@volter/game-editor 0.5.129 → 0.5.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/BUNDLED_NOTICES +22 -22
  2. package/catalog/entries/blender.json +2 -2
  3. package/catalog/entries/music.json +2 -2
  4. package/dist/.vite/manifest.json +2182 -2182
  5. package/dist/assets/{AssetBudgetPanel-zU9LQz7t.js → AssetBudgetPanel-qpkXbdeJ.js} +3 -3
  6. package/dist/assets/{AudioViewer-BuIumvS8.js → AudioViewer-Diq9-n8F.js} +1 -1
  7. package/dist/assets/{CanvasBoardDocument-C_hhKnYC.js → CanvasBoardDocument-CBDQEyVH.js} +1 -1
  8. package/dist/assets/{CanvasSceneViewport-ksSPZOlc.js → CanvasSceneViewport-CoROtHru.js} +1 -1
  9. package/dist/assets/{ColorInput-CHpAb52O.js → ColorInput-BibS1jDX.js} +1 -1
  10. package/dist/assets/{ColorPicker-Cj7n9Kxl.js → ColorPicker-CjNV-7dt.js} +1 -1
  11. package/dist/assets/{EntityModelDocument-B7Ud_279.js → EntityModelDocument-D_yh_bF3.js} +1 -1
  12. package/dist/assets/{EnvironmentAssetDocument-yGom_45-.js → EnvironmentAssetDocument-C6oYSwMv.js} +1 -1
  13. package/dist/assets/{GameplaySessionTimeline-Cd0MV73-.js → GameplaySessionTimeline-BRSm8Se1.js} +1 -1
  14. package/dist/assets/{ImageViewer-CcUUUXNJ.js → ImageViewer-ni_DR2ux.js} +1 -1
  15. package/dist/assets/InspectorObjectPreview-5l23L20j.js +1 -0
  16. package/dist/assets/{JsonAssetDocument-Cyahk092.js → JsonAssetDocument-BFpOv6Ri.js} +1 -1
  17. package/dist/assets/{LiveModuleDocument-CZgNwvQy.js → LiveModuleDocument-BBM_u142.js} +1 -1
  18. package/dist/assets/{LutAssetDocument-BCbAd-Z6.js → LutAssetDocument-DEm_pet8.js} +1 -1
  19. package/dist/assets/{ModelAssetDocument-DCPMNFPS.js → ModelAssetDocument-CcJ0cdJN.js} +1 -1
  20. package/dist/assets/{NonThreeAuthoringBootstrap-Bj2wN899.js → NonThreeAuthoringBootstrap-BI-2A7N2.js} +1 -1
  21. package/dist/assets/{Object3DDocumentToolbar-CVPoo7Ba.js → Object3DDocumentToolbar-C64rqdsB.js} +1 -1
  22. package/dist/assets/Object3DDocumentViewport-ClruThDB.js +2 -0
  23. package/dist/assets/{Object3DPreview-BVbUxKmH.js → Object3DPreview-CMaxxYtS.js} +1 -1
  24. package/dist/assets/{OnlineAssetDetail-7a6_tNJk.js → OnlineAssetDetail-C0dCrrVt.js} +1 -1
  25. package/dist/assets/{PlayBar-Cmml9m77.js → PlayBar-B80scEvv.js} +1 -1
  26. package/dist/assets/{QuarksAssetDocument-Cf6ov1uz.js → QuarksAssetDocument-C3G0mGSZ.js} +1 -1
  27. package/dist/assets/{ReactCanvasControls-DlFa-ACA.js → ReactCanvasControls-abb1zGje.js} +1 -1
  28. package/dist/assets/{RootSelectionOverlay-BzYz2ob2.js → RootSelectionOverlay-Bl6dBNQj.js} +1 -1
  29. package/dist/assets/{ShaderAssetDocument-BHIygP3B.js → ShaderAssetDocument-BWHc9ibq.js} +1 -1
  30. package/dist/assets/{ShadowEditor-D19zHDYi.js → ShadowEditor-B4LCKfSG.js} +1 -1
  31. package/dist/assets/{SourceAssetViewer-IiFeRSfU.js → SourceAssetViewer-fVl0ydBm.js} +1 -1
  32. package/dist/assets/StageHost-B9vzNn1n.js +2 -0
  33. package/dist/assets/{StoryPreviewMount-BznKUCNI.js → StoryPreviewMount-C_hNc2Ij.js} +1 -1
  34. package/dist/assets/{ThreeBoardDocument-CKCPXwDq.js → ThreeBoardDocument-YogDDOIp.js} +2 -2
  35. package/dist/assets/{ThreeIsolationSceneContent-C1beSjX3.js → ThreeIsolationSceneContent-D-a3pLt7.js} +1 -1
  36. package/dist/assets/{ToolObject3DPreview-CwbFFjfw.js → ToolObject3DPreview-D78iOtk5.js} +1 -1
  37. package/dist/assets/{Toolbar-9O701nY-.js → Toolbar-BjG9vNYp.js} +1 -1
  38. package/dist/assets/{TransientHint-0ES3rCAi.js → TransientHint-Cq50MQPL.js} +1 -1
  39. package/dist/assets/{VideoViewer-mF9y5CJx.js → VideoViewer-DO_oytGm.js} +1 -1
  40. package/dist/assets/{ViewportShadingMenu-Bl09DInq.js → ViewportShadingMenu-BHMlqkhF.js} +1 -1
  41. package/dist/assets/{active-ingest-Lfx46SVT.js → active-ingest-rcBACBHB.js} +2 -2
  42. package/dist/assets/{animation-clock-Bx0PQrFI.js → animation-clock-Da3NGt-0.js} +1 -1
  43. package/dist/assets/{animation-mixers.service-DBwnNdey.js → animation-mixers.service-DxEKEOvF.js} +1 -1
  44. package/dist/assets/{animation-timeline.utility-5scbZH3A.js → animation-timeline.utility-fzyLKoSw.js} +1 -1
  45. package/dist/assets/{asset-budget-asset.menu-BAsodLrT.js → asset-budget-asset.menu-zQ4Geyg1.js} +1 -1
  46. package/dist/assets/{asset-budget.action-BxLOHl6M.js → asset-budget.action-eFkQrPAS.js} +1 -1
  47. package/dist/assets/{asset-budget.document-gEs0TFUI.js → asset-budget.document-Ccfy3tCs.js} +1 -1
  48. package/dist/assets/{asset-budget.menu-DLKtNhbo.js → asset-budget.menu-jB4_X00E.js} +1 -1
  49. package/dist/assets/{asset-editor-persistence-DMRNecs7.js → asset-editor-persistence-5ujpmT9M.js} +1 -1
  50. package/dist/assets/{asset-loaders-D6LJNA5m.js → asset-loaders-BsFdZ-U4.js} +1 -1
  51. package/dist/assets/{asset-preview-DPWGMtoN.js → asset-preview-agZh9kpZ.js} +1 -1
  52. package/dist/assets/{audio-unlock.service-zZPU9-cJ.js → audio-unlock.service-DYKj_NMi.js} +1 -1
  53. package/dist/assets/{audio.utility-1ayYQ4bt.js → audio.utility-DEEsSpaF.js} +1 -1
  54. package/dist/assets/autoplay.service-CKlnZKMd.js +1 -0
  55. package/dist/assets/{babylon-authoring-adapter-z6KoQamT.js → babylon-authoring-adapter-aQi2udfG.js} +1 -1
  56. package/dist/assets/{binding-resolver--K9B2aXQ.js → binding-resolver-Cri8YpQo.js} +2 -2
  57. package/dist/assets/{blender-node-editor.document-Cbl3oe-Y.js → blender-node-editor.document-BILuLRoc.js} +1 -1
  58. package/dist/assets/{blender-properties-tab-BjcUgPFK.js → blender-properties-tab-jDIlTzUD.js} +1 -1
  59. package/dist/assets/{blender-runtime-host-BnaYnPbE.js → blender-runtime-host-C9hWsbh6.js} +1 -1
  60. package/dist/assets/{blender-runtime-skin-i6pRHo_x.js → blender-runtime-skin-Ddxh2pae.js} +45 -45
  61. package/dist/assets/{blender-runtime.document-iznL9OIR.js → blender-runtime.document-D2iaxi5d.js} +7 -7
  62. package/dist/assets/{blender-screenshot.menu-DY45gH2v.js → blender-screenshot.menu-u9N-Zr7D.js} +1 -1
  63. package/dist/assets/{blender-timeline.document-DzI6KOwi.js → blender-timeline.document-BbVO_s4M.js} +1 -1
  64. package/dist/assets/{blender-uv-editor.document-CQGNL-em.js → blender-uv-editor.document-C8PGmvv1.js} +1 -1
  65. package/dist/assets/{blender-version.status-B-cFkEmZ.js → blender-version.status-B3y-afep.js} +1 -1
  66. package/dist/assets/{blender.command-DYVT6Brx.js → blender.command-C-n6jjz6.js} +1 -1
  67. package/dist/assets/{board-guides-BRZrEdtv.js → board-guides-BUF6uS04.js} +1 -1
  68. package/dist/assets/{bridge.command-BJz6FKqT.js → bridge.command-UFUOG3Tw.js} +3 -3
  69. package/dist/assets/{browserAll-Xq6kMmyy.js → browserAll-Dk8jnjcz.js} +1 -1
  70. package/dist/assets/{build-player.document-G0EP4-cV.js → build-player.document-DsrMMUJY.js} +1 -1
  71. package/dist/assets/{build-profiles.document-C0z4JBId.js → build-profiles.document-B8CHMTfM.js} +1 -1
  72. package/dist/assets/{build-progress.status-ZvaZuR-0.js → build-progress.status-BhNf_U67.js} +1 -1
  73. package/dist/assets/{build-session-CymiRvjZ.js → build-session-B8DvP_BQ.js} +1 -1
  74. package/dist/assets/{build.action-BBxTsXfE.js → build.action-DYur0Wge.js} +1 -1
  75. package/dist/assets/{build.command-DT_Zjx0J.js → build.command-FuDA5B6W.js} +1 -1
  76. package/dist/assets/{build.header-CIpUEYXT.js → build.header-DVZMW019.js} +1 -1
  77. package/dist/assets/{build.menu-BlTGELsH.js → build.menu-CoxrvW_I.js} +1 -1
  78. package/dist/assets/{build.service-AUScoZYu.js → build.service-CHKzqCRC.js} +1 -1
  79. package/dist/assets/{camera-_xYhs96x.js → camera-Cv9S-xWW.js} +1 -1
  80. package/dist/assets/{camera-runtime.inspector-CfU1WRe7.js → camera-runtime.inspector-D1DkFeuo.js} +1 -1
  81. package/dist/assets/{canvas-design-mount-B1zBhn_J.js → canvas-design-mount-CKKc-YGA.js} +3 -3
  82. package/dist/assets/{canvas-entry-runtime-Cg364i6A.js → canvas-entry-runtime-C2kFpUqh.js} +2 -2
  83. package/dist/assets/{canvas-preview-frames-BFU7tNhh.js → canvas-preview-frames-BDmAulpd.js} +1 -1
  84. package/dist/assets/{canvas-story-capture.service-5kd3Krkr.js → canvas-story-capture.service-fMRSHzJi.js} +2 -2
  85. package/dist/assets/{capability-coverage-rUUpSzOn.js → capability-coverage-BAQeb1sR.js} +1 -1
  86. package/dist/assets/{collaboration-presence-DVqUskAb.js → collaboration-presence-CignJxHj.js} +1 -1
  87. package/dist/assets/{collider-BF-ZbxHV.js → collider-DxPzwFDz.js} +1 -1
  88. package/dist/assets/{component-board.service-BcwBF-zp.js → component-board.service-7TS6vRxH.js} +2 -2
  89. package/dist/assets/{component-board.service-Bd1jmbus.js → component-board.service-D4U4JVVU.js} +2 -2
  90. package/dist/assets/{component-board.service-C4T_W5t7.js → component-board.service-DxUhkQVs.js} +2 -2
  91. package/dist/assets/{component-contracts.service-Cft1sJ-Z.js → component-contracts.service-UxbsTME6.js} +1 -1
  92. package/dist/assets/{component-instance-root-DktYaTot.js → component-instance-root-CL5qzF6u.js} +1 -1
  93. package/dist/assets/{component-verbs.command-DvuK_xvY.js → component-verbs.command-DgnKZO4N.js} +1 -1
  94. package/dist/assets/{component-verbs.service-DjMcC9H_.js → component-verbs.service-D3kg65sr.js} +1 -1
  95. package/dist/assets/{config-DlwXFlyt.js → config-Cn372ZzU.js} +2 -2
  96. package/dist/assets/{configurations-CNjdXyJJ.js → configurations-CTWBhTUf.js} +1 -1
  97. package/dist/assets/{connection.status-Cew-NIBU.js → connection.status-wwxZQEAF.js} +1 -1
  98. package/dist/assets/{constraints.inspector-COs-kZwV.js → constraints.inspector-Di21JmyY.js} +1 -1
  99. package/dist/assets/{content-bounds-CY_M6Fwr.js → content-bounds-wsarq3YV.js} +1 -1
  100. package/dist/assets/{contract-system-adapters-C1bKdaVk.js → contract-system-adapters-B9apGOMQ.js} +1 -1
  101. package/dist/assets/{coverage.service-DyHGtZYc.js → coverage.service-_67ez0oy.js} +1 -1
  102. package/dist/assets/{create-runtime-CYU9IW7x.js → create-runtime-BbrWG3Dj.js} +1 -1
  103. package/dist/assets/{curve-BF_LI3jO.js → curve-DrdLYZPA.js} +1 -1
  104. package/dist/assets/{data-asset-D71yCsQc.js → data-asset-cZrqcPJc.js} +1 -1
  105. package/dist/assets/{data-ref-DlKbKxgc.js → data-ref-XaI-aDOy.js} +1 -1
  106. package/dist/assets/{debug-bridge-D1LqwyHH.js → debug-bridge-CMNdajyG.js} +1 -1
  107. package/dist/assets/{debug-registry-BFq6QR4G.js → debug-registry-DpJjXPu6.js} +1 -1
  108. package/dist/assets/{deferred-ingest-play-sqaLv2U9.js → deferred-ingest-play-B8zw5TXo.js} +2 -2
  109. package/dist/assets/{design-time-canvas-mount-Cyaec5o_.js → design-time-canvas-mount-BWzhB7m2.js} +2 -2
  110. package/dist/assets/{design-time-layers-BmljBngv.js → design-time-layers-MmuAEkk7.js} +1 -1
  111. package/dist/assets/{design-time-mount.service-DkXbIUSV.js → design-time-mount.service-B6lQd1pk.js} +2 -2
  112. package/dist/assets/{design-time-mount.service-DaEQZipp.js → design-time-mount.service-DO5qbjP2.js} +2 -2
  113. package/dist/assets/{design-time-react-mount-DiJOqmix.js → design-time-react-mount-Cco4ZPxC.js} +1 -1
  114. package/dist/assets/{document-preview-three-BGSnBaa1.js → document-preview-three-6-rt0s3D.js} +1 -1
  115. package/dist/assets/{dom-authoring-adapter-DeA4Bi4o.js → dom-authoring-adapter-DJME07nM.js} +1 -1
  116. package/dist/assets/{draco3d-Dt3Ei-m7.js → draco3d-CxbStChw.js} +1 -1
  117. package/dist/assets/{edit-mode-audio.service-CwOaP-3u.js → edit-mode-audio.service-Ct7Ldnuk.js} +1 -1
  118. package/dist/assets/{edit-mode-authoring-Cm2rEFlJ.js → edit-mode-authoring-D-2Ik7C9.js} +1 -1
  119. package/dist/assets/{edit-mode-networking.service-BC5B83fD.js → edit-mode-networking.service-BjDXGMHA.js} +1 -1
  120. package/dist/assets/{editor-api-B0Z7yvj8.js → editor-api-DqL1Yaly.js} +1 -1
  121. package/dist/assets/{editor-layers-kBpG49pG.js → editor-layers-DVuMw5f5.js} +1 -1
  122. package/dist/assets/{editor-shell-store-C6VYP6ve.js → editor-shell-store-CNt2zW0E.js} +1 -1
  123. package/dist/assets/{entity-object-DiC6cpEd.js → entity-object-B_x2FCUW.js} +1 -1
  124. package/dist/assets/{extend-DXDb7AYu.js → extend-DM6br_Di.js} +1 -1
  125. package/dist/assets/{fork-menu-Cleuze1z.js → fork-menu-Bl2ZuYie.js} +1 -1
  126. package/dist/assets/{frame-debugger-store-B3YeiIrp.js → frame-debugger-store-DYLys9S-.js} +1 -1
  127. package/dist/assets/{game-contract-seams-Cfyg896y.js → game-contract-seams-B-7gb13c.js} +1 -1
  128. package/dist/assets/{game-css-scope-transform-CWJpcOFq.js → game-css-scope-transform-CNsIQ45a.js} +1 -1
  129. package/dist/assets/{game-document.service-Dhy_L2WU.js → game-document.service-DQfrwN2I.js} +1 -1
  130. package/dist/assets/{game-eval.command-C14hkRIz.js → game-eval.command-BqS_SLDG.js} +1 -1
  131. package/dist/assets/{game-module-access-Cb0rgQXR.js → game-module-access-Dr_jlctk.js} +1 -1
  132. package/dist/assets/{game-network-BuhrtQlJ.js → game-network-CAMgSePs.js} +3 -3
  133. package/dist/assets/{gameplay-export-BMmWR4qO.js → gameplay-export-CkUZ90s2.js} +1 -1
  134. package/dist/assets/{gameplay-replay-Cgxltc0I.js → gameplay-replay-D9vOE3M2.js} +1 -1
  135. package/dist/assets/{gameplay.command-BXkiGrY3.js → gameplay.command-BdwYqSMB.js} +1 -1
  136. package/dist/assets/{generation-jobs-Dti-NsGT.js → generation-jobs-CDn7Ao6l.js} +1 -1
  137. package/dist/assets/{generation.service-CUqMO_sv.js → generation.service-C8JvO6Ll.js} +1 -1
  138. package/dist/assets/{generations-CEMzKgsY.js → generations-BON32S2-.js} +1 -1
  139. package/dist/assets/{generations.status-ClObpAPX.js → generations.status-mal_FOwh.js} +1 -1
  140. package/dist/assets/{hierarchy-marks-BTgoMhKJ.js → hierarchy-marks-DDtpJ7PB.js} +1 -1
  141. package/dist/assets/{hosted-asset-materialization-B1rqU0R3.js → hosted-asset-materialization-DfkPbrUm.js} +1 -1
  142. package/dist/assets/{index-BQhQTNuj.js → index-BXWC4w5R.js} +2 -2
  143. package/dist/assets/{index-CfVh4Js-.js → index-BszEW86b.js} +1 -1
  144. package/dist/assets/{index-DmRQLG00.js → index-DAwnllXr.js} +1 -1
  145. package/dist/assets/{index-BZ9SChD2.js → index-DK92FabE.js} +1 -1
  146. package/dist/assets/{index-D8ZZhAux.js → index-DNf8O3O1.js} +1 -1
  147. package/dist/assets/{index-9nYTVIws.js → index-DmNeCiAo.js} +8 -8
  148. package/dist/assets/{index-L-eheuNN.js → index-SbBinYIF.js} +1 -1
  149. package/dist/assets/{index-Bir3FN9S.js → index-Y_P7AYV1.js} +1 -1
  150. package/dist/assets/{index-BTj5ZDs3.js → index-ihc3rASN.js} +1 -1
  151. package/dist/assets/{inference-diagnostics-71A-NHW0.js → inference-diagnostics-BCK7lzd-.js} +1 -1
  152. package/dist/assets/{ingest-boot-viewport-R_sgEesV.js → ingest-boot-viewport-BSLuPz4r.js} +1 -1
  153. package/dist/assets/{ingest-siblings-Cw0Uh18c.js → ingest-siblings-CE2dKDAS.js} +1 -1
  154. package/dist/assets/{ingest-source-persistence-DbuTxtMu.js → ingest-source-persistence-DXXd6X4G.js} +1 -1
  155. package/dist/assets/{ingest.service-DLFH4vr0.js → ingest.service-QPs7WiGX.js} +1 -1
  156. package/dist/assets/{inspect-3o2qSIRq.js → inspect-DA_mHIRo.js} +1 -1
  157. package/dist/assets/instances.command-C-vOAn13.js +1 -0
  158. package/dist/assets/{json-history-resource-C818aJwj.js → json-history-resource-CZUrVLZF.js} +1 -1
  159. package/dist/assets/{layered-pick-D9xs5s8q.js → layered-pick-D-zS343_.js} +1 -1
  160. package/dist/assets/{light-DmAkSp8r.js → light-BbgMtsRn.js} +1 -1
  161. package/dist/assets/{live-project-verbs-E-s8WH5m.js → live-project-verbs-CUKegag9.js} +1 -1
  162. package/dist/assets/{machine.document-WaAig10j.js → machine.document-DvN6BWU1.js} +1 -1
  163. package/dist/assets/{machines.finder-DOuT11sq.js → machines.finder-DT0HVk3x.js} +1 -1
  164. package/dist/assets/{material-Dmhe3uX6.js → material-BnXxYmBZ.js} +1 -1
  165. package/dist/assets/{material-factory-D2dS8Frx.js → material-factory-D6TA-Ubu.js} +1 -1
  166. package/dist/assets/{mesh-C0P0KD9j.js → mesh-Cutx-5di.js} +1 -1
  167. package/dist/assets/{model-asset-sections.service-DuN8nZyK.js → model-asset-sections.service-BRu2seCr.js} +1 -1
  168. package/dist/assets/{model-inspection-Dys9s7L6.js → model-inspection-BUTTeTpS.js} +1 -1
  169. package/dist/assets/{model-thumbnail-DXupO6bI.js → model-thumbnail-BtcSrAMa.js} +1 -1
  170. package/dist/assets/{models.finder-DVEKCOHk.js → models.finder-SXNTijTt.js} +1 -1
  171. package/dist/assets/{module-mode-BygBdatu.js → module-mode-Cnao3XAv.js} +2 -2
  172. package/dist/assets/{mount-canvas-ingest-root-Cbgn79dS.js → mount-canvas-ingest-root-BSPwlKi0.js} +2 -2
  173. package/dist/assets/{mount-dom-ingest-root-CXQpetbD.js → mount-dom-ingest-root-Bju1wKWY.js} +2 -2
  174. package/dist/assets/{mount-ingest-root-DUX3GfHM.js → mount-ingest-root-Cfb_hJuM.js} +2 -2
  175. package/dist/assets/{mount-manifest-CD7uLAam.js → mount-manifest-C9v48bKT.js} +1 -1
  176. package/dist/assets/{mount-three-ingest-root-D5BUSuP1.js → mount-three-ingest-root-DV2IXb3k.js} +1 -1
  177. package/dist/assets/{mounted-authoring-CHg17ilK.js → mounted-authoring-xyBh_twE.js} +1 -1
  178. package/dist/assets/{mounted-story-viewport-source-DWvv2V1k.js → mounted-story-viewport-source-hP2r14tz.js} +1 -1
  179. package/dist/assets/{native-debug-module-lQJX-160.js → native-debug-module-a57esQxg.js} +1 -1
  180. package/dist/assets/{navigation-BVBawG9W.js → navigation-XoA70Bj5.js} +1 -1
  181. package/dist/assets/{navmesh.menu-CJDd0N9U.js → navmesh.menu-DYnmqbCJ.js} +1 -1
  182. package/dist/assets/{navmesh.service-3H_AsM8V.js → navmesh.service-BzHkiDfO.js} +1 -1
  183. package/dist/assets/network-observer.service-C75jUX8T.js +1 -0
  184. package/dist/assets/{network.utility-CFfOHPIO.js → network.utility-DdSrG_G1.js} +1 -1
  185. package/dist/assets/{object3d-document-session-registry-D6-Tfc82.js → object3d-document-session-registry-jcgiK59f.js} +2 -2
  186. package/dist/assets/{oid-transform-CS4vS_7K.js → oid-transform--cph2k55.js} +1 -1
  187. package/dist/assets/{particles-5E9qI-gh.js → particles-J5SjiKkG.js} +1 -1
  188. package/dist/assets/{pixi-authoring-adapter-B7lzpOiN.js → pixi-authoring-adapter-BG8416OJ.js} +1 -1
  189. package/dist/assets/{pixi-live-write-target-B_0mlJ-W.js → pixi-live-write-target-Ck9xhI_J.js} +1 -1
  190. package/dist/assets/{play.command-DXwe-naC.js → play.command-C9QrjBqH.js} +2 -2
  191. package/dist/assets/{presentation-CNsPSm6R.js → presentation-CMWW6oC4.js} +1 -1
  192. package/dist/assets/{product-CGnkd6iD.js → product-CtuevsUE.js} +1 -1
  193. package/dist/assets/{profiler.action-CJgUgLVa.js → profiler.action-CKL52CX8.js} +1 -1
  194. package/dist/assets/{profiler.menu-r7vS6Yo1.js → profiler.menu-Bx7sdJpH.js} +1 -1
  195. package/dist/assets/{profiler.utility-CoHWXo_c.js → profiler.utility-B9jMd0tG.js} +1 -1
  196. package/dist/assets/{project-authoring-session-CRVFBRc-.js → project-authoring-session-Pa9mXNuZ.js} +2 -2
  197. package/dist/assets/{properties-bone-constraints.inspector-CzmVcM5s.js → properties-bone-constraints.inspector-b8cTlTwC.js} +1 -1
  198. package/dist/assets/{properties-bone.inspector-BZmU33Jq.js → properties-bone.inspector-BnLBufG0.js} +1 -1
  199. package/dist/assets/{properties-collection.inspector-D5E8xv7R.js → properties-collection.inspector-DBNlp_6i.js} +1 -1
  200. package/dist/assets/{properties-constraints.inspector-m1I_6ZEe.js → properties-constraints.inspector-NloiUa9x.js} +1 -1
  201. package/dist/assets/{properties-data.inspector-CHYtOay1.js → properties-data.inspector-C59o5Llj.js} +1 -1
  202. package/dist/assets/{properties-material.inspector-DD3Id-bK.js → properties-material.inspector-p8mh6kCW.js} +1 -1
  203. package/dist/assets/{properties-modifiers.inspector-DgFoyJ9g.js → properties-modifiers.inspector-fcqS8WO7.js} +1 -1
  204. package/dist/assets/{properties-object.inspector-ZKMUDqDb.js → properties-object.inspector-lil6UPt8.js} +1 -1
  205. package/dist/assets/{properties-output.inspector-B_EiV17y.js → properties-output.inspector-DsF-nKdF.js} +1 -1
  206. package/dist/assets/{properties-particles.inspector-Bp5t3sG5.js → properties-particles.inspector-q2Di84s0.js} +1 -1
  207. package/dist/assets/{properties-physics.inspector-BvJ6FjLW.js → properties-physics.inspector-CNclwGwq.js} +1 -1
  208. package/dist/assets/{properties-render.inspector-C0HhUqJV.js → properties-render.inspector-B9ZUvK6B.js} +1 -1
  209. package/dist/assets/{properties-scene.inspector-DvxB8SBY.js → properties-scene.inspector-cJWNTiko.js} +1 -1
  210. package/dist/assets/{properties-texture.inspector-DQK_N2p0.js → properties-texture.inspector-CWCdZSdQ.js} +1 -1
  211. package/dist/assets/{properties-view-layer.inspector-CQimDF5e.js → properties-view-layer.inspector-BHD2twq2.js} +1 -1
  212. package/dist/assets/{properties-world.inspector-Cbyj1FX6.js → properties-world.inspector-CMlj3XLq.js} +1 -1
  213. package/dist/assets/{r3f-design-session-BSfF6B87.js → r3f-design-session-BeAS5PQl.js} +2 -2
  214. package/dist/assets/{r3f-physics-binding-BNfJcrsE.js → r3f-physics-binding-t3rKYjMV.js} +1 -1
  215. package/dist/assets/{r3f-source-authoring-adapter-CN3frg1s.js → r3f-source-authoring-adapter-sFxW7pRe.js} +1 -1
  216. package/dist/assets/{react-canvas-navigation-DdSNr1eV.js → react-canvas-navigation-D2r0gF5Q.js} +1 -1
  217. package/dist/assets/{react-inspector.service-BbtT2HsV.js → react-inspector.service-C1XIPYH0.js} +1 -1
  218. package/dist/assets/{react-story-board-BT9vj0hE.js → react-story-board-2WEWRKNQ.js} +1 -1
  219. package/dist/assets/{react-three-rapier.esm-DE67kTw9.js → react-three-rapier.esm-B2uhShq_.js} +1 -1
  220. package/dist/assets/{react-world-authoring-adapter-CW_LKdTk.js → react-world-authoring-adapter-BLNUCSeK.js} +1 -1
  221. package/dist/assets/{realm-services-NnoNrbsM.js → realm-services-CcfZc_W9.js} +1 -1
  222. package/dist/assets/{reflection-probe-capture.inspector-DRvTQC2t.js → reflection-probe-capture.inspector-BEGRAIcz.js} +1 -1
  223. package/dist/assets/{registry-BYs8gLgr.js → registry-C_pAsb1l.js} +1 -1
  224. package/dist/assets/{relative-import-specifier-CAVq9YAo.js → relative-import-specifier-D1iFwXli.js} +1 -1
  225. package/dist/assets/{render-env-B5aBdPRW.js → render-env-CbXpOb9g.js} +1 -1
  226. package/dist/assets/{render-features-Dro8D2hp.js → render-features-DpJX9WCp.js} +1 -1
  227. package/dist/assets/{render-settings-GZy83cAX.js → render-settings-DYlzijyk.js} +1 -1
  228. package/dist/assets/{resolve-three-D2L9I0Oc.js → resolve-three-Bp7EZT4O.js} +3 -3
  229. package/dist/assets/{root-seam-contract-DhJmeQCY.js → root-seam-contract-Cvxfcfmv.js} +1 -1
  230. package/dist/assets/{run-selection-BkQCgqx8.js → run-selection-BDbgDokC.js} +1 -1
  231. package/dist/assets/{scene-capture-D1HDHgUb.js → scene-capture-CGCpkmz_.js} +1 -1
  232. package/dist/assets/{scene-document.service-CDkhd8nL.js → scene-document.service-BTOhPREd.js} +2 -2
  233. package/dist/assets/{scene-framing-Bib_NZz8.js → scene-framing-B4Ynn1mk.js} +1 -1
  234. package/dist/assets/{seeded-random-DfGQ6n66.js → seeded-random-wICYLJg6.js} +1 -1
  235. package/dist/assets/{setup-renderer-ayLSJRHD.js → setup-renderer-BjhvKXG4.js} +1 -1
  236. package/dist/assets/{source-object3d-authoring-adapter-B_kkT_oM.js → source-object3d-authoring-adapter-CIEoS6Tj.js} +1 -1
  237. package/dist/assets/{source-persistence-backend-CTvhQwDl.js → source-persistence-backend-jB_B_qgt.js} +1 -1
  238. package/dist/assets/{stage-keyboard-BiNmyrcC.js → stage-keyboard-3K38-Hw6.js} +1 -1
  239. package/dist/assets/{stage-overlay-set-DQLl2s9p.js → stage-overlay-set-i7XlbOA8.js} +1 -1
  240. package/dist/assets/{stage-presence-markers-DfVJAOvz.js → stage-presence-markers-CJ49-XME.js} +1 -1
  241. package/dist/assets/{stage-transform-tools-D31L_IPe.js → stage-transform-tools-Bf_p8cJg.js} +1 -1
  242. package/dist/assets/{standard-viewport-dressing-KeudiGw3.js → standard-viewport-dressing-8SWhTXK3.js} +1 -1
  243. package/dist/assets/{state-watch.action-CPN044HT.js → state-watch.action-DCsgcteq.js} +1 -1
  244. package/dist/assets/{state-watch.menu-BflRXjsh.js → state-watch.menu-BK7FGgVR.js} +1 -1
  245. package/dist/assets/{state-watch.utility-Bqey3wQF.js → state-watch.utility-B37tKCea.js} +1 -1
  246. package/dist/assets/{story-capture-BzPUoVSA.js → story-capture-OjR2l-KU.js} +1 -1
  247. package/dist/assets/{story-documents-B3tO-W0D.js → story-documents-Cwlnx5Xe.js} +1 -1
  248. package/dist/assets/{story-documents.service-BT7uy424.js → story-documents.service-DHuiVSJw.js} +1 -1
  249. package/dist/assets/{story-documents.service-ChxLJ279.js → story-documents.service-vNaYun8n.js} +1 -1
  250. package/dist/assets/{story-media-presence-D_0fuO18.js → story-media-presence-629BeHAI.js} +1 -1
  251. package/dist/assets/{story-pixi-preview-DwHwBn93.js → story-pixi-preview-B1mcJckV.js} +1 -1
  252. package/dist/assets/{story-presentation-CSAikKBj.js → story-presentation-Cv7oyJg2.js} +1 -1
  253. package/dist/assets/{story-three-preview-3zJJUEeK.js → story-three-preview-CsLEpAYI.js} +2 -2
  254. package/dist/assets/{studio-environment-8rNw9hGx.js → studio-environment-DsQ4K1L8.js} +1 -1
  255. package/dist/assets/{surface-state-bfly5eRp.js → surface-state-DUClAKxh.js} +1 -1
  256. package/dist/assets/{syntactic-prop-specs-mk2vEFn1.js → syntactic-prop-specs-Bf8S-Hpl.js} +1 -1
  257. package/dist/assets/{team-playtest.service-BsPtBJdT.js → team-playtest.service-8sDrJf5C.js} +1 -1
  258. package/dist/assets/{three-Cq9i0Lo_.js → three-Cgvnp1Nn.js} +1 -1
  259. package/dist/assets/{three-authoring-adapter--CDtc-SE.js → three-authoring-adapter-DZ8eqcFP.js} +1 -1
  260. package/dist/assets/three-authoring.service-FA9fRV2t.js +2 -0
  261. package/dist/assets/{three-ingest-runtime-CDzGhpUC.js → three-ingest-runtime-CYWRwidS.js} +1 -1
  262. package/dist/assets/{three-integration-w-zCKW8J.js → three-integration-DSN-gO72.js} +2 -2
  263. package/dist/assets/three-integration.service--eR0_MqR.js +1 -0
  264. package/dist/assets/{three-projection-core-CxFDvqEe.js → three-projection-core-CSr5hmWB.js} +1 -1
  265. package/dist/assets/{three-state-BHy0drOJ.js → three-state-BIe7PFbc.js} +1 -1
  266. package/dist/assets/{three-story-capture.service-D8JgsxaP.js → three-story-capture.service-gGvamise.js} +2 -2
  267. package/dist/assets/{three-story-model-uufCdHEL.js → three-story-model-CgIBLb2f.js} +1 -1
  268. package/dist/assets/{three-viewport-presentation-ChXzMJQZ.js → three-viewport-presentation-CEu9ox1U.js} +1 -1
  269. package/dist/assets/{transform-mode-request-BUc943em.js → transform-mode-request-8EAetSXS.js} +1 -1
  270. package/dist/assets/{transport-strip-Q1C-g9BA.js → transport-strip-anvfvigR.js} +1 -1
  271. package/dist/assets/transport.header-CpOG4bUd.js +1 -0
  272. package/dist/assets/{tuples-DKGWjTy0.js → tuples-BOY_uUhw.js} +1 -1
  273. package/dist/assets/{ui-board-document-D-VnJE6m.js → ui-board-document-Bgdx8jTV.js} +2 -2
  274. package/dist/assets/{user-data-BQR8TLTV.js → user-data-DvKLhMGu.js} +1 -1
  275. package/dist/assets/{utility-view-state-CI8DUyub.js → utility-view-state-DHpqflFO.js} +1 -1
  276. package/dist/assets/{viewport-door-3sS8tuxh.js → viewport-door-CVX7GCz1.js} +1 -1
  277. package/dist/assets/{viewport-root-presentation-D1HAou7A.js → viewport-root-presentation-m2H6uV6U.js} +1 -1
  278. package/dist/assets/{viewport-surface-status-QAiH2FdR.js → viewport-surface-status-DKyxV0Lz.js} +1 -1
  279. package/dist/assets/{webworkerAll-BsJisO83.js → webworkerAll-B7PoBHDQ.js} +1 -1
  280. package/dist/assets/{workspace-arrangement-8FYR3_fQ.js → workspace-arrangement-Dinn7b-i.js} +1 -1
  281. package/dist/assets/{world-documents-BIjTeJpy.js → world-documents-BL7VdFaK.js} +1 -1
  282. package/dist/assets/{world-root-stage-binding-dtFvIiVe.js → world-root-stage-binding-DXzosgL9.js} +1 -1
  283. package/dist/assets/{xstate-animation-binding-DCEYnnM_.js → xstate-animation-binding-BAPmVeqO.js} +1 -1
  284. package/dist/assets/{xstate-animation-meta-SX2VmhFE.js → xstate-animation-meta-RUH2Lum3.js} +1 -1
  285. package/dist-node/cli.js +16 -16
  286. package/package.json +16 -16
  287. package/dist/assets/InspectorObjectPreview-B90Vut8e.js +0 -1
  288. package/dist/assets/Object3DDocumentViewport-S-eokiOr.js +0 -2
  289. package/dist/assets/StageHost-A77nKogt.js +0 -2
  290. package/dist/assets/autoplay.service-DWi0mQ06.js +0 -1
  291. package/dist/assets/instances.command-BCLwTYAu.js +0 -1
  292. package/dist/assets/network-observer.service-BgHgylkf.js +0 -1
  293. package/dist/assets/three-authoring.service-Ckj4Lbbp.js +0 -2
  294. package/dist/assets/three-integration.service-CKxTNTnz.js +0 -1
  295. package/dist/assets/transport.header-DMkwWnDF.js +0 -1
