@volter/game-editor 0.5.125 → 0.5.127

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 (306) hide show
  1. package/BUNDLED_NOTICES +45 -45
  2. package/catalog/entries/blender.json +2 -2
  3. package/catalog/entries/music.json +2 -2
  4. package/dist/.vite/manifest.json +2219 -2218
  5. package/dist/assets/{AssetBudgetPanel-BSgP_Ly5.js → AssetBudgetPanel-PD5Ly9CT.js} +3 -3
  6. package/dist/assets/{AudioViewer-B88kBiQH.js → AudioViewer-Q40_cmYq.js} +1 -1
  7. package/dist/assets/{CanvasBoardDocument-BmyDdzzT.js → CanvasBoardDocument-BBdEdhFm.js} +1 -1
  8. package/dist/assets/{CanvasSceneViewport-DN9DYpjz.js → CanvasSceneViewport-BJeFlMuc.js} +1 -1
  9. package/dist/assets/{ColorInput-D6i_QXM-.js → ColorInput-Cad8L0Ed.js} +1 -1
  10. package/dist/assets/{ColorPicker-VBKN9sk0.js → ColorPicker-DFs5jze4.js} +1 -1
  11. package/dist/assets/{EntityModelDocument-Bbp4eSk-.js → EntityModelDocument-CayVoiiM.js} +1 -1
  12. package/dist/assets/{EnvironmentAssetDocument-CHl6PCV6.js → EnvironmentAssetDocument-CV3BXxtQ.js} +1 -1
  13. package/dist/assets/{Fbo-BwAOPGSM.js → Fbo-Biv6Lrhl.js} +1 -1
  14. package/dist/assets/{GameplaySessionTimeline-DSCmUHiz.js → GameplaySessionTimeline-DIJVApAB.js} +1 -1
  15. package/dist/assets/{Gltf-GjdUJfpn.js → Gltf-CRUmmFxv.js} +1 -1
  16. package/dist/assets/{ImageViewer-RDOE-ikb.js → ImageViewer-gSGJ3OMb.js} +1 -1
  17. package/dist/assets/InspectorObjectPreview-DpCK9AEo.js +1 -0
  18. package/dist/assets/{JsonAssetDocument-y-ihqubn.js → JsonAssetDocument-P6W4QFdq.js} +1 -1
  19. package/dist/assets/{LiveModuleDocument-BRKWZS4J.js → LiveModuleDocument-Df4fCKjJ.js} +1 -1
  20. package/dist/assets/{LutAssetDocument-D6redjUn.js → LutAssetDocument-BxMT39rJ.js} +1 -1
  21. package/dist/assets/{ModelAssetDocument-DXcUg5-F.js → ModelAssetDocument-iydZwJm6.js} +1 -1
  22. package/dist/assets/{NonThreeAuthoringBootstrap-CpZS3Gow.js → NonThreeAuthoringBootstrap-n7HSxNdt.js} +1 -1
  23. package/dist/assets/{Object3DDocumentToolbar-C7g33hHW.js → Object3DDocumentToolbar-DPt8h35L.js} +1 -1
  24. package/dist/assets/Object3DDocumentViewport-DyqXdp2F.js +2 -0
  25. package/dist/assets/{Object3DPreview-CWZeky9X.js → Object3DPreview-BxyRQ29F.js} +1 -1
  26. package/dist/assets/{OnlineAssetDetail-Wm_N9tmK.js → OnlineAssetDetail-CqwqPoIr.js} +1 -1
  27. package/dist/assets/{OrbitControls-DqeA2OK1.js → OrbitControls-C6LQ4Pxi.js} +1 -1
  28. package/dist/assets/{OrthographicCamera-QGDXU8-_.js → OrthographicCamera-Bv8_A2mi.js} +1 -1
  29. package/dist/assets/{PerspectiveCamera-CzyDwUe8.js → PerspectiveCamera-D3r6Hnc8.js} +1 -1
  30. package/dist/assets/{PlayBar-BSCkbbWm.js → PlayBar-BZ7mY6yG.js} +1 -1
  31. package/dist/assets/{QuarksAssetDocument-C2d8g6QR.js → QuarksAssetDocument-CGvZL9FT.js} +1 -1
  32. package/dist/assets/{ReactCanvasControls-DZZEWbJH.js → ReactCanvasControls-DAiX7h2-.js} +1 -1
  33. package/dist/assets/{RootSelectionOverlay-BlDdfAyN.js → RootSelectionOverlay-CXVw9xAS.js} +1 -1
  34. package/dist/assets/{ShaderAssetDocument-BMIhoIDU.js → ShaderAssetDocument-CMrEhzOn.js} +1 -1
  35. package/dist/assets/{ShadowEditor-DJfc5awF.js → ShadowEditor-5kAPELQ2.js} +1 -1
  36. package/dist/assets/{SourceAssetViewer-CSS85AGm.js → SourceAssetViewer-BNMvYZgb.js} +1 -1
  37. package/dist/assets/{StageHost-BHQB10fP.js → StageHost-Bg2tw0U7.js} +2 -2
  38. package/dist/assets/{StoryPreviewMount-DtOeByMH.js → StoryPreviewMount-D3R8uVtn.js} +1 -1
  39. package/dist/assets/{ThreeBoardDocument-CU7hSmxx.js → ThreeBoardDocument-B6eFjrJd.js} +2 -2
  40. package/dist/assets/{ThreeIsolationSceneContent-CZFEUx5D.js → ThreeIsolationSceneContent-ChDzjYPl.js} +1 -1
  41. package/dist/assets/{ToolObject3DPreview-BZ-bqJjM.js → ToolObject3DPreview-CHgTtmL3.js} +1 -1
  42. package/dist/assets/{Toolbar-bpjNJw1o.js → Toolbar-DkvknKyY.js} +1 -1
  43. package/dist/assets/{TransientHint-Cs1xJsTR.js → TransientHint-BfLb1fyi.js} +1 -1
  44. package/dist/assets/{VideoViewer-DNcS3fPO.js → VideoViewer-B8RaJOtF.js} +1 -1
  45. package/dist/assets/{ViewportShadingMenu-BGdf_ugP.js → ViewportShadingMenu-B5j1MDef.js} +1 -1
  46. package/dist/assets/{active-ingest-Ddr-rqpl.js → active-ingest-R_div-Oj.js} +2 -2
  47. package/dist/assets/{animation-clock-BBk2Uf4j.js → animation-clock-OkUiSD6M.js} +1 -1
  48. package/dist/assets/{animation-mixers.service-q4aIDhxx.js → animation-mixers.service-DR98WDHt.js} +1 -1
  49. package/dist/assets/{animation-timeline.utility-D6rFf4EX.js → animation-timeline.utility-De6MGXwn.js} +1 -1
  50. package/dist/assets/{asset-budget-asset.menu-DEuaaKC5.js → asset-budget-asset.menu-Kt7mAPah.js} +1 -1
  51. package/dist/assets/{asset-budget.action-v70qmoCd.js → asset-budget.action-gtj2M3e4.js} +1 -1
  52. package/dist/assets/{asset-budget.document-BeuS8SRM.js → asset-budget.document-DE_v7Mpa.js} +1 -1
  53. package/dist/assets/{asset-budget.menu-bK7bDVj7.js → asset-budget.menu-C1PtQGYz.js} +1 -1
  54. package/dist/assets/{asset-editor-persistence-C8kiK_is.js → asset-editor-persistence-BrrBFKn0.js} +1 -1
  55. package/dist/assets/{asset-loaders-CZ_1eTic.js → asset-loaders-CUe2eH9D.js} +1 -1
  56. package/dist/assets/{asset-preview-Cck2dsj4.js → asset-preview-BlwxJaQK.js} +1 -1
  57. package/dist/assets/{audio-unlock.service-DzW-k8nv.js → audio-unlock.service-DTn3KONa.js} +1 -1
  58. package/dist/assets/{audio.utility-CZfoTgEQ.js → audio.utility-BJnmxTTI.js} +1 -1
  59. package/dist/assets/autoplay.service-D8gOha8F.js +1 -0
  60. package/dist/assets/{babylon-authoring-adapter-B1-f9m-3.js → babylon-authoring-adapter-D1NipHtB.js} +1 -1
  61. package/dist/assets/binding-resolver-Bpe3oTrY.js +2 -0
  62. package/dist/assets/{blender-node-editor.document-gGXQ4eC4.js → blender-node-editor.document-MfNbaeLR.js} +1 -1
  63. package/dist/assets/{blender-properties-tab-_2HlBre8.js → blender-properties-tab-B779fz1Q.js} +1 -1
  64. package/dist/assets/blender-runtime-host-CtCtgqOL.js +7 -0
  65. package/dist/assets/{blender-runtime-skin-V9L1oa_d.js → blender-runtime-skin-CKHCTsry.js} +1 -1
  66. package/dist/assets/{blender-runtime.document-YfVgb0xw.js → blender-runtime.document-Ckdh3HKB.js} +1 -1
  67. package/dist/assets/{blender-screenshot.menu-DJW5wTB1.js → blender-screenshot.menu-ChP92jI-.js} +1 -1
  68. package/dist/assets/{blender-timeline.document-nci9H4b6.js → blender-timeline.document-DdyfjgSk.js} +1 -1
  69. package/dist/assets/{blender-uv-editor.document-hAy3fFV_.js → blender-uv-editor.document-DU_1bKdH.js} +1 -1
  70. package/dist/assets/{blender-version.status-IBwLAxXR.js → blender-version.status-BJq9fepS.js} +1 -1
  71. package/dist/assets/{blender.command-B_7KUtv7.js → blender.command-6IlfjjJi.js} +1 -1
  72. package/dist/assets/{board-guides-CLF_VLvL.js → board-guides-DiAs0DMA.js} +1 -1
  73. package/dist/assets/{bridge.command-DgsgKZa4.js → bridge.command-B9N3cMbg.js} +3 -3
  74. package/dist/assets/{browserAll-DnBssp_8.js → browserAll-D7Kd6srk.js} +1 -1
  75. package/dist/assets/{build-player.document-ue8n3WPX.js → build-player.document-Bl_0T2uA.js} +1 -1
  76. package/dist/assets/{build-profiles.document-BoxCYqFz.js → build-profiles.document-DNDwF9_Y.js} +1 -1
  77. package/dist/assets/{build-progress.status-DIVFq_Wm.js → build-progress.status-Boink4g8.js} +1 -1
  78. package/dist/assets/{build-session-LR4kIgAX.js → build-session-CuhlmGcx.js} +1 -1
  79. package/dist/assets/{build.action-B1Tw-IoK.js → build.action-CsMtOkDc.js} +1 -1
  80. package/dist/assets/{build.command-CtmztNo9.js → build.command-bhhxJk4Q.js} +1 -1
  81. package/dist/assets/{build.header-DDLkcelu.js → build.header-xDNZZU34.js} +1 -1
  82. package/dist/assets/{build.menu-BAwLd2ek.js → build.menu-BpjSystA.js} +1 -1
  83. package/dist/assets/{build.service-B-FnDXxN.js → build.service-BwluoAjv.js} +1 -1
  84. package/dist/assets/{camera-DuP48tI_.js → camera-hh5_JQfV.js} +1 -1
  85. package/dist/assets/{camera-runtime.inspector-CziDqZQb.js → camera-runtime.inspector-CUI-ssDo.js} +1 -1
  86. package/dist/assets/{canvas-design-mount-BABOs-lh.js → canvas-design-mount-CLCR9y6J.js} +3 -3
  87. package/dist/assets/{canvas-entry-runtime-Dcf218s2.js → canvas-entry-runtime-hVYG6wMW.js} +2 -2
  88. package/dist/assets/{canvas-preview-frames-DNGxYzHV.js → canvas-preview-frames-DLO3eNyZ.js} +1 -1
  89. package/dist/assets/{canvas-story-capture.service-BJpDDwVH.js → canvas-story-capture.service-B0_KeCoB.js} +2 -2
  90. package/dist/assets/{capability-coverage-6PwUP4oX.js → capability-coverage-Cchr0mQ3.js} +1 -1
  91. package/dist/assets/{collaboration-presence-BNBw47jA.js → collaboration-presence-Z5klZlI7.js} +1 -1
  92. package/dist/assets/{collider-DAF9Z2X4.js → collider-D1_IIE-F.js} +1 -1
  93. package/dist/assets/{component-board.service-ihMRMzy3.js → component-board.service-DRc9tSvn.js} +2 -2
  94. package/dist/assets/{component-board.service-khBXmwDQ.js → component-board.service-Jx7a2Yr-.js} +2 -2
  95. package/dist/assets/{component-board.service-Dv4HPrwH.js → component-board.service-LdfAanpB.js} +2 -2
  96. package/dist/assets/{component-contracts.service-CwplNZn-.js → component-contracts.service-B_JKJT9K.js} +1 -1
  97. package/dist/assets/{component-instance-root-9er-zSAY.js → component-instance-root-0OmhquKK.js} +1 -1
  98. package/dist/assets/{component-verbs.command-z-I0Ro4a.js → component-verbs.command-BAVS6__0.js} +1 -1
  99. package/dist/assets/{component-verbs.service-DwLwoLTJ.js → component-verbs.service-LM9zY1kI.js} +1 -1
  100. package/dist/assets/{config-DQzlvYVI.js → config-BUK1VABW.js} +2 -2
  101. package/dist/assets/{configurations-oKsIhTb-.js → configurations-N2mNw-tg.js} +1 -1
  102. package/dist/assets/{connection.status-BqYA7Z5e.js → connection.status-BzJ3fGF_.js} +1 -1
  103. package/dist/assets/{constraints.inspector-CVyV22tC.js → constraints.inspector-DxF0WKoV.js} +1 -1
  104. package/dist/assets/{content-bounds-DuSmUtY1.js → content-bounds-BZfH5RtN.js} +1 -1
  105. package/dist/assets/{contract-system-adapters-C66CNkAk.js → contract-system-adapters-BN9ohs9e.js} +1 -1
  106. package/dist/assets/{coverage.service-DwFCo4w8.js → coverage.service-CKeNuy0m.js} +1 -1
  107. package/dist/assets/{create-runtime-B2p75b5q.js → create-runtime-DIhNSHgr.js} +1 -1
  108. package/dist/assets/{curve-Dw4divzX.js → curve-DqPAAyLA.js} +1 -1
  109. package/dist/assets/{data-asset-BSxK3Y_h.js → data-asset-CUXIvdhH.js} +1 -1
  110. package/dist/assets/{data-ref-BUs2PbaF.js → data-ref-u6lwt2bh.js} +1 -1
  111. package/dist/assets/{debug-bridge-BdoOc1Jv.js → debug-bridge-0Ch5pR4P.js} +1 -1
  112. package/dist/assets/{debug-registry-BosYnV_Z.js → debug-registry-D9oD7FHT.js} +1 -1
  113. package/dist/assets/{deferred-ingest-play-BOUu0VgE.js → deferred-ingest-play-DObJUzph.js} +2 -2
  114. package/dist/assets/{design-time-canvas-mount-Ds-zq4CU.js → design-time-canvas-mount-kTm3g37R.js} +2 -2
  115. package/dist/assets/{design-time-layers-B0DteFiV.js → design-time-layers-Bf9v4K6S.js} +1 -1
  116. package/dist/assets/{design-time-mount.service-CrQoKi6N.js → design-time-mount.service-DdoDO9db.js} +2 -2
  117. package/dist/assets/{design-time-mount.service-CfOBd_-9.js → design-time-mount.service-DnfuDkLV.js} +2 -2
  118. package/dist/assets/{design-time-react-mount-B6BJiTeO.js → design-time-react-mount-BKngZyGo.js} +1 -1
  119. package/dist/assets/{document-preview-three-4FxFY9Cx.js → document-preview-three-Bfn5CPiD.js} +1 -1
  120. package/dist/assets/{dom-authoring-adapter-vourOD4d.js → dom-authoring-adapter-CKolNcI_.js} +1 -1
  121. package/dist/assets/{draco3d-Bk4s3p1H.js → draco3d-BkMn9cW2.js} +1 -1
  122. package/dist/assets/{edit-mode-audio.service-DRpU_FFF.js → edit-mode-audio.service-BXgbsw-L.js} +1 -1
  123. package/dist/assets/{edit-mode-authoring-z2Uu4CrX.js → edit-mode-authoring-Bx6SGIjL.js} +1 -1
  124. package/dist/assets/{edit-mode-networking.service-DhwnIn2o.js → edit-mode-networking.service-ZZETnS-m.js} +1 -1
  125. package/dist/assets/{editor-api-hojxsk8T.js → editor-api-MYo_NhPG.js} +1 -1
  126. package/dist/assets/{editor-layers-CSl6S15k.js → editor-layers-BDej9Ofa.js} +1 -1
  127. package/dist/assets/{editor-shell-store-DTfKHHYD.js → editor-shell-store-DmIN_bZc.js} +1 -1
  128. package/dist/assets/{entity-object-BO1_Qmt8.js → entity-object-sI9MDwQJ.js} +1 -1
  129. package/dist/assets/{events-156d8d12.esm-CYeuVCYr.js → events-156d8d12.esm-DmeaOP4r.js} +1 -1
  130. package/dist/assets/{extend-BedwRP5_.js → extend-Ci0OsrQT.js} +1 -1
  131. package/dist/assets/{fork-menu-BWmJjb_A.js → fork-menu-DBSCmy4Q.js} +1 -1
  132. package/dist/assets/{frame-debugger-store-Gu32HGGD.js → frame-debugger-store-BgELTeli.js} +1 -1
  133. package/dist/assets/{game-contract-seams-DQGwjObL.js → game-contract-seams-lha_cX4J.js} +1 -1
  134. package/dist/assets/{game-css-scope-transform-DYa5L1dk.js → game-css-scope-transform-BsQrnJad.js} +1 -1
  135. package/dist/assets/{game-document.service-CG1egqq7.js → game-document.service-CRVaHjov.js} +1 -1
  136. package/dist/assets/{game-eval.command-D9LYcy3m.js → game-eval.command-KKR6bdMi.js} +1 -1
  137. package/dist/assets/{game-module-access-DfYSoZjk.js → game-module-access-DYES1F1a.js} +1 -1
  138. package/dist/assets/{game-network-BZdvwJ0a.js → game-network-BtZZImhM.js} +3 -3
  139. package/dist/assets/{gameplay-export-BVH9PKaE.js → gameplay-export-NxNgfvAW.js} +1 -1
  140. package/dist/assets/{gameplay-replay-BLLppt8C.js → gameplay-replay-D4vTBXtR.js} +1 -1
  141. package/dist/assets/{gameplay.command-Djp-Aok2.js → gameplay.command-C3NnXZz5.js} +1 -1
  142. package/dist/assets/{generation-jobs-CsXRg1Tq.js → generation-jobs-B487f_2Z.js} +1 -1
  143. package/dist/assets/{generation.service-Cn7nGBEo.js → generation.service--yjaC5qx.js} +1 -1
  144. package/dist/assets/{generations-BqPU1fPO.js → generations-B76X3pOw.js} +1 -1
  145. package/dist/assets/{generations.status-CJUE5vVY.js → generations.status-iHwft6E7.js} +1 -1
  146. package/dist/assets/{hierarchy-marks-B4XzZe8e.js → hierarchy-marks-Bv3lFwvr.js} +1 -1
  147. package/dist/assets/{hosted-asset-materialization-iHAqPmZ-.js → hosted-asset-materialization-CI3cdlhz.js} +1 -1
  148. package/dist/assets/{index-COorqncb.js → index-CECK_ODc.js} +1 -1
  149. package/dist/assets/{index-C1mcZ_qc.js → index-CQ4zsFnG.js} +2 -2
  150. package/dist/assets/{index-C9f8SWpp.js → index-CxM9SCDb.js} +1 -1
  151. package/dist/assets/{index-X7FPqr0y.js → index-DM6wGhg6.js} +1 -1
  152. package/dist/assets/{index-CRj7mn0r.js → index-DmZJfzXE.js} +1 -1
  153. package/dist/assets/index-DzuOGwVB.js +1 -0
  154. package/dist/assets/{index-By0elT7x.js → index-hDH0MQtY.js} +1 -1
  155. package/dist/assets/{index-F91ICQ72.js → index-jbVAkbCC.js} +1 -1
  156. package/dist/assets/{index-r-FuctN5.js → index-jhDTJrJJ.js} +8 -8
  157. package/dist/assets/{index-CvVYuIWr.js → index-p9CDkug5.js} +1 -1
  158. package/dist/assets/{inference-diagnostics-D4Iu86es.js → inference-diagnostics-GzO30GlV.js} +1 -1
  159. package/dist/assets/{ingest-boot-viewport-DdHb1LeO.js → ingest-boot-viewport-eEXoWb4H.js} +1 -1
  160. package/dist/assets/{ingest-siblings-Cf-McyY_.js → ingest-siblings-DFv3-ybn.js} +1 -1
  161. package/dist/assets/{ingest-source-persistence-BwINDLYc.js → ingest-source-persistence-DrtMONfa.js} +1 -1
  162. package/dist/assets/{ingest.service-B8hV6YT4.js → ingest.service-Aqr5ECGV.js} +1 -1
  163. package/dist/assets/{inspect-sYciyXgK.js → inspect-CkG2Z66I.js} +1 -1
  164. package/dist/assets/instances.command-CnDpU3nG.js +1 -0
  165. package/dist/assets/{json-history-resource-DuT7scib.js → json-history-resource-sg0Vzf4w.js} +1 -1
  166. package/dist/assets/{layered-pick-1v6rbWkT.js → layered-pick-CEWefTxe.js} +1 -1
  167. package/dist/assets/{light-B3S378yT.js → light-BPEv67Pc.js} +1 -1
  168. package/dist/assets/{live-project-verbs-BnaccVli.js → live-project-verbs-CvPNGB8N.js} +1 -1
  169. package/dist/assets/{machine.document-BG1voYon.js → machine.document-Byg4Akxw.js} +1 -1
  170. package/dist/assets/{machines.finder-G0u80stL.js → machines.finder-Cu6MQ5CX.js} +1 -1
  171. package/dist/assets/{material-BCw5pv20.js → material-CCaJzzZ3.js} +1 -1
  172. package/dist/assets/{material-factory-zynl18MK.js → material-factory-BUMkjoYi.js} +1 -1
  173. package/dist/assets/{mesh-q9baasmD.js → mesh-CK1UuqDd.js} +1 -1
  174. package/dist/assets/{model-asset-sections.service-DL_H2GfH.js → model-asset-sections.service-iifouDM7.js} +1 -1
  175. package/dist/assets/{model-inspection-BbRgz6bo.js → model-inspection-DYuFlISa.js} +1 -1
  176. package/dist/assets/{model-thumbnail-DSDxaYgd.js → model-thumbnail-DQh5eEm6.js} +1 -1
  177. package/dist/assets/{models.finder-Dy-J43qR.js → models.finder-DK7FBN-1.js} +1 -1
  178. package/dist/assets/{module-mode-DNU-E0nG.js → module-mode-IVU14VtJ.js} +2 -2
  179. package/dist/assets/{mount-canvas-ingest-root-CQ4W-gUR.js → mount-canvas-ingest-root-CxkwEZ3U.js} +2 -2
  180. package/dist/assets/{mount-dom-ingest-root-COjIeP_R.js → mount-dom-ingest-root-CIxtLQlq.js} +2 -2
  181. package/dist/assets/{mount-ingest-root-CWdNrIZI.js → mount-ingest-root-0tfZf15A.js} +2 -2
  182. package/dist/assets/{mount-manifest-qdcv5b_0.js → mount-manifest-BjOZvESY.js} +1 -1
  183. package/dist/assets/{mount-three-ingest-root-DztDwD1p.js → mount-three-ingest-root-DohUuewD.js} +1 -1
  184. package/dist/assets/{mounted-authoring-DKn1UEnI.js → mounted-authoring-MD8wY1MJ.js} +1 -1
  185. package/dist/assets/{mounted-story-viewport-source-Dj51da9b.js → mounted-story-viewport-source-CXQknMtQ.js} +1 -1
  186. package/dist/assets/{native-debug-module-C5xRtrQJ.js → native-debug-module-B7pExEZQ.js} +1 -1
  187. package/dist/assets/{navigation-6i4sFL2e.js → navigation-oRKxBmNV.js} +1 -1
  188. package/dist/assets/{navmesh.menu-BeWFiE7d.js → navmesh.menu-B9VhK5IV.js} +1 -1
  189. package/dist/assets/{navmesh.service-y9zoEU38.js → navmesh.service-CyG9vb7p.js} +1 -1
  190. package/dist/assets/network-observer.service-BN1u0-oM.js +1 -0
  191. package/dist/assets/{network.utility-D_HsH5qj.js → network.utility-fKCL0zrN.js} +1 -1
  192. package/dist/assets/{object3d-document-session-registry-BGuY8anX.js → object3d-document-session-registry-BGN2Zn49.js} +2 -2
  193. package/dist/assets/{oid-transform-wqjngb9T.js → oid-transform-CGuM6vZg.js} +1 -1
  194. package/dist/assets/{particles-Cjg6XQEP.js → particles-CZSrHj3_.js} +1 -1
  195. package/dist/assets/{pixi-authoring-adapter-CMpVEOut.js → pixi-authoring-adapter-BGdlVTc3.js} +1 -1
  196. package/dist/assets/{pixi-live-write-target-714CPh5C.js → pixi-live-write-target-Bwu1bYXf.js} +1 -1
  197. package/dist/assets/{play.command-CIcot8mf.js → play.command-DOGPaB4C.js} +2 -2
  198. package/dist/assets/{presentation-DUidVzGI.js → presentation-BaYyBBj2.js} +1 -1
  199. package/dist/assets/{product-emJUqslE.js → product-nDWAhddV.js} +1 -1
  200. package/dist/assets/{profiler.action-Tb9vn81X.js → profiler.action-BJHf2xQo.js} +1 -1
  201. package/dist/assets/{profiler.menu-D2hXzK6K.js → profiler.menu-BNIQRpMB.js} +1 -1
  202. package/dist/assets/{profiler.utility-go2J_Rus.js → profiler.utility-SN9V1vO1.js} +1 -1
  203. package/dist/assets/{project-authoring-session-BvXLxd7m.js → project-authoring-session-BTy053IX.js} +2 -2
  204. package/dist/assets/{properties-bone-constraints.inspector-BZ_l2-st.js → properties-bone-constraints.inspector-CYpu4a1I.js} +1 -1
  205. package/dist/assets/{properties-bone.inspector-BZB51VMV.js → properties-bone.inspector-CoRR1NRF.js} +1 -1
  206. package/dist/assets/{properties-collection.inspector-C84oF9Qk.js → properties-collection.inspector-DbmGF5HE.js} +1 -1
  207. package/dist/assets/{properties-constraints.inspector-BZ5gjhkK.js → properties-constraints.inspector-DhDu-8JO.js} +1 -1
  208. package/dist/assets/{properties-data.inspector-BFRP4RBX.js → properties-data.inspector-C9hizZ5U.js} +1 -1
  209. package/dist/assets/{properties-material.inspector-Z0poViuH.js → properties-material.inspector-xw768wuX.js} +1 -1
  210. package/dist/assets/{properties-modifiers.inspector-e-sflJxR.js → properties-modifiers.inspector-CunyZ4p0.js} +1 -1
  211. package/dist/assets/{properties-object.inspector-B2MUPsKe.js → properties-object.inspector-DhR_ipG7.js} +1 -1
  212. package/dist/assets/{properties-output.inspector-Cl8ANiOA.js → properties-output.inspector-DiR-D4kZ.js} +1 -1
  213. package/dist/assets/{properties-particles.inspector-g8R7Qtlh.js → properties-particles.inspector-B3Wptqjp.js} +1 -1
  214. package/dist/assets/{properties-physics.inspector-BN1ScnFc.js → properties-physics.inspector-DczZfTN-.js} +1 -1
  215. package/dist/assets/{properties-render.inspector-BWmwuLsA.js → properties-render.inspector-qjHCxhXs.js} +1 -1
  216. package/dist/assets/{properties-scene.inspector-lBiqvysz.js → properties-scene.inspector-B-5goJJ1.js} +1 -1
  217. package/dist/assets/{properties-texture.inspector-CkIJP_1b.js → properties-texture.inspector-xNjlzod3.js} +1 -1
  218. package/dist/assets/{properties-view-layer.inspector-bWpA77BN.js → properties-view-layer.inspector-6onYZnR0.js} +1 -1
  219. package/dist/assets/{properties-world.inspector-C1GaZ5qr.js → properties-world.inspector-CJzAraZh.js} +1 -1
  220. package/dist/assets/{r3f-design-session-DbA50oqd.js → r3f-design-session-JBU21CBT.js} +2 -2
  221. package/dist/assets/{r3f-physics-binding-yDE4SctS.js → r3f-physics-binding-BQKS3eos.js} +1 -1
  222. package/dist/assets/{r3f-source-authoring-adapter-BCy1GWt8.js → r3f-source-authoring-adapter-CaPTplr2.js} +1 -1
  223. package/dist/assets/{react-canvas-navigation-S-IbbVDw.js → react-canvas-navigation-CuOqbCmx.js} +1 -1
  224. package/dist/assets/{react-inspector.service-Brsft7TJ.js → react-inspector.service-Biw-7Aph.js} +1 -1
  225. package/dist/assets/{react-story-board-B-wnwU1y.js → react-story-board-BS4wtpbe.js} +1 -1
  226. package/dist/assets/{react-three-fiber.esm-BrmmnfPq.js → react-three-fiber.esm-Z3njhfMT.js} +1 -1
  227. package/dist/assets/{react-three-rapier.esm-ChxOJQrA.js → react-three-rapier.esm-BPcU5vTr.js} +1 -1
  228. package/dist/assets/{react-world-authoring-adapter-CwnR93ZA.js → react-world-authoring-adapter-MA_K7IzV.js} +1 -1
  229. package/dist/assets/{realm-services-CsCNzgGK.js → realm-services-Dir-FaGM.js} +1 -1
  230. package/dist/assets/{reflection-probe-capture.inspector-DGhpuOM-.js → reflection-probe-capture.inspector-BzVk5nbq.js} +1 -1
  231. package/dist/assets/{registry-DVdPAH9u.js → registry-BRpQODGg.js} +1 -1
  232. package/dist/assets/{relative-import-specifier-DGpgcbeS.js → relative-import-specifier-BFDgw6rr.js} +1 -1
  233. package/dist/assets/{render-env-Dy3Kf2gg.js → render-env-g0xcT2gf.js} +1 -1
  234. package/dist/assets/{render-features-BjJcszQ2.js → render-features-ipsYrx5W.js} +1 -1
  235. package/dist/assets/{render-settings-CergIZPU.js → render-settings-Blt3RlHC.js} +1 -1
  236. package/dist/assets/{resolve-three-l_1-CXHl.js → resolve-three-D7kJDkec.js} +3 -3
  237. package/dist/assets/{root-seam-contract-9QibVtGc.js → root-seam-contract-TccLSDcM.js} +1 -1
  238. package/dist/assets/{run-selection-DOsR8mOQ.js → run-selection-BwneJGDD.js} +1 -1
  239. package/dist/assets/{scene-capture-CrqaUEgL.js → scene-capture-BbPvTNLW.js} +1 -1
  240. package/dist/assets/{scene-document.service-WItYUlyc.js → scene-document.service-EWLuGMAY.js} +2 -2
  241. package/dist/assets/{scene-framing-BxVkSlg3.js → scene-framing-CXQ4WFCe.js} +1 -1
  242. package/dist/assets/{seeded-random-BTqVP8Ii.js → seeded-random-CLC2hMDL.js} +1 -1
  243. package/dist/assets/{setup-renderer-B2da1u8k.js → setup-renderer-CwZuhttK.js} +1 -1
  244. package/dist/assets/{source-object3d-authoring-adapter-BKZ8oj3D.js → source-object3d-authoring-adapter-BRXDkWd8.js} +1 -1
  245. package/dist/assets/{source-persistence-backend-Con5sRZv.js → source-persistence-backend-BMcrOXF8.js} +1 -1
  246. package/dist/assets/{stage-keyboard-DGE-4Jpn.js → stage-keyboard-BoOvqz6F.js} +1 -1
  247. package/dist/assets/{stage-overlay-set-CKtVcxiT.js → stage-overlay-set-9gaaWRc5.js} +1 -1
  248. package/dist/assets/{stage-presence-markers-tb8yyWjE.js → stage-presence-markers-B5tMBPb2.js} +1 -1
  249. package/dist/assets/{stage-transform-tools-DdbkruEz.js → stage-transform-tools-CCzvYtKw.js} +1 -1
  250. package/dist/assets/{standard-viewport-dressing-BmMrgEAi.js → standard-viewport-dressing-BVHhIJE1.js} +1 -1
  251. package/dist/assets/{state-watch.action-BaJIFmyr.js → state-watch.action-BbRdD-Bw.js} +1 -1
  252. package/dist/assets/{state-watch.menu-ByA3Z9q-.js → state-watch.menu-D_JIVIMe.js} +1 -1
  253. package/dist/assets/{state-watch.utility-C2Sugdxe.js → state-watch.utility-BE-P2r3A.js} +1 -1
  254. package/dist/assets/{story-capture-D1xcKwr0.js → story-capture-BLl-A22X.js} +1 -1
  255. package/dist/assets/{story-documents-z4AFSTsH.js → story-documents-C441czJk.js} +1 -1
  256. package/dist/assets/{story-documents.service-gHigvC0Y.js → story-documents.service-CcG3J9jn.js} +1 -1
  257. package/dist/assets/{story-documents.service-BNFBCFet.js → story-documents.service-DAAUrl6I.js} +1 -1
  258. package/dist/assets/{story-media-presence-Ctf8e6_2.js → story-media-presence-BR_BcVt0.js} +1 -1
  259. package/dist/assets/{story-pixi-preview-B64Fbglp.js → story-pixi-preview-CM_XAwSW.js} +1 -1
  260. package/dist/assets/{story-presentation-CioG0A_4.js → story-presentation-CjP2otRK.js} +1 -1
  261. package/dist/assets/{story-three-preview-9zj9LGo3.js → story-three-preview-DUvRTcZc.js} +2 -2
  262. package/dist/assets/{studio-environment-CLaX3ria.js → studio-environment-D05pL7iQ.js} +1 -1
  263. package/dist/assets/{surface-state-CB3HOhtC.js → surface-state-0xXAxq6X.js} +1 -1
  264. package/dist/assets/{syntactic-prop-specs-Ce1hcg_C.js → syntactic-prop-specs-wO7dY0s8.js} +1 -1
  265. package/dist/assets/{team-playtest.service-D9-q_kQm.js → team-playtest.service-BPinahrE.js} +1 -1
  266. package/dist/assets/{three-BGqB-uVq.js → three-B_zMk3VF.js} +1 -1
  267. package/dist/assets/{three-authoring-adapter-BO7jI7-8.js → three-authoring-adapter-zwGjYwL0.js} +1 -1
  268. package/dist/assets/three-authoring.service-D7a7tS8M.js +2 -0
  269. package/dist/assets/{three-ingest-runtime-CzLs2nNM.js → three-ingest-runtime-CSsXqTWC.js} +1 -1
  270. package/dist/assets/{three-integration-qc8Reb1Y.js → three-integration-CXNucx1z.js} +2 -2
  271. package/dist/assets/three-integration.service-_6xudYSC.js +1 -0
  272. package/dist/assets/{three-projection-core-CFyOC4Fp.js → three-projection-core-BPR7YFcJ.js} +1 -1
  273. package/dist/assets/{three-state-z8gBcifl.js → three-state-C_HLiIZD.js} +1 -1
  274. package/dist/assets/{three-story-capture.service-c2yjqEby.js → three-story-capture.service-735_vEsy.js} +2 -2
  275. package/dist/assets/{three-story-model-St9GMyHp.js → three-story-model-BEisRrzq.js} +1 -1
  276. package/dist/assets/{three-viewport-presentation-BjXL1Zjv.js → three-viewport-presentation-Cfs5MJTy.js} +1 -1
  277. package/dist/assets/{transform-mode-request-C7qEF7HB.js → transform-mode-request-DsaxVuwS.js} +1 -1
  278. package/dist/assets/{transport-strip-e122YmzD.js → transport-strip-BEEkMmqy.js} +1 -1
  279. package/dist/assets/transport.header-Ds1930r5.js +1 -0
  280. package/dist/assets/{tuples-BUz9vxL7.js → tuples-CeiD4z2j.js} +1 -1
  281. package/dist/assets/{ui-board-document-DEqHspRN.js → ui-board-document-DcTv9Oo_.js} +2 -2
  282. package/dist/assets/{user-data-CPxKRceo.js → user-data-W3aDNol1.js} +1 -1
  283. package/dist/assets/{utility-view-state-B-gZQZIN.js → utility-view-state-IlWKtSFw.js} +1 -1
  284. package/dist/assets/{viewport-door-K-5DUW7m.js → viewport-door-C7l0uUHo.js} +1 -1
  285. package/dist/assets/{viewport-root-presentation-PTTfkoRf.js → viewport-root-presentation-DAw5nyWp.js} +1 -1
  286. package/dist/assets/{viewport-surface-status-BTqSVzg2.js → viewport-surface-status-gSFti1Lv.js} +1 -1
  287. package/dist/assets/{webworkerAll-DhL2BYVu.js → webworkerAll-Cf8x3KX0.js} +1 -1
  288. package/dist/assets/{workspace-arrangement-BOOvdRY-.js → workspace-arrangement-MmNy_T4o.js} +1 -1
  289. package/dist/assets/{world-documents-FtLCiCQe.js → world-documents-BNdPRrgb.js} +1 -1
  290. package/dist/assets/{world-root-stage-binding-FTlof7qc.js → world-root-stage-binding-BMAxQSOR.js} +1 -1
  291. package/dist/assets/{xstate-animation-binding-C06bUoKl.js → xstate-animation-binding-DZNqaKO9.js} +1 -1
  292. package/dist/assets/{xstate-animation-meta-h_xoeBCJ.js → xstate-animation-meta-KfEE-v3f.js} +1 -1
  293. package/dist-node/cli.js +16 -16
  294. package/package.json +16 -16
  295. package/template/vite.config.ts +1 -1
  296. package/dist/assets/InspectorObjectPreview-CkyqYsEo.js +0 -1
  297. package/dist/assets/Object3DDocumentViewport-CTE6_O8m.js +0 -2
  298. package/dist/assets/autoplay.service-Bd6xIgdv.js +0 -1
  299. package/dist/assets/binding-resolver-BcV7It57.js +0 -2
  300. package/dist/assets/blender-runtime-host-B3OHRnyq.js +0 -7
  301. package/dist/assets/index-bQE2NA0D.js +0 -1
  302. package/dist/assets/instances.command-Dj-9DRxh.js +0 -1
  303. package/dist/assets/network-observer.service-rq9XQOmV.js +0 -1
  304. package/dist/assets/three-authoring.service-CIJV-GMf.js +0 -2
  305. package/dist/assets/three-integration.service-DTYLz684.js +0 -1
  306. package/dist/assets/transport.header-C9_a76-g.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{al as r,a6 as k,aS as w,aT as z,aU as C}from"./index-r-FuctN5.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const m={fontSize:11,color:r.content.dim,marginBottom:2};function L({assetPath:s}){const o=l.useRef(null),[a,p]=l.useState(!1),[n,f]=l.useState(null),[c,x]=l.useState(0),[h,v]=l.useState(!1),[y,g]=l.useState(1),j=s.split("/").pop()??s,b=s.split(".").pop()?.toUpperCase()??"";l.useEffect(()=>()=>{o.current?.pause()},[]);const S=()=>{const t=o.current;t&&(a?t.pause():t.play(),p(!a))},d=t=>{const i=Math.floor(t/60),u=Math.floor(t%60);return`${i}:${u.toString().padStart(2,"0")}`};return e.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("div",{style:{fontWeight:600,fontSize:12,color:r.content.primary,wordBreak:"break-all"},children:j}),e.jsxs("div",{className:"volter-content-frost",style:{width:"100%",border:`1px solid ${r.boundary.default}`,borderRadius:r.shape.small,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:8,padding:16},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:48,height:48,children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",fill:"var(--volter-asset-icon-audio)"}),e.jsx("path",{d:"M9 8l4-2v12l-4-2H7V10h2zm6 1v6m2-5v4",stroke:"var(--volter-text-1)",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"})]}),n!=null&&e.jsxs("div",{style:{width:"100%",fontSize:10,color:r.content.muted,textAlign:"center"},children:[d(c)," / ",d(n)]}),n!=null&&n>0&&e.jsx("div",{style:{width:"100%",height:4,background:r.surface.raised,borderRadius:r.shape.small,cursor:"pointer",position:"relative"},onClick:t=>{const i=t.currentTarget.getBoundingClientRect(),u=(t.clientX-i.left)/i.width;o.current&&(o.current.currentTime=u*n)},children:e.jsx("div",{style:{width:`${c/n*100}%`,height:"100%",background:"var(--volter-asset-icon-audio)",borderRadius:r.shape.small}})}),e.jsx(k,{type:"button",variant:"secondary",size:"comfortable",onClick:S,children:a?"Pause":"Play"}),e.jsx("div",{role:"img","aria-label":"Audio waveform",style:{width:"100%",height:36,display:"flex",alignItems:"center",gap:2},children:Array.from({length:48},(t,i)=>e.jsx("i",{style:{flex:1,height:`${20+i*37%75}%`,background:"var(--volter-asset-icon-audio)",opacity:i/48<=c/(n||1)?1:.3}},i))}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:[e.jsx(w,{checked:h,onChange:t=>v(t.target.checked)})," Loop"]}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:["Volume"," ",e.jsx(z,{"aria-label":"Audio volume",min:"0",max:"1",step:"0.05",value:y,onChange:t=>{const i=Number(t.target.value);g(i),o.current&&(o.current.volume=i)}})]})]}),e.jsx("audio",{ref:o,src:s,loop:h,onLoadedMetadata:()=>{o.current&&f(o.current.duration)},onTimeUpdate:()=>{o.current&&x(o.current.currentTime)},onEnded:()=>p(!1)}),e.jsx(C,{label:"Info",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Path"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary,wordBreak:"break-all"},children:s})]}),n!=null&&e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Duration"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:d(n)})]}),e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Format"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:b})]})]})})]})}export{L as AudioViewer};
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{al as r,a6 as k,aS as w,aT as z,aU as C}from"./index-jhDTJrJJ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";const m={fontSize:11,color:r.content.dim,marginBottom:2};function L({assetPath:s}){const o=l.useRef(null),[a,p]=l.useState(!1),[n,f]=l.useState(null),[c,x]=l.useState(0),[h,v]=l.useState(!1),[y,g]=l.useState(1),j=s.split("/").pop()??s,b=s.split(".").pop()?.toUpperCase()??"";l.useEffect(()=>()=>{o.current?.pause()},[]);const S=()=>{const t=o.current;t&&(a?t.pause():t.play(),p(!a))},d=t=>{const i=Math.floor(t/60),u=Math.floor(t%60);return`${i}:${u.toString().padStart(2,"0")}`};return e.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("div",{style:{fontWeight:600,fontSize:12,color:r.content.primary,wordBreak:"break-all"},children:j}),e.jsxs("div",{className:"volter-content-frost",style:{width:"100%",border:`1px solid ${r.boundary.default}`,borderRadius:r.shape.small,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:8,padding:16},children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:48,height:48,children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",fill:"var(--volter-asset-icon-audio)"}),e.jsx("path",{d:"M9 8l4-2v12l-4-2H7V10h2zm6 1v6m2-5v4",stroke:"var(--volter-text-1)",strokeWidth:"1.5",fill:"none",strokeLinecap:"round"})]}),n!=null&&e.jsxs("div",{style:{width:"100%",fontSize:10,color:r.content.muted,textAlign:"center"},children:[d(c)," / ",d(n)]}),n!=null&&n>0&&e.jsx("div",{style:{width:"100%",height:4,background:r.surface.raised,borderRadius:r.shape.small,cursor:"pointer",position:"relative"},onClick:t=>{const i=t.currentTarget.getBoundingClientRect(),u=(t.clientX-i.left)/i.width;o.current&&(o.current.currentTime=u*n)},children:e.jsx("div",{style:{width:`${c/n*100}%`,height:"100%",background:"var(--volter-asset-icon-audio)",borderRadius:r.shape.small}})}),e.jsx(k,{type:"button",variant:"secondary",size:"comfortable",onClick:S,children:a?"Pause":"Play"}),e.jsx("div",{role:"img","aria-label":"Audio waveform",style:{width:"100%",height:36,display:"flex",alignItems:"center",gap:2},children:Array.from({length:48},(t,i)=>e.jsx("i",{style:{flex:1,height:`${20+i*37%75}%`,background:"var(--volter-asset-icon-audio)",opacity:i/48<=c/(n||1)?1:.3}},i))}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:[e.jsx(w,{checked:h,onChange:t=>v(t.target.checked)})," Loop"]}),e.jsxs("label",{style:{fontSize:11,color:r.content.muted},children:["Volume"," ",e.jsx(z,{"aria-label":"Audio volume",min:"0",max:"1",step:"0.05",value:y,onChange:t=>{const i=Number(t.target.value);g(i),o.current&&(o.current.volume=i)}})]})]}),e.jsx("audio",{ref:o,src:s,loop:h,onLoadedMetadata:()=>{o.current&&f(o.current.duration)},onTimeUpdate:()=>{o.current&&x(o.current.currentTime)},onEnded:()=>p(!1)}),e.jsx(C,{label:"Info",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Path"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary,wordBreak:"break-all"},children:s})]}),n!=null&&e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Duration"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:d(n)})]}),e.jsxs("div",{children:[e.jsx("div",{style:m,children:"Format"}),e.jsx("div",{style:{fontSize:11,color:r.content.primary},children:b})]})]})})]})}export{L as AudioViewer};
@@ -1 +1 @@
1
- import{a as y}from"./jsx-runtime-DPjLkJKQ.js";import{i as O}from"./react-canvas-navigation-S-IbbVDw.js";import{R as E,h as B,i as D}from"./react-story-board-B-wnwU1y.js";import{au as F,aw as z,bi as L,fV as X,fW as I,av as K,dK as V,eK as w,as as Y,at as G,cC as H,Z as W,fX as Z,fY as U,al as S,fZ as q,dB as $,dC as N,dE as J}from"./index-r-FuctN5.js";import{registerPresentedPixiApps as Q}from"./canvas-preview-frames-DNGxYzHV.js";import{R as tt}from"./ReactCanvasControls-DZZEWbJH.js";import{r as d}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{s as et}from"./story-presentation-CioG0A_4.js";import{m as nt}from"./pixi-story-model-DNkfnWUV.js";import{withPixiStoryMountTurn as T}from"./story-pixi-preview-B64Fbglp.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-C1mcZ_qc.js";import"./crash-null-boundary-v3a0uEgw.js";import"./story-mount-turn-DFRTj5hi.js";const ot="No story yet",st={width:160,height:160},A={width:240,height:180},R=96;function rt(e){return{stories:e.length,modules:new Set(e.map(o=>o.modulePath)).size}}function at(e){const o=e.layout;return o==="fullscreen"||o==="padded"||o==="centered"?o:"padded"}function it(e,o,i){if(!i.componentName)return!0;const r=I(e,i.componentName,o);return!r||r.modulePath===o&&r.name===i.name}function ct(e){const o=[],i=new Map,r=K();for(const t of e)if(t.ok)for(const n of t.stories){const c=F({modulePath:t.modulePath,regions:r});if(c.medium!=="canvas"){c.via==="undeclared"&&z(t.modulePath,c.reason);continue}if(!it(e,t.modulePath,n))continue;const h=L({modulePath:t.modulePath,...n.title===void 0?{}:{title:n.title}}),g=X(h),u=`${g}/${h.leaf}`;i.set(u,(i.get(u)??0)+1),o.push({identity:{id:`${t.modulePath}#${n.name}`,storyName:n.name,modulePath:t.modulePath,district:g},leafKey:u,leaf:h.leaf,storyLabel:n.label,Component:n.Component,layout:at(n.parameters)})}return o.map(({identity:t,leafKey:n,leaf:c,storyLabel:h,Component:g,layout:u})=>({identity:{...t,label:(i.get(n)??0)>1?`${c} · ${h}`:c},Component:g,layout:u}))}function lt(e,o){const i=new Set,r=[];for(const t of o){if(t.surface!=="canvas"||t.contentKind==="image")continue;const n=`${t.path}#${t.name}`;i.has(n)||(i.add(n),!I(e,t.name,t.path)&&r.push({key:n,name:t.name,path:t.path,line:t.line}))}return r}function dt(e,o){const i=o==="fullscreen"?e.app.screen:e.stage.getBounds(),r=o==="fullscreen"?0:8,t={x:Math.floor(i.x-r),y:Math.floor(i.y-r),width:Math.ceil(i.width+r*2),height:Math.ceil(i.height+r*2)};if(!Number.isFinite(t.width)||!Number.isFinite(t.height)||t.width<1||t.height<1)return{frameSize:{...A},crop:{x:0,y:0,...A}};if(o!=="fullscreen"){const n=Math.max(R,t.width),c=Math.max(R,t.height);t.x-=(n-t.width)/2,t.y-=(c-t.height)/2,t.width=n,t.height=c}return{frameSize:{width:t.width,height:t.height},crop:t}}function ut(e){return e instanceof Error?e.message:String(e)}async function pt(e,o,i){const r=[],t=[];for(const{identity:n,Component:c,layout:h}of e){if(o?.aborted)break;const g=u=>{t.push({id:n.id,modulePath:n.modulePath,storyName:n.storyName,reason:u})};try{const u=await i(c);if(!nt(u.stage)){u.dispose(),g("The story mounted no Pixi content.");continue}r.push({...n,mounted:u,...dt(u,h)})}catch(u){g(ut(u))}}return{exhibits:r,skipped:t}}function mt(e,o=[],i){return T(async r=>{const{exhibits:t,skipped:n}=await pt(ct(e),i,r),c={exhibits:t,ghosts:lt(e,o),skipped:n};if(i?.aborted)throw _(c),new Error("The 2D board build was superseded by a newer one.");return c})}function M(e){return T(async()=>{_(e)})}function _(e){for(const o of e.exhibits)try{o.mounted.dispose()}catch(i){console.error("[canvas-board] a story mount failed to dispose.",i)}}const ft="2D",ht=4;function yt(e,o,i){const r=new Set,t=j(e).map(n=>({id:n.id,label:n.label,...n.title?{secondaryLabel:n.title}:{},kind:"frame",typeLabel:"Frame",parentId:null,childIds:[]}));return{capabilities:{transform:!1,inspectorFields:!1,persist:!1},hierarchy:{roots:()=>t,node:n=>t.find(c=>c.id===n)??null},selection:{get:()=>{const n=o();return n?[n]:[]},set:n=>{const c=n.at(-1);c&&i(c)}},subscribe(n){return r.add(n),()=>r.delete(n)},notify(){for(const n of r)n()}}}function j(e){return[...e.exhibits.map(o=>({id:o.id,label:o.label,modulePath:o.modulePath,...o.district?{title:o.district}:{},frameSize:o.frameSize})),...e.ghosts.map(o=>({id:o.key,label:o.name,modulePath:o.path,title:ot,frameSize:st}))]}function gt(e,o,i){const r=j(o),t=r[0];if(!t)return null;const n=document.createElement("div");n.dataset.testid="canvas-board-layer",n.style.position="absolute",n.style.left="0",n.style.top="0",n.style.transformOrigin="0 0",e.appendChild(n);let c=null,h=t.id;c=B(n,r,t.id,(a,m)=>{h=a,c?.activate(a,m==="zoom"),i?.()},et(r));const g=[];for(const a of o.exhibits){const m=c.frames.get(a.id);if(!m)continue;const f=a.mounted.host;f.setAttribute("style",`position:absolute;left:${-a.crop.x}px;top:${-a.crop.y}px;width:${a.mounted.app.screen.width}px;height:${a.mounted.app.screen.height}px;overflow:visible;contain:layout paint;`);const k=a.mounted.app.canvas;k.style.display="block",k.style.width=`${a.mounted.app.screen.width}px`,k.style.height=`${a.mounted.app.screen.height}px`,m.content.appendChild(f),g.push(k)}for(const a of o.ghosts){const m=c.frames.get(a.key);if(!m)continue;m.element.style.border=`1px dashed ${S.boundary.strong}`;const f=document.createElement("div");f.dataset.testid="canvas-board-ghost",f.textContent="No story yet",f.style.position="absolute",f.style.inset="0",f.style.display="flex",f.style.alignItems="center",f.style.justifyContent="center",f.style.color=S.content.dim,f.style.font=`11px ${S.typography.sans}`,f.style.pointerEvents="none",m.content.appendChild(f)}const u=Q(o.exhibits.map(a=>a.mounted.app)),b=()=>{const a=N();n.style.transform=J(a)??"";const m=a.zoom>=1?"pixelated":"auto";for(const f of g)f.style.imageRendering=m},v=$(b);b();const P=requestAnimationFrame(()=>c?.fitAll());let C=!1,x=0,s=0,p=0;const l=a=>{x=requestAnimationFrame(l),p+=s===0?16:Math.min(100,a-s),s=a;for(const m of o.exhibits)try{m.mounted.ticker.update(p)}catch(f){console.error("[canvas-board] an exhibit failed to tick.",f)}};return{selectAt(a,m){return c?.selectAtClientPoint(a,m)??!1},activeStoryId(){return h},selectStory(a){return r.some(m=>m.id===a)?(h=a,c?.activate(a,!1),i?.(),!0):!1},zoomAt(a,m){return c?.zoomAtClientPoint(a,m)??!1},setPlaying(a){a!==C&&(C=a,a?(s=0,x=requestAnimationFrame(l)):(cancelAnimationFrame(x),x=0))},dispose(){cancelAnimationFrame(x),cancelAnimationFrame(P),v(),u();for(const a of o.exhibits)a.mounted.host.remove();c?.dispose(),c=null,n.remove()}}}function bt({active:e}){const o=d.useSyncExternalStore(Y,G),i=d.useRef(null),r=d.useRef(null),t=d.useRef(null),n=d.useRef(null),[c,h]=d.useState({status:"idle"}),[g,u]=d.useState(e);d.useEffect(()=>{e&&u(!0)},[e]),d.useEffect(()=>{const s=i.current;if(s)return O(s)},[]),d.useEffect(()=>{if(!g)return;const s=new AbortController;let p=null;return h({status:"building"}),H().then(l=>(l.ok||W.warn(`Component index unavailable, so this board shows no ghost frames: ${l.reason}`,"canvas-board"),mt(o,l.ok?l.entries:[],s.signal))).then(l=>{if(s.signal.aborted){M(l);return}p=l,h({status:"ready",board:l})},l=>{s.signal.aborted||h({status:"error",message:l instanceof Error?l.message:String(l)})}),()=>{s.abort(),p&&M(p)}},[o,g]);const b=c.status==="ready"?c.board:null,[v,P]=d.useState(null);d.useEffect(()=>{const s=i.current;if(!s||!b)return;const p=gt(s,b,()=>{P(r.current?.activeStoryId()??null)});return r.current=p,P(p?.activeStoryId()??null),()=>{r.current=null,p?.dispose()}},[b]);const C=b?.exhibits.find(s=>s.id===v)??null,x=d.useMemo(()=>b?yt(b,()=>r.current?.activeStoryId()??null,s=>r.current?.selectStory(s)):null,[b]);return d.useEffect(()=>{x?.notify()},[x,v]),d.useEffect(()=>{if(e)return Z(w,()=>({adapter:x,nodeId:null}))},[e,x]),d.useEffect(()=>{if(!(!e||!C))return U(w,()=>({id:C.id,title:C.label,kindLabel:"Canvas story",note:{text:`${C.storyName} · ${C.modulePath}`,testId:"canvas-board-subject-note"},sections:[]}))},[e,C]),d.useEffect(()=>(r.current?.setPlaying(e),()=>r.current?.setPlaying(!1)),[e,b]),y.jsxs("div",{"data-testid":"canvas-board","data-volter-backdrop-color":e?E:void 0,"data-volter-backdrop-policy":e?"dark-frost":void 0,style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"auto",touchAction:"none",userSelect:"none",WebkitUserSelect:"none",backgroundColor:E},ref:i,onPointerDown:s=>{t.current={x:s.clientX,y:s.clientY},n.current={x:s.clientX,y:s.clientY},s.currentTarget.setPointerCapture(s.pointerId)},onPointerMove:s=>{const p=n.current;if(!p)return;const l=s.clientX-p.x,a=s.clientY-p.y;l===0&&a===0||(n.current={x:s.clientX,y:s.clientY},q(l,a))},onPointerUp:s=>{const p=t.current;t.current=null,n.current=null,s.currentTarget.hasPointerCapture(s.pointerId)&&s.currentTarget.releasePointerCapture(s.pointerId),!(!p||Math.hypot(s.clientX-p.x,s.clientY-p.y)>ht)&&r.current?.selectAt(s.clientX,s.clientY)},onPointerCancel:()=>{t.current=null,n.current=null},onDoubleClick:s=>{r.current?.zoomAt(s.clientX,s.clientY)},children:[y.jsx(xt,{}),b?y.jsx(St,{board:b}):y.jsxs("div",{"data-testid":"canvas-board-status",style:{padding:16,fontSize:12,color:S.content.muted},children:[c.status==="error"&&c.message,c.status==="building"&&"Mounting every canvas story off-screen…",c.status==="idle"&&"Open this tab to lay out every canvas story at 1× texels."]}),y.jsx(tt,{containerRef:i,context:null,boardOnly:!0})]})}function xt(){const e=d.useSyncExternalStore($,N),o=Math.max(8,24*e.zoom),i=Math.max(.7,Math.min(1.4,e.zoom));return y.jsx("div",{"data-testid":"react-design-canvas-backdrop","aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:E,backgroundImage:`radial-gradient(circle, ${D} ${i}px, transparent ${i}px)`,backgroundPosition:`${e.x}px ${e.y}px`,backgroundSize:`${o}px ${o}px`}})}function St({board:e}){const[o,i]=d.useState(!1),r=rt(e.skipped);return y.jsxs("div",{"data-testid":"canvas-board-status",style:{position:"absolute",left:8,bottom:8,maxWidth:420,padding:"4px 8px",borderRadius:S.shape.small,background:S.surface.raised,border:`1px solid ${S.boundary.default}`,fontSize:10,color:S.content.muted,pointerEvents:"auto"},children:[e.exhibits.length," exhibit",e.exhibits.length===1?"":"s",e.ghosts.length>0&&y.jsxs(y.Fragment,{children:[" · ",e.ghosts.length," component",e.ghosts.length===1?"":"s"," without stories"]}),e.skipped.length>0&&y.jsxs(y.Fragment,{children:[" · ",y.jsxs("span",{role:"button",tabIndex:0,"aria-expanded":o,onClick:()=>i(t=>!t),onKeyDown:t=>{(t.key===" "||t.key==="Enter")&&(t.preventDefault(),i(n=>!n))},style:{cursor:"pointer",color:S.accent.default},children:[r.stories," ",r.stories===1?"story":"stories"," in ",r.modules," ",r.modules===1?"module":"modules"," not on this board"]})]}),o&&y.jsx("div",{style:{marginTop:4,maxHeight:160,overflow:"auto"},children:e.skipped.map(t=>y.jsxs("div",{style:{padding:"1px 0"},children:[y.jsxs("code",{style:{color:S.content.dim},children:[t.modulePath,"#",t.storyName]})," ","— ",t.reason]},t.id))})]})}function zt(){return V({id:w,title:ft,kind:"content-browser",workspaceRole:"workspace-reference",Content:bt,closeable:!1,readOnly:!0,presentation:()=>({kind:"workspace",id:w})},{category:"canvas"})}export{w as CANVAS_COMPONENTS_DOCUMENT_ID,zt as installCanvasBoardDocument};
1
+ import{a as y}from"./jsx-runtime-DPjLkJKQ.js";import{i as O}from"./react-canvas-navigation-CuOqbCmx.js";import{R as E,h as B,i as D}from"./react-story-board-BS4wtpbe.js";import{au as F,aw as z,bi as L,fV as X,fW as I,av as K,dK as V,eK as w,as as Y,at as G,cC as H,Z as W,fX as Z,fY as U,al as S,fZ as q,dB as $,dC as N,dE as J}from"./index-jhDTJrJJ.js";import{registerPresentedPixiApps as Q}from"./canvas-preview-frames-DLO3eNyZ.js";import{R as tt}from"./ReactCanvasControls-DAiX7h2-.js";import{r as d}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{s as et}from"./story-presentation-CjP2otRK.js";import{m as nt}from"./pixi-story-model-DNkfnWUV.js";import{withPixiStoryMountTurn as T}from"./story-pixi-preview-CM_XAwSW.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-CQ4zsFnG.js";import"./crash-null-boundary-v3a0uEgw.js";import"./story-mount-turn-DFRTj5hi.js";const ot="No story yet",st={width:160,height:160},A={width:240,height:180},R=96;function rt(e){return{stories:e.length,modules:new Set(e.map(o=>o.modulePath)).size}}function at(e){const o=e.layout;return o==="fullscreen"||o==="padded"||o==="centered"?o:"padded"}function it(e,o,i){if(!i.componentName)return!0;const r=I(e,i.componentName,o);return!r||r.modulePath===o&&r.name===i.name}function ct(e){const o=[],i=new Map,r=K();for(const t of e)if(t.ok)for(const n of t.stories){const c=F({modulePath:t.modulePath,regions:r});if(c.medium!=="canvas"){c.via==="undeclared"&&z(t.modulePath,c.reason);continue}if(!it(e,t.modulePath,n))continue;const h=L({modulePath:t.modulePath,...n.title===void 0?{}:{title:n.title}}),g=X(h),u=`${g}/${h.leaf}`;i.set(u,(i.get(u)??0)+1),o.push({identity:{id:`${t.modulePath}#${n.name}`,storyName:n.name,modulePath:t.modulePath,district:g},leafKey:u,leaf:h.leaf,storyLabel:n.label,Component:n.Component,layout:at(n.parameters)})}return o.map(({identity:t,leafKey:n,leaf:c,storyLabel:h,Component:g,layout:u})=>({identity:{...t,label:(i.get(n)??0)>1?`${c} · ${h}`:c},Component:g,layout:u}))}function lt(e,o){const i=new Set,r=[];for(const t of o){if(t.surface!=="canvas"||t.contentKind==="image")continue;const n=`${t.path}#${t.name}`;i.has(n)||(i.add(n),!I(e,t.name,t.path)&&r.push({key:n,name:t.name,path:t.path,line:t.line}))}return r}function dt(e,o){const i=o==="fullscreen"?e.app.screen:e.stage.getBounds(),r=o==="fullscreen"?0:8,t={x:Math.floor(i.x-r),y:Math.floor(i.y-r),width:Math.ceil(i.width+r*2),height:Math.ceil(i.height+r*2)};if(!Number.isFinite(t.width)||!Number.isFinite(t.height)||t.width<1||t.height<1)return{frameSize:{...A},crop:{x:0,y:0,...A}};if(o!=="fullscreen"){const n=Math.max(R,t.width),c=Math.max(R,t.height);t.x-=(n-t.width)/2,t.y-=(c-t.height)/2,t.width=n,t.height=c}return{frameSize:{width:t.width,height:t.height},crop:t}}function ut(e){return e instanceof Error?e.message:String(e)}async function pt(e,o,i){const r=[],t=[];for(const{identity:n,Component:c,layout:h}of e){if(o?.aborted)break;const g=u=>{t.push({id:n.id,modulePath:n.modulePath,storyName:n.storyName,reason:u})};try{const u=await i(c);if(!nt(u.stage)){u.dispose(),g("The story mounted no Pixi content.");continue}r.push({...n,mounted:u,...dt(u,h)})}catch(u){g(ut(u))}}return{exhibits:r,skipped:t}}function mt(e,o=[],i){return T(async r=>{const{exhibits:t,skipped:n}=await pt(ct(e),i,r),c={exhibits:t,ghosts:lt(e,o),skipped:n};if(i?.aborted)throw _(c),new Error("The 2D board build was superseded by a newer one.");return c})}function M(e){return T(async()=>{_(e)})}function _(e){for(const o of e.exhibits)try{o.mounted.dispose()}catch(i){console.error("[canvas-board] a story mount failed to dispose.",i)}}const ft="2D",ht=4;function yt(e,o,i){const r=new Set,t=j(e).map(n=>({id:n.id,label:n.label,...n.title?{secondaryLabel:n.title}:{},kind:"frame",typeLabel:"Frame",parentId:null,childIds:[]}));return{capabilities:{transform:!1,inspectorFields:!1,persist:!1},hierarchy:{roots:()=>t,node:n=>t.find(c=>c.id===n)??null},selection:{get:()=>{const n=o();return n?[n]:[]},set:n=>{const c=n.at(-1);c&&i(c)}},subscribe(n){return r.add(n),()=>r.delete(n)},notify(){for(const n of r)n()}}}function j(e){return[...e.exhibits.map(o=>({id:o.id,label:o.label,modulePath:o.modulePath,...o.district?{title:o.district}:{},frameSize:o.frameSize})),...e.ghosts.map(o=>({id:o.key,label:o.name,modulePath:o.path,title:ot,frameSize:st}))]}function gt(e,o,i){const r=j(o),t=r[0];if(!t)return null;const n=document.createElement("div");n.dataset.testid="canvas-board-layer",n.style.position="absolute",n.style.left="0",n.style.top="0",n.style.transformOrigin="0 0",e.appendChild(n);let c=null,h=t.id;c=B(n,r,t.id,(a,m)=>{h=a,c?.activate(a,m==="zoom"),i?.()},et(r));const g=[];for(const a of o.exhibits){const m=c.frames.get(a.id);if(!m)continue;const f=a.mounted.host;f.setAttribute("style",`position:absolute;left:${-a.crop.x}px;top:${-a.crop.y}px;width:${a.mounted.app.screen.width}px;height:${a.mounted.app.screen.height}px;overflow:visible;contain:layout paint;`);const k=a.mounted.app.canvas;k.style.display="block",k.style.width=`${a.mounted.app.screen.width}px`,k.style.height=`${a.mounted.app.screen.height}px`,m.content.appendChild(f),g.push(k)}for(const a of o.ghosts){const m=c.frames.get(a.key);if(!m)continue;m.element.style.border=`1px dashed ${S.boundary.strong}`;const f=document.createElement("div");f.dataset.testid="canvas-board-ghost",f.textContent="No story yet",f.style.position="absolute",f.style.inset="0",f.style.display="flex",f.style.alignItems="center",f.style.justifyContent="center",f.style.color=S.content.dim,f.style.font=`11px ${S.typography.sans}`,f.style.pointerEvents="none",m.content.appendChild(f)}const u=Q(o.exhibits.map(a=>a.mounted.app)),b=()=>{const a=N();n.style.transform=J(a)??"";const m=a.zoom>=1?"pixelated":"auto";for(const f of g)f.style.imageRendering=m},v=$(b);b();const P=requestAnimationFrame(()=>c?.fitAll());let C=!1,x=0,s=0,p=0;const l=a=>{x=requestAnimationFrame(l),p+=s===0?16:Math.min(100,a-s),s=a;for(const m of o.exhibits)try{m.mounted.ticker.update(p)}catch(f){console.error("[canvas-board] an exhibit failed to tick.",f)}};return{selectAt(a,m){return c?.selectAtClientPoint(a,m)??!1},activeStoryId(){return h},selectStory(a){return r.some(m=>m.id===a)?(h=a,c?.activate(a,!1),i?.(),!0):!1},zoomAt(a,m){return c?.zoomAtClientPoint(a,m)??!1},setPlaying(a){a!==C&&(C=a,a?(s=0,x=requestAnimationFrame(l)):(cancelAnimationFrame(x),x=0))},dispose(){cancelAnimationFrame(x),cancelAnimationFrame(P),v(),u();for(const a of o.exhibits)a.mounted.host.remove();c?.dispose(),c=null,n.remove()}}}function bt({active:e}){const o=d.useSyncExternalStore(Y,G),i=d.useRef(null),r=d.useRef(null),t=d.useRef(null),n=d.useRef(null),[c,h]=d.useState({status:"idle"}),[g,u]=d.useState(e);d.useEffect(()=>{e&&u(!0)},[e]),d.useEffect(()=>{const s=i.current;if(s)return O(s)},[]),d.useEffect(()=>{if(!g)return;const s=new AbortController;let p=null;return h({status:"building"}),H().then(l=>(l.ok||W.warn(`Component index unavailable, so this board shows no ghost frames: ${l.reason}`,"canvas-board"),mt(o,l.ok?l.entries:[],s.signal))).then(l=>{if(s.signal.aborted){M(l);return}p=l,h({status:"ready",board:l})},l=>{s.signal.aborted||h({status:"error",message:l instanceof Error?l.message:String(l)})}),()=>{s.abort(),p&&M(p)}},[o,g]);const b=c.status==="ready"?c.board:null,[v,P]=d.useState(null);d.useEffect(()=>{const s=i.current;if(!s||!b)return;const p=gt(s,b,()=>{P(r.current?.activeStoryId()??null)});return r.current=p,P(p?.activeStoryId()??null),()=>{r.current=null,p?.dispose()}},[b]);const C=b?.exhibits.find(s=>s.id===v)??null,x=d.useMemo(()=>b?yt(b,()=>r.current?.activeStoryId()??null,s=>r.current?.selectStory(s)):null,[b]);return d.useEffect(()=>{x?.notify()},[x,v]),d.useEffect(()=>{if(e)return Z(w,()=>({adapter:x,nodeId:null}))},[e,x]),d.useEffect(()=>{if(!(!e||!C))return U(w,()=>({id:C.id,title:C.label,kindLabel:"Canvas story",note:{text:`${C.storyName} · ${C.modulePath}`,testId:"canvas-board-subject-note"},sections:[]}))},[e,C]),d.useEffect(()=>(r.current?.setPlaying(e),()=>r.current?.setPlaying(!1)),[e,b]),y.jsxs("div",{"data-testid":"canvas-board","data-volter-backdrop-color":e?E:void 0,"data-volter-backdrop-policy":e?"dark-frost":void 0,style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"auto",touchAction:"none",userSelect:"none",WebkitUserSelect:"none",backgroundColor:E},ref:i,onPointerDown:s=>{t.current={x:s.clientX,y:s.clientY},n.current={x:s.clientX,y:s.clientY},s.currentTarget.setPointerCapture(s.pointerId)},onPointerMove:s=>{const p=n.current;if(!p)return;const l=s.clientX-p.x,a=s.clientY-p.y;l===0&&a===0||(n.current={x:s.clientX,y:s.clientY},q(l,a))},onPointerUp:s=>{const p=t.current;t.current=null,n.current=null,s.currentTarget.hasPointerCapture(s.pointerId)&&s.currentTarget.releasePointerCapture(s.pointerId),!(!p||Math.hypot(s.clientX-p.x,s.clientY-p.y)>ht)&&r.current?.selectAt(s.clientX,s.clientY)},onPointerCancel:()=>{t.current=null,n.current=null},onDoubleClick:s=>{r.current?.zoomAt(s.clientX,s.clientY)},children:[y.jsx(xt,{}),b?y.jsx(St,{board:b}):y.jsxs("div",{"data-testid":"canvas-board-status",style:{padding:16,fontSize:12,color:S.content.muted},children:[c.status==="error"&&c.message,c.status==="building"&&"Mounting every canvas story off-screen…",c.status==="idle"&&"Open this tab to lay out every canvas story at 1× texels."]}),y.jsx(tt,{containerRef:i,context:null,boardOnly:!0})]})}function xt(){const e=d.useSyncExternalStore($,N),o=Math.max(8,24*e.zoom),i=Math.max(.7,Math.min(1.4,e.zoom));return y.jsx("div",{"data-testid":"react-design-canvas-backdrop","aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:E,backgroundImage:`radial-gradient(circle, ${D} ${i}px, transparent ${i}px)`,backgroundPosition:`${e.x}px ${e.y}px`,backgroundSize:`${o}px ${o}px`}})}function St({board:e}){const[o,i]=d.useState(!1),r=rt(e.skipped);return y.jsxs("div",{"data-testid":"canvas-board-status",style:{position:"absolute",left:8,bottom:8,maxWidth:420,padding:"4px 8px",borderRadius:S.shape.small,background:S.surface.raised,border:`1px solid ${S.boundary.default}`,fontSize:10,color:S.content.muted,pointerEvents:"auto"},children:[e.exhibits.length," exhibit",e.exhibits.length===1?"":"s",e.ghosts.length>0&&y.jsxs(y.Fragment,{children:[" · ",e.ghosts.length," component",e.ghosts.length===1?"":"s"," without stories"]}),e.skipped.length>0&&y.jsxs(y.Fragment,{children:[" · ",y.jsxs("span",{role:"button",tabIndex:0,"aria-expanded":o,onClick:()=>i(t=>!t),onKeyDown:t=>{(t.key===" "||t.key==="Enter")&&(t.preventDefault(),i(n=>!n))},style:{cursor:"pointer",color:S.accent.default},children:[r.stories," ",r.stories===1?"story":"stories"," in ",r.modules," ",r.modules===1?"module":"modules"," not on this board"]})]}),o&&y.jsx("div",{style:{marginTop:4,maxHeight:160,overflow:"auto"},children:e.skipped.map(t=>y.jsxs("div",{style:{padding:"1px 0"},children:[y.jsxs("code",{style:{color:S.content.dim},children:[t.modulePath,"#",t.storyName]})," ","— ",t.reason]},t.id))})]})}function zt(){return V({id:w,title:ft,kind:"content-browser",workspaceRole:"workspace-reference",Content:bt,closeable:!1,readOnly:!0,presentation:()=>({kind:"workspace",id:w})},{category:"canvas"})}export{w as CANVAS_COMPONENTS_DOCUMENT_ID,zt as installCanvasBoardDocument};
@@ -1 +1 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as he,U as W,fC as ge,bq as R,br as X,G as U,fD as A,aC as te,fE as xe,fF as oe,bw as T,aM as N,a7 as k,fG as fe,dk as me,fH as be,fI as Se,d9 as J,a6 as _,di as ye,dF as ve,dG as je,fJ as ne,fK as ze,fL as se,bL as $,fM as P,bA as Ee,fN as Q,bB as L,bD as I,bC as ee,fO as we,fP as Ce,fQ as ke,fR as Me,fS as Ge,fT as Fe}from"./index-r-FuctN5.js";import{r as u}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{S as Ne,a as re}from"./react-canvas-navigation-S-IbbVDw.js";import{s as ie,c as ae,a as le,r as Pe,b as K,m as ce,V as Le,d as Te,e as Ve}from"./RootSelectionOverlay-BlDdfAyN.js";import{a as De}from"./Toolbar-bpjNJw1o.js";import{r as Ye}from"./transform-mode-request-C7qEF7HB.js";import{T as $e}from"./TransientHint-Cs1xJsTR.js";import{p as We}from"./layered-pick-1v6rbWkT.js";function Re(t,s,o,r){const g=i=>()=>{s(),Ye(t,i)};return he().keyboard.bindActions([{id:"transform.select",scope:"stage",run:g("select")},{id:"transform.translate",scope:"stage",run:g("translate")},{id:"transform.rotate",scope:"stage",run:g("rotate")},{id:"transform.scale",scope:"stage",run:g("scale")},{id:"canvas.panMode",scope:"stage",run:()=>o("pan")},{id:"canvas.rulerMode",scope:"stage",run:()=>o("ruler")},{id:"canvas.toggleGrid",scope:"stage",run:r}])}const nt="#111214";function de(t,s=32){let o=s>0?s:32;for(;o*t<12;)o*=2;for(;o*t>48;)o/=2;return o}function D(t){if(t.length===0)return null;let s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;for(const i of t)s=Math.min(s,i.x),o=Math.min(o,i.y),r=Math.max(r,i.x+i.width),g=Math.max(g,i.y+i.height);return{x:s,y:o,width:r-s,height:g-o}}function O(t,s,o){if(!o||!(o.width>0)||!(o.height>0))return;const r=Math.max(1,t.clientWidth-96),g=Math.max(1,t.clientHeight-96),i=Math.min(4,Math.max(re,Math.min(r/o.width,g/o.height)));s.setView(t.clientWidth/2-(o.x+o.width/2)*i,t.clientHeight/2-(o.y+o.height/2)*i,i)}function st({view:t,documentId:s}){const o=W();u.useSyncExternalStore(o.subscribe,o.getSnapshot),u.useEffect(()=>ge(s,"canvas"),[s]),u.useSyncExternalStore(R,X);const r=U(s),g=A(s),i=te()?.config.resolution,l=u.useSyncExternalStore(t.subscribe,t.get,t.get);u.useSyncExternalStore(u.useCallback(x=>ie(t,x),[t]),u.useCallback(()=>ae(t),[t]));const c=le(t),v=o.snap2D,a=de(l.zoom,v.step)*l.zoom,y=a*Math.max(1,Math.round(v.primaryEvery)),p=l.x+v.offsetX*l.zoom,b=l.y+v.offsetY*l.zoom;return e.jsxs("div",{"data-testid":"canvas-scene-backdrop",style:{position:"absolute",inset:0,zIndex:2,overflow:"hidden",pointerEvents:"none"},children:[r&&(!g.gridWhenSnapping||o.snapEnabled)&&e.jsx("div",{"data-testid":"canvas-scene-grid",style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(255,255,255,.075) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.075) 1px, transparent 1px),linear-gradient(rgba(255,255,255,.14) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.14) 1px, transparent 1px)",backgroundPosition:`${p}px ${b}px`,backgroundSize:`${a}px ${a}px, ${a}px ${a}px, ${y}px ${y}px, ${y}px ${y}px`}}),g.viewport&&i&&i.width>0&&i.height>0&&e.jsx("div",{"data-testid":"canvas-scene-viewport-rect",style:{position:"absolute",left:l.x,top:l.y,width:i.width*l.zoom,height:i.height*l.zoom,boxSizing:"border-box",borderStyle:"solid",borderWidth:1,borderColor:"rgba(160, 120, 255, .75)"}}),g.origin&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-testid":"canvas-scene-origin-y",style:{position:"absolute",left:0,right:0,top:l.y,height:1,background:"rgba(238, 91, 91, .8)"}}),e.jsx("div",{"data-testid":"canvas-scene-origin-x",style:{position:"absolute",top:0,bottom:0,left:l.x,width:1,background:"rgba(87, 199, 126, .8)"}}),e.jsx("div",{style:{position:"absolute",left:l.x+6,top:l.y+6,color:"rgba(255,255,255,.68)",font:"10px ui-monospace, SFMono-Regular, Menlo, monospace"},children:"0, 0"})]}),g.guides&&c.map(x=>e.jsx("div",{"data-testid":`canvas-scene-guide-${x.axis}`,title:`${x.axis.toUpperCase()} ${Math.round(x.value*100)/100} · drag to move · right-click to remove`,onContextMenu:S=>{S.preventDefault(),Pe(t,x.id)},onPointerDown:S=>{S.preventDefault(),S.stopPropagation();const h=S.currentTarget.parentElement?.getBoundingClientRect();if(!h)return;const E=d=>{const m=x.axis==="x"?d.clientX-h.left:d.clientY-h.top,n=t.get();ce(t,x.id,(m-(x.axis==="x"?n.x:n.y))/n.zoom)},C=()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",C)};window.addEventListener("pointermove",E),window.addEventListener("pointerup",C,{once:!0})},style:{position:"absolute",pointerEvents:"auto",cursor:x.axis==="x"?"ew-resize":"ns-resize",...x.axis==="x"?{left:l.x+x.value*l.zoom-4,top:20,bottom:0,width:9,borderLeft:"1px solid rgba(74, 180, 255, .95)"}:{top:l.y+x.value*l.zoom-4,left:20,right:0,height:9,borderTop:"1px solid rgba(74, 180, 255, .95)"}}},x.id)),g.rulers&&e.jsx(Xe,{view:t})]})}function Xe({view:t}){const s=u.useSyncExternalStore(t.subscribe,t.get,t.get),o=u.useRef(null),r=u.useRef(null),[g,i]=u.useState({width:0,height:0});u.useEffect(()=>{const p=()=>{const x=o.current?.clientWidth??0,S=r.current?.clientHeight??0;i(h=>h.width===x&&h.height===S?h:{width:x,height:S})};if(p(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(p);return o.current&&b.observe(o.current),r.current&&b.observe(r.current),()=>b.disconnect()},[]);const l=(p,b)=>{if(!(b>0))return[];const x=p==="x"?s.x:s.y,S=de(s.zoom),h=S*s.zoom,E=20,C=Math.ceil((E-x)/h),d=Math.floor((E+b-x)/h);return Array.from({length:Math.max(0,d-C+1)},(m,n)=>{const f=C+n;return{major:f%4===0,screen:x+f*h-E,value:f*S}})},c=l("x",g.width),v=l("y",g.height),a=(p,b)=>{b.preventDefault(),b.stopPropagation();const x=b.currentTarget.parentElement?.getBoundingClientRect();if(!x)return;const S=(d,m)=>{const n=t.get();return((p==="x"?d-x.left:m-x.top)-(p==="x"?n.x:n.y))/n.zoom},h=Te(t,p,S(b.clientX,b.clientY)),E=d=>ce(t,h,S(d.clientX,d.clientY)),C=()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",C)};window.addEventListener("pointermove",E),window.addEventListener("pointerup",C,{once:!0})},y={position:"absolute",pointerEvents:"auto",backgroundColor:"rgba(24, 26, 30, .96)",border:0,borderColor:"rgba(255,255,255,.14)",boxSizing:"border-box"};return e.jsxs(e.Fragment,{children:[e.jsx("button",{ref:o,type:"button","data-testid":"canvas-scene-ruler-x","aria-label":"Horizontal ruler; drag to create a horizontal guide",onPointerDown:p=>a("y",p),style:{...y,left:20,right:0,top:0,height:20,borderBottomStyle:"solid",borderBottomWidth:1,cursor:"row-resize",padding:0,overflow:"hidden"},children:c.map(p=>e.jsx("span",{"aria-hidden":"true","data-ruler-axis":"x","data-ruler-value":p.value,style:{position:"absolute",left:p.screen,bottom:0,width:1,height:p.major?8:4,background:p.major?"rgba(255,255,255,.5)":"rgba(255,255,255,.28)",pointerEvents:"none"},children:p.major&&e.jsx("span",{style:{position:"absolute",left:3,bottom:5,color:"rgba(255,255,255,.62)",font:"9px ui-monospace, SFMono-Regular, Menlo, monospace",lineHeight:1,whiteSpace:"nowrap"},children:p.value})},p.value))}),e.jsx("button",{ref:r,type:"button","data-testid":"canvas-scene-ruler-y","aria-label":"Vertical ruler; drag to create a vertical guide",onPointerDown:p=>a("x",p),style:{...y,top:20,bottom:0,left:0,width:20,borderRightStyle:"solid",borderRightWidth:1,cursor:"col-resize",padding:0,overflow:"hidden"},children:v.map(p=>e.jsx("span",{"aria-hidden":"true","data-ruler-axis":"y","data-ruler-value":p.value,style:{position:"absolute",top:p.screen,right:0,width:p.major?8:4,height:1,background:p.major?"rgba(255,255,255,.5)":"rgba(255,255,255,.28)",pointerEvents:"none"},children:p.major&&e.jsx("span",{style:{position:"absolute",right:4,top:3,color:"rgba(255,255,255,.62)",font:"9px ui-monospace, SFMono-Regular, Menlo, monospace",lineHeight:1,whiteSpace:"nowrap",writingMode:"vertical-rl",transform:"rotate(180deg)"},children:p.value})},p.value))}),e.jsx("div",{style:{...y,left:0,top:0,width:20,height:20}})]})}function rt({active:t,adapter:s,containerRef:o,view:r,documentId:g}){const i=W();u.useSyncExternalStore(i.subscribe,i.getSnapshot),u.useSyncExternalStore(R,X);const l=u.useSyncExternalStore(r.subscribe,r.get,r.get),[c,v]=u.useState(()=>B.get(r)??null),a=u.useCallback(d=>{B.set(r,d),v(d)},[r]);u.useEffect(()=>xe(g),[g]),u.useEffect(()=>{if(t)return Re(i,()=>a(null),d=>a(B.get(r)===d?null:d),()=>ue(g))},[t,i,a,r,g]);const y=i.transformMode,p=u.useRef(y);u.useEffect(()=>{p.current!==y&&(p.current=y,a(null))},[y,a]);const b=u.useCallback(d=>{const m=o.current;if(!m)return;const n=Math.min(Ne,Math.max(re,d)),f=m.clientWidth/2,j=m.clientHeight/2,z=(f-l.x)/l.zoom,G=(j-l.y)/l.zoom;r.setView(f-z*n,j-G*n,n)},[o,l,r]),x=u.useCallback(d=>{if(!s?.rects)return[];const m=[];for(const n of d){const f=s.rects.rect(n);f&&f.width>0&&f.height>0&&m.push(f)}return m},[s]),S=u.useCallback(()=>{const d=o.current;d&&O(d,r,D(x(i.selectedEntityIds)))},[o,x,i,r]),h=u.useCallback(()=>{const d=o.current;if(!d)return;const m=r.get(),n=te()?.config.resolution,f=n?n.width/2:0,j=n?n.height/2:0;r.setView(d.clientWidth/2-f*m.zoom,d.clientHeight/2-j*m.zoom,m.zoom)},[o,r]),E=u.useCallback(()=>{const d=o.current,m=D(x(i.selectedEntityIds));if(!d||!m)return;const n=r.get();r.setView(d.clientWidth/2-(m.x+m.width/2)*n.zoom,d.clientHeight/2-(m.y+m.height/2)*n.zoom,n.zoom)},[o,x,i,r]),C=u.useCallback(()=>{const d=o.current;!d||!s||O(d,r,D(x(oe(s))))},[s,o,x,r]);return u.useEffect(()=>{if(t)return i.onViewportAction(d=>{if(d.type==="focus-entity"){const m=o.current;if(!m)return;O(m,r,D(x([d.id])))}else d.type==="focus-selection"?S():d.type==="focus-scene"&&C()})},[t,o,C,S,x,i,r]),e.jsxs(e.Fragment,{children:[e.jsx($e,{}),e.jsx(De,{dimensions:"2d",otherToolActive:c!==null,onToolArmed:()=>a(null),viewTools:e.jsxs(e.Fragment,{children:[e.jsx(T,{text:"List Select: click to list the selectable nodes there",children:e.jsx(N,{"aria-label":"List Select mode","aria-pressed":c==="list",size:"comfortable",onClick:()=>a(c==="list"?null:"list"),children:e.jsx(k,{icon:fe,size:"md"})})}),e.jsx(T,{text:"Pivot: click or drag to put the selected node's pivot there",children:e.jsx(N,{"aria-label":"Pivot mode","aria-pressed":c==="pivot",size:"comfortable",onClick:d=>{if(d.shiftKey){const m=s?[...i.selectedEntityIds].map(f=>s.rects?.rect(f)).filter(f=>f!=null):[],n=D(m);n&&K(r,{x:n.x+n.width/2,y:n.y+n.height/2}),a("pivot");return}a(c==="pivot"?null:"pivot")},children:e.jsx(k,{icon:me,size:"md"})})}),e.jsx(T,{text:"Pan (Space-drag pans in any mode)",children:e.jsx(N,{"aria-label":"Pan mode","aria-pressed":c==="pan",size:"comfortable",onClick:()=>a(c==="pan"?null:"pan"),children:e.jsx(k,{icon:be,size:"md"})})}),e.jsx(T,{text:"Ruler: drag to measure distance and angle",children:e.jsx(N,{"aria-label":"Ruler mode","aria-pressed":c==="ruler",size:"comfortable",onClick:()=>a(c==="ruler"?null:"ruler"),children:e.jsx(k,{icon:Se,size:"md"})})})]}),trailingTools:e.jsxs(e.Fragment,{children:[e.jsx(Ie,{adapter:s,selected:[...i.selectedEntityIds]}),e.jsx(Be,{adapter:s,selected:[...i.selectedEntityIds]}),e.jsx(He,{documentId:g,view:r,hasSelection:i.selectedEntityIds.size>0,onCenterSelection:E,onFrameSelection:S})]})}),e.jsx(Ae,{adapter:s,view:r,documentId:g}),c?e.jsx(Oe,{mode:c,view:r,adapter:s,containerRef:o,onExit:()=>a(null)}):null,e.jsx(J,{label:"2D scene display",className:"volter-viewport-toolbar volter-viewport-toolbar-right","data-volter-canvas-navigation-ignore":"true",children:e.jsx(_,{"aria-label":"Frame all",variant:"ghost",size:"comfortable",onClick:C,children:"Frame all"})}),e.jsxs(J,{label:"2D scene navigation",className:"volter-canvas-scene-navigation","data-volter-canvas-navigation-ignore":"true",children:[e.jsx(N,{"aria-label":"Center view",title:"Center view: the game's viewport in the middle of the pane, at this zoom",size:"comfortable",onClick:h,children:e.jsx(k,{icon:ye,size:"md"})}),e.jsx(N,{"aria-label":"Zoom out",title:"Zoom out",size:"comfortable",onClick:()=>b(l.zoom/1.2),children:e.jsx(k,{icon:ve,size:"md"})}),e.jsxs(_,{variant:"ghost","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",size:"comfortable",onClick:()=>b(1),children:[Math.round(l.zoom*100),"%"]}),e.jsx(N,{"aria-label":"Zoom in",title:"Zoom in",size:"comfortable",onClick:()=>b(l.zoom*1.2),children:e.jsx(k,{icon:je,size:"md"})})]})]})}function Ae({adapter:t,view:s,documentId:o}){const r=u.useSyncExternalStore(s.subscribe,s.get,s.get),g=u.useCallback(a=>t?.subscribe?.(a)??(()=>{}),[t]),[i,l]=u.useState(0);u.useEffect(()=>g(()=>l(a=>a+1)),[g]),u.useSyncExternalStore(R,X);const c=A(o);if(!t?.inspector||!t.rects||!c.lock&&!c.group)return null;const v=oe(t).flatMap(a=>{const y=c.lock&&t.inspector?.get(a,"locked")===!0,p=c.group&&t.inspector?.get(a,"grouped")===!0,b=y||p?t.rects?.rect(a):null;return b?[{id:a,locked:y,grouped:p,x:r.x+b.x*r.zoom,y:r.y+b.y*r.zoom}]:[]});return e.jsx("div",{"data-testid":"canvas-scene-edit-gizmos","data-revision":i,style:{position:"absolute",inset:0,zIndex:55,pointerEvents:"none",overflow:"hidden"},children:v.map(a=>e.jsxs("div",{"data-testid":"canvas-scene-edit-gizmo","data-locked":a.locked,"data-grouped":a.grouped,style:{position:"absolute",left:a.x+2,top:a.y+2,display:"flex",gap:2,color:"#fff"},children:[a.locked?e.jsx(k,{icon:ne,size:"xs"}):null,a.grouped?e.jsx(k,{icon:se,size:"xs"}):null]},a.id))})}function He({documentId:t,view:s,hasSelection:o,onCenterSelection:r,onFrameSelection:g}){const[i,l]=u.useState(!1),c=u.useRef(null);u.useSyncExternalStore(R,X),u.useSyncExternalStore(u.useCallback(h=>ie(s,h),[s]),u.useCallback(()=>ae(s),[s]));const v=W();u.useSyncExternalStore(v.subscribe,v.getSnapshot);const a=A(t),y=U(t),p=[{label:"Show Grid",on:y&&!a.gridWhenSnapping,pick:()=>{$(t,!0),P(t,{gridWhenSnapping:!1})}},{label:"Show Grid When Snapping",on:y&&a.gridWhenSnapping,pick:()=>{$(t,!0),P(t,{gridWhenSnapping:!0})}},{label:"Hide Grid",on:!y,pick:()=>$(t,!1)}],b=()=>ue(t),x=[{label:"Rulers",on:a.rulers,toggle:()=>P(t,{rulers:!a.rulers})},{label:"Guides",on:a.guides,toggle:()=>P(t,{guides:!a.guides})},{label:"Origin",on:a.origin,toggle:()=>P(t,{origin:!a.origin})},{label:"Viewport",on:a.viewport,toggle:()=>P(t,{viewport:!a.viewport})}],S=h=>()=>{h(),l(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(_,{ref:c,"aria-label":"View","aria-haspopup":"menu","aria-expanded":i,variant:"ghost",size:"comfortable",onClick:()=>l(!i),children:"View"}),i&&e.jsxs(Ee,{anchorRef:c,align:"end",clamp:!0,"aria-label":"2D view",onDismiss:()=>l(!1),children:[e.jsxs(Q,{label:"Grid","data-testid":"canvas-scene-grid-submenu",children:[p.map(h=>e.jsxs(L,{role:"menuitemradio","aria-checked":h.on,onSelect:S(h.pick),children:[e.jsx("span",{className:"volter-menu-check",children:h.on&&e.jsx(k,{icon:I,size:"xs"})}),h.label]},h.label)),e.jsx(ee,{}),e.jsxs(L,{"data-testid":"canvas-scene-toggle-grid",onSelect:S(b),children:[e.jsx("span",{className:"volter-menu-check"}),"Toggle Grid"]})]}),x.map(h=>e.jsxs(L,{role:"menuitemcheckbox","aria-checked":h.on,onSelect:S(h.toggle),children:[e.jsx("span",{className:"volter-menu-check",children:h.on&&e.jsx(k,{icon:I,size:"xs"})}),h.label.startsWith("Show ")?h.label:`Show ${h.label}`]},h.label)),e.jsx(Q,{label:"Gizmos","data-testid":"canvas-scene-gizmos-submenu",children:[["position","Position"],["lock","Lock"],["group","Group"],["transformation","Transformation"]].map(([h,E])=>e.jsxs(L,{role:"menuitemcheckbox","aria-checked":a[h],onSelect:S(()=>P(t,{[h]:!a[h]})),children:[e.jsx("span",{className:"volter-menu-check",children:a[h]&&e.jsx(k,{icon:I,size:"xs"})}),E]},h))}),e.jsx(ee,{}),e.jsxs(L,{disabled:!o,onSelect:S(r),children:[e.jsx("span",{className:"volter-menu-check"}),"Center Selection"]}),e.jsxs(L,{disabled:!o,onSelect:S(g),children:[e.jsx("span",{className:"volter-menu-check"}),"Frame Selection"]}),e.jsxs(L,{disabled:le(s).length===0,onSelect:S(()=>Ve(s)),children:[e.jsx("span",{className:"volter-menu-check"}),"Clear Guides"]})]})]})}function Ie({adapter:t,selected:s}){const o=s.filter(l=>t?.inspector?.properties(l).some(c=>c.path==="locked")),r=o.length>0&&o.every(l=>t?.inspector?.get(l,"locked")===!0),g=o.length>1?"nodes":"node",i=r?`Unlock selected ${g}`:`Lock selected ${g}`;return e.jsx(T,{text:o.length>0?i:"Select a node to lock it",children:e.jsx(N,{"aria-label":i,"aria-pressed":r,size:"comfortable",disabled:o.length===0||!t?.inspector?.set,onClick:()=>{for(const l of o)t?.inspector?.set?.(l,"locked",!r)},children:e.jsx(k,{icon:r?ne:ze,size:"md"})})})}function ue(t){const s=U(t)&&!A(t).gridWhenSnapping;$(t,!0),P(t,{gridWhenSnapping:s})}const B=new WeakMap;function Oe({mode:t,view:s,adapter:o,containerRef:r,onExit:g}){const i=W(),l=u.useSyncExternalStore(s.subscribe,s.get,s.get),[c,v]=u.useState(null),[a,y]=u.useState(null);u.useEffect(()=>{const n=f=>{f.key==="Escape"&&(t==="pivot"&&K(s,null),g())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[g]);const p=(n,f)=>{const j=r.current?.getBoundingClientRect(),z=s.get(),G=n-(j?.left??0),w=f-(j?.top??0);return{x:(G-z.x)/z.zoom,y:(w-z.y)/z.zoom}},b=n=>{const f=i.snap2D,j=(G,w)=>i.snapEnabled&&f.step>0?Math.round((G-w)/f.step)*f.step+w:G,z={x:j(n.x,f.offsetX),y:j(n.y,f.offsetY)};return f.pixel?{x:Math.round(z.x),y:Math.round(z.y)}:z},x=(n,f,j)=>{if(!o)return f;const z=Ce(o,n);return ke(f,Ge(o,n)??(z?Fe(z):null),{invert:j,smart:i.smartSnap,gridOn:i.snapEnabled,grid:i.snap2D,threshold:Me/Math.max(s.get().zoom,.01)})},S=n=>{if(n.button!==0)return;if(n.preventDefault(),t==="list"){const w=We(i,n.clientX,n.clientY,o?{adapter:o}:{});y(w.length>0?{x:n.clientX,y:n.clientY,ids:w}:null);return}if(t==="pivot"&&n.shiftKey){K(s,b(p(n.clientX,n.clientY)));return}if(t==="pivot"){const w=i.selectedEntityIds,F=w.size===1&&o?[...w][0]:null,V=F&&o?we(o,F):null,Y=F?V?.layers(F).find(M=>M.category==="origin")?.handles.find(M=>M.writable):void 0;if(!F||!V||!Y)return;n.currentTarget.setPointerCapture(n.pointerId);const H=M=>{const q=x(F,p(M.clientX,M.clientY),M.metaKey||M.ctrlKey);return[q.x,q.y,0]};V.preview(F,Y.id,H(n));const Z=M=>V.preview(F,Y.id,H(M)),pe=M=>{window.removeEventListener("pointermove",Z),V.commit(F,Y.id,H(M))};window.addEventListener("pointermove",Z),window.addEventListener("pointerup",pe,{once:!0});return}n.currentTarget.setPointerCapture(n.pointerId);const f={clientX:n.clientX,clientY:n.clientY,pose:s.get()},j=p(n.clientX,n.clientY);t==="ruler"&&v({from:b(j),to:b(j)});const z=w=>{t==="pan"?s.setView(f.pose.x+w.clientX-f.clientX,f.pose.y+w.clientY-f.clientY,f.pose.zoom):v({from:b(j),to:b(p(w.clientX,w.clientY))})},G=()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",G)};window.addEventListener("pointermove",z),window.addEventListener("pointerup",G,{once:!0})},h=n=>({x:l.x+n.x*l.zoom,y:l.y+n.y*l.zoom}),E=c?Math.hypot(c.to.x-c.from.x,c.to.y-c.from.y):0,C=c?Math.atan2(c.to.y-c.from.y,c.to.x-c.from.x)*180/Math.PI:0,d=c?h(c.from):null,m=c?h(c.to):null;return e.jsxs("div",{"data-testid":`canvas-scene-${t}-layer`,"data-volter-canvas-navigation-ignore":"true",onPointerDown:S,style:{position:"absolute",inset:0,zIndex:60,cursor:t==="pan"?"grab":t==="list"?"context-menu":"crosshair"},children:[a&&o?e.jsx(Le,{state:a,adapter:o,onClose:()=>y(null)}):null,d&&m?e.jsxs(e.Fragment,{children:[e.jsx("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none"},children:e.jsx("line",{x1:d.x,y1:d.y,x2:m.x,y2:m.y,stroke:"#ff5fa2",strokeWidth:1.5})}),e.jsx("div",{"data-testid":"canvas-scene-ruler-reading",style:{position:"absolute",left:(d.x+m.x)/2+8,top:(d.y+m.y)/2+8,padding:"2px 6px",borderRadius:4,background:"rgba(24, 26, 30, .92)",color:"#fff",font:"11px ui-monospace, SFMono-Regular, Menlo, monospace",pointerEvents:"none",whiteSpace:"nowrap"},children:`${E.toFixed(1)} px · ${C.toFixed(1)}° · Δ ${(c.to.x-c.from.x).toFixed(1)}, ${(c.to.y-c.from.y).toFixed(1)}`})]}):null]})}function Be({adapter:t,selected:s}){const o=s.filter(l=>t?.inspector?.properties(l).some(c=>c.path==="grouped")),r=o.length>0&&o.every(l=>t?.inspector?.get(l,"grouped")===!0),g=o.length>1?"nodes":"node",i=r?`Ungroup selected ${g}`:`Group selected ${g} with their children`;return e.jsx(T,{text:o.length>0?i:"Select a node to group it",children:e.jsx(N,{"aria-label":i,"aria-pressed":r,size:"comfortable",disabled:o.length===0||!t?.inspector?.set,onClick:()=>{for(const l of o)t?.inspector?.set?.(l,"grouped",!r)},children:e.jsx(k,{icon:se,size:"md"})})})}export{nt as C,st as a,rt as b};
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as he,U as W,fC as ge,bq as R,br as X,G as U,fD as A,aC as te,fE as xe,fF as oe,bw as T,aM as N,a7 as k,fG as fe,dk as me,fH as be,fI as Se,d9 as J,a6 as _,di as ye,dF as ve,dG as je,fJ as ne,fK as ze,fL as se,bL as $,fM as P,bA as Ee,fN as Q,bB as L,bD as I,bC as ee,fO as we,fP as Ce,fQ as ke,fR as Me,fS as Ge,fT as Fe}from"./index-jhDTJrJJ.js";import{r as u}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{S as Ne,a as re}from"./react-canvas-navigation-CuOqbCmx.js";import{s as ie,c as ae,a as le,r as Pe,b as K,m as ce,V as Le,d as Te,e as Ve}from"./RootSelectionOverlay-CXVw9xAS.js";import{a as De}from"./Toolbar-DkvknKyY.js";import{r as Ye}from"./transform-mode-request-DsaxVuwS.js";import{T as $e}from"./TransientHint-BfLb1fyi.js";import{p as We}from"./layered-pick-CEWefTxe.js";function Re(t,s,o,r){const g=i=>()=>{s(),Ye(t,i)};return he().keyboard.bindActions([{id:"transform.select",scope:"stage",run:g("select")},{id:"transform.translate",scope:"stage",run:g("translate")},{id:"transform.rotate",scope:"stage",run:g("rotate")},{id:"transform.scale",scope:"stage",run:g("scale")},{id:"canvas.panMode",scope:"stage",run:()=>o("pan")},{id:"canvas.rulerMode",scope:"stage",run:()=>o("ruler")},{id:"canvas.toggleGrid",scope:"stage",run:r}])}const nt="#111214";function de(t,s=32){let o=s>0?s:32;for(;o*t<12;)o*=2;for(;o*t>48;)o/=2;return o}function D(t){if(t.length===0)return null;let s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;for(const i of t)s=Math.min(s,i.x),o=Math.min(o,i.y),r=Math.max(r,i.x+i.width),g=Math.max(g,i.y+i.height);return{x:s,y:o,width:r-s,height:g-o}}function O(t,s,o){if(!o||!(o.width>0)||!(o.height>0))return;const r=Math.max(1,t.clientWidth-96),g=Math.max(1,t.clientHeight-96),i=Math.min(4,Math.max(re,Math.min(r/o.width,g/o.height)));s.setView(t.clientWidth/2-(o.x+o.width/2)*i,t.clientHeight/2-(o.y+o.height/2)*i,i)}function st({view:t,documentId:s}){const o=W();u.useSyncExternalStore(o.subscribe,o.getSnapshot),u.useEffect(()=>ge(s,"canvas"),[s]),u.useSyncExternalStore(R,X);const r=U(s),g=A(s),i=te()?.config.resolution,l=u.useSyncExternalStore(t.subscribe,t.get,t.get);u.useSyncExternalStore(u.useCallback(x=>ie(t,x),[t]),u.useCallback(()=>ae(t),[t]));const c=le(t),v=o.snap2D,a=de(l.zoom,v.step)*l.zoom,y=a*Math.max(1,Math.round(v.primaryEvery)),p=l.x+v.offsetX*l.zoom,b=l.y+v.offsetY*l.zoom;return e.jsxs("div",{"data-testid":"canvas-scene-backdrop",style:{position:"absolute",inset:0,zIndex:2,overflow:"hidden",pointerEvents:"none"},children:[r&&(!g.gridWhenSnapping||o.snapEnabled)&&e.jsx("div",{"data-testid":"canvas-scene-grid",style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(255,255,255,.075) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.075) 1px, transparent 1px),linear-gradient(rgba(255,255,255,.14) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.14) 1px, transparent 1px)",backgroundPosition:`${p}px ${b}px`,backgroundSize:`${a}px ${a}px, ${a}px ${a}px, ${y}px ${y}px, ${y}px ${y}px`}}),g.viewport&&i&&i.width>0&&i.height>0&&e.jsx("div",{"data-testid":"canvas-scene-viewport-rect",style:{position:"absolute",left:l.x,top:l.y,width:i.width*l.zoom,height:i.height*l.zoom,boxSizing:"border-box",borderStyle:"solid",borderWidth:1,borderColor:"rgba(160, 120, 255, .75)"}}),g.origin&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-testid":"canvas-scene-origin-y",style:{position:"absolute",left:0,right:0,top:l.y,height:1,background:"rgba(238, 91, 91, .8)"}}),e.jsx("div",{"data-testid":"canvas-scene-origin-x",style:{position:"absolute",top:0,bottom:0,left:l.x,width:1,background:"rgba(87, 199, 126, .8)"}}),e.jsx("div",{style:{position:"absolute",left:l.x+6,top:l.y+6,color:"rgba(255,255,255,.68)",font:"10px ui-monospace, SFMono-Regular, Menlo, monospace"},children:"0, 0"})]}),g.guides&&c.map(x=>e.jsx("div",{"data-testid":`canvas-scene-guide-${x.axis}`,title:`${x.axis.toUpperCase()} ${Math.round(x.value*100)/100} · drag to move · right-click to remove`,onContextMenu:S=>{S.preventDefault(),Pe(t,x.id)},onPointerDown:S=>{S.preventDefault(),S.stopPropagation();const h=S.currentTarget.parentElement?.getBoundingClientRect();if(!h)return;const E=d=>{const m=x.axis==="x"?d.clientX-h.left:d.clientY-h.top,n=t.get();ce(t,x.id,(m-(x.axis==="x"?n.x:n.y))/n.zoom)},C=()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",C)};window.addEventListener("pointermove",E),window.addEventListener("pointerup",C,{once:!0})},style:{position:"absolute",pointerEvents:"auto",cursor:x.axis==="x"?"ew-resize":"ns-resize",...x.axis==="x"?{left:l.x+x.value*l.zoom-4,top:20,bottom:0,width:9,borderLeft:"1px solid rgba(74, 180, 255, .95)"}:{top:l.y+x.value*l.zoom-4,left:20,right:0,height:9,borderTop:"1px solid rgba(74, 180, 255, .95)"}}},x.id)),g.rulers&&e.jsx(Xe,{view:t})]})}function Xe({view:t}){const s=u.useSyncExternalStore(t.subscribe,t.get,t.get),o=u.useRef(null),r=u.useRef(null),[g,i]=u.useState({width:0,height:0});u.useEffect(()=>{const p=()=>{const x=o.current?.clientWidth??0,S=r.current?.clientHeight??0;i(h=>h.width===x&&h.height===S?h:{width:x,height:S})};if(p(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(p);return o.current&&b.observe(o.current),r.current&&b.observe(r.current),()=>b.disconnect()},[]);const l=(p,b)=>{if(!(b>0))return[];const x=p==="x"?s.x:s.y,S=de(s.zoom),h=S*s.zoom,E=20,C=Math.ceil((E-x)/h),d=Math.floor((E+b-x)/h);return Array.from({length:Math.max(0,d-C+1)},(m,n)=>{const f=C+n;return{major:f%4===0,screen:x+f*h-E,value:f*S}})},c=l("x",g.width),v=l("y",g.height),a=(p,b)=>{b.preventDefault(),b.stopPropagation();const x=b.currentTarget.parentElement?.getBoundingClientRect();if(!x)return;const S=(d,m)=>{const n=t.get();return((p==="x"?d-x.left:m-x.top)-(p==="x"?n.x:n.y))/n.zoom},h=Te(t,p,S(b.clientX,b.clientY)),E=d=>ce(t,h,S(d.clientX,d.clientY)),C=()=>{window.removeEventListener("pointermove",E),window.removeEventListener("pointerup",C)};window.addEventListener("pointermove",E),window.addEventListener("pointerup",C,{once:!0})},y={position:"absolute",pointerEvents:"auto",backgroundColor:"rgba(24, 26, 30, .96)",border:0,borderColor:"rgba(255,255,255,.14)",boxSizing:"border-box"};return e.jsxs(e.Fragment,{children:[e.jsx("button",{ref:o,type:"button","data-testid":"canvas-scene-ruler-x","aria-label":"Horizontal ruler; drag to create a horizontal guide",onPointerDown:p=>a("y",p),style:{...y,left:20,right:0,top:0,height:20,borderBottomStyle:"solid",borderBottomWidth:1,cursor:"row-resize",padding:0,overflow:"hidden"},children:c.map(p=>e.jsx("span",{"aria-hidden":"true","data-ruler-axis":"x","data-ruler-value":p.value,style:{position:"absolute",left:p.screen,bottom:0,width:1,height:p.major?8:4,background:p.major?"rgba(255,255,255,.5)":"rgba(255,255,255,.28)",pointerEvents:"none"},children:p.major&&e.jsx("span",{style:{position:"absolute",left:3,bottom:5,color:"rgba(255,255,255,.62)",font:"9px ui-monospace, SFMono-Regular, Menlo, monospace",lineHeight:1,whiteSpace:"nowrap"},children:p.value})},p.value))}),e.jsx("button",{ref:r,type:"button","data-testid":"canvas-scene-ruler-y","aria-label":"Vertical ruler; drag to create a vertical guide",onPointerDown:p=>a("x",p),style:{...y,top:20,bottom:0,left:0,width:20,borderRightStyle:"solid",borderRightWidth:1,cursor:"col-resize",padding:0,overflow:"hidden"},children:v.map(p=>e.jsx("span",{"aria-hidden":"true","data-ruler-axis":"y","data-ruler-value":p.value,style:{position:"absolute",top:p.screen,right:0,width:p.major?8:4,height:1,background:p.major?"rgba(255,255,255,.5)":"rgba(255,255,255,.28)",pointerEvents:"none"},children:p.major&&e.jsx("span",{style:{position:"absolute",right:4,top:3,color:"rgba(255,255,255,.62)",font:"9px ui-monospace, SFMono-Regular, Menlo, monospace",lineHeight:1,whiteSpace:"nowrap",writingMode:"vertical-rl",transform:"rotate(180deg)"},children:p.value})},p.value))}),e.jsx("div",{style:{...y,left:0,top:0,width:20,height:20}})]})}function rt({active:t,adapter:s,containerRef:o,view:r,documentId:g}){const i=W();u.useSyncExternalStore(i.subscribe,i.getSnapshot),u.useSyncExternalStore(R,X);const l=u.useSyncExternalStore(r.subscribe,r.get,r.get),[c,v]=u.useState(()=>B.get(r)??null),a=u.useCallback(d=>{B.set(r,d),v(d)},[r]);u.useEffect(()=>xe(g),[g]),u.useEffect(()=>{if(t)return Re(i,()=>a(null),d=>a(B.get(r)===d?null:d),()=>ue(g))},[t,i,a,r,g]);const y=i.transformMode,p=u.useRef(y);u.useEffect(()=>{p.current!==y&&(p.current=y,a(null))},[y,a]);const b=u.useCallback(d=>{const m=o.current;if(!m)return;const n=Math.min(Ne,Math.max(re,d)),f=m.clientWidth/2,j=m.clientHeight/2,z=(f-l.x)/l.zoom,G=(j-l.y)/l.zoom;r.setView(f-z*n,j-G*n,n)},[o,l,r]),x=u.useCallback(d=>{if(!s?.rects)return[];const m=[];for(const n of d){const f=s.rects.rect(n);f&&f.width>0&&f.height>0&&m.push(f)}return m},[s]),S=u.useCallback(()=>{const d=o.current;d&&O(d,r,D(x(i.selectedEntityIds)))},[o,x,i,r]),h=u.useCallback(()=>{const d=o.current;if(!d)return;const m=r.get(),n=te()?.config.resolution,f=n?n.width/2:0,j=n?n.height/2:0;r.setView(d.clientWidth/2-f*m.zoom,d.clientHeight/2-j*m.zoom,m.zoom)},[o,r]),E=u.useCallback(()=>{const d=o.current,m=D(x(i.selectedEntityIds));if(!d||!m)return;const n=r.get();r.setView(d.clientWidth/2-(m.x+m.width/2)*n.zoom,d.clientHeight/2-(m.y+m.height/2)*n.zoom,n.zoom)},[o,x,i,r]),C=u.useCallback(()=>{const d=o.current;!d||!s||O(d,r,D(x(oe(s))))},[s,o,x,r]);return u.useEffect(()=>{if(t)return i.onViewportAction(d=>{if(d.type==="focus-entity"){const m=o.current;if(!m)return;O(m,r,D(x([d.id])))}else d.type==="focus-selection"?S():d.type==="focus-scene"&&C()})},[t,o,C,S,x,i,r]),e.jsxs(e.Fragment,{children:[e.jsx($e,{}),e.jsx(De,{dimensions:"2d",otherToolActive:c!==null,onToolArmed:()=>a(null),viewTools:e.jsxs(e.Fragment,{children:[e.jsx(T,{text:"List Select: click to list the selectable nodes there",children:e.jsx(N,{"aria-label":"List Select mode","aria-pressed":c==="list",size:"comfortable",onClick:()=>a(c==="list"?null:"list"),children:e.jsx(k,{icon:fe,size:"md"})})}),e.jsx(T,{text:"Pivot: click or drag to put the selected node's pivot there",children:e.jsx(N,{"aria-label":"Pivot mode","aria-pressed":c==="pivot",size:"comfortable",onClick:d=>{if(d.shiftKey){const m=s?[...i.selectedEntityIds].map(f=>s.rects?.rect(f)).filter(f=>f!=null):[],n=D(m);n&&K(r,{x:n.x+n.width/2,y:n.y+n.height/2}),a("pivot");return}a(c==="pivot"?null:"pivot")},children:e.jsx(k,{icon:me,size:"md"})})}),e.jsx(T,{text:"Pan (Space-drag pans in any mode)",children:e.jsx(N,{"aria-label":"Pan mode","aria-pressed":c==="pan",size:"comfortable",onClick:()=>a(c==="pan"?null:"pan"),children:e.jsx(k,{icon:be,size:"md"})})}),e.jsx(T,{text:"Ruler: drag to measure distance and angle",children:e.jsx(N,{"aria-label":"Ruler mode","aria-pressed":c==="ruler",size:"comfortable",onClick:()=>a(c==="ruler"?null:"ruler"),children:e.jsx(k,{icon:Se,size:"md"})})})]}),trailingTools:e.jsxs(e.Fragment,{children:[e.jsx(Ie,{adapter:s,selected:[...i.selectedEntityIds]}),e.jsx(Be,{adapter:s,selected:[...i.selectedEntityIds]}),e.jsx(He,{documentId:g,view:r,hasSelection:i.selectedEntityIds.size>0,onCenterSelection:E,onFrameSelection:S})]})}),e.jsx(Ae,{adapter:s,view:r,documentId:g}),c?e.jsx(Oe,{mode:c,view:r,adapter:s,containerRef:o,onExit:()=>a(null)}):null,e.jsx(J,{label:"2D scene display",className:"volter-viewport-toolbar volter-viewport-toolbar-right","data-volter-canvas-navigation-ignore":"true",children:e.jsx(_,{"aria-label":"Frame all",variant:"ghost",size:"comfortable",onClick:C,children:"Frame all"})}),e.jsxs(J,{label:"2D scene navigation",className:"volter-canvas-scene-navigation","data-volter-canvas-navigation-ignore":"true",children:[e.jsx(N,{"aria-label":"Center view",title:"Center view: the game's viewport in the middle of the pane, at this zoom",size:"comfortable",onClick:h,children:e.jsx(k,{icon:ye,size:"md"})}),e.jsx(N,{"aria-label":"Zoom out",title:"Zoom out",size:"comfortable",onClick:()=>b(l.zoom/1.2),children:e.jsx(k,{icon:ve,size:"md"})}),e.jsxs(_,{variant:"ghost","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",size:"comfortable",onClick:()=>b(1),children:[Math.round(l.zoom*100),"%"]}),e.jsx(N,{"aria-label":"Zoom in",title:"Zoom in",size:"comfortable",onClick:()=>b(l.zoom*1.2),children:e.jsx(k,{icon:je,size:"md"})})]})]})}function Ae({adapter:t,view:s,documentId:o}){const r=u.useSyncExternalStore(s.subscribe,s.get,s.get),g=u.useCallback(a=>t?.subscribe?.(a)??(()=>{}),[t]),[i,l]=u.useState(0);u.useEffect(()=>g(()=>l(a=>a+1)),[g]),u.useSyncExternalStore(R,X);const c=A(o);if(!t?.inspector||!t.rects||!c.lock&&!c.group)return null;const v=oe(t).flatMap(a=>{const y=c.lock&&t.inspector?.get(a,"locked")===!0,p=c.group&&t.inspector?.get(a,"grouped")===!0,b=y||p?t.rects?.rect(a):null;return b?[{id:a,locked:y,grouped:p,x:r.x+b.x*r.zoom,y:r.y+b.y*r.zoom}]:[]});return e.jsx("div",{"data-testid":"canvas-scene-edit-gizmos","data-revision":i,style:{position:"absolute",inset:0,zIndex:55,pointerEvents:"none",overflow:"hidden"},children:v.map(a=>e.jsxs("div",{"data-testid":"canvas-scene-edit-gizmo","data-locked":a.locked,"data-grouped":a.grouped,style:{position:"absolute",left:a.x+2,top:a.y+2,display:"flex",gap:2,color:"#fff"},children:[a.locked?e.jsx(k,{icon:ne,size:"xs"}):null,a.grouped?e.jsx(k,{icon:se,size:"xs"}):null]},a.id))})}function He({documentId:t,view:s,hasSelection:o,onCenterSelection:r,onFrameSelection:g}){const[i,l]=u.useState(!1),c=u.useRef(null);u.useSyncExternalStore(R,X),u.useSyncExternalStore(u.useCallback(h=>ie(s,h),[s]),u.useCallback(()=>ae(s),[s]));const v=W();u.useSyncExternalStore(v.subscribe,v.getSnapshot);const a=A(t),y=U(t),p=[{label:"Show Grid",on:y&&!a.gridWhenSnapping,pick:()=>{$(t,!0),P(t,{gridWhenSnapping:!1})}},{label:"Show Grid When Snapping",on:y&&a.gridWhenSnapping,pick:()=>{$(t,!0),P(t,{gridWhenSnapping:!0})}},{label:"Hide Grid",on:!y,pick:()=>$(t,!1)}],b=()=>ue(t),x=[{label:"Rulers",on:a.rulers,toggle:()=>P(t,{rulers:!a.rulers})},{label:"Guides",on:a.guides,toggle:()=>P(t,{guides:!a.guides})},{label:"Origin",on:a.origin,toggle:()=>P(t,{origin:!a.origin})},{label:"Viewport",on:a.viewport,toggle:()=>P(t,{viewport:!a.viewport})}],S=h=>()=>{h(),l(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(_,{ref:c,"aria-label":"View","aria-haspopup":"menu","aria-expanded":i,variant:"ghost",size:"comfortable",onClick:()=>l(!i),children:"View"}),i&&e.jsxs(Ee,{anchorRef:c,align:"end",clamp:!0,"aria-label":"2D view",onDismiss:()=>l(!1),children:[e.jsxs(Q,{label:"Grid","data-testid":"canvas-scene-grid-submenu",children:[p.map(h=>e.jsxs(L,{role:"menuitemradio","aria-checked":h.on,onSelect:S(h.pick),children:[e.jsx("span",{className:"volter-menu-check",children:h.on&&e.jsx(k,{icon:I,size:"xs"})}),h.label]},h.label)),e.jsx(ee,{}),e.jsxs(L,{"data-testid":"canvas-scene-toggle-grid",onSelect:S(b),children:[e.jsx("span",{className:"volter-menu-check"}),"Toggle Grid"]})]}),x.map(h=>e.jsxs(L,{role:"menuitemcheckbox","aria-checked":h.on,onSelect:S(h.toggle),children:[e.jsx("span",{className:"volter-menu-check",children:h.on&&e.jsx(k,{icon:I,size:"xs"})}),h.label.startsWith("Show ")?h.label:`Show ${h.label}`]},h.label)),e.jsx(Q,{label:"Gizmos","data-testid":"canvas-scene-gizmos-submenu",children:[["position","Position"],["lock","Lock"],["group","Group"],["transformation","Transformation"]].map(([h,E])=>e.jsxs(L,{role:"menuitemcheckbox","aria-checked":a[h],onSelect:S(()=>P(t,{[h]:!a[h]})),children:[e.jsx("span",{className:"volter-menu-check",children:a[h]&&e.jsx(k,{icon:I,size:"xs"})}),E]},h))}),e.jsx(ee,{}),e.jsxs(L,{disabled:!o,onSelect:S(r),children:[e.jsx("span",{className:"volter-menu-check"}),"Center Selection"]}),e.jsxs(L,{disabled:!o,onSelect:S(g),children:[e.jsx("span",{className:"volter-menu-check"}),"Frame Selection"]}),e.jsxs(L,{disabled:le(s).length===0,onSelect:S(()=>Ve(s)),children:[e.jsx("span",{className:"volter-menu-check"}),"Clear Guides"]})]})]})}function Ie({adapter:t,selected:s}){const o=s.filter(l=>t?.inspector?.properties(l).some(c=>c.path==="locked")),r=o.length>0&&o.every(l=>t?.inspector?.get(l,"locked")===!0),g=o.length>1?"nodes":"node",i=r?`Unlock selected ${g}`:`Lock selected ${g}`;return e.jsx(T,{text:o.length>0?i:"Select a node to lock it",children:e.jsx(N,{"aria-label":i,"aria-pressed":r,size:"comfortable",disabled:o.length===0||!t?.inspector?.set,onClick:()=>{for(const l of o)t?.inspector?.set?.(l,"locked",!r)},children:e.jsx(k,{icon:r?ne:ze,size:"md"})})})}function ue(t){const s=U(t)&&!A(t).gridWhenSnapping;$(t,!0),P(t,{gridWhenSnapping:s})}const B=new WeakMap;function Oe({mode:t,view:s,adapter:o,containerRef:r,onExit:g}){const i=W(),l=u.useSyncExternalStore(s.subscribe,s.get,s.get),[c,v]=u.useState(null),[a,y]=u.useState(null);u.useEffect(()=>{const n=f=>{f.key==="Escape"&&(t==="pivot"&&K(s,null),g())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[g]);const p=(n,f)=>{const j=r.current?.getBoundingClientRect(),z=s.get(),G=n-(j?.left??0),w=f-(j?.top??0);return{x:(G-z.x)/z.zoom,y:(w-z.y)/z.zoom}},b=n=>{const f=i.snap2D,j=(G,w)=>i.snapEnabled&&f.step>0?Math.round((G-w)/f.step)*f.step+w:G,z={x:j(n.x,f.offsetX),y:j(n.y,f.offsetY)};return f.pixel?{x:Math.round(z.x),y:Math.round(z.y)}:z},x=(n,f,j)=>{if(!o)return f;const z=Ce(o,n);return ke(f,Ge(o,n)??(z?Fe(z):null),{invert:j,smart:i.smartSnap,gridOn:i.snapEnabled,grid:i.snap2D,threshold:Me/Math.max(s.get().zoom,.01)})},S=n=>{if(n.button!==0)return;if(n.preventDefault(),t==="list"){const w=We(i,n.clientX,n.clientY,o?{adapter:o}:{});y(w.length>0?{x:n.clientX,y:n.clientY,ids:w}:null);return}if(t==="pivot"&&n.shiftKey){K(s,b(p(n.clientX,n.clientY)));return}if(t==="pivot"){const w=i.selectedEntityIds,F=w.size===1&&o?[...w][0]:null,V=F&&o?we(o,F):null,Y=F?V?.layers(F).find(M=>M.category==="origin")?.handles.find(M=>M.writable):void 0;if(!F||!V||!Y)return;n.currentTarget.setPointerCapture(n.pointerId);const H=M=>{const q=x(F,p(M.clientX,M.clientY),M.metaKey||M.ctrlKey);return[q.x,q.y,0]};V.preview(F,Y.id,H(n));const Z=M=>V.preview(F,Y.id,H(M)),pe=M=>{window.removeEventListener("pointermove",Z),V.commit(F,Y.id,H(M))};window.addEventListener("pointermove",Z),window.addEventListener("pointerup",pe,{once:!0});return}n.currentTarget.setPointerCapture(n.pointerId);const f={clientX:n.clientX,clientY:n.clientY,pose:s.get()},j=p(n.clientX,n.clientY);t==="ruler"&&v({from:b(j),to:b(j)});const z=w=>{t==="pan"?s.setView(f.pose.x+w.clientX-f.clientX,f.pose.y+w.clientY-f.clientY,f.pose.zoom):v({from:b(j),to:b(p(w.clientX,w.clientY))})},G=()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",G)};window.addEventListener("pointermove",z),window.addEventListener("pointerup",G,{once:!0})},h=n=>({x:l.x+n.x*l.zoom,y:l.y+n.y*l.zoom}),E=c?Math.hypot(c.to.x-c.from.x,c.to.y-c.from.y):0,C=c?Math.atan2(c.to.y-c.from.y,c.to.x-c.from.x)*180/Math.PI:0,d=c?h(c.from):null,m=c?h(c.to):null;return e.jsxs("div",{"data-testid":`canvas-scene-${t}-layer`,"data-volter-canvas-navigation-ignore":"true",onPointerDown:S,style:{position:"absolute",inset:0,zIndex:60,cursor:t==="pan"?"grab":t==="list"?"context-menu":"crosshair"},children:[a&&o?e.jsx(Le,{state:a,adapter:o,onClose:()=>y(null)}):null,d&&m?e.jsxs(e.Fragment,{children:[e.jsx("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none"},children:e.jsx("line",{x1:d.x,y1:d.y,x2:m.x,y2:m.y,stroke:"#ff5fa2",strokeWidth:1.5})}),e.jsx("div",{"data-testid":"canvas-scene-ruler-reading",style:{position:"absolute",left:(d.x+m.x)/2+8,top:(d.y+m.y)/2+8,padding:"2px 6px",borderRadius:4,background:"rgba(24, 26, 30, .92)",color:"#fff",font:"11px ui-monospace, SFMono-Regular, Menlo, monospace",pointerEvents:"none",whiteSpace:"nowrap"},children:`${E.toFixed(1)} px · ${C.toFixed(1)}° · Δ ${(c.to.x-c.from.x).toFixed(1)}, ${(c.to.y-c.from.y).toFixed(1)}`})]}):null]})}function Be({adapter:t,selected:s}){const o=s.filter(l=>t?.inspector?.properties(l).some(c=>c.path==="grouped")),r=o.length>0&&o.every(l=>t?.inspector?.get(l,"grouped")===!0),g=o.length>1?"nodes":"node",i=r?`Ungroup selected ${g}`:`Group selected ${g} with their children`;return e.jsx(T,{text:o.length>0?i:"Select a node to group it",children:e.jsx(N,{"aria-label":i,"aria-pressed":r,size:"comfortable",disabled:o.length===0||!t?.inspector?.set,onClick:()=>{for(const l of o)t?.inspector?.set?.(l,"grouped",!r)},children:e.jsx(k,{icon:se,size:"md"})})})}export{nt as C,st as a,rt as b};
@@ -1 +1 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-nmcBqr7Y.js";import{dW as m,aN as u,dX as p}from"./index-r-FuctN5.js";function g({value:r,onChange:o,disabled:s=!1}){const[n,a]=l.useState(r??""),i=m();l.useEffect(()=>{a(r??"")},[r]);const c=()=>{const t=n.trim();t&&t!==r&&o(t)};return r===null?e.jsxs("div",{className:"volter-color-input",children:[e.jsx("div",{className:"volter-color-input-mixed"}),e.jsx(u,{placeholder:"—",disabled:s,onChange:t=>{t.target.value&&o(t.target.value)},"data-mixed":"true"})]}):e.jsxs("div",{className:"volter-color-input",children:[e.jsx(p,{value:r,disabled:s,onChange:t=>{i?.begin(),o(t.target.value)},onBlur:()=>i?.end()}),e.jsx(u,{value:n,disabled:s,onChange:t=>a(t.target.value),onBlur:c,onKeyDown:t=>{t.key==="Enter"?(c(),t.target.blur()):t.key==="Escape"&&(a(r),t.target.blur())}})]})}export{g as C};
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as l}from"./index-nmcBqr7Y.js";import{dW as m,aN as u,dX as p}from"./index-jhDTJrJJ.js";function g({value:r,onChange:o,disabled:s=!1}){const[n,a]=l.useState(r??""),i=m();l.useEffect(()=>{a(r??"")},[r]);const c=()=>{const t=n.trim();t&&t!==r&&o(t)};return r===null?e.jsxs("div",{className:"volter-color-input",children:[e.jsx("div",{className:"volter-color-input-mixed"}),e.jsx(u,{placeholder:"—",disabled:s,onChange:t=>{t.target.value&&o(t.target.value)},"data-mixed":"true"})]}):e.jsxs("div",{className:"volter-color-input",children:[e.jsx(p,{value:r,disabled:s,onChange:t=>{i?.begin(),o(t.target.value)},onBlur:()=>i?.end()}),e.jsx(u,{value:n,disabled:s,onChange:t=>a(t.target.value),onBlur:c,onKeyDown:t=>{t.key==="Enter"?(c(),t.target.blur()):t.key==="Escape"&&(a(r),t.target.blur())}})]})}export{g as C};
@@ -1 +1 @@
1
- import{a as y}from"./jsx-runtime-DPjLkJKQ.js";import{r as x}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{e4 as v,e5 as R,bP as ut,aN as dt,a6 as X,e6 as D}from"./index-r-FuctN5.js";function P(n){let t=n.replace("#","");t.length===3&&(t=`${t[0]??"0"}${t[0]??"0"}${t[1]??"0"}${t[1]??"0"}${t[2]??"0"}${t[2]??"0"}`);const e=Number.parseInt(t,16);return[e>>16&255,e>>8&255,e&255]}function tt(n,t,e){return`#${[n,t,e].map(o=>Math.round(Math.max(0,Math.min(255,o))).toString(16).padStart(2,"0")).join("")}`}function L(n,t,e){const o=n/255,c=t/255,i=e/255,l=Math.max(o,c,i),p=Math.min(o,c,i),u=l-p;let d=0;u!==0&&(l===o?d=((c-i)/u%6+6)%6:l===c?d=(i-o)/u+2:d=(o-c)/u+4,d/=6);const h=l===0?0:u/l;return[d,h,l]}function E(n,t,e){const o=Math.floor(n*6),c=n*6-o,i=e*(1-t),l=e*(1-c*t),p=e*(1-(1-c)*t);let u=0,d=0,h=0;switch(o%6){case 0:u=e,d=p,h=i;break;case 1:u=l,d=e,h=i;break;case 2:u=i,d=e,h=p;break;case 3:u=i,d=l,h=e;break;case 4:u=p,d=i,h=e;break;case 5:u=e,d=i,h=l;break}return[Math.round(u*255),Math.round(d*255),Math.round(h*255)]}function et(n,t,e){let o,c,i;if(t===0)o=c=i=e;else{const l=(d,h,f)=>{let $=f;return $<0&&($+=1),$>1&&($-=1),$<.16666666666666666?d+(h-d)*6*$:$<.5?h:$<.6666666666666666?d+(h-d)*(.6666666666666666-$)*6:d},p=e<.5?e*(1+t):e+t-e*t,u=2*e-p;o=l(u,p,n+1/3),c=l(u,p,n),i=l(u,p,n-1/3)}return[Math.round(o*255),Math.round(c*255),Math.round(i*255)]}function ft(n,t,e){const o=n/255,c=t/255,i=e/255,l=Math.max(o,c,i),p=Math.min(o,c,i);let u=0,d=0;const h=(l+p)/2;if(l!==p){const f=l-p;d=h>.5?f/(2-l-p):f/(l+p),l===o?u=((c-i)/f+(c<i?6:0))/6:l===c?u=((i-o)/f+2)/6:u=((o-c)/f+4)/6}return[u,d,h]}function z(n){if(n.startsWith("#")&&(n.length===4||n.length===7))return n;if(n.startsWith("#")&&n.length===9)return n.slice(0,7);const t=n.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){const[,o,c,i]=t;return`#${[o??"0",c??"0",i??"0"].map(l=>Number.parseInt(l,10).toString(16).padStart(2,"0")).join("")}`}const e=n.match(/hsla?\((\d+),\s*(\d+)%?,\s*(\d+)%?/);if(e){const[o,c,i]=et(Number.parseInt(e[1]??"0",10)/360,Number.parseInt(e[2]??"0",10)/100,Number.parseInt(e[3]??"0",10)/100);return tt(o,c,i)}return"#000000"}function A(n){const t=n.match(/rgba\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)/);if(t?.[1])return Number.parseFloat(t[1]);const e=n.match(/hsla\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)/);return e?.[1]?Number.parseFloat(e[1]):n.startsWith("#")&&n.length===9?Number.parseInt(n.slice(7,9),16)/255:1}function Z(n,t,e,o,c){if(c==="hex"){const f=tt(n,t,e);return o<1?`rgba(${n}, ${t}, ${e}, ${o.toFixed(2)})`:f}if(c==="rgb")return o<1?`rgba(${n}, ${t}, ${e}, ${o.toFixed(2)})`:`rgb(${n}, ${t}, ${e})`;const[i,l,p]=ft(n,t,e),u=Math.round(i*360),d=Math.round(l*100),h=Math.round(p*100);return o<1?`hsla(${u}, ${d}%, ${h}%, ${o.toFixed(2)})`:`hsl(${u}, ${d}%, ${h}%)`}function vt(n){const t=n.match(/\d+/g);return!t||t.length<3?"#000000":`#${[t[0]??"0",t[1]??"0",t[2]??"0"].map(e=>Number.parseInt(e,10).toString(16).padStart(2,"0")).join("")}`}const S=200,F=150,I=14;function pt({value:n,onChange:t,onChangeEnd:e,onClose:o,recentColors:c,onAddRecentColor:i,eyedropperFallback:l,onEyedropperPick:p,disabled:u}){const d=z(n),h=P(d),[f,$]=x.useState(()=>L(...h)),[M,j]=x.useState(()=>A(n)),[T,nt]=x.useState("hex"),[V,q]=x.useState(d),B=x.useRef(null),G=x.useRef(null),W=x.useRef(null),K=x.useRef(null),N=x.useRef(null),k=x.useCallback((r=f,s=M,a=T)=>{const[b,m,g]=E(r[0],r[1],r[2]);return Z(b,m,g,s,a)},[f,M,T]);x.useEffect(()=>{q(k())},[k]),x.useEffect(()=>{const r=G.current,s=r?.getContext("2d");if(!r||!s)return;const[a,b,m]=E(f[0],1,1),g=s.createLinearGradient(0,0,S,0);g.addColorStop(0,"#ffffff"),g.addColorStop(1,`rgb(${a},${b},${m})`),s.fillStyle=g,s.fillRect(0,0,S,F);const w=s.createLinearGradient(0,0,0,F);w.addColorStop(0,"rgba(0,0,0,0)"),w.addColorStop(1,"rgba(0,0,0,1)"),s.fillStyle=w,s.fillRect(0,0,S,F)},[f[0]]),x.useEffect(()=>{const r=W.current,s=r?.getContext("2d");if(!r||!s)return;const a=s.createLinearGradient(0,0,S,0);for(let b=0;b<=6;b++){const[m,g,w]=E(b/6,1,1);a.addColorStop(b/6,`rgb(${m},${g},${w})`)}s.fillStyle=a,s.fillRect(0,0,S,I)},[]),x.useEffect(()=>{const r=K.current,s=r?.getContext("2d");if(!r||!s)return;const a=4;for(let H=0;H<I;H+=a)for(let C=0;C<S;C+=a)s.fillStyle=(C/a+H/a)%2===0?"#ffffff":"#cccccc",s.fillRect(C,H,a,a);const[b,m,g]=E(f[0],f[1],f[2]),w=s.createLinearGradient(0,0,S,0);w.addColorStop(0,`rgba(${b},${m},${g},0)`),w.addColorStop(1,`rgba(${b},${m},${g},1)`),s.fillStyle=w,s.fillRect(0,0,S,I)},[f]),x.useEffect(()=>{if(!o)return;function r(a){a.key==="Escape"&&o?.()}function s(a){B.current&&!B.current.contains(a.target)&&o?.()}return document.addEventListener("keydown",r),document.addEventListener("mousedown",s,!0),()=>{document.removeEventListener("keydown",r),document.removeEventListener("mousedown",s,!0)}},[o]);const U=x.useCallback((r,s,a,b)=>{const m=s?.getBoundingClientRect();if(m)if(r==="sat"){const g=[f[0],O(a,m.left,m.width),ht(b,m.top,m.height)];$(g),R({onChange:t},k(g))}else if(r==="hue"){const g=[O(a,m.left,m.width),f[1],f[2]];$(g),R({onChange:t},k(g))}else{const g=Math.round(O(a,m.left,m.width)*100)/100;j(g),R({onChange:t},k(f,g))}},[f,k,t]);x.useEffect(()=>{function r(a){const b=N.current;if(!b)return;a.preventDefault();const m=b==="sat"?G.current:b==="hue"?W.current:K.current;U(b,m,a.clientX,a.clientY)}function s(){if(N.current){N.current=null;const a=k();D({onChange:t,onChangeEnd:e},a),i?.(a)}}return window.addEventListener("mousemove",r),window.addEventListener("mouseup",s),()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",s)}},[U,k,t,e,i]);const _=(r,s)=>{u||(s.preventDefault(),N.current=r,U(r,s.currentTarget,s.clientX,s.clientY))},J=()=>{const r=V.trim(),s=bt(r),a=s?{r:s[0],g:s[1],b:s[2],a:1}:mt(r)??gt(r);if(!a)return;$(L(a.r,a.g,a.b)),j(a.a);const b=s?r:Z(a.r,a.g,a.b,a.a,T);R({onChange:t},b),D({onChange:t,onChangeEnd:e},b),i?.(b)},st=()=>{nt(r=>r==="hex"?"rgb":r==="rgb"?"hsl":"hex")},Q=typeof globalThis.EyeDropper=="function",Y=r=>{const s=z(r);$(L(...P(s))),j(A(r)),R({onChange:t},r),D({onChange:t,onChangeEnd:e},r)},ot=async()=>{if(Q){try{const s=globalThis.EyeDropper,a=await new s().open();Y(a.sRGBHex)}catch{}return}if(p){p(s=>{s&&Y(s)});return}const r=l?.();r&&Y(r)},[at,it,ct]=E(f[0],f[1],f[2]),lt=`rgba(${at},${it},${ct},${M})`;return y.jsxs(ut,{ref:B,"data-testid":"inspector-color-picker",onMouseDown:r=>r.stopPropagation(),style:{padding:10,width:S+16,boxSizing:"border-box"},children:[y.jsx("canvas",{ref:G,"data-testid":"color-picker-sv",width:S,height:F,onMouseDown:r=>_("sat",r),style:{cursor:"crosshair",borderRadius:v.radiusSmall,display:"block"}}),y.jsx("canvas",{ref:W,"data-testid":"color-picker-hue",width:S,height:I,onMouseDown:r=>_("hue",r),style:{cursor:"pointer",borderRadius:v.radiusSmall,display:"block",marginTop:6}}),y.jsx("canvas",{ref:K,"data-testid":"color-picker-alpha",width:S,height:I,onMouseDown:r=>_("alpha",r),style:{cursor:"pointer",borderRadius:v.radiusSmall,display:"block",marginTop:6}}),y.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginTop:8},children:[y.jsx("div",{style:{width:22,height:22,borderRadius:v.radiusSmall,flexShrink:0,border:`1px solid ${v.border}`,background:lt}}),y.jsx(dt,{type:"text","data-testid":"color-picker-text",value:V,onChange:r=>q(r.target.value),onKeyDown:r=>{r.key==="Enter"&&J()},onBlur:J,"data-density":"compact","data-monospace":"true",style:{flex:1}}),y.jsx(X,{type:"button",variant:"secondary",size:"compact","data-testid":"color-format-toggle",onClick:st,title:"Cycle color format",style:{flexShrink:0},children:T.toUpperCase()}),(Q||l||p)&&y.jsx(X,{type:"button",variant:"secondary",size:"compact","data-testid":"color-picker-eyedropper",onClick:ot,title:"Eyedropper",style:{flexShrink:0},children:"⌖"})]}),c&&c.length>0&&y.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3,marginTop:8,paddingTop:6,borderTop:`1px solid ${v.border}`},children:c.map((r,s)=>y.jsx("div",{"data-testid":"color-picker-recent",onClick:()=>{const a=z(r);$(L(...P(a))),j(A(r)),R({onChange:t},r),D({onChange:t,onChangeEnd:e},r)},title:r,style:{width:16,height:16,borderRadius:v.radiusSmall,cursor:"pointer",background:r,border:`1px solid ${v.border}`}},`${r}-${s}`))})]})}function wt({label:n,value:t,onChange:e,onChangeEnd:o,recentColors:c,onAddRecentColor:i,eyedropperFallback:l,onEyedropperPick:p,disabled:u,testId:d}){const[h,f]=x.useState(!1),$=z(t);return y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,position:"relative"},children:[y.jsx("div",{"data-testid":d?`${d}-swatch`:"color-swatch",onClick:()=>{u||f(M=>!M)},style:{width:20,height:20,borderRadius:v.radiusSmall,flexShrink:0,background:$,border:`1px solid ${v.border}`,cursor:u?"not-allowed":"pointer"}}),n&&y.jsx("span",{style:{fontSize:10,color:v.textMuted,flexShrink:0},children:n}),h&&!u&&y.jsx("div",{style:{position:"absolute",zIndex:"var(--volter-z-dropdown)",top:"100%",left:0,marginTop:4},children:y.jsx(pt,{value:t,onChange:e,onChangeEnd:o,onClose:()=>f(!1),recentColors:c,onAddRecentColor:i,eyedropperFallback:l,onEyedropperPick:p})})]})}function rt(n){return Math.max(0,Math.min(1,n))}function O(n,t,e){return rt(e?(n-t)/e:0)}function ht(n,t,e){return rt(e?1-(n-t)/e:0)}function bt(n){return/^#[0-9a-fA-F]{6}$/.test(n)?P(n):null}function mt(n){const t=n.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!t)return null;const[,e,o,c,i]=t;return{r:Number.parseInt(e??"0",10),g:Number.parseInt(o??"0",10),b:Number.parseInt(c??"0",10),a:i?Number.parseFloat(i):1}}function gt(n){const t=n.match(/hsla?\((\d+),\s*(\d+)%?,\s*(\d+)%?(?:,\s*([\d.]+))?\)/);if(!t)return null;const[,e,o,c,i]=t,[l,p,u]=et(Number.parseInt(e??"0",10)/360,Number.parseInt(o??"0",10)/100,Number.parseInt(c??"0",10)/100);return{r:l,g:p,b:u,a:i?Number.parseFloat(i):1}}export{wt as C,pt as a,P as h,A as p,vt as r,z as t};
1
+ import{a as y}from"./jsx-runtime-DPjLkJKQ.js";import{r as x}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{e4 as v,e5 as R,bP as ut,aN as dt,a6 as X,e6 as D}from"./index-jhDTJrJJ.js";function P(n){let t=n.replace("#","");t.length===3&&(t=`${t[0]??"0"}${t[0]??"0"}${t[1]??"0"}${t[1]??"0"}${t[2]??"0"}${t[2]??"0"}`);const e=Number.parseInt(t,16);return[e>>16&255,e>>8&255,e&255]}function tt(n,t,e){return`#${[n,t,e].map(o=>Math.round(Math.max(0,Math.min(255,o))).toString(16).padStart(2,"0")).join("")}`}function L(n,t,e){const o=n/255,c=t/255,i=e/255,l=Math.max(o,c,i),p=Math.min(o,c,i),u=l-p;let d=0;u!==0&&(l===o?d=((c-i)/u%6+6)%6:l===c?d=(i-o)/u+2:d=(o-c)/u+4,d/=6);const h=l===0?0:u/l;return[d,h,l]}function E(n,t,e){const o=Math.floor(n*6),c=n*6-o,i=e*(1-t),l=e*(1-c*t),p=e*(1-(1-c)*t);let u=0,d=0,h=0;switch(o%6){case 0:u=e,d=p,h=i;break;case 1:u=l,d=e,h=i;break;case 2:u=i,d=e,h=p;break;case 3:u=i,d=l,h=e;break;case 4:u=p,d=i,h=e;break;case 5:u=e,d=i,h=l;break}return[Math.round(u*255),Math.round(d*255),Math.round(h*255)]}function et(n,t,e){let o,c,i;if(t===0)o=c=i=e;else{const l=(d,h,f)=>{let $=f;return $<0&&($+=1),$>1&&($-=1),$<.16666666666666666?d+(h-d)*6*$:$<.5?h:$<.6666666666666666?d+(h-d)*(.6666666666666666-$)*6:d},p=e<.5?e*(1+t):e+t-e*t,u=2*e-p;o=l(u,p,n+1/3),c=l(u,p,n),i=l(u,p,n-1/3)}return[Math.round(o*255),Math.round(c*255),Math.round(i*255)]}function ft(n,t,e){const o=n/255,c=t/255,i=e/255,l=Math.max(o,c,i),p=Math.min(o,c,i);let u=0,d=0;const h=(l+p)/2;if(l!==p){const f=l-p;d=h>.5?f/(2-l-p):f/(l+p),l===o?u=((c-i)/f+(c<i?6:0))/6:l===c?u=((i-o)/f+2)/6:u=((o-c)/f+4)/6}return[u,d,h]}function z(n){if(n.startsWith("#")&&(n.length===4||n.length===7))return n;if(n.startsWith("#")&&n.length===9)return n.slice(0,7);const t=n.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){const[,o,c,i]=t;return`#${[o??"0",c??"0",i??"0"].map(l=>Number.parseInt(l,10).toString(16).padStart(2,"0")).join("")}`}const e=n.match(/hsla?\((\d+),\s*(\d+)%?,\s*(\d+)%?/);if(e){const[o,c,i]=et(Number.parseInt(e[1]??"0",10)/360,Number.parseInt(e[2]??"0",10)/100,Number.parseInt(e[3]??"0",10)/100);return tt(o,c,i)}return"#000000"}function A(n){const t=n.match(/rgba\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)/);if(t?.[1])return Number.parseFloat(t[1]);const e=n.match(/hsla\([^,]+,[^,]+,[^,]+,\s*([\d.]+)\)/);return e?.[1]?Number.parseFloat(e[1]):n.startsWith("#")&&n.length===9?Number.parseInt(n.slice(7,9),16)/255:1}function Z(n,t,e,o,c){if(c==="hex"){const f=tt(n,t,e);return o<1?`rgba(${n}, ${t}, ${e}, ${o.toFixed(2)})`:f}if(c==="rgb")return o<1?`rgba(${n}, ${t}, ${e}, ${o.toFixed(2)})`:`rgb(${n}, ${t}, ${e})`;const[i,l,p]=ft(n,t,e),u=Math.round(i*360),d=Math.round(l*100),h=Math.round(p*100);return o<1?`hsla(${u}, ${d}%, ${h}%, ${o.toFixed(2)})`:`hsl(${u}, ${d}%, ${h}%)`}function vt(n){const t=n.match(/\d+/g);return!t||t.length<3?"#000000":`#${[t[0]??"0",t[1]??"0",t[2]??"0"].map(e=>Number.parseInt(e,10).toString(16).padStart(2,"0")).join("")}`}const S=200,F=150,I=14;function pt({value:n,onChange:t,onChangeEnd:e,onClose:o,recentColors:c,onAddRecentColor:i,eyedropperFallback:l,onEyedropperPick:p,disabled:u}){const d=z(n),h=P(d),[f,$]=x.useState(()=>L(...h)),[M,j]=x.useState(()=>A(n)),[T,nt]=x.useState("hex"),[V,q]=x.useState(d),B=x.useRef(null),G=x.useRef(null),W=x.useRef(null),K=x.useRef(null),N=x.useRef(null),k=x.useCallback((r=f,s=M,a=T)=>{const[b,m,g]=E(r[0],r[1],r[2]);return Z(b,m,g,s,a)},[f,M,T]);x.useEffect(()=>{q(k())},[k]),x.useEffect(()=>{const r=G.current,s=r?.getContext("2d");if(!r||!s)return;const[a,b,m]=E(f[0],1,1),g=s.createLinearGradient(0,0,S,0);g.addColorStop(0,"#ffffff"),g.addColorStop(1,`rgb(${a},${b},${m})`),s.fillStyle=g,s.fillRect(0,0,S,F);const w=s.createLinearGradient(0,0,0,F);w.addColorStop(0,"rgba(0,0,0,0)"),w.addColorStop(1,"rgba(0,0,0,1)"),s.fillStyle=w,s.fillRect(0,0,S,F)},[f[0]]),x.useEffect(()=>{const r=W.current,s=r?.getContext("2d");if(!r||!s)return;const a=s.createLinearGradient(0,0,S,0);for(let b=0;b<=6;b++){const[m,g,w]=E(b/6,1,1);a.addColorStop(b/6,`rgb(${m},${g},${w})`)}s.fillStyle=a,s.fillRect(0,0,S,I)},[]),x.useEffect(()=>{const r=K.current,s=r?.getContext("2d");if(!r||!s)return;const a=4;for(let H=0;H<I;H+=a)for(let C=0;C<S;C+=a)s.fillStyle=(C/a+H/a)%2===0?"#ffffff":"#cccccc",s.fillRect(C,H,a,a);const[b,m,g]=E(f[0],f[1],f[2]),w=s.createLinearGradient(0,0,S,0);w.addColorStop(0,`rgba(${b},${m},${g},0)`),w.addColorStop(1,`rgba(${b},${m},${g},1)`),s.fillStyle=w,s.fillRect(0,0,S,I)},[f]),x.useEffect(()=>{if(!o)return;function r(a){a.key==="Escape"&&o?.()}function s(a){B.current&&!B.current.contains(a.target)&&o?.()}return document.addEventListener("keydown",r),document.addEventListener("mousedown",s,!0),()=>{document.removeEventListener("keydown",r),document.removeEventListener("mousedown",s,!0)}},[o]);const U=x.useCallback((r,s,a,b)=>{const m=s?.getBoundingClientRect();if(m)if(r==="sat"){const g=[f[0],O(a,m.left,m.width),ht(b,m.top,m.height)];$(g),R({onChange:t},k(g))}else if(r==="hue"){const g=[O(a,m.left,m.width),f[1],f[2]];$(g),R({onChange:t},k(g))}else{const g=Math.round(O(a,m.left,m.width)*100)/100;j(g),R({onChange:t},k(f,g))}},[f,k,t]);x.useEffect(()=>{function r(a){const b=N.current;if(!b)return;a.preventDefault();const m=b==="sat"?G.current:b==="hue"?W.current:K.current;U(b,m,a.clientX,a.clientY)}function s(){if(N.current){N.current=null;const a=k();D({onChange:t,onChangeEnd:e},a),i?.(a)}}return window.addEventListener("mousemove",r),window.addEventListener("mouseup",s),()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",s)}},[U,k,t,e,i]);const _=(r,s)=>{u||(s.preventDefault(),N.current=r,U(r,s.currentTarget,s.clientX,s.clientY))},J=()=>{const r=V.trim(),s=bt(r),a=s?{r:s[0],g:s[1],b:s[2],a:1}:mt(r)??gt(r);if(!a)return;$(L(a.r,a.g,a.b)),j(a.a);const b=s?r:Z(a.r,a.g,a.b,a.a,T);R({onChange:t},b),D({onChange:t,onChangeEnd:e},b),i?.(b)},st=()=>{nt(r=>r==="hex"?"rgb":r==="rgb"?"hsl":"hex")},Q=typeof globalThis.EyeDropper=="function",Y=r=>{const s=z(r);$(L(...P(s))),j(A(r)),R({onChange:t},r),D({onChange:t,onChangeEnd:e},r)},ot=async()=>{if(Q){try{const s=globalThis.EyeDropper,a=await new s().open();Y(a.sRGBHex)}catch{}return}if(p){p(s=>{s&&Y(s)});return}const r=l?.();r&&Y(r)},[at,it,ct]=E(f[0],f[1],f[2]),lt=`rgba(${at},${it},${ct},${M})`;return y.jsxs(ut,{ref:B,"data-testid":"inspector-color-picker",onMouseDown:r=>r.stopPropagation(),style:{padding:10,width:S+16,boxSizing:"border-box"},children:[y.jsx("canvas",{ref:G,"data-testid":"color-picker-sv",width:S,height:F,onMouseDown:r=>_("sat",r),style:{cursor:"crosshair",borderRadius:v.radiusSmall,display:"block"}}),y.jsx("canvas",{ref:W,"data-testid":"color-picker-hue",width:S,height:I,onMouseDown:r=>_("hue",r),style:{cursor:"pointer",borderRadius:v.radiusSmall,display:"block",marginTop:6}}),y.jsx("canvas",{ref:K,"data-testid":"color-picker-alpha",width:S,height:I,onMouseDown:r=>_("alpha",r),style:{cursor:"pointer",borderRadius:v.radiusSmall,display:"block",marginTop:6}}),y.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",marginTop:8},children:[y.jsx("div",{style:{width:22,height:22,borderRadius:v.radiusSmall,flexShrink:0,border:`1px solid ${v.border}`,background:lt}}),y.jsx(dt,{type:"text","data-testid":"color-picker-text",value:V,onChange:r=>q(r.target.value),onKeyDown:r=>{r.key==="Enter"&&J()},onBlur:J,"data-density":"compact","data-monospace":"true",style:{flex:1}}),y.jsx(X,{type:"button",variant:"secondary",size:"compact","data-testid":"color-format-toggle",onClick:st,title:"Cycle color format",style:{flexShrink:0},children:T.toUpperCase()}),(Q||l||p)&&y.jsx(X,{type:"button",variant:"secondary",size:"compact","data-testid":"color-picker-eyedropper",onClick:ot,title:"Eyedropper",style:{flexShrink:0},children:"⌖"})]}),c&&c.length>0&&y.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3,marginTop:8,paddingTop:6,borderTop:`1px solid ${v.border}`},children:c.map((r,s)=>y.jsx("div",{"data-testid":"color-picker-recent",onClick:()=>{const a=z(r);$(L(...P(a))),j(A(r)),R({onChange:t},r),D({onChange:t,onChangeEnd:e},r)},title:r,style:{width:16,height:16,borderRadius:v.radiusSmall,cursor:"pointer",background:r,border:`1px solid ${v.border}`}},`${r}-${s}`))})]})}function wt({label:n,value:t,onChange:e,onChangeEnd:o,recentColors:c,onAddRecentColor:i,eyedropperFallback:l,onEyedropperPick:p,disabled:u,testId:d}){const[h,f]=x.useState(!1),$=z(t);return y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,position:"relative"},children:[y.jsx("div",{"data-testid":d?`${d}-swatch`:"color-swatch",onClick:()=>{u||f(M=>!M)},style:{width:20,height:20,borderRadius:v.radiusSmall,flexShrink:0,background:$,border:`1px solid ${v.border}`,cursor:u?"not-allowed":"pointer"}}),n&&y.jsx("span",{style:{fontSize:10,color:v.textMuted,flexShrink:0},children:n}),h&&!u&&y.jsx("div",{style:{position:"absolute",zIndex:"var(--volter-z-dropdown)",top:"100%",left:0,marginTop:4},children:y.jsx(pt,{value:t,onChange:e,onChangeEnd:o,onClose:()=>f(!1),recentColors:c,onAddRecentColor:i,eyedropperFallback:l,onEyedropperPick:p})})]})}function rt(n){return Math.max(0,Math.min(1,n))}function O(n,t,e){return rt(e?(n-t)/e:0)}function ht(n,t,e){return rt(e?1-(n-t)/e:0)}function bt(n){return/^#[0-9a-fA-F]{6}$/.test(n)?P(n):null}function mt(n){const t=n.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!t)return null;const[,e,o,c,i]=t;return{r:Number.parseInt(e??"0",10),g:Number.parseInt(o??"0",10),b:Number.parseInt(c??"0",10),a:i?Number.parseFloat(i):1}}function gt(n){const t=n.match(/hsla?\((\d+),\s*(\d+)%?,\s*(\d+)%?(?:,\s*([\d.]+))?\)/);if(!t)return null;const[,e,o,c,i]=t,[l,p,u]=et(Number.parseInt(e??"0",10)/360,Number.parseInt(o??"0",10)/100,Number.parseInt(c??"0",10)/100);return{r:l,g:p,b:u,a:i?Number.parseFloat(i):1}}export{wt as C,pt as a,P as h,A as p,vt as r,z as t};
@@ -1 +1 @@
1
- import{a as n}from"./jsx-runtime-DPjLkJKQ.js";import{t as f}from"./editor-shell-store-DTfKHHYD.js";import{U as d,al as v}from"./index-r-FuctN5.js";import{r as l}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{a as S}from"./live-mixers-B-bwLZ7c.js";import{b as h,e as b,f as x}from"./asset-preview-Cck2dsj4.js";import{O as j}from"./StageHost-BHQB10fP.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./output-pass-HurwNl0G.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./Pass-D1MRT672.js";import"./editor-layers-CSl6S15k.js";import"./workspace-arrangement-BOOvdRY-.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./user-data-CPxKRceo.js";import"./entity-object-BO1_Qmt8.js";import"./three-contract-Dkt6PmWY.js";import"./renderer-ownership-BovSEcLv.js";import"./hierarchy-marks-B4XzZe8e.js";import"./studio-environment-CLaX3ria.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";import"./environment-Dg-YaLsA.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";import"./bitmap-label-Ct4k6ehY.js";import"./three-state-z8gBcifl.js";import"./standard-viewport-dressing-BmMrgEAi.js";import"./content-bounds-DuSmUtY1.js";import"./preview-renderer-BrYNFV1p.js";import"./live-gesture-lock-DJbrjOqf.js";import"./three-integration-qc8Reb1Y.js";import"./host-hierarchy-objects-BV3WqU2w.js";import"./layered-pick-1v6rbWkT.js";import"./root-stacking-BEd9ZvxC.js";import"./model-thumbnail-DSDxaYgd.js";import"./object3d-document-session-registry-BGuY8anX.js";import"./component-instance-root-9er-zSAY.js";import"./viewport-door-K-5DUW7m.js";import"./model-inspection-BbRgz6bo.js";import"./three-viewport-presentation-BjXL1Zjv.js";import"./clip-planes-CnAI6DZn.js";import"./three-BGqB-uVq.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./OrbitControls-B13MKuwC.js";import"./LineSegments2-DN9pUfWA.js";import"./three.quarks.esm-C_HmSKXo.js";import"./scene-framing-BxVkSlg3.js";import"./source-object3d-authoring-adapter-BKZ8oj3D.js";import"./three-projection-core-CFyOC4Fp.js";import"./editor-presentation-activity-CqJH4G9t.js";import"./transport-strip-e122YmzD.js";import"./viewport-surface-status-BTqSVzg2.js";function w(e){const t=new Set;return e.traverse(i=>{const r=S(i);if(r)for(const o of r.clips.values())t.add(o);for(const o of i.animations)t.add(o)}),[...t]}function E({documentId:e,source:t,sourcePath:i,displayName:r,active:o,chromeless:p=!1,revision:m=0,modelSource:a}){const u=l.useCallback(()=>{const s=h(b(t)),c=w(t);return s.animations=[...c],{root:s,animations:c,dispose(){x(s)}}},[t,m]);return n.jsx(j,{documentId:e,sourcePath:i??r,displayName:r,build:u,active:o,chromeless:p,rendererLane:p?"inspector-preview":"own",assetType:"entity",...a?{modelSource:a}:{}})}function Vt({documentId:e,entityId:t,displayName:i,active:r}){const o=f(d()),p=l.useSyncExternalStore(o.shell.subscribe,o.shell.getSnapshot),m=o.objectMap.get(t);return m?n.jsx(E,{documentId:e,source:m,sourcePath:`Entity ${t}`,displayName:i,active:r,revision:p,modelSource:{kind:"entity",entityId:t}}):n.jsxs("div",{role:"alert",style:{padding:20,color:v.semantic.danger},children:["Scene entity ",t," is no longer available."]})}export{Vt as EntityModelDocument,E as Object3DSnapshotDocument};
1
+ import{a as n}from"./jsx-runtime-DPjLkJKQ.js";import{t as f}from"./editor-shell-store-DmIN_bZc.js";import{U as d,al as v}from"./index-jhDTJrJJ.js";import{r as l}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{a as S}from"./live-mixers-B-bwLZ7c.js";import{b as h,e as b,f as x}from"./asset-preview-BlwxJaQK.js";import{O as j}from"./StageHost-Bg2tw0U7.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./output-pass-HurwNl0G.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./Pass-D1MRT672.js";import"./editor-layers-BDej9Ofa.js";import"./workspace-arrangement-MmNy_T4o.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./user-data-W3aDNol1.js";import"./entity-object-sI9MDwQJ.js";import"./three-contract-Dkt6PmWY.js";import"./renderer-ownership-BovSEcLv.js";import"./hierarchy-marks-Bv3lFwvr.js";import"./studio-environment-D05pL7iQ.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";import"./environment-Dg-YaLsA.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";import"./bitmap-label-Ct4k6ehY.js";import"./three-state-C_HLiIZD.js";import"./standard-viewport-dressing-BVHhIJE1.js";import"./content-bounds-BZfH5RtN.js";import"./preview-renderer-BrYNFV1p.js";import"./live-gesture-lock-DJbrjOqf.js";import"./three-integration-CXNucx1z.js";import"./host-hierarchy-objects-BV3WqU2w.js";import"./layered-pick-CEWefTxe.js";import"./root-stacking-BEd9ZvxC.js";import"./model-thumbnail-DQh5eEm6.js";import"./object3d-document-session-registry-BGN2Zn49.js";import"./component-instance-root-0OmhquKK.js";import"./viewport-door-C7l0uUHo.js";import"./model-inspection-DYuFlISa.js";import"./three-viewport-presentation-Cfs5MJTy.js";import"./clip-planes-CnAI6DZn.js";import"./three-B_zMk3VF.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./OrbitControls-B13MKuwC.js";import"./LineSegments2-DN9pUfWA.js";import"./three.quarks.esm-C_HmSKXo.js";import"./scene-framing-CXQ4WFCe.js";import"./source-object3d-authoring-adapter-BRXDkWd8.js";import"./three-projection-core-BPR7YFcJ.js";import"./editor-presentation-activity-CqJH4G9t.js";import"./transport-strip-BEEkMmqy.js";import"./viewport-surface-status-gSFti1Lv.js";function w(e){const t=new Set;return e.traverse(i=>{const r=S(i);if(r)for(const o of r.clips.values())t.add(o);for(const o of i.animations)t.add(o)}),[...t]}function E({documentId:e,source:t,sourcePath:i,displayName:r,active:o,chromeless:p=!1,revision:m=0,modelSource:a}){const u=l.useCallback(()=>{const s=h(b(t)),c=w(t);return s.animations=[...c],{root:s,animations:c,dispose(){x(s)}}},[t,m]);return n.jsx(j,{documentId:e,sourcePath:i??r,displayName:r,build:u,active:o,chromeless:p,rendererLane:p?"inspector-preview":"own",assetType:"entity",...a?{modelSource:a}:{}})}function Vt({documentId:e,entityId:t,displayName:i,active:r}){const o=f(d()),p=l.useSyncExternalStore(o.shell.subscribe,o.shell.getSnapshot),m=o.objectMap.get(t);return m?n.jsx(E,{documentId:e,source:m,sourcePath:`Entity ${t}`,displayName:i,active:r,revision:p,modelSource:{kind:"entity",entityId:t}}):n.jsxs("div",{role:"alert",style:{padding:20,color:v.semantic.danger},children:["Scene entity ",t," is no longer available."]})}export{Vt as EntityModelDocument,E as Object3DSnapshotDocument};
@@ -1 +1 @@
1
- import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{dR as M,dS as C,dT as D,dU as k,al as y,b5 as R,dV as b}from"./index-r-FuctN5.js";import{r as f}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{W as A}from"./three.module-BLhyNg0e.js";import{OrbitControls as P}from"./OrbitControls-B13MKuwC.js";import{E as z}from"./EXRLoader-CITMBvGd.js";import{HDRLoader as T}from"./HDRLoader-BTGuGhVo.js";import{s as I}from"./asset-editor-persistence-C8kiK_is.js";import{aT as L,ej as O,A as B,el as F,d9 as H,_ as G,db as $,cp as N,co as E,cx as j,ey as S,X as _,cj as q}from"./three.core-3arARmh6.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";function U(e){return e.split("/").pop()??e}function v(e,t,r){return Math.min(r,Math.max(t,e))}function X(e){return e.split(/[?#]/,1)[0].toLowerCase().endsWith(".exr")}async function W(e){const t=X(e)?"EXR":"HDR",s=await(t==="EXR"?new z:new T).loadAsync(e),p=s.image,n=p.width??0,a=p.height??0,c=n>0&&a>0&&Math.abs(n/a-2)<=.04;return s.mapping=L,s.needsUpdate=!0,{texture:s,width:n,height:a,format:t,panorama:c}}function V(e){const t=new F,r=new H(38,1,.05,100);r.position.set(6.2,3.4,7.8),r.lookAt(0,.7,0);const s=[],p=[];if(!e.panorama){t.background=new G("#11141b");const i=e.width>0&&e.height>0?e.width/e.height:1,d=new $(i>=1?4.8:4.8*i,i>=1?4.8/i:4.8),m=new N({map:e.texture,toneMapped:!0});return s.push(d),p.push(m),t.add(new E(d,m)),r.position.set(0,0,6.5),r.lookAt(0,0,0),{scene:t,camera:r,geometries:s,materials:p}}t.background=e.texture,t.environment=e.texture;const n=(i,d,m)=>{s.push(i),p.push(d);const x=new E(i,d);x.position.set(...m),t.add(x)};n(new S(1,64,40),new j({color:"#d8dde5",roughness:.08,metalness:1}),[-2.3,1.15,0]),n(new S(1,64,40),new j({color:"#c97341",roughness:.32,metalness:.25}),[0,1.15,0]),n(new S(1,64,40),new j({color:"#d7d5cf",roughness:.82,metalness:0}),[2.3,1.15,0]);const a=new _(5.7,96),c=new j({color:"#737881",roughness:.58,metalness:0});s.push(a),p.push(c);const l=new E(a,c);return l.rotation.x=-Math.PI/2,l.position.y=.08,t.add(l),{scene:t,camera:r,geometries:s,materials:p}}function J({image:e,settingsRef:t}){const r=f.useRef(null);return f.useEffect(()=>{const s=r.current;if(!s)return;let p=!1,n=0;const a=document.createElement("canvas");a.setAttribute("aria-label",`${e.format} environment preview`),a.style.width="100%",a.style.height="100%",a.style.display="block",s.replaceChildren(a);const c=new A({canvas:a,antialias:!0});c.outputColorSpace=O,c.toneMapping=B;const l=V(e),i=new P(l.camera,a);i.target.set(0,e.panorama?.8:0,0),i.enableDamping=!0,i.enablePan=!1,i.minDistance=e.panorama?3.8:4,i.maxDistance=e.panorama?14:10,i.update();const d={width:1,height:1},m=()=>{const u=t.current;if(c.toneMappingExposure=v(u.exposure,.05,8),e.panorama){const h=q.degToRad(u.rotation);l.scene.backgroundRotation.y=h,l.scene.environmentRotation.y=h,l.scene.backgroundBlurriness=v(u.blur,0,1),l.scene.environmentIntensity=v(u.intensity,0,8)}i.update(),c.render(l.scene,l.camera)},x=()=>{const u=s.getBoundingClientRect();d.width=Math.max(1,Math.floor(u.width)),d.height=Math.max(1,Math.floor(u.height)),c.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),c.setSize(d.width,d.height,!1),l.camera.aspect=d.width/d.height,l.camera.updateProjectionMatrix(),m()};x();const w=new ResizeObserver(x);w.observe(s);const g=()=>{p||(m(),n=requestAnimationFrame(g))};return n=requestAnimationFrame(g),()=>{p=!0,cancelAnimationFrame(n),w.disconnect(),i.dispose();for(const u of l.geometries)u.dispose();for(const u of l.materials)u.dispose();c.dispose(),a.remove()}},[e,t]),o.jsx("div",{ref:r,"data-testid":"environment-preview",style:{width:"100%",height:"100%",minHeight:260,background:"#11141b"}})}function K({panorama:e,settings:t,onChange:r}){return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:4},children:[o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Exposure",o.jsx(b,{value:t.exposure,onChange:s=>r({...t,exposure:v(s,.05,8)}),step:.05,precision:2})]}),e&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Lighting intensity",o.jsx(b,{value:t.intensity,onChange:s=>r({...t,intensity:v(s,0,8)}),step:.05,precision:2})]}),o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Rotation",o.jsx(b,{value:t.rotation,onChange:s=>r({...t,rotation:s%360}),step:1,precision:0})]}),o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Background blur",o.jsx(b,{value:t.blur,onChange:s=>r({...t,blur:v(s,0,1)}),step:.05,precision:2})]})]}),o.jsx("div",{style:{color:y.content.muted,fontSize:10,lineHeight:1.45},children:"Preview controls are session-only. Bind the image, orientation, and accepted intensity in the owning scene source."})]})}function pe({documentId:e,assetPath:t,active:r=!0}){const[s,p]=f.useState(0),[n,a]=f.useState(null),[c,l]=f.useState(null),[i,d]=f.useState({exposure:1,intensity:1,rotation:0,blur:0}),m=f.useRef(i);m.current=i,f.useEffect(()=>{if(r)return I(t,()=>p(g=>g+1))},[r,t]),f.useEffect(()=>{if(!r)return;let g=!1,u=null;return a(null),l(null),W(t).then(h=>{if(u=h,g){h.texture.dispose();return}a(h)},h=>{g||l(h instanceof Error?h.message:String(h))}),()=>{g=!0,u?.texture.dispose()}},[r,t,s]);const x=f.useMemo(()=>[{id:"environment-image",title:"Environment Image",icon:C,order:M,body:{kind:"custom",...n?{data:{format:n.format,width:n.width,height:n.height,panorama:n.panorama}}:{},render:()=>o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 10px"},children:[o.jsx("span",{style:{color:y.content.muted},children:"Format"}),o.jsx("span",{children:n?.format??"—"}),o.jsx("span",{style:{color:y.content.muted},children:"Resolution"}),o.jsx("span",{children:n?`${n.width} × ${n.height}`:"—"}),o.jsx("span",{style:{color:y.content.muted},children:"Projection"}),o.jsx("span",{children:n?.panorama?"2:1 equirectangular":"Flat image"})]})}},{id:"environment-preview-settings",title:"Preview",icon:k,order:D,body:{kind:"custom",data:{...i},render:()=>o.jsx(K,{panorama:n?.panorama??!1,settings:i,onChange:d})}}],[n,i]),w=U(t);return c?o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,status:"HDR image unavailable",children:o.jsx("div",{role:"alert",style:{padding:20,color:y.semantic.danger},children:c})}):n?o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,sections:x,status:`${n.format} · ${n.width} × ${n.height}`,fill:!0,children:o.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0},children:[o.jsx(J,{image:n,settingsRef:m}),o.jsx("div",{style:{position:"absolute",left:12,bottom:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:n.panorama?"Drag to orbit · wheel to frame":"Non-2:1 image · flat preview"})]})}):o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,status:"Loading HDR image",children:o.jsx("div",{style:{padding:20,color:y.content.muted},children:"Loading environment…"})})}export{pe as EnvironmentAssetDocument};
1
+ import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{dR as M,dS as C,dT as D,dU as k,al as y,b5 as R,dV as b}from"./index-jhDTJrJJ.js";import{r as f}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{W as A}from"./three.module-BLhyNg0e.js";import{OrbitControls as P}from"./OrbitControls-B13MKuwC.js";import{E as z}from"./EXRLoader-CITMBvGd.js";import{HDRLoader as T}from"./HDRLoader-BTGuGhVo.js";import{s as I}from"./asset-editor-persistence-BrrBFKn0.js";import{aT as L,ej as O,A as B,el as F,d9 as H,_ as G,db as $,cp as N,co as E,cx as j,ey as S,X as _,cj as q}from"./three.core-3arARmh6.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";function U(e){return e.split("/").pop()??e}function v(e,t,r){return Math.min(r,Math.max(t,e))}function X(e){return e.split(/[?#]/,1)[0].toLowerCase().endsWith(".exr")}async function W(e){const t=X(e)?"EXR":"HDR",s=await(t==="EXR"?new z:new T).loadAsync(e),p=s.image,n=p.width??0,a=p.height??0,c=n>0&&a>0&&Math.abs(n/a-2)<=.04;return s.mapping=L,s.needsUpdate=!0,{texture:s,width:n,height:a,format:t,panorama:c}}function V(e){const t=new F,r=new H(38,1,.05,100);r.position.set(6.2,3.4,7.8),r.lookAt(0,.7,0);const s=[],p=[];if(!e.panorama){t.background=new G("#11141b");const i=e.width>0&&e.height>0?e.width/e.height:1,d=new $(i>=1?4.8:4.8*i,i>=1?4.8/i:4.8),m=new N({map:e.texture,toneMapped:!0});return s.push(d),p.push(m),t.add(new E(d,m)),r.position.set(0,0,6.5),r.lookAt(0,0,0),{scene:t,camera:r,geometries:s,materials:p}}t.background=e.texture,t.environment=e.texture;const n=(i,d,m)=>{s.push(i),p.push(d);const x=new E(i,d);x.position.set(...m),t.add(x)};n(new S(1,64,40),new j({color:"#d8dde5",roughness:.08,metalness:1}),[-2.3,1.15,0]),n(new S(1,64,40),new j({color:"#c97341",roughness:.32,metalness:.25}),[0,1.15,0]),n(new S(1,64,40),new j({color:"#d7d5cf",roughness:.82,metalness:0}),[2.3,1.15,0]);const a=new _(5.7,96),c=new j({color:"#737881",roughness:.58,metalness:0});s.push(a),p.push(c);const l=new E(a,c);return l.rotation.x=-Math.PI/2,l.position.y=.08,t.add(l),{scene:t,camera:r,geometries:s,materials:p}}function J({image:e,settingsRef:t}){const r=f.useRef(null);return f.useEffect(()=>{const s=r.current;if(!s)return;let p=!1,n=0;const a=document.createElement("canvas");a.setAttribute("aria-label",`${e.format} environment preview`),a.style.width="100%",a.style.height="100%",a.style.display="block",s.replaceChildren(a);const c=new A({canvas:a,antialias:!0});c.outputColorSpace=O,c.toneMapping=B;const l=V(e),i=new P(l.camera,a);i.target.set(0,e.panorama?.8:0,0),i.enableDamping=!0,i.enablePan=!1,i.minDistance=e.panorama?3.8:4,i.maxDistance=e.panorama?14:10,i.update();const d={width:1,height:1},m=()=>{const u=t.current;if(c.toneMappingExposure=v(u.exposure,.05,8),e.panorama){const h=q.degToRad(u.rotation);l.scene.backgroundRotation.y=h,l.scene.environmentRotation.y=h,l.scene.backgroundBlurriness=v(u.blur,0,1),l.scene.environmentIntensity=v(u.intensity,0,8)}i.update(),c.render(l.scene,l.camera)},x=()=>{const u=s.getBoundingClientRect();d.width=Math.max(1,Math.floor(u.width)),d.height=Math.max(1,Math.floor(u.height)),c.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),c.setSize(d.width,d.height,!1),l.camera.aspect=d.width/d.height,l.camera.updateProjectionMatrix(),m()};x();const w=new ResizeObserver(x);w.observe(s);const g=()=>{p||(m(),n=requestAnimationFrame(g))};return n=requestAnimationFrame(g),()=>{p=!0,cancelAnimationFrame(n),w.disconnect(),i.dispose();for(const u of l.geometries)u.dispose();for(const u of l.materials)u.dispose();c.dispose(),a.remove()}},[e,t]),o.jsx("div",{ref:r,"data-testid":"environment-preview",style:{width:"100%",height:"100%",minHeight:260,background:"#11141b"}})}function K({panorama:e,settings:t,onChange:r}){return o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:4},children:[o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Exposure",o.jsx(b,{value:t.exposure,onChange:s=>r({...t,exposure:v(s,.05,8)}),step:.05,precision:2})]}),e&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Lighting intensity",o.jsx(b,{value:t.intensity,onChange:s=>r({...t,intensity:v(s,0,8)}),step:.05,precision:2})]}),o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Rotation",o.jsx(b,{value:t.rotation,onChange:s=>r({...t,rotation:s%360}),step:1,precision:0})]}),o.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Background blur",o.jsx(b,{value:t.blur,onChange:s=>r({...t,blur:v(s,0,1)}),step:.05,precision:2})]})]}),o.jsx("div",{style:{color:y.content.muted,fontSize:10,lineHeight:1.45},children:"Preview controls are session-only. Bind the image, orientation, and accepted intensity in the owning scene source."})]})}function pe({documentId:e,assetPath:t,active:r=!0}){const[s,p]=f.useState(0),[n,a]=f.useState(null),[c,l]=f.useState(null),[i,d]=f.useState({exposure:1,intensity:1,rotation:0,blur:0}),m=f.useRef(i);m.current=i,f.useEffect(()=>{if(r)return I(t,()=>p(g=>g+1))},[r,t]),f.useEffect(()=>{if(!r)return;let g=!1,u=null;return a(null),l(null),W(t).then(h=>{if(u=h,g){h.texture.dispose();return}a(h)},h=>{g||l(h instanceof Error?h.message:String(h))}),()=>{g=!0,u?.texture.dispose()}},[r,t,s]);const x=f.useMemo(()=>[{id:"environment-image",title:"Environment Image",icon:C,order:M,body:{kind:"custom",...n?{data:{format:n.format,width:n.width,height:n.height,panorama:n.panorama}}:{},render:()=>o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 10px"},children:[o.jsx("span",{style:{color:y.content.muted},children:"Format"}),o.jsx("span",{children:n?.format??"—"}),o.jsx("span",{style:{color:y.content.muted},children:"Resolution"}),o.jsx("span",{children:n?`${n.width} × ${n.height}`:"—"}),o.jsx("span",{style:{color:y.content.muted},children:"Projection"}),o.jsx("span",{children:n?.panorama?"2:1 equirectangular":"Flat image"})]})}},{id:"environment-preview-settings",title:"Preview",icon:k,order:D,body:{kind:"custom",data:{...i},render:()=>o.jsx(K,{panorama:n?.panorama??!1,settings:i,onChange:d})}}],[n,i]),w=U(t);return c?o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,status:"HDR image unavailable",children:o.jsx("div",{role:"alert",style:{padding:20,color:y.semantic.danger},children:c})}):n?o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,sections:x,status:`${n.format} · ${n.width} × ${n.height}`,fill:!0,children:o.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0},children:[o.jsx(J,{image:n,settingsRef:m}),o.jsx("div",{style:{position:"absolute",left:12,bottom:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:n.panorama?"Drag to orbit · wheel to frame":"Non-2:1 image · flat preview"})]})}):o.jsx(R,{documentId:e,active:r,type:"environment image",title:w,status:"Loading HDR image",children:o.jsx("div",{style:{padding:20,color:y.content.muted},children:"Loading environment…"})})}export{pe as EnvironmentAssetDocument};
@@ -1 +1 @@
1
- import{r as s}from"./index-nmcBqr7Y.js";import{u as l}from"./events-156d8d12.esm-CYeuVCYr.js";import{fx as b,bi as y,c1 as d,aC as h,b0 as T}from"./three.core-3arARmh6.js";function v(t,n,f){const a=l(r=>r.size),p=l(r=>r.viewport),e=typeof t=="number"?t:a.width*p.dpr,u=typeof n=="number"?n:a.height*p.dpr,c=(typeof t=="number"?f:t)||{},{samples:i=0,depth:m,...g}=c,F=m??c.depthBuffer,o=s.useMemo(()=>{const r=new b(e,u,{minFilter:d,magFilter:d,type:y,...g});return F&&(r.depthTexture=new h(e,u,T)),r.samples=i,r},[]);return s.useLayoutEffect(()=>{o.setSize(e,u),i&&(o.samples=i)},[i,o,e,u]),s.useEffect(()=>()=>o.dispose(),[]),o}const z=s.forwardRef(({children:t,width:n,height:f,...a},p)=>{const e=v(n,f,a);return s.useImperativeHandle(p,()=>e,[e]),s.createElement(s.Fragment,null,t?.(e))});export{z as F,v as u};
1
+ import{r as s}from"./index-nmcBqr7Y.js";import{u as l}from"./events-156d8d12.esm-DmeaOP4r.js";import{fx as b,bi as y,c1 as d,aC as h,b0 as T}from"./three.core-3arARmh6.js";function v(t,n,f){const a=l(r=>r.size),p=l(r=>r.viewport),e=typeof t=="number"?t:a.width*p.dpr,u=typeof n=="number"?n:a.height*p.dpr,c=(typeof t=="number"?f:t)||{},{samples:i=0,depth:m,...g}=c,F=m??c.depthBuffer,o=s.useMemo(()=>{const r=new b(e,u,{minFilter:d,magFilter:d,type:y,...g});return F&&(r.depthTexture=new h(e,u,T)),r.samples=i,r},[]);return s.useLayoutEffect(()=>{o.setSize(e,u),i&&(o.samples=i)},[i,o,e,u]),s.useEffect(()=>()=>o.dispose(),[]),o}const z=s.forwardRef(({children:t,width:n,height:f,...a},p)=>{const e=v(n,f,a);return s.useImperativeHandle(p,()=>e,[e]),s.createElement(s.Fragment,null,t?.(e))});export{z as F,v as u};
@@ -1 +1 @@
1
- import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{r as c}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{fv as d,fw as M,dq as f,al as o,et as F}from"./index-r-FuctN5.js";import{c as $}from"./gameplay-replay-BLLppt8C.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./rrweb-Cd2ifIRP.js";import"./output-DK8waum9.js";function T(t,u,p){return Math.max(0,t+p-(u??t))}function y(t){const u=Math.max(0,Math.floor(t/1e3)),p=Math.floor(u/60),i=u%60;return`${p}:${String(i).padStart(2,"0")}`}function q(){const t=c.useSyncExternalStore(d.subscribe,d.getSnapshot,d.getSnapshot),u=c.useRef(null),p=c.useRef(null),[i,j]=c.useState(null),v=c.useSyncExternalStore(M.subscribe,M.getSnapshot,M.getSnapshot),a=t.selectedSession,n=a?.recording?.finalized?a.recording:null,[b,S]=c.useState(null),A=c.useRef(Promise.resolve());c.useEffect(()=>{if(S(null),!n||n.format!=="canvas-dom"||!n.replay||!i)return;let e=!1;const s=n.replay,l=T(a?.startedAt??0,n.startedAt??a?.startedAt??0,i.ms),w=setTimeout(()=>{A.current=A.current.catch(()=>{}).then(async()=>{if(!e)try{const g=await $(s,l);e||S({src:`data:image/png;base64,${g.base64}`})}catch(g){e||S({error:g instanceof Error?g.message:String(g)})}})},180);return()=>{e=!0,clearTimeout(w)}},[n?.replay,n?.format,n?.startedAt,i?.ms,a?.startedAt]);const E=v?Date.parse(v.startedAt):Number.NaN,m=a?.status==="live"&&v&&Number.isFinite(E)&&E>=a.startedAt?v:null,h=a&&i?a.startedAt+i.ms:null,x=m&&h!==null?m.frames.reduce((e,s)=>{const l=Date.parse(s.capturedAt);return Number.isFinite(l)?e?Math.abs(l-h)<Math.abs(Date.parse(e.capturedAt)-h)?s:e:s:e},null)??null:null,k=x?Date.parse(x.capturedAt):Number.NaN,z=x&&h!==null&&Number.isFinite(k)&&Math.abs(k-h)<=Math.max(1e3,2e3/(m?.sampleFps??1))?x:null;function R(e,s){if(!Number.isFinite(e.duration))return;const l=a?.startedAt??0,w=T(l,n?.startedAt??l,s.ms);e.currentTime=Math.min(w/1e3,Math.max(0,e.duration-.01))}c.useEffect(()=>{const e=p.current;!e||!i||R(e,i)},[i,n?.startedAt,a?.startedAt]);function N(e){const s=u.current?.getBoundingClientRect();if(!s||s.width<=0)return{ms:0,x:0};const l=Math.max(0,Math.min(e-s.left,s.width));return{ms:l/s.width*t.liveEdgeMs,x:l}}return t.loading&&t.sessions.length===0?r.jsx("div",{style:{padding:`4px ${f[3]}`,fontSize:11},children:"Loading sessions…"}):t.error&&t.sessions.length===0?r.jsxs("div",{role:"alert",style:{padding:`4px ${f[3]}`,fontSize:11,color:o.semantic.danger},children:["Gameplay Sessions unavailable: ",t.error]}):r.jsxs("div",{style:{height:28,minHeight:28,display:"flex",alignItems:"center",gap:f[2],padding:`0 ${f[3]}`,borderBottom:`1px solid ${o.boundary.default}`,background:o.surface.inset,position:"relative",zIndex:2},children:[r.jsxs("select",{"aria-label":"Gameplay Session",value:t.selectedSessionId??"",onChange:e=>d.select(e.currentTarget.value),style:{maxWidth:180,height:20,fontSize:11},children:[t.sessions.length===0?r.jsx("option",{value:"",children:"No sessions yet"}):null,t.sessions.map((e,s)=>r.jsx("option",{value:e.id,children:e.status==="live"?"Live":e.run??`Session ${t.sessions.length-s}`},e.id))]}),r.jsx("span",{style:{width:34,fontVariantNumeric:"tabular-nums",fontSize:11},children:y(t.cursorMs)}),r.jsxs("div",{ref:u,role:"slider","aria-label":"Session time","aria-valuemin":0,"aria-valuemax":t.liveEdgeMs,"aria-valuenow":t.cursorMs,tabIndex:0,onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),d.seek(N(e.clientX).ms)},onPointerMove:e=>{const s=N(e.clientX);j(s),e.currentTarget.hasPointerCapture(e.pointerId)&&d.seek(s.ms)},onPointerLeave:()=>j(null),onKeyDown:e=>{e.key==="ArrowLeft"&&d.seek(t.cursorMs-1e3),e.key==="ArrowRight"&&d.seek(t.cursorMs+1e3)},style:{flex:1,height:12,position:"relative",cursor:"ew-resize",outline:"none"},children:[r.jsx("div",{style:{position:"absolute",left:0,right:0,top:5,height:2,background:o.boundary.strong}}),r.jsx("div",{style:{position:"absolute",left:`${t.liveEdgeMs>0?t.cursorMs/t.liveEdgeMs*100:0}%`,top:1,width:2,height:10,background:o.accent.default}}),i&&(n||m)?r.jsxs("div",{style:{position:"absolute",left:Math.max(0,i.x-80),top:16,width:160,padding:3,background:o.surface.raised,border:`1px solid ${o.boundary.strong}`,boxShadow:"0 6px 18px rgba(0,0,0,.35)",pointerEvents:"none"},children:[n?.format==="canvas-dom"?b?.src?r.jsx("img",{src:b.src,alt:"Recorded gameplay with HUD",style:{width:"100%",display:"block"}}):r.jsx("div",{role:"status",style:{padding:f[4],fontSize:F.sm},children:b?.error??"Reconstructing frame…"}):n?r.jsx("video",{ref:p,src:n.url,muted:!0,preload:"metadata",onLoadedMetadata:e=>{i&&R(e.currentTarget,i)},style:{width:"100%",display:"block"}}):z?r.jsx("img",{src:z.src,alt:"Live gameplay recording preview",style:{width:"100%",display:"block"}}):r.jsx("div",{style:{padding:8,fontSize:10,color:o.content.muted},children:m?.frames.length===0?"Frame previews are available after recording stops.":`This point is outside the ${y(m?.retentionMs??0)} live preview window.`}),r.jsx("div",{style:{fontSize:10,textAlign:"center",paddingTop:2},children:y(i.ms)})]}):null]}),r.jsx("span",{style:{width:34,fontVariantNumeric:"tabular-nums",fontSize:11},children:y(t.liveEdgeMs)}),a?.status==="live"?r.jsxs("span",{style:{color:o.semantic.danger,fontSize:10},children:["● LIVE",m?" VIDEO":""]}):n?r.jsx("span",{style:{fontSize:10,color:o.content.muted},children:"VIDEO"}):null,t.error?r.jsx("span",{role:"status",title:t.error,style:{color:o.semantic.warning,fontSize:11},children:"⚠"}):null]})}export{q as GameplaySessionTimeline};
1
+ import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{r as c}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{fv as d,fw as M,dq as f,al as o,et as F}from"./index-jhDTJrJJ.js";import{c as $}from"./gameplay-replay-D4vTBXtR.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./rrweb-Cd2ifIRP.js";import"./output-DK8waum9.js";function T(t,u,p){return Math.max(0,t+p-(u??t))}function y(t){const u=Math.max(0,Math.floor(t/1e3)),p=Math.floor(u/60),i=u%60;return`${p}:${String(i).padStart(2,"0")}`}function q(){const t=c.useSyncExternalStore(d.subscribe,d.getSnapshot,d.getSnapshot),u=c.useRef(null),p=c.useRef(null),[i,j]=c.useState(null),v=c.useSyncExternalStore(M.subscribe,M.getSnapshot,M.getSnapshot),a=t.selectedSession,n=a?.recording?.finalized?a.recording:null,[b,S]=c.useState(null),A=c.useRef(Promise.resolve());c.useEffect(()=>{if(S(null),!n||n.format!=="canvas-dom"||!n.replay||!i)return;let e=!1;const s=n.replay,l=T(a?.startedAt??0,n.startedAt??a?.startedAt??0,i.ms),w=setTimeout(()=>{A.current=A.current.catch(()=>{}).then(async()=>{if(!e)try{const g=await $(s,l);e||S({src:`data:image/png;base64,${g.base64}`})}catch(g){e||S({error:g instanceof Error?g.message:String(g)})}})},180);return()=>{e=!0,clearTimeout(w)}},[n?.replay,n?.format,n?.startedAt,i?.ms,a?.startedAt]);const E=v?Date.parse(v.startedAt):Number.NaN,m=a?.status==="live"&&v&&Number.isFinite(E)&&E>=a.startedAt?v:null,h=a&&i?a.startedAt+i.ms:null,x=m&&h!==null?m.frames.reduce((e,s)=>{const l=Date.parse(s.capturedAt);return Number.isFinite(l)?e?Math.abs(l-h)<Math.abs(Date.parse(e.capturedAt)-h)?s:e:s:e},null)??null:null,k=x?Date.parse(x.capturedAt):Number.NaN,z=x&&h!==null&&Number.isFinite(k)&&Math.abs(k-h)<=Math.max(1e3,2e3/(m?.sampleFps??1))?x:null;function R(e,s){if(!Number.isFinite(e.duration))return;const l=a?.startedAt??0,w=T(l,n?.startedAt??l,s.ms);e.currentTime=Math.min(w/1e3,Math.max(0,e.duration-.01))}c.useEffect(()=>{const e=p.current;!e||!i||R(e,i)},[i,n?.startedAt,a?.startedAt]);function N(e){const s=u.current?.getBoundingClientRect();if(!s||s.width<=0)return{ms:0,x:0};const l=Math.max(0,Math.min(e-s.left,s.width));return{ms:l/s.width*t.liveEdgeMs,x:l}}return t.loading&&t.sessions.length===0?r.jsx("div",{style:{padding:`4px ${f[3]}`,fontSize:11},children:"Loading sessions…"}):t.error&&t.sessions.length===0?r.jsxs("div",{role:"alert",style:{padding:`4px ${f[3]}`,fontSize:11,color:o.semantic.danger},children:["Gameplay Sessions unavailable: ",t.error]}):r.jsxs("div",{style:{height:28,minHeight:28,display:"flex",alignItems:"center",gap:f[2],padding:`0 ${f[3]}`,borderBottom:`1px solid ${o.boundary.default}`,background:o.surface.inset,position:"relative",zIndex:2},children:[r.jsxs("select",{"aria-label":"Gameplay Session",value:t.selectedSessionId??"",onChange:e=>d.select(e.currentTarget.value),style:{maxWidth:180,height:20,fontSize:11},children:[t.sessions.length===0?r.jsx("option",{value:"",children:"No sessions yet"}):null,t.sessions.map((e,s)=>r.jsx("option",{value:e.id,children:e.status==="live"?"Live":e.run??`Session ${t.sessions.length-s}`},e.id))]}),r.jsx("span",{style:{width:34,fontVariantNumeric:"tabular-nums",fontSize:11},children:y(t.cursorMs)}),r.jsxs("div",{ref:u,role:"slider","aria-label":"Session time","aria-valuemin":0,"aria-valuemax":t.liveEdgeMs,"aria-valuenow":t.cursorMs,tabIndex:0,onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),d.seek(N(e.clientX).ms)},onPointerMove:e=>{const s=N(e.clientX);j(s),e.currentTarget.hasPointerCapture(e.pointerId)&&d.seek(s.ms)},onPointerLeave:()=>j(null),onKeyDown:e=>{e.key==="ArrowLeft"&&d.seek(t.cursorMs-1e3),e.key==="ArrowRight"&&d.seek(t.cursorMs+1e3)},style:{flex:1,height:12,position:"relative",cursor:"ew-resize",outline:"none"},children:[r.jsx("div",{style:{position:"absolute",left:0,right:0,top:5,height:2,background:o.boundary.strong}}),r.jsx("div",{style:{position:"absolute",left:`${t.liveEdgeMs>0?t.cursorMs/t.liveEdgeMs*100:0}%`,top:1,width:2,height:10,background:o.accent.default}}),i&&(n||m)?r.jsxs("div",{style:{position:"absolute",left:Math.max(0,i.x-80),top:16,width:160,padding:3,background:o.surface.raised,border:`1px solid ${o.boundary.strong}`,boxShadow:"0 6px 18px rgba(0,0,0,.35)",pointerEvents:"none"},children:[n?.format==="canvas-dom"?b?.src?r.jsx("img",{src:b.src,alt:"Recorded gameplay with HUD",style:{width:"100%",display:"block"}}):r.jsx("div",{role:"status",style:{padding:f[4],fontSize:F.sm},children:b?.error??"Reconstructing frame…"}):n?r.jsx("video",{ref:p,src:n.url,muted:!0,preload:"metadata",onLoadedMetadata:e=>{i&&R(e.currentTarget,i)},style:{width:"100%",display:"block"}}):z?r.jsx("img",{src:z.src,alt:"Live gameplay recording preview",style:{width:"100%",display:"block"}}):r.jsx("div",{style:{padding:8,fontSize:10,color:o.content.muted},children:m?.frames.length===0?"Frame previews are available after recording stops.":`This point is outside the ${y(m?.retentionMs??0)} live preview window.`}),r.jsx("div",{style:{fontSize:10,textAlign:"center",paddingTop:2},children:y(i.ms)})]}):null]}),r.jsx("span",{style:{width:34,fontVariantNumeric:"tabular-nums",fontSize:11},children:y(t.liveEdgeMs)}),a?.status==="live"?r.jsxs("span",{style:{color:o.semantic.danger,fontSize:10},children:["● LIVE",m?" VIDEO":""]}):n?r.jsx("span",{style:{fontSize:10,color:o.content.muted},children:"VIDEO"}):null,t.error?r.jsx("span",{role:"status",title:t.error,style:{color:o.semantic.warning,fontSize:11},children:"⚠"}):null]})}export{q as GameplaySessionTimeline};