@volter/game-editor 0.5.81 → 0.5.82

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 (324) hide show
  1. package/BUNDLED_NOTICES +22 -22
  2. package/catalog/entries/blender.json +2 -2
  3. package/catalog/entries/music.json +2 -2
  4. package/dist/.vite/manifest.json +2138 -2137
  5. package/dist/assets/{AssetBudgetPanel-CfVYW4ED.js → AssetBudgetPanel-Iip49rxI.js} +3 -3
  6. package/dist/assets/{AudioViewer-J10BXrtm.js → AudioViewer-DmkOvskF.js} +1 -1
  7. package/dist/assets/{CanvasBoardDocument-BgIbuOQF.js → CanvasBoardDocument-DCS8uzQo.js} +1 -1
  8. package/dist/assets/CanvasSceneViewport-CfOuQiQ0.js +1 -0
  9. package/dist/assets/{ColorInput-fX1V5l8_.js → ColorInput-7CPpl8MI.js} +1 -1
  10. package/dist/assets/EntityModelDocument-CplmAib0.js +1 -0
  11. package/dist/assets/{EnvironmentAssetDocument-QuLkCom9.js → EnvironmentAssetDocument-DlS6KFJu.js} +1 -1
  12. package/dist/assets/{GameplaySessionTimeline-D0z5Mc0R.js → GameplaySessionTimeline-C3zH6edi.js} +1 -1
  13. package/dist/assets/{ImageViewer-DWUPPWRf.js → ImageViewer-C0lQ6YO0.js} +1 -1
  14. package/dist/assets/InspectorObjectPreview-Bjc1Tn-I.js +1 -0
  15. package/dist/assets/{JsonAssetDocument-C0Lr6RwY.js → JsonAssetDocument-DjmH9CQH.js} +1 -1
  16. package/dist/assets/{LiveModuleDocument-CaGmr0EA.js → LiveModuleDocument-Hiot8Q5L.js} +1 -1
  17. package/dist/assets/{LutAssetDocument-B6GmsOYd.js → LutAssetDocument-6bBwNMOn.js} +1 -1
  18. package/dist/assets/{ModelAssetDocument-BBDnXTQm.js → ModelAssetDocument-G6ajiV51.js} +1 -1
  19. package/dist/assets/{NonThreeAuthoringBootstrap-byKqf1kp.js → NonThreeAuthoringBootstrap-DpieYAMC.js} +1 -1
  20. package/dist/assets/Object3DDocumentToolbar-BtZkDxKa.js +1 -0
  21. package/dist/assets/Object3DDocumentViewport-BhH8afDi.js +2 -0
  22. package/dist/assets/{Object3DPreview-pn9i3vwZ.js → Object3DPreview-DdrYVJUZ.js} +1 -1
  23. package/dist/assets/{OnlineAssetDetail-PDCDAcqz.js → OnlineAssetDetail-D06eTe3y.js} +1 -1
  24. package/dist/assets/{PlayBar-DEnkv3v6.js → PlayBar-BbzjgLFJ.js} +1 -1
  25. package/dist/assets/{QuarksAssetDocument-2x66XymD.js → QuarksAssetDocument-wGHNt4ov.js} +1 -1
  26. package/dist/assets/{ReactCanvasControls-rFwp2CeP.js → ReactCanvasControls-BL2tOUj6.js} +1 -1
  27. package/dist/assets/{RootSelectionOverlay-B9rf-SSV.js → RootSelectionOverlay-C6Wu8nIs.js} +1 -1
  28. package/dist/assets/{ShaderAssetDocument-ImI6jbzB.js → ShaderAssetDocument-BDi8iNLA.js} +4 -4
  29. package/dist/assets/{ShadowEditor-DXxVxTzk.js → ShadowEditor-C3L0UWSH.js} +1 -1
  30. package/dist/assets/{SourceAssetViewer-CMbp_o7v.js → SourceAssetViewer-D832bARo.js} +1 -1
  31. package/dist/assets/StageHost-Bor1eHEO.js +2 -0
  32. package/dist/assets/{StoryPreviewMount-D2zLWzWy.js → StoryPreviewMount-CmOEFzZY.js} +1 -1
  33. package/dist/assets/{ThreeBoardDocument-nX3UiY3u.js → ThreeBoardDocument-BtBMGtiQ.js} +2 -2
  34. package/dist/assets/{ThreeIsolationSceneContent-CGHM0vsg.js → ThreeIsolationSceneContent-BEHNSEsi.js} +1 -1
  35. package/dist/assets/{ToolObject3DPreview-BfNcqtFv.js → ToolObject3DPreview-76LMkfin.js} +1 -1
  36. package/dist/assets/{Toolbar-BJRJsbHG.js → Toolbar-BEBQdxRz.js} +1 -1
  37. package/dist/assets/{TransientHint-CDvYgnzu.js → TransientHint-CzsdY8W6.js} +1 -1
  38. package/dist/assets/{VideoViewer-B6Dv2zeQ.js → VideoViewer-Ckrawyuq.js} +1 -1
  39. package/dist/assets/{ViewportShadingMenu-CrTY7tnk.js → ViewportShadingMenu-BofQt6_4.js} +1 -1
  40. package/dist/assets/{active-ingest-lrfMBhf9.js → active-ingest-D_ryI_R4.js} +2 -2
  41. package/dist/assets/{animation-clock-DktVGV5-.js → animation-clock-QjtJDIsR.js} +1 -1
  42. package/dist/assets/{animation-mixers.service-fkojNtor.js → animation-mixers.service-BInUs1US.js} +1 -1
  43. package/dist/assets/{animation-timeline.utility-DDrUZKe8.js → animation-timeline.utility-DUrfNSwn.js} +1 -1
  44. package/dist/assets/{asset-budget-asset.menu-CDlgKSO9.js → asset-budget-asset.menu-DVQEksFp.js} +1 -1
  45. package/dist/assets/{asset-budget.action-D6n-wIR3.js → asset-budget.action-C-ENAa52.js} +1 -1
  46. package/dist/assets/{asset-budget.document-DFByoagB.js → asset-budget.document-Bb1PyL3H.js} +1 -1
  47. package/dist/assets/{asset-budget.menu-B2u_1dWR.js → asset-budget.menu-CPi2yjBA.js} +1 -1
  48. package/dist/assets/{asset-editor-persistence-e6bYhVnm.js → asset-editor-persistence-Duoq7o22.js} +1 -1
  49. package/dist/assets/{asset-loaders-Bsq-3hNt.js → asset-loaders-BftJ2m7-.js} +1 -1
  50. package/dist/assets/{asset-preview-B7j9QV6N.js → asset-preview-BS71mXsZ.js} +1 -1
  51. package/dist/assets/{audio-unlock.service-7oO4YVIj.js → audio-unlock.service-C3ygvDjU.js} +1 -1
  52. package/dist/assets/{audio.utility-9fcsT3YY.js → audio.utility-DF55sgHW.js} +1 -1
  53. package/dist/assets/autoplay.service-DaonKf7O.js +1 -0
  54. package/dist/assets/{babylon-authoring-adapter-BJfYxqDM.js → babylon-authoring-adapter-CmeehOBt.js} +1 -1
  55. package/dist/assets/{binding-resolver-CBXePHiR.js → binding-resolver-DUz8C8Fs.js} +2 -2
  56. package/dist/assets/{blender-node-editor.document-xA7eGv3-.js → blender-node-editor.document-B8S2TVMM.js} +1 -1
  57. package/dist/assets/{blender-properties-tab-nY8UOQUL.js → blender-properties-tab-y-_BeZDx.js} +1 -1
  58. package/dist/assets/blender-runtime-host-CUH6peXj.js +4 -0
  59. package/dist/assets/{blender-runtime-skin-D3Arti9-.js → blender-runtime-skin-B1tYITn2.js} +36 -36
  60. package/dist/assets/blender-runtime.document-DnSl0twI.js +12 -0
  61. package/dist/assets/{blender-timeline.document-DXoQ7y8E.js → blender-timeline.document-CeCylyXB.js} +1 -1
  62. package/dist/assets/{blender-uv-editor.document-CMOyob1N.js → blender-uv-editor.document-DEllMw3a.js} +1 -1
  63. package/dist/assets/{blender-version.status-16xnuezC.js → blender-version.status-CrT9NqK-.js} +1 -1
  64. package/dist/assets/{blender.command-Br2EUk6Q.js → blender.command-GIjMG1-m.js} +1 -1
  65. package/dist/assets/{board-guides-whelE-Dr.js → board-guides-B6TEPOPi.js} +1 -1
  66. package/dist/assets/{bridge.command-T93eURWq.js → bridge.command-D6qTcgje.js} +3 -3
  67. package/dist/assets/{browserAll-BfZu7-UJ.js → browserAll-k35XRFil.js} +1 -1
  68. package/dist/assets/build-player.document-CHxj4P8q.js +1 -0
  69. package/dist/assets/{build-profiles.document-DNncGOL3.js → build-profiles.document-CZCk1HYA.js} +2 -2
  70. package/dist/assets/{build-progress.status-DnJetNft.js → build-progress.status-BNwBxP2a.js} +1 -1
  71. package/dist/assets/{build-session-BaEmzCkm.js → build-session-CW2UyYFF.js} +1 -1
  72. package/dist/assets/{build.action-exbllMgM.js → build.action-EmCcMu47.js} +1 -1
  73. package/dist/assets/{build.command-Imykh8LN.js → build.command-CzEckGcR.js} +1 -1
  74. package/dist/assets/{build.header-9RzLy3UQ.js → build.header-CsYLpZbh.js} +1 -1
  75. package/dist/assets/{build.menu-CRhA3yID.js → build.menu-CaDkDQuy.js} +1 -1
  76. package/dist/assets/{build.service-CxIdSEPw.js → build.service-BcKtbU0-.js} +1 -1
  77. package/dist/assets/{camera-BiBGeQQ4.js → camera-BwWZUyKt.js} +1 -1
  78. package/dist/assets/{camera-runtime.inspector-DmRFynxC.js → camera-runtime.inspector-CJyi3zmp.js} +1 -1
  79. package/dist/assets/{canvas-design-mount-DJ6zQJKG.js → canvas-design-mount-B_uwZkEU.js} +6 -6
  80. package/dist/assets/{canvas-entry-runtime-Cjga4XYp.js → canvas-entry-runtime-DskaohHK.js} +2 -2
  81. package/dist/assets/{canvas-preview-frames-EoYgD6W4.js → canvas-preview-frames-BzLeTumX.js} +1 -1
  82. package/dist/assets/{canvas-story-capture.service-D5UntNCd.js → canvas-story-capture.service-C80CsS8r.js} +2 -2
  83. package/dist/assets/{capability-coverage-9qm5WVwt.js → capability-coverage-wd6bAhv3.js} +2 -2
  84. package/dist/assets/{collaboration-presence-Q6zcL5v0.js → collaboration-presence-DcPhahtF.js} +1 -1
  85. package/dist/assets/{collider-CTHtUvnl.js → collider-Dw2iWV3F.js} +1 -1
  86. package/dist/assets/{component-board.service-Bf-ETQF0.js → component-board.service-CH99sgj0.js} +2 -2
  87. package/dist/assets/component-board.service-Cd1c9oSN.js +2 -0
  88. package/dist/assets/{component-board.service-foqmr9Ii.js → component-board.service-XAxyLCnM.js} +2 -2
  89. package/dist/assets/{component-contracts.service-Do9hADdW.js → component-contracts.service-DerT0BP-.js} +1 -1
  90. package/dist/assets/{component-instance-root-MBgAuUpp.js → component-instance-root-Cw_-ajBX.js} +1 -1
  91. package/dist/assets/{component-verbs.command-DtMdPuyO.js → component-verbs.command-BHK9M2Rk.js} +1 -1
  92. package/dist/assets/component-verbs.service-DsxhVcvk.js +1 -0
  93. package/dist/assets/{config-B6tt9xy3.js → config-1rCvm02z.js} +3 -3
  94. package/dist/assets/configurations-CRTYw0r9.js +1 -0
  95. package/dist/assets/{connection.status-BNPvWdJD.js → connection.status-D4fjnH24.js} +1 -1
  96. package/dist/assets/{constraints.inspector-DoOn25Lk.js → constraints.inspector-BgnafOLf.js} +1 -1
  97. package/dist/assets/{content-bounds-BFpR_e--.js → content-bounds-D5pXeHJN.js} +1 -1
  98. package/dist/assets/{contract-system-adapters-BRHtWOi_.js → contract-system-adapters-rVGdworX.js} +1 -1
  99. package/dist/assets/{coverage.service-BB1XhwsL.js → coverage.service-BNme5Agb.js} +1 -1
  100. package/dist/assets/{create-runtime-B6u6x5eK.js → create-runtime-CcuQTSfy.js} +2 -2
  101. package/dist/assets/{curve-D11mIGoN.js → curve-DorFv33R.js} +1 -1
  102. package/dist/assets/{data-asset-DejEwzXj.js → data-asset-CAE35Emh.js} +1 -1
  103. package/dist/assets/{data-ref-DJNVzksb.js → data-ref-DXqRnZsJ.js} +1 -1
  104. package/dist/assets/{debug-bridge-DlGIEyTc.js → debug-bridge-DdCJSEni.js} +1 -1
  105. package/dist/assets/{debug-registry-Dagj3b6J.js → debug-registry-xQJcVubm.js} +1 -1
  106. package/dist/assets/deferred-ingest-play-CEnsC3uN.js +2 -0
  107. package/dist/assets/{design-time-canvas-mount-Cpb_jITI.js → design-time-canvas-mount-CPRrCPFA.js} +2 -2
  108. package/dist/assets/design-time-layers-hmGqBp06.js +1 -0
  109. package/dist/assets/{design-time-mount.service-Ck5Hjxtn.js → design-time-mount.service-CEmJjRIJ.js} +2 -2
  110. package/dist/assets/{design-time-mount.service-DEa-41ij.js → design-time-mount.service-CLL-1Za4.js} +2 -2
  111. package/dist/assets/{design-time-react-mount-DCTpYS51.js → design-time-react-mount-DmXi3GBy.js} +1 -1
  112. package/dist/assets/{document-preview-three-TjlxMDBR.js → document-preview-three-B4j_zNef.js} +1 -1
  113. package/dist/assets/{dom-authoring-adapter-C3ZsI41l.js → dom-authoring-adapter-BklRbjZB.js} +1 -1
  114. package/dist/assets/{draco3d-Ddr7J1sS.js → draco3d-CFWI1XDT.js} +1 -1
  115. package/dist/assets/{edit-mode-audio.service-D047aZ6I.js → edit-mode-audio.service-SUzv0nHs.js} +1 -1
  116. package/dist/assets/{edit-mode-authoring-DubxVdEM.js → edit-mode-authoring-CSt3zzmS.js} +1 -1
  117. package/dist/assets/{edit-mode-networking.service-DitjC2ZL.js → edit-mode-networking.service-D6UohrCr.js} +1 -1
  118. package/dist/assets/editor-api-WeHVNlEo.js +1 -0
  119. package/dist/assets/{editor-layers-BK3fNRb7.js → editor-layers-CjeYrUlm.js} +1 -1
  120. package/dist/assets/{editor-shell-store-Bro0arjr.js → editor-shell-store-DckLm6m8.js} +1 -1
  121. package/dist/assets/{entity-object-BFppZ54X.js → entity-object-V13bGmay.js} +1 -1
  122. package/dist/assets/{extend-MkXq6t1H.js → extend-BQeRA-aV.js} +1 -1
  123. package/dist/assets/{fork-menu-DzoCyQvA.js → fork-menu-Bthg9viY.js} +1 -1
  124. package/dist/assets/{frame-debugger-store-xbOH83D0.js → frame-debugger-store-DDxWlDPK.js} +1 -1
  125. package/dist/assets/{game-contract-seams-5IUqvr7b.js → game-contract-seams-DrYyE5PX.js} +1 -1
  126. package/dist/assets/{game-css-scope-transform-DDAoTvZQ.js → game-css-scope-transform-D5hQWaci.js} +1 -1
  127. package/dist/assets/game-document.service-cJ1yKc2V.js +1 -0
  128. package/dist/assets/{game-eval.command-DcFoKUe7.js → game-eval.command-CKo-W17_.js} +1 -1
  129. package/dist/assets/{game-module-access-ABBzTWg7.js → game-module-access-DuptGLGx.js} +1 -1
  130. package/dist/assets/game-network-CAH_Jsh6.js +22 -0
  131. package/dist/assets/gameplay-export-B-JE4uSD.js +1 -0
  132. package/dist/assets/gameplay-replay-WyopKGyB.js +1 -0
  133. package/dist/assets/{gameplay.command-qdQLKC3A.js → gameplay.command-D4cY3nOq.js} +1 -1
  134. package/dist/assets/generation-jobs-CcCrhKLM.js +1 -0
  135. package/dist/assets/{generation.service-CdwRWoIV.js → generation.service-CQwmLAOQ.js} +1 -1
  136. package/dist/assets/{generations-nW4LG5qG.js → generations-qfhCRH8C.js} +1 -1
  137. package/dist/assets/{generations.status-DgjVrgGL.js → generations.status-CcbR2OfF.js} +1 -1
  138. package/dist/assets/{hierarchy-marks-Pb6wnNcu.js → hierarchy-marks-B1jSqxSv.js} +1 -1
  139. package/dist/assets/{hosted-asset-materialization-BCnTLunr.js → hosted-asset-materialization-BZf-8JA1.js} +1 -1
  140. package/dist/assets/{index-Bz4YDJ7o.js → index-CHa43s2p.js} +1 -1
  141. package/dist/assets/{index-BYoN6-Qw.js → index-Cj_b0Ygc.js} +1 -1
  142. package/dist/assets/{index-Db2ixdvK.js → index-D-RMHSzb.js} +1 -1
  143. package/dist/assets/{index-D7q1gYjq.js → index-DXtfej3G.js} +1 -1
  144. package/dist/assets/{index-BlWeDGvp.js → index-D_ViOFCz.js} +2 -2
  145. package/dist/assets/{index-Ds9fZyOU.js → index-DrEVdQvN.js} +1 -1
  146. package/dist/assets/{index-CvGsVzTo.js → index-V4J7xfRg.js} +7 -7
  147. package/dist/assets/{index-CaZZDx3x.js → index-aREcGExk.js} +1 -1
  148. package/dist/assets/index-yXSK_qPW.js +1 -0
  149. package/dist/assets/{inference-diagnostics-BCwXk-CS.js → inference-diagnostics-DoZQ1mpg.js} +1 -1
  150. package/dist/assets/{ingest-boot-viewport-BPER30gQ.js → ingest-boot-viewport-DWdOtGGE.js} +1 -1
  151. package/dist/assets/ingest-siblings-DyvasVDH.js +1 -0
  152. package/dist/assets/{ingest-source-persistence-CPlDA2D8.js → ingest-source-persistence-CQOJeGhj.js} +1 -1
  153. package/dist/assets/{ingest.service-BhwFGlqY.js → ingest.service-CqIcydem.js} +1 -1
  154. package/dist/assets/{inspect-DxfAFkho.js → inspect-DiSjB-N1.js} +1 -1
  155. package/dist/assets/instances.command-COw2QpbN.js +1 -0
  156. package/dist/assets/{json-history-resource-CckDydoO.js → json-history-resource-CH2nzMZh.js} +1 -1
  157. package/dist/assets/{layered-pick-BaxBYi7u.js → layered-pick-BUr1U8lU.js} +1 -1
  158. package/dist/assets/{light-DF4nTzTq.js → light-CxiGIJma.js} +1 -1
  159. package/dist/assets/live-project-verbs-CnknlUlT.js +1 -0
  160. package/dist/assets/{machine.document-DaPLAXaa.js → machine.document-D7jMrzXt.js} +1 -1
  161. package/dist/assets/{machines.finder-C9s8SFtp.js → machines.finder-Dor3O0uf.js} +1 -1
  162. package/dist/assets/{material-rGFsBrD0.js → material-B6cH1Oqw.js} +1 -1
  163. package/dist/assets/{material-factory-CCcnlv8E.js → material-factory-BN3Lax5C.js} +1 -1
  164. package/dist/assets/{mesh-CVBvSsCX.js → mesh-Cj-CYroI.js} +1 -1
  165. package/dist/assets/{model-asset-sections.service-vVRv6iOD.js → model-asset-sections.service-mC4WJFTA.js} +1 -1
  166. package/dist/assets/{model-inspection-Dd-hn5v2.js → model-inspection-8o57YSZW.js} +1 -1
  167. package/dist/assets/{model-thumbnail-BDU_QU37.js → model-thumbnail-chePRlH7.js} +1 -1
  168. package/dist/assets/{models.finder-CQMZz5xX.js → models.finder-CKkT5ZdU.js} +1 -1
  169. package/dist/assets/{module-mode-DcBz3aI7.js → module-mode-BMiMhHI3.js} +2 -2
  170. package/dist/assets/{mount-canvas-ingest-root-DMWeT_c3.js → mount-canvas-ingest-root-B1swVIUJ.js} +2 -2
  171. package/dist/assets/{mount-dom-ingest-root-Bx1TmleJ.js → mount-dom-ingest-root-B8hO5mht.js} +2 -2
  172. package/dist/assets/{mount-ingest-root-BDP8atUq.js → mount-ingest-root-Cbnh-mSw.js} +2 -2
  173. package/dist/assets/{mount-manifest-C5QVCZlS.js → mount-manifest-B7oL1Abg.js} +1 -1
  174. package/dist/assets/{mount-three-ingest-root-DSmhgOJn.js → mount-three-ingest-root-BdUJx6ix.js} +1 -1
  175. package/dist/assets/{mounted-authoring-D-tXkNKH.js → mounted-authoring-C47L5H5t.js} +1 -1
  176. package/dist/assets/{mounted-story-viewport-source-Snu9yn1n.js → mounted-story-viewport-source-CyEK_vaq.js} +1 -1
  177. package/dist/assets/{native-debug-module-XfhvyMrK.js → native-debug-module-JJOFtIVz.js} +1 -1
  178. package/dist/assets/{navigation-CTTcWe0R.js → navigation-ROJM2w84.js} +1 -1
  179. package/dist/assets/{navmesh.menu-mFjQ30B0.js → navmesh.menu-DjefqtkI.js} +1 -1
  180. package/dist/assets/{navmesh.service-BJPp7ZXu.js → navmesh.service-BPqjEQiq.js} +1 -1
  181. package/dist/assets/network-observer.service-GFzXuBMb.js +1 -0
  182. package/dist/assets/{network.utility-C-_7MTIV.js → network.utility-6Y5u53n8.js} +1 -1
  183. package/dist/assets/object3d-document-session-registry-DNCOGA3i.js +2 -0
  184. package/dist/assets/{oid-transform-Bgdv7kST.js → oid-transform-DQzN_Gl_.js} +1 -1
  185. package/dist/assets/{particles-CHXYb9Jd.js → particles-DGdUmqOr.js} +1 -1
  186. package/dist/assets/{pixi-authoring-adapter-lj5CidSR.js → pixi-authoring-adapter-BRktdcIz.js} +1 -1
  187. package/dist/assets/{pixi-live-write-target-BEL9GCCr.js → pixi-live-write-target-Dg0mdLaa.js} +1 -1
  188. package/dist/assets/play.command-4IDAqR5W.js +2 -0
  189. package/dist/assets/{presentation-CmK-bEDi.js → presentation-8m-RDKIS.js} +1 -1
  190. package/dist/assets/{product-gjrRHe-K.js → product-t6tauO7R.js} +1 -1
  191. package/dist/assets/{profiler.action-CZ6UQi9A.js → profiler.action-CXA4IkQB.js} +1 -1
  192. package/dist/assets/{profiler.menu-DxbnC3d6.js → profiler.menu-BgIBv4-I.js} +1 -1
  193. package/dist/assets/{profiler.utility-BvARl7sM.js → profiler.utility-BYoRbfIK.js} +1 -1
  194. package/dist/assets/{project-authoring-session-CBKXzBlD.js → project-authoring-session-DkekCxNv.js} +2 -2
  195. package/dist/assets/{properties-bone-constraints.inspector-Co8UpbhC.js → properties-bone-constraints.inspector-DXpiCtf9.js} +1 -1
  196. package/dist/assets/{properties-bone.inspector-CFXh2lQH.js → properties-bone.inspector-wIDsP4c5.js} +1 -1
  197. package/dist/assets/{properties-collection.inspector-Jq9X8fEq.js → properties-collection.inspector-5SRPbqfM.js} +1 -1
  198. package/dist/assets/{properties-constraints.inspector-CMcKD_Jc.js → properties-constraints.inspector-DIjKz692.js} +1 -1
  199. package/dist/assets/{properties-data.inspector-cP3izSat.js → properties-data.inspector-DE6i8biZ.js} +1 -1
  200. package/dist/assets/{properties-material.inspector-CrZIovv9.js → properties-material.inspector-Cu1UCPY4.js} +1 -1
  201. package/dist/assets/{properties-modifiers.inspector-DqQMxoiL.js → properties-modifiers.inspector-DsQzA638.js} +1 -1
  202. package/dist/assets/{properties-object.inspector-DM63eANJ.js → properties-object.inspector-C57X0GJq.js} +1 -1
  203. package/dist/assets/{properties-output.inspector-B475IBEd.js → properties-output.inspector-DzrcFuRM.js} +1 -1
  204. package/dist/assets/{properties-particles.inspector-vGXQ4kWx.js → properties-particles.inspector-DGqSnelN.js} +1 -1
  205. package/dist/assets/{properties-physics.inspector-CfwqpVGS.js → properties-physics.inspector-DIjhtiLe.js} +1 -1
  206. package/dist/assets/{properties-render.inspector-BYLknsM7.js → properties-render.inspector-CX0orwn9.js} +1 -1
  207. package/dist/assets/{properties-scene.inspector-BcIZBfGk.js → properties-scene.inspector-DaHNL_sq.js} +1 -1
  208. package/dist/assets/{properties-texture.inspector-p3Owurhl.js → properties-texture.inspector-B5hmxPRy.js} +1 -1
  209. package/dist/assets/{properties-view-layer.inspector-CN-5jzB9.js → properties-view-layer.inspector-C7hdJgei.js} +1 -1
  210. package/dist/assets/{properties-world.inspector-DVp8fYWx.js → properties-world.inspector-EWTC6jNw.js} +1 -1
  211. package/dist/assets/r3f-design-session-CXlGV9hp.js +2 -0
  212. package/dist/assets/{r3f-physics-binding-BcTFD1ZS.js → r3f-physics-binding-DZSIB0d_.js} +1 -1
  213. package/dist/assets/{r3f-source-authoring-adapter-DVnhzoxp.js → r3f-source-authoring-adapter-GR97EmII.js} +1 -1
  214. package/dist/assets/{react-canvas-navigation-CBorZtWB.js → react-canvas-navigation-L_mOnybL.js} +1 -1
  215. package/dist/assets/{react-inspector.service-Dc99kogU.js → react-inspector.service-B4P3UnSY.js} +1 -1
  216. package/dist/assets/{react-story-board-6-BjI32N.js → react-story-board-CT1_3sk_.js} +1 -1
  217. package/dist/assets/{react-three-rapier.esm-BO2XPUEM.js → react-three-rapier.esm-DyMNYoA_.js} +1 -1
  218. package/dist/assets/{react-world-authoring-adapter-B6BiehHR.js → react-world-authoring-adapter-OR1SW2jI.js} +1 -1
  219. package/dist/assets/{realm-services-DCnaxwIb.js → realm-services-u0mnjXU9.js} +1 -1
  220. package/dist/assets/{reflection-probe-capture.inspector-CWneVfEe.js → reflection-probe-capture.inspector-CTNlSaGW.js} +1 -1
  221. package/dist/assets/{registry-BQ9YcFZF.js → registry-wqakYaDW.js} +1 -1
  222. package/dist/assets/{relative-import-specifier-BvzqkvYS.js → relative-import-specifier-DXWVQf0o.js} +1 -1
  223. package/dist/assets/{render-env-F320_iHT.js → render-env-CN09NtDf.js} +1 -1
  224. package/dist/assets/{render-features-DFwHsGxu.js → render-features-HCEupUJ6.js} +1 -1
  225. package/dist/assets/{render-settings-BPcHd4LA.js → render-settings-Clt6d05o.js} +1 -1
  226. package/dist/assets/{resolve-three-CnxafYrg.js → resolve-three-CLzKVMx2.js} +13 -13
  227. package/dist/assets/{root-seam-contract-CueaHgB9.js → root-seam-contract-D2uQHWF9.js} +1 -1
  228. package/dist/assets/{run-selection-BMQWV9Fn.js → run-selection-AyelFc9T.js} +1 -1
  229. package/dist/assets/{scene-capture-DcMYbX9_.js → scene-capture-WbPcLfJl.js} +1 -1
  230. package/dist/assets/{scene-document.service-CZpLI3b6.js → scene-document.service-4U6rDhCp.js} +2 -2
  231. package/dist/assets/{scene-framing-nVyYC4Y-.js → scene-framing-DzSL2Cld.js} +1 -1
  232. package/dist/assets/{seeded-random-D0QPgfm6.js → seeded-random-tpdJjdqy.js} +1 -1
  233. package/dist/assets/{setup-renderer-ji8Qt-PP.js → setup-renderer-B5vZmCyu.js} +1 -1
  234. package/dist/assets/{source-object3d-authoring-adapter-owosRx07.js → source-object3d-authoring-adapter-BQnQ3Qzg.js} +1 -1
  235. package/dist/assets/{source-persistence-backend-Djuk0m-7.js → source-persistence-backend-uyd6NiWD.js} +1 -1
  236. package/dist/assets/stage-keyboard-B2yrk2zu.js +1 -0
  237. package/dist/assets/stage-overlay-set-Cqtz3s06.js +1 -0
  238. package/dist/assets/{stage-presence-markers-CQlXR9fX.js → stage-presence-markers-BgLs0Aj5.js} +1 -1
  239. package/dist/assets/stage-transform-tools-BHcz53td.js +1 -0
  240. package/dist/assets/{standard-viewport-dressing-e4mnLmI6.js → standard-viewport-dressing-uhv_3JvQ.js} +2 -2
  241. package/dist/assets/{state-watch.action-Cv3W67Kr.js → state-watch.action-BJ08HgcO.js} +1 -1
  242. package/dist/assets/{state-watch.menu-Cuziz9RM.js → state-watch.menu-rAULwijr.js} +1 -1
  243. package/dist/assets/{state-watch.utility-B1zkFd_6.js → state-watch.utility-eEbQcj8t.js} +1 -1
  244. package/dist/assets/{story-capture-Drqhmo7i.js → story-capture-B8wfSf5s.js} +1 -1
  245. package/dist/assets/{story-documents-Cjoy-ydN.js → story-documents-Cm4jCkW5.js} +2 -2
  246. package/dist/assets/{story-documents.service-gVxcUtso.js → story-documents.service-BDvQCslK.js} +1 -1
  247. package/dist/assets/{story-documents.service-Csto-LsX.js → story-documents.service-Cgtg6rXn.js} +1 -1
  248. package/dist/assets/story-media-presence-SGlp_afL.js +1 -0
  249. package/dist/assets/{story-pixi-preview-uA6AevDw.js → story-pixi-preview-D62Q_vIW.js} +1 -1
  250. package/dist/assets/{story-presentation-DgAoj9Qt.js → story-presentation-CofUdEU7.js} +1 -1
  251. package/dist/assets/{story-three-preview-CQYi1rZ_.js → story-three-preview-B9O1wapP.js} +2 -2
  252. package/dist/assets/{studio-environment-DK0ke0m0.js → studio-environment-BIhqrtFc.js} +1 -1
  253. package/dist/assets/{surface-state-DlUcJe84.js → surface-state-DrM3wsrr.js} +1 -1
  254. package/dist/assets/{syntactic-prop-specs-92aOVqyZ.js → syntactic-prop-specs-BGz0N7Dg.js} +1 -1
  255. package/dist/assets/{team-playtest.service-CGBismiY.js → team-playtest.service-CiE8UJAe.js} +1 -1
  256. package/dist/assets/{three-bdxPiUPb.js → three-BQfhEwUz.js} +1 -1
  257. package/dist/assets/{three-authoring-adapter-BuqO9MDt.js → three-authoring-adapter-COBwREQO.js} +1 -1
  258. package/dist/assets/three-authoring.service-C0azvoq8.js +2 -0
  259. package/dist/assets/{three-ingest-runtime-CwRnwvb0.js → three-ingest-runtime-BnRF_nJN.js} +1 -1
  260. package/dist/assets/three-integration-DeWYFf1x.js +2 -0
  261. package/dist/assets/three-integration.service-CoWCBTmg.js +1 -0
  262. package/dist/assets/{three-projection-core-BO23VKAP.js → three-projection-core-PQm-CO61.js} +1 -1
  263. package/dist/assets/{three-state-BhQOBgKC.js → three-state-C7khRIQE.js} +1 -1
  264. package/dist/assets/{three-story-capture.service-BAtrzxHq.js → three-story-capture.service-B0oiGIfp.js} +2 -2
  265. package/dist/assets/three-story-model-D7g2pqfJ.js +1 -0
  266. package/dist/assets/{three-viewport-presentation-CWanX03c.js → three-viewport-presentation-B_tBudM-.js} +5 -5
  267. package/dist/assets/transform-mode-request-DWM6BdRA.js +1 -0
  268. package/dist/assets/{transport-strip-CFLRAIQd.js → transport-strip-vgXGDgkI.js} +1 -1
  269. package/dist/assets/transport.header-CfVHXjrT.js +1 -0
  270. package/dist/assets/{tuples-BKzzn3tK.js → tuples-BnYrlQqS.js} +1 -1
  271. package/dist/assets/ui-board-document-B_-K9luq.js +2 -0
  272. package/dist/assets/{user-data-DfBtZvxw.js → user-data-CifDDvSr.js} +1 -1
  273. package/dist/assets/{utility-view-state-CL4NJh3n.js → utility-view-state-BPl8Asup.js} +1 -1
  274. package/dist/assets/{viewport-door-CuJjGYTz.js → viewport-door-BCXEYmon.js} +1 -1
  275. package/dist/assets/{viewport-root-presentation-CkSAEMH-.js → viewport-root-presentation-DJLpUuf0.js} +1 -1
  276. package/dist/assets/{viewport-surface-status-D3t-0oLs.js → viewport-surface-status-jwLhIK_M.js} +1 -1
  277. package/dist/assets/{webworkerAll-DCmB9rsA.js → webworkerAll-P6jePa6X.js} +1 -1
  278. package/dist/assets/{workspace-arrangement-C9uemwSK.js → workspace-arrangement-B_OcbQbj.js} +1 -1
  279. package/dist/assets/{world-documents-Dvn8e5I0.js → world-documents-Bx3j867R.js} +1 -1
  280. package/dist/assets/{world-root-stage-binding-BB7acZV_.js → world-root-stage-binding-LEhjWDkn.js} +1 -1
  281. package/dist/assets/{xstate-animation-binding-DctwT981.js → xstate-animation-binding-Dionc_fC.js} +1 -1
  282. package/dist/assets/{xstate-animation-meta-s4Vc8Wu3.js → xstate-animation-meta-XEmD_qc_.js} +1 -1
  283. package/dist-node/cli.js +16 -16
  284. package/package.json +16 -16
  285. package/dist/assets/CanvasSceneViewport-Z8OReqpB.js +0 -1
  286. package/dist/assets/EntityModelDocument-BltE1A7W.js +0 -1
  287. package/dist/assets/InspectorObjectPreview-BpttBw3o.js +0 -1
  288. package/dist/assets/Object3DDocumentToolbar-BHuuMZnS.js +0 -1
  289. package/dist/assets/Object3DDocumentViewport-ByDDwGJD.js +0 -2
  290. package/dist/assets/StageHost-D1Sz5aud.js +0 -2
  291. package/dist/assets/autoplay.service-DncOrn-K.js +0 -1
  292. package/dist/assets/blender-runtime-host-CcqXT39s.js +0 -4
  293. package/dist/assets/blender-runtime.document-DDW5jIJe.js +0 -12
  294. package/dist/assets/build-player.document-DJQLP4xM.js +0 -1
  295. package/dist/assets/component-board.service-yIS2UB-T.js +0 -2
  296. package/dist/assets/component-verbs.service-CJYq28Zw.js +0 -1
  297. package/dist/assets/configurations-BcYOQ7i-.js +0 -1
  298. package/dist/assets/deferred-ingest-play-DZiOEH9a.js +0 -2
  299. package/dist/assets/design-time-layers-DT4X-pJp.js +0 -1
  300. package/dist/assets/editor-api-CPh65aBN.js +0 -1
  301. package/dist/assets/game-document.service-CxfiFnxt.js +0 -1
  302. package/dist/assets/game-network-BPTyOFqA.js +0 -22
  303. package/dist/assets/gameplay-export-CRnHCUBb.js +0 -1
  304. package/dist/assets/gameplay-replay-yPaMxi2o.js +0 -1
  305. package/dist/assets/generation-jobs-Cy1oE-Ff.js +0 -1
  306. package/dist/assets/index-BPuw4yre.js +0 -1
  307. package/dist/assets/ingest-siblings-2QHhcCgA.js +0 -1
  308. package/dist/assets/instances.command-BJ-I9vtW.js +0 -1
  309. package/dist/assets/live-project-verbs-B7S-wGjC.js +0 -1
  310. package/dist/assets/network-observer.service-CjeDB1Id.js +0 -1
  311. package/dist/assets/object3d-document-session-registry-CWaOPDYg.js +0 -2
  312. package/dist/assets/play.command-C9QyYFgv.js +0 -2
  313. package/dist/assets/r3f-design-session-Cyy1sDGH.js +0 -2
  314. package/dist/assets/stage-keyboard-G6HMStmP.js +0 -1
  315. package/dist/assets/stage-overlay-set-ChHqsFiR.js +0 -1
  316. package/dist/assets/stage-transform-tools-BM9u9Awe.js +0 -1
  317. package/dist/assets/story-media-presence-CYc2fP4y.js +0 -1
  318. package/dist/assets/three-authoring.service-CMym8IbB.js +0 -2
  319. package/dist/assets/three-integration-BHoulbny.js +0 -2
  320. package/dist/assets/three-integration.service-BlgF9hV3.js +0 -1
  321. package/dist/assets/three-story-model-D_bo7Gl-.js +0 -1
  322. package/dist/assets/transform-mode-request-Bg6T_rOC.js +0 -1
  323. package/dist/assets/transport.header-B3dK1KaC.js +0 -1
  324. package/dist/assets/ui-board-document-DMxgQ-9n.js +0 -2
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/axe-LkjAB6Lv.js","assets/_commonjsHelpers-D6-XlEtG.js"])))=>i.map(i=>d[i]);
2
- import{e$ as se,eI as ie,dw as ae,f0 as ce,f1 as le,f2 as K,f3 as H,a7 as U,eK as de,am as L,an as P,af as s,en as u,ep as d,a0 as A,es as ue,aR as ye,aM as V,_ as pe,f4 as fe,ao as me,ap as he,f5 as Q,f6 as ve,f7 as ge,f8 as xe,b8 as J,f9 as X,aw as Se}from"./index-CvGsVzTo.js";import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{R as we,f as be}from"./presentation-CmK-bEDi.js";import{e as Z,S as q}from"./surface-state-DlUcJe84.js";import{m as ee,r as je}from"./StoryPreviewMount-D2zLWzWy.js";import{d as te}from"./surface-content-Dg9Kkazf.js";const Re=se,y=new Map;let oe=0;const M=new Set;function m(){oe++;for(const t of M)t()}function E(t){return M.add(t),()=>{M.delete(t)}}function O(){return oe}function Ee(t,e){return`story:${t}#${e}`}function Oe(t,e){return`story-docs:${t}#${e}`}function $(){const t=K();if(!t||t.descriptor.kind!=="story")return null;const e=y.get(t.descriptor.id);return e?.mode==="preview"?{...e,id:t.descriptor.id}:null}function F(t,e,o){const n=y.get(t);if(n){if(o===void 0){const i={...n.argOverrides};delete i[e],n.argOverrides=i}else n.argOverrides={...n.argOverrides,[e]:o};m()}}function Ce(t,e,o){const n=y.get(t);n&&(n.actionLog=[...n.actionLog,{name:e,args:o,time:Date.now()}].slice(-200),m())}function Ne(t){const e=y.get(t);!e||e.actionLog.length===0||(e.actionLog=[],m())}function re(t,e,o,n={}){Ue();const i=Ee(e,o);y.has(i)||(y.set(i,{modulePath:e,storyName:o,mode:"preview",store:t,argOverrides:{},actionLog:[],playResult:null,accessibility:{status:"idle",violations:[]},container:null,previewReady:!1,previewRevision:0,resolution:{label:"Fill",width:null,height:null},scale:1}),m());const a=n.activate===void 0?{}:{activate:n.activate};return X({id:i,title:n.title??o,kind:"story",workspaceRole:"authored-subject",provenance:{sourcePath:e},Content:Pe,Toolbar:$e,closeable:!0,presentation:()=>({kind:"story",modulePath:e,storyName:o,mode:"preview"}),persist:()=>({modulePath:e,storyName:o}),onDispose:p=>{y.delete(p)&&m()}},a)}function Y(t,e,o){const n=Oe(e,o);return y.has(n)||(y.set(n,{modulePath:e,storyName:o,mode:"docs",store:t,argOverrides:{},actionLog:[],playResult:null,accessibility:{status:"idle",violations:[]},container:null,previewReady:!1,previewRevision:0,resolution:{label:"Fill",width:null,height:null},scale:1}),m()),X({id:n,title:`${o} — Docs`,kind:"story",workspaceRole:"workspace-reference",provenance:{sourcePath:e},Content:_e,closeable:!0,presentation:()=>({kind:"story",modulePath:e,storyName:o,mode:"docs"}),persist:()=>({modulePath:e,storyName:o,view:"docs"}),onDispose:i=>{y.delete(i)&&m()}})}function ke(){const t=Se();return t?xe(t).then(J,J):Promise.resolve()}fe({kind:"story",owner:"story-documents",prepare:ke,restore:({state:t,store:e})=>{const o=t,n=typeof o?.modulePath=="string"?o.modulePath:null,i=typeof o?.storyName=="string"?o.storyName:null;if(!n||!i)return!1;const a=P().find(c=>c.modulePath===n);if(!a?.ok||!a.stories.some(c=>c.name===i))return!1;if(o?.view==="docs")return Y(e,n,i),!0;const{medium:p}=me({modulePath:n,regions:he()});return p!=="dom"&&p!=="canvas"?!1:(re(e,n,i),!0)}});Q({id:ve,owner:"story-documents",open:(t,e)=>re(t,e.modulePath,e.storyName,{...e.title===void 0?{}:{title:e.title},...e.activate===void 0?{}:{activate:e.activate}})});Q({id:ge,owner:"story-documents",open:(t,e)=>Y(t,e.modulePath,e.storyName)});function W(t,e){const o=P().find(n=>n.modulePath===t);return o?o.ok?{story:o.stories.find(n=>n.name===e),moduleError:void 0}:{story:void 0,moduleError:o.error}:{story:void 0,moduleError:void 0}}function ne(t){const e=t.Component.args;return e&&typeof e=="object"?e:{}}function De(t,e){const o=y.get(t),n={};for(const[i,a]of Object.entries(ne(e)))typeof a=="function"&&(n[i]=(...p)=>(Ce(t,i,p),a(...p)));return{...n,...o?.argOverrides??{}}}function Pe({documentId:t}){l.useSyncExternalStore(E,O),l.useSyncExternalStore(L,()=>P());const e=y.get(t),o=l.useRef(null),n=l.useRef(null),[i,a]=l.useState(!1),[p,c]=l.useState("unknown"),[g,w]=l.useState(null),[z,T]=l.useState({width:0,height:0}),{story:b,moduleError:x}=e?W(e.modulePath,e.storyName):{story:void 0,moduleError:void 0},h=e?JSON.stringify(e.argOverrides):"";l.useEffect(()=>{const f=o.current;if(!f)return;if(typeof ResizeObserver>"u"){T({width:f.clientWidth,height:f.clientHeight});return}const j=new ResizeObserver(([R])=>{if(!R)return;const{width:_,height:k}=R.contentRect;T(D=>D.width===_&&D.height===k?D:{width:_,height:k})});return j.observe(f),()=>j.disconnect()},[]),l.useEffect(()=>{const f=n.current;if(!f||!e)return;e.container!==f&&(e.container=f,m());const j=e.previewRevision+1;if(e.previewRevision=j,e.previewReady=!1,e.playResult=null,e.accessibility={status:"idle",violations:[]},m(),c("unknown"),w(null),!b){a(!1),c("empty");return}let R=!1,_,k;const D=()=>{R||c(te(f)?"present":"empty")},G=new MutationObserver(D);return G.observe(f,{childList:!0,subtree:!0,characterData:!0}),a(!0),ee(f,e.modulePath,e.storyName,b.Component,De(t,b)).then(S=>{if(R){S?.unmount();return}if(!S){y.get(t)?.previewRevision===j&&(a(!1),c("empty"));return}const B=y.get(t);if(!B||B.previewRevision!==j){S.unmount();return}_=S.unmount,B.previewReady=!0,a(!1),k=setTimeout(D,0),m()},S=>{R||y.get(t)?.previewRevision!==j||(a(!1),w(S instanceof Error?S.message:String(S)),c("empty"))}),()=>{R=!0,G.disconnect(),k!==void 0&&clearTimeout(k),_?.()}},[t,e,b,h]);const C=e?.resolution.width===null,v=!e||C?1:be(z,{width:e.resolution.width,height:e.resolution.height}).scale;if(l.useEffect(()=>{!e||!Number.isFinite(v)||v<=0||e.scale===v||(e.scale=v,m())},[v,e]),!e)return r.jsx("div",{style:{padding:u[6],fontSize:d.md,color:s.content.muted,pointerEvents:"auto"},children:"This story document is no longer available."});const N=`${e.modulePath}#${e.storyName}`,I=b?g?{tone:"error",title:`Story ${N} failed`,description:g}:Z({surface:"Story",rootIds:[N],phase:i?"loading":"ready",content:p}):{tone:"error",title:`Story ${N} is unavailable`,description:x??`No story export named “${e.storyName}” exists in ${e.modulePath}; it may have been renamed or removed.`};return r.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",pointerEvents:"auto"},children:r.jsx("div",{ref:o,style:{position:"relative",flex:1,minHeight:0,overflow:"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsxs("div",{style:C?{position:"absolute",inset:0}:{position:"relative",width:e.resolution.width*v,height:e.resolution.height*v,flex:"0 0 auto"},children:[r.jsx("div",{"data-testid":"story-preview-root",ref:n,style:{position:"absolute",inset:0,isolation:"isolate",contain:"layout paint",overflow:"auto",background:s.surface.inset,...C?{}:{width:e.resolution.width,height:e.resolution.height,transform:`scale(${v})`,transformOrigin:"top left"}}}),r.jsx(q,{explanation:I,testId:"story-surface-status"})]})})})}function Te(t){const e=t.parameters.docs;if(!e||typeof e!="object")return{};const o=e.description;if(typeof o=="string")return{story:o};if(!o||typeof o!="object")return{};const n=o;return{...typeof n.component=="string"?{component:n.component}:{},...typeof n.story=="string"?{story:n.story}:{}}}function _e({documentId:t}){l.useSyncExternalStore(E,O),l.useSyncExternalStore(L,()=>P());const e=y.get(t),o=l.useRef(null),[n,i]=l.useState("unknown"),[a,p]=l.useState(null),{story:c,moduleError:g}=e?W(e.modulePath,e.storyName):{story:void 0,moduleError:void 0};if(l.useEffect(()=>{const x=o.current;if(!x||!e||!c)return;let h=!1,C=null,v;i("unknown"),p(null);const N=()=>{h||i(te(x)?"present":"empty")},I=new MutationObserver(N);return I.observe(x,{childList:!0,subtree:!0,characterData:!0}),ee(x,e.modulePath,e.storyName,c.Component).then(f=>{if(!f){h||i("empty");return}h?f.unmount():(C=f.unmount,v=setTimeout(N,0))},f=>{h||(p(f instanceof Error?f.message:String(f)),i("empty"))}),()=>{h=!0,I.disconnect(),v!==void 0&&clearTimeout(v),C?.()}},[e,c]),!e||!c)return r.jsx("div",{style:{padding:u[8],color:s.semantic.danger,fontSize:d.md},children:g??"This Storybook Docs document is no longer available."});const w=Te(c),z=c.args,T=`${e.modulePath}#${e.storyName}`,b=a?{tone:"error",title:`Story ${T} failed`,description:a}:Z({surface:"Story",rootIds:[T],phase:n==="unknown"?"loading":"ready",content:n});return r.jsx("article",{"data-testid":"story-docs-document",className:"volter-content-frost",style:{flex:1,minHeight:0,overflow:"auto",pointerEvents:"auto",padding:"24px clamp(18px, 5vw, 64px)"},children:r.jsxs("div",{style:{maxWidth:920,margin:"0 auto",display:"flex",flexDirection:"column",gap:22},children:[r.jsxs("header",{children:[r.jsx("div",{style:{color:s.content.dim,fontSize:d.base,marginBottom:5},children:c.title??e.modulePath}),r.jsx("h1",{style:{color:s.content.primary,fontSize:d.heading,margin:0},children:c.label}),(w.story??w.component)&&r.jsx("p",{style:{color:s.content.primary,lineHeight:1.6,maxWidth:760,whiteSpace:"pre-wrap"},children:w.story??w.component})]}),r.jsxs("section",{children:[r.jsx("h2",{style:{color:s.content.primary,fontSize:d.xl},children:"Canvas"}),r.jsxs("div",{style:{position:"relative",minHeight:180},children:[r.jsx("div",{ref:o,"data-testid":"story-docs-canvas",style:{position:"relative",isolation:"isolate",contain:"layout paint",minHeight:180,padding:18,overflow:"auto",background:s.surface.inset,border:`1px solid ${s.boundary.default}`,borderRadius:s.shape.medium}}),r.jsx(q,{explanation:b,testId:"story-docs-surface-status"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{style:{color:s.content.primary,fontSize:d.xl},children:"Args"}),r.jsxs("div",{style:{border:`1px solid ${s.boundary.default}`,borderRadius:s.shape.medium,overflow:"hidden"},children:[Object.entries(z).map(([x,h])=>r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(120px, .4fr) minmax(140px, .6fr) 1fr",gap:u[6],padding:`${u[4]} ${u[5]}`,borderBottom:`1px solid ${s.boundary.default}`,fontSize:d.base},children:[r.jsx("code",{style:{color:s.accent.default},children:x}),r.jsx("span",{style:{color:s.content.muted},children:Array.isArray(h)?"array":typeof h}),r.jsx("code",{style:{color:s.content.primary,overflow:"hidden",textOverflow:"ellipsis"},children:typeof h=="function"?"function":JSON.stringify(h)})]},x)),Object.keys(z).length===0&&r.jsx("div",{style:{padding:u[5],color:s.content.dim,fontSize:d.base},children:"This story declares no args."})]})]}),r.jsxs("footer",{style:{color:s.content.dim,fontSize:d.sm},children:[e.modulePath," · ",e.storyName]})]})})}function $e({documentId:t}){l.useSyncExternalStore(E,O),l.useSyncExternalStore(L,()=>P());const e=y.get(t);if(!e)return null;const{story:o}=W(e.modulePath,e.storyName),n=typeof o?.Component.play=="function",i=e.playResult;return r.jsxs("div",{"data-testid":"story-document-toolbar",style:{display:"flex",alignItems:"center",gap:u[4],padding:"3px 10px",fontSize:d.sm,color:s.content.muted,borderBottom:`1px solid ${s.boundary.default}`},children:[r.jsxs("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:[e.modulePath," —"," ",r.jsx("code",{style:{color:s.accent.default},children:e.storyName})]}),r.jsx(we,{resolution:e.resolution,scale:e.scale,onResolutionChange:a=>{e.resolution=a,m()}}),r.jsx(A,{size:"compact","data-testid":"story-open-docs",onClick:()=>Y(e.store,e.modulePath,e.storyName),style:{flexShrink:0},children:"Docs"}),n&&o&&r.jsx(A,{variant:"outline",size:"compact","data-testid":"story-run-play",onClick:async()=>{if(!e.container||!e.previewReady)return;const a=e.previewRevision,p=await je(e.modulePath,e.storyName,o.Component,e.container),c=y.get(t);c?.previewReady&&c.previewRevision===a&&(c.playResult=p,m())},disabled:!e.previewReady,style:{flexShrink:0},children:"Run play()"}),i?.ran&&!i.error&&r.jsx("span",{"data-testid":"story-play-result",style:{color:s.semantic.success,fontWeight:600},children:"play() ran"}),i?.error&&r.jsx("span",{"data-testid":"story-play-result",style:{color:s.semantic.danger},children:i.error})]})}function ze({id:t,name:e,value:o}){return r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u[3],padding:"3px 0"},children:[r.jsx("span",{style:{width:90,flexShrink:0,fontSize:d.base,color:s.content.muted,overflow:"hidden",textOverflow:"ellipsis"},title:e,children:e}),typeof o=="boolean"?r.jsx(ye,{className:"volter-checkbox","data-testid":`story-arg-${e}`,checked:o,onChange:n=>F(t,e,n.target.checked)}):typeof o=="number"?r.jsx(V,{type:"number",className:"volter-input","data-testid":`story-arg-${e}`,value:o,onChange:n=>{const i=n.target.value,a=Number.parseFloat(i);F(t,e,i===""||Number.isNaN(a)?void 0:a)},style:{width:80}}):typeof o=="string"?r.jsx(V,{type:"text",className:"volter-input","data-testid":`story-arg-${e}`,value:o,onChange:n=>F(t,e,n.target.value),style:{flex:1,minWidth:0}}):r.jsx("span",{style:{fontSize:d.base,color:s.content.dim},"data-testid":`story-arg-${e}`,children:typeof o=="function"?"fn (logged to Actions)":JSON.stringify(o)})]})}function Ie(){l.useSyncExternalStore(E,O),l.useSyncExternalStore(L,()=>P());const t=$();if(!t)return null;const{story:e}=W(t.modulePath,t.storyName),o=e?{...ne(e),...t.argOverrides}:{},n=Object.keys(o);return r.jsxs("div",{"data-testid":"inspector-story-args",style:{pointerEvents:"auto",padding:u[4],borderBottom:`1px solid ${s.boundary.default}`},children:[r.jsx("div",{style:{fontSize:d.base,color:s.content.dim,textTransform:"uppercase",marginBottom:u[2]},children:"Story Args"}),r.jsx("div",{style:{fontSize:d.base,color:s.content.primary,fontWeight:600,marginBottom:u[2]},children:t.storyName}),n.length===0&&r.jsx("div",{style:{fontSize:d.base,color:s.content.dim},children:e?"This story declares no args.":"Story source unavailable."}),n.map(i=>r.jsx(ze,{id:t.id,name:i,value:o[i]},i))]})}function Ae(){l.useSyncExternalStore(E,O);const t=$();return t?r.jsxs("div",{"data-testid":"story-actions-utility",style:{flex:1,minHeight:0,overflowY:"auto",padding:u[4],fontSize:d.base},children:[r.jsx(A,{size:"compact",style:{marginBottom:u[3]},onClick:()=>Ne(t.id),children:"Clear"}),t.actionLog.length===0?r.jsx("div",{style:{color:s.content.dim},children:"No actions logged — function-valued args are wrapped with logging spies; interact with the story preview to see calls here."}):t.actionLog.map((e,o)=>r.jsxs("div",{style:{padding:`${u[1]} 0`,borderBottom:`1px solid ${s.boundary.default}`},children:[r.jsx("code",{style:{color:s.accent.default},children:e.name})," ",r.jsxs("span",{style:{color:s.content.muted},children:["(",e.args.map(n=>{try{return typeof n=="object"?JSON.stringify(n)?.slice(0,80):String(n)}catch{return String(n)}}).join(", "),")"]})]},o))]}):r.jsx("div",{style:{padding:u[6],fontSize:d.md,color:s.content.dim},children:"No active story."})}function Le(){l.useSyncExternalStore(E,O);const t=$();if(!t)return r.jsx("div",{style:{padding:u[6],fontSize:d.md,color:s.content.dim},children:"No active story."});const e=t.playResult;return r.jsxs("div",{"data-testid":"story-interactions-utility",style:{flex:1,minHeight:0,overflowY:"auto",padding:u[6],fontSize:d.md},children:[!e&&r.jsx("div",{style:{color:s.content.dim},children:"No interaction run yet — use the story document's “Run play()”."}),e&&!e.ran&&r.jsx("div",{style:{color:s.content.dim},children:"This story declares no play() function."}),e?.ran&&!e.error&&r.jsx("div",{style:{color:s.semantic.success,fontWeight:600},children:"play() ran without errors."}),e?.error&&r.jsx("div",{style:{color:s.semantic.danger,whiteSpace:"pre-wrap"},children:e.error})]})}async function We(t){const e=y.get(t);if(!e?.container||!e.previewReady)return;const o=e.container,n=e.previewRevision;e.accessibility={status:"running",violations:[]},m();try{const a=await(await pe(async()=>{const{default:c}=await import("./axe-LkjAB6Lv.js").then(g=>g.a);return{default:c}},__vite__mapDeps([0,1]))).default.run(o),p=y.get(t);if(!p?.previewReady||p.previewRevision!==n||p.container!==o)return;p.accessibility={status:"complete",violations:a.violations.map(c=>({id:c.id,impact:c.impact??null,help:c.help,helpUrl:c.helpUrl,nodes:c.nodes.map(g=>({html:g.html,target:g.target.map(String)}))}))},m()}catch(i){const a=y.get(t);if(!a?.previewReady||a.previewRevision!==n||a.container!==o)return;a.accessibility={status:"error",violations:[],error:i instanceof Error?i.message:String(i)},m()}}function Be(){l.useSyncExternalStore(E,O);const t=$();if(!t)return r.jsx("div",{style:{padding:u[6],fontSize:d.md,color:s.content.dim},children:"No active story."});const e=t.accessibility;return r.jsxs("div",{"data-testid":"story-accessibility-utility",style:{flex:1,minHeight:0,overflowY:"auto",padding:u[5],fontSize:d.base},children:[r.jsx(A,{variant:"outline",size:"compact",disabled:!t.container||!t.previewReady||e.status==="running",onClick:()=>void We(t.id),style:{marginBottom:u[4]},children:e.status==="running"?"Checking…":"Run accessibility check"}),e.status==="idle"&&r.jsx("div",{style:{color:s.content.dim},children:"Run axe against the mounted story preview."}),e.status==="error"&&r.jsx("div",{style:{color:s.semantic.danger},children:e.error}),e.status==="complete"&&e.violations.length===0&&r.jsx("div",{style:{color:s.semantic.success,fontWeight:600},children:"No accessibility violations found."}),e.violations.map(o=>r.jsxs("details",{style:{borderBottom:`1px solid ${s.boundary.default}`,padding:`${u[3]} 0`},children:[r.jsxs("summary",{style:{color:o.impact==="critical"||o.impact==="serious"?s.semantic.danger:s.content.primary,cursor:"pointer"},children:[o.help," · ",o.nodes.length," node",o.nodes.length===1?"":"s"]}),r.jsx("a",{href:o.helpUrl,target:"_blank",rel:"noreferrer",style:{color:s.accent.default,display:"inline-block",margin:"5px 0"},children:"How to fix"}),o.nodes.map((n,i)=>r.jsxs("pre",{style:{color:s.content.muted,fontFamily:ue,fontSize:d.sm,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:[n.target.join(" "),`
3
- `,n.html]},`${o.id}:${i}`))]},o.id))]})}const He=de();function Ue(){He.ensure(t=>{t(ie({match:()=>K()?.descriptor.kind==="story",id:le,title:ce,icon:Re,order:ae,Section:Ie}));const e=()=>$()!==null;t(H({...U.storyActions,Content:Ae,available:e})),t(H({...U.storyInteractions,Content:Le,available:e})),t(H({...U.storyAccessibility,Content:Be,available:e}))})}export{Re as S,Ue as e,ke as p,Ee as s};
2
+ import{e$ as se,eI as ie,dS as ae,f0 as ce,f1 as le,f2 as K,f3 as H,ac as U,eK as de,ar as L,as as P,ak as s,en as u,ep as d,a5 as A,es as ue,aR as ye,aM as V,_ as pe,f4 as fe,at as me,au as he,f5 as Q,f6 as ve,f7 as ge,f8 as xe,b8 as J,f9 as X,aB as Se}from"./index-V4J7xfRg.js";import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{R as we,f as be}from"./presentation-8m-RDKIS.js";import{e as Z,S as q}from"./surface-state-DrM3wsrr.js";import{m as ee,r as je}from"./StoryPreviewMount-CmOEFzZY.js";import{d as te}from"./surface-content-Dg9Kkazf.js";const Re=se,y=new Map;let oe=0;const M=new Set;function m(){oe++;for(const t of M)t()}function E(t){return M.add(t),()=>{M.delete(t)}}function O(){return oe}function Ee(t,e){return`story:${t}#${e}`}function Oe(t,e){return`story-docs:${t}#${e}`}function $(){const t=K();if(!t||t.descriptor.kind!=="story")return null;const e=y.get(t.descriptor.id);return e?.mode==="preview"?{...e,id:t.descriptor.id}:null}function F(t,e,o){const n=y.get(t);if(n){if(o===void 0){const i={...n.argOverrides};delete i[e],n.argOverrides=i}else n.argOverrides={...n.argOverrides,[e]:o};m()}}function Ce(t,e,o){const n=y.get(t);n&&(n.actionLog=[...n.actionLog,{name:e,args:o,time:Date.now()}].slice(-200),m())}function ke(t){const e=y.get(t);!e||e.actionLog.length===0||(e.actionLog=[],m())}function re(t,e,o,n={}){Ue();const i=Ee(e,o);y.has(i)||(y.set(i,{modulePath:e,storyName:o,mode:"preview",store:t,argOverrides:{},actionLog:[],playResult:null,accessibility:{status:"idle",violations:[]},container:null,previewReady:!1,previewRevision:0,resolution:{label:"Fill",width:null,height:null},scale:1}),m());const a=n.activate===void 0?{}:{activate:n.activate};return X({id:i,title:n.title??o,kind:"story",workspaceRole:"authored-subject",provenance:{sourcePath:e},Content:Pe,Toolbar:$e,closeable:!0,presentation:()=>({kind:"story",modulePath:e,storyName:o,mode:"preview"}),persist:()=>({modulePath:e,storyName:o}),onDispose:p=>{y.delete(p)&&m()}},a)}function Y(t,e,o){const n=Oe(e,o);return y.has(n)||(y.set(n,{modulePath:e,storyName:o,mode:"docs",store:t,argOverrides:{},actionLog:[],playResult:null,accessibility:{status:"idle",violations:[]},container:null,previewReady:!1,previewRevision:0,resolution:{label:"Fill",width:null,height:null},scale:1}),m()),X({id:n,title:`${o} — Docs`,kind:"story",workspaceRole:"workspace-reference",provenance:{sourcePath:e},Content:_e,closeable:!0,presentation:()=>({kind:"story",modulePath:e,storyName:o,mode:"docs"}),persist:()=>({modulePath:e,storyName:o,view:"docs"}),onDispose:i=>{y.delete(i)&&m()}})}function Ne(){const t=Se();return t?xe(t).then(J,J):Promise.resolve()}fe({kind:"story",owner:"story-documents",prepare:Ne,restore:({state:t,store:e})=>{const o=t,n=typeof o?.modulePath=="string"?o.modulePath:null,i=typeof o?.storyName=="string"?o.storyName:null;if(!n||!i)return!1;const a=P().find(c=>c.modulePath===n);if(!a?.ok||!a.stories.some(c=>c.name===i))return!1;if(o?.view==="docs")return Y(e,n,i),!0;const{medium:p}=me({modulePath:n,regions:he()});return p!=="dom"&&p!=="canvas"?!1:(re(e,n,i),!0)}});Q({id:ve,owner:"story-documents",open:(t,e)=>re(t,e.modulePath,e.storyName,{...e.title===void 0?{}:{title:e.title},...e.activate===void 0?{}:{activate:e.activate}})});Q({id:ge,owner:"story-documents",open:(t,e)=>Y(t,e.modulePath,e.storyName)});function W(t,e){const o=P().find(n=>n.modulePath===t);return o?o.ok?{story:o.stories.find(n=>n.name===e),moduleError:void 0}:{story:void 0,moduleError:o.error}:{story:void 0,moduleError:void 0}}function ne(t){const e=t.Component.args;return e&&typeof e=="object"?e:{}}function De(t,e){const o=y.get(t),n={};for(const[i,a]of Object.entries(ne(e)))typeof a=="function"&&(n[i]=(...p)=>(Ce(t,i,p),a(...p)));return{...n,...o?.argOverrides??{}}}function Pe({documentId:t}){l.useSyncExternalStore(E,O),l.useSyncExternalStore(L,()=>P());const e=y.get(t),o=l.useRef(null),n=l.useRef(null),[i,a]=l.useState(!1),[p,c]=l.useState("unknown"),[g,w]=l.useState(null),[z,T]=l.useState({width:0,height:0}),{story:b,moduleError:x}=e?W(e.modulePath,e.storyName):{story:void 0,moduleError:void 0},h=e?JSON.stringify(e.argOverrides):"";l.useEffect(()=>{const f=o.current;if(!f)return;if(typeof ResizeObserver>"u"){T({width:f.clientWidth,height:f.clientHeight});return}const j=new ResizeObserver(([R])=>{if(!R)return;const{width:_,height:N}=R.contentRect;T(D=>D.width===_&&D.height===N?D:{width:_,height:N})});return j.observe(f),()=>j.disconnect()},[]),l.useEffect(()=>{const f=n.current;if(!f||!e)return;e.container!==f&&(e.container=f,m());const j=e.previewRevision+1;if(e.previewRevision=j,e.previewReady=!1,e.playResult=null,e.accessibility={status:"idle",violations:[]},m(),c("unknown"),w(null),!b){a(!1),c("empty");return}let R=!1,_,N;const D=()=>{R||c(te(f)?"present":"empty")},G=new MutationObserver(D);return G.observe(f,{childList:!0,subtree:!0,characterData:!0}),a(!0),ee(f,e.modulePath,e.storyName,b.Component,De(t,b)).then(S=>{if(R){S?.unmount();return}if(!S){y.get(t)?.previewRevision===j&&(a(!1),c("empty"));return}const B=y.get(t);if(!B||B.previewRevision!==j){S.unmount();return}_=S.unmount,B.previewReady=!0,a(!1),N=setTimeout(D,0),m()},S=>{R||y.get(t)?.previewRevision!==j||(a(!1),w(S instanceof Error?S.message:String(S)),c("empty"))}),()=>{R=!0,G.disconnect(),N!==void 0&&clearTimeout(N),_?.()}},[t,e,b,h]);const C=e?.resolution.width===null,v=!e||C?1:be(z,{width:e.resolution.width,height:e.resolution.height}).scale;if(l.useEffect(()=>{!e||!Number.isFinite(v)||v<=0||e.scale===v||(e.scale=v,m())},[v,e]),!e)return r.jsx("div",{style:{padding:u[6],fontSize:d.md,color:s.content.muted,pointerEvents:"auto"},children:"This story document is no longer available."});const k=`${e.modulePath}#${e.storyName}`,I=b?g?{tone:"error",title:`Story ${k} failed`,description:g}:Z({surface:"Story",rootIds:[k],phase:i?"loading":"ready",content:p}):{tone:"error",title:`Story ${k} is unavailable`,description:x??`No story export named “${e.storyName}” exists in ${e.modulePath}; it may have been renamed or removed.`};return r.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",pointerEvents:"auto"},children:r.jsx("div",{ref:o,style:{position:"relative",flex:1,minHeight:0,overflow:"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsxs("div",{style:C?{position:"absolute",inset:0}:{position:"relative",width:e.resolution.width*v,height:e.resolution.height*v,flex:"0 0 auto"},children:[r.jsx("div",{"data-testid":"story-preview-root",ref:n,style:{position:"absolute",inset:0,isolation:"isolate",contain:"layout paint",overflow:"auto",background:s.surface.inset,...C?{}:{width:e.resolution.width,height:e.resolution.height,transform:`scale(${v})`,transformOrigin:"top left"}}}),r.jsx(q,{explanation:I,testId:"story-surface-status"})]})})})}function Te(t){const e=t.parameters.docs;if(!e||typeof e!="object")return{};const o=e.description;if(typeof o=="string")return{story:o};if(!o||typeof o!="object")return{};const n=o;return{...typeof n.component=="string"?{component:n.component}:{},...typeof n.story=="string"?{story:n.story}:{}}}function _e({documentId:t}){l.useSyncExternalStore(E,O),l.useSyncExternalStore(L,()=>P());const e=y.get(t),o=l.useRef(null),[n,i]=l.useState("unknown"),[a,p]=l.useState(null),{story:c,moduleError:g}=e?W(e.modulePath,e.storyName):{story:void 0,moduleError:void 0};if(l.useEffect(()=>{const x=o.current;if(!x||!e||!c)return;let h=!1,C=null,v;i("unknown"),p(null);const k=()=>{h||i(te(x)?"present":"empty")},I=new MutationObserver(k);return I.observe(x,{childList:!0,subtree:!0,characterData:!0}),ee(x,e.modulePath,e.storyName,c.Component).then(f=>{if(!f){h||i("empty");return}h?f.unmount():(C=f.unmount,v=setTimeout(k,0))},f=>{h||(p(f instanceof Error?f.message:String(f)),i("empty"))}),()=>{h=!0,I.disconnect(),v!==void 0&&clearTimeout(v),C?.()}},[e,c]),!e||!c)return r.jsx("div",{style:{padding:u[8],color:s.semantic.danger,fontSize:d.md},children:g??"This Storybook Docs document is no longer available."});const w=Te(c),z=c.args,T=`${e.modulePath}#${e.storyName}`,b=a?{tone:"error",title:`Story ${T} failed`,description:a}:Z({surface:"Story",rootIds:[T],phase:n==="unknown"?"loading":"ready",content:n});return r.jsx("article",{"data-testid":"story-docs-document",className:"volter-content-frost",style:{flex:1,minHeight:0,overflow:"auto",pointerEvents:"auto",padding:"24px clamp(18px, 5vw, 64px)"},children:r.jsxs("div",{style:{maxWidth:920,margin:"0 auto",display:"flex",flexDirection:"column",gap:22},children:[r.jsxs("header",{children:[r.jsx("div",{style:{color:s.content.dim,fontSize:d.base,marginBottom:5},children:c.title??e.modulePath}),r.jsx("h1",{style:{color:s.content.primary,fontSize:d.heading,margin:0},children:c.label}),(w.story??w.component)&&r.jsx("p",{style:{color:s.content.primary,lineHeight:1.6,maxWidth:760,whiteSpace:"pre-wrap"},children:w.story??w.component})]}),r.jsxs("section",{children:[r.jsx("h2",{style:{color:s.content.primary,fontSize:d.xl},children:"Canvas"}),r.jsxs("div",{style:{position:"relative",minHeight:180},children:[r.jsx("div",{ref:o,"data-testid":"story-docs-canvas",style:{position:"relative",isolation:"isolate",contain:"layout paint",minHeight:180,padding:18,overflow:"auto",background:s.surface.inset,border:`1px solid ${s.boundary.default}`,borderRadius:s.shape.medium}}),r.jsx(q,{explanation:b,testId:"story-docs-surface-status"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{style:{color:s.content.primary,fontSize:d.xl},children:"Args"}),r.jsxs("div",{style:{border:`1px solid ${s.boundary.default}`,borderRadius:s.shape.medium,overflow:"hidden"},children:[Object.entries(z).map(([x,h])=>r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(120px, .4fr) minmax(140px, .6fr) 1fr",gap:u[6],padding:`${u[4]} ${u[5]}`,borderBottom:`1px solid ${s.boundary.default}`,fontSize:d.base},children:[r.jsx("code",{style:{color:s.accent.default},children:x}),r.jsx("span",{style:{color:s.content.muted},children:Array.isArray(h)?"array":typeof h}),r.jsx("code",{style:{color:s.content.primary,overflow:"hidden",textOverflow:"ellipsis"},children:typeof h=="function"?"function":JSON.stringify(h)})]},x)),Object.keys(z).length===0&&r.jsx("div",{style:{padding:u[5],color:s.content.dim,fontSize:d.base},children:"This story declares no args."})]})]}),r.jsxs("footer",{style:{color:s.content.dim,fontSize:d.sm},children:[e.modulePath," · ",e.storyName]})]})})}function $e({documentId:t}){l.useSyncExternalStore(E,O),l.useSyncExternalStore(L,()=>P());const e=y.get(t);if(!e)return null;const{story:o}=W(e.modulePath,e.storyName),n=typeof o?.Component.play=="function",i=e.playResult;return r.jsxs("div",{"data-testid":"story-document-toolbar",style:{display:"flex",alignItems:"center",gap:u[4],padding:"3px 10px",fontSize:d.sm,color:s.content.muted,borderBottom:`1px solid ${s.boundary.default}`},children:[r.jsxs("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:[e.modulePath," —"," ",r.jsx("code",{style:{color:s.accent.default},children:e.storyName})]}),r.jsx(we,{resolution:e.resolution,scale:e.scale,onResolutionChange:a=>{e.resolution=a,m()}}),r.jsx(A,{size:"compact","data-testid":"story-open-docs",onClick:()=>Y(e.store,e.modulePath,e.storyName),style:{flexShrink:0},children:"Docs"}),n&&o&&r.jsx(A,{variant:"outline",size:"compact","data-testid":"story-run-play",onClick:async()=>{if(!e.container||!e.previewReady)return;const a=e.previewRevision,p=await je(e.modulePath,e.storyName,o.Component,e.container),c=y.get(t);c?.previewReady&&c.previewRevision===a&&(c.playResult=p,m())},disabled:!e.previewReady,style:{flexShrink:0},children:"Run play()"}),i?.ran&&!i.error&&r.jsx("span",{"data-testid":"story-play-result",style:{color:s.semantic.success,fontWeight:600},children:"play() ran"}),i?.error&&r.jsx("span",{"data-testid":"story-play-result",style:{color:s.semantic.danger},children:i.error})]})}function ze({id:t,name:e,value:o}){return r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:u[3],padding:"3px 0"},children:[r.jsx("span",{style:{width:90,flexShrink:0,fontSize:d.base,color:s.content.muted,overflow:"hidden",textOverflow:"ellipsis"},title:e,children:e}),typeof o=="boolean"?r.jsx(ye,{className:"volter-checkbox","data-testid":`story-arg-${e}`,checked:o,onChange:n=>F(t,e,n.target.checked)}):typeof o=="number"?r.jsx(V,{type:"number",className:"volter-input","data-testid":`story-arg-${e}`,value:o,onChange:n=>{const i=n.target.value,a=Number.parseFloat(i);F(t,e,i===""||Number.isNaN(a)?void 0:a)},style:{width:80}}):typeof o=="string"?r.jsx(V,{type:"text",className:"volter-input","data-testid":`story-arg-${e}`,value:o,onChange:n=>F(t,e,n.target.value),style:{flex:1,minWidth:0}}):r.jsx("span",{style:{fontSize:d.base,color:s.content.dim},"data-testid":`story-arg-${e}`,children:typeof o=="function"?"fn (logged to Actions)":JSON.stringify(o)})]})}function Ie(){l.useSyncExternalStore(E,O),l.useSyncExternalStore(L,()=>P());const t=$();if(!t)return null;const{story:e}=W(t.modulePath,t.storyName),o=e?{...ne(e),...t.argOverrides}:{},n=Object.keys(o);return r.jsxs("div",{"data-testid":"inspector-story-args",style:{pointerEvents:"auto",padding:u[4],borderBottom:`1px solid ${s.boundary.default}`},children:[r.jsx("div",{style:{fontSize:d.base,color:s.content.dim,textTransform:"uppercase",marginBottom:u[2]},children:"Story Args"}),r.jsx("div",{style:{fontSize:d.base,color:s.content.primary,fontWeight:600,marginBottom:u[2]},children:t.storyName}),n.length===0&&r.jsx("div",{style:{fontSize:d.base,color:s.content.dim},children:e?"This story declares no args.":"Story source unavailable."}),n.map(i=>r.jsx(ze,{id:t.id,name:i,value:o[i]},i))]})}function Ae(){l.useSyncExternalStore(E,O);const t=$();return t?r.jsxs("div",{"data-testid":"story-actions-utility",style:{flex:1,minHeight:0,overflowY:"auto",padding:u[4],fontSize:d.base},children:[r.jsx(A,{size:"compact",style:{marginBottom:u[3]},onClick:()=>ke(t.id),children:"Clear"}),t.actionLog.length===0?r.jsx("div",{style:{color:s.content.dim},children:"No actions logged — function-valued args are wrapped with logging spies; interact with the story preview to see calls here."}):t.actionLog.map((e,o)=>r.jsxs("div",{style:{padding:`${u[1]} 0`,borderBottom:`1px solid ${s.boundary.default}`},children:[r.jsx("code",{style:{color:s.accent.default},children:e.name})," ",r.jsxs("span",{style:{color:s.content.muted},children:["(",e.args.map(n=>{try{return typeof n=="object"?JSON.stringify(n)?.slice(0,80):String(n)}catch{return String(n)}}).join(", "),")"]})]},o))]}):r.jsx("div",{style:{padding:u[6],fontSize:d.md,color:s.content.dim},children:"No active story."})}function Le(){l.useSyncExternalStore(E,O);const t=$();if(!t)return r.jsx("div",{style:{padding:u[6],fontSize:d.md,color:s.content.dim},children:"No active story."});const e=t.playResult;return r.jsxs("div",{"data-testid":"story-interactions-utility",style:{flex:1,minHeight:0,overflowY:"auto",padding:u[6],fontSize:d.md},children:[!e&&r.jsx("div",{style:{color:s.content.dim},children:"No interaction run yet — use the story document's “Run play()”."}),e&&!e.ran&&r.jsx("div",{style:{color:s.content.dim},children:"This story declares no play() function."}),e?.ran&&!e.error&&r.jsx("div",{style:{color:s.semantic.success,fontWeight:600},children:"play() ran without errors."}),e?.error&&r.jsx("div",{style:{color:s.semantic.danger,whiteSpace:"pre-wrap"},children:e.error})]})}async function We(t){const e=y.get(t);if(!e?.container||!e.previewReady)return;const o=e.container,n=e.previewRevision;e.accessibility={status:"running",violations:[]},m();try{const a=await(await pe(async()=>{const{default:c}=await import("./axe-LkjAB6Lv.js").then(g=>g.a);return{default:c}},__vite__mapDeps([0,1]))).default.run(o),p=y.get(t);if(!p?.previewReady||p.previewRevision!==n||p.container!==o)return;p.accessibility={status:"complete",violations:a.violations.map(c=>({id:c.id,impact:c.impact??null,help:c.help,helpUrl:c.helpUrl,nodes:c.nodes.map(g=>({html:g.html,target:g.target.map(String)}))}))},m()}catch(i){const a=y.get(t);if(!a?.previewReady||a.previewRevision!==n||a.container!==o)return;a.accessibility={status:"error",violations:[],error:i instanceof Error?i.message:String(i)},m()}}function Be(){l.useSyncExternalStore(E,O);const t=$();if(!t)return r.jsx("div",{style:{padding:u[6],fontSize:d.md,color:s.content.dim},children:"No active story."});const e=t.accessibility;return r.jsxs("div",{"data-testid":"story-accessibility-utility",style:{flex:1,minHeight:0,overflowY:"auto",padding:u[5],fontSize:d.base},children:[r.jsx(A,{variant:"outline",size:"compact",disabled:!t.container||!t.previewReady||e.status==="running",onClick:()=>void We(t.id),style:{marginBottom:u[4]},children:e.status==="running"?"Checking…":"Run accessibility check"}),e.status==="idle"&&r.jsx("div",{style:{color:s.content.dim},children:"Run axe against the mounted story preview."}),e.status==="error"&&r.jsx("div",{style:{color:s.semantic.danger},children:e.error}),e.status==="complete"&&e.violations.length===0&&r.jsx("div",{style:{color:s.semantic.success,fontWeight:600},children:"No accessibility violations found."}),e.violations.map(o=>r.jsxs("details",{style:{borderBottom:`1px solid ${s.boundary.default}`,padding:`${u[3]} 0`},children:[r.jsxs("summary",{style:{color:o.impact==="critical"||o.impact==="serious"?s.semantic.danger:s.content.primary,cursor:"pointer"},children:[o.help," · ",o.nodes.length," node",o.nodes.length===1?"":"s"]}),r.jsx("a",{href:o.helpUrl,target:"_blank",rel:"noreferrer",style:{color:s.accent.default,display:"inline-block",margin:"5px 0"},children:"How to fix"}),o.nodes.map((n,i)=>r.jsxs("pre",{style:{color:s.content.muted,fontFamily:ue,fontSize:d.sm,whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:[n.target.join(" "),`
3
+ `,n.html]},`${o.id}:${i}`))]},o.id))]})}const He=de();function Ue(){He.ensure(t=>{t(ie({match:()=>K()?.descriptor.kind==="story",id:le,title:ce,icon:Re,order:ae,Section:Ie}));const e=()=>$()!==null;t(H({...U.storyActions,Content:Ae,available:e})),t(H({...U.storyInteractions,Content:Le,available:e})),t(H({...U.storyAccessibility,Content:Be,available:e}))})}export{Re as S,Ue as e,Ne as p,Ee as s};
@@ -1 +1 @@
1
- import{e as r}from"./story-documents-Cjoy-ydN.js";import"./index-CvGsVzTo.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"./presentation-CmK-bEDi.js";import"./surface-state-DlUcJe84.js";import"./StoryPreviewMount-D2zLWzWy.js";import"./surface-content-Dg9Kkazf.js";const g="workspace.service";function k(){return r(),()=>{}}export{g as point,k as start};
1
+ import{e as r}from"./story-documents-Cm4jCkW5.js";import"./index-V4J7xfRg.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"./presentation-8m-RDKIS.js";import"./surface-state-DrM3wsrr.js";import"./StoryPreviewMount-CmOEFzZY.js";import"./surface-content-Dg9Kkazf.js";const g="workspace.service";function k(){return r(),()=>{}}export{g as point,k as start};
@@ -1 +1 @@
1
- import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{O as H}from"./Object3DDocumentViewport-ByDDwGJD.js";import{S,e as W}from"./surface-state-DlUcJe84.js";import{S as G}from"./standard-viewport-dressing-e4mnLmI6.js";import{eI as z,dw as B,f0 as V,f1 as Y,eK as F,am as _,an as x,af as p,aR as J,aM as D,f2 as K,f5 as U,fk as L,f4 as X,fl as Q,f9 as Z,ao as q,ap as ee,d6 as te}from"./index-CvGsVzTo.js";import{m as re}from"./mounted-story-viewport-source-Snu9yn1n.js";import{s as oe}from"./story-arg-descriptors-Ek86ExX7.js";import{mountStoryObject3D as se,disposeStoryObject3D as N}from"./story-three-preview-CQYi1rZ_.js";import{m as ie}from"./three-story-model-D_bo7Gl-.js";import{S as ne,p as ae,s as le}from"./story-documents-Cjoy-ydN.js";import{r as l}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{R3fSourceAuthoringAdapter as ce}from"./r3f-source-authoring-adapter-DVnhzoxp.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./viewport-surface-status-D3t-0oLs.js";import"./content-bounds-BFpR_e--.js";import"./hierarchy-marks-Pb6wnNcu.js";import"./workspace-arrangement-C9uemwSK.js";import"./three.core-3arARmh6.js";import"./editor-layers-BK3fNRb7.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./environment-Dg-YaLsA.js";import"./three.module-BLhyNg0e.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";import"./user-data-DfBtZvxw.js";import"./asset-preview-B7j9QV6N.js";import"./renderer-ownership-BovSEcLv.js";import"./studio-environment-DK0ke0m0.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";import"./bitmap-label-Ct4k6ehY.js";import"./crash-null-boundary-v3a0uEgw.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./index-bQE2NA0D.js";import"./story-mount-turn-DFRTj5hi.js";import"./presentation-CmK-bEDi.js";import"./StoryPreviewMount-D2zLWzWy.js";import"./surface-content-Dg9Kkazf.js";import"./component-instance-root-MBgAuUpp.js";import"./live-gesture-lock-DJbrjOqf.js";import"./relative-import-specifier-BvzqkvYS.js";import"./three-projection-core-BO23VKAP.js";import"./three-bdxPiUPb.js";import"./entity-object-BFppZ54X.js";import"./three-contract-Dkt6PmWY.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./inference-diagnostics-BCwXk-CS.js";import"./instance-fork-actions-D3sRzS3K.js";import"./oid-transform-Bgdv7kST.js";import"./writer-tw6EcuVO.js";import"./r3f-physics-binding-BcTFD1ZS.js";import"./object3d-authoring-subject-XccsO0xG.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";const de="threeStory.arg.",f=new Map;let j=0;const v=new Set;function b(){j++;for(const e of v)e()}function I(e){return v.add(e),()=>{v.delete(e)}}function k(){return j}function ue(e,t){return`three-story:${e}#${t}`}function C(){const e=K();if(!e)return null;const t=f.get(e.descriptor.id);return t?{...t,id:e.descriptor.id}:null}function g(e,t,r){const s=f.get(e);if(s){if(r===void 0){const o={...s.argOverrides};delete o[t],s.argOverrides=o}else s.argOverrides={...s.argOverrides,[t]:r};b()}}function A(e,t,r=t,s={}){P(),Q(le(e,t));const o=ue(e,t);return f.has(o)||(f.set(o,{modulePath:e,storyName:t,argOverrides:{}}),b()),Z({id:o,title:r,kind:"world",workspaceRole:"authored-subject",provenance:{sourcePath:e},Content:pe,closeable:!0,presentation:()=>({kind:"story",modulePath:e,storyName:t,mode:"preview"}),persist:({title:n})=>({modulePath:e,storyName:t,title:n}),onDispose:n=>{f.delete(n)&&b()}},{activate:s.activate!==!1})}function me(e,t,r){const{story:s}=E(e,t);return!s||q({modulePath:e,regions:ee()}).medium!=="three"?!1:(A(e,t,r??s.label),!0)}U({id:L,owner:"three-story-documents",open:(e,t)=>A(t.modulePath,t.storyName,t.title??t.storyName,t.activate===void 0?{}:{activate:t.activate})});X({kind:"world",owner:"three-story-documents",prepare:ae,restore:({state:e})=>{const t=e,r=typeof t?.modulePath=="string"?t.modulePath:null,s=typeof t?.storyName=="string"?t.storyName:null;if(!r||!s)return!1;const o=typeof t?.title=="string"?t.title:void 0;return me(r,s,o)}});function E(e,t){const r=x().find(s=>s.modulePath===e);return r?r.ok?{story:r.stories.find(s=>s.name===t),moduleError:void 0}:{story:void 0,moduleError:r.error}:{story:void 0,moduleError:void 0}}function pe({documentId:e,active:t}){l.useSyncExternalStore(I,k),l.useSyncExternalStore(_,x);const r=f.get(e),[s,o]=l.useState(null),[n,u]=l.useState(null),d=l.useRef(new Set);l.useEffect(()=>{if(s)for(const a of d.current){if(a===s)break;a.dispose(),d.current.delete(a)}},[s]),l.useEffect(()=>()=>{for(const a of d.current)a.dispose();d.current.clear()},[]);const[T,$]=l.useState(t),h=r?.modulePath,O=l.useMemo(()=>h?({store:a,scene:c,hierarchyRoots:y})=>{const w=new ce(a,c,{worldId:e,entryPath:h,writeBackend:te("The Asset Editor"),hierarchyMode:"definition",...y?{hierarchyRoots:y}:{}});return{adapter:w,dispose:()=>w.dispose()}}:void 0,[e,h]);l.useEffect(()=>{t&&$(!0)},[t]);const{story:m,moduleError:R}=r?E(r.modulePath,r.storyName):{story:void 0,moduleError:void 0},M=r?JSON.stringify(r.argOverrides):"";if(l.useEffect(()=>{if(!T||!m||!r)return;let a=!1;return u(null),se(m.Component,{...r.argOverrides}).then(c=>{if(a){N(c);return}if(!ie(c.root)){N(c),u("The story mounted with no three content — its first R3F commit rendered an empty subtree. A <Suspense> boundary around three content is the usual cause: the boundary commits its fallback first, so the real children arrive on a later commit this document never sees.");return}const y=re(c);d.current.add(y),o(y)}).catch(c=>{a||u(c instanceof Error?c.message:String(c))}),()=>{a=!0}},[T,m,r,M]),!r)return i.jsx("div",{style:{padding:12,fontSize:12,color:p.content.muted},children:"This story document is no longer available."});if((!m||n)&&!s){const a=`${r.modulePath}#${r.storyName}`;return i.jsx("div",{"data-testid":"three-story-document-error",style:{position:"relative",flex:1,minHeight:0},children:i.jsx(S,{testId:"three-story-surface-status",explanation:{tone:"error",title:`Story ${a} failed`,description:n??R??"It may have been renamed or removed; close this document."}})})}return s?i.jsxs("div",{style:{position:"relative",display:"flex",flex:1,minHeight:0},children:[i.jsx(H,{documentId:e,sourcePath:r.modulePath,build:s.build,displayName:m?.label??r.storyName,active:t,assetType:"component",...O?{sourceAuthoring:O}:{},cameraDirection:G}),(!m||n)&&i.jsx(S,{testId:"three-story-surface-status",explanation:{tone:"error",title:"Source update failed",description:n??R??"This story is unavailable. The last working view is retained."}})]}):i.jsx("div",{"data-testid":"three-story-document-loading",style:{position:"relative",flex:1,minHeight:0},children:i.jsx(S,{testId:"three-story-surface-status",explanation:W({surface:"Story",rootIds:[`${r.modulePath}#${r.storyName}`],phase:"loading",content:"unknown"})})})}function fe(){l.useSyncExternalStore(I,k),l.useSyncExternalStore(_,x);const e=C();if(!e)return null;const{story:t}=E(e.modulePath,e.storyName),r=t?{...t.args,...e.argOverrides}:{},s=oe(r,de);return i.jsxs("div",{"data-testid":"inspector-story-args-three",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${p.boundary.default}`},children:[i.jsx("div",{style:{fontSize:11,color:p.content.primary,fontWeight:600,marginBottom:4},children:e.storyName}),s.length===0&&i.jsx("div",{style:{fontSize:11,color:p.content.dim},children:t?"This story declares no editable args.":"Story source unavailable."}),s.map(o=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 0"},children:[i.jsx("span",{title:o.label,style:{width:90,flexShrink:0,fontSize:11,color:p.content.muted,overflow:"hidden",textOverflow:"ellipsis"},children:o.label}),o.type==="boolean"?i.jsx(J,{className:"volter-checkbox","data-testid":`three-story-arg-${o.label}`,checked:r[o.label]===!0,onChange:n=>g(e.id,o.label,n.target.checked)}):o.type==="number"?i.jsx(D,{type:"number",className:"volter-input","data-testid":`three-story-arg-${o.label}`,value:r[o.label],onChange:n=>{const u=n.target.value,d=Number.parseFloat(u);g(e.id,o.label,u===""||Number.isNaN(d)?void 0:d)},style:{width:80}}):o.type==="string"?i.jsx(D,{type:"text",className:"volter-input","data-testid":`three-story-arg-${o.label}`,value:r[o.label],onChange:n=>g(e.id,o.label,n.target.value),style:{flex:1,minWidth:0}}):i.jsx("span",{"data-testid":`three-story-arg-${o.label}`,style:{fontSize:11,color:p.content.dim},children:JSON.stringify(r[o.label])})]},o.path))]})}const ye=F();function P(){ye.ensure(e=>{e(z({match:()=>C()!==null,id:Y,title:V,icon:ne,order:B,Section:fe}))})}const Et="workspace.service";function Tt(){return P(),()=>{}}export{Et as point,Tt as start};
1
+ import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{O as H}from"./Object3DDocumentViewport-BhH8afDi.js";import{S,e as W}from"./surface-state-DrM3wsrr.js";import{S as G}from"./standard-viewport-dressing-uhv_3JvQ.js";import{eI as z,dS as B,f0 as V,f1 as Y,eK as F,ar as _,as as x,ak as p,aR as J,aM as D,f2 as K,f5 as U,fk as L,f4 as X,fl as Q,f9 as Z,at as q,au as ee,dw as te}from"./index-V4J7xfRg.js";import{m as re}from"./mounted-story-viewport-source-CyEK_vaq.js";import{s as oe}from"./story-arg-descriptors-Ek86ExX7.js";import{mountStoryObject3D as se,disposeStoryObject3D as N}from"./story-three-preview-B9O1wapP.js";import{m as ie}from"./three-story-model-D7g2pqfJ.js";import{S as ne,p as ae,s as le}from"./story-documents-Cm4jCkW5.js";import{r as l}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{R3fSourceAuthoringAdapter as ce}from"./r3f-source-authoring-adapter-GR97EmII.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./viewport-surface-status-jwLhIK_M.js";import"./content-bounds-D5pXeHJN.js";import"./hierarchy-marks-B1jSqxSv.js";import"./workspace-arrangement-B_OcbQbj.js";import"./three.core-3arARmh6.js";import"./editor-layers-CjeYrUlm.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./environment-Dg-YaLsA.js";import"./three.module-BLhyNg0e.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";import"./user-data-CifDDvSr.js";import"./asset-preview-BS71mXsZ.js";import"./renderer-ownership-BovSEcLv.js";import"./studio-environment-BIhqrtFc.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";import"./bitmap-label-Ct4k6ehY.js";import"./crash-null-boundary-v3a0uEgw.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./index-bQE2NA0D.js";import"./story-mount-turn-DFRTj5hi.js";import"./presentation-8m-RDKIS.js";import"./StoryPreviewMount-CmOEFzZY.js";import"./surface-content-Dg9Kkazf.js";import"./component-instance-root-Cw_-ajBX.js";import"./live-gesture-lock-DJbrjOqf.js";import"./relative-import-specifier-DXWVQf0o.js";import"./three-projection-core-PQm-CO61.js";import"./three-BQfhEwUz.js";import"./entity-object-V13bGmay.js";import"./three-contract-Dkt6PmWY.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./inference-diagnostics-DoZQ1mpg.js";import"./instance-fork-actions-D3sRzS3K.js";import"./oid-transform-DQzN_Gl_.js";import"./writer-tw6EcuVO.js";import"./r3f-physics-binding-DZSIB0d_.js";import"./object3d-authoring-subject-XccsO0xG.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";const de="threeStory.arg.",f=new Map;let j=0;const v=new Set;function b(){j++;for(const e of v)e()}function k(e){return v.add(e),()=>{v.delete(e)}}function I(){return j}function ue(e,t){return`three-story:${e}#${t}`}function C(){const e=K();if(!e)return null;const t=f.get(e.descriptor.id);return t?{...t,id:e.descriptor.id}:null}function g(e,t,r){const s=f.get(e);if(s){if(r===void 0){const o={...s.argOverrides};delete o[t],s.argOverrides=o}else s.argOverrides={...s.argOverrides,[t]:r};b()}}function A(e,t,r=t,s={}){P(),Q(le(e,t));const o=ue(e,t);return f.has(o)||(f.set(o,{modulePath:e,storyName:t,argOverrides:{}}),b()),Z({id:o,title:r,kind:"world",workspaceRole:"authored-subject",provenance:{sourcePath:e},Content:pe,closeable:!0,presentation:()=>({kind:"story",modulePath:e,storyName:t,mode:"preview"}),persist:({title:n})=>({modulePath:e,storyName:t,title:n}),onDispose:n=>{f.delete(n)&&b()}},{activate:s.activate!==!1})}function me(e,t,r){const{story:s}=E(e,t);return!s||q({modulePath:e,regions:ee()}).medium!=="three"?!1:(A(e,t,r??s.label),!0)}U({id:L,owner:"three-story-documents",open:(e,t)=>A(t.modulePath,t.storyName,t.title??t.storyName,t.activate===void 0?{}:{activate:t.activate})});X({kind:"world",owner:"three-story-documents",prepare:ae,restore:({state:e})=>{const t=e,r=typeof t?.modulePath=="string"?t.modulePath:null,s=typeof t?.storyName=="string"?t.storyName:null;if(!r||!s)return!1;const o=typeof t?.title=="string"?t.title:void 0;return me(r,s,o)}});function E(e,t){const r=x().find(s=>s.modulePath===e);return r?r.ok?{story:r.stories.find(s=>s.name===t),moduleError:void 0}:{story:void 0,moduleError:r.error}:{story:void 0,moduleError:void 0}}function pe({documentId:e,active:t}){l.useSyncExternalStore(k,I),l.useSyncExternalStore(_,x);const r=f.get(e),[s,o]=l.useState(null),[n,u]=l.useState(null),d=l.useRef(new Set);l.useEffect(()=>{if(s)for(const a of d.current){if(a===s)break;a.dispose(),d.current.delete(a)}},[s]),l.useEffect(()=>()=>{for(const a of d.current)a.dispose();d.current.clear()},[]);const[T,$]=l.useState(t),h=r?.modulePath,O=l.useMemo(()=>h?({store:a,scene:c,hierarchyRoots:y})=>{const w=new ce(a,c,{worldId:e,entryPath:h,writeBackend:te("The Asset Editor"),hierarchyMode:"definition",...y?{hierarchyRoots:y}:{}});return{adapter:w,dispose:()=>w.dispose()}}:void 0,[e,h]);l.useEffect(()=>{t&&$(!0)},[t]);const{story:m,moduleError:R}=r?E(r.modulePath,r.storyName):{story:void 0,moduleError:void 0},M=r?JSON.stringify(r.argOverrides):"";if(l.useEffect(()=>{if(!T||!m||!r)return;let a=!1;return u(null),se(m.Component,{...r.argOverrides}).then(c=>{if(a){N(c);return}if(!ie(c.root)){N(c),u("The story mounted with no three content — its first R3F commit rendered an empty subtree. A <Suspense> boundary around three content is the usual cause: the boundary commits its fallback first, so the real children arrive on a later commit this document never sees.");return}const y=re(c);d.current.add(y),o(y)}).catch(c=>{a||u(c instanceof Error?c.message:String(c))}),()=>{a=!0}},[T,m,r,M]),!r)return i.jsx("div",{style:{padding:12,fontSize:12,color:p.content.muted},children:"This story document is no longer available."});if((!m||n)&&!s){const a=`${r.modulePath}#${r.storyName}`;return i.jsx("div",{"data-testid":"three-story-document-error",style:{position:"relative",flex:1,minHeight:0},children:i.jsx(S,{testId:"three-story-surface-status",explanation:{tone:"error",title:`Story ${a} failed`,description:n??R??"It may have been renamed or removed; close this document."}})})}return s?i.jsxs("div",{style:{position:"relative",display:"flex",flex:1,minHeight:0},children:[i.jsx(H,{documentId:e,sourcePath:r.modulePath,build:s.build,displayName:m?.label??r.storyName,active:t,assetType:"component",...O?{sourceAuthoring:O}:{},cameraDirection:G}),(!m||n)&&i.jsx(S,{testId:"three-story-surface-status",explanation:{tone:"error",title:"Source update failed",description:n??R??"This story is unavailable. The last working view is retained."}})]}):i.jsx("div",{"data-testid":"three-story-document-loading",style:{position:"relative",flex:1,minHeight:0},children:i.jsx(S,{testId:"three-story-surface-status",explanation:W({surface:"Story",rootIds:[`${r.modulePath}#${r.storyName}`],phase:"loading",content:"unknown"})})})}function fe(){l.useSyncExternalStore(k,I),l.useSyncExternalStore(_,x);const e=C();if(!e)return null;const{story:t}=E(e.modulePath,e.storyName),r=t?{...t.args,...e.argOverrides}:{},s=oe(r,de);return i.jsxs("div",{"data-testid":"inspector-story-args-three",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${p.boundary.default}`},children:[i.jsx("div",{style:{fontSize:11,color:p.content.primary,fontWeight:600,marginBottom:4},children:e.storyName}),s.length===0&&i.jsx("div",{style:{fontSize:11,color:p.content.dim},children:t?"This story declares no editable args.":"Story source unavailable."}),s.map(o=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 0"},children:[i.jsx("span",{title:o.label,style:{width:90,flexShrink:0,fontSize:11,color:p.content.muted,overflow:"hidden",textOverflow:"ellipsis"},children:o.label}),o.type==="boolean"?i.jsx(J,{className:"volter-checkbox","data-testid":`three-story-arg-${o.label}`,checked:r[o.label]===!0,onChange:n=>g(e.id,o.label,n.target.checked)}):o.type==="number"?i.jsx(D,{type:"number",className:"volter-input","data-testid":`three-story-arg-${o.label}`,value:r[o.label],onChange:n=>{const u=n.target.value,d=Number.parseFloat(u);g(e.id,o.label,u===""||Number.isNaN(d)?void 0:d)},style:{width:80}}):o.type==="string"?i.jsx(D,{type:"text",className:"volter-input","data-testid":`three-story-arg-${o.label}`,value:r[o.label],onChange:n=>g(e.id,o.label,n.target.value),style:{flex:1,minWidth:0}}):i.jsx("span",{"data-testid":`three-story-arg-${o.label}`,style:{fontSize:11,color:p.content.dim},children:JSON.stringify(r[o.label])})]},o.path))]})}const ye=F();function P(){ye.ensure(e=>{e(z({match:()=>C()!==null,id:Y,title:V,icon:ne,order:B,Section:fe}))})}const Et="workspace.service";function Tt(){return P(),()=>{}}export{Et as point,Tt as start};
@@ -0,0 +1 @@
1
+ import{ar as p,as as S,at as b,au as v,av as y}from"./index-V4J7xfRg.js";const f={three:!1,canvas:!1,dom:!1};let r=f,a=0;const n=new Set;let u=!1;function j(){return l(),r}function N(e){return l(),n.add(e),()=>{n.delete(e)}}function l(){u||(u=!0,p(()=>{d()}),d())}function i(e){if(!(e.three===r.three&&e.canvas===r.canvas&&e.dom===r.dom)){r=e;for(const t of n)t()}}function M(e){const t=b({modulePath:e.modulePath,regions:v()});if(t.medium)return t.medium;e.modulePath&&y(e.modulePath,t.reason)}async function d(){const e=++a,t=S().flatMap(s=>s.ok?s.stories.map(o=>({...o,modulePath:s.modulePath})):[]);if(t.length===0)return i(f),r;const c={three:!1,canvas:!1,dom:!1};for(const s of t){const o=M(s);if(o&&(c[o]=!0),e!==a)return r}const{three:m,canvas:h,dom:P}=c;return e!==a||i({three:m,canvas:h,dom:P}),r}export{j as g,N as s};
@@ -1 +1 @@
1
- import{r as v}from"./index-nmcBqr7Y.js";import{withApplicationCollector as E}from"./canvas-preview-frames-EoYgD6W4.js";import{C as M}from"./crash-null-boundary-v3a0uEgw.js";import{m as b}from"./pixi-story-model-DNkfnWUV.js";import{au as P}from"./index-CvGsVzTo.js";import{r as S}from"./story-mount-turn-DFRTj5hi.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-BlWeDGvp.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const w=1e4,k=12,I="position:fixed;left:-20000px;top:0;width:512px;height:512px;overflow:hidden;contain:strict;pointer-events:none;visibility:hidden;";function C(t){return S(()=>t(D))}function R(t,c={}){return C(n=>n(t,c))}function _(t){return S(async()=>t.dispose())}async function G(t,c={}){const n=await R(t,c.props??{});try{const o=c.width??128,r=c.height??96;n.app.renderer.render({container:n.stage});const a=n.stage.getBounds(),s=c.layout==="fullscreen",d=8,e=n.app.screen.clone();s||(e.x=a.x-d,e.y=a.y-d,e.width=Math.max(1,a.width+d*2),e.height=Math.max(1,a.height+d*2));const i=o/r;if(!s&&e.width/e.height<i){const l=e.height*i;e.x-=(l-e.width)/2,e.width=l}else if(!s&&e.width/e.height>i){const l=e.width/i;e.y-=(l-e.height)/2,e.height=l}const u=n.app.renderer.background,h=await n.app.renderer.extract.canvas({target:n.stage,frame:e,...s&&u.alpha>0?{clearColor:u.colorRgba}:{}}),m=document.createElement("canvas");m.width=o,m.height=r;const f=m.getContext("2d");if(!f)throw new Error("Canvas story preview could not create a 2D readback context.");const g=Math.min(o/h.width,r/h.height),y=h.width*g,x=h.height*g;return f.drawImage(h,(o-y)/2,(r-x)/2,y,x),m.toDataURL("image/png")}finally{await _(n)}}const p=()=>new Promise(t=>setTimeout(t,0));async function D(t,c={}){typeof t.load=="function"&&await t.load();const n=await P(),o=document.createElement("div");o.setAttribute("style",I),document.body.appendChild(o);let r=null;const a=()=>{r?.unmount(),r=null,o.remove()};try{return await E(async s=>{let d=null;r=n.createRoot(o),r.render(v.createElement(M,{onCaught:h=>{d??=h}},v.createElement(t,c)));for(let h=0;h<k&&!(d||o.querySelector("canvas"));h++)await p();if(d)throw T(d);if(!o.querySelector("canvas"))throw new Error("The story rendered no canvas — it does not mount Pixi content.");const e=Date.now()+w;let i;for(;Date.now()<e;){if(d)throw T(d);if(i??=s[0],i&&b(i.stage))break;await p()}if(!i)throw new Error(`The story rendered a canvas but never initialized a Pixi Application within ${w/1e3}s — it is not a canvas story, or its renderer could not be created here.`);i.stop(),i.ticker.lastTime=0;let u=!1;return{host:o,stage:i.stage,ticker:i.ticker,app:i,dispose(){u||(u=!0,a())}}})}catch(s){throw a(),s}}const O=w;async function J(t,c=Date.now){if(t.length===0)return;const n=new Set,o=t.map(r=>{const a={postrender:()=>{n.add(r)}};return r.renderer?.runners.postrender.add(a),{app:r,observer:a}});try{const r=c()+O;for(;c()<r;){if(t.every(s=>s.stage!==void 0&&b(s.stage)&&n.has(s)))return;await p()}}finally{for(const{app:r,observer:a}of o)r.renderer?.runners.postrender.remove(a)}}function T(t){return new Error(`mountStoryPixi: the story threw while rendering — it does not mount Pixi content, or its component crashed. Original error: ${t instanceof Error?t.message:String(t)}`,{cause:t})}export{J as awaitPixiStoryFrame,G as capturePixiStoryThumbnail,_ as disposeStoryPixi,R as mountStoryPixi,C as withPixiStoryMountTurn};
1
+ import{r as v}from"./index-nmcBqr7Y.js";import{withApplicationCollector as E}from"./canvas-preview-frames-BzLeTumX.js";import{C as M}from"./crash-null-boundary-v3a0uEgw.js";import{m as b}from"./pixi-story-model-DNkfnWUV.js";import{az as P}from"./index-V4J7xfRg.js";import{r as S}from"./story-mount-turn-DFRTj5hi.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-D_ViOFCz.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const w=1e4,k=12,I="position:fixed;left:-20000px;top:0;width:512px;height:512px;overflow:hidden;contain:strict;pointer-events:none;visibility:hidden;";function C(t){return S(()=>t(D))}function R(t,c={}){return C(n=>n(t,c))}function _(t){return S(async()=>t.dispose())}async function G(t,c={}){const n=await R(t,c.props??{});try{const o=c.width??128,r=c.height??96;n.app.renderer.render({container:n.stage});const a=n.stage.getBounds(),s=c.layout==="fullscreen",d=8,e=n.app.screen.clone();s||(e.x=a.x-d,e.y=a.y-d,e.width=Math.max(1,a.width+d*2),e.height=Math.max(1,a.height+d*2));const i=o/r;if(!s&&e.width/e.height<i){const l=e.height*i;e.x-=(l-e.width)/2,e.width=l}else if(!s&&e.width/e.height>i){const l=e.width/i;e.y-=(l-e.height)/2,e.height=l}const u=n.app.renderer.background,h=await n.app.renderer.extract.canvas({target:n.stage,frame:e,...s&&u.alpha>0?{clearColor:u.colorRgba}:{}}),m=document.createElement("canvas");m.width=o,m.height=r;const f=m.getContext("2d");if(!f)throw new Error("Canvas story preview could not create a 2D readback context.");const g=Math.min(o/h.width,r/h.height),y=h.width*g,x=h.height*g;return f.drawImage(h,(o-y)/2,(r-x)/2,y,x),m.toDataURL("image/png")}finally{await _(n)}}const p=()=>new Promise(t=>setTimeout(t,0));async function D(t,c={}){typeof t.load=="function"&&await t.load();const n=await P(),o=document.createElement("div");o.setAttribute("style",I),document.body.appendChild(o);let r=null;const a=()=>{r?.unmount(),r=null,o.remove()};try{return await E(async s=>{let d=null;r=n.createRoot(o),r.render(v.createElement(M,{onCaught:h=>{d??=h}},v.createElement(t,c)));for(let h=0;h<k&&!(d||o.querySelector("canvas"));h++)await p();if(d)throw T(d);if(!o.querySelector("canvas"))throw new Error("The story rendered no canvas — it does not mount Pixi content.");const e=Date.now()+w;let i;for(;Date.now()<e;){if(d)throw T(d);if(i??=s[0],i&&b(i.stage))break;await p()}if(!i)throw new Error(`The story rendered a canvas but never initialized a Pixi Application within ${w/1e3}s — it is not a canvas story, or its renderer could not be created here.`);i.stop(),i.ticker.lastTime=0;let u=!1;return{host:o,stage:i.stage,ticker:i.ticker,app:i,dispose(){u||(u=!0,a())}}})}catch(s){throw a(),s}}const O=w;async function J(t,c=Date.now){if(t.length===0)return;const n=new Set,o=t.map(r=>{const a={postrender:()=>{n.add(r)}};return r.renderer?.runners.postrender.add(a),{app:r,observer:a}});try{const r=c()+O;for(;c()<r;){if(t.every(s=>s.stage!==void 0&&b(s.stage)&&n.has(s)))return;await p()}}finally{for(const{app:r,observer:a}of o)r.renderer?.runners.postrender.remove(a)}}function T(t){return new Error(`mountStoryPixi: the story threw while rendering — it does not mount Pixi content, or its component crashed. Original error: ${t instanceof Error?t.message:String(t)}`,{cause:t})}export{J as awaitPixiStoryFrame,G as capturePixiStoryThumbnail,_ as disposeStoryPixi,R as mountStoryPixi,C as withPixiStoryMountTurn};
@@ -1 +1 @@
1
- import{bh as P,bi as L,bj as j}from"./index-CvGsVzTo.js";const M=640,R=400;function F(e,t){return`portable-${e}:${t.map(n=>encodeURIComponent(n)).join("/")}`}function N(e){const t=new Map,n=[],u=new Map,r=new Map;for(const o of e){const s=P({modulePath:o.modulePath,...o.title?{title:o.title}:{}}),h=[...s.segments,s.leaf];let a=null;for(let d=0;d<h.length;d++){const p=h.slice(0,d+1),c=d===h.length-1,i=F(c?"component":"folder",p);t.has(i)||(t.set(i,{id:i,label:p.at(-1),role:c?"component":"folder",kind:c?"component":"group",typeLabel:c?"Component":d===0?"Category":"Folder",parentId:a,childIds:[],...c?{secondaryLabel:o.modulePath}:{}}),a?t.get(a)?.childIds.push(i):n.push(i)),a=i}const l=a;t.get(l)?.childIds.push(o.id),u.set(o.id,l);const f=r.get(l);f?f.storyIds.push(o.id):r.set(l,{id:l,label:L(s),storyIds:[o.id]})}return{sections:[...r.values()],nodes:[...t.values()],rootIds:n,storyParentIds:u}}function y(e){return e&&typeof e=="object"?e:null}function v(e){if(typeof e!="string")return null;const t=Number.parseFloat(e);return Number.isFinite(t)&&t>0?t:null}function S(e){const t=y(y(e.viewport)?.options),n={...j};if(!t)return n;for(const[u,r]of Object.entries(t)){const o=y(r),s=y(o?.styles);!o||!s||typeof o.name!="string"||typeof s.width!="string"||typeof s.height!="string"||(n[u]={name:o.name,styles:{width:s.width,height:s.height},...typeof o.type=="string"?{type:o.type}:{}})}return n}function T(e){const t=e.viewport;if(typeof t=="string")return{value:t||null,isRotated:!1};const n=y(t);return{value:typeof n?.value=="string"&&n.value?n.value:null,isRotated:n?.isRotated===!0}}function x(e,t,n,u){const r=e.parameters??{},o=e.globals??{},s=r.layout,h=s==="centered"||s==="fullscreen"||s==="padded"?s:"padded",a=S(r),l=Object.entries(a).flatMap(([m,b])=>{const w=v(b.styles.width),I=v(b.styles.height);return w&&I?[{id:m,label:b.name,width:w,height:I}]:[]}),f=T(o),d=n===void 0?f.value:n,p=l.find(m=>m.id===d),c=p?.width??t?.width??M,i=p?.height??t?.height??R,g=u??f.isRotated;return{layout:h,choices:l,selectedViewportId:p?.id??null,locked:e.viewportLocked===!0,rotated:g,width:g?i:c,height:g?c:i}}function G(e,t=N(e)){return{index:t,resolve:x}}export{N as c,G as s};
1
+ import{bh as P,bi as L,bj as j}from"./index-V4J7xfRg.js";const M=640,R=400;function F(e,t){return`portable-${e}:${t.map(n=>encodeURIComponent(n)).join("/")}`}function N(e){const t=new Map,n=[],u=new Map,r=new Map;for(const o of e){const s=P({modulePath:o.modulePath,...o.title?{title:o.title}:{}}),h=[...s.segments,s.leaf];let a=null;for(let d=0;d<h.length;d++){const p=h.slice(0,d+1),c=d===h.length-1,i=F(c?"component":"folder",p);t.has(i)||(t.set(i,{id:i,label:p.at(-1),role:c?"component":"folder",kind:c?"component":"group",typeLabel:c?"Component":d===0?"Category":"Folder",parentId:a,childIds:[],...c?{secondaryLabel:o.modulePath}:{}}),a?t.get(a)?.childIds.push(i):n.push(i)),a=i}const l=a;t.get(l)?.childIds.push(o.id),u.set(o.id,l);const f=r.get(l);f?f.storyIds.push(o.id):r.set(l,{id:l,label:L(s),storyIds:[o.id]})}return{sections:[...r.values()],nodes:[...t.values()],rootIds:n,storyParentIds:u}}function y(e){return e&&typeof e=="object"?e:null}function v(e){if(typeof e!="string")return null;const t=Number.parseFloat(e);return Number.isFinite(t)&&t>0?t:null}function S(e){const t=y(y(e.viewport)?.options),n={...j};if(!t)return n;for(const[u,r]of Object.entries(t)){const o=y(r),s=y(o?.styles);!o||!s||typeof o.name!="string"||typeof s.width!="string"||typeof s.height!="string"||(n[u]={name:o.name,styles:{width:s.width,height:s.height},...typeof o.type=="string"?{type:o.type}:{}})}return n}function T(e){const t=e.viewport;if(typeof t=="string")return{value:t||null,isRotated:!1};const n=y(t);return{value:typeof n?.value=="string"&&n.value?n.value:null,isRotated:n?.isRotated===!0}}function x(e,t,n,u){const r=e.parameters??{},o=e.globals??{},s=r.layout,h=s==="centered"||s==="fullscreen"||s==="padded"?s:"padded",a=S(r),l=Object.entries(a).flatMap(([m,b])=>{const w=v(b.styles.width),I=v(b.styles.height);return w&&I?[{id:m,label:b.name,width:w,height:I}]:[]}),f=T(o),d=n===void 0?f.value:n,p=l.find(m=>m.id===d),c=p?.width??t?.width??M,i=p?.height??t?.height??R,g=u??f.isRotated;return{layout:h,choices:l,selectedViewportId:p?.id??null,locked:e.viewportLocked===!0,rotated:g,width:g?i:c,height:g?c:i}}function G(e,t=N(e)){return{index:t,resolve:x}}export{N as c,G as s};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/react-three-rapier.esm-BO2XPUEM.js","assets/index-CvGsVzTo.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-CPiRKiDC.css","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/events-156d8d12.esm-CYeuVCYr.js","assets/index-bQE2NA0D.js","assets/BufferGeometryUtils-FJZNEiJN.js"])))=>i.map(i=>d[i]);
2
- import{M as U,h3 as W,h4 as z,_ as H}from"./index-CvGsVzTo.js";import{r as F}from"./index-nmcBqr7Y.js";import{f as G}from"./asset-preview-B7j9QV6N.js";import{C as $}from"./crash-null-boundary-v3a0uEgw.js";import{T as q}from"./three.module-BLhyNg0e.js";import{e as Q,f as V}from"./events-156d8d12.esm-CYeuVCYr.js";import{r as X}from"./story-mount-turn-DFRTj5hi.js";import{A as J,ej as K,d7 as Y}from"./three.core-3arARmh6.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D_NuPfjr.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./editor-layers-BK3fNRb7.js";import"./workspace-arrangement-C9uemwSK.js";import"./renderer-ownership-BovSEcLv.js";import"./hierarchy-marks-Pb6wnNcu.js";import"./studio-environment-DK0ke0m0.js";import"./user-data-DfBtZvxw.js";import"./KTX2Loader-CaqVE6nY.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";import"./bitmap-label-Ct4k6ehY.js";import"./index-bQE2NA0D.js";const Z=1/60,ee=6,te=15,N=1e-4,ne=2,re=10,oe=250,ie=4e3;function g(e){e.updateMatrixWorld(!0);const t=[];return e.traverse(n=>{const r=n.matrixWorld.elements;t.push(r[12],r[13],r[14])}),t}function D(e){let t=0;return e.traverse(()=>{t++}),t}function x(e,t){if(e.length!==t.length)return Number.NaN;let n=0;for(let r=0;r<t.length;r+=3){const o=t[r]-e[r],a=t[r+1]-e[r+1],i=t[r+2]-e[r+2],s=Math.sqrt(o*o+a*a+i*i);if(!Number.isFinite(s))return Number.NaN;s>n&&(n=s)}return n}const se=()=>new Promise(e=>setTimeout(e,0));async function ae(e,t,n){const r=n();let o=D(e),a=r,i=!1;for(;n()-r<ie;){if(n()-a>=oe){i=!0;break}await t();const s=D(e);s!==o&&(o=s,a=n())}return{buildWaitMs:n()-r,buildSettled:i}}function C(e){return{outcome:e,steps:0,lastMotion:0,buildWaitMs:0,buildSettled:!0}}function ce(e){return e.hasPhysicsSubscriber!==!1}async function ue(e,t={}){const n=t.yieldTurn??se,r=t.now??(()=>Date.now()),o=e.update?.bind(e);if(!o)return C("unsupported");if(!ce(e))return C("still");const{buildWaitMs:a,buildSettled:i}=await ae(e.scene,n,r);let s=g(e.scene),l=0,u=0,h=!1,E=0,y="still";for(let d=0;d<te;d++){for(let w=0;w<ee;w++)o(Z),l++;await n();const m=g(e.scene),p=x(s,m);if(s=m,!Number.isFinite(p)){u=0;continue}if(E=p,p>N){h=!0,u=0,y="budget";continue}if(u++,h&&u>=ne){y="rest";break}}for(let d=0;d<re;d++){await n();const m=g(e.scene),p=x(s,m);if(s=m,Number.isFinite(p)&&p<=N)break}return{outcome:y,steps:l,lastMotion:E,buildWaitMs:a,buildSettled:i}}const le={packaged:!1,createElement:F.createElement,createR3FRoot:V,extendThree:Q,three:q};let R=null;async function de(){const e=await import(W);for(const t of["createElement","createR3FRoot","extendThree"])if(typeof e[t]!="function")throw new Error(`The packaged R3F preview runtime did not export ${t} as a function — see vite-plugin-module-doorways.ts.`);if(typeof e.projectThree!="object"||e.projectThree===null)throw new Error("The packaged R3F preview runtime did not export projectThree — see vite-plugin-module-doorways.ts.");return{packaged:!0,createElement:e.createElement,createR3FRoot:e.createR3FRoot,extendThree:e.extendThree,three:e.projectThree}}async function me(){return await U()?(R||(R=de()),R):le}let T=null;function nt(){return T}const v="volter:story-preview-root",pe=1e4;function P(e){if(typeof e=="function"){const t=e;return t.displayName||t.name||""}if(e&&typeof e=="object"){const t=e;return typeof t.displayName=="string"&&t.displayName.length>0?t.displayName:typeof t.name=="string"&&t.name.length>0?t.name:P(t.type??t.render)}return""}function fe(e){const t=e,n=t._reactInternals??t._reactInternalFiber;return n&&typeof n=="object"?n:void 0}function he(e){const t=[P(e.type),P(e.elementType)];if(!(t.includes("RigidBody")||t.includes("InstancedRigidBodies")))return{provider:t.includes("Physics"),body:!1,movingBody:!1};const r=e.memoizedProps&&typeof e.memoizedProps=="object"?e.memoizedProps:{};return{provider:t.includes("Physics"),body:!0,movingBody:r.type!=="fixed"}}function ye(e){const t=e?[e]:[],n=new Set;let r=!1,o=!1,a=!1;for(;t.length>0;){const i=t.pop();if(n.has(i))continue;n.add(i);const s=he(i);r||=s.provider,o||=s.body,a||=s.movingBody,i.child&&t.push(i.child),i.sibling&&t.push(i.sibling)}return r?!o||a:!1}class we extends F.Component{componentDidMount(){this.props.onReport(ye(fe(this)))}render(){return this.props.children??null}}function Ee(e){return e instanceof Error&&e.message.includes("is not part of the THREE namespace")}function L(e){return Ee(e)?!0:e instanceof Error?e.message.includes("Hooks can only be used within the Canvas component")||e.message.includes("useGame: no Game in context"):!1}function rt(e){return L(e)}function I(e){return e instanceof Error&&e.message.includes("useRapier must be used within <Physics")}async function Te(e){try{return(e.packaged?await import("/@id/@react-three/rapier"):await H(()=>import("./react-three-rapier.esm-BO2XPUEM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))).Physics}catch{return null}}function Se(e,t,n){const r=globalThis,o=r.reportError,a=typeof o=="function"?o.bind(globalThis):i=>{console.error(i)};r.reportError=i=>{L(i)||t&&I(i)||a(i)};try{return n(e)}finally{r.reportError=o}}function be(e){return{domElement:e,xr:{enabled:!1,addEventListener(){},removeEventListener(){},setAnimationLoop(){},getSession(){return null}},shadowMap:{enabled:!1,type:Y},outputColorSpace:K,toneMapping:J,setPixelRatio(){},setSize(){},setClearColor(){},setClearAlpha(){},setViewport(){},setScissor(){},setScissorTest(){},setAnimationLoop(){},clear(){},render(){},compile(){},dispose(){},getPixelRatio(){return 1},getContext(){return null}}}let O=null;function k(e){return X(()=>e(Pe))}function ge(e){O!==e.extendThree&&(O=e.extendThree,e.extendThree(e.three))}async function Re(e,t={}){return k(n=>n(e,t))}function ve(e){return k(async()=>e.dispose())}async function Pe(e,t={}){const n=z();T=null;const r=n?Date.now():0,o=await me(),a=n?Date.now()-r:0,i=n?Date.now():0;typeof e.load=="function"&&await e.load();const s=n?Date.now()-i:0;try{return await j(o,e,t,void 0,{timed:n,runtimeMs:a,loadMs:s})}catch(l){if(!I(l))throw l;const u=await Te(o);if(!u)throw l;return await j(o,e,t,h=>o.createElement(u,{paused:!1},h),{timed:n,runtimeMs:a,loadMs:s})}}async function j(e,t,n,r,o){ge(e);const a=document.createElement("canvas"),i=Se(a,r===void 0,e.createR3FRoot);let s;const l=new Promise(c=>{s=c});await i.configure({gl:(()=>be(a)),frameloop:"never",size:{width:128,height:96,top:0,left:0},onCreated:c=>s(c)});let u=null,h;const E=new Promise((c,b)=>{h=b}),y=c=>{u??=new Error("mountStoryObject3D: the story threw while reconciling into an R3F root — it does not render `three` content (a DOM/React story), or its component crashed. Original error: "+String(c instanceof Error?c.message:c),{cause:c}),h(u)},d=e.createElement(t,n);let m=!1;const p=c=>{m=c};i.render(e.createElement("group",{name:v},e.createElement($,{onCaught:y},e.createElement(we,{onReport:p},r?r(d):d))));const w=o?.timed?Date.now():0;let M;const f=await Promise.race([l,E,new Promise((c,b)=>{M=setTimeout(()=>b(new Error("mountStoryObject3D: onCreated did not fire within 10s — the story never reached its first R3F commit and never threw. Either it is still SUSPENDED on a slow load (a suspending loader with no <Suspense> boundary holds the first commit until its content is ready), or its render is hung.")),pe)})]).catch(c=>{throw o?.timed&&(T={runtimeMs:o.runtimeMs,loadMs:o.loadMs,fiberMs:Date.now()-w,settleMs:0}),i.unmount(),c}).finally(()=>clearTimeout(M));if(u)throw i.unmount(),u;f.clock.autoStart=!1,f.clock.stop();const S=f.scene.getObjectByName(v);if(!S)throw i.unmount(),new Error(`mountStoryObject3D: the story's wrapper group ("${v}") is not in the scene after its first commit — the story rendered nothing mountable.`);const A=o?.timed?Date.now()-w:0,B=o?.timed?Date.now():0;await ue({scene:S,update:c=>{f.advance(f.clock.elapsedTime+Math.min(c,.1),!1)},hasPhysicsSubscriber:m}),o?.timed&&(T={runtimeMs:o.runtimeMs,loadMs:o.loadMs,fiberMs:A,settleMs:Date.now()-B});let _=f.clock.elapsedTime;return{root:S,scene:f.scene,advance(c){!(c>0)||!Number.isFinite(c)||(_+=Math.min(c,.1),f.advance(_,!1))},dispose(){i.unmount()}}}async function ot(e,t={}){const n=await Re(e,t.props??{});try{const r=G(n.root,{width:t.width??128,height:t.height??96,...t.camera===void 0?{}:{camera:t.camera},...t.pose===void 0?{}:{pose:t.pose}}),o=r.views.find(a=>a.view==="perspective")??r.views[0];if(!o)throw new Error("Story preview capture returned no views.");return`data:${o.mimeType};base64,${o.base64}`}finally{await ve(n)}}function it(){return typeof WebGLRenderingContext<"u"&&typeof navigator<"u"&&!navigator.userAgent.toLowerCase().includes("jsdom")}export{v as PREVIEW_ROOT_NAME,ot as captureStoryComponentThumbnail,ve as disposeStoryObject3D,rt as isStoryThreeClassificationRefusal,nt as lastStoryMountPhaseTiming,Re as mountStoryObject3D,it as supportsThreeStoryCapture,k as withStoryMountTurn};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/react-three-rapier.esm-DyMNYoA_.js","assets/index-V4J7xfRg.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-CPiRKiDC.css","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/events-156d8d12.esm-CYeuVCYr.js","assets/index-bQE2NA0D.js","assets/BufferGeometryUtils-FJZNEiJN.js"])))=>i.map(i=>d[i]);
2
+ import{V as U,h3 as W,h4 as z,_ as H}from"./index-V4J7xfRg.js";import{r as F}from"./index-nmcBqr7Y.js";import{a as G}from"./asset-preview-BS71mXsZ.js";import{C as V}from"./crash-null-boundary-v3a0uEgw.js";import{T as $}from"./three.module-BLhyNg0e.js";import{e as q,f as Q}from"./events-156d8d12.esm-CYeuVCYr.js";import{r as X}from"./story-mount-turn-DFRTj5hi.js";import{A as J,ej as K,d7 as Y}from"./three.core-3arARmh6.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D_NuPfjr.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./editor-layers-CjeYrUlm.js";import"./workspace-arrangement-B_OcbQbj.js";import"./renderer-ownership-BovSEcLv.js";import"./hierarchy-marks-B1jSqxSv.js";import"./studio-environment-BIhqrtFc.js";import"./user-data-CifDDvSr.js";import"./KTX2Loader-CaqVE6nY.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";import"./bitmap-label-Ct4k6ehY.js";import"./index-bQE2NA0D.js";const Z=1/60,ee=6,te=15,N=1e-4,ne=2,re=10,oe=250,ie=4e3;function g(e){e.updateMatrixWorld(!0);const t=[];return e.traverse(n=>{const r=n.matrixWorld.elements;t.push(r[12],r[13],r[14])}),t}function D(e){let t=0;return e.traverse(()=>{t++}),t}function x(e,t){if(e.length!==t.length)return Number.NaN;let n=0;for(let r=0;r<t.length;r+=3){const o=t[r]-e[r],a=t[r+1]-e[r+1],i=t[r+2]-e[r+2],s=Math.sqrt(o*o+a*a+i*i);if(!Number.isFinite(s))return Number.NaN;s>n&&(n=s)}return n}const se=()=>new Promise(e=>setTimeout(e,0));async function ae(e,t,n){const r=n();let o=D(e),a=r,i=!1;for(;n()-r<ie;){if(n()-a>=oe){i=!0;break}await t();const s=D(e);s!==o&&(o=s,a=n())}return{buildWaitMs:n()-r,buildSettled:i}}function C(e){return{outcome:e,steps:0,lastMotion:0,buildWaitMs:0,buildSettled:!0}}function ce(e){return e.hasPhysicsSubscriber!==!1}async function ue(e,t={}){const n=t.yieldTurn??se,r=t.now??(()=>Date.now()),o=e.update?.bind(e);if(!o)return C("unsupported");if(!ce(e))return C("still");const{buildWaitMs:a,buildSettled:i}=await ae(e.scene,n,r);let s=g(e.scene),l=0,u=0,h=!1,E=0,y="still";for(let d=0;d<te;d++){for(let w=0;w<ee;w++)o(Z),l++;await n();const m=g(e.scene),p=x(s,m);if(s=m,!Number.isFinite(p)){u=0;continue}if(E=p,p>N){h=!0,u=0,y="budget";continue}if(u++,h&&u>=ne){y="rest";break}}for(let d=0;d<re;d++){await n();const m=g(e.scene),p=x(s,m);if(s=m,Number.isFinite(p)&&p<=N)break}return{outcome:y,steps:l,lastMotion:E,buildWaitMs:a,buildSettled:i}}const le={packaged:!1,createElement:F.createElement,createR3FRoot:Q,extendThree:q,three:$};let R=null;async function de(){const e=await import(W);for(const t of["createElement","createR3FRoot","extendThree"])if(typeof e[t]!="function")throw new Error(`The packaged R3F preview runtime did not export ${t} as a function — see vite-plugin-module-doorways.ts.`);if(typeof e.projectThree!="object"||e.projectThree===null)throw new Error("The packaged R3F preview runtime did not export projectThree — see vite-plugin-module-doorways.ts.");return{packaged:!0,createElement:e.createElement,createR3FRoot:e.createR3FRoot,extendThree:e.extendThree,three:e.projectThree}}async function me(){return await U()?(R||(R=de()),R):le}let T=null;function nt(){return T}const v="volter:story-preview-root",pe=1e4;function P(e){if(typeof e=="function"){const t=e;return t.displayName||t.name||""}if(e&&typeof e=="object"){const t=e;return typeof t.displayName=="string"&&t.displayName.length>0?t.displayName:typeof t.name=="string"&&t.name.length>0?t.name:P(t.type??t.render)}return""}function fe(e){const t=e,n=t._reactInternals??t._reactInternalFiber;return n&&typeof n=="object"?n:void 0}function he(e){const t=[P(e.type),P(e.elementType)];if(!(t.includes("RigidBody")||t.includes("InstancedRigidBodies")))return{provider:t.includes("Physics"),body:!1,movingBody:!1};const r=e.memoizedProps&&typeof e.memoizedProps=="object"?e.memoizedProps:{};return{provider:t.includes("Physics"),body:!0,movingBody:r.type!=="fixed"}}function ye(e){const t=e?[e]:[],n=new Set;let r=!1,o=!1,a=!1;for(;t.length>0;){const i=t.pop();if(n.has(i))continue;n.add(i);const s=he(i);r||=s.provider,o||=s.body,a||=s.movingBody,i.child&&t.push(i.child),i.sibling&&t.push(i.sibling)}return r?!o||a:!1}class we extends F.Component{componentDidMount(){this.props.onReport(ye(fe(this)))}render(){return this.props.children??null}}function Ee(e){return e instanceof Error&&e.message.includes("is not part of the THREE namespace")}function L(e){return Ee(e)?!0:e instanceof Error?e.message.includes("Hooks can only be used within the Canvas component")||e.message.includes("useGame: no Game in context"):!1}function rt(e){return L(e)}function I(e){return e instanceof Error&&e.message.includes("useRapier must be used within <Physics")}async function Te(e){try{return(e.packaged?await import("/@id/@react-three/rapier"):await H(()=>import("./react-three-rapier.esm-DyMNYoA_.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))).Physics}catch{return null}}function Se(e,t,n){const r=globalThis,o=r.reportError,a=typeof o=="function"?o.bind(globalThis):i=>{console.error(i)};r.reportError=i=>{L(i)||t&&I(i)||a(i)};try{return n(e)}finally{r.reportError=o}}function be(e){return{domElement:e,xr:{enabled:!1,addEventListener(){},removeEventListener(){},setAnimationLoop(){},getSession(){return null}},shadowMap:{enabled:!1,type:Y},outputColorSpace:K,toneMapping:J,setPixelRatio(){},setSize(){},setClearColor(){},setClearAlpha(){},setViewport(){},setScissor(){},setScissorTest(){},setAnimationLoop(){},clear(){},render(){},compile(){},dispose(){},getPixelRatio(){return 1},getContext(){return null}}}let O=null;function k(e){return X(()=>e(Pe))}function ge(e){O!==e.extendThree&&(O=e.extendThree,e.extendThree(e.three))}async function Re(e,t={}){return k(n=>n(e,t))}function ve(e){return k(async()=>e.dispose())}async function Pe(e,t={}){const n=z();T=null;const r=n?Date.now():0,o=await me(),a=n?Date.now()-r:0,i=n?Date.now():0;typeof e.load=="function"&&await e.load();const s=n?Date.now()-i:0;try{return await j(o,e,t,void 0,{timed:n,runtimeMs:a,loadMs:s})}catch(l){if(!I(l))throw l;const u=await Te(o);if(!u)throw l;return await j(o,e,t,h=>o.createElement(u,{paused:!1},h),{timed:n,runtimeMs:a,loadMs:s})}}async function j(e,t,n,r,o){ge(e);const a=document.createElement("canvas"),i=Se(a,r===void 0,e.createR3FRoot);let s;const l=new Promise(c=>{s=c});await i.configure({gl:(()=>be(a)),frameloop:"never",size:{width:128,height:96,top:0,left:0},onCreated:c=>s(c)});let u=null,h;const E=new Promise((c,b)=>{h=b}),y=c=>{u??=new Error("mountStoryObject3D: the story threw while reconciling into an R3F root — it does not render `three` content (a DOM/React story), or its component crashed. Original error: "+String(c instanceof Error?c.message:c),{cause:c}),h(u)},d=e.createElement(t,n);let m=!1;const p=c=>{m=c};i.render(e.createElement("group",{name:v},e.createElement(V,{onCaught:y},e.createElement(we,{onReport:p},r?r(d):d))));const w=o?.timed?Date.now():0;let M;const f=await Promise.race([l,E,new Promise((c,b)=>{M=setTimeout(()=>b(new Error("mountStoryObject3D: onCreated did not fire within 10s — the story never reached its first R3F commit and never threw. Either it is still SUSPENDED on a slow load (a suspending loader with no <Suspense> boundary holds the first commit until its content is ready), or its render is hung.")),pe)})]).catch(c=>{throw o?.timed&&(T={runtimeMs:o.runtimeMs,loadMs:o.loadMs,fiberMs:Date.now()-w,settleMs:0}),i.unmount(),c}).finally(()=>clearTimeout(M));if(u)throw i.unmount(),u;f.clock.autoStart=!1,f.clock.stop();const S=f.scene.getObjectByName(v);if(!S)throw i.unmount(),new Error(`mountStoryObject3D: the story's wrapper group ("${v}") is not in the scene after its first commit — the story rendered nothing mountable.`);const A=o?.timed?Date.now()-w:0,B=o?.timed?Date.now():0;await ue({scene:S,update:c=>{f.advance(f.clock.elapsedTime+Math.min(c,.1),!1)},hasPhysicsSubscriber:m}),o?.timed&&(T={runtimeMs:o.runtimeMs,loadMs:o.loadMs,fiberMs:A,settleMs:Date.now()-B});let _=f.clock.elapsedTime;return{root:S,scene:f.scene,advance(c){!(c>0)||!Number.isFinite(c)||(_+=Math.min(c,.1),f.advance(_,!1))},dispose(){i.unmount()}}}async function ot(e,t={}){const n=await Re(e,t.props??{});try{const r=G(n.root,{width:t.width??128,height:t.height??96,...t.camera===void 0?{}:{camera:t.camera},...t.pose===void 0?{}:{pose:t.pose}}),o=r.views.find(a=>a.view==="perspective")??r.views[0];if(!o)throw new Error("Story preview capture returned no views.");return`data:${o.mimeType};base64,${o.base64}`}finally{await ve(n)}}function it(){return typeof WebGLRenderingContext<"u"&&typeof navigator<"u"&&!navigator.userAgent.toLowerCase().includes("jsdom")}export{v as PREVIEW_ROOT_NAME,ot as captureStoryComponentThumbnail,ve as disposeStoryObject3D,rt as isStoryThreeClassificationRefusal,nt as lastStoryMountPhaseTiming,Re as mountStoryObject3D,it as supportsThreeStoryCapture,k as withStoryMountTurn};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/spark.module-Byplgb8G.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/Pass-D1MRT672.js"])))=>i.map(i=>d[i]);
2
- import{_ as g}from"./index-CvGsVzTo.js";import{s as f}from"./user-data-DfBtZvxw.js";import{D as T,K as S,M as E}from"./KTX2Loader-CaqVE6nY.js";import{GLTFLoader as L}from"./GLTFLoader-KeoruJgS.js";import{cc as M,eX as v,fo as p,co as I,K as b}from"./three.core-3arARmh6.js";import{createStandardEnvironment as x}from"./environment-Dg-YaLsA.js";let D="/";function w(t){return t.startsWith("/")||t.startsWith("http")||t.startsWith("data:")||t.startsWith("blob:")?t:D+t}const r=new M;r.setURLModifier(w);new v(r);const h=new T(r);h.setDecoderPath("/jsm/libs/draco/gltf/");const _=new S(r);_.setTranscoderPath("/jsm/libs/basis/");const l=new L(r);l.setDRACOLoader(h);l.setKTX2Loader(_);l.setMeshoptDecoder(E);function N(t){return w(t)}const i=new Map;async function z(t,a){let e=i.get(t);!e&&a&&(e=Promise.resolve(a),i.set(t,e)),e||(e=fetch(N(t)).then(async s=>{if(!s.ok)throw new Error(`Failed to load Gaussian splat: ${t} (${s.status} ${s.statusText})`);return new Uint8Array(await s.arrayBuffer())}),i.set(t,e));try{const[{SplatMesh:s},u]=await Promise.all([g(()=>import("./spark.module-Byplgb8G.js"),__vite__mapDeps([0,1,2,3])),e]),o=new s({fileBytes:u,fileName:t,raycastable:!0});await o.initialized,f(o,"gaussianSplat",{src:t,numSplats:o.numSplats});const d=o.getBoundingBox();if(!d.isEmpty()){const m=d.getSize(new p).multiplyScalar(1.5),y=d.getCenter(new p),n=new I(new b(m.x,m.y,m.z));n.name="__volter_splat_bounds",n.position.copy(y),n.visible=!1,n.raycast=()=>{},f(n,"engineInternal",!0),o.add(n)}return o}catch(s){throw i.delete(t),s}}const O=.45,C=.25,c=new WeakMap;function K(t,a){let e=c.get(a);e||(e=x(a),c.set(a,e)),t.environment=e.texture,t.environmentIntensity=O}function V(t){const a=c.get(t);a&&(c.delete(t),a.dispose())}export{C as S,K as a,V as d,l as g,z as l,N as r};
2
+ import{_ as g}from"./index-V4J7xfRg.js";import{s as f}from"./user-data-CifDDvSr.js";import{D as T,K as S,M as E}from"./KTX2Loader-CaqVE6nY.js";import{GLTFLoader as L}from"./GLTFLoader-KeoruJgS.js";import{cc as M,eX as v,fo as p,co as I,K as b}from"./three.core-3arARmh6.js";import{createStandardEnvironment as x}from"./environment-Dg-YaLsA.js";let D="/";function w(t){return t.startsWith("/")||t.startsWith("http")||t.startsWith("data:")||t.startsWith("blob:")?t:D+t}const r=new M;r.setURLModifier(w);new v(r);const h=new T(r);h.setDecoderPath("/jsm/libs/draco/gltf/");const _=new S(r);_.setTranscoderPath("/jsm/libs/basis/");const l=new L(r);l.setDRACOLoader(h);l.setKTX2Loader(_);l.setMeshoptDecoder(E);function N(t){return w(t)}const i=new Map;async function z(t,a){let e=i.get(t);!e&&a&&(e=Promise.resolve(a),i.set(t,e)),e||(e=fetch(N(t)).then(async s=>{if(!s.ok)throw new Error(`Failed to load Gaussian splat: ${t} (${s.status} ${s.statusText})`);return new Uint8Array(await s.arrayBuffer())}),i.set(t,e));try{const[{SplatMesh:s},u]=await Promise.all([g(()=>import("./spark.module-Byplgb8G.js"),__vite__mapDeps([0,1,2,3])),e]),o=new s({fileBytes:u,fileName:t,raycastable:!0});await o.initialized,f(o,"gaussianSplat",{src:t,numSplats:o.numSplats});const d=o.getBoundingBox();if(!d.isEmpty()){const m=d.getSize(new p).multiplyScalar(1.5),y=d.getCenter(new p),n=new I(new b(m.x,m.y,m.z));n.name="__volter_splat_bounds",n.position.copy(y),n.visible=!1,n.raycast=()=>{},f(n,"engineInternal",!0),o.add(n)}return o}catch(s){throw i.delete(t),s}}const O=.45,C=.25,c=new WeakMap;function K(t,a){let e=c.get(a);e||(e=x(a),c.set(a,e)),t.environment=e.texture,t.environmentIntensity=O}function V(t){const a=c.get(t);a&&(c.delete(t),a.dispose())}export{C as S,K as a,V as d,l as g,z as l,N as r};
@@ -1,3 +1,3 @@
1
- import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{ex as a}from"./index-CvGsVzTo.js";function $({explanation:e,testId:t,style:o}){return e?s.jsx(a,{"data-testid":t,tone:e.tone,title:e.title,description:s.jsx("span",{style:{whiteSpace:"pre-wrap"},children:e.description}),style:{position:"absolute",inset:0,pointerEvents:"none",...o}}):null}function r(e){return e.map(t=>`“${t}”`).join(", ")}function d(e,t){const o=t.map(n=>n.worldId);return{tone:"error",title:o.length===1?`${e} root ${r(o)} failed`:`${o.length} ${e} roots failed`,description:`${t.map(n=>`${n.worldId} (${n.kind}, ${n.identity}): ${n.message}`).join(`
1
+ import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{ex as a}from"./index-V4J7xfRg.js";function $({explanation:e,testId:t,style:o}){return e?s.jsx(a,{"data-testid":t,tone:e.tone,title:e.title,description:s.jsx("span",{style:{whiteSpace:"pre-wrap"},children:e.description}),style:{position:"absolute",inset:0,pointerEvents:"none",...o}}):null}function r(e){return e.map(t=>`“${t}”`).join(", ")}function d(e,t){const o=t.map(n=>n.worldId);return{tone:"error",title:o.length===1?`${e} root ${r(o)} failed`:`${o.length} ${e} roots failed`,description:`${t.map(n=>`${n.worldId} (${n.kind}, ${n.identity}): ${n.message}`).join(`
2
2
  `)}
3
3
  If this followed an edit, Undo (Ctrl+Z) restores the previous source and remounts.`}}function c(e,t){return{tone:"loading",title:t.length===0?`Loading ${e}`:t.length===1?`Loading ${e} root ${r(t)}`:`Loading ${t.length} ${e} roots`,description:t.length===0?"Reading the project declaration to identify the root that belongs here.":`Waiting for ${r(t)} to finish mounting.`}}function u(e,t){return t.length===0?{tone:"neutral",title:`No ${e} root`,description:"No declared root belongs to this surface."}:{tone:"neutral",title:"No renderable content",description:(t.length===1?`Root ${r(t)} mounted successfully but currently produces no renderable content.`:`Roots ${r(t)} mounted successfully but currently produce no renderable content.`)+" If this world builds its content under its game systems, press Play (▶) to run it."}}function m(e){if(e.content==="present")return null;if(e.playSuspended)return{tone:"neutral",title:"Editing paused during Play",description:`${r(e.rootIds)} is running in the Game tab. Press Stop (⏹) to edit it here.`};const t=new Set(e.rootIds),o=(e.failures??[]).filter(i=>t.has(i.worldId));if(o.length>0)return d(e.surface,o);if(e.disclosure)return{tone:"neutral",title:`No ${e.surface} editor for ${r(e.rootIds)}`,description:e.disclosure};const n=(e.readiness??[]).filter(i=>i.state==="waiting"&&t.has(i.rootId)).map(i=>i.rootId),l=n.length>0?n:e.rootIds;return e.phase==="loading"||n.length>0||e.content==="unknown"?c(e.surface,l):u(e.surface,e.rootIds)}export{$ as S,m as e};
@@ -1 +1 @@
1
- import{ay as t}from"./index-CvGsVzTo.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";function c(e){if(!e)return{type:null};switch(e.kind){case t.SyntaxKind.StringKeyword:return{type:"string"};case t.SyntaxKind.NumberKeyword:return{type:"number"};case t.SyntaxKind.BooleanKeyword:return{type:"boolean"}}if(t.isUnionTypeNode(e)){const n=[];for(const r of e.types){if(!t.isLiteralTypeNode(r))return{type:null};if(t.isStringLiteral(r.literal))n.push(r.literal.text);else if(t.isNumericLiteral(r.literal))n.push(Number(r.literal.text));else return{type:null}}return n.length>0?{type:"enum",options:n}:{type:null}}return t.isTupleTypeNode(e)&&e.elements.length===3&&e.elements.every(n=>n.kind===t.SyntaxKind.NumberKeyword)?{type:"vec3"}:{type:null}}function y(e,n,r){if(!e||!t.isTypeReferenceNode(e)||!t.isIdentifier(e.typeName)||e.typeArguments&&e.typeArguments.length>0)return e;const s=e.typeName.text,i=f(n,s);if(i)return t.isTypeAliasDeclaration(i)?i.type:e;const a=r.get(s);return a?a.type:e}function m(e,n,r,s){for(const i of e){if(!t.isPropertySignature(i))continue;const a=t.isIdentifier(i.name)||t.isStringLiteral(i.name)?i.name.text:null;a&&n.set(a,{optional:i.questionToken!==void 0,...c(y(i.type,r,s))})}}function f(e,n){for(const r of e.statements)if((t.isTypeAliasDeclaration(r)||t.isInterfaceDeclaration(r))&&r.name.text===n)return r;return null}function p(e,n,r,s,i){if(i>4)return;if(t.isTypeLiteralNode(e)){m(e.members,s,n,r);return}if(t.isIntersectionTypeNode(e)){for(const l of e.types)p(l,n,r,s,i+1);return}if(!t.isTypeReferenceNode(e)||!t.isIdentifier(e.typeName))return;const a=e.typeName.text,o=f(n,a);if(o){t.isTypeAliasDeclaration(o)?p(o.type,n,r,s,i+1):m(o.members,s,n,r);return}const u=r.get(a);u&&p(u.type,u.sf,new Map,s,i+1)}function x(e,n){const r=e.getText(n);if(t.isStringLiteral(e)||t.isNoSubstitutionTemplateLiteral(e))return{defaultText:r,defaultValue:e.text};if(t.isNumericLiteral(e))return{defaultText:r,defaultValue:Number(e.text)};if(t.isPrefixUnaryExpression(e)&&e.operator===t.SyntaxKind.MinusToken&&t.isNumericLiteral(e.operand))return{defaultText:r,defaultValue:-Number(e.operand.text)};if(e.kind===t.SyntaxKind.TrueKeyword)return{defaultText:r,defaultValue:!0};if(e.kind===t.SyntaxKind.FalseKeyword)return{defaultText:r,defaultValue:!1};if(t.isArrayLiteralExpression(e)){const s=[];for(const i of e.elements)if(t.isNumericLiteral(i))s.push(Number(i.text));else if(t.isPrefixUnaryExpression(i)&&i.operator===t.SyntaxKind.MinusToken&&t.isNumericLiteral(i.operand))s.push(-Number(i.operand.text));else return{defaultText:r};return{defaultText:r,defaultValue:s}}return{defaultText:r}}function N(e){return t.isFunctionDeclaration(e)&&e.name&&e.parameters[0]?{name:e.name.text,parameter:e.parameters[0]}:t.isVariableDeclaration(e)&&t.isIdentifier(e.name)&&e.initializer&&(t.isArrowFunction(e.initializer)||t.isFunctionExpression(e.initializer))&&e.initializer.parameters[0]?{name:e.name.text,parameter:e.initializer.parameters[0]}:null}function V(e,n){const r=new Map,s=i=>{const a=N(i);if(a&&/^[A-Z]/.test(a.name)&&!r.has(a.name)){const o=b(a.parameter,e,n);o.length>0&&r.set(a.name,o)}(t.isSourceFile(i)||t.isVariableStatement(i)||t.isVariableDeclarationList(i))&&t.forEachChild(i,s)};return s(e),r}function b(e,n,r){const s=new Map;if(t.isObjectBindingPattern(e.name))for(const a of e.name.elements){if(a.dotDotDotToken)continue;const o=a.propertyName??a.name;!t.isIdentifier(o)||!a.initializer||s.set(o.text,x(a.initializer,n))}const i=new Map;if(e.type&&p(e.type,n,r,i,0),i.size>0){const a=[];for(const[o,u]of i){const l=s.get(o);a.push({name:o,type:u.type,...u.options?{options:u.options}:{},optional:u.optional||l!==void 0,...l??{}})}return a}return[...s].map(([a,o])=>({name:a,type:null,optional:!0,...o}))}export{V as localComponentPropSpecs};
1
+ import{aD as t}from"./index-V4J7xfRg.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";function c(e){if(!e)return{type:null};switch(e.kind){case t.SyntaxKind.StringKeyword:return{type:"string"};case t.SyntaxKind.NumberKeyword:return{type:"number"};case t.SyntaxKind.BooleanKeyword:return{type:"boolean"}}if(t.isUnionTypeNode(e)){const n=[];for(const r of e.types){if(!t.isLiteralTypeNode(r))return{type:null};if(t.isStringLiteral(r.literal))n.push(r.literal.text);else if(t.isNumericLiteral(r.literal))n.push(Number(r.literal.text));else return{type:null}}return n.length>0?{type:"enum",options:n}:{type:null}}return t.isTupleTypeNode(e)&&e.elements.length===3&&e.elements.every(n=>n.kind===t.SyntaxKind.NumberKeyword)?{type:"vec3"}:{type:null}}function y(e,n,r){if(!e||!t.isTypeReferenceNode(e)||!t.isIdentifier(e.typeName)||e.typeArguments&&e.typeArguments.length>0)return e;const s=e.typeName.text,i=f(n,s);if(i)return t.isTypeAliasDeclaration(i)?i.type:e;const a=r.get(s);return a?a.type:e}function m(e,n,r,s){for(const i of e){if(!t.isPropertySignature(i))continue;const a=t.isIdentifier(i.name)||t.isStringLiteral(i.name)?i.name.text:null;a&&n.set(a,{optional:i.questionToken!==void 0,...c(y(i.type,r,s))})}}function f(e,n){for(const r of e.statements)if((t.isTypeAliasDeclaration(r)||t.isInterfaceDeclaration(r))&&r.name.text===n)return r;return null}function p(e,n,r,s,i){if(i>4)return;if(t.isTypeLiteralNode(e)){m(e.members,s,n,r);return}if(t.isIntersectionTypeNode(e)){for(const l of e.types)p(l,n,r,s,i+1);return}if(!t.isTypeReferenceNode(e)||!t.isIdentifier(e.typeName))return;const a=e.typeName.text,o=f(n,a);if(o){t.isTypeAliasDeclaration(o)?p(o.type,n,r,s,i+1):m(o.members,s,n,r);return}const u=r.get(a);u&&p(u.type,u.sf,new Map,s,i+1)}function x(e,n){const r=e.getText(n);if(t.isStringLiteral(e)||t.isNoSubstitutionTemplateLiteral(e))return{defaultText:r,defaultValue:e.text};if(t.isNumericLiteral(e))return{defaultText:r,defaultValue:Number(e.text)};if(t.isPrefixUnaryExpression(e)&&e.operator===t.SyntaxKind.MinusToken&&t.isNumericLiteral(e.operand))return{defaultText:r,defaultValue:-Number(e.operand.text)};if(e.kind===t.SyntaxKind.TrueKeyword)return{defaultText:r,defaultValue:!0};if(e.kind===t.SyntaxKind.FalseKeyword)return{defaultText:r,defaultValue:!1};if(t.isArrayLiteralExpression(e)){const s=[];for(const i of e.elements)if(t.isNumericLiteral(i))s.push(Number(i.text));else if(t.isPrefixUnaryExpression(i)&&i.operator===t.SyntaxKind.MinusToken&&t.isNumericLiteral(i.operand))s.push(-Number(i.operand.text));else return{defaultText:r};return{defaultText:r,defaultValue:s}}return{defaultText:r}}function N(e){return t.isFunctionDeclaration(e)&&e.name&&e.parameters[0]?{name:e.name.text,parameter:e.parameters[0]}:t.isVariableDeclaration(e)&&t.isIdentifier(e.name)&&e.initializer&&(t.isArrowFunction(e.initializer)||t.isFunctionExpression(e.initializer))&&e.initializer.parameters[0]?{name:e.name.text,parameter:e.initializer.parameters[0]}:null}function V(e,n){const r=new Map,s=i=>{const a=N(i);if(a&&/^[A-Z]/.test(a.name)&&!r.has(a.name)){const o=b(a.parameter,e,n);o.length>0&&r.set(a.name,o)}(t.isSourceFile(i)||t.isVariableStatement(i)||t.isVariableDeclarationList(i))&&t.forEachChild(i,s)};return s(e),r}function b(e,n,r){const s=new Map;if(t.isObjectBindingPattern(e.name))for(const a of e.name.elements){if(a.dotDotDotToken)continue;const o=a.propertyName??a.name;!t.isIdentifier(o)||!a.initializer||s.set(o.text,x(a.initializer,n))}const i=new Map;if(e.type&&p(e.type,n,r,i,0),i.size>0){const a=[];for(const[o,u]of i){const l=s.get(o);a.push({name:o,type:u.type,...u.options?{options:u.options}:{},optional:u.optional||l!==void 0,...l??{}})}return a}return[...s].map(([a,o])=>({name:a,type:null,optional:!0,...o}))}export{V as localComponentPropSpecs};
@@ -1 +1 @@
1
- import{ah as d,ai as w,aj as b,ak as N}from"./index-CvGsVzTo.js";import{r as m}from"./collaboration-presence-Q6zcL5v0.js";import{e as v,j as P,m as I}from"./game-network-BPTyOFqA.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"./index-OZVqp6xS.js";import"./index-Da9JhEvW.js";import"./native-debug-module-XfhvyMrK.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-Dagj3b6J.js";import"./contract-system-adapters-BRHtWOi_.js";import"./game-contract-seams-5IUqvr7b.js";import"./seeded-random-D0QPgfm6.js";import"./game-audio-BeCyd0Ha.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-B7S-wGjC.js";import"./capability-coverage-9qm5WVwt.js";import"./edit-mode-authoring-DubxVdEM.js";import"./json-history-resource-CckDydoO.js";import"./binding-resolver-CBXePHiR.js";import"./adapter-surface-Y37Nzcyw.js";import"./structural-signature-Dc7skRiy.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./realm-services-DCnaxwIb.js";import"./canvas-entry-runtime-Cjga4XYp.js";import"./three-ingest-runtime-CwRnwvb0.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-CqJH4G9t.js";import"./active-ingest-lrfMBhf9.js";import"./ingest-source-persistence-CPlDA2D8.js";import"./pixi-story-model-DNkfnWUV.js";import"./surface-content-Dg9Kkazf.js";import"./viewport-root-presentation-CkSAEMH-.js";import"./mounted-authoring-D-tXkNKH.js";import"./entity-object-BFppZ54X.js";import"./user-data-DfBtZvxw.js";import"./workspace-arrangement-C9uemwSK.js";import"./three-contract-Dkt6PmWY.js";import"./three-bdxPiUPb.js";import"./editor-layers-BK3fNRb7.js";import"./component-instance-root-MBgAuUpp.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./three-authoring-adapter-BuqO9MDt.js";import"./source-persistence-backend-Djuk0m-7.js";import"./three-projection-core-BO23VKAP.js";import"./body-marks-C1LxJtQb.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./structural-ids-BOo2BRoY.js";import"./object3d-authoring-subject-XccsO0xG.js";import"./r3f-physics-binding-BcTFD1ZS.js";import"./deferred-ingest-play-DZiOEH9a.js";import"./rrweb-Cd2ifIRP.js";import"./react-world-authoring-adapter-B6BiehHR.js";import"./board-guides-whelE-Dr.js";import"./relative-import-specifier-BvzqkvYS.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-DxfAFkho.js";import"./inference-diagnostics-BCwXk-CS.js";import"./writer-tw6EcuVO.js";import"./three-state-BhQOBgKC.js";import"./editor-shell-store-Bro0arjr.js";import"./output-pass-HurwNl0G.js";import"./viewport-door-CuJjGYTz.js";import"./game-surface-defaults-D8S4cRxi.js";const Yt="workspace.service";function Zt(){let i=null;const p=new Set;let e=null,n=null,a=d();const l=()=>{e?.(),e=null,n?.(),n=null,a=null},y=w(u=>{const k=u.participants.find(r=>r.participantId===b)?.capabilities.includes("test")??!1,t=u.activePlaytest,s=I();if(!k||!t){i=null,l(),m({playtest:null}),s?.mode==="team"&&P(),t||p.clear();return}s?.mode==="team"&&s.id===t.id||i!==t.id&&(p.has(t.id)||(i=t.id,m({playtest:{id:t.id,play:"starting",networking:"connecting",roomName:null,problem:null}}),v(t.seed,{mode:"team",id:t.id,roomKey:t.roomKey,revision:t.revision,participantId:b}).then(()=>{if(i!==t.id)return;l();const r=()=>{const o=d(),c=o?.getConnectionState?.(),f=o?.getRoomInfo?.();m({playtest:{id:t.id,play:"ready",networking:o?c==="connected"&&f?"ready":c==="error"?"error":"connecting":"not-declared",roomName:f?.roomName??null,problem:c==="error"?"The game networking adapter reported an error.":null}})},g=()=>{const o=d();o!==a&&(e?.(),a=o,e=o?.subscribe(r)??null),r()};n=N(g),g()}).catch(r=>{i===t.id&&(i=null,p.add(t.id),m({playtest:{id:t.id,play:"error",networking:"error",roomName:null,problem:r instanceof Error?r.message:String(r)}}))})))});return()=>{l(),y()}}export{Yt as point,Zt as start};
1
+ import{am as d,an as k,ao as b,ap as N}from"./index-V4J7xfRg.js";import{r as m}from"./collaboration-presence-DcPhahtF.js";import{e as v,j as P,m as I}from"./game-network-CAH_Jsh6.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"./index-OZVqp6xS.js";import"./index-Da9JhEvW.js";import"./native-debug-module-JJOFtIVz.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-xQJcVubm.js";import"./contract-system-adapters-rVGdworX.js";import"./game-contract-seams-DrYyE5PX.js";import"./seeded-random-tpdJjdqy.js";import"./game-audio-BeCyd0Ha.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-CnknlUlT.js";import"./capability-coverage-wd6bAhv3.js";import"./edit-mode-authoring-CSt3zzmS.js";import"./json-history-resource-CH2nzMZh.js";import"./binding-resolver-DUz8C8Fs.js";import"./adapter-surface-Y37Nzcyw.js";import"./structural-signature-Dc7skRiy.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./realm-services-u0mnjXU9.js";import"./canvas-entry-runtime-DskaohHK.js";import"./three-ingest-runtime-BnRF_nJN.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-CqJH4G9t.js";import"./active-ingest-D_ryI_R4.js";import"./ingest-source-persistence-CQOJeGhj.js";import"./pixi-story-model-DNkfnWUV.js";import"./surface-content-Dg9Kkazf.js";import"./viewport-root-presentation-DJLpUuf0.js";import"./mounted-authoring-C47L5H5t.js";import"./entity-object-V13bGmay.js";import"./user-data-CifDDvSr.js";import"./workspace-arrangement-B_OcbQbj.js";import"./three-contract-Dkt6PmWY.js";import"./three-BQfhEwUz.js";import"./editor-layers-CjeYrUlm.js";import"./component-instance-root-Cw_-ajBX.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./three-authoring-adapter-COBwREQO.js";import"./source-persistence-backend-uyd6NiWD.js";import"./three-projection-core-PQm-CO61.js";import"./body-marks-C1LxJtQb.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./structural-ids-BOo2BRoY.js";import"./object3d-authoring-subject-XccsO0xG.js";import"./r3f-physics-binding-DZSIB0d_.js";import"./deferred-ingest-play-CEnsC3uN.js";import"./rrweb-Cd2ifIRP.js";import"./react-world-authoring-adapter-OR1SW2jI.js";import"./board-guides-B6TEPOPi.js";import"./relative-import-specifier-DXWVQf0o.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-DiSjB-N1.js";import"./inference-diagnostics-DoZQ1mpg.js";import"./writer-tw6EcuVO.js";import"./three-state-C7khRIQE.js";import"./editor-shell-store-DckLm6m8.js";import"./output-pass-HurwNl0G.js";import"./viewport-door-BCXEYmon.js";import"./game-surface-defaults-D8S4cRxi.js";const Yt="workspace.service";function Zt(){let i=null;const p=new Set;let e=null,n=null,a=d();const l=()=>{e?.(),e=null,n?.(),n=null,a=null},y=k(u=>{const w=u.participants.find(r=>r.participantId===b)?.capabilities.includes("test")??!1,t=u.activePlaytest,s=I();if(!w||!t){i=null,l(),m({playtest:null}),s?.mode==="team"&&P(),t||p.clear();return}s?.mode==="team"&&s.id===t.id||i!==t.id&&(p.has(t.id)||(i=t.id,m({playtest:{id:t.id,play:"starting",networking:"connecting",roomName:null,problem:null}}),v(t.seed,{mode:"team",id:t.id,roomKey:t.roomKey,revision:t.revision,participantId:b}).then(()=>{if(i!==t.id)return;l();const r=()=>{const o=d(),c=o?.getConnectionState?.(),f=o?.getRoomInfo?.();m({playtest:{id:t.id,play:"ready",networking:o?c==="connected"&&f?"ready":c==="error"?"error":"connecting":"not-declared",roomName:f?.roomName??null,problem:c==="error"?"The game networking adapter reported an error.":null}})},g=()=>{const o=d();o!==a&&(e?.(),a=o,e=o?.subscribe(r)??null),r()};n=N(g),g()}).catch(r=>{i===t.id&&(i=null,p.add(t.id),m({playtest:{id:t.id,play:"error",networking:"error",roomName:null,problem:r instanceof Error?r.message:String(r)}}))})))});return()=>{l(),y()}}export{Yt as point,Zt as start};
@@ -1 +1 @@
1
- import{isInEditorOwnedSubtree as V,isEditorOwnedObject as P}from"./editor-layers-BK3fNRb7.js";import{g as k}from"./user-data-DfBtZvxw.js";import{b as E,c as S}from"./component-instance-root-MBgAuUpp.js";import{n as K,e as $,s as A}from"./entity-object-BFppZ54X.js";import{s as W}from"./viewport-editor-controls-BYaAZ_Ku.js";import{fd as z,e6 as G,B as U}from"./three.core-3arARmh6.js";function q(n){const t=k(n,"constraints");return Array.isArray(t)?t.filter(e=>!!e&&typeof e=="object"&&typeof e.getSnapshot=="function"&&!!e.config):[]}const M="ingest:camera",J=1<<31;function Q(n){return(n.layers.mask&J)!==0}function Y(n,t){const e=new Map;let r=0,s=0,f=0;const u=(i,c)=>{const o=`ingest:${c}:${i.type}:${i.name||""}`;e.set(o,i),r++,i.isLight?f++:i.isMesh&&s++,d(i,c)},d=(i,c)=>{let o=0;for(const h of i.children)Q(h)||(u(h,c?`${c}/${o}`:`${o}`),o++)};return d(n,""),t&&(e.set(M,t),r++),{byId:e,count:r,meshes:s,lights:f}}function Z(n){const t=k(n,"authoringSubject");return t&&typeof t.label=="string"&&typeof t.kind=="string"?t:null}function X(n){const t=k(n,"reflectionProbe");if(!t||typeof t!="object")return null;const e=t;return e.config&&typeof e.recapture=="function"&&typeof e.getSnapshot=="function"?t:null}let D=null;function ht(n){D=n,W(n?.editorControls??null)}function tt(){return D}function C(n){return n.depthWrite===!1&&n.side===U}function et(n){const t=n.material;return t?Array.isArray(t)?t.length>0&&t.every(C):C(t):!1}function L(n,t,e,r=()=>!1,s){const f=tt();if(!f)return[];const u=f.canvas.getBoundingClientRect();if(u.width<=0||u.height<=0||!Number.isFinite(t)||!Number.isFinite(e)||t<u.left||e<u.top||t>=u.left+u.width||e>=u.top+u.height)return[];const d=new z((t-u.left)/u.width*2-1,-((e-u.top)/u.height)*2+1),i=new G;i.layers.enableAll(),i.setFromCamera(d,f.camera);const c=new Set(s?.objects??n.objectMap.values()),o=[...c].filter(b=>{for(let I=b.parent;I;I=I.parent)if(c.has(I))return!1;return!0});for(const b of o)b.traverse(I=>{const m=I;m.isSkinnedMesh&&(m.boundingBox=null,m.boundingSphere=null)});const h=i.intersectObjects(o,!0),p=[],v=new Set;for(const b of h){if(V(b.object)||et(b.object))continue;let I=b.object,m=null;if(s)for(;I&&m===null;)m=s.idForObject3D(I),I=I.parent;else{const a=K(I);m=a?$(a)??null:null}m!==null&&!r(m)&&!v.has(m)&&(v.add(m),p.push(m))}return nt(p,o,h.length,t,e),p}function nt(n,t,e,r,s){n.length>0||r===0&&s===0||console.info(`[viewport-pick] click selected nothing (candidates ${t.length}, rayHits ${e}, resolvedIds 0)`)}function st(n,t,e,r=()=>!1,s){return L(n,t,e,r,s)[0]??null}const R={count:0,meshes:0,lights:0,instancedMeshes:0,instances:0};let x=0;function H(n){let t=0,e=0;for(const r of n.values()){const s=r.object;s.isInstancedMesh&&(t++,e+=typeof s.count=="number"?s.count:0)}return{instancedMeshes:t,instances:e}}function F(n){let t=0,e=0;for(const r of n.values()){const s=r.object;s.isLight?e++:s.isMesh&&t++}return{count:n.size,meshes:t,lights:e,...H(n)}}function T(n,t){const e=new Map,r=[],s=t.skip??P;t.begin?.(n);const f=(u,d,i,c)=>{if(s(u))return;const o=t.identify(u,{path:d,ownerId:i,ownedByAncestor:c});o!==null&&(A(u,o),e.set(o,{object:u,id:o,parentId:i,childIds:[]}),i===null?r.push(o):e.get(i)?.childIds.push(o));const h=c||o!==null;u.children.forEach((p,v)=>{f(p,[...d,v],o??i,h)}),t.leave?.(u,o)};return n.children.forEach((u,d)=>{f(u,[d],null,!1)}),{nodes:e,rootIds:r,stats:F(e)}}const it="r3f:";function O(n,t){return`${it}${n}:${t}`}function rt(n){const t=new Map,e=new Map,r=(d,i)=>d===i||d.startsWith(`${i}#`)&&/^\d+$/u.test(d.slice(i.length+1)),s=d=>{e.clear();const i=c=>{if(P(c))return;const o=E(c),h=$(c);if(o!==void 0&&h!==void 0){const p=O(n,o);r(h,p)&&!e.has(h)&&e.set(h,c)}for(const p of c.children)i(p)};for(const c of d.children)i(c)},f=(d,i)=>{const c=$(d);if(c===void 0||i===void 0)return c;const o=O(n,i);return r(c,o)?e.get(c)===d?c:void 0:c},u=(d,i)=>{const c=O(n,i);let o=t.get(i)??0,h=S(c,o);for(;e.has(h);)o+=1,h=S(c,o);return t.set(i,o+1),e.set(h,d),h};return{begin:d=>{t.clear(),s(d)},identify:(d,i)=>{const c=E(d),o=f(d,c);if(o!==void 0)return o;const h=c===void 0?void 0:u(d,c);return h!==void 0||!i.ownedByAncestor||k(d,"authoringRoot")===!0?h??`live:${n}:${x++}`:null}}}function N(n,t){return T(n,rt(t))}function pt(n,t){const{nodes:e}=N(n,t),r=new Map;for(const[s,f]of e)r.set(s,f.object);return r}function yt(n,t={}){const e=t.camera;return{incremental:{kind:"live-oid",worldId:n},project:r=>{const s=N(r,n);return!e||[...s.nodes.values()].some(f=>f.object===e)?s:(A(e,M),s.nodes.set(M,{object:e,id:M,parentId:null,childIds:[]}),s.rootIds.push(M),{...s,stats:{...s.stats,count:s.nodes.size}})}}}function gt(n={}){const t=n.camera;return{project:e=>{const r=Y(e,t),s=new Map;for(const[d,i]of r.byId)s.set(i,d);const f=new Map,u=[];for(const[d,i]of r.byId){const c=i.parent,o=(c&&c!==e?s.get(c):void 0)??null,h=i.children.map(p=>s.get(p)).filter(p=>p!==void 0);f.set(d,{object:i,id:d,parentId:o,childIds:h}),o===null&&u.push(d)}return{nodes:f,rootIds:u,stats:{count:r.count,meshes:r.meshes,lights:r.lights,...H(f)}}}}}function It(n){let t=new Map,e=new Map;return{get instanceRoots(){return t},get representatives(){return e},project:r=>{const s=new Map,f=new Map,u=new Map,d=new Set,i=new Map,c=T(r,{identify:(o,h)=>{const p=E(o);if(p===void 0)return O(n,`@${h.path.join(".")}`);const v=s.get(p)??0;return s.set(p,v+1),v===0&&u.set(p,o),d.has(p)||(f.set(p,(f.get(p)??0)+1),d.add(p),i.set(o,p)),S(O(n,p),v)},leave:o=>{const h=i.get(o);h!==void 0&&(d.delete(h),i.delete(o))}});return t=f,e=u,c}}}function mt(n){return{project:t=>T(t,{skip:e=>!!k(e,"editorHelper")||e.isSkeletonHelper===!0,identify:(e,r)=>`source-object:${n}:${r.path.join(".")}`})}}function vt(n){const t=Z(n);return t?t.kind:q(n).length>0?"constraint-owner":X(n)?"reflection-probe":n.isSkinnedMesh?"skinned-mesh":n.isBone?"bone":n.isLight?"light":n.isCamera?"camera":n.type==="Audio"||n.type==="PositionalAudio"||n.type==="AudioListener"?"audio":n.isMesh?"mesh":n.children.length>0?"group":"object"}function ot(n,t){for(let e=n.parent;e!==null;e=e.parent)if(e===t)return!0;return!1}function _(n,t){if(n===t)return!0;for(let e=n.parent;e!==null;e=e.parent)if(e===t)return!0;return!1}class wt{constructor(t,e={}){this.identity=t,this.options=e}nodesById=new Map;objectsById=new Map;idsByObjectIndex=new Map;roots=[];walkStats=R;project(t){if(!t)return this.nodesById=new Map,this.objectsById=new Map,this.idsByObjectIndex=new Map,this.roots=[],this.walkStats=R,this.walkStats;const{nodes:e,rootIds:r,stats:s}=this.identity.project(t);return this.nodesById=e,this.objectsById=new Map([...e].map(([f,u])=>[f,u.object])),this.idsByObjectIndex=new Map([...e].map(([f,u])=>[u.object,f])),this.roots=r,this.walkStats=s,s}projectSubtrees(t,e){const r=this.identity.incremental;if(t===null||r?.kind!=="live-oid")return null;const s=e.filter((a,l)=>e.indexOf(a)===l&&!e.some(y=>y!==a&&ot(a,y))),f=this.roots,u=new Set,d=new Set,i=new Set;for(const a of s)a.traverse(l=>{const y=this.idsByObjectIndex.get(l);if(y===void 0)return;const g=this.nodesById.get(y);g?.parentId!==null&&g?.parentId!==void 0&&i.add(g.parentId),u.add(y),this.nodesById.delete(y),this.objectsById.delete(y),this.idsByObjectIndex.delete(l)});const c=P,o=(a,l)=>{const y=this.objectsById.get(a);return y===void 0||y===l},h=(a,l)=>{const y=$(a);if(y!==void 0&&o(y,a))return y;const g=E(a);if(g!==void 0){const w=O(r.worldId,g);let B=0,j=S(w,B);for(;!o(j,a);)j=S(w,++B);return j}if(!l||k(a,"authoringRoot")===!0){let w=`live:${r.worldId}:${x++}`;for(;!o(w,a);)w=`live:${r.worldId}:${x++}`;return w}return null},p=(a,l,y)=>{if(c(a))return;const g=h(a,y);g!==null&&(A(a,g),this.nodesById.set(g,{object:a,id:g,parentId:l,childIds:[]}),this.objectsById.set(g,a),this.idsByObjectIndex.set(a,g),d.add(g),l!==null&&i.add(l));const w=g??l,B=y||g!==null;for(const j of a.children)p(j,w,B)};for(const a of s){if(!_(a,t))continue;let l=a.parent,y=null;for(;l!==null&&l!==t;){const g=this.idsByObjectIndex.get(l);if(g!==void 0){y=g;break}l=l.parent}p(a,y,y!==null)}const v=a=>{const l=[],y=g=>{if(c(g))return;const w=this.idsByObjectIndex.get(g);if(w!==void 0){l.push(w);return}for(const B of g.children)y(B)};for(const g of a.children)y(g);return l};for(const a of i){const l=this.nodesById.get(a);l!==void 0&&l.childIds.splice(0,l.childIds.length,...v(l.object))}for(const a of d){const l=this.nodesById.get(a);l!==void 0&&l.childIds.splice(0,l.childIds.length,...v(l.object))}const b=v(t),I=this.roots.filter(a=>{const l=this.objectsById.get(a);return l!==void 0&&!_(l,t)&&!u.has(a)});this.roots=[...b,...I],this.walkStats=F(this.nodesById);const m=f.length!==this.roots.length||f.some((a,l)=>a!==this.roots[l]);return{removedIds:u,addedIds:d,changedParentIds:i,rootsChanged:m}}get nodes(){return this.nodesById}get objects(){return this.objectsById}get idsByObject(){return this.idsByObjectIndex}get rootIds(){return this.roots}get stats(){return this.walkStats}node(t){return this.nodesById.get(t)??null}rootNodes(){return this.roots.map(t=>this.nodesById.get(t)).filter(t=>t!==void 0)}objectOf(t){return this.objectsById.get(t)??null}idOf(t){return this.idsByObjectIndex.get(t)??null}childIdsOf(t){const e=[];for(const r of t){const s=this.idsByObjectIndex.get(r);s!==void 0&&e.push(s)}return e}objectMapSnapshot(){return new Map(this.objectsById)}pick(t,e,r,s){return st(t,e,r,s,this.pickProjection())}candidates(t,e,r,s){return L(t,e,r,s,this.pickProjection())}pickProjection(){if(this.options.pickScope!=="store-object-map")return{objects:this.objectsById.values(),idForObject3D:t=>this.idOf(t)}}}export{wt as T,yt as a,gt as b,It as c,mt as d,q as e,ht as f,vt as n,Z as o,X as r,pt as s};
1
+ import{isInEditorOwnedSubtree as V,isEditorOwnedObject as P}from"./editor-layers-CjeYrUlm.js";import{g as k}from"./user-data-CifDDvSr.js";import{b as E,c as S}from"./component-instance-root-Cw_-ajBX.js";import{n as K,e as $,s as A}from"./entity-object-V13bGmay.js";import{s as W}from"./viewport-editor-controls-BYaAZ_Ku.js";import{fd as z,e6 as G,B as U}from"./three.core-3arARmh6.js";function q(n){const t=k(n,"constraints");return Array.isArray(t)?t.filter(e=>!!e&&typeof e=="object"&&typeof e.getSnapshot=="function"&&!!e.config):[]}const M="ingest:camera",J=1<<31;function Q(n){return(n.layers.mask&J)!==0}function Y(n,t){const e=new Map;let r=0,s=0,f=0;const u=(i,c)=>{const o=`ingest:${c}:${i.type}:${i.name||""}`;e.set(o,i),r++,i.isLight?f++:i.isMesh&&s++,d(i,c)},d=(i,c)=>{let o=0;for(const h of i.children)Q(h)||(u(h,c?`${c}/${o}`:`${o}`),o++)};return d(n,""),t&&(e.set(M,t),r++),{byId:e,count:r,meshes:s,lights:f}}function Z(n){const t=k(n,"authoringSubject");return t&&typeof t.label=="string"&&typeof t.kind=="string"?t:null}function X(n){const t=k(n,"reflectionProbe");if(!t||typeof t!="object")return null;const e=t;return e.config&&typeof e.recapture=="function"&&typeof e.getSnapshot=="function"?t:null}let D=null;function ht(n){D=n,W(n?.editorControls??null)}function tt(){return D}function C(n){return n.depthWrite===!1&&n.side===U}function et(n){const t=n.material;return t?Array.isArray(t)?t.length>0&&t.every(C):C(t):!1}function L(n,t,e,r=()=>!1,s){const f=tt();if(!f)return[];const u=f.canvas.getBoundingClientRect();if(u.width<=0||u.height<=0||!Number.isFinite(t)||!Number.isFinite(e)||t<u.left||e<u.top||t>=u.left+u.width||e>=u.top+u.height)return[];const d=new z((t-u.left)/u.width*2-1,-((e-u.top)/u.height)*2+1),i=new G;i.layers.enableAll(),i.setFromCamera(d,f.camera);const c=new Set(s?.objects??n.objectMap.values()),o=[...c].filter(b=>{for(let I=b.parent;I;I=I.parent)if(c.has(I))return!1;return!0});for(const b of o)b.traverse(I=>{const m=I;m.isSkinnedMesh&&(m.boundingBox=null,m.boundingSphere=null)});const h=i.intersectObjects(o,!0),p=[],v=new Set;for(const b of h){if(V(b.object)||et(b.object))continue;let I=b.object,m=null;if(s)for(;I&&m===null;)m=s.idForObject3D(I),I=I.parent;else{const a=K(I);m=a?$(a)??null:null}m!==null&&!r(m)&&!v.has(m)&&(v.add(m),p.push(m))}return nt(p,o,h.length,t,e),p}function nt(n,t,e,r,s){n.length>0||r===0&&s===0||console.info(`[viewport-pick] click selected nothing (candidates ${t.length}, rayHits ${e}, resolvedIds 0)`)}function st(n,t,e,r=()=>!1,s){return L(n,t,e,r,s)[0]??null}const R={count:0,meshes:0,lights:0,instancedMeshes:0,instances:0};let x=0;function H(n){let t=0,e=0;for(const r of n.values()){const s=r.object;s.isInstancedMesh&&(t++,e+=typeof s.count=="number"?s.count:0)}return{instancedMeshes:t,instances:e}}function F(n){let t=0,e=0;for(const r of n.values()){const s=r.object;s.isLight?e++:s.isMesh&&t++}return{count:n.size,meshes:t,lights:e,...H(n)}}function T(n,t){const e=new Map,r=[],s=t.skip??P;t.begin?.(n);const f=(u,d,i,c)=>{if(s(u))return;const o=t.identify(u,{path:d,ownerId:i,ownedByAncestor:c});o!==null&&(A(u,o),e.set(o,{object:u,id:o,parentId:i,childIds:[]}),i===null?r.push(o):e.get(i)?.childIds.push(o));const h=c||o!==null;u.children.forEach((p,v)=>{f(p,[...d,v],o??i,h)}),t.leave?.(u,o)};return n.children.forEach((u,d)=>{f(u,[d],null,!1)}),{nodes:e,rootIds:r,stats:F(e)}}const it="r3f:";function O(n,t){return`${it}${n}:${t}`}function rt(n){const t=new Map,e=new Map,r=(d,i)=>d===i||d.startsWith(`${i}#`)&&/^\d+$/u.test(d.slice(i.length+1)),s=d=>{e.clear();const i=c=>{if(P(c))return;const o=E(c),h=$(c);if(o!==void 0&&h!==void 0){const p=O(n,o);r(h,p)&&!e.has(h)&&e.set(h,c)}for(const p of c.children)i(p)};for(const c of d.children)i(c)},f=(d,i)=>{const c=$(d);if(c===void 0||i===void 0)return c;const o=O(n,i);return r(c,o)?e.get(c)===d?c:void 0:c},u=(d,i)=>{const c=O(n,i);let o=t.get(i)??0,h=S(c,o);for(;e.has(h);)o+=1,h=S(c,o);return t.set(i,o+1),e.set(h,d),h};return{begin:d=>{t.clear(),s(d)},identify:(d,i)=>{const c=E(d),o=f(d,c);if(o!==void 0)return o;const h=c===void 0?void 0:u(d,c);return h!==void 0||!i.ownedByAncestor||k(d,"authoringRoot")===!0?h??`live:${n}:${x++}`:null}}}function N(n,t){return T(n,rt(t))}function pt(n,t){const{nodes:e}=N(n,t),r=new Map;for(const[s,f]of e)r.set(s,f.object);return r}function yt(n,t={}){const e=t.camera;return{incremental:{kind:"live-oid",worldId:n},project:r=>{const s=N(r,n);return!e||[...s.nodes.values()].some(f=>f.object===e)?s:(A(e,M),s.nodes.set(M,{object:e,id:M,parentId:null,childIds:[]}),s.rootIds.push(M),{...s,stats:{...s.stats,count:s.nodes.size}})}}}function gt(n={}){const t=n.camera;return{project:e=>{const r=Y(e,t),s=new Map;for(const[d,i]of r.byId)s.set(i,d);const f=new Map,u=[];for(const[d,i]of r.byId){const c=i.parent,o=(c&&c!==e?s.get(c):void 0)??null,h=i.children.map(p=>s.get(p)).filter(p=>p!==void 0);f.set(d,{object:i,id:d,parentId:o,childIds:h}),o===null&&u.push(d)}return{nodes:f,rootIds:u,stats:{count:r.count,meshes:r.meshes,lights:r.lights,...H(f)}}}}}function It(n){let t=new Map,e=new Map;return{get instanceRoots(){return t},get representatives(){return e},project:r=>{const s=new Map,f=new Map,u=new Map,d=new Set,i=new Map,c=T(r,{identify:(o,h)=>{const p=E(o);if(p===void 0)return O(n,`@${h.path.join(".")}`);const v=s.get(p)??0;return s.set(p,v+1),v===0&&u.set(p,o),d.has(p)||(f.set(p,(f.get(p)??0)+1),d.add(p),i.set(o,p)),S(O(n,p),v)},leave:o=>{const h=i.get(o);h!==void 0&&(d.delete(h),i.delete(o))}});return t=f,e=u,c}}}function mt(n){return{project:t=>T(t,{skip:e=>!!k(e,"editorHelper")||e.isSkeletonHelper===!0,identify:(e,r)=>`source-object:${n}:${r.path.join(".")}`})}}function vt(n){const t=Z(n);return t?t.kind:q(n).length>0?"constraint-owner":X(n)?"reflection-probe":n.isSkinnedMesh?"skinned-mesh":n.isBone?"bone":n.isLight?"light":n.isCamera?"camera":n.type==="Audio"||n.type==="PositionalAudio"||n.type==="AudioListener"?"audio":n.isMesh?"mesh":n.children.length>0?"group":"object"}function ot(n,t){for(let e=n.parent;e!==null;e=e.parent)if(e===t)return!0;return!1}function _(n,t){if(n===t)return!0;for(let e=n.parent;e!==null;e=e.parent)if(e===t)return!0;return!1}class wt{constructor(t,e={}){this.identity=t,this.options=e}nodesById=new Map;objectsById=new Map;idsByObjectIndex=new Map;roots=[];walkStats=R;project(t){if(!t)return this.nodesById=new Map,this.objectsById=new Map,this.idsByObjectIndex=new Map,this.roots=[],this.walkStats=R,this.walkStats;const{nodes:e,rootIds:r,stats:s}=this.identity.project(t);return this.nodesById=e,this.objectsById=new Map([...e].map(([f,u])=>[f,u.object])),this.idsByObjectIndex=new Map([...e].map(([f,u])=>[u.object,f])),this.roots=r,this.walkStats=s,s}projectSubtrees(t,e){const r=this.identity.incremental;if(t===null||r?.kind!=="live-oid")return null;const s=e.filter((a,l)=>e.indexOf(a)===l&&!e.some(y=>y!==a&&ot(a,y))),f=this.roots,u=new Set,d=new Set,i=new Set;for(const a of s)a.traverse(l=>{const y=this.idsByObjectIndex.get(l);if(y===void 0)return;const g=this.nodesById.get(y);g?.parentId!==null&&g?.parentId!==void 0&&i.add(g.parentId),u.add(y),this.nodesById.delete(y),this.objectsById.delete(y),this.idsByObjectIndex.delete(l)});const c=P,o=(a,l)=>{const y=this.objectsById.get(a);return y===void 0||y===l},h=(a,l)=>{const y=$(a);if(y!==void 0&&o(y,a))return y;const g=E(a);if(g!==void 0){const w=O(r.worldId,g);let B=0,j=S(w,B);for(;!o(j,a);)j=S(w,++B);return j}if(!l||k(a,"authoringRoot")===!0){let w=`live:${r.worldId}:${x++}`;for(;!o(w,a);)w=`live:${r.worldId}:${x++}`;return w}return null},p=(a,l,y)=>{if(c(a))return;const g=h(a,y);g!==null&&(A(a,g),this.nodesById.set(g,{object:a,id:g,parentId:l,childIds:[]}),this.objectsById.set(g,a),this.idsByObjectIndex.set(a,g),d.add(g),l!==null&&i.add(l));const w=g??l,B=y||g!==null;for(const j of a.children)p(j,w,B)};for(const a of s){if(!_(a,t))continue;let l=a.parent,y=null;for(;l!==null&&l!==t;){const g=this.idsByObjectIndex.get(l);if(g!==void 0){y=g;break}l=l.parent}p(a,y,y!==null)}const v=a=>{const l=[],y=g=>{if(c(g))return;const w=this.idsByObjectIndex.get(g);if(w!==void 0){l.push(w);return}for(const B of g.children)y(B)};for(const g of a.children)y(g);return l};for(const a of i){const l=this.nodesById.get(a);l!==void 0&&l.childIds.splice(0,l.childIds.length,...v(l.object))}for(const a of d){const l=this.nodesById.get(a);l!==void 0&&l.childIds.splice(0,l.childIds.length,...v(l.object))}const b=v(t),I=this.roots.filter(a=>{const l=this.objectsById.get(a);return l!==void 0&&!_(l,t)&&!u.has(a)});this.roots=[...b,...I],this.walkStats=F(this.nodesById);const m=f.length!==this.roots.length||f.some((a,l)=>a!==this.roots[l]);return{removedIds:u,addedIds:d,changedParentIds:i,rootsChanged:m}}get nodes(){return this.nodesById}get objects(){return this.objectsById}get idsByObject(){return this.idsByObjectIndex}get rootIds(){return this.roots}get stats(){return this.walkStats}node(t){return this.nodesById.get(t)??null}rootNodes(){return this.roots.map(t=>this.nodesById.get(t)).filter(t=>t!==void 0)}objectOf(t){return this.objectsById.get(t)??null}idOf(t){return this.idsByObjectIndex.get(t)??null}childIdsOf(t){const e=[];for(const r of t){const s=this.idsByObjectIndex.get(r);s!==void 0&&e.push(s)}return e}objectMapSnapshot(){return new Map(this.objectsById)}pick(t,e,r,s){return st(t,e,r,s,this.pickProjection())}candidates(t,e,r,s){return L(t,e,r,s,this.pickProjection())}pickProjection(){if(this.options.pickScope!=="store-object-map")return{objects:this.objectsById.values(),idForObject3D:t=>this.idOf(t)}}}export{wt as T,yt as a,gt as b,It as c,mt as d,q as e,ht as f,vt as n,Z as o,X as r,pt as s};
@@ -1 +1 @@
1
- import{d6 as k,ec as _,O as v,as as A,aw as X,e7 as O,gz as W,gA as R,q as P,bm as U,gB as G,ah as N,bn as L,bk as Q,bl as Y,k as Z,bo as q}from"./index-CvGsVzTo.js";import{a as ee,o as te,b as C}from"./component-instance-root-MBgAuUpp.js";import{c as re,p as x,m as se,a as oe}from"./source-persistence-backend-Djuk0m-7.js";import{J as ie,c as ne}from"./json-history-resource-CckDydoO.js";import{r as f,d as ae,a as ce}from"./ingest-source-persistence-CPlDA2D8.js";import{r as le}from"./three-projection-core-BO23VKAP.js";import{a as D,T as he,n as ue,b as de}from"./three-bdxPiUPb.js";import{isEditorOwnedObject as T}from"./editor-layers-BK3fNRb7.js";import{bodyOwningNode as F}from"./body-marks-C1LxJtQb.js";import{colorMaterialOf as y}from"./structural-ids-BOo2BRoY.js";import{object3DAuthoringSubjectOf as H}from"./object3d-authoring-subject-XccsO0xG.js";import{createRapierBodyEditing as fe}from"./rapier-physics-adapter-CaZqWLu0.js";import{getUserData as m}from"./user-data-CODoGZqA.js";import{b as me,c as pe}from"./r3f-physics-binding-BcTFD1ZS.js";const be={position:{owner:"self",member:"position",kind:"vector3"},rotation:{owner:"self",member:"rotation",kind:"euler"},scale:{owner:"self",member:"scale",kind:"vector3"},visible:{owner:"self",member:"visible",kind:"boolean"},name:{owner:"self",member:"name",kind:"string"},"material.color":{owner:"material",member:"color",kind:"color"},"light.color":{owner:"self",member:"color",kind:"color"},"light.intensity":{owner:"self",member:"intensity",kind:"number"},"light.distance":{owner:"self",member:"distance",kind:"number"},"camera.fov":{owner:"self",member:"fov",kind:"number"},"camera.near":{owner:"self",member:"near",kind:"number"},"camera.far":{owner:"self",member:"far",kind:"number"},"shadow.cast":{owner:"self",member:"castShadow",kind:"boolean"},"shadow.receive":{owner:"self",member:"receiveShadow",kind:"boolean"}},ye={position:{owner:"self",member:"position",kind:"vector2",componentMembers:["x","y"]},rotation:{owner:"self",member:"rotation",kind:"number"},scale:{owner:"self",member:"scale",kind:"vector2"},visible:{owner:"self",member:"visible",kind:"boolean"},name:{owner:"self",member:"label",kind:"string"},alpha:{owner:"self",member:"alpha",kind:"number"},tint:{owner:"self",member:"tint",kind:"color"}},ge={position:{owner:"self",member:"position",kind:"vector3"},rotation:{owner:"self",member:"rotation",kind:"euler"},scale:{owner:"self",member:"scaling",kind:"vector3"},name:{owner:"self",member:"name",kind:"string"},visible:{owner:"self",member:"isVisible",kind:"boolean"},visibility:{owner:"self",member:"visibility",kind:"number"}};function J(l,t="three"){return(t==="pixi"?ye:t==="babylon"?ge:be)[l]??null}const K="the game's own JSX source (source-stamp write-back)",S={position:"position",rotation:"rotation",scale:"scale",visible:"visible",name:"name","material.color":"color","light.color":"color","light.intensity":"intensity","light.distance":"distance","camera.fov":"fov","camera.near":"near","camera.far":"far","shadow.cast":"castShadow","shadow.receive":"receiveShadow"};function M(l){const t=Math.round(l*1e4)/1e4;return Object.is(t,-0)?"0":String(t)}function V(l,t){const e=J(l)?.kind;return e==="vector3"||e==="euler"?!Array.isArray(t)||t.length!==3||!t.every(r=>typeof r=="number"&&Number.isFinite(r))?null:`[${t.map(M).join(", ")}]`:e==="number"?typeof t=="number"&&Number.isFinite(t)?M(t):null:e==="boolean"?typeof t=="boolean"?String(t):null:(e==="color"||e==="string")&&typeof t=="string"?t.replace(/["\\]/g,""):null}function z(l,t){const e=me(l??void 0,t);if(e)return e;const r=l?.r3fAuthoring;if(!r||t!=="position"&&t!=="rotation"&&t!=="scale")return null;const s=`<${l?.tag??"this component"}>`;return r.simulationOwnedTransform===!0?`${s} drives its own ${t} every frame — this instance is placed by the simulation, not by the editor`:r.transformProps.includes(t)?null:`${s} does not forward ${t} to its native root`}function I(l){const t=l.file.replaceAll("\\","/"),e=X()?.rootPath.replaceAll("\\","/").replace(/\/$/,""),r=e&&t.startsWith(`${e}/`)?t.slice(e.length+1):t;return{anchored:!0,kind:"source",file:r,line:l.line,col:l.col,display:`${r}:${l.line}`}}async function De(l){try{const e=await(l??k("Live source locations"))?.index?.();return r=>{const s=e?.[r];return s?I(s):null}}catch{return()=>null}}async function ve(l,t,e){const r=l.writeProp;if(!r)throw new Error("the gesture-scoped source writer cannot write JSX props");let s=0;for(const{property:o,text:i}of e){const a=await r(t,o,i,{addIfMissing:!0,allowShapeUpgrade:!0});if(a.dynamic)throw new Error(`${o} is bound to a JSX expression, not an authored literal`);if(!a.changed&&a.error)throw new Error(a.error);a.changed&&s++}return s}function we(l){const t=l.backend??k("The Play→source transform committer"),e=_(t,l.history),r=o=>o?!e?.runGesture||!e.writeProp||!e.index?{available:!1,reason:"This editor session cannot open a checksum-guarded project-source gesture."}:{available:!0}:{available:!1,reason:"This live node has no OID source stamp, so no authored literal owns its pose."},s=o=>(v.warn(`[play] Commit live transform to source refused: ${o}`,"play-mode"),{destination:A,persisted:!1});return{availability:r,async commit(o,i){const a=r(o);if(!a.available||!o||!e?.runGesture||!e.index)return s(a.reason??"the source writer is unavailable");const c=(await e.index())[o]??null;if(!c)return s(`the current source index has no entry for OID "${o}"`);const h=["position","rotation","scale"].map(d=>{const j=z(c,d);if(j)throw new Error(j);const w=i[d],$=w===void 0?null:V(d,w);if($===null)throw new Error(`${d} is not a finite transform literal`);return{property:d,text:$}});let u;try{u=await e.runGesture("Commit Play Transform to Source",d=>ve(d,o,h))}catch(d){return s(d instanceof Error?d.message:String(d))}return u===0?(v.log("[play] Source already matches the selected live transform.","play-mode"),{destination:"source already matched the live transform",persisted:!1}):(v.log(`[play] Committed ${u} live transform literal(s) to ${c.file}:${c.line}.`,"play-mode"),{destination:K,persisted:!0})}}}function Se(l){let t=null,e=new Map,r=!1;const s=async()=>{const n=t?.index;if(n)try{e=new Map(Object.entries(await n.call(t))),r=!0}catch{}},o=n=>n?e.get(n)??null:null,i=n=>{const c=o(n);return c?I(c).display:null},a=(n,c)=>{if(!n)return{ok:!1,reason:"this object carries no source stamp — the game built it at runtime rather than writing it as an element of its own source"};if(!t?.writeProp)return{ok:!1,reason:"this editor tier cannot write project source"};const h=S[c];if(!h)return{ok:!1,reason:`${c} has no JSX attribute this seam can write`};const u=z(o(n),h);if(u)return{ok:!1,reason:u};if(!O()){const d=i(n);return{ok:!1,reason:`${d?`written at ${d}`:"source-stamped"}, but this game is playing — hold it to author`}}return{ok:!0}};return{attach(){const n=l.backend??k("This world’s OID source persistence")??null;t=n?_(n,l.history)??n:null,s()},anchor(n){const c=e.get(n);return c?I(c):null},physicsPlaced(n,c){return pe(o(n)??void 0,S[c]??c)},describe({sourceOid:n,property:c}){const h=a(n,c);if(!h.ok)return`Live-only edit — ${h.reason}.`;const u=i(n);return u?`Persisting to ${u}.`:`Persisting to this element's own JSX${r?"":" (source index still loading)"}.`},gate({sourceOid:n,property:c}){return a(n,c)},armed:()=>t?.writeProp!==void 0&&O(),report:(n,c)=>f(n,c),async write(n){const c=a(n.sourceOid,n.property);if(!c.ok)return f(n.label,c.reason),!1;const h=S[n.property],u=V(n.property,n.next);if(u===null)return f(n.label,`the new ${n.property} is not a value this seam can spell as a JSX literal`),!1;try{const d=await t.writeProp(n.sourceOid,h,u,{addIfMissing:!0,allowShapeUpgrade:!0});return d.dynamic?(f(n.label,`${h} at ${i(n.sourceOid)??"this element"} is bound to a JSX expression, not a literal`),!1):d.changed?(v.log(`[ingest] ${n.label} written to the game's own source — ${h} → ${i(n.sourceOid)??n.sourceOid}`),s(),!0):(f(n.label,d.error??"the source writer made no change"),!1)}catch(d){return f(n.label,`the write failed: ${d instanceof Error?d.message:String(d)}`),!1}},removal:{available({sourceOid:n,property:c}){return t?.removeProp?a(n,c).ok:!1},async perform(n){const c=a(n.sourceOid,n.property);if(!c.ok||!t?.removeProp)return f(n.label,c.ok?"this editor tier cannot remove project source":c.reason),!1;const h=S[n.property];try{const u=await t.removeProp(n.sourceOid,h);return u.dynamic?(f(n.label,`${h} at ${i(n.sourceOid)??"this element"} is bound to a JSX expression — removing it would delete the game's own wiring, not an override`),!1):u.changed?(v.log(`[ingest] ${n.label} — ${h} dropped from the game's own source at ${i(n.sourceOid)??n.sourceOid}`),s(),!0):(f(n.label,u.error??`${i(n.sourceOid)??"this element"} authors no ${h} attribute, so there was nothing to drop`),!1)}catch(u){return f(n.label,`the removal failed: ${u instanceof Error?u.message:String(u)}`),!1}}},destination(){return t?.writeProp&&O()?K:A},dispose(){t=null,e=new Map,r=!1}}}const je={source:"live",label:"live",detail:"Running objects adopted from the live scene. Edits affect this session only and are discarded when play stops."},Oe="Applied to the running world; code that drives this transform each frame may overwrite it.",Ce={source:"foreign",label:"live-only",detail:"Unmodified ingested game — edits apply to the running game for this session only and are never saved."},Ie={source:"foreign",label:"game source",detail:"Ingested game whose own source carries the editor's authoring stamps — a literal JSX prop writes back to the game’s own file (expression-bound props stay read-only)."};function p(l){return l.isLight?l:null}function g(l){const t=l;return t.isPointLight||t.isSpotLight?t:null}function ke(l){const t=l;return t.isDirectionalLight||t.isPointLight||t.isSpotLight?t:null}function b(l){const t=l;return t.isPerspectiveCamera?t:null}function B(l){const t=l;return t.isMesh&&t.geometry?t.geometry:null}class E{constructor(t,e,r){if(this.store=t,this.options=r,this.sceneRef=e,this.identity=r.identity,this.projector=new he(this.identity,{pickScope:"projection"}),this.persist=r.persistence??null,this.loop=r.loop,this.frameControl=r.frameControl??"adapter",this.provenance=r.provenance??je,r.sourceCommit){const i={availability:a=>r.sourceCommit.availability(C(this.objectOf(a))),commit:async a=>{const n=this.objectOf(a),c=this.captureChannelBaseline(a)??{},h=await r.sourceCommit.commit(C(n),c);return h.persisted&&this.store.shell.notifyIngestEdit(),h}};Object.assign(this.transforms,{sourceCommit:i})}r.sourceDeclaresStories&&(this.stories=W("three",t.shell,i=>{const a=this.hierarchy.node(i);return a?.role!=="component"?null:{name:a.typeLabel??a.label}})),this.refresh(),this.watchStructure();const s=t.shell.projectHistory;this.historyResource=this.persist&&s?new ie({history:s,kind:"session-state",scope:"session",subject:{...r.journal,id:`${r.journal.id}/live-three-edits`},displayName:"Live edits",capture:()=>this.captureHistoryState(),conflictIdentity:i=>i.edits,restore:async i=>{this.restoreHistoryState(i)}}):null;const o=this.persist;o&&(o.attach({read:(i,a)=>this.readChannel(i,a),apply:(i,a,n)=>this.applyChannel(i,a,n)}),this.persistence={...ne(),get destination(){return o.destination()}},o.readSiteLiterals&&(this.instances=this.creationSiteInstances(o)))}sceneRef;projector;watchedForStructure=new Set;changedStructureRoots=new Set;structureRefreshQueued=!1;disposed=!1;crossSurfaceStructureRevision=0;hasCrossSurfaceStructure=!1;identity;persist;loop;frameControl;instanceLiterals=new Map;instanceLiteralRequests=new Map;markedBodies=fe(t=>{const e=this.objectOf(t);if(!e)return{kind:"unresolved"};const r=F(e);return r?{kind:"body",body:r}:{kind:"no-body"}});bodyOwnershipByObject=new WeakMap;physicsFor(t){const e=R();return e&&P(e,t)!=="unresolved"?e:null}edits={};historyResource;editStartState;editBaseline;capabilities={transform:!0,inspectorFields:!0,persist:!1};stories;instances;provenance;persistence;get scene(){return typeof this.sceneRef=="function"?this.sceneRef():this.sceneRef}refresh(){const t=this.projector.project(this.scene);return this.refreshCrossSurfacePresence(),this.crossSurfaceStructureRevision++,t}crossSurfaceStructureSignature(){return this.hasCrossSurfaceStructure?String(this.crossSurfaceStructureRevision):null}objectCarriesCrossSurfaceStructure(t){return m(t,"authoringHierarchyId")!==void 0||m(t,"authoringHierarchyParentId")!==void 0||m(t,"authoringHierarchyOrder")!==void 0}subtreeCarriesCrossSurfaceStructure(t){let e=!1;return t.traverse(r=>{this.objectCarriesCrossSurfaceStructure(r)&&(e=!0)}),e}refreshCrossSurfacePresence(){this.hasCrossSurfaceStructure=!1;for(const t of this.projector.nodes.values())if(this.objectCarriesCrossSurfaceStructure(t.object)){this.hasCrossSurfaceStructure=!0;return}}onStructureChanged=t=>{T(t.child)||this.disposed||(this.changedStructureRoots.add(t.child),!this.structureRefreshQueued&&(this.structureRefreshQueued=!0,queueMicrotask(()=>{if(this.structureRefreshQueued=!1,this.disposed)return;const e=[...this.changedStructureRoots];this.changedStructureRoots.clear();const r=e.some(o=>this.subtreeCarriesCrossSurfaceStructure(o));for(const o of e)this.unwatchStructureSubtree(o);const s=this.projector.projectSubtrees(this.scene,e);if(s===null)this.refresh(),this.watchStructure();else for(const o of e)this.structureRootIsAttached(o)&&this.watchStructureSubtree(o);r&&(this.refreshCrossSurfacePresence(),this.crossSurfaceStructureRevision++),this.syncAdoptedObjectMap(s??void 0),this.store.notifyIngestObjectMapEdit(s===null?void 0:{changedParentIds:s.changedParentIds,rootsChanged:s.rootsChanged,addedIds:s.addedIds,removedIds:s.removedIds})})))};watchStructure(){for(const e of this.watchedForStructure)e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure.clear();const t=this.scene;t&&this.watchStructureSubtree(t)}watchStructureSubtree(t){const e=r=>{if(!(T(r)||this.watchedForStructure.has(r))){r.addEventListener("childadded",this.onStructureChanged),r.addEventListener("childremoved",this.onStructureChanged),this.watchedForStructure.add(r);for(const s of r.children)e(s)}};e(t)}structureRootIsAttached(t){const e=this.scene;if(e===null)return!1;for(let r=t;r!==null;r=r.parent)if(r===e)return!0;return!1}unwatchStructureSubtree(t){t.traverse(e=>{this.watchedForStructure.delete(e)&&(e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged))})}syncAdoptedObjectMap(t){const e=this.scene;if(!e||this.store.scene!==e)return;const r=this.store.objectMap;if(t===void 0){r.clear();for(const[o,i]of this.projector.objectMapSnapshot())r.set(o,i)}else{for(const o of t.removedIds)r.delete(o);for(const o of t.addedIds){const i=this.projector.objectOf(o);i!==null&&r.set(o,i)}}const s=[...this.store.shell.selectedEntityIds].filter(o=>r.has(o));s.length!==this.store.shell.selectedEntityIds.size&&this.store.shell.selectMultiple(s)}invalidate(){this.refresh()}adoptScene(t){this.sceneRef=t,this.refresh(),this.watchStructure(),this.syncAdoptedObjectMap()}objectOf(t){return this.projector.objectOf(t)}objectMapSnapshot(){return this.projector.objectMapSnapshot()}record(t,e){this.edits[t]={...this.edits[t],...e}}toEditorNode(t){const e=t.object,r=m(e,"authoringHierarchyId"),s=m(e,"authoringHierarchyParentId"),o=m(e,"authoringHierarchyOrder"),i=ee(e)&&m(e,"authoringRoot")!==!0,a=m(e,"authoringComponent"),n=(i?m(e,"authoringLabel"):void 0)||e.name||e.type;return{id:t.id,label:n,role:i?"component":"entity",kind:ue(e),typeLabel:i?a||n:e.type,parentId:t.parentId,childIds:[...t.childIds],...r===void 0?{}:{crossSurfaceId:r},...s===void 0?{}:{crossSurfaceParentId:s},...o===void 0?{}:{crossSurfaceOrder:o}}}hierarchy={crossSurfaceStructureSignature:()=>this.crossSurfaceStructureSignature(),roots:()=>this.projector.rootNodes().map(t=>this.toEditorNode(t)),node:t=>{const e=this.projector.node(t);return e?this.toEditorNode(e):null},object3D:t=>this.objectOf(t),idForObject3D:t=>this.projector.idOf(t)};selection={get:()=>[...this.store.shell.selectedEntityIds],set:t=>this.store.shell.selectMultiple(t),resolve:(t,e)=>{const r=this.hierarchy.node(t);if(!r)return null;const s=[];let o=r,i=0;for(;o&&i++<1e3;)(o.role==="component"||o.role==="instance")&&s.push(o),o=o.parentId?this.hierarchy.node(o.parentId):null;const a=s.reverse();if(a.length===0)return{id:t};const n=e?.scopeId?a.findIndex(u=>u.id===e.scopeId):-1,c=n>=0?Math.min(n+1,a.length-1):0,h=e?.intent==="deep"?Math.min(c+1,a.length-1):c;return{id:a[h].id}}};pickable={pick:(t,e)=>(this.refresh(),this.projector.pick(this.store,t,e)),candidates:(t,e)=>(this.refresh(),this.projector.candidates(this.store,t,e))};truth={resolve:(t,e)=>{const r=this.anchorFor(t,e);return{site:r.anchor,writeAnchorKind:r.anchorKind}}};related=re(t=>this.truth.resolve(t,"position").site);transforms={get:t=>le(this.objectOf(t)),editability:(t,e)=>{if(!this.objectOf(t))return{writable:!1,reason:G};const r=N();return r?.networkId(t)&&!r.editable(t)?{writable:!1,reason:"This transform is controlled by remote or server network authority."}:this.bodyOwns(t)?{writable:!0,reason:"Moves the physics body that owns this node.",...this.removableFlag(t,e)}:this.frameControl==="host"&&this.store.shell.playState==="playing"?{writable:!0,reason:Oe,...this.removableFlag(t,e)}:this.persist?{writable:!0,reason:this.persist.describe(this.anchorFor(t,e)),...this.removableFlag(t,e)}:{writable:!0}},beginEdit:t=>{this.historyResource?.assertCanMutate(),!(!this.objectOf(t)||!this.editableByNetwork(t))&&(this.loop?.pause(),this.physicsFor(t)?.freeze(t),this.markedBodies.freeze(t),this.editStartState=this.persist?this.captureHistoryState():void 0,this.editBaseline=void 0)},apply:(t,e)=>{!this.objectOf(t)||!this.editableByNetwork(t)||(this.persist&&!this.editBaseline&&(this.editBaseline=this.captureChannelBaseline(t)),this.writeTransform(t,e),this.physicsFor(t)?.commit(t,e),this.markedBodies.commit(t,e),this.store.shell.notifyIngestEdit())},endEdit:t=>{this.loop?.resume();const e=this.objectOf(t),r=`Transform ${e?.name||"Object"}`,s=this.editStartState,o=this.editBaseline;return this.editStartState=void 0,this.editBaseline=void 0,e&&(this.physicsFor(t)?.unfreeze(t),this.markedBodies.unfreeze(t),this.store.shell.notifyIngestEdit()),this.persist?this.persistOrJournal(t,r,s,o):void 0},remove:(t,e)=>{if(this.persist?.removal)return U(this.pipedRemove(t,e))}};removableFlag(t,e){const r=this.persist?.removal;return r?r.available(this.anchorFor(t,e))?{removable:!0}:{}:{}}pipedRemove(t,e){const r=this.persist,s=r.removal,o=`Remove ${this.objectOf(t)?.name||"Object"} ${e}`;return{resolve:()=>{const i=this.anchorFor(t,e);return s.available(i)?i.anchorKind==="live-only"?L(r.describe(i)):{reaches:"writer",anchorKind:i.anchorKind,destination:r.destination(),write:()=>s.perform({...i,label:o})}:L(r.describe(i))},record:()=>{},report:i=>{r.armed()&&r.report(o,i)}}}bodyOwns(t){const e=this.objectOf(t);if(!e)return!1;const r=this.bodyOwnershipByObject.get(e);if(r!==void 0)return r;const s=R(),o=s?P(s,t):void 0;if(o==="physics")return this.bodyOwnershipByObject.set(e,!0),!0;const i=F(e)!==void 0;return(i||o==="editor")&&this.bodyOwnershipByObject.set(e,i),i}editableByNetwork(t){const e=N();return e?e.editable(t):!0}inspector={properties:t=>{const e=this.objectOf(t);if(!e)return[];const r=[{path:"name",label:"Name",type:"string"},{path:"visible",label:"Visible",type:"boolean"},{path:"object.type",label:"Native type",type:"string",readonly:!0}],s=H(e);return s?.fields&&r.push(...s.fields().filter(i=>!["name","visible"].includes(i.path)).map(({value:i,...a})=>a)),y(e)&&r.push({path:"material.color",label:"Color",type:"color",group:"Material"}),p(e)&&(r.push({path:"light.intensity",label:"Intensity",type:"number"}),r.push({path:"light.color",label:"Light Color",type:"color"}),g(e)&&r.push({path:"light.distance",label:"Distance",type:"number"}),ke(e)&&r.push({path:"shadow.cast",label:"Cast Shadow",type:"boolean"})),b(e)&&(r.push({path:"camera.fov",label:"FOV",type:"number"}),r.push({path:"camera.near",label:"Near",type:"number"}),r.push({path:"camera.far",label:"Far",type:"number"})),B(e)&&(r.push({path:"mesh.vertices",label:"Vertices",type:"number",readonly:!0}),r.push({path:"shadow.cast",label:"Cast Shadow",type:"boolean"}),r.push({path:"shadow.receive",label:"Receive Shadow",type:"boolean"})),r},get:(t,e)=>{const r=this.objectOf(t);if(!r)return;if(e==="name")return r.name;if(e==="visible")return r.visible;if(e==="object.type")return r.type;const s=H(r)?.fields?.().find(o=>o.path===e);if(s)return s.value();if(e==="material.color"){const o=y(r);return o?`#${o.color.getHexString()}`:void 0}if(e==="light.intensity")return p(r)?.intensity;if(e==="light.distance")return g(r)?.distance;if(e==="light.color"){const o=p(r);return o?`#${o.color.getHexString()}`:void 0}if(e==="camera.fov")return b(r)?.fov;if(e==="camera.near")return b(r)?.near;if(e==="camera.far")return b(r)?.far;if(e==="mesh.vertices"){const o=B(r);return o?o.getAttribute("position")?.count??0:void 0}if(e==="shadow.cast")return r.castShadow;if(e==="shadow.receive")return r.receiveShadow},set:(t,e,r)=>{if(this.historyResource?.assertCanMutate(),!this.persist){this.writeProp(t,e,r);return}const s=this.captureHistoryState(),o=this.readChannel(t,e);this.writeProp(t,e,r);const i=`Set ${this.objectOf(t)?.name||"Object"} ${e}`,a=this.readChannel(t,e);if(!(o!==void 0&&a!==void 0&&JSON.stringify(o)!==JSON.stringify(a))){this.recordHistory(i,s);return}return x({backend:this.persist,subject:()=>this.anchorFor(t,e),baseline:o,next:a,label:i,journal:()=>this.recordHistory(i,s)})}};subscribe(t){return this.store.shell.subscribe(t)}dispose(){this.disposed=!0;for(const t of this.watchedForStructure)t.removeEventListener("childadded",this.onStructureChanged),t.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure.clear(),this.changedStructureRoots.clear(),this.historyResource?.dispose(),this.persist?.dispose()}readChannel(t,e){const r=this.objectOf(t);if(r)return e==="position"?r.position.toArray():e==="rotation"?[r.rotation.x,r.rotation.y,r.rotation.z]:e==="scale"?r.scale.toArray():this.inspector.get(t,e)}applyChannel(t,e,r){const s=this.objectOf(t);if(s){if(e==="position"&&Array.isArray(r))s.position.fromArray(r);else if(e==="rotation"&&Array.isArray(r)){const[o,i,a]=r;s.rotation.set(o??0,i??0,a??0)}else if(e==="scale"&&Array.isArray(r))s.scale.fromArray(r);else{this.writeProp(t,e,r);return}this.store.shell.notifyIngestEdit()}}writeTransform(t,e){this.historyResource?.assertCanMutate();const r=this.objectOf(t);r&&(r.position.set(e.position[0],e.position[1],e.position[2]),r.quaternion.set(e.rotation[0],e.rotation[1],e.rotation[2],e.rotation[3]),r.scale.set(e.scale[0],e.scale[1],e.scale[2]),this.record(t,{position:e.position,rotation:e.rotation,scale:e.scale}))}writeProp(t,e,r){const s=this.objectOf(t);if(s){if(e==="name")s.name=String(r);else if(e==="visible")s.visible=!!r,this.record(t,{visible:s.visible});else if(e==="material.color"){const o=y(s);o&&(o.color.set(String(r)),this.record(t,{color:`#${o.color.getHexString()}`}))}else if(e==="light.intensity"){const o=p(s);o&&(o.intensity=Number(r))}else if(e==="light.distance"){const o=g(s);o&&(o.distance=Number(r))}else if(e==="light.color")p(s)?.color.set(String(r));else if(e==="camera.fov"||e==="camera.near"||e==="camera.far"){const o=b(s);o&&(o[e.split(".")[1]]=Number(r),o.updateProjectionMatrix())}else e==="shadow.cast"?s.castShadow=!!r:e==="shadow.receive"&&(s.receiveShadow=!!r);this.store.shell.notifyIngestEdit()}}anchorFor(t,e){const r=this.objectOf(t),s=J(e),o=r&&s?.owner==="material"?y(r):r,i=s?.owner==="material"?te(o):C(o),a=i?this.persist?.anchor?.(i):null;if(a){const h=i?this.persist?.physicsPlaced?.(i,e):!1;return{entityId:t,property:e,anchor:a,anchorKind:h?"physics-binding":"source-prop",instances:1,sourceOid:i}}const n=ae(o);if(n!==null)return{entityId:t,property:e,anchor:ce(n),anchorKind:"data-record",instances:1,...i?{sourceOid:i}:{}};const c=i?this.options.sourceAnchor?.(i)??{anchored:!1,reason:"The source index has not resolved this object’s OID."}:Q(o??null);return{entityId:t,property:e,anchor:c,anchorKind:i?this.persist?.anchor?"source-prop":"live-only":c.anchored?"construction-literal":"live-only",instances:c.anchored&&c.kind==="source"?i?1:Y(c):0,...i?{sourceOid:i}:{}}}measureWriteReach(){this.refresh();let t=0;const e=Z();for(const r of this.projector.nodes.keys()){const s=this.anchorFor(r,"position");e[s.anchorKind]++,s.anchor.anchored&&t++}return{addressable:t,total:this.projector.nodes.size,destination:this.persist?.destination()??A,byKind:e}}captureChannelBaseline(t){const e=this.objectOf(t);if(e)return{position:e.position.toArray(),rotation:[e.rotation.x,e.rotation.y,e.rotation.z],scale:e.scale.toArray()}}persistOrJournal(t,e,r,s){const o=this.persist;if(!o)return;const i=s?this.captureChannelBaseline(t):void 0,a=s&&i?Object.keys(s).filter(c=>JSON.stringify(s[c])!==JSON.stringify(i[c])):[];a.length>1&&o.report(e,se(a));const n=a.length===1?a[0]:null;if(n===null){this.recordHistory(e,r);return}return x({backend:o,subject:()=>this.anchorFor(t,n),baseline:s[n],next:i[n],label:e,journal:()=>this.recordHistory(e,r)})}creationSiteKey(t){const e=t.anchor;return e.anchored&&e.kind==="source"?`${e.file}:${e.line}:${e.col}`:null}instancePropertyPaths(t,e){const r=["position","rotation","scale",...this.inspector.properties(t).filter(s=>!s.readonly).map(s=>s.path)];return[...new Set(r)].filter(s=>this.creationSiteKey(this.anchorFor(t,s))===e)}loadInstanceLiterals(t,e,r,s){const o=this.instanceLiteralRequests.get(s);if(o)return o;const i=this.instancePropertyPaths(e,s).map(n=>({property:n,live:this.readChannel(e,n)})).filter(n=>n.live!==void 0),a=t.readSiteLiterals({anchor:r.anchor,instances:r.instances,writeScope:"creation-site",properties:i}).then(n=>(this.instanceLiterals.set(s,n),this.store.shell.notifyIngestEdit(),n));return this.instanceLiteralRequests.set(s,a),a}sameInstanceValue(t,e){return Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((r,s)=>this.sameInstanceValue(r,e[s])):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=1e-6:t===e}instanceComponentName(t){return t.constructor.name||t.type}instanceCountLabel(t){return`${t} ${t===1?"instance":"instances"}`}instanceOverride(t,e,r,s,o){const i=s[r],a=this.readChannel(e,r);if(!i||i.literal===null||a===void 0||this.sameInstanceValue(i.literal,a))return null;const n=t.gate({...this.anchorFor(e,r),writeScope:"creation-site"}),c=i.writable?n.ok?void 0:n.reason:i.reason,h=this.inspector.properties(e).find(u=>u.path===r)?.label??r;return{path:r,label:h,value:a,...i.text?{defaultText:i.text}:{},canApplyToComponent:c===void 0,...c?{applyUnavailableReason:c}:{},affectedInstanceCount:o.instances}}async applyInstanceDefault(t,e,r,s){const o={...this.anchorFor(r,s),writeScope:"creation-site"},i=this.creationSiteKey(o);if(!i)return{changed:!1,message:"This object has no source site."};const a=this.objectOf(r);if(!a)return{changed:!1,message:"This object is no longer in the live world."};const n=(await e(r,o,i))[s];if(!n)return{changed:!1,message:`The construction site names no ${s}.`};if(n.literal===null)return{changed:!1,message:`The construction site names no ${s} default.`};const c=this.readChannel(r,s);if(c===void 0)return{changed:!1,message:`${s} has no live value.`};if(!n.writable)return{changed:!1,message:n.reason??`${s} cannot be rewritten.`};const h=t.gate(o);if(!h.ok)return{changed:!1,message:h.reason};const u=o.instances,d=`Apply ${s} to ${this.instanceComponentName(a)} default (${this.instanceCountLabel(u)})`;if(!await t.write({...o,baseline:n.literal,next:c,label:d}))return{changed:!1,message:`${d} did not land; the console names why.`};this.instanceLiterals.delete(i),this.instanceLiteralRequests.delete(i),this.store.shell.notifyIngestEdit();const w=o.anchor.anchored?o.anchor.display:"this source site";return{changed:!0,message:`${s} now applies to all ${this.instanceCountLabel(u)} from ${w}.`,write:{destination:w,persisted:!0}}}creationSiteInstances(t){const e=async(r,s,o)=>this.instanceLiterals.get(o)??this.loadInstanceLiterals(t,r,s,o);return{describe:r=>{const s=this.anchorFor(r,"position"),o=this.creationSiteKey(s),i=this.objectOf(r);if(!o||!i)return null;const a=this.instanceLiterals.get(o);if(!a)return this.loadInstanceLiterals(t,r,s,o),null;if(Object.keys(a).length===0)return null;const n=this.instancePropertyPaths(r,o).map(c=>this.instanceOverride(t,r,c,a,s)).filter(c=>c!==null);return{componentName:this.instanceComponentName(i),...s.anchor.anchored?{sourcePath:s.anchor.display}:{},overrides:n}},revert:async(r,s)=>{const o=this.anchorFor(r,"position"),i=this.creationSiteKey(o);if(!i)return;const a=await e(r,o,i),n=this.captureHistoryState();let c=0;for(const h of s){const u=a[h]?.literal;u!=null&&(this.applyChannel(r,h,u),c++)}return c>0&&this.recordHistory(`Revert ${c} instance override(s)`,n),c>0?q:void 0},applyToComponent:(r,s)=>this.applyInstanceDefault(t,e,r,s)}}recordHistory(t,e){!this.historyResource||!e||this.historyResource.record(t,e,this.captureHistoryState()).catch(r=>{v.error(`[ingest] failed to journal "${t}" into project history — the edit is applied but has no history entry (it cannot be undone): ${r instanceof Error?r.message:String(r)}`)})}captureHistoryState(){const t={};for(const[e,r]of this.projector.nodes){const s=r.object,o=y(s),i=p(s),a=b(s);t[e]={name:s.name,visible:s.visible,transform:this.transforms.get(e),...o?{color:`#${o.color.getHexString()}`}:{},...i?{lightIntensity:i.intensity,lightColor:`#${i.color.getHexString()}`,...g(s)?{lightDistance:g(s).distance}:{}}:{},...a?{camera:{fov:a.fov,near:a.near,far:a.far}}:{},castShadow:s.castShadow,receiveShadow:s.receiveShadow}}return{edits:structuredClone(this.edits),objects:t}}restoreHistoryState(t){for(const[e,r]of Object.entries(t.objects)){const s=this.objectOf(e);if(!s)continue;s.name=r.name,s.visible=r.visible,s.position.fromArray(r.transform.position),s.quaternion.fromArray(r.transform.rotation),s.scale.fromArray(r.transform.scale),this.physicsFor(e)?.commit(e,r.transform),this.markedBodies.commit(e,r.transform),r.color&&y(s)?.color.set(r.color);const o=p(s);if(o&&(r.lightIntensity!==void 0&&(o.intensity=r.lightIntensity),r.lightColor&&o.color.set(r.lightColor),r.lightDistance!==void 0)){const a=g(s);a&&(a.distance=r.lightDistance)}const i=b(s);i&&r.camera&&(i.fov=r.camera.fov,i.near=r.camera.near,i.far=r.camera.far,i.updateProjectionMatrix()),s.castShadow=r.castShadow,s.receiveShadow=r.receiveShadow}this.edits=structuredClone(t.edits),this.store.shell.notifyIngestEdit()}}function Je(l,t,e){return new E(l,t,{identity:de({camera:e.camera}),journal:e.journal,persistence:oe({history:l.shell.projectHistory,writer:e.sourceWriter}),loop:e.loop,...e.frameControl?{frameControl:e.frameControl}:{},provenance:Ce})}function Ke(l,t,e){return new E(l,t,{identity:D(e.worldId,{camera:e.camera}),journal:e.journal,persistence:Se({history:l.shell.projectHistory,backend:e.backend}),loop:e.loop,...e.frameControl?{frameControl:e.frameControl}:{},provenance:Ie,sourceDeclaresStories:!0})}function Ve(l,t,e,r,s={}){return new E(l,t,{identity:D(e),journal:r,frameControl:"host",sourceAnchor:s.sourceAnchor,...s.explicitSourceCommit?{sourceCommit:we({history:l.shell.projectHistory,...s.backend?{backend:s.backend}:{}})}:{}})}export{Ke as a,Ve as o,De as r,Je as s};
1
+ import{dw as k,ec as _,Y as v,ax as A,aB as X,e7 as O,gz as U,gA as R,q as P,bT as W,gB as Y,am as N,bU as L,bR as G,bS as Q,k as Z,bV as q}from"./index-V4J7xfRg.js";import{a as ee,o as te,b as C}from"./component-instance-root-Cw_-ajBX.js";import{c as re,p as x,m as se,a as oe}from"./source-persistence-backend-uyd6NiWD.js";import{J as ie,c as ne}from"./json-history-resource-CH2nzMZh.js";import{r as f,d as ae,a as ce}from"./ingest-source-persistence-CQOJeGhj.js";import{r as le}from"./three-projection-core-PQm-CO61.js";import{a as D,T as he,n as ue,b as de}from"./three-BQfhEwUz.js";import{isEditorOwnedObject as T}from"./editor-layers-CjeYrUlm.js";import{bodyOwningNode as F}from"./body-marks-C1LxJtQb.js";import{colorMaterialOf as y}from"./structural-ids-BOo2BRoY.js";import{object3DAuthoringSubjectOf as H}from"./object3d-authoring-subject-XccsO0xG.js";import{createRapierBodyEditing as fe}from"./rapier-physics-adapter-CaZqWLu0.js";import{getUserData as m}from"./user-data-CODoGZqA.js";import{b as me,c as pe}from"./r3f-physics-binding-DZSIB0d_.js";const be={position:{owner:"self",member:"position",kind:"vector3"},rotation:{owner:"self",member:"rotation",kind:"euler"},scale:{owner:"self",member:"scale",kind:"vector3"},visible:{owner:"self",member:"visible",kind:"boolean"},name:{owner:"self",member:"name",kind:"string"},"material.color":{owner:"material",member:"color",kind:"color"},"light.color":{owner:"self",member:"color",kind:"color"},"light.intensity":{owner:"self",member:"intensity",kind:"number"},"light.distance":{owner:"self",member:"distance",kind:"number"},"camera.fov":{owner:"self",member:"fov",kind:"number"},"camera.near":{owner:"self",member:"near",kind:"number"},"camera.far":{owner:"self",member:"far",kind:"number"},"shadow.cast":{owner:"self",member:"castShadow",kind:"boolean"},"shadow.receive":{owner:"self",member:"receiveShadow",kind:"boolean"}},ye={position:{owner:"self",member:"position",kind:"vector2",componentMembers:["x","y"]},rotation:{owner:"self",member:"rotation",kind:"number"},scale:{owner:"self",member:"scale",kind:"vector2"},visible:{owner:"self",member:"visible",kind:"boolean"},name:{owner:"self",member:"label",kind:"string"},alpha:{owner:"self",member:"alpha",kind:"number"},tint:{owner:"self",member:"tint",kind:"color"}},ge={position:{owner:"self",member:"position",kind:"vector3"},rotation:{owner:"self",member:"rotation",kind:"euler"},scale:{owner:"self",member:"scaling",kind:"vector3"},name:{owner:"self",member:"name",kind:"string"},visible:{owner:"self",member:"isVisible",kind:"boolean"},visibility:{owner:"self",member:"visibility",kind:"number"}};function J(l,t="three"){return(t==="pixi"?ye:t==="babylon"?ge:be)[l]??null}const K="the game's own JSX source (source-stamp write-back)",S={position:"position",rotation:"rotation",scale:"scale",visible:"visible",name:"name","material.color":"color","light.color":"color","light.intensity":"intensity","light.distance":"distance","camera.fov":"fov","camera.near":"near","camera.far":"far","shadow.cast":"castShadow","shadow.receive":"receiveShadow"};function M(l){const t=Math.round(l*1e4)/1e4;return Object.is(t,-0)?"0":String(t)}function V(l,t){const e=J(l)?.kind;return e==="vector3"||e==="euler"?!Array.isArray(t)||t.length!==3||!t.every(r=>typeof r=="number"&&Number.isFinite(r))?null:`[${t.map(M).join(", ")}]`:e==="number"?typeof t=="number"&&Number.isFinite(t)?M(t):null:e==="boolean"?typeof t=="boolean"?String(t):null:(e==="color"||e==="string")&&typeof t=="string"?t.replace(/["\\]/g,""):null}function z(l,t){const e=me(l??void 0,t);if(e)return e;const r=l?.r3fAuthoring;if(!r||t!=="position"&&t!=="rotation"&&t!=="scale")return null;const s=`<${l?.tag??"this component"}>`;return r.simulationOwnedTransform===!0?`${s} drives its own ${t} every frame — this instance is placed by the simulation, not by the editor`:r.transformProps.includes(t)?null:`${s} does not forward ${t} to its native root`}function I(l){const t=l.file.replaceAll("\\","/"),e=X()?.rootPath.replaceAll("\\","/").replace(/\/$/,""),r=e&&t.startsWith(`${e}/`)?t.slice(e.length+1):t;return{anchored:!0,kind:"source",file:r,line:l.line,col:l.col,display:`${r}:${l.line}`}}async function De(l){try{const e=await(l??k("Live source locations"))?.index?.();return r=>{const s=e?.[r];return s?I(s):null}}catch{return()=>null}}async function ve(l,t,e){const r=l.writeProp;if(!r)throw new Error("the gesture-scoped source writer cannot write JSX props");let s=0;for(const{property:o,text:i}of e){const a=await r(t,o,i,{addIfMissing:!0,allowShapeUpgrade:!0});if(a.dynamic)throw new Error(`${o} is bound to a JSX expression, not an authored literal`);if(!a.changed&&a.error)throw new Error(a.error);a.changed&&s++}return s}function we(l){const t=l.backend??k("The Play→source transform committer"),e=_(t,l.history),r=o=>o?!e?.runGesture||!e.writeProp||!e.index?{available:!1,reason:"This editor session cannot open a checksum-guarded project-source gesture."}:{available:!0}:{available:!1,reason:"This live node has no OID source stamp, so no authored literal owns its pose."},s=o=>(v.warn(`[play] Commit live transform to source refused: ${o}`,"play-mode"),{destination:A,persisted:!1});return{availability:r,async commit(o,i){const a=r(o);if(!a.available||!o||!e?.runGesture||!e.index)return s(a.reason??"the source writer is unavailable");const c=(await e.index())[o]??null;if(!c)return s(`the current source index has no entry for OID "${o}"`);const h=["position","rotation","scale"].map(d=>{const j=z(c,d);if(j)throw new Error(j);const w=i[d],$=w===void 0?null:V(d,w);if($===null)throw new Error(`${d} is not a finite transform literal`);return{property:d,text:$}});let u;try{u=await e.runGesture("Commit Play Transform to Source",d=>ve(d,o,h))}catch(d){return s(d instanceof Error?d.message:String(d))}return u===0?(v.log("[play] Source already matches the selected live transform.","play-mode"),{destination:"source already matched the live transform",persisted:!1}):(v.log(`[play] Committed ${u} live transform literal(s) to ${c.file}:${c.line}.`,"play-mode"),{destination:K,persisted:!0})}}}function Se(l){let t=null,e=new Map,r=!1;const s=async()=>{const n=t?.index;if(n)try{e=new Map(Object.entries(await n.call(t))),r=!0}catch{}},o=n=>n?e.get(n)??null:null,i=n=>{const c=o(n);return c?I(c).display:null},a=(n,c)=>{if(!n)return{ok:!1,reason:"this object carries no source stamp — the game built it at runtime rather than writing it as an element of its own source"};if(!t?.writeProp)return{ok:!1,reason:"this editor tier cannot write project source"};const h=S[c];if(!h)return{ok:!1,reason:`${c} has no JSX attribute this seam can write`};const u=z(o(n),h);if(u)return{ok:!1,reason:u};if(!O()){const d=i(n);return{ok:!1,reason:`${d?`written at ${d}`:"source-stamped"}, but this game is playing — hold it to author`}}return{ok:!0}};return{attach(){const n=l.backend??k("This world’s OID source persistence")??null;t=n?_(n,l.history)??n:null,s()},anchor(n){const c=e.get(n);return c?I(c):null},physicsPlaced(n,c){return pe(o(n)??void 0,S[c]??c)},describe({sourceOid:n,property:c}){const h=a(n,c);if(!h.ok)return`Live-only edit — ${h.reason}.`;const u=i(n);return u?`Persisting to ${u}.`:`Persisting to this element's own JSX${r?"":" (source index still loading)"}.`},gate({sourceOid:n,property:c}){return a(n,c)},armed:()=>t?.writeProp!==void 0&&O(),report:(n,c)=>f(n,c),async write(n){const c=a(n.sourceOid,n.property);if(!c.ok)return f(n.label,c.reason),!1;const h=S[n.property],u=V(n.property,n.next);if(u===null)return f(n.label,`the new ${n.property} is not a value this seam can spell as a JSX literal`),!1;try{const d=await t.writeProp(n.sourceOid,h,u,{addIfMissing:!0,allowShapeUpgrade:!0});return d.dynamic?(f(n.label,`${h} at ${i(n.sourceOid)??"this element"} is bound to a JSX expression, not a literal`),!1):d.changed?(v.log(`[ingest] ${n.label} written to the game's own source — ${h} → ${i(n.sourceOid)??n.sourceOid}`),s(),!0):(f(n.label,d.error??"the source writer made no change"),!1)}catch(d){return f(n.label,`the write failed: ${d instanceof Error?d.message:String(d)}`),!1}},removal:{available({sourceOid:n,property:c}){return t?.removeProp?a(n,c).ok:!1},async perform(n){const c=a(n.sourceOid,n.property);if(!c.ok||!t?.removeProp)return f(n.label,c.ok?"this editor tier cannot remove project source":c.reason),!1;const h=S[n.property];try{const u=await t.removeProp(n.sourceOid,h);return u.dynamic?(f(n.label,`${h} at ${i(n.sourceOid)??"this element"} is bound to a JSX expression — removing it would delete the game's own wiring, not an override`),!1):u.changed?(v.log(`[ingest] ${n.label} — ${h} dropped from the game's own source at ${i(n.sourceOid)??n.sourceOid}`),s(),!0):(f(n.label,u.error??`${i(n.sourceOid)??"this element"} authors no ${h} attribute, so there was nothing to drop`),!1)}catch(u){return f(n.label,`the removal failed: ${u instanceof Error?u.message:String(u)}`),!1}}},destination(){return t?.writeProp&&O()?K:A},dispose(){t=null,e=new Map,r=!1}}}const je={source:"live",label:"live",detail:"Running objects adopted from the live scene. Edits affect this session only and are discarded when play stops."},Oe="Applied to the running world; code that drives this transform each frame may overwrite it.",Ce={source:"foreign",label:"live-only",detail:"Unmodified ingested game — edits apply to the running game for this session only and are never saved."},Ie={source:"foreign",label:"game source",detail:"Ingested game whose own source carries the editor's authoring stamps — a literal JSX prop writes back to the game’s own file (expression-bound props stay read-only)."};function p(l){return l.isLight?l:null}function g(l){const t=l;return t.isPointLight||t.isSpotLight?t:null}function ke(l){const t=l;return t.isDirectionalLight||t.isPointLight||t.isSpotLight?t:null}function b(l){const t=l;return t.isPerspectiveCamera?t:null}function B(l){const t=l;return t.isMesh&&t.geometry?t.geometry:null}class E{constructor(t,e,r){if(this.store=t,this.options=r,this.sceneRef=e,this.identity=r.identity,this.projector=new he(this.identity,{pickScope:"projection"}),this.persist=r.persistence??null,this.loop=r.loop,this.frameControl=r.frameControl??"adapter",this.provenance=r.provenance??je,r.sourceCommit){const i={availability:a=>r.sourceCommit.availability(C(this.objectOf(a))),commit:async a=>{const n=this.objectOf(a),c=this.captureChannelBaseline(a)??{},h=await r.sourceCommit.commit(C(n),c);return h.persisted&&this.store.shell.notifyIngestEdit(),h}};Object.assign(this.transforms,{sourceCommit:i})}r.sourceDeclaresStories&&(this.stories=U("three",t.shell,i=>{const a=this.hierarchy.node(i);return a?.role!=="component"?null:{name:a.typeLabel??a.label}})),this.refresh(),this.watchStructure();const s=t.shell.projectHistory;this.historyResource=this.persist&&s?new ie({history:s,kind:"session-state",scope:"session",subject:{...r.journal,id:`${r.journal.id}/live-three-edits`},displayName:"Live edits",capture:()=>this.captureHistoryState(),conflictIdentity:i=>i.edits,restore:async i=>{this.restoreHistoryState(i)}}):null;const o=this.persist;o&&(o.attach({read:(i,a)=>this.readChannel(i,a),apply:(i,a,n)=>this.applyChannel(i,a,n)}),this.persistence={...ne(),get destination(){return o.destination()}},o.readSiteLiterals&&(this.instances=this.creationSiteInstances(o)))}sceneRef;projector;watchedForStructure=new Set;changedStructureRoots=new Set;structureRefreshQueued=!1;disposed=!1;crossSurfaceStructureRevision=0;hasCrossSurfaceStructure=!1;identity;persist;loop;frameControl;instanceLiterals=new Map;instanceLiteralRequests=new Map;markedBodies=fe(t=>{const e=this.objectOf(t);if(!e)return{kind:"unresolved"};const r=F(e);return r?{kind:"body",body:r}:{kind:"no-body"}});bodyOwnershipByObject=new WeakMap;physicsFor(t){const e=R();return e&&P(e,t)!=="unresolved"?e:null}edits={};historyResource;editStartState;editBaseline;capabilities={transform:!0,inspectorFields:!0,persist:!1};stories;instances;provenance;persistence;get scene(){return typeof this.sceneRef=="function"?this.sceneRef():this.sceneRef}refresh(){const t=this.projector.project(this.scene);return this.refreshCrossSurfacePresence(),this.crossSurfaceStructureRevision++,t}crossSurfaceStructureSignature(){return this.hasCrossSurfaceStructure?String(this.crossSurfaceStructureRevision):null}objectCarriesCrossSurfaceStructure(t){return m(t,"authoringHierarchyId")!==void 0||m(t,"authoringHierarchyParentId")!==void 0||m(t,"authoringHierarchyOrder")!==void 0}subtreeCarriesCrossSurfaceStructure(t){let e=!1;return t.traverse(r=>{this.objectCarriesCrossSurfaceStructure(r)&&(e=!0)}),e}refreshCrossSurfacePresence(){this.hasCrossSurfaceStructure=!1;for(const t of this.projector.nodes.values())if(this.objectCarriesCrossSurfaceStructure(t.object)){this.hasCrossSurfaceStructure=!0;return}}onStructureChanged=t=>{T(t.child)||this.disposed||(this.changedStructureRoots.add(t.child),!this.structureRefreshQueued&&(this.structureRefreshQueued=!0,queueMicrotask(()=>{if(this.structureRefreshQueued=!1,this.disposed)return;const e=[...this.changedStructureRoots];this.changedStructureRoots.clear();const r=e.some(o=>this.subtreeCarriesCrossSurfaceStructure(o));for(const o of e)this.unwatchStructureSubtree(o);const s=this.projector.projectSubtrees(this.scene,e);if(s===null)this.refresh(),this.watchStructure();else for(const o of e)this.structureRootIsAttached(o)&&this.watchStructureSubtree(o);r&&(this.refreshCrossSurfacePresence(),this.crossSurfaceStructureRevision++),this.syncAdoptedObjectMap(s??void 0),this.store.notifyIngestObjectMapEdit(s===null?void 0:{changedParentIds:s.changedParentIds,rootsChanged:s.rootsChanged,addedIds:s.addedIds,removedIds:s.removedIds})})))};watchStructure(){for(const e of this.watchedForStructure)e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure.clear();const t=this.scene;t&&this.watchStructureSubtree(t)}watchStructureSubtree(t){const e=r=>{if(!(T(r)||this.watchedForStructure.has(r))){r.addEventListener("childadded",this.onStructureChanged),r.addEventListener("childremoved",this.onStructureChanged),this.watchedForStructure.add(r);for(const s of r.children)e(s)}};e(t)}structureRootIsAttached(t){const e=this.scene;if(e===null)return!1;for(let r=t;r!==null;r=r.parent)if(r===e)return!0;return!1}unwatchStructureSubtree(t){t.traverse(e=>{this.watchedForStructure.delete(e)&&(e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged))})}syncAdoptedObjectMap(t){const e=this.scene;if(!e||this.store.scene!==e)return;const r=this.store.objectMap;if(t===void 0){r.clear();for(const[o,i]of this.projector.objectMapSnapshot())r.set(o,i)}else{for(const o of t.removedIds)r.delete(o);for(const o of t.addedIds){const i=this.projector.objectOf(o);i!==null&&r.set(o,i)}}const s=[...this.store.shell.selectedEntityIds].filter(o=>r.has(o));s.length!==this.store.shell.selectedEntityIds.size&&this.store.shell.selectMultiple(s)}invalidate(){this.refresh()}adoptScene(t){this.sceneRef=t,this.refresh(),this.watchStructure(),this.syncAdoptedObjectMap()}objectOf(t){return this.projector.objectOf(t)}objectMapSnapshot(){return this.projector.objectMapSnapshot()}record(t,e){this.edits[t]={...this.edits[t],...e}}toEditorNode(t){const e=t.object,r=m(e,"authoringHierarchyId"),s=m(e,"authoringHierarchyParentId"),o=m(e,"authoringHierarchyOrder"),i=ee(e)&&m(e,"authoringRoot")!==!0,a=m(e,"authoringComponent"),n=(i?m(e,"authoringLabel"):void 0)||e.name||e.type;return{id:t.id,label:n,role:i?"component":"entity",kind:ue(e),typeLabel:i?a||n:e.type,parentId:t.parentId,childIds:[...t.childIds],...r===void 0?{}:{crossSurfaceId:r},...s===void 0?{}:{crossSurfaceParentId:s},...o===void 0?{}:{crossSurfaceOrder:o}}}hierarchy={crossSurfaceStructureSignature:()=>this.crossSurfaceStructureSignature(),roots:()=>this.projector.rootNodes().map(t=>this.toEditorNode(t)),node:t=>{const e=this.projector.node(t);return e?this.toEditorNode(e):null},object3D:t=>this.objectOf(t),idForObject3D:t=>this.projector.idOf(t)};selection={get:()=>[...this.store.shell.selectedEntityIds],set:t=>this.store.shell.selectMultiple(t),resolve:(t,e)=>{const r=this.hierarchy.node(t);if(!r)return null;const s=[];let o=r,i=0;for(;o&&i++<1e3;)(o.role==="component"||o.role==="instance")&&s.push(o),o=o.parentId?this.hierarchy.node(o.parentId):null;const a=s.reverse();if(a.length===0)return{id:t};const n=e?.scopeId?a.findIndex(u=>u.id===e.scopeId):-1,c=n>=0?Math.min(n+1,a.length-1):0,h=e?.intent==="deep"?Math.min(c+1,a.length-1):c;return{id:a[h].id}}};pickable={pick:(t,e)=>(this.refresh(),this.projector.pick(this.store,t,e)),candidates:(t,e)=>(this.refresh(),this.projector.candidates(this.store,t,e))};truth={resolve:(t,e)=>{const r=this.anchorFor(t,e);return{site:r.anchor,writeAnchorKind:r.anchorKind}}};related=re(t=>this.truth.resolve(t,"position").site);transforms={get:t=>le(this.objectOf(t)),editability:(t,e)=>{if(!this.objectOf(t))return{writable:!1,reason:Y};const r=N();return r?.networkId(t)&&!r.editable(t)?{writable:!1,reason:"This transform is controlled by remote or server network authority."}:this.bodyOwns(t)?{writable:!0,reason:"Moves the physics body that owns this node.",...this.removableFlag(t,e)}:this.frameControl==="host"&&this.store.shell.playState==="playing"?{writable:!0,reason:Oe,...this.removableFlag(t,e)}:this.persist?{writable:!0,reason:this.persist.describe(this.anchorFor(t,e)),...this.removableFlag(t,e)}:{writable:!0}},beginEdit:t=>{this.historyResource?.assertCanMutate(),!(!this.objectOf(t)||!this.editableByNetwork(t))&&(this.loop?.pause(),this.physicsFor(t)?.freeze(t),this.markedBodies.freeze(t),this.editStartState=this.persist?this.captureHistoryState():void 0,this.editBaseline=void 0)},apply:(t,e)=>{!this.objectOf(t)||!this.editableByNetwork(t)||(this.persist&&!this.editBaseline&&(this.editBaseline=this.captureChannelBaseline(t)),this.writeTransform(t,e),this.physicsFor(t)?.commit(t,e),this.markedBodies.commit(t,e),this.store.shell.notifyIngestEdit())},endEdit:t=>{this.loop?.resume();const e=this.objectOf(t),r=`Transform ${e?.name||"Object"}`,s=this.editStartState,o=this.editBaseline;return this.editStartState=void 0,this.editBaseline=void 0,e&&(this.physicsFor(t)?.unfreeze(t),this.markedBodies.unfreeze(t),this.store.shell.notifyIngestEdit()),this.persist?this.persistOrJournal(t,r,s,o):void 0},remove:(t,e)=>{if(this.persist?.removal)return W(this.pipedRemove(t,e))}};removableFlag(t,e){const r=this.persist?.removal;return r?r.available(this.anchorFor(t,e))?{removable:!0}:{}:{}}pipedRemove(t,e){const r=this.persist,s=r.removal,o=`Remove ${this.objectOf(t)?.name||"Object"} ${e}`;return{resolve:()=>{const i=this.anchorFor(t,e);return s.available(i)?i.anchorKind==="live-only"?L(r.describe(i)):{reaches:"writer",anchorKind:i.anchorKind,destination:r.destination(),write:()=>s.perform({...i,label:o})}:L(r.describe(i))},record:()=>{},report:i=>{r.armed()&&r.report(o,i)}}}bodyOwns(t){const e=this.objectOf(t);if(!e)return!1;const r=this.bodyOwnershipByObject.get(e);if(r!==void 0)return r;const s=R(),o=s?P(s,t):void 0;if(o==="physics")return this.bodyOwnershipByObject.set(e,!0),!0;const i=F(e)!==void 0;return(i||o==="editor")&&this.bodyOwnershipByObject.set(e,i),i}editableByNetwork(t){const e=N();return e?e.editable(t):!0}inspector={properties:t=>{const e=this.objectOf(t);if(!e)return[];const r=[{path:"name",label:"Name",type:"string"},{path:"visible",label:"Visible",type:"boolean"},{path:"object.type",label:"Native type",type:"string",readonly:!0}],s=H(e);return s?.fields&&r.push(...s.fields().filter(i=>!["name","visible"].includes(i.path)).map(({value:i,...a})=>a)),y(e)&&r.push({path:"material.color",label:"Color",type:"color",group:"Material"}),p(e)&&(r.push({path:"light.intensity",label:"Intensity",type:"number"}),r.push({path:"light.color",label:"Light Color",type:"color"}),g(e)&&r.push({path:"light.distance",label:"Distance",type:"number"}),ke(e)&&r.push({path:"shadow.cast",label:"Cast Shadow",type:"boolean"})),b(e)&&(r.push({path:"camera.fov",label:"FOV",type:"number"}),r.push({path:"camera.near",label:"Near",type:"number"}),r.push({path:"camera.far",label:"Far",type:"number"})),B(e)&&(r.push({path:"mesh.vertices",label:"Vertices",type:"number",readonly:!0}),r.push({path:"shadow.cast",label:"Cast Shadow",type:"boolean"}),r.push({path:"shadow.receive",label:"Receive Shadow",type:"boolean"})),r},get:(t,e)=>{const r=this.objectOf(t);if(!r)return;if(e==="name")return r.name;if(e==="visible")return r.visible;if(e==="object.type")return r.type;const s=H(r)?.fields?.().find(o=>o.path===e);if(s)return s.value();if(e==="material.color"){const o=y(r);return o?`#${o.color.getHexString()}`:void 0}if(e==="light.intensity")return p(r)?.intensity;if(e==="light.distance")return g(r)?.distance;if(e==="light.color"){const o=p(r);return o?`#${o.color.getHexString()}`:void 0}if(e==="camera.fov")return b(r)?.fov;if(e==="camera.near")return b(r)?.near;if(e==="camera.far")return b(r)?.far;if(e==="mesh.vertices"){const o=B(r);return o?o.getAttribute("position")?.count??0:void 0}if(e==="shadow.cast")return r.castShadow;if(e==="shadow.receive")return r.receiveShadow},set:(t,e,r)=>{if(this.historyResource?.assertCanMutate(),!this.persist){this.writeProp(t,e,r);return}const s=this.captureHistoryState(),o=this.readChannel(t,e);this.writeProp(t,e,r);const i=`Set ${this.objectOf(t)?.name||"Object"} ${e}`,a=this.readChannel(t,e);if(!(o!==void 0&&a!==void 0&&JSON.stringify(o)!==JSON.stringify(a))){this.recordHistory(i,s);return}return x({backend:this.persist,subject:()=>this.anchorFor(t,e),baseline:o,next:a,label:i,journal:()=>this.recordHistory(i,s)})}};subscribe(t){return this.store.shell.subscribe(t)}dispose(){this.disposed=!0;for(const t of this.watchedForStructure)t.removeEventListener("childadded",this.onStructureChanged),t.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure.clear(),this.changedStructureRoots.clear(),this.historyResource?.dispose(),this.persist?.dispose()}readChannel(t,e){const r=this.objectOf(t);if(r)return e==="position"?r.position.toArray():e==="rotation"?[r.rotation.x,r.rotation.y,r.rotation.z]:e==="scale"?r.scale.toArray():this.inspector.get(t,e)}applyChannel(t,e,r){const s=this.objectOf(t);if(s){if(e==="position"&&Array.isArray(r))s.position.fromArray(r);else if(e==="rotation"&&Array.isArray(r)){const[o,i,a]=r;s.rotation.set(o??0,i??0,a??0)}else if(e==="scale"&&Array.isArray(r))s.scale.fromArray(r);else{this.writeProp(t,e,r);return}this.store.shell.notifyIngestEdit()}}writeTransform(t,e){this.historyResource?.assertCanMutate();const r=this.objectOf(t);r&&(r.position.set(e.position[0],e.position[1],e.position[2]),r.quaternion.set(e.rotation[0],e.rotation[1],e.rotation[2],e.rotation[3]),r.scale.set(e.scale[0],e.scale[1],e.scale[2]),this.record(t,{position:e.position,rotation:e.rotation,scale:e.scale}))}writeProp(t,e,r){const s=this.objectOf(t);if(s){if(e==="name")s.name=String(r);else if(e==="visible")s.visible=!!r,this.record(t,{visible:s.visible});else if(e==="material.color"){const o=y(s);o&&(o.color.set(String(r)),this.record(t,{color:`#${o.color.getHexString()}`}))}else if(e==="light.intensity"){const o=p(s);o&&(o.intensity=Number(r))}else if(e==="light.distance"){const o=g(s);o&&(o.distance=Number(r))}else if(e==="light.color")p(s)?.color.set(String(r));else if(e==="camera.fov"||e==="camera.near"||e==="camera.far"){const o=b(s);o&&(o[e.split(".")[1]]=Number(r),o.updateProjectionMatrix())}else e==="shadow.cast"?s.castShadow=!!r:e==="shadow.receive"&&(s.receiveShadow=!!r);this.store.shell.notifyIngestEdit()}}anchorFor(t,e){const r=this.objectOf(t),s=J(e),o=r&&s?.owner==="material"?y(r):r,i=s?.owner==="material"?te(o):C(o),a=i?this.persist?.anchor?.(i):null;if(a){const h=i?this.persist?.physicsPlaced?.(i,e):!1;return{entityId:t,property:e,anchor:a,anchorKind:h?"physics-binding":"source-prop",instances:1,sourceOid:i}}const n=ae(o);if(n!==null)return{entityId:t,property:e,anchor:ce(n),anchorKind:"data-record",instances:1,...i?{sourceOid:i}:{}};const c=i?this.options.sourceAnchor?.(i)??{anchored:!1,reason:"The source index has not resolved this object’s OID."}:G(o??null);return{entityId:t,property:e,anchor:c,anchorKind:i?this.persist?.anchor?"source-prop":"live-only":c.anchored?"construction-literal":"live-only",instances:c.anchored&&c.kind==="source"?i?1:Q(c):0,...i?{sourceOid:i}:{}}}measureWriteReach(){this.refresh();let t=0;const e=Z();for(const r of this.projector.nodes.keys()){const s=this.anchorFor(r,"position");e[s.anchorKind]++,s.anchor.anchored&&t++}return{addressable:t,total:this.projector.nodes.size,destination:this.persist?.destination()??A,byKind:e}}captureChannelBaseline(t){const e=this.objectOf(t);if(e)return{position:e.position.toArray(),rotation:[e.rotation.x,e.rotation.y,e.rotation.z],scale:e.scale.toArray()}}persistOrJournal(t,e,r,s){const o=this.persist;if(!o)return;const i=s?this.captureChannelBaseline(t):void 0,a=s&&i?Object.keys(s).filter(c=>JSON.stringify(s[c])!==JSON.stringify(i[c])):[];a.length>1&&o.report(e,se(a));const n=a.length===1?a[0]:null;if(n===null){this.recordHistory(e,r);return}return x({backend:o,subject:()=>this.anchorFor(t,n),baseline:s[n],next:i[n],label:e,journal:()=>this.recordHistory(e,r)})}creationSiteKey(t){const e=t.anchor;return e.anchored&&e.kind==="source"?`${e.file}:${e.line}:${e.col}`:null}instancePropertyPaths(t,e){const r=["position","rotation","scale",...this.inspector.properties(t).filter(s=>!s.readonly).map(s=>s.path)];return[...new Set(r)].filter(s=>this.creationSiteKey(this.anchorFor(t,s))===e)}loadInstanceLiterals(t,e,r,s){const o=this.instanceLiteralRequests.get(s);if(o)return o;const i=this.instancePropertyPaths(e,s).map(n=>({property:n,live:this.readChannel(e,n)})).filter(n=>n.live!==void 0),a=t.readSiteLiterals({anchor:r.anchor,instances:r.instances,writeScope:"creation-site",properties:i}).then(n=>(this.instanceLiterals.set(s,n),this.store.shell.notifyIngestEdit(),n));return this.instanceLiteralRequests.set(s,a),a}sameInstanceValue(t,e){return Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((r,s)=>this.sameInstanceValue(r,e[s])):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=1e-6:t===e}instanceComponentName(t){return t.constructor.name||t.type}instanceCountLabel(t){return`${t} ${t===1?"instance":"instances"}`}instanceOverride(t,e,r,s,o){const i=s[r],a=this.readChannel(e,r);if(!i||i.literal===null||a===void 0||this.sameInstanceValue(i.literal,a))return null;const n=t.gate({...this.anchorFor(e,r),writeScope:"creation-site"}),c=i.writable?n.ok?void 0:n.reason:i.reason,h=this.inspector.properties(e).find(u=>u.path===r)?.label??r;return{path:r,label:h,value:a,...i.text?{defaultText:i.text}:{},canApplyToComponent:c===void 0,...c?{applyUnavailableReason:c}:{},affectedInstanceCount:o.instances}}async applyInstanceDefault(t,e,r,s){const o={...this.anchorFor(r,s),writeScope:"creation-site"},i=this.creationSiteKey(o);if(!i)return{changed:!1,message:"This object has no source site."};const a=this.objectOf(r);if(!a)return{changed:!1,message:"This object is no longer in the live world."};const n=(await e(r,o,i))[s];if(!n)return{changed:!1,message:`The construction site names no ${s}.`};if(n.literal===null)return{changed:!1,message:`The construction site names no ${s} default.`};const c=this.readChannel(r,s);if(c===void 0)return{changed:!1,message:`${s} has no live value.`};if(!n.writable)return{changed:!1,message:n.reason??`${s} cannot be rewritten.`};const h=t.gate(o);if(!h.ok)return{changed:!1,message:h.reason};const u=o.instances,d=`Apply ${s} to ${this.instanceComponentName(a)} default (${this.instanceCountLabel(u)})`;if(!await t.write({...o,baseline:n.literal,next:c,label:d}))return{changed:!1,message:`${d} did not land; the console names why.`};this.instanceLiterals.delete(i),this.instanceLiteralRequests.delete(i),this.store.shell.notifyIngestEdit();const w=o.anchor.anchored?o.anchor.display:"this source site";return{changed:!0,message:`${s} now applies to all ${this.instanceCountLabel(u)} from ${w}.`,write:{destination:w,persisted:!0}}}creationSiteInstances(t){const e=async(r,s,o)=>this.instanceLiterals.get(o)??this.loadInstanceLiterals(t,r,s,o);return{describe:r=>{const s=this.anchorFor(r,"position"),o=this.creationSiteKey(s),i=this.objectOf(r);if(!o||!i)return null;const a=this.instanceLiterals.get(o);if(!a)return this.loadInstanceLiterals(t,r,s,o),null;if(Object.keys(a).length===0)return null;const n=this.instancePropertyPaths(r,o).map(c=>this.instanceOverride(t,r,c,a,s)).filter(c=>c!==null);return{componentName:this.instanceComponentName(i),...s.anchor.anchored?{sourcePath:s.anchor.display}:{},overrides:n}},revert:async(r,s)=>{const o=this.anchorFor(r,"position"),i=this.creationSiteKey(o);if(!i)return;const a=await e(r,o,i),n=this.captureHistoryState();let c=0;for(const h of s){const u=a[h]?.literal;u!=null&&(this.applyChannel(r,h,u),c++)}return c>0&&this.recordHistory(`Revert ${c} instance override(s)`,n),c>0?q:void 0},applyToComponent:(r,s)=>this.applyInstanceDefault(t,e,r,s)}}recordHistory(t,e){!this.historyResource||!e||this.historyResource.record(t,e,this.captureHistoryState()).catch(r=>{v.error(`[ingest] failed to journal "${t}" into project history — the edit is applied but has no history entry (it cannot be undone): ${r instanceof Error?r.message:String(r)}`)})}captureHistoryState(){const t={};for(const[e,r]of this.projector.nodes){const s=r.object,o=y(s),i=p(s),a=b(s);t[e]={name:s.name,visible:s.visible,transform:this.transforms.get(e),...o?{color:`#${o.color.getHexString()}`}:{},...i?{lightIntensity:i.intensity,lightColor:`#${i.color.getHexString()}`,...g(s)?{lightDistance:g(s).distance}:{}}:{},...a?{camera:{fov:a.fov,near:a.near,far:a.far}}:{},castShadow:s.castShadow,receiveShadow:s.receiveShadow}}return{edits:structuredClone(this.edits),objects:t}}restoreHistoryState(t){for(const[e,r]of Object.entries(t.objects)){const s=this.objectOf(e);if(!s)continue;s.name=r.name,s.visible=r.visible,s.position.fromArray(r.transform.position),s.quaternion.fromArray(r.transform.rotation),s.scale.fromArray(r.transform.scale),this.physicsFor(e)?.commit(e,r.transform),this.markedBodies.commit(e,r.transform),r.color&&y(s)?.color.set(r.color);const o=p(s);if(o&&(r.lightIntensity!==void 0&&(o.intensity=r.lightIntensity),r.lightColor&&o.color.set(r.lightColor),r.lightDistance!==void 0)){const a=g(s);a&&(a.distance=r.lightDistance)}const i=b(s);i&&r.camera&&(i.fov=r.camera.fov,i.near=r.camera.near,i.far=r.camera.far,i.updateProjectionMatrix()),s.castShadow=r.castShadow,s.receiveShadow=r.receiveShadow}this.edits=structuredClone(t.edits),this.store.shell.notifyIngestEdit()}}function Je(l,t,e){return new E(l,t,{identity:de({camera:e.camera}),journal:e.journal,persistence:oe({history:l.shell.projectHistory,writer:e.sourceWriter}),loop:e.loop,...e.frameControl?{frameControl:e.frameControl}:{},provenance:Ce})}function Ke(l,t,e){return new E(l,t,{identity:D(e.worldId,{camera:e.camera}),journal:e.journal,persistence:Se({history:l.shell.projectHistory,backend:e.backend}),loop:e.loop,...e.frameControl?{frameControl:e.frameControl}:{},provenance:Ie,sourceDeclaresStories:!0})}function Ve(l,t,e,r,s={}){return new E(l,t,{identity:D(e),journal:r,frameControl:"host",sourceAnchor:s.sourceAnchor,...s.explicitSourceCommit?{sourceCommit:we({history:l.shell.projectHistory,...s.backend?{backend:s.backend}:{}})}:{}})}export{Ke as a,Ve as o,De as r,Je as s};