@@ -1 +1 @@
1
- import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{r as w}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{e4 as j,a6 as S,f0 as st,aN as et,e6 as M,e5 as L,bH as K,a7 as z,iZ as X,kD as O,eJ as at,bP as it,hZ as W,dV as lt,aS as ct}from"./index-9nYTVIws.js";import{C as N,r as ot}from"./ColorPicker-Cj7n9Kxl.js";const dt={full:{anchor:{left:0,top:0,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},top:{anchor:{left:0,top:0,right:1,bottom:0},offset:{left:0,top:0,right:0,bottom:0}},bottom:{anchor:{left:0,top:1,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},left:{anchor:{left:0,top:0,right:0,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},right:{anchor:{left:1,top:0,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},center:{anchor:{left:.5,top:.5,right:.5,bottom:.5},offset:{left:-60,top:-20,right:60,bottom:20}},"top-left":{anchor:{left:0,top:0,right:0,bottom:0},offset:{left:0,top:0,right:120,bottom:40}},"top-right":{anchor:{left:1,top:0,right:1,bottom:0},offset:{left:-120,top:0,right:0,bottom:40}}},V=["flex-start","center","flex-end"],Y=["flex-start","center","flex-end"];function pt({row:t,col:e,justify:s,align:r,isActive:c,disabled:a,onSelect:h}){return o.jsx("div",{"data-testid":`alignment-grid-${t}-${e}`,onClick:()=>{a||h(s,r)},style:{width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:a?"not-allowed":"pointer",borderRadius:j.radiusSmall,background:c?j.accent:"transparent"},children:o.jsx("div",{style:{width:c?6:4,height:c?6:4,borderRadius:"50%",background:c?j.onAccent:j.textMuted}})})}function Lt({value:t,onChange:e,disabled:s}){const r=V.indexOf(t.justify),c=Y.indexOf(t.align);return o.jsx("div",{"data-testid":"alignment-grid",style:{display:"inline-grid",gridTemplateColumns:"repeat(3, 16px)",gridTemplateRows:"repeat(3, 16px)",gap:1,background:j.inputBg,borderRadius:j.radiusMedium,padding:4,opacity:s?.35:1},children:Y.map((a,h)=>V.map((l,m)=>o.jsx(pt,{row:h,col:m,justify:l,align:a,isActive:h===c&&m===r,disabled:s,onSelect:(f,g)=>e({justify:f,align:g})},`${h}-${m}`)))})}function It({onSelect:t,disabled:e}){return o.jsx("div",{"data-testid":"anchor-presets",style:{display:"flex",flexWrap:"wrap",gap:4},children:Object.entries(dt).map(([s,r])=>o.jsx(S,{type:"button",variant:"secondary",size:"compact","data-testid":`anchor-preset-${s}`,disabled:e,onClick:()=>t(s,r),children:s},s))})}function R({label:t,value:e,unit:s="",step:r=1,min:c,max:a,precision:h,disabled:l,onChange:m,onChangeEnd:f,testId:g,style:p}){const x=w.useRef(null),u=h??(r<1?2:r>=100?-2:0),n=w.useMemo(()=>y=>{if(u<0){const C=10**-u;return Math.round(y/C)*C}const k=10**u;return Math.round(y*k)/k},[u]),i=y=>{let k=y;return c!==void 0&&(k=Math.max(c,k)),a!==void 0&&(k=Math.min(a,k)),n(k)},d=y=>{if(l)return;y.preventDefault(),x.current={startX:y.clientX,startValue:e,last:e},document.body.style.cursor="ew-resize";const k=I=>{if(!x.current)return;I.preventDefault();const A=I.clientX-x.current.startX,rt=I.shiftKey?10:I.altKey?.1:1,U=i(x.current.startValue+A*r*rt);x.current.last=U,L({onChange:m},U)},C=()=>{document.body.style.cursor="",window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",H),window.removeEventListener("keydown",G)},H=()=>{if(x.current){const I=x.current.last;x.current=null,M({onChange:m,onChangeEnd:f},I)}C()},G=I=>{if(I.key==="Escape"&&x.current){const A=i(x.current.startValue);x.current=null,L({onChange:m},A),M({onChange:m,onChangeEnd:f},A),C()}};window.addEventListener("mousemove",k),window.addEventListener("mouseup",H),window.addEventListener("keydown",G)},[v,$]=w.useState(null),E=w.useRef(!1),b=y=>{const k=Number.parseFloat(y);if(Number.isNaN(k))return;const C=i(k);C!==e&&M({onChange:m,onChangeEnd:f},C)};return o.jsxs("div",{style:{...st,...p},children:[o.jsx("span",{className:"volter-scrub-label","data-testid":g?`${g}-label`:void 0,onMouseDown:d,"data-disabled":l||void 0,style:{fontSize:11,...l?{color:j.dynamic}:{},flexShrink:0,cursor:l?"not-allowed":"ew-resize",userSelect:"none",fontWeight:500},children:t}),o.jsx(et,{"data-testid":g,type:"text",value:v??`${e}${s}`,readOnly:l,"data-dynamic":l||void 0,onFocus:y=>{$(`${e}${s}`),y.target.select()},onChange:y=>$(y.target.value),onBlur:y=>{E.current||b(y.target.value),E.current=!1,$(null)},onKeyDown:y=>{y.key==="Enter"&&y.target.blur(),y.key==="Escape"&&(E.current=!0,y.target.blur())},style:{flex:1,width:0}})]})}const q=["none","solid","dashed","dotted","double"];function ut(t){return{top:t,right:t,bottom:t,left:t}}function ht(t){const e=r=>`${r.width}|${r.style}|${r.color}`,s=e(t.top);return e(t.right)===s&&e(t.bottom)===s&&e(t.left)===s}function Tt({value:t,onChange:e,onChangeEnd:s,disabled:r,recentColors:c,onAddRecentColor:a}){const[h,l]=w.useState(!ht(t)),m=(p,x)=>{const u={...t.top,...p},n=ut(u);x?M({onChange:e,onChangeEnd:s},n):L({onChange:e},n)},f=(p,x,u)=>{const n={...t,[p]:{...t[p],...x}};u?M({onChange:e,onChangeEnd:s},n):L({onChange:e},n)};if(!h)return o.jsxs("div",{"data-testid":"border-editor-uniform",style:{display:"flex",gap:6,alignItems:"center"},children:[o.jsx(N,{testId:"border-color",value:t.top.color,disabled:r,onChange:p=>m({color:p},!1),onChangeEnd:p=>m({color:p},!0),recentColors:c,onAddRecentColor:a}),o.jsx(R,{testId:"border-width",label:"W",value:t.top.width,min:0,disabled:r,onChange:p=>m({width:p},!1),onChangeEnd:p=>m({width:p},!0),style:{width:64}}),o.jsx(K,{className:"volter-select","data-testid":"border-style",value:t.top.style,disabled:r,"data-dynamic":r||void 0,onChange:p=>m({style:p.target.value},!0),style:{flex:1},children:q.map(p=>o.jsx("option",{value:p,children:p},p))}),o.jsx(S,{type:"button","data-testid":"border-expand",title:"Per-side borders","aria-label":"Edit borders per side",onClick:()=>l(!0),variant:"ghost",size:"compact",children:o.jsx(z,{icon:X})})]});const g=[{key:"top",label:"T"},{key:"right",label:"R"},{key:"bottom",label:"B"},{key:"left",label:"L"}];return o.jsxs("div",{"data-testid":"border-editor-expanded",style:{display:"flex",flexDirection:"column",gap:4},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[o.jsx("span",{style:{fontSize:10,color:j.textMuted},children:"Per-side"}),o.jsx("div",{style:{flex:1}}),o.jsx(S,{type:"button",variant:"primary",size:"compact","data-testid":"border-collapse",title:"Uniform border","aria-label":"Use one border for all sides",onClick:()=>l(!1),children:o.jsx(z,{icon:X})})]}),g.map(({key:p,label:x})=>o.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[o.jsx("span",{style:{fontSize:10,color:j.textMuted,width:10,textAlign:"center"},children:x}),o.jsx(N,{testId:`border-${p}-color`,value:t[p].color,disabled:r,onChange:u=>f(p,{color:u},!1),onChangeEnd:u=>f(p,{color:u},!0),recentColors:c,onAddRecentColor:a}),o.jsx(R,{testId:`border-${p}-width`,label:"",value:t[p].width,min:0,disabled:r,onChange:u=>f(p,{width:u},!1),onChangeEnd:u=>f(p,{width:u},!0),style:{width:48}}),o.jsx(K,{className:"volter-select","data-testid":`border-${p}-style`,value:t[p].style,disabled:r,"data-density":"compact","data-dynamic":r||void 0,onChange:u=>f(p,{style:u.target.value},!0),style:{flex:1},children:q.map(u=>o.jsx("option",{value:u,children:u},u))})]},p))]})}function ft(t){return{topLeft:t,topRight:t,bottomLeft:t,bottomRight:t}}function mt(t){return t.topLeft===t.topRight&&t.topRight===t.bottomLeft&&t.bottomLeft===t.bottomRight}function zt({value:t,onChange:e,onChangeEnd:s,disabled:r}){const[c,a]=w.useState(!mt(t)),h=(f,g)=>{const p=ft(f);g?M({onChange:e,onChangeEnd:s},p):L({onChange:e},p)},l=(f,g,p)=>{const x={...t,[f]:g};p?M({onChange:e,onChangeEnd:s},x):L({onChange:e},x)};if(!c)return o.jsxs("div",{"data-testid":"border-radius-editor-uniform",style:{display:"flex",gap:4,alignItems:"center"},children:[o.jsx(R,{testId:"border-radius",label:o.jsx(z,{icon:O,label:"Radius"}),value:t.topLeft,min:0,disabled:r,onChange:f=>h(f,!1),onChangeEnd:f=>h(f,!0),style:{flex:1}}),o.jsx(S,{type:"button","data-testid":"border-radius-expand",title:"Independent corners","aria-label":"Edit radius per corner",onClick:()=>a(!0),variant:"ghost",size:"compact",children:o.jsx(z,{icon:O})})]});const m=[{key:"topLeft",label:"TL"},{key:"topRight",label:"TR"},{key:"bottomLeft",label:"BL"},{key:"bottomRight",label:"BR"}];return o.jsxs("div",{"data-testid":"border-radius-editor-expanded",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[o.jsx("span",{style:{fontSize:10,color:j.textMuted},children:"Corners"}),o.jsx("div",{style:{flex:1}}),o.jsx(S,{type:"button",variant:"primary",size:"compact","data-testid":"border-radius-collapse",title:"Uniform radius","aria-label":"Use one radius for all corners",onClick:()=>a(!1),children:o.jsx(z,{icon:O})})]}),o.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:m.map(({key:f,label:g})=>o.jsx(R,{testId:`border-radius-${f}`,label:g,value:t[f],min:0,disabled:r,onChange:p=>l(f,p,!1),onChangeEnd:p=>l(f,p,!0)},f))})]})}const P=[{name:"blur",unit:"px",min:0,max:50,step:.5,default:0},{name:"brightness",unit:"%",min:0,max:300,step:1,default:100},{name:"contrast",unit:"%",min:0,max:300,step:1,default:100},{name:"saturate",unit:"%",min:0,max:300,step:1,default:100},{name:"grayscale",unit:"%",min:0,max:100,step:1,default:0},{name:"hue-rotate",unit:"deg",min:0,max:360,step:1,default:0}];function Bt(t){return!t||t==="none"?P.map(e=>({name:e.name,value:e.default})):P.map(e=>{const s=new RegExp(`${e.name}\\(([\\d.]+)${e.unit}?\\)`),r=t.match(s);return{name:e.name,value:r?.[1]?Number.parseFloat(r[1]):e.default}})}function Nt(t){const e=[];for(let s=0;s<t.length;s++){const r=t[s],c=P[s];r&&c&&r.value!==c.default&&e.push(`${r.name}(${r.value}${c.unit})`)}return e.length?e.join(" "):"none"}function At({value:t,onChange:e,onChangeEnd:s,disabled:r,label:c="Filter",testId:a="filter-editor"}){const h=(l,m,f)=>{const g=t.map((p,x)=>x===l?{...p,value:m}:p);f?M({onChange:e,onChangeEnd:s},g):L({onChange:e},g)};return o.jsxs("div",{"data-testid":a,children:[o.jsx("div",{style:{fontSize:9,color:j.textMuted,marginBottom:4},children:c}),t.map((l,m)=>{const f=P[m];return f?o.jsx("div",{"data-testid":`filter-row-${l.name}`,style:{marginBottom:3},children:o.jsx(R,{testId:`filter-${l.name}`,label:l.name.replace("hue-rotate","hue"),value:l.value,unit:f.unit,min:f.min,max:f.max,step:f.step,disabled:r,onChange:g=>h(m,g,!1),onChangeEnd:g=>h(m,g,!0)})},l.name):null})]})}const T=28,J=10;function Dt({value:t,onChange:e,disabled:s,fonts:r,testId:c="font-picker"}){const[a,h]=w.useState(!1),[l,m]=w.useState(""),[f,g]=w.useState(0),p=w.useRef(null),x=w.useRef(null);w.useEffect(()=>{a&&x.current?.focus()},[a]),w.useEffect(()=>{if(!a)return;const b=y=>{p.current&&!p.current.contains(y.target)&&h(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[a]),w.useEffect(()=>{if(!a)return;const b=y=>{y.key==="Escape"&&h(!1)};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[a]);const u=w.useMemo(()=>{if(!l)return r;const b=l.toLowerCase();return r.filter(y=>y.toLowerCase().includes(b))},[r,l]),n=u.length*T,i=Math.floor(f/T),d=Math.min(u.length,i+J+2),v=u.slice(i,d),$=b=>{e(b),h(!1),m("")},E=t.replace(/^["']|["']$/g,"");return o.jsxs("div",{ref:p,"data-testid":c,style:{position:"relative",flex:1},children:[o.jsxs(S,{type:"button",variant:"secondary",className:"volter-field-trigger","aria-haspopup":"listbox","aria-expanded":a,disabled:s,"data-testid":"font-picker-input",onClick:()=>{s||h(b=>!b)},children:[o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E||"—"}),o.jsx(at,{direction:"down",tone:"muted",style:{marginLeft:4}})]}),a&&o.jsxs(it,{"data-testid":"font-picker-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:"var(--volter-z-dropdown)",marginTop:2},children:[o.jsx("div",{style:{padding:4},children:o.jsx(et,{ref:x,type:"text","data-testid":"font-picker-search",value:l,onChange:b=>{m(b.target.value),g(0)},placeholder:"Search fonts…","data-density":"compact",style:{width:"100%",boxSizing:"border-box"}})}),o.jsx("div",{"data-testid":"font-picker-list",onScroll:b=>g(b.target.scrollTop),style:{maxHeight:J*T,overflowY:"auto"},children:o.jsx("div",{style:{height:n,position:"relative"},children:v.map((b,y)=>{const k=i+y,C=b.toLowerCase()===E.toLowerCase();return o.jsx("div",{"data-testid":`font-picker-option-${b}`,onClick:()=>$(b),style:{position:"absolute",top:k*T,left:0,right:0,height:T,display:"flex",alignItems:"center",padding:"0 8px",cursor:"pointer",fontSize:12,background:C?j.accent:"transparent",color:C?j.onAccent:j.text},children:o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b})},b)})})}),u.length===0&&o.jsx("div",{style:{padding:"8px 12px",color:j.textMuted,fontSize:10,textAlign:"center"},children:"No matching fonts"})]})]})}function gt(t){const e=t.stops.map(s=>`${s.color} ${Math.round(s.position*100)}%`).join(", ");return t.type==="radial"?`radial-gradient(circle, ${e})`:`linear-gradient(${t.angle}deg, ${e})`}function xt(t){const e=t.match(/^linear-gradient\((.+)\)$/);if(e?.[1]!==void 0)return{type:"linear",inner:e[1]};const s=t.match(/^radial-gradient\((.+)\)$/);return s?.[1]!==void 0?{type:"radial",inner:s[1]}:null}function yt(t){const e=t.match(/^(\d+)deg\s*,\s*/);if(e)return{angle:Number.parseInt(e[1]??"180",10),colorPart:t.slice(e[0].length)};if(t.startsWith("to ")){const s=t.match(/^to\s+\w+\s*,\s*/);if(s)return{angle:180,colorPart:t.slice(s[0].length)}}return{angle:180,colorPart:t}}function bt(t){const e=t.split(/,\s*(?![^(]*\))/).map(s=>{const r=s.trim(),c=r.match(/\s+(\d+)%$/),a=c?Number.parseInt(c[1]??"0",10)/100:-1;return{color:c?r.slice(0,-c[0].length).trim():r,position:a}});for(let s=0;s<e.length;s++){const r=e[s];r&&r.position<0&&(r.position=e.length>1?s/(e.length-1):0)}return e}function Ft(t){if(!t||t==="none")return null;const e=xt(t);if(!e)return null;const{angle:s,colorPart:r}=e.type==="linear"?yt(e.inner):{angle:180,colorPart:e.inner},c=bt(r);return c.length<2?null:{type:e.type,angle:s,stops:c}}function _({stops:t,selected:e,onSelect:s,onMove:r,disabled:c,testIdPrefix:a}){return o.jsx("div",{style:{position:"relative",height:12,marginTop:2},children:t.map((h,l)=>o.jsx("div",{"data-testid":`${a}-${l}`,onClick:()=>s(l),onMouseDown:m=>{if(c)return;m.preventDefault(),s(l);const g=m.target.parentElement?.getBoundingClientRect(),p=n=>g?.width?Math.max(0,Math.min(1,(n-g.left)/g.width)):h.position,x=n=>r(l,p(n.clientX),!1),u=n=>{r(l,p(n.clientX),!0),window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",x),window.addEventListener("mouseup",u)},style:{position:"absolute",left:`${h.position*100}%`,top:0,width:10,height:10,borderRadius:"50%",background:h.css,border:`2px solid ${l===e?j.accent:"#fff"}`,transform:"translateX(-50%)",cursor:c?"not-allowed":"pointer"}},l))})}function Pt({value:t,onChange:e,onChangeEnd:s,disabled:r,recentColors:c,onAddRecentColor:a,testId:h="gradient-editor"}){const[l,m]=w.useState(0),f=(i,d)=>{d?M({onChange:e,onChangeEnd:s},i):L({onChange:e},i)},g=(i,d,v)=>{const $=t.stops.map((E,b)=>b===i?{...E,...d}:E);f({...t,stops:$},v)},p=()=>{const i=t.stops[t.stops.length-1]?.position??1,d=t.stops[0]?.position??0,v=(i+d)/2,$=[...t.stops,{color:"#888888",position:v}].sort((E,b)=>E.position-b.position);m($.length-1),f({...t,stops:$},!0)},x=i=>{if(t.stops.length<=2)return;const d=t.stops.filter((v,$)=>$!==i);m(Math.min(l,d.length-1)),f({...t,stops:d},!0)},u=t.stops[l]?.color??"#000000",n=u.startsWith("#")?u:ot(u);return o.jsxs("div",{"data-testid":h,children:[o.jsxs("div",{style:{position:"relative",marginBottom:8},children:[o.jsx("div",{"data-testid":"gradient-preview",style:{height:20,borderRadius:j.radiusSmall,border:`1px solid ${j.border}`,background:gt(t)}}),o.jsx(_,{stops:t.stops.map(i=>({position:i.position,css:i.color})),selected:l,onSelect:m,onMove:(i,d,v)=>g(i,{position:d},v),disabled:r,testIdPrefix:"gradient-stop"})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[o.jsx(N,{testId:"gradient-selected-color",value:n,disabled:r,onChange:i=>g(l,{color:i},!1),onChangeEnd:i=>g(l,{color:i},!0),recentColors:c,onAddRecentColor:a}),o.jsxs("span",{style:{fontSize:9,color:j.textMuted},children:["Stop ",l+1]}),t.stops.length>2&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove gradient stop","data-testid":"gradient-remove-stop",onClick:()=>x(l),children:"×"}),o.jsx(S,{type:"button",variant:"ghost",size:"compact","data-testid":"gradient-add-stop",onClick:p,children:"+ stop"})]}),o.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[o.jsxs("div",{style:{display:"flex",gap:1,flex:1},children:[o.jsx(W,{testId:"gradient-type-linear",label:"Linear",active:t.type==="linear",disabled:r,onClick:()=>f({...t,type:"linear"},!0)}),o.jsx(W,{testId:"gradient-type-radial",label:"Radial",active:t.type==="radial",disabled:r,onClick:()=>f({...t,type:"radial"},!0)})]}),t.type==="linear"&&o.jsx(R,{testId:"gradient-angle",label:"°",value:t.angle,unit:"deg",disabled:r,onChange:i=>f({...t,angle:i},!1),onChangeEnd:i=>f({...t,angle:i},!0),style:{width:70}})]})]})}function Q(t){const e=s=>Math.round(Math.max(0,Math.min(1,s))*255).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}function Z(t){return{r:Number.parseInt(t.slice(1,3),16)/255,g:Number.parseInt(t.slice(3,5),16)/255,b:Number.parseInt(t.slice(5,7),16)/255}}function D(t,e,s){if(t.length===0)return;if(e<=t[0].pos)return t[0].value;const r=t[t.length-1];if(e>=r.pos)return r.value;for(let c=0;c+1<t.length;c++){const a=t[c],h=t[c+1];if(e>=a.pos&&e<=h.pos){const l=h.pos>a.pos?(e-a.pos)/(h.pos-a.pos):0;return s(a.value,h.value,l)}}return r.value}const B=(t,e,s)=>t+(e-t)*s,tt=(t,e,s)=>({r:B(t.r,e.r,s),g:B(t.g,e.g,s),b:B(t.b,e.b,s)});function F(t,e,s){const r={...t[e],pos:s},c=[...t.filter((a,h)=>h!==e),r].sort((a,h)=>a.pos-h.pos);return{keys:c,index:c.indexOf(r)}}function Ot({value:t,onChange:e,onChangeEnd:s,disabled:r,testId:c="quarks-gradient"}){const[a,h]=w.useState({track:"color",i:0}),l=(n,i)=>{i?M({onChange:e,onChangeEnd:s},n):L({onChange:e},n)},m=n=>({...t,color:{...t.color,keys:n}}),f=n=>({...t,alpha:{...t.alpha,keys:n}}),p=[...new Set([...t.color.keys.map(n=>n.pos),...t.alpha.keys.map(n=>n.pos)])].sort((n,i)=>n-i).map(n=>{const i=D(t.color.keys,n,tt)??{r:1,g:1,b:1},d=D(t.alpha.keys,n,B)??1;return`rgba(${Math.round(i.r*255)},${Math.round(i.g*255)},${Math.round(i.b*255)},${Math.round(d*1e3)/1e3}) ${Math.round(n*100)}%`}).join(", "),x=t.color.keys[a.track==="color"?a.i:0],u=t.alpha.keys[a.track==="alpha"?a.i:0];return o.jsxs("div",{"data-testid":c,children:[o.jsx(_,{stops:t.alpha.keys.map(n=>{const i=Math.round(Math.max(0,Math.min(1,n.value))*255);return{position:n.pos,css:`rgb(${i},${i},${i})`}}),selected:a.track==="alpha"?a.i:-1,onSelect:n=>h({track:"alpha",i:n}),onMove:(n,i,d)=>{const{keys:v,index:$}=F(t.alpha.keys,n,i);h({track:"alpha",i:$}),l(f(v),d)},disabled:r,testIdPrefix:`${c}-alpha-stop`}),o.jsx("div",{"data-testid":`${c}-preview`,style:{height:20,borderRadius:j.radiusSmall,border:`1px solid ${j.border}`,backgroundImage:`linear-gradient(90deg, ${p}), repeating-linear-gradient(45deg, #777 0 5px, #aaa 5px 10px)`}}),o.jsx(_,{stops:t.color.keys.map(n=>({position:n.pos,css:Q(n.value)})),selected:a.track==="color"?a.i:-1,onSelect:n=>h({track:"color",i:n}),onMove:(n,i,d)=>{const{keys:v,index:$}=F(t.color.keys,n,i);h({track:"color",i:$}),l(m(v),d)},disabled:r,testIdPrefix:`${c}-color-stop`}),a.track==="color"&&x&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[o.jsx(N,{testId:`${c}-color-swatch`,value:Q(x.value),disabled:r,onChange:n=>l(m(t.color.keys.map((i,d)=>d===a.i?{...i,value:Z(n)}:i)),!1),onChangeEnd:n=>l(m(t.color.keys.map((i,d)=>d===a.i?{...i,value:Z(n)}:i)),!0)}),o.jsxs("span",{style:{fontSize:9,color:j.textMuted},children:["Color ",a.i+1,"/",t.color.keys.length]}),t.color.keys.length>2&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove color stop","data-testid":`${c}-remove-color-stop`,onClick:()=>{const n=t.color.keys.filter((i,d)=>d!==a.i);h({track:"color",i:Math.min(a.i,n.length-1)}),l(m(n),!0)},children:"×"}),o.jsx(S,{type:"button",variant:"ghost",size:"compact","data-testid":`${c}-add-color-stop`,onClick:()=>{const i=D(t.color.keys,.5,tt)??{r:1,g:1,b:1},{keys:d,index:v}=F([...t.color.keys,{value:i,pos:.5}],t.color.keys.length,.5);h({track:"color",i:v}),l(m(d),!0)},children:"+ stop"})]}),a.track==="alpha"&&u&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[o.jsx(lt,{label:"a",step:.05,testId:`${c}-alpha-value`,value:Math.round(u.value*1e3)/1e3,onChange:n=>l(f(t.alpha.keys.map((i,d)=>d===a.i?{...i,value:Math.max(0,Math.min(1,n))}:i)),!1),onChangeEnd:n=>l(f(t.alpha.keys.map((i,d)=>d===a.i?{...i,value:Math.max(0,Math.min(1,n))}:i)),!0)}),o.jsxs("span",{style:{fontSize:9,color:j.textMuted},children:["Alpha ",a.i+1,"/",t.alpha.keys.length]}),t.alpha.keys.length>2&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove alpha stop","data-testid":`${c}-remove-alpha-stop`,onClick:()=>{const n=t.alpha.keys.filter((i,d)=>d!==a.i);h({track:"alpha",i:Math.min(a.i,n.length-1)}),l(f(n),!0)},children:"×"}),o.jsx(S,{type:"button",variant:"ghost",size:"compact","data-testid":`${c}-add-alpha-stop`,onClick:()=>{const i=D(t.alpha.keys,.5,B)??1,{keys:d,index:v}=F([...t.alpha.keys,{value:i,pos:.5}],t.alpha.keys.length,.5);h({track:"alpha",i:v}),l(f(d),!0)},children:"+ stop"})]})]})}const jt={x:0,y:4,blur:8,spread:0,color:"rgba(0,0,0,0.25)",inset:!1,enabled:!0},vt={x:0,y:2,blur:4,spread:0,color:"rgba(0,0,0,0.3)",inset:!1,enabled:!0};function wt(t,e){return(e?[t.inset?"inset":"",`${t.x}px`,`${t.y}px`,`${t.blur}px`,`${t.spread}px`,t.color]:[`${t.x}px`,`${t.y}px`,`${t.blur}px`,t.color]).filter(Boolean).join(" ")}function _t(t,e=!0){const s=t.filter(r=>r.enabled);return s.length===0?"none":s.map(r=>wt(r,e)).join(", ")}function $t(t){const e=t.match(/(rgba?\([^)]+\))/);if(e?.[1])return{color:e[1],nums:t.replace(e[1],"").trim()};const s=t.match(/(#[0-9a-fA-F]{3,8})/);return s?.[1]?{color:s[1],nums:t.replace(s[1],"").trim()}:{color:"#000000",nums:t}}function kt(t,e){if(!t||t==="none")return null;const s=t.trim(),r=e&&s.startsWith("inset"),c=r?s.slice(5).trim():s,{color:a,nums:h}=$t(c),l=h.split(/\s+/).map(m=>Number.parseFloat(m)).filter(m=>!Number.isNaN(m));return e?{inset:r,x:l[0]??0,y:l[1]??0,blur:l[2]??0,spread:l[3]??0,color:a}:l.length<2?null:{inset:!1,x:l[0]??0,y:l[1]??0,blur:l[2]??0,spread:0,color:a}}function Ht(t,e=!0){if(!t||t==="none")return[];const s=t.split(/,\s*(?![^(]*\))/),r=[];for(const c of s){const a=kt(c.trim(),e);a&&r.push({...a,enabled:!0})}return r}function nt({value:t,onChange:e,onChangeEnd:s,disabled:r,withSpreadInset:c=!0,label:a="Shadow",testId:h="shadow-editor",recentColors:l,onAddRecentColor:m}){const f=(u,n)=>{n?M({onChange:e,onChangeEnd:s},u):L({onChange:e},u)},g=(u,n,i=!1)=>{f(t.map((d,v)=>v===u?{...d,...n}:d),i)},p=u=>{f(t.filter((n,i)=>i!==u),!0)},x=()=>{f([...t,{...c?jt:vt}],!0)};return o.jsxs("div",{"data-testid":h,children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:t.length>0?4:0},children:[o.jsx("span",{style:{fontSize:9,color:j.textMuted},children:a}),o.jsx("div",{style:{flex:1}}),!r&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","data-testid":`${h}-add`,onClick:x,children:"+"})]}),t.map((u,n)=>{const i=u.color.startsWith("#")?u.color:ot(u.color);return o.jsxs("div",{"data-testid":`${h}-row-${n}`,style:{marginBottom:6,padding:"4px 0",borderBottom:`1px solid ${j.border}`},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-pressed":u.enabled,"data-testid":`${h}-toggle-${n}`,onClick:()=>{r||g(n,{enabled:!u.enabled},!0)},children:u.enabled?"●":"○"}),o.jsx(N,{testId:`${h}-color-${n}`,value:i,disabled:r,onChange:d=>g(n,{color:d}),onChangeEnd:d=>g(n,{color:d},!0),recentColors:l,onAddRecentColor:m}),c&&o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:2,fontSize:8,color:j.textMuted,cursor:"pointer"},children:[o.jsx(ct,{className:"volter-checkbox","data-testid":`${h}-inset-${n}`,checked:u.inset,disabled:r,onChange:d=>g(n,{inset:d.target.checked},!0)}),"in"]}),o.jsx("div",{style:{flex:1}}),!r&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-label":`Remove ${a.toLowerCase()} ${n+1}`,"data-testid":`${h}-remove-${n}`,onClick:()=>p(n),children:"×"})]}),u.enabled&&o.jsxs("div",{style:{display:"flex",gap:4},children:[o.jsx(R,{label:"X",value:u.x,disabled:r,onChange:d=>g(n,{x:d}),onChangeEnd:d=>g(n,{x:d},!0),style:{flex:1}}),o.jsx(R,{label:"Y",value:u.y,disabled:r,onChange:d=>g(n,{y:d}),onChangeEnd:d=>g(n,{y:d},!0),style:{flex:1}}),o.jsx(R,{label:"B",value:u.blur,min:0,disabled:r,onChange:d=>g(n,{blur:Math.max(0,d)}),onChangeEnd:d=>g(n,{blur:Math.max(0,d)},!0),style:{flex:1}}),c&&o.jsx(R,{label:"S",value:u.spread,disabled:r,onChange:d=>g(n,{spread:d}),onChangeEnd:d=>g(n,{spread:d},!0),style:{flex:1}})]})]},n)})]})}function Gt(t){return o.jsx(nt,{...t,withSpreadInset:!0,testId:"box-shadow-editor",label:t.label??"Shadow"})}function Ut(t){return o.jsx(nt,{...t,withSpreadInset:!1,testId:"text-shadow-editor",label:t.label??"Text Shadow"})}export{Lt as A,Tt as B,jt as D,At as F,Pt as G,Ot as Q,R as S,Ut as T,zt as a,Bt as b,gt as c,Nt as d,Ht as e,Gt as f,_t as g,Dt as h,ht as i,mt as j,It as k,vt as l,_ as m,nt as n,ft as o,Ft as p,ut as u};
1
+ import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{r as w}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{e4 as j,a6 as S,f0 as st,aN as et,e6 as M,e5 as L,bH as K,a7 as z,iZ as X,kD as O,eJ as at,bP as it,hZ as W,dV as lt,aS as ct}from"./index-DmNeCiAo.js";import{C as N,r as ot}from"./ColorPicker-CjNV-7dt.js";const dt={full:{anchor:{left:0,top:0,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},top:{anchor:{left:0,top:0,right:1,bottom:0},offset:{left:0,top:0,right:0,bottom:0}},bottom:{anchor:{left:0,top:1,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},left:{anchor:{left:0,top:0,right:0,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},right:{anchor:{left:1,top:0,right:1,bottom:1},offset:{left:0,top:0,right:0,bottom:0}},center:{anchor:{left:.5,top:.5,right:.5,bottom:.5},offset:{left:-60,top:-20,right:60,bottom:20}},"top-left":{anchor:{left:0,top:0,right:0,bottom:0},offset:{left:0,top:0,right:120,bottom:40}},"top-right":{anchor:{left:1,top:0,right:1,bottom:0},offset:{left:-120,top:0,right:0,bottom:40}}},V=["flex-start","center","flex-end"],Y=["flex-start","center","flex-end"];function pt({row:t,col:e,justify:s,align:r,isActive:c,disabled:a,onSelect:h}){return o.jsx("div",{"data-testid":`alignment-grid-${t}-${e}`,onClick:()=>{a||h(s,r)},style:{width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",cursor:a?"not-allowed":"pointer",borderRadius:j.radiusSmall,background:c?j.accent:"transparent"},children:o.jsx("div",{style:{width:c?6:4,height:c?6:4,borderRadius:"50%",background:c?j.onAccent:j.textMuted}})})}function Lt({value:t,onChange:e,disabled:s}){const r=V.indexOf(t.justify),c=Y.indexOf(t.align);return o.jsx("div",{"data-testid":"alignment-grid",style:{display:"inline-grid",gridTemplateColumns:"repeat(3, 16px)",gridTemplateRows:"repeat(3, 16px)",gap:1,background:j.inputBg,borderRadius:j.radiusMedium,padding:4,opacity:s?.35:1},children:Y.map((a,h)=>V.map((l,m)=>o.jsx(pt,{row:h,col:m,justify:l,align:a,isActive:h===c&&m===r,disabled:s,onSelect:(f,g)=>e({justify:f,align:g})},`${h}-${m}`)))})}function It({onSelect:t,disabled:e}){return o.jsx("div",{"data-testid":"anchor-presets",style:{display:"flex",flexWrap:"wrap",gap:4},children:Object.entries(dt).map(([s,r])=>o.jsx(S,{type:"button",variant:"secondary",size:"compact","data-testid":`anchor-preset-${s}`,disabled:e,onClick:()=>t(s,r),children:s},s))})}function R({label:t,value:e,unit:s="",step:r=1,min:c,max:a,precision:h,disabled:l,onChange:m,onChangeEnd:f,testId:g,style:p}){const x=w.useRef(null),u=h??(r<1?2:r>=100?-2:0),n=w.useMemo(()=>y=>{if(u<0){const C=10**-u;return Math.round(y/C)*C}const k=10**u;return Math.round(y*k)/k},[u]),i=y=>{let k=y;return c!==void 0&&(k=Math.max(c,k)),a!==void 0&&(k=Math.min(a,k)),n(k)},d=y=>{if(l)return;y.preventDefault(),x.current={startX:y.clientX,startValue:e,last:e},document.body.style.cursor="ew-resize";const k=I=>{if(!x.current)return;I.preventDefault();const A=I.clientX-x.current.startX,rt=I.shiftKey?10:I.altKey?.1:1,U=i(x.current.startValue+A*r*rt);x.current.last=U,L({onChange:m},U)},C=()=>{document.body.style.cursor="",window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",H),window.removeEventListener("keydown",G)},H=()=>{if(x.current){const I=x.current.last;x.current=null,M({onChange:m,onChangeEnd:f},I)}C()},G=I=>{if(I.key==="Escape"&&x.current){const A=i(x.current.startValue);x.current=null,L({onChange:m},A),M({onChange:m,onChangeEnd:f},A),C()}};window.addEventListener("mousemove",k),window.addEventListener("mouseup",H),window.addEventListener("keydown",G)},[v,$]=w.useState(null),E=w.useRef(!1),b=y=>{const k=Number.parseFloat(y);if(Number.isNaN(k))return;const C=i(k);C!==e&&M({onChange:m,onChangeEnd:f},C)};return o.jsxs("div",{style:{...st,...p},children:[o.jsx("span",{className:"volter-scrub-label","data-testid":g?`${g}-label`:void 0,onMouseDown:d,"data-disabled":l||void 0,style:{fontSize:11,...l?{color:j.dynamic}:{},flexShrink:0,cursor:l?"not-allowed":"ew-resize",userSelect:"none",fontWeight:500},children:t}),o.jsx(et,{"data-testid":g,type:"text",value:v??`${e}${s}`,readOnly:l,"data-dynamic":l||void 0,onFocus:y=>{$(`${e}${s}`),y.target.select()},onChange:y=>$(y.target.value),onBlur:y=>{E.current||b(y.target.value),E.current=!1,$(null)},onKeyDown:y=>{y.key==="Enter"&&y.target.blur(),y.key==="Escape"&&(E.current=!0,y.target.blur())},style:{flex:1,width:0}})]})}const q=["none","solid","dashed","dotted","double"];function ut(t){return{top:t,right:t,bottom:t,left:t}}function ht(t){const e=r=>`${r.width}|${r.style}|${r.color}`,s=e(t.top);return e(t.right)===s&&e(t.bottom)===s&&e(t.left)===s}function Tt({value:t,onChange:e,onChangeEnd:s,disabled:r,recentColors:c,onAddRecentColor:a}){const[h,l]=w.useState(!ht(t)),m=(p,x)=>{const u={...t.top,...p},n=ut(u);x?M({onChange:e,onChangeEnd:s},n):L({onChange:e},n)},f=(p,x,u)=>{const n={...t,[p]:{...t[p],...x}};u?M({onChange:e,onChangeEnd:s},n):L({onChange:e},n)};if(!h)return o.jsxs("div",{"data-testid":"border-editor-uniform",style:{display:"flex",gap:6,alignItems:"center"},children:[o.jsx(N,{testId:"border-color",value:t.top.color,disabled:r,onChange:p=>m({color:p},!1),onChangeEnd:p=>m({color:p},!0),recentColors:c,onAddRecentColor:a}),o.jsx(R,{testId:"border-width",label:"W",value:t.top.width,min:0,disabled:r,onChange:p=>m({width:p},!1),onChangeEnd:p=>m({width:p},!0),style:{width:64}}),o.jsx(K,{className:"volter-select","data-testid":"border-style",value:t.top.style,disabled:r,"data-dynamic":r||void 0,onChange:p=>m({style:p.target.value},!0),style:{flex:1},children:q.map(p=>o.jsx("option",{value:p,children:p},p))}),o.jsx(S,{type:"button","data-testid":"border-expand",title:"Per-side borders","aria-label":"Edit borders per side",onClick:()=>l(!0),variant:"ghost",size:"compact",children:o.jsx(z,{icon:X})})]});const g=[{key:"top",label:"T"},{key:"right",label:"R"},{key:"bottom",label:"B"},{key:"left",label:"L"}];return o.jsxs("div",{"data-testid":"border-editor-expanded",style:{display:"flex",flexDirection:"column",gap:4},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[o.jsx("span",{style:{fontSize:10,color:j.textMuted},children:"Per-side"}),o.jsx("div",{style:{flex:1}}),o.jsx(S,{type:"button",variant:"primary",size:"compact","data-testid":"border-collapse",title:"Uniform border","aria-label":"Use one border for all sides",onClick:()=>l(!1),children:o.jsx(z,{icon:X})})]}),g.map(({key:p,label:x})=>o.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[o.jsx("span",{style:{fontSize:10,color:j.textMuted,width:10,textAlign:"center"},children:x}),o.jsx(N,{testId:`border-${p}-color`,value:t[p].color,disabled:r,onChange:u=>f(p,{color:u},!1),onChangeEnd:u=>f(p,{color:u},!0),recentColors:c,onAddRecentColor:a}),o.jsx(R,{testId:`border-${p}-width`,label:"",value:t[p].width,min:0,disabled:r,onChange:u=>f(p,{width:u},!1),onChangeEnd:u=>f(p,{width:u},!0),style:{width:48}}),o.jsx(K,{className:"volter-select","data-testid":`border-${p}-style`,value:t[p].style,disabled:r,"data-density":"compact","data-dynamic":r||void 0,onChange:u=>f(p,{style:u.target.value},!0),style:{flex:1},children:q.map(u=>o.jsx("option",{value:u,children:u},u))})]},p))]})}function ft(t){return{topLeft:t,topRight:t,bottomLeft:t,bottomRight:t}}function mt(t){return t.topLeft===t.topRight&&t.topRight===t.bottomLeft&&t.bottomLeft===t.bottomRight}function zt({value:t,onChange:e,onChangeEnd:s,disabled:r}){const[c,a]=w.useState(!mt(t)),h=(f,g)=>{const p=ft(f);g?M({onChange:e,onChangeEnd:s},p):L({onChange:e},p)},l=(f,g,p)=>{const x={...t,[f]:g};p?M({onChange:e,onChangeEnd:s},x):L({onChange:e},x)};if(!c)return o.jsxs("div",{"data-testid":"border-radius-editor-uniform",style:{display:"flex",gap:4,alignItems:"center"},children:[o.jsx(R,{testId:"border-radius",label:o.jsx(z,{icon:O,label:"Radius"}),value:t.topLeft,min:0,disabled:r,onChange:f=>h(f,!1),onChangeEnd:f=>h(f,!0),style:{flex:1}}),o.jsx(S,{type:"button","data-testid":"border-radius-expand",title:"Independent corners","aria-label":"Edit radius per corner",onClick:()=>a(!0),variant:"ghost",size:"compact",children:o.jsx(z,{icon:O})})]});const m=[{key:"topLeft",label:"TL"},{key:"topRight",label:"TR"},{key:"bottomLeft",label:"BL"},{key:"bottomRight",label:"BR"}];return o.jsxs("div",{"data-testid":"border-radius-editor-expanded",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[o.jsx("span",{style:{fontSize:10,color:j.textMuted},children:"Corners"}),o.jsx("div",{style:{flex:1}}),o.jsx(S,{type:"button",variant:"primary",size:"compact","data-testid":"border-radius-collapse",title:"Uniform radius","aria-label":"Use one radius for all corners",onClick:()=>a(!1),children:o.jsx(z,{icon:O})})]}),o.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:3},children:m.map(({key:f,label:g})=>o.jsx(R,{testId:`border-radius-${f}`,label:g,value:t[f],min:0,disabled:r,onChange:p=>l(f,p,!1),onChangeEnd:p=>l(f,p,!0)},f))})]})}const P=[{name:"blur",unit:"px",min:0,max:50,step:.5,default:0},{name:"brightness",unit:"%",min:0,max:300,step:1,default:100},{name:"contrast",unit:"%",min:0,max:300,step:1,default:100},{name:"saturate",unit:"%",min:0,max:300,step:1,default:100},{name:"grayscale",unit:"%",min:0,max:100,step:1,default:0},{name:"hue-rotate",unit:"deg",min:0,max:360,step:1,default:0}];function Bt(t){return!t||t==="none"?P.map(e=>({name:e.name,value:e.default})):P.map(e=>{const s=new RegExp(`${e.name}\\(([\\d.]+)${e.unit}?\\)`),r=t.match(s);return{name:e.name,value:r?.[1]?Number.parseFloat(r[1]):e.default}})}function Nt(t){const e=[];for(let s=0;s<t.length;s++){const r=t[s],c=P[s];r&&c&&r.value!==c.default&&e.push(`${r.name}(${r.value}${c.unit})`)}return e.length?e.join(" "):"none"}function At({value:t,onChange:e,onChangeEnd:s,disabled:r,label:c="Filter",testId:a="filter-editor"}){const h=(l,m,f)=>{const g=t.map((p,x)=>x===l?{...p,value:m}:p);f?M({onChange:e,onChangeEnd:s},g):L({onChange:e},g)};return o.jsxs("div",{"data-testid":a,children:[o.jsx("div",{style:{fontSize:9,color:j.textMuted,marginBottom:4},children:c}),t.map((l,m)=>{const f=P[m];return f?o.jsx("div",{"data-testid":`filter-row-${l.name}`,style:{marginBottom:3},children:o.jsx(R,{testId:`filter-${l.name}`,label:l.name.replace("hue-rotate","hue"),value:l.value,unit:f.unit,min:f.min,max:f.max,step:f.step,disabled:r,onChange:g=>h(m,g,!1),onChangeEnd:g=>h(m,g,!0)})},l.name):null})]})}const T=28,J=10;function Dt({value:t,onChange:e,disabled:s,fonts:r,testId:c="font-picker"}){const[a,h]=w.useState(!1),[l,m]=w.useState(""),[f,g]=w.useState(0),p=w.useRef(null),x=w.useRef(null);w.useEffect(()=>{a&&x.current?.focus()},[a]),w.useEffect(()=>{if(!a)return;const b=y=>{p.current&&!p.current.contains(y.target)&&h(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[a]),w.useEffect(()=>{if(!a)return;const b=y=>{y.key==="Escape"&&h(!1)};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[a]);const u=w.useMemo(()=>{if(!l)return r;const b=l.toLowerCase();return r.filter(y=>y.toLowerCase().includes(b))},[r,l]),n=u.length*T,i=Math.floor(f/T),d=Math.min(u.length,i+J+2),v=u.slice(i,d),$=b=>{e(b),h(!1),m("")},E=t.replace(/^["']|["']$/g,"");return o.jsxs("div",{ref:p,"data-testid":c,style:{position:"relative",flex:1},children:[o.jsxs(S,{type:"button",variant:"secondary",className:"volter-field-trigger","aria-haspopup":"listbox","aria-expanded":a,disabled:s,"data-testid":"font-picker-input",onClick:()=>{s||h(b=>!b)},children:[o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E||"—"}),o.jsx(at,{direction:"down",tone:"muted",style:{marginLeft:4}})]}),a&&o.jsxs(it,{"data-testid":"font-picker-dropdown",style:{position:"absolute",top:"100%",left:0,right:0,zIndex:"var(--volter-z-dropdown)",marginTop:2},children:[o.jsx("div",{style:{padding:4},children:o.jsx(et,{ref:x,type:"text","data-testid":"font-picker-search",value:l,onChange:b=>{m(b.target.value),g(0)},placeholder:"Search fonts…","data-density":"compact",style:{width:"100%",boxSizing:"border-box"}})}),o.jsx("div",{"data-testid":"font-picker-list",onScroll:b=>g(b.target.scrollTop),style:{maxHeight:J*T,overflowY:"auto"},children:o.jsx("div",{style:{height:n,position:"relative"},children:v.map((b,y)=>{const k=i+y,C=b.toLowerCase()===E.toLowerCase();return o.jsx("div",{"data-testid":`font-picker-option-${b}`,onClick:()=>$(b),style:{position:"absolute",top:k*T,left:0,right:0,height:T,display:"flex",alignItems:"center",padding:"0 8px",cursor:"pointer",fontSize:12,background:C?j.accent:"transparent",color:C?j.onAccent:j.text},children:o.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b})},b)})})}),u.length===0&&o.jsx("div",{style:{padding:"8px 12px",color:j.textMuted,fontSize:10,textAlign:"center"},children:"No matching fonts"})]})]})}function gt(t){const e=t.stops.map(s=>`${s.color} ${Math.round(s.position*100)}%`).join(", ");return t.type==="radial"?`radial-gradient(circle, ${e})`:`linear-gradient(${t.angle}deg, ${e})`}function xt(t){const e=t.match(/^linear-gradient\((.+)\)$/);if(e?.[1]!==void 0)return{type:"linear",inner:e[1]};const s=t.match(/^radial-gradient\((.+)\)$/);return s?.[1]!==void 0?{type:"radial",inner:s[1]}:null}function yt(t){const e=t.match(/^(\d+)deg\s*,\s*/);if(e)return{angle:Number.parseInt(e[1]??"180",10),colorPart:t.slice(e[0].length)};if(t.startsWith("to ")){const s=t.match(/^to\s+\w+\s*,\s*/);if(s)return{angle:180,colorPart:t.slice(s[0].length)}}return{angle:180,colorPart:t}}function bt(t){const e=t.split(/,\s*(?![^(]*\))/).map(s=>{const r=s.trim(),c=r.match(/\s+(\d+)%$/),a=c?Number.parseInt(c[1]??"0",10)/100:-1;return{color:c?r.slice(0,-c[0].length).trim():r,position:a}});for(let s=0;s<e.length;s++){const r=e[s];r&&r.position<0&&(r.position=e.length>1?s/(e.length-1):0)}return e}function Ft(t){if(!t||t==="none")return null;const e=xt(t);if(!e)return null;const{angle:s,colorPart:r}=e.type==="linear"?yt(e.inner):{angle:180,colorPart:e.inner},c=bt(r);return c.length<2?null:{type:e.type,angle:s,stops:c}}function _({stops:t,selected:e,onSelect:s,onMove:r,disabled:c,testIdPrefix:a}){return o.jsx("div",{style:{position:"relative",height:12,marginTop:2},children:t.map((h,l)=>o.jsx("div",{"data-testid":`${a}-${l}`,onClick:()=>s(l),onMouseDown:m=>{if(c)return;m.preventDefault(),s(l);const g=m.target.parentElement?.getBoundingClientRect(),p=n=>g?.width?Math.max(0,Math.min(1,(n-g.left)/g.width)):h.position,x=n=>r(l,p(n.clientX),!1),u=n=>{r(l,p(n.clientX),!0),window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",u)};window.addEventListener("mousemove",x),window.addEventListener("mouseup",u)},style:{position:"absolute",left:`${h.position*100}%`,top:0,width:10,height:10,borderRadius:"50%",background:h.css,border:`2px solid ${l===e?j.accent:"#fff"}`,transform:"translateX(-50%)",cursor:c?"not-allowed":"pointer"}},l))})}function Pt({value:t,onChange:e,onChangeEnd:s,disabled:r,recentColors:c,onAddRecentColor:a,testId:h="gradient-editor"}){const[l,m]=w.useState(0),f=(i,d)=>{d?M({onChange:e,onChangeEnd:s},i):L({onChange:e},i)},g=(i,d,v)=>{const $=t.stops.map((E,b)=>b===i?{...E,...d}:E);f({...t,stops:$},v)},p=()=>{const i=t.stops[t.stops.length-1]?.position??1,d=t.stops[0]?.position??0,v=(i+d)/2,$=[...t.stops,{color:"#888888",position:v}].sort((E,b)=>E.position-b.position);m($.length-1),f({...t,stops:$},!0)},x=i=>{if(t.stops.length<=2)return;const d=t.stops.filter((v,$)=>$!==i);m(Math.min(l,d.length-1)),f({...t,stops:d},!0)},u=t.stops[l]?.color??"#000000",n=u.startsWith("#")?u:ot(u);return o.jsxs("div",{"data-testid":h,children:[o.jsxs("div",{style:{position:"relative",marginBottom:8},children:[o.jsx("div",{"data-testid":"gradient-preview",style:{height:20,borderRadius:j.radiusSmall,border:`1px solid ${j.border}`,background:gt(t)}}),o.jsx(_,{stops:t.stops.map(i=>({position:i.position,css:i.color})),selected:l,onSelect:m,onMove:(i,d,v)=>g(i,{position:d},v),disabled:r,testIdPrefix:"gradient-stop"})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[o.jsx(N,{testId:"gradient-selected-color",value:n,disabled:r,onChange:i=>g(l,{color:i},!1),onChangeEnd:i=>g(l,{color:i},!0),recentColors:c,onAddRecentColor:a}),o.jsxs("span",{style:{fontSize:9,color:j.textMuted},children:["Stop ",l+1]}),t.stops.length>2&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove gradient stop","data-testid":"gradient-remove-stop",onClick:()=>x(l),children:"×"}),o.jsx(S,{type:"button",variant:"ghost",size:"compact","data-testid":"gradient-add-stop",onClick:p,children:"+ stop"})]}),o.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[o.jsxs("div",{style:{display:"flex",gap:1,flex:1},children:[o.jsx(W,{testId:"gradient-type-linear",label:"Linear",active:t.type==="linear",disabled:r,onClick:()=>f({...t,type:"linear"},!0)}),o.jsx(W,{testId:"gradient-type-radial",label:"Radial",active:t.type==="radial",disabled:r,onClick:()=>f({...t,type:"radial"},!0)})]}),t.type==="linear"&&o.jsx(R,{testId:"gradient-angle",label:"°",value:t.angle,unit:"deg",disabled:r,onChange:i=>f({...t,angle:i},!1),onChangeEnd:i=>f({...t,angle:i},!0),style:{width:70}})]})]})}function Q(t){const e=s=>Math.round(Math.max(0,Math.min(1,s))*255).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}function Z(t){return{r:Number.parseInt(t.slice(1,3),16)/255,g:Number.parseInt(t.slice(3,5),16)/255,b:Number.parseInt(t.slice(5,7),16)/255}}function D(t,e,s){if(t.length===0)return;if(e<=t[0].pos)return t[0].value;const r=t[t.length-1];if(e>=r.pos)return r.value;for(let c=0;c+1<t.length;c++){const a=t[c],h=t[c+1];if(e>=a.pos&&e<=h.pos){const l=h.pos>a.pos?(e-a.pos)/(h.pos-a.pos):0;return s(a.value,h.value,l)}}return r.value}const B=(t,e,s)=>t+(e-t)*s,tt=(t,e,s)=>({r:B(t.r,e.r,s),g:B(t.g,e.g,s),b:B(t.b,e.b,s)});function F(t,e,s){const r={...t[e],pos:s},c=[...t.filter((a,h)=>h!==e),r].sort((a,h)=>a.pos-h.pos);return{keys:c,index:c.indexOf(r)}}function Ot({value:t,onChange:e,onChangeEnd:s,disabled:r,testId:c="quarks-gradient"}){const[a,h]=w.useState({track:"color",i:0}),l=(n,i)=>{i?M({onChange:e,onChangeEnd:s},n):L({onChange:e},n)},m=n=>({...t,color:{...t.color,keys:n}}),f=n=>({...t,alpha:{...t.alpha,keys:n}}),p=[...new Set([...t.color.keys.map(n=>n.pos),...t.alpha.keys.map(n=>n.pos)])].sort((n,i)=>n-i).map(n=>{const i=D(t.color.keys,n,tt)??{r:1,g:1,b:1},d=D(t.alpha.keys,n,B)??1;return`rgba(${Math.round(i.r*255)},${Math.round(i.g*255)},${Math.round(i.b*255)},${Math.round(d*1e3)/1e3}) ${Math.round(n*100)}%`}).join(", "),x=t.color.keys[a.track==="color"?a.i:0],u=t.alpha.keys[a.track==="alpha"?a.i:0];return o.jsxs("div",{"data-testid":c,children:[o.jsx(_,{stops:t.alpha.keys.map(n=>{const i=Math.round(Math.max(0,Math.min(1,n.value))*255);return{position:n.pos,css:`rgb(${i},${i},${i})`}}),selected:a.track==="alpha"?a.i:-1,onSelect:n=>h({track:"alpha",i:n}),onMove:(n,i,d)=>{const{keys:v,index:$}=F(t.alpha.keys,n,i);h({track:"alpha",i:$}),l(f(v),d)},disabled:r,testIdPrefix:`${c}-alpha-stop`}),o.jsx("div",{"data-testid":`${c}-preview`,style:{height:20,borderRadius:j.radiusSmall,border:`1px solid ${j.border}`,backgroundImage:`linear-gradient(90deg, ${p}), repeating-linear-gradient(45deg, #777 0 5px, #aaa 5px 10px)`}}),o.jsx(_,{stops:t.color.keys.map(n=>({position:n.pos,css:Q(n.value)})),selected:a.track==="color"?a.i:-1,onSelect:n=>h({track:"color",i:n}),onMove:(n,i,d)=>{const{keys:v,index:$}=F(t.color.keys,n,i);h({track:"color",i:$}),l(m(v),d)},disabled:r,testIdPrefix:`${c}-color-stop`}),a.track==="color"&&x&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[o.jsx(N,{testId:`${c}-color-swatch`,value:Q(x.value),disabled:r,onChange:n=>l(m(t.color.keys.map((i,d)=>d===a.i?{...i,value:Z(n)}:i)),!1),onChangeEnd:n=>l(m(t.color.keys.map((i,d)=>d===a.i?{...i,value:Z(n)}:i)),!0)}),o.jsxs("span",{style:{fontSize:9,color:j.textMuted},children:["Color ",a.i+1,"/",t.color.keys.length]}),t.color.keys.length>2&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove color stop","data-testid":`${c}-remove-color-stop`,onClick:()=>{const n=t.color.keys.filter((i,d)=>d!==a.i);h({track:"color",i:Math.min(a.i,n.length-1)}),l(m(n),!0)},children:"×"}),o.jsx(S,{type:"button",variant:"ghost",size:"compact","data-testid":`${c}-add-color-stop`,onClick:()=>{const i=D(t.color.keys,.5,tt)??{r:1,g:1,b:1},{keys:d,index:v}=F([...t.color.keys,{value:i,pos:.5}],t.color.keys.length,.5);h({track:"color",i:v}),l(m(d),!0)},children:"+ stop"})]}),a.track==="alpha"&&u&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:4},children:[o.jsx(lt,{label:"a",step:.05,testId:`${c}-alpha-value`,value:Math.round(u.value*1e3)/1e3,onChange:n=>l(f(t.alpha.keys.map((i,d)=>d===a.i?{...i,value:Math.max(0,Math.min(1,n))}:i)),!1),onChangeEnd:n=>l(f(t.alpha.keys.map((i,d)=>d===a.i?{...i,value:Math.max(0,Math.min(1,n))}:i)),!0)}),o.jsxs("span",{style:{fontSize:9,color:j.textMuted},children:["Alpha ",a.i+1,"/",t.alpha.keys.length]}),t.alpha.keys.length>2&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-label":"Remove alpha stop","data-testid":`${c}-remove-alpha-stop`,onClick:()=>{const n=t.alpha.keys.filter((i,d)=>d!==a.i);h({track:"alpha",i:Math.min(a.i,n.length-1)}),l(f(n),!0)},children:"×"}),o.jsx(S,{type:"button",variant:"ghost",size:"compact","data-testid":`${c}-add-alpha-stop`,onClick:()=>{const i=D(t.alpha.keys,.5,B)??1,{keys:d,index:v}=F([...t.alpha.keys,{value:i,pos:.5}],t.alpha.keys.length,.5);h({track:"alpha",i:v}),l(f(d),!0)},children:"+ stop"})]})]})}const jt={x:0,y:4,blur:8,spread:0,color:"rgba(0,0,0,0.25)",inset:!1,enabled:!0},vt={x:0,y:2,blur:4,spread:0,color:"rgba(0,0,0,0.3)",inset:!1,enabled:!0};function wt(t,e){return(e?[t.inset?"inset":"",`${t.x}px`,`${t.y}px`,`${t.blur}px`,`${t.spread}px`,t.color]:[`${t.x}px`,`${t.y}px`,`${t.blur}px`,t.color]).filter(Boolean).join(" ")}function _t(t,e=!0){const s=t.filter(r=>r.enabled);return s.length===0?"none":s.map(r=>wt(r,e)).join(", ")}function $t(t){const e=t.match(/(rgba?\([^)]+\))/);if(e?.[1])return{color:e[1],nums:t.replace(e[1],"").trim()};const s=t.match(/(#[0-9a-fA-F]{3,8})/);return s?.[1]?{color:s[1],nums:t.replace(s[1],"").trim()}:{color:"#000000",nums:t}}function kt(t,e){if(!t||t==="none")return null;const s=t.trim(),r=e&&s.startsWith("inset"),c=r?s.slice(5).trim():s,{color:a,nums:h}=$t(c),l=h.split(/\s+/).map(m=>Number.parseFloat(m)).filter(m=>!Number.isNaN(m));return e?{inset:r,x:l[0]??0,y:l[1]??0,blur:l[2]??0,spread:l[3]??0,color:a}:l.length<2?null:{inset:!1,x:l[0]??0,y:l[1]??0,blur:l[2]??0,spread:0,color:a}}function Ht(t,e=!0){if(!t||t==="none")return[];const s=t.split(/,\s*(?![^(]*\))/),r=[];for(const c of s){const a=kt(c.trim(),e);a&&r.push({...a,enabled:!0})}return r}function nt({value:t,onChange:e,onChangeEnd:s,disabled:r,withSpreadInset:c=!0,label:a="Shadow",testId:h="shadow-editor",recentColors:l,onAddRecentColor:m}){const f=(u,n)=>{n?M({onChange:e,onChangeEnd:s},u):L({onChange:e},u)},g=(u,n,i=!1)=>{f(t.map((d,v)=>v===u?{...d,...n}:d),i)},p=u=>{f(t.filter((n,i)=>i!==u),!0)},x=()=>{f([...t,{...c?jt:vt}],!0)};return o.jsxs("div",{"data-testid":h,children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:t.length>0?4:0},children:[o.jsx("span",{style:{fontSize:9,color:j.textMuted},children:a}),o.jsx("div",{style:{flex:1}}),!r&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","data-testid":`${h}-add`,onClick:x,children:"+"})]}),t.map((u,n)=>{const i=u.color.startsWith("#")?u.color:ot(u.color);return o.jsxs("div",{"data-testid":`${h}-row-${n}`,style:{marginBottom:6,padding:"4px 0",borderBottom:`1px solid ${j.border}`},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-pressed":u.enabled,"data-testid":`${h}-toggle-${n}`,onClick:()=>{r||g(n,{enabled:!u.enabled},!0)},children:u.enabled?"●":"○"}),o.jsx(N,{testId:`${h}-color-${n}`,value:i,disabled:r,onChange:d=>g(n,{color:d}),onChangeEnd:d=>g(n,{color:d},!0),recentColors:l,onAddRecentColor:m}),c&&o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:2,fontSize:8,color:j.textMuted,cursor:"pointer"},children:[o.jsx(ct,{className:"volter-checkbox","data-testid":`${h}-inset-${n}`,checked:u.inset,disabled:r,onChange:d=>g(n,{inset:d.target.checked},!0)}),"in"]}),o.jsx("div",{style:{flex:1}}),!r&&o.jsx(S,{type:"button",variant:"ghost",size:"compact","aria-label":`Remove ${a.toLowerCase()} ${n+1}`,"data-testid":`${h}-remove-${n}`,onClick:()=>p(n),children:"×"})]}),u.enabled&&o.jsxs("div",{style:{display:"flex",gap:4},children:[o.jsx(R,{label:"X",value:u.x,disabled:r,onChange:d=>g(n,{x:d}),onChangeEnd:d=>g(n,{x:d},!0),style:{flex:1}}),o.jsx(R,{label:"Y",value:u.y,disabled:r,onChange:d=>g(n,{y:d}),onChangeEnd:d=>g(n,{y:d},!0),style:{flex:1}}),o.jsx(R,{label:"B",value:u.blur,min:0,disabled:r,onChange:d=>g(n,{blur:Math.max(0,d)}),onChangeEnd:d=>g(n,{blur:Math.max(0,d)},!0),style:{flex:1}}),c&&o.jsx(R,{label:"S",value:u.spread,disabled:r,onChange:d=>g(n,{spread:d}),onChangeEnd:d=>g(n,{spread:d},!0),style:{flex:1}})]})]},n)})]})}function Gt(t){return o.jsx(nt,{...t,withSpreadInset:!0,testId:"box-shadow-editor",label:t.label??"Shadow"})}function Ut(t){return o.jsx(nt,{...t,withSpreadInset:!1,testId:"text-shadow-editor",label:t.label??"Text Shadow"})}export{Lt as A,Tt as B,jt as D,At as F,Pt as G,Ot as Q,R as S,Ut as T,zt as a,Bt as b,gt as c,Nt as d,Ht as e,Gt as f,_t as g,Dt as h,ht as i,mt as j,It as k,vt as l,_ as m,nt as n,ft as o,Ft as p,ut as u};
@@ -1 +1 @@
1
- import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{b5 as m,al as n,b6 as x,b7 as C,b8 as $,aC as V}from"./index-9nYTVIws.js";import{r as f}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{J as E,C as N,c as A}from"./JsonAssetDocument-Cyahk092.js";import{AudioViewer as H}from"./AudioViewer-BuIumvS8.js";import{ImageViewer as R}from"./ImageViewer-CcUUUXNJ.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 k(t){const e=(t.split(/[?#]/,1)[0]??"").replace(/^\//,"");return e.startsWith("src/")&&/\.(?:[cm]?[jt]sx?)$/.test(e)}function j(t){const e=C(t);return e.editor==="model"?"model":e.editor==="image"?"image":e.editor==="audio"?"audio":e.editor==="data"?"json":e.editor==="environment"?"environment":e.format==="cube"?"lut":e.format==="glsl"||e.format==="vert"||e.format==="frag"?"shader":k(t)?"module":e.editor==="source"&&e.previewable?"text":"binary"}function b({documentId:t,assetPath:e,active:i=!0}){const[o,l]=f.useState(null),[c,u]=f.useState(null),y=e.split("/").pop()??e;return f.useEffect(()=>{let a=!1;l(null),u(null);const w=e.replace(/^\//,"");let d=0;async function h(){const g=++d;try{const s=`/__editor/source-file?path=${encodeURIComponent(w)}`,S=await fetch(s,{cache:"no-store"}).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.text()});!a&&g===d&&(l(S),u(null))}catch(s){!a&&g===d&&u(s instanceof Error?s.message:String(s))}}const v=$();return h(),()=>{a=!0,v()}},[e]),r.jsx(m,{documentId:t,active:i,type:"source",title:y,sections:[],status:`source · ${e}`,fill:!0,children:r.jsx("div",{style:{padding:12,height:"100%",minHeight:0,display:"flex",flexDirection:"column",gap:8},children:r.jsx("div",{style:{padding:8,flex:1,minHeight:0,display:"flex",overflow:"hidden",background:n.surface.inset,border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small},children:c!==null||o===null?r.jsx("div",{style:{fontFamily:n.typography.mono,fontSize:11,lineHeight:1.5,color:c?n.semantic.danger:n.content.muted,padding:4},children:c??"Loading…"}):r.jsx(N,{value:o,followChanges:!0,language:A(e),fontSize:11,maxHeight:"100%",ariaLabel:`Source of ${e}`})})})})}function z({documentId:t,assetPath:e,active:i}){const o=e.split("/").pop()??e;return r.jsx(m,{documentId:t,active:i,type:"source",title:o,sections:[],status:`no viewer · ${e}`,children:r.jsxs("div",{style:{padding:16,color:n.content.muted,fontSize:12},children:["No editor package in this project renders ",o,"; the file is available in the project and stays selectable and referenceable."]})})}function K({documentId:t,assetPath:e,active:i=!0}){switch(j(e)){case"model":case"environment":case"lut":case"shader":{const o=j(e);return r.jsx(x,{route:o,documentId:t,assetPath:e,displayName:e.split("/").pop()??e,active:i,whenUnregistered:r.jsx(z,{documentId:t,assetPath:e,active:i})})}case"image":return r.jsx(R,{assetPath:e});case"audio":return r.jsx(H,{assetPath:e});case"json":return r.jsx(E,{documentId:t,assetPath:e,displayName:e.split("/").pop()??e,active:i,sections:[],status:`json · ${e}`});case"module":{const o=V()?.rootPath,l=r.jsx(b,{documentId:t,assetPath:e,active:i});return o?r.jsx(x,{route:"module",documentId:t,assetPath:e,projectRoot:o,displayName:e.split("/").pop()??e,active:i,fallback:l,whenUnregistered:l}):l}case"text":return r.jsx(b,{documentId:t,assetPath:e,active:i});case"binary":return r.jsx(m,{documentId:t,active:i,type:"binary source",title:e.split("/").pop()??e,sections:[],status:`binary · ${e}`,children:r.jsxs("div",{style:{padding:16,color:n.content.muted,fontSize:12},children:[r.jsx("div",{style:{color:n.content.primary,fontWeight:600,marginBottom:6},children:e.split("/").pop()}),"This binary source is available in the project, but it has no safe in-editor renderer. Its file remains selectable and referenceable without being misidentified as another format."]})})}}export{K as SourceAssetViewer,j as sourceAssetRoute};
1
+ import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import{b5 as m,al as n,b6 as x,b7 as C,b8 as $,aC as V}from"./index-DmNeCiAo.js";import{r as f}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{J as E,C as N,c as A}from"./JsonAssetDocument-BFpOv6Ri.js";import{AudioViewer as H}from"./AudioViewer-Diq9-n8F.js";import{ImageViewer as R}from"./ImageViewer-ni_DR2ux.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 k(t){const e=(t.split(/[?#]/,1)[0]??"").replace(/^\//,"");return e.startsWith("src/")&&/\.(?:[cm]?[jt]sx?)$/.test(e)}function j(t){const e=C(t);return e.editor==="model"?"model":e.editor==="image"?"image":e.editor==="audio"?"audio":e.editor==="data"?"json":e.editor==="environment"?"environment":e.format==="cube"?"lut":e.format==="glsl"||e.format==="vert"||e.format==="frag"?"shader":k(t)?"module":e.editor==="source"&&e.previewable?"text":"binary"}function b({documentId:t,assetPath:e,active:i=!0}){const[o,l]=f.useState(null),[c,u]=f.useState(null),y=e.split("/").pop()??e;return f.useEffect(()=>{let a=!1;l(null),u(null);const w=e.replace(/^\//,"");let d=0;async function h(){const g=++d;try{const s=`/__editor/source-file?path=${encodeURIComponent(w)}`,S=await fetch(s,{cache:"no-store"}).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.text()});!a&&g===d&&(l(S),u(null))}catch(s){!a&&g===d&&u(s instanceof Error?s.message:String(s))}}const v=$();return h(),()=>{a=!0,v()}},[e]),r.jsx(m,{documentId:t,active:i,type:"source",title:y,sections:[],status:`source · ${e}`,fill:!0,children:r.jsx("div",{style:{padding:12,height:"100%",minHeight:0,display:"flex",flexDirection:"column",gap:8},children:r.jsx("div",{style:{padding:8,flex:1,minHeight:0,display:"flex",overflow:"hidden",background:n.surface.inset,border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small},children:c!==null||o===null?r.jsx("div",{style:{fontFamily:n.typography.mono,fontSize:11,lineHeight:1.5,color:c?n.semantic.danger:n.content.muted,padding:4},children:c??"Loading…"}):r.jsx(N,{value:o,followChanges:!0,language:A(e),fontSize:11,maxHeight:"100%",ariaLabel:`Source of ${e}`})})})})}function z({documentId:t,assetPath:e,active:i}){const o=e.split("/").pop()??e;return r.jsx(m,{documentId:t,active:i,type:"source",title:o,sections:[],status:`no viewer · ${e}`,children:r.jsxs("div",{style:{padding:16,color:n.content.muted,fontSize:12},children:["No editor package in this project renders ",o,"; the file is available in the project and stays selectable and referenceable."]})})}function K({documentId:t,assetPath:e,active:i=!0}){switch(j(e)){case"model":case"environment":case"lut":case"shader":{const o=j(e);return r.jsx(x,{route:o,documentId:t,assetPath:e,displayName:e.split("/").pop()??e,active:i,whenUnregistered:r.jsx(z,{documentId:t,assetPath:e,active:i})})}case"image":return r.jsx(R,{assetPath:e});case"audio":return r.jsx(H,{assetPath:e});case"json":return r.jsx(E,{documentId:t,assetPath:e,displayName:e.split("/").pop()??e,active:i,sections:[],status:`json · ${e}`});case"module":{const o=V()?.rootPath,l=r.jsx(b,{documentId:t,assetPath:e,active:i});return o?r.jsx(x,{route:"module",documentId:t,assetPath:e,projectRoot:o,displayName:e.split("/").pop()??e,active:i,fallback:l,whenUnregistered:l}):l}case"text":return r.jsx(b,{documentId:t,assetPath:e,active:i});case"binary":return r.jsx(m,{documentId:t,active:i,type:"binary source",title:e.split("/").pop()??e,sections:[],status:`binary · ${e}`,children:r.jsxs("div",{style:{padding:16,color:n.content.muted,fontSize:12},children:[r.jsx("div",{style:{color:n.content.primary,fontWeight:600,marginBottom:6},children:e.split("/").pop()}),"This binary source is available in the project, but it has no safe in-editor renderer. Its file remains selectable and referenceable without being misidentified as another format."]})})}}export{K as SourceAssetViewer,j as sourceAssetRoute};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DHhMOs_s.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/stage-transform-tools-Bf_p8cJg.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-DmNeCiAo.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/index-CPiRKiDC.css","assets/editor-shell-store-CNt2zW0E.js","assets/output-pass-HurwNl0G.js","assets/Pass-D1MRT672.js","assets/editor-layers-DVuMw5f5.js","assets/workspace-arrangement-Dinn7b-i.js","assets/user-data-DvKLhMGu.js","assets/entity-object-B_x2FCUW.js","assets/three-contract-Dkt6PmWY.js","assets/Toolbar-BjG9vNYp.js","assets/transform-mode-request-8EAetSXS.js","assets/three-state-BIe7PFbc.js","assets/standard-viewport-dressing-8SWhTXK3.js","assets/content-bounds-wsarq3YV.js","assets/hierarchy-marks-DDtpJ7PB.js","assets/environment-Dg-YaLsA.js","assets/RoomEnvironment-BkknvS_I.js","assets/EXRLoader-CITMBvGd.js","assets/HDRLoader-BTGuGhVo.js","assets/preview-renderer-BrYNFV1p.js","assets/renderer-ownership-BovSEcLv.js","assets/live-mixers-B-bwLZ7c.js","assets/live-gesture-lock-DJbrjOqf.js","assets/three-integration-DSN-gO72.js","assets/host-hierarchy-objects-BV3WqU2w.js","assets/layered-pick-D-zS343_.js","assets/root-stacking-BEd9ZvxC.js","assets/model-thumbnail-BtcSrAMa.js","assets/studio-environment-DsQ4K1L8.js","assets/KTX2Loader-CaqVE6nY.js","assets/GLTFLoader-KeoruJgS.js","assets/BufferGeometryUtils-B22h7jo4.js","assets/object3d-document-session-registry-jcgiK59f.js","assets/component-instance-root-CL5qzF6u.js","assets/viewport-door-CVX7GCz1.js","assets/asset-preview-agZh9kpZ.js","assets/bitmap-label-Ct4k6ehY.js","assets/model-inspection-BUTTeTpS.js","assets/three-viewport-presentation-CEu9ox1U.js","assets/clip-planes-CnAI6DZn.js","assets/three-Cgvnp1Nn.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/OrbitControls-B13MKuwC.js","assets/LineSegments2-DN9pUfWA.js","assets/three.quarks.esm-C_HmSKXo.js","assets/scene-framing-B4Ynn1mk.js","assets/source-object3d-authoring-adapter-CIEoS6Tj.js","assets/three-projection-core-CSr5hmWB.js","assets/editor-presentation-activity-CqJH4G9t.js","assets/transport-strip-anvfvigR.js","assets/viewport-surface-status-DKyxV0Lz.js","assets/stage-overlay-set-i7XlbOA8.js","assets/TransientHint-Cq50MQPL.js","assets/ViewportShadingMenu-BHMlqkhF.js","assets/stage-keyboard-3K38-Hw6.js","assets/camera-authoring-DYjhU5Zp.js","assets/stage-presence-markers-CJ49-XME.js","assets/collaboration-presence-CignJxHj.js"])))=>i.map(i=>d[i]);
2
+ import{kQ as xr,ln as ur,kX as Ue,Z as as,eX as Hn,lt as Bn,_ as Je,G as zn,lu as _n,j1 as $s,bw as Ke,aM as Fe,a7 as xe,bz as Wn,bN as In,a6 as qe,lv as Nn,bP as $n,de as Gn,aL as cs,df as ls,lw as Gs,lx as Un,iX as qn,bq as mr,br as us,bs as Ze,al as Qe,er as Xn,ly as Yn,lz as Kn,a8 as Se,ak as Zn,lA as Qn,lB as Jn,lC as ei,lD as ti,lE as ri,hl as si,lF as ni,b5 as ii,lG as Us,aQ as oi,gM as ai,lH as hs,lI as ds,lJ as ps,b1 as fs,kP as ms,fC as gs,lK as ci,F as li,bu as ui,bt as vs,lL as hi,bK as di,j4 as pi,gm as ws,lM as fi,lN as mi,lO as gi,hg as vi,dI as wi,kY as bi,kO as yi,fX as Si,gg as xi,lP as bs,B as Pi,lQ as Ci,bR as ki}from"./index-DmNeCiAo.js";import{a as d}from"./jsx-runtime-DPjLkJKQ.js";import{t as gr,a as Ei}from"./three-state-BIe7PFbc.js";import{i as H,b as Mi,a as Oi,w as Ri,c as ji,s as ys}from"./standard-viewport-dressing-8SWhTXK3.js";import{r as f}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{a as vr}from"./content-bounds-wsarq3YV.js";import{EDITOR_LAYER as qs,isInEditorOwnedSubtree as Ti}from"./editor-layers-DVuMw5f5.js";import{createStandardEnvironment as Vi}from"./environment-Dg-YaLsA.js";import{a as Ai}from"./preview-renderer-BrYNFV1p.js";import{s as Xs}from"./user-data-DvKLhMGu.js";import{s as Li,a as Fi}from"./live-mixers-B-bwLZ7c.js";import{n as Di,bh as Ft,N as Ys,M as Ks,dg as Zs,df as Qs,fo as B,_ as be,d5 as wr,d9 as Hi,L as Ss,I as br,ez as Bi,dp as xs,cj as yr,em as zi,cp as _i,c0 as Wi,aO as Ii,bX as Ni,fx as Ps,bi as $i,eu as Gi,cg as we,T as Ui,ej as Js,el as en,A as qi,d7 as Xi,eW as Cs,fd as ut,e6 as ks,cm as Es}from"./three.core-3arARmh6.js";import{l as Yi,w as Ki}from"./live-gesture-lock-DJbrjOqf.js";import{v as Zi}from"./output-pass-HurwNl0G.js";import{V as Qi,a as Ji}from"./three-integration-DSN-gO72.js";import{a as De}from"./three-contract-Dkt6PmWY.js";import{d as Dt,f as eo}from"./model-inspection-BUTTeTpS.js";import{c as to,p as Lt,d as Ms,i as Os,r as ro,b as so,a as no,t as Rs,s as js,C as io,e as oo,f as ao,E as co}from"./three-viewport-presentation-CEu9ox1U.js";import{s as Sr}from"./workspace-arrangement-Dinn7b-i.js";import{a as lo,b as uo,L as ho}from"./LineSegments2-DN9pUfWA.js";import{s as po,o as fo,a as mo,b as go}from"./object3d-document-session-registry-jcgiK59f.js";import{S as vo}from"./source-object3d-authoring-adapter-CIEoS6Tj.js";import{s as wo,i as hr}from"./editor-presentation-activity-CqJH4G9t.js";import{r as Ts,c as Vs}from"./viewport-door-CVX7GCz1.js";import{T as bo}from"./transport-strip-anvfvigR.js";import{V as yo,O as So}from"./viewport-surface-status-DKyxV0Lz.js";import{t as tn}from"./editor-shell-store-CNt2zW0E.js";const rn=30;function sn(n,e,t){return n<e?e:n>t?t:n}function xo(n,e){const t=n.animations;if(t.length===0)return null;const s=new Di(n);let i=t[0];if(!i)return null;const a=o=>{s.stopAllAction();const l=s.clipAction(o);l.paused=!1,l.play(),i=o};a(i);const c=e.attach({id:n.uuid,label:n.name||i.name||"Clip",range:()=>({start:0,end:i?.duration??0,fps:rn}),seek:o=>{s.setTime(sn(o,0,i?.duration??0))},clips:()=>t.map(o=>({id:o.name,label:o.name})),setClip:o=>{const l=t.find(p=>p.name===o);l&&a(l)}});return()=>{c(),s.stopAllAction(),s.uncacheRoot(n)}}function Po(n,e){const t=Fi(n);if(!t)return null;let s=t.clips.values().next().value;if(!s)return null;const i=c=>{t.mixer.stopAllAction();const o=t.mixer.clipAction(c);o.paused=!1,o.play(),s=c};return e.attach({id:n.uuid,label:n.name||s.name||"Animation",range:()=>({start:0,end:s?.duration??0,fps:rn}),seek:c=>{t.mixer.setTime(sn(c,0,s?.duration??0))},clips:()=>[...t.clips.entries()].map(([c,o])=>({id:c,label:o.name||c})),setClip:c=>{const o=t.clips.get(c);o&&i(o)}})}function As(n,e,t={}){const s=new Map,i=()=>{const o=new Set;(typeof n=="function"?n():n)?.traverse(p=>{if(s.has(p.uuid)){o.add(p.uuid);return}const C=Po(p,e)??xo(p,e);C&&(s.set(p.uuid,C),o.add(p.uuid))});for(const[p,C]of[...s])o.has(p)||(C(),s.delete(p))};i();const a=t.rescanOnLiveMixers,c=a?Li(()=>{a()&&i()}):()=>{};return{refresh:i,dispose:()=>{c();for(const o of s.values())o();s.clear()}}}const je=()=>globalThis.performance?.now()??Date.now();function Co(n,e){return n.length===0?0:n[Math.min(n.length-1,Math.floor((n.length-1)*e))]??0}function ko(n=!1){const e=new Set,t=[],s=new Map,i=new Map,a=new Map;let c=[],o=[],l=n,p=!1,C=!1,w=0,P=0,S=0;const I=[];let z=0,M=0,k={gpuMs:null,drawCalls:0,triangles:0,geometries:0,textures:0,renderPasses:null},N={enabled:l,recording:C,fps:0,cpuMs:0,p95Ms:0,p99Ms:0,frames:[],phases:[],systems:[],components:[],render:k};function Q(){const y=t.at(-1),q=t.slice();let _;const Y=F=>(_??=q.map(Z=>Z.intervalMs).filter(Z=>Z>0).sort((Z,V)=>Z-V),Co(_,F));N={enabled:l,recording:C,fps:y?.intervalMs?1e3/y.intervalMs:0,cpuMs:y?.cpuMs??0,get p95Ms(){return Y(.95)},get p99Ms(){return Y(.99)},frames:q,phases:y?.phases??[],systems:[...i].map(([F,Z])=>({name:F,ms:Z})).sort((F,Z)=>Z.ms-F.ms),components:[...a].map(([F,Z])=>({name:F,ms:Z})).sort((F,Z)=>Z.ms-F.ms),render:k};for(const F of e)F()}return{get enabled(){return l},set enabled(y){l!==y&&(l=y,y&&!p&&(S=0),Q())},get telemetryEnabled(){return p},set telemetryEnabled(y){if(p===y)return;const q=!l&&!p;p=y,y&&q&&(S=0),Q()},get recording(){return C},startRecording(){const y=!l&&!p;l=!0,y&&(S=0),C=!0,t.length=0,Q()},stopRecording(){C=!1,Q()},clear(){t.length=0,Q()},beginFrame(){!l&&!p||(s.clear(),i.clear(),a.clear(),c=[],o=[],I.length=0,k={gpuMs:null,drawCalls:0,triangles:0,geometries:0,textures:0,renderPasses:null},P=je())},beginPhase(){l&&I.push(je())},endPhase(y){if(!l)return;const q=I.pop()??P,_=je()-q,Y=s.get(y);s.set(y,{ms:(Y?.ms??0)+_,startMs:Y?.startMs??q-P}),C&&performance.measure(`volter.phase.${y}`,{start:q,duration:_})},systemObserver:{beginSystem(){l&&(z=je())},endSystem(y,q,_){if(!l)return;const Y=je(),F=`${y} / ${q} / ${_}`;i.set(F,(i.get(F)??0)+Y-z),c.push({name:F,phase:q,startMs:z-P,ms:Y-z})}},beginComponent(){C&&(M=je())},endComponent(y,q=""){if(!C)return;const _=je();a.set(y,(a.get(y)??0)+_-M),o.push({name:y,phase:q,startMs:M-P,ms:_-M})},reportRender(y){l&&(k={gpuMs:y.gpuMs??k.gpuMs,drawCalls:k.drawCalls+y.drawCalls,triangles:k.triangles+y.triangles,geometries:k.geometries+y.geometries,textures:k.textures+y.textures,renderPasses:y.renderPasses===void 0?k.renderPasses:(k.renderPasses??0)+y.renderPasses})},endFrame(){if(!l&&!p)return;const y=je(),q=S===0?0:P-S;S=P;const _={id:++w,timestamp:y,intervalMs:q,cpuMs:y-P,phases:[...s].map(([Y,{ms:F,startMs:Z}])=>({name:Y,ms:F,startMs:Z})).sort((Y,F)=>F.ms-Y.ms),systems:c.slice(),components:o.slice(),render:{...k}};t.push(_),t.length>600&&t.splice(0,t.length-600),C&&performance.measure("volter.frame",{start:P,duration:_.cpuMs}),Q()},subscribe(y){return e.add(y),()=>{e.delete(y)}},getSnapshot(){return N},exportJSON(){return JSON.stringify({version:2,capturedAt:new Date().toISOString(),frames:t},null,2)}}}class Eo extends Ft{constructor(e,t){super(),this.bones=e;const s=new Set;for(const o of e){const l=o.parent;l?.isBone&&this.addSegment(l,o,s);for(const p of o.children)p.isBone&&this.addSegment(o,p,s)}this.linePositions=new Float32Array(Math.max(this.segments.length*6,6));const i=new lo;i.setPositions(this.linePositions),this.lineMaterial=new uo({color:t,linewidth:5,worldUnits:!1,depthTest:!1,depthWrite:!1,toneMapped:!1,alphaToCoverage:!0}),this.lines=new ho(i,this.lineMaterial),this.lines.onBeforeRender=o=>{o.getSize(this.lineMaterial.resolution)},this.lines.frustumCulled=!1,this.lines.renderOrder=1001,this.add(this.lines),this.pointPositions=new Float32Array(Math.max(e.length*3,3));const a=new Ys;a.setAttribute("position",new Ks(this.pointPositions,3));const c=new Zs({color:t,size:11,sizeAttenuation:!1,depthTest:!1,depthWrite:!1,toneMapped:!1});this.points=new Qs(a,c),this.points.frustumCulled=!1,this.points.renderOrder=1002,this.add(this.points),this.name="__object3d_document_bone_selection",Sr(this,"editorHelper",!0),this.traverse(o=>o.layers.set(qs)),this.update()}segments=[];linePositions;pointPositions;lines;lineMaterial;points;worldPosition=new B;setColor(e){this.lineMaterial.color.setHex(e),this.points.material.color.setHex(e)}update(){let e=0;for(const[i,a]of this.segments)i.getWorldPosition(this.worldPosition),this.linePositions.set(this.worldPosition.toArray(),e),a.getWorldPosition(this.worldPosition),this.linePositions.set(this.worldPosition.toArray(),e+3),e+=6;const t=this.lines.geometry.getAttribute("instanceStart");t&&(t.data.needsUpdate=!0),e=0;for(const i of this.bones)i.getWorldPosition(this.worldPosition),this.pointPositions.set(this.worldPosition.toArray(),e),e+=3;const s=this.points.geometry.getAttribute("position");s&&(s.needsUpdate=!0)}dispose(){this.lines.geometry.dispose(),this.lineMaterial.dispose(),this.points.geometry.dispose(),this.points.material.dispose()}addSegment(e,t,s){const i=`${e.uuid}:${t.uuid}`;s.has(i)||(s.add(i),this.segments.push([e,t]))}}const Mo="skeletons",dr=new be(58879),pr=new be(16756736);function Oo(n){const e=n.geometry.getAttribute("color");for(let s=0;s<e.count;s+=2)e.setXYZ(s,dr.r,dr.g,dr.b),s+1<e.count&&e.setXYZ(s+1,pr.r,pr.g,pr.b);e.needsUpdate=!0,n.renderOrder=999;const t=n.material;t.depthTest=!1,t.depthWrite=!1,t.toneMapped=!1,Sr(n,"editorHelper",!0),Sr(n,"editorHelperType",Mo),n.traverse(s=>s.layers.set(qs))}const Ro=1,jo=700,To=.001,Vo=Math.PI-.001,Ao=n=>n<.5?4*n*n*n:1-(-2*n+2)**3/2,Lo=n=>n;function Xe(n,e){return typeof n=="number"&&Number.isFinite(n)?n:e}const Ls={mode:"solid",background:"neutral",projection:"perspective",skeleton:!1,bounds:!1},Fs=1119773;class Fo{constructor(e,t,s,i,a,c,o=new be(2106410),l=null){this.documentId=e,this.root=t,this.scene=s,this.renderer=i,this.viewport=a,this.authoring=c,this.neutralBackground=o,this.frameBox=l,this.unsubscribeSelectionTheme=xr(i.domElement,this.syncSelectionTheme),a.orbitControls.addEventListener("start",this.cancelLookForHuman),this.unsubscribeRotateStart=a.onRotateStart(this.autoPerspective),this.unsubscribeAxisView=a.onAxisView(this.axisView)}profiler=ko();shading=new Qi;helpers=[];skeletonHelper=null;boundsHelper=null;boneSelectionHighlight=null;boneSelectionSignature="";composer=null;composerLoading=!1;disposed=!1;sceneRenderPass=null;selectionOutline=null;selectionOutlinePass=null;selectedObjects=[];selectionOrigins=null;renderWidth=1;renderHeight=1;orthographicCamera=new wr;captureAspect=null;cameraOverride=null;cameraViewSource=null;through=null;leaving=!1;viewMemo=null;throughPerspective=new Hi;throughOrthographic=new wr;beforeRender=null;state=Ls;version=0;listeners=new Set;unsubscribeSelectionTheme=()=>{};flight=null;flightPose=new B;topologyOverlay=null;topologyFollowers=[];unsubscribeRotateStart;unsubscribeAxisView;axisView=()=>(this.leaveCameraView(!1),this.settleFlight("superseded"),ur().autoPerspective&&this.setProjection("orthographic"),!0);autoPerspective=()=>{if(!ur().autoPerspective||this.cameraView()!==null||this.state.projection!=="orthographic")return;const e=this.viewport.camera,t=e.position.clone().sub(this.viewport.orbitControls.target),s=new B(0,1,0).applyQuaternion(e.quaternion);Dt(t,s)!==null&&this.setProjection("perspective")};replaceContent(e,t){H(),this.selectionOutline?.selection.clear(),this.selectedObjects=[],this.boneSelectionSignature="",this.clearBoneSelectionHighlight(),this.clearSkeletonHelper(),this.clearBoundsHelper(),this.clearTopologyOverlay(),this.root=e,this.authoring=t,this.state.mode==="wireframe"&&this.buildTopologyOverlay(),this.state.bounds&&(this.boundsHelper=new Ss(e,16757844),this.addHelper(this.boundsHelper,"bounds")),this.syncSelectionPresentation(),this.refreshSkeletonHelper(),this.notify()}cancelLookForHuman=()=>{this.settleFlight("human")};selectionColors=null;syncSelectionTheme=()=>{this.selectionColors=Ue(this.renderer.domElement);const e=this.selectionColors.visible;this.selectionOutline&&to(this.selectionOutline,Ue(this.renderer.domElement)),this.boneSelectionHighlight?.setColor(e)};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.version;presentation(){return this.state}resolveFrameBounds(e="selection"){const t=e==="all"?[]:this.authoring?.selection?.get()??[];if(t.length>0){const s=new br;let i=!1;for(const a of t){const c=this.authoring?De(this.authoring.hierarchy,a):null;if(!c)continue;const o=vr(c);o.isEmpty()||(s.union(o),i=!0)}if(i)return s}return this.frameBox&&!this.frameBox.isEmpty()?this.frameBox:vr(this.root)}frame(e=1,t="selection"){this.leaveCameraView(!1);const s=this.resolveFrameBounds(t);if(s.isEmpty()){let l=0,p=0;return this.root.traverse(C=>{const w=C.geometry;w&&(l+=1,p+=w.getAttribute("position")?.count??0)}),as.warn(`frame: nothing to frame — root "${this.root.name}" (${this.root.children.length} children, ${l} meshes, ${p} positions), selection ${JSON.stringify(this.authoring?.selection?.get()??[])}, frameBox ${this.frameBox?this.frameBox.isEmpty()?"empty":"set":"none"}`,"document"),!1}this.settleFlight("superseded");const i=s.getCenter(new B),a=this.viewport.camera.position.clone().sub(this.viewport.orbitControls.target).normalize();a.lengthSq()===0&&a.set(.8,.5,-1).normalize();const c=Math.min(10,Math.max(.1,Xe(e,1))),o=Lt(s,this.viewport.camera,a)*c;return this.viewport.setPose(i.clone().addScaledVector(a,o),i),!0}orbit(e){return this.launchFlight(Xe(e.azimuth,0),Xe(e.elevation,0),Math.min(60,Math.max(0,Xe(e.duration,.6))),Ao)}turntable(e){const t=Xe(e.revolutions,1);return this.launchFlight(t*Math.PI*2,0,Math.min(60,Math.max(0,Xe(e.seconds,6))),Lo)}looking(){return this.flight!==null}launchFlight(e,t,s,i){this.settleFlight("superseded");const a=this.viewport.camera,c=this.viewport.orbitControls.target.clone(),o=new Bi().setFromVector3(a.position.clone().sub(c)),l=o.radius>1e-4?o.radius:Math.max(this.resolveFrameBounds().getSize(new B).length(),1),p={pivot:c,radius:l,startTheta:o.theta,startPhi:o.phi,deltaTheta:e,deltaPhi:-t,duration:s,ease:i,elapsed:0,theta:o.theta,phi:o.phi,settle:null};this.flight=p;const C=new Promise(w=>{p.settle=w});return this.applyFlightPose(p,0),s<=0&&this.settleFlight(null),C}applyFlightPose(e,t){const s=e.ease(t);e.theta=e.startTheta+e.deltaTheta*s,e.phi=Math.min(Vo,Math.max(To,e.startPhi+e.deltaPhi*s));const i=this.viewport.camera;i.position.setFromSphericalCoords(e.radius,e.phi,e.theta).add(e.pivot),this.viewport.orbitControls.target.copy(e.pivot),i.lookAt(e.pivot),i.updateMatrixWorld(),this.flightPose.copy(i.position)}advanceLook(e){const t=this.flight;if(!t)return;const s=Math.max(1e-4,t.radius*.001);if(this.viewport.camera.position.distanceToSquared(this.flightPose)>s*s){this.settleFlight("human");return}e>0&&Number.isFinite(e)&&(t.elapsed+=e);const i=t.duration<=0?1:Math.min(1,t.elapsed/t.duration);this.applyFlightPose(t,i),i>=1&&this.settleFlight(null)}settleFlight(e){const t=this.flight;if(!t)return;this.flight=null;const s={completed:e===null,azimuth:t.theta,elevation:Math.PI/2-t.phi,seconds:Math.min(t.elapsed,t.duration)};t.settle?.(e===null?s:{...s,cancelledBy:e})}select(e){H(),this.authoring&&Hn(this.authoring,[...e])}selection(){return[...this.authoring?.selection?.get()??[]]}idForObject(e){return this.authoring?.hierarchy.idForObject3D?.(e)??null}syncSelectionPresentation(){H();const e=(this.authoring?.selection?.get()??[]).map(i=>this.authoring?De(this.authoring.hierarchy,i):null).filter(i=>i!==null);if(this.selectedObjects=e,this.selectionOutline&&(Ms(this.selectionOutline,this.selectionOutlineWanted?e:[]),this.syncComposerOutput()),this.selectionOrigins){const i=Ue(this.renderer.domElement);this.selectionOrigins.update(e,{visible:i.visible,...i.active?{active:i.active.visible}:{}})}const t=e.filter(i=>!!i.isBone),s=t.map(i=>i.uuid).join("\0");s!==this.boneSelectionSignature&&(this.boneSelectionSignature=s,this.clearBoneSelectionHighlight(),t.length>0&&(this.boneSelectionHighlight=new Eo(t,Ue(this.renderer.domElement).visible),this.scene.add(this.boneSelectionHighlight)),this.refreshSkeletonHelper())}frameSelection(){return this.frameIds(this.authoring?.selection?.get()??[])}frameIds(e){this.leaveCameraView(!1),this.settleFlight("superseded");const t=e.map(s=>this.authoring?De(this.authoring.hierarchy,s):null).filter(s=>s!==null);return t.length===0?!1:t.every(s=>s.isBone)?(this.frameBones(t),!0):(this.viewport.focusOnMultiple(t),!0)}setViewPreset(e,t="bounds"){H(),this.leaveCameraView(!1),this.settleFlight("superseded");const s=eo(e);let i,a;if(t==="view")i=this.viewport.orbitControls.target.clone(),a=this.viewport.camera.position.distanceTo(i);else{const l=this.resolveFrameBounds();if(l.isEmpty())return;i=l.getCenter(new B),a=Lt(l,this.viewport.camera,s)}const c=i.clone().addScaledVector(s,a),o=e==="top"?{x:0,y:0,z:-1}:e==="bottom"?{x:0,y:0,z:1}:{x:0,y:1,z:0};this.viewport.setPose(c,i,void 0,o),this.setProjection(e==="isometric"?"perspective":"orthographic")}setCameraPose(e,t,s){H(),this.leaveCameraView(!1),this.settleFlight("superseded"),this.viewport.setPose(e,t,s)}cameraPose(){return{position:this.viewport.camera.position.toArray(),target:this.viewport.orbitControls.target.toArray(),fov:this.viewport.camera.fov}}camera(){if(this.cameraOverride)return this.cameraOverride;const e=this.drawnCamera();return this.viewport.setGizmoCamera(e===this.viewport.camera?null:e),e}drawnCamera(){const e=this.through?this.cameraView():null;return e?this.throughCamera(e):(this.through&&!this.leaving&&(this.leaving=!0,queueMicrotask(()=>{this.leaving=!1,this.through&&!this.cameraView()&&this.leaveCameraView(!1)})),this.state.projection==="perspective"?this.viewport.camera:(this.syncOrthographicCamera(),this.orthographicCamera))}setCameraViewSource(e){this.cameraViewSource!==e&&(this.cameraViewSource=e,e||this.leaveCameraView(!1),this.notify())}hasCameraView(){return this.cameraViewSource!==null}cameraView(){const e=this.through,t=this.cameraViewSource;if(!e||!t)return null;const s=this.renderer.domElement,i=this.captureAspect?{width:this.captureAspect,height:1}:{width:s.clientWidth,height:s.clientHeight},a=this.viewport.camera,c=e.locked?`${a.position.toArray().join(",")}|${a.quaternion.toArray().join(",")}`:"",o=`${e.camera}|${i.width}|${i.height}|${e.zoom}|${e.offset.join(",")}|${c}`;if(this.viewMemo?.key===o)return this.viewMemo.view;const l=t.view(e.camera,i,e.zoom,e.offset),p=l&&e.locked?{...l,position:a.position.toArray(),quaternion:a.quaternion.toArray()}:l;return this.viewMemo={key:o,view:p},queueMicrotask(()=>{this.viewMemo=null}),p}toggleCameraView(){if(this.through)return this.leaveCameraView(!0),!0;const e=this.cameraViewSource,t=e?.camera()??null;if(!e)return!1;if(t===null)return as.warn("camera view: No active camera — the scene has no camera to look through","document"),!1;H(),this.settleFlight("superseded");const s=this.viewport,i=s.orbitControls,a=i.enableDamping;return i.enableDamping=!1,i.update(),i.enableDamping=a,this.through={camera:t,zoom:e.zoom.opening,offset:[0,0],left:{position:s.camera.position.clone(),target:s.orbitControls.target.clone(),up:s.camera.up.clone(),projection:this.state.projection},release:this.captureCameraViewInput(),locked:!1},e.showing?.(t),this.notify(),!0}cameraViewLocked(){return!this.through||!this.cameraViewSource?.setPose?null:this.through.locked}toggleCameraViewLock(){const e=this.through,t=this.cameraViewSource;if(!(!e||!t?.setPose)){if(e.release(),e.locked=!e.locked,!e.locked)e.release=this.captureCameraViewInput();else{const s=this.cameraView(),i=this.viewport.orbitControls,a=this.viewport.camera;if(s){const M=new B(...s.position),k=new xs(...s.quaternion),N=e.left.position.distanceTo(e.left.target);a.up.set(0,1,0).applyQuaternion(k),a.position.copy(M),a.quaternion.copy(k),i.target.copy(M).addScaledVector(new B(0,0,-1).applyQuaternion(k),N),i.update()}const c=i.enabled;i.enabled=!0;const o=i.enableDamping;i.enableDamping=!1;const l=e.camera,p=M=>({position:a.position.toArray(),quaternion:a.quaternion.toArray(),final:M});let C=!1,w=null,P=!1;const S=M=>{if(C){w={...M,final:M.final||(w?.final??!1)};return}C=!0,w=null,Promise.resolve(t.setPose(l,M.position,M.quaternion,M.final)).catch(()=>{}).finally(()=>{C=!1,w&&S(w)})},I=()=>{P=!0,H(),this.notify(),S(p(!1))},z=()=>{P&&(P=!1,S(p(!0)))};i.addEventListener("change",I),i.addEventListener("end",z),e.release=()=>{z(),i.removeEventListener("change",I),i.removeEventListener("end",z),i.enabled=c,i.enableDamping=o}}this.viewMemo=null,H(),this.notify()}}cameraViewZoom(){return this.through?.zoom??null}setCameraViewZoom(e){const t=this.through,s=this.cameraViewSource;!t||!s||!Number.isFinite(e)||e<=0||(t.zoom=Math.min(s.zoom.max,Math.max(s.zoom.min,e)),H(),this.notify())}zoomCameraView(e){this.through&&this.setCameraViewZoom(this.through.zoom*e)}panCameraView(e,t){const s=this.through,i=this.cameraViewSource;if(!s||!i)return;const[a,c]=i.pan(s.offset,s.zoom,e,t);s.offset=[a,c],H(),this.notify()}leaveCameraView(e){const t=this.through;if(!t)return;const s=this.cameraView();t.release(),this.through=null,this.viewMemo=null,this.cameraViewSource?.showing?.(null),this.viewport.setGizmoCamera(null);const i=this.viewport;if(e)i.camera.position.copy(t.left.position),i.camera.up.copy(t.left.up),i.orbitControls.target.copy(t.left.target),this.state={...this.state,projection:t.left.projection};else if(s){const a=t.left.position.distanceTo(t.left.target),c=new B(...s.position),o=new xs(...s.quaternion),l=new B(0,0,-1).applyQuaternion(o);i.camera.up.set(0,1,0).applyQuaternion(o),i.camera.position.copy(c),i.orbitControls.target.copy(c).addScaledVector(l,a);const p=Dt(t.left.position.clone().sub(t.left.target),t.left.up)!==null,C=ur().autoPerspective&&p?"perspective":t.left.projection;this.state={...this.state,projection:C}}i.camera.lookAt(i.orbitControls.target),i.orbitControls.update(),H(),this.notify()}throughCamera(e){const{left:t,right:s,top:i,bottom:a}=e.window,c=this.viewport.camera.layers.mask;if(e.projection==="orthographic"){const l=this.throughOrthographic;return Object.assign(l,{left:t,right:s,top:i,bottom:a,near:e.near,far:e.far,zoom:1}),l.position.set(...e.position),l.quaternion.set(...e.quaternion),l.layers.mask=c,l.updateProjectionMatrix(),l.updateMatrixWorld(!0),l}const o=this.throughPerspective;return o.near=e.near,o.far=e.far,o.fov=yr.radToDeg(2*Math.atan((i-a)/2)),o.aspect=(s-t)/(i-a),o.zoom=1,o.position.set(...e.position),o.quaternion.set(...e.quaternion),o.layers.mask=c,o.projectionMatrix.makePerspective(t*e.near,s*e.near,i*e.near,a*e.near,e.near,e.far),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.updateMatrixWorld(!0),o}captureCameraViewInput(){const e=this.viewport.orbitControls,t=this.renderer.domElement,s=t.parentElement??t,i=e.enabled;e.enabled=!1;const a=o=>{o.target!==t||o.deltaY===0||(o.preventDefault(),this.zoomCameraView(o.deltaY<0?1.2:1/1.2))},c=o=>{if(o.target!==t)return;const l=e.mouseButtons;let p=[l.LEFT,l.MIDDLE,l.RIGHT][o.button]??null;const C=o.ctrlKey||o.metaKey||o.shiftKey;if(o.button===1&&(o.ctrlKey||o.metaKey)&&p===we.ROTATE?p=we.DOLLY:C&&p===we.ROTATE?p=we.PAN:C&&p===we.PAN&&(p=we.ROTATE),p===we.ROTATE){this.leaveCameraView(!1);return}if(p!==we.PAN&&p!==we.DOLLY)return;o.preventDefault();const w=t.getBoundingClientRect();let P=o.clientX,S=o.clientY;const I=this.through?.zoom??1,z=Math.max(5+o.clientY-w.top,1),M=N=>{if(p===we.PAN){this.panCameraView((N.clientX-P)/Math.max(w.width,1),(N.clientY-S)/Math.max(w.height,1)),P=N.clientX,S=N.clientY;return}const Q=Math.max(.01,2*((5+N.clientY-w.top)/z-1)+1);this.setCameraViewZoom(I/Q)},k=()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k)};window.addEventListener("pointermove",M),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k)};return s.addEventListener("wheel",a,{capture:!0,passive:!1}),s.addEventListener("pointerdown",c,{capture:!0}),()=>{s.removeEventListener("wheel",a,{capture:!0}),s.removeEventListener("pointerdown",c,{capture:!0}),e.enabled=i}}projection(){return this.state.projection}setProjection(e){H(),this.state.projection!==e&&(this.state={...this.state,projection:e},this.notify())}setMode(e){H(),this.state.mode!==e&&(this.clearDiagnosticPresentation(),this.state={...this.state,mode:e},e==="uv"?this.scene.overrideMaterial=new zi({vertexShader:"varying vec2 vUv; void main(){ vUv=uv; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }",fragmentShader:"varying vec2 vUv; void main(){ gl_FragColor=vec4(vUv,0.0,1.0); }"}):e==="vertex-colors"?this.scene.overrideMaterial=new _i({vertexColors:!0}):e==="wireframe"&&this.buildTopologyOverlay(),this.notify())}buildTopologyOverlay(){const e=new Ft,t=[];this.root.updateMatrixWorld(!0),this.root.traverse(s=>{const i=s;if(!i.isMesh||!i.geometry)return;const a=new Wi(new Ii(i.geometry,Ro),new Ni({color:Fs,toneMapped:!1,transparent:!0,opacity:.85,depthTest:!1,depthWrite:!1}));a.matrixAutoUpdate=!1,a.matrixWorldAutoUpdate=!1,a.matrixWorld.copy(i.matrixWorld),a.frustumCulled=!1,a.renderOrder=2,e.add(a),t.push({line:a,source:i})}),t.length!==0&&(this.topologyOverlay=e,this.topologyFollowers=t,this.addHelper(e,"topology"))}syncTopologyOverlay(){this.topologyFollowers.some(({source:i})=>i.parent===null)&&(this.clearTopologyOverlay(),this.buildTopologyOverlay()),this.selectionColors??=Ue(this.renderer.domElement);const e=this.selectionColors,t=this.selectedObjects.at(-1)??null,s=(i,a)=>{for(let c=i;c;c=c.parent)if(c===a)return!0;return!1};for(const{line:i,source:a}of this.topologyFollowers){i.matrixWorld.copy(a.matrixWorld),i.visible=a.visible;const c=i.material,o=t!==null&&s(a,t),l=o||this.selectedObjects.some(C=>s(a,C)),p=o?e.active?.visible??e.visible:l?e.visible:null;c.color.setHex(p??Fs)}}clearTopologyOverlay(){for(const{line:s}of this.topologyFollowers.splice(0))s.geometry.dispose(),s.material.dispose();const e=this.topologyOverlay;if(this.topologyOverlay=null,!e)return;e.removeFromParent();const t=this.helpers.indexOf(e);t>=0&&this.helpers.splice(t,1)}setBounds(e){H(),this.state.bounds!==e&&(this.state={...this.state,bounds:e},e?(this.boundsHelper=new Ss(this.root,16757844),this.addHelper(this.boundsHelper,"bounds")):this.clearBoundsHelper(),this.notify())}setSkeleton(e){H(),this.state.skeleton!==e&&(this.state={...this.state,skeleton:e},this.refreshSkeletonHelper(),this.notify())}neutralBackgroundTexture(){return this.neutralBackground}setNeutralBackground(e){H();const t=this.scene.background,s=this.neutralBackground,i=t===s||t instanceof be&&s instanceof be&&t.equals(s);this.neutralBackground=e,i&&(this.scene.background=e)}setBackground(e){H(),this.state.background!==e&&(this.scene.background=e==="transparent"?null:this.neutralBackground,this.state={...this.state,background:e},this.notify())}resetPresentation(){H(),Bn(this.documentId),this.clearDiagnosticPresentation(),this.state=Ls,this.refreshSkeletonHelper(),this.clearBoundsHelper(),this.scene.background=this.neutralBackground,this.viewport.camera.up.set(0,1,0),this.frame(),this.notify()}setBeforeRender(e){this.beforeRender=e}presentedFrameWaiters=[];presentsFrames=!1;setPresentsFrames(e){this.presentsFrames=e,e||this.resolvePresentedFrame(null)}requestPresentedFrame(){return this.presentsFrames?new Promise(e=>{let t=!1;const s=i=>{t||(t=!0,e(i))};this.presentedFrameWaiters.push(s),H(),setTimeout(()=>s(null),jo)}):Promise.resolve(null)}needsFrame(){return this.flight!==null||this.presentedFrameWaiters.length>0}servePresentedFrame(){if(this.presentedFrameWaiters.length===0)return;const e=this.renderer.domElement,t=document.createElement("canvas");t.width=Math.max(1,e.width),t.height=Math.max(1,e.height);const s=t.getContext("2d");if(!s){this.resolvePresentedFrame(null);return}s.drawImage(e,0,0),this.resolvePresentedFrame(t)}resolvePresentedFrame(e){const t=this.presentedFrameWaiters;this.presentedFrameWaiters=[];for(const s of t)s(e)}render(e){const t=this.beforeRender?.();try{this.boneSelectionHighlight?.update();const s=this.camera(),i=this.state.mode;if(this.boundsHelper?.update(),this.selectionOrigins?.place(),i==="uv"||i==="vertex-colors"){e(s);return}if(i==="wireframe"&&this.topologyOverlay){if(this.syncTopologyOverlay(),this.xray.enabled&&this.xray.alpha<=0){const a=new Set;this.root.traverse(c=>{const o=c;if(o.isMesh)for(const l of Array.isArray(o.material)?o.material:[o.material])l?.visible&&(l.visible=!1,a.add(l))});try{e(s)}finally{for(const c of a)c.visible=!0}return}this.shading.render(this.scene,"clay",()=>e(s),Os);return}this.shading.render(this.scene,i,()=>e(s),Os)}finally{t?.()}}renderViewport(e=0){this.advanceLook(e),this.ensureComposer(),this.render(t=>{const s=this.composer;if(!s){this.renderer.render(this.scene,t);return}s.setMainScene(this.scene),s.setMainCamera(t),s.render(e)})}resize(e,t){H(),this.renderWidth=Math.max(1,e),this.renderHeight=Math.max(1,t),this.composer?.setSize(this.renderWidth,this.renderHeight)}renderCapture(e,t){this.render(s=>{if(!t){e(s);return}const i=this.scene.background,a=this.renderer.getClearColor(new be),c=this.renderer.getClearAlpha();try{this.scene.background=null,this.renderer.setClearColor(0,0),e(s)}finally{this.scene.background=i,this.renderer.setClearColor(a,c)}})}captureImage(e=512){const t=typeof e=="number"?e:e.width,s=typeof e=="number"?e:e.height;if(!Number.isFinite(t)||t<1||!Number.isFinite(s)||s<1)return null;const i=Math.min(2048,Math.round(t)),a=Math.min(2048,Math.round(s)),c=i*2,o=a*2,l=new Ps(c,o,{type:$i}),p=new Ps(c,o),C=this.renderer.getRenderTarget(),w=this.renderer.getPixelRatio(),P=this.viewport.camera,S=P.aspect;try{this.captureAspect=i/a;const I=typeof e=="number"?void 0:e.camera;I?this.cameraOverride=I:(P.aspect=i/a,P.updateProjectionMatrix()),this.renderer.setPixelRatio(1),this.renderer.setRenderTarget(l),this.renderCapture(_=>this.renderSolidForCapture(_,l,c,o),typeof e!="number"&&e.transparent===!0),Zi(typeof e!="number"&&e.transparent===!0).render(this.renderer,p,l,0,!1);const z=c*4,M=new Uint8Array(z*o);this.renderer.readRenderTargetPixels(p,0,0,c,o,M);const k=document.createElement("canvas");k.width=c,k.height=o;const N=k.getContext("2d");if(!N)return null;const Q=N.createImageData(c,o);for(let _=0;_<o;_++){const Y=(o-1-_)*z,F=_*z;Q.data.set(M.subarray(Y,Y+z),F)}N.putImageData(Q,0,0);const y=document.createElement("canvas");y.width=i,y.height=a;const q=y.getContext("2d");return q?(q.drawImage(k,0,0,i,a),y.toDataURL("image/png")):null}finally{this.captureAspect=null,this.cameraOverride=null,P.aspect=S,P.updateProjectionMatrix(),this.renderer.setRenderTarget(C),this.renderer.setPixelRatio(w),this.composer?.setSize(this.renderWidth,this.renderHeight,!1),p.dispose(),l.dispose(),H()}}dispose(){this.disposed=!0,this.leaveCameraView(!1),this.selectionOrigins?.dispose(),this.selectionOrigins=null,this.settleFlight("closed"),this.viewport.orbitControls.removeEventListener("start",this.cancelLookForHuman),this.unsubscribeRotateStart(),this.unsubscribeAxisView(),this.unsubscribeSelectionTheme(),this.clearDiagnosticPresentation(),this.clearBoneSelectionHighlight(),this.clearBoundsHelper(),this.clearSkeletonHelper(),this.selectionOutline&&ro(this.renderer,this.selectionOutline,this.selectionOutlinePass),this.composer?.dispose(),this.sceneRenderPass=null,this.selectionOutline=null,this.selectionOutlinePass=null,this.composer=null,this.shading.dispose(),this.listeners.clear()}addHelper(e,t){e.name=`__object3d_document_${t}`,Xs(e,"editorHelper",!0),this.scene.add(e),this.helpers.push(e)}get selectionOutlineEnabled(){return this.selectionOutlineWanted}set selectionOutlineEnabled(e){e!==this.selectionOutlineWanted&&(this.selectionOutlineWanted=e,e?this.syncSelectionPresentation():(this.selectionOutline?.selection.clear(),this.syncComposerOutput()))}selectionOutlineWanted=!0;xray={enabled:!1,alpha:1};setXray(e){this.xray.enabled===e.enabled&&this.xray.alpha===e.alpha||(this.xray=e,H())}set selectionOriginsEnabled(e){e!==(this.selectionOrigins!==null)&&(e?(this.selectionOrigins=new Bo,this.scene.add(this.selectionOrigins),this.syncSelectionPresentation()):(this.selectionOrigins?.dispose(),this.selectionOrigins=null,H()))}ensureComposer(){this.selectionOutlineWanted&&(this.composer||this.composerLoading||this.disposed||(this.composerLoading=!0,Je(()=>import("./index-DHhMOs_s.js"),__vite__mapDeps([0,1,2])).then(e=>{if(this.composerLoading=!1,this.disposed||this.composer)return;const t=this.camera(),s=new e.EffectComposer(this.renderer);this.sceneRenderPass=new e.RenderPass(this.scene,t),s.addPass(this.sceneRenderPass),this.selectionOutline=so(e,this.renderer,this.scene,t,Ue(this.renderer.domElement)),this.syncSelectionTheme(),Ms(this.selectionOutline,this.selectedObjects),this.selectionOutlinePass=new e.EffectPass(t,this.selectionOutline),s.addPass(this.selectionOutlinePass),this.composer=s,this.syncComposerOutput(),s.setSize(this.renderWidth,this.renderHeight),H()}).catch(()=>{this.composerLoading=!1})))}renderSolidForCapture(e,t,s,i){const a=this.composer,c=(this.selectionOutline?.selection.size??0)>0;if(!a||!c||!this.sceneRenderPass||!this.selectionOutlinePass){this.renderer.render(this.scene,e);return}const o=this.renderWidth,l=this.renderHeight;try{this.sceneRenderPass.renderToScreen=!1,this.selectionOutlinePass.renderToScreen=!1,a.setSize(s,i,!1),this.sceneRenderPass.render(this.renderer,a.inputBuffer,a.outputBuffer,0),this.selectionOutlinePass.render(this.renderer,a.inputBuffer,t,0)}finally{a.setSize(o,l,!1),this.syncComposerOutput(),this.renderer.setRenderTarget(t)}}syncComposerOutput(){const e=(this.selectionOutline?.selection.size??0)>0;this.sceneRenderPass&&(this.sceneRenderPass.renderToScreen=!e),this.selectionOutlinePass&&(this.selectionOutlinePass.enabled=e,this.selectionOutlinePass.renderToScreen=e)}refreshSkeletonHelper(){const e=this.state.skeleton||this.boneSelectionHighlight!==null;e&&!this.skeletonHelper?(this.skeletonHelper=new Gi(this.root),Oo(this.skeletonHelper),this.scene.add(this.skeletonHelper)):e||this.clearSkeletonHelper()}clearSkeletonHelper(){this.skeletonHelper&&(this.skeletonHelper.removeFromParent(),this.skeletonHelper.dispose(),this.skeletonHelper=null)}clearBoneSelectionHighlight(){this.boneSelectionHighlight&&(this.boneSelectionHighlight.removeFromParent(),this.boneSelectionHighlight.dispose(),this.boneSelectionHighlight=null)}clearBoundsHelper(){if(!this.boundsHelper)return;const e=this.boundsHelper;this.boundsHelper=null;const t=this.helpers.indexOf(e);t>=0&&this.helpers.splice(t,1),e.removeFromParent(),e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(s=>{s.dispose()}):e.material.dispose()}frameBones(e){const t=new br,s=new B;for(const l of e){t.expandByPoint(l.getWorldPosition(s)),l.parent?.isBone&&t.expandByPoint(l.parent.getWorldPosition(s));for(const p of l.children)p.isBone&&t.expandByPoint(p.getWorldPosition(s))}const i=t.getCenter(new B),a=Math.max(t.getSize(new B).length(),.2);t.expandByScalar(a*.35);const c=this.viewport.camera.position.clone().sub(this.viewport.orbitControls.target).normalize(),o=Lt(t,this.viewport.camera,c);this.viewport.setPose(i.clone().addScaledVector(c,o),i)}syncOrthographicCamera(){const e=this.viewport.camera,t=this.viewport.orbitControls.target,s=Math.max(e.position.distanceTo(t),.001),i=Math.max(s*Math.tan(yr.degToRad(e.fov)/2),.001),a=Math.max(this.renderer.domElement.clientWidth,1),c=Math.max(this.renderer.domElement.clientHeight,1),o=this.captureAspect??a/c;this.orthographicCamera.left=-i*o,this.orthographicCamera.right=i*o,this.orthographicCamera.top=i,this.orthographicCamera.bottom=-i,this.orthographicCamera.near=e.near,this.orthographicCamera.far=e.far,this.orthographicCamera.position.copy(e.position),this.orthographicCamera.quaternion.copy(e.quaternion),this.orthographicCamera.up.copy(e.up),this.orthographicCamera.layers.mask=e.layers.mask,this.orthographicCamera.updateProjectionMatrix(),this.orthographicCamera.updateMatrixWorld(!0)}clearDiagnosticPresentation(){this.clearTopologyOverlay(),this.scene.overrideMaterial?.dispose(),this.scene.overrideMaterial=null;for(const e of this.helpers.splice(0)){e.removeFromParent();const t=e;t.geometry?.dispose();const s=t.material;Array.isArray(s)?s.forEach(i=>{i.dispose()}):s?.dispose()}}notify(){this.version++;for(const e of this.listeners)e()}}const Do=7;let ht=null;function Ho(){if(ht)return ht;const n=64,e=document.createElement("canvas");e.width=n,e.height=n;const t=e.getContext("2d");return t.beginPath(),t.arc(n/2,n/2,n/2-1,0,Math.PI*2),t.fillStyle="rgba(0, 0, 0, 0.75)",t.fill(),t.beginPath(),t.arc(n/2,n/2,n/2-8,0,Math.PI*2),t.fillStyle="#ffffff",t.fill(),ht=new Ui(e),ht.colorSpace=Js,ht}class Bo extends Qs{objects=[];origin=new B;constructor(){super(new Ys,new Zs({map:Ho(),size:Do,sizeAttenuation:!1,transparent:!0,alphaTest:.05,depthTest:!1,depthWrite:!1,toneMapped:!1})),this.name="volter:selection-origins",this.userData.editorHelper=!0,this.renderOrder=1e3,this.frustumCulled=!1,this.raycast=()=>{}}update(e,t){this.objects=e,this.material.color.setHex(e.length===1&&t.active!==void 0?t.active:t.visible),this.visible=e.length>0}place(){const e=this.objects.length;let t=this.geometry.getAttribute("position");(t===void 0||t.count<e)&&(this.geometry.dispose(),t=new Ks(new Float32Array(Math.max(e,8)*3),3),this.geometry.setAttribute("position",t)),this.geometry.setDrawRange(0,e),this.objects.forEach((s,i)=>{s.getWorldPosition(this.origin),t.setXYZ(i,this.origin.x,this.origin.y,this.origin.z)}),t.needsUpdate=!0}dispose(){this.removeFromParent(),this.geometry.dispose(),this.material.dispose()}}class zo{constructor(e){this.options=e}active=null;settling=!1;idleWaiters=new Set;begin(e){if(this.active||this.settling)return!1;try{const t=this.options.begin(e);return t?(this.active={pointerId:e.pointerId,gesture:t},!0):!1}catch(t){return this.options.reportError(t),!1}}update(e){if(!(!this.active||this.active.pointerId!==e.pointerId))try{this.active.gesture.update(e)}catch(t){this.cancelWithError(t)}}async commit(e){const t=this.take(e.pointerId);if(!t)return!1;this.settling=!0;try{return await t.commit(e),await this.options.persist(t.label),!0}catch(s){try{await t.cancel()}catch(i){return this.options.reportError({operationError:s,rollbackError:i}),!1}return this.options.reportError(s),!1}finally{this.settling=!1;for(const s of this.idleWaiters)s();this.idleWaiters.clear()}}async cancel(e){const t=this.take(e);if(!t)return!1;this.settling=!0;try{return await t.cancel(),!0}catch(s){return this.options.reportError(s),!1}finally{this.settling=!1;for(const s of this.idleWaiters)s();this.idleWaiters.clear()}}async settle(){this.active&&await this.cancel(),this.settling&&await new Promise(e=>this.idleWaiters.add(e))}hasActiveGesture(){return this.active!==null}take(e){if(!this.active||e!==void 0&&this.active.pointerId!==e)return null;const t=this.active.gesture;return this.active=null,t}async cancelWithError(e){const t=this.take();if(t){this.settling=!0;try{await t.cancel(),this.options.reportError(e)}catch(s){this.options.reportError({operationError:e,rollbackError:s})}finally{this.settling=!1;for(const s of this.idleWaiters)s();this.idleWaiters.clear()}}}}class _o{constructor(e,t){this.frame=e,this.releaseRenderer=t,this.unsubscribeActivity=wo(()=>this.syncActivity())}rafId=0;running=!1;disposed=!1;active=!1;unsubscribeActivity;get isDisposed(){return this.disposed}get isRunning(){return this.running}setActive(e){this.disposed||(this.active=e,this.syncActivity())}syncActivity(){this.active&&hr()?this.start():this.stop()}redraw(){this.running&&!this.disposed&&hr()&&this.guardedFrame(performance.now())}dispose(){this.stop(),!this.disposed&&(this.disposed=!0,this.unsubscribeActivity(),this.releaseRenderer())}start(){this.disposed||this.running||(this.running=!0,this.guardedFrame(performance.now(),!0),!(!this.running||this.disposed)&&(this.rafId=requestAnimationFrame(this.tick)))}lastFrameFailure=null;guardedFrame(e,t=!1){try{this.frame(e,t),this.lastFrameFailure=null}catch(s){const i=s instanceof Error?s.message:String(s);i!==this.lastFrameFailure&&(this.lastFrameFailure=i,console.error("[document renderer] a frame threw; the loop continues:",s))}}stop(){this.running=!1,this.rafId!==0&&(cancelAnimationFrame(this.rafId),this.rafId=0)}tick=e=>{if(!(!this.running||this.disposed)){if(!hr()){this.stop();return}this.guardedFrame(e),!(!this.running||this.disposed)&&(this.rafId=requestAnimationFrame(this.tick))}}}const Wo=new Set(["solid","clay","unlit","wireframe","normals","overdraw"]);function Io(n,e){return{read:()=>{const t=n.cameraPose;if(!t)return null;const{position:s,target:i}=t;return{camera:{position:{x:s.x,y:s.y,z:s.z},target:{x:i.x,y:i.y,z:i.z},...t.fov?{fov:t.fov}:{}},diagnostic:n.shadingMode,grid:zn(e)}},setDiagnostic:t=>Wo.has(t)?(n.setShadingMode(t),!0):!1,setCamera:t=>typeof t!="string"?(n.shell.setCameraPose(t.position,t.target,t.fov),!0):t==="isometric"?!1:(n.shell.setViewPreset(t),!0),frame:t=>t==="document"?!1:(n.shell.focusOnSelection(),!0)}}function No(n){const e=gr();return e?_n($s(e.shell,n)):"none"}const $o=f.lazy(()=>Je(()=>import("./stage-transform-tools-Bf_p8cJg.js"),__vite__mapDeps([3,4,5,6,7,8,9,10,11,12,13,14,15,1,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63])).then(n=>({default:n.ThreeStageTransformTools}))),Go=f.lazy(()=>Je(()=>import("./stage-transform-tools-Bf_p8cJg.js"),__vite__mapDeps([3,4,5,6,7,8,9,10,11,12,13,14,15,1,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63])).then(n=>({default:n.ThreeStageTransformControls})));function Ds(n){return{transformTools:()=>No(n),TransformTools:$o,TransformControls:Go}}class Uo{constructor(e,t,s){this.create=e,this.isOpen=t,this.subscribe=s}states=new Map;generations=new WeakMap;unsubscribe=null;claim(e){const t=this.states.get(e)??[];let s=t.find(i=>!i.inUse);return s||(s=this.create(e),t.push(s),this.states.set(e,t)),s.inUse=!0,this.generations.set(s,this.generation(s)+1),this.unsubscribe??=this.subscribe(()=>this.discardClosed()),s}generation(e){return this.generations.get(e)??0}release(e,t=this.generation(e)){this.generation(e)===t&&(e.inUse=!1,queueMicrotask(()=>this.discardClosed()))}retain(e,t,s){if(!this.isOpen(e.documentId)||!this.states.get(e.documentId)?.includes(e)||this.generation(e)!==s){t.dispose();return}const i=e.source;e.source=t,i!==t&&i?.dispose()}discardClosed(){const e=[];for(const[s,i]of this.states){if(this.isOpen(s))continue;const a=i.filter(c=>c.inUse);e.push(...i.filter(c=>!c.inUse)),a.length?this.states.set(s,a):this.states.delete(s)}this.states.size===0&&(this.unsubscribe?.(),this.unsubscribe=null);const t=[];for(const s of e){const i=s.source;s.source=null;try{i?.dispose()}catch(a){t.push(a)}}if(t.length)throw new AggregateError(t,"Retained document cleanup failed")}}const qo=f.lazy(async()=>({default:(await Je(()=>import("./stage-overlay-set-i7XlbOA8.js"),__vite__mapDeps([64,4,5,7,8,6,9,10,11,12,13,45,65,66,24,14,15,1,2,16,17,18,19,20,21,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63]))).StageOverlaySet}));function Xo(n){return d.jsx(f.Suspense,{fallback:null,children:d.jsx(qo,{...n})})}function Hs(n,e,t){if(e==="orthographic"){const s=Dt(n.camera.position.clone().sub(n.orbitControls.target),new B(0,1,0).applyQuaternion(n.camera.quaternion));return s!==null?s:t==="short"?"Iso":"Orthographic"}return t==="short"?"Persp":"Perspective"}const Yo=()=>()=>{},Bs=()=>0;function Ko({shell:n,documentId:e,label:t,kebab:s=!1}){const i=f.useSyncExternalStore(no,Rs,Rs);f.useSyncExternalStore(po,fo);const a=e?mo(e):null;f.useSyncExternalStore(a?.subscribe??Yo,a?.getSnapshot??Bs,a?.getSnapshot??Bs);const c=a?a.projection():i.projection,o=P=>{a?a.setProjection(P):js(P)},[l,p]=f.useState(!1),C=f.useRef(null);f.useEffect(()=>{if(!l)return;const P=S=>{C.current?.contains(S.target)||p(!1)};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[l]);const w=P=>{if(a){a.setViewPreset(P,"view");return}js("orthographic"),n.setViewPreset(P)};return d.jsxs("div",{ref:C,className:"volter-viewport-popover-anchor",children:[t===void 0?d.jsx(Ke,{text:c==="perspective"?"Perspective":"Orthographic",children:d.jsx(Fe,{"aria-label":"Viewport views","aria-expanded":l,size:"comfortable",onClick:()=>p(P=>!P),children:d.jsx(xe,{icon:l?Wn:In,size:"md"})})}):d.jsxs(qe,{size:"comfortable",variant:"ghost","aria-label":"Viewport views","aria-expanded":l,"data-testid":"viewport-view-name",onClick:()=>p(P=>!P),children:[s?d.jsx(xe,{icon:Nn,size:"sm"}):null,t]}),l?d.jsx($n,{style:{minWidth:230},children:d.jsxs(Gn,{gap:3,children:[d.jsx(cs,{variant:"caption",tone:"muted",children:"Projection"}),d.jsxs(ls,{gap:1,children:[d.jsx(qe,{size:"compact",variant:c==="perspective"?"primary":"ghost",onClick:()=>o("perspective"),children:"Perspective"}),d.jsx(qe,{size:"compact",variant:c==="orthographic"?"primary":"ghost",onClick:()=>o("orthographic"),children:"Orthographic"})]}),d.jsx(cs,{variant:"caption",tone:"muted",children:"Axis View"}),d.jsxs(ls,{gap:1,children:[d.jsx(qe,{size:"compact",variant:"ghost",onClick:()=>w("top"),children:"Top"}),d.jsx(qe,{size:"compact",variant:"ghost",onClick:()=>w("front"),children:"Front"}),d.jsx(qe,{size:"compact",variant:"ghost",onClick:()=>w("right"),children:"Right"})]})]})}):null]})}const Zo=ao;function zs(n){return xr(null,n)}const Qo=()=>()=>{},_s=()=>0,Jo=5,ea=58;function ta(n,e){const t=e?.camera()??n.renderCamera,s=n.camera.position,i=n.orbitControls.target,a=t.isOrthographicCamera?nn(t,n,e):0;return[s.x,s.y,s.z,i.x,i.y,i.z,a].map(c=>c.toPrecision(6)).join(",")}function nn(n,e,t){const s=e.orbitControls.domElement,i=Math.max(1,t?.renderer.domElement.height??(s?.clientHeight??1)*(s?.ownerDocument.defaultView?.devicePixelRatio??1));return(n.top-n.bottom)/n.zoom/i}function ra({viewport:n,documentId:e,session:t,store:s,projection:i,displayName:a,objectName:c,statistics:o,subject:l,gridScale:p}){f.useSyncExternalStore(s.subscribe,s.getShellSnapshot??s.getSnapshot),f.useSyncExternalStore(f.useCallback(V=>{const D=n?.orbitControls;return D?.addEventListener("change",V),()=>D?.removeEventListener("change",V)},[n]),()=>n?ta(n,t):""),f.useSyncExternalStore(t?.subscribe??Qo,t?.getSnapshot??_s,t?.getSnapshot??_s);const C=f.useSyncExternalStore(zs,Gs),w=f.useSyncExternalStore(zs,Un),P=C&&!w?Qe.content.onAccent:Qe.content.primary,S=qn();f.useSyncExternalStore(mr,us,us);const I=Ze(e).overlays.navigationControls;if(!n)return null;const z=Dt(n.camera.position.clone().sub(n.orbitControls.target),new B(0,1,0).applyQuaternion(n.camera.quaternion))??"User",M=t?.projection()??i,k=t?.cameraView()??null,N=k?`Camera ${k.projection==="perspective"?"Perspective":"Orthographic"}`:`${z} ${M==="perspective"?"Perspective":"Orthographic"}`,Q=s.selectedEntityId,y=(Q===null?null:c(Q))||null,q=l??(y===null||y===a?a:`${a} | ${y}`),_=t?.camera()??n.renderCamera,Y=p&&!k&&z!=="User"&&_.isOrthographicCamera?p(nn(_,n,t)):null,F=V=>{V.preventDefault();const D=V.currentTarget;D.setPointerCapture(V.pointerId);const Pe=n.orbitControls.domElement?.getBoundingClientRect().top??0,Te=Math.max(5+V.clientY-Pe,1),le=n.camera,de=n.orbitControls.target,ue=le.position.clone().sub(de),re=!t&&n.renderCamera instanceof wr?n.renderCamera:null,ie=re?.zoom??1,Ve=t?.cameraViewZoom()??null,pe=fe=>{const He=5+fe.clientY-Pe,Ce=Math.max(.01,2*(He/Te-1)+1);Ve!==null&&t?.cameraView()?t.setCameraViewZoom(Ve/Ce):re?(re.zoom=ie/Ce,re.updateProjectionMatrix()):le.position.copy(de).addScaledVector(ue,Ce),n.orbitControls.update()},ee=()=>{D.removeEventListener("pointermove",pe),D.removeEventListener("pointerup",ee),D.removeEventListener("pointercancel",ee),D.removeEventListener("lostpointercapture",ee)};D.addEventListener("pointermove",pe),D.addEventListener("pointerup",ee),D.addEventListener("pointercancel",ee),D.addEventListener("lostpointercapture",ee)},Z=V=>{V.preventDefault();const D=V.currentTarget;D.setPointerCapture(V.pointerId);let Pe=V.clientX,Te=V.clientY;const le=new B,de=new B,ue=ie=>{const Ve=ie.clientX-Pe,pe=ie.clientY-Te;if(Pe=ie.clientX,Te=ie.clientY,t?.cameraView()){const tt=t.renderer.domElement;t.panCameraView(Ve/Math.max(tt.clientWidth,1),pe/Math.max(tt.clientHeight,1));return}const ee=n.camera,fe=n.orbitControls.target,He=ee.position.distanceTo(fe),Ce=Math.max(1,D.ownerDocument.defaultView?.innerHeight??1),et=2*He*Math.tan(yr.degToRad(ee.fov/2))/Ce;le.setFromMatrixColumn(ee.matrixWorld,0).multiplyScalar(-Ve*et),de.setFromMatrixColumn(ee.matrixWorld,1).multiplyScalar(pe*et),ee.position.add(le).add(de),fe.add(le).add(de),n.orbitControls.update()},re=()=>{D.removeEventListener("pointermove",ue),D.removeEventListener("pointerup",re),D.removeEventListener("pointercancel",re),D.removeEventListener("lostpointercapture",re)};D.addEventListener("pointermove",ue),D.addEventListener("pointerup",re),D.addEventListener("pointercancel",re),D.addEventListener("lostpointercapture",re)};return d.jsxs(d.Fragment,{children:[S.viewName==="text"&&s.showHelpers?d.jsxs("div",{"data-testid":"viewport-view-text","aria-hidden":"true",style:{position:"absolute",top:"var(--volter-space-3)",left:"calc(var(--volter-space-4) + var(--volter-control-comfortable-height) * 2 + var(--volter-space-4))",display:"flex",flexDirection:"column",gap:"var(--volter-space-1)",fontSize:"var(--volter-font-sm)",color:P,textShadow:"var(--volter-content-text-shadow, none)",pointerEvents:"none",userSelect:"none"},children:[d.jsx("span",{children:N}),d.jsx("span",{children:q}),Y?d.jsx("span",{"data-testid":"viewport-grid-scale",children:Y}):null,o&&o.length>0?d.jsx("div",{"data-testid":"viewport-statistics",style:{display:"grid",gridTemplateColumns:`${ea}px auto`,rowGap:"var(--volter-space-1)",marginTop:Xn[Jo]},children:o.map(V=>d.jsxs(f.Fragment,{children:[d.jsx("span",{children:V.label}),d.jsx("span",{children:V.value})]},V.id))}):null]}):null,S.viewName==="menu"?d.jsx("div",{className:"volter-viewport-view-pill",style:{position:"absolute",top:"var(--volter-viewport-overlay-top, var(--volter-space-4))",left:"var(--volter-stage-name-left, calc(var(--volter-space-4) + var(--volter-control-comfortable-height) * 2 + var(--volter-space-4)))",zIndex:"calc(var(--volter-z-dropdown, 1000) - 1)",pointerEvents:"auto"},children:d.jsx(Ko,{shell:s,documentId:e,label:Hs(n,M,"long"),kebab:!0})}):null,S.viewName==="gizmo"?d.jsxs("button",{type:"button","data-testid":"viewport-view-name",className:"volter-viewport-gizmo-label","aria-label":M==="perspective"?"Switch to orthographic":"Switch to perspective",onClick:()=>{const V=M==="perspective"?"orthographic":"perspective";t?t.setProjection(V):n.setProjection(V)},style:{position:"absolute",top:oo+4,right:io,transform:"translateX(50%)",display:"inline-flex",alignItems:"center",gap:"var(--volter-space-1)",padding:0,border:0,background:"none",fontSize:"var(--volter-font-sm)",color:P,textShadow:"var(--volter-content-text-shadow, none)",cursor:"pointer",pointerEvents:"auto"},children:[d.jsx(xe,{size:"xs",icon:M==="perspective"?Yn:Kn}),Hs(n,M,"short")]}):null,I&&s.showGizmos?d.jsxs("div",{"data-testid":"viewport-navigation",role:"toolbar","aria-label":"Navigation","aria-orientation":"vertical",className:"volter-chrome-island volter-viewport-navigation",style:{position:"absolute",top:Zo,right:"var(--volter-space-6)",display:"flex",flexDirection:"column",gap:"var(--volter-space-1)",padding:"var(--volter-space-1) 0",borderRadius:"var(--volter-radius-full)",background:"var(--volter-island-surface, var(--volter-surface-overlay))",pointerEvents:"auto"},children:[d.jsx(Ke,{text:"Zoom (drag)",children:d.jsx(Fe,{size:"comfortable","aria-label":"Zoom the view",onPointerDown:F,children:d.jsx(xe,{size:"2xl",icon:Se.viewport.zoomIn})})}),d.jsx(Ke,{text:"Pan (drag)",children:d.jsx(Fe,{size:"comfortable","aria-label":"Pan the view",onPointerDown:Z,children:d.jsx(xe,{size:"2xl",icon:Se.viewport.pan})})}),t?.hasCameraView()?d.jsx(Ke,{text:k?"Leave the camera view":"Look through the camera",children:d.jsx(Fe,{size:"comfortable","aria-label":"Toggle the camera view",onClick:()=>t.toggleCameraView(),children:d.jsx(xe,{size:"2xl",icon:k?Se.viewport.cameraView:Se.viewport.camera})})}):null,k&&t?.cameraViewLocked()!==null?d.jsx(Ke,{text:t?.cameraViewLocked()?"Unlock the camera from the view":"Lock the camera to the view",children:d.jsx(Fe,{size:"comfortable","aria-label":"Lock the camera to the view",onClick:()=>t?.toggleCameraViewLock(),children:d.jsx(xe,{size:"2xl",icon:t?.cameraViewLocked()?Se.viewport.cameraLocked:Se.viewport.cameraUnlocked})})}):null,k||S.viewName==="gizmo"?null:d.jsx(Ke,{text:M==="perspective"?"Orthographic":"Perspective",children:d.jsx(Fe,{size:"comfortable","aria-label":"Toggle perspective and orthographic",onClick:()=>{const V=M==="perspective"?"orthographic":"perspective";t?t.setProjection(V):n.setProjection(V)},children:d.jsx(xe,{size:"2xl",icon:M==="orthographic"?Se.viewport.projectionOrthographic:Se.viewport.projection})})})]}):null,k&&t?d.jsx(sa,{view:k,canvas:t.renderer.domElement,locked:t.cameraViewLocked()===!0}):null]})}function sa({view:n,canvas:e,locked:t}){const[s,i]=f.useState(null),[,a]=f.useState(0);f.useEffect(()=>{const M=new ResizeObserver(()=>a(k=>k+1));return M.observe(e),()=>M.disconnect()},[e]);const c=e.clientWidth,o=e.clientHeight,l=e.ownerDocument.defaultView?.devicePixelRatio??1,p=e.getBoundingClientRect(),C=s?.getBoundingClientRect(),w=1/l,P=n.frame.left*c-w,S=n.frame.top*o-w,I=n.frame.width*c+2*w,z=n.frame.height*o+2*w;return d.jsx("div",{ref:i,"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none"},children:C?d.jsxs("svg",{"data-testid":"viewport-camera-frame",width:c,height:o,style:{position:"absolute",left:p.left-C.left,top:p.top-C.top},children:[n.passepartout.opacity>0?d.jsx("path",{d:`M0 0H${c}V${o}H0Z M${P} ${S}V${S+z}H${P+I}V${S}Z`,fill:n.passepartout.color,fillOpacity:n.passepartout.opacity,fillRule:"evenodd"}):null,n.passepartout.opacity>0?d.jsx("rect",{x:P,y:S,width:I,height:z,fill:"none",stroke:n.border.solid,strokeWidth:w,shapeRendering:"crispEdges"}):null,d.jsx("rect",{x:P,y:S,width:I,height:z,fill:"none",stroke:n.border.dashed,strokeWidth:w,strokeDasharray:`${3*w} ${3*w}`,shapeRendering:"crispEdges"}),t?d.jsx("rect",{x:P-w,y:S-w,width:I+2*w,height:z+2*w,fill:"none",stroke:n.border.locked,strokeWidth:w,strokeDasharray:`${3*w} ${3*w}`,shapeRendering:"crispEdges"}):null]}):null})}const na=f.lazy(async()=>({default:(await Je(()=>import("./stage-keyboard-3K38-Hw6.js"),__vite__mapDeps([67,7,5,8,68,6,4,9,10,11,12,13,45,23]))).StageKeyboardBinding})),ia=n=>{const e=n.split(":");return(e[0]==="document"?e[1]:e[0])??n},Ws=()=>ki(),fr=12;function Is(n){if(!n)return null;const e=new br(new B(n.min[0],n.min[1],n.min[2]),new B(n.max[0],n.max[1],n.max[2]));return e.isEmpty()?null:e}const oa=500;function aa(n){return xr(null,n)}const ca=["solid","preview","rendered","clay","unlit","wireframe","matcap","normals","overdraw"];let la=0;const Ye=new Uo(n=>({documentId:n,store:tn(new Us),inUse:!1,source:null,camera:null,presentation:null,transport:null,contentSeconds:0,transportAdvances:0}),n=>oi().some(e=>e.descriptor.id===n),ai);function ua({canvasHostRef:n}){return d.jsx("div",{ref:n,style:{position:"absolute",inset:0}})}function ha(n,e,t,s,i){if(e==="inspector-preview"){const l=Ai();return l.canvas.setAttribute("aria-label",`${t} authoring viewport`),n.appendChild(l.canvas),{canvas:l.canvas,renderer:l.renderer,lease:l}}const a=Ji(s.width,s.height,i),{canvas:c,renderer:o}=a;return c.setAttribute("aria-label",`${t} authoring viewport`),n.appendChild(c),{canvas:c,renderer:o,lease:a}}class Ns{constructor(e,t,s){this.lane=e,this.surface=t,this.store=s??tn(new Us),this.transport=new Ci(this.store.shell)}scene=new en;store;cleanups=[];rendererSession=new _o((e,t)=>this.frame?.(e,t),()=>{});viewport=null;session=null;dressing=null;presentationRig=null;applyPresentation=null;backdropOverridden=!1;documentStudio=null;contentLights=[];contentHas={light:!1,"directional-light":!1};darkened=[];darkenContentLights(){for(const t of this.contentLights)t.visible&&(t.visible=!1,this.darkened.push(t));if(this.darkened.length===0)return 0;const e=this.darkened.length;return this.scene.onAfterRender=()=>{for(const t of this.darkened)t.visible=!0;this.darkened=[],this.scene.onAfterRender=()=>{}},e}defaultEnvironment=null;defaultBackground=null;adapter=null;presentationAdapter=null;content=null;frame=null;syncHostScene=null;presence=null;initialized=!1;contentSeconds=0;transportAdvances=0;users=0;closed=!1;released=!1;get isClosed(){return this.closed}transport;borrow(){this.users++;let e=!1;return()=>{e||(e=!0,this.users--,this.releaseIfClosed())}}close(){this.closed=!0,this.frame=null,this.syncHostScene=null,this.session?.setBeforeRender(null),this.session?.setPresentsFrames(!1),this.rendererSession.setActive(!1),this.content?.dispose(),this.transport.dispose(),this.releaseIfClosed()}releaseIfClosed(){if(!this.closed||this.users!==0||this.released)return;this.released=!0;const{lease:e,renderer:t,canvas:s}=this.surface;for(const i of[...this.cleanups.splice(0),()=>this.session?.dispose(),()=>this.viewport?.dispose(),()=>this.rendererSession.dispose(),()=>this.dressing?.dispose(),...e?[()=>e.release()]:[()=>t.dispose(),()=>t.forceContextLoss(),()=>s.remove()]])try{i()}catch(a){console.error("Object3D document cleanup failed.",a)}}}function on({documentId:n,sourcePath:e,build:t,displayName:s="Source Object3D",background:i,cameraDirection:a,persistence:c,documentSource:o,authoring:l,interaction:p,selectionOutline:C=!0,active:w=!0,audit:P=!0,chromeless:S=!1,modelSource:I,assetType:z,sourceAuthoring:M,dressing:k,rendererLane:N="own",onOpenNode:Q,frameBounds:y,openingFrameBounds:q,openingFit:_,openingView:Y,presentation:F,cameraView:Z,stageKind:V,statistics:D,subject:Pe,gridScale:Te,content:le}){const de=V??ia(n);f.useEffect(()=>{if(!S)return Zn(n)},[n,S]);const ue=Ei(Qn()),re=ue??gr(),ie=re?$s(re.shell,n,S?"embedded":"document"):null,Ve=f.useSyncExternalStore(aa,Gs),pe=ie!==null&&Jn(ie,Ve),ee=f.useRef(pe);ee.current=pe;const fe=ie!==null&&ei(ie),He=f.useRef(fe);He.current=fe;const Ce=ie!==null&&ti(ie),et=f.useRef(Ce);et.current=Ce;const tt=ri(),Ht=f.useRef(tt);Ht.current=tt;const Bt=f.useRef(null),zt=f.useRef(null),X=f.useRef(null),Ae=f.useRef(null);(!Ae.current||Ae.current.documentId!==n)&&(Ae.current&&Ye.release(Ae.current),Ae.current=Ye.claim(n)),f.useEffect(()=>{const R=Ae.current,me=Ye.generation(R);return()=>Ye.release(R,me)},[n]);const $=Ae.current,Be=le?.kind==="world-root",_t=w||Be,Pr=f.useRef(le?.kind==="world-root"?le.load:null);Pr.current=le?.kind==="world-root"?le.load:null;const[ze,Wt]=f.useState(_t);f.useEffect(()=>Wt(_t),[_t]);const It=f.useRef(C);f.useEffect(()=>{It.current=C;const R=X.current?.session;R&&(R.selectionOutlineEnabled=N!=="inspector-preview"&&C),X.current?.applyPresentation?.()},[C,N]);const Cr=f.useRef(Promise.resolve()),Nt=f.useRef(!1);f.useEffect(()=>{if(ze)return rt.current=!1,qt("building"),()=>{const R=X.current;if(R&&!Be){Nt.current=!dt.current;const me=R.store.cameraPose;$.camera=me&&R.viewport?{...me,up:R.viewport.camera.up.clone()}:null,$.presentation=R.session?.presentation()??null,$.transport=R.transport.snapshot(),$.contentSeconds=R.contentSeconds,$.transportAdvances=R.transportAdvances}mt.current=null,gt.current=null,ft.current=null,pt.current=null,R?.close(),X.current=null}},[n,N,$,ze,Be]);const kr=f.useRef(Q);kr.current=Q;const Er=f.useRef(y);Er.current=y;const Mr=f.useRef(q);Mr.current=q;const $t=f.useRef(Y);$t.current=Y;const Or=f.useRef(F);Or.current=F;const Rr=f.useRef(Z);Rr.current=Z;const dt=f.useRef(w);dt.current=w;const jr=f.useRef(w),Tr=f.useRef({build:t,sourcePath:e});f.useEffect(()=>{const R=Tr.current;Tr.current={build:t,sourcePath:e},!(R.build===t&&R.sourcePath===e)&&!ze&&$.source&&($.source.dispose(),$.source=null)},[t,$,e,ze]);const pt=f.useRef(null),rt=f.useRef(!1),ft=f.useRef(null),mt=f.useRef(null),gt=f.useRef(null),[Gt,oe]=f.useState(null),[Ut,qt]=f.useState("building"),[Vr,an]=f.useState(null),[cn,ln]=f.useState("mounting"),[un,hn]=f.useState([]),Ar=f.useRef(null),[Lr,dn]=f.useState("perspective"),[pn,Fr]=f.useState(null),vt=f.useRef(null);vt.current=pn;const Xt=a?.[0],Yt=a?.[1],Kt=a?.[2],st=I?.kind,Zt=I?.kind==="project-file"?I.path:void 0,wt=I?.kind==="entity"?I.entityId:void 0,Dr=k?.environment,Hr=k?.background,Br=k?.keyLight,Qt=k?.grid,nt=k?.viewLocked,Jt=k?.toneMapping;w&&si(n),f.useEffect(()=>{let R=!1;if(!ze)return;const me=async ke=>{const G=Bt.current,it=zt.current;if(!G||!it||X.current)return;const E=Ht.current;if(!E){oe("The world root needs the editor shell above it; this host has none.");return}const ot=await ke();if(R||X.current)return;an(()=>ot),hs();const r=new Ns("own",ot.mountWorldRootSurface(it,G,s),gr()??void 0);X.current=r,r.cleanups.push(ds(n,r.store.shell)),r.cleanups.push(ps(n,r.transport)),r.cleanups.push(Pi(n,{...Io(r.store,n),...Ds(n)}));const ae=ot.installWorldRootStage({store:r.store,documentId:n,container:G,canvas:r.surface.canvas,renderer:r.surface.renderer,stats:E,cameraPreview:()=>Ar.current,onMountStatus:ln,onRootIds:hn,runFrame:Ee=>Ts(n,Ee)});r.viewport=ae.viewport,r.frame=ae.frame,r.content={scene:ae.scene,settle:()=>Promise.resolve(),dispose:async()=>ae.dispose()};const j=As(()=>r.store.scene??ae.scene,r.transport,{rescanOnLiveMixers:()=>r.store.shell.playState==="stopped"});let se=0;r.cleanups.push(()=>j.dispose()),r.cleanups.push(r.store.shell.subscribe(()=>{if(r.store.shell.playState!=="stopped")return;const Ee=performance.now();Ee-se<oa||(se=Ee,j.refresh())})),r.cleanups.push(Vs({camera:ae.viewport.camera,drawCamera:()=>ae.viewport.renderCamera,orbit:ae.viewport.orbitControls,scene:ae.scene},ae.present,ae.setHelper,{documentId:n})),pt.current=r.rendererSession,r.initialized=!0,bs(),qt("ready"),r.rendererSession.setActive(!0)},mn=async()=>{for(await X.current?.content?.settle();Yi();)await Ki();if(R)return;const ke=Pr.current;if(ke)return me(ke);const G=Bt.current,it=zt.current;if(!G||!it)return;if(!t||e===void 0){oe("This stage shows `build` content and was given no `build()`/`sourcePath`.");return}let E;const ot=Ye.generation($);try{E=$.source??t(),$.source=null}catch(te){oe(te instanceof Error?te.message:String(te));return}try{X.current||(hs(),X.current=new Ns(N,ha(it,N,s,{width:Math.max(1,G.clientWidth),height:Math.max(1,G.clientHeight)},()=>{Wt(!1),window.setTimeout(()=>{dt.current&&Wt(!0)},0)}),$.store),X.current.contentSeconds=$.contentSeconds,X.current.transportAdvances=$.transportAdvances)}catch(te){throw E.dispose(),te}const r=X.current,ae=r.borrow(),{renderer:j,canvas:se,lease:Ee}=r.surface,T=r.store;S||(r.cleanups.push(ds(n,T.shell)),r.cleanups.push(ps(n,r.transport)));const yt=fs();yt&&T.shell.attachHistory(yt);const tr=N==="inspector-preview",_e=ee.current,_r=He.current,Wr=et.current,A=new en,St=E.root.parent;A.add(E.root),E.animations&&(E.root.animations=[...E.animations]);const rr={root:E.root,animations:E.root.animations};let We=null,Ie=null,Ne=null,Me=null,he=null,xt=null,Pt=null,Ct=null,kt=null,Et=null,sr=null,Ir=null,Nr=null,$r=!1,Mt=!1,Ot=null;const nr={scene:A,settle:()=>he?.settle()??Promise.resolve(),dispose:()=>{if(Ot)return Ot;Mt=!0;const te=Nt.current;return Nt.current=!1,xt&&G.removeEventListener("pointerdown",xt,!0),Pt&&G.removeEventListener("pointermove",Pt,!0),Ct&&G.removeEventListener("pointerup",Ct,!0),kt&&G.removeEventListener("pointercancel",kt,!0),Et&&window.removeEventListener("keydown",Et),sr?.(),sr=null,Ot=(async()=>{await he?.settle();const at=[];for(const Rt of[()=>Me?.dispose(),()=>Ie?.dispose?.(),()=>We?.dispose(),()=>A.removeFromParent(),()=>{te?Ye.retain($,E,ot):E.dispose()},ae])try{Rt()}catch(ge){at.push(ge)}at.length&&console.error("Object3D source cleanup failed.",...at)})(),Ot}};try{const te=async u=>{try{const m=rr;if(o&&!c){if(!m)throw new Error("Project history is unavailable; the edit was not saved.");const h=fs();if(!h)throw new Error("Project history is unavailable; the edit was not saved.");const v=o.serialize(m);if(v===null)return oe(null),!1;const g=await Ws().replaceSource(h,{file:o.path,source:v,label:u??o.label??`Edit ${s}`});return oe(null),g}if(!c)throw new Error("This Asset Lab document has no persistence binding.");if(!Ne||!m)throw new Error("Project history is unavailable; the edit was not saved.");const{persisted:x}=await(await Ne).commit(m,u);return oe(null),x}catch(m){throw oe(m instanceof Error?m.message:JSON.stringify(m)),m}};We=new vo(T,A,{documentId:n,title:s,sourcePath:e,documentKind:Wr?"asset":"source",audit:P,...E.hierarchyRoots?{hierarchyRoots:E.hierarchyRoots}:{},...st==="project-file"&&Zt?{modelSource:{kind:st,path:Zt}}:st==="entity"&&wt?{modelSource:{kind:st,entityId:wt}}:{}});const at={documentId:n,sourcePath:e,root:E.root,animations:E.root.animations,scene:A,defaultAdapter:We,commit:te};Ie=l?.(at)??null;const Rt=Ie?We:null;!Ie&&M&&(Ie=M({store:T,scene:A,...E.hierarchyRoots?{hierarchyRoots:E.hierarchyRoots}:{}}),We.dispose()),Ne=c&&yt?Ws().openPersistence({binding:c,document:rr,history:yt}):null,Ne&&Ne.catch(u=>{!Mt&&X.current?.content===nr&&oe(u instanceof Error?u.message:JSON.stringify(u))});const ge=Ie?.adapter??We;if(!r.dressing){j.outputColorSpace=Js,j.toneMapping=Jt??qi,j.shadowMap.enabled=!0,j.shadowMap.type=Xi,j.info.autoReset=!1,j.setPixelRatio(Math.min(window.devicePixelRatio,2)),_e&&j.setClearColor(0,0);const u=Dr===!1?null:Ee&&"environment"in Ee?Ee.environment():Vi(j),m=ms(se);r.dressing=Mi(r.scene,{environment:u,background:!_e&&i===void 0&&Hr!==!1,keyLight:!1,grid:Qt===!0,content:E.root}),!_e&&i!==void 0?r.scene.background=new be(i):!_e&&m.background!==null&&(r.scene.background=new be(m.background)),r.defaultEnvironment=r.scene.environment,r.defaultBackground=r.scene.background;{const x=new Oi(r.scene,H);r.presentationRig=x,gs(n,de);let h=r.store.shell.showHelpers;const v=()=>{const g=Ze(n);if(h=r.store.shell.showHelpers,x.apply(g,j,Jt),r.viewport?.setStageFunction(g.world,g.interaction),r.viewport?.setFieldOfView(g.camera.fov),r.viewport?.setSelectionMarks(g.overlays.selection),r.viewport?.setGridMajorEvery(g.overlays.grid.majorEvery),r.viewport?.setAxisLines(g.overlays.axes),r.viewport?.setNavigation(g.overlays.navigation),r.viewport?.setGridVisible(g.overlays.grid.visible&&h),r.session){const O=r.session.presentation().mode==="wireframe"&&g.xray.enabled&&g.xray.alpha<=0;r.session.selectionOutlineEnabled=!tr&&h&&It.current&&g.overlays.selection.outline&&!O,r.session.selectionOriginsEnabled=!tr&&h&&g.overlays.selection.origins,r.session.setXray(g.xray)}H()};r.applyPresentation=v,v(),r.cleanups.push(mr(v)),r.cleanups.push(r.store.shell.subscribe(()=>{r.store.shell.showHelpers!==h&&v()})),r.cleanups.push(ci(()=>{x.forgetFailedImages(),v()})),r.cleanups.push(()=>{x.dispose(),r.presentationRig===x&&(r.presentationRig=null)})}r.cleanups.push(()=>{r.defaultBackground instanceof Cs&&r.defaultBackground!==r.dressing?.backgroundTexture&&r.defaultBackground.dispose()})}const Gr=(u,m)=>{const x=r.adapter,h=r.viewport;if(!x||!h)return null;const v=se.getBoundingClientRect(),g=new ut((u-v.left)/Math.max(v.width,1)*2-1,-((m-v.top)/Math.max(v.height,1))*2+1),O=new ks;O.layers.enableAll(),O.params.Line2={threshold:4},O.setFromCamera(g,r.session?.camera()??h.camera);const K=r.presentationAdapter,ne=L=>{for(let W=L;W;W=W.parent){const J=K?.hierarchy.idForObject3D?.(W)??x.hierarchy.idForObject3D?.(W);if(J)return J}return null};let ve=null;for(const L of O.intersectObjects([...T.objectMap.values()],!0)){if(Ti(L.object))continue;const W=ne(L.object);if(W){ve={distance:L.distance,id:W};break}}const ye=h.visibleHelpers().filter(L=>L.userData.volterPickable===!0);for(const L of O.intersectObjects(ye,!0)){let W=null,J=!0;for(let Re=L.object;Re;Re=Re.parent)Re.visible||(J=!1),W??=Re.userData.volterPicksAs??null;if(!J)continue;const ce=W?ne(W):null;if(ce){(!ve||L.distance<ve.distance)&&(ve={distance:L.distance,id:ce});break}}return ve?.id??null};if(!r.viewport){r.viewport=new co(se,r.scene,T,G,{renderer:j,authoring:()=>r.adapter??ge,pick:Gr,drawCamera:()=>r.session?.camera()??r.viewport.camera,publishPickContext:!1,onProjectionChange:dn,chromeInsetPx:S||_r?0:fr,lightRig:!1}),Qt===!0&&r.viewport.grid.removeFromParent();const u=m=>{const x=Gr(m.clientX,m.clientY),h=x&&r.adapter?De(r.adapter.hierarchy,x):null;h&&kr.current?.(h)};G.addEventListener("dblclick",u),r.cleanups.push(()=>G.removeEventListener("dblclick",u))}const b=r.viewport;if(nt){const u=b.camera;r.scene.add(u);const m=new Ft;m.name="volter:document-studio",m.add(nt),u.add(m),r.documentStudio=m,r.cleanups.push(()=>{nt.removeFromParent(),m.removeFromParent(),r.documentStudio===m&&(r.documentStudio=null),u.removeFromParent()})}if(p){const u=new Ft;u.name="__object3d_document_overlay",Xs(u,"editorHelper",!0),A.add(u),Me=p.setup({root:E.root,scene:A,renderer:j,overlay:u,camera:()=>r.session?.camera()??b.camera,writable:c!==void 0||o!==void 0});const m=h=>{const v=se.getBoundingClientRect(),g=new ut((h.clientX-v.left)/Math.max(v.width,1)*2-1,-((h.clientY-v.top)/Math.max(v.height,1))*2+1),O=new ks;return O.layers.enableAll(),O.setFromCamera(g,r.session?.camera()??b.camera),{pointerId:h.pointerId,button:h.button,buttons:h.buttons,clientX:h.clientX,clientY:h.clientY,altKey:h.altKey,ctrlKey:h.ctrlKey,metaKey:h.metaKey,shiftKey:h.shiftKey,ray:O.ray.clone(),hits:O.intersectObjects([E.root,u],!0)}};he=new zo({begin:h=>{if(!c&&!o)throw new Error("This Asset Lab document has no persistence binding; project gestures are read-only.");return Me.begin(h)},persist:async h=>{await te(h)},reportError:h=>oe(h instanceof Error?h.message:JSON.stringify(h))});const x=h=>{h.preventDefault(),h.stopPropagation()};xt=h=>{h.target instanceof Element&&h.target.closest('[role="alert"], [role="toolbar"]')!==null||he?.begin(m(h))&&(x(h),h.isTrusted&&se.setPointerCapture?.(h.pointerId))},Pt=h=>{he?.hasActiveGesture()&&(x(h),he.update(m(h)))},Ct=h=>{he?.hasActiveGesture()&&(x(h),se.hasPointerCapture?.(h.pointerId)&&se.releasePointerCapture?.(h.pointerId),he.commit(m(h)))},kt=h=>{he?.hasActiveGesture()&&(x(h),he.cancel(h.pointerId))},Et=h=>{h.key!=="Escape"||!he?.hasActiveGesture()||(h.preventDefault(),he.cancel())},Ir=()=>{G.addEventListener("pointerdown",xt,!0),G.addEventListener("pointermove",Pt,!0),G.addEventListener("pointerup",Ct,!0),G.addEventListener("pointercancel",kt,!0),window.addEventListener("keydown",Et)}}const Le=r.content,Ur=[...T.shell.selectedEntityIds],ct=r.adapter,vn=r.presentationAdapter,wn=new Map(T.objectMap),$e=r.session?.root,bn=r.frame,yn=r.syncHostScene,Sn=mt.current,xn=gt.current,Pn=ft.current,qr=r.session?.neutralBackgroundTexture(),Cn=r.dressing.lights.map(u=>u.visible),kn=r.cleanups.length,En=r.initialized;if(Nr=()=>{A.removeFromParent(),St&&St.add(E.root),Le&&r.scene.add(Le.scene),r.adapter=ct,r.presentationAdapter=vn,r.content=Le,r.frame=bn,r.syncHostScene=yn,r.initialized=En;for(const u of r.cleanups.splice(kn))u();!$e&&r.session&&(r.session.dispose(),r.session=null),T.objectMap.clear();for(const[u,m]of wn)T.objectMap.set(u,m);Le&&T.bindScene(Le.scene,j,b.batchedRenderer,b.camera),$e&&ct&&r.session?.replaceContent($e,ct),mt.current=Sn,gt.current=xn,ft.current=Pn,vt.current=ct,Fr(ct),qr!==void 0&&r.session?.setNeutralBackground(qr),r.dressing?.lights.forEach((u,m)=>{u.visible=Cn[m]??!0}),$e&&(r.dressing?.frameContent($e),r.presentationRig?.placeFloor($e)),T.shell.selectMultiple(Ur),T.notifyIngestObjectMapEdit()},Le?.scene.removeFromParent(),r.scene.add(A),r.adapter=ge,r.presentationAdapter=Rt,r.content=nr,T.bindScene(A,j,b.batchedRenderer,b.camera),T.setOrbitTarget(b.orbitControls.target),T.objectMap.clear(),A.traverse(u=>{const m=Rt?.hierarchy.idForObject3D?.(u)??ge.hierarchy.idForObject3D?.(u);m&&T.objectMap.set(m,u)}),r.session)r.session.replaceContent(E.root,ge);else{const u=Is(Er.current),m=Is(Mr.current)??u,x=Ze(n).camera;b.setFieldOfView(x.fov);const h=$t.current,v=Xt!==void 0&&Yt!==void 0&&Kt!==void 0;if(!h&&!v){const g=b.orbitControls.target,O=b.camera.position.distanceTo(g);b.camera.position.copy(g).addScaledVector(new B(...x.opening).normalize(),O)}if(m||b.focusOn(E.root),h){const g=new B(...h.target),O=new B(...h.direction).normalize();b.camera.position.copy(g).addScaledVector(O,h.distance),b.camera.up.set(0,1,0),h.up&&b.camera.up.set(...h.up),b.orbitControls.target.copy(g)}else if(v){const g=m??vr(E.root),O=g.getCenter(new B),K=new B(Xt,Yt,Kt).normalize(),ne=Lt(g,b.camera,K)*Math.min(10,Math.max(.1,_??1));b.camera.position.copy(O).add(K.multiplyScalar(ne)),b.orbitControls.target.copy(O)}if(r.session=new Fo(n,E.root,r.scene,j,b,ge,_e?null:i===void 0?r.dressing.backgroundTexture:new be(i),u),r.session.selectionOutlineEnabled=!tr&&It.current,r.session.setCameraViewSource(Rr.current??null),r.applyPresentation?.(),$t.current?.projection==="orthographic"&&r.session.setProjection("orthographic"),!_e&&i===void 0&&r.dressing.backgroundTexture){const g=r.session;r.cleanups.push(Ri(()=>{const O=ms(se).background,K=r.defaultBackground;r.defaultBackground=O!==null?new be(O):ji(),g.neutralBackgroundTexture()===K&&g.setNeutralBackground(r.defaultBackground),K instanceof Cs&&K!==r.dressing?.backgroundTexture&&K.dispose()}))}}const lt=$.camera;lt&&(b.setPose(lt.position,lt.target,lt.fov||void 0,lt.up),b.setProjection(Lr),$.camera=null);const U=r.session;mt.current=rr,gt.current=Ne,ft.current=Me,vt.current=ge,Fr(ge);const ir=li(de)?.all?.lighting!==void 0||ui(de)?null:nt?{all:{lighting:{source:"studio",studioPreset:vs.id,auto:null}}}:Br===!1?{all:{lighting:{source:"scene"}}}:null,jt=Or.current??null;gs(n,de,ir&&jt?hi(ir,jt):jt??ir);const or=new Set(ca);let Xr;const Yr=()=>{const u=r.session?.presentation().mode;u!==Xr&&(Xr=u,r.applyPresentation?.()),!(u===void 0||!or.has(u))&&Ze(n).drawMode!==u&&di(n,{drawMode:u})},ar=jt?.drawMode??pi(n).drawMode;ar!==void 0&&or.has(ar)&&r.session&&r.session.setMode(ar),Yr();const Mn=r.session?.subscribe(Yr),On=mr(()=>{const u=r.session,m=Ze(n).drawMode;u&&u.presentation().mode!==m&&or.has(u.presentation().mode)&&u.setMode(m)});r.cleanups.push(()=>{Mn?.(),On()});const Tt=[];E.root.traverse(u=>{u.isLight&&Tt.push(u)});const Rn={light:Tt.length>0,"directional-light":Tt.some(u=>u.isDirectionalLight)};r.contentLights=Tt,r.contentHas=Rn,r.dressing.frameContent(E.root),r.presentationRig?.placeFloor(E.root),r.cleanups.push(T.shell.subscribe(()=>r.presentationRig?.placeFloor(E.root)));const Kr=new Set;T.shell.selectMultiple(Ur.filter(u=>{const m=T.objectMap.get(u)??De(ge.hierarchy,u);if(m===null&&!T.objectMap.has(u))return!1;const x=m??u;return Kr.has(x)?!1:(Kr.add(x),!0)})),T.notifyIngestObjectMapEdit(),U.syncSelectionPresentation(),Ir?.(),oe(null),S||ws(n);let Vt=A.background;U.setNeutralBackground(Vt??r.defaultBackground);const Ge=$.presentation;Ge&&(U.setMode(Ge.mode),U.setBackground(Ge.background),U.setProjection(Ge.projection),U.setSkeleton(Ge.skeleton),U.setBounds(Ge.bounds),$.presentation=null);const jn=()=>{r.viewport?.alignGridToView(U.camera(),j.domElement.width),r.scene.environment=A.environment??r.defaultEnvironment,r.scene.fog=A.fog,r.scene.environmentIntensity=A.environmentIntensity,r.scene.environmentRotation.copy(A.environmentRotation),r.scene.backgroundIntensity=A.backgroundIntensity,r.scene.backgroundBlurriness=A.backgroundBlurriness,r.scene.backgroundRotation.copy(A.backgroundRotation);const u=r.presentationRig;if(u){const m=u.resolveSource({...r.contentHas,environment:A.environment!==null}),x=u.environment();x&&(r.scene.environment=x.texture??r.defaultEnvironment,r.scene.environmentIntensity=x.intensity,r.scene.environmentRotation.set(0,x.rotation,0));const h=u.backdrop();h!=="keep"?(r.scene.background=h.value,r.scene.backgroundBlurriness=h.blur,r.scene.backgroundIntensity=h.intensity,r.scene.backgroundRotation.set(0,h.rotation,0),r.backdropOverridden=!0):r.backdropOverridden&&(r.scene.background=U.neutralBackgroundTexture(),r.scene.backgroundBlurriness=A.backgroundBlurriness,r.scene.backgroundIntensity=A.backgroundIntensity,r.backdropOverridden=!1);const v=m==="studio"&&u.presetId()===vs.id;r.documentStudio&&(r.documentStudio.visible=v);const g=m==="studio"&&!v||m==="preview"&&!u.sceneLightsShown()?r.darkenContentLights():0;u.update(U.camera()),fi(n,{source:m,presetId:u.presetId(),presetLights:u.lightsVisible(),documentStudio:r.documentStudio?r.documentStudio.visible:null,contentLights:r.contentLights.length,contentLightsDarkened:g,environmentIntensity:r.scene.environmentIntensity,environmentImage:u.imageReport().shown,environmentImagePending:u.imageReport().pending,toneMapping:String(j.toneMapping)})}Vt!==A.background&&(Vt=A.background,U.setNeutralBackground(Vt??r.defaultBackground))};r.syncHostScene=jn,U.setBeforeRender(()=>(r.syncHostScene?.(),E.prepareDraw?.(U.camera()))),U.setPresentsFrames(!0);const Tn=u=>{Mt||!(u>0)||!Number.isFinite(u)||(r.contentSeconds+=u,r.transportAdvances++,E.update?.(u))},Vn=As(E.root,r.transport);r.cleanups.push(()=>Vn.dispose());const Oe=$.transport;Oe&&(Oe.activeSubject&&r.transport.setActiveSubject(Oe.activeSubject),r.transport.setLoop(Oe.range.loop),r.transport.setTimeScale(Oe.timeScale),r.transport.seek(Oe.time),Oe.playbackState==="playing"?r.transport.play():Oe.playbackState==="paused"&&r.transport.pause(),$.transport=null);let cr=performance.now();const Zr=typeof E.onChange=="function";let lr=!0;const At=()=>{lr=!0};if(Zr){const u=E.onChange(At),m=T.shell.subscribe(At),x=["pointerdown","pointermove","pointerup","pointerleave","wheel","keydown","keyup"];for(const h of x)G.addEventListener(h,At,{capture:!0,passive:!0});sr=()=>{u(),m();for(const h of x)G.removeEventListener(h,At,{capture:!0})}}let Qr=-1;const Jr=new Es,es=new Es,ts=new ut,rs=new ut;let ss,ns=null,is=Number.NaN;const An=u=>{if(!Zr||lr||u>0||ys()!==Qr||U.needsFrame()||r.presence?.live()||Me?.prepareFrame||Me?.update||(b.batchedRenderer.batches?.length??0)>0)return!0;const m=U.camera();return m.updateMatrixWorld(),j.getDrawingBufferSize(rs),!m.matrixWorld.equals(Jr)||!m.projectionMatrix.equals(es)||!rs.equals(ts)||r.scene.background!==ss||j.toneMapping!==ns||j.toneMappingExposure!==is},Ln=()=>{lr=!1,Qr=ys();const u=U.camera();Jr.copy(u.matrixWorld),es.copy(u.projectionMatrix),j.getDrawingBufferSize(ts),ss=r.scene.background,ns=j.toneMapping,is=j.toneMappingExposure},os=(u,m)=>{if(Mt||!j||!b)return;const x=j,h=b,v=U?.profiler;v?.beginFrame(),m&&(cr=u);const g=Math.min((u-cr)/1e3,.1);cr=u,v?.beginPhase();const O=r.transport.tick(g);if(O>0&&Tn(O),Me?.prepareFrame?.(g),Me?.update?.(g),v?.endPhase("animation"),v?.beginPhase(),r.presence?.syncMarkers(g),b.update(g),S||Ts(n,g),b.batchedRenderer.update(g),v?.endPhase("editor"),!m&&!An(O)){v?.endFrame();return}v?.beginPhase(),x.info.reset();const K=!rt.current&&mi()===n;K&&gi(n);const ne=K?Date.now():0,ve=r.scene.overrideMaterial,ye=U.presentation().mode;ye!=="uv"&&ye!=="vertex-colors"&&(r.scene.overrideMaterial=A.overrideMaterial);try{h.renderWithInfrastructure(()=>{U.renderViewport(g),h.renderViewCube(x)})}finally{r.scene.overrideMaterial=ve}U.servePresentedFrame(),Ln(),rt.current||(rt.current=!0,K&&vi("first-render",Date.now()-ne),wi(n),qt("ready")),v?.reportRender({gpuMs:null,drawCalls:x.info.render.calls,triangles:x.info.render.triangles,geometries:x.info.memory.geometries,textures:x.info.memory.textures}),v?.endPhase("render"),v?.endFrame();const L=Ht.current;if(L&&ue&&bi(ue.shell)===T.shell){const W=U.cameraPose();L.frameTime=g*1e3,L.fps=g>0?1/g:0,L.drawCalls=x.info.render.calls,L.triangles=x.info.render.triangles,L.cameraPosition.x=W.position[0],L.cameraPosition.y=W.position[1],L.cameraPosition.z=W.position[2],L.cameraTarget.x=W.target[0],L.cameraTarget.y=W.target[1],L.cameraTarget.z=W.target[2]}};r.frame=os;const Fn=u=>{if(!j)throw new Error("This stage has no renderer yet.");const m=j,x=m.getContext(),h=new Uint8Array(4),v=[];for(let J=0;J<=u;J++){const ce=performance.now();os(ce,!0),x.readPixels(0,0,1,1,x.RGBA,x.UNSIGNED_BYTE,h),J>0&&v.push(performance.now()-ce)}const g={calls:m.info.render.calls,triangles:m.info.render.triangles};let O=0,K=0;r.scene.traverseVisible(J=>{const ce=J;if(!ce.isMesh||!ce.geometry)return;O++;const Re=ce.geometry.getIndex(),Dn=Re?Re.count:ce.geometry.getAttribute("position")?.count??0;K+=Math.floor(Dn/3)*(ce.count??1)});const ne=[...v].sort((J,ce)=>J-ce),ve=J=>ne[Math.min(ne.length-1,Math.floor(J*ne.length))]??0,ye=m.getDrawingBufferSize(new ut),L=m.getPixelRatio(),W=J=>Math.round(J*100)/100;return{frames:u,medianMs:W(ve(.5)),p95Ms:W(ve(.95)),minMs:W(ne[0]??0),width:ye.x,height:ye.y,cssWidth:W(ye.x/L),cssHeight:W(ye.y/L),devicePixelRatio:L,drawn:g,scene:{meshes:O,triangles:K},drawMode:Ze(n).drawMode}};if(pt.current=r.rendererSession,!r.initialized){S||(r.cleanups.push(Vs({camera:b.camera,drawCamera:()=>r.session?.camera()??b.camera,orbit:b.orbitControls,scene:r.scene,frameCost:v=>Fn(v)},()=>null,(v,g)=>b.setHelper(v,g),{documentId:n})),Je(()=>import("./stage-presence-markers-CJ49-XME.js"),__vite__mapDeps([69,4,5,7,8,9,10,6,11,12,13,26,27,18,2,70])).then(v=>{if(r.isClosed||X.current!==r||r.presence)return;const g=v.bindStagePresenceMarkers({scene:r.scene,store:T,documentId:n,container:G,canvas:se,viewport:b,readVisibleCameraPose:()=>{const O=r.session?.camera()??b.renderCamera,K=O.getWorldPosition(new B),ne=O.fov;return{position:K,target:b.orbitControls.target,fov:typeof ne=="number"?ne:0}}});r.presence=g,r.cleanups.push(()=>g.dispose())}),r.cleanups.push(go(U,Ds(n))),r.cleanups.push(yi({id:n,label:s,kind:Wr?"asset":"source",profiler:U.profiler}))),!S&&!_r&&r.cleanups.push(Si(n,()=>({adapter:r.adapter,nodeId:r.adapter?.selection?.get()[0]??null})));const u=S?`${n}#chromeless-${++la}`:n;r.cleanups.push(xi({id:u,label:s,contentClock:()=>r.contentSeconds,transportAdvances:()=>r.transportAdvances})),r.cleanups.push(T.shell.onViewportAction(v=>{switch(v.type){case"focus-selection":case"focus-scene":!r.session?.frame()&&r.session?.root&&b.focusOn(r.session.root);break;case"focus-entity":{const g=r.adapter?De(r.adapter.hierarchy,v.id):null;g&&b.focusOn(g);break}case"snap-selection-to-floor":b.snapSelectionToFloor();break;case"set-view-preset":r.session?r.session.setViewPreset(v.preset==="perspective"?"isometric":v.preset,"view"):b.setViewPreset(v.preset);break;case"toggle-camera-view":r.session?.toggleCameraView();break;case"frame-all":!r.session?.frame(1,"all")&&r.session?.root?b.focusOn(r.session.root):r.session||b.focusOnScene();break;case"zoom-view":r.session?.cameraView()&&!r.session.cameraViewLocked()?r.session.zoomCameraView(v.direction>0?1.2:1/1.2):b.zoomStep(v.direction);break;case"step-view":if(r.session?.cameraView()&&!r.session.cameraViewLocked())break;b.stepView(v.step);break;case"toggle-projection":{const g=r.session;if(g?.cameraView())break;const K=(g?g.projection():b.projection)==="perspective"?"orthographic":"perspective";g?g.setProjection(K):b.setProjection(K);break}case"set-camera-pose":b.setPose(v.position,v.target,v.fov);break}}));let m="";r.cleanups.push(T.shell.subscribe(()=>{b.objectMap=T.objectMap,b.syncFromStore(),r.session?.syncSelectionPresentation();const v=(r.adapter?.selection?.get()??[]).join("\0");v!==m&&(m=v,S||ws(n))}));const x=()=>{const v=Math.max(1,G.clientWidth),g=Math.max(1,G.clientHeight),O=j.getPixelRatio();(se.width!==Math.floor(v*O)||se.height!==Math.floor(g*O))&&j.setSize(v,g,!1),b.resize(v,g),r.session?.resize(v,g),r.rendererSession.redraw()},h=new ResizeObserver(x);h.observe(G),r.cleanups.push(()=>h.disconnect()),x(),r.initialized=!0,bs()}b.objectMap=T.objectMap,b.syncFromStore(),r.rendererSession.setActive(dt.current),r.rendererSession.redraw(),$r=!0,Le?.dispose()}catch(te){if(!$r)try{Nr?.()}finally{St&&E.root.parent===A&&St.add(E.root),nr.dispose()}console.error(`[object3d document] ${s}: source update failed`,te),oe(te instanceof Error?te.message:String(te))}},gn=Cr.current.then(mn);return Cr.current=gn.catch(ke=>{R||oe(ke instanceof Error?ke.message:String(ke))}),()=>{R=!0}},[l,i,t,Xt,Yt,Kt,s,n,pe,Hr,Dr,Qt,Br,nt,Jt,S,wt,st,Zt,p,c,o,N,$,ze,M,e,Be]),f.useEffect(()=>{const R=pt.current,me=w&&!jr.current;jr.current=w,R&&(me&&(rt.current=!1,ni(n)),R.setActive(w||Be))},[w,n,Be]);const bt=X.current,er=Ut==="ready"&&bt?.viewport?{store:bt.store,viewport:bt.viewport,canvas:bt.surface.canvas}:null,fn=f.useCallback(()=>{const R=vt.current;return R?{adapter:R,nodeId:R.selection?.get()[0]??R.hierarchy.roots()[0]?.id??null}:null},[]),zr=d.jsx("div",{"data-testid":"tool-object3d-authoring","data-volter-chromeless":S||void 0,className:pe?"volter-object3d-studio-stage":void 0,style:{position:S||fe?"relative":"absolute",...S?{width:"100%",height:"100%"}:fe?{flex:1,minHeight:0}:{inset:-fr},overflow:"hidden",background:pe?void 0:Qe.surface.raised,pointerEvents:"auto"},children:d.jsxs("div",{ref:Bt,style:{position:"absolute",inset:0,minHeight:0,overflow:"hidden"},children:[d.jsx(ua,{canvasHostRef:zt}),w&&er&&!S?d.jsx(f.Suspense,{fallback:null,children:d.jsx(na,{stage:er})}):null,ue&&!S?d.jsx(Xo,{store:ue,documentId:n,stage:er,active:w,chrome:"document"}):null,ue&&Vr?d.jsx(Vr.Overlays,{store:ue,documentId:n,cameraPreviewRef:Ar,mountStatus:cn,rootIds:un}):null,Gt&&d.jsx("div",{role:"alert",style:{position:"absolute",insetInline:0,top:0,display:"flex",justifyContent:"center",padding:"var(--volter-space-3)",pointerEvents:"none"},children:d.jsxs("div",{className:"volter-chrome-island",style:{display:"flex",alignItems:"center",gap:"var(--volter-space-3)",maxWidth:"80%",padding:"var(--volter-space-2) var(--volter-space-3)",borderRadius:"var(--volter-radius-md)",border:`var(--volter-stroke-resting) solid ${Qe.semantic.danger}`,background:Qe.surface.raised,color:Qe.semantic.danger,pointerEvents:"auto"},children:[d.jsx("span",{children:Gt}),d.jsx(Fe,{size:"compact","aria-label":"Dismiss",onClick:()=>oe(null),"data-testid":"object3d-document-error-dismiss",children:d.jsx(xe,{icon:Se.action.close})})]})}),!Gt&&Ut==="building"&&d.jsx(yo,{testId:"object3d-document-status",children:So}),d.jsx("div",{style:{position:"absolute",inset:S||fe?0:fr,pointerEvents:"none"},children:!S&&Ut==="ready"&&X.current&&d.jsx(ra,{viewport:X.current.viewport,documentId:n,session:X.current.session,store:X.current.store.shell,projection:Lr,displayName:s,...D?{statistics:D}:{},...Pe!==void 0?{subject:Pe}:{},...Te?{gridScale:Te}:{},objectName:R=>(me=>me?De(me.hierarchy,R)?.name:void 0)(X.current?.adapter)??X.current?.store.objectMap.get(R)?.name??null})})]})});return fe?d.jsx(ii,{documentId:n,active:w,type:z??(wt?"entity":"model"),title:s,status:e,selection:fn,fill:!0,children:d.jsxs("div",{className:"volter-object3d-asset-workspace",children:[zr,d.jsx(bo,{transport:X.current?.transport??null})]})}):zr}function da(n){return d.jsx(on,{...n})}const Ia=Object.freeze(Object.defineProperty({__proto__:null,Object3DDocumentViewport:on,ToolObject3DAuthoring:da},Symbol.toStringTag,{value:"Module"}));export{on as O,Ia as S,Ko as V,Hs as s,No as t};
@@ -1 +1 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{az as y,aA as f,al as g,aB as x,aC as S}from"./index-9nYTVIws.js";import{r as j}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";class w extends j.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,o){console.error(`[stories] ${this.props.modulePath} — story "${this.props.storyName}" crashed while rendering:`,t,o.componentStack)}render(){return this.state.error?e.jsxs("div",{style:{padding:12,fontSize:12,color:g.semantic.danger,maxWidth:640},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:["Story crashed: ",e.jsx("code",{children:this.props.modulePath})," — export"," ",e.jsx("code",{children:this.props.storyName})]}),e.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)})]}):this.props.children}}const a=new WeakMap;async function k(r,t,o,i,s){const n=a.get(r),c=(n?.generation??0)+1;a.set(r,{root:n?.root,generation:c}),y(r);const d=S();d&&await x(d.rootPath),await i.load();const{createRoot:m,flushSync:h}=await f(),p=a.get(r);if(!p||p.generation!==c)return null;const u=n?.root??m(r);return a.set(r,{root:u,generation:c}),h(()=>{u.render(e.jsx(w,{modulePath:t,storyName:o,children:e.jsx(i,{...s??{}})}))}),{root:u,unmount:()=>{queueMicrotask(()=>{const l=a.get(r);!l||l.generation!==c||!l.root||(a.delete(r),l.root.unmount())})}}}async function B(r,t,o,i){if(typeof o.play!="function")return{ran:!1};try{return await o.play({canvasElement:i}),{ran:!0}}catch(s){const n=String(s instanceof Error?s.message:s);return console.error(`[stories] ${r} — story "${t}"'s play() threw:`,s),{ran:!0,error:`[stories] ${r} — story "${t}"'s play() failed: ${n}`}}}export{k as m,B as r};
1
+ import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{az as y,aA as f,al as g,aB as x,aC as S}from"./index-DmNeCiAo.js";import{r as j}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";class w extends j.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,o){console.error(`[stories] ${this.props.modulePath} — story "${this.props.storyName}" crashed while rendering:`,t,o.componentStack)}render(){return this.state.error?e.jsxs("div",{style:{padding:12,fontSize:12,color:g.semantic.danger,maxWidth:640},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:["Story crashed: ",e.jsx("code",{children:this.props.modulePath})," — export"," ",e.jsx("code",{children:this.props.storyName})]}),e.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)})]}):this.props.children}}const a=new WeakMap;async function k(r,t,o,i,s){const n=a.get(r),c=(n?.generation??0)+1;a.set(r,{root:n?.root,generation:c}),y(r);const d=S();d&&await x(d.rootPath),await i.load();const{createRoot:m,flushSync:h}=await f(),p=a.get(r);if(!p||p.generation!==c)return null;const u=n?.root??m(r);return a.set(r,{root:u,generation:c}),h(()=>{u.render(e.jsx(w,{modulePath:t,storyName:o,children:e.jsx(i,{...s??{}})}))}),{root:u,unmount:()=>{queueMicrotask(()=>{const l=a.get(r);!l||l.generation!==c||!l.root||(a.delete(r),l.root.unmount())})}}}async function B(r,t,o,i){if(typeof o.play!="function")return{ran:!1};try{return await o.play({canvasElement:i}),{ran:!0}}catch(s){const n=String(s instanceof Error?s.message:s);return console.error(`[stories] ${r} — story "${t}"'s play() threw:`,s),{ran:!0,error:`[stories] ${r} — story "${t}"'s play() failed: ${n}`}}}export{k as m,B as r};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/document-preview-three-BGSnBaa1.js","assets/content-bounds-CY_M6Fwr.js","assets/hierarchy-marks-BTgoMhKJ.js","assets/workspace-arrangement-8FYR3_fQ.js","assets/index-9nYTVIws.js","assets/index-nmcBqr7Y.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/index-CPiRKiDC.css","assets/three.core-3arARmh6.js","assets/editor-layers-kBpG49pG.js","assets/renderer-ownership-BovSEcLv.js","assets/three.module-BLhyNg0e.js","assets/scene-framing-Bib_NZz8.js","assets/environment-Dg-YaLsA.js","assets/RoomEnvironment-BkknvS_I.js","assets/EXRLoader-CITMBvGd.js","assets/HDRLoader-BTGuGhVo.js","assets/standard-viewport-dressing-KeudiGw3.js","assets/user-data-BQR8TLTV.js"])))=>i.map(i=>d[i]);
2
- import{hg as O,hh as dt,au as Q,aw as Kt,bi as zt,fV as It,bj as Vt,fW as St,av as tt,hi as Ht,al as g,eM as Zt,dT as Xt,hj as Wt,f5 as Ut,fg as X,dK as Yt,as as Mt,hk as qt,fn as Jt,gF as mt,eO as Qt,b9 as te,at as W,cC as Et,_ as A,hl as ee,hm as ne,Z as oe,hn as Z,ho as re,dv as se}from"./index-9nYTVIws.js";import{a as m}from"./jsx-runtime-DPjLkJKQ.js";import{a as ie}from"./three-contract-Dkt6PmWY.js";import{a as ae}from"./object3d-document-session-registry-D6-Tfc82.js";import{O as ce}from"./Object3DDocumentViewport-S-eokiOr.js";import{S as ue}from"./standard-viewport-dressing-KeudiGw3.js";import{t as le}from"./viewport-surface-status-QAiH2FdR.js";import{r as w}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{withStoryMountTurn as vt,lastStoryMountPhaseTiming as de}from"./story-three-preview-3zJJUEeK.js";import{m as me}from"./three-story-model-uufCdHEL.js";import{c as pe}from"./content-bounds-CY_M6Fwr.js";import{EDITOR_LAYER as he}from"./editor-layers-kBpG49pG.js";import{setUserData as fe}from"./user-data-CODoGZqA.js";import{bh as R,co as Dt,K as xe,cx as ge,db as ye,cp as be,aI as we,N as Se,a$ as Me,c0 as Ee,b_ as ve,el as De,I as _e,fo as P,ex as Oe,cj as Pe}from"./three.core-3arARmh6.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./environment-Dg-YaLsA.js";import"./three.module-BLhyNg0e.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";import"./user-data-BQR8TLTV.js";import"./workspace-arrangement-8FYR3_fQ.js";import"./asset-preview-DPWGMtoN.js";import"./renderer-ownership-BovSEcLv.js";import"./hierarchy-marks-BTgoMhKJ.js";import"./studio-environment-8rNw9hGx.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";import"./bitmap-label-Ct4k6ehY.js";import"./crash-null-boundary-v3a0uEgw.js";import"./events-156d8d12.esm-DmeaOP4r.js";import"./index-DzuOGwVB.js";import"./story-mount-turn-DFRTj5hi.js";import"./object-marks-BnvSuCTt.js";const L={neighbourGapFactor:.45,minGap:.5,districtGapFactor:.6,minDistrictGap:3},$=.7,Te={min:[0,0,0],max:[0,0,0]};function et(t){return[...t.min,...t.max].some(r=>!Number.isFinite(r))?Te:{min:[Math.min(t.min[0],t.max[0]),Math.min(t.min[1],t.max[1]),Math.min(t.min[2],t.max[2])],max:[Math.max(t.min[0],t.max[0]),Math.max(t.min[1],t.max[1]),Math.max(t.min[2],t.max[2])]}}function nt(t){return[t.max[0]-t.min[0],t.max[1]-t.min[1],t.max[2]-t.min[2]]}function pt(t){const e=nt(et(t));return e[0]*e[2]}function ke(t){return-et(t).min[1]}function _t(t){const e=Math.max(t[0],t[2]),r=Math.max(.15,.1*e);return[Math.max(t[0]+2*r,$),Math.max(t[2]+2*r,$)]}function Ot(t){return Math.max(t[0],t[1])}function Be(t){return t.map(e=>({item:e,bounds:et(e.bounds)})).sort((e,r)=>{const n=pt(e.bounds)-pt(r.bounds);return n!==0?n:e.item.id<r.item.id?-1:1})}function Re(t){const e=Math.max($,...t.map(({bounds:r})=>Ot(_t(nt(r)))));return Math.max(10,2.2*e)}function je(t,e,r){const n=Re(t),s=[];let o={slots:[],xEdge:0,depth:0,previousSpan:null};const i=()=>{o.slots.length>0&&s.push({slots:o.slots,xEdge:o.xEdge,depth:o.depth}),o={slots:[],xEdge:0,depth:0,previousSpan:null}};for(const{item:a,bounds:u}of t){const c=nt(u),l=_t(c),d=Ot(l),p=o.previousSpan===null?0:Math.max(r,e*Math.max(o.previousSpan,d));o.slots.length>0&&o.xEdge+p+l[0]>n&&i();const y=o.previousSpan===null?0:p,b=o.xEdge+y+l[0]/2;o.xEdge=b+l[0]/2,o.depth=Math.max(o.depth,l[1]),o.previousSpan=d,o.slots.push({item:a,bounds:u,size:c,footprint:l,centreX:b})}return i(),s}function ht(t,e,r,n,s){const o=je(e,n,s),i=[];let a=r,u=null,c=0;for(const l of o){u!==null&&(a+=Math.max(s,n*Math.max(u,l.depth)));const d=a+l.depth/2;a=d+l.depth/2,u=l.depth,c=Math.max(c,l.xEdge);for(const p of l.slots)i.push({id:p.item.id,groupKey:t,translation:[p.centreX-(p.bounds.min[0]+p.bounds.max[0])/2,ke(p.bounds),d-(p.bounds.min[2]+p.bounds.max[2])/2],anchor:[p.centreX,0,d],size:p.size,footprint:p.footprint})}return{placements:i,xEdge:c,depth:a-r}}function Ce(t){return Math.min(3,Math.max(.6,.08*t))}function Ne(t,e={}){const r=e.neighbourGapFactor??L.neighbourGapFactor,n=e.minGap??L.minGap,s=e.districtGapFactor??L.districtGapFactor,o=e.minDistrictGap??L.minDistrictGap,i=new Map;for(const d of t){const p=i.get(d.groupKey);p?p.push(d):i.set(d.groupKey,[d])}const a=[];let u=0,c=null;for(const d of i.keys()){const p=Be(i.get(d)??[]),y=ht(d,p,0,r,n),b=Ce(Math.max(y.depth,$)),x=y.depth+2*b;c!==null&&(u+=Math.max(o,s*Math.max(c,x)));const h=u;u=h+x,c=x;const{placements:v,xEdge:V}=ht(d,p,h+b,r,n),_={minX:-b,maxX:V+b,minZ:h,maxZ:h+x};a.push({groupKey:d,items:v,extent:_,anchor:[(_.minX+_.maxX)/2,0,_.minZ]})}const l=a.length===0?{minX:0,maxX:0,minZ:0,maxZ:0}:{minX:Math.min(...a.map(d=>d.extent.minX)),maxX:Math.max(...a.map(d=>d.extent.maxX)),minZ:Math.min(...a.map(d=>d.extent.minZ)),maxZ:Math.max(...a.map(d=>d.extent.maxZ))};return{districts:a,extent:l}}const Pt={min:[0,0,0],max:[0,0,0]},Ae=.35,ft=20;function ot(t){return[...t.min,...t.max].every(e=>Number.isFinite(e))}function z(t){return ot(t)?{min:[Math.min(t.min[0],t.max[0]),Math.min(t.min[1],t.max[1]),Math.min(t.min[2],t.max[2])],max:[Math.max(t.min[0],t.max[0]),Math.max(t.min[1],t.max[1]),Math.max(t.min[2],t.max[2])]}:Pt}function Tt(t){const e=z(t);return[e.max[0]-e.min[0],e.max[1]-e.min[1],e.max[2]-e.min[2]]}function K(t){const e=t.map(z).filter(o=>ot(o));if(e.length===0)return Pt;const r=e[0],n=[r.min[0],r.min[1],r.min[2]],s=[r.max[0],r.max[1],r.max[2]];for(let o=1;o<e.length;o++){const i=e[o];n[0]=Math.min(n[0],i.min[0]),n[1]=Math.min(n[1],i.min[1]),n[2]=Math.min(n[2],i.min[2]),s[0]=Math.max(s[0],i.max[0]),s[1]=Math.max(s[1],i.max[1]),s[2]=Math.max(s[2],i.max[2])}return{min:n,max:s}}function U(t,e){const r=z(t);return{min:[r.min[0]+e[0],r.min[1]+e[1],r.min[2]+e[2]],max:[r.max[0]+e[0],r.max[1]+e[1],r.max[2]+e[2]]}}function Le(t){return"min"in t?{bounds:t}:{bounds:t.bounds,...t.overlay===!0?{overlay:!0}:{},...t.enclosure===!0?{enclosure:!0}:{}}}function Ge(t,e={}){if(e.overlay)return"volume";if(e.enclosure)return"environment-scale";const n=[...Tt(t)].sort((a,u)=>u-a),s=n[0]??0,o=n[1]??0;return(n[2]??0)<Ae&&o>=ft&&s>=ft?"unbounded-plane":null}function Fe(t){const e=t.map(Le).map(a=>({bounds:z(a.bounds),overlay:a.overlay===!0,enclosure:a.enclosure===!0})).filter(a=>ot(a.bounds)),r=e.map(a=>a.bounds),n=K(r);if(e.length<2)return{full:n,presence:n,helpers:[]};const s=e.map(a=>Ge(a.bounds,{overlay:a.overlay,enclosure:a.enclosure})),o=e.filter((a,u)=>s[u]===null).map(a=>a.bounds);if(o.length===0)return{full:n,presence:n,helpers:[]};const i=[];for(let a=0;a<e.length;a++){const u=s[a]??null;u!==null&&i.push({kind:u,bounds:e[a].bounds,size:Tt(e[a].bounds)})}return{full:n,presence:K(o),helpers:i}}function $e(t){const e=t.map(u=>({exhibit:u,presence:Fe(u.nodes)})),r=e.map(({exhibit:u,presence:c})=>({id:u.id,groupKey:u.groupKey,bounds:c.presence})),n=Ne(r),s=new Map;for(const u of n.districts)for(const c of u.items)s.set(c.id,c);const o=[],i=[],a=[];for(const{exhibit:u,presence:c}of e){const l=s.get(u.id);l&&(o.push({id:u.id,groupKey:u.groupKey,full:c.full,presence:c.presence,helpers:c.helpers,placement:l}),i.push(U(c.presence,l.translation)),a.push(U(c.full,l.translation)))}return{layout:n,exhibits:o,frame:K(i),fullFrame:K(a)}}const kt="volterBoardStoryId",Bt="volterBoardComponentKey",I="volter:board:no-story";function Ke(t){return{stories:t.length,modules:new Set(t.map(e=>e.modulePath)).size}}const Y="Ungrouped",xt="No story yet",ze=.9;function Ie(t){return t instanceof Error?t.message:String(t)}async function Ve(t,e,r){const n=Date.now();let s=null,o=null;try{s=await r(e),me(s.root)||(s.dispose(),s=null,o="The story mounted no three content.")}catch(a){o=Ie(a)}const i=de();return Ht({id:t.id,ms:Date.now()-n,runtimeMs:i?.runtimeMs??0,loadMs:i?.loadMs??0,fiberMs:i?.fiberMs??0,settleMs:i?.settleMs??0,ok:s!==null}),{identity:t,mounted:s,reason:o}}function Rt(t){t.traverse(e=>{e.layers.enable(he),fe(e,"editorHelper",!0)})}const He={color:3291977,roughness:.92,metalness:.04,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:2},gt=.06,Ze=0,yt=0,Xe=11124182,We=9413565;function Ue(t){const e=t.extent.maxX-t.extent.minX,r=t.extent.maxZ-t.extent.minZ,n=new Dt(new xe(e,gt,r),new ge(He));return n.name=`volter:board-pad:${t.groupKey||Y}`,n.position.set((t.extent.minX+t.extent.maxX)/2,Ze-gt/2,(t.extent.minZ+t.extent.maxZ)/2),n.receiveShadow=!0,Rt(n),n}function Ye(t,e){const r=t/2,n=e/2,s=[[-r,-n],[r,-n],[r,n],[-r,n]],o=[];for(let u=0;u<s.length;u++){const c=s[u],l=s[(u+1)%s.length];o.push(c[0],0,c[1],l[0],0,l[1])}const i=new Se;i.setAttribute("position",new Me(o,3));const a=new Ee(i,new ve({color:Xe,dashSize:.09,gapSize:.06}));return a.computeLineDistances(),a}function qe(t){const e=new R;e.name=`volter:board-ghost:${t.name}`,e.userData[Bt]=t.key;const[r,n]=t.placement.footprint,s=new Dt(new ye(r,n),new be({color:We,transparent:!0,opacity:.1,depthWrite:!1,side:we}));s.rotation.x=-Math.PI/2,s.position.y=yt;const o=Ye(r,n);return o.position.y=yt,e.add(s,o),e.position.set(t.placement.anchor[0],0,t.placement.anchor[2]),e}function Je(t,e,r){if(!r.componentName)return!0;const n=St(t,r.componentName,e);return!n||n.modulePath===e&&n.name===r.name}function Qe(t){return jt(t).length}function jt(t){const e=[],r=new Map,n=tt();for(const s of t)if(s.ok)for(const o of s.stories){const i=Q({modulePath:s.modulePath,regions:n});if(i.medium!=="three"){i.via==="undeclared"&&Kt(s.modulePath,i.reason);continue}if(!Je(t,s.modulePath,o))continue;const a=zt({modulePath:s.modulePath,...o.title===void 0?{}:{title:o.title}}),u=It(a),c=`${u}/${a.leaf}`;r.set(c,(r.get(c)??0)+1),e.push({identity:{id:`${s.modulePath}#${o.name}`,storyName:o.name,modulePath:s.modulePath,groupKey:u,groupLeaf:a.leaf,groupPath:Vt(a)},storyLabel:o.label,Component:o.Component})}return e.map(({identity:s,storyLabel:o,Component:i})=>({identity:{...s,label:(r.get(`${s.groupKey}/${s.groupLeaf}`)??0)>1?`${s.groupLeaf} · ${o}`:s.groupLeaf},Component:i}))}function tn(t,e){const r=new Set,n=[];for(const s of e){if(s.surface!=="three"||s.contentKind==="image")continue;const o=`${s.path}#${s.name}`;r.has(o)||(r.add(o),!St(t,s.name,s.path)&&n.push(s))}return n}function en(t,e,r){const n=new R;return n.name=`volter:board-exhibit:${t.label}`,n.position.set(...e.translation),n.add(r.root),n.userData[kt]=t.id,n}function q(t){return vt(async()=>{t.dispose()})}async function Ct(t,e=[],r){return vt(n=>an(t,e,r,n))}async function nn(t,e,r){const n=[];for(const{identity:s,Component:o}of t){if(e?.aborted)break;n.push(await Ve(s,o,r))}return n}function on(t){return{min:t.min.toArray(),max:t.max.toArray()}}function rn(t){const e=new Map,r=new Map,n=[],s=[];for(const o of t){if(!o.mounted){s.push({id:o.identity.id,modulePath:o.identity.modulePath,storyName:o.identity.storyName,reason:o.reason??"The story produced no Object3D."});continue}const i=pe(o.mounted.root).map(a=>({bounds:on(a.box),overlay:a.overlay,enclosure:a.enclosure}));e.set(o.identity.id,o.mounted),r.set(o.identity.id,o.identity),n.push({id:o.identity.id,groupKey:o.identity.groupKey,nodes:i})}return{mounts:e,identities:r,measures:n,skipped:s}}function sn(t){const e=ze/2;return{id:`${t.path}#${t.name}`,groupKey:I,nodes:[{min:[-e,0,-e],max:[e,0,e]}]}}async function an(t,e,r,n){const s=Date.now(),o=jt(t);O("candidate-collect",Date.now()-s),dt({candidateCount:o.length});const i=Date.now(),a=await nn(o,r,n);O("story-mounts",Date.now()-i);const u=Date.now(),{mounts:c,identities:l,measures:d,skipped:p}=rn(a);O("bounds",Date.now()-u);const y=Date.now(),b=tn(t,e),x=new Map(b.map(f=>[`${f.path}#${f.name}`,f])),h=$e([...d,...b.map(sn)]),v=h.layout,V=new Map(h.exhibits.map(f=>[f.id,f]));O("layout",Date.now()-y);const _=Date.now(),T=new R;T.name="volter:three-board";const k=new R;k.name="volter:board-chrome",Rt(k),T.add(k);const j=[],rt=[],st=[],it=[k];for(const f of v.districts){const M=f.groupKey===I,D=new R;D.name=`volter:board-district:${M?xt:f.groupKey||Y}`,T.add(D),k.add(Ue(f));for(const S of f.items){if(M){const N=x.get(S.id);if(!N)continue;const ut={key:S.id,name:N.name,path:N.path,line:N.line,placement:S},lt=qe(ut);D.add(lt),it.push(lt),st.push(ut);continue}const C=c.get(S.id),H=l.get(S.id),E=V.get(S.id);!C||!H||!E||(D.add(en(H,S,C)),j.push({...H,placement:S,fullSize:[E.full.max[0]-E.full.min[0],E.full.max[1]-E.full.min[1],E.full.max[2]-E.full.min[2]],helpers:E.helpers}))}rt.push({groupKey:f.groupKey,label:M?xt:f.groupKey||Y,placement:f})}const $t=j.flatMap(f=>f.helpers.map(M=>({exhibitId:f.id,exhibitLabel:f.label,kind:M.kind,size:M.size})));let at=!1;const ct={root:T,exhibits:j,districts:rt,ghostSlots:st,skipped:p,frameBounds:h.frame,openingFrameBounds:h.exhibits[0]?U(h.exhibits[0].presence,h.exhibits[0].placement.translation):h.frame,helperVolumes:$t,dispose(){if(!at){at=!0;for(const f of it)f.traverse(M=>{const D=M;D.geometry?.dispose();const S=D.material;if(Array.isArray(S))for(const C of S)C.dispose();else S?.dispose()}),f.removeFromParent();for(const f of c.values())try{f.dispose()}catch(M){console.error("[three-board] a story mount failed to dispose.",M)}c.clear(),T.clear()}}};if(O("assemble",Date.now()-_),dt({exhibitCount:j.length,skippedCount:p.length}),r?.aborted)throw ct.dispose(),new Error("The 3D board build was superseded by a newer one.");return ct}function cn(t){return Nt(t,kt)}function un(t){return Nt(t,Bt)}function Nt(t,e){let r=t;for(;r;){const n=r.userData[e];if(typeof n=="string")return n;r=r.parent}return null}const At="3D";let F=null,Lt=0;const J=new Set;function bt(){Lt++;for(const t of J)t()}function ln(t){return J.add(t),()=>{J.delete(t)}}function dn(){return Lt}function Gt(t){return Number.isFinite(t)?t>=10?`${Math.round(t)} m`:t>=1?`${t.toFixed(1)} m`:`${t.toFixed(2)} m`:"—"}function mn(t,e,r){const n=Ft(e,r);return n?qt(Jt,t,{modulePath:n.modulePath,storyName:n.storyName,title:n.label}):null}function pn(t,e,r){const n=Mn(t,e);if(!n)return null;const s={definitionLocation:()=>({file:n.path,line:n.line})};return r?mt(s,n.key,"definition",r):mt(s,n.key,"definition")}function hn(t){const e=tt(),r=t.filter(o=>o.ok&&Q({modulePath:o.modulePath,regions:e}).medium==="three"),n=w.useRef([]),s=n.current;return(s.length!==r.length||s.some((o,i)=>o!==r[i]))&&(n.current=r),n.current}function fn({documentId:t,active:e,store:r}){const n=w.useSyncExternalStore(Mt,W),s=hn(n),[o,i]=w.useState({status:"idle"});e&&ee(t);const[a,u]=w.useState(e);w.useEffect(()=>{e&&u(!0)},[e]),w.useEffect(()=>{if(!a)return;const p=new AbortController;let y=null;i({status:"building"}),ne(t,{modulesAlreadyLoaded:s.length>0});const b=Date.now();return Et().then(x=>{const h=Date.now()-b;return O("component-index",h,{busyMs:0,waitMs:h}),x.ok||oe.warn(`Component index unavailable, so this board shows no ghost slots: ${x.reason}`,"three-board"),Ct(s,x.ok?x.entries:[],p.signal)}).then(x=>{if(p.signal.aborted){Z(t),q(x);return}y=x,F=x,bt(),re(),i({status:"ready",scene:x})},x=>{if(p.signal.aborted){Z(t);return}i({status:"error",message:x instanceof Error?x.message:String(x)})}),()=>{p.abort(),y?(F===y&&(F=null),q(y),bt()):Z(t)}},[s,a,t]);const c=o.status==="ready"?o.scene:null,l=w.useCallback(()=>{if(!c)throw new Error("The 3D board is still building.");return{root:c.root,dispose(){}}},[c]),d=w.useCallback(p=>{if(mn(r,c,p)!==null)return;const y=pn(c,p);y&&y.then(se)},[c,r]);return m.jsx("div",{style:{position:"relative",flex:1,minHeight:0,pointerEvents:"auto"},children:c?m.jsxs(m.Fragment,{children:[m.jsx(ce,{documentId:t,sourcePath:"Generated from this project’s stories",displayName:At,build:l,active:e,onOpenNode:d,cameraDirection:ue,frameBounds:c.frameBounds,openingFrameBounds:c.openingFrameBounds,dressing:{grid:!0}}),m.jsx(gn,{documentId:t,scene:c,active:e}),m.jsx(xn,{scene:c})]}):m.jsxs("div",{"data-testid":"three-board-status",style:{padding:16,fontSize:12,color:g.content.muted},children:[o.status==="error"&&o.message,o.status==="building"&&le(Qe(s)),o.status==="idle"&&"Open this tab to lay out every story at true scale."]})})}function xn({scene:t}){const[e,r]=w.useState(!1),n=Ke(t.skipped),s=t.districts.filter(o=>o.groupKey!==I).length;return m.jsxs("div",{"data-testid":"three-board-status",style:{position:"absolute",left:8,bottom:8,maxWidth:420,padding:"4px 8px",borderRadius:g.shape.small,background:g.surface.raised,border:`1px solid ${g.boundary.default}`,fontSize:10,color:g.content.muted,pointerEvents:"auto"},children:[t.exhibits.length," exhibit",t.exhibits.length===1?"":"s"," · ",s," ","district",s===1?"":"s",t.helperVolumes.length>0&&m.jsxs(m.Fragment,{children:[" · ",t.helperVolumes.length," helper volume",t.helperVolumes.length===1?"":"s"," at true scale, outside the default frame"]}),t.ghostSlots.length>0&&m.jsxs(m.Fragment,{children:[" · ",t.ghostSlots.length," component",t.ghostSlots.length===1?"":"s"," without stories"]}),t.skipped.length>0&&m.jsxs(m.Fragment,{children:[" · ",m.jsxs("span",{role:"button",tabIndex:0,"aria-expanded":e,onClick:()=>r(o=>!o),onKeyDown:o=>{(o.key===" "||o.key==="Enter")&&(o.preventDefault(),r(i=>!i))},style:{cursor:"pointer",color:g.accent.default},children:[n.stories," ",n.stories===1?"story":"stories"," in ",n.modules," ",n.modules===1?"module":"modules"," not on this board"]})]}),e&&m.jsx("div",{style:{marginTop:4,maxHeight:160,overflow:"auto"},children:t.skipped.map(o=>m.jsxs("div",{style:{padding:"1px 0"},children:[m.jsxs("code",{style:{color:g.content.dim},children:[o.modulePath,"#",o.storyName]})," ","— ",o.reason]},o.id))})]})}function gn({documentId:t,scene:e,active:r}){const n=w.useRef(null),[s,o]=w.useState([]);return w.useEffect(()=>{if(!r)return;let i=0,a=!1;const u=yn(e),c=()=>{if(a)return;i=requestAnimationFrame(c);const l=n.current,d=ae(t);!l||!d||l.clientWidth===0||l.clientHeight===0||o(bn(u,d.camera(),l.clientWidth,l.clientHeight))};return i=requestAnimationFrame(c),()=>{a=!0,cancelAnimationFrame(i)}},[r,t,e]),m.jsx("div",{ref:n,"data-testid":"three-board-labels",style:{position:"absolute",inset:-12,pointerEvents:"none",overflow:"hidden"},children:s.map(i=>m.jsxs("div",{style:{position:"absolute",left:i.x,top:i.y,transform:"translate(-50%, -100%)",whiteSpace:"nowrap",padding:i.district?"2px 7px":"1px 5px",borderRadius:g.shape.small,background:g.surface.raised,border:`1px ${i.ghost?"dashed":"solid"} ${i.district&&!i.ghost?g.accent.default:g.boundary.default}`,color:i.district&&!i.ghost?g.content.primary:g.content.muted,fontSize:i.district?12:10,fontWeight:i.district?600:400,opacity:i.ghost?.9:1},children:[i.text,m.jsx("span",{style:{marginLeft:6,color:g.content.dim,fontWeight:400},children:i.detail})]},i.key))})}const B=new P;function wt(t){return[t.anchor[0],0,t.anchor[2]-t.footprint[1]/2]}function yn(t){return[...t.districts.map(e=>{const r=e.groupKey===I,n=e.placement.items.length;return{key:`district:${e.groupKey}`,text:e.label,detail:r?`${n} component${n===1?"":"s"}`:`${n} exhibit${n===1?"":"s"}`,district:!0,ghost:r,point:e.placement.anchor}}),...t.exhibits.map(e=>({key:`exhibit:${e.id}`,text:e.label,detail:Gt(e.placement.size[1]),district:!1,ghost:!1,point:wt(e.placement)})),...t.ghostSlots.map(e=>({key:`ghost:${e.key}`,text:e.name,detail:"No story yet",district:!1,ghost:!0,point:wt(e.placement)}))]}function bn(t,e,r,n){e.updateMatrixWorld();const s=[];for(const o of t)B.set(o.point[0],o.point[1],o.point[2]).project(e),!(B.z>1)&&s.push({key:o.key,text:o.text,detail:o.detail,district:o.district,ghost:o.ghost,x:(B.x*.5+.5)*r,y:(-B.y*.5+.5)*n,depth:B.z});return Sn(s).sort((o,i)=>i.depth-o.depth)}function wn(t){const e=t.district?12:10,r=(t.text.length+t.detail.length)*e*.62+24,n=e+8;return[t.x-r/2,t.y-n,t.x+r/2,t.y]}function Sn(t){const e=[...t].sort((n,s)=>(s.district?1:0)-(n.district?1:0)||n.depth-s.depth),r=[];for(const n of e){const s=wn(n);r.some(i=>s[0]<i.rect[2]&&s[2]>i.rect[0]&&s[1]<i.rect[3]&&s[3]>i.rect[1])||r.push({label:n,rect:s})}return r.map(n=>n.label)}function Ft(t,e){if(!t)return null;const r=cn(e);return r?t.exhibits.find(n=>n.id===r)??null:null}function Mn(t,e){if(!t)return null;const r=un(e);return r?t.ghostSlots.find(n=>n.key===r)??null:null}function En({adapter:t,nodeId:e}){w.useSyncExternalStore(ln,dn);const n=[...e?[e]:[],...t.selection?.get()??[]].reduce((s,o)=>s??Ft(F,ie(t.hierarchy,o)),null);return m.jsx("div",{"data-testid":"inspector-exhibit",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${g.boundary.default}`},children:n?m.jsxs("div",{style:{display:"grid",gap:3,fontSize:11},children:[m.jsx("div",{style:{color:g.content.primary,fontWeight:600},children:n.label}),m.jsx(G,{label:"Story",value:n.storyName}),m.jsx(G,{label:"Group",value:n.groupPath}),m.jsx(G,{label:"Module",value:n.modulePath}),m.jsx(G,{label:"Size",value:n.placement.size.map(s=>Gt(s)).join(" × ")})]}):m.jsx("div",{style:{fontSize:11,color:g.content.dim},children:"Pick an exhibit to read its story."})})}function G({label:t,value:e}){return m.jsxs("div",{style:{display:"flex",gap:6},children:[m.jsx("span",{style:{width:52,flexShrink:0,color:g.content.muted},children:t}),m.jsx("code",{style:{color:g.content.primary,overflow:"hidden",textOverflow:"ellipsis"},title:e,children:e})]})}const vn=Qt();function Dn(){vn.ensure(t=>{t(Zt({match:()=>Ut()?.descriptor.id===X,id:"exhibit",title:"Exhibit",icon:Wt,order:Xt,Section:En}))})}const _n={revision:()=>JSON.stringify(W().map(t=>t.modulePath)),subscribe:Mt,capture:async t=>{await te();const e=tt(),r=W().filter(o=>o.ok&&Q({modulePath:o.modulePath,regions:e}).medium==="three"),n=await Et(),s=await Ct(r,n.ok?n.entries:[]);try{const{captureAuthoredThreeScenePreview:o}=await A(async()=>{const{captureAuthoredThreeScenePreview:h}=await import("./document-preview-three-BGSnBaa1.js");return{captureAuthoredThreeScenePreview:h}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),{createStandardEnvironment:i}=await A(async()=>{const{createStandardEnvironment:h}=await import("./environment-Dg-YaLsA.js");return{createStandardEnvironment:h}},__vite__mapDeps([19,17,14,20,21,22])),{applyStandardViewportDressing:a}=await A(async()=>{const{applyStandardViewportDressing:h}=await import("./standard-viewport-dressing-KeudiGw3.js").then(v=>v.d);return{applyStandardViewportDressing:h}},__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,19,17,20,21,22,24])),{isEditorOwnedObject:u}=await A(async()=>{const{isEditorOwnedObject:h}=await import("./editor-layers-kBpG49pG.js");return{isEditorOwnedObject:h}},__vite__mapDeps([15,3,4,5,6,7,8,9,10,11,12,13]));s.root.traverse(h=>{u(h)&&(h.visible=!1)});const c=new De;c.add(s.root);const l=new _e(new P(...s.frameBounds.min),new P(...s.frameBounds.max)),d=l.isEmpty()?new P:l.getCenter(new P),y=(l.isEmpty()?1:Math.max(.01,l.getBoundingSphere(new Oe).radius))/Math.sin(Pe.degToRad(42/2))*1.15,b=d.clone().addScaledVector(new P(1,.75,1).normalize(),y),x={...t,camera:{position:b,target:d,fov:42}};return o(s.root,c,x,h=>{const v=a(c,{environment:i(h),background:!1});return()=>v.dispose()})}finally{await q(s)}}};function ho(t){return Dn(),Yt({id:X,title:At,kind:"content-browser",workspaceRole:"workspace-reference",Content:e=>m.jsx(fn,{...e,store:t}),readOnly:!0,preview:_n,presentation:()=>({kind:"workspace",id:X})},{category:"canvas"})}export{En as BoardExhibitSection,X as THREE_COMPONENTS_DOCUMENT_ID,Dn as ensureThreeBoardContributionsRegistered,ho as installThreeBoardDocument,mn as openExhibitStoryDocument,pn as openGhostComponentSource};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/document-preview-three-6-rt0s3D.js","assets/content-bounds-wsarq3YV.js","assets/hierarchy-marks-DDtpJ7PB.js","assets/workspace-arrangement-Dinn7b-i.js","assets/index-DmNeCiAo.js","assets/index-nmcBqr7Y.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/index-CPiRKiDC.css","assets/three.core-3arARmh6.js","assets/editor-layers-DVuMw5f5.js","assets/renderer-ownership-BovSEcLv.js","assets/three.module-BLhyNg0e.js","assets/scene-framing-B4Ynn1mk.js","assets/environment-Dg-YaLsA.js","assets/RoomEnvironment-BkknvS_I.js","assets/EXRLoader-CITMBvGd.js","assets/HDRLoader-BTGuGhVo.js","assets/standard-viewport-dressing-8SWhTXK3.js","assets/user-data-DvKLhMGu.js"])))=>i.map(i=>d[i]);
2
+ import{hg as O,hh as dt,au as Q,aw as Kt,bi as zt,fV as It,bj as Vt,fW as St,av as tt,hi as Ht,al as g,eM as Zt,dT as Xt,hj as Wt,f5 as Ut,fg as X,dK as Yt,as as Mt,hk as qt,fn as Jt,gF as mt,eO as Qt,b9 as te,at as W,cC as Et,_ as A,hl as ee,hm as ne,Z as oe,hn as Z,ho as re,dv as se}from"./index-DmNeCiAo.js";import{a as m}from"./jsx-runtime-DPjLkJKQ.js";import{a as ie}from"./three-contract-Dkt6PmWY.js";import{a as ae}from"./object3d-document-session-registry-jcgiK59f.js";import{O as ce}from"./Object3DDocumentViewport-ClruThDB.js";import{S as ue}from"./standard-viewport-dressing-8SWhTXK3.js";import{t as le}from"./viewport-surface-status-DKyxV0Lz.js";import{r as w}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{withStoryMountTurn as vt,lastStoryMountPhaseTiming as de}from"./story-three-preview-CsLEpAYI.js";import{m as me}from"./three-story-model-CgIBLb2f.js";import{c as pe}from"./content-bounds-wsarq3YV.js";import{EDITOR_LAYER as he}from"./editor-layers-DVuMw5f5.js";import{setUserData as fe}from"./user-data-CODoGZqA.js";import{bh as R,co as Dt,K as xe,cx as ge,db as ye,cp as be,aI as we,N as Se,a$ as Me,c0 as Ee,b_ as ve,el as De,I as _e,fo as P,ex as Oe,cj as Pe}from"./three.core-3arARmh6.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./environment-Dg-YaLsA.js";import"./three.module-BLhyNg0e.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";import"./user-data-DvKLhMGu.js";import"./workspace-arrangement-Dinn7b-i.js";import"./asset-preview-agZh9kpZ.js";import"./renderer-ownership-BovSEcLv.js";import"./hierarchy-marks-DDtpJ7PB.js";import"./studio-environment-DsQ4K1L8.js";import"./KTX2Loader-CaqVE6nY.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";import"./bitmap-label-Ct4k6ehY.js";import"./crash-null-boundary-v3a0uEgw.js";import"./events-156d8d12.esm-DmeaOP4r.js";import"./index-DzuOGwVB.js";import"./story-mount-turn-DFRTj5hi.js";import"./object-marks-BnvSuCTt.js";const L={neighbourGapFactor:.45,minGap:.5,districtGapFactor:.6,minDistrictGap:3},$=.7,Te={min:[0,0,0],max:[0,0,0]};function et(t){return[...t.min,...t.max].some(r=>!Number.isFinite(r))?Te:{min:[Math.min(t.min[0],t.max[0]),Math.min(t.min[1],t.max[1]),Math.min(t.min[2],t.max[2])],max:[Math.max(t.min[0],t.max[0]),Math.max(t.min[1],t.max[1]),Math.max(t.min[2],t.max[2])]}}function nt(t){return[t.max[0]-t.min[0],t.max[1]-t.min[1],t.max[2]-t.min[2]]}function pt(t){const e=nt(et(t));return e[0]*e[2]}function ke(t){return-et(t).min[1]}function _t(t){const e=Math.max(t[0],t[2]),r=Math.max(.15,.1*e);return[Math.max(t[0]+2*r,$),Math.max(t[2]+2*r,$)]}function Ot(t){return Math.max(t[0],t[1])}function Be(t){return t.map(e=>({item:e,bounds:et(e.bounds)})).sort((e,r)=>{const n=pt(e.bounds)-pt(r.bounds);return n!==0?n:e.item.id<r.item.id?-1:1})}function Re(t){const e=Math.max($,...t.map(({bounds:r})=>Ot(_t(nt(r)))));return Math.max(10,2.2*e)}function je(t,e,r){const n=Re(t),s=[];let o={slots:[],xEdge:0,depth:0,previousSpan:null};const i=()=>{o.slots.length>0&&s.push({slots:o.slots,xEdge:o.xEdge,depth:o.depth}),o={slots:[],xEdge:0,depth:0,previousSpan:null}};for(const{item:a,bounds:u}of t){const c=nt(u),l=_t(c),d=Ot(l),p=o.previousSpan===null?0:Math.max(r,e*Math.max(o.previousSpan,d));o.slots.length>0&&o.xEdge+p+l[0]>n&&i();const y=o.previousSpan===null?0:p,b=o.xEdge+y+l[0]/2;o.xEdge=b+l[0]/2,o.depth=Math.max(o.depth,l[1]),o.previousSpan=d,o.slots.push({item:a,bounds:u,size:c,footprint:l,centreX:b})}return i(),s}function ht(t,e,r,n,s){const o=je(e,n,s),i=[];let a=r,u=null,c=0;for(const l of o){u!==null&&(a+=Math.max(s,n*Math.max(u,l.depth)));const d=a+l.depth/2;a=d+l.depth/2,u=l.depth,c=Math.max(c,l.xEdge);for(const p of l.slots)i.push({id:p.item.id,groupKey:t,translation:[p.centreX-(p.bounds.min[0]+p.bounds.max[0])/2,ke(p.bounds),d-(p.bounds.min[2]+p.bounds.max[2])/2],anchor:[p.centreX,0,d],size:p.size,footprint:p.footprint})}return{placements:i,xEdge:c,depth:a-r}}function Ce(t){return Math.min(3,Math.max(.6,.08*t))}function Ne(t,e={}){const r=e.neighbourGapFactor??L.neighbourGapFactor,n=e.minGap??L.minGap,s=e.districtGapFactor??L.districtGapFactor,o=e.minDistrictGap??L.minDistrictGap,i=new Map;for(const d of t){const p=i.get(d.groupKey);p?p.push(d):i.set(d.groupKey,[d])}const a=[];let u=0,c=null;for(const d of i.keys()){const p=Be(i.get(d)??[]),y=ht(d,p,0,r,n),b=Ce(Math.max(y.depth,$)),x=y.depth+2*b;c!==null&&(u+=Math.max(o,s*Math.max(c,x)));const h=u;u=h+x,c=x;const{placements:v,xEdge:V}=ht(d,p,h+b,r,n),_={minX:-b,maxX:V+b,minZ:h,maxZ:h+x};a.push({groupKey:d,items:v,extent:_,anchor:[(_.minX+_.maxX)/2,0,_.minZ]})}const l=a.length===0?{minX:0,maxX:0,minZ:0,maxZ:0}:{minX:Math.min(...a.map(d=>d.extent.minX)),maxX:Math.max(...a.map(d=>d.extent.maxX)),minZ:Math.min(...a.map(d=>d.extent.minZ)),maxZ:Math.max(...a.map(d=>d.extent.maxZ))};return{districts:a,extent:l}}const Pt={min:[0,0,0],max:[0,0,0]},Ae=.35,ft=20;function ot(t){return[...t.min,...t.max].every(e=>Number.isFinite(e))}function z(t){return ot(t)?{min:[Math.min(t.min[0],t.max[0]),Math.min(t.min[1],t.max[1]),Math.min(t.min[2],t.max[2])],max:[Math.max(t.min[0],t.max[0]),Math.max(t.min[1],t.max[1]),Math.max(t.min[2],t.max[2])]}:Pt}function Tt(t){const e=z(t);return[e.max[0]-e.min[0],e.max[1]-e.min[1],e.max[2]-e.min[2]]}function K(t){const e=t.map(z).filter(o=>ot(o));if(e.length===0)return Pt;const r=e[0],n=[r.min[0],r.min[1],r.min[2]],s=[r.max[0],r.max[1],r.max[2]];for(let o=1;o<e.length;o++){const i=e[o];n[0]=Math.min(n[0],i.min[0]),n[1]=Math.min(n[1],i.min[1]),n[2]=Math.min(n[2],i.min[2]),s[0]=Math.max(s[0],i.max[0]),s[1]=Math.max(s[1],i.max[1]),s[2]=Math.max(s[2],i.max[2])}return{min:n,max:s}}function U(t,e){const r=z(t);return{min:[r.min[0]+e[0],r.min[1]+e[1],r.min[2]+e[2]],max:[r.max[0]+e[0],r.max[1]+e[1],r.max[2]+e[2]]}}function Le(t){return"min"in t?{bounds:t}:{bounds:t.bounds,...t.overlay===!0?{overlay:!0}:{},...t.enclosure===!0?{enclosure:!0}:{}}}function Ge(t,e={}){if(e.overlay)return"volume";if(e.enclosure)return"environment-scale";const n=[...Tt(t)].sort((a,u)=>u-a),s=n[0]??0,o=n[1]??0;return(n[2]??0)<Ae&&o>=ft&&s>=ft?"unbounded-plane":null}function Fe(t){const e=t.map(Le).map(a=>({bounds:z(a.bounds),overlay:a.overlay===!0,enclosure:a.enclosure===!0})).filter(a=>ot(a.bounds)),r=e.map(a=>a.bounds),n=K(r);if(e.length<2)return{full:n,presence:n,helpers:[]};const s=e.map(a=>Ge(a.bounds,{overlay:a.overlay,enclosure:a.enclosure})),o=e.filter((a,u)=>s[u]===null).map(a=>a.bounds);if(o.length===0)return{full:n,presence:n,helpers:[]};const i=[];for(let a=0;a<e.length;a++){const u=s[a]??null;u!==null&&i.push({kind:u,bounds:e[a].bounds,size:Tt(e[a].bounds)})}return{full:n,presence:K(o),helpers:i}}function $e(t){const e=t.map(u=>({exhibit:u,presence:Fe(u.nodes)})),r=e.map(({exhibit:u,presence:c})=>({id:u.id,groupKey:u.groupKey,bounds:c.presence})),n=Ne(r),s=new Map;for(const u of n.districts)for(const c of u.items)s.set(c.id,c);const o=[],i=[],a=[];for(const{exhibit:u,presence:c}of e){const l=s.get(u.id);l&&(o.push({id:u.id,groupKey:u.groupKey,full:c.full,presence:c.presence,helpers:c.helpers,placement:l}),i.push(U(c.presence,l.translation)),a.push(U(c.full,l.translation)))}return{layout:n,exhibits:o,frame:K(i),fullFrame:K(a)}}const kt="volterBoardStoryId",Bt="volterBoardComponentKey",I="volter:board:no-story";function Ke(t){return{stories:t.length,modules:new Set(t.map(e=>e.modulePath)).size}}const Y="Ungrouped",xt="No story yet",ze=.9;function Ie(t){return t instanceof Error?t.message:String(t)}async function Ve(t,e,r){const n=Date.now();let s=null,o=null;try{s=await r(e),me(s.root)||(s.dispose(),s=null,o="The story mounted no three content.")}catch(a){o=Ie(a)}const i=de();return Ht({id:t.id,ms:Date.now()-n,runtimeMs:i?.runtimeMs??0,loadMs:i?.loadMs??0,fiberMs:i?.fiberMs??0,settleMs:i?.settleMs??0,ok:s!==null}),{identity:t,mounted:s,reason:o}}function Rt(t){t.traverse(e=>{e.layers.enable(he),fe(e,"editorHelper",!0)})}const He={color:3291977,roughness:.92,metalness:.04,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:2},gt=.06,Ze=0,yt=0,Xe=11124182,We=9413565;function Ue(t){const e=t.extent.maxX-t.extent.minX,r=t.extent.maxZ-t.extent.minZ,n=new Dt(new xe(e,gt,r),new ge(He));return n.name=`volter:board-pad:${t.groupKey||Y}`,n.position.set((t.extent.minX+t.extent.maxX)/2,Ze-gt/2,(t.extent.minZ+t.extent.maxZ)/2),n.receiveShadow=!0,Rt(n),n}function Ye(t,e){const r=t/2,n=e/2,s=[[-r,-n],[r,-n],[r,n],[-r,n]],o=[];for(let u=0;u<s.length;u++){const c=s[u],l=s[(u+1)%s.length];o.push(c[0],0,c[1],l[0],0,l[1])}const i=new Se;i.setAttribute("position",new Me(o,3));const a=new Ee(i,new ve({color:Xe,dashSize:.09,gapSize:.06}));return a.computeLineDistances(),a}function qe(t){const e=new R;e.name=`volter:board-ghost:${t.name}`,e.userData[Bt]=t.key;const[r,n]=t.placement.footprint,s=new Dt(new ye(r,n),new be({color:We,transparent:!0,opacity:.1,depthWrite:!1,side:we}));s.rotation.x=-Math.PI/2,s.position.y=yt;const o=Ye(r,n);return o.position.y=yt,e.add(s,o),e.position.set(t.placement.anchor[0],0,t.placement.anchor[2]),e}function Je(t,e,r){if(!r.componentName)return!0;const n=St(t,r.componentName,e);return!n||n.modulePath===e&&n.name===r.name}function Qe(t){return jt(t).length}function jt(t){const e=[],r=new Map,n=tt();for(const s of t)if(s.ok)for(const o of s.stories){const i=Q({modulePath:s.modulePath,regions:n});if(i.medium!=="three"){i.via==="undeclared"&&Kt(s.modulePath,i.reason);continue}if(!Je(t,s.modulePath,o))continue;const a=zt({modulePath:s.modulePath,...o.title===void 0?{}:{title:o.title}}),u=It(a),c=`${u}/${a.leaf}`;r.set(c,(r.get(c)??0)+1),e.push({identity:{id:`${s.modulePath}#${o.name}`,storyName:o.name,modulePath:s.modulePath,groupKey:u,groupLeaf:a.leaf,groupPath:Vt(a)},storyLabel:o.label,Component:o.Component})}return e.map(({identity:s,storyLabel:o,Component:i})=>({identity:{...s,label:(r.get(`${s.groupKey}/${s.groupLeaf}`)??0)>1?`${s.groupLeaf} · ${o}`:s.groupLeaf},Component:i}))}function tn(t,e){const r=new Set,n=[];for(const s of e){if(s.surface!=="three"||s.contentKind==="image")continue;const o=`${s.path}#${s.name}`;r.has(o)||(r.add(o),!St(t,s.name,s.path)&&n.push(s))}return n}function en(t,e,r){const n=new R;return n.name=`volter:board-exhibit:${t.label}`,n.position.set(...e.translation),n.add(r.root),n.userData[kt]=t.id,n}function q(t){return vt(async()=>{t.dispose()})}async function Ct(t,e=[],r){return vt(n=>an(t,e,r,n))}async function nn(t,e,r){const n=[];for(const{identity:s,Component:o}of t){if(e?.aborted)break;n.push(await Ve(s,o,r))}return n}function on(t){return{min:t.min.toArray(),max:t.max.toArray()}}function rn(t){const e=new Map,r=new Map,n=[],s=[];for(const o of t){if(!o.mounted){s.push({id:o.identity.id,modulePath:o.identity.modulePath,storyName:o.identity.storyName,reason:o.reason??"The story produced no Object3D."});continue}const i=pe(o.mounted.root).map(a=>({bounds:on(a.box),overlay:a.overlay,enclosure:a.enclosure}));e.set(o.identity.id,o.mounted),r.set(o.identity.id,o.identity),n.push({id:o.identity.id,groupKey:o.identity.groupKey,nodes:i})}return{mounts:e,identities:r,measures:n,skipped:s}}function sn(t){const e=ze/2;return{id:`${t.path}#${t.name}`,groupKey:I,nodes:[{min:[-e,0,-e],max:[e,0,e]}]}}async function an(t,e,r,n){const s=Date.now(),o=jt(t);O("candidate-collect",Date.now()-s),dt({candidateCount:o.length});const i=Date.now(),a=await nn(o,r,n);O("story-mounts",Date.now()-i);const u=Date.now(),{mounts:c,identities:l,measures:d,skipped:p}=rn(a);O("bounds",Date.now()-u);const y=Date.now(),b=tn(t,e),x=new Map(b.map(f=>[`${f.path}#${f.name}`,f])),h=$e([...d,...b.map(sn)]),v=h.layout,V=new Map(h.exhibits.map(f=>[f.id,f]));O("layout",Date.now()-y);const _=Date.now(),T=new R;T.name="volter:three-board";const k=new R;k.name="volter:board-chrome",Rt(k),T.add(k);const j=[],rt=[],st=[],it=[k];for(const f of v.districts){const M=f.groupKey===I,D=new R;D.name=`volter:board-district:${M?xt:f.groupKey||Y}`,T.add(D),k.add(Ue(f));for(const S of f.items){if(M){const N=x.get(S.id);if(!N)continue;const ut={key:S.id,name:N.name,path:N.path,line:N.line,placement:S},lt=qe(ut);D.add(lt),it.push(lt),st.push(ut);continue}const C=c.get(S.id),H=l.get(S.id),E=V.get(S.id);!C||!H||!E||(D.add(en(H,S,C)),j.push({...H,placement:S,fullSize:[E.full.max[0]-E.full.min[0],E.full.max[1]-E.full.min[1],E.full.max[2]-E.full.min[2]],helpers:E.helpers}))}rt.push({groupKey:f.groupKey,label:M?xt:f.groupKey||Y,placement:f})}const $t=j.flatMap(f=>f.helpers.map(M=>({exhibitId:f.id,exhibitLabel:f.label,kind:M.kind,size:M.size})));let at=!1;const ct={root:T,exhibits:j,districts:rt,ghostSlots:st,skipped:p,frameBounds:h.frame,openingFrameBounds:h.exhibits[0]?U(h.exhibits[0].presence,h.exhibits[0].placement.translation):h.frame,helperVolumes:$t,dispose(){if(!at){at=!0;for(const f of it)f.traverse(M=>{const D=M;D.geometry?.dispose();const S=D.material;if(Array.isArray(S))for(const C of S)C.dispose();else S?.dispose()}),f.removeFromParent();for(const f of c.values())try{f.dispose()}catch(M){console.error("[three-board] a story mount failed to dispose.",M)}c.clear(),T.clear()}}};if(O("assemble",Date.now()-_),dt({exhibitCount:j.length,skippedCount:p.length}),r?.aborted)throw ct.dispose(),new Error("The 3D board build was superseded by a newer one.");return ct}function cn(t){return Nt(t,kt)}function un(t){return Nt(t,Bt)}function Nt(t,e){let r=t;for(;r;){const n=r.userData[e];if(typeof n=="string")return n;r=r.parent}return null}const At="3D";let F=null,Lt=0;const J=new Set;function bt(){Lt++;for(const t of J)t()}function ln(t){return J.add(t),()=>{J.delete(t)}}function dn(){return Lt}function Gt(t){return Number.isFinite(t)?t>=10?`${Math.round(t)} m`:t>=1?`${t.toFixed(1)} m`:`${t.toFixed(2)} m`:"—"}function mn(t,e,r){const n=Ft(e,r);return n?qt(Jt,t,{modulePath:n.modulePath,storyName:n.storyName,title:n.label}):null}function pn(t,e,r){const n=Mn(t,e);if(!n)return null;const s={definitionLocation:()=>({file:n.path,line:n.line})};return r?mt(s,n.key,"definition",r):mt(s,n.key,"definition")}function hn(t){const e=tt(),r=t.filter(o=>o.ok&&Q({modulePath:o.modulePath,regions:e}).medium==="three"),n=w.useRef([]),s=n.current;return(s.length!==r.length||s.some((o,i)=>o!==r[i]))&&(n.current=r),n.current}function fn({documentId:t,active:e,store:r}){const n=w.useSyncExternalStore(Mt,W),s=hn(n),[o,i]=w.useState({status:"idle"});e&&ee(t);const[a,u]=w.useState(e);w.useEffect(()=>{e&&u(!0)},[e]),w.useEffect(()=>{if(!a)return;const p=new AbortController;let y=null;i({status:"building"}),ne(t,{modulesAlreadyLoaded:s.length>0});const b=Date.now();return Et().then(x=>{const h=Date.now()-b;return O("component-index",h,{busyMs:0,waitMs:h}),x.ok||oe.warn(`Component index unavailable, so this board shows no ghost slots: ${x.reason}`,"three-board"),Ct(s,x.ok?x.entries:[],p.signal)}).then(x=>{if(p.signal.aborted){Z(t),q(x);return}y=x,F=x,bt(),re(),i({status:"ready",scene:x})},x=>{if(p.signal.aborted){Z(t);return}i({status:"error",message:x instanceof Error?x.message:String(x)})}),()=>{p.abort(),y?(F===y&&(F=null),q(y),bt()):Z(t)}},[s,a,t]);const c=o.status==="ready"?o.scene:null,l=w.useCallback(()=>{if(!c)throw new Error("The 3D board is still building.");return{root:c.root,dispose(){}}},[c]),d=w.useCallback(p=>{if(mn(r,c,p)!==null)return;const y=pn(c,p);y&&y.then(se)},[c,r]);return m.jsx("div",{style:{position:"relative",flex:1,minHeight:0,pointerEvents:"auto"},children:c?m.jsxs(m.Fragment,{children:[m.jsx(ce,{documentId:t,sourcePath:"Generated from this project’s stories",displayName:At,build:l,active:e,onOpenNode:d,cameraDirection:ue,frameBounds:c.frameBounds,openingFrameBounds:c.openingFrameBounds,dressing:{grid:!0}}),m.jsx(gn,{documentId:t,scene:c,active:e}),m.jsx(xn,{scene:c})]}):m.jsxs("div",{"data-testid":"three-board-status",style:{padding:16,fontSize:12,color:g.content.muted},children:[o.status==="error"&&o.message,o.status==="building"&&le(Qe(s)),o.status==="idle"&&"Open this tab to lay out every story at true scale."]})})}function xn({scene:t}){const[e,r]=w.useState(!1),n=Ke(t.skipped),s=t.districts.filter(o=>o.groupKey!==I).length;return m.jsxs("div",{"data-testid":"three-board-status",style:{position:"absolute",left:8,bottom:8,maxWidth:420,padding:"4px 8px",borderRadius:g.shape.small,background:g.surface.raised,border:`1px solid ${g.boundary.default}`,fontSize:10,color:g.content.muted,pointerEvents:"auto"},children:[t.exhibits.length," exhibit",t.exhibits.length===1?"":"s"," · ",s," ","district",s===1?"":"s",t.helperVolumes.length>0&&m.jsxs(m.Fragment,{children:[" · ",t.helperVolumes.length," helper volume",t.helperVolumes.length===1?"":"s"," at true scale, outside the default frame"]}),t.ghostSlots.length>0&&m.jsxs(m.Fragment,{children:[" · ",t.ghostSlots.length," component",t.ghostSlots.length===1?"":"s"," without stories"]}),t.skipped.length>0&&m.jsxs(m.Fragment,{children:[" · ",m.jsxs("span",{role:"button",tabIndex:0,"aria-expanded":e,onClick:()=>r(o=>!o),onKeyDown:o=>{(o.key===" "||o.key==="Enter")&&(o.preventDefault(),r(i=>!i))},style:{cursor:"pointer",color:g.accent.default},children:[n.stories," ",n.stories===1?"story":"stories"," in ",n.modules," ",n.modules===1?"module":"modules"," not on this board"]})]}),e&&m.jsx("div",{style:{marginTop:4,maxHeight:160,overflow:"auto"},children:t.skipped.map(o=>m.jsxs("div",{style:{padding:"1px 0"},children:[m.jsxs("code",{style:{color:g.content.dim},children:[o.modulePath,"#",o.storyName]})," ","— ",o.reason]},o.id))})]})}function gn({documentId:t,scene:e,active:r}){const n=w.useRef(null),[s,o]=w.useState([]);return w.useEffect(()=>{if(!r)return;let i=0,a=!1;const u=yn(e),c=()=>{if(a)return;i=requestAnimationFrame(c);const l=n.current,d=ae(t);!l||!d||l.clientWidth===0||l.clientHeight===0||o(bn(u,d.camera(),l.clientWidth,l.clientHeight))};return i=requestAnimationFrame(c),()=>{a=!0,cancelAnimationFrame(i)}},[r,t,e]),m.jsx("div",{ref:n,"data-testid":"three-board-labels",style:{position:"absolute",inset:-12,pointerEvents:"none",overflow:"hidden"},children:s.map(i=>m.jsxs("div",{style:{position:"absolute",left:i.x,top:i.y,transform:"translate(-50%, -100%)",whiteSpace:"nowrap",padding:i.district?"2px 7px":"1px 5px",borderRadius:g.shape.small,background:g.surface.raised,border:`1px ${i.ghost?"dashed":"solid"} ${i.district&&!i.ghost?g.accent.default:g.boundary.default}`,color:i.district&&!i.ghost?g.content.primary:g.content.muted,fontSize:i.district?12:10,fontWeight:i.district?600:400,opacity:i.ghost?.9:1},children:[i.text,m.jsx("span",{style:{marginLeft:6,color:g.content.dim,fontWeight:400},children:i.detail})]},i.key))})}const B=new P;function wt(t){return[t.anchor[0],0,t.anchor[2]-t.footprint[1]/2]}function yn(t){return[...t.districts.map(e=>{const r=e.groupKey===I,n=e.placement.items.length;return{key:`district:${e.groupKey}`,text:e.label,detail:r?`${n} component${n===1?"":"s"}`:`${n} exhibit${n===1?"":"s"}`,district:!0,ghost:r,point:e.placement.anchor}}),...t.exhibits.map(e=>({key:`exhibit:${e.id}`,text:e.label,detail:Gt(e.placement.size[1]),district:!1,ghost:!1,point:wt(e.placement)})),...t.ghostSlots.map(e=>({key:`ghost:${e.key}`,text:e.name,detail:"No story yet",district:!1,ghost:!0,point:wt(e.placement)}))]}function bn(t,e,r,n){e.updateMatrixWorld();const s=[];for(const o of t)B.set(o.point[0],o.point[1],o.point[2]).project(e),!(B.z>1)&&s.push({key:o.key,text:o.text,detail:o.detail,district:o.district,ghost:o.ghost,x:(B.x*.5+.5)*r,y:(-B.y*.5+.5)*n,depth:B.z});return Sn(s).sort((o,i)=>i.depth-o.depth)}function wn(t){const e=t.district?12:10,r=(t.text.length+t.detail.length)*e*.62+24,n=e+8;return[t.x-r/2,t.y-n,t.x+r/2,t.y]}function Sn(t){const e=[...t].sort((n,s)=>(s.district?1:0)-(n.district?1:0)||n.depth-s.depth),r=[];for(const n of e){const s=wn(n);r.some(i=>s[0]<i.rect[2]&&s[2]>i.rect[0]&&s[1]<i.rect[3]&&s[3]>i.rect[1])||r.push({label:n,rect:s})}return r.map(n=>n.label)}function Ft(t,e){if(!t)return null;const r=cn(e);return r?t.exhibits.find(n=>n.id===r)??null:null}function Mn(t,e){if(!t)return null;const r=un(e);return r?t.ghostSlots.find(n=>n.key===r)??null:null}function En({adapter:t,nodeId:e}){w.useSyncExternalStore(ln,dn);const n=[...e?[e]:[],...t.selection?.get()??[]].reduce((s,o)=>s??Ft(F,ie(t.hierarchy,o)),null);return m.jsx("div",{"data-testid":"inspector-exhibit",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${g.boundary.default}`},children:n?m.jsxs("div",{style:{display:"grid",gap:3,fontSize:11},children:[m.jsx("div",{style:{color:g.content.primary,fontWeight:600},children:n.label}),m.jsx(G,{label:"Story",value:n.storyName}),m.jsx(G,{label:"Group",value:n.groupPath}),m.jsx(G,{label:"Module",value:n.modulePath}),m.jsx(G,{label:"Size",value:n.placement.size.map(s=>Gt(s)).join(" × ")})]}):m.jsx("div",{style:{fontSize:11,color:g.content.dim},children:"Pick an exhibit to read its story."})})}function G({label:t,value:e}){return m.jsxs("div",{style:{display:"flex",gap:6},children:[m.jsx("span",{style:{width:52,flexShrink:0,color:g.content.muted},children:t}),m.jsx("code",{style:{color:g.content.primary,overflow:"hidden",textOverflow:"ellipsis"},title:e,children:e})]})}const vn=Qt();function Dn(){vn.ensure(t=>{t(Zt({match:()=>Ut()?.descriptor.id===X,id:"exhibit",title:"Exhibit",icon:Wt,order:Xt,Section:En}))})}const _n={revision:()=>JSON.stringify(W().map(t=>t.modulePath)),subscribe:Mt,capture:async t=>{await te();const e=tt(),r=W().filter(o=>o.ok&&Q({modulePath:o.modulePath,regions:e}).medium==="three"),n=await Et(),s=await Ct(r,n.ok?n.entries:[]);try{const{captureAuthoredThreeScenePreview:o}=await A(async()=>{const{captureAuthoredThreeScenePreview:h}=await import("./document-preview-three-6-rt0s3D.js");return{captureAuthoredThreeScenePreview:h}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])),{createStandardEnvironment:i}=await A(async()=>{const{createStandardEnvironment:h}=await import("./environment-Dg-YaLsA.js");return{createStandardEnvironment:h}},__vite__mapDeps([19,17,14,20,21,22])),{applyStandardViewportDressing:a}=await A(async()=>{const{applyStandardViewportDressing:h}=await import("./standard-viewport-dressing-8SWhTXK3.js").then(v=>v.d);return{applyStandardViewportDressing:h}},__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,19,17,20,21,22,24])),{isEditorOwnedObject:u}=await A(async()=>{const{isEditorOwnedObject:h}=await import("./editor-layers-DVuMw5f5.js");return{isEditorOwnedObject:h}},__vite__mapDeps([15,3,4,5,6,7,8,9,10,11,12,13]));s.root.traverse(h=>{u(h)&&(h.visible=!1)});const c=new De;c.add(s.root);const l=new _e(new P(...s.frameBounds.min),new P(...s.frameBounds.max)),d=l.isEmpty()?new P:l.getCenter(new P),y=(l.isEmpty()?1:Math.max(.01,l.getBoundingSphere(new Oe).radius))/Math.sin(Pe.degToRad(42/2))*1.15,b=d.clone().addScaledVector(new P(1,.75,1).normalize(),y),x={...t,camera:{position:b,target:d,fov:42}};return o(s.root,c,x,h=>{const v=a(c,{environment:i(h),background:!1});return()=>v.dispose()})}finally{await q(s)}}};function ho(t){return Dn(),Yt({id:X,title:At,kind:"content-browser",workspaceRole:"workspace-reference",Content:e=>m.jsx(fn,{...e,store:t}),readOnly:!0,preview:_n,presentation:()=>({kind:"workspace",id:X})},{category:"canvas"})}export{En as BoardExhibitSection,X as THREE_COMPONENTS_DOCUMENT_ID,Dn as ensureThreeBoardContributionsRegistered,ho as installThreeBoardDocument,mn as openExhibitStoryDocument,pn as openGhostComponentSource};
@@ -1 +1 @@
1
- import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{al as p,fU as g,aC as b}from"./index-9nYTVIws.js";import{r as m}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{captureAuthoredThreeScenePreview as E}from"./document-preview-three-BGSnBaa1.js";import{m as v}from"./mounted-story-viewport-source-DWvv2V1k.js";import{mountStoryObject3D as w,disposeStoryObject3D as x}from"./story-three-preview-3zJJUEeK.js";import{O as C}from"./Object3DDocumentViewport-S-eokiOr.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"./content-bounds-CY_M6Fwr.js";import"./hierarchy-marks-BTgoMhKJ.js";import"./workspace-arrangement-8FYR3_fQ.js";import"./three.core-3arARmh6.js";import"./editor-layers-kBpG49pG.js";import"./renderer-ownership-BovSEcLv.js";import"./three.module-BLhyNg0e.js";import"./scene-framing-Bib_NZz8.js";import"./asset-preview-DPWGMtoN.js";import"./studio-environment-8rNw9hGx.js";import"./user-data-BQR8TLTV.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"./crash-null-boundary-v3a0uEgw.js";import"./events-156d8d12.esm-DmeaOP4r.js";import"./index-DzuOGwVB.js";import"./story-mount-turn-DFRTj5hi.js";import"./viewport-surface-status-QAiH2FdR.js";async function N(e,n,t){const s=(await import(e))[t??"default"];if(typeof s!="function")throw new Error(`${n} does not export ${t===void 0?"a default component":`\`${t}\``}, which is what the adapter's scene table names. The table and the module disagree.`);return s}function at({active:e,documentId:n,state:t}){const[o,c]=m.useState(null),[s,d]=m.useState(null),a=m.useRef(null),[f,j]=m.useState(e);m.useEffect(()=>{e&&j(!0)},[e]);const u=t?.path,h=t?.exportName;return m.useEffect(()=>{if(!f||!u)return;let l=!1;return d(null),c(null),y(u,h).then(r=>w(r,{})).then(r=>{if(l){x(r);return}const S=v(r);a.current=S,c(S)}).catch(r=>{l||d(r instanceof Error?r.message:String(r))}),()=>{l=!0,a.current?.dispose(),a.current=null,c(null)}},[f,u,h]),t?s?i.jsxs("div",{role:"alert","data-testid":"scene-document-error",style:{padding:12,fontSize:12,color:p.semantic.danger,maxWidth:640},children:[i.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:[t.path,t.exportName?` — ${t.exportName}`:""]}),i.jsx("div",{style:{color:p.content.muted,whiteSpace:"pre-wrap"},children:s})]}):o?i.jsx(C,{documentId:n,sourcePath:t.path,build:o.build,displayName:t.label,active:e}):i.jsx("div",{"data-testid":"scene-document-loading",style:{padding:12,fontSize:12,color:p.content.muted,fontStyle:"italic"},children:"mounting…"}):i.jsx("div",{style:{padding:12,fontSize:12,color:p.content.muted},children:"This scene document is no longer declared by the project's adapter."})}async function y(e,n){const t=b();if(!t)throw new Error("No project is open, so its scene modules cannot be loaded.");const o=`${g(t.rootPath,e)}?t=${Date.now()}`;return N(o,e,n)}async function ut(e,n){const t=await y(e.path,e.exportName),o=await w(t,{});try{return E(o.root,o.scene,n)}finally{await x(o)}}export{at as ThreeIsolationSceneContent,ut as captureThreeIsolationScenePreview};
1
+ import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{al as p,fU as g,aC as b}from"./index-DmNeCiAo.js";import{r as m}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{captureAuthoredThreeScenePreview as E}from"./document-preview-three-6-rt0s3D.js";import{m as v}from"./mounted-story-viewport-source-hP2r14tz.js";import{mountStoryObject3D as w,disposeStoryObject3D as x}from"./story-three-preview-CsLEpAYI.js";import{O as C}from"./Object3DDocumentViewport-ClruThDB.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"./content-bounds-wsarq3YV.js";import"./hierarchy-marks-DDtpJ7PB.js";import"./workspace-arrangement-Dinn7b-i.js";import"./three.core-3arARmh6.js";import"./editor-layers-DVuMw5f5.js";import"./renderer-ownership-BovSEcLv.js";import"./three.module-BLhyNg0e.js";import"./scene-framing-B4Ynn1mk.js";import"./asset-preview-agZh9kpZ.js";import"./studio-environment-DsQ4K1L8.js";import"./user-data-DvKLhMGu.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"./crash-null-boundary-v3a0uEgw.js";import"./events-156d8d12.esm-DmeaOP4r.js";import"./index-DzuOGwVB.js";import"./story-mount-turn-DFRTj5hi.js";import"./viewport-surface-status-DKyxV0Lz.js";async function N(e,n,t){const s=(await import(e))[t??"default"];if(typeof s!="function")throw new Error(`${n} does not export ${t===void 0?"a default component":`\`${t}\``}, which is what the adapter's scene table names. The table and the module disagree.`);return s}function at({active:e,documentId:n,state:t}){const[o,c]=m.useState(null),[s,d]=m.useState(null),a=m.useRef(null),[f,j]=m.useState(e);m.useEffect(()=>{e&&j(!0)},[e]);const u=t?.path,h=t?.exportName;return m.useEffect(()=>{if(!f||!u)return;let l=!1;return d(null),c(null),y(u,h).then(r=>w(r,{})).then(r=>{if(l){x(r);return}const S=v(r);a.current=S,c(S)}).catch(r=>{l||d(r instanceof Error?r.message:String(r))}),()=>{l=!0,a.current?.dispose(),a.current=null,c(null)}},[f,u,h]),t?s?i.jsxs("div",{role:"alert","data-testid":"scene-document-error",style:{padding:12,fontSize:12,color:p.semantic.danger,maxWidth:640},children:[i.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:[t.path,t.exportName?` — ${t.exportName}`:""]}),i.jsx("div",{style:{color:p.content.muted,whiteSpace:"pre-wrap"},children:s})]}):o?i.jsx(C,{documentId:n,sourcePath:t.path,build:o.build,displayName:t.label,active:e}):i.jsx("div",{"data-testid":"scene-document-loading",style:{padding:12,fontSize:12,color:p.content.muted,fontStyle:"italic"},children:"mounting…"}):i.jsx("div",{style:{padding:12,fontSize:12,color:p.content.muted},children:"This scene document is no longer declared by the project's adapter."})}async function y(e,n){const t=b();if(!t)throw new Error("No project is open, so its scene modules cannot be loaded.");const o=`${g(t.rootPath,e)}?t=${Date.now()}`;return N(o,e,n)}async function ut(e,n){const t=await y(e.path,e.exportName),o=await w(t,{});try{return E(o.root,o.scene,n)}finally{await x(o)}}export{at as ThreeIsolationSceneContent,ut as captureThreeIsolationScenePreview};
@@ -1 +1 @@
1
- import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{Object3DPreview as d}from"./Object3DPreview-BVbUxKmH.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-9nYTVIws.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./OrbitControls-B13MKuwC.js";import"./asset-preview-DPWGMtoN.js";import"./editor-layers-kBpG49pG.js";import"./workspace-arrangement-8FYR3_fQ.js";import"./renderer-ownership-BovSEcLv.js";import"./hierarchy-marks-BTgoMhKJ.js";import"./studio-environment-8rNw9hGx.js";import"./user-data-BQR8TLTV.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"./editor-presentation-activity-CqJH4G9t.js";import"./model-thumbnail-DXupO6bI.js";function Q({build:r,displayName:m="Object3D preview",height:p=360,background:e,showSkeleton:s=!1,cameraDirection:n,showGrid:c,useDefaultLighting:u,exposure:a,setupPreview:t,active:j=!0}){const i=t!==void 0;return o.jsx("div",{style:{width:"100%",height:p,minHeight:240},children:o.jsx(d,{sourceFactory:r,displayName:m,active:j,showSkeleton:s,background:e,cameraDirection:n,showGrid:c??!i,useDefaultLighting:u??!i,exposure:a,setupPreview:t})})}export{Q as ToolObject3DPreview};
1
+ import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{Object3DPreview as d}from"./Object3DPreview-CMaxxYtS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-DmNeCiAo.js";import"./index-nmcBqr7Y.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./OrbitControls-B13MKuwC.js";import"./asset-preview-agZh9kpZ.js";import"./editor-layers-DVuMw5f5.js";import"./workspace-arrangement-Dinn7b-i.js";import"./renderer-ownership-BovSEcLv.js";import"./hierarchy-marks-DDtpJ7PB.js";import"./studio-environment-DsQ4K1L8.js";import"./user-data-DvKLhMGu.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"./editor-presentation-activity-CqJH4G9t.js";import"./model-thumbnail-BtcSrAMa.js";function Q({build:r,displayName:m="Object3D preview",height:p=360,background:e,showSkeleton:s=!1,cameraDirection:n,showGrid:c,useDefaultLighting:u,exposure:a,setupPreview:t,active:j=!0}){const i=t!==void 0;return o.jsx("div",{style:{width:"100%",height:p,minHeight:240},children:o.jsx(d,{sourceFactory:r,displayName:m,active:j,showSkeleton:s,background:e,cameraDirection:n,showGrid:c??!i,useDefaultLighting:u??!i,exposure:a,setupPreview:t})})}export{Q as ToolObject3DPreview};