@volter/game-editor 0.5.145 → 0.5.146

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 (295) 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 +2135 -2135
  5. package/dist/assets/{AssetBudgetPanel-8flhcwbD.js → AssetBudgetPanel-Cj7h9s3X.js} +3 -3
  6. package/dist/assets/{AudioViewer-BYZn4DUK.js → AudioViewer-C2NMmN1c.js} +1 -1
  7. package/dist/assets/{CanvasBoardDocument-CoNJL2CI.js → CanvasBoardDocument-Dd3wtq7p.js} +1 -1
  8. package/dist/assets/{CanvasSceneViewport-Dq3V66EU.js → CanvasSceneViewport-0FaWuBze.js} +1 -1
  9. package/dist/assets/{ColorInput-CZ9YSe5b.js → ColorInput-4LOMybLs.js} +1 -1
  10. package/dist/assets/{ColorPicker-DytPZaFB.js → ColorPicker-spH4IeyW.js} +1 -1
  11. package/dist/assets/{EntityModelDocument-BkXCSQxA.js → EntityModelDocument-CTnlWOAG.js} +1 -1
  12. package/dist/assets/{EnvironmentAssetDocument-DFZWx1WX.js → EnvironmentAssetDocument-DYjIexUh.js} +1 -1
  13. package/dist/assets/{GameplaySessionTimeline-B8wWEj5v.js → GameplaySessionTimeline-Dcx9Tust.js} +1 -1
  14. package/dist/assets/{ImageViewer-CIM_I8nH.js → ImageViewer-CQv4oEKB.js} +1 -1
  15. package/dist/assets/InspectorObjectPreview-BnEt3UNq.js +1 -0
  16. package/dist/assets/{JsonAssetDocument-gQuwiLdR.js → JsonAssetDocument-Dt86RAz-.js} +1 -1
  17. package/dist/assets/{LiveModuleDocument-DHCRcqhT.js → LiveModuleDocument-CBox9dZG.js} +1 -1
  18. package/dist/assets/{LutAssetDocument-B4RQTQCB.js → LutAssetDocument-CdYwavhv.js} +1 -1
  19. package/dist/assets/{ModelAssetDocument-DJnaaIHX.js → ModelAssetDocument-DIPUGMBf.js} +1 -1
  20. package/dist/assets/{NonThreeAuthoringBootstrap-CF7BPoB9.js → NonThreeAuthoringBootstrap-Cp7zJ6PO.js} +1 -1
  21. package/dist/assets/{Object3DDocumentToolbar-DsN2NUQv.js → Object3DDocumentToolbar-CRTrPiAi.js} +1 -1
  22. package/dist/assets/Object3DDocumentViewport-CMesyIkM.js +2 -0
  23. package/dist/assets/{Object3DPreview-BwZhzzAg.js → Object3DPreview-Fa0nVIWt.js} +1 -1
  24. package/dist/assets/{OnlineAssetDetail-DB3yzRTz.js → OnlineAssetDetail-DeY_kRhJ.js} +1 -1
  25. package/dist/assets/{PlayBar-CfImNQE-.js → PlayBar-D1twbgPU.js} +1 -1
  26. package/dist/assets/{QuarksAssetDocument-DJGQB4u7.js → QuarksAssetDocument-BwwK54MP.js} +1 -1
  27. package/dist/assets/{ReactCanvasControls-BkR9VVE8.js → ReactCanvasControls-BQ8gXxs4.js} +1 -1
  28. package/dist/assets/{RootSelectionOverlay-CSfOoibk.js → RootSelectionOverlay-6PrR0msJ.js} +1 -1
  29. package/dist/assets/{ShaderAssetDocument-CoiFAJWh.js → ShaderAssetDocument-C9_LgCgY.js} +1 -1
  30. package/dist/assets/{ShadowEditor-DgBjRx-V.js → ShadowEditor-CN7DmrkP.js} +1 -1
  31. package/dist/assets/{SourceAssetViewer-O0HH8IOS.js → SourceAssetViewer-CK7ciFBW.js} +1 -1
  32. package/dist/assets/StageHost-D56PzKrs.js +2 -0
  33. package/dist/assets/{StoryPreviewMount-Bdx5zbNZ.js → StoryPreviewMount-DJ04sEMk.js} +1 -1
  34. package/dist/assets/{ThreeBoardDocument-CXv7KFP1.js → ThreeBoardDocument-CH2oiNAp.js} +2 -2
  35. package/dist/assets/{ThreeIsolationSceneContent-D5WV80fA.js → ThreeIsolationSceneContent-D2DCIpv0.js} +1 -1
  36. package/dist/assets/{ToolObject3DPreview-BGrgHTE9.js → ToolObject3DPreview-DJWD_bUg.js} +1 -1
  37. package/dist/assets/{Toolbar-SOKVz9Is.js → Toolbar-CFrBc1nF.js} +1 -1
  38. package/dist/assets/{TransientHint-C-aFB2Ox.js → TransientHint-luDOQE4y.js} +1 -1
  39. package/dist/assets/{VideoViewer-B4I4Cbpl.js → VideoViewer-Ck3TJc3E.js} +1 -1
  40. package/dist/assets/{ViewportShadingMenu-DBsoDPhe.js → ViewportShadingMenu-BSbiK2XW.js} +1 -1
  41. package/dist/assets/{active-ingest-DOoYv5lC.js → active-ingest-DeIM9C5L.js} +2 -2
  42. package/dist/assets/{animation-clock-TPDD3KgB.js → animation-clock-D1kC4Z86.js} +1 -1
  43. package/dist/assets/{animation-mixers.service-fTlm79AY.js → animation-mixers.service-D_QEbPpn.js} +1 -1
  44. package/dist/assets/{animation-timeline.utility-CagyUWvy.js → animation-timeline.utility-BmvxYBF1.js} +1 -1
  45. package/dist/assets/{asset-budget-asset.menu-QnQQKyUV.js → asset-budget-asset.menu-BqmJBnJp.js} +1 -1
  46. package/dist/assets/{asset-budget.action-Denu9n8R.js → asset-budget.action-mfsCOaBe.js} +1 -1
  47. package/dist/assets/{asset-budget.document-DAQQudBF.js → asset-budget.document-DlTvmR9U.js} +1 -1
  48. package/dist/assets/{asset-budget.menu-Dhqm1ACI.js → asset-budget.menu-CfFFqH0a.js} +1 -1
  49. package/dist/assets/{asset-editor-persistence-BPJ80IV2.js → asset-editor-persistence-CYZFLtpb.js} +1 -1
  50. package/dist/assets/{asset-loaders-Dcnf7Bw6.js → asset-loaders-D-7Pz-E0.js} +1 -1
  51. package/dist/assets/{asset-preview-BmprxTYE.js → asset-preview-DwWy2SHE.js} +1 -1
  52. package/dist/assets/{audio-unlock.service-CDSrqMlA.js → audio-unlock.service-BzOgoK0f.js} +1 -1
  53. package/dist/assets/{audio.utility-Bk4p5xsL.js → audio.utility-Bq8w2r0V.js} +1 -1
  54. package/dist/assets/autoplay.service-_kVqba2M.js +1 -0
  55. package/dist/assets/{babylon-authoring-adapter-_KBkPwd9.js → babylon-authoring-adapter-ldSrOv7d.js} +1 -1
  56. package/dist/assets/{binding-resolver-ClWFzZwl.js → binding-resolver-CLAC4Oou.js} +2 -2
  57. package/dist/assets/{blender-node-editor.document-BJs-svOJ.js → blender-node-editor.document-Co514xJk.js} +1 -1
  58. package/dist/assets/{blender-properties-tab-Ca6GGoZA.js → blender-properties-tab-D0pPyu6C.js} +1 -1
  59. package/dist/assets/{blender-runtime-host-BDbcC0Zg.js → blender-runtime-host-BfAWl8jZ.js} +1 -1
  60. package/dist/assets/{blender-runtime-skin-C-J3OdY_.js → blender-runtime-skin-ClXU_pYv.js} +2 -2
  61. package/dist/assets/{blender-runtime.document-0fBzbVqg.js → blender-runtime.document-CzE-1h4j.js} +1 -1
  62. package/dist/assets/{blender-screenshot.menu-D3yZwxi6.js → blender-screenshot.menu-wvAjkf8o.js} +1 -1
  63. package/dist/assets/{blender-timeline.document-BOpLOn76.js → blender-timeline.document-D9b7dNPM.js} +1 -1
  64. package/dist/assets/{blender-uv-editor.document-CNlwlNsR.js → blender-uv-editor.document-BwwjBDOS.js} +1 -1
  65. package/dist/assets/{blender-version.status-BrfCcN3A.js → blender-version.status-ddgmM7fx.js} +1 -1
  66. package/dist/assets/{blender.command-B-4gubQH.js → blender.command-DwHKBUyF.js} +1 -1
  67. package/dist/assets/{board-guides-CAd3Uwwe.js → board-guides-2MWr9kZQ.js} +1 -1
  68. package/dist/assets/{bridge.command-B_ZMM1Af.js → bridge.command-snxNsDHL.js} +3 -3
  69. package/dist/assets/{browserAll-DJib4cRK.js → browserAll-DiFaRv4x.js} +1 -1
  70. package/dist/assets/{build-player.document-Dkk9-Cxq.js → build-player.document-BCYLGI6X.js} +1 -1
  71. package/dist/assets/{build-profiles.document-E4xigdal.js → build-profiles.document-BfALhOLS.js} +1 -1
  72. package/dist/assets/{build-progress.status-BmBmwXjj.js → build-progress.status-H9FVq1Nw.js} +1 -1
  73. package/dist/assets/{build-session-DhHsQRks.js → build-session-C8UTaRpP.js} +1 -1
  74. package/dist/assets/{build.action-CUifgV58.js → build.action-BZoNXYGP.js} +1 -1
  75. package/dist/assets/{build.command-BErZJdyz.js → build.command-Cq8b2ZJ6.js} +1 -1
  76. package/dist/assets/{build.header-Bx2ejMEG.js → build.header-Wgw5RsWT.js} +1 -1
  77. package/dist/assets/{build.menu-Dpl69Asc.js → build.menu-BfMIBsGC.js} +1 -1
  78. package/dist/assets/{build.service-BHf0-RtC.js → build.service-DiJ-3Vue.js} +1 -1
  79. package/dist/assets/{camera-D2f8WceK.js → camera-C04aN_OQ.js} +1 -1
  80. package/dist/assets/{camera-runtime.inspector-Bed8jPeG.js → camera-runtime.inspector-CnWrVWbT.js} +1 -1
  81. package/dist/assets/{canvas-design-mount-s-hs4sM5.js → canvas-design-mount-BEO3N1GH.js} +3 -3
  82. package/dist/assets/{canvas-entry-runtime-DtH7NAl5.js → canvas-entry-runtime-BKXjFEpC.js} +2 -2
  83. package/dist/assets/{canvas-preview-frames-BgBKQGAL.js → canvas-preview-frames-DlUOebf1.js} +1 -1
  84. package/dist/assets/{canvas-story-capture.service-Cqk4C8AX.js → canvas-story-capture.service-BD7jC9fG.js} +2 -2
  85. package/dist/assets/{capability-coverage-CRqjvzDo.js → capability-coverage-CKk539ZB.js} +1 -1
  86. package/dist/assets/{collaboration-presence-D-oYewcY.js → collaboration-presence-B72eeYMj.js} +1 -1
  87. package/dist/assets/{collider-phxm70qk.js → collider-C5zjn_5X.js} +1 -1
  88. package/dist/assets/{component-board.service-CLXsAGWX.js → component-board.service-DIjdm965.js} +2 -2
  89. package/dist/assets/{component-board.service-CE8B8nHy.js → component-board.service-e02WXSTY.js} +2 -2
  90. package/dist/assets/{component-board.service-D68yuC-G.js → component-board.service-efFkmqkQ.js} +2 -2
  91. package/dist/assets/{component-contracts.service-J0ThBCQb.js → component-contracts.service-BDAnLXr_.js} +1 -1
  92. package/dist/assets/{component-instance-root-CTNzehmC.js → component-instance-root-Bx-2lbRr.js} +1 -1
  93. package/dist/assets/{component-verbs.command-D9Y2aSPT.js → component-verbs.command-ZqVpT6_N.js} +1 -1
  94. package/dist/assets/{component-verbs.service-NmQpK7Cp.js → component-verbs.service-M_8-wbha.js} +1 -1
  95. package/dist/assets/{config-DtFNLMre.js → config-C-2s_BAP.js} +2 -2
  96. package/dist/assets/{configurations-DizIsCtw.js → configurations-DJKKldTl.js} +1 -1
  97. package/dist/assets/{connection.status-_545jhmC.js → connection.status-chAq26qI.js} +1 -1
  98. package/dist/assets/{constraints.inspector-Zg0371sI.js → constraints.inspector-ICwNPfFn.js} +1 -1
  99. package/dist/assets/{content-bounds-JcLbQeNM.js → content-bounds-_3L42iZv.js} +1 -1
  100. package/dist/assets/{contract-system-adapters-CborQejG.js → contract-system-adapters-CXVtEEG9.js} +1 -1
  101. package/dist/assets/{coverage.service-ZvzXk_RH.js → coverage.service-C8DwCiDf.js} +1 -1
  102. package/dist/assets/{create-runtime-BRhUNQFy.js → create-runtime-D5mvBwj7.js} +1 -1
  103. package/dist/assets/{curve-ViOyXS6d.js → curve-DJ-hYz0v.js} +1 -1
  104. package/dist/assets/{data-asset-C4dKbRfK.js → data-asset-Beu0kPMY.js} +1 -1
  105. package/dist/assets/{data-ref-B0raIwHa.js → data-ref-2NLWnVad.js} +1 -1
  106. package/dist/assets/{debug-bridge-DPTNskFv.js → debug-bridge-D8_tPne3.js} +1 -1
  107. package/dist/assets/{debug-registry-Dc3W6vwO.js → debug-registry-BUn-3w5j.js} +1 -1
  108. package/dist/assets/{deferred-ingest-play-CIebXfgB.js → deferred-ingest-play-CVy431tz.js} +2 -2
  109. package/dist/assets/{design-time-canvas-mount-BGOBVa9p.js → design-time-canvas-mount-CazAJNIm.js} +2 -2
  110. package/dist/assets/{design-time-layers-BPYiK7VF.js → design-time-layers-BdvwPtJ0.js} +1 -1
  111. package/dist/assets/{design-time-mount.service-qJ2qfNGK.js → design-time-mount.service-C20XC1lH.js} +2 -2
  112. package/dist/assets/{design-time-mount.service-CBc4Am_-.js → design-time-mount.service-CwW4PFPB.js} +2 -2
  113. package/dist/assets/{design-time-react-mount-CV5Hd5Jd.js → design-time-react-mount-j6ADy2Og.js} +1 -1
  114. package/dist/assets/{document-preview-three-C_6mBiiE.js → document-preview-three-BKlE3rQf.js} +1 -1
  115. package/dist/assets/{dom-authoring-adapter-CJzZxsuq.js → dom-authoring-adapter-DQLbnGyg.js} +1 -1
  116. package/dist/assets/{draco3d-CjtPWm52.js → draco3d-BJljm3nJ.js} +1 -1
  117. package/dist/assets/{edit-mode-audio.service-B-CjR9wW.js → edit-mode-audio.service-CsUeTv5u.js} +1 -1
  118. package/dist/assets/{edit-mode-authoring-CCBUV6q2.js → edit-mode-authoring-D54ihZgV.js} +1 -1
  119. package/dist/assets/{edit-mode-networking.service-Mx_poWhf.js → edit-mode-networking.service-C5uySvAm.js} +1 -1
  120. package/dist/assets/{editor-api-DNxuq7oq.js → editor-api-B_Q5T6QF.js} +1 -1
  121. package/dist/assets/{editor-layers-DdJOFmu5.js → editor-layers-Dsfzcx0b.js} +1 -1
  122. package/dist/assets/{editor-shell-store-BXKwqCuM.js → editor-shell-store-CMpd1UwI.js} +1 -1
  123. package/dist/assets/{entity-object-dwaTJjul.js → entity-object-BdDiGzfv.js} +1 -1
  124. package/dist/assets/{extend-D_CXDVWD.js → extend-CMh2M1Wu.js} +1 -1
  125. package/dist/assets/{fork-menu-DklvmtJS.js → fork-menu-36Axbn1w.js} +1 -1
  126. package/dist/assets/{frame-debugger-store-D2CIrmXD.js → frame-debugger-store-BcFRdkh5.js} +1 -1
  127. package/dist/assets/{game-contract-seams-C1m_P4SS.js → game-contract-seams-CkWXZKBr.js} +1 -1
  128. package/dist/assets/{game-css-scope-transform-BA7ZbLSi.js → game-css-scope-transform-BJCqOoR0.js} +1 -1
  129. package/dist/assets/{game-document.service-Cce4QU61.js → game-document.service-INZGkGbn.js} +1 -1
  130. package/dist/assets/{game-eval.command-BkWv-UfA.js → game-eval.command-DoTlb41L.js} +1 -1
  131. package/dist/assets/{game-module-access-XGEiv_PE.js → game-module-access-CnBDyF7n.js} +1 -1
  132. package/dist/assets/{game-network-D8ug1x3w.js → game-network-BtjFTt2o.js} +3 -3
  133. package/dist/assets/{gameplay-export-DoN38r9u.js → gameplay-export-DAFpXOU0.js} +1 -1
  134. package/dist/assets/{gameplay-replay-DtHDmjp5.js → gameplay-replay-BzXNC4jl.js} +1 -1
  135. package/dist/assets/{gameplay.command-DYnPT8Lo.js → gameplay.command-CFj50YCT.js} +1 -1
  136. package/dist/assets/{generation-jobs-BXHZFlzo.js → generation-jobs-DVPIfZGN.js} +1 -1
  137. package/dist/assets/{generation.service-CGSWxPf1.js → generation.service-B7jbiHj4.js} +1 -1
  138. package/dist/assets/{generations-DSXF1fKZ.js → generations-BdzYspx9.js} +1 -1
  139. package/dist/assets/{generations.status-Cf_3wvkx.js → generations.status-rF39D0fJ.js} +1 -1
  140. package/dist/assets/{hierarchy-marks-D-538fQp.js → hierarchy-marks-CmVlgczH.js} +1 -1
  141. package/dist/assets/{hosted-asset-materialization-DyuYIe1c.js → hosted-asset-materialization-BE-__aF1.js} +1 -1
  142. package/dist/assets/{index-Bako454B.js → index-77Pib7-L.js} +1 -1
  143. package/dist/assets/{index-B_PxgVrX.js → index-BdHcaUix.js} +1 -1
  144. package/dist/assets/{index-CCKpGWll.js → index-C3Cly1nm.js} +2 -2
  145. package/dist/assets/{index-CqiPDGfq.js → index-C5sjRs6U.js} +1 -1
  146. package/dist/assets/{index-9uCSEhwf.js → index-DQvF8ql8.js} +1 -1
  147. package/dist/assets/{index-BzRGSlHd.js → index-DSGmxuuA.js} +1 -1
  148. package/dist/assets/{index-Crsbhlhy.js → index-DaRQxpdW.js} +7 -7
  149. package/dist/assets/{index-B6n4-N99.js → index-DqZQbzOn.js} +1 -1
  150. package/dist/assets/{index-8RtOnhOo.js → index-DtXV3icG.js} +1 -1
  151. package/dist/assets/{inference-diagnostics-JiGwiJUe.js → inference-diagnostics-CFKZbcUX.js} +1 -1
  152. package/dist/assets/{ingest-boot-viewport-BqIgHJiK.js → ingest-boot-viewport-0RCIjGyr.js} +1 -1
  153. package/dist/assets/{ingest-siblings-C3KBC2OL.js → ingest-siblings-ipe3TEXW.js} +1 -1
  154. package/dist/assets/{ingest-source-persistence-Bk9qLkTV.js → ingest-source-persistence-BhLgFaNT.js} +1 -1
  155. package/dist/assets/{ingest.service-DdIqzdni.js → ingest.service-CTFUSkfm.js} +1 -1
  156. package/dist/assets/{inspect-DPJ1m-DR.js → inspect-BNHDIOcX.js} +1 -1
  157. package/dist/assets/instances.command-DoTOUMeC.js +1 -0
  158. package/dist/assets/{json-history-resource-BdE8EcB4.js → json-history-resource-BvTJaESk.js} +1 -1
  159. package/dist/assets/{layered-pick-CsPry26y.js → layered-pick-CeUEqXrE.js} +1 -1
  160. package/dist/assets/{light-P3HQqMJN.js → light-DWb5ql01.js} +1 -1
  161. package/dist/assets/{live-project-verbs-l0iIsIQL.js → live-project-verbs-BeIsYWK0.js} +1 -1
  162. package/dist/assets/{machine.document-Dz14QA8c.js → machine.document-R_hPyA6L.js} +1 -1
  163. package/dist/assets/{machines.finder-d1uSMp3z.js → machines.finder-SpgoWz9Z.js} +1 -1
  164. package/dist/assets/{material-D7yEfFFf.js → material-CBrVqKwQ.js} +1 -1
  165. package/dist/assets/{material-factory-DzsVJzgQ.js → material-factory-CsbWsZNA.js} +1 -1
  166. package/dist/assets/{mesh-f9oWqYCD.js → mesh-DJV7OYWi.js} +1 -1
  167. package/dist/assets/{model-asset-sections.service-Yh4yCNss.js → model-asset-sections.service-kr2Z47JF.js} +1 -1
  168. package/dist/assets/{model-inspection-C5OZWNER.js → model-inspection-CkDdmvUX.js} +1 -1
  169. package/dist/assets/{model-thumbnail-DFht0Zea.js → model-thumbnail-Dvqh6Alw.js} +1 -1
  170. package/dist/assets/{models.finder-zG-WERDy.js → models.finder-Cf1GuDeE.js} +1 -1
  171. package/dist/assets/{module-mode-CIRC4PLv.js → module-mode-oCNL6WcJ.js} +2 -2
  172. package/dist/assets/{mount-canvas-ingest-root-WOBvBU2u.js → mount-canvas-ingest-root-McTMBqUU.js} +2 -2
  173. package/dist/assets/{mount-dom-ingest-root-eYOFvDv6.js → mount-dom-ingest-root-LcPfHoVu.js} +2 -2
  174. package/dist/assets/{mount-ingest-root-BtlYDYMM.js → mount-ingest-root-N_xkoEr8.js} +2 -2
  175. package/dist/assets/{mount-manifest-BLFE1lZT.js → mount-manifest-CZcTVc7p.js} +1 -1
  176. package/dist/assets/{mount-three-ingest-root-Bp78LaZS.js → mount-three-ingest-root-yVgOHHUx.js} +1 -1
  177. package/dist/assets/{mounted-authoring-C7-8VFjR.js → mounted-authoring-BM-DX0X3.js} +1 -1
  178. package/dist/assets/{mounted-story-viewport-source-DYFGQweE.js → mounted-story-viewport-source-DzDp_0y7.js} +1 -1
  179. package/dist/assets/{native-debug-module-DZBcJZ3O.js → native-debug-module-DtxmnSHX.js} +1 -1
  180. package/dist/assets/{navigation-CLNvQtYC.js → navigation-BcFZXsQl.js} +1 -1
  181. package/dist/assets/{navmesh.menu-VhuMK-B9.js → navmesh.menu-C4JcsDqb.js} +1 -1
  182. package/dist/assets/{navmesh.service-9skC9KbW.js → navmesh.service-Cy1wNHHb.js} +1 -1
  183. package/dist/assets/network-observer.service-QBgwzA0p.js +1 -0
  184. package/dist/assets/{network.utility-Cx6YQWiW.js → network.utility-B3n9FPtM.js} +1 -1
  185. package/dist/assets/{object3d-document-session-registry-DYtU0S61.js → object3d-document-session-registry-C19aZYMr.js} +2 -2
  186. package/dist/assets/{oid-transform--LwgkNr9.js → oid-transform-IdvEHtlc.js} +1 -1
  187. package/dist/assets/{particles-DCL9brKJ.js → particles-DY5H6WOd.js} +1 -1
  188. package/dist/assets/{pixi-authoring-adapter-CJsDP9TC.js → pixi-authoring-adapter-Cx778K0H.js} +1 -1
  189. package/dist/assets/{pixi-live-write-target-BkbfLPLj.js → pixi-live-write-target-B9MBUwKH.js} +1 -1
  190. package/dist/assets/{play.command-D7U5ws3m.js → play.command-dSyfa0Mp.js} +2 -2
  191. package/dist/assets/{presentation-BlPdw2Jq.js → presentation-CwNm9mlh.js} +1 -1
  192. package/dist/assets/{product-BjUMoNzc.js → product-Bbc0LLza.js} +1 -1
  193. package/dist/assets/{profiler.action-BeMlKn0D.js → profiler.action-Cyyf6VWF.js} +1 -1
  194. package/dist/assets/{profiler.menu-ByNYDsb_.js → profiler.menu-ClEKTyWO.js} +1 -1
  195. package/dist/assets/{profiler.utility-QR-GTEWX.js → profiler.utility-C1D2Gg-U.js} +1 -1
  196. package/dist/assets/{project-authoring-session-D5fR27Xf.js → project-authoring-session-BSob2D65.js} +2 -2
  197. package/dist/assets/{properties-bone-constraints.inspector-CQ1kzpeW.js → properties-bone-constraints.inspector-L73QxWaS.js} +1 -1
  198. package/dist/assets/{properties-bone.inspector-BmWvLtS5.js → properties-bone.inspector-Bpp0cSF6.js} +1 -1
  199. package/dist/assets/{properties-collection.inspector-Bp4G6gAf.js → properties-collection.inspector-j0506O4s.js} +1 -1
  200. package/dist/assets/{properties-constraints.inspector-C5u2vHgr.js → properties-constraints.inspector-DjTr1Erm.js} +1 -1
  201. package/dist/assets/{properties-data.inspector-DLuIeVjK.js → properties-data.inspector-By5glSUR.js} +1 -1
  202. package/dist/assets/{properties-material.inspector-BazVBacy.js → properties-material.inspector-DN56JOAm.js} +1 -1
  203. package/dist/assets/{properties-modifiers.inspector-BR_xxGgB.js → properties-modifiers.inspector-BxRjWuOR.js} +1 -1
  204. package/dist/assets/{properties-object.inspector-BT8ErQ5C.js → properties-object.inspector-BHTl-m8G.js} +1 -1
  205. package/dist/assets/{properties-output.inspector-Db7k-X5n.js → properties-output.inspector-DjbAiJTY.js} +1 -1
  206. package/dist/assets/{properties-particles.inspector-GHdgdRSV.js → properties-particles.inspector-D1mTEKuy.js} +1 -1
  207. package/dist/assets/{properties-physics.inspector-CDa8fMg1.js → properties-physics.inspector-Ddxywk7T.js} +1 -1
  208. package/dist/assets/{properties-render.inspector-ChRA2wF6.js → properties-render.inspector-DlueZX_8.js} +1 -1
  209. package/dist/assets/{properties-scene.inspector-wox_pPvs.js → properties-scene.inspector-LB3sc51D.js} +1 -1
  210. package/dist/assets/{properties-texture.inspector-c5cYfvzG.js → properties-texture.inspector-BU-JEAY_.js} +1 -1
  211. package/dist/assets/{properties-view-layer.inspector-KfYDdJ83.js → properties-view-layer.inspector-BkAjyCpL.js} +1 -1
  212. package/dist/assets/{properties-world.inspector-DO4TsCFa.js → properties-world.inspector-BXybm5So.js} +1 -1
  213. package/dist/assets/{r3f-design-session-huIajqIc.js → r3f-design-session-DkmfD2Mx.js} +2 -2
  214. package/dist/assets/{r3f-physics-binding-YA43TdoL.js → r3f-physics-binding-CmR_FKS6.js} +1 -1
  215. package/dist/assets/{r3f-source-authoring-adapter-BlRstmGA.js → r3f-source-authoring-adapter-EkIj_j5C.js} +1 -1
  216. package/dist/assets/{react-canvas-navigation-M0ghQ3Pg.js → react-canvas-navigation-DnUWxFpr.js} +1 -1
  217. package/dist/assets/{react-inspector.service-CStUUFdZ.js → react-inspector.service-CVE2zwb_.js} +1 -1
  218. package/dist/assets/{react-story-board-CJ2rY1vM.js → react-story-board-BSUDIFUD.js} +1 -1
  219. package/dist/assets/{react-three-rapier.esm-2PI2GKyc.js → react-three-rapier.esm-HR--m53B.js} +1 -1
  220. package/dist/assets/{react-world-authoring-adapter-tdk4Hqj1.js → react-world-authoring-adapter-LUIUlDuG.js} +1 -1
  221. package/dist/assets/{realm-services-ZGsXIjKw.js → realm-services-DjWyEFlR.js} +1 -1
  222. package/dist/assets/{reflection-probe-capture.inspector-CacOiakh.js → reflection-probe-capture.inspector-CnnUUjZ1.js} +1 -1
  223. package/dist/assets/{registry-CCO8vgc4.js → registry-CoEgg4Uf.js} +1 -1
  224. package/dist/assets/{relative-import-specifier-CJ9epbC5.js → relative-import-specifier-qiLdR9s0.js} +1 -1
  225. package/dist/assets/{render-env-CcmQfcfh.js → render-env-uOmAJnlr.js} +1 -1
  226. package/dist/assets/{render-features-d6WsfyhR.js → render-features-BDTrZqsn.js} +1 -1
  227. package/dist/assets/{render-settings-2QiH0WvX.js → render-settings-B7DKAMUq.js} +1 -1
  228. package/dist/assets/{resolve-three-DaW6J3do.js → resolve-three-DqtjenoZ.js} +3 -3
  229. package/dist/assets/{root-seam-contract-BaqTf_0m.js → root-seam-contract-Dnk26mgR.js} +1 -1
  230. package/dist/assets/{run-selection-BmPqbXVv.js → run-selection-DMh0XzlK.js} +1 -1
  231. package/dist/assets/{scene-capture-BPf9CksU.js → scene-capture-B5Rcy1pe.js} +1 -1
  232. package/dist/assets/{scene-document.service-BCJX2wYL.js → scene-document.service-CptpkE8S.js} +2 -2
  233. package/dist/assets/{scene-framing-pfBwKlV1.js → scene-framing-k2LlZgVg.js} +1 -1
  234. package/dist/assets/{seeded-random-Cm0mJ9WK.js → seeded-random-nwY9ZTVx.js} +1 -1
  235. package/dist/assets/{setup-renderer-CDiOvS5v.js → setup-renderer-BuXtI2-s.js} +1 -1
  236. package/dist/assets/{source-object3d-authoring-adapter-CmnO36sT.js → source-object3d-authoring-adapter-D16iP0TM.js} +1 -1
  237. package/dist/assets/{source-persistence-backend-ECfFZPdn.js → source-persistence-backend-C35VQxKz.js} +1 -1
  238. package/dist/assets/{stage-keyboard-D9z07kMc.js → stage-keyboard-CjhoPz6i.js} +1 -1
  239. package/dist/assets/{stage-overlay-set-BEcLelHE.js → stage-overlay-set-B32HW5jr.js} +1 -1
  240. package/dist/assets/{stage-presence-markers-61iYjRz9.js → stage-presence-markers-CD1g5aVX.js} +1 -1
  241. package/dist/assets/{stage-transform-tools-D_zntx7x.js → stage-transform-tools-CVnmgj4G.js} +1 -1
  242. package/dist/assets/{standard-viewport-dressing-CvWc3TIo.js → standard-viewport-dressing-DbvBhJBU.js} +1 -1
  243. package/dist/assets/{state-watch.action-Dj33chqd.js → state-watch.action-BdPnoEng.js} +1 -1
  244. package/dist/assets/{state-watch.menu-BDbYVr9h.js → state-watch.menu-BmAXd2iE.js} +1 -1
  245. package/dist/assets/{state-watch.utility-YGDgFG4K.js → state-watch.utility-Bnzldqwo.js} +1 -1
  246. package/dist/assets/{story-capture-DRH3UvNr.js → story-capture-BofI_wKy.js} +1 -1
  247. package/dist/assets/{story-documents-DoLPg9Lx.js → story-documents-DkDjQXJJ.js} +1 -1
  248. package/dist/assets/{story-documents.service-Teg89FZc.js → story-documents.service-BsRPe5R4.js} +1 -1
  249. package/dist/assets/{story-documents.service-Ll8_ATjf.js → story-documents.service-DiAebTI9.js} +1 -1
  250. package/dist/assets/{story-media-presence-Xlo427K1.js → story-media-presence-CtYvsK-A.js} +1 -1
  251. package/dist/assets/{story-pixi-preview-BBP84uRR.js → story-pixi-preview-CMpik5gu.js} +1 -1
  252. package/dist/assets/{story-presentation-Bqi53kq0.js → story-presentation-D9-lh6hS.js} +1 -1
  253. package/dist/assets/{story-three-preview-BP4ILFDq.js → story-three-preview-DnW5SEf7.js} +2 -2
  254. package/dist/assets/{studio-environment-BLFX45T5.js → studio-environment-BSd_1eWm.js} +1 -1
  255. package/dist/assets/{surface-state-rZISD-ig.js → surface-state-C1SxqlW8.js} +1 -1
  256. package/dist/assets/{syntactic-prop-specs-BVVxIxx3.js → syntactic-prop-specs-mvpbkzOV.js} +1 -1
  257. package/dist/assets/{team-playtest.service-DqP8zQMt.js → team-playtest.service-sy9-i7wc.js} +1 -1
  258. package/dist/assets/{three-a5CVjo2i.js → three-CW7JxjOv.js} +1 -1
  259. package/dist/assets/{three-authoring-adapter-D9bJThN9.js → three-authoring-adapter-DH5IBxn4.js} +1 -1
  260. package/dist/assets/three-authoring.service-Epg_oejj.js +2 -0
  261. package/dist/assets/{three-ingest-runtime-CfjyePZf.js → three-ingest-runtime-BnjdzpH9.js} +1 -1
  262. package/dist/assets/{three-integration-Bq5NMTap.js → three-integration-h_YZxmn4.js} +2 -2
  263. package/dist/assets/three-integration.service-mHfKD3i5.js +1 -0
  264. package/dist/assets/{three-projection-core-BTQ_M-Ho.js → three-projection-core-RACdI_qj.js} +1 -1
  265. package/dist/assets/{three-state-DYl6KVhl.js → three-state-COm8p1VC.js} +1 -1
  266. package/dist/assets/{three-story-capture.service-CkEnDiGX.js → three-story-capture.service-DXOV7quR.js} +2 -2
  267. package/dist/assets/{three-story-model-DR4JL0tj.js → three-story-model-DWDPEwZs.js} +1 -1
  268. package/dist/assets/{three-viewport-presentation-Bu3_3jY0.js → three-viewport-presentation-DO_Tqsn5.js} +1 -1
  269. package/dist/assets/{transform-mode-request-CQMVP3gI.js → transform-mode-request-DLXLBh2a.js} +1 -1
  270. package/dist/assets/{transport-strip-7xF6Xkx1.js → transport-strip-Ck5zz3Th.js} +1 -1
  271. package/dist/assets/transport.header-DC3-PIO2.js +1 -0
  272. package/dist/assets/{tuples-Bi79tUJA.js → tuples-B4X2J9eQ.js} +1 -1
  273. package/dist/assets/{ui-board-document-ByN-Igr_.js → ui-board-document-BfrxNqBh.js} +2 -2
  274. package/dist/assets/{user-data-BJje5VYV.js → user-data-BVjl5VSz.js} +1 -1
  275. package/dist/assets/{utility-view-state-D_M1xdFg.js → utility-view-state-BwFHQqg-.js} +1 -1
  276. package/dist/assets/{viewport-door-Bn_5UYAF.js → viewport-door-DGEfF1wj.js} +1 -1
  277. package/dist/assets/{viewport-root-presentation-CMku-eFg.js → viewport-root-presentation-BzFN3-WC.js} +1 -1
  278. package/dist/assets/{viewport-surface-status-Z2lECnRZ.js → viewport-surface-status-BTe8UVhJ.js} +1 -1
  279. package/dist/assets/{webworkerAll-B66_oG9K.js → webworkerAll-Cys-YS-I.js} +1 -1
  280. package/dist/assets/{workspace-arrangement-BPsnvrOt.js → workspace-arrangement-BD3sTZSQ.js} +1 -1
  281. package/dist/assets/{world-documents-CEI6Ult8.js → world-documents-eSWWvQsk.js} +1 -1
  282. package/dist/assets/{world-root-stage-binding-BtFetoJf.js → world-root-stage-binding-D8sBh4Kt.js} +1 -1
  283. package/dist/assets/{xstate-animation-binding-5ogRENtk.js → xstate-animation-binding-CqpKrHn2.js} +1 -1
  284. package/dist/assets/{xstate-animation-meta-D3SfP75s.js → xstate-animation-meta-Cbd_n_eN.js} +1 -1
  285. package/dist-node/cli.js +16 -16
  286. package/package.json +16 -16
  287. package/dist/assets/InspectorObjectPreview-ec285ozq.js +0 -1
  288. package/dist/assets/Object3DDocumentViewport-DGFR-qkU.js +0 -2
  289. package/dist/assets/StageHost-CNkXkK_f.js +0 -2
  290. package/dist/assets/autoplay.service-B8dGBVjn.js +0 -1
  291. package/dist/assets/instances.command-BIwrjtVv.js +0 -1
  292. package/dist/assets/network-observer.service-ib7T4XSw.js +0 -1
  293. package/dist/assets/three-authoring.service-C0WuXyLN.js +0 -2
  294. package/dist/assets/three-integration.service-scS00K9w.js +0 -1
  295. package/dist/assets/transport.header-AqKlS4Ny.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{U as N,d7 as O,d8 as k,d9 as P,a8 as h,bw as u,aM as f,a7 as d,da as v,db as R,dc as B,dd as G,a6 as w,bz as z,bP as M,de as A,aL as l,aN as m,df as b,aS as y,dg as C,bv as F,dh as L,by as V,bA as $,bB as U,bD as H,di as K,dj as _,dk as X,dl as Y}from"./index-Crsbhlhy.js";import{r as c}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{r as T}from"./transform-mode-request-CQMVP3gI.js";function D({active:a,onArm:t,faIcon:r,action:s,label:i}){return e.jsx(u,{text:i,hotkey:v(s),children:e.jsx(f,{"aria-label":i,"aria-pressed":a,shape:"segment",size:"comfortable",onClick:t,children:e.jsx(d,{icon:r,size:"md"})})})}function I({store:a,dimensions:t="3d",size:r="comfortable",variant:s="ghost",showValues:i=!1}){const[o,S]=c.useState(!1),j=c.useRef(null);return c.useEffect(()=>{if(!o)return;const n=p=>{j.current&&!j.current.contains(p.target)&&S(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[o]),e.jsxs("div",{ref:j,className:"volter-viewport-popover-anchor",children:[e.jsxs(R,{children:[t==="2d"&&e.jsx(u,{text:"Smart Snap",children:e.jsx(f,{"aria-label":"Toggle smart snap","aria-pressed":a.smartSnap.enabled,variant:s,size:r,onClick:()=>a.setSmartSnap({enabled:!a.smartSnap.enabled}),children:e.jsx(d,{icon:B,size:"md"})})}),e.jsx(u,{text:t==="2d"?"Grid Snap":"Toggle Snap",hotkey:v("viewport.toggleSnap"),children:e.jsx(f,{"aria-label":"Toggle snap","aria-pressed":a.snapEnabled,variant:s,size:r,onClick:()=>a.toggleSnap(),children:e.jsx(d,{icon:G,size:"md"})})}),i?[["translate",h.tool.move,`${a.snapValues.translate}`],["rotate",h.tool.rotate,`${a.snapValues.rotate}°`],["scale",h.tool.scale,`${a.snapValues.scale}`]].map(([n,p,g])=>e.jsx(u,{text:"Snap Settings",children:e.jsxs(w,{"aria-label":`${n} snap step`,"aria-haspopup":"dialog","aria-expanded":o,variant:s,size:r,"data-snap-step":n,onClick:()=>S(!o),children:[e.jsx(d,{icon:p,size:"xs"}),g]})},n)):e.jsx(u,{text:"Snap Settings",children:e.jsx(f,{"aria-label":"Snap settings","aria-haspopup":"dialog","aria-expanded":o,variant:s,size:r,onClick:()=>S(!o),children:e.jsx(d,{icon:z,size:"xs"})})})]}),o&&e.jsx(M,{className:"volter-snap-popover",children:e.jsxs(A,{gap:2,children:[t==="2d"?e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"caption",tone:"muted",children:"Grid Step (px)"}),e.jsx(m,{type:"number","aria-label":"Grid step",value:a.snap2D.step,step:1,min:1,onChange:n=>a.setSnap2D({step:Number(n.target.value)||8})}),e.jsx(l,{variant:"caption",tone:"muted",children:"Grid Offset (px)"}),e.jsxs(b,{gap:1,children:[e.jsx(m,{type:"number","aria-label":"Grid offset x",value:a.snap2D.offsetX,step:1,onChange:n=>a.setSnap2D({offsetX:Number(n.target.value)||0})}),e.jsx(m,{type:"number","aria-label":"Grid offset y",value:a.snap2D.offsetY,step:1,onChange:n=>a.setSnap2D({offsetY:Number(n.target.value)||0})})]}),e.jsx(l,{variant:"caption",tone:"muted",children:"Primary Line Every (steps)"}),e.jsx(m,{type:"number","aria-label":"Primary line every",value:a.snap2D.primaryEvery,step:1,min:1,onChange:n=>a.setSnap2D({primaryEvery:Number(n.target.value)||8})})]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"caption",tone:"muted",children:"Translate"}),e.jsx(m,{type:"number",value:a.snapValues.translate,step:.25,min:.01,onChange:n=>a.setSnapValues({translate:Number(n.target.value)||1})})]}),t==="2d"?e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"caption",tone:"muted",children:"Rotation Offset (deg)"}),e.jsx(m,{type:"number","aria-label":"Rotation offset",value:a.snap2D.rotationOffset,step:1,onChange:n=>a.setSnap2D({rotationOffset:Number(n.target.value)||0})}),e.jsx(l,{variant:"caption",tone:"muted",children:"Rotation Step (deg)"}),e.jsx(m,{type:"number","aria-label":"Rotation step",value:a.snap2D.rotationStep,step:1,min:1,onChange:n=>a.setSnap2D({rotationStep:Number(n.target.value)||15})}),e.jsx(l,{variant:"caption",tone:"muted",children:"Scale Step"}),e.jsx(m,{type:"number","aria-label":"Scale step",value:a.snap2D.scaleStep,step:.05,min:.01,onChange:n=>a.setSnap2D({scaleStep:Number(n.target.value)||.1})})]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"caption",tone:"muted",children:"Rotate (deg)"}),e.jsx(m,{type:"number",value:a.snapValues.rotate,step:5,min:1,onChange:n=>a.setSnapValues({rotate:Number(n.target.value)||15})}),e.jsx(l,{variant:"caption",tone:"muted",children:"Scale"}),e.jsx(m,{type:"number",value:a.snapValues.scale,step:.05,min:.01,onChange:n=>a.setSnapValues({scale:Number(n.target.value)||.25})})]}),t==="2d"&&e.jsxs(e.Fragment,{children:[[["Use Rotation Snap",a.rotationSnap,()=>a.setRotationSnap(!a.rotationSnap)],["Use Scale Snap",a.scaleSnap,()=>a.setScaleSnap(!a.scaleSnap)],["Snap Relative",a.snap2D.relative,()=>a.setSnap2D({relative:!a.snap2D.relative})],["Use Pixel Snap",a.snap2D.pixel,()=>a.setSnap2D({pixel:!a.snap2D.pixel})]].map(([n,p,g])=>e.jsxs(b,{gap:2,align:"center",role:"menuitemcheckbox","aria-checked":p,onClick:g,children:[e.jsx(y,{checked:p,readOnly:!0}),e.jsx(l,{children:n})]},n)),e.jsx(l,{variant:"caption",tone:"muted",children:"Smart Snapping"}),[["parent","Snap to Parent"],["others","Snap to Other Nodes"],["sides","Snap to Node Sides"],["center","Snap to Node Center"],["guides","Snap to Guides"]].map(([n,p])=>e.jsxs(b,{gap:2,align:"center",role:"menuitemcheckbox","aria-checked":a.smartSnap[n],onClick:()=>a.setSmartSnap({[n]:!a.smartSnap[n]}),children:[e.jsx(y,{checked:a.smartSnap[n],readOnly:!0}),e.jsx(l,{children:p})]},n))]}),t==="3d"&&e.jsxs(e.Fragment,{children:[e.jsxs(b,{gap:2,align:"center",onClick:()=>a.toggleSnapToSurface(),children:[e.jsx(y,{checked:a.snapToSurface,readOnly:!0}),e.jsx(l,{children:"Snap to Surface"})]}),e.jsxs(l,{variant:"caption",tone:"dim",children:["Hold ",e.jsx(C,{children:"Ctrl"})," while dragging to snap once ·"," ",e.jsx(C,{children:v("viewport.toggleSnap")})," toggles"]}),e.jsxs(l,{variant:"caption",tone:"dim",children:["Hold ",e.jsx(C,{children:v("viewport.vertexSnapHold")})," during translate for vertex snap"]})]})]})})]})}const q={"active-element":"Active Element","median-point":"Median Point","individual-origins":"Individual Origins"};function W({store:a}){const t=["active-element","median-point","individual-origins"],r=`Pivot: ${q[a.pivotMode]}`;return e.jsx(u,{text:r,hotkey:v("viewport.cyclePivot"),children:e.jsx(f,{"aria-label":r,"aria-pressed":a.pivotMode!=="active-element",variant:"secondary",onClick:()=>{const s=t.indexOf(a.pivotMode);a.setPivotMode(t[(s+1)%t.length])},children:e.jsx(d,{icon:K,size:"md"})})})}const J={auto:"Auto",pivot:"Pivot",center:"Center"};function Q({store:a}){const t=["auto","pivot","center"],r=`Anchor: ${J[a.gizmoAnchor]}`;return e.jsx(u,{text:r,children:e.jsx(f,{"aria-label":r,"aria-pressed":a.gizmoAnchor!=="auto",variant:"secondary",onClick:()=>{const s=t.indexOf(a.gizmoAnchor);a.setGizmoAnchor(t[(s+1)%t.length])},children:e.jsx(d,{icon:a.gizmoAnchor==="center"?_:X,size:"md"})})})}function Z({store:a}){const[t,r]=c.useState(!1),s=c.useRef(null);return c.useEffect(()=>{if(!t)return;const i=o=>{s.current?.contains(o.target)||r(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t]),e.jsxs("div",{ref:s,className:"volter-viewport-popover-anchor",children:[e.jsx(u,{text:"Transform options",children:e.jsx(f,{"aria-label":"Transform options","aria-haspopup":"dialog","aria-expanded":t,variant:"secondary",onClick:()=>r(i=>!i),children:e.jsx(d,{icon:Y,size:"md"})})}),t?e.jsx(M,{style:{minWidth:240},children:e.jsxs(A,{gap:3,children:[e.jsxs(w,{size:"compact",variant:"ghost",onClick:()=>{a.snapSelectionToFloor(),r(!1)},children:["Snap Selection to Floor ",e.jsx(C,{children:v("viewport.snapToFloor")})]}),e.jsxs(b,{gap:2,align:"center",onClick:()=>a.togglePreserveChildrenTransform(),style:{cursor:"pointer"},children:[e.jsx(y,{checked:a.preserveChildrenTransform,readOnly:!0}),e.jsx(l,{children:"Preserve Children Transform"})]}),e.jsx(l,{variant:"caption",tone:"dim",children:"Keep source-writable children fixed in world space while their parent moves."})]})}):null]})}function ee({store:a}){const[t,r]=c.useState(!1),s=c.useRef(null),i=a.transformSpace==="world"?"Global":"Local";return e.jsxs("div",{className:"volter-viewport-popover-anchor",children:[e.jsx(u,{text:`Transform orientation: ${i}`,children:e.jsxs(w,{ref:s,type:"button",size:"compact",variant:"secondary","aria-label":`Transform orientation: ${i}`,"aria-haspopup":"menu","aria-expanded":t,onClick:()=>r(o=>!o),className:"volter-transform-orientation-trigger",children:[e.jsx(d,{icon:a.transformSpace==="world"?L:V,size:"sm"}),e.jsx("span",{children:i}),e.jsx(d,{icon:z,size:"xs"})]})}),t&&e.jsx($,{anchorRef:s,align:"start",clamp:!0,"aria-label":"Transform orientation",onDismiss:()=>r(!1),children:["world","local"].map(o=>e.jsxs(U,{role:"menuitemradio","aria-checked":a.transformSpace===o,onSelect:()=>{a.setTransformSpace(o),r(!1)},children:[e.jsx("span",{className:"volter-menu-check",children:a.transformSpace===o&&e.jsx(d,{icon:H,size:"xs"})}),o==="world"?"Global":"Local"]},o))})]})}function ie({store:a}={}){const t=N(),r=a??t;c.useSyncExternalStore(r.subscribe,r.getShellSnapshot??r.getSnapshot),c.useSyncExternalStore(O,k,k);const[s,i]=c.useState(null),o=s?.closest(".volter-stage-bar")!=null;return e.jsxs(F,{compact:!0,label:"Transform controls","data-testid":"transform-header-controls",className:"volter-transform-header-controls",children:[e.jsx("span",{ref:i,hidden:!0}),e.jsx(ee,{store:r}),e.jsxs(R,{children:[e.jsx(W,{store:r}),e.jsx(Q,{store:r})]}),e.jsx(I,{store:r,size:"default",variant:"secondary",showValues:o}),e.jsx(Z,{store:r})]})}const ae=()=>()=>{},E=()=>null;function le({dimensions:a="3d",door:t,store:r,otherToolActive:s=!1,onToolArmed:i,viewTools:o,trailingTools:S}={}){const j=N(),n=r??j;c.useSyncExternalStore(n.subscribe,n.getShellSnapshot??n.getSnapshot),c.useSyncExternalStore(O,k,k);const p=c.useSyncExternalStore(t?.subscribe??ae,t?.armed??E,t?.armed??E),g=[{mode:"translate",faIcon:h.tool.move,action:"transform.translate",label:"Move"},{mode:"rotate",faIcon:h.tool.rotate,action:"transform.rotate",label:"Rotate"},{mode:"scale",faIcon:h.tool.scale,action:"transform.scale",label:"Scale"}];return e.jsxs(P,{label:"Transform tools","data-testid":a==="2d"?"canvas-2d-toolstrip":"threejs-toolstrip",className:"volter-viewport-toolbar volter-viewport-toolbar-left",children:[t?null:e.jsx(D,{faIcon:h.tool.select,action:"transform.select",label:"Select",active:!s&&(n.transformMode==="select"||a==="2d"&&n.transformMode==="combined"),onArm:()=>{i?.(),T(n,"select")}}),g.map(x=>e.jsx(D,{faIcon:x.faIcon,action:x.action,label:x.label,active:!s&&(t?p===x.mode:n.transformMode===x.mode),onArm:()=>{i?.(),t?t.begin(x.mode):T(n,x.mode)}},x.mode)),t||a==="2d"?null:e.jsx(D,{faIcon:h.tool.transform,action:"transform.combined",label:"Transform (all handles)",active:n.transformMode==="combined",onArm:()=>T(n,"combined")}),o,a==="2d"?e.jsx(I,{store:n,dimensions:"2d"}):null,S]})}export{ie as T,le as a};
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{U as N,d7 as O,d8 as k,d9 as P,a8 as h,bw as u,aM as f,a7 as d,da as v,db as R,dc as B,dd as G,a6 as w,bz as z,bP as M,de as A,aL as l,aN as m,df as b,aS as y,dg as C,bv as F,dh as L,by as V,bA as $,bB as U,bD as H,di as K,dj as _,dk as X,dl as Y}from"./index-DaRQxpdW.js";import{r as c}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{r as T}from"./transform-mode-request-DLXLBh2a.js";function D({active:a,onArm:t,faIcon:r,action:s,label:i}){return e.jsx(u,{text:i,hotkey:v(s),children:e.jsx(f,{"aria-label":i,"aria-pressed":a,shape:"segment",size:"comfortable",onClick:t,children:e.jsx(d,{icon:r,size:"md"})})})}function I({store:a,dimensions:t="3d",size:r="comfortable",variant:s="ghost",showValues:i=!1}){const[o,S]=c.useState(!1),j=c.useRef(null);return c.useEffect(()=>{if(!o)return;const n=p=>{j.current&&!j.current.contains(p.target)&&S(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[o]),e.jsxs("div",{ref:j,className:"volter-viewport-popover-anchor",children:[e.jsxs(R,{children:[t==="2d"&&e.jsx(u,{text:"Smart Snap",children:e.jsx(f,{"aria-label":"Toggle smart snap","aria-pressed":a.smartSnap.enabled,variant:s,size:r,onClick:()=>a.setSmartSnap({enabled:!a.smartSnap.enabled}),children:e.jsx(d,{icon:B,size:"md"})})}),e.jsx(u,{text:t==="2d"?"Grid Snap":"Toggle Snap",hotkey:v("viewport.toggleSnap"),children:e.jsx(f,{"aria-label":"Toggle snap","aria-pressed":a.snapEnabled,variant:s,size:r,onClick:()=>a.toggleSnap(),children:e.jsx(d,{icon:G,size:"md"})})}),i?[["translate",h.tool.move,`${a.snapValues.translate}`],["rotate",h.tool.rotate,`${a.snapValues.rotate}°`],["scale",h.tool.scale,`${a.snapValues.scale}`]].map(([n,p,g])=>e.jsx(u,{text:"Snap Settings",children:e.jsxs(w,{"aria-label":`${n} snap step`,"aria-haspopup":"dialog","aria-expanded":o,variant:s,size:r,"data-snap-step":n,onClick:()=>S(!o),children:[e.jsx(d,{icon:p,size:"xs"}),g]})},n)):e.jsx(u,{text:"Snap Settings",children:e.jsx(f,{"aria-label":"Snap settings","aria-haspopup":"dialog","aria-expanded":o,variant:s,size:r,onClick:()=>S(!o),children:e.jsx(d,{icon:z,size:"xs"})})})]}),o&&e.jsx(M,{className:"volter-snap-popover",children:e.jsxs(A,{gap:2,children:[t==="2d"?e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"caption",tone:"muted",children:"Grid Step (px)"}),e.jsx(m,{type:"number","aria-label":"Grid step",value:a.snap2D.step,step:1,min:1,onChange:n=>a.setSnap2D({step:Number(n.target.value)||8})}),e.jsx(l,{variant:"caption",tone:"muted",children:"Grid Offset (px)"}),e.jsxs(b,{gap:1,children:[e.jsx(m,{type:"number","aria-label":"Grid offset x",value:a.snap2D.offsetX,step:1,onChange:n=>a.setSnap2D({offsetX:Number(n.target.value)||0})}),e.jsx(m,{type:"number","aria-label":"Grid offset y",value:a.snap2D.offsetY,step:1,onChange:n=>a.setSnap2D({offsetY:Number(n.target.value)||0})})]}),e.jsx(l,{variant:"caption",tone:"muted",children:"Primary Line Every (steps)"}),e.jsx(m,{type:"number","aria-label":"Primary line every",value:a.snap2D.primaryEvery,step:1,min:1,onChange:n=>a.setSnap2D({primaryEvery:Number(n.target.value)||8})})]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"caption",tone:"muted",children:"Translate"}),e.jsx(m,{type:"number",value:a.snapValues.translate,step:.25,min:.01,onChange:n=>a.setSnapValues({translate:Number(n.target.value)||1})})]}),t==="2d"?e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"caption",tone:"muted",children:"Rotation Offset (deg)"}),e.jsx(m,{type:"number","aria-label":"Rotation offset",value:a.snap2D.rotationOffset,step:1,onChange:n=>a.setSnap2D({rotationOffset:Number(n.target.value)||0})}),e.jsx(l,{variant:"caption",tone:"muted",children:"Rotation Step (deg)"}),e.jsx(m,{type:"number","aria-label":"Rotation step",value:a.snap2D.rotationStep,step:1,min:1,onChange:n=>a.setSnap2D({rotationStep:Number(n.target.value)||15})}),e.jsx(l,{variant:"caption",tone:"muted",children:"Scale Step"}),e.jsx(m,{type:"number","aria-label":"Scale step",value:a.snap2D.scaleStep,step:.05,min:.01,onChange:n=>a.setSnap2D({scaleStep:Number(n.target.value)||.1})})]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"caption",tone:"muted",children:"Rotate (deg)"}),e.jsx(m,{type:"number",value:a.snapValues.rotate,step:5,min:1,onChange:n=>a.setSnapValues({rotate:Number(n.target.value)||15})}),e.jsx(l,{variant:"caption",tone:"muted",children:"Scale"}),e.jsx(m,{type:"number",value:a.snapValues.scale,step:.05,min:.01,onChange:n=>a.setSnapValues({scale:Number(n.target.value)||.25})})]}),t==="2d"&&e.jsxs(e.Fragment,{children:[[["Use Rotation Snap",a.rotationSnap,()=>a.setRotationSnap(!a.rotationSnap)],["Use Scale Snap",a.scaleSnap,()=>a.setScaleSnap(!a.scaleSnap)],["Snap Relative",a.snap2D.relative,()=>a.setSnap2D({relative:!a.snap2D.relative})],["Use Pixel Snap",a.snap2D.pixel,()=>a.setSnap2D({pixel:!a.snap2D.pixel})]].map(([n,p,g])=>e.jsxs(b,{gap:2,align:"center",role:"menuitemcheckbox","aria-checked":p,onClick:g,children:[e.jsx(y,{checked:p,readOnly:!0}),e.jsx(l,{children:n})]},n)),e.jsx(l,{variant:"caption",tone:"muted",children:"Smart Snapping"}),[["parent","Snap to Parent"],["others","Snap to Other Nodes"],["sides","Snap to Node Sides"],["center","Snap to Node Center"],["guides","Snap to Guides"]].map(([n,p])=>e.jsxs(b,{gap:2,align:"center",role:"menuitemcheckbox","aria-checked":a.smartSnap[n],onClick:()=>a.setSmartSnap({[n]:!a.smartSnap[n]}),children:[e.jsx(y,{checked:a.smartSnap[n],readOnly:!0}),e.jsx(l,{children:p})]},n))]}),t==="3d"&&e.jsxs(e.Fragment,{children:[e.jsxs(b,{gap:2,align:"center",onClick:()=>a.toggleSnapToSurface(),children:[e.jsx(y,{checked:a.snapToSurface,readOnly:!0}),e.jsx(l,{children:"Snap to Surface"})]}),e.jsxs(l,{variant:"caption",tone:"dim",children:["Hold ",e.jsx(C,{children:"Ctrl"})," while dragging to snap once ·"," ",e.jsx(C,{children:v("viewport.toggleSnap")})," toggles"]}),e.jsxs(l,{variant:"caption",tone:"dim",children:["Hold ",e.jsx(C,{children:v("viewport.vertexSnapHold")})," during translate for vertex snap"]})]})]})})]})}const q={"active-element":"Active Element","median-point":"Median Point","individual-origins":"Individual Origins"};function W({store:a}){const t=["active-element","median-point","individual-origins"],r=`Pivot: ${q[a.pivotMode]}`;return e.jsx(u,{text:r,hotkey:v("viewport.cyclePivot"),children:e.jsx(f,{"aria-label":r,"aria-pressed":a.pivotMode!=="active-element",variant:"secondary",onClick:()=>{const s=t.indexOf(a.pivotMode);a.setPivotMode(t[(s+1)%t.length])},children:e.jsx(d,{icon:K,size:"md"})})})}const J={auto:"Auto",pivot:"Pivot",center:"Center"};function Q({store:a}){const t=["auto","pivot","center"],r=`Anchor: ${J[a.gizmoAnchor]}`;return e.jsx(u,{text:r,children:e.jsx(f,{"aria-label":r,"aria-pressed":a.gizmoAnchor!=="auto",variant:"secondary",onClick:()=>{const s=t.indexOf(a.gizmoAnchor);a.setGizmoAnchor(t[(s+1)%t.length])},children:e.jsx(d,{icon:a.gizmoAnchor==="center"?_:X,size:"md"})})})}function Z({store:a}){const[t,r]=c.useState(!1),s=c.useRef(null);return c.useEffect(()=>{if(!t)return;const i=o=>{s.current?.contains(o.target)||r(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t]),e.jsxs("div",{ref:s,className:"volter-viewport-popover-anchor",children:[e.jsx(u,{text:"Transform options",children:e.jsx(f,{"aria-label":"Transform options","aria-haspopup":"dialog","aria-expanded":t,variant:"secondary",onClick:()=>r(i=>!i),children:e.jsx(d,{icon:Y,size:"md"})})}),t?e.jsx(M,{style:{minWidth:240},children:e.jsxs(A,{gap:3,children:[e.jsxs(w,{size:"compact",variant:"ghost",onClick:()=>{a.snapSelectionToFloor(),r(!1)},children:["Snap Selection to Floor ",e.jsx(C,{children:v("viewport.snapToFloor")})]}),e.jsxs(b,{gap:2,align:"center",onClick:()=>a.togglePreserveChildrenTransform(),style:{cursor:"pointer"},children:[e.jsx(y,{checked:a.preserveChildrenTransform,readOnly:!0}),e.jsx(l,{children:"Preserve Children Transform"})]}),e.jsx(l,{variant:"caption",tone:"dim",children:"Keep source-writable children fixed in world space while their parent moves."})]})}):null]})}function ee({store:a}){const[t,r]=c.useState(!1),s=c.useRef(null),i=a.transformSpace==="world"?"Global":"Local";return e.jsxs("div",{className:"volter-viewport-popover-anchor",children:[e.jsx(u,{text:`Transform orientation: ${i}`,children:e.jsxs(w,{ref:s,type:"button",size:"compact",variant:"secondary","aria-label":`Transform orientation: ${i}`,"aria-haspopup":"menu","aria-expanded":t,onClick:()=>r(o=>!o),className:"volter-transform-orientation-trigger",children:[e.jsx(d,{icon:a.transformSpace==="world"?L:V,size:"sm"}),e.jsx("span",{children:i}),e.jsx(d,{icon:z,size:"xs"})]})}),t&&e.jsx($,{anchorRef:s,align:"start",clamp:!0,"aria-label":"Transform orientation",onDismiss:()=>r(!1),children:["world","local"].map(o=>e.jsxs(U,{role:"menuitemradio","aria-checked":a.transformSpace===o,onSelect:()=>{a.setTransformSpace(o),r(!1)},children:[e.jsx("span",{className:"volter-menu-check",children:a.transformSpace===o&&e.jsx(d,{icon:H,size:"xs"})}),o==="world"?"Global":"Local"]},o))})]})}function ie({store:a}={}){const t=N(),r=a??t;c.useSyncExternalStore(r.subscribe,r.getShellSnapshot??r.getSnapshot),c.useSyncExternalStore(O,k,k);const[s,i]=c.useState(null),o=s?.closest(".volter-stage-bar")!=null;return e.jsxs(F,{compact:!0,label:"Transform controls","data-testid":"transform-header-controls",className:"volter-transform-header-controls",children:[e.jsx("span",{ref:i,hidden:!0}),e.jsx(ee,{store:r}),e.jsxs(R,{children:[e.jsx(W,{store:r}),e.jsx(Q,{store:r})]}),e.jsx(I,{store:r,size:"default",variant:"secondary",showValues:o}),e.jsx(Z,{store:r})]})}const ae=()=>()=>{},E=()=>null;function le({dimensions:a="3d",door:t,store:r,otherToolActive:s=!1,onToolArmed:i,viewTools:o,trailingTools:S}={}){const j=N(),n=r??j;c.useSyncExternalStore(n.subscribe,n.getShellSnapshot??n.getSnapshot),c.useSyncExternalStore(O,k,k);const p=c.useSyncExternalStore(t?.subscribe??ae,t?.armed??E,t?.armed??E),g=[{mode:"translate",faIcon:h.tool.move,action:"transform.translate",label:"Move"},{mode:"rotate",faIcon:h.tool.rotate,action:"transform.rotate",label:"Rotate"},{mode:"scale",faIcon:h.tool.scale,action:"transform.scale",label:"Scale"}];return e.jsxs(P,{label:"Transform tools","data-testid":a==="2d"?"canvas-2d-toolstrip":"threejs-toolstrip",className:"volter-viewport-toolbar volter-viewport-toolbar-left",children:[t?null:e.jsx(D,{faIcon:h.tool.select,action:"transform.select",label:"Select",active:!s&&(n.transformMode==="select"||a==="2d"&&n.transformMode==="combined"),onArm:()=>{i?.(),T(n,"select")}}),g.map(x=>e.jsx(D,{faIcon:x.faIcon,action:x.action,label:x.label,active:!s&&(t?p===x.mode:n.transformMode===x.mode),onArm:()=>{i?.(),t?t.begin(x.mode):T(n,x.mode)}},x.mode)),t||a==="2d"?null:e.jsx(D,{faIcon:h.tool.transform,action:"transform.combined",label:"Transform (all handles)",active:n.transformMode==="combined",onArm:()=>T(n,"combined")}),o,a==="2d"?e.jsx(I,{store:n,dimensions:"2d"}):null,S]})}export{ie as T,le as a};
@@ -1 +1 @@
1
- import{a}from"./jsx-runtime-DPjLkJKQ.js";import{r as s}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{dm as i,dn as n,dp as o,al as t,dq as r}from"./index-Crsbhlhy.js";function u(){const e=s.useSyncExternalStore(i,n,n);return e?a.jsx("div",{role:"status","aria-live":"polite","data-testid":"transient-hint",style:{position:"absolute",left:"50%",bottom:r[6],transform:"translateX(-50%)",maxWidth:"min(440px, 80%)",padding:`${r[3]}px ${r[5]}px`,borderRadius:t.shape.medium,border:`1px solid ${t.boundary.strong}`,background:t.surface.overlay,color:t.content.primary,fontSize:"var(--volter-font-base)",lineHeight:1.4,textAlign:"center",pointerEvents:"none",zIndex:o.toast},children:e.message},e.id):null}export{u as T};
1
+ import{a}from"./jsx-runtime-DPjLkJKQ.js";import{r as s}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{dm as i,dn as n,dp as o,al as t,dq as r}from"./index-DaRQxpdW.js";function u(){const e=s.useSyncExternalStore(i,n,n);return e?a.jsx("div",{role:"status","aria-live":"polite","data-testid":"transient-hint",style:{position:"absolute",left:"50%",bottom:r[6],transform:"translateX(-50%)",maxWidth:"min(440px, 80%)",padding:`${r[3]}px ${r[5]}px`,borderRadius:t.shape.medium,border:`1px solid ${t.boundary.strong}`,background:t.surface.overlay,color:t.content.primary,fontSize:"var(--volter-font-base)",lineHeight:1.4,textAlign:"center",pointerEvents:"none",zIndex:o.toast},children:e.message},e.id):null}export{u as T};
@@ -1 +1 @@
1
- import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{r}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{aL as c,aZ as x}from"./index-Crsbhlhy.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";function H({assetPath:s}){const[p,a]=r.useState(!1),[d,m]=r.useState(null),i=s;r.useEffect(()=>{a(!1)},[i]);const n=s.split("/").pop()??s,l=r.useCallback(e=>{if(e){if(e.error){a(!0);return}e.videoWidth<=0||m(o=>o&&o.w===e.videoWidth&&o.h===e.videoHeight?o:{w:e.videoWidth,h:e.videoHeight})}},[]);return t.jsxs("div",{"data-testid":"video-asset-document",style:{height:"100%",minHeight:240,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},children:[t.jsx(c,{tone:"dim",variant:"label",children:n}),d&&t.jsxs(c,{tone:"muted",variant:"code",children:[d.w," × ",d.h]})]}),t.jsx("div",{className:"volter-asset-transparency-well",style:{flex:1,minHeight:0,display:"flex",alignItems:"center",justifyContent:"center",padding:12},children:p?t.jsxs("div",{style:{color:x[2],fontSize:12,textAlign:"center"},children:[n," could not be played from ",i,". The file may be missing, or its codec may not be one this browser decodes."]}):t.jsx("video",{src:i,controls:!0,playsInline:!0,preload:"metadata",ref:l,onError:()=>a(!0),onLoadedMetadata:e=>l(e.currentTarget),style:{maxWidth:"100%",maxHeight:"100%",display:"block"}},i)})]})}export{H as VideoViewer};
1
+ import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{r}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{aL as c,aZ as x}from"./index-DaRQxpdW.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";function H({assetPath:s}){const[p,a]=r.useState(!1),[d,m]=r.useState(null),i=s;r.useEffect(()=>{a(!1)},[i]);const n=s.split("/").pop()??s,l=r.useCallback(e=>{if(e){if(e.error){a(!0);return}e.videoWidth<=0||m(o=>o&&o.w===e.videoWidth&&o.h===e.videoHeight?o:{w:e.videoWidth,h:e.videoHeight})}},[]);return t.jsxs("div",{"data-testid":"video-asset-document",style:{height:"100%",minHeight:240,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},children:[t.jsx(c,{tone:"dim",variant:"label",children:n}),d&&t.jsxs(c,{tone:"muted",variant:"code",children:[d.w," × ",d.h]})]}),t.jsx("div",{className:"volter-asset-transparency-well",style:{flex:1,minHeight:0,display:"flex",alignItems:"center",justifyContent:"center",padding:12},children:p?t.jsxs("div",{style:{color:x[2],fontSize:12,textAlign:"center"},children:[n," could not be played from ",i,". The file may be missing, or its codec may not be one this browser decodes."]}):t.jsx("video",{src:i,controls:!0,playsInline:!0,preload:"metadata",ref:l,onError:()=>a(!0),onLoadedMetadata:e=>l(e.currentTarget),style:{maxWidth:"100%",maxHeight:"100%",display:"block"}},i)})]})}export{H as VideoViewer};
@@ -1 +1 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{fz as C,bB as b,a7 as c,bD as g,bC as w,a6 as y,bz as j,db as S,bw as f,aM as v,fA as M,fB as z,bA as N,al as V}from"./index-Crsbhlhy.js";import{r as x}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";function T(){return e.jsxs("svg",{viewBox:"0 0 16 16",className:"volter-viewport-overlays-glyph","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M5.24 4.51 A5.3 5.3 0 1 1 11.89 11.16 A5.85 5.85 0 0 0 5.24 4.51 Z",fill:"currentColor"}),e.jsx("circle",{cx:"6.1",cy:"10.3",r:"4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"})]})}function D({label:r="Overlays",choices:p,master:l,glyph:t,word:h}){const[s,o]=x.useState(!1),i=x.useRef(null),m=p.some(n=>n.enabled),d=l?.enabled??m,u=t??e.jsx(c,{icon:d?M:z,size:"md"});x.useEffect(()=>{if(!s)return;const n=k=>{i.current&&!i.current.contains(k.target)&&o(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);const a=s?e.jsxs(C,{className:"volter-helpers-menu",onDismiss:()=>o(!1),children:[l?e.jsxs(e.Fragment,{children:[e.jsxs(b,{role:"menuitemcheckbox","aria-checked":l.enabled,onSelect:l.onToggle,children:[e.jsx("span",{className:"volter-menu-check",children:l.enabled&&e.jsx(c,{icon:g,size:"xs"})}),"Show ",r]}),e.jsx(w,{})]}):null,p.map(n=>e.jsxs(b,{role:"menuitemcheckbox","aria-checked":n.enabled,disabled:n.disabled,onSelect:n.onToggle,children:[e.jsx("span",{className:"volter-menu-check",children:n.enabled&&e.jsx(c,{icon:g,size:"xs"})}),n.label]},n.id))]}):null;return h!==void 0?e.jsxs("div",{ref:i,className:"volter-viewport-popover-anchor",children:[e.jsxs(y,{variant:"ghost",size:"comfortable","aria-label":`Choose ${r.toLowerCase()}`,"aria-expanded":s,onClick:()=>o(!s),children:[h,e.jsx(c,{icon:j,size:"xs"})]}),a]}):e.jsxs("div",{ref:i,className:"volter-viewport-popover-anchor",children:[l?e.jsxs(S,{children:[e.jsx(f,{text:`${r}: ${d?"On":"Off"}`,children:e.jsx(v,{"aria-label":`Toggle ${r.toLowerCase()}`,"aria-pressed":d,size:"comfortable",onClick:l.onToggle,children:u})}),e.jsx(v,{"aria-label":`Choose ${r.toLowerCase()}`,"aria-expanded":s,size:"comfortable",onClick:()=>o(!s),children:e.jsx(c,{icon:j,size:"xs"})})]}):e.jsx(f,{text:`${r}: ${d?"On":"Off"}`,children:e.jsx(v,{"aria-label":`Choose ${r.toLowerCase()}`,"aria-expanded":s,"aria-pressed":d,size:"comfortable",onClick:()=>o(!s),children:u})}),a]})}const O=[{mode:"solid",label:"Material",description:"Authored materials and lighting"},{mode:"clay",label:"Solid",description:"Neutral flat-shaded geometry"},{mode:"unlit",label:"Unlit",description:"Base color without scene lighting"},{mode:"wireframe",label:"Wireframe",description:"Renderable triangle edges"},{mode:"matcap",label:"Matcap",description:"Neutral clay sphere — form without color"},{mode:"normals",label:"Normals",description:"Surface-normal direction colors"},{mode:"overdraw",label:"Overdraw",description:"Additive overlap visualization"}],$={preview:"Material Preview",rendered:"Rendered",uv:"UV","vertex-colors":"Vertex Colors"},I=[{mode:"wireframe",glyph:"wireframe",label:"Wireframe"},{mode:"clay",glyph:"sphere",label:"Solid"},{mode:"solid",glyph:"preview",label:"Material"}];function G(r){return[{mode:"wireframe",glyph:"wireframe",label:"Wireframe"},{mode:"solid",glyph:"sphere",label:"Solid"},...r.has("preview")?[{mode:"preview",glyph:"preview",label:"Material Preview"}]:[],...r.has("rendered")?[{mode:"rendered",glyph:"rendered",label:"Rendered"}]:[]]}function E({glyph:r}){return e.jsxs("svg",{viewBox:"0 0 16 16",className:"volter-viewport-shading-glyph","aria-hidden":"true",focusable:"false",children:[r==="sphere"||r==="rendered"?e.jsx("circle",{cx:"8",cy:"8",r:"7.3",fill:"currentColor"}):e.jsx("circle",{cx:"8",cy:"8",r:"7.3",fill:"none",stroke:"currentColor",strokeWidth:"1.05"}),r==="wireframe"?e.jsxs("g",{stroke:"currentColor",strokeWidth:"1.05",children:[e.jsx("line",{x1:"1.7",y1:"5.4",x2:"14.3",y2:"5.4"}),e.jsx("line",{x1:"1.7",y1:"10.6",x2:"14.3",y2:"10.6"}),e.jsx("line",{x1:"5.4",y1:"1.7",x2:"5.4",y2:"14.3"})]}):null,r==="rendered"?e.jsx("circle",{cx:"5.6",cy:"5.6",r:"2.3",fill:"var(--volter-surface-overlay, #ffffff)",fillOpacity:"0.7"}):null,r==="preview"?e.jsx("path",{d:"M7.73 1.23 L7.73 10.43 L1.22 8.04 A6.78 6.78 0 0 1 7.73 1.23 Z",fill:"currentColor"}):null]})}function A({mode:r,onChange:p,choices:l,disabled:t=!1,segments:h,children:s}){const[o,i]=x.useState(!1),m=x.useRef(null),d=l.find(a=>a.mode===r)??l[0];if(!d)return null;const u=o&&!t?e.jsxs(N,{id:"volter-viewport-shading-menu",anchorRef:m,"aria-label":"Viewport shading modes",onDismiss:()=>i(!1),style:{minWidth:230},children:[l.map(a=>e.jsxs(b,{role:"menuitemradio","aria-checked":a.mode===r,onSelect:()=>{p(a.mode),i(!1)},style:{display:"grid",gridTemplateColumns:"14px 1fr",gap:7},children:[e.jsx("span",{style:{opacity:a.mode===r?1:0},children:e.jsx(c,{icon:g,size:"xs"})}),e.jsxs("span",{children:[e.jsx("span",{style:{display:"block"},children:a.label}),e.jsx("span",{style:{display:"block",color:V.content.dim,fontSize:10},children:a.description})]})]},a.mode)),s?e.jsxs(e.Fragment,{children:[e.jsx(w,{}),e.jsx("div",{className:"volter-viewport-shading-options",children:s})]}):null]}):null;return h?e.jsxs("div",{className:"volter-viewport-popover-anchor",children:[e.jsxs("span",{className:"volter-viewport-shading-segments",role:"group","aria-label":"Viewport shading",children:[h.map(a=>e.jsx(f,{text:`Viewport shading: ${a.label}`,children:e.jsx(v,{size:"compact",shape:"segment",variant:"secondary","aria-pressed":a.mode===r,"aria-label":`Viewport shading: ${a.label}`,disabled:t,onClick:()=>p(a.mode),children:e.jsx(E,{glyph:a.glyph})})},a.mode)),e.jsx(f,{text:"Shading options",children:e.jsx(v,{ref:m,size:"compact",shape:"segment",variant:"secondary","aria-label":"Shading options","aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?"volter-viewport-shading-menu":void 0,disabled:t,onClick:()=>i(a=>!a),children:e.jsx(c,{icon:j,size:"xs"})})})]}),u]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx(f,{text:`Viewport shading: ${d.label}`,children:e.jsxs(y,{ref:m,type:"button",size:"compact",variant:"secondary","aria-label":`Viewport shading: ${d.label}`,"aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?"volter-viewport-shading-menu":void 0,disabled:t,onClick:()=>i(a=>!a),style:{display:"inline-flex",alignItems:"center",gap:5,minWidth:66},children:[e.jsx("span",{children:d.label}),e.jsx(c,{icon:j,size:"xs"})]})}),u]})}function F({mode:r,onChange:p,disabled:l=!1,words:t}){const h=x.useMemo(()=>{const s=O.map(i=>({...i,label:t?.[i.mode]??i.label}));if(s.some(i=>i.mode===r))return s;const o=t?.[r]??$[r]??r;return[...s,{mode:r,label:o,description:"The mode this view is drawn in"}]},[t,r]);return e.jsx(A,{mode:r,onChange:p,choices:h,disabled:l})}export{A as V,I as a,D as b,T as c,F as d,G as p,O as v};
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{fz as C,bB as b,a7 as c,bD as g,bC as w,a6 as y,bz as j,db as S,bw as f,aM as v,fA as M,fB as z,bA as N,al as V}from"./index-DaRQxpdW.js";import{r as x}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";function T(){return e.jsxs("svg",{viewBox:"0 0 16 16",className:"volter-viewport-overlays-glyph","aria-hidden":"true",focusable:"false",children:[e.jsx("path",{d:"M5.24 4.51 A5.3 5.3 0 1 1 11.89 11.16 A5.85 5.85 0 0 0 5.24 4.51 Z",fill:"currentColor"}),e.jsx("circle",{cx:"6.1",cy:"10.3",r:"4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"})]})}function D({label:r="Overlays",choices:p,master:l,glyph:t,word:h}){const[s,o]=x.useState(!1),i=x.useRef(null),m=p.some(n=>n.enabled),d=l?.enabled??m,u=t??e.jsx(c,{icon:d?M:z,size:"md"});x.useEffect(()=>{if(!s)return;const n=k=>{i.current&&!i.current.contains(k.target)&&o(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);const a=s?e.jsxs(C,{className:"volter-helpers-menu",onDismiss:()=>o(!1),children:[l?e.jsxs(e.Fragment,{children:[e.jsxs(b,{role:"menuitemcheckbox","aria-checked":l.enabled,onSelect:l.onToggle,children:[e.jsx("span",{className:"volter-menu-check",children:l.enabled&&e.jsx(c,{icon:g,size:"xs"})}),"Show ",r]}),e.jsx(w,{})]}):null,p.map(n=>e.jsxs(b,{role:"menuitemcheckbox","aria-checked":n.enabled,disabled:n.disabled,onSelect:n.onToggle,children:[e.jsx("span",{className:"volter-menu-check",children:n.enabled&&e.jsx(c,{icon:g,size:"xs"})}),n.label]},n.id))]}):null;return h!==void 0?e.jsxs("div",{ref:i,className:"volter-viewport-popover-anchor",children:[e.jsxs(y,{variant:"ghost",size:"comfortable","aria-label":`Choose ${r.toLowerCase()}`,"aria-expanded":s,onClick:()=>o(!s),children:[h,e.jsx(c,{icon:j,size:"xs"})]}),a]}):e.jsxs("div",{ref:i,className:"volter-viewport-popover-anchor",children:[l?e.jsxs(S,{children:[e.jsx(f,{text:`${r}: ${d?"On":"Off"}`,children:e.jsx(v,{"aria-label":`Toggle ${r.toLowerCase()}`,"aria-pressed":d,size:"comfortable",onClick:l.onToggle,children:u})}),e.jsx(v,{"aria-label":`Choose ${r.toLowerCase()}`,"aria-expanded":s,size:"comfortable",onClick:()=>o(!s),children:e.jsx(c,{icon:j,size:"xs"})})]}):e.jsx(f,{text:`${r}: ${d?"On":"Off"}`,children:e.jsx(v,{"aria-label":`Choose ${r.toLowerCase()}`,"aria-expanded":s,"aria-pressed":d,size:"comfortable",onClick:()=>o(!s),children:u})}),a]})}const O=[{mode:"solid",label:"Material",description:"Authored materials and lighting"},{mode:"clay",label:"Solid",description:"Neutral flat-shaded geometry"},{mode:"unlit",label:"Unlit",description:"Base color without scene lighting"},{mode:"wireframe",label:"Wireframe",description:"Renderable triangle edges"},{mode:"matcap",label:"Matcap",description:"Neutral clay sphere — form without color"},{mode:"normals",label:"Normals",description:"Surface-normal direction colors"},{mode:"overdraw",label:"Overdraw",description:"Additive overlap visualization"}],$={preview:"Material Preview",rendered:"Rendered",uv:"UV","vertex-colors":"Vertex Colors"},I=[{mode:"wireframe",glyph:"wireframe",label:"Wireframe"},{mode:"clay",glyph:"sphere",label:"Solid"},{mode:"solid",glyph:"preview",label:"Material"}];function G(r){return[{mode:"wireframe",glyph:"wireframe",label:"Wireframe"},{mode:"solid",glyph:"sphere",label:"Solid"},...r.has("preview")?[{mode:"preview",glyph:"preview",label:"Material Preview"}]:[],...r.has("rendered")?[{mode:"rendered",glyph:"rendered",label:"Rendered"}]:[]]}function E({glyph:r}){return e.jsxs("svg",{viewBox:"0 0 16 16",className:"volter-viewport-shading-glyph","aria-hidden":"true",focusable:"false",children:[r==="sphere"||r==="rendered"?e.jsx("circle",{cx:"8",cy:"8",r:"7.3",fill:"currentColor"}):e.jsx("circle",{cx:"8",cy:"8",r:"7.3",fill:"none",stroke:"currentColor",strokeWidth:"1.05"}),r==="wireframe"?e.jsxs("g",{stroke:"currentColor",strokeWidth:"1.05",children:[e.jsx("line",{x1:"1.7",y1:"5.4",x2:"14.3",y2:"5.4"}),e.jsx("line",{x1:"1.7",y1:"10.6",x2:"14.3",y2:"10.6"}),e.jsx("line",{x1:"5.4",y1:"1.7",x2:"5.4",y2:"14.3"})]}):null,r==="rendered"?e.jsx("circle",{cx:"5.6",cy:"5.6",r:"2.3",fill:"var(--volter-surface-overlay, #ffffff)",fillOpacity:"0.7"}):null,r==="preview"?e.jsx("path",{d:"M7.73 1.23 L7.73 10.43 L1.22 8.04 A6.78 6.78 0 0 1 7.73 1.23 Z",fill:"currentColor"}):null]})}function A({mode:r,onChange:p,choices:l,disabled:t=!1,segments:h,children:s}){const[o,i]=x.useState(!1),m=x.useRef(null),d=l.find(a=>a.mode===r)??l[0];if(!d)return null;const u=o&&!t?e.jsxs(N,{id:"volter-viewport-shading-menu",anchorRef:m,"aria-label":"Viewport shading modes",onDismiss:()=>i(!1),style:{minWidth:230},children:[l.map(a=>e.jsxs(b,{role:"menuitemradio","aria-checked":a.mode===r,onSelect:()=>{p(a.mode),i(!1)},style:{display:"grid",gridTemplateColumns:"14px 1fr",gap:7},children:[e.jsx("span",{style:{opacity:a.mode===r?1:0},children:e.jsx(c,{icon:g,size:"xs"})}),e.jsxs("span",{children:[e.jsx("span",{style:{display:"block"},children:a.label}),e.jsx("span",{style:{display:"block",color:V.content.dim,fontSize:10},children:a.description})]})]},a.mode)),s?e.jsxs(e.Fragment,{children:[e.jsx(w,{}),e.jsx("div",{className:"volter-viewport-shading-options",children:s})]}):null]}):null;return h?e.jsxs("div",{className:"volter-viewport-popover-anchor",children:[e.jsxs("span",{className:"volter-viewport-shading-segments",role:"group","aria-label":"Viewport shading",children:[h.map(a=>e.jsx(f,{text:`Viewport shading: ${a.label}`,children:e.jsx(v,{size:"compact",shape:"segment",variant:"secondary","aria-pressed":a.mode===r,"aria-label":`Viewport shading: ${a.label}`,disabled:t,onClick:()=>p(a.mode),children:e.jsx(E,{glyph:a.glyph})})},a.mode)),e.jsx(f,{text:"Shading options",children:e.jsx(v,{ref:m,size:"compact",shape:"segment",variant:"secondary","aria-label":"Shading options","aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?"volter-viewport-shading-menu":void 0,disabled:t,onClick:()=>i(a=>!a),children:e.jsx(c,{icon:j,size:"xs"})})})]}),u]}):e.jsxs("div",{style:{position:"relative"},children:[e.jsx(f,{text:`Viewport shading: ${d.label}`,children:e.jsxs(y,{ref:m,type:"button",size:"compact",variant:"secondary","aria-label":`Viewport shading: ${d.label}`,"aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?"volter-viewport-shading-menu":void 0,disabled:t,onClick:()=>i(a=>!a),style:{display:"inline-flex",alignItems:"center",gap:5,minWidth:66},children:[e.jsx("span",{children:d.label}),e.jsx(c,{icon:j,size:"xs"})]})}),u]})}function F({mode:r,onChange:p,disabled:l=!1,words:t}){const h=x.useMemo(()=>{const s=O.map(i=>({...i,label:t?.[i.mode]??i.label}));if(s.some(i=>i.mode===r))return s;const o=t?.[r]??$[r]??r;return[...s,{mode:r,label:o,description:"The mode this view is drawn in"}]},[t,r]);return e.jsx(A,{mode:r,onChange:p,choices:h,disabled:l})}export{A as V,I as a,D as b,T as c,F as d,G as p,O as v};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/game-css-scope-transform-BA7ZbLSi.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-Crsbhlhy.js","assets/index-nmcBqr7Y.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"])))=>i.map(i=>d[i]);
2
- import{_ as se,lR as Fe,lS as He,lT as De,Z as P,lU as je,jg as ze,Q as Ne,ab as pe,jM as Be,b$ as W,c0 as O,c1 as q,c3 as We}from"./index-Crsbhlhy.js";import{GAME_SCENES_SHAPE as Oe}from"./game-contract-seams-C1m_P4SS.js";import{g as qe,c as Ue,d as Ve,e as Ke,S as Ye}from"./capability-coverage-CRqjvzDo.js";import{i as Qe,b as Je,l as Ze}from"./ingest-source-persistence-Bk9qLkTV.js";import{p as Xe}from"./contract-system-adapters-CborQejG.js";const rn="contain: layout; visibility: visible;";function ae(e){return typeof e=="boolean"?e:e?.capture??!1}const ie="volterScopedCss";let le=null;function et(){return le??=Promise.all([se(()=>import("./game-css-scope-transform-BA7ZbLSi.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),se(()=>import("./index-Crsbhlhy.js").then(e=>e.u2),__vite__mapDeps([2,3,1,4,5,6,7,8,9,10]))]).then(([{scopeGameCss:e},{GAME_CSS_SCOPE_SELECTOR:t}])=>n=>e({css:n,scopeSelector:t,styleSheetPath:"/"})),le}function tt(e){let t=null;const n=()=>et().then(i=>{t=i}),o=i=>{const g=i.textContent??"";if(g.length===0||i.dataset[ie]===g)return;if(!t){const y=g;i.textContent="",n().then(()=>{i.isConnected&&(i.textContent??"")===""&&(i.textContent=y,o(i))});return}let h;try{h=t(g)}catch{i.textContent="";return}i.dataset[ie]=h,i.textContent=h},a=i=>{if(i instanceof HTMLStyleElement)return i;const g=i.parentElement;return g instanceof HTMLStyleElement?g:null},u=new MutationObserver(i=>{const g=new Set;for(const h of i)if(h.type==="childList")for(const y of h.addedNodes){const w=a(y);if(w)g.add(w);else if(y instanceof Element)for(const d of y.querySelectorAll("style"))g.add(d)}else if(h.type==="characterData"){const y=a(h.target);y&&g.add(y)}for(const h of g)h.isConnected&&o(h)});u.observe(e,{childList:!0,subtree:!0,characterData:!0});for(const i of e.querySelectorAll("style"))o(i);return u}class nt{surfaceElement=null;injectedStyles=null;get surface(){return this.surfaceElement}set surface(t){this.injectedStyles?.disconnect(),this.injectedStyles=null,this.surfaceElement=t,t&&(this.injectedStyles=tt(t))}pageTitle="";executingClassicScript=null;headElement=null;resizeBus=new EventTarget;resizeListeners=new Map;addResizeListener(t,n){let o=this.resizeListeners.get(t);o||(o=new Set,this.resizeListeners.set(t,o)),o.add(ae(n)),this.resizeBus.addEventListener("resize",t,n)}removeResizeListener(t,n){const o=this.resizeListeners.get(t);o&&(o.delete(ae(n)),o.size===0&&this.resizeListeners.delete(t)),this.resizeBus.removeEventListener("resize",t,n)}get gameResizesItself(){return this.resizeListeners.size>0}reset(){this.headElement?.remove(),this.headElement=null,this.pageTitle="",this.executingClassicScript=null,this.surface=null,this.resizeListeners.clear(),this.resizeBus=new EventTarget}dispatchResize(){this.resizeBus.dispatchEvent(new Event("resize"))}viewport(){const t=this.surface;return t?{width:t.clientWidth,height:t.clientHeight}:null}get title(){return this.pageTitle}set title(t){this.pageTitle=String(t)}get currentScript(){return this.executingClassicScript}withCurrentScript(t,n){const o=this.executingClassicScript,a=document.createElement("script");a.src=t,this.executingClassicScript=a;try{return n()}finally{this.executingClassicScript=o}}head(){const t=this.surface;if(!t)return null;if(!this.headElement||this.headElement.parentElement!==t){const n=document.createElement("div");n.dataset.volterGameHead="",n.hidden=!0,t.prepend(n),this.headElement=n}return this.headElement}}function rt(e){const t=`(__volterHost.__volterGameRealm?__volterHost.__volterGameRealm(${JSON.stringify("")}):null)`;return ot.replace("__VOLTER_REALM__",t)}const ot=`const __volterHost=({}).constructor.constructor('return globalThis')(),__volterR=__VOLTER_REALM__,__volterGlobal=((__volterR&&__volterR.globalThis)||__volterHost.__volterGameWindow||__volterHost),globalThis=__volterGlobal,__volterSched=((__volterR&&__volterR.timers)||__volterHost.__volterGameTimers||__volterHost),__volterBind=function(n){var f=__volterSched[n];return typeof f==='function'?f.bind(__volterSched):f;},console=((__volterR&&__volterR.console)||__volterHost.__volterGameConsole||__volterHost.console),window=((__volterR&&__volterR.window)||__volterHost.__volterGameWindow||__volterGlobal.window),document=((__volterR&&__volterR.document)||__volterHost.__volterGameDocument||__volterGlobal.document),__volterWindowBind=function(n){var f=window&&window[n];return typeof f==='function'?f.bind(window):f;},localStorage=(window&&window.localStorage),sessionStorage=(window&&window.sessionStorage),location=(window&&window.location),addEventListener=__volterWindowBind('addEventListener'),removeEventListener=__volterWindowBind('removeEventListener'),dispatchEvent=__volterWindowBind('dispatchEvent'),fetch=function(){var f=__volterHost.__volterProjectFetch;return f?f.apply(null,arguments):__volterHost.fetch.apply(__volterHost,arguments)},setTimeout=__volterBind('setTimeout'),clearTimeout=__volterBind('clearTimeout'),setInterval=__volterBind('setInterval'),clearInterval=__volterBind('clearInterval'),requestAnimationFrame=__volterBind('requestAnimationFrame'),cancelAnimationFrame=__volterBind('cancelAnimationFrame');
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/game-css-scope-transform-BJCqOoR0.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-DaRQxpdW.js","assets/index-nmcBqr7Y.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"])))=>i.map(i=>d[i]);
2
+ import{_ as se,lR as Fe,lS as He,lT as De,Z as P,lU as je,jg as ze,Q as Ne,ab as pe,jM as Be,b$ as W,c0 as O,c1 as q,c3 as We}from"./index-DaRQxpdW.js";import{GAME_SCENES_SHAPE as Oe}from"./game-contract-seams-CkWXZKBr.js";import{g as qe,c as Ue,d as Ve,e as Ke,S as Ye}from"./capability-coverage-CKk539ZB.js";import{i as Qe,b as Je,l as Ze}from"./ingest-source-persistence-BhLgFaNT.js";import{p as Xe}from"./contract-system-adapters-CXVtEEG9.js";const rn="contain: layout; visibility: visible;";function ae(e){return typeof e=="boolean"?e:e?.capture??!1}const ie="volterScopedCss";let le=null;function et(){return le??=Promise.all([se(()=>import("./game-css-scope-transform-BJCqOoR0.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),se(()=>import("./index-DaRQxpdW.js").then(e=>e.u2),__vite__mapDeps([2,3,1,4,5,6,7,8,9,10]))]).then(([{scopeGameCss:e},{GAME_CSS_SCOPE_SELECTOR:t}])=>n=>e({css:n,scopeSelector:t,styleSheetPath:"/"})),le}function tt(e){let t=null;const n=()=>et().then(i=>{t=i}),o=i=>{const g=i.textContent??"";if(g.length===0||i.dataset[ie]===g)return;if(!t){const y=g;i.textContent="",n().then(()=>{i.isConnected&&(i.textContent??"")===""&&(i.textContent=y,o(i))});return}let h;try{h=t(g)}catch{i.textContent="";return}i.dataset[ie]=h,i.textContent=h},a=i=>{if(i instanceof HTMLStyleElement)return i;const g=i.parentElement;return g instanceof HTMLStyleElement?g:null},u=new MutationObserver(i=>{const g=new Set;for(const h of i)if(h.type==="childList")for(const y of h.addedNodes){const w=a(y);if(w)g.add(w);else if(y instanceof Element)for(const d of y.querySelectorAll("style"))g.add(d)}else if(h.type==="characterData"){const y=a(h.target);y&&g.add(y)}for(const h of g)h.isConnected&&o(h)});u.observe(e,{childList:!0,subtree:!0,characterData:!0});for(const i of e.querySelectorAll("style"))o(i);return u}class nt{surfaceElement=null;injectedStyles=null;get surface(){return this.surfaceElement}set surface(t){this.injectedStyles?.disconnect(),this.injectedStyles=null,this.surfaceElement=t,t&&(this.injectedStyles=tt(t))}pageTitle="";executingClassicScript=null;headElement=null;resizeBus=new EventTarget;resizeListeners=new Map;addResizeListener(t,n){let o=this.resizeListeners.get(t);o||(o=new Set,this.resizeListeners.set(t,o)),o.add(ae(n)),this.resizeBus.addEventListener("resize",t,n)}removeResizeListener(t,n){const o=this.resizeListeners.get(t);o&&(o.delete(ae(n)),o.size===0&&this.resizeListeners.delete(t)),this.resizeBus.removeEventListener("resize",t,n)}get gameResizesItself(){return this.resizeListeners.size>0}reset(){this.headElement?.remove(),this.headElement=null,this.pageTitle="",this.executingClassicScript=null,this.surface=null,this.resizeListeners.clear(),this.resizeBus=new EventTarget}dispatchResize(){this.resizeBus.dispatchEvent(new Event("resize"))}viewport(){const t=this.surface;return t?{width:t.clientWidth,height:t.clientHeight}:null}get title(){return this.pageTitle}set title(t){this.pageTitle=String(t)}get currentScript(){return this.executingClassicScript}withCurrentScript(t,n){const o=this.executingClassicScript,a=document.createElement("script");a.src=t,this.executingClassicScript=a;try{return n()}finally{this.executingClassicScript=o}}head(){const t=this.surface;if(!t)return null;if(!this.headElement||this.headElement.parentElement!==t){const n=document.createElement("div");n.dataset.volterGameHead="",n.hidden=!0,t.prepend(n),this.headElement=n}return this.headElement}}function rt(e){const t=`(__volterHost.__volterGameRealm?__volterHost.__volterGameRealm(${JSON.stringify("")}):null)`;return ot.replace("__VOLTER_REALM__",t)}const ot=`const __volterHost=({}).constructor.constructor('return globalThis')(),__volterR=__VOLTER_REALM__,__volterGlobal=((__volterR&&__volterR.globalThis)||__volterHost.__volterGameWindow||__volterHost),globalThis=__volterGlobal,__volterSched=((__volterR&&__volterR.timers)||__volterHost.__volterGameTimers||__volterHost),__volterBind=function(n){var f=__volterSched[n];return typeof f==='function'?f.bind(__volterSched):f;},console=((__volterR&&__volterR.console)||__volterHost.__volterGameConsole||__volterHost.console),window=((__volterR&&__volterR.window)||__volterHost.__volterGameWindow||__volterGlobal.window),document=((__volterR&&__volterR.document)||__volterHost.__volterGameDocument||__volterGlobal.document),__volterWindowBind=function(n){var f=window&&window[n];return typeof f==='function'?f.bind(window):f;},localStorage=(window&&window.localStorage),sessionStorage=(window&&window.sessionStorage),location=(window&&window.location),addEventListener=__volterWindowBind('addEventListener'),removeEventListener=__volterWindowBind('removeEventListener'),dispatchEvent=__volterWindowBind('dispatchEvent'),fetch=function(){var f=__volterHost.__volterProjectFetch;return f?f.apply(null,arguments):__volterHost.fetch.apply(__volterHost,arguments)},setTimeout=__volterBind('setTimeout'),clearTimeout=__volterBind('clearTimeout'),setInterval=__volterBind('setInterval'),clearInterval=__volterBind('clearInterval'),requestAnimationFrame=__volterBind('requestAnimationFrame'),cancelAnimationFrame=__volterBind('cancelAnimationFrame');
3
3
  `,on=rt(),st=new Set(["href","protocol","host","hostname","port","pathname","search"]),at=new Set(["assign","replace","reload"]),it=new Set(["play","project","hub","scene","ingest","create-from","checkout_id"]);function lt(e){return it.has(e)||e.startsWith("volter")}function _e(e){const t=e.startsWith("?")?e.slice(1):e;if(!t)return"";const n=new URLSearchParams;for(const[a,u]of new URLSearchParams(t))lt(a)||n.append(a,u);const o=n.toString();return o.length>0?`?${o}`:""}function ct(e){try{const t=new URL(e);return t.search=_e(t.search),t.href}catch{return e}}function ut(e,t,n){const o=Object.create(null);return new Proxy(o,{get(a,u){if(typeof u=="string"&&at.has(u))return(...g)=>{u==="reload"&&n?.reloadGame?.()||t(`location.${u}(${g.map(h=>String(h)).join(", ")})`)};if(u==="search")return _e(String(Reflect.get(e,"search")??""));if(u==="href")return ct(String(Reflect.get(e,"href")??""));const i=Reflect.get(e,u);return typeof i=="function"?i.bind(e):i},set(a,u,i){return typeof u=="string"&&st.has(u)?(t(`location.${u} = ${String(i)}`),!0):Reflect.set(e,u,i)},has(a,u){return Reflect.has(e,u)}})}function dt(e){return`Ingested game attempted to navigate the editor away (${e}) — refused. A game running in-realm shares the editor's document, so leaving it would take the whole session with it; game code sees a scoped \`location\` facade whose reads pass through and whose navigating writes do not (packages/editor-game/src/host/game-location-guard.ts).`}function ft(e){let t=0,n=0;const o=Object.create(Object.getPrototypeOf(e)),a=w=>(t+=1,e.getItem(String(w))),u=(w,d)=>{n+=1,e.setItem(String(w),String(d))},i=w=>{n+=1,e.removeItem(String(w))},g=()=>{n+=1,e.clear()},h=w=>(t+=1,e.key(Number(w)));return{storage:new Proxy(o,{get(w,d){return d==="length"?(t+=1,e.length):d==="getItem"?a:d==="setItem"?u:d==="removeItem"?i:d==="clear"?g:d==="key"?h:d===Symbol.toStringTag?"Storage":typeof d=="string"?a(d)??void 0:Reflect.get(o,d,o)},set(w,d,p){return typeof d!="string"?Reflect.set(o,d,p,o):(u(d,String(p)),!0)},deleteProperty(w,d){return typeof d!="string"?Reflect.deleteProperty(o,d):(i(d),!0)},defineProperty(w,d,p){return typeof d!="string"||!("value"in p)?!1:(u(d,String(p.value)),!0)},has(w,d){return typeof d!="string"?Reflect.has(o,d):d in o?!0:a(d)!==null},ownKeys(){const w=[];for(let d=0;d<e.length;d+=1){const p=e.key(d);p!==null&&w.push(p)}return w},getOwnPropertyDescriptor(w,d){if(typeof d!="string")return;const p=e.getItem(d);return p===null?void 0:{configurable:!0,enumerable:!0,value:p,writable:!0}}}),stats:()=>({reads:t,writes:n})}}function mt(e){return!e||e.loop!=="gated"&&e.loop!=="self-driven"?null:{verdict:e.loop,evidence:e.evidence}}function gt(e){let t="open",n=0,o=0,a=0,u=0,i=0,g=0,h=0,y=0,w=!1;const d=[],p=new Set,T=new Set,I=new Set,S=new Map,A=()=>(t==="held"?h:e.now())-y,c=m=>{a++,t==="held"&&u++;try{m.run()}catch(_){e.setTimeout(()=>{throw _},0)}},f=()=>{const m=d.splice(0,d.length);S.clear();for(const _ of m)c(_)},s=m=>{d.push(m)},r=m=>()=>{if(t==="held"){s(m);return}c(m)},l=()=>{t!=="held"&&(h=e.now(),t="held")},v=()=>{t==="held"&&(y+=e.now()-h)};return{schedulers:{setTimeout(m,_,...E){if(o++,w)return-1;const R={run:()=>m(...E)};let L=-1;const C=r(R);return L=e.setTimeout(()=>{p.delete(L),C()},_),p.add(L),R.timerId=L,L},clearTimeout(m){e.clearTimeout(m),p.delete(m);const _=d.findIndex(E=>E.timerId===m);_!==-1&&d.splice(_,1)},setInterval(m,_,...E){if(o++,w)return-1;let R=-1;const L=()=>{const C={run:()=>m(...E)};if(t==="held"){const re=S.get(R);if(re){const oe=d.indexOf(re);oe!==-1&&d.splice(oe,1)}S.set(R,C),s(C);return}c(C)};return R=e.setInterval(L,_),T.add(R),R},clearInterval(m){e.clearInterval(m),T.delete(m);const _=S.get(m);if(_){S.delete(m);const E=d.indexOf(_);E!==-1&&d.splice(E,1)}},requestAnimationFrame(m){if(o++,w)return-1;const _={run:()=>m(A())};let E=-1;const R=r(_);return E=e.requestAnimationFrame(()=>{I.delete(E),R()}),I.add(E),_.frameId=E,E},cancelAnimationFrame(m){e.cancelAnimationFrame(m),I.delete(m);const _=d.findIndex(E=>E.frameId===m);_!==-1&&d.splice(_,1)}},hold:l,release(){w||(v(),t="open",f())},step(m=1){if(!w){for(v(),n=m>0?m:1,t="step";n>0&&d.length>0;)n--,f();t="held",h=e.now()}},stats(){return{mode:t,pending:d.length,requests:o,fired:a,firedWhileHeld:u,activeTimeouts:p.size,activeIntervals:T.size,activeAnimationFrames:I.size,input:i,inputBlocked:g}},recordInput(m){i++,m&&g++},dispose(){if(w)return{timeouts:0,intervals:0,animationFrames:0,parkedCallbacks:0};w=!0;const m={timeouts:p.size,intervals:T.size,animationFrames:I.size,parkedCallbacks:d.length};for(const _ of p)e.clearTimeout(_);for(const _ of T)e.clearInterval(_);for(const _ of I)e.cancelAnimationFrame(_);return p.clear(),T.clear(),I.clear(),d.length=0,S.clear(),n=0,t="held",h=e.now(),m}}}async function sn(e){const t=e.windowMs??1500,n=Math.max(1,Math.min(e.sampleMs??50,t)),o=e.sleep??(T=>new Promise(I=>setTimeout(I,T))),a=e.gate;if(!a)return{loop:"self-driven",reason:"no same-realm loop gate is installed, so nothing here controls this game’s scheduling",evidence:{pendingWhileHeld:0,firedWhileHeld:0,progressBefore:0,progressAfter:0,windowMs:t}};const u=a.stats(),i=e.progress();let g=u,h=i,y=u.pending,w=u.mode==="held";for(let T=0;T<t;T+=n)if(await o(Math.min(n,t-T)),g=a.stats(),h=e.progress(),y=Math.max(y,g.pending),g.mode!=="held"){w=!1;break}const d=g.firedWhileHeld-u.firedWhileHeld,p={pendingWhileHeld:y,firedWhileHeld:d,progressBefore:i,progressAfter:h,windowMs:t};return!w||g.mode!=="held"?{loop:"unmeasured",reason:"the gate was not held for the whole probe window — something else released it, so control was not measured",evidence:p}:d>0?{loop:"self-driven",reason:`${d} gated callback(s) ran while the gate was held — the gate leaked, so it cannot claim control`,evidence:p}:h>i?{loop:"self-driven",reason:`the game kept rendering while its scheduling was withheld (frame ${i} → ${h} in ${t}ms) — something outside this gate drives its loop`,evidence:p}:y===0?{loop:"unmeasured",reason:"nothing was due while the gate was held, so it withheld nothing and the probe learned nothing about this loop — note a hidden or backgrounded tab schedules no frames at all, which is a fact about the TAB, never about the game",evidence:p}:{loop:"gated",reason:`verified: ${y} scheduled callback(s) withheld, none ran, and no frame advanced in ${t}ms of held time`,evidence:p}}let U=null;function ht(){return U}const z=new Set(["keydown","keyup","keypress","mousedown","mouseup","mousemove","click","dblclick","contextmenu","wheel","pointerdown","pointerup","pointermove","pointercancel","touchstart","touchmove","touchend","touchcancel"]);function Se(e){const t=new Set,n=new WeakSet,o=((a,u)=>{const i=vt(a,u),g=yt(a,u);if(e()){for(const y of i)t.add(y);for(const y of g)t.delete(y);return!1}if(n.has(u))return!1;let h=!1;for(const y of g)t.delete(y)&&(h=!0);return h&&n.add(u),!h});return o.outstandingReleases=()=>{const a=[];for(const u of t){const i=u.indexOf(":"),g=u.slice(0,i),h=u.slice(i+1);g==="key"?a.push(new KeyboardEvent("keyup",{code:h,key:wt(h),bubbles:!0})):g==="mouse"?a.push(new MouseEvent("mouseup",{button:Number(h),bubbles:!0})):g==="pointer"&&typeof PointerEvent=="function"&&a.push(new PointerEvent("pointerup",{pointerId:Number(h),bubbles:!0}))}return a},o}function wt(e){const t=/^Key([A-Z])$/.exec(e);if(t)return t[1].toLowerCase();const n=/^Digit(\d)$/.exec(e);return n?n[1]:e==="Space"?" ":e}function be(e){const t=e.changedTouches;return t?Array.from(t,n=>`touch:${n.identifier}`):["touch"]}function vt(e,t){switch(e){case"keydown":return[`key:${t.code}`];case"mousedown":return[`mouse:${t.button}`];case"pointerdown":return[`pointer:${t.pointerId}`];case"touchstart":return be(t);default:return[]}}function yt(e,t){switch(e){case"keyup":return[`key:${t.code}`];case"mouseup":return[`mouse:${t.button}`];case"pointerup":case"pointercancel":return[`pointer:${t.pointerId}`];case"touchend":case"touchcancel":return be(t);default:return[]}}const Ee=new Set(["setTimeout","clearTimeout","setInterval","clearInterval","requestAnimationFrame","cancelAnimationFrame"]);function Re(e,t){return typeof e!="function"||Object.hasOwn(e,"prototype")?e:e.bind(t)}const k="",F=new Map,V=new Map,H=new Map,ce=new WeakMap;function K(e){let t=H.get(e);return t||(t=new nt,H.set(e,t)),t}function an(e,t=k){const n=K(t);return n.surface=e,n}function ln(e=k){H.get(e)?.reset()}function cn(e=k){return K(e)}function un(){const e=[];for(const[t,n]of H)n.surface&&e.push({surface:n.surface,gate:Te(t)});return e}function Te(e){return()=>Fe()&&(V.get(e)??(()=>!0))()}function pt(e,t){const n=Te(e);return()=>t.alive&&n()}const M=[];function _t(){return M[M.length-1]??null}De(_t);function $(e,t){M.push(e);try{return t()}finally{M.pop()}}function St(e,t){return{setTimeout(n,o,...a){return t.setTimeout((...u)=>$(e,()=>n(...u)),o,...a)},clearTimeout:n=>t.clearTimeout(n),setInterval(n,o,...a){return t.setInterval((...u)=>$(e,()=>n(...u)),o,...a)},clearInterval:n=>t.clearInterval(n),requestAnimationFrame(n){return t.requestAnimationFrame(o=>$(e,()=>n(o)))},cancelAnimationFrame:n=>t.cancelAnimationFrame(n)}}function bt(e){const t=new Map;return new Proxy(console,{get(n,o){const a=Reflect.get(n,o,n);if(typeof a!="function")return a;let u=t.get(o);return u||(u=(...i)=>$(e,()=>a.apply(n,i)),t.set(o,u)),u}})}function ue(e){let t=!1,n=null;return()=>{if(t)return n;t=!0;try{n=ft(window[e])}catch{n=null}return n}}let Ie=null;function Et(e){Ie=e}let Pe=null;function Rt(e){const t={alive:!0},n=new Map,o=pt(e,t),a=gt({setTimeout:(S,A)=>window.setTimeout(S,A),clearTimeout:S=>window.clearTimeout(S),setInterval:(S,A)=>window.setInterval(S,A),clearInterval:S=>window.clearInterval(S),requestAnimationFrame:S=>window.requestAnimationFrame(S),cancelAnimationFrame:S=>window.cancelAnimationFrame(S),now:()=>performance.now()}),u=new WeakSet,i=(S,A)=>{u.has(S)||(u.add(S),a.recordInput?.(A))};e===k&&(Pe=a);const g=K(e),h=St(e,a.schedulers),y=ue("localStorage"),w=ue("sessionStorage");let d,p;const T=me(de(window,()=>!0,{page:g,role:"window"}),o,{execute:S=>$(e,S),realmId:e,recordInput:i,role:"window",schedulers:h,self:()=>d,document:()=>p,localStorage:y,sessionStorage:w,isolateExpandos:!0});d=T.proxy;const I=me(de(document,()=>!0,{page:g,role:"document"}),o,{execute:S=>$(e,S),realmId:e,recordInput:i,role:"document",self:()=>d});return p=I.proxy,{moduleUrls:n,live:t,loop:a,document:I,localStorage:y,sessionStorage:w,window:T,public:{recordModuleUrl(S){t.alive&&n.set(new URL(S).pathname,S)},console:bt(e),document:p,globalThis:d,timers:h,window:d}}}function Y(e=k){let t=F.get(e);return t||(t=Rt(e),F.set(e,t)),t.public}function Tt(e){return[...F.get(e)?.moduleUrls.values()??[]]}function dn(e){const t=F.get(e);if(!t)return null;const n={reads:0,writes:0};return{globals:t.window.expandoCount(),mountId:e,loop:t.loop.stats(),listeners:{document:t.document.count(),window:t.window.count()},storage:{local:t.localStorage()?.stats()??n,session:t.sessionStorage()?.stats()??n}}}function It(e=k){V.delete(e),H.get(e)?.reset(),e!==k&&H.delete(e);const n=F.get(e);if(!n)return{mountId:e,listeners:0,timers:{timeouts:0,intervals:0,animationFrames:0,parkedCallbacks:0}};F.delete(e),n.moduleUrls.clear(),n.live.alive=!1;const o=n.document.dispose()+n.window.dispose(),a=n.loop.dispose?.()??{timeouts:0,intervals:0,animationFrames:0,parkedCallbacks:0};return e===k&&Ce(),{mountId:e,listeners:o,timers:a}}function fn(e,t=k){V.set(t,e)}function de(e,t,n){const o=new Map,a=Se(t),u=()=>n?.page.surface??null,i=()=>n?.role==="window"&&n.page.surface?n.page:null,g=(c,f,s)=>{const r=i();if(r&&c==="resize"&&f!==null){r.addResizeListener(f,s);return}if((c==="load"||c==="DOMContentLoaded"||c==="pageshow")&&f!==null&&document.readyState==="complete"){window.setTimeout(()=>{const l=new Event(c);typeof f=="function"?f.call(p,l):f.handleEvent(l)},0);return}if(z.has(c)&&f!==null){let l=o.get(c);l||(l=new Map,o.set(c,l));const v=f;let b=l.get(v);b||(b=function(m){if(!a(c,m))return typeof v=="function"?v.call(this,m):v.handleEvent(m)},l.set(v,b)),e.addEventListener(c,b,s);return}e.addEventListener(c,f,s)},h=(c,f,s)=>{const r=i();if(r&&c==="resize"&&f!==null){r.removeResizeListener(f,s);return}if(z.has(c)&&f!==null){const l=o.get(c),v=l?.get(f);if(v){l?.delete(f),e.removeEventListener(c,v,s);return}}e.removeEventListener(c,f,s)},y=new WeakMap,w=c=>{if(typeof c!="string"||!c.startsWith("on"))return null;const f=c.slice(2);return z.has(f)?f:null},d=c=>{console.error(dt(c))};let p;const T=()=>{const c=Reflect.get(e,"location",e);if(!c||!n)return null;const f=ce.get(n.page);if(f?.source===c)return{value:f.view};const s=ut(c,d,{reloadGame:()=>{const r=Ie;return r?(r(),!0):!1}});return ce.set(n.page,{source:c,view:s}),{value:s}},I=c=>{const f=i();if(!f)return null;if(c==="window"||c==="self"||c==="top"||c==="parent")return{value:p};if(c!=="innerWidth"&&c!=="outerWidth"&&c!=="innerHeight"&&c!=="outerHeight")return null;const s=f.viewport();return s?c==="innerWidth"||c==="outerWidth"?{value:s.width}:c==="innerHeight"||c==="outerHeight"?{value:s.height}:null:null},S=c=>{if(!n)return null;if(c==="location")return T();if(n.role==="document"){const f=u();if(f&&(c==="body"||c==="documentElement"))return{value:f};if(f&&c==="head")return{value:n.page.head()};if(f&&c==="title")return{value:n.page.title};if(f&&c==="currentScript")return{value:n.page.currentScript};if(f&&c==="activeElement"){const s=Reflect.get(e,"activeElement",e);return{value:s&&f.contains(s)?s:f}}}return I(c)},A=c=>{if(n?.role!=="document"||typeof c!="string")return;const f=u();if(!f)return;const s=e;if(c==="querySelector")return r=>r.trim().toLowerCase()==="head"?n.page.head():f.matches(r)?f:f.querySelector(r);if(c==="querySelectorAll")return f.querySelectorAll.bind(f);if(c==="getElementById")return r=>{const l=s.getElementById(r);return l&&f.contains(l)?l:null};if(c==="getElementsByClassName")return f.getElementsByClassName.bind(f);if(c==="getElementsByTagName")return r=>{if(r.toLowerCase()!=="head")return f.getElementsByTagName(r);const l=n.page.head();return l?Object.assign([l],{item:v=>v===0?l:null,namedItem:v=>l.id===v?l:null}):[]};if(c==="elementFromPoint"||c==="elementsFromPoint")return(r,l)=>{const v=f.getBoundingClientRect(),m=s[c].bind(s)(r+v.left,l+v.top);return Array.isArray(m)?m.filter(_=>f.contains(_)):m&&f.contains(m)?m:null}};return p=new Proxy(e,{get(c,f){if(f==="addEventListener")return g;if(f==="removeEventListener")return h;const s=S(f);if(s)return s.value;const r=A(f);if(r)return r;if(typeof f=="string"&&Ee.has(f)){const v=U;if(v)return v.schedulers[f]}const l=Reflect.get(c,f,c);return typeof l!="function"?l:y.get(l)??Re(l,c)},set(c,f,s){if(f==="location"&&n)return d(`${n.role}.location = ${String(s)}`),!0;if(n?.role==="document"&&f==="title"&&n.page.surface)return n.page.title=String(s),!0;if(w(f)!==null&&typeof s=="function"){const l=s,v=function(b){if(t())return l.call(this,b)};return y.set(v,l),Reflect.set(c,f,v,c)}if(f==="onload"&&typeof s=="function"&&document.readyState==="complete"){const l=s;return window.setTimeout(()=>l.call(p,new Event("load")),0),!0}return Reflect.set(c,f,s,c)}}),p}function fe(e){return typeof e=="boolean"?e:e?.capture??!1}function me(e,t,n){const o=n.execute??(s=>s()),a=[],u=Se(t);let i=!1,g=!1;const h=s=>{if(g)return;g=!0;const r=n.realmId?`"${n.realmId}"`:"the default realm";console.warn(`volter: a stopped game tried to register ${s} on its ${n.role} after its realm (${r}) was reclaimed; refused. Later refusals in this generation are silent.`)},y=new Map,w=new Map,d=new WeakMap;let p;const T=s=>n.role==="window"&&n.self&&(s===e||typeof window<"u"&&s===window)?n.self():n.document&&(s===n.document()||typeof document<"u"&&s===document)?n.document():s,I=s=>{const r=d.get(s);if(r)return r;const l=new Proxy(s,{get(v,b){if(b==="currentTarget")return p;if(b==="target"||b==="srcElement"){const _=Reflect.get(v,b,v);return _===v.currentTarget?p:T(_)}if(b==="view")return T(Reflect.get(v,b,v));if(b==="composedPath")return()=>v.composedPath().map(T);const m=Reflect.get(v,b,v);return typeof m=="function"?m.bind(v):m}});return d.set(s,l),l},S=s=>{const r=a.indexOf(s);r!==-1&&a.splice(r,1),e.removeEventListener(s.type,s.actual,s.capture),s.abort?.signal.removeEventListener("abort",s.abort.handler)},A=(s,r,l)=>{if(r===null)return;if(i){h(`a "${s}" listener`);return}const v=fe(l),b=l&&typeof l!="boolean"?l.signal:void 0;if(b?.aborted||a.some(R=>R.type===s&&R.original===r&&R.capture===v))return;let m;const _=function(R){if(l&&typeof l!="boolean"&&l.once){const C=a.indexOf(m);C!==-1&&a.splice(C,1),m.abort?.signal.removeEventListener("abort",m.abort.handler)}if(z.has(s)){const C=u(s,R);if(n.recordInput?.(R,C),C)return}const L=I(R);return o(()=>typeof r=="function"?r.call(p,L):r.handleEvent(L))},E=()=>S(m);m={type:s,original:r,actual:_,capture:v,...b?{abort:{signal:b,handler:E}}:{}},a.push(m),e.addEventListener(s,_,l),b?.addEventListener("abort",E,{once:!0}),(s==="load"||s==="DOMContentLoaded"||s==="pageshow")&&document.readyState==="complete"&&window.setTimeout(()=>{!i&&a.includes(m)&&_.call(e,new Event(s))},0)},c=(s,r,l)=>{if(r===null)return;const v=fe(l),b=a.find(m=>m.type===s&&m.original===r&&m.capture===v);b?S(b):e.removeEventListener(s,r,l)},f=s=>typeof s=="string"&&s.startsWith("on")&&s.length>2?s.slice(2):null;return p=new Proxy(e,{get(s,r){if(r==="addEventListener")return A;if(r==="removeEventListener")return c;const l=w.get(r);if(l)return l.original;if(n.self&&(n.role==="window"&&(r==="window"||r==="self"||r==="frames"||r==="top"||r==="parent")||n.role==="document"&&r==="defaultView"))return n.self();if(n.role==="window"&&r==="document"&&n.document)return n.document();if(n.role==="window"&&r==="globalThis"&&n.self)return n.self();if(n.role==="window"&&r==="localStorage"&&n.localStorage)return n.localStorage()?.storage;if(n.role==="window"&&r==="sessionStorage"&&n.sessionStorage)return n.sessionStorage()?.storage;if(typeof r=="string"&&Ee.has(r)&&n.schedulers)return n.schedulers[r];const v=y.get(r);if(v)return v.get?v.get.call(p):v.value;const b=Reflect.get(s,r,s);return typeof b!="function"?b:Re(b,s)},set(s,r,l){if(r==="location")return Reflect.set(s,r,l,s);if(n.role==="window"&&(r==="document"||r==="globalThis"||r==="localStorage"||r==="sessionStorage"))return!0;const v=f(r);if(v){if(i)return h(`an "${String(r)}" handler`),!0;const b=w.get(r);if(b&&(e.removeEventListener(b.type,b.actual),w.delete(r)),typeof l!="function")return!0;const m=l,_=(v==="load"||v==="DOMContentLoaded"||v==="pageshow")&&document.readyState==="complete",E=function(R){if(z.has(v)){const C=u(v,R);if(n.recordInput?.(R,C),C)return}const L=o(()=>m.call(p,I(R)));return L===!1&&R.preventDefault(),L};return w.set(r,{type:v,original:m,actual:E}),e.addEventListener(v,E),_&&window.setTimeout(()=>{!i&&w.get(r)?.actual===E&&E.call(e,new Event(v))},0),!0}return n.isolateExpandos?(y.set(r,{configurable:!0,enumerable:!0,value:l,writable:!0}),!0):Reflect.set(s,r,l,s)},defineProperty(s,r,l){return n.isolateExpandos?Reflect.getOwnPropertyDescriptor(s,r)?.configurable===!1?!1:(y.set(r,{...l,configurable:!0,enumerable:l.enumerable??!0}),!0):Reflect.defineProperty(s,r,l)},deleteProperty(s,r){return y.delete(r)?!0:n.isolateExpandos?Reflect.getOwnPropertyDescriptor(s,r)?.configurable!==!1:Reflect.deleteProperty(s,r)},has(s,r){return y.has(r)||Reflect.has(s,r)},ownKeys(s){const r=new Set(Reflect.ownKeys(s));for(const l of y.keys())typeof l!="number"&&r.add(l);return[...r]},getOwnPropertyDescriptor(s,r){const l=Reflect.getOwnPropertyDescriptor(s,r);return l?.configurable===!1?l:y.get(r)??l}}),{proxy:p,count:()=>a.length+w.size,expandoCount:()=>y.size,dispose(){for(const r of u.outstandingReleases()){for(const l of[...a])l.type===r.type&&l.actual.call(p,r);for(const l of w.values())l.type===r.type&&l.actual.call(p,r)}i=!0;const s=a.length+w.size;for(const r of[...a])S(r);for(const r of w.values())e.removeEventListener(r.type,r.actual);return w.clear(),y.clear(),s}}}let B=!1;function Ce(){if(!B)return;const e=globalThis,t=Y();U=Pe,e.__volterGameTimers=t.timers,e.__volterGameWindow=t.window,e.__volterGameDocument=t.document,e.__volterGameConsole=t.console}function mn(){if(B||typeof window>"u"||typeof document>"u")return;B=!0;const e=globalThis;He(),e.__volterGameModuleUrls=Tt,e.__volterGameRealm=t=>(M.push(t),queueMicrotask(()=>{const n=M.lastIndexOf(t);n>=0&&M.splice(n,1)}),Y(t)),Ce()}function Q(e,t){const n=It(e),o=n.timers.timeouts+n.timers.intervals+n.timers.animationFrames+n.timers.parkedCallbacks;if(n.listeners===0&&o===0)return;const a=[];n.listeners>0&&a.push(`${n.listeners} window/document listener${n.listeners===1?"":"s"}`),o>0&&a.push(`${o} timer/frame callback${o===1?"":"s"}`),P.logStructured("warn",`${t} stopped without releasing ${a.join(" and ")}; the editor reclaimed them.`,"environment",void 0,{instanceId:e,instanceName:t})}function Le(e=typeof window>"u"?null:window){const t=e?.volterGame;return!t||t.contractVersion!==1?null:t}const Pt=Object.entries(Oe).filter(([,e])=>!e.optional).map(([e])=>e);function Ae(e){const t=e?.scenes;if(t==null)return{scenes:null,malformed:null};if(typeof t!="object")return{scenes:null,malformed:`declared as ${typeof t}; expected an object with list(), current() and goTo()`};const n=Pt.filter(o=>typeof t[o]!="function");return n.length>0?{scenes:null,malformed:`declared a scenes surface missing required member(s): ${n.join(", ")}`}:{scenes:t,malformed:null}}function Ct(e){const t=e?.ready;if(t==null)return{ready:null,malformed:null};if(typeof t=="function"){const n=t;return{ready:()=>Promise.resolve(n()),malformed:null}}if(typeof t.then=="function"){const n=t;return{ready:()=>Promise.resolve(n),malformed:null}}return{ready:null,malformed:`declared \`ready\` as ${typeof t}; expected a promise or a function returning one`}}function Lt(e){const t=e?.world;return t==null?{world:null,malformed:null}:typeof t!="object"||t.isScene!==!0?{world:null,malformed:`declared \`world\` as ${typeof t}; expected the game's own THREE.Scene`}:{world:t,malformed:null}}function At(e){const t=e?.presentation;if(t==null)return{canvas:null,malformed:null};const n=t;return typeof n!="object"||n.tagName!=="CANVAS"||typeof n.getContext!="function"?{canvas:null,malformed:`declared \`presentation\` as ${typeof t=="object"?String(n.tagName??"object"):typeof t}; expected the game's own <canvas> element`}:{canvas:t,malformed:null}}const gn=Object.freeze(Object.defineProperty({__proto__:null,readGameContract:Le,readGamePresentation:At,readGameReady:Ct,readGameScenes:Ae,readGameWorld:Lt},Symbol.toStringTag,{value:"Module"}));function kt(e){if(!Array.isArray(e))throw new Error("scenes.list() did not return an array");const t=new Set;for(const n of e){if(typeof n!="object"||n===null||typeof n.id!="string"||n.id.trim().length===0||typeof n.label!="string"||n.label.trim().length===0)throw new Error("scenes.list() returned an invalid { id, label } scene");if(t.has(n.id))throw new Error(`scenes.list() returned duplicate id "${n.id}"`);t.add(n.id)}return e}function xt(e){return typeof e?.goToScene=="function"}function hn(e,t={}){const{scenes:n,malformed:o}=Ae(e);if(o!==null&&P.warn(`Ignored the game contract's \`scenes\` surface: ${o}`,"ingest"),!n)return null;let a=!1;const u=()=>{try{return kt(n.list())}catch(g){return a||(a=!0,P.warn(`Ignored invalid game-contract scenes: ${g instanceof Error?g.message:String(g)}`,"ingest")),[]}},i=g=>{const h=u().map(w=>w.id);return h.includes(g)?(t.onSwitchAccepted?.(g),{ok:!0,settled:(async()=>{try{return await n.goTo(g),{requested:g,current:n.current()}}catch(w){return{requested:g,current:n.current(),error:w instanceof Error?w.message:String(w)}}})()}):{ok:!1,error:`scenes.goTo: "${g}" is not one of this game's scenes (${h.length>0?h.join(", "):"it lists none"}).`,known:h}};return{title:"Scenes",storiesFor:g=>u().map(({id:h,label:y})=>({id:h,label:y})),active:g=>n.current(),goToScene:i,apply:(g,h)=>{if(h===null){P.warn("This game’s scenes cannot be cleared: it is always in one of its own scenes. Pick the scene to switch to instead.","ingest");return}const y=i(h);if(!y.ok){P.warn(`${y.error} — ignoring.`,"ingest");return}y.settled.then(w=>{w.error!==void 0&&P.error(`scenes.goTo("${h}") failed: ${w.error}`,"ingest")})}}}function Gt(){const e=G();if(!e)return null;const n=(()=>{switch(e.kind){case"canvas":return e.session.adapter;case"dom":return e.session.adapter;case"three":return e.session.mount?.authoring}})()?.stories;return xt(n)?n:null}let J=!1;function ge(){return J}function wn(){J=!0}function vn(){J=!1}let D=null,x=null;function yn(e){D=e,e||Z()}function pn(){D=null,Z()}function Z(){const e=x;x=null,e&&(clearTimeout(e.timer),e.settle(null))}function ke(){const e=D?.renderer.domElement;return typeof e=="object"&&e!==null?e:null}function _n(){const e=x;if(!(!e||!D))try{const t=D.renderer;if(typeof t.getRenderTarget=="function"&&t.getRenderTarget()!==null)return;const n=ke();if(!n||n.width===0||n.height===0)return;const o=e.image??n.ownerDocument.createElement("canvas");o.width=n.width,o.height=n.height;const a=o.getContext("2d");if(!a||(a.drawImage(n,0,0),e.image=o,e.delivering))return;e.delivering=!0,setTimeout(()=>{x===e&&(x=null,clearTimeout(e.timer),e.settle(e.image))},0)}catch{}}function Mt(e=2e3){return D?(Z(),new Promise(t=>{const n=setTimeout(()=>{x?.timer===n&&(x=null),t(null)},e);x={settle:t,timer:n,image:null,delivering:!1}})):Promise.resolve(null)}const $t={play:e=>(e.play(),"driven"),resume:e=>(e.resume(),"driven"),stop:(e,t)=>t?.stopEndsRun?"declined":(e.pause(),"driven"),pause:e=>(e.pause(),"driven"),step:e=>e.canStep?(e.step(),"driven"):{ok:!1,error:"this ingested game cannot be stepped — no serve-time loop gate measured control over its frames, so a single-frame step would be a button that lies (see ingest/same-realm-loop-gate.ts)"}};function Ft(e,t,n){if(!je(t))return null;const o=$t[t](e,n);return o==="declined"?null:o!=="driven"?o:{ok:!0,data:{ingest:!0,playing:e.playing}}}function Ht(){return Y().window}function X(){return typeof window>"u"?null:Le(Ht())}let ee=!1;function Dt(){return ee}function N(e){ee=e}function jt(){N(!1);const e=window;delete e.__volterMountCold,delete e.__volterIngestPlayed}function he(e,t,n){const o=(a,u)=>ze({seam:`contract.lifecycle.${t}`,subject:"game",epoch:qe(e),stage:"effect",outcome:a,source:"consumer",detail:u});try{n(),o("pass",`the mounted ingest lifecycle consumed lifecycle.${t}`)}catch(a){throw o("fail",`lifecycle.${t} failed: ${a instanceof Error?a.message:String(a)}`),a}}function Sn(e={}){const t=X(),n=t?.lifecycle,o=()=>{if(t&&n?.start){he(t,"start",()=>n.start?.());return}window.dispatchEvent(new CustomEvent("volter:ingest-play"))},a=typeof n?.pause=="function",u=typeof n?.resume=="function";return t&&a!==u?{start:o,pauseGap:a?"the game contract declares lifecycle.pause without lifecycle.resume":"the game contract declares lifecycle.resume without lifecycle.pause"}:t&&a&&u?{start:o,setPaused:i=>he(t,i?"pause":"resume",()=>{i?n?.pause?.():n?.resume?.()})}:e.setPaused?{start:o,setPaused:e.setPaused,...e.step?{step:e.step}:{},...e.canStep?{canStep:e.canStep}:{}}:{start:o,pauseGap:e.pauseGap??"the game declares no lifecycle.pause/resume pair and its mounted adapter exposes no setPaused capability"}}function bn(){const e=G();return e?e.session.lifecycle.pauseGap??null:null}function we(e){const t=G();if(t)for(const n of t.siblings)try{n.setPaused?.(e)}catch(o){P.error(`Composite sibling setPaused(${e}) failed: ${o}`,"ingest")}}function zt(){return X()}function xe(){const e=G()?.session.lifecycle;if(!e?.setPaused)return null;const t=()=>{e.setPaused?.(!0),we(!0),N(!1)},n=()=>{e.setPaused?.(!1),we(!1),N(!0)};return{get playing(){return ee},play(){Ne();const o=window;if(o.__volterIngestPlayed)return n();o.__volterIngestPlayed=!0,e.start(),n()},pause:t,resume:n,canStep:!!e.step&&(e.canStep?.()??!0),step(){e.canStep?.()!==!1&&(e.step?.(),N(!1))}}}function En(e){const t=xe();return t?(t.pause(),!0):!1}const Nt=Ue(e=>{e.level==="warn"?P.warn(e.message,"ingest"):P.log(e.message,"ingest")});let Bt=0,Ge="";function Rn(e){Ge=`${e}#${++Bt}`}function Tn(e){const t=mt(e.realmLoopVerdict?.()),n=e.realmLoopVerdict?.()?.reason??null;return t!==null||n!==null?{loop:t,reason:n}:e.realmLoopVerdict?{loop:null,reason:null}:{loop:null,reason:Wt}}function In(){return{loop:null,reason:"⏸ calls the host runtime's own play pause on this route, but no probe has measured whether that reaches this game's frames — an unmodified React game that schedules its own timers is not held by the host loop"}}const Wt="this mount installs no loop gate, so no verdict will ever be measured here — nothing in the editor holds this game's frames";function Ot(e,t,n){const o=Xe(t?.systems,n),a=new Map(o.empty.map(i=>[i.slot,i.evidence])),u=new Map(o.malformed.map(i=>[i.slot,i.reason]));return Ye.map(i=>{if(e[i]!=null)return{slot:i,state:"bound",proof:Be({slot:i,adapter:e[i],subject:"game"})};const g=a.get(i);if(g!==void 0)return{slot:i,state:"empty",evidence:g};const h=u.get(i);return h!==void 0?{slot:i,state:"malformed",evidence:h}:{slot:i,state:"unanswered"}})}function qt(){const e=Je();switch(e.state){case"absent":return null;case"loading":return{state:"loading"};case"ready":return{state:"ready",dataFile:e.writer.dataFile};default:return{state:"failed",reason:e.reason}}}function te(){const e=G(),t=e?.coverage;if(!e||!t)return null;const n=Qe(),o=t.loop(),a=zt();return Ve({worldId:e.worldId,reach:t.reach,surface:e.kind,reachMechanism:t.reachMechanism,loop:o.loop,loopReason:o.reason,contract:Ke(a),systemAdapters:Ot(pe(),a,e.kind),ownership:n?{writable:n.writable,reason:n.reason??null,recorder:n.recorder??null}:null,dataWriter:qt(),projectVerbs:[],writeReach:t.writeReach?.()??null})}function Pn(e){const t=G();if(!t)return;t.coverage=e;const n=te();n&&Nt.report(Ge,n)}function Cn(e,t){if(!t)return;const n=`Ingest "${e}" loop: ${t.loop} — ${t.reason}`;t.loop==="gated"?P.log(n,"ingest"):P.warn(n,"adapter")}const Ut=["hierarchy","selection","transforms","inspector","assetSubject","structure","persistence","pickable","rects","boxEdit","text","colorSample","stories","truth","assetDrop"];function Vt(e){return Ut.filter(t=>e[t]!==void 0)}function Ln(e){return{coverage:()=>te(),prepareCoverage:()=>Ze(),authoringProviders:()=>Vt(e),engineSystems:()=>Object.keys(pe())}}function An(e,t){Object.defineProperties(e,{loop:{enumerable:!0,get:()=>t.realmLoopVerdict?.()?.loop??null},loopReason:{enumerable:!0,get:()=>t.realmLoopVerdict?.()?.reason??null}}),e.realmLoopStats=()=>ht()?.stats()??null}function kn(e,t){const n=e,o=typeof n.querySelectorAll=="function"?n.querySelectorAll("*").length:t.nodeCount(),a=Object.keys(e).some(u=>u.startsWith("__reactContainer"));return{elementCount:o,hierarchyNodeCount:t.nodeCount(),reactRootPresent:a}}function xn(e,t){window[e]=t}function ne(e){delete window[e]}function Me(){Et(null);const e=G();if(e){Jt(null),jt();try{X()?.lifecycle?.dispose?.()}catch(t){P.error(`The game's own lifecycle.dispose threw at teardown: ${t}`,"ingest")}for(let t=e.siblings.length-1;t>=0;t--)try{e.siblings[t].dispose()}catch(n){P.error(`Composite sibling dispose failed: ${n}`,"ingest")}switch(e.kind){case"three":Kt(e.session);return;case"canvas":Yt(e.session);return;case"dom":Qt(e.session);return}}}function Kt(e){if(e.mount?.authoring&&e.mount.authoring.dispose?.(),W(null),O(null),q(),e.resizeObserver?.disconnect(),e.inputGateUnsubscribe?.(),e.mount)try{e.store.exitPlayScene()}catch{}e.store.shell.setPlayState("stopped");try{e.mount?.game.dispose()}catch{}Q("","The ingested game"),ne("__volterIngest"),P.log("Ingest root unmounted","ingest")}function Yt(e){e.adapter&&e.adapter.dispose(),W(null),O(null),q(),e.store.shell.setPlayState("stopped");try{e.dispose()}catch{}Q("","The ingested canvas game"),ne("__volterIngest2D"),P.log("canvas ingest root unmounted","ingest")}function Qt(e){e.adapter.dispose(),W(null),O(null),q(),e.store.shell.setPlayState("stopped");try{e.stop()}catch{}Q("","The ingested DOM game"),ne("__volterIngestReact"),P.log("DOM ingest root unmounted","ingest")}function Gn(){G()?.kind==="three"&&Me()}let j=null;function G(){return j}function Jt(e){j=e}function $e(){return j?.kind??null}function ve(){return $e()!==null}function Mn(e){j&&(j.siblings=[...e])}let ye=Promise.resolve();function $n(e){const t=ye.then(e);return ye=t.then(()=>{},()=>{}),t}We({id:"ingest",priority:1,mounted:ve,playing:()=>Dt()||ge(),stop:Me,instanceContainer:()=>null,frameCanvas:ke,snapshotFrame:()=>Mt(),command:e=>{const t=ve()?xe():null;return t?Ft(t,e.type,{stopEndsRun:ge()}):null},scenes:Gt,surface:$e,coverage:te,authoringRefusal:()=>j?.kind==="dom"?"This is an ingested native-React game: its components render directly as a DOM layer under the host React — there is no scene graph or renderer to introspect, and authoring is deliberately off for react ingests (the editor never writes JSX back into an unmodified game). The game is hosted, sized, and disposed; play it in the Game tab.":null});export{Q as $,un as A,an as B,Ct as C,X as D,ln as E,At as F,rn as G,Ht as H,sn as I,pn as J,ht as K,Lt as L,Rn as M,N,Cn as O,Tn as P,An as Q,dn as R,Gt as S,hn as T,Wt as U,yn as V,_n as W,on as X,cn as Y,et as Z,ie as _,G as a,mn as a0,_t as a1,gn as a2,wn as b,Me as c,ge as d,vn as e,bn as f,xe as g,En as h,ve as i,Sn as j,Jt as k,fn as l,In as m,kn as n,Ln as o,xn as p,mt as q,Pn as r,$n as s,te as t,Dt as u,jt as v,Mn as w,$e as x,Gn as y,zt as z};
@@ -1 +1 @@
1
- import{dY as p}from"./index-Crsbhlhy.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const u=1e-9,d=1e5;function f(m,e,t){const r=t.end-t.start,i=t.loop&&r>u,o=[];let s=m,a=e,c=!1,l=0;for(;;){const h=t.end-s;if(!i||a<=h+u){const n=Math.min(s+a,t.end);o.push({from:s,to:n,direction:"forward"}),s=n;break}if(o.push({from:s,to:t.end,direction:"forward"}),a-=h,s=t.start,c=!0,l++,l>d){const n=t.start+a%r;o.push({from:s,to:n,direction:"forward"}),s=n;break}}return{pos:s,intervals:o,looped:c}}function g(m,e,t){const r=t.end-t.start,i=t.loop&&r>u,o=[];let s=m,a=e,c=!1,l=0;for(;;){const h=s-t.start;if(!i||a<=h+u){const n=Math.max(s-a,t.start);o.push({from:s,to:n,direction:"reverse"}),s=n;break}if(o.push({from:s,to:t.start,direction:"reverse"}),a-=h,s=t.end,c=!0,l++,l>d){const n=t.end-a%r;o.push({from:s,to:n,direction:"reverse"}),s=n;break}}return{pos:s,intervals:o,looped:c}}function _(m,e){return m<e.start?e.start:m>e.end?e.end:m}class D{_previousTime;_currentTime;_range;_timeScale;_playDirection="forward";_lastCrossingDirection="forward";_playbackState="stopped";_evaluators=[];_registrationCounter=0;constructor(e={}){const t=e.start??0,r=e.end??Math.max(t,1);if(r<t)throw new Error(`[AnimationClock] range end (${r}) must be >= start (${t})`);const i=e.timeScale??1;if(!Number.isFinite(i)||i<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${i}`);this._range={start:t,end:r,loop:e.loop??!1},this._timeScale=i,this._previousTime=t,this._currentTime=t}get time(){return this._currentTime}get previousTime(){return this._previousTime}get direction(){return this._playbackState==="playing"?this._playDirection:"paused"}get playbackState(){return this._playbackState}get timeScale(){return this._timeScale}set timeScale(e){if(!Number.isFinite(e)||e<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${e}`);this._timeScale=e}get range(){return this._range}setRange(e){const t=e.start??this._range.start,r=e.end??this._range.end,i=e.loop??this._range.loop;if(r<t)throw new Error(`[AnimationClock] range end (${r}) must be >= start (${t})`);this._range={start:t,end:r,loop:i};const o=_(this._currentTime,this._range);o!==this._currentTime&&this.seek(o)}play(e){e&&(this._playDirection=e),this._playbackState="playing"}pause(){this._playbackState="paused"}stop(){this._playbackState="stopped"}seek(e){const t=_(e,this._range);if(t===this._currentTime)return this.emit(this._currentTime,this._currentTime,[{from:t,to:t,direction:this._lastCrossingDirection}],!1,this._lastCrossingDirection);const r=t>this._currentTime?"forward":"reverse",i=this._currentTime;return this._previousTime=i,this._currentTime=t,this._lastCrossingDirection=r,this.emit(i,t,[{from:i,to:t,direction:r}],!1,r)}seekFrame(e,t){if(!Number.isFinite(t)||t<=0)throw new Error(`[AnimationClock] seekFrame fps must be a finite number > 0, got ${t}`);return this.seek(this._range.start+e/t)}advance(e){if(this._playbackState!=="playing")return null;if(!Number.isFinite(e))throw new Error(`[AnimationClock] advance(dt) requires a finite dt, got ${e}`);const t=Math.abs(e)*this._timeScale,r=this._currentTime;if(t===0)return this.emit(r,r,[],!1,this._playDirection);const i=this._playDirection==="forward"?f(r,t,this._range):g(r,t,this._range);return this._previousTime=r,this._currentTime=i.pos,this._lastCrossingDirection=this._playDirection,this.emit(r,i.pos,i.intervals,i.looped,this._playDirection)}subscribe(e,t){if(!p.includes(e))throw new Error(`[AnimationClock] unknown phase "${e}". Valid: ${p.join(", ")}`);const r={phase:e,order:this._registrationCounter++,fn:t};return this._evaluators.push(r),{dispose:()=>{const i=this._evaluators.indexOf(r);i!==-1&&this._evaluators.splice(i,1)}}}emit(e,t,r,i,o){const s={previousTime:e,currentTime:t,direction:o,timeScale:this._timeScale,looped:i,intervals:r};if(this._evaluators.length>0){const a=[...this._evaluators].sort((c,l)=>{const h=p.indexOf(c.phase),n=p.indexOf(l.phase);return h!==n?h-n:c.order-l.order});for(const c of a)try{c.fn(s)}catch(l){console.error(`[AnimationClock] evaluator in phase "${c.phase}" threw:`,l)}}return s}}export{D as AnimationClock};
1
+ import{dY as p}from"./index-DaRQxpdW.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const u=1e-9,d=1e5;function f(m,e,t){const r=t.end-t.start,i=t.loop&&r>u,o=[];let s=m,a=e,c=!1,l=0;for(;;){const h=t.end-s;if(!i||a<=h+u){const n=Math.min(s+a,t.end);o.push({from:s,to:n,direction:"forward"}),s=n;break}if(o.push({from:s,to:t.end,direction:"forward"}),a-=h,s=t.start,c=!0,l++,l>d){const n=t.start+a%r;o.push({from:s,to:n,direction:"forward"}),s=n;break}}return{pos:s,intervals:o,looped:c}}function g(m,e,t){const r=t.end-t.start,i=t.loop&&r>u,o=[];let s=m,a=e,c=!1,l=0;for(;;){const h=s-t.start;if(!i||a<=h+u){const n=Math.max(s-a,t.start);o.push({from:s,to:n,direction:"reverse"}),s=n;break}if(o.push({from:s,to:t.start,direction:"reverse"}),a-=h,s=t.end,c=!0,l++,l>d){const n=t.end-a%r;o.push({from:s,to:n,direction:"reverse"}),s=n;break}}return{pos:s,intervals:o,looped:c}}function _(m,e){return m<e.start?e.start:m>e.end?e.end:m}class D{_previousTime;_currentTime;_range;_timeScale;_playDirection="forward";_lastCrossingDirection="forward";_playbackState="stopped";_evaluators=[];_registrationCounter=0;constructor(e={}){const t=e.start??0,r=e.end??Math.max(t,1);if(r<t)throw new Error(`[AnimationClock] range end (${r}) must be >= start (${t})`);const i=e.timeScale??1;if(!Number.isFinite(i)||i<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${i}`);this._range={start:t,end:r,loop:e.loop??!1},this._timeScale=i,this._previousTime=t,this._currentTime=t}get time(){return this._currentTime}get previousTime(){return this._previousTime}get direction(){return this._playbackState==="playing"?this._playDirection:"paused"}get playbackState(){return this._playbackState}get timeScale(){return this._timeScale}set timeScale(e){if(!Number.isFinite(e)||e<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${e}`);this._timeScale=e}get range(){return this._range}setRange(e){const t=e.start??this._range.start,r=e.end??this._range.end,i=e.loop??this._range.loop;if(r<t)throw new Error(`[AnimationClock] range end (${r}) must be >= start (${t})`);this._range={start:t,end:r,loop:i};const o=_(this._currentTime,this._range);o!==this._currentTime&&this.seek(o)}play(e){e&&(this._playDirection=e),this._playbackState="playing"}pause(){this._playbackState="paused"}stop(){this._playbackState="stopped"}seek(e){const t=_(e,this._range);if(t===this._currentTime)return this.emit(this._currentTime,this._currentTime,[{from:t,to:t,direction:this._lastCrossingDirection}],!1,this._lastCrossingDirection);const r=t>this._currentTime?"forward":"reverse",i=this._currentTime;return this._previousTime=i,this._currentTime=t,this._lastCrossingDirection=r,this.emit(i,t,[{from:i,to:t,direction:r}],!1,r)}seekFrame(e,t){if(!Number.isFinite(t)||t<=0)throw new Error(`[AnimationClock] seekFrame fps must be a finite number > 0, got ${t}`);return this.seek(this._range.start+e/t)}advance(e){if(this._playbackState!=="playing")return null;if(!Number.isFinite(e))throw new Error(`[AnimationClock] advance(dt) requires a finite dt, got ${e}`);const t=Math.abs(e)*this._timeScale,r=this._currentTime;if(t===0)return this.emit(r,r,[],!1,this._playDirection);const i=this._playDirection==="forward"?f(r,t,this._range):g(r,t,this._range);return this._previousTime=r,this._currentTime=i.pos,this._lastCrossingDirection=this._playDirection,this.emit(r,i.pos,i.intervals,i.looped,this._playDirection)}subscribe(e,t){if(!p.includes(e))throw new Error(`[AnimationClock] unknown phase "${e}". Valid: ${p.join(", ")}`);const r={phase:e,order:this._registrationCounter++,fn:t};return this._evaluators.push(r),{dispose:()=>{const i=this._evaluators.indexOf(r);i!==-1&&this._evaluators.splice(i,1)}}}emit(e,t,r,i,o){const s={previousTime:e,currentTime:t,direction:o,timeScale:this._timeScale,looped:i,intervals:r};if(this._evaluators.length>0){const a=[...this._evaluators].sort((c,l)=>{const h=p.indexOf(c.phase),n=p.indexOf(l.phase);return h!==n?h-n:c.order-l.order});for(const c of a)try{c.fn(s)}catch(l){console.error(`[AnimationClock] evaluator in phase "${c.phase}" threw:`,l)}}return s}}export{D as AnimationClock};
@@ -1 +1 @@
1
- import{r}from"./index-Crsbhlhy.js";import{l as t}from"./live-mixers-B-bwLZ7c.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const u="workspace.service";function v(){return r().session.reportFacet(()=>({liveMixers:t().map(i=>({site:i.key,clips:[...i.clips.keys()],animates:[...i.roots].map(o=>o.name||"(unnamed)")}))}))}export{u as point,v as start};
1
+ import{r}from"./index-DaRQxpdW.js";import{l as t}from"./live-mixers-B-bwLZ7c.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const u="workspace.service";function v(){return r().session.reportFacet(()=>({liveMixers:t().map(i=>({site:i.key,clips:[...i.clips.keys()],animates:[...i.roots].map(o=>o.name||"(unnamed)")}))}))}export{u as point,v as start};
@@ -1 +1 @@
1
- import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import{r as c,aL as p}from"./index-Crsbhlhy.js";import{T as m}from"./transport-strip-7xF6Xkx1.js";import{r as a}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const E="workspace.utility",T="Animation";function j(){const{documents:o,transport:n}=c(),e=a.useSyncExternalStore(o.subscribe,o.activeId,o.activeId),t=a.useSyncExternalStore(n.subscribe,a.useCallback(()=>e?n.for(e):null,[e,n])),r=a.useSyncExternalStore(a.useCallback(i=>t?t.subscribe(i):()=>{},[t]),a.useCallback(()=>t?.snapshot()??null,[t]));return!t||!r||r.activeSubject===null?s.jsx(p,{as:"p",variant:"caption","data-testid":"animation-timeline-empty","data-document":e??"","data-transport":t?"yes":"no",style:{padding:"var(--volter-space-2) var(--volter-space-3)"},children:t?"Nothing in the active document plays an animation.":"The active document has no stage to animate."}):s.jsx(m,{transport:t})}export{j as default,E as point,T as title};
1
+ import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import{r as c,aL as p}from"./index-DaRQxpdW.js";import{T as m}from"./transport-strip-Ck5zz3Th.js";import{r as a}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const E="workspace.utility",T="Animation";function j(){const{documents:o,transport:n}=c(),e=a.useSyncExternalStore(o.subscribe,o.activeId,o.activeId),t=a.useSyncExternalStore(n.subscribe,a.useCallback(()=>e?n.for(e):null,[e,n])),r=a.useSyncExternalStore(a.useCallback(i=>t?t.subscribe(i):()=>{},[t]),a.useCallback(()=>t?.snapshot()??null,[t]));return!t||!r||r.activeSubject===null?s.jsx(p,{as:"p",variant:"caption","data-testid":"animation-timeline-empty","data-document":e??"","data-transport":t?"yes":"no",style:{padding:"var(--volter-space-2) var(--volter-space-3)"},children:t?"Nothing in the active document plays an animation.":"The active document has no stage to animate."}):s.jsx(m,{transport:t})}export{j as default,E as point,T as title};
@@ -1 +1 @@
1
- import{o}from"./AssetBudgetPanel-8flhcwbD.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-Crsbhlhy.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./asset-loaders-Dcnf7Bw6.js";import"./SkeletonUtils-YH9iLOY_.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./loader-BTUKnX5Q.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const D="workspace.menu",I={menu:"asset",items:[{id:"open-budget",label:"Open in Asset Budget",testId:"asset-context-open-budget",execute:({assetPath:t})=>{t!==void 0&&o(t)}}]};export{I as menu,D as point};
1
+ import{o}from"./AssetBudgetPanel-Cj7h9s3X.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-DaRQxpdW.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./asset-loaders-D-7Pz-E0.js";import"./SkeletonUtils-YH9iLOY_.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./loader-BTUKnX5Q.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const D="workspace.menu",I={menu:"asset",items:[{id:"open-budget",label:"Open in Asset Budget",testId:"asset-context-open-budget",execute:({assetPath:t})=>{t!==void 0&&o(t)}}]};export{I as menu,D as point};
@@ -1 +1 @@
1
- import{o as t}from"./AssetBudgetPanel-8flhcwbD.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-Crsbhlhy.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./asset-loaders-Dcnf7Bw6.js";import"./SkeletonUtils-YH9iLOY_.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./loader-BTUKnX5Q.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const D="workspace.action",O=[{id:"asset-budget",label:"Open Asset Budget",execute:()=>{t()}}];export{O as actions,D as point};
1
+ import{o as t}from"./AssetBudgetPanel-Cj7h9s3X.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-DaRQxpdW.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./asset-loaders-D-7Pz-E0.js";import"./SkeletonUtils-YH9iLOY_.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./loader-BTUKnX5Q.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const D="workspace.action",O=[{id:"asset-budget",label:"Open Asset Budget",execute:()=>{t()}}];export{O as actions,D as point};
@@ -1 +1 @@
1
- import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{A as o}from"./AssetBudgetPanel-8flhcwbD.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-Crsbhlhy.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./asset-loaders-Dcnf7Bw6.js";import"./SkeletonUtils-YH9iLOY_.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./loader-BTUKnX5Q.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const P="workspace.document",R="Asset Budget";function _(r){return t.jsx(o,{})}export{_ as default,P as point,R as title};
1
+ import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{A as o}from"./AssetBudgetPanel-Cj7h9s3X.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-DaRQxpdW.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./asset-loaders-D-7Pz-E0.js";import"./SkeletonUtils-YH9iLOY_.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./loader-BTUKnX5Q.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const P="workspace.document",R="Asset Budget";function _(r){return t.jsx(o,{})}export{_ as default,P as point,R as title};
@@ -1 +1 @@
1
- import{o as t}from"./AssetBudgetPanel-8flhcwbD.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-Crsbhlhy.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./asset-loaders-Dcnf7Bw6.js";import"./SkeletonUtils-YH9iLOY_.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./loader-BTUKnX5Q.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const D="workspace.menu",I={menu:"window",items:[{id:"asset-budget",label:"Asset Budget",testId:"menu-asset-budget",execute:()=>{t()}}]};export{I as menu,D as point};
1
+ import{o as t}from"./AssetBudgetPanel-Cj7h9s3X.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-DaRQxpdW.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./asset-loaders-D-7Pz-E0.js";import"./SkeletonUtils-YH9iLOY_.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./asset-parse-error-BHMwBRU3.js";import"./user-data-CODoGZqA.js";import"./object-marks-BnvSuCTt.js";import"./loader-BTUKnX5Q.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const D="workspace.menu",I={menu:"window",items:[{id:"asset-budget",label:"Asset Budget",testId:"menu-asset-budget",execute:()=>{t()}}]};export{I as menu,D as point};
@@ -1 +1 @@
1
- import{a$ as v,b0 as l,b1 as h,b2 as b,b3 as m,b4 as g}from"./index-Crsbhlhy.js";const p=new WeakMap;function w(e){typeof window>"u"||(window.dispatchEvent(new CustomEvent("editor:assets-changed",{detail:{paths:[u(e)]}})),window.dispatchEvent(new CustomEvent("editor:asset-mutation",{detail:{type:"change",paths:[u(e)]}})))}function k(e,a){const s=u(a);let n=p.get(e);n||(n=new Map,p.set(e,n));const t=n.get(s);if(t)return t;const d=e.registry.registerProject("project-file",`.volter/history/imported-assets/${s}`,s.split("/").pop()),o={revision:0,driver:void 0},r=async()=>{const i=await b(s),c=new TextEncoder().encode(i);return{revision:o.revision,contentType:"application/vnd.volter.asset-history-token",bytes:c,sha256:await m(c)}};return o.driver={descriptor:d,capture:r,preflight:async i=>{const c=await r();return c.sha256===i.sha256?{ok:!0}:{ok:!1,reason:"content-conflict",actualRevision:o.revision,actualSha256:c.sha256}},restore:async i=>{const c=new TextDecoder().decode(e.snapshots.read(i).bytes);await l(s,c),o.revision++,w(s)},estimateBytes:i=>i.byteLength},e.registerDriver(o.driver),n.set(s,o),o}function f(e){return new TextEncoder().encode(e)}async function A(e,a){if(e.length===0)return;const s=h();if(!s)return;const n=e.map(t=>({entry:t,resource:k(s,t.assetPath)}));try{await s.recordAppliedTransaction({label:a,detail:e.map(t=>u(t.assetPath)).join(", "),resources:n.map(({resource:t})=>t.driver.descriptor.key),scope:"project"},n.map(({entry:t,resource:d})=>({resource:d.driver.descriptor.key,beforeBytes:f(t.beforeToken),afterBytes:f(t.afterToken),contentType:"application/vnd.volter.asset-history-token"})))}catch(t){const d=await Promise.allSettled(e.map(r=>l(r.assetPath,r.beforeToken)));for(const r of e)w(r.assetPath);const o=d.find(r=>r.status==="rejected");throw o?.status==="rejected"?new Error(`Project history could not record undo/redo and rollback failed: ${o.reason instanceof Error?o.reason.message:String(o.reason)}`):new Error(`Assets were rolled back because project history could not record undo/redo: ${t instanceof Error?t.message:String(t)}`)}}async function E(e,a=`Import ${e.name}`){const s=await v(e);return s.ok&&s.history&&await A([s.history],a),s}function u(e){const a=e.split(/[?#]/,1)[0].replace(/^\/+/,"");if(!a)throw new Error("Project asset path cannot be empty.");return a}function P(e,a){const s=h(),n=u(e);let t=!1;const d=()=>{t||(t=!0,queueMicrotask(()=>{t=!1,a()}))},o=s?g(s).subscribeAll(i=>{i===n&&d()}):()=>{},r=i=>{const c=i.detail?.paths;(!c||c.some(y=>u(y)===n))&&d()};return typeof window<"u"&&window.addEventListener("editor:assets-changed",r),()=>{o(),typeof window<"u"&&window.removeEventListener("editor:assets-changed",r)}}export{E as d,P as s};
1
+ import{a$ as v,b0 as l,b1 as h,b2 as b,b3 as m,b4 as g}from"./index-DaRQxpdW.js";const p=new WeakMap;function w(e){typeof window>"u"||(window.dispatchEvent(new CustomEvent("editor:assets-changed",{detail:{paths:[u(e)]}})),window.dispatchEvent(new CustomEvent("editor:asset-mutation",{detail:{type:"change",paths:[u(e)]}})))}function k(e,a){const s=u(a);let n=p.get(e);n||(n=new Map,p.set(e,n));const t=n.get(s);if(t)return t;const d=e.registry.registerProject("project-file",`.volter/history/imported-assets/${s}`,s.split("/").pop()),o={revision:0,driver:void 0},r=async()=>{const i=await b(s),c=new TextEncoder().encode(i);return{revision:o.revision,contentType:"application/vnd.volter.asset-history-token",bytes:c,sha256:await m(c)}};return o.driver={descriptor:d,capture:r,preflight:async i=>{const c=await r();return c.sha256===i.sha256?{ok:!0}:{ok:!1,reason:"content-conflict",actualRevision:o.revision,actualSha256:c.sha256}},restore:async i=>{const c=new TextDecoder().decode(e.snapshots.read(i).bytes);await l(s,c),o.revision++,w(s)},estimateBytes:i=>i.byteLength},e.registerDriver(o.driver),n.set(s,o),o}function f(e){return new TextEncoder().encode(e)}async function A(e,a){if(e.length===0)return;const s=h();if(!s)return;const n=e.map(t=>({entry:t,resource:k(s,t.assetPath)}));try{await s.recordAppliedTransaction({label:a,detail:e.map(t=>u(t.assetPath)).join(", "),resources:n.map(({resource:t})=>t.driver.descriptor.key),scope:"project"},n.map(({entry:t,resource:d})=>({resource:d.driver.descriptor.key,beforeBytes:f(t.beforeToken),afterBytes:f(t.afterToken),contentType:"application/vnd.volter.asset-history-token"})))}catch(t){const d=await Promise.allSettled(e.map(r=>l(r.assetPath,r.beforeToken)));for(const r of e)w(r.assetPath);const o=d.find(r=>r.status==="rejected");throw o?.status==="rejected"?new Error(`Project history could not record undo/redo and rollback failed: ${o.reason instanceof Error?o.reason.message:String(o.reason)}`):new Error(`Assets were rolled back because project history could not record undo/redo: ${t instanceof Error?t.message:String(t)}`)}}async function E(e,a=`Import ${e.name}`){const s=await v(e);return s.ok&&s.history&&await A([s.history],a),s}function u(e){const a=e.split(/[?#]/,1)[0].replace(/^\/+/,"");if(!a)throw new Error("Project asset path cannot be empty.");return a}function P(e,a){const s=h(),n=u(e);let t=!1;const d=()=>{t||(t=!0,queueMicrotask(()=>{t=!1,a()}))},o=s?g(s).subscribeAll(i=>{i===n&&d()}):()=>{},r=i=>{const c=i.detail?.paths;(!c||c.some(y=>u(y)===n))&&d()};return typeof window<"u"&&window.addEventListener("editor:assets-changed",r),()=>{o(),typeof window<"u"&&window.removeEventListener("editor:assets-changed",r)}}export{E as d,P as s};
@@ -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 y}from"./index-Crsbhlhy.js";import{clone as g}from"./SkeletonUtils-YH9iLOY_.js";import{AssetParseError as d}from"./asset-parse-error-BHMwBRU3.js";import{setUserData as p}from"./user-data-CODoGZqA.js";import{gltfLoader as _,resolveUrl as x,textureLoader as S}from"./loader-BTUKnX5Q.js";import{co as h,fo as u,K as b}from"./three.core-3arARmh6.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-BLhyNg0e.js";import"./object-marks-BnvSuCTt.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const m=new Map,l=new Map,c=new Map;function N(e){const n=m.get(e);if(n)return n;const t=S.load(e);return m.set(e,t),t}function R(e){let n=l.get(e);return n||(n=new Promise((t,a)=>{_.load(e,o=>t({scene:o.scene,animations:o.animations}),void 0,o=>a(o))}),l.set(e,n)),n.then(t=>{const a=g(t.scene);return a.traverse(o=>{o instanceof h&&(o.material=Array.isArray(o.material)?o.material.map(s=>s.clone()):o.material.clone(),p(o,"__sharedGeometry",!0))}),{scene:a,animations:t.animations}})}async function V(e,n){let t=c.get(e);!t&&n&&(t=Promise.resolve(n),c.set(e,t)),t||(t=fetch(x(e)).then(async a=>{if(!a.ok)throw new Error(`Failed to load Gaussian splat: ${e} (${a.status} ${a.statusText})`);return new Uint8Array(await a.arrayBuffer())}),c.set(e,t));try{const[{SplatMesh:a},o]=await Promise.all([y(()=>import("./spark.module-Byplgb8G.js"),__vite__mapDeps([0,1,2,3])),t]),s=new a({fileBytes:o,fileName:e,raycastable:!0});await s.initialized,p(s,"gaussianSplat",{src:e,numSplats:s.numSplats});const r=s.getBoundingBox();if(!r.isEmpty()){const f=r.getSize(new u).multiplyScalar(1.5),w=r.getCenter(new u),i=new h(new b(f.x,f.y,f.z));i.name="__volter_splat_bounds",i.position.copy(w),i.visible=!1,i.raycast=()=>{},p(i,"engineInternal",!0),s.add(i)}return s}catch(a){throw c.delete(e),a}}function K(e,n,t){const a=e.getObjectByName(n);if(!a)throw new d([{code:"custom",path:["mesh","node"],message:`glTF "${t}" has no node named "${n}" (getObjectByName found nothing)`}],t);const o=r=>r.isSkinnedMesh;let s=o(a);if(s||a.traverse(r=>{o(r)&&(s=!0)}),s)throw new d([{code:"custom",path:["mesh","node"],message:`glTF "${t}" node "${n}" is (or contains) a SkinnedMesh — a skinned mesh cannot be lifted out of its armature (atomic-subtree rule). Reference the whole file instead of a \`node\`, or bake/export a non-skinned sub-asset.`}],t);return a}function q(){m.clear(),l.clear(),c.clear()}function H(e){m.delete(e),l.delete(e)}function J(){return{textures:m.size,gltf:l.size,splat:c.size}}export{J as assetCacheSizes,q as clearAssetCaches,H as invalidateCachedAsset,R as loadGLTF,V as loadSplat,N as loadTexture,K as resolveGltfNode};
2
+ import{_ as y}from"./index-DaRQxpdW.js";import{clone as g}from"./SkeletonUtils-YH9iLOY_.js";import{AssetParseError as d}from"./asset-parse-error-BHMwBRU3.js";import{setUserData as p}from"./user-data-CODoGZqA.js";import{gltfLoader as _,resolveUrl as x,textureLoader as S}from"./loader-BTUKnX5Q.js";import{co as h,fo as u,K as b}from"./three.core-3arARmh6.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-BLhyNg0e.js";import"./object-marks-BnvSuCTt.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";const m=new Map,l=new Map,c=new Map;function N(e){const n=m.get(e);if(n)return n;const t=S.load(e);return m.set(e,t),t}function R(e){let n=l.get(e);return n||(n=new Promise((t,a)=>{_.load(e,o=>t({scene:o.scene,animations:o.animations}),void 0,o=>a(o))}),l.set(e,n)),n.then(t=>{const a=g(t.scene);return a.traverse(o=>{o instanceof h&&(o.material=Array.isArray(o.material)?o.material.map(s=>s.clone()):o.material.clone(),p(o,"__sharedGeometry",!0))}),{scene:a,animations:t.animations}})}async function V(e,n){let t=c.get(e);!t&&n&&(t=Promise.resolve(n),c.set(e,t)),t||(t=fetch(x(e)).then(async a=>{if(!a.ok)throw new Error(`Failed to load Gaussian splat: ${e} (${a.status} ${a.statusText})`);return new Uint8Array(await a.arrayBuffer())}),c.set(e,t));try{const[{SplatMesh:a},o]=await Promise.all([y(()=>import("./spark.module-Byplgb8G.js"),__vite__mapDeps([0,1,2,3])),t]),s=new a({fileBytes:o,fileName:e,raycastable:!0});await s.initialized,p(s,"gaussianSplat",{src:e,numSplats:s.numSplats});const r=s.getBoundingBox();if(!r.isEmpty()){const f=r.getSize(new u).multiplyScalar(1.5),w=r.getCenter(new u),i=new h(new b(f.x,f.y,f.z));i.name="__volter_splat_bounds",i.position.copy(w),i.visible=!1,i.raycast=()=>{},p(i,"engineInternal",!0),s.add(i)}return s}catch(a){throw c.delete(e),a}}function K(e,n,t){const a=e.getObjectByName(n);if(!a)throw new d([{code:"custom",path:["mesh","node"],message:`glTF "${t}" has no node named "${n}" (getObjectByName found nothing)`}],t);const o=r=>r.isSkinnedMesh;let s=o(a);if(s||a.traverse(r=>{o(r)&&(s=!0)}),s)throw new d([{code:"custom",path:["mesh","node"],message:`glTF "${t}" node "${n}" is (or contains) a SkinnedMesh — a skinned mesh cannot be lifted out of its armature (atomic-subtree rule). Reference the whole file instead of a \`node\`, or bake/export a non-skinned sub-asset.`}],t);return a}function q(){m.clear(),l.clear(),c.clear()}function H(e){m.delete(e),l.delete(e)}function J(){return{textures:m.size,gltf:l.size,splat:c.size}}export{J as assetCacheSizes,q as clearAssetCaches,H as invalidateCachedAsset,R as loadGLTF,V as loadSplat,N as loadTexture,K as resolveGltfNode};
@@ -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 We}from"./index-Crsbhlhy.js";import{EDITOR_LAYER as ye,isEditorOwnedObject as Ve}from"./editor-layers-DdJOFmu5.js";import{m as _}from"./renderer-ownership-BovSEcLv.js";import{i as je}from"./hierarchy-marks-D-538fQp.js";import{l as Ge,g as be,a as q,d as X,S as He}from"./studio-environment-BLFX45T5.js";import{h as z}from"./user-data-BJje5VYV.js";import{W}from"./three.module-BLhyNg0e.js";import{d5 as Ye,fo as b,eW as qe,cm as ee,I as ve,d9 as Xe,cj as O,ev as Ze,bu as Je,co as xe,c0 as Ke,b$ as Qe,bV as et,df as tt,eE as nt,bK as ot,F as rt,bh as Ee,cW as st,ej as V,A as j,n as at,el as it,bj as ct,aE as J,_ as lt}from"./three.core-3arARmh6.js";import{d as P,m as Se}from"./bitmap-label-Ct4k6ehY.js";const pn=["front","side"],Me=1,dn=.55,hn=Me/2,K=128,ut=[24,26,31],pt=[235,137,52],dt=[56,189,248],ht=[236,240,238];function fn(e,t){if(e.length<t*4)throw new Error(`Silhouette mask expected ${t*4} RGBA bytes but received ${e.length}.`);const o=new Uint8Array(t);for(let n=0;n<t;n++){const r=n*4,s=e[r]>=K||e[r+1]>=K||e[r+2]>=K;o[n]=s?1:0}return o}function mn(e,t){if(e.length!==t.length)throw new Error(`Mask IoU requires equal-size masks (${e.length} vs ${t.length}).`);let o=0,n=0,r=0;for(let a=0;a<e.length;a++){const i=e[a]!==0,c=t[a]!==0;i&&n++,c&&r++,i&&c&&o++}const s=n+r-o;return{intersection:o,union:s,aCount:n,bCount:r,iou:s===0?0:o/s}}function gn(e,t){if(e.length!==t.length)throw new Error(`Overlay requires equal-size masks (${e.length} vs ${t.length}).`);const o=new Uint8ClampedArray(e.length*4);for(let n=0;n<e.length;n++){const r=e[n]!==0,s=t[n]!==0,a=r&&s?ht:r?pt:s?dt:ut,i=n*4;o[i]=a[0],o[i+1]=a[1],o[i+2]=a[2],o[i+3]=255}return o}function ft(e){if(!Array.isArray(e)||e.length!==3)return null;const[t,o,n]=e;return typeof t!="number"||typeof o!="number"||typeof n!="number"||!Number.isFinite(t)||!Number.isFinite(o)||!Number.isFinite(n)||Math.hypot(t,n)<1e-6?null:[t,o,n]}function Ae(e){const[t,,o]=e;if(!Number.isFinite(t)||!Number.isFinite(o)||Math.hypot(t,o)<1e-6)throw new Error(`Cannot derive a facing from forward vector [${e.join(", ")}].`);return Math.atan2(t,o)}function wn(e,t,o=Me){const n=t[1]-e[1];if(!Number.isFinite(n)||n<=0)throw new Error(`Compare normalization needs positive model height, got ${n}.`);const r=o/n,s=(e[0]+t[0])/2,a=(e[2]+t[2])/2;return{scale:r,position:[-s*r,-e[1]*r,-a*r]}}const H=1.2,Ie=.001;function te(e){const t=new b(Math.sin(e),0,Math.cos(e)),n=new b(0,1,0).clone().cross(t).normalize(),r=t.clone().cross(n).normalize();return{direction:t,right:n,up:r}}function Ce(){return{minRight:Number.POSITIVE_INFINITY,maxRight:Number.NEGATIVE_INFINITY,minUp:Number.POSITIVE_INFINITY,maxUp:Number.NEGATIVE_INFINITY,minDepth:Number.POSITIVE_INFINITY,maxDepth:Number.NEGATIVE_INFINITY}}function oe(e){return e.maxRight<e.minRight}function mt(e){e.minRight=Number.POSITIVE_INFINITY,e.maxRight=Number.NEGATIVE_INFINITY,e.minUp=Number.POSITIVE_INFINITY,e.maxUp=Number.NEGATIVE_INFINITY,e.minDepth=Number.POSITIVE_INFINITY,e.maxDepth=Number.NEGATIVE_INFINITY}function Te(e,t,o){const n=t.dot(o.right),r=t.dot(o.up),s=t.dot(o.direction);n<e.minRight&&(e.minRight=n),n>e.maxRight&&(e.maxRight=n),r<e.minUp&&(e.minUp=r),r>e.maxUp&&(e.maxUp=r),s<e.minDepth&&(e.minDepth=s),s>e.maxDepth&&(e.maxDepth=s)}function gt(e,t){if(oe(e))throw new Error("Asset preview cannot frame an empty projected span.");return new b().addScaledVector(t.right,(e.minRight+e.maxRight)/2).addScaledVector(t.up,(e.minUp+e.maxUp)/2).addScaledVector(t.direction,(e.minDepth+e.maxDepth)/2)}function Re(e,t,o,n=H){const r=Math.max(t,e/o,Ie)*n;return{halfHeight:r,halfWidth:r*o}}function wt(e,t,o=H){if(oe(e))throw new Error("Asset preview cannot frame an empty projected span.");return Re((e.maxRight-e.minRight)/2,(e.maxUp-e.minUp)/2,t,o)}function yt(e){if(e.length===0)throw new Error("Asset preview cannot union an empty set of frames.");let t=0,o=0;for(const n of e)t=Math.max(t,n.halfWidth),o=Math.max(o,n.halfHeight);return{halfWidth:t,halfHeight:o}}function bt(e,t,o,n,r,s){const a=Math.max(n*r,Ie);let i=a,c=a;const l=new b;for(const u of e)l.copy(u).sub(t),i=Math.max(i,Math.abs(l.dot(o.right))+a),c=Math.max(c,Math.abs(l.dot(o.up))+a);return i=Math.max(i,c*s),c=Math.max(c,i/s),{halfWidth:i,halfHeight:c}}function vt(e){if(e.length===0)throw new Error("Asset preview cannot centre a bone-zoom crop on zero anchors.");const t=new b;for(const o of e)t.add(o);return t.multiplyScalar(1/e.length)}function xt(e,t){const o=e.position.dot(t.right),n=e.position.dot(t.up),r=e.position.dot(t.direction),s=e.zoom||1;return{minRight:o+e.left/s,maxRight:o+e.right/s,minUp:n+e.bottom/s,maxUp:n+e.top/s,minDepth:r-e.far,maxDepth:r-e.near}}function Et(e,t){return oe(e)?!1:e.maxRight>=t.minRight&&e.minRight<=t.maxRight&&e.maxUp>=t.minUp&&e.minUp<=t.maxUp&&e.maxDepth>=t.minDepth&&e.minDepth<=t.maxDepth}function re(e,t,o,n,r){const s=new Ye(-o.halfWidth,o.halfWidth,o.halfHeight,-o.halfHeight,.01,r);return s.position.copy(e).addScaledVector(t.direction,n),s.up.copy(t.up),s.lookAt(e),s.updateProjectionMatrix(),s.updateMatrixWorld(!0),s}const k=["front","right","top","perspective"],ue=24;function Le(e){const t=e;return typeof t=="object"&&t!==null&&typeof t.bone=="string"&&t.bone.length>0&&(t.axis==="x"||t.axis==="y"||t.axis==="z")&&typeof t.radians=="number"&&Number.isFinite(t.radians)}function Ne(e){const t=e;return typeof t=="object"&&t!==null&&typeof t.morph=="string"&&t.morph.length>0&&typeof t.influence=="number"&&Number.isFinite(t.influence)}function Pe(e){const t=e;return typeof t=="object"&&t!==null&&typeof t.bone=="string"&&t.bone.length>0&&(t.axis==="x"||t.axis==="y"||t.axis==="z")&&typeof t.meters=="number"&&Number.isFinite(t.meters)}function St(e){return Le(e)||Ne(e)||Pe(e)}function Mt(e,t){const o=e;if(typeof o!="object"||o===null||typeof o.label!="string"||!/^[a-z0-9][a-z0-9-]*$/i.test(o.label)||o.pose!==void 0&&(typeof o.pose!="string"||!t.has(o.pose)))return!1;if(o.view==="turntable")return typeof o.yaw=="number"&&Number.isFinite(o.yaw);if(o.view==="bone-zoom"){const n=o;return n.yaw!==void 0&&(typeof n.yaw!="number"||!Number.isFinite(n.yaw))?!1:Array.isArray(n.bones)&&n.bones.length>0&&n.bones.every(r=>typeof r=="string"&&r.length>0)&&typeof n.spanFraction=="number"&&Number.isFinite(n.spanFraction)&&n.spanFraction>0&&n.spanFraction<=2}return!1}function yn(e){const t=c=>{throw new Error(`Asset preview shot-set definition is invalid: ${c}`)},o=e;(typeof o!="object"||o===null)&&t("expected an object.");const n=o;(typeof n.name!="string"||!/^[a-z0-9][a-z0-9-]*$/i.test(n.name))&&t("`name` must be a short alphanumeric/dash identifier."),n.requiredBones!==void 0&&(!Array.isArray(n.requiredBones)||n.requiredBones.some(c=>typeof c!="string"||c.length===0))&&t("`requiredBones` must be an array of non-empty bone names."),n.rigRequirementHint!==void 0&&typeof n.rigRequirementHint!="string"&&t("`rigRequirementHint` must be a string.");const r=n.poses??{};(typeof r!="object"||r===null||Array.isArray(r))&&t("`poses` must be an object of named pose-step lists.");for(const[c,l]of Object.entries(r))(!Array.isArray(l)||!l.every(St))&&t(`pose ${JSON.stringify(c)} must be an array of {bone, axis, radians} and/or {morph, influence}.`);const s=new Set(Object.keys(r));(!Array.isArray(n.shots)||n.shots.length===0||n.shots.length>ue)&&t(`\`shots\` must list 1-${ue} shots.`);const a=n.shots,i=new Set;for(const c of a){Mt(c,s)||t('every shot needs a label plus either {view:"turntable", yaw} or {view:"bone-zoom", bones, spanFraction, yaw?}, with every `yaw` a finite number of radians and `pose` naming a declared pose.');const{label:l}=c;i.has(l)&&t(`duplicate shot label ${JSON.stringify(l)}.`),i.add(l)}return n}const At=512,pe=64,de=1024,U=2106410,It=25e3,N=64*1024*1024;function T(e){const t=e??At;if(!Number.isInteger(t)||t<pe||t>de)throw new Error(`Asset preview dimensions must be integers from ${pe} to ${de}.`);return t}function C(e){const t=e.toDataURL("image/png"),o=t.indexOf(",");return o>=0?t.slice(o+1):t}function bn(e){const t=new Set;e.traverse(n=>t.add(n));let o=e;return e.traverse(n=>{const r=n;if(!(!r.isSkinnedMesh||!r.skeleton))for(const s of r.skeleton.bones){if(!s||t.has(s))continue;const a=new Set;for(let c=o;c;c=c.parent)a.add(c);let i=null;for(let c=s;c;c=c.parent)if(a.has(c)){i=c;break}i&&i!==o&&(o=i,o.traverse(c=>t.add(c)))}}),o}function $(e){const t=new Set;e.traverse(a=>{t.add(a)});const o=Tt(e,t),n=Rt(e,o),r=Ct(e);n.matrix.copy(r),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixAutoUpdate=!1,n.matrixWorld.copy(r),n.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,n.visible=!0;const s=[];n.traverse(a=>{a!==n&&a.userData.editorHelper&&s.push(a)});for(const a of s)a.parent?.remove(a);return n}function Ct(e){const t=[];let o=e;for(;o;)t.push(o),o=o.parent;const n=t.findIndex(i=>!i.matrixWorldAutoUpdate),r=n>=0?t[n].matrixWorld.clone():new ee,s=new ee,a=n>=0?n-1:t.length-1;for(let i=a;i>=0;i--){const c=t[i];c.matrixAutoUpdate?s.compose(c.position,c.quaternion,c.scale):s.copy(c.matrix),r.multiply(s)}return r}function Tt(e,t){const o=new Map,n=new Map;let r=null;const s=()=>{if(r)return r;const a=new Map;for(const i of t){const c=i;if(!c.isBone||c.name==="")continue;const l=a.get(c.name);l?l.push(c):a.set(c.name,[c])}return r=a,a};if(e.traverse(a=>{const i=a;if(!i.isSkinnedMesh)return;const c=i.name||i.uuid;for(const l of i.skeleton.bones){if(l&&t.has(l)||l&&o.has(l))continue;const u=l?s().get(l.name)??[]:[];if(u.length===1){o.set(l,u[0]);continue}const p=l?.name||"(unnamed bone)";n.set(`${c} -> ${p}`,{mesh:c,bone:p,sameNamed:u.length})}}),n.size>0){const a=[...n.values()].map(({mesh:i,bone:c,sameNamed:l})=>l>1?`${i} -> ${c} (${l} bones inside the selection share that name — which one is meant is ambiguous)`:`${i} -> ${c} (no bone of that name inside the selection)`).join("; ");throw new Error(`Asset preview selection references bones outside its hierarchy that it cannot bind to: ${a}. Select the complete skeleton root — the node that owns both the skinned mesh and its bones.`)}return o}function Rt(e,t=new Map){const o=new Map,n=[],r=a=>{const i=Lt(a);o.set(a,i),Nt(a,i),a.isSkinnedMesh&&n.push([a,i]);const c=a;if(c.isLOD){const l=i,u=c.levels.filter(m=>m.object.visible),p=u.length===1?u[0]:c.levels[0];l.autoUpdate=!1;const d=new Set(c.levels.map(m=>m.object));for(const m of c.levels){if(Q(m.object))continue;const w=r(m.object);w.visible=c.autoUpdate?m===p:m.object.visible,l.addLevel(w,m.distance,m.hysteresis)}for(const m of a.children)!d.has(m)&&!Q(m)&&i.add(r(m))}else for(const l of a.children)Q(l)||i.add(r(l));return i},s=r(e);for(const[a,i]of n){const c=a.skeleton.clone();c.bones=a.skeleton.bones.map(l=>{const u=o.get(t.get(l)??l);if(!u?.isBone)throw new Error(`Asset preview could not map skeleton bone: ${l.name||l.uuid}`);return u}),i.skeleton=c,i.bindMode=a.bindMode,i.bindMatrix.copy(a.bindMatrix),i.bindMatrixInverse.copy(a.bindMatrixInverse)}return s}function Lt(e){const t=e;if(t.isSkinnedMesh)return new Ze(t.geometry,t.material);const o=e;if(o.isInstancedMesh){const i=new Je(o.geometry,o.material,o.count);return i.instanceMatrix.copy(o.instanceMatrix),i.instanceColor=o.instanceColor?o.instanceColor.clone():null,i.morphTexture=o.morphTexture,i}const n=e;if(n.isMesh)return new xe(n.geometry,n.material);const r=e;if(e.isLineSegments)return new Ke(r.geometry,r.material);if(e.isLineLoop)return new Qe(r.geometry,r.material);if(r.isLine)return new et(r.geometry,r.material);const s=e;if(s.isPoints)return new tt(s.geometry,s.material);const a=e;return a.isSprite?new nt(a.material):e.isLOD?new ot:e.isBone?new rt:e.isGroup?new Ee:new st}function Nt(e,t){t.name=e.name,t.up.copy(e.up),t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.copy(e.matrix),t.matrixWorld.copy(e.matrixWorld),t.matrixAutoUpdate=e.matrixAutoUpdate,t.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,t.visible=e.visible,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.frustumCulled=!1,t.renderOrder=e.renderOrder,t.layers.set(0),t.animations=[...e.animations];const o=e,n=t;o.morphTargetInfluences&&(o.morphTargetDictionary&&(n.morphTargetDictionary={...o.morphTargetDictionary}),n.morphTargetInfluences=[...o.morphTargetInfluences]);const r=e;r.isSprite&&t.center.copy(r.center)}function Q(e){const t=1<<ye;return!!(e.userData.editorHelper||e.userData.editorIcon||(e.layers.mask&t)!==0)}function G(e){const t=new Set;e.traverse(o=>{const n=o;n.isSkinnedMesh&&t.add(n.skeleton);const r=o;if(r.isInstancedMesh){const s=r.morphTexture;r.morphTexture=null,r.dispose(),r.morphTexture=s}});for(const o of t)o.dispose()}function vn(e){const t=e();let o;try{o=$(t.root),o.animations=[...t.animations??t.root.animations]}catch(r){try{t.dispose()}catch(s){throw new AggregateError([r,s],"Object3D preview snapshot creation and source cleanup both failed.")}throw r}let n=!1;return{root:o,dispose(){if(n)return;n=!0;const r=[];try{G(o)}catch(s){r.push(s)}try{t.dispose()}catch(s){r.push(s)}if(r.length===1)throw r[0];if(r.length>1)throw new AggregateError(r,"Object3D preview snapshot cleanup failed.")}}}function R(e,t="front"){se(e);const o=Pt(e,t);if(o.isEmpty())throw new Error("Asset preview source has no renderable bounds.");const n=o.getCenter(new b),r=o.getSize(new b);return{center:n,size:r,radius:Math.max(r.length()/2,.001)}}function se(e){e.parent?.updateWorldMatrix(!0,!1),e.updateMatrixWorld(!0)}function Pt(e,t){const o=new ve;return ae(e,Z(t),t==="perspective",n=>o.expandByPoint(n)),o}function Ut(e,t){const o=t.map(()=>Ce());return t.length===0||(se(e),ae(e,t[0],!1,n=>{for(let r=0;r<t.length;r++)Te(o[r],n,t[r])})),o}function Bt(e,t){const o=t.map(()=>0);let n=0;if(t.length===0)return{framed:o,total:n};se(e);const r=t.map(()=>Ce());let s=-1;const a=()=>{if(!(s<0)){n++;for(let i=0;i<t.length;i++)Et(r[i],t[i].window)&&o[i]++,mt(r[i])}};return ae(e,t[0].basis,!1,(i,c)=>{c!==s&&(a(),s=c);for(let l=0;l<t.length;l++)Te(r[l],i,t[l].basis)}),a(),{framed:o,total:n}}function ae(e,t,o,n){const r=new ve,s=new b,a=new b,i=new ee;let c=0;const l=u=>{if(!u.visible||u!==e&&je(u))return;if(z(u,"gaussianSplat")){r.copy(u.getBoundingBox()).applyMatrix4(u.matrixWorld);const w=c++;for(const f of[r.min.x,r.max.x])for(const E of[r.min.y,r.max.y])for(const v of[r.min.z,r.max.z])n(s.set(f,E,v),w)}const p=u;if(p.isLOD&&p.levels.length>0){const w=new Set(p.levels.map(f=>f.object));for(const f of p.levels)l(f.object);for(const f of u.children)w.has(f)||l(f);return}const d=u;if(d.isSprite&&d.material.visible){if(o&&!d.material.sizeAttenuation)throw new Error("Asset preview cannot deterministically frame a perspective Sprite with sizeAttenuation disabled.");const w=new b().setFromMatrixPosition(d.matrixWorld),f=new b().setFromMatrixScale(d.matrixWorld),E=Math.cos(d.material.rotation),v=Math.sin(d.material.rotation),x=c++;for(const A of[-d.center.x,1-d.center.x])for(const h of[-d.center.y,1-d.center.y]){const g=A*Math.abs(f.x),y=h*Math.abs(f.y),S=E*g-v*y,M=v*g+E*y;n(w.clone().addScaledVector(t.right,S).addScaledVector(t.up,M),x)}}const m=d.isSprite?void 0:u.geometry;if(m){const w=m.getAttribute("position");if(w){const f=Ft(u,m,w.count),E=Ot(u,f.length),v=Math.ceil(f.length/E),x=u;if(x.isInstancedMesh){const A=new xe(x.geometry,x.material);for(let h=0;h<x.count;h++)x.getMatrixAt(h,i),x.morphTexture&&x.getMorphAt(h,A),f.forEach((g,y)=>{A.getVertexPosition(g,a),a.applyMatrix4(i).applyMatrix4(x.matrixWorld),n(a,c+Math.floor(y/E))}),c+=v}else{const A=u;f.forEach((h,g)=>{A.isMesh?A.getVertexPosition(h,a):$t(u,m,h,a),a.applyMatrix4(u.matrixWorld),n(a,c+Math.floor(g/E))}),c+=v}}}for(const w of u.children)l(w)};l(e)}function Ft(e,t,o){const n=e.material;if(!n)return[];const r=t.index?.count??o,s=Math.max(0,t.drawRange.start),a=Math.min(r,Number.isFinite(t.drawRange.count)?s+t.drawRange.count:r),i=[];if(Array.isArray(n))for(const l of t.groups){const u=l.materialIndex??0;if(!n[u]?.visible)continue;const p=Math.max(s,l.start),d=Math.min(a,l.start+l.count);d>p&&i.push([p,d])}else n.visible&&a>s&&i.push([s,a]);const c=[];for(const[l,u]of i){const p=kt(e,u-l);for(let d=l;d<l+p;d++)c.push(t.index?t.index.getX(d):d)}return c}function Ot(e,t){return e.isMesh?3:e.isLineSegments?2:e.isLine?Math.max(t,1):1}function kt(e,t){return e.isMesh?t-t%3:e.isLineSegments?t-t%2:e.isLine?t>=2?t:0:t}function $t(e,t,o,n){const r=t.getAttribute("position");n.fromBufferAttribute(r,o);const s=t.morphAttributes.position,a=e.morphTargetInfluences;if(!s||!a)return n;const i=n.clone(),c=new b,l=new b;for(let u=0;u<s.length;u++){const p=a[u]??0;p!==0&&(l.fromBufferAttribute(s[u],o),t.morphTargetsRelative||l.sub(i),c.addScaledVector(l,p))}return n.add(c)}function Dt(e,t,o){const{center:n,size:r,radius:s}=t;let a=r.x,i=r.y;const c=Z(e),{direction:l,up:u}=c;e==="right"?a=r.z:e==="top"&&(a=r.x,i=r.z);const p=Re(a/2,i/2,o);return re(n,{direction:l,right:c.right,up:u},p,s*3+1,s*10+10)}function Y(e,t,o,n){const r=new Xe(35,t,.01,e.radius*20+20),s=O.degToRad(r.fov/2),a=Math.atan(Math.tan(s)*t),i=Z("perspective"),c=o?.clone().normalize()??i.direction,l=Math.abs(c.y)>.999?new b(0,0,1):new b(0,1,0),u=o?l.clone().cross(c).normalize():i.right,p=o?c.clone().cross(u).normalize():i.up,d=e.size.clone().multiplyScalar(.5);let m=0;for(const w of[-1,1])for(const f of[-1,1])for(const E of[-1,1]){const v=new b(w*d.x,f*d.y,E*d.z),x=v.dot(c);m=Math.max(m,x+Math.abs(v.dot(u))*H/Math.tan(a),x+Math.abs(v.dot(p))*H/Math.tan(s))}return r.position.copy(e.center).addScaledVector(c,Math.max(n??m,.01)),r.lookAt(e.center),r.updateProjectionMatrix(),r.updateMatrixWorld(!0),r}function Z(e){const t=e==="front"?new b(0,0,1):e==="right"?new b(1,0,0):e==="top"?new b(0,1,0):new b(1,.72,1).normalize(),n=(e==="top"?new b(0,0,-1):new b(0,1,0)).clone().cross(t).normalize(),r=t.clone().cross(n).normalize();return{direction:t,right:n,up:r}}function ie(e,t,o){return e==="perspective"?Y(t,o):Dt(e,t,o)}function he(e,t,o){return Y(e,t,o)}function Ue(e,t,o,n){const r=o.map(te),s=Ut(e,r),a=yt(s.map(c=>wt(c,n))),i=new Map;return o.forEach((c,l)=>{i.set(c,re(gt(s[l],r[l]),r[l],a,t.radius*3+1,t.radius*10+10))}),i}function _t(e,t,o={}){const n=T(o.width),r=T(o.height),s=o.background??"neutral",a=$(e);let i=null;try{const c=R(a,"perspective"),l=D(a,c),u=_(new W({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));i=u,u.setPixelRatio(1),u.outputColorSpace=V,u.toneMapping=j,u.toneMappingExposure=1,u.setClearColor(U,s==="transparent"?0:1),u.setSize(n,r,!1),q(l,u);const p=Math.atan2(t[0],t[2]),d=n/r,m=y=>new b(Math.sin(y),.72,Math.cos(y)).normalize(),w=[p,p+Math.PI,p-Math.PI/2,p+Math.PI/2],f=Ue(a,c,w,d),E=[{label:"front",camera:f.get(w[0])},{label:"back",camera:f.get(w[1])},{label:"left",camera:f.get(w[2])},{label:"right",camera:f.get(w[3])},{label:"quarter-left",camera:he(c,d,m(p-Math.PI/4))},{label:"quarter-right",camera:he(c,d,m(p+Math.PI/4))}],v=[],x=2,A=3,h=document.createElement("canvas");h.width=n*x,h.height=r*A;const g=h.getContext("2d");if(!g)throw new Error("Unable to create the source-review contact sheet.");return E.forEach(({label:y,camera:S},M)=>{u.render(l,S),v.push({label:y,base64:C(u.domElement),mimeType:"image/png"});const I=M%x*n,F=Math.floor(M/x)*r;g.drawImage(u.domElement,I,F,n,r);const ze=y==="quarter-left"?"3/4-L":y==="quarter-right"?"3/4-R":y.toUpperCase();P(g,ze,I,F,n,r)}),{width:n,height:r,shots:v,contactSheet:{width:n*x,height:r*A,base64:C(h),mimeType:"image/png"}}}finally{i&&X(i),i?.dispose(),i?.forceContextLoss(),G(a)}}function zt(e,t,o,n,r){const s=vt(e),a=bt(e,s,t,o,n,r),i=o*3+1;return re(s,t,a,i,i+o*4+1)}function fe(e,t){const o=new Map;e.traverse(a=>{const i=a;i.isBone&&a.name&&o.set(a.name,i)});const n=t.requiredBones??[],r=n.filter(a=>!o.has(a)),s=t.rigRequirementHint?` (${t.rigRequirementHint})`:"";if(n.length>0&&o.size===0)throw new Error(`Asset preview '--shots ${t.name}' requires a rigged GLB${s}, but this model has no skeleton at all. Required joints: ${n.join(", ")}.`);if(r.length>0)throw new Error(`Asset preview '--shots ${t.name}' requires joints this GLB's skeleton does not have${s}. Missing joint(s): ${r.join(", ")}.`);return o}function Wt(e,t,o){const n=o.filter(Ne);for(const r of o)if(Le(r)){const s=t.get(r.bone);if(!s)continue;r.axis==="x"?s.rotateX(r.radians):r.axis==="y"?s.rotateY(r.radians):s.rotateZ(r.radians)}else if(Pe(r)){const s=t.get(r.bone);if(!s)continue;r.axis==="x"?s.translateX(r.meters):r.axis==="y"?s.translateY(r.meters):s.translateZ(r.meters)}n.length!==0&&e.traverse(r=>{const s=r,a=s.morphTargetDictionary,i=s.morphTargetInfluences;if(!(!a||!i))for(const{morph:c,influence:l}of n){const u=a[c];u!==void 0&&(i[u]=l)}})}function Be(e){let t=null;return e.traverse(o=>{t||(t=ft(o.userData.forward))}),t??[0,0,1]}function ne(e,t){const o=new Ee;return o.rotation.y=Ae(t),o.add(e),o.updateMatrixWorld(!0),o}function D(e,t){const o=new it;o.add(e),o.add(new ct(16777215,3489874,1.8*He));const n=new J(16777215,2.2);n.position.copy(t.center).addScaledVector(new b(1,1.5,1),t.radius*3),o.add(n);const r=new J(12572671,.8);r.position.copy(t.center).addScaledVector(new b(-1,.5,-.7),t.radius*2),o.add(r);const s=new J(16773596,.45);return s.position.copy(t.center).addScaledVector(new b(.3,-1,.4),t.radius*2),o.add(s),o}let L=null;function me(){const e=L;L=null,e&&(X(e),e.dispose(),e.forceContextLoss())}function Vt(){if(L?.getContext().isContextLost()&&me(),!L){const e=_(new W({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));L=e,e.domElement.addEventListener("webglcontextlost",()=>{L===e&&me()})}return L}function Fe(e,t={}){let o=!1;if(e.traverse(i=>{z(i,"gaussianSplat")&&(o=!0)}),o)throw new Error("Gaussian-splat capture requires the async project-asset capture path so Spark can sort each view.");const n=T(t.width),r=T(t.height),s=t.background??"neutral",a=$(e);try{const i=Be(e);t.pose&&Gt(a,t.pose);const c=ne(a,i),l=ce(i),u=R(c,"perspective"),p=D(c,u),d=Vt();if(d.setPixelRatio(1),d.outputColorSpace=V,d.toneMapping=j,d.toneMappingExposure=1,d.setClearColor(U,s==="transparent"?0:1),q(p,d),t.camera)return Ht(d,p,Y(u,n/r,ge(t.camera),t.camera.distance),n,r,t.camera,l);const m=new Map;for(const f of k)m.set(f,ie(f,R(c,f),n/r));const w=Y(u,n/r,ge({azimuthDegrees:30,elevationDegrees:-60}));return ke(d,p,m,n,r,l,w)}finally{G(a)}}function jt(e,t,o){const n=Oe(t,o.yawDegrees);if(!n)return e;const r=document.createElement("canvas");r.width=e.width,r.height=e.height;const s=r.getContext("2d");if(!s)return e;s.drawImage(e,0,0);const a=Se(n.text,e.width,e.height),i=n.edge==="left"?0:e.width-a.width;return P(s,n.text,i,e.height-a.height,e.width,e.height),r}function ce(e){const t=Ae(e);return{forward:[e[0],e[1],e[2]],yawDegrees:Math.round(O.radToDeg(t))}}function Gt(e,t){if(!Number.isFinite(t.timeSeconds)||t.timeSeconds<0)throw new Error(`Asset preview pose time must be a finite number of seconds >= 0, got ${t.timeSeconds}.`);const o=e.animations??[],n=o.find(s=>s.name===t.clip);if(!n){const s=o.map(a=>`'${a.name}'`).join(", ");throw new Error(`Asset preview pose clip '${t.clip}' not found on the subject. `+(s?`Its clips are: ${s}.`:"The subject carries no animation clips at all — clips live on the model root (GLB animations, or a builder module’s `root.animations`)."))}const r=new at(e);r.clipAction(n).play(),r.update(t.timeSeconds),e.updateMatrixWorld(!0)}function ge(e){const t=O.degToRad(e.azimuthDegrees),o=O.degToRad(e.elevationDegrees);return new b(Math.sin(t)*Math.cos(o),Math.sin(o),Math.cos(t)*Math.cos(o)).normalize()}function Ht(e,t,o,n,r,s,a){e.setSize(n,r,!1),e.render(t,o);const i={view:"perspective",base64:C(e.domElement),mimeType:"image/png"},c=document.createElement("canvas");c.width=n,c.height=r;const l=c.getContext("2d");if(!l)throw new Error("Unable to create the asset preview contact sheet.");l.drawImage(e.domElement,0,0,n,r);const u=`AZ ${Math.round(s.azimuthDegrees)} EL ${Math.round(s.elevationDegrees)}`+(s.distance===void 0?"":` D ${Math.round(s.distance)}`);return P(l,u,0,0,n,r),{width:n,height:r,orientation:a,views:[i],contactSheet:{width:n,height:r,base64:C(c),mimeType:"image/png"}}}function Oe(e,t){if(e==="perspective")return null;const o=O.degToRad(t),n=Z(e).right.applyAxisAngle(new b(0,1,0),-o),r=[["X",new b(1,0,0)],["Y",new b(0,1,0)],["Z",new b(0,0,1)]];for(const[s,a]of r){const i=n.dot(a);if(i>.99)return{text:`+${s}>`,edge:"right"};if(i<-.99)return{text:`<+${s}`,edge:"left"}}return{text:`YAW ${t}`,edge:"left"}}function ke(e,t,o,n,r,s,a){const i=[],c=a?[...k,"below"]:[...k],l=a?3:2,u=n*l,p=r*2,d=document.createElement("canvas");d.width=u,d.height=p;const m=d.getContext("2d");if(!m)throw new Error("Unable to create the asset preview contact sheet.");e.getClearAlpha()>0&&(m.fillStyle=`#${new lt(U).getHexString()}`,m.fillRect(0,0,u,p)),e.setSize(n,r,!1),c.forEach((f,E)=>{const v=f==="below"?a:o.get(f);if(!v)return;e.render(t,v),i.push({view:f,base64:C(f==="below"?e.domElement:jt(e.domElement,f,s)),mimeType:"image/png"});const x=E%l,A=Math.floor(E/l),h=x*n,g=A*r;m.drawImage(e.domElement,h,g,n,r);const y=f==="perspective"?"3/4":f.toUpperCase();if(P(m,y,h,g,n,r),f==="below")return;const S=Oe(f,s.yawDegrees);if(S){const M=Se(S.text,n,r),I=S.edge==="left"?h:h+n-M.width;P(m,S.text,I,g+r-M.height,n,r)}});const w={width:u,height:p,base64:C(d),mimeType:"image/png"};return{width:n,height:r,orientation:s,views:i,contactSheet:w}}function xn(e,t,o={}){let n=!1;if(e.traverse(l=>{z(l,"gaussianSplat")&&(n=!0)}),n)throw new Error("Gaussian-splat capture requires the async project-asset capture path so Spark can sort each view.");const r=T(o.width),s=T(o.height),a=o.background??"neutral",i=[];let c=null;try{t.traverse(p=>{p.visible&&Ve(p)&&(p.visible=!1,i.push(p))});const l=new Map;for(const p of k){const d=ie(p,R(e,p),r/s);d.layers.enableAll(),d.layers.disable(ye),l.set(p,d)}const u=_(new W({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));return c=u,u.setPixelRatio(1),u.outputColorSpace=V,u.toneMapping=j,u.toneMappingExposure=1,u.setClearColor(U,a==="transparent"?0:1),ke(u,t,l,r,s,ce([0,0,1]))}finally{for(const l of i)l.visible=!0;c?.dispose(),c?.forceContextLoss()}}function Yt(e,t,o){const n=e.pose===void 0?"":` under pose '${e.pose}'`,r=e.view==="bone-zoom"?`bone-zoom on ${e.bones.join(", ")} at yaw ${(e.yaw??0).toFixed(3)}`:`turntable at yaw ${e.yaw.toFixed(3)}`,s=e.view==="bone-zoom"?"Zoom anchors are read from the REST skeleton for every shot, so a pose that MOVES the anchor leaves the crop behind where the joint used to be: re-aim the shot (another joint or yaw), widen its spanFraction, or drop it.":"Check the shot yaw and the pose it renders under.";return{label:e.label,reason:"empty-frame",...e.view==="bone-zoom"?{bones:[...e.bones]}:{},...e.pose===void 0?{}:{pose:e.pose},message:`Asset preview '--shots ${t}' shot ${JSON.stringify(e.label)} (${r}${n}) framed NONE of the subject's ${o} rendered faces: the image is background only and proves nothing about the asset. ${s}`}}function qt(e,t,o){const n=[],r=()=>{for(const s of n)G(s);n.length=0};try{const s=$(e);n.push(s);const a=fe(s,t),i=Be(e),c=ne(s,i),l=R(c,"perspective"),u=D(c,l),p={subject:c,scene:u,framing:l},d=new Map;for(const h of t.shots){if(h.pose===void 0||d.has(h.pose))continue;const g=t.poses?.[h.pose]??[],y=$(e);n.push(y);const S=fe(y,t);Wt(y,S,g),y.updateMatrixWorld(!0);const M=ne(y,i),I=R(M,"perspective");d.set(h.pose,{subject:M,scene:D(M,I),framing:I})}const m=h=>h===void 0?p:d.get(h),w=h=>new b().setFromMatrixPosition(a.get(h).matrixWorld),f=new Map;for(const h of new Set(t.shots.filter(g=>g.view==="turntable").map(g=>g.pose??void 0))){const g=m(h),y=[...new Set(t.shots.filter(S=>S.view==="turntable"&&(S.pose??void 0)===h).map(S=>S.yaw))];f.set(h,Ue(g.subject,g.framing,y,o))}const E=t.shots.map(h=>{const g=m(h.pose);if(h.view==="turntable")return{label:h.label,camera:f.get(h.pose??void 0).get(h.yaw),scene:g.scene,stage:g,basis:te(h.yaw)};const y=h.bones.find(M=>!a.has(M));if(y!==void 0)throw new Error(`Asset preview '--shots ${t.name}' shot ${JSON.stringify(h.label)} zooms on a joint this GLB's skeleton does not have: ${y}. List it in the definition's requiredBones or fix the rig.`);const S=te(h.yaw??0);return{label:h.label,camera:zt(h.bones.map(w),S,l.radius,h.spanFraction,o),scene:g.scene,stage:g,basis:S}}),v=[],x=new Map,A=new Map;E.forEach(({stage:h},g)=>{const y=A.get(h);y?y.push(g):A.set(h,[g])});for(const[h,g]of A){const{framed:y,total:S}=Bt(h.subject,g.map(M=>{const I=E[M];return{basis:I.basis,window:xt(I.camera,I.basis)}}));g.forEach((M,I)=>{if(y[I]!==0)return;const F=Yt(t.shots[M],t.name,S);x.set(M,F),v.push(F)})}return{shots:E.map(({label:h,camera:g,scene:y},S)=>{const M=x.get(S);return{label:h,camera:g,scene:y,...M?{warning:M}:{}}}),warnings:v,dispose:r}}catch(s){throw r(),s}}function $e(e,t,o={}){const n=T(o.width),r=T(o.height),s=o.background??"neutral",a=qt(e,t,n/r);let i=null;try{const c=_(new W({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));i=c,c.setPixelRatio(1),c.outputColorSpace=V,c.toneMapping=j,c.toneMappingExposure=1,c.setClearColor(U,s==="transparent"?0:1),c.setSize(n,r,!1);for(const v of a.shots)q(v.scene,c);const l=[],u=2,p=Math.ceil(a.shots.length/u),d=n*u,m=r*p,w=document.createElement("canvas");w.width=d,w.height=m;const f=w.getContext("2d");if(!f)throw new Error("Unable to create the asset preview contact sheet.");a.shots.forEach(({label:v,camera:x,scene:A,warning:h},g)=>{c.render(A,x),l.push({label:v,base64:C(c.domElement),mimeType:"image/png"});const y=g%u,S=Math.floor(g/u),M=y*n,I=S*r;f.drawImage(c.domElement,M,I,n,r),P(f,h?`${v.toUpperCase()} - EMPTY`:v.toUpperCase(),M,I,n,r,h?"warning":"normal")});const E={width:d,height:m,base64:C(w),mimeType:"image/png"};return{width:n,height:r,shots:l,warnings:a.warnings,contactSheet:E}}finally{i&&X(i),i?.dispose(),i?.forceContextLoss(),a.dispose()}}function Xt(e){const t=e.replace(/^\/?public(\/|$)/,"/");if(!t.startsWith("/")||t.startsWith("//")||t.includes("\\")||t.includes("?")||t.includes("#"))throw new Error("Model asset paths must be the served web path (project-root absolute, with public/ stripped): e.g. /models/generated/hero.glb");let o;try{o=decodeURIComponent(t)}catch{throw new Error("Asset Editor model path contains invalid URL encoding.")}if(o.split("/").some(s=>s==="."||s===".."))throw new Error("Asset Editor model paths cannot traverse outside the project root.");const n=globalThis.location?.origin??"http://localhost",r=new URL(t,n);if(r.origin!==n||!r.pathname.toLowerCase().match(/\.(?:glb|gltf|spz)$/))throw new Error("Asset Editor loads bounded, same-origin project .glb, .gltf, or .spz files only.");return r}async function De(e,t,o=N){const n=await fetch(e,{signal:t});if(!n.ok)throw new Error(`Unable to load project model (${n.status} ${n.statusText}).`);const r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>o)throw new Error(`Asset Editor project models must be ${N/1024/1024} MiB or less.`);if(!n.body){const u=await n.arrayBuffer();if(u.byteLength>o)throw new Error(`Asset Editor project models must be ${N/1024/1024} MiB or less.`);return u}const s=n.body.getReader(),a=[];let i=0;try{for(;;){const{done:u,value:p}=await s.read();if(u)break;if(i+=p.byteLength,i>o)throw await s.cancel(),new Error(`Asset Editor project models must be ${N/1024/1024} MiB or less.`);a.push(p)}}finally{s.releaseLock()}const c=new Uint8Array(i);let l=0;for(const u of a)c.set(u,l),l+=u.byteLength;return c.buffer}function we(e,t,o){return new Promise((n,r)=>{let s=!1;const a=c=>s?!1:(s=!0,o.removeEventListener("abort",i),c(),!0),i=()=>a(()=>r(o.reason));if(o.addEventListener("abort",i,{once:!0}),o.aborted){i();return}be.parse(e,new URL(".",t).href,c=>{c.scene.animations=[...c.animations],a(()=>n(c.scene))||B(c.scene)},c=>a(()=>r(c)))})}function Zt(e,t){if(e.includes("\\")||e.includes("?")||e.includes("#"))throw new Error("Asset Editor .gltf dependencies must be plain same-origin project paths.");const o=new URL(e,t);if(o.origin!==t.origin)throw new Error("Asset Editor .gltf dependencies must stay on the project origin.");return o}function Jt(e,t){if(typeof e.mimeType=="string")return e.mimeType;const o=t.pathname.split(".").pop()?.toLowerCase();return o==="png"?"image/png":o==="jpg"||o==="jpeg"?"image/jpeg":o==="webp"?"image/webp":"application/octet-stream"}async function Kt(e,t,o){let n;try{n=JSON.parse(new TextDecoder().decode(e))}catch{throw new Error("Asset Editor could not parse the project .gltf JSON document.")}const r=[...Array.isArray(n.buffers)?n.buffers:[],...Array.isArray(n.images)?n.images:[]];let s=e.byteLength;for(const a of r){if(typeof a.uri!="string"||a.uri.startsWith("data:"))continue;const i=Zt(a.uri,t),c=await De(i,o,N-s);s+=c.byteLength;const l=new Uint8Array(c);let u="";for(let p=0;p<l.length;p+=32768)u+=String.fromCharCode(...l.subarray(p,p+32768));a.uri=`data:${Jt(a,i)};base64,${btoa(u)}`}return JSON.stringify(n)}function _e(e,t){let o;try{const n=atob(e);o=new Uint8Array(n.length);for(let r=0;r<n.length;r++)o[r]=n.charCodeAt(r)}catch{throw new Error(`${t} is not valid base64.`)}if(o.byteLength===0||o.byteLength>N)throw new Error(`${t} must be non-empty and at most ${N/1024/1024} MiB.`);return new Promise((n,r)=>{be.parse(o.buffer,"",s=>{s.scene.animations=[...s.animations],n(s.scene)},s=>r(s instanceof Error?s:new Error(String(s))))})}async function En(e,t={}){const o=await _e(e,"Asset preview GLB bytes");try{return Fe(o,t)}finally{B(o)}}async function Sn(e,t,o={}){const n=await _e(e,"Asset preview GLB bytes");try{return $e(n,t,o)}finally{B(n)}}async function Qt(e,t){const o=Xt(e),n=new AbortController,r=()=>n.abort(t?.reason);t?.aborted?r():t?.addEventListener("abort",r,{once:!0});const s=globalThis.setTimeout(()=>n.abort(new Error("Asset Editor project model load timed out after 25 seconds.")),It);try{const a=await De(o,n.signal);if(n.signal.throwIfAborted(),o.pathname.toLowerCase().endsWith(".spz"))return{root:await Ge(e,new Uint8Array(a)),sourceBytes:null};if(o.pathname.toLowerCase().endsWith(".glb")){const c=new Uint8Array(a.slice(0));return{root:await we(a,o,n.signal),sourceBytes:c}}const i=await Kt(a,o,n.signal);return{root:await we(i,o,n.signal),sourceBytes:null}}finally{globalThis.clearTimeout(s),t?.removeEventListener("abort",r)}}async function le(e,t){return(await Qt(e,t)).root}function B(e){z(e,"gaussianSplat")&&e.dispose(),G(e),e.traverse(t=>{const o=t;o.isInstancedMesh&&o.morphTexture?.dispose();const n=t;if(n.geometry?.dispose(),!n.material)return;const r=Array.isArray(n.material)?n.material:[n.material];for(const s of r){for(const a of Object.values(s))a instanceof qe&&a.dispose();s.dispose()}})}async function Mn(e,t={}){const o=await le(e);try{return z(o,"gaussianSplat")?await en(o,t):Fe(o,t)}finally{B(o)}}async function An(e,t,o={}){const n=await le(e);try{return _t(n,t,o)}finally{B(n)}}async function en(e,t){const o=T(t.width),n=T(t.height),r=t.background??"neutral",s=R(e,"perspective"),a=D(e,s),i=_(new W({antialias:!1,alpha:!0,preserveDrawingBuffer:!0}));let c=null;try{const l=await We(()=>import("./spark.module-Byplgb8G.js"),__vite__mapDeps([0,1,2,3]));c=new l.SparkRenderer({renderer:i,autoUpdate:!1,enableLod:!1}),a.add(c),i.setPixelRatio(1),i.outputColorSpace=V,i.toneMapping=j,i.toneMappingExposure=1,i.setClearColor(U,r==="transparent"?0:1),i.setSize(o,n,!1),q(a,i);const u=[],p=document.createElement("canvas");p.width=o*2,p.height=n*2;const d=p.getContext("2d");if(!d)throw new Error("Unable to create the asset preview contact sheet.");for(const[m,w]of k.entries()){const f=ie(w,R(e,w),o/n);await c.update({scene:a,camera:f}),i.render(a,f),u.push({view:w,base64:C(i.domElement),mimeType:"image/png"});const E=m%2*o,v=Math.floor(m/2)*n;d.drawImage(i.domElement,E,v,o,n),P(d,w==="perspective"?"3/4":w.toUpperCase(),E,v,o,n)}return{width:o,height:n,orientation:ce([0,0,1]),views:u,contactSheet:{width:o*2,height:n*2,base64:C(p),mimeType:"image/png"}}}finally{c?.removeFromParent(),e.removeFromParent(),c?.dispose(),X(i),i.dispose(),i.forceContextLoss()}}async function In(e,t,o={}){const n=await le(e);try{return $e(n,t,o)}finally{B(n)}}export{pn as A,An as B,dn as C,_t as D,xn as E,En as F,Fe as a,$ as b,Mn as c,B as d,bn as e,G as f,vn as g,le as h,he as i,T as j,C as k,Qt as l,R as m,mn as n,gn as o,_e as p,Ae as q,Be as r,fn as s,wn as t,hn as u,yn as v,ft as w,Sn as x,In as y,$e as z};
2
+ import{_ as We}from"./index-DaRQxpdW.js";import{EDITOR_LAYER as ye,isEditorOwnedObject as Ve}from"./editor-layers-Dsfzcx0b.js";import{m as _}from"./renderer-ownership-BovSEcLv.js";import{i as je}from"./hierarchy-marks-CmVlgczH.js";import{l as Ge,g as be,a as q,d as X,S as He}from"./studio-environment-BSd_1eWm.js";import{h as z}from"./user-data-BVjl5VSz.js";import{W}from"./three.module-BLhyNg0e.js";import{d5 as Ye,fo as b,eW as qe,cm as ee,I as ve,d9 as Xe,cj as O,ev as Ze,bu as Je,co as xe,c0 as Ke,b$ as Qe,bV as et,df as tt,eE as nt,bK as ot,F as rt,bh as Ee,cW as st,ej as V,A as j,n as at,el as it,bj as ct,aE as J,_ as lt}from"./three.core-3arARmh6.js";import{d as P,m as Se}from"./bitmap-label-Ct4k6ehY.js";const pn=["front","side"],Me=1,dn=.55,hn=Me/2,K=128,ut=[24,26,31],pt=[235,137,52],dt=[56,189,248],ht=[236,240,238];function fn(e,t){if(e.length<t*4)throw new Error(`Silhouette mask expected ${t*4} RGBA bytes but received ${e.length}.`);const o=new Uint8Array(t);for(let n=0;n<t;n++){const r=n*4,s=e[r]>=K||e[r+1]>=K||e[r+2]>=K;o[n]=s?1:0}return o}function mn(e,t){if(e.length!==t.length)throw new Error(`Mask IoU requires equal-size masks (${e.length} vs ${t.length}).`);let o=0,n=0,r=0;for(let a=0;a<e.length;a++){const i=e[a]!==0,c=t[a]!==0;i&&n++,c&&r++,i&&c&&o++}const s=n+r-o;return{intersection:o,union:s,aCount:n,bCount:r,iou:s===0?0:o/s}}function gn(e,t){if(e.length!==t.length)throw new Error(`Overlay requires equal-size masks (${e.length} vs ${t.length}).`);const o=new Uint8ClampedArray(e.length*4);for(let n=0;n<e.length;n++){const r=e[n]!==0,s=t[n]!==0,a=r&&s?ht:r?pt:s?dt:ut,i=n*4;o[i]=a[0],o[i+1]=a[1],o[i+2]=a[2],o[i+3]=255}return o}function ft(e){if(!Array.isArray(e)||e.length!==3)return null;const[t,o,n]=e;return typeof t!="number"||typeof o!="number"||typeof n!="number"||!Number.isFinite(t)||!Number.isFinite(o)||!Number.isFinite(n)||Math.hypot(t,n)<1e-6?null:[t,o,n]}function Ae(e){const[t,,o]=e;if(!Number.isFinite(t)||!Number.isFinite(o)||Math.hypot(t,o)<1e-6)throw new Error(`Cannot derive a facing from forward vector [${e.join(", ")}].`);return Math.atan2(t,o)}function wn(e,t,o=Me){const n=t[1]-e[1];if(!Number.isFinite(n)||n<=0)throw new Error(`Compare normalization needs positive model height, got ${n}.`);const r=o/n,s=(e[0]+t[0])/2,a=(e[2]+t[2])/2;return{scale:r,position:[-s*r,-e[1]*r,-a*r]}}const H=1.2,Ie=.001;function te(e){const t=new b(Math.sin(e),0,Math.cos(e)),n=new b(0,1,0).clone().cross(t).normalize(),r=t.clone().cross(n).normalize();return{direction:t,right:n,up:r}}function Ce(){return{minRight:Number.POSITIVE_INFINITY,maxRight:Number.NEGATIVE_INFINITY,minUp:Number.POSITIVE_INFINITY,maxUp:Number.NEGATIVE_INFINITY,minDepth:Number.POSITIVE_INFINITY,maxDepth:Number.NEGATIVE_INFINITY}}function oe(e){return e.maxRight<e.minRight}function mt(e){e.minRight=Number.POSITIVE_INFINITY,e.maxRight=Number.NEGATIVE_INFINITY,e.minUp=Number.POSITIVE_INFINITY,e.maxUp=Number.NEGATIVE_INFINITY,e.minDepth=Number.POSITIVE_INFINITY,e.maxDepth=Number.NEGATIVE_INFINITY}function Te(e,t,o){const n=t.dot(o.right),r=t.dot(o.up),s=t.dot(o.direction);n<e.minRight&&(e.minRight=n),n>e.maxRight&&(e.maxRight=n),r<e.minUp&&(e.minUp=r),r>e.maxUp&&(e.maxUp=r),s<e.minDepth&&(e.minDepth=s),s>e.maxDepth&&(e.maxDepth=s)}function gt(e,t){if(oe(e))throw new Error("Asset preview cannot frame an empty projected span.");return new b().addScaledVector(t.right,(e.minRight+e.maxRight)/2).addScaledVector(t.up,(e.minUp+e.maxUp)/2).addScaledVector(t.direction,(e.minDepth+e.maxDepth)/2)}function Re(e,t,o,n=H){const r=Math.max(t,e/o,Ie)*n;return{halfHeight:r,halfWidth:r*o}}function wt(e,t,o=H){if(oe(e))throw new Error("Asset preview cannot frame an empty projected span.");return Re((e.maxRight-e.minRight)/2,(e.maxUp-e.minUp)/2,t,o)}function yt(e){if(e.length===0)throw new Error("Asset preview cannot union an empty set of frames.");let t=0,o=0;for(const n of e)t=Math.max(t,n.halfWidth),o=Math.max(o,n.halfHeight);return{halfWidth:t,halfHeight:o}}function bt(e,t,o,n,r,s){const a=Math.max(n*r,Ie);let i=a,c=a;const l=new b;for(const u of e)l.copy(u).sub(t),i=Math.max(i,Math.abs(l.dot(o.right))+a),c=Math.max(c,Math.abs(l.dot(o.up))+a);return i=Math.max(i,c*s),c=Math.max(c,i/s),{halfWidth:i,halfHeight:c}}function vt(e){if(e.length===0)throw new Error("Asset preview cannot centre a bone-zoom crop on zero anchors.");const t=new b;for(const o of e)t.add(o);return t.multiplyScalar(1/e.length)}function xt(e,t){const o=e.position.dot(t.right),n=e.position.dot(t.up),r=e.position.dot(t.direction),s=e.zoom||1;return{minRight:o+e.left/s,maxRight:o+e.right/s,minUp:n+e.bottom/s,maxUp:n+e.top/s,minDepth:r-e.far,maxDepth:r-e.near}}function Et(e,t){return oe(e)?!1:e.maxRight>=t.minRight&&e.minRight<=t.maxRight&&e.maxUp>=t.minUp&&e.minUp<=t.maxUp&&e.maxDepth>=t.minDepth&&e.minDepth<=t.maxDepth}function re(e,t,o,n,r){const s=new Ye(-o.halfWidth,o.halfWidth,o.halfHeight,-o.halfHeight,.01,r);return s.position.copy(e).addScaledVector(t.direction,n),s.up.copy(t.up),s.lookAt(e),s.updateProjectionMatrix(),s.updateMatrixWorld(!0),s}const k=["front","right","top","perspective"],ue=24;function Le(e){const t=e;return typeof t=="object"&&t!==null&&typeof t.bone=="string"&&t.bone.length>0&&(t.axis==="x"||t.axis==="y"||t.axis==="z")&&typeof t.radians=="number"&&Number.isFinite(t.radians)}function Ne(e){const t=e;return typeof t=="object"&&t!==null&&typeof t.morph=="string"&&t.morph.length>0&&typeof t.influence=="number"&&Number.isFinite(t.influence)}function Pe(e){const t=e;return typeof t=="object"&&t!==null&&typeof t.bone=="string"&&t.bone.length>0&&(t.axis==="x"||t.axis==="y"||t.axis==="z")&&typeof t.meters=="number"&&Number.isFinite(t.meters)}function St(e){return Le(e)||Ne(e)||Pe(e)}function Mt(e,t){const o=e;if(typeof o!="object"||o===null||typeof o.label!="string"||!/^[a-z0-9][a-z0-9-]*$/i.test(o.label)||o.pose!==void 0&&(typeof o.pose!="string"||!t.has(o.pose)))return!1;if(o.view==="turntable")return typeof o.yaw=="number"&&Number.isFinite(o.yaw);if(o.view==="bone-zoom"){const n=o;return n.yaw!==void 0&&(typeof n.yaw!="number"||!Number.isFinite(n.yaw))?!1:Array.isArray(n.bones)&&n.bones.length>0&&n.bones.every(r=>typeof r=="string"&&r.length>0)&&typeof n.spanFraction=="number"&&Number.isFinite(n.spanFraction)&&n.spanFraction>0&&n.spanFraction<=2}return!1}function yn(e){const t=c=>{throw new Error(`Asset preview shot-set definition is invalid: ${c}`)},o=e;(typeof o!="object"||o===null)&&t("expected an object.");const n=o;(typeof n.name!="string"||!/^[a-z0-9][a-z0-9-]*$/i.test(n.name))&&t("`name` must be a short alphanumeric/dash identifier."),n.requiredBones!==void 0&&(!Array.isArray(n.requiredBones)||n.requiredBones.some(c=>typeof c!="string"||c.length===0))&&t("`requiredBones` must be an array of non-empty bone names."),n.rigRequirementHint!==void 0&&typeof n.rigRequirementHint!="string"&&t("`rigRequirementHint` must be a string.");const r=n.poses??{};(typeof r!="object"||r===null||Array.isArray(r))&&t("`poses` must be an object of named pose-step lists.");for(const[c,l]of Object.entries(r))(!Array.isArray(l)||!l.every(St))&&t(`pose ${JSON.stringify(c)} must be an array of {bone, axis, radians} and/or {morph, influence}.`);const s=new Set(Object.keys(r));(!Array.isArray(n.shots)||n.shots.length===0||n.shots.length>ue)&&t(`\`shots\` must list 1-${ue} shots.`);const a=n.shots,i=new Set;for(const c of a){Mt(c,s)||t('every shot needs a label plus either {view:"turntable", yaw} or {view:"bone-zoom", bones, spanFraction, yaw?}, with every `yaw` a finite number of radians and `pose` naming a declared pose.');const{label:l}=c;i.has(l)&&t(`duplicate shot label ${JSON.stringify(l)}.`),i.add(l)}return n}const At=512,pe=64,de=1024,U=2106410,It=25e3,N=64*1024*1024;function T(e){const t=e??At;if(!Number.isInteger(t)||t<pe||t>de)throw new Error(`Asset preview dimensions must be integers from ${pe} to ${de}.`);return t}function C(e){const t=e.toDataURL("image/png"),o=t.indexOf(",");return o>=0?t.slice(o+1):t}function bn(e){const t=new Set;e.traverse(n=>t.add(n));let o=e;return e.traverse(n=>{const r=n;if(!(!r.isSkinnedMesh||!r.skeleton))for(const s of r.skeleton.bones){if(!s||t.has(s))continue;const a=new Set;for(let c=o;c;c=c.parent)a.add(c);let i=null;for(let c=s;c;c=c.parent)if(a.has(c)){i=c;break}i&&i!==o&&(o=i,o.traverse(c=>t.add(c)))}}),o}function $(e){const t=new Set;e.traverse(a=>{t.add(a)});const o=Tt(e,t),n=Rt(e,o),r=Ct(e);n.matrix.copy(r),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixAutoUpdate=!1,n.matrixWorld.copy(r),n.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,n.visible=!0;const s=[];n.traverse(a=>{a!==n&&a.userData.editorHelper&&s.push(a)});for(const a of s)a.parent?.remove(a);return n}function Ct(e){const t=[];let o=e;for(;o;)t.push(o),o=o.parent;const n=t.findIndex(i=>!i.matrixWorldAutoUpdate),r=n>=0?t[n].matrixWorld.clone():new ee,s=new ee,a=n>=0?n-1:t.length-1;for(let i=a;i>=0;i--){const c=t[i];c.matrixAutoUpdate?s.compose(c.position,c.quaternion,c.scale):s.copy(c.matrix),r.multiply(s)}return r}function Tt(e,t){const o=new Map,n=new Map;let r=null;const s=()=>{if(r)return r;const a=new Map;for(const i of t){const c=i;if(!c.isBone||c.name==="")continue;const l=a.get(c.name);l?l.push(c):a.set(c.name,[c])}return r=a,a};if(e.traverse(a=>{const i=a;if(!i.isSkinnedMesh)return;const c=i.name||i.uuid;for(const l of i.skeleton.bones){if(l&&t.has(l)||l&&o.has(l))continue;const u=l?s().get(l.name)??[]:[];if(u.length===1){o.set(l,u[0]);continue}const p=l?.name||"(unnamed bone)";n.set(`${c} -> ${p}`,{mesh:c,bone:p,sameNamed:u.length})}}),n.size>0){const a=[...n.values()].map(({mesh:i,bone:c,sameNamed:l})=>l>1?`${i} -> ${c} (${l} bones inside the selection share that name — which one is meant is ambiguous)`:`${i} -> ${c} (no bone of that name inside the selection)`).join("; ");throw new Error(`Asset preview selection references bones outside its hierarchy that it cannot bind to: ${a}. Select the complete skeleton root — the node that owns both the skinned mesh and its bones.`)}return o}function Rt(e,t=new Map){const o=new Map,n=[],r=a=>{const i=Lt(a);o.set(a,i),Nt(a,i),a.isSkinnedMesh&&n.push([a,i]);const c=a;if(c.isLOD){const l=i,u=c.levels.filter(m=>m.object.visible),p=u.length===1?u[0]:c.levels[0];l.autoUpdate=!1;const d=new Set(c.levels.map(m=>m.object));for(const m of c.levels){if(Q(m.object))continue;const w=r(m.object);w.visible=c.autoUpdate?m===p:m.object.visible,l.addLevel(w,m.distance,m.hysteresis)}for(const m of a.children)!d.has(m)&&!Q(m)&&i.add(r(m))}else for(const l of a.children)Q(l)||i.add(r(l));return i},s=r(e);for(const[a,i]of n){const c=a.skeleton.clone();c.bones=a.skeleton.bones.map(l=>{const u=o.get(t.get(l)??l);if(!u?.isBone)throw new Error(`Asset preview could not map skeleton bone: ${l.name||l.uuid}`);return u}),i.skeleton=c,i.bindMode=a.bindMode,i.bindMatrix.copy(a.bindMatrix),i.bindMatrixInverse.copy(a.bindMatrixInverse)}return s}function Lt(e){const t=e;if(t.isSkinnedMesh)return new Ze(t.geometry,t.material);const o=e;if(o.isInstancedMesh){const i=new Je(o.geometry,o.material,o.count);return i.instanceMatrix.copy(o.instanceMatrix),i.instanceColor=o.instanceColor?o.instanceColor.clone():null,i.morphTexture=o.morphTexture,i}const n=e;if(n.isMesh)return new xe(n.geometry,n.material);const r=e;if(e.isLineSegments)return new Ke(r.geometry,r.material);if(e.isLineLoop)return new Qe(r.geometry,r.material);if(r.isLine)return new et(r.geometry,r.material);const s=e;if(s.isPoints)return new tt(s.geometry,s.material);const a=e;return a.isSprite?new nt(a.material):e.isLOD?new ot:e.isBone?new rt:e.isGroup?new Ee:new st}function Nt(e,t){t.name=e.name,t.up.copy(e.up),t.position.copy(e.position),t.quaternion.copy(e.quaternion),t.scale.copy(e.scale),t.matrix.copy(e.matrix),t.matrixWorld.copy(e.matrixWorld),t.matrixAutoUpdate=e.matrixAutoUpdate,t.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,t.visible=e.visible,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.frustumCulled=!1,t.renderOrder=e.renderOrder,t.layers.set(0),t.animations=[...e.animations];const o=e,n=t;o.morphTargetInfluences&&(o.morphTargetDictionary&&(n.morphTargetDictionary={...o.morphTargetDictionary}),n.morphTargetInfluences=[...o.morphTargetInfluences]);const r=e;r.isSprite&&t.center.copy(r.center)}function Q(e){const t=1<<ye;return!!(e.userData.editorHelper||e.userData.editorIcon||(e.layers.mask&t)!==0)}function G(e){const t=new Set;e.traverse(o=>{const n=o;n.isSkinnedMesh&&t.add(n.skeleton);const r=o;if(r.isInstancedMesh){const s=r.morphTexture;r.morphTexture=null,r.dispose(),r.morphTexture=s}});for(const o of t)o.dispose()}function vn(e){const t=e();let o;try{o=$(t.root),o.animations=[...t.animations??t.root.animations]}catch(r){try{t.dispose()}catch(s){throw new AggregateError([r,s],"Object3D preview snapshot creation and source cleanup both failed.")}throw r}let n=!1;return{root:o,dispose(){if(n)return;n=!0;const r=[];try{G(o)}catch(s){r.push(s)}try{t.dispose()}catch(s){r.push(s)}if(r.length===1)throw r[0];if(r.length>1)throw new AggregateError(r,"Object3D preview snapshot cleanup failed.")}}}function R(e,t="front"){se(e);const o=Pt(e,t);if(o.isEmpty())throw new Error("Asset preview source has no renderable bounds.");const n=o.getCenter(new b),r=o.getSize(new b);return{center:n,size:r,radius:Math.max(r.length()/2,.001)}}function se(e){e.parent?.updateWorldMatrix(!0,!1),e.updateMatrixWorld(!0)}function Pt(e,t){const o=new ve;return ae(e,Z(t),t==="perspective",n=>o.expandByPoint(n)),o}function Ut(e,t){const o=t.map(()=>Ce());return t.length===0||(se(e),ae(e,t[0],!1,n=>{for(let r=0;r<t.length;r++)Te(o[r],n,t[r])})),o}function Bt(e,t){const o=t.map(()=>0);let n=0;if(t.length===0)return{framed:o,total:n};se(e);const r=t.map(()=>Ce());let s=-1;const a=()=>{if(!(s<0)){n++;for(let i=0;i<t.length;i++)Et(r[i],t[i].window)&&o[i]++,mt(r[i])}};return ae(e,t[0].basis,!1,(i,c)=>{c!==s&&(a(),s=c);for(let l=0;l<t.length;l++)Te(r[l],i,t[l].basis)}),a(),{framed:o,total:n}}function ae(e,t,o,n){const r=new ve,s=new b,a=new b,i=new ee;let c=0;const l=u=>{if(!u.visible||u!==e&&je(u))return;if(z(u,"gaussianSplat")){r.copy(u.getBoundingBox()).applyMatrix4(u.matrixWorld);const w=c++;for(const f of[r.min.x,r.max.x])for(const E of[r.min.y,r.max.y])for(const v of[r.min.z,r.max.z])n(s.set(f,E,v),w)}const p=u;if(p.isLOD&&p.levels.length>0){const w=new Set(p.levels.map(f=>f.object));for(const f of p.levels)l(f.object);for(const f of u.children)w.has(f)||l(f);return}const d=u;if(d.isSprite&&d.material.visible){if(o&&!d.material.sizeAttenuation)throw new Error("Asset preview cannot deterministically frame a perspective Sprite with sizeAttenuation disabled.");const w=new b().setFromMatrixPosition(d.matrixWorld),f=new b().setFromMatrixScale(d.matrixWorld),E=Math.cos(d.material.rotation),v=Math.sin(d.material.rotation),x=c++;for(const A of[-d.center.x,1-d.center.x])for(const h of[-d.center.y,1-d.center.y]){const g=A*Math.abs(f.x),y=h*Math.abs(f.y),S=E*g-v*y,M=v*g+E*y;n(w.clone().addScaledVector(t.right,S).addScaledVector(t.up,M),x)}}const m=d.isSprite?void 0:u.geometry;if(m){const w=m.getAttribute("position");if(w){const f=Ft(u,m,w.count),E=Ot(u,f.length),v=Math.ceil(f.length/E),x=u;if(x.isInstancedMesh){const A=new xe(x.geometry,x.material);for(let h=0;h<x.count;h++)x.getMatrixAt(h,i),x.morphTexture&&x.getMorphAt(h,A),f.forEach((g,y)=>{A.getVertexPosition(g,a),a.applyMatrix4(i).applyMatrix4(x.matrixWorld),n(a,c+Math.floor(y/E))}),c+=v}else{const A=u;f.forEach((h,g)=>{A.isMesh?A.getVertexPosition(h,a):$t(u,m,h,a),a.applyMatrix4(u.matrixWorld),n(a,c+Math.floor(g/E))}),c+=v}}}for(const w of u.children)l(w)};l(e)}function Ft(e,t,o){const n=e.material;if(!n)return[];const r=t.index?.count??o,s=Math.max(0,t.drawRange.start),a=Math.min(r,Number.isFinite(t.drawRange.count)?s+t.drawRange.count:r),i=[];if(Array.isArray(n))for(const l of t.groups){const u=l.materialIndex??0;if(!n[u]?.visible)continue;const p=Math.max(s,l.start),d=Math.min(a,l.start+l.count);d>p&&i.push([p,d])}else n.visible&&a>s&&i.push([s,a]);const c=[];for(const[l,u]of i){const p=kt(e,u-l);for(let d=l;d<l+p;d++)c.push(t.index?t.index.getX(d):d)}return c}function Ot(e,t){return e.isMesh?3:e.isLineSegments?2:e.isLine?Math.max(t,1):1}function kt(e,t){return e.isMesh?t-t%3:e.isLineSegments?t-t%2:e.isLine?t>=2?t:0:t}function $t(e,t,o,n){const r=t.getAttribute("position");n.fromBufferAttribute(r,o);const s=t.morphAttributes.position,a=e.morphTargetInfluences;if(!s||!a)return n;const i=n.clone(),c=new b,l=new b;for(let u=0;u<s.length;u++){const p=a[u]??0;p!==0&&(l.fromBufferAttribute(s[u],o),t.morphTargetsRelative||l.sub(i),c.addScaledVector(l,p))}return n.add(c)}function Dt(e,t,o){const{center:n,size:r,radius:s}=t;let a=r.x,i=r.y;const c=Z(e),{direction:l,up:u}=c;e==="right"?a=r.z:e==="top"&&(a=r.x,i=r.z);const p=Re(a/2,i/2,o);return re(n,{direction:l,right:c.right,up:u},p,s*3+1,s*10+10)}function Y(e,t,o,n){const r=new Xe(35,t,.01,e.radius*20+20),s=O.degToRad(r.fov/2),a=Math.atan(Math.tan(s)*t),i=Z("perspective"),c=o?.clone().normalize()??i.direction,l=Math.abs(c.y)>.999?new b(0,0,1):new b(0,1,0),u=o?l.clone().cross(c).normalize():i.right,p=o?c.clone().cross(u).normalize():i.up,d=e.size.clone().multiplyScalar(.5);let m=0;for(const w of[-1,1])for(const f of[-1,1])for(const E of[-1,1]){const v=new b(w*d.x,f*d.y,E*d.z),x=v.dot(c);m=Math.max(m,x+Math.abs(v.dot(u))*H/Math.tan(a),x+Math.abs(v.dot(p))*H/Math.tan(s))}return r.position.copy(e.center).addScaledVector(c,Math.max(n??m,.01)),r.lookAt(e.center),r.updateProjectionMatrix(),r.updateMatrixWorld(!0),r}function Z(e){const t=e==="front"?new b(0,0,1):e==="right"?new b(1,0,0):e==="top"?new b(0,1,0):new b(1,.72,1).normalize(),n=(e==="top"?new b(0,0,-1):new b(0,1,0)).clone().cross(t).normalize(),r=t.clone().cross(n).normalize();return{direction:t,right:n,up:r}}function ie(e,t,o){return e==="perspective"?Y(t,o):Dt(e,t,o)}function he(e,t,o){return Y(e,t,o)}function Ue(e,t,o,n){const r=o.map(te),s=Ut(e,r),a=yt(s.map(c=>wt(c,n))),i=new Map;return o.forEach((c,l)=>{i.set(c,re(gt(s[l],r[l]),r[l],a,t.radius*3+1,t.radius*10+10))}),i}function _t(e,t,o={}){const n=T(o.width),r=T(o.height),s=o.background??"neutral",a=$(e);let i=null;try{const c=R(a,"perspective"),l=D(a,c),u=_(new W({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));i=u,u.setPixelRatio(1),u.outputColorSpace=V,u.toneMapping=j,u.toneMappingExposure=1,u.setClearColor(U,s==="transparent"?0:1),u.setSize(n,r,!1),q(l,u);const p=Math.atan2(t[0],t[2]),d=n/r,m=y=>new b(Math.sin(y),.72,Math.cos(y)).normalize(),w=[p,p+Math.PI,p-Math.PI/2,p+Math.PI/2],f=Ue(a,c,w,d),E=[{label:"front",camera:f.get(w[0])},{label:"back",camera:f.get(w[1])},{label:"left",camera:f.get(w[2])},{label:"right",camera:f.get(w[3])},{label:"quarter-left",camera:he(c,d,m(p-Math.PI/4))},{label:"quarter-right",camera:he(c,d,m(p+Math.PI/4))}],v=[],x=2,A=3,h=document.createElement("canvas");h.width=n*x,h.height=r*A;const g=h.getContext("2d");if(!g)throw new Error("Unable to create the source-review contact sheet.");return E.forEach(({label:y,camera:S},M)=>{u.render(l,S),v.push({label:y,base64:C(u.domElement),mimeType:"image/png"});const I=M%x*n,F=Math.floor(M/x)*r;g.drawImage(u.domElement,I,F,n,r);const ze=y==="quarter-left"?"3/4-L":y==="quarter-right"?"3/4-R":y.toUpperCase();P(g,ze,I,F,n,r)}),{width:n,height:r,shots:v,contactSheet:{width:n*x,height:r*A,base64:C(h),mimeType:"image/png"}}}finally{i&&X(i),i?.dispose(),i?.forceContextLoss(),G(a)}}function zt(e,t,o,n,r){const s=vt(e),a=bt(e,s,t,o,n,r),i=o*3+1;return re(s,t,a,i,i+o*4+1)}function fe(e,t){const o=new Map;e.traverse(a=>{const i=a;i.isBone&&a.name&&o.set(a.name,i)});const n=t.requiredBones??[],r=n.filter(a=>!o.has(a)),s=t.rigRequirementHint?` (${t.rigRequirementHint})`:"";if(n.length>0&&o.size===0)throw new Error(`Asset preview '--shots ${t.name}' requires a rigged GLB${s}, but this model has no skeleton at all. Required joints: ${n.join(", ")}.`);if(r.length>0)throw new Error(`Asset preview '--shots ${t.name}' requires joints this GLB's skeleton does not have${s}. Missing joint(s): ${r.join(", ")}.`);return o}function Wt(e,t,o){const n=o.filter(Ne);for(const r of o)if(Le(r)){const s=t.get(r.bone);if(!s)continue;r.axis==="x"?s.rotateX(r.radians):r.axis==="y"?s.rotateY(r.radians):s.rotateZ(r.radians)}else if(Pe(r)){const s=t.get(r.bone);if(!s)continue;r.axis==="x"?s.translateX(r.meters):r.axis==="y"?s.translateY(r.meters):s.translateZ(r.meters)}n.length!==0&&e.traverse(r=>{const s=r,a=s.morphTargetDictionary,i=s.morphTargetInfluences;if(!(!a||!i))for(const{morph:c,influence:l}of n){const u=a[c];u!==void 0&&(i[u]=l)}})}function Be(e){let t=null;return e.traverse(o=>{t||(t=ft(o.userData.forward))}),t??[0,0,1]}function ne(e,t){const o=new Ee;return o.rotation.y=Ae(t),o.add(e),o.updateMatrixWorld(!0),o}function D(e,t){const o=new it;o.add(e),o.add(new ct(16777215,3489874,1.8*He));const n=new J(16777215,2.2);n.position.copy(t.center).addScaledVector(new b(1,1.5,1),t.radius*3),o.add(n);const r=new J(12572671,.8);r.position.copy(t.center).addScaledVector(new b(-1,.5,-.7),t.radius*2),o.add(r);const s=new J(16773596,.45);return s.position.copy(t.center).addScaledVector(new b(.3,-1,.4),t.radius*2),o.add(s),o}let L=null;function me(){const e=L;L=null,e&&(X(e),e.dispose(),e.forceContextLoss())}function Vt(){if(L?.getContext().isContextLost()&&me(),!L){const e=_(new W({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));L=e,e.domElement.addEventListener("webglcontextlost",()=>{L===e&&me()})}return L}function Fe(e,t={}){let o=!1;if(e.traverse(i=>{z(i,"gaussianSplat")&&(o=!0)}),o)throw new Error("Gaussian-splat capture requires the async project-asset capture path so Spark can sort each view.");const n=T(t.width),r=T(t.height),s=t.background??"neutral",a=$(e);try{const i=Be(e);t.pose&&Gt(a,t.pose);const c=ne(a,i),l=ce(i),u=R(c,"perspective"),p=D(c,u),d=Vt();if(d.setPixelRatio(1),d.outputColorSpace=V,d.toneMapping=j,d.toneMappingExposure=1,d.setClearColor(U,s==="transparent"?0:1),q(p,d),t.camera)return Ht(d,p,Y(u,n/r,ge(t.camera),t.camera.distance),n,r,t.camera,l);const m=new Map;for(const f of k)m.set(f,ie(f,R(c,f),n/r));const w=Y(u,n/r,ge({azimuthDegrees:30,elevationDegrees:-60}));return ke(d,p,m,n,r,l,w)}finally{G(a)}}function jt(e,t,o){const n=Oe(t,o.yawDegrees);if(!n)return e;const r=document.createElement("canvas");r.width=e.width,r.height=e.height;const s=r.getContext("2d");if(!s)return e;s.drawImage(e,0,0);const a=Se(n.text,e.width,e.height),i=n.edge==="left"?0:e.width-a.width;return P(s,n.text,i,e.height-a.height,e.width,e.height),r}function ce(e){const t=Ae(e);return{forward:[e[0],e[1],e[2]],yawDegrees:Math.round(O.radToDeg(t))}}function Gt(e,t){if(!Number.isFinite(t.timeSeconds)||t.timeSeconds<0)throw new Error(`Asset preview pose time must be a finite number of seconds >= 0, got ${t.timeSeconds}.`);const o=e.animations??[],n=o.find(s=>s.name===t.clip);if(!n){const s=o.map(a=>`'${a.name}'`).join(", ");throw new Error(`Asset preview pose clip '${t.clip}' not found on the subject. `+(s?`Its clips are: ${s}.`:"The subject carries no animation clips at all — clips live on the model root (GLB animations, or a builder module’s `root.animations`)."))}const r=new at(e);r.clipAction(n).play(),r.update(t.timeSeconds),e.updateMatrixWorld(!0)}function ge(e){const t=O.degToRad(e.azimuthDegrees),o=O.degToRad(e.elevationDegrees);return new b(Math.sin(t)*Math.cos(o),Math.sin(o),Math.cos(t)*Math.cos(o)).normalize()}function Ht(e,t,o,n,r,s,a){e.setSize(n,r,!1),e.render(t,o);const i={view:"perspective",base64:C(e.domElement),mimeType:"image/png"},c=document.createElement("canvas");c.width=n,c.height=r;const l=c.getContext("2d");if(!l)throw new Error("Unable to create the asset preview contact sheet.");l.drawImage(e.domElement,0,0,n,r);const u=`AZ ${Math.round(s.azimuthDegrees)} EL ${Math.round(s.elevationDegrees)}`+(s.distance===void 0?"":` D ${Math.round(s.distance)}`);return P(l,u,0,0,n,r),{width:n,height:r,orientation:a,views:[i],contactSheet:{width:n,height:r,base64:C(c),mimeType:"image/png"}}}function Oe(e,t){if(e==="perspective")return null;const o=O.degToRad(t),n=Z(e).right.applyAxisAngle(new b(0,1,0),-o),r=[["X",new b(1,0,0)],["Y",new b(0,1,0)],["Z",new b(0,0,1)]];for(const[s,a]of r){const i=n.dot(a);if(i>.99)return{text:`+${s}>`,edge:"right"};if(i<-.99)return{text:`<+${s}`,edge:"left"}}return{text:`YAW ${t}`,edge:"left"}}function ke(e,t,o,n,r,s,a){const i=[],c=a?[...k,"below"]:[...k],l=a?3:2,u=n*l,p=r*2,d=document.createElement("canvas");d.width=u,d.height=p;const m=d.getContext("2d");if(!m)throw new Error("Unable to create the asset preview contact sheet.");e.getClearAlpha()>0&&(m.fillStyle=`#${new lt(U).getHexString()}`,m.fillRect(0,0,u,p)),e.setSize(n,r,!1),c.forEach((f,E)=>{const v=f==="below"?a:o.get(f);if(!v)return;e.render(t,v),i.push({view:f,base64:C(f==="below"?e.domElement:jt(e.domElement,f,s)),mimeType:"image/png"});const x=E%l,A=Math.floor(E/l),h=x*n,g=A*r;m.drawImage(e.domElement,h,g,n,r);const y=f==="perspective"?"3/4":f.toUpperCase();if(P(m,y,h,g,n,r),f==="below")return;const S=Oe(f,s.yawDegrees);if(S){const M=Se(S.text,n,r),I=S.edge==="left"?h:h+n-M.width;P(m,S.text,I,g+r-M.height,n,r)}});const w={width:u,height:p,base64:C(d),mimeType:"image/png"};return{width:n,height:r,orientation:s,views:i,contactSheet:w}}function xn(e,t,o={}){let n=!1;if(e.traverse(l=>{z(l,"gaussianSplat")&&(n=!0)}),n)throw new Error("Gaussian-splat capture requires the async project-asset capture path so Spark can sort each view.");const r=T(o.width),s=T(o.height),a=o.background??"neutral",i=[];let c=null;try{t.traverse(p=>{p.visible&&Ve(p)&&(p.visible=!1,i.push(p))});const l=new Map;for(const p of k){const d=ie(p,R(e,p),r/s);d.layers.enableAll(),d.layers.disable(ye),l.set(p,d)}const u=_(new W({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));return c=u,u.setPixelRatio(1),u.outputColorSpace=V,u.toneMapping=j,u.toneMappingExposure=1,u.setClearColor(U,a==="transparent"?0:1),ke(u,t,l,r,s,ce([0,0,1]))}finally{for(const l of i)l.visible=!0;c?.dispose(),c?.forceContextLoss()}}function Yt(e,t,o){const n=e.pose===void 0?"":` under pose '${e.pose}'`,r=e.view==="bone-zoom"?`bone-zoom on ${e.bones.join(", ")} at yaw ${(e.yaw??0).toFixed(3)}`:`turntable at yaw ${e.yaw.toFixed(3)}`,s=e.view==="bone-zoom"?"Zoom anchors are read from the REST skeleton for every shot, so a pose that MOVES the anchor leaves the crop behind where the joint used to be: re-aim the shot (another joint or yaw), widen its spanFraction, or drop it.":"Check the shot yaw and the pose it renders under.";return{label:e.label,reason:"empty-frame",...e.view==="bone-zoom"?{bones:[...e.bones]}:{},...e.pose===void 0?{}:{pose:e.pose},message:`Asset preview '--shots ${t}' shot ${JSON.stringify(e.label)} (${r}${n}) framed NONE of the subject's ${o} rendered faces: the image is background only and proves nothing about the asset. ${s}`}}function qt(e,t,o){const n=[],r=()=>{for(const s of n)G(s);n.length=0};try{const s=$(e);n.push(s);const a=fe(s,t),i=Be(e),c=ne(s,i),l=R(c,"perspective"),u=D(c,l),p={subject:c,scene:u,framing:l},d=new Map;for(const h of t.shots){if(h.pose===void 0||d.has(h.pose))continue;const g=t.poses?.[h.pose]??[],y=$(e);n.push(y);const S=fe(y,t);Wt(y,S,g),y.updateMatrixWorld(!0);const M=ne(y,i),I=R(M,"perspective");d.set(h.pose,{subject:M,scene:D(M,I),framing:I})}const m=h=>h===void 0?p:d.get(h),w=h=>new b().setFromMatrixPosition(a.get(h).matrixWorld),f=new Map;for(const h of new Set(t.shots.filter(g=>g.view==="turntable").map(g=>g.pose??void 0))){const g=m(h),y=[...new Set(t.shots.filter(S=>S.view==="turntable"&&(S.pose??void 0)===h).map(S=>S.yaw))];f.set(h,Ue(g.subject,g.framing,y,o))}const E=t.shots.map(h=>{const g=m(h.pose);if(h.view==="turntable")return{label:h.label,camera:f.get(h.pose??void 0).get(h.yaw),scene:g.scene,stage:g,basis:te(h.yaw)};const y=h.bones.find(M=>!a.has(M));if(y!==void 0)throw new Error(`Asset preview '--shots ${t.name}' shot ${JSON.stringify(h.label)} zooms on a joint this GLB's skeleton does not have: ${y}. List it in the definition's requiredBones or fix the rig.`);const S=te(h.yaw??0);return{label:h.label,camera:zt(h.bones.map(w),S,l.radius,h.spanFraction,o),scene:g.scene,stage:g,basis:S}}),v=[],x=new Map,A=new Map;E.forEach(({stage:h},g)=>{const y=A.get(h);y?y.push(g):A.set(h,[g])});for(const[h,g]of A){const{framed:y,total:S}=Bt(h.subject,g.map(M=>{const I=E[M];return{basis:I.basis,window:xt(I.camera,I.basis)}}));g.forEach((M,I)=>{if(y[I]!==0)return;const F=Yt(t.shots[M],t.name,S);x.set(M,F),v.push(F)})}return{shots:E.map(({label:h,camera:g,scene:y},S)=>{const M=x.get(S);return{label:h,camera:g,scene:y,...M?{warning:M}:{}}}),warnings:v,dispose:r}}catch(s){throw r(),s}}function $e(e,t,o={}){const n=T(o.width),r=T(o.height),s=o.background??"neutral",a=qt(e,t,n/r);let i=null;try{const c=_(new W({antialias:!0,alpha:!0,preserveDrawingBuffer:!0}));i=c,c.setPixelRatio(1),c.outputColorSpace=V,c.toneMapping=j,c.toneMappingExposure=1,c.setClearColor(U,s==="transparent"?0:1),c.setSize(n,r,!1);for(const v of a.shots)q(v.scene,c);const l=[],u=2,p=Math.ceil(a.shots.length/u),d=n*u,m=r*p,w=document.createElement("canvas");w.width=d,w.height=m;const f=w.getContext("2d");if(!f)throw new Error("Unable to create the asset preview contact sheet.");a.shots.forEach(({label:v,camera:x,scene:A,warning:h},g)=>{c.render(A,x),l.push({label:v,base64:C(c.domElement),mimeType:"image/png"});const y=g%u,S=Math.floor(g/u),M=y*n,I=S*r;f.drawImage(c.domElement,M,I,n,r),P(f,h?`${v.toUpperCase()} - EMPTY`:v.toUpperCase(),M,I,n,r,h?"warning":"normal")});const E={width:d,height:m,base64:C(w),mimeType:"image/png"};return{width:n,height:r,shots:l,warnings:a.warnings,contactSheet:E}}finally{i&&X(i),i?.dispose(),i?.forceContextLoss(),a.dispose()}}function Xt(e){const t=e.replace(/^\/?public(\/|$)/,"/");if(!t.startsWith("/")||t.startsWith("//")||t.includes("\\")||t.includes("?")||t.includes("#"))throw new Error("Model asset paths must be the served web path (project-root absolute, with public/ stripped): e.g. /models/generated/hero.glb");let o;try{o=decodeURIComponent(t)}catch{throw new Error("Asset Editor model path contains invalid URL encoding.")}if(o.split("/").some(s=>s==="."||s===".."))throw new Error("Asset Editor model paths cannot traverse outside the project root.");const n=globalThis.location?.origin??"http://localhost",r=new URL(t,n);if(r.origin!==n||!r.pathname.toLowerCase().match(/\.(?:glb|gltf|spz)$/))throw new Error("Asset Editor loads bounded, same-origin project .glb, .gltf, or .spz files only.");return r}async function De(e,t,o=N){const n=await fetch(e,{signal:t});if(!n.ok)throw new Error(`Unable to load project model (${n.status} ${n.statusText}).`);const r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>o)throw new Error(`Asset Editor project models must be ${N/1024/1024} MiB or less.`);if(!n.body){const u=await n.arrayBuffer();if(u.byteLength>o)throw new Error(`Asset Editor project models must be ${N/1024/1024} MiB or less.`);return u}const s=n.body.getReader(),a=[];let i=0;try{for(;;){const{done:u,value:p}=await s.read();if(u)break;if(i+=p.byteLength,i>o)throw await s.cancel(),new Error(`Asset Editor project models must be ${N/1024/1024} MiB or less.`);a.push(p)}}finally{s.releaseLock()}const c=new Uint8Array(i);let l=0;for(const u of a)c.set(u,l),l+=u.byteLength;return c.buffer}function we(e,t,o){return new Promise((n,r)=>{let s=!1;const a=c=>s?!1:(s=!0,o.removeEventListener("abort",i),c(),!0),i=()=>a(()=>r(o.reason));if(o.addEventListener("abort",i,{once:!0}),o.aborted){i();return}be.parse(e,new URL(".",t).href,c=>{c.scene.animations=[...c.animations],a(()=>n(c.scene))||B(c.scene)},c=>a(()=>r(c)))})}function Zt(e,t){if(e.includes("\\")||e.includes("?")||e.includes("#"))throw new Error("Asset Editor .gltf dependencies must be plain same-origin project paths.");const o=new URL(e,t);if(o.origin!==t.origin)throw new Error("Asset Editor .gltf dependencies must stay on the project origin.");return o}function Jt(e,t){if(typeof e.mimeType=="string")return e.mimeType;const o=t.pathname.split(".").pop()?.toLowerCase();return o==="png"?"image/png":o==="jpg"||o==="jpeg"?"image/jpeg":o==="webp"?"image/webp":"application/octet-stream"}async function Kt(e,t,o){let n;try{n=JSON.parse(new TextDecoder().decode(e))}catch{throw new Error("Asset Editor could not parse the project .gltf JSON document.")}const r=[...Array.isArray(n.buffers)?n.buffers:[],...Array.isArray(n.images)?n.images:[]];let s=e.byteLength;for(const a of r){if(typeof a.uri!="string"||a.uri.startsWith("data:"))continue;const i=Zt(a.uri,t),c=await De(i,o,N-s);s+=c.byteLength;const l=new Uint8Array(c);let u="";for(let p=0;p<l.length;p+=32768)u+=String.fromCharCode(...l.subarray(p,p+32768));a.uri=`data:${Jt(a,i)};base64,${btoa(u)}`}return JSON.stringify(n)}function _e(e,t){let o;try{const n=atob(e);o=new Uint8Array(n.length);for(let r=0;r<n.length;r++)o[r]=n.charCodeAt(r)}catch{throw new Error(`${t} is not valid base64.`)}if(o.byteLength===0||o.byteLength>N)throw new Error(`${t} must be non-empty and at most ${N/1024/1024} MiB.`);return new Promise((n,r)=>{be.parse(o.buffer,"",s=>{s.scene.animations=[...s.animations],n(s.scene)},s=>r(s instanceof Error?s:new Error(String(s))))})}async function En(e,t={}){const o=await _e(e,"Asset preview GLB bytes");try{return Fe(o,t)}finally{B(o)}}async function Sn(e,t,o={}){const n=await _e(e,"Asset preview GLB bytes");try{return $e(n,t,o)}finally{B(n)}}async function Qt(e,t){const o=Xt(e),n=new AbortController,r=()=>n.abort(t?.reason);t?.aborted?r():t?.addEventListener("abort",r,{once:!0});const s=globalThis.setTimeout(()=>n.abort(new Error("Asset Editor project model load timed out after 25 seconds.")),It);try{const a=await De(o,n.signal);if(n.signal.throwIfAborted(),o.pathname.toLowerCase().endsWith(".spz"))return{root:await Ge(e,new Uint8Array(a)),sourceBytes:null};if(o.pathname.toLowerCase().endsWith(".glb")){const c=new Uint8Array(a.slice(0));return{root:await we(a,o,n.signal),sourceBytes:c}}const i=await Kt(a,o,n.signal);return{root:await we(i,o,n.signal),sourceBytes:null}}finally{globalThis.clearTimeout(s),t?.removeEventListener("abort",r)}}async function le(e,t){return(await Qt(e,t)).root}function B(e){z(e,"gaussianSplat")&&e.dispose(),G(e),e.traverse(t=>{const o=t;o.isInstancedMesh&&o.morphTexture?.dispose();const n=t;if(n.geometry?.dispose(),!n.material)return;const r=Array.isArray(n.material)?n.material:[n.material];for(const s of r){for(const a of Object.values(s))a instanceof qe&&a.dispose();s.dispose()}})}async function Mn(e,t={}){const o=await le(e);try{return z(o,"gaussianSplat")?await en(o,t):Fe(o,t)}finally{B(o)}}async function An(e,t,o={}){const n=await le(e);try{return _t(n,t,o)}finally{B(n)}}async function en(e,t){const o=T(t.width),n=T(t.height),r=t.background??"neutral",s=R(e,"perspective"),a=D(e,s),i=_(new W({antialias:!1,alpha:!0,preserveDrawingBuffer:!0}));let c=null;try{const l=await We(()=>import("./spark.module-Byplgb8G.js"),__vite__mapDeps([0,1,2,3]));c=new l.SparkRenderer({renderer:i,autoUpdate:!1,enableLod:!1}),a.add(c),i.setPixelRatio(1),i.outputColorSpace=V,i.toneMapping=j,i.toneMappingExposure=1,i.setClearColor(U,r==="transparent"?0:1),i.setSize(o,n,!1),q(a,i);const u=[],p=document.createElement("canvas");p.width=o*2,p.height=n*2;const d=p.getContext("2d");if(!d)throw new Error("Unable to create the asset preview contact sheet.");for(const[m,w]of k.entries()){const f=ie(w,R(e,w),o/n);await c.update({scene:a,camera:f}),i.render(a,f),u.push({view:w,base64:C(i.domElement),mimeType:"image/png"});const E=m%2*o,v=Math.floor(m/2)*n;d.drawImage(i.domElement,E,v,o,n),P(d,w==="perspective"?"3/4":w.toUpperCase(),E,v,o,n)}return{width:o,height:n,orientation:ce([0,0,1]),views:u,contactSheet:{width:o*2,height:n*2,base64:C(p),mimeType:"image/png"}}}finally{c?.removeFromParent(),e.removeFromParent(),c?.dispose(),X(i),i.dispose(),i.forceContextLoss()}}async function In(e,t,o={}){const n=await le(e);try{return $e(n,t,o)}finally{B(n)}}export{pn as A,An as B,dn as C,_t as D,xn as E,En as F,Fe as a,$ as b,Mn as c,B as d,bn as e,G as f,vn as g,le as h,he as i,T as j,C as k,Qt as l,R as m,mn as n,gn as o,_e as p,Ae as q,Be as r,fn as s,wn as t,hn as u,yn as v,ft as w,Sn as x,In as y,$e as z};
@@ -1 +1 @@
1
- import{r as e}from"./index-Crsbhlhy.js";import{i as r}from"./pose-guard-CLabLSzf.js";import{i}from"./game-audio-BeCyd0Ha.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.core-3arARmh6.js";let o=!1;function p(){r(t=>{o||(o=!0,e().console.log(`[audio-pose-guard] dropped a Web Audio pose update for a ${t} whose world matrix is not finite — the scene graph is unchanged and the node keeps its last good pose. Reported once; see audioPoseUpdatesDropped() for the running count.`,"authoring"))})}const w="workspace.service";function G(){i(),p()}export{w as point,G as start};
1
+ import{r as e}from"./index-DaRQxpdW.js";import{i as r}from"./pose-guard-CLabLSzf.js";import{i}from"./game-audio-BeCyd0Ha.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.core-3arARmh6.js";let o=!1;function p(){r(t=>{o||(o=!0,e().console.log(`[audio-pose-guard] dropped a Web Audio pose update for a ${t} whose world matrix is not finite — the scene graph is unchanged and the node keeps its last good pose. Reported once; see audioPoseUpdatesDropped() for the running count.`,"authoring"))})}const w="workspace.service";function G(){i(),p()}export{w as point,G as start};