@volter/game-editor 0.5.71 → 0.5.72

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 (325) hide show
  1. package/BUNDLED_NOTICES +18 -18
  2. package/catalog/entries/music.json +2 -2
  3. package/dist/.vite/manifest.json +2149 -2124
  4. package/dist/assets/{AssetBudgetPanel-CbSEGrcI.js → AssetBudgetPanel-TYxRsWF2.js} +3 -3
  5. package/dist/assets/{AudioViewer-DbO2vY3o.js → AudioViewer-SyAuzT6d.js} +1 -1
  6. package/dist/assets/{CanvasBoardDocument-BWmMyiAX.js → CanvasBoardDocument-bGKEifjb.js} +1 -1
  7. package/dist/assets/{CanvasSceneViewport-CrmQdonP.js → CanvasSceneViewport-DOvsDDXx.js} +1 -1
  8. package/dist/assets/{ColorInput-BOPGcPsk.js → ColorInput-ZEZlxzBn.js} +1 -1
  9. package/dist/assets/{EntityModelDocument-DUZaNI2v.js → EntityModelDocument-DLYhSTh-.js} +1 -1
  10. package/dist/assets/{EnvironmentAssetDocument-Bqsm2NLI.js → EnvironmentAssetDocument-BNcQR6yX.js} +1 -1
  11. package/dist/assets/{GameplaySessionTimeline-DmGEiHHD.js → GameplaySessionTimeline-B6GEizjr.js} +1 -1
  12. package/dist/assets/{ImageViewer-BXQ1dXgz.js → ImageViewer-CVnrpv0B.js} +1 -1
  13. package/dist/assets/InspectorObjectPreview-BanF_X-B.js +1 -0
  14. package/dist/assets/{JsonAssetDocument-BPQR7OXc.js → JsonAssetDocument-Cztt4zjY.js} +1 -1
  15. package/dist/assets/{LiveModuleDocument-DnlLSCZw.js → LiveModuleDocument-26blElg2.js} +1 -1
  16. package/dist/assets/{LutAssetDocument-CMDB77UF.js → LutAssetDocument-BnsiHHrS.js} +1 -1
  17. package/dist/assets/{ModelAssetDocument-C7Su96Mo.js → ModelAssetDocument-B5Yp9L8F.js} +1 -1
  18. package/dist/assets/{NonThreeAuthoringBootstrap-BqY5ceef.js → NonThreeAuthoringBootstrap-BHOfZ9sF.js} +1 -1
  19. package/dist/assets/{Object3DDocumentToolbar-CDYwPpW6.js → Object3DDocumentToolbar-B6BaAth8.js} +1 -1
  20. package/dist/assets/Object3DDocumentViewport-B4A-C5QD.js +2 -0
  21. package/dist/assets/{Object3DPreview-B_3FCd_-.js → Object3DPreview-BbPdqVcd.js} +1 -1
  22. package/dist/assets/{OnlineAssetDetail-BMAMYfaN.js → OnlineAssetDetail-B9ku5sHJ.js} +1 -1
  23. package/dist/assets/{PlayBar-DvpDIJXg.js → PlayBar-C72OdJpY.js} +1 -1
  24. package/dist/assets/{QuarksAssetDocument-BbG3zMIR.js → QuarksAssetDocument-B8WiFZqH.js} +1 -1
  25. package/dist/assets/{ReactCanvasControls-CnIJItuA.js → ReactCanvasControls-B-P7GL52.js} +1 -1
  26. package/dist/assets/{RootSelectionOverlay-47LRczuj.js → RootSelectionOverlay-DcHmoze3.js} +1 -1
  27. package/dist/assets/{ShaderAssetDocument-KDN9ZgDF.js → ShaderAssetDocument-CAx5sVKJ.js} +1 -1
  28. package/dist/assets/{ShadowEditor-CBNfgpsF.js → ShadowEditor-CCch2nLq.js} +1 -1
  29. package/dist/assets/{SourceAssetViewer-LGC-eTLS.js → SourceAssetViewer-bAfvPckn.js} +1 -1
  30. package/dist/assets/{StageHost-BOin7YcY.js → StageHost-D_2vBQsa.js} +2 -2
  31. package/dist/assets/{StoryPreviewMount-CN-jnvnn.js → StoryPreviewMount-BNoIvc7l.js} +1 -1
  32. package/dist/assets/{ThreeBoardDocument-DgC6xWZu.js → ThreeBoardDocument-Bvu00xSO.js} +2 -2
  33. package/dist/assets/{ThreeIsolationSceneContent-ieFf0WbO.js → ThreeIsolationSceneContent-DGtDG--4.js} +1 -1
  34. package/dist/assets/{ToolObject3DPreview-B15_D8MJ.js → ToolObject3DPreview-BKlQKnPe.js} +1 -1
  35. package/dist/assets/{Toolbar-CAnrijz7.js → Toolbar-TU3vLh4L.js} +1 -1
  36. package/dist/assets/{TransientHint-BiIz-7Hh.js → TransientHint-K6pZSJgG.js} +1 -1
  37. package/dist/assets/{VideoViewer-CrP78U5w.js → VideoViewer-DrtHx0m_.js} +1 -1
  38. package/dist/assets/{ViewportShadingMenu-BfoDB2WO.js → ViewportShadingMenu-zMKOlcUM.js} +1 -1
  39. package/dist/assets/{active-ingest-CHE8woWv.js → active-ingest-gUx8jeyJ.js} +2 -2
  40. package/dist/assets/{animation-clock-DWhLTlyc.js → animation-clock-D-tLCTj6.js} +1 -1
  41. package/dist/assets/{animation-mixers.service-xdiawk5y.js → animation-mixers.service-CuNPgPSv.js} +1 -1
  42. package/dist/assets/{animation-timeline.utility-Czb7Ax-Z.js → animation-timeline.utility-BzbSVAmj.js} +1 -1
  43. package/dist/assets/{asset-budget-asset.menu-CpHLTATf.js → asset-budget-asset.menu-B_A367BM.js} +1 -1
  44. package/dist/assets/{asset-budget.action-C_ZI2rdN.js → asset-budget.action-UgvyFZGk.js} +1 -1
  45. package/dist/assets/{asset-budget.document-hmCS7sH2.js → asset-budget.document-C20mZfef.js} +1 -1
  46. package/dist/assets/{asset-budget.menu-BZyzyVdk.js → asset-budget.menu-C1THP8Ir.js} +1 -1
  47. package/dist/assets/{asset-editor-persistence-BIFP2LgP.js → asset-editor-persistence-D-YVUM-o.js} +1 -1
  48. package/dist/assets/{asset-loaders-DqbPEavT.js → asset-loaders-ClM8urgu.js} +1 -1
  49. package/dist/assets/{asset-preview-BzDHm81_.js → asset-preview-BD4OZrEp.js} +1 -1
  50. package/dist/assets/{audio-unlock.service-C2a8hsP0.js → audio-unlock.service-krSi_8MS.js} +1 -1
  51. package/dist/assets/{audio.utility-VklURuQw.js → audio.utility-DjFH8tZN.js} +1 -1
  52. package/dist/assets/autoplay.service-C_iwBCWg.js +1 -0
  53. package/dist/assets/{babylon-authoring-adapter-DBBX2Hem.js → babylon-authoring-adapter-C6qqXaiV.js} +1 -1
  54. package/dist/assets/{binding-resolver-aDFCbAcG.js → binding-resolver-B6upIc33.js} +2 -2
  55. package/dist/assets/{blender-node-editor.document-BdX0SCxH.js → blender-node-editor.document-DsDBkUHt.js} +1 -1
  56. package/dist/assets/{blender-properties-tab-BVdvAiLS.js → blender-properties-tab-9RSYwbBS.js} +1 -1
  57. package/dist/assets/{blender-runtime-host-B1bjBV91.js → blender-runtime-host-DtpNeLGc.js} +1 -1
  58. package/dist/assets/{blender-runtime-skin-BEbT46i_.js → blender-runtime-skin-EKCns7fu.js} +1 -1
  59. package/dist/assets/{blender-runtime.document-BAQTV4az.js → blender-runtime.document-CmLNi8tH.js} +1 -1
  60. package/dist/assets/{blender-timeline.document-BTwdMhSn.js → blender-timeline.document-qArofonU.js} +1 -1
  61. package/dist/assets/{blender-uv-editor.document-CqxvqlSw.js → blender-uv-editor.document-Dv3ihJD4.js} +1 -1
  62. package/dist/assets/{blender-version.status-D-kPKENT.js → blender-version.status-BEIisS2r.js} +1 -1
  63. package/dist/assets/{blender.command-BABpNHlJ.js → blender.command-1xwFaSJs.js} +1 -1
  64. package/dist/assets/{board-guides-BVkDJqat.js → board-guides-DnI_fMSm.js} +1 -1
  65. package/dist/assets/bridge.command-C5EYO4OS.js +3 -0
  66. package/dist/assets/{browserAll-DjSaXYpJ.js → browserAll-Co_vDC8r.js} +1 -1
  67. package/dist/assets/{build-player.document-viLZOb6A.js → build-player.document-LBxyS2AI.js} +1 -1
  68. package/dist/assets/{build-profiles.document-C9gM1NV6.js → build-profiles.document-B_6Df2Sp.js} +1 -1
  69. package/dist/assets/{build-progress.status-DKw0YdnU.js → build-progress.status-Cdt1Zuu_.js} +1 -1
  70. package/dist/assets/{build-session-CpAT9iQU.js → build-session-DKHnqiXT.js} +1 -1
  71. package/dist/assets/{build.action-BrSZc3kA.js → build.action-DRDdqtZb.js} +1 -1
  72. package/dist/assets/{build.command-CVB-50ii.js → build.command-ry_OUUh9.js} +1 -1
  73. package/dist/assets/{build.header-BhOtTPyg.js → build.header-CiTCHvry.js} +1 -1
  74. package/dist/assets/{build.menu-BHIVHysW.js → build.menu-DiViXEwh.js} +1 -1
  75. package/dist/assets/{build.service-C5awmXgd.js → build.service-BSGXA-SQ.js} +1 -1
  76. package/dist/assets/{camera-B_ssMgXA.js → camera-B8Mdswus.js} +1 -1
  77. package/dist/assets/{camera-runtime.inspector-BAc2xnsF.js → camera-runtime.inspector-CupJRuBs.js} +1 -1
  78. package/dist/assets/{canvas-design-mount-DW2RoIFP.js → canvas-design-mount-DS8xWFiw.js} +3 -3
  79. package/dist/assets/{canvas-entry-runtime-BQdfSw1B.js → canvas-entry-runtime-BURQgaLB.js} +2 -2
  80. package/dist/assets/{canvas-preview-frames-Bc44u87o.js → canvas-preview-frames-Crj5bFty.js} +1 -1
  81. package/dist/assets/{canvas-story-capture.service-DTLE6FK3.js → canvas-story-capture.service-DQ6Zw3b0.js} +2 -2
  82. package/dist/assets/{capability-coverage-6I_iG0kk.js → capability-coverage-Ctnmu2LE.js} +1 -1
  83. package/dist/assets/{collaboration-presence-wD0oKl7P.js → collaboration-presence-C-yh_YBU.js} +1 -1
  84. package/dist/assets/{collider-BQKrXUbD.js → collider-C_I5Xdtu.js} +1 -1
  85. package/dist/assets/{component-board.service-BzZ2JQC8.js → component-board.service-BJ2DCCXQ.js} +2 -2
  86. package/dist/assets/component-board.service-COaCvlbA.js +2 -0
  87. package/dist/assets/{component-board.service-Cnxftkv8.js → component-board.service-DwPBo3xK.js} +2 -2
  88. package/dist/assets/{component-contracts.service-BJ73JRuk.js → component-contracts.service-RJCV5AAt.js} +1 -1
  89. package/dist/assets/{component-instance-root-9MmHwMal.js → component-instance-root-DjA11g2U.js} +1 -1
  90. package/dist/assets/{component-verbs.command-_nUoLZ1s.js → component-verbs.command-BwYzS1c0.js} +1 -1
  91. package/dist/assets/{component-verbs.service-D9qvuexk.js → component-verbs.service-CJvrj9av.js} +1 -1
  92. package/dist/assets/{config-DabjxySF.js → config-B4n-SqJs.js} +2 -2
  93. package/dist/assets/{configurations-CACHqi7T.js → configurations-Bqg2uvA4.js} +1 -1
  94. package/dist/assets/{connection.status-CfFK9wti.js → connection.status-BVL6eTcF.js} +1 -1
  95. package/dist/assets/{constraints.inspector-DvTTgVxM.js → constraints.inspector-CqY4o8xc.js} +1 -1
  96. package/dist/assets/{content-bounds-938XXJRy.js → content-bounds-C1-UpGMc.js} +1 -1
  97. package/dist/assets/{contract-system-adapters-D9Gcb7R7.js → contract-system-adapters-StvC0uNq.js} +1 -1
  98. package/dist/assets/{coverage.service-CyWmmos8.js → coverage.service-DI7ocYK8.js} +1 -1
  99. package/dist/assets/{create-runtime-D3CS8u84.js → create-runtime-DwcO7h9p.js} +1 -1
  100. package/dist/assets/{curve-CzIvpvWX.js → curve-CPd2jkVJ.js} +1 -1
  101. package/dist/assets/{data-asset-Dt3MP-sl.js → data-asset-B2UtWmua.js} +1 -1
  102. package/dist/assets/{data-ref-COkdIktX.js → data-ref-B036kumM.js} +1 -1
  103. package/dist/assets/{debug-bridge-LaiaWRls.js → debug-bridge-BG5c-HdI.js} +1 -1
  104. package/dist/assets/{debug-registry-BUPLu5EA.js → debug-registry--ZkoQWOO.js} +1 -1
  105. package/dist/assets/{deferred-ingest-play-DVLTxYCk.js → deferred-ingest-play-CmJi6tql.js} +2 -2
  106. package/dist/assets/{design-time-canvas-mount-CkOQQvFW.js → design-time-canvas-mount-2sEXGMyx.js} +2 -2
  107. package/dist/assets/design-time-layers-CUuV2SKK.js +1 -0
  108. package/dist/assets/{design-time-mount.service-C8VeEbCC.js → design-time-mount.service-DaEwimcE.js} +2 -2
  109. package/dist/assets/design-time-mount.service-m_Alk1A4.js +2 -0
  110. package/dist/assets/design-time-react-mount-CcCuClCL.js +1 -0
  111. package/dist/assets/{document-preview-three-C8Pzyiai.js → document-preview-three-CRYXGELs.js} +1 -1
  112. package/dist/assets/{dom-authoring-adapter-71D70rVP.js → dom-authoring-adapter-BQor85A0.js} +1 -1
  113. package/dist/assets/{draco3d-XOYD2Hke.js → draco3d-zcIWTWKV.js} +1 -1
  114. package/dist/assets/{edit-mode-audio.service-OcRQ9Ozq.js → edit-mode-audio.service-BZ_MguuB.js} +1 -1
  115. package/dist/assets/{edit-mode-authoring-Du1CaTkH.js → edit-mode-authoring-B8NE5TIR.js} +1 -1
  116. package/dist/assets/{edit-mode-networking.service-BWz-nxiL.js → edit-mode-networking.service-BnR0zkEk.js} +1 -1
  117. package/dist/assets/editor-api-D9ypvXGZ.js +1 -0
  118. package/dist/assets/{editor-layers-qlgroPbE.js → editor-layers-B2mwHrrn.js} +1 -1
  119. package/dist/assets/{editor-shell-store-Di0waLQj.js → editor-shell-store-V7HfbGqh.js} +1 -1
  120. package/dist/assets/{entity-object-BeRdaaqQ.js → entity-object-BqQBOLh4.js} +1 -1
  121. package/dist/assets/{extend-CFEzxGGP.js → extend-vhXKbXwa.js} +1 -1
  122. package/dist/assets/{fork-menu-Bujed-pM.js → fork-menu-CGygk03X.js} +1 -1
  123. package/dist/assets/{frame-debugger-store-CCm_jyhx.js → frame-debugger-store-BFHDpd_6.js} +1 -1
  124. package/dist/assets/{game-contract-seams-DOwrbA13.js → game-contract-seams-DYi5-NnM.js} +1 -1
  125. package/dist/assets/{game-css-scope-transform-DuP554oX.js → game-css-scope-transform-tjGkUu5X.js} +1 -1
  126. package/dist/assets/game-document.service-jY65msUL.js +1 -0
  127. package/dist/assets/game-eval.command-C0iQ6vZD.js +2 -0
  128. package/dist/assets/{game-module-access-gOlo85at.js → game-module-access-BlCkxuVe.js} +1 -1
  129. package/dist/assets/game-network-gqU0qk9j.js +22 -0
  130. package/dist/assets/game-surface-defaults-D8S4cRxi.js +1 -0
  131. package/dist/assets/{gameplay-export-Clmlm922.js → gameplay-export-SxI2CiOU.js} +1 -1
  132. package/dist/assets/{gameplay-replay-Dxz93B2M.js → gameplay-replay-CLHO__fQ.js} +1 -1
  133. package/dist/assets/gameplay.command-CQyRcFql.js +1 -0
  134. package/dist/assets/{generation-jobs-_kzxAnbI.js → generation-jobs-C6l_ZBhD.js} +1 -1
  135. package/dist/assets/{generation.service-B533Kbco.js → generation.service-CgbxxPGg.js} +1 -1
  136. package/dist/assets/{generations-D5GcYf91.js → generations-DxppE9pN.js} +1 -1
  137. package/dist/assets/{generations.status-CDZ_eHJZ.js → generations.status-DIzDQ4QZ.js} +1 -1
  138. package/dist/assets/{hierarchy-marks-BrmGekuT.js → hierarchy-marks-CSQMtCBU.js} +1 -1
  139. package/dist/assets/{hosted-asset-materialization-DBLM2dtz.js → hosted-asset-materialization-TryBlckx.js} +1 -1
  140. package/dist/assets/{index-CP1Fd1fP.js → index-AagWeY8V.js} +1 -1
  141. package/dist/assets/{index-vjNaMgz6.js → index-C8u7p1K7.js} +1 -1
  142. package/dist/assets/{index-Q98tByQ2.js → index-Cj4vTL7A.js} +1 -1
  143. package/dist/assets/{index-CiqSswEV.js → index-CpMTewhc.js} +1 -1
  144. package/dist/assets/{index-C8jugKW5.js → index-DBIi3ND-.js} +1 -1
  145. package/dist/assets/{index-sTPbmuS8.js → index-d2quMKQM.js} +1 -1
  146. package/dist/assets/{index-BPUmREu0.js → index-u6amYfnv.js} +2 -2
  147. package/dist/assets/{index-iW3HFEJB.js → index-wjn2vkB8.js} +10 -10
  148. package/dist/assets/{index-BU93FMYM.js → index-xsQaHGma.js} +1 -1
  149. package/dist/assets/{inference-diagnostics-PcfFN6SD.js → inference-diagnostics-dZd7OUSj.js} +1 -1
  150. package/dist/assets/{ingest-boot-viewport-CrnkiTcJ.js → ingest-boot-viewport-Chqb3b3L.js} +1 -1
  151. package/dist/assets/{ingest-siblings-CQ95u6JM.js → ingest-siblings-DyKim2on.js} +1 -1
  152. package/dist/assets/{ingest-source-persistence-2MRBPgo0.js → ingest-source-persistence-D7jtuLEB.js} +1 -1
  153. package/dist/assets/{ingest.service-DQqEvbsT.js → ingest.service-C2q5JocL.js} +1 -1
  154. package/dist/assets/{inspect-CUNyIUii.js → inspect-Cl65lNby.js} +1 -1
  155. package/dist/assets/instances.command-CnrRMqOy.js +1 -0
  156. package/dist/assets/{json-history-resource-82d2z68R.js → json-history-resource-DWPJt2Bk.js} +1 -1
  157. package/dist/assets/{layered-pick-Db8YSlDp.js → layered-pick-wB2IUStv.js} +1 -1
  158. package/dist/assets/{light-PK9RLNmD.js → light-BK4WrhlP.js} +1 -1
  159. package/dist/assets/{live-project-verbs-CayyA6Tc.js → live-project-verbs-CSKXil-5.js} +1 -1
  160. package/dist/assets/{machine.document-CUO0RxDP.js → machine.document-Wxh00rVH.js} +1 -1
  161. package/dist/assets/{machines.finder-B-DdPjby.js → machines.finder-Bq84a20u.js} +1 -1
  162. package/dist/assets/{material-C_mvE2lW.js → material-DzSXsXYn.js} +1 -1
  163. package/dist/assets/{material-factory-kKKe4-DN.js → material-factory-6zzgHeT5.js} +1 -1
  164. package/dist/assets/{mesh-fUiQLtsU.js → mesh-DTSUSSfl.js} +1 -1
  165. package/dist/assets/{model-asset-sections.service-Dfkzhu6Q.js → model-asset-sections.service-eYy0ol55.js} +1 -1
  166. package/dist/assets/{model-inspection-DgqjTy5z.js → model-inspection-DM9bxnjs.js} +1 -1
  167. package/dist/assets/{model-thumbnail-DORLbXyw.js → model-thumbnail-DcI972TR.js} +1 -1
  168. package/dist/assets/{models.finder-DzW1Sg26.js → models.finder-CbfSmlRN.js} +1 -1
  169. package/dist/assets/{module-mode-BWoDD0oV.js → module-mode-BCWTllUj.js} +2 -2
  170. package/dist/assets/mount-canvas-ingest-root-BWvMQ1oU.js +2 -0
  171. package/dist/assets/{mount-dom-ingest-root-BOEt11vp.js → mount-dom-ingest-root-C8_3MNzH.js} +2 -2
  172. package/dist/assets/mount-ingest-root-CnfZV05y.js +2 -0
  173. package/dist/assets/mount-manifest-BHLEQ9MI.js +1 -0
  174. package/dist/assets/mount-three-ingest-root-Ci-ZYEqi.js +1 -0
  175. package/dist/assets/{mounted-authoring-30zCcxeV.js → mounted-authoring-CRGnDIkF.js} +1 -1
  176. package/dist/assets/{mounted-story-viewport-source-N0xrUdtm.js → mounted-story-viewport-source-BV9Vkz5j.js} +1 -1
  177. package/dist/assets/{native-debug-module-Cofo9dCU.js → native-debug-module-D0TMOJ5J.js} +1 -1
  178. package/dist/assets/{navigation-B9kSIhNu.js → navigation-Dtw9RIIP.js} +1 -1
  179. package/dist/assets/{navmesh.menu-DPNQ2RCH.js → navmesh.menu-BOqiQXs0.js} +1 -1
  180. package/dist/assets/{navmesh.service-pffKX_Ht.js → navmesh.service-DRssu5HB.js} +1 -1
  181. package/dist/assets/network-observer.service-CSbHzsem.js +1 -0
  182. package/dist/assets/network.utility-DkecVQis.js +1 -0
  183. package/dist/assets/{object3d-document-session-registry-DMhhDWnQ.js → object3d-document-session-registry-D68l_sLd.js} +2 -2
  184. package/dist/assets/{oid-transform-AHICFvQG.js → oid-transform-DELHL858.js} +1 -1
  185. package/dist/assets/{particles-DIMSkSIe.js → particles-DxmpSiYm.js} +1 -1
  186. package/dist/assets/{pixi-authoring-adapter-DR6NNYrL.js → pixi-authoring-adapter-crYHqvEe.js} +1 -1
  187. package/dist/assets/{pixi-live-write-target-CXDKS1kQ.js → pixi-live-write-target-Cx72kgN6.js} +1 -1
  188. package/dist/assets/play.command-WI1aGM0Z.js +2 -0
  189. package/dist/assets/{presentation-DPddUHCg.js → presentation-CqPEUUNS.js} +1 -1
  190. package/dist/assets/{product-CEH3MVYt.js → product-dDGXQlJ0.js} +1 -1
  191. package/dist/assets/{profiler.action-qMarbw9x.js → profiler.action-DsAh7yvt.js} +1 -1
  192. package/dist/assets/{profiler.menu-C52_wfu8.js → profiler.menu-eMeZSO2J.js} +1 -1
  193. package/dist/assets/{profiler.utility-DzfXG0cD.js → profiler.utility-B9hb8tbg.js} +1 -1
  194. package/dist/assets/project-authoring-session-7KN3YlPS.js +2 -0
  195. package/dist/assets/{properties-bone-constraints.inspector-DEOxhp1W.js → properties-bone-constraints.inspector-DoCD043b.js} +1 -1
  196. package/dist/assets/{properties-bone.inspector-CY8EEYZl.js → properties-bone.inspector-mlQIkyBf.js} +1 -1
  197. package/dist/assets/{properties-collection.inspector-rGoZwmsY.js → properties-collection.inspector-BSGr9-vR.js} +1 -1
  198. package/dist/assets/{properties-constraints.inspector-DJITSHiL.js → properties-constraints.inspector-BfpdPfPN.js} +1 -1
  199. package/dist/assets/{properties-data.inspector-CNJ6cUzA.js → properties-data.inspector-yyf0b8Uw.js} +1 -1
  200. package/dist/assets/{properties-material.inspector-BkCUSFdM.js → properties-material.inspector-BjKs4qAn.js} +1 -1
  201. package/dist/assets/{properties-modifiers.inspector-C9ij0UfE.js → properties-modifiers.inspector-XAML7OJx.js} +1 -1
  202. package/dist/assets/{properties-object.inspector-IvVsyikt.js → properties-object.inspector-cHVVC7vP.js} +1 -1
  203. package/dist/assets/{properties-output.inspector-Df-fx8vq.js → properties-output.inspector-BE6O5uWt.js} +1 -1
  204. package/dist/assets/{properties-particles.inspector-J3UOyWlz.js → properties-particles.inspector-DA9r9tox.js} +1 -1
  205. package/dist/assets/{properties-physics.inspector-BmcTY5Q8.js → properties-physics.inspector-6V50bg6n.js} +1 -1
  206. package/dist/assets/{properties-render.inspector-DUB5qwIR.js → properties-render.inspector-1iXZTLFj.js} +1 -1
  207. package/dist/assets/{properties-scene.inspector-DxBRs2ae.js → properties-scene.inspector-8qzTDRZ-.js} +1 -1
  208. package/dist/assets/{properties-texture.inspector-BqzPv1aS.js → properties-texture.inspector-DnndHFBA.js} +1 -1
  209. package/dist/assets/{properties-view-layer.inspector-D1a1Dc1r.js → properties-view-layer.inspector-BFqtpGAW.js} +1 -1
  210. package/dist/assets/{properties-world.inspector-CCwHv8ha.js → properties-world.inspector-DrZZRQoS.js} +1 -1
  211. package/dist/assets/r3f-design-session-Bg3EEQz6.js +2 -0
  212. package/dist/assets/{r3f-physics-binding-mLmXPi7n.js → r3f-physics-binding-DSD0HHLc.js} +1 -1
  213. package/dist/assets/{r3f-source-authoring-adapter-W1zVFNuZ.js → r3f-source-authoring-adapter-Ca9azh8e.js} +1 -1
  214. package/dist/assets/{react-canvas-navigation-IPhloKzi.js → react-canvas-navigation-2OqMWHDI.js} +1 -1
  215. package/dist/assets/{react-inspector.service-C7T_Pqud.js → react-inspector.service-DYyJPfNc.js} +1 -1
  216. package/dist/assets/{react-story-board-CPTQdOIn.js → react-story-board-Cry0gSQl.js} +1 -1
  217. package/dist/assets/{react-three-rapier.esm-D43m0aj7.js → react-three-rapier.esm-DMmOHQDe.js} +1 -1
  218. package/dist/assets/{react-world-authoring-adapter-DgsCzOTj.js → react-world-authoring-adapter-CQtYfgx9.js} +1 -1
  219. package/dist/assets/{realm-services-C8OlRuJ5.js → realm-services-DBqdRLI4.js} +1 -1
  220. package/dist/assets/{reflection-probe-capture.inspector-DT1jvM_q.js → reflection-probe-capture.inspector-C5Bu6QzV.js} +1 -1
  221. package/dist/assets/{registry-XvQ4sPew.js → registry-_NCUhY0b.js} +1 -1
  222. package/dist/assets/{relative-import-specifier-CPCtuEhc.js → relative-import-specifier-BiEpXss5.js} +1 -1
  223. package/dist/assets/{render-env-BYsqF2DQ.js → render-env-D-pSIlJ1.js} +1 -1
  224. package/dist/assets/{render-features-CL2D1X_X.js → render-features-l7BQbeaM.js} +1 -1
  225. package/dist/assets/{render-settings-CsCXKLaq.js → render-settings-DjdbF9VX.js} +1 -1
  226. package/dist/assets/{resolve-three-DRDYxBE9.js → resolve-three-C5BhpPqs.js} +3 -3
  227. package/dist/assets/{root-seam-contract-BNGi8m22.js → root-seam-contract-cbINkIcN.js} +1 -1
  228. package/dist/assets/{run-selection-8wjzFzVg.js → run-selection-CxsHUK_M.js} +1 -1
  229. package/dist/assets/{scene-capture-aq3yUgox.js → scene-capture-CCifsWLp.js} +1 -1
  230. package/dist/assets/{scene-document.service-qnY16vPq.js → scene-document.service-TFlDSvVA.js} +2 -2
  231. package/dist/assets/{scene-framing-BWGUKaVh.js → scene-framing--293N2xY.js} +1 -1
  232. package/dist/assets/{seeded-random-BIdiJ8w9.js → seeded-random-BMF_UDMF.js} +1 -1
  233. package/dist/assets/{setup-renderer-BI8Dltzx.js → setup-renderer-ZCwGcqc7.js} +1 -1
  234. package/dist/assets/{source-object3d-authoring-adapter-Des84Gk3.js → source-object3d-authoring-adapter-C2qh6_pn.js} +1 -1
  235. package/dist/assets/{source-persistence-backend-I5wxqQgh.js → source-persistence-backend-iG_P2f_a.js} +1 -1
  236. package/dist/assets/{stage-keyboard-Ckod5Y4M.js → stage-keyboard-Bj7F0kP-.js} +1 -1
  237. package/dist/assets/{stage-overlay-set-CLTmSTo9.js → stage-overlay-set-4eMxmCWg.js} +1 -1
  238. package/dist/assets/{stage-presence-markers-DOoDCC7Z.js → stage-presence-markers-Dvo3soHw.js} +1 -1
  239. package/dist/assets/{stage-transform-tools-DjYQ95b7.js → stage-transform-tools-BGCCPEHD.js} +1 -1
  240. package/dist/assets/{standard-viewport-dressing-DE9WE1Lv.js → standard-viewport-dressing-DisOo98G.js} +1 -1
  241. package/dist/assets/{state-watch.action-D0rXmFVx.js → state-watch.action-BjMVtMnK.js} +1 -1
  242. package/dist/assets/{state-watch.menu-DJyVHqNM.js → state-watch.menu-uo9i_GJH.js} +1 -1
  243. package/dist/assets/{state-watch.utility-CHL55Pbn.js → state-watch.utility-BDSAOvyy.js} +1 -1
  244. package/dist/assets/{story-capture-BGeBen-R.js → story-capture-BZD3x0Pr.js} +1 -1
  245. package/dist/assets/{story-documents-B8TSr_CN.js → story-documents-DOsBtURt.js} +1 -1
  246. package/dist/assets/{story-documents.service-C_Q58qZs.js → story-documents.service-CbADy_Hj.js} +1 -1
  247. package/dist/assets/{story-documents.service-B1hhvZad.js → story-documents.service-D_hsjJr9.js} +1 -1
  248. package/dist/assets/{story-media-presence-CEwzSadX.js → story-media-presence-9jRxsUgl.js} +1 -1
  249. package/dist/assets/{story-pixi-preview-rAub2W_H.js → story-pixi-preview-DbcYdZMI.js} +1 -1
  250. package/dist/assets/{story-presentation-CdJ6Ncu6.js → story-presentation-CdTE_XUR.js} +1 -1
  251. package/dist/assets/{story-three-preview-Cp9kfSo0.js → story-three-preview-Bg0NL_U_.js} +2 -2
  252. package/dist/assets/{studio-environment-BCf09Sox.js → studio-environment-Cso4y0lE.js} +1 -1
  253. package/dist/assets/{surface-state-BUmVXUJj.js → surface-state-B_0Yt3kv.js} +1 -1
  254. package/dist/assets/{syntactic-prop-specs-BHoShoI2.js → syntactic-prop-specs-BrDBqyDN.js} +1 -1
  255. package/dist/assets/team-playtest.service-BaW1I4YQ.js +1 -0
  256. package/dist/assets/{three-wsMw8Ifj.js → three-C0qVNsOS.js} +1 -1
  257. package/dist/assets/{three-authoring-adapter-DctJX96k.js → three-authoring-adapter-C92rm99z.js} +1 -1
  258. package/dist/assets/three-authoring.service-D_KTfVs4.js +2 -0
  259. package/dist/assets/{three-ingest-runtime-Bqwv-JsZ.js → three-ingest-runtime-DOUKRBrc.js} +1 -1
  260. package/dist/assets/{three-integration-C9bu5OXH.js → three-integration-pMMAFpYl.js} +2 -2
  261. package/dist/assets/three-integration.service-k1_xWOYd.js +1 -0
  262. package/dist/assets/{three-projection-core-rOK39WmJ.js → three-projection-core-BOq13mz-.js} +1 -1
  263. package/dist/assets/{three-state-Cu8xEils.js → three-state-B6NLTszJ.js} +1 -1
  264. package/dist/assets/{three-story-capture.service-DJaS21h9.js → three-story-capture.service-CcRSfWad.js} +2 -2
  265. package/dist/assets/{three-story-model-CE0vGtKW.js → three-story-model-7qxVYOkR.js} +1 -1
  266. package/dist/assets/{three-viewport-presentation-IVtG1zll.js → three-viewport-presentation-DatfjZJH.js} +1 -1
  267. package/dist/assets/{transform-mode-request-C7qvcvEe.js → transform-mode-request-c8d5QQwQ.js} +1 -1
  268. package/dist/assets/{transport-strip-B6Hauzjh.js → transport-strip-BlGEb51b.js} +1 -1
  269. package/dist/assets/transport.header-DZ6f7-ON.js +1 -0
  270. package/dist/assets/{tuples-CP56GoRo.js → tuples-ChC18dWq.js} +1 -1
  271. package/dist/assets/ui-board-document-CliGHHFn.js +2 -0
  272. package/dist/assets/{user-data-BGLBYiFw.js → user-data-C2bC2Cok.js} +1 -1
  273. package/dist/assets/{utility-view-state-y2PTWZuT.js → utility-view-state-DbTE0Ome.js} +1 -1
  274. package/dist/assets/{viewport-door-B7DJhMPS.js → viewport-door-DNJf5Mej.js} +1 -1
  275. package/dist/assets/{viewport-root-presentation-DPtVohIT.js → viewport-root-presentation-CGYHAB1r.js} +1 -1
  276. package/dist/assets/{viewport-surface-status-CleQnKBz.js → viewport-surface-status-Db1dCE5f.js} +1 -1
  277. package/dist/assets/{webworkerAll-B8sqUYid.js → webworkerAll-K8X7iPJw.js} +1 -1
  278. package/dist/assets/{workspace-arrangement-6V8ZwB2d.js → workspace-arrangement-coA4mYU_.js} +1 -1
  279. package/dist/assets/world-documents-kcOR7HSb.js +1 -0
  280. package/dist/assets/{world-root-stage-binding-OOLit0lW.js → world-root-stage-binding-WQv8K4Zz.js} +1 -1
  281. package/dist/assets/{xstate-animation-binding-KbfYItEZ.js → xstate-animation-binding-BTIYbpkG.js} +1 -1
  282. package/dist/assets/{xstate-animation-meta-DM_K9jo1.js → xstate-animation-meta-D4bo9lqY.js} +1 -1
  283. package/dist-node/cli.js +14 -14
  284. package/package.json +14 -14
  285. package/template/.agents/references/project-manual.md +1 -1
  286. package/template/.agents/skills/volter-ingest-existing-game/SKILL.md +1 -1
  287. package/template/.agents/skills/volter-threejs-authoring/SKILL.md +1 -1
  288. package/template/.claude/skills/volter-ingest-existing-game/SKILL.md +1 -1
  289. package/template/.claude/skills/volter-threejs-authoring/SKILL.md +1 -1
  290. package/template/.github/skills/volter-ingest-existing-game/SKILL.md +1 -1
  291. package/template/.github/skills/volter-threejs-authoring/SKILL.md +1 -1
  292. package/template/IDIOMS.md +1 -1
  293. package/template/package.json +10 -10
  294. package/template/src/bot/bot-station.ts +1 -1
  295. package/template/vite.config.ts +2 -2
  296. package/template-dotfiles/gitignore +1 -1
  297. package/dist/assets/InspectorObjectPreview-JE22P2KW.js +0 -1
  298. package/dist/assets/Object3DDocumentViewport-mDettU8s.js +0 -2
  299. package/dist/assets/autoplay.service-ap_sEfca.js +0 -1
  300. package/dist/assets/bridge.command-DNktKXNP.js +0 -3
  301. package/dist/assets/component-board.service-DTH3BKq_.js +0 -2
  302. package/dist/assets/design-time-layers-Cv3txX_V.js +0 -1
  303. package/dist/assets/design-time-mount.service-DupCKL6-.js +0 -2
  304. package/dist/assets/design-time-react-mount-CT8eihNN.js +0 -1
  305. package/dist/assets/editor-api-BqS9NdSX.js +0 -1
  306. package/dist/assets/game-document.service-CW928hrj.js +0 -1
  307. package/dist/assets/game-eval.command-D8ohGtA6.js +0 -2
  308. package/dist/assets/game-network-CU3Yp0oN.js +0 -22
  309. package/dist/assets/gameplay.command-b2D2rbZV.js +0 -1
  310. package/dist/assets/instances.command-wzs2BWwt.js +0 -1
  311. package/dist/assets/mount-canvas-ingest-root-nBqJPkbz.js +0 -2
  312. package/dist/assets/mount-ingest-root-9KaA9ETn.js +0 -2
  313. package/dist/assets/mount-manifest-BOiv1Hix.js +0 -1
  314. package/dist/assets/mount-three-ingest-root-C_0Slh91.js +0 -1
  315. package/dist/assets/network-observer.service-D61Whg6t.js +0 -1
  316. package/dist/assets/network.utility-Bw74dLIu.js +0 -1
  317. package/dist/assets/play.command-L6qPHLHh.js +0 -2
  318. package/dist/assets/project-authoring-session-sbmVUm3i.js +0 -2
  319. package/dist/assets/r3f-design-session-By5arVMz.js +0 -2
  320. package/dist/assets/team-playtest.service-DErOWVaA.js +0 -1
  321. package/dist/assets/three-authoring.service-B2LLPXyf.js +0 -2
  322. package/dist/assets/three-integration.service-BXQuaWQ-.js +0 -1
  323. package/dist/assets/transport.header-CDivn20X.js +0 -1
  324. package/dist/assets/ui-board-document-B69iTbe5.js +0 -2
  325. package/dist/assets/world-documents-CwxZ4xtW.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/blender-node-editor.document-BdX0SCxH.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/blender-runtime-host-B1bjBV91.js","assets/preview-renderer-BrYNFV1p.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/environment-Dg-YaLsA.js","assets/RoomEnvironment-BkknvS_I.js","assets/EXRLoader-CITMBvGd.js","assets/HDRLoader-BTGuGhVo.js","assets/renderer-ownership-BovSEcLv.js","assets/output-pass-HurwNl0G.js","assets/Pass-D1MRT672.js","assets/clip-planes-CnAI6DZn.js","assets/content-bounds-938XXJRy.js","assets/hierarchy-marks-BrmGekuT.js","assets/workspace-arrangement-6V8ZwB2d.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/blender-timeline.document-BTwdMhSn.js","assets/blender-runtime-skin-BEbT46i_.js","assets/LineSegments2-DN9pUfWA.js","assets/blender-uv-editor.document-CqxvqlSw.js","assets/blender-runtime.document-BAQTV4az.js","assets/three-contract-Dkt6PmWY.js","assets/viewport-door-B7DJhMPS.js","assets/blender-version.status-D-kPKENT.js","assets/blender.command-BABpNHlJ.js","assets/blender.status-BMETIbb2.js","assets/model.layout-BpZE1W9V.js","assets/regions-DWeEBnE2.js","assets/models.finder-DzW1Sg26.js","assets/properties-bone-constraints.inspector-DEOxhp1W.js","assets/blender-properties-tab-BVdvAiLS.js","assets/properties-constraints.inspector-DJITSHiL.js","assets/properties-bone.inspector-CY8EEYZl.js","assets/properties-collection.inspector-rGoZwmsY.js","assets/properties-data.inspector-CNJ6cUzA.js","assets/properties-material.inspector-BkCUSFdM.js","assets/properties-modifiers.inspector-C9ij0UfE.js","assets/properties-object.inspector-IvVsyikt.js","assets/properties-output.inspector-Df-fx8vq.js","assets/properties-particles.inspector-J3UOyWlz.js","assets/properties-physics.inspector-BmcTY5Q8.js","assets/properties-render.inspector-DUB5qwIR.js","assets/properties-scene.inspector-DxBRs2ae.js","assets/properties-texture.inspector-BqzPv1aS.js","assets/properties-view-layer.inspector-D1a1Dc1r.js","assets/properties-world.inspector-CCwHv8ha.js","assets/sculpt.layout-D-K5cLw6.js","assets/shading.layout-CZZHKBer.js","assets/uv-editing.layout-A8RA-cbM.js","assets/asset-budget-asset.menu-CpHLTATf.js","assets/AssetBudgetPanel-CbSEGrcI.js","assets/asset-loaders-DqbPEavT.js","assets/SkeletonUtils-YH9iLOY_.js","assets/asset-parse-error-BHMwBRU3.js","assets/user-data-CODoGZqA.js","assets/object-marks-BnvSuCTt.js","assets/loader-BTUKnX5Q.js","assets/KTX2Loader-CaqVE6nY.js","assets/GLTFLoader-KeoruJgS.js","assets/BufferGeometryUtils-B22h7jo4.js","assets/asset-budget.action-C_ZI2rdN.js","assets/asset-budget.document-hmCS7sH2.js","assets/asset-budget.menu-BZyzyVdk.js","assets/audio-unlock.service-C2a8hsP0.js","assets/pose-guard-CLabLSzf.js","assets/game-audio-BeCyd0Ha.js","assets/network-observer.service-D61Whg6t.js","assets/game-network-CU3Yp0oN.js","assets/index-OZVqp6xS.js","assets/index-Da9JhEvW.js","assets/native-debug-module-Cofo9dCU.js","assets/native-entry-surface-BE8LJNdu.js","assets/debug-registry-BUPLu5EA.js","assets/contract-system-adapters-D9Gcb7R7.js","assets/game-contract-seams-DOwrbA13.js","assets/seeded-random-BIdiJ8w9.js","assets/rapier-physics-adapter-CaZqWLu0.js","assets/events-156d8d12.esm-CYeuVCYr.js","assets/index-bQE2NA0D.js","assets/live-project-verbs-CayyA6Tc.js","assets/capability-coverage-6I_iG0kk.js","assets/edit-mode-authoring-Du1CaTkH.js","assets/json-history-resource-82d2z68R.js","assets/binding-resolver-aDFCbAcG.js","assets/adapter-surface-Y37Nzcyw.js","assets/structural-signature-Dc7skRiy.js","assets/webgl-frame-capture-DdJkM2mi.js","assets/realm-services-C8OlRuJ5.js","assets/canvas-entry-runtime-BQdfSw1B.js","assets/three-ingest-runtime-Bqwv-JsZ.js","assets/EffectComposer-BEAt0PtQ.js","assets/CopyShader-BzTUYzf6.js","assets/ShaderPass-DTnDQXm0.js","assets/CSS3DRenderer-BsAqfavI.js","assets/relative-path-guard-GiM7Lsz8.js","assets/react-root-BHA-cdrW.js","assets/editor-presentation-activity-CqJH4G9t.js","assets/active-ingest-CHE8woWv.js","assets/ingest-source-persistence-2MRBPgo0.js","assets/pixi-story-model-DNkfnWUV.js","assets/surface-content-Dg9Kkazf.js","assets/viewport-root-presentation-DPtVohIT.js","assets/mounted-authoring-30zCcxeV.js","assets/entity-object-BeRdaaqQ.js","assets/user-data-BGLBYiFw.js","assets/three-wsMw8Ifj.js","assets/editor-layers-qlgroPbE.js","assets/component-instance-root-9MmHwMal.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/three-authoring-adapter-DctJX96k.js","assets/source-persistence-backend-I5wxqQgh.js","assets/three-projection-core-rOK39WmJ.js","assets/body-marks-C1LxJtQb.js","assets/structural-ids-BOo2BRoY.js","assets/object3d-authoring-subject-XccsO0xG.js","assets/r3f-physics-binding-mLmXPi7n.js","assets/deferred-ingest-play-DVLTxYCk.js","assets/rrweb-Cd2ifIRP.js","assets/react-world-authoring-adapter-DgsCzOTj.js","assets/board-guides-BVkDJqat.js","assets/relative-import-specifier-CPCtuEhc.js","assets/story-arg-descriptors-Ek86ExX7.js","assets/inspect-CUNyIUii.js","assets/inference-diagnostics-PcfFN6SD.js","assets/writer-tw6EcuVO.js","assets/three-state-Cu8xEils.js","assets/editor-shell-store-Di0waLQj.js","assets/audio.utility-VklURuQw.js","assets/audio-meter-Cddyq1vI.js","assets/autoplay.service-ap_sEfca.js","assets/bridge.command-DNktKXNP.js","assets/gameplay-replay-Dxz93B2M.js","assets/output-DK8waum9.js","assets/command-results-CUQD49AB.js","assets/debug-bridge-LaiaWRls.js","assets/build-profiles.document-C9gM1NV6.js","assets/build-session-CpAT9iQU.js","assets/configurations-CACHqi7T.js","assets/build-player.document-viLZOb6A.js","assets/build-progress.status-DKw0YdnU.js","assets/build.action-BrSZc3kA.js","assets/build.command-CVB-50ii.js","assets/build.header-BhOtTPyg.js","assets/build.menu-BHIVHysW.js","assets/build.service-C5awmXgd.js","assets/connection.status-CfFK9wti.js","assets/coverage.service-CyWmmos8.js","assets/edit-mode-audio.service-OcRQ9Ozq.js","assets/edit-mode-networking.service-BWz-nxiL.js","assets/game-document.service-CW928hrj.js","assets/frame-debugger-store-CCm_jyhx.js","assets/utility-view-state-y2PTWZuT.js","assets/PlayBar-DvpDIJXg.js","assets/run-selection-8wjzFzVg.js","assets/presentation-DPddUHCg.js","assets/surface-state-BUmVXUJj.js","assets/game-eval.command-D8ohGtA6.js","assets/game-module-access-gOlo85at.js","assets/gameplay.command-b2D2rbZV.js","assets/generation.service-B533Kbco.js","assets/model-thumbnail-DORLbXyw.js","assets/studio-environment-BCf09Sox.js","assets/generation-jobs-_kzxAnbI.js","assets/generation-CdOATubd.css","assets/generations.status-CDZ_eHJZ.js","assets/ingest.service-DQqEvbsT.js","assets/registry-XvQ4sPew.js","assets/mount-ingest-root-9KaA9ETn.js","assets/instances.command-wzs2BWwt.js","assets/navmesh.menu-DPNQ2RCH.js","assets/navmesh-workflow-store-Cmnm57TB.js","assets/navmesh.service-pffKX_Ht.js","assets/host-hierarchy-objects-BV3WqU2w.js","assets/network.utility-Bw74dLIu.js","assets/play.command-L6qPHLHh.js","assets/profiler.action-qMarbw9x.js","assets/profiler.menu-C52_wfu8.js","assets/profiler.utility-DzfXG0cD.js","assets/scene-document.service-qnY16vPq.js","assets/Object3DDocumentViewport-mDettU8s.js","assets/viewport-surface-status-CleQnKBz.js","assets/after-paint-CB4bz1-e.js","assets/state-watch.action-D0rXmFVx.js","assets/state-watch.menu-DJyVHqNM.js","assets/state-watch.utility-CHL55Pbn.js","assets/team-playtest.service-DErOWVaA.js","assets/collaboration-presence-wD0oKl7P.js","assets/transport.header-CDivn20X.js","assets/component-board.service-BzZ2JQC8.js","assets/component-board-registry-DrIa2csL.js","assets/story-media-presence-CEwzSadX.js","assets/design-time-mount.service-C8VeEbCC.js","assets/design-time-mount-registry-DUpXCg1U.js","assets/component-board.service-DTH3BKq_.js","assets/design-time-mount.service-DupCKL6-.js","assets/react-inspector.service-C7T_Pqud.js","assets/ShadowEditor-CBNfgpsF.js","assets/eyedropper-session-bjPXnfeX.js","assets/dom-authoring-adapter-71D70rVP.js","assets/story-documents.service-B1hhvZad.js","assets/story-documents-B8TSr_CN.js","assets/StoryPreviewMount-CN-jnvnn.js","assets/camera-runtime.inspector-BAc2xnsF.js","assets/component-board.service-Cnxftkv8.js","assets/component-verbs.command-_nUoLZ1s.js","assets/instance-fork-actions-D3sRzS3K.js","assets/fork-menu-Bujed-pM.js","assets/component-verbs.service-D9qvuexk.js","assets/constraints.inspector-DvTTgVxM.js","assets/constraint-Bp1l8hY-.js","assets/model-asset-sections.service-Dfkzhu6Q.js","assets/model-inspection-DgqjTy5z.js","assets/source-object3d-authoring-adapter-Des84Gk3.js","assets/project-provenance-BGnJXJwa.js","assets/model-asset-sections-D1uxOu2v.css","assets/reflection-probe-capture.inspector-DT1jvM_q.js","assets/reflection-probe-sIto9mh0.js","assets/story-documents.service-C_Q58qZs.js","assets/standard-viewport-dressing-DE9WE1Lv.js","assets/mounted-story-viewport-source-N0xrUdtm.js","assets/story-three-preview-Cp9kfSo0.js","assets/asset-preview-BzDHm81_.js","assets/bitmap-label-Ct4k6ehY.js","assets/crash-null-boundary-v3a0uEgw.js","assets/story-mount-turn-DFRTj5hi.js","assets/three-story-model-CE0vGtKW.js","assets/r3f-source-authoring-adapter-W1zVFNuZ.js","assets/live-gesture-lock-DJbrjOqf.js","assets/oid-transform-AHICFvQG.js","assets/three-authoring.service-B2LLPXyf.js","assets/three-story-capture.service-DJaS21h9.js","assets/canvas-story-capture.service-DTLE6FK3.js","assets/component-contracts.service-BJ73JRuk.js","assets/three-integration.service-BXQuaWQ-.js","assets/three-integration-C9bu5OXH.js","assets/layered-pick-Db8YSlDp.js","assets/root-stacking-BEd9ZvxC.js","assets/object3d-document-session-registry-DMhhDWnQ.js","assets/animation-mixers.service-xdiawk5y.js","assets/live-mixers-B-bwLZ7c.js","assets/animation-timeline.utility-Czb7Ax-Z.js","assets/transport-strip-B6Hauzjh.js","assets/machines.finder-B-DdPjby.js","assets/machine.document-CUO0RxDP.js","assets/GameplaySessionTimeline-DmGEiHHD.js","assets/react-18-By2b4xR9.js","assets/AudioViewer-DbO2vY3o.js","assets/ImageViewer-BXQ1dXgz.js","assets/VideoViewer-CrP78U5w.js","assets/JsonAssetDocument-BPQR7OXc.js","assets/OnlineAssetDetail-BMAMYfaN.js","assets/asset-editor-persistence-BIFP2LgP.js","assets/SourceAssetViewer-LGC-eTLS.js","assets/InspectorCanvasPreview-BrFjhoiD.js","assets/hosted-asset-materialization-DBLM2dtz.js","assets/NonThreeAuthoringBootstrap-BqY5ceef.js","assets/project-authoring-session-sbmVUm3i.js","assets/story-capture-BGeBen-R.js","assets/react-story-board-CPTQdOIn.js","assets/story-presentation-CdJ6Ncu6.js"])))=>i.map(i=>d[i]);
2
- import{r as Ye,a as mC}from"./index-nmcBqr7Y.js";import{a as $}from"./jsx-runtime-DPjLkJKQ.js";import{r as MS}from"./index-CtzuWnCS.js";import{F as Xyr}from"./index-FUuS4qwW.js";import{a as Xje}from"./client-DNXj_opT.js";import{g as Yje,a as Yyr,c as xmt}from"./_commonjsHelpers-D6-XlEtG.js";function Zyr(t,n){for(var s=0;s<n.length;s++){const c=n[s];if(typeof c!="string"&&!Array.isArray(c)){for(const d in c)if(d!=="default"&&!(d in t)){const m=Object.getOwnPropertyDescriptor(c,d);m&&Object.defineProperty(t,d,m.get?m:{enumerable:!0,get:()=>c[d]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const Qyr="modulepreload",e0r=function(t){return"/"+t},wmt={},fo=function(n,s,c){let d=Promise.resolve();if(s&&s.length>0){let g=function(A){return Promise.all(A.map(F=>Promise.resolve(F).then(D=>({status:"fulfilled",value:D}),D=>({status:"rejected",reason:D}))))};document.getElementsByTagName("link");const S=document.querySelector("meta[property=csp-nonce]"),k=S?.nonce||S?.getAttribute("nonce");d=g(s.map(A=>{if(A=e0r(A),A in wmt)return;wmt[A]=!0;const F=A.endsWith(".css"),D=F?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${A}"]${D}`))return;const J=document.createElement("link");if(J.rel=F?"stylesheet":Qyr,F||(J.as="script"),J.crossOrigin="",J.href=A,k&&J.setAttribute("nonce",k),document.head.appendChild(J),F)return new Promise((q,G)=>{J.addEventListener("load",q),J.addEventListener("error",()=>G(new Error(`Unable to preload CSS for ${A}`)))})}))}function m(g){const S=new Event("vite:preloadError",{cancelable:!0});if(S.payload=g,window.dispatchEvent(S),!S.defaultPrevented)throw g}return d.then(g=>{for(const S of g||[])S.status==="rejected"&&m(S.reason);return n().catch(m)})},t0r=[{entryPath:"@volter/editor-blender/contributions/blender-node-editor.document.tsx",load:()=>fo(()=>import("./blender-node-editor.document-BdX0SCxH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-timeline.document.tsx",load:()=>fo(()=>import("./blender-timeline.document-BTwdMhSn.js"),__vite__mapDeps([24,1,2,25,26,7,8,5,6,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-uv-editor.document.tsx",load:()=>fo(()=>import("./blender-uv-editor.document-CqxvqlSw.js"),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-runtime.document.tsx",load:()=>fo(()=>import("./blender-runtime.document-BAQTV4az.js"),__vite__mapDeps([28,1,2,25,26,7,8,5,6,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,29,30,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-version.status.tsx",load:()=>fo(()=>import("./blender-version.status-D-kPKENT.js"),__vite__mapDeps([31,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.command.ts",load:()=>fo(()=>import("./blender.command-BABpNHlJ.js"),__vite__mapDeps([32,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.environment.ts",load:()=>fo(()=>import("./blender.environment-CG-pC7sk.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.keymap.ts",load:()=>fo(()=>import("./blender.keymap-BmOBRY7p.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.status.tsx",load:()=>fo(()=>import("./blender.status-BMETIbb2.js"),__vite__mapDeps([33,1,2]))},{entryPath:"@volter/editor-blender/contributions/blender.style.ts",load:()=>fo(()=>import("./blender.style-DaIh9SiA.js"),[])},{entryPath:"@volter/editor-blender/contributions/model.layout.ts",load:()=>fo(()=>import("./model.layout-BpZE1W9V.js"),__vite__mapDeps([34,35]))},{entryPath:"@volter/editor-blender/contributions/models.finder.ts",load:()=>fo(()=>import("./models.finder-DzW1Sg26.js"),__vite__mapDeps([36,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone-constraints.inspector.tsx",load:()=>fo(()=>import("./properties-bone-constraints.inspector-DEOxhp1W.js"),__vite__mapDeps([37,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,39,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone.inspector.tsx",load:()=>fo(()=>import("./properties-bone.inspector-CY8EEYZl.js"),__vite__mapDeps([40,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-collection.inspector.tsx",load:()=>fo(()=>import("./properties-collection.inspector-rGoZwmsY.js"),__vite__mapDeps([41,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-constraints.inspector.tsx",load:()=>fo(()=>import("./properties-constraints.inspector-DJITSHiL.js"),__vite__mapDeps([39,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-data.inspector.tsx",load:()=>fo(()=>import("./properties-data.inspector-CNJ6cUzA.js"),__vite__mapDeps([42,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-material.inspector.tsx",load:()=>fo(()=>import("./properties-material.inspector-BkCUSFdM.js"),__vite__mapDeps([43,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-modifiers.inspector.tsx",load:()=>fo(()=>import("./properties-modifiers.inspector-C9ij0UfE.js"),__vite__mapDeps([44,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-object.inspector.tsx",load:()=>fo(()=>import("./properties-object.inspector-IvVsyikt.js"),__vite__mapDeps([45,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-output.inspector.tsx",load:()=>fo(()=>import("./properties-output.inspector-Df-fx8vq.js"),__vite__mapDeps([46,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-particles.inspector.tsx",load:()=>fo(()=>import("./properties-particles.inspector-J3UOyWlz.js"),__vite__mapDeps([47,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-physics.inspector.tsx",load:()=>fo(()=>import("./properties-physics.inspector-BmcTY5Q8.js"),__vite__mapDeps([48,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-render.inspector.tsx",load:()=>fo(()=>import("./properties-render.inspector-DUB5qwIR.js"),__vite__mapDeps([49,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-scene.inspector.tsx",load:()=>fo(()=>import("./properties-scene.inspector-DxBRs2ae.js"),__vite__mapDeps([50,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-texture.inspector.tsx",load:()=>fo(()=>import("./properties-texture.inspector-BqzPv1aS.js"),__vite__mapDeps([51,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-view-layer.inspector.tsx",load:()=>fo(()=>import("./properties-view-layer.inspector-D1a1Dc1r.js"),__vite__mapDeps([52,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-world.inspector.tsx",load:()=>fo(()=>import("./properties-world.inspector-CCwHv8ha.js"),__vite__mapDeps([53,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/sculpt.layout.ts",load:()=>fo(()=>import("./sculpt.layout-D-K5cLw6.js"),__vite__mapDeps([54,35]))},{entryPath:"@volter/editor-blender/contributions/shading.layout.ts",load:()=>fo(()=>import("./shading.layout-CZZHKBer.js"),__vite__mapDeps([55,35]))},{entryPath:"@volter/editor-blender/contributions/uv-editing.layout.ts",load:()=>fo(()=>import("./uv-editing.layout-A8RA-cbM.js"),__vite__mapDeps([56,35]))},{entryPath:"@volter/editor-blender/contributions/texture.layout.ts",load:()=>fo(()=>import("./texture.layout-DASpHVht.js"),[])}],r0r=[{entryPath:"@volter/editor-game/contributions/asset-budget-asset.menu.ts",load:()=>fo(()=>import("./asset-budget-asset.menu-CpHLTATf.js"),__vite__mapDeps([57,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.action.ts",load:()=>fo(()=>import("./asset-budget.action-C_ZI2rdN.js"),__vite__mapDeps([68,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.document.tsx",load:()=>fo(()=>import("./asset-budget.document-hmCS7sH2.js"),__vite__mapDeps([69,1,2,58,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.menu.ts",load:()=>fo(()=>import("./asset-budget.menu-BZyzyVdk.js"),__vite__mapDeps([70,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/audio-unlock.service.ts",load:()=>fo(()=>import("./audio-unlock.service-C2a8hsP0.js"),__vite__mapDeps([71,72,8,73,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network-observer.service.ts",load:()=>fo(()=>import("./network-observer.service-D61Whg6t.js"),__vite__mapDeps([74,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/audio.utility.tsx",load:()=>fo(()=>import("./audio.utility-VklURuQw.js"),__vite__mapDeps([135,1,2,3,4,20,21,136,22,23]))},{entryPath:"@volter/editor-game/contributions/autoplay.service.ts",load:()=>fo(()=>import("./autoplay.service-ap_sEfca.js"),__vite__mapDeps([137,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/bridge.command.ts",load:()=>fo(()=>import("./bridge.command-DNktKXNP.js"),__vite__mapDeps([138,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,139,140,141,142]))},{entryPath:"@volter/editor-game/contributions/build-profiles.document.tsx",load:()=>fo(()=>import("./build-profiles.document-C9gM1NV6.js"),__vite__mapDeps([143,1,2,3,4,20,21,144,145,22,23]))},{entryPath:"@volter/editor-game/contributions/build-player.document.tsx",load:()=>fo(()=>import("./build-player.document-viLZOb6A.js"),__vite__mapDeps([146,1,2,3,4,144,145,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build-progress.status.tsx",load:()=>fo(()=>import("./build-progress.status-DKw0YdnU.js"),__vite__mapDeps([147,1,2,3,4,144,145,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.action.ts",load:()=>fo(()=>import("./build.action-BrSZc3kA.js"),__vite__mapDeps([148,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.command.ts",load:()=>fo(()=>import("./build.command-CVB-50ii.js"),__vite__mapDeps([149,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.header.tsx",load:()=>fo(()=>import("./build.header-BhOtTPyg.js"),__vite__mapDeps([150,1,2,3,4,20,21,144,145,22,23]))},{entryPath:"@volter/editor-game/contributions/build.menu.ts",load:()=>fo(()=>import("./build.menu-BHIVHysW.js"),__vite__mapDeps([151,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.service.ts",load:()=>fo(()=>import("./build.service-C5awmXgd.js"),__vite__mapDeps([152,144,145,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/connection.status.tsx",load:()=>fo(()=>import("./connection.status-CfFK9wti.js"),__vite__mapDeps([153,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/coverage.service.ts",load:()=>fo(()=>import("./coverage.service-CyWmmos8.js"),__vite__mapDeps([154,88,82,3,2,4,1,20,21,22,23,87]))},{entryPath:"@volter/editor-game/contributions/edit-mode-audio.service.ts",load:()=>fo(()=>import("./edit-mode-audio.service-OcRQ9Ozq.js"),__vite__mapDeps([155,72,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/edit-mode-networking.service.ts",load:()=>fo(()=>import("./edit-mode-networking.service-BWz-nxiL.js"),__vite__mapDeps([156,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/game-document.service.ts",load:()=>fo(()=>import("./game-document.service-CW928hrj.js"),__vite__mapDeps([157,1,2,3,4,20,21,158,136,159,160,145,161,75,76,77,78,79,80,81,82,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,162,163]))},{entryPath:"@volter/editor-game/contributions/game-eval.command.ts",load:()=>fo(()=>import("./game-eval.command-D8ohGtA6.js"),__vite__mapDeps([164,165,3,2,4,1,20,21,22,23,141,105,82,88,106,81,75,76,77,78,79,80,83,73,84,85,7,8,86,87,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/game.layout.ts",load:()=>fo(()=>import("./game.layout-CBASrvQu.js"),[])},{entryPath:"@volter/editor-game/contributions/gameplay.command.ts",load:()=>fo(()=>import("./gameplay.command-b2D2rbZV.js"),__vite__mapDeps([166,141,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/generation.service.ts",load:()=>fo(()=>import("./generation.service-B533Kbco.js"),__vite__mapDeps([167,1,2,3,4,168,13,169,112,19,65,7,8,66,67,9,10,11,12,20,21,170,22,23,171]))},{entryPath:"@volter/editor-game/contributions/generations.status.tsx",load:()=>fo(()=>import("./generations.status-CDZ_eHJZ.js"),__vite__mapDeps([172,1,2,3,4,20,21,170,22,23]))},{entryPath:"@volter/editor-game/contributions/godot.style.ts",load:()=>fo(()=>import("./godot.style-NCC0Pm-A.js"),[])},{entryPath:"@volter/editor-game/contributions/godot.view.ts",load:()=>fo(()=>import("./godot.view-DinHwC_o.js"),[])},{entryPath:"@volter/editor-game/contributions/ingest.service.ts",load:()=>fo(()=>import("./ingest.service-DQqEvbsT.js"),__vite__mapDeps([173,174,175,105,82,3,2,4,1,20,21,22,23,88,106,81,133,134,14,7,8,15,114,19,112,111,29]))},{entryPath:"@volter/editor-game/contributions/instances.command.ts",load:()=>fo(()=>import("./instances.command-wzs2BWwt.js"),__vite__mapDeps([176,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/navmesh.menu.ts",load:()=>fo(()=>import("./navmesh.menu-DPNQ2RCH.js"),__vite__mapDeps([177,178,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/navmesh.service.ts",load:()=>fo(()=>import("./navmesh.service-pffKX_Ht.js"),__vite__mapDeps([179,62,63,178,29,180,30,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network.utility.tsx",load:()=>fo(()=>import("./network.utility-Bw74dLIu.js"),__vite__mapDeps([181,1,2,75,76,77,78,79,80,81,82,3,4,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/play.command.ts",load:()=>fo(()=>import("./play.command-L6qPHLHh.js"),__vite__mapDeps([182,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,141,161,145]))},{entryPath:"@volter/editor-game/contributions/profiler.action.ts",load:()=>fo(()=>import("./profiler.action-qMarbw9x.js"),__vite__mapDeps([183,159,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.menu.ts",load:()=>fo(()=>import("./profiler.menu-C52_wfu8.js"),__vite__mapDeps([184,159,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.utility.tsx",load:()=>fo(()=>import("./profiler.utility-DzfXG0cD.js"),__vite__mapDeps([185,1,2,159,3,4,20,21,158,22,23]))},{entryPath:"@volter/editor-game/contributions/scene-document.service.ts",load:()=>fo(()=>import("./scene-document.service-qnY16vPq.js"),__vite__mapDeps([186,1,2,187,3,4,188,20,21,189,133,134,14,7,8,15,114,19,22,23,112,111,29]))},{entryPath:"@volter/editor-game/contributions/state-watch.action.ts",load:()=>fo(()=>import("./state-watch.action-D0rXmFVx.js"),__vite__mapDeps([190,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.menu.ts",load:()=>fo(()=>import("./state-watch.menu-DJyVHqNM.js"),__vite__mapDeps([191,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.utility.tsx",load:()=>fo(()=>import("./state-watch.utility-CHL55Pbn.js"),__vite__mapDeps([192,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/team-playtest.service.ts",load:()=>fo(()=>import("./team-playtest.service-DErOWVaA.js"),__vite__mapDeps([193,194,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/transport.header.tsx",load:()=>fo(()=>import("./transport.header-CDivn20X.js"),__vite__mapDeps([195,1,2,3,4,160,145,161,75,76,77,78,79,80,81,82,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30]))},{entryPath:"@volter/editor-game/contributions/unity.style.ts",load:()=>fo(()=>import("./unity.style-BUZD1vdX.js"),[])},{entryPath:"@volter/editor-game/contributions/unity.view.ts",load:()=>fo(()=>import("./unity.view--n1Xt50A.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.style.ts",load:()=>fo(()=>import("./unreal.style-Cqf-hEzT.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.view.ts",load:()=>fo(()=>import("./unreal.view-CKSsDgA8.js"),[])},{entryPath:"@volter/editor-game/contributions/canvas/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-BzZ2JQC8.js"),__vite__mapDeps([196,197,198,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas/design-time-mount.service.ts",load:()=>fo(()=>import("./design-time-mount.service-C8VeEbCC.js"),__vite__mapDeps([199,200,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-DTH3BKq_.js").then(t=>t.c),__vite__mapDeps([201,197,198]))},{entryPath:"@volter/editor-game/contributions/react/design-time-mount.service.ts",load:()=>fo(()=>import("./design-time-mount.service-DupCKL6-.js"),__vite__mapDeps([202,200,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/react-inspector.service.ts",load:()=>fo(()=>import("./react-inspector.service-C7T_Pqud.js"),__vite__mapDeps([203,1,2,3,4,20,21,204,127,205,130,131,206,90,126,128,129,132,22,23]))},{entryPath:"@volter/editor-game/contributions/react/story-documents.service.ts",load:()=>fo(()=>import("./story-documents.service-B1hhvZad.js"),__vite__mapDeps([207,208,1,2,3,4,20,21,162,163,209,108,22,23]))},{entryPath:"@volter/editor-game/contributions/three/camera-runtime.inspector.tsx",load:()=>fo(()=>import("./camera-runtime.inspector-BAc2xnsF.js"),__vite__mapDeps([210,1,2,29,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-Cnxftkv8.js"),__vite__mapDeps([211,197,198,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.command.ts",load:()=>fo(()=>import("./component-verbs.command-_nUoLZ1s.js"),__vite__mapDeps([212,213,214,134,14,7,8,15,114,19,3,2,4,1,20,21,22,23,112,111,29,133]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.service.ts",load:()=>fo(()=>import("./component-verbs.service-D9qvuexk.js"),__vite__mapDeps([215,214,213,134,14,7,8,15,114,19,3,2,4,1,20,21,22,23,112,111,29]))},{entryPath:"@volter/editor-game/contributions/three/constraints.inspector.tsx",load:()=>fo(()=>import("./constraints.inspector-DvTTgVxM.js"),__vite__mapDeps([216,1,2,29,115,112,19,217,62,63,3,4,20,21,133,134,14,7,8,15,114,22,23,111]))},{entryPath:"@volter/editor-game/contributions/three/model-asset-sections.service.ts",load:()=>fo(()=>import("./model-asset-sections.service-Dfkzhu6Q.js"),__vite__mapDeps([218,1,2,29,219,112,19,8,220,114,3,4,20,21,22,23,113,115,111,116,119,221,122,62,63,222]))},{entryPath:"@volter/editor-game/contributions/three/reflection-probe-capture.inspector.tsx",load:()=>fo(()=>import("./reflection-probe-capture.inspector-DT1jvM_q.js"),__vite__mapDeps([223,1,2,29,224,62,63,3,4,20,21,133,134,14,7,8,15,114,19,22,23,112,111]))},{entryPath:"@volter/editor-game/contributions/three/story-documents.service.ts",load:()=>fo(()=>import("./story-documents.service-C_Q58qZs.js"),__vite__mapDeps([225,1,2,187,3,4,188,20,21,163,226,17,18,19,8,114,22,23,9,7,10,11,12,112,227,228,229,13,169,65,66,67,230,231,85,86,232,129,233,208,162,209,108,234,115,235,128,119,113,111,29,116,131,213,236,132,123,122,62,63]))},{entryPath:"@volter/editor-game/contributions/three/three-authoring.service.ts",load:()=>fo(()=>import("./three-authoring.service-B2LLPXyf.js"),__vite__mapDeps([237,200,89,90,117,115,112,19,118,106,119,114,3,2,4,1,20,21,22,23,113,111,29,116,8,120,62,63,121,122,84,123,134,14,7,15]))},{entryPath:"@volter/editor-game/contributions/three-story-capture.service.ts",load:()=>fo(()=>import("./three-story-capture.service-DJaS21h9.js"),__vite__mapDeps([238,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas-story-capture.service.ts",load:()=>fo(()=>import("./canvas-story-capture.service-DTLE6FK3.js"),__vite__mapDeps([239,3,2,4,1,20,21,22,23]))}],n0r=[{entryPath:"@volter/editor-react/contributions/component-contracts.service.ts",load:()=>fo(()=>import("./component-contracts.service-BJ73JRuk.js"),__vite__mapDeps([240,236,132,123,3,2,4,1,20,21,22,23]))}],i0r=[{entryPath:"@volter/editor-threejs/contributions/three-integration.service.ts",load:()=>fo(()=>import("./three-integration.service-BXQuaWQ-.js"),__vite__mapDeps([241,242,180,13,7,8,6,9,10,11,12,243,244,112,19,1,2,3,4,168,169,65,66,67,245,133,134,14,15,114,20,21,22,23,111,29,18,115,30,17,229,230]))},{entryPath:"@volter/editor-threejs/contributions/animation-mixers.service.ts",load:()=>fo(()=>import("./animation-mixers.service-xdiawk5y.js"),__vite__mapDeps([246,247,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-threejs/contributions/animation-timeline.utility.tsx",load:()=>fo(()=>import("./animation-timeline.utility-Czb7Ax-Z.js"),__vite__mapDeps([248,1,2,249,3,4,20,21,22,23]))}],o0r=[{entryPath:"@volter/editor-xstate/contributions/machines.finder.ts",load:()=>fo(()=>import("./machines.finder-B-DdPjby.js"),__vite__mapDeps([250,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-xstate/contributions/machine.document.tsx",load:()=>fo(()=>import("./machine.document-CUO0RxDP.js"),__vite__mapDeps([251,1,2,3,4,20,21,22,23]))}];let HY=null;const FOe=new Set;function lee(){return HY}function s0r(t){if(HY!==null&&HY.id!==t.id)throw new Error(`Two products in one page: "${HY.id}" is already composed and "${t.id}" asked to be. A product is the running program; one page runs one.`);HY=t;for(const n of FOe)n()}function TTt(t){return FOe.add(t),()=>FOe.delete(t)}/*!
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/blender-node-editor.document-DsDBkUHt.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-nmcBqr7Y.js","assets/index-D_NuPfjr.js","assets/blender-runtime-host-DtpNeLGc.js","assets/preview-renderer-BrYNFV1p.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/environment-Dg-YaLsA.js","assets/RoomEnvironment-BkknvS_I.js","assets/EXRLoader-CITMBvGd.js","assets/HDRLoader-BTGuGhVo.js","assets/renderer-ownership-BovSEcLv.js","assets/output-pass-HurwNl0G.js","assets/Pass-D1MRT672.js","assets/clip-planes-CnAI6DZn.js","assets/content-bounds-C1-UpGMc.js","assets/hierarchy-marks-CSQMtCBU.js","assets/workspace-arrangement-coA4mYU_.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/blender-timeline.document-qArofonU.js","assets/blender-runtime-skin-EKCns7fu.js","assets/LineSegments2-DN9pUfWA.js","assets/blender-uv-editor.document-Dv3ihJD4.js","assets/blender-runtime.document-CmLNi8tH.js","assets/three-contract-Dkt6PmWY.js","assets/viewport-door-DNJf5Mej.js","assets/blender-version.status-BEIisS2r.js","assets/blender.command-1xwFaSJs.js","assets/blender.status-BMETIbb2.js","assets/model.layout-BpZE1W9V.js","assets/regions-DWeEBnE2.js","assets/models.finder-CbfSmlRN.js","assets/properties-bone-constraints.inspector-DoCD043b.js","assets/blender-properties-tab-9RSYwbBS.js","assets/properties-constraints.inspector-BfpdPfPN.js","assets/properties-bone.inspector-mlQIkyBf.js","assets/properties-collection.inspector-BSGr9-vR.js","assets/properties-data.inspector-yyf0b8Uw.js","assets/properties-material.inspector-BjKs4qAn.js","assets/properties-modifiers.inspector-XAML7OJx.js","assets/properties-object.inspector-cHVVC7vP.js","assets/properties-output.inspector-BE6O5uWt.js","assets/properties-particles.inspector-DA9r9tox.js","assets/properties-physics.inspector-6V50bg6n.js","assets/properties-render.inspector-1iXZTLFj.js","assets/properties-scene.inspector-8qzTDRZ-.js","assets/properties-texture.inspector-DnndHFBA.js","assets/properties-view-layer.inspector-BFqtpGAW.js","assets/properties-world.inspector-DrZZRQoS.js","assets/sculpt.layout-D-K5cLw6.js","assets/shading.layout-CZZHKBer.js","assets/uv-editing.layout-A8RA-cbM.js","assets/asset-budget-asset.menu-B_A367BM.js","assets/AssetBudgetPanel-TYxRsWF2.js","assets/asset-loaders-ClM8urgu.js","assets/SkeletonUtils-YH9iLOY_.js","assets/asset-parse-error-BHMwBRU3.js","assets/user-data-CODoGZqA.js","assets/object-marks-BnvSuCTt.js","assets/loader-BTUKnX5Q.js","assets/KTX2Loader-CaqVE6nY.js","assets/GLTFLoader-KeoruJgS.js","assets/BufferGeometryUtils-B22h7jo4.js","assets/asset-budget.action-UgvyFZGk.js","assets/asset-budget.document-C20mZfef.js","assets/asset-budget.menu-C1THP8Ir.js","assets/audio-unlock.service-krSi_8MS.js","assets/pose-guard-CLabLSzf.js","assets/game-audio-BeCyd0Ha.js","assets/network-observer.service-CSbHzsem.js","assets/game-network-gqU0qk9j.js","assets/index-OZVqp6xS.js","assets/index-Da9JhEvW.js","assets/native-debug-module-D0TMOJ5J.js","assets/native-entry-surface-BE8LJNdu.js","assets/debug-registry--ZkoQWOO.js","assets/contract-system-adapters-StvC0uNq.js","assets/game-contract-seams-DYi5-NnM.js","assets/seeded-random-BMF_UDMF.js","assets/rapier-physics-adapter-CaZqWLu0.js","assets/events-156d8d12.esm-CYeuVCYr.js","assets/index-bQE2NA0D.js","assets/live-project-verbs-CSKXil-5.js","assets/capability-coverage-Ctnmu2LE.js","assets/edit-mode-authoring-B8NE5TIR.js","assets/json-history-resource-DWPJt2Bk.js","assets/binding-resolver-B6upIc33.js","assets/adapter-surface-Y37Nzcyw.js","assets/structural-signature-Dc7skRiy.js","assets/webgl-frame-capture-DdJkM2mi.js","assets/realm-services-DBqdRLI4.js","assets/canvas-entry-runtime-BURQgaLB.js","assets/three-ingest-runtime-DOUKRBrc.js","assets/EffectComposer-BEAt0PtQ.js","assets/CopyShader-BzTUYzf6.js","assets/ShaderPass-DTnDQXm0.js","assets/CSS3DRenderer-BsAqfavI.js","assets/relative-path-guard-GiM7Lsz8.js","assets/react-root-BHA-cdrW.js","assets/editor-presentation-activity-CqJH4G9t.js","assets/active-ingest-gUx8jeyJ.js","assets/ingest-source-persistence-D7jtuLEB.js","assets/pixi-story-model-DNkfnWUV.js","assets/surface-content-Dg9Kkazf.js","assets/viewport-root-presentation-CGYHAB1r.js","assets/mounted-authoring-CRGnDIkF.js","assets/entity-object-BqQBOLh4.js","assets/user-data-C2bC2Cok.js","assets/three-C0qVNsOS.js","assets/editor-layers-B2mwHrrn.js","assets/component-instance-root-DjA11g2U.js","assets/viewport-editor-controls-BYaAZ_Ku.js","assets/three-authoring-adapter-C92rm99z.js","assets/source-persistence-backend-iG_P2f_a.js","assets/three-projection-core-BOq13mz-.js","assets/body-marks-C1LxJtQb.js","assets/structural-ids-BOo2BRoY.js","assets/object3d-authoring-subject-XccsO0xG.js","assets/r3f-physics-binding-DSD0HHLc.js","assets/deferred-ingest-play-CmJi6tql.js","assets/rrweb-Cd2ifIRP.js","assets/react-world-authoring-adapter-CQtYfgx9.js","assets/board-guides-DnI_fMSm.js","assets/relative-import-specifier-BiEpXss5.js","assets/story-arg-descriptors-Ek86ExX7.js","assets/inspect-Cl65lNby.js","assets/inference-diagnostics-dZd7OUSj.js","assets/writer-tw6EcuVO.js","assets/three-state-B6NLTszJ.js","assets/editor-shell-store-V7HfbGqh.js","assets/game-surface-defaults-D8S4cRxi.js","assets/audio.utility-DjFH8tZN.js","assets/audio-meter-Cddyq1vI.js","assets/autoplay.service-C_iwBCWg.js","assets/bridge.command-C5EYO4OS.js","assets/gameplay-replay-CLHO__fQ.js","assets/output-DK8waum9.js","assets/command-results-CUQD49AB.js","assets/debug-bridge-BG5c-HdI.js","assets/build-profiles.document-B_6Df2Sp.js","assets/build-session-DKHnqiXT.js","assets/configurations-Bqg2uvA4.js","assets/build-player.document-LBxyS2AI.js","assets/build-progress.status-Cdt1Zuu_.js","assets/build.action-DRDdqtZb.js","assets/build.command-ry_OUUh9.js","assets/build.header-CiTCHvry.js","assets/build.menu-DiViXEwh.js","assets/build.service-BSGXA-SQ.js","assets/connection.status-BVL6eTcF.js","assets/coverage.service-DI7ocYK8.js","assets/edit-mode-audio.service-BZ_MguuB.js","assets/edit-mode-networking.service-BnR0zkEk.js","assets/game-document.service-jY65msUL.js","assets/frame-debugger-store-BFHDpd_6.js","assets/utility-view-state-DbTE0Ome.js","assets/PlayBar-C72OdJpY.js","assets/run-selection-CxsHUK_M.js","assets/presentation-CqPEUUNS.js","assets/surface-state-B_0Yt3kv.js","assets/game-eval.command-C0iQ6vZD.js","assets/game-module-access-BlCkxuVe.js","assets/gameplay.command-CQyRcFql.js","assets/generation.service-CgbxxPGg.js","assets/model-thumbnail-DcI972TR.js","assets/studio-environment-Cso4y0lE.js","assets/generation-jobs-C6l_ZBhD.js","assets/generation-CdOATubd.css","assets/generations.status-DIzDQ4QZ.js","assets/ingest.service-C2q5JocL.js","assets/registry-_NCUhY0b.js","assets/mount-ingest-root-CnfZV05y.js","assets/instances.command-CnrRMqOy.js","assets/navmesh.menu-BOqiQXs0.js","assets/navmesh-workflow-store-Cmnm57TB.js","assets/navmesh.service-DRssu5HB.js","assets/host-hierarchy-objects-BV3WqU2w.js","assets/network.utility-DkecVQis.js","assets/play.command-WI1aGM0Z.js","assets/profiler.action-DsAh7yvt.js","assets/profiler.menu-eMeZSO2J.js","assets/profiler.utility-B9hb8tbg.js","assets/scene-document.service-TFlDSvVA.js","assets/Object3DDocumentViewport-B4A-C5QD.js","assets/viewport-surface-status-Db1dCE5f.js","assets/after-paint-CB4bz1-e.js","assets/state-watch.action-BjMVtMnK.js","assets/state-watch.menu-uo9i_GJH.js","assets/state-watch.utility-BDSAOvyy.js","assets/team-playtest.service-BaW1I4YQ.js","assets/collaboration-presence-C-yh_YBU.js","assets/transport.header-DZ6f7-ON.js","assets/component-board.service-BJ2DCCXQ.js","assets/component-board-registry-DrIa2csL.js","assets/story-media-presence-9jRxsUgl.js","assets/design-time-mount.service-DaEwimcE.js","assets/design-time-mount-registry-DUpXCg1U.js","assets/component-board.service-COaCvlbA.js","assets/design-time-mount.service-m_Alk1A4.js","assets/react-inspector.service-DYyJPfNc.js","assets/ShadowEditor-CCch2nLq.js","assets/eyedropper-session-bjPXnfeX.js","assets/dom-authoring-adapter-BQor85A0.js","assets/story-documents.service-D_hsjJr9.js","assets/story-documents-DOsBtURt.js","assets/StoryPreviewMount-BNoIvc7l.js","assets/camera-runtime.inspector-CupJRuBs.js","assets/component-board.service-DwPBo3xK.js","assets/component-verbs.command-BwYzS1c0.js","assets/instance-fork-actions-D3sRzS3K.js","assets/fork-menu-CGygk03X.js","assets/component-verbs.service-CJvrj9av.js","assets/constraints.inspector-CqY4o8xc.js","assets/constraint-Bp1l8hY-.js","assets/model-asset-sections.service-eYy0ol55.js","assets/model-inspection-DM9bxnjs.js","assets/source-object3d-authoring-adapter-C2qh6_pn.js","assets/project-provenance-BGnJXJwa.js","assets/model-asset-sections-D1uxOu2v.css","assets/reflection-probe-capture.inspector-C5Bu6QzV.js","assets/reflection-probe-sIto9mh0.js","assets/story-documents.service-CbADy_Hj.js","assets/standard-viewport-dressing-DisOo98G.js","assets/mounted-story-viewport-source-BV9Vkz5j.js","assets/story-three-preview-Bg0NL_U_.js","assets/asset-preview-BD4OZrEp.js","assets/bitmap-label-Ct4k6ehY.js","assets/crash-null-boundary-v3a0uEgw.js","assets/story-mount-turn-DFRTj5hi.js","assets/three-story-model-7qxVYOkR.js","assets/r3f-source-authoring-adapter-Ca9azh8e.js","assets/live-gesture-lock-DJbrjOqf.js","assets/oid-transform-DELHL858.js","assets/three-authoring.service-D_KTfVs4.js","assets/three-story-capture.service-CcRSfWad.js","assets/canvas-story-capture.service-DQ6Zw3b0.js","assets/component-contracts.service-RJCV5AAt.js","assets/three-integration.service-k1_xWOYd.js","assets/three-integration-pMMAFpYl.js","assets/layered-pick-wB2IUStv.js","assets/root-stacking-BEd9ZvxC.js","assets/object3d-document-session-registry-D68l_sLd.js","assets/animation-mixers.service-CuNPgPSv.js","assets/live-mixers-B-bwLZ7c.js","assets/animation-timeline.utility-BzbSVAmj.js","assets/transport-strip-BlGEb51b.js","assets/machines.finder-Bq84a20u.js","assets/machine.document-Wxh00rVH.js","assets/GameplaySessionTimeline-B6GEizjr.js","assets/react-18-By2b4xR9.js","assets/AudioViewer-SyAuzT6d.js","assets/ImageViewer-CVnrpv0B.js","assets/VideoViewer-DrtHx0m_.js","assets/JsonAssetDocument-Cztt4zjY.js","assets/OnlineAssetDetail-B9ku5sHJ.js","assets/asset-editor-persistence-D-YVUM-o.js","assets/SourceAssetViewer-bAfvPckn.js","assets/InspectorCanvasPreview-BrFjhoiD.js","assets/hosted-asset-materialization-TryBlckx.js","assets/NonThreeAuthoringBootstrap-BHOfZ9sF.js","assets/project-authoring-session-7KN3YlPS.js","assets/story-capture-BZD3x0Pr.js","assets/react-story-board-Cry0gSQl.js","assets/story-presentation-CdTE_XUR.js"])))=>i.map(i=>d[i]);
2
+ import{r as Ye,a as mC}from"./index-nmcBqr7Y.js";import{a as $}from"./jsx-runtime-DPjLkJKQ.js";import{r as MS}from"./index-CtzuWnCS.js";import{F as Xyr}from"./index-FUuS4qwW.js";import{a as Xje}from"./client-DNXj_opT.js";import{g as Yje,a as Yyr,c as xmt}from"./_commonjsHelpers-D6-XlEtG.js";function Zyr(t,n){for(var s=0;s<n.length;s++){const c=n[s];if(typeof c!="string"&&!Array.isArray(c)){for(const d in c)if(d!=="default"&&!(d in t)){const m=Object.getOwnPropertyDescriptor(c,d);m&&Object.defineProperty(t,d,m.get?m:{enumerable:!0,get:()=>c[d]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const Qyr="modulepreload",e0r=function(t){return"/"+t},wmt={},fo=function(n,s,c){let d=Promise.resolve();if(s&&s.length>0){let g=function(A){return Promise.all(A.map(F=>Promise.resolve(F).then(D=>({status:"fulfilled",value:D}),D=>({status:"rejected",reason:D}))))};document.getElementsByTagName("link");const S=document.querySelector("meta[property=csp-nonce]"),k=S?.nonce||S?.getAttribute("nonce");d=g(s.map(A=>{if(A=e0r(A),A in wmt)return;wmt[A]=!0;const F=A.endsWith(".css"),D=F?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${A}"]${D}`))return;const J=document.createElement("link");if(J.rel=F?"stylesheet":Qyr,F||(J.as="script"),J.crossOrigin="",J.href=A,k&&J.setAttribute("nonce",k),document.head.appendChild(J),F)return new Promise((q,G)=>{J.addEventListener("load",q),J.addEventListener("error",()=>G(new Error(`Unable to preload CSS for ${A}`)))})}))}function m(g){const S=new Event("vite:preloadError",{cancelable:!0});if(S.payload=g,window.dispatchEvent(S),!S.defaultPrevented)throw g}return d.then(g=>{for(const S of g||[])S.status==="rejected"&&m(S.reason);return n().catch(m)})},t0r=[{entryPath:"@volter/editor-blender/contributions/blender-node-editor.document.tsx",load:()=>fo(()=>import("./blender-node-editor.document-DsDBkUHt.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-timeline.document.tsx",load:()=>fo(()=>import("./blender-timeline.document-qArofonU.js"),__vite__mapDeps([24,1,2,25,26,7,8,5,6,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-uv-editor.document.tsx",load:()=>fo(()=>import("./blender-uv-editor.document-Dv3ihJD4.js"),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-runtime.document.tsx",load:()=>fo(()=>import("./blender-runtime.document-CmLNi8tH.js"),__vite__mapDeps([28,1,2,25,26,7,8,5,6,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,29,30,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender-version.status.tsx",load:()=>fo(()=>import("./blender-version.status-BEIisS2r.js"),__vite__mapDeps([31,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.command.ts",load:()=>fo(()=>import("./blender.command-1xwFaSJs.js"),__vite__mapDeps([32,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/blender.environment.ts",load:()=>fo(()=>import("./blender.environment-CG-pC7sk.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.keymap.ts",load:()=>fo(()=>import("./blender.keymap-BmOBRY7p.js"),[])},{entryPath:"@volter/editor-blender/contributions/blender.status.tsx",load:()=>fo(()=>import("./blender.status-BMETIbb2.js"),__vite__mapDeps([33,1,2]))},{entryPath:"@volter/editor-blender/contributions/blender.style.ts",load:()=>fo(()=>import("./blender.style-DaIh9SiA.js"),[])},{entryPath:"@volter/editor-blender/contributions/model.layout.ts",load:()=>fo(()=>import("./model.layout-BpZE1W9V.js"),__vite__mapDeps([34,35]))},{entryPath:"@volter/editor-blender/contributions/models.finder.ts",load:()=>fo(()=>import("./models.finder-CbfSmlRN.js"),__vite__mapDeps([36,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone-constraints.inspector.tsx",load:()=>fo(()=>import("./properties-bone-constraints.inspector-DoCD043b.js"),__vite__mapDeps([37,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,39,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-bone.inspector.tsx",load:()=>fo(()=>import("./properties-bone.inspector-mlQIkyBf.js"),__vite__mapDeps([40,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-collection.inspector.tsx",load:()=>fo(()=>import("./properties-collection.inspector-BSGr9-vR.js"),__vite__mapDeps([41,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-constraints.inspector.tsx",load:()=>fo(()=>import("./properties-constraints.inspector-BfpdPfPN.js"),__vite__mapDeps([39,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-data.inspector.tsx",load:()=>fo(()=>import("./properties-data.inspector-yyf0b8Uw.js"),__vite__mapDeps([42,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-material.inspector.tsx",load:()=>fo(()=>import("./properties-material.inspector-BjKs4qAn.js"),__vite__mapDeps([43,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-modifiers.inspector.tsx",load:()=>fo(()=>import("./properties-modifiers.inspector-XAML7OJx.js"),__vite__mapDeps([44,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-object.inspector.tsx",load:()=>fo(()=>import("./properties-object.inspector-cHVVC7vP.js"),__vite__mapDeps([45,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-output.inspector.tsx",load:()=>fo(()=>import("./properties-output.inspector-BE6O5uWt.js"),__vite__mapDeps([46,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-particles.inspector.tsx",load:()=>fo(()=>import("./properties-particles.inspector-DA9r9tox.js"),__vite__mapDeps([47,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-physics.inspector.tsx",load:()=>fo(()=>import("./properties-physics.inspector-6V50bg6n.js"),__vite__mapDeps([48,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-render.inspector.tsx",load:()=>fo(()=>import("./properties-render.inspector-1iXZTLFj.js"),__vite__mapDeps([49,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-scene.inspector.tsx",load:()=>fo(()=>import("./properties-scene.inspector-8qzTDRZ-.js"),__vite__mapDeps([50,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-texture.inspector.tsx",load:()=>fo(()=>import("./properties-texture.inspector-DnndHFBA.js"),__vite__mapDeps([51,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-view-layer.inspector.tsx",load:()=>fo(()=>import("./properties-view-layer.inspector-BFqtpGAW.js"),__vite__mapDeps([52,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/properties-world.inspector.tsx",load:()=>fo(()=>import("./properties-world.inspector-DrZZRQoS.js"),__vite__mapDeps([53,38,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,3,4,20,21,22,23]))},{entryPath:"@volter/editor-blender/contributions/sculpt.layout.ts",load:()=>fo(()=>import("./sculpt.layout-D-K5cLw6.js"),__vite__mapDeps([54,35]))},{entryPath:"@volter/editor-blender/contributions/shading.layout.ts",load:()=>fo(()=>import("./shading.layout-CZZHKBer.js"),__vite__mapDeps([55,35]))},{entryPath:"@volter/editor-blender/contributions/uv-editing.layout.ts",load:()=>fo(()=>import("./uv-editing.layout-A8RA-cbM.js"),__vite__mapDeps([56,35]))},{entryPath:"@volter/editor-blender/contributions/texture.layout.ts",load:()=>fo(()=>import("./texture.layout-DASpHVht.js"),[])}],r0r=[{entryPath:"@volter/editor-game/contributions/asset-budget-asset.menu.ts",load:()=>fo(()=>import("./asset-budget-asset.menu-B_A367BM.js"),__vite__mapDeps([57,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.action.ts",load:()=>fo(()=>import("./asset-budget.action-UgvyFZGk.js"),__vite__mapDeps([68,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.document.tsx",load:()=>fo(()=>import("./asset-budget.document-C20mZfef.js"),__vite__mapDeps([69,1,2,58,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/asset-budget.menu.ts",load:()=>fo(()=>import("./asset-budget.menu-C1THP8Ir.js"),__vite__mapDeps([70,58,1,2,3,4,20,21,59,60,7,8,61,62,63,64,65,66,67,22,23]))},{entryPath:"@volter/editor-game/contributions/audio-unlock.service.ts",load:()=>fo(()=>import("./audio-unlock.service-krSi_8MS.js"),__vite__mapDeps([71,72,8,73,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network-observer.service.ts",load:()=>fo(()=>import("./network-observer.service-CSbHzsem.js"),__vite__mapDeps([74,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135]))},{entryPath:"@volter/editor-game/contributions/audio.utility.tsx",load:()=>fo(()=>import("./audio.utility-DjFH8tZN.js"),__vite__mapDeps([136,1,2,3,4,20,21,137,22,23]))},{entryPath:"@volter/editor-game/contributions/autoplay.service.ts",load:()=>fo(()=>import("./autoplay.service-C_iwBCWg.js"),__vite__mapDeps([138,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135]))},{entryPath:"@volter/editor-game/contributions/bridge.command.ts",load:()=>fo(()=>import("./bridge.command-C5EYO4OS.js"),__vite__mapDeps([139,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135,140,141,142,143]))},{entryPath:"@volter/editor-game/contributions/build-profiles.document.tsx",load:()=>fo(()=>import("./build-profiles.document-B_6Df2Sp.js"),__vite__mapDeps([144,1,2,3,4,20,21,145,146,22,23]))},{entryPath:"@volter/editor-game/contributions/build-player.document.tsx",load:()=>fo(()=>import("./build-player.document-LBxyS2AI.js"),__vite__mapDeps([147,1,2,3,4,145,146,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build-progress.status.tsx",load:()=>fo(()=>import("./build-progress.status-Cdt1Zuu_.js"),__vite__mapDeps([148,1,2,3,4,145,146,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.action.ts",load:()=>fo(()=>import("./build.action-DRDdqtZb.js"),__vite__mapDeps([149,145,146,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.command.ts",load:()=>fo(()=>import("./build.command-ry_OUUh9.js"),__vite__mapDeps([150,145,146,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.header.tsx",load:()=>fo(()=>import("./build.header-CiTCHvry.js"),__vite__mapDeps([151,1,2,3,4,20,21,145,146,22,23]))},{entryPath:"@volter/editor-game/contributions/build.menu.ts",load:()=>fo(()=>import("./build.menu-DiViXEwh.js"),__vite__mapDeps([152,145,146,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/build.service.ts",load:()=>fo(()=>import("./build.service-BSGXA-SQ.js"),__vite__mapDeps([153,145,146,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/connection.status.tsx",load:()=>fo(()=>import("./connection.status-BVL6eTcF.js"),__vite__mapDeps([154,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/coverage.service.ts",load:()=>fo(()=>import("./coverage.service-DI7ocYK8.js"),__vite__mapDeps([155,88,82,3,2,4,1,20,21,22,23,87]))},{entryPath:"@volter/editor-game/contributions/edit-mode-audio.service.ts",load:()=>fo(()=>import("./edit-mode-audio.service-BZ_MguuB.js"),__vite__mapDeps([156,72,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/edit-mode-networking.service.ts",load:()=>fo(()=>import("./edit-mode-networking.service-BnR0zkEk.js"),__vite__mapDeps([157,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/game-document.service.ts",load:()=>fo(()=>import("./game-document.service-jY65msUL.js"),__vite__mapDeps([158,1,2,3,4,20,21,159,137,160,161,146,162,75,76,77,78,79,80,81,82,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135,163,164]))},{entryPath:"@volter/editor-game/contributions/game-eval.command.ts",load:()=>fo(()=>import("./game-eval.command-C0iQ6vZD.js"),__vite__mapDeps([165,166,3,2,4,1,20,21,22,23,142,105,82,88,106,81,75,76,77,78,79,80,83,73,84,85,7,8,86,87,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135]))},{entryPath:"@volter/editor-game/contributions/game.layout.ts",load:()=>fo(()=>import("./game.layout-CBASrvQu.js"),[])},{entryPath:"@volter/editor-game/contributions/gameplay.command.ts",load:()=>fo(()=>import("./gameplay.command-CQyRcFql.js"),__vite__mapDeps([167,142,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135]))},{entryPath:"@volter/editor-game/contributions/generation.service.ts",load:()=>fo(()=>import("./generation.service-CgbxxPGg.js"),__vite__mapDeps([168,1,2,3,4,169,13,170,112,19,65,7,8,66,67,9,10,11,12,20,21,171,22,23,172]))},{entryPath:"@volter/editor-game/contributions/generations.status.tsx",load:()=>fo(()=>import("./generations.status-DIzDQ4QZ.js"),__vite__mapDeps([173,1,2,3,4,20,21,171,22,23]))},{entryPath:"@volter/editor-game/contributions/godot.style.ts",load:()=>fo(()=>import("./godot.style-NCC0Pm-A.js"),[])},{entryPath:"@volter/editor-game/contributions/godot.view.ts",load:()=>fo(()=>import("./godot.view-DinHwC_o.js"),[])},{entryPath:"@volter/editor-game/contributions/ingest.service.ts",load:()=>fo(()=>import("./ingest.service-C2q5JocL.js"),__vite__mapDeps([174,175,176,105,82,3,2,4,1,20,21,22,23,88,106,81,133,134,14,7,8,15,114,19,112,111,29]))},{entryPath:"@volter/editor-game/contributions/instances.command.ts",load:()=>fo(()=>import("./instances.command-CnrRMqOy.js"),__vite__mapDeps([177,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135]))},{entryPath:"@volter/editor-game/contributions/navmesh.menu.ts",load:()=>fo(()=>import("./navmesh.menu-BOqiQXs0.js"),__vite__mapDeps([178,179,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/navmesh.service.ts",load:()=>fo(()=>import("./navmesh.service-DRssu5HB.js"),__vite__mapDeps([180,62,63,179,29,181,30,8,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/network.utility.tsx",load:()=>fo(()=>import("./network.utility-DkecVQis.js"),__vite__mapDeps([182,1,2,75,76,77,78,79,80,81,82,3,4,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135]))},{entryPath:"@volter/editor-game/contributions/play.command.ts",load:()=>fo(()=>import("./play.command-WI1aGM0Z.js"),__vite__mapDeps([183,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135,142,162,146]))},{entryPath:"@volter/editor-game/contributions/profiler.action.ts",load:()=>fo(()=>import("./profiler.action-DsAh7yvt.js"),__vite__mapDeps([184,160,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.menu.ts",load:()=>fo(()=>import("./profiler.menu-eMeZSO2J.js"),__vite__mapDeps([185,160,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/profiler.utility.tsx",load:()=>fo(()=>import("./profiler.utility-B9hb8tbg.js"),__vite__mapDeps([186,1,2,160,3,4,20,21,159,22,23]))},{entryPath:"@volter/editor-game/contributions/scene-document.service.ts",load:()=>fo(()=>import("./scene-document.service-TFlDSvVA.js"),__vite__mapDeps([187,1,2,188,3,4,189,20,21,190,133,134,14,7,8,15,114,19,22,23,112,111,29]))},{entryPath:"@volter/editor-game/contributions/state-watch.action.ts",load:()=>fo(()=>import("./state-watch.action-BjMVtMnK.js"),__vite__mapDeps([191,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.menu.ts",load:()=>fo(()=>import("./state-watch.menu-uo9i_GJH.js"),__vite__mapDeps([192,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/state-watch.utility.tsx",load:()=>fo(()=>import("./state-watch.utility-BDSAOvyy.js"),__vite__mapDeps([193,1,2,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/team-playtest.service.ts",load:()=>fo(()=>import("./team-playtest.service-BaW1I4YQ.js"),__vite__mapDeps([194,195,75,76,77,2,78,79,80,81,82,3,4,1,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135]))},{entryPath:"@volter/editor-game/contributions/transport.header.tsx",load:()=>fo(()=>import("./transport.header-DZ6f7-ON.js"),__vite__mapDeps([196,1,2,3,4,161,146,162,75,76,77,78,79,80,81,82,20,21,22,23,83,73,84,85,7,8,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,15,101,102,103,104,105,106,107,108,109,110,111,112,19,29,113,114,115,116,117,118,119,120,62,63,121,122,123,124,125,126,127,128,129,130,131,132,133,134,14,30,135]))},{entryPath:"@volter/editor-game/contributions/unity.style.ts",load:()=>fo(()=>import("./unity.style-BUZD1vdX.js"),[])},{entryPath:"@volter/editor-game/contributions/unity.view.ts",load:()=>fo(()=>import("./unity.view--n1Xt50A.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.style.ts",load:()=>fo(()=>import("./unreal.style-Cqf-hEzT.js"),[])},{entryPath:"@volter/editor-game/contributions/unreal.view.ts",load:()=>fo(()=>import("./unreal.view-CKSsDgA8.js"),[])},{entryPath:"@volter/editor-game/contributions/canvas/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-BJ2DCCXQ.js"),__vite__mapDeps([197,198,199,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas/design-time-mount.service.ts",load:()=>fo(()=>import("./design-time-mount.service-DaEwimcE.js"),__vite__mapDeps([200,201,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-COaCvlbA.js").then(t=>t.c),__vite__mapDeps([202,198,199]))},{entryPath:"@volter/editor-game/contributions/react/design-time-mount.service.ts",load:()=>fo(()=>import("./design-time-mount.service-m_Alk1A4.js"),__vite__mapDeps([203,201,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/react/react-inspector.service.ts",load:()=>fo(()=>import("./react-inspector.service-DYyJPfNc.js"),__vite__mapDeps([204,1,2,3,4,20,21,205,127,206,130,131,207,90,126,128,129,132,22,23]))},{entryPath:"@volter/editor-game/contributions/react/story-documents.service.ts",load:()=>fo(()=>import("./story-documents.service-D_hsjJr9.js"),__vite__mapDeps([208,209,1,2,3,4,20,21,163,164,210,108,22,23]))},{entryPath:"@volter/editor-game/contributions/three/camera-runtime.inspector.tsx",load:()=>fo(()=>import("./camera-runtime.inspector-CupJRuBs.js"),__vite__mapDeps([211,1,2,29,3,4,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-board.service.ts",load:()=>fo(()=>import("./component-board.service-DwPBo3xK.js"),__vite__mapDeps([212,198,199,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.command.ts",load:()=>fo(()=>import("./component-verbs.command-BwYzS1c0.js"),__vite__mapDeps([213,214,215,134,14,7,8,15,114,19,3,2,4,1,20,21,22,23,112,111,29,133]))},{entryPath:"@volter/editor-game/contributions/three/component-verbs.service.ts",load:()=>fo(()=>import("./component-verbs.service-CJvrj9av.js"),__vite__mapDeps([216,215,214,134,14,7,8,15,114,19,3,2,4,1,20,21,22,23,112,111,29]))},{entryPath:"@volter/editor-game/contributions/three/constraints.inspector.tsx",load:()=>fo(()=>import("./constraints.inspector-CqY4o8xc.js"),__vite__mapDeps([217,1,2,29,115,112,19,218,62,63,3,4,20,21,133,134,14,7,8,15,114,22,23,111]))},{entryPath:"@volter/editor-game/contributions/three/model-asset-sections.service.ts",load:()=>fo(()=>import("./model-asset-sections.service-eYy0ol55.js"),__vite__mapDeps([219,1,2,29,220,112,19,8,221,114,3,4,20,21,22,23,113,115,111,116,119,222,122,62,63,223]))},{entryPath:"@volter/editor-game/contributions/three/reflection-probe-capture.inspector.tsx",load:()=>fo(()=>import("./reflection-probe-capture.inspector-C5Bu6QzV.js"),__vite__mapDeps([224,1,2,29,225,62,63,3,4,20,21,133,134,14,7,8,15,114,19,22,23,112,111]))},{entryPath:"@volter/editor-game/contributions/three/story-documents.service.ts",load:()=>fo(()=>import("./story-documents.service-CbADy_Hj.js"),__vite__mapDeps([226,1,2,188,3,4,189,20,21,164,227,17,18,19,8,114,22,23,9,7,10,11,12,112,228,229,230,13,170,65,66,67,231,232,85,86,233,129,234,209,163,210,108,235,115,236,128,119,113,111,29,116,131,214,237,132,123,122,62,63]))},{entryPath:"@volter/editor-game/contributions/three/three-authoring.service.ts",load:()=>fo(()=>import("./three-authoring.service-D_KTfVs4.js"),__vite__mapDeps([238,201,89,90,117,115,112,19,118,106,119,114,3,2,4,1,20,21,22,23,113,111,29,116,8,120,62,63,121,122,84,123,134,14,7,15]))},{entryPath:"@volter/editor-game/contributions/three-story-capture.service.ts",load:()=>fo(()=>import("./three-story-capture.service-CcRSfWad.js"),__vite__mapDeps([239,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-game/contributions/canvas-story-capture.service.ts",load:()=>fo(()=>import("./canvas-story-capture.service-DQ6Zw3b0.js"),__vite__mapDeps([240,3,2,4,1,20,21,22,23]))}],n0r=[{entryPath:"@volter/editor-react/contributions/component-contracts.service.ts",load:()=>fo(()=>import("./component-contracts.service-RJCV5AAt.js"),__vite__mapDeps([241,237,132,123,3,2,4,1,20,21,22,23]))}],i0r=[{entryPath:"@volter/editor-threejs/contributions/three-integration.service.ts",load:()=>fo(()=>import("./three-integration.service-k1_xWOYd.js"),__vite__mapDeps([242,243,181,13,7,8,6,9,10,11,12,244,245,112,19,1,2,3,4,169,170,65,66,67,246,133,134,14,15,114,20,21,22,23,111,29,18,115,30,17,230,231]))},{entryPath:"@volter/editor-threejs/contributions/animation-mixers.service.ts",load:()=>fo(()=>import("./animation-mixers.service-CuNPgPSv.js"),__vite__mapDeps([247,248,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-threejs/contributions/animation-timeline.utility.tsx",load:()=>fo(()=>import("./animation-timeline.utility-BzbSVAmj.js"),__vite__mapDeps([249,1,2,250,3,4,20,21,22,23]))}],o0r=[{entryPath:"@volter/editor-xstate/contributions/machines.finder.ts",load:()=>fo(()=>import("./machines.finder-Bq84a20u.js"),__vite__mapDeps([251,3,2,4,1,20,21,22,23]))},{entryPath:"@volter/editor-xstate/contributions/machine.document.tsx",load:()=>fo(()=>import("./machine.document-Wxh00rVH.js"),__vite__mapDeps([252,1,2,3,4,20,21,22,23]))}];let HY=null;const FOe=new Set;function lee(){return HY}function s0r(t){if(HY!==null&&HY.id!==t.id)throw new Error(`Two products in one page: "${HY.id}" is already composed and "${t.id}" asked to be. A product is the running program; one page runs one.`);HY=t;for(const n of FOe)n()}function TTt(t){return FOe.add(t),()=>FOe.delete(t)}/*!
3
3
  * Font Awesome Free 7.2.0 by @fontawesome - https://fontawesome.com
4
4
  * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
5
5
  * Copyright 2026 Fonticons, Inc.
@@ -42,7 +42,7 @@ import{r as Ye,a as mC}from"./index-nmcBqr7Y.js";import{a as $}from"./jsx-runtim
42
42
 
43
43
  `)}q.write("payload.value = newResult;"),q.write("return payload;");const Ce=q.compile();return(Fe,De)=>Ce(J,Fe,De)};let m;const g=ZB,S=!HOe.jitless,A=S&&mCt.value,F=n.catchall;let D;t._zod.parse=(J,q)=>{D??(D=c.value);const G=J.value;return g(G)?S&&A&&q?.async===!1&&q.jitless!==!0?(m||(m=d(n.shape)),J=m(J,q),F?AEt([],G,J,q,D,t):J):s(J,q):(J.issues.push({expected:"object",code:"invalid_type",input:G,inst:t}),J)}});function Vmt(t,n,s,c){for(const m of t)if(m.issues.length===0)return n.value=m.value,n;const d=t.filter(m=>!MO(m));return d.length===1?(n.value=d[0].value,d[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:s,errors:t.map(m=>m.issues.map(g=>Nw(g,c,$S())))}),n)}const hLe=ui("$ZodUnion",(t,n)=>{vu.init(t,n),Gu(t._zod,"optin",()=>n.options.some(d=>d._zod.optin==="optional")?"optional":void 0),Gu(t._zod,"optout",()=>n.options.some(d=>d._zod.optout==="optional")?"optional":void 0),Gu(t._zod,"values",()=>{if(n.options.every(d=>d._zod.values))return new Set(n.options.flatMap(d=>Array.from(d._zod.values)))}),Gu(t._zod,"pattern",()=>{if(n.options.every(d=>d._zod.pattern)){const d=n.options.map(m=>m._zod.pattern);return new RegExp(`^(${d.map(m=>aye(m.source)).join("|")})$`)}});const s=n.options.length===1,c=n.options[0]._zod.run;t._zod.parse=(d,m)=>{if(s)return c(d,m);let g=!1;const S=[];for(const k of n.options){const A=k._zod.run({value:d.value,issues:[]},m);if(A instanceof Promise)S.push(A),g=!0;else{if(A.issues.length===0)return A;S.push(A)}}return g?Promise.all(S).then(k=>Vmt(k,d,t,m)):Vmt(S,d,t,m)}});function Umt(t,n,s,c){const d=t.filter(m=>m.issues.length===0);return d.length===1?(n.value=d[0].value,n):(d.length===0?n.issues.push({code:"invalid_union",input:n.value,inst:s,errors:t.map(m=>m.issues.map(g=>Nw(g,c,$S())))}):n.issues.push({code:"invalid_union",input:n.value,inst:s,errors:[],inclusive:!1}),n)}const Hbr=ui("$ZodXor",(t,n)=>{hLe.init(t,n),n.inclusive=!1;const s=n.options.length===1,c=n.options[0]._zod.run;t._zod.parse=(d,m)=>{if(s)return c(d,m);let g=!1;const S=[];for(const k of n.options){const A=k._zod.run({value:d.value,issues:[]},m);A instanceof Promise?(S.push(A),g=!0):S.push(A)}return g?Promise.all(S).then(k=>Umt(k,d,t,m)):Umt(S,d,t,m)}}),Gbr=ui("$ZodDiscriminatedUnion",(t,n)=>{n.inclusive=!1,hLe.init(t,n);const s=t._zod.parse;Gu(t._zod,"propValues",()=>{const d={};for(const m of n.options){const g=m._zod.propValues;if(!g||Object.keys(g).length===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(m)}"`);for(const[S,k]of Object.entries(g)){d[S]||(d[S]=new Set);for(const A of k)d[S].add(A)}}return d});const c=dee(()=>{const d=n.options,m=new Map;for(const g of d){const S=g._zod.propValues?.[n.discriminator];if(!S||S.size===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(g)}"`);for(const k of S){if(m.has(k))throw new Error(`Duplicate discriminator value "${String(k)}"`);m.set(k,g)}}return m});t._zod.parse=(d,m)=>{const g=d.value;if(!ZB(g))return d.issues.push({code:"invalid_type",expected:"object",input:g,inst:t}),d;const S=c.value.get(g?.[n.discriminator]);return S?S._zod.run(d,m):n.unionFallback?s(d,m):(d.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,input:g,path:[n.discriminator],inst:t}),d)}}),Kbr=ui("$ZodIntersection",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value,m=n.left._zod.run({value:d,issues:[]},c),g=n.right._zod.run({value:d,issues:[]},c);return m instanceof Promise||g instanceof Promise?Promise.all([m,g]).then(([k,A])=>Jmt(s,k,A)):Jmt(s,m,g)}});function KOe(t,n){if(t===n)return{valid:!0,data:t};if(t instanceof Date&&n instanceof Date&&+t==+n)return{valid:!0,data:t};if(cR(t)&&cR(n)){const s=Object.keys(n),c=Object.keys(t).filter(m=>s.indexOf(m)!==-1),d={...t,...n};for(const m of c){const g=KOe(t[m],n[m]);if(!g.valid)return{valid:!1,mergeErrorPath:[m,...g.mergeErrorPath]};d[m]=g.data}return{valid:!0,data:d}}if(Array.isArray(t)&&Array.isArray(n)){if(t.length!==n.length)return{valid:!1,mergeErrorPath:[]};const s=[];for(let c=0;c<t.length;c++){const d=t[c],m=n[c],g=KOe(d,m);if(!g.valid)return{valid:!1,mergeErrorPath:[c,...g.mergeErrorPath]};s.push(g.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function Jmt(t,n,s){const c=new Map;let d;for(const S of n.issues)if(S.code==="unrecognized_keys"){d??(d=S);for(const k of S.keys)c.has(k)||c.set(k,{}),c.get(k).l=!0}else t.issues.push(S);for(const S of s.issues)if(S.code==="unrecognized_keys")for(const k of S.keys)c.has(k)||c.set(k,{}),c.get(k).r=!0;else t.issues.push(S);const m=[...c].filter(([,S])=>S.l&&S.r).map(([S])=>S);if(m.length&&d&&t.issues.push({...d,keys:m}),MO(t))return t;const g=KOe(n.value,s.value);if(!g.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(g.mergeErrorPath)}`);return t.value=g.data,t}const DEt=ui("$ZodTuple",(t,n)=>{vu.init(t,n);const s=n.items;t._zod.parse=(c,d)=>{const m=c.value;if(!Array.isArray(m))return c.issues.push({input:m,inst:t,expected:"tuple",code:"invalid_type"}),c;c.value=[];const g=[],S=[...s].reverse().findIndex(F=>F._zod.optin!=="optional"),k=S===-1?0:s.length-S;if(!n.rest){const F=m.length>s.length,D=m.length<k-1;if(F||D)return c.issues.push({...F?{code:"too_big",maximum:s.length,inclusive:!0}:{code:"too_small",minimum:s.length},input:m,inst:t,origin:"array"}),c}let A=-1;for(const F of s){if(A++,A>=m.length&&A>=k)continue;const D=F._zod.run({value:m[A],issues:[]},d);D instanceof Promise?g.push(D.then(J=>vpe(J,c,A))):vpe(D,c,A)}if(n.rest){const F=m.slice(s.length);for(const D of F){A++;const J=n.rest._zod.run({value:D,issues:[]},d);J instanceof Promise?g.push(J.then(q=>vpe(q,c,A))):vpe(J,c,A)}}return g.length?Promise.all(g).then(()=>c):c}});function vpe(t,n,s){t.issues.length&&n.issues.push(...hC(s,t.issues)),n.value[s]=t.value}const Xbr=ui("$ZodRecord",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value;if(!cR(d))return s.issues.push({expected:"record",code:"invalid_type",input:d,inst:t}),s;const m=[],g=n.keyType._zod.values;if(g){s.value={};const S=new Set;for(const A of g)if(typeof A=="string"||typeof A=="number"||typeof A=="symbol"){S.add(typeof A=="number"?A.toString():A);const F=n.valueType._zod.run({value:d[A],issues:[]},c);F instanceof Promise?m.push(F.then(D=>{D.issues.length&&s.issues.push(...hC(A,D.issues)),s.value[A]=D.value})):(F.issues.length&&s.issues.push(...hC(A,F.issues)),s.value[A]=F.value)}let k;for(const A in d)S.has(A)||(k=k??[],k.push(A));k&&k.length>0&&s.issues.push({code:"unrecognized_keys",input:d,inst:t,keys:k})}else{s.value={};for(const S of Reflect.ownKeys(d)){if(S==="__proto__")continue;let k=n.keyType._zod.run({value:S,issues:[]},c);if(k instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof S=="string"&&mLe.test(S)&&k.issues.length){const D=n.keyType._zod.run({value:Number(S),issues:[]},c);if(D instanceof Promise)throw new Error("Async schemas not supported in object keys currently");D.issues.length===0&&(k=D)}if(k.issues.length){n.mode==="loose"?s.value[S]=d[S]:s.issues.push({code:"invalid_key",origin:"record",issues:k.issues.map(D=>Nw(D,c,$S())),input:S,path:[S],inst:t});continue}const F=n.valueType._zod.run({value:d[S],issues:[]},c);F instanceof Promise?m.push(F.then(D=>{D.issues.length&&s.issues.push(...hC(S,D.issues)),s.value[k.value]=D.value})):(F.issues.length&&s.issues.push(...hC(S,F.issues)),s.value[k.value]=F.value)}}return m.length?Promise.all(m).then(()=>s):s}}),Ybr=ui("$ZodMap",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value;if(!(d instanceof Map))return s.issues.push({expected:"map",code:"invalid_type",input:d,inst:t}),s;const m=[];s.value=new Map;for(const[g,S]of d){const k=n.keyType._zod.run({value:g,issues:[]},c),A=n.valueType._zod.run({value:S,issues:[]},c);k instanceof Promise||A instanceof Promise?m.push(Promise.all([k,A]).then(([F,D])=>{Wmt(F,D,s,g,d,t,c)})):Wmt(k,A,s,g,d,t,c)}return m.length?Promise.all(m).then(()=>s):s}});function Wmt(t,n,s,c,d,m,g){t.issues.length&&(Fme.has(typeof c)?s.issues.push(...hC(c,t.issues)):s.issues.push({code:"invalid_key",origin:"map",input:d,inst:m,issues:t.issues.map(S=>Nw(S,g,$S()))})),n.issues.length&&(Fme.has(typeof c)?s.issues.push(...hC(c,n.issues)):s.issues.push({origin:"map",code:"invalid_element",input:d,inst:m,key:c,issues:n.issues.map(S=>Nw(S,g,$S()))})),s.value.set(t.value,n.value)}const Zbr=ui("$ZodSet",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value;if(!(d instanceof Set))return s.issues.push({input:d,inst:t,expected:"set",code:"invalid_type"}),s;const m=[];s.value=new Set;for(const g of d){const S=n.valueType._zod.run({value:g,issues:[]},c);S instanceof Promise?m.push(S.then(k=>Hmt(k,s))):Hmt(S,s)}return m.length?Promise.all(m).then(()=>s):s}});function Hmt(t,n){t.issues.length&&n.issues.push(...t.issues),n.value.add(t.value)}const Qbr=ui("$ZodEnum",(t,n)=>{vu.init(t,n);const s=dLe(n.entries),c=new Set(s);t._zod.values=c,t._zod.pattern=new RegExp(`^(${s.filter(d=>Fme.has(typeof d)).map(d=>typeof d=="string"?xD(d):d.toString()).join("|")})$`),t._zod.parse=(d,m)=>{const g=d.value;return c.has(g)||d.issues.push({code:"invalid_value",values:s,input:g,inst:t}),d}}),e2r=ui("$ZodLiteral",(t,n)=>{if(vu.init(t,n),n.values.length===0)throw new Error("Cannot create literal schema with no valid values");const s=new Set(n.values);t._zod.values=s,t._zod.pattern=new RegExp(`^(${n.values.map(c=>typeof c=="string"?xD(c):c?xD(c.toString()):String(c)).join("|")})$`),t._zod.parse=(c,d)=>{const m=c.value;return s.has(m)||c.issues.push({code:"invalid_value",values:n.values,input:m,inst:t}),c}}),t2r=ui("$ZodFile",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{const d=s.value;return d instanceof File||s.issues.push({expected:"file",code:"invalid_type",input:d,inst:t}),s}}),r2r=ui("$ZodTransform",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new fLe(t.constructor.name);const d=n.transform(s.value,s);if(c.async)return(d instanceof Promise?d:Promise.resolve(d)).then(g=>(s.value=g,s));if(d instanceof Promise)throw new yB;return s.value=d,s}});function Gmt(t,n){return t.issues.length&&n===void 0?{issues:[],value:void 0}:t}const PEt=ui("$ZodOptional",(t,n)=>{vu.init(t,n),t._zod.optin="optional",t._zod.optout="optional",Gu(t._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),Gu(t._zod,"pattern",()=>{const s=n.innerType._zod.pattern;return s?new RegExp(`^(${aye(s.source)})?$`):void 0}),t._zod.parse=(s,c)=>{if(n.innerType._zod.optin==="optional"){const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>Gmt(m,s.value)):Gmt(d,s.value)}return s.value===void 0?s:n.innerType._zod.run(s,c)}}),n2r=ui("$ZodExactOptional",(t,n)=>{PEt.init(t,n),Gu(t._zod,"values",()=>n.innerType._zod.values),Gu(t._zod,"pattern",()=>n.innerType._zod.pattern),t._zod.parse=(s,c)=>n.innerType._zod.run(s,c)}),i2r=ui("$ZodNullable",(t,n)=>{vu.init(t,n),Gu(t._zod,"optin",()=>n.innerType._zod.optin),Gu(t._zod,"optout",()=>n.innerType._zod.optout),Gu(t._zod,"pattern",()=>{const s=n.innerType._zod.pattern;return s?new RegExp(`^(${aye(s.source)}|null)$`):void 0}),Gu(t._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),t._zod.parse=(s,c)=>s.value===null?s:n.innerType._zod.run(s,c)}),o2r=ui("$ZodDefault",(t,n)=>{vu.init(t,n),t._zod.optin="optional",Gu(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(s,c)=>{if(c.direction==="backward")return n.innerType._zod.run(s,c);if(s.value===void 0)return s.value=n.defaultValue,s;const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>Kmt(m,n)):Kmt(d,n)}});function Kmt(t,n){return t.value===void 0&&(t.value=n.defaultValue),t}const s2r=ui("$ZodPrefault",(t,n)=>{vu.init(t,n),t._zod.optin="optional",Gu(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(s,c)=>(c.direction==="backward"||s.value===void 0&&(s.value=n.defaultValue),n.innerType._zod.run(s,c))}),a2r=ui("$ZodNonOptional",(t,n)=>{vu.init(t,n),Gu(t._zod,"values",()=>{const s=n.innerType._zod.values;return s?new Set([...s].filter(c=>c!==void 0)):void 0}),t._zod.parse=(s,c)=>{const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>Xmt(m,t)):Xmt(d,t)}});function Xmt(t,n){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:n}),t}const c2r=ui("$ZodSuccess",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new fLe("ZodSuccess");const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>(s.value=m.issues.length===0,s)):(s.value=d.issues.length===0,s)}}),l2r=ui("$ZodCatch",(t,n)=>{vu.init(t,n),Gu(t._zod,"optin",()=>n.innerType._zod.optin),Gu(t._zod,"optout",()=>n.innerType._zod.optout),Gu(t._zod,"values",()=>n.innerType._zod.values),t._zod.parse=(s,c)=>{if(c.direction==="backward")return n.innerType._zod.run(s,c);const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(m=>(s.value=m.value,m.issues.length&&(s.value=n.catchValue({...s,error:{issues:m.issues.map(g=>Nw(g,c,$S()))},input:s.value}),s.issues=[]),s)):(s.value=d.value,d.issues.length&&(s.value=n.catchValue({...s,error:{issues:d.issues.map(m=>Nw(m,c,$S()))},input:s.value}),s.issues=[]),s)}}),u2r=ui("$ZodNaN",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>((typeof s.value!="number"||!Number.isNaN(s.value))&&s.issues.push({input:s.value,inst:t,expected:"nan",code:"invalid_type"}),s)}),f2r=ui("$ZodPipe",(t,n)=>{vu.init(t,n),Gu(t._zod,"values",()=>n.in._zod.values),Gu(t._zod,"optin",()=>n.in._zod.optin),Gu(t._zod,"optout",()=>n.out._zod.optout),Gu(t._zod,"propValues",()=>n.in._zod.propValues),t._zod.parse=(s,c)=>{if(c.direction==="backward"){const m=n.out._zod.run(s,c);return m instanceof Promise?m.then(g=>bpe(g,n.in,c)):bpe(m,n.in,c)}const d=n.in._zod.run(s,c);return d instanceof Promise?d.then(m=>bpe(m,n.out,c)):bpe(d,n.out,c)}});function bpe(t,n,s){return t.issues.length?(t.aborted=!0,t):n._zod.run({value:t.value,issues:t.issues},s)}const IEt=ui("$ZodCodec",(t,n)=>{vu.init(t,n),Gu(t._zod,"values",()=>n.in._zod.values),Gu(t._zod,"optin",()=>n.in._zod.optin),Gu(t._zod,"optout",()=>n.out._zod.optout),Gu(t._zod,"propValues",()=>n.in._zod.propValues),t._zod.parse=(s,c)=>{if((c.direction||"forward")==="forward"){const m=n.in._zod.run(s,c);return m instanceof Promise?m.then(g=>Spe(g,n,c)):Spe(m,n,c)}else{const m=n.out._zod.run(s,c);return m instanceof Promise?m.then(g=>Spe(g,n,c)):Spe(m,n,c)}}});function Spe(t,n,s){if(t.issues.length)return t.aborted=!0,t;if((s.direction||"forward")==="forward"){const d=n.transform(t.value,t);return d instanceof Promise?d.then(m=>xpe(t,m,n.out,s)):xpe(t,d,n.out,s)}else{const d=n.reverseTransform(t.value,t);return d instanceof Promise?d.then(m=>xpe(t,m,n.in,s)):xpe(t,d,n.in,s)}}function xpe(t,n,s,c){return t.issues.length?(t.aborted=!0,t):s._zod.run({value:n,issues:t.issues},c)}const d2r=ui("$ZodReadonly",(t,n)=>{vu.init(t,n),Gu(t._zod,"propValues",()=>n.innerType._zod.propValues),Gu(t._zod,"values",()=>n.innerType._zod.values),Gu(t._zod,"optin",()=>n.innerType?._zod?.optin),Gu(t._zod,"optout",()=>n.innerType?._zod?.optout),t._zod.parse=(s,c)=>{if(c.direction==="backward")return n.innerType._zod.run(s,c);const d=n.innerType._zod.run(s,c);return d instanceof Promise?d.then(Ymt):Ymt(d)}});function Ymt(t){return t.value=Object.freeze(t.value),t}const p2r=ui("$ZodTemplateLiteral",(t,n)=>{vu.init(t,n);const s=[];for(const c of n.parts)if(typeof c=="object"&&c!==null){if(!c._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...c._zod.traits].shift()}`);const d=c._zod.pattern instanceof RegExp?c._zod.pattern.source:c._zod.pattern;if(!d)throw new Error(`Invalid template literal part: ${c._zod.traits}`);const m=d.startsWith("^")?1:0,g=d.endsWith("$")?d.length-1:d.length;s.push(d.slice(m,g))}else if(c===null||hCt.has(typeof c))s.push(xD(`${c}`));else throw new Error(`Invalid template literal part: ${c}`);t._zod.pattern=new RegExp(`^${s.join("")}$`),t._zod.parse=(c,d)=>typeof c.value!="string"?(c.issues.push({input:c.value,inst:t,expected:"string",code:"invalid_type"}),c):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(c.value)||c.issues.push({input:c.value,inst:t,code:"invalid_format",format:n.format??"template_literal",pattern:t._zod.pattern.source}),c)}),_2r=ui("$ZodFunction",(t,n)=>(vu.init(t,n),t._def=n,t._zod.def=n,t.implement=s=>{if(typeof s!="function")throw new Error("implement() must be called with a function");return function(...c){const d=t._def.input?Bmt(t._def.input,c):c,m=Reflect.apply(s,this,d);return t._def.output?Bmt(t._def.output,m):m}},t.implementAsync=s=>{if(typeof s!="function")throw new Error("implementAsync() must be called with a function");return async function(...c){const d=t._def.input?await $mt(t._def.input,c):c,m=await Reflect.apply(s,this,d);return t._def.output?await $mt(t._def.output,m):m}},t._zod.parse=(s,c)=>typeof s.value!="function"?(s.issues.push({code:"invalid_type",expected:"function",input:s.value,inst:t}),s):(t._def.output&&t._def.output._zod.def.type==="promise"?s.value=t.implementAsync(s.value):s.value=t.implement(s.value),s),t.input=(...s)=>{const c=t.constructor;return Array.isArray(s[0])?new c({type:"function",input:new DEt({type:"tuple",items:s[0],rest:s[1]}),output:t._def.output}):new c({type:"function",input:s[0],output:t._def.output})},t.output=s=>{const c=t.constructor;return new c({type:"function",input:t._def.input,output:s})},t)),m2r=ui("$ZodPromise",(t,n)=>{vu.init(t,n),t._zod.parse=(s,c)=>Promise.resolve(s.value).then(d=>n.innerType._zod.run({value:d,issues:[]},c))}),h2r=ui("$ZodLazy",(t,n)=>{vu.init(t,n),Gu(t._zod,"innerType",()=>n.getter()),Gu(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Gu(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Gu(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Gu(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(s,c)=>t._zod.innerType._zod.run(s,c)}),g2r=ui("$ZodCustom",(t,n)=>{eh.init(t,n),vu.init(t,n),t._zod.parse=(s,c)=>s,t._zod.check=s=>{const c=s.value,d=n.fn(c);if(d instanceof Promise)return d.then(m=>Zmt(m,s,c,t));Zmt(d,s,c,t)}});function Zmt(t,n,s,c){if(!t){const d={code:"custom",input:s,inst:c,path:[...c._zod.def.path??[]],continue:!c._zod.def.abort};c._zod.def.params&&(d.params=c._zod.def.params),n.issues.push(QB(d))}}var Qmt;const Uhn=Symbol("ZodOutput"),Jhn=Symbol("ZodInput");class y2r{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...s){const c=s[0];return this._map.set(n,c),c&&typeof c=="object"&&"id"in c&&this._idmap.set(c.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const s=this._map.get(n);return s&&typeof s=="object"&&"id"in s&&this._idmap.delete(s.id),this._map.delete(n),this}get(n){const s=n._zod.parent;if(s){const c={...this.get(s)??{}};delete c.id;const d={...c,...this._map.get(n)};return Object.keys(d).length?d:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function v2r(){return new y2r}(Qmt=globalThis).__zod_globalRegistry??(Qmt.__zod_globalRegistry=v2r());const sD=globalThis.__zod_globalRegistry;function b2r(t,n){return new t({type:"string",...Jo(n)})}function Whn(t,n){return new t({type:"string",coerce:!0,...Jo(n)})}function NEt(t,n){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Jo(n)})}function XOe(t,n){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Jo(n)})}function OEt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Jo(n)})}function REt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Jo(n)})}function FEt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Jo(n)})}function MEt(t,n){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Jo(n)})}function gLe(t,n){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Jo(n)})}function jEt(t,n){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Jo(n)})}function LEt(t,n){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Jo(n)})}function BEt(t,n){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Jo(n)})}function $Et(t,n){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Jo(n)})}function qEt(t,n){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Jo(n)})}function zEt(t,n){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Jo(n)})}function VEt(t,n){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Jo(n)})}function UEt(t,n){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Jo(n)})}function JEt(t,n){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Jo(n)})}function S2r(t,n){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...Jo(n)})}function WEt(t,n){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Jo(n)})}function HEt(t,n){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Jo(n)})}function GEt(t,n){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Jo(n)})}function KEt(t,n){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Jo(n)})}function XEt(t,n){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Jo(n)})}function YEt(t,n){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Jo(n)})}const Hhn={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function x2r(t,n){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Jo(n)})}function w2r(t,n){return new t({type:"string",format:"date",check:"string_format",...Jo(n)})}function T2r(t,n){return new t({type:"string",format:"time",check:"string_format",precision:null,...Jo(n)})}function C2r(t,n){return new t({type:"string",format:"duration",check:"string_format",...Jo(n)})}function E2r(t,n){return new t({type:"number",checks:[],...Jo(n)})}function Ghn(t,n){return new t({type:"number",coerce:!0,checks:[],...Jo(n)})}function k2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Jo(n)})}function A2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...Jo(n)})}function D2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...Jo(n)})}function P2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...Jo(n)})}function I2r(t,n){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...Jo(n)})}function N2r(t,n){return new t({type:"boolean",...Jo(n)})}function Khn(t,n){return new t({type:"boolean",coerce:!0,...Jo(n)})}function O2r(t,n){return new t({type:"bigint",...Jo(n)})}function Xhn(t,n){return new t({type:"bigint",coerce:!0,...Jo(n)})}function R2r(t,n){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...Jo(n)})}function F2r(t,n){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...Jo(n)})}function M2r(t,n){return new t({type:"symbol",...Jo(n)})}function j2r(t,n){return new t({type:"undefined",...Jo(n)})}function L2r(t,n){return new t({type:"null",...Jo(n)})}function B2r(t){return new t({type:"any"})}function $2r(t){return new t({type:"unknown"})}function q2r(t,n){return new t({type:"never",...Jo(n)})}function z2r(t,n){return new t({type:"void",...Jo(n)})}function V2r(t,n){return new t({type:"date",...Jo(n)})}function Yhn(t,n){return new t({type:"date",coerce:!0,...Jo(n)})}function U2r(t,n){return new t({type:"nan",...Jo(n)})}function ZZ(t,n){return new SEt({check:"less_than",...Jo(n),value:t,inclusive:!1})}function XI(t,n){return new SEt({check:"less_than",...Jo(n),value:t,inclusive:!0})}function QZ(t,n){return new xEt({check:"greater_than",...Jo(n),value:t,inclusive:!1})}function qk(t,n){return new xEt({check:"greater_than",...Jo(n),value:t,inclusive:!0})}function Zhn(t){return QZ(0,t)}function Qhn(t){return ZZ(0,t)}function egn(t){return XI(0,t)}function tgn(t){return qk(0,t)}function YOe(t,n){return new q1r({check:"multiple_of",...Jo(n),value:t})}function yLe(t,n){return new U1r({check:"max_size",...Jo(n),maximum:t})}function eQ(t,n){return new J1r({check:"min_size",...Jo(n),minimum:t})}function ZEt(t,n){return new W1r({check:"size_equals",...Jo(n),size:t})}function QEt(t,n){return new H1r({check:"max_length",...Jo(n),maximum:t})}function jme(t,n){return new G1r({check:"min_length",...Jo(n),minimum:t})}function ekt(t,n){return new K1r({check:"length_equals",...Jo(n),length:t})}function J2r(t,n){return new X1r({check:"string_format",format:"regex",...Jo(n),pattern:t})}function W2r(t){return new Y1r({check:"string_format",format:"lowercase",...Jo(t)})}function H2r(t){return new Z1r({check:"string_format",format:"uppercase",...Jo(t)})}function G2r(t,n){return new Q1r({check:"string_format",format:"includes",...Jo(n),includes:t})}function K2r(t,n){return new ebr({check:"string_format",format:"starts_with",...Jo(n),prefix:t})}function X2r(t,n){return new tbr({check:"string_format",format:"ends_with",...Jo(n),suffix:t})}function rgn(t,n,s){return new rbr({check:"property",property:t,schema:n,...Jo(s)})}function Y2r(t,n){return new nbr({check:"mime_type",mime:t,...Jo(n)})}function M$(t){return new ibr({check:"overwrite",tx:t})}function Z2r(t){return M$(n=>n.normalize(t))}function Q2r(){return M$(t=>t.trim())}function eSr(){return M$(t=>t.toLowerCase())}function tSr(){return M$(t=>t.toUpperCase())}function rSr(){return M$(t=>_Ct(t))}function nSr(t,n,s){return new t({type:"array",element:n,...Jo(s)})}function ngn(t,n,s){return new t({type:"union",options:n,...Jo(s)})}function ign(t,n,s){return new t({type:"union",options:n,inclusive:!1,...Jo(s)})}function ogn(t,n,s,c){return new t({type:"union",options:s,discriminator:n,...Jo(c)})}function sgn(t,n,s){return new t({type:"intersection",left:n,right:s})}function agn(t,n,s,c){const d=s instanceof vu,m=d?c:s,g=d?s:null;return new t({type:"tuple",items:n,rest:g,...Jo(m)})}function cgn(t,n,s,c){return new t({type:"record",keyType:n,valueType:s,...Jo(c)})}function lgn(t,n,s,c){return new t({type:"map",keyType:n,valueType:s,...Jo(c)})}function ugn(t,n,s){return new t({type:"set",valueType:n,...Jo(s)})}function fgn(t,n,s){const c=Array.isArray(n)?Object.fromEntries(n.map(d=>[d,d])):n;return new t({type:"enum",entries:c,...Jo(s)})}function dgn(t,n,s){return new t({type:"enum",entries:n,...Jo(s)})}function pgn(t,n,s){return new t({type:"literal",values:Array.isArray(n)?n:[n],...Jo(s)})}function iSr(t,n){return new t({type:"file",...Jo(n)})}function _gn(t,n){return new t({type:"transform",transform:n})}function mgn(t,n){return new t({type:"optional",innerType:n})}function hgn(t,n){return new t({type:"nullable",innerType:n})}function ggn(t,n,s){return new t({type:"default",innerType:n,get defaultValue(){return typeof s=="function"?s():cye(s)}})}function ygn(t,n,s){return new t({type:"nonoptional",innerType:n,...Jo(s)})}function vgn(t,n){return new t({type:"success",innerType:n})}function bgn(t,n,s){return new t({type:"catch",innerType:n,catchValue:typeof s=="function"?s:()=>s})}function Sgn(t,n,s){return new t({type:"pipe",in:n,out:s})}function xgn(t,n){return new t({type:"readonly",innerType:n})}function wgn(t,n,s){return new t({type:"template_literal",parts:n,...Jo(s)})}function Tgn(t,n){return new t({type:"lazy",getter:n})}function Cgn(t,n){return new t({type:"promise",innerType:n})}function oSr(t,n,s){const c=Jo(s);return c.abort??(c.abort=!0),new t({type:"custom",check:"custom",fn:n,...c})}function sSr(t,n,s){return new t({type:"custom",check:"custom",fn:n,...Jo(s)})}function aSr(t){const n=cSr(s=>(s.addIssue=c=>{if(typeof c=="string")s.issues.push(QB(c,s.value,n._zod.def));else{const d=c;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=s.value),d.inst??(d.inst=n),d.continue??(d.continue=!n._zod.def.abort),s.issues.push(QB(d))}},t(s.value,s)));return n}function cSr(t,n){const s=new eh({check:"custom",...Jo(n)});return s._zod.check=t,s}function lSr(t){const n=new eh({check:"describe"});return n._zod.onattach=[s=>{const c=sD.get(s)??{};sD.add(s,{...c,description:t})}],n._zod.check=()=>{},n}function uSr(t){const n=new eh({check:"meta"});return n._zod.onattach=[s=>{const c=sD.get(s)??{};sD.add(s,{...c,...t})}],n._zod.check=()=>{},n}function fSr(t,n){const s=Jo(n);let c=s.truthy??["true","1","yes","on","y","enabled"],d=s.falsy??["false","0","no","off","n","disabled"];s.case!=="sensitive"&&(c=c.map(q=>typeof q=="string"?q.toLowerCase():q),d=d.map(q=>typeof q=="string"?q.toLowerCase():q));const m=new Set(c),g=new Set(d),S=t.Codec??IEt,k=t.Boolean??CEt,A=t.String??hye,F=new A({type:"string",error:s.error}),D=new k({type:"boolean",error:s.error}),J=new S({type:"pipe",in:F,out:D,transform:((q,G)=>{let se=q;return s.case!=="sensitive"&&(se=se.toLowerCase()),m.has(se)?!0:g.has(se)?!1:(G.issues.push({code:"invalid_value",expected:"stringbool",values:[...m,...g],input:G.value,inst:J,continue:!1}),{})}),reverseTransform:((q,G)=>q===!0?c[0]||"true":d[0]||"false"),error:s.error});return J}function gye(t,n,s,c={}){const d=Jo(c),m={...Jo(c),check:"string_format",type:"string",format:n,fn:typeof s=="function"?s:S=>s.test(S),...d};return s instanceof RegExp&&(m.pattern=s),new t(m)}function Lme(t){let n=t?.target??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??sD,target:n,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function F_(t,n,s={path:[],schemaPath:[]}){var c;const d=t._zod.def,m=n.seen.get(t);if(m)return m.count++,s.schemaPath.includes(t)&&(m.cycle=s.path),m.schema;const g={schema:{},count:1,cycle:void 0,path:s.path};n.seen.set(t,g);const S=t._zod.toJSONSchema?.();if(S)g.schema=S;else{const F={...s,schemaPath:[...s.schemaPath,t],path:s.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(n,g.schema,F);else{const J=g.schema,q=n.processors[d.type];if(!q)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${d.type}`);q(t,n,J,F)}const D=t._zod.parent;D&&(g.ref||(g.ref=D),F_(D,n,F),n.seen.get(D).isParent=!0)}const k=n.metadataRegistry.get(t);return k&&Object.assign(g.schema,k),n.io==="input"&&W1(t)&&(delete g.schema.examples,delete g.schema.default),n.io==="input"&&g.schema._prefault&&((c=g.schema).default??(c.default=g.schema._prefault)),delete g.schema._prefault,n.seen.get(t).schema}function Bme(t,n){const s=t.seen.get(n);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=new Map;for(const g of t.seen.entries()){const S=t.metadataRegistry.get(g[0])?.id;if(S){const k=c.get(S);if(k&&k!==g[0])throw new Error(`Duplicate schema id "${S}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);c.set(S,g[0])}}const d=g=>{const S=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const D=t.external.registry.get(g[0])?.id,J=t.external.uri??(G=>G);if(D)return{ref:J(D)};const q=g[1].defId??g[1].schema.id??`schema${t.counter++}`;return g[1].defId=q,{defId:q,ref:`${J("__shared")}#/${S}/${q}`}}if(g[1]===s)return{ref:"#"};const A=`#/${S}/`,F=g[1].schema.id??`__schema${t.counter++}`;return{defId:F,ref:A+F}},m=g=>{if(g[1].schema.$ref)return;const S=g[1],{ref:k,defId:A}=d(g);S.def={...S.schema},A&&(S.defId=A);const F=S.schema;for(const D in F)delete F[D];F.$ref=k};if(t.cycles==="throw")for(const g of t.seen.entries()){const S=g[1];if(S.cycle)throw new Error(`Cycle detected: #/${S.cycle?.join("/")}/<root>
44
44
 
45
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const g of t.seen.entries()){const S=g[1];if(n===g[0]){m(g);continue}if(t.external){const A=t.external.registry.get(g[0])?.id;if(n!==g[0]&&A){m(g);continue}}if(t.metadataRegistry.get(g[0])?.id){m(g);continue}if(S.cycle){m(g);continue}if(S.count>1&&t.reused==="ref"){m(g);continue}}}function $me(t,n){const s=t.seen.get(n);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=g=>{const S=t.seen.get(g);if(S.ref===null)return;const k=S.def??S.schema,A={...k},F=S.ref;if(S.ref=null,F){c(F);const J=t.seen.get(F),q=J.schema;if(q.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push(q)):Object.assign(k,q),Object.assign(k,A),g._zod.parent===F)for(const se in k)se==="$ref"||se==="allOf"||se in A||delete k[se];if(q.$ref&&J.def)for(const se in k)se==="$ref"||se==="allOf"||se in J.def&&JSON.stringify(k[se])===JSON.stringify(J.def[se])&&delete k[se]}const D=g._zod.parent;if(D&&D!==F){c(D);const J=t.seen.get(D);if(J?.schema.$ref&&(k.$ref=J.schema.$ref,J.def))for(const q in k)q==="$ref"||q==="allOf"||q in J.def&&JSON.stringify(k[q])===JSON.stringify(J.def[q])&&delete k[q]}t.override({zodSchema:g,jsonSchema:k,path:S.path??[]})};for(const g of[...t.seen.entries()].reverse())c(g[0]);const d={};if(t.target==="draft-2020-12"?d.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?d.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?d.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const g=t.external.registry.get(n)?.id;if(!g)throw new Error("Schema is missing an `id` property");d.$id=t.external.uri(g)}Object.assign(d,s.def??s.schema);const m=t.external?.defs??{};for(const g of t.seen.entries()){const S=g[1];S.def&&S.defId&&(m[S.defId]=S.def)}t.external||Object.keys(m).length>0&&(t.target==="draft-2020-12"?d.$defs=m:d.definitions=m);try{const g=JSON.parse(JSON.stringify(d));return Object.defineProperty(g,"~standard",{value:{...n["~standard"],jsonSchema:{input:qme(n,"input",t.processors),output:qme(n,"output",t.processors)}},enumerable:!1,writable:!1}),g}catch{throw new Error("Error converting schema to JSON.")}}function W1(t,n){const s=n??{seen:new Set};if(s.seen.has(t))return!1;s.seen.add(t);const c=t._zod.def;if(c.type==="transform")return!0;if(c.type==="array")return W1(c.element,s);if(c.type==="set")return W1(c.valueType,s);if(c.type==="lazy")return W1(c.getter(),s);if(c.type==="promise"||c.type==="optional"||c.type==="nonoptional"||c.type==="nullable"||c.type==="readonly"||c.type==="default"||c.type==="prefault")return W1(c.innerType,s);if(c.type==="intersection")return W1(c.left,s)||W1(c.right,s);if(c.type==="record"||c.type==="map")return W1(c.keyType,s)||W1(c.valueType,s);if(c.type==="pipe")return W1(c.in,s)||W1(c.out,s);if(c.type==="object"){for(const d in c.shape)if(W1(c.shape[d],s))return!0;return!1}if(c.type==="union"){for(const d of c.options)if(W1(d,s))return!0;return!1}if(c.type==="tuple"){for(const d of c.items)if(W1(d,s))return!0;return!!(c.rest&&W1(c.rest,s))}return!1}const dSr=(t,n={})=>s=>{const c=Lme({...s,processors:n});return F_(t,c),Bme(c,t),$me(c,t)},qme=(t,n,s={})=>c=>{const{libraryOptions:d,target:m}=c??{},g=Lme({...d??{},target:m,io:n,processors:s});return F_(t,g),Bme(g,t),$me(g,t)},pSr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tkt=(t,n,s,c)=>{const d=s;d.type="string";const{minimum:m,maximum:g,format:S,patterns:k,contentEncoding:A}=t._zod.bag;if(typeof m=="number"&&(d.minLength=m),typeof g=="number"&&(d.maxLength=g),S&&(d.format=pSr[S]??S,d.format===""&&delete d.format,S==="time"&&delete d.format),A&&(d.contentEncoding=A),k&&k.size>0){const F=[...k];F.length===1?d.pattern=F[0].source:F.length>1&&(d.allOf=[...F.map(D=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:D.source}))])}},rkt=(t,n,s,c)=>{const d=s,{minimum:m,maximum:g,format:S,multipleOf:k,exclusiveMaximum:A,exclusiveMinimum:F}=t._zod.bag;typeof S=="string"&&S.includes("int")?d.type="integer":d.type="number",typeof F=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(d.minimum=F,d.exclusiveMinimum=!0):d.exclusiveMinimum=F),typeof m=="number"&&(d.minimum=m,typeof F=="number"&&n.target!=="draft-04"&&(F>=m?delete d.minimum:delete d.exclusiveMinimum)),typeof A=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(d.maximum=A,d.exclusiveMaximum=!0):d.exclusiveMaximum=A),typeof g=="number"&&(d.maximum=g,typeof A=="number"&&n.target!=="draft-04"&&(A<=g?delete d.maximum:delete d.exclusiveMaximum)),typeof k=="number"&&(d.multipleOf=k)},nkt=(t,n,s,c)=>{s.type="boolean"},ikt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},okt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},skt=(t,n,s,c)=>{n.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},akt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},ckt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},lkt=(t,n,s,c)=>{s.not={}},ukt=(t,n,s,c)=>{},fkt=(t,n,s,c)=>{},dkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},pkt=(t,n,s,c)=>{const d=t._zod.def,m=dLe(d.entries);m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),s.enum=m},_kt=(t,n,s,c)=>{const d=t._zod.def,m=[];for(const g of d.values)if(g===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(g))}else m.push(g);if(m.length!==0)if(m.length===1){const g=m[0];s.type=g===null?"null":typeof g,n.target==="draft-04"||n.target==="openapi-3.0"?s.enum=[g]:s.const=g}else m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),m.every(g=>typeof g=="boolean")&&(s.type="boolean"),m.every(g=>g===null)&&(s.type="null"),s.enum=m},mkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},hkt=(t,n,s,c)=>{const d=s,m=t._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");d.type="string",d.pattern=m.source},gkt=(t,n,s,c)=>{const d=s,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:S,mime:k}=t._zod.bag;g!==void 0&&(m.minLength=g),S!==void 0&&(m.maxLength=S),k?k.length===1?(m.contentMediaType=k[0],Object.assign(d,m)):(Object.assign(d,m),d.anyOf=k.map(A=>({contentMediaType:A}))):Object.assign(d,m)},ykt=(t,n,s,c)=>{s.type="boolean"},vkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},bkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Skt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},xkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},wkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Tkt=(t,n,s,c)=>{const d=s,m=t._zod.def,{minimum:g,maximum:S}=t._zod.bag;typeof g=="number"&&(d.minItems=g),typeof S=="number"&&(d.maxItems=S),d.type="array",d.items=F_(m.element,n,{...c,path:[...c.path,"items"]})},Ckt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="object",d.properties={};const g=m.shape;for(const A in g)d.properties[A]=F_(g[A],n,{...c,path:[...c.path,"properties",A]});const S=new Set(Object.keys(g)),k=new Set([...S].filter(A=>{const F=m.shape[A]._zod;return n.io==="input"?F.optin===void 0:F.optout===void 0}));k.size>0&&(d.required=Array.from(k)),m.catchall?._zod.def.type==="never"?d.additionalProperties=!1:m.catchall?m.catchall&&(d.additionalProperties=F_(m.catchall,n,{...c,path:[...c.path,"additionalProperties"]})):n.io==="output"&&(d.additionalProperties=!1)},vLe=(t,n,s,c)=>{const d=t._zod.def,m=d.inclusive===!1,g=d.options.map((S,k)=>F_(S,n,{...c,path:[...c.path,m?"oneOf":"anyOf",k]}));m?s.oneOf=g:s.anyOf=g},Ekt=(t,n,s,c)=>{const d=t._zod.def,m=F_(d.left,n,{...c,path:[...c.path,"allOf",0]}),g=F_(d.right,n,{...c,path:[...c.path,"allOf",1]}),S=A=>"allOf"in A&&Object.keys(A).length===1,k=[...S(m)?m.allOf:[m],...S(g)?g.allOf:[g]];s.allOf=k},kkt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="array";const g=n.target==="draft-2020-12"?"prefixItems":"items",S=n.target==="draft-2020-12"||n.target==="openapi-3.0"?"items":"additionalItems",k=m.items.map((J,q)=>F_(J,n,{...c,path:[...c.path,g,q]})),A=m.rest?F_(m.rest,n,{...c,path:[...c.path,S,...n.target==="openapi-3.0"?[m.items.length]:[]]}):null;n.target==="draft-2020-12"?(d.prefixItems=k,A&&(d.items=A)):n.target==="openapi-3.0"?(d.items={anyOf:k},A&&d.items.anyOf.push(A),d.minItems=k.length,A||(d.maxItems=k.length)):(d.items=k,A&&(d.additionalItems=A));const{minimum:F,maximum:D}=t._zod.bag;typeof F=="number"&&(d.minItems=F),typeof D=="number"&&(d.maxItems=D)},Akt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="object";const g=m.keyType,k=g._zod.bag?.patterns;if(m.mode==="loose"&&k&&k.size>0){const F=F_(m.valueType,n,{...c,path:[...c.path,"patternProperties","*"]});d.patternProperties={};for(const D of k)d.patternProperties[D.source]=F}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(d.propertyNames=F_(m.keyType,n,{...c,path:[...c.path,"propertyNames"]})),d.additionalProperties=F_(m.valueType,n,{...c,path:[...c.path,"additionalProperties"]});const A=g._zod.values;if(A){const F=[...A].filter(D=>typeof D=="string"||typeof D=="number");F.length>0&&(d.required=F)}},Dkt=(t,n,s,c)=>{const d=t._zod.def,m=F_(d.innerType,n,c),g=n.seen.get(t);n.target==="openapi-3.0"?(g.ref=d.innerType,s.nullable=!0):s.anyOf=[m,{type:"null"}]},Pkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},Ikt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,s.default=JSON.parse(JSON.stringify(d.defaultValue))},Nkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,n.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(d.defaultValue)))},Okt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType;let g;try{g=d.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=g},Rkt=(t,n,s,c)=>{const d=t._zod.def,m=n.io==="input"?d.in._zod.def.type==="transform"?d.out:d.in:d.out;F_(m,n,c);const g=n.seen.get(t);g.ref=m},Fkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,s.readOnly=!0},Mkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},bLe=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},jkt=(t,n,s,c)=>{const d=t._zod.innerType;F_(d,n,c);const m=n.seen.get(t);m.ref=d},eht={string:tkt,number:rkt,boolean:nkt,bigint:ikt,symbol:okt,null:skt,undefined:akt,void:ckt,never:lkt,any:ukt,unknown:fkt,date:dkt,enum:pkt,literal:_kt,nan:mkt,template_literal:hkt,file:gkt,success:ykt,custom:vkt,function:bkt,transform:Skt,map:xkt,set:wkt,array:Tkt,object:Ckt,union:vLe,intersection:Ekt,tuple:kkt,record:Akt,nullable:Dkt,nonoptional:Pkt,default:Ikt,prefault:Nkt,catch:Okt,pipe:Rkt,readonly:Fkt,promise:Mkt,optional:bLe,lazy:jkt};function _Sr(t,n){if("_idmap"in t){const c=t,d=Lme({...n,processors:eht}),m={};for(const k of c._idmap.entries()){const[A,F]=k;F_(F,d)}const g={},S={registry:c,uri:n?.uri,defs:m};d.external=S;for(const k of c._idmap.entries()){const[A,F]=k;Bme(d,F),g[A]=$me(d,F)}if(Object.keys(m).length>0){const k=d.target==="draft-2020-12"?"$defs":"definitions";g.__shared={[k]:m}}return{schemas:g}}const s=Lme({...n,processors:eht});return F_(t,s),Bme(s,t),$me(s,t)}const Lkt=ui("ZodISODateTime",(t,n)=>{ybr.init(t,n),j_.init(t,n)});function Bkt(t){return x2r(Lkt,t)}const $kt=ui("ZodISODate",(t,n)=>{vbr.init(t,n),j_.init(t,n)});function qkt(t){return w2r($kt,t)}const zkt=ui("ZodISOTime",(t,n)=>{bbr.init(t,n),j_.init(t,n)});function Vkt(t){return T2r(zkt,t)}const Ukt=ui("ZodISODuration",(t,n)=>{Sbr.init(t,n),j_.init(t,n)});function Jkt(t){return C2r(Ukt,t)}const Egn=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:$kt,ZodISODateTime:Lkt,ZodISODuration:Ukt,ZodISOTime:zkt,date:qkt,datetime:Bkt,duration:Jkt,time:Vkt},Symbol.toStringTag,{value:"Module"})),Wkt=(t,n)=>{ICt.init(t,n),t.name="ZodError",Object.defineProperties(t,{format:{value:s=>d1r(t,s)},flatten:{value:s=>f1r(t,s)},addIssue:{value:s=>{t.issues.push(s),t.message=JSON.stringify(t.issues,Rme,2)}},addIssues:{value:s=>{t.issues.push(...s),t.message=JSON.stringify(t.issues,Rme,2)}},isEmpty:{get(){return t.issues.length===0}}})},kgn=ui("ZodError",Wkt),Mw=ui("ZodError",Wkt,{Parent:Error}),mSr=fye(Mw),hSr=dye(Mw),gSr=pye(Mw),ySr=_ye(Mw),vSr=NCt(Mw),bSr=OCt(Mw),SSr=RCt(Mw),xSr=FCt(Mw),wSr=MCt(Mw),TSr=jCt(Mw),CSr=LCt(Mw),ESr=BCt(Mw),Lu=ui("ZodType",(t,n)=>(vu.init(t,n),Object.assign(t["~standard"],{jsonSchema:{input:qme(t,"input"),output:qme(t,"output")}}),t.toJSONSchema=dSr(t,{}),t.def=n,t.type=n.type,Object.defineProperty(t,"_def",{value:n}),t.check=(...s)=>t.clone(oA(n,{checks:[...n.checks??[],...s.map(c=>typeof c=="function"?{_zod:{check:c,def:{check:"custom"},onattach:[]}}:c)]}),{parent:!0}),t.with=t.check,t.clone=(s,c)=>sA(t,s,c),t.brand=()=>t,t.register=((s,c)=>(s.add(t,c),t)),t.parse=(s,c)=>mSr(t,s,c,{callee:t.parse}),t.safeParse=(s,c)=>gSr(t,s,c),t.parseAsync=async(s,c)=>hSr(t,s,c,{callee:t.parseAsync}),t.safeParseAsync=async(s,c)=>ySr(t,s,c),t.spa=t.safeParseAsync,t.encode=(s,c)=>vSr(t,s,c),t.decode=(s,c)=>bSr(t,s,c),t.encodeAsync=async(s,c)=>SSr(t,s,c),t.decodeAsync=async(s,c)=>xSr(t,s,c),t.safeEncode=(s,c)=>wSr(t,s,c),t.safeDecode=(s,c)=>TSr(t,s,c),t.safeEncodeAsync=async(s,c)=>CSr(t,s,c),t.safeDecodeAsync=async(s,c)=>ESr(t,s,c),t.refine=(s,c)=>t.check(OAt(s,c)),t.superRefine=s=>t.check(RAt(s)),t.overwrite=s=>t.check(M$(s)),t.optional=()=>Ume(t),t.exactOptional=()=>mAt(t),t.nullable=()=>Jme(t),t.nullish=()=>Ume(Jme(t)),t.nonoptional=s=>SAt(t,s),t.array=()=>Gd(t),t.or=s=>AR([t,s]),t.and=s=>ULe(t,s),t.transform=s=>Wme(t,JLe(s)),t.default=s=>yAt(t,s),t.prefault=s=>bAt(t,s),t.catch=s=>TAt(t,s),t.pipe=s=>Wme(t,s),t.readonly=()=>kAt(t),t.describe=s=>{const c=t.clone();return sD.add(c,{description:s}),c},Object.defineProperty(t,"description",{get(){return sD.get(t)?.description},configurable:!0}),t.meta=(...s)=>{if(s.length===0)return sD.get(t);const c=t.clone();return sD.add(c,s[0]),c},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=s=>s(t),t)),SLe=ui("_ZodString",(t,n)=>{hye.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>tkt(t,c,d);const s=t._zod.bag;t.format=s.format??null,t.minLength=s.minimum??null,t.maxLength=s.maximum??null,t.regex=(...c)=>t.check(J2r(...c)),t.includes=(...c)=>t.check(G2r(...c)),t.startsWith=(...c)=>t.check(K2r(...c)),t.endsWith=(...c)=>t.check(X2r(...c)),t.min=(...c)=>t.check(jme(...c)),t.max=(...c)=>t.check(QEt(...c)),t.length=(...c)=>t.check(ekt(...c)),t.nonempty=(...c)=>t.check(jme(1,...c)),t.lowercase=c=>t.check(W2r(c)),t.uppercase=c=>t.check(H2r(c)),t.trim=()=>t.check(Q2r()),t.normalize=(...c)=>t.check(Z2r(...c)),t.toLowerCase=()=>t.check(eSr()),t.toUpperCase=()=>t.check(tSr()),t.slugify=()=>t.check(rSr())}),xLe=ui("ZodString",(t,n)=>{hye.init(t,n),SLe.init(t,n),t.email=s=>t.check(NEt(wLe,s)),t.url=s=>t.check(gLe(yye,s)),t.jwt=s=>t.check(YEt(LLe,s)),t.emoji=s=>t.check(jEt(TLe,s)),t.guid=s=>t.check(XOe(zme,s)),t.uuid=s=>t.check(OEt(aD,s)),t.uuidv4=s=>t.check(REt(aD,s)),t.uuidv6=s=>t.check(FEt(aD,s)),t.uuidv7=s=>t.check(MEt(aD,s)),t.nanoid=s=>t.check(LEt(CLe,s)),t.guid=s=>t.check(XOe(zme,s)),t.cuid=s=>t.check(BEt(ELe,s)),t.cuid2=s=>t.check($Et(kLe,s)),t.ulid=s=>t.check(qEt(ALe,s)),t.base64=s=>t.check(GEt(FLe,s)),t.base64url=s=>t.check(KEt(MLe,s)),t.xid=s=>t.check(zEt(DLe,s)),t.ksuid=s=>t.check(VEt(PLe,s)),t.ipv4=s=>t.check(UEt(ILe,s)),t.ipv6=s=>t.check(JEt(NLe,s)),t.cidrv4=s=>t.check(WEt(OLe,s)),t.cidrv6=s=>t.check(HEt(RLe,s)),t.e164=s=>t.check(XEt(jLe,s)),t.datetime=s=>t.check(Bkt(s)),t.date=s=>t.check(qkt(s)),t.time=s=>t.check(Vkt(s)),t.duration=s=>t.check(Jkt(s))});function bo(t){return b2r(xLe,t)}const j_=ui("ZodStringFormat",(t,n)=>{M_.init(t,n),SLe.init(t,n)}),wLe=ui("ZodEmail",(t,n)=>{lbr.init(t,n),j_.init(t,n)});function kSr(t){return NEt(wLe,t)}const zme=ui("ZodGUID",(t,n)=>{abr.init(t,n),j_.init(t,n)});function ASr(t){return XOe(zme,t)}const aD=ui("ZodUUID",(t,n)=>{cbr.init(t,n),j_.init(t,n)});function DSr(t){return OEt(aD,t)}function PSr(t){return REt(aD,t)}function ISr(t){return FEt(aD,t)}function NSr(t){return MEt(aD,t)}const yye=ui("ZodURL",(t,n)=>{ubr.init(t,n),j_.init(t,n)});function OSr(t){return gLe(yye,t)}function RSr(t){return gLe(yye,{protocol:/^https?$/,hostname:iEt,...Jo(t)})}const TLe=ui("ZodEmoji",(t,n)=>{fbr.init(t,n),j_.init(t,n)});function FSr(t){return jEt(TLe,t)}const CLe=ui("ZodNanoID",(t,n)=>{dbr.init(t,n),j_.init(t,n)});function MSr(t){return LEt(CLe,t)}const ELe=ui("ZodCUID",(t,n)=>{pbr.init(t,n),j_.init(t,n)});function jSr(t){return BEt(ELe,t)}const kLe=ui("ZodCUID2",(t,n)=>{_br.init(t,n),j_.init(t,n)});function LSr(t){return $Et(kLe,t)}const ALe=ui("ZodULID",(t,n)=>{mbr.init(t,n),j_.init(t,n)});function BSr(t){return qEt(ALe,t)}const DLe=ui("ZodXID",(t,n)=>{hbr.init(t,n),j_.init(t,n)});function $Sr(t){return zEt(DLe,t)}const PLe=ui("ZodKSUID",(t,n)=>{gbr.init(t,n),j_.init(t,n)});function qSr(t){return VEt(PLe,t)}const ILe=ui("ZodIPv4",(t,n)=>{xbr.init(t,n),j_.init(t,n)});function zSr(t){return UEt(ILe,t)}const Hkt=ui("ZodMAC",(t,n)=>{Tbr.init(t,n),j_.init(t,n)});function VSr(t){return S2r(Hkt,t)}const NLe=ui("ZodIPv6",(t,n)=>{wbr.init(t,n),j_.init(t,n)});function USr(t){return JEt(NLe,t)}const OLe=ui("ZodCIDRv4",(t,n)=>{Cbr.init(t,n),j_.init(t,n)});function JSr(t){return WEt(OLe,t)}const RLe=ui("ZodCIDRv6",(t,n)=>{Ebr.init(t,n),j_.init(t,n)});function WSr(t){return HEt(RLe,t)}const FLe=ui("ZodBase64",(t,n)=>{kbr.init(t,n),j_.init(t,n)});function HSr(t){return GEt(FLe,t)}const MLe=ui("ZodBase64URL",(t,n)=>{Dbr.init(t,n),j_.init(t,n)});function GSr(t){return KEt(MLe,t)}const jLe=ui("ZodE164",(t,n)=>{Pbr.init(t,n),j_.init(t,n)});function KSr(t){return XEt(jLe,t)}const LLe=ui("ZodJWT",(t,n)=>{Nbr.init(t,n),j_.init(t,n)});function XSr(t){return YEt(LLe,t)}const mee=ui("ZodCustomStringFormat",(t,n)=>{Obr.init(t,n),j_.init(t,n)});function YSr(t,n,s={}){return gye(mee,t,n,s)}function ZSr(t){return gye(mee,"hostname",nEt,t)}function QSr(t){return gye(mee,"hex",vEt,t)}function exr(t,n){const s=n?.enc??"hex",c=`${t}_${s}`,d=$1r[c];if(!d)throw new Error(`Unrecognized hash format: ${c}`);return gye(mee,c,d,n)}const BLe=ui("ZodNumber",(t,n)=>{TEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>rkt(t,c,d),t.gt=(c,d)=>t.check(QZ(c,d)),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.lt=(c,d)=>t.check(ZZ(c,d)),t.lte=(c,d)=>t.check(XI(c,d)),t.max=(c,d)=>t.check(XI(c,d)),t.int=c=>t.check(ZOe(c)),t.safe=c=>t.check(ZOe(c)),t.positive=c=>t.check(QZ(0,c)),t.nonnegative=c=>t.check(qk(0,c)),t.negative=c=>t.check(ZZ(0,c)),t.nonpositive=c=>t.check(XI(0,c)),t.multipleOf=(c,d)=>t.check(YOe(c,d)),t.step=(c,d)=>t.check(YOe(c,d)),t.finite=()=>t;const s=t._zod.bag;t.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),t.isFinite=!0,t.format=s.format??null});function fu(t){return E2r(BLe,t)}const j$=ui("ZodNumberFormat",(t,n)=>{Rbr.init(t,n),BLe.init(t,n)});function ZOe(t){return k2r(j$,t)}function txr(t){return A2r(j$,t)}function rxr(t){return D2r(j$,t)}function nxr(t){return P2r(j$,t)}function ixr(t){return I2r(j$,t)}const $Le=ui("ZodBoolean",(t,n)=>{CEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>nkt(t,s,c)});function _y(t){return N2r($Le,t)}const qLe=ui("ZodBigInt",(t,n)=>{EEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>ikt(t,c),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.gt=(c,d)=>t.check(QZ(c,d)),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.lt=(c,d)=>t.check(ZZ(c,d)),t.lte=(c,d)=>t.check(XI(c,d)),t.max=(c,d)=>t.check(XI(c,d)),t.positive=c=>t.check(QZ(BigInt(0),c)),t.negative=c=>t.check(ZZ(BigInt(0),c)),t.nonpositive=c=>t.check(XI(BigInt(0),c)),t.nonnegative=c=>t.check(qk(BigInt(0),c)),t.multipleOf=(c,d)=>t.check(YOe(c,d));const s=t._zod.bag;t.minValue=s.minimum??null,t.maxValue=s.maximum??null,t.format=s.format??null});function oxr(t){return O2r(qLe,t)}const zLe=ui("ZodBigIntFormat",(t,n)=>{Fbr.init(t,n),qLe.init(t,n)});function sxr(t){return R2r(zLe,t)}function axr(t){return F2r(zLe,t)}const Gkt=ui("ZodSymbol",(t,n)=>{Mbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>okt(t,s)});function cxr(t){return M2r(Gkt,t)}const Kkt=ui("ZodUndefined",(t,n)=>{jbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>akt(t,s)});function lxr(t){return j2r(Kkt,t)}const Xkt=ui("ZodNull",(t,n)=>{Lbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>skt(t,s,c)});function Ykt(t){return L2r(Xkt,t)}const Zkt=ui("ZodAny",(t,n)=>{Bbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ukt()});function uxr(){return B2r(Zkt)}const Qkt=ui("ZodUnknown",(t,n)=>{$br.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>fkt()});function t$(){return $2r(Qkt)}const eAt=ui("ZodNever",(t,n)=>{qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>lkt(t,s,c)});function VLe(t){return q2r(eAt,t)}const tAt=ui("ZodVoid",(t,n)=>{zbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ckt(t,s)});function fxr(t){return z2r(tAt,t)}const rAt=ui("ZodDate",(t,n)=>{Vbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>dkt(t,c),t.min=(c,d)=>t.check(qk(c,d)),t.max=(c,d)=>t.check(XI(c,d));const s=t._zod.bag;t.minDate=s.minimum?new Date(s.minimum):null,t.maxDate=s.maximum?new Date(s.maximum):null});function dxr(t){return V2r(rAt,t)}const nAt=ui("ZodArray",(t,n)=>{Ubr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Tkt(t,s,c,d),t.element=n.element,t.min=(s,c)=>t.check(jme(s,c)),t.nonempty=s=>t.check(jme(1,s)),t.max=(s,c)=>t.check(QEt(s,c)),t.length=(s,c)=>t.check(ekt(s,c)),t.unwrap=()=>t.element});function Gd(t,n){return nSr(nAt,t,n)}function pxr(t){const n=t._zod.def.shape;return ed(Object.keys(n))}const vye=ui("ZodObject",(t,n)=>{Wbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ckt(t,s,c,d),Gu(t,"shape",()=>n.shape),t.keyof=()=>ed(Object.keys(t._zod.def.shape)),t.catchall=s=>t.clone({...t._zod.def,catchall:s}),t.passthrough=()=>t.clone({...t._zod.def,catchall:t$()}),t.loose=()=>t.clone({...t._zod.def,catchall:t$()}),t.strict=()=>t.clone({...t._zod.def,catchall:VLe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=s=>wCt(t,s),t.safeExtend=s=>TCt(t,s),t.merge=s=>CCt(t,s),t.pick=s=>SCt(t,s),t.omit=s=>xCt(t,s),t.partial=(...s)=>ECt(WLe,t,s[0]),t.required=(...s)=>kCt(HLe,t,s[0])});function Pa(t,n){const s={type:"object",shape:t??{},...Jo(n)};return new vye(s)}function _xr(t,n){return new vye({type:"object",shape:t,catchall:VLe(),...Jo(n)})}function mxr(t,n){return new vye({type:"object",shape:t,catchall:t$(),...Jo(n)})}const bye=ui("ZodUnion",(t,n)=>{hLe.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vLe(t,s,c,d),t.options=n.options});function AR(t,n){return new bye({type:"union",options:t,...Jo(n)})}const iAt=ui("ZodXor",(t,n)=>{bye.init(t,n),Hbr.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vLe(t,s,c,d),t.options=n.options});function hxr(t,n){return new iAt({type:"union",options:t,inclusive:!1,...Jo(n)})}const oAt=ui("ZodDiscriminatedUnion",(t,n)=>{bye.init(t,n),Gbr.init(t,n)});function sAt(t,n,s){return new oAt({type:"union",options:n,discriminator:t,...Jo(s)})}const aAt=ui("ZodIntersection",(t,n)=>{Kbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ekt(t,s,c,d)});function ULe(t,n){return new aAt({type:"intersection",left:t,right:n})}const cAt=ui("ZodTuple",(t,n)=>{DEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>kkt(t,s,c,d),t.rest=s=>t.clone({...t._zod.def,rest:s})});function Vme(t,n,s){const c=n instanceof vu,d=c?s:n,m=c?n:null;return new cAt({type:"tuple",items:t,rest:m,...Jo(d)})}const Sye=ui("ZodRecord",(t,n)=>{Xbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Akt(t,s,c,d),t.keyType=n.keyType,t.valueType=n.valueType});function wD(t,n,s){return new Sye({type:"record",keyType:t,valueType:n,...Jo(s)})}function gxr(t,n,s){const c=sA(t);return c._zod.values=void 0,new Sye({type:"record",keyType:c,valueType:n,...Jo(s)})}function yxr(t,n,s){return new Sye({type:"record",keyType:t,valueType:n,mode:"loose",...Jo(s)})}const lAt=ui("ZodMap",(t,n)=>{Ybr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>xkt(t,s),t.keyType=n.keyType,t.valueType=n.valueType,t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(yLe(...s)),t.size=(...s)=>t.check(ZEt(...s))});function vxr(t,n,s){return new lAt({type:"map",keyType:t,valueType:n,...Jo(s)})}const uAt=ui("ZodSet",(t,n)=>{Zbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>wkt(t,s),t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(yLe(...s)),t.size=(...s)=>t.check(ZEt(...s))});function bxr(t,n){return new uAt({type:"set",valueType:t,...Jo(n)})}const tQ=ui("ZodEnum",(t,n)=>{Qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>pkt(t,c,d),t.enum=n.entries,t.options=Object.values(n.entries);const s=new Set(Object.keys(n.entries));t.extract=(c,d)=>{const m={};for(const g of c)if(s.has(g))m[g]=n.entries[g];else throw new Error(`Key ${g} not found in enum`);return new tQ({...n,checks:[],...Jo(d),entries:m})},t.exclude=(c,d)=>{const m={...n.entries};for(const g of c)if(s.has(g))delete m[g];else throw new Error(`Key ${g} not found in enum`);return new tQ({...n,checks:[],...Jo(d),entries:m})}});function ed(t,n){const s=Array.isArray(t)?Object.fromEntries(t.map(c=>[c,c])):t;return new tQ({type:"enum",entries:s,...Jo(n)})}function Sxr(t,n){return new tQ({type:"enum",entries:t,...Jo(n)})}const fAt=ui("ZodLiteral",(t,n)=>{e2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>_kt(t,s,c),t.values=new Set(n.values),Object.defineProperty(t,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Dg(t,n){return new fAt({type:"literal",values:Array.isArray(t)?t:[t],...Jo(n)})}const dAt=ui("ZodFile",(t,n)=>{t2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>gkt(t,s,c),t.min=(s,c)=>t.check(eQ(s,c)),t.max=(s,c)=>t.check(yLe(s,c)),t.mime=(s,c)=>t.check(Y2r(Array.isArray(s)?s:[s],c))});function xxr(t){return iSr(dAt,t)}const pAt=ui("ZodTransform",(t,n)=>{r2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Skt(t,s),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new fLe(t.constructor.name);s.addIssue=m=>{if(typeof m=="string")s.issues.push(QB(m,s.value,n));else{const g=m;g.fatal&&(g.continue=!1),g.code??(g.code="custom"),g.input??(g.input=s.value),g.inst??(g.inst=t),s.issues.push(QB(g))}};const d=n.transform(s.value,s);return d instanceof Promise?d.then(m=>(s.value=m,s)):(s.value=d,s)}});function JLe(t){return new pAt({type:"transform",transform:t})}const WLe=ui("ZodOptional",(t,n)=>{PEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Ume(t){return new WLe({type:"optional",innerType:t})}const _At=ui("ZodExactOptional",(t,n)=>{n2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function mAt(t){return new _At({type:"optional",innerType:t})}const hAt=ui("ZodNullable",(t,n)=>{i2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Dkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Jme(t){return new hAt({type:"nullable",innerType:t})}function wxr(t){return Ume(Jme(t))}const gAt=ui("ZodDefault",(t,n)=>{o2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ikt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yAt(t,n){return new gAt({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():cye(n)}})}const vAt=ui("ZodPrefault",(t,n)=>{s2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Nkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function bAt(t,n){return new vAt({type:"prefault",innerType:t,get defaultValue(){return typeof n=="function"?n():cye(n)}})}const HLe=ui("ZodNonOptional",(t,n)=>{a2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Pkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function SAt(t,n){return new HLe({type:"nonoptional",innerType:t,...Jo(n)})}const xAt=ui("ZodSuccess",(t,n)=>{c2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ykt(t,s,c),t.unwrap=()=>t._zod.def.innerType});function Txr(t){return new xAt({type:"success",innerType:t})}const wAt=ui("ZodCatch",(t,n)=>{l2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Okt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function TAt(t,n){return new wAt({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}const CAt=ui("ZodNaN",(t,n)=>{u2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>mkt(t,s)});function Cxr(t){return U2r(CAt,t)}const GLe=ui("ZodPipe",(t,n)=>{f2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Rkt(t,s,c,d),t.in=n.in,t.out=n.out});function Wme(t,n){return new GLe({type:"pipe",in:t,out:n})}const KLe=ui("ZodCodec",(t,n)=>{GLe.init(t,n),IEt.init(t,n)});function Exr(t,n,s){return new KLe({type:"pipe",in:t,out:n,transform:s.decode,reverseTransform:s.encode})}const EAt=ui("ZodReadonly",(t,n)=>{d2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Fkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function kAt(t){return new EAt({type:"readonly",innerType:t})}const AAt=ui("ZodTemplateLiteral",(t,n)=>{p2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>hkt(t,s,c)});function kxr(t,n){return new AAt({type:"template_literal",parts:t,...Jo(n)})}const DAt=ui("ZodLazy",(t,n)=>{h2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>jkt(t,s,c,d),t.unwrap=()=>t._zod.def.getter()});function PAt(t){return new DAt({type:"lazy",getter:t})}const IAt=ui("ZodPromise",(t,n)=>{m2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Mkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Axr(t){return new IAt({type:"promise",innerType:t})}const NAt=ui("ZodFunction",(t,n)=>{_2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bkt(t,s)});function tht(t){return new NAt({type:"function",input:Array.isArray(t?.input)?Vme(t?.input):t?.input??Gd(t$()),output:t?.output??t$()})}const xye=ui("ZodCustom",(t,n)=>{g2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vkt(t,s)});function Dxr(t){const n=new eh({check:"custom"});return n._zod.check=t,n}function YI(t,n){return oSr(xye,t??(()=>!0),n)}function OAt(t,n={}){return sSr(xye,t,n)}function RAt(t){return aSr(t)}const Pxr=lSr,Ixr=uSr;function Nxr(t,n={}){const s=new xye({type:"custom",check:"custom",fn:c=>c instanceof t,abort:!0,...Jo(n)});return s._zod.bag.Class=t,s._zod.check=c=>{c.value instanceof t||c.issues.push({code:"invalid_type",expected:t.name,input:c.value,inst:s,path:[...s._zod.def.path??[]]})},s}const Oxr=(...t)=>fSr({Codec:KLe,Boolean:$Le,String:xLe},...t);function Rxr(t){const n=PAt(()=>AR([bo(t),fu(),_y(),Ykt(),Gd(n),wD(bo(),n)]));return n}function FAt(t,n){return Wme(JLe(t),n)}const Agn=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:Zkt,ZodArray:nAt,ZodBase64:FLe,ZodBase64URL:MLe,ZodBigInt:qLe,ZodBigIntFormat:zLe,ZodBoolean:$Le,ZodCIDRv4:OLe,ZodCIDRv6:RLe,ZodCUID:ELe,ZodCUID2:kLe,ZodCatch:wAt,ZodCodec:KLe,ZodCustom:xye,ZodCustomStringFormat:mee,ZodDate:rAt,ZodDefault:gAt,ZodDiscriminatedUnion:oAt,ZodE164:jLe,ZodEmail:wLe,ZodEmoji:TLe,ZodEnum:tQ,ZodExactOptional:_At,ZodFile:dAt,ZodFunction:NAt,ZodGUID:zme,ZodIPv4:ILe,ZodIPv6:NLe,ZodIntersection:aAt,ZodJWT:LLe,ZodKSUID:PLe,ZodLazy:DAt,ZodLiteral:fAt,ZodMAC:Hkt,ZodMap:lAt,ZodNaN:CAt,ZodNanoID:CLe,ZodNever:eAt,ZodNonOptional:HLe,ZodNull:Xkt,ZodNullable:hAt,ZodNumber:BLe,ZodNumberFormat:j$,ZodObject:vye,ZodOptional:WLe,ZodPipe:GLe,ZodPrefault:vAt,ZodPromise:IAt,ZodReadonly:EAt,ZodRecord:Sye,ZodSet:uAt,ZodString:xLe,ZodStringFormat:j_,ZodSuccess:xAt,ZodSymbol:Gkt,ZodTemplateLiteral:AAt,ZodTransform:pAt,ZodTuple:cAt,ZodType:Lu,ZodULID:ALe,ZodURL:yye,ZodUUID:aD,ZodUndefined:Kkt,ZodUnion:bye,ZodUnknown:Qkt,ZodVoid:tAt,ZodXID:DLe,ZodXor:iAt,_ZodString:SLe,_default:yAt,_function:tht,any:uxr,array:Gd,base64:HSr,base64url:GSr,bigint:oxr,boolean:_y,catch:TAt,check:Dxr,cidrv4:JSr,cidrv6:WSr,codec:Exr,cuid:jSr,cuid2:LSr,custom:YI,date:dxr,describe:Pxr,discriminatedUnion:sAt,e164:KSr,email:kSr,emoji:FSr,enum:ed,exactOptional:mAt,file:xxr,float32:txr,float64:rxr,function:tht,guid:ASr,hash:exr,hex:QSr,hostname:ZSr,httpUrl:RSr,instanceof:Nxr,int:ZOe,int32:nxr,int64:sxr,intersection:ULe,ipv4:zSr,ipv6:USr,json:Rxr,jwt:XSr,keyof:pxr,ksuid:qSr,lazy:PAt,literal:Dg,looseObject:mxr,looseRecord:yxr,mac:VSr,map:vxr,meta:Ixr,nan:Cxr,nanoid:MSr,nativeEnum:Sxr,never:VLe,nonoptional:SAt,null:Ykt,nullable:Jme,nullish:wxr,number:fu,object:Pa,optional:Ume,partialRecord:gxr,pipe:Wme,prefault:bAt,preprocess:FAt,promise:Axr,readonly:kAt,record:wD,refine:OAt,set:bxr,strictObject:_xr,string:bo,stringFormat:YSr,stringbool:Oxr,success:Txr,superRefine:RAt,symbol:cxr,templateLiteral:kxr,transform:JLe,tuple:Vme,uint32:ixr,uint64:axr,ulid:BSr,undefined:lxr,union:AR,unknown:t$,url:OSr,uuid:DSr,uuidv4:PSr,uuidv6:ISr,uuidv7:NSr,void:fxr,xid:$Sr,xor:hxr},Symbol.toStringTag,{value:"Module"})),rht={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Dgn(t){$S({customError:t})}function Pgn(){return $S().customError}var nht;nht||(nht={});const iht=ed(["mock","live"]),Fxr=Pa({id:bo().min(1),name:bo().min(1),status:ed(["free","trialing","active","past_due","cancelling"]),interval:ed(["month","year"]).optional(),renewsAt:bo().datetime().optional(),endsAt:bo().datetime().optional()}),Mxr=Pa({included:fu().nonnegative(),purchased:fu().nonnegative(),used:fu().nonnegative(),reserved:fu().nonnegative(),remaining:fu().nonnegative(),resetsAt:bo().datetime().optional(),purchasedExpiresAt:bo().datetime().optional()}),jxr=Pa({overageEnabled:_y(),monthlyLimitCredits:fu().nonnegative(),alertThresholds:Gd(fu().min(1).max(100)).max(8),autoReload:Pa({enabled:_y(),whenRemainingBelow:fu().nonnegative(),reloadTo:fu().positive(),monthlyLimitCredits:fu().nonnegative()}).optional()}),Lxr=Pa({id:bo().min(1),kind:ed(["threshold","auto_reload_succeeded","auto_reload_failed"]),message:bo().min(1),createdAt:bo().datetime(),readAt:bo().datetime().optional()}),Bxr=Pa({id:bo().min(1),email:bo().email(),name:bo().min(1).optional()}),$xr=Pa({name:bo().min(1),verified:_y(),enrollmentMode:ed(["manual_invitation","automatic_invitation","automatic_suggestion","enterprise_sso"])}),qxr=Pa({id:bo().min(1),name:bo().min(1),slug:bo().min(1).optional(),role:bo().min(1),domains:Gd($xr).max(50)}),zxr=Pa({id:bo().min(1),occurredAt:bo().datetime(),kind:ed(["inference","generation","workspace","storage","relay","deployment"]),provider:bo().min(1),operation:bo().optional(),credits:fu().nonnegative(),state:ed(["reserved","settled","released"]),externalId:bo().optional()});ed(["free","creator","max","ultra"]);const Vxr=Pa({plans:Pa({free:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),creator:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),max:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),ultra:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()})}),creditPacks:wD(bo().min(1),Pa({name:bo().min(1),credits:fu().int().positive(),expiresInDays:fu().int().positive().optional()}))}),Uxr=sAt("authenticated",[Pa({authenticated:Dg(!1),backend:iht}),Pa({authenticated:Dg(!0),backend:iht,user:Bxr,organizations:Gd(qxr).max(100).optional(),plan:Fxr,credits:Mxr,spendPolicy:jxr,alerts:Gd(Lxr).max(100).optional(),entitlements:Pa({generation:_y(),dailyJobs:fu().int().positive().optional()})})]),Jxr=ed(["auto","mock","managed","byok"]),MAt=ed(["fal","tripo","worldlabs","openrouter"]),Wxr=Pa({enabled:_y(),provider:Dg("openrouter"),model:bo().trim().min(1).max(256)}),Hxr=ed(["environment","system","session","none"]),Gxr=Pa({provider:MAt,label:bo().min(1),environmentVariable:bo().min(1),configured:_y(),source:Hxr,editable:_y(),persistence:ed(["system","session"]),maskedKey:bo().min(1).optional(),problem:bo().min(1).optional()}),Kxr=Pa({provider:MAt,ok:Dg(!0),testedAt:bo().datetime()});function Xxr(t){return{routes:{mock:!0,managed:t.routes.managed,byok:t.routes.byok,byokProviders:[...t.routes.byokProviders]},preferredRoute:t.preferredRoute}}const wye=ULe(Uxr,Pa({accountEnvironment:ed(["test-mock","development-twin","production"]),routes:Pa({mock:Dg(!0),managed:_y(),byok:_y(),byokProviders:Gd(bo().min(1))}),preferredRoute:Jxr,providerCredentials:Gd(Gxr),codingInference:Wxr}));function Yxr(t,n){return`${t}: this origin answered with its page fallback (${n||"no content-type"}) rather than JSON, so no editor server handled the request.`}function sf(t,n){const s=t.headers.get("content-type")??"";if(!s.includes("application/json"))throw new Error(Yxr(n,s))}function CN(t,n){if(!t.ok)throw new Error(`${n} (${t.status}).`);sf(t,n)}async function L_(t,n){return CN(t,n),await t.json()}const oht="volter.collaboration.participant.v1",Zxr="volter.collaboration.remote-share.v1",QOe=globalThis.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__;function Qxr(){if(QOe?.participantId)return QOe.participantId;const t=globalThis.crypto?.randomUUID?.()??`participant-${Date.now()}`;try{const n=globalThis.localStorage?.getItem(oht);if(n)return n;globalThis.localStorage?.setItem(oht,t)}catch{}return t}const jAt=Qxr(),L$=(()=>{try{return globalThis.localStorage?.getItem(Zxr)==="1"}catch{return!1}})(),ewr=QOe?.displayName||"Local editor",twr=Symbol.for("volter.collaboration.revision"),eRe=globalThis[twr]??={value:0};function LAt(t){Number.isInteger(t)&&t>=eRe.value&&(eRe.value=t)}function Dw(){return{participantId:jAt,expectedRevision:eRe.value}}const rwr={authenticated:!1,backend:"mock",accountEnvironment:"test-mock",routes:{mock:!0,managed:!1,byok:!1,byokProviders:[]},preferredRoute:"auto",providerCredentials:[],codingInference:{enabled:!1,provider:"openrouter",model:"z-ai/glm-5.2"}};let r$=rwr,BAt=0,tRe=null;const rRe=new Set;function lR(t,n=null){if(!(tRe===n&&JSON.stringify(r$)===JSON.stringify(t))){r$=t,tRe=n,BAt++;for(const s of rRe)s()}}async function $At(t,n){sf(t,n);const s=await t.json();if(!t.ok)throw new Error(typeof s.error=="string"?String(s.error):`Account request failed (${t.status}).`);return wye.parse(s)}async function NC(t,n,s){const c=await fetch(t,{method:n,...s===void 0?{}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}}),d=await $At(c,`${n} ${t} failed`);return lR(d),d}function XLe(){return r$}function YLe(){return Xxr(r$)}function cN(){return BAt}function wpe(){return tRe}function Tye(t){return rRe.add(t),()=>rRe.delete(t)}async function sht(){try{const t=await $At(await fetch("/__editor/account"),"Account read failed");return lR(t),t}catch(t){throw lR(r$,t instanceof Error?t.message:String(t)),t}}const nwr=t=>NC("/__editor/account/mock-session","POST",{email:t}),iwr=t=>NC("/__editor/account/twin-session","POST",{email:t}),owr=()=>NC("/__editor/account/session","DELETE"),swr=t=>NC("/__editor/account/spend-policy","PUT",t),awr=()=>NC("/__editor/account/alerts/read","POST"),cwr=t=>NC("/__editor/account/execution-route","PUT",{route:t}),lwr=t=>NC("/__editor/account/coding-inference","PUT",t);async function uwr(t){const n=await fetch("/__editor/account/coding-inference/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});sf(n,"Coding quote failed");const s=await n.json();if(!n.ok||typeof s.model!="string"||typeof s.promptTokens!="number"||typeof s.outputTokens!="number"||typeof s.providerAmountUsd!="number"||typeof s.estimatedCredits!="number")throw new Error(typeof s.error=="string"?s.error:"Coding quote failed.");return s}const fwr=(t,n)=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"PUT",{key:n}),dwr=t=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"DELETE");async function pwr(t){const n=await fetch(`/__editor/account/provider-credentials/${encodeURIComponent(t)}/test`,{method:"POST"});sf(n,"Credential test failed");const s=await n.json();if(!n.ok)throw new Error(typeof s.error=="string"?s.error:`Credential test failed (${n.status}).`);return Kxr.parse(s)}const aht=t=>NC("/__editor/account/plan","PUT",{action:t});async function qAt(t,n){const s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID()},body:JSON.stringify(n)});sf(s,"Checkout failed");const c=await s.json();if(!s.ok||!c.account)throw new Error(typeof c.error=="string"?c.error:"Checkout failed.");return lR(wye.parse(c.account)),{...typeof c.checkoutUrl=="string"?{checkoutUrl:c.checkoutUrl}:{},mock:c.mock===!0}}const _wr=t=>qAt("/__editor/account/checkout",{plan:t}),mwr=t=>qAt("/__editor/account/credits",{packId:t});async function hwr(){const t=await fetch("/__editor/account/usage");sf(t,"Usage failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Usage failed.");return zxr.array().parse(n.entries??[])}async function gwr(){const t=await fetch("/__editor/account/catalog");sf(t,"Catalog failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Catalog failed.");return Vxr.parse(n)}async function ywr(){const t=await fetch("/__editor/account/billing-portal",{method:"POST"});sf(t,"Billing portal failed");const n=await t.json();if(!t.ok||typeof n.url!="string")throw new Error(typeof n.error=="string"?n.error:"Billing portal failed.");return{url:n.url,mock:n.mock===!0}}async function vwr(){const t=await fetch("/__editor/account/authorization-methods");sf(t,"Sign-in methods are unavailable");const n=await t.json();if(!t.ok||n.browser!==!0||typeof n.device!="boolean")throw new Error(typeof n.error=="string"?n.error:"Sign-in methods are unavailable.");return{browser:!0,device:n.device}}async function bwr(){const t=await fetch("/__editor/account/browser-authorization",{method:"POST"});sf(t,"Sign-in failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Sign-in failed.");return n}async function Swr(t){const n=await fetch(`/__editor/account/browser-authorization/${encodeURIComponent(t)}`);sf(n,"Sign-in failed");const s=await n.json();if(n.status===202)return!1;if(!n.ok||s.pending!==!1)throw new Error(typeof s.error=="string"?s.error:"Sign-in failed.");return lR(wye.parse(s.account)),!0}async function xwr(){const t=await fetch("/__editor/account/device-authorization",{method:"POST"});sf(t,"Sign-in failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Sign-in failed.");return n}async function wwr(t){const n=await fetch(`/__editor/account/device-authorization/${encodeURIComponent(t)}`);sf(n,"Sign-in failed");const s=await n.json();if(n.status===202)return!1;if(!n.ok||s.pending!==!1)throw new Error(typeof s.error=="string"?s.error:"Sign-in failed.");return lR(wye.parse(s.account)),!0}function Twr(){if(L$)return()=>{};const t=new URLSearchParams(window.location.search).get("checkout_id");t?NC("/__editor/account/checkout/confirm","POST",{checkoutId:t}).then(()=>{const s=new URL(window.location.href);s.searchParams.delete("checkout"),s.searchParams.delete("checkout_id"),window.history.replaceState(null,"",`${s.pathname}${s.search}${s.hash}`)}).catch(s=>lR(r$,s instanceof Error?s.message:String(s))):sht().catch(()=>{});const n=window.setInterval(()=>void sht().catch(()=>{}),3e4);return()=>window.clearInterval(n)}function zAt(t){return t?UAt(t)?null:t:null}function Cwr(t,n){try{return t.ownerOf(n)}catch{return"unresolved"}}function VAt(t){return t&&UAt(t)?t:null}function UAt(t){return t.keyedBy==="display"}const Ign=Object.freeze(Object.defineProperty({__proto__:null,displayKeyedPhysics:VAt,nodeKeyedPhysics:zAt,physicsOwnerOf:Cwr},Symbol.toStringTag,{value:"Module"})),Ewr={"source-prop":!0,"source-structure":!0,"construction-literal":!0,"physics-binding":!0,"data-record":!0,"live-only":!0},ZLe=Object.keys(Ewr);function kwr(){const t={};for(const n of ZLe)t[n]=0;return t}const Awr={provenance:!0,selection:!0,transforms:!0,inspector:!0,assetSubject:!0,related:!0,instances:!0,structure:!0,persistence:!0,pickable:!0,rects:!0,boxEdit:!0,text:!0,colorSample:!0,stories:!0,truth:!0,spatialHandles:!0,assetDrop:!0,subscribe:!0},QLe=Object.keys(Awr);function Dwr(t){const n={};for(const s of QLe)n[s]=t[s]!==void 0;return n}const Ngn=Object.freeze(Object.defineProperty({__proto__:null,AUTHORING_PROVIDER_KEYS:QLe,WRITE_ANCHOR_KINDS:ZLe,emptyWriteAnchorKindCounts:kwr,measureAuthoringProviders:Dwr},Symbol.toStringTag,{value:"Module"})),Pwr=["claim","shape","operation","effect","round-trip"],Hme={claim:0,shape:1,operation:2,effect:3,"round-trip":4};function JAt(t,n){return Hme[t]>=Hme[n]}function rQ(t){const{seam:n,subject:s,epoch:c,required:d}=t;if(t.notApplicable!==void 0)return{seam:n,subject:s,epoch:c,required:d,state:"not-applicable",receipt:null,detail:t.notApplicable};let m=null;for(const g of t.receipts)g.seam!==n||g.subject!==s||g.epoch!==c||(!m||Hme[g.stage]>=Hme[m.stage])&&(m=g);return m?m.outcome==="fail"?{seam:n,subject:s,epoch:c,required:d,state:"failed",receipt:m,detail:m.detail}:m.outcome==="absent"?{seam:n,subject:s,epoch:c,required:d,state:"absent",receipt:m,detail:m.detail}:JAt(m.stage,d)?{seam:n,subject:s,epoch:c,required:d,state:"verified",receipt:m,detail:m.detail}:{seam:n,subject:s,epoch:c,required:d,state:"unverified",receipt:m,detail:`${m.detail}; this proves ${m.stage}, but this seam requires ${d}`}:{seam:n,subject:s,epoch:c,required:d,state:"unverified",receipt:null,detail:`no current-epoch evidence has reached the required ${d} stage`}}class WAt{#e=[];record(n){if(!n.seam||!n.subject||!n.epoch||!n.detail.trim())throw new Error("seam evidence requires non-empty seam, subject, epoch, and detail");this.#e.push(n)}receipts(n){return this.#e.filter(s=>(n?.subject===void 0||s.subject===n.subject)&&(n?.epoch===void 0||s.epoch===n.epoch))}verdict(n){return rQ({...n,receipts:this.#e})}clearSubject(n){for(let s=this.#e.length-1;s>=0;s-=1)this.#e[s]?.subject===n&&this.#e.splice(s,1)}clear(){this.#e.length=0}}function Pp(){return t=>t}function Iwr(t){if(t.value===void 0)return{seam:t.seam,subject:t.subject,epoch:t.epoch,stage:"shape",outcome:t.optional?"absent":"fail",source:"shape-check",detail:t.optional?`${t.seam} is not exposed by this subject`:`${t.seam} is required by the contract but is absent`};const n=typeof t.value,s=t.kind==="function"?n==="function":n!=="function";return{seam:t.seam,subject:t.subject,epoch:t.epoch,stage:"shape",outcome:s?"pass":"fail",source:"shape-check",detail:s?`${t.seam} has the contract's ${t.kind} shape`:`${t.seam} is ${n}; the contract requires a ${t.kind}`}}function vB(t){const n=[],s=t.value!==null&&(typeof t.value=="object"||typeof t.value=="function")?t.value:null,c=Object.entries(t.shape);for(const[d,m]of c){const g=`${t.prefix}.${d}`,S=s?.[d];n.push(Iwr({seam:g,subject:t.subject,epoch:t.epoch,value:S,optional:m.optional,kind:m.kind}))}return n}function Gme(t){const n=rQ(t);if(n.state==="absent"||n.state==="failed"||!t.shape)return n;for(const[s,c]of Object.entries(t.shape)){const d=rQ({seam:`${t.seam}.${s}`,subject:t.subject,epoch:t.epoch,required:c.required,receipts:t.receipts});if(!(c.optional&&d.state==="absent")){if(d.state==="failed"||d.state==="absent")return{...n,state:"failed",receipt:d.receipt,detail:`${t.seam} is malformed: ${d.detail}`};if(d.state!=="verified")return{...n,state:"unverified",detail:`${t.seam} has the required shape, but ${d.seam} is unverified: ${d.detail}`}}}return n}const Ogn=Object.freeze(Object.defineProperty({__proto__:null,SEAM_PROOF_STAGES:Pwr,SeamEvidenceLedger:WAt,defineSeamShape:Pp,gradeSeamCarrier:Gme,gradeSeamEvidence:rQ,inspectSeamShape:vB,seamStageAtLeast:JAt},Symbol.toStringTag,{value:"Module"})),XY=Pp()({capabilities:{optional:!1,kind:"value",required:"shape"},provenance:{optional:!0,kind:"value",required:"shape"},hierarchy:{optional:!1,kind:"value",required:"operation"},selection:{optional:!0,kind:"value",required:"effect"},transforms:{optional:!0,kind:"value",required:"effect"},inspector:{optional:!0,kind:"value",required:"effect"},assetSubject:{optional:!0,kind:"value",required:"operation"},related:{optional:!0,kind:"value",required:"operation"},instances:{optional:!0,kind:"value",required:"effect"},structure:{optional:!0,kind:"value",required:"round-trip"},persistence:{optional:!0,kind:"value",required:"round-trip"},pickable:{optional:!0,kind:"value",required:"operation"},rects:{optional:!0,kind:"value",required:"operation"},boxEdit:{optional:!0,kind:"value",required:"effect"},text:{optional:!0,kind:"value",required:"effect"},colorSample:{optional:!0,kind:"value",required:"operation"},stories:{optional:!0,kind:"value",required:"effect"},truth:{optional:!0,kind:"value",required:"operation"},spatialHandles:{optional:!0,kind:"value",required:"effect"},assetDrop:{optional:!0,kind:"value",required:"round-trip"},subscribe:{optional:!0,kind:"function",required:"effect"}}),nRe=Pp()({roots:{optional:!1,kind:"function",required:"operation"},node:{optional:!1,kind:"function",required:"operation"},crossSurfaceStructureSignature:{optional:!0,kind:"function",required:"operation"},object3D:{optional:!0,kind:"function",required:"operation"},idForObject3D:{optional:!0,kind:"function",required:"operation"}}),HAt=Pp()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},resolve:{optional:!0,kind:"function",required:"operation"}}),GAt=Pp()({dimensions:{optional:!0,kind:"function",required:"operation"},get:{optional:!1,kind:"function",required:"operation"},editability:{optional:!0,kind:"function",required:"operation"},beginEdit:{optional:!1,kind:"function",required:"effect"},apply:{optional:!1,kind:"function",required:"effect"},endEdit:{optional:!1,kind:"function",required:"effect"},remove:{optional:!0,kind:"function",required:"round-trip"},sourceCommit:{optional:!0,kind:"value",required:"round-trip"}}),KAt=Pp()({properties:{optional:!1,kind:"function",required:"operation"},get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},preview:{optional:!0,kind:"function",required:"effect"},editability:{optional:!0,kind:"function",required:"operation"},remove:{optional:!0,kind:"function",required:"round-trip"}}),XAt=Pp()({get:{optional:!1,kind:"function",required:"operation"},entries:{optional:!0,kind:"function",required:"operation"}}),YAt=Pp()({links:{optional:!1,kind:"function",required:"operation"}}),ZAt=Pp()({describe:{optional:!1,kind:"function",required:"operation"},openComponent:{optional:!0,kind:"function",required:"effect"},revert:{optional:!1,kind:"function",required:"round-trip"},applyToComponent:{optional:!1,kind:"function",required:"round-trip"}}),QAt=Pp()({create:{optional:!1,kind:"function",required:"round-trip"},remove:{optional:!1,kind:"function",required:"round-trip"},duplicate:{optional:!1,kind:"function",required:"round-trip"},duplicateMany:{optional:!0,kind:"function",required:"round-trip"},reparent:{optional:!1,kind:"function",required:"round-trip"},reorder:{optional:!0,kind:"function",required:"round-trip"},creatableKinds:{optional:!0,kind:"function",required:"operation"},wrap:{optional:!0,kind:"function",required:"round-trip"},unwrap:{optional:!0,kind:"function",required:"round-trip"},group:{optional:!0,kind:"function",required:"round-trip"},ungroup:{optional:!0,kind:"function",required:"round-trip"},canUngroup:{optional:!0,kind:"function",required:"operation"},removeMany:{optional:!0,kind:"function",required:"round-trip"},copy:{optional:!0,kind:"function",required:"effect"},canCopy:{optional:!0,kind:"function",required:"operation"},cut:{optional:!0,kind:"function",required:"round-trip"},paste:{optional:!0,kind:"function",required:"round-trip"},canPaste:{optional:!0,kind:"function",required:"operation"}}),e3t=Pp()({isDirty:{optional:!1,kind:"function",required:"operation"},lastError:{optional:!0,kind:"function",required:"operation"},save:{optional:!1,kind:"function",required:"round-trip"},destination:{optional:!1,kind:"value",required:"shape"},applyExternal:{optional:!0,kind:"function",required:"effect"}}),t3t=Pp()({pick:{optional:!1,kind:"function",required:"operation"},candidates:{optional:!0,kind:"function",required:"operation"}}),r3t=Pp()({storiesFor:{optional:!1,kind:"function",required:"operation"},active:{optional:!1,kind:"function",required:"operation"},apply:{optional:!1,kind:"function",required:"effect"},isolate:{optional:!0,kind:"function",required:"effect"},title:{optional:!0,kind:"value",required:"shape"},unavailable:{optional:!0,kind:"function",required:"operation"}}),n3t=Pp()({accepts:{optional:!1,kind:"function",required:"operation"},drop:{optional:!1,kind:"function",required:"round-trip"}}),i3t=Pp()({rect:{optional:!1,kind:"function",required:"operation"},contextRects:{optional:!0,kind:"function",required:"operation"},emptyContainers:{optional:!0,kind:"function",required:"operation"},frame:{optional:!0,kind:"function",required:"operation"}}),o3t=Pp()({begin:{optional:!1,kind:"function",required:"effect"},apply:{optional:!1,kind:"function",required:"effect"},end:{optional:!1,kind:"function",required:"effect"},gizmoOrigin:{optional:!0,kind:"function",required:"operation"},referencePoint:{optional:!0,kind:"function",required:"operation"}}),s3t=Pp()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"}}),a3t=Pp()({backgroundChainAt:{optional:!1,kind:"function",required:"operation"}}),c3t=Pp()({resolve:{optional:!1,kind:"function",required:"operation"}}),l3t=Pp()({layers:{optional:!1,kind:"function",required:"operation"},preview:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"round-trip"}}),iRe={selection:HAt,transforms:GAt,inspector:KAt,assetSubject:XAt,related:YAt,instances:ZAt,structure:QAt,persistence:e3t,pickable:t3t,rects:i3t,boxEdit:o3t,text:s3t,colorSample:a3t,stories:r3t,truth:c3t,spatialHandles:l3t,assetDrop:n3t},Rgn=Object.freeze(Object.defineProperty({__proto__:null,ASSET_DROP_PROVIDER_SHAPE:n3t,ASSET_SUBJECT_PROVIDER_SHAPE:XAt,AUTHORING_ADAPTER_SHAPE:XY,AUTHORING_PROVIDER_SHAPES:iRe,BOX_EDIT_PROVIDER_SHAPE:o3t,COLOR_SAMPLE_PROVIDER_SHAPE:a3t,COMPONENT_INSTANCES_PROVIDER_SHAPE:ZAt,HIERARCHY_PROVIDER_SHAPE:nRe,INSPECTOR_PROVIDER_SHAPE:KAt,PERSISTENCE_PROVIDER_SHAPE:e3t,PICK_PROVIDER_SHAPE:t3t,RECT_PROVIDER_SHAPE:i3t,RELATED_SUBJECTS_PROVIDER_SHAPE:YAt,SELECTION_PROVIDER_SHAPE:HAt,SPATIAL_HANDLES_PROVIDER_SHAPE:l3t,STORIES_PROVIDER_SHAPE:r3t,STRUCTURE_PROVIDER_SHAPE:QAt,TEXT_PROVIDER_SHAPE:s3t,TRANSFORM_PROVIDER_SHAPE:GAt,TRUTH_PROVIDER_SHAPE:c3t},Symbol.toStringTag,{value:"Module"})),oRe=Pp()({physics:{optional:!0,kind:"value",required:"effect"},networking:{optional:!0,kind:"value",required:"operation"},navigation:{optional:!0,kind:"value",required:"operation"},audio:{optional:!0,kind:"value",required:"effect"},camera:{optional:!0,kind:"value",required:"effect"},debug:{optional:!0,kind:"value",required:"operation"},renderDebug:{optional:!0,kind:"value",required:"effect"}}),u3t=Pp()({keyedBy:{optional:!0,kind:"value",required:"shape"},ownerOf:{optional:!1,kind:"function",required:"operation"},freeze:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"effect"},unfreeze:{optional:!1,kind:"function",required:"effect"},debugDraw:{optional:!0,kind:"function",required:"operation"},setDebugDrawEnabled:{optional:!0,kind:"function",required:"effect"},contactPoints:{optional:!0,kind:"function",required:"operation"},colliders:{optional:!0,kind:"function",required:"operation"},previewCollider:{optional:!0,kind:"function",required:"effect"},joints:{optional:!0,kind:"function",required:"operation"},previewJointAnchor:{optional:!0,kind:"function",required:"effect"}}),f3t=Pp()({keyedBy:{optional:!1,kind:"value",required:"shape"},ownerOf:{optional:!1,kind:"function",required:"operation"},freeze:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"effect"},unfreeze:{optional:!1,kind:"function",required:"effect"}}),d3t=Pp()({peers:{optional:!1,kind:"function",required:"operation"},networkId:{optional:!1,kind:"function",required:"operation"},authority:{optional:!1,kind:"function",required:"operation"},editable:{optional:!1,kind:"function",required:"operation"},getConnectionState:{optional:!0,kind:"function",required:"operation"},getRoomInfo:{optional:!0,kind:"function",required:"operation"},getReplicationStats:{optional:!0,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"},getStateSnapshot:{optional:!0,kind:"function",required:"operation"},messageEvents:{optional:!0,kind:"function",required:"operation"},getRates:{optional:!0,kind:"function",required:"operation"},getConditioning:{optional:!0,kind:"function",required:"operation"},setConditioning:{optional:!0,kind:"function",required:"effect"},getServerConfig:{optional:!0,kind:"function",required:"operation"},getPlayerIdentity:{optional:!0,kind:"function",required:"operation"},setPlayerIdentity:{optional:!0,kind:"function",required:"effect"},getTrafficByType:{optional:!0,kind:"function",required:"operation"},sendMessage:{optional:!0,kind:"function",required:"effect"},getConditioningLimits:{optional:!0,kind:"function",required:"operation"},ping:{optional:!0,kind:"function",required:"effect"},inspectServer:{optional:!0,kind:"function",required:"operation"},disconnectClient:{optional:!0,kind:"function",required:"effect"},editServerState:{optional:!0,kind:"function",required:"effect"},deleteServerState:{optional:!0,kind:"function",required:"effect"},sendToClient:{optional:!0,kind:"function",required:"effect"},broadcast:{optional:!0,kind:"function",required:"effect"},disposeRoom:{optional:!0,kind:"function",required:"effect"},stateFieldType:{optional:!0,kind:"function",required:"operation"},clearTraffic:{optional:!0,kind:"function",required:"effect"},getTrafficByEntity:{optional:!0,kind:"function",required:"operation"},isRecording:{optional:!0,kind:"function",required:"operation"},setRecording:{optional:!0,kind:"function",required:"effect"}}),p3t=Pp()({hasNavMesh:{optional:!1,kind:"function",required:"operation"},findPath:{optional:!1,kind:"function",required:"effect"},debugMesh:{optional:!1,kind:"function",required:"operation"},bake:{optional:!0,kind:"function",required:"effect"},exportData:{optional:!0,kind:"function",required:"operation"},clear:{optional:!0,kind:"function",required:"effect"},crowdAgents:{optional:!0,kind:"function",required:"operation"}}),_3t=Pp()({resume:{optional:!0,kind:"function",required:"effect"},setMuted:{optional:!1,kind:"function",required:"effect"},isMuted:{optional:!1,kind:"function",required:"operation"},graphSnapshot:{optional:!0,kind:"function",required:"operation"},transportState:{optional:!0,kind:"function",required:"operation"},acquireMeters:{optional:!0,kind:"function",required:"effect"},acquireRecordingStream:{optional:!0,kind:"function",required:"effect"},renderOffline:{optional:!0,kind:"function",required:"operation"},audioEvents:{optional:!0,kind:"function",required:"operation"}}),m3t=Pp()({snapshot:{optional:!1,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"}}),h3t=Pp()({providers:{optional:!1,kind:"function",required:"operation"},state:{optional:!1,kind:"function",required:"operation"},stateAll:{optional:!1,kind:"function",required:"operation"},commands:{optional:!1,kind:"function",required:"operation"},invoke:{optional:!1,kind:"function",required:"effect"},events:{optional:!1,kind:"function",required:"operation"}}),g3t=Pp()({captureFrame:{optional:!1,kind:"function",required:"effect"},memorySnapshot:{optional:!0,kind:"function",required:"operation"}}),y3t={networking:d3t,navigation:p3t,audio:_3t,camera:m3t,debug:h3t,renderDebug:g3t},Fgn=Object.freeze(Object.defineProperty({__proto__:null,AUDIO_ADAPTER_SHAPE:_3t,CAMERA_ADAPTER_SHAPE:m3t,DEBUG_ADAPTER_SHAPE:h3t,NAVIGATION_ADAPTER_SHAPE:p3t,NETWORKING_ADAPTER_SHAPE:d3t,PHYSICS_2D_ADAPTER_SHAPE:f3t,PHYSICS_ADAPTER_SHAPE:u3t,RENDER_DEBUG_ADAPTER_SHAPE:g3t,SYSTEM_ADAPTERS_SHAPE:oRe,SYSTEM_PROVIDER_SHAPES:y3t},Symbol.toStringTag,{value:"Module"})),eBe=new WAt;function Nwr(t){eBe.record(t)}const cht=new WeakMap;let Owr=1;function v3t(t){const n=cht.get(t);if(n)return n;const s=`system-${Owr++}`;return cht.set(t,s),s}function Rwr(t){const n=t.epoch??v3t(t.adapter),s=`system.${t.slot}`,c={[t.slot]:t.adapter},d=t.slot==="physics"?VAt(t.adapter)?f3t:u3t:y3t[t.slot],m=[...vB({prefix:"system",value:c,shape:oRe,subject:t.subject,epoch:n}).filter(g=>g.seam===s),...vB({prefix:s,value:t.adapter,shape:d,subject:t.subject,epoch:n}),...eBe.receipts({subject:t.subject,epoch:n}),...t.receipts??[]];return Gme({seam:s,subject:t.subject,epoch:n,required:oRe[t.slot].required,receipts:m,shape:d})}let qS={},nQ=null,tBe=null;const Kme=new Set,Xme=new Set,sRe=new Set;let rBe=0;function aRe(){for(const t of sRe)t()}function Yme(t){if(t!==Eye())for(const n of Kme)n()}function Zme(t,n){const s=Aye();if(!(t===kye()&&n.length===s.length&&n.every((c,d)=>c===s[d]))){rBe++;for(const c of Xme)c()}}const LS=new Map;let S_e=null,b3t=0;const cRe=new Set,nBe="";function S3t(t,n){const s=["physics","networking","navigation","audio","camera","debug","renderDebug"];for(const c of s){const d=t[c];if(!d)continue;const m=Rwr({slot:c,adapter:d,subject:n||"game"});if(m.state==="failed")throw new Error(`system adapter refused: ${m.detail}`)}}function ZI(){return S_e!==null&&LS.has(S_e)?S_e:LS.keys().next().value??null}function Qme(){b3t++;for(const t of cRe)t()}function Fwr(t){const n=ZI();if(S_e=t,n!==ZI()){Qme(),rBe++;for(const s of Kme)s();for(const s of Xme)s()}}function Mgn(){return ZI()}function Mwr(t){return cRe.add(t),()=>cRe.delete(t)}function jgn(){return b3t}function Cye(){const t=ZI();return(t===null?void 0:LS.get(t))??qS}function jwr(t,n=nBe){const s=ZI(),c=Eye(),d=kye(),m=Aye();if(t){S3t(t,n),LS.set(n,t),qS=t,Yme(c),Zme(d,m),aRe(),s!==ZI()&&Qme();return}LS.delete(n),qS=LS.values().next().value??{},Yme(c),Zme(d,m),aRe(),s!==ZI()&&Qme()}function Lwr(){for(const t of[...LS.keys()])jwr(null,t);Fwr(null)}function Lgn(t,n=nBe){const s=Eye(),c=kye(),d=Aye(),m=LS.get(n);S3t(t,n),LS.set(n,t),qS===m&&(qS=t),Yme(s),Zme(c,d),aRe(),ZI()===n&&Qme()}function Bgn(){return qS}function Bwr(t){return sRe.add(t),()=>sRe.delete(t)}function $wr(){return[...LS.keys()]}function lht(t){const n=t.filter(d=>d!==nBe),s=t.length>n.length,c=n.map(d=>`"${d}"`);return s&&c.push("the unnamed default (address it with no id at all)"),c.join(", ")}class uht extends Error{instances;constructor(n,s){super(n),this.name="InstanceResolutionError",this.instances=s}}function qwr(t){const n=$wr();if(t!==void 0){const s=LS.get(t);if(s)return s;throw new uht(n.length===0?`no instance "${t}" — no game is mounted`:`no instance "${t}" — live: ${lht(n)}`,n)}if(n.length===1)return LS.get(n[0]);if(n.length===0)return qS;throw new uht(`${n.length} instances are live (${lht(n)}) — name one in your program (\`game.instance(id)\`, or \`await game.instances()\` for handles); refusing to guess`,n)}function $gn(){return zAt(qS.physics)}function zwr(){return qS.camera??null}function Eye(){return qS.networking??tBe??null}function Vwr(){return Cye().networking??tBe??null}function Uwr(t){return Kme.add(t),()=>Kme.delete(t)}function qgn(t){const n=Eye();tBe=t,Yme(n)}function zgn(){return qS.debug??null}function Vgn(t){const n=kye(),s=Aye();nQ=t,Zme(n,s)}function kye(){return qS.audio??nQ}function Jwr(){return Cye().audio??nQ}function Wwr(t){return Xme.add(t),()=>Xme.delete(t)}function Hwr(){return rBe}function Aye(){const t=new Set;for(const n of LS.values())n.audio&&t.add(n.audio);return t.size===0&&nQ&&t.add(nQ),[...t]}function Gwr(){return qS.renderDebug??null}function Ugn(){return Cye().renderDebug??null}let x3t=null;const lRe=new Set;function Jgn(t){x3t=t;for(const n of lRe)n()}function Dye(){return x3t?.()??null}function Pye(t){lRe.add(t);const n=Mwr(t);return()=>{lRe.delete(t),n()}}function lN(){const t=Dye();return t?`play:${t.instanceId}`:"stopped"}function Iye(t,n){let s=!1,c=[];const d=()=>{s=!1;const g=c;c=[];for(let S=g.length-1;S>=0;S--)g[S]()};return{ensure(g){if(!s){s=!0;try{g(S=>c.push(S))}catch(S){throw d(),S}}},reset:d}}let xO=[],Kwr=0,w3t=0;const uRe=new Set;function fht(){w3t++;for(const t of uRe)t()}function T3t(t){return uRe.add(t),()=>{uRe.delete(t)}}function dht(){return w3t}function Z4(t){if(xO.some(s=>s.contribution.id===t.id))throw new Error(`registerWorkspaceStatus: id "${t.id}" is already registered — status ids key status-bar slots, so they must be unique; unregister the previous contribution first.`);const n={contribution:t,seq:Kwr++};return xO=[...xO,n],fht(),()=>{xO.includes(n)&&(xO=xO.filter(s=>s!==n),fht())}}function fRe(t){const n=s=>[...xO].filter(c=>(c.contribution.align??"left")===s).sort((c,d)=>(c.contribution.order??0)-(d.contribution.order??0)||c.seq-d.seq).map(c=>c.contribution);return t?n(t):[...n("left"),...n("right")]}let x_e=null,C3t=0;const dRe=new Set;function pht(){C3t++;for(const t of dRe)t()}function E3t(t){return dRe.add(t),()=>dRe.delete(t)}function pRe(){return C3t}function iBe(){return x_e}function Xwr(t){const n=Symbol(t.documentId);return x_e={...t,token:n},pht(),()=>{x_e?.token===n&&(x_e=null,pht())}}function Ywr(){Ye.useSyncExternalStore(E3t,pRe);const t=iBe();return t?.status?$.jsx("span",{className:"volter-status-copy","data-testid":"status-asset-editor","data-status-tone":"muted",children:t.status}):null}const Zwr=Iye();function Qwr(){Zwr.ensure(t=>{t(Z4({id:"asset-editor-status",name:"Asset editor",align:"left",order:40,Content:Ywr}))})}Qwr();let bB=null,k3t=0;const _Re=new Set;function _ht(){k3t+=1;for(const t of _Re)t()}function eTr(t){return _Re.add(t),()=>{_Re.delete(t)}}function mht(){return k3t}function tTr(t,n){const s=Symbol(t);return bB={documentId:t,readSubject:n,token:s},_ht(),()=>{bB?.token===s&&(bB=null,_ht())}}function mRe(){return bB===null?null:{documentId:bB.documentId,subject:bB.readSubject()}}const uN=new Map,hRe=new Map;function A3t(){typeof window>"u"||window.parent===window||uN.size===0||window.parent.postMessage({type:"volter:viewport-ready",documents:[...uN.keys()]},"*")}typeof window<"u"&&window.parent!==window&&window.addEventListener("message",t=>{t.source===window.parent&&t.data?.type==="volter:request-viewport-ready"&&A3t()});let Oc=null,oBe=null;function sBe(){if(typeof window>"u")return!1;const t=window.__VOLTER_VIEWPORT_TIMINGS__;if(t===!0||t==="1")return!0;try{return new URLSearchParams(window.location.search).get("volterTimings")==="1"}catch{return!1}}function D3t(t,n,s){return{documentId:t,visibilityState:typeof document>"u"?"unavailable":document.visibilityState,startedAtMs:n,reactActiveAtMs:null,boardBuildStartedAtMs:null,boardReadyAtMs:null,constructStartedAtMs:null,viewportReadyAtMs:null,rafResumeAtMs:null,firstRenderStartedAtMs:null,workspaceSyncMs:0,revealScheduleMs:0,componentIndexMs:0,componentIndexBusyMs:0,componentIndexWaitMs:0,candidateCollectMs:0,storyMountTotalMs:0,boundsMs:0,layoutMs:0,assembleMs:0,webglContextMs:0,rendererMs:0,adapterSetupMs:0,iblBakeMs:0,dressingMs:0,editorViewportMs:0,framingMs:0,resizeBindMs:0,viewportBindMs:0,firstRenderMs:0,candidateCount:0,exhibitCount:0,skippedCount:0,modulesAlreadyLoaded:s.modulesAlreadyLoaded===!0,stories:[]}}function rTr(t){let n=0,s=0;for(const c of t)n+=Math.max(0,c.runtimeMs)+Math.max(0,c.fiberMs),s+=Math.max(0,c.loadMs)+Math.max(0,c.settleMs);return{busyMs:n,waitMs:s}}function nTr(t,n){const s=t.reactActiveAtMs===null?0:Math.max(0,t.reactActiveAtMs-t.startedAtMs),c=t.reactActiveAtMs??t.startedAtMs,d=t.boardBuildStartedAtMs,m=d===null?0:Math.max(0,d-c),g=t.boardReadyAtMs===null||t.constructStartedAtMs===null?0:Math.max(0,t.constructStartedAtMs-t.boardReadyAtMs),S=t.viewportReadyAtMs??t.rafResumeAtMs,k=t.firstRenderStartedAtMs??n,A=S===null?0:Math.max(0,k-S),F=S===null?Math.max(0,n-t.startedAtMs):Math.max(0,n-S),D=rTr(t.stories),J=t.boardBuildStartedAtMs===null?"switch-back":"first-open",G=iTr({workspaceSyncMs:s,revealScheduleMs:m,componentIndexMs:t.componentIndexMs,componentIndexBusyMs:t.componentIndexBusyMs,componentIndexWaitMs:t.componentIndexWaitMs,candidateCollectMs:t.candidateCollectMs,storyMountTotalMs:t.storyMountTotalMs,storyMountBusyMs:D.busyMs,storyMountWaitMs:D.waitMs,boundsMs:t.boundsMs,layoutMs:t.layoutMs,assembleMs:t.assembleMs,reactCommitMs:g,webglContextMs:t.webglContextMs,rendererMs:t.rendererMs,adapterSetupMs:t.adapterSetupMs,iblBakeMs:t.iblBakeMs,dressingMs:t.dressingMs,editorViewportMs:t.editorViewportMs,framingMs:t.framingMs,resizeBindMs:t.resizeBindMs,viewportBindMs:t.viewportBindMs,rafWaitMs:A,firstRenderMs:t.firstRenderMs}).reduce((pe,ue)=>pe+ue.ms,0),se=Math.max(0,n-t.startedAtMs);return{visibilityState:t.visibilityState,startedAtMs:t.startedAtMs,reactActiveAtMs:t.reactActiveAtMs,boardBuildStartedAtMs:t.boardBuildStartedAtMs,boardReadyAtMs:t.boardReadyAtMs,constructStartedAtMs:t.constructStartedAtMs,viewportReadyAtMs:t.viewportReadyAtMs,rafResumeAtMs:t.rafResumeAtMs,firstRenderStartedAtMs:t.firstRenderStartedAtMs,firstFrameAtMs:n,activationKind:J,workspaceSyncMs:s,revealScheduleMs:m,componentIndexMs:t.componentIndexMs,candidateCollectMs:t.candidateCollectMs,storyMountTotalMs:t.storyMountTotalMs,storyMountBusyMs:D.busyMs,storyMountWaitMs:D.waitMs,boundsMs:t.boundsMs,layoutMs:t.layoutMs,assembleMs:t.assembleMs,reactCommitMs:g,webglContextMs:t.webglContextMs,rendererMs:t.rendererMs,adapterSetupMs:t.adapterSetupMs,iblBakeMs:t.iblBakeMs,dressingMs:t.dressingMs,editorViewportMs:t.editorViewportMs,framingMs:t.framingMs,resizeBindMs:t.resizeBindMs,viewportBindMs:t.viewportBindMs,rafWaitMs:A,firstRenderMs:t.firstRenderMs,firstPaintMs:F,unattributedMs:Math.max(0,se-G),accountedMs:G,candidateCount:t.candidateCount,exhibitCount:t.exhibitCount,skippedCount:t.skippedCount,modulesAlreadyLoaded:t.modulesAlreadyLoaded,stories:t.stories,storyDiscovery:oBe}}function Zb(t,n){const s=Math.max(0,n);return{name:t,ms:s,busyMs:s,waitMs:0,kind:"cpu"}}function Tpe(t,n){const s=Math.max(0,n);return{name:t,ms:s,busyMs:0,waitMs:s,kind:"idle"}}function hht(t,n,s,c){const d=Math.max(0,n);let m=Math.max(0,s),g=Math.max(0,c);if(m+g>d){const S=d/(m+g);m*=S,g*=S}else m+g<d&&(g+=d-m-g);return{name:t,ms:d,busyMs:m,waitMs:g,kind:"mixed"}}function iTr(t){return[Tpe("workspace-sync",t.workspaceSyncMs),Tpe("reveal-schedule",t.revealScheduleMs),hht("component-index",t.componentIndexMs,t.componentIndexBusyMs,t.componentIndexWaitMs>0||t.componentIndexMs===0?t.componentIndexWaitMs:t.componentIndexMs),Zb("candidate-collect",t.candidateCollectMs),hht("story-mounts",t.storyMountTotalMs,t.storyMountBusyMs,t.storyMountWaitMs),Zb("bounds",t.boundsMs),Zb("layout",t.layoutMs),Zb("assemble",t.assembleMs),Tpe("react-commit (board→viewport)",t.reactCommitMs),Zb("webgl-context",t.webglContextMs),Zb("renderer",t.rendererMs),Zb("adapter-setup",t.adapterSetupMs),Zb("ibl-bake (three PMREM)",t.iblBakeMs),Zb("dressing",t.dressingMs),Zb("editor-viewport",t.editorViewportMs),Zb("framing",t.framingMs),Zb("resize-bind",t.resizeBindMs),Zb("viewport-bind",t.viewportBindMs),Tpe("raf-wait",t.rafWaitMs),Zb("first-render",t.firstRenderMs)]}function Wgn(t,n=Date.now()){const s=(hRe.get(t)??0)+1;hRe.set(t,s);const c={documentId:t,activation:s,firstFrameAtMs:n},d=Oc;if(d&&d.documentId===t){const m={...c,breakdown:nTr(d,n)};return Oc=null,uN.set(t,m),yht(),ght(),m}return uN.set(t,c),yht(),ght(),c}let gRe=new Set;const yRe=new Set;function ght(){A3t();for(const t of yRe)t()}function oTr(t){return yRe.add(t),()=>yRe.delete(t)}function yht(){uN.size!==0&&P3t()}function P3t(){const t=gRe;gRe=new Set;for(const n of t)n()}let vht=!1;function sTr(){vht||typeof document>"u"||(vht=!0,document.addEventListener("visibilitychange",()=>{document.hidden&&P3t()}))}function Nye(){return uN.size>0||typeof document<"u"&&document.hidden?Promise.resolve():(sTr(),new Promise(t=>gRe.add(t)))}function aTr(){return[...uN.values()]}function cTr(t){sBe()&&(Oc=D3t(t,Date.now(),{}))}function Hgn(t,n={}){if(!sBe())return;const s=Date.now();if(Oc&&Oc.documentId===t){Oc.boardBuildStartedAtMs===null&&(Oc.boardBuildStartedAtMs=s),n.modulesAlreadyLoaded===!0&&(Oc.modulesAlreadyLoaded=!0);return}Oc=D3t(t,s,n),Oc.boardBuildStartedAtMs=s}function Ggn(t){Oc&&(t&&Oc.documentId!==t||(Oc=null))}function Kgn(t,n,s){if(!Oc)return;const c=Math.max(0,n);switch(t){case"component-index":Oc.componentIndexMs=c,Oc.componentIndexBusyMs=Math.max(0,s?.busyMs??0),Oc.componentIndexWaitMs=Math.max(0,s?.waitMs??c);break;case"candidate-collect":Oc.candidateCollectMs=c;break;case"story-mounts":Oc.storyMountTotalMs=c;break;case"bounds":Oc.boundsMs=c;break;case"layout":Oc.layoutMs=c;break;case"assemble":Oc.assembleMs=c;break;case"webgl-context":Oc.webglContextMs=c;break;case"renderer":Oc.rendererMs=c;break;case"adapter-setup":Oc.adapterSetupMs=c;break;case"ibl-bake":Oc.iblBakeMs=c;break;case"dressing":Oc.dressingMs=c;break;case"editor-viewport":Oc.editorViewportMs=c;break;case"framing":Oc.framingMs=c;break;case"resize-bind":Oc.resizeBindMs=c;break;case"viewport-bind":Oc.viewportBindMs=c;break;case"first-render":Oc.firstRenderMs=c;break}}function Xgn(t){!Oc||Oc.documentId!==t||Oc.reactActiveAtMs===null&&(Oc.reactActiveAtMs=Date.now())}function Ygn(t){!Oc||Oc.documentId!==t||Oc.rafResumeAtMs===null&&(Oc.rafResumeAtMs=Date.now())}function Zgn(t){!Oc||Oc.documentId!==t||Oc.firstRenderStartedAtMs===null&&(Oc.firstRenderStartedAtMs=Date.now())}function Qgn(t){Oc&&(t.candidateCount!==void 0&&(Oc.candidateCount=t.candidateCount),t.exhibitCount!==void 0&&(Oc.exhibitCount=t.exhibitCount),t.skippedCount!==void 0&&(Oc.skippedCount=t.skippedCount))}function eyn(){Oc&&(Oc.boardReadyAtMs=Date.now())}function tyn(){Oc&&(Oc.constructStartedAtMs=Date.now())}function ryn(){Oc&&(Oc.viewportReadyAtMs=Date.now())}function nyn(t){Oc&&Oc.stories.push(t)}function iyn(){return Oc?.documentId??null}function lTr(t){sBe()&&(oBe=t)}function uTr(){uN.clear(),hRe.clear(),Oc=null,oBe=null}const fTr=["scene","game","world","story","asset","behavior","generation","content-browser","project-tool","tool-contribution","document"];let hp=[],zk=null,n2=null,iQ=null,uR=null;function bht(t){queueMicrotask(()=>{uR===t&&hp.some(n=>n.descriptor.id===t)&&(uR=null,X0(t))})}let I3t=0;const vRe=new Set,w5e=new Set,aBe=new Map,XO=new Map;function TC(){I3t++;for(const t of vRe)t()}function i2(t){return vRe.add(t),()=>{vRe.delete(t)}}function X1(){return I3t}function l0(){return hp}function e_(){return n2}function bRe(){return iQ}function dTr(t,n){X0(t)&&iQ!==n&&(iQ=n,TC())}function CC(){return hp.find(t=>t.descriptor.id===n2)??null}function oQ(t){if(t===n2)return;t&&cTr(t);const n=hp.find(c=>c.descriptor.id===n2);n2=t,iQ=null,n?.descriptor.onDeactivate?.(n.descriptor.id);const s=hp.find(c=>c.descriptor.id===t);s?.descriptor.onActivate?.(s.descriptor.id)}function pTr(t,n,s,c){if(n){!s&&c&&zk===t&&(zk=null);return}s&&(zk&&EN(zk),zk=t)}function ND(t,n={}){const s=uR===t.id,c=s||n.activate!==!1,d=hp.find(g=>g.descriptor.id===t.id);if(pTr(t.id,!!d,n.preview===!0,c),!d)return hp=[...hp,{descriptor:t,dirty:!1,title:t.title}],!t.area&&(c||n2===null)&&oQ(t.id),s&&bht(t.id),TC(),t.id;let m=!1;return(d.descriptor.Toolbar!==t.Toolbar||d.descriptor.Shelf!==t.Shelf||d.descriptor.Content!==t.Content)&&(hp=hp.map(g=>{if(g!==d)return g;const{Toolbar:S,Shelf:k,...A}=g.descriptor;return{...g,descriptor:{...A,Content:t.Content,...t.Toolbar?{Toolbar:t.Toolbar}:{},...t.Shelf?{Shelf:t.Shelf}:{}}}}),m=!0),c&&n2!==t.id&&(oQ(t.id),m=!0),m&&TC(),s&&bht(t.id),t.id}function X0(t){return hp.some(n=>n.descriptor.id===t)?(n2!==t&&(oQ(t),TC()),!0):!1}function N3t(){uR=null}function _Tr(t){if(X0(t)){uR=null;return}uR=t}function EN(t,n={}){if(w5e.has(t))return!1;const s=hp.findIndex(d=>d.descriptor.id===t);if(s<0)return!1;const c=hp[s];if(c.dirty&&!n.discardDirty)return!1;w5e.add(t);try{if(n2===t){const m=s>0?hp[s-1]:hp[s+1]??null;oQ(m?m.descriptor.id:null)}return hp=hp.filter(m=>m.descriptor.id!==t),zk===t&&(zk=null),aBe.delete(t),XO.delete(t),c.descriptor.onDispose?.(t),TC(),!0}finally{w5e.delete(t)}}function O3t(){if(hp.length===0&&n2===null)return;const t=hp;oQ(null),hp=[],iQ=null,zk=null,aBe.clear(),XO.clear(),uR=null;for(const n of t)n.descriptor.onDispose?.(n.descriptor.id);TC()}function mTr(t,n){return hp.some(s=>s.descriptor.id===t)?(XO.set(t,n),TC(),()=>{XO.get(t)===n&&(XO.delete(t),TC())}):()=>{}}function oyn(t){XO.has(t)&&TC()}async function hTr(t){if(!hp.some(s=>s.descriptor.id===t))return null;const n=aBe.get(t);if(!n)return null;try{return await n()}catch{return!1}}function gTr(){return n2?hTr(n2):Promise.resolve(null)}function syn(t,n){n&&zk===t&&(zk=null);const s=hp.findIndex(d=>d.descriptor.id===t);s<0||hp[s].dirty===n||(hp=hp.map(d=>d.descriptor.id===t?{...d,dirty:n}:d),TC())}function R3t(t,n){const s=hp.find(c=>c.descriptor.id===t);!s||s.title===n||(hp=hp.map(c=>c.descriptor.id===t?{...c,title:n}:c),TC())}function cBe(t){const n=hp.find(c=>c.descriptor.id===t),s=XO.get(t)??n?.descriptor.selection;if(!s)return null;try{return s()}catch{return null}}function Oye(){return n2?cBe(n2):null}const yTr={adapter:null,nodeId:null};function vTr(t){return JSON.stringify({id:t.id,title:t.title,hint:t.hint,kindLabel:t.kindLabel,note:t.note,sections:t.sections.map(n=>({id:n.id,title:n.title,order:n.order,description:n.description,defaultOpen:n.defaultOpen,testId:n.testId,keepMounted:n.keepMounted,railGroup:n.railGroup,bodyKind:n.body.kind})),quickActions:t.quickActions?.map(n=>({id:n.id,title:n.title,label:n.label,placement:n.placement,pressed:n.pressed,disabled:n.disabled}))})}function lBe({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,selection:g}){Ye.useEffect(()=>{if(n)return Xwr({documentId:t,title:c,type:s,...m?{status:m}:{}})},[n,t,m,c,s]);const S=Ye.useRef(g);S.current=g,Ye.useEffect(()=>{if(n)return mTr(t,()=>S.current?.()??yTr)},[n,t]);const k={id:t,title:c,kindLabel:s,...m?{note:{text:m,testId:"asset-editor-status"}}:{},sections:d??[]},A=Ye.useRef(k);A.current=k;const F=vTr(k);return Ye.useEffect(()=>{if(n)return tTr(t,()=>A.current)},[n,t,F]),null}function bTr({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,fill:g=!1,selection:S,children:k}){return $.jsxs("section",{className:"volter-asset-editor","data-testid":`asset-editor:${s}`,"aria-label":`${c} Asset Editor`,children:[$.jsx(lBe,{documentId:t,active:n,type:s,title:c,sections:d,status:m,selection:S}),$.jsx("main",{className:`volter-asset-editor__viewport${g?" volter-asset-editor__viewport--fill":""}`,children:k})]})}const STr=Object.freeze(Object.defineProperty({__proto__:null,AssetEditorShell:bTr,AssetEditorSubject:lBe},Symbol.toStringTag,{value:"Module"})),w_e=new Map,SRe=new Set;function Sht(){for(const t of SRe)t()}function ayn(t){const n=Object.entries(t);for(const[s,c]of n)w_e.set(s,c);return Sht(),()=>{for(const[s,c]of n)w_e.get(s)===c&&w_e.delete(s);Sht()}}function xTr(t){return w_e.get(t)??null}function wTr(t){return SRe.add(t),()=>{SRe.delete(t)}}function TTr(t){return $.jsx(lBe,{...t})}const xht=new Map;function CTr(t){const n=xht.get(t);if(n)return n;function s(c){const d=Ye.useCallback(()=>xTr(t),[]),m=Ye.useSyncExternalStore(wTr,d,d);return m?$.jsx(m,{...c}):$.jsxs("div",{style:{minHeight:240},children:["Loading ",t,"…"]})}return s.displayName=`ContributionSurface(${t})`,xht.set(t,s),s}const uBe=new Proxy(Object.freeze({AssetDocument:TTr}),{get(t,n,s){return typeof n!="string"||Reflect.has(t,n)||!/^[A-Z]/.test(n)?Reflect.get(t,n,s):CTr(n)}}),wht=Object.freeze({id:"classic",shape:{small:"3px",medium:"6px",large:"8px",full:"9999px"},elevation:{small:"0 2px 8px rgba(0,0,0,0.6)",medium:"0 4px 12px rgba(0,0,0,0.5)",large:"0 8px 32px rgba(0,0,0,0.6)"}}),Ym=Object.freeze({id:"glass",color:{surface:{shell:"#12161f",panel:"rgba(255,255,255,0.06)",chrome:"rgba(255,255,255,0.10)",raised:"rgba(255,255,255,0.16)",inset:"rgba(10,14,22,0.38)",overlay:"rgba(255,255,255,0.08)"},boundary:{default:"rgba(255,255,255,0.22)",strong:"rgba(255,255,255,0.38)"},neutralOverlay:{hover:"color-mix(in srgb, currentColor 10%, transparent)",active:"color-mix(in srgb, currentColor 16%, transparent)"},scrim:"rgba(8,12,20,0.35)"},shape:{small:"4px",medium:"8px",large:"14px",full:"9999px"},elevation:{small:"0 4px 14px -6px rgba(0,0,0,0.45)",medium:"0 8px 24px -10px rgba(0,0,0,0.5)",large:"0 20px 46px -16px rgba(0,0,0,0.55), 0 4px 14px -6px rgba(0,0,0,0.35)"},treatment:{backdropBlurPx:1,backdropSaturation:1.15,edgeSpecular:.7,specularAngleDeg:120,refractionBezelPx:56,refractionThickness:1.25,textShadowOpacity:.72,contentFrostBlurPx:24,ambientLiftOpacity:.07,adaptiveContent:!0,brightTextShadowOpacity:0,brightFrostBg:"rgba(255,255,255,0.3)"},reducedTransparency:{surface:{shell:"#12161f",panel:"#33373e",chrome:"#3d4047",raised:"#4b4e55",inset:"#23272f",overlay:"#383b43"},scrim:"rgba(8,12,20,0.5)"}}),ETr=["classic","glass"],kTr=Object.freeze([{id:"classic",title:"Classic",description:"Opaque editor surfaces with conventional bars and panels."},{id:"glass",title:"Glass",description:"Adaptive clear material with refraction, frost, and floating chrome."}]),SB=new Map;let ehe=null;const the=new Set;function ATr(){return ehe??=[...kTr,...[...SB.values()].map(({id:t,title:n,description:s})=>({id:t,title:n,description:s}))],ehe}function DTr(t){return the.add(t),()=>the.delete(t)}function PTr(t){if(Rye(t.id))throw new Error(`registerContributedMaterial: material "${t.id}" is already registered.`);SB.set(t.id,t),ehe=null;for(const n of the)n();return()=>{if(SB.get(t.id)===t){SB.delete(t.id),ehe=null;for(const n of the)n()}}}function Rye(t){return typeof t=="string"&&(ETr.includes(t)||SB.has(t))}function ITr(t,n,s=!1){if(n!=="glass"){const d=SB.get(n);return{id:d?`${t.id}--${d.id}`:t.id,color:t.color,typography:t.typography,shape:d?.shape??wht.shape,elevation:d?.elevation??wht.elevation,...d?.density?{density:d.density}:{},...d?.stage?{stage:d.stage}:{},appearance:{material:"classic",transparency:"standard"}}}return{id:`${t.id}--${s?"glass-reduced":"glass"}`,color:{surface:s?Ym.reducedTransparency.surface:Ym.color.surface,boundary:Ym.color.boundary,content:t.color.content,accent:t.color.accent,semantic:t.color.semantic,neutralOverlay:Ym.color.neutralOverlay,scrim:s?Ym.reducedTransparency.scrim:Ym.color.scrim},typography:t.typography,shape:Ym.shape,elevation:Ym.elevation,appearance:{material:"glass",transparency:s?"reduced":"standard"},...s?{}:{treatment:Ym.treatment}}}const NTr={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},OTr={start:"flex-start",center:"center",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly"};function Cpe(t){return t===0?"0px":t===void 0?void 0:`var(--volter-space-${t})`}function F3t({gap:t,align:n,justify:s,padding:c,paddingX:d,paddingY:m,style:g}){return{gap:Cpe(t),alignItems:n?NTr[n]:void 0,justifyContent:s?OTr[s]:void 0,padding:Cpe(c),paddingInline:Cpe(d),paddingBlock:Cpe(m),...g}}function hee(t,n){return n?`${t} ${n}`:t}function M3t({className:t,...n}){return $.jsx("div",{...n,className:hee("volter-stack",t),style:F3t(n)})}function bZ({className:t,...n}){return $.jsx("div",{...n,className:hee("volter-inline",t),style:F3t(n)})}function cyn({className:t,...n}){return $.jsx("span",{...n,"aria-hidden":"true",className:hee("volter-spacer",t)})}function RTr({orientation:t="horizontal",className:n,...s}){return $.jsx("div",{...s,"aria-hidden":"true","data-orientation":t,className:hee("volter-divider",n)})}function FTr({children:t,className:n,...s}){return $.jsx(bZ,{...s,className:hee("volter-actions",n),gap:2,align:"center",children:t})}function j3t(t,n){return n?`${t} ${n}`:t}const _p=Ye.forwardRef(function({as:n="span",variant:s="body",tone:c="primary",truncate:d=!1,selectable:m=!1,className:g,...S},k){const A=n;return $.jsx(A,{...S,ref:k,"data-variant":s,"data-tone":c,"data-truncate":d||void 0,"data-selectable":m||void 0,className:j3t("volter-text",g)})});function lyn({className:t,...n}){return $.jsx("kbd",{...n,className:j3t("volter-keycap",t)})}function B$(t,n){return n?`${t} ${n}`:t}function xRe({labelledBy:t,onDismiss:n,size:s="default",variant:c="default",className:d,...m}){const[g]=Ye.useState(()=>typeof document>"u"?null:document.querySelector(".volter-editor-theme")),S=Ye.useId(),k=$.jsx("div",{"data-volter-portal-content":g?S:void 0,className:"volter-dialog-scrim","data-variant":c,onPointerDown:A=>{A.target===A.currentTarget&&n?.()},children:$.jsx("div",{...m,role:"dialog","aria-modal":"true","aria-labelledby":t,"data-size":s,"data-variant":c,className:B$("volter-dialog",d)})});return g?$.jsxs($.Fragment,{children:[$.jsx("span",{"data-volter-portal":S,style:{display:"none"}}),MS.createPortal(k,g)]}):k}function wRe({titleId:t,title:n,description:s}){return $.jsxs(M3t,{className:"volter-dialog-header",gap:2,children:[$.jsx(_p,{id:t,as:"h2",variant:"heading",children:n}),s&&$.jsx(_p,{as:"p",tone:"muted",children:s})]})}function L3t({className:t,...n}){return $.jsx(M3t,{...n,className:B$("volter-dialog-body",t)})}function TRe({children:t,className:n,...s}){return $.jsx(FTr,{...s,className:B$("volter-dialog-footer",n),children:t})}function uyn({className:t,...n}){return $.jsx("label",{...n,className:B$("volter-dialog-field",t)})}function fyn({children:t}){return $.jsx(_p,{variant:"label",tone:"muted",children:t})}function dyn({className:t,...n}){return $.jsx(bZ,{...n,className:B$("volter-joined-field",t)})}function pyn({className:t,...n}){return $.jsx("span",{...n,className:B$("volter-joined-field-suffix",t)})}function fBe(t,n){return n?`${t} ${n}`:t}function MTr({className:t,...n}){return $.jsx("div",{...n,className:fBe("volter-field-group",t)})}function T_e({label:t,htmlFor:n,hint:s,compact:c=!1,className:d,children:m,...g}){return $.jsxs("div",{...g,"data-compact":c||void 0,className:fBe("volter-field-row",d),children:[$.jsx("label",{htmlFor:n,className:"volter-field-label",children:t}),$.jsx("div",{className:"volter-field-control",children:m}),s&&$.jsx("div",{className:"volter-field-hint",children:s})]})}function _yn({className:t,...n}){return $.jsx("label",{...n,className:fBe("volter-field-label",t)})}const myn=Ye.forwardRef(function({selected:n=!1,accent:s="bar",className:c,type:d="button",...m},g){return $.jsx("button",{...m,ref:g,type:d,"data-selected":n||void 0,"data-accent":s,className:c?`volter-list-button ${c}`:"volter-list-button"})});function jTr({tone:t="neutral",icon:n,title:s,description:c,action:d,compact:m=!1,className:g,...S}){const k=t==="error"?"alert":t==="loading"||t==="success"?"status":void 0;return $.jsxs("div",{...S,role:S.role??k,"data-tone":t,"data-compact":m||void 0,className:g?`volter-state-surface ${g}`:"volter-state-surface",children:[n&&$.jsx("div",{className:"volter-state-surface-icon",children:n}),$.jsx("strong",{className:"volter-state-surface-title",children:s}),c&&$.jsx("div",{className:"volter-state-surface-description",children:c}),d&&$.jsx("div",{className:"volter-state-surface-action",children:d})]})}function $$(t,n){return n?`${t} ${n}`:t}function LTr({variant:t="panel",border:n=!1,scroll:s=!1,className:c,...d}){return $.jsx("div",{...d,"data-variant":t,"data-border":n||void 0,"data-scroll":s||void 0,className:$$("volter-surface",c)})}function hyn({tone:t="info",icon:n,actions:s,className:c,children:d,...m}){return $.jsxs("div",{...m,role:t==="error"?"alert":"status","data-tone":t,className:$$("volter-banner",c),children:[n&&$.jsx("span",{className:"volter-banner-icon",children:n}),$.jsx("div",{className:"volter-banner-content",children:d}),s&&$.jsx("div",{className:"volter-banner-actions",children:s})]})}const gyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("div",{ref:c,...s,className:$$("volter-popover",n)})});function yyn({shape:t="label",className:n,...s}){return $.jsx("span",{...s,"data-shape":t,className:$$("volter-badge",n)})}function Tht({position:t="inside",className:n,...s}){return $.jsx("div",{...s,"aria-hidden":"true","data-position":t,className:$$("volter-drop-indicator",n)})}function vyn({orientation:t,label:n,valueNow:s,valueMin:c=0,valueMax:d=100,className:m,...g}){return $.jsx("div",{...g,role:"separator","aria-label":n,"aria-orientation":t,"aria-valuenow":s,"aria-valuemin":s===void 0?void 0:c,"aria-valuemax":s===void 0?void 0:d,"data-orientation":t,className:$$("volter-resize-handle",m)})}function B3t(t,n){return n?`${t} ${n}`:t}const byn=Ye.forwardRef(function({className:n,onKeyDown:s,...c},d){return $.jsx("div",{...c,ref:d,role:"tablist",className:B3t("volter-tabs",n),onKeyDown:m=>{if(s?.(m),m.defaultPrevented||!["ArrowLeft","ArrowRight","Home","End"].includes(m.key))return;const g=Array.from(m.currentTarget.querySelectorAll('[role="tab"]:not(:disabled)'));if(g.length===0)return;m.preventDefault();const S=g.indexOf(document.activeElement);(m.key==="Home"?g[0]:m.key==="End"?g.at(-1):m.key==="ArrowRight"?g[(S+1+g.length)%g.length]:g[(S-1+g.length)%g.length])?.focus()}})}),Syn=Ye.forwardRef(function({selected:n=!1,dirty:s=!1,badge:c,className:d,type:m="button",tabIndex:g,children:S,...k},A){return $.jsxs("button",{...k,ref:A,type:m,role:"tab",tabIndex:g??(n?0:-1),"aria-selected":n,"data-selected":n||void 0,className:B3t("volter-tab",d),children:[s&&$.jsxs($.Fragment,{children:[$.jsx("span",{className:"volter-tab-dirty",title:"Unsaved","aria-hidden":"true"}),$.jsx("span",{className:"volter-sr-only",children:"Unsaved"})]}),$.jsx("span",{className:"volter-tab-label",children:S}),c!==void 0&&$.jsx("span",{className:"volter-tab-badge",children:c})]})});function gee(t,n){return n?`${t} ${n}`:t}const n$=Ye.forwardRef(function({label:n,compact:s=!1,selectionMode:c="independent",className:d,...m},g){return $.jsx("div",{...m,ref:g,role:"toolbar","aria-label":n,"data-compact":s||void 0,"data-selection-mode":c,className:gee("volter-toolbar",d)})});function Cht({className:t,...n}){return $.jsx("div",{...n,role:"group",className:gee("volter-toolbar-group",t)})}function Eht(t){return $.jsx("span",{...t,"aria-hidden":"true",className:gee("volter-toolbar-divider",t.className)})}function xyn({className:t,onPointerDownCapture:n,...s}){return $.jsx(n$,{...s,compact:!0,className:gee("volter-floating-toolbar volter-glass-island",t),onPointerDownCapture:c=>{n?.(c),c.stopPropagation()}})}function wyn({className:t,...n}){return $.jsx("div",{...n,role:"group",className:gee("volter-split-button",t)})}function $3t(t,n){return n?`${t} ${n}`:t}const Tyn=Ye.forwardRef(function({label:n,className:s,...c},d){return $.jsx("div",{...c,ref:d,role:"tree","aria-label":n,className:$3t("volter-tree",s)})}),Cyn=Ye.forwardRef(function({level:n=1,selected:s=!1,expanded:c,muted:d=!1,dragging:m=!1,leading:g,actions:S,className:k,children:A,style:F,...D},J){return $.jsxs("div",{...D,ref:J,role:"treeitem",tabIndex:D.tabIndex??-1,"aria-level":n,"aria-selected":s,...c===void 0?{}:{"aria-expanded":c},"data-selected":s||void 0,"data-muted":d||void 0,"data-dragging":m||void 0,className:$3t("volter-tree-row",k),style:{paddingLeft:6+Math.max(0,n-1)*14,...F},children:[g&&$.jsx("span",{className:"volter-tree-row-leading",children:g}),$.jsx("span",{className:"volter-tree-row-label",children:A}),S&&$.jsx("span",{className:"volter-tree-row-actions",children:S})]})});function q3t(t,n=8){const s=window.innerWidth,c=window.innerHeight,d=Math.max(n,s-t.width-n),m=Math.max(n,c-t.height-n);return{left:Math.min(Math.max(t.left,n),d),top:Math.min(Math.max(t.top,n),m)}}function Fye(t,n){return n?`${t} ${n}`:t}function CRe(t){return Array.from(t.querySelectorAll('[role="menuitem"]:not(:disabled), [role="menuitemradio"]:not(:disabled), [role="menuitemcheckbox"]:not(:disabled)'))}function BTr(t){CRe(t)[0]?.focus()}const fN=Ye.forwardRef(function({className:n,role:s="menu",autoFocusFirst:c=!1,dismissBoundaryRef:d,onDismiss:m,onKeyDown:g,...S},k){const A=Ye.useRef(null);return Ye.useImperativeHandle(k,()=>A.current),Ye.useEffect(()=>{c&&CRe(A.current)[0]?.focus()},[c]),Ye.useEffect(()=>{if(!m)return;const F=D=>{const J=D.target;!A.current?.contains(J)&&!d?.current?.contains(J)&&m("outside")};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[d,m]),$.jsx("div",{...S,ref:A,role:s,className:Fye("volter-menu",n),onKeyDown:F=>{if(g?.(F),F.defaultPrevented)return;if(F.key==="Escape"){F.preventDefault(),m?.("escape");return}if(!["ArrowDown","ArrowUp","Home","End"].includes(F.key))return;F.preventDefault();const D=CRe(F.currentTarget);if(D.length===0)return;const J=D.indexOf(document.activeElement);F.key==="Home"?D[0]?.focus():F.key==="End"?D.at(-1)?.focus():F.key==="ArrowDown"?D[(J+1+D.length)%D.length]?.focus():D[(J-1+D.length)%D.length]?.focus()}})}),Nc=Ye.forwardRef(function({className:n,type:s="button",role:c="menuitem",onClick:d,onSelect:m,...g},S){return $.jsx("button",{...g,ref:S,type:s,role:c,className:Fye("volter-menu-item",n),onClick:k=>{d?.(k),k.defaultPrevented||m?.()}})});function H1(t){return $.jsx("hr",{...t,className:Fye("volter-menu-separator",t.className)})}const dBe=Ye.forwardRef(function({className:n,type:s="button",...c},d){return $.jsx("button",{...c,ref:d,type:s,"aria-haspopup":c["aria-haspopup"]??"menu",className:Fye("volter-menu-trigger",n)})});function rhe({children:t}){const n=Ye.useRef(null),[s,c]=Ye.useState(null),d=Ye.useId();return Ye.useLayoutEffect(()=>{c(n.current?.closest(".volter-editor-theme")??null)},[]),$.jsxs($.Fragment,{children:[$.jsx("span",{ref:n,"data-volter-portal":d,style:{display:"none"}}),s?MS.createPortal($.jsx("div",{"data-volter-portal-content":d,style:{display:"contents"},children:t}),s):null]})}function pBe({anchorRef:t,align:n="end",side:s="bottom",autoFocusFirst:c=!0,gap:d=4,clamp:m=!1,onDismiss:g,style:S,children:k,...A}){const[F,D]=Ye.useState(null),[J,q]=Ye.useState(null),G=Ye.useRef(null),se=Ye.useRef(!0),pe=Ye.useRef(!1),ue=Ye.useCallback(()=>{const Fe=t.current;if(!Fe||!F)return;const De=Fe.getBoundingClientRect(),be=F.getBoundingClientRect(),we=s==="right"||s==="left"?{left:s==="right"?De.right+d:De.left-d-be.width,top:De.top}:{left:n==="end"?De.right-be.width:De.left,top:s==="top"?De.top-d-be.height:De.bottom+d},Be=m?q3t({...we,width:be.width,height:be.height}):we,bt=G.current;bt?.left===Be.left&&bt.top===Be.top||(G.current=Be,q(Be))},[n,t,m,d,F,s]);Ye.useLayoutEffect(()=>{const Fe=t.current;if(!Fe||!F)return;ue();let De=0;const be=()=>{ue(),De=requestAnimationFrame(be)};De=requestAnimationFrame(be),window.addEventListener("resize",ue),document.addEventListener("scroll",ue,!0);const X=typeof ResizeObserver>"u"?null:new ResizeObserver(ue);return X?.observe(Fe),X?.observe(F),()=>{const we=se.current&&F.contains(document.activeElement);window.removeEventListener("resize",ue),document.removeEventListener("scroll",ue,!0),cancelAnimationFrame(De),X?.disconnect(),we&&queueMicrotask(()=>t.current?.focus())}},[t,F,ue]),Ye.useLayoutEffect(()=>{!c||pe.current||!F||!J||(pe.current=!0,BTr(F))},[c,F,J]);const Ce=Fe=>{se.current=Fe!=="outside",g(),Fe==="escape"&&t.current?.focus()};return $.jsx(rhe,{children:$.jsx(fN,{...A,ref:D,dismissBoundaryRef:t,onDismiss:Ce,style:{...S,position:"fixed",left:J?.left??0,top:J?.top??0,visibility:J?S?.visibility:"hidden"},children:k})})}function Eyn({label:t,children:n,gap:s=0,...c}){const[d,m]=Ye.useState(!1),g=Ye.useRef(null),S=Ye.useId(),k=F=>F instanceof Element&&(g.current?.contains(F)===!0||F.closest(`[data-volter-submenu="${S}"]`)!==null),A=F=>{k(F.relatedTarget)||m(!1)};return $.jsxs($.Fragment,{children:[$.jsxs(Nc,{...c,ref:g,"aria-haspopup":"menu","aria-expanded":d,onPointerEnter:()=>m(!0),onPointerLeave:A,onClick:F=>{F.preventDefault(),m(!0)},onKeyDown:F=>{(F.key==="ArrowRight"||F.key==="Enter"||F.key===" ")&&(F.preventDefault(),m(!0)),F.key==="ArrowLeft"&&m(!1)},children:[$.jsx("span",{style:{flex:1},children:t}),$.jsx("span",{"aria-hidden":"true",style:{paddingInlineStart:"var(--volter-space-4)"},children:"▸"})]}),d&&$.jsx(pBe,{anchorRef:g,"data-volter-submenu":S,side:"right",gap:s,clamp:!0,autoFocusFirst:!1,onDismiss:()=>m(!1),onPointerLeave:A,children:n})]})}const Ms=Ye.forwardRef(function({variant:n="secondary",size:s="default",shape:c="default",className:d,type:m="button",...g},S){return $.jsx("button",{...g,ref:S,type:m,className:d?`volter-btn ${d}`:"volter-btn","data-variant":n,"data-size":s,"data-shape":c})}),dm=Ye.forwardRef(function({variant:n="ghost",visibleLabel:s,children:c,...d},m){return $.jsxs(Ms,{...d,ref:m,variant:n,"data-icon":"true","data-label-placement":s===void 0?void 0:"below",children:[c,s!==void 0&&$.jsx("span",{className:"volter-icon-button-label",children:s})]})}),PI={base:0,overlayLow:50,sticky:100,dropdown:1e3,toast:9999,modal:1e4},IG={0:"#1a1a1a",1:"#242424",2:"#2c2c2c",3:"#333333",inset:"#1e1e1e"},kht={1:"#333333",2:"#444444"},xB={1:"#c5c8ce",2:"#9aa0a6",3:"#90959c"},$Tr="#579EFF",qTr="rgba(87,158,255,0.15)",T5e={1:"#f2f6fb",2:"#d3d9e0",3:"#aab0b7"},_Be="#d8dee9",mBe="rgba(216,222,233,0.18)",z3t="#FF6B6B",V3t="#e0a030",U3t="#4caf50",J3t="rgba(76,175,80,0.15)",W3t="rgba(255,107,107,0.15)",H3t="rgba(224,160,48,0.12)",G3t="rgba(255,107,107,0.06)",K3t="rgba(0,0,0,0.5)",X3t="#ff79c6",Y3t="rgba(255,121,198,0.08)",Z3t="#22b8d6",Mye='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',jye='ui-monospace, "SF Mono", Monaco, "Cascadia Code", monospace',C5e={sm:"0 2px 8px rgba(0,0,0,0.6)",md:"0 4px 12px rgba(0,0,0,0.5)",lg:"0 8px 32px rgba(0,0,0,0.6)"},hBe={0:"var(--volter-surface-shell)",1:"var(--volter-surface-panel)",2:"var(--volter-surface-chrome)",3:"var(--volter-surface-raised)",inset:"var(--volter-surface-inset)"},nhe={1:"var(--volter-boundary-default)",2:"var(--volter-boundary-strong)"},Zf={1:"var(--volter-content-primary)",2:"var(--volter-content-muted)",3:"var(--volter-content-dim)"},kyn="var(--volter-accent)",Ayn="var(--volter-accent-muted)",Dyn={background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},C_e="var(--volter-danger)",Pyn="var(--volter-warn)",Iyn="var(--volter-success)",Nyn="var(--volter-success-muted)",Oyn="var(--volter-danger-muted)",Ryn="var(--volter-warn-muted)",Fyn="var(--volter-danger-faint)",Myn="var(--volter-scrim)",jyn="var(--volter-dynamic)",Lyn="var(--volter-dynamic-muted)",R_={1:2,2:4,3:6,4:8,5:10,6:12,8:16,10:20,12:24},Q3t={commandBar:36,panelHeader:30,localToolbar:28,treeRow:24,treeIndent:14,statusBar:36,toolSize:34,toolWidth:38,toolGap:7,areaSeam:1,areaEmboss:0},gBe=["solid","clay","unlit","wireframe","matcap","normals","overdraw","preview","rendered"];function Qb(t){return t===void 0?"":`${t}`}function Zp(t){return{control:{...zTr,...t.density?.control},font:{...UTr,...t.density?.font},icon:{...VTr,...t.density?.icon},chrome:{...Q3t,...t.density?.chrome}}}const zTr={compact:20,default:24,comfortable:28},E5e={resting:1,active:2},VTr={xs:9,sm:10,md:12,lg:13,xl:14,"2xl":16},UTr={xs:9,sm:10,base:11,md:12,lg:13,xl:14,"2xl":16,heading:24},E_e={regular:400,semibold:600,bold:700},Epe={tight:1,snug:1.2,normal:1.4,relaxed:1.5},NG={duration:{fast:140,base:180,slow:300},easing:{standard:"cubic-bezier(0.32, 0.72, 0.28, 1)",out:"ease-out"}},Byn="var(--volter-font-sans)",$yn="var(--volter-font-mono)",qI={small:"3px",medium:"6px",large:"8px",full:"9999px"},sQ={sm:"var(--volter-radius-sm)",md:"var(--volter-radius-md)",lg:"var(--volter-radius-lg)",full:"var(--volter-radius-full)"},qyn={sm:"var(--volter-shadow-sm)",md:"var(--volter-shadow-md)",lg:"var(--volter-shadow-lg)"},YY={xs:"var(--volter-font-xs)",sm:"var(--volter-font-sm)",base:"var(--volter-font-base)",md:"var(--volter-font-md)",lg:"var(--volter-font-lg)",xl:"var(--volter-font-xl)","2xl":"var(--volter-font-2xl)",heading:"var(--volter-font-heading)"},G0={1:"var(--volter-space-1)",2:"var(--volter-space-2)",3:"var(--volter-space-3)",4:"var(--volter-space-4)",5:"var(--volter-space-5)",6:"var(--volter-space-6)",8:"var(--volter-space-8)",10:"var(--volter-space-10)",12:"var(--volter-space-12)"},Aht={tight:"var(--volter-leading-tight)",snug:"var(--volter-leading-snug)",normal:"var(--volter-leading-normal)",relaxed:"var(--volter-leading-relaxed)"},zyn={duration:{fast:"var(--volter-duration-fast)",base:"var(--volter-duration-base)",slow:"var(--volter-duration-slow)"},easing:{standard:"var(--volter-ease-standard)",out:"var(--volter-ease-out)"}},Vyn="var(--volter-focus-ring)",JTr=["outliner","properties"],Lye=Object.keys({object:!0,modifier:!0,material:!0,tool:!0,operator:!0,data:!0,scene:!0,collection:!0,select:!0}),i$={id:"graphite-dark",color:{surface:{shell:IG[0],panel:IG[1],chrome:IG[2],raised:IG[3],inset:IG.inset,overlay:"rgba(36,36,36,0.94)"},boundary:{default:kht[1],strong:kht[2]},content:{primary:xB[1],muted:xB[2],dim:xB[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:$Tr,muted:qTr},semantic:{danger:z3t,dangerMuted:W3t,dangerFaint:G3t,warning:V3t,warningMuted:H3t,success:U3t,successMuted:J3t,dynamic:X3t,dynamicMuted:Y3t,instance:Z3t},neutralOverlay:{hover:"rgba(255,255,255,0.08)",active:"rgba(255,255,255,0.14)"},scrim:K3t},typography:{sans:Mye,mono:jye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:C5e.sm,medium:C5e.md,large:C5e.lg}},WTr={...i$,id:"graphite-neutral",color:{...i$.color,content:{primary:T5e[1],muted:T5e[2],dim:T5e[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:_Be,muted:mBe}}},HTr={id:"midnight-high-contrast",color:{surface:{shell:"#0b0f14",panel:"#111821",chrome:"#17212c",raised:"#223040",inset:"#080c11",overlay:"rgba(17,24,33,0.96)"},boundary:{default:"#34465a",strong:"#71869d"},content:{primary:"#f2f5f8",muted:"#bdc8d5",dim:"#8493a5",onAccent:"#071019",onBright:{primary:"#071019",muted:"rgba(7,16,25,0.82)",dim:"rgba(7,16,25,0.72)"}},accent:{default:"#65d1ff",muted:"rgba(101,209,255,0.18)"},semantic:{danger:"#ff7b86",dangerMuted:"rgba(255,123,134,0.18)",dangerFaint:"rgba(255,123,134,0.08)",warning:"#f3c969",warningMuted:"rgba(243,201,105,0.16)",success:"#62d394",successMuted:"rgba(98,211,148,0.18)",dynamic:"#e889ff",dynamicMuted:"rgba(232,137,255,0.12)",instance:"#a49bff"},neutralOverlay:{hover:"rgba(255,255,255,0.10)",active:"rgba(255,255,255,0.18)"},scrim:"rgba(0,0,0,0.68)"},typography:{sans:Mye,mono:jye},shape:{small:"3px",medium:"6px",large:"8px",full:"9999px"},elevation:{small:"0 2px 8px rgba(0,0,0,0.72)",medium:"0 6px 18px rgba(0,0,0,0.68)",large:"0 12px 40px rgba(0,0,0,0.76)"}},ERe={id:"glass-dark",appearance:{material:"glass",transparency:"standard"},color:{surface:{shell:"rgba(26,26,26,0.88)",panel:"rgba(36,36,36,0.62)",chrome:"rgba(44,44,44,0.68)",raised:"rgba(51,51,51,0.74)",inset:"rgba(30,30,30,0.7)",overlay:"rgba(36,36,36,0.55)"},boundary:{default:"rgba(255,255,255,0.14)",strong:"rgba(255,255,255,0.24)"},content:{primary:xB[1],muted:xB[2],dim:xB[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:_Be,muted:mBe},semantic:{danger:z3t,dangerMuted:W3t,dangerFaint:G3t,warning:V3t,warningMuted:H3t,success:U3t,successMuted:J3t,dynamic:X3t,dynamicMuted:Y3t,instance:Z3t},neutralOverlay:{hover:"color-mix(in srgb, currentColor 9%, transparent)",active:"color-mix(in srgb, currentColor 14%, transparent)"},scrim:"rgba(0,0,0,0.35)"},typography:{sans:Mye,mono:jye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:"0 4px 16px rgba(0,0,0,0.55)",medium:"0 8px 28px rgba(0,0,0,0.5)",large:"0 16px 48px rgba(0,0,0,0.55)"},treatment:{backdropBlurPx:14,backdropSaturation:1.3,backdropBrightness:.5,edgeSpecular:.6,specularAngleDeg:120,thickness:.5}},GTr=(()=>{const{treatment:t,...n}=ERe;return{...n,id:"glass-dark-lite",appearance:{material:"glass",transparency:"reduced"},color:{...ERe.color,surface:{shell:"#1a1a1a",panel:"#222222",chrome:"#292929",raised:"#303030",inset:"#1d1d1d",overlay:"#202020"},scrim:K3t}}})(),kRe={id:"liquid-glass",appearance:{material:"glass",transparency:"standard"},color:{surface:{shell:Ym.color.surface.shell,panel:Ym.color.surface.panel,chrome:Ym.color.surface.chrome,raised:Ym.color.surface.raised,inset:Ym.color.surface.inset,overlay:Ym.color.surface.overlay},boundary:Ym.color.boundary,content:{primary:"#f2f6fb",muted:"rgba(242,246,251,0.85)",dim:"rgba(242,246,251,0.68)",onAccent:"#0b1526",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:_Be,muted:mBe},semantic:{danger:"#ff7b86",dangerMuted:"rgba(255,123,134,0.22)",dangerFaint:"rgba(255,123,134,0.10)",warning:"#ffd35f",warningMuted:"rgba(255,211,95,0.18)",success:"#58e078",successMuted:"rgba(88,224,120,0.20)",dynamic:"#ff8fd8",dynamicMuted:"rgba(255,143,216,0.14)",instance:"#3ad2ea"},neutralOverlay:Ym.color.neutralOverlay,scrim:Ym.color.scrim},typography:{sans:Mye,mono:jye},shape:Ym.shape,elevation:Ym.elevation,treatment:Ym.treatment},KTr=(()=>{const{treatment:t,...n}=kRe;return{...n,id:"liquid-glass-lite",appearance:{material:"glass",transparency:"reduced"},color:{...kRe.color,surface:Ym.reducedTransparency.surface,scrim:Ym.reducedTransparency.scrim}}})(),e4t={"graphite-dark":i$,"graphite-neutral":WTr,"midnight-high-contrast":HTr,"glass-dark":ERe,"glass-dark-lite":GTr,"liquid-glass":kRe,"liquid-glass-lite":KTr};function XTr(t){return typeof t=="string"&&Object.hasOwn(e4t,t)}const Go={surface:{shell:"var(--volter-surface-shell)",panel:"var(--volter-surface-panel)",chrome:"var(--volter-surface-chrome)",raised:"var(--volter-surface-raised)",inset:"var(--volter-surface-inset)",overlay:"var(--volter-surface-overlay)"},boundary:{default:"var(--volter-boundary-default)",strong:"var(--volter-boundary-strong)"},content:{primary:"var(--volter-content-primary)",muted:"var(--volter-content-muted)",dim:"var(--volter-content-dim)",onAccent:"var(--volter-content-on-accent)",active:"var(--volter-content-active)",selected:"var(--volter-content-selected)"},accent:{default:"var(--volter-accent)",muted:"var(--volter-accent-muted)"},selection:{background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},semantic:{danger:"var(--volter-danger)",dangerMuted:"var(--volter-danger-muted)",dangerFaint:"var(--volter-danger-faint)",warning:"var(--volter-warn)",warningMuted:"var(--volter-warn-muted)",success:"var(--volter-success)",successMuted:"var(--volter-success-muted)",dynamic:"var(--volter-dynamic)",dynamicMuted:"var(--volter-dynamic-muted)",instance:"var(--volter-instance)"},neutralOverlay:{hover:"var(--volter-neutral-hover)",active:"var(--volter-neutral-active)"},scrim:"var(--volter-scrim)",typography:{sans:"var(--volter-font-sans)",mono:"var(--volter-font-mono)"},shape:{small:"var(--volter-radius-sm)",medium:"var(--volter-radius-md)",large:"var(--volter-radius-lg)",full:"var(--volter-radius-full)"},elevation:{small:"var(--volter-shadow-sm)",medium:"var(--volter-shadow-md)",large:"var(--volter-shadow-lg)"},focusRing:"var(--volter-focus-ring)"};function YTr(t){const n=`<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1L5 5L9 1' stroke='${t}' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(n)}")`}function ZTr(t){if(!t)return"none";const n=[];return t.backdropBlurPx&&n.push(`blur(${t.backdropBlurPx}px)`),t.backdropSaturation!==void 0&&t.backdropSaturation!==1&&n.push(`saturate(${t.backdropSaturation})`),t.backdropBrightness!==void 0&&t.backdropBrightness!==1&&n.push(`brightness(${t.backdropBrightness})`),n.length>0?n.join(" "):"none"}function Dht(t,n){return n?"transparent":`linear-gradient(var(${t}), var(${t})), linear-gradient(var(--volter-surface-shell), var(--volter-surface-shell))`}function Pht(t){const n=t?.contentFrostBlurPx??0;if(n<=0)return"none";const s=[`blur(${n}px)`];return t?.backdropSaturation!==void 0&&t.backdropSaturation!==1&&s.push(`saturate(${t.backdropSaturation})`),s.join(" ")}function ARe(t){return(t?.contentFrostBlurPx??0)>0?"rgba(255,255,255,0.10)":"transparent"}function QTr(t){return t?"color-mix(in srgb, currentColor 7%, transparent)":"var(--volter-widget-field)"}function eCr(t){return t?"color-mix(in srgb, currentColor 26%, transparent)":"var(--volter-boundary-default)"}function tCr(t,n){const d=[n==="none"?"":n,t?"inset 0 1px 0 color-mix(in srgb, currentColor 14%, transparent), 0 5px 14px -12px color-mix(in srgb, currentColor 55%, transparent)":""].filter(Boolean);return d.length===0?"none":d.join(", ")}const rCr=.6,nCr=.5;function ihe(t,n){return`rgba(255,255,255,${Math.min(1,Number((t*n/rCr).toFixed(3)))})`}function t4t(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>ihe(d,n);return`linear-gradient(${s}deg, ${c(.95)} 0%, ${c(.38)} 16%, ${c(.16)} 40%, ${c(.14)} 60%, ${c(.45)} 84%, ${c(.85)} 100%)`}function iCr(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>ihe(d,n);return`linear-gradient(${s}deg, ${c(.16)} 0%, ${c(.05)} 24%, transparent 40%)`}function oCr(t){const n=t?.edgeSpecular??0,s=t?.thickness??0,c=[];if(n>0&&(c.push(`inset 0 1px 1px ${ihe(.28,n)}`),c.push(`inset 0 -1px 1px ${ihe(.1,n)}`)),s>0){const d=m=>`${Number((m*s/nCr).toFixed(1))}px`;c.push(`inset 0 ${d(12)} ${d(24)} ${d(-14)} rgba(255,255,255,0.35)`),c.push(`inset 0 ${d(-14)} ${d(28)} ${d(-18)} rgba(0,0,0,0.55)`),c.push(`0 ${d(18)} ${d(40)} ${d(-18)} rgba(0,0,0,0.55)`)}else c.push("var(--volter-shadow-lg)");return c.join(", ")}function q$(t){return t.appearance?t.appearance.material==="glass":t.treatment!==void 0}function sCr(t){return q$(t)?"var(--volter-surface-panel)":"color-mix(in srgb, var(--volter-surface-panel) 90%, transparent)"}function aCr(t){return q$(t)?t.treatment?"var(--volter-surface-backdrop-filter)":"none":"blur(8px)"}function cCr(t){return t?"17px":"var(--volter-radius-md)"}function lCr(t){return t?"var(--volter-boundary-default)":"var(--volter-boundary-strong)"}function uCr(t){return t?"var(--volter-shadow-lg)":"var(--volter-shadow-sm)"}function fCr(t,n){const s=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t.color.accent.default);if(!s)return null;const[c,d,m]=[s[1],s[2],s[3]].map(g=>Number.parseInt(g,16));return`rgba(${c},${d},${m},${n})`}function Bye(t){return q$(t)}function dCr(t){return Bye(t)?"var(--volter-neutral-active)":"var(--volter-accent-muted)"}function r4t(t){const n=t.trim().toLowerCase();if(n.startsWith("#"))return n.length===5?n.endsWith("f"):n.length===9?n.endsWith("ff"):!0;const s=/^rgba?\(([^)]*)\)$/.exec(n)??/^hsla?\(([^)]*)\)$/.exec(n);if(s){const c=(s[1]??"").split(/[,/]/)[3];return c===void 0||Number.parseFloat(c)>=1}return n!=="transparent"&&!n.includes("transparent")}function n4t(t){if(!r4t(t))return!1;const n=t.trim().toLowerCase();let s=null;const c=/^#([0-9a-f]{3}|[0-9a-f]{6})(?:f|ff)?$/.exec(n);if(c){const S=c[1].length===3?[...c[1]].map(k=>k+k).join(""):c[1];s=[0,2,4].map(k=>Number.parseInt(S.slice(k,k+2),16))}else{const S=/^rgba?\(([^)]*)\)$/.exec(n);S&&(s=(S[1]??"").split(/[,\s/]+/).filter(Boolean).slice(0,3).map(k=>k.endsWith("%")?Number.parseFloat(k)*2.55:Number.parseFloat(k)))}if(!s||s.some(S=>!Number.isFinite(S)))return!1;const[d,m,g]=s;return(.2126*d+.7152*m+.0722*g)/255>.5}function pCr(t){return Bye(t)?"var(--volter-content-primary)":r4t(t.color.accent.muted)?"var(--volter-content-on-accent)":"var(--volter-content-primary)"}function _Cr(t){return Bye(t)?"color-mix(in srgb, currentColor 30%, transparent)":n4t(t.color.surface.panel)?`rgb(from ${t.color.accent.muted} r g b / 1)`:"var(--volter-accent)"}function mCr(t){return Bye(t)?"color-mix(in srgb, currentColor 76%, transparent)":"var(--volter-accent)"}function hCr(t){return t?"var(--volter-radius-full)":"var(--volter-radius-sm)"}function gCr(t){return!q$(t)||!t.treatment?"var(--volter-accent)":fCr(t,.82)??"var(--volter-accent)"}function yCr(t){const n=t?.edgeSpecular??0;return n<=0?"none":t4t({...t,edgeSpecular:n*.4})}function vCr(t){const n=t?.ambientLiftOpacity??0;if(n<=0)return"none";const s=Number(n.toFixed(3)),c=Number((n*.35).toFixed(3));return`linear-gradient(165deg, rgba(255,255,255,${s}) 0%, rgba(255,255,255,${c}) 55%, rgba(255,255,255,0) 100%)`}function i4t(t){return t<=0?"none":`0 1px 2px rgba(0,0,0,${Number(t.toFixed(3))})`}function o4t(t){return i4t(t?.textShadowOpacity??0)}function bCr(t){return t.treatment?.adaptiveContent?{primary:t.color.content.onBright.primary,muted:t.color.content.onBright.muted,dim:t.color.content.onBright.dim,textShadow:i4t(t.treatment.brightTextShadowOpacity??0),frostBg:t.treatment.brightFrostBg??ARe(t.treatment)}:{primary:t.color.content.primary,muted:t.color.content.muted,dim:t.color.content.dim,textShadow:o4t(t.treatment),frostBg:ARe(t.treatment)}}function SCr(t){return t.treatment?t.treatment.adaptiveContent?"rgba(255,255,255,0.9)":wCr(t.color.surface.chrome,.9):t.color.surface.chrome}function xCr(t){return t.color.surface.panel}function wCr(t,n){const s=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([0-9.]+)\s*\)$/.exec(t);if(!s)return t;const c=Math.max(Number(s[4]),n);return`rgba(${s[1]},${s[2]},${s[3]},${c})`}function Iht(t){if(!t)return"none";const s=[`blur(${Math.max(16,t.contentFrostBlurPx??0)}px)`];return t.backdropSaturation!==void 0&&t.backdropSaturation!==1&&s.push(`saturate(${t.backdropSaturation})`),s.join(" ")}function TCr(t){return t.color.boundary.area??t.color.boundary.default}function CCr(t,n){return`color-mix(in srgb, ${t} 98.4%, ${n})`}function OG(t){return`color-mix(in srgb, var(--volter-area-emboss-mix), ${t})`}function ECr(t){const n=Zp(t).chrome.areaEmboss;return n>0?`#ffffff ${n}%`:"transparent 100%"}function kCr(t){const n=bCr(t),s=q$(t),c=t.color.widget?.regular??t.color.surface.raised,d=t.color.widget?.menu??t.color.surface.raised,m=t.color.widget?.field??t.color.surface.inset,g=t.color.widget?.emboss?`0 1px 0 ${t.color.widget.emboss}`:"none",S=A=>`color-mix(in srgb, ${A} 87.8%, ${t.color.content.primary})`,k=`color-mix(in srgb, ${t.color.surface.panel} 86.5%, ${t.color.surface.raised})`;return{"--volter-surface-shell":t.color.surface.shell,"--volter-surface-panel":t.color.surface.panel,"--volter-surface-chrome":t.color.surface.chrome,"--volter-surface-raised":t.color.surface.raised,"--volter-surface-inset":t.color.surface.inset,"--volter-surface-overlay":t.color.surface.overlay,"--volter-surface-backdrop-filter":ZTr(t.treatment),"--volter-surface-sticky":Dht("--volter-surface-chrome",s),"--volter-surface-sticky-panel":Dht("--volter-surface-panel",s),"--volter-surface-sticky-backdrop-filter":"none","--volter-surface-body-frost-filter":Pht(t.treatment),"--volter-content-frost-filter":Pht(t.treatment),"--volter-content-frost-bg":ARe(t.treatment),"--volter-input-surface":QTr(s),"--volter-input-border":eCr(s),"--volter-input-shadow":tCr(s,g),"--volter-structural-divider":s?"transparent":t.color.boundary.default,"--volter-card-specular-ring":t4t(t.treatment),"--volter-card-specular-sheen":iCr(t.treatment),"--volter-card-specular-shadow":oCr(t.treatment),"--volter-card-refraction-thickness":String(t.treatment?.refractionThickness??0),"--volter-card-refraction-bezel":String(t.treatment?.refractionBezelPx??28),"--volter-card-refraction-angle":String(t.treatment?.specularAngleDeg??120),"--volter-ambient-lift":vCr(t.treatment),"--volter-island-surface":sCr(t),"--volter-island-backdrop-filter":aCr(t),"--volter-island-radius":cCr(s),"--volter-island-border-color":lCr(s),"--volter-island-shadow":uCr(s),"--volter-island-specular-ring":yCr(t.treatment),"--volter-selection-bg":dCr(t),"--volter-content-on-selection":pCr(t),"--volter-selection-border":_Cr(t),"--volter-selection-indicator":mCr(t),"--volter-island-control-radius":hCr(s),"--volter-island-primary-bg":gCr(t),"--volter-content-text-shadow":o4t(t.treatment),"--volter-content-primary-on-bright":n.primary,"--volter-content-muted-on-bright":n.muted,"--volter-content-dim-on-bright":n.dim,"--volter-content-text-shadow-on-bright":n.textShadow,"--volter-content-frost-bg-on-bright":n.frostBg,"--volter-content-adaptive":t.treatment?.adaptiveContent?"1":"0","--volter-glass-regular-bg":SCr(t),"--volter-glass-regular-backdrop-filter":Iht(t.treatment),"--volter-glass-regular-panel-bg":xCr(t),"--volter-glass-regular-panel-backdrop-filter":Iht(t.treatment),"--volter-glass-dark-frost-panel-bg":"rgba(5,8,13,0.74)","--volter-glass-dark-frost-content-bg":"rgba(5,8,13,0.84)","--volter-scrim-backdrop-filter":t.treatment?"blur(8px)":"none","--volter-boundary-default":t.color.boundary.default,"--volter-boundary-strong":t.color.boundary.strong,"--volter-boundary-area":TCr(t),"--volter-tree-indent-guide":t.color.boundary.indent??"transparent","--volter-boundary-divider":t.color.boundary.divider??t.color.boundary.default,"--volter-area-emboss-mix":ECr(t),"--volter-area-emboss":OG(t.color.surface.panel),"--volter-area-emboss-stage":OG(OG(t.color.viewport?.background??t.color.surface.panel)),"--volter-area-emboss-stage-header":OG(OG(k)),"--volter-content-primary":t.color.content.primary,"--volter-content-muted":t.color.content.muted,"--volter-content-dim":t.color.content.dim,"--volter-content-on-accent":t.color.content.onAccent,"--volter-content-menu":t.color.content.menu??t.color.content.primary,"--volter-content-status":t.color.content.status??t.color.content.dim,"--volter-content-placeholder":t.color.content.placeholder??t.color.content.dim,"--volter-content-active":t.color.content.active??"","--volter-content-selected":t.color.content.selected??t.color.content.active??"","--volter-accent":t.color.accent.default,"--volter-accent-muted":t.color.accent.muted,"--volter-danger":t.color.semantic.danger,"--volter-danger-muted":t.color.semantic.dangerMuted,"--volter-danger-faint":t.color.semantic.dangerFaint,"--volter-warn":t.color.semantic.warning,"--volter-warn-muted":t.color.semantic.warningMuted,"--volter-success":t.color.semantic.success,"--volter-success-muted":t.color.semantic.successMuted,"--volter-dynamic":t.color.semantic.dynamic,"--volter-dynamic-muted":t.color.semantic.dynamicMuted,"--volter-instance":t.color.semantic.instance,"--volter-neutral-hover":t.color.neutralOverlay.hover,"--volter-neutral-active":t.color.neutralOverlay.active,"--volter-scrim":t.color.scrim,"--volter-surface-section":`color-mix(in srgb, ${t.color.surface.panel} 64.9%, ${t.color.surface.raised})`,"--volter-surface-section-edge":`color-mix(in srgb, ${t.color.surface.panel} 29.7%, ${t.color.surface.raised})`,"--volter-surface-header":k,"--volter-surface-row-alt":CCr(t.color.surface.panel,t.color.content.primary),...n4t(t.color.surface.panel)?{"--volter-tree-row-selected-bg":t.color.accent.muted,"--volter-tree-row-active-bg":`rgb(from ${t.color.accent.muted} r g b / 1)`,"--volter-tree-row-active-border":`rgb(from ${t.color.accent.muted} r g b / 1)`,"--volter-tree-datablock-fill":"color-mix(in srgb, var(--volter-category-data, currentColor) 14%, transparent)","--volter-tree-datablock-border":"color-mix(in srgb, var(--volter-content-primary) 14%, transparent)"}:{"--volter-tree-row-selected-bg":`color-mix(in srgb, ${t.color.accent.default} 42%, #000)`,"--volter-tree-row-active-bg":`color-mix(in srgb, ${t.color.accent.default} 70%, #000)`,"--volter-tree-row-active-border":"rgb(from var(--volter-tree-row-active-bg) calc(r + 40) calc(g + 40) calc(b + 40))","--volter-tree-datablock-fill":"color-mix(in srgb, color-mix(in srgb, var(--volter-category-data, currentColor) 60%, black) 26%, transparent)","--volter-tree-datablock-border":"color-mix(in srgb, var(--volter-content-primary) 24%, transparent)"},"--volter-tree-active-name-underline":t.color.content.active?"none":"underline","--volter-viewport-background":t.color.viewport?.background??"","--volter-viewport-grid":t.color.viewport?.grid??"","--volter-viewport-axis-x":t.color.viewport?.axisX??"","--volter-viewport-axis-y":t.color.viewport?.axisY??"","--volter-viewport-axis-z":t.color.viewport?.axisZ??"","--volter-viewport-wire":t.color.viewport?.wire??"","--volter-viewport-wire-opacity":Qb(t.stage?.wireOpacity),"--volter-viewport-axis-line-width":Qb(t.stage?.axisLineWidth),"--volter-viewport-selection":t.color.viewport?.selection??"","--volter-viewport-active":t.color.viewport?.active??"","--volter-gizmo-x":t.color.gizmo?.x??"","--volter-gizmo-y":t.color.gizmo?.y??"","--volter-gizmo-z":t.color.gizmo?.z??"","--volter-gizmo-navigation-x":t.color.gizmo?.navigationX??"","--volter-gizmo-navigation-y":t.color.gizmo?.navigationY??"","--volter-gizmo-navigation-z":t.color.gizmo?.navigationZ??"","--volter-gizmo-hover":t.color.gizmo?.hover??"","--volter-gizmo-drag":t.color.gizmo?.drag??"","--volter-viewport-gizmo-opacity":Qb(t.stage?.gizmoOpacity),"--volter-viewport-gizmo-arrow-length":Qb(t.stage?.gizmoArrowLength),"--volter-viewport-gizmo-arrow-head":Qb(t.stage?.gizmoArrowHead),"--volter-viewport-gizmo-ring-width":Qb(t.stage?.gizmoRingWidth),"--volter-viewport-navigation-gizmo":t.stage?.navigationGizmo??"","--volter-viewport-navigation-corner":t.stage?.navigationCorner??"","--volter-viewport-navigation-size":Qb(t.stage?.navigationSize),"--volter-viewport-gizmo-highlight-saturation":Qb(t.stage?.gizmoHighlightSaturation),"--volter-viewport-gizmo-highlight-value":Qb(t.stage?.gizmoHighlightValue),"--volter-viewport-gizmo-size":t.stage?.gizmoSize===void 0?"":`${t.stage.gizmoSize}`,"--volter-viewport-grid-line-width":Qb(t.stage?.gridLineWidth),"--volter-viewport-grid-major-width":Qb(t.stage?.gridMajorWidth),"--volter-viewport-grid-major-contrast":Qb(t.stage?.gridMajorContrast),"--volter-viewport-selection-box":t.stage?.selectionBox??"","--volter-viewport-selection-box-frame":t.stage?.selectionBoxFrame??"","--volter-viewport-outline-style":t.stage?.outlineStyle??"","--volter-viewport-outline-width":Qb(t.stage?.outlineWidth),"--volter-viewport-outline-hidden":t.stage?.outlineHidden===void 0?"":`${t.stage.outlineHidden}`,"--volter-viewport-selection-box-width":Qb(t.stage?.selectionBoxWidth),"--volter-viewport-chrome-bar":t.stage?.chrome?.bar??"","--volter-viewport-chrome-view-name":t.stage?.chrome?.viewName??"","--volter-viewport-chrome-tools":t.stage?.chrome?.tools??"","--volter-viewport-chrome-display":t.stage?.chrome?.display??"","--volter-viewport-chrome-transform-controls":t.stage?.chrome?.transformControls??"",...Object.fromEntries(gBe.map(A=>[`--volter-viewport-word-${A}`,t.stage?.words?.shading?.[A]??""])),"--volter-viewport-word-helpers":t.stage?.words?.helpers??"","--volter-widget-regular":c,"--volter-widget-regular-hover":S(c),"--volter-widget-menu":d,"--volter-widget-menu-hover":S(d),"--volter-widget-field":m,"--volter-widget-emboss-shadow":g,...Object.fromEntries(Lye.map(A=>[`--volter-category-${A}`,t.color.category?.[A]??"currentColor"])),"--volter-region-outliner":t.color.region?.outliner??t.color.surface.panel,"--volter-region-outliner-header":t.color.region?.outliner??t.color.surface.chrome,"--volter-region-properties":t.color.region?.properties??t.color.surface.panel,"--volter-region-properties-header":t.color.region?.properties??t.color.surface.chrome,"--volter-font-sans":t.typography.sans,"--volter-font-mono":t.typography.mono,"--volter-radius-sm":t.shape.small,"--volter-radius-md":t.shape.medium,"--volter-radius-lg":t.shape.large,"--volter-radius-full":t.shape.full,"--volter-shadow-sm":t.elevation.small,"--volter-shadow-md":t.elevation.medium,"--volter-shadow-lg":t.elevation.large,"--volter-focus-ring":`${E5e.active}px solid ${t.color.accent.default}`,"--volter-select-chevron":YTr(t.color.content.muted),"--volter-space-1":`${R_[1]}px`,"--volter-space-2":`${R_[2]}px`,"--volter-space-3":`${R_[3]}px`,"--volter-space-4":`${R_[4]}px`,"--volter-space-5":`${R_[5]}px`,"--volter-space-6":`${R_[6]}px`,"--volter-space-8":`${R_[8]}px`,"--volter-space-10":`${R_[10]}px`,"--volter-space-12":`${R_[12]}px`,"--volter-command-bar-height":`${Zp(t).chrome.commandBar}px`,"--volter-panel-header-height":`${Zp(t).chrome.panelHeader}px`,"--volter-local-toolbar-height":`${Zp(t).chrome.localToolbar}px`,"--volter-tree-row-height":`${Zp(t).chrome.treeRow}px`,"--volter-tree-indent":`${Zp(t).chrome.treeIndent}px`,"--volter-status-bar-height":`${Zp(t).chrome.statusBar}px`,"--volter-tool-size":`${Zp(t).chrome.toolSize}px`,"--volter-tool-width":`${Zp(t).chrome.toolWidth}px`,"--volter-tool-gap":`${Zp(t).chrome.toolGap}px`,"--volter-area-seam-width":`${Zp(t).chrome.areaSeam}px`,"--volter-control-compact-height":`${Zp(t).control.compact}px`,"--volter-control-default-height":`${Zp(t).control.default}px`,"--volter-control-comfortable-height":`${Zp(t).control.comfortable}px`,"--volter-stroke-resting":`${E5e.resting}px`,"--volter-stroke-active":`${E5e.active}px`,"--volter-font-xs":`${Zp(t).font.xs}px`,"--volter-font-sm":`${Zp(t).font.sm}px`,"--volter-font-base":`${Zp(t).font.base}px`,"--volter-font-md":`${Zp(t).font.md}px`,"--volter-font-lg":`${Zp(t).font.lg}px`,"--volter-font-xl":`${Zp(t).font.xl}px`,"--volter-font-2xl":`${Zp(t).font["2xl"]}px`,"--volter-icon-xs":`${Zp(t).icon.xs}px`,"--volter-icon-sm":`${Zp(t).icon.sm}px`,"--volter-icon-md":`${Zp(t).icon.md}px`,"--volter-icon-lg":`${Zp(t).icon.lg}px`,"--volter-icon-xl":`${Zp(t).icon.xl}px`,"--volter-icon-2xl":`${Zp(t).icon["2xl"]}px`,"--volter-font-heading":`${Zp(t).font.heading}px`,"--volter-font-weight-regular":String(E_e.regular),"--volter-font-weight-semibold":String(E_e.semibold),"--volter-font-weight-bold":String(E_e.bold),"--volter-leading-tight":String(Epe.tight),"--volter-leading-snug":String(Epe.snug),"--volter-leading-normal":String(Epe.normal),"--volter-leading-relaxed":String(Epe.relaxed),"--volter-duration-fast":`${NG.duration.fast}ms`,"--volter-duration-base":`${NG.duration.base}ms`,"--volter-duration-slow":`${NG.duration.slow}ms`,"--volter-ease-standard":NG.easing.standard,"--volter-ease-out":NG.easing.out,"--volter-z-base":String(PI.base),"--volter-z-overlay-low":String(PI.overlayLow),"--volter-z-sticky":String(PI.sticky),"--volter-z-dropdown":String(PI.dropdown),"--volter-z-toast":String(PI.toast),"--volter-z-modal":String(PI.modal)}}const DRe="volter-editor-theme";function ACr(t,n=i$){t.classList.add(DRe),t.dataset.volterTheme=n.id,t.dataset.volterChrome=q$(n)?"islands":"bars";for(const[s,c]of Object.entries(kCr(n)))t.style.setProperty(s,c)}const Uyn={bg:Go.semantic.dangerFaint,border:Go.semantic.danger,fg:Go.semantic.danger},Jyn={bg:Go.semantic.warningMuted,border:Go.semantic.warning,fg:Go.semantic.warning},s4t=Ye.createContext(null);function DCr(){return Ye.useContext(s4t)}function DR(t,n){return n?`${t} ${n}`:t}const Zm=Ye.forwardRef(function({className:n,type:s="text",...c},d){return $.jsx("input",{...c,ref:d,type:s,className:DR("volter-input",n)})}),Iw=Ye.forwardRef(function({className:n,...s},c){return $.jsx("select",{...s,ref:c,className:DR("volter-select",n)})}),yBe=Ye.forwardRef(function({className:n,...s},c){return $.jsx("textarea",{...s,ref:c,className:DR("volter-input volter-textarea",n)})}),TD=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"checkbox",className:DR("volter-checkbox",n)})}),a4t=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"color",className:DR("volter-color-swatch",n)})}),Wyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"file",className:DR("volter-file-input",n)})}),Hyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"range",className:DR("volter-range",n)})}),gC="default",PCr={id:gC,title:"Editor"},wB=new Map;let ohe=null,aQ=gC;const PRe=new Set;function IRe(){for(const t of PRe)t()}function Gyn(){return ohe??=[PCr,...[...wB.values()].map(({id:t,title:n})=>({id:t,title:n}))],ohe}function yee(t){return typeof t=="string"&&(t===gC||wB.has(t))}function ICr(t){if(yee(t.id))throw new Error(`registerContributedIconSet: icon set "${t.id}" is already registered.`);return wB.set(t.id,t),ohe=null,IRe(),()=>{wB.get(t.id)===t&&(wB.delete(t.id),ohe=null,IRe())}}function she(){return aQ}function ahe(t){const n=yee(t)?t:gC;n!==aQ&&(aQ=n,IRe())}function vBe(t){return PRe.add(t),()=>PRe.delete(t)}function c4t(t){return aQ===gC?null:wB.get(aQ)?.glyphs[t]??null}const Nht={xs:"var(--volter-icon-xs)",sm:"var(--volter-icon-sm)",md:"var(--volter-icon-md)",lg:"var(--volter-icon-lg)",xl:"var(--volter-icon-xl)","2xl":"var(--volter-icon-2xl)"},Oht={current:void 0,primary:Go.content.primary,muted:Go.content.muted,dim:Go.content.dim,accent:Go.accent.default,danger:Go.semantic.danger};function dc({icon:t,size:n="sm",tone:s="current",label:c,className:d,style:m,spin:g=!1,...S}){Ye.useSyncExternalStore(vBe,she,she);const k=c4t(t.iconName);if(k){const A=s!=="current",F=k.tone?`var(--volter-category-${k.tone}, currentColor)`:void 0,D=A?Oht[s]:k.tonedPath?void 0:F,J=A?"currentColor":F??"currentColor";return $.jsxs("svg",{...S,viewBox:k.viewBox??"0 0 16 16","data-volter-tone":A?void 0:k.tone,className:d,"aria-hidden":c?void 0:S["aria-hidden"]??"true","aria-label":c,role:c?"img":void 0,style:{width:"1.25em",height:"1em",overflow:"visible",verticalAlign:"-0.125em",fontSize:Nht[n],color:D,...m},children:[$.jsx("path",{d:k.path,fill:"currentColor"}),k.tonedPath?$.jsx("path",{d:k.tonedPath,fill:J}):null]})}return $.jsx(Xyr,{...S,icon:t,fixedWidth:!0,spin:g,className:d,"aria-hidden":c?void 0:S["aria-hidden"]??"true","aria-label":c,role:c?"img":void 0,style:{fontSize:Nht[n],color:Oht[s],...m}})}function l4t({direction:t,size:n="xs",tone:s="current",style:c}){return $.jsx(dc,{icon:t==="right"?ITt:JTt,size:n,tone:s,...c?{style:c}:{}})}function Kyn({direction:t,size:n="xs",tone:s="current"}){return $.jsx(dc,{icon:t==="right"?ETt:iLe,size:n,tone:s})}function fy(t,n){return{...n,iconName:t}}const Kk={action:{add:GTt,close:rLe,delete:ATt,search:kTt,refresh:G0r,undo:LOe,redo:Cmt,build:V0r,export:H0r,select:Emt},transport:{play:A0r,pause:J0r,restart:Cmt,stop:DTt,step:P0r},content:{project:MOe,folder:uee,file:jTt,source:oLe,scene:aLe,entity:aR,component:GB,camera:nye,light:Qje,image:iB,audio:nLe,data:PTt,code:eLe,stateMachine:OTt},status:{success:tLe,info:R$,warning:fee,error:MTt,visible:Zje,hidden:sLe,locked:Nme,unlocked:jOe},viewport:{zoomIn:_0r,zoomOut:d0r,pan:T0r,frame:u0r,projection:fy("viewport-projection",S5e),projectionOrthographic:fy("viewport-orthographic",S5e),camera:fy("viewport-camera",Tmt),cameraView:fy("viewport-camera-view",Tmt),cameraLocked:fy("viewport-camera-locked",Nme),cameraUnlocked:fy("viewport-camera-unlocked",jOe)},modeling:{extrude:fy("mesh-extrude",RTt),inset:fy("mesh-inset",z0r),bevel:fy("mesh-bevel",K0r),loopCut:fy("mesh-loop-cut",m0r),knife:fy("mesh-knife",L0r),smooth:fy("mesh-smooth",f0r),shrinkFatten:fy("mesh-shrink-fatten",LTt),subdivide:fy("mesh-subdivide",D0r)},tool:{extension:GB,select:fy("tool-select-box",Emt),move:$Tt,rotate:CTt,scale:fy("tool-scale",g0r),transform:fy("tool-transform",C0r),snap:k0r,frame:HTt,grid:S5e,profiler:UTt},panel:{outliner:fy("outliner",XTt),properties:fy("properties",qTt),"folder-open":MOe,"cubes-stacked":BTt,users:h0r,list:vZ,"rotate-left":LOe}};function SZ({value:t,onChange:n,onChangeEnd:s,step:c=.1,precision:d=3,disabled:m=!1,label:g,labelColor:S,style:k,testId:A,title:F}){const[D,J]=Ye.useState(!1),[q,G]=Ye.useState(""),se=Ye.useRef({startX:0,startVal:0,dragging:!1,gesture:!1,lastVal:0}),pe=Ye.useRef(null),ue=DCr();Ye.useEffect(()=>{if(!D)return;const we=pe.current;we&&(we.focus(),we.select())},[D]);const Ce=t===null,Fe=t??0,De=Ce?"—":Number.isFinite(Fe)?Fe.toFixed(d):0 .toFixed(d),be=we=>{if(m)return;se.current={startX:we.clientX,startVal:Fe,dragging:!1,gesture:!1,lastVal:Fe};const Be=It=>{const Wt=It.clientX-se.current.startX;if(Math.abs(Wt)>3&&(se.current.dragging=!0),se.current.dragging){se.current.gesture||(se.current.gesture=!0,ue?.begin());const zt=se.current.startVal+Wt*c,ft=Math.round(zt/c)*c;se.current.lastVal=ft,n(ft)}},bt=()=>{window.removeEventListener("pointermove",Be),window.removeEventListener("pointerup",bt),se.current.gesture&&ue?.end(),se.current.dragging?s?.(se.current.lastVal):(J(!0),G(Ce?"":De))};window.addEventListener("pointermove",Be),window.addEventListener("pointerup",bt)},X=()=>{J(!1);const we=Number.parseFloat(q);Number.isFinite(we)&&(n(we),s?.(we))};return $.jsxs("div",{className:"volter-number-input","data-testid":A,title:F,style:k,children:[g&&$.jsx("span",{className:"volter-number-input-label",style:S?{color:S}:void 0,children:g}),D?$.jsx(Zm,{ref:pe,value:q,onChange:we=>G(we.target.value),onBlur:X,onKeyDown:we=>{we.key==="Enter"&&X(),we.key==="Escape"&&J(!1)},placeholder:Ce?"—":void 0,className:"volter-number-input-editor"}):$.jsx("div",{onPointerDown:be,className:"volter-number-input-scrub","data-mixed":Ce||void 0,"data-disabled":m||void 0,children:De})]})}const NCr={minHeight:"var(--volter-panel-header-height)",padding:`0 ${R_[4]}px`,color:Go.content.muted,fontSize:"var(--volter-font-base)",fontWeight:E_e.semibold,textTransform:"uppercase",display:"flex",alignItems:"center",gap:R_[2],userSelect:"none"},OCr={...NCr,background:"var(--volter-surface-sticky)",borderBottom:"1px solid var(--volter-structural-divider)",flexShrink:0};function $ye({name:t,actions:n,onHeaderClick:s,hideHeader:c=!1,style:d,children:m,...g}){return $.jsxs("div",{...g,style:{display:"flex",flexDirection:"column",pointerEvents:"auto",...d},children:[!c&&$.jsxs("div",{role:s?"button":void 0,tabIndex:s?0:void 0,onClick:s,onKeyDown:s?S=>{S.key==="Enter"&&s()}:void 0,style:{...OCr,cursor:s?"pointer":void 0,pointerEvents:"auto"},children:[$.jsx("span",{style:{flexShrink:0},children:t}),n&&$.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:R_[3]},children:n})]}),m]})}function RCr({label:t,icon:n,description:s,actions:c,collapsible:d=!0,defaultOpen:m=!0,children:g}){const[S,k]=Ye.useState(m),A=$.jsxs("span",{className:"volter-section-title",children:[$.jsx("span",{children:t}),s?$.jsx("small",{children:s}):null]});return $.jsxs("section",{className:"volter-section",children:[$.jsxs("div",{className:"volter-section-header",children:[d?$.jsxs("button",{type:"button",className:"volter-section-trigger","aria-expanded":S,onClick:()=>k(!S),children:[$.jsx(l4t,{direction:S?"down":"right",style:{fontSize:"var(--volter-section-disclosure-size, var(--volter-icon-xs))"}}),n&&$.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}):$.jsxs("div",{className:"volter-section-trigger","data-volter-static":!0,children:[n&&$.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}),c?$.jsx("div",{className:"volter-section-actions",children:c}):null]}),(S||!d)&&$.jsx("div",{className:"volter-section-body",children:g})]})}const zI=8,VI=6;function FCr(t){return t==="top"?"bottom":t==="bottom"?"top":t==="left"?"right":"left"}function MCr(t,n,s){return t==="top"?n.top-s.height-VI>=zI:t==="bottom"?n.bottom+s.height+VI<=window.innerHeight-zI:t==="left"?n.left-s.width-VI>=zI:n.right+s.width+VI<=window.innerWidth-zI}function jCr(t,n,s){let c=n.left+(n.width-s.width)/2,d=n.top+(n.height-s.height)/2;return t==="top"?d=n.top-s.height-VI:t==="bottom"?d=n.bottom+VI:t==="left"?c=n.left-s.width-VI:c=n.right+VI,{left:Math.max(zI,Math.min(c,window.innerWidth-s.width-zI)),top:Math.max(zI,Math.min(d,window.innerHeight-s.height-zI)),ready:!0}}function mO({text:t,hotkey:n,children:s,position:c="bottom",delay:d=400}){const m=Ye.useId(),g=Ye.useRef(null),S=Ye.useRef(null),k=Ye.useRef(null),A=Ye.useRef(!1),F=Ye.useRef(!1),[D,J]=Ye.useState(!1),[q,G]=Ye.useState(null),[se,pe]=Ye.useState({left:0,top:0,ready:!1});Ye.useLayoutEffect(()=>{G(g.current?.closest(".volter-editor-theme")??null)},[]),Ye.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]);const ue=()=>{k.current&&clearTimeout(k.current),k.current=null,J(!1)},Ce=()=>{!A.current&&!F.current&&ue()},Fe=be=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{pe(X=>({...X,ready:!1})),J(!0)},be)};Ye.useLayoutEffect(()=>{if(!D)return;const be=()=>{const X=g.current?.getBoundingClientRect(),we=S.current?.getBoundingClientRect();if(!X||!we)return;const Be=MCr(c,X,we)?c:FCr(c);pe(jCr(Be,X,we))};return be(),window.addEventListener("resize",be),window.addEventListener("scroll",be,!0),()=>{window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}},[n,c,t,D]);let De=s;if(Ye.isValidElement(s)){const be=[s.props["aria-describedby"],D?m:null].filter(Boolean).join(" ");De=Ye.cloneElement(s,be?{"aria-describedby":be}:{})}return $.jsxs("span",{ref:g,className:"volter-tooltip-anchor",onMouseEnter:()=>{A.current=!0,Fe(d)},onMouseLeave:()=>{A.current=!1,Ce()},onFocusCapture:()=>{F.current=!0,Fe(0)},onBlurCapture:be=>{be.currentTarget.contains(be.relatedTarget)||(F.current=!1,Ce())},children:[De,D&&q&&MS.createPortal($.jsxs("div",{ref:S,id:m,role:"tooltip",className:"volter-tooltip",style:{left:se.left,top:se.top,visibility:se.ready?"visible":"hidden"},children:[$.jsx("span",{children:t}),n&&$.jsx("kbd",{children:n})]}),q)]})}function LCr({value:t,onChange:n,onAxisChange:s,step:c=.1,disabled:d=!1,testIdPrefix:m}){const g=k=>m?`${m}-${k}`:void 0,S=k=>A=>{if(s)s(k,A);else{const F=[t[0]??0,t[1]??0,t[2]??0];F[k]=A,n(F)}};return $.jsxs("div",{style:{display:"flex",gap:4},children:[$.jsx(SZ,{label:"X",labelColor:"#E06178",value:t[0],onChange:S(0),step:c,disabled:d,style:{flex:1},testId:g("x")}),$.jsx(SZ,{label:"Y",labelColor:"#C2ED66",value:t[1],onChange:S(1),step:c,disabled:d,style:{flex:1},testId:g("y")}),$.jsx(SZ,{label:"Z",labelColor:"#6BABF5",value:t[2],onChange:S(2),step:c,disabled:d,style:{flex:1},testId:g("z")})]})}const k5e={bg:Go.surface.panel,surface:Go.surface.chrome,surfaceHover:Go.surface.raised,border:Go.boundary.default,text:Go.content.primary,textMuted:Go.content.muted,onAccent:Go.content.onAccent,accent:Go.accent.default,neutralHover:Go.neutralOverlay.hover,radiusSmall:Go.shape.small,radiusMedium:Go.shape.medium,inputBg:Go.surface.inset,dynamic:Go.semantic.dynamic,dynamicBg:Go.semantic.dynamicMuted},Xyn=Go.typography.sans,Yyn=Go.typography.mono;function Zyn(t,n){t.onChange(n)}function Qyn(t,n){(t.onChangeEnd??t.onChange)(n)}const e0n={display:"flex",alignItems:"center",gap:4},t0n={fontSize:"var(--volter-font-sm)",color:Go.content.muted,marginBottom:2},BCr={fontSize:"var(--volter-font-base)",fontWeight:600,color:Go.content.muted,textTransform:"uppercase",letterSpacing:.4},$Cr=72;function r0n({label:t,active:n,disabled:s,onClick:c,testId:d}){return $.jsx(Ms,{variant:n?"primary":"secondary",size:"compact","aria-pressed":n,disabled:s,"data-testid":d,onClick:()=>{s||c()},style:{flex:1},children:t})}function n0n(t){const n=t.match(/^(-?\d+\.?\d*)\s*(px|em|rem|%|vh|vw|deg|s|ms)?$/);if(n)return{num:Number.parseFloat(n[1]??"0"),unit:n[2]||""};const s=Number.parseFloat(t);return{num:Number.isNaN(s)?0:s,unit:""}}const A5e=22,Rht={width:A5e,height:A5e,flex:`0 0 ${A5e}px`,borderRadius:k5e.radiusSmall,border:`1px solid ${k5e.border}`,background:k5e.inputBg,objectFit:"cover",backgroundImage:"linear-gradient(45deg,rgba(128,128,128,.35) 25%,transparent 25%,transparent 75%,rgba(128,128,128,.35) 75%),linear-gradient(45deg,rgba(128,128,128,.35) 25%,transparent 25%,transparent 75%,rgba(128,128,128,.35) 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px"};function qCr({value:t,onChange:n,options:s,previewUrlFor:c,disabled:d,note:m,testId:g}){const S=t&&!s.includes(t)?[t,...s]:s;return $.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[t?$.jsx("img",{src:c(t),alt:"",style:Rht,"data-testid":`${g}-thumb`}):$.jsx("span",{style:Rht,"aria-hidden":"true"}),$.jsxs(Iw,{"data-testid":g,disabled:d,value:t,title:t||"No texture assigned",onChange:k=>n(k.target.value),style:{flex:1,minWidth:0},children:[$.jsx("option",{value:"",children:"—"}),S.map(k=>$.jsx("option",{value:k,children:k},k))]}),$.jsx(dm,{"data-testid":`${g}-clear`,"aria-label":"Clear this texture slot",title:"Clear this texture slot",disabled:d||!t,onClick:()=>n(""),children:$.jsx(dc,{icon:rLe})})]}),m&&$.jsx("span",{"data-testid":`${g}-note`,style:{fontSize:"var(--volter-font-sm)",color:Go.content.muted},children:m})]})}function NRe({value:t,onCommit:n,onKeyDown:s,onFocus:c,...d}){const[m,g]=Ye.useState(null),S=Ye.useRef(!1),k=()=>{!S.current&&m!==null&&m!==t&&n(m),S.current=!1,g(null)};return $.jsx(Zm,{...d,value:m??t,onFocus:A=>{g(t),c?.(A)},onChange:A=>g(A.target.value),onBlur:k,onKeyDown:A=>{A.key==="Enter"&&A.target.blur(),A.key==="Escape"&&(S.current=!0,A.target.blur()),s?.(A)}})}const k_e=new Map,ORe=new Set;let u4t=0;function Fht(){u4t+=1;for(const t of ORe)t()}function i0n(t,n){return k_e.set(t,n),Fht(),()=>{k_e.get(t)===n&&(k_e.delete(t),Fht())}}function bBe(t){return ORe.add(t),()=>ORe.delete(t)}function o$(){return u4t}function o2(t){return t?k_e.get(t)??null:null}const QL=new Map;function o0n(t){QL.set(t,(QL.get(t)??0)+1);let n=!1;return()=>{if(n)return;n=!0;const s=(QL.get(t)??0)-1;s>0?QL.set(t,s):QL.delete(t)}}function zCr(t){return(QL.get(t)??0)>0}const PR=1e4;async function EC(t,n=4e3){if(t())return!0;const s=performance.now();return new Promise(c=>{const d=()=>{t()?c(!0):performance.now()-s>=n?c(!1):setTimeout(d,25)};setTimeout(d,0)})}const xZ=new Map,TB=new Set,che=new Set,A_e=new Set;let f4t=0;function d4t(){f4t+=1;for(const t of[...TB])t()}function VCr(t,n){return xZ.set(t,n),d4t(),()=>{xZ.get(t)===n&&xZ.delete(t)}}function UCr(t){xZ.has(t)&&d4t()}function JCr(t){return TB.add(t),()=>{TB.delete(t)}}function Mht(){return f4t}function cQ(t){return xZ.get(t)}function p4t(t,n=1e4){const s=cQ(t);return s!==void 0?Promise.resolve(s):new Promise(c=>{const d=()=>{const g=cQ(t);g!==void 0&&(clearTimeout(m),TB.delete(d),c(g))},m=setTimeout(()=>{TB.delete(d),c(void 0)},n);TB.add(d)})}function _4t(t){che.add(t);for(const n of[...A_e])n();return()=>{che.delete(t)}}function m4t(t,n=1e4){return che.has(t)?Promise.resolve(!0):new Promise(s=>{const c=()=>{che.has(t)&&(clearTimeout(d),A_e.delete(c),s(!0))},d=setTimeout(()=>{A_e.delete(c),s(!1)},n);A_e.add(c)})}async function SBe(t){if(zCr(t)&&!await EC(()=>o2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}let RRe=null;const ZY=new Map;let YO=[];function WCr(t){if(RRe=t,!t)return;const n=YO;YO=[];for(const s of n)h4t(t,s)}function h4t(t,n){ZY.get(n.id)?.();const s=t.show(n),c=()=>{ZY.get(n.id)===c&&(ZY.delete(n.id),s(),n.onDismiss?.())};return ZY.set(n.id,c),c}let HCr=0;function s$(t){const n=t.id??`notification-${++HCr}`,s={...t,id:n};return RRe?h4t(RRe,s):(YO=[...YO.filter(c=>c.id!==n),s],()=>xBe(n))}function xBe(t){const n=ZY.get(t);if(n){n();return}const s=YO.find(c=>c.id===t);s&&(YO=YO.filter(c=>c.id!==t),s.onDismiss?.())}let Xk={sessions:[],selectedSessionId:null,selectedSession:null,cursorMs:0,liveEdgeMs:0,loading:!0,error:null},lhe=!0,kpe=null,D_e=null,RG=null,P_e=!1;const QY=new Set;function GCr(t,n,s){const c=t[0]??null;return c!==null&&n.length>0&&!n.some(m=>m.id===c.id)?{sessionId:c.id,latestAppeared:!0}:s&&t.some(m=>m.id===s)?{sessionId:s,latestAppeared:!1}:{sessionId:c?.id??null,latestAppeared:!1}}function uhe(t){Xk=t;for(const n of QY)n()}async function KCr(){const t=await fetch("/__editor/gameplay-sessions");return(await L_(t,"Could not load Gameplay Sessions")).sessions}async function XCr(t){return L_(await fetch(`/__editor/gameplay-sessions/${encodeURIComponent(t)}`),"Could not load the selected Gameplay Session").then(n=>n.session)}async function YCr(){try{const t={sessions:await KCr()},n=GCr(t.sessions,Xk.sessions,D_e),s=n.sessionId;n.latestAppeared&&(lhe=!0),D_e=s;const c=s?await XCr(s):null;if(D_e!==s){P_e=!0;return}const d=t.sessions.map(S=>S.id===c?.id?c:S),m=c?.durationMs??0,g=lhe?m:Math.min(Xk.cursorMs,m);uhe({sessions:d,selectedSessionId:s,selectedSession:c,cursorMs:g,liveEdgeMs:m,loading:!1,error:null})}catch(t){uhe({...Xk,loading:!1,error:t instanceof Error?t.message:String(t)})}}function lQ(){return RG?(P_e=!0,RG):(RG=YCr().finally(()=>{RG=null,P_e&&(P_e=!1,lQ())}),RG)}function ZCr(t){return QY.add(t),QY.size===1&&(lQ(),kpe=window.setInterval(()=>void lQ(),1e3)),()=>{QY.delete(t),QY.size===0&&kpe!==null&&(window.clearInterval(kpe),kpe=null)}}function QCr(t){const n=Xk.sessions.find(s=>s.id===t);n&&(D_e=n.id,lhe=!0,uhe({...Xk,selectedSessionId:n.id,selectedSession:n,cursorMs:n.durationMs,liveEdgeMs:n.durationMs}),lQ())}function eEr(t){const n=Math.max(0,Math.min(t,Xk.liveEdgeMs));lhe=Xk.liveEdgeMs-n<250,uhe({...Xk,cursorMs:n})}const g4t={getSnapshot:()=>Xk,subscribe:ZCr,select:QCr,seek:eEr,refresh:lQ};let y4t=null;const FRe=new Set,s0n={getSnapshot:()=>y4t,subscribe(t){return FRe.add(t),()=>FRe.delete(t)}};function a0n(t){y4t=t;for(const n of FRe)try{n()}catch{}}let ZO={phase:null,at:0,run:0},dN=ZO;const MRe=new Map;let v4t=null;function tEr(t){v4t=t,b4t(ZO)}function b4t(t){ZO=t;try{v4t?.(t)}catch{}}function uQ(){const t=[...MRe.values()].at(-1),n=t?{...t,run:dN.run}:dN;n.phase===ZO.phase&&n.at===ZO.at&&n.run===ZO.run||b4t(n)}function c0n(t=Date.now()){return dN={phase:null,at:t,run:dN.run+1},uQ(),ZO.run}function l0n(t,n=Date.now()){dN={phase:t,at:n,run:dN.run},uQ()}function u0n(t=Date.now()){dN={phase:null,at:t,run:dN.run},uQ()}function wBe(t,n=Date.now()){const s=Symbol();return MRe.set(s,{phase:t.slice(0,160),at:n}),uQ(),()=>{MRe.delete(s)&&uQ()}}const rEr=Ye.lazy(()=>fo(()=>import("./GameplaySessionTimeline-DmGEiHHD.js"),__vite__mapDeps([252,1,2,3,4,20,21,139,125,140,22,23])).then(t=>({default:t.GameplaySessionTimeline})));class TBe extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){console.error(`[tools] ${this.props.file} crashed while rendering:`,n,s.componentStack)}render(){return this.state.error?$.jsxs("div",{style:{padding:R_[6],fontSize:"var(--volter-font-md)",color:Go.semantic.danger,maxWidth:640},children:[$.jsxs("div",{style:{fontWeight:600,marginBottom:R_[2]},children:["Tool crashed: ",$.jsx("code",{children:this.props.file})]}),$.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)}),$.jsx("div",{style:{color:Go.content.muted,marginTop:R_[3]},children:"The editor is fine — fix the tool file and save; it reloads in place."})]}):this.props.children}}function nEr({contribution:t,Component:n,documentId:s,active:c,document:d,accountRevision:m,playKey:g}){const S=Ye.useRef(null),[k,A]=Ye.useState(null),F=Ye.useRef(null),D=Ye.useRef(null),J=Ye.useRef(t.file);J.current=t.file;const q=Ye.useRef(s);return q.current=s,Ye.useEffect(()=>{const G=S.current;if(!G)return;let se=!1;A(null);const pe=(Fe,De)=>{if(se)return;const be=Fe instanceof Error?Fe:new Error(String(Fe));console.error(`[tools] ${J.current} crashed while rendering:`,be,De?.componentStack),A(be),q.current&&_4t(q.current)},ue=G.appendChild(document.createElement("div"));ue.style.display="contents";const Ce=Xje.createRoot(ue,{onUncaughtError:pe});return F.current=Ce,()=>{se=!0,F.current=null,D.current?.(),D.current=null,queueMicrotask(()=>{Ce.unmount(),ue.remove()})}},[]),Ye.useEffect(()=>{const G=F.current;if(!G)return;A(null);const se={contributionId:t.id,client:Kye(),surfaces:uBe,account:YLe(),work:Ce=>{D.current?.(),D.current=Ce===null?null:wBe(`building ${Ce.replace(/^building /,"")}`)},notify:Ce=>s$({...Ce,id:`contribution:${t.id}:${Ce.title}`,...Ce.tone==="warning"?{fades:!0}:{}}),...t.point==="workspace.analytics"?{gameplaySessions:g4t}:{play:Dye()},...s?{documentId:s,publishContext:Ce=>VCr(s,Ce)}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}},pe=n??t.Component,ue=Ye.createElement(pe,{...se,...t.tool?{tool:t.tool}:{}});G.render(s?Ye.createElement(iEr,{documentId:s},ue):ue)},[m,c,t,n,s,d,g]),$.jsxs($.Fragment,{children:[k?$.jsxs("div",{style:{padding:R_[6],color:Go.semantic.danger},children:["Tool crashed: ",$.jsx("code",{children:t.file}),$.jsx("div",{style:{whiteSpace:"pre-wrap",marginTop:R_[2]},children:String(k)})]}):null,$.jsx("div",{ref:S,style:{minHeight:0,width:"100%"}})]})}function iEr({documentId:t,children:n}){return Ye.useEffect(()=>_4t(t),[t]),$.jsx($.Fragment,{children:n})}function IR({contribution:t,Component:n,documentId:s,active:c,document:d}){const m=Ye.useSyncExternalStore(Tye,cN,cN),g=Ye.useSyncExternalStore(Pye,lN,lN),S=t.point==="workspace.analytics"?"gameplay-sessions":g;return $.jsxs("div",{"data-testid":`tool-panel-${t.id}`,style:{flex:1,minHeight:0,overflow:t.point==="workspace.analytics"?"visible":"auto",color:Go.content.primary,display:"flex",flexDirection:"column"},children:[t.point==="workspace.analytics"?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(rEr,{})}):null,$.jsx(TBe,{file:t.file,children:$.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:$.jsx(nEr,{contribution:t,...n?{Component:n}:{},accountRevision:m,playKey:S,...s?{documentId:s}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}})})})]})}function oEr({id:t,title:n,file:s,tool:c,Component:d,adapter:m,nodeId:g}){Ye.useSyncExternalStore(Tye,cN,cN),Ye.useSyncExternalStore(Pye,lN,lN);const S=g?m.hierarchy.node(g):null;return $.jsx("div",{className:"volter-inspector-tool-section","data-testid":`inspector-tool-${t}`,children:$.jsx(TBe,{file:s,children:$.jsx(Vvr,{adapter:m,nodeId:g,children:$.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:Kye(),surfaces:uBe,account:YLe(),play:Dye(),node:S,nodeId:g,adapter:m})})})})}const sEr=Symbol("volter.inspection.mixed");function jRe(t){return t===sEr}function CBe(t){return t.readonlyReason??"This field is read-only."}function EBe(t){return"column"}function kBe(t,n){return t.quickActions.filter(s=>s.placement===n)}const LRe="preview",jht="transform",D5e="properties",S4t="stories",f0n="story-args",d0n="Story Args";function Lht(t){return`group:${t}`}const x4t=100,aEr=1e3,fQ=2e3,w4t=3e3,cEr=4e3,lEr=5e3,uEr={nullSubjectId:null};function T4t(t){return"sections"in t}const I_e=[];let C4t=0;const BRe=new Set;function Bht(){C4t++;for(const t of BRe)t()}function fEr(t){return BRe.add(t),()=>{BRe.delete(t)}}function $ht(){return C4t}function E4t(t){return I_e.push(t),Bht(),()=>{const n=I_e.indexOf(t);n>=0&&(I_e.splice(n,1),Bht())}}function qht(t,n,s=uEr){return I_e.filter(c=>c.match(t,n,s))}function k4t(t){if(typeof t!="object"||t===null)return!1;const n=t.name;return n==="Canceled"||n==="CancellationError"||n==="AbortError"}const dEr=1e3;class pEr{_entries=[];_listeners=new Set;_nextId=0;_version=0;_notifyScheduled=!1;_sink=null;setSink(n){this._sink=n}counts={info:0,warn:0,error:0};log(n,s){this._push("info",n,s)}warn(n,s){this._push("warn",n,s)}error(n,s){this._push("error",n,s)}logStructured(n,s,c,d,m){this._push(n,s,c,d,m)}clear(){this._entries=[],this.counts={info:0,warn:0,error:0},this._notify()}getEntries(){return this._entries}subscribe=n=>(this._listeners.add(n),()=>this._listeners.delete(n));getSnapshot=()=>this._version;_push(n,s,c,d,m){const g=this._entries[this._entries.length-1];if(g&&g.level===n&&g.message===s&&g.source===c&&g.metadata?.instanceId===m?.instanceId){g.count++,g.timestamp=Date.now(),this._sink?.(g),this._notify();return}const S={id:this._nextId++,timestamp:Date.now(),level:n,message:s,count:1};if(c&&(S.source=c),d&&(S.subsystem=d),m&&(S.metadata=m),this._entries.push(S),this.counts[n]++,this._sink?.(S),this._entries.length>dEr){const k=this._entries.shift();this.counts[k.level]=Math.max(0,this.counts[k.level]-1)}this._notify()}_notify(){this._version++,!this._notifyScheduled&&(this._notifyScheduled=!0,queueMicrotask(()=>{this._notifyScheduled=!1;for(const n of this._listeners)n()}))}}const ea=new pEr;typeof window<"u"&&(window.__volterEditorConsole=ea);const zht=1e3,Vht=4e3;function CB(t){try{const n=t;return typeof t=="object"&&n!==null&&typeof n.stack=="string"&&n.stack!==""&&typeof n.message=="string"?n.stack.includes(n.message)?n.stack:`${String(t)}
45
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const g of t.seen.entries()){const S=g[1];if(n===g[0]){m(g);continue}if(t.external){const A=t.external.registry.get(g[0])?.id;if(n!==g[0]&&A){m(g);continue}}if(t.metadataRegistry.get(g[0])?.id){m(g);continue}if(S.cycle){m(g);continue}if(S.count>1&&t.reused==="ref"){m(g);continue}}}function $me(t,n){const s=t.seen.get(n);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=g=>{const S=t.seen.get(g);if(S.ref===null)return;const k=S.def??S.schema,A={...k},F=S.ref;if(S.ref=null,F){c(F);const J=t.seen.get(F),q=J.schema;if(q.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push(q)):Object.assign(k,q),Object.assign(k,A),g._zod.parent===F)for(const se in k)se==="$ref"||se==="allOf"||se in A||delete k[se];if(q.$ref&&J.def)for(const se in k)se==="$ref"||se==="allOf"||se in J.def&&JSON.stringify(k[se])===JSON.stringify(J.def[se])&&delete k[se]}const D=g._zod.parent;if(D&&D!==F){c(D);const J=t.seen.get(D);if(J?.schema.$ref&&(k.$ref=J.schema.$ref,J.def))for(const q in k)q==="$ref"||q==="allOf"||q in J.def&&JSON.stringify(k[q])===JSON.stringify(J.def[q])&&delete k[q]}t.override({zodSchema:g,jsonSchema:k,path:S.path??[]})};for(const g of[...t.seen.entries()].reverse())c(g[0]);const d={};if(t.target==="draft-2020-12"?d.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?d.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?d.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const g=t.external.registry.get(n)?.id;if(!g)throw new Error("Schema is missing an `id` property");d.$id=t.external.uri(g)}Object.assign(d,s.def??s.schema);const m=t.external?.defs??{};for(const g of t.seen.entries()){const S=g[1];S.def&&S.defId&&(m[S.defId]=S.def)}t.external||Object.keys(m).length>0&&(t.target==="draft-2020-12"?d.$defs=m:d.definitions=m);try{const g=JSON.parse(JSON.stringify(d));return Object.defineProperty(g,"~standard",{value:{...n["~standard"],jsonSchema:{input:qme(n,"input",t.processors),output:qme(n,"output",t.processors)}},enumerable:!1,writable:!1}),g}catch{throw new Error("Error converting schema to JSON.")}}function W1(t,n){const s=n??{seen:new Set};if(s.seen.has(t))return!1;s.seen.add(t);const c=t._zod.def;if(c.type==="transform")return!0;if(c.type==="array")return W1(c.element,s);if(c.type==="set")return W1(c.valueType,s);if(c.type==="lazy")return W1(c.getter(),s);if(c.type==="promise"||c.type==="optional"||c.type==="nonoptional"||c.type==="nullable"||c.type==="readonly"||c.type==="default"||c.type==="prefault")return W1(c.innerType,s);if(c.type==="intersection")return W1(c.left,s)||W1(c.right,s);if(c.type==="record"||c.type==="map")return W1(c.keyType,s)||W1(c.valueType,s);if(c.type==="pipe")return W1(c.in,s)||W1(c.out,s);if(c.type==="object"){for(const d in c.shape)if(W1(c.shape[d],s))return!0;return!1}if(c.type==="union"){for(const d of c.options)if(W1(d,s))return!0;return!1}if(c.type==="tuple"){for(const d of c.items)if(W1(d,s))return!0;return!!(c.rest&&W1(c.rest,s))}return!1}const dSr=(t,n={})=>s=>{const c=Lme({...s,processors:n});return F_(t,c),Bme(c,t),$me(c,t)},qme=(t,n,s={})=>c=>{const{libraryOptions:d,target:m}=c??{},g=Lme({...d??{},target:m,io:n,processors:s});return F_(t,g),Bme(g,t),$me(g,t)},pSr={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tkt=(t,n,s,c)=>{const d=s;d.type="string";const{minimum:m,maximum:g,format:S,patterns:k,contentEncoding:A}=t._zod.bag;if(typeof m=="number"&&(d.minLength=m),typeof g=="number"&&(d.maxLength=g),S&&(d.format=pSr[S]??S,d.format===""&&delete d.format,S==="time"&&delete d.format),A&&(d.contentEncoding=A),k&&k.size>0){const F=[...k];F.length===1?d.pattern=F[0].source:F.length>1&&(d.allOf=[...F.map(D=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:D.source}))])}},rkt=(t,n,s,c)=>{const d=s,{minimum:m,maximum:g,format:S,multipleOf:k,exclusiveMaximum:A,exclusiveMinimum:F}=t._zod.bag;typeof S=="string"&&S.includes("int")?d.type="integer":d.type="number",typeof F=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(d.minimum=F,d.exclusiveMinimum=!0):d.exclusiveMinimum=F),typeof m=="number"&&(d.minimum=m,typeof F=="number"&&n.target!=="draft-04"&&(F>=m?delete d.minimum:delete d.exclusiveMinimum)),typeof A=="number"&&(n.target==="draft-04"||n.target==="openapi-3.0"?(d.maximum=A,d.exclusiveMaximum=!0):d.exclusiveMaximum=A),typeof g=="number"&&(d.maximum=g,typeof A=="number"&&n.target!=="draft-04"&&(A<=g?delete d.maximum:delete d.exclusiveMaximum)),typeof k=="number"&&(d.multipleOf=k)},nkt=(t,n,s,c)=>{s.type="boolean"},ikt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},okt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},skt=(t,n,s,c)=>{n.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},akt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},ckt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},lkt=(t,n,s,c)=>{s.not={}},ukt=(t,n,s,c)=>{},fkt=(t,n,s,c)=>{},dkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},pkt=(t,n,s,c)=>{const d=t._zod.def,m=dLe(d.entries);m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),s.enum=m},_kt=(t,n,s,c)=>{const d=t._zod.def,m=[];for(const g of d.values)if(g===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(g))}else m.push(g);if(m.length!==0)if(m.length===1){const g=m[0];s.type=g===null?"null":typeof g,n.target==="draft-04"||n.target==="openapi-3.0"?s.enum=[g]:s.const=g}else m.every(g=>typeof g=="number")&&(s.type="number"),m.every(g=>typeof g=="string")&&(s.type="string"),m.every(g=>typeof g=="boolean")&&(s.type="boolean"),m.every(g=>g===null)&&(s.type="null"),s.enum=m},mkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},hkt=(t,n,s,c)=>{const d=s,m=t._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");d.type="string",d.pattern=m.source},gkt=(t,n,s,c)=>{const d=s,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:S,mime:k}=t._zod.bag;g!==void 0&&(m.minLength=g),S!==void 0&&(m.maxLength=S),k?k.length===1?(m.contentMediaType=k[0],Object.assign(d,m)):(Object.assign(d,m),d.anyOf=k.map(A=>({contentMediaType:A}))):Object.assign(d,m)},ykt=(t,n,s,c)=>{s.type="boolean"},vkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},bkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Skt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},xkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},wkt=(t,n,s,c)=>{if(n.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Tkt=(t,n,s,c)=>{const d=s,m=t._zod.def,{minimum:g,maximum:S}=t._zod.bag;typeof g=="number"&&(d.minItems=g),typeof S=="number"&&(d.maxItems=S),d.type="array",d.items=F_(m.element,n,{...c,path:[...c.path,"items"]})},Ckt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="object",d.properties={};const g=m.shape;for(const A in g)d.properties[A]=F_(g[A],n,{...c,path:[...c.path,"properties",A]});const S=new Set(Object.keys(g)),k=new Set([...S].filter(A=>{const F=m.shape[A]._zod;return n.io==="input"?F.optin===void 0:F.optout===void 0}));k.size>0&&(d.required=Array.from(k)),m.catchall?._zod.def.type==="never"?d.additionalProperties=!1:m.catchall?m.catchall&&(d.additionalProperties=F_(m.catchall,n,{...c,path:[...c.path,"additionalProperties"]})):n.io==="output"&&(d.additionalProperties=!1)},vLe=(t,n,s,c)=>{const d=t._zod.def,m=d.inclusive===!1,g=d.options.map((S,k)=>F_(S,n,{...c,path:[...c.path,m?"oneOf":"anyOf",k]}));m?s.oneOf=g:s.anyOf=g},Ekt=(t,n,s,c)=>{const d=t._zod.def,m=F_(d.left,n,{...c,path:[...c.path,"allOf",0]}),g=F_(d.right,n,{...c,path:[...c.path,"allOf",1]}),S=A=>"allOf"in A&&Object.keys(A).length===1,k=[...S(m)?m.allOf:[m],...S(g)?g.allOf:[g]];s.allOf=k},kkt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="array";const g=n.target==="draft-2020-12"?"prefixItems":"items",S=n.target==="draft-2020-12"||n.target==="openapi-3.0"?"items":"additionalItems",k=m.items.map((J,q)=>F_(J,n,{...c,path:[...c.path,g,q]})),A=m.rest?F_(m.rest,n,{...c,path:[...c.path,S,...n.target==="openapi-3.0"?[m.items.length]:[]]}):null;n.target==="draft-2020-12"?(d.prefixItems=k,A&&(d.items=A)):n.target==="openapi-3.0"?(d.items={anyOf:k},A&&d.items.anyOf.push(A),d.minItems=k.length,A||(d.maxItems=k.length)):(d.items=k,A&&(d.additionalItems=A));const{minimum:F,maximum:D}=t._zod.bag;typeof F=="number"&&(d.minItems=F),typeof D=="number"&&(d.maxItems=D)},Akt=(t,n,s,c)=>{const d=s,m=t._zod.def;d.type="object";const g=m.keyType,k=g._zod.bag?.patterns;if(m.mode==="loose"&&k&&k.size>0){const F=F_(m.valueType,n,{...c,path:[...c.path,"patternProperties","*"]});d.patternProperties={};for(const D of k)d.patternProperties[D.source]=F}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(d.propertyNames=F_(m.keyType,n,{...c,path:[...c.path,"propertyNames"]})),d.additionalProperties=F_(m.valueType,n,{...c,path:[...c.path,"additionalProperties"]});const A=g._zod.values;if(A){const F=[...A].filter(D=>typeof D=="string"||typeof D=="number");F.length>0&&(d.required=F)}},Dkt=(t,n,s,c)=>{const d=t._zod.def,m=F_(d.innerType,n,c),g=n.seen.get(t);n.target==="openapi-3.0"?(g.ref=d.innerType,s.nullable=!0):s.anyOf=[m,{type:"null"}]},Pkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},Ikt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,s.default=JSON.parse(JSON.stringify(d.defaultValue))},Nkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,n.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(d.defaultValue)))},Okt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType;let g;try{g=d.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=g},Rkt=(t,n,s,c)=>{const d=t._zod.def,m=n.io==="input"?d.in._zod.def.type==="transform"?d.out:d.in:d.out;F_(m,n,c);const g=n.seen.get(t);g.ref=m},Fkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType,s.readOnly=!0},Mkt=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},bLe=(t,n,s,c)=>{const d=t._zod.def;F_(d.innerType,n,c);const m=n.seen.get(t);m.ref=d.innerType},jkt=(t,n,s,c)=>{const d=t._zod.innerType;F_(d,n,c);const m=n.seen.get(t);m.ref=d},eht={string:tkt,number:rkt,boolean:nkt,bigint:ikt,symbol:okt,null:skt,undefined:akt,void:ckt,never:lkt,any:ukt,unknown:fkt,date:dkt,enum:pkt,literal:_kt,nan:mkt,template_literal:hkt,file:gkt,success:ykt,custom:vkt,function:bkt,transform:Skt,map:xkt,set:wkt,array:Tkt,object:Ckt,union:vLe,intersection:Ekt,tuple:kkt,record:Akt,nullable:Dkt,nonoptional:Pkt,default:Ikt,prefault:Nkt,catch:Okt,pipe:Rkt,readonly:Fkt,promise:Mkt,optional:bLe,lazy:jkt};function _Sr(t,n){if("_idmap"in t){const c=t,d=Lme({...n,processors:eht}),m={};for(const k of c._idmap.entries()){const[A,F]=k;F_(F,d)}const g={},S={registry:c,uri:n?.uri,defs:m};d.external=S;for(const k of c._idmap.entries()){const[A,F]=k;Bme(d,F),g[A]=$me(d,F)}if(Object.keys(m).length>0){const k=d.target==="draft-2020-12"?"$defs":"definitions";g.__shared={[k]:m}}return{schemas:g}}const s=Lme({...n,processors:eht});return F_(t,s),Bme(s,t),$me(s,t)}const Lkt=ui("ZodISODateTime",(t,n)=>{ybr.init(t,n),j_.init(t,n)});function Bkt(t){return x2r(Lkt,t)}const $kt=ui("ZodISODate",(t,n)=>{vbr.init(t,n),j_.init(t,n)});function qkt(t){return w2r($kt,t)}const zkt=ui("ZodISOTime",(t,n)=>{bbr.init(t,n),j_.init(t,n)});function Vkt(t){return T2r(zkt,t)}const Ukt=ui("ZodISODuration",(t,n)=>{Sbr.init(t,n),j_.init(t,n)});function Jkt(t){return C2r(Ukt,t)}const Egn=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:$kt,ZodISODateTime:Lkt,ZodISODuration:Ukt,ZodISOTime:zkt,date:qkt,datetime:Bkt,duration:Jkt,time:Vkt},Symbol.toStringTag,{value:"Module"})),Wkt=(t,n)=>{ICt.init(t,n),t.name="ZodError",Object.defineProperties(t,{format:{value:s=>d1r(t,s)},flatten:{value:s=>f1r(t,s)},addIssue:{value:s=>{t.issues.push(s),t.message=JSON.stringify(t.issues,Rme,2)}},addIssues:{value:s=>{t.issues.push(...s),t.message=JSON.stringify(t.issues,Rme,2)}},isEmpty:{get(){return t.issues.length===0}}})},kgn=ui("ZodError",Wkt),Mw=ui("ZodError",Wkt,{Parent:Error}),mSr=fye(Mw),hSr=dye(Mw),gSr=pye(Mw),ySr=_ye(Mw),vSr=NCt(Mw),bSr=OCt(Mw),SSr=RCt(Mw),xSr=FCt(Mw),wSr=MCt(Mw),TSr=jCt(Mw),CSr=LCt(Mw),ESr=BCt(Mw),Lu=ui("ZodType",(t,n)=>(vu.init(t,n),Object.assign(t["~standard"],{jsonSchema:{input:qme(t,"input"),output:qme(t,"output")}}),t.toJSONSchema=dSr(t,{}),t.def=n,t.type=n.type,Object.defineProperty(t,"_def",{value:n}),t.check=(...s)=>t.clone(oA(n,{checks:[...n.checks??[],...s.map(c=>typeof c=="function"?{_zod:{check:c,def:{check:"custom"},onattach:[]}}:c)]}),{parent:!0}),t.with=t.check,t.clone=(s,c)=>sA(t,s,c),t.brand=()=>t,t.register=((s,c)=>(s.add(t,c),t)),t.parse=(s,c)=>mSr(t,s,c,{callee:t.parse}),t.safeParse=(s,c)=>gSr(t,s,c),t.parseAsync=async(s,c)=>hSr(t,s,c,{callee:t.parseAsync}),t.safeParseAsync=async(s,c)=>ySr(t,s,c),t.spa=t.safeParseAsync,t.encode=(s,c)=>vSr(t,s,c),t.decode=(s,c)=>bSr(t,s,c),t.encodeAsync=async(s,c)=>SSr(t,s,c),t.decodeAsync=async(s,c)=>xSr(t,s,c),t.safeEncode=(s,c)=>wSr(t,s,c),t.safeDecode=(s,c)=>TSr(t,s,c),t.safeEncodeAsync=async(s,c)=>CSr(t,s,c),t.safeDecodeAsync=async(s,c)=>ESr(t,s,c),t.refine=(s,c)=>t.check(OAt(s,c)),t.superRefine=s=>t.check(RAt(s)),t.overwrite=s=>t.check(M$(s)),t.optional=()=>Ume(t),t.exactOptional=()=>mAt(t),t.nullable=()=>Jme(t),t.nullish=()=>Ume(Jme(t)),t.nonoptional=s=>SAt(t,s),t.array=()=>Gd(t),t.or=s=>AR([t,s]),t.and=s=>ULe(t,s),t.transform=s=>Wme(t,JLe(s)),t.default=s=>yAt(t,s),t.prefault=s=>bAt(t,s),t.catch=s=>TAt(t,s),t.pipe=s=>Wme(t,s),t.readonly=()=>kAt(t),t.describe=s=>{const c=t.clone();return sD.add(c,{description:s}),c},Object.defineProperty(t,"description",{get(){return sD.get(t)?.description},configurable:!0}),t.meta=(...s)=>{if(s.length===0)return sD.get(t);const c=t.clone();return sD.add(c,s[0]),c},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=s=>s(t),t)),SLe=ui("_ZodString",(t,n)=>{hye.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>tkt(t,c,d);const s=t._zod.bag;t.format=s.format??null,t.minLength=s.minimum??null,t.maxLength=s.maximum??null,t.regex=(...c)=>t.check(J2r(...c)),t.includes=(...c)=>t.check(G2r(...c)),t.startsWith=(...c)=>t.check(K2r(...c)),t.endsWith=(...c)=>t.check(X2r(...c)),t.min=(...c)=>t.check(jme(...c)),t.max=(...c)=>t.check(QEt(...c)),t.length=(...c)=>t.check(ekt(...c)),t.nonempty=(...c)=>t.check(jme(1,...c)),t.lowercase=c=>t.check(W2r(c)),t.uppercase=c=>t.check(H2r(c)),t.trim=()=>t.check(Q2r()),t.normalize=(...c)=>t.check(Z2r(...c)),t.toLowerCase=()=>t.check(eSr()),t.toUpperCase=()=>t.check(tSr()),t.slugify=()=>t.check(rSr())}),xLe=ui("ZodString",(t,n)=>{hye.init(t,n),SLe.init(t,n),t.email=s=>t.check(NEt(wLe,s)),t.url=s=>t.check(gLe(yye,s)),t.jwt=s=>t.check(YEt(LLe,s)),t.emoji=s=>t.check(jEt(TLe,s)),t.guid=s=>t.check(XOe(zme,s)),t.uuid=s=>t.check(OEt(aD,s)),t.uuidv4=s=>t.check(REt(aD,s)),t.uuidv6=s=>t.check(FEt(aD,s)),t.uuidv7=s=>t.check(MEt(aD,s)),t.nanoid=s=>t.check(LEt(CLe,s)),t.guid=s=>t.check(XOe(zme,s)),t.cuid=s=>t.check(BEt(ELe,s)),t.cuid2=s=>t.check($Et(kLe,s)),t.ulid=s=>t.check(qEt(ALe,s)),t.base64=s=>t.check(GEt(FLe,s)),t.base64url=s=>t.check(KEt(MLe,s)),t.xid=s=>t.check(zEt(DLe,s)),t.ksuid=s=>t.check(VEt(PLe,s)),t.ipv4=s=>t.check(UEt(ILe,s)),t.ipv6=s=>t.check(JEt(NLe,s)),t.cidrv4=s=>t.check(WEt(OLe,s)),t.cidrv6=s=>t.check(HEt(RLe,s)),t.e164=s=>t.check(XEt(jLe,s)),t.datetime=s=>t.check(Bkt(s)),t.date=s=>t.check(qkt(s)),t.time=s=>t.check(Vkt(s)),t.duration=s=>t.check(Jkt(s))});function bo(t){return b2r(xLe,t)}const j_=ui("ZodStringFormat",(t,n)=>{M_.init(t,n),SLe.init(t,n)}),wLe=ui("ZodEmail",(t,n)=>{lbr.init(t,n),j_.init(t,n)});function kSr(t){return NEt(wLe,t)}const zme=ui("ZodGUID",(t,n)=>{abr.init(t,n),j_.init(t,n)});function ASr(t){return XOe(zme,t)}const aD=ui("ZodUUID",(t,n)=>{cbr.init(t,n),j_.init(t,n)});function DSr(t){return OEt(aD,t)}function PSr(t){return REt(aD,t)}function ISr(t){return FEt(aD,t)}function NSr(t){return MEt(aD,t)}const yye=ui("ZodURL",(t,n)=>{ubr.init(t,n),j_.init(t,n)});function OSr(t){return gLe(yye,t)}function RSr(t){return gLe(yye,{protocol:/^https?$/,hostname:iEt,...Jo(t)})}const TLe=ui("ZodEmoji",(t,n)=>{fbr.init(t,n),j_.init(t,n)});function FSr(t){return jEt(TLe,t)}const CLe=ui("ZodNanoID",(t,n)=>{dbr.init(t,n),j_.init(t,n)});function MSr(t){return LEt(CLe,t)}const ELe=ui("ZodCUID",(t,n)=>{pbr.init(t,n),j_.init(t,n)});function jSr(t){return BEt(ELe,t)}const kLe=ui("ZodCUID2",(t,n)=>{_br.init(t,n),j_.init(t,n)});function LSr(t){return $Et(kLe,t)}const ALe=ui("ZodULID",(t,n)=>{mbr.init(t,n),j_.init(t,n)});function BSr(t){return qEt(ALe,t)}const DLe=ui("ZodXID",(t,n)=>{hbr.init(t,n),j_.init(t,n)});function $Sr(t){return zEt(DLe,t)}const PLe=ui("ZodKSUID",(t,n)=>{gbr.init(t,n),j_.init(t,n)});function qSr(t){return VEt(PLe,t)}const ILe=ui("ZodIPv4",(t,n)=>{xbr.init(t,n),j_.init(t,n)});function zSr(t){return UEt(ILe,t)}const Hkt=ui("ZodMAC",(t,n)=>{Tbr.init(t,n),j_.init(t,n)});function VSr(t){return S2r(Hkt,t)}const NLe=ui("ZodIPv6",(t,n)=>{wbr.init(t,n),j_.init(t,n)});function USr(t){return JEt(NLe,t)}const OLe=ui("ZodCIDRv4",(t,n)=>{Cbr.init(t,n),j_.init(t,n)});function JSr(t){return WEt(OLe,t)}const RLe=ui("ZodCIDRv6",(t,n)=>{Ebr.init(t,n),j_.init(t,n)});function WSr(t){return HEt(RLe,t)}const FLe=ui("ZodBase64",(t,n)=>{kbr.init(t,n),j_.init(t,n)});function HSr(t){return GEt(FLe,t)}const MLe=ui("ZodBase64URL",(t,n)=>{Dbr.init(t,n),j_.init(t,n)});function GSr(t){return KEt(MLe,t)}const jLe=ui("ZodE164",(t,n)=>{Pbr.init(t,n),j_.init(t,n)});function KSr(t){return XEt(jLe,t)}const LLe=ui("ZodJWT",(t,n)=>{Nbr.init(t,n),j_.init(t,n)});function XSr(t){return YEt(LLe,t)}const mee=ui("ZodCustomStringFormat",(t,n)=>{Obr.init(t,n),j_.init(t,n)});function YSr(t,n,s={}){return gye(mee,t,n,s)}function ZSr(t){return gye(mee,"hostname",nEt,t)}function QSr(t){return gye(mee,"hex",vEt,t)}function exr(t,n){const s=n?.enc??"hex",c=`${t}_${s}`,d=$1r[c];if(!d)throw new Error(`Unrecognized hash format: ${c}`);return gye(mee,c,d,n)}const BLe=ui("ZodNumber",(t,n)=>{TEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>rkt(t,c,d),t.gt=(c,d)=>t.check(QZ(c,d)),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.lt=(c,d)=>t.check(ZZ(c,d)),t.lte=(c,d)=>t.check(XI(c,d)),t.max=(c,d)=>t.check(XI(c,d)),t.int=c=>t.check(ZOe(c)),t.safe=c=>t.check(ZOe(c)),t.positive=c=>t.check(QZ(0,c)),t.nonnegative=c=>t.check(qk(0,c)),t.negative=c=>t.check(ZZ(0,c)),t.nonpositive=c=>t.check(XI(0,c)),t.multipleOf=(c,d)=>t.check(YOe(c,d)),t.step=(c,d)=>t.check(YOe(c,d)),t.finite=()=>t;const s=t._zod.bag;t.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),t.isFinite=!0,t.format=s.format??null});function fu(t){return E2r(BLe,t)}const j$=ui("ZodNumberFormat",(t,n)=>{Rbr.init(t,n),BLe.init(t,n)});function ZOe(t){return k2r(j$,t)}function txr(t){return A2r(j$,t)}function rxr(t){return D2r(j$,t)}function nxr(t){return P2r(j$,t)}function ixr(t){return I2r(j$,t)}const $Le=ui("ZodBoolean",(t,n)=>{CEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>nkt(t,s,c)});function _y(t){return N2r($Le,t)}const qLe=ui("ZodBigInt",(t,n)=>{EEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>ikt(t,c),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.gt=(c,d)=>t.check(QZ(c,d)),t.gte=(c,d)=>t.check(qk(c,d)),t.min=(c,d)=>t.check(qk(c,d)),t.lt=(c,d)=>t.check(ZZ(c,d)),t.lte=(c,d)=>t.check(XI(c,d)),t.max=(c,d)=>t.check(XI(c,d)),t.positive=c=>t.check(QZ(BigInt(0),c)),t.negative=c=>t.check(ZZ(BigInt(0),c)),t.nonpositive=c=>t.check(XI(BigInt(0),c)),t.nonnegative=c=>t.check(qk(BigInt(0),c)),t.multipleOf=(c,d)=>t.check(YOe(c,d));const s=t._zod.bag;t.minValue=s.minimum??null,t.maxValue=s.maximum??null,t.format=s.format??null});function oxr(t){return O2r(qLe,t)}const zLe=ui("ZodBigIntFormat",(t,n)=>{Fbr.init(t,n),qLe.init(t,n)});function sxr(t){return R2r(zLe,t)}function axr(t){return F2r(zLe,t)}const Gkt=ui("ZodSymbol",(t,n)=>{Mbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>okt(t,s)});function cxr(t){return M2r(Gkt,t)}const Kkt=ui("ZodUndefined",(t,n)=>{jbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>akt(t,s)});function lxr(t){return j2r(Kkt,t)}const Xkt=ui("ZodNull",(t,n)=>{Lbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>skt(t,s,c)});function Ykt(t){return L2r(Xkt,t)}const Zkt=ui("ZodAny",(t,n)=>{Bbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ukt()});function uxr(){return B2r(Zkt)}const Qkt=ui("ZodUnknown",(t,n)=>{$br.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>fkt()});function t$(){return $2r(Qkt)}const eAt=ui("ZodNever",(t,n)=>{qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>lkt(t,s,c)});function VLe(t){return q2r(eAt,t)}const tAt=ui("ZodVoid",(t,n)=>{zbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ckt(t,s)});function fxr(t){return z2r(tAt,t)}const rAt=ui("ZodDate",(t,n)=>{Vbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>dkt(t,c),t.min=(c,d)=>t.check(qk(c,d)),t.max=(c,d)=>t.check(XI(c,d));const s=t._zod.bag;t.minDate=s.minimum?new Date(s.minimum):null,t.maxDate=s.maximum?new Date(s.maximum):null});function dxr(t){return V2r(rAt,t)}const nAt=ui("ZodArray",(t,n)=>{Ubr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Tkt(t,s,c,d),t.element=n.element,t.min=(s,c)=>t.check(jme(s,c)),t.nonempty=s=>t.check(jme(1,s)),t.max=(s,c)=>t.check(QEt(s,c)),t.length=(s,c)=>t.check(ekt(s,c)),t.unwrap=()=>t.element});function Gd(t,n){return nSr(nAt,t,n)}function pxr(t){const n=t._zod.def.shape;return ed(Object.keys(n))}const vye=ui("ZodObject",(t,n)=>{Wbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ckt(t,s,c,d),Gu(t,"shape",()=>n.shape),t.keyof=()=>ed(Object.keys(t._zod.def.shape)),t.catchall=s=>t.clone({...t._zod.def,catchall:s}),t.passthrough=()=>t.clone({...t._zod.def,catchall:t$()}),t.loose=()=>t.clone({...t._zod.def,catchall:t$()}),t.strict=()=>t.clone({...t._zod.def,catchall:VLe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=s=>wCt(t,s),t.safeExtend=s=>TCt(t,s),t.merge=s=>CCt(t,s),t.pick=s=>SCt(t,s),t.omit=s=>xCt(t,s),t.partial=(...s)=>ECt(WLe,t,s[0]),t.required=(...s)=>kCt(HLe,t,s[0])});function Pa(t,n){const s={type:"object",shape:t??{},...Jo(n)};return new vye(s)}function _xr(t,n){return new vye({type:"object",shape:t,catchall:VLe(),...Jo(n)})}function mxr(t,n){return new vye({type:"object",shape:t,catchall:t$(),...Jo(n)})}const bye=ui("ZodUnion",(t,n)=>{hLe.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vLe(t,s,c,d),t.options=n.options});function AR(t,n){return new bye({type:"union",options:t,...Jo(n)})}const iAt=ui("ZodXor",(t,n)=>{bye.init(t,n),Hbr.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vLe(t,s,c,d),t.options=n.options});function hxr(t,n){return new iAt({type:"union",options:t,inclusive:!1,...Jo(n)})}const oAt=ui("ZodDiscriminatedUnion",(t,n)=>{bye.init(t,n),Gbr.init(t,n)});function sAt(t,n,s){return new oAt({type:"union",options:n,discriminator:t,...Jo(s)})}const aAt=ui("ZodIntersection",(t,n)=>{Kbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ekt(t,s,c,d)});function ULe(t,n){return new aAt({type:"intersection",left:t,right:n})}const cAt=ui("ZodTuple",(t,n)=>{DEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>kkt(t,s,c,d),t.rest=s=>t.clone({...t._zod.def,rest:s})});function Vme(t,n,s){const c=n instanceof vu,d=c?s:n,m=c?n:null;return new cAt({type:"tuple",items:t,rest:m,...Jo(d)})}const Sye=ui("ZodRecord",(t,n)=>{Xbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Akt(t,s,c,d),t.keyType=n.keyType,t.valueType=n.valueType});function wD(t,n,s){return new Sye({type:"record",keyType:t,valueType:n,...Jo(s)})}function gxr(t,n,s){const c=sA(t);return c._zod.values=void 0,new Sye({type:"record",keyType:c,valueType:n,...Jo(s)})}function yxr(t,n,s){return new Sye({type:"record",keyType:t,valueType:n,mode:"loose",...Jo(s)})}const lAt=ui("ZodMap",(t,n)=>{Ybr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>xkt(t,s),t.keyType=n.keyType,t.valueType=n.valueType,t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(yLe(...s)),t.size=(...s)=>t.check(ZEt(...s))});function vxr(t,n,s){return new lAt({type:"map",keyType:t,valueType:n,...Jo(s)})}const uAt=ui("ZodSet",(t,n)=>{Zbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>wkt(t,s),t.min=(...s)=>t.check(eQ(...s)),t.nonempty=s=>t.check(eQ(1,s)),t.max=(...s)=>t.check(yLe(...s)),t.size=(...s)=>t.check(ZEt(...s))});function bxr(t,n){return new uAt({type:"set",valueType:t,...Jo(n)})}const tQ=ui("ZodEnum",(t,n)=>{Qbr.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(c,d,m)=>pkt(t,c,d),t.enum=n.entries,t.options=Object.values(n.entries);const s=new Set(Object.keys(n.entries));t.extract=(c,d)=>{const m={};for(const g of c)if(s.has(g))m[g]=n.entries[g];else throw new Error(`Key ${g} not found in enum`);return new tQ({...n,checks:[],...Jo(d),entries:m})},t.exclude=(c,d)=>{const m={...n.entries};for(const g of c)if(s.has(g))delete m[g];else throw new Error(`Key ${g} not found in enum`);return new tQ({...n,checks:[],...Jo(d),entries:m})}});function ed(t,n){const s=Array.isArray(t)?Object.fromEntries(t.map(c=>[c,c])):t;return new tQ({type:"enum",entries:s,...Jo(n)})}function Sxr(t,n){return new tQ({type:"enum",entries:t,...Jo(n)})}const fAt=ui("ZodLiteral",(t,n)=>{e2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>_kt(t,s,c),t.values=new Set(n.values),Object.defineProperty(t,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Dg(t,n){return new fAt({type:"literal",values:Array.isArray(t)?t:[t],...Jo(n)})}const dAt=ui("ZodFile",(t,n)=>{t2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>gkt(t,s,c),t.min=(s,c)=>t.check(eQ(s,c)),t.max=(s,c)=>t.check(yLe(s,c)),t.mime=(s,c)=>t.check(Y2r(Array.isArray(s)?s:[s],c))});function xxr(t){return iSr(dAt,t)}const pAt=ui("ZodTransform",(t,n)=>{r2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Skt(t,s),t._zod.parse=(s,c)=>{if(c.direction==="backward")throw new fLe(t.constructor.name);s.addIssue=m=>{if(typeof m=="string")s.issues.push(QB(m,s.value,n));else{const g=m;g.fatal&&(g.continue=!1),g.code??(g.code="custom"),g.input??(g.input=s.value),g.inst??(g.inst=t),s.issues.push(QB(g))}};const d=n.transform(s.value,s);return d instanceof Promise?d.then(m=>(s.value=m,s)):(s.value=d,s)}});function JLe(t){return new pAt({type:"transform",transform:t})}const WLe=ui("ZodOptional",(t,n)=>{PEt.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Ume(t){return new WLe({type:"optional",innerType:t})}const _At=ui("ZodExactOptional",(t,n)=>{n2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bLe(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function mAt(t){return new _At({type:"optional",innerType:t})}const hAt=ui("ZodNullable",(t,n)=>{i2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Dkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Jme(t){return new hAt({type:"nullable",innerType:t})}function wxr(t){return Ume(Jme(t))}const gAt=ui("ZodDefault",(t,n)=>{o2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Ikt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yAt(t,n){return new gAt({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():cye(n)}})}const vAt=ui("ZodPrefault",(t,n)=>{s2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Nkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function bAt(t,n){return new vAt({type:"prefault",innerType:t,get defaultValue(){return typeof n=="function"?n():cye(n)}})}const HLe=ui("ZodNonOptional",(t,n)=>{a2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Pkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function SAt(t,n){return new HLe({type:"nonoptional",innerType:t,...Jo(n)})}const xAt=ui("ZodSuccess",(t,n)=>{c2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>ykt(t,s,c),t.unwrap=()=>t._zod.def.innerType});function Txr(t){return new xAt({type:"success",innerType:t})}const wAt=ui("ZodCatch",(t,n)=>{l2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Okt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function TAt(t,n){return new wAt({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}const CAt=ui("ZodNaN",(t,n)=>{u2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>mkt(t,s)});function Cxr(t){return U2r(CAt,t)}const GLe=ui("ZodPipe",(t,n)=>{f2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Rkt(t,s,c,d),t.in=n.in,t.out=n.out});function Wme(t,n){return new GLe({type:"pipe",in:t,out:n})}const KLe=ui("ZodCodec",(t,n)=>{GLe.init(t,n),IEt.init(t,n)});function Exr(t,n,s){return new KLe({type:"pipe",in:t,out:n,transform:s.decode,reverseTransform:s.encode})}const EAt=ui("ZodReadonly",(t,n)=>{d2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Fkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function kAt(t){return new EAt({type:"readonly",innerType:t})}const AAt=ui("ZodTemplateLiteral",(t,n)=>{p2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>hkt(t,s,c)});function kxr(t,n){return new AAt({type:"template_literal",parts:t,...Jo(n)})}const DAt=ui("ZodLazy",(t,n)=>{h2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>jkt(t,s,c,d),t.unwrap=()=>t._zod.def.getter()});function PAt(t){return new DAt({type:"lazy",getter:t})}const IAt=ui("ZodPromise",(t,n)=>{m2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>Mkt(t,s,c,d),t.unwrap=()=>t._zod.def.innerType});function Axr(t){return new IAt({type:"promise",innerType:t})}const NAt=ui("ZodFunction",(t,n)=>{_2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>bkt(t,s)});function tht(t){return new NAt({type:"function",input:Array.isArray(t?.input)?Vme(t?.input):t?.input??Gd(t$()),output:t?.output??t$()})}const xye=ui("ZodCustom",(t,n)=>{g2r.init(t,n),Lu.init(t,n),t._zod.processJSONSchema=(s,c,d)=>vkt(t,s)});function Dxr(t){const n=new eh({check:"custom"});return n._zod.check=t,n}function YI(t,n){return oSr(xye,t??(()=>!0),n)}function OAt(t,n={}){return sSr(xye,t,n)}function RAt(t){return aSr(t)}const Pxr=lSr,Ixr=uSr;function Nxr(t,n={}){const s=new xye({type:"custom",check:"custom",fn:c=>c instanceof t,abort:!0,...Jo(n)});return s._zod.bag.Class=t,s._zod.check=c=>{c.value instanceof t||c.issues.push({code:"invalid_type",expected:t.name,input:c.value,inst:s,path:[...s._zod.def.path??[]]})},s}const Oxr=(...t)=>fSr({Codec:KLe,Boolean:$Le,String:xLe},...t);function Rxr(t){const n=PAt(()=>AR([bo(t),fu(),_y(),Ykt(),Gd(n),wD(bo(),n)]));return n}function FAt(t,n){return Wme(JLe(t),n)}const Agn=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:Zkt,ZodArray:nAt,ZodBase64:FLe,ZodBase64URL:MLe,ZodBigInt:qLe,ZodBigIntFormat:zLe,ZodBoolean:$Le,ZodCIDRv4:OLe,ZodCIDRv6:RLe,ZodCUID:ELe,ZodCUID2:kLe,ZodCatch:wAt,ZodCodec:KLe,ZodCustom:xye,ZodCustomStringFormat:mee,ZodDate:rAt,ZodDefault:gAt,ZodDiscriminatedUnion:oAt,ZodE164:jLe,ZodEmail:wLe,ZodEmoji:TLe,ZodEnum:tQ,ZodExactOptional:_At,ZodFile:dAt,ZodFunction:NAt,ZodGUID:zme,ZodIPv4:ILe,ZodIPv6:NLe,ZodIntersection:aAt,ZodJWT:LLe,ZodKSUID:PLe,ZodLazy:DAt,ZodLiteral:fAt,ZodMAC:Hkt,ZodMap:lAt,ZodNaN:CAt,ZodNanoID:CLe,ZodNever:eAt,ZodNonOptional:HLe,ZodNull:Xkt,ZodNullable:hAt,ZodNumber:BLe,ZodNumberFormat:j$,ZodObject:vye,ZodOptional:WLe,ZodPipe:GLe,ZodPrefault:vAt,ZodPromise:IAt,ZodReadonly:EAt,ZodRecord:Sye,ZodSet:uAt,ZodString:xLe,ZodStringFormat:j_,ZodSuccess:xAt,ZodSymbol:Gkt,ZodTemplateLiteral:AAt,ZodTransform:pAt,ZodTuple:cAt,ZodType:Lu,ZodULID:ALe,ZodURL:yye,ZodUUID:aD,ZodUndefined:Kkt,ZodUnion:bye,ZodUnknown:Qkt,ZodVoid:tAt,ZodXID:DLe,ZodXor:iAt,_ZodString:SLe,_default:yAt,_function:tht,any:uxr,array:Gd,base64:HSr,base64url:GSr,bigint:oxr,boolean:_y,catch:TAt,check:Dxr,cidrv4:JSr,cidrv6:WSr,codec:Exr,cuid:jSr,cuid2:LSr,custom:YI,date:dxr,describe:Pxr,discriminatedUnion:sAt,e164:KSr,email:kSr,emoji:FSr,enum:ed,exactOptional:mAt,file:xxr,float32:txr,float64:rxr,function:tht,guid:ASr,hash:exr,hex:QSr,hostname:ZSr,httpUrl:RSr,instanceof:Nxr,int:ZOe,int32:nxr,int64:sxr,intersection:ULe,ipv4:zSr,ipv6:USr,json:Rxr,jwt:XSr,keyof:pxr,ksuid:qSr,lazy:PAt,literal:Dg,looseObject:mxr,looseRecord:yxr,mac:VSr,map:vxr,meta:Ixr,nan:Cxr,nanoid:MSr,nativeEnum:Sxr,never:VLe,nonoptional:SAt,null:Ykt,nullable:Jme,nullish:wxr,number:fu,object:Pa,optional:Ume,partialRecord:gxr,pipe:Wme,prefault:bAt,preprocess:FAt,promise:Axr,readonly:kAt,record:wD,refine:OAt,set:bxr,strictObject:_xr,string:bo,stringFormat:YSr,stringbool:Oxr,success:Txr,superRefine:RAt,symbol:cxr,templateLiteral:kxr,transform:JLe,tuple:Vme,uint32:ixr,uint64:axr,ulid:BSr,undefined:lxr,union:AR,unknown:t$,url:OSr,uuid:DSr,uuidv4:PSr,uuidv6:ISr,uuidv7:NSr,void:fxr,xid:$Sr,xor:hxr},Symbol.toStringTag,{value:"Module"})),rht={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Dgn(t){$S({customError:t})}function Pgn(){return $S().customError}var nht;nht||(nht={});const iht=ed(["mock","live"]),Fxr=Pa({id:bo().min(1),name:bo().min(1),status:ed(["free","trialing","active","past_due","cancelling"]),interval:ed(["month","year"]).optional(),renewsAt:bo().datetime().optional(),endsAt:bo().datetime().optional()}),Mxr=Pa({included:fu().nonnegative(),purchased:fu().nonnegative(),used:fu().nonnegative(),reserved:fu().nonnegative(),remaining:fu().nonnegative(),resetsAt:bo().datetime().optional(),purchasedExpiresAt:bo().datetime().optional()}),jxr=Pa({overageEnabled:_y(),monthlyLimitCredits:fu().nonnegative(),alertThresholds:Gd(fu().min(1).max(100)).max(8),autoReload:Pa({enabled:_y(),whenRemainingBelow:fu().nonnegative(),reloadTo:fu().positive(),monthlyLimitCredits:fu().nonnegative()}).optional()}),Lxr=Pa({id:bo().min(1),kind:ed(["threshold","auto_reload_succeeded","auto_reload_failed"]),message:bo().min(1),createdAt:bo().datetime(),readAt:bo().datetime().optional()}),Bxr=Pa({id:bo().min(1),email:bo().email(),name:bo().min(1).optional()}),$xr=Pa({name:bo().min(1),verified:_y(),enrollmentMode:ed(["manual_invitation","automatic_invitation","automatic_suggestion","enterprise_sso"])}),qxr=Pa({id:bo().min(1),name:bo().min(1),slug:bo().min(1).optional(),role:bo().min(1),domains:Gd($xr).max(50)}),zxr=Pa({id:bo().min(1),occurredAt:bo().datetime(),kind:ed(["inference","generation","workspace","storage","relay","deployment"]),provider:bo().min(1),operation:bo().optional(),credits:fu().nonnegative(),state:ed(["reserved","settled","released"]),externalId:bo().optional()});ed(["free","creator","max","ultra"]);const Vxr=Pa({plans:Pa({free:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),creator:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),max:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()}),ultra:Pa({name:bo().min(1),includedCredits:fu().int().nonnegative(),monthlyPriceUsd:fu().nonnegative().optional()})}),creditPacks:wD(bo().min(1),Pa({name:bo().min(1),credits:fu().int().positive(),expiresInDays:fu().int().positive().optional()}))}),Uxr=sAt("authenticated",[Pa({authenticated:Dg(!1),backend:iht}),Pa({authenticated:Dg(!0),backend:iht,user:Bxr,organizations:Gd(qxr).max(100).optional(),plan:Fxr,credits:Mxr,spendPolicy:jxr,alerts:Gd(Lxr).max(100).optional(),entitlements:Pa({generation:_y(),dailyJobs:fu().int().positive().optional()})})]),Jxr=ed(["auto","mock","managed","byok"]),MAt=ed(["fal","tripo","worldlabs","openrouter"]),Wxr=Pa({enabled:_y(),provider:Dg("openrouter"),model:bo().trim().min(1).max(256)}),Hxr=ed(["environment","system","session","none"]),Gxr=Pa({provider:MAt,label:bo().min(1),environmentVariable:bo().min(1),configured:_y(),source:Hxr,editable:_y(),persistence:ed(["system","session"]),maskedKey:bo().min(1).optional(),problem:bo().min(1).optional()}),Kxr=Pa({provider:MAt,ok:Dg(!0),testedAt:bo().datetime()});function Xxr(t){return{routes:{mock:!0,managed:t.routes.managed,byok:t.routes.byok,byokProviders:[...t.routes.byokProviders]},preferredRoute:t.preferredRoute}}const wye=ULe(Uxr,Pa({accountEnvironment:ed(["test-mock","development-twin","production"]),routes:Pa({mock:Dg(!0),managed:_y(),byok:_y(),byokProviders:Gd(bo().min(1))}),preferredRoute:Jxr,providerCredentials:Gd(Gxr),codingInference:Wxr}));function Yxr(t,n){return`${t}: this origin answered with its page fallback (${n||"no content-type"}) rather than JSON, so no editor server handled the request.`}function sf(t,n){const s=t.headers.get("content-type")??"";if(!s.includes("application/json"))throw new Error(Yxr(n,s))}function CN(t,n){if(!t.ok)throw new Error(`${n} (${t.status}).`);sf(t,n)}async function L_(t,n){return CN(t,n),await t.json()}const oht="volter.collaboration.participant.v1",Zxr="volter.collaboration.remote-share.v1",QOe=globalThis.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__;function Qxr(){if(QOe?.participantId)return QOe.participantId;const t=globalThis.crypto?.randomUUID?.()??`participant-${Date.now()}`;try{const n=globalThis.localStorage?.getItem(oht);if(n)return n;globalThis.localStorage?.setItem(oht,t)}catch{}return t}const jAt=Qxr(),L$=(()=>{try{return globalThis.localStorage?.getItem(Zxr)==="1"}catch{return!1}})(),ewr=QOe?.displayName||"Local editor",twr=Symbol.for("volter.collaboration.revision"),eRe=globalThis[twr]??={value:0};function LAt(t){Number.isInteger(t)&&t>=eRe.value&&(eRe.value=t)}function Dw(){return{participantId:jAt,expectedRevision:eRe.value}}const rwr={authenticated:!1,backend:"mock",accountEnvironment:"test-mock",routes:{mock:!0,managed:!1,byok:!1,byokProviders:[]},preferredRoute:"auto",providerCredentials:[],codingInference:{enabled:!1,provider:"openrouter",model:"z-ai/glm-5.2"}};let r$=rwr,BAt=0,tRe=null;const rRe=new Set;function lR(t,n=null){if(!(tRe===n&&JSON.stringify(r$)===JSON.stringify(t))){r$=t,tRe=n,BAt++;for(const s of rRe)s()}}async function $At(t,n){sf(t,n);const s=await t.json();if(!t.ok)throw new Error(typeof s.error=="string"?String(s.error):`Account request failed (${t.status}).`);return wye.parse(s)}async function NC(t,n,s){const c=await fetch(t,{method:n,...s===void 0?{}:{headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}}),d=await $At(c,`${n} ${t} failed`);return lR(d),d}function XLe(){return r$}function YLe(){return Xxr(r$)}function cN(){return BAt}function wpe(){return tRe}function Tye(t){return rRe.add(t),()=>rRe.delete(t)}async function sht(){try{const t=await $At(await fetch("/__editor/account"),"Account read failed");return lR(t),t}catch(t){throw lR(r$,t instanceof Error?t.message:String(t)),t}}const nwr=t=>NC("/__editor/account/mock-session","POST",{email:t}),iwr=t=>NC("/__editor/account/twin-session","POST",{email:t}),owr=()=>NC("/__editor/account/session","DELETE"),swr=t=>NC("/__editor/account/spend-policy","PUT",t),awr=()=>NC("/__editor/account/alerts/read","POST"),cwr=t=>NC("/__editor/account/execution-route","PUT",{route:t}),lwr=t=>NC("/__editor/account/coding-inference","PUT",t);async function uwr(t){const n=await fetch("/__editor/account/coding-inference/quote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});sf(n,"Coding quote failed");const s=await n.json();if(!n.ok||typeof s.model!="string"||typeof s.promptTokens!="number"||typeof s.outputTokens!="number"||typeof s.providerAmountUsd!="number"||typeof s.estimatedCredits!="number")throw new Error(typeof s.error=="string"?s.error:"Coding quote failed.");return s}const fwr=(t,n)=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"PUT",{key:n}),dwr=t=>NC(`/__editor/account/provider-credentials/${encodeURIComponent(t)}`,"DELETE");async function pwr(t){const n=await fetch(`/__editor/account/provider-credentials/${encodeURIComponent(t)}/test`,{method:"POST"});sf(n,"Credential test failed");const s=await n.json();if(!n.ok)throw new Error(typeof s.error=="string"?s.error:`Credential test failed (${n.status}).`);return Kxr.parse(s)}const aht=t=>NC("/__editor/account/plan","PUT",{action:t});async function qAt(t,n){const s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":crypto.randomUUID()},body:JSON.stringify(n)});sf(s,"Checkout failed");const c=await s.json();if(!s.ok||!c.account)throw new Error(typeof c.error=="string"?c.error:"Checkout failed.");return lR(wye.parse(c.account)),{...typeof c.checkoutUrl=="string"?{checkoutUrl:c.checkoutUrl}:{},mock:c.mock===!0}}const _wr=t=>qAt("/__editor/account/checkout",{plan:t}),mwr=t=>qAt("/__editor/account/credits",{packId:t});async function hwr(){const t=await fetch("/__editor/account/usage");sf(t,"Usage failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Usage failed.");return zxr.array().parse(n.entries??[])}async function gwr(){const t=await fetch("/__editor/account/catalog");sf(t,"Catalog failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Catalog failed.");return Vxr.parse(n)}async function ywr(){const t=await fetch("/__editor/account/billing-portal",{method:"POST"});sf(t,"Billing portal failed");const n=await t.json();if(!t.ok||typeof n.url!="string")throw new Error(typeof n.error=="string"?n.error:"Billing portal failed.");return{url:n.url,mock:n.mock===!0}}async function vwr(){const t=await fetch("/__editor/account/authorization-methods");sf(t,"Sign-in methods are unavailable");const n=await t.json();if(!t.ok||n.browser!==!0||typeof n.device!="boolean")throw new Error(typeof n.error=="string"?n.error:"Sign-in methods are unavailable.");return{browser:!0,device:n.device}}async function bwr(){const t=await fetch("/__editor/account/browser-authorization",{method:"POST"});sf(t,"Sign-in failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Sign-in failed.");return n}async function Swr(t){const n=await fetch(`/__editor/account/browser-authorization/${encodeURIComponent(t)}`);sf(n,"Sign-in failed");const s=await n.json();if(n.status===202)return!1;if(!n.ok||s.pending!==!1)throw new Error(typeof s.error=="string"?s.error:"Sign-in failed.");return lR(wye.parse(s.account)),!0}async function xwr(){const t=await fetch("/__editor/account/device-authorization",{method:"POST"});sf(t,"Sign-in failed");const n=await t.json();if(!t.ok)throw new Error(typeof n.error=="string"?n.error:"Sign-in failed.");return n}async function wwr(t){const n=await fetch(`/__editor/account/device-authorization/${encodeURIComponent(t)}`);sf(n,"Sign-in failed");const s=await n.json();if(n.status===202)return!1;if(!n.ok||s.pending!==!1)throw new Error(typeof s.error=="string"?s.error:"Sign-in failed.");return lR(wye.parse(s.account)),!0}function Twr(){if(L$)return()=>{};const t=new URLSearchParams(window.location.search).get("checkout_id");t?NC("/__editor/account/checkout/confirm","POST",{checkoutId:t}).then(()=>{const s=new URL(window.location.href);s.searchParams.delete("checkout"),s.searchParams.delete("checkout_id"),window.history.replaceState(null,"",`${s.pathname}${s.search}${s.hash}`)}).catch(s=>lR(r$,s instanceof Error?s.message:String(s))):sht().catch(()=>{});const n=window.setInterval(()=>void sht().catch(()=>{}),3e4);return()=>window.clearInterval(n)}function zAt(t){return t?UAt(t)?null:t:null}function Cwr(t,n){try{return t.ownerOf(n)}catch{return"unresolved"}}function VAt(t){return t&&UAt(t)?t:null}function UAt(t){return t.keyedBy==="display"}const Ign=Object.freeze(Object.defineProperty({__proto__:null,displayKeyedPhysics:VAt,nodeKeyedPhysics:zAt,physicsOwnerOf:Cwr},Symbol.toStringTag,{value:"Module"})),Ewr={"source-prop":!0,"source-structure":!0,"construction-literal":!0,"physics-binding":!0,"data-record":!0,"live-only":!0},ZLe=Object.keys(Ewr);function kwr(){const t={};for(const n of ZLe)t[n]=0;return t}const Awr={provenance:!0,selection:!0,transforms:!0,inspector:!0,assetSubject:!0,related:!0,instances:!0,structure:!0,persistence:!0,pickable:!0,rects:!0,boxEdit:!0,text:!0,colorSample:!0,stories:!0,truth:!0,spatialHandles:!0,assetDrop:!0,subscribe:!0},QLe=Object.keys(Awr);function Dwr(t){const n={};for(const s of QLe)n[s]=t[s]!==void 0;return n}const Ngn=Object.freeze(Object.defineProperty({__proto__:null,AUTHORING_PROVIDER_KEYS:QLe,WRITE_ANCHOR_KINDS:ZLe,emptyWriteAnchorKindCounts:kwr,measureAuthoringProviders:Dwr},Symbol.toStringTag,{value:"Module"})),Pwr=["claim","shape","operation","effect","round-trip"],Hme={claim:0,shape:1,operation:2,effect:3,"round-trip":4};function JAt(t,n){return Hme[t]>=Hme[n]}function rQ(t){const{seam:n,subject:s,epoch:c,required:d}=t;if(t.notApplicable!==void 0)return{seam:n,subject:s,epoch:c,required:d,state:"not-applicable",receipt:null,detail:t.notApplicable};let m=null;for(const g of t.receipts)g.seam!==n||g.subject!==s||g.epoch!==c||(!m||Hme[g.stage]>=Hme[m.stage])&&(m=g);return m?m.outcome==="fail"?{seam:n,subject:s,epoch:c,required:d,state:"failed",receipt:m,detail:m.detail}:m.outcome==="absent"?{seam:n,subject:s,epoch:c,required:d,state:"absent",receipt:m,detail:m.detail}:JAt(m.stage,d)?{seam:n,subject:s,epoch:c,required:d,state:"verified",receipt:m,detail:m.detail}:{seam:n,subject:s,epoch:c,required:d,state:"unverified",receipt:m,detail:`${m.detail}; this proves ${m.stage}, but this seam requires ${d}`}:{seam:n,subject:s,epoch:c,required:d,state:"unverified",receipt:null,detail:`no current-epoch evidence has reached the required ${d} stage`}}class WAt{#e=[];record(n){if(!n.seam||!n.subject||!n.epoch||!n.detail.trim())throw new Error("seam evidence requires non-empty seam, subject, epoch, and detail");this.#e.push(n)}receipts(n){return this.#e.filter(s=>(n?.subject===void 0||s.subject===n.subject)&&(n?.epoch===void 0||s.epoch===n.epoch))}verdict(n){return rQ({...n,receipts:this.#e})}clearSubject(n){for(let s=this.#e.length-1;s>=0;s-=1)this.#e[s]?.subject===n&&this.#e.splice(s,1)}clear(){this.#e.length=0}}function Pp(){return t=>t}function Iwr(t){if(t.value===void 0)return{seam:t.seam,subject:t.subject,epoch:t.epoch,stage:"shape",outcome:t.optional?"absent":"fail",source:"shape-check",detail:t.optional?`${t.seam} is not exposed by this subject`:`${t.seam} is required by the contract but is absent`};const n=typeof t.value,s=t.kind==="function"?n==="function":n!=="function";return{seam:t.seam,subject:t.subject,epoch:t.epoch,stage:"shape",outcome:s?"pass":"fail",source:"shape-check",detail:s?`${t.seam} has the contract's ${t.kind} shape`:`${t.seam} is ${n}; the contract requires a ${t.kind}`}}function vB(t){const n=[],s=t.value!==null&&(typeof t.value=="object"||typeof t.value=="function")?t.value:null,c=Object.entries(t.shape);for(const[d,m]of c){const g=`${t.prefix}.${d}`,S=s?.[d];n.push(Iwr({seam:g,subject:t.subject,epoch:t.epoch,value:S,optional:m.optional,kind:m.kind}))}return n}function Gme(t){const n=rQ(t);if(n.state==="absent"||n.state==="failed"||!t.shape)return n;for(const[s,c]of Object.entries(t.shape)){const d=rQ({seam:`${t.seam}.${s}`,subject:t.subject,epoch:t.epoch,required:c.required,receipts:t.receipts});if(!(c.optional&&d.state==="absent")){if(d.state==="failed"||d.state==="absent")return{...n,state:"failed",receipt:d.receipt,detail:`${t.seam} is malformed: ${d.detail}`};if(d.state!=="verified")return{...n,state:"unverified",detail:`${t.seam} has the required shape, but ${d.seam} is unverified: ${d.detail}`}}}return n}const Ogn=Object.freeze(Object.defineProperty({__proto__:null,SEAM_PROOF_STAGES:Pwr,SeamEvidenceLedger:WAt,defineSeamShape:Pp,gradeSeamCarrier:Gme,gradeSeamEvidence:rQ,inspectSeamShape:vB,seamStageAtLeast:JAt},Symbol.toStringTag,{value:"Module"})),XY=Pp()({capabilities:{optional:!1,kind:"value",required:"shape"},provenance:{optional:!0,kind:"value",required:"shape"},hierarchy:{optional:!1,kind:"value",required:"operation"},selection:{optional:!0,kind:"value",required:"effect"},transforms:{optional:!0,kind:"value",required:"effect"},inspector:{optional:!0,kind:"value",required:"effect"},assetSubject:{optional:!0,kind:"value",required:"operation"},related:{optional:!0,kind:"value",required:"operation"},instances:{optional:!0,kind:"value",required:"effect"},structure:{optional:!0,kind:"value",required:"round-trip"},persistence:{optional:!0,kind:"value",required:"round-trip"},pickable:{optional:!0,kind:"value",required:"operation"},rects:{optional:!0,kind:"value",required:"operation"},boxEdit:{optional:!0,kind:"value",required:"effect"},text:{optional:!0,kind:"value",required:"effect"},colorSample:{optional:!0,kind:"value",required:"operation"},stories:{optional:!0,kind:"value",required:"effect"},truth:{optional:!0,kind:"value",required:"operation"},spatialHandles:{optional:!0,kind:"value",required:"effect"},assetDrop:{optional:!0,kind:"value",required:"round-trip"},subscribe:{optional:!0,kind:"function",required:"effect"}}),nRe=Pp()({roots:{optional:!1,kind:"function",required:"operation"},node:{optional:!1,kind:"function",required:"operation"},crossSurfaceStructureSignature:{optional:!0,kind:"function",required:"operation"},object3D:{optional:!0,kind:"function",required:"operation"},idForObject3D:{optional:!0,kind:"function",required:"operation"}}),HAt=Pp()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},resolve:{optional:!0,kind:"function",required:"operation"}}),GAt=Pp()({dimensions:{optional:!0,kind:"function",required:"operation"},get:{optional:!1,kind:"function",required:"operation"},editability:{optional:!0,kind:"function",required:"operation"},beginEdit:{optional:!1,kind:"function",required:"effect"},apply:{optional:!1,kind:"function",required:"effect"},endEdit:{optional:!1,kind:"function",required:"effect"},remove:{optional:!0,kind:"function",required:"round-trip"},sourceCommit:{optional:!0,kind:"value",required:"round-trip"}}),KAt=Pp()({properties:{optional:!1,kind:"function",required:"operation"},get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"},preview:{optional:!0,kind:"function",required:"effect"},editability:{optional:!0,kind:"function",required:"operation"},remove:{optional:!0,kind:"function",required:"round-trip"}}),XAt=Pp()({get:{optional:!1,kind:"function",required:"operation"},entries:{optional:!0,kind:"function",required:"operation"}}),YAt=Pp()({links:{optional:!1,kind:"function",required:"operation"}}),ZAt=Pp()({describe:{optional:!1,kind:"function",required:"operation"},openComponent:{optional:!0,kind:"function",required:"effect"},revert:{optional:!1,kind:"function",required:"round-trip"},applyToComponent:{optional:!1,kind:"function",required:"round-trip"}}),QAt=Pp()({create:{optional:!1,kind:"function",required:"round-trip"},remove:{optional:!1,kind:"function",required:"round-trip"},duplicate:{optional:!1,kind:"function",required:"round-trip"},duplicateMany:{optional:!0,kind:"function",required:"round-trip"},reparent:{optional:!1,kind:"function",required:"round-trip"},reorder:{optional:!0,kind:"function",required:"round-trip"},creatableKinds:{optional:!0,kind:"function",required:"operation"},wrap:{optional:!0,kind:"function",required:"round-trip"},unwrap:{optional:!0,kind:"function",required:"round-trip"},group:{optional:!0,kind:"function",required:"round-trip"},ungroup:{optional:!0,kind:"function",required:"round-trip"},canUngroup:{optional:!0,kind:"function",required:"operation"},removeMany:{optional:!0,kind:"function",required:"round-trip"},copy:{optional:!0,kind:"function",required:"effect"},canCopy:{optional:!0,kind:"function",required:"operation"},cut:{optional:!0,kind:"function",required:"round-trip"},paste:{optional:!0,kind:"function",required:"round-trip"},canPaste:{optional:!0,kind:"function",required:"operation"}}),e3t=Pp()({isDirty:{optional:!1,kind:"function",required:"operation"},lastError:{optional:!0,kind:"function",required:"operation"},save:{optional:!1,kind:"function",required:"round-trip"},destination:{optional:!1,kind:"value",required:"shape"},applyExternal:{optional:!0,kind:"function",required:"effect"}}),t3t=Pp()({pick:{optional:!1,kind:"function",required:"operation"},candidates:{optional:!0,kind:"function",required:"operation"}}),r3t=Pp()({storiesFor:{optional:!1,kind:"function",required:"operation"},active:{optional:!1,kind:"function",required:"operation"},apply:{optional:!1,kind:"function",required:"effect"},isolate:{optional:!0,kind:"function",required:"effect"},title:{optional:!0,kind:"value",required:"shape"},unavailable:{optional:!0,kind:"function",required:"operation"}}),n3t=Pp()({accepts:{optional:!1,kind:"function",required:"operation"},drop:{optional:!1,kind:"function",required:"round-trip"}}),i3t=Pp()({rect:{optional:!1,kind:"function",required:"operation"},contextRects:{optional:!0,kind:"function",required:"operation"},emptyContainers:{optional:!0,kind:"function",required:"operation"},frame:{optional:!0,kind:"function",required:"operation"}}),o3t=Pp()({begin:{optional:!1,kind:"function",required:"effect"},apply:{optional:!1,kind:"function",required:"effect"},end:{optional:!1,kind:"function",required:"effect"},gizmoOrigin:{optional:!0,kind:"function",required:"operation"},referencePoint:{optional:!0,kind:"function",required:"operation"}}),s3t=Pp()({get:{optional:!1,kind:"function",required:"operation"},set:{optional:!1,kind:"function",required:"effect"}}),a3t=Pp()({backgroundChainAt:{optional:!1,kind:"function",required:"operation"}}),c3t=Pp()({resolve:{optional:!1,kind:"function",required:"operation"}}),l3t=Pp()({layers:{optional:!1,kind:"function",required:"operation"},preview:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"round-trip"}}),iRe={selection:HAt,transforms:GAt,inspector:KAt,assetSubject:XAt,related:YAt,instances:ZAt,structure:QAt,persistence:e3t,pickable:t3t,rects:i3t,boxEdit:o3t,text:s3t,colorSample:a3t,stories:r3t,truth:c3t,spatialHandles:l3t,assetDrop:n3t},Rgn=Object.freeze(Object.defineProperty({__proto__:null,ASSET_DROP_PROVIDER_SHAPE:n3t,ASSET_SUBJECT_PROVIDER_SHAPE:XAt,AUTHORING_ADAPTER_SHAPE:XY,AUTHORING_PROVIDER_SHAPES:iRe,BOX_EDIT_PROVIDER_SHAPE:o3t,COLOR_SAMPLE_PROVIDER_SHAPE:a3t,COMPONENT_INSTANCES_PROVIDER_SHAPE:ZAt,HIERARCHY_PROVIDER_SHAPE:nRe,INSPECTOR_PROVIDER_SHAPE:KAt,PERSISTENCE_PROVIDER_SHAPE:e3t,PICK_PROVIDER_SHAPE:t3t,RECT_PROVIDER_SHAPE:i3t,RELATED_SUBJECTS_PROVIDER_SHAPE:YAt,SELECTION_PROVIDER_SHAPE:HAt,SPATIAL_HANDLES_PROVIDER_SHAPE:l3t,STORIES_PROVIDER_SHAPE:r3t,STRUCTURE_PROVIDER_SHAPE:QAt,TEXT_PROVIDER_SHAPE:s3t,TRANSFORM_PROVIDER_SHAPE:GAt,TRUTH_PROVIDER_SHAPE:c3t},Symbol.toStringTag,{value:"Module"})),oRe=Pp()({physics:{optional:!0,kind:"value",required:"effect"},networking:{optional:!0,kind:"value",required:"operation"},navigation:{optional:!0,kind:"value",required:"operation"},audio:{optional:!0,kind:"value",required:"effect"},camera:{optional:!0,kind:"value",required:"effect"},debug:{optional:!0,kind:"value",required:"operation"},renderDebug:{optional:!0,kind:"value",required:"effect"}}),u3t=Pp()({keyedBy:{optional:!0,kind:"value",required:"shape"},ownerOf:{optional:!1,kind:"function",required:"operation"},freeze:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"effect"},unfreeze:{optional:!1,kind:"function",required:"effect"},debugDraw:{optional:!0,kind:"function",required:"operation"},setDebugDrawEnabled:{optional:!0,kind:"function",required:"effect"},contactPoints:{optional:!0,kind:"function",required:"operation"},colliders:{optional:!0,kind:"function",required:"operation"},previewCollider:{optional:!0,kind:"function",required:"effect"},joints:{optional:!0,kind:"function",required:"operation"},previewJointAnchor:{optional:!0,kind:"function",required:"effect"}}),f3t=Pp()({keyedBy:{optional:!1,kind:"value",required:"shape"},ownerOf:{optional:!1,kind:"function",required:"operation"},freeze:{optional:!1,kind:"function",required:"effect"},commit:{optional:!1,kind:"function",required:"effect"},unfreeze:{optional:!1,kind:"function",required:"effect"}}),d3t=Pp()({peers:{optional:!1,kind:"function",required:"operation"},networkId:{optional:!1,kind:"function",required:"operation"},authority:{optional:!1,kind:"function",required:"operation"},editable:{optional:!1,kind:"function",required:"operation"},getConnectionState:{optional:!0,kind:"function",required:"operation"},getRoomInfo:{optional:!0,kind:"function",required:"operation"},getReplicationStats:{optional:!0,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"},getStateSnapshot:{optional:!0,kind:"function",required:"operation"},messageEvents:{optional:!0,kind:"function",required:"operation"},getRates:{optional:!0,kind:"function",required:"operation"},getConditioning:{optional:!0,kind:"function",required:"operation"},setConditioning:{optional:!0,kind:"function",required:"effect"},getServerConfig:{optional:!0,kind:"function",required:"operation"},getPlayerIdentity:{optional:!0,kind:"function",required:"operation"},setPlayerIdentity:{optional:!0,kind:"function",required:"effect"},getTrafficByType:{optional:!0,kind:"function",required:"operation"},sendMessage:{optional:!0,kind:"function",required:"effect"},getConditioningLimits:{optional:!0,kind:"function",required:"operation"},ping:{optional:!0,kind:"function",required:"effect"},inspectServer:{optional:!0,kind:"function",required:"operation"},disconnectClient:{optional:!0,kind:"function",required:"effect"},editServerState:{optional:!0,kind:"function",required:"effect"},deleteServerState:{optional:!0,kind:"function",required:"effect"},sendToClient:{optional:!0,kind:"function",required:"effect"},broadcast:{optional:!0,kind:"function",required:"effect"},disposeRoom:{optional:!0,kind:"function",required:"effect"},stateFieldType:{optional:!0,kind:"function",required:"operation"},clearTraffic:{optional:!0,kind:"function",required:"effect"},getTrafficByEntity:{optional:!0,kind:"function",required:"operation"},isRecording:{optional:!0,kind:"function",required:"operation"},setRecording:{optional:!0,kind:"function",required:"effect"}}),p3t=Pp()({hasNavMesh:{optional:!1,kind:"function",required:"operation"},findPath:{optional:!1,kind:"function",required:"effect"},debugMesh:{optional:!1,kind:"function",required:"operation"},bake:{optional:!0,kind:"function",required:"effect"},exportData:{optional:!0,kind:"function",required:"operation"},clear:{optional:!0,kind:"function",required:"effect"},crowdAgents:{optional:!0,kind:"function",required:"operation"}}),_3t=Pp()({resume:{optional:!0,kind:"function",required:"effect"},setMuted:{optional:!1,kind:"function",required:"effect"},isMuted:{optional:!1,kind:"function",required:"operation"},graphSnapshot:{optional:!0,kind:"function",required:"operation"},transportState:{optional:!0,kind:"function",required:"operation"},acquireMeters:{optional:!0,kind:"function",required:"effect"},acquireRecordingStream:{optional:!0,kind:"function",required:"effect"},renderOffline:{optional:!0,kind:"function",required:"operation"},audioEvents:{optional:!0,kind:"function",required:"operation"}}),m3t=Pp()({snapshot:{optional:!1,kind:"function",required:"operation"},subscribe:{optional:!1,kind:"function",required:"effect"}}),h3t=Pp()({providers:{optional:!1,kind:"function",required:"operation"},state:{optional:!1,kind:"function",required:"operation"},stateAll:{optional:!1,kind:"function",required:"operation"},commands:{optional:!1,kind:"function",required:"operation"},invoke:{optional:!1,kind:"function",required:"effect"},events:{optional:!1,kind:"function",required:"operation"}}),g3t=Pp()({captureFrame:{optional:!1,kind:"function",required:"effect"},memorySnapshot:{optional:!0,kind:"function",required:"operation"}}),y3t={networking:d3t,navigation:p3t,audio:_3t,camera:m3t,debug:h3t,renderDebug:g3t},Fgn=Object.freeze(Object.defineProperty({__proto__:null,AUDIO_ADAPTER_SHAPE:_3t,CAMERA_ADAPTER_SHAPE:m3t,DEBUG_ADAPTER_SHAPE:h3t,NAVIGATION_ADAPTER_SHAPE:p3t,NETWORKING_ADAPTER_SHAPE:d3t,PHYSICS_2D_ADAPTER_SHAPE:f3t,PHYSICS_ADAPTER_SHAPE:u3t,RENDER_DEBUG_ADAPTER_SHAPE:g3t,SYSTEM_ADAPTERS_SHAPE:oRe,SYSTEM_PROVIDER_SHAPES:y3t},Symbol.toStringTag,{value:"Module"})),eBe=new WAt;function Nwr(t){eBe.record(t)}const cht=new WeakMap;let Owr=1;function v3t(t){const n=cht.get(t);if(n)return n;const s=`system-${Owr++}`;return cht.set(t,s),s}function Rwr(t){const n=t.epoch??v3t(t.adapter),s=`system.${t.slot}`,c={[t.slot]:t.adapter},d=t.slot==="physics"?VAt(t.adapter)?f3t:u3t:y3t[t.slot],m=[...vB({prefix:"system",value:c,shape:oRe,subject:t.subject,epoch:n}).filter(g=>g.seam===s),...vB({prefix:s,value:t.adapter,shape:d,subject:t.subject,epoch:n}),...eBe.receipts({subject:t.subject,epoch:n}),...t.receipts??[]];return Gme({seam:s,subject:t.subject,epoch:n,required:oRe[t.slot].required,receipts:m,shape:d})}let qS={},nQ=null,tBe=null;const Kme=new Set,Xme=new Set,sRe=new Set;let rBe=0;function aRe(){for(const t of sRe)t()}function Yme(t){if(t!==Eye())for(const n of Kme)n()}function Zme(t,n){const s=Aye();if(!(t===kye()&&n.length===s.length&&n.every((c,d)=>c===s[d]))){rBe++;for(const c of Xme)c()}}const LS=new Map;let S_e=null,b3t=0;const cRe=new Set,nBe="";function S3t(t,n){const s=["physics","networking","navigation","audio","camera","debug","renderDebug"];for(const c of s){const d=t[c];if(!d)continue;const m=Rwr({slot:c,adapter:d,subject:n||"game"});if(m.state==="failed")throw new Error(`system adapter refused: ${m.detail}`)}}function ZI(){return S_e!==null&&LS.has(S_e)?S_e:LS.keys().next().value??null}function Qme(){b3t++;for(const t of cRe)t()}function Fwr(t){const n=ZI();if(S_e=t,n!==ZI()){Qme(),rBe++;for(const s of Kme)s();for(const s of Xme)s()}}function Mgn(){return ZI()}function Mwr(t){return cRe.add(t),()=>cRe.delete(t)}function jgn(){return b3t}function Cye(){const t=ZI();return(t===null?void 0:LS.get(t))??qS}function jwr(t,n=nBe){const s=ZI(),c=Eye(),d=kye(),m=Aye();if(t){S3t(t,n),LS.set(n,t),qS=t,Yme(c),Zme(d,m),aRe(),s!==ZI()&&Qme();return}LS.delete(n),qS=LS.values().next().value??{},Yme(c),Zme(d,m),aRe(),s!==ZI()&&Qme()}function Lwr(){for(const t of[...LS.keys()])jwr(null,t);Fwr(null)}function Lgn(t,n=nBe){const s=Eye(),c=kye(),d=Aye(),m=LS.get(n);S3t(t,n),LS.set(n,t),qS===m&&(qS=t),Yme(s),Zme(c,d),aRe(),ZI()===n&&Qme()}function Bgn(){return qS}function Bwr(t){return sRe.add(t),()=>sRe.delete(t)}function $wr(){return[...LS.keys()]}function lht(t){const n=t.filter(d=>d!==nBe),s=t.length>n.length,c=n.map(d=>`"${d}"`);return s&&c.push("the unnamed default (address it with no id at all)"),c.join(", ")}class uht extends Error{instances;constructor(n,s){super(n),this.name="InstanceResolutionError",this.instances=s}}function qwr(t){const n=$wr();if(t!==void 0){const s=LS.get(t);if(s)return s;throw new uht(n.length===0?`no instance "${t}" — no game is mounted`:`no instance "${t}" — live: ${lht(n)}`,n)}if(n.length===1)return LS.get(n[0]);if(n.length===0)return qS;throw new uht(`${n.length} instances are live (${lht(n)}) — name one in your program (\`game.instance(id)\`, or \`await game.instances()\` for handles); refusing to guess`,n)}function $gn(){return zAt(qS.physics)}function zwr(){return qS.camera??null}function Eye(){return qS.networking??tBe??null}function Vwr(){return Cye().networking??tBe??null}function Uwr(t){return Kme.add(t),()=>Kme.delete(t)}function qgn(t){const n=Eye();tBe=t,Yme(n)}function zgn(){return qS.debug??null}function Vgn(t){const n=kye(),s=Aye();nQ=t,Zme(n,s)}function kye(){return qS.audio??nQ}function Jwr(){return Cye().audio??nQ}function Wwr(t){return Xme.add(t),()=>Xme.delete(t)}function Hwr(){return rBe}function Aye(){const t=new Set;for(const n of LS.values())n.audio&&t.add(n.audio);return t.size===0&&nQ&&t.add(nQ),[...t]}function Gwr(){return qS.renderDebug??null}function Ugn(){return Cye().renderDebug??null}let x3t=null;const lRe=new Set;function Jgn(t){x3t=t;for(const n of lRe)n()}function Dye(){return x3t?.()??null}function Pye(t){lRe.add(t);const n=Mwr(t);return()=>{lRe.delete(t),n()}}function lN(){const t=Dye();return t?`play:${t.instanceId}`:"stopped"}function Iye(t,n){let s=!1,c=[];const d=()=>{s=!1;const g=c;c=[];for(let S=g.length-1;S>=0;S--)g[S]()};return{ensure(g){if(!s){s=!0;try{g(S=>c.push(S))}catch(S){throw d(),S}}},reset:d}}let xO=[],Kwr=0,w3t=0;const uRe=new Set;function fht(){w3t++;for(const t of uRe)t()}function T3t(t){return uRe.add(t),()=>{uRe.delete(t)}}function dht(){return w3t}function Z4(t){if(xO.some(s=>s.contribution.id===t.id))throw new Error(`registerWorkspaceStatus: id "${t.id}" is already registered — status ids key status-bar slots, so they must be unique; unregister the previous contribution first.`);const n={contribution:t,seq:Kwr++};return xO=[...xO,n],fht(),()=>{xO.includes(n)&&(xO=xO.filter(s=>s!==n),fht())}}function fRe(t){const n=s=>[...xO].filter(c=>(c.contribution.align??"left")===s).sort((c,d)=>(c.contribution.order??0)-(d.contribution.order??0)||c.seq-d.seq).map(c=>c.contribution);return t?n(t):[...n("left"),...n("right")]}let x_e=null,C3t=0;const dRe=new Set;function pht(){C3t++;for(const t of dRe)t()}function E3t(t){return dRe.add(t),()=>dRe.delete(t)}function pRe(){return C3t}function iBe(){return x_e}function Xwr(t){const n=Symbol(t.documentId);return x_e={...t,token:n},pht(),()=>{x_e?.token===n&&(x_e=null,pht())}}function Ywr(){Ye.useSyncExternalStore(E3t,pRe);const t=iBe();return t?.status?$.jsx("span",{className:"volter-status-copy","data-testid":"status-asset-editor","data-status-tone":"muted",children:t.status}):null}const Zwr=Iye();function Qwr(){Zwr.ensure(t=>{t(Z4({id:"asset-editor-status",name:"Asset editor",align:"left",order:40,Content:Ywr}))})}Qwr();let bB=null,k3t=0;const _Re=new Set;function _ht(){k3t+=1;for(const t of _Re)t()}function eTr(t){return _Re.add(t),()=>{_Re.delete(t)}}function mht(){return k3t}function tTr(t,n){const s=Symbol(t);return bB={documentId:t,readSubject:n,token:s},_ht(),()=>{bB?.token===s&&(bB=null,_ht())}}function mRe(){return bB===null?null:{documentId:bB.documentId,subject:bB.readSubject()}}const uN=new Map,hRe=new Map;function A3t(){typeof window>"u"||window.parent===window||uN.size===0||window.parent.postMessage({type:"volter:viewport-ready",documents:[...uN.keys()]},"*")}typeof window<"u"&&window.parent!==window&&window.addEventListener("message",t=>{t.source===window.parent&&t.data?.type==="volter:request-viewport-ready"&&A3t()});let Oc=null,oBe=null;function sBe(){if(typeof window>"u")return!1;const t=window.__VOLTER_VIEWPORT_TIMINGS__;if(t===!0||t==="1")return!0;try{return new URLSearchParams(window.location.search).get("volterTimings")==="1"}catch{return!1}}function D3t(t,n,s){return{documentId:t,visibilityState:typeof document>"u"?"unavailable":document.visibilityState,startedAtMs:n,reactActiveAtMs:null,boardBuildStartedAtMs:null,boardReadyAtMs:null,constructStartedAtMs:null,viewportReadyAtMs:null,rafResumeAtMs:null,firstRenderStartedAtMs:null,workspaceSyncMs:0,revealScheduleMs:0,componentIndexMs:0,componentIndexBusyMs:0,componentIndexWaitMs:0,candidateCollectMs:0,storyMountTotalMs:0,boundsMs:0,layoutMs:0,assembleMs:0,webglContextMs:0,rendererMs:0,adapterSetupMs:0,iblBakeMs:0,dressingMs:0,editorViewportMs:0,framingMs:0,resizeBindMs:0,viewportBindMs:0,firstRenderMs:0,candidateCount:0,exhibitCount:0,skippedCount:0,modulesAlreadyLoaded:s.modulesAlreadyLoaded===!0,stories:[]}}function rTr(t){let n=0,s=0;for(const c of t)n+=Math.max(0,c.runtimeMs)+Math.max(0,c.fiberMs),s+=Math.max(0,c.loadMs)+Math.max(0,c.settleMs);return{busyMs:n,waitMs:s}}function nTr(t,n){const s=t.reactActiveAtMs===null?0:Math.max(0,t.reactActiveAtMs-t.startedAtMs),c=t.reactActiveAtMs??t.startedAtMs,d=t.boardBuildStartedAtMs,m=d===null?0:Math.max(0,d-c),g=t.boardReadyAtMs===null||t.constructStartedAtMs===null?0:Math.max(0,t.constructStartedAtMs-t.boardReadyAtMs),S=t.viewportReadyAtMs??t.rafResumeAtMs,k=t.firstRenderStartedAtMs??n,A=S===null?0:Math.max(0,k-S),F=S===null?Math.max(0,n-t.startedAtMs):Math.max(0,n-S),D=rTr(t.stories),J=t.boardBuildStartedAtMs===null?"switch-back":"first-open",G=iTr({workspaceSyncMs:s,revealScheduleMs:m,componentIndexMs:t.componentIndexMs,componentIndexBusyMs:t.componentIndexBusyMs,componentIndexWaitMs:t.componentIndexWaitMs,candidateCollectMs:t.candidateCollectMs,storyMountTotalMs:t.storyMountTotalMs,storyMountBusyMs:D.busyMs,storyMountWaitMs:D.waitMs,boundsMs:t.boundsMs,layoutMs:t.layoutMs,assembleMs:t.assembleMs,reactCommitMs:g,webglContextMs:t.webglContextMs,rendererMs:t.rendererMs,adapterSetupMs:t.adapterSetupMs,iblBakeMs:t.iblBakeMs,dressingMs:t.dressingMs,editorViewportMs:t.editorViewportMs,framingMs:t.framingMs,resizeBindMs:t.resizeBindMs,viewportBindMs:t.viewportBindMs,rafWaitMs:A,firstRenderMs:t.firstRenderMs}).reduce((pe,ue)=>pe+ue.ms,0),se=Math.max(0,n-t.startedAtMs);return{visibilityState:t.visibilityState,startedAtMs:t.startedAtMs,reactActiveAtMs:t.reactActiveAtMs,boardBuildStartedAtMs:t.boardBuildStartedAtMs,boardReadyAtMs:t.boardReadyAtMs,constructStartedAtMs:t.constructStartedAtMs,viewportReadyAtMs:t.viewportReadyAtMs,rafResumeAtMs:t.rafResumeAtMs,firstRenderStartedAtMs:t.firstRenderStartedAtMs,firstFrameAtMs:n,activationKind:J,workspaceSyncMs:s,revealScheduleMs:m,componentIndexMs:t.componentIndexMs,candidateCollectMs:t.candidateCollectMs,storyMountTotalMs:t.storyMountTotalMs,storyMountBusyMs:D.busyMs,storyMountWaitMs:D.waitMs,boundsMs:t.boundsMs,layoutMs:t.layoutMs,assembleMs:t.assembleMs,reactCommitMs:g,webglContextMs:t.webglContextMs,rendererMs:t.rendererMs,adapterSetupMs:t.adapterSetupMs,iblBakeMs:t.iblBakeMs,dressingMs:t.dressingMs,editorViewportMs:t.editorViewportMs,framingMs:t.framingMs,resizeBindMs:t.resizeBindMs,viewportBindMs:t.viewportBindMs,rafWaitMs:A,firstRenderMs:t.firstRenderMs,firstPaintMs:F,unattributedMs:Math.max(0,se-G),accountedMs:G,candidateCount:t.candidateCount,exhibitCount:t.exhibitCount,skippedCount:t.skippedCount,modulesAlreadyLoaded:t.modulesAlreadyLoaded,stories:t.stories,storyDiscovery:oBe}}function Zb(t,n){const s=Math.max(0,n);return{name:t,ms:s,busyMs:s,waitMs:0,kind:"cpu"}}function Tpe(t,n){const s=Math.max(0,n);return{name:t,ms:s,busyMs:0,waitMs:s,kind:"idle"}}function hht(t,n,s,c){const d=Math.max(0,n);let m=Math.max(0,s),g=Math.max(0,c);if(m+g>d){const S=d/(m+g);m*=S,g*=S}else m+g<d&&(g+=d-m-g);return{name:t,ms:d,busyMs:m,waitMs:g,kind:"mixed"}}function iTr(t){return[Tpe("workspace-sync",t.workspaceSyncMs),Tpe("reveal-schedule",t.revealScheduleMs),hht("component-index",t.componentIndexMs,t.componentIndexBusyMs,t.componentIndexWaitMs>0||t.componentIndexMs===0?t.componentIndexWaitMs:t.componentIndexMs),Zb("candidate-collect",t.candidateCollectMs),hht("story-mounts",t.storyMountTotalMs,t.storyMountBusyMs,t.storyMountWaitMs),Zb("bounds",t.boundsMs),Zb("layout",t.layoutMs),Zb("assemble",t.assembleMs),Tpe("react-commit (board→viewport)",t.reactCommitMs),Zb("webgl-context",t.webglContextMs),Zb("renderer",t.rendererMs),Zb("adapter-setup",t.adapterSetupMs),Zb("ibl-bake (three PMREM)",t.iblBakeMs),Zb("dressing",t.dressingMs),Zb("editor-viewport",t.editorViewportMs),Zb("framing",t.framingMs),Zb("resize-bind",t.resizeBindMs),Zb("viewport-bind",t.viewportBindMs),Tpe("raf-wait",t.rafWaitMs),Zb("first-render",t.firstRenderMs)]}function Wgn(t,n=Date.now()){const s=(hRe.get(t)??0)+1;hRe.set(t,s);const c={documentId:t,activation:s,firstFrameAtMs:n},d=Oc;if(d&&d.documentId===t){const m={...c,breakdown:nTr(d,n)};return Oc=null,uN.set(t,m),yht(),ght(),m}return uN.set(t,c),yht(),ght(),c}let gRe=new Set;const yRe=new Set;function ght(){A3t();for(const t of yRe)t()}function oTr(t){return yRe.add(t),()=>yRe.delete(t)}function yht(){uN.size!==0&&P3t()}function P3t(){const t=gRe;gRe=new Set;for(const n of t)n()}let vht=!1;function sTr(){vht||typeof document>"u"||(vht=!0,document.addEventListener("visibilitychange",()=>{document.hidden&&P3t()}))}function Nye(){return uN.size>0||typeof document<"u"&&document.hidden?Promise.resolve():(sTr(),new Promise(t=>gRe.add(t)))}function aTr(){return[...uN.values()]}function cTr(t){sBe()&&(Oc=D3t(t,Date.now(),{}))}function Hgn(t,n={}){if(!sBe())return;const s=Date.now();if(Oc&&Oc.documentId===t){Oc.boardBuildStartedAtMs===null&&(Oc.boardBuildStartedAtMs=s),n.modulesAlreadyLoaded===!0&&(Oc.modulesAlreadyLoaded=!0);return}Oc=D3t(t,s,n),Oc.boardBuildStartedAtMs=s}function Ggn(t){Oc&&(t&&Oc.documentId!==t||(Oc=null))}function Kgn(t,n,s){if(!Oc)return;const c=Math.max(0,n);switch(t){case"component-index":Oc.componentIndexMs=c,Oc.componentIndexBusyMs=Math.max(0,s?.busyMs??0),Oc.componentIndexWaitMs=Math.max(0,s?.waitMs??c);break;case"candidate-collect":Oc.candidateCollectMs=c;break;case"story-mounts":Oc.storyMountTotalMs=c;break;case"bounds":Oc.boundsMs=c;break;case"layout":Oc.layoutMs=c;break;case"assemble":Oc.assembleMs=c;break;case"webgl-context":Oc.webglContextMs=c;break;case"renderer":Oc.rendererMs=c;break;case"adapter-setup":Oc.adapterSetupMs=c;break;case"ibl-bake":Oc.iblBakeMs=c;break;case"dressing":Oc.dressingMs=c;break;case"editor-viewport":Oc.editorViewportMs=c;break;case"framing":Oc.framingMs=c;break;case"resize-bind":Oc.resizeBindMs=c;break;case"viewport-bind":Oc.viewportBindMs=c;break;case"first-render":Oc.firstRenderMs=c;break}}function Xgn(t){!Oc||Oc.documentId!==t||Oc.reactActiveAtMs===null&&(Oc.reactActiveAtMs=Date.now())}function Ygn(t){!Oc||Oc.documentId!==t||Oc.rafResumeAtMs===null&&(Oc.rafResumeAtMs=Date.now())}function Zgn(t){!Oc||Oc.documentId!==t||Oc.firstRenderStartedAtMs===null&&(Oc.firstRenderStartedAtMs=Date.now())}function Qgn(t){Oc&&(t.candidateCount!==void 0&&(Oc.candidateCount=t.candidateCount),t.exhibitCount!==void 0&&(Oc.exhibitCount=t.exhibitCount),t.skippedCount!==void 0&&(Oc.skippedCount=t.skippedCount))}function eyn(){Oc&&(Oc.boardReadyAtMs=Date.now())}function tyn(){Oc&&(Oc.constructStartedAtMs=Date.now())}function ryn(){Oc&&(Oc.viewportReadyAtMs=Date.now())}function nyn(t){Oc&&Oc.stories.push(t)}function iyn(){return Oc?.documentId??null}function lTr(t){sBe()&&(oBe=t)}function uTr(){uN.clear(),hRe.clear(),Oc=null,oBe=null}const fTr=["scene","game","world","story","asset","behavior","generation","content-browser","project-tool","tool-contribution","document"];let hp=[],zk=null,n2=null,iQ=null,uR=null;function bht(t){queueMicrotask(()=>{uR===t&&hp.some(n=>n.descriptor.id===t)&&(uR=null,X0(t))})}let I3t=0;const vRe=new Set,w5e=new Set,aBe=new Map,XO=new Map;function TC(){I3t++;for(const t of vRe)t()}function i2(t){return vRe.add(t),()=>{vRe.delete(t)}}function X1(){return I3t}function l0(){return hp}function e_(){return n2}function bRe(){return iQ}function dTr(t,n){X0(t)&&iQ!==n&&(iQ=n,TC())}function CC(){return hp.find(t=>t.descriptor.id===n2)??null}function oQ(t){if(t===n2)return;t&&cTr(t);const n=hp.find(c=>c.descriptor.id===n2);n2=t,iQ=null,n?.descriptor.onDeactivate?.(n.descriptor.id);const s=hp.find(c=>c.descriptor.id===t);s?.descriptor.onActivate?.(s.descriptor.id)}function pTr(t,n,s,c){if(n){!s&&c&&zk===t&&(zk=null);return}s&&(zk&&EN(zk),zk=t)}function ND(t,n={}){const s=uR===t.id,c=s||n.activate!==!1,d=hp.find(g=>g.descriptor.id===t.id);if(pTr(t.id,!!d,n.preview===!0,c),!d)return hp=[...hp,{descriptor:t,dirty:!1,title:t.title}],!t.area&&(c||n2===null)&&oQ(t.id),s&&bht(t.id),TC(),t.id;let m=!1;return(d.descriptor.Toolbar!==t.Toolbar||d.descriptor.Shelf!==t.Shelf||d.descriptor.Content!==t.Content)&&(hp=hp.map(g=>{if(g!==d)return g;const{Toolbar:S,Shelf:k,...A}=g.descriptor;return{...g,descriptor:{...A,Content:t.Content,...t.Toolbar?{Toolbar:t.Toolbar}:{},...t.Shelf?{Shelf:t.Shelf}:{}}}}),m=!0),c&&n2!==t.id&&(oQ(t.id),m=!0),m&&TC(),s&&bht(t.id),t.id}function X0(t){return hp.some(n=>n.descriptor.id===t)?(n2!==t&&(oQ(t),TC()),!0):!1}function N3t(){uR=null}function _Tr(t){if(X0(t)){uR=null;return}uR=t}function EN(t,n={}){if(w5e.has(t))return!1;const s=hp.findIndex(d=>d.descriptor.id===t);if(s<0)return!1;const c=hp[s];if(c.dirty&&!n.discardDirty)return!1;w5e.add(t);try{if(n2===t){const m=s>0?hp[s-1]:hp[s+1]??null;oQ(m?m.descriptor.id:null)}return hp=hp.filter(m=>m.descriptor.id!==t),zk===t&&(zk=null),aBe.delete(t),XO.delete(t),c.descriptor.onDispose?.(t),TC(),!0}finally{w5e.delete(t)}}function O3t(){if(hp.length===0&&n2===null)return;const t=hp;oQ(null),hp=[],iQ=null,zk=null,aBe.clear(),XO.clear(),uR=null;for(const n of t)n.descriptor.onDispose?.(n.descriptor.id);TC()}function mTr(t,n){return hp.some(s=>s.descriptor.id===t)?(XO.set(t,n),TC(),()=>{XO.get(t)===n&&(XO.delete(t),TC())}):()=>{}}function oyn(t){XO.has(t)&&TC()}async function hTr(t){if(!hp.some(s=>s.descriptor.id===t))return null;const n=aBe.get(t);if(!n)return null;try{return await n()}catch{return!1}}function gTr(){return n2?hTr(n2):Promise.resolve(null)}function syn(t,n){n&&zk===t&&(zk=null);const s=hp.findIndex(d=>d.descriptor.id===t);s<0||hp[s].dirty===n||(hp=hp.map(d=>d.descriptor.id===t?{...d,dirty:n}:d),TC())}function R3t(t,n){const s=hp.find(c=>c.descriptor.id===t);!s||s.title===n||(hp=hp.map(c=>c.descriptor.id===t?{...c,title:n}:c),TC())}function cBe(t){const n=hp.find(c=>c.descriptor.id===t),s=XO.get(t)??n?.descriptor.selection;if(!s)return null;try{return s()}catch{return null}}function Oye(){return n2?cBe(n2):null}const yTr={adapter:null,nodeId:null};function vTr(t){return JSON.stringify({id:t.id,title:t.title,hint:t.hint,kindLabel:t.kindLabel,note:t.note,sections:t.sections.map(n=>({id:n.id,title:n.title,order:n.order,description:n.description,defaultOpen:n.defaultOpen,testId:n.testId,keepMounted:n.keepMounted,railGroup:n.railGroup,bodyKind:n.body.kind})),quickActions:t.quickActions?.map(n=>({id:n.id,title:n.title,label:n.label,placement:n.placement,pressed:n.pressed,disabled:n.disabled}))})}function lBe({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,selection:g}){Ye.useEffect(()=>{if(n)return Xwr({documentId:t,title:c,type:s,...m?{status:m}:{}})},[n,t,m,c,s]);const S=Ye.useRef(g);S.current=g,Ye.useEffect(()=>{if(n)return mTr(t,()=>S.current?.()??yTr)},[n,t]);const k={id:t,title:c,kindLabel:s,...m?{note:{text:m,testId:"asset-editor-status"}}:{},sections:d??[]},A=Ye.useRef(k);A.current=k;const F=vTr(k);return Ye.useEffect(()=>{if(n)return tTr(t,()=>A.current)},[n,t,F]),null}function bTr({documentId:t,active:n=!0,type:s,title:c,sections:d,status:m,fill:g=!1,selection:S,children:k}){return $.jsxs("section",{className:"volter-asset-editor","data-testid":`asset-editor:${s}`,"aria-label":`${c} Asset Editor`,children:[$.jsx(lBe,{documentId:t,active:n,type:s,title:c,sections:d,status:m,selection:S}),$.jsx("main",{className:`volter-asset-editor__viewport${g?" volter-asset-editor__viewport--fill":""}`,children:k})]})}const STr=Object.freeze(Object.defineProperty({__proto__:null,AssetEditorShell:bTr,AssetEditorSubject:lBe},Symbol.toStringTag,{value:"Module"})),w_e=new Map,SRe=new Set;function Sht(){for(const t of SRe)t()}function ayn(t){const n=Object.entries(t);for(const[s,c]of n)w_e.set(s,c);return Sht(),()=>{for(const[s,c]of n)w_e.get(s)===c&&w_e.delete(s);Sht()}}function xTr(t){return w_e.get(t)??null}function wTr(t){return SRe.add(t),()=>{SRe.delete(t)}}function TTr(t){return $.jsx(lBe,{...t})}const xht=new Map;function CTr(t){const n=xht.get(t);if(n)return n;function s(c){const d=Ye.useCallback(()=>xTr(t),[]),m=Ye.useSyncExternalStore(wTr,d,d);return m?$.jsx(m,{...c}):$.jsxs("div",{style:{minHeight:240},children:["Loading ",t,"…"]})}return s.displayName=`ContributionSurface(${t})`,xht.set(t,s),s}const uBe=new Proxy(Object.freeze({AssetDocument:TTr}),{get(t,n,s){return typeof n!="string"||Reflect.has(t,n)||!/^[A-Z]/.test(n)?Reflect.get(t,n,s):CTr(n)}}),wht=Object.freeze({id:"classic",shape:{small:"3px",medium:"6px",large:"8px",full:"9999px"},elevation:{small:"0 2px 8px rgba(0,0,0,0.6)",medium:"0 4px 12px rgba(0,0,0,0.5)",large:"0 8px 32px rgba(0,0,0,0.6)"}}),Ym=Object.freeze({id:"glass",color:{surface:{shell:"#12161f",panel:"rgba(255,255,255,0.06)",chrome:"rgba(255,255,255,0.10)",raised:"rgba(255,255,255,0.16)",inset:"rgba(10,14,22,0.38)",overlay:"rgba(255,255,255,0.08)"},boundary:{default:"rgba(255,255,255,0.22)",strong:"rgba(255,255,255,0.38)"},neutralOverlay:{hover:"color-mix(in srgb, currentColor 10%, transparent)",active:"color-mix(in srgb, currentColor 16%, transparent)"},scrim:"rgba(8,12,20,0.35)"},shape:{small:"4px",medium:"8px",large:"14px",full:"9999px"},elevation:{small:"0 4px 14px -6px rgba(0,0,0,0.45)",medium:"0 8px 24px -10px rgba(0,0,0,0.5)",large:"0 20px 46px -16px rgba(0,0,0,0.55), 0 4px 14px -6px rgba(0,0,0,0.35)"},treatment:{backdropBlurPx:1,backdropSaturation:1.15,edgeSpecular:.7,specularAngleDeg:120,refractionBezelPx:56,refractionThickness:1.25,textShadowOpacity:.72,contentFrostBlurPx:24,ambientLiftOpacity:.07,adaptiveContent:!0,brightTextShadowOpacity:0,brightFrostBg:"rgba(255,255,255,0.3)"},reducedTransparency:{surface:{shell:"#12161f",panel:"#33373e",chrome:"#3d4047",raised:"#4b4e55",inset:"#23272f",overlay:"#383b43"},scrim:"rgba(8,12,20,0.5)"}}),ETr=["classic","glass"],kTr=Object.freeze([{id:"classic",title:"Classic",description:"Opaque editor surfaces with conventional bars and panels."},{id:"glass",title:"Glass",description:"Adaptive clear material with refraction, frost, and floating chrome."}]),SB=new Map;let ehe=null;const the=new Set;function ATr(){return ehe??=[...kTr,...[...SB.values()].map(({id:t,title:n,description:s})=>({id:t,title:n,description:s}))],ehe}function DTr(t){return the.add(t),()=>the.delete(t)}function PTr(t){if(Rye(t.id))throw new Error(`registerContributedMaterial: material "${t.id}" is already registered.`);SB.set(t.id,t),ehe=null;for(const n of the)n();return()=>{if(SB.get(t.id)===t){SB.delete(t.id),ehe=null;for(const n of the)n()}}}function Rye(t){return typeof t=="string"&&(ETr.includes(t)||SB.has(t))}function ITr(t,n,s=!1){if(n!=="glass"){const d=SB.get(n);return{id:d?`${t.id}--${d.id}`:t.id,color:t.color,typography:t.typography,shape:d?.shape??wht.shape,elevation:d?.elevation??wht.elevation,...d?.density?{density:d.density}:{},...d?.stage?{stage:d.stage}:{},appearance:{material:"classic",transparency:"standard"}}}return{id:`${t.id}--${s?"glass-reduced":"glass"}`,color:{surface:s?Ym.reducedTransparency.surface:Ym.color.surface,boundary:Ym.color.boundary,content:t.color.content,accent:t.color.accent,semantic:t.color.semantic,neutralOverlay:Ym.color.neutralOverlay,scrim:s?Ym.reducedTransparency.scrim:Ym.color.scrim},typography:t.typography,shape:Ym.shape,elevation:Ym.elevation,appearance:{material:"glass",transparency:s?"reduced":"standard"},...s?{}:{treatment:Ym.treatment}}}const NTr={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",baseline:"baseline"},OTr={start:"flex-start",center:"center",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly"};function Cpe(t){return t===0?"0px":t===void 0?void 0:`var(--volter-space-${t})`}function F3t({gap:t,align:n,justify:s,padding:c,paddingX:d,paddingY:m,style:g}){return{gap:Cpe(t),alignItems:n?NTr[n]:void 0,justifyContent:s?OTr[s]:void 0,padding:Cpe(c),paddingInline:Cpe(d),paddingBlock:Cpe(m),...g}}function hee(t,n){return n?`${t} ${n}`:t}function M3t({className:t,...n}){return $.jsx("div",{...n,className:hee("volter-stack",t),style:F3t(n)})}function bZ({className:t,...n}){return $.jsx("div",{...n,className:hee("volter-inline",t),style:F3t(n)})}function cyn({className:t,...n}){return $.jsx("span",{...n,"aria-hidden":"true",className:hee("volter-spacer",t)})}function RTr({orientation:t="horizontal",className:n,...s}){return $.jsx("div",{...s,"aria-hidden":"true","data-orientation":t,className:hee("volter-divider",n)})}function FTr({children:t,className:n,...s}){return $.jsx(bZ,{...s,className:hee("volter-actions",n),gap:2,align:"center",children:t})}function j3t(t,n){return n?`${t} ${n}`:t}const _p=Ye.forwardRef(function({as:n="span",variant:s="body",tone:c="primary",truncate:d=!1,selectable:m=!1,className:g,...S},k){const A=n;return $.jsx(A,{...S,ref:k,"data-variant":s,"data-tone":c,"data-truncate":d||void 0,"data-selectable":m||void 0,className:j3t("volter-text",g)})});function lyn({className:t,...n}){return $.jsx("kbd",{...n,className:j3t("volter-keycap",t)})}function B$(t,n){return n?`${t} ${n}`:t}function xRe({labelledBy:t,onDismiss:n,size:s="default",variant:c="default",className:d,...m}){const[g]=Ye.useState(()=>typeof document>"u"?null:document.querySelector(".volter-editor-theme")),S=Ye.useId(),k=$.jsx("div",{"data-volter-portal-content":g?S:void 0,className:"volter-dialog-scrim","data-variant":c,onPointerDown:A=>{A.target===A.currentTarget&&n?.()},children:$.jsx("div",{...m,role:"dialog","aria-modal":"true","aria-labelledby":t,"data-size":s,"data-variant":c,className:B$("volter-dialog",d)})});return g?$.jsxs($.Fragment,{children:[$.jsx("span",{"data-volter-portal":S,style:{display:"none"}}),MS.createPortal(k,g)]}):k}function wRe({titleId:t,title:n,description:s}){return $.jsxs(M3t,{className:"volter-dialog-header",gap:2,children:[$.jsx(_p,{id:t,as:"h2",variant:"heading",children:n}),s&&$.jsx(_p,{as:"p",tone:"muted",children:s})]})}function L3t({className:t,...n}){return $.jsx(M3t,{...n,className:B$("volter-dialog-body",t)})}function TRe({children:t,className:n,...s}){return $.jsx(FTr,{...s,className:B$("volter-dialog-footer",n),children:t})}function uyn({className:t,...n}){return $.jsx("label",{...n,className:B$("volter-dialog-field",t)})}function fyn({children:t}){return $.jsx(_p,{variant:"label",tone:"muted",children:t})}function dyn({className:t,...n}){return $.jsx(bZ,{...n,className:B$("volter-joined-field",t)})}function pyn({className:t,...n}){return $.jsx("span",{...n,className:B$("volter-joined-field-suffix",t)})}function fBe(t,n){return n?`${t} ${n}`:t}function MTr({className:t,...n}){return $.jsx("div",{...n,className:fBe("volter-field-group",t)})}function T_e({label:t,htmlFor:n,hint:s,compact:c=!1,className:d,children:m,...g}){return $.jsxs("div",{...g,"data-compact":c||void 0,className:fBe("volter-field-row",d),children:[$.jsx("label",{htmlFor:n,className:"volter-field-label",children:t}),$.jsx("div",{className:"volter-field-control",children:m}),s&&$.jsx("div",{className:"volter-field-hint",children:s})]})}function _yn({className:t,...n}){return $.jsx("label",{...n,className:fBe("volter-field-label",t)})}const myn=Ye.forwardRef(function({selected:n=!1,accent:s="bar",className:c,type:d="button",...m},g){return $.jsx("button",{...m,ref:g,type:d,"data-selected":n||void 0,"data-accent":s,className:c?`volter-list-button ${c}`:"volter-list-button"})});function jTr({tone:t="neutral",icon:n,title:s,description:c,action:d,compact:m=!1,className:g,...S}){const k=t==="error"?"alert":t==="loading"||t==="success"?"status":void 0;return $.jsxs("div",{...S,role:S.role??k,"data-tone":t,"data-compact":m||void 0,className:g?`volter-state-surface ${g}`:"volter-state-surface",children:[n&&$.jsx("div",{className:"volter-state-surface-icon",children:n}),$.jsx("strong",{className:"volter-state-surface-title",children:s}),c&&$.jsx("div",{className:"volter-state-surface-description",children:c}),d&&$.jsx("div",{className:"volter-state-surface-action",children:d})]})}function $$(t,n){return n?`${t} ${n}`:t}function LTr({variant:t="panel",border:n=!1,scroll:s=!1,className:c,...d}){return $.jsx("div",{...d,"data-variant":t,"data-border":n||void 0,"data-scroll":s||void 0,className:$$("volter-surface",c)})}function hyn({tone:t="info",icon:n,actions:s,className:c,children:d,...m}){return $.jsxs("div",{...m,role:t==="error"?"alert":"status","data-tone":t,className:$$("volter-banner",c),children:[n&&$.jsx("span",{className:"volter-banner-icon",children:n}),$.jsx("div",{className:"volter-banner-content",children:d}),s&&$.jsx("div",{className:"volter-banner-actions",children:s})]})}const gyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("div",{ref:c,...s,className:$$("volter-popover",n)})});function yyn({shape:t="label",className:n,...s}){return $.jsx("span",{...s,"data-shape":t,className:$$("volter-badge",n)})}function Tht({position:t="inside",className:n,...s}){return $.jsx("div",{...s,"aria-hidden":"true","data-position":t,className:$$("volter-drop-indicator",n)})}function vyn({orientation:t,label:n,valueNow:s,valueMin:c=0,valueMax:d=100,className:m,...g}){return $.jsx("div",{...g,role:"separator","aria-label":n,"aria-orientation":t,"aria-valuenow":s,"aria-valuemin":s===void 0?void 0:c,"aria-valuemax":s===void 0?void 0:d,"data-orientation":t,className:$$("volter-resize-handle",m)})}function B3t(t,n){return n?`${t} ${n}`:t}const byn=Ye.forwardRef(function({className:n,onKeyDown:s,...c},d){return $.jsx("div",{...c,ref:d,role:"tablist",className:B3t("volter-tabs",n),onKeyDown:m=>{if(s?.(m),m.defaultPrevented||!["ArrowLeft","ArrowRight","Home","End"].includes(m.key))return;const g=Array.from(m.currentTarget.querySelectorAll('[role="tab"]:not(:disabled)'));if(g.length===0)return;m.preventDefault();const S=g.indexOf(document.activeElement);(m.key==="Home"?g[0]:m.key==="End"?g.at(-1):m.key==="ArrowRight"?g[(S+1+g.length)%g.length]:g[(S-1+g.length)%g.length])?.focus()}})}),Syn=Ye.forwardRef(function({selected:n=!1,dirty:s=!1,badge:c,className:d,type:m="button",tabIndex:g,children:S,...k},A){return $.jsxs("button",{...k,ref:A,type:m,role:"tab",tabIndex:g??(n?0:-1),"aria-selected":n,"data-selected":n||void 0,className:B3t("volter-tab",d),children:[s&&$.jsxs($.Fragment,{children:[$.jsx("span",{className:"volter-tab-dirty",title:"Unsaved","aria-hidden":"true"}),$.jsx("span",{className:"volter-sr-only",children:"Unsaved"})]}),$.jsx("span",{className:"volter-tab-label",children:S}),c!==void 0&&$.jsx("span",{className:"volter-tab-badge",children:c})]})});function gee(t,n){return n?`${t} ${n}`:t}const n$=Ye.forwardRef(function({label:n,compact:s=!1,selectionMode:c="independent",className:d,...m},g){return $.jsx("div",{...m,ref:g,role:"toolbar","aria-label":n,"data-compact":s||void 0,"data-selection-mode":c,className:gee("volter-toolbar",d)})});function Cht({className:t,...n}){return $.jsx("div",{...n,role:"group",className:gee("volter-toolbar-group",t)})}function Eht(t){return $.jsx("span",{...t,"aria-hidden":"true",className:gee("volter-toolbar-divider",t.className)})}function xyn({className:t,onPointerDownCapture:n,...s}){return $.jsx(n$,{...s,compact:!0,className:gee("volter-floating-toolbar volter-glass-island",t),onPointerDownCapture:c=>{n?.(c),c.stopPropagation()}})}function wyn({className:t,...n}){return $.jsx("div",{...n,role:"group",className:gee("volter-split-button",t)})}function $3t(t,n){return n?`${t} ${n}`:t}const Tyn=Ye.forwardRef(function({label:n,className:s,...c},d){return $.jsx("div",{...c,ref:d,role:"tree","aria-label":n,className:$3t("volter-tree",s)})}),Cyn=Ye.forwardRef(function({level:n=1,selected:s=!1,expanded:c,muted:d=!1,dragging:m=!1,leading:g,actions:S,className:k,children:A,style:F,...D},J){return $.jsxs("div",{...D,ref:J,role:"treeitem",tabIndex:D.tabIndex??-1,"aria-level":n,"aria-selected":s,...c===void 0?{}:{"aria-expanded":c},"data-selected":s||void 0,"data-muted":d||void 0,"data-dragging":m||void 0,className:$3t("volter-tree-row",k),style:{paddingLeft:6+Math.max(0,n-1)*14,...F},children:[g&&$.jsx("span",{className:"volter-tree-row-leading",children:g}),$.jsx("span",{className:"volter-tree-row-label",children:A}),S&&$.jsx("span",{className:"volter-tree-row-actions",children:S})]})});function q3t(t,n=8){const s=window.innerWidth,c=window.innerHeight,d=Math.max(n,s-t.width-n),m=Math.max(n,c-t.height-n);return{left:Math.min(Math.max(t.left,n),d),top:Math.min(Math.max(t.top,n),m)}}function Fye(t,n){return n?`${t} ${n}`:t}function CRe(t){return Array.from(t.querySelectorAll('[role="menuitem"]:not(:disabled), [role="menuitemradio"]:not(:disabled), [role="menuitemcheckbox"]:not(:disabled)'))}function BTr(t){CRe(t)[0]?.focus()}const fN=Ye.forwardRef(function({className:n,role:s="menu",autoFocusFirst:c=!1,dismissBoundaryRef:d,onDismiss:m,onKeyDown:g,...S},k){const A=Ye.useRef(null);return Ye.useImperativeHandle(k,()=>A.current),Ye.useEffect(()=>{c&&CRe(A.current)[0]?.focus()},[c]),Ye.useEffect(()=>{if(!m)return;const F=D=>{const J=D.target;!A.current?.contains(J)&&!d?.current?.contains(J)&&m("outside")};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[d,m]),$.jsx("div",{...S,ref:A,role:s,className:Fye("volter-menu",n),onKeyDown:F=>{if(g?.(F),F.defaultPrevented)return;if(F.key==="Escape"){F.preventDefault(),m?.("escape");return}if(!["ArrowDown","ArrowUp","Home","End"].includes(F.key))return;F.preventDefault();const D=CRe(F.currentTarget);if(D.length===0)return;const J=D.indexOf(document.activeElement);F.key==="Home"?D[0]?.focus():F.key==="End"?D.at(-1)?.focus():F.key==="ArrowDown"?D[(J+1+D.length)%D.length]?.focus():D[(J-1+D.length)%D.length]?.focus()}})}),Nc=Ye.forwardRef(function({className:n,type:s="button",role:c="menuitem",onClick:d,onSelect:m,...g},S){return $.jsx("button",{...g,ref:S,type:s,role:c,className:Fye("volter-menu-item",n),onClick:k=>{d?.(k),k.defaultPrevented||m?.()}})});function H1(t){return $.jsx("hr",{...t,className:Fye("volter-menu-separator",t.className)})}const dBe=Ye.forwardRef(function({className:n,type:s="button",...c},d){return $.jsx("button",{...c,ref:d,type:s,"aria-haspopup":c["aria-haspopup"]??"menu",className:Fye("volter-menu-trigger",n)})});function rhe({children:t}){const n=Ye.useRef(null),[s,c]=Ye.useState(null),d=Ye.useId();return Ye.useLayoutEffect(()=>{c(n.current?.closest(".volter-editor-theme")??null)},[]),$.jsxs($.Fragment,{children:[$.jsx("span",{ref:n,"data-volter-portal":d,style:{display:"none"}}),s?MS.createPortal($.jsx("div",{"data-volter-portal-content":d,style:{display:"contents"},children:t}),s):null]})}function pBe({anchorRef:t,align:n="end",side:s="bottom",autoFocusFirst:c=!0,gap:d=4,clamp:m=!1,onDismiss:g,style:S,children:k,...A}){const[F,D]=Ye.useState(null),[J,q]=Ye.useState(null),G=Ye.useRef(null),se=Ye.useRef(!0),pe=Ye.useRef(!1),ue=Ye.useCallback(()=>{const Fe=t.current;if(!Fe||!F)return;const De=Fe.getBoundingClientRect(),be=F.getBoundingClientRect(),we=s==="right"||s==="left"?{left:s==="right"?De.right+d:De.left-d-be.width,top:De.top}:{left:n==="end"?De.right-be.width:De.left,top:s==="top"?De.top-d-be.height:De.bottom+d},Be=m?q3t({...we,width:be.width,height:be.height}):we,bt=G.current;bt?.left===Be.left&&bt.top===Be.top||(G.current=Be,q(Be))},[n,t,m,d,F,s]);Ye.useLayoutEffect(()=>{const Fe=t.current;if(!Fe||!F)return;ue();let De=0;const be=()=>{ue(),De=requestAnimationFrame(be)};De=requestAnimationFrame(be),window.addEventListener("resize",ue),document.addEventListener("scroll",ue,!0);const X=typeof ResizeObserver>"u"?null:new ResizeObserver(ue);return X?.observe(Fe),X?.observe(F),()=>{const we=se.current&&F.contains(document.activeElement);window.removeEventListener("resize",ue),document.removeEventListener("scroll",ue,!0),cancelAnimationFrame(De),X?.disconnect(),we&&queueMicrotask(()=>t.current?.focus())}},[t,F,ue]),Ye.useLayoutEffect(()=>{!c||pe.current||!F||!J||(pe.current=!0,BTr(F))},[c,F,J]);const Ce=Fe=>{se.current=Fe!=="outside",g(),Fe==="escape"&&t.current?.focus()};return $.jsx(rhe,{children:$.jsx(fN,{...A,ref:D,dismissBoundaryRef:t,onDismiss:Ce,style:{...S,position:"fixed",left:J?.left??0,top:J?.top??0,visibility:J?S?.visibility:"hidden"},children:k})})}function Eyn({label:t,children:n,gap:s=0,...c}){const[d,m]=Ye.useState(!1),g=Ye.useRef(null),S=Ye.useId(),k=F=>F instanceof Element&&(g.current?.contains(F)===!0||F.closest(`[data-volter-submenu="${S}"]`)!==null),A=F=>{k(F.relatedTarget)||m(!1)};return $.jsxs($.Fragment,{children:[$.jsxs(Nc,{...c,ref:g,"aria-haspopup":"menu","aria-expanded":d,onPointerEnter:()=>m(!0),onPointerLeave:A,onClick:F=>{F.preventDefault(),m(!0)},onKeyDown:F=>{(F.key==="ArrowRight"||F.key==="Enter"||F.key===" ")&&(F.preventDefault(),m(!0)),F.key==="ArrowLeft"&&m(!1)},children:[$.jsx("span",{style:{flex:1},children:t}),$.jsx("span",{"aria-hidden":"true",style:{paddingInlineStart:"var(--volter-space-4)"},children:"▸"})]}),d&&$.jsx(pBe,{anchorRef:g,"data-volter-submenu":S,side:"right",gap:s,clamp:!0,autoFocusFirst:!1,onDismiss:()=>m(!1),onPointerLeave:A,children:n})]})}const Ms=Ye.forwardRef(function({variant:n="secondary",size:s="default",shape:c="default",className:d,type:m="button",...g},S){return $.jsx("button",{...g,ref:S,type:m,className:d?`volter-btn ${d}`:"volter-btn","data-variant":n,"data-size":s,"data-shape":c})}),dm=Ye.forwardRef(function({variant:n="ghost",visibleLabel:s,children:c,...d},m){return $.jsxs(Ms,{...d,ref:m,variant:n,"data-icon":"true","data-label-placement":s===void 0?void 0:"below",children:[c,s!==void 0&&$.jsx("span",{className:"volter-icon-button-label",children:s})]})}),PI={base:0,overlayLow:50,sticky:100,dropdown:1e3,toast:9999,modal:1e4},IG={0:"#1a1a1a",1:"#242424",2:"#2c2c2c",3:"#333333",inset:"#1e1e1e"},kht={1:"#333333",2:"#444444"},xB={1:"#c5c8ce",2:"#9aa0a6",3:"#90959c"},$Tr="#579EFF",qTr="rgba(87,158,255,0.15)",T5e={1:"#f2f6fb",2:"#d3d9e0",3:"#aab0b7"},_Be="#d8dee9",mBe="rgba(216,222,233,0.18)",z3t="#FF6B6B",V3t="#e0a030",U3t="#4caf50",J3t="rgba(76,175,80,0.15)",W3t="rgba(255,107,107,0.15)",H3t="rgba(224,160,48,0.12)",G3t="rgba(255,107,107,0.06)",K3t="rgba(0,0,0,0.5)",X3t="#ff79c6",Y3t="rgba(255,121,198,0.08)",Z3t="#22b8d6",Mye='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',jye='ui-monospace, "SF Mono", Monaco, "Cascadia Code", monospace',C5e={sm:"0 2px 8px rgba(0,0,0,0.6)",md:"0 4px 12px rgba(0,0,0,0.5)",lg:"0 8px 32px rgba(0,0,0,0.6)"},hBe={0:"var(--volter-surface-shell)",1:"var(--volter-surface-panel)",2:"var(--volter-surface-chrome)",3:"var(--volter-surface-raised)",inset:"var(--volter-surface-inset)"},nhe={1:"var(--volter-boundary-default)",2:"var(--volter-boundary-strong)"},Zf={1:"var(--volter-content-primary)",2:"var(--volter-content-muted)",3:"var(--volter-content-dim)"},kyn="var(--volter-accent)",Ayn="var(--volter-accent-muted)",Dyn={background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},C_e="var(--volter-danger)",Pyn="var(--volter-warn)",Iyn="var(--volter-success)",Nyn="var(--volter-success-muted)",Oyn="var(--volter-danger-muted)",Ryn="var(--volter-warn-muted)",Fyn="var(--volter-danger-faint)",Myn="var(--volter-scrim)",jyn="var(--volter-dynamic)",Lyn="var(--volter-dynamic-muted)",R_={1:2,2:4,3:6,4:8,5:10,6:12,8:16,10:20,12:24},Q3t={commandBar:36,panelHeader:30,localToolbar:28,treeRow:24,treeIndent:14,statusBar:36,toolSize:34,toolWidth:38,toolGap:7,areaSeam:1,areaEmboss:0},gBe=["solid","clay","unlit","wireframe","matcap","normals","overdraw","preview","rendered"];function Qb(t){return t===void 0?"":`${t}`}function Zp(t){return{control:{...zTr,...t.density?.control},font:{...UTr,...t.density?.font},icon:{...VTr,...t.density?.icon},chrome:{...Q3t,...t.density?.chrome}}}const zTr={compact:20,default:24,comfortable:28},E5e={resting:1,active:2},VTr={xs:9,sm:10,md:12,lg:13,xl:14,"2xl":16},UTr={xs:9,sm:10,base:11,md:12,lg:13,xl:14,"2xl":16,heading:24},E_e={regular:400,semibold:600,bold:700},Epe={tight:1,snug:1.2,normal:1.4,relaxed:1.5},NG={duration:{fast:140,base:180,slow:300},easing:{standard:"cubic-bezier(0.32, 0.72, 0.28, 1)",out:"ease-out"}},Byn="var(--volter-font-sans)",$yn="var(--volter-font-mono)",qI={small:"3px",medium:"6px",large:"8px",full:"9999px"},sQ={sm:"var(--volter-radius-sm)",md:"var(--volter-radius-md)",lg:"var(--volter-radius-lg)",full:"var(--volter-radius-full)"},qyn={sm:"var(--volter-shadow-sm)",md:"var(--volter-shadow-md)",lg:"var(--volter-shadow-lg)"},YY={xs:"var(--volter-font-xs)",sm:"var(--volter-font-sm)",base:"var(--volter-font-base)",md:"var(--volter-font-md)",lg:"var(--volter-font-lg)",xl:"var(--volter-font-xl)","2xl":"var(--volter-font-2xl)",heading:"var(--volter-font-heading)"},G0={1:"var(--volter-space-1)",2:"var(--volter-space-2)",3:"var(--volter-space-3)",4:"var(--volter-space-4)",5:"var(--volter-space-5)",6:"var(--volter-space-6)",8:"var(--volter-space-8)",10:"var(--volter-space-10)",12:"var(--volter-space-12)"},Aht={tight:"var(--volter-leading-tight)",snug:"var(--volter-leading-snug)",normal:"var(--volter-leading-normal)",relaxed:"var(--volter-leading-relaxed)"},zyn={duration:{fast:"var(--volter-duration-fast)",base:"var(--volter-duration-base)",slow:"var(--volter-duration-slow)"},easing:{standard:"var(--volter-ease-standard)",out:"var(--volter-ease-out)"}},Vyn="var(--volter-focus-ring)",JTr=["outliner","properties"],Lye=Object.keys({object:!0,modifier:!0,material:!0,tool:!0,operator:!0,data:!0,scene:!0,collection:!0,select:!0}),i$={id:"graphite-dark",color:{surface:{shell:IG[0],panel:IG[1],chrome:IG[2],raised:IG[3],inset:IG.inset,overlay:"rgba(36,36,36,0.94)"},boundary:{default:kht[1],strong:kht[2]},content:{primary:xB[1],muted:xB[2],dim:xB[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:$Tr,muted:qTr},semantic:{danger:z3t,dangerMuted:W3t,dangerFaint:G3t,warning:V3t,warningMuted:H3t,success:U3t,successMuted:J3t,dynamic:X3t,dynamicMuted:Y3t,instance:Z3t},neutralOverlay:{hover:"rgba(255,255,255,0.08)",active:"rgba(255,255,255,0.14)"},scrim:K3t},typography:{sans:Mye,mono:jye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:C5e.sm,medium:C5e.md,large:C5e.lg}},WTr={...i$,id:"graphite-neutral",color:{...i$.color,content:{primary:T5e[1],muted:T5e[2],dim:T5e[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:_Be,muted:mBe}}},HTr={id:"midnight-high-contrast",color:{surface:{shell:"#0b0f14",panel:"#111821",chrome:"#17212c",raised:"#223040",inset:"#080c11",overlay:"rgba(17,24,33,0.96)"},boundary:{default:"#34465a",strong:"#71869d"},content:{primary:"#f2f5f8",muted:"#bdc8d5",dim:"#8493a5",onAccent:"#071019",onBright:{primary:"#071019",muted:"rgba(7,16,25,0.82)",dim:"rgba(7,16,25,0.72)"}},accent:{default:"#65d1ff",muted:"rgba(101,209,255,0.18)"},semantic:{danger:"#ff7b86",dangerMuted:"rgba(255,123,134,0.18)",dangerFaint:"rgba(255,123,134,0.08)",warning:"#f3c969",warningMuted:"rgba(243,201,105,0.16)",success:"#62d394",successMuted:"rgba(98,211,148,0.18)",dynamic:"#e889ff",dynamicMuted:"rgba(232,137,255,0.12)",instance:"#a49bff"},neutralOverlay:{hover:"rgba(255,255,255,0.10)",active:"rgba(255,255,255,0.18)"},scrim:"rgba(0,0,0,0.68)"},typography:{sans:Mye,mono:jye},shape:{small:"3px",medium:"6px",large:"8px",full:"9999px"},elevation:{small:"0 2px 8px rgba(0,0,0,0.72)",medium:"0 6px 18px rgba(0,0,0,0.68)",large:"0 12px 40px rgba(0,0,0,0.76)"}},ERe={id:"glass-dark",appearance:{material:"glass",transparency:"standard"},color:{surface:{shell:"rgba(26,26,26,0.88)",panel:"rgba(36,36,36,0.62)",chrome:"rgba(44,44,44,0.68)",raised:"rgba(51,51,51,0.74)",inset:"rgba(30,30,30,0.7)",overlay:"rgba(36,36,36,0.55)"},boundary:{default:"rgba(255,255,255,0.14)",strong:"rgba(255,255,255,0.24)"},content:{primary:xB[1],muted:xB[2],dim:xB[3],onAccent:"#101820",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:_Be,muted:mBe},semantic:{danger:z3t,dangerMuted:W3t,dangerFaint:G3t,warning:V3t,warningMuted:H3t,success:U3t,successMuted:J3t,dynamic:X3t,dynamicMuted:Y3t,instance:Z3t},neutralOverlay:{hover:"color-mix(in srgb, currentColor 9%, transparent)",active:"color-mix(in srgb, currentColor 14%, transparent)"},scrim:"rgba(0,0,0,0.35)"},typography:{sans:Mye,mono:jye},shape:{small:qI.small,medium:qI.medium,large:qI.large,full:qI.full},elevation:{small:"0 4px 16px rgba(0,0,0,0.55)",medium:"0 8px 28px rgba(0,0,0,0.5)",large:"0 16px 48px rgba(0,0,0,0.55)"},treatment:{backdropBlurPx:14,backdropSaturation:1.3,backdropBrightness:.5,edgeSpecular:.6,specularAngleDeg:120,thickness:.5}},GTr=(()=>{const{treatment:t,...n}=ERe;return{...n,id:"glass-dark-lite",appearance:{material:"glass",transparency:"reduced"},color:{...ERe.color,surface:{shell:"#1a1a1a",panel:"#222222",chrome:"#292929",raised:"#303030",inset:"#1d1d1d",overlay:"#202020"},scrim:K3t}}})(),kRe={id:"liquid-glass",appearance:{material:"glass",transparency:"standard"},color:{surface:{shell:Ym.color.surface.shell,panel:Ym.color.surface.panel,chrome:Ym.color.surface.chrome,raised:Ym.color.surface.raised,inset:Ym.color.surface.inset,overlay:Ym.color.surface.overlay},boundary:Ym.color.boundary,content:{primary:"#f2f6fb",muted:"rgba(242,246,251,0.85)",dim:"rgba(242,246,251,0.68)",onAccent:"#0b1526",onBright:{primary:"#1a2330",muted:"rgba(26,35,48,0.82)",dim:"rgba(26,35,48,0.74)"}},accent:{default:_Be,muted:mBe},semantic:{danger:"#ff7b86",dangerMuted:"rgba(255,123,134,0.22)",dangerFaint:"rgba(255,123,134,0.10)",warning:"#ffd35f",warningMuted:"rgba(255,211,95,0.18)",success:"#58e078",successMuted:"rgba(88,224,120,0.20)",dynamic:"#ff8fd8",dynamicMuted:"rgba(255,143,216,0.14)",instance:"#3ad2ea"},neutralOverlay:Ym.color.neutralOverlay,scrim:Ym.color.scrim},typography:{sans:Mye,mono:jye},shape:Ym.shape,elevation:Ym.elevation,treatment:Ym.treatment},KTr=(()=>{const{treatment:t,...n}=kRe;return{...n,id:"liquid-glass-lite",appearance:{material:"glass",transparency:"reduced"},color:{...kRe.color,surface:Ym.reducedTransparency.surface,scrim:Ym.reducedTransparency.scrim}}})(),e4t={"graphite-dark":i$,"graphite-neutral":WTr,"midnight-high-contrast":HTr,"glass-dark":ERe,"glass-dark-lite":GTr,"liquid-glass":kRe,"liquid-glass-lite":KTr};function XTr(t){return typeof t=="string"&&Object.hasOwn(e4t,t)}const Go={surface:{shell:"var(--volter-surface-shell)",panel:"var(--volter-surface-panel)",chrome:"var(--volter-surface-chrome)",raised:"var(--volter-surface-raised)",inset:"var(--volter-surface-inset)",overlay:"var(--volter-surface-overlay)"},boundary:{default:"var(--volter-boundary-default)",strong:"var(--volter-boundary-strong)"},content:{primary:"var(--volter-content-primary)",muted:"var(--volter-content-muted)",dim:"var(--volter-content-dim)",onAccent:"var(--volter-content-on-accent)",active:"var(--volter-content-active)",selected:"var(--volter-content-selected)"},accent:{default:"var(--volter-accent)",muted:"var(--volter-accent-muted)"},selection:{background:"var(--volter-selection-bg)",border:"var(--volter-selection-border)",indicator:"var(--volter-selection-indicator)"},semantic:{danger:"var(--volter-danger)",dangerMuted:"var(--volter-danger-muted)",dangerFaint:"var(--volter-danger-faint)",warning:"var(--volter-warn)",warningMuted:"var(--volter-warn-muted)",success:"var(--volter-success)",successMuted:"var(--volter-success-muted)",dynamic:"var(--volter-dynamic)",dynamicMuted:"var(--volter-dynamic-muted)",instance:"var(--volter-instance)"},neutralOverlay:{hover:"var(--volter-neutral-hover)",active:"var(--volter-neutral-active)"},scrim:"var(--volter-scrim)",typography:{sans:"var(--volter-font-sans)",mono:"var(--volter-font-mono)"},shape:{small:"var(--volter-radius-sm)",medium:"var(--volter-radius-md)",large:"var(--volter-radius-lg)",full:"var(--volter-radius-full)"},elevation:{small:"var(--volter-shadow-sm)",medium:"var(--volter-shadow-md)",large:"var(--volter-shadow-lg)"},focusRing:"var(--volter-focus-ring)"};function YTr(t){const n=`<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1L5 5L9 1' stroke='${t}' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(n)}")`}function ZTr(t){if(!t)return"none";const n=[];return t.backdropBlurPx&&n.push(`blur(${t.backdropBlurPx}px)`),t.backdropSaturation!==void 0&&t.backdropSaturation!==1&&n.push(`saturate(${t.backdropSaturation})`),t.backdropBrightness!==void 0&&t.backdropBrightness!==1&&n.push(`brightness(${t.backdropBrightness})`),n.length>0?n.join(" "):"none"}function Dht(t,n){return n?"transparent":`linear-gradient(var(${t}), var(${t})), linear-gradient(var(--volter-surface-shell), var(--volter-surface-shell))`}function Pht(t){const n=t?.contentFrostBlurPx??0;if(n<=0)return"none";const s=[`blur(${n}px)`];return t?.backdropSaturation!==void 0&&t.backdropSaturation!==1&&s.push(`saturate(${t.backdropSaturation})`),s.join(" ")}function ARe(t){return(t?.contentFrostBlurPx??0)>0?"rgba(255,255,255,0.10)":"transparent"}function QTr(t){return t?"color-mix(in srgb, currentColor 7%, transparent)":"var(--volter-widget-field)"}function eCr(t){return t?"color-mix(in srgb, currentColor 26%, transparent)":"var(--volter-boundary-default)"}function tCr(t,n){const d=[n==="none"?"":n,t?"inset 0 1px 0 color-mix(in srgb, currentColor 14%, transparent), 0 5px 14px -12px color-mix(in srgb, currentColor 55%, transparent)":""].filter(Boolean);return d.length===0?"none":d.join(", ")}const rCr=.6,nCr=.5;function ihe(t,n){return`rgba(255,255,255,${Math.min(1,Number((t*n/rCr).toFixed(3)))})`}function t4t(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>ihe(d,n);return`linear-gradient(${s}deg, ${c(.95)} 0%, ${c(.38)} 16%, ${c(.16)} 40%, ${c(.14)} 60%, ${c(.45)} 84%, ${c(.85)} 100%)`}function iCr(t){const n=t?.edgeSpecular??0;if(n<=0)return"none";const s=t?.specularAngleDeg??120,c=d=>ihe(d,n);return`linear-gradient(${s}deg, ${c(.16)} 0%, ${c(.05)} 24%, transparent 40%)`}function oCr(t){const n=t?.edgeSpecular??0,s=t?.thickness??0,c=[];if(n>0&&(c.push(`inset 0 1px 1px ${ihe(.28,n)}`),c.push(`inset 0 -1px 1px ${ihe(.1,n)}`)),s>0){const d=m=>`${Number((m*s/nCr).toFixed(1))}px`;c.push(`inset 0 ${d(12)} ${d(24)} ${d(-14)} rgba(255,255,255,0.35)`),c.push(`inset 0 ${d(-14)} ${d(28)} ${d(-18)} rgba(0,0,0,0.55)`),c.push(`0 ${d(18)} ${d(40)} ${d(-18)} rgba(0,0,0,0.55)`)}else c.push("var(--volter-shadow-lg)");return c.join(", ")}function q$(t){return t.appearance?t.appearance.material==="glass":t.treatment!==void 0}function sCr(t){return q$(t)?"var(--volter-surface-panel)":"color-mix(in srgb, var(--volter-surface-panel) 90%, transparent)"}function aCr(t){return q$(t)?t.treatment?"var(--volter-surface-backdrop-filter)":"none":"blur(8px)"}function cCr(t){return t?"17px":"var(--volter-radius-md)"}function lCr(t){return t?"var(--volter-boundary-default)":"var(--volter-boundary-strong)"}function uCr(t){return t?"var(--volter-shadow-lg)":"var(--volter-shadow-sm)"}function fCr(t,n){const s=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(t.color.accent.default);if(!s)return null;const[c,d,m]=[s[1],s[2],s[3]].map(g=>Number.parseInt(g,16));return`rgba(${c},${d},${m},${n})`}function Bye(t){return q$(t)}function dCr(t){return Bye(t)?"var(--volter-neutral-active)":"var(--volter-accent-muted)"}function r4t(t){const n=t.trim().toLowerCase();if(n.startsWith("#"))return n.length===5?n.endsWith("f"):n.length===9?n.endsWith("ff"):!0;const s=/^rgba?\(([^)]*)\)$/.exec(n)??/^hsla?\(([^)]*)\)$/.exec(n);if(s){const c=(s[1]??"").split(/[,/]/)[3];return c===void 0||Number.parseFloat(c)>=1}return n!=="transparent"&&!n.includes("transparent")}function n4t(t){if(!r4t(t))return!1;const n=t.trim().toLowerCase();let s=null;const c=/^#([0-9a-f]{3}|[0-9a-f]{6})(?:f|ff)?$/.exec(n);if(c){const S=c[1].length===3?[...c[1]].map(k=>k+k).join(""):c[1];s=[0,2,4].map(k=>Number.parseInt(S.slice(k,k+2),16))}else{const S=/^rgba?\(([^)]*)\)$/.exec(n);S&&(s=(S[1]??"").split(/[,\s/]+/).filter(Boolean).slice(0,3).map(k=>k.endsWith("%")?Number.parseFloat(k)*2.55:Number.parseFloat(k)))}if(!s||s.some(S=>!Number.isFinite(S)))return!1;const[d,m,g]=s;return(.2126*d+.7152*m+.0722*g)/255>.5}function pCr(t){return Bye(t)?"var(--volter-content-primary)":r4t(t.color.accent.muted)?"var(--volter-content-on-accent)":"var(--volter-content-primary)"}function _Cr(t){return Bye(t)?"color-mix(in srgb, currentColor 30%, transparent)":n4t(t.color.surface.panel)?`rgb(from ${t.color.accent.muted} r g b / 1)`:"var(--volter-accent)"}function mCr(t){return Bye(t)?"color-mix(in srgb, currentColor 76%, transparent)":"var(--volter-accent)"}function hCr(t){return t?"var(--volter-radius-full)":"var(--volter-radius-sm)"}function gCr(t){return!q$(t)||!t.treatment?"var(--volter-accent)":fCr(t,.82)??"var(--volter-accent)"}function yCr(t){const n=t?.edgeSpecular??0;return n<=0?"none":t4t({...t,edgeSpecular:n*.4})}function vCr(t){const n=t?.ambientLiftOpacity??0;if(n<=0)return"none";const s=Number(n.toFixed(3)),c=Number((n*.35).toFixed(3));return`linear-gradient(165deg, rgba(255,255,255,${s}) 0%, rgba(255,255,255,${c}) 55%, rgba(255,255,255,0) 100%)`}function i4t(t){return t<=0?"none":`0 1px 2px rgba(0,0,0,${Number(t.toFixed(3))})`}function o4t(t){return i4t(t?.textShadowOpacity??0)}function bCr(t){return t.treatment?.adaptiveContent?{primary:t.color.content.onBright.primary,muted:t.color.content.onBright.muted,dim:t.color.content.onBright.dim,textShadow:i4t(t.treatment.brightTextShadowOpacity??0),frostBg:t.treatment.brightFrostBg??ARe(t.treatment)}:{primary:t.color.content.primary,muted:t.color.content.muted,dim:t.color.content.dim,textShadow:o4t(t.treatment),frostBg:ARe(t.treatment)}}function SCr(t){return t.treatment?t.treatment.adaptiveContent?"rgba(255,255,255,0.9)":wCr(t.color.surface.chrome,.9):t.color.surface.chrome}function xCr(t){return t.color.surface.panel}function wCr(t,n){const s=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([0-9.]+)\s*\)$/.exec(t);if(!s)return t;const c=Math.max(Number(s[4]),n);return`rgba(${s[1]},${s[2]},${s[3]},${c})`}function Iht(t){if(!t)return"none";const s=[`blur(${Math.max(16,t.contentFrostBlurPx??0)}px)`];return t.backdropSaturation!==void 0&&t.backdropSaturation!==1&&s.push(`saturate(${t.backdropSaturation})`),s.join(" ")}function TCr(t){return t.color.boundary.area??t.color.boundary.default}function CCr(t,n){return`color-mix(in srgb, ${t} 98.4%, ${n})`}function OG(t){return`color-mix(in srgb, var(--volter-area-emboss-mix), ${t})`}function ECr(t){const n=Zp(t).chrome.areaEmboss;return n>0?`#ffffff ${n}%`:"transparent 100%"}function kCr(t){const n=bCr(t),s=q$(t),c=t.color.widget?.regular??t.color.surface.raised,d=t.color.widget?.menu??t.color.surface.raised,m=t.color.widget?.field??t.color.surface.inset,g=t.color.widget?.emboss?`0 1px 0 ${t.color.widget.emboss}`:"none",S=A=>`color-mix(in srgb, ${A} 87.8%, ${t.color.content.primary})`,k=`color-mix(in srgb, ${t.color.surface.panel} 86.5%, ${t.color.surface.raised})`;return{"--volter-surface-shell":t.color.surface.shell,"--volter-surface-panel":t.color.surface.panel,"--volter-surface-chrome":t.color.surface.chrome,"--volter-surface-raised":t.color.surface.raised,"--volter-surface-inset":t.color.surface.inset,"--volter-surface-overlay":t.color.surface.overlay,"--volter-surface-backdrop-filter":ZTr(t.treatment),"--volter-surface-sticky":Dht("--volter-surface-chrome",s),"--volter-surface-sticky-panel":Dht("--volter-surface-panel",s),"--volter-surface-sticky-backdrop-filter":"none","--volter-surface-body-frost-filter":Pht(t.treatment),"--volter-content-frost-filter":Pht(t.treatment),"--volter-content-frost-bg":ARe(t.treatment),"--volter-input-surface":QTr(s),"--volter-input-border":eCr(s),"--volter-input-shadow":tCr(s,g),"--volter-structural-divider":s?"transparent":t.color.boundary.default,"--volter-card-specular-ring":t4t(t.treatment),"--volter-card-specular-sheen":iCr(t.treatment),"--volter-card-specular-shadow":oCr(t.treatment),"--volter-card-refraction-thickness":String(t.treatment?.refractionThickness??0),"--volter-card-refraction-bezel":String(t.treatment?.refractionBezelPx??28),"--volter-card-refraction-angle":String(t.treatment?.specularAngleDeg??120),"--volter-ambient-lift":vCr(t.treatment),"--volter-island-surface":sCr(t),"--volter-island-backdrop-filter":aCr(t),"--volter-island-radius":cCr(s),"--volter-island-border-color":lCr(s),"--volter-island-shadow":uCr(s),"--volter-island-specular-ring":yCr(t.treatment),"--volter-selection-bg":dCr(t),"--volter-content-on-selection":pCr(t),"--volter-selection-border":_Cr(t),"--volter-selection-indicator":mCr(t),"--volter-island-control-radius":hCr(s),"--volter-island-primary-bg":gCr(t),"--volter-content-text-shadow":o4t(t.treatment),"--volter-content-primary-on-bright":n.primary,"--volter-content-muted-on-bright":n.muted,"--volter-content-dim-on-bright":n.dim,"--volter-content-text-shadow-on-bright":n.textShadow,"--volter-content-frost-bg-on-bright":n.frostBg,"--volter-content-adaptive":t.treatment?.adaptiveContent?"1":"0","--volter-glass-regular-bg":SCr(t),"--volter-glass-regular-backdrop-filter":Iht(t.treatment),"--volter-glass-regular-panel-bg":xCr(t),"--volter-glass-regular-panel-backdrop-filter":Iht(t.treatment),"--volter-glass-dark-frost-panel-bg":"rgba(5,8,13,0.74)","--volter-glass-dark-frost-content-bg":"rgba(5,8,13,0.84)","--volter-scrim-backdrop-filter":t.treatment?"blur(8px)":"none","--volter-boundary-default":t.color.boundary.default,"--volter-boundary-strong":t.color.boundary.strong,"--volter-boundary-area":TCr(t),"--volter-tree-indent-guide":t.color.boundary.indent??"transparent","--volter-boundary-divider":t.color.boundary.divider??t.color.boundary.default,"--volter-area-emboss-mix":ECr(t),"--volter-area-emboss":OG(t.color.surface.panel),"--volter-area-emboss-stage":OG(OG(t.color.viewport?.background??t.color.surface.panel)),"--volter-area-emboss-stage-header":OG(OG(k)),"--volter-content-primary":t.color.content.primary,"--volter-content-muted":t.color.content.muted,"--volter-content-dim":t.color.content.dim,"--volter-content-on-accent":t.color.content.onAccent,"--volter-content-menu":t.color.content.menu??t.color.content.primary,"--volter-content-status":t.color.content.status??t.color.content.dim,"--volter-content-placeholder":t.color.content.placeholder??t.color.content.dim,"--volter-content-active":t.color.content.active??"","--volter-content-selected":t.color.content.selected??t.color.content.active??"","--volter-accent":t.color.accent.default,"--volter-accent-muted":t.color.accent.muted,"--volter-danger":t.color.semantic.danger,"--volter-danger-muted":t.color.semantic.dangerMuted,"--volter-danger-faint":t.color.semantic.dangerFaint,"--volter-warn":t.color.semantic.warning,"--volter-warn-muted":t.color.semantic.warningMuted,"--volter-success":t.color.semantic.success,"--volter-success-muted":t.color.semantic.successMuted,"--volter-dynamic":t.color.semantic.dynamic,"--volter-dynamic-muted":t.color.semantic.dynamicMuted,"--volter-instance":t.color.semantic.instance,"--volter-neutral-hover":t.color.neutralOverlay.hover,"--volter-neutral-active":t.color.neutralOverlay.active,"--volter-scrim":t.color.scrim,"--volter-surface-section":`color-mix(in srgb, ${t.color.surface.panel} 64.9%, ${t.color.surface.raised})`,"--volter-surface-section-edge":`color-mix(in srgb, ${t.color.surface.panel} 29.7%, ${t.color.surface.raised})`,"--volter-surface-header":k,"--volter-surface-row-alt":CCr(t.color.surface.panel,t.color.content.primary),...n4t(t.color.surface.panel)?{"--volter-tree-row-selected-bg":t.color.accent.muted,"--volter-tree-row-active-bg":`rgb(from ${t.color.accent.muted} r g b / 1)`,"--volter-tree-row-active-border":`rgb(from ${t.color.accent.muted} r g b / 1)`,"--volter-tree-datablock-fill":"color-mix(in srgb, var(--volter-category-data, currentColor) 14%, transparent)","--volter-tree-datablock-border":"color-mix(in srgb, var(--volter-content-primary) 14%, transparent)"}:{"--volter-tree-row-selected-bg":`color-mix(in srgb, ${t.color.accent.default} 42%, #000)`,"--volter-tree-row-active-bg":`color-mix(in srgb, ${t.color.accent.default} 70%, #000)`,"--volter-tree-row-active-border":"rgb(from var(--volter-tree-row-active-bg) calc(r + 40) calc(g + 40) calc(b + 40))","--volter-tree-datablock-fill":"color-mix(in srgb, color-mix(in srgb, var(--volter-category-data, currentColor) 60%, black) 26%, transparent)","--volter-tree-datablock-border":"color-mix(in srgb, var(--volter-content-primary) 24%, transparent)"},"--volter-tree-active-name-underline":t.color.content.active?"none":"underline","--volter-viewport-background":t.color.viewport?.background??"","--volter-viewport-grid":t.color.viewport?.grid??"","--volter-viewport-axis-x":t.color.viewport?.axisX??"","--volter-viewport-axis-y":t.color.viewport?.axisY??"","--volter-viewport-axis-z":t.color.viewport?.axisZ??"","--volter-viewport-wire":t.color.viewport?.wire??"","--volter-viewport-wire-opacity":Qb(t.stage?.wireOpacity),"--volter-viewport-axis-line-width":Qb(t.stage?.axisLineWidth),"--volter-viewport-selection":t.color.viewport?.selection??"","--volter-viewport-active":t.color.viewport?.active??"","--volter-gizmo-x":t.color.gizmo?.x??"","--volter-gizmo-y":t.color.gizmo?.y??"","--volter-gizmo-z":t.color.gizmo?.z??"","--volter-gizmo-navigation-x":t.color.gizmo?.navigationX??"","--volter-gizmo-navigation-y":t.color.gizmo?.navigationY??"","--volter-gizmo-navigation-z":t.color.gizmo?.navigationZ??"","--volter-gizmo-hover":t.color.gizmo?.hover??"","--volter-gizmo-drag":t.color.gizmo?.drag??"","--volter-viewport-gizmo-opacity":Qb(t.stage?.gizmoOpacity),"--volter-viewport-gizmo-arrow-length":Qb(t.stage?.gizmoArrowLength),"--volter-viewport-gizmo-arrow-head":Qb(t.stage?.gizmoArrowHead),"--volter-viewport-gizmo-ring-width":Qb(t.stage?.gizmoRingWidth),"--volter-viewport-navigation-gizmo":t.stage?.navigationGizmo??"","--volter-viewport-navigation-corner":t.stage?.navigationCorner??"","--volter-viewport-navigation-size":Qb(t.stage?.navigationSize),"--volter-viewport-gizmo-highlight-saturation":Qb(t.stage?.gizmoHighlightSaturation),"--volter-viewport-gizmo-highlight-value":Qb(t.stage?.gizmoHighlightValue),"--volter-viewport-gizmo-size":t.stage?.gizmoSize===void 0?"":`${t.stage.gizmoSize}`,"--volter-viewport-grid-line-width":Qb(t.stage?.gridLineWidth),"--volter-viewport-grid-major-width":Qb(t.stage?.gridMajorWidth),"--volter-viewport-grid-major-contrast":Qb(t.stage?.gridMajorContrast),"--volter-viewport-selection-box":t.stage?.selectionBox??"","--volter-viewport-selection-box-frame":t.stage?.selectionBoxFrame??"","--volter-viewport-outline-style":t.stage?.outlineStyle??"","--volter-viewport-outline-width":Qb(t.stage?.outlineWidth),"--volter-viewport-outline-hidden":t.stage?.outlineHidden===void 0?"":`${t.stage.outlineHidden}`,"--volter-viewport-selection-box-width":Qb(t.stage?.selectionBoxWidth),"--volter-viewport-chrome-bar":t.stage?.chrome?.bar??"","--volter-viewport-chrome-view-name":t.stage?.chrome?.viewName??"","--volter-viewport-chrome-tools":t.stage?.chrome?.tools??"","--volter-viewport-chrome-display":t.stage?.chrome?.display??"","--volter-viewport-chrome-transform-controls":t.stage?.chrome?.transformControls??"",...Object.fromEntries(gBe.map(A=>[`--volter-viewport-word-${A}`,t.stage?.words?.shading?.[A]??""])),"--volter-viewport-word-helpers":t.stage?.words?.helpers??"","--volter-widget-regular":c,"--volter-widget-regular-hover":S(c),"--volter-widget-menu":d,"--volter-widget-menu-hover":S(d),"--volter-widget-field":m,"--volter-widget-emboss-shadow":g,...Object.fromEntries(Lye.map(A=>[`--volter-category-${A}`,t.color.category?.[A]??"currentColor"])),"--volter-region-outliner":t.color.region?.outliner??t.color.surface.panel,"--volter-region-outliner-header":t.color.region?.outliner??t.color.surface.chrome,"--volter-region-properties":t.color.region?.properties??t.color.surface.panel,"--volter-region-properties-header":t.color.region?.properties??t.color.surface.chrome,"--volter-font-sans":t.typography.sans,"--volter-font-mono":t.typography.mono,"--volter-radius-sm":t.shape.small,"--volter-radius-md":t.shape.medium,"--volter-radius-lg":t.shape.large,"--volter-radius-full":t.shape.full,"--volter-shadow-sm":t.elevation.small,"--volter-shadow-md":t.elevation.medium,"--volter-shadow-lg":t.elevation.large,"--volter-focus-ring":`${E5e.active}px solid ${t.color.accent.default}`,"--volter-select-chevron":YTr(t.color.content.muted),"--volter-space-1":`${R_[1]}px`,"--volter-space-2":`${R_[2]}px`,"--volter-space-3":`${R_[3]}px`,"--volter-space-4":`${R_[4]}px`,"--volter-space-5":`${R_[5]}px`,"--volter-space-6":`${R_[6]}px`,"--volter-space-8":`${R_[8]}px`,"--volter-space-10":`${R_[10]}px`,"--volter-space-12":`${R_[12]}px`,"--volter-command-bar-height":`${Zp(t).chrome.commandBar}px`,"--volter-panel-header-height":`${Zp(t).chrome.panelHeader}px`,"--volter-local-toolbar-height":`${Zp(t).chrome.localToolbar}px`,"--volter-tree-row-height":`${Zp(t).chrome.treeRow}px`,"--volter-tree-indent":`${Zp(t).chrome.treeIndent}px`,"--volter-status-bar-height":`${Zp(t).chrome.statusBar}px`,"--volter-tool-size":`${Zp(t).chrome.toolSize}px`,"--volter-tool-width":`${Zp(t).chrome.toolWidth}px`,"--volter-tool-gap":`${Zp(t).chrome.toolGap}px`,"--volter-area-seam-width":`${Zp(t).chrome.areaSeam}px`,"--volter-control-compact-height":`${Zp(t).control.compact}px`,"--volter-control-default-height":`${Zp(t).control.default}px`,"--volter-control-comfortable-height":`${Zp(t).control.comfortable}px`,"--volter-stroke-resting":`${E5e.resting}px`,"--volter-stroke-active":`${E5e.active}px`,"--volter-font-xs":`${Zp(t).font.xs}px`,"--volter-font-sm":`${Zp(t).font.sm}px`,"--volter-font-base":`${Zp(t).font.base}px`,"--volter-font-md":`${Zp(t).font.md}px`,"--volter-font-lg":`${Zp(t).font.lg}px`,"--volter-font-xl":`${Zp(t).font.xl}px`,"--volter-font-2xl":`${Zp(t).font["2xl"]}px`,"--volter-icon-xs":`${Zp(t).icon.xs}px`,"--volter-icon-sm":`${Zp(t).icon.sm}px`,"--volter-icon-md":`${Zp(t).icon.md}px`,"--volter-icon-lg":`${Zp(t).icon.lg}px`,"--volter-icon-xl":`${Zp(t).icon.xl}px`,"--volter-icon-2xl":`${Zp(t).icon["2xl"]}px`,"--volter-font-heading":`${Zp(t).font.heading}px`,"--volter-font-weight-regular":String(E_e.regular),"--volter-font-weight-semibold":String(E_e.semibold),"--volter-font-weight-bold":String(E_e.bold),"--volter-leading-tight":String(Epe.tight),"--volter-leading-snug":String(Epe.snug),"--volter-leading-normal":String(Epe.normal),"--volter-leading-relaxed":String(Epe.relaxed),"--volter-duration-fast":`${NG.duration.fast}ms`,"--volter-duration-base":`${NG.duration.base}ms`,"--volter-duration-slow":`${NG.duration.slow}ms`,"--volter-ease-standard":NG.easing.standard,"--volter-ease-out":NG.easing.out,"--volter-z-base":String(PI.base),"--volter-z-overlay-low":String(PI.overlayLow),"--volter-z-sticky":String(PI.sticky),"--volter-z-dropdown":String(PI.dropdown),"--volter-z-toast":String(PI.toast),"--volter-z-modal":String(PI.modal)}}const DRe="volter-editor-theme";function ACr(t,n=i$){t.classList.add(DRe),t.dataset.volterTheme=n.id,t.dataset.volterChrome=q$(n)?"islands":"bars";for(const[s,c]of Object.entries(kCr(n)))t.style.setProperty(s,c)}const Uyn={bg:Go.semantic.dangerFaint,border:Go.semantic.danger,fg:Go.semantic.danger},Jyn={bg:Go.semantic.warningMuted,border:Go.semantic.warning,fg:Go.semantic.warning},s4t=Ye.createContext(null);function DCr(){return Ye.useContext(s4t)}function DR(t,n){return n?`${t} ${n}`:t}const Zm=Ye.forwardRef(function({className:n,type:s="text",...c},d){return $.jsx("input",{...c,ref:d,type:s,className:DR("volter-input",n)})}),Iw=Ye.forwardRef(function({className:n,...s},c){return $.jsx("select",{...s,ref:c,className:DR("volter-select",n)})}),yBe=Ye.forwardRef(function({className:n,...s},c){return $.jsx("textarea",{...s,ref:c,className:DR("volter-input volter-textarea",n)})}),TD=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"checkbox",className:DR("volter-checkbox",n)})}),a4t=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"color",className:DR("volter-color-swatch",n)})}),Wyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"file",className:DR("volter-file-input",n)})}),Hyn=Ye.forwardRef(function({className:n,...s},c){return $.jsx("input",{...s,ref:c,type:"range",className:DR("volter-range",n)})}),gC="default",PCr={id:gC,title:"Editor"},wB=new Map;let ohe=null,aQ=gC;const PRe=new Set;function IRe(){for(const t of PRe)t()}function Gyn(){return ohe??=[PCr,...[...wB.values()].map(({id:t,title:n})=>({id:t,title:n}))],ohe}function yee(t){return typeof t=="string"&&(t===gC||wB.has(t))}function ICr(t){if(yee(t.id))throw new Error(`registerContributedIconSet: icon set "${t.id}" is already registered.`);return wB.set(t.id,t),ohe=null,IRe(),()=>{wB.get(t.id)===t&&(wB.delete(t.id),ohe=null,IRe())}}function she(){return aQ}function ahe(t){const n=yee(t)?t:gC;n!==aQ&&(aQ=n,IRe())}function vBe(t){return PRe.add(t),()=>PRe.delete(t)}function c4t(t){return aQ===gC?null:wB.get(aQ)?.glyphs[t]??null}const Nht={xs:"var(--volter-icon-xs)",sm:"var(--volter-icon-sm)",md:"var(--volter-icon-md)",lg:"var(--volter-icon-lg)",xl:"var(--volter-icon-xl)","2xl":"var(--volter-icon-2xl)"},Oht={current:void 0,primary:Go.content.primary,muted:Go.content.muted,dim:Go.content.dim,accent:Go.accent.default,danger:Go.semantic.danger};function dc({icon:t,size:n="sm",tone:s="current",label:c,className:d,style:m,spin:g=!1,...S}){Ye.useSyncExternalStore(vBe,she,she);const k=c4t(t.iconName);if(k){const A=s!=="current",F=k.tone?`var(--volter-category-${k.tone}, currentColor)`:void 0,D=A?Oht[s]:k.tonedPath?void 0:F,J=A?"currentColor":F??"currentColor";return $.jsxs("svg",{...S,viewBox:k.viewBox??"0 0 16 16","data-volter-tone":A?void 0:k.tone,className:d,"aria-hidden":c?void 0:S["aria-hidden"]??"true","aria-label":c,role:c?"img":void 0,style:{width:"1.25em",height:"1em",overflow:"visible",verticalAlign:"-0.125em",fontSize:Nht[n],color:D,...m},children:[$.jsx("path",{d:k.path,fill:"currentColor"}),k.tonedPath?$.jsx("path",{d:k.tonedPath,fill:J}):null]})}return $.jsx(Xyr,{...S,icon:t,fixedWidth:!0,spin:g,className:d,"aria-hidden":c?void 0:S["aria-hidden"]??"true","aria-label":c,role:c?"img":void 0,style:{fontSize:Nht[n],color:Oht[s],...m}})}function l4t({direction:t,size:n="xs",tone:s="current",style:c}){return $.jsx(dc,{icon:t==="right"?ITt:JTt,size:n,tone:s,...c?{style:c}:{}})}function Kyn({direction:t,size:n="xs",tone:s="current"}){return $.jsx(dc,{icon:t==="right"?ETt:iLe,size:n,tone:s})}function fy(t,n){return{...n,iconName:t}}const Kk={action:{add:GTt,close:rLe,delete:ATt,search:kTt,refresh:G0r,undo:LOe,redo:Cmt,build:V0r,export:H0r,select:Emt},transport:{play:A0r,pause:J0r,restart:Cmt,stop:DTt,step:P0r},content:{project:MOe,folder:uee,file:jTt,source:oLe,scene:aLe,entity:aR,component:GB,camera:nye,light:Qje,image:iB,audio:nLe,data:PTt,code:eLe,stateMachine:OTt},status:{success:tLe,info:R$,warning:fee,error:MTt,visible:Zje,hidden:sLe,locked:Nme,unlocked:jOe},viewport:{zoomIn:_0r,zoomOut:d0r,pan:T0r,frame:u0r,projection:fy("viewport-projection",S5e),projectionOrthographic:fy("viewport-orthographic",S5e),camera:fy("viewport-camera",Tmt),cameraView:fy("viewport-camera-view",Tmt),cameraLocked:fy("viewport-camera-locked",Nme),cameraUnlocked:fy("viewport-camera-unlocked",jOe)},modeling:{extrude:fy("mesh-extrude",RTt),inset:fy("mesh-inset",z0r),bevel:fy("mesh-bevel",K0r),loopCut:fy("mesh-loop-cut",m0r),knife:fy("mesh-knife",L0r),smooth:fy("mesh-smooth",f0r),shrinkFatten:fy("mesh-shrink-fatten",LTt),subdivide:fy("mesh-subdivide",D0r)},tool:{extension:GB,select:fy("tool-select-box",Emt),move:$Tt,rotate:CTt,scale:fy("tool-scale",g0r),transform:fy("tool-transform",C0r),snap:k0r,frame:HTt,grid:S5e,profiler:UTt},panel:{outliner:fy("outliner",XTt),properties:fy("properties",qTt),"folder-open":MOe,"cubes-stacked":BTt,users:h0r,list:vZ,"rotate-left":LOe}};function SZ({value:t,onChange:n,onChangeEnd:s,step:c=.1,precision:d=3,disabled:m=!1,label:g,labelColor:S,style:k,testId:A,title:F}){const[D,J]=Ye.useState(!1),[q,G]=Ye.useState(""),se=Ye.useRef({startX:0,startVal:0,dragging:!1,gesture:!1,lastVal:0}),pe=Ye.useRef(null),ue=DCr();Ye.useEffect(()=>{if(!D)return;const we=pe.current;we&&(we.focus(),we.select())},[D]);const Ce=t===null,Fe=t??0,De=Ce?"—":Number.isFinite(Fe)?Fe.toFixed(d):0 .toFixed(d),be=we=>{if(m)return;se.current={startX:we.clientX,startVal:Fe,dragging:!1,gesture:!1,lastVal:Fe};const Be=It=>{const Wt=It.clientX-se.current.startX;if(Math.abs(Wt)>3&&(se.current.dragging=!0),se.current.dragging){se.current.gesture||(se.current.gesture=!0,ue?.begin());const zt=se.current.startVal+Wt*c,ft=Math.round(zt/c)*c;se.current.lastVal=ft,n(ft)}},bt=()=>{window.removeEventListener("pointermove",Be),window.removeEventListener("pointerup",bt),se.current.gesture&&ue?.end(),se.current.dragging?s?.(se.current.lastVal):(J(!0),G(Ce?"":De))};window.addEventListener("pointermove",Be),window.addEventListener("pointerup",bt)},X=()=>{J(!1);const we=Number.parseFloat(q);Number.isFinite(we)&&(n(we),s?.(we))};return $.jsxs("div",{className:"volter-number-input","data-testid":A,title:F,style:k,children:[g&&$.jsx("span",{className:"volter-number-input-label",style:S?{color:S}:void 0,children:g}),D?$.jsx(Zm,{ref:pe,value:q,onChange:we=>G(we.target.value),onBlur:X,onKeyDown:we=>{we.key==="Enter"&&X(),we.key==="Escape"&&J(!1)},placeholder:Ce?"—":void 0,className:"volter-number-input-editor"}):$.jsx("div",{onPointerDown:be,className:"volter-number-input-scrub","data-mixed":Ce||void 0,"data-disabled":m||void 0,children:De})]})}const NCr={minHeight:"var(--volter-panel-header-height)",padding:`0 ${R_[4]}px`,color:Go.content.muted,fontSize:"var(--volter-font-base)",fontWeight:E_e.semibold,textTransform:"uppercase",display:"flex",alignItems:"center",gap:R_[2],userSelect:"none"},OCr={...NCr,background:"var(--volter-surface-sticky)",borderBottom:"1px solid var(--volter-structural-divider)",flexShrink:0};function $ye({name:t,actions:n,onHeaderClick:s,hideHeader:c=!1,style:d,children:m,...g}){return $.jsxs("div",{...g,style:{display:"flex",flexDirection:"column",pointerEvents:"auto",...d},children:[!c&&$.jsxs("div",{role:s?"button":void 0,tabIndex:s?0:void 0,onClick:s,onKeyDown:s?S=>{S.key==="Enter"&&s()}:void 0,style:{...OCr,cursor:s?"pointer":void 0,pointerEvents:"auto"},children:[$.jsx("span",{style:{flexShrink:0},children:t}),n&&$.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:R_[3]},children:n})]}),m]})}function RCr({label:t,icon:n,description:s,actions:c,collapsible:d=!0,defaultOpen:m=!0,children:g}){const[S,k]=Ye.useState(m),A=$.jsxs("span",{className:"volter-section-title",children:[$.jsx("span",{children:t}),s?$.jsx("small",{children:s}):null]});return $.jsxs("section",{className:"volter-section",children:[$.jsxs("div",{className:"volter-section-header",children:[d?$.jsxs("button",{type:"button",className:"volter-section-trigger","aria-expanded":S,onClick:()=>k(!S),children:[$.jsx(l4t,{direction:S?"down":"right",style:{fontSize:"var(--volter-section-disclosure-size, var(--volter-icon-xs))"}}),n&&$.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}):$.jsxs("div",{className:"volter-section-trigger","data-volter-static":!0,children:[n&&$.jsx(dc,{icon:n,tone:"dim",className:"volter-section-glyph"}),A]}),c?$.jsx("div",{className:"volter-section-actions",children:c}):null]}),(S||!d)&&$.jsx("div",{className:"volter-section-body",children:g})]})}const zI=8,VI=6;function FCr(t){return t==="top"?"bottom":t==="bottom"?"top":t==="left"?"right":"left"}function MCr(t,n,s){return t==="top"?n.top-s.height-VI>=zI:t==="bottom"?n.bottom+s.height+VI<=window.innerHeight-zI:t==="left"?n.left-s.width-VI>=zI:n.right+s.width+VI<=window.innerWidth-zI}function jCr(t,n,s){let c=n.left+(n.width-s.width)/2,d=n.top+(n.height-s.height)/2;return t==="top"?d=n.top-s.height-VI:t==="bottom"?d=n.bottom+VI:t==="left"?c=n.left-s.width-VI:c=n.right+VI,{left:Math.max(zI,Math.min(c,window.innerWidth-s.width-zI)),top:Math.max(zI,Math.min(d,window.innerHeight-s.height-zI)),ready:!0}}function mO({text:t,hotkey:n,children:s,position:c="bottom",delay:d=400}){const m=Ye.useId(),g=Ye.useRef(null),S=Ye.useRef(null),k=Ye.useRef(null),A=Ye.useRef(!1),F=Ye.useRef(!1),[D,J]=Ye.useState(!1),[q,G]=Ye.useState(null),[se,pe]=Ye.useState({left:0,top:0,ready:!1});Ye.useLayoutEffect(()=>{G(g.current?.closest(".volter-editor-theme")??null)},[]),Ye.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]);const ue=()=>{k.current&&clearTimeout(k.current),k.current=null,J(!1)},Ce=()=>{!A.current&&!F.current&&ue()},Fe=be=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{pe(X=>({...X,ready:!1})),J(!0)},be)};Ye.useLayoutEffect(()=>{if(!D)return;const be=()=>{const X=g.current?.getBoundingClientRect(),we=S.current?.getBoundingClientRect();if(!X||!we)return;const Be=MCr(c,X,we)?c:FCr(c);pe(jCr(Be,X,we))};return be(),window.addEventListener("resize",be),window.addEventListener("scroll",be,!0),()=>{window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}},[n,c,t,D]);let De=s;if(Ye.isValidElement(s)){const be=[s.props["aria-describedby"],D?m:null].filter(Boolean).join(" ");De=Ye.cloneElement(s,be?{"aria-describedby":be}:{})}return $.jsxs("span",{ref:g,className:"volter-tooltip-anchor",onMouseEnter:()=>{A.current=!0,Fe(d)},onMouseLeave:()=>{A.current=!1,Ce()},onFocusCapture:()=>{F.current=!0,Fe(0)},onBlurCapture:be=>{be.currentTarget.contains(be.relatedTarget)||(F.current=!1,Ce())},children:[De,D&&q&&MS.createPortal($.jsxs("div",{ref:S,id:m,role:"tooltip",className:"volter-tooltip",style:{left:se.left,top:se.top,visibility:se.ready?"visible":"hidden"},children:[$.jsx("span",{children:t}),n&&$.jsx("kbd",{children:n})]}),q)]})}function LCr({value:t,onChange:n,onAxisChange:s,step:c=.1,disabled:d=!1,testIdPrefix:m}){const g=k=>m?`${m}-${k}`:void 0,S=k=>A=>{if(s)s(k,A);else{const F=[t[0]??0,t[1]??0,t[2]??0];F[k]=A,n(F)}};return $.jsxs("div",{style:{display:"flex",gap:4},children:[$.jsx(SZ,{label:"X",labelColor:"#E06178",value:t[0],onChange:S(0),step:c,disabled:d,style:{flex:1},testId:g("x")}),$.jsx(SZ,{label:"Y",labelColor:"#C2ED66",value:t[1],onChange:S(1),step:c,disabled:d,style:{flex:1},testId:g("y")}),$.jsx(SZ,{label:"Z",labelColor:"#6BABF5",value:t[2],onChange:S(2),step:c,disabled:d,style:{flex:1},testId:g("z")})]})}const k5e={bg:Go.surface.panel,surface:Go.surface.chrome,surfaceHover:Go.surface.raised,border:Go.boundary.default,text:Go.content.primary,textMuted:Go.content.muted,onAccent:Go.content.onAccent,accent:Go.accent.default,neutralHover:Go.neutralOverlay.hover,radiusSmall:Go.shape.small,radiusMedium:Go.shape.medium,inputBg:Go.surface.inset,dynamic:Go.semantic.dynamic,dynamicBg:Go.semantic.dynamicMuted},Xyn=Go.typography.sans,Yyn=Go.typography.mono;function Zyn(t,n){t.onChange(n)}function Qyn(t,n){(t.onChangeEnd??t.onChange)(n)}const e0n={display:"flex",alignItems:"center",gap:4},t0n={fontSize:"var(--volter-font-sm)",color:Go.content.muted,marginBottom:2},BCr={fontSize:"var(--volter-font-base)",fontWeight:600,color:Go.content.muted,textTransform:"uppercase",letterSpacing:.4},$Cr=72;function r0n({label:t,active:n,disabled:s,onClick:c,testId:d}){return $.jsx(Ms,{variant:n?"primary":"secondary",size:"compact","aria-pressed":n,disabled:s,"data-testid":d,onClick:()=>{s||c()},style:{flex:1},children:t})}function n0n(t){const n=t.match(/^(-?\d+\.?\d*)\s*(px|em|rem|%|vh|vw|deg|s|ms)?$/);if(n)return{num:Number.parseFloat(n[1]??"0"),unit:n[2]||""};const s=Number.parseFloat(t);return{num:Number.isNaN(s)?0:s,unit:""}}const A5e=22,Rht={width:A5e,height:A5e,flex:`0 0 ${A5e}px`,borderRadius:k5e.radiusSmall,border:`1px solid ${k5e.border}`,background:k5e.inputBg,objectFit:"cover",backgroundImage:"linear-gradient(45deg,rgba(128,128,128,.35) 25%,transparent 25%,transparent 75%,rgba(128,128,128,.35) 75%),linear-gradient(45deg,rgba(128,128,128,.35) 25%,transparent 25%,transparent 75%,rgba(128,128,128,.35) 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px"};function qCr({value:t,onChange:n,options:s,previewUrlFor:c,disabled:d,note:m,testId:g}){const S=t&&!s.includes(t)?[t,...s]:s;return $.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,minWidth:0},children:[t?$.jsx("img",{src:c(t),alt:"",style:Rht,"data-testid":`${g}-thumb`}):$.jsx("span",{style:Rht,"aria-hidden":"true"}),$.jsxs(Iw,{"data-testid":g,disabled:d,value:t,title:t||"No texture assigned",onChange:k=>n(k.target.value),style:{flex:1,minWidth:0},children:[$.jsx("option",{value:"",children:"—"}),S.map(k=>$.jsx("option",{value:k,children:k},k))]}),$.jsx(dm,{"data-testid":`${g}-clear`,"aria-label":"Clear this texture slot",title:"Clear this texture slot",disabled:d||!t,onClick:()=>n(""),children:$.jsx(dc,{icon:rLe})})]}),m&&$.jsx("span",{"data-testid":`${g}-note`,style:{fontSize:"var(--volter-font-sm)",color:Go.content.muted},children:m})]})}function NRe({value:t,onCommit:n,onKeyDown:s,onFocus:c,...d}){const[m,g]=Ye.useState(null),S=Ye.useRef(!1),k=()=>{!S.current&&m!==null&&m!==t&&n(m),S.current=!1,g(null)};return $.jsx(Zm,{...d,value:m??t,onFocus:A=>{g(t),c?.(A)},onChange:A=>g(A.target.value),onBlur:k,onKeyDown:A=>{A.key==="Enter"&&A.target.blur(),A.key==="Escape"&&(S.current=!0,A.target.blur()),s?.(A)}})}const k_e=new Map,ORe=new Set;let u4t=0;function Fht(){u4t+=1;for(const t of ORe)t()}function i0n(t,n){return k_e.set(t,n),Fht(),()=>{k_e.get(t)===n&&(k_e.delete(t),Fht())}}function bBe(t){return ORe.add(t),()=>ORe.delete(t)}function o$(){return u4t}function o2(t){return t?k_e.get(t)??null:null}const QL=new Map;function o0n(t){QL.set(t,(QL.get(t)??0)+1);let n=!1;return()=>{if(n)return;n=!0;const s=(QL.get(t)??0)-1;s>0?QL.set(t,s):QL.delete(t)}}function zCr(t){return(QL.get(t)??0)>0}const PR=1e4;async function EC(t,n=4e3){if(t())return!0;const s=performance.now();return new Promise(c=>{const d=()=>{t()?c(!0):performance.now()-s>=n?c(!1):setTimeout(d,25)};setTimeout(d,0)})}const xZ=new Map,TB=new Set,che=new Set,A_e=new Set;let f4t=0;function d4t(){f4t+=1;for(const t of[...TB])t()}function VCr(t,n){return xZ.set(t,n),d4t(),()=>{xZ.get(t)===n&&xZ.delete(t)}}function UCr(t){xZ.has(t)&&d4t()}function JCr(t){return TB.add(t),()=>{TB.delete(t)}}function Mht(){return f4t}function cQ(t){return xZ.get(t)}function p4t(t,n=1e4){const s=cQ(t);return s!==void 0?Promise.resolve(s):new Promise(c=>{const d=()=>{const g=cQ(t);g!==void 0&&(clearTimeout(m),TB.delete(d),c(g))},m=setTimeout(()=>{TB.delete(d),c(void 0)},n);TB.add(d)})}function _4t(t){che.add(t);for(const n of[...A_e])n();return()=>{che.delete(t)}}function m4t(t,n=1e4){return che.has(t)?Promise.resolve(!0):new Promise(s=>{const c=()=>{che.has(t)&&(clearTimeout(d),A_e.delete(c),s(!0))},d=setTimeout(()=>{A_e.delete(c),s(!1)},n);A_e.add(c)})}async function SBe(t){if(zCr(t)&&!await EC(()=>o2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}let RRe=null;const ZY=new Map;let YO=[];function WCr(t){if(RRe=t,!t)return;const n=YO;YO=[];for(const s of n)h4t(t,s)}function h4t(t,n){ZY.get(n.id)?.();const s=t.show(n),c=()=>{ZY.get(n.id)===c&&(ZY.delete(n.id),s(),n.onDismiss?.())};return ZY.set(n.id,c),c}let HCr=0;function s$(t){const n=t.id??`notification-${++HCr}`,s={...t,id:n};return RRe?h4t(RRe,s):(YO=[...YO.filter(c=>c.id!==n),s],()=>xBe(n))}function xBe(t){const n=ZY.get(t);if(n){n();return}const s=YO.find(c=>c.id===t);s&&(YO=YO.filter(c=>c.id!==t),s.onDismiss?.())}let Xk={sessions:[],selectedSessionId:null,selectedSession:null,cursorMs:0,liveEdgeMs:0,loading:!0,error:null},lhe=!0,kpe=null,D_e=null,RG=null,P_e=!1;const QY=new Set;function GCr(t,n,s){const c=t[0]??null;return c!==null&&n.length>0&&!n.some(m=>m.id===c.id)?{sessionId:c.id,latestAppeared:!0}:s&&t.some(m=>m.id===s)?{sessionId:s,latestAppeared:!1}:{sessionId:c?.id??null,latestAppeared:!1}}function uhe(t){Xk=t;for(const n of QY)n()}async function KCr(){const t=await fetch("/__editor/gameplay-sessions");return(await L_(t,"Could not load Gameplay Sessions")).sessions}async function XCr(t){return L_(await fetch(`/__editor/gameplay-sessions/${encodeURIComponent(t)}`),"Could not load the selected Gameplay Session").then(n=>n.session)}async function YCr(){try{const t={sessions:await KCr()},n=GCr(t.sessions,Xk.sessions,D_e),s=n.sessionId;n.latestAppeared&&(lhe=!0),D_e=s;const c=s?await XCr(s):null;if(D_e!==s){P_e=!0;return}const d=t.sessions.map(S=>S.id===c?.id?c:S),m=c?.durationMs??0,g=lhe?m:Math.min(Xk.cursorMs,m);uhe({sessions:d,selectedSessionId:s,selectedSession:c,cursorMs:g,liveEdgeMs:m,loading:!1,error:null})}catch(t){uhe({...Xk,loading:!1,error:t instanceof Error?t.message:String(t)})}}function lQ(){return RG?(P_e=!0,RG):(RG=YCr().finally(()=>{RG=null,P_e&&(P_e=!1,lQ())}),RG)}function ZCr(t){return QY.add(t),QY.size===1&&(lQ(),kpe=window.setInterval(()=>void lQ(),1e3)),()=>{QY.delete(t),QY.size===0&&kpe!==null&&(window.clearInterval(kpe),kpe=null)}}function QCr(t){const n=Xk.sessions.find(s=>s.id===t);n&&(D_e=n.id,lhe=!0,uhe({...Xk,selectedSessionId:n.id,selectedSession:n,cursorMs:n.durationMs,liveEdgeMs:n.durationMs}),lQ())}function eEr(t){const n=Math.max(0,Math.min(t,Xk.liveEdgeMs));lhe=Xk.liveEdgeMs-n<250,uhe({...Xk,cursorMs:n})}const g4t={getSnapshot:()=>Xk,subscribe:ZCr,select:QCr,seek:eEr,refresh:lQ};let y4t=null;const FRe=new Set,s0n={getSnapshot:()=>y4t,subscribe(t){return FRe.add(t),()=>FRe.delete(t)}};function a0n(t){y4t=t;for(const n of FRe)try{n()}catch{}}let ZO={phase:null,at:0,run:0},dN=ZO;const MRe=new Map;let v4t=null;function tEr(t){v4t=t,b4t(ZO)}function b4t(t){ZO=t;try{v4t?.(t)}catch{}}function uQ(){const t=[...MRe.values()].at(-1),n=t?{...t,run:dN.run}:dN;n.phase===ZO.phase&&n.at===ZO.at&&n.run===ZO.run||b4t(n)}function c0n(t=Date.now()){return dN={phase:null,at:t,run:dN.run+1},uQ(),ZO.run}function l0n(t,n=Date.now()){dN={phase:t,at:n,run:dN.run},uQ()}function u0n(t=Date.now()){dN={phase:null,at:t,run:dN.run},uQ()}function wBe(t,n=Date.now()){const s=Symbol();return MRe.set(s,{phase:t.slice(0,160),at:n}),uQ(),()=>{MRe.delete(s)&&uQ()}}const rEr=Ye.lazy(()=>fo(()=>import("./GameplaySessionTimeline-B6GEizjr.js"),__vite__mapDeps([253,1,2,3,4,20,21,140,125,141,22,23])).then(t=>({default:t.GameplaySessionTimeline})));class TBe extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){console.error(`[tools] ${this.props.file} crashed while rendering:`,n,s.componentStack)}render(){return this.state.error?$.jsxs("div",{style:{padding:R_[6],fontSize:"var(--volter-font-md)",color:Go.semantic.danger,maxWidth:640},children:[$.jsxs("div",{style:{fontWeight:600,marginBottom:R_[2]},children:["Tool crashed: ",$.jsx("code",{children:this.props.file})]}),$.jsx("div",{style:{whiteSpace:"pre-wrap"},children:String(this.state.error)}),$.jsx("div",{style:{color:Go.content.muted,marginTop:R_[3]},children:"The editor is fine — fix the tool file and save; it reloads in place."})]}):this.props.children}}function nEr({contribution:t,Component:n,documentId:s,active:c,document:d,accountRevision:m,playKey:g}){const S=Ye.useRef(null),[k,A]=Ye.useState(null),F=Ye.useRef(null),D=Ye.useRef(null),J=Ye.useRef(t.file);J.current=t.file;const q=Ye.useRef(s);return q.current=s,Ye.useEffect(()=>{const G=S.current;if(!G)return;let se=!1;A(null);const pe=(Fe,De)=>{if(se)return;const be=Fe instanceof Error?Fe:new Error(String(Fe));console.error(`[tools] ${J.current} crashed while rendering:`,be,De?.componentStack),A(be),q.current&&_4t(q.current)},ue=G.appendChild(document.createElement("div"));ue.style.display="contents";const Ce=Xje.createRoot(ue,{onUncaughtError:pe});return F.current=Ce,()=>{se=!0,F.current=null,D.current?.(),D.current=null,queueMicrotask(()=>{Ce.unmount(),ue.remove()})}},[]),Ye.useEffect(()=>{const G=F.current;if(!G)return;A(null);const se={contributionId:t.id,client:Kye(),surfaces:uBe,account:YLe(),work:Ce=>{D.current?.(),D.current=Ce===null?null:wBe(`building ${Ce.replace(/^building /,"")}`)},notify:Ce=>s$({...Ce,id:`contribution:${t.id}:${Ce.title}`,...Ce.tone==="warning"?{fades:!0}:{}}),...t.point==="workspace.analytics"?{gameplaySessions:g4t}:{play:Dye()},...s?{documentId:s,publishContext:Ce=>VCr(s,Ce)}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}},pe=n??t.Component,ue=Ye.createElement(pe,{...se,...t.tool?{tool:t.tool}:{}});G.render(s?Ye.createElement(iEr,{documentId:s},ue):ue)},[m,c,t,n,s,d,g]),$.jsxs($.Fragment,{children:[k?$.jsxs("div",{style:{padding:R_[6],color:Go.semantic.danger},children:["Tool crashed: ",$.jsx("code",{children:t.file}),$.jsx("div",{style:{whiteSpace:"pre-wrap",marginTop:R_[2]},children:String(k)})]}):null,$.jsx("div",{ref:S,style:{minHeight:0,width:"100%"}})]})}function iEr({documentId:t,children:n}){return Ye.useEffect(()=>_4t(t),[t]),$.jsx($.Fragment,{children:n})}function IR({contribution:t,Component:n,documentId:s,active:c,document:d}){const m=Ye.useSyncExternalStore(Tye,cN,cN),g=Ye.useSyncExternalStore(Pye,lN,lN),S=t.point==="workspace.analytics"?"gameplay-sessions":g;return $.jsxs("div",{"data-testid":`tool-panel-${t.id}`,style:{flex:1,minHeight:0,overflow:t.point==="workspace.analytics"?"visible":"auto",color:Go.content.primary,display:"flex",flexDirection:"column"},children:[t.point==="workspace.analytics"?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(rEr,{})}):null,$.jsx(TBe,{file:t.file,children:$.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:$.jsx(nEr,{contribution:t,...n?{Component:n}:{},accountRevision:m,playKey:S,...s?{documentId:s}:{},...c!==void 0?{active:c}:{},...d?{document:d}:{}})})})]})}function oEr({id:t,title:n,file:s,tool:c,Component:d,adapter:m,nodeId:g}){Ye.useSyncExternalStore(Tye,cN,cN),Ye.useSyncExternalStore(Pye,lN,lN);const S=g?m.hierarchy.node(g):null;return $.jsx("div",{className:"volter-inspector-tool-section","data-testid":`inspector-tool-${t}`,children:$.jsx(TBe,{file:s,children:$.jsx(Vvr,{adapter:m,nodeId:g,children:$.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:Kye(),surfaces:uBe,account:YLe(),play:Dye(),node:S,nodeId:g,adapter:m})})})})}const sEr=Symbol("volter.inspection.mixed");function jRe(t){return t===sEr}function CBe(t){return t.readonlyReason??"This field is read-only."}function EBe(t){return"column"}function kBe(t,n){return t.quickActions.filter(s=>s.placement===n)}const LRe="preview",jht="transform",D5e="properties",S4t="stories",f0n="story-args",d0n="Story Args";function Lht(t){return`group:${t}`}const x4t=100,aEr=1e3,fQ=2e3,w4t=3e3,cEr=4e3,lEr=5e3,uEr={nullSubjectId:null};function T4t(t){return"sections"in t}const I_e=[];let C4t=0;const BRe=new Set;function Bht(){C4t++;for(const t of BRe)t()}function fEr(t){return BRe.add(t),()=>{BRe.delete(t)}}function $ht(){return C4t}function E4t(t){return I_e.push(t),Bht(),()=>{const n=I_e.indexOf(t);n>=0&&(I_e.splice(n,1),Bht())}}function qht(t,n,s=uEr){return I_e.filter(c=>c.match(t,n,s))}function k4t(t){if(typeof t!="object"||t===null)return!1;const n=t.name;return n==="Canceled"||n==="CancellationError"||n==="AbortError"}const dEr=1e3;class pEr{_entries=[];_listeners=new Set;_nextId=0;_version=0;_notifyScheduled=!1;_sink=null;setSink(n){this._sink=n}counts={info:0,warn:0,error:0};log(n,s){this._push("info",n,s)}warn(n,s){this._push("warn",n,s)}error(n,s){this._push("error",n,s)}logStructured(n,s,c,d,m){this._push(n,s,c,d,m)}clear(){this._entries=[],this.counts={info:0,warn:0,error:0},this._notify()}getEntries(){return this._entries}subscribe=n=>(this._listeners.add(n),()=>this._listeners.delete(n));getSnapshot=()=>this._version;_push(n,s,c,d,m){const g=this._entries[this._entries.length-1];if(g&&g.level===n&&g.message===s&&g.source===c&&g.metadata?.instanceId===m?.instanceId){g.count++,g.timestamp=Date.now(),this._sink?.(g),this._notify();return}const S={id:this._nextId++,timestamp:Date.now(),level:n,message:s,count:1};if(c&&(S.source=c),d&&(S.subsystem=d),m&&(S.metadata=m),this._entries.push(S),this.counts[n]++,this._sink?.(S),this._entries.length>dEr){const k=this._entries.shift();this.counts[k.level]=Math.max(0,this.counts[k.level]-1)}this._notify()}_notify(){this._version++,!this._notifyScheduled&&(this._notifyScheduled=!0,queueMicrotask(()=>{this._notifyScheduled=!1;for(const n of this._listeners)n()}))}}const ea=new pEr;typeof window<"u"&&(window.__volterEditorConsole=ea);const zht=1e3,Vht=4e3;function CB(t){try{const n=t;return typeof t=="object"&&n!==null&&typeof n.stack=="string"&&n.stack!==""&&typeof n.message=="string"?n.stack.includes(n.message)?n.stack:`${String(t)}
46
46
  ${n.stack}`:String(t)}catch{return Object.prototype.toString.call(t)}}function _Er(t){if(typeof t!="object"||t===null)return CB(t);const n=new WeakSet;let s;try{s=JSON.stringify(t,(c,d)=>typeof d!="object"||d===null?d:n.has(d)?"[Circular]":(n.add(d),d))}catch{s=void 0}return s===void 0?CB(t):s.length>zht?`${s.slice(0,zht)}…`:s}function $Re(t){if(t.length===0)return"";const[n,...s]=t;if(typeof n!="string"||s.length===0)return t.map(CB).join(" ");let c=0;const d=n.replace(/%([sdifoOjc%])/g,(g,S)=>{if(S==="%")return"%";if(c>=s.length)return g;const k=s[c++];switch(S){case"s":return typeof k=="string"?k:CB(k);case"d":case"i":{if(typeof k=="symbol")return"NaN";if(typeof k=="bigint")return String(k);const A=Number(k);return Number.isFinite(A)?String(Math.trunc(A)):String(A)}case"f":return typeof k=="symbol"?"NaN":String(Number(k));case"c":return"";default:return _Er(k)}}),m=s.slice(c);return m.length===0?d:`${d} ${m.map(CB).join(" ")}`}function mEr(t,n){const s=t[0];if(typeof s!="string"||!/^(Encountered two children with the same key|Each child in a list should have a unique|Maximum update depth exceeded|Cannot update a component)/.test(s))return n;try{const c=Ye.captureOwnerStack?.();return c?`${n}
47
47
  Owner stack:${c}`:n}catch{return n}}function qRe(t,n={}){const s=t instanceof Error?`${t.name}: ${t.message}`:CB(t),c=[n.source?`[${n.source}] ${s}`:s],d=n.componentStack?.trim();d&&c.push(`Component stack:
48
48
  ${d}`),t instanceof Error&&t.stack&&t.stack!==s&&c.push(`JavaScript stack:
@@ -887,7 +887,7 @@ ${De.description}`)},showException:De=>{throw De},forceRemount:!0,storyContext:u
887
887
  Are you using a V6-style sort function in V7 mode?
888
888
 
889
889
  More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#v7-style-story-sort
890
- `)}},{fetch:Rbn}=bl,HHr=new Set(["area","base","body","head","link","map","meta","nobr","optgroup","option","script","style","template","title","track","wbr"]);`${Array.from(HHr).map(t=>`:not(${t})`).join("")}`;var{history:Fbn,document:Mbn}=bl,GHr=u2(WDr()),{document:jbn}=bl;new GHr.default({escapeXML:!0});var{document:Lbn}=bl;async function AOt(t,n,s){let c=n.parameters?.docs?.source?.transform,{id:d,unmappedArgs:m}=n,g=c&&t?c?.(t,n):t,S=g?await g:void 0;C$.getChannel().emit(vNr,{id:d,source:S,args:m,warning:s})}var KHr=$6t;function DOt(t,n){return $6r(t,n,{staticLoader:J6r()})}const XHr=[/Failed to fetch dynamically imported module: (\S+)/,/error loading dynamically imported module: (\S+)/],YHr=/(?:\bimport\s*(?:[\w*{}\s,$]+\s*from\s*)?|\bexport\s*[\w*{}\s,$]+\s*from\s*)["']((?:\/|\.\.?\/)[^"']+)["']/g,ZHr=400,lSt=5;typeof performance<"u"&&typeof performance.setResourceTimingBufferSize=="function"&&performance.setResourceTimingBufferSize(5e3);function QHr(t){for(const n of XHr){const s=n.exec(t)?.[1];if(s)return s}return null}const Z9e=new Map,RY=new Map;function eGr(t){let n=Z9e.get(t);return n||(n=(async()=>{const s=await fetch(t,{cache:"no-store"}),c=s.headers.get("content-type")??"";if(!s.ok||!/javascript|ecmascript/.test(c))return{status:s.status,type:c,imports:[]};const d=await s.text(),m=new Set;for(const g of d.matchAll(YHr)){const S=g[1];/\.[a-z]+(?:[?#]|$)|\?|^\/@/i.test(S)&&m.add(new URL(S,t).href)}return{status:s.status,type:c,imports:[...m]}})(),Z9e.set(t,n)),n}function tGr(t){const n=RY.get(t);if(n)return n;if(RY.size>=lSt)return Promise.resolve({entry:t,fetched:0,failed:{url:t,status:null,detail:`not walked: ${lSt} other failed imports are being walked`}});const s=rGr(t).catch(c=>({entry:t,fetched:0,failed:{url:t,status:null,detail:`walk failed: ${String(c)}`}})).finally(()=>{RY.delete(t),RY.size===0&&Z9e.clear()});return RY.set(t,s),s}async function rGr(t){const n=new URL(t,location.href).href,s=new Map,c=[n];for(;c.length>0&&s.size<ZHr;){const S=c.shift();if(s.has(S))continue;let k;try{k=await eGr(S)}catch(A){return{entry:t,fetched:s.size+1,failed:{url:S,status:0,detail:String(A)}}}if(k.status!==200||!/javascript|ecmascript/.test(k.type))return{entry:t,fetched:s.size+1,failed:{url:S,status:k.status,detail:k.type||"(no content type)"}};s.set(S,k.imports);for(const A of k.imports)s.has(A)||c.push(A)}const d=[],m=new Set,g=S=>{if(!(m.has(S)||!s.has(S))){m.add(S);for(const k of s.get(S))g(k);d.push(S)}};g(n);for(const S of d)try{await import(S)}catch(k){const A=performance.getEntriesByType("resource").filter(F=>F.name===S).map(F=>`${"responseStatus"in F?F.responseStatus:"?"} (${F.transferSize}B over the wire, ${F.initiatorType}) at ${Math.round(F.startTime)}ms`);return{entry:t,fetched:s.size,failed:{url:S,status:null,detail:`every module it imports loads and the network serves it, but the loader refused it (${String(k)}); its attempts on this page: ${A.join(" | ")||"none kept"}`}}}return{entry:t,fetched:s.size,failed:null}}function nGr(t){const{failed:n}=t;if(!n)return`all ${t.fetched} modules from ${t.entry} fetch and import from the page now`;const s=n.status===null?"":` answered ${n.status}`;return`module ${n.url}${s}: ${n.detail} (walking ${t.fetched} modules from ${t.entry})`}var POt=(t,n)=>EOt(s=>mC.createElement(t,s),n),iGr=Object.create,_ze=Object.defineProperty,oGr=Object.getOwnPropertyDescriptor,IOt=Object.getOwnPropertyNames,sGr=Object.getPrototypeOf,aGr=Object.prototype.hasOwnProperty,B_=(t,n)=>function(){try{return n||(0,t[IOt(t)[0]])((n={exports:{}}).exports,n),n.exports}catch(s){throw n=0,s}},mze=(t,n)=>{for(var s in n)_ze(t,s,{get:n[s],enumerable:!0})},cGr=(t,n,s,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let d of IOt(n))!aGr.call(t,d)&&d!==s&&_ze(t,d,{get:()=>n[d],enumerable:!(c=oGr(n,d))||c.enumerable});return t},eq=(t,n,s)=>(s=t!=null?iGr(sGr(t)):{},cGr(n||!t||!t.__esModule?_ze(s,"default",{value:t,enumerable:!0}):s,t)),hze={};mze(hze,{applyDecorators:()=>POt,beforeAll:()=>hGr,decorators:()=>_Gr,mount:()=>pGr,parameters:()=>mGr,render:()=>uGr,renderToCanvas:()=>ROt});function uSt(t){globalThis.IS_REACT_ACT_ENVIRONMENT=t}function lGr(){return globalThis.IS_REACT_ACT_ENVIRONMENT}var NOt=async({disableAct:t=!1}={})=>n=>n(),uGr=(t,n)=>{let{id:s,component:c}=n;if(!c)throw new Error(`Unable to render story ${s} as the component annotation is missing from the default export`);return mC.createElement(c,{...t})},{FRAMEWORK_OPTIONS:fGr}=bl,dGr=class extends Ye.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){let{hasError:t}=this.state,{showMain:n}=this.props;t||n()}componentDidCatch(t){let{showException:n}=this.props;n(t)}render(){let{hasError:t}=this.state,{children:n}=this.props;return t?null:n}},fSt=fGr?.strictMode?Ye.StrictMode:Ye.Fragment,Q9e=[],U7e=!1,OOt=async()=>{if(U7e||Q9e.length===0)return;U7e=!0;let t=Q9e.shift();t&&await t(),U7e=!1,OOt()};async function ROt({storyContext:t,unboundStoryFn:n,showMain:s,showException:c,forceRemount:d},m){let{renderElement:g,unmountElement:S}=await fo(async()=>{const{renderElement:J,unmountElement:q}=await import("./react-18-By2b4xR9.js");return{renderElement:J,unmountElement:q}},__vite__mapDeps([253,3,2,4,23,21])),k=n,A=t.parameters.__isPortableStory?mC.createElement(k,{...t}):mC.createElement(dGr,{key:t.id,showMain:s,showException:c},mC.createElement(k,{...t})),F=fSt?mC.createElement(fSt,null,A):A;d&&S(m);let D=await NOt({disableAct:t.viewMode==="docs"});return await new Promise(async(J,q)=>{Q9e.push(async()=>{try{await D(async()=>{await g(F,m,t?.parameters?.react?.rootOptions)}),J()}catch(G){q(G)}}),OOt()}),async()=>{await D(()=>{S(m)})}}var pGr=t=>async n=>(n!=null&&(t.originalStoryFn=()=>n),await t.renderToCanvas(),t.canvas),_Gr=[(t,n)=>{if(!n.parameters?.react?.rsc)return t();let[s,c]=Ye.version.split(".").map(d=>parseInt(d,10));if(!Number.isInteger(s)||!Number.isInteger(c))throw new Error("Unable to parse React version");if(s<18||s===18&&c<3)throw new Error("React Server Components require React >= 18.3");return Ye.createElement(Ye.Suspense,null,t())},(t,n)=>{if(n.tags?.includes(LI.TEST_FN)&&!bl.FEATURES?.experimentalTestSyntax)throw new Error("To use the experimental test function, you must enable the experimentalTestSyntax feature flag. See https://storybook.js.org/docs/api/main-config/main-config-features#experimentaltestsyntax");return t()}],mGr={renderer:"react"},hGr=async()=>{try{let t=await NOt();RJr({unstable_advanceTimersWrapper:n=>t(n),asyncWrapper:async n=>{let s=lGr();uSt(!1);try{let c=await n();return await new Promise(d=>{setTimeout(()=>{d()},0);let m=gGr(globalThis);m&&m.advanceTimersByTime(0)}),c}finally{uSt(s)}},eventWrapper:n=>{let s;return t(()=>(s=n(),s)),s}})}catch{}};function gGr(t){let n=Reflect.get(t,"jest");return n==null?void 0:setTimeout._isMockFunction===!0||Object.prototype.hasOwnProperty.call(setTimeout,"clock")?n:void 0}var yGr=B_({"../../../node_modules/@base2/pretty-print-object/dist/index.js"(t){var n=t&&t.__assign||function(){return n=Object.assign||function(k){for(var A,F=1,D=arguments.length;F<D;F++){A=arguments[F];for(var J in A)Object.prototype.hasOwnProperty.call(A,J)&&(k[J]=A[J])}return k},n.apply(this,arguments)},s=t&&t.__spreadArrays||function(){for(var k=0,A=0,F=arguments.length;A<F;A++)k+=arguments[A].length;for(var D=Array(k),J=0,A=0;A<F;A++)for(var q=arguments[A],G=0,se=q.length;G<se;G++,J++)D[J]=q[G];return D};Object.defineProperty(t,"__esModule",{value:!0});var c=[];function d(k){var A=typeof k;return k!==null&&(A==="object"||A==="function")}function m(k){return Object.prototype.toString.call(k)==="[object RegExp]"}function g(k){return Object.getOwnPropertySymbols(k).filter(function(A){return Object.prototype.propertyIsEnumerable.call(k,A)})}function S(k,A,F){F===void 0&&(F="");var D={indent:" ",singleQuotes:!0},J=n(n({},D),A),q;J.inlineCharacterLimit===void 0?q={newLine:`
890
+ `)}},{fetch:Rbn}=bl,HHr=new Set(["area","base","body","head","link","map","meta","nobr","optgroup","option","script","style","template","title","track","wbr"]);`${Array.from(HHr).map(t=>`:not(${t})`).join("")}`;var{history:Fbn,document:Mbn}=bl,GHr=u2(WDr()),{document:jbn}=bl;new GHr.default({escapeXML:!0});var{document:Lbn}=bl;async function AOt(t,n,s){let c=n.parameters?.docs?.source?.transform,{id:d,unmappedArgs:m}=n,g=c&&t?c?.(t,n):t,S=g?await g:void 0;C$.getChannel().emit(vNr,{id:d,source:S,args:m,warning:s})}var KHr=$6t;function DOt(t,n){return $6r(t,n,{staticLoader:J6r()})}const XHr=[/Failed to fetch dynamically imported module: (\S+)/,/error loading dynamically imported module: (\S+)/],YHr=/(?:\bimport\s*(?:[\w*{}\s,$]+\s*from\s*)?|\bexport\s*[\w*{}\s,$]+\s*from\s*)["']((?:\/|\.\.?\/)[^"']+)["']/g,ZHr=400,lSt=5;typeof performance<"u"&&typeof performance.setResourceTimingBufferSize=="function"&&performance.setResourceTimingBufferSize(5e3);function QHr(t){for(const n of XHr){const s=n.exec(t)?.[1];if(s)return s}return null}const Z9e=new Map,RY=new Map;function eGr(t){let n=Z9e.get(t);return n||(n=(async()=>{const s=await fetch(t,{cache:"no-store"}),c=s.headers.get("content-type")??"";if(!s.ok||!/javascript|ecmascript/.test(c))return{status:s.status,type:c,imports:[]};const d=await s.text(),m=new Set;for(const g of d.matchAll(YHr)){const S=g[1];/\.[a-z]+(?:[?#]|$)|\?|^\/@/i.test(S)&&m.add(new URL(S,t).href)}return{status:s.status,type:c,imports:[...m]}})(),Z9e.set(t,n)),n}function tGr(t){const n=RY.get(t);if(n)return n;if(RY.size>=lSt)return Promise.resolve({entry:t,fetched:0,failed:{url:t,status:null,detail:`not walked: ${lSt} other failed imports are being walked`}});const s=rGr(t).catch(c=>({entry:t,fetched:0,failed:{url:t,status:null,detail:`walk failed: ${String(c)}`}})).finally(()=>{RY.delete(t),RY.size===0&&Z9e.clear()});return RY.set(t,s),s}async function rGr(t){const n=new URL(t,location.href).href,s=new Map,c=[n];for(;c.length>0&&s.size<ZHr;){const S=c.shift();if(s.has(S))continue;let k;try{k=await eGr(S)}catch(A){return{entry:t,fetched:s.size+1,failed:{url:S,status:0,detail:String(A)}}}if(k.status!==200||!/javascript|ecmascript/.test(k.type))return{entry:t,fetched:s.size+1,failed:{url:S,status:k.status,detail:k.type||"(no content type)"}};s.set(S,k.imports);for(const A of k.imports)s.has(A)||c.push(A)}const d=[],m=new Set,g=S=>{if(!(m.has(S)||!s.has(S))){m.add(S);for(const k of s.get(S))g(k);d.push(S)}};g(n);for(const S of d)try{await import(S)}catch(k){const A=performance.getEntriesByType("resource").filter(F=>F.name===S).map(F=>`${"responseStatus"in F?F.responseStatus:"?"} (${F.transferSize}B over the wire, ${F.initiatorType}) at ${Math.round(F.startTime)}ms`);return{entry:t,fetched:s.size,failed:{url:S,status:null,detail:`every module it imports loads and the network serves it, but the loader refused it (${String(k)}); its attempts on this page: ${A.join(" | ")||"none kept"}`}}}return{entry:t,fetched:s.size,failed:null}}function nGr(t){const{failed:n}=t;if(!n)return`all ${t.fetched} modules from ${t.entry} fetch and import from the page now`;const s=n.status===null?"":` answered ${n.status}`;return`module ${n.url}${s}: ${n.detail} (walking ${t.fetched} modules from ${t.entry})`}var POt=(t,n)=>EOt(s=>mC.createElement(t,s),n),iGr=Object.create,_ze=Object.defineProperty,oGr=Object.getOwnPropertyDescriptor,IOt=Object.getOwnPropertyNames,sGr=Object.getPrototypeOf,aGr=Object.prototype.hasOwnProperty,B_=(t,n)=>function(){try{return n||(0,t[IOt(t)[0]])((n={exports:{}}).exports,n),n.exports}catch(s){throw n=0,s}},mze=(t,n)=>{for(var s in n)_ze(t,s,{get:n[s],enumerable:!0})},cGr=(t,n,s,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let d of IOt(n))!aGr.call(t,d)&&d!==s&&_ze(t,d,{get:()=>n[d],enumerable:!(c=oGr(n,d))||c.enumerable});return t},eq=(t,n,s)=>(s=t!=null?iGr(sGr(t)):{},cGr(n||!t||!t.__esModule?_ze(s,"default",{value:t,enumerable:!0}):s,t)),hze={};mze(hze,{applyDecorators:()=>POt,beforeAll:()=>hGr,decorators:()=>_Gr,mount:()=>pGr,parameters:()=>mGr,render:()=>uGr,renderToCanvas:()=>ROt});function uSt(t){globalThis.IS_REACT_ACT_ENVIRONMENT=t}function lGr(){return globalThis.IS_REACT_ACT_ENVIRONMENT}var NOt=async({disableAct:t=!1}={})=>n=>n(),uGr=(t,n)=>{let{id:s,component:c}=n;if(!c)throw new Error(`Unable to render story ${s} as the component annotation is missing from the default export`);return mC.createElement(c,{...t})},{FRAMEWORK_OPTIONS:fGr}=bl,dGr=class extends Ye.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){let{hasError:t}=this.state,{showMain:n}=this.props;t||n()}componentDidCatch(t){let{showException:n}=this.props;n(t)}render(){let{hasError:t}=this.state,{children:n}=this.props;return t?null:n}},fSt=fGr?.strictMode?Ye.StrictMode:Ye.Fragment,Q9e=[],U7e=!1,OOt=async()=>{if(U7e||Q9e.length===0)return;U7e=!0;let t=Q9e.shift();t&&await t(),U7e=!1,OOt()};async function ROt({storyContext:t,unboundStoryFn:n,showMain:s,showException:c,forceRemount:d},m){let{renderElement:g,unmountElement:S}=await fo(async()=>{const{renderElement:J,unmountElement:q}=await import("./react-18-By2b4xR9.js");return{renderElement:J,unmountElement:q}},__vite__mapDeps([254,3,2,4,23,21])),k=n,A=t.parameters.__isPortableStory?mC.createElement(k,{...t}):mC.createElement(dGr,{key:t.id,showMain:s,showException:c},mC.createElement(k,{...t})),F=fSt?mC.createElement(fSt,null,A):A;d&&S(m);let D=await NOt({disableAct:t.viewMode==="docs"});return await new Promise(async(J,q)=>{Q9e.push(async()=>{try{await D(async()=>{await g(F,m,t?.parameters?.react?.rootOptions)}),J()}catch(G){q(G)}}),OOt()}),async()=>{await D(()=>{S(m)})}}var pGr=t=>async n=>(n!=null&&(t.originalStoryFn=()=>n),await t.renderToCanvas(),t.canvas),_Gr=[(t,n)=>{if(!n.parameters?.react?.rsc)return t();let[s,c]=Ye.version.split(".").map(d=>parseInt(d,10));if(!Number.isInteger(s)||!Number.isInteger(c))throw new Error("Unable to parse React version");if(s<18||s===18&&c<3)throw new Error("React Server Components require React >= 18.3");return Ye.createElement(Ye.Suspense,null,t())},(t,n)=>{if(n.tags?.includes(LI.TEST_FN)&&!bl.FEATURES?.experimentalTestSyntax)throw new Error("To use the experimental test function, you must enable the experimentalTestSyntax feature flag. See https://storybook.js.org/docs/api/main-config/main-config-features#experimentaltestsyntax");return t()}],mGr={renderer:"react"},hGr=async()=>{try{let t=await NOt();RJr({unstable_advanceTimersWrapper:n=>t(n),asyncWrapper:async n=>{let s=lGr();uSt(!1);try{let c=await n();return await new Promise(d=>{setTimeout(()=>{d()},0);let m=gGr(globalThis);m&&m.advanceTimersByTime(0)}),c}finally{uSt(s)}},eventWrapper:n=>{let s;return t(()=>(s=n(),s)),s}})}catch{}};function gGr(t){let n=Reflect.get(t,"jest");return n==null?void 0:setTimeout._isMockFunction===!0||Object.prototype.hasOwnProperty.call(setTimeout,"clock")?n:void 0}var yGr=B_({"../../../node_modules/@base2/pretty-print-object/dist/index.js"(t){var n=t&&t.__assign||function(){return n=Object.assign||function(k){for(var A,F=1,D=arguments.length;F<D;F++){A=arguments[F];for(var J in A)Object.prototype.hasOwnProperty.call(A,J)&&(k[J]=A[J])}return k},n.apply(this,arguments)},s=t&&t.__spreadArrays||function(){for(var k=0,A=0,F=arguments.length;A<F;A++)k+=arguments[A].length;for(var D=Array(k),J=0,A=0;A<F;A++)for(var q=arguments[A],G=0,se=q.length;G<se;G++,J++)D[J]=q[G];return D};Object.defineProperty(t,"__esModule",{value:!0});var c=[];function d(k){var A=typeof k;return k!==null&&(A==="object"||A==="function")}function m(k){return Object.prototype.toString.call(k)==="[object RegExp]"}function g(k){return Object.getOwnPropertySymbols(k).filter(function(A){return Object.prototype.propertyIsEnumerable.call(k,A)})}function S(k,A,F){F===void 0&&(F="");var D={indent:" ",singleQuotes:!0},J=n(n({},D),A),q;J.inlineCharacterLimit===void 0?q={newLine:`
891
891
  `,newLineOrSpace:`
892
892
  `,pad:F,indent:F+J.indent}:q={newLine:"@@__PRETTY_PRINT_NEW_LINE__@@",newLineOrSpace:"@@__PRETTY_PRINT_NEW_LINE_OR_SPACE__@@",pad:"@@__PRETTY_PRINT_PAD__@@",indent:"@@__PRETTY_PRINT_INDENT__@@"};var G=function(ue){if(J.inlineCharacterLimit===void 0)return ue;var Ce=ue.replace(new RegExp(q.newLine,"g"),"").replace(new RegExp(q.newLineOrSpace,"g")," ").replace(new RegExp(q.pad+"|"+q.indent,"g"),"");return Ce.length<=J.inlineCharacterLimit?Ce:ue.replace(new RegExp(q.newLine+"|"+q.newLineOrSpace,"g"),`
893
893
  `).replace(new RegExp(q.pad,"g"),F).replace(new RegExp(q.indent,"g"),F+J.indent)};if(c.indexOf(k)!==-1)return'"[Circular]"';if(k==null||typeof k=="number"||typeof k=="boolean"||typeof k=="function"||typeof k=="symbol"||m(k))return String(k);if(k instanceof Date)return"new Date('"+k.toISOString()+"')";if(Array.isArray(k)){if(k.length===0)return"[]";c.push(k);var se="["+q.newLine+k.map(function(ue,Ce){var Fe=k.length-1===Ce?q.newLine:","+q.newLineOrSpace,De=S(ue,J,F+J.indent);return J.transform&&(De=J.transform(k,Ce,De)),q.indent+De+Fe}).join("")+q.pad+"]";return c.pop(),G(se)}if(d(k)){var pe=s(Object.keys(k),g(k));if(J.filter&&(pe=pe.filter(function(Ce){return J.filter&&J.filter(k,Ce)})),pe.length===0)return"{}";c.push(k);var se="{"+q.newLine+pe.map(function(Ce,Fe){var De=pe.length-1===Fe?q.newLine:","+q.newLineOrSpace,be=typeof Ce=="symbol",X=!be&&/^[a-z$_][a-z$_0-9]*$/i.test(Ce.toString()),we=be||X?Ce:S(Ce,J),Be=S(k[Ce],J,F+J.indent);return J.transform&&(Be=J.transform(k,Ce,Be)),q.indent+String(we)+": "+Be+De}).join("")+q.pad+"}";return c.pop(),G(se)}return k=String(k).replace(/[\r\n]/g,function(ue){return ue===`
@@ -939,7 +939,7 @@ ${n}`,d=lZ.get(c);if(d)return d;const m=_Yr(t,s,n).finally(()=>{lZ.get(c)===m&&l
939
939
  body{margin:0;min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 50% 30%,#1c2a3a 0,#101318 52%,#0b0e13 100%)}
940
940
  main{width:min(440px,100%);box-sizing:border-box;padding:34px;text-align:center;border:1px solid rgba(255,255,255,.1);border-radius:20px;background:rgba(23,28,35,.92);box-shadow:0 22px 60px rgba(0,0,0,.38)}
941
941
  .brand-mark{width:68px;height:68px;margin:0 auto 20px}.brand-mark img{display:block;width:100%;height:100%}h1{margin:0 0 10px;font-size:22px}p{margin:0;color:#aeb9c6;font-size:14px;line-height:1.6}
942
- </style><main><div class="brand-mark">${a4r()}</div><h1>Session ended</h1><p>This editor session has ended. You can close this tab.</p></main>`})}))}const Tge=new Set;function aZr(t){return Tge.add(t),()=>{Tge.delete(t)}}function cZr(){try{window.focus()}catch{}if(Tge.size===0){window.location.reload();return}for(const t of[...Tge])t()}function lZr(t,n,s={}){t.addEventListener("tab-refocus",c=>tZr(c)),t.addEventListener("tab-yield",c=>rZr(n,c)),t.addEventListener("tab-close",()=>sZr(n,s)),t.addEventListener("tab-adopt",()=>cZr())}const $k="/__editor",uZr=globalThis,md=uZr.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__,wC=md?.clientId??globalThis.crypto?.randomUUID?.()??`editor-${Date.now()}`,G0e=jAt,fZr=ewr;function dZr(t,n,s){md?.reportPhase?.(t,n,s)}function pZr(t){md?.reportCensus?.(t)}function _Zr(){md?.stopHeartbeat?.();const t=kw;if(t!==null){kw=null,eB=0,md?.source===t&&(md.source=null),P$===t&&(P$=null);try{t.close()}catch{}}}function mZr(){const t=new URLSearchParams({clientId:wC,participantId:G0e,displayName:fZr});return md?.tabId&&t.set("tabId",md.tabId),`${$k}/events?${t}`}let kw=md?.source??null,eB=md?.source&&md.pageOwned?1:0,P$=null;const RRt=new Set(["editor-command"]);function FRt(t,n){if(!md||md.source!==t)return;md.queueListeners=md.queueListeners.filter(({type:c,listener:d})=>n(c)?(t.removeEventListener(c,d),!1):!0);const s=md.pending.filter(c=>n(c.type));md.pending=md.pending.filter(c=>!n(c.type));for(const{type:c,data:d}of s)t.dispatchEvent(new MessageEvent(c,{data:d}))}function hZr(t){P$!==t&&(P$=t,lZr(t,$k,{tabId:md?.tabId,epoch:md?.epoch}),FRt(t,n=>!RRt.has(n)))}function jD(){kw||(md?.source?(kw=md.source,md.pageOwned&&eB++):(kw=new EventSource(mZr()),md&&(md.source=kw)));const t=kw;hZr(t),eB++;const n=[];let s=!1;return{addEventListener(c,d){const m=d;t.addEventListener(c,m),n.push({type:c,listener:m}),RRt.has(c)&&FRt(t,g=>g===c)},removeEventListener(c,d){const m=d;t.removeEventListener(c,m);const g=n.findIndex(S=>S.type===c&&S.listener===m);g>=0&&n.splice(g,1)},close(){if(!s){s=!0;for(const{type:c,listener:d}of n)t.removeEventListener(c,d);n.length=0,eB--,eB<=0&&(t.close(),kw===t&&(kw=null),md?.source===t&&(md.source=null),P$===t&&(P$=null),eB=0)}}}}function gZr(){const t=kw??md?.source??null;if(!t)return"unknown";if(typeof t.connected=="boolean")return t.connected?"open":"closed";const n=t.readyState;return typeof n=="number"?n===1?"open":"closed":"unknown"}function yZr(){if(typeof EventSource>"u")return()=>{};const t=jD(),n=Oze(c=>{c!==null&&c.reason!=="server-gone"&&_Zr()}),s=bZr();return()=>{s(),n(),t.close()}}const vZr=5;function bZr(){if(typeof window>"u")return()=>{};let t=0;const n=d=>{d===""||t>=vZr||(t+=1,FZ("console-entries",{entries:[{id:`boot-error:${t}`,severity:"error",message:`editor runtime error: ${d}`,source:"runtime",occurrences:1}],_clientId:md?.clientId??"boot"}))},s=d=>{const m=d.error;n(m?.stack??`${d.message} (${d.filename??"?"}:${d.lineno??0})`)},c=d=>{const m=d.reason;k4t(m)||n(m instanceof Error?m.stack??m.message:`unhandled rejection: ${String(m)}`)};return window.addEventListener("error",s),window.addEventListener("unhandledrejection",c),()=>{window.removeEventListener("error",s),window.removeEventListener("unhandledrejection",c)}}const SZr=2e3,xZr={"command-received":`${$k}/command-received`,"command-result":`${$k}/command-result`,"command-listener":`${$k}/command-listener`,"console-entries":`${$k}/console-entries`,"console-resolved":`${$k}/console-resolved`,"play-phase":`${$k}/play-phase`,state:`${$k}/state`,"tab-route":`${$k}/tab/route`};async function FZ(t,n){if(!(typeof fetch>"u"))try{await fetch(xZr[t],{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...md?.controlLifecycle?{_controlLifecycle:md.controlLifecycle}:{}})})}catch{}}async function bN(t,n){(kw??md?.source??null)?.send?.(t,n)||await FZ(t,n)}async function wZr(t,n){const s=kw??md?.source??null;if(!s){await FZ("command-result",n);return}let c;const d=new Promise(A=>{c=A}),m=A=>{const F=A.data;let D=F;if(typeof F=="string")try{D=JSON.parse(F)}catch{}D===t&&c()};s.addEventListener(MSt,m);const g={...n,_awaitCallerReceipt:!0};s.send?.("command-result",g)||await FZ("command-result",g);let S,k=!1;await Promise.race([d.then(()=>{k=!0}),new Promise(A=>{S=setTimeout(A,SZr)})]),S!==void 0&&clearTimeout(S),k||await FZ("command-result",n),s.removeEventListener(MSt,m)}function TZr(t){bN("tab-route",{clientId:wC,participantId:G0e,route:t})}function Rze(t){return{ok:!1,reason:t instanceof Error?t.message:String(t)}}async function CZr(t,n){try{const s=new URLSearchParams({root:t,dir:n}),c=await fetch(`${Jl}/assets?${s}`,{cache:"no-store"});return{ok:!0,entries:(await L_(c,`Could not list ${t}/${n} from ${Jl}/assets`)).entries??[]}}catch(s){return Rze(s)}}async function K0e(t,n){if(t!=="public")return CZr(t,n);try{return{ok:!0,entries:(await gR().list(n)).map(c=>({name:c.name,type:c.type==="dir"?"directory":"file",...c.size===void 0?{}:{size:c.size},...c.mtime===void 0?{}:{modifiedAt:c.mtime}}))}}catch(s){return Rze(s)}}async function MRt(){try{const t=await fetch(`${Jl}/project-components`,{cache:"no-store"});return{ok:!0,entries:(await L_(t,`Could not list project components from ${Jl}/project-components`)).components??[]}}catch(t){return Rze(t)}}function e2n(t){return`${Jl}/download?file=${encodeURIComponent(t)}`}class LSt extends Error{constructor(n,s){super(s),this.code=n,this.name="AssetDeliveryError"}}function BSt(t){return{offline:"Network delivery is offline. SSD assets remain available.","quota-limited":"The remote provider quota is exhausted. Retry after the provider resets it.","license-blocked":"This delivery is blocked because its license terms are not accepted.",unavailable:"No healthy SSD, cloud, or remote delivery is available for this variant.","provider-error":"The remote provider could not return delivery metadata. Retry the request."}[t]}const Cge=new Map,Ege=new Set;function Fze(t,n){return`${t}:${n}`}function t2n(t,n){return Cge.get(Fze(t,n))??null}function r2n(t){return Ege.add(t),()=>Ege.delete(t)}async function n2n(){try{const t=await fetch(`${Jl}/asset-library/downloaded`),n=await L_(t,"Could not read the downloaded-asset list");Cge.clear();for(const s of n.downloaded)Cge.set(Fze(s.source,s.id),`/${s.path}`);for(const s of Ege)s()}catch{}}async function i2n(t){const n=new URLSearchParams;n.set("source",t.source),n.set("type",t.type),t.q&&n.set("q",t.q),t.category&&n.set("category",t.category),t.offset!=null&&n.set("offset",String(t.offset)),t.limit!=null&&n.set("limit",String(t.limit));const s=await fetch(`${Jl}/asset-library/search?${n}`);if(sf(s,"Asset Library search failed"),!s.ok){const c=await s.json().catch(()=>null);throw new Error(c?.error??`Asset Library search failed (${s.status}).`)}return await s.json()}async function o2n(t,n){return EZr(t,n)}async function EZr(t,n){const s=new URLSearchParams({source:t,id:n});let c;try{c=await fetch(`${Jl}/asset-library/files?${s}`)}catch(m){throw new LSt("offline",m instanceof Error?m.message:BSt("offline"))}if(sf(c,"Asset Library file lookup failed"),!c.ok){const m=await c.json().catch(()=>null),g=c.status===403?"license-blocked":c.status===429?"quota-limited":c.status===404?"unavailable":"provider-error";throw new LSt(g,m?.error??BSt(g))}return(await c.json()).files}async function s2n(t,n){const s=new URLSearchParams({source:t,id:n}),c=await fetch(`${Jl}/asset-library/preview?${s}`);return sf(c,"Could not resolve an asset preview"),c.ok?await c.json():null}async function a2n(t){const n=await fetch(`${Jl}/asset-library/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,signal:void 0}),...t.signal?{signal:t.signal}:{}});sf(n,"Could not download the asset");const s=await n.json();if(s.ok&&s.path){Cge.set(Fze(t.source,t.id),`/${s.path}`);for(const c of Ege)c()}return s}async function c2n(t){const n=await fetch(`${Jl}/asset-library/history/capture`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t})});sf(n,"Asset history capture failed");const s=await n.json();if(!n.ok||!s.token)throw new Error(s.error??`Asset history capture failed (${n.status}).`);return s.token}async function l2n(t,n){const s=await fetch(`${Jl}/asset-library/history/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t,token:n})});if(sf(s,"Asset history restore failed"),!s.ok){const c=await s.json().catch(()=>null);throw new Error(c?.error??`Asset history restore failed (${s.status}).`)}}async function u2n(t,n){const s=new URLSearchParams({type:t});n&&s.set("source",n);const c=await fetch(`${Jl}/asset-library/categories?${s}`);return sf(c,"Could not read Asset Library categories"),c.ok?(await c.json()).categories:[]}function kZr(t){if(!t||typeof t!="object")return null;const n=t;return n.apiVersion!==1||typeof n.engineVersion!="string"&&n.engineVersion!==null||typeof n.manifestVersion!="number"||typeof n.startedAt!="string"||!n.source||n.source.state!=="current"&&n.source.state!=="restart-required"||n.source.state==="restart-required"&&(typeof n.source.changedPath!="string"||typeof n.source.changedAt!="string")?null:n}async function AZr(){let t;try{t=await fetch(`${Jl}/compatibility`,{cache:"no-store"})}catch(n){throw MFe(n instanceof Error?n.message:String(n))}if(t.status>=500)throw MFe(`HTTP ${t.status}`);try{CN(t,`GET ${Jl}/compatibility`)}catch{return null}try{return kZr(await t.json())}catch{return null}}async function Mze(){const t=await AZr();if(!t)throw _4r();return m4r(t),t}async function DZr(){try{const t=await fetch(`${Jl}/recent-projects`);return(await L_(t,"Could not list recent projects")).projects}catch{return[]}}async function f2n(t){const n=await fetch(`${Jl}/recent-projects`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});CN(n,"Could not remove recent project")}const $St={reopenLastProject:!1};async function PZr(){try{const t=await fetch(`${Jl}/launcher-settings`),n=await L_(t,"Could not read launcher settings");return{reopenLastProject:typeof n.reopenLastProject=="boolean"?n.reopenLastProject:$St.reopenLastProject}}catch{return{...$St}}}async function d2n(t){const n=await fetch(`${Jl}/launcher-settings`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await L_(n,"Could not save launcher settings")}async function p2n(t,n,s,c,d,m=[]){const g=await fetch(`${Jl}/create-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,location:n,template:s,...c?{exampleId:c}:{},...d?{presentation:d}:{},...m.length>0?{additions:m}:{}})});return sf(g,"Could not create the project"),await g.json()}async function _2n(t){try{const n=await fetch(`${Jl}/browse-folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t})});return(await L_(n,"Could not open the folder picker")).path}catch{return null}}async function m2n(t){const n=await fetch(`${Jl}/inspect-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});sf(n,`Could not inspect ${t}`);const s=await n.json();if(!n.ok||!s.path||!s.report)throw new Error(s.error??`Could not inspect ${t}.`);return{path:s.path,report:s.report}}async function h2n(t,n){const s=await fetch(`${Jl}/adapt-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,...n})});sf(s,`Could not add Volter Editor metadata to ${t}`);const c=await s.json();if(!s.ok||!c.path||!c.writes)throw new Error(c.error??`Could not add Volter Editor metadata to ${t}.`);return{path:c.path,writes:c.writes}}async function bMe(t){const n=await fetch(`${Jl}/reveal`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});CN(n,`Could not reveal ${t}`)}async function g2n(t){try{const n=await fetch(`${Jl}/save-thumbnail`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:t})});return CN(n,"Could not save the project thumbnail"),!0}catch{return!1}}async function jze(){let t;try{const s=await fetch(`${Jl}/project`);t=await L_(s,`No answer from ${Jl}/project`)}catch(s){return{status:"unknown",error:s instanceof Error?s.message:String(s)}}if(t.project)return{status:"project",project:t.project};const n=t.serving;return n&&typeof n.path=="string"?{status:"unreadable",path:n.path,error:typeof n.error=="string"?n.error:"unknown error"}:t.project===null?{status:"none"}:{status:"unknown",error:`Unrecognized ${Jl}/project response`}}async function y2n(){const t=await jze();return t.status==="project"?t.project:null}async function v2n(t){const n=await Mze(),s=await fetch(`${Jl}/open-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});let c;try{sf(s,`Could not open project at ${t}`),c=await s.json()}catch(m){throw MFe(m instanceof Error?m.message:`HTTP ${s.status} returned an invalid response`)}if(!s.ok){if(c&&typeof c=="object"){const m=c;if(typeof m.error=="string"&&f4r(m.recovery))throw new DC(m.error,m.recovery);if(typeof m.error=="string")throw new Error(m.error)}throw new Error(`Could not open project at ${t}: HTTP ${s.status}`)}const d=c;return d.config&&g$e(d.config,n),d}function X0e(t){return/^(\/|https?:|data:|blob:)/.test(t)?t:`/${t}`}async function IZr(t){try{const n=await fetch(X0e(t));if(n.ok)return await n.text()}catch{}return null}async function SMe(t){try{const n=await fetch(`/__editor/source-file?path=${encodeURIComponent(t.replace(/^\.?\//,""))}`,{cache:"no-store"});if(n.ok)return await n.text()}catch{}return null}function NZr(t){return(t.headers.get("content-type")??"").toLowerCase().includes("text/html")}async function jRt(t){try{const n=await fetch(X0e(t),{method:"HEAD"});return n.ok?NZr(n)?"absent":"present":"absent"}catch{return"unreachable"}}async function OZr(t){return await jRt(t)==="present"}async function b2n(t,n,s){try{const c=s==="base64"?T4r(n):n;return await gR().write(t,c),!0}catch{return!1}}async function LRt(t,n={}){if(t.length===0)return[];const s=await fetch(`/__editor/source-files?${new URLSearchParams([...t.map(d=>["include",d]),...n.order==="mtime"?[["order","mtime"]]:[]])}`);return s.ok?(await s.json()).files??[]:[]}async function S2n(){const t=await fetch(`${Jl}/validation-log`);return(await L_(t,"Could not read the server validation log")).entries??[]}async function RZr(t=3e3){if(typeof fetch>"u")return{ok:!1};try{const n=await fetch(`${Jl}/project`,{signal:AbortSignal.timeout(t)}),s=await L_(n,"Editor lease poll failed");return{ok:!0,identity:{project:typeof s.project?.path=="string"?s.project.path:null,pid:typeof s.session?.pid=="number"?s.session.pid:null}}}catch{return{ok:!1}}}async function FZr(){try{const t=await fetch(`${Jl}/editor-state`);return await L_(t,"Could not read editor state")}catch{return{}}}let qSt=!1;async function MZr(t,n={}){try{const s=await ZDt(`${Jl}/editor-state`,JSON.stringify(t),n.leaving===!0);return CN(s,"Could not save editor state"),!0}catch(s){return qSt||(qSt=!0,console.error(s instanceof Error?s.message:String(s))),!1}}let fZ=null,kge=null;async function BRt(){for(;fZ;){const t=fZ;fZ=null,await bN("state",{...t,_clientId:wC})}kge=null,fZ&&(kge=BRt())}function zSt(t){return fZ=t,kge??=BRt(),kge}async function jZr(t){await bN("command-received",{_requestId:t,_clientId:wC})}async function i_e(t){await bN("command-listener",{_clientId:wC,attached:t})}let LZr=0;function BZr(t){const n=++LZr;dZr(t.phase,wC,n),bN("play-phase",{_clientId:wC,...t,source:wC,sequence:n})}async function VSt(t,n,s,c,d=!1){const m={_requestId:t,_clientId:wC,ok:n,error:s,data:c};d?await wZr(t,m):await bN("command-result",m)}async function rte(t,n){sf(t,`gameplay recording ${n} failed`);const s=await t.json().catch(()=>({}));if(!t.ok)throw new Error(`gameplay recording ${n} failed: ${typeof s.error=="string"?s.error:`HTTP ${t.status}`}`);return s}async function x2n(t,n){const s=await fetch(`${Jl}/recording/start`,{...n?{signal:n}:{},method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});return rte(s,"start")}async function w2n(t,n,s,c){const d=new URLSearchParams({id:t.id,sequence:String(n)}),m=await fetch(`${Jl}/recording/dom?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":"application/octet-stream"},body:s});await rte(m,"DOM event upload")}async function T2n(t,n,s,c){const d=new URLSearchParams({id:t.id,name:n}),m=await fetch(`${Jl}/recording/asset?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":s.type||"application/octet-stream"},body:s});await rte(m,"replay asset upload")}async function C2n(t,n,s,c){const d=new URLSearchParams({id:t.id,sequence:String(n)}),m=await fetch(`${Jl}/recording/chunk?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":"application/octet-stream"},body:s});await rte(m,"chunk upload")}async function E2n(t,n,s,c){const d=await fetch(`${Jl}/recording/finish`,{...s?{signal:s}:{},method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id,reason:n??null,replay:c??null})});await rte(d,"finish")}async function k2n(t){await fetch(`${Jl}/recording/abort`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id})}).catch(()=>{})}async function A2n(){const t=await fetch(`${Jl}/repository-presence`,{cache:"no-store"});if(sf(t,"Could not read repository presence"),!t.ok)return{currentWorktreeId:null,sessions:[]};const n=await t.json().catch(()=>null);return{currentWorktreeId:typeof n?.currentWorktreeId=="string"?n.currentWorktreeId:null,sessions:Array.isArray(n?.sessions)?n.sessions:[]}}async function $Zr(){const t=await fetch(`${Jl}/project`,{cache:"no-store"});if(sf(t,"Could not read this session’s worktree identity"),!t.ok)return{branch:null,worktreeId:null};const n=await t.json().catch(()=>null);return{branch:typeof n?.session?.branch=="string"?n.session.branch:null,worktreeId:typeof n?.session?.worktreeId=="string"?n.session.worktreeId:null}}async function BR(t,n){const s=await fetch(`${Jl}/worktrees${t}`,n);sf(s,`Worktree operation ${t||"(list)"} failed`);const c=await s.json().catch(()=>null);if(!s.ok)throw new Error(typeof c?.error=="string"?c.error:`Worktree operation failed (${s.status}).`);return c??{}}function $Rt(t){return{worktrees:Array.isArray(t.worktrees)?t.worktrees:[],branches:Array.isArray(t.branches)?t.branches:[]}}async function qZr(){const t=await BR("/harnesses");return Array.isArray(t.harnesses)?t.harnesses:[]}async function zZr(){const t=await BR("");return $Rt(t)}async function VZr(t){return await BR("/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})})}async function USt(t,n="HEAD"){return await BR("/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t,from:n})})}async function UZr(t){return BR("/delegate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function JZr(t){const n=await BR("/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})});return $Rt(n).worktrees}async function WZr(t,n){await BR("/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t,sessionId:n})})}let Age=null;const xMe=new Set,wMe=new Set;function HZr(t){Age=t;for(const n of xMe)n(t);for(const n of wMe)n()}function Ih(){return Age}function D2n(t){return xMe.add(t),Age&&t(Age),()=>{xMe.delete(t)}}function o_e(t){return wMe.add(t),()=>{wMe.delete(t)}}const nA="references",qRt=["public",nA],Lze=`/project-game-static/${nA}/`;function Dge(t,n){return`${t}/${n}`}function Y0e(t,n){return t===nA?`${Lze}${n}`:`/${n}`}function GZr(t){return t.startsWith(Lze)}function KZr(t){const n=t.startsWith("/")?t:`/${t}`;if(GZr(n))return Dge(nA,n.slice(Lze.length));const s=t.startsWith("/")?t.slice(1):t;return s.startsWith("public/")?s:`public/${s}`}function zRt({assetPath:t,kind:n,sizeBytes:s}){return $.jsx(XZr,{assetPath:t,kind:n,sizeBytes:s},t)}function XZr({assetPath:t,kind:n,sizeBytes:s}){const c=t.split("#")[0],d=c.startsWith("/")||/^(?:data|blob|https?):/.test(c)?c:`/${c}`,m=KZr(c),[g,S]=Ye.useState(s),[k,A]=Ye.useState(null),[F,D]=Ye.useState(null);Ye.useEffect(()=>{if(s!==void 0){S(s);return}let pe=!1;const[ue,...Ce]=m.split("/"),Fe=Ce.pop();return K0e(ue,Ce.join("/")).then(De=>{!pe&&De.ok&&S(De.entries.find(be=>be.name===Fe)?.size)}),()=>{pe=!0}},[m,s]),Ye.useEffect(()=>{if(A(null),D(null),n==="image"){const ue=new Image;return ue.onload=()=>A({width:ue.naturalWidth,height:ue.naturalHeight}),ue.onerror=()=>D("Image properties could not be read."),ue.src=d,()=>{ue.onload=null,ue.onerror=null}}const pe=document.createElement(n);return pe.preload="metadata",pe.onloadedmetadata=()=>A({...Number.isFinite(pe.duration)?{duration:pe.duration}:{},...pe instanceof HTMLVideoElement?{width:pe.videoWidth,height:pe.videoHeight}:{}}),pe.onerror=()=>D("Media properties could not be read. The file may be missing or unsupported."),pe.src=d,()=>{pe.onloadedmetadata=null,pe.onerror=null,pe.removeAttribute("src"),pe.load()}},[d,n]);const J=k?.width,q=k?.height,G=[];if(J&&q){let pe=J,ue=q;for(;ue;)[pe,ue]=[ue,pe%ue];G.push(["Dimensions",`${J} × ${q} px`],["Aspect ratio",`${J/pe}:${q/pe}`])}k?.duration!==void 0&&G.push(["Duration",`${Number(k.duration.toFixed(3))} s`]);const se=c.split("?")[0].match(/\.([^./]+)$/)?.[1];return se&&G.push(["Format",se.toUpperCase()]),g!==void 0&&G.push(["File size",g<1024?`${g} B`:`${(g/(g<1024*1024?1024:1024*1024)).toFixed(1)} ${g<1024*1024?"KB":"MB"}`]),G.push(["Location",m]),$.jsxs("div",{"data-testid":"media-properties",style:{padding:8,fontSize:12},children:[F?$.jsx("p",{role:"status",style:{color:Zf[2]},children:F}):!k&&$.jsx("p",{role:"status",style:{color:Zf[3]},children:"Reading media properties…"}),$.jsx("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto minmax(0, 1fr)",gap:"10px 12px"},children:G.map(([pe,ue])=>$.jsxs("div",{style:{display:"contents"},children:[$.jsx("dt",{style:{color:Zf[3]},children:pe}),$.jsx("dd",{style:{margin:0,color:Zf[1],overflowWrap:"anywhere"},children:ue})]},pe))})]})}const Y7e=Ye.lazy(async()=>({default:(await fo(()=>Promise.resolve().then(()=>STr),void 0)).AssetEditorShell})),YZr=Ye.lazy(async()=>({default:(await fo(()=>import("./AudioViewer-DbO2vY3o.js"),__vite__mapDeps([254,1,2,3,4,20,21,22,23]))).AudioViewer})),ZZr=Ye.lazy(async()=>({default:(await fo(()=>import("./ImageViewer-BXQ1dXgz.js"),__vite__mapDeps([255,1,2,3,4,20,21,22,23]))).ImageViewer})),QZr=Ye.lazy(async()=>({default:(await fo(()=>import("./VideoViewer-CrP78U5w.js"),__vite__mapDeps([256,1,2,3,4,20,21,22,23]))).VideoViewer})),eQr=Ye.lazy(async()=>({default:(await fo(()=>import("./JsonAssetDocument-BPQR7OXc.js").then(n=>n.a),__vite__mapDeps([257,1,2,3,4,20,21]))).JsonAssetDocument})),JSt=Ye.lazy(async()=>({default:(await fo(()=>import("./OnlineAssetDetail-BMAMYfaN.js"),__vite__mapDeps([258,1,2,3,4,20,21,259,22,23]))).OnlineAssetDetail})),tQr=Ye.lazy(async()=>({default:(await fo(()=>import("./SourceAssetViewer-LGC-eTLS.js"),__vite__mapDeps([260,1,2,3,4,20,21,257,254,22,23,255]))).SourceAssetViewer})),K1=new Map,VRt=new Map,Z7e=new Map;let URt=0;const TMe=new Set;function nR(){URt++;for(const t of TMe)t()}function rQr(t){return TMe.add(t),()=>{TMe.delete(t)}}function nQr(){return URt}function iQr(t){return K1.get(t)}function JRt(t){return K1.has(t)}function oQr(t,n){const s=new Set([...Object.keys(t),...Object.keys(n)]);for(const c of s){const d=t[c],m=n[c];if(d!==m&&JSON.stringify(d)!==JSON.stringify(m))return!1}return!0}function Bze(t,n,s,c,d={}){typeof document<"u"&&document.activeElement instanceof HTMLElement&&Z7e.set(t,document.activeElement);const m=K1.get(t);if(!m)K1.set(t,s),nR();else{const S={...m,...s};oQr(m,S)||(K1.set(t,S),nR())}const g={id:t,title:n,kind:"asset",workspaceRole:"authored-subject",...c?{provenance:c}:{},Content:dQr,closeable:!0,presentation:()=>{const S=K1.get(t);return S?S.entityId?{kind:"asset",entityId:S.entityId,assetKind:"model"}:!S.assetPath||S.online?null:{kind:"asset",path:S.assetPath,assetKind:S.kind}:null},persist:()=>{const S=K1.get(t);if(!(!S?.assetPath||S.online||S.entityId!==void 0))return{path:S.assetPath,assetKind:S.kind}},onActivate:()=>{(s.kind==="image"||s.kind==="video"||s.kind==="audio")&&oD()},onDispose:S=>{K1.delete(S)&&nR();const k=Z7e.get(S);Z7e.delete(S),k?.isConnected&&setTimeout(()=>k.focus(),0)}};return ND(g,d)}function sN(t,n,s={}){const c=qYr(t),{frameName:d}=H0e(t),m=VRt.get(AO(t))??t;return Bze(m,c,d?{assetPath:t,kind:n,displayName:c}:{assetPath:t,kind:n},{sourcePath:t},s)}wee({kind:"asset",owner:"asset-documents",restore:async({state:t})=>{const n=t,s=typeof n?.path=="string"?n.path:null,c=typeof n?.assetKind=="string"?n.assetKind:null;return!s||!c||!await OZr(s)?!1:(sN(s,c),!0)}});async function WRt(t,n){return EC(()=>{if(e_()!==t)return!1;const s=cBe(t);return s?n!=="model"||s.adapter!==null:!1},PR)}kN({id:"asset-editor:entity",owner:"asset-documents",open:(t,{entityId:n,title:s})=>Bze(`asset-editor:entity:${n}`,s,{assetPath:"",kind:"model",entityId:n},{origin:`entity:${n}`})});kN({id:"asset",owner:"asset-documents",open:(t,n)=>{if(n.entityId){const c=Ih();if(!c)return null;const d=kze(Y0(c),n.entityId)?.assetDocument?.open()??null;if(!d)throw new Error(`Scene entity is not available: ${n.entityId}`);return d}const s=n.path;return s===void 0?null:sN(s,WSt(n.assetKind,s))},ready:async(t,n)=>{const s=n.entityId?"model":WSt(n.assetKind,n.path??"");if(!await WRt(t,s))throw new Error(`Asset document did not finish mounting its Inspector: ${t}`);await SBe(t)}});function WSt(t,n){return t==="animation"?"source":t==="prefab"?"json":t??sQr(n)}function sQr(t){const n=t.slice(t.lastIndexOf(".")+1).toLowerCase();return n==="glb"||n==="gltf"?"model":["png","jpg","jpeg","webp","gif","svg"].includes(n)?"image":["mp3","ogg","wav","flac"].includes(n)?"audio":["glsl","vert","frag","ts","tsx","js","jsx","css","html","md","txt"].includes(n)?"source":"json"}function aQr(t,n){const s=YYr(n);return Bze(`asset-editor:subject:${t}`,n.name,{assetPath:s,kind:n.kind,displayName:n.name,...n.sourcePath?{sourcePath:n.sourcePath}:{}},n.sourcePath?{sourcePath:n.sourcePath}:{origin:`entity:${t}`})}function cQr(t,n){const s=K1.get(t);if(!s)return;const{online:c,...d}=s;K1.set(t,{...d,assetPath:n}),nR()}function lQr(t,n){const s=K1.get(t);if(!s?.assetPath)return;const c=AO(s.assetPath);if(n.type==="move"&&n.oldPath&&n.newPath&&c===AO(n.oldPath)){const d=`/${AO(n.newPath)}`;K1.set(t,{...s,assetPath:d}),VRt.set(AO(d),t),R3t(t,d.split("/").pop()??d),nR()}else n.type==="delete"&&n.paths?.some(d=>AO(d)===c)?(K1.set(t,{...s,unavailableReason:`The source ${s.assetPath} was deleted. Undo the deletion or close this editor.`}),nR()):n.type==="change"&&n.paths?.some(d=>AO(d)===c)&&(K1.set(t,{...s,revision:(s.revision??0)+1}),nR())}function uQr(t){return t.online?"online":ig(t.assetPath).editor==="environment"?"environment":t.kind==="json"?"json":["model","image","video","audio","source"].includes(t.kind)?t.kind:"unsupported"}function Q7e(t){return{id:"source",title:"Source",icon:zTt,order:fQ,body:{kind:"custom",render:()=>$.jsx("div",{style:{padding:4},children:t.sourcePath??t.assetPath})}}}function fQr({id:t,spec:n,active:s}){if(n.unavailableReason)return $.jsx(Y7e,{documentId:t,active:s,type:n.kind,title:n.assetPath.split("/").pop()||"Deleted asset",status:"Source unavailable",children:$.jsx("div",{style:{padding:20,color:C_e},children:n.unavailableReason})});const c=uQr(n);if(c==="online"&&n.online){const k=n.online;return $.jsx(Y7e,{documentId:t,active:s,type:"online",title:k.name,sections:[{id:"online-asset",title:"Asset",icon:M0r,order:fQ,body:{kind:"custom",render:()=>$.jsx(JSt,{online:k,mode:"inspector",onResolved:A=>cQr(t,A)})}}],status:`${k.type} · ${k.source}`,children:$.jsx(JSt,{online:k,mode:"preview"})})}const d=(n.displayName??n.assetPath.split("/").pop())||n.entityId||"Asset",m=`${t}:${n.revision??0}`,g=$.jsxs("div",{style:{padding:20,color:C_e},children:["No editor package in this project renders ",d,"."]});if(c==="model")return n.assetPath?$.jsx(X7e,{route:"model",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m):n.entityId?$.jsx(X7e,{route:"entity-model",documentId:t,assetPath:"",entityId:n.entityId,displayName:d,active:s,whenUnregistered:g},m):$.jsx("div",{style:{padding:20,color:C_e},children:"Model source is unavailable."});if(c==="environment")return $.jsx(X7e,{route:"environment",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m);if(c==="source")return $.jsx(tQr,{documentId:t,assetPath:n.assetPath,active:s},m);if(c==="json")return $.jsx(eQr,{documentId:t,assetPath:n.assetPath,displayName:d,active:s,sections:[Q7e(n)],status:`json · ${n.sourcePath??n.displayName??n.assetPath}`},m);let S;switch(c){case"image":S=$.jsx(ZZr,{assetPath:n.assetPath,...n.displayName?{displayName:n.displayName}:{}},m);break;case"video":S=$.jsx(QZr,{assetPath:n.assetPath},m);break;case"audio":S=$.jsx(YZr,{assetPath:n.assetPath},m);break;default:S=$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"No viewer available for this asset type."})}return $.jsx(Y7e,{documentId:t,active:s,type:c,title:d,fill:c==="image"||c==="video",sections:c==="image"&&!n.assetPath.includes("#")||c==="video"||c==="audio"?[{id:"media-properties",title:"Properties",icon:zTt,order:fQ,body:{kind:"custom",render:()=>$.jsx(zRt,{assetPath:n.assetPath,kind:c},m)}},...n.sourcePath?[Q7e(n)]:[]]:[Q7e(n)],status:`${c} · ${n.sourcePath??n.displayName??n.assetPath}`,children:S})}function dQr({documentId:t,active:n}){Ye.useSyncExternalStore(rQr,nQr),Ye.useEffect(()=>{const c=d=>{lQr(t,d.detail)};return window.addEventListener("editor:asset-mutation",c),()=>window.removeEventListener("editor:asset-mutation",c)},[t]);const s=K1.get(t);return $.jsx("div",{"data-testid":`asset-document:${t}`,style:{flex:1,minHeight:0,overflow:"hidden",pointerEvents:"auto",background:hBe[1]},children:s?$.jsx(Ye.Suspense,{fallback:$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"Loading asset viewer…"}),children:$.jsx(fQr,{id:t,spec:s,active:n})}):$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"This asset document is no longer available."})})}function AO(t){return t.split(/[?#]/,1)[0].replace(/^\/+/,"")}const HRt=["three","pixi","dom","babylon","phaser"],$ze=Object.freeze({up:"y",groundHeight:0}),GRt=Pa({surface:ed(["three","canvas","dom"]).describe("An additional surface this root mounts, beside the manifest root’s own adapter"),include:Gd(bo().min(1)).min(1).describe("Project-relative globs (`**`, `*`, `?`) naming the source files that render on this additional surface")}).strict(),pQr=Pa({up:ed(["y","z"]).describe("World axis pointing away from the ground"),groundHeight:fu().describe("Ground offset along `up`, in world units")}).strict(),_Qr=Pa({id:bo().min(1).describe("Manifest root id this region grades"),surface:ed(["three","canvas","dom"]).describe("Render surface the host hands this root"),substrate:ed(HRt).describe("Native substrate serving this region, by name"),dialect:bo().min(1).nullable().describe("Dialect writer serving this region, by name; null states outright that the host writes no source here (the region's truth is the game's own code)"),anchors:Gd(ed(ZLe)).describe("Anchor kinds this region’s writer serves"),basis:pQr.optional().describe("World basis (up axis + ground height); omit for the native +Y / 0 default"),include:Gd(bo().min(1)).min(1).optional().describe("Project-relative globs (`**`, `*`, `?`) naming source files this region owns, for files no root entry’s import closure reaches; a declared include wins over reach"),mounts:Gd(GRt).min(1).optional().describe("Surfaces this root mounts BESIDE its own adapter, each with the files that render on them; with `surface`, the root’s full mounted surface set")}).strict(),mQr=AR([Dg("manifest-roots"),Gd(_Qr).min(1)]),hQr=Pa({include:Gd(bo().min(1)).min(1).optional().describe("Project-relative globs (`**`, `*`, `?`) naming source files this derived region owns, for files no root entry’s import closure reaches; a declared include wins over reach"),mounts:Gd(GRt).min(1).optional().describe("Surfaces this root mounts BESIDE its own adapter, each with the files that render on them; with the derived region’s own surface, the root’s full mounted surface set")}).strict().refine(t=>t.include!==void 0||t.mounts!==void 0,{message:"regionIncludes entry declares neither `include` nor `mounts` — an empty overlay states nothing the derivation did not already say. Remove it, or name the files it owns."}),gQr=wD(bo().min(1),hQr).describe("Per-region parameters for the `manifest-roots` rule, keyed by manifest root id: the `include` globs and `mounts` surfaces the mechanical derivation cannot produce");function qze(t,n={}){return t.map(s=>({...vQr(s),...yQr(n[s.id])}))}function yQr(t){return t?{...t.include?{include:t.include}:{},...t.mounts?{mounts:t.mounts}:{}}:{}}function KRt(t,n){const s=new Set(t.map(c=>c.id));return Object.keys(n).filter(c=>!s.has(c))}function vQr(t){const n=t.surface,s=t.adapter.type==="builtin",c=n==="canvas"?"pixi":n,d=$ze;return s?n==="dom"?{id:t.id,surface:n,substrate:c,dialect:"jsx",anchors:["source-prop","source-structure"],basis:d}:{id:t.id,surface:n,substrate:c,dialect:n==="three"?"r3f":"pixi-react",anchors:["source-prop","source-structure","construction-literal"],basis:d}:{id:t.id,surface:n,substrate:c,dialect:null,anchors:["live-only"],basis:d}}const VQ="exported-composition-regions",bQr=Pa({finder:bo().min(1).describe("Registered finder name")}).passthrough(),SQr=AR([Pa({kind:Dg("root-mount")}).strict(),Pa({kind:Dg("entrypoint-selection"),selection:bo().min(1),key:bo().min(1),active:_y().optional()}).strict(),Pa({kind:Dg("story"),storyId:bo().min(1)}).strict(),Pa({kind:Dg("game-contract"),sceneId:bo().min(1)}).strict(),Pa({kind:Dg("none"),reason:bo().min(1)}).strict()]),HSt=Pa({path:bo().min(1),export:bo().min(1).optional()}).strict(),xQr=Pa({id:bo().min(1),label:bo().min(1),kind:bo().min(1),region:bo().min(1).nullable(),authorable:_y(),reach:SQr,source:HSt.optional(),isolationSetup:HSt.optional(),finder:bo().min(1).optional()}).strict(),wQr=Pa({entries:Gd(xQr).optional(),find:Gd(bQr).optional(),default:bo().min(1).optional()}).strict(),XRt=["command","state"],TQr="observation.kind must be 'command' or 'state' — the two DebugAdapter faces a declaration projects onto. A SystemAdapters slot is declared through the game contract’s `systemAdapters` carrier, which validates it per-surface; declaring one here would be a second door onto the same slot with no rule for which wins.",CQr=Pa({id:bo().min(1),kind:ed(XRt,{error:()=>TQr}),description:bo().min(1).optional(),locus:ed(["client","server"]).optional(),answer:YI(t=>typeof t=="function",{message:"observation.answer must be a function evaluated against the mounted game"}).optional()}).strict().refine(t=>t.kind==="command"||t.locus===void 0,{path:["locus"],message:"observation.locus is valid only for a command declaration"}),EQr=["digital","scalar","vector2","pointerDelta","pointerPosition"],kQr=Pa({root:bo().min(1),actions:YI(t=>typeof t=="function",{message:"input.actions must be a function returning the app-owned action vocabulary"}),set:YI(t=>typeof t=="function",{message:"input.set must be a function writing the app-owned input store"}),clear:YI(t=>typeof t=="function",{message:"input.clear must be a function releasing app-owned virtual actions"})}).strict(),AQr=Pa({Layout:YI(t=>typeof t=="function","Layout must be an imported React component").optional(),style:YI(t=>typeof t=="object"&&t!==null&&typeof Reflect.get(t,"id")=="string","style must be an imported StyleContribution object").optional(),keymap:YI(t=>typeof t=="object"&&t!==null&&typeof Reflect.get(t,"id")=="string","keymap must be an imported KeymapContribution object").optional(),workspace:bo().min(1).optional(),inspector:ed(["column","properties","card"]).optional(),playUtilities:Gd(bo().min(1)).optional()}).strict(),DQr="`regionIncludes` states parameters for the `manifest-roots` RULE, so it cannot be paired with an explicit `regions` list — that form is the full replacement, and each entry carries its own `include`/`mounts`. Move these globs onto the matching `regions[]` entry, or drop the list and let the derivation run.",YRt=Pa({editor:AQr.optional(),regions:mQr.optional(),regionIncludes:gQr.optional(),documents:wQr.optional(),observation:Gd(CQr).optional(),input:kQr.optional()}).strict().refine(t=>t.regionIncludes===void 0||Object.keys(t.regionIncludes).length===0||!Array.isArray(t.regions),{message:DQr});function zze(t={}){const n=YRt.safeParse(t);if(!n.success)throw new Error(`volter.adapter.ts: invalid adapter definition — ${n.error.issues.map(s=>`${s.path.join(".")||"(root)"}: ${s.message}`).join("; ")}`);return Object.freeze({...t.editor?{editor:Object.freeze({...t.editor,...t.editor.playUtilities?{playUtilities:Object.freeze([...t.editor.playUtilities])}:{}})}:{},regions:t.regions??"manifest-roots",regionIncludes:Object.freeze({...t.regionIncludes??{}}),documents:Object.freeze({...t.documents??{}}),observation:Object.freeze([...t.observation??[]]),...t.input?{input:t.input}:{}})}function DO(t={}){return zze({regions:"manifest-roots",...t.regionIncludes?{regionIncludes:t.regionIncludes}:{},documents:{...t.scenes?{entries:t.scenes}:{},find:[{finder:"scenesFromEntrypointSelection",regions:VQ},{finder:"prefabsFromStories"}]}})}function CMe(t){if(t===null||typeof t!="object")throw new Error(`volter.adapter.ts must default-export defineAdapter({…}) / nativeAdapter() — got ${t===null?"null":typeof t}`);return zze(t)}const P2n=Object.freeze(Object.defineProperty({__proto__:null,ADAPTER_INPUT_VALUE_TYPES:EQr,AdapterDefinitionSchema:YRt,EXPORTED_COMPOSITION_REGIONS:VQ,NATIVE_REGION_BASIS:$ze,OBSERVATION_KINDS:XRt,SUBSTRATE_NAMES:HRt,defineAdapter:zze,nativeAdapter:DO,parseAdapterDefinition:CMe,regionsFromManifestRoots:qze,unmatchedRegionIncludeIds:KRt},Symbol.toStringTag,{value:"Module"})),MZ=new Map;function Vze(t){const n=t;return MZ.set(t.name,n),()=>{MZ.get(t.name)===n&&MZ.delete(t.name)}}function Uze(t,n){const s=t??{},c=[];(typeof s.name!="string"||s.name.length===0)&&c.push("`name` must be a non-empty string");const d=s.schema;if((!d||typeof d.safeParse!="function")&&c.push("`schema` must be a Zod schema"),typeof s.run!="function"&&c.push("`run(selection, input)` must be a function"),c.length>0)throw new Error(`${n}: not a finder — ${c.join("; ")}`);return Vze(s)}function ZRt(){return[...MZ.keys()]}function QRt(t,n){const s=MZ.get(t.finder);if(!s){const d=ZRt();throw new Error(`Unknown finder ${JSON.stringify(t.finder)} — registered: ${d.length>0?d.map(m=>`"${m}"`).join(", "):"none"}`)}const c=s.schema.safeParse(t);if(!c.success)throw new Error(`Finder ${JSON.stringify(t.finder)}: ${c.error.issues.map(d=>`${d.path.join(".")||"(selection)"}: ${d.message}`).join("; ")}`);return s.run(c.data,n)}const I2n=Object.freeze(Object.defineProperty({__proto__:null,registerContributedFinder:Uze,registerFinder:Vze,registeredFinderNames:ZRt,runRegisteredFinder:QRt},Symbol.toStringTag,{value:"Module"}));function GSt(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var eOe={exports:{}};const PQr={},IQr=Object.freeze(Object.defineProperty({__proto__:null,default:PQr},Symbol.toStringTag,{value:"Module"})),wI=Yyr(IQr);var KSt;function NQr(){return KSt||(KSt=1,(function(t){var n={};/*! *****************************************************************************
942
+ </style><main><div class="brand-mark">${a4r()}</div><h1>Session ended</h1><p>This editor session has ended. You can close this tab.</p></main>`})}))}const Tge=new Set;function aZr(t){return Tge.add(t),()=>{Tge.delete(t)}}function cZr(){try{window.focus()}catch{}if(Tge.size===0){window.location.reload();return}for(const t of[...Tge])t()}function lZr(t,n,s={}){t.addEventListener("tab-refocus",c=>tZr(c)),t.addEventListener("tab-yield",c=>rZr(n,c)),t.addEventListener("tab-close",()=>sZr(n,s)),t.addEventListener("tab-adopt",()=>cZr())}const $k="/__editor",uZr=globalThis,md=uZr.__VOLTER_EDITOR_PRESENCE_BOOTSTRAP__,wC=md?.clientId??globalThis.crypto?.randomUUID?.()??`editor-${Date.now()}`,G0e=jAt,fZr=ewr;function dZr(t,n,s){md?.reportPhase?.(t,n,s)}function pZr(t){md?.reportCensus?.(t)}function _Zr(){md?.stopHeartbeat?.();const t=kw;if(t!==null){kw=null,eB=0,md?.source===t&&(md.source=null),P$===t&&(P$=null);try{t.close()}catch{}}}function mZr(){const t=new URLSearchParams({clientId:wC,participantId:G0e,displayName:fZr});return md?.tabId&&t.set("tabId",md.tabId),`${$k}/events?${t}`}let kw=md?.source??null,eB=md?.source&&md.pageOwned?1:0,P$=null;const RRt=new Set(["editor-command"]);function FRt(t,n){if(!md||md.source!==t)return;md.queueListeners=md.queueListeners.filter(({type:c,listener:d})=>n(c)?(t.removeEventListener(c,d),!1):!0);const s=md.pending.filter(c=>n(c.type));md.pending=md.pending.filter(c=>!n(c.type));for(const{type:c,data:d}of s)t.dispatchEvent(new MessageEvent(c,{data:d}))}function hZr(t){P$!==t&&(P$=t,lZr(t,$k,{tabId:md?.tabId,epoch:md?.epoch}),FRt(t,n=>!RRt.has(n)))}function jD(){kw||(md?.source?(kw=md.source,md.pageOwned&&eB++):(kw=new EventSource(mZr()),md&&(md.source=kw)));const t=kw;hZr(t),eB++;const n=[];let s=!1;return{addEventListener(c,d){const m=d;t.addEventListener(c,m),n.push({type:c,listener:m}),RRt.has(c)&&FRt(t,g=>g===c)},removeEventListener(c,d){const m=d;t.removeEventListener(c,m);const g=n.findIndex(S=>S.type===c&&S.listener===m);g>=0&&n.splice(g,1)},close(){if(!s){s=!0;for(const{type:c,listener:d}of n)t.removeEventListener(c,d);n.length=0,eB--,eB<=0&&(t.close(),kw===t&&(kw=null),md?.source===t&&(md.source=null),P$===t&&(P$=null),eB=0)}}}}function gZr(){const t=kw??md?.source??null;if(!t)return"unknown";if(typeof t.connected=="boolean")return t.connected?"open":"closed";const n=t.readyState;return typeof n=="number"?n===1?"open":"closed":"unknown"}function yZr(){if(typeof EventSource>"u")return()=>{};const t=jD(),n=Oze(c=>{c!==null&&c.reason!=="server-gone"&&_Zr()}),s=bZr();return()=>{s(),n(),t.close()}}const vZr=5;function bZr(){if(typeof window>"u")return()=>{};let t=0;const n=d=>{d===""||t>=vZr||(t+=1,FZ("console-entries",{entries:[{id:`boot-error:${t}`,severity:"error",message:`editor runtime error: ${d}`,source:"runtime",occurrences:1}],_clientId:md?.clientId??"boot"}))},s=d=>{const m=d.error;n(m?.stack??`${d.message} (${d.filename??"?"}:${d.lineno??0})`)},c=d=>{const m=d.reason;k4t(m)||n(m instanceof Error?m.stack??m.message:`unhandled rejection: ${String(m)}`)};return window.addEventListener("error",s),window.addEventListener("unhandledrejection",c),()=>{window.removeEventListener("error",s),window.removeEventListener("unhandledrejection",c)}}const SZr=2e3,xZr={"command-received":`${$k}/command-received`,"command-result":`${$k}/command-result`,"command-listener":`${$k}/command-listener`,"console-entries":`${$k}/console-entries`,"console-resolved":`${$k}/console-resolved`,"play-phase":`${$k}/play-phase`,state:`${$k}/state`,"tab-route":`${$k}/tab/route`};async function FZ(t,n){if(!(typeof fetch>"u"))try{await fetch(xZr[t],{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...md?.controlLifecycle?{_controlLifecycle:md.controlLifecycle}:{}})})}catch{}}async function bN(t,n){(kw??md?.source??null)?.send?.(t,n)||await FZ(t,n)}async function wZr(t,n){const s=kw??md?.source??null;if(!s){await FZ("command-result",n);return}let c;const d=new Promise(A=>{c=A}),m=A=>{const F=A.data;let D=F;if(typeof F=="string")try{D=JSON.parse(F)}catch{}D===t&&c()};s.addEventListener(MSt,m);const g={...n,_awaitCallerReceipt:!0};s.send?.("command-result",g)||await FZ("command-result",g);let S,k=!1;await Promise.race([d.then(()=>{k=!0}),new Promise(A=>{S=setTimeout(A,SZr)})]),S!==void 0&&clearTimeout(S),k||await FZ("command-result",n),s.removeEventListener(MSt,m)}function TZr(t){bN("tab-route",{clientId:wC,participantId:G0e,route:t})}function Rze(t){return{ok:!1,reason:t instanceof Error?t.message:String(t)}}async function CZr(t,n){try{const s=new URLSearchParams({root:t,dir:n}),c=await fetch(`${Jl}/assets?${s}`,{cache:"no-store"});return{ok:!0,entries:(await L_(c,`Could not list ${t}/${n} from ${Jl}/assets`)).entries??[]}}catch(s){return Rze(s)}}async function K0e(t,n){if(t!=="public")return CZr(t,n);try{return{ok:!0,entries:(await gR().list(n)).map(c=>({name:c.name,type:c.type==="dir"?"directory":"file",...c.size===void 0?{}:{size:c.size},...c.mtime===void 0?{}:{modifiedAt:c.mtime}}))}}catch(s){return Rze(s)}}async function MRt(){try{const t=await fetch(`${Jl}/project-components`,{cache:"no-store"});return{ok:!0,entries:(await L_(t,`Could not list project components from ${Jl}/project-components`)).components??[]}}catch(t){return Rze(t)}}function e2n(t){return`${Jl}/download?file=${encodeURIComponent(t)}`}class LSt extends Error{constructor(n,s){super(s),this.code=n,this.name="AssetDeliveryError"}}function BSt(t){return{offline:"Network delivery is offline. SSD assets remain available.","quota-limited":"The remote provider quota is exhausted. Retry after the provider resets it.","license-blocked":"This delivery is blocked because its license terms are not accepted.",unavailable:"No healthy SSD, cloud, or remote delivery is available for this variant.","provider-error":"The remote provider could not return delivery metadata. Retry the request."}[t]}const Cge=new Map,Ege=new Set;function Fze(t,n){return`${t}:${n}`}function t2n(t,n){return Cge.get(Fze(t,n))??null}function r2n(t){return Ege.add(t),()=>Ege.delete(t)}async function n2n(){try{const t=await fetch(`${Jl}/asset-library/downloaded`),n=await L_(t,"Could not read the downloaded-asset list");Cge.clear();for(const s of n.downloaded)Cge.set(Fze(s.source,s.id),`/${s.path}`);for(const s of Ege)s()}catch{}}async function i2n(t){const n=new URLSearchParams;n.set("source",t.source),n.set("type",t.type),t.q&&n.set("q",t.q),t.category&&n.set("category",t.category),t.offset!=null&&n.set("offset",String(t.offset)),t.limit!=null&&n.set("limit",String(t.limit));const s=await fetch(`${Jl}/asset-library/search?${n}`);if(sf(s,"Asset Library search failed"),!s.ok){const c=await s.json().catch(()=>null);throw new Error(c?.error??`Asset Library search failed (${s.status}).`)}return await s.json()}async function o2n(t,n){return EZr(t,n)}async function EZr(t,n){const s=new URLSearchParams({source:t,id:n});let c;try{c=await fetch(`${Jl}/asset-library/files?${s}`)}catch(m){throw new LSt("offline",m instanceof Error?m.message:BSt("offline"))}if(sf(c,"Asset Library file lookup failed"),!c.ok){const m=await c.json().catch(()=>null),g=c.status===403?"license-blocked":c.status===429?"quota-limited":c.status===404?"unavailable":"provider-error";throw new LSt(g,m?.error??BSt(g))}return(await c.json()).files}async function s2n(t,n){const s=new URLSearchParams({source:t,id:n}),c=await fetch(`${Jl}/asset-library/preview?${s}`);return sf(c,"Could not resolve an asset preview"),c.ok?await c.json():null}async function a2n(t){const n=await fetch(`${Jl}/asset-library/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,signal:void 0}),...t.signal?{signal:t.signal}:{}});sf(n,"Could not download the asset");const s=await n.json();if(s.ok&&s.path){Cge.set(Fze(t.source,t.id),`/${s.path}`);for(const c of Ege)c()}return s}async function c2n(t){const n=await fetch(`${Jl}/asset-library/history/capture`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t})});sf(n,"Asset history capture failed");const s=await n.json();if(!n.ok||!s.token)throw new Error(s.error??`Asset history capture failed (${n.status}).`);return s.token}async function l2n(t,n){const s=await fetch(`${Jl}/asset-library/history/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assetPath:t,token:n})});if(sf(s,"Asset history restore failed"),!s.ok){const c=await s.json().catch(()=>null);throw new Error(c?.error??`Asset history restore failed (${s.status}).`)}}async function u2n(t,n){const s=new URLSearchParams({type:t});n&&s.set("source",n);const c=await fetch(`${Jl}/asset-library/categories?${s}`);return sf(c,"Could not read Asset Library categories"),c.ok?(await c.json()).categories:[]}function kZr(t){if(!t||typeof t!="object")return null;const n=t;return n.apiVersion!==1||typeof n.engineVersion!="string"&&n.engineVersion!==null||typeof n.manifestVersion!="number"||typeof n.startedAt!="string"||!n.source||n.source.state!=="current"&&n.source.state!=="restart-required"||n.source.state==="restart-required"&&(typeof n.source.changedPath!="string"||typeof n.source.changedAt!="string")?null:n}async function AZr(){let t;try{t=await fetch(`${Jl}/compatibility`,{cache:"no-store"})}catch(n){throw MFe(n instanceof Error?n.message:String(n))}if(t.status>=500)throw MFe(`HTTP ${t.status}`);try{CN(t,`GET ${Jl}/compatibility`)}catch{return null}try{return kZr(await t.json())}catch{return null}}async function Mze(){const t=await AZr();if(!t)throw _4r();return m4r(t),t}async function DZr(){try{const t=await fetch(`${Jl}/recent-projects`);return(await L_(t,"Could not list recent projects")).projects}catch{return[]}}async function f2n(t){const n=await fetch(`${Jl}/recent-projects`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});CN(n,"Could not remove recent project")}const $St={reopenLastProject:!1};async function PZr(){try{const t=await fetch(`${Jl}/launcher-settings`),n=await L_(t,"Could not read launcher settings");return{reopenLastProject:typeof n.reopenLastProject=="boolean"?n.reopenLastProject:$St.reopenLastProject}}catch{return{...$St}}}async function d2n(t){const n=await fetch(`${Jl}/launcher-settings`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await L_(n,"Could not save launcher settings")}async function p2n(t,n,s,c,d,m=[]){const g=await fetch(`${Jl}/create-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,location:n,template:s,...c?{exampleId:c}:{},...d?{presentation:d}:{},...m.length>0?{additions:m}:{}})});return sf(g,"Could not create the project"),await g.json()}async function _2n(t){try{const n=await fetch(`${Jl}/browse-folder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t})});return(await L_(n,"Could not open the folder picker")).path}catch{return null}}async function m2n(t){const n=await fetch(`${Jl}/inspect-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});sf(n,`Could not inspect ${t}`);const s=await n.json();if(!n.ok||!s.path||!s.report)throw new Error(s.error??`Could not inspect ${t}.`);return{path:s.path,report:s.report}}async function h2n(t,n){const s=await fetch(`${Jl}/adapt-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,...n})});sf(s,`Could not add Volter Editor metadata to ${t}`);const c=await s.json();if(!s.ok||!c.path||!c.writes)throw new Error(c.error??`Could not add Volter Editor metadata to ${t}.`);return{path:c.path,writes:c.writes}}async function bMe(t){const n=await fetch(`${Jl}/reveal`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});CN(n,`Could not reveal ${t}`)}async function g2n(t){try{const n=await fetch(`${Jl}/save-thumbnail`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:t})});return CN(n,"Could not save the project thumbnail"),!0}catch{return!1}}async function jze(){let t;try{const s=await fetch(`${Jl}/project`);t=await L_(s,`No answer from ${Jl}/project`)}catch(s){return{status:"unknown",error:s instanceof Error?s.message:String(s)}}if(t.project)return{status:"project",project:t.project};const n=t.serving;return n&&typeof n.path=="string"?{status:"unreadable",path:n.path,error:typeof n.error=="string"?n.error:"unknown error"}:t.project===null?{status:"none"}:{status:"unknown",error:`Unrecognized ${Jl}/project response`}}async function y2n(){const t=await jze();return t.status==="project"?t.project:null}async function v2n(t){const n=await Mze(),s=await fetch(`${Jl}/open-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})});let c;try{sf(s,`Could not open project at ${t}`),c=await s.json()}catch(m){throw MFe(m instanceof Error?m.message:`HTTP ${s.status} returned an invalid response`)}if(!s.ok){if(c&&typeof c=="object"){const m=c;if(typeof m.error=="string"&&f4r(m.recovery))throw new DC(m.error,m.recovery);if(typeof m.error=="string")throw new Error(m.error)}throw new Error(`Could not open project at ${t}: HTTP ${s.status}`)}const d=c;return d.config&&g$e(d.config,n),d}function X0e(t){return/^(\/|https?:|data:|blob:)/.test(t)?t:`/${t}`}async function IZr(t){try{const n=await fetch(X0e(t));if(n.ok)return await n.text()}catch{}return null}async function SMe(t){try{const n=await fetch(`/__editor/source-file?path=${encodeURIComponent(t.replace(/^\.?\//,""))}`,{cache:"no-store"});if(n.ok)return await n.text()}catch{}return null}function NZr(t){return(t.headers.get("content-type")??"").toLowerCase().includes("text/html")}async function jRt(t){try{const n=await fetch(X0e(t),{method:"HEAD"});return n.ok?NZr(n)?"absent":"present":"absent"}catch{return"unreachable"}}async function OZr(t){return await jRt(t)==="present"}async function b2n(t,n,s){try{const c=s==="base64"?T4r(n):n;return await gR().write(t,c),!0}catch{return!1}}async function LRt(t,n={}){if(t.length===0)return[];const s=await fetch(`/__editor/source-files?${new URLSearchParams([...t.map(d=>["include",d]),...n.order==="mtime"?[["order","mtime"]]:[]])}`);return s.ok?(await s.json()).files??[]:[]}async function S2n(){const t=await fetch(`${Jl}/validation-log`);return(await L_(t,"Could not read the server validation log")).entries??[]}async function RZr(t=3e3){if(typeof fetch>"u")return{ok:!1};try{const n=await fetch(`${Jl}/project`,{signal:AbortSignal.timeout(t)}),s=await L_(n,"Editor lease poll failed");return{ok:!0,identity:{project:typeof s.project?.path=="string"?s.project.path:null,pid:typeof s.session?.pid=="number"?s.session.pid:null}}}catch{return{ok:!1}}}async function FZr(){try{const t=await fetch(`${Jl}/editor-state`);return await L_(t,"Could not read editor state")}catch{return{}}}let qSt=!1;async function MZr(t,n={}){try{const s=await ZDt(`${Jl}/editor-state`,JSON.stringify(t),n.leaving===!0);return CN(s,"Could not save editor state"),!0}catch(s){return qSt||(qSt=!0,console.error(s instanceof Error?s.message:String(s))),!1}}let fZ=null,kge=null;async function BRt(){for(;fZ;){const t=fZ;fZ=null,await bN("state",{...t,_clientId:wC})}kge=null,fZ&&(kge=BRt())}function zSt(t){return fZ=t,kge??=BRt(),kge}async function jZr(t){await bN("command-received",{_requestId:t,_clientId:wC})}async function i_e(t){await bN("command-listener",{_clientId:wC,attached:t})}let LZr=0;function BZr(t){const n=++LZr;dZr(t.phase,wC,n),bN("play-phase",{_clientId:wC,...t,source:wC,sequence:n})}async function VSt(t,n,s,c,d=!1){const m={_requestId:t,_clientId:wC,ok:n,error:s,data:c};d?await wZr(t,m):await bN("command-result",m)}async function rte(t,n){sf(t,`gameplay recording ${n} failed`);const s=await t.json().catch(()=>({}));if(!t.ok)throw new Error(`gameplay recording ${n} failed: ${typeof s.error=="string"?s.error:`HTTP ${t.status}`}`);return s}async function x2n(t,n){const s=await fetch(`${Jl}/recording/start`,{...n?{signal:n}:{},method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});return rte(s,"start")}async function w2n(t,n,s,c){const d=new URLSearchParams({id:t.id,sequence:String(n)}),m=await fetch(`${Jl}/recording/dom?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":"application/octet-stream"},body:s});await rte(m,"DOM event upload")}async function T2n(t,n,s,c){const d=new URLSearchParams({id:t.id,name:n}),m=await fetch(`${Jl}/recording/asset?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":s.type||"application/octet-stream"},body:s});await rte(m,"replay asset upload")}async function C2n(t,n,s,c){const d=new URLSearchParams({id:t.id,sequence:String(n)}),m=await fetch(`${Jl}/recording/chunk?${d}`,{...c?{signal:c}:{},method:"POST",headers:{"content-type":"application/octet-stream"},body:s});await rte(m,"chunk upload")}async function E2n(t,n,s,c){const d=await fetch(`${Jl}/recording/finish`,{...s?{signal:s}:{},method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id,reason:n??null,replay:c??null})});await rte(d,"finish")}async function k2n(t){await fetch(`${Jl}/recording/abort`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t.id})}).catch(()=>{})}async function A2n(){const t=await fetch(`${Jl}/repository-presence`,{cache:"no-store"});if(sf(t,"Could not read repository presence"),!t.ok)return{currentWorktreeId:null,sessions:[]};const n=await t.json().catch(()=>null);return{currentWorktreeId:typeof n?.currentWorktreeId=="string"?n.currentWorktreeId:null,sessions:Array.isArray(n?.sessions)?n.sessions:[]}}async function $Zr(){const t=await fetch(`${Jl}/project`,{cache:"no-store"});if(sf(t,"Could not read this session’s worktree identity"),!t.ok)return{branch:null,worktreeId:null};const n=await t.json().catch(()=>null);return{branch:typeof n?.session?.branch=="string"?n.session.branch:null,worktreeId:typeof n?.session?.worktreeId=="string"?n.session.worktreeId:null}}async function BR(t,n){const s=await fetch(`${Jl}/worktrees${t}`,n);sf(s,`Worktree operation ${t||"(list)"} failed`);const c=await s.json().catch(()=>null);if(!s.ok)throw new Error(typeof c?.error=="string"?c.error:`Worktree operation failed (${s.status}).`);return c??{}}function $Rt(t){return{worktrees:Array.isArray(t.worktrees)?t.worktrees:[],branches:Array.isArray(t.branches)?t.branches:[]}}async function qZr(){const t=await BR("/harnesses");return Array.isArray(t.harnesses)?t.harnesses:[]}async function zZr(){const t=await BR("");return $Rt(t)}async function VZr(t){return await BR("/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})})}async function USt(t,n="HEAD"){return await BR("/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t,from:n})})}async function UZr(t){return BR("/delegate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async function JZr(t){const n=await BR("/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t})});return $Rt(n).worktrees}async function WZr(t,n){await BR("/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({worktreeId:t,sessionId:n})})}let Age=null;const xMe=new Set,wMe=new Set;function HZr(t){Age=t;for(const n of xMe)n(t);for(const n of wMe)n()}function Ih(){return Age}function D2n(t){return xMe.add(t),Age&&t(Age),()=>{xMe.delete(t)}}function o_e(t){return wMe.add(t),()=>{wMe.delete(t)}}const nA="references",qRt=["public",nA],Lze=`/project-game-static/${nA}/`;function Dge(t,n){return`${t}/${n}`}function Y0e(t,n){return t===nA?`${Lze}${n}`:`/${n}`}function GZr(t){return t.startsWith(Lze)}function KZr(t){const n=t.startsWith("/")?t:`/${t}`;if(GZr(n))return Dge(nA,n.slice(Lze.length));const s=t.startsWith("/")?t.slice(1):t;return s.startsWith("public/")?s:`public/${s}`}function zRt({assetPath:t,kind:n,sizeBytes:s}){return $.jsx(XZr,{assetPath:t,kind:n,sizeBytes:s},t)}function XZr({assetPath:t,kind:n,sizeBytes:s}){const c=t.split("#")[0],d=c.startsWith("/")||/^(?:data|blob|https?):/.test(c)?c:`/${c}`,m=KZr(c),[g,S]=Ye.useState(s),[k,A]=Ye.useState(null),[F,D]=Ye.useState(null);Ye.useEffect(()=>{if(s!==void 0){S(s);return}let pe=!1;const[ue,...Ce]=m.split("/"),Fe=Ce.pop();return K0e(ue,Ce.join("/")).then(De=>{!pe&&De.ok&&S(De.entries.find(be=>be.name===Fe)?.size)}),()=>{pe=!0}},[m,s]),Ye.useEffect(()=>{if(A(null),D(null),n==="image"){const ue=new Image;return ue.onload=()=>A({width:ue.naturalWidth,height:ue.naturalHeight}),ue.onerror=()=>D("Image properties could not be read."),ue.src=d,()=>{ue.onload=null,ue.onerror=null}}const pe=document.createElement(n);return pe.preload="metadata",pe.onloadedmetadata=()=>A({...Number.isFinite(pe.duration)?{duration:pe.duration}:{},...pe instanceof HTMLVideoElement?{width:pe.videoWidth,height:pe.videoHeight}:{}}),pe.onerror=()=>D("Media properties could not be read. The file may be missing or unsupported."),pe.src=d,()=>{pe.onloadedmetadata=null,pe.onerror=null,pe.removeAttribute("src"),pe.load()}},[d,n]);const J=k?.width,q=k?.height,G=[];if(J&&q){let pe=J,ue=q;for(;ue;)[pe,ue]=[ue,pe%ue];G.push(["Dimensions",`${J} × ${q} px`],["Aspect ratio",`${J/pe}:${q/pe}`])}k?.duration!==void 0&&G.push(["Duration",`${Number(k.duration.toFixed(3))} s`]);const se=c.split("?")[0].match(/\.([^./]+)$/)?.[1];return se&&G.push(["Format",se.toUpperCase()]),g!==void 0&&G.push(["File size",g<1024?`${g} B`:`${(g/(g<1024*1024?1024:1024*1024)).toFixed(1)} ${g<1024*1024?"KB":"MB"}`]),G.push(["Location",m]),$.jsxs("div",{"data-testid":"media-properties",style:{padding:8,fontSize:12},children:[F?$.jsx("p",{role:"status",style:{color:Zf[2]},children:F}):!k&&$.jsx("p",{role:"status",style:{color:Zf[3]},children:"Reading media properties…"}),$.jsx("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto minmax(0, 1fr)",gap:"10px 12px"},children:G.map(([pe,ue])=>$.jsxs("div",{style:{display:"contents"},children:[$.jsx("dt",{style:{color:Zf[3]},children:pe}),$.jsx("dd",{style:{margin:0,color:Zf[1],overflowWrap:"anywhere"},children:ue})]},pe))})]})}const Y7e=Ye.lazy(async()=>({default:(await fo(()=>Promise.resolve().then(()=>STr),void 0)).AssetEditorShell})),YZr=Ye.lazy(async()=>({default:(await fo(()=>import("./AudioViewer-SyAuzT6d.js"),__vite__mapDeps([255,1,2,3,4,20,21,22,23]))).AudioViewer})),ZZr=Ye.lazy(async()=>({default:(await fo(()=>import("./ImageViewer-CVnrpv0B.js"),__vite__mapDeps([256,1,2,3,4,20,21,22,23]))).ImageViewer})),QZr=Ye.lazy(async()=>({default:(await fo(()=>import("./VideoViewer-DrtHx0m_.js"),__vite__mapDeps([257,1,2,3,4,20,21,22,23]))).VideoViewer})),eQr=Ye.lazy(async()=>({default:(await fo(()=>import("./JsonAssetDocument-Cztt4zjY.js").then(n=>n.a),__vite__mapDeps([258,1,2,3,4,20,21]))).JsonAssetDocument})),JSt=Ye.lazy(async()=>({default:(await fo(()=>import("./OnlineAssetDetail-B9ku5sHJ.js"),__vite__mapDeps([259,1,2,3,4,20,21,260,22,23]))).OnlineAssetDetail})),tQr=Ye.lazy(async()=>({default:(await fo(()=>import("./SourceAssetViewer-bAfvPckn.js"),__vite__mapDeps([261,1,2,3,4,20,21,258,255,22,23,256]))).SourceAssetViewer})),K1=new Map,VRt=new Map,Z7e=new Map;let URt=0;const TMe=new Set;function nR(){URt++;for(const t of TMe)t()}function rQr(t){return TMe.add(t),()=>{TMe.delete(t)}}function nQr(){return URt}function iQr(t){return K1.get(t)}function JRt(t){return K1.has(t)}function oQr(t,n){const s=new Set([...Object.keys(t),...Object.keys(n)]);for(const c of s){const d=t[c],m=n[c];if(d!==m&&JSON.stringify(d)!==JSON.stringify(m))return!1}return!0}function Bze(t,n,s,c,d={}){typeof document<"u"&&document.activeElement instanceof HTMLElement&&Z7e.set(t,document.activeElement);const m=K1.get(t);if(!m)K1.set(t,s),nR();else{const S={...m,...s};oQr(m,S)||(K1.set(t,S),nR())}const g={id:t,title:n,kind:"asset",workspaceRole:"authored-subject",...c?{provenance:c}:{},Content:dQr,closeable:!0,presentation:()=>{const S=K1.get(t);return S?S.entityId?{kind:"asset",entityId:S.entityId,assetKind:"model"}:!S.assetPath||S.online?null:{kind:"asset",path:S.assetPath,assetKind:S.kind}:null},persist:()=>{const S=K1.get(t);if(!(!S?.assetPath||S.online||S.entityId!==void 0))return{path:S.assetPath,assetKind:S.kind}},onActivate:()=>{(s.kind==="image"||s.kind==="video"||s.kind==="audio")&&oD()},onDispose:S=>{K1.delete(S)&&nR();const k=Z7e.get(S);Z7e.delete(S),k?.isConnected&&setTimeout(()=>k.focus(),0)}};return ND(g,d)}function sN(t,n,s={}){const c=qYr(t),{frameName:d}=H0e(t),m=VRt.get(AO(t))??t;return Bze(m,c,d?{assetPath:t,kind:n,displayName:c}:{assetPath:t,kind:n},{sourcePath:t},s)}wee({kind:"asset",owner:"asset-documents",restore:async({state:t})=>{const n=t,s=typeof n?.path=="string"?n.path:null,c=typeof n?.assetKind=="string"?n.assetKind:null;return!s||!c||!await OZr(s)?!1:(sN(s,c),!0)}});async function WRt(t,n){return EC(()=>{if(e_()!==t)return!1;const s=cBe(t);return s?n!=="model"||s.adapter!==null:!1},PR)}kN({id:"asset-editor:entity",owner:"asset-documents",open:(t,{entityId:n,title:s})=>Bze(`asset-editor:entity:${n}`,s,{assetPath:"",kind:"model",entityId:n},{origin:`entity:${n}`})});kN({id:"asset",owner:"asset-documents",open:(t,n)=>{if(n.entityId){const c=Ih();if(!c)return null;const d=kze(Y0(c),n.entityId)?.assetDocument?.open()??null;if(!d)throw new Error(`Scene entity is not available: ${n.entityId}`);return d}const s=n.path;return s===void 0?null:sN(s,WSt(n.assetKind,s))},ready:async(t,n)=>{const s=n.entityId?"model":WSt(n.assetKind,n.path??"");if(!await WRt(t,s))throw new Error(`Asset document did not finish mounting its Inspector: ${t}`);await SBe(t)}});function WSt(t,n){return t==="animation"?"source":t==="prefab"?"json":t??sQr(n)}function sQr(t){const n=t.slice(t.lastIndexOf(".")+1).toLowerCase();return n==="glb"||n==="gltf"?"model":["png","jpg","jpeg","webp","gif","svg"].includes(n)?"image":["mp3","ogg","wav","flac"].includes(n)?"audio":["glsl","vert","frag","ts","tsx","js","jsx","css","html","md","txt"].includes(n)?"source":"json"}function aQr(t,n){const s=YYr(n);return Bze(`asset-editor:subject:${t}`,n.name,{assetPath:s,kind:n.kind,displayName:n.name,...n.sourcePath?{sourcePath:n.sourcePath}:{}},n.sourcePath?{sourcePath:n.sourcePath}:{origin:`entity:${t}`})}function cQr(t,n){const s=K1.get(t);if(!s)return;const{online:c,...d}=s;K1.set(t,{...d,assetPath:n}),nR()}function lQr(t,n){const s=K1.get(t);if(!s?.assetPath)return;const c=AO(s.assetPath);if(n.type==="move"&&n.oldPath&&n.newPath&&c===AO(n.oldPath)){const d=`/${AO(n.newPath)}`;K1.set(t,{...s,assetPath:d}),VRt.set(AO(d),t),R3t(t,d.split("/").pop()??d),nR()}else n.type==="delete"&&n.paths?.some(d=>AO(d)===c)?(K1.set(t,{...s,unavailableReason:`The source ${s.assetPath} was deleted. Undo the deletion or close this editor.`}),nR()):n.type==="change"&&n.paths?.some(d=>AO(d)===c)&&(K1.set(t,{...s,revision:(s.revision??0)+1}),nR())}function uQr(t){return t.online?"online":ig(t.assetPath).editor==="environment"?"environment":t.kind==="json"?"json":["model","image","video","audio","source"].includes(t.kind)?t.kind:"unsupported"}function Q7e(t){return{id:"source",title:"Source",icon:zTt,order:fQ,body:{kind:"custom",render:()=>$.jsx("div",{style:{padding:4},children:t.sourcePath??t.assetPath})}}}function fQr({id:t,spec:n,active:s}){if(n.unavailableReason)return $.jsx(Y7e,{documentId:t,active:s,type:n.kind,title:n.assetPath.split("/").pop()||"Deleted asset",status:"Source unavailable",children:$.jsx("div",{style:{padding:20,color:C_e},children:n.unavailableReason})});const c=uQr(n);if(c==="online"&&n.online){const k=n.online;return $.jsx(Y7e,{documentId:t,active:s,type:"online",title:k.name,sections:[{id:"online-asset",title:"Asset",icon:M0r,order:fQ,body:{kind:"custom",render:()=>$.jsx(JSt,{online:k,mode:"inspector",onResolved:A=>cQr(t,A)})}}],status:`${k.type} · ${k.source}`,children:$.jsx(JSt,{online:k,mode:"preview"})})}const d=(n.displayName??n.assetPath.split("/").pop())||n.entityId||"Asset",m=`${t}:${n.revision??0}`,g=$.jsxs("div",{style:{padding:20,color:C_e},children:["No editor package in this project renders ",d,"."]});if(c==="model")return n.assetPath?$.jsx(X7e,{route:"model",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m):n.entityId?$.jsx(X7e,{route:"entity-model",documentId:t,assetPath:"",entityId:n.entityId,displayName:d,active:s,whenUnregistered:g},m):$.jsx("div",{style:{padding:20,color:C_e},children:"Model source is unavailable."});if(c==="environment")return $.jsx(X7e,{route:"environment",documentId:t,assetPath:n.assetPath,displayName:d,active:s,whenUnregistered:g},m);if(c==="source")return $.jsx(tQr,{documentId:t,assetPath:n.assetPath,active:s},m);if(c==="json")return $.jsx(eQr,{documentId:t,assetPath:n.assetPath,displayName:d,active:s,sections:[Q7e(n)],status:`json · ${n.sourcePath??n.displayName??n.assetPath}`},m);let S;switch(c){case"image":S=$.jsx(ZZr,{assetPath:n.assetPath,...n.displayName?{displayName:n.displayName}:{}},m);break;case"video":S=$.jsx(QZr,{assetPath:n.assetPath},m);break;case"audio":S=$.jsx(YZr,{assetPath:n.assetPath},m);break;default:S=$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"No viewer available for this asset type."})}return $.jsx(Y7e,{documentId:t,active:s,type:c,title:d,fill:c==="image"||c==="video",sections:c==="image"&&!n.assetPath.includes("#")||c==="video"||c==="audio"?[{id:"media-properties",title:"Properties",icon:zTt,order:fQ,body:{kind:"custom",render:()=>$.jsx(zRt,{assetPath:n.assetPath,kind:c},m)}},...n.sourcePath?[Q7e(n)]:[]]:[Q7e(n)],status:`${c} · ${n.sourcePath??n.displayName??n.assetPath}`,children:S})}function dQr({documentId:t,active:n}){Ye.useSyncExternalStore(rQr,nQr),Ye.useEffect(()=>{const c=d=>{lQr(t,d.detail)};return window.addEventListener("editor:asset-mutation",c),()=>window.removeEventListener("editor:asset-mutation",c)},[t]);const s=K1.get(t);return $.jsx("div",{"data-testid":`asset-document:${t}`,style:{flex:1,minHeight:0,overflow:"hidden",pointerEvents:"auto",background:hBe[1]},children:s?$.jsx(Ye.Suspense,{fallback:$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"Loading asset viewer…"}),children:$.jsx(fQr,{id:t,spec:s,active:n})}):$.jsx("div",{style:{padding:16,color:Zf[2],fontSize:12},children:"This asset document is no longer available."})})}function AO(t){return t.split(/[?#]/,1)[0].replace(/^\/+/,"")}const HRt=["three","pixi","dom","babylon","phaser"],$ze=Object.freeze({up:"y",groundHeight:0}),GRt=Pa({surface:ed(["three","canvas","dom"]).describe("An additional surface this root mounts, beside the manifest root’s own adapter"),include:Gd(bo().min(1)).min(1).describe("Project-relative globs (`**`, `*`, `?`) naming the source files that render on this additional surface")}).strict(),pQr=Pa({up:ed(["y","z"]).describe("World axis pointing away from the ground"),groundHeight:fu().describe("Ground offset along `up`, in world units")}).strict(),_Qr=Pa({id:bo().min(1).describe("Manifest root id this region grades"),surface:ed(["three","canvas","dom"]).describe("Render surface the host hands this root"),substrate:ed(HRt).describe("Native substrate serving this region, by name"),dialect:bo().min(1).nullable().describe("Dialect writer serving this region, by name; null states outright that the host writes no source here (the region's truth is the game's own code)"),anchors:Gd(ed(ZLe)).describe("Anchor kinds this region’s writer serves"),basis:pQr.optional().describe("World basis (up axis + ground height); omit for the native +Y / 0 default"),include:Gd(bo().min(1)).min(1).optional().describe("Project-relative globs (`**`, `*`, `?`) naming source files this region owns, for files no root entry’s import closure reaches; a declared include wins over reach"),mounts:Gd(GRt).min(1).optional().describe("Surfaces this root mounts BESIDE its own adapter, each with the files that render on them; with `surface`, the root’s full mounted surface set")}).strict(),mQr=AR([Dg("manifest-roots"),Gd(_Qr).min(1)]),hQr=Pa({include:Gd(bo().min(1)).min(1).optional().describe("Project-relative globs (`**`, `*`, `?`) naming source files this derived region owns, for files no root entry’s import closure reaches; a declared include wins over reach"),mounts:Gd(GRt).min(1).optional().describe("Surfaces this root mounts BESIDE its own adapter, each with the files that render on them; with the derived region’s own surface, the root’s full mounted surface set")}).strict().refine(t=>t.include!==void 0||t.mounts!==void 0,{message:"regionIncludes entry declares neither `include` nor `mounts` — an empty overlay states nothing the derivation did not already say. Remove it, or name the files it owns."}),gQr=wD(bo().min(1),hQr).describe("Per-region parameters for the `manifest-roots` rule, keyed by manifest root id: the `include` globs and `mounts` surfaces the mechanical derivation cannot produce");function qze(t,n={}){return t.map(s=>({...vQr(s),...yQr(n[s.id])}))}function yQr(t){return t?{...t.include?{include:t.include}:{},...t.mounts?{mounts:t.mounts}:{}}:{}}function KRt(t,n){const s=new Set(t.map(c=>c.id));return Object.keys(n).filter(c=>!s.has(c))}function vQr(t){const n=t.surface,s=t.adapter.type==="builtin",c=n==="canvas"?"pixi":n,d=$ze;return s?n==="dom"?{id:t.id,surface:n,substrate:c,dialect:"jsx",anchors:["source-prop","source-structure"],basis:d}:{id:t.id,surface:n,substrate:c,dialect:n==="three"?"r3f":"pixi-react",anchors:["source-prop","source-structure","construction-literal"],basis:d}:{id:t.id,surface:n,substrate:c,dialect:null,anchors:["live-only"],basis:d}}const VQ="exported-composition-regions",bQr=Pa({finder:bo().min(1).describe("Registered finder name")}).passthrough(),SQr=AR([Pa({kind:Dg("root-mount")}).strict(),Pa({kind:Dg("entrypoint-selection"),selection:bo().min(1),key:bo().min(1),active:_y().optional()}).strict(),Pa({kind:Dg("story"),storyId:bo().min(1)}).strict(),Pa({kind:Dg("game-contract"),sceneId:bo().min(1)}).strict(),Pa({kind:Dg("none"),reason:bo().min(1)}).strict()]),HSt=Pa({path:bo().min(1),export:bo().min(1).optional()}).strict(),xQr=Pa({id:bo().min(1),label:bo().min(1),kind:bo().min(1),region:bo().min(1).nullable(),authorable:_y(),reach:SQr,source:HSt.optional(),isolationSetup:HSt.optional(),finder:bo().min(1).optional()}).strict(),wQr=Pa({entries:Gd(xQr).optional(),find:Gd(bQr).optional(),default:bo().min(1).optional()}).strict(),XRt=["command","state"],TQr="observation.kind must be 'command' or 'state' — the two DebugAdapter faces a declaration projects onto. A SystemAdapters slot is declared through the game contract’s `systemAdapters` carrier, which validates it per-surface; declaring one here would be a second door onto the same slot with no rule for which wins.",CQr=Pa({id:bo().min(1),kind:ed(XRt,{error:()=>TQr}),description:bo().min(1).optional(),locus:ed(["client","server"]).optional(),answer:YI(t=>typeof t=="function",{message:"observation.answer must be a function evaluated against the mounted game"}).optional()}).strict().refine(t=>t.kind==="command"||t.locus===void 0,{path:["locus"],message:"observation.locus is valid only for a command declaration"}),EQr=["digital","scalar","vector2","pointerDelta","pointerPosition"],kQr=Pa({root:bo().min(1),actions:YI(t=>typeof t=="function",{message:"input.actions must be a function returning the app-owned action vocabulary"}),set:YI(t=>typeof t=="function",{message:"input.set must be a function writing the app-owned input store"}),clear:YI(t=>typeof t=="function",{message:"input.clear must be a function releasing app-owned virtual actions"})}).strict(),AQr=Pa({Layout:YI(t=>typeof t=="function","Layout must be an imported React component").optional(),style:YI(t=>typeof t=="object"&&t!==null&&typeof Reflect.get(t,"id")=="string","style must be an imported StyleContribution object").optional(),keymap:YI(t=>typeof t=="object"&&t!==null&&typeof Reflect.get(t,"id")=="string","keymap must be an imported KeymapContribution object").optional(),workspace:bo().min(1).optional(),inspector:ed(["column","properties","card"]).optional(),playUtilities:Gd(bo().min(1)).optional()}).strict(),DQr="`regionIncludes` states parameters for the `manifest-roots` RULE, so it cannot be paired with an explicit `regions` list — that form is the full replacement, and each entry carries its own `include`/`mounts`. Move these globs onto the matching `regions[]` entry, or drop the list and let the derivation run.",YRt=Pa({editor:AQr.optional(),regions:mQr.optional(),regionIncludes:gQr.optional(),documents:wQr.optional(),observation:Gd(CQr).optional(),input:kQr.optional()}).strict().refine(t=>t.regionIncludes===void 0||Object.keys(t.regionIncludes).length===0||!Array.isArray(t.regions),{message:DQr});function zze(t={}){const n=YRt.safeParse(t);if(!n.success)throw new Error(`volter.adapter.ts: invalid adapter definition — ${n.error.issues.map(s=>`${s.path.join(".")||"(root)"}: ${s.message}`).join("; ")}`);return Object.freeze({...t.editor?{editor:Object.freeze({...t.editor,...t.editor.playUtilities?{playUtilities:Object.freeze([...t.editor.playUtilities])}:{}})}:{},regions:t.regions??"manifest-roots",regionIncludes:Object.freeze({...t.regionIncludes??{}}),documents:Object.freeze({...t.documents??{}}),observation:Object.freeze([...t.observation??[]]),...t.input?{input:t.input}:{}})}function DO(t={}){return zze({regions:"manifest-roots",...t.regionIncludes?{regionIncludes:t.regionIncludes}:{},documents:{...t.scenes?{entries:t.scenes}:{},find:[{finder:"scenesFromEntrypointSelection",regions:VQ},{finder:"prefabsFromStories"}]}})}function CMe(t){if(t===null||typeof t!="object")throw new Error(`volter.adapter.ts must default-export defineAdapter({…}) / nativeAdapter() — got ${t===null?"null":typeof t}`);return zze(t)}const P2n=Object.freeze(Object.defineProperty({__proto__:null,ADAPTER_INPUT_VALUE_TYPES:EQr,AdapterDefinitionSchema:YRt,EXPORTED_COMPOSITION_REGIONS:VQ,NATIVE_REGION_BASIS:$ze,OBSERVATION_KINDS:XRt,SUBSTRATE_NAMES:HRt,defineAdapter:zze,nativeAdapter:DO,parseAdapterDefinition:CMe,regionsFromManifestRoots:qze,unmatchedRegionIncludeIds:KRt},Symbol.toStringTag,{value:"Module"})),MZ=new Map;function Vze(t){const n=t;return MZ.set(t.name,n),()=>{MZ.get(t.name)===n&&MZ.delete(t.name)}}function Uze(t,n){const s=t??{},c=[];(typeof s.name!="string"||s.name.length===0)&&c.push("`name` must be a non-empty string");const d=s.schema;if((!d||typeof d.safeParse!="function")&&c.push("`schema` must be a Zod schema"),typeof s.run!="function"&&c.push("`run(selection, input)` must be a function"),c.length>0)throw new Error(`${n}: not a finder — ${c.join("; ")}`);return Vze(s)}function ZRt(){return[...MZ.keys()]}function QRt(t,n){const s=MZ.get(t.finder);if(!s){const d=ZRt();throw new Error(`Unknown finder ${JSON.stringify(t.finder)} — registered: ${d.length>0?d.map(m=>`"${m}"`).join(", "):"none"}`)}const c=s.schema.safeParse(t);if(!c.success)throw new Error(`Finder ${JSON.stringify(t.finder)}: ${c.error.issues.map(d=>`${d.path.join(".")||"(selection)"}: ${d.message}`).join("; ")}`);return s.run(c.data,n)}const I2n=Object.freeze(Object.defineProperty({__proto__:null,registerContributedFinder:Uze,registerFinder:Vze,registeredFinderNames:ZRt,runRegisteredFinder:QRt},Symbol.toStringTag,{value:"Module"}));function GSt(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var eOe={exports:{}};const PQr={},IQr=Object.freeze(Object.defineProperty({__proto__:null,default:PQr},Symbol.toStringTag,{value:"Module"})),wI=Yyr(IQr);var KSt;function NQr(){return KSt||(KSt=1,(function(t){var n={};/*! *****************************************************************************
943
943
  Copyright (c) Microsoft Corporation. All rights reserved.
944
944
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
945
945
  this file except in compliance with the License. You may obtain a copy of the
@@ -1394,16 +1394,16 @@ volter.project.json does not match the current project format:
1394
1394
  ${wen(g)}`)}const m={manifestVersion:d.manifestVersion,name:d.name,version:d.version,engine:d.engine,appId:d.appId,resolution:d.resolution,authoring:d.authoring?{hierarchy:gFt(d.authoring.hierarchy)}:void 0,hasThreeRoot:aFt(d,"three"),rootCount:d.roots.length,configurations:d.configurations};return cLe({rootPath:t,config:m})}const Cen=3,Een=300;async function yFt(){const t=await Mze();for(let n=1;;n++){const s=await jze(),c=y4r({status:s.status,attempt:n,maxAttempts:Cen});if(c==="continue-ladder")return null;if(c==="open"&&s.status==="project"){const d=s.project;return g$e(d.config,t),cLe({rootPath:d.path,config:d.config})}if(c==="retry"){await new Promise(d=>setTimeout(d,Een));continue}throw new y$e(v4r(s.status==="unreadable"?{status:"unreadable",path:s.path,error:s.error}:{status:"unknown",error:s.status==="unknown"?s.error:"no answer from the server"}))}}async function ken(){w4r(window.location.search);const t=await yFt();return t||Aen()}async function Aen(){const[t,n]=await Promise.all([PZr(),DZr()]),s=g4r({explicitTarget:null,hubRequested:x4r(window.location.search),reopenLastEnabled:t.reopenLastProject,recents:n});if(s.kind!=="reopen-last")return null;try{return await Ten(s.path)}catch(c){return console.warn(`[volter] "Reopen last project on launch" could not open ${s.path}; showing the project browser instead.`,c),null}}const OMe=new Map;function Y2n(t){for(const[n,s]of OMe)if(vFt(n,t))return s;return null}function Z2n(t){for(const n of[...OMe.keys()])vFt(n,t)&&OMe.delete(n)}function ZSt(t){return t.replaceAll("\\","/")}function vFt(t,n){const s=ZSt(t),c=ZSt(n).replace(/^\.?\//,"");return s===c||s.endsWith(`/${c}`)}function bFt(t){return()=>{}}function Den(t,n,s){if(!t.startsWith("."))return null;const c=n.replaceAll("\\","/").split("/").slice(0,-1);for(const m of t.split("/"))m==="."||m===""||(m===".."?c.pop():c.push(m));const d=c.join("/");for(const m of[d,`${d}.tsx`,`${d}.ts`,`${d}/index.tsx`,`${d}/index.ts`])if(s.has(m))return m;return null}function QSt(t){const n=t.replaceAll("\\","/").replace(/^\.\//,""),s=n.lastIndexOf("/");return s>=0?n.slice(0,s):""}function Pen(t){const n=new Map;for(const s of t){const c=s.componentName;if(c===void 0||c==="")continue;const d=n.get(c);d?d.push(s):n.set(c,[s])}return n}function Ien(t,n){const s=n?t.filter(d=>QSt(d.modulePath)===QSt(n.path)):[],c=s.length>0?s:t;return{chosen:c.find(d=>d.isDefault===!0)??c[0],colocated:s.length>0}}function Nen(t,n){const s=[],c=[];for(const[d,m]of Pen(n.stories)){const g=n.components?.find(A=>A.name===d),{chosen:S,colocated:k}=Ien(m,g);S&&(g&&!k&&c.push(`prefabsFromStories: "${d}" is declared by ${S.modulePath}, which is not colocated with ${g.path}. The join is by name; confirm it names this component.`),s.push({id:d,label:d,kind:"prefab",region:g?.region??null,authorable:!0,reach:{kind:"story",storyId:S.storyId},...g?{source:{path:g.path,export:g.name}}:{},finder:"prefabsFromStories"}))}return{entries:s,notes:c}}function Oen(){const t=[];for(const n of rq())if(n.ok)for(const s of n.stories)t.push({modulePath:n.modulePath,storyId:s.id,label:s.label,...s.componentName===void 0?{}:{componentName:s.componentName},isDefault:vRt(s)});return t}const Ren={name:"prefabsFromStories",schema:Pa({finder:Dg("prefabsFromStories")}).strict(),run(t,n){return Nen(t,{stories:Oen(),...n.components===void 0?{}:{components:n.components}})}},LB="volter.adapter.ts";let LZ=null,Nge=null,Z0e="__unscoped__",iR=null,SFt=0;const UQ=new Set;function u0(){return Z0e===Em()?LZ:null}async function Q2n(){return iR&&await iR,Z0e===Em()?Nge:null}function Gze(){const t=()=>!of()||!!u0();return t()?Promise.resolve():new Promise(n=>{const s=OC(()=>{t()&&(s(),n())})})}async function Fen(){for(await(await fo(async()=>{const{projectBootstrapSettled:n}=await Promise.resolve().then(()=>Q9t);return{projectBootstrapSettled:n}},void 0)).projectBootstrapSettled(),await mN(),await BB();iR;)await iR;const t=u0();if(!t||t.documentsPending)throw new Error("The project document table could not finish loading; inspect the project diagnostics.");return t.scenes}function OC(t){return UQ.add(t),()=>UQ.delete(t)}function cme(t,n=[],s=void 0,c=null){Z0e=Em(),LZ=t,Nge=c,TEr(c?.editor),ben(t?.regions??[]),ten(n),ren(s??null);for(const d of UQ)d();WEr()}function Men(t){return{id:t.id,kind:t.kind,answered:t.answer!==void 0}}function jen(t){const{Layout:n,...s}=t;return{...s,...n?{layout:n.displayName??n.name??"Project layout"}:{}}}async function Len(t){return await import(`${Jze(t,LB)}?t=${Date.now()}`)}function Ben(t,n){return t.find(s=>s.surface===n)?.id??null}function $en(t){const n=new Set(t.map(s=>s.path));return(s,c)=>Den(s,c,n)}function qen(t){const n=cFt(t);return n.length===1?n[0].id:null}const zen={entrypoints:[],components:[]};async function Ven(t,n,s){const c=[];for(const A of MB(t))A.entry&&c.push({regionId:A.id,path:A.entry,source:await SMe(A.entry)});let d=[];const m=await MRt().catch(A=>({ok:!1,reason:A instanceof Error?A.message:String(A)}));m.ok?d=m.entries.map(A=>({name:A.name,path:A.path,region:Ben(n,A.surface)})):ea.warn(`Component index unavailable, so prefabs resolve without source paths: ${m.reason}`,"project");const g=new Set;for(const A of s.documents.find??[])for(const F of A.include??[])g.add(F);const S=[],k=[];if(g.size>0){const A=await LRt([...g],{order:"mtime"}).catch(()=>[]);for(const F of A){k.push(F);const D=await SMe(F);D!==null&&!D.includes("\0")&&S.push({path:F,source:D})}}return{entrypoints:c,components:d,sources:S,files:k,resolveModule:$en(d)}}function Uen(t,n){const s=[...t.documents.entries??[]],c=[],d=[];let m=0;for(const S of t.documents.find??[]){let k;try{k=XQr(S,n)}catch(A){c.push(`finder ${JSON.stringify(S.finder)}: ${A instanceof Error?A.message:String(A)}`),m+=1;continue}s.push(...k.entries),c.push(...k.notes),k.default!==void 0&&d.push(k.default)}const g=d.length===1?d[0]:null;return{table:{entries:s,default:t.documents.default??g},notes:c,unresolved:m}}const MI=[];function eSn(t){const n=MI.findIndex(s=>s.owner===t.owner&&s.id===t.id);return n>=0&&MI.splice(n,1),MI.push(t),MI.sort((s,c)=>(s.order??0)-(c.order??0)),()=>{const s=MI.indexOf(t);s>=0&&MI.splice(s,1)}}function ext(t){for(const n of MI){const s=n.modulePathFor(t);if(s!==null)return{source:n,modulePath:s}}return null}function txt(t){return t!==null&&typeof t=="object"&&"default"in t?t.default:t}function KL(t,n){if(t.kind==="present")try{return{definition:CMe(txt(t.module)),source:"project",modulePath:LB,error:null}}catch(c){return{definition:DO(),source:"native",modulePath:null,error:`${LB} did not load — ${JQ(c)}`}}if(t.kind==="broken")return{definition:DO(),source:"native",modulePath:null,error:`${LB} did not load — ${t.error}`};const s=t.kind==="unreachable"?t.error:null;if(n.kind==="present")try{return{definition:CMe(txt(n.module)),source:"registry",modulePath:n.path,error:s}}catch(c){return{definition:DO(),source:"native",modulePath:null,error:`${n.path} did not load — ${JQ(c)}`}}return n.kind==="broken"?{definition:DO(),source:"native",modulePath:null,error:`${n.path} did not load — ${n.error}`}:n.kind==="unanswered"?{definition:DO(),source:"native",modulePath:null,error:`volter.project.json declares the ingest root \`${n.rootId}\`, and no registered adapter-definition source holds a declaration for it (${n.sources} source${n.sources===1?"":"s"} registered). The lane that owns a vendored game's declaration is \`@volter/editor-game\`, which registers through its \`ingest.service.ts\` contribution — so either this product does not compose that package, or its contribution pass did not load it. The declared native default is standing in, which means this game's own scene table is NOT what the editor is showing.`}:{definition:DO(),source:"native",modulePath:null,error:s}}function Jen(t,n,s){const{definition:c,source:d,modulePath:m,error:g}=n,S=c.regions==="manifest-roots"?qze(MB(t),c.regionIncludes):[...c.regions],k=KRt(MB(t),c.regionIncludes),{table:A,notes:F,unresolved:D}=Uen(c,s);return{source:d,modulePath:m,regions:S,scenes:A,documentsPending:D>0,...c.editor?{editor:jen(c.editor)}:{},observation:c.observation.map(Men),notes:k.length>0?[...F,`adapter: regionIncludes names ${k.map(J=>`\`${J}\``).join(", ")}, which no root in volter.project.json declares (roots: ${MB(t).map(J=>`\`${J.id}\``).join(", ")}) — those globs were merged onto nothing.`]:F,error:g}}async function Wen(t,n){const s=qen(n),c=await jRt(LB);if(c==="present")try{const g=await Len(t.rootPath);return KL({kind:"present",module:g},{kind:"absent"})}catch(g){return KL({kind:"broken",error:JQ(g)},{kind:"absent"})}const d=c==="unreachable"?{kind:"unreachable",error:`${LB} could not be probed — the project's file routes did not answer, so whether this project owns an adapter is UNKNOWN.`}:{kind:"absent"};if(s===null)return KL(d,{kind:"absent"});let m=ext(s);if(m===null&&(await Hen(s),m=ext(s)),m===null){const g=KL(d,{kind:"unanswered",rootId:s,sources:MI.length});return g.error&&ea.warn(g.error,"ingest"),g}try{const g=await m.source.importModule(s);return KL(d,{kind:"present",module:g,path:m.modulePath})}catch(g){return KL(d,{kind:"broken",path:m.modulePath,error:JQ(g)})}}let rxt=null,s_e=null,RMe=null;function nxt(){return RMe}function Hen(t){const n=Em();if(rxt!==n&&(rxt=n,s_e=null),!s_e){RMe=`Loading the ingest lane — this project declares the unmodified-game root “${t}”, whose adapter declaration a package supplies.`;for(const s of UQ)s();s_e=mN().catch(()=>{}).finally(()=>{RMe=null;for(const s of UQ)s()})}return s_e}let rOe=[],FMe="";function Gen(){const t=t$e(),n=t.map(s=>s.entryPath).join("|");if(!(n===FMe&&t.every(s=>lme.has(s.module)))){for(const s of rOe)s();rOe=[],lme=new WeakSet;for(const{entryPath:s,module:c}of t)try{rOe.push(Uze(c?.finder,s)),lme.add(c)}catch(d){ea.error(d instanceof Error?d.message:String(d),"project")}FMe=n}}let lme=new WeakSet;Uze(Ren,"packages/editor-sdk/src/kit/stories/prefabs-finder.ts");l2(()=>{const t=t$e();(t.map(s=>s.entryPath).join("|")!==FMe||!t.every(s=>lme.has(s.module)))&&of()&&BB()});GEr(()=>LZ&&!LZ.documentsPending?[...new Set(LZ.scenes.entries.map(t=>t.kind))]:null);function BB(){const t=Ken(++SFt,of());return iR=t,t.then(()=>{iR===t&&(iR=null)}),t}async function Ken(t,n){const s=()=>t===SFt&&of()===n;if(!n){cme(null);return}let c;try{c=await yen()}catch(k){if(!s())return;cme({source:"native",modulePath:null,regions:[],scenes:{entries:[],default:null},observation:[],notes:[],documentsPending:!1,error:`adapter: the project's manifest did not load, so no region could be derived — ${JQ(k)}`});return}if(!s())return;const d=await Wen(n,c);if(!s())return;Gen();const m=d.definition.regions==="manifest-roots"?qze(MB(c),d.definition.regionIncludes):[...d.definition.regions],g=(d.definition.documents.find??[]).length>0?await Ven(c,m,d.definition):zen;if(!s())return;const S=Jen(c,d,g);cme(S,d.definition.observation,d.definition.input,d.source==="native"?null:d.definition)}function JQ(t){return t instanceof Error?t.message:String(t)}function Xen(t){if(!Nge)return!0;const n=Nge.documents.find??[];for(const s of n)for(const c of s.include??[])if(Yen(c).test(t))return!0;return!1}function Yen(t){const n="__DEEP__",s=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\//g,n).replace(/\*/g,"[^/]*").split(n).join("(?:.*/)?");return new RegExp(`^${s}$`)}function Zen(){BB();const t=bFt(),n=Rw(()=>{Z0e!==Em()&&cme(null),BB()}),s=sen(c=>{(c===""||Xen(c))&&BB()});return()=>{t(),n(),s()}}const Qen="scene:";function ixt(t){return`${Qen}${t}`}function MY(t){const{kind:n}=t.reach;return n==="game-contract"||n==="root-mount"||n==="entrypoint-selection"?{liveReach:n}:{}}function Kze(t){if(!t.authorable)return{kind:"no-document",...MY(t),reason:`"${t.id}" is declared TRAVERSAL (boot/loading choreography), not an authorable composition, so it has no Edit document.`};switch(t.reach.kind){case"none":return{kind:"no-document",...MY(t),reason:t.reach.reason};case"root-mount":return t.region===null?{kind:"no-document",...MY(t),reason:`"${t.id}" is reached by mounting a region, but the entry names no region, so there is no standing document it could be.`}:{kind:"root-document",regionId:t.region,title:t.label};case"entrypoint-selection":return t.reach.active===!0&&t.region!==null?{kind:"root-document",regionId:t.region,title:t.label}:t.source?{kind:"isolation-document",documentId:ixt(t.id),title:t.label,regionId:t.region,source:t.source,...t.isolationSetup?{isolationSetup:t.isolationSetup}:{}}:{kind:"no-document",...MY(t),reason:`"${t.id}" is selected at the entrypoint's \`${t.reach.selection}\` slot, but the finder could not resolve the module it names, so there is nothing to mount in isolation.`};case"game-contract":return t.source?{kind:"isolation-document",documentId:ixt(t.id),title:t.label,regionId:t.region,source:t.source,...t.isolationSetup?{isolationSetup:t.isolationSetup}:{},contractSceneId:t.reach.sceneId}:{kind:"no-document",...MY(t),reason:`"${t.id}" is reached only through the running game's own navigation (its scenes contract calls it "${t.reach.sceneId}"), and the entry names no source module, so there is no Edit document — open it while the game is running.`};case"story":return{kind:"story-document",title:t.label,storyId:t.reach.storyId}}}function Xze(t){const n=[];for(const s of t.entries){if(s.kind!=="scene")continue;const c=Kze(s);c.kind!=="no-document"&&n.push({entry:s,plan:c,isDefault:t.default===s.id})}return n}function tSn(t,n,s){const c=Xze(t),d=c.flatMap(k=>k.plan.kind==="isolation-document"?[k.plan.documentId]:[]),m=new Set(n),g=new Set(s),S=t.entries.filter(k=>k.authorable&&k.kind!=="scene"&&k.kind!=="prefab").length;return{sceneDocuments:c.length+S,isolationDocuments:d.length,openIsolationDocuments:d.filter(k=>m.has(k)).length,availableIsolationDocuments:d.filter(k=>g.has(k)).length,pieces:t.entries.filter(k=>k.kind==="prefab").length,sceneEntries:t.entries.filter(k=>k.kind==="scene").length,storyFailures:rq().filter(k=>!k.ok).length}}function rSn(t){const n=Xze(t);return n.some(s=>s.plan.kind==="isolation-document")&&!n.some(s=>s.plan.kind==="root-document")}const a0="workspace:game",nSn="workspace:scene",etn="workspace:canvas-scene",ttn="workspace:3d-components",rtn="workspace:2d-components",ntn="workspace:ui-components",itn=new Set([etn,rtn,ttn,ntn]),otn=4e3;let BZ=null,ume=null,Oge=null,WQ=!1,fme=null,oxt=!1,Yze=!1;const Rge=new Set,stn=()=>null;function xFt(){if(!BZ)return null;const n=ume;return{id:a0,title:"Game",kind:"game",workspaceRole:"authored-subject",Content:n?.Content??stn,...n?.Toolbar?{Toolbar:n.Toolbar}:{},closeable:!1,presentation:()=>({kind:"workspace",id:a0})}}function atn(){const t={session:!0};return BZ=t,()=>{BZ===t&&(Zze(),BZ=null)}}function ctn(t){if(ume=t,iq()){const n=xFt();n&&ND(n,{activate:!1})}return()=>{ume===t&&(ume=null)}}function HQ(){return Yze&&iq()}function iq(){return l0().some(t=>t.descriptor.id===a0)}function iSn(){return iq()?(N3t(),X0(a0)):!1}function ltn(){return Oge}function utn(t){Oge=t,WQ=!0;for(const n of[...Rge])n();Rge.clear()}function ftn(t){Oge===t&&(Oge=null,WQ=!1)}async function dtn(t=otn){const n=xFt();return n?(N3t(),Yze=!0,iq()?X0(n.id):(fme=e_(),ND(n)),WQ?!0:new Promise(s=>{const c=()=>{clearTimeout(d),s(!0)},d=setTimeout(()=>{Rge.delete(c),s(WQ)},t);Rge.add(c)})):!1}function Zze(){if(Yze=!1,!BZ||!iq()){fme=null;return}const t=fme;fme=null,WQ=!1,EN(a0,{discardDirty:!0}),t&&X0(t)}function ptn(t){oxt&&!t&&Zze(),oxt=t}let vC=[];const MMe=new Set,GQ=new Map;let Qze=!1,eVe=!1,jMe=!1;function wFt(t,n=!0){GQ.set(t,n),Fge()}const tVe=()=>{for(const t of MMe)t()},Q0e=()=>vC;function _tn(t){return MMe.add(t),()=>{MMe.delete(t)}}function SN(t,n=!0){const s=vC.find(c=>c.descriptor.id===t);return s?(ND({...s.descriptor,closeable:!0,persist:()=>({availableDocumentId:t})},{activate:n}),!0):!1}function Fge(){for(const[t,n]of GQ)SN(t,n&&!HQ())&&GQ.delete(t);if(Qze&&!eVe&&!jMe){const t=vC.find(n=>n.default);t&&(jMe=!0,SN(t.descriptor.id,!HQ()))}}function oSn(t,n){const s=vC.find(d=>d.descriptor.id===t.id);if(s?.descriptor.Content===t.Content&&s?.descriptor.title===t.title&&s.descriptor.provenance?.sourcePath===t.provenance?.sourcePath&&s.descriptor.provenance?.rootId===t.provenance?.rootId&&s.descriptor.Toolbar===t.Toolbar&&s.descriptor.Shelf===t.Shelf&&s.descriptor.preview===t.preview&&s.default===(n.default??!1)&&s.category===n.category&&s.rootId===n.rootId)return t.id;const c={descriptor:t,category:n.category,default:n.default??!1,rootId:n.rootId};return vC=s?vC.map(d=>d.descriptor.id===t.id?c:d):[...vC,c],tVe(),Fge(),t.id}function sSn(t){vC.some(n=>n.descriptor.id===t)&&(vC=vC.filter(n=>n.descriptor.id!==t),EN(t,{discardDirty:!0}),tVe())}for(const t of fTr)wee({kind:t,owner:"workspace-available-documents",restore:({state:n,active:s})=>{const c=n?.availableDocumentId;return typeof c!="string"?!1:(GQ.set(c,s),Fge(),!0)},beginRestore:({hasDocumentsToRestore:n})=>{Qze=!0,eVe=n,Fge()}});function mtn(){vC=[],GQ.clear(),Qze=!1,eVe=!1,jMe=!1,tVe()}const dme=new Map;function aSn(t,n){return dme.set(t,n),()=>{dme.get(t)===n&&dme.delete(t)}}function rVe(t){return dme.get(t)??Q0e().find(n=>n.rootId===t)?.descriptor.id??null}function LMe(t){const n=rVe(t);return n?SN(n)||X0(n):!1}const pme=new Map;function cSn(t,n){return pme.set(t,n),()=>{pme.get(t)===n&&pme.delete(t)}}function sxt(t){return pme.get(t)?.()??null}const BMe=new Set;function lSn(t){return BMe.add(t),()=>{BMe.delete(t)}}function axt(t){for(const n of BMe){const s=n(t);if(s!==null)return s}return null}const $Me="document:";function nVe(t){return`${$Me}${t}`}function htn(t){return t.startsWith($Me)?t.slice($Me.length):null}const KQ=new Map;function gtn(t){return KQ.get(t)?.entry}function ytn(t){return{id:t.id,kind:t.kind,label:t.label,...t.source?{source:{path:t.source.path,...t.source.export?{export:t.source.export}:{}}}:{}}}function TFt(t){const n=t.source?.path;if(!n)return"source";const s=ig(n).kind;return s==="model"||s==="image"||s==="video"||s==="audio"||s==="json"?s:"source"}function qMe(t){return PN(t)!==void 0}function ID(t,n={}){const s=PN(t.kind);if(!s)return!1;const c=nVe(t.id);return KQ.set(c,{entry:t,props:ytn(t)}),ND({id:c,title:t.label,kind:"document",workspaceRole:"authored-subject",provenance:{...t.source?{sourcePath:t.source.path}:{},origin:s.file},Content:ktn,...s.Toolbar?{Toolbar:Ctn}:{},...s.Shelf?{Shelf:Etn}:{},presentation:()=>({kind:"document",id:t.id}),persist:()=>({entryId:t.id}),onDispose:d=>{KQ.delete(d)}},n),!0}kN({id:"document",owner:"kind-documents",open:(t,n)=>{const s=nOe(n.id);return!s||!qMe(s.kind)?null:ID(s)?nVe(s.id):null},settle:async t=>{await EC(()=>nOe(t.id)!==void 0,2e4);const s=nOe(t.id);if(!s)throw new Error(`The project's document table lists no document: ${t.id}`);if(!await EC(()=>qMe(s.kind),2e4))throw new Error(`No editor is registered for documents of kind '${s.kind}' (${t.id})`)},ready:async t=>{await m4t(t),await SBe(t)}});function nOe(t){return u0()?.scenes.entries.find(n=>n.id===t)}function CFt(t,n={}){if(ID(t,n))return;const s=l2(()=>{ID(t,n)&&s()})}function vtn(t){const n=htn(t);if(n===null)return!1;const s=()=>{const c=u0()?.scenes.entries.find(d=>d.id===n);return c?(CFt(c,{activate:!1}),!0):!1};if(!s()){const c=OC(()=>{s()&&c()})}return!0}function btn(){return l2(()=>{const t=new Set(l0().map(n=>n.descriptor.id));for(const[n,{entry:s}]of KQ)t.has(n)&&PN(s.kind)&&ID(s,{activate:!1})})}function Stn(t,n){const s=of(),c=()=>{if(of()!==s)return!0;const m=u0();if(!m)return!1;const g=m.scenes.entries.find(S=>S.id===t);return g?(n(g),!0):!1};if(c())return;const d=OC(()=>{c()&&d()})}function xtn(t){const n=t.entries.filter(c=>c.kind!=="scene"&&c.kind!=="prefab"&&(c.source!==void 0||PN(c.kind)!==void 0)),s=n.find(c=>c.id===t.default);return s||(n[0]??null)}let cxt=null,Mge=null;function wtn(t){cxt?.();let n=t?new Set(t):null;const s=()=>{const c=u0();if(!c||c.documentsPending)return;const d=new Set(c.scenes.entries.map(g=>g.id));if(n===null){n=d,Mge=d;return}const m=[...c.scenes.entries].reverse().find(g=>!n?.has(g.id)&&g.kind!=="scene"&&g.kind!=="prefab"&&g.source&&qMe(g.kind));n=d,Mge=d,m?.source&&ID(m,{activate:!0,preview:!0})&&BI({path:`/${m.source.path}`,name:m.label,kind:"source",capabilities:ig(m.source.path),origin:"project",health:"healthy",selectionCount:1})};s(),cxt=OC(s)}function Ttn(t){const n=of(),s=()=>{if(of()!==n)return!0;const d=u0();return!d||d.documentsPending||d.error!==null?!1:(d.scenes.entries.some(m=>t.includes(m.id))||EFt(),!0)};if(s())return;const c=OC(()=>{s()&&c()})}function EFt(){const t=of(),n=()=>{if(of()!==t)return!0;const c=u0();if(!c||c.documentsPending)return!1;if(l0().some(m=>!m.descriptor.area))return!0;const d=xtn(c.scenes);if(!d)return!c.scenes.entries.some(m=>m.kind!=="scene"&&m.kind!=="prefab");if(!d.source)return ID(d),!0;{const m=`/${d.source.path}`;ID(d)||sN(m,TFt(d)),BI({path:m,name:d.label,kind:"source",capabilities:ig(d.source.path),origin:"project",health:"healthy",selectionCount:1})}return!0};if(n())return;const s=OC(()=>{n()&&s()})}wee({kind:"document",owner:"kind-documents",restore:({state:t,active:n})=>{const s=t,c=typeof s?.entryId=="string"?s.entryId:null;return c?(Stn(c,d=>{CFt(d,{activate:n})}),!0):!1},persistKindState:()=>Mge?{seen:[...Mge]}:void 0,beginRestore:({state:t,hasDocumentsToRestore:n,documentsToRestore:s})=>{const c=t,d=Array.isArray(c?.seen)?c.seen.filter(m=>typeof m=="string"):void 0;if(!n)EFt();else{const m=s.map(g=>g.kind==="document"?g.state?.entryId:void 0);m.every(g=>typeof g=="string")&&Ttn(m)}wtn(d)}});function iVe(t){Ye.useSyncExternalStore(l2,rA);const n=KQ.get(t)?.props;return{entry:n,contribution:n?PN(n.kind):void 0}}function Ctn({documentId:t,active:n}){const{entry:s,contribution:c}=iVe(t);return!s||!c?.Toolbar?null:$.jsx(IR,{contribution:c,Component:c.Toolbar,documentId:t,active:n,document:s},`${c.id}:${c.version}:toolbar:${t}`)}function Etn({documentId:t,active:n}){const{entry:s,contribution:c}=iVe(t);return!s||!c?.Shelf?null:$.jsx(IR,{contribution:c,Component:c.Shelf,documentId:t,active:n,document:s},`${c.id}:${c.version}:shelf:${t}`)}function ktn({documentId:t,active:n}){const{entry:s,contribution:c}=iVe(t);return!s||!c?$.jsx("div",{style:{padding:12,fontSize:12,color:Go.content.muted,pointerEvents:"auto"},children:"No editor is registered for this document's kind — close this document."}):$.jsx(IR,{contribution:c,documentId:t,active:n,document:s},`${c.id}:${c.version}:${t}`)}function Atn(t){if(t)for(const n of Xze(t)){if(n.plan.kind!=="root-document")continue;const s=rVe(n.plan.regionId);s&&R3t(s,n.plan.title)}}function Dtn(){const t=()=>Atn(u0()?.scenes??null);return t(),OC(t)}const Ptn=15e3;async function Itn(t){const n=()=>u0()?.scenes.entries.some(s=>s.id===t)??!1;return n()||await new Promise(s=>{let c=!1;const d=()=>{c||(c=!0,clearTimeout(m),g(),s())},m=setTimeout(d,Ptn),g=OC(()=>{n()&&d()});n()&&d()}),kFt(t)}function kFt(t){const n=u0();if(!n)return{ok:!1,code:"SCENE_TABLE_UNAVAILABLE",error:"open: the project adapter has not loaded yet, so there is no scene table to open."};const s=n.scenes.entries.find(d=>d.id===t);if(!s){const d=n.scenes.entries.map(m=>m.id);return{ok:!1,code:"SCENE_NOT_FOUND",error:`open: "${t}" is not in the adapter's scene table. Known ids: ${d.length>0?d.join(", "):"(the table is empty)"}.`,known:d}}if(s.kind!=="scene"&&s.kind!=="prefab"&&ID(s,{activate:!0}))return{ok:!0,documentId:nVe(s.id),title:s.label};const c=Kze(s);switch(c.kind){case"no-document":return c.liveReach!==void 0?{ok:!1,code:"SCENE_NAVIGATION_NOT_RUNNING",error:`open: ${c.reason} No game is running in this session.`}:{ok:!1,code:"SCENE_NOT_OPENABLE",error:`open: "${t}" has no Edit document — ${c.reason}`};case"root-document":{const d=rVe(c.regionId);return d?(SN(d)||X0(d),{ok:!0,documentId:d,title:c.title}):{ok:!1,code:"SCENE_DOCUMENT_NOT_MOUNTED",error:`open: "${t}" is region "${c.regionId}"'s own document, and no document is mounted for that region in this session.`}}case"isolation-document":{const d=CD("scene",Ih()??{},{entry:s,activate:!0});return d?{ok:!0,documentId:d,title:c.title}:{ok:!1,code:"SCENE_NOT_OPENABLE",error:`No installed scene editor can open "${t}".`}}case"story-document":{const d=CD("story",Ih()??{},{storyId:c.storyId,title:c.title});return d===null?{ok:!1,code:"SCENE_DOCUMENT_NOT_MOUNTED",error:`open: "${t}" is reached by story "${c.storyId}", and nothing in this editor opened it — either this project's story registry does not hold that id, or its module declares no medium (declare it via \`volter.adapter.ts\` regionIncludes or a manifest root entry). The session console names which.`}:{ok:!0,documentId:d,title:c.title}}}}let dZ=[];function uSn(t){return dZ=[...dZ,t],()=>{dZ=dZ.filter(n=>n!==t)}}async function Ntn(t){for(const n of dZ){const s=await n(t);if(s)return s}return null}let $Z=null;function fSn(t){return $Z=t,()=>{$Z===t&&($Z=null)}}async function dSn(t){return $Z?$Z.observe(t):{result:await t(),settled:async()=>{},frame:async()=>null}}let pZ=[];function pSn(t){return pZ=[...pZ,t],()=>{pZ=pZ.filter(n=>n!==t)}}async function Otn(t,n){for(const s of pZ){const c=s(t,n);if(c!==null)return c}return null}const XQ="data-volter-game-styles",Rtn=`[${XQ}]`;function Ftn(t){t.setAttribute(XQ,"")}const _Sn=Object.freeze(Object.defineProperty({__proto__:null,GAME_CSS_SCOPE_ATTRIBUTE:XQ,GAME_CSS_SCOPE_SELECTOR:Rtn,markGameCssScope:Ftn},Symbol.toStringTag,{value:"Module"})),AFt={installed:!1,sources:[],note:null},lxt="data-volter-scoped-game-css";let iOe=null,DFt=AFt,PFt=null;function IFt(){return PFt}function Mtn(){return typeof globalThis.CSSScopeRule=="function"}async function jtn(t){if(iOe?.projectRoot===t)return iOe.state;const n=Btn(t);return iOe={projectRoot:t,state:n},n}function Ltn(){return DFt}async function Btn(t){const n=await $tn(t);return DFt=n,n}async function $tn(t){let n;try{const m=await fetch("/__editor/scoped-game-css");n=await L_(m,"Could not read the project scoped game CSS")}catch{return AFt}const s=typeof n.css=="string"?n.css:"",c=Array.isArray(n.sources)?n.sources:[],d=typeof n.note=="string"?n.note:null;if(s.length===0)return{installed:!1,sources:c,note:d};if(!Mtn()){const m="unstyled — this browser has no CSS `@scope`, so the game stylesheet cannot be contained to the game. Loading it anyway would restyle the editor.";return ea.warn(`[scoped-game-css] ${m}`,"authoring"),{installed:!1,sources:c,note:m}}return qtn(t,s),{installed:!0,sources:c,note:d}}function qtn(t,n){const s=document.head.querySelector(`style[${lxt}]`),c=s instanceof HTMLStyleElement?s:document.createElement("style");c.setAttribute(lxt,t),c.textContent=n,c.isConnected||document.head.appendChild(c),PFt=n}const mSn=Object.freeze(Object.defineProperty({__proto__:null,ensureScopedGameStyles:jtn,scopedGameStylesCssText:IFt,scopedGameStylesState:Ltn},Symbol.toStringTag,{value:"Module"})),ztn='[data-volter-root-surface="true"]';function eve(t){return t.matches(ztn)||t.closest('[data-volter-canvas-scene="true"]')!==null}function Vtn(){return{imgs:new WeakMap}}const NFt=500,OFt=100,RFt=8;function Utn(t=NFt,n=OFt){let s=null,c=null,d=!1,m=null;const g=S=>{c?.disconnect(),s=S,m=null,d=!1,c=typeof MutationObserver>"u"?null:new MutationObserver(()=>{d=!0}),c?.observe(S,{subtree:!0,childList:!0,attributes:!0,characterData:!0})};return{take(S,k,A){if(s!==S)return g(S),null;c&&c.takeRecords().length>0&&(d=!0);const F=performance.now();return m&&m.width===k&&m.height===A&&(!d&&F-m.builtAt<=t||d&&F<m.notBefore)?m:(m=null,d=!1,null)},store(S,k,A,F,D){if(s!==S)return;const J=performance.now();m={...F,width:k,height:A,builtAt:J,notBefore:J+Math.max(n,RFt*D)}},dispose(){c?.disconnect(),c=null,s=null,m=null}}}function oOe(t,n){try{const s=t.createElement("canvas"),c=n,d=n instanceof HTMLVideoElement?n:null;s.width=Math.max(1,Math.round(Number(d?.videoWidth||c.naturalWidth||n.width)||0)),s.height=Math.max(1,Math.round(Number(d?.videoHeight||c.naturalHeight||n.height)||0));const m=s.getContext("2d");return m?(m.drawImage(n,0,0),s.toDataURL("image/png")):null}catch{return null}}function FFt(t,n){const s=new Set,c=d=>{if(s.has(d))return"";s.add(d);try{return Array.from(d.cssRules).map(m=>{const g=m.styleSheet;return g?c(g):m.type===CSSRule.FONT_FACE_RULE?m.cssText.replace(/url\((['"]?)(.*?)\1\)/g,(S,k,A)=>`url("${new URL(A,d.href??t.baseURI).href}")`):m.cssText}).join(`
1395
1395
  `)}catch{return""}};return Array.from(n,c).filter(Boolean).join(`
1396
1396
  `)}function MFt(t){return FFt(t,Array.from(t.styleSheets))}function Jtn(t,n){const s=n?.replace(/\\/g,"/").replace(/\/$/,""),c=Array.from(t.styleSheets).filter(d=>{const m=d.ownerNode,g=m instanceof Element?m.getAttribute("data-vite-dev-id"):null;if(!g)return!1;const S=(g.split("?")[0]??g).replace(/\\/g,"/");return S.includes("/node_modules/")?!1:s?S.startsWith(`${s}/`):!0});return c.length===0?"":FFt(t,c)}async function Wtn(t){await t.fonts.ready;let n=MFt(t);const s=new Set;for(const c of n.matchAll(/@font-face\s*\{[^}]*\}/g))for(const d of c[0].matchAll(/url\("([^"]+)"\)/g))d[1].startsWith("data:")||s.add(d[1]);return await Promise.all(Array.from(s,async c=>{const d=await fetch(c,{signal:AbortSignal.timeout(1e4)});if(!d.ok)throw new Error(`Capture font could not be loaded (${d.status}): ${c}`);const m=await d.blob(),g=await new Promise((S,k)=>{const A=new FileReader;A.onload=()=>S(String(A.result)),A.onerror=()=>k(A.error),A.readAsDataURL(m)});n=n.replaceAll(`url("${c}")`,`url("${g}")`)})),n}function Htn(t,n){const s=t.ownerDocument.defaultView?.getComputedStyle(t);if(s){for(const c of Array.from(s)){if(!c.startsWith("--"))continue;const d=s.getPropertyValue(c);d&&n.style.setProperty(c,d)}for(const c of["color","color-scheme","font-family","font-size","font-weight","line-height","text-shadow"]){const d=s.getPropertyValue(c);d&&n.style.setProperty(c,d)}}}function oVe(t){const s=t.ownerDocument.defaultView?.getComputedStyle(t)?.backgroundColor;if(!s||s==="transparent")return null;const c=/^rgba?\([^)]*,\s*([\d.]+)\s*\)$/.exec(s)?.[1];return c!==void 0&&Number(c)===0?null:s}function jFt(t){const n=[],s=new Set;for(const c of Array.from(t.querySelectorAll("canvas"))){if(!eve(c))continue;const d=[];for(let m=c.parentElement;m&&(m===t||t.contains(m))&&(d.unshift(m),m!==t);m=m.parentElement);for(const m of[...d,...Gtn(t,c)])s.has(m)||(s.add(m),n.push(m))}return n}function Gtn(t,n){const s=t.ownerDocument,c=n.getBoundingClientRect();if(c.width<=0||c.height<=0||typeof s.elementsFromPoint!="function")return[];const d=new Set,m=[[c.left+c.width/2,c.top+c.height/2],[c.left+c.width*.1,c.top+c.height*.1],[c.left+c.width*.9,c.top+c.height*.1],[c.left+c.width*.1,c.top+c.height*.9],[c.left+c.width*.9,c.top+c.height*.9]];for(const[g,S]of m){const k=s.elementsFromPoint(g,S),A=k.indexOf(n);if(!(A<0))for(const F of k.slice(A+1))Ktn(F,t)&&d.add(F)}return Array.from(d).reverse()}function Ktn(t,n){return t instanceof HTMLElement&&(t===n||n.contains(t))&&oVe(t)!==null}function LFt(t){const n=[];for(let s=t.parentElement;s;s=s.parentElement)n.unshift(s);return n}function Xtn(t,n){const s="select, input, textarea",c=g=>[...g.matches(s)?[g]:[],...Array.from(g.querySelectorAll(s))],d=c(t),m=c(n);d.forEach((g,S)=>{const k=m[S];if(k){if(g instanceof HTMLSelectElement&&k instanceof HTMLSelectElement){const A=Array.from(g.options);Array.from(k.options).forEach((F,D)=>{A[D]?.selected?F.setAttribute("selected",""):F.removeAttribute("selected")});return}if(g instanceof HTMLInputElement&&k instanceof HTMLInputElement){g.type==="checkbox"||g.type==="radio"?g.checked?k.setAttribute("checked",""):k.removeAttribute("checked"):k.setAttribute("value",g.value);return}g instanceof HTMLTextAreaElement&&k instanceof HTMLTextAreaElement&&(k.textContent=g.value)}})}function Ytn(t,n){const s=[t,...Array.from(t.querySelectorAll("*"))],c=[n,...Array.from(n.querySelectorAll("*"))];s.forEach((d,m)=>{const g=d.scrollTop,S=d.scrollLeft;if(g===0&&S===0)return;const k=c[m];if(!(k instanceof HTMLElement))return;const A=k.firstElementChild;if(!(A instanceof HTMLElement))return;k.style.overflow="hidden";const F=getComputedStyle(d.firstElementChild??d),D=Number.parseFloat(F.marginTop)||0,J=Number.parseFloat(F.marginLeft)||0;g!==0&&(A.style.marginTop=`${D-g}px`),S!==0&&(A.style.marginLeft=`${J-S}px`)})}function Ztn(t,n,s){if(!s?.size)return;const c=[t,...Array.from(t.querySelectorAll("*"))],d=[n,...Array.from(n.querySelectorAll("*"))];c.forEach((m,g)=>{if(!s.has(m))return;const S=d[g];S instanceof HTMLElement&&(S.style.background="transparent")})}function BFt(t,n,s,c){const d=Array.from(t.children).filter(se=>se.tagName.toLowerCase()!=="canvas");if(d.length===0)return null;const m=c?.includeDocumentStyles===!0,g=m?t.cloneNode(!1):t.ownerDocument.createElement("div");g.style.position="relative",g.style.inset="auto",g.style.width=`${n}px`,g.style.height=`${s}px`,g.style.margin="0",g.style.transform="none",m?Htn(t,g):g.style.background="transparent";const S=c?.transparentBackdrops;if(S?.has(t)&&(g.style.background="transparent"),t.closest(`[${XQ}]`)&&g.setAttribute(XQ,""),m){const se=c?.documentCssText??MFt(t.ownerDocument);if(se){const pe=t.ownerDocument.createElement("style");pe.textContent=se,g.appendChild(pe)}}const k=t.ownerDocument.createElement("style");k.textContent="*,*::before,*::after{animation:none!important;transition:none!important;caret-color:transparent!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;}",g.appendChild(k);const A=IFt();if(A){const se=t.ownerDocument.createElement("style");se.textContent=A,g.appendChild(se)}if(!m){const se=Jtn(t.ownerDocument,c?.projectRoot);if(se){const pe=t.ownerDocument.createElement("style");pe.textContent=se,g.appendChild(pe)}}for(const se of d){const pe=se.cloneNode(!0);Ztn(se,pe,S),Xtn(se,pe),Ytn(se,pe);const ue=[...se instanceof HTMLImageElement?[se]:[],...Array.from(se.querySelectorAll("img"))];[...pe instanceof HTMLImageElement?[pe]:[],...Array.from(pe.querySelectorAll("img"))].forEach((X,we)=>{const Be=ue[we];if(!Be?.complete||Be.naturalWidth<=0||Be.naturalHeight<=0)return;const bt=Be.currentSrc||Be.src,It=c?.snapshots?.imgs.get(Be),Wt=It&&It.src===bt?It.url:oOe(t.ownerDocument,Be);(!It||It.src!==bt)&&c?.snapshots?.imgs.set(Be,{src:bt,url:Wt}),Wt&&X.setAttribute("src",Wt)});const Fe=[...se instanceof HTMLVideoElement?[se]:[],...Array.from(se.querySelectorAll("video"))];[...pe instanceof HTMLVideoElement?[pe]:[],...Array.from(pe.querySelectorAll("video"))].forEach((X,we)=>{const Be=Fe[we];if(!Be||Be.readyState<2||Be.videoWidth<=0)return;const bt=oOe(t.ownerDocument,Be);if(!bt)return;const It=t.ownerDocument.createElement("img");It.setAttribute("src",bt),It.setAttribute("style",X.getAttribute("style")??""),X.replaceWith(It)});const be=Array.from(se.querySelectorAll("canvas"));Array.from(pe.querySelectorAll("canvas")).forEach((X,we)=>{const Be=be[we];if(Be&&eve(Be)){X.remove();return}const bt=Be?c?.canvasPixels?.get(Be):void 0,It=bt?oOe(t.ownerDocument,bt):null;if(!It){X.remove();return}const Wt=t.ownerDocument.createElement("img");Wt.setAttribute("src",It),Wt.setAttribute("style",`${X.getAttribute("style")??""}`);for(const zt of Array.from(X.attributes))Wt.setAttribute(zt.name,zt.value);X.replaceWith(Wt)}),g.appendChild(pe)}const F=new XMLSerializer().serializeToString(g),D=c?.rasterSize?.width??n,J=c?.rasterSize?.height??s,q=D===n&&J===s?"":` viewBox="0 0 ${n} ${s}"`;return{svg:`<svg xmlns="http://www.w3.org/2000/svg" width="${D}" height="${J}"${q}><foreignObject width="100%" height="100%">${F}</foreignObject></svg>`,overlayCount:d.length}}const Qtn={canvas:"canvas layer","dom-overlay":"DOM overlay layer","composite-output":"composite output"};class HI extends Error{layer;constructor(n,s){const c=typeof s=="object"&&s!==null&&"message"in s&&typeof s.message=="string"?s.message:String(s);super(`${Qtn[n]} capture failed — ${c}`),this.name="CaptureLayerError",this.layer=n}}function jge(t,n){return n instanceof HI?n:new HI(t,n)}const X4=32,ern=24,sVe=.9;function $Ft(t,n){return[t[n*4]??0,t[n*4+1]??0,t[n*4+2]??0]}function trn(t,n){const s=new Map;for(let m=0;m<n;m++){const[g,S,k]=$Ft(t,m),A=g>>5<<10|S>>5<<5|k>>5,F=s.get(A)??{n:0,r:0,g:0,b:0};F.n+=1,F.r+=g,F.g+=S,F.b+=k,s.set(A,F)}let c={n:1,r:0,g:0,b:0},d=0;for(const m of s.values())m.n/n>=.01&&(d+=1),m.n>c.n&&(c=m);return{mean:[Math.round(c.r/c.n),Math.round(c.g/c.n),Math.round(c.b/c.n)],distinctRegions:d}}function rrn(t,n,s){let c=0;for(let d=0;d<n;d++){const m=$Ft(t,d);Math.max(Math.abs(m[0]-s[0]),Math.abs(m[1]-s[1]),Math.abs(m[2]-s[2]))<=ern&&(c+=1)}return c}function qFt(t,n,s=sVe){const{mean:c,distinctRegions:d}=trn(t,n),m=Math.round(rrn(t,n,c)/n*1e3)/1e3,g=`#${c.map(A=>A.toString(16).padStart(2,"0")).join("")}`,S=m>=s,k=`this capture is ~${Math.round(m*100)}% one flat surface (${g}) — likely a wall, an empty view, or a buried camera; it is weak evidence.`;return{dominantFraction:m,dominantColor:g,distinctRegions:d,degenerate:S,...S?{warning:k}:{}}}function zMe(t,n,s=sVe){try{const c=n.createElement("canvas");c.width=X4,c.height=X4;const d=c.getContext("2d");if(!d)return null;d.drawImage(t,0,0,X4,X4);const m=d.getImageData(0,0,X4,X4);return qFt(m.data,X4*X4,s)}catch{return null}}async function zFt(t,n=350){if(typeof t.getAnimations!="function")return;const s=t.getAnimations({subtree:!0}).filter(c=>{const d=c.effect?.getComputedTiming().endTime;return typeof d=="number"&&Number.isFinite(d)});s.length!==0&&await Promise.race([Promise.allSettled(s.map(c=>c.finished)),new Promise(c=>setTimeout(c,n))])}async function YQ(t,n=75){const s=t.ownerDocument.defaultView?.requestAnimationFrame.bind(t.ownerDocument.defaultView);s&&await new Promise(c=>{let d=!1;const m=()=>{d||(d=!0,clearTimeout(g),c())},g=setTimeout(m,n);s(()=>s(m))})}async function VFt(t,n){return await YQ(t),(n?.presentsOnCanvas??t.querySelectorAll("canvas").length>0)||await new Promise(c=>setTimeout(c,650)),await zFt(t),await YQ(t),VMe(t,2,n??{})}const UFt=.03;function JFt(t,n){if(n<=0)return 0;let s=0;for(let c=3;c<t.length;c+=4)t[c]===0&&(s+=1);return s/n}function WFt(t,n,s=.08){if(n<=0)return!1;let c=0;for(let d=0;d<t.length;d+=4)t[d]<=8&&t[d+1]<=8&&t[d+2]<=8&&t[d+3]>=250&&(c+=1);return c/n>s}function nrn(t,n,s,c){let d;try{d=t.getImageData(0,0,n,s)}catch{return{kind:"ok"}}const m=n*s,g=JFt(d.data,m),S=g>UFt;return c>0&&(S||WFt(d.data,m))?{kind:"retry"}:S?{kind:"blank",transparentFraction:g}:{kind:"ok"}}function irn(t,n,s){let c;try{c=t.getImageData(0,0,n,s)}catch{return{left:0,top:0,right:n,bottom:s}}let d=n,m=s,g=-1,S=-1;const k=c.data;for(let A=0;A<s;A+=1){const F=A*n*4;for(let D=0;D<n;D+=1)k[F+D*4+3]!==0&&(D<d&&(d=D),D>g&&(g=D),A<m&&(m=A),A>S&&(S=A))}return g<0?null:{left:d,top:m,right:g+1,bottom:S+1}}async function VMe(t,n,s){const c=t.ownerDocument.createElement("canvas"),d=await HFt(t,c,s),m=c.width,g=c.height,S=c.getContext("2d");if(!S)throw new HI("composite-output","no 2d canvas context");if(d.canvases===0&&d.domOverlays>0&&s?.cropToContent===!0){const D=irn(S,m,g);if(D===null){if(s.allowTransparent)return{base64:c.toDataURL("image/png").split(",")[1],mimeType:"image/png",layers:d};if(n>0)return await new Promise(we=>setTimeout(we,300)),await YQ(t),VMe(t,n-1,s);throw new HI("dom-overlay","the composite is ~100% fully transparent after two repaints — nothing in it painted a backdrop, so the PNG would read as a flat black frame. This subject's background is painted by an element OUTSIDE what is being photographed (a detached clone carries no ancestors), or its own DOM never mounted.")}const J=16,q=Math.max(0,D.left-J),G=Math.max(0,D.top-J),se=Math.min(m,D.right+J),pe=Math.min(g,D.bottom+J),ue=t.ownerDocument.createElement("canvas");ue.width=Math.max(1,se-q),ue.height=Math.max(1,pe-G);const Ce=ue.getContext("2d");if(!Ce)throw new HI("composite-output","no 2d canvas context");const Fe=getComputedStyle(t).backgroundColor;Fe&&Fe!=="transparent"&&Fe!=="rgba(0, 0, 0, 0)"&&(Ce.fillStyle=Fe,Ce.fillRect(0,0,ue.width,ue.height)),Ce.drawImage(c,q,G,ue.width,ue.height,0,0,ue.width,ue.height);const De=zMe(ue,t.ownerDocument);let be;try{be=ue.toDataURL("image/png")}catch(we){throw jge("composite-output",we)}const X=be.indexOf(",");return{base64:X>=0?be.slice(X+1):be,mimeType:"image/png",layers:d,...De?{flatness:De}:{}}}if(d.canvases===0&&d.domOverlays>0&&!s.allowTransparent){const D=nrn(S,m,g,n);if(D.kind==="retry")return await new Promise(J=>setTimeout(J,300)),await YQ(t),VMe(t,n-1,s);if(D.kind==="blank")throw new HI("dom-overlay",`the composite is ~${Math.round(D.transparentFraction*100)}% fully transparent after two repaints — nothing in it painted a backdrop, so the PNG would read as a flat black frame. This subject's background is painted by an element OUTSIDE what is being photographed (a detached clone carries no ancestors), or its own DOM never mounted.`)}const k=zMe(c,t.ownerDocument);let A;try{A=c.toDataURL("image/png")}catch(D){throw jge("composite-output",D)}const F=A.indexOf(",");return{base64:F>=0?A.slice(F+1):A,mimeType:"image/png",layers:d,...k?{flatness:k}:{}}}function uxt(t,n,s,c=1,d=1){for(const m of n){const g=oVe(m);if(!g)continue;const S=m.getBoundingClientRect();t.fillStyle=g,t.fillRect((S.left-s.left)*c,(S.top-s.top)*d,S.width*c,S.height*d)}}async function HFt(t,n,s){const c=t.getBoundingClientRect(),d=Math.max(1,Math.round(s?.size?.width??c.width)),m=Math.max(1,Math.round(s?.size?.height??c.height)),g=s?.size?d/c.width:1,S=s?.size?m/c.height:1;n.width!==d&&(n.width=d),n.height!==m&&(n.height=m);const k=n.getContext("2d");if(!k)throw new HI("composite-output","no 2d canvas context");if(k.clearRect(0,0,d,m),s?.cropToContent!==!0){const se=getComputedStyle(t).backgroundColor;se&&se!=="transparent"&&se!=="rgba(0, 0, 0, 0)"&&(k.fillStyle=se,k.fillRect(0,0,d,m))}s?.includeDocumentStyles&&uxt(k,LFt(t),c,g,S);const F=Array.from(t.querySelectorAll("canvas")).some(se=>!eve(se))?null:s?.overlayCache?.take(t,d,m),D=F?.backdrops??jFt(t);uxt(k,D,c,g,S);const J=Array.from(t.querySelectorAll("canvas")).filter(se=>{const pe=se.getBoundingClientRect();return se.width>0&&se.height>0&&pe.width>0&&pe.height>0}),q=new Map;for(const se of J)try{const pe=se.getBoundingClientRect(),ue=await s?.canvasFrame?.(se)??se;q.set(se,ue),k.drawImage(ue,(pe.left-c.left)*g,(pe.top-c.top)*S,pe.width*g,pe.height*S)}catch(pe){throw jge("canvas",pe)}let G=0;try{if(F)F.image&&k.drawImage(F.image,0,0,d,m),G=F.overlayCount;else{const se=performance.now(),pe=BFt(t,d/g,m/S,{includeDocumentStyles:s?.includeDocumentStyles,projectRoot:s?.projectRoot,documentCssText:s?.includeDocumentStyles?await Wtn(t.ownerDocument):void 0,canvasPixels:q,transparentBackdrops:new Set(D),snapshots:s?.snapshots,rasterSize:{width:d,height:m}});if(pe){const ue=new Image;ue.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(pe.svg)}`,await ue.decode(),k.drawImage(ue,0,0,d,m),G=pe.overlayCount,s?.overlayCache?.store(t,d,m,{image:ue,overlayCount:pe.overlayCount,backdrops:D},performance.now()-se)}else s?.overlayCache?.store(t,d,m,{image:null,overlayCount:0,backdrops:D},performance.now()-se)}}catch(se){throw jge("dom-overlay",se)}return{canvases:J.length,domOverlays:G}}const orn=Object.freeze(Object.defineProperty({__proto__:null,CaptureLayerError:HI,FLATNESS_GRID:X4,FLATNESS_WARN_AT:sVe,OVERLAY_CACHE_MAX_AGE_MS:NFt,OVERLAY_REBUILD_COST_MULTIPLIER:RFt,OVERLAY_REBUILD_FLOOR_MS:OFt,TRANSPARENT_PIXEL_LIMIT:UFt,ancestorBackdrops:LFt,buildOverlaySvg:BFt,capturePlayComposite:VFt,createImageSnapshotCache:Vtn,createOverlayFrameCache:Utn,drawPlayCompositeFrame:HFt,hasExcessNearBlackPixels:WFt,isRootCanvas:eve,measureFlatness:qFt,opaqueBackgroundColor:oVe,rootSurfaceBackdrops:jFt,sampleFlatness:zMe,transparentPixelFraction:JFt,waitForFiniteMotion:zFt,waitForPaint:YQ},Symbol.toStringTag,{value:"Module"}));function ote(t){const n=CC(),s=n?.descriptor.presentation?.()??void 0,c=o2(n?.descriptor.id),d=Oye(),m=c?.selection?c.selection.read():d?.adapter?.selection?.get()??(c?[...t.selectedEntityIds]:[]),g=c?.read()??void 0,S=eDt();return{version:1,workspace:zS(),...Ahe()===null?{}:{style:Ahe()},keymap:dR(),...s?{document:s}:{},...m.length>0?{selection:{ids:[...m]}}:{},...g?{viewport:g}:{},...S?{panel:S}:{}}}function srn(t){return tCt(ote(t),window.location.href)}let $I=[],arn=0,GFt=0;const UMe=new Set;function JMe(){GFt++;for(const t of UMe)t()}function KFt(){JMe()}function WMe(){return Y1()}function aVe(){let t=null;for(const{session:n}of $I){const s=n.startedAt?.()??null;s!==null&&(!t||s>t.startedAt)&&(t={startedAt:s,endedAt:n.endedAt?.()??null})}return t}function XFt(){for(const{session:t}of $I){const n=t.restartRequired?.()??null;if(n!==null)return n}return null}function YFt(){(Y1().find(s=>(s.restartRequired?.()??null)!==null)??Y1().find(s=>s.mounted()&&s.restart))?.restart?.()}function cVe(){for(const t of Y1()){if(!t.mounted())continue;const n=t.frameCanvas?.()??null;if(n)return n}return null}function lVe(t){for(const n of Y1())if(!(!n.mounted()||!n.snapshotFrame)&&n.frameCanvas?.()===t)return n.snapshotFrame();return null}function uVe(t){for(const n of Y1()){if(!n.mounted()||!n.command)continue;const s=n.command(t);if(s)return s}return null}function fVe(){for(const t of Y1()){if(!t.mounted())continue;const n=t.scenes?.()??null;if(n&&typeof n.goToScene=="function")return n}return null}function tve(){for(const t of Y1()){if(!t.mounted())continue;const n=t.surface?.()??null;if(n)return n}return null}function dVe(){for(const t of Y1()){if(!t.mounted())continue;const n=t.coverage?.()??null;if(n)return n}return null}function pVe(){for(const t of Y1()){if(!t.mounted())continue;const n=t.authoringRefusal?.()??null;if(n!==null)return n}return null}function ZFt(t){return Y1().find(s=>s.mounted()&&s.remount)?.remount?.(t)??null}function QFt(t){if($I.some(s=>s.session.id===t.id))throw new Error(`live session "${t.id}" is already registered.`);const n={session:t,seq:arn++};return $I=[...$I,n],JMe(),()=>{$I=$I.filter(s=>s!==n),JMe()}}function Y1(){return[...$I].sort((t,n)=>(t.session.priority??0)-(n.session.priority??0)||t.seq-n.seq).map(t=>t.session)}function _Ve(){return Y1().some(t=>t.mounted())}function rve(){return Y1().some(t=>t.playing())}function mVe(){for(const t of Y1())t.stop()}function e9t(t){for(const n of Y1()){const s=n.instanceContainer(t);if(s)return s}return null}function hVe(t){return UMe.add(t),()=>UMe.delete(t)}function t9t(){return GFt}const crn=Object.freeze(Object.defineProperty({__proto__:null,anyLiveSessionMounted:_Ve,anyLiveSessionPlaying:rve,dispatchLiveCommand:uVe,liveAuthoringRefusal:pVe,liveCoverage:dVe,liveFrameCanvas:cVe,liveInstanceContainer:e9t,liveRestartRequired:XFt,liveRunWindow:aVe,liveScenes:fVe,liveSessions:WMe,liveSessionsVersion:t9t,liveSurface:tve,notifyLiveSessionsChanged:KFt,registerLiveSession:QFt,remountLiveSelection:ZFt,restartLiveSession:YFt,snapshotLiveFrame:lVe,stopAllLiveSessions:mVe,subscribeLiveSessions:hVe},Symbol.toStringTag,{value:"Module"}));async function r9t(t){const n=lVe(t);return n||Ntn(t)}function lrn(t){const n=t;return n&&typeof n.toDataURL=="function"?n:null}const urn=Object.freeze(Object.defineProperty({__proto__:null,liveCanvasFrame:r9t,readablePngSource:lrn},Symbol.toStringTag,{value:"Module"}));let qZ=null;function frn(){if(!qZ)return!0;try{return qZ()}catch{return!0}}function drn(t){return qZ=t,()=>{qZ===t&&(qZ=null)}}const n9t=new WeakMap;function hSn(t,n){n9t.set(t,n)}function i9t(t){for(const n of Array.from(t.querySelectorAll("iframe"))){const s=n9t.get(n),c=s?.container();if(s&&c)return{container:c,canvasFrame:s.canvasFrame}}return null}function gVe(t){return Array.from(document.querySelectorAll("[data-workspace-document-id]")).find(n=>n.dataset.workspaceDocumentId===t&&(bRe()===null||n.dataset.workspaceViewId===bRe()))??null}const HMe=["document","header","shelf","rail","outliner","content","utility"],prn={rail:{part:"properties",view:"volter.properties",title:"Properties"},outliner:{part:"outliner",view:"volter.outliner",title:"Outliner"},content:{part:"content",view:"volter.content",title:"Content"}},_rn={header:{prefix:"document-header",title:"header strip"},shelf:{prefix:"document-shelf",title:"tool shelf"}};function yVe(t){const n=[t.container,...t.extraRoots??[]];for(let c=0;c<n.length;c++)for(const d of n[c].querySelectorAll("[data-volter-portal]")){const m=d.dataset.volterPortal;if(m===void 0)continue;const g=document.querySelector(`[data-volter-portal-content="${CSS.escape(m)}"]`);g&&!n.includes(g)&&n.push(g)}const s=i9t(t.container)?.container;return s&&!n.includes(s)&&n.push(s),n}function mrn(t){return document.querySelector(`[data-volter-part="${t}"]`)}function hrn(){const t=[...document.querySelectorAll("[data-volter-utility]")].find(s=>{const c=s.getBoundingClientRect();return c.width>0&&c.height>0});if(!t)throw new Error("No utility view is showing, so scope 'utility' has nothing to reach. Show one in the panel (View: Open View…) and retry.");const n=t.dataset.volterUtility??"";return{container:t,name:"utility",id:n,title:n}}function grn(t){if(t==="utility")return hrn();const n=t==="rail"||t==="outliner"||t==="content"?prn[t]:null;if(n){const s=mrn(n.part),c=t==="rail"?[...document.querySelectorAll('[data-testid="inspector-panel"][data-volter-inspector-presentation="card"]')].find(d=>{const m=d.getBoundingClientRect();return m.width>0&&m.height>0})??null:null;if(c&&!s)return{container:c,name:t,id:n.view,title:"Inspector card"};if(c&&s)return{container:s,extraRoots:[c],name:t,id:n.view,title:`${n.title} and the inspector card`};if(!s)throw new Error(`The ${n.title} view (${n.view}) is not open, so scope '${t}' has nothing to reach. Open it from the workbench (View: Open View…) and retry — this door reads and drives what is on screen, and reports its absence rather than an empty match list.`);return{container:s,name:t,id:n.view,title:n.title}}return yrn(t)}function yrn(t){const n=CC();if(!n)throw new Error(`No active editor document, so scope '${t}' has nothing to reach. The editor's own views are still readable: scope 'outliner', scope 'rail', and scope 'content'.`);const s=e_()??n.descriptor.id;if(s===a0&&t!=="header")throw new Error("The Game document is out of this door's scope: drive and read a game through its own doors — `game.commands()`/`game.command(n)`/`game.state(n)`, or `page(step)` during play — never through synthetic DOM gestures. Its header strip (the editor's own Play bar and controls) is scope 'header'; the editor's views around it stay readable: scope 'outliner' and scope 'rail'.");const c=gVe(s);if(!c)throw new Error(`The active document's surface is not mounted: ${s} (${n.title}). Present it first (\`editor.present\`) and retry.`);const d=c.closest(".volter-dock-document")??c;if(t==="document")return{container:d,name:t,id:s,title:n.title};const m=_rn[t],g=d.querySelector(`[data-testid="${m.prefix}:${s}"]`);if(!g)throw new Error(`The active document "${n.title}" (${s}) draws no ${m.title}, so scope '${t}' has nothing to reach. Its whole box is scope 'document'.`);return{container:g,name:t,id:s,title:`${n.title} — ${m.title}`}}function fxt(t,n){return new Error(`Out of scope: ${n}. This step ran in scope '${t.name}' — "${t.title}" (${t.id}) — and reaches ONLY inside it. The other surfaces are named, not walked to: ${HMe.filter(s=>s!==t.name).map(s=>`'${s}'`).join(", ")} (pass \`{ scope }\`). The rest of the page is deliberately unreachable.`)}const dxt=400,pxt="rgb(1, 2, 3)",vrn="rgba(0, 0, 0, 0)";function brn(t,n){const s=getComputedStyle(t).getPropertyValue(n).trim();if(s==="")return"";const d=t.ownerDocument.createElement("span");d.style.position="absolute",d.style.pointerEvents="none",d.style.visibility="hidden",d.style.backgroundColor=pxt,t.appendChild(d);try{d.style.backgroundColor=`var(${n})`;const m=getComputedStyle(d).backgroundColor.trim();return m===pxt||m===vrn?s:m}finally{d.remove()}}function Srn(t,n){const s=getComputedStyle(t),c={};for(const d of n)c[d]=d.startsWith("--")?brn(t,d):s.getPropertyValue(xrn(d)).trim();return c}function xrn(t){return t.includes("-")?t:t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function _xt(t,n,s){const c=t,d={};for(const A of Array.from(t.attributes))d[A.name]=A.value;const m=c.getBoundingClientRect(),g=t.value,S=t.checked,k=(c.innerText||t.textContent||"").trim();return{index:n,tag:t.tagName.toLowerCase(),text:k.length>dxt?`${k.slice(0,dxt)}…`:k,attributes:d,rect:{x:m.x,y:m.y,width:m.width,height:m.height},...typeof g=="string"?{value:g}:{},...typeof S=="boolean"?{checked:S}:{},...c.hasAttribute("disabled")?{disabled:!0}:{},...s&&s.length>0?{styles:Srn(c,s)}:{}}}function _me(t,n,s){const c=a9t(t,n),d=c[s];if(!d)throw fxt(t,`${JSON.stringify(n)} matched ${c.length} element(s), so index ${s} does not exist`);if(!yVe(t).some(m=>m.contains(d)))throw fxt(t,`${JSON.stringify(n)} resolved outside the document's container`);return d}function wrn(t,n=[.5,.5]){const s=t.getBoundingClientRect();return{bubbles:!0,cancelable:!0,composed:!0,view:t.ownerDocument.defaultView??window,clientX:s.x+s.width*n[0],clientY:s.y+s.height*n[1],button:0,buttons:1}}function vVe(t){let n=t;for(;n&&!(n.hasAttribute("tabindex")||n.tabIndex>=0||n.isContentEditable);)n=n.parentElement;(n??t).focus({preventScroll:!0})}function o9t(t,n=[.5,.5]){const s=t.getBoundingClientRect();return{clientX:s.x+s.width*n[0],clientY:s.y+s.height*n[1]}}function Trn(t,n){const{clientX:s,clientY:c}=o9t(t,n);return t.ownerDocument.elementFromPoint(s,c)??t}function Crn(t,n=1,s,c={},d){const m={...wrn(t,s),...d,...c},g=Math.max(1,Math.round(n));s9t(t,()=>{for(let S=1;S<=g;S++){const k={...m,detail:S},A={...m,buttons:0,detail:S};t.dispatchEvent(new PointerEvent("pointerdown",{...k,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousedown",k)),vVe(t),t.dispatchEvent(new PointerEvent("pointerup",{...A,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mouseup",A)),t.dispatchEvent(new MouseEvent("click",A))}g>=2&&t.dispatchEvent(new MouseEvent("dblclick",{...m,buttons:0,detail:g}))})}function Ern(t,n,s,c){const d=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t:null;if(!d)throw new Error(`Cannot type into a <${t.tagName.toLowerCase()}>: this verb drives a text field. Click the control that opens one first (the Outliner's rename is a double click — \`click(selector, { clicks: 2 })\`), then \`type\` into the field it puts up.`);const m=t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(m,"value")?.set,S=A=>{g?g.call(d,A):d.value=A};d.focus();let k=d.value;s&&k!==""&&(d.select?.(),k="",S(k),d.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0,inputType:"deleteContentBackward"})));for(const A of[...n]){const F={key:A,bubbles:!0,cancelable:!0,composed:!0};d.dispatchEvent(new KeyboardEvent("keydown",F)),k+=A,S(k),d.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0,inputType:"insertText",data:A})),d.dispatchEvent(new KeyboardEvent("keyup",F))}if(c){const A={key:"Enter",code:"Enter",bubbles:!0,cancelable:!0,composed:!0};d.dispatchEvent(new KeyboardEvent("keydown",A)),d.dispatchEvent(new KeyboardEvent("keyup",A))}}function s9t(t,n){const c=(t.ownerDocument.defaultView??window).Element.prototype,d=c.setPointerCapture,m=c.releasePointerCapture;c.setPointerCapture=()=>{},c.releasePointerCapture=()=>{};try{n()}finally{c.setPointerCapture=d,c.releasePointerCapture=m}}function krn(t,n,s,c,d={},m=[],g=0){const S=t.getBoundingClientRect(),k=g===0?1:g===2?2:4,A=(D,J)=>({bubbles:!0,cancelable:!0,composed:!0,view:window,clientX:S.x+S.width*D,clientY:S.y+S.height*J,button:g,buttons:k,altKey:d.altKey??!1,ctrlKey:d.ctrlKey??!1,metaKey:d.metaKey??!1,shiftKey:d.shiftKey??!1}),F=A(n[0],n[1]);s9t(t,()=>{t.dispatchEvent(new PointerEvent("pointermove",{...F,button:-1,buttons:0,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousemove",{...F,buttons:0})),t.dispatchEvent(new PointerEvent("pointerdown",{...F,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousedown",F)),vVe(t);const D=Math.max(1,Math.round(c)),J=[n,...m,s];for(let G=0;G+1<J.length;G++){const se=J[G],pe=J[G+1];for(let ue=1;ue<=D;ue++){const Ce=ue/D,Fe=A(se[0]+(pe[0]-se[0])*Ce,se[1]+(pe[1]-se[1])*Ce);t.dispatchEvent(new PointerEvent("pointermove",{...Fe,button:-1,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mousemove",Fe))}}const q={...A(s[0],s[1]),buttons:0};t.dispatchEvent(new PointerEvent("pointerup",{...q,pointerType:"mouse"})),t.dispatchEvent(new MouseEvent("mouseup",q)),g===2?t.dispatchEvent(new MouseEvent("contextmenu",q)):g===0&&n[0]===s[0]&&n[1]===s[1]&&t.dispatchEvent(new MouseEvent("click",q))})}function Arn(t,n){if(n)return n;const s=document.activeElement;return s instanceof HTMLElement&&yVe(t).some(c=>c.contains(s))?s:t.container}function a9t(t,n){try{return yVe(t).flatMap(s=>Array.from(s.querySelectorAll(n)))}catch(s){throw new Error(`Invalid selector ${JSON.stringify(n)}: ${String(s)}`)}}function sOe(t,n){const s=n.selector===void 0?null:_me(t,n.selector,n.index??0);return Arn(t,s)}const Drn={" ":"Space","`":"Backquote","-":"Minus","=":"Equal","[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash"};function Prn(t){return/^[a-z]$/i.test(t)?`Key${t.toUpperCase()}`:/^[0-9]$/.test(t)?`Digit${t}`:Drn[t]??t}const Irn={Backspace:8,Tab:9,Enter:13,Escape:27," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Delete:46};function Nrn(t){if(/^[a-z0-9]$/i.test(t))return t.toUpperCase().charCodeAt(0);const n=/^F([1-9]|1[0-2])$/.exec(t);return n?111+Number(n[1]):Irn[t]??0}function Orn(t){const n=t===void 0?null:/^Numpad([0-9])$/.exec(t);return n?96+Number(n[1]):t==="NumpadDecimal"?110:null}function mxt(t,n){const s=new KeyboardEvent(t,Rrn(n)),c=Orn(n.code)??Nrn(n.key);return Object.defineProperty(s,"keyCode",{get:()=>c}),Object.defineProperty(s,"which",{get:()=>c}),s}function Rrn(t){return{key:t.key,code:t.code??Prn(t.key),bubbles:!0,cancelable:!0,composed:!0,...t.ctrlKey?{ctrlKey:!0}:{},...t.metaKey?{metaKey:!0}:{},...t.shiftKey?{shiftKey:!0}:{},...t.altKey?{altKey:!0}:{}}}function Frn(t,n){const s=[...t.options].map(d=>d.value);if(!s.includes(n))throw new Error(`No option with value ${JSON.stringify(n)} on this <select> — it offers ${s.map(d=>JSON.stringify(d)).join(", ")||"(no options)"}. The value is the option's \`value\`, not its label; \`query\` reports both.`);const c=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;c?c.call(t,n):t.value=n,t.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),t.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}const aOe=["query","click","drag","key","paste","select","type"];function Mrn(t){const n=t?.action;if(!aOe.includes(n))throw new Error(`Unknown document-probe action ${JSON.stringify(n)}. This door has exactly ${aOe.length} verbs: ${aOe.join(", ")} (\`editor.document.*\`).`);const s=t.scope??"document";if(!HMe.includes(s))throw new Error(`Unknown scope ${JSON.stringify(s)}. This door addresses exactly these surfaces: ${HMe.map(c=>`'${c}'`).join(", ")}.`);return grn(s)}async function jrn(t){const n=Mrn(t);if(e_()===a0&&frn()&&t.action!=="query"&&t.action!=="click"&&t.action!=="select")throw new Error(`'${t.action}' is refused while the Game document holds the keyboard: its events would reach the game. Query, click and select still work; click into a view's field first, or drive the game through the game's own doors.`);const s={name:n.name,id:n.id,title:n.title},c=d=>({scope:s,matched:1,elements:[_xt(d,0)]});switch(t.action){case"query":{const d=a9t(n,t.selector);return{scope:s,matched:d.length,elements:d.slice(0,t.limit??25).map((m,g)=>_xt(m,g,t.styles))}}case"click":{const d=_me(n,t.selector,t.index??0),m=t.at;if(m!==void 0&&!(Array.isArray(m)&&m.length===2&&m.every(S=>typeof S=="number"&&Number.isFinite(S))))throw new Error(`click's \`at\` is [x, y], fractions of the element's box; got ${JSON.stringify(m)}.`);const g=d.ownerDocument===document?d:Trn(d,m);return Crn(g,t.clicks??1,m&&g===d?m:void 0,{...t.altKey?{altKey:!0}:{},...t.ctrlKey?{ctrlKey:!0}:{},...t.metaKey?{metaKey:!0}:{},...t.shiftKey?{shiftKey:!0}:{}},g===d?void 0:o9t(d,m)),c(g)}case"type":{const d=sOe(n,t);return Ern(d,t.text,t.replace??!0,t.enter??!0),c(d)}case"drag":{if(t.button!==void 0&&![0,1,2].includes(t.button))throw new Error(`Unknown button ${JSON.stringify(t.button)}: 0 primary, 1 middle, 2 secondary.`);const d=_me(n,t.selector,t.index??0),m=d.getBoundingClientRect(),g=[["from",t.from],...(t.via??[]).map((S,k)=>[`via[${k}]`,S]),["to",t.to]];for(const[S,k]of g)if(!k.every(F=>Number.isFinite(F)&&F>=0&&F<=1)&&!(t.leave&&S!=="from"&&k.every(F=>Number.isFinite(F))))throw new Error(`drag ${S} ${JSON.stringify(k)} is not a fraction of the element's box: points are [x, y] from 0 to 1 from its top-left ([0.5, 0.5] is its centre). This element is ${Math.round(m.width)} x ${Math.round(m.height)} px at (${Math.round(m.x)}, ${Math.round(m.y)}); a page pixel px becomes (px - ${Math.round(m.x)}) / ${Math.round(m.width)}.`);return krn(d,t.from,t.to,t.steps??8,{...t.altKey===void 0?{}:{altKey:t.altKey},...t.ctrlKey===void 0?{}:{ctrlKey:t.ctrlKey},...t.metaKey===void 0?{}:{metaKey:t.metaKey},...t.shiftKey===void 0?{}:{shiftKey:t.shiftKey}},t.via??[],t.button??0),c(d)}case"key":{const d=sOe(n,t);document.activeElement instanceof Node&&d.contains(document.activeElement)||vVe(d);const m=document.activeElement,g=m instanceof HTMLElement&&d.contains(m)?m:d;return g.dispatchEvent(mxt("keydown",t)),t.holdMs&&await new Promise(S=>setTimeout(S,t.holdMs)),g.dispatchEvent(mxt("keyup",t)),c(d)}case"select":{const d=_me(n,t.selector,t.index??0);if(!(d instanceof HTMLSelectElement))throw new Error(`${JSON.stringify(t.selector)} resolved a <${d.tagName.toLowerCase()}>, not a <select>. This verb sets a dropdown's value; a button or a checkbox takes \`click\`.`);return Frn(d,t.value),c(d)}case"paste":{const d=sOe(n,t),m=new DataTransfer;return m.setData("text/plain",t.text),d.dispatchEvent(new ClipboardEvent("paste",{bubbles:!0,cancelable:!0,composed:!0,clipboardData:m})),c(d)}}}const hxt="editor-chrome-root";function Lrn(t){return async n=>{const s={width:Math.max(1,Math.round(n.clientWidth*t)),height:Math.max(1,Math.round(n.clientHeight*t))};return await Otn(n,s)??r9t(n)}}async function Brn(t,n){const s=document.getElementById(hxt);if(!s)throw new Error(`The editor chrome root (#${hxt}) is not mounted, so there is no editor page to photograph.`);let c=s;if(n?.region==="document"){const k=e_(),A=k?gVe(k):null;if(!A)throw new Error("No active document is showing, so there is no document region to photograph.");c=A}const d=n?.scale??window.devicePixelRatio??1,m=c.getBoundingClientRect(),g={width:Math.max(1,Math.round(m.width*d)),height:Math.max(1,Math.round(m.height*d))};return{...await VFt(c,{canvasFrame:Lrn(d),includeDocumentStyles:!0,size:g}),view:ote(t),size:g,scale:d}}function ste(){return rve()}function gSn(){return!ste()}const Lge=new Set;function $rn(t,n){const s={collect:t,reusableKeys:n?.reusableKeys??[]};return Lge.add(s),()=>{Lge.delete(s)}}function qrn(t=null){const n={};for(const s of Lge)Object.assign(n,s.collect(t));return n}function zrn(){const t=[];for(const n of Lge)t.push(...n.reusableKeys);return t}let zZ=null;const GI=[];function Vrn(t){if(zZ=t,GI.length!==0)for(const n of GI.splice(0,GI.length))n.resolve(t)}function Urn(){return new Promise((t,n)=>{GI.push({resolve:t,reject:n})})}function Jrn(t){zZ===t&&(zZ=null,GI.length!==0&&queueMicrotask(()=>{if(!(zZ!==null||GI.length===0))for(const n of GI.splice(0,GI.length))n.reject(new Error("the hierarchy panel (GameHierarchy) unmounted before it published the mutated row tree, so the mutation cannot be acknowledged against a rendered tree. Open the Hierarchy panel in the workspace dock and retry."))}))}function gxt(){return zZ}function Wrn(t,n){const s=[],c=[];for(const d of t.rows){const m=Hrn(d,t);for(;c.length>d.depth;)c.pop();const g=c.length>0?c[c.length-1]:void 0;if(g===void 0)s.push(m);else{const S=g.children;S===void 0?g.children=[m]:S.push(m)}c.push(m)}return{rowCount:t.rows.length,window:{start:t.window.start,end:t.window.end},...t.searchTerm?{search:t.searchTerm}:{},...t.scopeId?{scopeId:t.scopeId}:{},playState:n.playState,activeViewportTab:n.activeViewportTab,roots:s}}function Hrn(t,n){const{node:s}=t;return t.more?{id:s.id,label:`… ${t.more.hidden} more`,depth:t.depth,childCount:0,internalChildCount:0,expandable:!1,more:{hidden:t.more.hidden}}:{id:s.id,label:s.label,...s.typeLabel===void 0?{}:{typeLabel:s.typeLabel},...s.role===void 0?{}:{role:s.role},depth:t.depth,childCount:s.childIds.length,internalChildCount:n.foldedInternalCount(s.id),expandable:t.hasChildren,...t.hasChildren?{expanded:n.isExpanded(t)}:{},...n.isInternal(s.id)?{internal:!0}:{},...n.isComponentRoot(s.id)?{componentRoot:!0}:{}}}const Grn=new Set(["raw","url","worker","sharedworker","inline","init"]),Krn=[".ts",".tsx",".js",".jsx",".mjs",".cjs"],Xrn=/\.stories\.[cm]?[jt]sx?$/i;function Yrn(t){let n;try{n=new URL(t,"http://volter.invalid")}catch{return null}return{path:n.pathname,query:n.search}}function Zrn(t){const n=new URLSearchParams(t);for(const s of n.keys())if(Grn.has(s))return!0;return!1}function Qrn(t,n,s){if(t.startTime<s)return null;const c=Yrn(t.name);if(!c)return null;const{path:d,query:m}=c;if(!d.includes(n)||!Krn.some(A=>d.endsWith(A))||Xrn.test(d)||d.endsWith("/volter.adapter.ts")||Zrn(m))return null;const g=new URLSearchParams(m),S=g.get(Pge)??"";g.delete(Pge);const k=g.toString();return{group:`${S}\0${d}`,path:d,url:`${d}${k?`?${k}`:""}`}}function enn(t,n){const s=n.projectRoot.endsWith("/")?n.projectRoot.slice(0,-1):n.projectRoot;if(s.length===0)return[];const c=new Map;for(const m of t){const g=Qrn(m,s,n.since);if(!g)continue;const S=c.get(g.group);S===void 0?c.set(g.group,{path:g.path,urls:[g.url]}):S.urls.includes(g.url)||S.urls.push(g.url)}const d=[];for(const{path:m,urls:g}of c.values())g.length>1&&d.push({path:m,urls:g});return d}function ySn(t){return`Cross-root module split: ${t.path} was loaded ${t.urls.length} times in one mount, so each root holds its OWN copy of its module-level state (a \`let\` written by one root is invisible to the other). Urls: `+t.urls.join(" | ")}function c9t(){const t=globalThis.performance;if(!t||typeof t!="object")return null;const n=t;return typeof n.now!="function"||typeof n.getEntriesByType!="function"?null:n}let Gk=null,ZQ=[],VO=null,$B=[];function vSn(){$B=[],Gk?.disconnect(),Gk=null,ZQ=[];const t=c9t();if(!t){VO=null;return}VO=t.now(),typeof PerformanceObserver<"u"&&(Gk=new PerformanceObserver(n=>{ZQ.push(...n.getEntries())}),Gk.observe({type:"resource"}))}function bSn(t){const n=c9t();if(!n||VO===null)return VO=null,$B;const s=Gk?[...ZQ,...Gk.takeRecords()]:n.getEntriesByType("resource");return Gk?.disconnect(),Gk=null,ZQ=[],$B=enn(s,{projectRoot:t,since:VO}),VO=null,$B}function tnn(){return $B}function SSn(){Gk?.disconnect(),Gk=null,ZQ=[],$B=[],VO=null}const GMe=new Set;let jY=null;function rnn(t){return GMe.add(t),()=>{GMe.delete(t)}}function nnn(){return jY||(jY=Promise.all([...GMe].map(t=>Promise.resolve().then(t))).then(()=>{}).finally(()=>{jY=null}),jY)}const inn=500;function yxt(t){const n=globalThis,s=n.requestIdleCallback;if(typeof s=="function"){const d=s.call(globalThis,t,{timeout:inn});return()=>n.cancelIdleCallback?.call(globalThis,d)}const c=setTimeout(t,0);return()=>clearTimeout(c)}const mme=new Map;function xSn(t,n){return mme.set(t,n),()=>{mme.get(t)===n&&mme.delete(t)}}function onn(){return Object.fromEntries([...mme].map(([t,n])=>[t,n()]))}let l9t=null;function wSn(t){l9t=t}function snn(){return l9t}const ann=["three","canvas","dom"];function vxt(t){return t.provenance?.source==="boundary"}function cnn(t){return ann.includes(t)?t:null}function lnn(){const t=Oye(),n=CC()?.descriptor.provenance?.rootId,s=n?u0()?.regions.find(g=>g.id===n):void 0,c=t?.adapter&&n&&s?{worldId:n,surface:s.surface,adapter:t.adapter}:null,d=sPt();if(!d)return c?[c]:[];if(d instanceof hy){const g=d.childAdapters().filter(S=>S.role==="world"&&!vxt(S.adapter)).map(S=>({worldId:S.worldId,surface:cnn(S.kind),adapter:S.adapter}));return c?[c,...g.filter(S=>S.worldId!==n)]:g}if(vxt(d)||d===snn())return c?[c]:[];const m={worldId:"root",surface:tve(),adapter:d};return c?[c,m]:[m]}const qB=new Map,KMe=new Set;let u9t=0;function bxt(){u9t++;for(const t of KMe)t()}function TSn(t){return qB.set(t.id,t),bxt(),()=>{qB.get(t.id)===t&&(qB.delete(t.id),bxt())}}function CSn(t){return t?qB.get(t)??null:null}function unn(){return[...qB.values()]}function ESn(t){if(t===null)return null;for(const n of qB.values())if(n.kind==="game"&&n.instanceId===t)return n;return null}function kSn(t){return KMe.add(t),()=>KMe.delete(t)}function ASn(){return u9t}function bVe(t){return t.length===0?void 0:t.some(s=>s.hiddenBy===null)?null:[...t].sort((s,c)=>c.area-s.area)[0]?.hiddenBy??null}function fnn(t){return t.filter(n=>n.hiddenBy!==null).sort((n,s)=>s.area-n.area).map(n=>`${n.label} (${n.hiddenBy}, ${n.inlineHiding===null?"from an ancestor or a stylesheet":n.failsafeEligible?"its own inline style, unowned":"its own inline style, by a declared owner"}, ${Math.round(n.area)}px²)`)}function f9t(t){return t.filter(n=>n.failsafeEligible&&n.inlineHiding!==null)}function dnn(t){return t.some(n=>n.hiddenBy!==null)?f9t(t).length>0:null}const pnn=4e3;function _nn(t){const n=t.deadlineMs??pnn;if(t.framesProduced<=0)return{fire:!1};if(t.hiddenForMs===null||t.hiddenForMs<n)return{fire:!1};if(bVe(t.canvases)===null)return{fire:!1};const s=[...f9t(t.canvases)].sort((c,d)=>d.area-c.area)[0];return s?{fire:!0,target:s,ledger:`canvas reveal FAILSAFE FIRED — the "${s.label}" canvas was still hidden by its own inline ${s.inlineHiding} (${s.hiddenBy}) ${Math.round(t.hiddenForMs/1e3)}s after frames started arriving, so the editor cleared that style to put the picture on screen. THIS IS A DEFECT, not a feature: the mount path that hid this canvas never ran its own reveal, and the failsafe fires ONCE — a second mount in this state stays blank. Report it upstream with the mount that owns this canvas.`}:{fire:!1}}const hme=new Map;function DSn(t){return hme.set(t.id,t),()=>{hme.get(t.id)===t&&hme.delete(t.id)}}function mnn(){return[...hme.values()]}const cOe=10,a_e=5e3;function hnn(t){if(t.mode!=="edit")return{status:"ok",detail:"not in Edit mode — the invariant does not apply while playing"};if(t.loops===null)return{status:"unmeasured",detail:"nothing enumerated this session’s game loops",fix:"the session vitals collector must report a loop fact per live runtime (play, ingest, module)"};const n=t.designTimeSurfaces,s=[...t.loops.filter(S=>S.running).map(S=>S.name),...(n??[]).filter(S=>S.advanced===!0&&S.transportAdvanced!==!0).map(S=>`${S.label} (design-time surface)`)],c=(n??[]).filter(S=>S.advanced===!0&&S.transportAdvanced===!0);if(s.length>0)return{status:"violation",detail:`Edit mode, but content time is advancing in ${s.length} place(s): ${s.join(", ")}`,cause:`content time is advancing while the editor is in Edit: ${[...s].sort().join(", ")}`,missing:"authoring is happening on top of moving content: the thing under the gizmo moves while you edit it, a pose you are reading is a frame of an animation rather than what the source says, and every other instrument reports a still editor",fix:"one time policy at the shared viewport stack — presentation (orbit, turntable, dressing) keeps running while CONTENT time (mixers, useFrame, simulation) is held at design time"};const d=(n??[]).filter(S=>S.advanced===null),m=t.loops.map(S=>S.name).join(", ");if(n===null)return{status:"unmeasured",detail:`${t.loops.length} enumerated loop(s) stopped (${m}), but nothing enumerated this session's design-time surfaces`,fix:"the session vitals collector must enumerate the Object3DDocumentViewport stack’s live sessions"};if(d.length>0)return{status:"unmeasured",detail:`${t.loops.length} enumerated loop(s) stopped (${m}), and ${n.length-d.length} design-time surface(s) still — but ${d.length} publish no content clock: `+d.map(S=>`${S.label} (${S.unavailable??"no reason given"})`).join(", "),fix:"each design-time surface host must publish its own content clock (`Object3DDocumentSession.contentClock`) so this row can speak for it"};const g=c.length===0?"":`; ${c.length} advancing under an engaged transport (${c.map(S=>S.label).join(", ")})`;return{status:"ok",detail:`Edit is static — ${t.loops.length} enumerated loop(s) stopped (${m}), and ${n.length} design-time surface(s) hold their content time${g}`}}function gnn(t){return t.presentedThreeRoots===null?{status:"unmeasured",detail:"nothing enumerated which three roots this session presents",fix:"the session vitals collector must read the mounted roots off the active authoring surface"}:t.presentedThreeRoots.length<=1?{status:"ok",detail:`the scene presents ${t.presentedThreeRoots.length} three root(s)`}:{status:"violation",detail:`the scene presents ${t.presentedThreeRoots.length} three roots at once: ${t.presentedThreeRoots.join(", ")}`,cause:`the scene presents more than one three root: ${[...t.presentedThreeRoots].sort().join(", ")}`,missing:"a scene has ONE root by the authoring ontology — scenes swap inside it. Two presented at once means selection, framing and the gizmo are working over a tree no single document owns",fix:"declare one three root and swap SCENES inside it (ARCHITECTURE-CORE §Roots); a second world belongs behind its own document"}}function ynn(t){return t.canvasHiddenBy===void 0?{status:"unmeasured",detail:"no canvas was found to measure",fix:"the session vitals collector must enumerate this session’s canvases before this can be checked"}:t.framesProduced===null?{status:"unmeasured",detail:"nothing sampled whether frames are being produced",fix:"the session vitals collector must run its frame sampler before this can be checked"}:t.canvasHiddenBy===null?{status:"ok",detail:"this session presents a revealed canvas"}:t.framesProduced===0?{status:"ok",detail:`every canvas is hidden (largest: ${t.canvasHiddenBy}) and nothing is drawing — not the failsafe's case`}:t.canvasHidesItself===!1?{status:"ok",detail:`every canvas is hidden but none is hiding ITSELF — the workspace is showing a non-canvas document, which is what the user opened: ${(t.hiddenCanvases??[]).join("; ")}`}:{status:"violation",detail:`${t.framesProduced} frame(s) produced in ${t.sampleWindowMs??0}ms while every canvas is hidden and one hides ITSELF: ${(t.hiddenCanvases??[]).join("; ")}`,cause:`frames are being produced while every canvas is hidden and one hides itself (${t.canvasHiddenBy})`,missing:"the session is burning frames onto a surface nobody can see — the user is looking at an empty viewport while every instrument reports a healthy, rendering session",fix:"reveal the canvas as soon as it produces frames — the bounded failsafe in `coverage/canvas-reveal.ts` does it for inline hiding on the canvas itself and says so loudly; hiding from an ancestor or a stylesheet is its owner’s to undo"}}function vnn(t){return t.directManipulationExpected===!1?{status:"ok",detail:"browser automation is rendering evidence — no person is waiting on direct manipulation"}:t.tabVisible?t.fps===null?{status:"unmeasured",detail:t.fpsUnavailable??"no frame-rate sample exists",fix:"the session vitals collector must sample frame cadence while the tab is visible"}:t.fps>=cOe?{status:"ok",detail:`visible tab rendering at ${t.fps.toFixed(1)}fps`}:{status:"violation",detail:`visible tab rendering at ${t.fps.toFixed(1)}fps, below the ${cOe}fps floor`,cause:`the visible tab is rendering below the ${cOe}fps floor`,missing:"the editor has stopped being a direct-manipulation tool: a drag, a click and a keystroke all land seconds after the user made them",fix:"find the cost with the Profiler’s Overview (long-animation-frame attribution) — main-thread saturation and GPU/compositor cost are separate hunts"}:{status:"ok",detail:"the tab is hidden — a hidden tab is not owed a frame rate"}}function bnn(t){return t.play===null?{status:"ok",detail:"nothing is playing — the invariant does not apply"}:t.tabVisible?t.play.framesDrawn===null?{status:"unmeasured",detail:t.play.framesUnavailable??"the play session reports no frame count, so nothing can say whether it drew",fix:"the play session’s render loop must expose a frame count (its profiler source carries one only while telemetry is enabled)"}:t.play.framesDrawn>0?{status:"ok",detail:`play has drawn ${t.play.framesDrawn} frame(s)`}:t.play.startedMsAgo<a_e?{status:"ok",detail:`play started ${t.play.startedMsAgo}ms ago and has not drawn yet — inside the ${a_e}ms deadline`}:{status:"violation",detail:`play started ${t.play.startedMsAgo}ms ago and has drawn no frame (deadline ${a_e}ms)`,cause:`play started and no frame has drawn within the ${a_e}ms deadline`,missing:"the user pressed ▶ and the game is not running: the viewport shows whatever was there before, and every other instrument reports a live play session",fix:"find why the run loop never rendered — the console’s own errors from the play session are the first read"}:{status:"ok",detail:"the tab is hidden — the engine hidden-pauses the loop, so no frame is owed"}}const d9t={"edit-mode-static":hnn,"single-root-scene":gnn,"canvas-revealed":ynn,"visible-tab-fps-floor":vnn,"play-drew-a-frame":bnn},Snn=Object.keys(d9t);function xnn(t){return Snn.map(n=>({id:n,...d9t[n](t)}))}function wnn(t){if(t.status!=="violation")return null;const n=[`invariant "${t.id}" VIOLATED — ${t.cause??t.id}`];return t.missing&&n.push(` cost: ${t.missing}`),t.fix&&n.push(` fix: ${t.fix}`),n.join(`
1397
- `)}const XMe=new Set;function Tnn(t){return XMe.add(t),()=>{XMe.delete(t)}}function Cnn(){for(const t of[...XMe])try{t()}catch(n){ea.error(`a session-sample subscriber threw: ${String(n)}`,"invariant")}}const Enn=5e3;let Aw={frames:0,since:0},VZ=null,zB=null,oR=null;const UZ=new Map;function knn(t){const n=window.getComputedStyle(t);if(n.display==="none")return"display: none";if(n.visibility==="hidden")return"visibility: hidden";if(Number.parseFloat(n.opacity||"1")===0)return"opacity: 0";const s=t.getBoundingClientRect();return s.width<=0||s.height<=0?"zero-size box":null}const Ann="editor-canvas";function Dnn(t){const n=t.style;return n.display==="none"?"display":n.visibility==="hidden"?"visibility":n.opacity!==""&&Number.parseFloat(n.opacity)===0?"opacity":null}function p9t(){return[...document.querySelectorAll("canvas")].map((n,s)=>{const c=n.getAttribute("data-testid"),d=n.getBoundingClientRect();return{label:c??(n.className||`canvas #${s}`),area:Math.max(0,d.width)*Math.max(0,d.height),hiddenBy:knn(n),inlineHiding:Dnn(n),failsafeEligible:c!==Ann&&!n.closest(".monaco-editor")}})}function Pnn(){const t=unn();if(t.length===0)return{framesDrawn:null,framesUnavailable:"no render loop registered a performance source, so nothing counts this session’s frames"};let n=null;for(const s of t){const d=s.profiler.getSnapshot().frames.at(-1);d&&(n=Math.max(n??0,d.id))}return n===null?{framesDrawn:null,framesUnavailable:"the registered render loop records no frames (its profiler has neither profiling nor telemetry enabled)"}:{framesDrawn:n,framesUnavailable:null}}const PO=new Map,LY=new Map;function Inn(){const t=mnn(),n=new Set,s=t.map(c=>{const{id:d,label:m}=c;n.add(d);let g=null;try{g=c.transportAdvances?.()??null}catch{g=null}const S=LY.get(d);g===null?LY.delete(d):LY.set(d,g);const k=g===null||S===void 0?{}:{transportAdvanced:g!==S};let A;try{A=c.contentClock()}catch(J){return PO.delete(d),{id:d,label:m,advanced:null,unavailable:`its content clock threw: ${String(J)}`,...k}}if(A===null)return PO.delete(d),{id:d,label:m,advanced:null,unavailable:"its content clock is temporarily unavailable",...k};const F=A,D=PO.get(d);return PO.set(d,F),D===void 0?{id:d,label:m,advanced:null,unavailable:"first reading — nothing to compare it against yet",...k}:{id:d,label:m,advanced:F!==D,...k}});for(const c of[...PO.keys()])n.has(c)||PO.delete(c);for(const c of[...LY.keys()])n.has(c)||LY.delete(c);return s}function Nnn(t=Date.now()){const n=ste(),s=Aw.since===0?0:t-Aw.since,c=Aw.frames,d=s>0&&c>0?c*1e3/s:null,m=n?{startedMsAgo:oR===null?0:t-oR,...Pnn()}:null;return{mode:n?"play":"edit",loops:[...WMe().map(g=>({name:`${g.id} session`,running:g.mounted()})),...WMe().map(g=>({name:`${g.id} playing`,running:g.playing()}))],designTimeSurfaces:Inn(),presentedThreeRoots:sPt()?lnn().filter(g=>g.surface==="three").map(g=>g.worldId):null,...(()=>{const g=p9t();return{canvasHiddenBy:bVe(g),canvasHidesItself:dnn(g),hiddenCanvases:fnn(g)}})(),framesProduced:Aw.since===0?null:c,sampleWindowMs:Aw.since===0?null:s,tabVisible:!document.hidden,directManipulationExpected:navigator.webdriver!==!0,fps:d,fpsUnavailable:d===null?Aw.since===0?"the frame sampler has not opened a window yet":"no frame was produced in the sample window":null,play:m}}function _9t(){return xnn(Nnn())}let mB=null;const Sxt=new WeakSet;function Onn(t,n){const s=bVe(t);if(s==null){mB=null;return}if(mB===null){mB=n;return}const c=_nn({canvases:t,framesProduced:Aw.frames,hiddenForMs:n-mB});if(!c.fire)return;const d=[...document.querySelectorAll("canvas")].find(m=>(m.getAttribute("data-testid")??m.className)===c.target.label);!d||Sxt.has(d)||(Sxt.add(d),c.target.inlineHiding==="display"&&d.style.removeProperty("display"),c.target.inlineHiding==="visibility"&&d.style.removeProperty("visibility"),c.target.inlineHiding==="opacity"&&d.style.removeProperty("opacity"),ea.error(c.ledger,"invariant"))}function Rnn(){const t=_9t();for(const n of t){const s=wnn(n);if(!s){UZ.delete(n.id);continue}if(n.id==="visible-tab-fps-floor"){const c=(UZ.get(n.id)??0)+1;if(UZ.set(n.id,c),c<3)continue}ea.warn(s,"invariant")}return t}function Fnn(){if(zB!==null)return xxt;Aw={frames:0,since:Date.now()};const t=()=>{Aw.frames++,VZ=requestAnimationFrame(t)};return VZ=requestAnimationFrame(t),zB=setInterval(()=>{const n=ste();n&&oR===null&&(oR=Date.now()),n||(oR=null),Cnn(),Onn(p9t(),Date.now()),Rnn(),Aw={frames:0,since:Date.now()}},Enn),xxt}function Mnn(){Aw={frames:0,since:zB===null?0:Date.now()},oR=null,mB=null,UZ.clear(),PO.clear()}function xxt(){VZ!==null&&cancelAnimationFrame(VZ),zB!==null&&clearInterval(zB),VZ=null,zB=null,Aw={frames:0,since:0},oR=null,mB=null,UZ.clear()}let YMe=null;function jnn(t){YMe=t}function SVe(){return YMe?(YMe(),!0):!1}let xVe=[];const ZMe=new Set;function wxt(t){xVe=t;for(const n of ZMe)n()}function Lnn(){return xVe}function Bnn(t){return ZMe.add(t),()=>ZMe.delete(t)}function $nn(t){const n=xVe.find(s=>s.id===t);return n?(n.run(),!0):!1}let QQ=null;function qnn(t){QQ=t}function znn(t){QQ&&Promise.resolve(QQ(`${t}.focus`)).catch(()=>{})}const Vnn=/^volter\.([^.]+)\.(.+)$/;async function Unn(t,n){if(QQ)return await QQ(t,n);const s=Vnn.exec(t);if(!s)throw new Error(`No command "${t}". Without the Code-OSS frame there is no command service, so the only commands this editor answers are a view's own verbs, spelled volter.<view>.<verb> (for example volter.blender-node-view.view-all).`);const{invokeViewVerb:c}=await fo(async()=>{const{invokeViewVerb:d}=await Promise.resolve().then(()=>s4r);return{invokeViewVerb:d}},[]);return c(s[1],s[2],n)}const wVe=[{kind:"agent",title:"Conversations",hotkeyScope:"workspace",selectableText:!0,icon:"users"},{kind:"project-work",title:"Project work",hotkeyScope:"workspace",selectableText:!0,icon:"list"},{kind:"hierarchy",title:"Hierarchy",hotkeyScope:"hierarchy",selectableText:!1,region:"outliner",icon:"outliner"},{kind:"assets",title:"Content",hotkeyScope:"asset-browser",selectableText:!1,icon:"folder-open"},{kind:"asset-library",title:"Asset Library",hotkeyScope:"asset-browser",selectableText:!1,icon:"cubes-stacked"},{kind:"inspector",title:"Inspector",hotkeyScope:"inspector",selectableText:!1,region:"properties",icon:"properties"}];async function Jnn(t){const{liveCanvasFrame:n}=await fo(async()=>{const{liveCanvasFrame:s}=await Promise.resolve().then(()=>urn);return{liveCanvasFrame:s}},void 0);return n(t)}async function Wnn(...t){const{capturePlayComposite:n}=await fo(async()=>{const{capturePlayComposite:s}=await Promise.resolve().then(()=>orn);return{capturePlayComposite:s}},void 0);return n(...t)}async function Txt(){return fo(()=>Promise.resolve().then(()=>HDt),void 0)}async function Hnn(){return fo(()=>Promise.resolve().then(()=>Gan),void 0)}function Gnn(t,n=5e3){return SC().some(s=>s.id===t)?Promise.resolve():new Promise(s=>{let c=0,d=()=>{};const m=()=>{clearTimeout(c),d(),s()};d=Jye(()=>{SC().some(g=>g.id===t)&&m()}),SC().some(g=>g.id===t)?m():c=window.setTimeout(m,n)})}async function Knn(t){if(t){if(!SC().some(n=>n.id===t)){const n=t.startsWith(Ome);if(n&&(await(await Txt()).refreshProjectToolContributions(),await Gnn(t)),!SC().some(s=>s.id===t)){const s=SC().map(d=>d.id),c=n?(await Txt()).contributionFailureHint(t.slice(Ome.length)):"";throw new Error(`Utility is not registered: ${t}.`+c+` Registered utilities: ${s.length>0?s.join(", "):"(none)"}. A project contributes one by exporting a \`workspace.utility\` tool contribution; its view id is \`tool:<contribution-id>\`.`)}}bC(t)}}async function m9t(t){const n=wVe.map(c=>c.kind),s=n.find(c=>c===t);if(!s)throw new Error(`"${t}" is not a panel of this editor. Panels: ${n.join(", ")}.`);if(FBe(s),!await EC(()=>eDt()===s))throw new Error(`The ${s} panel is not in this workspace's layout, so it could not be focused. Panels: ${n.join(", ")}.`);return s}function Xnn(t,n){if(X0("workspace:scene"))return"workspace:scene";const s=l0().map(c=>c.descriptor.id);throw new Error(`This session has no Scene document open. Open documents: ${s.join(", ")||"none"}; address one as { kind: "workspace", id }.`)}async function Ynn(t){let n=!1;if(await EC(()=>(n=LMe(t.id),n||sxt(t.id)!==null),PR),n)return e_();const s=sxt(t.id);throw s?new Error(s):new Error(`World document is not registered: ${t.id}`)}async function Znn(t,n){const s=g=>g.filter(S=>S.id===n||S.label===n);let c=[];if(!await EC(()=>{const g=cBe(t)?.adapter?.stories;if(!g)return!1;c=g.storiesFor("");const S=s(c);return S.length===1?(g.apply(S[0].id,S[0].id),!0):c.length>0},PR))throw new Error(`The board mounted no stories provider within the wait window; story ${JSON.stringify(n)} was not applied.`);const m=s(c);if(m.length!==1)throw new Error(m.length===0?`No story matches ${JSON.stringify(n)}. This board's stories: ${c.map(g=>g.label).join(", ")||"(none)"}.`:`${JSON.stringify(n)} is ambiguous (${m.length} stories match) — use the story id: ${m.map(g=>g.id).join(" | ")}`)}async function Qnn(t,n){const s=await Wye(n.kind,t,n);if(s!==null)return s;let c=!1;if(await EC(()=>(c=SN(n.id)||X0(n.id),c||axt(n.id)!==null),PR),c)return n.story!==void 0&&await Znn(n.id,n.story),n.id;const d=axt(n.id);throw d?new Error(d):new Error(`Workspace document is not available: ${n.id}`)}async function ein(t,n){const s=await Wye(n.kind,t,n);if(s===null){const{kind:c,...d}=n,m=pkr();throw new Error(`Nothing in this editor can open a '${c}' document (${JSON.stringify(d)}). Either no package registered an opener for that view address, or the subject does not exist. Registered view addresses: ${m.length>0?m.join(", "):"(none)"}.`)}return s}function tin(t){const n=XEr();return n===null?"":n.includes(t)?`"${t}" is a kind in this project's document table, not an address — a document opens in the editor registered for its KIND, so address it as { kind: "document", id: "<that table entry's id>" }.`:n.length===0?"":`This project's document table holds ${n.map(s=>`"${s}"`).join(", ")}; each opens as { kind: "document", id: "<the table entry's id>" }.`}async function rin(t,n){if(!n)return e_();if(!cvr(n.kind))throw new Error(`present-view does not know the document kind "${String(n.kind)}". An EditorView addresses a document by one of: ${QTt.join(", ")}. `+tin(String(n.kind)));switch(n.kind){case"scene":return Xnn();case"world":return Ynn(n);case"asset":case"tool":case"document":case"story":case"project-tool":case"generation":return ein(t,n);case"workspace":return Qnn(t,n)}}function nin(t){const n=t.indexOf(",");return{base64:n>=0?t.slice(n+1):t,mimeType:"image/png"}}const Cxt=gVe;function iin(t,n,s){if(!s?.degenerate)return null;const c=cVe();return!c||!n.contains(c)?null:`This door photographs the "${t}" document, which for a live three ingest holds the GAME'S own canvas — created without \`preserveDrawingBuffer\`, so its pixels can only be read from inside the game's own render pass. This game did not draw inside that window (a render-on-demand world sitting idle, or a loop the Edit-tab input gate has frozen), so the frame came back BLANK (${s.warning??"essentially one flat colour"}) — a PNG that reads as a real image. The editor's own renderer is drawing this same world in the Scene viewport (the mount adopts the captured scene), so capture \`workspace:scene\` instead — or drive the game until it renders and ask again.`}async function h9t(t,n){const s=CC();if(!s)throw new Error("No active editor document to capture.");const{descriptor:c,title:d}=s,m=ote(t),g={id:c.id,title:d,kind:c.kind,...c.provenance?.sourcePath?{sourcePath:c.provenance.sourcePath}:{},...c.provenance?.rootId?{rootId:c.provenance.rootId}:{}},S=o2(c.id);if(S?.capture){const J=S.capture(n);if(!J)throw new Error(`Object3D document could not be captured: ${c.id}`);return{...nin(J),document:g,view:m,source:"object3d-document"}}const k=c.id===a0?e9t()??Cxt(c.id):Cxt(c.id);if(!k)throw new Error(`Active document surface is not mounted: ${c.id}`);const A=i9t(k),F=await Wnn(A?.container??k,{canvasFrame:A?.canvasFrame??Jnn,includeDocumentStyles:c.id!==a0&&!A}),D=iin(c.id,k,F.flatness);if(D)throw new Error(D);return{base64:F.base64,mimeType:F.mimeType,document:g,view:m,source:c.id===a0?"game-composite":c.id==="workspace:scene"?"scene-viewport":"document-composite",layers:F.layers,...F.flatness?{flatness:F.flatness}:{}}}const oin="workspace:scene";function sin(t){return o2(t)??o2(oin)}function ain(t,n,s,c){const d=o2(n),m=sin(n);s.selection&&(d?.selection?d.selection.apply(s.selection.ids):t.selectMultiple(s.selection.ids));const g=s.viewport;g?.grid!==void 0&&(n&&F_e(n)?yAr(n,g.grid):c.push("This document draws no grid.")),g?.diagnostic&&!m?.setDiagnostic(g.diagnostic)&&c.push(`Diagnostic ${g.diagnostic} is unavailable for this document.`),g?.camera&&!m?.setCamera(g.camera)&&c.push(typeof g.camera=="string"?`${g.camera==="isometric"?"Isometric":g.camera} camera is unavailable for this document.`:"The camera is unavailable for this document."),s.selection?.focus||g?.frame==="selection"?m?.frame("selection")||c.push("The requested selection could not be framed."):g?.frame==="document"&&(m?.frame("document")||c.push("Document framing is unavailable for this document."))}async function Bge(t,n,s={}){if(n?.version!==1)throw new Error("present-view requires EditorView version 1.");const c=Object.keys(n).filter(F=>!Dmt.includes(F));if(c.length>0)throw new Error(`present-view does not know ${c.map(F=>`"${F}"`).join(", ")}. An EditorView carries: ${Dmt.join(", ")}. A document's own address (kind, and the fields that kind reads) goes under "document".`);const d=ote(t);if(n.style!==void 0){const F=OR().map(D=>D.id);if(!F.includes(n.style))throw new Error(`present-view requires a style of ${F.join(", ")}, got ${String(n.style)}.`);HBe(n.style)}if(n.workspace!==void 0){if(!kB(n.workspace))throw new Error(`present-view requires a workspace of ${$Be().join(", ")}, got ${String(n.workspace)}.`);if(zS()!==n.workspace){const F=hDt();s2(n.workspace),await Promise.race([F,new Promise(D=>setTimeout(D,3e3))])}}const m=[];n.keymap!==void 0&&n.keymap!==dR()&&m.push(`Keymap "${n.keymap}" was not applied — a view reports the keymap, it does not set it. This project is on "${dR()}" (its adapter's declaration, or its own settings).`);const g=await rin(t,n.document);await Knn(n.utility);const S=o2(g);if(await S?.prepare?.(),!S?.selection&&n.selection?.ids.length&&(n.document?.kind==="scene"||n.document?.kind==="world")){const F=n.selection.ids;if(!await EC(()=>F.every(J=>Y0(t).hierarchy.node(J)!==null),PR))throw new Error(`Shared view selection is not available: ${F.join(", ")}`)}g&&e_()!==g&&X0(g),ain(t,g,n,m),n.panel!==void 0&&await m9t(n.panel);const k=tCt(n,window.location.href);s.updateUrl!==!1&&window.history.replaceState(window.history.state,"",k);const A={view:n,url:k,warnings:m};return(s.origin??"agent")==="agent"&&(await Hnn()).showEditorPresentationNotice({presented:A,previousView:d}),A}const $ge=new Map;let g9t=0;const QMe=new Set;function y9t(){g9t+=1;for(const t of QMe)t()}function cin(t,n,s){const c=$ge.get(t);c&&c.assetPath===n&&c.actions.length===s.length&&c.actions.every((d,m)=>d===s[m])||($ge.set(t,{assetPath:n,actions:s}),y9t())}function lin(t){$ge.delete(t)&&y9t()}function uin(t){const n=[];for(const s of $ge.values())s.assetPath===t&&n.push(...s.actions);return n}function fin(t){return QMe.add(t),()=>QMe.delete(t)}function Ext(){return g9t}const din=[],kxt=new Set;let pin=0;function _in(t){for(const n of din)if(n.match(t))return n;return null}function min(t){return kxt.add(t),()=>{kxt.delete(t)}}function Axt(){return pin}const O_={open:{id:"project-asset.open",shortcut:"Enter"},rename:{id:"project-asset.rename",shortcut:"F2"},move:{id:"project-asset.move",shortcut:null},duplicate:{id:"project-asset.duplicate",shortcut:"Mod+D"},delete:{id:"project-asset.delete",shortcut:"Delete"},copyPath:{id:"project-asset.copy-path",shortcut:"Mod+Shift+C"},reveal:{id:"project-asset.reveal",shortcut:null},refresh:{id:"project-asset.refresh",shortcut:"Mod+R"},import:{id:"project-asset.import",shortcut:null},createFolder:{id:"project-asset.create-folder",shortcut:"Mod+Shift+N"}},eD=[],eje=new Set,BY=new Map;let v9t=0;function lOe(){v9t++;for(const t of eje)t()}function hin(t){const n=eD.findIndex(s=>s.owner===t.owner&&s.id===t.id);if(n>=0){const[s]=eD.splice(n,1);s&&(BY.get(s)?.(),BY.delete(s))}return eD.push(t),eD.sort((s,c)=>(s.order??0)-(c.order??0)),BY.set(t,t.subscribe(lOe)),lOe(),()=>{const s=eD.indexOf(t);s<0||(eD.splice(s,1),BY.get(t)?.(),BY.delete(t),lOe())}}const gin=[];function yin(){return eD.length===0?gin:eD}function b9t(t){return eje.add(t),()=>{eje.delete(t)}}function qge(){return v9t}function S9t(t){for(const n of eD){const s=n.entries({components:[t],surface:null})[0];if(s)return{source:n,entry:s}}return null}function vin(){const t=J0e();return t?{path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}}:null}function bin(t,n){return Ye.useEffect(()=>()=>lin(t),[t]),Ye.useCallback(s=>{n!==null&&cin(t,n,s)},[t,n])}function Sin({id:t,title:n,file:s,tool:c,Component:d}){Ye.useSyncExternalStore(U0e,qQ),Ye.useSyncExternalStore(Tye,cN,cN),Ye.useSyncExternalStore(Pye,lN,lN);const m=vin(),g=bin(t,m?.path??null),S=Ye.useRef(null),k=Ye.useCallback(F=>{S.current?.(),S.current=F===null?null:wBe(`building ${F.replace(/^building /,"")}`)},[]);Ye.useEffect(()=>()=>S.current?.(),[]);const A=Ye.useCallback(F=>s$({...F,id:`contribution:${t}:${F.title}`,...F.tone==="warning"?{fades:!0}:{}}),[t]);return $.jsxs("div",{"data-testid":`asset-inspector-tool-${t}`,style:{padding:8,borderTop:"1px solid var(--volter-structural-divider)",marginTop:4},children:[$.jsxs("div",{style:{...BCr,marginBottom:4},children:[$.jsx(dc,{icon:Kk.tool.extension,tone:"muted",style:{marginRight:4}}),n]}),$.jsx(TBe,{file:s,children:$.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:Kye(),surfaces:uBe,account:YLe(),play:Dye(),asset:m,setActions:g,notify:A,work:k})})]})}function xin(t,n){if(n<=0)return[];if(t.length===0)return Array.from({length:n},()=>0);const s=new Array(n),c=t.length/n;let d=0;for(let m=0;m<n;m++){const g=Math.floor(m*c),S=Math.max(g+1,Math.floor((m+1)*c));let k=0;for(let A=g;A<S;A++)k=Math.max(k,Math.abs(t[A]??0));s[m]=k,d=Math.max(d,k)}return d<=1e-8?s.fill(0):s.map(m=>m/d)}const x9t=32,tje=new Set,Dxt=new Map,Pxt=new Map;let sR=null,JZ=null,w9t=0,rje=0,VB=0,xN=0,Ixt=!1,pD={url:null,progress:0,playing:!1};function win(){for(const t of tje)t()}function I$(t){pD.url===t.url&&pD.playing===t.playing&&Math.abs(pD.progress-t.progress)<.002||(pD=t,win())}function TVe(){return sR??=new AudioContext,sR}function Tin(){if(Ixt||typeof window>"u")return;Ixt=!0;const t=()=>{if(!sR)return;const n=pD.url,s=xN;sR.resume().then(()=>{n&&s===xN&&!JZ&&sR?.state==="running"&&E9t(n,s)})};window.addEventListener("pointerdown",t,{capture:!0}),window.addEventListener("keydown",t,{capture:!0})}function CVe(){if(VB&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(VB),VB=0,!JZ)return;const t=JZ;JZ=null,t.onended=null;try{t.stop()}catch{}t.disconnect()}function T9t(){if(VB=0,!pD.playing||!sR||rje<=0)return;const t=Math.min(1,(sR.currentTime-w9t)/rje);I$({url:pD.url,progress:t,playing:t<1}),t<1&&typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(T9t))}function Cin(t,n,s){if(s!==xN)return;CVe();const c=TVe(),d=c.createBufferSource(),m=c.createGain();m.gain.value=1,d.buffer=t,d.connect(m),m.connect(c.destination),d.onended=()=>{s===xN&&I$({url:n,progress:1,playing:!1})},d.start(),JZ=d,w9t=c.currentTime,rje=t.duration,I$({url:n,progress:0,playing:!0}),typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(T9t))}async function C9t(t){const n=Dxt.get(t);if(n)return n;const s=(async()=>{const c=await fetch(t);if(!c.ok)throw new Error(`Audio preview could not read ${t}.`);const d=await c.arrayBuffer();return TVe().decodeAudioData(d.slice(0))})().catch(()=>null);return Dxt.set(t,s),s}async function E9t(t,n){Tin();const s=await C9t(t);if(n!==xN)return;if(!s){I$({url:t,progress:0,playing:!1});return}const c=TVe();c.state==="suspended"&&(await c.resume(),n!==xN)||c.state==="running"&&Cin(s,t,n)}function Ein(t){return tje.add(t),()=>tje.delete(t)}function kin(){return pD}function Ain(t){const n=++xN;CVe(),I$({url:t,progress:0,playing:!0}),E9t(t,n)}function Din(t){t&&pD.url!==t||(xN+=1,CVe(),I$({url:null,progress:0,playing:!1}))}function Pin(t,n=x9t){const s=`${t}#${n}`,c=Pxt.get(s);if(c)return c;const d=C9t(t).then(m=>m?xin(m.getChannelData(0),n):Array.from({length:n},()=>0));return Pxt.set(s,d),d}let _Z=[];function PSn(t){return _Z=[..._Z,t],()=>{_Z=_Z.filter(n=>n!==t)}}function k9t(t){return _Z.find(n=>n.accepts(t))??null}const EVe={folder:"var(--volter-asset-icon-folder)",model:"var(--volter-asset-icon-model)",prefab:"var(--volter-asset-icon-prefab)",component:"var(--volter-asset-icon-component)",audio:"var(--volter-asset-icon-audio)",image:"var(--volter-asset-icon-image)",video:"var(--volter-asset-icon-video)",json:"var(--volter-asset-icon-json)",unknown:"var(--volter-asset-icon-unknown)",source:"var(--volter-asset-icon-source)"},Iin={folder:uee,model:O0r,prefab:GB,component:eLe,audio:nLe,image:x0r,video:I0r,json:oLe,unknown:jTt,source:YTt};function vD({kind:t,size:n=24}){return $.jsx(dc,{icon:Iin[t],style:{fontSize:n,color:EVe[t]}})}const Nin=100,Oin=50,Rin=new WPt(t=>{const n=k9t(t);return n?n.render(t):Promise.reject(new Error(`No model preview loader for ${t}.`))},2);function A9t(t,n){const[s,c]=Ye.useState(null),[d,m]=Ye.useState(!1),[g,S]=Ye.useState(null),[k,A]=Ye.useState(!1);Ye.useEffect(()=>{c(null),m(!1),S(null),A(!1)},[t]),Ye.useEffect(()=>{let D=!1,J=null;return b$e().then(q=>{if(D)return;const G=q.status==="ok"?q.manifest.entries[t.replace(/^\/+/,"")]:void 0;if(!k&&G?.path&&(G.state==="generated"||G.state==="upstream")){S(G.path.startsWith("/")?G.path:`/${G.path}`);return}return J=Rin.request(t,n),J.promise}).then(q=>{!D&&q&&c(q)}).catch(()=>{D||m(!0)}),()=>{D=!0,J?.cancel()}},[k,n,t]);const F=Ye.useCallback(()=>{S(null),A(!0)},[]);return{src:g??s,fromManifest:g!==null,failed:d,rejectManifest:F}}function D9t({url:t}){const n=A9t(t,Nin);return n.failed?$.jsx(vD,{kind:"model"}):n.fromManifest&&n.src?$.jsx("img",{src:n.src,alt:"cached model preview",onError:n.rejectManifest,style:{width:"100%",height:"100%",objectFit:"contain"}}):n.src?$.jsx("img",{src:n.src,alt:"model preview",style:{width:"100%",height:"100%",objectFit:"contain"}}):$.jsx("div",{style:{width:28,height:28,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center"},children:$.jsx("div",{className:"volter-anim-spin",style:{width:16,height:16,border:`2px solid ${nhe[2]}`,borderTopColor:EVe.model,borderRadius:"50%"}})})}function Fin({url:t,name:n}){const[s,c]=Ye.useState(()=>Array.from({length:x9t},()=>.15)),d=Ye.useSyncExternalStore(Ein,kin);Ye.useEffect(()=>{let S=!1;return Pin(t).then(k=>{S||c(k)}),()=>{S=!0}},[t]);const m=d.url===t,g=m?d.progress:0;return $.jsx("div",{role:"img","aria-label":`${n} waveform preview`,style:{display:"flex",alignItems:"center",gap:1,width:"86%",height:"62%"},children:s.map((S,k)=>{const A=k/s.length<=g;return $.jsx("i",{style:{flex:1,height:`${12+S*88}%`,background:"var(--volter-asset-icon-audio)",opacity:m&&A?1:.28,borderRadius:1}},k)})})}function wR({kind:t,name:n,variant:s="tile"}){const c=EVe[t],d=s==="cell";return t==="audio"?$.jsxs("svg",{role:"img","aria-label":`${n} waveform preview`,viewBox:"0 0 64 48",width:d?"78%":52,height:d?"78%":44,children:[$.jsx("rect",{width:"64",height:"48",rx:"4",fill:"var(--volter-bg-inset)"}),Array.from({length:16},(m,g)=>$.jsx("rect",{x:g*4+1,y:24-g*13%18/2,width:"2",height:g*13%18+3,fill:c},g))]}):$.jsxs("svg",{role:"img","aria-label":`${n} ${t} preview`,viewBox:"0 0 52 48",width:d?"66%":48,height:d?"72%":44,children:[$.jsx("rect",{x:"5",y:"3",width:"42",height:"42",rx:"4",fill:"var(--volter-bg-inset)",stroke:c}),$.jsx("path",{d:"M13 15h26M13 23h18M13 31h22",stroke:c,strokeWidth:"3",strokeLinecap:"round"})]})}function P9t(t,n,s,c){if(t<=0||n<=0||s<=0||c<=0)return 1;const d=t<=s?Math.floor(s/t):0,m=n<=c?Math.floor(c/n):0,g=Math.min(d,m);return g>=1?g:1/Math.max(Math.ceil(t/s),Math.ceil(n/c))}function ISn(t,n,s,c,d){return t==="fit"?P9t(n,s,c,d):t}function Min(t,n,s){const c=Math.max(1,s.sourceWidth??s.width),d=Math.max(1,s.sourceHeight??s.height);t.width=c,t.height=d;const m=t.getContext("2d");if(!m)return;m.imageSmoothingEnabled=!1,m.clearRect(0,0,c,d);const g=HYr(s);if(s.rotated){m.save(),m.translate(s.trimX,s.trimY+g.width),m.rotate(-Math.PI/2),m.drawImage(n,g.x,g.y,g.width,g.height,0,0,g.width,g.height),m.restore();return}m.drawImage(n,g.x,g.y,g.width,g.height,s.trimX,s.trimY,g.width,g.height)}function I9t({sheetUrl:t,frame:n,scale:s,maxEdge:c}){const d=Ye.useRef(null),m=Math.max(1,n.sourceWidth??n.width),g=Math.max(1,n.sourceHeight??n.height),S=c!=null?P9t(m,g,c,c):s??1,k=Math.max(1,Math.round(m*S)),A=Math.max(1,Math.round(g*S));return Ye.useEffect(()=>{const F=d.current;if(!F)return;const D=new Image;let J=!1;return D.onload=()=>{J||Min(F,D,n)},D.src=t,()=>{J=!0}},[n,t]),$.jsx("canvas",{ref:d,width:m,height:g,"aria-hidden":!0,style:{width:k,height:A,imageRendering:"pixelated",display:"block"}})}const N9t={fontSize:11,color:Zf[3],marginBottom:2},jin={fontSize:11,color:Zf[1],wordBreak:"break-all"};function uOe({asset:t}){Ye.useSyncExternalStore(l2,rA,rA);const n={path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}};return MDt().map(s=>{let c=!1;try{c=s.match(n)}catch(d){console.error(`[tool contributions] ${s.file}'s asset match() threw.`,d)}return c?$.jsx(Sin,{id:s.id,title:s.title,file:s.file,tool:s.tool,Component:s.Component},`${s.id}:${s.version}`):null})}function Nxt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ph({label:t,value:n}){return $.jsxs("div",{children:[$.jsx("div",{style:N9t,children:t}),$.jsx("div",{style:jin,children:n})]})}function Lin({asset:t}){const n=t.capabilities?.editor==="environment";Ye.useSyncExternalStore(b9t,qge,qge);const s=t.componentPreview,c=s?S9t({name:t.name,path:s.sourcePath,surface:s.surface}):null;return $.jsx("div",{"data-testid":"inspector-asset-preview",style:{position:"absolute",inset:0,background:hBe.inset,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:c?$.jsx(c.source.Thumbnail,{entry:c.entry,previewRevision:0}):n?$.jsx(wR,{kind:"image",name:t.name,variant:"cell"}):t.kind==="image"?$.jsx($in,{path:t.path,name:t.name}):t.kind==="video"?$.jsx(Bin,{path:t.path}):t.kind==="model"?$.jsx(D9t,{url:t.path}):$.jsx(wR,{kind:t.kind,name:t.name,variant:"cell"})})}function Bin({path:t}){return $.jsx("video",{src:t,muted:!0,preload:"metadata",style:{width:"100%",height:"100%",objectFit:"contain"}})}function $in({path:t,name:n}){const{sheetPath:s,frameName:c}=H0e(t),[d,m]=Ye.useState(null);return Ye.useEffect(()=>{if(!c){m(null);return}let g=!1;return fetch(`/${PRt(s)}`).then(S=>S.ok?S.text():null).then(S=>{if(g||!S)return;const k=Nze(S);m(k?.frames.find(A=>A.name===c)??null)}).catch(()=>{g||m(null)}),()=>{g=!0}},[c,s]),d?$.jsx(I9t,{sheetUrl:`/${s}`,frame:d,maxEdge:96}):$.jsx("img",{src:t.split("#")[0],alt:n,style:{width:"100%",height:"100%",objectFit:"contain"}})}function qin({asset:t}){const[n,s]=Ye.useState(null),{sheetPath:c,frameName:d}=H0e(t.path);return Ye.useEffect(()=>{if(s(null),t.kind!=="image"||t.capabilities?.editor==="environment")return;let m=!1;if(d)return fetch(`/${PRt(c)}`).then(S=>S.ok?S.text():null).then(S=>{if(m||!S)return;const k=Nze(S)?.frames.find(A=>A.name===d);k&&s({w:k.sourceWidth,h:k.sourceHeight})}).catch(()=>{}),()=>{m=!0};const g=new Image;return g.onload=()=>{m||s({w:g.naturalWidth,h:g.naturalHeight})},g.src=t.path.split("#")[0]??t.path,()=>{m=!0}},[t.capabilities?.editor,t.kind,t.path,d,c]),n?$.jsx(Ph,{label:"Dimensions",value:`${n.w} × ${n.h}`}):null}function zin(){Ye.useSyncExternalStore(min,Axt,Axt);const t=J0e();if(!t)return null;const n=_in(t),s=t.name.includes(".")?t.name.split(".").pop()??"":"";return n?$.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",borderBottom:`1px solid ${nhe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[$.jsx(n.View,{asset:t}),$.jsx(uOe,{asset:t})]}):(t.selectionCount??1)===1&&(t.kind==="image"&&!t.path.includes("#")&&t.capabilities?.editor!=="environment"||t.kind==="video"||t.kind==="audio")?$.jsxs($.Fragment,{children:[$.jsx(zRt,{assetPath:t.path,kind:t.kind,sizeBytes:t.sizeBytes}),$.jsxs("div",{style:{padding:"0 8px",display:"grid",gap:6},children:[t.health&&t.health!=="healthy"&&$.jsx(Ph,{label:"Health",value:t.health}),!!t.healthCodes?.length&&$.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.sourcePath&&$.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!!t.dependencies?.length&&$.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")}),!!t.references?.length&&$.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")})]}),$.jsx(uOe,{asset:t})]}):$.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${nhe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[$.jsx(qin,{asset:t}),$.jsx("div",{style:{...N9t,marginBottom:0,textTransform:"uppercase"},children:"Asset"}),$.jsx("div",{style:{fontWeight:600,fontSize:12,color:Zf[1],wordBreak:"break-all"},children:t.name}),$.jsx(Ph,{label:"Path",value:t.path}),t.componentPreview&&$.jsx(Ph,{label:"Surface",value:t.componentPreview.surface==="canvas"?"2D / Pixi":t.componentPreview.surface==="three"?"3D / Three":t.componentPreview.surface}),t.selectionCount&&t.selectionCount>1&&$.jsxs($.Fragment,{children:[$.jsx(Ph,{label:"Selection",value:`${t.selectionCount} assets`}),t.selectionTotalBytes!==void 0&&$.jsx(Ph,{label:"Total size",value:Nxt(t.selectionTotalBytes)}),t.selectionFormats&&$.jsx(Ph,{label:"Formats",value:t.selectionFormats.join(", ")})]}),s&&$.jsx(Ph,{label:"Format",value:s.toUpperCase()}),t.sizeBytes!==void 0&&$.jsx(Ph,{label:"Size",value:Nxt(t.sizeBytes)}),t.capabilities&&$.jsxs($.Fragment,{children:[$.jsx(Ph,{label:"Runtime readiness",value:t.capabilities.runtimeReady?"Runtime-ready":"Import or conversion required"}),$.jsx(Ph,{label:"Preview",value:t.capabilities.previewable?"Available":"Unsupported"}),$.jsx(Ph,{label:"Placement",value:t.capabilities.placeable?"Placeable":"Not placeable"}),$.jsx(Ph,{label:"Editor",value:FB(t.capabilities)??"No editor"})]}),t.health&&$.jsx(Ph,{label:"Health",value:t.health}),t.healthCodes&&$.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.dependencies&&$.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")||"None"}),t.references&&$.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")||"None"}),t.sourcePath&&$.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!t.componentPreview&&$.jsxs("div",{style:{display:"flex",gap:6},children:[$.jsx(Ms,{type:"button","data-command-id":O_.open.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:open-project-asset",{detail:{path:t.path}})),children:"Open"}),t.selectionCount&&t.selectionCount>1&&$.jsxs($.Fragment,{children:[$.jsx(Ms,{type:"button","data-command-id":O_.move.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:O_.move.id}})),children:"Move selected"}),$.jsx(Ms,{type:"button","data-command-id":O_.delete.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:O_.delete.id}})),children:"Delete selected"})]})]}),$.jsx("div",{style:{fontSize:10,color:Zf[3]},children:"Double-click (or press Enter) in the asset browser to open the full viewer."}),$.jsx(uOe,{asset:t})]})}function Vin(t){return uin(t).map(n=>({id:n.id,title:n.title,...n.label===void 0?{}:{label:n.label},placement:"identity",...n.disabled===void 0?{}:{disabled:n.disabled},run:n.run}))}function Uin(){const t=J0e();if(t===null)return null;const n=Oye();return n&&(n.adapter!==null||n.nodeId!==null)?null:{quickActions:Vin(t.path),id:`asset:${t.path}`,title:t.name,kindLabel:t.online?`${t.kind} · ${t.online.source}`:t.kind,note:{text:t.sourcePath??t.path,testId:"inspector-asset-path"},sections:[{id:LRe,title:"Preview",icon:iB,order:x4t,body:{kind:"preview",render:()=>$.jsx(Lin,{asset:t})}},{id:"asset-selection",title:"Asset",icon:R$,order:fQ,body:{kind:"custom",render:()=>$.jsx(zin,{})},keepMounted:!0}]}}const Jin={loop:"Loop control","contract.root":"DOM root","contract.lifecycle.start":"Cold start","contract.lifecycle.pause":"Pause / resume",persistence:"Source persistence",systems:"Commands and state"};function Win(t){const n=Jin[t];if(n)return n;const[s,c]=t.split("."),d=(c??t).replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase(),m=d.charAt(0).toUpperCase()+d.slice(1);return s==="system"?`${m} adapter`:m}const Hin={ok:N0r,gap:MTt,na:X0r,info:R$},Gin={ok:Go.semantic.success,gap:Go.semantic.warning,na:Go.content.dim,info:Go.content.dim};function Kin({row:t}){return $.jsxs("div",{"data-testid":`ingest-coverage-row-${t.seam}`,"data-status":t.status,style:{display:"grid",gridTemplateColumns:"16px minmax(0, 1fr)",gap:7,padding:"8px 10px",borderTop:"1px solid var(--volter-structural-divider)"},children:[$.jsx("span",{style:{color:Gin[t.status],paddingTop:1},children:$.jsx(dc,{icon:Hin[t.status]})}),$.jsxs("div",{style:{minWidth:0},children:[$.jsx("div",{style:{color:Go.content.primary,fontWeight:600},children:Win(t.seam)}),$.jsx("div",{style:{marginTop:2,color:Go.content.muted,lineHeight:1.4,overflowWrap:"anywhere"},children:t.detail}),t.missing&&$.jsxs("div",{style:{marginTop:6,color:Go.content.muted,lineHeight:1.4},children:[$.jsx("strong",{style:{color:Go.semantic.warning},children:"Missing:"})," ",t.missing]}),t.fix&&$.jsxs("div",{style:{marginTop:4,color:Go.content.dim,lineHeight:1.4},children:[$.jsx("strong",{children:"Fix:"})," ",t.fix]})]})]})}function Xin({report:t}){const{summary:n}=t;return $.jsxs("div",{"data-testid":"ingest-coverage-report",style:{fontSize:"var(--volter-font-base)"},children:[$.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,padding:"7px 10px 9px",color:Go.content.muted},children:[$.jsxs("span",{style:{color:n.gaps>0?Go.semantic.warning:Go.semantic.success},children:[n.gaps," ",n.gaps===1?"gap":"gaps"]}),$.jsxs("span",{children:[n.ok," integrated"]}),$.jsxs("span",{children:[n.na," not applicable"]}),$.jsxs("span",{children:[n.info," informational"]})]}),t.rows.map(s=>$.jsx(Kin,{row:s},s.seam))]})}function Yin(t){return{id:"ingest-coverage",title:"Ingest coverage",icon:UTt,order:9e3,description:`${t.summary.gaps} gap${t.summary.gaps===1?"":"s"}`,defaultOpen:!0,testId:"ingest-coverage-section",body:{kind:"custom",render:()=>$.jsx(Xin,{report:t}),data:{summary:t.summary,rows:t.rows}}}}function Zin(t,n,s){if(t)return t.nodeId;const c=[...n].at(-1);if(c)return c;const d=s.selection?.get().at(-1)??null;if(d===null)return null;const m=s.hierarchy.roots();return m.length===1&&m[0]?.id===d?null:d}const O9t="inspectorPresentation";function Qin(t){return t==="card"||t==="column"||t==="properties"}function Oxt(){const t=ZAr(O9t);if(!t||typeof t!="object")return{};const n={};for(const[s,c]of Object.entries(t))Qin(c)&&(n[s]=c);return n}let UB=null,nve=0;const UO=new Set;let fOe=null;YDt().then(()=>{UB=null,nve++;for(const t of UO)t()});function eon(){nve++;for(const t of UO)t()}function R9t(){if(UB===null){if(!YAr())return Oxt();UB=Oxt()}return UB}function nje(t){return R9t()[t]??null}function kVe(t,n){if(znn("volter.properties"),nje(t)!==n){UB={...R9t(),[t]:n},nve++,QAr(O9t,UB);for(const s of UO)s()}}function ton(t){return UO.size===0&&(fOe=HAr(eon)),UO.add(t),()=>{UO.delete(t),UO.size===0&&(fOe?.(),fOe=null)}}function Rxt(){return nve}function ron(t,n,s=null){return n??s??t}function F9t(t){return t.sections.map(n=>({id:n.id,title:n.title,icon:n.icon,...n.railGroup===void 0?{}:{railGroup:n.railGroup},...n.railDefault===void 0?{}:{railDefault:n.railDefault}}))}function ije(t){return t==="three"||t==="canvas"||t==="dom"?t:null}function non(t,n){const s=n.selectedEntityId;if(s===null)return null;const c=t.childAdapters(),d=c.find(m=>m.worldId===t.ownerOf(s))??c.find(m=>t.groupNodeId(m.worldId)===s);return d?ije(d.kind):null}function ion(t){const n=iBe();if(n!==null&&n.documentId===e_())return"asset-lab";const{adapter:s,surface:c}=Cm(t);if(c)return c;if(s instanceof hy){const d=s.childAdapters(),m=d.length===1?ije(d[0]?.kind??""):null;if(m)return m;const g=non(s,t);if(g)return g}return ije(tve()??"")??"three"}function oon({stories:t,activeStoryId:n,onApplyStory:s,isolation:c,unavailableReason:d}){return $.jsxs("div",{style:{padding:"4px 0"},children:[t.length>0?$.jsxs(Iw,{"data-testid":"ingest-stories-select",value:n,onChange:m=>{const g=m.target.value;s(g===""?null:g)},style:{width:"100%"},children:[$.jsx("option",{value:"",children:"(none)"}),t.map(m=>$.jsx("option",{value:m.id,children:m.label},m.id))]}):$.jsx("div",{"data-testid":"ingest-stories-none",style:{fontSize:"var(--volter-font-base)",color:Go.content.dim,fontStyle:"italic"},children:d??"No stories — this root has no associated portable CSF previews."}),c&&$.jsx(Ms,{"data-testid":"catalog-isolate",onClick:c.toggle,variant:c.isolated?"primary":"secondary","aria-pressed":c.isolated,style:{marginTop:6,width:"100%"},children:c.isolated?"Exit isolation":"Isolate"})]})}const bD=180/Math.PI;function M9t(t,n,s){const c=Math.cos(t/2),d=Math.cos(n/2),m=Math.cos(s/2),g=Math.sin(t/2),S=Math.sin(n/2),k=Math.sin(s/2);return[g*d*m+c*S*k,c*S*m-g*d*k,c*d*k+g*S*m,c*d*m-g*S*k]}function son([t,n,s,c]){const d=t+t,m=n+n,g=s+s,S=t*d,k=t*m,A=t*g,F=n*m,D=n*g,J=s*g,q=c*d,G=c*m,se=c*g,pe=1-(F+J),ue=k-se,Ce=A+G,Fe=1-(S+J),De=D-q,be=D+q,X=1-(S+F),we=Math.asin(Math.min(Math.max(Ce,-1),1));return Math.abs(Ce)<.9999999?[Math.atan2(-De,X),we,Math.atan2(-ue,pe)]:[Math.atan2(be,Fe),we,0]}function AVe(t){const[n,s,c,d]=t,m=n*n+s*s+c*c+d*d,g=Math.sqrt(m),S=m<Number.EPSILON?[0,0,0,1]:[n/g,s/g,c/g,d/g],[k,A,F]=son(S);return[k*bD,A*bD,F*bD]}function aon(t,n,s){if(s.length!==3||s.some(d=>!Number.isFinite(d)))throw new Error(`transform.${n} expects three finite numbers.`);const c={position:[...t.position],rotation:[...t.rotation],scale:[...t.scale]};return n==="rotation"?{...c,rotation:M9t(s[0]/bD,s[1]/bD,s[2]/bD)}:{...c,[n]:[s[0],s[1],s[2]]}}function con(t,n,s){const c=AVe(t.rotation);return c[n]=s,{position:[...t.position],rotation:M9t(c[0]/bD,c[1]/bD,c[2]/bD),scale:[...t.scale]}}const lon={x:"#e0726d",y:"#83bd66",z:"#6390dd"};function dOe({axes:t,label:n,values:s,testidPrefix:c,step:d,precision:m,onBegin:g,onPreview:S,onCommit:k,readOnly:A,readOnlyReason:F}){const[D,J]=Ye.useState(null),q=Ye.useRef(!1);return $.jsx(T_e,{label:n,style:{padding:"4px 8px"},children:t.map(({axis:G,name:se})=>$.jsx(SZ,{testId:`${c}-${se}`,label:se,labelColor:lon[se],title:F,disabled:A,step:d,precision:m,value:D?.axis===G?D.value:Number.isFinite(s[G])?s[G]:0,style:{flex:1,minWidth:0},onChange:pe=>{q.current||(q.current=!0,g?.()),J({axis:G,value:pe}),S?.(G,pe)},onChangeEnd:pe=>{q.current=!1,J(null),k(G,pe)}},se))})}function uon({dimensions:t="3d",transform:n,readOnly:s=!1,channelEditability:c,note:d,onBegin:m,onPreview:g,onCommit:S}){const k=[{axis:0,name:"x"},{axis:1,name:"y"}],A=[...k,{axis:2,name:"z"}],F=(se,pe,ue)=>{const Ce={position:[...n.position],rotation:[...n.rotation],scale:[...n.scale]};return Ce[pe][se]=ue,Ce},D=(se,pe)=>(ue,Ce)=>{Number.isFinite(Ce)&&pe?.(F(ue,se,Ce))},J=se=>(pe,ue)=>{Number.isFinite(ue)&&se?.(con(n,pe,ue))},q=se=>{const pe=c?.[se],ue=s||pe?.writable===!1;return pe?.reason?{readOnly:ue,readOnlyReason:pe.reason}:{readOnly:ue}},G=[...new Set(["position","rotation","scale"].map(se=>q(se)).filter(se=>se.readOnly&&se.readOnlyReason).map(se=>se.readOnlyReason))];return $.jsxs(MTr,{children:[$.jsx(dOe,{axes:t==="2d"?k:A,label:"Position",testidPrefix:"ingest-position",values:n.position,step:.1,precision:3,...q("position"),onBegin:m,onPreview:g&&D("position",g),onCommit:D("position",S)}),$.jsx(dOe,{axes:t==="2d"?[{axis:2,name:"z"}]:A,label:t==="2d"?"Rotation (degrees)":"Rotation",testidPrefix:"ingest-rotation",values:AVe(n.rotation),step:1,precision:1,...q("rotation"),onBegin:m,onPreview:g&&J(g),onCommit:J(S)}),$.jsx(dOe,{axes:t==="2d"?k:A,label:"Scale",testidPrefix:"ingest-scale",values:n.scale,step:.01,precision:3,...q("scale"),onBegin:m,onPreview:g&&D("scale",g),onCommit:D("scale",S)}),G.map(se=>$.jsx(_p,{"data-testid":"inspector-transform-readonly-reason",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:se},se)),d&&$.jsx(_p,{"data-testid":"inspector-transform-note",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:d})]})}function Fxt(t){return t.revertsTo===void 0?`Revert ${t.label} to default`:`Revert ${t.label} to ${t.revertsTo}`}function fon({value:t,onCommit:n,onPreview:s,...c}){const[d,m]=Ye.useState(null),g=Ye.useRef(null),S=Ye.useRef(null),k=Ye.useRef({draft:d,onCommit:n});return k.current={draft:d,onCommit:n},Ye.useEffect(()=>{const A=g.current;if(!A)return;const F=()=>{const{draft:D,onCommit:J}=k.current,q=D??A.value;q&&q!==S.current&&J(q),S.current=null,m(null)};return A.addEventListener("change",F),()=>A.removeEventListener("change",F)},[]),$.jsx(a4t,{...c,ref:g,value:d??t,onChange:A=>{S.current===null&&(S.current=t),m(A.target.value),s?.(A.target.value)}})}async function j9t(t,n=qRt){const s=await Promise.all(n.map(c=>don(t,c)));return{assets:s.flatMap(c=>c.assets),failedListings:s.flatMap(c=>c.failedListings)}}async function don(t,n){const s=[""],c=[],d=[];let m=0;for(;s.length>0&&m<512;){const g=s.splice(0,8),S=await Promise.all(g.map(k=>t(n,k)));m+=g.length,S.forEach((k,A)=>{const F=g[A];if(!k.ok){d.push(`${n}/${F}: ${k.reason}`);return}for(const D of k.entries){const J=F?`${F}/${D.name}`:D.name;D.type==="directory"?s.push(J):c.push({path:J,root:n,entry:D})}})}return{assets:c,failedListings:d}}async function pon(t,n){const s=t.filter(S=>S.root==="public"),c=_on(s),d=(await Promise.all(c.map(async S=>{const k=await n(S.path);if(!k)return null;const A=Nze(k);return A?{sidecar:S,parsed:A}:null}))).flatMap(S=>S?[S]:[]),m=new Set;for(const{sidecar:S,parsed:k}of d){m.add(S.path);const A=Mxt(S.path);for(const F of zYr(k.image))m.add(A?`${A}/${F}`:F);for(const F of s)yMe(F.path)===yMe(S.path)&&m.add(F.path)}const g=d.flatMap(({sidecar:S,parsed:k})=>{const A=Mxt(S.path),F=A?`${A}/${k.image}`:k.image;return k.frames.map(D=>({path:`${F}#${D.name}`,root:S.root,entry:{name:`${D.name}.png`,type:"file",...S.entry.size===void 0?{}:{size:S.entry.size},...S.entry.modifiedAt===void 0?{}:{modifiedAt:S.entry.modifiedAt}},spritesheet:{sheetPath:F,x:D.x,y:D.y,width:D.width,height:D.height,rotated:D.rotated,sourceWidth:D.sourceWidth,sourceHeight:D.sourceHeight,trimX:D.trimX,trimY:D.trimY}}))});return[...t.filter(S=>S.root!=="public"||!m.has(S.path)),...g]}function _on(t){const n=new Map;for(const s of t){if(!/\.json$/i.test(s.path))continue;const c=yMe(s.path),d=n.get(c);(!d||OSt(s.path)>OSt(d.path))&&n.set(c,s)}return[...n.values()]}function Mxt(t){const n=t.lastIndexOf("/");return n<0?"":t.slice(0,n)}function L9t(t){const n=ig(t).kind;return n==="model"||n==="image"||n==="video"||n==="audio"?n:"other"}function mon(t){const n=ig(t.entry.name);return n.placeable&&n.runtimeReady?10:n.kind==="model"&&n.runtimeReady?15:n.kind==="prefab"?25:n.runtimeReady&&(n.kind==="image"||n.kind==="audio")?30:n.runtimeReady?40:n.importable?70:90}function hon(t){return(t.surface==="three"?0:t.surface==="canvas"?10:t.surface==="dom"?20:30)+(t.exported?0:4)}const gon=1e4,yon={paths:[],failures:[]};let $Y=null;async function von(){const t=await j9t(K0e,["public"]);return{paths:t.assets.filter(n=>L9t(n.entry.name)==="image").map(n=>n.path).sort((n,s)=>n.localeCompare(s)),failures:t.failedListings}}function bon(){const t=Date.now();return(!$Y||t-$Y.at>gon)&&($Y={at:t,scan:von().catch(n=>($Y=null,{paths:[],failures:[n instanceof Error?n.message:String(n)]}))}),$Y.scan}function Son(t){const[n,s]=Ye.useState(yon);return Ye.useEffect(()=>{let c=!0;return bon().then(d=>{c&&s(d)}),()=>{c=!1}},[t]),n}const xon={width:64},jxt={width:$Cr,fontSize:"var(--volter-font-md)",color:Go.content.muted};function AI(t){return`ingest-prop-${t.replace(/\./g,"-")}`}function won({field:t,io:n,value:s}){const{paths:c,failures:d}=Son(!0),[m,g]=Ye.useState(null),S=F=>{g(null),Promise.resolve(n.set(t.path,F===""?null:F)).then(D=>{g(D&&!D.persisted?{forValue:F,text:`Not saved — ${D.destination}. See the editor console for the mechanism.`}:null)})},k=m?.forValue===s?m.text:void 0,A=d.length>0?`${d.length} folder(s) under public/ could not be read — this list may be incomplete.`:void 0;return $.jsx(qCr,{testId:AI(t.path),value:s,options:c,previewUrlFor:F=>`/${F}`,disabled:t.readonly,note:k??A,onChange:S})}function Ton({field:t,io:n}){const s=t,c=n.get(s.path),d=jRe(c)?void 0:c,m=s.defaulted===!0&&d===void 0,g=s.readonly?CBe(s):void 0,S=s.resettable?$.jsx(dm,{"data-testid":`ingest-revert-${s.path.replace(/\./g,"-")}`,"aria-label":Fxt(s),title:Fxt(s),onClick:()=>n.remove?.(s.path),children:$.jsx(dc,{icon:LOe})}):null;return s.type==="boolean"?$.jsxs("label",{title:g,style:{display:"flex",gap:6,alignItems:"center",padding:"6px 8px",fontSize:"var(--volter-font-md)"},children:[$.jsx(TD,{"data-testid":AI(s.path),checked:!!d,ref:k=>{k&&(k.indeterminate=m)},disabled:s.readonly,onChange:k=>n.set(s.path,k.target.checked)}),$.jsx("span",{style:s.defaulted?{color:Go.content.dim}:void 0,children:s.label}),S]}):$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},children:[$.jsx("span",{style:s.defaulted?{...jxt,color:Go.content.dim}:jxt,title:g??(s.defaulted?`${s.label} — default (not set here)`:s.label),children:s.label}),s.type==="color"?$.jsx(fon,{"data-testid":s.path==="material.color"?"ingest-color":AI(s.path),value:d??"#ffffff",disabled:s.readonly,onCommit:k=>n.set(s.path,k),onPreview:k=>n.preview?.(s.path,k)}):s.type==="number"?$.jsx(NRe,{type:"number","data-testid":AI(s.path),disabled:s.readonly,value:typeof d=="number"?String(Math.round(d*1e3)/1e3):"",placeholder:m?"—":void 0,onCommit:k=>{const A=Number.parseFloat(k);Number.isFinite(A)&&n.set(s.path,A)},style:xon}):s.type==="enum"?$.jsxs(Iw,{"data-testid":AI(s.path),disabled:s.readonly,value:String(d??""),onChange:k=>{const A=s.options?.find(F=>String(F)===k.target.value)??k.target.value;n.set(s.path,A)},style:{width:120},children:[m&&$.jsx("option",{value:"",children:"—"}),(s.options??[]).map(k=>$.jsx("option",{value:String(k),children:String(k)},String(k)))]}):s.type==="vec3"?$.jsx("div",{style:{width:190},children:$.jsx(LCr,{value:Array.isArray(d)&&d.length===3?[Number(d[0]),Number(d[1]),Number(d[2])]:[null,null,null],disabled:!!s.readonly,testIdPrefix:AI(s.path),onChange:k=>n.set(s.path,k)})}):s.type==="asset"?$.jsx(won,{field:s,io:n,value:typeof d=="string"?d:""}):s.type==="json"?$.jsx(yBe,{"data-testid":AI(s.path),"data-variant":"code",disabled:s.readonly,defaultValue:m?"":JSON.stringify(d??null),placeholder:m?"—":void 0,onBlur:k=>{try{n.set(s.path,JSON.parse(k.target.value))}catch{}},style:{width:160}},`${s.path}:${JSON.stringify(d??null)}`):$.jsx(NRe,{type:"text","data-testid":AI(s.path),readOnly:s.readonly,value:String(d??""),placeholder:m?"—":void 0,onCommit:k=>n.set(s.path,k),style:{width:120}}),S]})}function B9t({fields:t,io:n}){return $.jsx($.Fragment,{children:t.map(s=>$.jsx(Ton,{field:s,io:n},s.path))})}function ive(t){const[n,s]=Ye.useState(null);return Ye.useEffect(()=>{let c=0;const d=requestAnimationFrame(()=>{c=requestAnimationFrame(()=>s(t))});return()=>{cancelAnimationFrame(d),cancelAnimationFrame(c)}},[t]),n===t}const Con=Ye.lazy(()=>fo(()=>import("./InspectorCanvasPreview-BrFjhoiD.js"),__vite__mapDeps([261,1,2,3,4])).then(t=>({default:t.InspectorCanvasPreview})));function NSn({picture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=ive(n);return $.jsxs("div",{"data-testid":d?"inspection-preview-thumbnail":"inspection-preview",style:d?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[m&&$.jsx(Ye.Suspense,{fallback:null,children:t()}),!d&&s.map(g=>$.jsx(Ms,{"data-testid":g.id,size:"compact",disabled:g.disabled,title:g.title,onClick:g.run,style:{position:"absolute",right:8,bottom:8},children:g.label},g.id))]})}function Eon({source:t,entry:n,previewKey:s,actions:c,mode:d="section"}){const m=d==="thumbnail",g=ive(s);return $.jsxs("div",{"data-testid":m?"inspection-preview-thumbnail":"inspection-preview",style:m?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[g&&$.jsx("div",{style:{position:"absolute",inset:0,overflow:"hidden",background:"var(--volter-bg-inset)"},children:$.jsx(t.Thumbnail,{entry:n,previewRevision:0,width:m?96:256,height:m?96:256})}),!m&&c.map(S=>$.jsx(Ms,{"data-testid":S.id,size:"compact",disabled:S.disabled,title:S.title,onClick:S.run,style:{position:"absolute",right:8,bottom:8},children:S.label},S.id))]})}function kon({capture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=ive(n);return $.jsxs("div",{"data-testid":d?"inspection-preview-thumbnail":"inspection-preview",style:d?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[m&&$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(Con,{capture:t,previewKey:n,size:d?96:256})}),!d&&s.map(g=>$.jsx(Ms,{"data-testid":g.id,size:"compact",disabled:g.disabled,title:g.title,onClick:g.run,style:{position:"absolute",right:8,bottom:8},children:g.label},g.id))]})}function Aon(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Don(t){const n=[],s=[],c=new Map;for(const d of t)d.group?(c.has(d.group)||(c.set(d.group,[]),s.push(d.group)),c.get(d.group).push(d)):n.push(d);return{ungrouped:n,groups:s.map(d=>({name:d,groupId:Aon(d),properties:c.get(d)}))}}function Pon(t,n){if(!t.transforms)return null;const s=t.transforms.dimensions?.(n);return s!==void 0?s:t.hierarchy.object3D===void 0||t.hierarchy.object3D(n)!==null?"3d":null}const Ion=14,Non=[[/physic|rigid|collid/i,F0r],[/material/i,l0r],[/light/i,Qje],[/camera/i,nye],[/audio|sound|music/i,nLe],[/player|character|humanoid|person/i,R0r],[/anim|state|machine/i,OTt]];function Oon(t){for(const[n,s]of Non)if(n.test(t))return s;return GB}function Ron(t){return n=>Ye.createElement(Eon,{source:t.picture.source,entry:t.picture.entry,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Fon(t){return n=>Ye.createElement(kon,{capture:t.capture,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Mon(t){return t.media?t.media.preview?t.media.preview({displayName:t.displayName,previewKey:t.previewKey,actions:t.actions}):null:t.canvasCapture?Fon({capture:t.canvasCapture,previewKey:t.previewKey,actions:t.actions}):t.picture?Ron({picture:t.picture,previewKey:t.previewKey,actions:t.actions}):null}function pOe(t){const n=t.slice(10);if(n!=="position"&&n!=="rotation"&&n!=="scale")throw new Error(`The Transform section has no ${JSON.stringify(t)}.`);return n}const jon={position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]};function Lon(t,n,s,c){if(T4t(t))return t.sections(c,n);const d=t.Section;return[{id:t.id,title:t.title,icon:typeof t.icon=="function"?t.icon(c,n):t.icon,order:t.order,...t.railGroup===void 0?{}:{railGroup:t.railGroup},...t.railDefault===void 0?{}:{railDefault:t.railDefault},body:{kind:"custom",render:()=>Ye.createElement(d,{adapter:n,nodeId:s})}}]}function $9t(t,n,s,c){const d=new Set,m=new Map,g=[];for(const S of t){const k=Lon(S,n,s,c).filter(F=>!d.has(F.id)),A=(T4t(S)?S.claims??[]:[]).filter(F=>!d.has(F));if(!(k.length===0&&A.length===0)){for(const F of k)d.add(F.id),m.set(F.id,S.owner);for(const F of A)d.add(F);g.push(...k)}}return{sections:g,claimed:d,owners:m}}function q9t(t,n,s){return s===void 0?[...t]:t.filter(c=>n.get(c.id)===s.owner||s.builtins.includes(c.id))}function oje(t){const{adapter:n,nullSubject:s}=t,{sections:c,claimed:d,owners:m}=$9t(n?t.contributions??[]:[],n,null,null),g=q9t([...(s?.sections??[]).filter(S=>!d.has(S.id)),...c].sort((S,k)=>S.order-k.order),m,t.rail);return{id:s?.id??"nothing-selected",title:s?.title??"Nothing selected",identity:s?.kindLabel?{rename:{readOnly:!0,set:()=>{}},kindLabel:s.kindLabel,...s.note?{note:s.note}:{}}:null,...s?.hint?{hint:s.hint}:{},presentation:{preferred:EBe(t.surface)},quickActions:s?.quickActions??[],related:[],sections:g}}function Bon(t,n,s){if(t.body.kind!=="custom"||t.body.editable)return t;const c=s.get(t.id);return!c||c.length===0?t:{...t,body:{...t.body,editable:{fields:c,io:n}}}}function $on(t){const{adapter:n,nodeId:s,node:c,contributions:d,onEdit:m}=t;if(s===null)return oje({nullSubject:t.nullSubject??null,surface:t.surface,contributions:d,adapter:n,rail:t.rail});const{sections:g,claimed:S,owners:k}=$9t(d,n,s,c),A={get:en=>n.inspector?.get(s,en),...n.inspector?.preview?{preview:(en,ii)=>{n.inspector?.preview?.(s,en,ii)}}:{},set:(en,ii)=>{if(!n.inspector)return;const No=dPt(n,s,en,ii);return m(),No},...n.inspector?.remove?{remove:en=>{const ii=E3r(n,s,en);return m(),ii}}:{}},F=n.inspector?.properties(s)??[],D=F.find(en=>en.path==="name"),{ungrouped:J,groups:q}=Don(F.filter(en=>en.path!=="name")),G=J.find(en=>en.path==="visible"&&en.type==="boolean"),se=G?J.filter(en=>en!==G):J,pe=[...D&&D.readonly!==!0?[D]:[],...G?[G]:[]],ue=[];if(G){const en=A.get(G.path)!==!1,ii=en?"Visible — click to hide":"Hidden — click to show";ue.push({id:"inspector-visibility-toggle",title:ii,icon:en?Zje:sLe,placement:"identity",pressed:!en,disabled:G.readonly===!0,run:async()=>{await A.set(G.path,!en)}})}t.assetDocument&&ue.push({id:"open-asset-editor",title:"Open in Asset Editor",label:"Open in Asset Editor",placement:"preview",run:t.assetDocument.open}),n.transforms?.sourceCommit?.availability(s)?.available&&ue.push({id:"commit-live-transform-source",title:"Commit this live transform to its authored source literal",label:"Commit transform to source",icon:RTt,placement:"identity",run:async()=>{await uPt(n,s),m()}});const De=new Map;De.set(D5e,se);for(const en of q)De.set(Lht(en.groupId),en.properties);const be=[],X=n.truth?.resolve(s,"position").site??null,we=t.media,Be=c?.typeLabel??c?.label??s,bt=t.surface==="canvas"&&we===null&&t.stories?S9t({name:Be,path:X?.anchored===!0?X.file:"",surface:"canvas"}):null,It=ue.filter(en=>en.placement==="preview"),Wt=Mon({media:we,canvasCapture:t.canvasPreview,picture:bt,displayName:c?.label??s,previewKey:s,actions:It});!S.has(LRe)&&Wt!==null&&be.push({id:LRe,title:"Preview",icon:aR,order:x4t,body:{kind:"preview",render:Wt}});const zt=Pon(n,s),ft=!S.has(jht)&&zt!==null,tr=ft?q.find(en=>en.name==="Transform")?.properties??[]:[];if(ft){const en=n.transforms?.get(s)??jon,ii=we?.instanced??null,No=Object.fromEntries(["position","rotation","scale"].map(En=>[En,n.transforms?.editability?.(s,En)??{writable:n.capabilities.transform}])),gn={position:[...en.position],rotation:AVe(en.rotation),scale:[...en.scale]};be.push({id:jht,title:"Transform",icon:$Tt,order:aEr,body:{kind:"custom",data:{...gn,editability:No,...ii?{instanced:ii}:{}},editable:{fields:["position","rotation","scale"].map(En=>{const cs=!n.capabilities.transform||!No[En].writable;return{path:`transform.${En}`,label:En[0].toUpperCase()+En.slice(1),type:"vec3",value:gn[En],readonly:cs,...!cs&&n.transforms?.remove&&No[En].removable===!0?{resettable:!0}:{}}}),io:{get:En=>gn[pOe(En)],set:(En,cs)=>{if(!n.transforms)return;const On=aon(en,pOe(En),cs);NFe(n,s),q_e(n,s,On);const ji=OFe(n,s);return m(),ji},...n.transforms?.remove?{remove:En=>{const cs=lPt(n,s,pOe(En));return m(),cs}}:{}}},render:()=>[Ye.createElement(uon,{key:"channels",dimensions:zt,transform:en,readOnly:!n.capabilities.transform,channelEditability:No,...ii?.note?{note:ii.note}:{},onBegin:()=>{NFe(n,s)},onPreview:En=>{q_e(n,s,En)},onCommit:En=>{q_e(n,s,En),OFe(n,s),m()}}),...tr.length>0?[Ye.createElement(B9t,{key:"rows",fields:tr,io:A})]:[]]}})}S.has(D5e)||(se.length>0&&be.push({id:D5e,title:"Properties",icon:qTt,order:fQ,defaultOpen:!0,body:{kind:"fields",fields:se,io:A}}),q.forEach((en,ii)=>{if(tr.length>0&&en.name==="Transform")return;const No=en.properties.filter(gn=>!gn.defaulted).length;be.push({id:Lht(en.groupId),title:en.name,icon:Oon(en.name),order:w4t+ii,description:No>0?`${No} set of ${en.properties.length}`:`${en.properties.length} properties`,defaultOpen:No>0&&en.properties.length<=Ion,testId:`ingest-group-${en.groupId}`,body:{kind:"fields",fields:en.properties,io:A}})}));const Qt=t.stories;!S.has(S4t)&&Qt&&be.push(qon(Qt)),be.push(...g.map(en=>Bon(en,A,De))),be.sort((en,ii)=>en.order-ii.order);const Tt=q9t(be,k,t.rail),vn=bPt(n,s),Yr=SPt(n);return{id:s,title:c?.label??"",identity:{rename:{readOnly:D===void 0||D.readonly===!0,set:en=>A.set("name",en)},kindLabel:`${c?.typeLabel??c?.kind??""}${vn?` · ${vn.label}`:""}`,...c?.kind?{kind:c.kind}:{},...Yr?{document:{path:Yr,...vn?.detail?{title:vn.detail}:{}}}:{},note:X?.anchored?{text:`${X.kind==="data"?"Level data":"Source"} · ${X.display}`,title:X.kind==="data"?`Placed by record ${X.record} of ${X.file}, the game's own level data`:`Constructed by a \`new\` expression at ${X.file} line ${X.line}, column ${X.col}`,testId:"inspector-creation-site"}:void 0},presentation:{preferred:EBe(t.surface)},...pe.length>0?{editable:{fields:pe,io:A}}:{},...t.alsoSelected?{alsoSelected:t.alsoSelected}:{},quickActions:ue,related:n.related?.links(s)??[],sections:Tt}}function qon(t){return{id:S4t,title:t.title??"Stories",icon:aLe,order:cEr,body:{kind:"custom",render:()=>Ye.createElement(oon,{stories:t.stories,activeStoryId:t.activeStoryId,onApplyStory:t.onApplyStory,isolation:t.isolation,unavailableReason:t.unavailableReason??null})}}}const zon=["project-tool","tool-contribution"];function Von(t){const{activeDocumentKind:n,documentSelection:s}=t;return n===null||!zon.includes(n)?!1:s===null}function Lxt(t){const{subject:n,surface:s,available:c,override:d,workspaceDefault:m=null,columnShown:g=!0}=t,S=n.presentation.preferred??EBe(),k=ron(S,d,m),A=k!=="card"&&!g?"card":k;return{subject:n,surface:s,presentation:A,available:c,card:c&&A==="card",column:A!=="card"}}const z9t="game";function Uon(t){const n=t.projectName?.trim();return{id:z9t,title:n&&n.length>0?n:"Game",kindLabel:"Game",...t.instanceName?{note:{text:t.instanceName}}:{},sections:[]}}function OSn(t){return m$e({match:()=>e_()===a0,describe:()=>Uon(t())})}const Jon=3,Won=Object.freeze({none:!0});function Hon(t){const n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function eee(t,n=0){if(t===null)return null;const s=typeof t;if(s==="string"||s==="boolean")return t;if(s==="number")return Number.isFinite(t)?t===0?0:t:{kind:"opaque",type:"number"};if(s!=="object")return{kind:"opaque",type:s};if(n>=Jon)return{kind:"opaque",type:Bxt(t)};if(Array.isArray(t))return t.map(m=>eee(m,n+1));const c=t;if(!Hon(c))return{kind:"opaque",type:Bxt(c)};const d={};for(const[m,g]of Object.entries(c))g!==void 0&&(d[m]=eee(g,n+1));return d}function Bxt(t){return t.constructor?.name??"object"}function $xt(t,n){let s;try{s=n.get(t.path)}catch{s=void 0}return{path:t.path,label:t.label,type:t.type,...jRe(s)?{mixed:!0}:{},...!jRe(s)&&s!==void 0?{value:eee(s)}:{},...t.defaulted!==void 0?{defaulted:t.defaulted}:{},...t.readonly!==void 0?{readonly:t.readonly}:{},...t.readonly?{readonlyReason:CBe(t)}:{},...t.resettable!==void 0?{resettable:t.resettable}:{},...t.revertsTo!==void 0?{revertsTo:t.revertsTo}:{},...t.group!==void 0?{group:t.group}:{},...t.options!==void 0?{options:t.options.map(c=>eee(c))}:{}}}function qxt(t){const n={};for(const[s,c]of Object.entries(t))c!==void 0&&(n[s]=eee(c));return n}function Gon(t){const n=t.body;if(n.kind==="fields")return{kind:"fields",fields:n.fields.map(s=>$xt(s,n.io))};if(n.kind==="custom"&&n.data!==void 0&&n.editable===void 0)return{kind:"custom",id:t.id,title:t.title,data:qxt(n.data)};if(n.kind==="custom"&&n.editable!==void 0){const s=n.editable;return{kind:"fields",fields:s.fields.map(c=>$xt(c,s.io)),...n.data!==void 0?{data:qxt(n.data)}:{}}}return{kind:n.kind,id:t.id,title:t.title}}function Kon(t){return{id:t.id,title:t.title,order:t.order,...t.description!==void 0?{description:t.description}:{},body:Gon(t)}}function Xon(t,n){return{id:t.id,title:t.title,...t.identity?.kindLabel?{kindLabel:t.identity.kindLabel}:{},...t.identity?.note?{note:t.identity.note.text}:{},...t.hint?{hint:t.hint}:{},...t.alsoSelected?{alsoSelected:t.alsoSelected}:{},presentation:{preferred:t.presentation.preferred,...n?{resolved:n.presentation,surface:n.surface}:{}},quickActions:t.quickActions.map(s=>({id:s.id,title:s.title,...s.label!==void 0?{label:s.label}:{},...s.pressed!==void 0?{pressed:s.pressed}:{},...s.disabled!==void 0?{disabled:s.disabled}:{}})),related:t.related.map(({id:s,title:c})=>({id:s,title:c})),sections:t.sections.map(Kon)}}const zxt=new WeakMap;function Yon(t){if(!t.capture)return null;const n=zxt.get(t);if(n)return n;const s=async c=>t.capture?.(c)??null;return zxt.set(t,s),s}function Zon(t){return typeof t.previewImage=="function"}function Qon(t,n,s){if(!n)return null;if(s==="asset-lab"){const d=o2(e_());return d?Yon(d):null}let c=t;if(t instanceof hy){const d=t.ownerOf(n);c=t.childAdapters().find(m=>m.worldId===d)?.adapter??t}return Zon(c)?d=>c.previewImage(n,d,d):null}function esn(){const t=e_();if(t===null)return null;const n=gtn(t);if(n===void 0)return null;const s=PN(n.kind);return s===void 0||s.inspectorRail!=="owned"?null:{rail:{owner:s.owner,builtins:s.inspectorBuiltins??[]}}}function tsn(t){const{store:n,adapter:s,documentSelection:c,surface:d}=t,m=Uin();if(m!==null)return{subject:oje({nullSubject:m,surface:d}),available:!0};const g=Zin(c,n.selectedEntityIds,s),S=g?s.hierarchy.node(g):null;if(g!==null&&S===null)return{subject:oje({nullSubject:null,surface:d}),available:!1};const k=()=>n.notifyIngestEdit(),A=g?null:Z3r({adapter:s,surface:d,store:n,onEdit:k}),F=g?S?qht(S,s):[]:qht(null,s,{nullSubjectId:A?.id??null}),D=g?kze(s,g):null;return{subject:$on({adapter:s,nodeId:g,node:S,surface:d,contributions:F,...g?{}:{nullSubject:A},media:d==="asset-lab"?null:D,canvasPreview:Qon(s,g,d),assetDocument:D?.assetDocument??null,stories:H3r(s,S,g),...esn()??{},...c===null&&g!==null&&n.selectedEntityIds.size>1?{alsoSelected:n.selectedEntityIds.size-1}:{},onEdit:k}),available:g!==null||A!==null||F.length>0}}function ove(t){const n=ion(t),{adapter:s,documentSelection:c}=Cm(t),d=tsn({store:t,adapter:s,documentSelection:c,surface:n}),{subject:m}=d,g=d.available&&(m.id!==z9t||m.sections.length>0)&&!Von({activeDocumentKind:CC()?.descriptor.kind??null,documentSelection:c}),S=e_()===a0?dVe():null;if(S){const k=Yin(S),A=g?{...m,sections:[...m.sections.filter(F=>F.id!==k.id),k].sort((F,D)=>F.order-D.order)}:{id:`ingest:${S.summary.worldId}`,title:"Ingested game",identity:null,hint:"This mount exposes no editable scene subject. Coverage below says exactly which editor seams it did earn.",presentation:m.presentation,quickActions:[],related:[],sections:[k]};return Lxt({subject:A,surface:n,available:!0,override:nje(n),workspaceDefault:mD().inspector??null,columnShown:vgt("properties")!==!1})}return Lxt({subject:m,surface:n,available:g,override:nje(n),workspaceDefault:mD().inspector??null,columnShown:vgt("properties")!==!1})}function sve(t){const{subject:n,surface:s,presentation:c,available:d}=ove(t);return d?Xon(n,{surface:s,presentation:c}):Won}async function rsn(t,n){const{subject:s,available:c}=ove(t);if(!c)throw new Error("No Inspector subject is active.");const d=s.quickActions.filter(g=>g.id===n);if(d.length!==1){const g=s.quickActions.map(S=>S.id);throw new Error(d.length===0?`Inspector action ${JSON.stringify(n)} is not available. `+(g.length>0?`Available actions: ${g.join(", ")}.`:"This subject exposes no actions."):`Inspector action id ${JSON.stringify(n)} is ambiguous (${d.length} matches).`)}const m=d[0];if(!m||m.disabled)throw new Error(`Inspector action ${JSON.stringify(n)} is disabled.`);return await m.run(),sve(t)}function nsn(t,n){const s=c=>{throw new Error(`Inspector field ${JSON.stringify(t.path)} expects ${c}.`)};if(t.type==="number"&&(typeof n!="number"||!Number.isFinite(n))&&s("a finite number"),t.type==="boolean"&&typeof n!="boolean"&&s("a boolean"),(t.type==="string"||t.type==="color"||t.type==="asset"||t.type==="enum")&&typeof n!="string"&&s("a string"),t.type==="vec3"&&(!Array.isArray(n)||n.length!==3||n.some(c=>typeof c!="number"||!Number.isFinite(c)))&&s("three finite numbers"),t.type==="enum"&&t.options&&!t.options.includes(n))throw new Error(`Inspector field ${JSON.stringify(t.path)} accepts: ${t.options.map(String).join(", ")}.`)}async function isn(t,n,s){const c=V9t(t,n);nsn(c.field,s);const d=await c.io.set(n,s)??Rhe;return{subject:sve(t),write:d}}function V9t(t,n){const{subject:s,available:c}=ove(t);if(!c)throw new Error("No Inspector subject is active.");const d=(s.editable?.fields??[]).filter(k=>k.path===n).map(k=>({field:k,io:s.editable.io})),m=s.sections.flatMap(k=>{const A=k.body,F=A.kind==="fields"?{fields:A.fields,io:A.io}:A.kind==="custom"?A.editable:void 0;return F?F.fields.filter(D=>D.path===n).map(D=>({field:D,io:F.io})):[]}),g=[...d,...m];if(g.length===0)throw new Error(`The active Inspector has no field at ${JSON.stringify(n)}.`);if(g.length>1)throw new Error(`The active Inspector exposes ${JSON.stringify(n)} more than once.`);const S=g[0];if(S.field.readonly)throw new Error(`Inspector field ${JSON.stringify(n)} is read-only: ${CBe(S.field)}`);return S}class sje extends Error{constructor(n){super(n),this.name="InspectionRemovalUnavailableError"}}async function osn(t,n){const s=V9t(t,n);if(s.field.resettable!==!0)throw new sje(`Inspector field ${JSON.stringify(n)} does not declare itself removable (\`resettable\`), so this lane has no way to express the property's absence. Write a value with \`set-inspection-field\` instead — and note that doing so cannot restore byte-absence for a property an edit ADDED.`);if(!s.io.remove)throw new sje(`The Inspector io that owns ${JSON.stringify(n)} implements no removal door, so the property's authored override cannot be dropped through this editor. The dialect writer that owns this source edit owns removal too; until it does, an edit/revert round trip over this lane is unverifiable at byte level.`);const c=await s.io.remove(n)??Rhe;return{subject:sve(t),write:c}}const DVe=new Map;let U9t=[];const aje=new Set;function J9t(){U9t=[...DVe.values()];for(const t of aje)t()}function RSn(t){return aje.add(t),()=>aje.delete(t)}function FSn(t){DVe.set(t.rootId,t),J9t()}function MSn(t){DVe.delete(t)&&J9t()}function W9t(){return U9t}function ssn(){const t=W9t();if(t.length===0)return null;const n=t.filter(s=>s.source==="measured");return n.length===0?null:`${n.length} of ${t.length} root(s) have NO readiness declaration (${n.map(s=>s.rootId).join(", ")}) — the host is measuring instead. A self-booting game states it with \`window.volterGame.ready\`.`}function asn(t){return t.liveMounted?t.livePlaying?t.storePlayState==="paused"?"paused":"playing":"paused":"stopped"}async function csn(t,n){switch(t.reach.kind){case"game-contract":{const s=n.scenes();if(!s)return{ok:!1,code:"SCENE_CONTRACT_UNAVAILABLE",error:`open: "${t.id}" is reached through the running game's own scenes contract, and the game running in this session publishes none (\`window.volterGame.scenes\`).`};const c=s.goToScene(t.reach.sceneId);if(!c.ok)return{ok:!1,code:"SCENE_NOT_IN_CONTRACT",error:`open: "${t.id}" — ${c.error}`,known:c.known};const d=await c.settled;return d.error!==void 0?{ok:!1,code:"SCENE_SWITCH_FAILED",error:`open: "${t.id}" — the game's own navigation failed: ${d.error}`}:(n.activateGameDocument(),{ok:!0,documentId:n.gameDocumentId,title:t.label,scene:{requested:d.requested,current:d.current}})}case"root-mount":return n.activateGameDocument()?{ok:!0,documentId:n.gameDocumentId,title:t.label}:{ok:!1,code:"SCENE_DOCUMENT_NOT_MOUNTED",error:`open: "${t.id}" is the running game itself, and no game document is open in this session.`};case"entrypoint-selection":{const s=n.remountSelection,c=t.region;if(!s||c===null)return{ok:!1,code:"SCENE_NOT_OPENABLE_LIVE",error:`open: "${t.id}" sits at the entrypoint's \`${t.reach.selection}\` swap slot, and this session has no live remount for a native swap-slot scene — a running game cannot be sent there in place. Stop the game and open it as a document instead.`};const d=await s({selection:t.reach.selection,key:t.reach.key,regionId:c});return d.ok?(n.activateGameDocument(),{ok:!0,documentId:n.gameDocumentId,title:t.label,scene:{requested:t.reach.key,current:t.reach.key},restart:!0}):{ok:!1,code:"SCENE_SWITCH_FAILED",error:`open: "${t.id}" — remount at \`${t.reach.selection}["${t.reach.key}"]\` failed: ${d.error}`}}case"story":case"none":return null}}const zge="console";function lsn(t){let n=zQ().length>0;const s=CRt(()=>{const m=zQ().length>0;m&&!n&&mD().drawer!=="hidden"&&bC(zge),n=m});let c=t.getSnapshot().lastError!==null;const d=t.subscribe(()=>{const m=t.getSnapshot().lastError,g=m!==null;g&&!c&&(ea.error(`Source write rolled back: ${m.message} (${m.code})`,"history"),mD().drawer!=="hidden"&&bC(zge)),c=g});return()=>{s(),d()}}function ave(){rkr(zge)}function cve(){bC(zge)}const Vge=new Map;function jSn(t){return n=>{if(n.phase==="adopted"){Vge.set(t,{source:n.source,sceneId:n.sceneId,cameraId:n.cameraId,alternates:[]});return}const s=Vge.get(t);s&&s.alternates.push({sceneId:n.sceneId,cameraId:n.cameraId,sameRenderer:n.sameRenderer,drawCount:n.drawCount})}}function LSn(t){Vge.delete(t)}function usn(){return[...Vge].map(([t,n])=>({rootId:t,source:n.source,sceneId:n.sceneId,cameraId:n.cameraId,alternates:[...n.alternates],...n.alternates.length>0?{ambiguity:`"${t}" rendered ${n.alternates.length} other world(s) after the one the editor adopted (${n.source}: ${n.sceneId}). The adopted world is unchanged; if the editor is showing the wrong scene, one of these is it: `+n.alternates.map(s=>`${s.sceneId}${s.sameRenderer?"":" (a SECOND renderer)"}`).join(", ")}:{}}))}const fsn=new Set(["state","stateAll","providers","commands","events","snapshot"]);function dsn(t){if(t.type!=="bridge-call")return[];const n=t.method;if(typeof n!="string"||!fsn.has(n))return[];const s=t.instance;try{const c=qwr(s).debug;if(c===void 0)return[];const d=[v3t(c),s??""].join(":"),m=(S,k="")=>[d,S,k].join(":");if(n==="snapshot")return[m("snapshot"),m("state","time"),m("stateAll"),m("events")];const g=n==="state"?String(t.callArgs?.[0]):"";return[m(n,g)]}catch{return[]}}function psn(t,n,s){const c=dsn(t),d=n&&c.length>0&&c.every(m=>s.has(m));if(n)for(const m of c)s.add(m);return{derived:d?"none":n&&c.length>0?"always":$vr(t.type)??Lvr(t.type),playFullReport:n&&!d&&c.length>0?"explicit":n&&t.type==="bridge-call"&&t.method==="invoke"?"if-content-changed":"none"}}function _sn(t,n,s,c){return t==="none"?!1:!(t==="if-content-changed"&&n==="none"&&s===c)}function Vxt(t,n){const s=nq(t);return s.hierarchy.node(n)!==null||kze(s,n)!==null?null:`select: no entity with id "${n}" — neither the active authoring adapter's hierarchy nor the live object index owns it, so there is nothing to select. Read the ids that exist with editor.hierarchy() (the rows the panel is rendering) or editor.status().entities.`}function _Oe(t,n,s){const c=o2(e_())?.selection;if(c){c.apply(n);return}const d=t.applySelectionBeforePresentation(n);s?.deferPresentation?s.deferPresentation(d):setTimeout(d,0)}function msn(){return typeof document>"u"?null:{visibility:document.visibilityState,focused:document.hasFocus(),reportedAt:Date.now()}}const hsn=["entities","entityCount","ontologyInvariants"];function gsn(t){const n={...t};for(const s of hsn)delete n[s];for(const s of zrn())delete n[s];return{...n,_statePatch:!0}}function Uxt(t,n=null){const s=zQ(),c=e_(),d=Pze(t),m=g4t.getSnapshot(),g=n?.entities??W0e(t);return{playState:asn({storePlayState:t.playState,liveMounted:_Ve(),livePlaying:rve()}),mountFailures:s.map(S=>({...S})),storyFailures:rq().flatMap(S=>S.ok?[]:[{modulePath:S.modulePath,error:S.error}]),moduleSplits:tnn().map(S=>({path:S.path,urls:[...S.urls]})),adapter:u0(),readiness:W9t().map(S=>({...S})),readinessWarning:ssn(),worldAdoption:usn().map(S=>({...S})),presence:msn(),pageErrors:ysn(),consoleErrors:vsn(),sessionErrors:bsn(),sessionWarnings:Ssn(),rendererResources:{...onn()},ontologyInvariants:n?.ontologyInvariants??_9t().map(S=>({...S})),...qrn(n),selectedEntityId:d[0]??null,selectedEntityIds:d,selectedCreationSite:FYr(t),selectedWriteAnchorKind:MYr(t),activeViewportTab:t.activeViewportTab,activeDocumentId:c,activeUtilityId:ekr(),gameplaySession:{selectedSessionId:m.selectedSessionId,latestSessionId:m.sessions[0]?.id??null,selectedStatus:m.selectedSession?.status??null,cursorMs:m.cursorMs,liveEdgeMs:m.liveEdgeMs},openDocumentIds:l0().map(S=>S.descriptor.id),availableDocuments:Q0e().map(S=>({id:S.descriptor.id,category:S.category,default:S.default})),activeTabKey:(()=>{const S=e_();return S&&JRt(S)?S:"__inspector__"})(),entityCount:g.length,savePath:Dze(t),saveState:ERt(t),entities:g,viewportActivationTimings:aTr()}}function H9t(t,n){const s=n instanceof Error?n.message:String(n),c=`editor command "${String(t.type)}" threw: ${s}`;return console.error(c,n),{ok:!1,error:c}}function PVe(t){const n=aVe();return!n||t<n.startedAt?!1:n.endedAt===null||t<=n.endedAt}function ysn(){return ea.getEntries().filter(t=>t.level==="error"&&t.source==="runtime"&&PVe(t.timestamp)).slice(-100).map(t=>t.count>1?`${t.message} (×${t.count})`:t.message)}const Jxt=200;function vsn(){return IVe(ea.getEntries().filter(t=>t.level==="error"&&t.source!=="runtime"&&PVe(t.timestamp)))}function IVe(t){const n=t.reduce((c,d)=>c+d.count,0),s=t.slice(-3).map(c=>{const d=c.source?`[${c.source}] `:"",m=c.count>1?` (×${c.count})`:"",g=c.message.length>Jxt?`${c.message.slice(0,Jxt)}…`:c.message;return`${d}${g}${m}`});return{count:n,recent:s}}function bsn(){return IVe(ea.getEntries().filter(t=>t.level==="error"&&!PVe(t.timestamp)))}function Ssn(){return IVe(ea.getEntries().filter(t=>t.level==="warn"))}async function xsn(t){const n=t.src;if(typeof n!="string")return{ok:!1,error:`document-script requires a string "src" (the step's toString())`};const s=e_();if(!s)return{ok:!1,error:"document-script: no document is active",data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE"}};await p4t(s);const c=cQ(s);if(e_()!==s)return{ok:!1,error:"document-script: the active document changed while its context was loading",data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE",documentId:s}};if(c===void 0)return{ok:!1,error:`document-script: the active document (${s}) publishes no context to run against — a document opts in through its \`publishContext\` prop (the mesh document publishes its session).`,data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE",documentId:s}};let d;try{d=new Function("ctx","info",`return (${n})(ctx, info)`)}catch(m){return{ok:!1,error:`document-script: failed to reconstruct the step function from source — ${m instanceof Error?m.message:String(m)}`,data:{code:"DOCUMENT_SCRIPT_ERROR"}}}try{const m=await d(c,{documentId:s});return{ok:!0,data:{result:m===void 0?null:m}}}catch(m){return{ok:!1,error:`document-script: step threw — ${m instanceof Error?m.message:String(m)}`,data:{code:"DOCUMENT_SCRIPT_ERROR"}}}}async function wsn(t,n,s){if(LYr(n.type),gYr()&&n.type!=="stop")return{ok:!1,error:"Video export owns this paused run. Stop it to cancel before another command."};const c=uVe(n);if(c)return c;if(n.type==="play"||n.type==="restart"){const g=zQ();if(g.length>0)return{ok:!1,error:`this project's ${g.length===1?"root":"roots"} did not mount, so there is nothing to ${n.type==="play"?"play":"restart"}: `+g.map(S=>`"${S.worldId}" (${S.identity}) — ${S.message}`).join("; ")}}const d=await BYr(n.type);if(d)try{const g=await d.handle(n);return{ok:g.ok,...g.error!==void 0?{error:g.error}:{},...g.data!==void 0?{data:g.data}:{}}}catch(g){return H9t(n,g)}if(!sye(n.type))return{ok:!1,error:`unknown command type "${n.type}" — not one of the editor's own, and no package this project declares contributes it (or the editor page predates this CLI)`,data:{code:"UNKNOWN_COMMAND_TYPE"}};const m=n.type;switch(m){case"session-prepare-close":return await nnn(),{ok:!0};case"select":{const g=n.id??null;if(g!==null){const S=Vxt(t,g);if(S)return{ok:!1,error:S}}_Oe(t,g?[g]:[],s);break}case"select-multiple":{const g=n.ids;for(const S of g){const k=Vxt(t,S);if(k)return{ok:!1,error:k}}_Oe(t,g,s);break}case"select-all":{_Oe(t,W0e(t).map(g=>g.id),s);break}case"viewport-tab":{const g=n.tab;if(g!=="edit"&&g!=="play")return{ok:!1,error:`viewport-tab requires "edit" or "play", got ${String(g)}.`};const S=l0().map(A=>A.descriptor.id),k=g==="play"?S.find(A=>A===a0):S.find(A=>A==="workspace:scene")??S.find(A=>A!==a0);if(!k||!X0(k))return{ok:!1,error:g==="play"?"viewport-tab play: no Game document is open. Start Play first.":"viewport-tab edit: no document other than Game is open."};break}case"show-panel":try{const g=n.panel;return typeof g!="string"||g.trim()===""?{ok:!1,error:'show-panel requires a non-empty "panel".'}:{ok:!0,data:{panel:await m9t(g)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"active-tab":{const g=n.key;if(g!=="__inspector__"&&!X0(g)){const S=l0().map(k=>k.descriptor.id);return{ok:!1,error:`No open workspace document with id "${g}" — nothing was activated. `+(S.length>0?`Open documents: ${S.join(", ")}.`:"No documents are open in this workspace.")}}break}case"select-asset":{const g=n.path;if(typeof g!="string"||g.trim()==="")return{ok:!1,error:'select-asset requires a non-empty "path".'};const S=g.replace(/^\/+/,""),k=S.split("/").pop()??S,A=ig(k);BI({path:g,name:k,kind:FB(A)??"unknown",capabilities:A,origin:"project"});break}case"open-asset-tab":{const g=n.kind,S=sN(n.path,g);if(!await WRt(S,g))return{ok:!1,error:`Asset document did not finish mounting its Inspector: ${S}`};break}case"close-asset-tab":{const g=n.key;JRt(g)&&EN(g);break}case"toggle-command-palette":SVe();break;case"toggle-console":ave();break;case"page-reload":return setTimeout(()=>{window.location.reload()},0),{ok:!0,data:{scheduled:!0}};case"set-workspace":{const g=n.workspace;if(!kB(g))return{ok:!1,error:`set-workspace requires one of ${$Be().join(", ")}, got ${String(g)}.`};if(zS()===g)return{ok:!0,data:{workspace:g,applied:!0}};const S=hDt().then(()=>!0);s2(g);const k=await Promise.race([S,new Promise(A=>setTimeout(()=>A(!1),3e3))]);return{ok:!0,data:{workspace:g,applied:k}}}case"set-style":{const g=n.style,S=OR().map(A=>A.id);if(typeof g!="string"||!S.includes(g))return{ok:!1,error:`set-style requires one of ${S.join(", ")}, got ${String(g)}.`};HBe(g);const k=Ahe();return k!==g?{ok:!1,error:`set-style applied "${g}" but the editor is wearing ${k===null?"a custom mix of axes":`"${k}"`} (${lgt(g).join("; ")}).`,data:{style:k,differences:lgt(g)}}:{ok:!0,data:{style:g}}}case"viewport-presentation":{const g=n.documentId;if(typeof g!="string"||g==="")return{ok:!1,error:"viewport-presentation needs a `documentId` (a document stage)."};const S=F_e(g)===null&&F_e(`document:${g}`)!==null?`document:${g}`:g,k=n.layer;if(k!==void 0){if(typeof k!="object"||k===null)return{ok:!1,error:"viewport-presentation `layer` must be a presentation layer object."};GBe(S,k)}const A=n.preset;return A!==void 0&&(typeof A!="string"||!bAr(S,A))?{ok:!1,error:`viewport-presentation \`preset\` must be one of: ${fgt().map(F=>F.id).join(", ")||"(none registered)"}.`}:{ok:!0,data:{presentation:KBe(S),binding:F_e(S),bound:TAr(),lastDraw:wAr(S),presets:hAr().map(F=>F.id),viewPresets:fgt().map(F=>F.id),environmentImages:DAr().map(F=>F.id)}}}case"set-appearance":{const g=n.material;return g===void 0?{ok:!1,error:"set-appearance needs a `material` to set."}:Rye(g)?(TDt(g),{ok:!0,data:{material:_N(),style:Ahe()}}):{ok:!1,error:`set-appearance material must be one of ${ATr().map(k=>k.id).join(", ")}, got ${String(g)}.`}}case"present-view":try{return{ok:!0,data:{...await Bge(t,n.view)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"current-view":return{ok:!0,data:{view:ote(t)}};case"inspect":return{ok:!0,data:{subject:sve(t)}};case"run-inspection-action":try{const g=n.actionId;if(typeof g!="string"||g.trim()==="")throw new Error("run-inspection-action requires a non-empty actionId.");return{ok:!0,data:{subject:await rsn(t,g)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"run-command":try{const g=n.commandId;if(typeof g!="string"||g.trim()==="")throw new Error("run-command requires a non-empty commandId.");const S=await Unn(g,n.args);return{ok:!0,data:{result:S===void 0?null:S}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"hierarchy":{const g=gxt();return g===null?{ok:!1,error:"the hierarchy panel (GameHierarchy) is not mounted — no row tree is rendered, so there is nothing to report. Open the Hierarchy panel in the workspace dock and retry."}:{ok:!0,data:{hierarchy:Wrn(g,{playState:t.playState,activeViewportTab:t.activeViewportTab})}}}case"expand-hierarchy-all":case"collapse-hierarchy-all":{const g=n.type==="expand-hierarchy-all",S=gxt();if(S===null)return{ok:!1,error:`the hierarchy panel (GameHierarchy) is not mounted — no row tree is rendered, so there is nothing to ${g?"expand":"collapse"}. Open the Hierarchy panel in the workspace dock and retry.`};const k=Urn();g?S.expandAll():S.collapseAll();try{await k}catch(A){return{ok:!1,error:A instanceof Error?A.message:String(A)}}return{ok:!0,data:{}}}case"undo":case"redo":{const g=s?.history;if(!g)return{ok:!1,error:`${String(n.type)}: this editor has no history session attached, so there is nothing to undo.`};const S=n.type==="undo"?await g.undo():await g.redo(),k=g.getSnapshot();return{ok:!0,data:{moved:S,canUndo:k.canUndo,canRedo:k.canRedo,undoLabel:k.undoLabel,redoLabel:k.redoLabel}}}case"set-inspection-field":try{const g=n.path;if(typeof g!="string"||g.trim()==="")throw new Error("set-inspection-field requires a non-empty field path.");const S=await isn(t,g,n.value);return{ok:!0,data:{subject:S.subject,write:S.write}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"remove-inspection-field":try{const g=n.path;if(typeof g!="string"||g.trim()==="")throw new Error("remove-inspection-field requires a non-empty field path.");const S=await osn(t,g);return{ok:!0,data:{subject:S.subject,write:S.write}}}catch(g){return g instanceof sje?{ok:!1,error:g.message,data:{code:"REMOVAL_UNAVAILABLE"}}:{ok:!1,error:g instanceof Error?g.message:String(g)}}case"structure-op":try{const g=String(n.op??""),S=Cm(t).adapter,k=Pze(t),A=Array.isArray(n.ids)?n.ids.filter(G=>typeof G=="string"):typeof n.id=="string"&&n.id.trim()!==""?[n.id]:k,F=A[0],D=()=>{if(!F)throw new Error(`structure-op "${g}" needs an id or a selected row.`);return F},J=G=>typeof n[G]=="string"&&n[G].trim()!==""?n[G]:void 0,q=S.structure;if(!q)return{ok:!1,error:"structure-op: the active authoring adapter exposes no structure provider."};switch(g){case"create":{const G=J("kind");if(!G)return{ok:!1,error:'structure-op "create" needs a `kind`.'};const se=Xye(S,G,J("parentId"));return{ok:!0,data:{id:se.id,write:await se.ack}}}case"delete":return{ok:!0,data:{write:A.length>1&&q.removeMany?await a$e(S,A):await Ohe(S,D())}};case"duplicate":{if(A.length>1&&q.duplicateMany)return{ok:!0,data:{write:await mPt(S,A)}};const G=Yye(S,D());return{ok:!0,data:{id:G.id,write:await G.ack}}}case"reparent":{const G=J("parentId")??null;return{ok:!0,data:{write:await QO(S,D(),G)}}}case"reorder":{if(!q.reorder)return{ok:!1,error:"structure-op: this adapter has no `reorder`."};const G=J("beforeSiblingId")??null;return{ok:!0,data:{write:await c$e(S,D(),G)}}}case"wrap":return q.wrap?{ok:!0,data:{write:await Zye(S,D(),J("tag"))}}:{ok:!1,error:"structure-op: this adapter has no `wrap`."};case"unwrap":return q.unwrap?{ok:!0,data:{write:await Qye(S,D())}}:{ok:!1,error:"structure-op: this adapter has no `unwrap`."};case"group":{if(!q.group)return{ok:!1,error:"structure-op: this adapter has no `group`."};const G=e0e(S,A);return{ok:!0,data:{id:G.id,write:await G.ack}}}case"ungroup":{if(!q.ungroup)return{ok:!1,error:"structure-op: this adapter has no `ungroup`."};const G=l$e(S,D());return{ok:!0,data:{ids:G.ids,write:await G.ack}}}case"copy":return q.copy?{ok:!0,data:{copied:await t0e(S,A)}}:{ok:!1,error:"structure-op: this adapter has no `copy`."};case"cut":{if(!q.cut)return{ok:!1,error:"structure-op: this adapter has no `cut`."};const G=await r0e(S,A);return G===!1?{ok:!1,error:'structure-op "cut" was refused by the adapter.'}:{ok:!0,data:{write:G}}}case"paste":{if(!q.paste)return{ok:!1,error:"structure-op: this adapter has no `paste`."};const G=J("parentId")??(F?S.hierarchy.node(F)?.parentId??null:null),se=await n0e(S,G);return se===!1?{ok:!1,error:'structure-op "paste" was refused by the adapter.'}:{ok:!0,data:{write:se}}}default:return{ok:!1,error:`structure-op: unknown op ${JSON.stringify(g)}. Known ops: create, delete, duplicate, reparent, reorder, wrap, unwrap, group, ungroup, copy, cut, paste.`}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"document-probe":try{return{ok:!0,data:{...await jrn(n.step)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"capture-active-document":{const g=RDr(n);if("error"in g)return{ok:!1,error:g.error};try{return n.view&&await Bge(t,n.view),{ok:!0,data:{...await h9t(t,g.size)}}}catch(S){return{ok:!1,error:S instanceof Error?S.message:String(S)}}}case"capture-editor-chrome":{const g=n.scale;if(g!==void 0&&(typeof g!="number"||!(g>0)||g>4))return{ok:!1,error:`capture-editor-chrome: "scale" must be a number greater than 0 and no more than 4 (output pixels per CSS pixel; the frame crosses the relay as base64 PNG). It defaults to the page's own devicePixelRatio.`};const S=n.region;if(S!==void 0&&S!=="page"&&S!=="document")return{ok:!1,error:'capture-editor-chrome: "region" is "page" or "document".'};try{return{ok:!0,data:{...await Brn(t,{...g===void 0?{}:{scale:g},...S===void 0?{}:{region:S}})}}}catch(k){return{ok:!1,error:k instanceof Error?k.message:String(k)}}}case"document-table":{const g=u0();return g?{ok:!0,data:{default:g.scenes.default??null,entries:g.scenes.entries,pending:g.documentsPending===!0}}:{ok:!1,error:"The project adapter has not resolved yet — no document table to list.",data:{code:"SCENE_TABLE_UNAVAILABLE"}}}case"open":{const g=n.id;if(typeof g!="string"||g.trim()==="")return{ok:!1,error:"open requires a non-empty scene-table entry id."};const S=ste(),k=S?u0()?.scenes.entries.find(J=>J.id===g&&PN(J.kind)===void 0):void 0,A=S?async J=>await ZFt(J)??{ok:!1,error:"No running lane can remount with a selection."}:void 0,D=(k?await csn(k,{scenes:fVe,activateGameDocument:()=>X0(a0),gameDocumentId:a0,...A?{remountSelection:A}:{}}):null)??await Itn(g);return D.ok?{ok:!0,data:{documentId:D.documentId,title:D.title,..."scene"in D&&D.scene?{scene:D.scene}:{},..."restart"in D&&D.restart?{restart:!0}:{}}}:{ok:!1,error:D.error,data:{code:D.code,...D.known===void 0?{}:{known:[...D.known]}}}}case"document-script":return xsn(n);default:return{ok:!1,error:`unknown command type "${String(m)}" — editor page predates this CLI`,data:{code:"UNKNOWN_COMMAND_TYPE"}}}return{ok:!0}}function Tsn(t,n){const s=jD();let c=null,d=-1;const m=new Set;let g=!1,S=null,k=null,A=null;const F=()=>{n_e()===null&&(c=Uxt(t),d=t.contentVersion,zSt(c))};let D=null;const J=()=>{S!==null&&(clearTimeout(S),S=null),D?.(),D=null},q=()=>{k=null,A!==null&&clearTimeout(A),A=null},G=()=>{q(),g=!0,J(),S=setTimeout(()=>{S=null,D=yxt(()=>{D=null,g=!1,F()})},250)},se=vn=>{if(t.contentVersion!==vn){G();return}q(),k=vn,A=setTimeout(q,1e3)},pe=()=>ste()&&t.playState==="playing",ue=vn=>{(vn!==null||k!==null&&t.contentVersion!==k||g&&t.contentVersion!==d)&&G()},Ce=(vn,Yr,en)=>pe()?(_sn(en,vn,t.contentVersion,d)&&(vn==="explicit"?G():vn==="if-content-changed"?se(Yr??t.contentVersion):ue(Yr)),!0):!1,Fe=(vn="always",Yr="none",en=null)=>{if(n_e()!==null)return;if(c===null){F();return}const ii=Uxt(t,c);c=ii,zSt(gsn(ii)),vn!=="none"&&(Ce(Yr,en,vn)||(J(),q(),g=!1,!(vn==="if-content-changed"&&t.contentVersion===d)&&D===null&&(D=yxt(()=>{D=null,F()}))))};let De=!1,be=!1,X=t.playState;const we=vn=>{vn&&(be=!0),!De&&(De=!0,queueMicrotask(()=>{De=!1;const Yr=be;be=!1;const en=X!==t.playState;X=t.playState,Fe(Yr?"always":"if-content-changed",en&&t.playState==="playing"?"explicit":"none")}))},Be=()=>we(!1),bt=()=>we(!0),It=t.subscribe(Be),Wt=hVe(bt),zt=OC(bt),ft=oTr(bt);F(),i_e(!0),tEr(BZr),s.addEventListener("open",()=>{Fe("if-content-changed"),i_e(n_e()===null)});const tr=Oze(vn=>{i_e(vn===null)});s.addEventListener("editor-command",vn=>{try{const Yr=JSON.parse(vn.data),en=Yr._requestId,ii=t.contentVersion,No=n_e();if(No!==null){const En=QYr(No,String(Yr.type));en&&VSt(en,!1,En);return}en&&jZr(en);let gn;wsn(t,Yr,{deferPresentation:En=>{gn=En},...n?{history:n}:{}}).catch(En=>H9t(Yr,En)).then(En=>{if(en){const On=VSt(en,En.ok,En.error,En.data,gn!==void 0);if(gn){const ji=()=>window.setTimeout(gn,0);On.then(ji,ji)}}else gn&&window.setTimeout(gn,0);const cs=psn(Yr,En.ok,m);Fe(cs.derived,cs.playFullReport,ii)})}catch{}}),s.addEventListener("project-changed",()=>{window.location.reload()});const Qt=()=>Fe();document.addEventListener("visibilitychange",Qt),window.addEventListener("focus",Qt),window.addEventListener("blur",Qt);const Tt=()=>setTimeout(Qt,0);return window.addEventListener("error",Tt),window.addEventListener("unhandledrejection",Tt),()=>{i_e(!1),D?.(),D=null,S!==null&&clearTimeout(S),S=null,q(),tr(),It(),Wt(),zt(),ft(),document.removeEventListener("visibilitychange",Qt),window.removeEventListener("focus",Qt),window.removeEventListener("blur",Qt),window.removeEventListener("error",Tt),window.removeEventListener("unhandledrejection",Tt),s.close()}}function Csn(t,n,s){return Ye.createContext(s)}const LD=Csn(void 0,"EditorContext",null);function Esn({runtime:t,children:n}){const s=Ye.useMemo(()=>({begin:()=>{},end:()=>{}}),[]);return $.jsx(LD.Provider,{value:t,children:$.jsx(s4t.Provider,{value:s,children:$.jsx(Ye.Suspense,{children:n})})})}function Yv(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorStore must be used within <EditorProvider>");return t.store}function BSn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorStats must be used within <EditorProvider>");return t.stats}function ksn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorInit must be used within <EditorProvider>");return t.initPromise}function G9t(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryService must be used within <EditorProvider>");return t.session.history}function Asn(){return Ye.useContext(LD)?.session.history??null}function $Sn(){return Ye.useContext(LD)?.store??null}function qSn(){return Ye.useContext(LD)?.stats??null}function lve(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryCommands must be used within <EditorProvider>");return t.session.historyCommands}function K9t(){const t=lve();return Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}function Dsn(t,n){return t==="selection"&&n==="selection"?"selection":"content"}class Psn{_viewportSelections={edit:new Set,play:new Set};_history=null;_playState="stopped";_playEditRegime=null;_followsWorkspaceFocus;constructor(n={}){if(this._followsWorkspaceFocus=n.followsWorkspaceFocus===!0,!this._followsWorkspaceFocus)return;let s=this.activeViewportTab;i2(()=>{const c=this.activeViewportTab;c!==s&&(s=c,this._notify())})}_listeners=new Set;_deferredNotifyTimer=null;_deferredNotifyScope="content";_version=0;_shellVersion=0;_contentVersion=0;_hierarchyRowFacetVersion=0;subscribe=n=>(this._listeners.add(n),()=>this._listeners.delete(n));getSnapshot=()=>this._version;getShellSnapshot=()=>this._shellVersion;get contentVersion(){return this._contentVersion}get hierarchyRowFacetVersion(){return this._hierarchyRowFacetVersion}get projectHistory(){return this._history}_notify(n="content",s="shell",c=n!=="selection"){this._deferredNotifyTimer!==null&&(clearTimeout(this._deferredNotifyTimer),this._deferredNotifyTimer=null),this._beforeNotify(),this._version++,s==="shell"&&this._shellVersion++,n!=="selection"&&this._contentVersion++,c&&this._hierarchyRowFacetVersion++;for(const d of this._listeners)d()}_transformMode="combined";_transformSpace="world";_snapEnabled=!1;_snapValues={translate:1,rotate:15,scale:.25};_snapToSurface=!1;_rotationSnap=!1;_snap2D={step:8,offsetX:0,offsetY:0,primaryEvery:8,rotationOffset:0,rotationStep:15,scaleStep:.1,relative:!1,pixel:!0};_scaleSnap=!1;_smartSnap={enabled:!1,parent:!0,others:!0,guides:!0,sides:!0,center:!0};_preserveChildrenTransform=!1;_pivotMode="active-element";_gizmoAnchor="auto";_showHelpers=!0;_helperVisibility={bounds:!1,lights:!0,cameras:!0,colliders:!0,joints:!0,particles:!0,lod:!0,audio:!0,splines:!0,navmesh:!0,constraints:!0,reflectionProbes:!0,triggerVolumes:!0,skeletons:!1,weights:!1,cursor:!0,empties:!0};get transformMode(){return this._transformMode}get transformSpace(){return this._transformSpace}get snapEnabled(){return this._snapEnabled}get snapValues(){return this._snapValues}get snapToSurface(){return this._snapToSurface}get snap2D(){return this._snap2D}setSnap2D(n){this._snap2D={...this._snap2D,...n},this._notify()}get rotationSnap(){return this._rotationSnap}get scaleSnap(){return this._scaleSnap}setRotationSnap(n){this._rotationSnap=n,this._notify()}setScaleSnap(n){this._scaleSnap=n,this._notify()}get smartSnap(){return this._smartSnap}get preserveChildrenTransform(){return this._preserveChildrenTransform}get pivotMode(){return this._pivotMode}get gizmoAnchor(){return this._gizmoAnchor}get showHelpers(){return this._showHelpers}get helperVisibility(){return this._helperVisibility}setTransformMode(n){this._transformMode=n,this._notify()}setTransformSpace(n){this._transformSpace=n,this._notify()}toggleSnap(){this._snapEnabled=!this._snapEnabled,this._notify()}setSnapValues(n){this._snapValues={...this._snapValues,...n},this._notify()}setSmartSnap(n){this._smartSnap={...this._smartSnap,...n},this._notify()}toggleSnapToSurface(){this._snapToSurface=!this._snapToSurface,this._notify()}togglePreserveChildrenTransform(){this._preserveChildrenTransform=!this._preserveChildrenTransform,this._notify()}setPivotMode(n){this._pivotMode=n,this._notify()}setGizmoAnchor(n){this._gizmoAnchor=n,this._notify()}toggleHelpers(){this._showHelpers=!this._showHelpers,this._notify()}toggleHelperType(n){this._helperVisibility[n]=!this._helperVisibility[n],this._helperVisibility[n]&&(this._showHelpers=!0),this._notify()}_viewportActionListeners=new Set;onViewportAction=n=>(this._viewportActionListeners.add(n),()=>this._viewportActionListeners.delete(n));requestViewportAction(n){for(const s of this._viewportActionListeners)s(n)}focusOnEntity(n){this.requestViewportAction({type:"focus-entity",id:n})}focusOnSelection(){this.requestViewportAction({type:"focus-selection"})}frameAll(){this.requestViewportAction({type:"frame-all"})}zoomView(n){this.requestViewportAction({type:"zoom-view",direction:n})}focusOnScene(){this.requestViewportAction({type:"focus-scene"})}snapSelectionToFloor(){this.requestViewportAction({type:"snap-selection-to-floor"})}setViewPreset(n){this.requestViewportAction({type:"set-view-preset",preset:n})}stepView(n){this.requestViewportAction({type:"step-view",step:n})}toggleCameraView(){this.requestViewportAction({type:"toggle-camera-view"})}toggleProjection(){this.requestViewportAction({type:"toggle-projection"})}setCameraPose(n,s,c){this.requestViewportAction({type:"set-camera-pose",position:n,target:s,...c!==void 0?{fov:c}:{}})}notifyChange(n="content",s="shell",c=n!=="selection"){this._notify(n,s,c)}_notifyDeferred(n="content"){if(this._deferredNotifyTimer!==null){this._deferredNotifyScope=Dsn(this._deferredNotifyScope,n);return}this._deferredNotifyScope=n,this._deferredNotifyTimer=setTimeout(()=>{this._deferredNotifyTimer=null;const s=this._deferredNotifyScope;this._deferredNotifyScope="content",this._notify(s)},0)}attachHistory(n){if(this._history!==n){if(this._history)throw new Error("EditorStore is already attached to project history.");this._history=n,this._onHistoryAttached()}}get selectedEntityId(){const n=this._viewportSelections[this.activeViewportTab];return n.size===0?null:[...n].at(-1)}get selectedEntityIds(){return this._viewportSelections[this.activeViewportTab]}get canUndo(){return this._history?.getSnapshot().canUndo??!1}get canRedo(){return this._history?.getSnapshot().canRedo??!1}notifyIngestEdit(){this._notify()}get playState(){return this._playState}_blockedDuringPlay(n){return this._playState==="stopped"?!1:(console.warn(`EditorStore: "${n}" is disabled during play mode — stop the game first.`),!0)}setPlayState(n){const s=this._playState!=="stopped";this._playState=n,n==="stopped"&&s&&this._onPlayStopped(),this._notify()}get playEditRegime(){return this._playEditRegime}setPlayEditRegime(n){this._playEditRegime=n,this._notify()}get activeViewportTab(){return this._followsWorkspaceFocus&&e_()===a0?"play":"edit"}select(n,s="immediate"){const c=this._viewportSelections[this.activeViewportTab];c.clear(),n&&c.add(n),s==="deferred"?this._notifyDeferred("selection"):this._notify("selection")}selectMultiple(n,s="immediate"){this._viewportSelections[this.activeViewportTab]=new Set(n),s==="deferred"?this._notifyDeferred("selection"):this._notify("selection")}applySelectionBeforePresentation(n){this._viewportSelections[this.activeViewportTab]=new Set(n);let s=!1;return()=>{s||(s=!0,this._notify("selection"))}}addToSelection(n){this._viewportSelections[this.activeViewportTab].add(n),this._notify("selection")}toggleSelection(n){const s=this._viewportSelections[this.activeViewportTab];s.has(n)?s.delete(n):s.add(n),this._notify("selection")}_beforeNotify(){}_onHistoryAttached(){}_onPlayStopped(){}}class Isn{constructor(n){this.history=n,this.snapshot=this.buildSnapshot(),this.unsubscribeHistory=n.subscribe(this.notify)}tail=Promise.resolve();listeners=new Set;pending=0;version=0;disposed=!1;idleWaiters=new Set;unsubscribeHistory;snapshot;subscribe=n=>this.disposed?()=>{}:(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.snapshot;undo(){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.undo()))}redo(){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.redo()))}jumpTo(n){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.jumpTo(n)))}get canUndo(){return this.snapshot.canUndo}get canRedo(){return this.snapshot.canRedo}dispose(){if(this.disposed)return;this.disposed=!0,this.unsubscribeHistory();const n=new Error("History commands are disposed.");for(const s of this.idleWaiters)s.unsubscribe(),s.reject(n);this.idleWaiters.clear(),this.listeners.clear(),this.notify()}enqueue(n){if(this.disposed)return Promise.reject(new Error("History commands are disposed."));this.pending++,this.notify();const s=()=>{if(this.disposed)throw new Error("History commands are disposed.");return n()},c=this.tail.then(s,s);return this.tail=c.then(()=>{},()=>{}),c.finally(()=>{this.pending--,this.notify()})}assertNotDisposed(){if(this.disposed)throw new Error("History commands are disposed.")}waitForServiceIdle(){return this.disposed?Promise.reject(new Error("History commands are disposed.")):this.history.getSnapshot().busy?new Promise((n,s)=>{const c={unsubscribe:()=>{},reject:s},d=()=>{c.unsubscribe(),this.idleWaiters.delete(c)};c.unsubscribe=this.history.subscribe(()=>{this.history.getSnapshot().busy||(d(),n())}),this.idleWaiters.add(c)}):Promise.resolve()}notify=()=>{this.version++,this.snapshot=this.buildSnapshot();for(const n of this.listeners)n()};buildSnapshot(){const n=this.history.getSnapshot(),s=this.pending>0||n.busy;return{version:this.version,busy:s,canUndo:!this.disposed&&!s&&n.canUndo,canRedo:!this.disposed&&!s&&n.canRedo,undoLabel:n.undoLabel,redoLabel:n.redoLabel}}}function Nsn(t){let n=t.getSnapshot().limitWarning,s=t.getSnapshot().lastEviction;return t.subscribe(()=>{const{limitWarning:c,lastEviction:d}=t.getSnapshot();c!==n&&(n=c,c&&(i0(c.message),ea.warn(c.message,"history"))),d!==s&&(s=d,d&&ea.warn(d.message,"history"))})}class Osn{constructor(n,s={}){this.projectIdentity=n,this.history=new gDr(s),this.historyCommands=new Isn(this.history),this.releaseLimitNotices=Nsn(this.history)}history;historyCommands;releaseLimitNotices;dispose(){this.releaseLimitNotices(),this.historyCommands.dispose(),this.history.dispose()}}function Rsn(){return X9t}let X9t=Promise.resolve();function Y9t(){const t=Fsn();return X9t=t.then(()=>{},()=>{}),t}async function Fsn(){await Z9t()}async function Z9t(){const t=of();if(t){ea.log(`Opened project: ${t.config.name}`,"project");return}try{const n=await yFt();n&&ea.log(`Opened project: ${n.config.name}`,"project")}catch{}}const Q9t=Object.freeze(Object.defineProperty({__proto__:null,bootstrapProject:Y9t,initProject:Z9t,projectBootstrapSettled:Rsn},Symbol.toStringTag,{value:"Module"}));function mOe(t){return Promise.reject(new Error(`This editor tier cannot ${t}.`))}const eMt={openPersistence:()=>mOe("persist Asset Lab documents"),replaceSource:()=>mOe("write project source"),saveThumbnailFraming:()=>mOe("write project thumbnail framing")};let gme=eMt;function Msn(t){if(gme!==t){if(gme!==eMt)throw new Error("An Object3D document write policy is already installed.");gme=t}}function jsn(){return gme}function Lsn(){let t=0;const n=async()=>{const c=++t,d=of();if(d)try{const m=await jze();if(m.status!=="project"||m.project.path!==d.rootPath)return;const g=m.project.config;if(c!==t||of()!==d)return;cLe({...d,config:g})}catch(m){c===t&&of()===d&&console.error("[project] Could not refresh project declarations:",m)}},s=oen(()=>void n());return()=>{t++,s()}}function Bsn(){return Ivr(()=>{mVe(),v3r(null),Lwr(),Mnn(),uTr(),O3t(),mtn(),oD()})}async function $sn(){typeof performance<"u"&&performance.getEntriesByType("navigation").length>0&&await Promise.race([Nye(),new Promise(n=>setTimeout(n,5e3))]),await mN()}function qsn(){$sn();const t=Rw(()=>void mN()),n=fFt(()=>void mN());return()=>{t(),n()}}const zsn={tools:[],contributions:[],loadErrors:[]};let tMt=zsn,rMt=0;const cje=new Set;function Wxt(t){tMt=t,rMt++;for(const n of cje)n()}function N$(){return tMt}function Vsn(){return rMt}function nMt(t){return cje.add(t),()=>cje.delete(t)}async function WZ(){try{const t=await fetch("/__editor/project-tools"),n=await L_(t,"Catalog request failed");return Wxt(n),n}catch(t){const n={tools:[],contributions:[],loadErrors:[{sourcePath:"package.json#volter.tools",message:t instanceof Error?t.message:String(t)}]};return Wxt(n),n}}async function Usn(t,n,s={}){const c=await fetch("/__editor/project-tools/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,input:n,confirm:s.confirm===!0})}),d=await L_(c,`Running the project tool ${JSON.stringify(t)} failed`);if(!d||typeof d!="object"||typeof d.ok!="boolean")throw new Error(`Tool request returned an invalid response (${c.status}).`);return d}function Jsn(){WZ();const t=Rw(()=>void WZ()),n=fFt(()=>void WZ());return()=>{t(),n()}}const Uge=new Map;function Wsn(t,n){if(n===null){Uge.delete(t);return}Uge.set(t,n),Hsn()}const Hxt=128;let mZ=[],HZ=null,iMt=0,yme=!1;function Hsn(){if(yme)return()=>{};if(typeof PerformanceObserver>"u")return()=>{};let t;try{t=new PerformanceObserver(n=>{for(const s of n.getEntries()){const c=s.duration;(HZ===null||c>HZ)&&(HZ=c),c>=100&&(iMt+=1),mZ.push({start:s.startTime,duration:c}),mZ.length>Hxt&&(mZ=mZ.slice(-Hxt))}}),t.observe({type:"longtask",buffered:!0})}catch{return()=>{}}return yme=!0,()=>{t.disconnect(),yme=!1}}function Gsn(){return yme?{longestTaskMs:HZ===null?null:Math.round(HZ),tasksOver100ms:iMt}:null}function Ksn(t=performance.now()){if(Uge.size===0)return null;const n={};for(const[s,c]of Uge){const d=c(),m=d.lastCallWindow;let g=null;if(m!==null){const S=m.end??t;for(const k of mZ)k.start+k.duration<m.start||k.start>S||(g===null||k.duration>g)&&(g=k.duration)}n[s]={inFlightMs:d.inFlightMs,lastCallMs:d.lastCallMs,maxCallMs:d.maxCallMs,callsOver5s:d.callsOver5s,callsOver30s:d.callsOver30s,lastCallLongestTaskMs:g===null?null:Math.round(g),wasmMemoryMB:d.wasmMemoryMB}}return n}function Gxt(t){return!("unavailable"in t)}function Xsn(t=globalThis.performance){const n=t?.memory;return!n||typeof n.usedJSHeapSize!="number"||typeof n.totalJSHeapSize!="number"?{unavailable:"performance.memory is unavailable — it is a non-standard Chromium-only API, not exposed by this browser."}:{usedBytes:n.usedJSHeapSize,totalBytes:n.totalJSHeapSize,limitBytes:typeof n.jsHeapSizeLimit=="number"?n.jsHeapSizeLimit:null}}const Ysn=5e3,Zsn=4,Qsn=1024*1024;function hOe(t){return Math.round(t/Qsn*100)/100}function ean(t){const n=t.heap(),s=t.canvases(),c=t.rendererCounts(),d=t.workerCalls?.()??null,m=t.stalls?.()??null;let g=0;for(const S of s)g+=S.width*S.height*Zsn;return{heapUsedMB:Gxt(n)?hOe(n.usedBytes):null,heapLimitMB:Gxt(n)&&n.limitBytes!==null?hOe(n.limitBytes):null,mountEpochs:t.mountEpochs(),canvases:s.length,canvasMB:hOe(g),...d===null?{}:{workerCalls:d},...m===null?{}:{stalls:m},...c===null?{}:{textures:c.textures,geometries:c.geometries,...c.programs===null?{}:{programs:c.programs}}}}function tan(t){const n=new Set;for(const s of t)try{const c=new URL(s.name,"http://volter.invalid").searchParams.get(Pge);c!==null&&c.length>0&&n.add(c)}catch{}return n.size}function ran(){return{heap:()=>Xsn(),mountEpochs:()=>tan(performance.getEntriesByType("resource")),canvases:()=>[...document.querySelectorAll("canvas")],rendererCounts:()=>Gwr()?.memorySnapshot?.().counts??null,workerCalls:()=>Ksn(),stalls:()=>Gsn()}}let oMt=null;function zSn(){return oMt}function nan(t){const n=t.sources??ran(),s=t.hidden??(()=>document.visibilityState==="hidden"),c=()=>{if(s())return;const m=ean(n);oMt=m,t.report(m)};c();const d=setInterval(c,t.intervalMs??Ysn);return()=>clearInterval(d)}function ian({children:t}){const n=Ye.useRef(null);n.current||(n.current=new Psn({followsWorkspaceFocus:!0}),HZr(n.current));const s=Ye.useRef(null);if(!s.current){const g=of();s.current=new Osn(g?.rootPath??"unknown-project")}n.current.attachHistory(s.current.history),Msn(ODr);const c=Ye.useRef(null);c.current||(c.current={fps:0,frameTime:0,drawCalls:0,triangles:0,cameraPosition:{x:0,y:0,z:0},cameraTarget:{x:0,y:0,z:0}});const d=Ye.useRef(null);d.current||(d.current=Y9t()),Ye.useEffect(()=>Tsn(n.current,s.current.historyCommands),[]),Ye.useEffect(()=>qsn(),[]),Ye.useEffect(()=>Jsn(),[]),Ye.useEffect(()=>Zen(),[]),Ye.useEffect(()=>Lsn(),[]),Ye.useEffect(()=>Bsn(),[]),Ye.useEffect(()=>Dtn(),[]),Ye.useEffect(()=>nan({report:pZr}),[]);const m=Ye.useRef(!1);return Ye.useEffect(()=>{m.current=!0;const g=s.current;return()=>{m.current=!1,queueMicrotask(()=>{m.current||g.dispose()})}},[]),$.jsx(Esn,{runtime:{store:n.current,stats:c.current,initPromise:d.current,session:s.current},children:t})}const Jge={x:0,y:0,zoom:1};function VSn(t=Jge){let n=t;const s=new Set,c=()=>{for(const d of s)d()};return{get:()=>n,setView:(d,m,g)=>{const S=Math.min(4,Math.max(.1,g));n.x===d&&n.y===m&&n.zoom===S||(n={x:d,y:m,zoom:S},c())},setPan:(d,m)=>{const g=n.zoom;n.x===d&&n.y===m||(n={x:d,y:m,zoom:g},c())},setZoom:d=>{const m=Math.min(4,Math.max(.1,d));n.zoom!==m&&(n={x:n.x,y:n.y,zoom:m},c())},reset:()=>{n.x===0&&n.y===0&&n.zoom===1||(n=Jge,c())},subscribe:d=>(s.add(d),()=>s.delete(d))}}let r2=Jge;const lje=new Set,USn={get:()=>oan(),setView:(t,n,s)=>NVe(t,n,s),setPan:(t,n)=>aMt(t,n),setZoom:t=>san(t),reset:()=>cMt(),subscribe:t=>aan(t)};function sMt(){for(const t of lje)t()}function oan(){return r2}function NVe(t,n,s){const c=Math.min(4,Math.max(.1,s));r2.x===t&&r2.y===n&&r2.zoom===c||(r2={x:t,y:n,zoom:c},sMt())}function aMt(t,n){NVe(t,n,r2.zoom)}function san(t){NVe(r2.x,r2.y,t)}function JSn(t,n){aMt(r2.x+t,r2.y+n)}function cMt(){r2.x===0&&r2.y===0&&r2.zoom===1||(r2=Jge,sMt())}function aan(t){return lje.add(t),()=>lje.delete(t)}function WSn(t){if(!(t.x===0&&t.y===0&&t.zoom===1))return t.zoom===1?`translate(${t.x}px, ${t.y}px)`:t.x===0&&t.y===0?`scale(${t.zoom})`:`translate(${t.x}px, ${t.y}px) scale(${t.zoom})`}const can=new Set(["opacity","zIndex","flexGrow","flexShrink","fontWeight","lineHeight"]);function lan(t){if(typeof t=="number")return t;if(typeof t!="string"||t==="")return;const n=Number.parseFloat(t);return Number.isNaN(n)?void 0:n}function HSn(t,n){if(typeof t!="number"||typeof n!="string")return t;const s=n.trim().match(/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?([a-z]+|%)$/i)?.[1];return s&&s.toLowerCase()!=="px"?`${t}${s}`:t}function GSn(t,n){return typeof n!="number"?n:n===0||can.has(t)?String(n):`${n}px`}const uan={hidden:!1,interactive:!1,pickLock:!1},lMt=new Map;function uve(t){return lMt.get(t)??uan}function OVe(t,n){lMt.set(t,{...uve(t),...n})}function oq(t){return uve(t).hidden}function fan(t,n){OVe(t,{hidden:n})}function dan(t){fan(t,!oq(t))}function uMt(t){return uve(t).interactive}function pan(t,n){OVe(t,{interactive:n})}function _an(t){pan(t,!uMt(t))}function fMt(t){return uve(t).pickLock}function man(t,n){OVe(t,{pickLock:n})}function han(t){man(t,!fMt(t))}const Kxt=8,wN=8,KSn=[{pos:"nw",cursor:"nwse-resize"},{pos:"n",cursor:"ns-resize"},{pos:"ne",cursor:"nesw-resize"},{pos:"w",cursor:"ew-resize"},{pos:"e",cursor:"ew-resize"},{pos:"sw",cursor:"nesw-resize"},{pos:"s",cursor:"ns-resize"},{pos:"se",cursor:"nwse-resize"}];function XSn(t,n){const s=t.x+t.width/2,c=t.y+t.height/2;switch(n){case"nw":return{x:t.x,y:t.y};case"n":return{x:s,y:t.y};case"ne":return{x:t.x+t.width,y:t.y};case"w":return{x:t.x,y:c};case"e":return{x:t.x+t.width,y:c};case"sw":return{x:t.x,y:t.y+t.height};case"s":return{x:s,y:t.y+t.height};case"se":return{x:t.x+t.width,y:t.y+t.height}}}function iA(t,n){return n?Math.round(t):Math.round(t/Kxt)*Kxt}function dMt(t,n,s,c,d){let m=Math.max(wN,iA(n.width+t,s)),g=null;return c.length&&(g=pve(n.x+m,c,d),g&&(m=Math.max(wN,g.edge-n.x))),{value:m,match:g}}function pMt(t,n,s,c,d){const m=n.x+n.width;let g=Math.max(wN,iA(n.width-t,s)),S=null;return c.length&&(S=pve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,eastEdge:m,match:S}}function _Mt(t,n,s,c,d){let m=Math.max(wN,iA(n.height+t,s)),g=null;return c.length&&(g=pve(n.y+m,c,d),g&&(m=Math.max(wN,g.edge-n.y))),{value:m,match:g}}function mMt(t,n,s,c,d){const m=n.y+n.height;let g=Math.max(wN,iA(n.height-t,s)),S=null;return c.length&&(S=pve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,southEdge:m,match:S}}function gan(t,n,s,c,d,m,g){if(t==="e"||t==="ne"||t==="se")return{width:dMt(n,s,d,m,g).value};if(t==="w"||t==="nw"||t==="sw"){const{value:S,eastEdge:k}=pMt(n,s,d,m,g);return c?{width:S,x:k-S}:{width:S}}return{}}function yan(t,n,s,c,d,m,g){if(t==="s"||t==="sw"||t==="se")return{height:_Mt(n,s,d,m,g).value};if(t==="n"||t==="nw"||t==="ne"){const{value:S,southEdge:k}=mMt(n,s,d,m,g);return c?{height:S,y:k-S}:{height:S}}return{}}function YSn(t,n,s,c,d,m,g,S=TR){const k=!m&&g?ate(g):null,A=k?fve(k):[],F=k?dve(k):[];return{...gan(t,n,c,d,m,A,S),...yan(t,s,c,d,m,F,S)}}const TR=4;function ate(t){return{paddingBox:t.paddingBox??{x:0,y:0,width:0,height:0},siblingRects:(t.siblings??[]).filter(n=>n.width>0&&n.height>0),guideX:t.guideEdges?.x??[],guideY:t.guideEdges?.y??[]}}function fve(t){const n=[{edge:t.paddingBox.x,rect:t.paddingBox},{edge:t.paddingBox.x+t.paddingBox.width,rect:t.paddingBox}];for(const s of t.siblingRects)n.push({edge:s.x,rect:s}),n.push({edge:s.x+s.width,rect:s});for(const s of t.guideX??[])n.push({edge:s,rect:{x:s,y:-1e5,width:0,height:2e5}});return n}function dve(t){const n=[{edge:t.paddingBox.y,rect:t.paddingBox},{edge:t.paddingBox.y+t.paddingBox.height,rect:t.paddingBox}];for(const s of t.siblingRects)n.push({edge:s.y,rect:s}),n.push({edge:s.y+s.height,rect:s});for(const s of t.guideY??[])n.push({edge:s,rect:{x:-1e5,y:s,width:2e5,height:0}});return n}function tee(t,n,s,c){let d=t,m=c,g=null;for(const S of s){const k=Math.abs(t-S.edge);k<=m&&(m=k,d=S.edge,g=S);const A=Math.abs(t+n-S.edge);A<=m&&(m=A,d=S.edge-n,g=S)}return{value:d,match:g}}function pve(t,n,s){let c=null,d=s;for(const m of n){const g=Math.abs(t-m.edge);g<=d&&(d=g,c=m)}return c}function ZSn(t,n,s,c,d){let m=iA(s.x+t,c),g=iA(s.y+n,c);if(!c&&d){const S=ate(d);m=tee(m,s.width,fve(S),TR).value,g=tee(g,s.height,dve(S),TR).value}return{x:m,y:g}}function QSn(t,n,s,c,d,m=TR){if(s)return{guides:[],position:t};let g=null,S=m;for(const pe of d?.snapPoints??[]){const ue=Math.hypot(t.x-pe.x,t.y-pe.y);ue<=S&&(S=ue,g=pe)}if(g)return{guides:ree({x:g.x,y:g.y,width:0,height:0},{edge:g.x,rect:n},{edge:g.y,rect:n}),position:g};if(d?.bounded)return{guides:[],position:t};const k=iA(t.x,!1),A=iA(t.y,!1),F=[n,c?.parent,c?.paddingBox,...c?.siblings??[]].filter(pe=>!!pe&&pe.width>0&&pe.height>0);let D=null,J=null,q=m,G=m;for(const pe of F){for(const ue of[pe.x,pe.x+pe.width/2,pe.x+pe.width]){const Ce=Math.abs(k-ue);Ce<=q&&(q=Ce,D={edge:ue,rect:pe})}for(const ue of[pe.y,pe.y+pe.height/2,pe.y+pe.height]){const Ce=Math.abs(A-ue);Ce<=G&&(G=Ce,J={edge:ue,rect:pe})}}const se={x:D?.edge??k,y:J?.edge??A};return{guides:ree({x:se.x,y:se.y,width:0,height:0},D,J),position:se}}function ree(t,n,s){const c=[];return n&&c.push({orientation:"vertical",at:n.edge,start:Math.min(t.y,n.rect.y),end:Math.max(t.y+t.height,n.rect.y+n.rect.height)}),s&&c.push({orientation:"horizontal",at:s.edge,start:Math.min(t.x,s.rect.x),end:Math.max(t.x+t.width,s.rect.x+s.rect.width)}),c}function exn(t,n,s,c,d,m=TR){if(c||!d)return[];const g=iA(s.x+t,!1),S=iA(s.y+n,!1),k=ate(d),A=tee(g,s.width,fve(k),m).match,F=tee(S,s.height,dve(k),m).match,D={x:g,y:S,width:s.width,height:s.height};return ree(D,A,F)}function txn(t,n,s,c,d="both",m=!1,g=TR,S={},k=ban){if(m)return{position:t,guides:[]};const A={x:s.x+t.x-n.x,y:s.y+t.y-n.y,width:s.width,height:s.height},F=[],D=[],J=(pe,ue,Ce)=>{F.push({edge:pe.x,rect:pe},{edge:pe.x+pe.width,rect:pe}),D.push({edge:pe.y,rect:pe},{edge:pe.y+pe.height,rect:pe}),F.push({edge:pe.x+pe.width/2,rect:pe}),D.push({edge:pe.y+pe.height/2,rect:pe})};if(c){const pe=ate(c);if(k.parent&&pe.paddingBox.width>0&&pe.paddingBox.height>0&&J(pe.paddingBox),k.others)for(const ue of pe.siblingRects)J(ue)}if(k.guides){for(const pe of[...c?.guideEdges?.x??[],...S.x??[]])F.push({edge:pe,rect:{x:pe,y:A.y,width:0,height:A.height}});for(const pe of[...c?.guideEdges?.y??[],...S.y??[]])D.push({edge:pe,rect:{x:A.x,y:pe,width:A.width,height:0}})}if(F.length===0&&D.length===0)return{position:t,guides:[]};const q=d==="y"?{value:A.x,match:null}:Xxt(A.x,A.width,F,g),G=d==="x"?{value:A.y,match:null}:Xxt(A.y,A.height,D,g),se={...A,x:q.value,y:G.value};return{position:{x:t.x+se.x-A.x,y:t.y+se.y-A.y},guides:ree(se,q.match,G.match)}}function van(t,n,s,c,d){const m=n.tr.x-n.tl.x,g=n.tr.y-n.tl.y,S=n.bl.x-n.tl.x,k=n.bl.y-n.tl.y,A=m*k-g*S;if(Math.abs(A)<1e-9)return t;const F=t.x-n.tl.x,D=t.y-n.tl.y,J=[...s?[0,1]:[],...c?[.5]:[]],q=(pe,ue)=>{let Ce=pe,Fe=d;for(const De of J){const be=Math.abs(pe-De)*ue;be<=Fe&&(Fe=be,Ce=De)}return Ce},G=q((F*k-D*S)/A,Math.hypot(m,g)),se=q((m*D-g*F)/A,Math.hypot(S,k));return{x:n.tl.x+G*m+se*S,y:n.tl.y+G*g+se*k}}function rxn(t,n,s){const{smart:c,grid:d}=s;let m=t;return n&&c.enabled!==s.invert&&(c.sides||c.center)&&(m=van(t,n,c.sides,c.center,s.threshold)),n&&Math.abs(Pan(n))>1e-6?m:(!(Math.hypot(m.x-t.x,m.y-t.y)>1e-9)&&s.gridOn&&d.step>0&&(m={x:Math.round((m.x-d.offsetX)/d.step)*d.step+d.offsetX,y:Math.round((m.y-d.offsetY)/d.step)*d.step+d.offsetY}),d.pixel?{x:Math.round(m.x),y:Math.round(m.y)}:m)}function nxn(t){return{tl:{x:t.x,y:t.y},tr:{x:t.x+t.width,y:t.y},br:{x:t.x+t.width,y:t.y+t.height},bl:{x:t.x,y:t.y+t.height}}}const ban={parent:!0,others:!0,guides:!0};function Xxt(t,n,s,c){const d=tee(t,n,s,c);let m=d.value,g=d.match,S=g?Math.abs(m-t):c;for(const k of s){const A=Math.abs(t+n/2-k.edge);A<S&&(S=A,m=k.edge-n/2,g=k)}return{value:m,match:g}}function ixn(t,n,s,c,d,m,g=TR){if(d||!m)return[];const S=t==="e"||t==="ne"||t==="se",k=t==="w"||t==="nw"||t==="sw",A=t==="s"||t==="sw"||t==="se",F=t==="n"||t==="nw"||t==="ne",D=ate(m),J=fve(D),q=dve(D);let G=null;S?G=dMt(n,c,!1,J,g).match:k&&(G=pMt(n,c,!1,J,g).match);let se=null;return A?se=_Mt(s,c,!1,q,g).match:F&&(se=mMt(s,c,!1,q,g).match),ree(c,G,se)}function oxn(t,n,s,c,d=15){const m=F=>F*180/Math.PI,g=m(Math.atan2(n.y-t.y,n.x-t.x)),k=m(Math.atan2(s.y-t.y,s.x-t.x))-g;return{rotate:c?k:Math.round(k/d)*d}}function RN(t,n){if(t instanceof hy){const s=t.ownerOf(n);return s?t.childAdapters().find(c=>c.worldId===s)?.adapter??null:null}return t}const Yxt=new WeakMap;function San(t){const n=t.boxEdit;if(!n)return null;const s=Yxt.get(t);if(s?.provider===n)return s.recorded;const c={begin:d=>Pg({adapter:t,seam:"editor.boxEdit.begin",stage:"effect",detail:`the world overlay began a box edit for ${d}`,run:()=>n.begin(d)}),apply:(d,m)=>Pg({adapter:t,seam:"editor.boxEdit.apply",stage:"effect",detail:`the world overlay applied a ${Object.keys(m).join(", ")} box patch to ${d}`,run:()=>n.apply(d,m)}),end:d=>Pg({adapter:t,seam:"editor.boxEdit.end",stage:"effect",detail:`the world overlay ended a box edit for ${d}`,run:()=>n.end(d)}),...n.gizmoOrigin?{gizmoOrigin:d=>Pg({adapter:t,seam:"editor.boxEdit.gizmoOrigin",stage:"operation",detail:`the world overlay read the native gizmo origin for ${d}`,run:()=>n.gizmoOrigin?.(d)??null})}:{},...n.referencePoint?{referencePoint:d=>Pg({adapter:t,seam:"editor.boxEdit.referencePoint",stage:"operation",detail:`the world overlay read the native reference point for ${d}`,run:()=>n.referencePoint?.(d)??null})}:{}};return Yxt.set(t,{provider:n,recorded:c}),c}function xan(t,n){return RN(t,n)?.rects?.rect(n)??null}function wan(t,n){const s=RN(t,n);return s?San(s):null}function sxn(t,n){return RN(t,n)?.rects?.contextRects?.(n)}function axn(t,n){return RN(t,n)?.structure??null}function cxn(t,n){return RN(t,n)?.text??null}function lxn(t,n){return RN(t,n)?.colorSample??null}function uxn(t,n){const s=RN(t,n);return s?.rects?A3r(s):null}function fxn(t){const n=t instanceof hy?t.childAdapters():[{worldId:"",adapter:t}],s=[];for(const{worldId:c,adapter:d}of n)d.rects?.emptyContainers&&(c&&oq(c)||s.push(...d.rects.emptyContainers()));return s}function Tan(t,n){const s=c=>{const d=t.inspector?.get(n,`style.${c}`);return lan(d)??0};return{paddingTop:s("paddingTop"),paddingRight:s("paddingRight"),paddingBottom:s("paddingBottom"),paddingLeft:s("paddingLeft"),marginTop:s("marginTop"),marginRight:s("marginRight"),marginBottom:s("marginBottom"),marginLeft:s("marginLeft")}}const Can=4;function dxn(t,n){const s=D=>D>0?D:Can,c=s(n.paddingTop),d=s(n.paddingRight),m=s(n.paddingBottom),g=s(n.paddingLeft),S=s(n.marginTop),k=s(n.marginRight),A=s(n.marginBottom),F=s(n.marginLeft);return[{side:"paddingTop",kind:"padding",x:t.x,y:t.y,width:t.width,height:c,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+c/2,value:n.paddingTop,isZero:n.paddingTop===0},{side:"paddingBottom",kind:"padding",x:t.x,y:t.y+t.height-m,width:t.width,height:m,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+t.height-m/2,value:n.paddingBottom,isZero:n.paddingBottom===0},{side:"paddingLeft",kind:"padding",x:t.x,y:t.y,width:g,height:t.height,cursor:"ew-resize",labelX:t.x+g/2,labelY:t.y+t.height/2,value:n.paddingLeft,isZero:n.paddingLeft===0},{side:"paddingRight",kind:"padding",x:t.x+t.width-d,y:t.y,width:d,height:t.height,cursor:"ew-resize",labelX:t.x+t.width-d/2,labelY:t.y+t.height/2,value:n.paddingRight,isZero:n.paddingRight===0},{side:"marginTop",kind:"margin",x:t.x,y:t.y-S,width:t.width,height:S,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y-S/2,value:n.marginTop,isZero:n.marginTop===0},{side:"marginBottom",kind:"margin",x:t.x,y:t.y+t.height,width:t.width,height:A,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+t.height+A/2,value:n.marginBottom,isZero:n.marginBottom===0},{side:"marginLeft",kind:"margin",x:t.x-F,y:t.y,width:F,height:t.height,cursor:"ew-resize",labelX:t.x-F/2,labelY:t.y+t.height/2,value:n.marginLeft,isZero:n.marginLeft===0},{side:"marginRight",kind:"margin",x:t.x+t.width,y:t.y,width:k,height:t.height,cursor:"ew-resize",labelX:t.x+t.width+k/2,labelY:t.y+t.height/2,value:n.marginRight,isZero:n.marginRight===0}]}function Ean(t,n,s){switch(t){case"paddingTop":return s;case"paddingBottom":return-s;case"paddingLeft":return n;case"paddingRight":return-n;case"marginTop":return-s;case"marginBottom":return s;case"marginLeft":return-n;case"marginRight":return n}}function pxn(t,n,s,c){const d=Ean(t,n,s),m=Math.max(0,Math.round(c+d));return{[t]:m}}function _xn(t,n,s){return{x:t.x+n,y:t.y+s,width:t.width,height:t.height}}const gOe=3;function SO(t,n){return n==="x"?t.x+t.width/2:t.y+t.height/2}function kan(t,n,s){if(n===0){const m=t[0].rect;return s?m.x:m.y}if(n===t.length){const m=t[t.length-1].rect;return s?m.x+m.width:m.y+m.height}const c=t[n-1].rect,d=t[n].rect;return s?(c.x+c.width+d.x)/2:(c.y+c.height+d.y)/2}function Aan(t,n,s){const c=Math.min(...t.map(g=>s?g.rect.y:g.rect.x)),d=Math.max(...t.map(g=>s?g.rect.y+g.rect.height:g.rect.x+g.rect.width)),m=gOe/2;return s?{x:n-m,y:c,width:gOe,height:d-c}:{x:c,y:n-m,width:d-c,height:gOe}}function mxn(t,n){if(t.length===0)return null;const s=Math.max(...t.map(J=>SO(J.rect,"x")))-Math.min(...t.map(J=>SO(J.rect,"x"))),c=Math.max(...t.map(J=>SO(J.rect,"y")))-Math.min(...t.map(J=>SO(J.rect,"y"))),d=s>=c,m=d?"x":"y",g=[...t].sort((J,q)=>SO(J.rect,m)-SO(q.rect,m)),S=d?n.x:n.y;let k=0;for(;k<g.length&&SO(g[k].rect,m)<S;)k++;const A=k<g.length?g[k].id:null,F=kan(g,k,d),D=Aan(g,F,d);return{beforeSiblingId:A,index:k,marker:D}}function hxn(t,n){const s=t.hierarchy.node(n);if(!s)return null;if(s.parentId){const c=t.hierarchy.node(s.parentId);return c?c.childIds:null}return t.hierarchy.roots().map(c=>c.id)}function gxn(t,n){const s=t.x,c=t.x+t.width,d=t.y,m=t.y+t.height,g=n.x,S=n.x+n.width,k=n.y,A=n.y+n.height,F=[];let D=null;if(c<=g?D={x1:c,x2:g}:S<=s&&(D={x1:S,x2:s}),D){const q=Math.max(d,k),G=Math.min(m,A),se=G>q?(q+G)/2:((d+m)/2+(k+A)/2)/2;F.push({orientation:"horizontal",x1:D.x1,y1:se,x2:D.x2,y2:se,distance:Math.round(D.x2-D.x1),labelX:(D.x1+D.x2)/2,labelY:se})}let J=null;if(m<=k?J={y1:m,y2:k}:A<=d&&(J={y1:A,y2:d}),J){const q=Math.max(s,g),G=Math.min(c,S),se=G>q?(q+G)/2:((s+c)/2+(g+S)/2)/2;F.push({orientation:"vertical",x1:se,y1:J.y1,x2:se,y2:J.y2,distance:Math.round(J.y2-J.y1),labelX:se,labelY:(J.y1+J.y2)/2})}return F}function yOe(t,n,s){const c=t?.get(n,s);return typeof c=="string"&&c.length>0?c:null}function yxn(t,n){const s=yOe(t.inspector,n,"style.position");let c=null;const d=t.hierarchy.node(n)?.parentId??null;if(d){const m=yOe(t.inspector,d,"style.display");m==="flex"||m==="inline-flex"?c=`flex ${(yOe(t.inspector,d,"style.flexDirection")??"row").startsWith("column")?"col":"row"}`:m==="grid"||m==="inline-grid"?c="grid":m&&(c=m)}return{position:s,parentLayout:c}}function vxn(t,n){if(t.length<2)return[];const s=t.map(F=>F.rect),c=Math.min(...s.map(F=>F.x)),d=Math.max(...s.map(F=>F.x+F.width)),m=Math.min(...s.map(F=>F.y)),g=Math.max(...s.map(F=>F.y+F.height)),S=(c+d)/2,k=(m+g)/2,A=[];for(const{id:F,rect:D}of t)switch(n){case"left":A.push({id:F,x:c});break;case"hcenter":A.push({id:F,x:S-D.width/2});break;case"right":A.push({id:F,x:d-D.width});break;case"top":A.push({id:F,y:m});break;case"vcenter":A.push({id:F,y:k-D.height/2});break;case"bottom":A.push({id:F,y:g-D.height});break}return A}function bxn(t,n){if(t.length<3)return[];const s=n==="horizontal",c=[...t].sort((D,J)=>s?D.rect.x-J.rect.x:D.rect.y-J.rect.y),d=c[0],m=c[c.length-1],g=s?m.rect.x+m.rect.width-d.rect.x:m.rect.y+m.rect.height-d.rect.y,S=c.reduce((D,J)=>D+(s?J.rect.width:J.rect.height),0),k=(g-S)/(c.length-1);let A=s?d.rect.x:d.rect.y;const F=[];for(const D of c)F.push(s?{id:D.id,x:A}:{id:D.id,y:A}),A+=(s?D.rect.width:D.rect.height)+k;return F}function Sxn(t){if(t.length===0)return null;const n=Math.min(...t.map(m=>m.x)),s=Math.min(...t.map(m=>m.y)),c=Math.max(...t.map(m=>m.x+m.width)),d=Math.max(...t.map(m=>m.y+m.height));return{x:n,y:s,width:c-n,height:d-s}}function Dan(t,n,s,c,d){const m={};return s?(t!==0&&(m.x=c.x+t),n!==0&&(m.y=c.y+n),m):(t!==0&&(m.marginLeft=d.left+t),n!==0&&(m.marginTop=d.top+n),m)}function xxn(t,n){return RN(t,n)?.rects?.frame?.(n)??null}function wxn(t){const n=t.tr.x-t.tl.x,s=t.tr.y-t.tl.y,c=t.bl.x-t.tl.x,d=t.bl.y-t.tl.y,m=Math.max(Math.hypot(n,s),Math.hypot(c,d),1e-9);return Math.abs(s)/m>.001||Math.abs(c)/m>.001}function Pan(t){return Math.atan2(t.tr.y-t.tl.y,t.tr.x-t.tl.x)}function hMt(t,n,s){return{x:t.tl.x+n*(t.tr.x-t.tl.x)+s*(t.bl.x-t.tl.x),y:t.tl.y+n*(t.tr.y-t.tl.y)+s*(t.bl.y-t.tl.y)}}function gMt(t){const n=t.includes("w")?0:t.includes("e")?1:.5,s=t.includes("n")?0:t.includes("s")?1:.5;return{s:n,t:s}}function Txn(t,n,s){if(s.length!==2||t.width===void 0||t.height===void 0||!(n.width>0)||!(n.height>0))return t;const c=Math.max(t.width/n.width,t.height/n.height),d=n.width*c,m=n.height*c;return{...t,width:d,height:m,...s.includes("w")?{x:n.x+n.width-d}:{},...s.includes("n")?{y:n.y+n.height-m}:{}}}function Cxn(t,n){const{s,t:c}=gMt(n);return hMt(t,s,c)}function Zxt(t,n){const s=t.tr.x-t.tl.x,c=t.tr.y-t.tl.y,d=t.bl.x-t.tl.x,m=t.bl.y-t.tl.y,g=s*m-c*d;return Math.abs(g)<1e-12?{s:0,t:0}:{s:(n.x*m-n.y*d)/g,t:(s*n.y-c*n.x)/g}}function Exn(t,n,s,c,d,m=!1){const g=Zxt(t,{x:s,y:c}),S=n.includes("e")?1+g.s:n.includes("w")?1-g.s:1,k=n.includes("s")?1+g.t:n.includes("n")?1-g.t:1,A=Math.max(S,k),F=Math.max(.01,m&&n.length===2?A:S),D=Math.max(.01,m&&n.length===2?A:k),J=gMt(n),q=hMt(t,1-J.s,1-J.t),G=Zxt(t,{x:q.x-d.x,y:q.y-d.y}),se={x:d.x+F*G.s*(t.tr.x-t.tl.x)+D*G.t*(t.bl.x-t.tl.x),y:d.y+F*G.s*(t.tr.y-t.tl.y)+D*G.t*(t.bl.y-t.tl.y)};return{scaleXFactor:F,scaleYFactor:D,originX:d.x+q.x-se.x,originY:d.y+q.y-se.y}}let Qxt=!1;const yMt=new Set(["viewport","hierarchy","inspector","asset-browser","workspace","global"]);let vMt="viewport";const bMt="editorActiveHotkeyScope";function kxn(){const t=document.documentElement.dataset[bMt];return t&&yMt.has(t)?t:vMt}function CR(t){vMt=t,document.documentElement.dataset[bMt]=t}const Ian="data-editor-app-undo";function ewt(t){return t instanceof Element&&t.closest(`[${Ian}]`)!==null}function uje(t){return t instanceof Element?t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable?!0:!!t.closest('[contenteditable]:not([contenteditable="false"])'):!1}function Nan(t){for(const n of t.composedPath()){if(!(n instanceof HTMLElement)||t.type==="focusin"&&n.hasAttribute("data-editor-hotkey-fallback"))continue;const s=n.dataset.editorHotkeyScope;if(s&&yMt.has(s))return s}return null}function twt(t){const n=Nan(t);n&&CR(n)}const vOe=[];function rwt(t){return vOe.push(...t),()=>{for(const n of t){const s=vOe.indexOf(n);s>=0&&vOe.splice(s,1)}}}function Oan(){Qxt||(window.addEventListener("pointerdown",twt,!0),window.addEventListener("focusin",twt,!0),Qxt=!0)}const GZ=new Map;let SMt=0;const fje=new Set;function nwt(){SMt++;for(const t of fje)t()}function Ran(t){return GZ.set(t.id,t),nwt(),()=>{GZ.get(t.id)===t&&(GZ.delete(t.id),nwt())}}function Fan(){return[...GZ.values()]}function Man(){return SMt}function jan(t){return fje.add(t),()=>fje.delete(t)}function RVe(t){const n=GZ.get(t);return!n||n.enabled&&!n.enabled()?!1:(n.run(),!0)}const Tw=["viewport","hierarchy","inspector"];function XL(){return(globalThis.getSelection?.()?.toString()??"").length===0}function BD(t){return Pze(t)}async function FVe(t){const n=BD(t);n.length!==0&&await t0e(Cm(t).adapter,n)}async function MVe(t){const n=BD(t);n.length!==0&&await r0e(Cm(t).adapter,n)}async function jVe(t){const n=Cm(t).adapter,s=BD(t)[0],c=s?n.hierarchy.node(s)?.parentId??null:null;await n0e(n,c)}let iwt=Promise.resolve();function _ve(t){const n=iwt.then(()=>Lan(t));return iwt=n.then(()=>{},()=>{}),n}async function Lan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter,c=s.structure;if(!c)return;const d=n.length===1?s.hierarchy.node(n[0])?.label??"selection":`${n.length} objects`;if(i0(`Duplicating ${d}…`),c.duplicateMany){const m=await mPt(s,n);if(m&&!m.persisted){i0(m.destination);return}}else for(const m of n){const g=await Yye(s,m).ack;if(g&&!g.persisted){i0(g.destination);return}}i0(`Duplicated ${d}`)}async function mve(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter,c=s.structure;if(c)if(c.removeMany)await a$e(s,n);else{const d=new Map(aPt(s).map((g,S)=>[g,S])),m=[...n].sort((g,S)=>(d.get(S)??-1)-(d.get(g)??-1));for(const g of m)await Ohe(s,g)}}async function Ban(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;if(s.structure?.wrap)for(const d of n)await Zye(s,d)}async function $an(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;if(s.structure?.unwrap)for(const d of n)await Qye(s,d)}async function qan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;s.structure?.group&&await e0e(s,n).ack}function TI(t,n,s){const c=BD(t);if(c.length===0)return;const d=Cm(t).adapter;for(const m of c){const g=wan(d,m);if(!g)continue;const S=xan(d,m);if(!S)continue;const k=d.inspector?.get(m,"style.position"),A=k==="absolute"||k==="fixed",F=Tan(d,m),D=Dan(n,s,A,S,{left:F.marginLeft,top:F.marginTop});Object.keys(D).length!==0&&(g.begin(m),g.apply(m,D),g.end(m))}}function zan(t){const n=Array.isArray(t)?t:[t];return n.includes("global")?"global":n.length===1&&n[0]==="viewport"?"stage":"panel"}let vme=null;function pp(t,n){const{frameEnabled:s,...c}=n;return vme?.push(Ran({id:t,run:d=>c.action(d??new KeyboardEvent("keydown")),scope:zan(c.scope),...s?{enabled:s}:{}})),OBe(t).map(d=>({...c,...d}))}function xMt(t){const n=()=>{const g=[],S=vme;vme=g;try{return{rows:t(),actions:g}}finally{vme=S}};let s=n(),c=rwt(s.rows);const d=()=>{c();for(const g of s.actions)g()},m=Uye(()=>{d(),s=n(),c=rwt(s.rows)});return()=>{m(),d()}}function Van(t,n){const s=()=>{const m=n.getSnapshot().undoLabel;n.undo().then(g=>{g&&m&&i0(`Undid ${m}`)})},c=()=>{const m=n.getSnapshot().redoLabel;n.redo().then(g=>{g&&m&&i0(`Redid ${m}`)})},d=xMt(()=>[...pp("edit.redo",{scope:"global",allowInEditable:!0,when:m=>!uje(m.target)||ewt(m.target),action:c}),...pp("edit.undo",{scope:"global",allowInEditable:!0,when:m=>!uje(m.target)||ewt(m.target),action:s}),...pp("edit.copy",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void FVe(t)}),...pp("edit.cut",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void MVe(t)}),...pp("edit.paste",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void jVe(t)}),...pp("edit.duplicate",{scope:Tw,action:()=>void _ve(t)}),...pp("edit.group",{scope:Tw,action:()=>void qan(t)}),...pp("edit.wrap",{scope:Tw,action:()=>Ban(t)}),...pp("edit.unwrap",{scope:Tw,action:()=>$an(t)}),...pp("edit.nudgeUp",{scope:"viewport",action:()=>TI(t,0,-1)}),...pp("edit.nudgeUpCoarse",{scope:"viewport",action:()=>TI(t,0,-10)}),...pp("edit.nudgeDown",{scope:"viewport",action:()=>TI(t,0,1)}),...pp("edit.nudgeDownCoarse",{scope:"viewport",action:()=>TI(t,0,10)}),...pp("edit.nudgeLeft",{scope:"viewport",action:()=>TI(t,-1,0)}),...pp("edit.nudgeLeftCoarse",{scope:"viewport",action:()=>TI(t,-10,0)}),...pp("edit.nudgeRight",{scope:"viewport",action:()=>TI(t,1,0)}),...pp("edit.nudgeRightCoarse",{scope:"viewport",action:()=>TI(t,10,0)}),...pp("edit.selectAll",{scope:Tw,action:()=>{const m=Cm(t).adapter;c0(m,aPt(m))}}),...pp("edit.deselectAll",{scope:Tw,action:()=>c0(Cm(t).adapter,[])}),...pp("edit.save",{scope:"global",allowInEditable:!0,action:()=>{gTr().then(m=>{m===null&&ARt(t)})}}),...pp("view.resetPan",{scope:"viewport",action:()=>cMt()}),...pp("edit.enterScope",{scope:Tw,when:()=>t.playState==="stopped",frameEnabled:()=>t.playState==="stopped",action:()=>{L3r(Cm(t).adapter)}}),...pp("edit.delete",{scope:Tw,action:()=>void mve(t)}),...pp("edit.exitScopeOrDeselect",{scope:Tw,when:()=>M3r()!==null||t.playState==="stopped",frameEnabled:()=>!0,action:()=>{const m=Cm(t).adapter;if(!j3r(m)){if(t.playState!=="stopped"){mVe();return}t.select(null)}}}),...pp("view.commandPalette",{scope:"global",action:()=>{SVe()||ea.warn(`The command palette has not handed over its opener yet — run "Volter Editor: Open Workspace" first, or press the workbench's own Show All Commands.`)}}),...pp("view.toggleConsole",{scope:"global",action:()=>ave()}),...pp("view.focusMode",{scope:"global",action:()=>MBe()}),...pp("workspace.cycleNext",{scope:"global",action:()=>{She(1)}}),...pp("workspace.cyclePrevious",{scope:"global",action:()=>{She(-1)}})]);return Oan(),d}function Uan(t){return xMt(()=>t.flatMap(n=>{const s=n.enabled;return pp(n.id,{scope:n.scope==="stage"?"viewport":"global",action:c=>n.run(c),...s?{when:()=>s(),frameEnabled:()=>s()}:{}})}))}function LVe(){nkr("undo-history")}function Jan(){const t=()=>LVe();return window.addEventListener("editor:show-history-tab",t),()=>window.removeEventListener("editor:show-history-tab",t)}let dje=null,wMt=0;const pje=new Set;function BVe(t){if(dje!==t){dje=t,wMt++;for(const n of pje)n()}}function TMt(){return dje}function Wan(t){BVe(t)}function CMt(){BVe(null)}function EMt(t){return pje.add(t),()=>pje.delete(t)}function _je(){return wMt}function Han(){BVe(null)}const Gan=Object.freeze(Object.defineProperty({__proto__:null,__resetEditorPresentationNoticeForTest:Han,clearEditorPresentationNotice:CMt,editorPresentationNotice:TMt,editorPresentationNoticeVersion:_je,showEditorPresentationNotice:Wan,subscribeEditorPresentationNotice:EMt},Symbol.toStringTag,{value:"Module"})),owt="agent-presented-view";function Kan(){const t=Yv();Ye.useSyncExternalStore(EMt,_je,_je);const n=TMt();return Ye.useEffect(()=>{if(!n){xBe(owt);return}s$({id:owt,tone:"info",title:"Agent presented this view.",...n.presented.warnings.length>0?{detail:n.presented.warnings.join(" ")}:{},onDismiss:CMt,actions:[{label:"Copy Link",keeps:!0,run:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(n.presented.url)).catch(()=>{ea.warn("Could not copy the view link to the clipboard.","editor")})}},{label:"Return",primary:!0,run:()=>{Bge(t,n.previousView,{origin:"return"}).catch(s=>{ea.error(`Could not return to the previous editor view: ${s instanceof Error?s.message:String(s)}`,"editor")})}}]})},[n,t]),null}function Xan(t){Ye.useEffect(()=>{const n=atn(),s=()=>ptn(t.playState!=="stopped");s();const c=t.subscribe(s);return()=>{c(),n(),O3t()}},[t])}const nee={console:{id:"console",title:"Console"},lightExplorer:{id:"light-explorer",title:"Light Explorer"}},Yan={storyActions:{id:"story-actions",title:"Actions"},storyInteractions:{id:"story-interactions",title:"Interactions"},storyAccessibility:{id:"story-accessibility",title:"Accessibility"},generations:{id:"generations",title:"Generations"}};[...Object.values(nee),...Object.values(Yan)];const Zan={info:Go.content.primary,warn:Go.semantic.warning,error:Go.semantic.danger},swt={scene:"#78dce8",physics:"#ff6188",animation:"#a9dc76",network:"#fc9867",audio:"#ab9df2",ai:"#ffd866",input:"#78dce8",core:Go.content.primary},awt={info:R$,warn:WTt,error:NTt};function Qan(){const t=Yv();Ye.useSyncExternalStore(ea.subscribe,ea.getSnapshot);const[n,s]=Ye.useState(""),[c,d]=Ye.useState("all"),[m,g]=Ye.useState({info:!0,warn:!0,error:!0}),S=Ye.useRef(null),[k,A]=Ye.useState(!0),F=ea.getEntries(),D=new Map;for(const Ce of F){const Fe=Ce.metadata?.instanceId;if(typeof Fe!="string"||Fe.length===0)continue;const De=Ce.metadata?.instanceName;D.set(Fe,typeof De=="string"&&De.length>0?De:`Instance ${Fe}`)}const J=F.filter(Ce=>!(!m[Ce.level]||c!=="all"&&Ce.metadata?.instanceId!==c||n&&!Ce.message.toLowerCase().includes(n.toLowerCase())));Ye.useEffect(()=>{k&&S.current&&(S.current.scrollTop=S.current.scrollHeight)},[F.length,k]);const q=()=>{if(!S.current)return;const{scrollTop:Ce,scrollHeight:Fe,clientHeight:De}=S.current;A(Fe-Ce-De<20)},G=Ce=>{g(Fe=>({...Fe,[Ce]:!Fe[Ce]}))},se=Ce=>{const Fe=new Date(Ce);return`${Fe.getHours().toString().padStart(2,"0")}:${Fe.getMinutes().toString().padStart(2,"0")}:${Fe.getSeconds().toString().padStart(2,"0")}`},pe=Ce=>{c0(Y0(t),[Ce]),RVe("viewport.frameSelection")},ue=ea.counts;return $.jsxs(LTr,{className:"volter-console",children:[$.jsxs(n$,{label:"Console filters",compact:!0,children:[$.jsx(dm,{"aria-label":"Clear console",size:"compact",onClick:()=>ea.clear(),title:"Clear console",children:$.jsx(dc,{icon:ATt,size:"xs"})}),$.jsx(Eht,{}),$.jsxs(Iw,{"aria-label":"Filter console by game instance",title:"Show messages from all game instances or one inspected instance",value:c,onChange:Ce=>d(Ce.target.value),style:{width:"auto",minWidth:74,height:24,fontSize:11},children:[$.jsx("option",{value:"all",children:"All instances"}),[...D].map(([Ce,Fe])=>$.jsx("option",{value:Ce,children:Fe},Ce))]}),$.jsx(Eht,{}),["info","warn","error"].map(Ce=>$.jsxs(Ms,{variant:"ghost",size:"compact","aria-label":`Toggle ${Ce} messages`,"aria-pressed":m[Ce],"data-console-level":Ce,onClick:()=>G(Ce),children:[$.jsx(dc,{icon:awt[Ce],size:"xs"}),ue[Ce]]},Ce)),$.jsx(Zm,{placeholder:"Filter...",value:n,onChange:Ce=>s(Ce.target.value),className:"volter-console-filter"})]}),$.jsxs("div",{ref:S,onScroll:q,className:"volter-console-list volter-selectable-text",children:[J.length===0&&$.jsx("div",{className:"volter-console-empty",children:"No messages"}),J.map(Ce=>{const Fe=Ce.metadata?.entityId!=null?String(Ce.metadata.entityId):null,De=(Fe?Y0(t).hierarchy.node(Fe)?.label:null)||Fe,be=typeof Ce.metadata?.instanceId=="string"?Ce.metadata.instanceId:null,X=typeof Ce.metadata?.instanceName=="string"?Ce.metadata.instanceName:be?`Instance ${be}`:null;return $.jsxs("div",{className:"volter-console-row","data-level":Ce.level,style:{color:Zan[Ce.level]},children:[$.jsx("span",{style:{color:Go.content.dim,marginRight:6,flexShrink:0},children:se(Ce.timestamp)}),$.jsx(dc,{icon:awt[Ce.level],style:{fontSize:9,marginTop:4,marginRight:6,flexShrink:0}}),X&&$.jsx("span",{title:be?`Runtime instance ${be}`:void 0,style:{background:Go.accent.muted,color:Go.accent.default,borderRadius:Go.shape.small,padding:"0 4px",fontSize:10,marginRight:6,flexShrink:0},children:X}),Ce.subsystem&&$.jsx("span",{style:{background:`${swt[Ce.subsystem]??Go.content.muted}22`,color:swt[Ce.subsystem]??Go.content.muted,borderRadius:Go.shape.small,padding:"0 4px",fontSize:10,marginRight:6,flexShrink:0},children:Ce.subsystem}),$.jsxs("span",{style:{flex:1,wordBreak:"break-word"},children:[Ce.message,Fe&&$.jsxs("span",{onClick:()=>pe(Fe),style:{background:Go.semantic.successMuted,color:Go.semantic.success,borderRadius:Go.shape.small,padding:"0 5px",fontSize:10,marginLeft:6,cursor:"pointer",pointerEvents:"auto",display:"inline-flex",alignItems:"center",gap:3},title:`Select and focus "${De}"`,children:[$.jsx(dc,{icon:aR,style:{fontSize:8}}),De]}),Ce.source&&$.jsxs("span",{style:{color:Go.content.dim,marginLeft:6},children:["[",Ce.source,"]"]})]}),Ce.count>1&&$.jsx("span",{className:"volter-console-count",children:Ce.count})]},Ce.id)})]})]})}const ecn={enabled:"visible",color:"light.color",intensity:"light.intensity",range:"light.distance",shadows:"shadow.cast"};function kMt(t){const n=[],s=t;return W$(t.hierarchy,c=>{c.kind==="light"&&n.push(c)},{extraChildren:c=>s.internalChildren?.(c)}),n}function Axn(t){return kMt(t).length}function AMt(t,n){return t.find(s=>s.path===ecn[n])??null}function qY(t,n,s,c,d){const m=AMt(s,c);if(!m||!t.inspector)return{supported:!1,writable:!1,value:null};let g;try{g=t.inspector.get(n,m.path)}catch{g=void 0}return{supported:!0,writable:m.readonly!==!0,value:d(g)?g:null}}const cwt=t=>typeof t=="boolean",tcn=t=>typeof t=="string",lwt=t=>typeof t=="number"&&Number.isFinite(t);function rcn(t){return kMt(t).map(n=>{let s=[];try{s=t.inspector?.properties(n.id)??[]}catch{}const c=t.hierarchy.object3D?.(n.id)?.type;return{id:n.id,name:n.label,type:n.typeLabel??c??"Light",enabled:qY(t,n.id,s,"enabled",cwt),color:qY(t,n.id,s,"color",tcn),intensity:qY(t,n.id,s,"intensity",lwt),range:qY(t,n.id,s,"range",lwt),shadows:qY(t,n.id,s,"shadows",cwt)}})}function ncn(t,n,s,c){if(!t.inspector)return 0;let d=0;for(const m of n){let g=null;try{g=AMt(t.inspector.properties(m),s)}catch{continue}!g||g.readonly||(dPt(t,m,g.path,c),d++)}return d}function icn(t,n){return t===null&&n===null?0:t===null?1:n===null?-1:typeof t=="string"&&typeof n=="string"?t.localeCompare(n,void 0,{numeric:!0,sensitivity:"base"}):Number(t)-Number(n)}function uwt(t,n){return n==="name"||n==="type"?t[n]:t[n].value}function zY({label:t,sortKey:n,activeKey:s,direction:c,onSort:d}){const m=n===s;return $.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-light-explorer-sort","aria-label":`Sort lights by ${t}`,onClick:()=>d(n),children:[t,m?$.jsx(dc,{icon:c==="ascending"?E0r:W0r,size:"xs"}):null]})}function hve(){return $.jsx("span",{className:"volter-light-explorer-unavailable",children:"—"})}function ocn({row:t,edit:n}){return t.enabled.supported?$.jsx(TD,{"aria-label":`${t.enabled.value?"Disable":"Enable"} ${t.name}`,checked:t.enabled.value??!1,disabled:!t.enabled.writable,onChange:s=>n("enabled",s.target.checked)}):$.jsx(hve,{})}function scn({row:t,edit:n}){return!t.color.supported||!t.color.value?$.jsx(hve,{}):$.jsxs("div",{className:"volter-light-explorer-color",children:[$.jsx(a4t,{"aria-label":`Color for ${t.name}`,value:t.color.value,disabled:!t.color.writable,onChange:s=>n("color",s.target.value)}),$.jsx("span",{children:t.color.value})]})}function fwt({row:t,field:n,step:s,edit:c}){const d=t[n];return d.supported?$.jsx(SZ,{value:d.value,disabled:!d.writable,precision:2,step:s,onChange:m=>c(n,m)}):$.jsx(hve,{})}function acn({row:t,edit:n}){return t.shadows.supported?$.jsx(TD,{"aria-label":`Toggle shadows for ${t.name}`,checked:t.shadows.value??!1,disabled:!t.shadows.writable,onChange:s=>n("shadows",s.target.checked)}):$.jsx(hve,{})}function ccn({row:t,adapter:n,visibleRows:s,selected:c,selectionAnchor:d,edit:m}){const g=(S,k)=>m(t,S,k);return $.jsxs("tr",{"data-selected":c.has(t.id)||void 0,children:[$.jsx("td",{children:$.jsx(ocn,{row:t,edit:g})}),$.jsx("td",{children:$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-light-explorer-name","aria-pressed":c.has(t.id),onClick:S=>{ucn(n,s,t.id,d.current,S.shiftKey,S.metaKey||S.ctrlKey),S.shiftKey||(d.current=t.id)},children:t.name})}),$.jsx("td",{className:"volter-light-explorer-type",children:t.type}),$.jsx("td",{children:$.jsx(scn,{row:t,edit:g})}),$.jsx("td",{children:$.jsx(fwt,{row:t,field:"intensity",step:.1,edit:g})}),$.jsx("td",{children:$.jsx(fwt,{row:t,field:"range",step:.5,edit:g})}),$.jsx("td",{children:$.jsx(acn,{row:t,edit:g})})]})}function lcn(t,n,s){if(!n.has(t.id))return[t.id];const c=s.filter(d=>n.has(d.id));return c.length>1?c.map(d=>d.id):[t.id]}function ucn(t,n,s,c,d,m){if(!t.selection)return;const g=t.selection.get();if(d&&c){const S=n.findIndex(A=>A.id===c),k=n.findIndex(A=>A.id===s);if(S>=0&&k>=0){const A=n.slice(Math.min(S,k),Math.max(S,k)+1).map(F=>F.id);c0(t,m?[...new Set([...g,...A])]:A,{intent:"exact"});return}}if(m){c0(t,g.includes(s)?g.filter(S=>S!==s):[...g,s],{intent:"exact"});return}c0(t,[s],{intent:"exact"})}function fcn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(Cee,AD,AD);const{adapter:n}=Cm(t),[,s]=Ye.useReducer(De=>De+1,0);Ye.useEffect(()=>n.subscribe?.(s),[n]);const[c,d]=Ye.useState(""),[m,g]=Ye.useState("all"),[S,k]=Ye.useState("name"),[A,F]=Ye.useState("ascending"),D=Ye.useRef(null),J=rcn(n),q=Ye.useMemo(()=>[...new Set(J.map(De=>De.type))].sort((De,be)=>De.localeCompare(be)),[J]),G=c.trim().toLocaleLowerCase(),se=J.filter(De=>(m==="all"||De.type===m)&&(!G||De.name.toLocaleLowerCase().includes(G)||De.type.toLocaleLowerCase().includes(G))).sort((De,be)=>{const X=icn(uwt(De,S),uwt(be,S));return A==="ascending"?X:-X}),pe=new Set(n.selection?.get()??[]),ue=J.filter(De=>pe.has(De.id)).length,Ce=De=>{De===S?F(be=>be==="ascending"?"descending":"ascending"):(k(De),F("ascending"))},Fe=(De,be,X)=>{const we=lcn(De,pe,se);ncn(n,we,be,X)>0&&t.notifyIngestEdit()};return $.jsxs("section",{className:"volter-light-explorer","aria-label":"Light Explorer",children:[$.jsxs("div",{className:"volter-light-explorer-toolbar",children:[$.jsx(Zm,{"aria-label":"Search lights",placeholder:"Search lights…",value:c,onChange:De=>d(De.target.value)}),$.jsxs(Iw,{"aria-label":"Filter lights by type",value:m,onChange:De=>g(De.target.value),children:[$.jsx("option",{value:"all",children:"All types"}),q.map(De=>$.jsx("option",{value:De,children:De},De))]}),$.jsxs("span",{className:"volter-light-explorer-summary",children:[J.length," ",J.length===1?"light":"lights",ue>0?` · ${ue} selected`:""]})]}),J.length===0?$.jsx("div",{className:"volter-light-explorer-empty",children:"The active document does not expose any lights."}):$.jsxs("div",{className:"volter-light-explorer-scroll",children:[$.jsxs("table",{className:"volter-light-explorer-table",children:[$.jsx("thead",{children:$.jsxs("tr",{children:[$.jsx("th",{className:"volter-light-explorer-check-column",scope:"col",children:"On"}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Name",sortKey:"name",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Type",sortKey:"type",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:"Color"}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Intensity",sortKey:"intensity",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Range",sortKey:"range",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Shadows",sortKey:"shadows",activeKey:S,direction:A,onSort:Ce})})]})}),$.jsx("tbody",{children:se.map(De=>$.jsx(ccn,{row:De,adapter:n,visibleRows:se,selected:pe,selectionAnchor:D,edit:Fe},De.id))})]}),se.length===0?$.jsx("div",{className:"volter-light-explorer-empty",children:"No lights match the current filters."}):null]})]})}const dcn=Iye();function pcn(){const{error:t,warn:n}=ea.counts;return t>0?{count:t+n,severity:"error"}:n>0?{count:n,severity:"warn"}:null}function _cn(){dcn.ensure(t=>{t(nFe({...nee.console,order:-100,Content:Qan,badge:pcn,subscribeBadge:ea.subscribe,badgeSnapshot:ea.getSnapshot,visibleByDefault:!1,closeable:!0})),t(nFe({...nee.lightExplorer,order:21,Content:fcn,visibleByDefault:!1,closeable:!0}))})}const mcn=5742335;function DMt(t,n,s){return t<<16|n<<8|s}function dwt(t){const n=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t.trim())?.[1];if(n){const d=n.length===3?[...n].map(m=>`${m}${m}`).join(""):n;return Number.parseInt(d.slice(0,6),16)}const s=/^rgba?\(\s*(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)/i.exec(t.trim());if(!s)return null;const c=s.slice(1,4).map(d=>Math.round(Number(d)));return c.some(d=>d<0||d>255)?null:DMt(c[0],c[1],c[2])}function iee(t){const n=dwt(t);if(n!==null||typeof document>"u")return n;if(typeof CSS<"u"&&!CSS.supports("color",t))return null;const s=document.createElement("canvas").getContext("2d");return s?(s.fillStyle="#010203",s.fillStyle=t,dwt(String(s.fillStyle))):null}function dA(t){return typeof document>"u"?null:t?.closest(`.${DRe}`)??document.querySelector(`.${DRe}`)}function pwt(t){const n=Math.round((t>>16&255)*.42),s=Math.round((t>>8&255)*.42),c=Math.round((t&255)*.42);return DMt(n,s,c)}function Ig(t,n){return t&&typeof getComputedStyle<"u"?getComputedStyle(t).getPropertyValue(n).trim():""}const PMt={"--volter-viewport-background":"--vscode-volter-viewport-background","--volter-viewport-grid":"--vscode-volter-viewport-grid","--volter-viewport-axis-x":"--vscode-volter-viewport-axisX","--volter-viewport-axis-y":"--vscode-volter-viewport-axisY","--volter-viewport-axis-z":"--vscode-volter-viewport-axisZ","--volter-viewport-selection":"--vscode-volter-viewport-selection","--volter-viewport-active":"--vscode-volter-viewport-active","--volter-viewport-wire":"--vscode-volter-viewport-wire","--volter-gizmo-x":"--vscode-volter-gizmo-x","--volter-gizmo-y":"--vscode-volter-gizmo-y","--volter-gizmo-z":"--vscode-volter-gizmo-z","--volter-gizmo-navigation-x":"--vscode-volter-gizmo-navigationX","--volter-gizmo-navigation-y":"--vscode-volter-gizmo-navigationY","--volter-gizmo-navigation-z":"--vscode-volter-gizmo-navigationZ","--volter-gizmo-hover":"--vscode-volter-gizmo-hover","--volter-gizmo-drag":"--vscode-volter-gizmo-drag"};function oee(t,n){const s=PMt[n];return(s?Ig(t,s):"")||Ig(t,n)}function Dxn(t){const n=dA(t),s=oee(n,"--volter-viewport-selection")||Ig(n,"--volter-accent"),c=iee(s||i$.color.accent.default)??mcn,d=iee(oee(n,"--volter-viewport-active")),m=Ig(n,"--volter-viewport-outline-style"),g=Number.parseFloat(Ig(n,"--volter-viewport-outline-width")),S=Ig(n,"--volter-viewport-outline-hidden");return{visible:c,hidden:pwt(c),...d===null?{}:{active:{visible:d,hidden:pwt(d)}},...m===""&&S===""&&!Number.isFinite(g)?{}:{outline:{style:m==="crisp"?"crisp":"soft",width:Number.isFinite(g)&&g>0?g:null,hidden:S!=="false"}}}}function Pxn(t){return IMt(t).background!==null}function Ixn(t){const n=IMt(t).background;if(n===null)return!1;const s=n>>16&255,c=n>>8&255,d=n&255;return(.2126*s+.7152*c+.0722*d)/255>.5}function IMt(t){const n=dA(t),s=c=>{const d=oee(n,c);return d?iee(d):null};return{background:s("--volter-viewport-background"),grid:s("--volter-viewport-grid"),axisX:s("--volter-viewport-axis-x"),axisY:s("--volter-viewport-axis-y"),axisZ:s("--volter-viewport-axis-z"),axisLineWidth:(()=>{const c=Ig(n,"--volter-viewport-axis-line-width"),d=c?Number.parseFloat(c):Number.NaN;return Number.isFinite(d)?d:null})(),active:s("--volter-viewport-active")}}function Nxn(t){const n=dA(t),s=m=>{const g=oee(n,m);return g?iee(g):null},c=m=>{const g=Ig(n,m);if(!g)return null;const S=Number.parseFloat(g);return Number.isFinite(S)?S:null},d=m=>{const g=s(`${m}-x`),S=s(`${m}-y`),k=s(`${m}-z`);return g!==null&&S!==null&&k!==null?[g,S,k]:null};return{axes:d("--volter-gizmo"),navigation:d("--volter-gizmo-navigation"),hover:s("--volter-gizmo-hover"),drag:s("--volter-gizmo-drag"),opacity:c("--volter-viewport-gizmo-opacity"),arrowLength:c("--volter-viewport-gizmo-arrow-length"),arrowHead:c("--volter-viewport-gizmo-arrow-head"),ringWidth:c("--volter-viewport-gizmo-ring-width"),navigationSize:c("--volter-viewport-navigation-size"),background:s("--volter-viewport-background"),navigationForm:(m=>m==="cones"||m==="triad"||m==="godot"?m:"balls")(Ig(n,"--volter-viewport-navigation-gizmo")),navigationCorner:Ig(n,"--volter-viewport-navigation-corner")==="bottom-left"?"bottom-left":"top-right",highlightSaturation:c("--volter-viewport-gizmo-highlight-saturation"),highlightValue:c("--volter-viewport-gizmo-highlight-value")}}function Oxn(t){const n=Ig(dA(t),"--volter-viewport-gizmo-size");if(!n)return null;const s=Number.parseFloat(n);return Number.isFinite(s)&&s>0?s:null}function Rxn(t){const n=dA(t),s=(d,m)=>{const g=Number.parseFloat(Ig(n,d)??"");return Number.isFinite(g)&&g>0?g:m},c=s("--volter-viewport-grid-line-width",1);return{lineWidth:c,majorWidth:s("--volter-viewport-grid-major-width",c),majorContrast:s("--volter-viewport-grid-major-contrast",1)}}function Fxn(t){const n=dA(t),s=oee(n,"--volter-viewport-wire"),c=Number.parseFloat(Ig(n,"--volter-viewport-wire-opacity"));return{color:s?iee(s):null,opacity:Number.isFinite(c)?c:null}}function Mxn(t){const n=dA(t),s=Number.parseFloat(Ig(n,"--volter-viewport-selection-box-width"));return{edges:Ig(n,"--volter-viewport-selection-box")==="edges",frame:Ig(n,"--volter-viewport-selection-box-frame")==="object"?"object":"world",lineWidth:Number.isFinite(s)&&s>0?s:null}}function NMt(t){const n=dA(t);return["--volter-viewport-chrome-bar","--volter-viewport-chrome-view-name","--volter-viewport-chrome-tools","--volter-viewport-chrome-display","--volter-viewport-chrome-transform-controls"].map(s=>Ig(n,s)).join("|")}function hcn(t){const[n,s,c,d,m]=t.split("|"),g=["strip","pills"],S=["menu","gizmo","bar"],k=["bar-start","bar-end"],A=(F,D,J)=>D.includes(F)?F:J;return{bar:A(n,g,"none"),viewName:A(s,S,"text"),tools:A(c,k,"shelf"),display:A(d,k,"corner"),transformControls:m==="bar"?"bar":"header"}}let mje=null;function gcn(t){return RMt(null,()=>{mje=NMt(),t()})}function _wt(){return mje??=NMt(),mje}let hje=null;function OMt(){const t=dA();return JSON.stringify([gBe.map(n=>Ig(t,`--volter-viewport-word-${n}`)),Ig(t,"--volter-viewport-word-helpers")])}function ycn(t){return RMt(null,()=>{hje=OMt(),t()})}function mwt(){return hje??=OMt(),hje}function jxn(){const t=Ye.useSyncExternalStore(ycn,mwt,mwt);return Ye.useMemo(()=>{const[n,s]=JSON.parse(t),c={};return gBe.forEach((d,m)=>{n[m]&&(c[d]=n[m])}),{shading:c,helpers:s||void 0}},[t])}function vcn(){const t=Ye.useSyncExternalStore(gcn,_wt,_wt);return Ye.useMemo(()=>hcn(t),[t])}function RMt(t,n){n();const s=dA(t);if(!s||typeof MutationObserver>"u")return()=>{};const c=new MutationObserver(n);c.observe(s,{attributes:!0,attributeFilter:["style"]});const d=bcn(s,n);return()=>{c.disconnect(),d()}}const c_e=new Set;let YL=null,bOe="";function bcn(t,n){const s=()=>Object.values(PMt).map(c=>Ig(t,c)).join("|");return c_e.add(n),!YL&&typeof document<"u"&&document.head&&(bOe=s(),YL=new MutationObserver(()=>{const c=s();if(c!==bOe){bOe=c;for(const d of[...c_e])d()}}),YL.observe(document.head,{childList:!0,subtree:!0,characterData:!0})),()=>{c_e.delete(n),c_e.size===0&&YL&&(YL.disconnect(),YL=null)}}function Scn({documentId:t,runtime:n=!1,island:s=!1,assetPath:c,transformControls:d,children:m}){Ye.useSyncExternalStore(bBe,o$,o$);const g=Ye.useSyncExternalStore(U$,eA,eA),S=o2(t)?.HeaderControls;return!m&&!S&&!d||!n&&g.includes("header:hidden")?null:$.jsxs("div",{className:s?"volter-dock-document-toolbar volter-chrome-island volter-glass-island":"volter-dock-document-toolbar","data-runtime-toolbar":n||void 0,"data-island-scale":"compact","data-testid":`document-header:${t}`,children:[m?$.jsx("div",{className:"volter-dock-document-toolbar-own",children:m}):null,d,S?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(S,{documentId:t,...c&&!c.startsWith("online:")?{assetPath:c}:{}})}):null]})}function xcn({documentId:t,children:n}){const s=Ye.useSyncExternalStore(U$,eA,eA);return!n||s.includes("shelf:hidden")?null:$.jsx("div",{className:"volter-dock-document-shelf","data-testid":`document-shelf:${t}`,role:"toolbar","aria-orientation":"vertical","aria-label":"Document tools",children:n})}function wcn(t){return t==="game"||t==="scene"||t==="world"?"world":"resource"}function FMt({viewId:t,descriptor:n,active:s,backdrop:c=!1,chrome:d=!0}){const m=n.Content,g=n.Toolbar,S=n.Shelf,k=wcn(n.kind),A=Yv();Ye.useSyncExternalStore(A.subscribe,A.getShellSnapshot??A.getSnapshot),Ye.useSyncExternalStore(Cee,AD,AD),Ye.useSyncExternalStore(bBe,o$,o$),Ye.useSyncExternalStore(oCt,VOe,VOe);const F=o2(n.id),D=s&&n.kind!=="game"?F?.transformTools?.()??"none":"none",J=F?.TransformTools,q=F?.TransformControls,G=vcn(),se=d&&F!==null&&F!==void 0&&!c,pe=se&&G.bar!=="none"&&G.tools!=="shelf",ue=Ye.useSyncExternalStore(U$,eA,eA).includes("shelf:hidden"),Ce=D==="none"||!J?null:$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(J,{documentId:n.id})}),Fe=se&&G.bar!=="none",De=!Fe||G.display==="corner"?null:G.display==="bar-start"?"start":"end",be=pe?G.tools==="bar-start"?"start":"end":null,X=Fe&&G.transformControls==="bar"&&D==="gizmo"&&q!==void 0,we=X?be??De??"start":null,Be=bt=>$.jsxs("div",{className:"volter-stage-bar-group","data-edge":bt,children:[De===bt?$.jsx("div",{className:"volter-stage-bar-slot","data-stage-bar-slot":"display"}):null,be===bt?Ce:null,we===bt&&q?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(q,{documentId:n.id})}):null]});return $.jsxs("div",{className:"volter-dock-document","data-testid":`workspace-doc:${n.id}`,"data-editor-hotkey-scope":k==="world"?"viewport":"workspace","data-volter-document-family":k,children:[d&&$.jsx(Scn,{documentId:n.id,runtime:n.kind==="game",island:c&&k==="world",assetPath:iQr(n.id)?.assetPath,transformControls:D==="gizmo"&&q&&!X?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(q,{documentId:n.id})}):null,children:g?$.jsx(g,{documentId:n.id,active:s}):null}),$.jsxs("div",{className:"volter-dock-document-content","data-workspace-document-id":n.id,"data-workspace-view-id":t,"data-volter-stage-bar":se&&G.bar!=="none"?G.bar:void 0,"data-volter-stage-rail":d&&!ue&&(Ce&&!pe||S)?void 0:"empty",children:[$.jsx(m,{documentId:n.id,...t?{viewId:t}:{},active:s}),Fe?$.jsxs("div",{className:"volter-stage-bar","data-form":G.bar,role:"toolbar","aria-label":"Viewport",children:[Be("start"),Be("end")]}):null,d&&$.jsx(xcn,{documentId:n.id,children:Ce&&!pe||S?$.jsxs($.Fragment,{children:[pe?null:Ce,S?$.jsx(S,{documentId:n.id,active:s}):null]}):null})]})]})}const l_e=new Map;function Tcn(t,n){const s=Em();let c=l_e.get(t);(!c||c.project!==s)&&(c={project:s,count:0,created:n},l_e.set(t,c)),c.count++;const d=c;return()=>{l_e.get(t)!==d||--d.count>0||(l_e.delete(t),d.created&&Em()===d.project&&EN(t))}}function Ccn({document:t,chrome:n=!0,active:s=!0,onReady:c}){const d=Yv(),[m,g]=Ye.useState(null),[S,k]=Ye.useState(null),A=JSON.stringify(t),F=Ye.useRef(c);F.current=c;const D=Ye.useRef(null);Ye.useSyncExternalStore(i2,X1,X1);const J=Ye.useSyncExternalStore(bBe,o$,o$);Ye.useEffect(()=>{let G=!1,se;const pe=Em(),ue=()=>!G&&Em()===pe,Ce=JSON.parse(A);return g(null),k(null),(async()=>{if(await Gze(),!ue())return;const Fe=new Set(l0().map(be=>be.descriptor.id)),De=Ce.kind==="asset"?sN(Ce.path,Ce.assetKind??"source",{activate:s}):Ce.kind==="workspace"?Fe.has(Ce.id)?Ce.id:null:await Wye(Ce.kind,d,{...Ce,activate:s});if(ue()){if(!De)throw new Error("The requested layout document is unavailable.");se=Tcn(De,!Fe.has(De)),g(De)}})().catch(Fe=>{ue()&&k(Fe instanceof Error?Fe.message:String(Fe))}),()=>{G=!0,se?.()}},[d,A]),Ye.useEffect(()=>{!m||!s||X0(m)},[m,s]),Ye.useEffect(()=>{if(!m)return;const G=o2(m);if(!(!G||D.current===G)){D.current=G;try{F.current?.({select(se){const pe=G.idsNamed?.(se)??[];if(pe.length!==1)throw new Error(`Expected one object named "${se}"; found ${pe.length}.`);G.selection?.apply(pe)},transform(se){G.setTransformMode?.(se)},frame(){G.frame("document")}})}catch(se){k(se instanceof Error?se.message:String(se))}}},[m,J]);const q=m?l0().find(G=>G.descriptor.id===m):void 0;return $.jsx("div",{style:{position:"relative",flex:1,minWidth:0,minHeight:0,height:"100%",overflow:"hidden"},children:S?$.jsx("div",{role:"alert",children:S}):q?$.jsx(FMt,{descriptor:q.descriptor,active:s,chrome:n}):$.jsx("div",{role:"status",children:"Opening document…"})})}function Ecn(){return $.jsxs(kee,{children:[$.jsx(Aee,{}),$.jsx(Pee,{}),$.jsx(Dee,{})]})}function kcn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot);const n=Ye.useSyncExternalStore(zye,c$,c$),[s,c]=Ye.useState(!1),d=Ye.useSyncExternalStore(OC,nxt,nxt);if(Ye.useEffect(()=>{let g=!1;return Gze().then(()=>{g||c(!0)}),()=>{g=!0}},[]),!s)return $.jsx("div",{role:"status",children:d??"Loading project layout…"});const m=n.Layout??Ecn;return $.jsx(m,{playing:t.playState!=="stopped",paused:t.playState==="paused"})}function $Ve({size:t=64}){return $.jsx("img",{src:lee()?.logo??mR.logo,width:t,height:t,alt:"","aria-hidden":"true","data-testid":"volter-logo",style:{display:"block"}})}const gje="account";function MMt(){return ND({id:gje,title:"Account",kind:"tool-contribution",workspaceRole:"workspace-task",provenance:{origin:"Volter account"},Content:Icn,closeable:!0,presentation:()=>({kind:"workspace",id:gje})})}kN({id:"workspace",owner:"account-documents",open:(t,n)=>n.id===gje?MMt():null});function Acn(t){return t.source==="environment"?`Environment · ${t.environmentVariable}`:t.source==="system"?"Secure system storage":t.source==="session"?t.configured?"Session only":"Session storage":"Not configured"}function hB({children:t}){return $.jsxs("div",{className:"volter-account-infostrip",children:[$.jsx(dc,{icon:R$,className:"volter-account-infostrip-icon","aria-hidden":"true"}),$.jsx("span",{children:t})]})}function Dcn({provider:t,busy:n,run:s,editing:c,removing:d,onEdit:m,onStopEditing:g,onRemoveIntent:S}){const[k,A]=Ye.useState("");return $.jsxs("div",{className:"volter-account-provider","data-configured":t.configured,children:[$.jsx("span",{className:"volter-account-provider-monogram","aria-hidden":"true",children:t.label.slice(0,1)}),$.jsxs("div",{className:"volter-account-provider-main",children:[$.jsxs("div",{className:"volter-account-provider-name",children:[$.jsx("strong",{children:t.label}),t.configured&&$.jsxs($.Fragment,{children:[$.jsx("span",{className:"volter-account-provider-dot","aria-hidden":"true"}),$.jsx("span",{className:"volter-account-provider-key",children:t.maskedKey})]})]}),$.jsx("span",{className:"volter-account-provider-source",children:Acn(t)}),t.source==="session"&&t.configured&&$.jsx("span",{className:"volter-account-provider-warning",children:"No system credential manager is available. This key will be forgotten when the editor stops."}),t.problem&&$.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:t.problem}),t.source==="environment"&&$.jsxs("span",{className:"volter-account-provider-source",children:["Restart the editor after changing ",t.environmentVariable,"."]})]}),c?$.jsxs("form",{className:"volter-account-provider-form",onSubmit:F=>{F.preventDefault(),s(async()=>{await fwr(t.provider,k),A(""),g()},`${t.label} credential saved.`)},children:[$.jsxs("label",{className:"volter-field",children:[$.jsxs("span",{className:"volter-field-label",children:[t.label," API key"]}),$.jsx(Zm,{autoComplete:"off",autoFocus:!0,type:"password",value:k,onChange:F=>A(F.target.value)})]}),$.jsxs("div",{className:"volter-account-provider-form-actions",children:[$.jsx(Ms,{type:"submit",variant:"primary",disabled:n||k.trim()==="",children:"Save key"}),$.jsx(Ms,{type:"button",variant:"ghost",disabled:n,onClick:()=>{A(""),g()},children:"Cancel"})]})]}):$.jsxs("div",{className:"volter-account-provider-actions",children:[t.configured&&$.jsx(Ms,{size:"compact",disabled:n,onClick:()=>void s(()=>pwr(t.provider),`${t.label} credential is valid.`),children:"Test"}),t.editable&&$.jsx(Ms,{size:"compact",variant:t.configured?"ghost":"secondary",disabled:n,onClick:()=>{A(""),m()},children:t.configured?"Replace":"Add key"}),t.editable&&t.configured&&!d&&$.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(t.provider),children:"Remove"}),d&&$.jsxs($.Fragment,{children:[$.jsx(Ms,{size:"compact",variant:"danger",disabled:n,onClick:()=>void s(async()=>{await dwr(t.provider),S(null)},`${t.label} credential removed.`),children:"Confirm remove"}),$.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(null),children:"Cancel"})]})]})]})}function hwt({busy:t,run:n}){const s=XLe(),[c,d]=Ye.useState(null),[m,g]=Ye.useState(null),S=s.providerCredentials.filter(k=>k.configured).length;return $.jsxs("section",{className:"volter-account-card volter-provider-connections",children:[$.jsxs("div",{className:"volter-account-providers-header",children:[$.jsxs("div",{children:[$.jsx("h3",{className:"volter-account-card-title",children:"Provider connections"}),$.jsx("p",{className:"volter-account-card-sub",children:"Keys live in this computer's credential manager — never in project files or the editor UI."})]}),$.jsxs("span",{className:"volter-status-dot","data-state":S>0?"on":"off",children:[S," connected"]})]}),$.jsx("div",{className:"volter-account-provider-list",children:s.providerCredentials.map(k=>$.jsx(Dcn,{provider:k,busy:t,run:n,editing:c===k.provider,removing:m===k.provider,onEdit:()=>{g(null),d(k.provider)},onStopEditing:()=>d(null),onRemoveIntent:g},k.provider))})]})}function gwt({busy:t,run:n}){const s=XLe(),c=s.codingInference,[d,m]=Ye.useState(c.model),[g,S]=Ye.useState(null),[k,A]=Ye.useState(null);Ye.useEffect(()=>m(c.model),[c.model]),Ye.useEffect(()=>{S(null),A(null)},[d,s.preferredRoute]);const F=D=>n(()=>lwr({...c,...D,model:(D.model??c.model).trim()}),"Coding inference settings saved.");return $.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Coding inference"}),$.jsxs("p",{className:"volter-account-card-sub",children:["Coding agents run on the login you already did — ",$.jsx("code",{children:"codex login"}),", Claude's device login, ",$.jsx("code",{children:"grok login"})," — and Volter Editor injects nothing into them. Turn this on only for a harness you have no subscription for: it routes that harness through OpenRouter on this account's managed credits or your own key, and it takes effect only while Preferred route above is Managed or BYOK. Existing sessions keep the route they launched with."]}),$.jsxs("label",{className:"volter-account-switch-row",children:[$.jsx(TD,{checked:c.enabled,disabled:t,onChange:D=>void F({enabled:D.target.checked})}),$.jsxs("span",{className:"volter-account-switch-copy",children:[$.jsx("strong",{children:"Use OpenRouter for coding agents"}),$.jsx("small",{children:"Codex, Claude Code, OpenCode and Pi are configured per spawned process. Grok takes no provider configuration and always runs on its own device login."})]})]}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Managed coding model"}),$.jsxs(Iw,{value:d,disabled:t,onChange:D=>{const J=D.target.value;m(J),J!==c.model&&F({model:J})},children:[!["z-ai/glm-5.2","moonshotai/kimi-k3"].includes(d)&&$.jsxs("option",{value:d,children:[d," · custom"]}),$.jsx("option",{value:"z-ai/glm-5.2",children:"GLM-5.2 · managed default"}),$.jsx("option",{value:"moonshotai/kimi-k3",children:"Kimi K3 · higher-cost option"})]})]}),s.preferredRoute==="managed"?$.jsxs("div",{className:"volter-account-card-footer",children:[$.jsx(Ms,{size:"compact",disabled:t,onClick:()=>{A(null),uwr({model:d,promptTokens:1e5,outputTokens:2e4}).then(S).catch(D=>A(D instanceof Error?D.message:String(D)))},children:"Preflight typical coding session"}),g&&$.jsxs("span",{className:"volter-account-help",children:["Estimate: ",g.estimatedCredits.toLocaleString()," Volter credits ($",g.providerAmountUsd.toFixed(4)," provider cost) for 100k input + 20k output tokens."]}),k&&$.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:k})]}):s.preferredRoute==="byok"?$.jsx(hB,{children:"BYOK coding charges OpenRouter directly and consumes zero Volter credits."}):null,$.jsxs(hB,{children:["Active account route: ",s.preferredRoute,". BYOK requires the OpenRouter connection below; managed uses the Volter balance."]})]})}function Pcn({plan:t}){const n=t.status.replace("_"," "),s=t.status==="active"||n.toLowerCase()===t.name.trim().toLowerCase();return $.jsxs("span",{className:"volter-account-plan-chips",children:[$.jsxs("span",{className:"volter-chip","data-tone":"accent",children:[t.name," plan"]}),!s&&$.jsx("span",{className:"volter-chip","data-tone":t.status==="cancelling"?"warn":void 0,children:n}),(t.renewsAt||t.endsAt)&&$.jsxs("span",{className:"volter-chip",children:[t.endsAt?"Access ends":"Renews"," ",new Date(t.endsAt??t.renewsAt).toLocaleDateString()]})]})}function Icn(){Ye.useSyncExternalStore(Tye,cN,cN);const t=XLe(),[n,s]=Ye.useState("builder@example.test"),[c,d]=Ye.useState([]),[m,g]=Ye.useState(null),[S,k]=Ye.useState("creator"),[A,F]=Ye.useState(""),[D,J]=Ye.useState(!1),[q,G]=Ye.useState(null),[se,pe]=Ye.useState(null),[ue,Ce]=Ye.useState(null),[Fe,De]=Ye.useState(!1);Ye.useEffect(()=>{if(t.authenticated||t.backend!=="live"||t.accountEnvironment==="development-twin"){De(!1);return}vwr().then(zt=>De(zt.device)).catch(()=>De(!1))},[t.authenticated,t.backend]),Ye.useEffect(()=>{if(!ue)return;const zt=()=>{Swr(ue.authorizationId).then(tr=>{tr&&Ce(null)}).catch(tr=>{G(tr instanceof Error?tr.message:String(tr)),Ce(null)})};zt();const ft=window.setInterval(zt,1e3);return()=>window.clearInterval(ft)},[ue]),Ye.useEffect(()=>{if(!se)return;const zt=()=>{wwr(se.deviceCode).then(tr=>{tr&&pe(null)}).catch(tr=>{G(tr instanceof Error?tr.message:String(tr)),pe(null)})},ft=window.setInterval(zt,Math.max(1,se.intervalSeconds)*1e3);return()=>window.clearInterval(ft)},[se]),Ye.useEffect(()=>{if(!t.authenticated){d([]);return}hwr().then(d).catch(()=>d([]))},[t.authenticated,t.authenticated?t.user.id:"signed-out",t.authenticated?t.credits.used:0]),Ye.useEffect(()=>{if(!t.authenticated){g(null);return}gwr().then(zt=>{g(zt);const ft=["creator","max","ultra"].find(tr=>tr!==t.plan.id);k(ft??"creator"),F(Object.keys(zt.creditPacks)[0]??"")}).catch(()=>g(null))},[t.authenticated,t.authenticated?t.user.id:"signed-out"]);const be=async(zt,ft)=>{J(!0),G(null);try{await zt(),ft&&G(ft)}catch(tr){G(tr instanceof Error?tr.message:String(tr))}finally{J(!1)}};if(!t.authenticated)return $.jsx("div",{className:"volter-account","data-testid":"account-document",children:$.jsxs("div",{className:"volter-account-signin-stack",children:[$.jsxs("div",{className:"volter-account-signin-hero",children:[$.jsx("span",{className:"volter-account-signin-mark","aria-hidden":"true",children:$.jsx($Ve,{size:52})}),$.jsx("h1",{className:"volter-account-signin-title",children:"Sign in to Volter Editor"})]}),t.accountEnvironment==="development-twin"?$.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>iwr(n),"Signed in through the local Clerk Twin.")},children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Development email"}),$.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),$.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use Clerk Twin account"}),$.jsx(hB,{children:"Local Clerk and Polar twins — fake identity and checkout, with the real Volter account and credit boundaries."})]}):t.backend==="live"?$.jsxs("section",{className:"volter-account-card volter-account-signin-card",children:[$.jsx(Ms,{variant:"primary",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await bwr();Ce(zt),window.open(zt.authorizationUrl,"_blank","noopener,noreferrer")}),children:ue?"Waiting for browser sign-in…":"Continue in browser"}),Fe&&$.jsx(Ms,{variant:"ghost",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await xwr();pe(zt),window.open(zt.verificationUri,"_blank","noopener,noreferrer")}),children:"Use a device code instead"}),se&&$.jsxs("div",{className:"volter-account-device-code",children:[$.jsx("strong",{children:se.userCode}),$.jsx("span",{children:"Complete authorization in the browser. This editor polls without receiving your password."})]}),$.jsx(hB,{children:"Authorization happens in your browser — this editor never sees your password."})]}):$.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>nwr(n),"Signed in to the zero-charge local account.")},children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Email"}),$.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),$.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use local mock account"}),$.jsx(hB,{children:"Local mock — no payment, network identity, or provider request."})]}),$.jsxs("ul",{className:"volter-account-signin-points",children:[$.jsx("li",{children:"Every paid generation shows its route and estimate first"}),$.jsx("li",{children:"Spend controls and hard limits are on by default"}),$.jsx("li",{children:"Provider keys stay in your system credential manager"})]}),$.jsx(gwt,{busy:D,run:be}),$.jsx(hwt,{busy:D,run:be}),(q||wpe())&&$.jsx("div",{className:"volter-account-status",role:"status",children:q??wpe()})]})});const X=t.credits.included+t.credits.purchased,we=X===0?0:Math.min(100,t.credits.used/X*100),Be=X===0?0:Math.max(0,Math.min(100-we,t.credits.reserved/X*100)),bt=X>0&&t.credits.used>X,It=t.backend==="mock"||t.entitlements.generation,Wt=zt=>swr({...t.spendPolicy,...zt});return $.jsxs("div",{className:"volter-account","data-testid":"account-document",children:[$.jsx("h1",{className:"volter-sr-only",children:"Account"}),$.jsxs("div",{className:"volter-account-stack",children:[$.jsxs("header",{className:"volter-account-identity",children:[$.jsx("span",{className:"volter-account-avatar","aria-hidden":"true",children:t.user.email.slice(0,1)}),$.jsxs("div",{className:"volter-account-identity-main",children:[$.jsxs("div",{className:"volter-account-identity-row",children:[$.jsx("h2",{className:"volter-account-identity-email",children:t.user.email}),$.jsx(Pcn,{plan:t.plan})]}),$.jsx("p",{className:"volter-account-identity-note",children:t.accountEnvironment==="development-twin"?"Clerk + Polar Twin development account":t.backend==="mock"?"Isolated test account":"Volter account"})]}),$.jsx(Ms,{variant:"ghost",className:"volter-account-signout",disabled:D,onClick:()=>void be(owr),children:"Sign out"})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsxs("div",{className:"volter-account-card-head",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Credits"}),t.plan.id!=="free"&&t.plan.status==="cancelling"&&$.jsx(Ms,{size:"compact",disabled:D,onClick:()=>void be(()=>aht("resume")),children:"Resume subscription"})]}),!It&&$.jsx(hB,{children:"This account has not been admitted to Volter managed services. Signing up or paying does not grant provider access; contact the Volter team for admission."}),m&&$.jsxs("div",{className:"volter-account-card-footer",children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Subscription tier"}),$.jsx(Iw,{value:S,disabled:D||!It,onChange:zt=>k(zt.target.value),children:Object.keys(m.plans).map(zt=>{const ft=m.plans[zt],tr=ft.monthlyPriceUsd;return $.jsxs("option",{value:zt,disabled:zt==="free",children:[ft.name,tr!==void 0?` · $${tr}/month`:""," ·"," ",ft.includedCredits.toLocaleString()," credits",zt===t.plan.id?" · current":""]},zt)})})]}),$.jsxs(Ms,{variant:"primary",size:"compact",disabled:D||!It||S===t.plan.id||S==="free",onClick:()=>void be(async()=>{const zt=await _wr(S);zt.checkoutUrl?window.open(zt.checkoutUrl,"_blank","noopener,noreferrer"):G(zt.mock?`Mock ${m.plans[S].name} upgrade completed. No payment occurred.`:`Subscription changed to ${m.plans[S].name}.`)}),children:["Choose ",m.plans[S].name]})]}),$.jsxs("div",{className:"volter-account-credit-figure",children:[$.jsx("span",{className:"volter-account-credit-number",children:t.credits.remaining.toLocaleString()}),$.jsx("span",{className:"volter-account-credit-unit",children:"credits remaining"})]}),$.jsxs("div",{className:"volter-meter",role:"progressbar","aria-label":"Credits used","aria-valuenow":Math.round(we),"aria-valuemin":0,"aria-valuemax":100,"data-state":bt?"over":void 0,children:[$.jsx("span",{className:"volter-meter-fill",style:{width:`${we}%`}}),Be>0&&$.jsx("span",{className:"volter-meter-fill","data-part":"reserved",style:{left:`${we}%`,width:`${Be}%`}})]}),$.jsxs("p",{className:"volter-account-cycle-line",children:[t.credits.used.toLocaleString()," of ",X.toLocaleString()," used this cycle",t.credits.resetsAt&&$.jsxs($.Fragment,{children:[" · resets ",new Date(t.credits.resetsAt).toLocaleDateString()]}),bt&&$.jsx("span",{className:"volter-account-cycle-over",children:" · over allowance"})]}),$.jsxs("div",{className:"volter-account-legend","data-state":bt?"over":void 0,children:[$.jsxs("span",{className:"volter-account-legend-item","data-part":"included",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.included.toLocaleString()," included"]}),$.jsxs("span",{className:"volter-account-legend-item","data-part":"used",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.used.toLocaleString()," used"]}),$.jsxs("span",{className:"volter-account-legend-item","data-part":"reserved",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.reserved.toLocaleString()," reserved"]}),$.jsxs("span",{className:"volter-account-legend-item","data-part":"purchased",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.purchased.toLocaleString()," purchased"]})]}),t.credits.purchasedExpiresAt&&$.jsxs("p",{className:"volter-account-help volter-account-expiry",children:["Purchased credits expire"," ",new Date(t.credits.purchasedExpiresAt).toLocaleDateString(),"."]}),$.jsxs("div",{className:"volter-account-card-footer",children:[m&&A&&m.creditPacks[A]&&$.jsxs($.Fragment,{children:[$.jsx(Iw,{"aria-label":"Credit pack",value:A,disabled:D||!It,onChange:zt=>F(zt.target.value),children:Object.entries(m.creditPacks).map(([zt,ft])=>$.jsxs("option",{value:zt,children:[ft.name," · ",ft.credits.toLocaleString()," credits"]},zt))}),$.jsx(Ms,{size:"compact",disabled:D||!It,onClick:()=>void be(async()=>{const zt=m.creditPacks[A],ft=await mwr(A);ft.checkoutUrl?window.open(ft.checkoutUrl,"_blank","noopener,noreferrer"):G(`Added ${zt?.credits.toLocaleString()??""} mock credits. No payment occurred.`)}),children:"Buy credits"})]}),$.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(async()=>{const zt=await ywr();zt.mock?G("Mock billing portal: no payment page was opened."):window.open(zt.url,"_blank","noopener,noreferrer")}),children:"Billing and invoices"}),t.plan.id!=="free"&&t.plan.status==="active"&&$.jsx(Ms,{size:"compact",variant:"ghost",className:"volter-account-quiet-danger",disabled:D,onClick:()=>void be(()=>aht("cancel")),children:"Cancel at renewal"})]})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Generation routing"}),$.jsx("p",{className:"volter-account-card-sub",children:"Billing preference for AI usage. Provider libraries apply it automatically; requests show the resolved account and cost before submission."}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Preferred route"}),$.jsxs(Iw,{value:t.preferredRoute,onChange:zt=>void be(()=>cwr(zt.target.value)),children:[t.accountEnvironment==="test-mock"&&$.jsx("option",{value:"mock",children:"Mock · free and local"}),$.jsx("option",{value:"auto",children:"Automatic · saved key or Volter account"}),$.jsxs("option",{value:"managed",disabled:!t.routes.managed,children:["Managed · Volter credits",t.routes.managed?"":" (unavailable)"]}),$.jsxs("option",{value:"byok",disabled:!t.routes.byok,children:["BYOK · provider dollars",t.routes.byok?"":" (no key found)"]})]})]})]}),$.jsx(gwt,{busy:D,run:be}),$.jsx(hwt,{busy:D,run:be}),(t.alerts?.length??0)>0&&$.jsxs("section",{className:"volter-account-card",children:[$.jsxs("div",{className:"volter-account-card-head",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Account alerts"}),t.alerts?.some(zt=>!zt.readAt)&&$.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(awr),children:"Mark read"})]}),$.jsx("div",{className:"volter-account-usage",children:t.alerts?.map(zt=>$.jsxs("div",{className:"volter-account-usage-row",children:[$.jsxs("span",{children:[$.jsx("strong",{children:zt.readAt?"Notice":"New"}),$.jsx("small",{children:zt.message})]}),$.jsx("span",{children:new Date(zt.createdAt).toLocaleDateString()})]},zt.id))})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Spend controls"}),$.jsxs("p",{className:"volter-account-card-sub",children:["Alerts at ",t.spendPolicy.alertThresholds.join("%, "),"% of the available allowance."]}),$.jsxs("label",{className:"volter-account-switch-row",children:[$.jsx(TD,{checked:t.spendPolicy.overageEnabled,onChange:zt=>void be(()=>Wt({overageEnabled:zt.target.checked,monthlyLimitCredits:zt.target.checked&&t.spendPolicy.monthlyLimitCredits===0?1e3:t.spendPolicy.monthlyLimitCredits}))}),$.jsxs("span",{className:"volter-account-switch-copy",children:[$.jsx("strong",{children:"Allow paid overage"}),$.jsx("small",{children:"Off by default. Managed requests stop before provider submission."})]})]}),$.jsx("div",{className:"volter-account-limit-field",children:$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Monthly overage hard limit"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.monthlyLimitCredits,disabled:!t.spendPolicy.overageEnabled,onBlur:zt=>void be(()=>Wt({monthlyLimitCredits:Number(zt.target.value)}))},t.spendPolicy.monthlyLimitCredits),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})}),$.jsxs("label",{className:"volter-account-switch-row",children:[$.jsx(TD,{checked:t.spendPolicy.autoReload?.enabled===!0,onChange:zt=>void be(()=>Wt({autoReload:{enabled:zt.target.checked,whenRemainingBelow:t.spendPolicy.autoReload?.whenRemainingBelow??100,reloadTo:t.spendPolicy.autoReload?.reloadTo??500,monthlyLimitCredits:t.spendPolicy.autoReload?.monthlyLimitCredits??2e3}}))}),$.jsxs("span",{className:"volter-account-switch-copy",children:[$.jsx("strong",{children:"Automatically reload credits"}),$.jsx("small",{children:"Optional, independently capped, and never enabled by checkout."})]})]}),t.spendPolicy.autoReload?.enabled&&$.jsxs("div",{className:"volter-account-policy-fields",children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Reload below"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.autoReload.whenRemainingBelow,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,whenRemainingBelow:Number(zt.target.value)}}))},t.spendPolicy.autoReload.whenRemainingBelow),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Reload balance to"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.jsx(Zm,{type:"number",min:1,defaultValue:t.spendPolicy.autoReload.reloadTo,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,reloadTo:Number(zt.target.value)}}))},t.spendPolicy.autoReload.reloadTo),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Monthly reload cap"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.autoReload.monthlyLimitCredits,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,monthlyLimitCredits:Number(zt.target.value)}}))},t.spendPolicy.autoReload.monthlyLimitCredits),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})]})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Current-cycle usage"}),c.length===0?$.jsx("p",{className:"volter-account-help",children:"No managed credit usage has been settled in this account."}):$.jsx("div",{className:"volter-account-usage",children:c.map(zt=>$.jsxs("div",{className:"volter-account-usage-row",children:[$.jsxs("span",{children:[zt.kind," · ",zt.provider," · ",zt.operation??"managed operation"]}),$.jsxs("strong",{children:[zt.credits.toLocaleString()," credits"]})]},zt.id))})]}),(q||wpe())&&$.jsx("div",{className:"volter-account-status",role:"status",children:q??wpe()})]})]})}function Ncn(t,n,s){const d=navigator.platform.includes("Mac")?"⌘":"Ctrl+",m=Y0(t),g=[...t.selectedEntityIds],S=g[0],k=S?m.hierarchy.node(S)?.parentId??null:null,A=g.length>0&&!!m.structure?.copy&&(m.structure.canCopy?.(g)??!0),F=A&&!!m.structure?.cut,D=!!m.structure?.paste&&(m.structure.canPaste?.(k)??!0),J=[...F?[{id:"editor.cut",label:"Cut",category:"action",shortcut:Vv("edit.cut"),execute:()=>MVe(t)}]:[],...A?[{id:"editor.copy",label:"Copy",category:"action",shortcut:Vv("edit.copy"),execute:()=>FVe(t)}]:[],...D?[{id:"editor.paste",label:"Paste",category:"action",shortcut:Vv("edit.paste"),execute:()=>jVe(t)}]:[]];return[{id:"account.open",label:"Account and Provider Connections",category:"action",execute:()=>{MMt()}},{id:"editor.undo",label:s?.undoLabel?`Undo ${s.undoLabel}`:"Undo",category:"action",shortcut:Vv("edit.undo"),execute:async()=>{await n.undo()}},{id:"editor.redo",label:s?.redoLabel?`Redo ${s.redoLabel}`:"Redo",category:"action",shortcut:Vv("edit.redo"),execute:async()=>{await n.redo()}},...J,{id:"editor.duplicate",label:"Duplicate",category:"action",shortcut:Vv("edit.duplicate"),execute:()=>_ve(t)},{id:"editor.delete",label:"Delete Selected",category:"action",shortcut:Vv("edit.delete"),execute:()=>mve(t)},{id:"editor.select-all",label:"Select All",category:"action",shortcut:Vv("edit.selectAll"),execute:()=>kRt(t)},{id:"editor.deselect",label:"Deselect All",category:"action",shortcut:Vv("edit.deselectAll")??Vv("edit.exitScopeOrDeselect"),execute:()=>Ize(t,[])},{id:"toggle.console",label:"Toggle Console",category:"action",shortcut:Vv("view.toggleConsole"),execute:()=>{ave()}},{id:"view.focusMode",label:"Toggle Focus Mode",category:"action",shortcut:Vv("view.focusMode"),execute:()=>{MBe()}},...AN().map(q=>({id:`workspace.${q.id}`,label:`Workspace: ${q.title}`,category:"action",execute:()=>{Uk(q.id)&&s2(q.id)}})),{id:"workspace.cycleNext",label:"Next Workspace",category:"action",shortcut:Vv("workspace.cycleNext"),execute:()=>{She(1)}},{id:"workspace.cyclePrevious",label:"Previous Workspace",category:"action",shortcut:Vv("workspace.cyclePrevious"),execute:()=>{She(-1)}},...W4t().map(q=>({id:`keymap.${q.id}`,label:`Keymap: ${q.title}`,category:"action",execute:()=>{$Er(q.id)}})),...OR().map(q=>({id:`view.workspaceStyle.${q.id}`,label:`Workspace Style: ${q.title}`,category:"action",execute:()=>{HBe(q.id)}})),{id:"view.undoHistory",label:"Undo History",category:"action",execute:()=>{LVe()}},{id:"view.lightExplorer",label:"Open Light Explorer",category:"action",execute:()=>bC(nee.lightExplorer.id)},...Object.values(O_).filter(q=>q.id!==O_.open.id).map(q=>({id:q.id,label:`${q.id.replace("project-asset.","").split("-").map(G=>G[0]?.toUpperCase()+G.slice(1)).join(" ")} Project Asset`,category:"asset",...q.shortcut?{shortcut:q.shortcut.replace("Mod",d)}:{},execute:()=>{window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:q.id}}))}})),{id:"view.asset-library",label:"Asset Library",category:"action",execute:()=>{FBe("asset-library")}}]}function Ocn(t){return W0e(t).filter(n=>n.id!==kFe).map(n=>({id:`entity:${n.id}`,label:n.name,category:"entity",execute:()=>{Ize(t,[n.id]),RVe("viewport.frameSelection")}}))}function Rcn(){return Q0e().filter(t=>t.category==="canvas").map(({descriptor:t})=>({id:`board:${t.id}`,label:`Open ${t.title}`,category:"action",execute:()=>void SN(t.id)}))}function aN(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Wge(t){const n=t.type;if(typeof n=="string")return n;if(Array.isArray(n))return n.find(s=>s!=="null")}function jMt(t){const n=aN(t);if("default"in n)return structuredClone(n.default);const s=Wge(n);if(s==="object"||n.properties){const c={};for(const[d,m]of Object.entries(aN(n.properties))){const g=aN(m);("default"in g||Array.isArray(n.required)&&n.required.includes(d))&&(c[d]=jMt(g))}return c}return s==="array"?[]:s==="boolean"?!1:s==="number"||s==="integer"?Number(n.minimum??0):""}function yje(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,n=>n.toUpperCase())}function Fcn({name:t,schema:n,value:s,required:c,onChange:d}){const m=Wge(n),g=typeof n.description=="string"?n.description:null,S=Array.isArray(n.enum)?n.enum:null,k=`tool-field:${t}`;if(m==="boolean")return $.jsxs("label",{style:{...VY,gridTemplateColumns:"18px minmax(0, 1fr)"},children:[$.jsx(TD,{id:k,checked:s===!0,onChange:F=>d(F.target.checked)}),$.jsxs("span",{children:[$.jsx("span",{style:ywt,children:yje(t)}),g&&$.jsx("span",{style:FO,children:g})]})]});const A=$.jsxs("span",{style:ywt,children:[yje(t)," ",!c&&$.jsx("span",{style:jcn,children:"optional"})]});return S?$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsxs(Iw,{id:k,value:String(s??""),onChange:F=>d(F.target.value),style:u_e,children:[!c&&$.jsx("option",{value:"",children:"Not set"}),S.map(F=>$.jsx("option",{value:String(F),children:String(F)},String(F)))]}),g&&$.jsx("span",{style:FO,children:g})]}):m==="number"||m==="integer"?$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsx(Zm,{id:k,type:"number",value:typeof s=="number"?s:"",min:typeof n.minimum=="number"?n.minimum:void 0,max:typeof n.maximum=="number"?n.maximum:void 0,step:m==="integer"?1:"any",onChange:F=>d(F.target.value===""?void 0:Number(F.target.value)),style:u_e}),g&&$.jsx("span",{style:FO,children:g})]}):m==="array"&&Wge(aN(n.items))==="string"?$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsx(Zm,{id:k,value:Array.isArray(s)?s.join(", "):"",onChange:F=>d(F.target.value.split(",").map(D=>D.trim()).filter(Boolean)),placeholder:"Comma-separated values",style:u_e}),g&&$.jsx("span",{style:FO,children:g})]}):$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsx(Zm,{id:k,value:typeof s=="string"?s:"",onChange:F=>d(F.target.value||(c?"":void 0)),style:u_e}),g&&$.jsx("span",{style:FO,children:g})]})}function LMt({schema:t,value:n,onChange:s,path:c=""}){const d=aN(t.properties),m=new Set(Array.isArray(t.required)?t.required:[]);return $.jsx("div",{style:{display:"grid",gap:14},children:Object.entries(d).map(([g,S])=>{const k=aN(S),A=Wge(k),F=D=>{const J={...n};D===void 0?delete J[g]:J[g]=D,s(J)};return A==="object"||k.properties?$.jsxs("fieldset",{style:Lcn,children:[$.jsx("legend",{style:Bcn,children:yje(g)}),typeof k.description=="string"&&$.jsx("p",{style:{...FO,marginTop:0},children:k.description}),$.jsx(LMt,{schema:k,value:aN(n[g]),onChange:F,path:c?`${c}.${g}`:g})]},g):$.jsx(Fcn,{name:c?`${c}.${g}`:g,schema:k,value:n[g],required:m.has(g),onChange:F},g)})})}function Mcn({schema:t,value:n,onChange:s}){const c=aN(t);return c.properties?$.jsx(LMt,{schema:c,value:n,onChange:s}):$.jsx("div",{style:FO,children:"This schema has no form-compatible fields."})}const VY={display:"grid",gap:5},ywt={color:Zf[1],fontWeight:600,fontSize:"var(--volter-font-sm)"},jcn={color:Zf[3],fontWeight:400,marginLeft:5},FO={display:"block",color:Zf[2],fontSize:"var(--volter-font-sm)",lineHeight:1.4},u_e={boxSizing:"border-box",width:"100%"},Lcn={margin:0,padding:14,border:"1px solid var(--volter-boundary-default)",borderRadius:"var(--volter-radius-md)"},Bcn={padding:"0 6px",color:Zf[1],fontWeight:600},Hge="project-tools",vje="project-tool:";function $cn(t){return`${vje}${t}`}function gve(){ND({id:Hge,title:"Project Tools",kind:"project-tool",workspaceRole:"workspace-reference",Content:BMt,closeable:!0,presentation:()=>({kind:"workspace",id:Hge}),persist:()=>({catalog:!0})})}function yve(t){const n=N$().tools.find(c=>c.name===t);if(!n)return!1;const s=AC().filter(c=>c.tool?.name===t);return s.length===1?tA(s[0].id):(ND({id:$cn(t),title:n.summary||n.name,kind:"project-tool",workspaceRole:"workspace-reference",provenance:{sourcePath:n.sourcePath,origin:n.name},Content:BMt,closeable:!0,presentation:()=>({kind:"project-tool",name:t}),persist:()=>({name:t})}),!0)}kN({id:"workspace",owner:"project-tool-documents",open:(t,n)=>n.id!==Hge?null:(gve(),Hge)});kN({id:"project-tool",owner:"project-tool-documents",open:(t,n)=>yve(n.name)?e_():null,settle:async t=>{if(await WZ().catch(()=>{}),!await EC(()=>N$().tools.some(n=>n.name===t.name)))throw new Error(`Project tool is not registered: ${t.name}`)}});wee({kind:"project-tool",owner:"project-tool-documents",prepare:()=>WZ().then(()=>{},()=>{}),restore:({state:t})=>{const n=t;return n?.catalog===!0?(gve(),!0):typeof n?.name=="string"&&yve(n.name)}});function qcn(){return[{id:"project-tools:open",label:"Open Project Tools",category:"action",execute:()=>gve()},...N$().tools.map(t=>({id:`project-tool:${t.name}`,label:`Run: ${t.summary||t.name}`,category:"action",execute:()=>void yve(t.name)}))]}function vwt({value:t}){return $.jsx("pre",{style:Jcn,children:JSON.stringify(t,null,2)})}function BMt({documentId:t}){Ye.useSyncExternalStore(nMt,Vsn),Ye.useSyncExternalStore(l2,rA);const n=N$(),s=t.startsWith(vje)?t.slice(vje.length):null,c=s?n.tools.find(d=>d.name===s):null;return s?c?$.jsx(zcn,{tool:c},c.name):$.jsx("div",{style:bje,children:"This tool is no longer available."}):$.jsxs("div",{style:bje,"data-testid":"project-tools-catalog",children:[$.jsx("h2",{style:$Mt,children:"Project Tools"}),$.jsxs("p",{style:{...Sje,margin:"0 0 18px",maxWidth:720,lineHeight:1.5},children:["Explicitly registered in ",$.jsx("code",{children:"package.json#volter.tools"}),". Each tool is an ordinary project function; a registration may pair it with optional editor contributions."]}),$.jsx("div",{style:{display:"grid",gap:8},children:n.tools.map(d=>$.jsxs(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>yve(d.name),"data-testid":`project-command-card:${d.name}`,children:[$.jsxs("span",{style:qMt,children:[$.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:d.summary}),$.jsx("span",{style:zMt,children:"Open"})]}),$.jsx("code",{style:{color:Zf[2],fontSize:"var(--volter-font-sm)"},children:d.name}),$.jsx("span",{style:Vcn,children:$.jsxs("span",{children:[d.host," · ",d.permission.risk," · ",d.sourcePath]})})]},d.name))}),n.tools.length===0&&n.loadErrors.length===0&&$.jsx("div",{style:Sje,children:"No project tools registered."}),n.loadErrors.map(d=>$.jsxs("div",{style:Gge,children:[d.sourcePath,": ",d.message]},`${d.sourcePath}:${d.message}`)),e$e().map(d=>$.jsxs("div",{style:Gge,children:[d.entryPath,": ",d.error]},`${d.entryPath}:${d.error}`))]})}function zcn({tool:t}){const n=AC().filter(se=>se.tool?.name===t.name),s=jMt(t.inputSchema),[c,d]=Ye.useState(s&&typeof s=="object"&&!Array.isArray(s)?s:{}),[m,g]=Ye.useState(()=>JSON.stringify(c,null,2)),[S,k]=Ye.useState(null),[A,F]=Ye.useState(!1),[D,J]=Ye.useState(null),q=t.host==="node",G=async()=>{if(t.permission.risk==="read"||window.confirm(`${t.permission.summary}
1397
+ `)}const XMe=new Set;function Tnn(t){return XMe.add(t),()=>{XMe.delete(t)}}function Cnn(){for(const t of[...XMe])try{t()}catch(n){ea.error(`a session-sample subscriber threw: ${String(n)}`,"invariant")}}const Enn=5e3;let Aw={frames:0,since:0},VZ=null,zB=null,oR=null;const UZ=new Map;function knn(t){const n=window.getComputedStyle(t);if(n.display==="none")return"display: none";if(n.visibility==="hidden")return"visibility: hidden";if(Number.parseFloat(n.opacity||"1")===0)return"opacity: 0";const s=t.getBoundingClientRect();return s.width<=0||s.height<=0?"zero-size box":null}const Ann="editor-canvas";function Dnn(t){const n=t.style;return n.display==="none"?"display":n.visibility==="hidden"?"visibility":n.opacity!==""&&Number.parseFloat(n.opacity)===0?"opacity":null}function p9t(){return[...document.querySelectorAll("canvas")].map((n,s)=>{const c=n.getAttribute("data-testid"),d=n.getBoundingClientRect();return{label:c??(n.className||`canvas #${s}`),area:Math.max(0,d.width)*Math.max(0,d.height),hiddenBy:knn(n),inlineHiding:Dnn(n),failsafeEligible:c!==Ann&&!n.closest(".monaco-editor")}})}function Pnn(){const t=unn();if(t.length===0)return{framesDrawn:null,framesUnavailable:"no render loop registered a performance source, so nothing counts this session’s frames"};let n=null;for(const s of t){const d=s.profiler.getSnapshot().frames.at(-1);d&&(n=Math.max(n??0,d.id))}return n===null?{framesDrawn:null,framesUnavailable:"the registered render loop records no frames (its profiler has neither profiling nor telemetry enabled)"}:{framesDrawn:n,framesUnavailable:null}}const PO=new Map,LY=new Map;function Inn(){const t=mnn(),n=new Set,s=t.map(c=>{const{id:d,label:m}=c;n.add(d);let g=null;try{g=c.transportAdvances?.()??null}catch{g=null}const S=LY.get(d);g===null?LY.delete(d):LY.set(d,g);const k=g===null||S===void 0?{}:{transportAdvanced:g!==S};let A;try{A=c.contentClock()}catch(J){return PO.delete(d),{id:d,label:m,advanced:null,unavailable:`its content clock threw: ${String(J)}`,...k}}if(A===null)return PO.delete(d),{id:d,label:m,advanced:null,unavailable:"its content clock is temporarily unavailable",...k};const F=A,D=PO.get(d);return PO.set(d,F),D===void 0?{id:d,label:m,advanced:null,unavailable:"first reading — nothing to compare it against yet",...k}:{id:d,label:m,advanced:F!==D,...k}});for(const c of[...PO.keys()])n.has(c)||PO.delete(c);for(const c of[...LY.keys()])n.has(c)||LY.delete(c);return s}function Nnn(t=Date.now()){const n=ste(),s=Aw.since===0?0:t-Aw.since,c=Aw.frames,d=s>0&&c>0?c*1e3/s:null,m=n?{startedMsAgo:oR===null?0:t-oR,...Pnn()}:null;return{mode:n?"play":"edit",loops:[...WMe().map(g=>({name:`${g.id} session`,running:g.mounted()})),...WMe().map(g=>({name:`${g.id} playing`,running:g.playing()}))],designTimeSurfaces:Inn(),presentedThreeRoots:sPt()?lnn().filter(g=>g.surface==="three").map(g=>g.worldId):null,...(()=>{const g=p9t();return{canvasHiddenBy:bVe(g),canvasHidesItself:dnn(g),hiddenCanvases:fnn(g)}})(),framesProduced:Aw.since===0?null:c,sampleWindowMs:Aw.since===0?null:s,tabVisible:!document.hidden,directManipulationExpected:navigator.webdriver!==!0,fps:d,fpsUnavailable:d===null?Aw.since===0?"the frame sampler has not opened a window yet":"no frame was produced in the sample window":null,play:m}}function _9t(){return xnn(Nnn())}let mB=null;const Sxt=new WeakSet;function Onn(t,n){const s=bVe(t);if(s==null){mB=null;return}if(mB===null){mB=n;return}const c=_nn({canvases:t,framesProduced:Aw.frames,hiddenForMs:n-mB});if(!c.fire)return;const d=[...document.querySelectorAll("canvas")].find(m=>(m.getAttribute("data-testid")??m.className)===c.target.label);!d||Sxt.has(d)||(Sxt.add(d),c.target.inlineHiding==="display"&&d.style.removeProperty("display"),c.target.inlineHiding==="visibility"&&d.style.removeProperty("visibility"),c.target.inlineHiding==="opacity"&&d.style.removeProperty("opacity"),ea.error(c.ledger,"invariant"))}function Rnn(){const t=_9t();for(const n of t){const s=wnn(n);if(!s){UZ.delete(n.id);continue}if(n.id==="visible-tab-fps-floor"){const c=(UZ.get(n.id)??0)+1;if(UZ.set(n.id,c),c<3)continue}ea.warn(s,"invariant")}return t}function Fnn(){if(zB!==null)return xxt;Aw={frames:0,since:Date.now()};const t=()=>{Aw.frames++,VZ=requestAnimationFrame(t)};return VZ=requestAnimationFrame(t),zB=setInterval(()=>{const n=ste();n&&oR===null&&(oR=Date.now()),n||(oR=null),Cnn(),Onn(p9t(),Date.now()),Rnn(),Aw={frames:0,since:Date.now()}},Enn),xxt}function Mnn(){Aw={frames:0,since:zB===null?0:Date.now()},oR=null,mB=null,UZ.clear(),PO.clear()}function xxt(){VZ!==null&&cancelAnimationFrame(VZ),zB!==null&&clearInterval(zB),VZ=null,zB=null,Aw={frames:0,since:0},oR=null,mB=null,UZ.clear()}let YMe=null;function jnn(t){YMe=t}function SVe(){return YMe?(YMe(),!0):!1}let xVe=[];const ZMe=new Set;function wxt(t){xVe=t;for(const n of ZMe)n()}function Lnn(){return xVe}function Bnn(t){return ZMe.add(t),()=>ZMe.delete(t)}function $nn(t){const n=xVe.find(s=>s.id===t);return n?(n.run(),!0):!1}let QQ=null;function qnn(t){QQ=t}function znn(t){QQ&&Promise.resolve(QQ(`${t}.focus`)).catch(()=>{})}const Vnn=/^volter\.([^.]+)\.(.+)$/;async function Unn(t,n){if(QQ)return await QQ(t,n);const s=Vnn.exec(t);if(!s)throw new Error(`No command "${t}". Without the Code-OSS frame there is no command service, so the only commands this editor answers are a view's own verbs, spelled volter.<view>.<verb> (for example volter.blender-node-view.view-all).`);const{invokeViewVerb:c}=await fo(async()=>{const{invokeViewVerb:d}=await Promise.resolve().then(()=>s4r);return{invokeViewVerb:d}},[]);return c(s[1],s[2],n)}const wVe=[{kind:"agent",title:"Conversations",hotkeyScope:"workspace",selectableText:!0,icon:"users"},{kind:"project-work",title:"Project work",hotkeyScope:"workspace",selectableText:!0,icon:"list"},{kind:"hierarchy",title:"Hierarchy",hotkeyScope:"hierarchy",selectableText:!1,region:"outliner",icon:"outliner"},{kind:"assets",title:"Content",hotkeyScope:"asset-browser",selectableText:!1,icon:"folder-open"},{kind:"asset-library",title:"Asset Library",hotkeyScope:"asset-browser",selectableText:!1,icon:"cubes-stacked"},{kind:"inspector",title:"Inspector",hotkeyScope:"inspector",selectableText:!1,region:"properties",icon:"properties"}];async function Jnn(t){const{liveCanvasFrame:n}=await fo(async()=>{const{liveCanvasFrame:s}=await Promise.resolve().then(()=>urn);return{liveCanvasFrame:s}},void 0);return n(t)}async function Wnn(...t){const{capturePlayComposite:n}=await fo(async()=>{const{capturePlayComposite:s}=await Promise.resolve().then(()=>orn);return{capturePlayComposite:s}},void 0);return n(...t)}async function Txt(){return fo(()=>Promise.resolve().then(()=>HDt),void 0)}async function Hnn(){return fo(()=>Promise.resolve().then(()=>Gan),void 0)}function Gnn(t,n=5e3){return SC().some(s=>s.id===t)?Promise.resolve():new Promise(s=>{let c=0,d=()=>{};const m=()=>{clearTimeout(c),d(),s()};d=Jye(()=>{SC().some(g=>g.id===t)&&m()}),SC().some(g=>g.id===t)?m():c=window.setTimeout(m,n)})}async function Knn(t){if(t){if(!SC().some(n=>n.id===t)){const n=t.startsWith(Ome);if(n&&(await(await Txt()).refreshProjectToolContributions(),await Gnn(t)),!SC().some(s=>s.id===t)){const s=SC().map(d=>d.id),c=n?(await Txt()).contributionFailureHint(t.slice(Ome.length)):"";throw new Error(`Utility is not registered: ${t}.`+c+` Registered utilities: ${s.length>0?s.join(", "):"(none)"}. A project contributes one by exporting a \`workspace.utility\` tool contribution; its view id is \`tool:<contribution-id>\`.`)}}bC(t)}}async function m9t(t){const n=wVe.map(c=>c.kind),s=n.find(c=>c===t);if(!s)throw new Error(`"${t}" is not a panel of this editor. Panels: ${n.join(", ")}.`);if(FBe(s),!await EC(()=>eDt()===s))throw new Error(`The ${s} panel is not in this workspace's layout, so it could not be focused. Panels: ${n.join(", ")}.`);return s}function Xnn(t,n){if(X0("workspace:scene"))return"workspace:scene";const s=l0().map(c=>c.descriptor.id);throw new Error(`This session has no Scene document open. Open documents: ${s.join(", ")||"none"}; address one as { kind: "workspace", id }.`)}async function Ynn(t){let n=!1;if(await EC(()=>(n=LMe(t.id),n||sxt(t.id)!==null),PR),n)return e_();const s=sxt(t.id);throw s?new Error(s):new Error(`World document is not registered: ${t.id}`)}async function Znn(t,n){const s=g=>g.filter(S=>S.id===n||S.label===n);let c=[];if(!await EC(()=>{const g=cBe(t)?.adapter?.stories;if(!g)return!1;c=g.storiesFor("");const S=s(c);return S.length===1?(g.apply(S[0].id,S[0].id),!0):c.length>0},PR))throw new Error(`The board mounted no stories provider within the wait window; story ${JSON.stringify(n)} was not applied.`);const m=s(c);if(m.length!==1)throw new Error(m.length===0?`No story matches ${JSON.stringify(n)}. This board's stories: ${c.map(g=>g.label).join(", ")||"(none)"}.`:`${JSON.stringify(n)} is ambiguous (${m.length} stories match) — use the story id: ${m.map(g=>g.id).join(" | ")}`)}async function Qnn(t,n){const s=await Wye(n.kind,t,n);if(s!==null)return s;let c=!1;if(await EC(()=>(c=SN(n.id)||X0(n.id),c||axt(n.id)!==null),PR),c)return n.story!==void 0&&await Znn(n.id,n.story),n.id;const d=axt(n.id);throw d?new Error(d):new Error(`Workspace document is not available: ${n.id}`)}async function ein(t,n){const s=await Wye(n.kind,t,n);if(s===null){const{kind:c,...d}=n,m=pkr();throw new Error(`Nothing in this editor can open a '${c}' document (${JSON.stringify(d)}). Either no package registered an opener for that view address, or the subject does not exist. Registered view addresses: ${m.length>0?m.join(", "):"(none)"}.`)}return s}function tin(t){const n=XEr();return n===null?"":n.includes(t)?`"${t}" is a kind in this project's document table, not an address — a document opens in the editor registered for its KIND, so address it as { kind: "document", id: "<that table entry's id>" }.`:n.length===0?"":`This project's document table holds ${n.map(s=>`"${s}"`).join(", ")}; each opens as { kind: "document", id: "<the table entry's id>" }.`}async function rin(t,n){if(!n)return e_();if(!cvr(n.kind))throw new Error(`present-view does not know the document kind "${String(n.kind)}". An EditorView addresses a document by one of: ${QTt.join(", ")}. `+tin(String(n.kind)));switch(n.kind){case"scene":return Xnn();case"world":return Ynn(n);case"asset":case"tool":case"document":case"story":case"project-tool":case"generation":return ein(t,n);case"workspace":return Qnn(t,n)}}function nin(t){const n=t.indexOf(",");return{base64:n>=0?t.slice(n+1):t,mimeType:"image/png"}}const Cxt=gVe;function iin(t,n,s){if(!s?.degenerate)return null;const c=cVe();return!c||!n.contains(c)?null:`This door photographs the "${t}" document, which for a live three ingest holds the GAME'S own canvas — created without \`preserveDrawingBuffer\`, so its pixels can only be read from inside the game's own render pass. This game did not draw inside that window (a render-on-demand world sitting idle, or a loop the Edit-tab input gate has frozen), so the frame came back BLANK (${s.warning??"essentially one flat colour"}) — a PNG that reads as a real image. The editor's own renderer is drawing this same world in the Scene viewport (the mount adopts the captured scene), so capture \`workspace:scene\` instead — or drive the game until it renders and ask again.`}async function h9t(t,n){const s=CC();if(!s)throw new Error("No active editor document to capture.");const{descriptor:c,title:d}=s,m=ote(t),g={id:c.id,title:d,kind:c.kind,...c.provenance?.sourcePath?{sourcePath:c.provenance.sourcePath}:{},...c.provenance?.rootId?{rootId:c.provenance.rootId}:{}},S=o2(c.id);if(S?.capture){const J=S.capture(n);if(!J)throw new Error(`Object3D document could not be captured: ${c.id}`);return{...nin(J),document:g,view:m,source:"object3d-document"}}const k=c.id===a0?e9t()??Cxt(c.id):Cxt(c.id);if(!k)throw new Error(`Active document surface is not mounted: ${c.id}`);const A=i9t(k),F=await Wnn(A?.container??k,{canvasFrame:A?.canvasFrame??Jnn,includeDocumentStyles:c.id!==a0&&!A}),D=iin(c.id,k,F.flatness);if(D)throw new Error(D);return{base64:F.base64,mimeType:F.mimeType,document:g,view:m,source:c.id===a0?"game-composite":c.id==="workspace:scene"?"scene-viewport":"document-composite",layers:F.layers,...F.flatness?{flatness:F.flatness}:{}}}const oin="workspace:scene";function sin(t){return o2(t)??o2(oin)}function ain(t,n,s,c){const d=o2(n),m=sin(n);s.selection&&(d?.selection?d.selection.apply(s.selection.ids):t.selectMultiple(s.selection.ids));const g=s.viewport;g?.grid!==void 0&&(n&&F_e(n)?yAr(n,g.grid):c.push("This document draws no grid.")),g?.diagnostic&&!m?.setDiagnostic(g.diagnostic)&&c.push(`Diagnostic ${g.diagnostic} is unavailable for this document.`),g?.camera&&!m?.setCamera(g.camera)&&c.push(typeof g.camera=="string"?`${g.camera==="isometric"?"Isometric":g.camera} camera is unavailable for this document.`:"The camera is unavailable for this document."),s.selection?.focus||g?.frame==="selection"?m?.frame("selection")||c.push("The requested selection could not be framed."):g?.frame==="document"&&(m?.frame("document")||c.push("Document framing is unavailable for this document."))}async function Bge(t,n,s={}){if(n?.version!==1)throw new Error("present-view requires EditorView version 1.");const c=Object.keys(n).filter(F=>!Dmt.includes(F));if(c.length>0)throw new Error(`present-view does not know ${c.map(F=>`"${F}"`).join(", ")}. An EditorView carries: ${Dmt.join(", ")}. A document's own address (kind, and the fields that kind reads) goes under "document".`);const d=ote(t);if(n.style!==void 0){const F=OR().map(D=>D.id);if(!F.includes(n.style))throw new Error(`present-view requires a style of ${F.join(", ")}, got ${String(n.style)}.`);HBe(n.style)}if(n.workspace!==void 0){if(!kB(n.workspace))throw new Error(`present-view requires a workspace of ${$Be().join(", ")}, got ${String(n.workspace)}.`);if(zS()!==n.workspace){const F=hDt();s2(n.workspace),await Promise.race([F,new Promise(D=>setTimeout(D,3e3))])}}const m=[];n.keymap!==void 0&&n.keymap!==dR()&&m.push(`Keymap "${n.keymap}" was not applied — a view reports the keymap, it does not set it. This project is on "${dR()}" (its adapter's declaration, or its own settings).`);const g=await rin(t,n.document);await Knn(n.utility);const S=o2(g);if(await S?.prepare?.(),!S?.selection&&n.selection?.ids.length&&(n.document?.kind==="scene"||n.document?.kind==="world")){const F=n.selection.ids;if(!await EC(()=>F.every(J=>Y0(t).hierarchy.node(J)!==null),PR))throw new Error(`Shared view selection is not available: ${F.join(", ")}`)}g&&e_()!==g&&X0(g),ain(t,g,n,m),n.panel!==void 0&&await m9t(n.panel);const k=tCt(n,window.location.href);s.updateUrl!==!1&&window.history.replaceState(window.history.state,"",k);const A={view:n,url:k,warnings:m};return(s.origin??"agent")==="agent"&&(await Hnn()).showEditorPresentationNotice({presented:A,previousView:d}),A}const $ge=new Map;let g9t=0;const QMe=new Set;function y9t(){g9t+=1;for(const t of QMe)t()}function cin(t,n,s){const c=$ge.get(t);c&&c.assetPath===n&&c.actions.length===s.length&&c.actions.every((d,m)=>d===s[m])||($ge.set(t,{assetPath:n,actions:s}),y9t())}function lin(t){$ge.delete(t)&&y9t()}function uin(t){const n=[];for(const s of $ge.values())s.assetPath===t&&n.push(...s.actions);return n}function fin(t){return QMe.add(t),()=>QMe.delete(t)}function Ext(){return g9t}const din=[],kxt=new Set;let pin=0;function _in(t){for(const n of din)if(n.match(t))return n;return null}function min(t){return kxt.add(t),()=>{kxt.delete(t)}}function Axt(){return pin}const O_={open:{id:"project-asset.open",shortcut:"Enter"},rename:{id:"project-asset.rename",shortcut:"F2"},move:{id:"project-asset.move",shortcut:null},duplicate:{id:"project-asset.duplicate",shortcut:"Mod+D"},delete:{id:"project-asset.delete",shortcut:"Delete"},copyPath:{id:"project-asset.copy-path",shortcut:"Mod+Shift+C"},reveal:{id:"project-asset.reveal",shortcut:null},refresh:{id:"project-asset.refresh",shortcut:"Mod+R"},import:{id:"project-asset.import",shortcut:null},createFolder:{id:"project-asset.create-folder",shortcut:"Mod+Shift+N"}},eD=[],eje=new Set,BY=new Map;let v9t=0;function lOe(){v9t++;for(const t of eje)t()}function hin(t){const n=eD.findIndex(s=>s.owner===t.owner&&s.id===t.id);if(n>=0){const[s]=eD.splice(n,1);s&&(BY.get(s)?.(),BY.delete(s))}return eD.push(t),eD.sort((s,c)=>(s.order??0)-(c.order??0)),BY.set(t,t.subscribe(lOe)),lOe(),()=>{const s=eD.indexOf(t);s<0||(eD.splice(s,1),BY.get(t)?.(),BY.delete(t),lOe())}}const gin=[];function yin(){return eD.length===0?gin:eD}function b9t(t){return eje.add(t),()=>{eje.delete(t)}}function qge(){return v9t}function S9t(t){for(const n of eD){const s=n.entries({components:[t],surface:null})[0];if(s)return{source:n,entry:s}}return null}function vin(){const t=J0e();return t?{path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}}:null}function bin(t,n){return Ye.useEffect(()=>()=>lin(t),[t]),Ye.useCallback(s=>{n!==null&&cin(t,n,s)},[t,n])}function Sin({id:t,title:n,file:s,tool:c,Component:d}){Ye.useSyncExternalStore(U0e,qQ),Ye.useSyncExternalStore(Tye,cN,cN),Ye.useSyncExternalStore(Pye,lN,lN);const m=vin(),g=bin(t,m?.path??null),S=Ye.useRef(null),k=Ye.useCallback(F=>{S.current?.(),S.current=F===null?null:wBe(`building ${F.replace(/^building /,"")}`)},[]);Ye.useEffect(()=>()=>S.current?.(),[]);const A=Ye.useCallback(F=>s$({...F,id:`contribution:${t}:${F.title}`,...F.tone==="warning"?{fades:!0}:{}}),[t]);return $.jsxs("div",{"data-testid":`asset-inspector-tool-${t}`,style:{padding:8,borderTop:"1px solid var(--volter-structural-divider)",marginTop:4},children:[$.jsxs("div",{style:{...BCr,marginBottom:4},children:[$.jsx(dc,{icon:Kk.tool.extension,tone:"muted",style:{marginRight:4}}),n]}),$.jsx(TBe,{file:s,children:$.jsx(d,{...c?{tool:c}:{},contributionId:t.slice(t.lastIndexOf(":")+1),client:Kye(),surfaces:uBe,account:YLe(),play:Dye(),asset:m,setActions:g,notify:A,work:k})})]})}function xin(t,n){if(n<=0)return[];if(t.length===0)return Array.from({length:n},()=>0);const s=new Array(n),c=t.length/n;let d=0;for(let m=0;m<n;m++){const g=Math.floor(m*c),S=Math.max(g+1,Math.floor((m+1)*c));let k=0;for(let A=g;A<S;A++)k=Math.max(k,Math.abs(t[A]??0));s[m]=k,d=Math.max(d,k)}return d<=1e-8?s.fill(0):s.map(m=>m/d)}const x9t=32,tje=new Set,Dxt=new Map,Pxt=new Map;let sR=null,JZ=null,w9t=0,rje=0,VB=0,xN=0,Ixt=!1,pD={url:null,progress:0,playing:!1};function win(){for(const t of tje)t()}function I$(t){pD.url===t.url&&pD.playing===t.playing&&Math.abs(pD.progress-t.progress)<.002||(pD=t,win())}function TVe(){return sR??=new AudioContext,sR}function Tin(){if(Ixt||typeof window>"u")return;Ixt=!0;const t=()=>{if(!sR)return;const n=pD.url,s=xN;sR.resume().then(()=>{n&&s===xN&&!JZ&&sR?.state==="running"&&E9t(n,s)})};window.addEventListener("pointerdown",t,{capture:!0}),window.addEventListener("keydown",t,{capture:!0})}function CVe(){if(VB&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(VB),VB=0,!JZ)return;const t=JZ;JZ=null,t.onended=null;try{t.stop()}catch{}t.disconnect()}function T9t(){if(VB=0,!pD.playing||!sR||rje<=0)return;const t=Math.min(1,(sR.currentTime-w9t)/rje);I$({url:pD.url,progress:t,playing:t<1}),t<1&&typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(T9t))}function Cin(t,n,s){if(s!==xN)return;CVe();const c=TVe(),d=c.createBufferSource(),m=c.createGain();m.gain.value=1,d.buffer=t,d.connect(m),m.connect(c.destination),d.onended=()=>{s===xN&&I$({url:n,progress:1,playing:!1})},d.start(),JZ=d,w9t=c.currentTime,rje=t.duration,I$({url:n,progress:0,playing:!0}),typeof requestAnimationFrame=="function"&&(VB=requestAnimationFrame(T9t))}async function C9t(t){const n=Dxt.get(t);if(n)return n;const s=(async()=>{const c=await fetch(t);if(!c.ok)throw new Error(`Audio preview could not read ${t}.`);const d=await c.arrayBuffer();return TVe().decodeAudioData(d.slice(0))})().catch(()=>null);return Dxt.set(t,s),s}async function E9t(t,n){Tin();const s=await C9t(t);if(n!==xN)return;if(!s){I$({url:t,progress:0,playing:!1});return}const c=TVe();c.state==="suspended"&&(await c.resume(),n!==xN)||c.state==="running"&&Cin(s,t,n)}function Ein(t){return tje.add(t),()=>tje.delete(t)}function kin(){return pD}function Ain(t){const n=++xN;CVe(),I$({url:t,progress:0,playing:!0}),E9t(t,n)}function Din(t){t&&pD.url!==t||(xN+=1,CVe(),I$({url:null,progress:0,playing:!1}))}function Pin(t,n=x9t){const s=`${t}#${n}`,c=Pxt.get(s);if(c)return c;const d=C9t(t).then(m=>m?xin(m.getChannelData(0),n):Array.from({length:n},()=>0));return Pxt.set(s,d),d}let _Z=[];function PSn(t){return _Z=[..._Z,t],()=>{_Z=_Z.filter(n=>n!==t)}}function k9t(t){return _Z.find(n=>n.accepts(t))??null}const EVe={folder:"var(--volter-asset-icon-folder)",model:"var(--volter-asset-icon-model)",prefab:"var(--volter-asset-icon-prefab)",component:"var(--volter-asset-icon-component)",audio:"var(--volter-asset-icon-audio)",image:"var(--volter-asset-icon-image)",video:"var(--volter-asset-icon-video)",json:"var(--volter-asset-icon-json)",unknown:"var(--volter-asset-icon-unknown)",source:"var(--volter-asset-icon-source)"},Iin={folder:uee,model:O0r,prefab:GB,component:eLe,audio:nLe,image:x0r,video:I0r,json:oLe,unknown:jTt,source:YTt};function vD({kind:t,size:n=24}){return $.jsx(dc,{icon:Iin[t],style:{fontSize:n,color:EVe[t]}})}const Nin=100,Oin=50,Rin=new WPt(t=>{const n=k9t(t);return n?n.render(t):Promise.reject(new Error(`No model preview loader for ${t}.`))},2);function A9t(t,n){const[s,c]=Ye.useState(null),[d,m]=Ye.useState(!1),[g,S]=Ye.useState(null),[k,A]=Ye.useState(!1);Ye.useEffect(()=>{c(null),m(!1),S(null),A(!1)},[t]),Ye.useEffect(()=>{let D=!1,J=null;return b$e().then(q=>{if(D)return;const G=q.status==="ok"?q.manifest.entries[t.replace(/^\/+/,"")]:void 0;if(!k&&G?.path&&(G.state==="generated"||G.state==="upstream")){S(G.path.startsWith("/")?G.path:`/${G.path}`);return}return J=Rin.request(t,n),J.promise}).then(q=>{!D&&q&&c(q)}).catch(()=>{D||m(!0)}),()=>{D=!0,J?.cancel()}},[k,n,t]);const F=Ye.useCallback(()=>{S(null),A(!0)},[]);return{src:g??s,fromManifest:g!==null,failed:d,rejectManifest:F}}function D9t({url:t}){const n=A9t(t,Nin);return n.failed?$.jsx(vD,{kind:"model"}):n.fromManifest&&n.src?$.jsx("img",{src:n.src,alt:"cached model preview",onError:n.rejectManifest,style:{width:"100%",height:"100%",objectFit:"contain"}}):n.src?$.jsx("img",{src:n.src,alt:"model preview",style:{width:"100%",height:"100%",objectFit:"contain"}}):$.jsx("div",{style:{width:28,height:28,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center"},children:$.jsx("div",{className:"volter-anim-spin",style:{width:16,height:16,border:`2px solid ${nhe[2]}`,borderTopColor:EVe.model,borderRadius:"50%"}})})}function Fin({url:t,name:n}){const[s,c]=Ye.useState(()=>Array.from({length:x9t},()=>.15)),d=Ye.useSyncExternalStore(Ein,kin);Ye.useEffect(()=>{let S=!1;return Pin(t).then(k=>{S||c(k)}),()=>{S=!0}},[t]);const m=d.url===t,g=m?d.progress:0;return $.jsx("div",{role:"img","aria-label":`${n} waveform preview`,style:{display:"flex",alignItems:"center",gap:1,width:"86%",height:"62%"},children:s.map((S,k)=>{const A=k/s.length<=g;return $.jsx("i",{style:{flex:1,height:`${12+S*88}%`,background:"var(--volter-asset-icon-audio)",opacity:m&&A?1:.28,borderRadius:1}},k)})})}function wR({kind:t,name:n,variant:s="tile"}){const c=EVe[t],d=s==="cell";return t==="audio"?$.jsxs("svg",{role:"img","aria-label":`${n} waveform preview`,viewBox:"0 0 64 48",width:d?"78%":52,height:d?"78%":44,children:[$.jsx("rect",{width:"64",height:"48",rx:"4",fill:"var(--volter-bg-inset)"}),Array.from({length:16},(m,g)=>$.jsx("rect",{x:g*4+1,y:24-g*13%18/2,width:"2",height:g*13%18+3,fill:c},g))]}):$.jsxs("svg",{role:"img","aria-label":`${n} ${t} preview`,viewBox:"0 0 52 48",width:d?"66%":48,height:d?"72%":44,children:[$.jsx("rect",{x:"5",y:"3",width:"42",height:"42",rx:"4",fill:"var(--volter-bg-inset)",stroke:c}),$.jsx("path",{d:"M13 15h26M13 23h18M13 31h22",stroke:c,strokeWidth:"3",strokeLinecap:"round"})]})}function P9t(t,n,s,c){if(t<=0||n<=0||s<=0||c<=0)return 1;const d=t<=s?Math.floor(s/t):0,m=n<=c?Math.floor(c/n):0,g=Math.min(d,m);return g>=1?g:1/Math.max(Math.ceil(t/s),Math.ceil(n/c))}function ISn(t,n,s,c,d){return t==="fit"?P9t(n,s,c,d):t}function Min(t,n,s){const c=Math.max(1,s.sourceWidth??s.width),d=Math.max(1,s.sourceHeight??s.height);t.width=c,t.height=d;const m=t.getContext("2d");if(!m)return;m.imageSmoothingEnabled=!1,m.clearRect(0,0,c,d);const g=HYr(s);if(s.rotated){m.save(),m.translate(s.trimX,s.trimY+g.width),m.rotate(-Math.PI/2),m.drawImage(n,g.x,g.y,g.width,g.height,0,0,g.width,g.height),m.restore();return}m.drawImage(n,g.x,g.y,g.width,g.height,s.trimX,s.trimY,g.width,g.height)}function I9t({sheetUrl:t,frame:n,scale:s,maxEdge:c}){const d=Ye.useRef(null),m=Math.max(1,n.sourceWidth??n.width),g=Math.max(1,n.sourceHeight??n.height),S=c!=null?P9t(m,g,c,c):s??1,k=Math.max(1,Math.round(m*S)),A=Math.max(1,Math.round(g*S));return Ye.useEffect(()=>{const F=d.current;if(!F)return;const D=new Image;let J=!1;return D.onload=()=>{J||Min(F,D,n)},D.src=t,()=>{J=!0}},[n,t]),$.jsx("canvas",{ref:d,width:m,height:g,"aria-hidden":!0,style:{width:k,height:A,imageRendering:"pixelated",display:"block"}})}const N9t={fontSize:11,color:Zf[3],marginBottom:2},jin={fontSize:11,color:Zf[1],wordBreak:"break-all"};function uOe({asset:t}){Ye.useSyncExternalStore(l2,rA,rA);const n={path:t.path,name:t.name,kind:t.kind,origin:t.origin??"project",...t.sourcePath?{sourcePath:t.sourcePath}:{}};return MDt().map(s=>{let c=!1;try{c=s.match(n)}catch(d){console.error(`[tool contributions] ${s.file}'s asset match() threw.`,d)}return c?$.jsx(Sin,{id:s.id,title:s.title,file:s.file,tool:s.tool,Component:s.Component},`${s.id}:${s.version}`):null})}function Nxt(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ph({label:t,value:n}){return $.jsxs("div",{children:[$.jsx("div",{style:N9t,children:t}),$.jsx("div",{style:jin,children:n})]})}function Lin({asset:t}){const n=t.capabilities?.editor==="environment";Ye.useSyncExternalStore(b9t,qge,qge);const s=t.componentPreview,c=s?S9t({name:t.name,path:s.sourcePath,surface:s.surface}):null;return $.jsx("div",{"data-testid":"inspector-asset-preview",style:{position:"absolute",inset:0,background:hBe.inset,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:c?$.jsx(c.source.Thumbnail,{entry:c.entry,previewRevision:0}):n?$.jsx(wR,{kind:"image",name:t.name,variant:"cell"}):t.kind==="image"?$.jsx($in,{path:t.path,name:t.name}):t.kind==="video"?$.jsx(Bin,{path:t.path}):t.kind==="model"?$.jsx(D9t,{url:t.path}):$.jsx(wR,{kind:t.kind,name:t.name,variant:"cell"})})}function Bin({path:t}){return $.jsx("video",{src:t,muted:!0,preload:"metadata",style:{width:"100%",height:"100%",objectFit:"contain"}})}function $in({path:t,name:n}){const{sheetPath:s,frameName:c}=H0e(t),[d,m]=Ye.useState(null);return Ye.useEffect(()=>{if(!c){m(null);return}let g=!1;return fetch(`/${PRt(s)}`).then(S=>S.ok?S.text():null).then(S=>{if(g||!S)return;const k=Nze(S);m(k?.frames.find(A=>A.name===c)??null)}).catch(()=>{g||m(null)}),()=>{g=!0}},[c,s]),d?$.jsx(I9t,{sheetUrl:`/${s}`,frame:d,maxEdge:96}):$.jsx("img",{src:t.split("#")[0],alt:n,style:{width:"100%",height:"100%",objectFit:"contain"}})}function qin({asset:t}){const[n,s]=Ye.useState(null),{sheetPath:c,frameName:d}=H0e(t.path);return Ye.useEffect(()=>{if(s(null),t.kind!=="image"||t.capabilities?.editor==="environment")return;let m=!1;if(d)return fetch(`/${PRt(c)}`).then(S=>S.ok?S.text():null).then(S=>{if(m||!S)return;const k=Nze(S)?.frames.find(A=>A.name===d);k&&s({w:k.sourceWidth,h:k.sourceHeight})}).catch(()=>{}),()=>{m=!0};const g=new Image;return g.onload=()=>{m||s({w:g.naturalWidth,h:g.naturalHeight})},g.src=t.path.split("#")[0]??t.path,()=>{m=!0}},[t.capabilities?.editor,t.kind,t.path,d,c]),n?$.jsx(Ph,{label:"Dimensions",value:`${n.w} × ${n.h}`}):null}function zin(){Ye.useSyncExternalStore(min,Axt,Axt);const t=J0e();if(!t)return null;const n=_in(t),s=t.name.includes(".")?t.name.split(".").pop()??"":"";return n?$.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",borderBottom:`1px solid ${nhe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[$.jsx(n.View,{asset:t}),$.jsx(uOe,{asset:t})]}):(t.selectionCount??1)===1&&(t.kind==="image"&&!t.path.includes("#")&&t.capabilities?.editor!=="environment"||t.kind==="video"||t.kind==="audio")?$.jsxs($.Fragment,{children:[$.jsx(zRt,{assetPath:t.path,kind:t.kind,sizeBytes:t.sizeBytes}),$.jsxs("div",{style:{padding:"0 8px",display:"grid",gap:6},children:[t.health&&t.health!=="healthy"&&$.jsx(Ph,{label:"Health",value:t.health}),!!t.healthCodes?.length&&$.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.sourcePath&&$.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!!t.dependencies?.length&&$.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")}),!!t.references?.length&&$.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")})]}),$.jsx(uOe,{asset:t})]}):$.jsxs("div",{"data-testid":"inspector-asset-selection",style:{pointerEvents:"auto",padding:8,borderBottom:`1px solid ${nhe[1]}`,display:"flex",flexDirection:"column",gap:6},children:[$.jsx(qin,{asset:t}),$.jsx("div",{style:{...N9t,marginBottom:0,textTransform:"uppercase"},children:"Asset"}),$.jsx("div",{style:{fontWeight:600,fontSize:12,color:Zf[1],wordBreak:"break-all"},children:t.name}),$.jsx(Ph,{label:"Path",value:t.path}),t.componentPreview&&$.jsx(Ph,{label:"Surface",value:t.componentPreview.surface==="canvas"?"2D / Pixi":t.componentPreview.surface==="three"?"3D / Three":t.componentPreview.surface}),t.selectionCount&&t.selectionCount>1&&$.jsxs($.Fragment,{children:[$.jsx(Ph,{label:"Selection",value:`${t.selectionCount} assets`}),t.selectionTotalBytes!==void 0&&$.jsx(Ph,{label:"Total size",value:Nxt(t.selectionTotalBytes)}),t.selectionFormats&&$.jsx(Ph,{label:"Formats",value:t.selectionFormats.join(", ")})]}),s&&$.jsx(Ph,{label:"Format",value:s.toUpperCase()}),t.sizeBytes!==void 0&&$.jsx(Ph,{label:"Size",value:Nxt(t.sizeBytes)}),t.capabilities&&$.jsxs($.Fragment,{children:[$.jsx(Ph,{label:"Runtime readiness",value:t.capabilities.runtimeReady?"Runtime-ready":"Import or conversion required"}),$.jsx(Ph,{label:"Preview",value:t.capabilities.previewable?"Available":"Unsupported"}),$.jsx(Ph,{label:"Placement",value:t.capabilities.placeable?"Placeable":"Not placeable"}),$.jsx(Ph,{label:"Editor",value:FB(t.capabilities)??"No editor"})]}),t.health&&$.jsx(Ph,{label:"Health",value:t.health}),t.healthCodes&&$.jsx(Ph,{label:"Issues",value:t.healthCodes.join(", ")}),t.dependencies&&$.jsx(Ph,{label:"Dependencies",value:t.dependencies.join(", ")||"None"}),t.references&&$.jsx(Ph,{label:"References",value:t.references.map(c=>`${c.ownerPath} ${c.jsonPath}`).join(", ")||"None"}),t.sourcePath&&$.jsx(Ph,{label:"Imported from",value:t.sourcePath}),!t.componentPreview&&$.jsxs("div",{style:{display:"flex",gap:6},children:[$.jsx(Ms,{type:"button","data-command-id":O_.open.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:open-project-asset",{detail:{path:t.path}})),children:"Open"}),t.selectionCount&&t.selectionCount>1&&$.jsxs($.Fragment,{children:[$.jsx(Ms,{type:"button","data-command-id":O_.move.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:O_.move.id}})),children:"Move selected"}),$.jsx(Ms,{type:"button","data-command-id":O_.delete.id,onClick:()=>window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:O_.delete.id}})),children:"Delete selected"})]})]}),$.jsx("div",{style:{fontSize:10,color:Zf[3]},children:"Double-click (or press Enter) in the asset browser to open the full viewer."}),$.jsx(uOe,{asset:t})]})}function Vin(t){return uin(t).map(n=>({id:n.id,title:n.title,...n.label===void 0?{}:{label:n.label},placement:"identity",...n.disabled===void 0?{}:{disabled:n.disabled},run:n.run}))}function Uin(){const t=J0e();if(t===null)return null;const n=Oye();return n&&(n.adapter!==null||n.nodeId!==null)?null:{quickActions:Vin(t.path),id:`asset:${t.path}`,title:t.name,kindLabel:t.online?`${t.kind} · ${t.online.source}`:t.kind,note:{text:t.sourcePath??t.path,testId:"inspector-asset-path"},sections:[{id:LRe,title:"Preview",icon:iB,order:x4t,body:{kind:"preview",render:()=>$.jsx(Lin,{asset:t})}},{id:"asset-selection",title:"Asset",icon:R$,order:fQ,body:{kind:"custom",render:()=>$.jsx(zin,{})},keepMounted:!0}]}}const Jin={loop:"Loop control","contract.root":"DOM root","contract.lifecycle.start":"Cold start","contract.lifecycle.pause":"Pause / resume",persistence:"Source persistence",systems:"Commands and state"};function Win(t){const n=Jin[t];if(n)return n;const[s,c]=t.split("."),d=(c??t).replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase(),m=d.charAt(0).toUpperCase()+d.slice(1);return s==="system"?`${m} adapter`:m}const Hin={ok:N0r,gap:MTt,na:X0r,info:R$},Gin={ok:Go.semantic.success,gap:Go.semantic.warning,na:Go.content.dim,info:Go.content.dim};function Kin({row:t}){return $.jsxs("div",{"data-testid":`ingest-coverage-row-${t.seam}`,"data-status":t.status,style:{display:"grid",gridTemplateColumns:"16px minmax(0, 1fr)",gap:7,padding:"8px 10px",borderTop:"1px solid var(--volter-structural-divider)"},children:[$.jsx("span",{style:{color:Gin[t.status],paddingTop:1},children:$.jsx(dc,{icon:Hin[t.status]})}),$.jsxs("div",{style:{minWidth:0},children:[$.jsx("div",{style:{color:Go.content.primary,fontWeight:600},children:Win(t.seam)}),$.jsx("div",{style:{marginTop:2,color:Go.content.muted,lineHeight:1.4,overflowWrap:"anywhere"},children:t.detail}),t.missing&&$.jsxs("div",{style:{marginTop:6,color:Go.content.muted,lineHeight:1.4},children:[$.jsx("strong",{style:{color:Go.semantic.warning},children:"Missing:"})," ",t.missing]}),t.fix&&$.jsxs("div",{style:{marginTop:4,color:Go.content.dim,lineHeight:1.4},children:[$.jsx("strong",{children:"Fix:"})," ",t.fix]})]})]})}function Xin({report:t}){const{summary:n}=t;return $.jsxs("div",{"data-testid":"ingest-coverage-report",style:{fontSize:"var(--volter-font-base)"},children:[$.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,padding:"7px 10px 9px",color:Go.content.muted},children:[$.jsxs("span",{style:{color:n.gaps>0?Go.semantic.warning:Go.semantic.success},children:[n.gaps," ",n.gaps===1?"gap":"gaps"]}),$.jsxs("span",{children:[n.ok," integrated"]}),$.jsxs("span",{children:[n.na," not applicable"]}),$.jsxs("span",{children:[n.info," informational"]})]}),t.rows.map(s=>$.jsx(Kin,{row:s},s.seam))]})}function Yin(t){return{id:"ingest-coverage",title:"Ingest coverage",icon:UTt,order:9e3,description:`${t.summary.gaps} gap${t.summary.gaps===1?"":"s"}`,defaultOpen:!0,testId:"ingest-coverage-section",body:{kind:"custom",render:()=>$.jsx(Xin,{report:t}),data:{summary:t.summary,rows:t.rows}}}}function Zin(t,n,s){if(t)return t.nodeId;const c=[...n].at(-1);if(c)return c;const d=s.selection?.get().at(-1)??null;if(d===null)return null;const m=s.hierarchy.roots();return m.length===1&&m[0]?.id===d?null:d}const O9t="inspectorPresentation";function Qin(t){return t==="card"||t==="column"||t==="properties"}function Oxt(){const t=ZAr(O9t);if(!t||typeof t!="object")return{};const n={};for(const[s,c]of Object.entries(t))Qin(c)&&(n[s]=c);return n}let UB=null,nve=0;const UO=new Set;let fOe=null;YDt().then(()=>{UB=null,nve++;for(const t of UO)t()});function eon(){nve++;for(const t of UO)t()}function R9t(){if(UB===null){if(!YAr())return Oxt();UB=Oxt()}return UB}function nje(t){return R9t()[t]??null}function kVe(t,n){if(znn("volter.properties"),nje(t)!==n){UB={...R9t(),[t]:n},nve++,QAr(O9t,UB);for(const s of UO)s()}}function ton(t){return UO.size===0&&(fOe=HAr(eon)),UO.add(t),()=>{UO.delete(t),UO.size===0&&(fOe?.(),fOe=null)}}function Rxt(){return nve}function ron(t,n,s=null){return n??s??t}function F9t(t){return t.sections.map(n=>({id:n.id,title:n.title,icon:n.icon,...n.railGroup===void 0?{}:{railGroup:n.railGroup},...n.railDefault===void 0?{}:{railDefault:n.railDefault}}))}function ije(t){return t==="three"||t==="canvas"||t==="dom"?t:null}function non(t,n){const s=n.selectedEntityId;if(s===null)return null;const c=t.childAdapters(),d=c.find(m=>m.worldId===t.ownerOf(s))??c.find(m=>t.groupNodeId(m.worldId)===s);return d?ije(d.kind):null}function ion(t){const n=iBe();if(n!==null&&n.documentId===e_())return"asset-lab";const{adapter:s,surface:c}=Cm(t);if(c)return c;if(s instanceof hy){const d=s.childAdapters(),m=d.length===1?ije(d[0]?.kind??""):null;if(m)return m;const g=non(s,t);if(g)return g}return ije(tve()??"")??"three"}function oon({stories:t,activeStoryId:n,onApplyStory:s,isolation:c,unavailableReason:d}){return $.jsxs("div",{style:{padding:"4px 0"},children:[t.length>0?$.jsxs(Iw,{"data-testid":"ingest-stories-select",value:n,onChange:m=>{const g=m.target.value;s(g===""?null:g)},style:{width:"100%"},children:[$.jsx("option",{value:"",children:"(none)"}),t.map(m=>$.jsx("option",{value:m.id,children:m.label},m.id))]}):$.jsx("div",{"data-testid":"ingest-stories-none",style:{fontSize:"var(--volter-font-base)",color:Go.content.dim,fontStyle:"italic"},children:d??"No stories — this root has no associated portable CSF previews."}),c&&$.jsx(Ms,{"data-testid":"catalog-isolate",onClick:c.toggle,variant:c.isolated?"primary":"secondary","aria-pressed":c.isolated,style:{marginTop:6,width:"100%"},children:c.isolated?"Exit isolation":"Isolate"})]})}const bD=180/Math.PI;function M9t(t,n,s){const c=Math.cos(t/2),d=Math.cos(n/2),m=Math.cos(s/2),g=Math.sin(t/2),S=Math.sin(n/2),k=Math.sin(s/2);return[g*d*m+c*S*k,c*S*m-g*d*k,c*d*k+g*S*m,c*d*m-g*S*k]}function son([t,n,s,c]){const d=t+t,m=n+n,g=s+s,S=t*d,k=t*m,A=t*g,F=n*m,D=n*g,J=s*g,q=c*d,G=c*m,se=c*g,pe=1-(F+J),ue=k-se,Ce=A+G,Fe=1-(S+J),De=D-q,be=D+q,X=1-(S+F),we=Math.asin(Math.min(Math.max(Ce,-1),1));return Math.abs(Ce)<.9999999?[Math.atan2(-De,X),we,Math.atan2(-ue,pe)]:[Math.atan2(be,Fe),we,0]}function AVe(t){const[n,s,c,d]=t,m=n*n+s*s+c*c+d*d,g=Math.sqrt(m),S=m<Number.EPSILON?[0,0,0,1]:[n/g,s/g,c/g,d/g],[k,A,F]=son(S);return[k*bD,A*bD,F*bD]}function aon(t,n,s){if(s.length!==3||s.some(d=>!Number.isFinite(d)))throw new Error(`transform.${n} expects three finite numbers.`);const c={position:[...t.position],rotation:[...t.rotation],scale:[...t.scale]};return n==="rotation"?{...c,rotation:M9t(s[0]/bD,s[1]/bD,s[2]/bD)}:{...c,[n]:[s[0],s[1],s[2]]}}function con(t,n,s){const c=AVe(t.rotation);return c[n]=s,{position:[...t.position],rotation:M9t(c[0]/bD,c[1]/bD,c[2]/bD),scale:[...t.scale]}}const lon={x:"#e0726d",y:"#83bd66",z:"#6390dd"};function dOe({axes:t,label:n,values:s,testidPrefix:c,step:d,precision:m,onBegin:g,onPreview:S,onCommit:k,readOnly:A,readOnlyReason:F}){const[D,J]=Ye.useState(null),q=Ye.useRef(!1);return $.jsx(T_e,{label:n,style:{padding:"4px 8px"},children:t.map(({axis:G,name:se})=>$.jsx(SZ,{testId:`${c}-${se}`,label:se,labelColor:lon[se],title:F,disabled:A,step:d,precision:m,value:D?.axis===G?D.value:Number.isFinite(s[G])?s[G]:0,style:{flex:1,minWidth:0},onChange:pe=>{q.current||(q.current=!0,g?.()),J({axis:G,value:pe}),S?.(G,pe)},onChangeEnd:pe=>{q.current=!1,J(null),k(G,pe)}},se))})}function uon({dimensions:t="3d",transform:n,readOnly:s=!1,channelEditability:c,note:d,onBegin:m,onPreview:g,onCommit:S}){const k=[{axis:0,name:"x"},{axis:1,name:"y"}],A=[...k,{axis:2,name:"z"}],F=(se,pe,ue)=>{const Ce={position:[...n.position],rotation:[...n.rotation],scale:[...n.scale]};return Ce[pe][se]=ue,Ce},D=(se,pe)=>(ue,Ce)=>{Number.isFinite(Ce)&&pe?.(F(ue,se,Ce))},J=se=>(pe,ue)=>{Number.isFinite(ue)&&se?.(con(n,pe,ue))},q=se=>{const pe=c?.[se],ue=s||pe?.writable===!1;return pe?.reason?{readOnly:ue,readOnlyReason:pe.reason}:{readOnly:ue}},G=[...new Set(["position","rotation","scale"].map(se=>q(se)).filter(se=>se.readOnly&&se.readOnlyReason).map(se=>se.readOnlyReason))];return $.jsxs(MTr,{children:[$.jsx(dOe,{axes:t==="2d"?k:A,label:"Position",testidPrefix:"ingest-position",values:n.position,step:.1,precision:3,...q("position"),onBegin:m,onPreview:g&&D("position",g),onCommit:D("position",S)}),$.jsx(dOe,{axes:t==="2d"?[{axis:2,name:"z"}]:A,label:t==="2d"?"Rotation (degrees)":"Rotation",testidPrefix:"ingest-rotation",values:AVe(n.rotation),step:1,precision:1,...q("rotation"),onBegin:m,onPreview:g&&J(g),onCommit:J(S)}),$.jsx(dOe,{axes:t==="2d"?k:A,label:"Scale",testidPrefix:"ingest-scale",values:n.scale,step:.01,precision:3,...q("scale"),onBegin:m,onPreview:g&&D("scale",g),onCommit:D("scale",S)}),G.map(se=>$.jsx(_p,{"data-testid":"inspector-transform-readonly-reason",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:se},se)),d&&$.jsx(_p,{"data-testid":"inspector-transform-note",variant:"caption",tone:"muted",style:{display:"block",padding:"4px 8px",overflowWrap:"anywhere"},children:d})]})}function Fxt(t){return t.revertsTo===void 0?`Revert ${t.label} to default`:`Revert ${t.label} to ${t.revertsTo}`}function fon({value:t,onCommit:n,onPreview:s,...c}){const[d,m]=Ye.useState(null),g=Ye.useRef(null),S=Ye.useRef(null),k=Ye.useRef({draft:d,onCommit:n});return k.current={draft:d,onCommit:n},Ye.useEffect(()=>{const A=g.current;if(!A)return;const F=()=>{const{draft:D,onCommit:J}=k.current,q=D??A.value;q&&q!==S.current&&J(q),S.current=null,m(null)};return A.addEventListener("change",F),()=>A.removeEventListener("change",F)},[]),$.jsx(a4t,{...c,ref:g,value:d??t,onChange:A=>{S.current===null&&(S.current=t),m(A.target.value),s?.(A.target.value)}})}async function j9t(t,n=qRt){const s=await Promise.all(n.map(c=>don(t,c)));return{assets:s.flatMap(c=>c.assets),failedListings:s.flatMap(c=>c.failedListings)}}async function don(t,n){const s=[""],c=[],d=[];let m=0;for(;s.length>0&&m<512;){const g=s.splice(0,8),S=await Promise.all(g.map(k=>t(n,k)));m+=g.length,S.forEach((k,A)=>{const F=g[A];if(!k.ok){d.push(`${n}/${F}: ${k.reason}`);return}for(const D of k.entries){const J=F?`${F}/${D.name}`:D.name;D.type==="directory"?s.push(J):c.push({path:J,root:n,entry:D})}})}return{assets:c,failedListings:d}}async function pon(t,n){const s=t.filter(S=>S.root==="public"),c=_on(s),d=(await Promise.all(c.map(async S=>{const k=await n(S.path);if(!k)return null;const A=Nze(k);return A?{sidecar:S,parsed:A}:null}))).flatMap(S=>S?[S]:[]),m=new Set;for(const{sidecar:S,parsed:k}of d){m.add(S.path);const A=Mxt(S.path);for(const F of zYr(k.image))m.add(A?`${A}/${F}`:F);for(const F of s)yMe(F.path)===yMe(S.path)&&m.add(F.path)}const g=d.flatMap(({sidecar:S,parsed:k})=>{const A=Mxt(S.path),F=A?`${A}/${k.image}`:k.image;return k.frames.map(D=>({path:`${F}#${D.name}`,root:S.root,entry:{name:`${D.name}.png`,type:"file",...S.entry.size===void 0?{}:{size:S.entry.size},...S.entry.modifiedAt===void 0?{}:{modifiedAt:S.entry.modifiedAt}},spritesheet:{sheetPath:F,x:D.x,y:D.y,width:D.width,height:D.height,rotated:D.rotated,sourceWidth:D.sourceWidth,sourceHeight:D.sourceHeight,trimX:D.trimX,trimY:D.trimY}}))});return[...t.filter(S=>S.root!=="public"||!m.has(S.path)),...g]}function _on(t){const n=new Map;for(const s of t){if(!/\.json$/i.test(s.path))continue;const c=yMe(s.path),d=n.get(c);(!d||OSt(s.path)>OSt(d.path))&&n.set(c,s)}return[...n.values()]}function Mxt(t){const n=t.lastIndexOf("/");return n<0?"":t.slice(0,n)}function L9t(t){const n=ig(t).kind;return n==="model"||n==="image"||n==="video"||n==="audio"?n:"other"}function mon(t){const n=ig(t.entry.name);return n.placeable&&n.runtimeReady?10:n.kind==="model"&&n.runtimeReady?15:n.kind==="prefab"?25:n.runtimeReady&&(n.kind==="image"||n.kind==="audio")?30:n.runtimeReady?40:n.importable?70:90}function hon(t){return(t.surface==="three"?0:t.surface==="canvas"?10:t.surface==="dom"?20:30)+(t.exported?0:4)}const gon=1e4,yon={paths:[],failures:[]};let $Y=null;async function von(){const t=await j9t(K0e,["public"]);return{paths:t.assets.filter(n=>L9t(n.entry.name)==="image").map(n=>n.path).sort((n,s)=>n.localeCompare(s)),failures:t.failedListings}}function bon(){const t=Date.now();return(!$Y||t-$Y.at>gon)&&($Y={at:t,scan:von().catch(n=>($Y=null,{paths:[],failures:[n instanceof Error?n.message:String(n)]}))}),$Y.scan}function Son(t){const[n,s]=Ye.useState(yon);return Ye.useEffect(()=>{let c=!0;return bon().then(d=>{c&&s(d)}),()=>{c=!1}},[t]),n}const xon={width:64},jxt={width:$Cr,fontSize:"var(--volter-font-md)",color:Go.content.muted};function AI(t){return`ingest-prop-${t.replace(/\./g,"-")}`}function won({field:t,io:n,value:s}){const{paths:c,failures:d}=Son(!0),[m,g]=Ye.useState(null),S=F=>{g(null),Promise.resolve(n.set(t.path,F===""?null:F)).then(D=>{g(D&&!D.persisted?{forValue:F,text:`Not saved — ${D.destination}. See the editor console for the mechanism.`}:null)})},k=m?.forValue===s?m.text:void 0,A=d.length>0?`${d.length} folder(s) under public/ could not be read — this list may be incomplete.`:void 0;return $.jsx(qCr,{testId:AI(t.path),value:s,options:c,previewUrlFor:F=>`/${F}`,disabled:t.readonly,note:k??A,onChange:S})}function Ton({field:t,io:n}){const s=t,c=n.get(s.path),d=jRe(c)?void 0:c,m=s.defaulted===!0&&d===void 0,g=s.readonly?CBe(s):void 0,S=s.resettable?$.jsx(dm,{"data-testid":`ingest-revert-${s.path.replace(/\./g,"-")}`,"aria-label":Fxt(s),title:Fxt(s),onClick:()=>n.remove?.(s.path),children:$.jsx(dc,{icon:LOe})}):null;return s.type==="boolean"?$.jsxs("label",{title:g,style:{display:"flex",gap:6,alignItems:"center",padding:"6px 8px",fontSize:"var(--volter-font-md)"},children:[$.jsx(TD,{"data-testid":AI(s.path),checked:!!d,ref:k=>{k&&(k.indeterminate=m)},disabled:s.readonly,onChange:k=>n.set(s.path,k.target.checked)}),$.jsx("span",{style:s.defaulted?{color:Go.content.dim}:void 0,children:s.label}),S]}):$.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},children:[$.jsx("span",{style:s.defaulted?{...jxt,color:Go.content.dim}:jxt,title:g??(s.defaulted?`${s.label} — default (not set here)`:s.label),children:s.label}),s.type==="color"?$.jsx(fon,{"data-testid":s.path==="material.color"?"ingest-color":AI(s.path),value:d??"#ffffff",disabled:s.readonly,onCommit:k=>n.set(s.path,k),onPreview:k=>n.preview?.(s.path,k)}):s.type==="number"?$.jsx(NRe,{type:"number","data-testid":AI(s.path),disabled:s.readonly,value:typeof d=="number"?String(Math.round(d*1e3)/1e3):"",placeholder:m?"—":void 0,onCommit:k=>{const A=Number.parseFloat(k);Number.isFinite(A)&&n.set(s.path,A)},style:xon}):s.type==="enum"?$.jsxs(Iw,{"data-testid":AI(s.path),disabled:s.readonly,value:String(d??""),onChange:k=>{const A=s.options?.find(F=>String(F)===k.target.value)??k.target.value;n.set(s.path,A)},style:{width:120},children:[m&&$.jsx("option",{value:"",children:"—"}),(s.options??[]).map(k=>$.jsx("option",{value:String(k),children:String(k)},String(k)))]}):s.type==="vec3"?$.jsx("div",{style:{width:190},children:$.jsx(LCr,{value:Array.isArray(d)&&d.length===3?[Number(d[0]),Number(d[1]),Number(d[2])]:[null,null,null],disabled:!!s.readonly,testIdPrefix:AI(s.path),onChange:k=>n.set(s.path,k)})}):s.type==="asset"?$.jsx(won,{field:s,io:n,value:typeof d=="string"?d:""}):s.type==="json"?$.jsx(yBe,{"data-testid":AI(s.path),"data-variant":"code",disabled:s.readonly,defaultValue:m?"":JSON.stringify(d??null),placeholder:m?"—":void 0,onBlur:k=>{try{n.set(s.path,JSON.parse(k.target.value))}catch{}},style:{width:160}},`${s.path}:${JSON.stringify(d??null)}`):$.jsx(NRe,{type:"text","data-testid":AI(s.path),readOnly:s.readonly,value:String(d??""),placeholder:m?"—":void 0,onCommit:k=>n.set(s.path,k),style:{width:120}}),S]})}function B9t({fields:t,io:n}){return $.jsx($.Fragment,{children:t.map(s=>$.jsx(Ton,{field:s,io:n},s.path))})}function ive(t){const[n,s]=Ye.useState(null);return Ye.useEffect(()=>{let c=0;const d=requestAnimationFrame(()=>{c=requestAnimationFrame(()=>s(t))});return()=>{cancelAnimationFrame(d),cancelAnimationFrame(c)}},[t]),n===t}const Con=Ye.lazy(()=>fo(()=>import("./InspectorCanvasPreview-BrFjhoiD.js"),__vite__mapDeps([262,1,2,3,4])).then(t=>({default:t.InspectorCanvasPreview})));function NSn({picture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=ive(n);return $.jsxs("div",{"data-testid":d?"inspection-preview-thumbnail":"inspection-preview",style:d?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[m&&$.jsx(Ye.Suspense,{fallback:null,children:t()}),!d&&s.map(g=>$.jsx(Ms,{"data-testid":g.id,size:"compact",disabled:g.disabled,title:g.title,onClick:g.run,style:{position:"absolute",right:8,bottom:8},children:g.label},g.id))]})}function Eon({source:t,entry:n,previewKey:s,actions:c,mode:d="section"}){const m=d==="thumbnail",g=ive(s);return $.jsxs("div",{"data-testid":m?"inspection-preview-thumbnail":"inspection-preview",style:m?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[g&&$.jsx("div",{style:{position:"absolute",inset:0,overflow:"hidden",background:"var(--volter-bg-inset)"},children:$.jsx(t.Thumbnail,{entry:n,previewRevision:0,width:m?96:256,height:m?96:256})}),!m&&c.map(S=>$.jsx(Ms,{"data-testid":S.id,size:"compact",disabled:S.disabled,title:S.title,onClick:S.run,style:{position:"absolute",right:8,bottom:8},children:S.label},S.id))]})}function kon({capture:t,previewKey:n,actions:s,mode:c="section"}){const d=c==="thumbnail",m=ive(n);return $.jsxs("div",{"data-testid":d?"inspection-preview-thumbnail":"inspection-preview",style:d?{position:"absolute",inset:0,overflow:"hidden"}:{position:"relative",width:"calc(100% - 24px)",aspectRatio:"1 / 1",flexShrink:0,margin:12,overflow:"hidden",border:"1px solid var(--volter-structural-divider)",borderRadius:"var(--dv-group-border-radius, 8px)"},children:[m&&$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(Con,{capture:t,previewKey:n,size:d?96:256})}),!d&&s.map(g=>$.jsx(Ms,{"data-testid":g.id,size:"compact",disabled:g.disabled,title:g.title,onClick:g.run,style:{position:"absolute",right:8,bottom:8},children:g.label},g.id))]})}function Aon(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Don(t){const n=[],s=[],c=new Map;for(const d of t)d.group?(c.has(d.group)||(c.set(d.group,[]),s.push(d.group)),c.get(d.group).push(d)):n.push(d);return{ungrouped:n,groups:s.map(d=>({name:d,groupId:Aon(d),properties:c.get(d)}))}}function Pon(t,n){if(!t.transforms)return null;const s=t.transforms.dimensions?.(n);return s!==void 0?s:t.hierarchy.object3D===void 0||t.hierarchy.object3D(n)!==null?"3d":null}const Ion=14,Non=[[/physic|rigid|collid/i,F0r],[/material/i,l0r],[/light/i,Qje],[/camera/i,nye],[/audio|sound|music/i,nLe],[/player|character|humanoid|person/i,R0r],[/anim|state|machine/i,OTt]];function Oon(t){for(const[n,s]of Non)if(n.test(t))return s;return GB}function Ron(t){return n=>Ye.createElement(Eon,{source:t.picture.source,entry:t.picture.entry,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Fon(t){return n=>Ye.createElement(kon,{capture:t.capture,previewKey:t.previewKey,actions:t.actions,...n?{mode:n}:{}})}function Mon(t){return t.media?t.media.preview?t.media.preview({displayName:t.displayName,previewKey:t.previewKey,actions:t.actions}):null:t.canvasCapture?Fon({capture:t.canvasCapture,previewKey:t.previewKey,actions:t.actions}):t.picture?Ron({picture:t.picture,previewKey:t.previewKey,actions:t.actions}):null}function pOe(t){const n=t.slice(10);if(n!=="position"&&n!=="rotation"&&n!=="scale")throw new Error(`The Transform section has no ${JSON.stringify(t)}.`);return n}const jon={position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]};function Lon(t,n,s,c){if(T4t(t))return t.sections(c,n);const d=t.Section;return[{id:t.id,title:t.title,icon:typeof t.icon=="function"?t.icon(c,n):t.icon,order:t.order,...t.railGroup===void 0?{}:{railGroup:t.railGroup},...t.railDefault===void 0?{}:{railDefault:t.railDefault},body:{kind:"custom",render:()=>Ye.createElement(d,{adapter:n,nodeId:s})}}]}function $9t(t,n,s,c){const d=new Set,m=new Map,g=[];for(const S of t){const k=Lon(S,n,s,c).filter(F=>!d.has(F.id)),A=(T4t(S)?S.claims??[]:[]).filter(F=>!d.has(F));if(!(k.length===0&&A.length===0)){for(const F of k)d.add(F.id),m.set(F.id,S.owner);for(const F of A)d.add(F);g.push(...k)}}return{sections:g,claimed:d,owners:m}}function q9t(t,n,s){return s===void 0?[...t]:t.filter(c=>n.get(c.id)===s.owner||s.builtins.includes(c.id))}function oje(t){const{adapter:n,nullSubject:s}=t,{sections:c,claimed:d,owners:m}=$9t(n?t.contributions??[]:[],n,null,null),g=q9t([...(s?.sections??[]).filter(S=>!d.has(S.id)),...c].sort((S,k)=>S.order-k.order),m,t.rail);return{id:s?.id??"nothing-selected",title:s?.title??"Nothing selected",identity:s?.kindLabel?{rename:{readOnly:!0,set:()=>{}},kindLabel:s.kindLabel,...s.note?{note:s.note}:{}}:null,...s?.hint?{hint:s.hint}:{},presentation:{preferred:EBe(t.surface)},quickActions:s?.quickActions??[],related:[],sections:g}}function Bon(t,n,s){if(t.body.kind!=="custom"||t.body.editable)return t;const c=s.get(t.id);return!c||c.length===0?t:{...t,body:{...t.body,editable:{fields:c,io:n}}}}function $on(t){const{adapter:n,nodeId:s,node:c,contributions:d,onEdit:m}=t;if(s===null)return oje({nullSubject:t.nullSubject??null,surface:t.surface,contributions:d,adapter:n,rail:t.rail});const{sections:g,claimed:S,owners:k}=$9t(d,n,s,c),A={get:en=>n.inspector?.get(s,en),...n.inspector?.preview?{preview:(en,ii)=>{n.inspector?.preview?.(s,en,ii)}}:{},set:(en,ii)=>{if(!n.inspector)return;const No=dPt(n,s,en,ii);return m(),No},...n.inspector?.remove?{remove:en=>{const ii=E3r(n,s,en);return m(),ii}}:{}},F=n.inspector?.properties(s)??[],D=F.find(en=>en.path==="name"),{ungrouped:J,groups:q}=Don(F.filter(en=>en.path!=="name")),G=J.find(en=>en.path==="visible"&&en.type==="boolean"),se=G?J.filter(en=>en!==G):J,pe=[...D&&D.readonly!==!0?[D]:[],...G?[G]:[]],ue=[];if(G){const en=A.get(G.path)!==!1,ii=en?"Visible — click to hide":"Hidden — click to show";ue.push({id:"inspector-visibility-toggle",title:ii,icon:en?Zje:sLe,placement:"identity",pressed:!en,disabled:G.readonly===!0,run:async()=>{await A.set(G.path,!en)}})}t.assetDocument&&ue.push({id:"open-asset-editor",title:"Open in Asset Editor",label:"Open in Asset Editor",placement:"preview",run:t.assetDocument.open}),n.transforms?.sourceCommit?.availability(s)?.available&&ue.push({id:"commit-live-transform-source",title:"Commit this live transform to its authored source literal",label:"Commit transform to source",icon:RTt,placement:"identity",run:async()=>{await uPt(n,s),m()}});const De=new Map;De.set(D5e,se);for(const en of q)De.set(Lht(en.groupId),en.properties);const be=[],X=n.truth?.resolve(s,"position").site??null,we=t.media,Be=c?.typeLabel??c?.label??s,bt=t.surface==="canvas"&&we===null&&t.stories?S9t({name:Be,path:X?.anchored===!0?X.file:"",surface:"canvas"}):null,It=ue.filter(en=>en.placement==="preview"),Wt=Mon({media:we,canvasCapture:t.canvasPreview,picture:bt,displayName:c?.label??s,previewKey:s,actions:It});!S.has(LRe)&&Wt!==null&&be.push({id:LRe,title:"Preview",icon:aR,order:x4t,body:{kind:"preview",render:Wt}});const zt=Pon(n,s),ft=!S.has(jht)&&zt!==null,tr=ft?q.find(en=>en.name==="Transform")?.properties??[]:[];if(ft){const en=n.transforms?.get(s)??jon,ii=we?.instanced??null,No=Object.fromEntries(["position","rotation","scale"].map(En=>[En,n.transforms?.editability?.(s,En)??{writable:n.capabilities.transform}])),gn={position:[...en.position],rotation:AVe(en.rotation),scale:[...en.scale]};be.push({id:jht,title:"Transform",icon:$Tt,order:aEr,body:{kind:"custom",data:{...gn,editability:No,...ii?{instanced:ii}:{}},editable:{fields:["position","rotation","scale"].map(En=>{const cs=!n.capabilities.transform||!No[En].writable;return{path:`transform.${En}`,label:En[0].toUpperCase()+En.slice(1),type:"vec3",value:gn[En],readonly:cs,...!cs&&n.transforms?.remove&&No[En].removable===!0?{resettable:!0}:{}}}),io:{get:En=>gn[pOe(En)],set:(En,cs)=>{if(!n.transforms)return;const On=aon(en,pOe(En),cs);NFe(n,s),q_e(n,s,On);const ji=OFe(n,s);return m(),ji},...n.transforms?.remove?{remove:En=>{const cs=lPt(n,s,pOe(En));return m(),cs}}:{}}},render:()=>[Ye.createElement(uon,{key:"channels",dimensions:zt,transform:en,readOnly:!n.capabilities.transform,channelEditability:No,...ii?.note?{note:ii.note}:{},onBegin:()=>{NFe(n,s)},onPreview:En=>{q_e(n,s,En)},onCommit:En=>{q_e(n,s,En),OFe(n,s),m()}}),...tr.length>0?[Ye.createElement(B9t,{key:"rows",fields:tr,io:A})]:[]]}})}S.has(D5e)||(se.length>0&&be.push({id:D5e,title:"Properties",icon:qTt,order:fQ,defaultOpen:!0,body:{kind:"fields",fields:se,io:A}}),q.forEach((en,ii)=>{if(tr.length>0&&en.name==="Transform")return;const No=en.properties.filter(gn=>!gn.defaulted).length;be.push({id:Lht(en.groupId),title:en.name,icon:Oon(en.name),order:w4t+ii,description:No>0?`${No} set of ${en.properties.length}`:`${en.properties.length} properties`,defaultOpen:No>0&&en.properties.length<=Ion,testId:`ingest-group-${en.groupId}`,body:{kind:"fields",fields:en.properties,io:A}})}));const Qt=t.stories;!S.has(S4t)&&Qt&&be.push(qon(Qt)),be.push(...g.map(en=>Bon(en,A,De))),be.sort((en,ii)=>en.order-ii.order);const Tt=q9t(be,k,t.rail),vn=bPt(n,s),Yr=SPt(n);return{id:s,title:c?.label??"",identity:{rename:{readOnly:D===void 0||D.readonly===!0,set:en=>A.set("name",en)},kindLabel:`${c?.typeLabel??c?.kind??""}${vn?` · ${vn.label}`:""}`,...c?.kind?{kind:c.kind}:{},...Yr?{document:{path:Yr,...vn?.detail?{title:vn.detail}:{}}}:{},note:X?.anchored?{text:`${X.kind==="data"?"Level data":"Source"} · ${X.display}`,title:X.kind==="data"?`Placed by record ${X.record} of ${X.file}, the game's own level data`:`Constructed by a \`new\` expression at ${X.file} line ${X.line}, column ${X.col}`,testId:"inspector-creation-site"}:void 0},presentation:{preferred:EBe(t.surface)},...pe.length>0?{editable:{fields:pe,io:A}}:{},...t.alsoSelected?{alsoSelected:t.alsoSelected}:{},quickActions:ue,related:n.related?.links(s)??[],sections:Tt}}function qon(t){return{id:S4t,title:t.title??"Stories",icon:aLe,order:cEr,body:{kind:"custom",render:()=>Ye.createElement(oon,{stories:t.stories,activeStoryId:t.activeStoryId,onApplyStory:t.onApplyStory,isolation:t.isolation,unavailableReason:t.unavailableReason??null})}}}const zon=["project-tool","tool-contribution"];function Von(t){const{activeDocumentKind:n,documentSelection:s}=t;return n===null||!zon.includes(n)?!1:s===null}function Lxt(t){const{subject:n,surface:s,available:c,override:d,workspaceDefault:m=null,columnShown:g=!0}=t,S=n.presentation.preferred??EBe(),k=ron(S,d,m),A=k!=="card"&&!g?"card":k;return{subject:n,surface:s,presentation:A,available:c,card:c&&A==="card",column:A!=="card"}}const z9t="game";function Uon(t){const n=t.projectName?.trim();return{id:z9t,title:n&&n.length>0?n:"Game",kindLabel:"Game",...t.instanceName?{note:{text:t.instanceName}}:{},sections:[]}}function OSn(t){return m$e({match:()=>e_()===a0,describe:()=>Uon(t())})}const Jon=3,Won=Object.freeze({none:!0});function Hon(t){const n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function eee(t,n=0){if(t===null)return null;const s=typeof t;if(s==="string"||s==="boolean")return t;if(s==="number")return Number.isFinite(t)?t===0?0:t:{kind:"opaque",type:"number"};if(s!=="object")return{kind:"opaque",type:s};if(n>=Jon)return{kind:"opaque",type:Bxt(t)};if(Array.isArray(t))return t.map(m=>eee(m,n+1));const c=t;if(!Hon(c))return{kind:"opaque",type:Bxt(c)};const d={};for(const[m,g]of Object.entries(c))g!==void 0&&(d[m]=eee(g,n+1));return d}function Bxt(t){return t.constructor?.name??"object"}function $xt(t,n){let s;try{s=n.get(t.path)}catch{s=void 0}return{path:t.path,label:t.label,type:t.type,...jRe(s)?{mixed:!0}:{},...!jRe(s)&&s!==void 0?{value:eee(s)}:{},...t.defaulted!==void 0?{defaulted:t.defaulted}:{},...t.readonly!==void 0?{readonly:t.readonly}:{},...t.readonly?{readonlyReason:CBe(t)}:{},...t.resettable!==void 0?{resettable:t.resettable}:{},...t.revertsTo!==void 0?{revertsTo:t.revertsTo}:{},...t.group!==void 0?{group:t.group}:{},...t.options!==void 0?{options:t.options.map(c=>eee(c))}:{}}}function qxt(t){const n={};for(const[s,c]of Object.entries(t))c!==void 0&&(n[s]=eee(c));return n}function Gon(t){const n=t.body;if(n.kind==="fields")return{kind:"fields",fields:n.fields.map(s=>$xt(s,n.io))};if(n.kind==="custom"&&n.data!==void 0&&n.editable===void 0)return{kind:"custom",id:t.id,title:t.title,data:qxt(n.data)};if(n.kind==="custom"&&n.editable!==void 0){const s=n.editable;return{kind:"fields",fields:s.fields.map(c=>$xt(c,s.io)),...n.data!==void 0?{data:qxt(n.data)}:{}}}return{kind:n.kind,id:t.id,title:t.title}}function Kon(t){return{id:t.id,title:t.title,order:t.order,...t.description!==void 0?{description:t.description}:{},body:Gon(t)}}function Xon(t,n){return{id:t.id,title:t.title,...t.identity?.kindLabel?{kindLabel:t.identity.kindLabel}:{},...t.identity?.note?{note:t.identity.note.text}:{},...t.hint?{hint:t.hint}:{},...t.alsoSelected?{alsoSelected:t.alsoSelected}:{},presentation:{preferred:t.presentation.preferred,...n?{resolved:n.presentation,surface:n.surface}:{}},quickActions:t.quickActions.map(s=>({id:s.id,title:s.title,...s.label!==void 0?{label:s.label}:{},...s.pressed!==void 0?{pressed:s.pressed}:{},...s.disabled!==void 0?{disabled:s.disabled}:{}})),related:t.related.map(({id:s,title:c})=>({id:s,title:c})),sections:t.sections.map(Kon)}}const zxt=new WeakMap;function Yon(t){if(!t.capture)return null;const n=zxt.get(t);if(n)return n;const s=async c=>t.capture?.(c)??null;return zxt.set(t,s),s}function Zon(t){return typeof t.previewImage=="function"}function Qon(t,n,s){if(!n)return null;if(s==="asset-lab"){const d=o2(e_());return d?Yon(d):null}let c=t;if(t instanceof hy){const d=t.ownerOf(n);c=t.childAdapters().find(m=>m.worldId===d)?.adapter??t}return Zon(c)?d=>c.previewImage(n,d,d):null}function esn(){const t=e_();if(t===null)return null;const n=gtn(t);if(n===void 0)return null;const s=PN(n.kind);return s===void 0||s.inspectorRail!=="owned"?null:{rail:{owner:s.owner,builtins:s.inspectorBuiltins??[]}}}function tsn(t){const{store:n,adapter:s,documentSelection:c,surface:d}=t,m=Uin();if(m!==null)return{subject:oje({nullSubject:m,surface:d}),available:!0};const g=Zin(c,n.selectedEntityIds,s),S=g?s.hierarchy.node(g):null;if(g!==null&&S===null)return{subject:oje({nullSubject:null,surface:d}),available:!1};const k=()=>n.notifyIngestEdit(),A=g?null:Z3r({adapter:s,surface:d,store:n,onEdit:k}),F=g?S?qht(S,s):[]:qht(null,s,{nullSubjectId:A?.id??null}),D=g?kze(s,g):null;return{subject:$on({adapter:s,nodeId:g,node:S,surface:d,contributions:F,...g?{}:{nullSubject:A},media:d==="asset-lab"?null:D,canvasPreview:Qon(s,g,d),assetDocument:D?.assetDocument??null,stories:H3r(s,S,g),...esn()??{},...c===null&&g!==null&&n.selectedEntityIds.size>1?{alsoSelected:n.selectedEntityIds.size-1}:{},onEdit:k}),available:g!==null||A!==null||F.length>0}}function ove(t){const n=ion(t),{adapter:s,documentSelection:c}=Cm(t),d=tsn({store:t,adapter:s,documentSelection:c,surface:n}),{subject:m}=d,g=d.available&&(m.id!==z9t||m.sections.length>0)&&!Von({activeDocumentKind:CC()?.descriptor.kind??null,documentSelection:c}),S=e_()===a0?dVe():null;if(S){const k=Yin(S),A=g?{...m,sections:[...m.sections.filter(F=>F.id!==k.id),k].sort((F,D)=>F.order-D.order)}:{id:`ingest:${S.summary.worldId}`,title:"Ingested game",identity:null,hint:"This mount exposes no editable scene subject. Coverage below says exactly which editor seams it did earn.",presentation:m.presentation,quickActions:[],related:[],sections:[k]};return Lxt({subject:A,surface:n,available:!0,override:nje(n),workspaceDefault:mD().inspector??null,columnShown:vgt("properties")!==!1})}return Lxt({subject:m,surface:n,available:g,override:nje(n),workspaceDefault:mD().inspector??null,columnShown:vgt("properties")!==!1})}function sve(t){const{subject:n,surface:s,presentation:c,available:d}=ove(t);return d?Xon(n,{surface:s,presentation:c}):Won}async function rsn(t,n){const{subject:s,available:c}=ove(t);if(!c)throw new Error("No Inspector subject is active.");const d=s.quickActions.filter(g=>g.id===n);if(d.length!==1){const g=s.quickActions.map(S=>S.id);throw new Error(d.length===0?`Inspector action ${JSON.stringify(n)} is not available. `+(g.length>0?`Available actions: ${g.join(", ")}.`:"This subject exposes no actions."):`Inspector action id ${JSON.stringify(n)} is ambiguous (${d.length} matches).`)}const m=d[0];if(!m||m.disabled)throw new Error(`Inspector action ${JSON.stringify(n)} is disabled.`);return await m.run(),sve(t)}function nsn(t,n){const s=c=>{throw new Error(`Inspector field ${JSON.stringify(t.path)} expects ${c}.`)};if(t.type==="number"&&(typeof n!="number"||!Number.isFinite(n))&&s("a finite number"),t.type==="boolean"&&typeof n!="boolean"&&s("a boolean"),(t.type==="string"||t.type==="color"||t.type==="asset"||t.type==="enum")&&typeof n!="string"&&s("a string"),t.type==="vec3"&&(!Array.isArray(n)||n.length!==3||n.some(c=>typeof c!="number"||!Number.isFinite(c)))&&s("three finite numbers"),t.type==="enum"&&t.options&&!t.options.includes(n))throw new Error(`Inspector field ${JSON.stringify(t.path)} accepts: ${t.options.map(String).join(", ")}.`)}async function isn(t,n,s){const c=V9t(t,n);nsn(c.field,s);const d=await c.io.set(n,s)??Rhe;return{subject:sve(t),write:d}}function V9t(t,n){const{subject:s,available:c}=ove(t);if(!c)throw new Error("No Inspector subject is active.");const d=(s.editable?.fields??[]).filter(k=>k.path===n).map(k=>({field:k,io:s.editable.io})),m=s.sections.flatMap(k=>{const A=k.body,F=A.kind==="fields"?{fields:A.fields,io:A.io}:A.kind==="custom"?A.editable:void 0;return F?F.fields.filter(D=>D.path===n).map(D=>({field:D,io:F.io})):[]}),g=[...d,...m];if(g.length===0)throw new Error(`The active Inspector has no field at ${JSON.stringify(n)}.`);if(g.length>1)throw new Error(`The active Inspector exposes ${JSON.stringify(n)} more than once.`);const S=g[0];if(S.field.readonly)throw new Error(`Inspector field ${JSON.stringify(n)} is read-only: ${CBe(S.field)}`);return S}class sje extends Error{constructor(n){super(n),this.name="InspectionRemovalUnavailableError"}}async function osn(t,n){const s=V9t(t,n);if(s.field.resettable!==!0)throw new sje(`Inspector field ${JSON.stringify(n)} does not declare itself removable (\`resettable\`), so this lane has no way to express the property's absence. Write a value with \`set-inspection-field\` instead — and note that doing so cannot restore byte-absence for a property an edit ADDED.`);if(!s.io.remove)throw new sje(`The Inspector io that owns ${JSON.stringify(n)} implements no removal door, so the property's authored override cannot be dropped through this editor. The dialect writer that owns this source edit owns removal too; until it does, an edit/revert round trip over this lane is unverifiable at byte level.`);const c=await s.io.remove(n)??Rhe;return{subject:sve(t),write:c}}const DVe=new Map;let U9t=[];const aje=new Set;function J9t(){U9t=[...DVe.values()];for(const t of aje)t()}function RSn(t){return aje.add(t),()=>aje.delete(t)}function FSn(t){DVe.set(t.rootId,t),J9t()}function MSn(t){DVe.delete(t)&&J9t()}function W9t(){return U9t}function ssn(){const t=W9t();if(t.length===0)return null;const n=t.filter(s=>s.source==="measured");return n.length===0?null:`${n.length} of ${t.length} root(s) have NO readiness declaration (${n.map(s=>s.rootId).join(", ")}) — the host is measuring instead. A self-booting game states it with \`window.volterGame.ready\`.`}function asn(t){return t.liveMounted?t.livePlaying?t.storePlayState==="paused"?"paused":"playing":"paused":"stopped"}async function csn(t,n){switch(t.reach.kind){case"game-contract":{const s=n.scenes();if(!s)return{ok:!1,code:"SCENE_CONTRACT_UNAVAILABLE",error:`open: "${t.id}" is reached through the running game's own scenes contract, and the game running in this session publishes none (\`window.volterGame.scenes\`).`};const c=s.goToScene(t.reach.sceneId);if(!c.ok)return{ok:!1,code:"SCENE_NOT_IN_CONTRACT",error:`open: "${t.id}" — ${c.error}`,known:c.known};const d=await c.settled;return d.error!==void 0?{ok:!1,code:"SCENE_SWITCH_FAILED",error:`open: "${t.id}" — the game's own navigation failed: ${d.error}`}:(n.activateGameDocument(),{ok:!0,documentId:n.gameDocumentId,title:t.label,scene:{requested:d.requested,current:d.current}})}case"root-mount":return n.activateGameDocument()?{ok:!0,documentId:n.gameDocumentId,title:t.label}:{ok:!1,code:"SCENE_DOCUMENT_NOT_MOUNTED",error:`open: "${t.id}" is the running game itself, and no game document is open in this session.`};case"entrypoint-selection":{const s=n.remountSelection,c=t.region;if(!s||c===null)return{ok:!1,code:"SCENE_NOT_OPENABLE_LIVE",error:`open: "${t.id}" sits at the entrypoint's \`${t.reach.selection}\` swap slot, and this session has no live remount for a native swap-slot scene — a running game cannot be sent there in place. Stop the game and open it as a document instead.`};const d=await s({selection:t.reach.selection,key:t.reach.key,regionId:c});return d.ok?(n.activateGameDocument(),{ok:!0,documentId:n.gameDocumentId,title:t.label,scene:{requested:t.reach.key,current:t.reach.key},restart:!0}):{ok:!1,code:"SCENE_SWITCH_FAILED",error:`open: "${t.id}" — remount at \`${t.reach.selection}["${t.reach.key}"]\` failed: ${d.error}`}}case"story":case"none":return null}}const zge="console";function lsn(t){let n=zQ().length>0;const s=CRt(()=>{const m=zQ().length>0;m&&!n&&mD().drawer!=="hidden"&&bC(zge),n=m});let c=t.getSnapshot().lastError!==null;const d=t.subscribe(()=>{const m=t.getSnapshot().lastError,g=m!==null;g&&!c&&(ea.error(`Source write rolled back: ${m.message} (${m.code})`,"history"),mD().drawer!=="hidden"&&bC(zge)),c=g});return()=>{s(),d()}}function ave(){rkr(zge)}function cve(){bC(zge)}const Vge=new Map;function jSn(t){return n=>{if(n.phase==="adopted"){Vge.set(t,{source:n.source,sceneId:n.sceneId,cameraId:n.cameraId,alternates:[]});return}const s=Vge.get(t);s&&s.alternates.push({sceneId:n.sceneId,cameraId:n.cameraId,sameRenderer:n.sameRenderer,drawCount:n.drawCount})}}function LSn(t){Vge.delete(t)}function usn(){return[...Vge].map(([t,n])=>({rootId:t,source:n.source,sceneId:n.sceneId,cameraId:n.cameraId,alternates:[...n.alternates],...n.alternates.length>0?{ambiguity:`"${t}" rendered ${n.alternates.length} other world(s) after the one the editor adopted (${n.source}: ${n.sceneId}). The adopted world is unchanged; if the editor is showing the wrong scene, one of these is it: `+n.alternates.map(s=>`${s.sceneId}${s.sameRenderer?"":" (a SECOND renderer)"}`).join(", ")}:{}}))}const fsn=new Set(["state","stateAll","providers","commands","events","snapshot"]);function dsn(t){if(t.type!=="bridge-call")return[];const n=t.method;if(typeof n!="string"||!fsn.has(n))return[];const s=t.instance;try{const c=qwr(s).debug;if(c===void 0)return[];const d=[v3t(c),s??""].join(":"),m=(S,k="")=>[d,S,k].join(":");if(n==="snapshot")return[m("snapshot"),m("state","time"),m("stateAll"),m("events")];const g=n==="state"?String(t.callArgs?.[0]):"";return[m(n,g)]}catch{return[]}}function psn(t,n,s){const c=dsn(t),d=n&&c.length>0&&c.every(m=>s.has(m));if(n)for(const m of c)s.add(m);return{derived:d?"none":n&&c.length>0?"always":$vr(t.type)??Lvr(t.type),playFullReport:n&&!d&&c.length>0?"explicit":n&&t.type==="bridge-call"&&t.method==="invoke"?"if-content-changed":"none"}}function _sn(t,n,s,c){return t==="none"?!1:!(t==="if-content-changed"&&n==="none"&&s===c)}function Vxt(t,n){const s=nq(t);return s.hierarchy.node(n)!==null||kze(s,n)!==null?null:`select: no entity with id "${n}" — neither the active authoring adapter's hierarchy nor the live object index owns it, so there is nothing to select. Read the ids that exist with editor.hierarchy() (the rows the panel is rendering) or editor.status().entities.`}function _Oe(t,n,s){const c=o2(e_())?.selection;if(c){c.apply(n);return}const d=t.applySelectionBeforePresentation(n);s?.deferPresentation?s.deferPresentation(d):setTimeout(d,0)}function msn(){return typeof document>"u"?null:{visibility:document.visibilityState,focused:document.hasFocus(),reportedAt:Date.now()}}const hsn=["entities","entityCount","ontologyInvariants"];function gsn(t){const n={...t};for(const s of hsn)delete n[s];for(const s of zrn())delete n[s];return{...n,_statePatch:!0}}function Uxt(t,n=null){const s=zQ(),c=e_(),d=Pze(t),m=g4t.getSnapshot(),g=n?.entities??W0e(t);return{playState:asn({storePlayState:t.playState,liveMounted:_Ve(),livePlaying:rve()}),mountFailures:s.map(S=>({...S})),storyFailures:rq().flatMap(S=>S.ok?[]:[{modulePath:S.modulePath,error:S.error}]),moduleSplits:tnn().map(S=>({path:S.path,urls:[...S.urls]})),adapter:u0(),readiness:W9t().map(S=>({...S})),readinessWarning:ssn(),worldAdoption:usn().map(S=>({...S})),presence:msn(),pageErrors:ysn(),consoleErrors:vsn(),sessionErrors:bsn(),sessionWarnings:Ssn(),rendererResources:{...onn()},ontologyInvariants:n?.ontologyInvariants??_9t().map(S=>({...S})),...qrn(n),selectedEntityId:d[0]??null,selectedEntityIds:d,selectedCreationSite:FYr(t),selectedWriteAnchorKind:MYr(t),activeViewportTab:t.activeViewportTab,activeDocumentId:c,activeUtilityId:ekr(),gameplaySession:{selectedSessionId:m.selectedSessionId,latestSessionId:m.sessions[0]?.id??null,selectedStatus:m.selectedSession?.status??null,cursorMs:m.cursorMs,liveEdgeMs:m.liveEdgeMs},openDocumentIds:l0().map(S=>S.descriptor.id),availableDocuments:Q0e().map(S=>({id:S.descriptor.id,category:S.category,default:S.default})),activeTabKey:(()=>{const S=e_();return S&&JRt(S)?S:"__inspector__"})(),entityCount:g.length,savePath:Dze(t),saveState:ERt(t),entities:g,viewportActivationTimings:aTr()}}function H9t(t,n){const s=n instanceof Error?n.message:String(n),c=`editor command "${String(t.type)}" threw: ${s}`;return console.error(c,n),{ok:!1,error:c}}function PVe(t){const n=aVe();return!n||t<n.startedAt?!1:n.endedAt===null||t<=n.endedAt}function ysn(){return ea.getEntries().filter(t=>t.level==="error"&&t.source==="runtime"&&PVe(t.timestamp)).slice(-100).map(t=>t.count>1?`${t.message} (×${t.count})`:t.message)}const Jxt=200;function vsn(){return IVe(ea.getEntries().filter(t=>t.level==="error"&&t.source!=="runtime"&&PVe(t.timestamp)))}function IVe(t){const n=t.reduce((c,d)=>c+d.count,0),s=t.slice(-3).map(c=>{const d=c.source?`[${c.source}] `:"",m=c.count>1?` (×${c.count})`:"",g=c.message.length>Jxt?`${c.message.slice(0,Jxt)}…`:c.message;return`${d}${g}${m}`});return{count:n,recent:s}}function bsn(){return IVe(ea.getEntries().filter(t=>t.level==="error"&&!PVe(t.timestamp)))}function Ssn(){return IVe(ea.getEntries().filter(t=>t.level==="warn"))}async function xsn(t){const n=t.src;if(typeof n!="string")return{ok:!1,error:`document-script requires a string "src" (the step's toString())`};const s=e_();if(!s)return{ok:!1,error:"document-script: no document is active",data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE"}};await p4t(s);const c=cQ(s);if(e_()!==s)return{ok:!1,error:"document-script: the active document changed while its context was loading",data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE",documentId:s}};if(c===void 0)return{ok:!1,error:`document-script: the active document (${s}) publishes no context to run against — a document opts in through its \`publishContext\` prop (the mesh document publishes its session).`,data:{code:"DOCUMENT_SCRIPT_UNAVAILABLE",documentId:s}};let d;try{d=new Function("ctx","info",`return (${n})(ctx, info)`)}catch(m){return{ok:!1,error:`document-script: failed to reconstruct the step function from source — ${m instanceof Error?m.message:String(m)}`,data:{code:"DOCUMENT_SCRIPT_ERROR"}}}try{const m=await d(c,{documentId:s});return{ok:!0,data:{result:m===void 0?null:m}}}catch(m){return{ok:!1,error:`document-script: step threw — ${m instanceof Error?m.message:String(m)}`,data:{code:"DOCUMENT_SCRIPT_ERROR"}}}}async function wsn(t,n,s){if(LYr(n.type),gYr()&&n.type!=="stop")return{ok:!1,error:"Video export owns this paused run. Stop it to cancel before another command."};const c=uVe(n);if(c)return c;if(n.type==="play"||n.type==="restart"){const g=zQ();if(g.length>0)return{ok:!1,error:`this project's ${g.length===1?"root":"roots"} did not mount, so there is nothing to ${n.type==="play"?"play":"restart"}: `+g.map(S=>`"${S.worldId}" (${S.identity}) — ${S.message}`).join("; ")}}const d=await BYr(n.type);if(d)try{const g=await d.handle(n);return{ok:g.ok,...g.error!==void 0?{error:g.error}:{},...g.data!==void 0?{data:g.data}:{}}}catch(g){return H9t(n,g)}if(!sye(n.type))return{ok:!1,error:`unknown command type "${n.type}" — not one of the editor's own, and no package this project declares contributes it (or the editor page predates this CLI)`,data:{code:"UNKNOWN_COMMAND_TYPE"}};const m=n.type;switch(m){case"session-prepare-close":return await nnn(),{ok:!0};case"select":{const g=n.id??null;if(g!==null){const S=Vxt(t,g);if(S)return{ok:!1,error:S}}_Oe(t,g?[g]:[],s);break}case"select-multiple":{const g=n.ids;for(const S of g){const k=Vxt(t,S);if(k)return{ok:!1,error:k}}_Oe(t,g,s);break}case"select-all":{_Oe(t,W0e(t).map(g=>g.id),s);break}case"viewport-tab":{const g=n.tab;if(g!=="edit"&&g!=="play")return{ok:!1,error:`viewport-tab requires "edit" or "play", got ${String(g)}.`};const S=l0().map(A=>A.descriptor.id),k=g==="play"?S.find(A=>A===a0):S.find(A=>A==="workspace:scene")??S.find(A=>A!==a0);if(!k||!X0(k))return{ok:!1,error:g==="play"?"viewport-tab play: no Game document is open. Start Play first.":"viewport-tab edit: no document other than Game is open."};break}case"show-panel":try{const g=n.panel;return typeof g!="string"||g.trim()===""?{ok:!1,error:'show-panel requires a non-empty "panel".'}:{ok:!0,data:{panel:await m9t(g)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"active-tab":{const g=n.key;if(g!=="__inspector__"&&!X0(g)){const S=l0().map(k=>k.descriptor.id);return{ok:!1,error:`No open workspace document with id "${g}" — nothing was activated. `+(S.length>0?`Open documents: ${S.join(", ")}.`:"No documents are open in this workspace.")}}break}case"select-asset":{const g=n.path;if(typeof g!="string"||g.trim()==="")return{ok:!1,error:'select-asset requires a non-empty "path".'};const S=g.replace(/^\/+/,""),k=S.split("/").pop()??S,A=ig(k);BI({path:g,name:k,kind:FB(A)??"unknown",capabilities:A,origin:"project"});break}case"open-asset-tab":{const g=n.kind,S=sN(n.path,g);if(!await WRt(S,g))return{ok:!1,error:`Asset document did not finish mounting its Inspector: ${S}`};break}case"close-asset-tab":{const g=n.key;JRt(g)&&EN(g);break}case"toggle-command-palette":SVe();break;case"toggle-console":ave();break;case"page-reload":return setTimeout(()=>{window.location.reload()},0),{ok:!0,data:{scheduled:!0}};case"set-workspace":{const g=n.workspace;if(!kB(g))return{ok:!1,error:`set-workspace requires one of ${$Be().join(", ")}, got ${String(g)}.`};if(zS()===g)return{ok:!0,data:{workspace:g,applied:!0}};const S=hDt().then(()=>!0);s2(g);const k=await Promise.race([S,new Promise(A=>setTimeout(()=>A(!1),3e3))]);return{ok:!0,data:{workspace:g,applied:k}}}case"set-style":{const g=n.style,S=OR().map(A=>A.id);if(typeof g!="string"||!S.includes(g))return{ok:!1,error:`set-style requires one of ${S.join(", ")}, got ${String(g)}.`};HBe(g);const k=Ahe();return k!==g?{ok:!1,error:`set-style applied "${g}" but the editor is wearing ${k===null?"a custom mix of axes":`"${k}"`} (${lgt(g).join("; ")}).`,data:{style:k,differences:lgt(g)}}:{ok:!0,data:{style:g}}}case"viewport-presentation":{const g=n.documentId;if(typeof g!="string"||g==="")return{ok:!1,error:"viewport-presentation needs a `documentId` (a document stage)."};const S=F_e(g)===null&&F_e(`document:${g}`)!==null?`document:${g}`:g,k=n.layer;if(k!==void 0){if(typeof k!="object"||k===null)return{ok:!1,error:"viewport-presentation `layer` must be a presentation layer object."};GBe(S,k)}const A=n.preset;return A!==void 0&&(typeof A!="string"||!bAr(S,A))?{ok:!1,error:`viewport-presentation \`preset\` must be one of: ${fgt().map(F=>F.id).join(", ")||"(none registered)"}.`}:{ok:!0,data:{presentation:KBe(S),binding:F_e(S),bound:TAr(),lastDraw:wAr(S),presets:hAr().map(F=>F.id),viewPresets:fgt().map(F=>F.id),environmentImages:DAr().map(F=>F.id)}}}case"set-appearance":{const g=n.material;return g===void 0?{ok:!1,error:"set-appearance needs a `material` to set."}:Rye(g)?(TDt(g),{ok:!0,data:{material:_N(),style:Ahe()}}):{ok:!1,error:`set-appearance material must be one of ${ATr().map(k=>k.id).join(", ")}, got ${String(g)}.`}}case"present-view":try{return{ok:!0,data:{...await Bge(t,n.view)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"current-view":return{ok:!0,data:{view:ote(t)}};case"inspect":return{ok:!0,data:{subject:sve(t)}};case"run-inspection-action":try{const g=n.actionId;if(typeof g!="string"||g.trim()==="")throw new Error("run-inspection-action requires a non-empty actionId.");return{ok:!0,data:{subject:await rsn(t,g)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"run-command":try{const g=n.commandId;if(typeof g!="string"||g.trim()==="")throw new Error("run-command requires a non-empty commandId.");const S=await Unn(g,n.args);return{ok:!0,data:{result:S===void 0?null:S}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"hierarchy":{const g=gxt();return g===null?{ok:!1,error:"the hierarchy panel (GameHierarchy) is not mounted — no row tree is rendered, so there is nothing to report. Open the Hierarchy panel in the workspace dock and retry."}:{ok:!0,data:{hierarchy:Wrn(g,{playState:t.playState,activeViewportTab:t.activeViewportTab})}}}case"expand-hierarchy-all":case"collapse-hierarchy-all":{const g=n.type==="expand-hierarchy-all",S=gxt();if(S===null)return{ok:!1,error:`the hierarchy panel (GameHierarchy) is not mounted — no row tree is rendered, so there is nothing to ${g?"expand":"collapse"}. Open the Hierarchy panel in the workspace dock and retry.`};const k=Urn();g?S.expandAll():S.collapseAll();try{await k}catch(A){return{ok:!1,error:A instanceof Error?A.message:String(A)}}return{ok:!0,data:{}}}case"undo":case"redo":{const g=s?.history;if(!g)return{ok:!1,error:`${String(n.type)}: this editor has no history session attached, so there is nothing to undo.`};const S=n.type==="undo"?await g.undo():await g.redo(),k=g.getSnapshot();return{ok:!0,data:{moved:S,canUndo:k.canUndo,canRedo:k.canRedo,undoLabel:k.undoLabel,redoLabel:k.redoLabel}}}case"set-inspection-field":try{const g=n.path;if(typeof g!="string"||g.trim()==="")throw new Error("set-inspection-field requires a non-empty field path.");const S=await isn(t,g,n.value);return{ok:!0,data:{subject:S.subject,write:S.write}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"remove-inspection-field":try{const g=n.path;if(typeof g!="string"||g.trim()==="")throw new Error("remove-inspection-field requires a non-empty field path.");const S=await osn(t,g);return{ok:!0,data:{subject:S.subject,write:S.write}}}catch(g){return g instanceof sje?{ok:!1,error:g.message,data:{code:"REMOVAL_UNAVAILABLE"}}:{ok:!1,error:g instanceof Error?g.message:String(g)}}case"structure-op":try{const g=String(n.op??""),S=Cm(t).adapter,k=Pze(t),A=Array.isArray(n.ids)?n.ids.filter(G=>typeof G=="string"):typeof n.id=="string"&&n.id.trim()!==""?[n.id]:k,F=A[0],D=()=>{if(!F)throw new Error(`structure-op "${g}" needs an id or a selected row.`);return F},J=G=>typeof n[G]=="string"&&n[G].trim()!==""?n[G]:void 0,q=S.structure;if(!q)return{ok:!1,error:"structure-op: the active authoring adapter exposes no structure provider."};switch(g){case"create":{const G=J("kind");if(!G)return{ok:!1,error:'structure-op "create" needs a `kind`.'};const se=Xye(S,G,J("parentId"));return{ok:!0,data:{id:se.id,write:await se.ack}}}case"delete":return{ok:!0,data:{write:A.length>1&&q.removeMany?await a$e(S,A):await Ohe(S,D())}};case"duplicate":{if(A.length>1&&q.duplicateMany)return{ok:!0,data:{write:await mPt(S,A)}};const G=Yye(S,D());return{ok:!0,data:{id:G.id,write:await G.ack}}}case"reparent":{const G=J("parentId")??null;return{ok:!0,data:{write:await QO(S,D(),G)}}}case"reorder":{if(!q.reorder)return{ok:!1,error:"structure-op: this adapter has no `reorder`."};const G=J("beforeSiblingId")??null;return{ok:!0,data:{write:await c$e(S,D(),G)}}}case"wrap":return q.wrap?{ok:!0,data:{write:await Zye(S,D(),J("tag"))}}:{ok:!1,error:"structure-op: this adapter has no `wrap`."};case"unwrap":return q.unwrap?{ok:!0,data:{write:await Qye(S,D())}}:{ok:!1,error:"structure-op: this adapter has no `unwrap`."};case"group":{if(!q.group)return{ok:!1,error:"structure-op: this adapter has no `group`."};const G=e0e(S,A);return{ok:!0,data:{id:G.id,write:await G.ack}}}case"ungroup":{if(!q.ungroup)return{ok:!1,error:"structure-op: this adapter has no `ungroup`."};const G=l$e(S,D());return{ok:!0,data:{ids:G.ids,write:await G.ack}}}case"copy":return q.copy?{ok:!0,data:{copied:await t0e(S,A)}}:{ok:!1,error:"structure-op: this adapter has no `copy`."};case"cut":{if(!q.cut)return{ok:!1,error:"structure-op: this adapter has no `cut`."};const G=await r0e(S,A);return G===!1?{ok:!1,error:'structure-op "cut" was refused by the adapter.'}:{ok:!0,data:{write:G}}}case"paste":{if(!q.paste)return{ok:!1,error:"structure-op: this adapter has no `paste`."};const G=J("parentId")??(F?S.hierarchy.node(F)?.parentId??null:null),se=await n0e(S,G);return se===!1?{ok:!1,error:'structure-op "paste" was refused by the adapter.'}:{ok:!0,data:{write:se}}}default:return{ok:!1,error:`structure-op: unknown op ${JSON.stringify(g)}. Known ops: create, delete, duplicate, reparent, reorder, wrap, unwrap, group, ungroup, copy, cut, paste.`}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"document-probe":try{return{ok:!0,data:{...await jrn(n.step)}}}catch(g){return{ok:!1,error:g instanceof Error?g.message:String(g)}}case"capture-active-document":{const g=RDr(n);if("error"in g)return{ok:!1,error:g.error};try{return n.view&&await Bge(t,n.view),{ok:!0,data:{...await h9t(t,g.size)}}}catch(S){return{ok:!1,error:S instanceof Error?S.message:String(S)}}}case"capture-editor-chrome":{const g=n.scale;if(g!==void 0&&(typeof g!="number"||!(g>0)||g>4))return{ok:!1,error:`capture-editor-chrome: "scale" must be a number greater than 0 and no more than 4 (output pixels per CSS pixel; the frame crosses the relay as base64 PNG). It defaults to the page's own devicePixelRatio.`};const S=n.region;if(S!==void 0&&S!=="page"&&S!=="document")return{ok:!1,error:'capture-editor-chrome: "region" is "page" or "document".'};try{return{ok:!0,data:{...await Brn(t,{...g===void 0?{}:{scale:g},...S===void 0?{}:{region:S}})}}}catch(k){return{ok:!1,error:k instanceof Error?k.message:String(k)}}}case"document-table":{const g=u0();return g?{ok:!0,data:{default:g.scenes.default??null,entries:g.scenes.entries,pending:g.documentsPending===!0}}:{ok:!1,error:"The project adapter has not resolved yet — no document table to list.",data:{code:"SCENE_TABLE_UNAVAILABLE"}}}case"open":{const g=n.id;if(typeof g!="string"||g.trim()==="")return{ok:!1,error:"open requires a non-empty scene-table entry id."};const S=ste(),k=S?u0()?.scenes.entries.find(J=>J.id===g&&PN(J.kind)===void 0):void 0,A=S?async J=>await ZFt(J)??{ok:!1,error:"No running lane can remount with a selection."}:void 0,D=(k?await csn(k,{scenes:fVe,activateGameDocument:()=>X0(a0),gameDocumentId:a0,...A?{remountSelection:A}:{}}):null)??await Itn(g);return D.ok?{ok:!0,data:{documentId:D.documentId,title:D.title,..."scene"in D&&D.scene?{scene:D.scene}:{},..."restart"in D&&D.restart?{restart:!0}:{}}}:{ok:!1,error:D.error,data:{code:D.code,...D.known===void 0?{}:{known:[...D.known]}}}}case"document-script":return xsn(n);default:return{ok:!1,error:`unknown command type "${String(m)}" — editor page predates this CLI`,data:{code:"UNKNOWN_COMMAND_TYPE"}}}return{ok:!0}}function Tsn(t,n){const s=jD();let c=null,d=-1;const m=new Set;let g=!1,S=null,k=null,A=null;const F=()=>{n_e()===null&&(c=Uxt(t),d=t.contentVersion,zSt(c))};let D=null;const J=()=>{S!==null&&(clearTimeout(S),S=null),D?.(),D=null},q=()=>{k=null,A!==null&&clearTimeout(A),A=null},G=()=>{q(),g=!0,J(),S=setTimeout(()=>{S=null,D=yxt(()=>{D=null,g=!1,F()})},250)},se=vn=>{if(t.contentVersion!==vn){G();return}q(),k=vn,A=setTimeout(q,1e3)},pe=()=>ste()&&t.playState==="playing",ue=vn=>{(vn!==null||k!==null&&t.contentVersion!==k||g&&t.contentVersion!==d)&&G()},Ce=(vn,Yr,en)=>pe()?(_sn(en,vn,t.contentVersion,d)&&(vn==="explicit"?G():vn==="if-content-changed"?se(Yr??t.contentVersion):ue(Yr)),!0):!1,Fe=(vn="always",Yr="none",en=null)=>{if(n_e()!==null)return;if(c===null){F();return}const ii=Uxt(t,c);c=ii,zSt(gsn(ii)),vn!=="none"&&(Ce(Yr,en,vn)||(J(),q(),g=!1,!(vn==="if-content-changed"&&t.contentVersion===d)&&D===null&&(D=yxt(()=>{D=null,F()}))))};let De=!1,be=!1,X=t.playState;const we=vn=>{vn&&(be=!0),!De&&(De=!0,queueMicrotask(()=>{De=!1;const Yr=be;be=!1;const en=X!==t.playState;X=t.playState,Fe(Yr?"always":"if-content-changed",en&&t.playState==="playing"?"explicit":"none")}))},Be=()=>we(!1),bt=()=>we(!0),It=t.subscribe(Be),Wt=hVe(bt),zt=OC(bt),ft=oTr(bt);F(),i_e(!0),tEr(BZr),s.addEventListener("open",()=>{Fe("if-content-changed"),i_e(n_e()===null)});const tr=Oze(vn=>{i_e(vn===null)});s.addEventListener("editor-command",vn=>{try{const Yr=JSON.parse(vn.data),en=Yr._requestId,ii=t.contentVersion,No=n_e();if(No!==null){const En=QYr(No,String(Yr.type));en&&VSt(en,!1,En);return}en&&jZr(en);let gn;wsn(t,Yr,{deferPresentation:En=>{gn=En},...n?{history:n}:{}}).catch(En=>H9t(Yr,En)).then(En=>{if(en){const On=VSt(en,En.ok,En.error,En.data,gn!==void 0);if(gn){const ji=()=>window.setTimeout(gn,0);On.then(ji,ji)}}else gn&&window.setTimeout(gn,0);const cs=psn(Yr,En.ok,m);Fe(cs.derived,cs.playFullReport,ii)})}catch{}}),s.addEventListener("project-changed",()=>{window.location.reload()});const Qt=()=>Fe();document.addEventListener("visibilitychange",Qt),window.addEventListener("focus",Qt),window.addEventListener("blur",Qt);const Tt=()=>setTimeout(Qt,0);return window.addEventListener("error",Tt),window.addEventListener("unhandledrejection",Tt),()=>{i_e(!1),D?.(),D=null,S!==null&&clearTimeout(S),S=null,q(),tr(),It(),Wt(),zt(),ft(),document.removeEventListener("visibilitychange",Qt),window.removeEventListener("focus",Qt),window.removeEventListener("blur",Qt),window.removeEventListener("error",Tt),window.removeEventListener("unhandledrejection",Tt),s.close()}}function Csn(t,n,s){return Ye.createContext(s)}const LD=Csn(void 0,"EditorContext",null);function Esn({runtime:t,children:n}){const s=Ye.useMemo(()=>({begin:()=>{},end:()=>{}}),[]);return $.jsx(LD.Provider,{value:t,children:$.jsx(s4t.Provider,{value:s,children:$.jsx(Ye.Suspense,{children:n})})})}function Yv(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorStore must be used within <EditorProvider>");return t.store}function BSn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorStats must be used within <EditorProvider>");return t.stats}function ksn(){const t=Ye.useContext(LD);if(!t)throw new Error("useEditorInit must be used within <EditorProvider>");return t.initPromise}function G9t(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryService must be used within <EditorProvider>");return t.session.history}function Asn(){return Ye.useContext(LD)?.session.history??null}function $Sn(){return Ye.useContext(LD)?.store??null}function qSn(){return Ye.useContext(LD)?.stats??null}function lve(){const t=Ye.useContext(LD);if(!t)throw new Error("useHistoryCommands must be used within <EditorProvider>");return t.session.historyCommands}function K9t(){const t=lve();return Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot)}function Dsn(t,n){return t==="selection"&&n==="selection"?"selection":"content"}class Psn{_viewportSelections={edit:new Set,play:new Set};_history=null;_playState="stopped";_playEditRegime=null;_followsWorkspaceFocus;constructor(n={}){if(this._followsWorkspaceFocus=n.followsWorkspaceFocus===!0,!this._followsWorkspaceFocus)return;let s=this.activeViewportTab;i2(()=>{const c=this.activeViewportTab;c!==s&&(s=c,this._notify())})}_listeners=new Set;_deferredNotifyTimer=null;_deferredNotifyScope="content";_version=0;_shellVersion=0;_contentVersion=0;_hierarchyRowFacetVersion=0;subscribe=n=>(this._listeners.add(n),()=>this._listeners.delete(n));getSnapshot=()=>this._version;getShellSnapshot=()=>this._shellVersion;get contentVersion(){return this._contentVersion}get hierarchyRowFacetVersion(){return this._hierarchyRowFacetVersion}get projectHistory(){return this._history}_notify(n="content",s="shell",c=n!=="selection"){this._deferredNotifyTimer!==null&&(clearTimeout(this._deferredNotifyTimer),this._deferredNotifyTimer=null),this._beforeNotify(),this._version++,s==="shell"&&this._shellVersion++,n!=="selection"&&this._contentVersion++,c&&this._hierarchyRowFacetVersion++;for(const d of this._listeners)d()}_transformMode="combined";_transformSpace="world";_snapEnabled=!1;_snapValues={translate:1,rotate:15,scale:.25};_snapToSurface=!1;_rotationSnap=!1;_snap2D={step:8,offsetX:0,offsetY:0,primaryEvery:8,rotationOffset:0,rotationStep:15,scaleStep:.1,relative:!1,pixel:!0};_scaleSnap=!1;_smartSnap={enabled:!1,parent:!0,others:!0,guides:!0,sides:!0,center:!0};_preserveChildrenTransform=!1;_pivotMode="active-element";_gizmoAnchor="auto";_showHelpers=!0;_helperVisibility={bounds:!1,lights:!0,cameras:!0,colliders:!0,joints:!0,particles:!0,lod:!0,audio:!0,splines:!0,navmesh:!0,constraints:!0,reflectionProbes:!0,triggerVolumes:!0,skeletons:!1,weights:!1,cursor:!0,empties:!0};get transformMode(){return this._transformMode}get transformSpace(){return this._transformSpace}get snapEnabled(){return this._snapEnabled}get snapValues(){return this._snapValues}get snapToSurface(){return this._snapToSurface}get snap2D(){return this._snap2D}setSnap2D(n){this._snap2D={...this._snap2D,...n},this._notify()}get rotationSnap(){return this._rotationSnap}get scaleSnap(){return this._scaleSnap}setRotationSnap(n){this._rotationSnap=n,this._notify()}setScaleSnap(n){this._scaleSnap=n,this._notify()}get smartSnap(){return this._smartSnap}get preserveChildrenTransform(){return this._preserveChildrenTransform}get pivotMode(){return this._pivotMode}get gizmoAnchor(){return this._gizmoAnchor}get showHelpers(){return this._showHelpers}get helperVisibility(){return this._helperVisibility}setTransformMode(n){this._transformMode=n,this._notify()}setTransformSpace(n){this._transformSpace=n,this._notify()}toggleSnap(){this._snapEnabled=!this._snapEnabled,this._notify()}setSnapValues(n){this._snapValues={...this._snapValues,...n},this._notify()}setSmartSnap(n){this._smartSnap={...this._smartSnap,...n},this._notify()}toggleSnapToSurface(){this._snapToSurface=!this._snapToSurface,this._notify()}togglePreserveChildrenTransform(){this._preserveChildrenTransform=!this._preserveChildrenTransform,this._notify()}setPivotMode(n){this._pivotMode=n,this._notify()}setGizmoAnchor(n){this._gizmoAnchor=n,this._notify()}toggleHelpers(){this._showHelpers=!this._showHelpers,this._notify()}toggleHelperType(n){this._helperVisibility[n]=!this._helperVisibility[n],this._helperVisibility[n]&&(this._showHelpers=!0),this._notify()}_viewportActionListeners=new Set;onViewportAction=n=>(this._viewportActionListeners.add(n),()=>this._viewportActionListeners.delete(n));requestViewportAction(n){for(const s of this._viewportActionListeners)s(n)}focusOnEntity(n){this.requestViewportAction({type:"focus-entity",id:n})}focusOnSelection(){this.requestViewportAction({type:"focus-selection"})}frameAll(){this.requestViewportAction({type:"frame-all"})}zoomView(n){this.requestViewportAction({type:"zoom-view",direction:n})}focusOnScene(){this.requestViewportAction({type:"focus-scene"})}snapSelectionToFloor(){this.requestViewportAction({type:"snap-selection-to-floor"})}setViewPreset(n){this.requestViewportAction({type:"set-view-preset",preset:n})}stepView(n){this.requestViewportAction({type:"step-view",step:n})}toggleCameraView(){this.requestViewportAction({type:"toggle-camera-view"})}toggleProjection(){this.requestViewportAction({type:"toggle-projection"})}setCameraPose(n,s,c){this.requestViewportAction({type:"set-camera-pose",position:n,target:s,...c!==void 0?{fov:c}:{}})}notifyChange(n="content",s="shell",c=n!=="selection"){this._notify(n,s,c)}_notifyDeferred(n="content"){if(this._deferredNotifyTimer!==null){this._deferredNotifyScope=Dsn(this._deferredNotifyScope,n);return}this._deferredNotifyScope=n,this._deferredNotifyTimer=setTimeout(()=>{this._deferredNotifyTimer=null;const s=this._deferredNotifyScope;this._deferredNotifyScope="content",this._notify(s)},0)}attachHistory(n){if(this._history!==n){if(this._history)throw new Error("EditorStore is already attached to project history.");this._history=n,this._onHistoryAttached()}}get selectedEntityId(){const n=this._viewportSelections[this.activeViewportTab];return n.size===0?null:[...n].at(-1)}get selectedEntityIds(){return this._viewportSelections[this.activeViewportTab]}get canUndo(){return this._history?.getSnapshot().canUndo??!1}get canRedo(){return this._history?.getSnapshot().canRedo??!1}notifyIngestEdit(){this._notify()}get playState(){return this._playState}_blockedDuringPlay(n){return this._playState==="stopped"?!1:(console.warn(`EditorStore: "${n}" is disabled during play mode — stop the game first.`),!0)}setPlayState(n){const s=this._playState!=="stopped";this._playState=n,n==="stopped"&&s&&this._onPlayStopped(),this._notify()}get playEditRegime(){return this._playEditRegime}setPlayEditRegime(n){this._playEditRegime=n,this._notify()}get activeViewportTab(){return this._followsWorkspaceFocus&&e_()===a0?"play":"edit"}select(n,s="immediate"){const c=this._viewportSelections[this.activeViewportTab];c.clear(),n&&c.add(n),s==="deferred"?this._notifyDeferred("selection"):this._notify("selection")}selectMultiple(n,s="immediate"){this._viewportSelections[this.activeViewportTab]=new Set(n),s==="deferred"?this._notifyDeferred("selection"):this._notify("selection")}applySelectionBeforePresentation(n){this._viewportSelections[this.activeViewportTab]=new Set(n);let s=!1;return()=>{s||(s=!0,this._notify("selection"))}}addToSelection(n){this._viewportSelections[this.activeViewportTab].add(n),this._notify("selection")}toggleSelection(n){const s=this._viewportSelections[this.activeViewportTab];s.has(n)?s.delete(n):s.add(n),this._notify("selection")}_beforeNotify(){}_onHistoryAttached(){}_onPlayStopped(){}}class Isn{constructor(n){this.history=n,this.snapshot=this.buildSnapshot(),this.unsubscribeHistory=n.subscribe(this.notify)}tail=Promise.resolve();listeners=new Set;pending=0;version=0;disposed=!1;idleWaiters=new Set;unsubscribeHistory;snapshot;subscribe=n=>this.disposed?()=>{}:(this.listeners.add(n),()=>this.listeners.delete(n));getSnapshot=()=>this.snapshot;undo(){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.undo()))}redo(){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.redo()))}jumpTo(n){return this.enqueue(async()=>(await this.waitForServiceIdle(),this.assertNotDisposed(),this.history.jumpTo(n)))}get canUndo(){return this.snapshot.canUndo}get canRedo(){return this.snapshot.canRedo}dispose(){if(this.disposed)return;this.disposed=!0,this.unsubscribeHistory();const n=new Error("History commands are disposed.");for(const s of this.idleWaiters)s.unsubscribe(),s.reject(n);this.idleWaiters.clear(),this.listeners.clear(),this.notify()}enqueue(n){if(this.disposed)return Promise.reject(new Error("History commands are disposed."));this.pending++,this.notify();const s=()=>{if(this.disposed)throw new Error("History commands are disposed.");return n()},c=this.tail.then(s,s);return this.tail=c.then(()=>{},()=>{}),c.finally(()=>{this.pending--,this.notify()})}assertNotDisposed(){if(this.disposed)throw new Error("History commands are disposed.")}waitForServiceIdle(){return this.disposed?Promise.reject(new Error("History commands are disposed.")):this.history.getSnapshot().busy?new Promise((n,s)=>{const c={unsubscribe:()=>{},reject:s},d=()=>{c.unsubscribe(),this.idleWaiters.delete(c)};c.unsubscribe=this.history.subscribe(()=>{this.history.getSnapshot().busy||(d(),n())}),this.idleWaiters.add(c)}):Promise.resolve()}notify=()=>{this.version++,this.snapshot=this.buildSnapshot();for(const n of this.listeners)n()};buildSnapshot(){const n=this.history.getSnapshot(),s=this.pending>0||n.busy;return{version:this.version,busy:s,canUndo:!this.disposed&&!s&&n.canUndo,canRedo:!this.disposed&&!s&&n.canRedo,undoLabel:n.undoLabel,redoLabel:n.redoLabel}}}function Nsn(t){let n=t.getSnapshot().limitWarning,s=t.getSnapshot().lastEviction;return t.subscribe(()=>{const{limitWarning:c,lastEviction:d}=t.getSnapshot();c!==n&&(n=c,c&&(i0(c.message),ea.warn(c.message,"history"))),d!==s&&(s=d,d&&ea.warn(d.message,"history"))})}class Osn{constructor(n,s={}){this.projectIdentity=n,this.history=new gDr(s),this.historyCommands=new Isn(this.history),this.releaseLimitNotices=Nsn(this.history)}history;historyCommands;releaseLimitNotices;dispose(){this.releaseLimitNotices(),this.historyCommands.dispose(),this.history.dispose()}}function Rsn(){return X9t}let X9t=Promise.resolve();function Y9t(){const t=Fsn();return X9t=t.then(()=>{},()=>{}),t}async function Fsn(){await Z9t()}async function Z9t(){const t=of();if(t){ea.log(`Opened project: ${t.config.name}`,"project");return}try{const n=await yFt();n&&ea.log(`Opened project: ${n.config.name}`,"project")}catch{}}const Q9t=Object.freeze(Object.defineProperty({__proto__:null,bootstrapProject:Y9t,initProject:Z9t,projectBootstrapSettled:Rsn},Symbol.toStringTag,{value:"Module"}));function mOe(t){return Promise.reject(new Error(`This editor tier cannot ${t}.`))}const eMt={openPersistence:()=>mOe("persist Asset Lab documents"),replaceSource:()=>mOe("write project source"),saveThumbnailFraming:()=>mOe("write project thumbnail framing")};let gme=eMt;function Msn(t){if(gme!==t){if(gme!==eMt)throw new Error("An Object3D document write policy is already installed.");gme=t}}function jsn(){return gme}function Lsn(){let t=0;const n=async()=>{const c=++t,d=of();if(d)try{const m=await jze();if(m.status!=="project"||m.project.path!==d.rootPath)return;const g=m.project.config;if(c!==t||of()!==d)return;cLe({...d,config:g})}catch(m){c===t&&of()===d&&console.error("[project] Could not refresh project declarations:",m)}},s=oen(()=>void n());return()=>{t++,s()}}function Bsn(){return Ivr(()=>{mVe(),v3r(null),Lwr(),Mnn(),uTr(),O3t(),mtn(),oD()})}async function $sn(){typeof performance<"u"&&performance.getEntriesByType("navigation").length>0&&await Promise.race([Nye(),new Promise(n=>setTimeout(n,5e3))]),await mN()}function qsn(){$sn();const t=Rw(()=>void mN()),n=fFt(()=>void mN());return()=>{t(),n()}}const zsn={tools:[],contributions:[],loadErrors:[]};let tMt=zsn,rMt=0;const cje=new Set;function Wxt(t){tMt=t,rMt++;for(const n of cje)n()}function N$(){return tMt}function Vsn(){return rMt}function nMt(t){return cje.add(t),()=>cje.delete(t)}async function WZ(){try{const t=await fetch("/__editor/project-tools"),n=await L_(t,"Catalog request failed");return Wxt(n),n}catch(t){const n={tools:[],contributions:[],loadErrors:[{sourcePath:"package.json#volter.tools",message:t instanceof Error?t.message:String(t)}]};return Wxt(n),n}}async function Usn(t,n,s={}){const c=await fetch("/__editor/project-tools/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,input:n,confirm:s.confirm===!0})}),d=await L_(c,`Running the project tool ${JSON.stringify(t)} failed`);if(!d||typeof d!="object"||typeof d.ok!="boolean")throw new Error(`Tool request returned an invalid response (${c.status}).`);return d}function Jsn(){WZ();const t=Rw(()=>void WZ()),n=fFt(()=>void WZ());return()=>{t(),n()}}const Uge=new Map;function Wsn(t,n){if(n===null){Uge.delete(t);return}Uge.set(t,n),Hsn()}const Hxt=128;let mZ=[],HZ=null,iMt=0,yme=!1;function Hsn(){if(yme)return()=>{};if(typeof PerformanceObserver>"u")return()=>{};let t;try{t=new PerformanceObserver(n=>{for(const s of n.getEntries()){const c=s.duration;(HZ===null||c>HZ)&&(HZ=c),c>=100&&(iMt+=1),mZ.push({start:s.startTime,duration:c}),mZ.length>Hxt&&(mZ=mZ.slice(-Hxt))}}),t.observe({type:"longtask",buffered:!0})}catch{return()=>{}}return yme=!0,()=>{t.disconnect(),yme=!1}}function Gsn(){return yme?{longestTaskMs:HZ===null?null:Math.round(HZ),tasksOver100ms:iMt}:null}function Ksn(t=performance.now()){if(Uge.size===0)return null;const n={};for(const[s,c]of Uge){const d=c(),m=d.lastCallWindow;let g=null;if(m!==null){const S=m.end??t;for(const k of mZ)k.start+k.duration<m.start||k.start>S||(g===null||k.duration>g)&&(g=k.duration)}n[s]={inFlightMs:d.inFlightMs,lastCallMs:d.lastCallMs,maxCallMs:d.maxCallMs,callsOver5s:d.callsOver5s,callsOver30s:d.callsOver30s,lastCallLongestTaskMs:g===null?null:Math.round(g),wasmMemoryMB:d.wasmMemoryMB}}return n}function Gxt(t){return!("unavailable"in t)}function Xsn(t=globalThis.performance){const n=t?.memory;return!n||typeof n.usedJSHeapSize!="number"||typeof n.totalJSHeapSize!="number"?{unavailable:"performance.memory is unavailable — it is a non-standard Chromium-only API, not exposed by this browser."}:{usedBytes:n.usedJSHeapSize,totalBytes:n.totalJSHeapSize,limitBytes:typeof n.jsHeapSizeLimit=="number"?n.jsHeapSizeLimit:null}}const Ysn=5e3,Zsn=4,Qsn=1024*1024;function hOe(t){return Math.round(t/Qsn*100)/100}function ean(t){const n=t.heap(),s=t.canvases(),c=t.rendererCounts(),d=t.workerCalls?.()??null,m=t.stalls?.()??null;let g=0;for(const S of s)g+=S.width*S.height*Zsn;return{heapUsedMB:Gxt(n)?hOe(n.usedBytes):null,heapLimitMB:Gxt(n)&&n.limitBytes!==null?hOe(n.limitBytes):null,mountEpochs:t.mountEpochs(),canvases:s.length,canvasMB:hOe(g),...d===null?{}:{workerCalls:d},...m===null?{}:{stalls:m},...c===null?{}:{textures:c.textures,geometries:c.geometries,...c.programs===null?{}:{programs:c.programs}}}}function tan(t){const n=new Set;for(const s of t)try{const c=new URL(s.name,"http://volter.invalid").searchParams.get(Pge);c!==null&&c.length>0&&n.add(c)}catch{}return n.size}function ran(){return{heap:()=>Xsn(),mountEpochs:()=>tan(performance.getEntriesByType("resource")),canvases:()=>[...document.querySelectorAll("canvas")],rendererCounts:()=>Gwr()?.memorySnapshot?.().counts??null,workerCalls:()=>Ksn(),stalls:()=>Gsn()}}let oMt=null;function zSn(){return oMt}function nan(t){const n=t.sources??ran(),s=t.hidden??(()=>document.visibilityState==="hidden"),c=()=>{if(s())return;const m=ean(n);oMt=m,t.report(m)};c();const d=setInterval(c,t.intervalMs??Ysn);return()=>clearInterval(d)}function ian({children:t}){const n=Ye.useRef(null);n.current||(n.current=new Psn({followsWorkspaceFocus:!0}),HZr(n.current));const s=Ye.useRef(null);if(!s.current){const g=of();s.current=new Osn(g?.rootPath??"unknown-project")}n.current.attachHistory(s.current.history),Msn(ODr);const c=Ye.useRef(null);c.current||(c.current={fps:0,frameTime:0,drawCalls:0,triangles:0,cameraPosition:{x:0,y:0,z:0},cameraTarget:{x:0,y:0,z:0}});const d=Ye.useRef(null);d.current||(d.current=Y9t()),Ye.useEffect(()=>Tsn(n.current,s.current.historyCommands),[]),Ye.useEffect(()=>qsn(),[]),Ye.useEffect(()=>Jsn(),[]),Ye.useEffect(()=>Zen(),[]),Ye.useEffect(()=>Lsn(),[]),Ye.useEffect(()=>Bsn(),[]),Ye.useEffect(()=>Dtn(),[]),Ye.useEffect(()=>nan({report:pZr}),[]);const m=Ye.useRef(!1);return Ye.useEffect(()=>{m.current=!0;const g=s.current;return()=>{m.current=!1,queueMicrotask(()=>{m.current||g.dispose()})}},[]),$.jsx(Esn,{runtime:{store:n.current,stats:c.current,initPromise:d.current,session:s.current},children:t})}const Jge={x:0,y:0,zoom:1};function VSn(t=Jge){let n=t;const s=new Set,c=()=>{for(const d of s)d()};return{get:()=>n,setView:(d,m,g)=>{const S=Math.min(4,Math.max(.1,g));n.x===d&&n.y===m&&n.zoom===S||(n={x:d,y:m,zoom:S},c())},setPan:(d,m)=>{const g=n.zoom;n.x===d&&n.y===m||(n={x:d,y:m,zoom:g},c())},setZoom:d=>{const m=Math.min(4,Math.max(.1,d));n.zoom!==m&&(n={x:n.x,y:n.y,zoom:m},c())},reset:()=>{n.x===0&&n.y===0&&n.zoom===1||(n=Jge,c())},subscribe:d=>(s.add(d),()=>s.delete(d))}}let r2=Jge;const lje=new Set,USn={get:()=>oan(),setView:(t,n,s)=>NVe(t,n,s),setPan:(t,n)=>aMt(t,n),setZoom:t=>san(t),reset:()=>cMt(),subscribe:t=>aan(t)};function sMt(){for(const t of lje)t()}function oan(){return r2}function NVe(t,n,s){const c=Math.min(4,Math.max(.1,s));r2.x===t&&r2.y===n&&r2.zoom===c||(r2={x:t,y:n,zoom:c},sMt())}function aMt(t,n){NVe(t,n,r2.zoom)}function san(t){NVe(r2.x,r2.y,t)}function JSn(t,n){aMt(r2.x+t,r2.y+n)}function cMt(){r2.x===0&&r2.y===0&&r2.zoom===1||(r2=Jge,sMt())}function aan(t){return lje.add(t),()=>lje.delete(t)}function WSn(t){if(!(t.x===0&&t.y===0&&t.zoom===1))return t.zoom===1?`translate(${t.x}px, ${t.y}px)`:t.x===0&&t.y===0?`scale(${t.zoom})`:`translate(${t.x}px, ${t.y}px) scale(${t.zoom})`}const can=new Set(["opacity","zIndex","flexGrow","flexShrink","fontWeight","lineHeight"]);function lan(t){if(typeof t=="number")return t;if(typeof t!="string"||t==="")return;const n=Number.parseFloat(t);return Number.isNaN(n)?void 0:n}function HSn(t,n){if(typeof t!="number"||typeof n!="string")return t;const s=n.trim().match(/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?([a-z]+|%)$/i)?.[1];return s&&s.toLowerCase()!=="px"?`${t}${s}`:t}function GSn(t,n){return typeof n!="number"?n:n===0||can.has(t)?String(n):`${n}px`}const uan={hidden:!1,interactive:!1,pickLock:!1},lMt=new Map;function uve(t){return lMt.get(t)??uan}function OVe(t,n){lMt.set(t,{...uve(t),...n})}function oq(t){return uve(t).hidden}function fan(t,n){OVe(t,{hidden:n})}function dan(t){fan(t,!oq(t))}function uMt(t){return uve(t).interactive}function pan(t,n){OVe(t,{interactive:n})}function _an(t){pan(t,!uMt(t))}function fMt(t){return uve(t).pickLock}function man(t,n){OVe(t,{pickLock:n})}function han(t){man(t,!fMt(t))}const Kxt=8,wN=8,KSn=[{pos:"nw",cursor:"nwse-resize"},{pos:"n",cursor:"ns-resize"},{pos:"ne",cursor:"nesw-resize"},{pos:"w",cursor:"ew-resize"},{pos:"e",cursor:"ew-resize"},{pos:"sw",cursor:"nesw-resize"},{pos:"s",cursor:"ns-resize"},{pos:"se",cursor:"nwse-resize"}];function XSn(t,n){const s=t.x+t.width/2,c=t.y+t.height/2;switch(n){case"nw":return{x:t.x,y:t.y};case"n":return{x:s,y:t.y};case"ne":return{x:t.x+t.width,y:t.y};case"w":return{x:t.x,y:c};case"e":return{x:t.x+t.width,y:c};case"sw":return{x:t.x,y:t.y+t.height};case"s":return{x:s,y:t.y+t.height};case"se":return{x:t.x+t.width,y:t.y+t.height}}}function iA(t,n){return n?Math.round(t):Math.round(t/Kxt)*Kxt}function dMt(t,n,s,c,d){let m=Math.max(wN,iA(n.width+t,s)),g=null;return c.length&&(g=pve(n.x+m,c,d),g&&(m=Math.max(wN,g.edge-n.x))),{value:m,match:g}}function pMt(t,n,s,c,d){const m=n.x+n.width;let g=Math.max(wN,iA(n.width-t,s)),S=null;return c.length&&(S=pve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,eastEdge:m,match:S}}function _Mt(t,n,s,c,d){let m=Math.max(wN,iA(n.height+t,s)),g=null;return c.length&&(g=pve(n.y+m,c,d),g&&(m=Math.max(wN,g.edge-n.y))),{value:m,match:g}}function mMt(t,n,s,c,d){const m=n.y+n.height;let g=Math.max(wN,iA(n.height-t,s)),S=null;return c.length&&(S=pve(m-g,c,d),S&&(g=Math.max(wN,m-S.edge))),{value:g,southEdge:m,match:S}}function gan(t,n,s,c,d,m,g){if(t==="e"||t==="ne"||t==="se")return{width:dMt(n,s,d,m,g).value};if(t==="w"||t==="nw"||t==="sw"){const{value:S,eastEdge:k}=pMt(n,s,d,m,g);return c?{width:S,x:k-S}:{width:S}}return{}}function yan(t,n,s,c,d,m,g){if(t==="s"||t==="sw"||t==="se")return{height:_Mt(n,s,d,m,g).value};if(t==="n"||t==="nw"||t==="ne"){const{value:S,southEdge:k}=mMt(n,s,d,m,g);return c?{height:S,y:k-S}:{height:S}}return{}}function YSn(t,n,s,c,d,m,g,S=TR){const k=!m&&g?ate(g):null,A=k?fve(k):[],F=k?dve(k):[];return{...gan(t,n,c,d,m,A,S),...yan(t,s,c,d,m,F,S)}}const TR=4;function ate(t){return{paddingBox:t.paddingBox??{x:0,y:0,width:0,height:0},siblingRects:(t.siblings??[]).filter(n=>n.width>0&&n.height>0),guideX:t.guideEdges?.x??[],guideY:t.guideEdges?.y??[]}}function fve(t){const n=[{edge:t.paddingBox.x,rect:t.paddingBox},{edge:t.paddingBox.x+t.paddingBox.width,rect:t.paddingBox}];for(const s of t.siblingRects)n.push({edge:s.x,rect:s}),n.push({edge:s.x+s.width,rect:s});for(const s of t.guideX??[])n.push({edge:s,rect:{x:s,y:-1e5,width:0,height:2e5}});return n}function dve(t){const n=[{edge:t.paddingBox.y,rect:t.paddingBox},{edge:t.paddingBox.y+t.paddingBox.height,rect:t.paddingBox}];for(const s of t.siblingRects)n.push({edge:s.y,rect:s}),n.push({edge:s.y+s.height,rect:s});for(const s of t.guideY??[])n.push({edge:s,rect:{x:-1e5,y:s,width:2e5,height:0}});return n}function tee(t,n,s,c){let d=t,m=c,g=null;for(const S of s){const k=Math.abs(t-S.edge);k<=m&&(m=k,d=S.edge,g=S);const A=Math.abs(t+n-S.edge);A<=m&&(m=A,d=S.edge-n,g=S)}return{value:d,match:g}}function pve(t,n,s){let c=null,d=s;for(const m of n){const g=Math.abs(t-m.edge);g<=d&&(d=g,c=m)}return c}function ZSn(t,n,s,c,d){let m=iA(s.x+t,c),g=iA(s.y+n,c);if(!c&&d){const S=ate(d);m=tee(m,s.width,fve(S),TR).value,g=tee(g,s.height,dve(S),TR).value}return{x:m,y:g}}function QSn(t,n,s,c,d,m=TR){if(s)return{guides:[],position:t};let g=null,S=m;for(const pe of d?.snapPoints??[]){const ue=Math.hypot(t.x-pe.x,t.y-pe.y);ue<=S&&(S=ue,g=pe)}if(g)return{guides:ree({x:g.x,y:g.y,width:0,height:0},{edge:g.x,rect:n},{edge:g.y,rect:n}),position:g};if(d?.bounded)return{guides:[],position:t};const k=iA(t.x,!1),A=iA(t.y,!1),F=[n,c?.parent,c?.paddingBox,...c?.siblings??[]].filter(pe=>!!pe&&pe.width>0&&pe.height>0);let D=null,J=null,q=m,G=m;for(const pe of F){for(const ue of[pe.x,pe.x+pe.width/2,pe.x+pe.width]){const Ce=Math.abs(k-ue);Ce<=q&&(q=Ce,D={edge:ue,rect:pe})}for(const ue of[pe.y,pe.y+pe.height/2,pe.y+pe.height]){const Ce=Math.abs(A-ue);Ce<=G&&(G=Ce,J={edge:ue,rect:pe})}}const se={x:D?.edge??k,y:J?.edge??A};return{guides:ree({x:se.x,y:se.y,width:0,height:0},D,J),position:se}}function ree(t,n,s){const c=[];return n&&c.push({orientation:"vertical",at:n.edge,start:Math.min(t.y,n.rect.y),end:Math.max(t.y+t.height,n.rect.y+n.rect.height)}),s&&c.push({orientation:"horizontal",at:s.edge,start:Math.min(t.x,s.rect.x),end:Math.max(t.x+t.width,s.rect.x+s.rect.width)}),c}function exn(t,n,s,c,d,m=TR){if(c||!d)return[];const g=iA(s.x+t,!1),S=iA(s.y+n,!1),k=ate(d),A=tee(g,s.width,fve(k),m).match,F=tee(S,s.height,dve(k),m).match,D={x:g,y:S,width:s.width,height:s.height};return ree(D,A,F)}function txn(t,n,s,c,d="both",m=!1,g=TR,S={},k=ban){if(m)return{position:t,guides:[]};const A={x:s.x+t.x-n.x,y:s.y+t.y-n.y,width:s.width,height:s.height},F=[],D=[],J=(pe,ue,Ce)=>{F.push({edge:pe.x,rect:pe},{edge:pe.x+pe.width,rect:pe}),D.push({edge:pe.y,rect:pe},{edge:pe.y+pe.height,rect:pe}),F.push({edge:pe.x+pe.width/2,rect:pe}),D.push({edge:pe.y+pe.height/2,rect:pe})};if(c){const pe=ate(c);if(k.parent&&pe.paddingBox.width>0&&pe.paddingBox.height>0&&J(pe.paddingBox),k.others)for(const ue of pe.siblingRects)J(ue)}if(k.guides){for(const pe of[...c?.guideEdges?.x??[],...S.x??[]])F.push({edge:pe,rect:{x:pe,y:A.y,width:0,height:A.height}});for(const pe of[...c?.guideEdges?.y??[],...S.y??[]])D.push({edge:pe,rect:{x:A.x,y:pe,width:A.width,height:0}})}if(F.length===0&&D.length===0)return{position:t,guides:[]};const q=d==="y"?{value:A.x,match:null}:Xxt(A.x,A.width,F,g),G=d==="x"?{value:A.y,match:null}:Xxt(A.y,A.height,D,g),se={...A,x:q.value,y:G.value};return{position:{x:t.x+se.x-A.x,y:t.y+se.y-A.y},guides:ree(se,q.match,G.match)}}function van(t,n,s,c,d){const m=n.tr.x-n.tl.x,g=n.tr.y-n.tl.y,S=n.bl.x-n.tl.x,k=n.bl.y-n.tl.y,A=m*k-g*S;if(Math.abs(A)<1e-9)return t;const F=t.x-n.tl.x,D=t.y-n.tl.y,J=[...s?[0,1]:[],...c?[.5]:[]],q=(pe,ue)=>{let Ce=pe,Fe=d;for(const De of J){const be=Math.abs(pe-De)*ue;be<=Fe&&(Fe=be,Ce=De)}return Ce},G=q((F*k-D*S)/A,Math.hypot(m,g)),se=q((m*D-g*F)/A,Math.hypot(S,k));return{x:n.tl.x+G*m+se*S,y:n.tl.y+G*g+se*k}}function rxn(t,n,s){const{smart:c,grid:d}=s;let m=t;return n&&c.enabled!==s.invert&&(c.sides||c.center)&&(m=van(t,n,c.sides,c.center,s.threshold)),n&&Math.abs(Pan(n))>1e-6?m:(!(Math.hypot(m.x-t.x,m.y-t.y)>1e-9)&&s.gridOn&&d.step>0&&(m={x:Math.round((m.x-d.offsetX)/d.step)*d.step+d.offsetX,y:Math.round((m.y-d.offsetY)/d.step)*d.step+d.offsetY}),d.pixel?{x:Math.round(m.x),y:Math.round(m.y)}:m)}function nxn(t){return{tl:{x:t.x,y:t.y},tr:{x:t.x+t.width,y:t.y},br:{x:t.x+t.width,y:t.y+t.height},bl:{x:t.x,y:t.y+t.height}}}const ban={parent:!0,others:!0,guides:!0};function Xxt(t,n,s,c){const d=tee(t,n,s,c);let m=d.value,g=d.match,S=g?Math.abs(m-t):c;for(const k of s){const A=Math.abs(t+n/2-k.edge);A<S&&(S=A,m=k.edge-n/2,g=k)}return{value:m,match:g}}function ixn(t,n,s,c,d,m,g=TR){if(d||!m)return[];const S=t==="e"||t==="ne"||t==="se",k=t==="w"||t==="nw"||t==="sw",A=t==="s"||t==="sw"||t==="se",F=t==="n"||t==="nw"||t==="ne",D=ate(m),J=fve(D),q=dve(D);let G=null;S?G=dMt(n,c,!1,J,g).match:k&&(G=pMt(n,c,!1,J,g).match);let se=null;return A?se=_Mt(s,c,!1,q,g).match:F&&(se=mMt(s,c,!1,q,g).match),ree(c,G,se)}function oxn(t,n,s,c,d=15){const m=F=>F*180/Math.PI,g=m(Math.atan2(n.y-t.y,n.x-t.x)),k=m(Math.atan2(s.y-t.y,s.x-t.x))-g;return{rotate:c?k:Math.round(k/d)*d}}function RN(t,n){if(t instanceof hy){const s=t.ownerOf(n);return s?t.childAdapters().find(c=>c.worldId===s)?.adapter??null:null}return t}const Yxt=new WeakMap;function San(t){const n=t.boxEdit;if(!n)return null;const s=Yxt.get(t);if(s?.provider===n)return s.recorded;const c={begin:d=>Pg({adapter:t,seam:"editor.boxEdit.begin",stage:"effect",detail:`the world overlay began a box edit for ${d}`,run:()=>n.begin(d)}),apply:(d,m)=>Pg({adapter:t,seam:"editor.boxEdit.apply",stage:"effect",detail:`the world overlay applied a ${Object.keys(m).join(", ")} box patch to ${d}`,run:()=>n.apply(d,m)}),end:d=>Pg({adapter:t,seam:"editor.boxEdit.end",stage:"effect",detail:`the world overlay ended a box edit for ${d}`,run:()=>n.end(d)}),...n.gizmoOrigin?{gizmoOrigin:d=>Pg({adapter:t,seam:"editor.boxEdit.gizmoOrigin",stage:"operation",detail:`the world overlay read the native gizmo origin for ${d}`,run:()=>n.gizmoOrigin?.(d)??null})}:{},...n.referencePoint?{referencePoint:d=>Pg({adapter:t,seam:"editor.boxEdit.referencePoint",stage:"operation",detail:`the world overlay read the native reference point for ${d}`,run:()=>n.referencePoint?.(d)??null})}:{}};return Yxt.set(t,{provider:n,recorded:c}),c}function xan(t,n){return RN(t,n)?.rects?.rect(n)??null}function wan(t,n){const s=RN(t,n);return s?San(s):null}function sxn(t,n){return RN(t,n)?.rects?.contextRects?.(n)}function axn(t,n){return RN(t,n)?.structure??null}function cxn(t,n){return RN(t,n)?.text??null}function lxn(t,n){return RN(t,n)?.colorSample??null}function uxn(t,n){const s=RN(t,n);return s?.rects?A3r(s):null}function fxn(t){const n=t instanceof hy?t.childAdapters():[{worldId:"",adapter:t}],s=[];for(const{worldId:c,adapter:d}of n)d.rects?.emptyContainers&&(c&&oq(c)||s.push(...d.rects.emptyContainers()));return s}function Tan(t,n){const s=c=>{const d=t.inspector?.get(n,`style.${c}`);return lan(d)??0};return{paddingTop:s("paddingTop"),paddingRight:s("paddingRight"),paddingBottom:s("paddingBottom"),paddingLeft:s("paddingLeft"),marginTop:s("marginTop"),marginRight:s("marginRight"),marginBottom:s("marginBottom"),marginLeft:s("marginLeft")}}const Can=4;function dxn(t,n){const s=D=>D>0?D:Can,c=s(n.paddingTop),d=s(n.paddingRight),m=s(n.paddingBottom),g=s(n.paddingLeft),S=s(n.marginTop),k=s(n.marginRight),A=s(n.marginBottom),F=s(n.marginLeft);return[{side:"paddingTop",kind:"padding",x:t.x,y:t.y,width:t.width,height:c,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+c/2,value:n.paddingTop,isZero:n.paddingTop===0},{side:"paddingBottom",kind:"padding",x:t.x,y:t.y+t.height-m,width:t.width,height:m,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+t.height-m/2,value:n.paddingBottom,isZero:n.paddingBottom===0},{side:"paddingLeft",kind:"padding",x:t.x,y:t.y,width:g,height:t.height,cursor:"ew-resize",labelX:t.x+g/2,labelY:t.y+t.height/2,value:n.paddingLeft,isZero:n.paddingLeft===0},{side:"paddingRight",kind:"padding",x:t.x+t.width-d,y:t.y,width:d,height:t.height,cursor:"ew-resize",labelX:t.x+t.width-d/2,labelY:t.y+t.height/2,value:n.paddingRight,isZero:n.paddingRight===0},{side:"marginTop",kind:"margin",x:t.x,y:t.y-S,width:t.width,height:S,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y-S/2,value:n.marginTop,isZero:n.marginTop===0},{side:"marginBottom",kind:"margin",x:t.x,y:t.y+t.height,width:t.width,height:A,cursor:"ns-resize",labelX:t.x+t.width/2,labelY:t.y+t.height+A/2,value:n.marginBottom,isZero:n.marginBottom===0},{side:"marginLeft",kind:"margin",x:t.x-F,y:t.y,width:F,height:t.height,cursor:"ew-resize",labelX:t.x-F/2,labelY:t.y+t.height/2,value:n.marginLeft,isZero:n.marginLeft===0},{side:"marginRight",kind:"margin",x:t.x+t.width,y:t.y,width:k,height:t.height,cursor:"ew-resize",labelX:t.x+t.width+k/2,labelY:t.y+t.height/2,value:n.marginRight,isZero:n.marginRight===0}]}function Ean(t,n,s){switch(t){case"paddingTop":return s;case"paddingBottom":return-s;case"paddingLeft":return n;case"paddingRight":return-n;case"marginTop":return-s;case"marginBottom":return s;case"marginLeft":return-n;case"marginRight":return n}}function pxn(t,n,s,c){const d=Ean(t,n,s),m=Math.max(0,Math.round(c+d));return{[t]:m}}function _xn(t,n,s){return{x:t.x+n,y:t.y+s,width:t.width,height:t.height}}const gOe=3;function SO(t,n){return n==="x"?t.x+t.width/2:t.y+t.height/2}function kan(t,n,s){if(n===0){const m=t[0].rect;return s?m.x:m.y}if(n===t.length){const m=t[t.length-1].rect;return s?m.x+m.width:m.y+m.height}const c=t[n-1].rect,d=t[n].rect;return s?(c.x+c.width+d.x)/2:(c.y+c.height+d.y)/2}function Aan(t,n,s){const c=Math.min(...t.map(g=>s?g.rect.y:g.rect.x)),d=Math.max(...t.map(g=>s?g.rect.y+g.rect.height:g.rect.x+g.rect.width)),m=gOe/2;return s?{x:n-m,y:c,width:gOe,height:d-c}:{x:c,y:n-m,width:d-c,height:gOe}}function mxn(t,n){if(t.length===0)return null;const s=Math.max(...t.map(J=>SO(J.rect,"x")))-Math.min(...t.map(J=>SO(J.rect,"x"))),c=Math.max(...t.map(J=>SO(J.rect,"y")))-Math.min(...t.map(J=>SO(J.rect,"y"))),d=s>=c,m=d?"x":"y",g=[...t].sort((J,q)=>SO(J.rect,m)-SO(q.rect,m)),S=d?n.x:n.y;let k=0;for(;k<g.length&&SO(g[k].rect,m)<S;)k++;const A=k<g.length?g[k].id:null,F=kan(g,k,d),D=Aan(g,F,d);return{beforeSiblingId:A,index:k,marker:D}}function hxn(t,n){const s=t.hierarchy.node(n);if(!s)return null;if(s.parentId){const c=t.hierarchy.node(s.parentId);return c?c.childIds:null}return t.hierarchy.roots().map(c=>c.id)}function gxn(t,n){const s=t.x,c=t.x+t.width,d=t.y,m=t.y+t.height,g=n.x,S=n.x+n.width,k=n.y,A=n.y+n.height,F=[];let D=null;if(c<=g?D={x1:c,x2:g}:S<=s&&(D={x1:S,x2:s}),D){const q=Math.max(d,k),G=Math.min(m,A),se=G>q?(q+G)/2:((d+m)/2+(k+A)/2)/2;F.push({orientation:"horizontal",x1:D.x1,y1:se,x2:D.x2,y2:se,distance:Math.round(D.x2-D.x1),labelX:(D.x1+D.x2)/2,labelY:se})}let J=null;if(m<=k?J={y1:m,y2:k}:A<=d&&(J={y1:A,y2:d}),J){const q=Math.max(s,g),G=Math.min(c,S),se=G>q?(q+G)/2:((s+c)/2+(g+S)/2)/2;F.push({orientation:"vertical",x1:se,y1:J.y1,x2:se,y2:J.y2,distance:Math.round(J.y2-J.y1),labelX:se,labelY:(J.y1+J.y2)/2})}return F}function yOe(t,n,s){const c=t?.get(n,s);return typeof c=="string"&&c.length>0?c:null}function yxn(t,n){const s=yOe(t.inspector,n,"style.position");let c=null;const d=t.hierarchy.node(n)?.parentId??null;if(d){const m=yOe(t.inspector,d,"style.display");m==="flex"||m==="inline-flex"?c=`flex ${(yOe(t.inspector,d,"style.flexDirection")??"row").startsWith("column")?"col":"row"}`:m==="grid"||m==="inline-grid"?c="grid":m&&(c=m)}return{position:s,parentLayout:c}}function vxn(t,n){if(t.length<2)return[];const s=t.map(F=>F.rect),c=Math.min(...s.map(F=>F.x)),d=Math.max(...s.map(F=>F.x+F.width)),m=Math.min(...s.map(F=>F.y)),g=Math.max(...s.map(F=>F.y+F.height)),S=(c+d)/2,k=(m+g)/2,A=[];for(const{id:F,rect:D}of t)switch(n){case"left":A.push({id:F,x:c});break;case"hcenter":A.push({id:F,x:S-D.width/2});break;case"right":A.push({id:F,x:d-D.width});break;case"top":A.push({id:F,y:m});break;case"vcenter":A.push({id:F,y:k-D.height/2});break;case"bottom":A.push({id:F,y:g-D.height});break}return A}function bxn(t,n){if(t.length<3)return[];const s=n==="horizontal",c=[...t].sort((D,J)=>s?D.rect.x-J.rect.x:D.rect.y-J.rect.y),d=c[0],m=c[c.length-1],g=s?m.rect.x+m.rect.width-d.rect.x:m.rect.y+m.rect.height-d.rect.y,S=c.reduce((D,J)=>D+(s?J.rect.width:J.rect.height),0),k=(g-S)/(c.length-1);let A=s?d.rect.x:d.rect.y;const F=[];for(const D of c)F.push(s?{id:D.id,x:A}:{id:D.id,y:A}),A+=(s?D.rect.width:D.rect.height)+k;return F}function Sxn(t){if(t.length===0)return null;const n=Math.min(...t.map(m=>m.x)),s=Math.min(...t.map(m=>m.y)),c=Math.max(...t.map(m=>m.x+m.width)),d=Math.max(...t.map(m=>m.y+m.height));return{x:n,y:s,width:c-n,height:d-s}}function Dan(t,n,s,c,d){const m={};return s?(t!==0&&(m.x=c.x+t),n!==0&&(m.y=c.y+n),m):(t!==0&&(m.marginLeft=d.left+t),n!==0&&(m.marginTop=d.top+n),m)}function xxn(t,n){return RN(t,n)?.rects?.frame?.(n)??null}function wxn(t){const n=t.tr.x-t.tl.x,s=t.tr.y-t.tl.y,c=t.bl.x-t.tl.x,d=t.bl.y-t.tl.y,m=Math.max(Math.hypot(n,s),Math.hypot(c,d),1e-9);return Math.abs(s)/m>.001||Math.abs(c)/m>.001}function Pan(t){return Math.atan2(t.tr.y-t.tl.y,t.tr.x-t.tl.x)}function hMt(t,n,s){return{x:t.tl.x+n*(t.tr.x-t.tl.x)+s*(t.bl.x-t.tl.x),y:t.tl.y+n*(t.tr.y-t.tl.y)+s*(t.bl.y-t.tl.y)}}function gMt(t){const n=t.includes("w")?0:t.includes("e")?1:.5,s=t.includes("n")?0:t.includes("s")?1:.5;return{s:n,t:s}}function Txn(t,n,s){if(s.length!==2||t.width===void 0||t.height===void 0||!(n.width>0)||!(n.height>0))return t;const c=Math.max(t.width/n.width,t.height/n.height),d=n.width*c,m=n.height*c;return{...t,width:d,height:m,...s.includes("w")?{x:n.x+n.width-d}:{},...s.includes("n")?{y:n.y+n.height-m}:{}}}function Cxn(t,n){const{s,t:c}=gMt(n);return hMt(t,s,c)}function Zxt(t,n){const s=t.tr.x-t.tl.x,c=t.tr.y-t.tl.y,d=t.bl.x-t.tl.x,m=t.bl.y-t.tl.y,g=s*m-c*d;return Math.abs(g)<1e-12?{s:0,t:0}:{s:(n.x*m-n.y*d)/g,t:(s*n.y-c*n.x)/g}}function Exn(t,n,s,c,d,m=!1){const g=Zxt(t,{x:s,y:c}),S=n.includes("e")?1+g.s:n.includes("w")?1-g.s:1,k=n.includes("s")?1+g.t:n.includes("n")?1-g.t:1,A=Math.max(S,k),F=Math.max(.01,m&&n.length===2?A:S),D=Math.max(.01,m&&n.length===2?A:k),J=gMt(n),q=hMt(t,1-J.s,1-J.t),G=Zxt(t,{x:q.x-d.x,y:q.y-d.y}),se={x:d.x+F*G.s*(t.tr.x-t.tl.x)+D*G.t*(t.bl.x-t.tl.x),y:d.y+F*G.s*(t.tr.y-t.tl.y)+D*G.t*(t.bl.y-t.tl.y)};return{scaleXFactor:F,scaleYFactor:D,originX:d.x+q.x-se.x,originY:d.y+q.y-se.y}}let Qxt=!1;const yMt=new Set(["viewport","hierarchy","inspector","asset-browser","workspace","global"]);let vMt="viewport";const bMt="editorActiveHotkeyScope";function kxn(){const t=document.documentElement.dataset[bMt];return t&&yMt.has(t)?t:vMt}function CR(t){vMt=t,document.documentElement.dataset[bMt]=t}const Ian="data-editor-app-undo";function ewt(t){return t instanceof Element&&t.closest(`[${Ian}]`)!==null}function uje(t){return t instanceof Element?t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable?!0:!!t.closest('[contenteditable]:not([contenteditable="false"])'):!1}function Nan(t){for(const n of t.composedPath()){if(!(n instanceof HTMLElement)||t.type==="focusin"&&n.hasAttribute("data-editor-hotkey-fallback"))continue;const s=n.dataset.editorHotkeyScope;if(s&&yMt.has(s))return s}return null}function twt(t){const n=Nan(t);n&&CR(n)}const vOe=[];function rwt(t){return vOe.push(...t),()=>{for(const n of t){const s=vOe.indexOf(n);s>=0&&vOe.splice(s,1)}}}function Oan(){Qxt||(window.addEventListener("pointerdown",twt,!0),window.addEventListener("focusin",twt,!0),Qxt=!0)}const GZ=new Map;let SMt=0;const fje=new Set;function nwt(){SMt++;for(const t of fje)t()}function Ran(t){return GZ.set(t.id,t),nwt(),()=>{GZ.get(t.id)===t&&(GZ.delete(t.id),nwt())}}function Fan(){return[...GZ.values()]}function Man(){return SMt}function jan(t){return fje.add(t),()=>fje.delete(t)}function RVe(t){const n=GZ.get(t);return!n||n.enabled&&!n.enabled()?!1:(n.run(),!0)}const Tw=["viewport","hierarchy","inspector"];function XL(){return(globalThis.getSelection?.()?.toString()??"").length===0}function BD(t){return Pze(t)}async function FVe(t){const n=BD(t);n.length!==0&&await t0e(Cm(t).adapter,n)}async function MVe(t){const n=BD(t);n.length!==0&&await r0e(Cm(t).adapter,n)}async function jVe(t){const n=Cm(t).adapter,s=BD(t)[0],c=s?n.hierarchy.node(s)?.parentId??null:null;await n0e(n,c)}let iwt=Promise.resolve();function _ve(t){const n=iwt.then(()=>Lan(t));return iwt=n.then(()=>{},()=>{}),n}async function Lan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter,c=s.structure;if(!c)return;const d=n.length===1?s.hierarchy.node(n[0])?.label??"selection":`${n.length} objects`;if(i0(`Duplicating ${d}…`),c.duplicateMany){const m=await mPt(s,n);if(m&&!m.persisted){i0(m.destination);return}}else for(const m of n){const g=await Yye(s,m).ack;if(g&&!g.persisted){i0(g.destination);return}}i0(`Duplicated ${d}`)}async function mve(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter,c=s.structure;if(c)if(c.removeMany)await a$e(s,n);else{const d=new Map(aPt(s).map((g,S)=>[g,S])),m=[...n].sort((g,S)=>(d.get(S)??-1)-(d.get(g)??-1));for(const g of m)await Ohe(s,g)}}async function Ban(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;if(s.structure?.wrap)for(const d of n)await Zye(s,d)}async function $an(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;if(s.structure?.unwrap)for(const d of n)await Qye(s,d)}async function qan(t){const n=BD(t);if(n.length===0)return;const s=Cm(t).adapter;s.structure?.group&&await e0e(s,n).ack}function TI(t,n,s){const c=BD(t);if(c.length===0)return;const d=Cm(t).adapter;for(const m of c){const g=wan(d,m);if(!g)continue;const S=xan(d,m);if(!S)continue;const k=d.inspector?.get(m,"style.position"),A=k==="absolute"||k==="fixed",F=Tan(d,m),D=Dan(n,s,A,S,{left:F.marginLeft,top:F.marginTop});Object.keys(D).length!==0&&(g.begin(m),g.apply(m,D),g.end(m))}}function zan(t){const n=Array.isArray(t)?t:[t];return n.includes("global")?"global":n.length===1&&n[0]==="viewport"?"stage":"panel"}let vme=null;function pp(t,n){const{frameEnabled:s,...c}=n;return vme?.push(Ran({id:t,run:d=>c.action(d??new KeyboardEvent("keydown")),scope:zan(c.scope),...s?{enabled:s}:{}})),OBe(t).map(d=>({...c,...d}))}function xMt(t){const n=()=>{const g=[],S=vme;vme=g;try{return{rows:t(),actions:g}}finally{vme=S}};let s=n(),c=rwt(s.rows);const d=()=>{c();for(const g of s.actions)g()},m=Uye(()=>{d(),s=n(),c=rwt(s.rows)});return()=>{m(),d()}}function Van(t,n){const s=()=>{const m=n.getSnapshot().undoLabel;n.undo().then(g=>{g&&m&&i0(`Undid ${m}`)})},c=()=>{const m=n.getSnapshot().redoLabel;n.redo().then(g=>{g&&m&&i0(`Redid ${m}`)})},d=xMt(()=>[...pp("edit.redo",{scope:"global",allowInEditable:!0,when:m=>!uje(m.target)||ewt(m.target),action:c}),...pp("edit.undo",{scope:"global",allowInEditable:!0,when:m=>!uje(m.target)||ewt(m.target),action:s}),...pp("edit.copy",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void FVe(t)}),...pp("edit.cut",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void MVe(t)}),...pp("edit.paste",{scope:Tw,when:XL,frameEnabled:XL,action:()=>void jVe(t)}),...pp("edit.duplicate",{scope:Tw,action:()=>void _ve(t)}),...pp("edit.group",{scope:Tw,action:()=>void qan(t)}),...pp("edit.wrap",{scope:Tw,action:()=>Ban(t)}),...pp("edit.unwrap",{scope:Tw,action:()=>$an(t)}),...pp("edit.nudgeUp",{scope:"viewport",action:()=>TI(t,0,-1)}),...pp("edit.nudgeUpCoarse",{scope:"viewport",action:()=>TI(t,0,-10)}),...pp("edit.nudgeDown",{scope:"viewport",action:()=>TI(t,0,1)}),...pp("edit.nudgeDownCoarse",{scope:"viewport",action:()=>TI(t,0,10)}),...pp("edit.nudgeLeft",{scope:"viewport",action:()=>TI(t,-1,0)}),...pp("edit.nudgeLeftCoarse",{scope:"viewport",action:()=>TI(t,-10,0)}),...pp("edit.nudgeRight",{scope:"viewport",action:()=>TI(t,1,0)}),...pp("edit.nudgeRightCoarse",{scope:"viewport",action:()=>TI(t,10,0)}),...pp("edit.selectAll",{scope:Tw,action:()=>{const m=Cm(t).adapter;c0(m,aPt(m))}}),...pp("edit.deselectAll",{scope:Tw,action:()=>c0(Cm(t).adapter,[])}),...pp("edit.save",{scope:"global",allowInEditable:!0,action:()=>{gTr().then(m=>{m===null&&ARt(t)})}}),...pp("view.resetPan",{scope:"viewport",action:()=>cMt()}),...pp("edit.enterScope",{scope:Tw,when:()=>t.playState==="stopped",frameEnabled:()=>t.playState==="stopped",action:()=>{L3r(Cm(t).adapter)}}),...pp("edit.delete",{scope:Tw,action:()=>void mve(t)}),...pp("edit.exitScopeOrDeselect",{scope:Tw,when:()=>M3r()!==null||t.playState==="stopped",frameEnabled:()=>!0,action:()=>{const m=Cm(t).adapter;if(!j3r(m)){if(t.playState!=="stopped"){mVe();return}t.select(null)}}}),...pp("view.commandPalette",{scope:"global",action:()=>{SVe()||ea.warn(`The command palette has not handed over its opener yet — run "Volter Editor: Open Workspace" first, or press the workbench's own Show All Commands.`)}}),...pp("view.toggleConsole",{scope:"global",action:()=>ave()}),...pp("view.focusMode",{scope:"global",action:()=>MBe()}),...pp("workspace.cycleNext",{scope:"global",action:()=>{She(1)}}),...pp("workspace.cyclePrevious",{scope:"global",action:()=>{She(-1)}})]);return Oan(),d}function Uan(t){return xMt(()=>t.flatMap(n=>{const s=n.enabled;return pp(n.id,{scope:n.scope==="stage"?"viewport":"global",action:c=>n.run(c),...s?{when:()=>s(),frameEnabled:()=>s()}:{}})}))}function LVe(){nkr("undo-history")}function Jan(){const t=()=>LVe();return window.addEventListener("editor:show-history-tab",t),()=>window.removeEventListener("editor:show-history-tab",t)}let dje=null,wMt=0;const pje=new Set;function BVe(t){if(dje!==t){dje=t,wMt++;for(const n of pje)n()}}function TMt(){return dje}function Wan(t){BVe(t)}function CMt(){BVe(null)}function EMt(t){return pje.add(t),()=>pje.delete(t)}function _je(){return wMt}function Han(){BVe(null)}const Gan=Object.freeze(Object.defineProperty({__proto__:null,__resetEditorPresentationNoticeForTest:Han,clearEditorPresentationNotice:CMt,editorPresentationNotice:TMt,editorPresentationNoticeVersion:_je,showEditorPresentationNotice:Wan,subscribeEditorPresentationNotice:EMt},Symbol.toStringTag,{value:"Module"})),owt="agent-presented-view";function Kan(){const t=Yv();Ye.useSyncExternalStore(EMt,_je,_je);const n=TMt();return Ye.useEffect(()=>{if(!n){xBe(owt);return}s$({id:owt,tone:"info",title:"Agent presented this view.",...n.presented.warnings.length>0?{detail:n.presented.warnings.join(" ")}:{},onDismiss:CMt,actions:[{label:"Copy Link",keeps:!0,run:()=>{Promise.resolve().then(()=>navigator.clipboard.writeText(n.presented.url)).catch(()=>{ea.warn("Could not copy the view link to the clipboard.","editor")})}},{label:"Return",primary:!0,run:()=>{Bge(t,n.previousView,{origin:"return"}).catch(s=>{ea.error(`Could not return to the previous editor view: ${s instanceof Error?s.message:String(s)}`,"editor")})}}]})},[n,t]),null}function Xan(t){Ye.useEffect(()=>{const n=atn(),s=()=>ptn(t.playState!=="stopped");s();const c=t.subscribe(s);return()=>{c(),n(),O3t()}},[t])}const nee={console:{id:"console",title:"Console"},lightExplorer:{id:"light-explorer",title:"Light Explorer"}},Yan={storyActions:{id:"story-actions",title:"Actions"},storyInteractions:{id:"story-interactions",title:"Interactions"},storyAccessibility:{id:"story-accessibility",title:"Accessibility"},generations:{id:"generations",title:"Generations"}};[...Object.values(nee),...Object.values(Yan)];const Zan={info:Go.content.primary,warn:Go.semantic.warning,error:Go.semantic.danger},swt={scene:"#78dce8",physics:"#ff6188",animation:"#a9dc76",network:"#fc9867",audio:"#ab9df2",ai:"#ffd866",input:"#78dce8",core:Go.content.primary},awt={info:R$,warn:WTt,error:NTt};function Qan(){const t=Yv();Ye.useSyncExternalStore(ea.subscribe,ea.getSnapshot);const[n,s]=Ye.useState(""),[c,d]=Ye.useState("all"),[m,g]=Ye.useState({info:!0,warn:!0,error:!0}),S=Ye.useRef(null),[k,A]=Ye.useState(!0),F=ea.getEntries(),D=new Map;for(const Ce of F){const Fe=Ce.metadata?.instanceId;if(typeof Fe!="string"||Fe.length===0)continue;const De=Ce.metadata?.instanceName;D.set(Fe,typeof De=="string"&&De.length>0?De:`Instance ${Fe}`)}const J=F.filter(Ce=>!(!m[Ce.level]||c!=="all"&&Ce.metadata?.instanceId!==c||n&&!Ce.message.toLowerCase().includes(n.toLowerCase())));Ye.useEffect(()=>{k&&S.current&&(S.current.scrollTop=S.current.scrollHeight)},[F.length,k]);const q=()=>{if(!S.current)return;const{scrollTop:Ce,scrollHeight:Fe,clientHeight:De}=S.current;A(Fe-Ce-De<20)},G=Ce=>{g(Fe=>({...Fe,[Ce]:!Fe[Ce]}))},se=Ce=>{const Fe=new Date(Ce);return`${Fe.getHours().toString().padStart(2,"0")}:${Fe.getMinutes().toString().padStart(2,"0")}:${Fe.getSeconds().toString().padStart(2,"0")}`},pe=Ce=>{c0(Y0(t),[Ce]),RVe("viewport.frameSelection")},ue=ea.counts;return $.jsxs(LTr,{className:"volter-console",children:[$.jsxs(n$,{label:"Console filters",compact:!0,children:[$.jsx(dm,{"aria-label":"Clear console",size:"compact",onClick:()=>ea.clear(),title:"Clear console",children:$.jsx(dc,{icon:ATt,size:"xs"})}),$.jsx(Eht,{}),$.jsxs(Iw,{"aria-label":"Filter console by game instance",title:"Show messages from all game instances or one inspected instance",value:c,onChange:Ce=>d(Ce.target.value),style:{width:"auto",minWidth:74,height:24,fontSize:11},children:[$.jsx("option",{value:"all",children:"All instances"}),[...D].map(([Ce,Fe])=>$.jsx("option",{value:Ce,children:Fe},Ce))]}),$.jsx(Eht,{}),["info","warn","error"].map(Ce=>$.jsxs(Ms,{variant:"ghost",size:"compact","aria-label":`Toggle ${Ce} messages`,"aria-pressed":m[Ce],"data-console-level":Ce,onClick:()=>G(Ce),children:[$.jsx(dc,{icon:awt[Ce],size:"xs"}),ue[Ce]]},Ce)),$.jsx(Zm,{placeholder:"Filter...",value:n,onChange:Ce=>s(Ce.target.value),className:"volter-console-filter"})]}),$.jsxs("div",{ref:S,onScroll:q,className:"volter-console-list volter-selectable-text",children:[J.length===0&&$.jsx("div",{className:"volter-console-empty",children:"No messages"}),J.map(Ce=>{const Fe=Ce.metadata?.entityId!=null?String(Ce.metadata.entityId):null,De=(Fe?Y0(t).hierarchy.node(Fe)?.label:null)||Fe,be=typeof Ce.metadata?.instanceId=="string"?Ce.metadata.instanceId:null,X=typeof Ce.metadata?.instanceName=="string"?Ce.metadata.instanceName:be?`Instance ${be}`:null;return $.jsxs("div",{className:"volter-console-row","data-level":Ce.level,style:{color:Zan[Ce.level]},children:[$.jsx("span",{style:{color:Go.content.dim,marginRight:6,flexShrink:0},children:se(Ce.timestamp)}),$.jsx(dc,{icon:awt[Ce.level],style:{fontSize:9,marginTop:4,marginRight:6,flexShrink:0}}),X&&$.jsx("span",{title:be?`Runtime instance ${be}`:void 0,style:{background:Go.accent.muted,color:Go.accent.default,borderRadius:Go.shape.small,padding:"0 4px",fontSize:10,marginRight:6,flexShrink:0},children:X}),Ce.subsystem&&$.jsx("span",{style:{background:`${swt[Ce.subsystem]??Go.content.muted}22`,color:swt[Ce.subsystem]??Go.content.muted,borderRadius:Go.shape.small,padding:"0 4px",fontSize:10,marginRight:6,flexShrink:0},children:Ce.subsystem}),$.jsxs("span",{style:{flex:1,wordBreak:"break-word"},children:[Ce.message,Fe&&$.jsxs("span",{onClick:()=>pe(Fe),style:{background:Go.semantic.successMuted,color:Go.semantic.success,borderRadius:Go.shape.small,padding:"0 5px",fontSize:10,marginLeft:6,cursor:"pointer",pointerEvents:"auto",display:"inline-flex",alignItems:"center",gap:3},title:`Select and focus "${De}"`,children:[$.jsx(dc,{icon:aR,style:{fontSize:8}}),De]}),Ce.source&&$.jsxs("span",{style:{color:Go.content.dim,marginLeft:6},children:["[",Ce.source,"]"]})]}),Ce.count>1&&$.jsx("span",{className:"volter-console-count",children:Ce.count})]},Ce.id)})]})]})}const ecn={enabled:"visible",color:"light.color",intensity:"light.intensity",range:"light.distance",shadows:"shadow.cast"};function kMt(t){const n=[],s=t;return W$(t.hierarchy,c=>{c.kind==="light"&&n.push(c)},{extraChildren:c=>s.internalChildren?.(c)}),n}function Axn(t){return kMt(t).length}function AMt(t,n){return t.find(s=>s.path===ecn[n])??null}function qY(t,n,s,c,d){const m=AMt(s,c);if(!m||!t.inspector)return{supported:!1,writable:!1,value:null};let g;try{g=t.inspector.get(n,m.path)}catch{g=void 0}return{supported:!0,writable:m.readonly!==!0,value:d(g)?g:null}}const cwt=t=>typeof t=="boolean",tcn=t=>typeof t=="string",lwt=t=>typeof t=="number"&&Number.isFinite(t);function rcn(t){return kMt(t).map(n=>{let s=[];try{s=t.inspector?.properties(n.id)??[]}catch{}const c=t.hierarchy.object3D?.(n.id)?.type;return{id:n.id,name:n.label,type:n.typeLabel??c??"Light",enabled:qY(t,n.id,s,"enabled",cwt),color:qY(t,n.id,s,"color",tcn),intensity:qY(t,n.id,s,"intensity",lwt),range:qY(t,n.id,s,"range",lwt),shadows:qY(t,n.id,s,"shadows",cwt)}})}function ncn(t,n,s,c){if(!t.inspector)return 0;let d=0;for(const m of n){let g=null;try{g=AMt(t.inspector.properties(m),s)}catch{continue}!g||g.readonly||(dPt(t,m,g.path,c),d++)}return d}function icn(t,n){return t===null&&n===null?0:t===null?1:n===null?-1:typeof t=="string"&&typeof n=="string"?t.localeCompare(n,void 0,{numeric:!0,sensitivity:"base"}):Number(t)-Number(n)}function uwt(t,n){return n==="name"||n==="type"?t[n]:t[n].value}function zY({label:t,sortKey:n,activeKey:s,direction:c,onSort:d}){const m=n===s;return $.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-light-explorer-sort","aria-label":`Sort lights by ${t}`,onClick:()=>d(n),children:[t,m?$.jsx(dc,{icon:c==="ascending"?E0r:W0r,size:"xs"}):null]})}function hve(){return $.jsx("span",{className:"volter-light-explorer-unavailable",children:"—"})}function ocn({row:t,edit:n}){return t.enabled.supported?$.jsx(TD,{"aria-label":`${t.enabled.value?"Disable":"Enable"} ${t.name}`,checked:t.enabled.value??!1,disabled:!t.enabled.writable,onChange:s=>n("enabled",s.target.checked)}):$.jsx(hve,{})}function scn({row:t,edit:n}){return!t.color.supported||!t.color.value?$.jsx(hve,{}):$.jsxs("div",{className:"volter-light-explorer-color",children:[$.jsx(a4t,{"aria-label":`Color for ${t.name}`,value:t.color.value,disabled:!t.color.writable,onChange:s=>n("color",s.target.value)}),$.jsx("span",{children:t.color.value})]})}function fwt({row:t,field:n,step:s,edit:c}){const d=t[n];return d.supported?$.jsx(SZ,{value:d.value,disabled:!d.writable,precision:2,step:s,onChange:m=>c(n,m)}):$.jsx(hve,{})}function acn({row:t,edit:n}){return t.shadows.supported?$.jsx(TD,{"aria-label":`Toggle shadows for ${t.name}`,checked:t.shadows.value??!1,disabled:!t.shadows.writable,onChange:s=>n("shadows",s.target.checked)}):$.jsx(hve,{})}function ccn({row:t,adapter:n,visibleRows:s,selected:c,selectionAnchor:d,edit:m}){const g=(S,k)=>m(t,S,k);return $.jsxs("tr",{"data-selected":c.has(t.id)||void 0,children:[$.jsx("td",{children:$.jsx(ocn,{row:t,edit:g})}),$.jsx("td",{children:$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-light-explorer-name","aria-pressed":c.has(t.id),onClick:S=>{ucn(n,s,t.id,d.current,S.shiftKey,S.metaKey||S.ctrlKey),S.shiftKey||(d.current=t.id)},children:t.name})}),$.jsx("td",{className:"volter-light-explorer-type",children:t.type}),$.jsx("td",{children:$.jsx(scn,{row:t,edit:g})}),$.jsx("td",{children:$.jsx(fwt,{row:t,field:"intensity",step:.1,edit:g})}),$.jsx("td",{children:$.jsx(fwt,{row:t,field:"range",step:.5,edit:g})}),$.jsx("td",{children:$.jsx(acn,{row:t,edit:g})})]})}function lcn(t,n,s){if(!n.has(t.id))return[t.id];const c=s.filter(d=>n.has(d.id));return c.length>1?c.map(d=>d.id):[t.id]}function ucn(t,n,s,c,d,m){if(!t.selection)return;const g=t.selection.get();if(d&&c){const S=n.findIndex(A=>A.id===c),k=n.findIndex(A=>A.id===s);if(S>=0&&k>=0){const A=n.slice(Math.min(S,k),Math.max(S,k)+1).map(F=>F.id);c0(t,m?[...new Set([...g,...A])]:A,{intent:"exact"});return}}if(m){c0(t,g.includes(s)?g.filter(S=>S!==s):[...g,s],{intent:"exact"});return}c0(t,[s],{intent:"exact"})}function fcn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(Cee,AD,AD);const{adapter:n}=Cm(t),[,s]=Ye.useReducer(De=>De+1,0);Ye.useEffect(()=>n.subscribe?.(s),[n]);const[c,d]=Ye.useState(""),[m,g]=Ye.useState("all"),[S,k]=Ye.useState("name"),[A,F]=Ye.useState("ascending"),D=Ye.useRef(null),J=rcn(n),q=Ye.useMemo(()=>[...new Set(J.map(De=>De.type))].sort((De,be)=>De.localeCompare(be)),[J]),G=c.trim().toLocaleLowerCase(),se=J.filter(De=>(m==="all"||De.type===m)&&(!G||De.name.toLocaleLowerCase().includes(G)||De.type.toLocaleLowerCase().includes(G))).sort((De,be)=>{const X=icn(uwt(De,S),uwt(be,S));return A==="ascending"?X:-X}),pe=new Set(n.selection?.get()??[]),ue=J.filter(De=>pe.has(De.id)).length,Ce=De=>{De===S?F(be=>be==="ascending"?"descending":"ascending"):(k(De),F("ascending"))},Fe=(De,be,X)=>{const we=lcn(De,pe,se);ncn(n,we,be,X)>0&&t.notifyIngestEdit()};return $.jsxs("section",{className:"volter-light-explorer","aria-label":"Light Explorer",children:[$.jsxs("div",{className:"volter-light-explorer-toolbar",children:[$.jsx(Zm,{"aria-label":"Search lights",placeholder:"Search lights…",value:c,onChange:De=>d(De.target.value)}),$.jsxs(Iw,{"aria-label":"Filter lights by type",value:m,onChange:De=>g(De.target.value),children:[$.jsx("option",{value:"all",children:"All types"}),q.map(De=>$.jsx("option",{value:De,children:De},De))]}),$.jsxs("span",{className:"volter-light-explorer-summary",children:[J.length," ",J.length===1?"light":"lights",ue>0?` · ${ue} selected`:""]})]}),J.length===0?$.jsx("div",{className:"volter-light-explorer-empty",children:"The active document does not expose any lights."}):$.jsxs("div",{className:"volter-light-explorer-scroll",children:[$.jsxs("table",{className:"volter-light-explorer-table",children:[$.jsx("thead",{children:$.jsxs("tr",{children:[$.jsx("th",{className:"volter-light-explorer-check-column",scope:"col",children:"On"}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Name",sortKey:"name",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Type",sortKey:"type",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:"Color"}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Intensity",sortKey:"intensity",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Range",sortKey:"range",activeKey:S,direction:A,onSort:Ce})}),$.jsx("th",{scope:"col",children:$.jsx(zY,{label:"Shadows",sortKey:"shadows",activeKey:S,direction:A,onSort:Ce})})]})}),$.jsx("tbody",{children:se.map(De=>$.jsx(ccn,{row:De,adapter:n,visibleRows:se,selected:pe,selectionAnchor:D,edit:Fe},De.id))})]}),se.length===0?$.jsx("div",{className:"volter-light-explorer-empty",children:"No lights match the current filters."}):null]})]})}const dcn=Iye();function pcn(){const{error:t,warn:n}=ea.counts;return t>0?{count:t+n,severity:"error"}:n>0?{count:n,severity:"warn"}:null}function _cn(){dcn.ensure(t=>{t(nFe({...nee.console,order:-100,Content:Qan,badge:pcn,subscribeBadge:ea.subscribe,badgeSnapshot:ea.getSnapshot,visibleByDefault:!1,closeable:!0})),t(nFe({...nee.lightExplorer,order:21,Content:fcn,visibleByDefault:!1,closeable:!0}))})}const mcn=5742335;function DMt(t,n,s){return t<<16|n<<8|s}function dwt(t){const n=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t.trim())?.[1];if(n){const d=n.length===3?[...n].map(m=>`${m}${m}`).join(""):n;return Number.parseInt(d.slice(0,6),16)}const s=/^rgba?\(\s*(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)/i.exec(t.trim());if(!s)return null;const c=s.slice(1,4).map(d=>Math.round(Number(d)));return c.some(d=>d<0||d>255)?null:DMt(c[0],c[1],c[2])}function iee(t){const n=dwt(t);if(n!==null||typeof document>"u")return n;if(typeof CSS<"u"&&!CSS.supports("color",t))return null;const s=document.createElement("canvas").getContext("2d");return s?(s.fillStyle="#010203",s.fillStyle=t,dwt(String(s.fillStyle))):null}function dA(t){return typeof document>"u"?null:t?.closest(`.${DRe}`)??document.querySelector(`.${DRe}`)}function pwt(t){const n=Math.round((t>>16&255)*.42),s=Math.round((t>>8&255)*.42),c=Math.round((t&255)*.42);return DMt(n,s,c)}function Ig(t,n){return t&&typeof getComputedStyle<"u"?getComputedStyle(t).getPropertyValue(n).trim():""}const PMt={"--volter-viewport-background":"--vscode-volter-viewport-background","--volter-viewport-grid":"--vscode-volter-viewport-grid","--volter-viewport-axis-x":"--vscode-volter-viewport-axisX","--volter-viewport-axis-y":"--vscode-volter-viewport-axisY","--volter-viewport-axis-z":"--vscode-volter-viewport-axisZ","--volter-viewport-selection":"--vscode-volter-viewport-selection","--volter-viewport-active":"--vscode-volter-viewport-active","--volter-viewport-wire":"--vscode-volter-viewport-wire","--volter-gizmo-x":"--vscode-volter-gizmo-x","--volter-gizmo-y":"--vscode-volter-gizmo-y","--volter-gizmo-z":"--vscode-volter-gizmo-z","--volter-gizmo-navigation-x":"--vscode-volter-gizmo-navigationX","--volter-gizmo-navigation-y":"--vscode-volter-gizmo-navigationY","--volter-gizmo-navigation-z":"--vscode-volter-gizmo-navigationZ","--volter-gizmo-hover":"--vscode-volter-gizmo-hover","--volter-gizmo-drag":"--vscode-volter-gizmo-drag"};function oee(t,n){const s=PMt[n];return(s?Ig(t,s):"")||Ig(t,n)}function Dxn(t){const n=dA(t),s=oee(n,"--volter-viewport-selection")||Ig(n,"--volter-accent"),c=iee(s||i$.color.accent.default)??mcn,d=iee(oee(n,"--volter-viewport-active")),m=Ig(n,"--volter-viewport-outline-style"),g=Number.parseFloat(Ig(n,"--volter-viewport-outline-width")),S=Ig(n,"--volter-viewport-outline-hidden");return{visible:c,hidden:pwt(c),...d===null?{}:{active:{visible:d,hidden:pwt(d)}},...m===""&&S===""&&!Number.isFinite(g)?{}:{outline:{style:m==="crisp"?"crisp":"soft",width:Number.isFinite(g)&&g>0?g:null,hidden:S!=="false"}}}}function Pxn(t){return IMt(t).background!==null}function Ixn(t){const n=IMt(t).background;if(n===null)return!1;const s=n>>16&255,c=n>>8&255,d=n&255;return(.2126*s+.7152*c+.0722*d)/255>.5}function IMt(t){const n=dA(t),s=c=>{const d=oee(n,c);return d?iee(d):null};return{background:s("--volter-viewport-background"),grid:s("--volter-viewport-grid"),axisX:s("--volter-viewport-axis-x"),axisY:s("--volter-viewport-axis-y"),axisZ:s("--volter-viewport-axis-z"),axisLineWidth:(()=>{const c=Ig(n,"--volter-viewport-axis-line-width"),d=c?Number.parseFloat(c):Number.NaN;return Number.isFinite(d)?d:null})(),active:s("--volter-viewport-active")}}function Nxn(t){const n=dA(t),s=m=>{const g=oee(n,m);return g?iee(g):null},c=m=>{const g=Ig(n,m);if(!g)return null;const S=Number.parseFloat(g);return Number.isFinite(S)?S:null},d=m=>{const g=s(`${m}-x`),S=s(`${m}-y`),k=s(`${m}-z`);return g!==null&&S!==null&&k!==null?[g,S,k]:null};return{axes:d("--volter-gizmo"),navigation:d("--volter-gizmo-navigation"),hover:s("--volter-gizmo-hover"),drag:s("--volter-gizmo-drag"),opacity:c("--volter-viewport-gizmo-opacity"),arrowLength:c("--volter-viewport-gizmo-arrow-length"),arrowHead:c("--volter-viewport-gizmo-arrow-head"),ringWidth:c("--volter-viewport-gizmo-ring-width"),navigationSize:c("--volter-viewport-navigation-size"),background:s("--volter-viewport-background"),navigationForm:(m=>m==="cones"||m==="triad"||m==="godot"?m:"balls")(Ig(n,"--volter-viewport-navigation-gizmo")),navigationCorner:Ig(n,"--volter-viewport-navigation-corner")==="bottom-left"?"bottom-left":"top-right",highlightSaturation:c("--volter-viewport-gizmo-highlight-saturation"),highlightValue:c("--volter-viewport-gizmo-highlight-value")}}function Oxn(t){const n=Ig(dA(t),"--volter-viewport-gizmo-size");if(!n)return null;const s=Number.parseFloat(n);return Number.isFinite(s)&&s>0?s:null}function Rxn(t){const n=dA(t),s=(d,m)=>{const g=Number.parseFloat(Ig(n,d)??"");return Number.isFinite(g)&&g>0?g:m},c=s("--volter-viewport-grid-line-width",1);return{lineWidth:c,majorWidth:s("--volter-viewport-grid-major-width",c),majorContrast:s("--volter-viewport-grid-major-contrast",1)}}function Fxn(t){const n=dA(t),s=oee(n,"--volter-viewport-wire"),c=Number.parseFloat(Ig(n,"--volter-viewport-wire-opacity"));return{color:s?iee(s):null,opacity:Number.isFinite(c)?c:null}}function Mxn(t){const n=dA(t),s=Number.parseFloat(Ig(n,"--volter-viewport-selection-box-width"));return{edges:Ig(n,"--volter-viewport-selection-box")==="edges",frame:Ig(n,"--volter-viewport-selection-box-frame")==="object"?"object":"world",lineWidth:Number.isFinite(s)&&s>0?s:null}}function NMt(t){const n=dA(t);return["--volter-viewport-chrome-bar","--volter-viewport-chrome-view-name","--volter-viewport-chrome-tools","--volter-viewport-chrome-display","--volter-viewport-chrome-transform-controls"].map(s=>Ig(n,s)).join("|")}function hcn(t){const[n,s,c,d,m]=t.split("|"),g=["strip","pills"],S=["menu","gizmo","bar"],k=["bar-start","bar-end"],A=(F,D,J)=>D.includes(F)?F:J;return{bar:A(n,g,"none"),viewName:A(s,S,"text"),tools:A(c,k,"shelf"),display:A(d,k,"corner"),transformControls:m==="bar"?"bar":"header"}}let mje=null;function gcn(t){return RMt(null,()=>{mje=NMt(),t()})}function _wt(){return mje??=NMt(),mje}let hje=null;function OMt(){const t=dA();return JSON.stringify([gBe.map(n=>Ig(t,`--volter-viewport-word-${n}`)),Ig(t,"--volter-viewport-word-helpers")])}function ycn(t){return RMt(null,()=>{hje=OMt(),t()})}function mwt(){return hje??=OMt(),hje}function jxn(){const t=Ye.useSyncExternalStore(ycn,mwt,mwt);return Ye.useMemo(()=>{const[n,s]=JSON.parse(t),c={};return gBe.forEach((d,m)=>{n[m]&&(c[d]=n[m])}),{shading:c,helpers:s||void 0}},[t])}function vcn(){const t=Ye.useSyncExternalStore(gcn,_wt,_wt);return Ye.useMemo(()=>hcn(t),[t])}function RMt(t,n){n();const s=dA(t);if(!s||typeof MutationObserver>"u")return()=>{};const c=new MutationObserver(n);c.observe(s,{attributes:!0,attributeFilter:["style"]});const d=bcn(s,n);return()=>{c.disconnect(),d()}}const c_e=new Set;let YL=null,bOe="";function bcn(t,n){const s=()=>Object.values(PMt).map(c=>Ig(t,c)).join("|");return c_e.add(n),!YL&&typeof document<"u"&&document.head&&(bOe=s(),YL=new MutationObserver(()=>{const c=s();if(c!==bOe){bOe=c;for(const d of[...c_e])d()}}),YL.observe(document.head,{childList:!0,subtree:!0,characterData:!0})),()=>{c_e.delete(n),c_e.size===0&&YL&&(YL.disconnect(),YL=null)}}function Scn({documentId:t,runtime:n=!1,island:s=!1,assetPath:c,transformControls:d,children:m}){Ye.useSyncExternalStore(bBe,o$,o$);const g=Ye.useSyncExternalStore(U$,eA,eA),S=o2(t)?.HeaderControls;return!m&&!S&&!d||!n&&g.includes("header:hidden")?null:$.jsxs("div",{className:s?"volter-dock-document-toolbar volter-chrome-island volter-glass-island":"volter-dock-document-toolbar","data-runtime-toolbar":n||void 0,"data-island-scale":"compact","data-testid":`document-header:${t}`,children:[m?$.jsx("div",{className:"volter-dock-document-toolbar-own",children:m}):null,d,S?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(S,{documentId:t,...c&&!c.startsWith("online:")?{assetPath:c}:{}})}):null]})}function xcn({documentId:t,children:n}){const s=Ye.useSyncExternalStore(U$,eA,eA);return!n||s.includes("shelf:hidden")?null:$.jsx("div",{className:"volter-dock-document-shelf","data-testid":`document-shelf:${t}`,role:"toolbar","aria-orientation":"vertical","aria-label":"Document tools",children:n})}function wcn(t){return t==="game"||t==="scene"||t==="world"?"world":"resource"}function FMt({viewId:t,descriptor:n,active:s,backdrop:c=!1,chrome:d=!0}){const m=n.Content,g=n.Toolbar,S=n.Shelf,k=wcn(n.kind),A=Yv();Ye.useSyncExternalStore(A.subscribe,A.getShellSnapshot??A.getSnapshot),Ye.useSyncExternalStore(Cee,AD,AD),Ye.useSyncExternalStore(bBe,o$,o$),Ye.useSyncExternalStore(oCt,VOe,VOe);const F=o2(n.id),D=s&&n.kind!=="game"?F?.transformTools?.()??"none":"none",J=F?.TransformTools,q=F?.TransformControls,G=vcn(),se=d&&F!==null&&F!==void 0&&!c,pe=se&&G.bar!=="none"&&G.tools!=="shelf",ue=Ye.useSyncExternalStore(U$,eA,eA).includes("shelf:hidden"),Ce=D==="none"||!J?null:$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(J,{documentId:n.id})}),Fe=se&&G.bar!=="none",De=!Fe||G.display==="corner"?null:G.display==="bar-start"?"start":"end",be=pe?G.tools==="bar-start"?"start":"end":null,X=Fe&&G.transformControls==="bar"&&D==="gizmo"&&q!==void 0,we=X?be??De??"start":null,Be=bt=>$.jsxs("div",{className:"volter-stage-bar-group","data-edge":bt,children:[De===bt?$.jsx("div",{className:"volter-stage-bar-slot","data-stage-bar-slot":"display"}):null,be===bt?Ce:null,we===bt&&q?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(q,{documentId:n.id})}):null]});return $.jsxs("div",{className:"volter-dock-document","data-testid":`workspace-doc:${n.id}`,"data-editor-hotkey-scope":k==="world"?"viewport":"workspace","data-volter-document-family":k,children:[d&&$.jsx(Scn,{documentId:n.id,runtime:n.kind==="game",island:c&&k==="world",assetPath:iQr(n.id)?.assetPath,transformControls:D==="gizmo"&&q&&!X?$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(q,{documentId:n.id})}):null,children:g?$.jsx(g,{documentId:n.id,active:s}):null}),$.jsxs("div",{className:"volter-dock-document-content","data-workspace-document-id":n.id,"data-workspace-view-id":t,"data-volter-stage-bar":se&&G.bar!=="none"?G.bar:void 0,"data-volter-stage-rail":d&&!ue&&(Ce&&!pe||S)?void 0:"empty",children:[$.jsx(m,{documentId:n.id,...t?{viewId:t}:{},active:s}),Fe?$.jsxs("div",{className:"volter-stage-bar","data-form":G.bar,role:"toolbar","aria-label":"Viewport",children:[Be("start"),Be("end")]}):null,d&&$.jsx(xcn,{documentId:n.id,children:Ce&&!pe||S?$.jsxs($.Fragment,{children:[pe?null:Ce,S?$.jsx(S,{documentId:n.id,active:s}):null]}):null})]})]})}const l_e=new Map;function Tcn(t,n){const s=Em();let c=l_e.get(t);(!c||c.project!==s)&&(c={project:s,count:0,created:n},l_e.set(t,c)),c.count++;const d=c;return()=>{l_e.get(t)!==d||--d.count>0||(l_e.delete(t),d.created&&Em()===d.project&&EN(t))}}function Ccn({document:t,chrome:n=!0,active:s=!0,onReady:c}){const d=Yv(),[m,g]=Ye.useState(null),[S,k]=Ye.useState(null),A=JSON.stringify(t),F=Ye.useRef(c);F.current=c;const D=Ye.useRef(null);Ye.useSyncExternalStore(i2,X1,X1);const J=Ye.useSyncExternalStore(bBe,o$,o$);Ye.useEffect(()=>{let G=!1,se;const pe=Em(),ue=()=>!G&&Em()===pe,Ce=JSON.parse(A);return g(null),k(null),(async()=>{if(await Gze(),!ue())return;const Fe=new Set(l0().map(be=>be.descriptor.id)),De=Ce.kind==="asset"?sN(Ce.path,Ce.assetKind??"source",{activate:s}):Ce.kind==="workspace"?Fe.has(Ce.id)?Ce.id:null:await Wye(Ce.kind,d,{...Ce,activate:s});if(ue()){if(!De)throw new Error("The requested layout document is unavailable.");se=Tcn(De,!Fe.has(De)),g(De)}})().catch(Fe=>{ue()&&k(Fe instanceof Error?Fe.message:String(Fe))}),()=>{G=!0,se?.()}},[d,A]),Ye.useEffect(()=>{!m||!s||X0(m)},[m,s]),Ye.useEffect(()=>{if(!m)return;const G=o2(m);if(!(!G||D.current===G)){D.current=G;try{F.current?.({select(se){const pe=G.idsNamed?.(se)??[];if(pe.length!==1)throw new Error(`Expected one object named "${se}"; found ${pe.length}.`);G.selection?.apply(pe)},transform(se){G.setTransformMode?.(se)},frame(){G.frame("document")}})}catch(se){k(se instanceof Error?se.message:String(se))}}},[m,J]);const q=m?l0().find(G=>G.descriptor.id===m):void 0;return $.jsx("div",{style:{position:"relative",flex:1,minWidth:0,minHeight:0,height:"100%",overflow:"hidden"},children:S?$.jsx("div",{role:"alert",children:S}):q?$.jsx(FMt,{descriptor:q.descriptor,active:s,chrome:n}):$.jsx("div",{role:"status",children:"Opening document…"})})}function Ecn(){return $.jsxs(kee,{children:[$.jsx(Aee,{}),$.jsx(Pee,{}),$.jsx(Dee,{})]})}function kcn(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot);const n=Ye.useSyncExternalStore(zye,c$,c$),[s,c]=Ye.useState(!1),d=Ye.useSyncExternalStore(OC,nxt,nxt);if(Ye.useEffect(()=>{let g=!1;return Gze().then(()=>{g||c(!0)}),()=>{g=!0}},[]),!s)return $.jsx("div",{role:"status",children:d??"Loading project layout…"});const m=n.Layout??Ecn;return $.jsx(m,{playing:t.playState!=="stopped",paused:t.playState==="paused"})}function $Ve({size:t=64}){return $.jsx("img",{src:lee()?.logo??mR.logo,width:t,height:t,alt:"","aria-hidden":"true","data-testid":"volter-logo",style:{display:"block"}})}const gje="account";function MMt(){return ND({id:gje,title:"Account",kind:"tool-contribution",workspaceRole:"workspace-task",provenance:{origin:"Volter account"},Content:Icn,closeable:!0,presentation:()=>({kind:"workspace",id:gje})})}kN({id:"workspace",owner:"account-documents",open:(t,n)=>n.id===gje?MMt():null});function Acn(t){return t.source==="environment"?`Environment · ${t.environmentVariable}`:t.source==="system"?"Secure system storage":t.source==="session"?t.configured?"Session only":"Session storage":"Not configured"}function hB({children:t}){return $.jsxs("div",{className:"volter-account-infostrip",children:[$.jsx(dc,{icon:R$,className:"volter-account-infostrip-icon","aria-hidden":"true"}),$.jsx("span",{children:t})]})}function Dcn({provider:t,busy:n,run:s,editing:c,removing:d,onEdit:m,onStopEditing:g,onRemoveIntent:S}){const[k,A]=Ye.useState("");return $.jsxs("div",{className:"volter-account-provider","data-configured":t.configured,children:[$.jsx("span",{className:"volter-account-provider-monogram","aria-hidden":"true",children:t.label.slice(0,1)}),$.jsxs("div",{className:"volter-account-provider-main",children:[$.jsxs("div",{className:"volter-account-provider-name",children:[$.jsx("strong",{children:t.label}),t.configured&&$.jsxs($.Fragment,{children:[$.jsx("span",{className:"volter-account-provider-dot","aria-hidden":"true"}),$.jsx("span",{className:"volter-account-provider-key",children:t.maskedKey})]})]}),$.jsx("span",{className:"volter-account-provider-source",children:Acn(t)}),t.source==="session"&&t.configured&&$.jsx("span",{className:"volter-account-provider-warning",children:"No system credential manager is available. This key will be forgotten when the editor stops."}),t.problem&&$.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:t.problem}),t.source==="environment"&&$.jsxs("span",{className:"volter-account-provider-source",children:["Restart the editor after changing ",t.environmentVariable,"."]})]}),c?$.jsxs("form",{className:"volter-account-provider-form",onSubmit:F=>{F.preventDefault(),s(async()=>{await fwr(t.provider,k),A(""),g()},`${t.label} credential saved.`)},children:[$.jsxs("label",{className:"volter-field",children:[$.jsxs("span",{className:"volter-field-label",children:[t.label," API key"]}),$.jsx(Zm,{autoComplete:"off",autoFocus:!0,type:"password",value:k,onChange:F=>A(F.target.value)})]}),$.jsxs("div",{className:"volter-account-provider-form-actions",children:[$.jsx(Ms,{type:"submit",variant:"primary",disabled:n||k.trim()==="",children:"Save key"}),$.jsx(Ms,{type:"button",variant:"ghost",disabled:n,onClick:()=>{A(""),g()},children:"Cancel"})]})]}):$.jsxs("div",{className:"volter-account-provider-actions",children:[t.configured&&$.jsx(Ms,{size:"compact",disabled:n,onClick:()=>void s(()=>pwr(t.provider),`${t.label} credential is valid.`),children:"Test"}),t.editable&&$.jsx(Ms,{size:"compact",variant:t.configured?"ghost":"secondary",disabled:n,onClick:()=>{A(""),m()},children:t.configured?"Replace":"Add key"}),t.editable&&t.configured&&!d&&$.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(t.provider),children:"Remove"}),d&&$.jsxs($.Fragment,{children:[$.jsx(Ms,{size:"compact",variant:"danger",disabled:n,onClick:()=>void s(async()=>{await dwr(t.provider),S(null)},`${t.label} credential removed.`),children:"Confirm remove"}),$.jsx(Ms,{size:"compact",variant:"ghost",disabled:n,onClick:()=>S(null),children:"Cancel"})]})]})]})}function hwt({busy:t,run:n}){const s=XLe(),[c,d]=Ye.useState(null),[m,g]=Ye.useState(null),S=s.providerCredentials.filter(k=>k.configured).length;return $.jsxs("section",{className:"volter-account-card volter-provider-connections",children:[$.jsxs("div",{className:"volter-account-providers-header",children:[$.jsxs("div",{children:[$.jsx("h3",{className:"volter-account-card-title",children:"Provider connections"}),$.jsx("p",{className:"volter-account-card-sub",children:"Keys live in this computer's credential manager — never in project files or the editor UI."})]}),$.jsxs("span",{className:"volter-status-dot","data-state":S>0?"on":"off",children:[S," connected"]})]}),$.jsx("div",{className:"volter-account-provider-list",children:s.providerCredentials.map(k=>$.jsx(Dcn,{provider:k,busy:t,run:n,editing:c===k.provider,removing:m===k.provider,onEdit:()=>{g(null),d(k.provider)},onStopEditing:()=>d(null),onRemoveIntent:g},k.provider))})]})}function gwt({busy:t,run:n}){const s=XLe(),c=s.codingInference,[d,m]=Ye.useState(c.model),[g,S]=Ye.useState(null),[k,A]=Ye.useState(null);Ye.useEffect(()=>m(c.model),[c.model]),Ye.useEffect(()=>{S(null),A(null)},[d,s.preferredRoute]);const F=D=>n(()=>lwr({...c,...D,model:(D.model??c.model).trim()}),"Coding inference settings saved.");return $.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Coding inference"}),$.jsxs("p",{className:"volter-account-card-sub",children:["Coding agents run on the login you already did — ",$.jsx("code",{children:"codex login"}),", Claude's device login, ",$.jsx("code",{children:"grok login"})," — and Volter Editor injects nothing into them. Turn this on only for a harness you have no subscription for: it routes that harness through OpenRouter on this account's managed credits or your own key, and it takes effect only while Preferred route above is Managed or BYOK. Existing sessions keep the route they launched with."]}),$.jsxs("label",{className:"volter-account-switch-row",children:[$.jsx(TD,{checked:c.enabled,disabled:t,onChange:D=>void F({enabled:D.target.checked})}),$.jsxs("span",{className:"volter-account-switch-copy",children:[$.jsx("strong",{children:"Use OpenRouter for coding agents"}),$.jsx("small",{children:"Codex, Claude Code, OpenCode and Pi are configured per spawned process. Grok takes no provider configuration and always runs on its own device login."})]})]}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Managed coding model"}),$.jsxs(Iw,{value:d,disabled:t,onChange:D=>{const J=D.target.value;m(J),J!==c.model&&F({model:J})},children:[!["z-ai/glm-5.2","moonshotai/kimi-k3"].includes(d)&&$.jsxs("option",{value:d,children:[d," · custom"]}),$.jsx("option",{value:"z-ai/glm-5.2",children:"GLM-5.2 · managed default"}),$.jsx("option",{value:"moonshotai/kimi-k3",children:"Kimi K3 · higher-cost option"})]})]}),s.preferredRoute==="managed"?$.jsxs("div",{className:"volter-account-card-footer",children:[$.jsx(Ms,{size:"compact",disabled:t,onClick:()=>{A(null),uwr({model:d,promptTokens:1e5,outputTokens:2e4}).then(S).catch(D=>A(D instanceof Error?D.message:String(D)))},children:"Preflight typical coding session"}),g&&$.jsxs("span",{className:"volter-account-help",children:["Estimate: ",g.estimatedCredits.toLocaleString()," Volter credits ($",g.providerAmountUsd.toFixed(4)," provider cost) for 100k input + 20k output tokens."]}),k&&$.jsx("span",{className:"volter-account-provider-warning",role:"alert",children:k})]}):s.preferredRoute==="byok"?$.jsx(hB,{children:"BYOK coding charges OpenRouter directly and consumes zero Volter credits."}):null,$.jsxs(hB,{children:["Active account route: ",s.preferredRoute,". BYOK requires the OpenRouter connection below; managed uses the Volter balance."]})]})}function Pcn({plan:t}){const n=t.status.replace("_"," "),s=t.status==="active"||n.toLowerCase()===t.name.trim().toLowerCase();return $.jsxs("span",{className:"volter-account-plan-chips",children:[$.jsxs("span",{className:"volter-chip","data-tone":"accent",children:[t.name," plan"]}),!s&&$.jsx("span",{className:"volter-chip","data-tone":t.status==="cancelling"?"warn":void 0,children:n}),(t.renewsAt||t.endsAt)&&$.jsxs("span",{className:"volter-chip",children:[t.endsAt?"Access ends":"Renews"," ",new Date(t.endsAt??t.renewsAt).toLocaleDateString()]})]})}function Icn(){Ye.useSyncExternalStore(Tye,cN,cN);const t=XLe(),[n,s]=Ye.useState("builder@example.test"),[c,d]=Ye.useState([]),[m,g]=Ye.useState(null),[S,k]=Ye.useState("creator"),[A,F]=Ye.useState(""),[D,J]=Ye.useState(!1),[q,G]=Ye.useState(null),[se,pe]=Ye.useState(null),[ue,Ce]=Ye.useState(null),[Fe,De]=Ye.useState(!1);Ye.useEffect(()=>{if(t.authenticated||t.backend!=="live"||t.accountEnvironment==="development-twin"){De(!1);return}vwr().then(zt=>De(zt.device)).catch(()=>De(!1))},[t.authenticated,t.backend]),Ye.useEffect(()=>{if(!ue)return;const zt=()=>{Swr(ue.authorizationId).then(tr=>{tr&&Ce(null)}).catch(tr=>{G(tr instanceof Error?tr.message:String(tr)),Ce(null)})};zt();const ft=window.setInterval(zt,1e3);return()=>window.clearInterval(ft)},[ue]),Ye.useEffect(()=>{if(!se)return;const zt=()=>{wwr(se.deviceCode).then(tr=>{tr&&pe(null)}).catch(tr=>{G(tr instanceof Error?tr.message:String(tr)),pe(null)})},ft=window.setInterval(zt,Math.max(1,se.intervalSeconds)*1e3);return()=>window.clearInterval(ft)},[se]),Ye.useEffect(()=>{if(!t.authenticated){d([]);return}hwr().then(d).catch(()=>d([]))},[t.authenticated,t.authenticated?t.user.id:"signed-out",t.authenticated?t.credits.used:0]),Ye.useEffect(()=>{if(!t.authenticated){g(null);return}gwr().then(zt=>{g(zt);const ft=["creator","max","ultra"].find(tr=>tr!==t.plan.id);k(ft??"creator"),F(Object.keys(zt.creditPacks)[0]??"")}).catch(()=>g(null))},[t.authenticated,t.authenticated?t.user.id:"signed-out"]);const be=async(zt,ft)=>{J(!0),G(null);try{await zt(),ft&&G(ft)}catch(tr){G(tr instanceof Error?tr.message:String(tr))}finally{J(!1)}};if(!t.authenticated)return $.jsx("div",{className:"volter-account","data-testid":"account-document",children:$.jsxs("div",{className:"volter-account-signin-stack",children:[$.jsxs("div",{className:"volter-account-signin-hero",children:[$.jsx("span",{className:"volter-account-signin-mark","aria-hidden":"true",children:$.jsx($Ve,{size:52})}),$.jsx("h1",{className:"volter-account-signin-title",children:"Sign in to Volter Editor"})]}),t.accountEnvironment==="development-twin"?$.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>iwr(n),"Signed in through the local Clerk Twin.")},children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Development email"}),$.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),$.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use Clerk Twin account"}),$.jsx(hB,{children:"Local Clerk and Polar twins — fake identity and checkout, with the real Volter account and credit boundaries."})]}):t.backend==="live"?$.jsxs("section",{className:"volter-account-card volter-account-signin-card",children:[$.jsx(Ms,{variant:"primary",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await bwr();Ce(zt),window.open(zt.authorizationUrl,"_blank","noopener,noreferrer")}),children:ue?"Waiting for browser sign-in…":"Continue in browser"}),Fe&&$.jsx(Ms,{variant:"ghost",disabled:D||se!==null||ue!==null,onClick:()=>void be(async()=>{const zt=await xwr();pe(zt),window.open(zt.verificationUri,"_blank","noopener,noreferrer")}),children:"Use a device code instead"}),se&&$.jsxs("div",{className:"volter-account-device-code",children:[$.jsx("strong",{children:se.userCode}),$.jsx("span",{children:"Complete authorization in the browser. This editor polls without receiving your password."})]}),$.jsx(hB,{children:"Authorization happens in your browser — this editor never sees your password."})]}):$.jsxs("form",{className:"volter-account-card volter-account-signin-card",onSubmit:zt=>{zt.preventDefault(),be(()=>nwr(n),"Signed in to the zero-charge local account.")},children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Email"}),$.jsx(Zm,{value:n,type:"email",onChange:zt=>s(zt.target.value)})]}),$.jsx(Ms,{type:"submit",variant:"primary",disabled:D||!n.includes("@"),children:D?"Signing in…":"Use local mock account"}),$.jsx(hB,{children:"Local mock — no payment, network identity, or provider request."})]}),$.jsxs("ul",{className:"volter-account-signin-points",children:[$.jsx("li",{children:"Every paid generation shows its route and estimate first"}),$.jsx("li",{children:"Spend controls and hard limits are on by default"}),$.jsx("li",{children:"Provider keys stay in your system credential manager"})]}),$.jsx(gwt,{busy:D,run:be}),$.jsx(hwt,{busy:D,run:be}),(q||wpe())&&$.jsx("div",{className:"volter-account-status",role:"status",children:q??wpe()})]})});const X=t.credits.included+t.credits.purchased,we=X===0?0:Math.min(100,t.credits.used/X*100),Be=X===0?0:Math.max(0,Math.min(100-we,t.credits.reserved/X*100)),bt=X>0&&t.credits.used>X,It=t.backend==="mock"||t.entitlements.generation,Wt=zt=>swr({...t.spendPolicy,...zt});return $.jsxs("div",{className:"volter-account","data-testid":"account-document",children:[$.jsx("h1",{className:"volter-sr-only",children:"Account"}),$.jsxs("div",{className:"volter-account-stack",children:[$.jsxs("header",{className:"volter-account-identity",children:[$.jsx("span",{className:"volter-account-avatar","aria-hidden":"true",children:t.user.email.slice(0,1)}),$.jsxs("div",{className:"volter-account-identity-main",children:[$.jsxs("div",{className:"volter-account-identity-row",children:[$.jsx("h2",{className:"volter-account-identity-email",children:t.user.email}),$.jsx(Pcn,{plan:t.plan})]}),$.jsx("p",{className:"volter-account-identity-note",children:t.accountEnvironment==="development-twin"?"Clerk + Polar Twin development account":t.backend==="mock"?"Isolated test account":"Volter account"})]}),$.jsx(Ms,{variant:"ghost",className:"volter-account-signout",disabled:D,onClick:()=>void be(owr),children:"Sign out"})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsxs("div",{className:"volter-account-card-head",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Credits"}),t.plan.id!=="free"&&t.plan.status==="cancelling"&&$.jsx(Ms,{size:"compact",disabled:D,onClick:()=>void be(()=>aht("resume")),children:"Resume subscription"})]}),!It&&$.jsx(hB,{children:"This account has not been admitted to Volter managed services. Signing up or paying does not grant provider access; contact the Volter team for admission."}),m&&$.jsxs("div",{className:"volter-account-card-footer",children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Subscription tier"}),$.jsx(Iw,{value:S,disabled:D||!It,onChange:zt=>k(zt.target.value),children:Object.keys(m.plans).map(zt=>{const ft=m.plans[zt],tr=ft.monthlyPriceUsd;return $.jsxs("option",{value:zt,disabled:zt==="free",children:[ft.name,tr!==void 0?` · $${tr}/month`:""," ·"," ",ft.includedCredits.toLocaleString()," credits",zt===t.plan.id?" · current":""]},zt)})})]}),$.jsxs(Ms,{variant:"primary",size:"compact",disabled:D||!It||S===t.plan.id||S==="free",onClick:()=>void be(async()=>{const zt=await _wr(S);zt.checkoutUrl?window.open(zt.checkoutUrl,"_blank","noopener,noreferrer"):G(zt.mock?`Mock ${m.plans[S].name} upgrade completed. No payment occurred.`:`Subscription changed to ${m.plans[S].name}.`)}),children:["Choose ",m.plans[S].name]})]}),$.jsxs("div",{className:"volter-account-credit-figure",children:[$.jsx("span",{className:"volter-account-credit-number",children:t.credits.remaining.toLocaleString()}),$.jsx("span",{className:"volter-account-credit-unit",children:"credits remaining"})]}),$.jsxs("div",{className:"volter-meter",role:"progressbar","aria-label":"Credits used","aria-valuenow":Math.round(we),"aria-valuemin":0,"aria-valuemax":100,"data-state":bt?"over":void 0,children:[$.jsx("span",{className:"volter-meter-fill",style:{width:`${we}%`}}),Be>0&&$.jsx("span",{className:"volter-meter-fill","data-part":"reserved",style:{left:`${we}%`,width:`${Be}%`}})]}),$.jsxs("p",{className:"volter-account-cycle-line",children:[t.credits.used.toLocaleString()," of ",X.toLocaleString()," used this cycle",t.credits.resetsAt&&$.jsxs($.Fragment,{children:[" · resets ",new Date(t.credits.resetsAt).toLocaleDateString()]}),bt&&$.jsx("span",{className:"volter-account-cycle-over",children:" · over allowance"})]}),$.jsxs("div",{className:"volter-account-legend","data-state":bt?"over":void 0,children:[$.jsxs("span",{className:"volter-account-legend-item","data-part":"included",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.included.toLocaleString()," included"]}),$.jsxs("span",{className:"volter-account-legend-item","data-part":"used",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.used.toLocaleString()," used"]}),$.jsxs("span",{className:"volter-account-legend-item","data-part":"reserved",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.reserved.toLocaleString()," reserved"]}),$.jsxs("span",{className:"volter-account-legend-item","data-part":"purchased",children:[$.jsx("span",{className:"volter-account-legend-dot","aria-hidden":"true"}),t.credits.purchased.toLocaleString()," purchased"]})]}),t.credits.purchasedExpiresAt&&$.jsxs("p",{className:"volter-account-help volter-account-expiry",children:["Purchased credits expire"," ",new Date(t.credits.purchasedExpiresAt).toLocaleDateString(),"."]}),$.jsxs("div",{className:"volter-account-card-footer",children:[m&&A&&m.creditPacks[A]&&$.jsxs($.Fragment,{children:[$.jsx(Iw,{"aria-label":"Credit pack",value:A,disabled:D||!It,onChange:zt=>F(zt.target.value),children:Object.entries(m.creditPacks).map(([zt,ft])=>$.jsxs("option",{value:zt,children:[ft.name," · ",ft.credits.toLocaleString()," credits"]},zt))}),$.jsx(Ms,{size:"compact",disabled:D||!It,onClick:()=>void be(async()=>{const zt=m.creditPacks[A],ft=await mwr(A);ft.checkoutUrl?window.open(ft.checkoutUrl,"_blank","noopener,noreferrer"):G(`Added ${zt?.credits.toLocaleString()??""} mock credits. No payment occurred.`)}),children:"Buy credits"})]}),$.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(async()=>{const zt=await ywr();zt.mock?G("Mock billing portal: no payment page was opened."):window.open(zt.url,"_blank","noopener,noreferrer")}),children:"Billing and invoices"}),t.plan.id!=="free"&&t.plan.status==="active"&&$.jsx(Ms,{size:"compact",variant:"ghost",className:"volter-account-quiet-danger",disabled:D,onClick:()=>void be(()=>aht("cancel")),children:"Cancel at renewal"})]})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Generation routing"}),$.jsx("p",{className:"volter-account-card-sub",children:"Billing preference for AI usage. Provider libraries apply it automatically; requests show the resolved account and cost before submission."}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Preferred route"}),$.jsxs(Iw,{value:t.preferredRoute,onChange:zt=>void be(()=>cwr(zt.target.value)),children:[t.accountEnvironment==="test-mock"&&$.jsx("option",{value:"mock",children:"Mock · free and local"}),$.jsx("option",{value:"auto",children:"Automatic · saved key or Volter account"}),$.jsxs("option",{value:"managed",disabled:!t.routes.managed,children:["Managed · Volter credits",t.routes.managed?"":" (unavailable)"]}),$.jsxs("option",{value:"byok",disabled:!t.routes.byok,children:["BYOK · provider dollars",t.routes.byok?"":" (no key found)"]})]})]})]}),$.jsx(gwt,{busy:D,run:be}),$.jsx(hwt,{busy:D,run:be}),(t.alerts?.length??0)>0&&$.jsxs("section",{className:"volter-account-card",children:[$.jsxs("div",{className:"volter-account-card-head",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Account alerts"}),t.alerts?.some(zt=>!zt.readAt)&&$.jsx(Ms,{size:"compact",variant:"ghost",disabled:D,onClick:()=>void be(awr),children:"Mark read"})]}),$.jsx("div",{className:"volter-account-usage",children:t.alerts?.map(zt=>$.jsxs("div",{className:"volter-account-usage-row",children:[$.jsxs("span",{children:[$.jsx("strong",{children:zt.readAt?"Notice":"New"}),$.jsx("small",{children:zt.message})]}),$.jsx("span",{children:new Date(zt.createdAt).toLocaleDateString()})]},zt.id))})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Spend controls"}),$.jsxs("p",{className:"volter-account-card-sub",children:["Alerts at ",t.spendPolicy.alertThresholds.join("%, "),"% of the available allowance."]}),$.jsxs("label",{className:"volter-account-switch-row",children:[$.jsx(TD,{checked:t.spendPolicy.overageEnabled,onChange:zt=>void be(()=>Wt({overageEnabled:zt.target.checked,monthlyLimitCredits:zt.target.checked&&t.spendPolicy.monthlyLimitCredits===0?1e3:t.spendPolicy.monthlyLimitCredits}))}),$.jsxs("span",{className:"volter-account-switch-copy",children:[$.jsx("strong",{children:"Allow paid overage"}),$.jsx("small",{children:"Off by default. Managed requests stop before provider submission."})]})]}),$.jsx("div",{className:"volter-account-limit-field",children:$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Monthly overage hard limit"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.monthlyLimitCredits,disabled:!t.spendPolicy.overageEnabled,onBlur:zt=>void be(()=>Wt({monthlyLimitCredits:Number(zt.target.value)}))},t.spendPolicy.monthlyLimitCredits),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})}),$.jsxs("label",{className:"volter-account-switch-row",children:[$.jsx(TD,{checked:t.spendPolicy.autoReload?.enabled===!0,onChange:zt=>void be(()=>Wt({autoReload:{enabled:zt.target.checked,whenRemainingBelow:t.spendPolicy.autoReload?.whenRemainingBelow??100,reloadTo:t.spendPolicy.autoReload?.reloadTo??500,monthlyLimitCredits:t.spendPolicy.autoReload?.monthlyLimitCredits??2e3}}))}),$.jsxs("span",{className:"volter-account-switch-copy",children:[$.jsx("strong",{children:"Automatically reload credits"}),$.jsx("small",{children:"Optional, independently capped, and never enabled by checkout."})]})]}),t.spendPolicy.autoReload?.enabled&&$.jsxs("div",{className:"volter-account-policy-fields",children:[$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Reload below"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.autoReload.whenRemainingBelow,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,whenRemainingBelow:Number(zt.target.value)}}))},t.spendPolicy.autoReload.whenRemainingBelow),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Reload balance to"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.jsx(Zm,{type:"number",min:1,defaultValue:t.spendPolicy.autoReload.reloadTo,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,reloadTo:Number(zt.target.value)}}))},t.spendPolicy.autoReload.reloadTo),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]}),$.jsxs("label",{className:"volter-field",children:[$.jsx("span",{className:"volter-field-label",children:"Monthly reload cap"}),$.jsxs("span",{className:"volter-account-input-suffix",children:[$.jsx(Zm,{type:"number",min:0,defaultValue:t.spendPolicy.autoReload.monthlyLimitCredits,onBlur:zt=>void be(()=>Wt({autoReload:{...t.spendPolicy.autoReload,monthlyLimitCredits:Number(zt.target.value)}}))},t.spendPolicy.autoReload.monthlyLimitCredits),$.jsx("span",{className:"volter-account-suffix","aria-hidden":"true",children:"credits"})]})]})]})]}),$.jsxs("section",{className:"volter-account-card",children:[$.jsx("h3",{className:"volter-account-card-title",children:"Current-cycle usage"}),c.length===0?$.jsx("p",{className:"volter-account-help",children:"No managed credit usage has been settled in this account."}):$.jsx("div",{className:"volter-account-usage",children:c.map(zt=>$.jsxs("div",{className:"volter-account-usage-row",children:[$.jsxs("span",{children:[zt.kind," · ",zt.provider," · ",zt.operation??"managed operation"]}),$.jsxs("strong",{children:[zt.credits.toLocaleString()," credits"]})]},zt.id))})]}),(q||wpe())&&$.jsx("div",{className:"volter-account-status",role:"status",children:q??wpe()})]})]})}function Ncn(t,n,s){const d=navigator.platform.includes("Mac")?"⌘":"Ctrl+",m=Y0(t),g=[...t.selectedEntityIds],S=g[0],k=S?m.hierarchy.node(S)?.parentId??null:null,A=g.length>0&&!!m.structure?.copy&&(m.structure.canCopy?.(g)??!0),F=A&&!!m.structure?.cut,D=!!m.structure?.paste&&(m.structure.canPaste?.(k)??!0),J=[...F?[{id:"editor.cut",label:"Cut",category:"action",shortcut:Vv("edit.cut"),execute:()=>MVe(t)}]:[],...A?[{id:"editor.copy",label:"Copy",category:"action",shortcut:Vv("edit.copy"),execute:()=>FVe(t)}]:[],...D?[{id:"editor.paste",label:"Paste",category:"action",shortcut:Vv("edit.paste"),execute:()=>jVe(t)}]:[]];return[{id:"account.open",label:"Account and Provider Connections",category:"action",execute:()=>{MMt()}},{id:"editor.undo",label:s?.undoLabel?`Undo ${s.undoLabel}`:"Undo",category:"action",shortcut:Vv("edit.undo"),execute:async()=>{await n.undo()}},{id:"editor.redo",label:s?.redoLabel?`Redo ${s.redoLabel}`:"Redo",category:"action",shortcut:Vv("edit.redo"),execute:async()=>{await n.redo()}},...J,{id:"editor.duplicate",label:"Duplicate",category:"action",shortcut:Vv("edit.duplicate"),execute:()=>_ve(t)},{id:"editor.delete",label:"Delete Selected",category:"action",shortcut:Vv("edit.delete"),execute:()=>mve(t)},{id:"editor.select-all",label:"Select All",category:"action",shortcut:Vv("edit.selectAll"),execute:()=>kRt(t)},{id:"editor.deselect",label:"Deselect All",category:"action",shortcut:Vv("edit.deselectAll")??Vv("edit.exitScopeOrDeselect"),execute:()=>Ize(t,[])},{id:"toggle.console",label:"Toggle Console",category:"action",shortcut:Vv("view.toggleConsole"),execute:()=>{ave()}},{id:"view.focusMode",label:"Toggle Focus Mode",category:"action",shortcut:Vv("view.focusMode"),execute:()=>{MBe()}},...AN().map(q=>({id:`workspace.${q.id}`,label:`Workspace: ${q.title}`,category:"action",execute:()=>{Uk(q.id)&&s2(q.id)}})),{id:"workspace.cycleNext",label:"Next Workspace",category:"action",shortcut:Vv("workspace.cycleNext"),execute:()=>{She(1)}},{id:"workspace.cyclePrevious",label:"Previous Workspace",category:"action",shortcut:Vv("workspace.cyclePrevious"),execute:()=>{She(-1)}},...W4t().map(q=>({id:`keymap.${q.id}`,label:`Keymap: ${q.title}`,category:"action",execute:()=>{$Er(q.id)}})),...OR().map(q=>({id:`view.workspaceStyle.${q.id}`,label:`Workspace Style: ${q.title}`,category:"action",execute:()=>{HBe(q.id)}})),{id:"view.undoHistory",label:"Undo History",category:"action",execute:()=>{LVe()}},{id:"view.lightExplorer",label:"Open Light Explorer",category:"action",execute:()=>bC(nee.lightExplorer.id)},...Object.values(O_).filter(q=>q.id!==O_.open.id).map(q=>({id:q.id,label:`${q.id.replace("project-asset.","").split("-").map(G=>G[0]?.toUpperCase()+G.slice(1)).join(" ")} Project Asset`,category:"asset",...q.shortcut?{shortcut:q.shortcut.replace("Mod",d)}:{},execute:()=>{window.dispatchEvent(new CustomEvent("editor:project-asset-command",{detail:{id:q.id}}))}})),{id:"view.asset-library",label:"Asset Library",category:"action",execute:()=>{FBe("asset-library")}}]}function Ocn(t){return W0e(t).filter(n=>n.id!==kFe).map(n=>({id:`entity:${n.id}`,label:n.name,category:"entity",execute:()=>{Ize(t,[n.id]),RVe("viewport.frameSelection")}}))}function Rcn(){return Q0e().filter(t=>t.category==="canvas").map(({descriptor:t})=>({id:`board:${t.id}`,label:`Open ${t.title}`,category:"action",execute:()=>void SN(t.id)}))}function aN(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function Wge(t){const n=t.type;if(typeof n=="string")return n;if(Array.isArray(n))return n.find(s=>s!=="null")}function jMt(t){const n=aN(t);if("default"in n)return structuredClone(n.default);const s=Wge(n);if(s==="object"||n.properties){const c={};for(const[d,m]of Object.entries(aN(n.properties))){const g=aN(m);("default"in g||Array.isArray(n.required)&&n.required.includes(d))&&(c[d]=jMt(g))}return c}return s==="array"?[]:s==="boolean"?!1:s==="number"||s==="integer"?Number(n.minimum??0):""}function yje(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,n=>n.toUpperCase())}function Fcn({name:t,schema:n,value:s,required:c,onChange:d}){const m=Wge(n),g=typeof n.description=="string"?n.description:null,S=Array.isArray(n.enum)?n.enum:null,k=`tool-field:${t}`;if(m==="boolean")return $.jsxs("label",{style:{...VY,gridTemplateColumns:"18px minmax(0, 1fr)"},children:[$.jsx(TD,{id:k,checked:s===!0,onChange:F=>d(F.target.checked)}),$.jsxs("span",{children:[$.jsx("span",{style:ywt,children:yje(t)}),g&&$.jsx("span",{style:FO,children:g})]})]});const A=$.jsxs("span",{style:ywt,children:[yje(t)," ",!c&&$.jsx("span",{style:jcn,children:"optional"})]});return S?$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsxs(Iw,{id:k,value:String(s??""),onChange:F=>d(F.target.value),style:u_e,children:[!c&&$.jsx("option",{value:"",children:"Not set"}),S.map(F=>$.jsx("option",{value:String(F),children:String(F)},String(F)))]}),g&&$.jsx("span",{style:FO,children:g})]}):m==="number"||m==="integer"?$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsx(Zm,{id:k,type:"number",value:typeof s=="number"?s:"",min:typeof n.minimum=="number"?n.minimum:void 0,max:typeof n.maximum=="number"?n.maximum:void 0,step:m==="integer"?1:"any",onChange:F=>d(F.target.value===""?void 0:Number(F.target.value)),style:u_e}),g&&$.jsx("span",{style:FO,children:g})]}):m==="array"&&Wge(aN(n.items))==="string"?$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsx(Zm,{id:k,value:Array.isArray(s)?s.join(", "):"",onChange:F=>d(F.target.value.split(",").map(D=>D.trim()).filter(Boolean)),placeholder:"Comma-separated values",style:u_e}),g&&$.jsx("span",{style:FO,children:g})]}):$.jsxs("label",{style:VY,htmlFor:k,children:[A,$.jsx(Zm,{id:k,value:typeof s=="string"?s:"",onChange:F=>d(F.target.value||(c?"":void 0)),style:u_e}),g&&$.jsx("span",{style:FO,children:g})]})}function LMt({schema:t,value:n,onChange:s,path:c=""}){const d=aN(t.properties),m=new Set(Array.isArray(t.required)?t.required:[]);return $.jsx("div",{style:{display:"grid",gap:14},children:Object.entries(d).map(([g,S])=>{const k=aN(S),A=Wge(k),F=D=>{const J={...n};D===void 0?delete J[g]:J[g]=D,s(J)};return A==="object"||k.properties?$.jsxs("fieldset",{style:Lcn,children:[$.jsx("legend",{style:Bcn,children:yje(g)}),typeof k.description=="string"&&$.jsx("p",{style:{...FO,marginTop:0},children:k.description}),$.jsx(LMt,{schema:k,value:aN(n[g]),onChange:F,path:c?`${c}.${g}`:g})]},g):$.jsx(Fcn,{name:c?`${c}.${g}`:g,schema:k,value:n[g],required:m.has(g),onChange:F},g)})})}function Mcn({schema:t,value:n,onChange:s}){const c=aN(t);return c.properties?$.jsx(LMt,{schema:c,value:n,onChange:s}):$.jsx("div",{style:FO,children:"This schema has no form-compatible fields."})}const VY={display:"grid",gap:5},ywt={color:Zf[1],fontWeight:600,fontSize:"var(--volter-font-sm)"},jcn={color:Zf[3],fontWeight:400,marginLeft:5},FO={display:"block",color:Zf[2],fontSize:"var(--volter-font-sm)",lineHeight:1.4},u_e={boxSizing:"border-box",width:"100%"},Lcn={margin:0,padding:14,border:"1px solid var(--volter-boundary-default)",borderRadius:"var(--volter-radius-md)"},Bcn={padding:"0 6px",color:Zf[1],fontWeight:600},Hge="project-tools",vje="project-tool:";function $cn(t){return`${vje}${t}`}function gve(){ND({id:Hge,title:"Project Tools",kind:"project-tool",workspaceRole:"workspace-reference",Content:BMt,closeable:!0,presentation:()=>({kind:"workspace",id:Hge}),persist:()=>({catalog:!0})})}function yve(t){const n=N$().tools.find(c=>c.name===t);if(!n)return!1;const s=AC().filter(c=>c.tool?.name===t);return s.length===1?tA(s[0].id):(ND({id:$cn(t),title:n.summary||n.name,kind:"project-tool",workspaceRole:"workspace-reference",provenance:{sourcePath:n.sourcePath,origin:n.name},Content:BMt,closeable:!0,presentation:()=>({kind:"project-tool",name:t}),persist:()=>({name:t})}),!0)}kN({id:"workspace",owner:"project-tool-documents",open:(t,n)=>n.id!==Hge?null:(gve(),Hge)});kN({id:"project-tool",owner:"project-tool-documents",open:(t,n)=>yve(n.name)?e_():null,settle:async t=>{if(await WZ().catch(()=>{}),!await EC(()=>N$().tools.some(n=>n.name===t.name)))throw new Error(`Project tool is not registered: ${t.name}`)}});wee({kind:"project-tool",owner:"project-tool-documents",prepare:()=>WZ().then(()=>{},()=>{}),restore:({state:t})=>{const n=t;return n?.catalog===!0?(gve(),!0):typeof n?.name=="string"&&yve(n.name)}});function qcn(){return[{id:"project-tools:open",label:"Open Project Tools",category:"action",execute:()=>gve()},...N$().tools.map(t=>({id:`project-tool:${t.name}`,label:`Run: ${t.summary||t.name}`,category:"action",execute:()=>void yve(t.name)}))]}function vwt({value:t}){return $.jsx("pre",{style:Jcn,children:JSON.stringify(t,null,2)})}function BMt({documentId:t}){Ye.useSyncExternalStore(nMt,Vsn),Ye.useSyncExternalStore(l2,rA);const n=N$(),s=t.startsWith(vje)?t.slice(vje.length):null,c=s?n.tools.find(d=>d.name===s):null;return s?c?$.jsx(zcn,{tool:c},c.name):$.jsx("div",{style:bje,children:"This tool is no longer available."}):$.jsxs("div",{style:bje,"data-testid":"project-tools-catalog",children:[$.jsx("h2",{style:$Mt,children:"Project Tools"}),$.jsxs("p",{style:{...Sje,margin:"0 0 18px",maxWidth:720,lineHeight:1.5},children:["Explicitly registered in ",$.jsx("code",{children:"package.json#volter.tools"}),". Each tool is an ordinary project function; a registration may pair it with optional editor contributions."]}),$.jsx("div",{style:{display:"grid",gap:8},children:n.tools.map(d=>$.jsxs(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>yve(d.name),"data-testid":`project-command-card:${d.name}`,children:[$.jsxs("span",{style:qMt,children:[$.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:d.summary}),$.jsx("span",{style:zMt,children:"Open"})]}),$.jsx("code",{style:{color:Zf[2],fontSize:"var(--volter-font-sm)"},children:d.name}),$.jsx("span",{style:Vcn,children:$.jsxs("span",{children:[d.host," · ",d.permission.risk," · ",d.sourcePath]})})]},d.name))}),n.tools.length===0&&n.loadErrors.length===0&&$.jsx("div",{style:Sje,children:"No project tools registered."}),n.loadErrors.map(d=>$.jsxs("div",{style:Gge,children:[d.sourcePath,": ",d.message]},`${d.sourcePath}:${d.message}`)),e$e().map(d=>$.jsxs("div",{style:Gge,children:[d.entryPath,": ",d.error]},`${d.entryPath}:${d.error}`))]})}function zcn({tool:t}){const n=AC().filter(se=>se.tool?.name===t.name),s=jMt(t.inputSchema),[c,d]=Ye.useState(s&&typeof s=="object"&&!Array.isArray(s)?s:{}),[m,g]=Ye.useState(()=>JSON.stringify(c,null,2)),[S,k]=Ye.useState(null),[A,F]=Ye.useState(!1),[D,J]=Ye.useState(null),q=t.host==="node",G=async()=>{if(t.permission.risk==="read"||window.confirm(`${t.permission.summary}
1398
1398
 
1399
- Run ${t.name}?`)){F(!0);try{k(await Usn(t.name,c,{confirm:!0}))}catch(pe){k({ok:!1,error:{code:"REQUEST_FAILED",message:String(pe)}})}finally{F(!1)}}};return $.jsxs("div",{style:bje,"data-testid":`project-tool:${t.name}`,children:[$.jsx("h2",{style:$Mt,children:t.summary}),$.jsx("code",{style:{color:Zf[2]},children:t.name}),$.jsx("p",{style:{color:Zf[2]},children:t.description}),$.jsxs("div",{style:Sje,children:[t.host," · ",t.permission.risk," · ",t.sourcePath]}),n.length>0&&$.jsxs("section",{style:{marginTop:18,maxWidth:760},children:[$.jsx("h3",{style:{margin:"0 0 8px",fontSize:13},children:"Presentations"}),$.jsx("div",{style:{display:"grid",gap:8},children:n.map(se=>$.jsx(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>tA(se.id),children:$.jsxs("span",{style:qMt,children:[$.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:se.title}),$.jsx("span",{style:zMt,children:"Open"})]})},se.id))})]}),!q&&$.jsx("div",{style:Gge,children:"This runner supports Node-hosted tools. Import the underlying function directly in browser or runtime code."}),$.jsxs("details",{open:n.length===0,style:{marginTop:18,maxWidth:760},children:[$.jsx("summary",{style:{cursor:"pointer",color:Zf[2],fontSize:12},children:n.length>0?"Advanced · invoke native schema":"Input"}),$.jsx("section",{style:{marginTop:12},children:$.jsx(Mcn,{schema:t.inputSchema,value:c,onChange:se=>{d(se),g(JSON.stringify(se,null,2)),J(null)}})}),D&&$.jsx("div",{style:Gge,children:D}),$.jsx(Ms,{variant:"primary",disabled:!q||A||D!==null,"aria-busy":A,onClick:()=>void G(),style:{marginTop:16},children:A?"Running…":"Run tool"}),$.jsxs("details",{style:{marginTop:16},children:[$.jsx("summary",{style:SOe,children:"Advanced JSON"}),$.jsx(yBe,{id:`tool-input:${t.name}`,value:m,onChange:se=>{const pe=se.target.value;g(pe);try{const ue=JSON.parse(pe);if(!ue||typeof ue!="object"||Array.isArray(ue))throw new Error("Input must be a JSON object.");d(ue),J(null)}catch(ue){J(ue instanceof Error?ue.message:String(ue))}},rows:10,"data-variant":"code",style:Ucn}),$.jsxs("details",{children:[$.jsx("summary",{style:SOe,children:"Input schema"}),$.jsx(vwt,{value:t.inputSchema})]})]})]}),S!==null&&$.jsxs("section",{children:[$.jsx("div",{style:SOe,children:"Result"}),$.jsx(vwt,{value:S})]})]})}const bje={width:"100%",maxWidth:960,margin:"0 auto",padding:24,boxSizing:"border-box",overflow:"auto",pointerEvents:"auto",color:Zf[1],fontSize:"var(--volter-font-base)"},$Mt={margin:"0 0 6px",fontSize:20},Sje={color:Zf[2],fontSize:"var(--volter-font-sm)"},SOe={display:"block",margin:"14px 0 6px",color:Zf[1]},qMt={display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",gap:12},zMt={color:Zf[2],fontSize:"var(--volter-font-sm)",fontWeight:500},Vcn={display:"flex",width:"100%",minWidth:0,alignItems:"center",justifyContent:"space-between",gap:12,color:Zf[2],fontSize:"var(--volter-font-sm)"},Gge={marginTop:10,color:C_e,whiteSpace:"pre-wrap"},Ucn={width:"100%",boxSizing:"border-box",resize:"vertical"},Jcn={overflow:"auto",padding:10,background:hBe.inset,border:`1px solid ${nhe[1]}`,borderRadius:sQ.sm,color:Zf[2]};function Wcn(t,n,s){const c=Ncn(t,n,s),d=[...qcn(),...Rcn(),...mkr()],m=Ocn(t),g=lCt().map(S=>({id:S.id,label:S.label,category:"action",shortcut:S.shortcut?Vv(S.shortcut):void 0,execute:S.execute}));return[...c,...d,...g,...Kcn(),...m]}const Hcn=["view","window","debug","tools","help"],Gcn={view:"View",window:"Window",debug:"Debug",tools:"Tools",help:"Help"};function Kcn(){return Hcn.flatMap(t=>uLe(t).map(n=>{const s=typeof n.label=="function"?n.label():n.label,c=`${Gcn[t]}: ${s}`;return{id:n.id,label:c,category:"action",menu:{id:t,label:s},execute:()=>{if(n.disabled?.({})){i0(`${c} is not available right now.`);return}return n.execute({})}}}))}function Xcn(t){return t.map(n=>`${n.id}\0${n.label}\0${n.menu?.id??""}`).join("")}function Ycn(){const t=Yv(),n=lve(),s=K9t(),c=Ye.useSyncExternalStore(lLe,YB,YB),d=Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),m=Ye.useSyncExternalStore(EDt,Ehe,Ehe),g=Ye.useSyncExternalStore(Uye,fhe,fhe),S=Ye.useMemo(()=>Wcn(t,n,s),[t,n,s,c,d,m,g]),k=Ye.useRef(null);return Ye.useEffect(()=>{const A=Xcn(S);A!==k.current&&(k.current=A,wxt(S.map(F=>({id:F.id,label:F.label,category:F.category,run:F.execute,...F.menu?{menu:F.menu}:{}}))))},[S]),Ye.useEffect(()=>()=>{k.current=null,wxt([])},[]),null}let VMt=[];const xje=new Set;function Zcn(t){return xje.add(t),()=>xje.delete(t)}function Qcn(){return VMt}function eln(){for(const t of xje)t()}function tln(t){return`Starter asset "${t.key}" (pack "${t.pack}") did not materialize into ${t.dest}: ${t.reason} Nothing was written for it — features that read that file degrade (a missing clips GLB leaves the character standing without locomotion clips). Use Retry once the cause is fixed.`}function rln(t){const n=t.failed.map(s=>({key:s.entry.key,dest:s.entry.dest,pack:s.entry.pack,reason:s.reason}));for(const s of n)ea.error(tln(s),"assets");VMt=n,eln()}async function nln(t){try{const{materializeDeclaredAssetPacks:n}=await fo(async()=>{const{materializeDeclaredAssetPacks:c}=await import("./hosted-asset-materialization-DBLM2dtz.js");return{materializeDeclaredAssetPacks:c}},__vite__mapDeps([262,102,3,2,4,1,20,21,22,23])),s=await n(t);rln(s)}catch(n){ea.error(`Retrying asset materialization failed before any entry was attempted: ${n instanceof Error?n.message:String(n)}`,"assets")}}let UMt={kind:"quiet"},JMt=0;const wje=new Set;function iln(){return UMt}function oln(t){UMt=t,JMt+=1;for(const n of wje)n()}function sln(t){return wje.add(t),()=>wje.delete(t)}function bwt(){return JMt}const aln=()=>()=>{},Swt=()=>null;function cln(){const t=Yv(),n=Asn();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),Ye.useSyncExternalStore(n?.subscribe??aln,n?.getSnapshot??Swt,n?.getSnapshot??Swt);const s=ERt(t);if(s==="saved")return null;const c=Dze(t),d=s==="failed",m=d?RYr(t):null,g=d?{label:"Save failed",title:m?`Save failed: ${m} — click to open Console`:"Save failed — click to open Console"}:{label:"Unsaved",title:"Unsaved changes — click to save (Cmd/Ctrl+S)"},S=c?`${g.title} — ${c}`:g.title;return $.jsxs(Ms,{type:"button","data-testid":"save-status","data-save-state":s,variant:"ghost",size:"compact",className:"volter-save-status",onClick:()=>d?cve():void ARt(t),title:S,children:[$.jsx("span",{className:"volter-save-status-dot"}),g.label]})}function lln(){Ye.useSyncExternalStore(ea.subscribe,ea.getSnapshot);const t=ea.counts,n=[{id:"info",icon:R$,label:"message",count:t.info},{id:"warn",icon:WTt,label:"warning",count:t.warn},{id:"error",icon:NTt,label:"error",count:t.error}];return $.jsx("span",{className:"volter-console-status-counts","data-testid":"status-console-counts",children:n.map(s=>$.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action volter-console-status-count","data-testid":`status-console-${s.id}`,"data-console-level":s.id,"data-has-count":s.count>0?!0:void 0,"data-has-errors":s.id==="error"&&s.count>0?!0:void 0,onClick:()=>cve(),title:`${s.count} console ${s.label}${s.count===1?"":"s"} — open Console`,children:[$.jsx(dc,{icon:s.icon,size:"xs"}),s.count]},s.id))})}function uln(t){return[...t.map(s=>`"${s.worldId}" (${s.kind} / ${s.identity}) — ${s.message}`),"See the Console for the full trace."].join(`
1399
+ Run ${t.name}?`)){F(!0);try{k(await Usn(t.name,c,{confirm:!0}))}catch(pe){k({ok:!1,error:{code:"REQUEST_FAILED",message:String(pe)}})}finally{F(!1)}}};return $.jsxs("div",{style:bje,"data-testid":`project-tool:${t.name}`,children:[$.jsx("h2",{style:$Mt,children:t.summary}),$.jsx("code",{style:{color:Zf[2]},children:t.name}),$.jsx("p",{style:{color:Zf[2]},children:t.description}),$.jsxs("div",{style:Sje,children:[t.host," · ",t.permission.risk," · ",t.sourcePath]}),n.length>0&&$.jsxs("section",{style:{marginTop:18,maxWidth:760},children:[$.jsx("h3",{style:{margin:"0 0 8px",fontSize:13},children:"Presentations"}),$.jsx("div",{style:{display:"grid",gap:8},children:n.map(se=>$.jsx(Ms,{variant:"ghost",className:"volter-project-tool-card",onClick:()=>tA(se.id),children:$.jsxs("span",{style:qMt,children:[$.jsx("strong",{style:{color:Zf[1],fontWeight:600},children:se.title}),$.jsx("span",{style:zMt,children:"Open"})]})},se.id))})]}),!q&&$.jsx("div",{style:Gge,children:"This runner supports Node-hosted tools. Import the underlying function directly in browser or runtime code."}),$.jsxs("details",{open:n.length===0,style:{marginTop:18,maxWidth:760},children:[$.jsx("summary",{style:{cursor:"pointer",color:Zf[2],fontSize:12},children:n.length>0?"Advanced · invoke native schema":"Input"}),$.jsx("section",{style:{marginTop:12},children:$.jsx(Mcn,{schema:t.inputSchema,value:c,onChange:se=>{d(se),g(JSON.stringify(se,null,2)),J(null)}})}),D&&$.jsx("div",{style:Gge,children:D}),$.jsx(Ms,{variant:"primary",disabled:!q||A||D!==null,"aria-busy":A,onClick:()=>void G(),style:{marginTop:16},children:A?"Running…":"Run tool"}),$.jsxs("details",{style:{marginTop:16},children:[$.jsx("summary",{style:SOe,children:"Advanced JSON"}),$.jsx(yBe,{id:`tool-input:${t.name}`,value:m,onChange:se=>{const pe=se.target.value;g(pe);try{const ue=JSON.parse(pe);if(!ue||typeof ue!="object"||Array.isArray(ue))throw new Error("Input must be a JSON object.");d(ue),J(null)}catch(ue){J(ue instanceof Error?ue.message:String(ue))}},rows:10,"data-variant":"code",style:Ucn}),$.jsxs("details",{children:[$.jsx("summary",{style:SOe,children:"Input schema"}),$.jsx(vwt,{value:t.inputSchema})]})]})]}),S!==null&&$.jsxs("section",{children:[$.jsx("div",{style:SOe,children:"Result"}),$.jsx(vwt,{value:S})]})]})}const bje={width:"100%",maxWidth:960,margin:"0 auto",padding:24,boxSizing:"border-box",overflow:"auto",pointerEvents:"auto",color:Zf[1],fontSize:"var(--volter-font-base)"},$Mt={margin:"0 0 6px",fontSize:20},Sje={color:Zf[2],fontSize:"var(--volter-font-sm)"},SOe={display:"block",margin:"14px 0 6px",color:Zf[1]},qMt={display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",gap:12},zMt={color:Zf[2],fontSize:"var(--volter-font-sm)",fontWeight:500},Vcn={display:"flex",width:"100%",minWidth:0,alignItems:"center",justifyContent:"space-between",gap:12,color:Zf[2],fontSize:"var(--volter-font-sm)"},Gge={marginTop:10,color:C_e,whiteSpace:"pre-wrap"},Ucn={width:"100%",boxSizing:"border-box",resize:"vertical"},Jcn={overflow:"auto",padding:10,background:hBe.inset,border:`1px solid ${nhe[1]}`,borderRadius:sQ.sm,color:Zf[2]};function Wcn(t,n,s){const c=Ncn(t,n,s),d=[...qcn(),...Rcn(),...mkr()],m=Ocn(t),g=lCt().map(S=>({id:S.id,label:S.label,category:"action",shortcut:S.shortcut?Vv(S.shortcut):void 0,execute:S.execute}));return[...c,...d,...g,...Kcn(),...m]}const Hcn=["view","window","debug","tools","help"],Gcn={view:"View",window:"Window",debug:"Debug",tools:"Tools",help:"Help"};function Kcn(){return Hcn.flatMap(t=>uLe(t).map(n=>{const s=typeof n.label=="function"?n.label():n.label,c=`${Gcn[t]}: ${s}`;return{id:n.id,label:c,category:"action",menu:{id:t,label:s},execute:()=>{if(n.disabled?.({})){i0(`${c} is not available right now.`);return}return n.execute({})}}}))}function Xcn(t){return t.map(n=>`${n.id}\0${n.label}\0${n.menu?.id??""}`).join("")}function Ycn(){const t=Yv(),n=lve(),s=K9t(),c=Ye.useSyncExternalStore(lLe,YB,YB),d=Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),m=Ye.useSyncExternalStore(EDt,Ehe,Ehe),g=Ye.useSyncExternalStore(Uye,fhe,fhe),S=Ye.useMemo(()=>Wcn(t,n,s),[t,n,s,c,d,m,g]),k=Ye.useRef(null);return Ye.useEffect(()=>{const A=Xcn(S);A!==k.current&&(k.current=A,wxt(S.map(F=>({id:F.id,label:F.label,category:F.category,run:F.execute,...F.menu?{menu:F.menu}:{}}))))},[S]),Ye.useEffect(()=>()=>{k.current=null,wxt([])},[]),null}let VMt=[];const xje=new Set;function Zcn(t){return xje.add(t),()=>xje.delete(t)}function Qcn(){return VMt}function eln(){for(const t of xje)t()}function tln(t){return`Starter asset "${t.key}" (pack "${t.pack}") did not materialize into ${t.dest}: ${t.reason} Nothing was written for it — features that read that file degrade (a missing clips GLB leaves the character standing without locomotion clips). Use Retry once the cause is fixed.`}function rln(t){const n=t.failed.map(s=>({key:s.entry.key,dest:s.entry.dest,pack:s.entry.pack,reason:s.reason}));for(const s of n)ea.error(tln(s),"assets");VMt=n,eln()}async function nln(t){try{const{materializeDeclaredAssetPacks:n}=await fo(async()=>{const{materializeDeclaredAssetPacks:c}=await import("./hosted-asset-materialization-TryBlckx.js");return{materializeDeclaredAssetPacks:c}},__vite__mapDeps([263,102,3,2,4,1,20,21,22,23])),s=await n(t);rln(s)}catch(n){ea.error(`Retrying asset materialization failed before any entry was attempted: ${n instanceof Error?n.message:String(n)}`,"assets")}}let UMt={kind:"quiet"},JMt=0;const wje=new Set;function iln(){return UMt}function oln(t){UMt=t,JMt+=1;for(const n of wje)n()}function sln(t){return wje.add(t),()=>wje.delete(t)}function bwt(){return JMt}const aln=()=>()=>{},Swt=()=>null;function cln(){const t=Yv(),n=Asn();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),Ye.useSyncExternalStore(n?.subscribe??aln,n?.getSnapshot??Swt,n?.getSnapshot??Swt);const s=ERt(t);if(s==="saved")return null;const c=Dze(t),d=s==="failed",m=d?RYr(t):null,g=d?{label:"Save failed",title:m?`Save failed: ${m} — click to open Console`:"Save failed — click to open Console"}:{label:"Unsaved",title:"Unsaved changes — click to save (Cmd/Ctrl+S)"},S=c?`${g.title} — ${c}`:g.title;return $.jsxs(Ms,{type:"button","data-testid":"save-status","data-save-state":s,variant:"ghost",size:"compact",className:"volter-save-status",onClick:()=>d?cve():void ARt(t),title:S,children:[$.jsx("span",{className:"volter-save-status-dot"}),g.label]})}function lln(){Ye.useSyncExternalStore(ea.subscribe,ea.getSnapshot);const t=ea.counts,n=[{id:"info",icon:R$,label:"message",count:t.info},{id:"warn",icon:WTt,label:"warning",count:t.warn},{id:"error",icon:NTt,label:"error",count:t.error}];return $.jsx("span",{className:"volter-console-status-counts","data-testid":"status-console-counts",children:n.map(s=>$.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action volter-console-status-count","data-testid":`status-console-${s.id}`,"data-console-level":s.id,"data-has-count":s.count>0?!0:void 0,"data-has-errors":s.id==="error"&&s.count>0?!0:void 0,onClick:()=>cve(),title:`${s.count} console ${s.label}${s.count===1?"":"s"} — open Console`,children:[$.jsx(dc,{icon:s.icon,size:"xs"}),s.count]},s.id))})}function uln(t){return[...t.map(s=>`"${s.worldId}" (${s.kind} / ${s.identity}) — ${s.message}`),"See the Console for the full trace."].join(`
1400
1400
  `)}function fln(){const t=Ye.useSyncExternalStore(CRt,zQ);return t.length===0?null:$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-mount-failure","data-status-tone":"danger",onClick:()=>cve(),title:uln(t),children:t.length===1?"1 world failed to mount":`${t.length} worlds failed to mount`})}function dln(t){return[...t.map(s=>`${s.dest} — ${s.reason}`),"Nothing was written for them, so features that read those files degrade.","See the Console (subsystem `assets`) for the full lines."].join(`
1401
- `)}function pln(){const t=Ye.useSyncExternalStore(Zcn,Qcn),[n,s]=Ye.useState(!1),c=Ye.useCallback(()=>{s(!0),nln(gR()).finally(()=>s(!1))},[]);return t.length===0?null:$.jsxs($.Fragment,{children:[$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization","data-status-tone":"danger",onClick:()=>cve(),title:dln(t),children:t.length===1?"1 starter asset did not download":`${t.length} starter assets did not download`}),$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization-retry",disabled:n,onClick:c,children:n?"Retrying…":"Retry"})]})}function _ln(){const t=JEr(),n=Yv();if(Ye.useSyncExternalStore(n.subscribe,n.getShellSnapshot??n.getSnapshot),!t)return null;const s=n.playState,c={stopped:{label:"Play stopped",tone:void 0},playing:{label:"Playing",tone:"success"},paused:{label:"Paused",tone:"warning"}}[s];return $.jsx("span",{className:"volter-status-copy","data-testid":"status-play-state","data-play-state":s,"data-status-tone":c.tone,children:c.label})}function mln(){Ye.useSyncExternalStore(sln,bwt,bwt);const t=iln();if(t.kind==="quiet")return null;const n=t.kind==="void"?"error":"warning",s=t.kind==="void"?t.reason==="taken-over"?"Editor yielded":"Editor disconnected":t.subject==="busy"?"Editor slow":"Editor stale";return $.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-editor-lease","data-lease-state":t.kind,"data-tone":n,onClick:()=>window.location.reload(),title:t.kind==="void"&&t.reloadOffered?"The editor is served here again — reload":"The editor server is not answering — reload once it is served here again",children:[$.jsx(dc,{icon:n==="error"?Kk.status.error:Kk.status.warning})," ",s]})}function hln(){Ye.useSyncExternalStore(Jye,fkr);const t=SC().filter(n=>n.section==="project");return t.length===0?null:$.jsx($.Fragment,{children:t.map(n=>$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":`status-project-utility-${n.id}`,onClick:()=>bC(n.id),title:`Open the ${n.title} drawer tab (this project's own face)`,children:n.title},n.id))})}const gln=Iye();function yln(){gln.ensure(t=>{t(Z4({id:"editor-lease",name:"Editor server",align:"left",order:-90,Content:mln})),t(Z4({id:"save-status",name:"Save state",align:"left",order:0,Content:cln})),t(Z4({id:"console-counts",name:"Console errors and warnings",align:"left",order:10,Content:lln})),t(Z4({id:"mount-failure",name:"Mount failure",align:"left",order:5,Content:fln})),t(Z4({id:"asset-materialization",name:"Asset materialization",align:"left",order:15,Content:pln})),t(Z4({id:"play-state",name:"Play state",align:"left",order:20,Content:_ln})),t(Z4({id:"project-utilities",name:"Project utilities",align:"left",order:25,Content:hln}))})}const vln=Ye.lazy(async()=>({default:(await fo(()=>import("./NonThreeAuthoringBootstrap-BqY5ceef.js"),__vite__mapDeps([263,3,2,4,264,89,1,20,21,22,23]))).ProjectAuthoringBootstrap}));function bln(){const t=Yv(),n=G9t(),s=lve();return Ye.use(ksn()),Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),Xan(t),Ye.useEffect(()=>yln(),[]),Ye.useEffect(()=>_cn(),[]),Ye.useEffect(()=>lsn(n),[n]),Ye.useEffect(()=>Jan(),[]),Ye.useEffect(()=>_kr(),[t]),Ye.useEffect(()=>btn(),[t]),Ye.useEffect(()=>j4r(n),[n]),Ye.useEffect(()=>Van(t,s),[t,s]),Ye.useEffect(()=>yYr(t),[t]),Ye.useEffect(()=>ien(()=>window.dispatchEvent(new CustomEvent("editor:assets-changed")),c=>window.dispatchEvent(new CustomEvent("editor:assets-changed",{detail:c}))),[]),$.jsxs($.Fragment,{children:[$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(vln,{store:t})}),$.jsx(kcn,{}),$.jsx(Kan,{}),$.jsx(Ycn,{})]})}const Sln=3,xln=1e4,wln=4e3;function Tln(t){return{bootIdentity:null,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:t}}function xwt(t,n,s,c){if(!n.ok){const d=s==="open";return{...t,lastIdentity:null,consecutiveFailures:t.consecutiveFailures+1,unbackedFailures:d?0:t.unbackedFailures+1,darkSince:d?c:t.darkSince}}return{bootIdentity:t.bootIdentity??n.identity,lastIdentity:n.identity,consecutiveFailures:0,unbackedFailures:0,darkSince:c}}function Cln(t,n){return{bootIdentity:t.bootIdentity,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:n}}function WMt(t,n){return!(t.project!==null&&n.project!==null&&t.project!==n.project||t.pid!==null&&n.pid!==null&&t.pid!==n.pid)}function Eln(t){const{consecutiveFailures:n,unbackedFailures:s,failureThreshold:c,darkForMs:d,minDarkWindowMs:m,bootIdentity:g,lastIdentity:S}=t;return g&&S&&!WMt(g,S)?{status:"void",reason:"taken-over"}:n>=c?s>=c&&d>=m?{status:"void",reason:"server-gone"}:{status:"degraded",reason:null}:{status:"live",reason:null}}function kln(t,n){return!t?.project||!n.project?!1:n.project===t.project}function Aln(t,n){if(!n.ok)return"none";const s=n.identity;return t&&t.pid!==null&&s.pid===t.pid&&WMt(t,s)?"resume":kln(t,s)?"reload":t?.project?"none":"offer-reload"}const Kge="volter.editor.orphaned-tab.v1";function Dln(t){if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!="object"||n===null)return null;const s=n;if(typeof s.at!="number"||!Number.isFinite(s.at)||s.reason!=="server-gone")return null;const c=typeof s.project=="string"?s.project:null;return{at:s.at,reason:s.reason,project:c}}function Pln(t){return JSON.stringify(t)}function Iln(t,n){const s=Math.max(0,Math.round((n-t.at)/1e3)),c=s<90?`${s}s ago`:s<5400?`${Math.round(s/60)}m ago`:`${Math.round(s/3600)}h ago`,d=t.project?` on ${t.project}`:"";return`A previous editor window at this address lost its server ${c}${d} and was left orphaned. If that window is still open it is a stale snapshot — nothing in it is saved and every click in it hangs on retries. Close it; this window is the live one.`}const Nln=720*60*1e3;function Oln(t,n){const s=n-t.at;return s>=0&&s<=Nln}function qVe(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Rln(t,n=qVe()){try{n?.setItem(Kge,Pln(t))}catch{}}function Fln(t=qVe()){if(!t)return null;try{const n=Dln(t.getItem(Kge));return t.removeItem(Kge),n}catch{return null}}function Mln(t=qVe()){try{t?.removeItem(Kge)}catch{}}function jln(t){return t?t.split(/[\\/]/).filter(Boolean).at(-1)??null:null}async function Lln(){try{const{stopAllLiveSessions:t}=await fo(async()=>{const{stopAllLiveSessions:n}=await Promise.resolve().then(()=>crn);return{stopAllLiveSessions:n}},void 0);t()}catch{}}function Bln(){const[t,n]=Ye.useState({kind:"quiet"}),s=Ye.useRef(Tln(Date.now())),c=Ye.useRef(null),d=Ye.useRef(!1);return Ye.useEffect(()=>{let m=!1,g=null;const S=()=>{g!==null&&(clearInterval(g),g=null)},k=async pe=>{c.current=pe,NRt(pe),pe==="taken-over"&&S(),pe==="server-gone"&&Rln({at:Date.now(),reason:"server-gone",project:s.current.bootIdentity?.project??null}),n(d.current?{kind:"degraded",subject:"stale"}:{kind:"void",reason:pe,reloadOffered:!1}),await Lln()},A=(pe,ue,Ce)=>{switch(Aln(s.current.bootIdentity,pe)){case"resume":{c.current=null,ZYr(),Mln(),s.current=xwt(s.current,pe,ue,Ce),n({kind:"quiet"});return}case"reload":if(d.current)return;window.location.reload();return;case"offer-reload":n(Fe=>Fe.kind==="void"&&!Fe.reloadOffered?{...Fe,reloadOffered:!0}:Fe);return;default:return}},F=async()=>{const pe=await RZr(),ue=gZr(),Ce=Date.now();if(m)return;if(c.current!==null){A(pe,ue,Ce);return}s.current=xwt(s.current,pe,ue,Ce);const Fe=Eln({consecutiveFailures:s.current.consecutiveFailures,unbackedFailures:s.current.unbackedFailures,failureThreshold:Sln,darkForMs:Ce-s.current.darkSince,minDarkWindowMs:xln,bootIdentity:s.current.bootIdentity,lastIdentity:s.current.lastIdentity});if(Fe.status==="void"&&Fe.reason!==null){await k(Fe.reason);return}n(Fe.status==="degraded"?{kind:"degraded",subject:"busy"}:{kind:"quiet"})};let D=!1;const J=()=>{D||m||(D=!0,F().finally(()=>{D=!1}))},q=()=>{m||(c.current===null&&(s.current=Cln(s.current,Date.now())),J())},G=()=>{document.visibilityState==="visible"&&q()};document.addEventListener("visibilitychange",G),window.addEventListener("pageshow",q);let se=null;try{const pe=jD();pe.addEventListener("error",J),pe.addEventListener("open",J),se=pe}catch{}return g=setInterval(J,wln),()=>{m=!0,S(),document.removeEventListener("visibilitychange",G),window.removeEventListener("pageshow",q),se?.close()}},[]),Ye.useEffect(()=>{oln(t);const m=jln(s.current.bootIdentity?.project??null),g=()=>{d.current=!0,n({kind:"degraded",subject:"stale"})};if(t.kind==="quiet"){xBe(xOe);return}if(t.kind==="degraded"){s$({id:xOe,tone:"warning",sticky:!0,...t.subject==="busy"?{title:"Editor server is slow to answer.",detail:"Still connected — this window keeps working, and this clears itself when the server catches up."}:{title:"This window's editor server has stopped.",detail:"You chose to keep reading it — nothing here saves, and it will not reconnect on its own. Reload once the editor is served here again.",actions:[{label:"Reload",primary:!0,run:()=>window.location.reload()}]}});return}s$({id:xOe,tone:"error",sticky:!0,title:"Editor disconnected.",detail:t.reason==="taken-over"?`${m?`${m}'s`:"This project's"} editor is now running in another window. This one has yielded.`:`This window's editor server has stopped — nothing here is saved, and a running game has left its room. Reopen with ${DB(`edit ${m??"<project>"}`)}${m?`, or leave this window open: it reloads by itself when ${m}'s editor is served here again.`:"."}`,onDismiss:()=>{d.current||g()},actions:[...t.reloadOffered?[{label:"Reload",primary:!0,run:()=>window.location.reload()}]:[],{label:"Close window",run:()=>window.close()},{label:"Continue anyway",run:g}]})},[t]),null}const xOe="editor-lease",$ln="0.5.71",qln={version:$ln},zln="0.5.71",Vln={version:zln},HMt=Vln.version,Uln=qln.version;function Jln({error:t,onDismiss:n,onRetry:s,startup:c=!1}){const d=t.recovery&&"verbs"in t.recovery?ePt(t.recovery.verbs):null,[m,g]=Ye.useState(!1);return Ye.useEffect(()=>{if(!m)return;const S=window.setTimeout(()=>g(!1),1600);return()=>window.clearTimeout(S)},[m]),$.jsxs("div",{role:"alert",className:"volter-error-card volter-shell-rise",children:[$.jsx("div",{className:"volter-error-card-icon","aria-hidden":"true",children:$.jsx(dc,{icon:fee})}),$.jsxs("div",{className:"volter-error-card-body",children:[c?$.jsx("h1",{className:"volter-error-card-title",children:t.recovery?.title??"Couldn’t open this project"}):t.recovery&&$.jsx("div",{className:"volter-error-card-title",children:t.recovery.title}),t.recovery&&$.jsx("p",{className:"volter-error-card-guidance",children:t.recovery.guidance}),$.jsx("div",{className:"volter-error-card-message","data-testid":c?"project-startup-error-details":void 0,children:t.message}),d&&$.jsxs("div",{children:[c&&$.jsx("div",{className:"volter-error-card-recovery-label",children:"RUN FROM THE PROJECT FOLDER"}),$.jsxs("div",{className:"volter-error-card-command",children:[$.jsx("code",{"data-testid":c?"project-startup-recovery-command":"project-screen-recovery-command",children:d}),$.jsxs(Ms,{type:"button",variant:"secondary",size:"compact",onClick:()=>{navigator.clipboard?.writeText(d),g(!0)},children:[$.jsx(dc,{icon:m?tLe:q0r,"aria-hidden":"true"}),m?"Copied":"Copy"]})]})]}),$.jsxs("div",{className:"volter-error-card-actions",children:[s&&$.jsx(Ms,{type:"button",variant:"primary",className:"volter-shell-cta","data-testid":"retry-project-detection",onClick:s,children:"Retry"}),n&&$.jsx(Ms,{type:"button",variant:"ghost",className:"volter-shell-cta","aria-label":"Dismiss error",onClick:n,children:"Dismiss"})]})]})]})}function Tje({error:t,report:n,onRetry:s}){return $.jsx("div",{className:"volter-shell","data-testid":"project-detection-error",children:$.jsxs("div",{className:"volter-shell-container","data-view":"startup-error",children:[$.jsx("header",{className:"volter-shell-header",children:$.jsxs("span",{className:"volter-shell-brand-static",children:[$.jsx("span",{className:"volter-shell-brand-mark","aria-hidden":"true",children:$.jsx($Ve,{size:30})}),$.jsx("span",{className:"volter-shell-wordmark",children:mR.name})]})}),$.jsx(Jln,{error:t,onRetry:s,startup:!0}),n?.projectPath&&$.jsx("div",{className:"volter-shell-notice","data-testid":"project-startup-serving",children:$.jsxs("span",{children:["This editor server is serving"," ",$.jsx("code",{"data-testid":"project-startup-serving-path",children:n.projectPath})," — the project exists; the editor could not read it. Fix the file it names above and press Retry."]})}),$.jsx("footer",{className:"volter-shell-footer",children:$.jsxs("span",{className:"volter-chip","data-variant":"tag",children:["Editor v",HMt," · Engine v",Uln]})})]})})}function Wln({wait:t}={}){return $.jsx("main",{role:"status","aria-live":"polite","aria-label":"Opening project","data-testid":"startup-loading-screen",className:"volter-splash",children:$.jsxs("div",{className:"volter-splash-stack",children:[$.jsx("div",{"aria-hidden":"true",className:"volter-splash-logo",children:$.jsx($Ve,{size:72})}),$.jsx("div",{className:"volter-splash-title",children:mR.name}),$.jsx("div",{"aria-hidden":"true",className:"volter-splash-progress"}),t?$.jsxs($.Fragment,{children:[$.jsx("div",{className:"volter-splash-status","data-testid":"startup-wait-status",children:`Asking the server which project it serves — ${t.seconds}s`}),$.jsx("div",{className:"volter-splash-note",children:"Still trying. The first boot of a fresh checkout can take a while, so this keeps asking until the server answers."}),t.detail?$.jsxs("div",{className:"volter-splash-note",children:["Last attempt: ",t.detail]}):null]}):$.jsx("div",{className:"volter-splash-status",children:"Opening project…"})]})})}class Hln extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){ea.error(`Editor chrome crashed while the command listener stayed attached: ${n.message}
1401
+ `)}function pln(){const t=Ye.useSyncExternalStore(Zcn,Qcn),[n,s]=Ye.useState(!1),c=Ye.useCallback(()=>{s(!0),nln(gR()).finally(()=>s(!1))},[]);return t.length===0?null:$.jsxs($.Fragment,{children:[$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization","data-status-tone":"danger",onClick:()=>cve(),title:dln(t),children:t.length===1?"1 starter asset did not download":`${t.length} starter assets did not download`}),$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-asset-materialization-retry",disabled:n,onClick:c,children:n?"Retrying…":"Retry"})]})}function _ln(){const t=JEr(),n=Yv();if(Ye.useSyncExternalStore(n.subscribe,n.getShellSnapshot??n.getSnapshot),!t)return null;const s=n.playState,c={stopped:{label:"Play stopped",tone:void 0},playing:{label:"Playing",tone:"success"},paused:{label:"Paused",tone:"warning"}}[s];return $.jsx("span",{className:"volter-status-copy","data-testid":"status-play-state","data-play-state":s,"data-status-tone":c.tone,children:c.label})}function mln(){Ye.useSyncExternalStore(sln,bwt,bwt);const t=iln();if(t.kind==="quiet")return null;const n=t.kind==="void"?"error":"warning",s=t.kind==="void"?t.reason==="taken-over"?"Editor yielded":"Editor disconnected":t.subject==="busy"?"Editor slow":"Editor stale";return $.jsxs(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":"status-editor-lease","data-lease-state":t.kind,"data-tone":n,onClick:()=>window.location.reload(),title:t.kind==="void"&&t.reloadOffered?"The editor is served here again — reload":"The editor server is not answering — reload once it is served here again",children:[$.jsx(dc,{icon:n==="error"?Kk.status.error:Kk.status.warning})," ",s]})}function hln(){Ye.useSyncExternalStore(Jye,fkr);const t=SC().filter(n=>n.section==="project");return t.length===0?null:$.jsx($.Fragment,{children:t.map(n=>$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-status-action","data-testid":`status-project-utility-${n.id}`,onClick:()=>bC(n.id),title:`Open the ${n.title} drawer tab (this project's own face)`,children:n.title},n.id))})}const gln=Iye();function yln(){gln.ensure(t=>{t(Z4({id:"editor-lease",name:"Editor server",align:"left",order:-90,Content:mln})),t(Z4({id:"save-status",name:"Save state",align:"left",order:0,Content:cln})),t(Z4({id:"console-counts",name:"Console errors and warnings",align:"left",order:10,Content:lln})),t(Z4({id:"mount-failure",name:"Mount failure",align:"left",order:5,Content:fln})),t(Z4({id:"asset-materialization",name:"Asset materialization",align:"left",order:15,Content:pln})),t(Z4({id:"play-state",name:"Play state",align:"left",order:20,Content:_ln})),t(Z4({id:"project-utilities",name:"Project utilities",align:"left",order:25,Content:hln}))})}const vln=Ye.lazy(async()=>({default:(await fo(()=>import("./NonThreeAuthoringBootstrap-BHOfZ9sF.js"),__vite__mapDeps([264,3,2,4,265,89,1,20,21,22,23]))).ProjectAuthoringBootstrap}));function bln(){const t=Yv(),n=G9t(),s=lve();return Ye.use(ksn()),Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot),Xan(t),Ye.useEffect(()=>yln(),[]),Ye.useEffect(()=>_cn(),[]),Ye.useEffect(()=>lsn(n),[n]),Ye.useEffect(()=>Jan(),[]),Ye.useEffect(()=>_kr(),[t]),Ye.useEffect(()=>btn(),[t]),Ye.useEffect(()=>j4r(n),[n]),Ye.useEffect(()=>Van(t,s),[t,s]),Ye.useEffect(()=>yYr(t),[t]),Ye.useEffect(()=>ien(()=>window.dispatchEvent(new CustomEvent("editor:assets-changed")),c=>window.dispatchEvent(new CustomEvent("editor:assets-changed",{detail:c}))),[]),$.jsxs($.Fragment,{children:[$.jsx(Ye.Suspense,{fallback:null,children:$.jsx(vln,{store:t})}),$.jsx(kcn,{}),$.jsx(Kan,{}),$.jsx(Ycn,{})]})}const Sln=3,xln=1e4,wln=4e3;function Tln(t){return{bootIdentity:null,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:t}}function xwt(t,n,s,c){if(!n.ok){const d=s==="open";return{...t,lastIdentity:null,consecutiveFailures:t.consecutiveFailures+1,unbackedFailures:d?0:t.unbackedFailures+1,darkSince:d?c:t.darkSince}}return{bootIdentity:t.bootIdentity??n.identity,lastIdentity:n.identity,consecutiveFailures:0,unbackedFailures:0,darkSince:c}}function Cln(t,n){return{bootIdentity:t.bootIdentity,lastIdentity:null,consecutiveFailures:0,unbackedFailures:0,darkSince:n}}function WMt(t,n){return!(t.project!==null&&n.project!==null&&t.project!==n.project||t.pid!==null&&n.pid!==null&&t.pid!==n.pid)}function Eln(t){const{consecutiveFailures:n,unbackedFailures:s,failureThreshold:c,darkForMs:d,minDarkWindowMs:m,bootIdentity:g,lastIdentity:S}=t;return g&&S&&!WMt(g,S)?{status:"void",reason:"taken-over"}:n>=c?s>=c&&d>=m?{status:"void",reason:"server-gone"}:{status:"degraded",reason:null}:{status:"live",reason:null}}function kln(t,n){return!t?.project||!n.project?!1:n.project===t.project}function Aln(t,n){if(!n.ok)return"none";const s=n.identity;return t&&t.pid!==null&&s.pid===t.pid&&WMt(t,s)?"resume":kln(t,s)?"reload":t?.project?"none":"offer-reload"}const Kge="volter.editor.orphaned-tab.v1";function Dln(t){if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!="object"||n===null)return null;const s=n;if(typeof s.at!="number"||!Number.isFinite(s.at)||s.reason!=="server-gone")return null;const c=typeof s.project=="string"?s.project:null;return{at:s.at,reason:s.reason,project:c}}function Pln(t){return JSON.stringify(t)}function Iln(t,n){const s=Math.max(0,Math.round((n-t.at)/1e3)),c=s<90?`${s}s ago`:s<5400?`${Math.round(s/60)}m ago`:`${Math.round(s/3600)}h ago`,d=t.project?` on ${t.project}`:"";return`A previous editor window at this address lost its server ${c}${d} and was left orphaned. If that window is still open it is a stale snapshot — nothing in it is saved and every click in it hangs on retries. Close it; this window is the live one.`}const Nln=720*60*1e3;function Oln(t,n){const s=n-t.at;return s>=0&&s<=Nln}function qVe(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Rln(t,n=qVe()){try{n?.setItem(Kge,Pln(t))}catch{}}function Fln(t=qVe()){if(!t)return null;try{const n=Dln(t.getItem(Kge));return t.removeItem(Kge),n}catch{return null}}function Mln(t=qVe()){try{t?.removeItem(Kge)}catch{}}function jln(t){return t?t.split(/[\\/]/).filter(Boolean).at(-1)??null:null}async function Lln(){try{const{stopAllLiveSessions:t}=await fo(async()=>{const{stopAllLiveSessions:n}=await Promise.resolve().then(()=>crn);return{stopAllLiveSessions:n}},void 0);t()}catch{}}function Bln(){const[t,n]=Ye.useState({kind:"quiet"}),s=Ye.useRef(Tln(Date.now())),c=Ye.useRef(null),d=Ye.useRef(!1);return Ye.useEffect(()=>{let m=!1,g=null;const S=()=>{g!==null&&(clearInterval(g),g=null)},k=async pe=>{c.current=pe,NRt(pe),pe==="taken-over"&&S(),pe==="server-gone"&&Rln({at:Date.now(),reason:"server-gone",project:s.current.bootIdentity?.project??null}),n(d.current?{kind:"degraded",subject:"stale"}:{kind:"void",reason:pe,reloadOffered:!1}),await Lln()},A=(pe,ue,Ce)=>{switch(Aln(s.current.bootIdentity,pe)){case"resume":{c.current=null,ZYr(),Mln(),s.current=xwt(s.current,pe,ue,Ce),n({kind:"quiet"});return}case"reload":if(d.current)return;window.location.reload();return;case"offer-reload":n(Fe=>Fe.kind==="void"&&!Fe.reloadOffered?{...Fe,reloadOffered:!0}:Fe);return;default:return}},F=async()=>{const pe=await RZr(),ue=gZr(),Ce=Date.now();if(m)return;if(c.current!==null){A(pe,ue,Ce);return}s.current=xwt(s.current,pe,ue,Ce);const Fe=Eln({consecutiveFailures:s.current.consecutiveFailures,unbackedFailures:s.current.unbackedFailures,failureThreshold:Sln,darkForMs:Ce-s.current.darkSince,minDarkWindowMs:xln,bootIdentity:s.current.bootIdentity,lastIdentity:s.current.lastIdentity});if(Fe.status==="void"&&Fe.reason!==null){await k(Fe.reason);return}n(Fe.status==="degraded"?{kind:"degraded",subject:"busy"}:{kind:"quiet"})};let D=!1;const J=()=>{D||m||(D=!0,F().finally(()=>{D=!1}))},q=()=>{m||(c.current===null&&(s.current=Cln(s.current,Date.now())),J())},G=()=>{document.visibilityState==="visible"&&q()};document.addEventListener("visibilitychange",G),window.addEventListener("pageshow",q);let se=null;try{const pe=jD();pe.addEventListener("error",J),pe.addEventListener("open",J),se=pe}catch{}return g=setInterval(J,wln),()=>{m=!0,S(),document.removeEventListener("visibilitychange",G),window.removeEventListener("pageshow",q),se?.close()}},[]),Ye.useEffect(()=>{oln(t);const m=jln(s.current.bootIdentity?.project??null),g=()=>{d.current=!0,n({kind:"degraded",subject:"stale"})};if(t.kind==="quiet"){xBe(xOe);return}if(t.kind==="degraded"){s$({id:xOe,tone:"warning",sticky:!0,...t.subject==="busy"?{title:"Editor server is slow to answer.",detail:"Still connected — this window keeps working, and this clears itself when the server catches up."}:{title:"This window's editor server has stopped.",detail:"You chose to keep reading it — nothing here saves, and it will not reconnect on its own. Reload once the editor is served here again.",actions:[{label:"Reload",primary:!0,run:()=>window.location.reload()}]}});return}s$({id:xOe,tone:"error",sticky:!0,title:"Editor disconnected.",detail:t.reason==="taken-over"?`${m?`${m}'s`:"This project's"} editor is now running in another window. This one has yielded.`:`This window's editor server has stopped — nothing here is saved, and a running game has left its room. Reopen with ${DB(`edit ${m??"<project>"}`)}${m?`, or leave this window open: it reloads by itself when ${m}'s editor is served here again.`:"."}`,onDismiss:()=>{d.current||g()},actions:[...t.reloadOffered?[{label:"Reload",primary:!0,run:()=>window.location.reload()}]:[],{label:"Close window",run:()=>window.close()},{label:"Continue anyway",run:g}]})},[t]),null}const xOe="editor-lease",$ln="0.5.72",qln={version:$ln},zln="0.5.72",Vln={version:zln},HMt=Vln.version,Uln=qln.version;function Jln({error:t,onDismiss:n,onRetry:s,startup:c=!1}){const d=t.recovery&&"verbs"in t.recovery?ePt(t.recovery.verbs):null,[m,g]=Ye.useState(!1);return Ye.useEffect(()=>{if(!m)return;const S=window.setTimeout(()=>g(!1),1600);return()=>window.clearTimeout(S)},[m]),$.jsxs("div",{role:"alert",className:"volter-error-card volter-shell-rise",children:[$.jsx("div",{className:"volter-error-card-icon","aria-hidden":"true",children:$.jsx(dc,{icon:fee})}),$.jsxs("div",{className:"volter-error-card-body",children:[c?$.jsx("h1",{className:"volter-error-card-title",children:t.recovery?.title??"Couldn’t open this project"}):t.recovery&&$.jsx("div",{className:"volter-error-card-title",children:t.recovery.title}),t.recovery&&$.jsx("p",{className:"volter-error-card-guidance",children:t.recovery.guidance}),$.jsx("div",{className:"volter-error-card-message","data-testid":c?"project-startup-error-details":void 0,children:t.message}),d&&$.jsxs("div",{children:[c&&$.jsx("div",{className:"volter-error-card-recovery-label",children:"RUN FROM THE PROJECT FOLDER"}),$.jsxs("div",{className:"volter-error-card-command",children:[$.jsx("code",{"data-testid":c?"project-startup-recovery-command":"project-screen-recovery-command",children:d}),$.jsxs(Ms,{type:"button",variant:"secondary",size:"compact",onClick:()=>{navigator.clipboard?.writeText(d),g(!0)},children:[$.jsx(dc,{icon:m?tLe:q0r,"aria-hidden":"true"}),m?"Copied":"Copy"]})]})]}),$.jsxs("div",{className:"volter-error-card-actions",children:[s&&$.jsx(Ms,{type:"button",variant:"primary",className:"volter-shell-cta","data-testid":"retry-project-detection",onClick:s,children:"Retry"}),n&&$.jsx(Ms,{type:"button",variant:"ghost",className:"volter-shell-cta","aria-label":"Dismiss error",onClick:n,children:"Dismiss"})]})]})]})}function Tje({error:t,report:n,onRetry:s}){return $.jsx("div",{className:"volter-shell","data-testid":"project-detection-error",children:$.jsxs("div",{className:"volter-shell-container","data-view":"startup-error",children:[$.jsx("header",{className:"volter-shell-header",children:$.jsxs("span",{className:"volter-shell-brand-static",children:[$.jsx("span",{className:"volter-shell-brand-mark","aria-hidden":"true",children:$.jsx($Ve,{size:30})}),$.jsx("span",{className:"volter-shell-wordmark",children:mR.name})]})}),$.jsx(Jln,{error:t,onRetry:s,startup:!0}),n?.projectPath&&$.jsx("div",{className:"volter-shell-notice","data-testid":"project-startup-serving",children:$.jsxs("span",{children:["This editor server is serving"," ",$.jsx("code",{"data-testid":"project-startup-serving-path",children:n.projectPath})," — the project exists; the editor could not read it. Fix the file it names above and press Retry."]})}),$.jsx("footer",{className:"volter-shell-footer",children:$.jsxs("span",{className:"volter-chip","data-variant":"tag",children:["Editor v",HMt," · Engine v",Uln]})})]})})}function Wln({wait:t}={}){return $.jsx("main",{role:"status","aria-live":"polite","aria-label":"Opening project","data-testid":"startup-loading-screen",className:"volter-splash",children:$.jsxs("div",{className:"volter-splash-stack",children:[$.jsx("div",{"aria-hidden":"true",className:"volter-splash-logo",children:$.jsx($Ve,{size:72})}),$.jsx("div",{className:"volter-splash-title",children:mR.name}),$.jsx("div",{"aria-hidden":"true",className:"volter-splash-progress"}),t?$.jsxs($.Fragment,{children:[$.jsx("div",{className:"volter-splash-status","data-testid":"startup-wait-status",children:`Asking the server which project it serves — ${t.seconds}s`}),$.jsx("div",{className:"volter-splash-note",children:"Still trying. The first boot of a fresh checkout can take a while, so this keeps asking until the server answers."}),t.detail?$.jsxs("div",{className:"volter-splash-note",children:["Last attempt: ",t.detail]}):null]}):$.jsx("div",{className:"volter-splash-status",children:"Opening project…"})]})})}class Hln extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){ea.error(`Editor chrome crashed while the command listener stayed attached: ${n.message}
1402
1402
  ${s.componentStack??""}`,"editor")}render(){return this.state.error?$.jsx(Tje,{error:{message:`The editor surface crashed: ${this.state.error.message}`},onRetry:()=>this.setState({error:null})}):this.props.children}}function f_e({children:t}){return $.jsxs($.Fragment,{children:[t,$.jsx(Bln,{})]})}function Gln(t){const n=t instanceof Error?t.message:String(t);return t instanceof DC?{status:"error",message:n,recovery:t.recovery}:t instanceof y$e?{status:"error",message:n,report:t.report}:{status:"error",message:n}}const Kln=8e3;function Xln(t=ken,n=Kln){return new Promise((s,c)=>{const d=window.setTimeout(()=>{c(new VPt(n))},n);t().then(m=>{window.clearTimeout(d),s(m)},m=>{window.clearTimeout(d),c(m)})})}const Yln=3;function Zln(){const[t,n]=Ye.useState({status:"detecting",waitingSince:null}),[s,c]=Ye.useState(0);Ye.useEffect(()=>Twr(),[]),Ye.useEffect(()=>yZr(),[]),Ye.useEffect(()=>aZr(()=>c(k=>k+1)),[]),Ye.useEffect(()=>{let k=!1,A,F=0;const D=Date.now();n({status:"detecting",waitingSince:null});const J=()=>{Xln().then(q=>{k||n(q?{status:"ready",project:q}:{status:"no-project"})},q=>{if(k)return;F+=1;const G=S4r(q,F);if(G.kind==="terminal"){const pe=Gln(q),ue=pe.recovery&&"verbs"in pe.recovery?ePt(pe.recovery.verbs):null;ea.error(`Startup failed: ${pe.message}${ue?` Run: ${ue}`:""}`,"editor"),n(pe);return}const se=q instanceof Error?q.message:String(q);F===Yln&&ea.error(`Project detection has failed ${F} times and is still retrying: ${se}`,"editor"),n({status:"detecting",waitingSince:D,lastError:se}),A=window.setTimeout(J,G.delayMs)})};return J(),()=>{k=!0,A!==void 0&&window.clearTimeout(A)}},[s]);const d=t.status==="detecting"?t.waitingSince:null,[m,g]=Ye.useState(0);Ye.useEffect(()=>{if(d===null){g(0);return}const k=()=>g(Math.max(0,Math.round((Date.now()-d)/1e3)));k();const A=window.setInterval(k,1e3);return()=>window.clearInterval(A)},[d]),Ye.useEffect(()=>{t.status!=="detecting"&&TZr(t.status==="ready"?"project":"no-project")},[t.status]);const S=t.status==="ready"?t.project.config.name:t.status==="error"?"Couldn't open project":null;return Ye.useEffect(()=>{document.title=RPt(S)},[S]),t.status==="detecting"?$.jsx(f_e,{children:$.jsx(Wln,{wait:t.waitingSince===null?void 0:{seconds:m,detail:t.lastError}})}):t.status==="no-project"?$.jsx(f_e,{children:$.jsx(Tje,{error:{message:`This window has no project open. A session serves one project: open a folder that carries a volter.project.json, or start one from a terminal — ${DB("edit <folder>")}.`},onRetry:()=>c(k=>k+1)})}):t.status==="error"?$.jsx(f_e,{children:$.jsx(Tje,{error:{message:t.message,...t.recovery?{recovery:t.recovery}:{}},report:t.report,onRetry:()=>c(k=>k+1)})}):$.jsx(f_e,{children:$.jsx(ian,{children:$.jsx(Hln,{children:$.jsx(bln,{})})})})}function zVe(t){Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot,t.getShellSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(Cee,AD,AD),Ye.useSyncExternalStore(Pye,lN,lN),Ye.useSyncExternalStore(ton,Rxt,Rxt),Ye.useSyncExternalStore(U$,mhe,mhe),Ye.useSyncExternalStore(fEr,$ht,$ht),Ye.useSyncExternalStore(fin,Ext,Ext),Ye.useSyncExternalStore(U0e,qQ,qQ),Ye.useSyncExternalStore(E3t,pRe,pRe),Ye.useSyncExternalStore(eTr,mht,mht),Ye.useSyncExternalStore(JCr,Mht,Mht);const[,n]=Ye.useReducer(d=>d+1,0),{adapter:s}=Cm(t),c=Ye.useRef({broad:t.getSnapshot(),shell:t.getShellSnapshot()});return c.current={broad:t.getSnapshot(),shell:t.getShellSnapshot()},Ye.useEffect(()=>{const d=s.subscribe;if(d)return Pg({adapter:s,seam:"editor.subscribe",stage:"effect",detail:"the active Inspector subscribed to adapter-owned changes",run:()=>d.call(s,()=>{const m=c.current,g={broad:t.getSnapshot(),shell:t.getShellSnapshot()};c.current=g,g.broad===m.broad&&g.shell===m.shell&&n()})})},[s,t]),ove(t)}let DI=null,GMt=0;const Cje=new Set;function Qln(){return DI}function wwt(){return GMt}function eun(t){return Cje.add(t),()=>Cje.delete(t)}function Twt(t){if(!(DI===t||DI!==null&&t!==null&&DI.x===t.x&&DI.y===t.y&&DI.width===t.width&&DI.height===t.height)){DI=t,GMt+=1;for(const s of Cje)s()}}function tun(t,n,s){const c=Math.min(n.maxWidth,Math.max(n.minSize,t.width-n.margin*2)),d=Math.min(n.maxHeight,Math.max(n.minSize,t.height-n.margin*2)),m=t.x+n.margin,g=t.x+t.width-c-n.margin,S=t.y+n.margin,k=t.y+t.height-d-n.margin,A=t.x+t.width-s.right-c,F=t.y+t.height-s.bottom-d;return{width:c,height:d,left:Math.min(Math.max(A,m),Math.max(g,m)),top:Math.min(Math.max(F,S),Math.max(k,S))}}const KMt=Ye.createContext(null);function run({actions:t,children:n}){return $.jsx(KMt.Provider,{value:t,children:n})}function nun(){return Ye.useContext(KMt)}function RC(t,n){return{...n,iconName:t}}const iun=RC("outliner-object",aR),oun=RC("outliner-light",Qje),sun=RC("outliner-camera",nye),aun=RC("outliner-audio",j0r),wOe=RC("outliner-data",b0r),Cwt=RC("outliner-mesh",aR),cun={three:iun,react:eLe,canvas:ZTt,scene:aLe,mesh:Cwt,"skinned-mesh":Cwt,"mesh-data":wOe,"three-source":wOe,"model-asset":wOe,light:oun,camera:sun,audio:aun,"reflection-probe":KTt,group:qOe,object:FTt,component:GB,img:iB,a:w0r,ul:vZ,ol:vZ,li:vZ,button:BOe,sprite:iB,animatedsprite:VTt,nineslicesprite:iB,tilingsprite:iB,text:B0r,graphics:BOe,container:qOe},lun=RC("outliner-render-on",nye),uun=RC("outliner-render-off",y0r),fun=RC("outliner-exclude-on",v0r),dun=RC("outliner-exclude-off",BOe),pun=/^blender-[a-z0-9-]+$/;function KZ(t,n=FTt){const s=cun[t];return s||(pun.test(t)?RC(t,n):n)}const _un=new Set(["mesh-data","blender-material-data","blender-shapekey-data","blender-texture-data","blender-image-data"]),mun=["blender-outliner-data-","blender-light-","blender-lightprobe-"];function XMt(t){return t===void 0?!1:_un.has(t)?!0:mun.some(n=>t.startsWith(n))}function Eje(t){return t.body.kind==="fields"?$.jsx(B9t,{fields:t.body.fields,io:t.body.io}):t.body.render()}function VVe({action:t}){return $.jsx(dm,{"data-testid":t.id,"aria-label":t.title,title:t.title,"aria-pressed":t.pressed,disabled:t.disabled,onClick:t.run,children:t.icon&&$.jsx(dc,{icon:t.icon})})}function UVe(t){return t.related.find(n=>n.id.startsWith("definition:"))??null}function hun(t){return t.related.filter(n=>!n.id.startsWith("creation-site:")&&!n.id.startsWith("definition:"))}function JVe({link:t}){return $.jsxs(Ms,{variant:"secondary",size:"compact","data-testid":"inspector-open-definition",title:t.title,onClick:t.open,style:{display:"inline-flex",alignItems:"center",gap:4,flexShrink:0},children:[$.jsx(dc,{icon:U0r}),$.jsx("span",{style:{maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.title})]})}function YMt({subject:t}){const n=hun(t);return n.length===0?null:$.jsx("div",{"data-testid":"inspector-related-subjects",style:{display:"flex",flexWrap:"wrap",gap:4,padding:"6px 8px"},children:n.map(s=>$.jsx(Ms,{variant:"ghost",onClick:s.open,title:s.title,children:s.title},s.id))})}function kje(t){const n=c4t(t.iconName);if(n)return`${n.path}|${n.tonedPath??""}`;const s=t.icon[4];return Array.isArray(s)?s.join("|"):s}function ZMt({subject:t,onJump:n}){const s=F9t(t);return Ye.useSyncExternalStore(vBe,she,she),s.length<5||new Set(s.map(c=>kje(c.icon))).size<3?null:$.jsx("div",{className:"volter-inspector-icon-strip",role:"toolbar","aria-label":"Sections","data-testid":"inspector-section-strip",children:s.map(c=>$.jsx(dm,{size:"compact","data-testid":`section-icon-${c.id}`,"aria-label":c.title,title:c.title,onClick:()=>n(c.id),children:$.jsx(dc,{icon:c.icon})},c.id))})}function gun({render:t,glyph:n,subjectKey:s}){const c=ive(s)?t:null;return c?$.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none"},children:c("thumbnail")}):$.jsx(dc,{icon:n})}function WVe({subject:t}){const n=t.identity;if(!n)return null;const s=[n.kindLabel,n.note?.text].filter(Boolean).join(" — ");return n.rename.readOnly?$.jsx("div",{"data-testid":"ingest-name","data-readonly":"true",...s?{title:s}:{},style:{flex:1,minWidth:0,fontSize:"var(--volter-font-md)",fontWeight:600,color:Go.content.primary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.title}):$.jsx(NRe,{"data-testid":"ingest-name","aria-label":"Name",value:t.title,onCommit:c=>{c.trim()!==""&&n.rename.set(c)},"data-emphasis":"strong",...s?{title:s}:{},style:{flex:1,minWidth:0}})}function QMt({subject:t}){const n=t.identity;if(!n)return $.jsxs("div",{style:{padding:12},children:[$.jsx("div",{style:{fontSize:"var(--volter-font-md)",fontWeight:600},children:t.title}),t.hint&&$.jsx("div",{"data-testid":"inspector-subject-hint",style:{marginTop:4,fontSize:"var(--volter-font-base)",color:Go.content.dim},children:t.hint})]});const s=UVe(t);return $.jsxs("div",{className:"volter-inspector-identity",style:{padding:`${G0[1]} ${G0[4]}`,borderBottom:"1px solid var(--volter-structural-divider)"},children:[$.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[$.jsx(WVe,{subject:t}),n.kindLabel&&$.jsx("span",{"data-testid":"inspector-kind-label",style:{fontSize:"var(--volter-font-base)",color:Go.content.dim,whiteSpace:"nowrap"},children:n.kindLabel}),kBe(t,"identity").map(c=>$.jsx(VVe,{action:c},c.id)),s&&$.jsx(JVe,{link:s})]}),n.document&&$.jsx("div",{"data-testid":"inspector-document-path","data-document-path":n.document.path,...n.document.title?{title:n.document.title}:{},style:{marginTop:G0[1],fontSize:"var(--volter-font-base)",color:Go.content.muted,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",direction:"rtl",textAlign:"left"},children:$.jsx("bdi",{children:n.document.path})}),t.alsoSelected?$.jsx("div",{"data-testid":"inspector-also-selected",style:{marginTop:6,fontSize:"var(--volter-font-base)",color:Go.content.dim},children:`${t.alsoSelected+1} selected — fields edit this one, the gizmo moves all`}):null,n.note?.text&&$.jsx("div",{"data-testid":"inspector-subject-note",style:{marginTop:6,fontSize:"var(--volter-font-base)",color:Go.content.dim},children:n.note.text})]})}function yun({subject:t}){const n=t.identity;if(!n)return $.jsx(QMt,{subject:t});const s=UVe(t),c=n.kind?KZ(n.kind,Xge(t)):Xge(t),d=t.title||n.kindLabel||"",m=[n.kindLabel,n.document?.path,n.document?.title].filter(Boolean).join(" — ");return $.jsxs("div",{className:"volter-inspector-identity","data-volter-identity-layout":"properties",children:[$.jsxs("div",{className:"volter-inspector-breadcrumb",children:[$.jsx(dc,{icon:c,tone:"primary"}),$.jsx("span",{className:"volter-inspector-breadcrumb-chain","data-testid":"inspector-document-path",...n.document?{"data-document-path":n.document.path}:{},...m?{title:m}:{},children:$.jsx("bdi",{children:d})}),kBe(t,"identity").map(g=>$.jsx(VVe,{action:g},g.id))]}),$.jsxs("div",{className:"volter-inspector-datablock",children:[$.jsx("span",{className:"volter-inspector-datablock-kind","data-testid":"inspector-kind-label",...n.kindLabel?{title:n.kindLabel}:{},children:$.jsx(dc,{icon:c,tone:"primary"})}),$.jsx(WVe,{subject:t}),s&&$.jsx(JVe,{link:s})]}),t.alsoSelected?$.jsx("div",{"data-testid":"inspector-also-selected",style:{marginTop:G0[3],fontSize:"var(--volter-font-base)",color:Go.content.dim},children:`${t.alsoSelected+1} selected — fields edit this one, the gizmo moves all`}):null,n.note?.text&&$.jsx("div",{"data-testid":"inspector-subject-note",style:{marginTop:G0[3],fontSize:"var(--volter-font-base)",color:Go.content.dim},children:n.note.text})]})}function vun({section:t}){return $.jsx("div",{"data-testid":t.testId,"data-inspector-section":t.id,children:$.jsx(RCr,{label:t.title,icon:t.icon,description:t.description,collapsible:!0,defaultOpen:t.defaultOpen??!0,children:Eje(t)})})}function bun({subject:t}){const n=Ye.useRef(null),s=c=>{n.current?.querySelector(`[data-inspector-section="${c}"]`)?.scrollIntoView({block:"nearest",behavior:"smooth"})};return $.jsxs("div",{style:{pointerEvents:"auto"},children:[$.jsx(QMt,{subject:t}),$.jsx(ZMt,{subject:t,onJump:s}),$.jsx(YMt,{subject:t}),$.jsx("div",{ref:n,children:t.sections.map(c=>$.jsx(Ye.Fragment,{children:$.jsx(vun,{section:c})},c.id))})]})}const d_e=new Map;let Ewt=null;function Sun({subject:t}){const n=F9t(t),s=d_e.get(t.id)??Ewt,[c,d]=Ye.useState(null),m=(c&&n.some(k=>k.id===c)?c:null)??(s&&n.some(k=>k.id===s)?s:null)??n.find(k=>k.railDefault)?.id??n[0]?.id??null,g=t.sections.find(k=>k.id===m)??null,S=k=>{d(k),d_e.size>200&&d_e.clear(),d_e.set(t.id,k),Ewt=k};return $.jsx("div",{className:"volter-inspector-properties-fill",style:{pointerEvents:"auto"},children:$.jsxs("div",{className:"volter-inspector-properties","data-testid":"inspector-properties",children:[$.jsx("div",{className:"volter-inspector-properties-rail",role:"tablist","aria-orientation":"vertical","aria-label":"Sections",children:n.map((k,A)=>$.jsxs(Ye.Fragment,{children:[A>0&&k.railGroup!==n[A-1]?.railGroup?$.jsx("div",{className:"volter-inspector-properties-rail-separator","data-testid":"properties-tab-separator",role:"presentation"}):null,$.jsx(dm,{size:"compact",role:"tab","aria-selected":k.id===m,"data-testid":`properties-tab-${k.id}`,"aria-label":k.title,title:k.title,onClick:()=>S(k.id),children:$.jsx(dc,{icon:k.icon,size:"xl"})})]},k.id))}),$.jsxs("div",{className:"volter-inspector-properties-body",role:"tabpanel",children:[$.jsx(yun,{subject:t}),$.jsx(YMt,{subject:t}),g?$.jsx("div",{"data-testid":g.testId,"data-inspector-section":g.id,children:Eje(g)}):null,t.sections.filter(k=>k.keepMounted&&k.id!==m).map(k=>$.jsx("div",{"data-inspector-section":k.id,"data-inspector-section-hidden":"true",style:{display:"none"},children:Eje(k)},k.id))]})]})})}function Xge(t){const n=t.sections[0]?.icon;return n?kje(n)===kje($Oe)?aR:n:aR}function xun({subject:t,surface:n}){const s=nun(),c=t.sections.find(k=>k.body.kind==="preview"),d=c?.body.kind==="preview"?c.body:null,m=UVe(t),g=n?()=>kVe(n,"column"):null,S=t.identity!==null;return $.jsxs("div",{className:"volter-mini-inspector","data-testid":"inspector-panel","data-volter-inspector-presentation":"card",onPointerDown:()=>CR("inspector"),children:[s&&$.jsx(dm,{size:"compact",className:"volter-mini-inspector-minimize","data-testid":"inspector-minimize","aria-label":"Minimize inspector",title:"Minimize inspector",onClick:s.minimize,children:$.jsx(dc,{icon:p0r})}),$.jsx("div",{className:"volter-mini-inspector-preview","data-testid":"inspector-mini-preview",...g?{role:"button",tabIndex:0,"aria-label":`Expand inspector for ${t.title}`,title:`Expand inspector for ${t.title}`,onClick:g,onKeyDown:k=>{(k.key===" "||k.key==="Enter")&&(k.preventDefault(),g())}}:{},children:$.jsx(gun,{render:d?d.render:null,glyph:Xge(t),subjectKey:t.id})}),S?$.jsxs("div",{className:"volter-mini-inspector-identity",children:[$.jsx(WVe,{subject:t}),kBe(t,"identity").map(k=>$.jsx(VVe,{action:k},k.id))]}):$.jsx("div",{className:"volter-mini-inspector-identity",children:$.jsx("div",{style:{flex:1,minWidth:0,fontSize:"var(--volter-font-md)",fontWeight:600},children:t.title})}),$.jsx(ZMt,{subject:t,onJump:()=>g?.()}),m&&$.jsx("div",{className:"volter-mini-inspector-actions",children:$.jsx(JVe,{link:m})})]})}function wun({subject:t,onExpand:n,onClear:s}){const c=t.sections.find(m=>m.body.kind==="preview"),d=c?.body.kind==="preview"?c.body:null;return $.jsxs("div",{className:"volter-inspector-pill","data-testid":"inspector-pill",children:[$.jsxs("div",{role:"button",tabIndex:0,className:"volter-inspector-pill-open","aria-label":`Expand inspector for ${t.title}`,title:`Expand inspector for ${t.title}`,onClick:n,onKeyDown:m=>{(m.key===" "||m.key==="Enter")&&(m.preventDefault(),n())},children:[$.jsx("span",{className:"volter-inspector-pill-thumb","aria-hidden":"true",children:d?d.render("thumbnail"):$.jsx(dc,{icon:Xge(t)})}),$.jsx("span",{className:"volter-inspector-pill-name",children:t.title})]}),s&&$.jsx(dm,{"data-testid":"inspector-fab-clear-selection","aria-label":"Clear selection",title:"Clear selection",onClick:s,children:$.jsx(dc,{icon:rLe})})]})}const p_e=new Map;function kwt({subject:t,presentation:n,surface:s}){const c=t.id,d=Ye.useCallback(m=>{m&&(m.scrollTop=p_e.get(c)??0)},[c]);return n==="card"?$.jsx(xun,{subject:t,...s?{surface:s}:{}}):$.jsx($ye,{name:"Inspector",hideHeader:!0,className:"volter-content-frost","data-testid":"inspector-panel","data-volter-inspector-presentation":n,onPointerDown:()=>CR("inspector"),style:{overflowY:"auto"},ref:d,onScroll:m=>{p_e.size>200&&p_e.clear(),p_e.set(c,m.currentTarget.scrollTop)},children:n==="properties"?$.jsx(Sun,{subject:t}):$.jsx(bun,{subject:t})})}const Tun=250;let ejt=0,UY=null;const bme=new Set;function Cun(){ejt++;for(const t of bme)t()}function HVe(t){return bme.add(t),UY===null&&(UY=setInterval(Cun,Tun)),()=>{bme.delete(t),bme.size===0&&UY!==null&&(clearInterval(UY),UY=null)}}function Eun(){return ejt}function tjt(t){return Ye.useSyncExternalStore(HVe,t,t)}function kun({presentation:t,surface:n}){const s=pVe(),c=$.jsx("div",{"data-testid":"no-authoring-note",style:{padding:12,color:Go.semantic.warning,fontSize:"var(--volter-font-md)",lineHeight:1.5},children:s!==null?$.jsxs($.Fragment,{children:[$.jsx("strong",{children:"Nothing to author."})," ",s]}):$.jsxs($.Fragment,{children:[$.jsx("strong",{children:"Nothing to author."})," This root's adapter publishes no inspector surface, so there is nothing here to describe or edit. The root is still hosted, sized, and disposed; play it in the Game tab."]})}),d=n?$.jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:"2px 4px"},children:$.jsx(dm,{size:"compact","data-testid":"inspector-expand","aria-label":"Expand inspector to side panel",title:"Expand inspector to side panel",onClick:()=>kVe(n,"column"),children:$.jsx(dc,{icon:LTt})})}):null;return t==="card"?$.jsxs("div",{className:"volter-mini-inspector","data-testid":"inspector-panel","data-volter-inspector-presentation":"card",onPointerDown:()=>CR("inspector"),children:[d,c]}):$.jsx($ye,{name:"Inspector (nothing to author)",hideHeader:!0,className:"volter-content-frost","data-testid":"inspector-panel",onPointerDown:()=>CR("inspector"),children:c})}function GVe(){const t=Yv();tjt(()=>zwr());const n=zVe(t),{adapter:s}=Cm(t);return n.available?s.capabilities.inspectorFields?$.jsx(kwt,{subject:n.subject,presentation:n.presentation,surface:n.surface}):n.subject.identity!==null||n.subject.sections.length>0?$.jsx(kwt,{subject:n.subject,presentation:n.presentation,surface:n.surface}):l$()?$.jsx(kun,{presentation:n.presentation,surface:n.surface}):null:null}function Aun({surface:t}){return $.jsx($ye,{name:"Inspector",hideHeader:!0,"data-testid":"inspector-shown-as-card",children:$.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"var(--volter-space-3)",padding:"var(--volter-space-4)",color:Go.content.muted,fontSize:"var(--volter-font-md)",lineHeight:1.5},children:[$.jsx("span",{children:"The inspector for this view is shown as a card in the viewport."}),$.jsx(Ms,{variant:"secondary",size:"compact","data-testid":"inspector-dock-here",onClick:()=>kVe(t,"column"),children:"Show it here"})]})})}const rjt=260,njt=360,see=16,Dun=200,ijt=220,Aje=54,Pun=52,Iun={maxWidth:rjt,maxHeight:njt,minSize:Dun,margin:see},Nun={right:see,bottom:see},Oun={maxWidth:ijt,maxHeight:Aje,minSize:Aje,margin:see};function Run(t,n,s){return tun(t,s?Oun:Iun,n)}function Fun(){const t=Yv();Ye.useSyncExternalStore(t.subscribe,t.getShellSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(U0e,qQ,qQ),Ye.useSyncExternalStore(eun,wwt,wwt);const n=Qln(),[s,c]=Ye.useState(!1),{subject:d}=zVe(t),m=Ye.useCallback(()=>{oD();const{adapter:S}=Cm(t);c0(S,[])||t.select(null)},[t]),g=n?Run(n,Nun,s):null;return $.jsx("div",{style:{position:"absolute",...g?{left:g.left,top:g.top,width:g.width,height:g.height}:{right:see,bottom:Pun,width:s?ijt:rjt,height:s?Aje:njt},display:"flex",alignItems:"flex-end",zIndex:PI.sticky,pointerEvents:"none"},children:$.jsx("div",{"data-testid":"compact-inspector-card",style:{display:"flex",width:"100%",...s?{height:"100%"}:{maxHeight:"100%"},borderRadius:s?999:"var(--dv-group-border-radius, 8px)",overflow:s?"hidden":"clip",border:"var(--dv-floating-border, 1px solid var(--volter-boundary-default))",boxShadow:"var(--dv-floating-box-shadow, var(--volter-shadow-lg))",background:"var(--dv-group-view-background-color, var(--volter-bg-1))",pointerEvents:"auto"},children:s?$.jsx(wun,{subject:d,onExpand:()=>c(!1),onClear:m}):$.jsx(run,{actions:{minimize:()=>c(!0)},children:$.jsx(GVe,{})})})})}let Mun=1;const Awt=new WeakMap;function jun(t){if(!t)return 0;const n=Awt.get(t);if(n!==void 0)return n;const s=Mun++;return Awt.set(t,s),s}function KVe(t){const n=Y0(t);return n instanceof hy?n.childAdapters().find(c=>c.kind==="three"&&c.adapter.capabilities.transform)?.worldId??null:null}function Lun(t){const n=Y0(t);if(!(n instanceof hy))return!0;if(!n.childAdapters().some(d=>d.kind==="three"))return!1;const c=KVe(t);return c===null?!0:!oq(c)}const Bun="/__editor/collaboration",Dwt=["participants","presence","messages","revisions","audit","team-test"];let KI=null;const Dje=new Set,Pje=new Set;let Pwt=0;function __e(t){KI=t,LAt(t.revision);for(const n of Dje)n(t);if(t.revision>Pwt){Pwt=t.revision;for(const n of Pje)n(t.revision)}}async function Ije(t,n){const s=await fetch(`${Bun}${t}`,n);if(s.status!==204&&sf(s,`Collaboration request ${t} failed`),!s.ok){const c=await s.json().catch(()=>null);throw new Error(typeof c?.error=="string"?c.error:"Collaboration request failed.")}return s.status===204?void 0:await s.json()}function $un(){return KI}let m_e=null,h_e=0;function ojt(){if(h_e++,!m_e){const n=jD(),s=g=>{try{__e(JSON.parse(g.data))}catch{}};let c=!1;const d=()=>{c||(c=!0,Ije("").then(__e).catch(()=>{}).finally(()=>{c=!1}))},m=g=>{try{const S=JSON.parse(g.data);if(!KI||S.sequence<=KI.sequence)return;if(S.channel!=="presence"){d();return}const k=S.payload;if(typeof k.participantId!="string"||!k.presence)return;__e({...KI,sequence:S.sequence,participants:KI.participants.map(A=>A.participantId===k.participantId?{...A,presence:k.presence}:A)})}catch{}};n.addEventListener("collaboration-snapshot",s);for(const g of Dwt)n.addEventListener(`collaboration-${g}`,m);Ije("").then(__e).catch(()=>{}),m_e=()=>{n.removeEventListener("collaboration-snapshot",s);for(const g of Dwt)n.removeEventListener(`collaboration-${g}`,m);n.close()}}let t=!1;return()=>{t||(t=!0,h_e--,h_e<=0&&(h_e=0,m_e?.(),m_e=null))}}function qun(t){Dje.add(t),KI&&t(KI);const n=ojt();return()=>{Dje.delete(t),n()}}function Lxn(t){Pje.add(t);const n=ojt();let s=!1;return()=>{s||(s=!0,Pje.delete(t),n())}}async function Bxn(t){await Ije("/presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({participantId:G0e,presence:t})})}const Iwt=500,sjt=()=>{};function zun(t,n){if(n===sjt)return{hierarchy:t.hierarchy,isComponentRoot:()=>!1,isBuiltInternal:()=>!1,...t.hasInternals?{hasInternals:A=>t.hasInternals(A)}:{},...t.internalChildren?{internalChildren:A=>t.internalChildren(A)}:{}};const s=new Map,c=A=>{const F=s.get(A);if(F!==void 0)return F;const D=[];let J=A,q=!1,G=0;for(;J!==null&&G++<Iwt;){const se=s.get(J);if(se!==void 0){q=se;break}D.push(J);const pe=n(J);if(pe?.componentRoot!==void 0)break;if(pe?.builtInternal===!0){q=!0;break}if(pe?.authoredEntity===!0)break;J=t.hierarchy.node(J)?.parentId??null}for(const se of D)s.set(se,q);return q},d=A=>n(A)?.componentRoot!==void 0,m=(A,F=0)=>{if(F>Iwt)return[];const D=[];for(const J of A.childIds){if(!c(J)){D.push(J);continue}const q=t.hierarchy.node(J);q&&D.push(...m(q,F+1))}return D},g=A=>A.childIds.filter(F=>c(F)),S=A=>{if(!A)return null;const F=n(A.id)?.componentRoot,D=m(A),J=D.length===A.childIds.length&&D.every((q,G)=>q===A.childIds[G]);return F===void 0&&J?A:{...A,...F===void 0?{}:{role:"component",typeLabel:F},...J?{}:{childIds:D}}};return{hierarchy:{roots:()=>t.hierarchy.roots().flatMap(A=>c(A.id)?m(A).flatMap(F=>{const D=S(t.hierarchy.node(F));return D?[{...D,parentId:A.parentId}]:[]}):[S(A)]),node:A=>S(t.hierarchy.node(A))},isComponentRoot:d,isBuiltInternal:c,hasInternals:A=>{if(t.hasInternals?.(A)===!0)return!0;const F=t.hierarchy.node(A);return F?g(F).length>0:!1},internalChildren:A=>{const F=t.internalChildren?.(A),D=t.hierarchy.node(A),J=D?g(D).flatMap(q=>{const G=S(t.hierarchy.node(q));return G?[{...G,parentId:A}]:[]}):[];return F===void 0?J.length>0?J:void 0:[...F,...J]}}}function Vun(t,n,s){for(const c of n)c.more||s(c.node.id)&&t.set(c.node.id,!1);return t}function Uun(t,n){for(const s of t.childAdapters())if(t.groupNodeId(s.worldId)===n)return s.worldId;return t.ownerOf(n)}function Jun(t,n,s){if(!(t instanceof hy))return!0;const c=Uun(t,s);return c===null?!1:n.every(d=>t.ownerOf(d)===c)}const Wun="This world's structure comes from its own source, which the editor can't rewrite here — reparenting is not wired for it.",Hun="That row is part of a component instance's own output, not authored content. Drop onto the instance itself to place relative to it.";function Nwt(t){return t.hasStructureWritePath?t.targetIsInternal?Hun:null:Wun}const Gun=400,ajt="volter.projectLocalState";let JB=null,JY=null,ER={},Nje=!1,WB=null;function cjt(){return Em()}function cte(){const t=cjt();if(JB===t)return Promise.resolve();if(JY)return JY.then(()=>cte());const n=n$e(),s=n?Promise.resolve(Kun(n.get(ajt))):FZr();return JY=Promise.all([s,V4t()]).then(([c])=>{ER=c&&typeof c=="object"?{...c}:{},JB=t}).catch(()=>{ER={},JB=t}).finally(()=>{JY=null}),JY}function lte(){return JB===cjt()}function vve(t){if(lte())return ER[t]}function XVe(t=!1){if(WB!==null&&(clearTimeout(WB),WB=null),!Nje)return;Nje=!1;const n=n$e();n?n.store(ajt,JSON.stringify(ER)):MZr(ER,{leaving:t})}function Kun(t){if(!t)return{};try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}catch{return{}}}function bve(t,n){const s=()=>{ER={...ER,[t]:n},Nje=!0,WB!==null&&clearTimeout(WB),WB=setTimeout(XVe,Gun)};lte()?s():cte().then(s)}function Xun(){XVe(!0)}Rw(()=>{of()&&cte()});KAr(()=>{JB!==null&&(XVe(),JB=null,of()&&cte())});typeof window<"u"&&window.addEventListener("pagehide",Xun);const ljt="hierarchyExpansion",O$=new Map;let Owt=!1;function YVe(){if(Owt||!lte())return;Owt=!0;const t=vve(ljt)??{};for(const[n,s]of Object.entries(t))O$.set(n,new Map(Object.entries(s)))}function ujt(){const t={};for(const[n,s]of O$)t[n]=Object.fromEntries(s);bve(ljt,t)}function Yun(t,n){return YVe(),O$.get(t)?.get(n)}function Rwt(t,n){YVe();let s=O$.get(t);s||(s=new Map,O$.set(t,s));for(const[c,d]of n)s.set(c,d);ujt()}function Zun(t){YVe(),O$.delete(t),ujt()}let Yge=null;const Oje=new Set;function Qun(){return Yge}function efn(t){return Oje.add(t),()=>{Oje.delete(t)}}function fjt(t){if(Yge!==t){Yge=t;for(const n of Oje)n()}}function tfn(t){Yge===t&&fjt(null)}const rfn=500,Fwt=new Set,aee=new Set;function $xn(t){return aee.has(t)}function qxn(t){return aee.delete(t)?!1:(aee.add(t),!0)}function zxn(){return aee}function nfn(t,n=aee){if(typeof t.internalChildren!="function"||n.size===0)return{hierarchy:t.hierarchy,isInternal:()=>!1,revealRootIds:Fwt,internalIds:Fwt};const s=new Map,c=new Map,d=new Set,m=(S,k)=>{if(k>rfn||s.has(S))return;const A=t.internalChildren(S)??[];if(A.length!==0){s.set(S,A.map(F=>F.id));for(const F of A)c.has(F.id)||(c.set(F.id,F),m(F.id,k+1))}};for(const S of n)m(S,0),s.has(S)&&d.add(S);const g=S=>{if(!S)return null;const k=s.get(S.id);return k?{...S,childIds:[...S.childIds,...k]}:S};return{hierarchy:{roots:()=>t.hierarchy.roots().map(S=>g(S)),node:S=>g(c.get(S)??t.hierarchy.node(S))},isInternal:S=>c.has(S),revealRootIds:d,internalIds:new Set(c.keys())}}function ifn(t,n){for(const s of n.internalIds)t.set(s,!1);for(const s of n.revealRootIds)t.set(s,!0);return t}const Zge=20,ofn="__more__:",djt=500;function sfn(t,n,s){return t?Math.max(Zge,n.get(s)??Zge):Number.POSITIVE_INFINITY}function afn(t,n,s,c,d){return{node:{id:`${ofn}${t}`,label:"",kind:"object",parentId:s,childIds:[]},depth:n,pathKey:`${t}/__more__`,hasChildren:!1,hiddenByCollapse:c,more:{parentPathKey:t,hidden:d}}}function Mwt(t,n,s=new Map,c=!1){const d=[],m=new Set,g=(S,k,A,F)=>{if(m.has(S.id)||k>djt)return;m.add(S.id);const D=S.childIds.length>0;d.push({node:S,depth:k,pathKey:A,hasChildren:D,hiddenByCollapse:F});const J=n.has(A);if(c&&J)return;const q=F||J,G=Math.min(S.childIds.length,sfn(c,s,A));for(let se=0;se<G;se++){const pe=t.node(S.childIds[se]);pe&&g(pe,k+1,`${A}.${se}`,q)}c&&S.childIds.length>G&&d.push(afn(A,k+1,S.id,q,S.childIds.length-G))};return t.roots().forEach((S,k)=>{g(S,0,`r${k}`,!1)}),d}function cfn(t,n,s){if(s.size===0)return n;const c=new Map;for(let k=0;k<n.length;k+=1){const A=n[k];A.more||c.set(A.node.id,k)}const d=[];for(const k of s){const A=c.get(k),F=t.node(k);if(A===void 0||F===null)continue;const D=n[A];let J=A+1;for(;J<n.length&&n[J].depth>D.depth;)J+=1;d.push({start:A,end:J,row:D,node:F})}if(d.length===0)return null;d.sort((k,A)=>k.start-A.start);const m=[];for(const k of d){const A=m.at(-1);A&&k.start<A.end||m.push(k)}for(const k of s){const A=c.get(k);if(A!==void 0&&!m.some(({start:F,end:D})=>A>=F&&A<D))return null}const g=k=>{const A=[],F=new Set;let D=!0;const J=(q,G,se)=>{if(D){if(F.has(q.id)||G>djt){D=!1;return}F.add(q.id),A.push({node:q,depth:G,pathKey:se,hasChildren:q.childIds.length>0,hiddenByCollapse:!1});for(let pe=0;pe<q.childIds.length;pe+=1){const ue=t.node(q.childIds[pe]);ue&&J(ue,G+1,`${se}.${String(pe)}`)}}};return J(k.node,k.row.depth,k.row.pathKey),D?A:null},S=[...n];for(let k=m.length-1;k>=0;k-=1){const A=m[k],F=g(A);if(F===null)return null;S.splice(A.start,A.end-A.start,...F)}return S}function jwt(t){return`${t.pathKey}:${t.node.id}`}function lfn(t,n,s,c,d){const m=Math.max(0,Math.floor(n/c)-d),g=Math.ceil(s/c)+d*2,S=Math.min(t,m+g);return{start:m,end:S}}function ufn(t,n){if(t.length!==n.length)return!1;for(let s=0;s<t.length;s+=1)if(!Object.is(t[s],n[s]))return!1;return!0}class TOe{#e=null;#t;computeCount=0;get current(){return this.#t}read(n,s){if(this.#e!==null&&ufn(this.#e,n))return this.#t;const c=s(this.#t);return this.#e=n,this.#t=c,this.computeCount+=1,c}}class ffn{#e=new TOe;#t=new TOe;#i=new TOe;#n;#r=Number.NEGATIVE_INFINITY;structural(n,s){const[c,d]=n;if(c===this.#n&&typeof d=="number"&&d<this.#r&&this.#e.current!==void 0)return this.#e.current;const m=this.#e.read(n,s);return c!==this.#n&&(this.#n=c,this.#r=Number.NEGATIVE_INFINITY),typeof d=="number"&&(this.#r=Math.max(this.#r,d)),m}collapsed(n,s){return this.#t.read(n,s)}browse(n,s){return this.#i.read(n,s)}get counts(){return{structural:this.#e.computeCount,collapsed:this.#t.computeCount,browse:this.#i.computeCount}}}function dfn(t){const n=new Map,s=new Map;for(const c of t){if(c.more)continue;n.set(c.pathKey,c.node.id);const d=s.get(c.node.id);d?d.push(c.pathKey):s.set(c.node.id,[c.pathKey])}return{nodeIdByPathKey:n,pathKeysByNodeId:s}}function ZVe(t){const n=t.split("."),s=[];for(let c=1;c<n.length;c++)s.push(n.slice(0,c).join("."));return s}function Lwt(t,n){const s=new Set;for(const c of n)for(const d of t.pathKeysByNodeId.get(c)??[])for(const m of ZVe(d)){const g=t.nodeIdByPathKey.get(m);g&&s.add(g)}return s}function pfn(t,n){const s=new Map;for(const c of n)for(const d of t.pathKeysByNodeId.get(c)??[]){const m=d.split(".");let g=m[0];for(let S=1;S<m.length;S++){const k=Number(m[S]);Number.isFinite(k)&&s.set(g,Math.max(s.get(g)??0,k+1)),g=`${g}.${m[S]}`}}return s}function _fn(t){return t.size===0?"":[...t].sort((n,s)=>n[0]<s[0]?-1:n[0]>s[0]?1:0).map(([n,s])=>`${n}=${String(s)}`).join(",")}const mfn=["position","rotation","scale"];function hfn(t){const n=t.role==="component"&&!!t.typeLabel;return{label:t.label,typeSuffix:n?t.typeLabel:null}}const QVe={locked:!1};function gfn(t){let n;for(const s of mfn){const c=t(s);if(!c||c.writable)return QVe;s==="position"&&(n=c.reason)}return n===void 0?{locked:!0}:{locked:!0,reason:n}}class yfn{entries=new Map;source=null;version=Number.NaN;computed=0;get computeCount(){return this.computed}summaryFor(n,s,c){(this.source!==n||this.version!==s)&&(this.entries.clear(),this.source=n,this.version=s);const d=this.entries.get(c);if(d)return d;this.computed++;const m=n.transforms?.editability,g=m?gfn(S=>m(c,S)):QVe;return this.entries.set(c,g),g}}const vfn={draggable:!0,renamable:!0,writable:!0,searchable:!0},bfn={draggable:!1,renamable:!1,writable:!0,searchable:!0},Sfn={draggable:!1,renamable:!1,writable:!1,searchable:!1};function eUe(t){return t.internal?Sfn:t.structural?bfn:vfn}function xfn(t){return!t||t.length===0?null:{count:t.length,tooltip:t.map(n=>n.message).join(`
1403
- `),codes:t.map(n=>n.code)}}class wfn{entries=new Map;source=null;version=Number.NaN;computed=0;get computeCount(){return this.computed}badgeFor(n,s,c){(this.source!==n||this.version!==s)&&(this.entries.clear(),this.source=n,this.version=s);const d=this.entries.get(c);if(d!==void 0)return d;this.computed++;const m=n.diagnosticsFor?xfn(n.diagnosticsFor(c)):null;return this.entries.set(c,m),m}}const Sme=new Map;function Vxn(t){return Sme.set(t.documentId,t),()=>{Sme.get(t.documentId)===t&&Sme.delete(t.documentId)}}function Tfn(t){return Sme.get(t)??null}function Cfn(t,n){const s=[...n];return s.length===0||s.some(c=>t.hierarchy.node(c)===null)?null:t.rects?{worldId:null,kind:"dom"}:s.every(c=>t.hierarchy.object3D?.(c)!=null)?{worldId:null,kind:"three"}:null}function Efn(t,n){const s=t.childAdapters();let c=null;for(const d of n){const m=s.find(g=>t.groupNodeId(g.worldId)===d)??s.find(g=>t.ownerOf(d)===g.worldId);if(!m||c&&c.worldId!==m.worldId)return null;c=m}return c?{worldId:c.worldId,kind:c.kind,adapter:c.adapter}:null}function kfn(t,n){const s=[...n];if(s.length===0)return null;if(t instanceof hy)return Efn(t,s);const c=Cfn(t,s);return c?{...c,adapter:t}:null}function Afn(t,n){return!n||n.worldId!==null&&oq(n.worldId)?!1:n.kind!=="three"||n.worldId===null?!0:KVe(t)===n.worldId}const XZ=new Map;let pjt=0;const Rje=new Set;function Bwt(){pjt++;for(const t of[...Rje])t()}function Uxn(t,n){const s={store:n};return XZ.set(t,s),Bwt(),()=>{XZ.get(t)===s&&(XZ.delete(t),Bwt())}}function Dfn(t){return t===null?null:XZ.get(t)?.store??null}function Jxn(t){for(const[n,s]of XZ)if(s.store===t)return n;return null}function Wxn(t){return Rje.add(t),()=>{Rje.delete(t)}}function Hxn(){return pjt}const rB=new Map;function Gxn(t){return rB.set(t,(rB.get(t)??0)+1),()=>{const n=(rB.get(t)??1)-1;n>0?rB.set(t,n):rB.delete(t)}}const _jt={count:0,surface:null,visible:!1};function Pfn(t){return t==="three"||t==="canvas"||t==="dom"?t:null}function $wt(t){switch(t){case"scene":case"world":return{kind:"composition"};case"story":return{kind:"story"};case"asset":return{kind:"artifact"};case"document":return{kind:"data"};default:return{kind:"unknown"}}}function Ifn(t){if(t===null)return{kind:"unknown"};const n=l0().find(d=>d.descriptor.id===t);if(!n)return{kind:"unknown"};const s=n.descriptor.presentation?.()??null,c=$wt(s?.kind);return c.kind!=="unknown"?c:$wt(n.descriptor.kind)}function Nfn(t){return t instanceof hy?t.childAdapters().some(n=>n.kind==="three"):!t.rects&&typeof t.hierarchy.object3D=="function"}function Fje(t,n,s,c){const d=Y0(t),m=Lun(t)&&Nfn(d)?"three":null,g=t.playState,S=t.selectedEntityIds.size;if(S===0)return{documentId:n,chrome:c,subject:s,surface:m,selection:_jt,play:g};const k=kfn(d,t.selectedEntityIds);return{documentId:n,chrome:c,subject:s,surface:m,selection:{count:S,surface:Pfn(k?.kind),visible:Afn(t,k)},play:g}}function Ofn(t,n,s="document"){const c=Ifn(n);if(rB.has(n))return{...Fje(t,n,c,s),surface:"canvas"};const d=Tfn(n);if(d===null){const g=l0().find(S=>S.descriptor.id===n)?.descriptor.kind;return g!==void 0&&g!=="game"&&g!=="scene"&&g!=="world"?{documentId:n,chrome:s,subject:c,surface:null,selection:_jt,play:t.playState}:Fje(t,n,c,s)}const m=d.selection().length;return{documentId:n,chrome:s,subject:c,surface:"three",selection:{count:m,surface:m>0?"three":null,visible:!0},play:t.playState}}function Rfn(t){const n=e_();return n!==null?Ofn(t,n):Fje(t,null,{kind:"unknown"},"document")}function Ffn(t){return Dfn(e_())??t}function Mfn(t){return t.surface!=="three"?!1:t.selection.count===0?!0:t.selection.surface==="three"&&t.selection.visible}function Kxn(t){return Mfn(t)?iCt(t.documentId)===null?"gizmo":"modal":"none"}function Xxn(t){return t.surface==="three"&&t.selection.count>0&&t.selection.surface==="three"&&t.selection.visible}function mjt(t){return t.chrome==="embedded"||t.subject.kind==="story"||t.subject.kind==="artifact"}function Yxn(t,n){return mjt(t)?!0:t.subject.kind==="data"&&!n}function Zxn(t){return t.chrome==="document"&&mjt(t)}let xme=null;const Qge=new Set;function Qxn(t){xme=t;for(const n of Qge)n();return()=>{if(xme===t){xme=null;for(const n of Qge)n()}}}function eye(){return xme}function jfn(t){return Qge.add(t),()=>{Qge.delete(t)}}const COe="application/x-editor-asset",EOe="application/x-hierarchy-reorder";function kOe(t){const s=t?.querySelector(".volter-tree-row")?.getBoundingClientRect().height??0;if(s>0)return Math.round(s);const c=t?Number.parseFloat(getComputedStyle(t).getPropertyValue("--volter-tree-row-height")):Number.NaN;return Number.isFinite(c)&&c>0?c:Q3t.treeRow}const hZ="var(--volter-tree-indent)";function wme(t){return`calc(${hZ} * ${t})`}const qwt=5;function Lfn(t,n,s){const c=[];for(let d=0;d<t;d++)c.push({column:d,starts:n===d,ends:s<=d});return c}const Bfn=[],$fn=6,qfn=8,zfn=2400;function Vfn(t){const n=new Map,s=d=>{const m=d.childIds.flatMap(g=>{const S=t.node(g);return S?.role==="document"&&S.secondaryLabel?S.childIds:[g]});return m.length===d.childIds.length&&m.every((g,S)=>g===d.childIds[S])?null:m},c=d=>{let m=n.get(d.id);return m===void 0&&(m=s(d),n.set(d.id,m)),m===null?d:{...d,childIds:m}};return{...t,roots:()=>{const d=t.roots();return d.length===1&&d[0]?.role==="document"?d[0].childIds.map(m=>t.node(m)).filter(m=>m!==null).map(c):d.map(c)},node:d=>{const m=t.node(d);return m?c(m):null}}}const Ufn=300,Jfn=new Map,Wfn={folder:uee,document:oLe,story:VTt,component:GB,instance:qOe,boundary:fee};function Hfn(t){return t.role==="root"?KZ(t.kind,ZTt):t.role==="entity"||t.role==="element"?KZ(t.kind):(t.role?Wfn[t.role]:void 0)??KZ(t.kind)}const hjt=new Set(["folder","root","document","story","boundary"]);function Gfn(t,n,s){let c=t,d=0;for(;c&&d++<1e3;){if(n.includes(c))return!0;c=s.hierarchy.node(c)?.parentId??null}return!1}function Kfn(t,n){return n===null?t.hierarchy.roots().map(s=>s.id):t.hierarchy.node(n)?.childIds??[]}function tUe(t,n){if(!(t instanceof hy))return null;for(const s of t.childAdapters())if(t.groupNodeId(s.worldId)===n){const c=t.inspector?.get(n,"zOrder");return{zOrder:typeof c=="number"?c:s.zOrder,worldId:s.worldId,role:s.role,kind:s.kind,provenance:s.adapter.provenance??null}}return null}function Tme(t,n){return tUe(t,n)!==null}function rUe(t,n){return t instanceof hy&&t.isOrganizationNode(n)}function gjt(t,n){if(!(t instanceof hy))return t;const s=t.ownerOf(n);return t.childAdapters().find(c=>c.worldId===s)?.adapter??t}function zwt(t,n){return n===void 0?t.structure!==void 0:gjt(t,n).structure!==void 0}function Xfn(t,n,s){return Tme(t,n)||rUe(t,n)||s!==void 0&&hjt.has(s)}function Yfn(t,n){const s=new Map,c=[],d=[],m=new Map;for(const g of t)g.more||m.set(g.node.id,g.node.kind);for(const g of t){if(g.more)continue;const S=g.depth===0?0:c[g.depth-1]??0,k=g.depth===0?null:d[g.depth-1],A=Xfn(n,g.node.id,g.node.role),F=S+(A?0:1);c[g.depth]=F,c.length=g.depth+1,d[g.depth]=g.node,d.length=g.depth+1;const D=g.node.childIds.length>0&&g.node.childIds.every(J=>XMt(m.get(J)));s.set(g.node.id,g.node.defaultExpanded??(!D&&(A||F<=1||k?.childIds.length===1)))}return s}function Zfn(t,n,s){const c=new Set;for(const d of t)if(!(d.more||!eUe({structural:!1,internal:s(d.node.id)}).searchable)&&d.node.label.toLowerCase().includes(n)){c.add(d.pathKey);for(const m of ZVe(d.pathKey))c.add(m)}return c}function Qfn(t,n){const s=new Map(t);for(const[c,d]of n)s.set(c,Math.max(s.get(c)??0,d));return s}function edn({value:t,onChange:n}){const s=Ye.useRef(null);return $.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flex:`0 1 var(${rdn}, ${tdn}px)`,minWidth:ndn},children:[$.jsx(dc,{icon:kTt,"aria-hidden":"true",style:{position:"absolute",left:idn,pointerEvents:"none",color:"var(--volter-text-1)",fontSize:"var(--volter-icon-lg)"}}),$.jsx(Zm,{ref:s,type:"text","data-testid":"ingest-search",placeholder:"Search",className:"volter-input",value:t,onChange:c=>n(c.target.value),onKeyDown:c=>{c.key==="Escape"&&(c.stopPropagation(),t!==""?n(""):s.current?.blur())},style:{flex:1,minWidth:0,paddingLeft:`var(${sdn}, ${odn}px)`,paddingRight:adn}})]})}const tdn=64,rdn="--volter-hierarchy-search-basis",ndn=56,idn=2,odn=21,sdn="--volter-hierarchy-search-text-inset",adn=2;function cdn({onCollapseAll:t,onResetExpansion:n,onExpandAll:s}){const[c,d]=Ye.useState(!1),m=Ye.useRef(null);return $.jsxs("div",{ref:m,style:{position:"relative",flexShrink:0},children:[$.jsx(dm,{title:"View","aria-label":"View","aria-haspopup":"menu","aria-expanded":c,"data-testid":"hierarchy-view-menu",onClick:()=>d(g=>!g),variant:"secondary",size:"compact",children:$.jsx(dc,{icon:JTt,"aria-hidden":"true",style:{fontSize:"var(--volter-icon-xs)"}})}),c&&$.jsxs(fN,{autoFocusFirst:!0,dismissBoundaryRef:m,onDismiss:()=>d(!1),style:{position:"absolute",top:"100%",right:0,marginTop:R_[2],minWidth:170},children:[$.jsx(Nc,{"data-testid":"hierarchy-collapse-all",onSelect:()=>{t(),d(!1)},children:"Collapse All"}),$.jsx(Nc,{"data-testid":"hierarchy-reset-expansion",onSelect:()=>{n(),d(!1)},children:"Reset Openness"}),$.jsx(Nc,{"data-testid":"hierarchy-expand-all",onSelect:()=>{s(),d(!1)},children:"Expand All"})]})]})}function ldn({slot:t,search:n,setSearch:s,adapter:c,createTargetId:d,onCollapseAll:m,onResetExpansion:g,onExpandAll:S}){const k=$.jsxs($.Fragment,{children:[$.jsx(edn,{value:n,onChange:s}),$.jsx(cdn,{onCollapseAll:m,onResetExpansion:g,onExpandAll:S}),$.jsx(fdn,{adapter:c,parentId:d})]});return t?MS.createPortal($.jsx("div",{"data-testid":"hierarchy-header-controls",style:{display:"flex",alignItems:"center",gap:G0[1],height:"100%",minWidth:0},children:k}),t):$.jsx(n$,{label:"Hierarchy controls",compact:!0,style:{gap:G0[2]},children:k})}function udn({state:t,adapter:n,store:s,isGroupNode:c,isInternal:d,onRename:m,onClose:g}){const S=Ye.useRef(null),[k,A]=Ye.useState({left:t.x,top:t.y});Ye.useLayoutEffect(()=>{const Yr=S.current;if(!Yr)return;const en=Yr.getBoundingClientRect();A(q3t({top:t.y,left:t.x,width:en.width,height:en.height}))},[t.x,t.y]);const[F,D]=Ye.useState(!1),J=Ye.useRef(!1);Ye.useEffect(()=>{F&&(J.current=!1)},[F]),Ye.useEffect(()=>{const Yr=ii=>{S.current&&!S.current.contains(ii.target)&&g()},en=ii=>{ii.key==="Escape"&&g()};return document.addEventListener("mousedown",Yr),document.addEventListener("keydown",en),()=>{document.removeEventListener("mousedown",Yr),document.removeEventListener("keydown",en)}},[g]);const q=n.hierarchy.node(t.nodeId);if(!q)return null;const G=n.structure?.creatableKinds?.(t.nodeId)??[],pe=gjt(n,t.nodeId).structure,ue=!!pe,Ce=n.inspector?.get(t.nodeId,"name")!==void 0,Fe=n.inspector?.get(t.nodeId,"locked")!==void 0,De=n.inspector?.get(t.nodeId,"locked")===!0,be=n.inspector?.get(t.nodeId,"visible")!==void 0,X=n.inspector?.get(t.nodeId,"visible")!==!1,we=n.inspector?.editability?.(t.nodeId,"locked"),Be=n.inspector?.editability?.(t.nodeId,"visible"),bt=Fe&&(we?.writable??!0),It=be&&(Be?.writable??!0),Wt=[...Ffn(s).selectedEntityIds],zt=Wt.includes(t.nodeId)?Wt:[t.nodeId],ft=U3r(bPt(n,t.nodeId)),tr=pe?.copy?"Copy needs source-addressable entities from one world.":ft,Qt=pe?.paste?"Copy or cut a source-addressable entity in this world first.":ft,Tt=[],vn=eUe({structural:c,internal:d});if(d&&q.parentId!==null&&Tt.push({label:"Select Parent",testId:"hierarchy-context-menu-select-parent",action:()=>{c0(n,[q.parentId]),g()}}),!c&&vn.writable){Tt.push({label:"Rename",testId:"hierarchy-context-menu-rename",...Ce?{}:{disabledReason:ft},action:()=>{m(t.nodeId),g()}}),Tt.push({label:"Cut",testId:"hierarchy-context-menu-cut",...pe?.cut&&(n.structure?.canCopy?.(zt)??!0)?{}:{disabledReason:tr},action:()=>{r0e(n,zt),g()}}),Tt.push({label:"Copy",testId:"hierarchy-context-menu-copy",...pe?.copy&&(n.structure?.canCopy?.(zt)??!0)?{}:{disabledReason:tr},action:()=>{t0e(n,zt),g()}}),Tt.push({label:"Paste",testId:"hierarchy-context-menu-paste",...pe?.paste&&(n.structure?.canPaste?.(q.parentId)??!0)?{}:{disabledReason:Qt},action:()=>{n0e(n,q.parentId),g()}}),Tt.push({label:"Duplicate",testId:"hierarchy-context-menu-duplicate",...ue?{}:{disabledReason:ft},action:()=>{Wt.length>1&&Wt.includes(t.nodeId)?_ve(s):Yye(n,t.nodeId).ack,g()}}),pe?.group&&Wt.length>1&&Wt.includes(t.nodeId)&&Tt.push({label:"Group Selection",testId:"hierarchy-context-menu-group",action:()=>{e0e(n,Wt).ack,g()}}),pe?.ungroup&&pe.canUngroup?.(t.nodeId)&&Tt.push({label:"Ungroup",testId:"hierarchy-context-menu-ungroup",action:()=>{l$e(n,t.nodeId).ack,g()}}),pe?.wrap&&Tt.push({label:"Wrap",testId:"hierarchy-context-menu-wrap",action:()=>{Zye(n,t.nodeId),g()}}),pe?.unwrap&&Tt.push({label:"Unwrap",testId:"hierarchy-context-menu-unwrap",action:()=>{Qye(n,t.nodeId),g()}}),q.parentId!==null&&Tt.push({label:"Select Parent",testId:"hierarchy-context-menu-select-parent",action:()=>{c0(n,[q.parentId]),g()}}),Tt.push({label:be&&!X?"Show":"Hide",...It?{}:{disabledReason:Be?.reason??ft},action:()=>{n.inspector.set(t.nodeId,"visible",!X),s.notifyIngestEdit(),g()}}),Tt.push({label:De?"Unlock":"Lock",...bt?{}:{disabledReason:we?.reason??ft},action:()=>{n.inspector.set(t.nodeId,"locked",!De),s.notifyIngestEdit(),g()}});for(const Yr of i3r({nodeId:t.nodeId,store:s}))Tt.push({label:Yr.label,...Yr.color!==void 0?{color:Yr.color}:{},action:()=>{Yr.action(),g()}});Tt.push({label:"Delete",testId:"hierarchy-context-menu-delete",color:Go.semantic.danger,...ue?{}:{disabledReason:ft},action:()=>{Wt.length>1&&Wt.includes(t.nodeId)?mve(s):n.structure.remove(t.nodeId),g()}})}return $.jsx(rhe,{children:$.jsxs(fN,{ref:S,"data-testid":"ingest-context-menu",style:{position:"fixed",left:k.left,top:k.top,minWidth:150,maxWidth:260,fontSize:"var(--volter-font-base)"},children:[!c&&vn.writable&&G.length>0&&$.jsxs("div",{children:[$.jsxs(Nc,{"data-testid":"hierarchy-context-menu-create",onSelect:()=>D(Yr=>!Yr),style:{justifyContent:"space-between",gap:R_[4]},children:[$.jsx("span",{children:"Create"}),$.jsx(l4t,{direction:"right",tone:"dim"})]}),F&&G.map(Yr=>$.jsx(Nc,{"data-testid":`hierarchy-context-menu-create-${Yr.kind}`,onSelect:()=>{J.current||(J.current=!0,Xye(n,Yr.kind,t.nodeId).ack,g())},style:{paddingLeft:G0[12]},children:Yr.label},Yr.kind))]}),Tt.map(Yr=>Yr.disabledReason!==void 0?$.jsx(Nc,{"data-testid":Yr.testId,"aria-disabled":"true",title:Yr.disabledReason,style:{cursor:"not-allowed",color:Go.content.dim,opacity:.7},children:Yr.label},Yr.label):$.jsx(Nc,{"data-testid":Yr.testId,onSelect:Yr.action,style:Yr.color!==void 0?{color:Yr.color}:void 0,children:Yr.label},Yr.label)),d&&$.jsx("div",{"data-testid":"hierarchy-context-menu-internal-note",style:{padding:`${R_[4]}px ${R_[6]}px`,color:Go.content.dim,maxWidth:240,lineHeight:Aht.normal},children:n.transforms?.editability?.(t.nodeId,"position")?.reason??"This rendered part has no authored source identity."}),!ue&&!d&&$.jsxs("div",{style:{padding:`${R_[4]}px ${R_[6]}px`,color:Go.semantic.warning,maxWidth:240,lineHeight:Aht.normal},children:[$.jsx("strong",{children:"Create / Delete / Reparent — not available."})," This game owns its own scene graph, so structural authoring isn't reapplicable. You can edit transform / material / visibility, or capture a subtree into the first-party editable format."]})]})})}function fdn({adapter:t,parentId:n}){const[s,c]=Ye.useState(!1),d=Ye.useRef(null),m=Ye.useRef(!1),g=t.structure?.creatableKinds?.(n)??[],S=n?t.hierarchy.node(n)?.label:null;return Ye.useEffect(()=>{if(!s)return;m.current=!1;const k=F=>{d.current&&!d.current.contains(F.target)&&c(!1)},A=F=>{F.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",k),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",A)}},[s]),g.length===0?null:$.jsxs("div",{ref:d,style:{position:"relative",flexShrink:0},children:[$.jsxs(Ms,{title:S?`Add to ${S}`:"Add","aria-label":S?`Add to ${S}`:"Add","aria-expanded":s,"data-testid":"hierarchy-add-menu",onClick:()=>c(!s),variant:s?"primary":"secondary",size:"compact",children:[$.jsx(dc,{icon:GTt,style:{fontSize:"var(--volter-font-sm)"}})," ",$.jsx(dc,{icon:iLe,style:{fontSize:"var(--volter-font-xs)"}})]}),s&&$.jsx(fN,{style:{position:"absolute",top:"100%",right:0,marginTop:R_[2],minWidth:130,maxHeight:"min(480px, 70vh)",overflowY:"auto"},children:g.map(k=>$.jsx(Nc,{"data-testid":`hierarchy-add-${k.kind}`,onSelect:()=>{m.current||(m.current=!0,Xye(t,k.kind,n??void 0).ack,c(!1))},children:k.label},k.kind))})]})}function ddn({row:t,onReveal:n}){const s=t.more.hidden;return $.jsxs(Ms,{type:"button",variant:"ghost",className:"volter-hierarchy-more","data-testid":"ingest-row-more",onClick:()=>n(t.more.parentPathKey),style:{paddingLeft:wme(t.depth+1)},children:["… ",s," more"]})}function Vwt(t,n){if(!n)return t;const s=t.toLowerCase(),c=n.toLowerCase(),d=[];let m=0,g=s.indexOf(c,m);if(g<0)return t;let S=0;for(;g>=0;)g>m&&d.push(t.slice(m,g)),d.push($.jsx("mark",{"data-testid":"ingest-row-search-highlight",style:{background:Go.semantic.warning,color:Go.surface.shell,borderRadius:Go.shape.small},children:t.slice(g,g+c.length)},S++)),m=g+c.length,g=s.indexOf(c,m);return m<t.length&&d.push(t.slice(m)),d}function yjt(t,n){return t.length===n.length&&t.every((s,c)=>s===n[c])}function pdn(t,n){const s=t.node,c=n.node;return t.depth===n.depth&&t.pathKey===n.pathKey&&t.hasChildren===n.hasChildren&&t.hiddenByCollapse===n.hiddenByCollapse&&t.more?.parentPathKey===n.more?.parentPathKey&&t.more?.hidden===n.more?.hidden&&s.id===c.id&&s.label===c.label&&s.role===c.role&&s.secondaryLabel===c.secondaryLabel&&s.kind===c.kind&&s.typeLabel===c.typeLabel&&s.parentId===c.parentId&&yjt(s.childIds,c.childIds)&&s.crossSurfaceId===c.crossSurfaceId&&s.crossSurfaceParentId===c.crossSurfaceParentId&&s.crossSurfaceOrder===c.crossSurfaceOrder&&s.crossSurfaceGroupLabel===c.crossSurfaceGroupLabel}function _dn(t,n){return pdn(t.row,n.row)&&t.adapter===n.adapter&&t.store===n.store&&t.isSelected===n.isSelected&&t.isSelectionActive===n.isSelectionActive&&t.isEditing===n.isEditing&&t.isCollapsed===n.isCollapsed&&t.dropZone===n.dropZone&&t.isDragged===n.isDragged&&t.rowIndex===n.rowIndex&&t.prevDepth===n.prevDepth&&t.nextDepth===n.nextDepth&&t.isInternal===n.isInternal&&t.searchTerm===n.searchTerm&&t.lockCache===n.lockCache&&t.warningCache===n.warningCache&&t.editabilityVersion===n.editabilityVersion&&t.adapterVersion===n.adapterVersion&&t.threeRootId===n.threeRootId&&t.onToggleOpen===n.onToggleOpen&&t.onStartEditing===n.onStartEditing&&t.onContextMenu===n.onContextMenu&&t.onDragStart===n.onDragStart&&t.onClick===n.onClick&&t.onEnterScope===n.onEnterScope&&t.typeSuffixShown===n.typeSuffixShown&&t.instanceRuleShown===n.instanceRuleShown&&t.restrictionColumns===n.restrictionColumns&&t.excludeColumnShown===n.excludeColumnShown&&yjt(t.remoteSelectionColors,n.remoteSelectionColors)}const mdn=Ye.memo(function({row:n,adapter:s,store:c,isSelected:d,isSelectionActive:m,isEditing:g,isCollapsed:S,dropZone:k,isDragged:A,rowIndex:F,prevDepth:D,nextDepth:J,isInternal:q,searchTerm:G,lockCache:se,warningCache:pe,editabilityVersion:ue,adapterVersion:Ce,onToggleOpen:Fe,onStartEditing:De,threeRootId:be,onContextMenu:X,onDragStart:we,onClick:Be,onEnterScope:bt,remoteSelectionColors:It,typeSuffixShown:Wt,instanceRuleShown:zt,restrictionColumns:ft,excludeColumnShown:tr}){const{node:Qt,depth:Tt,hasChildren:vn}=n,Yr=tUe(s,Qt.id),en=Yr!==null,ii=rUe(s,Qt.id),No=en||ii||Qt.role!==void 0&&hjt.has(Qt.role),gn=eUe({structural:No,internal:q}),En=No?void 0:s.inspector?.get(Qt.id,"locked"),cs=No?void 0:s.inspector?.get(Qt.id,"name"),On=!No&&s.inspector?.get(Qt.id,"visible")!==void 0,ji=No?void 0:s.inspector?.editability?.(Qt.id,"locked"),Ja=No?void 0:s.inspector?.editability?.(Qt.id,"visible"),_a=No?void 0:s.inspector?.get(Qt.id,"renderVisible"),Pn=_a!==void 0,js=_a!==!1,fa=No?void 0:s.inspector?.editability?.(Qt.id,"renderVisible"),Nt=Pn&&(fa?.writable??!0),$c=No?void 0:s.inspector?.get(Qt.id,"exclude"),Ni=$c!==void 0,Dc=$c===!0,vc=No?void 0:s.inspector?.editability?.(Qt.id,"exclude"),Tf=Ni&&(vc?.writable??!0),Ip=Yr?oq(Yr.worldId):!1,Au=Yr?uMt(Yr.worldId):!1,dl=Yr?fMt(Yr.worldId):!1,bu=en?!Ip:s.inspector?.get(Qt.id,"visible")!==!1,Al=En!==void 0,Ku=En===!0,pl=Al&&(ji?.writable??!0),gs=On&&(Ja?.writable??!0),Xu=cs!==void 0,$r=hfn(Qt),Sl=No?0:s.instances?.describe(Qt.id)?.overrides.length??0,Rl=No?QVe:se.summaryFor(s,ue,Qt.id),mi=No?null:pe.badgeFor(s,ue,Qt.id),tu=No?null:eye()?.detail(s,Qt.id,c)??null,Wc=S&&vn?Qt.childIds.slice(0,$fn).map(Ao=>s.hierarchy.node(Ao)).filter(Ao=>Ao!==null&&XMt(Ao.kind)):[];return $.jsxs("div",{className:"volter-tree-row","data-entity-name":No?void 0:Qt.label,"data-testid":"ingest-row","data-ingest-name":Qt.label,"data-node-role":Qt.role,"data-depth":Tt,"data-selected":d?"true":void 0,"data-selection-active":m?"true":void 0,"data-remotely-selected":It.length>0?"true":void 0,"data-dragging":A?"true":void 0,"data-row-alt":F%2===1?"true":void 0,"data-internal":q?"true":void 0,"data-muted":q||Dc||!No&&!bu?"true":void 0,draggable:gn.draggable,onDragStart:Ao=>we(Ao,Qt.id),onClick:Ao=>{if(Yr?.role==="world"&&LMe(Yr.worldId),Qt.role==="story"){const ia=s instanceof hy?s.ownerOf(Qt.id):null;ia&&LMe(ia),s.stories?.apply(Qt.id,Qt.id)}Be(Ao,Qt.id)},onDoubleClick:()=>{Qt.role==="story"?CD("story",c,{storyId:Qt.id}):Qt.role==="component"||Qt.role==="instance"||Qt.role==="boundary"?bt(Qt.id):gn.renamable&&Xu&&De(Qt.id)},onContextMenu:Ao=>{Ao.preventDefault(),X(Ao,Qt.id)},style:{position:"relative",paddingLeft:wme(Tt),paddingRight:G0[2],gap:G0[2],cursor:"pointer",outline:k==="child"?`1px dashed ${Go.accent.default}`:"none",whiteSpace:"nowrap",overflow:"hidden",fontSize:"var(--volter-font-base)"},children:[k==="before"&&$.jsx(Tht,{position:"before",style:{left:wme(Tt)}}),k==="after"&&$.jsx(Tht,{position:"after",style:{left:wme(Tt)}}),Lfn(Tt,D,J).map(Ao=>$.jsx("span",{className:"volter-tree-indent-guide","aria-hidden":"true",style:{left:`calc(${hZ} * ${Ao.column+.5} - 0.5px)`,top:Ao.starts?qwt:0,bottom:Ao.ends?qwt:0}},Ao.column)),vn?$.jsx(dm,{type:"button",variant:"ghost",size:"compact","aria-label":S?`Expand ${Qt.label}`:`Collapse ${Qt.label}`,"aria-expanded":!S,"data-testid":"ingest-row-caret",onClick:Ao=>{Ao.stopPropagation(),Fe(n,Ao.altKey)},title:"Expand/collapse (Option/Alt-click applies to the branch)",className:"volter-tree-caret",children:$.jsx(dc,{icon:S?ETt:iLe,"aria-hidden":"true"})}):$.jsx("span",{"data-testid":"ingest-row-caret","aria-hidden":"true",style:{width:hZ,flexShrink:0}}),It.length>0&&$.jsx("span",{className:"volter-tree-remote-selection",role:"img",title:`Selected by ${It.length} collaborator${It.length===1?"":"s"}`,"aria-label":"Selected by a collaborator",children:It.slice(0,3).map(Ao=>$.jsx("span",{style:{background:Ao},"aria-hidden":"true"},Ao))}),Yr?.role==="world"&&Yr.worldId===be&&$.jsx("span",{"data-testid":"world-focus-radio","data-world-focused":"true",title:"Live Three world — shown in the viewport",style:{fontSize:"var(--volter-font-xs)",opacity:.8,flexShrink:0},children:$.jsx(dc,{icon:KTt,"aria-hidden":"true"})}),$.jsx("span",{className:"volter-tree-type-glyph",title:Qt.role?`${Qt.role}: ${Qt.kind}`:Qt.kind,style:{width:"var(--volter-icon-md)",fontSize:"var(--volter-icon-sm)",flexShrink:0,textAlign:"center"},children:$.jsx(dc,{icon:Hfn(Qt),"aria-hidden":"true"})}),g?$.jsx(Zm,{autoFocus:!0,defaultValue:Qt.label,onBlur:Ao=>{s.inspector.set(Qt.id,"name",Ao.currentTarget.value),c.notifyIngestEdit(),De("")},onKeyDown:Ao=>{Ao.key==="Enter"&&(s.inspector.set(Qt.id,"name",Ao.currentTarget.value),c.notifyIngestEdit(),De("")),Ao.key==="Escape"&&De("")},onClick:Ao=>Ao.stopPropagation(),"data-variant":"tree-edit",style:{flex:1,minWidth:0}}):$.jsxs("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:[$r.typeSuffix?$.jsxs("span",{"data-testid":"hierarchy-instance-label",...Wt?{}:{title:`Component instance of <${$r.typeSuffix}>`},style:{textDecorationLine:zt?d?"var(--volter-tree-active-name-underline)":"underline":"none",textDecorationStyle:"dotted",textDecorationColor:Go.semantic.instance,textUnderlineOffset:"3px",...d?{color:m?Go.content.active:Go.content.selected}:{}},children:[Vwt(Qt.label,G),!Wt&&Sl>0?"*":""]}):$.jsx("span",{"data-testid":"hierarchy-plain-label",style:d?{color:m?Go.content.active:Go.content.selected}:void 0,children:Vwt(Qt.label,G)}),Wc.map(Ao=>$.jsx("span",{className:"volter-tree-datablock","data-active":m?"true":void 0,title:`${Ao.kind}: ${Ao.label}`,children:$.jsx(dc,{icon:KZ(Ao.kind),"aria-hidden":"true"})},Ao.id)),$r.typeSuffix&&Wt&&$.jsxs("span",{"data-testid":"hierarchy-instance-type","data-type-label":$r.typeSuffix,title:`Component instance of <${$r.typeSuffix}>`,style:{marginLeft:G0[2],fontSize:"var(--volter-font-sm)",color:Go.content.dim},children:["·",$r.typeSuffix,Sl>0?"*":""]}),Qt.secondaryLabel&&$.jsx("span",{style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.5},children:Qt.secondaryLabel}),tu&&$.jsx("span",{"data-testid":"hierarchy-instanced-units",style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.5},children:tu}),Yr?.role==="world"&&Yr.zOrder!==0&&$.jsxs("span",{title:`Z order: ${Yr.zOrder}`,style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.6},children:["Z ",Yr.zOrder]}),Yr?.provenance&&$.jsx("span",{"data-testid":"world-provenance","data-provenance":Yr.provenance.source,title:Yr.provenance.detail,style:{marginLeft:G0[3],fontSize:"var(--volter-font-xs)",padding:`0 ${R_[2]}px`,borderRadius:Go.shape.small,border:`1px solid ${Go.boundary.strong}`,color:Go.content.muted,verticalAlign:"middle"},children:Yr.provenance.label})]}),mi&&$.jsx("span",{"data-testid":"hierarchy-row-warning","data-warning-codes":mi.codes.join(","),"data-warning-count":mi.count,role:"img",title:mi.tooltip,"aria-label":`${Qt.label}: ${mi.tooltip}`,style:{fontSize:"var(--volter-font-sm)",color:Go.semantic.warning,flexShrink:0},children:$.jsx(dc,{icon:fee,"aria-hidden":"true"})}),Rl.locked&&Rl.reason&&$.jsx("span",{"data-testid":"hierarchy-transform-lock",role:"img",title:Rl.reason,"aria-label":`${Qt.label}: ${Rl.reason}`,style:{fontSize:"var(--volter-font-sm)",color:Go.content.dim,flexShrink:0},children:$.jsx(dc,{icon:Nme,"aria-hidden":"true"})}),ft==="select+viewport"&&Al&&gn.writable&&$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-lock",disabled:!pl,title:pl?Ku?"Unlock":"Lock":ji?.reason||"Locked","aria-label":Ku?`Unlock ${Qt.label}`:`Lock ${Qt.label}`,"aria-pressed":Ku,onClick:Ao=>{Ao.stopPropagation(),s.inspector.set(Qt.id,"locked",!Ku),c.notifyIngestEdit()},children:$.jsx(dc,{icon:Ku?Nme:jOe,"aria-hidden":"true"})}),tr&&(Ni&&gn.writable?$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-exclude",disabled:!Tf,title:Tf?Dc?"Include in view layer":"Exclude from view layer":vc?.reason||"Exclusion is read-only","aria-label":Dc?`Include ${Qt.label} in the view layer`:`Exclude ${Qt.label} from the view layer`,"aria-checked":!Dc,role:"checkbox",onClick:Ao=>{Ao.stopPropagation(),s.inspector.set(Qt.id,"exclude",!Dc),c.notifyIngestEdit()},children:$.jsx(dc,{icon:Dc?dun:fun,"aria-hidden":"true"})}):$.jsx("span",{"aria-hidden":"true",style:{width:hZ,flexShrink:0}})),(On||en)&&gn.writable&&$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-visibility",disabled:!en&&!gs,title:en||gs?bu?"Hide":"Show":Ja?.reason||"Visibility is read-only","aria-label":bu?`Hide ${Qt.label}`:`Show ${Qt.label}`,"aria-pressed":!bu,onClick:Ao=>{Ao.stopPropagation(),Yr?(dan(Yr.worldId),c.notifyIngestEdit()):(s.inspector.set(Qt.id,"visible",!bu),c.notifyIngestEdit())},children:$.jsx(dc,{icon:bu?Zje:sLe,"aria-hidden":"true"})}),ft==="viewport+render"&&(Pn&&gn.writable?$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-render-visibility",disabled:!Nt,title:Nt?js?"Disable in renders":"Enable in renders":fa?.reason||"Render visibility is read-only","aria-label":js?`Disable ${Qt.label} in renders`:`Enable ${Qt.label} in renders`,"aria-pressed":!js,onClick:Ao=>{Ao.stopPropagation(),s.inspector.set(Qt.id,"renderVisible",!js),c.notifyIngestEdit()},children:$.jsx(dc,{icon:js?lun:uun,"aria-hidden":"true"})}):$.jsx("span",{"aria-hidden":"true",style:{width:hZ,flexShrink:0}})),Yr&&$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"world-interactive-toggle",title:Au?"Interactive (layer forwards pointer events)":"Not interactive (layer is pointer-events:none)","aria-label":`Forward pointer events to ${Qt.label}`,"aria-pressed":Au,onClick:Ao=>{Ao.stopPropagation(),_an(Yr.worldId),c.notifyIngestEdit()},children:$.jsx(dc,{icon:Z0r,"aria-hidden":"true"})}),Yr&&$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"world-picklock-toggle",title:dl?"Pick-locked (skipped by topmost-layer picking)":"Not pick-locked","aria-label":`Exclude ${Qt.label} from viewport picking`,"aria-pressed":dl,onClick:Ao=>{Ao.stopPropagation(),han(Yr.worldId),c.notifyIngestEdit()},children:$.jsx(dc,{icon:HTt,"aria-hidden":"true"})})]})},_dn);function hdn({store:t,adapter:n}){Ye.useSyncExternalStore(t.subscribe,t.getSnapshot);const s=Ye.useDeferredValue(t.contentVersion);Ye.useSyncExternalStore(R3r,F3r),Ye.useSyncExternalStore(U$,eA,eA);const c=mD().hierarchyTypeSuffix!=="hidden",d=mD().hierarchyInstanceRule!=="hidden",m=mD().hierarchyRestrictions??"select+viewport",[g,S]=Ye.useReducer(zi=>zi+1,0),k=Ye.useRef(t.getSnapshot());k.current=t.getSnapshot();const[A,F]=Ye.useState($un());Ye.useEffect(()=>n.subscribe?.(()=>{k.current=t.getSnapshot(),S()}),[n,t]),Ye.useEffect(()=>qun(F),[]);const D=Ye.useMemo(()=>{const zi=new Map;for(const Jn of A?.participants??[])if(Jn.participantId!==G0e)for(const Cs of Jn.presence.selection){const lc=zi.get(Cs)??[];lc.includes(Jn.color)||lc.push(Jn.color),zi.set(Cs,lc)}return zi},[A]),J=Ye.useRef(new yfn),q=Ye.useRef(new wfn),G=t.hierarchyRowFacetVersion,se=KVe(t),[pe,ue]=Ye.useState(""),Ce=Ye.useSyncExternalStore(efn,Qun,()=>null),[Fe,De]=Ye.useState(null),[be,X]=Ye.useState(null),[we,Be]=Ye.useState(null),[bt,It]=Ye.useState(!1),[Wt,zt]=Ye.useState(null),ft=Ye.useRef(null),[tr,Qt]=Ye.useState(0),Tt=Ye.useRef(null),vn=Ye.useSyncExternalStore(wDt,agt,agt).includes("outliner")?"outliner":void 0,Yr=Ye.useRef(new Map),en=Ye.useRef(new Map),ii=Ye.useRef(new ffn),No=Ye.useRef(0),gn=Ye.useRef(null),En=Ye.useRef(null),cs=Ye.useRef(null),On=Ye.useRef(null),[,ji]=Ye.useReducer(zi=>zi+1,0),Ja=pe.trim().toLowerCase(),_a=of()?.rootPath??"__unscoped__",Pn=n.selection?.get()??[],js=Pn.length===1?Pn[0]:null,fa=[...Pn].sort().join("\0"),Nt=Ye.useMemo(()=>new Set(fa===""?[]:fa.split("\0")),[fa]),$c=Pn.at(-1)??null,Ni=i0e(n),Dc=Ni.at(-1)??null,vc=Ye.useRef("");Ye.useEffect(()=>{if(fa===""||vc.current===fa)return;const zi=Tt.current,Jn=zi?.querySelector('[data-selected="true"]');if(!zi||!Jn)return;const Cs=zi.getBoundingClientRect(),lc=Jn.getBoundingClientRect();(lc.top<Cs.top||lc.bottom>Cs.bottom)&&Jn.scrollIntoView({block:"nearest"}),vc.current=fa}),gn.current!==_a&&(en.current.clear(),gn.current=_a,En.current=null);const Tf=ii.current,Ip=[n,s,g],Au=Tf.structural(Ip,zi=>{const Jn=zun(n,eye()?.marks(n.hierarchy)??sjt),Cs=nfn(Jn),lc=Vfn(Cs.hierarchy),Nu=eye()?.structureLog(t)??null,Fl=Nu?.epoch()??0,Yu=zi?s-zi.contentVersion:0,Pe=zi?Fl-zi.objectMapEpoch:0,Et=zi?.adapter===n&&s===t.contentVersion&&Yu>0&&Yu===Pe?Nu?.parentChangesSince(zi.objectMapEpoch)??null:null,In=(zi&&Et?cfn(lc,zi.structuralRows,Et.changedParentIds):null)??Mwt(lc,new Set),pr=ifn(Vun(Yfn(In,n),In,Ur=>Jn.isComponentRoot(Ur)),Cs);return{adapter:n,contentVersion:s,objectMapEpoch:Fl,marked:Jn,internals:Cs,hierarchyView:lc,structuralRows:In,defaultExpansion:pr,index:dfn(In)}}),{marked:dl,internals:bu,hierarchyView:Al,structuralRows:Ku,defaultExpansion:pl}=Au,gs=zi=>en.current.get(zi)??Yun(_a,zi)??pl.get(zi)??!0,Xu=En.current;if(Xu?.adapter!==n||Xu.selection!==fa){for(const Jn of Lwt(Au.index,Nt))gs(Jn)||(en.current.set(Jn,!0),No.current+=1);[...Nt].every(Jn=>Au.index.pathKeysByNodeId.has(Jn))&&(En.current={adapter:n,selection:fa})}const $r=zi=>gs(zi.node.id),Sl=Ja.length===0&&(b3r()||t.playState!=="stopped"),Rl=Qfn(Yr.current,Sl?pfn(Au.index,Nt):Jfn),mi=ii.current.collapsed([Au,No.current,_a,Dc],()=>{const zi=Dc?Ku.find(Cs=>!Cs.more&&Cs.node.id===Dc)??null:null,Jn=new Set(Ku.filter(Cs=>!Cs.more&&Cs.hasChildren&&!$r(Cs)).map(Cs=>Cs.pathKey));if(zi){Jn.delete(zi.pathKey);for(const Cs of ZVe(zi.pathKey))Jn.delete(Cs)}return{scopeRow:zi,effectiveCollapsedPaths:Jn}}),{scopeRow:tu,effectiveCollapsedPaths:Wc}=mi,Ao=ii.current.browse([Au,mi,Ja,Sl,Sl?_fn(Rl):""],()=>{const zi=Mwt(Al,Wc,Rl,Sl),Jn=Ja?Zfn(Ku,Ja,bu.isInternal):null,Cs=Jn?Ku.filter(Fl=>Jn.has(Fl.pathKey)):zi,Nu=(tu?Cs.filter(Fl=>Fl.pathKey.startsWith(`${tu.pathKey}.`)).map(Fl=>({...Fl,depth:Math.max(0,Fl.depth-tu.depth-1)})):Cs).filter(Fl=>{if(Tme(n,Fl.node.id))return!0;let Yu=Fl.node.parentId;for(;Yu;){const Pe=tUe(n,Yu);if(Pe&&oq(Pe.worldId))return!1;Yu=Al.node(Yu)?.parentId??null}return!0});return{rows:Ja?Nu:Nu.filter(Fl=>!Fl.hiddenByCollapse)}}),{rows:ia}=Ao,Du=Ye.useMemo(()=>ia.some(zi=>!zi.more&&n.inspector?.get(zi.node.id,"exclude")!==void 0),[ia,n,g,s]);Ye.useEffect(()=>{Qt(0),Tt.current&&(Tt.current.scrollTop=0)},[Ja]);const gp=Tt.current?.clientHeight||zfn,Id=kOe(Tt.current),{start:Qs,end:Pu}=ia.length>Ufn?lfn(ia.length,tr,gp,Id,qfn):{start:0,end:ia.length},Ls=ia.slice(Qs,Pu),Ff=Qs*Id,Hs=(ia.length-Pu)*Id,Ds=Ye.useCallback(zi=>{const Jn=Ku.filter(Cs=>Cs.hasChildren).map(Cs=>[Cs.node.id,zi]);for(const[Cs,lc]of Jn)en.current.set(Cs,lc);Rwt(_a,Jn),No.current+=1,ji()},[_a,Ku]),Rc={rows:ia,window:{start:Qs,end:Pu},searchTerm:Ja||null,scopeId:Dc,isExpanded:$r,isInternal:zi=>bu.isInternal(zi),isComponentRoot:zi=>dl.isComponentRoot(zi),foldedInternalCount:zi=>dl.internalChildren?.(zi)?.length??0,expandAll:()=>Ds(!0),collapseAll:()=>Ds(!1)};Ye.useEffect(()=>(Vrn(Rc),()=>Jrn(Rc)),[Rc]);const Ze=Ye.useRef({adapter:n,rows:ia,selectedIds:Nt,structuralRows:Ku,isExpanded:$r,projectIdentity:_a});Ze.current={adapter:n,rows:ia,selectedIds:Nt,structuralRows:Ku,isExpanded:$r,projectIdentity:_a};const jt=Ye.useCallback((zi,Jn)=>{const Cs=Ze.current,lc=!Cs.isExpanded(zi),Nu=[[zi.node.id,lc]];if(Jn){const Fl=`${zi.pathKey}.`;for(const Yu of Cs.structuralRows)Yu.hasChildren&&Yu.pathKey.startsWith(Fl)&&Nu.push([Yu.node.id,lc])}for(const[Fl,Yu]of Nu)en.current.set(Fl,Yu);Rwt(Cs.projectIdentity,Nu),No.current+=1,ji()},[]),mt=Ye.useCallback(()=>{en.current.clear();for(const zi of Lwt(Au.index,Nt))en.current.set(zi,!0);Zun(_a),No.current+=1,ji()},[_a,fa,Au]),xt=Ye.useCallback(zi=>{const Jn=Yr.current;Jn.set(zi,(Jn.get(zi)??Zge)+Zge),No.current+=1,ji()},[]),xr=Ye.useCallback(zi=>{$3r(n,zi)},[n,t]);Ye.useEffect(()=>{if(!fa){On.current=null;return}const zi=On.current;if(zi?.adapter===n&&zi.selection===fa)return;On.current={adapter:n,selection:fa};const Jn=ia.findIndex(Yu=>Nt.has(Yu.node.id)),Cs=Tt.current;if(Jn<0||!Cs)return;const lc=kOe(Cs),Nu=Jn*lc,Fl=Nu+lc;Nu<Cs.scrollTop?Cs.scrollTop=Nu:Fl>Cs.scrollTop+Cs.clientHeight&&(Cs.scrollTop=Math.max(0,Fl-Cs.clientHeight)),Qt(Cs.scrollTop)},[n,ia,Nt,fa]);const Vn=Ye.useCallback((zi,Jn)=>{const Cs=Ze.current;if(Cs.adapter.selection){if(zi.metaKey||zi.ctrlKey){const lc=new Set(Cs.selectedIds);lc.has(Jn)?lc.delete(Jn):lc.add(Jn),c0(Cs.adapter,[...lc])}else if(zi.shiftKey&&cs.current){const lc=Cs.rows.findIndex(Fl=>Fl.node.id===cs.current),Nu=Cs.rows.findIndex(Fl=>Fl.node.id===Jn);if(lc>=0&&Nu>=0){const Fl=Math.min(lc,Nu),Yu=Math.max(lc,Nu),Pe=Cs.rows.slice(Fl,Yu+1).filter(Et=>!Et.more).map(Et=>Et.node.id);c0(Cs.adapter,Pe)}}else c0(Cs.adapter,[Jn]);cs.current=Jn}},[]),eo=Ye.useCallback((zi,Jn)=>{const Cs=Ze.current.selectedIds,lc=Cs.has(Jn)?[...Cs]:[Jn];zt(lc),zi.dataTransfer.effectAllowed="move",zi.dataTransfer.setData(EOe,JSON.stringify(lc)),zi.dataTransfer.setData("text/plain",Jn)},[]),bi=Ye.useCallback((zi,Jn)=>{De({x:zi.clientX,y:zi.clientY,nodeId:Jn})},[]),ta=Ye.useCallback(zi=>{const Jn=zi.dataTransfer.types.includes(EOe),Cs=zi.dataTransfer.types.includes(COe);if(!Jn&&!Cs)return;zi.preventDefault(),zi.dataTransfer.dropEffect=Jn?"move":"copy",ft.current=null;const lc=Tt.current.getBoundingClientRect(),Nu=Tt.current.scrollTop,Fl=zi.clientY-lc.top+Nu,Yu=kOe(Tt.current),Pe=Math.floor(Fl/Yu);if(Pe>=ia.length){Be(null),It(!0),Jn&&Wt&&(ft.current=Nwt({hasStructureWritePath:zwt(n,Wt[0]),targetIsInternal:!1}));return}It(!1);const Et=Pe>=0?ia[Pe]:void 0;if(!Et||Et.more){Be(null);return}const Nr=Nwt({hasStructureWritePath:Jn?zwt(n,Et.node.id):!0,targetIsInternal:bu.isInternal(Et.node.id)});if(Nr!==null){ft.current=Nr,Be(null);return}const In=Fl-Pe*Yu;let pr;if(In<Yu*.25?pr="before":In>Yu*.75?pr="after":pr="child",Jn&&Wt){const Ur=Et.node.id;if(Wt.includes(Ur)||Gfn(Ur,Wt,n))return;if(!Jun(n,Wt,Ur)){Be(null);return}}if(Tme(n,Et.node.id)&&pr!=="child"&&(pr="child"),(Et.node.role==="document"||Et.node.role==="story")&&(pr="child"),Et.node.role==="folder"||Et.node.role==="boundary"){Be(null);return}Be({nodeId:Et.node.id,zone:pr})},[ia,Wt,n,bu]),ic=Ye.useCallback(()=>{Be(null),It(!1),zt(null),ft.current=null},[]),Ps=Ye.useCallback(zi=>{zi.preventDefault(),zi.stopPropagation();const Jn=we,Cs=bt,lc=ft.current;if(Be(null),It(!1),zt(null),ft.current=null,lc!==null){i0(lc);return}const Nu=n.structure,Fl=zi.dataTransfer.getData(EOe);if(Fl&&Nu){const Pe=JSON.parse(Fl);if(Cs){for(const Li of Pe)QO(n,Li,null);return}if(!Jn)return;const Et=ia.find(Li=>Li.node.id===Jn.nodeId);if(!Et)return;const Nr=Et.node.id;if(Jn.zone==="child"){for(const Li of Pe)QO(n,Li,Nr);return}const In=Et.node.parentId,pr=Kfn(n,In).filter(Li=>!Pe.includes(Li)),Ur=pr.indexOf(Nr),Ei=Jn.zone==="before"?Nr:Ur>=0?pr[Ur+1]??null:null;for(const Li of Pe)(n.hierarchy.node(Li)?.parentId??null)!==In&&QO(n,Li,In??null),c$e(n,Li,Ei);return}const Yu=zi.dataTransfer.getData(COe);if(Yu&&n.assetDrop)try{const Pe=JSON.parse(Yu);if(Pe.kind==="scene")return;const Et={item:Pe.component??{kind:"file",name:Pe.name??Pe.path.split("/").pop()??Pe.path}};if(Cs){n.assetDrop.accepts("",Pe.path,Et)&&RFe(n,"",Pe.path,Et);return}if(!Jn)return;const Nr=ia.find(pr=>pr.node.id===Jn.nodeId);if(!Nr)return;const In=Nr.node.id;n.assetDrop.accepts(In,Pe.path,Et)&&RFe(n,In,Pe.path,Et)}catch{}},[we,bt,ia,n]),Iu=SPt(n)??"Untitled";return $.jsxs($ye,{name:null,hideHeader:!0,onPointerDown:()=>CR("hierarchy"),onDragOver:zi=>{zi.dataTransfer.types.includes(COe)&&(zi.preventDefault(),zi.dataTransfer.dropEffect="copy")},style:{flex:1,minWidth:0,minHeight:0,borderRight:`1px solid ${Go.boundary.default}`},children:[$.jsx("span",{"data-testid":"scene-name","data-scene":Iu,style:{display:"none"},children:Iu}),$.jsx(ldn,{slot:Ce,search:pe,setSearch:ue,adapter:n,createTargetId:js,onCollapseAll:()=>Ds(!1),onResetExpansion:mt,onExpandAll:()=>Ds(!0)}),Dc&&$.jsxs("nav",{"data-testid":"selection-scope-breadcrumb","aria-label":"Selection scope",style:{display:"flex",alignItems:"center",gap:3,minHeight:26,padding:`0 ${R_[2]}px`,borderBottom:`1px solid ${Go.boundary.default}`,overflow:"hidden",flexShrink:0},children:[$.jsx(Ms,{variant:"ghost",size:"compact","data-testid":"selection-scope-root",onClick:()=>Agt(n,null),children:"Game"}),Ni.map((zi,Jn)=>{const Cs=n.hierarchy.node(zi);if(!Cs)return null;const lc=Jn===Ni.length-1;return $.jsxs("span",{style:{display:"flex",alignItems:"center",minWidth:0},children:[$.jsx("span",{"aria-hidden":"true",style:{color:Go.content.muted},children:"/"}),$.jsx(Ms,{variant:"ghost",size:"compact","data-testid":"selection-scope-crumb","data-scope-current":lc?"true":void 0,"aria-current":lc?"location":void 0,onClick:()=>Agt(n,zi),style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Cs.label})]},zi)})]}),$.jsxs("div",{ref:Tt,"data-testid":"ingest-hierarchy",className:"volter-content-frost volter-tree-body","data-volter-region":vn,style:{flex:1,minHeight:0,overflow:"auto",position:"relative",pointerEvents:"auto"},onDragOver:ta,onDrop:Ps,onDragEnd:ic,onScroll:zi=>Qt(zi.currentTarget.scrollTop),onDragLeave:zi=>{Tt.current?.contains(zi.relatedTarget)||(Be(null),It(!1))},children:[$.jsx("div",{"data-testid":"game-hierarchy-spacer-top",style:{height:Ff}}),Ls.map((zi,Jn)=>zi.more?$.jsx(ddn,{row:zi,onReveal:xt},jwt(zi)):$.jsx(mdn,{row:zi,rowIndex:Qs+Jn,prevDepth:ia[Qs+Jn-1]?.depth??-1,nextDepth:ia[Qs+Jn+1]?.depth??-1,adapter:n,store:t,isSelected:Nt.has(zi.node.id),isSelectionActive:$c===zi.node.id,isEditing:be===zi.node.id,isCollapsed:Ja?!1:Wc.has(zi.pathKey),dropZone:we&&we.nodeId===zi.node.id?we.zone:null,isDragged:Wt?.includes(zi.node.id)??!1,isInternal:bu.isInternal(zi.node.id),threeRootId:se,searchTerm:Ja,lockCache:J.current,warningCache:q.current,editabilityVersion:G,adapterVersion:g,onToggleOpen:jt,onStartEditing:X,onContextMenu:bi,onDragStart:eo,onClick:Vn,onEnterScope:xr,typeSuffixShown:c,instanceRuleShown:d,restrictionColumns:m,excludeColumnShown:Du,remoteSelectionColors:D.get(zi.node.id)??Bfn},jwt(zi))),$.jsx("div",{"data-testid":"game-hierarchy-spacer-bottom",style:{height:Hs}}),$.jsx("div",{style:{minHeight:40}}),bt&&$.jsx("div",{style:{position:"absolute",left:0,right:0,top:ia.length*Id,height:2,background:Go.accent.default,pointerEvents:"none",zIndex:PI.overlayLow}})]}),Fe&&(()=>{const zi=Al.node(Fe.nodeId),Jn=zi?Tme(n,zi.id)||rUe(n,zi.id):!1;return $.jsx(udn,{state:Fe,adapter:n,store:t,isGroupNode:Jn,isInternal:bu.isInternal(Fe.nodeId),onRename:X,onClose:()=>De(null)})})()]})}function vjt(){const t=Yv(),[,n]=Ye.useReducer(c=>c+1,0);Ye.useSyncExternalStore(i2,X1),Ye.useSyncExternalStore(Cee,AD),Ye.useSyncExternalStore(jfn,eye);const{adapter:s}=Cm(t);return Ye.useEffect(()=>s.subscribe?.(n),[s]),$.jsx(hdn,{store:t,adapter:s},jun(s))}const Sve="https://volter-learn.pages.dev/",gdn=`${Sve}quick-starts/`,ydn=`${Sve}manual/`,Uwt=`${Sve}reference/`;function bjt(t){const n=/^(\d+)\.(\d+)(?:[.+-]|$)/.exec(t?.trim()??"");if(!n)return null;const s=`${Number(n[1])}.${Number(n[2])}`;return s==="0.0"?null:s}function vdn(t){const n=bjt(t);return n===null?Uwt:`${Uwt}${n}/`}function g_e(t){window.open(t,"_blank","noopener,noreferrer")}function bdn(){const t=Yv(),n=Y0(t),s=n.structure,c=[...t.selectedEntityIds],d=c[0],m=d?n.hierarchy.node(d)?.parentId??null:null,g=lve(),S=K9t(),k=Ye.useSyncExternalStore(l2,bFe,bFe);Ye.useSyncExternalStore(dDt,vhe,vhe),Ye.useSyncExternalStore(Uye,fhe,fhe),Ye.useSyncExternalStore(EDt,Ehe,Ehe),Ye.useSyncExternalStore(lLe,YB,YB);const A=X=>{const we=uLe(X);return we.length===0?null:$.jsxs($.Fragment,{children:[$.jsx(H1,{}),we.map(Be=>$.jsx(Nc,{...Be.testId?{"data-testid":Be.testId}:{},disabled:Be.disabled?.({})??!1,onSelect:De(()=>void Be.execute({})),children:typeof Be.label=="function"?Be.label():Be.label},Be.id))]})},F=Ye.useSyncExternalStore(nMt,N$,N$),D=Ye.useSyncExternalStore(mDt,zS,zS),q=Ye.useSyncExternalStore(Rw,of,of)?.config.engine.version??null,G=bjt(q),[se,pe]=Ye.useState(null);tjt(()=>se?jvr():"");const ue=Ye.useRef(null),Ce=Ye.useRef({}),Fe=X=>Ce.current[X]??={current:null};Ye.useEffect(()=>{if(!se)return;const X=we=>{ue.current?.contains(we.target)||pe(null)};return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[se]);const De=X=>()=>{pe(null),X()},be={edit:$.jsxs($.Fragment,{children:[$.jsx(Nc,{disabled:S.busy||!S.canUndo,onSelect:De(()=>g.undo()),children:S.undoLabel?`Undo ${S.undoLabel}`:"Undo"}),$.jsx(Nc,{disabled:S.busy||!S.canRedo,onSelect:De(()=>g.redo()),children:S.redoLabel?`Redo ${S.redoLabel}`:"Redo"}),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(LVe),children:"Undo History…"}),$.jsx(H1,{}),$.jsx(Nc,{disabled:c.length===0||!s?.cut||!(s.canCopy?.(c)??!0),onSelect:De(()=>MVe(t)),children:"Cut"}),$.jsx(Nc,{disabled:c.length===0||!s?.copy||!(s.canCopy?.(c)??!0),onSelect:De(()=>FVe(t)),children:"Copy"}),$.jsx(Nc,{disabled:!s?.paste||!(s.canPaste?.(m)??!0),onSelect:De(()=>jVe(t)),children:"Paste"}),$.jsx(H1,{}),$.jsx(Nc,{disabled:t.selectedEntityIds.size===0,onSelect:De(()=>void _ve(t)),children:"Duplicate"}),$.jsx(Nc,{disabled:t.selectedEntityIds.size===0,onSelect:De(()=>void mve(t)),children:"Delete"}),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(()=>kRt(t)),children:"Select All"}),$.jsx(Nc,{disabled:t.selectedEntityIds.size===0,onSelect:De(()=>t.select(null)),children:"Deselect All"})]}),view:$.jsxs($.Fragment,{children:[$.jsx(Nc,{onSelect:De(()=>SVe()),children:"Command Palette…"}),$.jsx(Nc,{onSelect:De(async()=>{const X=srn(t);try{await navigator.clipboard.writeText(X),ea.log("Copied a link to the current editor view.","editor")}catch(we){ea.error(`Could not copy the editor view link: ${we instanceof Error?we.message:String(we)}`,"editor")}}),children:"Copy View Link"}),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(MBe),children:"Toggle Focus Mode"}),A("view")]}),window:$.jsxs($.Fragment,{children:[AN().filter(X=>Uk(X.id)).map(X=>$.jsxs(Nc,{role:"menuitemradio","aria-checked":D===X.id,"data-testid":`workspace-${X.id}`,title:X.description,onSelect:De(()=>s2(X.id)),children:[$.jsx(dc,{icon:Kk.status.success,style:{opacity:D===X.id?1:0}}),"Workspace: ",X.title]},X.id)),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(ave),children:"Console"}),$.jsx(Nc,{onSelect:De(()=>bC(nee.lightExplorer.id)),children:"Light Explorer"}),$.jsx(Nc,{onSelect:De(()=>FBe("asset-library")),children:"Asset Library"}),$.jsx(Nc,{onSelect:De(()=>bC("generations")),children:"Generations"}),A("window")]}),debug:$.jsx($.Fragment,{children:A("debug")}),tools:$.jsxs($.Fragment,{children:[$.jsxs(Nc,{onSelect:De(()=>gve()),children:["Project Tools…",F.tools.length>0?` (${F.tools.length})`:""]}),$.jsx(H1,{}),k.length?k.map(X=>$.jsx(Nc,{onSelect:De(()=>{X.point==="workspace.document"?tA(X.id):bC(`tool:${X.id}`)}),children:X.title},X.id)):$.jsx(Nc,{disabled:!0,children:"No custom project tools"}),A("tools")]}),help:$.jsxs($.Fragment,{children:[$.jsx(Nc,{"data-testid":"help-learn-home",onSelect:De(()=>g_e(Sve)),children:"volter Learn"}),$.jsx(Nc,{"data-testid":"help-quick-starts",onSelect:De(()=>g_e(gdn)),children:"Quick-starts"}),$.jsx(Nc,{"data-testid":"help-manual",onSelect:De(()=>g_e(ydn)),children:"Manual"}),$.jsx(H1,{}),$.jsx(Nc,{"data-testid":"help-reference",title:G?`API/schema reference pinned to this project's engine (v${q})`:"API/schema reference (no engine version pin available)",onSelect:De(()=>g_e(vdn(q))),children:G?`Reference for v${q}`:"Reference"}),A("help")]})};return $.jsx("div",{ref:ue,style:{display:"flex",alignItems:"stretch",marginLeft:"var(--volter-space-2)"},children:["edit","view","window","debug","tools","help"].map(X=>$.jsxs("div",{ref:Fe(X),style:{position:"relative"},children:[$.jsx(dBe,{"data-testid":`app-menu-${X}`,"aria-haspopup":"menu","aria-expanded":se===X,onClick:()=>pe(we=>we===X?null:X),onKeyDown:we=>{we.key==="ArrowDown"&&(we.preventDefault(),pe(X))},onPointerEnter:()=>{se&&pe(X)},style:{textTransform:"capitalize"},children:X}),se===X&&$.jsx(pBe,{anchorRef:Fe(X),dismissBoundaryRef:Fe(X),align:"start",gap:0,clamp:!0,autoFocusFirst:!0,onDismiss:()=>{const we=ue.current?.querySelector(`[data-testid="app-menu-${X}"]`);pe(null),requestAnimationFrame(()=>we?.focus())},style:{minWidth:190},children:be[X]})]},X))})}const Sdn=new Map,Jwt=new Set;let xdn=0;function wdn(t){return Sdn.get(t)??Tdn}const Tdn=[];function Cdn(t){return Jwt.add(t),()=>Jwt.delete(t)}function Wwt(){return xdn}function Cme({slot:t}){return Ye.useSyncExternalStore(Cdn,Wwt,Wwt),$.jsx($.Fragment,{children:wdn(t).map(n=>$.jsx(n.Content,{},n.owner))})}const IO=[],Mje=new Set;let Sjt=0;function Hwt(){Sjt++;for(const t of Mje)t()}function Edn(t){const n=IO.findIndex(s=>s.owner===t.owner);return n>=0&&IO.splice(n,1),IO.push(t),IO.sort((s,c)=>(s.order??0)-(c.order??0)),Hwt(),()=>{const s=IO.indexOf(t);s<0||(IO.splice(s,1),Hwt())}}async function kdn(t){const n=new Set,s=[];for(const c of IO){let d;try{d=await c.harnesses(t)}catch{continue}for(const m of d)n.has(m.id)||(n.add(m.id),s.push(m))}return s}function Adn(t){return Mje.add(t),()=>{Mje.delete(t)}}function Gwt(){return Sjt}async function pA(t,n){const s=await fetch(`/__editor/share-control${t}`,{...n,headers:{...n?.body?{"Content-Type":"application/json"}:{},...n?.headers}});if(s.status!==204&&sf(s,`Git request ${t} failed`),!s.ok){const c=await s.json().catch(()=>null);throw new Error(typeof c?.error=="string"?c.error:`Git request failed (${s.status}).`)}return s.status===204?void 0:await s.json()}async function Ddn(){const t=await fetch("/__editor/git/status");return L_(t,"Git status failed")}function Pdn(t){return pA("/git/checkpoint",{method:"POST",body:JSON.stringify(t)})}function Idn(t){return pA("/git/publish",{method:"POST",...t?{signal:t}:{}})}function Kwt(t){return pA("/git/stage",{method:"POST",body:JSON.stringify(t)})}function Ndn(t){return pA("/git/fetch",{method:"POST",...t?{signal:t}:{}})}function Odn(t){return pA("/git/update",{method:"POST",...t?{signal:t}:{}})}function Xwt(t){return pA("/git/rebase",{method:"POST",body:JSON.stringify({action:t})})}function Rdn(){return pA("/git/readiness",{method:"POST"})}function Fdn(t){return pA("/git/pull-request",{method:"POST",body:JSON.stringify(t)})}function Mdn(){return pA("/git/pull-request/status")}function jdn(t){return pA("/git/pull-request/merge",{method:"POST",...t?{signal:t}:{}})}function Ldn(){const[t,n]=Ye.useState(null),[s,c]=Ye.useState(!1),[d,m]=Ye.useState(null),[g,S]=Ye.useState([]),[k,A]=Ye.useState(""),[F,D]=Ye.useState(null),[J,q]=Ye.useState(null),[G,se]=Ye.useState(null),[pe,ue]=Ye.useState(!1),Ce=Ye.useRef(null);Ye.useEffect(()=>{Ddn().then(we=>{m(we),S(we.changed.map(Be=>Be.path))}).catch(we=>n(String(we)))},[]);const Fe=we=>{m(we),S(Be=>Be.filter(bt=>we.changed.some(It=>It.path===bt)))},De=async(we,Be,bt)=>{const It=new AbortController;Ce.current=It,q(bt??null),c(!0),n(null),D(null);try{Fe(await we(It.signal)),D(Be)}catch(Wt){n(Wt instanceof Error?Wt.message:String(Wt))}finally{Ce.current===It&&(Ce.current=null),q(null),c(!1)}},be=we=>{se(null),Fdn({title:we}).then(Be=>{Fe(Be.status),D(`Pull request: ${Be.url}`)}).catch(Be=>n(String(Be)))},X=()=>{ue(!1);const we=new AbortController;Ce.current=we,q("Merging pull request"),c(!0),jdn(we.signal).then(Be=>D(`Merged pull request: ${Be.url}`)).catch(Be=>n(String(Be))).finally(()=>{Ce.current===we&&(Ce.current=null),q(null),c(!1)})};return $.jsxs("section",{className:"volter-worktree-version-control",children:[t&&$.jsx("div",{style:{color:Go.semantic.danger,fontSize:YY.sm,marginBottom:5},children:t}),d?.available?$.jsxs("details",{style:{marginTop:G0[4]},children:[$.jsxs("summary",{style:{cursor:"pointer",fontSize:YY.sm},children:["Git · ",d.branch??"detached"," ·"," ",d.dirty?`${d.changed.length} changed`:"clean",d.baseAhead!==null&&d.baseBehind!==null?` · base +${d.baseAhead}/-${d.baseBehind}`:"",d.ahead!==null&&d.behind!==null?` · remote +${d.ahead}/-${d.behind}`:""]}),$.jsxs("div",{style:{display:"grid",gap:5,marginTop:5,fontSize:YY.sm},children:[$.jsxs("span",{style:{color:Go.content.dim},children:[d.repositoryId.slice(0,20)," · ",d.worktreeId.slice(0,20)]}),d.changed.map(we=>{const Be=d.hunks.filter(bt=>bt.path===we.path);return $.jsxs("div",{style:{display:"grid",gap:3},children:[$.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[$.jsx(TD,{"aria-label":`Include ${we.path} in checkpoint`,checked:g.includes(we.path),onChange:bt=>S(It=>bt.target.checked?[...It,we.path]:It.filter(Wt=>Wt!==we.path))}),$.jsxs("code",{style:{minWidth:0,flex:1},children:[we.index,we.worktree," ",we.path]}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void De(()=>Kwt({path:we.path,staged:we.index!==" "&&we.index!=="?"}),we.index!==" "&&we.index!=="?"?`Unstaged ${we.path}.`:`Staged ${we.path}.`),children:we.index!==" "&&we.index!=="?"?"Unstage file":"Stage file"})]}),Be.map(bt=>$.jsxs("div",{style:{display:"flex",gap:5,paddingLeft:22,alignItems:"center"},children:[$.jsxs("code",{style:{minWidth:0,flex:1,color:Go.content.dim},children:[bt.header," · +",bt.additions,"/-",bt.deletions]}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void De(()=>Kwt({path:bt.path,hunkId:bt.id,staged:bt.staged}),bt.staged?"Hunk unstaged.":"Hunk staged."),children:bt.staged?"Unstage hunk":"Stage hunk"})]},bt.id))]},we.path)}),d.rebaseInProgress&&$.jsxs("div",{role:"alert",style:{display:"grid",gap:5,color:Go.semantic.warning},children:[$.jsxs("span",{children:["Rebase paused",d.conflicts.length>0?` · conflicts: ${d.conflicts.join(", ")}`:""]}),$.jsxs("span",{style:{display:"flex",gap:5},children:[$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.conflicts.length>0,onClick:()=>void De(()=>Xwt("continue"),"Rebase continued."),children:"Continue rebase"}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void De(()=>Xwt("abort"),"Rebase aborted."),children:"Abort rebase"})]})]}),d.dirty&&$.jsxs("div",{style:{display:"flex",gap:5},children:[$.jsx(Zm,{"aria-label":"Git checkpoint message",placeholder:"Checkpoint message",value:k,onChange:we=>A(we.target.value),style:{minWidth:0,flex:1}}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||!k.trim()||g.length===0,onClick:()=>void De(()=>Pdn({paths:g,message:k}),"Selected paths checkpointed with verified account attribution.").then(()=>A("")),children:"Checkpoint"})]}),$.jsxs("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:[$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||!d.remoteUrl,onClick:()=>void De(Ndn,"Remote refs fetched and pruned.","Fetching"),children:"Fetch"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||!d.remoteUrl,onClick:()=>void De(Idn,"Branch published.","Publishing"),children:"Publish"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||!d.baseRef,onClick:()=>void De(Odn,"Branch rebased onto its base.","Fetching and rebasing"),children:"Update from base"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s,onClick:()=>void Rdn().then(we=>{Fe(we.status),D(we.ready?"Merge-ready; no merge was performed.":we.reasons.join(" "))}).catch(we=>n(String(we))),children:"Check merge readiness"}),d.github&&d.upstream&&$.jsxs($.Fragment,{children:[$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s,onClick:()=>se(k||d.branch||"Volter Editor changes"),children:"Create PR"}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void Mdn().then(we=>D(we.available?`PR ${we.state??"open"} · ${we.mergeState??"status unknown"} · checks ${we.checks?.passed??0} passed/${we.checks?.pending??0} pending/${we.checks?.failed??0} failed${we.reviewDecision?` · review ${we.reviewDecision}`:""}${we.url?` · ${we.url}`:""}`:we.reason??"No pull request found.")).catch(we=>n(String(we))),children:"PR status"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||d.rebaseInProgress,onClick:()=>ue(!0),children:"Merge PR…"})]})]}),J&&$.jsxs("div",{role:"status",style:{display:"flex",gap:5,alignItems:"center"},children:[$.jsxs("span",{children:[J,"…"]}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",onClick:()=>Ce.current?.abort(),children:"Cancel"})]}),d.history.length>0&&$.jsxs("details",{children:[$.jsx("summary",{style:{cursor:"pointer",color:Go.content.dim},children:"Recent history"}),$.jsx("div",{style:{display:"grid",gap:3,paddingTop:G0[2]},children:d.history.map(we=>$.jsxs("span",{title:`${we.author} · ${we.authoredAt}`,children:[$.jsx("code",{children:we.shortSha})," · ",we.subject]},we.sha))})]}),F&&$.jsx("span",{style:{color:Go.semantic.success},children:F})]})]}):$.jsx("span",{style:{color:Go.content.dim,fontSize:YY.sm},children:"Loading version control…"}),G!==null&&$.jsxs(xRe,{labelledBy:"volter-pull-request-title-heading",onDismiss:()=>se(null),children:[$.jsx(wRe,{titleId:"volter-pull-request-title-heading",title:"Create pull request",description:`Opens a pull request for ${d?.branch??"this branch"} on its remote.`}),$.jsx(L3t,{children:$.jsx(Zm,{"aria-label":"Pull request title",autoFocus:!0,value:G,onChange:we=>se(we.target.value),onKeyDown:we=>{we.key!=="Enter"||!G.trim()||(we.preventDefault(),be(G.trim()))}})}),$.jsxs(TRe,{children:[$.jsx(Ms,{type:"button",variant:"ghost",onClick:()=>se(null),children:"Cancel"}),$.jsx(Ms,{type:"button",variant:"primary",disabled:!G.trim(),onClick:()=>be(G.trim()),children:"Create pull request"})]})]}),pe&&$.jsxs(xRe,{labelledBy:"volter-merge-pr-heading",onDismiss:()=>ue(!1),children:[$.jsx(wRe,{titleId:"volter-merge-pr-heading",title:"Merge pull request",description:`Merging the pull request for ${d?.branch??"this branch"} changes the remote repository.`}),$.jsxs(TRe,{children:[$.jsx(Ms,{type:"button",variant:"ghost",onClick:()=>ue(!1),children:"Cancel"}),$.jsx(Ms,{type:"button",variant:"primary",onClick:X,children:"Merge pull request"})]})]})]})}Edn({owner:"editor-core:supercode",harnesses:async()=>qZr()});const Bdn={worktrees:[],branches:[]};function $dn(t){return`agent/${t.toLocaleLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,42)||"task"}`}function qdn({currentLabel:t,onDone:n,onError:s}){const[c,d]=Ye.useState(""),[m,g]=Ye.useState("agent/task"),[S,k]=Ye.useState(!1),[A,F]=Ye.useState("worktree"),[D,J]=Ye.useState([]),[q,G]=Ye.useState(""),[se,pe]=Ye.useState(!1),ue=Ye.useSyncExternalStore(Adn,Gwt,Gwt);return Ye.useEffect(()=>{let Ce=!0;return kdn(A).then(Fe=>{Ce&&(J(Fe),G(De=>Fe.some(be=>be.id===De)?De:Fe[0]?.id??""))}),()=>{Ce=!1}},[A,ue]),$.jsxs("div",{className:"volter-worktree-delegate",role:"group","aria-label":"Delegate task",children:[$.jsx(_p,{as:"div",variant:"label",children:"Delegate task"}),$.jsx(yBe,{"aria-label":"Task for the agent",placeholder:"Describe a bounded task…",value:c,onChange:Ce=>{const Fe=Ce.target.value;d(Fe),S||g($dn(Fe))}}),$.jsxs("label",{children:[$.jsx("span",{children:"Harness"}),$.jsxs(Iw,{value:q,onChange:Ce=>G(Ce.target.value),children:[D.length===0&&$.jsx("option",{value:"",children:"No harness ready"}),D.map(Ce=>$.jsx("option",{value:Ce.id,children:Ce.label},Ce.id))]})]}),$.jsxs("label",{children:[$.jsx("span",{children:"Isolation"}),$.jsxs(Iw,{value:A,onChange:Ce=>{F(Ce.target.value)},children:[$.jsx("option",{value:"worktree",children:"New worktree (recommended)"}),$.jsx("option",{value:"current",children:"Current worktree (shared files)"})]})]}),A!=="current"&&$.jsxs("label",{children:[$.jsx("span",{children:"Branch"}),$.jsx(Zm,{"aria-label":"Delegated branch",value:m,onChange:Ce=>{k(!0),g(Ce.target.value)}})]}),$.jsx(_p,{as:"div",variant:"caption",tone:"dim",children:A==="worktree"?`Creates a sibling checkout from ${t}, opens its editor, and starts the agent there.`:"The agent edits the files in this live worktree alongside you."}),$.jsx(Ms,{type:"button",variant:"primary",size:"compact",disabled:se||!c.trim()||!q||A!=="current"&&!m.trim(),onClick:()=>{pe(!0),UZr({task:c.trim(),harness:q,isolation:A,...A!=="current"?{branch:m.trim(),from:"HEAD"}:{}}).then(n).catch(Ce=>s(Ce instanceof Error?Ce.message:String(Ce))).finally(()=>pe(!1))},children:se?"Delegating…":"Delegate"})]})}function zdn(t){return t.replace(/[\\/]$/,"").split(/[\\/]/).at(-1)??t}function Vdn(t){const n=t.current?["Current worktree"]:[zdn(t.root)];t.sessions.length>0&&n.push("editor running"),t.dirty?n.push("uncommitted changes"):n.push("clean"),t.ahead&&n.push(`${t.ahead} ahead`),t.behind&&n.push(`${t.behind} behind`);const s=nUe(t);if(s.length===1){const c=s[0];n.push(c.kind==="agent"?`${c.displayName} ${c.status}${c.changeCount>0?` · ${c.changeCount} changes`:""}`:`${c.displayName} here`)}else s.length>1&&n.push(`${s.length} collaborators here`);return n.join(" · ")}function nUe(t){const n=new Map;for(const s of t.sessions)for(const c of s.presence?.participants??[]){const d=n.get(c.participantId);(!d||Date.parse(d.lastSeenAt)<Date.parse(c.lastSeenAt))&&n.set(c.participantId,c)}return[...n.values()].sort((s,c)=>{const d={"needs-input":0,active:1,idle:2,done:3};return d[s.status]-d[c.status]||s.displayName.localeCompare(c.displayName)})}function Udn(t){return t.kind==="agent"?"AI":t.displayName.split(/\s+/).slice(0,2).map(n=>n[0]?.toLocaleUpperCase()??"").join("")}function Ywt({worktree:t}){const n=nUe(t);if(n.length===0)return null;const s=n.slice(0,3);return $.jsxs("span",{className:"volter-worktree-presence",role:"img","aria-label":n.map(c=>`${c.displayName}, ${c.status}`).join("; "),children:[s.map(c=>$.jsx("span",{className:"volter-worktree-avatar","data-kind":c.kind,"data-status":c.status,style:{"--volter-participant-color":c.color},title:`${c.displayName} · ${c.kind} · ${c.status}`,"aria-hidden":"true",children:Udn(c)},c.participantId)),n.length>s.length&&$.jsxs("span",{className:"volter-worktree-avatar volter-worktree-avatar-more","aria-hidden":"true",children:["+",n.length-s.length]})]})}function Zwt(t,...n){const s=t.trim().toLocaleLowerCase();return!s||n.some(c=>c?.toLocaleLowerCase().includes(s))}function Qwt(t,n){return[+!t.current,Math.min(...nUe(t).map(s=>s.status==="needs-input"?0:s.status==="active"?1:s.status==="idle"?2:3)),+(t.branch===null),+(t.sessions.length===0),+!t.dirty,-(t.branch?n.get(t.branch)??0:0)]}function Jdn(t){return(n,s)=>{const c=Qwt(n,t),d=Qwt(s,t);return c.reduce((g,S,k)=>g||S-(d[k]??0),0)||(n.branch??n.root).localeCompare(s.branch??s.root)}}function Wdn(){const[t,n]=Ye.useState(Bdn),[s,c]=Ye.useState({branch:null,worktreeId:null}),[d,m]=Ye.useState(!1),[g,S]=Ye.useState(null),[k,A]=Ye.useState(null),F=Ye.useCallback(async(J=!1)=>{J||m(!0);try{n(await zZr()),A(null)}catch(q){A(q instanceof Error?q.message:String(q))}finally{J||m(!1)}},[]);return Ye.useEffect(()=>{if(L$)return;let J=!0;return $Zr().then(q=>{J&&c(q)}).catch(()=>{}),()=>{J=!1}},[]),{state:t,sessionIdentity:s,loading:d,busy:g,error:k,setError:A,refresh:F,run:async(J,q,G)=>{S(J),A(null);try{await q(),G()}catch(se){A(se instanceof Error?se.message:String(se))}finally{S(null)}}}}function Hdn(){const t=Ye.useRef(null),[n,s]=Ye.useState(!1),[c,d]=Ye.useState(""),[m,g]=Ye.useState(!1),{state:S,sessionIdentity:k,loading:A,busy:F,error:D,setError:J,refresh:q,run:G}=Wdn();if(Ye.useEffect(()=>{n&&q()},[n,q]),L$)return null;const se=S.worktrees.find(ft=>ft.current),pe=se?.branch??k.branch??(S.worktrees.length>0||k.worktreeId?"detached":"Branches"),ue=pe!=="Branches",Ce=new Map(S.branches.map(ft=>[ft.name,ft.updatedAt])),De=[...S.worktrees].sort(Jdn(Ce)).filter(ft=>Zwt(c,ft.branch,ft.root)),be=S.branches.filter(ft=>!ft.worktreeId&&Zwt(c,ft.name)),X=De.slice(0,c.trim()?30:10),we=be.slice(0,c.trim()?50:20),Be=De.length-X.length,bt=be.length-we.length,It=c.trim(),Wt=S.branches.some(ft=>ft.name===It),zt=De.length>0||be.length>0;return $.jsxs("div",{className:"volter-worktree-switcher",children:[$.jsxs(dBe,{ref:t,className:"volter-worktree-trigger","aria-label":ue?`Branches and worktrees, current branch ${pe}${se?.dirty?", uncommitted changes":""}`:"Branches and worktrees","aria-expanded":n,title:ue?`Branches and worktrees — ${pe}${se?.dirty?" (uncommitted changes)":""}`:"Branches and worktrees",onClick:()=>{s(ft=>!ft),n||d("")},onKeyDown:ft=>{ft.key==="ArrowDown"&&(ft.preventDefault(),s(!0))},children:[$.jsx(dc,{icon:c0r}),se?.dirty&&$.jsx("span",{className:"volter-worktree-dirty-dot","aria-hidden":"true"}),se&&$.jsx(Ywt,{worktree:se})]}),n&&$.jsxs(pBe,{anchorRef:t,align:"start",clamp:!0,autoFocusFirst:!1,className:"volter-worktree-menu","aria-label":"Branches and worktrees",onDismiss:()=>s(!1),children:[$.jsxs("div",{className:"volter-worktree-search",children:[$.jsx(Zm,{autoFocus:!0,"aria-label":"Find a branch",placeholder:"Find a branch…",value:c,disabled:F!==null||A,onChange:ft=>d(ft.target.value)}),$.jsx(Ms,{variant:"ghost",size:"compact","aria-label":"Refresh branches and worktrees",title:"Refresh",disabled:F!==null,onClick:()=>void G("refresh",q,()=>{}),children:$.jsx(dc,{icon:CTt})})]}),$.jsx(H1,{}),$.jsxs("div",{className:"volter-worktree-results",children:[A&&S.worktrees.length===0&&$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-empty",children:"Loading branches…"}),X.length>0&&$.jsxs("section",{"aria-label":"Worktrees",children:[$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-section-label",children:"Worktrees"}),X.map(ft=>{const tr=ft.branch??"Detached HEAD";return $.jsxs("div",{className:"volter-worktree-row-shell",children:[$.jsxs(Nc,{className:"volter-worktree-menu-item","data-current":ft.current||void 0,disabled:ft.current||!ft.project||F!==null,"aria-current":ft.current?"true":void 0,title:ft.root,onSelect:()=>void G(ft.worktreeId,()=>VZr(ft.worktreeId),()=>s(!1)),children:[$.jsx("span",{className:"volter-worktree-row-icon",children:ft.current&&$.jsx(dc,{icon:tLe})}),$.jsxs("span",{className:"volter-worktree-row-copy",children:[$.jsxs("span",{className:"volter-worktree-row-title",children:[tr,ft.dirty&&$.jsx("span",{className:"volter-worktree-dirty-dot","aria-hidden":"true"})]}),$.jsx("span",{className:"volter-worktree-row-detail",children:F===ft.worktreeId?"Opening…":Vdn(ft)})]}),$.jsx(Ywt,{worktree:ft})]}),!ft.current&&ft.sessions[0]?.sessionId&&$.jsx(Ms,{type:"button",size:"compact",variant:"ghost","aria-label":`Stop editor for ${tr}`,title:"Stop editor session",disabled:F!==null,onClick:()=>void G(`stop:${ft.worktreeId}`,()=>WZr(ft.worktreeId,ft.sessions[0].sessionId),()=>s(!1)),children:$.jsx(dc,{icon:DTt})}),!ft.current&&ft.sessions.length===0&&!ft.dirty&&$.jsx(Ms,{type:"button",size:"compact",variant:"ghost","aria-label":`Archive worktree ${tr}`,title:"Archive clean worktree",disabled:F!==null,onClick:()=>void G(`archive:${ft.worktreeId}`,()=>JZr(ft.worktreeId),()=>s(!1)),children:$.jsx(dc,{icon:YTt})})]},ft.worktreeId)}),Be>0&&$.jsxs(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-more",children:[Be," more worktrees — search to narrow"]})]}),we.length>0&&$.jsxs("section",{"aria-label":"Local branches",children:[$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-section-label",children:"Local branches"}),we.map(ft=>$.jsxs(Nc,{className:"volter-worktree-menu-item",disabled:F!==null,onSelect:()=>void G(ft.name,()=>USt(ft.name),()=>s(!1)),children:[$.jsx("span",{className:"volter-worktree-row-icon"}),$.jsxs("span",{className:"volter-worktree-row-copy",children:[$.jsx("span",{className:"volter-worktree-row-title",children:ft.name}),$.jsx("span",{className:"volter-worktree-row-detail",children:F===ft.name?"Creating worktree…":"Open in a new worktree"})]})]},ft.name)),bt>0&&$.jsxs(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-more",children:[bt," more ",It?"matches":"branches"," — search to narrow"]})]}),!A&&!zt&&!It&&$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-empty",children:"No branches found."})]}),It&&!Wt&&!A&&$.jsxs($.Fragment,{children:[$.jsx(H1,{}),$.jsxs(Nc,{className:"volter-worktree-create-command",disabled:F!==null,onSelect:()=>void G("create",()=>USt(It),()=>s(!1)),children:[$.jsx("span",{className:"volter-worktree-row-icon",children:"+"}),$.jsxs("span",{className:"volter-worktree-row-copy",children:[$.jsxs("span",{className:"volter-worktree-row-title",children:["Create branch “",It,"”"]}),$.jsx("span",{className:"volter-worktree-row-detail",children:F==="create"?"Creating worktree…":`From ${pe}, in a new worktree`})]})]})]}),!It&&$.jsxs($.Fragment,{children:[$.jsx(H1,{}),m?$.jsx(qdn,{currentLabel:pe,onDone:()=>{g(!1),s(!1),q(!0)},onError:J}):$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-worktree-delegate-open",onClick:()=>g(!0),children:"Delegate to agent…"}),$.jsx(H1,{}),$.jsx(Ldn,{})]}),D&&$.jsx(_p,{as:"div",variant:"caption",tone:"danger",role:"alert",className:"volter-worktree-error",children:D})]})]})}function Gdn({transport:t}){const[,n]=Ye.useReducer(D=>D+1,0);Ye.useEffect(()=>Rw(n),[]);const[s,c]=Ye.useState(!1),d=Ye.useRef(null),m=of(),g=m?.config.name??"No Project",S=m?.config.version??null,k=m?.config.engine.version??null,A=m?.config.manifestVersion??null,F=m?.rootPath??"";return Ye.useEffect(()=>{if(!s)return;const D=J=>{d.current&&!d.current.contains(J.target)&&c(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[s]),$.jsxs("header",{className:"volter-project-header",children:[lee()?.nativeMenus?$.jsx("div",{className:"volter-project-header-left"}):$.jsxs("div",{ref:d,className:"volter-project-header-left",children:[$.jsxs("div",{className:"volter-project-header-cluster volter-chrome-island volter-glass-island",children:[$.jsxs(dBe,{"data-testid":"project-menu-trigger","aria-label":`${g} project menu`,title:F?`${g} — ${F}`:g,onClick:()=>c(D=>!D),onKeyDown:D=>{D.key==="ArrowDown"&&(D.preventDefault(),c(!0))},className:"volter-project-trigger",children:[$.jsx(dc,{icon:Kk.content.project}),$.jsx(_p,{"data-testid":"project-name","data-project":g,"data-project-version":S??void 0,variant:"label",className:"volter-sr-only",children:g})]}),$.jsx(Hdn,{}),$.jsx(bZ,{onPointerDown:()=>c(!1),className:"volter-project-app-menus",children:$.jsx(bdn,{})})]}),$.jsx(Kdn,{}),s&&$.jsxs(fN,{autoFocusFirst:!0,onDismiss:()=>{const D=d.current?.querySelector('[data-testid="project-menu-trigger"]');c(!1),requestAnimationFrame(()=>D?.focus())},className:"volter-project-menu",children:[$.jsx(_p,{"data-testid":"project-menu-name",title:g,variant:"label",truncate:!0,className:"volter-project-menu-name",children:g}),F&&$.jsx(_p,{"data-testid":"project-menu-path",title:F,variant:"caption",tone:"dim",selectable:!0,truncate:!0,className:"volter-project-path",children:F}),S&&k&&A!==null&&$.jsxs($.Fragment,{children:[F&&$.jsx(H1,{}),$.jsxs("div",{"data-testid":"project-version-summary",className:"volter-project-versions",children:[$.jsx("span",{children:"Editor"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",HMt]}),$.jsx("span",{children:"Project"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",S]}),$.jsx("span",{children:"Engine"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",k]}),$.jsx("span",{children:"Format"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",A]})]}),$.jsx(H1,{})]}),F&&$.jsx(Nc,{onSelect:()=>{c(!1),bMe(F)},children:"Show in Finder"}),$.jsx(Nc,{"data-testid":"project-menu-history",onSelect:()=>{c(!1),window.dispatchEvent(new CustomEvent("editor:show-history-tab"))},children:"Undo History…"})]})]}),$.jsx(bZ,{"data-testid":"header-transport",className:"volter-project-transport volter-chrome-island volter-glass-island",align:"center",children:t??$.jsx(Xdn,{})}),$.jsx(bZ,{className:"volter-project-header-right",justify:"end",align:"center",children:$.jsx(Cme,{slot:"header-trailing"})})]})}function Kdn(){Ye.useSyncExternalStore(U$,mhe,mhe),Ye.useSyncExternalStore(dDt,vhe,vhe);const t=Ye.useSyncExternalStore(mDt,zS,zS);if(mD().workspaceTabs!=="shown")return null;const n=AN().filter(s=>Uk(s.id));return $.jsxs($.Fragment,{children:[$.jsx(RTr,{orientation:"vertical",className:"volter-project-menu-rule"}),$.jsx("div",{role:"tablist","aria-label":"Workspaces","data-testid":"workspace-tabs",className:"volter-workspace-tabs",children:n.map(s=>$.jsx("button",{type:"button",role:"tab","aria-selected":s.id===t,title:s.description,className:"volter-workspace-tab",onClick:()=>s2(s.id),children:s.title},s.id))})]})}function Xdn(){Ye.useSyncExternalStore(lLe,YB,YB);const t=Ovr();return t.length===0?null:$.jsx($.Fragment,{children:t.map(({id:n,Component:s})=>$.jsx(s,{documentId:""},n))})}function Ydn({utility:t,testId:n}){const s=t.Content;return $.jsx("div",{className:"volter-dock-panel volter-regular-panel-portal","data-testid":n??`bottom-panel-utility-${t.id}`,"data-editor-hotkey-scope":"workspace","data-volter-noselect":"true",children:$.jsx(s,{})})}function Zdn(t,n){return window.confirm(n)}const Qdn=4,epn=4,tpn=24,rpn=4,npn=3,ipn=new Set(["model","image"]),opn=new Set(["glb","gltf","fbx","obj","dae","stl","ply","spz","bvh","3ds"]);function spn(t){const n=t.lastIndexOf(".");return n>0&&opn.has(t.slice(n+1).toLowerCase())}const apn=new Set(["audio","video","prefab","json"]);function xjt(t){let n=0;const s=[];return async c=>{n>=t&&await new Promise(d=>s.push(d)),n++;try{return await c()}finally{n--,s.shift()?.()}}}function iUe(t){return t.replace(/^(?:\.\/|\/)+/,"").replace(/\/+$/,"")}function cpn(t,n){const s=t?n.slice(t.length+1):n;return s.split("/",1)[0]??s}function eTt(t,n){return t.tier-n.tier||t.depth-n.depth||t.seq-n.seq}function lpn(t,n,s,c){for(const d of t){if(n.length>=c)break;s.has(d.subtree)||(s.add(d.subtree),n.push(d))}for(const d of t){if(n.length>=c)break;n.includes(d)||n.push(d)}}function upn(t,n){const s=[...t].sort(eTt),c=[],d=new Set;for(const m of[1,2]){const g=s.filter(S=>S.tier===m);lpn(g,c,d,n)}return c.sort(eTt),c.map(({path:m,name:g,kind:S})=>({path:m,name:g,kind:S}))}function fpn(t){return ipn.has(t)?1:apn.has(t)?2:0}function dpn(t,n,s,c){for(const d of s){if(d.name.startsWith("."))continue;const m=n.dir?`${n.dir}/${d.name}`:d.name;if(d.type==="directory"){n.depth+1>t.maxDepth?t.truncated=!0:c.push({dir:m,depth:n.depth+1});continue}t.totalAssets++;const g=spn(d.name)?"model":ig(d.name).kind,S=fpn(g);S!==0&&t.candidates.push({path:m,name:d.name,kind:g,tier:S,depth:n.depth,seq:t.seq++,subtree:cpn(t.base,m)})}}async function ppn(t,n,s={}){const c=s.listAssets??K0e,d=s.maxItems??Qdn,m=s.maxListings??tpn,g=xjt(s.listConcurrency??rpn),S=iUe(n),k={base:S,maxDepth:s.maxDepth??epn,candidates:[],totalAssets:0,truncated:!1,failedListings:0,seq:0};let A=0,F=[{dir:S,depth:0}];for(;F.length>0;){const D=Math.max(0,m-A),J=F.slice(0,D);J.length<F.length&&(k.truncated=!0),A+=J.length;const q=await Promise.all(J.map(se=>g(()=>c(t,se.dir)))),G=[];for(const[se,pe]of J.entries()){const ue=q[se];if(!ue||!ue.ok){k.failedListings+=1;continue}dpn(k,pe,ue.entries,G)}F=G}return{items:upn(k.candidates,d),totalAssets:k.totalAssets,scannedAll:!k.truncated&&k.failedListings===0,failedListings:k.failedListings}}const wjt="\0",JO=new Map,_pn=xjt(npn);function mpn(t,n,s){const c=`${t}${wjt}${iUe(n)}`,d=JO.get(c);if(d)return d;const m=_pn(()=>ppn(t,n,s));JO.set(c,m);const g=()=>{JO.get(c)===m&&JO.delete(c)};return m.then(S=>{(S.failedListings>0||S.items.length===0&&S.totalAssets===0)&&g()},g),m}function hpn(t,n){return t===n||t===""||n===""||t.startsWith(`${n}/`)||n.startsWith(`${t}/`)}function tTt(t){if(t===void 0){JO.clear();return}const n=iUe(t);for(const s of[...JO.keys()]){const c=s.slice(s.indexOf(wjt)+1);hpn(c,n)&&JO.delete(s)}}function jje(t,n="$"){return typeof t=="string"?[{path:n,value:t}]:Array.isArray(t)?t.flatMap((s,c)=>jje(s,`${n}[${c}]`)):!t||typeof t!="object"?[]:Object.entries(t).flatMap(([s,c])=>jje(c,`${n}.${s}`))}function gpn(t,n){if(!n||!t.toLowerCase().endsWith(".gltf"))return[];try{const s=JSON.parse(n),c=t.includes("/")?t.slice(0,t.lastIndexOf("/")+1):"";return[...s.buffers??[],...s.images??[]].flatMap(d=>d.uri&&!d.uri.startsWith("data:")?[`${c}${d.uri}`]:[])}catch{return[]}}function ypn(t){const n=new Map(t.files.map(A=>[A.path.replace(/^\//,""),A])),s=t.assetPath.replace(/^\//,""),c=n.get(s),d=new Set,m=ig(s);if(c||d.add("missing-file"),m.importable?m.runtimeReady||d.add("source-only"):d.add("unsupported-format"),c?.text&&m.kind==="json")try{JSON.parse(c.text)}catch{d.add("invalid-metadata")}const g=gpn(s,c?.text);g.some(A=>!n.has(A))&&d.add("missing-dependency");const S=[];for(const A of t.files)if(!(!A.text||!/\.json$/i.test(A.path)))try{for(const F of jje(JSON.parse(A.text))){const D=F.value.replace(/^\//,"");D===s?S.push({ownerPath:A.path,jsonPath:F.path,assetPath:s}):D.startsWith("assets/")&&!n.has(D)&&d.add("broken-asset-reference")}}catch{}d.size===0&&d.add("healthy");const k=new Set(["missing-file","missing-dependency","invalid-metadata","broken-asset-reference"]);return{health:{status:[...d].some(A=>k.has(A))?"error":d.has("healthy")?"healthy":"warning",codes:[...d]},dependencies:g,references:S}}async function Tjt(t,n=""){const s=await t.list(n),c=[];for(const d of s){const m=n?`${n}/${d.name}`:d.name;d.type==="dir"?c.push(...await Tjt(t,m)):/\.json$|\.gltf$/i.test(m)?c.push({path:m,text:await t.read(m)}):c.push({path:m})}return c}async function vpn(t,n){return ypn({assetPath:n,files:await Tjt(t)})}function y_e(t){typeof window>"u"||(window.dispatchEvent(new CustomEvent("editor:asset-mutation",{detail:t})),window.dispatchEvent(new CustomEvent("editor:assets-changed")))}function K4(t){const n=t.replace(/^\/+/,"").replace(/\\/g,"/").replace(/\/{2,}/g,"/");if(!n||n==="."||n.split("/").some(s=>!s||s===".."))throw new Error(`Invalid project asset path: ${t}`);return n}async function AOe(t,n){for(const s of n)if(await t.exists(s))throw new Error(`An asset already exists at ${s}.`)}async function bpn(t,n){const s=S$e(n.history,n.backend);switch(t.type){case"create-folder":{const c=K4(t.path),d=`${c}/.volter-folder`;if(await n.backend.exists(c))throw new Error(`Folder already exists: ${c}.`);return s.write(d,"",{label:`Create folder ${c}`})}case"duplicate":{const c=K4(t.source),d=K4(t.destination);await AOe(n.backend,[d]);const m=await n.backend.readBytes(c);return s.write(d,m,{label:`Duplicate ${c}`})}case"move":{const c=K4(t.source),d=K4(t.destination);await AOe(n.backend,[d]);const m=await n.backend.readBytes(c),g=new Map([[d,m],[c,null]]),S=await s.mutate([...g].map(([k,A])=>({path:k,data:A})),{label:`Move ${c}`});return S&&y_e({type:"move",oldPath:c,newPath:d}),S}case"move-many":{const c=t.moves.map(A=>({source:K4(A.source),destination:K4(A.destination)}));if(c.length===0)return!1;const d=new Set(c.map(A=>A.source)),m=c.map(A=>A.destination);if(new Set(m).size!==m.length)throw new Error("Batch move destinations must be unique.");for(const A of m)if(!d.has(A)&&await n.backend.exists(A))throw new Error(`An asset already exists at ${A}.`);const g=await Promise.all(c.map(async A=>({...A,bytes:await n.backend.readBytes(A.source)}))),S=new Map;for(const{destination:A,bytes:F}of g)S.set(A,F);for(const{source:A}of g)m.includes(A)||S.set(A,null);const k=await s.mutate([...S].map(([A,F])=>({path:A,data:F})),{label:`Move ${c.length} assets`});if(k)for(const A of c)y_e({type:"move",oldPath:A.source,newPath:A.destination});return k}case"delete":{const c=[...new Set(t.paths.map(K4))],d=await s.mutate(c.map(m=>({path:m,data:null})),{label:`Delete ${c.length} asset${c.length===1?"":"s"}`});return d&&y_e({type:"delete",paths:c}),d}case"import":{const c=t.files.map(m=>({path:K4(m.path),data:m.bytes}));await AOe(n.backend,c.map(m=>m.path));const d=await s.mutate(c,{label:`Import ${c.length} asset${c.length===1?"":"s"}`});return d&&y_e({type:"change",paths:c.map(m=>m.path)}),d}}}const Spn=320,xpn=180,wpn="document-preview-v4",gZ=new Map,Tpn=new WPt(async t=>{const n=gZ.get(t);if(await new Promise(s=>{typeof requestIdleCallback=="function"?requestIdleCallback(()=>s(),{timeout:1e3}):setTimeout(s,0)}),[...n.consumers].every(s=>s.aborted))throw new DOMException("Preview demand was cancelled.","AbortError");return n.run()},1);let YZ=null,rTt,DOe=null;const WY=new Set;async function Cjt(t){const n=gR();let s;try{s=await n.list(t)}catch{return[]}const c=[];for(const d of s)d.type==="dir"?c.push(...await Cjt(d.path)):c.push(`${d.path}:${d.size??0}:${d.mtime??0}`);return c}async function Cpn(){const t=of()?.rootPath;return rTt!==t&&(rTt=t,YZ=null),YZ??=Promise.all([LRt([xR,"volter.adapter.ts",".storybook/**/*","src/**/*.ts","src/**/*.tsx","src/**/*.js","src/**/*.jsx","src/**/*.mjs","src/**/*.cjs","src/**/*.json","src/**/*.css"]).then(async n=>Promise.all(n.map(async s=>`${s}:${await SMe(s)??""}`))),Cjt("")]).then(([n,s])=>Ejt([...n,...s].sort().join(`
1403
+ `),codes:t.map(n=>n.code)}}class wfn{entries=new Map;source=null;version=Number.NaN;computed=0;get computeCount(){return this.computed}badgeFor(n,s,c){(this.source!==n||this.version!==s)&&(this.entries.clear(),this.source=n,this.version=s);const d=this.entries.get(c);if(d!==void 0)return d;this.computed++;const m=n.diagnosticsFor?xfn(n.diagnosticsFor(c)):null;return this.entries.set(c,m),m}}const Sme=new Map;function Vxn(t){return Sme.set(t.documentId,t),()=>{Sme.get(t.documentId)===t&&Sme.delete(t.documentId)}}function Tfn(t){return Sme.get(t)??null}function Cfn(t,n){const s=[...n];return s.length===0||s.some(c=>t.hierarchy.node(c)===null)?null:t.rects?{worldId:null,kind:"dom"}:s.every(c=>t.hierarchy.object3D?.(c)!=null)?{worldId:null,kind:"three"}:null}function Efn(t,n){const s=t.childAdapters();let c=null;for(const d of n){const m=s.find(g=>t.groupNodeId(g.worldId)===d)??s.find(g=>t.ownerOf(d)===g.worldId);if(!m||c&&c.worldId!==m.worldId)return null;c=m}return c?{worldId:c.worldId,kind:c.kind,adapter:c.adapter}:null}function kfn(t,n){const s=[...n];if(s.length===0)return null;if(t instanceof hy)return Efn(t,s);const c=Cfn(t,s);return c?{...c,adapter:t}:null}function Afn(t,n){return!n||n.worldId!==null&&oq(n.worldId)?!1:n.kind!=="three"||n.worldId===null?!0:KVe(t)===n.worldId}const XZ=new Map;let pjt=0;const Rje=new Set;function Bwt(){pjt++;for(const t of[...Rje])t()}function Uxn(t,n){const s={store:n};return XZ.set(t,s),Bwt(),()=>{XZ.get(t)===s&&(XZ.delete(t),Bwt())}}function Dfn(t){return t===null?null:XZ.get(t)?.store??null}function Jxn(t){for(const[n,s]of XZ)if(s.store===t)return n;return null}function Wxn(t){return Rje.add(t),()=>{Rje.delete(t)}}function Hxn(){return pjt}const rB=new Map;function Gxn(t){return rB.set(t,(rB.get(t)??0)+1),()=>{const n=(rB.get(t)??1)-1;n>0?rB.set(t,n):rB.delete(t)}}const _jt={count:0,surface:null,visible:!1};function Pfn(t){return t==="three"||t==="canvas"||t==="dom"?t:null}function $wt(t){switch(t){case"scene":case"world":return{kind:"composition"};case"story":return{kind:"story"};case"asset":return{kind:"artifact"};case"document":return{kind:"data"};default:return{kind:"unknown"}}}function Ifn(t){if(t===null)return{kind:"unknown"};const n=l0().find(d=>d.descriptor.id===t);if(!n)return{kind:"unknown"};const s=n.descriptor.presentation?.()??null,c=$wt(s?.kind);return c.kind!=="unknown"?c:$wt(n.descriptor.kind)}function Nfn(t){return t instanceof hy?t.childAdapters().some(n=>n.kind==="three"):!t.rects&&typeof t.hierarchy.object3D=="function"}function Fje(t,n,s,c){const d=Y0(t),m=Lun(t)&&Nfn(d)?"three":null,g=t.playState,S=t.selectedEntityIds.size;if(S===0)return{documentId:n,chrome:c,subject:s,surface:m,selection:_jt,play:g};const k=kfn(d,t.selectedEntityIds);return{documentId:n,chrome:c,subject:s,surface:m,selection:{count:S,surface:Pfn(k?.kind),visible:Afn(t,k)},play:g}}function Ofn(t,n,s="document"){const c=Ifn(n);if(rB.has(n))return{...Fje(t,n,c,s),surface:"canvas"};const d=Tfn(n);if(d===null){const g=l0().find(S=>S.descriptor.id===n)?.descriptor.kind;return g!==void 0&&g!=="game"&&g!=="scene"&&g!=="world"?{documentId:n,chrome:s,subject:c,surface:null,selection:_jt,play:t.playState}:Fje(t,n,c,s)}const m=d.selection().length;return{documentId:n,chrome:s,subject:c,surface:"three",selection:{count:m,surface:m>0?"three":null,visible:!0},play:t.playState}}function Rfn(t){const n=e_();return n!==null?Ofn(t,n):Fje(t,null,{kind:"unknown"},"document")}function Ffn(t){return Dfn(e_())??t}function Mfn(t){return t.surface!=="three"?!1:t.selection.count===0?!0:t.selection.surface==="three"&&t.selection.visible}function Kxn(t){return Mfn(t)?iCt(t.documentId)===null?"gizmo":"modal":"none"}function Xxn(t){return t.surface==="three"&&t.selection.count>0&&t.selection.surface==="three"&&t.selection.visible}function mjt(t){return t.chrome==="embedded"||t.subject.kind==="story"||t.subject.kind==="artifact"}function Yxn(t,n){return mjt(t)?!0:t.subject.kind==="data"&&!n}function Zxn(t){return t.chrome==="document"&&mjt(t)}let xme=null;const Qge=new Set;function Qxn(t){xme=t;for(const n of Qge)n();return()=>{if(xme===t){xme=null;for(const n of Qge)n()}}}function eye(){return xme}function jfn(t){return Qge.add(t),()=>{Qge.delete(t)}}const COe="application/x-editor-asset",EOe="application/x-hierarchy-reorder";function kOe(t){const s=t?.querySelector(".volter-tree-row")?.getBoundingClientRect().height??0;if(s>0)return Math.round(s);const c=t?Number.parseFloat(getComputedStyle(t).getPropertyValue("--volter-tree-row-height")):Number.NaN;return Number.isFinite(c)&&c>0?c:Q3t.treeRow}const hZ="var(--volter-tree-indent)";function wme(t){return`calc(${hZ} * ${t})`}const qwt=5;function Lfn(t,n,s){const c=[];for(let d=0;d<t;d++)c.push({column:d,starts:n===d,ends:s<=d});return c}const Bfn=[],$fn=6,qfn=8,zfn=2400;function Vfn(t){const n=new Map,s=d=>{const m=d.childIds.flatMap(g=>{const S=t.node(g);return S?.role==="document"&&S.secondaryLabel?S.childIds:[g]});return m.length===d.childIds.length&&m.every((g,S)=>g===d.childIds[S])?null:m},c=d=>{let m=n.get(d.id);return m===void 0&&(m=s(d),n.set(d.id,m)),m===null?d:{...d,childIds:m}};return{...t,roots:()=>{const d=t.roots();return d.length===1&&d[0]?.role==="document"?d[0].childIds.map(m=>t.node(m)).filter(m=>m!==null).map(c):d.map(c)},node:d=>{const m=t.node(d);return m?c(m):null}}}const Ufn=300,Jfn=new Map,Wfn={folder:uee,document:oLe,story:VTt,component:GB,instance:qOe,boundary:fee};function Hfn(t){return t.role==="root"?KZ(t.kind,ZTt):t.role==="entity"||t.role==="element"?KZ(t.kind):(t.role?Wfn[t.role]:void 0)??KZ(t.kind)}const hjt=new Set(["folder","root","document","story","boundary"]);function Gfn(t,n,s){let c=t,d=0;for(;c&&d++<1e3;){if(n.includes(c))return!0;c=s.hierarchy.node(c)?.parentId??null}return!1}function Kfn(t,n){return n===null?t.hierarchy.roots().map(s=>s.id):t.hierarchy.node(n)?.childIds??[]}function tUe(t,n){if(!(t instanceof hy))return null;for(const s of t.childAdapters())if(t.groupNodeId(s.worldId)===n){const c=t.inspector?.get(n,"zOrder");return{zOrder:typeof c=="number"?c:s.zOrder,worldId:s.worldId,role:s.role,kind:s.kind,provenance:s.adapter.provenance??null}}return null}function Tme(t,n){return tUe(t,n)!==null}function rUe(t,n){return t instanceof hy&&t.isOrganizationNode(n)}function gjt(t,n){if(!(t instanceof hy))return t;const s=t.ownerOf(n);return t.childAdapters().find(c=>c.worldId===s)?.adapter??t}function zwt(t,n){return n===void 0?t.structure!==void 0:gjt(t,n).structure!==void 0}function Xfn(t,n,s){return Tme(t,n)||rUe(t,n)||s!==void 0&&hjt.has(s)}function Yfn(t,n){const s=new Map,c=[],d=[],m=new Map;for(const g of t)g.more||m.set(g.node.id,g.node.kind);for(const g of t){if(g.more)continue;const S=g.depth===0?0:c[g.depth-1]??0,k=g.depth===0?null:d[g.depth-1],A=Xfn(n,g.node.id,g.node.role),F=S+(A?0:1);c[g.depth]=F,c.length=g.depth+1,d[g.depth]=g.node,d.length=g.depth+1;const D=g.node.childIds.length>0&&g.node.childIds.every(J=>XMt(m.get(J)));s.set(g.node.id,g.node.defaultExpanded??(!D&&(A||F<=1||k?.childIds.length===1)))}return s}function Zfn(t,n,s){const c=new Set;for(const d of t)if(!(d.more||!eUe({structural:!1,internal:s(d.node.id)}).searchable)&&d.node.label.toLowerCase().includes(n)){c.add(d.pathKey);for(const m of ZVe(d.pathKey))c.add(m)}return c}function Qfn(t,n){const s=new Map(t);for(const[c,d]of n)s.set(c,Math.max(s.get(c)??0,d));return s}function edn({value:t,onChange:n}){const s=Ye.useRef(null);return $.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flex:`0 1 var(${rdn}, ${tdn}px)`,minWidth:ndn},children:[$.jsx(dc,{icon:kTt,"aria-hidden":"true",style:{position:"absolute",left:idn,pointerEvents:"none",color:"var(--volter-text-1)",fontSize:"var(--volter-icon-lg)"}}),$.jsx(Zm,{ref:s,type:"text","data-testid":"ingest-search",placeholder:"Search",className:"volter-input",value:t,onChange:c=>n(c.target.value),onKeyDown:c=>{c.key==="Escape"&&(c.stopPropagation(),t!==""?n(""):s.current?.blur())},style:{flex:1,minWidth:0,paddingLeft:`var(${sdn}, ${odn}px)`,paddingRight:adn}})]})}const tdn=64,rdn="--volter-hierarchy-search-basis",ndn=56,idn=2,odn=21,sdn="--volter-hierarchy-search-text-inset",adn=2;function cdn({onCollapseAll:t,onResetExpansion:n,onExpandAll:s}){const[c,d]=Ye.useState(!1),m=Ye.useRef(null);return $.jsxs("div",{ref:m,style:{position:"relative",flexShrink:0},children:[$.jsx(dm,{title:"View","aria-label":"View","aria-haspopup":"menu","aria-expanded":c,"data-testid":"hierarchy-view-menu",onClick:()=>d(g=>!g),variant:"secondary",size:"compact",children:$.jsx(dc,{icon:JTt,"aria-hidden":"true",style:{fontSize:"var(--volter-icon-xs)"}})}),c&&$.jsxs(fN,{autoFocusFirst:!0,dismissBoundaryRef:m,onDismiss:()=>d(!1),style:{position:"absolute",top:"100%",right:0,marginTop:R_[2],minWidth:170},children:[$.jsx(Nc,{"data-testid":"hierarchy-collapse-all",onSelect:()=>{t(),d(!1)},children:"Collapse All"}),$.jsx(Nc,{"data-testid":"hierarchy-reset-expansion",onSelect:()=>{n(),d(!1)},children:"Reset Openness"}),$.jsx(Nc,{"data-testid":"hierarchy-expand-all",onSelect:()=>{s(),d(!1)},children:"Expand All"})]})]})}function ldn({slot:t,search:n,setSearch:s,adapter:c,createTargetId:d,onCollapseAll:m,onResetExpansion:g,onExpandAll:S}){const k=$.jsxs($.Fragment,{children:[$.jsx(edn,{value:n,onChange:s}),$.jsx(cdn,{onCollapseAll:m,onResetExpansion:g,onExpandAll:S}),$.jsx(fdn,{adapter:c,parentId:d})]});return t?MS.createPortal($.jsx("div",{"data-testid":"hierarchy-header-controls",style:{display:"flex",alignItems:"center",gap:G0[1],height:"100%",minWidth:0},children:k}),t):$.jsx(n$,{label:"Hierarchy controls",compact:!0,style:{gap:G0[2]},children:k})}function udn({state:t,adapter:n,store:s,isGroupNode:c,isInternal:d,onRename:m,onClose:g}){const S=Ye.useRef(null),[k,A]=Ye.useState({left:t.x,top:t.y});Ye.useLayoutEffect(()=>{const Yr=S.current;if(!Yr)return;const en=Yr.getBoundingClientRect();A(q3t({top:t.y,left:t.x,width:en.width,height:en.height}))},[t.x,t.y]);const[F,D]=Ye.useState(!1),J=Ye.useRef(!1);Ye.useEffect(()=>{F&&(J.current=!1)},[F]),Ye.useEffect(()=>{const Yr=ii=>{S.current&&!S.current.contains(ii.target)&&g()},en=ii=>{ii.key==="Escape"&&g()};return document.addEventListener("mousedown",Yr),document.addEventListener("keydown",en),()=>{document.removeEventListener("mousedown",Yr),document.removeEventListener("keydown",en)}},[g]);const q=n.hierarchy.node(t.nodeId);if(!q)return null;const G=n.structure?.creatableKinds?.(t.nodeId)??[],pe=gjt(n,t.nodeId).structure,ue=!!pe,Ce=n.inspector?.get(t.nodeId,"name")!==void 0,Fe=n.inspector?.get(t.nodeId,"locked")!==void 0,De=n.inspector?.get(t.nodeId,"locked")===!0,be=n.inspector?.get(t.nodeId,"visible")!==void 0,X=n.inspector?.get(t.nodeId,"visible")!==!1,we=n.inspector?.editability?.(t.nodeId,"locked"),Be=n.inspector?.editability?.(t.nodeId,"visible"),bt=Fe&&(we?.writable??!0),It=be&&(Be?.writable??!0),Wt=[...Ffn(s).selectedEntityIds],zt=Wt.includes(t.nodeId)?Wt:[t.nodeId],ft=U3r(bPt(n,t.nodeId)),tr=pe?.copy?"Copy needs source-addressable entities from one world.":ft,Qt=pe?.paste?"Copy or cut a source-addressable entity in this world first.":ft,Tt=[],vn=eUe({structural:c,internal:d});if(d&&q.parentId!==null&&Tt.push({label:"Select Parent",testId:"hierarchy-context-menu-select-parent",action:()=>{c0(n,[q.parentId]),g()}}),!c&&vn.writable){Tt.push({label:"Rename",testId:"hierarchy-context-menu-rename",...Ce?{}:{disabledReason:ft},action:()=>{m(t.nodeId),g()}}),Tt.push({label:"Cut",testId:"hierarchy-context-menu-cut",...pe?.cut&&(n.structure?.canCopy?.(zt)??!0)?{}:{disabledReason:tr},action:()=>{r0e(n,zt),g()}}),Tt.push({label:"Copy",testId:"hierarchy-context-menu-copy",...pe?.copy&&(n.structure?.canCopy?.(zt)??!0)?{}:{disabledReason:tr},action:()=>{t0e(n,zt),g()}}),Tt.push({label:"Paste",testId:"hierarchy-context-menu-paste",...pe?.paste&&(n.structure?.canPaste?.(q.parentId)??!0)?{}:{disabledReason:Qt},action:()=>{n0e(n,q.parentId),g()}}),Tt.push({label:"Duplicate",testId:"hierarchy-context-menu-duplicate",...ue?{}:{disabledReason:ft},action:()=>{Wt.length>1&&Wt.includes(t.nodeId)?_ve(s):Yye(n,t.nodeId).ack,g()}}),pe?.group&&Wt.length>1&&Wt.includes(t.nodeId)&&Tt.push({label:"Group Selection",testId:"hierarchy-context-menu-group",action:()=>{e0e(n,Wt).ack,g()}}),pe?.ungroup&&pe.canUngroup?.(t.nodeId)&&Tt.push({label:"Ungroup",testId:"hierarchy-context-menu-ungroup",action:()=>{l$e(n,t.nodeId).ack,g()}}),pe?.wrap&&Tt.push({label:"Wrap",testId:"hierarchy-context-menu-wrap",action:()=>{Zye(n,t.nodeId),g()}}),pe?.unwrap&&Tt.push({label:"Unwrap",testId:"hierarchy-context-menu-unwrap",action:()=>{Qye(n,t.nodeId),g()}}),q.parentId!==null&&Tt.push({label:"Select Parent",testId:"hierarchy-context-menu-select-parent",action:()=>{c0(n,[q.parentId]),g()}}),Tt.push({label:be&&!X?"Show":"Hide",...It?{}:{disabledReason:Be?.reason??ft},action:()=>{n.inspector.set(t.nodeId,"visible",!X),s.notifyIngestEdit(),g()}}),Tt.push({label:De?"Unlock":"Lock",...bt?{}:{disabledReason:we?.reason??ft},action:()=>{n.inspector.set(t.nodeId,"locked",!De),s.notifyIngestEdit(),g()}});for(const Yr of i3r({nodeId:t.nodeId,store:s}))Tt.push({label:Yr.label,...Yr.color!==void 0?{color:Yr.color}:{},action:()=>{Yr.action(),g()}});Tt.push({label:"Delete",testId:"hierarchy-context-menu-delete",color:Go.semantic.danger,...ue?{}:{disabledReason:ft},action:()=>{Wt.length>1&&Wt.includes(t.nodeId)?mve(s):n.structure.remove(t.nodeId),g()}})}return $.jsx(rhe,{children:$.jsxs(fN,{ref:S,"data-testid":"ingest-context-menu",style:{position:"fixed",left:k.left,top:k.top,minWidth:150,maxWidth:260,fontSize:"var(--volter-font-base)"},children:[!c&&vn.writable&&G.length>0&&$.jsxs("div",{children:[$.jsxs(Nc,{"data-testid":"hierarchy-context-menu-create",onSelect:()=>D(Yr=>!Yr),style:{justifyContent:"space-between",gap:R_[4]},children:[$.jsx("span",{children:"Create"}),$.jsx(l4t,{direction:"right",tone:"dim"})]}),F&&G.map(Yr=>$.jsx(Nc,{"data-testid":`hierarchy-context-menu-create-${Yr.kind}`,onSelect:()=>{J.current||(J.current=!0,Xye(n,Yr.kind,t.nodeId).ack,g())},style:{paddingLeft:G0[12]},children:Yr.label},Yr.kind))]}),Tt.map(Yr=>Yr.disabledReason!==void 0?$.jsx(Nc,{"data-testid":Yr.testId,"aria-disabled":"true",title:Yr.disabledReason,style:{cursor:"not-allowed",color:Go.content.dim,opacity:.7},children:Yr.label},Yr.label):$.jsx(Nc,{"data-testid":Yr.testId,onSelect:Yr.action,style:Yr.color!==void 0?{color:Yr.color}:void 0,children:Yr.label},Yr.label)),d&&$.jsx("div",{"data-testid":"hierarchy-context-menu-internal-note",style:{padding:`${R_[4]}px ${R_[6]}px`,color:Go.content.dim,maxWidth:240,lineHeight:Aht.normal},children:n.transforms?.editability?.(t.nodeId,"position")?.reason??"This rendered part has no authored source identity."}),!ue&&!d&&$.jsxs("div",{style:{padding:`${R_[4]}px ${R_[6]}px`,color:Go.semantic.warning,maxWidth:240,lineHeight:Aht.normal},children:[$.jsx("strong",{children:"Create / Delete / Reparent — not available."})," This game owns its own scene graph, so structural authoring isn't reapplicable. You can edit transform / material / visibility, or capture a subtree into the first-party editable format."]})]})})}function fdn({adapter:t,parentId:n}){const[s,c]=Ye.useState(!1),d=Ye.useRef(null),m=Ye.useRef(!1),g=t.structure?.creatableKinds?.(n)??[],S=n?t.hierarchy.node(n)?.label:null;return Ye.useEffect(()=>{if(!s)return;m.current=!1;const k=F=>{d.current&&!d.current.contains(F.target)&&c(!1)},A=F=>{F.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",k),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",A)}},[s]),g.length===0?null:$.jsxs("div",{ref:d,style:{position:"relative",flexShrink:0},children:[$.jsxs(Ms,{title:S?`Add to ${S}`:"Add","aria-label":S?`Add to ${S}`:"Add","aria-expanded":s,"data-testid":"hierarchy-add-menu",onClick:()=>c(!s),variant:s?"primary":"secondary",size:"compact",children:[$.jsx(dc,{icon:GTt,style:{fontSize:"var(--volter-font-sm)"}})," ",$.jsx(dc,{icon:iLe,style:{fontSize:"var(--volter-font-xs)"}})]}),s&&$.jsx(fN,{style:{position:"absolute",top:"100%",right:0,marginTop:R_[2],minWidth:130,maxHeight:"min(480px, 70vh)",overflowY:"auto"},children:g.map(k=>$.jsx(Nc,{"data-testid":`hierarchy-add-${k.kind}`,onSelect:()=>{m.current||(m.current=!0,Xye(t,k.kind,n??void 0).ack,c(!1))},children:k.label},k.kind))})]})}function ddn({row:t,onReveal:n}){const s=t.more.hidden;return $.jsxs(Ms,{type:"button",variant:"ghost",className:"volter-hierarchy-more","data-testid":"ingest-row-more",onClick:()=>n(t.more.parentPathKey),style:{paddingLeft:wme(t.depth+1)},children:["… ",s," more"]})}function Vwt(t,n){if(!n)return t;const s=t.toLowerCase(),c=n.toLowerCase(),d=[];let m=0,g=s.indexOf(c,m);if(g<0)return t;let S=0;for(;g>=0;)g>m&&d.push(t.slice(m,g)),d.push($.jsx("mark",{"data-testid":"ingest-row-search-highlight",style:{background:Go.semantic.warning,color:Go.surface.shell,borderRadius:Go.shape.small},children:t.slice(g,g+c.length)},S++)),m=g+c.length,g=s.indexOf(c,m);return m<t.length&&d.push(t.slice(m)),d}function yjt(t,n){return t.length===n.length&&t.every((s,c)=>s===n[c])}function pdn(t,n){const s=t.node,c=n.node;return t.depth===n.depth&&t.pathKey===n.pathKey&&t.hasChildren===n.hasChildren&&t.hiddenByCollapse===n.hiddenByCollapse&&t.more?.parentPathKey===n.more?.parentPathKey&&t.more?.hidden===n.more?.hidden&&s.id===c.id&&s.label===c.label&&s.role===c.role&&s.secondaryLabel===c.secondaryLabel&&s.kind===c.kind&&s.typeLabel===c.typeLabel&&s.parentId===c.parentId&&yjt(s.childIds,c.childIds)&&s.crossSurfaceId===c.crossSurfaceId&&s.crossSurfaceParentId===c.crossSurfaceParentId&&s.crossSurfaceOrder===c.crossSurfaceOrder&&s.crossSurfaceGroupLabel===c.crossSurfaceGroupLabel}function _dn(t,n){return pdn(t.row,n.row)&&t.adapter===n.adapter&&t.store===n.store&&t.isSelected===n.isSelected&&t.isSelectionActive===n.isSelectionActive&&t.isEditing===n.isEditing&&t.isCollapsed===n.isCollapsed&&t.dropZone===n.dropZone&&t.isDragged===n.isDragged&&t.rowIndex===n.rowIndex&&t.prevDepth===n.prevDepth&&t.nextDepth===n.nextDepth&&t.isInternal===n.isInternal&&t.searchTerm===n.searchTerm&&t.lockCache===n.lockCache&&t.warningCache===n.warningCache&&t.editabilityVersion===n.editabilityVersion&&t.adapterVersion===n.adapterVersion&&t.threeRootId===n.threeRootId&&t.onToggleOpen===n.onToggleOpen&&t.onStartEditing===n.onStartEditing&&t.onContextMenu===n.onContextMenu&&t.onDragStart===n.onDragStart&&t.onClick===n.onClick&&t.onEnterScope===n.onEnterScope&&t.typeSuffixShown===n.typeSuffixShown&&t.instanceRuleShown===n.instanceRuleShown&&t.restrictionColumns===n.restrictionColumns&&t.excludeColumnShown===n.excludeColumnShown&&yjt(t.remoteSelectionColors,n.remoteSelectionColors)}const mdn=Ye.memo(function({row:n,adapter:s,store:c,isSelected:d,isSelectionActive:m,isEditing:g,isCollapsed:S,dropZone:k,isDragged:A,rowIndex:F,prevDepth:D,nextDepth:J,isInternal:q,searchTerm:G,lockCache:se,warningCache:pe,editabilityVersion:ue,adapterVersion:Ce,onToggleOpen:Fe,onStartEditing:De,threeRootId:be,onContextMenu:X,onDragStart:we,onClick:Be,onEnterScope:bt,remoteSelectionColors:It,typeSuffixShown:Wt,instanceRuleShown:zt,restrictionColumns:ft,excludeColumnShown:tr}){const{node:Qt,depth:Tt,hasChildren:vn}=n,Yr=tUe(s,Qt.id),en=Yr!==null,ii=rUe(s,Qt.id),No=en||ii||Qt.role!==void 0&&hjt.has(Qt.role),gn=eUe({structural:No,internal:q}),En=No?void 0:s.inspector?.get(Qt.id,"locked"),cs=No?void 0:s.inspector?.get(Qt.id,"name"),On=!No&&s.inspector?.get(Qt.id,"visible")!==void 0,ji=No?void 0:s.inspector?.editability?.(Qt.id,"locked"),Ja=No?void 0:s.inspector?.editability?.(Qt.id,"visible"),_a=No?void 0:s.inspector?.get(Qt.id,"renderVisible"),Pn=_a!==void 0,js=_a!==!1,fa=No?void 0:s.inspector?.editability?.(Qt.id,"renderVisible"),Nt=Pn&&(fa?.writable??!0),$c=No?void 0:s.inspector?.get(Qt.id,"exclude"),Ni=$c!==void 0,Dc=$c===!0,vc=No?void 0:s.inspector?.editability?.(Qt.id,"exclude"),Tf=Ni&&(vc?.writable??!0),Ip=Yr?oq(Yr.worldId):!1,Au=Yr?uMt(Yr.worldId):!1,dl=Yr?fMt(Yr.worldId):!1,bu=en?!Ip:s.inspector?.get(Qt.id,"visible")!==!1,Al=En!==void 0,Ku=En===!0,pl=Al&&(ji?.writable??!0),gs=On&&(Ja?.writable??!0),Xu=cs!==void 0,$r=hfn(Qt),Sl=No?0:s.instances?.describe(Qt.id)?.overrides.length??0,Rl=No?QVe:se.summaryFor(s,ue,Qt.id),mi=No?null:pe.badgeFor(s,ue,Qt.id),tu=No?null:eye()?.detail(s,Qt.id,c)??null,Wc=S&&vn?Qt.childIds.slice(0,$fn).map(Ao=>s.hierarchy.node(Ao)).filter(Ao=>Ao!==null&&XMt(Ao.kind)):[];return $.jsxs("div",{className:"volter-tree-row","data-entity-name":No?void 0:Qt.label,"data-testid":"ingest-row","data-ingest-name":Qt.label,"data-node-role":Qt.role,"data-depth":Tt,"data-selected":d?"true":void 0,"data-selection-active":m?"true":void 0,"data-remotely-selected":It.length>0?"true":void 0,"data-dragging":A?"true":void 0,"data-row-alt":F%2===1?"true":void 0,"data-internal":q?"true":void 0,"data-muted":q||Dc||!No&&!bu?"true":void 0,draggable:gn.draggable,onDragStart:Ao=>we(Ao,Qt.id),onClick:Ao=>{if(Yr?.role==="world"&&LMe(Yr.worldId),Qt.role==="story"){const ia=s instanceof hy?s.ownerOf(Qt.id):null;ia&&LMe(ia),s.stories?.apply(Qt.id,Qt.id)}Be(Ao,Qt.id)},onDoubleClick:()=>{Qt.role==="story"?CD("story",c,{storyId:Qt.id}):Qt.role==="component"||Qt.role==="instance"||Qt.role==="boundary"?bt(Qt.id):gn.renamable&&Xu&&De(Qt.id)},onContextMenu:Ao=>{Ao.preventDefault(),X(Ao,Qt.id)},style:{position:"relative",paddingLeft:wme(Tt),paddingRight:G0[2],gap:G0[2],cursor:"pointer",outline:k==="child"?`1px dashed ${Go.accent.default}`:"none",whiteSpace:"nowrap",overflow:"hidden",fontSize:"var(--volter-font-base)"},children:[k==="before"&&$.jsx(Tht,{position:"before",style:{left:wme(Tt)}}),k==="after"&&$.jsx(Tht,{position:"after",style:{left:wme(Tt)}}),Lfn(Tt,D,J).map(Ao=>$.jsx("span",{className:"volter-tree-indent-guide","aria-hidden":"true",style:{left:`calc(${hZ} * ${Ao.column+.5} - 0.5px)`,top:Ao.starts?qwt:0,bottom:Ao.ends?qwt:0}},Ao.column)),vn?$.jsx(dm,{type:"button",variant:"ghost",size:"compact","aria-label":S?`Expand ${Qt.label}`:`Collapse ${Qt.label}`,"aria-expanded":!S,"data-testid":"ingest-row-caret",onClick:Ao=>{Ao.stopPropagation(),Fe(n,Ao.altKey)},title:"Expand/collapse (Option/Alt-click applies to the branch)",className:"volter-tree-caret",children:$.jsx(dc,{icon:S?ETt:iLe,"aria-hidden":"true"})}):$.jsx("span",{"data-testid":"ingest-row-caret","aria-hidden":"true",style:{width:hZ,flexShrink:0}}),It.length>0&&$.jsx("span",{className:"volter-tree-remote-selection",role:"img",title:`Selected by ${It.length} collaborator${It.length===1?"":"s"}`,"aria-label":"Selected by a collaborator",children:It.slice(0,3).map(Ao=>$.jsx("span",{style:{background:Ao},"aria-hidden":"true"},Ao))}),Yr?.role==="world"&&Yr.worldId===be&&$.jsx("span",{"data-testid":"world-focus-radio","data-world-focused":"true",title:"Live Three world — shown in the viewport",style:{fontSize:"var(--volter-font-xs)",opacity:.8,flexShrink:0},children:$.jsx(dc,{icon:KTt,"aria-hidden":"true"})}),$.jsx("span",{className:"volter-tree-type-glyph",title:Qt.role?`${Qt.role}: ${Qt.kind}`:Qt.kind,style:{width:"var(--volter-icon-md)",fontSize:"var(--volter-icon-sm)",flexShrink:0,textAlign:"center"},children:$.jsx(dc,{icon:Hfn(Qt),"aria-hidden":"true"})}),g?$.jsx(Zm,{autoFocus:!0,defaultValue:Qt.label,onBlur:Ao=>{s.inspector.set(Qt.id,"name",Ao.currentTarget.value),c.notifyIngestEdit(),De("")},onKeyDown:Ao=>{Ao.key==="Enter"&&(s.inspector.set(Qt.id,"name",Ao.currentTarget.value),c.notifyIngestEdit(),De("")),Ao.key==="Escape"&&De("")},onClick:Ao=>Ao.stopPropagation(),"data-variant":"tree-edit",style:{flex:1,minWidth:0}}):$.jsxs("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:[$r.typeSuffix?$.jsxs("span",{"data-testid":"hierarchy-instance-label",...Wt?{}:{title:`Component instance of <${$r.typeSuffix}>`},style:{textDecorationLine:zt?d?"var(--volter-tree-active-name-underline)":"underline":"none",textDecorationStyle:"dotted",textDecorationColor:Go.semantic.instance,textUnderlineOffset:"3px",...d?{color:m?Go.content.active:Go.content.selected}:{}},children:[Vwt(Qt.label,G),!Wt&&Sl>0?"*":""]}):$.jsx("span",{"data-testid":"hierarchy-plain-label",style:d?{color:m?Go.content.active:Go.content.selected}:void 0,children:Vwt(Qt.label,G)}),Wc.map(Ao=>$.jsx("span",{className:"volter-tree-datablock","data-active":m?"true":void 0,title:`${Ao.kind}: ${Ao.label}`,children:$.jsx(dc,{icon:KZ(Ao.kind),"aria-hidden":"true"})},Ao.id)),$r.typeSuffix&&Wt&&$.jsxs("span",{"data-testid":"hierarchy-instance-type","data-type-label":$r.typeSuffix,title:`Component instance of <${$r.typeSuffix}>`,style:{marginLeft:G0[2],fontSize:"var(--volter-font-sm)",color:Go.content.dim},children:["·",$r.typeSuffix,Sl>0?"*":""]}),Qt.secondaryLabel&&$.jsx("span",{style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.5},children:Qt.secondaryLabel}),tu&&$.jsx("span",{"data-testid":"hierarchy-instanced-units",style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.5},children:tu}),Yr?.role==="world"&&Yr.zOrder!==0&&$.jsxs("span",{title:`Z order: ${Yr.zOrder}`,style:{marginLeft:G0[3],fontSize:"var(--volter-font-sm)",opacity:.6},children:["Z ",Yr.zOrder]}),Yr?.provenance&&$.jsx("span",{"data-testid":"world-provenance","data-provenance":Yr.provenance.source,title:Yr.provenance.detail,style:{marginLeft:G0[3],fontSize:"var(--volter-font-xs)",padding:`0 ${R_[2]}px`,borderRadius:Go.shape.small,border:`1px solid ${Go.boundary.strong}`,color:Go.content.muted,verticalAlign:"middle"},children:Yr.provenance.label})]}),mi&&$.jsx("span",{"data-testid":"hierarchy-row-warning","data-warning-codes":mi.codes.join(","),"data-warning-count":mi.count,role:"img",title:mi.tooltip,"aria-label":`${Qt.label}: ${mi.tooltip}`,style:{fontSize:"var(--volter-font-sm)",color:Go.semantic.warning,flexShrink:0},children:$.jsx(dc,{icon:fee,"aria-hidden":"true"})}),Rl.locked&&Rl.reason&&$.jsx("span",{"data-testid":"hierarchy-transform-lock",role:"img",title:Rl.reason,"aria-label":`${Qt.label}: ${Rl.reason}`,style:{fontSize:"var(--volter-font-sm)",color:Go.content.dim,flexShrink:0},children:$.jsx(dc,{icon:Nme,"aria-hidden":"true"})}),ft==="select+viewport"&&Al&&gn.writable&&$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-lock",disabled:!pl,title:pl?Ku?"Unlock":"Lock":ji?.reason||"Locked","aria-label":Ku?`Unlock ${Qt.label}`:`Lock ${Qt.label}`,"aria-pressed":Ku,onClick:Ao=>{Ao.stopPropagation(),s.inspector.set(Qt.id,"locked",!Ku),c.notifyIngestEdit()},children:$.jsx(dc,{icon:Ku?Nme:jOe,"aria-hidden":"true"})}),tr&&(Ni&&gn.writable?$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-exclude",disabled:!Tf,title:Tf?Dc?"Include in view layer":"Exclude from view layer":vc?.reason||"Exclusion is read-only","aria-label":Dc?`Include ${Qt.label} in the view layer`:`Exclude ${Qt.label} from the view layer`,"aria-checked":!Dc,role:"checkbox",onClick:Ao=>{Ao.stopPropagation(),s.inspector.set(Qt.id,"exclude",!Dc),c.notifyIngestEdit()},children:$.jsx(dc,{icon:Dc?dun:fun,"aria-hidden":"true"})}):$.jsx("span",{"aria-hidden":"true",style:{width:hZ,flexShrink:0}})),(On||en)&&gn.writable&&$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-visibility",disabled:!en&&!gs,title:en||gs?bu?"Hide":"Show":Ja?.reason||"Visibility is read-only","aria-label":bu?`Hide ${Qt.label}`:`Show ${Qt.label}`,"aria-pressed":!bu,onClick:Ao=>{Ao.stopPropagation(),Yr?(dan(Yr.worldId),c.notifyIngestEdit()):(s.inspector.set(Qt.id,"visible",!bu),c.notifyIngestEdit())},children:$.jsx(dc,{icon:bu?Zje:sLe,"aria-hidden":"true"})}),ft==="viewport+render"&&(Pn&&gn.writable?$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"ingest-row-render-visibility",disabled:!Nt,title:Nt?js?"Disable in renders":"Enable in renders":fa?.reason||"Render visibility is read-only","aria-label":js?`Disable ${Qt.label} in renders`:`Enable ${Qt.label} in renders`,"aria-pressed":!js,onClick:Ao=>{Ao.stopPropagation(),s.inspector.set(Qt.id,"renderVisible",!js),c.notifyIngestEdit()},children:$.jsx(dc,{icon:js?lun:uun,"aria-hidden":"true"})}):$.jsx("span",{"aria-hidden":"true",style:{width:hZ,flexShrink:0}})),Yr&&$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"world-interactive-toggle",title:Au?"Interactive (layer forwards pointer events)":"Not interactive (layer is pointer-events:none)","aria-label":`Forward pointer events to ${Qt.label}`,"aria-pressed":Au,onClick:Ao=>{Ao.stopPropagation(),_an(Yr.worldId),c.notifyIngestEdit()},children:$.jsx(dc,{icon:Z0r,"aria-hidden":"true"})}),Yr&&$.jsx(dm,{type:"button",variant:"ghost",size:"compact","data-testid":"world-picklock-toggle",title:dl?"Pick-locked (skipped by topmost-layer picking)":"Not pick-locked","aria-label":`Exclude ${Qt.label} from viewport picking`,"aria-pressed":dl,onClick:Ao=>{Ao.stopPropagation(),han(Yr.worldId),c.notifyIngestEdit()},children:$.jsx(dc,{icon:HTt,"aria-hidden":"true"})})]})},_dn);function hdn({store:t,adapter:n}){Ye.useSyncExternalStore(t.subscribe,t.getSnapshot);const s=Ye.useDeferredValue(t.contentVersion);Ye.useSyncExternalStore(R3r,F3r),Ye.useSyncExternalStore(U$,eA,eA);const c=mD().hierarchyTypeSuffix!=="hidden",d=mD().hierarchyInstanceRule!=="hidden",m=mD().hierarchyRestrictions??"select+viewport",[g,S]=Ye.useReducer(zi=>zi+1,0),k=Ye.useRef(t.getSnapshot());k.current=t.getSnapshot();const[A,F]=Ye.useState($un());Ye.useEffect(()=>n.subscribe?.(()=>{k.current=t.getSnapshot(),S()}),[n,t]),Ye.useEffect(()=>qun(F),[]);const D=Ye.useMemo(()=>{const zi=new Map;for(const Jn of A?.participants??[])if(Jn.participantId!==G0e)for(const Cs of Jn.presence.selection){const lc=zi.get(Cs)??[];lc.includes(Jn.color)||lc.push(Jn.color),zi.set(Cs,lc)}return zi},[A]),J=Ye.useRef(new yfn),q=Ye.useRef(new wfn),G=t.hierarchyRowFacetVersion,se=KVe(t),[pe,ue]=Ye.useState(""),Ce=Ye.useSyncExternalStore(efn,Qun,()=>null),[Fe,De]=Ye.useState(null),[be,X]=Ye.useState(null),[we,Be]=Ye.useState(null),[bt,It]=Ye.useState(!1),[Wt,zt]=Ye.useState(null),ft=Ye.useRef(null),[tr,Qt]=Ye.useState(0),Tt=Ye.useRef(null),vn=Ye.useSyncExternalStore(wDt,agt,agt).includes("outliner")?"outliner":void 0,Yr=Ye.useRef(new Map),en=Ye.useRef(new Map),ii=Ye.useRef(new ffn),No=Ye.useRef(0),gn=Ye.useRef(null),En=Ye.useRef(null),cs=Ye.useRef(null),On=Ye.useRef(null),[,ji]=Ye.useReducer(zi=>zi+1,0),Ja=pe.trim().toLowerCase(),_a=of()?.rootPath??"__unscoped__",Pn=n.selection?.get()??[],js=Pn.length===1?Pn[0]:null,fa=[...Pn].sort().join("\0"),Nt=Ye.useMemo(()=>new Set(fa===""?[]:fa.split("\0")),[fa]),$c=Pn.at(-1)??null,Ni=i0e(n),Dc=Ni.at(-1)??null,vc=Ye.useRef("");Ye.useEffect(()=>{if(fa===""||vc.current===fa)return;const zi=Tt.current,Jn=zi?.querySelector('[data-selected="true"]');if(!zi||!Jn)return;const Cs=zi.getBoundingClientRect(),lc=Jn.getBoundingClientRect();(lc.top<Cs.top||lc.bottom>Cs.bottom)&&Jn.scrollIntoView({block:"nearest"}),vc.current=fa}),gn.current!==_a&&(en.current.clear(),gn.current=_a,En.current=null);const Tf=ii.current,Ip=[n,s,g],Au=Tf.structural(Ip,zi=>{const Jn=zun(n,eye()?.marks(n.hierarchy)??sjt),Cs=nfn(Jn),lc=Vfn(Cs.hierarchy),Nu=eye()?.structureLog(t)??null,Fl=Nu?.epoch()??0,Yu=zi?s-zi.contentVersion:0,Pe=zi?Fl-zi.objectMapEpoch:0,Et=zi?.adapter===n&&s===t.contentVersion&&Yu>0&&Yu===Pe?Nu?.parentChangesSince(zi.objectMapEpoch)??null:null,In=(zi&&Et?cfn(lc,zi.structuralRows,Et.changedParentIds):null)??Mwt(lc,new Set),pr=ifn(Vun(Yfn(In,n),In,Ur=>Jn.isComponentRoot(Ur)),Cs);return{adapter:n,contentVersion:s,objectMapEpoch:Fl,marked:Jn,internals:Cs,hierarchyView:lc,structuralRows:In,defaultExpansion:pr,index:dfn(In)}}),{marked:dl,internals:bu,hierarchyView:Al,structuralRows:Ku,defaultExpansion:pl}=Au,gs=zi=>en.current.get(zi)??Yun(_a,zi)??pl.get(zi)??!0,Xu=En.current;if(Xu?.adapter!==n||Xu.selection!==fa){for(const Jn of Lwt(Au.index,Nt))gs(Jn)||(en.current.set(Jn,!0),No.current+=1);[...Nt].every(Jn=>Au.index.pathKeysByNodeId.has(Jn))&&(En.current={adapter:n,selection:fa})}const $r=zi=>gs(zi.node.id),Sl=Ja.length===0&&(b3r()||t.playState!=="stopped"),Rl=Qfn(Yr.current,Sl?pfn(Au.index,Nt):Jfn),mi=ii.current.collapsed([Au,No.current,_a,Dc],()=>{const zi=Dc?Ku.find(Cs=>!Cs.more&&Cs.node.id===Dc)??null:null,Jn=new Set(Ku.filter(Cs=>!Cs.more&&Cs.hasChildren&&!$r(Cs)).map(Cs=>Cs.pathKey));if(zi){Jn.delete(zi.pathKey);for(const Cs of ZVe(zi.pathKey))Jn.delete(Cs)}return{scopeRow:zi,effectiveCollapsedPaths:Jn}}),{scopeRow:tu,effectiveCollapsedPaths:Wc}=mi,Ao=ii.current.browse([Au,mi,Ja,Sl,Sl?_fn(Rl):""],()=>{const zi=Mwt(Al,Wc,Rl,Sl),Jn=Ja?Zfn(Ku,Ja,bu.isInternal):null,Cs=Jn?Ku.filter(Fl=>Jn.has(Fl.pathKey)):zi,Nu=(tu?Cs.filter(Fl=>Fl.pathKey.startsWith(`${tu.pathKey}.`)).map(Fl=>({...Fl,depth:Math.max(0,Fl.depth-tu.depth-1)})):Cs).filter(Fl=>{if(Tme(n,Fl.node.id))return!0;let Yu=Fl.node.parentId;for(;Yu;){const Pe=tUe(n,Yu);if(Pe&&oq(Pe.worldId))return!1;Yu=Al.node(Yu)?.parentId??null}return!0});return{rows:Ja?Nu:Nu.filter(Fl=>!Fl.hiddenByCollapse)}}),{rows:ia}=Ao,Du=Ye.useMemo(()=>ia.some(zi=>!zi.more&&n.inspector?.get(zi.node.id,"exclude")!==void 0),[ia,n,g,s]);Ye.useEffect(()=>{Qt(0),Tt.current&&(Tt.current.scrollTop=0)},[Ja]);const gp=Tt.current?.clientHeight||zfn,Id=kOe(Tt.current),{start:Qs,end:Pu}=ia.length>Ufn?lfn(ia.length,tr,gp,Id,qfn):{start:0,end:ia.length},Ls=ia.slice(Qs,Pu),Ff=Qs*Id,Hs=(ia.length-Pu)*Id,Ds=Ye.useCallback(zi=>{const Jn=Ku.filter(Cs=>Cs.hasChildren).map(Cs=>[Cs.node.id,zi]);for(const[Cs,lc]of Jn)en.current.set(Cs,lc);Rwt(_a,Jn),No.current+=1,ji()},[_a,Ku]),Rc={rows:ia,window:{start:Qs,end:Pu},searchTerm:Ja||null,scopeId:Dc,isExpanded:$r,isInternal:zi=>bu.isInternal(zi),isComponentRoot:zi=>dl.isComponentRoot(zi),foldedInternalCount:zi=>dl.internalChildren?.(zi)?.length??0,expandAll:()=>Ds(!0),collapseAll:()=>Ds(!1)};Ye.useEffect(()=>(Vrn(Rc),()=>Jrn(Rc)),[Rc]);const Ze=Ye.useRef({adapter:n,rows:ia,selectedIds:Nt,structuralRows:Ku,isExpanded:$r,projectIdentity:_a});Ze.current={adapter:n,rows:ia,selectedIds:Nt,structuralRows:Ku,isExpanded:$r,projectIdentity:_a};const jt=Ye.useCallback((zi,Jn)=>{const Cs=Ze.current,lc=!Cs.isExpanded(zi),Nu=[[zi.node.id,lc]];if(Jn){const Fl=`${zi.pathKey}.`;for(const Yu of Cs.structuralRows)Yu.hasChildren&&Yu.pathKey.startsWith(Fl)&&Nu.push([Yu.node.id,lc])}for(const[Fl,Yu]of Nu)en.current.set(Fl,Yu);Rwt(Cs.projectIdentity,Nu),No.current+=1,ji()},[]),mt=Ye.useCallback(()=>{en.current.clear();for(const zi of Lwt(Au.index,Nt))en.current.set(zi,!0);Zun(_a),No.current+=1,ji()},[_a,fa,Au]),xt=Ye.useCallback(zi=>{const Jn=Yr.current;Jn.set(zi,(Jn.get(zi)??Zge)+Zge),No.current+=1,ji()},[]),xr=Ye.useCallback(zi=>{$3r(n,zi)},[n,t]);Ye.useEffect(()=>{if(!fa){On.current=null;return}const zi=On.current;if(zi?.adapter===n&&zi.selection===fa)return;On.current={adapter:n,selection:fa};const Jn=ia.findIndex(Yu=>Nt.has(Yu.node.id)),Cs=Tt.current;if(Jn<0||!Cs)return;const lc=kOe(Cs),Nu=Jn*lc,Fl=Nu+lc;Nu<Cs.scrollTop?Cs.scrollTop=Nu:Fl>Cs.scrollTop+Cs.clientHeight&&(Cs.scrollTop=Math.max(0,Fl-Cs.clientHeight)),Qt(Cs.scrollTop)},[n,ia,Nt,fa]);const Vn=Ye.useCallback((zi,Jn)=>{const Cs=Ze.current;if(Cs.adapter.selection){if(zi.metaKey||zi.ctrlKey){const lc=new Set(Cs.selectedIds);lc.has(Jn)?lc.delete(Jn):lc.add(Jn),c0(Cs.adapter,[...lc])}else if(zi.shiftKey&&cs.current){const lc=Cs.rows.findIndex(Fl=>Fl.node.id===cs.current),Nu=Cs.rows.findIndex(Fl=>Fl.node.id===Jn);if(lc>=0&&Nu>=0){const Fl=Math.min(lc,Nu),Yu=Math.max(lc,Nu),Pe=Cs.rows.slice(Fl,Yu+1).filter(Et=>!Et.more).map(Et=>Et.node.id);c0(Cs.adapter,Pe)}}else c0(Cs.adapter,[Jn]);cs.current=Jn}},[]),eo=Ye.useCallback((zi,Jn)=>{const Cs=Ze.current.selectedIds,lc=Cs.has(Jn)?[...Cs]:[Jn];zt(lc),zi.dataTransfer.effectAllowed="move",zi.dataTransfer.setData(EOe,JSON.stringify(lc)),zi.dataTransfer.setData("text/plain",Jn)},[]),bi=Ye.useCallback((zi,Jn)=>{De({x:zi.clientX,y:zi.clientY,nodeId:Jn})},[]),ta=Ye.useCallback(zi=>{const Jn=zi.dataTransfer.types.includes(EOe),Cs=zi.dataTransfer.types.includes(COe);if(!Jn&&!Cs)return;zi.preventDefault(),zi.dataTransfer.dropEffect=Jn?"move":"copy",ft.current=null;const lc=Tt.current.getBoundingClientRect(),Nu=Tt.current.scrollTop,Fl=zi.clientY-lc.top+Nu,Yu=kOe(Tt.current),Pe=Math.floor(Fl/Yu);if(Pe>=ia.length){Be(null),It(!0),Jn&&Wt&&(ft.current=Nwt({hasStructureWritePath:zwt(n,Wt[0]),targetIsInternal:!1}));return}It(!1);const Et=Pe>=0?ia[Pe]:void 0;if(!Et||Et.more){Be(null);return}const Nr=Nwt({hasStructureWritePath:Jn?zwt(n,Et.node.id):!0,targetIsInternal:bu.isInternal(Et.node.id)});if(Nr!==null){ft.current=Nr,Be(null);return}const In=Fl-Pe*Yu;let pr;if(In<Yu*.25?pr="before":In>Yu*.75?pr="after":pr="child",Jn&&Wt){const Ur=Et.node.id;if(Wt.includes(Ur)||Gfn(Ur,Wt,n))return;if(!Jun(n,Wt,Ur)){Be(null);return}}if(Tme(n,Et.node.id)&&pr!=="child"&&(pr="child"),(Et.node.role==="document"||Et.node.role==="story")&&(pr="child"),Et.node.role==="folder"||Et.node.role==="boundary"){Be(null);return}Be({nodeId:Et.node.id,zone:pr})},[ia,Wt,n,bu]),ic=Ye.useCallback(()=>{Be(null),It(!1),zt(null),ft.current=null},[]),Ps=Ye.useCallback(zi=>{zi.preventDefault(),zi.stopPropagation();const Jn=we,Cs=bt,lc=ft.current;if(Be(null),It(!1),zt(null),ft.current=null,lc!==null){i0(lc);return}const Nu=n.structure,Fl=zi.dataTransfer.getData(EOe);if(Fl&&Nu){const Pe=JSON.parse(Fl);if(Cs){for(const Li of Pe)QO(n,Li,null);return}if(!Jn)return;const Et=ia.find(Li=>Li.node.id===Jn.nodeId);if(!Et)return;const Nr=Et.node.id;if(Jn.zone==="child"){for(const Li of Pe)QO(n,Li,Nr);return}const In=Et.node.parentId,pr=Kfn(n,In).filter(Li=>!Pe.includes(Li)),Ur=pr.indexOf(Nr),Ei=Jn.zone==="before"?Nr:Ur>=0?pr[Ur+1]??null:null;for(const Li of Pe)(n.hierarchy.node(Li)?.parentId??null)!==In&&QO(n,Li,In??null),c$e(n,Li,Ei);return}const Yu=zi.dataTransfer.getData(COe);if(Yu&&n.assetDrop)try{const Pe=JSON.parse(Yu);if(Pe.kind==="scene")return;const Et={item:Pe.component??{kind:"file",name:Pe.name??Pe.path.split("/").pop()??Pe.path}};if(Cs){n.assetDrop.accepts("",Pe.path,Et)&&RFe(n,"",Pe.path,Et);return}if(!Jn)return;const Nr=ia.find(pr=>pr.node.id===Jn.nodeId);if(!Nr)return;const In=Nr.node.id;n.assetDrop.accepts(In,Pe.path,Et)&&RFe(n,In,Pe.path,Et)}catch{}},[we,bt,ia,n]),Iu=SPt(n)??"Untitled";return $.jsxs($ye,{name:null,hideHeader:!0,onPointerDown:()=>CR("hierarchy"),onDragOver:zi=>{zi.dataTransfer.types.includes(COe)&&(zi.preventDefault(),zi.dataTransfer.dropEffect="copy")},style:{flex:1,minWidth:0,minHeight:0,borderRight:`1px solid ${Go.boundary.default}`},children:[$.jsx("span",{"data-testid":"scene-name","data-scene":Iu,style:{display:"none"},children:Iu}),$.jsx(ldn,{slot:Ce,search:pe,setSearch:ue,adapter:n,createTargetId:js,onCollapseAll:()=>Ds(!1),onResetExpansion:mt,onExpandAll:()=>Ds(!0)}),Dc&&$.jsxs("nav",{"data-testid":"selection-scope-breadcrumb","aria-label":"Selection scope",style:{display:"flex",alignItems:"center",gap:3,minHeight:26,padding:`0 ${R_[2]}px`,borderBottom:`1px solid ${Go.boundary.default}`,overflow:"hidden",flexShrink:0},children:[$.jsx(Ms,{variant:"ghost",size:"compact","data-testid":"selection-scope-root",onClick:()=>Agt(n,null),children:"Game"}),Ni.map((zi,Jn)=>{const Cs=n.hierarchy.node(zi);if(!Cs)return null;const lc=Jn===Ni.length-1;return $.jsxs("span",{style:{display:"flex",alignItems:"center",minWidth:0},children:[$.jsx("span",{"aria-hidden":"true",style:{color:Go.content.muted},children:"/"}),$.jsx(Ms,{variant:"ghost",size:"compact","data-testid":"selection-scope-crumb","data-scope-current":lc?"true":void 0,"aria-current":lc?"location":void 0,onClick:()=>Agt(n,zi),style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Cs.label})]},zi)})]}),$.jsxs("div",{ref:Tt,"data-testid":"ingest-hierarchy",className:"volter-content-frost volter-tree-body","data-volter-region":vn,style:{flex:1,minHeight:0,overflow:"auto",position:"relative",pointerEvents:"auto"},onDragOver:ta,onDrop:Ps,onDragEnd:ic,onScroll:zi=>Qt(zi.currentTarget.scrollTop),onDragLeave:zi=>{Tt.current?.contains(zi.relatedTarget)||(Be(null),It(!1))},children:[$.jsx("div",{"data-testid":"game-hierarchy-spacer-top",style:{height:Ff}}),Ls.map((zi,Jn)=>zi.more?$.jsx(ddn,{row:zi,onReveal:xt},jwt(zi)):$.jsx(mdn,{row:zi,rowIndex:Qs+Jn,prevDepth:ia[Qs+Jn-1]?.depth??-1,nextDepth:ia[Qs+Jn+1]?.depth??-1,adapter:n,store:t,isSelected:Nt.has(zi.node.id),isSelectionActive:$c===zi.node.id,isEditing:be===zi.node.id,isCollapsed:Ja?!1:Wc.has(zi.pathKey),dropZone:we&&we.nodeId===zi.node.id?we.zone:null,isDragged:Wt?.includes(zi.node.id)??!1,isInternal:bu.isInternal(zi.node.id),threeRootId:se,searchTerm:Ja,lockCache:J.current,warningCache:q.current,editabilityVersion:G,adapterVersion:g,onToggleOpen:jt,onStartEditing:X,onContextMenu:bi,onDragStart:eo,onClick:Vn,onEnterScope:xr,typeSuffixShown:c,instanceRuleShown:d,restrictionColumns:m,excludeColumnShown:Du,remoteSelectionColors:D.get(zi.node.id)??Bfn},jwt(zi))),$.jsx("div",{"data-testid":"game-hierarchy-spacer-bottom",style:{height:Hs}}),$.jsx("div",{style:{minHeight:40}}),bt&&$.jsx("div",{style:{position:"absolute",left:0,right:0,top:ia.length*Id,height:2,background:Go.accent.default,pointerEvents:"none",zIndex:PI.overlayLow}})]}),Fe&&(()=>{const zi=Al.node(Fe.nodeId),Jn=zi?Tme(n,zi.id)||rUe(n,zi.id):!1;return $.jsx(udn,{state:Fe,adapter:n,store:t,isGroupNode:Jn,isInternal:bu.isInternal(Fe.nodeId),onRename:X,onClose:()=>De(null)})})()]})}function vjt(){const t=Yv(),[,n]=Ye.useReducer(c=>c+1,0);Ye.useSyncExternalStore(i2,X1),Ye.useSyncExternalStore(Cee,AD),Ye.useSyncExternalStore(jfn,eye);const{adapter:s}=Cm(t);return Ye.useEffect(()=>s.subscribe?.(n),[s]),$.jsx(hdn,{store:t,adapter:s},jun(s))}const Sve="https://volter-learn.pages.dev/",gdn=`${Sve}quick-starts/`,ydn=`${Sve}manual/`,Uwt=`${Sve}reference/`;function bjt(t){const n=/^(\d+)\.(\d+)(?:[.+-]|$)/.exec(t?.trim()??"");if(!n)return null;const s=`${Number(n[1])}.${Number(n[2])}`;return s==="0.0"?null:s}function vdn(t){const n=bjt(t);return n===null?Uwt:`${Uwt}${n}/`}function g_e(t){window.open(t,"_blank","noopener,noreferrer")}function bdn(){const t=Yv(),n=Y0(t),s=n.structure,c=[...t.selectedEntityIds],d=c[0],m=d?n.hierarchy.node(d)?.parentId??null:null,g=lve(),S=K9t(),k=Ye.useSyncExternalStore(l2,bFe,bFe);Ye.useSyncExternalStore(dDt,vhe,vhe),Ye.useSyncExternalStore(Uye,fhe,fhe),Ye.useSyncExternalStore(EDt,Ehe,Ehe),Ye.useSyncExternalStore(lLe,YB,YB);const A=X=>{const we=uLe(X);return we.length===0?null:$.jsxs($.Fragment,{children:[$.jsx(H1,{}),we.map(Be=>$.jsx(Nc,{...Be.testId?{"data-testid":Be.testId}:{},disabled:Be.disabled?.({})??!1,onSelect:De(()=>void Be.execute({})),children:typeof Be.label=="function"?Be.label():Be.label},Be.id))]})},F=Ye.useSyncExternalStore(nMt,N$,N$),D=Ye.useSyncExternalStore(mDt,zS,zS),q=Ye.useSyncExternalStore(Rw,of,of)?.config.engine.version??null,G=bjt(q),[se,pe]=Ye.useState(null);tjt(()=>se?jvr():"");const ue=Ye.useRef(null),Ce=Ye.useRef({}),Fe=X=>Ce.current[X]??={current:null};Ye.useEffect(()=>{if(!se)return;const X=we=>{ue.current?.contains(we.target)||pe(null)};return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[se]);const De=X=>()=>{pe(null),X()},be={edit:$.jsxs($.Fragment,{children:[$.jsx(Nc,{disabled:S.busy||!S.canUndo,onSelect:De(()=>g.undo()),children:S.undoLabel?`Undo ${S.undoLabel}`:"Undo"}),$.jsx(Nc,{disabled:S.busy||!S.canRedo,onSelect:De(()=>g.redo()),children:S.redoLabel?`Redo ${S.redoLabel}`:"Redo"}),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(LVe),children:"Undo History…"}),$.jsx(H1,{}),$.jsx(Nc,{disabled:c.length===0||!s?.cut||!(s.canCopy?.(c)??!0),onSelect:De(()=>MVe(t)),children:"Cut"}),$.jsx(Nc,{disabled:c.length===0||!s?.copy||!(s.canCopy?.(c)??!0),onSelect:De(()=>FVe(t)),children:"Copy"}),$.jsx(Nc,{disabled:!s?.paste||!(s.canPaste?.(m)??!0),onSelect:De(()=>jVe(t)),children:"Paste"}),$.jsx(H1,{}),$.jsx(Nc,{disabled:t.selectedEntityIds.size===0,onSelect:De(()=>void _ve(t)),children:"Duplicate"}),$.jsx(Nc,{disabled:t.selectedEntityIds.size===0,onSelect:De(()=>void mve(t)),children:"Delete"}),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(()=>kRt(t)),children:"Select All"}),$.jsx(Nc,{disabled:t.selectedEntityIds.size===0,onSelect:De(()=>t.select(null)),children:"Deselect All"})]}),view:$.jsxs($.Fragment,{children:[$.jsx(Nc,{onSelect:De(()=>SVe()),children:"Command Palette…"}),$.jsx(Nc,{onSelect:De(async()=>{const X=srn(t);try{await navigator.clipboard.writeText(X),ea.log("Copied a link to the current editor view.","editor")}catch(we){ea.error(`Could not copy the editor view link: ${we instanceof Error?we.message:String(we)}`,"editor")}}),children:"Copy View Link"}),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(MBe),children:"Toggle Focus Mode"}),A("view")]}),window:$.jsxs($.Fragment,{children:[AN().filter(X=>Uk(X.id)).map(X=>$.jsxs(Nc,{role:"menuitemradio","aria-checked":D===X.id,"data-testid":`workspace-${X.id}`,title:X.description,onSelect:De(()=>s2(X.id)),children:[$.jsx(dc,{icon:Kk.status.success,style:{opacity:D===X.id?1:0}}),"Workspace: ",X.title]},X.id)),$.jsx(H1,{}),$.jsx(Nc,{onSelect:De(ave),children:"Console"}),$.jsx(Nc,{onSelect:De(()=>bC(nee.lightExplorer.id)),children:"Light Explorer"}),$.jsx(Nc,{onSelect:De(()=>FBe("asset-library")),children:"Asset Library"}),$.jsx(Nc,{onSelect:De(()=>bC("generations")),children:"Generations"}),A("window")]}),debug:$.jsx($.Fragment,{children:A("debug")}),tools:$.jsxs($.Fragment,{children:[$.jsxs(Nc,{onSelect:De(()=>gve()),children:["Project Tools…",F.tools.length>0?` (${F.tools.length})`:""]}),$.jsx(H1,{}),k.length?k.map(X=>$.jsx(Nc,{onSelect:De(()=>{X.point==="workspace.document"?tA(X.id):bC(`tool:${X.id}`)}),children:X.title},X.id)):$.jsx(Nc,{disabled:!0,children:"No custom project tools"}),A("tools")]}),help:$.jsxs($.Fragment,{children:[$.jsx(Nc,{"data-testid":"help-learn-home",onSelect:De(()=>g_e(Sve)),children:"Volter Learn"}),$.jsx(Nc,{"data-testid":"help-quick-starts",onSelect:De(()=>g_e(gdn)),children:"Quick-starts"}),$.jsx(Nc,{"data-testid":"help-manual",onSelect:De(()=>g_e(ydn)),children:"Manual"}),$.jsx(H1,{}),$.jsx(Nc,{"data-testid":"help-reference",title:G?`API/schema reference pinned to this project's engine (v${q})`:"API/schema reference (no engine version pin available)",onSelect:De(()=>g_e(vdn(q))),children:G?`Reference for v${q}`:"Reference"}),A("help")]})};return $.jsx("div",{ref:ue,style:{display:"flex",alignItems:"stretch",marginLeft:"var(--volter-space-2)"},children:["edit","view","window","debug","tools","help"].map(X=>$.jsxs("div",{ref:Fe(X),style:{position:"relative"},children:[$.jsx(dBe,{"data-testid":`app-menu-${X}`,"aria-haspopup":"menu","aria-expanded":se===X,onClick:()=>pe(we=>we===X?null:X),onKeyDown:we=>{we.key==="ArrowDown"&&(we.preventDefault(),pe(X))},onPointerEnter:()=>{se&&pe(X)},style:{textTransform:"capitalize"},children:X}),se===X&&$.jsx(pBe,{anchorRef:Fe(X),dismissBoundaryRef:Fe(X),align:"start",gap:0,clamp:!0,autoFocusFirst:!0,onDismiss:()=>{const we=ue.current?.querySelector(`[data-testid="app-menu-${X}"]`);pe(null),requestAnimationFrame(()=>we?.focus())},style:{minWidth:190},children:be[X]})]},X))})}const Sdn=new Map,Jwt=new Set;let xdn=0;function wdn(t){return Sdn.get(t)??Tdn}const Tdn=[];function Cdn(t){return Jwt.add(t),()=>Jwt.delete(t)}function Wwt(){return xdn}function Cme({slot:t}){return Ye.useSyncExternalStore(Cdn,Wwt,Wwt),$.jsx($.Fragment,{children:wdn(t).map(n=>$.jsx(n.Content,{},n.owner))})}const IO=[],Mje=new Set;let Sjt=0;function Hwt(){Sjt++;for(const t of Mje)t()}function Edn(t){const n=IO.findIndex(s=>s.owner===t.owner);return n>=0&&IO.splice(n,1),IO.push(t),IO.sort((s,c)=>(s.order??0)-(c.order??0)),Hwt(),()=>{const s=IO.indexOf(t);s<0||(IO.splice(s,1),Hwt())}}async function kdn(t){const n=new Set,s=[];for(const c of IO){let d;try{d=await c.harnesses(t)}catch{continue}for(const m of d)n.has(m.id)||(n.add(m.id),s.push(m))}return s}function Adn(t){return Mje.add(t),()=>{Mje.delete(t)}}function Gwt(){return Sjt}async function pA(t,n){const s=await fetch(`/__editor/share-control${t}`,{...n,headers:{...n?.body?{"Content-Type":"application/json"}:{},...n?.headers}});if(s.status!==204&&sf(s,`Git request ${t} failed`),!s.ok){const c=await s.json().catch(()=>null);throw new Error(typeof c?.error=="string"?c.error:`Git request failed (${s.status}).`)}return s.status===204?void 0:await s.json()}async function Ddn(){const t=await fetch("/__editor/git/status");return L_(t,"Git status failed")}function Pdn(t){return pA("/git/checkpoint",{method:"POST",body:JSON.stringify(t)})}function Idn(t){return pA("/git/publish",{method:"POST",...t?{signal:t}:{}})}function Kwt(t){return pA("/git/stage",{method:"POST",body:JSON.stringify(t)})}function Ndn(t){return pA("/git/fetch",{method:"POST",...t?{signal:t}:{}})}function Odn(t){return pA("/git/update",{method:"POST",...t?{signal:t}:{}})}function Xwt(t){return pA("/git/rebase",{method:"POST",body:JSON.stringify({action:t})})}function Rdn(){return pA("/git/readiness",{method:"POST"})}function Fdn(t){return pA("/git/pull-request",{method:"POST",body:JSON.stringify(t)})}function Mdn(){return pA("/git/pull-request/status")}function jdn(t){return pA("/git/pull-request/merge",{method:"POST",...t?{signal:t}:{}})}function Ldn(){const[t,n]=Ye.useState(null),[s,c]=Ye.useState(!1),[d,m]=Ye.useState(null),[g,S]=Ye.useState([]),[k,A]=Ye.useState(""),[F,D]=Ye.useState(null),[J,q]=Ye.useState(null),[G,se]=Ye.useState(null),[pe,ue]=Ye.useState(!1),Ce=Ye.useRef(null);Ye.useEffect(()=>{Ddn().then(we=>{m(we),S(we.changed.map(Be=>Be.path))}).catch(we=>n(String(we)))},[]);const Fe=we=>{m(we),S(Be=>Be.filter(bt=>we.changed.some(It=>It.path===bt)))},De=async(we,Be,bt)=>{const It=new AbortController;Ce.current=It,q(bt??null),c(!0),n(null),D(null);try{Fe(await we(It.signal)),D(Be)}catch(Wt){n(Wt instanceof Error?Wt.message:String(Wt))}finally{Ce.current===It&&(Ce.current=null),q(null),c(!1)}},be=we=>{se(null),Fdn({title:we}).then(Be=>{Fe(Be.status),D(`Pull request: ${Be.url}`)}).catch(Be=>n(String(Be)))},X=()=>{ue(!1);const we=new AbortController;Ce.current=we,q("Merging pull request"),c(!0),jdn(we.signal).then(Be=>D(`Merged pull request: ${Be.url}`)).catch(Be=>n(String(Be))).finally(()=>{Ce.current===we&&(Ce.current=null),q(null),c(!1)})};return $.jsxs("section",{className:"volter-worktree-version-control",children:[t&&$.jsx("div",{style:{color:Go.semantic.danger,fontSize:YY.sm,marginBottom:5},children:t}),d?.available?$.jsxs("details",{style:{marginTop:G0[4]},children:[$.jsxs("summary",{style:{cursor:"pointer",fontSize:YY.sm},children:["Git · ",d.branch??"detached"," ·"," ",d.dirty?`${d.changed.length} changed`:"clean",d.baseAhead!==null&&d.baseBehind!==null?` · base +${d.baseAhead}/-${d.baseBehind}`:"",d.ahead!==null&&d.behind!==null?` · remote +${d.ahead}/-${d.behind}`:""]}),$.jsxs("div",{style:{display:"grid",gap:5,marginTop:5,fontSize:YY.sm},children:[$.jsxs("span",{style:{color:Go.content.dim},children:[d.repositoryId.slice(0,20)," · ",d.worktreeId.slice(0,20)]}),d.changed.map(we=>{const Be=d.hunks.filter(bt=>bt.path===we.path);return $.jsxs("div",{style:{display:"grid",gap:3},children:[$.jsxs("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[$.jsx(TD,{"aria-label":`Include ${we.path} in checkpoint`,checked:g.includes(we.path),onChange:bt=>S(It=>bt.target.checked?[...It,we.path]:It.filter(Wt=>Wt!==we.path))}),$.jsxs("code",{style:{minWidth:0,flex:1},children:[we.index,we.worktree," ",we.path]}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void De(()=>Kwt({path:we.path,staged:we.index!==" "&&we.index!=="?"}),we.index!==" "&&we.index!=="?"?`Unstaged ${we.path}.`:`Staged ${we.path}.`),children:we.index!==" "&&we.index!=="?"?"Unstage file":"Stage file"})]}),Be.map(bt=>$.jsxs("div",{style:{display:"flex",gap:5,paddingLeft:22,alignItems:"center"},children:[$.jsxs("code",{style:{minWidth:0,flex:1,color:Go.content.dim},children:[bt.header," · +",bt.additions,"/-",bt.deletions]}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void De(()=>Kwt({path:bt.path,hunkId:bt.id,staged:bt.staged}),bt.staged?"Hunk unstaged.":"Hunk staged."),children:bt.staged?"Unstage hunk":"Stage hunk"})]},bt.id))]},we.path)}),d.rebaseInProgress&&$.jsxs("div",{role:"alert",style:{display:"grid",gap:5,color:Go.semantic.warning},children:[$.jsxs("span",{children:["Rebase paused",d.conflicts.length>0?` · conflicts: ${d.conflicts.join(", ")}`:""]}),$.jsxs("span",{style:{display:"flex",gap:5},children:[$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.conflicts.length>0,onClick:()=>void De(()=>Xwt("continue"),"Rebase continued."),children:"Continue rebase"}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void De(()=>Xwt("abort"),"Rebase aborted."),children:"Abort rebase"})]})]}),d.dirty&&$.jsxs("div",{style:{display:"flex",gap:5},children:[$.jsx(Zm,{"aria-label":"Git checkpoint message",placeholder:"Checkpoint message",value:k,onChange:we=>A(we.target.value),style:{minWidth:0,flex:1}}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||!k.trim()||g.length===0,onClick:()=>void De(()=>Pdn({paths:g,message:k}),"Selected paths checkpointed with verified account attribution.").then(()=>A("")),children:"Checkpoint"})]}),$.jsxs("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:[$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||!d.remoteUrl,onClick:()=>void De(Ndn,"Remote refs fetched and pruned.","Fetching"),children:"Fetch"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||!d.remoteUrl,onClick:()=>void De(Idn,"Branch published.","Publishing"),children:"Publish"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||!d.baseRef,onClick:()=>void De(Odn,"Branch rebased onto its base.","Fetching and rebasing"),children:"Update from base"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s,onClick:()=>void Rdn().then(we=>{Fe(we.status),D(we.ready?"Merge-ready; no merge was performed.":we.reasons.join(" "))}).catch(we=>n(String(we))),children:"Check merge readiness"}),d.github&&d.upstream&&$.jsxs($.Fragment,{children:[$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s,onClick:()=>se(k||d.branch||"Volter Editor changes"),children:"Create PR"}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",disabled:s,onClick:()=>void Mdn().then(we=>D(we.available?`PR ${we.state??"open"} · ${we.mergeState??"status unknown"} · checks ${we.checks?.passed??0} passed/${we.checks?.pending??0} pending/${we.checks?.failed??0} failed${we.reviewDecision?` · review ${we.reviewDecision}`:""}${we.url?` · ${we.url}`:""}`:we.reason??"No pull request found.")).catch(we=>n(String(we))),children:"PR status"}),$.jsx(Ms,{type:"button",size:"compact",variant:"outline",disabled:s||d.dirty||d.rebaseInProgress,onClick:()=>ue(!0),children:"Merge PR…"})]})]}),J&&$.jsxs("div",{role:"status",style:{display:"flex",gap:5,alignItems:"center"},children:[$.jsxs("span",{children:[J,"…"]}),$.jsx(Ms,{type:"button",size:"compact",variant:"ghost",onClick:()=>Ce.current?.abort(),children:"Cancel"})]}),d.history.length>0&&$.jsxs("details",{children:[$.jsx("summary",{style:{cursor:"pointer",color:Go.content.dim},children:"Recent history"}),$.jsx("div",{style:{display:"grid",gap:3,paddingTop:G0[2]},children:d.history.map(we=>$.jsxs("span",{title:`${we.author} · ${we.authoredAt}`,children:[$.jsx("code",{children:we.shortSha})," · ",we.subject]},we.sha))})]}),F&&$.jsx("span",{style:{color:Go.semantic.success},children:F})]})]}):$.jsx("span",{style:{color:Go.content.dim,fontSize:YY.sm},children:"Loading version control…"}),G!==null&&$.jsxs(xRe,{labelledBy:"volter-pull-request-title-heading",onDismiss:()=>se(null),children:[$.jsx(wRe,{titleId:"volter-pull-request-title-heading",title:"Create pull request",description:`Opens a pull request for ${d?.branch??"this branch"} on its remote.`}),$.jsx(L3t,{children:$.jsx(Zm,{"aria-label":"Pull request title",autoFocus:!0,value:G,onChange:we=>se(we.target.value),onKeyDown:we=>{we.key!=="Enter"||!G.trim()||(we.preventDefault(),be(G.trim()))}})}),$.jsxs(TRe,{children:[$.jsx(Ms,{type:"button",variant:"ghost",onClick:()=>se(null),children:"Cancel"}),$.jsx(Ms,{type:"button",variant:"primary",disabled:!G.trim(),onClick:()=>be(G.trim()),children:"Create pull request"})]})]}),pe&&$.jsxs(xRe,{labelledBy:"volter-merge-pr-heading",onDismiss:()=>ue(!1),children:[$.jsx(wRe,{titleId:"volter-merge-pr-heading",title:"Merge pull request",description:`Merging the pull request for ${d?.branch??"this branch"} changes the remote repository.`}),$.jsxs(TRe,{children:[$.jsx(Ms,{type:"button",variant:"ghost",onClick:()=>ue(!1),children:"Cancel"}),$.jsx(Ms,{type:"button",variant:"primary",onClick:X,children:"Merge pull request"})]})]})]})}Edn({owner:"editor-core:supercode",harnesses:async()=>qZr()});const Bdn={worktrees:[],branches:[]};function $dn(t){return`agent/${t.toLocaleLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,42)||"task"}`}function qdn({currentLabel:t,onDone:n,onError:s}){const[c,d]=Ye.useState(""),[m,g]=Ye.useState("agent/task"),[S,k]=Ye.useState(!1),[A,F]=Ye.useState("worktree"),[D,J]=Ye.useState([]),[q,G]=Ye.useState(""),[se,pe]=Ye.useState(!1),ue=Ye.useSyncExternalStore(Adn,Gwt,Gwt);return Ye.useEffect(()=>{let Ce=!0;return kdn(A).then(Fe=>{Ce&&(J(Fe),G(De=>Fe.some(be=>be.id===De)?De:Fe[0]?.id??""))}),()=>{Ce=!1}},[A,ue]),$.jsxs("div",{className:"volter-worktree-delegate",role:"group","aria-label":"Delegate task",children:[$.jsx(_p,{as:"div",variant:"label",children:"Delegate task"}),$.jsx(yBe,{"aria-label":"Task for the agent",placeholder:"Describe a bounded task…",value:c,onChange:Ce=>{const Fe=Ce.target.value;d(Fe),S||g($dn(Fe))}}),$.jsxs("label",{children:[$.jsx("span",{children:"Harness"}),$.jsxs(Iw,{value:q,onChange:Ce=>G(Ce.target.value),children:[D.length===0&&$.jsx("option",{value:"",children:"No harness ready"}),D.map(Ce=>$.jsx("option",{value:Ce.id,children:Ce.label},Ce.id))]})]}),$.jsxs("label",{children:[$.jsx("span",{children:"Isolation"}),$.jsxs(Iw,{value:A,onChange:Ce=>{F(Ce.target.value)},children:[$.jsx("option",{value:"worktree",children:"New worktree (recommended)"}),$.jsx("option",{value:"current",children:"Current worktree (shared files)"})]})]}),A!=="current"&&$.jsxs("label",{children:[$.jsx("span",{children:"Branch"}),$.jsx(Zm,{"aria-label":"Delegated branch",value:m,onChange:Ce=>{k(!0),g(Ce.target.value)}})]}),$.jsx(_p,{as:"div",variant:"caption",tone:"dim",children:A==="worktree"?`Creates a sibling checkout from ${t}, opens its editor, and starts the agent there.`:"The agent edits the files in this live worktree alongside you."}),$.jsx(Ms,{type:"button",variant:"primary",size:"compact",disabled:se||!c.trim()||!q||A!=="current"&&!m.trim(),onClick:()=>{pe(!0),UZr({task:c.trim(),harness:q,isolation:A,...A!=="current"?{branch:m.trim(),from:"HEAD"}:{}}).then(n).catch(Ce=>s(Ce instanceof Error?Ce.message:String(Ce))).finally(()=>pe(!1))},children:se?"Delegating…":"Delegate"})]})}function zdn(t){return t.replace(/[\\/]$/,"").split(/[\\/]/).at(-1)??t}function Vdn(t){const n=t.current?["Current worktree"]:[zdn(t.root)];t.sessions.length>0&&n.push("editor running"),t.dirty?n.push("uncommitted changes"):n.push("clean"),t.ahead&&n.push(`${t.ahead} ahead`),t.behind&&n.push(`${t.behind} behind`);const s=nUe(t);if(s.length===1){const c=s[0];n.push(c.kind==="agent"?`${c.displayName} ${c.status}${c.changeCount>0?` · ${c.changeCount} changes`:""}`:`${c.displayName} here`)}else s.length>1&&n.push(`${s.length} collaborators here`);return n.join(" · ")}function nUe(t){const n=new Map;for(const s of t.sessions)for(const c of s.presence?.participants??[]){const d=n.get(c.participantId);(!d||Date.parse(d.lastSeenAt)<Date.parse(c.lastSeenAt))&&n.set(c.participantId,c)}return[...n.values()].sort((s,c)=>{const d={"needs-input":0,active:1,idle:2,done:3};return d[s.status]-d[c.status]||s.displayName.localeCompare(c.displayName)})}function Udn(t){return t.kind==="agent"?"AI":t.displayName.split(/\s+/).slice(0,2).map(n=>n[0]?.toLocaleUpperCase()??"").join("")}function Ywt({worktree:t}){const n=nUe(t);if(n.length===0)return null;const s=n.slice(0,3);return $.jsxs("span",{className:"volter-worktree-presence",role:"img","aria-label":n.map(c=>`${c.displayName}, ${c.status}`).join("; "),children:[s.map(c=>$.jsx("span",{className:"volter-worktree-avatar","data-kind":c.kind,"data-status":c.status,style:{"--volter-participant-color":c.color},title:`${c.displayName} · ${c.kind} · ${c.status}`,"aria-hidden":"true",children:Udn(c)},c.participantId)),n.length>s.length&&$.jsxs("span",{className:"volter-worktree-avatar volter-worktree-avatar-more","aria-hidden":"true",children:["+",n.length-s.length]})]})}function Zwt(t,...n){const s=t.trim().toLocaleLowerCase();return!s||n.some(c=>c?.toLocaleLowerCase().includes(s))}function Qwt(t,n){return[+!t.current,Math.min(...nUe(t).map(s=>s.status==="needs-input"?0:s.status==="active"?1:s.status==="idle"?2:3)),+(t.branch===null),+(t.sessions.length===0),+!t.dirty,-(t.branch?n.get(t.branch)??0:0)]}function Jdn(t){return(n,s)=>{const c=Qwt(n,t),d=Qwt(s,t);return c.reduce((g,S,k)=>g||S-(d[k]??0),0)||(n.branch??n.root).localeCompare(s.branch??s.root)}}function Wdn(){const[t,n]=Ye.useState(Bdn),[s,c]=Ye.useState({branch:null,worktreeId:null}),[d,m]=Ye.useState(!1),[g,S]=Ye.useState(null),[k,A]=Ye.useState(null),F=Ye.useCallback(async(J=!1)=>{J||m(!0);try{n(await zZr()),A(null)}catch(q){A(q instanceof Error?q.message:String(q))}finally{J||m(!1)}},[]);return Ye.useEffect(()=>{if(L$)return;let J=!0;return $Zr().then(q=>{J&&c(q)}).catch(()=>{}),()=>{J=!1}},[]),{state:t,sessionIdentity:s,loading:d,busy:g,error:k,setError:A,refresh:F,run:async(J,q,G)=>{S(J),A(null);try{await q(),G()}catch(se){A(se instanceof Error?se.message:String(se))}finally{S(null)}}}}function Hdn(){const t=Ye.useRef(null),[n,s]=Ye.useState(!1),[c,d]=Ye.useState(""),[m,g]=Ye.useState(!1),{state:S,sessionIdentity:k,loading:A,busy:F,error:D,setError:J,refresh:q,run:G}=Wdn();if(Ye.useEffect(()=>{n&&q()},[n,q]),L$)return null;const se=S.worktrees.find(ft=>ft.current),pe=se?.branch??k.branch??(S.worktrees.length>0||k.worktreeId?"detached":"Branches"),ue=pe!=="Branches",Ce=new Map(S.branches.map(ft=>[ft.name,ft.updatedAt])),De=[...S.worktrees].sort(Jdn(Ce)).filter(ft=>Zwt(c,ft.branch,ft.root)),be=S.branches.filter(ft=>!ft.worktreeId&&Zwt(c,ft.name)),X=De.slice(0,c.trim()?30:10),we=be.slice(0,c.trim()?50:20),Be=De.length-X.length,bt=be.length-we.length,It=c.trim(),Wt=S.branches.some(ft=>ft.name===It),zt=De.length>0||be.length>0;return $.jsxs("div",{className:"volter-worktree-switcher",children:[$.jsxs(dBe,{ref:t,className:"volter-worktree-trigger","aria-label":ue?`Branches and worktrees, current branch ${pe}${se?.dirty?", uncommitted changes":""}`:"Branches and worktrees","aria-expanded":n,title:ue?`Branches and worktrees — ${pe}${se?.dirty?" (uncommitted changes)":""}`:"Branches and worktrees",onClick:()=>{s(ft=>!ft),n||d("")},onKeyDown:ft=>{ft.key==="ArrowDown"&&(ft.preventDefault(),s(!0))},children:[$.jsx(dc,{icon:c0r}),se?.dirty&&$.jsx("span",{className:"volter-worktree-dirty-dot","aria-hidden":"true"}),se&&$.jsx(Ywt,{worktree:se})]}),n&&$.jsxs(pBe,{anchorRef:t,align:"start",clamp:!0,autoFocusFirst:!1,className:"volter-worktree-menu","aria-label":"Branches and worktrees",onDismiss:()=>s(!1),children:[$.jsxs("div",{className:"volter-worktree-search",children:[$.jsx(Zm,{autoFocus:!0,"aria-label":"Find a branch",placeholder:"Find a branch…",value:c,disabled:F!==null||A,onChange:ft=>d(ft.target.value)}),$.jsx(Ms,{variant:"ghost",size:"compact","aria-label":"Refresh branches and worktrees",title:"Refresh",disabled:F!==null,onClick:()=>void G("refresh",q,()=>{}),children:$.jsx(dc,{icon:CTt})})]}),$.jsx(H1,{}),$.jsxs("div",{className:"volter-worktree-results",children:[A&&S.worktrees.length===0&&$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-empty",children:"Loading branches…"}),X.length>0&&$.jsxs("section",{"aria-label":"Worktrees",children:[$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-section-label",children:"Worktrees"}),X.map(ft=>{const tr=ft.branch??"Detached HEAD";return $.jsxs("div",{className:"volter-worktree-row-shell",children:[$.jsxs(Nc,{className:"volter-worktree-menu-item","data-current":ft.current||void 0,disabled:ft.current||!ft.project||F!==null,"aria-current":ft.current?"true":void 0,title:ft.root,onSelect:()=>void G(ft.worktreeId,()=>VZr(ft.worktreeId),()=>s(!1)),children:[$.jsx("span",{className:"volter-worktree-row-icon",children:ft.current&&$.jsx(dc,{icon:tLe})}),$.jsxs("span",{className:"volter-worktree-row-copy",children:[$.jsxs("span",{className:"volter-worktree-row-title",children:[tr,ft.dirty&&$.jsx("span",{className:"volter-worktree-dirty-dot","aria-hidden":"true"})]}),$.jsx("span",{className:"volter-worktree-row-detail",children:F===ft.worktreeId?"Opening…":Vdn(ft)})]}),$.jsx(Ywt,{worktree:ft})]}),!ft.current&&ft.sessions[0]?.sessionId&&$.jsx(Ms,{type:"button",size:"compact",variant:"ghost","aria-label":`Stop editor for ${tr}`,title:"Stop editor session",disabled:F!==null,onClick:()=>void G(`stop:${ft.worktreeId}`,()=>WZr(ft.worktreeId,ft.sessions[0].sessionId),()=>s(!1)),children:$.jsx(dc,{icon:DTt})}),!ft.current&&ft.sessions.length===0&&!ft.dirty&&$.jsx(Ms,{type:"button",size:"compact",variant:"ghost","aria-label":`Archive worktree ${tr}`,title:"Archive clean worktree",disabled:F!==null,onClick:()=>void G(`archive:${ft.worktreeId}`,()=>JZr(ft.worktreeId),()=>s(!1)),children:$.jsx(dc,{icon:YTt})})]},ft.worktreeId)}),Be>0&&$.jsxs(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-more",children:[Be," more worktrees — search to narrow"]})]}),we.length>0&&$.jsxs("section",{"aria-label":"Local branches",children:[$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-section-label",children:"Local branches"}),we.map(ft=>$.jsxs(Nc,{className:"volter-worktree-menu-item",disabled:F!==null,onSelect:()=>void G(ft.name,()=>USt(ft.name),()=>s(!1)),children:[$.jsx("span",{className:"volter-worktree-row-icon"}),$.jsxs("span",{className:"volter-worktree-row-copy",children:[$.jsx("span",{className:"volter-worktree-row-title",children:ft.name}),$.jsx("span",{className:"volter-worktree-row-detail",children:F===ft.name?"Creating worktree…":"Open in a new worktree"})]})]},ft.name)),bt>0&&$.jsxs(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-more",children:[bt," more ",It?"matches":"branches"," — search to narrow"]})]}),!A&&!zt&&!It&&$.jsx(_p,{as:"div",variant:"caption",tone:"dim",className:"volter-worktree-empty",children:"No branches found."})]}),It&&!Wt&&!A&&$.jsxs($.Fragment,{children:[$.jsx(H1,{}),$.jsxs(Nc,{className:"volter-worktree-create-command",disabled:F!==null,onSelect:()=>void G("create",()=>USt(It),()=>s(!1)),children:[$.jsx("span",{className:"volter-worktree-row-icon",children:"+"}),$.jsxs("span",{className:"volter-worktree-row-copy",children:[$.jsxs("span",{className:"volter-worktree-row-title",children:["Create branch “",It,"”"]}),$.jsx("span",{className:"volter-worktree-row-detail",children:F==="create"?"Creating worktree…":`From ${pe}, in a new worktree`})]})]})]}),!It&&$.jsxs($.Fragment,{children:[$.jsx(H1,{}),m?$.jsx(qdn,{currentLabel:pe,onDone:()=>{g(!1),s(!1),q(!0)},onError:J}):$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",className:"volter-worktree-delegate-open",onClick:()=>g(!0),children:"Delegate to agent…"}),$.jsx(H1,{}),$.jsx(Ldn,{})]}),D&&$.jsx(_p,{as:"div",variant:"caption",tone:"danger",role:"alert",className:"volter-worktree-error",children:D})]})]})}function Gdn({transport:t}){const[,n]=Ye.useReducer(D=>D+1,0);Ye.useEffect(()=>Rw(n),[]);const[s,c]=Ye.useState(!1),d=Ye.useRef(null),m=of(),g=m?.config.name??"No Project",S=m?.config.version??null,k=m?.config.engine.version??null,A=m?.config.manifestVersion??null,F=m?.rootPath??"";return Ye.useEffect(()=>{if(!s)return;const D=J=>{d.current&&!d.current.contains(J.target)&&c(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[s]),$.jsxs("header",{className:"volter-project-header",children:[lee()?.nativeMenus?$.jsx("div",{className:"volter-project-header-left"}):$.jsxs("div",{ref:d,className:"volter-project-header-left",children:[$.jsxs("div",{className:"volter-project-header-cluster volter-chrome-island volter-glass-island",children:[$.jsxs(dBe,{"data-testid":"project-menu-trigger","aria-label":`${g} project menu`,title:F?`${g} — ${F}`:g,onClick:()=>c(D=>!D),onKeyDown:D=>{D.key==="ArrowDown"&&(D.preventDefault(),c(!0))},className:"volter-project-trigger",children:[$.jsx(dc,{icon:Kk.content.project}),$.jsx(_p,{"data-testid":"project-name","data-project":g,"data-project-version":S??void 0,variant:"label",className:"volter-sr-only",children:g})]}),$.jsx(Hdn,{}),$.jsx(bZ,{onPointerDown:()=>c(!1),className:"volter-project-app-menus",children:$.jsx(bdn,{})})]}),$.jsx(Kdn,{}),s&&$.jsxs(fN,{autoFocusFirst:!0,onDismiss:()=>{const D=d.current?.querySelector('[data-testid="project-menu-trigger"]');c(!1),requestAnimationFrame(()=>D?.focus())},className:"volter-project-menu",children:[$.jsx(_p,{"data-testid":"project-menu-name",title:g,variant:"label",truncate:!0,className:"volter-project-menu-name",children:g}),F&&$.jsx(_p,{"data-testid":"project-menu-path",title:F,variant:"caption",tone:"dim",selectable:!0,truncate:!0,className:"volter-project-path",children:F}),S&&k&&A!==null&&$.jsxs($.Fragment,{children:[F&&$.jsx(H1,{}),$.jsxs("div",{"data-testid":"project-version-summary",className:"volter-project-versions",children:[$.jsx("span",{children:"Editor"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",HMt]}),$.jsx("span",{children:"Project"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",S]}),$.jsx("span",{children:"Engine"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",k]}),$.jsx("span",{children:"Format"}),$.jsxs(_p,{variant:"code",tone:"muted",children:["v",A]})]}),$.jsx(H1,{})]}),F&&$.jsx(Nc,{onSelect:()=>{c(!1),bMe(F)},children:"Show in Finder"}),$.jsx(Nc,{"data-testid":"project-menu-history",onSelect:()=>{c(!1),window.dispatchEvent(new CustomEvent("editor:show-history-tab"))},children:"Undo History…"})]})]}),$.jsx(bZ,{"data-testid":"header-transport",className:"volter-project-transport volter-chrome-island volter-glass-island",align:"center",children:t??$.jsx(Xdn,{})}),$.jsx(bZ,{className:"volter-project-header-right",justify:"end",align:"center",children:$.jsx(Cme,{slot:"header-trailing"})})]})}function Kdn(){Ye.useSyncExternalStore(U$,mhe,mhe),Ye.useSyncExternalStore(dDt,vhe,vhe);const t=Ye.useSyncExternalStore(mDt,zS,zS);if(mD().workspaceTabs!=="shown")return null;const n=AN().filter(s=>Uk(s.id));return $.jsxs($.Fragment,{children:[$.jsx(RTr,{orientation:"vertical",className:"volter-project-menu-rule"}),$.jsx("div",{role:"tablist","aria-label":"Workspaces","data-testid":"workspace-tabs",className:"volter-workspace-tabs",children:n.map(s=>$.jsx("button",{type:"button",role:"tab","aria-selected":s.id===t,title:s.description,className:"volter-workspace-tab",onClick:()=>s2(s.id),children:s.title},s.id))})]})}function Xdn(){Ye.useSyncExternalStore(lLe,YB,YB);const t=Ovr();return t.length===0?null:$.jsx($.Fragment,{children:t.map(({id:n,Component:s})=>$.jsx(s,{documentId:""},n))})}function Ydn({utility:t,testId:n}){const s=t.Content;return $.jsx("div",{className:"volter-dock-panel volter-regular-panel-portal","data-testid":n??`bottom-panel-utility-${t.id}`,"data-editor-hotkey-scope":"workspace","data-volter-noselect":"true",children:$.jsx(s,{})})}function Zdn(t,n){return window.confirm(n)}const Qdn=4,epn=4,tpn=24,rpn=4,npn=3,ipn=new Set(["model","image"]),opn=new Set(["glb","gltf","fbx","obj","dae","stl","ply","spz","bvh","3ds"]);function spn(t){const n=t.lastIndexOf(".");return n>0&&opn.has(t.slice(n+1).toLowerCase())}const apn=new Set(["audio","video","prefab","json"]);function xjt(t){let n=0;const s=[];return async c=>{n>=t&&await new Promise(d=>s.push(d)),n++;try{return await c()}finally{n--,s.shift()?.()}}}function iUe(t){return t.replace(/^(?:\.\/|\/)+/,"").replace(/\/+$/,"")}function cpn(t,n){const s=t?n.slice(t.length+1):n;return s.split("/",1)[0]??s}function eTt(t,n){return t.tier-n.tier||t.depth-n.depth||t.seq-n.seq}function lpn(t,n,s,c){for(const d of t){if(n.length>=c)break;s.has(d.subtree)||(s.add(d.subtree),n.push(d))}for(const d of t){if(n.length>=c)break;n.includes(d)||n.push(d)}}function upn(t,n){const s=[...t].sort(eTt),c=[],d=new Set;for(const m of[1,2]){const g=s.filter(S=>S.tier===m);lpn(g,c,d,n)}return c.sort(eTt),c.map(({path:m,name:g,kind:S})=>({path:m,name:g,kind:S}))}function fpn(t){return ipn.has(t)?1:apn.has(t)?2:0}function dpn(t,n,s,c){for(const d of s){if(d.name.startsWith("."))continue;const m=n.dir?`${n.dir}/${d.name}`:d.name;if(d.type==="directory"){n.depth+1>t.maxDepth?t.truncated=!0:c.push({dir:m,depth:n.depth+1});continue}t.totalAssets++;const g=spn(d.name)?"model":ig(d.name).kind,S=fpn(g);S!==0&&t.candidates.push({path:m,name:d.name,kind:g,tier:S,depth:n.depth,seq:t.seq++,subtree:cpn(t.base,m)})}}async function ppn(t,n,s={}){const c=s.listAssets??K0e,d=s.maxItems??Qdn,m=s.maxListings??tpn,g=xjt(s.listConcurrency??rpn),S=iUe(n),k={base:S,maxDepth:s.maxDepth??epn,candidates:[],totalAssets:0,truncated:!1,failedListings:0,seq:0};let A=0,F=[{dir:S,depth:0}];for(;F.length>0;){const D=Math.max(0,m-A),J=F.slice(0,D);J.length<F.length&&(k.truncated=!0),A+=J.length;const q=await Promise.all(J.map(se=>g(()=>c(t,se.dir)))),G=[];for(const[se,pe]of J.entries()){const ue=q[se];if(!ue||!ue.ok){k.failedListings+=1;continue}dpn(k,pe,ue.entries,G)}F=G}return{items:upn(k.candidates,d),totalAssets:k.totalAssets,scannedAll:!k.truncated&&k.failedListings===0,failedListings:k.failedListings}}const wjt="\0",JO=new Map,_pn=xjt(npn);function mpn(t,n,s){const c=`${t}${wjt}${iUe(n)}`,d=JO.get(c);if(d)return d;const m=_pn(()=>ppn(t,n,s));JO.set(c,m);const g=()=>{JO.get(c)===m&&JO.delete(c)};return m.then(S=>{(S.failedListings>0||S.items.length===0&&S.totalAssets===0)&&g()},g),m}function hpn(t,n){return t===n||t===""||n===""||t.startsWith(`${n}/`)||n.startsWith(`${t}/`)}function tTt(t){if(t===void 0){JO.clear();return}const n=iUe(t);for(const s of[...JO.keys()]){const c=s.slice(s.indexOf(wjt)+1);hpn(c,n)&&JO.delete(s)}}function jje(t,n="$"){return typeof t=="string"?[{path:n,value:t}]:Array.isArray(t)?t.flatMap((s,c)=>jje(s,`${n}[${c}]`)):!t||typeof t!="object"?[]:Object.entries(t).flatMap(([s,c])=>jje(c,`${n}.${s}`))}function gpn(t,n){if(!n||!t.toLowerCase().endsWith(".gltf"))return[];try{const s=JSON.parse(n),c=t.includes("/")?t.slice(0,t.lastIndexOf("/")+1):"";return[...s.buffers??[],...s.images??[]].flatMap(d=>d.uri&&!d.uri.startsWith("data:")?[`${c}${d.uri}`]:[])}catch{return[]}}function ypn(t){const n=new Map(t.files.map(A=>[A.path.replace(/^\//,""),A])),s=t.assetPath.replace(/^\//,""),c=n.get(s),d=new Set,m=ig(s);if(c||d.add("missing-file"),m.importable?m.runtimeReady||d.add("source-only"):d.add("unsupported-format"),c?.text&&m.kind==="json")try{JSON.parse(c.text)}catch{d.add("invalid-metadata")}const g=gpn(s,c?.text);g.some(A=>!n.has(A))&&d.add("missing-dependency");const S=[];for(const A of t.files)if(!(!A.text||!/\.json$/i.test(A.path)))try{for(const F of jje(JSON.parse(A.text))){const D=F.value.replace(/^\//,"");D===s?S.push({ownerPath:A.path,jsonPath:F.path,assetPath:s}):D.startsWith("assets/")&&!n.has(D)&&d.add("broken-asset-reference")}}catch{}d.size===0&&d.add("healthy");const k=new Set(["missing-file","missing-dependency","invalid-metadata","broken-asset-reference"]);return{health:{status:[...d].some(A=>k.has(A))?"error":d.has("healthy")?"healthy":"warning",codes:[...d]},dependencies:g,references:S}}async function Tjt(t,n=""){const s=await t.list(n),c=[];for(const d of s){const m=n?`${n}/${d.name}`:d.name;d.type==="dir"?c.push(...await Tjt(t,m)):/\.json$|\.gltf$/i.test(m)?c.push({path:m,text:await t.read(m)}):c.push({path:m})}return c}async function vpn(t,n){return ypn({assetPath:n,files:await Tjt(t)})}function y_e(t){typeof window>"u"||(window.dispatchEvent(new CustomEvent("editor:asset-mutation",{detail:t})),window.dispatchEvent(new CustomEvent("editor:assets-changed")))}function K4(t){const n=t.replace(/^\/+/,"").replace(/\\/g,"/").replace(/\/{2,}/g,"/");if(!n||n==="."||n.split("/").some(s=>!s||s===".."))throw new Error(`Invalid project asset path: ${t}`);return n}async function AOe(t,n){for(const s of n)if(await t.exists(s))throw new Error(`An asset already exists at ${s}.`)}async function bpn(t,n){const s=S$e(n.history,n.backend);switch(t.type){case"create-folder":{const c=K4(t.path),d=`${c}/.volter-folder`;if(await n.backend.exists(c))throw new Error(`Folder already exists: ${c}.`);return s.write(d,"",{label:`Create folder ${c}`})}case"duplicate":{const c=K4(t.source),d=K4(t.destination);await AOe(n.backend,[d]);const m=await n.backend.readBytes(c);return s.write(d,m,{label:`Duplicate ${c}`})}case"move":{const c=K4(t.source),d=K4(t.destination);await AOe(n.backend,[d]);const m=await n.backend.readBytes(c),g=new Map([[d,m],[c,null]]),S=await s.mutate([...g].map(([k,A])=>({path:k,data:A})),{label:`Move ${c}`});return S&&y_e({type:"move",oldPath:c,newPath:d}),S}case"move-many":{const c=t.moves.map(A=>({source:K4(A.source),destination:K4(A.destination)}));if(c.length===0)return!1;const d=new Set(c.map(A=>A.source)),m=c.map(A=>A.destination);if(new Set(m).size!==m.length)throw new Error("Batch move destinations must be unique.");for(const A of m)if(!d.has(A)&&await n.backend.exists(A))throw new Error(`An asset already exists at ${A}.`);const g=await Promise.all(c.map(async A=>({...A,bytes:await n.backend.readBytes(A.source)}))),S=new Map;for(const{destination:A,bytes:F}of g)S.set(A,F);for(const{source:A}of g)m.includes(A)||S.set(A,null);const k=await s.mutate([...S].map(([A,F])=>({path:A,data:F})),{label:`Move ${c.length} assets`});if(k)for(const A of c)y_e({type:"move",oldPath:A.source,newPath:A.destination});return k}case"delete":{const c=[...new Set(t.paths.map(K4))],d=await s.mutate(c.map(m=>({path:m,data:null})),{label:`Delete ${c.length} asset${c.length===1?"":"s"}`});return d&&y_e({type:"delete",paths:c}),d}case"import":{const c=t.files.map(m=>({path:K4(m.path),data:m.bytes}));await AOe(n.backend,c.map(m=>m.path));const d=await s.mutate(c,{label:`Import ${c.length} asset${c.length===1?"":"s"}`});return d&&y_e({type:"change",paths:c.map(m=>m.path)}),d}}}const Spn=320,xpn=180,wpn="document-preview-v4",gZ=new Map,Tpn=new WPt(async t=>{const n=gZ.get(t);if(await new Promise(s=>{typeof requestIdleCallback=="function"?requestIdleCallback(()=>s(),{timeout:1e3}):setTimeout(s,0)}),[...n.consumers].every(s=>s.aborted))throw new DOMException("Preview demand was cancelled.","AbortError");return n.run()},1);let YZ=null,rTt,DOe=null;const WY=new Set;async function Cjt(t){const n=gR();let s;try{s=await n.list(t)}catch{return[]}const c=[];for(const d of s)d.type==="dir"?c.push(...await Cjt(d.path)):c.push(`${d.path}:${d.size??0}:${d.mtime??0}`);return c}async function Cpn(){const t=of()?.rootPath;return rTt!==t&&(rTt=t,YZ=null),YZ??=Promise.all([LRt([xR,"volter.adapter.ts",".storybook/**/*","src/**/*.ts","src/**/*.tsx","src/**/*.js","src/**/*.jsx","src/**/*.mjs","src/**/*.cjs","src/**/*.json","src/**/*.css"]).then(async n=>Promise.all(n.map(async s=>`${s}:${await SMe(s)??""}`))),Cjt("")]).then(([n,s])=>Ejt([...n,...s].sort().join(`
1404
1404
  `))),YZ}function Epn(t){return WY.add(t),DOe??=Ag.watch(n=>{if(n.path===PB){JPt();for(const s of WY)s();return}if(!(!/^(src|public|\.storybook)\//.test(n.path)&&n.path!==xR&&n.path!=="volter.adapter.ts")){YZ=null;for(const s of WY)s()}}),()=>{WY.delete(t),WY.size===0&&(DOe?.(),DOe=null,YZ=null)}}async function kpn(t,n,s){n.throwIfAborted();let c=gZ.get(t);c||(c={run:s,consumers:new Set},gZ.set(t,c)),c.consumers.add(n);const d=Tpn.request(t,1);n.addEventListener("abort",d.cancel,{once:!0});try{return await d.promise}finally{n.removeEventListener("abort",d.cancel),c.consumers.delete(n),c.consumers.size===0&&gZ.get(t)===c&&gZ.delete(t)}}async function Ejt(t){const n=new TextEncoder().encode(t),s=await crypto.subtle.digest("SHA-256",n);return[...new Uint8Array(s)].map(c=>c.toString(16).padStart(2,"0")).join("")}function Apn(t){const n=/^data:([^;,]+);base64,(.*)$/s.exec(t);if(!n)throw new Error("Document preview owner returned an invalid image data URL.");const s=atob(n[2]),c=new Uint8Array(s.length);for(let d=0;d<s.length;d++)c[d]=s.charCodeAt(d);return{mime:n[1],bytes:c}}function nTt(t,n="image/png"){const s=new Uint8Array(t.byteLength);return s.set(t),URL.createObjectURL(new Blob([s.buffer],{type:n}))}async function Dpn(t){const n=await b$e();if(n.status!=="ok")return;const s=n.manifest.entries[`document:${t}`]?.framing;return s?{position:{x:s.position[0],y:s.position[1],z:s.position[2]},target:{x:s.target[0],y:s.target[1],z:s.target[2]},...s.fov===void 0?{}:{fov:s.fov}}:void 0}async function Ppn(t,n,s,c){const d=of()?.rootPath??"no-project",m=await Dpn(t),g=JSON.stringify({projectId:d,documentId:t,recipe:wpn,revision:n.revision(),dependencies:await Cpn(),camera:m});c.throwIfAborted();const S=await Ejt(g),k=`.volter/cache/document-previews/${S}.png`;if(s===0&&await Ag.exists(k))return nTt(await Ag.readBytes(k));const A=await kpn(S,c,()=>n.capture({width:Spn,height:xpn,...m?{camera:m}:{}}));c.throwIfAborted();const F=Apn(A);return await Ag.write(k,F.bytes),nTt(F.bytes,F.mime)}function Ipn({documentId:t,source:n,previewRevision:s}){const[c,d]=Ye.useState(null),[m,g]=Ye.useState(null),[S,k]=Ye.useState(0),[A,F]=Ye.useState(0),[D,J]=Ye.useState(!0),[q,G]=Ye.useState(!1),se=Ye.useRef(null),pe=Ye.useRef(null),ue=Ye.useRef(null),Ce=Ye.useRef({previewRevision:s,retry:A});return Ye.useEffect(()=>{let Fe=null;const De=()=>{pe.current?.abort(),J(!0),Fe&&clearTimeout(Fe),Fe=setTimeout(()=>k(we=>we+1),750)},be=n.subscribe(De),X=Epn(De);return()=>{Fe&&clearTimeout(Fe),be(),X()}},[n]),Ye.useEffect(()=>()=>{ue.current?.startsWith("blob:")&&URL.revokeObjectURL(ue.current)},[]),Ye.useEffect(()=>{const Fe=se.current;if(!Fe)return;const De=new IntersectionObserver(([be])=>G(be?.isIntersecting??!1));return De.observe(Fe),()=>De.disconnect()},[]),Ye.useEffect(()=>{if(!q)return;const Fe=new AbortController;pe.current=Fe;const De=Ce.current.previewRevision!==s||Ce.current.retry!==A?1:0;return g(null),J(!0),Ppn(t,n,De,Fe.signal).then(be=>{if(Fe.signal.aborted){URL.revokeObjectURL(be);return}ue.current&&URL.revokeObjectURL(ue.current),Ce.current={previewRevision:s,retry:A},ue.current=be,d(be),J(!1)}).catch(be=>{Fe.signal.aborted||(g(be instanceof Error?be.message:String(be)),J(!1))}),()=>Fe.abort()},[t,s,A,n,S,q]),$.jsxs("div",{ref:se,style:{width:"100%",height:"100%",position:"relative",display:"grid",placeItems:"center"},children:[c&&$.jsx("img",{src:c,alt:`${t} preview`,style:{width:"100%",height:"100%",objectFit:"contain"}}),m?$.jsx("button",{type:"button",title:m,onClick:Fe=>{Fe.stopPropagation(),F(De=>De+1)},style:{position:"absolute",bottom:0,border:0,background:"var(--vscode-editor-background)",color:Zf[3],pointerEvents:"auto"},children:"Preview unavailable · Retry"}):D?$.jsx("span",{role:"status",style:{position:"absolute",bottom:0,background:"var(--vscode-editor-background)",color:Zf[3],fontSize:YY.xs},children:c?"Refreshing preview…":"Loading preview…"}):null]})}function kjt(t,n){return Y0e(t,n.path)}function Npn({root:t,item:n}){const[s,c]=Ye.useState(!1);return s?$.jsx(vD,{kind:"image",size:14}):$.jsx("img",{src:kjt(t,n),alt:n.name,loading:"lazy",onError:()=>c(!0)})}function Opn({root:t,item:n}){const s=A9t(kjt(t,n),Oin);return s.failed?$.jsx(vD,{kind:"model",size:14}):s.src?$.jsx("img",{src:s.src,alt:n.name,"data-fit":"contain",onError:s.fromManifest?s.rejectManifest:void 0}):null}function Rpn({root:t,item:n}){return ig(n.name).editor==="environment"?$.jsx(wR,{kind:"image",name:n.name,variant:"cell"}):n.kind==="image"?$.jsx(Npn,{root:t,item:n}):n.kind==="model"?$.jsx(Opn,{root:t,item:n}):$.jsx(wR,{kind:n.kind,name:n.name,variant:"cell"})}function Fpn({root:t,folderPath:n,revision:s}){const[c,d]=Ye.useState(null);if(Ye.useEffect(()=>{d(null)},[t,n]),Ye.useEffect(()=>{let g=!1;return mpn(t,n).then(S=>{g||d(S)},()=>{g||d("failed")}),()=>{g=!0}},[t,n,s]),c===null||c==="failed")return $.jsx(vD,{kind:"folder"});if(c.totalAssets===0)return $.jsx("div",{className:"volter-folder-preview","data-testid":"folder-preview-empty","aria-hidden":"true",children:$.jsxs("div",{className:"volter-folder-preview__empty",children:[$.jsx(dc,{icon:MOe,className:"volter-folder-preview__empty-glyph"}),$.jsx("span",{className:"volter-folder-preview__empty-caption",children:"Empty"})]})});const m=c.scannedAll?`${c.totalAssets}`:`${c.totalAssets}+`;return c.items.length===0?$.jsxs("div",{className:"volter-folder-preview","data-testid":"folder-preview-plain","aria-hidden":"true",children:[$.jsx("div",{className:"volter-folder-preview__fallback",children:$.jsx(vD,{kind:"folder"})}),$.jsx("span",{className:"volter-folder-preview__count",children:m})]}):$.jsxs("div",{className:"volter-folder-preview","data-testid":"folder-preview","aria-hidden":"true",children:[$.jsx("div",{className:"volter-folder-preview__grid","data-count":c.items.length,children:c.items.map(g=>$.jsx("div",{className:"volter-folder-preview__cell",children:$.jsx(Rpn,{root:t,item:g})},g.path))}),$.jsx("span",{className:"volter-folder-preview__chip",children:$.jsx(dc,{icon:uee})}),$.jsx("span",{className:"volter-folder-preview__count",children:m})]})}const Ajt="contentBrowser";function Lje(t){return t.type==="directory"?"folder":ig(t.name).kind}function Mpn(t,n,s){return Y0e(t,n?`${n}/${s}`:s)}function jpn(t,n,s){return n?`/${n}/${s}`:`/${s}`}function Lpn(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Bje(t){const n=ig(t);return n.importable?n.runtimeReady?"healthy":"source-only":"unsupported"}const Bpn=640,iTt={scope:"content",root:"public",currentPath:"",viewMode:"grid",sort:"relevance",filter:"all",density:96,expanded:["public"],treeVisibility:"auto",facets:["component"]};function $pn(){try{const t=vve(Ajt)??{},n=t.viewMode,s=t.treeVisibility,c=t.scope,d=t.root;return{...iTt,...t,root:d===nA?nA:"public",currentPath:t.currentPath??"",scope:c==="files"?"files":"content",viewMode:c==="files"&&n==="list"?"list":"grid",treeVisibility:s==="shown"||s==="hidden"?s:"auto",facets:Array.isArray(t.facets)&&t.facets.length>0?[t.facets[0]]:["component"]}}catch{return iTt}}const qpn={listAssets:K0e,listProjectComponents:MRt},POe="Reference material is not part of the built game — it stays in the project's references/ folder and is never exported. Copy the file into public/ to use it in the game; edit or remove it where it lives.",zpn=new Set(["component","scene","canvas","model","image","video","audio","other"]);function Vpn(t){const n=t.charAt(0).toUpperCase()+t.slice(1);return n.endsWith("s")?n:`${n}s`}async function oTt(t,n){if(!n&&e_()!==t)throw new Error("Open this scene as the active document before using its current view.");const s=o2(t)?.read()?.camera,c=s&&typeof s!="string"?s:null;if(!n&&!c)throw new Error("The active scene has no ready 3D authoring view to save.");await jsn().saveThumbnailFraming(`document:${t}`,n?void 0:{position:[c.position.x,c.position.y,c.position.z],target:[c.target.x,c.target.y,c.target.z],fov:c.fov??50})}function Upn(t){return t.component.surface==="three"?"3d":t.component.surface==="canvas"?"2d":"ui"}function Jpn(t){const n={"3d":"3D","2d":"2D",ui:"UI"};return["3d","2d","ui"].flatMap(s=>{const c=t.filter(d=>d.source==="component"&&Upn(d)===s);return c.length>0?[{id:`prefabs-${s}`,label:n[s],headingLevel:"category",entries:c}]:[]})}function Wpn(t,n,s){return n==="files"?[{id:"files",label:null,headingLevel:null,entries:[...t]}]:s.length===1&&s[0]==="component"?Jpn(t):t.length>0?[{id:"content",label:null,headingLevel:null,entries:[...t]}]:[]}function Djt(t){return t.source==="available"?t.available.category:t.source==="component"?t.component.contentKind??"component":t.source==="document"?t.document.kind:L9t(t.name)}function Hpn(t){return t.source==="component"?t.component.contentKind??"component":t.source==="available"||t.source==="document"?"source":Lje(t.entry)}function WO(t){const n=t.lastIndexOf("/");return n<0?"":t.slice(0,n)}function Gpn(t,n){if(t.source==="component"||t.source==="document"||t.source==="available")return;const{entry:s}=t,{currentRoot:c,currentPath:d,navigate:m,openAsset:g}=n;if(s.type==="directory"){m(c,d?`${d}/${s.name}`:s.name);return}const S=ig(s.name),k=FB(S);if(k){if(t.spritesheet){const A=t.path.includes("#")?t.path.slice(t.path.lastIndexOf("#")+1):s.name.replace(/\.png$/i,"");g(`/${t.spritesheet.sheetPath}#${A}`,k);return}g(Mpn(t.root,d,s.name),k)}}function Pjt(t){return t.source==="component"?`Component · line ${t.component.line}`:t.source==="available"?t.path||t.available.descriptor.title:t.source==="document"?`${t.document.kind} · ${t.path}`:t.entry.type!=="file"?"Folder":t.entry.size===void 0?"Size unknown":Lpn(t.entry.size)}function Kpn(t){if(t.source==="component")return`${t.name}
1405
1405
  ${t.path}:${t.component.line}`;if(t.source==="available")return`${t.name}
1406
1406
  ${t.path}`;if(t.source==="document")return`${t.name}
1407
1407
  ${t.path}`;const n=Pjt(t);return n?`${t.name}
1408
1408
  ${n}`:t.name}function Xpn(t,n,s){if(t.source==="component"||t.source==="document"||t.source==="available"||n==="all"||t.entry.type==="directory")return!0;const c=ig(t.name),d=s?`${s}/${t.name}`:t.name;return{"runtime-ready":c.runtimeReady,"source-only":c.importable&&!c.runtimeReady,unsupported:!c.importable,imported:d.startsWith("asset-library/local/"),generated:d.startsWith(".generated/")}[n]}function HB(t,n){return t.name.localeCompare(n.name)||t.path.localeCompare(n.path)}function sTt(t){return t.source==="asset"?mon({path:t.path,root:t.root,entry:t.entry}):t.source==="available"||t.source==="document"?10:hon(t.component)-100}function Ypn(t,n){const s=sTt(t),c=sTt(n);return s!==c?s-c:t.source!==n.source?t.source==="component"?-1:1:(t.source==="component"&&n.source==="component"||t.source!=="asset"||n.source!=="asset",HB(t,n))}function aTt(t,n){return t===void 0?n===void 0?0:1:n===void 0?-1:n-t}function Zpn(t,n,s){if(t.entry.type!==n.entry.type)return t.entry.type==="directory"?-1:1;if(s==="size"&&t.entry.size!==n.entry.size)return aTt(t.entry.size,n.entry.size);if(s==="modified"&&t.entry.modifiedAt!==n.entry.modifiedAt)return aTt(t.entry.modifiedAt,n.entry.modifiedAt);if(s==="type"){const c=Lje(t.entry).localeCompare(Lje(n.entry));if(c!==0)return c}if(s==="health"){const c=Bje(t.name).localeCompare(Bje(n.name));if(c!==0)return c}return HB(t,n)}function Qpn(t,n,s){return s==="relevance"?Ypn(t,n):s==="name"?HB(t,n):t.source!==n.source?t.source==="component"?-1:1:t.source!=="asset"||n.source!=="asset"?HB(t,n):Zpn(t,n,s)}function e_n(t,n){if(n.query&&!`${t.name} ${t.path}`.toLowerCase().includes(n.query))return!1;if(n.scope==="content"&&n.facets.length>0){const s=Djt(t);return n.facets.includes(s)}return n.scope==="content"||Xpn(t,n.filter,n.shownPath)}const t_n={width:"100%",minWidth:0,padding:0,textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:3},r_n={width:"100%",minWidth:0,minHeight:28,padding:"3px 6px",textAlign:"left",display:"flex",flexDirection:"row",alignItems:"center",gap:7};function n_n(t){const n=new Map;if(!t.assetSubject)return n;const s=t.assetSubject.entries?.()??C3r(t.hierarchy).flatMap(c=>{const d=t.assetSubject?.get(c.id);return d?[{id:c.id,subject:d}]:[]});for(const{id:c,subject:d}of s){const m=d.sourcePath?.replaceAll("\\","/").replace(/^\.\//,"")??"",g=m.lastIndexOf("/src/"),S=g>=0?m.slice(g+1):m;n.set(`${S}:${d.name}`,{id:c,subject:d})}return n}const i_n=()=>()=>{},o_n=()=>0;function s_n({sheetUrl:t,frame:n}){return $.jsx(I9t,{sheetUrl:t,frame:{name:"",x:n.x,y:n.y,width:n.width,height:n.height,rotated:n.rotated,sourceWidth:n.sourceWidth,sourceHeight:n.sourceHeight,trimX:n.trimX,trimY:n.trimY},maxEdge:48})}function a_n({item:t,kind:n,assetUrl:s,grid:c,folderPath:d,previewRevision:m}){const g=s;if(n==="folder")return c?$.jsx(Fpn,{root:t.source==="asset"?t.root:"public",folderPath:d,revision:m}):$.jsx(vD,{kind:"folder",size:15});if(n==="audio"&&s)return $.jsx(Fin,{url:g,name:t.name});if(!c)return $.jsx(vD,{kind:n,size:15});if(t.source==="available"&&t.available.descriptor.preview)return $.jsx(Ipn,{documentId:t.available.descriptor.id,source:t.available.descriptor.preview,previewRevision:m});if(t.source==="component"){const{Thumbnail:S}=t.contentSource;return $.jsx(S,{entry:t.contentEntry,previewRevision:m})}return ig(t.name).editor==="environment"?$.jsx(wR,{kind:"image",name:t.name}):n==="image"?t.source==="asset"&&t.spritesheet?$.jsx(s_n,{sheetUrl:`/${t.spritesheet.sheetPath}`,frame:t.spritesheet}):$.jsx("img",{src:g,alt:t.name,style:{maxWidth:48,maxHeight:48,objectFit:"contain",borderRadius:sQ.sm}}):n==="video"&&g?$.jsx("video",{src:`${g}#t=0.1`,muted:!0,playsInline:!0,preload:"metadata",style:{maxWidth:48,maxHeight:48,objectFit:"contain",borderRadius:sQ.sm}}):n==="model"||k9t(s)?$.jsx(D9t,{url:s}):["prefab","json"].includes(n)?$.jsx(wR,{kind:n,name:t.name}):$.jsx(vD,{kind:n})}function c_n({item:t,selected:n,onDragStart:s,onSelect:c,onOpen:d,onContextMenu:m,viewMode:g,previewRevision:S,showPath:k}){const A=Hpn(t),F=t.source==="asset"?t.entry:null,D=F?.type==="file"?ig(F.name):null,J=t.source==="asset"?Y0e(t.root,t.path):"",q=t.path,G=Kpn(t),se=F?F.type==="directory"||D?.placeable?D?.placeable?"grab":"pointer":"default":"pointer",pe=Pjt(t),ue=t.source==="component"?t.path:t.source==="asset"?Dge(t.root,WO(t.path)).replace(/\/$/,""):WO(t.path)||"public",Ce=k?`${ue} · ${pe}`:pe,Fe=g!=="list";return $.jsxs("div",{className:"volter-selectable volter-project-asset-entry","data-selected":n||void 0,"data-view":g,role:"option","aria-selected":n,tabIndex:0,draggable:t.source==="component"||t.source==="asset"&&F?.type==="file"&&D?.placeable===!0||t.source==="asset"&&t.spritesheet!==void 0||t.source==="asset"&&t.root===nA&&F?.type==="file",onPointerEnter:()=>{A==="audio"&&J&&Ain(J)},onPointerLeave:()=>{A==="audio"&&J&&Din(J)},onDragStart:De=>s(De,t),onDragEnd:_3r,onClick:De=>c(t,De),onDoubleClick:()=>d(t),onContextMenu:De=>m(De,t),onKeyDown:De=>{if(De.key==="ContextMenu"||De.shiftKey&&De.key==="F10"){De.preventDefault();const be=De.currentTarget.getBoundingClientRect();De.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:be.left,clientY:be.bottom}))}else De.key==="Enter"?d(t):De.key===" "&&(c(t,De),De.preventDefault())},title:G,style:{...Fe?t_n:r_n,borderRadius:sQ.sm,cursor:se,userSelect:"none"},children:[$.jsxs("div",{className:"volter-project-asset-entry__preview","data-testid":"asset-entry-preview",style:{...Fe?{width:"100%",aspectRatio:t.source==="available"&&t.available.descriptor.preview?"16 / 9":"1 / 1",margin:"0 auto"}:{width:18,height:18,margin:0},display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",borderRadius:sQ.sm,pointerEvents:"none",position:"relative"},children:[$.jsx(a_n,{item:t,kind:A,assetUrl:J,grid:Fe,folderPath:q,previewRevision:S}),Fe&&$.jsx("span",{className:"volter-project-asset-entry__kind","data-testid":"asset-entry-kind",title:`${A} asset`,children:$.jsx(vD,{kind:A,size:11})})]}),$.jsx("div",{"data-testid":"asset-entry-name",style:{...Fe?{fontSize:10,lineHeight:"13px",minHeight:26,display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2}:{fontSize:11,lineHeight:"18px",flex:1},overflow:"hidden",textOverflow:"ellipsis",whiteSpace:Fe?"normal":"nowrap",color:Zf[1],minWidth:0},children:t.name}),!Fe&&$.jsx("div",{role:"listbox","aria-label":"Project assets","aria-multiselectable":"true",style:{maxWidth:"45%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:Zf[3],fontSize:10},children:Ce})]})}function l_n({scope:t,facets:n,availableFacets:s,currentPath:c,currentRoot:d,searchOpen:m,searchQuery:g,viewMode:S,density:k,treeVisible:A,onScopeChange:F,onFacetToggle:D,onFacetsClear:J,onNavigate:q,onSearchOpenChange:G,onSearchQueryChange:se,onViewModeChange:pe,onDensityChange:ue,onTreeVisibilityToggle:Ce,onCreateFolder:Fe,onImport:De,onDelete:be,deleteDisabled:X,onRefresh:we,generationTools:Be,onGenerate:bt}){const It=Ye.useRef(null),Wt=Ye.useRef(!0),zt=Ye.useRef(null),[ft,tr]=Ye.useState(!1),Qt=c?c.split("/"):[],Tt=WO(c),vn=d===nA?"References":"Files",Yr=()=>{se(""),G(!1)};return Ye.useEffect(()=>{if(!ft)return;const en=ii=>{It.current?.contains(ii.target)||tr(!1)};return document.addEventListener("pointerdown",en),()=>document.removeEventListener("pointerdown",en)},[ft]),Ye.useLayoutEffect(()=>{const en=zt.current;if(!en)return;const ii=()=>{en.scrollLeft=en.scrollWidth};Wt.current=!0,ii();const No=()=>{Wt.current=en.scrollWidth-en.clientWidth-en.scrollLeft<=1};en.addEventListener("scroll",No,{passive:!0});const gn=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>{Wt.current&&ii()});return gn?.observe(en),()=>{en.removeEventListener("scroll",No),gn?.disconnect()}},[c,m]),$.jsxs("div",{className:"volter-project-assets-toolbar",children:[$.jsxs(n$,{label:"Content display",compact:!0,className:"volter-project-assets-toolbar__row",children:[$.jsxs(Cht,{children:[$.jsx(mO,{text:"Content grid",position:"top",children:$.jsx(dm,{"aria-label":"Content grid","data-testid":"content-scope-content","aria-pressed":t==="content",onClick:()=>{t!=="content"&&F("content"),pe("grid")},children:$.jsx(dc,{icon:Y0r})})}),$.jsx(mO,{text:"Browse grid",position:"top",children:$.jsx(dm,{"aria-label":"Browse grid","data-testid":"content-scope-files","aria-pressed":t==="files"&&S==="grid",onClick:()=>{t!=="files"&&F("files"),pe("grid")},children:$.jsx(dc,{icon:PTt})})}),$.jsx(mO,{text:"Browse list",position:"top",children:$.jsx(dm,{"aria-label":"Browse list","data-testid":"asset-view-list","aria-pressed":t==="files"&&S==="list",onClick:()=>{t!=="files"&&F("files"),pe("list")},children:$.jsx(dc,{icon:vZ})})})]}),$.jsx("span",{style:{flex:1}}),m?$.jsx(Zm,{type:"text","data-testid":"asset-search-input","aria-label":"Search content",placeholder:"Search content...",value:g,onChange:en=>se(en.target.value),onKeyDown:en=>{en.key==="Escape"&&Yr()},className:"volter-input",autoFocus:!0,style:{flex:"0 1 160px",minWidth:60}}):null,$.jsx(mO,{text:m?"Close search":"Search",position:"top",children:$.jsx(dm,{"data-testid":m?"asset-search-close":"asset-search-toggle","aria-label":m?"Close search":"Search content",onClick:()=>{m?Yr():G(!0)},children:$.jsx(dc,{icon:m?Kk.action.close:Kk.action.search})})})]}),$.jsxs(n$,{label:t==="content"?"Content types":"Folder navigation",compact:!0,className:"volter-project-assets-toolbar__row",children:[t==="files"&&$.jsxs($.Fragment,{children:[$.jsx(mO,{text:A?"Hide folders":"Show folders",position:"top",children:$.jsx(dm,{"data-testid":"asset-tree-toggle","aria-label":A?"Hide folder tree":"Show folder tree","aria-controls":"project-asset-tree","aria-expanded":A,onClick:Ce,children:$.jsx(dc,{icon:XTt})})}),$.jsx(mO,{text:"Back",position:"top",children:$.jsx(dm,{"data-testid":"asset-back","aria-label":"Back",disabled:!c,onClick:()=>q(d,Tt),children:$.jsx(dc,{icon:$0r})})}),$.jsxs("nav",{ref:zt,"data-testid":"asset-breadcrumb","aria-label":"Asset location",style:{flex:1,display:"flex",alignItems:"center",gap:2,fontSize:12,minWidth:0,overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap"},children:[c?$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",onClick:()=>q(d,""),style:{flexShrink:0},children:vn}):$.jsx("span",{"aria-current":"location",style:{color:Zf[1]},children:vn}),Qt.map((en,ii)=>{const No=Qt.slice(0,ii+1).join("/"),gn=ii===Qt.length-1;return $.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,flexShrink:0},children:[$.jsx("span",{style:{color:Zf[3]},children:"/"}),gn?$.jsx("span",{"aria-current":"location",title:en,style:{color:Zf[1]},children:en}):$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",onClick:()=>q(d,No),children:en})]},No)})]})]}),t==="content"&&$.jsxs(Cht,{className:"volter-content-filter-inline","aria-label":"Content types",children:[m&&$.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-content-filter-chip","data-testid":"content-filter-all","aria-pressed":n.length===0,onClick:J,children:"All"}),[...[["component","Prefabs"],["scene","Scenes"],["canvas","Canvases"],["model","Models"],["image","Images"],["video","Videos"],["audio","Audio"],["other","Other"]].filter(([en])=>s.has(en)),...[...s].filter(en=>!zpn.has(en)).sort().map(en=>[en,Vpn(en)])].map(([en,ii])=>$.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-content-filter-chip","data-testid":`content-filter-${en}`,"aria-pressed":n.includes(en),onClick:()=>D(en),children:ii},en))]}),$.jsxs("div",{ref:It,className:"volter-project-assets-toolbar__more",children:[$.jsx(mO,{text:"More asset actions",position:"top",children:$.jsx(dm,{"aria-label":"More asset actions","aria-expanded":ft,"aria-haspopup":"menu",onClick:()=>tr(en=>!en),children:$.jsx(dc,{icon:a0r})})}),ft&&$.jsxs(fN,{autoFocusFirst:!0,className:"volter-project-assets-toolbar__menu",onDismiss:()=>tr(!1),children:[$.jsx(Nc,{"data-command-id":O_.import.id,onSelect:()=>{tr(!1),De()},children:"Import files…"}),$.jsx(Nc,{"data-command-id":O_.createFolder.id,onSelect:()=>{tr(!1),Fe()},children:"New folder"}),Be.length>0&&$.jsxs($.Fragment,{children:[$.jsx("hr",{className:"volter-menu-separator"}),$.jsx(Nc,{onSelect:()=>{tr(!1),bt()},children:"Create asset…"})]}),$.jsx(Nc,{onSelect:()=>{tr(!1),ue(k<=96?132:88)},children:k<=96?"Larger thumbnails":"Smaller thumbnails"}),$.jsx(Nc,{disabled:X,"data-command-id":O_.delete.id,onSelect:()=>{tr(!1),be()},children:"Delete selected"}),$.jsx(Nc,{onSelect:()=>{tr(!1),we()},children:"Refresh"})]})]})]})]})}function u_n(t){const[n,s]=Ye.useState(new Map);Ye.useEffect(()=>{s(new Map)},[t.revision]),Ye.useEffect(()=>{for(const d of t.expanded){if(n.has(d))continue;const m=qRt.find(S=>d===S||d.startsWith(`${S}/`));if(!m)continue;const g=d===m?"":d.slice(`${m}/`.length);t.loadAssets(m,g).then(S=>{S.ok&&s(k=>{const A=new Map(k);return A.set(d,S.entries.filter(F=>F.type==="directory").map(F=>F.name)),A})})}},[n,t.expanded,t.loadAssets]);const c=(d,m,g)=>{const S=m?`${d}/${m}`:d,k=t.expanded.has(S),A=m.split("/").pop()||d;return $.jsxs("div",{children:[$.jsxs("div",{className:"volter-asset-tree-row",style:{paddingLeft:6+g*14},children:[$.jsx(dm,{className:"volter-asset-tree-toggle","aria-label":`${k?"Collapse":"Expand"} ${A}`,"aria-expanded":k,onClick:()=>t.onExpanded(S),children:$.jsx(dc,{icon:ITt,style:{transform:k?"rotate(90deg)":void 0}})}),$.jsxs(Ms,{variant:"ghost",size:"compact",className:"volter-asset-tree-target","aria-current":t.currentRoot===d&&t.currentPath===m?"page":void 0,onClick:()=>t.onNavigate(d,m),children:[$.jsx(dc,{icon:uee}),A]})]}),k&&n.get(S)?.map(F=>c(d,m?`${m}/${F}`:F,g+1))]},S)};return $.jsxs("aside",{id:"project-asset-tree",className:"volter-asset-tree","aria-label":"Project asset sources",hidden:t.hidden,children:[$.jsx("div",{className:"volter-asset-facet-title",children:"Project"}),c("public","",0),$.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-asset-tree-target",onClick:()=>t.onNavigate("public","asset-library/local"),children:"Imported"}),$.jsx(Ms,{variant:"ghost",size:"compact",className:"volter-asset-tree-target",onClick:()=>t.onNavigate("public",".generated"),children:"Generated"}),$.jsx("div",{className:"volter-asset-facet-title",children:"References"}),c(nA,"",0)]})}function f_n(t){const n=Ye.useRef(null),[s,c]=Ye.useState(t),[d,m]=Ye.useState(!0);Ye.useLayoutEffect(()=>{const k=n.current;if(!k)return;const A=D=>{D>0&&m(D>=Bpn)};if(A(k.getBoundingClientRect().width),typeof ResizeObserver>"u")return;const F=new ResizeObserver(([D])=>{D&&A(D.contentRect.width)});return F.observe(k),()=>F.disconnect()},[]);const g=s==="shown"||s==="auto"&&d,S=Ye.useCallback(()=>{c(g?"hidden":"shown")},[g]);return{browserRef:n,treeVisibility:s,treeVisible:g,toggleTreeVisibility:S}}function d_n({services:t=qpn}){const n=Yv(),s=typeof n.subscribe=="function"?n.subscribe:i_n,c=typeof n.getSnapshot=="function"?n.getSnapshot:o_n,d=typeof n.getShellSnapshot=="function"?n.getShellSnapshot:c,m=Ye.useSyncExternalStore(s,d,d),g=Ye.useSyncExternalStore(Cee,AD,AD),S=Ye.useSyncExternalStore(i2,X1,X1),k=Ye.useRef(n);k.current=n;const A=G9t(),F=Ye.useSyncExternalStore(l2,rA,rA),D=Ye.useSyncExternalStore(b9t,qge,qge),J=F.filter(pr=>pr.point==="workspace.document"&&pr.tool?.generation?.role==="submit"),q=Ye.useMemo($pn,[]),[G,se]=Ye.useState(q.root),[pe,ue]=Ye.useState(q.scope),[Ce,Fe]=Ye.useState(q.facets),[De,be]=Ye.useState(q.currentPath),[X,we]=Ye.useState(q.viewMode),[Be,bt]=Ye.useState(q.scope==="content"?"relevance":"name"),[It,Wt]=Ye.useState("all"),[zt,ft]=Ye.useState(q.density),{browserRef:tr,treeVisibility:Qt,treeVisible:Tt,toggleTreeVisibility:vn}=f_n(q.treeVisibility),[Yr,en]=Ye.useState(!1),[ii,No]=Ye.useState({path:q.currentPath,entries:[]}),[gn,En]=Ye.useState([]),[cs,On]=Ye.useState([]),ji=Ye.useSyncExternalStore(_tn,Q0e),Ja=Ye.useSyncExternalStore(OC,u0,u0),[_a,Pn]=Ye.useState(!1),[js,fa]=Ye.useState([]),[Nt,$c]=Ye.useState(new Set(q.expanded)),[Ni,Dc]=Ye.useState(0),[vc,Tf]=Ye.useState(0),[Ip,Au]=Ye.useState(""),[dl,bu]=Ye.useState(new Set),[Al,Ku]=Ye.useState(null),[pl,gs]=Ye.useState(null),[Xu,$r]=Ye.useState(""),Sl=Ye.useCallback(pr=>{$r(pr.initial),gs(pr)},[]),[Rl,mi]=Ye.useState(!1),[tu,Wc]=Ye.useState(null),[Ao,ia]=Ye.useState(null),Du=Ye.useRef(null),gp=Ye.useRef(new Map),Id=Ye.useRef("");Ye.useEffect(()=>{bve(Ajt,{scope:pe,root:G,facets:Ce,currentPath:De,viewMode:X,sort:Be,filter:It,density:zt,expanded:[...Nt],treeVisibility:Qt})},[De,G,zt,Nt,Ce,It,pe,Be,Qt,X]);const Qs=Ye.useCallback(async(pr,Ur)=>{const Ei=`${pr}:${Ur}`;Id.current=Ei;const Li=(kc,Nd)=>{Id.current===Ei&&No({path:Ur,entries:kc,...Nd===void 0?{}:{failure:Nd}})},uc=gp.current.get(Ei);if(uc){Li(uc);return}try{const kc=await t.listAssets(pr,Ur);if(!kc.ok){Li([],kc.reason);return}gp.current.set(Ei,kc.entries),Li(kc.entries)}catch(kc){Li([],kc instanceof Error?kc.message:String(kc))}},[t]);Ye.useEffect(()=>{Qs(G,De)},[G,De,Qs]);const Pu=Ye.useCallback(async()=>{Pn(!0);try{const[pr,Ur]=await Promise.all([j9t(t.listAssets),t.listProjectComponents()]),Ei=await pon(pr.assets,async Li=>{try{const uc=await fetch(`/${Li}`);return uc.ok?await uc.text():null}catch{return null}});En(Ei),On(Ur.ok?Ur.entries:[]),fa([...pr.failedListings,...Ur.ok?[]:[`component index: ${Ur.reason}`]])}catch(pr){En([]),On([]),fa([pr instanceof Error?pr.message:String(pr)])}finally{Pn(!1)}},[t]);Ye.useEffect(()=>{pe==="content"&&Pu()},[Pu,pe]);const Ls=Ye.useCallback((pr,Ur)=>{se(pr),be(Ur),bu(new Set),Wc(null),oD(),Au(""),en(!1)},[]),Ff=Ye.useCallback(pr=>{ue(pr),bt(pr==="content"?"relevance":"name"),Wt("all"),bu(new Set),Wc(null),oD()},[]),Hs=Ye.useCallback(pr=>{Fe([pr])},[]),Ds=Ye.useCallback(pr=>{en(pr),pr||Fe(Ur=>Ur.length>0?Ur:["component"])},[]),Rc=ii.path,Ze=Ye.useMemo(()=>n_n(Cm(k.current).adapter),[g,m,S]),jt=Ye.useMemo(()=>Cm(k.current).surface,[g,m,S]),mt=Ye.useMemo(()=>{if(pe==="content"){const pr=new Map(cs.map(Li=>[`${Li.path}:${Li.name}`,Li])),Ur=yin().flatMap(Li=>Li.entries({components:cs,surface:jt}).flatMap(uc=>{const kc=pr.get(`${uc.component.path}:${uc.component.name}`);if(!kc)return[];const Nd=`${kc.path.replace(/^\.\//,"")}:${kc.name}`,Lo=Ze.get(Nd);return[{source:"component",key:`component:${Li.id}:${uc.id}`,name:kc.name,path:kc.path,component:kc,contentSource:Li,contentEntry:uc,...Lo?{authoringAsset:Lo}:{}}]})),Ei=(Ja?.scenes.entries??[]).flatMap(Li=>{if(Li.kind==="prefab")return[];const uc=Li.kind==="scene"?Kze(Li):null;return uc&&ji.some(kc=>(kc.category==="scene"||kc.category==="canvas")&&(uc.kind==="root-document"&&kc.rootId===uc.regionId||uc.kind==="isolation-document"&&kc.descriptor.id===uc.documentId||!!Li.source?.path&&kc.descriptor.provenance?.sourcePath?.replace(/^\.\//,"")===Li.source.path.replace(/^\.\//,"")))?[]:Li.kind!=="scene"&&!Li.source?[]:[{source:"document",key:`document:${Li.id}`,name:Li.label,path:Li.source?.path??"",document:Li}]});return[...Ur,...Ei,...ji.map(Li=>({source:"available",key:`available:${Li.descriptor.id}`,name:Li.descriptor.title,path:Li.descriptor.provenance?.sourcePath??"",available:Li})),...gn.map(({path:Li,root:uc,entry:kc,spritesheet:Nd})=>({source:"asset",key:`asset:${uc}:${Li}`,name:kc.name,path:Li,root:uc,entry:kc,...Nd?{spritesheet:Nd}:{}}))]}return ii.entries.map(pr=>{const Ur=ii.path?`${ii.path}/${pr.name}`:pr.name;return{source:"asset",key:`asset:${G}:${Ur}`,name:pr.name,path:Ur,root:G,entry:pr}})},[jt,Ja,ji,Ze,cs,gn,D,G,ii,pe]),xt=pe==="content"?js[0]??null:ii.failure??null,xr=Ye.useMemo(()=>{const pr=Ip.toLowerCase(),Ur=mt.filter(Li=>e_n(Li,{query:pr,scope:pe,facets:Ce,filter:It,shownPath:Rc})),Ei=pe==="files"&&Be==="relevance"?"name":Be;return[...Ur].sort((Li,uc)=>Qpn(Li,uc,Ei))},[mt,Ce,Rc,It,pe,Ip,Be]),Vn=Ye.useMemo(()=>{const pr=new Set;for(const Ur of mt)pr.add(Djt(Ur));return pr},[mt]),eo=Ye.useMemo(()=>Wpn(xr,pe,Ce),[Ce,xr,pe]),bi=Ye.useCallback((pr,Ur)=>{if(Ur.source==="component"){const Lo={path:Ur.path,kind:"component",name:Ur.name,component:{kind:"component",name:Ur.component.name,sourcePath:Ur.component.path,exportKind:Ur.component.defaultExport?"default":"named",surface:Ur.component.surface}};pr.dataTransfer.setData("text/plain",Ur.name),pr.dataTransfer.setData("application/x-editor-asset",JSON.stringify(Lo));return}if(Ur.source==="document"||Ur.source==="available"){if("dataTransfer"in pr){pr.dataTransfer.setData("text/plain",Ur.path);return}return}const{entry:Ei}=Ur,Li=ig(Ei.name);if(Ur.root===nA){pr.preventDefault(),i0(`${Ei.name} is reference material. ${POe}`);return}if(Ur.spritesheet){pr.preventDefault(),i0(`${Ei.name} is one frame of the ${Ur.spritesheet.sheetPath.split("/").pop()??"sprite sheet"} sprite sheet — it is placed through the Prefab that animates it, not on its own. Drop a Prefab, or a standalone image file.`);return}if(Ei.type!=="file"||!Li.placeable){pr.preventDefault();return}const uc=FB(Li);if(!uc)return;const Nd={path:jpn(G,WO(Ur.path),Ei.name),kind:uc,name:Ei.name};pr.dataTransfer.setData("text/plain",Ei.name),pr.dataTransfer.setData("application/x-editor-asset",JSON.stringify(Nd))},[G]),ta=Ye.useCallback((pr,Ur)=>{let Ei=new Set;if(Ur.shiftKey&&tu){const Np=xr.findIndex(Rh=>Rh.key===tu),ls=xr.findIndex(Rh=>Rh.key===pr.key);if(Np>=0&&ls>=0){const[Rh,Gi]=Np<ls?[Np,ls]:[ls,Np];Ei=new Set(xr.slice(Rh,Gi+1).map(U=>U.key))}}else Ur.metaKey||Ur.ctrlKey?(Ei=new Set(dl),Ei.has(pr.key)?Ei.delete(pr.key):Ei.add(pr.key),Wc(pr.key)):(Ei.add(pr.key),Wc(pr.key));if(bu(Ei),pr.source==="component"){if(pr.component.contentKind==="image"&&pr.authoringAsset){BI({path:pr.authoringAsset.subject.sourcePath??pr.path,name:pr.name,kind:"image",capabilities:ig("svg"),health:"healthy",selectionCount:Ei.size});return}BI({path:pr.path,name:pr.name,kind:"component",health:"healthy",selectionCount:Ei.size,componentPreview:{surface:pr.component.surface,sourcePath:pr.component.path}});return}if(pr.source==="document"||pr.source==="available"){BI({path:`/${pr.path}`,name:pr.name,kind:"source",capabilities:ig(pr.name),origin:"project",health:"healthy",selectionCount:Ei.size});return}const{entry:Li}=pr;if(Li.type==="directory"){oD();return}const uc=ig(Li.name),kc=FB(uc)??"unknown",Nd=Y0e(pr.root,pr.path);if(BI({path:Nd,name:Li.name,kind:kc,...Li.size===void 0?{}:{sizeBytes:Li.size},capabilities:uc,health:Bje(Li.name),selectionCount:Ei.size,...pr.path.startsWith("asset-library/local")?{sourcePath:"Asset Library provenance metadata"}:{}}),pr.root!=="public")return;const Lo=pr.path;vpn(gR(),Lo).then(Np=>{const ls=Nd;J0e()?.path===ls&&BI({path:ls,name:Li.name,kind:kc,...Li.size===void 0?{}:{sizeBytes:Li.size},capabilities:uc,health:Np.health.status==="healthy"?"healthy":uc.runtimeReady?"unsupported":"source-only",healthCodes:Np.health.codes,dependencies:Np.dependencies,references:Np.references,selectionCount:Ei.size})}).catch(()=>{})},[xr,dl,tu]),ic=Ye.useCallback(pr=>{if(pr.source==="component"){if(pr.authoringAsset){aQr(pr.authoringAsset.id,pr.authoringAsset.subject);return}pr.contentSource.open(n,pr.contentEntry,pr.name);return}if(pr.source==="available"){SN(pr.available.descriptor.id);return}if(pr.source==="document"){if(pr.document.kind==="scene"){const Ur=kFt(pr.document.id);Ur.ok||ea.error(Ur.error,"scene");return}ID(pr.document)||sN(`/${pr.path}`,TFt(pr.document));return}Gpn(pr,{currentRoot:G,currentPath:pr.source==="asset"?WO(pr.path):"",navigate:Ls,openAsset:(Ur,Ei)=>sN(Ur,Ei)})},[G,Ls,n]),Ps=Ye.useCallback(pr=>{if(Dc(Ur=>Ur+1),gp.current.clear(),pr?.length)for(const Ur of pr)tTt(Ur);else tTt();Tf(Ur=>Ur+1),Qs(G,De),pe==="content"&&Pu()},[G,De,Pu,Qs,pe]);Ye.useEffect(()=>{const pr=Ur=>Ps(Ur.detail?.paths);return window.addEventListener("editor:assets-changed",pr),()=>window.removeEventListener("editor:assets-changed",pr)},[Ps]),Ye.useEffect(()=>{const pr=Ur=>{const Ei=Ur.detail?.path;if(!Ei)return;const Li=ig(Ei),uc=FB(Li);uc&&sN(Ei,uc)};return window.addEventListener("editor:open-project-asset",pr),()=>window.removeEventListener("editor:open-project-asset",pr)},[n]);const Iu=Ye.useMemo(()=>mt.filter(pr=>dl.has(pr.key)),[mt,dl]),zi=Ye.useMemo(()=>Iu.flatMap(pr=>pr.source==="asset"&&pr.entry.type==="file"&&pr.root==="public"?[pr.path]:[]),[Iu]),Jn=Ye.useMemo(()=>Iu.flatMap(pr=>pr.source==="asset"&&pr.entry.type==="file"?[Dge(pr.root,pr.path)]:[]),[Iu]);Ye.useEffect(()=>{const pr=new Set(mt.map(Ur=>Ur.key));bu(Ur=>{const Ei=new Set([...Ur].filter(Li=>pr.has(Li)));return Ur.size>0&&Ei.size===0&&(Wc(null),oD()),Ei.size===Ur.size?Ur:Ei})},[mt]);const Cs=Ye.useCallback(async pr=>{await bpn(pr,{backend:gR(),history:A}),gp.current.clear(),G==="public"&&await Qs(G,De),pe==="content"&&await Pu()},[De,G,Pu,Qs,A,pe]),lc=Ye.useCallback(async()=>{zi.length!==0&&Zdn("delete",`Delete ${zi.length} selected asset(s)? This is undoable.`)&&(await Cs({type:"delete",paths:zi}),bu(new Set),Wc(null),oD())},[Cs,zi]),Nu=Ye.useCallback(()=>{zi.length!==0&&Sl({title:`Move ${zi.length} selected to folder`,initial:De,confirmLabel:"Move",run:async pr=>{const Ur=pr.replace(/^\/+|\/+$/g,"");Ku(null);try{await Cs({type:"move-many",moves:zi.map(Ei=>({source:Ei,destination:Ur?`${Ur}/${Ei.split("/").pop()}`:Ei.split("/").pop()}))})}catch(Ei){Ku(Ei instanceof Error?Ei.message:String(Ei))}}})},[Sl,De,Cs,zi]),Fl=Ye.useCallback(()=>{G==="public"&&Sl({title:"New folder name",initial:"",confirmLabel:"Create",run:async pr=>{pr&&await Cs({type:"create-folder",path:De?`${De}/${pr}`:pr})}})},[Sl,De,G,Cs]),Yu=Ye.useCallback(async pr=>{if(!pr||pr.length===0)return;const Ur=pe==="content"||G!=="public"?"":De,Ei=await Promise.all([...pr].map(async Li=>({path:Ur?`${Ur}/${Li.name}`:Li.name,bytes:new Uint8Array(await Li.arrayBuffer())})));Ku(null);try{await Cs({type:"import",files:Ei})}catch(Li){Ku(`Could not import ${Ei.length===1?Ei[0]?.path:`${Ei.length} files`}: ${Li instanceof Error?Li.message:String(Li)}`);return}pe==="content"&&Ff("files"),Ls("public",Ur),i0(Ei.length===1?`Imported ${Ei[0]?.path}`:`Imported ${Ei.length} files`)},[Ff,De,G,Cs,Ls,pe]),Pe=Ye.useCallback(pr=>{if(!(pr.source!=="asset"||pr.entry.type!=="file")){if(pr.root!=="public"){i0(`${pr.name} is reference material. ${POe}`);return}Sl({title:`Rename ${pr.name}`,initial:pr.name,confirmLabel:"Rename",run:async Ur=>{if(!Ur||Ur===pr.name)return;const Ei=pr.path,Li=WO(pr.path),uc=Li?`${Li}/${Ur}`:Ur;await Cs({type:"move",source:Ei,destination:uc})}})}},[Sl,Cs]),Et=Ye.useCallback(async pr=>{if(pr.source!=="asset"||pr.entry.type!=="file")return;if(pr.root!=="public"){i0(`${pr.name} is reference material. ${POe}`);return}const Ur=pr.name.lastIndexOf("."),Ei=Ur>0?`${pr.name.slice(0,Ur)} copy${pr.name.slice(Ur)}`:`${pr.name} copy`,Li=pr.path,uc=WO(pr.path),kc=uc?`${uc}/${Ei}`:Ei;await Cs({type:"duplicate",source:Li,destination:kc})},[Cs]),Nr=Ye.useCallback(pr=>{$c(Ur=>{const Ei=new Set(Ur);return Ei.has(pr)?Ei.delete(pr):Ei.add(pr),Ei})},[]);Ye.useEffect(()=>{const pr=Ur=>{const Ei=Ur.detail?.id,Li=Iu[0];Ei===O_.refresh.id?Ps():Ei===O_.import.id?Du.current?.click():Ei===O_.createFolder.id?Fl():Ei===O_.move.id?Nu():Ei===O_.delete.id?lc():Ei===O_.rename.id&&Li?Pe(Li):Ei===O_.duplicate.id&&Li?Et(Li):Ei===O_.copyPath.id&&Jn[0]?navigator.clipboard.writeText(Jn[0]):Ei===O_.reveal.id&&Jn[0]&&bMe(Jn[0])};return window.addEventListener("editor:project-asset-command",pr),()=>window.removeEventListener("editor:project-asset-command",pr)},[Fl,De,lc,Et,Nu,Ps,Pe,Iu,Jn]);const In=Ao?.item.source==="available"&&Ao.item.available.descriptor.preview?Ao.item:null;return $.jsxs("div",{ref:tr,className:"volter-asset-browser","data-tree-visible":pe==="files"&&Tt,onPointerDown:()=>CR("asset-browser"),onKeyDown:pr=>{if(!uje(pr.target)){if(pr.key==="Delete"||pr.key==="Backspace")lc(),pr.preventDefault();else if((pr.metaKey||pr.ctrlKey)&&pr.key.toLowerCase()==="d"){const Ur=Iu[0];Ur&&Et(Ur),pr.preventDefault()}else if(pr.key==="F2"){const Ur=Iu[0];Ur&&Pe(Ur),pr.preventDefault()}}},onDragOver:pr=>{G!=="public"||!pr.dataTransfer.types.includes("Files")||(pr.preventDefault(),pr.dataTransfer.dropEffect="copy",Rl||mi(!0))},onDragLeave:pr=>{pr.currentTarget.contains(pr.relatedTarget)||mi(!1)},onDrop:pr=>{G!=="public"||!pr.dataTransfer.types.includes("Files")||(pr.preventDefault(),mi(!1),Yu(pr.dataTransfer.files))},style:{display:"flex",flex:1,minHeight:0,position:"relative",...Rl?{outline:`2px dashed ${Go.accent.default}`,outlineOffset:-2}:{}},children:[$.jsx(u_n,{currentRoot:G,currentPath:De,expanded:Nt,hidden:pe!=="files"||!Tt,revision:Ni,loadAssets:t.listAssets,onExpanded:Nr,onNavigate:Ls}),$.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,minHeight:0},children:[$.jsx(Zm,{ref:Du,type:"file",multiple:!0,"aria-label":"Import project assets",hidden:!0,onChange:pr=>{Yu(pr.target.files),pr.currentTarget.value=""}}),$.jsx(l_n,{availableFacets:Vn,scope:pe,facets:Ce,currentPath:De,currentRoot:G,searchOpen:Yr,searchQuery:Ip,viewMode:X,density:zt,treeVisible:Tt,onScopeChange:Ff,onFacetToggle:Hs,onFacetsClear:()=>Fe([]),onNavigate:Ls,onSearchOpenChange:Ds,onSearchQueryChange:Au,onViewModeChange:we,onDensityChange:ft,onTreeVisibilityToggle:vn,onCreateFolder:()=>void Fl(),onImport:()=>Du.current?.click(),onDelete:()=>void lc(),deleteDisabled:zi.length===0,onRefresh:Ps,generationTools:J,onGenerate:()=>{CD("generation",n,{kind:"generation",id:"create"})}}),Al&&$.jsx("div",{role:"alert",className:"volter-asset-operation-error",children:Al}),pl&&$.jsxs("form",{className:"volter-asset-inline-prompt",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 8px"},onSubmit:pr=>{pr.preventDefault();const Ur=pl;gs(null),Ur.run(Xu.trim())},children:[$.jsx("span",{style:{fontSize:12},children:pl.title}),$.jsx(Zm,{autoFocus:!0,"aria-label":pl.title,value:Xu,onChange:pr=>$r(pr.target.value),onKeyDown:pr=>{pr.key==="Escape"&&gs(null)}}),$.jsx(Ms,{type:"submit",size:"compact",children:pl.confirmLabel}),$.jsx(Ms,{type:"button",variant:"ghost",size:"compact",onClick:()=>gs(null),children:"Cancel"})]}),zi.length>0&&$.jsxs(n$,{label:"Selected asset actions",compact:!0,children:[$.jsxs("span",{children:[zi.length," selected"]}),$.jsx(Ms,{variant:"ghost",size:"compact",onClick:()=>void Nu(),children:"Move selected"}),$.jsx(Ms,{variant:"ghost",size:"compact","aria-label":"Delete selected assets",onClick:()=>void lc(),children:"Delete"})]}),$.jsxs("div",{className:"volter-project-assets-results","data-view":X,"data-testid":"project-asset-results",role:"listbox","aria-label":pe==="content"?"Project content":"Project files","aria-multiselectable":"true",style:{flex:1,overflowY:"auto",padding:8,display:X==="list"?"flex":"grid",gridTemplateColumns:X==="grid"?`repeat(auto-fill, minmax(${Math.round(zt*.75)}px, 1fr))`:void 0,gridAutoRows:X==="list"?void 0:"min-content",flexDirection:X==="list"?"column":void 0,gap:X==="list"?1:6,alignContent:"start"},children:[eo.map(pr=>$.jsxs("div",{role:"group","aria-label":pr.label??void 0,className:"volter-content-result-section",children:[pr.label&&$.jsx("div",{role:"presentation",className:"volter-content-section-heading","data-level":pr.headingLevel??void 0,"data-testid":`content-section-${pr.id}`,children:$.jsx("span",{children:pr.label})}),pr.entries.map(Ur=>$.jsx(c_n,{item:Ur,selected:dl.has(Ur.key),onDragStart:bi,onSelect:ta,onOpen:ic,onContextMenu:(Ei,Li)=>{Ei.preventDefault(),Li.source!=="component"&&(dl.has(Li.key)||ta(Li,Ei),ia({x:Ei.clientX,y:Ei.clientY,item:Li}))},viewMode:X,previewRevision:vc,showPath:pe==="content"},Ur.key))]},pr.id)),xr.length===0&&$.jsx(jTr,{compact:!0,style:{gridColumn:"1 / -1"},icon:$.jsx(dc,{icon:xt?Kk.status.warning:Ip?Kk.action.search:Kk.content.folder}),title:_a?"Finding project content…":xt?"Listing failed":Ip?"No matching content":pe==="content"?"No content in this type":"Empty folder",description:_a?"Scanning components and assets across the project.":xt?`Listing failed: ${xt}`:Ip?"Try a broader search or another content type.":pe==="content"?"Choose another type or import an asset.":"Add files to this folder to see them here."})]})]}),In&&Ao&&$.jsx(rhe,{children:$.jsxs(fN,{autoFocusFirst:!0,className:"volter-asset-context-menu",style:{left:Ao.x,top:Ao.y},onDismiss:()=>ia(null),children:[$.jsxs(Nc,{type:"button",role:"menuitem",onClick:()=>{ic(In),ia(null)},children:["Open ",$.jsx("kbd",{children:"Enter"})]}),In.available.category==="scene"&&$.jsxs($.Fragment,{children:[$.jsx(Nc,{type:"button",role:"menuitem",onClick:()=>{const pr=In.available.descriptor.id;ia(null),oTt(pr,!1).then(()=>Tf(Ur=>Ur+1)).catch(Ur=>Ku(Ur instanceof Error?Ur.message:String(Ur)))},children:"Use current view for preview"}),$.jsx(Nc,{type:"button",role:"menuitem",onClick:()=>{const pr=In.available.descriptor.id;ia(null),oTt(pr,!0).then(()=>Tf(Ur=>Ur+1)).catch(Ur=>Ku(Ur instanceof Error?Ur.message:String(Ur)))},children:"Reset preview view"})]}),$.jsx(Nc,{type:"button",role:"menuitem",onClick:()=>{ia(null),Tf(pr=>pr+1)},children:"Refresh preview"})]})}),Ao&&Ao.item.source==="asset"&&$.jsx(rhe,{children:$.jsxs(fN,{autoFocusFirst:!0,className:"volter-asset-context-menu",style:{left:Ao.x,top:Ao.y},onDismiss:()=>ia(null),children:[$.jsxs(Nc,{type:"button",role:"menuitem","data-command-id":O_.open.id,onClick:()=>{ic(Ao.item),ia(null)},children:["Open ",$.jsx("kbd",{children:"Enter"})]}),$.jsxs(Nc,{type:"button",role:"menuitem","data-command-id":O_.rename.id,onClick:()=>{Pe(Ao.item),ia(null)},children:["Rename ",$.jsx("kbd",{children:"F2"})]}),$.jsxs(Nc,{type:"button",role:"menuitem","data-command-id":O_.duplicate.id,onClick:()=>{Et(Ao.item),ia(null)},children:["Duplicate ",$.jsx("kbd",{children:"⌘D"})]}),$.jsx(Nc,{type:"button",role:"menuitem","data-command-id":O_.move.id,disabled:zi.length===0,title:zi.length?"Move selected assets":"Select a file to move",onClick:()=>{Nu(),ia(null)},children:"Move selected…"}),$.jsx(Nc,{type:"button",role:"menuitem","data-command-id":O_.copyPath.id,disabled:!Jn[0],onClick:()=>{Jn[0]&&navigator.clipboard.writeText(Jn[0]),ia(null)},children:"Copy path"}),uLe("asset").map(pr=>{const Ur=Ao.item.source==="asset"&&Ao.item.entry.type==="file",Ei=Ao.item.source==="asset"?{assetPath:Dge(Ao.item.root,Ao.item.path)}:{};return $.jsx(Nc,{type:"button",role:"menuitem","data-testid":pr.testId,disabled:!Ur||(pr.disabled?.(Ei)??!1),onClick:()=>{pr.execute(Ei),ia(null)},children:typeof pr.label=="function"?pr.label():pr.label},pr.id)}),$.jsx(Nc,{type:"button",role:"menuitem","data-command-id":O_.reveal.id,disabled:!Jn[0],onClick:()=>{Jn[0]&&bMe(Jn[0]),ia(null)},children:"Reveal in Finder"}),$.jsxs(Nc,{type:"button",role:"menuitem","data-command-id":O_.delete.id,disabled:zi.length===0,onClick:()=>{lc(),ia(null)},children:["Delete ",$.jsx("kbd",{children:"⌫"})]})]})})]})}const p_n={agent:()=>$.jsx(Cme,{slot:"panel:agent"}),"project-work":()=>$.jsx(Cme,{slot:"panel:project-work"}),hierarchy:vjt,assets:({dependencies:t})=>$.jsx(d_n,{services:t?.assets}),"asset-library":()=>$.jsx(Cme,{slot:"panel:asset-library"}),inspector:GVe};class __n extends Ye.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){ea.error(`The ${this.props.title} panel crashed and was taken down alone (the rest of the editor stays up; Retry in the panel remounts it): ${n.message}
1409
- ${s.componentStack??""}`,"editor")}render(){return this.state.error?$.jsxs("div",{role:"alert","data-testid":"static-panel-crashed",style:{padding:12,display:"grid",gap:8,alignContent:"start"},children:[$.jsxs("strong",{children:[this.props.title," crashed."]}),$.jsx("span",{style:{opacity:.8,wordBreak:"break-word"},children:this.state.error.message}),$.jsx("div",{children:$.jsx(Ms,{type:"button",variant:"outline",size:"compact",onClick:()=>this.setState({error:null}),children:"Retry"})})]}):this.props.children}}const m_n=wVe.map(t=>{const n=p_n[t.kind],s=c=>$.jsx(__n,{title:t.title,children:$.jsx(n,{...c})});return s.displayName=`StaticPanel(${t.kind})`,{...t,Content:s}});function h_n(t){return m_n.find(n=>n.kind===t)}function g_n({kind:t,dependencies:n}){const{Content:s}=h_n(t);return $.jsx(s,{dependencies:n})}const y_n=250;function v_n(){const t=D4t(),n=b_n();return()=>{n(),t()}}function b_n(){const t=new Map;let n=null,s=!1;function c(){const g=[],S=new Set;for(const k of ea.getEntries()){if(S.add(k.id),k.level!=="error"&&k.level!=="warn")continue;const A=t.get(k.id)??0;k.count<=A||(t.set(k.id,k.count),g.push({severity:k.level,message:k.message,source:k.source??null,occurrences:k.count-A}))}for(const k of[...t.keys()])S.has(k)||t.delete(k);return g}function d(){if(n=null,s)return;const g=c();g.length!==0&&bN("console-entries",{entries:g,_clientId:wC})}const m=ea.subscribe(()=>{if(s)return;const g=ea.getEntries(),S=g[g.length-1];if(S&&S.level==="error"&&!t.has(S.id)){n!==null&&clearTimeout(n),n=null,queueMicrotask(d);return}n===null&&(n=setTimeout(d,y_n))});return bN("console-entries",{entries:[],_clientId:wC}),d(),()=>{s=!0,n!==null&&clearTimeout(n),m()}}const Y4={INPUT:"input",PRE_PHYSICS:"prePhysics",PHYSICS:"physics",POST_PHYSICS:"postPhysics",GAME_LOGIC:"gameLogic",ANIMATION:"animation",PRE_RENDER:"preRender",RENDER:"render"},yZ=[Y4.INPUT,Y4.PRE_PHYSICS,Y4.PHYSICS,Y4.POST_PHYSICS,Y4.GAME_LOGIC,Y4.ANIMATION,Y4.PRE_RENDER,Y4.RENDER],ewn=Object.freeze(Object.defineProperty({__proto__:null,PHASE_ORDER:yZ,SystemPhase:Y4},Symbol.toStringTag,{value:"Module"})),tye=1e-9,Ijt=1e5;function S_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>tye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=s.end-g;if(!d||S<=F+tye){const D=Math.min(g+S,s.end);m.push({from:g,to:D,direction:"forward"}),g=D;break}if(m.push({from:g,to:s.end,direction:"forward"}),S-=F,g=s.start,k=!0,A++,A>Ijt){const D=s.start+S%c;m.push({from:g,to:D,direction:"forward"}),g=D;break}}return{pos:g,intervals:m,looped:k}}function x_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>tye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=g-s.start;if(!d||S<=F+tye){const D=Math.max(g-S,s.start);m.push({from:g,to:D,direction:"reverse"}),g=D;break}if(m.push({from:g,to:s.start,direction:"reverse"}),S-=F,g=s.end,k=!0,A++,A>Ijt){const D=s.end-S%c;m.push({from:g,to:D,direction:"reverse"}),g=D;break}}return{pos:g,intervals:m,looped:k}}function cTt(t,n){return t<n.start?n.start:t>n.end?n.end:t}class w_n{_previousTime;_currentTime;_range;_timeScale;_playDirection="forward";_lastCrossingDirection="forward";_playbackState="stopped";_evaluators=[];_registrationCounter=0;constructor(n={}){const s=n.start??0,c=n.end??Math.max(s,1);if(c<s)throw new Error(`[AnimationClock] range end (${c}) must be >= start (${s})`);const d=n.timeScale??1;if(!Number.isFinite(d)||d<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${d}`);this._range={start:s,end:c,loop:n.loop??!1},this._timeScale=d,this._previousTime=s,this._currentTime=s}get time(){return this._currentTime}get previousTime(){return this._previousTime}get direction(){return this._playbackState==="playing"?this._playDirection:"paused"}get playbackState(){return this._playbackState}get timeScale(){return this._timeScale}set timeScale(n){if(!Number.isFinite(n)||n<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${n}`);this._timeScale=n}get range(){return this._range}setRange(n){const s=n.start??this._range.start,c=n.end??this._range.end,d=n.loop??this._range.loop;if(c<s)throw new Error(`[AnimationClock] range end (${c}) must be >= start (${s})`);this._range={start:s,end:c,loop:d};const m=cTt(this._currentTime,this._range);m!==this._currentTime&&this.seek(m)}play(n){n&&(this._playDirection=n),this._playbackState="playing"}pause(){this._playbackState="paused"}stop(){this._playbackState="stopped"}seek(n){const s=cTt(n,this._range);if(s===this._currentTime)return this.emit(this._currentTime,this._currentTime,[{from:s,to:s,direction:this._lastCrossingDirection}],!1,this._lastCrossingDirection);const c=s>this._currentTime?"forward":"reverse",d=this._currentTime;return this._previousTime=d,this._currentTime=s,this._lastCrossingDirection=c,this.emit(d,s,[{from:d,to:s,direction:c}],!1,c)}seekFrame(n,s){if(!Number.isFinite(s)||s<=0)throw new Error(`[AnimationClock] seekFrame fps must be a finite number > 0, got ${s}`);return this.seek(this._range.start+n/s)}advance(n){if(this._playbackState!=="playing")return null;if(!Number.isFinite(n))throw new Error(`[AnimationClock] advance(dt) requires a finite dt, got ${n}`);const s=Math.abs(n)*this._timeScale,c=this._currentTime;if(s===0)return this.emit(c,c,[],!1,this._playDirection);const d=this._playDirection==="forward"?S_n(c,s,this._range):x_n(c,s,this._range);return this._previousTime=c,this._currentTime=d.pos,this._lastCrossingDirection=this._playDirection,this.emit(c,d.pos,d.intervals,d.looped,this._playDirection)}subscribe(n,s){if(!yZ.includes(n))throw new Error(`[AnimationClock] unknown phase "${n}". Valid: ${yZ.join(", ")}`);const c={phase:n,order:this._registrationCounter++,fn:s};return this._evaluators.push(c),{dispose:()=>{const d=this._evaluators.indexOf(c);d!==-1&&this._evaluators.splice(d,1)}}}emit(n,s,c,d,m){const g={previousTime:n,currentTime:s,direction:m,timeScale:this._timeScale,looped:d,intervals:c};if(this._evaluators.length>0){const S=[...this._evaluators].sort((k,A)=>{const F=yZ.indexOf(k.phase),D=yZ.indexOf(A.phase);return F!==D?F-D:k.order-A.order});for(const k of S)try{k.fn(g)}catch(A){console.error(`[AnimationClock] evaluator in phase "${k.phase}" threw:`,A)}}return g}}const v_e={start:0,end:0,fps:30},T_n=150;class twn{constructor(n){this.store=n,this.stopStoreWatch=n.subscribe(()=>this.notify())}clock=new w_n;subjects=[];activeId=null;listeners=new Set;settleListeners=new Set;settleTimer=null;disposed=!1;cachedSnapshot=null;stopStoreWatch;attach(n){return this.subjects.push(n),this.activeId===null?this.setActiveSubject(n.id):(n.seek(this.clock.time),this.notify()),()=>{const s=this.subjects.indexOf(n);if(s<0)return;if(this.subjects.splice(s,1),this.activeId!==n.id){this.notify();return}this.activeId=null;const c=this.subjects[0];c?this.setActiveSubject(c.id):(this.clock.setRange({start:v_e.start,end:v_e.end,loop:!1}),this.notify())}}setActiveSubject(n){const s=this.subjects.find(d=>d.id===n);if(!s)return;this.activeId=n;const c=s.range();this.clock.setRange({start:c.start,end:c.end}),this.applyTime(this.clock.time),this.notify()}get active(){return this.subjects.find(n=>n.id===this.activeId)??null}fps(){return this.active?.range().fps??v_e.fps}get driver(){return this.store.playState==="stopped"?"editor":"world"}assertEditorDrives(){if(this.driver==="world")throw new Error("transport: the world is driving time (Play); pause the game to scrub")}play(n="forward"){this.assertEditorDrives(),this.active&&(this.cancelSettle(),this.clock.play(n),this.notify())}pause(){this.assertEditorDrives(),this.clock.pause(),this.cancelSettle(),this.settle(),this.notify()}stop(){this.assertEditorDrives(),this.clock.pause(),this.cancelSettle(),this.applyTime(this.clock.seek(this.clock.range.start).currentTime),this.clock.stop(),this.settle(),this.notify()}seek(n){this.assertEditorDrives(),this.applyTime(this.clock.seek(n).currentTime),this.clock.playbackState!=="playing"&&this.scheduleSettle(),this.notify()}seekFrame(n){this.seek(n/this.fps())}setLoop(n){this.clock.setRange({loop:n}),this.notify()}setTimeScale(n){this.clock.timeScale=n,this.notify()}tick(n){if(this.disposed||this.driver==="world"||this.clock.playbackState!=="playing")return 0;const s=this.clock.time,c=this.clock.advance(n);return c?(this.applyTime(c.currentTime),this.notify(),c.looped?Math.abs(n)*this.clock.timeScale:c.currentTime-s):0}applyTime(n){const s=this.active;s&&s.seek(n);for(const c of this.subjects)c!==s&&c.seek(n)}onSettled(n){return this.settleListeners.add(n),()=>{this.settleListeners.delete(n)}}scheduleSettle(){this.cancelSettle(),this.settleTimer=setTimeout(()=>{this.settleTimer=null,this.settle()},T_n)}cancelSettle(){this.settleTimer!==null&&(clearTimeout(this.settleTimer),this.settleTimer=null)}settle(){if(this.disposed)return;const n=this.clock.time;for(const s of[...this.settleListeners])s(n)}snapshot(){const n=this.cachedSnapshot;if(n)return n;const s=this.active?.range()??v_e,c={time:this.clock.time,range:{start:this.clock.range.start,end:this.clock.range.end,fps:s.fps,loop:this.clock.range.loop},playbackState:this.clock.playbackState,timeScale:this.clock.timeScale,activeSubject:this.activeId,subjects:this.subjects.map(d=>({id:d.id,label:d.label})),driver:this.driver};return this.cachedSnapshot=c,c}activeClips(){const s=this.active?.clips?.();return s&&s.length>1?s:null}setActiveClip(n){this.assertEditorDrives(),this.active?.setClip?.(n);const s=this.active?.range();s&&this.clock.setRange({start:s.start,end:s.end}),this.applyTime(this.clock.time),this.notify()}subscribe(n){return this.listeners.add(n),()=>{this.listeners.delete(n)}}notify(){this.cachedSnapshot=null;for(const n of[...this.listeners])n()}dispose(){this.disposed=!0,this.stopStoreWatch(),this.cancelSettle(),this.clock.stop(),this.subjects.length=0,this.activeId=null,this.listeners.clear(),this.settleListeners.clear()}}const Eme=new Map,$je=new Set;function lTt(){for(const t of[...$je])t()}function rwn(t,n){return Eme.set(t,n),lTt(),()=>{Eme.get(t)===n&&(Eme.delete(t),lTt())}}function C_n(t){return t===null?null:Eme.get(t)??null}function E_n(t){return $je.add(t),()=>{$je.delete(t)}}let kme=null;function nwn(t){return kme=t,()=>{kme===t&&(kme=null)}}function xve(){return kme}const Njt="__volterWorkspacePersistenceSuppressed";function Ojt(){return globalThis}function Rjt(t){Ojt()[Njt]=t}function k_n(){return Ojt()[Njt]===!0}function Fjt(){return(See()?.immersivePlay??!1)&&!NR().play?.keepPanelsVisible}const Mjt={phase:"idle",flightDone:!1,gameReady:!1};function A_n(t,n){const s=t.flightDone||n==="flight-done",c=t.gameReady||n==="game-ready";return s&&c?{phase:"crossfade",flightDone:s,gameReady:c}:s?{phase:"holding",flightDone:s,gameReady:c}:{...t,flightDone:s,gameReady:c}}function D_n(t,n){if(n==="stop")return Mjt;switch(t.phase){case"idle":return n==="start"?{phase:"entering",flightDone:!1,gameReady:!1}:n==="start-reduced"?{phase:"playing",flightDone:!0,gameReady:!0}:t;case"entering":return A_n(t,n);case"holding":return n==="game-ready"?{...t,phase:"crossfade",gameReady:!0}:t;case"crossfade":return n==="crossfade-done"?{...t,phase:"playing"}:t;case"playing":return t}}const P_n=450,I_n=220,jjt=250;function N_n(t){t.style.setProperty("--volter-play-dissolve-duration",`${P_n}ms`),t.style.setProperty("--volter-play-materialize-duration",`${I_n}ms`),t.style.setProperty("--volter-play-crossfade-duration",`${jjt}ms`)}let SD=null;function O_n(t){return SD=t,typeof document<"u"&&N_n(document.documentElement),()=>{SD===t&&(SD=null)}}function Ljt(){return typeof window<"u"&&(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1)}let Qk=null;function R_n(){return Qk?.state.phase??"idle"}const Ame=new Set;function Bjt(){if(Ame.size===0)return;const t=[...Ame];Ame.clear();for(const n of t)n()}function F_n(t){if(!Qk||Qk.state.phase==="playing"){t();return}Ame.add(t)}function M_n(t,n,s){const c=setTimeout(()=>{t.timeouts.delete(c),s()},n);t.timeouts.add(c)}function gB(t){const n=Qk;if(!n)return;const s=n.state,c=D_n(s,t);c!==s&&(n.state=c,c.phase==="crossfade"&&s.phase!=="crossfade"&&(SD?.root.classList.add("volter-play-crossfade"),M_n(n,jjt+30,()=>gB("crossfade-done"))),c.phase==="playing"&&s.phase!=="playing"&&(SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),n.flying&&xve()?.settle(),Bjt()))}function j_n(){L_n({immersive:Fjt()})}function L_n(t){if(Qk&&oUe(),!t.immersive)return;const n=Ljt();Rjt(!0);const s={state:Mjt,reducedMotion:n,flying:!1,timeouts:new Set};if(Qk=s,SD?.hideChrome(!n),n){gB("start-reduced");return}if(gB("start"),s.flying=xve()?.begin(()=>{Qk===s&&gB("flight-done")})??!1,!s.flying){gB("flight-done");return}SD?.root.classList.add("volter-play-flight")}function B_n(t,n){(!t||!n)&&oUe()}function $_n(t){const n=Qk;n&&(n.flying&&t&&xve()?.track(t),gB("game-ready"))}function oUe(){const t=Qk;if(t){Qk=null;for(const n of t.timeouts)clearTimeout(n);t.timeouts.clear(),Bjt(),SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),t.flying&&xve()?.end(),SD?.showChrome(!Ljt()),Rjt(!1)}}const qje=new Set;let $jt=null;function qjt(){return of()?.rootPath??null}function q_n(t){qje.add(t);const n=qjt();return n!==null&&$jt===n&&t(),()=>{qje.delete(t)}}async function iwn(){$jt=qjt();for(const t of[...qje])await t()}function z_n(){const t=e_();if(t===null)return null;const n=cQ(t);if(typeof n!="object"||n===null)return null;const s=n.stageMode;if(typeof s!="function")return null;const c=s.call(n);return typeof c=="string"?c:null}let zje=null;function V_n(t){zje=t}function uTt(){if(!zje)throw new Error("The workbench Output service is not connected.");return zje}function U_n(){eDr(e_),e4r({output:{write:(...t)=>uTt().write(...t),show:t=>uTt().show(t)},console:{log:(t,n)=>ea.log(t,n),warn:(t,n)=>ea.warn(t,n),error:(t,n)=>ea.error(t,n)},live:{register:QFt,mounted:_Ve,playing:rve,runWindow:aVe,restartRequired:XFt,restart:YFt,subscribe:hVe,version:t9t,notifyChanged:KFt,snapshotFrame:lVe,frameCanvas:cVe,authoringRefusal:pVe,dispatch:uVe,scenes:fVe,surface:tve,coverage:dVe},viewport:{transition:{begin:j_n,ready:$_n,end:oUe,onSettled:F_n,phase:R_n}},hierarchy:{subscribe:t=>{const n=o_e(t),s=Ih()?.subscribe(t);return()=>{n(),s?.()}},version:()=>{const t=Ih();return t?.getShellSnapshot?.()??t?.getSnapshot()??0}},session:{beginWork:wBe,reportFacet:$rn,onSample:Tnn,onCommandDispatched:jYr,playState:()=>Ih()?.playState??"stopped",playEditRegime:()=>Ih()?.playEditRegime??null,subscribe:t=>{const n=o_e(t),s=Ih()?.subscribe(t);return()=>{n(),s?.()}},version:()=>{const t=Ih();return t?.getShellSnapshot?.()??t?.getSnapshot()??0},open:()=>Ih()!==null,onEnded:t=>Oze(n=>{n!==null&&t()}),onBeforeClose:rnn,reportWorkerCallMeter:Wsn},project:{documentTable:Fen,mounts:l$,engineVersion:()=>of()?.config.engine.version??null,subscribe:Rw,onReady:q_n},notify:t=>s$(t),systems:{inspected:Cye,subscribe:Bwr,inspectedNetworking:Vwr,subscribeNetworking:Uwr,inspectedAudio:()=>Jwr()??null,subscribeAudio:Wwr,audioVersion:Hwr},availability:{subscribe:HVe,version:Eun},workspace:{showUtility:bC,openContributedDocument:t=>tA(t),open:async t=>await Wye(t.kind,Ih()??{},t)!==null,liveDocument:{id:a0,register:ctn,acquire:dtn,release:Zze,open:iq,container:ltn,setContainer:utn,releaseContainer:ftn}},documents:{activeId:e_,active:()=>{const t=CC();return t?{id:t.descriptor.id,kind:t.descriptor.kind,title:t.title}:null},subscribe:i2,version:X1,context:cQ,waitForContext:p4t,contextChanged:UCr,captureActive:t=>{const n=Ih();return n?h9t(n,t):Promise.reject(new Error("No editor session is open to capture a document from."))}},transport:{for:t=>C_n(t),subscribe:E_n},projectLocalState:{ready:lte,read:vve,write:bve,projectRootPath:()=>of()?.rootPath??null},history:{record:QPt,setDelegate:Z4r,onElement:rDr,invalidate:nDr,onInvalidated:iDr,changed:Q4r,elements:tDr,focusedResource:()=>{const t=CC();if(!t)return null;const n=t.descriptor.provenance?.sourcePath;if(n)return n;const s=Ih();return s?OYr(s)??Dze(s):null},undo:()=>Ih()?.projectHistory?.undo()??Promise.resolve(!1),redo:()=>Ih()?.projectHistory?.redo()??Promise.resolve(!1),canUndo:()=>Ih()?.projectHistory?.getSnapshot().canUndo??!1,canRedo:()=>Ih()?.projectHistory?.getSnapshot().canRedo??!1,undoLabel:()=>Ih()?.projectHistory?.getSnapshot().undoLabel??null,redoLabel:()=>Ih()?.projectHistory?.getSnapshot().redoLabel??null,subscribe:t=>{const n=ZPt(t),s=o_e(t),c=Ih()?.projectHistory?.subscribe(t),d=i2(t);return()=>{n(),s(),c?.(),d()}}},files:{setProvider:E4r,read:t=>Ag.read(t),readBytes:t=>Ag.readBytes(t),write:(t,n)=>Ag.write(t,n),exists:t=>Ag.exists(t),list:t=>Ag.list(t),watch:t=>Ag.watch(t)},settings:{setProvider:CEr,get:IEr,set:OEr,inspect:U4t,subscribe:t=>{const n=$4t(t),s=bee(t);return()=>{n(),s()}}},keyboard:{actions:()=>Fan().map(({id:t,scope:n})=>({id:t,scope:n})),keymaps:()=>W4t().map(({id:t,title:n})=>({id:t,title:n,chords:Z4t(t)})),activeKeymap:dR,invoke:t=>RVe(t),subscribe:t=>{const n=jan(t),s=Uye(t),c=o_e(t),d=Ih()?.subscribe(t),m=i2(t);return()=>{n(),s(),c(),d?.(),m()}},version:()=>Man()+X1(),stage:()=>{const t=Ih();return t?{surface:Rfn(t).surface,mode:z_n()}:{surface:null,mode:null}},bindActions:Uan,chordsFor:OBe,shortcutFor:t=>Vv(t)??null}})}let J_n=0,cee=null;const Vje=new Set;function fTt(t){const n={generation:++J_n,promise:t,active:!0};cee=n;for(const s of Vje)s(n);return Vje.clear(),n}function W_n(){const t=cee;return t?.active?Promise.resolve(t):new Promise(n=>Vje.add(n))}async function sUe(){for(;;){const t=await W_n();if(await t.promise,cee===t&&t.active)return}}const zjt=16,H_n=300,G_n=1e4,Vjt="workspace";function K_n(){const t=vve(Vjt);return!t||t.version!==zjt?null:t}function X_n(t){bve(Vjt,t)}function Y_n(t){const{descriptor:n}=t;if(!n.persist)return null;let s;try{s=n.persist({id:n.id,title:t.title})}catch{return null}if(s==null)return null;const c=SAr(n.id);return{kind:n.kind,id:n.id,state:s,...Object.keys(c).length>0?{presentation:c}:{}}}function Z_n(){const t={};let n=!1;for(const s of lDt()){if(!s.persistKindState)continue;let c;try{c=s.persistKindState()}catch{continue}c!=null&&(t[s.kind]=c,n=!0)}return n?t:void 0}function Q_n(){const t=[];for(const s of l0()){const c=Y_n(s);c&&t.push(c)}const n=Z_n();return{version:zjt,workspace:zS(),documents:{open:t,activeId:e_(),...n?{kinds:n}:{}}}}async function emn(t,n,s){for(const c of cDt(n.kind))try{if(await c.restore({id:n.id,state:n.state,active:n.id===s&&!HQ(),store:t}))return!0}catch{}return!1}function dTt(t){if(!t)return!1;const n=!HQ();return SN(t,n)?!0:itn.has(t)?(wFt(t),n&&_Tr(t),!0):n&&X0(t)}function tmn(t,n){const s=n?.kinds??{},c=(n?.open.length??0)>0;for(const d of lDt())if(d.beginRestore)try{d.beginRestore({state:s[d.kind],hasDocumentsToRestore:c,documentsToRestore:(n?.open??[]).map(m=>({kind:m.kind,state:m.state})),store:t})}catch{}}function rmn(t){const n=new Set;for(const s of t)for(const c of cDt(s.kind))c.prepare&&n.add(c.prepare);return Promise.all([...n].map(s=>s().catch(()=>{})))}async function nmn(t,n){const s=n?.documents;if(tmn(t,s),!s||s.open.length===0){dTt(s?.activeId??null);return}await rmn(s.open);for(const c of s.open){const d=c.presentation;d&&typeof d=="object"&&!Array.isArray(d)&&xAr(c.id,d),await emn(t,c,s.activeId)}dTt(s.activeId)}function Ujt(t){if(!lte()||of()&&!u0()){let se=!1,pe=null,ue=()=>{};const Ce=new Promise(De=>{ue=De}),Fe=fTt(Ce);return Promise.all([cte(),Gze()]).then(()=>{if(se){ue();return}pe=Ujt(t),Fe.active=!1,sUe().finally(ue)}),()=>{se=!0,pe?.()}}const n=K_n();n?.workspace&&kB(n.workspace)&&Uk(n.workspace)?s2(n.workspace):(n?.workspace&&Tkr(n.workspace),s2(pR(),{provisional:!0}));let s=!1,c=null;const d=[],m=()=>{c!==null&&(clearTimeout(c),c=null),!(k_n()||t.playState!==void 0&&t.playState!=="stopped")&&X_n(Q_n())},g=()=>{c!==null&&clearTimeout(c),c=setTimeout(m,H_n)},S=()=>m();let k=null;const A=typeof window<"u"&&rCt(window.location.href)!==null,F=A||!(n?.documents?.open.length??0)?Promise.resolve():mN().catch(()=>{}),D=F.then(()=>A?void 0:nmn(t,n)).catch(()=>{}),J=new Promise(se=>{F.then(()=>{s||(k=setTimeout(()=>{se()},G_n))})}),q=Promise.race([D,J]).then(()=>{k!==null&&clearTimeout(k),!s&&(d.push(i2(g)),d.push(EAr(g)),window.addEventListener("pagehide",S))}),G=fTt(q);return()=>{s=!0,G.active=!1,cee===G&&(cee=null),k!==null&&clearTimeout(k);for(const se of d)se();window.removeEventListener("pagehide",S),c!==null&&m()}}function imn(t){Ye.useEffect(()=>{const n=rCt(window.location.href);if(!n)return;let s=!1;const c=Em(),d=()=>!s&&Em()===c;return sUe().then(()=>{if(d())return Bge(t,n,{updateUrl:!1,origin:"link"})}).catch(m=>{ea.error(`Could not restore shared editor view: ${m instanceof Error?m.message:String(m)}`,"editor")}),()=>{s=!0}},[t])}const pTt="volter:stale-chunk-reload";function omn(){typeof window>"u"||window.addEventListener("vite:preloadError",t=>{let n=0;try{n=Number(sessionStorage.getItem(pTt)??0)}catch{}if(!(Date.now()-n<6e4)){try{sessionStorage.setItem(pTt,String(Date.now()))}catch{}t.preventDefault(),window.location.reload()}})}const jI=[];function smn(t){const n=jI.findIndex(s=>s.owner===t.owner&&s.id===t.id);return n>=0&&jI.splice(n,1),jI.push(t),jI.sort((s,c)=>(s.order??0)-(c.order??0)),()=>{const s=jI.indexOf(t);s>=0&&jI.splice(s,1)}}function own(t,n,s){const c=new Map,d={surface:t,store:n},m=g=>{const S=s(g);if(!S)return null;for(const k of jI){const A=k.statesFor(S,d);if(A.length>0)return{source:k,states:A}}return null};return{storiesFor:g=>[...m(g)?.states??[]],active:g=>c.get(g)??null,apply:(g,S)=>{if(S===null){c.delete(g),n.notifyIngestEdit();return}const k=m(g);if(!k?.states.some(F=>F.id===S)){ea.warn(`[component-states] stories.apply: state "${S}" does not belong to node "${g}" on the ${t} surface — ignoring.`,"authoring");return}const A=s(g);A&&(c.set(g,S),k.source.apply(A,S,d),n.notifyIngestEdit())},unavailable:()=>jI.length>0?null:"No package in this editor registered a source of component states, so this component's named states could not be read."}}class swn extends Error{name="StoryMediumMismatch"}function awn(t){return t instanceof Error&&t.name==="StoryMediumMismatch"}const Dme=new Map;function cwn(t,n){return Dme.set(t,n),()=>{Dme.get(t)===n&&Dme.delete(t)}}function amn(t){return Dme.get(t)??null}function cmn(t,n){const s=[];for(const c of Object.keys(n).sort())s.push(`${c}=${lmn(n[c])}`);return`${t}|${s.join("&")}`}function lmn(t){if(typeof t=="function")return"fn";if(typeof t=="symbol")return"symbol";if(t===void 0)return"undefined";try{return JSON.stringify(t)??"undefined"}catch{return`[${typeof t}]`}}const rye=new Map,b_e=new Map,_Tt=new WeakMap;let mTt=Promise.resolve(),hTt=null,umn=1;function fmn(){return typeof WebGLRenderingContext<"u"&&typeof navigator<"u"&&!navigator.userAgent.toLowerCase().includes("jsdom")}async function dmn(){await Promise.race([Nye(),new Promise(t=>setTimeout(t,5e3))]),await Promise.race([new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t()))),new Promise(t=>setTimeout(t,250))]),await new Promise(t=>setTimeout(t,750)),await new Promise(t=>{const n=globalThis.requestIdleCallback;if(typeof n=="function"){n(()=>t(),{timeout:2e3});return}setTimeout(t,0)})}function pmn(){return hTt??=dmn(),hTt}function _mn(t){const n=_Tt.get(t);if(n!==void 0)return n;const s=umn++;return _Tt.set(t,s),s}function mmn(t,n,s,c){const d=rye.get(t);if(d)return Promise.resolve(d);const m=b_e.get(t);if(m)return m;const g=mTt.then(async()=>{await pmn();const S=s.parameters.layout,k=S==="fullscreen"||S==="padded"||S==="centered"?S:"padded",A={...c,props:s.args,layout:k},F=amn(n==="canvas"?"canvas":"three");if(!F)throw new Error(`No ${n} story capture is registered.`);return F(s.Component,A)});return mTt=g.then(()=>{},()=>{}),b_e.set(t,g),g.then(S=>{rye.set(t,S),b_e.delete(t)},()=>b_e.delete(t)),g}function hmn({component:t,story:n,previewRevision:s,width:c=128,height:d=96}){const m=n.Component,g=`${t.surface}:${t.path}:${cmn(n.id,n.args)}:${_mn(m)}:${s}:${c}x${d}`,[S,k]=Ye.useState(()=>rye.get(g)),[A,F]=Ye.useState(!1);return Ye.useEffect(()=>{let D=!1;if(F(!1),k(rye.get(g)),!!fmn())return mmn(g,t.surface,n,{width:c,height:d}).then(J=>{D||k(J)},()=>{D||F(!0)}),()=>{D=!0}},[t.surface,d,g,n,c]),S?$.jsx("img",{src:S,alt:`${t.name} preview`,className:"volter-component-thumbnail"}):$.jsx("span",{className:"volter-component-thumbnail-fallback","data-component-preview":A?"failed":"capturing-story",children:$.jsx(wR,{kind:"component",name:t.name})})}const wve="story:three",Tve="story:isolated",gmn="story:docs";function ymn(t,n){return t.surface==="dom"?!1:n===null||t.surface===n}function vmn({entry:t,previewRevision:n,width:s,height:c}){const d=t.detail;return $.jsx(hmn,{component:t.component,story:d,previewRevision:n,...s===void 0?{}:{width:s},...c===void 0?{}:{height:c}})}const bmn="story",Smn={id:bmn,owner:"./component-content-source",entries(t){const n=rq(),s=[];for(const c of t.components){if(!ymn(c,t.surface))continue;const d=bRt(n,c.name,c.path);d&&s.push({id:`${c.path}:${c.name}`,component:c,detail:d})}return s},subscribe:V0e,Thumbnail:vmn,open(t,n,s){const c=n.detail,d=n.component.surface==="three";CD(d?wve:Tve,t,d?{modulePath:c.modulePath,storyName:c.name,title:s}:{modulePath:c.modulePath,storyName:c.name})}};function gTt(t){return dYr(t.name,t.sourcePath)}const xmn={id:"portable-csf",owner:"./component-states",statesFor:(t,n)=>n.surface==="dom"?[]:gTt(t).map(s=>({id:s.id,label:s.label})),apply:(t,n,s)=>{const c=gTt(t).find(d=>d.id===n);if(c){if(s.surface==="three"){CD(wve,s.store,{modulePath:c.modulePath,storyName:c.name,title:c.label});return}if(s.surface==="canvas"){CD(Tve,s.store,{modulePath:c.modulePath,storyName:c.name});return}ea.warn(`[portable-csf] no story document is registered for the "${s.surface}" surface, so state "${n}" of "${t.name}" could not be opened.`,"authoring")}}};function wmn(){let t=0,n=!1;const s=S=>{const k=++t;oYr(),Nye().then(()=>{if(!(n||k!==t))return hYr(of(),void 0,{deferUndeclared:!0,...S?{changedPaths:S}:{}})})};s();let c=null;const d=bFt(),m=Rw(()=>s()),g=aen(s);return()=>{n=!0,t+=1,c!==null&&clearTimeout(c),d(),m(),g()}}const Jjt="story",IOe=new Set,NOe=new Set;function Tmn(t){const n=_Rt({modulePath:t.modulePath,title:t.title}).leaf;return n===t.label?n:`${n} · ${t.label}`}function OOe(t){for(const n of rq())if(n.ok){for(const s of n.stories)if(t.storyId===void 0?n.modulePath===t.modulePath&&s.name===t.storyName:s.id===t.storyId)return{modulePath:n.modulePath,storyName:s.name,title:t.title??Tmn({modulePath:n.modulePath,title:s.title,label:s.label})}}return null}function Cmn(t,n,s){const c={modulePath:s.modulePath,storyName:s.storyName,title:s.title,...n.activate===void 0?{}:{activate:n.activate}};if(n.mode==="docs")return CD(gmn,t,c);const d=Cze({modulePath:s.modulePath,regions:Tze()});return d.medium===void 0?(iYr(s.modulePath,d.reason),null):CD(d.medium==="three"?wve:Tve,t,c)}function yTt(t){ea.warn(`No composed portable story carries the id ${JSON.stringify(t)}, so nothing opened it.`,"editor")}function Emn(){return kN({id:Jjt,owner:"./story-opener",open:(t,n)=>{const s=OOe(n);return s?Cmn(t,n,s):(n.modulePath?IOe.add(n.modulePath):n.storyId!==void 0&&(NOe.add(n.storyId),lYr()&&yTt(n.storyId)),null)},settle:async()=>{await DDr();const t=[...IOe],n=[...NOe];if(IOe.clear(),NOe.clear(),await Promise.all(t.map(s=>pYr(of(),s))),n.length!==0){await uYr();for(const s of n)OOe({storyId:s})||yTt(s)}},ready:async(t,n)=>{if(n.mode==="docs")return;const s=OOe(n);if(!(!s||Cze({modulePath:s.modulePath,regions:Tze()}).medium!=="three")&&!await EC(()=>o2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}})}const kmn={actions:()=>{if(!egt(Tve)&&!egt(wve))return[];const t=[];for(const n of rq()){if(!n.ok)continue;const s=n.modulePath.split("/").pop()??n.modulePath;for(const c of n.stories)t.push({id:`story:${c.id}`,label:`Open Story: ${c.name} — ${s}`,execute:()=>void n0().workspace.open({kind:Jjt,modulePath:n.modulePath,storyName:c.name,title:c.name})})}return t},subscribe:t=>V0e(t)};function Amn(t,n){if(n===void 0)return;const s=n;return s===null||typeof s!="object"||typeof s.azimuthDegrees!="number"||!Number.isFinite(s.azimuthDegrees)||typeof s.elevationDegrees!="number"||!Number.isFinite(s.elevationDegrees)||s.elevationDegrees<-90||s.elevationDegrees>90||s.distance!==void 0&&(typeof s.distance!="number"||!Number.isFinite(s.distance)||s.distance<=0)?`${t} camera must be {azimuthDegrees, elevationDegrees in [-90, 90], distance? > 0 meters}.`:{azimuthDegrees:s.azimuthDegrees,elevationDegrees:s.elevationDegrees,...s.distance===void 0?{}:{distance:s.distance}}}function Dmn(t,n){if(n===void 0)return;const s=n;return s===null||typeof s!="object"||typeof s.clip!="string"||s.clip.length===0||typeof s.timeSeconds!="number"||!Number.isFinite(s.timeSeconds)||s.timeSeconds<0?`${t} pose must be {clip: non-empty string, timeSeconds >= 0}.`:{clip:s.clip,timeSeconds:s.timeSeconds}}const Pmn="packages/editor-core/src/stories/story-capture-command.ts",nB="capture-story-variants";async function Imn(t){if(document.visibilityState==="hidden")return{ok:!1,error:"story capture needs a PRESENTING tab — the editor tab is hidden, so the browser suspends the frames a story mount must paint. Bring the editor tab to the foreground (or unminimize its window) and re-run."};const n=t.modulePath;if(typeof n!="string"||n==="")return{ok:!1,error:`${nB} requires a project-relative modulePath.`};const s=t.story;if(s!==void 0&&typeof s!="string")return{ok:!1,error:`${nB} story must be a CSF export name.`};const c=(d,m,g)=>{if(d===void 0)return m;if(typeof d!="number"||!Number.isInteger(d)||d<64||d>1024)throw new Error(`${nB} ${g} must be an integer from 64 to 1024.`);return d};try{const d=await(async()=>{try{const D=await IZr("volter.project.json");if(!D)return null;const J=JSON.parse(D),q=J.resolution?.width,G=J.resolution?.height;return typeof q!="number"||typeof G!="number"||q<64||G<64||q>4096||G>4096?null:{width:Math.min(1024,Math.round(q)),height:Math.min(1024,Math.round(G))}}catch{return null}})(),m=c(t.width,d?.width??960,"width"),g=c(t.height,d?.height??540,"height"),S=Amn(nB,t.camera);if(typeof S=="string")return{ok:!1,error:S};const k=Dmn(nB,t.pose);if(typeof k=="string")return{ok:!1,error:k};const{captureProjectStoryVariants:A}=await fo(async()=>{const{captureProjectStoryVariants:D}=await import("./story-capture-BGeBen-R.js");return{captureProjectStoryVariants:D}},__vite__mapDeps([265,266,1,2,3,4,20,21,230,209,267,22,23]));return{ok:!0,data:{...await A(of(),{modulePath:n,...s===void 0?{}:{story:s},width:m,height:g,...S?{camera:S}:{},...k?{pose:k}:{}})}}}catch(d){return{ok:!1,error:d instanceof Error?d.message:String(d)}}}const Nmn={[nB]:{timeoutMs:12e4,derivedRefresh:"if-content-changed",handle:Imn}};function Omn(){const t=hin(Smn),n=smn(xmn),s=Emn(),c=uCt(kmn),d=dCt(Pmn,Nmn),m=wmn(),g=V0e(()=>{BB()});return()=>{g(),m(),d(),c(),s(),n(),t()}}const Rmn=[["descriptionForeground","--volter-content-dim"],["disabledForeground","--volter-content-placeholder"],["errorForeground","--volter-danger"],["focusBorder","--volter-accent"],["selection.background","--volter-accent","99"],["sash.hoverBorder","--volter-accent"],["menubar.selectionBackground","--volter-accent"],["menubar.selectionForeground","--volter-content-on-accent"],["menu.selectionBackground","--volter-accent"],["menu.selectionForeground","--volter-content-on-accent"],["editorGroupHeader.tabsBackground","--volter-surface-chrome"],["editorGroup.dropBackground","--volter-accent","66"],["tab.inactiveBackground","--volter-surface-chrome"],["tab.inactiveForeground","--volter-content-dim"],["editor.background","--volter-surface-chrome"],["editorLineNumber.foreground","--volter-content-placeholder"],["editor.selectionBackground","--volter-accent","99"],["editorGutter.background","--volter-surface-chrome"],["panelTitle.inactiveForeground","--volter-content-dim"],["list.activeSelectionBackground","--volter-accent"],["list.activeSelectionForeground","--volter-content-on-accent"],["list.focusOutline","--volter-accent"],["list.dropBackground","--volter-accent","66"],["button.background","--volter-accent"],["button.foreground","--volter-content-on-accent"],["checkbox.selectBackground","--volter-accent"],["input.background","--volter-surface-chrome"],["input.placeholderForeground","--volter-content-placeholder"],["inputOption.activeBackground","--volter-accent"],["inputOption.activeForeground","--volter-content-on-accent"],["inputValidation.errorBorder","--volter-danger"],["badge.background","--volter-accent"],["badge.foreground","--volter-content-on-accent"],["progressBar.background","--volter-accent"],["quickInputList.focusBackground","--volter-accent"],["quickInputList.focusForeground","--volter-content-on-accent"],["notificationsErrorIcon.foreground","--volter-danger"],["notificationsWarningIcon.foreground","--volter-warn"],["notificationsInfoIcon.foreground","--volter-accent"],["terminal.background","--volter-surface-chrome"],["commandCenter.background","--volter-surface-chrome"],["volter.view.background","--volter-surface-panel"],["foreground","--volter-content-primary"],["icon.foreground","--volter-content-muted"],["widget.border","--volter-boundary-default"],["titleBar.activeBackground","--volter-surface-shell"],["titleBar.inactiveBackground","--volter-surface-shell"],["titleBar.activeForeground","--volter-content-muted"],["titleBar.border","--volter-surface-shell"],["activityBar.background","--volter-surface-shell"],["activityBar.foreground","--volter-content-primary"],["activityBar.inactiveForeground","--volter-content-dim"],["activityBar.border","--volter-surface-shell"],["activityBar.activeBorder","--volter-accent"],["statusBar.background","--volter-surface-shell"],["statusBar.foreground","--volter-content-muted"],["statusBar.border","--volter-surface-shell"],["sideBar.background","--volter-surface-panel"],["sideBar.foreground","--volter-content-primary"],["sideBar.border","--volter-boundary-default"],["sideBarSectionHeader.background","--volter-surface-chrome"],["panel.background","--volter-surface-panel"],["panel.border","--volter-boundary-default"],["editorGroup.border","--volter-boundary-default"],["editorGroupHeader.tabsBorder","--volter-boundary-default"],["tab.activeBackground","--volter-surface-panel"],["tab.activeForeground","--volter-content-primary"],["tab.border","--volter-boundary-default"],["menu.background","--volter-widget-menu"],["menu.foreground","--volter-content-menu"],["menu.border","--volter-boundary-default"],["dropdown.background","--volter-widget-menu"],["dropdown.border","--volter-boundary-default"],["input.foreground","--volter-content-primary"],["input.border","--volter-boundary-default"]],Fmn=[["volter.viewport.background","--volter-viewport-background"],["volter.viewport.grid","--volter-viewport-grid"],["volter.viewport.axisX","--volter-viewport-axis-x"],["volter.viewport.axisY","--volter-viewport-axis-y"],["volter.viewport.axisZ","--volter-viewport-axis-z"],["volter.viewport.selection","--volter-viewport-selection"],["volter.viewport.active","--volter-viewport-active"],["volter.viewport.wire","--volter-viewport-wire"],["volter.gizmo.x","--volter-gizmo-x"],["volter.gizmo.y","--volter-gizmo-y"],["volter.gizmo.z","--volter-gizmo-z"],["volter.gizmo.navigationX","--volter-gizmo-navigation-x"],["volter.gizmo.navigationY","--volter-gizmo-navigation-y"],["volter.gizmo.navigationZ","--volter-gizmo-navigation-z"],["volter.gizmo.hover","--volter-gizmo-hover"],["volter.gizmo.drag","--volter-gizmo-drag"]];function vTt(t){const n=t.trim().toLowerCase(),s=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(n)?.[1];if(s)return`#${s.length===3?[...s].map(S=>S+S).join(""):s}`;const c=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?\s*\)$/.exec(n);if(!c)return null;const d=S=>Math.max(0,Math.min(255,Math.round(Number(S)))).toString(16).padStart(2,"0"),m=c[4],g=m===void 0?"":Math.round(Math.max(0,Math.min(1,m.endsWith("%")?Number.parseFloat(m)/100:Number(m)))*255).toString(16).padStart(2,"0");return`#${d(c[1])}${d(c[2])}${d(c[3])}${g==="ff"?"":g}`}function Mmn(t){const n=getComputedStyle(t),s={};for(const[c,d,m]of Rmn){const g=vTt(n.getPropertyValue(d));g!==null&&(g.length===9&&!m||(s[c]=m&&g.length===7?`${g}${m}`:g))}for(const[c,d]of Fmn){const m=vTt(n.getPropertyValue(d));m!==null&&(s[c]=m)}return s}let xm=null,Wjt=0;const Uje=new Set;function jmn(t){return Uje.add(t),()=>Uje.delete(t)}function bTt(){return Wjt}const ROe=new Map;function Hjt(t,n){ROe.get(t)?.disconnect(),ROe.delete(t);const s=()=>{const d=n?.isConnected?n.getBoundingClientRect():null;WAr(t,d!==null&&d.width>0&&d.height>0)};if(s(),n===null||typeof ResizeObserver>"u")return;const c=new ResizeObserver(s);c.observe(n),ROe.set(t,c)}function Lmn(t,n){if(xm){if(n===null){if(xm[t]?.isConnected)return}else if(xm[t]===n)return;if(n===null&&(t==="outliner"||t==="properties"||t==="content")){const s={...xm};delete s[t],xm=s}else n!==null&&(xm={...xm,[t]:n});n!==null&&Gjt(t,n),Hjt(t,n),Wjt+=1;for(const s of Uje)s()}}function Gjt(t,n){n.dataset.volterPart=t}const HO=new Map;let Kjt=0;const Jje=new Set,Xjt=new Set;let STt=!1;function xTt(){for(const t of l0())Xjt.add(t.descriptor.id)}function Bmn(t){STt||(STt=!0,i2(xTt)),xTt(),!(!t||Xjt.has(t))&&(vtn(t)||wFt(t,!1))}function $mn(t,n){if(n){if(!HO.delete(t.id))return}else{HO.has(t.id)||Bmn(t.documentId);const s=HO.get(t.id);if(s?.element===t.element&&s.documentId===t.documentId)return;HO.set(t.id,{...t})}Kjt+=1;for(const s of[...Jje])s()}function qmn(t){return Jje.add(t),()=>{Jje.delete(t)}}function wTt(){return Kjt}function GO({children:t,row:n=!1,center:s=!1}){return $.jsx("div",{className:"volter-editor-shell volter-part",onWheel:c=>c.stopPropagation(),"data-editor-hotkey-scope":"workspace","data-editor-hotkey-fallback":!0,style:{display:"flex",flexDirection:n?"row":"column",justifyContent:s?"center":void 0,width:"100%",height:"100%",minHeight:0,minWidth:0,position:"relative",fontFamily:"var(--volter-font-sans)",fontSize:"var(--volter-font-base)",color:"var(--volter-content-primary)"},children:t})}function zmn({children:t}){return $.jsx($.Fragment,{children:t})}function Vmn(){return xm?MS.createPortal($.jsx(GO,{center:!0,children:$.jsx(Gdn,{})}),xm.header):null}function Umn(){return null}function Jmn(){const t=Ye.useRef(null);return Ye.useEffect(()=>{const n=t.current;if(n)return fjt(n),()=>tfn(n)},[]),$.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[$.jsx("div",{ref:t,className:"volter-vscode-outliner-header",style:{padding:"var(--volter-space-2) var(--volter-space-4)","--volter-hierarchy-search-basis":"100%"}}),$.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:$.jsx(vjt,{})})]})}const Pme=new Map,Wje=new Set;let Hje=0;function Wmn(t,n){if(n){if(Pme.get(t)===n)return;n.dataset.volterUtility=t,Pme.set(t,n)}else if(!Pme.delete(t))return;Hje++;for(const s of Wje)s()}const Ime=new Map,Gje=new Set;let Kje=0;function Hmn(t,n){if(n){if(Ime.get(t)===n)return;Ime.set(t,n)}else if(!Ime.delete(t))return;Kje++;for(const s of Gje)s()}function Gmn(){return Ye.useSyncExternalStore(T3t,dht,dht),Ye.useSyncExternalStore(t=>(Gje.add(t),()=>Gje.delete(t)),()=>Kje,()=>Kje),$.jsx($.Fragment,{children:[...fRe("left"),...fRe("right")].map(t=>{const n=Ime.get(t.id);if(!n)return null;const s=t.Content;return $.jsx(Ye.Fragment,{children:MS.createPortal($.jsx(s,{}),n)},t.id)})})}function Kmn(){return Ye.useSyncExternalStore(Jye,hhe,hhe),Ye.useSyncExternalStore(t=>(Wje.add(t),()=>Wje.delete(t)),()=>Hje,()=>Hje),$.jsx($.Fragment,{children:SC().map(t=>{const n=Pme.get(t.id);return n?$.jsx(Ye.Fragment,{children:MS.createPortal($.jsx(GO,{children:$.jsx(Ydn,{utility:t})}),n)},t.id):null})})}function Xmn({descriptor:t,viewId:n,slot:s,parking:c,visible:d,inspector:m}){const[g]=Ye.useState(()=>document.createElement("div"));return Ye.useLayoutEffect(()=>{g.className="volter-vscode-document-slot",g.dataset.volterDocument=t.id,g.dataset.volterArea=t.area??"",g.style.cssText=`display:${d?"flex":"none"};flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;position:relative;`},[g,t.id,t.area,d]),Ye.useLayoutEffect(()=>((s??c).appendChild(g),()=>g.remove()),[g,s,c]),MS.createPortal($.jsxs(GO,{children:[$.jsx(FMt,{descriptor:t,viewId:n,active:d,chrome:!t.area}),m&&$.jsx(Fun,{})]}),g)}let Yjt=!0;function Ymn({arrangement:t,immersivePlay:n}){const s=Yv();imn(s);const c=zVe(s);Ye.useLayoutEffect(()=>{Yjt=c.column},[c.column]);const d=HO.get(bRe()??"")?.element??xm?.center;Ye.useLayoutEffect(()=>{if(!d)return;const F=()=>Twt({x:0,y:0,width:d.clientWidth,height:d.clientHeight}),D=new ResizeObserver(F);return D.observe(d),F(),()=>{D.disconnect(),Twt(null)}},[d]),Ye.useSyncExternalStore(s.subscribe,s.getShellSnapshot??s.getSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(qmn,wTt,wTt),Ye.useSyncExternalStore(jmn,bTt,bTt),Ye.useLayoutEffect(()=>{const F=ZEr({...t?{arrangement:t}:{},...n===void 0?{}:{immersivePlay:n},playUtilities:[]});return t&&s2(t.id),kkr(),F},[t,n]);const m=s.playState!=="stopped",g=Ye.useSyncExternalStore(bee,NR).play?.keepPanelsVisible;if(Ye.useEffect(()=>{B_n(m,Fjt())},[m,n,g]),Ye.useEffect(()=>Ujt(s),[s]),!xm)return null;const S=xm.center,k=l0(),A=CC()??k[0]??null;return globalThis.__volterBridge={documents:k.map(F=>F.descriptor.id),active:A?.descriptor.id??null,workspace:t?.id??null,areas:k.flatMap(F=>F.descriptor.area?[{id:F.descriptor.id,area:F.descriptor.area}]:[]),slots:[...HO.values()].map(({id:F,documentId:D,element:J})=>({id:F,documentId:D,visible:!!J}))},$.jsxs($.Fragment,{children:[[...HO.values()].map(F=>{const D=k.find(J=>J.descriptor.id===F.documentId)?.descriptor;return D?$.jsx(Xmn,{descriptor:D,viewId:F.id,slot:F.element??void 0,parking:S,visible:!!F.element,inspector:c.card&&D.id===A?.descriptor.id},F.id):null}),k.length===0&&MS.createPortal($.jsx(GO,{children:$.jsx("div",{className:"volter-vscode-empty",children:"No document open"})}),xm.center),xm.outliner&&MS.createPortal($.jsx(GO,{children:$.jsx(Jmn,{})}),xm.outliner),xm.properties&&MS.createPortal($.jsx(GO,{children:c.column?$.jsx(GVe,{}):$.jsx(Aun,{surface:c.surface})}),xm.properties),xm.content&&MS.createPortal($.jsx(GO,{children:$.jsx(g_n,{kind:"assets"})}),xm.content),$.jsx(Kmn,{}),$.jsx(Gmn,{})]})}async function Zmn(t,n={}){xm=t,n.workspaceStorage&&GAr(n.workspaceStorage),r3r();for(const[Fe,De]of Object.entries(t))De&&Gjt(Fe,De),Hjt(Fe,De??null);t.chromeRoot.id="editor-chrome-root",APt({Frame:zmn,Header:Vmn,Footer:Umn,Workspace:Ymn,Document:Ccn}),v_n(),Fnn();const s=Fln();s&&Oln(s,Date.now())&&ea.warn(Iln(s,Date.now()),"editor"),omn(),EDr(),U_n(),Omn(),await Promise.all([V4t(),Qkr(),YDt()]),_Ar(t.chromeRoot),t.chromeRoot.classList.toggle("volter-native-menus",lee()?.nativeMenus===!0);const c=document.createElement("div");c.id="editor-root",c.className="volter-part",c.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:10;",t.chromeRoot.appendChild(c),Xje.createRoot(c).render($.jsx(Zln,{}));const d={activeKeymap:()=>n0().keyboard.activeKeymap(),invoke:Fe=>n0().keyboard.invoke(Fe),subscribe:Fe=>n0().keyboard.subscribe(Fe),facts:()=>{const Fe=n0(),De=Fe.keyboard.stage();return{surface:De.surface,mode:De.mode,documentKind:Fe.documents.active()?.kind??null,play:Fe.session.playState()}},report:(Fe,De)=>{const be=n0();Fe==="error"?be.console.error(De,"editor"):be.console.warn(De,"editor")}};let m=!1;const g={whenRestored:sUe,activeSource:()=>{const Fe=n0().documents.active();if(!Fe)return null;const De=Fe.kind==="model"&&Fe.id.startsWith("model:")?Fe.id.slice(6):"";return{kind:Fe.kind,path:De}},list:()=>l0().map(Fe=>{const De=Fe.descriptor.area?vkr().find(be=>be.id===Fe.descriptor.area):void 0;return{id:Fe.descriptor.id,title:Fe.title,...De?{area:{id:De.id,place:De.place,ratio:De.ratio}}:{}}}),activeId:()=>CC()?.descriptor.id??null,subscribe:Fe=>{m=!0;const De=i2(Fe),be=bkr(Fe);return()=>{De(),be()}},activate:(Fe,De)=>{!m&&HQ()||(De?dTr(Fe,De):X0(Fe))},close:Fe=>{if(EN(Fe))return;const De=l0().find(be=>be.descriptor.id===Fe);De&&d.report("warn",`“${De.title}” has unsaved changes, so it stayed open. Save it (⌘S) and close it again.`)},setView:(Fe,De)=>$mn(Fe,De)},S={elements:()=>n0().history.elements(),onElement:Fe=>n0().history.onElement(Fe),onInvalidated:Fe=>n0().history.onInvalidated(Fe),changed:()=>n0().history.changed(),focusedResource:()=>n0().history.focusedResource(),focusedDocument:()=>{const Fe=n0().documents.active();return Fe?{id:Fe.id,label:Fe.title}:null},setDelegate:Fe=>n0().history.setDelegate(Fe),report:d.report},k={setProvider:Fe=>n0().files.setProvider(Fe),report:d.report},A={setProvider:Fe=>n0().settings.setProvider(Fe),adapterValues:()=>[...kEr()],workbenchValues:()=>{const Fe=xm?.chromeRoot;if(!Fe)return[];const De=getComputedStyle(Fe).getPropertyValue("--volter-command-bar-height").trim(),be=Number.parseFloat(De),X=["workbench.colorCustomizations",Mmn(Fe)];return!Number.isFinite(be)||be<=0?[X]:[["window.titleBarHeight",Math.round(be)],X]},lookId:()=>DN(),notify:Fe=>{n0().notify(Fe)},subscribe:Fe=>{const De=zye(Fe),be=wDt(Fe);return()=>{De(),be()}},report:d.report},F={list:()=>Lnn().map(Fe=>({id:Fe.id,label:Fe.label,category:Fe.category,...Fe.menu?{menu:Fe.menu}:{}})),invoke:Fe=>$nn(Fe),subscribe:Fe=>Bnn(Fe),setPaletteOpener:Fe=>jnn(Fe),setCommandExecutor:Fe=>qnn(Fe),report:d.report},D={setDelegate:Fe=>WCr(Fe?{show:De=>Fe({...De,source:t3r()})}:null)},J={list:()=>IPt().map(Fe=>({view:Fe.view,title:Fe.title,verbs:Fe.verbs.map(De=>({id:De.id,...De.title?{title:De.title}:{}}))})),invoke:(Fe,De,be)=>OPt(Fe,De,be),subscribe:Fe=>NPt(Fe)},q={list:()=>SC().map((Fe,De)=>({id:Fe.id,title:Fe.title,order:Fe.order??De})),subscribe:Fe=>{let De=hhe();const be=Jye(Fe),X=HVe(()=>{const we=hhe();we!==De&&(De=we,Fe())});return()=>{be(),X()}},offerBody:(Fe,De)=>Wmn(Fe,De)};let G=!0,se=null,pe=null;drn(()=>G);const ue={setActiveStaticPanel:Fe=>Xht(wVe.find(De=>De.kind===Fe)?.kind??null),focusCompactInspector:()=>{if(Yjt)return!1;const Fe=xm?.center.querySelector('[data-testid="compact-inspector-card"]');return Fe?(Fe.tabIndex=-1,Fe.focus(),Xht("inspector"),!0):!1},setPaneActive:Fe=>{G!==Fe&&(G=Fe)},setImmersive:Fe=>{se?.(),se=null,!(!Fe||!xm)&&(se=O_n({root:xm.chromeRoot,hideChrome:()=>Fe.enter(),showChrome:()=>Fe.exit()}))},setDockCommands:Fe=>{pe?.(),pe=null,Fe&&(pe=tkr({showUtility:De=>Fe.showUtility(De),toggleUtility:De=>Fe.toggleUtility(De),ensureUtility:De=>Fe.ensureUtility(De),closeUtility:De=>Fe.closeUtility(De),showStaticPanel:De=>Fe.showStaticPanel(De),setFocus:De=>Fe.setFocus(De),toggleFocus:()=>Fe.toggleFocus(),captureUtilities:De=>{for(const be of De)Fe.showUtility(be);return()=>{for(const be of De)Fe.closeUtility(be)}},showAuxiliary:()=>ue.report("warn","Undo history has no panel under the VS Code frame: the stack is the workbench's own (U4), reached through Edit → Undo/Redo and the Timeline.")}))},report:(Fe,De)=>d.report(Fe,De)};return{host:c,keyboard:d,documents:g,history:S,files:k,commands:F,notifications:D,views:J,utilities:q,output:{setProvider:V_n},settings:A,status:{list:()=>["left","right"].flatMap(Fe=>fRe(Fe).map((De,be)=>({id:De.id,title:De.name,align:Fe,order:De.order??be}))),subscribe:Fe=>T3t(Fe),offerBody:(Fe,De)=>Hmn(Fe,De)},game:ue,offerPart:Lmn}}function Qmn(t){const n=Object.keys(t.packages);return s0r({id:t.id,packages:n,look:t.look,workspace:t.workspace,nativeMenus:t.nativeMenus,logo:t.logo}),ODt(n.flatMap(s=>t.packages[s]??[])),{mountVolter:Zmn}}const{mountVolter:lwn}=Qmn({id:"game-editor",packages:{"@volter/editor-game":r0r,"@volter/editor-react":n0r,"@volter/editor-threejs":i0r,"@volter/editor-xstate":o0r,"@volter/editor-blender":t0r},look:"classic",workspace:"game",logo:"https://brand.volter.ai/logo/volter-game-editor/svg",nativeMenus:!0});export{hSn as $,_3t as A,DB as B,m3t as C,h3t as D,u0 as E,OC as F,Xze as G,nRe as H,iSn as I,D2n as J,Yv as K,Ih as L,UXr as M,p3t as N,ea as O,f3t as P,Jl as Q,g3t as R,Pwr as S,G0n as T,VFt as U,Vtn as V,ZLe as W,HFt as X,L_ as Y,CN as Z,fo as _,XY as a,l2n as a$,Ms as a0,dc as a1,Kk as a2,K0n as a3,bC as a4,Bgn as a5,Usn as a6,Yan as a7,eSn as a8,Wze as a9,hy as aA,oq as aB,fMt as aC,M3r as aD,nSn as aE,Vxn as aF,i0n as aG,F_e as aH,w0n as aI,gAr as aJ,_p as aK,dm as aL,Zm as aM,iwn as aN,Q0e as aO,l0 as aP,wFt as aQ,TD as aR,Hyn as aS,RCr as aT,H0e as aU,PRt as aV,Nze as aW,ISn as aX,Zf as aY,I9t as aZ,a2n as a_,MB as aa,$wr as ab,e9t as ac,Wbn as ad,o0n as ae,Go as af,zgn as ag,Eye as ah,qun as ai,G0e as aj,Uwr as ak,Bxn as al,V0e as am,rq as an,Cze as ao,Tze as ap,iYr as aq,lan as ar,f$e as as,Ftn as at,fRt as au,jtn as av,of as aw,Y0 as ax,mp as ay,O0n as az,QLe as b,S2n as b$,L4r as b0,c2n as b1,yC as b2,S$e as b3,bTr as b4,X7e as b5,ig as b6,bFt as b7,uYr as b8,zbn as b9,fu as bA,x2n as bB,C2n as bC,E2n as bD,k2n as bE,LSt as bF,h2n as bG,T2n as bH,w2n as bI,JZr as bJ,BSt as bK,_2n as bL,jD as bM,yZr as bN,USt as bO,p2n as bP,UZr as bQ,u2n as bR,y2n as bS,e2n as bT,t2n as bU,AZr as bV,A2n as bW,$Zr as bX,PZr as bY,o2n as bZ,s2n as b_,hRt as ba,dRt as bb,gRt as bc,GXr as bd,amn as be,awn as bf,dSn as bg,_Rt as bh,cYr as bi,ovn as bj,L0n as bk,j0n as bl,P3r as bm,z0n as bn,Rhe as bo,Hbn as bp,Xbn as bq,dtn as br,y3r as bs,v3r as bt,jwr as bu,Gbn as bv,ltn as bw,QFt as bx,ed as by,_y as bz,iRe as c,R_ as c$,m2n as c0,K0e as c1,qZr as c2,zZr as c3,MRt as c4,LRt as c5,DZr as c6,n2n as c7,FZr as c8,r2n as c9,USn as cA,Uye as cB,dR as cC,xyn as cD,mO as cE,Vv as cF,wyn as cG,C0r as cH,k0r as cI,iLe as cJ,gyn as cK,M3t as cL,bZ as cM,lyn as cN,n$ as cO,Thn as cP,aR as cQ,pBe as cR,Nc as cS,tLe as cT,HTt as cU,KTt as cV,_hn as cW,W0r as cX,I0n as cY,N0n as cZ,PI as c_,VZr as ca,v2n as cb,RZr as cc,jze as cd,jRt as ce,OZr as cf,SMe as cg,IZr as ch,f2n as ci,i_e as cj,jZr as ck,VSt as cl,zSt as cm,BZr as cn,TZr as co,Mze as cp,bMe as cq,MZr as cr,b2n as cs,g2n as ct,i2n as cu,WZr as cv,d2n as cw,etn as cx,X0 as cy,ixt as cz,d3t as d,_Sr as d$,Jxn as d0,cBe as d1,Cm as d2,gfn as d3,i0 as d4,O2n as d5,ADr as d6,$un as d7,DRe as d8,i$ as d9,a4t as dA,lLe as dB,YB as dC,Wxn as dD,Hxn as dE,Dfn as dF,EAr as dG,A0n as dH,KBe as dI,ugt as dJ,T0n as dK,fhn as dL,Ovr as dM,fgt as dN,bAr as dO,hAr as dP,GBe as dQ,yAr as dR,a0r as dS,nye as dT,LOe as dU,hyn as dV,jsn as dW,yZ as dX,sAt as dY,AR as dZ,_xr as d_,aan as da,oan as db,NVe as dc,WSn as dd,d0r as de,_0r as df,u0r as dg,Iw as dh,CTt as di,H1 as dj,Wgn as dk,sen as dl,oSn as dm,ntn as dn,cMt as dp,l2 as dq,zAr as dr,Kbn as ds,uMt as dt,fQ as du,yhn as dv,lEr as dw,qTt as dx,SZ as dy,DCr as dz,u3t as e,vhn as e$,t$ as e0,Vme as e1,iCt as e2,$0n as e3,W0 as e4,W0n as e5,M2n as e6,gSn as e7,evn as e8,jhe as e9,syn as eA,sSn as eB,OYr as eC,Dze as eD,ERt as eE,l4t as eF,rtn as eG,lYr as eH,E4t as eI,D5e as eJ,Iye as eK,Don as eL,eLe as eM,bhn as eN,l0r as eO,w4t as eP,Oon as eQ,Lht as eR,k5e as eS,Aht as eT,c0 as eU,Yyn as eV,can as eW,NRe as eX,yBe as eY,e0n as eZ,$Cr as e_,T4r as ea,OQr as eb,tvn as ec,u$e as ed,nvn as ee,rvn as ef,qbn as eg,GSn as eh,HSn as ei,H0n as ej,hBe as ek,nhe as el,myn as em,G0 as en,kyn as eo,YY as ep,Iyn as eq,C_e as er,$yn as es,sQ as et,qgn as eu,Rw as ev,Ehn as ew,jTr as ex,PSn as ey,rSn as ez,oRe as f,W9t as f$,d0n as f0,f0n as f1,CC as f2,nFe as f3,wee as f4,kN as f5,Tve as f6,gmn as f7,hYr as f8,ND as f9,Dhn as fA,T0r as fB,Ahn as fC,Nme as fD,jOe as fE,ZTt as fF,S0n as fG,Eyn as fH,uxn as fI,xan as fJ,rxn as fK,TR as fL,xxn as fM,nxn as fN,Jze as fO,$bn as fP,bRt as fQ,mTr as fR,tTr as fS,JSn as fT,aSn as fU,lSn as fV,a0 as fW,cSn as fX,HQ as fY,VSn as fZ,RSn as f_,zwr as fa,MTr as fb,T_e as fc,ttn as fd,p$e as fe,n3r as ff,nfn as fg,zxn as fh,qxn as fi,$xn as fj,wve as fk,EN as fl,v0n as fm,D0n as fn,cwn as fo,swn as fp,uSn as fq,fSn as fr,g4t as fs,s0n as ft,hhn as fu,whn as fv,C0n as fw,b0n as fx,Gxn as fy,aPt as fz,y3t as g,rA as g$,CRt as g0,zQ as g1,kfn as g2,jun as g3,CR as g4,HXr as g5,Vbn as g6,Ltn as g7,DDr as g8,Pg as g9,$gn as gA,DFe as gB,f3r as gC,ivn as gD,h0r as gE,Jbn as gF,gYr as gG,Eht as gH,JTt as gI,i2 as gJ,X1 as gK,kSn as gL,ASn as gM,Mwr as gN,jgn as gO,ESn as gP,Mgn as gQ,CSn as gR,KFt as gS,U2n as gT,xR as gU,een as gV,$rn as gW,Chn as gX,zTt as gY,OTt as gZ,LTr as g_,DSn as ga,f0r as gb,fee as gc,R2n as gd,Z2n as ge,F2n as gf,oyn as gg,Y2n as gh,fN as gi,Zje as gj,sLe as gk,o4r as gl,J2n as gm,R0n as gn,X2n as go,F0n as gp,Q0n as gq,Dw as gr,sf as gs,hR as gt,b3r as gu,M0n as gv,wSn as gw,sPt as gx,snn as gy,own as gz,WAt as h,Kyn as h$,AC as h0,tA as h1,xhn as h2,J0n as h3,sBe as h4,X0e as h5,Qbn as h6,uCt as h7,Oan as h8,kxn as h9,RTr as hA,Tht as hB,Lye as hC,kTr as hD,ETr as hE,JTr as hF,yyn as hG,Syn as hH,byn as hI,Tyn as hJ,Cyn as hK,Xyn as hL,_yn as hM,Wyn as hN,Ym as hO,s4t as hP,dyn as hQ,pyn as hR,$ye as hS,vyn as hT,gBe as hU,cyn as hV,Uyn as hW,Jyn as hX,rhe as hY,r0n as hZ,Cht as h_,dYr as ha,q0n as hb,Lgn as hc,x0n as hd,dBe as he,Kgn as hf,Qgn as hg,nyn as hh,R$ as hi,CD as hj,Xgn as hk,Hgn as hl,Ggn as hm,eyn as hn,Qyn as ho,Zyn as hp,FTr as hq,qCr as hr,wht as hs,gC as ht,xRe as hu,L3t as hv,uyn as hw,fyn as hx,TRe as hy,wRe as hz,Pp as i,Qje as i$,LCr as i0,Ayn as i1,c4t as i2,she as i3,ACr as i4,OG as i5,Q3t as i6,q3t as i7,ITr as i8,zTr as i9,KTr as iA,HTr as iB,NG as iC,zyn as iD,n0n as iE,CCr as iF,ICr as iG,PTr as iH,Myn as iI,Dyn as iJ,ahe as iK,qyn as iL,E5e as iM,DTr as iN,vBe as iO,Nyn as iP,q$ as iQ,Pyn as iR,Ryn as iS,BSn as iT,zSn as iU,Cee as iV,AD as iW,vcn as iX,jxn as iY,S5e as iZ,Axn as i_,Fyn as ia,Oyn as ib,jyn as ic,Lyn as id,Gyn as ie,ATr as ig,kCr as ih,e4t as ii,t0n as ij,BTr as ik,Vyn as il,Byn as im,UTr as io,E_e as ip,ERe as iq,GTr as ir,WTr as is,BCr as it,VTr as iu,yee as iv,Rye as iw,XTr as ix,Epe as iy,kRe as iz,VAt as j,Exn as j$,nee as j0,Ofn as j1,Xxn as j2,nPt as j3,g3r as j4,eBe as j5,qwr as j6,uht as j7,Nwr as j8,v3t as j9,QHr as jA,tGr as jB,nGr as jC,tSn as jD,Rwr as jE,dVe as jF,lnn as jG,ste as jH,Xsn as jI,Gxt as jJ,wI as jK,RFe as jL,Sxn as jM,ahn as jN,dhn as jO,uhn as jP,vxn as jQ,lhn as jR,m0r as jS,bxn as jT,wan as jU,cxn as jV,axn as jW,Pon as jX,wxn as jY,sxn as jZ,Pan as j_,ysn as ja,K2n as jb,HI as jc,zMe as jd,Vgn as je,qRt as jf,Y0e as jg,Tye as jh,cN as ji,XLe as jj,Pye as jk,lN as jl,RAr as jm,TBe as jn,uBe as jo,Dye as jp,YLe as jq,Kye as jr,Fin as js,D9t as jt,jTt as ju,FB as jv,sN as jw,$2n as jx,Lxn as jy,F_n as jz,kwr as k,Jwr as k$,YSn as k0,Txn as k1,ixn as k2,txn as k3,ZSn as k4,_xn as k5,exn as k6,QSn as k7,oxn as k8,pxn as k9,phn as kA,rLe as kB,bEr as kC,vve as kD,bve as kE,TSn as kF,IMt as kG,RMt as kH,Uxt as kI,NFe as kJ,q_e as kK,OFe as kL,Lun as kM,KVe as kN,Dxn as kO,Ffn as kP,y0n as kQ,K0r as kR,Q2n as kS,gR as kT,bDr as kU,yve as kV,U$ as kW,eA as kX,mD as kY,Wwr as kZ,Hwr as k_,lxn as ka,mxn as kb,c$e as kc,fxn as kd,KSn as ke,Cxn as kf,XSn as kg,hxn as kh,_Ve as ki,dxn as kj,Tan as kk,gxn as kl,yxn as km,jSn as kn,FSn as ko,LSn as kp,W2n as kq,CDr as kr,e6t as ks,H2n as kt,MSn as ku,wD as kv,J0 as kw,GSt as kx,LAt as ky,Y4 as kz,Gme as l,twn as l$,Aye as l0,ghn as l1,j0r as l2,ZAr as l3,QAr as l4,mhn as l5,tjt as l6,Ugn as l7,Fwr as l8,Vwr as l9,ayn as lA,dCt as lB,xSn as lC,E0n as lD,Kxn as lE,chn as lF,Pxn as lG,Ixn as lH,Shn as lI,khn as lJ,$Sn as lK,Yxn as lL,Zxn as lM,mjt as lN,qSn as lO,Ygn as lP,Psn as lQ,tyn as lR,Uxn as lS,rwn as lT,P0n as lU,kAr as lV,SAr as lW,k0n as lX,iyn as lY,Zgn as lZ,ryn as l_,OPt as la,Mxn as lb,Fxn as lc,Nxn as ld,Rxn as le,Oxn as lf,m0n as lg,A3r as lh,U0n as li,V0n as lj,G2n as lk,Afn as ll,Ybn as lm,Zbn as ln,pSn as lo,r9t as lp,sjt as lq,Qxn as lr,nwn as ls,Ubn as lt,NSn as lu,Cfn as lv,Amn as lw,Dmn as lx,nq as ly,RDr as lz,rQ as m,U1r as m$,frn as m0,B0n as m1,hEr as m2,Ihn as m3,L2n as m4,N2n as m5,B2n as m6,EQr as m7,FEr as m8,PEr as m9,Lme as mA,eht as mB,F_ as mC,Bme as mD,$me as mE,Bbr as mF,Ubr as mG,yB as mH,kbr as mI,Dbr as mJ,EEt as mK,Fbr as mL,CEt as mM,Cbr as mN,Ebr as mO,pbr as mP,_br as mQ,l2r as mR,eh as mS,V1r as mT,tbr as mU,xEt as mV,Q1r as mW,K1r as mX,SEt as mY,Y1r as mZ,H1r as m_,eve as ma,Utn as mb,a0n as mc,g0n as md,c0n as me,u0n as mf,l0n as mg,Rsn as mh,h0n as mi,vSn as mj,bSn as mk,ySn as ml,SSn as mm,gEr as mn,yEr as mo,$Re as mp,bN as mq,OSn as mr,Jgn as ms,uje as mt,PAt as mu,Nxr as mv,YI as mw,Kvr as mx,gCt as my,i1r as mz,vB as n,Mbr as n$,nbr as n0,G1r as n1,J1r as n2,q1r as n3,z1r as n4,ibr as n5,rbr as n6,X1r as n7,W1r as n8,ebr as n9,gbr as nA,h2r as nB,e2r as nC,Tbr as nD,Ybr as nE,u2r as nF,dbr as nG,qbr as nH,a2r as nI,Lbr as nJ,i2r as nK,TEt as nL,Rbr as nM,Jbr as nN,Wbr as nO,PEt as nP,f2r as nQ,s2r as nR,m2r as nS,d2r as nT,Fw as nU,Xbr as nV,y2r as nW,Zbr as nX,hye as nY,M_ as nZ,c2r as n_,mye as na,Z1r as nb,IEt as nc,g2r as nd,Obr as ne,Vbr as nf,o2r as ng,Gbr as nh,Pbr as ni,lbr as nj,fbr as nk,fLe as nl,Qbr as nm,ICt as nn,n2r as no,t2r as np,_2r as nq,abr as nr,xbr as ns,wbr as nt,vbr as nu,ybr as nv,Sbr as nw,bbr as nx,Kbr as ny,Nbr as nz,Dwr as o,w2r as o$,p2r as o0,r2r as o1,DEt as o2,vu as o3,mbr as o4,ubr as o5,cbr as o6,jbr as o7,hLe as o8,$br as o9,$Et as oA,oSr as oB,V2r as oC,OCt as oD,FCt as oE,ggn as oF,ogn as oG,XEt as oH,NEt as oI,jEt as oJ,NCt as oK,RCt as oL,X2r as oM,fgn as oN,iSr as oO,A2r as oP,D2r as oQ,QZ as oR,qk as oS,XOe as oT,G2r as oU,k2r as oV,P2r as oW,R2r as oX,sgn as oY,UEt as oZ,JEt as o_,zbr as oa,hbr as ob,Hbr as oc,Nhn as od,ui as oe,Jhn as of,Uhn as og,obr as oh,jmt as oi,Hhn as oj,B2r as ok,nSr as ol,GEt as om,KEt as on,O2r as oo,N2r as op,bgn as oq,cSr as or,WEt as os,HEt as ot,Xhn as ou,Khn as ov,Yhn as ow,Ghn as ox,Whn as oy,BEt as oz,zAt as p,Q2r as p$,x2r as p0,C2r as p1,T2r as p2,YEt as p3,VEt as p4,Tgn as p5,ekt as p6,pgn as p7,W2r as p8,ZZ as p9,Zhn as pA,Cgn as pB,rgn as pC,xgn as pD,cgn as pE,sSr as pF,J2r as pG,jCt as pH,BCt as pI,MCt as pJ,LCt as pK,pye as pL,_ye as pM,ugn as pN,ZEt as pO,rSr as pP,K2r as pQ,b2r as pR,gye as pS,fSr as pT,vgn as pU,aSr as pV,M2r as pW,wgn as pX,eSr as pY,tSr as pZ,_gn as p_,XI as pa,S2r as pb,lgn as pc,QEt as pd,yLe as pe,Y2r as pf,jme as pg,eQ as ph,YOe as pi,U2r as pj,LEt as pk,dgn as pl,Qhn as pm,q2r as pn,tgn as po,ygn as pp,egn as pq,Z2r as pr,L2r as ps,hgn as pt,E2r as pu,mgn as pv,M$ as pw,fye as px,dye as py,Sgn as pz,Cwr as q,kLe as q$,agn as q0,I2r as q1,F2r as q2,qEt as q3,j2r as q4,ngn as q5,$2r as q6,H2r as q7,gLe as q8,OEt as q9,$1r as qA,v2r as qB,qhn as qC,Vhn as qD,$hn as qE,zhn as qF,_1r as qG,m1r as qH,p1r as qI,Rhn as qJ,Ohn as qK,sbr as qL,Agn as qM,Egn as qN,xLe as qO,BLe as qP,$Le as qQ,qLe as qR,rAt as qS,Zkt as qT,nAt as qU,FLe as qV,MLe as qW,zLe as qX,OLe as qY,RLe as qZ,ELe as q_,REt as qa,FEt as qb,MEt as qc,z2r as qd,zEt as qe,ign as qf,sA as qg,$S as qh,qme as qi,dSr as qj,jhn as qk,Bhn as ql,lSr as qm,Mhn as qn,Lhn as qo,f1r as qp,d1r as qq,HOe as qr,sD as qs,wEt as qt,Abr as qu,Ibr as qv,uSr as qw,Bmt as qx,$mt as qy,Fhn as qz,n0 as r,yAt as r$,wAt as r0,KLe as r1,xye as r2,mee as r3,gAt as r4,oAt as r5,jLe as r6,wLe as r7,TLe as r8,tQ as r9,j$ as rA,vye as rB,WLe as rC,GLe as rD,vAt as rE,IAt as rF,EAt as rG,Mw as rH,Sye as rI,uAt as rJ,j_ as rK,xAt as rL,Gkt as rM,AAt as rN,pAt as rO,cAt as rP,Lu as rQ,ALe as rR,yye as rS,aD as rT,Kkt as rU,bye as rV,Qkt as rW,tAt as rX,DLe as rY,iAt as rZ,SLe as r_,kgn as ra,_At as rb,dAt as rc,nht as rd,NAt as re,zme as rf,ILe as rg,NLe as rh,$kt as ri,Lkt as rj,Ukt as rk,zkt as rl,aAt as rm,rht as rn,LLe as ro,PLe as rp,DAt as rq,fAt as rr,Hkt as rs,lAt as rt,CAt as ru,CLe as rv,eAt as rw,HLe as rx,Xkt as ry,hAt as rz,JAt as s,OAt as s$,tht as s0,uxr as s1,HSr as s2,GSr as s3,oxr as s4,TAt as s5,Dxr as s6,JSr as s7,WSr as s8,Exr as s9,USr as sA,Rxr as sB,XSr as sC,pxr as sD,qSr as sE,mxr as sF,yxr as sG,VSr as sH,vxr as sI,Ixr as sJ,Cxr as sK,MSr as sL,Sxr as sM,VLe as sN,SAt as sO,Ykt as sP,Jme as sQ,wxr as sR,Ume as sS,mSr as sT,hSr as sU,gxr as sV,Wme as sW,bAt as sX,FAt as sY,Axr as sZ,kAt as s_,jSr as sa,LSr as sb,dxr as sc,bSr as sd,xSr as se,Pxr as sf,KSr as sg,kSr as sh,FSr as si,vSr as sj,SSr as sk,mAt as sl,xxr as sm,txr as sn,rxr as so,Pgn as sp,ASr as sq,exr as sr,QSr as ss,ZSr as st,RSr as su,ZOe as sv,nxr as sw,sxr as sx,ULe as sy,zSr as sz,Pa as t,TSr as t0,ESr as t1,wSr as t2,CSr as t3,gSr as t4,ySr as t5,bxr as t6,Dgn as t7,YSr as t8,Oxr as t9,cvr as tA,avr as tB,lwn as tC,Phn as tD,Ign as tE,Ngn as tF,Ogn as tG,Rgn as tH,Fgn as tI,SEr as tJ,p0n as tK,_0n as tL,X0n as tM,Y0n as tN,Z0n as tO,Bbn as tP,P2n as tQ,I2n as tR,IQr as tS,j2n as tT,q2n as tU,z2n as tV,V2n as tW,_Sn as tX,mSn as tY,urn as tZ,ewn as t_,Txr as ta,RAt as tb,cxr as tc,kxr as td,JLe as te,ixr as tf,axr as tg,BSr as th,lxr as ti,OSr as tj,DSr as tk,PSr as tl,ISr as tm,NSr as tn,fxr as to,$Sr as tp,hxr as tq,svr as tr,QTt as ts,Dmt as tt,Ome as tu,ovr as tv,ivr as tw,PG as tx,rCt as ty,tCt as tz,Gd as u,bo as v,Dg as w,e_ as x,yen as y,cFt as z};
1409
+ ${s.componentStack??""}`,"editor")}render(){return this.state.error?$.jsxs("div",{role:"alert","data-testid":"static-panel-crashed",style:{padding:12,display:"grid",gap:8,alignContent:"start"},children:[$.jsxs("strong",{children:[this.props.title," crashed."]}),$.jsx("span",{style:{opacity:.8,wordBreak:"break-word"},children:this.state.error.message}),$.jsx("div",{children:$.jsx(Ms,{type:"button",variant:"outline",size:"compact",onClick:()=>this.setState({error:null}),children:"Retry"})})]}):this.props.children}}const m_n=wVe.map(t=>{const n=p_n[t.kind],s=c=>$.jsx(__n,{title:t.title,children:$.jsx(n,{...c})});return s.displayName=`StaticPanel(${t.kind})`,{...t,Content:s}});function h_n(t){return m_n.find(n=>n.kind===t)}function g_n({kind:t,dependencies:n}){const{Content:s}=h_n(t);return $.jsx(s,{dependencies:n})}const y_n=250;function v_n(){const t=D4t(),n=b_n();return()=>{n(),t()}}function b_n(){const t=new Map;let n=null,s=!1;function c(){const g=[],S=new Set;for(const k of ea.getEntries()){if(S.add(k.id),k.level!=="error"&&k.level!=="warn")continue;const A=t.get(k.id)??0;k.count<=A||(t.set(k.id,k.count),g.push({severity:k.level,message:k.message,source:k.source??null,occurrences:k.count-A}))}for(const k of[...t.keys()])S.has(k)||t.delete(k);return g}function d(){if(n=null,s)return;const g=c();g.length!==0&&bN("console-entries",{entries:g,_clientId:wC})}const m=ea.subscribe(()=>{if(s)return;const g=ea.getEntries(),S=g[g.length-1];if(S&&S.level==="error"&&!t.has(S.id)){n!==null&&clearTimeout(n),n=null,queueMicrotask(d);return}n===null&&(n=setTimeout(d,y_n))});return bN("console-entries",{entries:[],_clientId:wC}),d(),()=>{s=!0,n!==null&&clearTimeout(n),m()}}const Y4={INPUT:"input",PRE_PHYSICS:"prePhysics",PHYSICS:"physics",POST_PHYSICS:"postPhysics",GAME_LOGIC:"gameLogic",ANIMATION:"animation",PRE_RENDER:"preRender",RENDER:"render"},yZ=[Y4.INPUT,Y4.PRE_PHYSICS,Y4.PHYSICS,Y4.POST_PHYSICS,Y4.GAME_LOGIC,Y4.ANIMATION,Y4.PRE_RENDER,Y4.RENDER],ewn=Object.freeze(Object.defineProperty({__proto__:null,PHASE_ORDER:yZ,SystemPhase:Y4},Symbol.toStringTag,{value:"Module"})),tye=1e-9,Ijt=1e5;function S_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>tye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=s.end-g;if(!d||S<=F+tye){const D=Math.min(g+S,s.end);m.push({from:g,to:D,direction:"forward"}),g=D;break}if(m.push({from:g,to:s.end,direction:"forward"}),S-=F,g=s.start,k=!0,A++,A>Ijt){const D=s.start+S%c;m.push({from:g,to:D,direction:"forward"}),g=D;break}}return{pos:g,intervals:m,looped:k}}function x_n(t,n,s){const c=s.end-s.start,d=s.loop&&c>tye,m=[];let g=t,S=n,k=!1,A=0;for(;;){const F=g-s.start;if(!d||S<=F+tye){const D=Math.max(g-S,s.start);m.push({from:g,to:D,direction:"reverse"}),g=D;break}if(m.push({from:g,to:s.start,direction:"reverse"}),S-=F,g=s.end,k=!0,A++,A>Ijt){const D=s.end-S%c;m.push({from:g,to:D,direction:"reverse"}),g=D;break}}return{pos:g,intervals:m,looped:k}}function cTt(t,n){return t<n.start?n.start:t>n.end?n.end:t}class w_n{_previousTime;_currentTime;_range;_timeScale;_playDirection="forward";_lastCrossingDirection="forward";_playbackState="stopped";_evaluators=[];_registrationCounter=0;constructor(n={}){const s=n.start??0,c=n.end??Math.max(s,1);if(c<s)throw new Error(`[AnimationClock] range end (${c}) must be >= start (${s})`);const d=n.timeScale??1;if(!Number.isFinite(d)||d<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${d}`);this._range={start:s,end:c,loop:n.loop??!1},this._timeScale=d,this._previousTime=s,this._currentTime=s}get time(){return this._currentTime}get previousTime(){return this._previousTime}get direction(){return this._playbackState==="playing"?this._playDirection:"paused"}get playbackState(){return this._playbackState}get timeScale(){return this._timeScale}set timeScale(n){if(!Number.isFinite(n)||n<0)throw new Error(`[AnimationClock] timeScale must be a finite number >= 0, got ${n}`);this._timeScale=n}get range(){return this._range}setRange(n){const s=n.start??this._range.start,c=n.end??this._range.end,d=n.loop??this._range.loop;if(c<s)throw new Error(`[AnimationClock] range end (${c}) must be >= start (${s})`);this._range={start:s,end:c,loop:d};const m=cTt(this._currentTime,this._range);m!==this._currentTime&&this.seek(m)}play(n){n&&(this._playDirection=n),this._playbackState="playing"}pause(){this._playbackState="paused"}stop(){this._playbackState="stopped"}seek(n){const s=cTt(n,this._range);if(s===this._currentTime)return this.emit(this._currentTime,this._currentTime,[{from:s,to:s,direction:this._lastCrossingDirection}],!1,this._lastCrossingDirection);const c=s>this._currentTime?"forward":"reverse",d=this._currentTime;return this._previousTime=d,this._currentTime=s,this._lastCrossingDirection=c,this.emit(d,s,[{from:d,to:s,direction:c}],!1,c)}seekFrame(n,s){if(!Number.isFinite(s)||s<=0)throw new Error(`[AnimationClock] seekFrame fps must be a finite number > 0, got ${s}`);return this.seek(this._range.start+n/s)}advance(n){if(this._playbackState!=="playing")return null;if(!Number.isFinite(n))throw new Error(`[AnimationClock] advance(dt) requires a finite dt, got ${n}`);const s=Math.abs(n)*this._timeScale,c=this._currentTime;if(s===0)return this.emit(c,c,[],!1,this._playDirection);const d=this._playDirection==="forward"?S_n(c,s,this._range):x_n(c,s,this._range);return this._previousTime=c,this._currentTime=d.pos,this._lastCrossingDirection=this._playDirection,this.emit(c,d.pos,d.intervals,d.looped,this._playDirection)}subscribe(n,s){if(!yZ.includes(n))throw new Error(`[AnimationClock] unknown phase "${n}". Valid: ${yZ.join(", ")}`);const c={phase:n,order:this._registrationCounter++,fn:s};return this._evaluators.push(c),{dispose:()=>{const d=this._evaluators.indexOf(c);d!==-1&&this._evaluators.splice(d,1)}}}emit(n,s,c,d,m){const g={previousTime:n,currentTime:s,direction:m,timeScale:this._timeScale,looped:d,intervals:c};if(this._evaluators.length>0){const S=[...this._evaluators].sort((k,A)=>{const F=yZ.indexOf(k.phase),D=yZ.indexOf(A.phase);return F!==D?F-D:k.order-A.order});for(const k of S)try{k.fn(g)}catch(A){console.error(`[AnimationClock] evaluator in phase "${k.phase}" threw:`,A)}}return g}}const v_e={start:0,end:0,fps:30},T_n=150;class twn{constructor(n){this.store=n,this.stopStoreWatch=n.subscribe(()=>this.notify())}clock=new w_n;subjects=[];activeId=null;listeners=new Set;settleListeners=new Set;settleTimer=null;disposed=!1;cachedSnapshot=null;stopStoreWatch;attach(n){return this.subjects.push(n),this.activeId===null?this.setActiveSubject(n.id):(n.seek(this.clock.time),this.notify()),()=>{const s=this.subjects.indexOf(n);if(s<0)return;if(this.subjects.splice(s,1),this.activeId!==n.id){this.notify();return}this.activeId=null;const c=this.subjects[0];c?this.setActiveSubject(c.id):(this.clock.setRange({start:v_e.start,end:v_e.end,loop:!1}),this.notify())}}setActiveSubject(n){const s=this.subjects.find(d=>d.id===n);if(!s)return;this.activeId=n;const c=s.range();this.clock.setRange({start:c.start,end:c.end}),this.applyTime(this.clock.time),this.notify()}get active(){return this.subjects.find(n=>n.id===this.activeId)??null}fps(){return this.active?.range().fps??v_e.fps}get driver(){return this.store.playState==="stopped"?"editor":"world"}assertEditorDrives(){if(this.driver==="world")throw new Error("transport: the world is driving time (Play); pause the game to scrub")}play(n="forward"){this.assertEditorDrives(),this.active&&(this.cancelSettle(),this.clock.play(n),this.notify())}pause(){this.assertEditorDrives(),this.clock.pause(),this.cancelSettle(),this.settle(),this.notify()}stop(){this.assertEditorDrives(),this.clock.pause(),this.cancelSettle(),this.applyTime(this.clock.seek(this.clock.range.start).currentTime),this.clock.stop(),this.settle(),this.notify()}seek(n){this.assertEditorDrives(),this.applyTime(this.clock.seek(n).currentTime),this.clock.playbackState!=="playing"&&this.scheduleSettle(),this.notify()}seekFrame(n){this.seek(n/this.fps())}setLoop(n){this.clock.setRange({loop:n}),this.notify()}setTimeScale(n){this.clock.timeScale=n,this.notify()}tick(n){if(this.disposed||this.driver==="world"||this.clock.playbackState!=="playing")return 0;const s=this.clock.time,c=this.clock.advance(n);return c?(this.applyTime(c.currentTime),this.notify(),c.looped?Math.abs(n)*this.clock.timeScale:c.currentTime-s):0}applyTime(n){const s=this.active;s&&s.seek(n);for(const c of this.subjects)c!==s&&c.seek(n)}onSettled(n){return this.settleListeners.add(n),()=>{this.settleListeners.delete(n)}}scheduleSettle(){this.cancelSettle(),this.settleTimer=setTimeout(()=>{this.settleTimer=null,this.settle()},T_n)}cancelSettle(){this.settleTimer!==null&&(clearTimeout(this.settleTimer),this.settleTimer=null)}settle(){if(this.disposed)return;const n=this.clock.time;for(const s of[...this.settleListeners])s(n)}snapshot(){const n=this.cachedSnapshot;if(n)return n;const s=this.active?.range()??v_e,c={time:this.clock.time,range:{start:this.clock.range.start,end:this.clock.range.end,fps:s.fps,loop:this.clock.range.loop},playbackState:this.clock.playbackState,timeScale:this.clock.timeScale,activeSubject:this.activeId,subjects:this.subjects.map(d=>({id:d.id,label:d.label})),driver:this.driver};return this.cachedSnapshot=c,c}activeClips(){const s=this.active?.clips?.();return s&&s.length>1?s:null}setActiveClip(n){this.assertEditorDrives(),this.active?.setClip?.(n);const s=this.active?.range();s&&this.clock.setRange({start:s.start,end:s.end}),this.applyTime(this.clock.time),this.notify()}subscribe(n){return this.listeners.add(n),()=>{this.listeners.delete(n)}}notify(){this.cachedSnapshot=null;for(const n of[...this.listeners])n()}dispose(){this.disposed=!0,this.stopStoreWatch(),this.cancelSettle(),this.clock.stop(),this.subjects.length=0,this.activeId=null,this.listeners.clear(),this.settleListeners.clear()}}const Eme=new Map,$je=new Set;function lTt(){for(const t of[...$je])t()}function rwn(t,n){return Eme.set(t,n),lTt(),()=>{Eme.get(t)===n&&(Eme.delete(t),lTt())}}function C_n(t){return t===null?null:Eme.get(t)??null}function E_n(t){return $je.add(t),()=>{$je.delete(t)}}let kme=null;function nwn(t){return kme=t,()=>{kme===t&&(kme=null)}}function xve(){return kme}const Njt="__volterWorkspacePersistenceSuppressed";function Ojt(){return globalThis}function Rjt(t){Ojt()[Njt]=t}function k_n(){return Ojt()[Njt]===!0}function Fjt(){return(See()?.immersivePlay??!1)&&!NR().play?.keepPanelsVisible}const Mjt={phase:"idle",flightDone:!1,gameReady:!1};function A_n(t,n){const s=t.flightDone||n==="flight-done",c=t.gameReady||n==="game-ready";return s&&c?{phase:"crossfade",flightDone:s,gameReady:c}:s?{phase:"holding",flightDone:s,gameReady:c}:{...t,flightDone:s,gameReady:c}}function D_n(t,n){if(n==="stop")return Mjt;switch(t.phase){case"idle":return n==="start"?{phase:"entering",flightDone:!1,gameReady:!1}:n==="start-reduced"?{phase:"playing",flightDone:!0,gameReady:!0}:t;case"entering":return A_n(t,n);case"holding":return n==="game-ready"?{...t,phase:"crossfade",gameReady:!0}:t;case"crossfade":return n==="crossfade-done"?{...t,phase:"playing"}:t;case"playing":return t}}const P_n=450,I_n=220,jjt=250;function N_n(t){t.style.setProperty("--volter-play-dissolve-duration",`${P_n}ms`),t.style.setProperty("--volter-play-materialize-duration",`${I_n}ms`),t.style.setProperty("--volter-play-crossfade-duration",`${jjt}ms`)}let SD=null;function O_n(t){return SD=t,typeof document<"u"&&N_n(document.documentElement),()=>{SD===t&&(SD=null)}}function Ljt(){return typeof window<"u"&&(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1)}let Qk=null;function R_n(){return Qk?.state.phase??"idle"}const Ame=new Set;function Bjt(){if(Ame.size===0)return;const t=[...Ame];Ame.clear();for(const n of t)n()}function F_n(t){if(!Qk||Qk.state.phase==="playing"){t();return}Ame.add(t)}function M_n(t,n,s){const c=setTimeout(()=>{t.timeouts.delete(c),s()},n);t.timeouts.add(c)}function gB(t){const n=Qk;if(!n)return;const s=n.state,c=D_n(s,t);c!==s&&(n.state=c,c.phase==="crossfade"&&s.phase!=="crossfade"&&(SD?.root.classList.add("volter-play-crossfade"),M_n(n,jjt+30,()=>gB("crossfade-done"))),c.phase==="playing"&&s.phase!=="playing"&&(SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),n.flying&&xve()?.settle(),Bjt()))}function j_n(){L_n({immersive:Fjt()})}function L_n(t){if(Qk&&oUe(),!t.immersive)return;const n=Ljt();Rjt(!0);const s={state:Mjt,reducedMotion:n,flying:!1,timeouts:new Set};if(Qk=s,SD?.hideChrome(!n),n){gB("start-reduced");return}if(gB("start"),s.flying=xve()?.begin(()=>{Qk===s&&gB("flight-done")})??!1,!s.flying){gB("flight-done");return}SD?.root.classList.add("volter-play-flight")}function B_n(t,n){(!t||!n)&&oUe()}function $_n(t){const n=Qk;n&&(n.flying&&t&&xve()?.track(t),gB("game-ready"))}function oUe(){const t=Qk;if(t){Qk=null;for(const n of t.timeouts)clearTimeout(n);t.timeouts.clear(),Bjt(),SD?.root.classList.remove("volter-play-flight","volter-play-crossfade"),t.flying&&xve()?.end(),SD?.showChrome(!Ljt()),Rjt(!1)}}const qje=new Set;let $jt=null;function qjt(){return of()?.rootPath??null}function q_n(t){qje.add(t);const n=qjt();return n!==null&&$jt===n&&t(),()=>{qje.delete(t)}}async function iwn(){$jt=qjt();for(const t of[...qje])await t()}function z_n(){const t=e_();if(t===null)return null;const n=cQ(t);if(typeof n!="object"||n===null)return null;const s=n.stageMode;if(typeof s!="function")return null;const c=s.call(n);return typeof c=="string"?c:null}let zje=null;function V_n(t){zje=t}function uTt(){if(!zje)throw new Error("The workbench Output service is not connected.");return zje}function U_n(){eDr(e_),e4r({output:{write:(...t)=>uTt().write(...t),show:t=>uTt().show(t)},console:{log:(t,n)=>ea.log(t,n),warn:(t,n)=>ea.warn(t,n),error:(t,n)=>ea.error(t,n)},live:{register:QFt,mounted:_Ve,playing:rve,runWindow:aVe,restartRequired:XFt,restart:YFt,subscribe:hVe,version:t9t,notifyChanged:KFt,snapshotFrame:lVe,frameCanvas:cVe,authoringRefusal:pVe,dispatch:uVe,scenes:fVe,surface:tve,coverage:dVe},viewport:{transition:{begin:j_n,ready:$_n,end:oUe,onSettled:F_n,phase:R_n}},hierarchy:{subscribe:t=>{const n=o_e(t),s=Ih()?.subscribe(t);return()=>{n(),s?.()}},version:()=>{const t=Ih();return t?.getShellSnapshot?.()??t?.getSnapshot()??0}},session:{beginWork:wBe,reportFacet:$rn,onSample:Tnn,onCommandDispatched:jYr,playState:()=>Ih()?.playState??"stopped",playEditRegime:()=>Ih()?.playEditRegime??null,subscribe:t=>{const n=o_e(t),s=Ih()?.subscribe(t);return()=>{n(),s?.()}},version:()=>{const t=Ih();return t?.getShellSnapshot?.()??t?.getSnapshot()??0},open:()=>Ih()!==null,onEnded:t=>Oze(n=>{n!==null&&t()}),onBeforeClose:rnn,reportWorkerCallMeter:Wsn},project:{documentTable:Fen,mounts:l$,engineVersion:()=>of()?.config.engine.version??null,subscribe:Rw,onReady:q_n},notify:t=>s$(t),systems:{inspected:Cye,subscribe:Bwr,inspectedNetworking:Vwr,subscribeNetworking:Uwr,inspectedAudio:()=>Jwr()??null,subscribeAudio:Wwr,audioVersion:Hwr},availability:{subscribe:HVe,version:Eun},workspace:{showUtility:bC,openContributedDocument:t=>tA(t),open:async t=>await Wye(t.kind,Ih()??{},t)!==null,liveDocument:{id:a0,register:ctn,acquire:dtn,release:Zze,open:iq,container:ltn,setContainer:utn,releaseContainer:ftn}},documents:{activeId:e_,active:()=>{const t=CC();return t?{id:t.descriptor.id,kind:t.descriptor.kind,title:t.title}:null},subscribe:i2,version:X1,context:cQ,waitForContext:p4t,contextChanged:UCr,captureActive:t=>{const n=Ih();return n?h9t(n,t):Promise.reject(new Error("No editor session is open to capture a document from."))}},transport:{for:t=>C_n(t),subscribe:E_n},projectLocalState:{ready:lte,read:vve,write:bve,projectRootPath:()=>of()?.rootPath??null},history:{record:QPt,setDelegate:Z4r,onElement:rDr,invalidate:nDr,onInvalidated:iDr,changed:Q4r,elements:tDr,focusedResource:()=>{const t=CC();if(!t)return null;const n=t.descriptor.provenance?.sourcePath;if(n)return n;const s=Ih();return s?OYr(s)??Dze(s):null},undo:()=>Ih()?.projectHistory?.undo()??Promise.resolve(!1),redo:()=>Ih()?.projectHistory?.redo()??Promise.resolve(!1),canUndo:()=>Ih()?.projectHistory?.getSnapshot().canUndo??!1,canRedo:()=>Ih()?.projectHistory?.getSnapshot().canRedo??!1,undoLabel:()=>Ih()?.projectHistory?.getSnapshot().undoLabel??null,redoLabel:()=>Ih()?.projectHistory?.getSnapshot().redoLabel??null,subscribe:t=>{const n=ZPt(t),s=o_e(t),c=Ih()?.projectHistory?.subscribe(t),d=i2(t);return()=>{n(),s(),c?.(),d()}}},files:{setProvider:E4r,read:t=>Ag.read(t),readBytes:t=>Ag.readBytes(t),write:(t,n)=>Ag.write(t,n),exists:t=>Ag.exists(t),list:t=>Ag.list(t),watch:t=>Ag.watch(t)},settings:{setProvider:CEr,get:IEr,set:OEr,inspect:U4t,subscribe:t=>{const n=$4t(t),s=bee(t);return()=>{n(),s()}}},keyboard:{actions:()=>Fan().map(({id:t,scope:n})=>({id:t,scope:n})),keymaps:()=>W4t().map(({id:t,title:n})=>({id:t,title:n,chords:Z4t(t)})),activeKeymap:dR,invoke:t=>RVe(t),subscribe:t=>{const n=jan(t),s=Uye(t),c=o_e(t),d=Ih()?.subscribe(t),m=i2(t);return()=>{n(),s(),c(),d?.(),m()}},version:()=>Man()+X1(),stage:()=>{const t=Ih();return t?{surface:Rfn(t).surface,mode:z_n()}:{surface:null,mode:null}},bindActions:Uan,chordsFor:OBe,shortcutFor:t=>Vv(t)??null}})}let J_n=0,cee=null;const Vje=new Set;function fTt(t){const n={generation:++J_n,promise:t,active:!0};cee=n;for(const s of Vje)s(n);return Vje.clear(),n}function W_n(){const t=cee;return t?.active?Promise.resolve(t):new Promise(n=>Vje.add(n))}async function sUe(){for(;;){const t=await W_n();if(await t.promise,cee===t&&t.active)return}}const zjt=16,H_n=300,G_n=1e4,Vjt="workspace";function K_n(){const t=vve(Vjt);return!t||t.version!==zjt?null:t}function X_n(t){bve(Vjt,t)}function Y_n(t){const{descriptor:n}=t;if(!n.persist)return null;let s;try{s=n.persist({id:n.id,title:t.title})}catch{return null}if(s==null)return null;const c=SAr(n.id);return{kind:n.kind,id:n.id,state:s,...Object.keys(c).length>0?{presentation:c}:{}}}function Z_n(){const t={};let n=!1;for(const s of lDt()){if(!s.persistKindState)continue;let c;try{c=s.persistKindState()}catch{continue}c!=null&&(t[s.kind]=c,n=!0)}return n?t:void 0}function Q_n(){const t=[];for(const s of l0()){const c=Y_n(s);c&&t.push(c)}const n=Z_n();return{version:zjt,workspace:zS(),documents:{open:t,activeId:e_(),...n?{kinds:n}:{}}}}async function emn(t,n,s){for(const c of cDt(n.kind))try{if(await c.restore({id:n.id,state:n.state,active:n.id===s&&!HQ(),store:t}))return!0}catch{}return!1}function dTt(t){if(!t)return!1;const n=!HQ();return SN(t,n)?!0:itn.has(t)?(wFt(t),n&&_Tr(t),!0):n&&X0(t)}function tmn(t,n){const s=n?.kinds??{},c=(n?.open.length??0)>0;for(const d of lDt())if(d.beginRestore)try{d.beginRestore({state:s[d.kind],hasDocumentsToRestore:c,documentsToRestore:(n?.open??[]).map(m=>({kind:m.kind,state:m.state})),store:t})}catch{}}function rmn(t){const n=new Set;for(const s of t)for(const c of cDt(s.kind))c.prepare&&n.add(c.prepare);return Promise.all([...n].map(s=>s().catch(()=>{})))}async function nmn(t,n){const s=n?.documents;if(tmn(t,s),!s||s.open.length===0){dTt(s?.activeId??null);return}await rmn(s.open);for(const c of s.open){const d=c.presentation;d&&typeof d=="object"&&!Array.isArray(d)&&xAr(c.id,d),await emn(t,c,s.activeId)}dTt(s.activeId)}function Ujt(t){if(!lte()||of()&&!u0()){let se=!1,pe=null,ue=()=>{};const Ce=new Promise(De=>{ue=De}),Fe=fTt(Ce);return Promise.all([cte(),Gze()]).then(()=>{if(se){ue();return}pe=Ujt(t),Fe.active=!1,sUe().finally(ue)}),()=>{se=!0,pe?.()}}const n=K_n();n?.workspace&&kB(n.workspace)&&Uk(n.workspace)?s2(n.workspace):(n?.workspace&&Tkr(n.workspace),s2(pR(),{provisional:!0}));let s=!1,c=null;const d=[],m=()=>{c!==null&&(clearTimeout(c),c=null),!(k_n()||t.playState!==void 0&&t.playState!=="stopped")&&X_n(Q_n())},g=()=>{c!==null&&clearTimeout(c),c=setTimeout(m,H_n)},S=()=>m();let k=null;const A=typeof window<"u"&&rCt(window.location.href)!==null,F=A||!(n?.documents?.open.length??0)?Promise.resolve():mN().catch(()=>{}),D=F.then(()=>A?void 0:nmn(t,n)).catch(()=>{}),J=new Promise(se=>{F.then(()=>{s||(k=setTimeout(()=>{se()},G_n))})}),q=Promise.race([D,J]).then(()=>{k!==null&&clearTimeout(k),!s&&(d.push(i2(g)),d.push(EAr(g)),window.addEventListener("pagehide",S))}),G=fTt(q);return()=>{s=!0,G.active=!1,cee===G&&(cee=null),k!==null&&clearTimeout(k);for(const se of d)se();window.removeEventListener("pagehide",S),c!==null&&m()}}function imn(t){Ye.useEffect(()=>{const n=rCt(window.location.href);if(!n)return;let s=!1;const c=Em(),d=()=>!s&&Em()===c;return sUe().then(()=>{if(d())return Bge(t,n,{updateUrl:!1,origin:"link"})}).catch(m=>{ea.error(`Could not restore shared editor view: ${m instanceof Error?m.message:String(m)}`,"editor")}),()=>{s=!0}},[t])}const pTt="volter:stale-chunk-reload";function omn(){typeof window>"u"||window.addEventListener("vite:preloadError",t=>{let n=0;try{n=Number(sessionStorage.getItem(pTt)??0)}catch{}if(!(Date.now()-n<6e4)){try{sessionStorage.setItem(pTt,String(Date.now()))}catch{}t.preventDefault(),window.location.reload()}})}const jI=[];function smn(t){const n=jI.findIndex(s=>s.owner===t.owner&&s.id===t.id);return n>=0&&jI.splice(n,1),jI.push(t),jI.sort((s,c)=>(s.order??0)-(c.order??0)),()=>{const s=jI.indexOf(t);s>=0&&jI.splice(s,1)}}function own(t,n,s){const c=new Map,d={surface:t,store:n},m=g=>{const S=s(g);if(!S)return null;for(const k of jI){const A=k.statesFor(S,d);if(A.length>0)return{source:k,states:A}}return null};return{storiesFor:g=>[...m(g)?.states??[]],active:g=>c.get(g)??null,apply:(g,S)=>{if(S===null){c.delete(g),n.notifyIngestEdit();return}const k=m(g);if(!k?.states.some(F=>F.id===S)){ea.warn(`[component-states] stories.apply: state "${S}" does not belong to node "${g}" on the ${t} surface — ignoring.`,"authoring");return}const A=s(g);A&&(c.set(g,S),k.source.apply(A,S,d),n.notifyIngestEdit())},unavailable:()=>jI.length>0?null:"No package in this editor registered a source of component states, so this component's named states could not be read."}}class swn extends Error{name="StoryMediumMismatch"}function awn(t){return t instanceof Error&&t.name==="StoryMediumMismatch"}const Dme=new Map;function cwn(t,n){return Dme.set(t,n),()=>{Dme.get(t)===n&&Dme.delete(t)}}function amn(t){return Dme.get(t)??null}function cmn(t,n){const s=[];for(const c of Object.keys(n).sort())s.push(`${c}=${lmn(n[c])}`);return`${t}|${s.join("&")}`}function lmn(t){if(typeof t=="function")return"fn";if(typeof t=="symbol")return"symbol";if(t===void 0)return"undefined";try{return JSON.stringify(t)??"undefined"}catch{return`[${typeof t}]`}}const rye=new Map,b_e=new Map,_Tt=new WeakMap;let mTt=Promise.resolve(),hTt=null,umn=1;function fmn(){return typeof WebGLRenderingContext<"u"&&typeof navigator<"u"&&!navigator.userAgent.toLowerCase().includes("jsdom")}async function dmn(){await Promise.race([Nye(),new Promise(t=>setTimeout(t,5e3))]),await Promise.race([new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(()=>t()))),new Promise(t=>setTimeout(t,250))]),await new Promise(t=>setTimeout(t,750)),await new Promise(t=>{const n=globalThis.requestIdleCallback;if(typeof n=="function"){n(()=>t(),{timeout:2e3});return}setTimeout(t,0)})}function pmn(){return hTt??=dmn(),hTt}function _mn(t){const n=_Tt.get(t);if(n!==void 0)return n;const s=umn++;return _Tt.set(t,s),s}function mmn(t,n,s,c){const d=rye.get(t);if(d)return Promise.resolve(d);const m=b_e.get(t);if(m)return m;const g=mTt.then(async()=>{await pmn();const S=s.parameters.layout,k=S==="fullscreen"||S==="padded"||S==="centered"?S:"padded",A={...c,props:s.args,layout:k},F=amn(n==="canvas"?"canvas":"three");if(!F)throw new Error(`No ${n} story capture is registered.`);return F(s.Component,A)});return mTt=g.then(()=>{},()=>{}),b_e.set(t,g),g.then(S=>{rye.set(t,S),b_e.delete(t)},()=>b_e.delete(t)),g}function hmn({component:t,story:n,previewRevision:s,width:c=128,height:d=96}){const m=n.Component,g=`${t.surface}:${t.path}:${cmn(n.id,n.args)}:${_mn(m)}:${s}:${c}x${d}`,[S,k]=Ye.useState(()=>rye.get(g)),[A,F]=Ye.useState(!1);return Ye.useEffect(()=>{let D=!1;if(F(!1),k(rye.get(g)),!!fmn())return mmn(g,t.surface,n,{width:c,height:d}).then(J=>{D||k(J)},()=>{D||F(!0)}),()=>{D=!0}},[t.surface,d,g,n,c]),S?$.jsx("img",{src:S,alt:`${t.name} preview`,className:"volter-component-thumbnail"}):$.jsx("span",{className:"volter-component-thumbnail-fallback","data-component-preview":A?"failed":"capturing-story",children:$.jsx(wR,{kind:"component",name:t.name})})}const wve="story:three",Tve="story:isolated",gmn="story:docs";function ymn(t,n){return t.surface==="dom"?!1:n===null||t.surface===n}function vmn({entry:t,previewRevision:n,width:s,height:c}){const d=t.detail;return $.jsx(hmn,{component:t.component,story:d,previewRevision:n,...s===void 0?{}:{width:s},...c===void 0?{}:{height:c}})}const bmn="story",Smn={id:bmn,owner:"./component-content-source",entries(t){const n=rq(),s=[];for(const c of t.components){if(!ymn(c,t.surface))continue;const d=bRt(n,c.name,c.path);d&&s.push({id:`${c.path}:${c.name}`,component:c,detail:d})}return s},subscribe:V0e,Thumbnail:vmn,open(t,n,s){const c=n.detail,d=n.component.surface==="three";CD(d?wve:Tve,t,d?{modulePath:c.modulePath,storyName:c.name,title:s}:{modulePath:c.modulePath,storyName:c.name})}};function gTt(t){return dYr(t.name,t.sourcePath)}const xmn={id:"portable-csf",owner:"./component-states",statesFor:(t,n)=>n.surface==="dom"?[]:gTt(t).map(s=>({id:s.id,label:s.label})),apply:(t,n,s)=>{const c=gTt(t).find(d=>d.id===n);if(c){if(s.surface==="three"){CD(wve,s.store,{modulePath:c.modulePath,storyName:c.name,title:c.label});return}if(s.surface==="canvas"){CD(Tve,s.store,{modulePath:c.modulePath,storyName:c.name});return}ea.warn(`[portable-csf] no story document is registered for the "${s.surface}" surface, so state "${n}" of "${t.name}" could not be opened.`,"authoring")}}};function wmn(){let t=0,n=!1;const s=S=>{const k=++t;oYr(),Nye().then(()=>{if(!(n||k!==t))return hYr(of(),void 0,{deferUndeclared:!0,...S?{changedPaths:S}:{}})})};s();let c=null;const d=bFt(),m=Rw(()=>s()),g=aen(s);return()=>{n=!0,t+=1,c!==null&&clearTimeout(c),d(),m(),g()}}const Jjt="story",IOe=new Set,NOe=new Set;function Tmn(t){const n=_Rt({modulePath:t.modulePath,title:t.title}).leaf;return n===t.label?n:`${n} · ${t.label}`}function OOe(t){for(const n of rq())if(n.ok){for(const s of n.stories)if(t.storyId===void 0?n.modulePath===t.modulePath&&s.name===t.storyName:s.id===t.storyId)return{modulePath:n.modulePath,storyName:s.name,title:t.title??Tmn({modulePath:n.modulePath,title:s.title,label:s.label})}}return null}function Cmn(t,n,s){const c={modulePath:s.modulePath,storyName:s.storyName,title:s.title,...n.activate===void 0?{}:{activate:n.activate}};if(n.mode==="docs")return CD(gmn,t,c);const d=Cze({modulePath:s.modulePath,regions:Tze()});return d.medium===void 0?(iYr(s.modulePath,d.reason),null):CD(d.medium==="three"?wve:Tve,t,c)}function yTt(t){ea.warn(`No composed portable story carries the id ${JSON.stringify(t)}, so nothing opened it.`,"editor")}function Emn(){return kN({id:Jjt,owner:"./story-opener",open:(t,n)=>{const s=OOe(n);return s?Cmn(t,n,s):(n.modulePath?IOe.add(n.modulePath):n.storyId!==void 0&&(NOe.add(n.storyId),lYr()&&yTt(n.storyId)),null)},settle:async()=>{await DDr();const t=[...IOe],n=[...NOe];if(IOe.clear(),NOe.clear(),await Promise.all(t.map(s=>pYr(of(),s))),n.length!==0){await uYr();for(const s of n)OOe({storyId:s})||yTt(s)}},ready:async(t,n)=>{if(n.mode==="docs")return;const s=OOe(n);if(!(!s||Cze({modulePath:s.modulePath,regions:Tze()}).medium!=="three")&&!await EC(()=>o2(t)!==null,PR))throw new Error(`The requested Object3D view did not mount for document: ${t}`)}})}const kmn={actions:()=>{if(!egt(Tve)&&!egt(wve))return[];const t=[];for(const n of rq()){if(!n.ok)continue;const s=n.modulePath.split("/").pop()??n.modulePath;for(const c of n.stories)t.push({id:`story:${c.id}`,label:`Open Story: ${c.name} — ${s}`,execute:()=>void n0().workspace.open({kind:Jjt,modulePath:n.modulePath,storyName:c.name,title:c.name})})}return t},subscribe:t=>V0e(t)};function Amn(t,n){if(n===void 0)return;const s=n;return s===null||typeof s!="object"||typeof s.azimuthDegrees!="number"||!Number.isFinite(s.azimuthDegrees)||typeof s.elevationDegrees!="number"||!Number.isFinite(s.elevationDegrees)||s.elevationDegrees<-90||s.elevationDegrees>90||s.distance!==void 0&&(typeof s.distance!="number"||!Number.isFinite(s.distance)||s.distance<=0)?`${t} camera must be {azimuthDegrees, elevationDegrees in [-90, 90], distance? > 0 meters}.`:{azimuthDegrees:s.azimuthDegrees,elevationDegrees:s.elevationDegrees,...s.distance===void 0?{}:{distance:s.distance}}}function Dmn(t,n){if(n===void 0)return;const s=n;return s===null||typeof s!="object"||typeof s.clip!="string"||s.clip.length===0||typeof s.timeSeconds!="number"||!Number.isFinite(s.timeSeconds)||s.timeSeconds<0?`${t} pose must be {clip: non-empty string, timeSeconds >= 0}.`:{clip:s.clip,timeSeconds:s.timeSeconds}}const Pmn="packages/editor-core/src/stories/story-capture-command.ts",nB="capture-story-variants";async function Imn(t){if(document.visibilityState==="hidden")return{ok:!1,error:"story capture needs a PRESENTING tab — the editor tab is hidden, so the browser suspends the frames a story mount must paint. Bring the editor tab to the foreground (or unminimize its window) and re-run."};const n=t.modulePath;if(typeof n!="string"||n==="")return{ok:!1,error:`${nB} requires a project-relative modulePath.`};const s=t.story;if(s!==void 0&&typeof s!="string")return{ok:!1,error:`${nB} story must be a CSF export name.`};const c=(d,m,g)=>{if(d===void 0)return m;if(typeof d!="number"||!Number.isInteger(d)||d<64||d>1024)throw new Error(`${nB} ${g} must be an integer from 64 to 1024.`);return d};try{const d=await(async()=>{try{const D=await IZr("volter.project.json");if(!D)return null;const J=JSON.parse(D),q=J.resolution?.width,G=J.resolution?.height;return typeof q!="number"||typeof G!="number"||q<64||G<64||q>4096||G>4096?null:{width:Math.min(1024,Math.round(q)),height:Math.min(1024,Math.round(G))}}catch{return null}})(),m=c(t.width,d?.width??960,"width"),g=c(t.height,d?.height??540,"height"),S=Amn(nB,t.camera);if(typeof S=="string")return{ok:!1,error:S};const k=Dmn(nB,t.pose);if(typeof k=="string")return{ok:!1,error:k};const{captureProjectStoryVariants:A}=await fo(async()=>{const{captureProjectStoryVariants:D}=await import("./story-capture-BZD3x0Pr.js");return{captureProjectStoryVariants:D}},__vite__mapDeps([266,267,1,2,3,4,20,21,231,210,268,22,23]));return{ok:!0,data:{...await A(of(),{modulePath:n,...s===void 0?{}:{story:s},width:m,height:g,...S?{camera:S}:{},...k?{pose:k}:{}})}}}catch(d){return{ok:!1,error:d instanceof Error?d.message:String(d)}}}const Nmn={[nB]:{timeoutMs:12e4,derivedRefresh:"if-content-changed",handle:Imn}};function Omn(){const t=hin(Smn),n=smn(xmn),s=Emn(),c=uCt(kmn),d=dCt(Pmn,Nmn),m=wmn(),g=V0e(()=>{BB()});return()=>{g(),m(),d(),c(),s(),n(),t()}}const Rmn=[["descriptionForeground","--volter-content-dim"],["disabledForeground","--volter-content-placeholder"],["errorForeground","--volter-danger"],["focusBorder","--volter-accent"],["selection.background","--volter-accent","99"],["sash.hoverBorder","--volter-accent"],["menubar.selectionBackground","--volter-accent"],["menubar.selectionForeground","--volter-content-on-accent"],["menu.selectionBackground","--volter-accent"],["menu.selectionForeground","--volter-content-on-accent"],["editorGroupHeader.tabsBackground","--volter-surface-chrome"],["editorGroup.dropBackground","--volter-accent","66"],["tab.inactiveBackground","--volter-surface-chrome"],["tab.inactiveForeground","--volter-content-dim"],["editor.background","--volter-surface-chrome"],["editorLineNumber.foreground","--volter-content-placeholder"],["editor.selectionBackground","--volter-accent","99"],["editorGutter.background","--volter-surface-chrome"],["panelTitle.inactiveForeground","--volter-content-dim"],["list.activeSelectionBackground","--volter-accent"],["list.activeSelectionForeground","--volter-content-on-accent"],["list.focusOutline","--volter-accent"],["list.dropBackground","--volter-accent","66"],["button.background","--volter-accent"],["button.foreground","--volter-content-on-accent"],["checkbox.selectBackground","--volter-accent"],["input.background","--volter-surface-chrome"],["input.placeholderForeground","--volter-content-placeholder"],["inputOption.activeBackground","--volter-accent"],["inputOption.activeForeground","--volter-content-on-accent"],["inputValidation.errorBorder","--volter-danger"],["badge.background","--volter-accent"],["badge.foreground","--volter-content-on-accent"],["progressBar.background","--volter-accent"],["quickInputList.focusBackground","--volter-accent"],["quickInputList.focusForeground","--volter-content-on-accent"],["notificationsErrorIcon.foreground","--volter-danger"],["notificationsWarningIcon.foreground","--volter-warn"],["notificationsInfoIcon.foreground","--volter-accent"],["terminal.background","--volter-surface-chrome"],["commandCenter.background","--volter-surface-chrome"],["volter.view.background","--volter-surface-panel"],["foreground","--volter-content-primary"],["icon.foreground","--volter-content-muted"],["widget.border","--volter-boundary-default"],["titleBar.activeBackground","--volter-surface-shell"],["titleBar.inactiveBackground","--volter-surface-shell"],["titleBar.activeForeground","--volter-content-muted"],["titleBar.border","--volter-surface-shell"],["activityBar.background","--volter-surface-shell"],["activityBar.foreground","--volter-content-primary"],["activityBar.inactiveForeground","--volter-content-dim"],["activityBar.border","--volter-surface-shell"],["activityBar.activeBorder","--volter-accent"],["statusBar.background","--volter-surface-shell"],["statusBar.foreground","--volter-content-muted"],["statusBar.border","--volter-surface-shell"],["sideBar.background","--volter-surface-panel"],["sideBar.foreground","--volter-content-primary"],["sideBar.border","--volter-boundary-default"],["sideBarSectionHeader.background","--volter-surface-chrome"],["panel.background","--volter-surface-panel"],["panel.border","--volter-boundary-default"],["editorGroup.border","--volter-boundary-default"],["editorGroupHeader.tabsBorder","--volter-boundary-default"],["tab.activeBackground","--volter-surface-panel"],["tab.activeForeground","--volter-content-primary"],["tab.border","--volter-boundary-default"],["menu.background","--volter-widget-menu"],["menu.foreground","--volter-content-menu"],["menu.border","--volter-boundary-default"],["dropdown.background","--volter-widget-menu"],["dropdown.border","--volter-boundary-default"],["input.foreground","--volter-content-primary"],["input.border","--volter-boundary-default"]],Fmn=[["volter.viewport.background","--volter-viewport-background"],["volter.viewport.grid","--volter-viewport-grid"],["volter.viewport.axisX","--volter-viewport-axis-x"],["volter.viewport.axisY","--volter-viewport-axis-y"],["volter.viewport.axisZ","--volter-viewport-axis-z"],["volter.viewport.selection","--volter-viewport-selection"],["volter.viewport.active","--volter-viewport-active"],["volter.viewport.wire","--volter-viewport-wire"],["volter.gizmo.x","--volter-gizmo-x"],["volter.gizmo.y","--volter-gizmo-y"],["volter.gizmo.z","--volter-gizmo-z"],["volter.gizmo.navigationX","--volter-gizmo-navigation-x"],["volter.gizmo.navigationY","--volter-gizmo-navigation-y"],["volter.gizmo.navigationZ","--volter-gizmo-navigation-z"],["volter.gizmo.hover","--volter-gizmo-hover"],["volter.gizmo.drag","--volter-gizmo-drag"]];function vTt(t){const n=t.trim().toLowerCase(),s=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(n)?.[1];if(s)return`#${s.length===3?[...s].map(S=>S+S).join(""):s}`;const c=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?\s*\)$/.exec(n);if(!c)return null;const d=S=>Math.max(0,Math.min(255,Math.round(Number(S)))).toString(16).padStart(2,"0"),m=c[4],g=m===void 0?"":Math.round(Math.max(0,Math.min(1,m.endsWith("%")?Number.parseFloat(m)/100:Number(m)))*255).toString(16).padStart(2,"0");return`#${d(c[1])}${d(c[2])}${d(c[3])}${g==="ff"?"":g}`}function Mmn(t){const n=getComputedStyle(t),s={};for(const[c,d,m]of Rmn){const g=vTt(n.getPropertyValue(d));g!==null&&(g.length===9&&!m||(s[c]=m&&g.length===7?`${g}${m}`:g))}for(const[c,d]of Fmn){const m=vTt(n.getPropertyValue(d));m!==null&&(s[c]=m)}return s}let xm=null,Wjt=0;const Uje=new Set;function jmn(t){return Uje.add(t),()=>Uje.delete(t)}function bTt(){return Wjt}const ROe=new Map;function Hjt(t,n){ROe.get(t)?.disconnect(),ROe.delete(t);const s=()=>{const d=n?.isConnected?n.getBoundingClientRect():null;WAr(t,d!==null&&d.width>0&&d.height>0)};if(s(),n===null||typeof ResizeObserver>"u")return;const c=new ResizeObserver(s);c.observe(n),ROe.set(t,c)}function Lmn(t,n){if(xm){if(n===null){if(xm[t]?.isConnected)return}else if(xm[t]===n)return;if(n===null&&(t==="outliner"||t==="properties"||t==="content")){const s={...xm};delete s[t],xm=s}else n!==null&&(xm={...xm,[t]:n});n!==null&&Gjt(t,n),Hjt(t,n),Wjt+=1;for(const s of Uje)s()}}function Gjt(t,n){n.dataset.volterPart=t}const HO=new Map;let Kjt=0;const Jje=new Set,Xjt=new Set;let STt=!1;function xTt(){for(const t of l0())Xjt.add(t.descriptor.id)}function Bmn(t){STt||(STt=!0,i2(xTt)),xTt(),!(!t||Xjt.has(t))&&(vtn(t)||wFt(t,!1))}function $mn(t,n){if(n){if(!HO.delete(t.id))return}else{HO.has(t.id)||Bmn(t.documentId);const s=HO.get(t.id);if(s?.element===t.element&&s.documentId===t.documentId)return;HO.set(t.id,{...t})}Kjt+=1;for(const s of[...Jje])s()}function qmn(t){return Jje.add(t),()=>{Jje.delete(t)}}function wTt(){return Kjt}function GO({children:t,row:n=!1,center:s=!1}){return $.jsx("div",{className:"volter-editor-shell volter-part",onWheel:c=>c.stopPropagation(),"data-editor-hotkey-scope":"workspace","data-editor-hotkey-fallback":!0,style:{display:"flex",flexDirection:n?"row":"column",justifyContent:s?"center":void 0,width:"100%",height:"100%",minHeight:0,minWidth:0,position:"relative",fontFamily:"var(--volter-font-sans)",fontSize:"var(--volter-font-base)",color:"var(--volter-content-primary)"},children:t})}function zmn({children:t}){return $.jsx($.Fragment,{children:t})}function Vmn(){return xm?MS.createPortal($.jsx(GO,{center:!0,children:$.jsx(Gdn,{})}),xm.header):null}function Umn(){return null}function Jmn(){const t=Ye.useRef(null);return Ye.useEffect(()=>{const n=t.current;if(n)return fjt(n),()=>tfn(n)},[]),$.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[$.jsx("div",{ref:t,className:"volter-vscode-outliner-header",style:{padding:"var(--volter-space-2) var(--volter-space-4)","--volter-hierarchy-search-basis":"100%"}}),$.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:$.jsx(vjt,{})})]})}const Pme=new Map,Wje=new Set;let Hje=0;function Wmn(t,n){if(n){if(Pme.get(t)===n)return;n.dataset.volterUtility=t,Pme.set(t,n)}else if(!Pme.delete(t))return;Hje++;for(const s of Wje)s()}const Ime=new Map,Gje=new Set;let Kje=0;function Hmn(t,n){if(n){if(Ime.get(t)===n)return;Ime.set(t,n)}else if(!Ime.delete(t))return;Kje++;for(const s of Gje)s()}function Gmn(){return Ye.useSyncExternalStore(T3t,dht,dht),Ye.useSyncExternalStore(t=>(Gje.add(t),()=>Gje.delete(t)),()=>Kje,()=>Kje),$.jsx($.Fragment,{children:[...fRe("left"),...fRe("right")].map(t=>{const n=Ime.get(t.id);if(!n)return null;const s=t.Content;return $.jsx(Ye.Fragment,{children:MS.createPortal($.jsx(s,{}),n)},t.id)})})}function Kmn(){return Ye.useSyncExternalStore(Jye,hhe,hhe),Ye.useSyncExternalStore(t=>(Wje.add(t),()=>Wje.delete(t)),()=>Hje,()=>Hje),$.jsx($.Fragment,{children:SC().map(t=>{const n=Pme.get(t.id);return n?$.jsx(Ye.Fragment,{children:MS.createPortal($.jsx(GO,{children:$.jsx(Ydn,{utility:t})}),n)},t.id):null})})}function Xmn({descriptor:t,viewId:n,slot:s,parking:c,visible:d,inspector:m}){const[g]=Ye.useState(()=>document.createElement("div"));return Ye.useLayoutEffect(()=>{g.className="volter-vscode-document-slot",g.dataset.volterDocument=t.id,g.dataset.volterArea=t.area??"",g.style.cssText=`display:${d?"flex":"none"};flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;position:relative;`},[g,t.id,t.area,d]),Ye.useLayoutEffect(()=>((s??c).appendChild(g),()=>g.remove()),[g,s,c]),MS.createPortal($.jsxs(GO,{children:[$.jsx(FMt,{descriptor:t,viewId:n,active:d,chrome:!t.area}),m&&$.jsx(Fun,{})]}),g)}let Yjt=!0;function Ymn({arrangement:t,immersivePlay:n}){const s=Yv();imn(s);const c=zVe(s);Ye.useLayoutEffect(()=>{Yjt=c.column},[c.column]);const d=HO.get(bRe()??"")?.element??xm?.center;Ye.useLayoutEffect(()=>{if(!d)return;const F=()=>Twt({x:0,y:0,width:d.clientWidth,height:d.clientHeight}),D=new ResizeObserver(F);return D.observe(d),F(),()=>{D.disconnect(),Twt(null)}},[d]),Ye.useSyncExternalStore(s.subscribe,s.getShellSnapshot??s.getSnapshot),Ye.useSyncExternalStore(i2,X1,X1),Ye.useSyncExternalStore(qmn,wTt,wTt),Ye.useSyncExternalStore(jmn,bTt,bTt),Ye.useLayoutEffect(()=>{const F=ZEr({...t?{arrangement:t}:{},...n===void 0?{}:{immersivePlay:n},playUtilities:[]});return t&&s2(t.id),kkr(),F},[t,n]);const m=s.playState!=="stopped",g=Ye.useSyncExternalStore(bee,NR).play?.keepPanelsVisible;if(Ye.useEffect(()=>{B_n(m,Fjt())},[m,n,g]),Ye.useEffect(()=>Ujt(s),[s]),!xm)return null;const S=xm.center,k=l0(),A=CC()??k[0]??null;return globalThis.__volterBridge={documents:k.map(F=>F.descriptor.id),active:A?.descriptor.id??null,workspace:t?.id??null,areas:k.flatMap(F=>F.descriptor.area?[{id:F.descriptor.id,area:F.descriptor.area}]:[]),slots:[...HO.values()].map(({id:F,documentId:D,element:J})=>({id:F,documentId:D,visible:!!J}))},$.jsxs($.Fragment,{children:[[...HO.values()].map(F=>{const D=k.find(J=>J.descriptor.id===F.documentId)?.descriptor;return D?$.jsx(Xmn,{descriptor:D,viewId:F.id,slot:F.element??void 0,parking:S,visible:!!F.element,inspector:c.card&&D.id===A?.descriptor.id},F.id):null}),k.length===0&&MS.createPortal($.jsx(GO,{children:$.jsx("div",{className:"volter-vscode-empty",children:"No document open"})}),xm.center),xm.outliner&&MS.createPortal($.jsx(GO,{children:$.jsx(Jmn,{})}),xm.outliner),xm.properties&&MS.createPortal($.jsx(GO,{children:c.column?$.jsx(GVe,{}):$.jsx(Aun,{surface:c.surface})}),xm.properties),xm.content&&MS.createPortal($.jsx(GO,{children:$.jsx(g_n,{kind:"assets"})}),xm.content),$.jsx(Kmn,{}),$.jsx(Gmn,{})]})}async function Zmn(t,n={}){xm=t,n.workspaceStorage&&GAr(n.workspaceStorage),r3r();for(const[Fe,De]of Object.entries(t))De&&Gjt(Fe,De),Hjt(Fe,De??null);t.chromeRoot.id="editor-chrome-root",APt({Frame:zmn,Header:Vmn,Footer:Umn,Workspace:Ymn,Document:Ccn}),v_n(),Fnn();const s=Fln();s&&Oln(s,Date.now())&&ea.warn(Iln(s,Date.now()),"editor"),omn(),EDr(),U_n(),Omn(),await Promise.all([V4t(),Qkr(),YDt()]),_Ar(t.chromeRoot),t.chromeRoot.classList.toggle("volter-native-menus",lee()?.nativeMenus===!0);const c=document.createElement("div");c.id="editor-root",c.className="volter-part",c.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:10;",t.chromeRoot.appendChild(c),Xje.createRoot(c).render($.jsx(Zln,{}));const d={activeKeymap:()=>n0().keyboard.activeKeymap(),invoke:Fe=>n0().keyboard.invoke(Fe),subscribe:Fe=>n0().keyboard.subscribe(Fe),facts:()=>{const Fe=n0(),De=Fe.keyboard.stage();return{surface:De.surface,mode:De.mode,documentKind:Fe.documents.active()?.kind??null,play:Fe.session.playState()}},report:(Fe,De)=>{const be=n0();Fe==="error"?be.console.error(De,"editor"):be.console.warn(De,"editor")}};let m=!1;const g={whenRestored:sUe,activeSource:()=>{const Fe=n0().documents.active();if(!Fe)return null;const De=Fe.kind==="model"&&Fe.id.startsWith("model:")?Fe.id.slice(6):"";return{kind:Fe.kind,path:De}},list:()=>l0().map(Fe=>{const De=Fe.descriptor.area?vkr().find(be=>be.id===Fe.descriptor.area):void 0;return{id:Fe.descriptor.id,title:Fe.title,...De?{area:{id:De.id,place:De.place,ratio:De.ratio}}:{}}}),activeId:()=>CC()?.descriptor.id??null,subscribe:Fe=>{m=!0;const De=i2(Fe),be=bkr(Fe);return()=>{De(),be()}},activate:(Fe,De)=>{!m&&HQ()||(De?dTr(Fe,De):X0(Fe))},close:Fe=>{if(EN(Fe))return;const De=l0().find(be=>be.descriptor.id===Fe);De&&d.report("warn",`“${De.title}” has unsaved changes, so it stayed open. Save it (⌘S) and close it again.`)},setView:(Fe,De)=>$mn(Fe,De)},S={elements:()=>n0().history.elements(),onElement:Fe=>n0().history.onElement(Fe),onInvalidated:Fe=>n0().history.onInvalidated(Fe),changed:()=>n0().history.changed(),focusedResource:()=>n0().history.focusedResource(),focusedDocument:()=>{const Fe=n0().documents.active();return Fe?{id:Fe.id,label:Fe.title}:null},setDelegate:Fe=>n0().history.setDelegate(Fe),report:d.report},k={setProvider:Fe=>n0().files.setProvider(Fe),report:d.report},A={setProvider:Fe=>n0().settings.setProvider(Fe),adapterValues:()=>[...kEr()],workbenchValues:()=>{const Fe=xm?.chromeRoot;if(!Fe)return[];const De=getComputedStyle(Fe).getPropertyValue("--volter-command-bar-height").trim(),be=Number.parseFloat(De),X=["workbench.colorCustomizations",Mmn(Fe)];return!Number.isFinite(be)||be<=0?[X]:[["window.titleBarHeight",Math.round(be)],X]},lookId:()=>DN(),notify:Fe=>{n0().notify(Fe)},subscribe:Fe=>{const De=zye(Fe),be=wDt(Fe);return()=>{De(),be()}},report:d.report},F={list:()=>Lnn().map(Fe=>({id:Fe.id,label:Fe.label,category:Fe.category,...Fe.menu?{menu:Fe.menu}:{}})),invoke:Fe=>$nn(Fe),subscribe:Fe=>Bnn(Fe),setPaletteOpener:Fe=>jnn(Fe),setCommandExecutor:Fe=>qnn(Fe),report:d.report},D={setDelegate:Fe=>WCr(Fe?{show:De=>Fe({...De,source:t3r()})}:null)},J={list:()=>IPt().map(Fe=>({view:Fe.view,title:Fe.title,verbs:Fe.verbs.map(De=>({id:De.id,...De.title?{title:De.title}:{}}))})),invoke:(Fe,De,be)=>OPt(Fe,De,be),subscribe:Fe=>NPt(Fe)},q={list:()=>SC().map((Fe,De)=>({id:Fe.id,title:Fe.title,order:Fe.order??De})),subscribe:Fe=>{let De=hhe();const be=Jye(Fe),X=HVe(()=>{const we=hhe();we!==De&&(De=we,Fe())});return()=>{be(),X()}},offerBody:(Fe,De)=>Wmn(Fe,De)};let G=!0,se=null,pe=null;drn(()=>G);const ue={setActiveStaticPanel:Fe=>Xht(wVe.find(De=>De.kind===Fe)?.kind??null),focusCompactInspector:()=>{if(Yjt)return!1;const Fe=xm?.center.querySelector('[data-testid="compact-inspector-card"]');return Fe?(Fe.tabIndex=-1,Fe.focus(),Xht("inspector"),!0):!1},setPaneActive:Fe=>{G!==Fe&&(G=Fe)},setImmersive:Fe=>{se?.(),se=null,!(!Fe||!xm)&&(se=O_n({root:xm.chromeRoot,hideChrome:()=>Fe.enter(),showChrome:()=>Fe.exit()}))},setDockCommands:Fe=>{pe?.(),pe=null,Fe&&(pe=tkr({showUtility:De=>Fe.showUtility(De),toggleUtility:De=>Fe.toggleUtility(De),ensureUtility:De=>Fe.ensureUtility(De),closeUtility:De=>Fe.closeUtility(De),showStaticPanel:De=>Fe.showStaticPanel(De),setFocus:De=>Fe.setFocus(De),toggleFocus:()=>Fe.toggleFocus(),captureUtilities:De=>{for(const be of De)Fe.showUtility(be);return()=>{for(const be of De)Fe.closeUtility(be)}},showAuxiliary:()=>ue.report("warn","Undo history has no panel under the VS Code frame: the stack is the workbench's own (U4), reached through Edit → Undo/Redo and the Timeline.")}))},report:(Fe,De)=>d.report(Fe,De)};return{host:c,keyboard:d,documents:g,history:S,files:k,commands:F,notifications:D,views:J,utilities:q,output:{setProvider:V_n},settings:A,status:{list:()=>["left","right"].flatMap(Fe=>fRe(Fe).map((De,be)=>({id:De.id,title:De.name,align:Fe,order:De.order??be}))),subscribe:Fe=>T3t(Fe),offerBody:(Fe,De)=>Hmn(Fe,De)},game:ue,offerPart:Lmn}}function Qmn(t){const n=Object.keys(t.packages);return s0r({id:t.id,packages:n,look:t.look,workspace:t.workspace,nativeMenus:t.nativeMenus,logo:t.logo}),ODt(n.flatMap(s=>t.packages[s]??[])),{mountVolter:Zmn}}const{mountVolter:lwn}=Qmn({id:"game-editor",packages:{"@volter/editor-game":r0r,"@volter/editor-react":n0r,"@volter/editor-threejs":i0r,"@volter/editor-xstate":o0r,"@volter/editor-blender":t0r},look:"classic",workspace:"game",logo:"https://brand.volter.ai/logo/volter-game-editor/svg",nativeMenus:!0});export{hSn as $,_3t as A,DB as B,m3t as C,h3t as D,u0 as E,OC as F,Xze as G,nRe as H,iSn as I,D2n as J,Yv as K,Ih as L,UXr as M,p3t as N,ea as O,f3t as P,Jl as Q,g3t as R,Pwr as S,G0n as T,VFt as U,Vtn as V,ZLe as W,HFt as X,L_ as Y,CN as Z,fo as _,XY as a,l2n as a$,Ms as a0,dc as a1,Kk as a2,K0n as a3,bC as a4,Bgn as a5,Usn as a6,Yan as a7,eSn as a8,Wze as a9,hy as aA,oq as aB,fMt as aC,M3r as aD,nSn as aE,Vxn as aF,i0n as aG,F_e as aH,w0n as aI,gAr as aJ,_p as aK,dm as aL,Zm as aM,iwn as aN,Q0e as aO,l0 as aP,wFt as aQ,TD as aR,Hyn as aS,RCr as aT,H0e as aU,PRt as aV,Nze as aW,ISn as aX,Zf as aY,I9t as aZ,a2n as a_,MB as aa,$wr as ab,e9t as ac,Wbn as ad,o0n as ae,Go as af,zgn as ag,Eye as ah,qun as ai,G0e as aj,Uwr as ak,Bxn as al,V0e as am,rq as an,Cze as ao,Tze as ap,iYr as aq,lan as ar,f$e as as,Ftn as at,fRt as au,jtn as av,of as aw,Y0 as ax,mp as ay,O0n as az,QLe as b,S2n as b$,L4r as b0,c2n as b1,yC as b2,S$e as b3,bTr as b4,X7e as b5,ig as b6,bFt as b7,uYr as b8,zbn as b9,fu as bA,x2n as bB,C2n as bC,E2n as bD,k2n as bE,LSt as bF,h2n as bG,T2n as bH,w2n as bI,JZr as bJ,BSt as bK,_2n as bL,jD as bM,yZr as bN,USt as bO,p2n as bP,UZr as bQ,u2n as bR,y2n as bS,e2n as bT,t2n as bU,AZr as bV,A2n as bW,$Zr as bX,PZr as bY,o2n as bZ,s2n as b_,hRt as ba,dRt as bb,gRt as bc,GXr as bd,amn as be,awn as bf,dSn as bg,_Rt as bh,cYr as bi,ovn as bj,L0n as bk,j0n as bl,P3r as bm,z0n as bn,Rhe as bo,Hbn as bp,Xbn as bq,dtn as br,y3r as bs,v3r as bt,jwr as bu,Gbn as bv,ltn as bw,QFt as bx,ed as by,_y as bz,iRe as c,R_ as c$,m2n as c0,K0e as c1,qZr as c2,zZr as c3,MRt as c4,LRt as c5,DZr as c6,n2n as c7,FZr as c8,r2n as c9,USn as cA,Uye as cB,dR as cC,xyn as cD,mO as cE,Vv as cF,wyn as cG,C0r as cH,k0r as cI,iLe as cJ,gyn as cK,M3t as cL,bZ as cM,lyn as cN,n$ as cO,Thn as cP,aR as cQ,pBe as cR,Nc as cS,tLe as cT,HTt as cU,KTt as cV,_hn as cW,W0r as cX,I0n as cY,N0n as cZ,PI as c_,VZr as ca,v2n as cb,RZr as cc,jze as cd,jRt as ce,OZr as cf,SMe as cg,IZr as ch,f2n as ci,i_e as cj,jZr as ck,VSt as cl,zSt as cm,BZr as cn,TZr as co,Mze as cp,bMe as cq,MZr as cr,b2n as cs,g2n as ct,i2n as cu,WZr as cv,d2n as cw,etn as cx,X0 as cy,ixt as cz,d3t as d,_Sr as d$,Jxn as d0,cBe as d1,Cm as d2,gfn as d3,i0 as d4,O2n as d5,ADr as d6,$un as d7,DRe as d8,i$ as d9,a4t as dA,lLe as dB,YB as dC,Wxn as dD,Hxn as dE,Dfn as dF,EAr as dG,A0n as dH,KBe as dI,ugt as dJ,T0n as dK,fhn as dL,Ovr as dM,fgt as dN,bAr as dO,hAr as dP,GBe as dQ,yAr as dR,a0r as dS,nye as dT,LOe as dU,hyn as dV,jsn as dW,yZ as dX,sAt as dY,AR as dZ,_xr as d_,aan as da,oan as db,NVe as dc,WSn as dd,d0r as de,_0r as df,u0r as dg,Iw as dh,CTt as di,H1 as dj,Wgn as dk,sen as dl,oSn as dm,ntn as dn,cMt as dp,l2 as dq,zAr as dr,Kbn as ds,uMt as dt,fQ as du,yhn as dv,lEr as dw,qTt as dx,SZ as dy,DCr as dz,u3t as e,vhn as e$,t$ as e0,Vme as e1,iCt as e2,$0n as e3,W0 as e4,W0n as e5,M2n as e6,gSn as e7,evn as e8,jhe as e9,syn as eA,sSn as eB,OYr as eC,Dze as eD,ERt as eE,l4t as eF,rtn as eG,lYr as eH,E4t as eI,D5e as eJ,Iye as eK,Don as eL,eLe as eM,bhn as eN,l0r as eO,w4t as eP,Oon as eQ,Lht as eR,k5e as eS,Aht as eT,c0 as eU,Yyn as eV,can as eW,NRe as eX,yBe as eY,e0n as eZ,$Cr as e_,T4r as ea,OQr as eb,tvn as ec,u$e as ed,nvn as ee,rvn as ef,qbn as eg,GSn as eh,HSn as ei,H0n as ej,hBe as ek,nhe as el,myn as em,G0 as en,kyn as eo,YY as ep,Iyn as eq,C_e as er,$yn as es,sQ as et,qgn as eu,Rw as ev,Ehn as ew,jTr as ex,PSn as ey,rSn as ez,oRe as f,W9t as f$,d0n as f0,f0n as f1,CC as f2,nFe as f3,wee as f4,kN as f5,Tve as f6,gmn as f7,hYr as f8,ND as f9,Dhn as fA,T0r as fB,Ahn as fC,Nme as fD,jOe as fE,ZTt as fF,S0n as fG,Eyn as fH,uxn as fI,xan as fJ,rxn as fK,TR as fL,xxn as fM,nxn as fN,Jze as fO,$bn as fP,bRt as fQ,mTr as fR,tTr as fS,JSn as fT,aSn as fU,lSn as fV,a0 as fW,cSn as fX,HQ as fY,VSn as fZ,RSn as f_,zwr as fa,MTr as fb,T_e as fc,ttn as fd,p$e as fe,n3r as ff,nfn as fg,zxn as fh,qxn as fi,$xn as fj,wve as fk,EN as fl,v0n as fm,D0n as fn,cwn as fo,swn as fp,uSn as fq,fSn as fr,g4t as fs,s0n as ft,hhn as fu,whn as fv,C0n as fw,b0n as fx,Gxn as fy,aPt as fz,y3t as g,rA as g$,CRt as g0,zQ as g1,kfn as g2,jun as g3,CR as g4,HXr as g5,Vbn as g6,Ltn as g7,DDr as g8,Pg as g9,$gn as gA,DFe as gB,f3r as gC,ivn as gD,h0r as gE,Jbn as gF,gYr as gG,Eht as gH,JTt as gI,i2 as gJ,X1 as gK,kSn as gL,ASn as gM,Mwr as gN,jgn as gO,ESn as gP,Mgn as gQ,CSn as gR,KFt as gS,U2n as gT,xR as gU,een as gV,$rn as gW,Chn as gX,zTt as gY,OTt as gZ,LTr as g_,DSn as ga,f0r as gb,fee as gc,R2n as gd,Z2n as ge,F2n as gf,oyn as gg,Y2n as gh,fN as gi,Zje as gj,sLe as gk,o4r as gl,J2n as gm,R0n as gn,X2n as go,F0n as gp,Q0n as gq,Dw as gr,sf as gs,hR as gt,b3r as gu,M0n as gv,wSn as gw,sPt as gx,snn as gy,own as gz,WAt as h,Kyn as h$,AC as h0,tA as h1,xhn as h2,J0n as h3,sBe as h4,X0e as h5,Qbn as h6,uCt as h7,Oan as h8,kxn as h9,RTr as hA,Tht as hB,Lye as hC,kTr as hD,ETr as hE,JTr as hF,yyn as hG,Syn as hH,byn as hI,Tyn as hJ,Cyn as hK,Xyn as hL,_yn as hM,Wyn as hN,Ym as hO,s4t as hP,dyn as hQ,pyn as hR,$ye as hS,vyn as hT,gBe as hU,cyn as hV,Uyn as hW,Jyn as hX,rhe as hY,r0n as hZ,Cht as h_,dYr as ha,q0n as hb,Lgn as hc,x0n as hd,dBe as he,Kgn as hf,Qgn as hg,nyn as hh,R$ as hi,CD as hj,Xgn as hk,Hgn as hl,Ggn as hm,eyn as hn,Qyn as ho,Zyn as hp,FTr as hq,qCr as hr,wht as hs,gC as ht,xRe as hu,L3t as hv,uyn as hw,fyn as hx,TRe as hy,wRe as hz,Pp as i,Qje as i$,LCr as i0,Ayn as i1,c4t as i2,she as i3,ACr as i4,OG as i5,Q3t as i6,q3t as i7,ITr as i8,zTr as i9,KTr as iA,HTr as iB,NG as iC,zyn as iD,n0n as iE,CCr as iF,ICr as iG,PTr as iH,Myn as iI,Dyn as iJ,ahe as iK,qyn as iL,E5e as iM,DTr as iN,vBe as iO,Nyn as iP,q$ as iQ,Pyn as iR,Ryn as iS,BSn as iT,zSn as iU,Cee as iV,AD as iW,vcn as iX,jxn as iY,S5e as iZ,Axn as i_,Fyn as ia,Oyn as ib,jyn as ic,Lyn as id,Gyn as ie,ATr as ig,kCr as ih,e4t as ii,t0n as ij,BTr as ik,Vyn as il,Byn as im,UTr as io,E_e as ip,ERe as iq,GTr as ir,WTr as is,BCr as it,VTr as iu,yee as iv,Rye as iw,XTr as ix,Epe as iy,kRe as iz,VAt as j,Exn as j$,nee as j0,Ofn as j1,Xxn as j2,nPt as j3,g3r as j4,eBe as j5,qwr as j6,uht as j7,Nwr as j8,v3t as j9,QHr as jA,tGr as jB,nGr as jC,tSn as jD,Rwr as jE,dVe as jF,lnn as jG,ste as jH,Xsn as jI,Gxt as jJ,wI as jK,RFe as jL,Sxn as jM,ahn as jN,dhn as jO,uhn as jP,vxn as jQ,lhn as jR,m0r as jS,bxn as jT,wan as jU,cxn as jV,axn as jW,Pon as jX,wxn as jY,sxn as jZ,Pan as j_,ysn as ja,K2n as jb,HI as jc,zMe as jd,Vgn as je,qRt as jf,Y0e as jg,Tye as jh,cN as ji,XLe as jj,Pye as jk,lN as jl,RAr as jm,TBe as jn,uBe as jo,Dye as jp,YLe as jq,Kye as jr,Fin as js,D9t as jt,jTt as ju,FB as jv,sN as jw,$2n as jx,Lxn as jy,F_n as jz,kwr as k,Jwr as k$,YSn as k0,Txn as k1,ixn as k2,txn as k3,ZSn as k4,_xn as k5,exn as k6,QSn as k7,oxn as k8,pxn as k9,phn as kA,rLe as kB,bEr as kC,vve as kD,bve as kE,TSn as kF,IMt as kG,RMt as kH,Uxt as kI,NFe as kJ,q_e as kK,OFe as kL,Lun as kM,KVe as kN,Dxn as kO,Ffn as kP,y0n as kQ,K0r as kR,Q2n as kS,gR as kT,bDr as kU,yve as kV,U$ as kW,eA as kX,mD as kY,Wwr as kZ,Hwr as k_,lxn as ka,mxn as kb,c$e as kc,fxn as kd,KSn as ke,Cxn as kf,XSn as kg,hxn as kh,_Ve as ki,dxn as kj,Tan as kk,gxn as kl,yxn as km,jSn as kn,FSn as ko,LSn as kp,W2n as kq,CDr as kr,e6t as ks,H2n as kt,MSn as ku,wD as kv,J0 as kw,GSt as kx,LAt as ky,Y4 as kz,Gme as l,twn as l$,Aye as l0,ghn as l1,j0r as l2,ZAr as l3,QAr as l4,mhn as l5,tjt as l6,Ugn as l7,Fwr as l8,Vwr as l9,ayn as lA,dCt as lB,xSn as lC,E0n as lD,Kxn as lE,chn as lF,Pxn as lG,Ixn as lH,Shn as lI,khn as lJ,$Sn as lK,Yxn as lL,Zxn as lM,mjt as lN,qSn as lO,Ygn as lP,Psn as lQ,tyn as lR,Uxn as lS,rwn as lT,P0n as lU,kAr as lV,SAr as lW,k0n as lX,iyn as lY,Zgn as lZ,ryn as l_,OPt as la,Mxn as lb,Fxn as lc,Nxn as ld,Rxn as le,Oxn as lf,m0n as lg,A3r as lh,U0n as li,V0n as lj,G2n as lk,Afn as ll,Ybn as lm,Zbn as ln,pSn as lo,r9t as lp,sjt as lq,Qxn as lr,nwn as ls,Ubn as lt,NSn as lu,Cfn as lv,Amn as lw,Dmn as lx,nq as ly,RDr as lz,rQ as m,U1r as m$,frn as m0,B0n as m1,hEr as m2,Ihn as m3,L2n as m4,N2n as m5,B2n as m6,EQr as m7,FEr as m8,PEr as m9,Lme as mA,eht as mB,F_ as mC,Bme as mD,$me as mE,Bbr as mF,Ubr as mG,yB as mH,kbr as mI,Dbr as mJ,EEt as mK,Fbr as mL,CEt as mM,Cbr as mN,Ebr as mO,pbr as mP,_br as mQ,l2r as mR,eh as mS,V1r as mT,tbr as mU,xEt as mV,Q1r as mW,K1r as mX,SEt as mY,Y1r as mZ,H1r as m_,eve as ma,Utn as mb,a0n as mc,g0n as md,c0n as me,u0n as mf,l0n as mg,Rsn as mh,h0n as mi,vSn as mj,bSn as mk,ySn as ml,SSn as mm,gEr as mn,yEr as mo,$Re as mp,bN as mq,OSn as mr,Jgn as ms,uje as mt,PAt as mu,Nxr as mv,YI as mw,Kvr as mx,gCt as my,i1r as mz,vB as n,Mbr as n$,nbr as n0,G1r as n1,J1r as n2,q1r as n3,z1r as n4,ibr as n5,rbr as n6,X1r as n7,W1r as n8,ebr as n9,gbr as nA,h2r as nB,e2r as nC,Tbr as nD,Ybr as nE,u2r as nF,dbr as nG,qbr as nH,a2r as nI,Lbr as nJ,i2r as nK,TEt as nL,Rbr as nM,Jbr as nN,Wbr as nO,PEt as nP,f2r as nQ,s2r as nR,m2r as nS,d2r as nT,Fw as nU,Xbr as nV,y2r as nW,Zbr as nX,hye as nY,M_ as nZ,c2r as n_,mye as na,Z1r as nb,IEt as nc,g2r as nd,Obr as ne,Vbr as nf,o2r as ng,Gbr as nh,Pbr as ni,lbr as nj,fbr as nk,fLe as nl,Qbr as nm,ICt as nn,n2r as no,t2r as np,_2r as nq,abr as nr,xbr as ns,wbr as nt,vbr as nu,ybr as nv,Sbr as nw,bbr as nx,Kbr as ny,Nbr as nz,Dwr as o,w2r as o$,p2r as o0,r2r as o1,DEt as o2,vu as o3,mbr as o4,ubr as o5,cbr as o6,jbr as o7,hLe as o8,$br as o9,$Et as oA,oSr as oB,V2r as oC,OCt as oD,FCt as oE,ggn as oF,ogn as oG,XEt as oH,NEt as oI,jEt as oJ,NCt as oK,RCt as oL,X2r as oM,fgn as oN,iSr as oO,A2r as oP,D2r as oQ,QZ as oR,qk as oS,XOe as oT,G2r as oU,k2r as oV,P2r as oW,R2r as oX,sgn as oY,UEt as oZ,JEt as o_,zbr as oa,hbr as ob,Hbr as oc,Nhn as od,ui as oe,Jhn as of,Uhn as og,obr as oh,jmt as oi,Hhn as oj,B2r as ok,nSr as ol,GEt as om,KEt as on,O2r as oo,N2r as op,bgn as oq,cSr as or,WEt as os,HEt as ot,Xhn as ou,Khn as ov,Yhn as ow,Ghn as ox,Whn as oy,BEt as oz,zAt as p,Q2r as p$,x2r as p0,C2r as p1,T2r as p2,YEt as p3,VEt as p4,Tgn as p5,ekt as p6,pgn as p7,W2r as p8,ZZ as p9,Zhn as pA,Cgn as pB,rgn as pC,xgn as pD,cgn as pE,sSr as pF,J2r as pG,jCt as pH,BCt as pI,MCt as pJ,LCt as pK,pye as pL,_ye as pM,ugn as pN,ZEt as pO,rSr as pP,K2r as pQ,b2r as pR,gye as pS,fSr as pT,vgn as pU,aSr as pV,M2r as pW,wgn as pX,eSr as pY,tSr as pZ,_gn as p_,XI as pa,S2r as pb,lgn as pc,QEt as pd,yLe as pe,Y2r as pf,jme as pg,eQ as ph,YOe as pi,U2r as pj,LEt as pk,dgn as pl,Qhn as pm,q2r as pn,tgn as po,ygn as pp,egn as pq,Z2r as pr,L2r as ps,hgn as pt,E2r as pu,mgn as pv,M$ as pw,fye as px,dye as py,Sgn as pz,Cwr as q,kLe as q$,agn as q0,I2r as q1,F2r as q2,qEt as q3,j2r as q4,ngn as q5,$2r as q6,H2r as q7,gLe as q8,OEt as q9,$1r as qA,v2r as qB,qhn as qC,Vhn as qD,$hn as qE,zhn as qF,_1r as qG,m1r as qH,p1r as qI,Rhn as qJ,Ohn as qK,sbr as qL,Agn as qM,Egn as qN,xLe as qO,BLe as qP,$Le as qQ,qLe as qR,rAt as qS,Zkt as qT,nAt as qU,FLe as qV,MLe as qW,zLe as qX,OLe as qY,RLe as qZ,ELe as q_,REt as qa,FEt as qb,MEt as qc,z2r as qd,zEt as qe,ign as qf,sA as qg,$S as qh,qme as qi,dSr as qj,jhn as qk,Bhn as ql,lSr as qm,Mhn as qn,Lhn as qo,f1r as qp,d1r as qq,HOe as qr,sD as qs,wEt as qt,Abr as qu,Ibr as qv,uSr as qw,Bmt as qx,$mt as qy,Fhn as qz,n0 as r,yAt as r$,wAt as r0,KLe as r1,xye as r2,mee as r3,gAt as r4,oAt as r5,jLe as r6,wLe as r7,TLe as r8,tQ as r9,j$ as rA,vye as rB,WLe as rC,GLe as rD,vAt as rE,IAt as rF,EAt as rG,Mw as rH,Sye as rI,uAt as rJ,j_ as rK,xAt as rL,Gkt as rM,AAt as rN,pAt as rO,cAt as rP,Lu as rQ,ALe as rR,yye as rS,aD as rT,Kkt as rU,bye as rV,Qkt as rW,tAt as rX,DLe as rY,iAt as rZ,SLe as r_,kgn as ra,_At as rb,dAt as rc,nht as rd,NAt as re,zme as rf,ILe as rg,NLe as rh,$kt as ri,Lkt as rj,Ukt as rk,zkt as rl,aAt as rm,rht as rn,LLe as ro,PLe as rp,DAt as rq,fAt as rr,Hkt as rs,lAt as rt,CAt as ru,CLe as rv,eAt as rw,HLe as rx,Xkt as ry,hAt as rz,JAt as s,OAt as s$,tht as s0,uxr as s1,HSr as s2,GSr as s3,oxr as s4,TAt as s5,Dxr as s6,JSr as s7,WSr as s8,Exr as s9,USr as sA,Rxr as sB,XSr as sC,pxr as sD,qSr as sE,mxr as sF,yxr as sG,VSr as sH,vxr as sI,Ixr as sJ,Cxr as sK,MSr as sL,Sxr as sM,VLe as sN,SAt as sO,Ykt as sP,Jme as sQ,wxr as sR,Ume as sS,mSr as sT,hSr as sU,gxr as sV,Wme as sW,bAt as sX,FAt as sY,Axr as sZ,kAt as s_,jSr as sa,LSr as sb,dxr as sc,bSr as sd,xSr as se,Pxr as sf,KSr as sg,kSr as sh,FSr as si,vSr as sj,SSr as sk,mAt as sl,xxr as sm,txr as sn,rxr as so,Pgn as sp,ASr as sq,exr as sr,QSr as ss,ZSr as st,RSr as su,ZOe as sv,nxr as sw,sxr as sx,ULe as sy,zSr as sz,Pa as t,TSr as t0,ESr as t1,wSr as t2,CSr as t3,gSr as t4,ySr as t5,bxr as t6,Dgn as t7,YSr as t8,Oxr as t9,cvr as tA,avr as tB,lwn as tC,Phn as tD,Ign as tE,Ngn as tF,Ogn as tG,Rgn as tH,Fgn as tI,SEr as tJ,p0n as tK,_0n as tL,X0n as tM,Y0n as tN,Z0n as tO,Bbn as tP,P2n as tQ,I2n as tR,IQr as tS,j2n as tT,q2n as tU,z2n as tV,V2n as tW,_Sn as tX,mSn as tY,urn as tZ,ewn as t_,Txr as ta,RAt as tb,cxr as tc,kxr as td,JLe as te,ixr as tf,axr as tg,BSr as th,lxr as ti,OSr as tj,DSr as tk,PSr as tl,ISr as tm,NSr as tn,fxr as to,$Sr as tp,hxr as tq,svr as tr,QTt as ts,Dmt as tt,Ome as tu,ovr as tv,ivr as tw,PG as tx,rCt as ty,tCt as tz,Gd as u,bo as v,Dg as w,e_ as x,yen as y,cFt as z};