@volter/game-editor 0.5.65 → 0.5.66

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 (544) hide show
  1. package/BUNDLED_NOTICES +1962 -363
  2. package/catalog/entries/bake.json +0 -1
  3. package/catalog/entries/blender.json +2 -2
  4. package/catalog/entries/reflections.json +2 -4
  5. package/catalog/project-source/src/lib/bake/asset-seed.ts +1 -2
  6. package/catalog/project-source/src/lib/bake/clip-layering.ts +3 -4
  7. package/catalog/project-source/src/lib/bake/gltf-bake.ts +1 -1
  8. package/catalog/project-source/src/lib/bake/params.ts +3 -5
  9. package/catalog/project-source/src/lib/bake/rest-relative-animation.ts +2 -3
  10. package/dist/.vite/manifest.json +2406 -2182
  11. package/dist/assets/{AssetBudgetPanel-J9--TZPU.js → AssetBudgetPanel-csYWK2H4.js} +8 -8
  12. package/dist/assets/{AudioViewer-CR7333fe.js → AudioViewer-BH_LUYs5.js} +1 -1
  13. package/dist/assets/{BVHLoader-6bQIXhMX.js → BVHLoader-Jkzh8hMf.js} +1 -1
  14. package/dist/assets/BufferGeometryUtils-CAbuTPOA.js +1 -0
  15. package/dist/assets/{CCDIKSolver-CD7vLpsK.js → CCDIKSolver-D4NvkJ8d.js} +1 -1
  16. package/dist/assets/{CSS3DRenderer-CL7ABLVK.js → CSS3DRenderer-CAS2WZZy.js} +1 -1
  17. package/dist/assets/CanvasSceneViewport-BlsRTk-X.js +1 -0
  18. package/dist/assets/ColladaLoader-DxYB89DA.js +3 -0
  19. package/dist/assets/{ColorInput-DQBNrW-K.js → ColorInput-CPQNsDf1.js} +1 -1
  20. package/dist/assets/{ConvexGeometry-CAzXlPVG.js → ConvexGeometry-Dinf-sev.js} +1 -1
  21. package/dist/assets/{ConvexHull-BINCESFp.js → ConvexHull-CrJ8FY-w.js} +1 -1
  22. package/dist/assets/{DecalGeometry-160KRdfg.js → DecalGeometry-owkbefLa.js} +1 -1
  23. package/dist/assets/EffectComposer-BHDH-NLz.js +1 -0
  24. package/dist/assets/EntityModelDocument-DuQivdvc.js +1 -0
  25. package/dist/assets/EnvironmentAssetDocument-CnTEMn3A.js +1 -0
  26. package/dist/assets/FBXLoader-BMUbIhtE.js +1 -0
  27. package/dist/assets/Fbo-DrK7CWlB.js +1 -0
  28. package/dist/assets/{FontLoader-CvGoVI5a.js → FontLoader-BR_K6Baw.js} +2 -2
  29. package/dist/assets/GLTFExporter-BZqAQJbw.js +1 -0
  30. package/dist/assets/{GameplaySessionTimeline-B52W3FVZ.js → GameplaySessionTimeline-Crqwv2fP.js} +1 -1
  31. package/dist/assets/Gltf-7cVbZUzT.js +2 -0
  32. package/dist/assets/ImageViewer-BkFie7Hm.js +1 -0
  33. package/dist/assets/InspectorObjectPreview-Dl3tyJBn.js +1 -0
  34. package/dist/assets/JsonAssetDocument-BUFzubHM.js +2 -0
  35. package/dist/assets/{LineSegments2-CsOpKSiM.js → LineSegments2-Cicm_Hu1.js} +2 -2
  36. package/dist/assets/LiveModuleDocument-C3OQxiba.js +1 -0
  37. package/dist/assets/LutAssetDocument-DVzd1RZ9.js +1 -0
  38. package/dist/assets/{MTLLoader-_Xzd4_0p.js → MTLLoader-Bg_grNiT.js} +2 -2
  39. package/dist/assets/{MarchingCubes-Bsp4wrzd.js → MarchingCubes-a78AL3HB.js} +1 -1
  40. package/dist/assets/MeshBVH-BCSLNEeP.js +1 -0
  41. package/dist/assets/ModelAssetDocument-pN84goRT.js +1 -0
  42. package/dist/assets/{NonThreeAuthoringBootstrap-C3woOMxX.js → NonThreeAuthoringBootstrap-BKNejRiW.js} +1 -1
  43. package/dist/assets/{OBJLoader-BhIC6Hwo.js → OBJLoader-BiwzVj5b.js} +2 -2
  44. package/dist/assets/Object3DDocumentToolbar-D5Bg5FEf.js +1 -0
  45. package/dist/assets/Object3DDocumentViewport-DFHqru3a.js +2 -0
  46. package/dist/assets/Object3DPreview-BTtZ-41z.js +2 -0
  47. package/dist/assets/OnlineAssetDetail-BAqozdAp.js +1 -0
  48. package/dist/assets/{OrbitControls-DLpayAaK.js → OrbitControls-CzKVCORl.js} +1 -1
  49. package/dist/assets/{OrbitControls-CM3bPray.js → OrbitControls-CzTRRI7x.js} +1 -1
  50. package/dist/assets/{OrthographicCamera-bQozawrh.js → OrthographicCamera-CSDDsvu7.js} +1 -1
  51. package/dist/assets/{PLYLoader-DYQqs5Ik.js → PLYLoader-QxrxxMpE.js} +2 -2
  52. package/dist/assets/{PerspectiveCamera-CQ2lh01o.js → PerspectiveCamera-DzD_NfVh.js} +1 -1
  53. package/dist/assets/PlayBar-qVJpgwJt.js +2 -0
  54. package/dist/assets/QuarksAssetDocument-B4vBlUsS.js +2 -0
  55. package/dist/assets/RGBELoader-WQ7xZofE.js +1 -0
  56. package/dist/assets/RectAreaLightUniformsLib-CwcuoVqt.js +1 -0
  57. package/dist/assets/{RenderPass-DPrn-Uky.js → RenderPass-C_CeQNdh.js} +1 -1
  58. package/dist/assets/{ResolutionPicker-C67vs1F3.js → ResolutionPicker-DpHVJxn5.js} +1 -1
  59. package/dist/assets/RootSelectionOverlay-BxvsunO4.js +1 -0
  60. package/dist/assets/{RoundedBox-BDGBg6QZ.js → RoundedBox-B_cZ0NFy.js} +1 -1
  61. package/dist/assets/{RoundedBoxGeometry-CyUuYPfW.js → RoundedBoxGeometry-Y4rcSIvX.js} +1 -1
  62. package/dist/assets/STLLoader-Bej_Nkpr.js +1 -0
  63. package/dist/assets/{SelectionBox-D_75KrNW.js → SelectionBox-Cn9vm7f9.js} +1 -1
  64. package/dist/assets/ShaderAssetDocument-Dx2x8CLr.js +12 -0
  65. package/dist/assets/{ShaderPass-QYRpPuFJ.js → ShaderPass-qtkA7CQ8.js} +1 -1
  66. package/dist/assets/{ShadowEditor-DkImwu1Y.js → ShadowEditor-BEIUkrHL.js} +1 -1
  67. package/dist/assets/SimplifyModifier-D2EesGr2.js +1 -0
  68. package/dist/assets/{SkeletonUtils-Cps8GOC6.js → SkeletonUtils-C8ayciDc.js} +1 -1
  69. package/dist/assets/{Sky-CQKCgYDs.js → Sky-BBpnAJZV.js} +1 -1
  70. package/dist/assets/SourceAssetViewer-BpMbbuy6.js +1 -0
  71. package/dist/assets/StageHost-lB8f---y.js +2 -0
  72. package/dist/assets/{StoryPreviewMount-DjyxRCXu.js → StoryPreviewMount-BIfxmkYh.js} +1 -1
  73. package/dist/assets/{TDSLoader-D_T8XJ81.js → TDSLoader-rHl5Uwc0.js} +1 -1
  74. package/dist/assets/{TextGeometry-DOWAEUV0.js → TextGeometry-BRHSufuM.js} +1 -1
  75. package/dist/assets/ThreeBoardDocument-BHV92Ia3.js +2 -0
  76. package/dist/assets/{ThreeIsolationSceneContent-C8C8whSF.js → ThreeIsolationSceneContent-BqtgDHBK.js} +1 -1
  77. package/dist/assets/{ToolObject3DPreview-BRoDWe4Q.js → ToolObject3DPreview-CcaPJTyH.js} +1 -1
  78. package/dist/assets/Toolbar-keHcSvDD.js +1 -0
  79. package/dist/assets/{TrackballControls-DfznuQTh.js → TrackballControls-Cce-6Ff5.js} +1 -1
  80. package/dist/assets/{TransientHint-BB1fwrvK.js → TransientHint-Dlslh3oX.js} +1 -1
  81. package/dist/assets/{UnrealBloomPass-CR-cS_K5.js → UnrealBloomPass-DiseEiFK.js} +2 -2
  82. package/dist/assets/{VideoViewer-C6kocgIU.js → VideoViewer-naGSXHd6.js} +1 -1
  83. package/dist/assets/ViewportShadingMenu-C7Hdhtca.js +1 -0
  84. package/dist/assets/{active-ingest-CT6jSGhr.js → active-ingest-DEgq9JiA.js} +3 -3
  85. package/dist/assets/{animation-clock-CnjZqfJp.js → animation-clock-lTIb6nk3.js} +1 -1
  86. package/dist/assets/animation-mixers.service-2O2rVwQf.js +1 -0
  87. package/dist/assets/asset-budget-asset.menu-9NhdHAC9.js +1 -0
  88. package/dist/assets/asset-budget.action-yg6-luUJ.js +1 -0
  89. package/dist/assets/asset-budget.document-B46_VFqa.js +1 -0
  90. package/dist/assets/asset-budget.menu-DuH07N-e.js +1 -0
  91. package/dist/assets/{asset-editor-persistence-BBaONOJt.js → asset-editor-persistence-BVtzjadu.js} +1 -1
  92. package/dist/assets/{asset-loaders-BOy5Ss8k.js → asset-loaders-BxG1LykH.js} +2 -2
  93. package/dist/assets/{assets-BuSoGjBX.js → assets-Do88ZdV_.js} +1 -1
  94. package/dist/assets/{audio-unlock.service-CfUgUQVy.js → audio-unlock.service-BJH0mWvX.js} +1 -1
  95. package/dist/assets/{audio.utility-C6K6jem8.js → audio.utility-Cp4aVYFU.js} +1 -1
  96. package/dist/assets/autoplay.service-FxpRy7Ev.js +1 -0
  97. package/dist/assets/{babylon-authoring-adapter-CL02gWDn.js → babylon-authoring-adapter-B_8iE8fK.js} +1 -1
  98. package/dist/assets/{binding-resolver-Dsh-6Vor.js → binding-resolver-BWwG10zJ.js} +2 -2
  99. package/dist/assets/blender-emscripten-engine-CEsWgnR7.js +2 -0
  100. package/dist/assets/{blender-node-editor.document-iIDkB9sI.js → blender-node-editor.document-DTgwy8KC.js} +1 -1
  101. package/dist/assets/blender-properties-tab-DWSJpkxq.js +3 -0
  102. package/dist/assets/blender-runtime-host-OGjPjTrG.js +4 -0
  103. package/dist/assets/{blender-runtime-skin-DyQ9B6CR.js → blender-runtime-skin-DymtXlpt.js} +37 -39
  104. package/dist/assets/blender-runtime.document-CzH2ohHR.js +8 -0
  105. package/dist/assets/{blender-timeline.document-77fx96N7.js → blender-timeline.document-BRy_QPHt.js} +1 -1
  106. package/dist/assets/{blender-uv-editor.document-fsT7B4gV.js → blender-uv-editor.document-D-AbUCqz.js} +1 -1
  107. package/dist/assets/{blender-version.status-o6dBm3n6.js → blender-version.status-B7flzX_7.js} +1 -1
  108. package/dist/assets/{blender-wali-engine-wTOcrOMC.js → blender-wali-engine-D3iKpzn9.js} +1 -1
  109. package/dist/assets/blender.command-BVHtgTQy.js +1 -0
  110. package/dist/assets/blender.environment-CG-pC7sk.js +1 -0
  111. package/dist/assets/{blender.style-Dcem5f_T.js → blender.style-CxfbTFcE.js} +1 -1
  112. package/dist/assets/{board-guides-DziKSTss.js → board-guides-C3usUZZk.js} +1 -1
  113. package/dist/assets/body-marks-D8iaje6y.js +1 -0
  114. package/dist/assets/bridge.command-BF9u6r0A.js +3 -0
  115. package/dist/assets/browserAll-38aBu-cf.js +1 -0
  116. package/dist/assets/{build-profiles.document-kW8iw8Xj.js → build-profiles.document-DO7oNRuo.js} +2 -2
  117. package/dist/assets/{build-progress.status-BNRLytg2.js → build-progress.status-COeNVhYd.js} +1 -1
  118. package/dist/assets/{build-session-C_sg3CEn.js → build-session-IWIriS5P.js} +1 -1
  119. package/dist/assets/{build.action-lYjTLb7K.js → build.action-DlkFvZf6.js} +1 -1
  120. package/dist/assets/{build.command-DIGgUPU_.js → build.command-DPqQIYj_.js} +1 -1
  121. package/dist/assets/{build.header-CKajx5U3.js → build.header-CNLG-pV8.js} +1 -1
  122. package/dist/assets/{build.menu-BdU0QXny.js → build.menu-hUlH6loi.js} +1 -1
  123. package/dist/assets/{build.service-CbBAyeu3.js → build.service-C86Td3_9.js} +1 -1
  124. package/dist/assets/{camera-KEsKvOL7.js → camera-CKbyBXMe.js} +1 -1
  125. package/dist/assets/camera-authoring-Ci3KnE-W.js +1 -0
  126. package/dist/assets/{camera-runtime.inspector-B7unX4g1.js → camera-runtime.inspector-DdR3P2BF.js} +1 -1
  127. package/dist/assets/canvas-entry-runtime-E5YjSgre.js +2 -0
  128. package/dist/assets/canvas-preview-frames-CiAx7dpV.js +1 -0
  129. package/dist/assets/{capability-coverage-Czas4C18.js → capability-coverage-CfUeULDN.js} +5 -5
  130. package/dist/assets/city-EkhAOo5s.exr +0 -0
  131. package/dist/assets/{collaboration-presence-DLoZ7EA3.js → collaboration-presence-CSLFNT7m.js} +1 -1
  132. package/dist/assets/{collider-Bw0mXlsW.js → collider-DRSaLRM9.js} +1 -1
  133. package/dist/assets/{component-board.service-DCwcUssB.js → component-board.service-B7Sv8b7m.js} +2 -2
  134. package/dist/assets/component-board.service-B8UHw8dn.js +2 -0
  135. package/dist/assets/component-contracts.service-LFGekycZ.js +1 -0
  136. package/dist/assets/{component-verbs.command-7xzfjGMZ.js → component-verbs.command-D4SvFjfG.js} +1 -1
  137. package/dist/assets/component-verbs.service-TGvWxf2b.js +1 -0
  138. package/dist/assets/{config-CEZk921y.js → config-DB_RH-hO.js} +3 -3
  139. package/dist/assets/{configurations-DTBMdaTL.js → configurations-C2qgJNnW.js} +1 -1
  140. package/dist/assets/{connection.status-BifnQdOs.js → connection.status-CG7X2brL.js} +1 -1
  141. package/dist/assets/{console-bridge-CHcb-xk5.js → console-bridge-B5Ltae37.js} +1 -1
  142. package/dist/assets/{constraint-De8f1Uiq.js → constraint-C_Jj7dXy.js} +1 -1
  143. package/dist/assets/constraints.inspector-D6QZJS4b.js +1 -0
  144. package/dist/assets/courtyard-DqlebbpC.exr +0 -0
  145. package/dist/assets/coverage.service-Clo86874.js +3 -0
  146. package/dist/assets/{create-runtime-CVCc1BDx.js → create-runtime-lmA910XT.js} +1 -1
  147. package/dist/assets/{curve-7Q79VgU4.js → curve-6-TR6dNb.js} +1 -1
  148. package/dist/assets/{data-asset-4hjS642k.js → data-asset-BNbd309U.js} +1 -1
  149. package/dist/assets/{data-ref-CQI28C0D.js → data-ref-Dvmd7eb1.js} +1 -1
  150. package/dist/assets/{debug-bridge-CCohG-d-.js → debug-bridge-BUNhgyY6.js} +1 -1
  151. package/dist/assets/{debug-registry-Dgvitx8M.js → debug-registry-B3Cnne3x.js} +1 -1
  152. package/dist/assets/deferred-ingest-play-7V8OrW3e.js +2 -0
  153. package/dist/assets/design-time-layers-g9VS6amb.js +1 -0
  154. package/dist/assets/design-time-mount.service-HtMr_vBd.js +2 -0
  155. package/dist/assets/design-time-react-mount-Dx6fJ-Hg.js +1 -0
  156. package/dist/assets/{directional-shadow-fit-BVkOKAv2.js → directional-shadow-fit-Cjz_Eg2b.js} +1 -1
  157. package/dist/assets/{document-preview-three-Kbg2GCLm.js → document-preview-three-C3y0syYQ.js} +1 -1
  158. package/dist/assets/{dom-authoring-adapter-CY8C7f4T.js → dom-authoring-adapter-CEeFyatF.js} +1 -1
  159. package/dist/assets/{draco3d-BBUTcNkz.js → draco3d-FKy0apkb.js} +1 -1
  160. package/dist/assets/drei-asset-caches-jJoHXbTj.js +2 -0
  161. package/dist/assets/{edit-mode-audio.service-Bzetwd5B.js → edit-mode-audio.service-DZTnrW6t.js} +1 -1
  162. package/dist/assets/edit-mode-authoring-D_BiHCQj.js +1 -0
  163. package/dist/assets/{edit-mode-networking.service-YCX6RRb_.js → edit-mode-networking.service-BzMI2VxO.js} +1 -1
  164. package/dist/assets/editor-api-Bzmo0o8_.js +1 -0
  165. package/dist/assets/{entry-adjudication-Cq8Yeb74.js → entry-adjudication-BYy7TXOB.js} +1 -1
  166. package/dist/assets/{events-156d8d12.esm-ErOhDXXB.js → events-156d8d12.esm-C734MYnx.js} +7 -7
  167. package/dist/assets/{extend-B-eOccUm.js → extend-CLG0ymiX.js} +1 -1
  168. package/dist/assets/forest-P_CQY3b_.exr +0 -0
  169. package/dist/assets/fork-menu-De7HU6_H.js +1 -0
  170. package/dist/assets/{frame-debugger-store-D1Mf_5up.js → frame-debugger-store-BZgIOlU6.js} +1 -1
  171. package/dist/assets/{game-DHOZVb-7.js → game-D5EJoILQ.js} +1 -1
  172. package/dist/assets/{game-contract-seams-a5YXejOu.js → game-contract-seams-TCpIMmHP.js} +1 -1
  173. package/dist/assets/{game-css-scope-transform-Eng4wS8E.js → game-css-scope-transform-NbpajQr-.js} +1 -1
  174. package/dist/assets/game-document.service-6eRlrI-d.js +1 -0
  175. package/dist/assets/game-eval.command-hKnSMlX0.js +2 -0
  176. package/dist/assets/{game-input-seams-CIQdetRw.js → game-input-seams-BC6xhZy3.js} +1 -1
  177. package/dist/assets/{game-module-access-B2mFxv-i.js → game-module-access-ry3xb1Ix.js} +1 -1
  178. package/dist/assets/{gameplay-export-BoKXm51x.js → gameplay-export-DiLQuPpn.js} +1 -1
  179. package/dist/assets/gameplay-replay-Bsre-1K8.js +1 -0
  180. package/dist/assets/{gameplay-rng-trap-CTNhm-UW.js → gameplay-rng-trap-BhRx_CtU.js} +1 -1
  181. package/dist/assets/gameplay.command-BqiyGn-I.js +1 -0
  182. package/dist/assets/{generation-jobs-BQrXbGp_.js → generation-jobs-BYcpgeGk.js} +1 -1
  183. package/dist/assets/generation.service-O81IqA-6.js +1 -0
  184. package/dist/assets/{generations-DzUogZsM.js → generations-CsGQ3twi.js} +1 -1
  185. package/dist/assets/{generations.status-CgOUBCum.js → generations.status-C3YU0_ml.js} +1 -1
  186. package/dist/assets/godot.style-DxJaFWOP.js +1 -0
  187. package/dist/assets/godot.view-BFsHk8b2.js +1 -0
  188. package/dist/assets/{hosted-asset-materialization-CiIvWkGU.js → hosted-asset-materialization-Bk-plQF6.js} +2 -2
  189. package/dist/assets/{ibl-override-material-BlmCxFKq.js → ibl-override-material-BhbGwgS1.js} +1 -1
  190. package/dist/assets/{index-mjWQmGhM.js → index-0n9eSzwT.js} +1 -1
  191. package/dist/assets/index-B4bmKkgY.css +1 -0
  192. package/dist/assets/index-BLo2LE8C.js +3404 -0
  193. package/dist/assets/index-BWW4-DBH.js +1 -0
  194. package/dist/assets/index-CLcsjKUs.js +1 -0
  195. package/dist/assets/index-CU5YUq-x.js +134 -0
  196. package/dist/assets/{index-DUpHH6JR.js → index-Cb6o_Td_.js} +1 -1
  197. package/dist/assets/index-Ckxb31Yz.js +1500 -0
  198. package/dist/assets/index-CnpsJMao.js +1 -0
  199. package/dist/assets/index-Cr23XhNm.js +1 -0
  200. package/dist/assets/index-DO1rWQ_r.js +487 -0
  201. package/dist/assets/{index-BcCBqgM_.js → index-DUh02lTr.js} +1 -1
  202. package/dist/assets/index-DXEHfb0b.js +1 -0
  203. package/dist/assets/{index-V1R-e5Bd.js → index-wRCvCebM.js} +1 -1
  204. package/dist/assets/{inference-diagnostics-Dhmtfbq_.js → inference-diagnostics-YW0yJkKx.js} +1 -1
  205. package/dist/assets/{ingest-BbYMC2vQ.js → ingest-BlQnR7s3.js} +1 -1
  206. package/dist/assets/ingest-boot-viewport-uG9jQ1zm.js +1 -0
  207. package/dist/assets/ingest-siblings-DRQXSWax.js +1 -0
  208. package/dist/assets/{ingest-source-persistence-C_6Hiyra.js → ingest-source-persistence-DH6ioCOu.js} +1 -1
  209. package/dist/assets/{ingest.service-BTDnQfM1.js → ingest.service-GeaWMaZX.js} +1 -1
  210. package/dist/assets/{input-manager-DH_hGW6d.js → input-manager-Cxx3RJgG.js} +1 -1
  211. package/dist/assets/{input-router-BNQvtIqw.js → input-router-FzxO5ld6.js} +1 -1
  212. package/dist/assets/{inspect-BZfi3mmo.js → inspect-BRgDdtVk.js} +1 -1
  213. package/dist/assets/instances.command-CFOMPSj3.js +1 -0
  214. package/dist/assets/{instruments-CKR02Y8I.js → instruments-IKn-vvNb.js} +1 -1
  215. package/dist/assets/interior-Bo_lba15.exr +0 -0
  216. package/dist/assets/{json-history-resource-BbxllWfV.js → json-history-resource-r-9q_hxP.js} +1 -1
  217. package/dist/assets/{light-D-_wsKTq.js → light-CFAor97k.js} +1 -1
  218. package/dist/assets/light-camera-factory-D1sgz3YB.js +1 -0
  219. package/dist/assets/live-mixers-BRkRHd6g.js +1 -0
  220. package/dist/assets/{loader-CaF_I7Yt.js → loader-BbMsvIxP.js} +1 -1
  221. package/dist/assets/machine.document-CgmsOh-s.js +24 -0
  222. package/dist/assets/machines.finder-nxiCgQc2.js +1 -0
  223. package/dist/assets/matcap-texture-Dh65bX5V.js +1 -0
  224. package/dist/assets/{material-CpAdjDxn.js → material-D5kXEZWQ.js} +1 -1
  225. package/dist/assets/{material-factory-Bz6h__6g.js → material-factory-0Qb0VuZ5.js} +1 -1
  226. package/dist/assets/material-preview.view-DqNcpd_b.js +1 -0
  227. package/dist/assets/{mesh-B3WPtNKO.js → mesh-BKPgNTwh.js} +1 -1
  228. package/dist/assets/{mesh-shadow-CZnXrw_l.js → mesh-shadow-BDQP4mHs.js} +1 -1
  229. package/dist/assets/model-asset-sections.service-DWPLmkqa.js +1 -0
  230. package/dist/assets/model-inspection-Cxfg_Fei.js +1 -0
  231. package/dist/assets/model.layout-BpZE1W9V.js +1 -0
  232. package/dist/assets/{models.finder-G2jQgIRu.js → models.finder-DHW17ZEa.js} +1 -1
  233. package/dist/assets/module-mode-CRfHyIMS.js +2 -0
  234. package/dist/assets/mount-canvas-ingest-root-BZZ8M3Lu.js +2 -0
  235. package/dist/assets/mount-dom-ingest-root-D1GV6Jjt.js +2 -0
  236. package/dist/assets/{mount-game-6t9cKNo4.js → mount-game-F9e76auh.js} +1 -1
  237. package/dist/assets/mount-ingest-root-B5D-Lmmk.js +2 -0
  238. package/dist/assets/{mount-manifest-CGVxhmAw.js → mount-manifest-cYRhgHfo.js} +1 -1
  239. package/dist/assets/mount-three-ingest-root-BNnouaBn.js +1 -0
  240. package/dist/assets/{mounted-authoring-Dmg5xmhP.js → mounted-authoring-TIN5EnCb.js} +1 -1
  241. package/dist/assets/{mounted-story-viewport-source-DjP6RA9U.js → mounted-story-viewport-source-CAlEmE0_.js} +1 -1
  242. package/dist/assets/{native-debug-module-CWicoSGD.js → native-debug-module-j-MekcLS.js} +1 -1
  243. package/dist/assets/{navigation-CIiCx-SM.js → navigation-DmR1BDVo.js} +1 -1
  244. package/dist/assets/{navmesh.menu-CAKiH8PW.js → navmesh.menu-FhL1pGx1.js} +1 -1
  245. package/dist/assets/{navmesh.service-jgDWlgj1.js → navmesh.service-usyDeJlm.js} +1 -1
  246. package/dist/assets/{network.utility-CEu5nHf7.js → network.utility-BPh4hTmh.js} +1 -1
  247. package/dist/assets/night-CvV4Gybt.exr +0 -0
  248. package/dist/assets/{object3d-authoring-subject-CH5sI2oP.js → object3d-authoring-subject-CyE4rQ2A.js} +1 -1
  249. package/dist/assets/oid-transform-BOqL6YH6.js +2 -0
  250. package/dist/assets/{particles-Y626p22p.js → particles-C47L-dda.js} +1 -1
  251. package/dist/assets/particles-factory-CRqPLdS7.js +1 -0
  252. package/dist/assets/pixi-authoring-adapter-C5Ikqj5-.js +1 -0
  253. package/dist/assets/{pixi-live-write-target-DuWydlWb.js → pixi-live-write-target-OWBk79dp.js} +1 -1
  254. package/dist/assets/pixi-primitive-D5igywJ_.js +1 -0
  255. package/dist/assets/pixi-react-root-factory-9lZ0Yz-n.js +1 -0
  256. package/dist/assets/play-mode-DomOvQie.js +22 -0
  257. package/dist/assets/play.command-DoqjH-Pp.js +2 -0
  258. package/dist/assets/{playtest-BXIL1JEF.js → playtest-BnFenMBW.js} +1 -1
  259. package/dist/assets/{pose-guard-6Osb2cFu.js → pose-guard-Bb3gZOzk.js} +1 -1
  260. package/dist/assets/{product-DFhyARJj.js → product-CTDJoVo5.js} +1 -1
  261. package/dist/assets/{profiler.action-CaXJDp3t.js → profiler.action-C_OFGkDw.js} +1 -1
  262. package/dist/assets/{profiler.menu-BIMF6Bi4.js → profiler.menu-BJbnVoo4.js} +1 -1
  263. package/dist/assets/{profiler.utility-BExw9wBO.js → profiler.utility-qpfhuwRw.js} +1 -1
  264. package/dist/assets/project-authoring-session-BV-MM8Fl.js +2 -0
  265. package/dist/assets/{project-provenance-BoP3nrle.js → project-provenance-4ldz-EOG.js} +1 -1
  266. package/dist/assets/{properties-bone-constraints.inspector-ByT6p7S-.js → properties-bone-constraints.inspector-C-ByIdg1.js} +1 -1
  267. package/dist/assets/{properties-bone.inspector-z4qJwKO5.js → properties-bone.inspector-CXY0xCQB.js} +1 -1
  268. package/dist/assets/{properties-collection.inspector-D0_3ijWU.js → properties-collection.inspector-DIfkZAel.js} +1 -1
  269. package/dist/assets/{properties-constraints.inspector-CESzjuls.js → properties-constraints.inspector-BaunL5nT.js} +1 -1
  270. package/dist/assets/{properties-data.inspector-hG8Wgyzb.js → properties-data.inspector-DQD-jfO2.js} +1 -1
  271. package/dist/assets/{properties-material.inspector-CzY0JCQ6.js → properties-material.inspector-A0HZ4SX6.js} +1 -1
  272. package/dist/assets/{properties-modifiers.inspector-3dDhwf7g.js → properties-modifiers.inspector-GUnVhVwZ.js} +1 -1
  273. package/dist/assets/{properties-object.inspector-CiarfxkT.js → properties-object.inspector-Chsfa4Xa.js} +1 -1
  274. package/dist/assets/{properties-output.inspector-DKJxmKSD.js → properties-output.inspector-U7ZmD0Me.js} +1 -1
  275. package/dist/assets/{properties-particles.inspector-CCEdYWGm.js → properties-particles.inspector-umkW-OlI.js} +1 -1
  276. package/dist/assets/{properties-physics.inspector-B2c0KUyA.js → properties-physics.inspector-CLVBlWwL.js} +1 -1
  277. package/dist/assets/{properties-render.inspector-Bcm0HLRW.js → properties-render.inspector-D0u9taKy.js} +1 -1
  278. package/dist/assets/{properties-scene.inspector-PIM_eTb_.js → properties-scene.inspector-JwGCZQAx.js} +1 -1
  279. package/dist/assets/{properties-texture.inspector-CgFlnyr8.js → properties-texture.inspector-B1vC28pw.js} +1 -1
  280. package/dist/assets/{properties-view-layer.inspector-DGjF_Aqo.js → properties-view-layer.inspector-BuUKyBFp.js} +1 -1
  281. package/dist/assets/{properties-world.inspector-CrMvaRvB.js → properties-world.inspector-VXUj4dT4.js} +1 -1
  282. package/dist/assets/r3f-design-session-qJ2v5SrB.js +2 -0
  283. package/dist/assets/r3f-physics-binding-C8OqNRG2.js +1 -0
  284. package/dist/assets/{r3f-root-factory-z9llD1OU.js → r3f-root-factory-DjGnbU4n.js} +1 -1
  285. package/dist/assets/r3f-source-authoring-adapter-CG9heazM.js +12 -0
  286. package/dist/assets/{rapier-physics-bridge-CMoeVo3Y.js → rapier-physics-bridge-B-EK7KYV.js} +1 -1
  287. package/dist/assets/react-inspector.service-DWeXDHJq.js +1 -0
  288. package/dist/assets/{react-root-CEz5NTck.js → react-root-DGLRLr-F.js} +1 -1
  289. package/dist/assets/react-story-board-CSqHY0Cg.js +1 -0
  290. package/dist/assets/{react-three-fiber.esm-CycrbDlA.js → react-three-fiber.esm-BxIoqVh1.js} +1 -1
  291. package/dist/assets/{react-three-rapier.esm-CEfKpvxT.js → react-three-rapier.esm-BYzLhdSV.js} +1 -1
  292. package/dist/assets/react-world-authoring-adapter-BMT9kLWU.js +1 -0
  293. package/dist/assets/{realm-services-CobQsq_X.js → realm-services-D25JHoqD.js} +1 -1
  294. package/dist/assets/{reflection-probe-Don-M3Fj.js → reflection-probe-CqXWlicu.js} +1 -1
  295. package/dist/assets/{reflection-probe-capture.inspector-CmFUoJCx.js → reflection-probe-capture.inspector-B7Qa30vB.js} +1 -1
  296. package/dist/assets/regions-DWeEBnE2.js +1 -0
  297. package/dist/assets/{register-render-vitals-BiZk29b2.js → register-render-vitals-BO7x64kR.js} +1 -1
  298. package/dist/assets/{registry-02YZjMNp.js → registry-DlTluc4x.js} +1 -1
  299. package/dist/assets/{render-audio-control-vMRlePWb.js → render-audio-control-DCa_bOBI.js} +1 -1
  300. package/dist/assets/{render-batch-system-0vq7p0VC.js → render-batch-system-CzCp9YKM.js} +1 -1
  301. package/dist/assets/{render-control-Df3yTiyr.js → render-control-BNQr1eNO.js} +1 -1
  302. package/dist/assets/{render-env-D2IV2x5k.js → render-env-emvlfeTG.js} +1 -1
  303. package/dist/assets/{render-features-CPQ_e568.js → render-features-COF7MSQ9.js} +1 -1
  304. package/dist/assets/{render-settings-Bw4W9SYF.js → render-settings-C_kIMq8Y.js} +1 -1
  305. package/dist/assets/{resolve-three-SZE_WWUM.js → resolve-three-C-nx-QdA.js} +13 -13
  306. package/dist/assets/{root-seam-contract-Z0VWX3Bk.js → root-seam-contract-C7GOxf5x.js} +1 -1
  307. package/dist/assets/{run-ticks-settled-C4ksViyA.js → run-ticks-settled-B0cTtmhQ.js} +1 -1
  308. package/dist/assets/{scene-capture-CGYF-Viw.js → scene-capture-CLOc7GXc.js} +1 -1
  309. package/dist/assets/{scene-capture-BQKzU0NT.js → scene-capture-D10Nxkvp.js} +1 -1
  310. package/dist/assets/scene-document.service-B7kAVTko.js +2 -0
  311. package/dist/assets/{scene-framing-Cat0GtyJ.js → scene-framing-50N7SKuX.js} +1 -1
  312. package/dist/assets/{scene-index-B6BZOHMk.js → scene-index-Bce459yu.js} +1 -1
  313. package/dist/assets/{scene-query-C7_N-TpI.js → scene-query-IUZhw6pA.js} +1 -1
  314. package/dist/assets/{schema-kl9-2B_J.js → schema-Iy-mbzll.js} +1 -1
  315. package/dist/assets/sculpt.layout-D-K5cLw6.js +1 -0
  316. package/dist/assets/{seeded-random-i3mtgBKZ.js → seeded-random-CN0scLZj.js} +1 -1
  317. package/dist/assets/{session-CZ5JPg-z.js → session-CsR0lApe.js} +24 -15
  318. package/dist/assets/{setup-audio-S8GQF91f.js → setup-audio-BJ18gvXZ.js} +1 -1
  319. package/dist/assets/setup-particles-B6H-GbAA.js +1 -0
  320. package/dist/assets/{setup-physics-BeZ7-LKD.js → setup-physics-GugbTT0J.js} +1 -1
  321. package/dist/assets/{setup-renderer-DVXaSGin.js → setup-renderer-wt_a-p8r.js} +20 -20
  322. package/dist/assets/shading.layout-CZZHKBer.js +1 -0
  323. package/dist/assets/{sim-clock-CLflx7kg.js → sim-clock-DEfbb_-P.js} +1 -1
  324. package/dist/assets/{soft-particle-depth-DGvfQDi1.js → soft-particle-depth-CKUS1j0Y.js} +1 -1
  325. package/dist/assets/source-object3d-authoring-adapter-CfHQLFAL.js +1 -0
  326. package/dist/assets/{source-persistence-backend-C-aR-B_Y.js → source-persistence-backend-_-JMEXxE.js} +1 -1
  327. package/dist/assets/{spark-renderer-lifecycle-ynWESJcv.js → spark-renderer-lifecycle-9mnMW3Z4.js} +1 -1
  328. package/dist/assets/{spark.module-4pXQoz5d.js → spark.module-CXth-y_a.js} +1 -1
  329. package/dist/assets/stage-keyboard-C0FdDLOQ.js +1 -0
  330. package/dist/assets/stage-overlay-set-CwhCzbOy.js +1 -0
  331. package/dist/assets/stage-presence-markers-DVMDKiB-.js +1 -0
  332. package/dist/assets/stage-transform-tools-B09Z7v0o.js +1 -0
  333. package/dist/assets/standard-viewport-dressing-GUUr6GuK.js +20 -0
  334. package/dist/assets/{state-watch.action-BOvQR2qt.js → state-watch.action-CgF8qoFC.js} +1 -1
  335. package/dist/assets/{state-watch.menu-CNLvDeeY.js → state-watch.menu-CIMncESW.js} +1 -1
  336. package/dist/assets/{state-watch.utility-Bg1tTTQU.js → state-watch.utility-zTHkUALC.js} +1 -1
  337. package/dist/assets/static-batch-advisor-DqfXWRUq.js +1 -0
  338. package/dist/assets/story-capture-COQgezzl.js +1 -0
  339. package/dist/assets/story-documents-DQ0KORmd.js +3 -0
  340. package/dist/assets/story-documents.service-DOSaqPqv.js +1 -0
  341. package/dist/assets/story-documents.service-Gb7oUkbg.js +1 -0
  342. package/dist/assets/{story-media-presence-BHzk2IV5.js → story-media-presence-nW3zJqKv.js} +1 -1
  343. package/dist/assets/story-pixi-preview-COPTEsHo.js +1 -0
  344. package/dist/assets/story-presentation-CxADj5oz.js +1 -0
  345. package/dist/assets/{story-three-preview-BHEDZzcl.js → story-three-preview-C9W__8Or.js} +2 -2
  346. package/dist/assets/{structural-ids-Dc-7rEwi.js → structural-ids-CblajJQK.js} +1 -1
  347. package/dist/assets/studio-CysTBGIb.exr +0 -0
  348. package/dist/assets/sunrise-Dj0psFrf.exr +0 -0
  349. package/dist/assets/sunset-Bw3x2Bot.exr +0 -0
  350. package/dist/assets/{surface-state-DaxyruCj.js → surface-state-BAUJu6GY.js} +1 -1
  351. package/dist/assets/{system-runner-DkOjxEBt.js → system-runner-D_DtVrer.js} +1 -1
  352. package/dist/assets/team-playtest.service--79O6xkx.js +1 -0
  353. package/dist/assets/{three-CDSueJyJ.js → three-DSsr_Lvp.js} +1 -1
  354. package/dist/assets/{three-authoring-adapter-CmSQ3Vui.js → three-authoring-adapter-Yqsank46.js} +1 -1
  355. package/dist/assets/three-authoring.service-BDos-bRt.js +2 -0
  356. package/dist/assets/{three-ingest-runtime-QzDYk6tU.js → three-ingest-runtime-DWijtqQ8.js} +1 -1
  357. package/dist/assets/{three-projection-core-BmKMZ-nf.js → three-projection-core-kubBTx0s.js} +1 -1
  358. package/dist/assets/three-story-model-BraQFA9h.js +1 -0
  359. package/dist/assets/three-viewport-presentation-BL7Uc2i6.js +1 -0
  360. package/dist/assets/{three.module-D396a9Mn.js → three.module-IFn-4i31.js} +1 -1
  361. package/dist/assets/three.quarks.esm-CRKGjKAH.js +1039 -0
  362. package/dist/assets/transform-mode-request-Cu7ewbtr.js +1 -0
  363. package/dist/assets/{transform-writer-BhBBTx33.js → transform-writer-DXxrI4t7.js} +1 -1
  364. package/dist/assets/transport.header-CeND8Vzh.js +1 -0
  365. package/dist/assets/{trigger-volume-BNK2XzPL.js → trigger-volume-BCVRS3NM.js} +1 -1
  366. package/dist/assets/{tuples-CIQ4Bn1U.js → tuples-DKDGrN1t.js} +1 -1
  367. package/dist/assets/ui-board-document-DD2CAEAo.js +2 -0
  368. package/dist/assets/unity.style-vCmLw4gI.js +1 -0
  369. package/dist/assets/unity.view-DIn2S6Do.js +1 -0
  370. package/dist/assets/unreal.style-BQn-HhOX.js +1 -0
  371. package/dist/assets/unreal.view-adNBETZK.js +1 -0
  372. package/dist/assets/user-data-CZqsJDk-.js +1 -0
  373. package/dist/assets/{utility-view-state-BHypxA33.js → utility-view-state-DYJY8V8O.js} +1 -1
  374. package/dist/assets/uv-editing.layout-A8RA-cbM.js +1 -0
  375. package/dist/assets/{vgai-shared-three-Bc5PvpLM.js → vgai-shared-three-D_RAEumG.js} +1 -1
  376. package/dist/assets/{viewport-root-presentation-CWsE56K6.js → viewport-root-presentation-C9M98VNM.js} +1 -1
  377. package/dist/assets/{viewport-shading-BuA88e_A.js → viewport-shading-BzcvgJhK.js} +1 -1
  378. package/dist/assets/viewport-shading-boundary-CBvvzS-p.js +84 -0
  379. package/dist/assets/{viewport-surface-status-B3om4Kcf.js → viewport-surface-status-BFmnWp7z.js} +1 -1
  380. package/dist/assets/voxel-surface-ROWYug7H.js +1 -0
  381. package/dist/assets/webgl-frame-capture-CRKX73E9.js +1 -0
  382. package/dist/assets/webworkerAll-CehoCtFb.js +1 -0
  383. package/dist/assets/{worker-UrMcrc5_.js → worker-B7zhIsFh.js} +2 -2
  384. package/dist/assets/world-documents-DErHq15h.js +1 -0
  385. package/dist/assets/world-root-stage-binding-BIymcQ4K.js +1 -0
  386. package/dist/assets/{world-state-BWG-IcOd.js → world-state-ZGDGY_Xl.js} +1 -1
  387. package/dist/assets/{writer-B-KovzkA.js → writer-BPbm4_my.js} +5 -5
  388. package/dist/assets/xstate-animation-binding-Cvd4JbEY.js +1 -0
  389. package/dist/assets/{xstate-animation-meta-Q3u9zh_m.js → xstate-animation-meta-B3OZR8Q2.js} +1 -1
  390. package/dist/vgai-shared-three.json +1 -1
  391. package/dist-node/cli.js +317 -73
  392. package/dist-node/create.js +59 -19
  393. package/package.json +16 -13
  394. package/src/index.ts +6 -0
  395. package/template/.agents/skills/vgai-3d-models/SKILL.md +3 -3
  396. package/template/.agents/skills/vgai-threejs-authoring/SKILL.md +4 -9
  397. package/template/.claude/skills/vgai-3d-models/SKILL.md +3 -3
  398. package/template/.claude/skills/vgai-threejs-authoring/SKILL.md +4 -9
  399. package/template/.github/skills/vgai-3d-models/SKILL.md +3 -3
  400. package/template/.github/skills/vgai-threejs-authoring/SKILL.md +4 -9
  401. package/template/AGENTS.md +1 -1
  402. package/template/check-idioms.ts +4 -5
  403. package/template/package.json +9 -9
  404. package/template/tsconfig.json +1 -0
  405. package/template/vgai.adapter.ts +1 -0
  406. package/template-dotfiles/gitignore +2 -0
  407. package/workbench/src/media/game-cover.css +1 -1
  408. package/catalog/project-source/src/lib/bake/mesh-slice.ts +0 -157
  409. package/dist/assets/BufferGeometryUtils-Nz37EVXf.js +0 -1
  410. package/dist/assets/CanvasSceneViewport-Bpi6gVTC.js +0 -1
  411. package/dist/assets/ColladaLoader-aVOPIsCh.js +0 -3
  412. package/dist/assets/EXRLoader-Cdans_oJ.js +0 -1
  413. package/dist/assets/EffectComposer-DQxfsXBZ.js +0 -1
  414. package/dist/assets/EntityModelDocument-Ccvw66N9.js +0 -1
  415. package/dist/assets/EnvironmentAssetDocument-Dg-Qq6O6.js +0 -1
  416. package/dist/assets/FBXLoader-B4MoUtAn.js +0 -1
  417. package/dist/assets/Fbo-Dz-Soul3.js +0 -1
  418. package/dist/assets/GLTFExporter-HgrCle4L.js +0 -1
  419. package/dist/assets/Gltf-UHVWKz65.js +0 -2
  420. package/dist/assets/HDRLoader-THU88oVD.js +0 -5
  421. package/dist/assets/ImageViewer-Tn7s_MnW.js +0 -1
  422. package/dist/assets/InspectorObjectPreview-CVejvLRg.js +0 -1
  423. package/dist/assets/JsonAssetDocument-C7VGcLhu.js +0 -3
  424. package/dist/assets/MeshBVH-BiDHDcu-.js +0 -1
  425. package/dist/assets/ModelAssetDocument-F5GACirk.js +0 -1
  426. package/dist/assets/Object3DDocumentViewport-DB7T0NTl.js +0 -2
  427. package/dist/assets/Object3DPreview-DL8oi7Xs.js +0 -2
  428. package/dist/assets/OnlineAssetDetail-C6z9RvYK.js +0 -2
  429. package/dist/assets/PlayBar-BR-Vg3Jb.js +0 -2
  430. package/dist/assets/RGBELoader-BgBcQv8j.js +0 -1
  431. package/dist/assets/RectAreaLightUniformsLib-CMMoWfll.js +0 -1
  432. package/dist/assets/RootSelectionOverlay-BZPlxmXU.js +0 -1
  433. package/dist/assets/STLLoader-Dyv3lsxY.js +0 -1
  434. package/dist/assets/SimplifyModifier-C8ayvRzd.js +0 -1
  435. package/dist/assets/SourceAssetViewer-2SWQoUut.js +0 -12
  436. package/dist/assets/StageHost-BN-IoTef.js +0 -2
  437. package/dist/assets/ThreeBoardDocument-CVncZyIq.js +0 -2
  438. package/dist/assets/asset-budget-asset.menu-Di3KiQCd.js +0 -1
  439. package/dist/assets/asset-budget.action-DCzzcuTh.js +0 -1
  440. package/dist/assets/asset-budget.document-BWU8wnVW.js +0 -1
  441. package/dist/assets/asset-budget.menu-BGZpT_31.js +0 -1
  442. package/dist/assets/autoplay.service-BZBGNSvt.js +0 -1
  443. package/dist/assets/blender-emscripten-engine-9ZIRYNhe.js +0 -2
  444. package/dist/assets/blender-properties-tab-C5CyPydi.js +0 -3
  445. package/dist/assets/blender-runtime-host-BpBwGv7r.js +0 -4
  446. package/dist/assets/blender-runtime.document-lIYhhPtv.js +0 -8
  447. package/dist/assets/blender.command-BtJeWk-A.js +0 -1
  448. package/dist/assets/body-marks-h_xDxiDE.js +0 -1
  449. package/dist/assets/bridge.command-o5gDNEwa.js +0 -3
  450. package/dist/assets/browserAll-DeWblVez.js +0 -1
  451. package/dist/assets/canvas-entry-runtime-SfBxaR9M.js +0 -2
  452. package/dist/assets/component-board.service-DidCyM4O.js +0 -2
  453. package/dist/assets/component-verbs.service-Bv9jId3q.js +0 -1
  454. package/dist/assets/constraints.inspector-B9U9Yj-u.js +0 -1
  455. package/dist/assets/coverage.service-VTX5Mcsx.js +0 -3
  456. package/dist/assets/deferred-ingest-play-DCJi_Pgu.js +0 -2
  457. package/dist/assets/design-time-layers-wYgOTgni.js +0 -1
  458. package/dist/assets/design-time-mount.service-BzY21e1F.js +0 -2
  459. package/dist/assets/design-time-react-mount-DM9WLrF2.js +0 -1
  460. package/dist/assets/edit-mode-authoring-B47TfLqu.js +0 -1
  461. package/dist/assets/editor-api-BoJIcyZG.js +0 -1
  462. package/dist/assets/fflate.module-DPuTF8aG.js +0 -6
  463. package/dist/assets/fork-menu-BoVyw2Wu.js +0 -1
  464. package/dist/assets/game-document.service-DbRfx2V0.js +0 -1
  465. package/dist/assets/game-eval.command-D-7Dxbj_.js +0 -2
  466. package/dist/assets/gameplay-replay-e5umMlXv.js +0 -1
  467. package/dist/assets/gameplay.command-DxcVYX6F.js +0 -1
  468. package/dist/assets/generation.service-CDIgObuw.js +0 -1
  469. package/dist/assets/index-96FBF1Oj.js +0 -1
  470. package/dist/assets/index-BAWkB0dv.js +0 -1
  471. package/dist/assets/index-BDnS2b6S.js +0 -1
  472. package/dist/assets/index-BjTCPEQ7.js +0 -134
  473. package/dist/assets/index-CVCb_ImQ.js +0 -1
  474. package/dist/assets/index-CZd9o7Lu.js +0 -1
  475. package/dist/assets/index-D2fNXpHa.css +0 -1
  476. package/dist/assets/index-GIL7oGEO.js +0 -4894
  477. package/dist/assets/index-OrYXPk3Z.js +0 -487
  478. package/dist/assets/ingest-boot-viewport-D5rI_Kk_.js +0 -1
  479. package/dist/assets/ingest-siblings-Bop2kqVl.js +0 -1
  480. package/dist/assets/instances.command-D6UkZNO8.js +0 -1
  481. package/dist/assets/light-camera-factory-CWbbe9gI.js +0 -1
  482. package/dist/assets/live-behaviors-Bxq49Maz.js +0 -1
  483. package/dist/assets/matcap-texture-CVfalpWT.js +0 -1
  484. package/dist/assets/model-asset-sections.service-CHhFS3ZX.js +0 -1
  485. package/dist/assets/model.layout-BJUEQYUI.js +0 -1
  486. package/dist/assets/module-mode-DVBLT9d-.js +0 -2
  487. package/dist/assets/mount-canvas-ingest-root-DDuAWf_C.js +0 -2
  488. package/dist/assets/mount-dom-ingest-root-D_EiBgpn.js +0 -2
  489. package/dist/assets/mount-ingest-root-glv2SSWf.js +0 -2
  490. package/dist/assets/mount-three-ingest-root-hrUt9VVU.js +0 -1
  491. package/dist/assets/particles-factory-DnLOHXT8.js +0 -1
  492. package/dist/assets/pasteboard-materialize-BqSS4QzV.js +0 -20
  493. package/dist/assets/pasteboard.action-DU3UHtJG.js +0 -2
  494. package/dist/assets/pixi-authoring-adapter-CjibysC3.js +0 -1
  495. package/dist/assets/pixi-primitive-DlWbUPN9.js +0 -1
  496. package/dist/assets/pixi-react-root-factory-DYsznYRQ.js +0 -1
  497. package/dist/assets/play-mode-BFU2PCkG.js +0 -22
  498. package/dist/assets/play.command-BpqqLqkq.js +0 -2
  499. package/dist/assets/project-authoring-session-Bnt6icLr.js +0 -2
  500. package/dist/assets/r3f-design-session-D-4yyDO9.js +0 -2
  501. package/dist/assets/r3f-physics-binding-BBo8oma9.js +0 -1
  502. package/dist/assets/r3f-source-authoring-adapter-w6Bc60K-.js +0 -13
  503. package/dist/assets/react-inspector.service-B_neRnSK.js +0 -1
  504. package/dist/assets/react-story-board-BDDwiE2H.js +0 -1
  505. package/dist/assets/react-world-authoring-adapter-DmrwM3py.js +0 -1
  506. package/dist/assets/runtime-inspection-l2iFQSsg.js +0 -1
  507. package/dist/assets/scene-document.service-qkDjUrlP.js +0 -2
  508. package/dist/assets/sculpt.layout-zJF55yCR.js +0 -1
  509. package/dist/assets/setup-particles-GCXlnkj_.js +0 -1
  510. package/dist/assets/shading.layout-DULYZV6M.js +0 -1
  511. package/dist/assets/source-object3d-authoring-adapter-B-L6Ha6f.js +0 -1
  512. package/dist/assets/stage-invalidation-DBg3C3Ta.js +0 -1
  513. package/dist/assets/stage-keyboard-n-5kKH-m.js +0 -1
  514. package/dist/assets/stage-overlay-set-B9zp2sLB.js +0 -1
  515. package/dist/assets/stage-presence-markers-DiGI6A45.js +0 -1
  516. package/dist/assets/standard-viewport-dressing-CzjAe_0A.js +0 -7
  517. package/dist/assets/static-batch-advisor-B13QEH7d.js +0 -1
  518. package/dist/assets/story-capture-_gC8dXV-.js +0 -1
  519. package/dist/assets/story-documents--TDLaPeL.js +0 -3
  520. package/dist/assets/story-documents.service-BiS_YbNQ.js +0 -1
  521. package/dist/assets/story-documents.service-CxOPYJ2j.js +0 -1
  522. package/dist/assets/story-pixi-preview-BUrOJZXS.js +0 -1
  523. package/dist/assets/story-presentation-j2AVN-mK.js +0 -1
  524. package/dist/assets/team-playtest.service-DqOinFVA.js +0 -1
  525. package/dist/assets/three-authoring.service-iuHLwtf1.js +0 -2
  526. package/dist/assets/three-viewport-presentation-QBQpSdMh.js +0 -1
  527. package/dist/assets/three.quarks.esm-B1C61jGo.js +0 -1039
  528. package/dist/assets/transport.header-B-6HQlU2.js +0 -1
  529. package/dist/assets/ui-board-document-Bwtt--xp.js +0 -2
  530. package/dist/assets/use-live-actor-state-DErbWQWF.js +0 -1
  531. package/dist/assets/user-data-BB2Of6Ht.js +0 -1
  532. package/dist/assets/uv-editing.layout-BEKHxmHw.js +0 -1
  533. package/dist/assets/viewport-shading-boundary-B_-_gABg.js +0 -82
  534. package/dist/assets/voxel-surface-DtcsSWRL.js +0 -1
  535. package/dist/assets/webgl-frame-capture-FlF9zQmW.js +0 -1
  536. package/dist/assets/webworkerAll-CM2o_dnz.js +0 -1
  537. package/dist/assets/world-documents-147tiFZe.js +0 -1
  538. package/dist/assets/world-root-stage-binding-vwTrtBz6.js +0 -1
  539. package/dist/assets/xstate-animation-binding-Brd0NST6.js +0 -1
  540. package/dist/assets/xstate-behavior.action-B8UluFBK.js +0 -1
  541. package/dist/assets/xstate-behavior.document-CKAsE45I.js +0 -1
  542. package/dist/assets/xstate-behavior.inspector-vJJyuifc.js +0 -1
  543. package/dist/assets/xstate-behavior.menu-BXbPICIh.js +0 -1
  544. package/dist/assets/xstate-inspection-BsZv8LS9.js +0 -1
@@ -1 +1 @@
1
- import{aI as j,jO as N,jP as K,jQ as $,O as P,aH as A,fJ as E,jR as S}from"./index-GIL7oGEO.js";import{g as W}from"./viewport-pick-context-DkawXbEi.js";import{g as z,t as V,ao as G}from"./three.module-D396a9Mn.js";function J(n){const t=j(n,"constraints");return Array.isArray(t)?t.filter(e=>!!e&&typeof e=="object"&&typeof e.getSnapshot=="function"&&!!e.config):[]}const M="ingest:camera",Q=1<<31;function U(n){return(n.layers.mask&Q)!==0}function q(n,t){const e=new Map;let r=0,s=0,f=0;const u=(i,c)=>{const o=`ingest:${c}:${i.type}:${i.name||""}`;e.set(o,i),r++,i.isLight?f++:i.isMesh&&s++,d(i,c)},d=(i,c)=>{let o=0;for(const h of i.children)U(h)||(u(h,c?`${c}/${o}`:`${o}`),o++)};return d(n,""),t&&(e.set(M,t),r++),{byId:e,count:r,meshes:s,lights:f}}function Y(n){const t=j(n,"authoringSubject");return t&&typeof t.label=="string"&&typeof t.kind=="string"?t:null}function Z(n){const t=j(n,"reflectionProbe");if(!t||typeof t!="object")return null;const e=t;return e.config&&typeof e.recapture=="function"&&typeof e.getSnapshot=="function"?t:null}function R(n){return n.depthWrite===!1&&n.side===G}function X(n){const t=n.material;return t?Array.isArray(t)?t.length>0&&t.every(R):R(t):!1}function D(n,t,e,r=()=>!1,s){const f=W();if(!f)return[];const u=f.canvas.getBoundingClientRect();if(u.width<=0||u.height<=0||!Number.isFinite(t)||!Number.isFinite(e)||t<u.left||e<u.top||t>=u.left+u.width||e>=u.top+u.height)return[];const d=new z((t-u.left)/u.width*2-1,-((e-u.top)/u.height)*2+1),i=new V;i.layers.enableAll(),i.setFromCamera(d,f.camera);const c=new Set(s?.objects??n.objectMap.values()),o=[...c].filter(O=>{for(let I=O.parent;I;I=I.parent)if(c.has(I))return!1;return!0});for(const O of o)O.traverse(I=>{const v=I;v.isSkinnedMesh&&(v.boundingBox=null,v.boundingSphere=null)});const h=i.intersectObjects(o,!0),p=[],m=new Set;for(const O of h){if(N(O.object)||X(O.object))continue;let I=O.object,v=null;if(s)for(;I&&v===null;)v=s.idForObject3D(I),I=I.parent;else{const a=K(I);v=a?$(a)??null:null}v!==null&&!r(v)&&!m.has(v)&&(m.add(v),p.push(v))}return tt(p,o,h.length,t,e),p}function tt(n,t,e,r,s){n.length>0||r===0&&s===0||console.info(`[viewport-pick] click selected nothing (candidates ${t.length}, rayHits ${e}, resolvedIds 0)`)}function et(n,t,e,r=()=>!1,s){return D(n,t,e,r,s)[0]??null}const C={count:0,meshes:0,lights:0,instancedMeshes:0,instances:0};let x=0;function H(n){let t=0,e=0;for(const r of n.values()){const s=r.object;s.isInstancedMesh&&(t++,e+=typeof s.count=="number"?s.count:0)}return{instancedMeshes:t,instances:e}}function L(n){let t=0,e=0;for(const r of n.values()){const s=r.object;s.isLight?e++:s.isMesh&&t++}return{count:n.size,meshes:t,lights:e,...H(n)}}function T(n,t){const e=new Map,r=[],s=t.skip??A;t.begin?.(n);const f=(u,d,i,c)=>{if(s(u))return;const o=t.identify(u,{path:d,ownerId:i,ownedByAncestor:c});o!==null&&(P(u,o),e.set(o,{object:u,id:o,parentId:i,childIds:[]}),i===null?r.push(o):e.get(i)?.childIds.push(o));const h=c||o!==null;u.children.forEach((p,m)=>{f(p,[...d,m],o??i,h)}),t.leave?.(u,o)};return n.children.forEach((u,d)=>{f(u,[d],null,!1)}),{nodes:e,rootIds:r,stats:L(e)}}const nt="r3f:";function B(n,t){return`${nt}${n}:${t}`}function st(n){const t=new Map,e=new Map,r=(d,i)=>d===i||d.startsWith(`${i}#`)&&/^\d+$/u.test(d.slice(i.length+1)),s=d=>{e.clear();const i=c=>{if(A(c))return;const o=E(c),h=$(c);if(o!==void 0&&h!==void 0){const p=B(n,o);r(h,p)&&!e.has(h)&&e.set(h,c)}for(const p of c.children)i(p)};for(const c of d.children)i(c)},f=(d,i)=>{const c=$(d);if(c===void 0||i===void 0)return c;const o=B(n,i);return r(c,o)?e.get(c)===d?c:void 0:c},u=(d,i)=>{const c=B(n,i);let o=t.get(i)??0,h=S(c,o);for(;e.has(h);)o+=1,h=S(c,o);return t.set(i,o+1),e.set(h,d),h};return{begin:d=>{t.clear(),s(d)},identify:(d,i)=>{const c=E(d),o=f(d,c);if(o!==void 0)return o;const h=c===void 0?void 0:u(d,c);return h!==void 0||!i.ownedByAncestor||j(d,"authoringRoot")===!0?h??`live:${n}:${x++}`:null}}}function F(n,t){return T(n,st(t))}function dt(n,t){const{nodes:e}=F(n,t),r=new Map;for(const[s,f]of e)r.set(s,f.object);return r}function at(n,t={}){const e=t.camera;return{incremental:{kind:"live-oid",worldId:n},project:r=>{const s=F(r,n);return!e||[...s.nodes.values()].some(f=>f.object===e)?s:(P(e,M),s.nodes.set(M,{object:e,id:M,parentId:null,childIds:[]}),s.rootIds.push(M),{...s,stats:{...s.stats,count:s.nodes.size}})}}}function ut(n={}){const t=n.camera;return{project:e=>{const r=q(e,t),s=new Map;for(const[d,i]of r.byId)s.set(i,d);const f=new Map,u=[];for(const[d,i]of r.byId){const c=i.parent,o=(c&&c!==e?s.get(c):void 0)??null,h=i.children.map(p=>s.get(p)).filter(p=>p!==void 0);f.set(d,{object:i,id:d,parentId:o,childIds:h}),o===null&&u.push(d)}return{nodes:f,rootIds:u,stats:{count:r.count,meshes:r.meshes,lights:r.lights,...H(f)}}}}}function lt(n){let t=new Map,e=new Map;return{get instanceRoots(){return t},get representatives(){return e},project:r=>{const s=new Map,f=new Map,u=new Map,d=new Set,i=new Map,c=T(r,{identify:(o,h)=>{const p=E(o);if(p===void 0)return B(n,`@${h.path.join(".")}`);const m=s.get(p)??0;return s.set(p,m+1),m===0&&u.set(p,o),d.has(p)||(f.set(p,(f.get(p)??0)+1),d.add(p),i.set(o,p)),S(B(n,p),m)},leave:o=>{const h=i.get(o);h!==void 0&&(d.delete(h),i.delete(o))}});return t=f,e=u,c}}}function ft(n){return{project:t=>T(t,{skip:e=>!!j(e,"editorHelper")||e.isSkeletonHelper===!0,identify:(e,r)=>`source-object:${n}:${r.path.join(".")}`})}}function ht(n){const t=Y(n);return t?t.kind:J(n).length>0?"constraint-owner":Z(n)?"reflection-probe":n.isSkinnedMesh?"skinned-mesh":n.isBone?"bone":n.isLight?"light":n.isCamera?"camera":n.type==="Audio"||n.type==="PositionalAudio"||n.type==="AudioListener"?"audio":n.isMesh?"mesh":n.children.length>0?"group":"object"}function it(n,t){for(let e=n.parent;e!==null;e=e.parent)if(e===t)return!0;return!1}function _(n,t){if(n===t)return!0;for(let e=n.parent;e!==null;e=e.parent)if(e===t)return!0;return!1}class pt{constructor(t,e={}){this.identity=t,this.options=e}nodesById=new Map;objectsById=new Map;idsByObjectIndex=new Map;roots=[];walkStats=C;project(t){if(!t)return this.nodesById=new Map,this.objectsById=new Map,this.idsByObjectIndex=new Map,this.roots=[],this.walkStats=C,this.walkStats;const{nodes:e,rootIds:r,stats:s}=this.identity.project(t);return this.nodesById=e,this.objectsById=new Map([...e].map(([f,u])=>[f,u.object])),this.idsByObjectIndex=new Map([...e].map(([f,u])=>[u.object,f])),this.roots=r,this.walkStats=s,s}projectSubtrees(t,e){const r=this.identity.incremental;if(t===null||r?.kind!=="live-oid")return null;const s=e.filter((a,l)=>e.indexOf(a)===l&&!e.some(y=>y!==a&&it(a,y))),f=this.roots,u=new Set,d=new Set,i=new Set;for(const a of s)a.traverse(l=>{const y=this.idsByObjectIndex.get(l);if(y===void 0)return;const g=this.nodesById.get(y);g?.parentId!==null&&g?.parentId!==void 0&&i.add(g.parentId),u.add(y),this.nodesById.delete(y),this.objectsById.delete(y),this.idsByObjectIndex.delete(l)});const c=A,o=(a,l)=>{const y=this.objectsById.get(a);return y===void 0||y===l},h=(a,l)=>{const y=$(a);if(y!==void 0&&o(y,a))return y;const g=E(a);if(g!==void 0){const w=B(r.worldId,g);let b=0,k=S(w,b);for(;!o(k,a);)k=S(w,++b);return k}if(!l||j(a,"authoringRoot")===!0){let w=`live:${r.worldId}:${x++}`;for(;!o(w,a);)w=`live:${r.worldId}:${x++}`;return w}return null},p=(a,l,y)=>{if(c(a))return;const g=h(a,y);g!==null&&(P(a,g),this.nodesById.set(g,{object:a,id:g,parentId:l,childIds:[]}),this.objectsById.set(g,a),this.idsByObjectIndex.set(a,g),d.add(g),l!==null&&i.add(l));const w=g??l,b=y||g!==null;for(const k of a.children)p(k,w,b)};for(const a of s){if(!_(a,t))continue;let l=a.parent,y=null;for(;l!==null&&l!==t;){const g=this.idsByObjectIndex.get(l);if(g!==void 0){y=g;break}l=l.parent}p(a,y,y!==null)}const m=a=>{const l=[],y=g=>{if(c(g))return;const w=this.idsByObjectIndex.get(g);if(w!==void 0){l.push(w);return}for(const b of g.children)y(b)};for(const g of a.children)y(g);return l};for(const a of i){const l=this.nodesById.get(a);l!==void 0&&l.childIds.splice(0,l.childIds.length,...m(l.object))}for(const a of d){const l=this.nodesById.get(a);l!==void 0&&l.childIds.splice(0,l.childIds.length,...m(l.object))}const O=m(t),I=this.roots.filter(a=>{const l=this.objectsById.get(a);return l!==void 0&&!_(l,t)&&!u.has(a)});this.roots=[...O,...I],this.walkStats=L(this.nodesById);const v=f.length!==this.roots.length||f.some((a,l)=>a!==this.roots[l]);return{removedIds:u,addedIds:d,changedParentIds:i,rootsChanged:v}}get nodes(){return this.nodesById}get objects(){return this.objectsById}get idsByObject(){return this.idsByObjectIndex}get rootIds(){return this.roots}get stats(){return this.walkStats}node(t){return this.nodesById.get(t)??null}rootNodes(){return this.roots.map(t=>this.nodesById.get(t)).filter(t=>t!==void 0)}objectOf(t){return this.objectsById.get(t)??null}idOf(t){return this.idsByObjectIndex.get(t)??null}childIdsOf(t){const e=[];for(const r of t){const s=this.idsByObjectIndex.get(r);s!==void 0&&e.push(s)}return e}objectMapSnapshot(){return new Map(this.objectsById)}pick(t,e,r,s){return et(t,e,r,s,this.pickProjection())}candidates(t,e,r,s){return D(t,e,r,s,this.pickProjection())}pickProjection(){if(this.options.pickScope!=="store-object-map")return{objects:this.objectsById.values(),idForObject3D:t=>this.idOf(t)}}}export{pt as T,at as a,ut as b,lt as c,ft as d,J as e,ht as n,Y as o,Z as r,dt as s};
1
+ import{aI as k,kr as N,ks as K,kt as $,Q as A,aJ as P,gA as E,ku as S}from"./index-Ckxb31Yz.js";import{g as W}from"./viewport-pick-context-DkawXbEi.js";import{g as z,q as V,ak as q}from"./three.module-IFn-4i31.js";function G(n){const t=k(n,"constraints");return Array.isArray(t)?t.filter(e=>!!e&&typeof e=="object"&&typeof e.getSnapshot=="function"&&!!e.config):[]}const M="ingest:camera",J=1<<31;function Q(n){return(n.layers.mask&J)!==0}function U(n,t){const e=new Map;let r=0,s=0,f=0;const u=(i,c)=>{const o=`ingest:${c}:${i.type}:${i.name||""}`;e.set(o,i),r++,i.isLight?f++:i.isMesh&&s++,d(i,c)},d=(i,c)=>{let o=0;for(const h of i.children)Q(h)||(u(h,c?`${c}/${o}`:`${o}`),o++)};return d(n,""),t&&(e.set(M,t),r++),{byId:e,count:r,meshes:s,lights:f}}function Y(n){const t=k(n,"authoringSubject");return t&&typeof t.label=="string"&&typeof t.kind=="string"?t:null}function Z(n){const t=k(n,"reflectionProbe");if(!t||typeof t!="object")return null;const e=t;return e.config&&typeof e.recapture=="function"&&typeof e.getSnapshot=="function"?t:null}function R(n){return n.depthWrite===!1&&n.side===q}function X(n){const t=n.material;return t?Array.isArray(t)?t.length>0&&t.every(R):R(t):!1}function D(n,t,e,r=()=>!1,s){const f=W();if(!f)return[];const u=f.canvas.getBoundingClientRect();if(u.width<=0||u.height<=0||!Number.isFinite(t)||!Number.isFinite(e)||t<u.left||e<u.top||t>=u.left+u.width||e>=u.top+u.height)return[];const d=new z((t-u.left)/u.width*2-1,-((e-u.top)/u.height)*2+1),i=new V;i.layers.enableAll(),i.setFromCamera(d,f.camera);const c=new Set(s?.objects??n.objectMap.values()),o=[...c].filter(b=>{for(let I=b.parent;I;I=I.parent)if(c.has(I))return!1;return!0});for(const b of o)b.traverse(I=>{const v=I;v.isSkinnedMesh&&(v.boundingBox=null,v.boundingSphere=null)});const h=i.intersectObjects(o,!0),p=[],m=new Set;for(const b of h){if(N(b.object)||X(b.object))continue;let I=b.object,v=null;if(s)for(;I&&v===null;)v=s.idForObject3D(I),I=I.parent;else{const a=K(I);v=a?$(a)??null:null}v!==null&&!r(v)&&!m.has(v)&&(m.add(v),p.push(v))}return tt(p,o,h.length,t,e),p}function tt(n,t,e,r,s){n.length>0||r===0&&s===0||console.info(`[viewport-pick] click selected nothing (candidates ${t.length}, rayHits ${e}, resolvedIds 0)`)}function et(n,t,e,r=()=>!1,s){return D(n,t,e,r,s)[0]??null}const C={count:0,meshes:0,lights:0,instancedMeshes:0,instances:0};let x=0;function L(n){let t=0,e=0;for(const r of n.values()){const s=r.object;s.isInstancedMesh&&(t++,e+=typeof s.count=="number"?s.count:0)}return{instancedMeshes:t,instances:e}}function H(n){let t=0,e=0;for(const r of n.values()){const s=r.object;s.isLight?e++:s.isMesh&&t++}return{count:n.size,meshes:t,lights:e,...L(n)}}function T(n,t){const e=new Map,r=[],s=t.skip??P;t.begin?.(n);const f=(u,d,i,c)=>{if(s(u))return;const o=t.identify(u,{path:d,ownerId:i,ownedByAncestor:c});o!==null&&(A(u,o),e.set(o,{object:u,id:o,parentId:i,childIds:[]}),i===null?r.push(o):e.get(i)?.childIds.push(o));const h=c||o!==null;u.children.forEach((p,m)=>{f(p,[...d,m],o??i,h)}),t.leave?.(u,o)};return n.children.forEach((u,d)=>{f(u,[d],null,!1)}),{nodes:e,rootIds:r,stats:H(e)}}const nt="r3f:";function O(n,t){return`${nt}${n}:${t}`}function st(n){const t=new Map,e=new Map,r=(d,i)=>d===i||d.startsWith(`${i}#`)&&/^\d+$/u.test(d.slice(i.length+1)),s=d=>{e.clear();const i=c=>{if(P(c))return;const o=E(c),h=$(c);if(o!==void 0&&h!==void 0){const p=O(n,o);r(h,p)&&!e.has(h)&&e.set(h,c)}for(const p of c.children)i(p)};for(const c of d.children)i(c)},f=(d,i)=>{const c=$(d);if(c===void 0||i===void 0)return c;const o=O(n,i);return r(c,o)?e.get(c)===d?c:void 0:c},u=(d,i)=>{const c=O(n,i);let o=t.get(i)??0,h=S(c,o);for(;e.has(h);)o+=1,h=S(c,o);return t.set(i,o+1),e.set(h,d),h};return{begin:d=>{t.clear(),s(d)},identify:(d,i)=>{const c=E(d),o=f(d,c);if(o!==void 0)return o;const h=c===void 0?void 0:u(d,c);return h!==void 0||!i.ownedByAncestor||k(d,"authoringRoot")===!0?h??`live:${n}:${x++}`:null}}}function F(n,t){return T(n,st(t))}function dt(n,t){const{nodes:e}=F(n,t),r=new Map;for(const[s,f]of e)r.set(s,f.object);return r}function at(n,t={}){const e=t.camera;return{incremental:{kind:"live-oid",worldId:n},project:r=>{const s=F(r,n);return!e||[...s.nodes.values()].some(f=>f.object===e)?s:(A(e,M),s.nodes.set(M,{object:e,id:M,parentId:null,childIds:[]}),s.rootIds.push(M),{...s,stats:{...s.stats,count:s.nodes.size}})}}}function ut(n={}){const t=n.camera;return{project:e=>{const r=U(e,t),s=new Map;for(const[d,i]of r.byId)s.set(i,d);const f=new Map,u=[];for(const[d,i]of r.byId){const c=i.parent,o=(c&&c!==e?s.get(c):void 0)??null,h=i.children.map(p=>s.get(p)).filter(p=>p!==void 0);f.set(d,{object:i,id:d,parentId:o,childIds:h}),o===null&&u.push(d)}return{nodes:f,rootIds:u,stats:{count:r.count,meshes:r.meshes,lights:r.lights,...L(f)}}}}}function lt(n){let t=new Map,e=new Map;return{get instanceRoots(){return t},get representatives(){return e},project:r=>{const s=new Map,f=new Map,u=new Map,d=new Set,i=new Map,c=T(r,{identify:(o,h)=>{const p=E(o);if(p===void 0)return O(n,`@${h.path.join(".")}`);const m=s.get(p)??0;return s.set(p,m+1),m===0&&u.set(p,o),d.has(p)||(f.set(p,(f.get(p)??0)+1),d.add(p),i.set(o,p)),S(O(n,p),m)},leave:o=>{const h=i.get(o);h!==void 0&&(d.delete(h),i.delete(o))}});return t=f,e=u,c}}}function ft(n){return{project:t=>T(t,{skip:e=>!!k(e,"editorHelper")||e.isSkeletonHelper===!0,identify:(e,r)=>`source-object:${n}:${r.path.join(".")}`})}}function ht(n){const t=Y(n);return t?t.kind:G(n).length>0?"constraint-owner":Z(n)?"reflection-probe":n.isSkinnedMesh?"skinned-mesh":n.isBone?"bone":n.isLight?"light":n.isCamera?"camera":n.type==="Audio"||n.type==="PositionalAudio"||n.type==="AudioListener"?"audio":n.isMesh?"mesh":n.children.length>0?"group":"object"}function it(n,t){for(let e=n.parent;e!==null;e=e.parent)if(e===t)return!0;return!1}function _(n,t){if(n===t)return!0;for(let e=n.parent;e!==null;e=e.parent)if(e===t)return!0;return!1}class pt{constructor(t,e={}){this.identity=t,this.options=e}nodesById=new Map;objectsById=new Map;idsByObjectIndex=new Map;roots=[];walkStats=C;project(t){if(!t)return this.nodesById=new Map,this.objectsById=new Map,this.idsByObjectIndex=new Map,this.roots=[],this.walkStats=C,this.walkStats;const{nodes:e,rootIds:r,stats:s}=this.identity.project(t);return this.nodesById=e,this.objectsById=new Map([...e].map(([f,u])=>[f,u.object])),this.idsByObjectIndex=new Map([...e].map(([f,u])=>[u.object,f])),this.roots=r,this.walkStats=s,s}projectSubtrees(t,e){const r=this.identity.incremental;if(t===null||r?.kind!=="live-oid")return null;const s=e.filter((a,l)=>e.indexOf(a)===l&&!e.some(y=>y!==a&&it(a,y))),f=this.roots,u=new Set,d=new Set,i=new Set;for(const a of s)a.traverse(l=>{const y=this.idsByObjectIndex.get(l);if(y===void 0)return;const g=this.nodesById.get(y);g?.parentId!==null&&g?.parentId!==void 0&&i.add(g.parentId),u.add(y),this.nodesById.delete(y),this.objectsById.delete(y),this.idsByObjectIndex.delete(l)});const c=P,o=(a,l)=>{const y=this.objectsById.get(a);return y===void 0||y===l},h=(a,l)=>{const y=$(a);if(y!==void 0&&o(y,a))return y;const g=E(a);if(g!==void 0){const w=O(r.worldId,g);let B=0,j=S(w,B);for(;!o(j,a);)j=S(w,++B);return j}if(!l||k(a,"authoringRoot")===!0){let w=`live:${r.worldId}:${x++}`;for(;!o(w,a);)w=`live:${r.worldId}:${x++}`;return w}return null},p=(a,l,y)=>{if(c(a))return;const g=h(a,y);g!==null&&(A(a,g),this.nodesById.set(g,{object:a,id:g,parentId:l,childIds:[]}),this.objectsById.set(g,a),this.idsByObjectIndex.set(a,g),d.add(g),l!==null&&i.add(l));const w=g??l,B=y||g!==null;for(const j of a.children)p(j,w,B)};for(const a of s){if(!_(a,t))continue;let l=a.parent,y=null;for(;l!==null&&l!==t;){const g=this.idsByObjectIndex.get(l);if(g!==void 0){y=g;break}l=l.parent}p(a,y,y!==null)}const m=a=>{const l=[],y=g=>{if(c(g))return;const w=this.idsByObjectIndex.get(g);if(w!==void 0){l.push(w);return}for(const B of g.children)y(B)};for(const g of a.children)y(g);return l};for(const a of i){const l=this.nodesById.get(a);l!==void 0&&l.childIds.splice(0,l.childIds.length,...m(l.object))}for(const a of d){const l=this.nodesById.get(a);l!==void 0&&l.childIds.splice(0,l.childIds.length,...m(l.object))}const b=m(t),I=this.roots.filter(a=>{const l=this.objectsById.get(a);return l!==void 0&&!_(l,t)&&!u.has(a)});this.roots=[...b,...I],this.walkStats=H(this.nodesById);const v=f.length!==this.roots.length||f.some((a,l)=>a!==this.roots[l]);return{removedIds:u,addedIds:d,changedParentIds:i,rootsChanged:v}}get nodes(){return this.nodesById}get objects(){return this.objectsById}get idsByObject(){return this.idsByObjectIndex}get rootIds(){return this.roots}get stats(){return this.walkStats}node(t){return this.nodesById.get(t)??null}rootNodes(){return this.roots.map(t=>this.nodesById.get(t)).filter(t=>t!==void 0)}objectOf(t){return this.objectsById.get(t)??null}idOf(t){return this.idsByObjectIndex.get(t)??null}childIdsOf(t){const e=[];for(const r of t){const s=this.idsByObjectIndex.get(r);s!==void 0&&e.push(s)}return e}objectMapSnapshot(){return new Map(this.objectsById)}pick(t,e,r,s){return et(t,e,r,s,this.pickProjection())}candidates(t,e,r,s){return D(t,e,r,s,this.pickProjection())}pickProjection(){if(this.options.pickScope!=="store-object-map")return{objects:this.objectsById.values(),idForObject3D:t=>this.idOf(t)}}}export{pt as T,at as a,ut as b,lt as c,ft as d,G as e,ht as n,Y as o,Z as r,dt as s};
@@ -1 +1 @@
1
- import{dc as k,dE as B,V as v,aB as E,aF as X,dA as O,fE as z,fF as R,aH as P,fG as U,bT as W,fH as G,aq as N,bU as L,fI as Q,fJ as C,bR as Y,bS as Z,k as q,bV as ee}from"./index-GIL7oGEO.js";import{c as te,p as x,m as re,a as se}from"./source-persistence-backend-C-aR-B_Y.js";import{J as oe,c as ie}from"./json-history-resource-BbxllWfV.js";import{r as f,d as ne,a as ae}from"./ingest-source-persistence-C_6Hiyra.js";import{r as ce}from"./three-projection-core-BmKMZ-nf.js";import{a as _,T as le,n as he,b as ue}from"./three-CDSueJyJ.js";import{bodyOwningNode as T}from"./body-marks-h_xDxiDE.js";import{colorMaterialOf as y}from"./structural-ids-Dc-7rEwi.js";import{object3DAuthoringSubjectOf as F}from"./object3d-authoring-subject-CH5sI2oP.js";import{createRapierBodyEditing as de}from"./rapier-physics-adapter-CaZqWLu0.js";import{getUserData as m}from"./user-data-BB2Of6Ht.js";import{p as fe,b as me}from"./r3f-physics-binding-BBo8oma9.js";const pe={position:{owner:"self",member:"position",kind:"vector3"},rotation:{owner:"self",member:"rotation",kind:"euler"},scale:{owner:"self",member:"scale",kind:"vector3"},visible:{owner:"self",member:"visible",kind:"boolean"},name:{owner:"self",member:"name",kind:"string"},"material.color":{owner:"material",member:"color",kind:"color"},"light.color":{owner:"self",member:"color",kind:"color"},"light.intensity":{owner:"self",member:"intensity",kind:"number"},"light.distance":{owner:"self",member:"distance",kind:"number"},"camera.fov":{owner:"self",member:"fov",kind:"number"},"camera.near":{owner:"self",member:"near",kind:"number"},"camera.far":{owner:"self",member:"far",kind:"number"},"shadow.cast":{owner:"self",member:"castShadow",kind:"boolean"},"shadow.receive":{owner:"self",member:"receiveShadow",kind:"boolean"}},be={position:{owner:"self",member:"position",kind:"vector2",componentMembers:["x","y"]},rotation:{owner:"self",member:"rotation",kind:"number"},scale:{owner:"self",member:"scale",kind:"vector2"},visible:{owner:"self",member:"visible",kind:"boolean"},name:{owner:"self",member:"label",kind:"string"},alpha:{owner:"self",member:"alpha",kind:"number"},tint:{owner:"self",member:"tint",kind:"color"}},ye={position:{owner:"self",member:"position",kind:"vector3"},rotation:{owner:"self",member:"rotation",kind:"euler"},scale:{owner:"self",member:"scaling",kind:"vector3"},name:{owner:"self",member:"name",kind:"string"},visible:{owner:"self",member:"isVisible",kind:"boolean"},visibility:{owner:"self",member:"visibility",kind:"number"}};function D(l,t="three"){return(t==="pixi"?be:t==="babylon"?ye:pe)[l]??null}const J="the game's own JSX source (source-stamp write-back)",S={position:"position",rotation:"rotation",scale:"scale",visible:"visible",name:"name","material.color":"color","light.color":"color","light.intensity":"intensity","light.distance":"distance","camera.fov":"fov","camera.near":"near","camera.far":"far","shadow.cast":"castShadow","shadow.receive":"receiveShadow"};function H(l){const t=Math.round(l*1e4)/1e4;return Object.is(t,-0)?"0":String(t)}function K(l,t){const e=D(l)?.kind;return e==="vector3"||e==="euler"?!Array.isArray(t)||t.length!==3||!t.every(r=>typeof r=="number"&&Number.isFinite(r))?null:`[${t.map(H).join(", ")}]`:e==="number"?typeof t=="number"&&Number.isFinite(t)?H(t):null:e==="boolean"?typeof t=="boolean"?String(t):null:(e==="color"||e==="string")&&typeof t=="string"?t.replace(/["\\]/g,""):null}function V(l,t){const e=fe(l??void 0,t);if(e)return e;const r=l?.r3fAuthoring;if(!r||t!=="position"&&t!=="rotation"&&t!=="scale")return null;const s=`<${l?.tag??"this component"}>`;return r.simulationOwnedTransform===!0?`${s} drives its own ${t} every frame — this instance is placed by the simulation, not by the editor`:r.transformProps.includes(t)?null:`${s} does not forward ${t} to its native root`}function I(l){const t=l.file.replaceAll("\\","/"),e=X()?.rootPath.replaceAll("\\","/").replace(/\/$/,""),r=e&&t.startsWith(`${e}/`)?t.slice(e.length+1):t;return{anchored:!0,kind:"source",file:r,line:l.line,col:l.col,display:`${r}:${l.line}`}}async function Me(l){try{const e=await(l??k("Live source locations"))?.index?.();return r=>{const s=e?.[r];return s?I(s):null}}catch{return()=>null}}async function ge(l,t,e){const r=l.writeProp;if(!r)throw new Error("the gesture-scoped source writer cannot write JSX props");let s=0;for(const{property:o,text:i}of e){const a=await r(t,o,i,{addIfMissing:!0,allowShapeUpgrade:!0});if(a.dynamic)throw new Error(`${o} is bound to a JSX expression, not an authored literal`);if(!a.changed&&a.error)throw new Error(a.error);a.changed&&s++}return s}function ve(l){const t=l.backend??k("The Play→source transform committer"),e=B(t,l.history),r=o=>o?!e?.runGesture||!e.writeProp||!e.index?{available:!1,reason:"This editor session cannot open a checksum-guarded project-source gesture."}:{available:!0}:{available:!1,reason:"This live node has no OID source stamp, so no authored literal owns its pose."},s=o=>(v.warn(`[play] Commit live transform to source refused: ${o}`,"play-mode"),{destination:E,persisted:!1});return{availability:r,async commit(o,i){const a=r(o);if(!a.available||!o||!e?.runGesture||!e.index)return s(a.reason??"the source writer is unavailable");const c=(await e.index())[o]??null;if(!c)return s(`the current source index has no entry for OID "${o}"`);const h=["position","rotation","scale"].map(d=>{const j=V(c,d);if(j)throw new Error(j);const w=i[d],$=w===void 0?null:K(d,w);if($===null)throw new Error(`${d} is not a finite transform literal`);return{property:d,text:$}});let u;try{u=await e.runGesture("Commit Play Transform to Source",d=>ge(d,o,h))}catch(d){return s(d instanceof Error?d.message:String(d))}return u===0?(v.log("[play] Source already matches the selected live transform.","play-mode"),{destination:"source already matched the live transform",persisted:!1}):(v.log(`[play] Committed ${u} live transform literal(s) to ${c.file}:${c.line}.`,"play-mode"),{destination:J,persisted:!0})}}}function we(l){let t=null,e=new Map,r=!1;const s=async()=>{const n=t?.index;if(n)try{e=new Map(Object.entries(await n.call(t))),r=!0}catch{}},o=n=>n?e.get(n)??null:null,i=n=>{const c=o(n);return c?I(c).display:null},a=(n,c)=>{if(!n)return{ok:!1,reason:"this object carries no source stamp — the game built it at runtime rather than writing it as an element of its own source"};if(!t?.writeProp)return{ok:!1,reason:"this editor tier cannot write project source"};const h=S[c];if(!h)return{ok:!1,reason:`${c} has no JSX attribute this seam can write`};const u=V(o(n),h);if(u)return{ok:!1,reason:u};if(!O()){const d=i(n);return{ok:!1,reason:`${d?`written at ${d}`:"source-stamped"}, but this game is playing — hold it to author`}}return{ok:!0}};return{attach(){const n=l.backend??k("This world’s OID source persistence")??null;t=n?B(n,l.history)??n:null,s()},anchor(n){const c=e.get(n);return c?I(c):null},physicsPlaced(n,c){return me(o(n)??void 0,S[c]??c)},describe({sourceOid:n,property:c}){const h=a(n,c);if(!h.ok)return`Live-only edit — ${h.reason}.`;const u=i(n);return u?`Persisting to ${u}.`:`Persisting to this element's own JSX${r?"":" (source index still loading)"}.`},gate({sourceOid:n,property:c}){return a(n,c)},armed:()=>t?.writeProp!==void 0&&O(),report:(n,c)=>f(n,c),async write(n){const c=a(n.sourceOid,n.property);if(!c.ok)return f(n.label,c.reason),!1;const h=S[n.property],u=K(n.property,n.next);if(u===null)return f(n.label,`the new ${n.property} is not a value this seam can spell as a JSX literal`),!1;try{const d=await t.writeProp(n.sourceOid,h,u,{addIfMissing:!0,allowShapeUpgrade:!0});return d.dynamic?(f(n.label,`${h} at ${i(n.sourceOid)??"this element"} is bound to a JSX expression, not a literal`),!1):d.changed?(v.log(`[ingest] ${n.label} written to the game's own source — ${h} → ${i(n.sourceOid)??n.sourceOid}`),s(),!0):(f(n.label,d.error??"the source writer made no change"),!1)}catch(d){return f(n.label,`the write failed: ${d instanceof Error?d.message:String(d)}`),!1}},removal:{available({sourceOid:n,property:c}){return t?.removeProp?a(n,c).ok:!1},async perform(n){const c=a(n.sourceOid,n.property);if(!c.ok||!t?.removeProp)return f(n.label,c.ok?"this editor tier cannot remove project source":c.reason),!1;const h=S[n.property];try{const u=await t.removeProp(n.sourceOid,h);return u.dynamic?(f(n.label,`${h} at ${i(n.sourceOid)??"this element"} is bound to a JSX expression — removing it would delete the game's own wiring, not an override`),!1):u.changed?(v.log(`[ingest] ${n.label} — ${h} dropped from the game's own source at ${i(n.sourceOid)??n.sourceOid}`),s(),!0):(f(n.label,u.error??`${i(n.sourceOid)??"this element"} authors no ${h} attribute, so there was nothing to drop`),!1)}catch(u){return f(n.label,`the removal failed: ${u instanceof Error?u.message:String(u)}`),!1}}},destination(){return t?.writeProp&&O()?J:E},dispose(){t=null,e=new Map,r=!1}}}const Se={source:"live",label:"live",detail:"Running objects adopted from the live scene. Edits affect this session only and are discarded when play stops."},je="Applied to the running world; code that drives this transform each frame may overwrite it.",Oe={source:"foreign",label:"live-only",detail:"Unmodified ingested game — edits apply to the running game for this session only and are never saved."},Ce={source:"foreign",label:"game source",detail:"Ingested game whose own source carries the editor's authoring stamps — a literal JSX prop writes back to the game’s own file (expression-bound props stay read-only)."};function p(l){return l.isLight?l:null}function g(l){const t=l;return t.isPointLight||t.isSpotLight?t:null}function Ie(l){const t=l;return t.isDirectionalLight||t.isPointLight||t.isSpotLight?t:null}function b(l){const t=l;return t.isPerspectiveCamera?t:null}function M(l){const t=l;return t.isMesh&&t.geometry?t.geometry:null}class A{constructor(t,e,r){if(this.store=t,this.options=r,this.sceneRef=e,this.identity=r.identity,this.projector=new le(this.identity,{pickScope:"projection"}),this.persist=r.persistence??null,this.loop=r.loop,this.frameControl=r.frameControl??"adapter",this.provenance=r.provenance??Se,r.sourceCommit){const i={availability:a=>r.sourceCommit.availability(C(this.objectOf(a))),commit:async a=>{const n=this.objectOf(a),c=this.captureChannelBaseline(a)??{},h=await r.sourceCommit.commit(C(n),c);return h.persisted&&this.store.notifyIngestEdit(),h}};Object.assign(this.transforms,{sourceCommit:i})}r.sourceDeclaresStories&&(this.stories=z("three",t,i=>{const a=this.hierarchy.node(i);return a?.role!=="component"?null:{name:a.typeLabel??a.label}})),this.refresh(),this.watchStructure();const s=t.projectHistory;this.historyResource=this.persist&&s?new oe({history:s,kind:"session-state",scope:"session",subject:{...r.journal,id:`${r.journal.id}/live-three-edits`},displayName:"Live edits",capture:()=>this.captureHistoryState(),conflictIdentity:i=>i.edits,restore:async i=>{this.restoreHistoryState(i)}}):null;const o=this.persist;o&&(o.attach({read:(i,a)=>this.readChannel(i,a),apply:(i,a,n)=>this.applyChannel(i,a,n)}),this.persistence={...ie(),get destination(){return o.destination()}},o.readSiteLiterals&&(this.instances=this.creationSiteInstances(o)))}sceneRef;projector;watchedForStructure=new Set;changedStructureRoots=new Set;structureRefreshQueued=!1;disposed=!1;crossSurfaceStructureRevision=0;hasCrossSurfaceStructure=!1;identity;persist;loop;frameControl;instanceLiterals=new Map;instanceLiteralRequests=new Map;markedBodies=de(t=>{const e=this.objectOf(t);if(!e)return{kind:"unresolved"};const r=T(e);return r?{kind:"body",body:r}:{kind:"no-body"}});bodyOwnershipByObject=new WeakMap;physicsFor(t){const e=R();return e&&e.ownerOf(t)!=="unresolved"?e:null}edits={};historyResource;editStartState;editBaseline;capabilities={transform:!0,inspectorFields:!0,persist:!1};stories;instances;provenance;persistence;get scene(){return typeof this.sceneRef=="function"?this.sceneRef():this.sceneRef}refresh(){const t=this.projector.project(this.scene);return this.refreshCrossSurfacePresence(),this.crossSurfaceStructureRevision++,t}crossSurfaceStructureSignature(){return this.hasCrossSurfaceStructure?String(this.crossSurfaceStructureRevision):null}objectCarriesCrossSurfaceStructure(t){return m(t,"authoringHierarchyId")!==void 0||m(t,"authoringHierarchyParentId")!==void 0||m(t,"authoringHierarchyOrder")!==void 0}subtreeCarriesCrossSurfaceStructure(t){let e=!1;return t.traverse(r=>{this.objectCarriesCrossSurfaceStructure(r)&&(e=!0)}),e}refreshCrossSurfacePresence(){this.hasCrossSurfaceStructure=!1;for(const t of this.projector.nodes.values())if(this.objectCarriesCrossSurfaceStructure(t.object)){this.hasCrossSurfaceStructure=!0;return}}onStructureChanged=t=>{P(t.child)||this.disposed||(this.changedStructureRoots.add(t.child),!this.structureRefreshQueued&&(this.structureRefreshQueued=!0,queueMicrotask(()=>{if(this.structureRefreshQueued=!1,this.disposed)return;const e=[...this.changedStructureRoots];this.changedStructureRoots.clear();const r=e.some(o=>this.subtreeCarriesCrossSurfaceStructure(o));for(const o of e)this.unwatchStructureSubtree(o);const s=this.projector.projectSubtrees(this.scene,e);if(s===null)this.refresh(),this.watchStructure();else for(const o of e)this.structureRootIsAttached(o)&&this.watchStructureSubtree(o);r&&(this.refreshCrossSurfacePresence(),this.crossSurfaceStructureRevision++),this.syncAdoptedObjectMap(s??void 0),this.store.notifyIngestObjectMapEdit(s===null?void 0:{changedParentIds:s.changedParentIds,rootsChanged:s.rootsChanged,addedIds:s.addedIds,removedIds:s.removedIds})})))};watchStructure(){for(const e of this.watchedForStructure)e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure.clear();const t=this.scene;t&&this.watchStructureSubtree(t)}watchStructureSubtree(t){const e=r=>{if(!(P(r)||this.watchedForStructure.has(r))){r.addEventListener("childadded",this.onStructureChanged),r.addEventListener("childremoved",this.onStructureChanged),this.watchedForStructure.add(r);for(const s of r.children)e(s)}};e(t)}structureRootIsAttached(t){const e=this.scene;if(e===null)return!1;for(let r=t;r!==null;r=r.parent)if(r===e)return!0;return!1}unwatchStructureSubtree(t){t.traverse(e=>{this.watchedForStructure.delete(e)&&(e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged))})}syncAdoptedObjectMap(t){const e=this.scene;if(!e||this.store.scene!==e)return;const r=this.store.objectMap;if(t===void 0){r.clear();for(const[o,i]of this.projector.objectMapSnapshot())r.set(o,i)}else{for(const o of t.removedIds)r.delete(o);for(const o of t.addedIds){const i=this.projector.objectOf(o);i!==null&&r.set(o,i)}}const s=[...this.store.selectedEntityIds].filter(o=>r.has(o));s.length!==this.store.selectedEntityIds.size&&this.store.selectMultiple(s)}invalidate(){this.refresh()}adoptScene(t){this.sceneRef=t,this.refresh(),this.watchStructure(),this.syncAdoptedObjectMap()}objectOf(t){return this.projector.objectOf(t)}objectMapSnapshot(){return this.projector.objectMapSnapshot()}record(t,e){this.edits[t]={...this.edits[t],...e}}toEditorNode(t){const e=t.object,r=m(e,"authoringHierarchyId"),s=m(e,"authoringHierarchyParentId"),o=m(e,"authoringHierarchyOrder"),i=U(e)&&m(e,"authoringRoot")!==!0,a=m(e,"authoringComponent"),n=(i?m(e,"authoringLabel"):void 0)||e.name||e.type;return{id:t.id,label:n,role:i?"component":"entity",kind:he(e),typeLabel:i?a||n:e.type,parentId:t.parentId,childIds:[...t.childIds],...r===void 0?{}:{crossSurfaceId:r},...s===void 0?{}:{crossSurfaceParentId:s},...o===void 0?{}:{crossSurfaceOrder:o}}}hierarchy={crossSurfaceStructureSignature:()=>this.crossSurfaceStructureSignature(),roots:()=>this.projector.rootNodes().map(t=>this.toEditorNode(t)),node:t=>{const e=this.projector.node(t);return e?this.toEditorNode(e):null},object3D:t=>this.objectOf(t),idForObject3D:t=>this.projector.idOf(t)};selection={get:()=>[...this.store.selectedEntityIds],set:t=>this.store.selectMultiple(t),resolve:(t,e)=>{const r=this.hierarchy.node(t);if(!r)return null;const s=[];let o=r,i=0;for(;o&&i++<1e3;)(o.role==="component"||o.role==="instance")&&s.push(o),o=o.parentId?this.hierarchy.node(o.parentId):null;const a=s.reverse();if(a.length===0)return{id:t};const n=e?.scopeId?a.findIndex(u=>u.id===e.scopeId):-1,c=n>=0?Math.min(n+1,a.length-1):0,h=e?.intent==="deep"?Math.min(c+1,a.length-1):c;return{id:a[h].id}}};pickable={pick:(t,e)=>(this.refresh(),this.projector.pick(this.store,t,e)),candidates:(t,e)=>(this.refresh(),this.projector.candidates(this.store,t,e))};truth={resolve:(t,e)=>{const r=this.anchorFor(t,e);return{site:r.anchor,writeAnchorKind:r.anchorKind}}};related=te(t=>this.truth.resolve(t,"position").site);transforms={get:t=>ce(this.objectOf(t)),editability:(t,e)=>{if(!this.objectOf(t))return{writable:!1,reason:G};const r=N();return r?.networkId(t)&&!r.editable(t)?{writable:!1,reason:"This transform is controlled by remote or server network authority."}:this.bodyOwns(t)?{writable:!0,reason:"Moves the physics body that owns this node.",...this.removableFlag(t,e)}:this.frameControl==="host"&&this.store.playState==="playing"?{writable:!0,reason:je,...this.removableFlag(t,e)}:this.persist?{writable:!0,reason:this.persist.describe(this.anchorFor(t,e)),...this.removableFlag(t,e)}:{writable:!0}},beginEdit:t=>{this.historyResource?.assertCanMutate(),!(!this.objectOf(t)||!this.editableByNetwork(t))&&(this.loop?.pause(),this.physicsFor(t)?.freeze(t),this.markedBodies.freeze(t),this.editStartState=this.persist?this.captureHistoryState():void 0,this.editBaseline=void 0)},apply:(t,e)=>{!this.objectOf(t)||!this.editableByNetwork(t)||(this.persist&&!this.editBaseline&&(this.editBaseline=this.captureChannelBaseline(t)),this.writeTransform(t,e),this.physicsFor(t)?.commit(t,e),this.markedBodies.commit(t,e),this.store.notifyIngestEdit())},endEdit:t=>{this.loop?.resume();const e=this.objectOf(t),r=`Transform ${e?.name||"Object"}`,s=this.editStartState,o=this.editBaseline;return this.editStartState=void 0,this.editBaseline=void 0,e&&(this.physicsFor(t)?.unfreeze(t),this.markedBodies.unfreeze(t),this.store.notifyIngestEdit()),this.persist?this.persistOrJournal(t,r,s,o):void 0},remove:(t,e)=>{if(this.persist?.removal)return W(this.pipedRemove(t,e))}};removableFlag(t,e){const r=this.persist?.removal;return r?r.available(this.anchorFor(t,e))?{removable:!0}:{}:{}}pipedRemove(t,e){const r=this.persist,s=r.removal,o=`Remove ${this.objectOf(t)?.name||"Object"} ${e}`;return{resolve:()=>{const i=this.anchorFor(t,e);return s.available(i)?i.anchorKind==="live-only"?L(r.describe(i)):{reaches:"writer",anchorKind:i.anchorKind,destination:r.destination(),write:()=>s.perform({...i,label:o})}:L(r.describe(i))},record:()=>{},report:i=>{r.armed()&&r.report(o,i)}}}bodyOwns(t){const e=this.objectOf(t);if(!e)return!1;const r=this.bodyOwnershipByObject.get(e);if(r!==void 0)return r;const s=R()?.ownerOf(t);if(s==="physics")return this.bodyOwnershipByObject.set(e,!0),!0;const o=T(e)!==void 0;return(o||s==="editor")&&this.bodyOwnershipByObject.set(e,o),o}editableByNetwork(t){const e=N();return e?e.editable(t):!0}inspector={properties:t=>{const e=this.objectOf(t);if(!e)return[];const r=[{path:"name",label:"Name",type:"string"},{path:"visible",label:"Visible",type:"boolean"},{path:"object.type",label:"Native type",type:"string",readonly:!0}],s=F(e);return s?.fields&&r.push(...s.fields().filter(i=>!["name","visible"].includes(i.path)).map(({value:i,...a})=>a)),y(e)&&r.push({path:"material.color",label:"Color",type:"color",group:"Material"}),p(e)&&(r.push({path:"light.intensity",label:"Intensity",type:"number"}),r.push({path:"light.color",label:"Light Color",type:"color"}),g(e)&&r.push({path:"light.distance",label:"Distance",type:"number"}),Ie(e)&&r.push({path:"shadow.cast",label:"Cast Shadow",type:"boolean"})),b(e)&&(r.push({path:"camera.fov",label:"FOV",type:"number"}),r.push({path:"camera.near",label:"Near",type:"number"}),r.push({path:"camera.far",label:"Far",type:"number"})),M(e)&&(r.push({path:"mesh.vertices",label:"Vertices",type:"number",readonly:!0}),r.push({path:"shadow.cast",label:"Cast Shadow",type:"boolean"}),r.push({path:"shadow.receive",label:"Receive Shadow",type:"boolean"})),r},get:(t,e)=>{const r=this.objectOf(t);if(!r)return;if(e==="name")return r.name;if(e==="visible")return r.visible;if(e==="object.type")return r.type;const s=F(r)?.fields?.().find(o=>o.path===e);if(s)return s.value();if(e==="material.color"){const o=y(r);return o?`#${o.color.getHexString()}`:void 0}if(e==="light.intensity")return p(r)?.intensity;if(e==="light.distance")return g(r)?.distance;if(e==="light.color"){const o=p(r);return o?`#${o.color.getHexString()}`:void 0}if(e==="camera.fov")return b(r)?.fov;if(e==="camera.near")return b(r)?.near;if(e==="camera.far")return b(r)?.far;if(e==="mesh.vertices"){const o=M(r);return o?o.getAttribute("position")?.count??0:void 0}if(e==="shadow.cast")return r.castShadow;if(e==="shadow.receive")return r.receiveShadow},set:(t,e,r)=>{if(this.historyResource?.assertCanMutate(),!this.persist){this.writeProp(t,e,r);return}const s=this.captureHistoryState(),o=this.readChannel(t,e);this.writeProp(t,e,r);const i=`Set ${this.objectOf(t)?.name||"Object"} ${e}`,a=this.readChannel(t,e);if(!(o!==void 0&&a!==void 0&&JSON.stringify(o)!==JSON.stringify(a))){this.recordHistory(i,s);return}return x({backend:this.persist,subject:()=>this.anchorFor(t,e),baseline:o,next:a,label:i,journal:()=>this.recordHistory(i,s)})}};subscribe(t){return this.store.subscribe(t)}dispose(){this.disposed=!0;for(const t of this.watchedForStructure)t.removeEventListener("childadded",this.onStructureChanged),t.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure.clear(),this.changedStructureRoots.clear(),this.historyResource?.dispose(),this.persist?.dispose()}readChannel(t,e){const r=this.objectOf(t);if(r)return e==="position"?r.position.toArray():e==="rotation"?[r.rotation.x,r.rotation.y,r.rotation.z]:e==="scale"?r.scale.toArray():this.inspector.get(t,e)}applyChannel(t,e,r){const s=this.objectOf(t);if(s){if(e==="position"&&Array.isArray(r))s.position.fromArray(r);else if(e==="rotation"&&Array.isArray(r)){const[o,i,a]=r;s.rotation.set(o??0,i??0,a??0)}else if(e==="scale"&&Array.isArray(r))s.scale.fromArray(r);else{this.writeProp(t,e,r);return}this.store.notifyIngestEdit()}}writeTransform(t,e){this.historyResource?.assertCanMutate();const r=this.objectOf(t);r&&(r.position.set(e.position[0],e.position[1],e.position[2]),r.quaternion.set(e.rotation[0],e.rotation[1],e.rotation[2],e.rotation[3]),r.scale.set(e.scale[0],e.scale[1],e.scale[2]),this.record(t,{position:e.position,rotation:e.rotation,scale:e.scale}))}writeProp(t,e,r){const s=this.objectOf(t);if(s){if(e==="name")s.name=String(r);else if(e==="visible")s.visible=!!r,this.record(t,{visible:s.visible});else if(e==="material.color"){const o=y(s);o&&(o.color.set(String(r)),this.record(t,{color:`#${o.color.getHexString()}`}))}else if(e==="light.intensity"){const o=p(s);o&&(o.intensity=Number(r))}else if(e==="light.distance"){const o=g(s);o&&(o.distance=Number(r))}else if(e==="light.color")p(s)?.color.set(String(r));else if(e==="camera.fov"||e==="camera.near"||e==="camera.far"){const o=b(s);o&&(o[e.split(".")[1]]=Number(r),o.updateProjectionMatrix())}else e==="shadow.cast"?s.castShadow=!!r:e==="shadow.receive"&&(s.receiveShadow=!!r);this.store.notifyIngestEdit()}}anchorFor(t,e){const r=this.objectOf(t),s=D(e),o=r&&s?.owner==="material"?y(r):r,i=s?.owner==="material"?Q(o):C(o),a=i?this.persist?.anchor?.(i):null;if(a){const h=i?this.persist?.physicsPlaced?.(i,e):!1;return{entityId:t,property:e,anchor:a,anchorKind:h?"physics-binding":"source-prop",instances:1,sourceOid:i}}const n=ne(o);if(n!==null)return{entityId:t,property:e,anchor:ae(n),anchorKind:"data-record",instances:1,...i?{sourceOid:i}:{}};const c=i?this.options.sourceAnchor?.(i)??{anchored:!1,reason:"The source index has not resolved this object’s OID."}:Y(o??null);return{entityId:t,property:e,anchor:c,anchorKind:i?this.persist?.anchor?"source-prop":"live-only":c.anchored?"construction-literal":"live-only",instances:c.anchored&&c.kind==="source"?i?1:Z(c):0,...i?{sourceOid:i}:{}}}measureWriteReach(){this.refresh();let t=0;const e=q();for(const r of this.projector.nodes.keys()){const s=this.anchorFor(r,"position");e[s.anchorKind]++,s.anchor.anchored&&t++}return{addressable:t,total:this.projector.nodes.size,destination:this.persist?.destination()??E,byKind:e}}captureChannelBaseline(t){const e=this.objectOf(t);if(e)return{position:e.position.toArray(),rotation:[e.rotation.x,e.rotation.y,e.rotation.z],scale:e.scale.toArray()}}persistOrJournal(t,e,r,s){const o=this.persist;if(!o)return;const i=s?this.captureChannelBaseline(t):void 0,a=s&&i?Object.keys(s).filter(c=>JSON.stringify(s[c])!==JSON.stringify(i[c])):[];a.length>1&&o.report(e,re(a));const n=a.length===1?a[0]:null;if(n===null){this.recordHistory(e,r);return}return x({backend:o,subject:()=>this.anchorFor(t,n),baseline:s[n],next:i[n],label:e,journal:()=>this.recordHistory(e,r)})}creationSiteKey(t){const e=t.anchor;return e.anchored&&e.kind==="source"?`${e.file}:${e.line}:${e.col}`:null}instancePropertyPaths(t,e){const r=["position","rotation","scale",...this.inspector.properties(t).filter(s=>!s.readonly).map(s=>s.path)];return[...new Set(r)].filter(s=>this.creationSiteKey(this.anchorFor(t,s))===e)}loadInstanceLiterals(t,e,r,s){const o=this.instanceLiteralRequests.get(s);if(o)return o;const i=this.instancePropertyPaths(e,s).map(n=>({property:n,live:this.readChannel(e,n)})).filter(n=>n.live!==void 0),a=t.readSiteLiterals({anchor:r.anchor,instances:r.instances,writeScope:"creation-site",properties:i}).then(n=>(this.instanceLiterals.set(s,n),this.store.notifyIngestEdit(),n));return this.instanceLiteralRequests.set(s,a),a}sameInstanceValue(t,e){return Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((r,s)=>this.sameInstanceValue(r,e[s])):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=1e-6:t===e}instanceComponentName(t){return t.constructor.name||t.type}instanceCountLabel(t){return`${t} ${t===1?"instance":"instances"}`}instanceOverride(t,e,r,s,o){const i=s[r],a=this.readChannel(e,r);if(!i||i.literal===null||a===void 0||this.sameInstanceValue(i.literal,a))return null;const n=t.gate({...this.anchorFor(e,r),writeScope:"creation-site"}),c=i.writable?n.ok?void 0:n.reason:i.reason,h=this.inspector.properties(e).find(u=>u.path===r)?.label??r;return{path:r,label:h,value:a,...i.text?{defaultText:i.text}:{},canApplyToComponent:c===void 0,...c?{applyUnavailableReason:c}:{},affectedInstanceCount:o.instances}}async applyInstanceDefault(t,e,r,s){const o={...this.anchorFor(r,s),writeScope:"creation-site"},i=this.creationSiteKey(o);if(!i)return{changed:!1,message:"This object has no source site."};const a=this.objectOf(r);if(!a)return{changed:!1,message:"This object is no longer in the live world."};const n=(await e(r,o,i))[s];if(!n)return{changed:!1,message:`The construction site names no ${s}.`};if(n.literal===null)return{changed:!1,message:`The construction site names no ${s} default.`};const c=this.readChannel(r,s);if(c===void 0)return{changed:!1,message:`${s} has no live value.`};if(!n.writable)return{changed:!1,message:n.reason??`${s} cannot be rewritten.`};const h=t.gate(o);if(!h.ok)return{changed:!1,message:h.reason};const u=o.instances,d=`Apply ${s} to ${this.instanceComponentName(a)} default (${this.instanceCountLabel(u)})`;if(!await t.write({...o,baseline:n.literal,next:c,label:d}))return{changed:!1,message:`${d} did not land; the console names why.`};this.instanceLiterals.delete(i),this.instanceLiteralRequests.delete(i),this.store.notifyIngestEdit();const w=o.anchor.anchored?o.anchor.display:"this source site";return{changed:!0,message:`${s} now applies to all ${this.instanceCountLabel(u)} from ${w}.`,write:{destination:w,persisted:!0}}}creationSiteInstances(t){const e=async(r,s,o)=>this.instanceLiterals.get(o)??this.loadInstanceLiterals(t,r,s,o);return{describe:r=>{const s=this.anchorFor(r,"position"),o=this.creationSiteKey(s),i=this.objectOf(r);if(!o||!i)return null;const a=this.instanceLiterals.get(o);if(!a)return this.loadInstanceLiterals(t,r,s,o),null;if(Object.keys(a).length===0)return null;const n=this.instancePropertyPaths(r,o).map(c=>this.instanceOverride(t,r,c,a,s)).filter(c=>c!==null);return{componentName:this.instanceComponentName(i),...s.anchor.anchored?{sourcePath:s.anchor.display}:{},overrides:n}},revert:async(r,s)=>{const o=this.anchorFor(r,"position"),i=this.creationSiteKey(o);if(!i)return;const a=await e(r,o,i),n=this.captureHistoryState();let c=0;for(const h of s){const u=a[h]?.literal;u!=null&&(this.applyChannel(r,h,u),c++)}return c>0&&this.recordHistory(`Revert ${c} instance override(s)`,n),c>0?ee:void 0},applyToComponent:(r,s)=>this.applyInstanceDefault(t,e,r,s)}}recordHistory(t,e){!this.historyResource||!e||this.historyResource.record(t,e,this.captureHistoryState()).catch(r=>{v.error(`[ingest] failed to journal "${t}" into project history — the edit is applied but has no history entry (it cannot be undone): ${r instanceof Error?r.message:String(r)}`)})}captureHistoryState(){const t={};for(const[e,r]of this.projector.nodes){const s=r.object,o=y(s),i=p(s),a=b(s);t[e]={name:s.name,visible:s.visible,transform:this.transforms.get(e),...o?{color:`#${o.color.getHexString()}`}:{},...i?{lightIntensity:i.intensity,lightColor:`#${i.color.getHexString()}`,...g(s)?{lightDistance:g(s).distance}:{}}:{},...a?{camera:{fov:a.fov,near:a.near,far:a.far}}:{},castShadow:s.castShadow,receiveShadow:s.receiveShadow}}return{edits:structuredClone(this.edits),objects:t}}restoreHistoryState(t){for(const[e,r]of Object.entries(t.objects)){const s=this.objectOf(e);if(!s)continue;s.name=r.name,s.visible=r.visible,s.position.fromArray(r.transform.position),s.quaternion.fromArray(r.transform.rotation),s.scale.fromArray(r.transform.scale),this.physicsFor(e)?.commit(e,r.transform),this.markedBodies.commit(e,r.transform),r.color&&y(s)?.color.set(r.color);const o=p(s);if(o&&(r.lightIntensity!==void 0&&(o.intensity=r.lightIntensity),r.lightColor&&o.color.set(r.lightColor),r.lightDistance!==void 0)){const a=g(s);a&&(a.distance=r.lightDistance)}const i=b(s);i&&r.camera&&(i.fov=r.camera.fov,i.near=r.camera.near,i.far=r.camera.far,i.updateProjectionMatrix()),s.castShadow=r.castShadow,s.receiveShadow=r.receiveShadow}this.edits=structuredClone(t.edits),this.store.notifyIngestEdit()}}function Be(l,t,e){return new A(l,t,{identity:ue({camera:e.camera}),journal:e.journal,persistence:se({history:l.projectHistory,writer:e.sourceWriter}),loop:e.loop,...e.frameControl?{frameControl:e.frameControl}:{},provenance:Oe})}function _e(l,t,e){return new A(l,t,{identity:_(e.worldId,{camera:e.camera}),journal:e.journal,persistence:we({history:l.projectHistory,backend:e.backend}),loop:e.loop,...e.frameControl?{frameControl:e.frameControl}:{},provenance:Ce,sourceDeclaresStories:!0})}function De(l,t,e,r,s={}){return new A(l,t,{identity:_(e),journal:r,frameControl:"host",sourceAnchor:s.sourceAnchor,...s.explicitSourceCommit?{sourceCommit:ve({history:l.projectHistory,...s.backend?{backend:s.backend}:{}})}:{}})}export{_e as a,De as o,Me as r,Be as s};
1
+ import{dY as k,ev as B,X as v,aC as A,aG as X,eq as O,gv as z,gw as R,aJ as P,gx as W,ci as U,gy as G,ar as N,cj as L,gz as Y,gA as C,cg as Q,ch as Z,k as q,ck as ee}from"./index-Ckxb31Yz.js";import{c as te,p as x,m as re,a as se}from"./source-persistence-backend-_-JMEXxE.js";import{J as oe,c as ie}from"./json-history-resource-r-9q_hxP.js";import{r as f,d as ne,a as ae}from"./ingest-source-persistence-DH6ioCOu.js";import{r as ce}from"./three-projection-core-kubBTx0s.js";import{a as _,T as le,n as he,b as ue}from"./three-DSsr_Lvp.js";import{bodyOwningNode as T}from"./body-marks-D8iaje6y.js";import{colorMaterialOf as y}from"./structural-ids-CblajJQK.js";import{object3DAuthoringSubjectOf as F}from"./object3d-authoring-subject-CyE4rQ2A.js";import{createRapierBodyEditing as de}from"./rapier-physics-adapter-CaZqWLu0.js";import{getUserData as m}from"./user-data-CZqsJDk-.js";import{b as fe,c as me}from"./r3f-physics-binding-C8OqNRG2.js";const pe={position:{owner:"self",member:"position",kind:"vector3"},rotation:{owner:"self",member:"rotation",kind:"euler"},scale:{owner:"self",member:"scale",kind:"vector3"},visible:{owner:"self",member:"visible",kind:"boolean"},name:{owner:"self",member:"name",kind:"string"},"material.color":{owner:"material",member:"color",kind:"color"},"light.color":{owner:"self",member:"color",kind:"color"},"light.intensity":{owner:"self",member:"intensity",kind:"number"},"light.distance":{owner:"self",member:"distance",kind:"number"},"camera.fov":{owner:"self",member:"fov",kind:"number"},"camera.near":{owner:"self",member:"near",kind:"number"},"camera.far":{owner:"self",member:"far",kind:"number"},"shadow.cast":{owner:"self",member:"castShadow",kind:"boolean"},"shadow.receive":{owner:"self",member:"receiveShadow",kind:"boolean"}},be={position:{owner:"self",member:"position",kind:"vector2",componentMembers:["x","y"]},rotation:{owner:"self",member:"rotation",kind:"number"},scale:{owner:"self",member:"scale",kind:"vector2"},visible:{owner:"self",member:"visible",kind:"boolean"},name:{owner:"self",member:"label",kind:"string"},alpha:{owner:"self",member:"alpha",kind:"number"},tint:{owner:"self",member:"tint",kind:"color"}},ye={position:{owner:"self",member:"position",kind:"vector3"},rotation:{owner:"self",member:"rotation",kind:"euler"},scale:{owner:"self",member:"scaling",kind:"vector3"},name:{owner:"self",member:"name",kind:"string"},visible:{owner:"self",member:"isVisible",kind:"boolean"},visibility:{owner:"self",member:"visibility",kind:"number"}};function D(l,t="three"){return(t==="pixi"?be:t==="babylon"?ye:pe)[l]??null}const J="the game's own JSX source (source-stamp write-back)",S={position:"position",rotation:"rotation",scale:"scale",visible:"visible",name:"name","material.color":"color","light.color":"color","light.intensity":"intensity","light.distance":"distance","camera.fov":"fov","camera.near":"near","camera.far":"far","shadow.cast":"castShadow","shadow.receive":"receiveShadow"};function H(l){const t=Math.round(l*1e4)/1e4;return Object.is(t,-0)?"0":String(t)}function K(l,t){const e=D(l)?.kind;return e==="vector3"||e==="euler"?!Array.isArray(t)||t.length!==3||!t.every(r=>typeof r=="number"&&Number.isFinite(r))?null:`[${t.map(H).join(", ")}]`:e==="number"?typeof t=="number"&&Number.isFinite(t)?H(t):null:e==="boolean"?typeof t=="boolean"?String(t):null:(e==="color"||e==="string")&&typeof t=="string"?t.replace(/["\\]/g,""):null}function V(l,t){const e=fe(l??void 0,t);if(e)return e;const r=l?.r3fAuthoring;if(!r||t!=="position"&&t!=="rotation"&&t!=="scale")return null;const s=`<${l?.tag??"this component"}>`;return r.simulationOwnedTransform===!0?`${s} drives its own ${t} every frame — this instance is placed by the simulation, not by the editor`:r.transformProps.includes(t)?null:`${s} does not forward ${t} to its native root`}function I(l){const t=l.file.replaceAll("\\","/"),e=X()?.rootPath.replaceAll("\\","/").replace(/\/$/,""),r=e&&t.startsWith(`${e}/`)?t.slice(e.length+1):t;return{anchored:!0,kind:"source",file:r,line:l.line,col:l.col,display:`${r}:${l.line}`}}async function Me(l){try{const e=await(l??k("Live source locations"))?.index?.();return r=>{const s=e?.[r];return s?I(s):null}}catch{return()=>null}}async function ge(l,t,e){const r=l.writeProp;if(!r)throw new Error("the gesture-scoped source writer cannot write JSX props");let s=0;for(const{property:o,text:i}of e){const a=await r(t,o,i,{addIfMissing:!0,allowShapeUpgrade:!0});if(a.dynamic)throw new Error(`${o} is bound to a JSX expression, not an authored literal`);if(!a.changed&&a.error)throw new Error(a.error);a.changed&&s++}return s}function ve(l){const t=l.backend??k("The Play→source transform committer"),e=B(t,l.history),r=o=>o?!e?.runGesture||!e.writeProp||!e.index?{available:!1,reason:"This editor session cannot open a checksum-guarded project-source gesture."}:{available:!0}:{available:!1,reason:"This live node has no OID source stamp, so no authored literal owns its pose."},s=o=>(v.warn(`[play] Commit live transform to source refused: ${o}`,"play-mode"),{destination:A,persisted:!1});return{availability:r,async commit(o,i){const a=r(o);if(!a.available||!o||!e?.runGesture||!e.index)return s(a.reason??"the source writer is unavailable");const c=(await e.index())[o]??null;if(!c)return s(`the current source index has no entry for OID "${o}"`);const h=["position","rotation","scale"].map(d=>{const j=V(c,d);if(j)throw new Error(j);const w=i[d],$=w===void 0?null:K(d,w);if($===null)throw new Error(`${d} is not a finite transform literal`);return{property:d,text:$}});let u;try{u=await e.runGesture("Commit Play Transform to Source",d=>ge(d,o,h))}catch(d){return s(d instanceof Error?d.message:String(d))}return u===0?(v.log("[play] Source already matches the selected live transform.","play-mode"),{destination:"source already matched the live transform",persisted:!1}):(v.log(`[play] Committed ${u} live transform literal(s) to ${c.file}:${c.line}.`,"play-mode"),{destination:J,persisted:!0})}}}function we(l){let t=null,e=new Map,r=!1;const s=async()=>{const n=t?.index;if(n)try{e=new Map(Object.entries(await n.call(t))),r=!0}catch{}},o=n=>n?e.get(n)??null:null,i=n=>{const c=o(n);return c?I(c).display:null},a=(n,c)=>{if(!n)return{ok:!1,reason:"this object carries no source stamp — the game built it at runtime rather than writing it as an element of its own source"};if(!t?.writeProp)return{ok:!1,reason:"this editor tier cannot write project source"};const h=S[c];if(!h)return{ok:!1,reason:`${c} has no JSX attribute this seam can write`};const u=V(o(n),h);if(u)return{ok:!1,reason:u};if(!O()){const d=i(n);return{ok:!1,reason:`${d?`written at ${d}`:"source-stamped"}, but this game is playing — hold it to author`}}return{ok:!0}};return{attach(){const n=l.backend??k("This world’s OID source persistence")??null;t=n?B(n,l.history)??n:null,s()},anchor(n){const c=e.get(n);return c?I(c):null},physicsPlaced(n,c){return me(o(n)??void 0,S[c]??c)},describe({sourceOid:n,property:c}){const h=a(n,c);if(!h.ok)return`Live-only edit — ${h.reason}.`;const u=i(n);return u?`Persisting to ${u}.`:`Persisting to this element's own JSX${r?"":" (source index still loading)"}.`},gate({sourceOid:n,property:c}){return a(n,c)},armed:()=>t?.writeProp!==void 0&&O(),report:(n,c)=>f(n,c),async write(n){const c=a(n.sourceOid,n.property);if(!c.ok)return f(n.label,c.reason),!1;const h=S[n.property],u=K(n.property,n.next);if(u===null)return f(n.label,`the new ${n.property} is not a value this seam can spell as a JSX literal`),!1;try{const d=await t.writeProp(n.sourceOid,h,u,{addIfMissing:!0,allowShapeUpgrade:!0});return d.dynamic?(f(n.label,`${h} at ${i(n.sourceOid)??"this element"} is bound to a JSX expression, not a literal`),!1):d.changed?(v.log(`[ingest] ${n.label} written to the game's own source — ${h} → ${i(n.sourceOid)??n.sourceOid}`),s(),!0):(f(n.label,d.error??"the source writer made no change"),!1)}catch(d){return f(n.label,`the write failed: ${d instanceof Error?d.message:String(d)}`),!1}},removal:{available({sourceOid:n,property:c}){return t?.removeProp?a(n,c).ok:!1},async perform(n){const c=a(n.sourceOid,n.property);if(!c.ok||!t?.removeProp)return f(n.label,c.ok?"this editor tier cannot remove project source":c.reason),!1;const h=S[n.property];try{const u=await t.removeProp(n.sourceOid,h);return u.dynamic?(f(n.label,`${h} at ${i(n.sourceOid)??"this element"} is bound to a JSX expression — removing it would delete the game's own wiring, not an override`),!1):u.changed?(v.log(`[ingest] ${n.label} — ${h} dropped from the game's own source at ${i(n.sourceOid)??n.sourceOid}`),s(),!0):(f(n.label,u.error??`${i(n.sourceOid)??"this element"} authors no ${h} attribute, so there was nothing to drop`),!1)}catch(u){return f(n.label,`the removal failed: ${u instanceof Error?u.message:String(u)}`),!1}}},destination(){return t?.writeProp&&O()?J:A},dispose(){t=null,e=new Map,r=!1}}}const Se={source:"live",label:"live",detail:"Running objects adopted from the live scene. Edits affect this session only and are discarded when play stops."},je="Applied to the running world; code that drives this transform each frame may overwrite it.",Oe={source:"foreign",label:"live-only",detail:"Unmodified ingested game — edits apply to the running game for this session only and are never saved."},Ce={source:"foreign",label:"game source",detail:"Ingested game whose own source carries the editor's authoring stamps — a literal JSX prop writes back to the game’s own file (expression-bound props stay read-only)."};function p(l){return l.isLight?l:null}function g(l){const t=l;return t.isPointLight||t.isSpotLight?t:null}function Ie(l){const t=l;return t.isDirectionalLight||t.isPointLight||t.isSpotLight?t:null}function b(l){const t=l;return t.isPerspectiveCamera?t:null}function M(l){const t=l;return t.isMesh&&t.geometry?t.geometry:null}class E{constructor(t,e,r){if(this.store=t,this.options=r,this.sceneRef=e,this.identity=r.identity,this.projector=new le(this.identity,{pickScope:"projection"}),this.persist=r.persistence??null,this.loop=r.loop,this.frameControl=r.frameControl??"adapter",this.provenance=r.provenance??Se,r.sourceCommit){const i={availability:a=>r.sourceCommit.availability(C(this.objectOf(a))),commit:async a=>{const n=this.objectOf(a),c=this.captureChannelBaseline(a)??{},h=await r.sourceCommit.commit(C(n),c);return h.persisted&&this.store.notifyIngestEdit(),h}};Object.assign(this.transforms,{sourceCommit:i})}r.sourceDeclaresStories&&(this.stories=z("three",t,i=>{const a=this.hierarchy.node(i);return a?.role!=="component"?null:{name:a.typeLabel??a.label}})),this.refresh(),this.watchStructure();const s=t.projectHistory;this.historyResource=this.persist&&s?new oe({history:s,kind:"session-state",scope:"session",subject:{...r.journal,id:`${r.journal.id}/live-three-edits`},displayName:"Live edits",capture:()=>this.captureHistoryState(),conflictIdentity:i=>i.edits,restore:async i=>{this.restoreHistoryState(i)}}):null;const o=this.persist;o&&(o.attach({read:(i,a)=>this.readChannel(i,a),apply:(i,a,n)=>this.applyChannel(i,a,n)}),this.persistence={...ie(),get destination(){return o.destination()}},o.readSiteLiterals&&(this.instances=this.creationSiteInstances(o)))}sceneRef;projector;watchedForStructure=new Set;changedStructureRoots=new Set;structureRefreshQueued=!1;disposed=!1;crossSurfaceStructureRevision=0;hasCrossSurfaceStructure=!1;identity;persist;loop;frameControl;instanceLiterals=new Map;instanceLiteralRequests=new Map;markedBodies=de(t=>{const e=this.objectOf(t);if(!e)return{kind:"unresolved"};const r=T(e);return r?{kind:"body",body:r}:{kind:"no-body"}});bodyOwnershipByObject=new WeakMap;physicsFor(t){const e=R();return e&&e.ownerOf(t)!=="unresolved"?e:null}edits={};historyResource;editStartState;editBaseline;capabilities={transform:!0,inspectorFields:!0,persist:!1};stories;instances;provenance;persistence;get scene(){return typeof this.sceneRef=="function"?this.sceneRef():this.sceneRef}refresh(){const t=this.projector.project(this.scene);return this.refreshCrossSurfacePresence(),this.crossSurfaceStructureRevision++,t}crossSurfaceStructureSignature(){return this.hasCrossSurfaceStructure?String(this.crossSurfaceStructureRevision):null}objectCarriesCrossSurfaceStructure(t){return m(t,"authoringHierarchyId")!==void 0||m(t,"authoringHierarchyParentId")!==void 0||m(t,"authoringHierarchyOrder")!==void 0}subtreeCarriesCrossSurfaceStructure(t){let e=!1;return t.traverse(r=>{this.objectCarriesCrossSurfaceStructure(r)&&(e=!0)}),e}refreshCrossSurfacePresence(){this.hasCrossSurfaceStructure=!1;for(const t of this.projector.nodes.values())if(this.objectCarriesCrossSurfaceStructure(t.object)){this.hasCrossSurfaceStructure=!0;return}}onStructureChanged=t=>{P(t.child)||this.disposed||(this.changedStructureRoots.add(t.child),!this.structureRefreshQueued&&(this.structureRefreshQueued=!0,queueMicrotask(()=>{if(this.structureRefreshQueued=!1,this.disposed)return;const e=[...this.changedStructureRoots];this.changedStructureRoots.clear();const r=e.some(o=>this.subtreeCarriesCrossSurfaceStructure(o));for(const o of e)this.unwatchStructureSubtree(o);const s=this.projector.projectSubtrees(this.scene,e);if(s===null)this.refresh(),this.watchStructure();else for(const o of e)this.structureRootIsAttached(o)&&this.watchStructureSubtree(o);r&&(this.refreshCrossSurfacePresence(),this.crossSurfaceStructureRevision++),this.syncAdoptedObjectMap(s??void 0),this.store.notifyIngestObjectMapEdit(s===null?void 0:{changedParentIds:s.changedParentIds,rootsChanged:s.rootsChanged,addedIds:s.addedIds,removedIds:s.removedIds})})))};watchStructure(){for(const e of this.watchedForStructure)e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure.clear();const t=this.scene;t&&this.watchStructureSubtree(t)}watchStructureSubtree(t){const e=r=>{if(!(P(r)||this.watchedForStructure.has(r))){r.addEventListener("childadded",this.onStructureChanged),r.addEventListener("childremoved",this.onStructureChanged),this.watchedForStructure.add(r);for(const s of r.children)e(s)}};e(t)}structureRootIsAttached(t){const e=this.scene;if(e===null)return!1;for(let r=t;r!==null;r=r.parent)if(r===e)return!0;return!1}unwatchStructureSubtree(t){t.traverse(e=>{this.watchedForStructure.delete(e)&&(e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged))})}syncAdoptedObjectMap(t){const e=this.scene;if(!e||this.store.scene!==e)return;const r=this.store.objectMap;if(t===void 0){r.clear();for(const[o,i]of this.projector.objectMapSnapshot())r.set(o,i)}else{for(const o of t.removedIds)r.delete(o);for(const o of t.addedIds){const i=this.projector.objectOf(o);i!==null&&r.set(o,i)}}const s=[...this.store.selectedEntityIds].filter(o=>r.has(o));s.length!==this.store.selectedEntityIds.size&&this.store.selectMultiple(s)}invalidate(){this.refresh()}adoptScene(t){this.sceneRef=t,this.refresh(),this.watchStructure(),this.syncAdoptedObjectMap()}objectOf(t){return this.projector.objectOf(t)}objectMapSnapshot(){return this.projector.objectMapSnapshot()}record(t,e){this.edits[t]={...this.edits[t],...e}}toEditorNode(t){const e=t.object,r=m(e,"authoringHierarchyId"),s=m(e,"authoringHierarchyParentId"),o=m(e,"authoringHierarchyOrder"),i=W(e)&&m(e,"authoringRoot")!==!0,a=m(e,"authoringComponent"),n=(i?m(e,"authoringLabel"):void 0)||e.name||e.type;return{id:t.id,label:n,role:i?"component":"entity",kind:he(e),typeLabel:i?a||n:e.type,parentId:t.parentId,childIds:[...t.childIds],...r===void 0?{}:{crossSurfaceId:r},...s===void 0?{}:{crossSurfaceParentId:s},...o===void 0?{}:{crossSurfaceOrder:o}}}hierarchy={crossSurfaceStructureSignature:()=>this.crossSurfaceStructureSignature(),roots:()=>this.projector.rootNodes().map(t=>this.toEditorNode(t)),node:t=>{const e=this.projector.node(t);return e?this.toEditorNode(e):null},object3D:t=>this.objectOf(t),idForObject3D:t=>this.projector.idOf(t)};selection={get:()=>[...this.store.selectedEntityIds],set:t=>this.store.selectMultiple(t),resolve:(t,e)=>{const r=this.hierarchy.node(t);if(!r)return null;const s=[];let o=r,i=0;for(;o&&i++<1e3;)(o.role==="component"||o.role==="instance")&&s.push(o),o=o.parentId?this.hierarchy.node(o.parentId):null;const a=s.reverse();if(a.length===0)return{id:t};const n=e?.scopeId?a.findIndex(u=>u.id===e.scopeId):-1,c=n>=0?Math.min(n+1,a.length-1):0,h=e?.intent==="deep"?Math.min(c+1,a.length-1):c;return{id:a[h].id}}};pickable={pick:(t,e)=>(this.refresh(),this.projector.pick(this.store,t,e)),candidates:(t,e)=>(this.refresh(),this.projector.candidates(this.store,t,e))};truth={resolve:(t,e)=>{const r=this.anchorFor(t,e);return{site:r.anchor,writeAnchorKind:r.anchorKind}}};related=te(t=>this.truth.resolve(t,"position").site);transforms={get:t=>ce(this.objectOf(t)),editability:(t,e)=>{if(!this.objectOf(t))return{writable:!1,reason:G};const r=N();return r?.networkId(t)&&!r.editable(t)?{writable:!1,reason:"This transform is controlled by remote or server network authority."}:this.bodyOwns(t)?{writable:!0,reason:"Moves the physics body that owns this node.",...this.removableFlag(t,e)}:this.frameControl==="host"&&this.store.playState==="playing"?{writable:!0,reason:je,...this.removableFlag(t,e)}:this.persist?{writable:!0,reason:this.persist.describe(this.anchorFor(t,e)),...this.removableFlag(t,e)}:{writable:!0}},beginEdit:t=>{this.historyResource?.assertCanMutate(),!(!this.objectOf(t)||!this.editableByNetwork(t))&&(this.loop?.pause(),this.physicsFor(t)?.freeze(t),this.markedBodies.freeze(t),this.editStartState=this.persist?this.captureHistoryState():void 0,this.editBaseline=void 0)},apply:(t,e)=>{!this.objectOf(t)||!this.editableByNetwork(t)||(this.persist&&!this.editBaseline&&(this.editBaseline=this.captureChannelBaseline(t)),this.writeTransform(t,e),this.physicsFor(t)?.commit(t,e),this.markedBodies.commit(t,e),this.store.notifyIngestEdit())},endEdit:t=>{this.loop?.resume();const e=this.objectOf(t),r=`Transform ${e?.name||"Object"}`,s=this.editStartState,o=this.editBaseline;return this.editStartState=void 0,this.editBaseline=void 0,e&&(this.physicsFor(t)?.unfreeze(t),this.markedBodies.unfreeze(t),this.store.notifyIngestEdit()),this.persist?this.persistOrJournal(t,r,s,o):void 0},remove:(t,e)=>{if(this.persist?.removal)return U(this.pipedRemove(t,e))}};removableFlag(t,e){const r=this.persist?.removal;return r?r.available(this.anchorFor(t,e))?{removable:!0}:{}:{}}pipedRemove(t,e){const r=this.persist,s=r.removal,o=`Remove ${this.objectOf(t)?.name||"Object"} ${e}`;return{resolve:()=>{const i=this.anchorFor(t,e);return s.available(i)?i.anchorKind==="live-only"?L(r.describe(i)):{reaches:"writer",anchorKind:i.anchorKind,destination:r.destination(),write:()=>s.perform({...i,label:o})}:L(r.describe(i))},record:()=>{},report:i=>{r.armed()&&r.report(o,i)}}}bodyOwns(t){const e=this.objectOf(t);if(!e)return!1;const r=this.bodyOwnershipByObject.get(e);if(r!==void 0)return r;const s=R()?.ownerOf(t);if(s==="physics")return this.bodyOwnershipByObject.set(e,!0),!0;const o=T(e)!==void 0;return(o||s==="editor")&&this.bodyOwnershipByObject.set(e,o),o}editableByNetwork(t){const e=N();return e?e.editable(t):!0}inspector={properties:t=>{const e=this.objectOf(t);if(!e)return[];const r=[{path:"name",label:"Name",type:"string"},{path:"visible",label:"Visible",type:"boolean"},{path:"object.type",label:"Native type",type:"string",readonly:!0}],s=F(e);return s?.fields&&r.push(...s.fields().filter(i=>!["name","visible"].includes(i.path)).map(({value:i,...a})=>a)),y(e)&&r.push({path:"material.color",label:"Color",type:"color",group:"Material"}),p(e)&&(r.push({path:"light.intensity",label:"Intensity",type:"number"}),r.push({path:"light.color",label:"Light Color",type:"color"}),g(e)&&r.push({path:"light.distance",label:"Distance",type:"number"}),Ie(e)&&r.push({path:"shadow.cast",label:"Cast Shadow",type:"boolean"})),b(e)&&(r.push({path:"camera.fov",label:"FOV",type:"number"}),r.push({path:"camera.near",label:"Near",type:"number"}),r.push({path:"camera.far",label:"Far",type:"number"})),M(e)&&(r.push({path:"mesh.vertices",label:"Vertices",type:"number",readonly:!0}),r.push({path:"shadow.cast",label:"Cast Shadow",type:"boolean"}),r.push({path:"shadow.receive",label:"Receive Shadow",type:"boolean"})),r},get:(t,e)=>{const r=this.objectOf(t);if(!r)return;if(e==="name")return r.name;if(e==="visible")return r.visible;if(e==="object.type")return r.type;const s=F(r)?.fields?.().find(o=>o.path===e);if(s)return s.value();if(e==="material.color"){const o=y(r);return o?`#${o.color.getHexString()}`:void 0}if(e==="light.intensity")return p(r)?.intensity;if(e==="light.distance")return g(r)?.distance;if(e==="light.color"){const o=p(r);return o?`#${o.color.getHexString()}`:void 0}if(e==="camera.fov")return b(r)?.fov;if(e==="camera.near")return b(r)?.near;if(e==="camera.far")return b(r)?.far;if(e==="mesh.vertices"){const o=M(r);return o?o.getAttribute("position")?.count??0:void 0}if(e==="shadow.cast")return r.castShadow;if(e==="shadow.receive")return r.receiveShadow},set:(t,e,r)=>{if(this.historyResource?.assertCanMutate(),!this.persist){this.writeProp(t,e,r);return}const s=this.captureHistoryState(),o=this.readChannel(t,e);this.writeProp(t,e,r);const i=`Set ${this.objectOf(t)?.name||"Object"} ${e}`,a=this.readChannel(t,e);if(!(o!==void 0&&a!==void 0&&JSON.stringify(o)!==JSON.stringify(a))){this.recordHistory(i,s);return}return x({backend:this.persist,subject:()=>this.anchorFor(t,e),baseline:o,next:a,label:i,journal:()=>this.recordHistory(i,s)})}};subscribe(t){return this.store.subscribe(t)}dispose(){this.disposed=!0;for(const t of this.watchedForStructure)t.removeEventListener("childadded",this.onStructureChanged),t.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure.clear(),this.changedStructureRoots.clear(),this.historyResource?.dispose(),this.persist?.dispose()}readChannel(t,e){const r=this.objectOf(t);if(r)return e==="position"?r.position.toArray():e==="rotation"?[r.rotation.x,r.rotation.y,r.rotation.z]:e==="scale"?r.scale.toArray():this.inspector.get(t,e)}applyChannel(t,e,r){const s=this.objectOf(t);if(s){if(e==="position"&&Array.isArray(r))s.position.fromArray(r);else if(e==="rotation"&&Array.isArray(r)){const[o,i,a]=r;s.rotation.set(o??0,i??0,a??0)}else if(e==="scale"&&Array.isArray(r))s.scale.fromArray(r);else{this.writeProp(t,e,r);return}this.store.notifyIngestEdit()}}writeTransform(t,e){this.historyResource?.assertCanMutate();const r=this.objectOf(t);r&&(r.position.set(e.position[0],e.position[1],e.position[2]),r.quaternion.set(e.rotation[0],e.rotation[1],e.rotation[2],e.rotation[3]),r.scale.set(e.scale[0],e.scale[1],e.scale[2]),this.record(t,{position:e.position,rotation:e.rotation,scale:e.scale}))}writeProp(t,e,r){const s=this.objectOf(t);if(s){if(e==="name")s.name=String(r);else if(e==="visible")s.visible=!!r,this.record(t,{visible:s.visible});else if(e==="material.color"){const o=y(s);o&&(o.color.set(String(r)),this.record(t,{color:`#${o.color.getHexString()}`}))}else if(e==="light.intensity"){const o=p(s);o&&(o.intensity=Number(r))}else if(e==="light.distance"){const o=g(s);o&&(o.distance=Number(r))}else if(e==="light.color")p(s)?.color.set(String(r));else if(e==="camera.fov"||e==="camera.near"||e==="camera.far"){const o=b(s);o&&(o[e.split(".")[1]]=Number(r),o.updateProjectionMatrix())}else e==="shadow.cast"?s.castShadow=!!r:e==="shadow.receive"&&(s.receiveShadow=!!r);this.store.notifyIngestEdit()}}anchorFor(t,e){const r=this.objectOf(t),s=D(e),o=r&&s?.owner==="material"?y(r):r,i=s?.owner==="material"?Y(o):C(o),a=i?this.persist?.anchor?.(i):null;if(a){const h=i?this.persist?.physicsPlaced?.(i,e):!1;return{entityId:t,property:e,anchor:a,anchorKind:h?"physics-binding":"source-prop",instances:1,sourceOid:i}}const n=ne(o);if(n!==null)return{entityId:t,property:e,anchor:ae(n),anchorKind:"data-record",instances:1,...i?{sourceOid:i}:{}};const c=i?this.options.sourceAnchor?.(i)??{anchored:!1,reason:"The source index has not resolved this object’s OID."}:Q(o??null);return{entityId:t,property:e,anchor:c,anchorKind:i?this.persist?.anchor?"source-prop":"live-only":c.anchored?"construction-literal":"live-only",instances:c.anchored&&c.kind==="source"?i?1:Z(c):0,...i?{sourceOid:i}:{}}}measureWriteReach(){this.refresh();let t=0;const e=q();for(const r of this.projector.nodes.keys()){const s=this.anchorFor(r,"position");e[s.anchorKind]++,s.anchor.anchored&&t++}return{addressable:t,total:this.projector.nodes.size,destination:this.persist?.destination()??A,byKind:e}}captureChannelBaseline(t){const e=this.objectOf(t);if(e)return{position:e.position.toArray(),rotation:[e.rotation.x,e.rotation.y,e.rotation.z],scale:e.scale.toArray()}}persistOrJournal(t,e,r,s){const o=this.persist;if(!o)return;const i=s?this.captureChannelBaseline(t):void 0,a=s&&i?Object.keys(s).filter(c=>JSON.stringify(s[c])!==JSON.stringify(i[c])):[];a.length>1&&o.report(e,re(a));const n=a.length===1?a[0]:null;if(n===null){this.recordHistory(e,r);return}return x({backend:o,subject:()=>this.anchorFor(t,n),baseline:s[n],next:i[n],label:e,journal:()=>this.recordHistory(e,r)})}creationSiteKey(t){const e=t.anchor;return e.anchored&&e.kind==="source"?`${e.file}:${e.line}:${e.col}`:null}instancePropertyPaths(t,e){const r=["position","rotation","scale",...this.inspector.properties(t).filter(s=>!s.readonly).map(s=>s.path)];return[...new Set(r)].filter(s=>this.creationSiteKey(this.anchorFor(t,s))===e)}loadInstanceLiterals(t,e,r,s){const o=this.instanceLiteralRequests.get(s);if(o)return o;const i=this.instancePropertyPaths(e,s).map(n=>({property:n,live:this.readChannel(e,n)})).filter(n=>n.live!==void 0),a=t.readSiteLiterals({anchor:r.anchor,instances:r.instances,writeScope:"creation-site",properties:i}).then(n=>(this.instanceLiterals.set(s,n),this.store.notifyIngestEdit(),n));return this.instanceLiteralRequests.set(s,a),a}sameInstanceValue(t,e){return Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((r,s)=>this.sameInstanceValue(r,e[s])):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=1e-6:t===e}instanceComponentName(t){return t.constructor.name||t.type}instanceCountLabel(t){return`${t} ${t===1?"instance":"instances"}`}instanceOverride(t,e,r,s,o){const i=s[r],a=this.readChannel(e,r);if(!i||i.literal===null||a===void 0||this.sameInstanceValue(i.literal,a))return null;const n=t.gate({...this.anchorFor(e,r),writeScope:"creation-site"}),c=i.writable?n.ok?void 0:n.reason:i.reason,h=this.inspector.properties(e).find(u=>u.path===r)?.label??r;return{path:r,label:h,value:a,...i.text?{defaultText:i.text}:{},canApplyToComponent:c===void 0,...c?{applyUnavailableReason:c}:{},affectedInstanceCount:o.instances}}async applyInstanceDefault(t,e,r,s){const o={...this.anchorFor(r,s),writeScope:"creation-site"},i=this.creationSiteKey(o);if(!i)return{changed:!1,message:"This object has no source site."};const a=this.objectOf(r);if(!a)return{changed:!1,message:"This object is no longer in the live world."};const n=(await e(r,o,i))[s];if(!n)return{changed:!1,message:`The construction site names no ${s}.`};if(n.literal===null)return{changed:!1,message:`The construction site names no ${s} default.`};const c=this.readChannel(r,s);if(c===void 0)return{changed:!1,message:`${s} has no live value.`};if(!n.writable)return{changed:!1,message:n.reason??`${s} cannot be rewritten.`};const h=t.gate(o);if(!h.ok)return{changed:!1,message:h.reason};const u=o.instances,d=`Apply ${s} to ${this.instanceComponentName(a)} default (${this.instanceCountLabel(u)})`;if(!await t.write({...o,baseline:n.literal,next:c,label:d}))return{changed:!1,message:`${d} did not land; the console names why.`};this.instanceLiterals.delete(i),this.instanceLiteralRequests.delete(i),this.store.notifyIngestEdit();const w=o.anchor.anchored?o.anchor.display:"this source site";return{changed:!0,message:`${s} now applies to all ${this.instanceCountLabel(u)} from ${w}.`,write:{destination:w,persisted:!0}}}creationSiteInstances(t){const e=async(r,s,o)=>this.instanceLiterals.get(o)??this.loadInstanceLiterals(t,r,s,o);return{describe:r=>{const s=this.anchorFor(r,"position"),o=this.creationSiteKey(s),i=this.objectOf(r);if(!o||!i)return null;const a=this.instanceLiterals.get(o);if(!a)return this.loadInstanceLiterals(t,r,s,o),null;if(Object.keys(a).length===0)return null;const n=this.instancePropertyPaths(r,o).map(c=>this.instanceOverride(t,r,c,a,s)).filter(c=>c!==null);return{componentName:this.instanceComponentName(i),...s.anchor.anchored?{sourcePath:s.anchor.display}:{},overrides:n}},revert:async(r,s)=>{const o=this.anchorFor(r,"position"),i=this.creationSiteKey(o);if(!i)return;const a=await e(r,o,i),n=this.captureHistoryState();let c=0;for(const h of s){const u=a[h]?.literal;u!=null&&(this.applyChannel(r,h,u),c++)}return c>0&&this.recordHistory(`Revert ${c} instance override(s)`,n),c>0?ee:void 0},applyToComponent:(r,s)=>this.applyInstanceDefault(t,e,r,s)}}recordHistory(t,e){!this.historyResource||!e||this.historyResource.record(t,e,this.captureHistoryState()).catch(r=>{v.error(`[ingest] failed to journal "${t}" into project history — the edit is applied but has no history entry (it cannot be undone): ${r instanceof Error?r.message:String(r)}`)})}captureHistoryState(){const t={};for(const[e,r]of this.projector.nodes){const s=r.object,o=y(s),i=p(s),a=b(s);t[e]={name:s.name,visible:s.visible,transform:this.transforms.get(e),...o?{color:`#${o.color.getHexString()}`}:{},...i?{lightIntensity:i.intensity,lightColor:`#${i.color.getHexString()}`,...g(s)?{lightDistance:g(s).distance}:{}}:{},...a?{camera:{fov:a.fov,near:a.near,far:a.far}}:{},castShadow:s.castShadow,receiveShadow:s.receiveShadow}}return{edits:structuredClone(this.edits),objects:t}}restoreHistoryState(t){for(const[e,r]of Object.entries(t.objects)){const s=this.objectOf(e);if(!s)continue;s.name=r.name,s.visible=r.visible,s.position.fromArray(r.transform.position),s.quaternion.fromArray(r.transform.rotation),s.scale.fromArray(r.transform.scale),this.physicsFor(e)?.commit(e,r.transform),this.markedBodies.commit(e,r.transform),r.color&&y(s)?.color.set(r.color);const o=p(s);if(o&&(r.lightIntensity!==void 0&&(o.intensity=r.lightIntensity),r.lightColor&&o.color.set(r.lightColor),r.lightDistance!==void 0)){const a=g(s);a&&(a.distance=r.lightDistance)}const i=b(s);i&&r.camera&&(i.fov=r.camera.fov,i.near=r.camera.near,i.far=r.camera.far,i.updateProjectionMatrix()),s.castShadow=r.castShadow,s.receiveShadow=r.receiveShadow}this.edits=structuredClone(t.edits),this.store.notifyIngestEdit()}}function Be(l,t,e){return new E(l,t,{identity:ue({camera:e.camera}),journal:e.journal,persistence:se({history:l.projectHistory,writer:e.sourceWriter}),loop:e.loop,...e.frameControl?{frameControl:e.frameControl}:{},provenance:Oe})}function _e(l,t,e){return new E(l,t,{identity:_(e.worldId,{camera:e.camera}),journal:e.journal,persistence:we({history:l.projectHistory,backend:e.backend}),loop:e.loop,...e.frameControl?{frameControl:e.frameControl}:{},provenance:Ce,sourceDeclaresStories:!0})}function De(l,t,e,r,s={}){return new E(l,t,{identity:_(e),journal:r,frameControl:"host",sourceAnchor:s.sourceAnchor,...s.explicitSourceCommit?{sourceCommit:ve({history:l.projectHistory,...s.backend?{backend:s.backend}:{}})}:{}})}export{_e as a,De as o,Me as r,Be as s};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/r3f-design-session-qJ2v5SrB.js","assets/index-Ckxb31Yz.js","assets/index-nmcBqr7Y.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/three.module-IFn-4i31.js","assets/index-B4bmKkgY.css","assets/edit-mode-authoring-D_BiHCQj.js","assets/entry-adjudication-BYy7TXOB.js","assets/r3f-root-factory-DjGnbU4n.js","assets/register-render-vitals-BO7x64kR.js","assets/render-census-BrQX_CXv.js","assets/structural-signature-0w-i_ats.js","assets/render-vitals-BZ5HtvMi.js","assets/static-batch-advisor-DqfXWRUq.js","assets/webgl-frame-capture-CRKX73E9.js","assets/world-state-ZGDGY_Xl.js","assets/debug-registry-B3Cnne3x.js","assets/frame-selector-cache-cCeUbcjG.js","assets/dev-build-gDYrq68M.js","assets/game-input-seams-BC6xhZy3.js","assets/seeded-random-CN0scLZj.js","assets/render-seed-DF4JHy7P.js","assets/frame-delta-D2nsw_Ht.js","assets/events-156d8d12.esm-C734MYnx.js","assets/index-bQE2NA0D.js","assets/realm-services-D25JHoqD.js","assets/canvas-entry-runtime-E5YjSgre.js","assets/three-ingest-runtime-DWijtqQ8.js","assets/EffectComposer-BHDH-NLz.js","assets/CopyShader-BzTUYzf6.js","assets/ShaderPass-qtkA7CQ8.js","assets/CSS3DRenderer-CAS2WZZy.js","assets/scene-framing-50N7SKuX.js","assets/native-debug-module-j-MekcLS.js","assets/native-entry-surface-BE8LJNdu.js","assets/playtest-BnFenMBW.js","assets/game-contract-seams-TCpIMmHP.js","assets/assets-Do88ZdV_.js","assets/loader-BbMsvIxP.js","assets/game-loop-CZvXlY00.js","assets/frame-pacing-D5acoOzO.js","assets/create-runtime-lmA910XT.js","assets/adapter-surface-Y37Nzcyw.js","assets/binding-Bmxqznjk.js","assets/setup-renderer-wt_a-p8r.js","assets/index-DUh02lTr.js","assets/defaults-DKiBJCPN.js","assets/render-settings-C_kIMq8Y.js","assets/render-features-COF7MSQ9.js","assets/game-D5EJoILQ.js","assets/loop-gate-report-N52EWFGD.js","assets/system-slot-E2mEdiih.js","assets/user-data-CZqsJDk-.js","assets/object-marks-DwvIEBOK.js","assets/sim-clock-DEfbb_-P.js","assets/system-runner-D_DtVrer.js","assets/performance-profiler-D_Jey87L.js","assets/input-manager-Cxx3RJgG.js","assets/asset-parse-error-BHMwBRU3.js","assets/binding-identity-DcTpbvyg.js","assets/prompt-labels-DSMdM2_B.js","assets/schema-Iy-mbzll.js","assets/gameplay-rng-trap-BhRx_CtU.js","assets/state-bridge-DLP1jLRW.js","assets/input-router-FzxO5ld6.js","assets/render-control-BNQr1eNO.js","assets/live-gesture-lock-DJbrjOqf.js","assets/drei-asset-caches-jJoHXbTj.js"])))=>i.map(i=>d[i]);
2
+ import{_ as m,aL as p}from"./index-Ckxb31Yz.js";import{r as s}from"./design-time-mount-registry-DUpXCg1U.js";import{q as n}from"./edit-mode-authoring-D_BiHCQj.js";import{a}from"./json-history-resource-r-9q_hxP.js";import{o as u}from"./three-authoring-adapter-Yqsank46.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-IFn-4i31.js";import"./source-persistence-backend-_-JMEXxE.js";import"./ingest-source-persistence-DH6ioCOu.js";import"./three-projection-core-kubBTx0s.js";import"./three-DSsr_Lvp.js";import"./viewport-pick-context-DkawXbEi.js";import"./body-marks-D8iaje6y.js";import"./user-data-CZqsJDk-.js";import"./object-marks-DwvIEBOK.js";import"./structural-ids-CblajJQK.js";import"./object3d-authoring-subject-CyE4rQ2A.js";import"./rapier-physics-adapter-CaZqWLu0.js";import"./r3f-physics-binding-C8OqNRG2.js";const V="workspace.service";function W(){const t=m(()=>import("./r3f-design-session-qJ2v5SrB.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,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73]));t.catch(()=>{});const i=p("three",(o,r)=>u(o,()=>o.scene,r,a(r))),e=s({kind:"three",owner:"@volter/editor-game/three/three-authoring",mountWorldRootSession:async o=>{const{mountR3FDesignSession:r}=await t;return r(o.store,o.composite,o.renderer)}});return n(),()=>{e(),i()}}export{V as point,W as start};
@@ -1 +1 @@
1
- import{T as n}from"./three.module-D396a9Mn.js";import{EffectComposer as i}from"./EffectComposer-DQxfsXBZ.js";import{CSS3DRenderer as s}from"./CSS3DRenderer-CL7ABLVK.js";import{Q as m,U as c}from"./index-GIL7oGEO.js";const a={three:n,EffectComposer:i,CSS3DRenderer:s};let r=null;async function f(){const e=await import(c),t=["projectThree","EffectComposer","CSS3DRenderer"].filter(o=>e[o]===void 0||e[o]===null);if(t.length>0)throw new Error(`The packaged runtime's synthetic three-ingest module did not export ${t.join(", ")} — see vite-plugin-module-doorways.ts.`);return{three:e.projectThree,EffectComposer:e.EffectComposer,CSS3DRenderer:e.CSS3DRenderer}}async function h(){return await m()?(r||(r=f()),r):a}export{h as r};
1
+ import{T as n}from"./three.module-IFn-4i31.js";import{EffectComposer as i}from"./EffectComposer-BHDH-NLz.js";import{CSS3DRenderer as s}from"./CSS3DRenderer-CAS2WZZy.js";import{T as m,V as c}from"./index-Ckxb31Yz.js";const a={three:n,EffectComposer:i,CSS3DRenderer:s};let r=null;async function f(){const e=await import(c),t=["projectThree","EffectComposer","CSS3DRenderer"].filter(o=>e[o]===void 0||e[o]===null);if(t.length>0)throw new Error(`The packaged runtime's synthetic three-ingest module did not export ${t.join(", ")} — see vite-plugin-module-doorways.ts.`);return{three:e.projectThree,EffectComposer:e.EffectComposer,CSS3DRenderer:e.CSS3DRenderer}}async function h(){return await m()?(r||(r=f()),r):a}export{h as r};
@@ -1 +1 @@
1
- import{aH as f,aI as n}from"./index-GIL7oGEO.js";import{o as h,n as I}from"./three-CDSueJyJ.js";import{V as u,Q as O}from"./three.module-D396a9Mn.js";const l=new u,p=new O,c=new u;function m(o){return o.matrixAutoUpdate===!1?(o.matrix.decompose(l,p,c),{position:l.toArray(),quaternion:p.toArray(),scale:c.toArray()}):{position:o.position.toArray(),quaternion:o.quaternion.toArray(),scale:o.scale.toArray()}}function y(o,t){return o.length===t.length&&o.every((e,r)=>e===t[r])}class S{constructor(t){this.options=t,this.selected=[...t.initial]}adopted=[];selected;current(){const t=[...this.options.store.selectedEntityIds].filter(this.options.owns);return y(t,this.adopted)||(this.adopted=t,this.selected=t,this.options.onChange?.(t)),[...this.selected]}publish(t){this.selected=[...t];const e=this.selected.filter(this.options.owns);this.adopted=e,this.options.onChange?.(e),this.options.store.selectMultiple(e)}}function v(o){if(!o)return{position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]};const t=m(o);return{position:t.position,rotation:t.quaternion,scale:t.scale}}function a(o){return o.type==="Object3D"&&o.name===""&&h(o)===null&&o.userData.oid===void 0&&n(o,"authoringInstance")===void 0&&n(o,"authoringRoot")!==!0&&n(o,"vgaiComponentRoot")===void 0}class q{constructor(t){this.options=t,this.rootIdSet=new Set(t.rootIds)}rootIdSet;childObjects(t){return t.children.flatMap(e=>f(e)?[]:a(e)?this.childObjects(e):[e])}childIds(t){return this.options.projector.childIdsOf(this.childObjects(t))}rootObjects(){return this.options.rootIds.flatMap(t=>{const e=this.options.projector.objectOf(t);return e?a(e)?this.childObjects(e):[e]:[]})}rootIds(){return this.options.projector.childIdsOf(this.rootObjects())}parentId(t){const{projector:e,scene:r,documentNodeId:i}=this.options,d=e.idOf(t);if(d!==null&&this.rootIdSet.has(d))return i;let s=t.parent;for(;s&&s!==r&&a(s);)s=s.parent;return s&&s!==r?e.idOf(s)??i:i}node(t){const e=h(t);return{id:this.options.projector.idOf(t),label:e?.label||t.name||t.type||"Object3D",role:"entity",kind:I(t),...e?.typeLabel?{typeLabel:e.typeLabel}:{},parentId:this.parentId(t),childIds:this.childIds(t)}}}export{q as C,S,v as r};
1
+ import{aJ as f,aI as n}from"./index-Ckxb31Yz.js";import{o as h,n as I}from"./three-DSsr_Lvp.js";import{V as u,Q as O}from"./three.module-IFn-4i31.js";const l=new u,p=new O,c=new u;function m(o){return o.matrixAutoUpdate===!1?(o.matrix.decompose(l,p,c),{position:l.toArray(),quaternion:p.toArray(),scale:c.toArray()}):{position:o.position.toArray(),quaternion:o.quaternion.toArray(),scale:o.scale.toArray()}}function y(o,t){return o.length===t.length&&o.every((e,r)=>e===t[r])}class S{constructor(t){this.options=t,this.selected=[...t.initial]}adopted=[];selected;current(){const t=[...this.options.store.selectedEntityIds].filter(this.options.owns);return y(t,this.adopted)||(this.adopted=t,this.selected=t,this.options.onChange?.(t)),[...this.selected]}publish(t){this.selected=[...t];const e=this.selected.filter(this.options.owns);this.adopted=e,this.options.onChange?.(e),this.options.store.selectMultiple(e)}}function v(o){if(!o)return{position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]};const t=m(o);return{position:t.position,rotation:t.quaternion,scale:t.scale}}function a(o){return o.type==="Object3D"&&o.name===""&&h(o)===null&&o.userData.oid===void 0&&n(o,"authoringInstance")===void 0&&n(o,"authoringRoot")!==!0&&n(o,"vgaiComponentRoot")===void 0}class q{constructor(t){this.options=t,this.rootIdSet=new Set(t.rootIds)}rootIdSet;childObjects(t){return t.children.flatMap(e=>f(e)?[]:a(e)?this.childObjects(e):[e])}childIds(t){return this.options.projector.childIdsOf(this.childObjects(t))}rootObjects(){return this.options.rootIds.flatMap(t=>{const e=this.options.projector.objectOf(t);return e?a(e)?this.childObjects(e):[e]:[]})}rootIds(){return this.options.projector.childIdsOf(this.rootObjects())}parentId(t){const{projector:e,scene:r,documentNodeId:i}=this.options,d=e.idOf(t);if(d!==null&&this.rootIdSet.has(d))return i;let s=t.parent;for(;s&&s!==r&&a(s);)s=s.parent;return s&&s!==r?e.idOf(s)??i:i}node(t){const e=h(t);return{id:this.options.projector.idOf(t),label:e?.label||t.name||t.type||"Object3D",role:"entity",kind:I(t),...e?.typeLabel?{typeLabel:e.typeLabel}:{},parentId:this.parentId(t),childIds:this.childIds(t)}}}export{q as C,S,v as r};
@@ -0,0 +1 @@
1
+ import{ay as d,aA as a,az as m}from"./index-Ckxb31Yz.js";function u(o){return o.children.length>0}function c(o){const n=m(),t=[];for(const e of o){const r=d({modulePath:e.modulePath,regions:n});if(r.medium==="dom"){t.push(e);continue}r.via==="undeclared"&&e.modulePath&&a(e.modulePath,r.reason)}return t}export{c as d,u as m};
@@ -0,0 +1 @@
1
+ let t={projection:"perspective"};const r=new Set;function o(){return t}function s(e){return r.add(e),()=>r.delete(e)}function i(e){if(t.projection!==e){t={...t,projection:e};for(const n of r)n()}}export{i as a,s,o as t};
@@ -3837,4 +3837,4 @@ void main() {
3837
3837
 
3838
3838
  }
3839
3839
 
3840
- }`;class Vy{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){const n=new dc(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new fn({vertexShader:zy,fragmentShader:ky,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ye(new Ss(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Hy extends En{constructor(t,e){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,f=null,m=null;const _=typeof XRWebGLBinding<"u",g=new Vy,p={},y=e.getContextAttributes();let v=null,x=null;const A=[],T=[],R=new Q;let I=null;const b=new Te;b.viewport=new te;const S=new Te;S.viewport=new te;const L=[b,S],F=new af;let z=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let et=A[Y];return et===void 0&&(et=new pa,A[Y]=et),et.getTargetRaySpace()},this.getControllerGrip=function(Y){let et=A[Y];return et===void 0&&(et=new pa,A[Y]=et),et.getGripSpace()},this.getHand=function(Y){let et=A[Y];return et===void 0&&(et=new pa,A[Y]=et),et.getHandSpace()};function q(Y){const et=T.indexOf(Y.inputSource);if(et===-1)return;const yt=A[et];yt!==void 0&&(yt.update(Y.inputSource,Y.frame,c||a),yt.dispatchEvent({type:Y.type,data:Y.inputSource}))}function W(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",W),i.removeEventListener("inputsourceschange",nt);for(let Y=0;Y<A.length;Y++){const et=T[Y];et!==null&&(T[Y]=null,A[Y].disconnect(et))}z=null,G=null,g.reset();for(const Y in p)delete p[Y];t.setRenderTarget(v),f=null,d=null,u=null,i=null,x=null,Qt.stop(),n.isPresenting=!1,t.setPixelRatio(I),t.setSize(R.width,R.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u===null&&_&&(u=new XRWebGLBinding(i,e)),u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(v=t.getRenderTarget(),i.addEventListener("select",q),i.addEventListener("selectstart",q),i.addEventListener("selectend",q),i.addEventListener("squeeze",q),i.addEventListener("squeezestart",q),i.addEventListener("squeezeend",q),i.addEventListener("end",W),i.addEventListener("inputsourceschange",nt),y.xrCompatible!==!0&&await e.makeXRCompatible(),I=t.getPixelRatio(),t.getSize(R),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let yt=null,Pt=null,Tt=null;y.depth&&(Tt=y.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,yt=y.stencil?ds:us,Pt=y.stencil?hs:kn);const Zt={colorFormat:e.RGBA8,depthFormat:Tt,scaleFactor:s};u=this.getBinding(),d=u.createProjectionLayer(Zt),i.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),x=new bn(d.textureWidth,d.textureHeight,{format:Oe,type:dn,depthTexture:new uc(d.textureWidth,d.textureHeight,Pt,void 0,void 0,void 0,void 0,void 0,void 0,yt),stencilBuffer:y.stencil,colorSpace:t.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const yt={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,e,yt),i.updateRenderState({baseLayer:f}),t.setPixelRatio(1),t.setSize(f.framebufferWidth,f.framebufferHeight,!1),x=new bn(f.framebufferWidth,f.framebufferHeight,{format:Oe,type:dn,colorSpace:t.outputColorSpace,stencilBuffer:y.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),Qt.setContext(i),Qt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function nt(Y){for(let et=0;et<Y.removed.length;et++){const yt=Y.removed[et],Pt=T.indexOf(yt);Pt>=0&&(T[Pt]=null,A[Pt].disconnect(yt))}for(let et=0;et<Y.added.length;et++){const yt=Y.added[et];let Pt=T.indexOf(yt);if(Pt===-1){for(let Zt=0;Zt<A.length;Zt++)if(Zt>=T.length){T.push(yt),Pt=Zt;break}else if(T[Zt]===null){T[Zt]=yt,Pt=Zt;break}if(Pt===-1)break}const Tt=A[Pt];Tt&&Tt.connect(yt)}}const H=new C,ut=new C;function _t(Y,et,yt){H.setFromMatrixPosition(et.matrixWorld),ut.setFromMatrixPosition(yt.matrixWorld);const Pt=H.distanceTo(ut),Tt=et.projectionMatrix.elements,Zt=yt.projectionMatrix.elements,ce=Tt[14]/(Tt[10]-1),P=Tt[14]/(Tt[10]+1),tt=(Tt[9]+1)/Tt[5],$=(Tt[9]-1)/Tt[5],J=(Tt[8]-1)/Tt[0],Z=(Zt[8]+1)/Zt[0],ct=ce*J,it=ce*Z,ht=Pt/(-J+Z),kt=ht*-J;if(et.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(kt),Y.translateZ(ht),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Tt[10]===-1)Y.projectionMatrix.copy(et.projectionMatrix),Y.projectionMatrixInverse.copy(et.projectionMatrixInverse);else{const zt=ce+ht,w=P+ht,M=ct-kt,O=it+(Pt-kt),V=tt*P/w*zt,j=$*P/w*zt;Y.projectionMatrix.makePerspective(M,O,V,j,zt,w),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function St(Y,et){et===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(et.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;let et=Y.near,yt=Y.far;g.texture!==null&&(g.depthNear>0&&(et=g.depthNear),g.depthFar>0&&(yt=g.depthFar)),F.near=S.near=b.near=et,F.far=S.far=b.far=yt,(z!==F.near||G!==F.far)&&(i.updateRenderState({depthNear:F.near,depthFar:F.far}),z=F.near,G=F.far),F.layers.mask=Y.layers.mask|6,b.layers.mask=F.layers.mask&3,S.layers.mask=F.layers.mask&5;const Pt=Y.parent,Tt=F.cameras;St(F,Pt);for(let Zt=0;Zt<Tt.length;Zt++)St(Tt[Zt],Pt);Tt.length===2?_t(F,b,S):F.projectionMatrix.copy(b.projectionMatrix),Gt(Y,F,Pt)};function Gt(Y,et,yt){yt===null?Y.matrix.copy(et.matrixWorld):(Y.matrix.copy(yt.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(et.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(et.projectionMatrix),Y.projectionMatrixInverse.copy(et.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=ps*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(Y){l=Y,d!==null&&(d.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(F)},this.getCameraTexture=function(Y){return p[Y]};let $t=null;function se(Y,et){if(h=et.getViewerPose(c||a),m=et,h!==null){const yt=h.views;f!==null&&(t.setRenderTargetFramebuffer(x,f.framebuffer),t.setRenderTarget(x));let Pt=!1;yt.length!==F.cameras.length&&(F.cameras.length=0,Pt=!0);for(let P=0;P<yt.length;P++){const tt=yt[P];let $=null;if(f!==null)$=f.getViewport(tt);else{const Z=u.getViewSubImage(d,tt);$=Z.viewport,P===0&&(t.setRenderTargetTextures(x,Z.colorTexture,Z.depthStencilTexture),t.setRenderTarget(x))}let J=L[P];J===void 0&&(J=new Te,J.layers.enable(P),J.viewport=new te,L[P]=J),J.matrix.fromArray(tt.transform.matrix),J.matrix.decompose(J.position,J.quaternion,J.scale),J.projectionMatrix.fromArray(tt.projectionMatrix),J.projectionMatrixInverse.copy(J.projectionMatrix).invert(),J.viewport.set($.x,$.y,$.width,$.height),P===0&&(F.matrix.copy(J.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),Pt===!0&&F.cameras.push(J)}const Tt=i.enabledFeatures;if(Tt&&Tt.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){u=n.getBinding();const P=u.getDepthInformation(yt[0]);P&&P.isValid&&P.texture&&g.init(P,i.renderState)}if(Tt&&Tt.includes("camera-access")&&_){t.state.unbindTexture(),u=n.getBinding();for(let P=0;P<yt.length;P++){const tt=yt[P].camera;if(tt){let $=p[tt];$||($=new dc,p[tt]=$);const J=u.getCameraImage(tt);$.sourceTexture=J}}}}for(let yt=0;yt<A.length;yt++){const Pt=T[yt],Tt=A[yt];Pt!==null&&Tt!==void 0&&Tt.update(Pt,et,c||a)}$t&&$t(Y,et),et.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:et}),m=null}const Qt=new df;Qt.setAnimationLoop(se),this.setAnimationLoop=function(Y){$t=Y},this.dispose=function(){}}}const vi=new tn,Gy=new Ot;function Wy(r,t){function e(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function n(g,p){p.color.getRGB(g.fogColor.value,cd(r)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function i(g,p,y,v,x){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(g,p):p.isMeshToonMaterial?(s(g,p),u(g,p)):p.isMeshPhongMaterial?(s(g,p),h(g,p)):p.isMeshStandardMaterial?(s(g,p),d(g,p),p.isMeshPhysicalMaterial&&f(g,p,x)):p.isMeshMatcapMaterial?(s(g,p),m(g,p)):p.isMeshDepthMaterial?s(g,p):p.isMeshDistanceMaterial?(s(g,p),_(g,p)):p.isMeshNormalMaterial?s(g,p):p.isLineBasicMaterial?(a(g,p),p.isLineDashedMaterial&&o(g,p)):p.isPointsMaterial?l(g,p,y,v):p.isSpriteMaterial?c(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,e(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===Be&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,e(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===Be&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,e(p.displacementMap,g.displacementMapTransform),g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,e(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const y=t.get(p),v=y.envMap,x=y.envMapRotation;v&&(g.envMap.value=v,vi.copy(x),vi.x*=-1,vi.y*=-1,vi.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(vi.y*=-1,vi.z*=-1),g.envMapRotation.value.setFromMatrix4(Gy.makeRotationFromEuler(vi)),g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,y,v){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*y,g.scale.value=v*.5,p.map&&(g.map.value=p.map,e(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,y){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Be&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const y=t.get(p).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Xy(r,t,e,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,v){const x=v.program;n.uniformBlockBinding(y,x)}function c(y,v){let x=i[y.id];x===void 0&&(m(y),x=h(y),i[y.id]=x,y.addEventListener("dispose",g));const A=v.program;n.updateUBOMapping(y,A);const T=t.render.frame;s[y.id]!==T&&(d(y),s[y.id]=T)}function h(y){const v=u();y.__bindingPointIndex=v;const x=r.createBuffer(),A=y.__size,T=y.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,A,T),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,v,x),x}function u(){for(let y=0;y<o;y++)if(a.indexOf(y)===-1)return a.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const v=i[y.id],x=y.uniforms,A=y.__cache;r.bindBuffer(r.UNIFORM_BUFFER,v);for(let T=0,R=x.length;T<R;T++){const I=Array.isArray(x[T])?x[T]:[x[T]];for(let b=0,S=I.length;b<S;b++){const L=I[b];if(f(L,T,b,A)===!0){const F=L.__offset,z=Array.isArray(L.value)?L.value:[L.value];let G=0;for(let q=0;q<z.length;q++){const W=z[q],nt=_(W);typeof W=="number"||typeof W=="boolean"?(L.__data[0]=W,r.bufferSubData(r.UNIFORM_BUFFER,F+G,L.__data)):W.isMatrix3?(L.__data[0]=W.elements[0],L.__data[1]=W.elements[1],L.__data[2]=W.elements[2],L.__data[3]=0,L.__data[4]=W.elements[3],L.__data[5]=W.elements[4],L.__data[6]=W.elements[5],L.__data[7]=0,L.__data[8]=W.elements[6],L.__data[9]=W.elements[7],L.__data[10]=W.elements[8],L.__data[11]=0):(W.toArray(L.__data,G),G+=nt.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,F,L.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(y,v,x,A){const T=y.value,R=v+"_"+x;if(A[R]===void 0)return typeof T=="number"||typeof T=="boolean"?A[R]=T:A[R]=T.clone(),!0;{const I=A[R];if(typeof T=="number"||typeof T=="boolean"){if(I!==T)return A[R]=T,!0}else if(I.equals(T)===!1)return I.copy(T),!0}return!1}function m(y){const v=y.uniforms;let x=0;const A=16;for(let R=0,I=v.length;R<I;R++){const b=Array.isArray(v[R])?v[R]:[v[R]];for(let S=0,L=b.length;S<L;S++){const F=b[S],z=Array.isArray(F.value)?F.value:[F.value];for(let G=0,q=z.length;G<q;G++){const W=z[G],nt=_(W),H=x%A,ut=H%nt.boundary,_t=H+ut;x+=ut,_t!==0&&A-_t<nt.storage&&(x+=A-_t),F.__data=new Float32Array(nt.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=x,x+=nt.storage}}}const T=x%A;return T>0&&(x+=A-T),y.__size=x,y.__cache={},this}function _(y){const v={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(v.boundary=4,v.storage=4):y.isVector2?(v.boundary=8,v.storage=8):y.isVector3||y.isColor?(v.boundary=16,v.storage=12):y.isVector4?(v.boundary=16,v.storage=16):y.isMatrix3?(v.boundary=48,v.storage=48):y.isMatrix4?(v.boundary=64,v.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),v}function g(y){const v=y.target;v.removeEventListener("dispose",g);const x=a.indexOf(v.__bindingPointIndex);a.splice(x,1),r.deleteBuffer(i[v.id]),delete i[v.id],delete s[v.id]}function p(){for(const y in i)r.deleteBuffer(i[y]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}class qy{constructor(t={}){const{canvas:e=ad(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1}=t;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const m=new Uint32Array(4),_=new Int32Array(4);let g=null,p=null;const y=[],v=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const x=this;let A=!1;this._outputColorSpace=Ge;let T=0,R=0,I=null,b=-1,S=null;const L=new te,F=new te;let z=null;const G=new xt(0);let q=0,W=e.width,nt=e.height,H=1,ut=null,_t=null;const St=new te(0,0,W,nt),Gt=new te(0,0,W,nt);let $t=!1;const se=new Ms;let Qt=!1,Y=!1;const et=new Ot,yt=new C,Pt=new te,Tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Zt=!1;function ce(){return I===null?H:1}let P=n;function tt(E,U){return e.getContext(E,U)}try{const E={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r180"),e.addEventListener("webglcontextlost",dt,!1),e.addEventListener("webglcontextrestored",bt,!1),e.addEventListener("webglcontextcreationerror",rt,!1),P===null){const U="webgl2";if(P=tt(U,E),P===null)throw tt(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let $,J,Z,ct,it,ht,kt,zt,w,M,O,V,j,X,Rt,lt,At,wt,st,gt,Ft,It,pt,qt;function D(){$=new iv(P),$.init(),It=new _f(P,$),J=new $x(P,$,t,It),Z=new Oy(P,$),J.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),ct=new av(P),it=new Ey,ht=new By(P,$,Z,it,J,It,ct),kt=new Qx(x),zt=new nv(x),w=new d_(P),pt=new Zx(P,w),M=new sv(P,w,ct,pt),O=new lv(P,M,w,ct),st=new ov(P,J,ht),lt=new Kx(it),V=new by(x,kt,zt,$,J,pt,lt),j=new Wy(x,it),X=new Ay,Rt=new Ly($),wt=new Yx(x,kt,zt,Z,O,f,l),At=new Ny(x,O,J),qt=new Xy(P,ct,J,Z),gt=new Jx(P,$,ct),Ft=new rv(P,$,ct),ct.programs=V.programs,x.capabilities=J,x.extensions=$,x.properties=it,x.renderLists=X,x.shadowMap=At,x.state=Z,x.info=ct}D();const ot=new Hy(x,P);this.xr=ot,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const E=$.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=$.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(E){E!==void 0&&(H=E,this.setSize(W,nt,!1))},this.getSize=function(E){return E.set(W,nt)},this.setSize=function(E,U,B=!0){if(ot.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=E,nt=U,e.width=Math.floor(E*H),e.height=Math.floor(U*H),B===!0&&(e.style.width=E+"px",e.style.height=U+"px"),this.setViewport(0,0,E,U)},this.getDrawingBufferSize=function(E){return E.set(W*H,nt*H).floor()},this.setDrawingBufferSize=function(E,U,B){W=E,nt=U,H=B,e.width=Math.floor(E*B),e.height=Math.floor(U*B),this.setViewport(0,0,E,U)},this.getCurrentViewport=function(E){return E.copy(L)},this.getViewport=function(E){return E.copy(St)},this.setViewport=function(E,U,B,k){E.isVector4?St.set(E.x,E.y,E.z,E.w):St.set(E,U,B,k),Z.viewport(L.copy(St).multiplyScalar(H).round())},this.getScissor=function(E){return E.copy(Gt)},this.setScissor=function(E,U,B,k){E.isVector4?Gt.set(E.x,E.y,E.z,E.w):Gt.set(E,U,B,k),Z.scissor(F.copy(Gt).multiplyScalar(H).round())},this.getScissorTest=function(){return $t},this.setScissorTest=function(E){Z.setScissorTest($t=E)},this.setOpaqueSort=function(E){ut=E},this.setTransparentSort=function(E){_t=E},this.getClearColor=function(E){return E.copy(wt.getClearColor())},this.setClearColor=function(){wt.setClearColor(...arguments)},this.getClearAlpha=function(){return wt.getClearAlpha()},this.setClearAlpha=function(){wt.setClearAlpha(...arguments)},this.clear=function(E=!0,U=!0,B=!0){let k=0;if(E){let N=!1;if(I!==null){const at=I.texture.format;N=at===ho||at===co||at===dr}if(N){const at=I.texture.type,mt=at===dn||at===kn||at===cs||at===hs||at===ao||at===oo,Et=wt.getClearColor(),vt=wt.getClearAlpha(),Ut=Et.r,Bt=Et.g,Lt=Et.b;mt?(m[0]=Ut,m[1]=Bt,m[2]=Lt,m[3]=vt,P.clearBufferuiv(P.COLOR,0,m)):(_[0]=Ut,_[1]=Bt,_[2]=Lt,_[3]=vt,P.clearBufferiv(P.COLOR,0,_))}else k|=P.COLOR_BUFFER_BIT}U&&(k|=P.DEPTH_BUFFER_BIT),B&&(k|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(k)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",dt,!1),e.removeEventListener("webglcontextrestored",bt,!1),e.removeEventListener("webglcontextcreationerror",rt,!1),wt.dispose(),X.dispose(),Rt.dispose(),it.dispose(),kt.dispose(),zt.dispose(),O.dispose(),pt.dispose(),qt.dispose(),V.dispose(),ot.dispose(),ot.removeEventListener("sessionstart",mn),ot.removeEventListener("sessionend",Dc),si.stop()};function dt(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),A=!0}function bt(){console.log("THREE.WebGLRenderer: Context Restored."),A=!1;const E=ct.autoReset,U=At.enabled,B=At.autoUpdate,k=At.needsUpdate,N=At.type;D(),ct.autoReset=E,At.enabled=U,At.autoUpdate=B,At.needsUpdate=k,At.type=N}function rt(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function K(E){const U=E.target;U.removeEventListener("dispose",K),Ct(U)}function Ct(E){Vt(E),it.remove(E)}function Vt(E){const U=it.get(E).programs;U!==void 0&&(U.forEach(function(B){V.releaseProgram(B)}),E.isShaderMaterial&&V.releaseShaderCache(E))}this.renderBufferDirect=function(E,U,B,k,N,at){U===null&&(U=Tt);const mt=N.isMesh&&N.matrixWorld.determinant()<0,Et=xf(E,U,B,k,N);Z.setMaterial(k,mt);let vt=B.index,Ut=1;if(k.wireframe===!0){if(vt=M.getWireframeAttribute(B),vt===void 0)return;Ut=2}const Bt=B.drawRange,Lt=B.attributes.position;let Jt=Bt.start*Ut,ae=(Bt.start+Bt.count)*Ut;at!==null&&(Jt=Math.max(Jt,at.start*Ut),ae=Math.min(ae,(at.start+at.count)*Ut)),vt!==null?(Jt=Math.max(Jt,0),ae=Math.min(ae,vt.count)):Lt!=null&&(Jt=Math.max(Jt,0),ae=Math.min(ae,Lt.count));const me=ae-Jt;if(me<0||me===1/0)return;pt.setup(N,k,Et,B,vt);let ue,le=gt;if(vt!==null&&(ue=w.get(vt),le=Ft,le.setIndex(ue)),N.isMesh)k.wireframe===!0?(Z.setLineWidth(k.wireframeLinewidth*ce()),le.setMode(P.LINES)):le.setMode(P.TRIANGLES);else if(N.isLine){let Dt=k.linewidth;Dt===void 0&&(Dt=1),Z.setLineWidth(Dt*ce()),N.isLineSegments?le.setMode(P.LINES):N.isLineLoop?le.setMode(P.LINE_LOOP):le.setMode(P.LINE_STRIP)}else N.isPoints?le.setMode(P.POINTS):N.isSprite&&le.setMode(P.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)ir("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),le.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if($.get("WEBGL_multi_draw"))le.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const Dt=N._multiDrawStarts,de=N._multiDrawCounts,ne=N._multiDrawCount,Ze=vt?w.get(vt).bytesPerElement:1,Fi=it.get(k).currentProgram.getUniforms();for(let Je=0;Je<ne;Je++)Fi.setValue(P,"_gl_DrawID",Je),le.render(Dt[Je]/Ze,de[Je])}else if(N.isInstancedMesh)le.renderInstances(Jt,me,N.count);else if(B.isInstancedBufferGeometry){const Dt=B._maxInstanceCount!==void 0?B._maxInstanceCount:1/0,de=Math.min(B.instanceCount,Dt);le.renderInstances(Jt,me,de)}else le.render(Jt,me)};function he(E,U,B){E.transparent===!0&&E.side===vn&&E.forceSinglePass===!1?(E.side=Be,E.needsUpdate=!0,Mr(E,U,B),E.side=Bn,E.needsUpdate=!0,Mr(E,U,B),E.side=vn):Mr(E,U,B)}this.compile=function(E,U,B=null){B===null&&(B=E),p=Rt.get(B),p.init(U),v.push(p),B.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),E!==B&&E.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),p.setupLights();const k=new Set;return E.traverse(function(N){if(!(N.isMesh||N.isPoints||N.isLine||N.isSprite))return;const at=N.material;if(at)if(Array.isArray(at))for(let mt=0;mt<at.length;mt++){const Et=at[mt];he(Et,B,N),k.add(Et)}else he(at,B,N),k.add(at)}),p=v.pop(),k},this.compileAsync=function(E,U,B=null){const k=this.compile(E,U,B);return new Promise(N=>{function at(){if(k.forEach(function(mt){it.get(mt).currentProgram.isReady()&&k.delete(mt)}),k.size===0){N(E);return}setTimeout(at,10)}$.get("KHR_parallel_shader_compile")!==null?at():setTimeout(at,10)})};let ie=null;function An(E){ie&&ie(E)}function mn(){si.stop()}function Dc(){si.start()}const si=new df;si.setAnimationLoop(An),typeof self<"u"&&si.setContext(self),this.setAnimationLoop=function(E){ie=E,ot.setAnimationLoop(E),E===null?si.stop():si.start()},ot.addEventListener("sessionstart",mn),ot.addEventListener("sessionend",Dc),this.render=function(E,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),ot.enabled===!0&&ot.isPresenting===!0&&(ot.cameraAutoUpdate===!0&&ot.updateCamera(U),U=ot.getCamera()),E.isScene===!0&&E.onBeforeRender(x,E,U,I),p=Rt.get(E,v.length),p.init(U),v.push(p),et.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),se.setFromProjectionMatrix(et,Qe,U.reversedDepth),Y=this.localClippingEnabled,Qt=lt.init(this.clippingPlanes,Y),g=X.get(E,y.length),g.init(),y.push(g),ot.enabled===!0&&ot.isPresenting===!0){const at=x.xr.getDepthSensingMesh();at!==null&&zo(at,U,-1/0,x.sortObjects)}zo(E,U,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(ut,_t),Zt=ot.enabled===!1||ot.isPresenting===!1||ot.hasDepthSensing()===!1,Zt&&wt.addToRenderList(g,E),this.info.render.frame++,Qt===!0&&lt.beginShadows();const B=p.state.shadowsArray;At.render(B,E,U),Qt===!0&&lt.endShadows(),this.info.autoReset===!0&&this.info.reset();const k=g.opaque,N=g.transmissive;if(p.setupLights(),U.isArrayCamera){const at=U.cameras;if(N.length>0)for(let mt=0,Et=at.length;mt<Et;mt++){const vt=at[mt];Nc(k,N,E,vt)}Zt&&wt.render(E);for(let mt=0,Et=at.length;mt<Et;mt++){const vt=at[mt];Uc(g,E,vt,vt.viewport)}}else N.length>0&&Nc(k,N,E,U),Zt&&wt.render(E),Uc(g,E,U);I!==null&&R===0&&(ht.updateMultisampleRenderTarget(I),ht.updateRenderTargetMipmap(I)),E.isScene===!0&&E.onAfterRender(x,E,U),pt.resetDefaultState(),b=-1,S=null,v.pop(),v.length>0?(p=v[v.length-1],Qt===!0&&lt.setGlobalState(x.clippingPlanes,p.state.camera)):p=null,y.pop(),y.length>0?g=y[y.length-1]:g=null};function zo(E,U,B,k){if(E.visible===!1)return;if(E.layers.test(U.layers)){if(E.isGroup)B=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(U);else if(E.isLight)p.pushLight(E),E.castShadow&&p.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||se.intersectsSprite(E)){k&&Pt.setFromMatrixPosition(E.matrixWorld).applyMatrix4(et);const mt=O.update(E),Et=E.material;Et.visible&&g.push(E,mt,Et,B,Pt.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||se.intersectsObject(E))){const mt=O.update(E),Et=E.material;if(k&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Pt.copy(E.boundingSphere.center)):(mt.boundingSphere===null&&mt.computeBoundingSphere(),Pt.copy(mt.boundingSphere.center)),Pt.applyMatrix4(E.matrixWorld).applyMatrix4(et)),Array.isArray(Et)){const vt=mt.groups;for(let Ut=0,Bt=vt.length;Ut<Bt;Ut++){const Lt=vt[Ut],Jt=Et[Lt.materialIndex];Jt&&Jt.visible&&g.push(E,mt,Jt,B,Pt.z,Lt)}}else Et.visible&&g.push(E,mt,Et,B,Pt.z,null)}}const at=E.children;for(let mt=0,Et=at.length;mt<Et;mt++)zo(at[mt],U,B,k)}function Uc(E,U,B,k){const N=E.opaque,at=E.transmissive,mt=E.transparent;p.setupLightsView(B),Qt===!0&&lt.setGlobalState(x.clippingPlanes,B),k&&Z.viewport(L.copy(k)),N.length>0&&yr(N,U,B),at.length>0&&yr(at,U,B),mt.length>0&&yr(mt,U,B),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Nc(E,U,B,k){if((B.isScene===!0?B.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[k.id]===void 0&&(p.state.transmissionRenderTarget[k.id]=new bn(1,1,{generateMipmaps:!0,type:$.has("EXT_color_buffer_half_float")||$.has("EXT_color_buffer_float")?vs:dn,minFilter:yn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace}));const at=p.state.transmissionRenderTarget[k.id],mt=k.viewport||L;at.setSize(mt.z*x.transmissionResolutionScale,mt.w*x.transmissionResolutionScale);const Et=x.getRenderTarget(),vt=x.getActiveCubeFace(),Ut=x.getActiveMipmapLevel();x.setRenderTarget(at),x.getClearColor(G),q=x.getClearAlpha(),q<1&&x.setClearColor(16777215,.5),x.clear(),Zt&&wt.render(B);const Bt=x.toneMapping;x.toneMapping=Fn;const Lt=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),p.setupLightsView(k),Qt===!0&&lt.setGlobalState(x.clippingPlanes,k),yr(E,B,k),ht.updateMultisampleRenderTarget(at),ht.updateRenderTargetMipmap(at),$.has("WEBGL_multisampled_render_to_texture")===!1){let Jt=!1;for(let ae=0,me=U.length;ae<me;ae++){const ue=U[ae],le=ue.object,Dt=ue.geometry,de=ue.material,ne=ue.group;if(de.side===vn&&le.layers.test(k.layers)){const Ze=de.side;de.side=Be,de.needsUpdate=!0,Fc(le,B,k,Dt,de,ne),de.side=Ze,de.needsUpdate=!0,Jt=!0}}Jt===!0&&(ht.updateMultisampleRenderTarget(at),ht.updateRenderTargetMipmap(at))}x.setRenderTarget(Et,vt,Ut),x.setClearColor(G,q),Lt!==void 0&&(k.viewport=Lt),x.toneMapping=Bt}function yr(E,U,B){const k=U.isScene===!0?U.overrideMaterial:null;for(let N=0,at=E.length;N<at;N++){const mt=E[N],Et=mt.object,vt=mt.geometry,Ut=mt.group;let Bt=mt.material;Bt.allowOverride===!0&&k!==null&&(Bt=k),Et.layers.test(B.layers)&&Fc(Et,U,B,vt,Bt,Ut)}}function Fc(E,U,B,k,N,at){E.onBeforeRender(x,U,B,k,N,at),E.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),N.onBeforeRender(x,U,B,k,E,at),N.transparent===!0&&N.side===vn&&N.forceSinglePass===!1?(N.side=Be,N.needsUpdate=!0,x.renderBufferDirect(B,U,k,N,E,at),N.side=Bn,N.needsUpdate=!0,x.renderBufferDirect(B,U,k,N,E,at),N.side=vn):x.renderBufferDirect(B,U,k,N,E,at),E.onAfterRender(x,U,B,k,N,at)}function Mr(E,U,B){U.isScene!==!0&&(U=Tt);const k=it.get(E),N=p.state.lights,at=p.state.shadowsArray,mt=N.state.version,Et=V.getParameters(E,N.state,at,U,B),vt=V.getProgramCacheKey(Et);let Ut=k.programs;k.environment=E.isMeshStandardMaterial?U.environment:null,k.fog=U.fog,k.envMap=(E.isMeshStandardMaterial?zt:kt).get(E.envMap||k.environment),k.envMapRotation=k.environment!==null&&E.envMap===null?U.environmentRotation:E.envMapRotation,Ut===void 0&&(E.addEventListener("dispose",K),Ut=new Map,k.programs=Ut);let Bt=Ut.get(vt);if(Bt!==void 0){if(k.currentProgram===Bt&&k.lightsStateVersion===mt)return Bc(E,Et),Bt}else Et.uniforms=V.getUniforms(E),E.onBeforeCompile(Et,x),Bt=V.acquireProgram(Et,vt),Ut.set(vt,Bt),k.uniforms=Et.uniforms;const Lt=k.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Lt.clippingPlanes=lt.uniform),Bc(E,Et),k.needsLights=yf(E),k.lightsStateVersion=mt,k.needsLights&&(Lt.ambientLightColor.value=N.state.ambient,Lt.lightProbe.value=N.state.probe,Lt.directionalLights.value=N.state.directional,Lt.directionalLightShadows.value=N.state.directionalShadow,Lt.spotLights.value=N.state.spot,Lt.spotLightShadows.value=N.state.spotShadow,Lt.rectAreaLights.value=N.state.rectArea,Lt.ltc_1.value=N.state.rectAreaLTC1,Lt.ltc_2.value=N.state.rectAreaLTC2,Lt.pointLights.value=N.state.point,Lt.pointLightShadows.value=N.state.pointShadow,Lt.hemisphereLights.value=N.state.hemi,Lt.directionalShadowMap.value=N.state.directionalShadowMap,Lt.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Lt.spotShadowMap.value=N.state.spotShadowMap,Lt.spotLightMatrix.value=N.state.spotLightMatrix,Lt.spotLightMap.value=N.state.spotLightMap,Lt.pointShadowMap.value=N.state.pointShadowMap,Lt.pointShadowMatrix.value=N.state.pointShadowMatrix),k.currentProgram=Bt,k.uniformsList=null,Bt}function Oc(E){if(E.uniformsList===null){const U=E.currentProgram.getUniforms();E.uniformsList=ma.seqWithValue(U.seq,E.uniforms)}return E.uniformsList}function Bc(E,U){const B=it.get(E);B.outputColorSpace=U.outputColorSpace,B.batching=U.batching,B.batchingColor=U.batchingColor,B.instancing=U.instancing,B.instancingColor=U.instancingColor,B.instancingMorph=U.instancingMorph,B.skinning=U.skinning,B.morphTargets=U.morphTargets,B.morphNormals=U.morphNormals,B.morphColors=U.morphColors,B.morphTargetsCount=U.morphTargetsCount,B.numClippingPlanes=U.numClippingPlanes,B.numIntersection=U.numClipIntersection,B.vertexAlphas=U.vertexAlphas,B.vertexTangents=U.vertexTangents,B.toneMapping=U.toneMapping}function xf(E,U,B,k,N){U.isScene!==!0&&(U=Tt),ht.resetTextureUnits();const at=U.fog,mt=k.isMeshStandardMaterial?U.environment:null,Et=I===null?x.outputColorSpace:I.isXRRenderTarget===!0?I.texture.colorSpace:Ii,vt=(k.isMeshStandardMaterial?zt:kt).get(k.envMap||mt),Ut=k.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,Bt=!!B.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Lt=!!B.morphAttributes.position,Jt=!!B.morphAttributes.normal,ae=!!B.morphAttributes.color;let me=Fn;k.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(me=x.toneMapping);const ue=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,le=ue!==void 0?ue.length:0,Dt=it.get(k),de=p.state.lights;if(Qt===!0&&(Y===!0||E!==S)){const De=E===S&&k.id===b;lt.setState(k,E,De)}let ne=!1;k.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==de.state.version||Dt.outputColorSpace!==Et||N.isBatchedMesh&&Dt.batching===!1||!N.isBatchedMesh&&Dt.batching===!0||N.isBatchedMesh&&Dt.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&Dt.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&Dt.instancing===!1||!N.isInstancedMesh&&Dt.instancing===!0||N.isSkinnedMesh&&Dt.skinning===!1||!N.isSkinnedMesh&&Dt.skinning===!0||N.isInstancedMesh&&Dt.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Dt.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&Dt.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&Dt.instancingMorph===!1&&N.morphTexture!==null||Dt.envMap!==vt||k.fog===!0&&Dt.fog!==at||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==lt.numPlanes||Dt.numIntersection!==lt.numIntersection)||Dt.vertexAlphas!==Ut||Dt.vertexTangents!==Bt||Dt.morphTargets!==Lt||Dt.morphNormals!==Jt||Dt.morphColors!==ae||Dt.toneMapping!==me||Dt.morphTargetsCount!==le)&&(ne=!0):(ne=!0,Dt.__version=k.version);let Ze=Dt.currentProgram;ne===!0&&(Ze=Mr(k,U,N));let Fi=!1,Je=!1,Es=!1;const fe=Ze.getUniforms(),en=Dt.uniforms;if(Z.useProgram(Ze.program)&&(Fi=!0,Je=!0,Es=!0),k.id!==b&&(b=k.id,Je=!0),Fi||S!==E){Z.buffers.depth.getReversed()&&E.reversedDepth!==!0&&(E._reversedDepth=!0,E.updateProjectionMatrix()),fe.setValue(P,"projectionMatrix",E.projectionMatrix),fe.setValue(P,"viewMatrix",E.matrixWorldInverse);const ke=fe.map.cameraPosition;ke!==void 0&&ke.setValue(P,yt.setFromMatrixPosition(E.matrixWorld)),J.logarithmicDepthBuffer&&fe.setValue(P,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&fe.setValue(P,"isOrthographic",E.isOrthographicCamera===!0),S!==E&&(S=E,Je=!0,Es=!0)}if(N.isSkinnedMesh){fe.setOptional(P,N,"bindMatrix"),fe.setOptional(P,N,"bindMatrixInverse");const De=N.skeleton;De&&(De.boneTexture===null&&De.computeBoneTexture(),fe.setValue(P,"boneTexture",De.boneTexture,ht))}N.isBatchedMesh&&(fe.setOptional(P,N,"batchingTexture"),fe.setValue(P,"batchingTexture",N._matricesTexture,ht),fe.setOptional(P,N,"batchingIdTexture"),fe.setValue(P,"batchingIdTexture",N._indirectTexture,ht),fe.setOptional(P,N,"batchingColorTexture"),N._colorsTexture!==null&&fe.setValue(P,"batchingColorTexture",N._colorsTexture,ht));const nn=B.morphAttributes;if((nn.position!==void 0||nn.normal!==void 0||nn.color!==void 0)&&st.update(N,B,Ze),(Je||Dt.receiveShadow!==N.receiveShadow)&&(Dt.receiveShadow=N.receiveShadow,fe.setValue(P,"receiveShadow",N.receiveShadow)),k.isMeshGouraudMaterial&&k.envMap!==null&&(en.envMap.value=vt,en.flipEnvMap.value=vt.isCubeTexture&&vt.isRenderTargetTexture===!1?-1:1),k.isMeshStandardMaterial&&k.envMap===null&&U.environment!==null&&(en.envMapIntensity.value=U.environmentIntensity),Je&&(fe.setValue(P,"toneMappingExposure",x.toneMappingExposure),Dt.needsLights&&vf(en,Es),at&&k.fog===!0&&j.refreshFogUniforms(en,at),j.refreshMaterialUniforms(en,k,H,nt,p.state.transmissionRenderTarget[E.id]),ma.upload(P,Oc(Dt),en,ht)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(ma.upload(P,Oc(Dt),en,ht),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&fe.setValue(P,"center",N.center),fe.setValue(P,"modelViewMatrix",N.modelViewMatrix),fe.setValue(P,"normalMatrix",N.normalMatrix),fe.setValue(P,"modelMatrix",N.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const De=k.uniformsGroups;for(let ke=0,ko=De.length;ke<ko;ke++){const ri=De[ke];qt.update(ri,Ze),qt.bind(ri,Ze)}}return Ze}function vf(E,U){E.ambientLightColor.needsUpdate=U,E.lightProbe.needsUpdate=U,E.directionalLights.needsUpdate=U,E.directionalLightShadows.needsUpdate=U,E.pointLights.needsUpdate=U,E.pointLightShadows.needsUpdate=U,E.spotLights.needsUpdate=U,E.spotLightShadows.needsUpdate=U,E.rectAreaLights.needsUpdate=U,E.hemisphereLights.needsUpdate=U}function yf(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(E,U,B){const k=it.get(E);k.__autoAllocateDepthBuffer=E.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1&&(k.__useRenderToTexture=!1),it.get(E.texture).__webglTexture=U,it.get(E.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:B,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(E,U){const B=it.get(E);B.__webglFramebuffer=U,B.__useDefaultFramebuffer=U===void 0};const Mf=P.createFramebuffer();this.setRenderTarget=function(E,U=0,B=0){I=E,T=U,R=B;let k=!0,N=null,at=!1,mt=!1;if(E){const vt=it.get(E);if(vt.__useDefaultFramebuffer!==void 0)Z.bindFramebuffer(P.FRAMEBUFFER,null),k=!1;else if(vt.__webglFramebuffer===void 0)ht.setupRenderTarget(E);else if(vt.__hasExternalTextures)ht.rebindTextures(E,it.get(E.texture).__webglTexture,it.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const Lt=E.depthTexture;if(vt.__boundDepthTexture!==Lt){if(Lt!==null&&it.has(Lt)&&(E.width!==Lt.image.width||E.height!==Lt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ht.setupDepthRenderbuffer(E)}}const Ut=E.texture;(Ut.isData3DTexture||Ut.isDataArrayTexture||Ut.isCompressedArrayTexture)&&(mt=!0);const Bt=it.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(Bt[U])?N=Bt[U][B]:N=Bt[U],at=!0):E.samples>0&&ht.useMultisampledRTT(E)===!1?N=it.get(E).__webglMultisampledFramebuffer:Array.isArray(Bt)?N=Bt[B]:N=Bt,L.copy(E.viewport),F.copy(E.scissor),z=E.scissorTest}else L.copy(St).multiplyScalar(H).floor(),F.copy(Gt).multiplyScalar(H).floor(),z=$t;if(B!==0&&(N=Mf),Z.bindFramebuffer(P.FRAMEBUFFER,N)&&k&&Z.drawBuffers(E,N),Z.viewport(L),Z.scissor(F),Z.setScissorTest(z),at){const vt=it.get(E.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+U,vt.__webglTexture,B)}else if(mt){const vt=U;for(let Ut=0;Ut<E.textures.length;Ut++){const Bt=it.get(E.textures[Ut]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+Ut,Bt.__webglTexture,B,vt)}}else if(E!==null&&B!==0){const vt=it.get(E.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,vt.__webglTexture,B)}b=-1},this.readRenderTargetPixels=function(E,U,B,k,N,at,mt,Et=0){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let vt=it.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&mt!==void 0&&(vt=vt[mt]),vt){Z.bindFramebuffer(P.FRAMEBUFFER,vt);try{const Ut=E.textures[Et],Bt=Ut.format,Lt=Ut.type;if(!J.textureFormatReadable(Bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!J.textureTypeReadable(Lt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=E.width-k&&B>=0&&B<=E.height-N&&(E.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+Et),P.readPixels(U,B,k,N,It.convert(Bt),It.convert(Lt),at))}finally{const Ut=I!==null?it.get(I).__webglFramebuffer:null;Z.bindFramebuffer(P.FRAMEBUFFER,Ut)}}},this.readRenderTargetPixelsAsync=async function(E,U,B,k,N,at,mt,Et=0){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let vt=it.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&mt!==void 0&&(vt=vt[mt]),vt)if(U>=0&&U<=E.width-k&&B>=0&&B<=E.height-N){Z.bindFramebuffer(P.FRAMEBUFFER,vt);const Ut=E.textures[Et],Bt=Ut.format,Lt=Ut.type;if(!J.textureFormatReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!J.textureTypeReadable(Lt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Jt=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,Jt),P.bufferData(P.PIXEL_PACK_BUFFER,at.byteLength,P.STREAM_READ),E.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+Et),P.readPixels(U,B,k,N,It.convert(Bt),It.convert(Lt),0);const ae=I!==null?it.get(I).__webglFramebuffer:null;Z.bindFramebuffer(P.FRAMEBUFFER,ae);const me=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Cp(P,me,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,Jt),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,at),P.deleteBuffer(Jt),P.deleteSync(me),at}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(E,U=null,B=0){const k=Math.pow(2,-B),N=Math.floor(E.image.width*k),at=Math.floor(E.image.height*k),mt=U!==null?U.x:0,Et=U!==null?U.y:0;ht.setTexture2D(E,0),P.copyTexSubImage2D(P.TEXTURE_2D,B,0,0,mt,Et,N,at),Z.unbindTexture()};const Sf=P.createFramebuffer(),bf=P.createFramebuffer();this.copyTextureToTexture=function(E,U,B=null,k=null,N=0,at=null){at===null&&(N!==0?(ir("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),at=N,N=0):at=0);let mt,Et,vt,Ut,Bt,Lt,Jt,ae,me;const ue=E.isCompressedTexture?E.mipmaps[at]:E.image;if(B!==null)mt=B.max.x-B.min.x,Et=B.max.y-B.min.y,vt=B.isBox3?B.max.z-B.min.z:1,Ut=B.min.x,Bt=B.min.y,Lt=B.isBox3?B.min.z:0;else{const nn=Math.pow(2,-N);mt=Math.floor(ue.width*nn),Et=Math.floor(ue.height*nn),E.isDataArrayTexture?vt=ue.depth:E.isData3DTexture?vt=Math.floor(ue.depth*nn):vt=1,Ut=0,Bt=0,Lt=0}k!==null?(Jt=k.x,ae=k.y,me=k.z):(Jt=0,ae=0,me=0);const le=It.convert(U.format),Dt=It.convert(U.type);let de;U.isData3DTexture?(ht.setTexture3D(U,0),de=P.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?(ht.setTexture2DArray(U,0),de=P.TEXTURE_2D_ARRAY):(ht.setTexture2D(U,0),de=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,U.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,U.unpackAlignment);const ne=P.getParameter(P.UNPACK_ROW_LENGTH),Ze=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Fi=P.getParameter(P.UNPACK_SKIP_PIXELS),Je=P.getParameter(P.UNPACK_SKIP_ROWS),Es=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,ue.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,ue.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ut),P.pixelStorei(P.UNPACK_SKIP_ROWS,Bt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Lt);const fe=E.isDataArrayTexture||E.isData3DTexture,en=U.isDataArrayTexture||U.isData3DTexture;if(E.isDepthTexture){const nn=it.get(E),De=it.get(U),ke=it.get(nn.__renderTarget),ko=it.get(De.__renderTarget);Z.bindFramebuffer(P.READ_FRAMEBUFFER,ke.__webglFramebuffer),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,ko.__webglFramebuffer);for(let ri=0;ri<vt;ri++)fe&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,it.get(E).__webglTexture,N,Lt+ri),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,it.get(U).__webglTexture,at,me+ri)),P.blitFramebuffer(Ut,Bt,mt,Et,Jt,ae,mt,Et,P.DEPTH_BUFFER_BIT,P.NEAREST);Z.bindFramebuffer(P.READ_FRAMEBUFFER,null),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(N!==0||E.isRenderTargetTexture||it.has(E)){const nn=it.get(E),De=it.get(U);Z.bindFramebuffer(P.READ_FRAMEBUFFER,Sf),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,bf);for(let ke=0;ke<vt;ke++)fe?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,nn.__webglTexture,N,Lt+ke):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,nn.__webglTexture,N),en?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,De.__webglTexture,at,me+ke):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,De.__webglTexture,at),N!==0?P.blitFramebuffer(Ut,Bt,mt,Et,Jt,ae,mt,Et,P.COLOR_BUFFER_BIT,P.NEAREST):en?P.copyTexSubImage3D(de,at,Jt,ae,me+ke,Ut,Bt,mt,Et):P.copyTexSubImage2D(de,at,Jt,ae,Ut,Bt,mt,Et);Z.bindFramebuffer(P.READ_FRAMEBUFFER,null),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else en?E.isDataTexture||E.isData3DTexture?P.texSubImage3D(de,at,Jt,ae,me,mt,Et,vt,le,Dt,ue.data):U.isCompressedArrayTexture?P.compressedTexSubImage3D(de,at,Jt,ae,me,mt,Et,vt,le,ue.data):P.texSubImage3D(de,at,Jt,ae,me,mt,Et,vt,le,Dt,ue):E.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,at,Jt,ae,mt,Et,le,Dt,ue.data):E.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,at,Jt,ae,ue.width,ue.height,le,ue.data):P.texSubImage2D(P.TEXTURE_2D,at,Jt,ae,mt,Et,le,Dt,ue);P.pixelStorei(P.UNPACK_ROW_LENGTH,ne),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Ze),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Fi),P.pixelStorei(P.UNPACK_SKIP_ROWS,Je),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Es),at===0&&U.generateMipmaps&&P.generateMipmap(de),Z.unbindTexture()},this.initRenderTarget=function(E){it.get(E).__webglFramebuffer===void 0&&ht.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?ht.setTextureCube(E,0):E.isData3DTexture?ht.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?ht.setTexture2DArray(E,0):ht.setTexture2D(E,0),Z.unbindTexture()},this.resetState=function(){T=0,R=0,I=null,Z.reset(),pt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qe}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Kt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Kt._getUnpackColorSpace()}}const Zy=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Vu,AddEquation:$n,AddOperation:Ou,AdditiveAnimationBlendMode:nc,AdditiveBlending:Ll,AgXToneMapping:Gu,AlphaFormat:jl,AlwaysCompare:sd,AlwaysDepth:va,AlwaysStencilFunc:Fl,AmbientLight:jd,AnimationAction:hf,AnimationClip:cr,AnimationLoader:eg,AnimationMixer:Ig,AnimationObjectGroup:Cg,AnimationUtils:Km,ArcCurve:Ed,ArrayCamera:af,ArrowHelper:i_,AttachedBindMode:Nl,Audio:lf,AudioAnalyser:xg,AudioContext:wc,AudioListener:mg,AudioLoader:dg,AxesHelper:s_,BackSide:Be,BasicDepthPacking:Ju,BasicShadowMap:wf,BatchedMesh:vd,Bone:cc,BooleanKeyframeTrack:Ui,Box2:Vg,Box3:Pe,Box3Helper:e_,BoxGeometry:Di,BoxHelper:t_,BufferAttribute:oe,BufferGeometry:Xt,BufferGeometryLoader:rf,ByteType:Jl,Cache:Mn,Camera:go,CameraHelper:jg,CanvasTexture:ym,CapsuleGeometry:bo,CatmullRomCurve3:Td,CineonToneMapping:ku,CircleGeometry:Eo,ClampToEdgeWrapping:rn,Clock:of,Color:xt,ColorKeyframeTrack:Ec,ColorManagement:Kt,CompressedArrayTexture:xm,CompressedCubeTexture:vm,CompressedTexture:So,CompressedTextureLoader:ng,ConeGeometry:mr,ConstantAlphaFactor:Uu,ConstantColorFactor:Lu,Controls:a_,CubeCamera:ud,CubeReflectionMapping:zn,CubeRefractionMapping:Qn,CubeTexture:fr,CubeTextureLoader:ig,CubeUVReflectionMapping:xs,CubicBezierCurve:pc,CubicBezierCurve3:Ad,CubicInterpolant:Xd,CullFaceBack:Pl,CullFaceFront:gu,CullFaceFrontBack:Af,CullFaceNone:mu,Curve:pn,CurvePath:Cd,CustomBlending:xu,CustomToneMapping:Hu,CylinderGeometry:pr,Cylindrical:kg,Data3DTexture:po,DataArrayTexture:fo,DataTexture:Sn,DataTextureLoader:sg,DataUtils:Gp,DecrementStencilOp:Vf,DecrementWrapStencilOp:Gf,DefaultLoadingManager:Zd,DepthFormat:us,DepthStencilFormat:ds,DepthTexture:uc,DetachedBindMode:Xu,DirectionalLight:Qd,DirectionalLightHelper:Qg,DiscreteInterpolant:qd,DodecahedronGeometry:To,DoubleSide:vn,DstAlphaFactor:wu,DstColorFactor:Ru,DynamicCopyUsage:sp,DynamicDrawUsage:Qf,DynamicReadUsage:ep,EdgesGeometry:bd,EllipseCurve:Ao,EqualCompare:td,EqualDepth:Ma,EqualStencilFunc:Yf,EquirectangularReflectionMapping:Zs,EquirectangularRefractionMapping:Js,Euler:tn,EventDispatcher:En,ExternalTexture:dc,ExtrudeGeometry:wo,FileLoader:Vn,Float16BufferAttribute:$p,Float32BufferAttribute:Mt,FloatType:Xe,Fog:xo,FogExp2:_o,FramebufferTexture:_m,FrontSide:Bn,Frustum:Ms,FrustumArray:Mo,GLBufferAttribute:Ng,GLSL1:ap,GLSL3:Ol,GreaterCompare:ed,GreaterDepth:ba,GreaterEqualCompare:id,GreaterEqualDepth:Sa,GreaterEqualStencilFunc:Kf,GreaterStencilFunc:Jf,GridHelper:$g,Group:as,HalfFloatType:vs,HemisphereLight:Jd,HemisphereLightHelper:Jg,IcosahedronGeometry:Co,ImageBitmapLoader:ug,ImageLoader:hr,ImageUtils:od,IncrementStencilOp:kf,IncrementWrapStencilOp:Hf,InstancedBufferAttribute:gs,InstancedBufferGeometry:sf,InstancedInterleavedBuffer:Ug,InstancedMesh:xd,Int16BufferAttribute:Zp,Int32BufferAttribute:Jp,Int8BufferAttribute:Xp,IntType:ro,InterleavedBuffer:vo,InterleavedBufferAttribute:Pi,Interpolant:xr,InterpolateDiscrete:Qs,InterpolateLinear:ja,InterpolateSmooth:fa,InterpolationSamplingMode:cp,InterpolationSamplingType:lp,InvertStencilOp:Wf,KeepStencilOp:yi,KeyframeTrack:an,LOD:gd,LatheGeometry:Ro,Layers:mo,LessCompare:ju,LessDepth:ya,LessEqualCompare:ic,LessEqualDepth:Ri,LessEqualStencilFunc:Zf,LessStencilFunc:qf,Light:ii,LightProbe:nf,Line:jn,Line3:Wg,LineBasicMaterial:ze,LineCurve:mc,LineCurve3:wd,LineDashedMaterial:Hd,LineLoop:yd,LineSegments:Tn,LinearFilter:Me,LinearInterpolant:bc,LinearMipMapLinearFilter:Pf,LinearMipMapNearestFilter:If,LinearMipmapLinearFilter:yn,LinearMipmapNearestFilter:ks,LinearSRGBColorSpace:Ii,LinearToneMapping:Bu,LinearTransfer:tr,Loader:Ye,LoaderUtils:Hl,LoadingManager:Tc,LoopOnce:qu,LoopPingPong:Zu,LoopRepeat:Yu,MOUSE:Ef,Material:Le,MaterialLoader:Oo,MathUtils:Ap,Matrix2:Pc,Matrix3:Ht,Matrix4:Ot,MaxEquation:Su,Mesh:ye,MeshBasicMaterial:ei,MeshDepthMaterial:yc,MeshDistanceMaterial:Mc,MeshLambertMaterial:kd,MeshMatcapMaterial:Vd,MeshNormalMaterial:zd,MeshPhongMaterial:Od,MeshPhysicalMaterial:Fd,MeshStandardMaterial:vc,MeshToonMaterial:Bd,MinEquation:Mu,MirroredRepeatWrapping:Ks,MixOperation:Fu,MultiplyBlending:Ul,MultiplyOperation:ur,NearestFilter:Ae,NearestMipMapLinearFilter:Rf,NearestMipMapNearestFilter:Cf,NearestMipmapLinearFilter:ss,NearestMipmapNearestFilter:Zl,NeutralToneMapping:Wu,NeverCompare:Qu,NeverDepth:xa,NeverStencilFunc:Xf,NoBlending:Nn,NoColorSpace:Dn,NoToneMapping:Fn,NormalAnimationBlendMode:uo,NormalBlending:Ai,NotEqualCompare:nd,NotEqualDepth:Ea,NotEqualStencilFunc:$f,NumberKeyframeTrack:or,Object3D:ee,ObjectLoader:cg,ObjectSpaceNormalMap:Ku,OctahedronGeometry:gr,OneFactor:Eu,OneMinusConstantAlphaFactor:Nu,OneMinusConstantColorFactor:Du,OneMinusDstAlphaFactor:Cu,OneMinusDstColorFactor:Iu,OneMinusSrcAlphaFactor:_a,OneMinusSrcColorFactor:Au,OrthographicCamera:Fo,PCFShadowMap:Yl,PCFSoftShadowMap:_u,PMREMGenerator:Xl,Path:io,PerspectiveCamera:Te,Plane:Jn,PlaneGeometry:Ss,PlaneHelper:n_,PointLight:Kd,PointLightHelper:Yg,Points:Md,PointsMaterial:hc,PolarGridHelper:Kg,PolyhedronGeometry:ni,PositionalAudio:_g,PropertyBinding:jt,PropertyMixer:cf,QuadraticBezierCurve:gc,QuadraticBezierCurve3:_c,Quaternion:qe,QuaternionKeyframeTrack:vr,QuaternionLinearInterpolant:Yd,RED_GREEN_RGTC2_Format:Ka,RED_RGTC1_Format:Ja,REVISION:"180",RGBADepthPacking:$u,RGBAFormat:Oe,RGBAIntegerFormat:ho,RGBA_ASTC_10x10_Format:Ga,RGBA_ASTC_10x5_Format:ka,RGBA_ASTC_10x6_Format:Va,RGBA_ASTC_10x8_Format:Ha,RGBA_ASTC_12x10_Format:Wa,RGBA_ASTC_12x12_Format:Xa,RGBA_ASTC_4x4_Format:La,RGBA_ASTC_5x4_Format:Da,RGBA_ASTC_5x5_Format:Ua,RGBA_ASTC_6x5_Format:Na,RGBA_ASTC_6x6_Format:Fa,RGBA_ASTC_8x5_Format:Oa,RGBA_ASTC_8x6_Format:Ba,RGBA_ASTC_8x8_Format:za,RGBA_BPTC_Format:qa,RGBA_ETC2_EAC_Format:Pa,RGBA_PVRTC_2BPPV1_Format:Ca,RGBA_PVRTC_4BPPV1_Format:wa,RGBA_S3TC_DXT1_Format:Hs,RGBA_S3TC_DXT3_Format:Gs,RGBA_S3TC_DXT5_Format:Ws,RGBDepthPacking:Ff,RGBFormat:tc,RGBIntegerFormat:Lf,RGB_BPTC_SIGNED_Format:Ya,RGB_BPTC_UNSIGNED_Format:Za,RGB_ETC1_Format:Ra,RGB_ETC2_Format:Ia,RGB_PVRTC_2BPPV1_Format:Aa,RGB_PVRTC_4BPPV1_Format:Ta,RGB_S3TC_DXT1_Format:Vs,RGDepthPacking:Of,RGFormat:ec,RGIntegerFormat:co,RawShaderMaterial:Nd,Ray:ys,Raycaster:Fg,RectAreaLight:tf,RedFormat:lo,RedIntegerFormat:dr,ReinhardToneMapping:zu,RenderTarget:rc,RenderTarget3D:Pg,RepeatWrapping:$s,ReplaceStencilOp:zf,ReverseSubtractEquation:yu,RingGeometry:Io,SIGNED_RED_GREEN_RGTC2_Format:Qa,SIGNED_RED_RGTC1_Format:$a,SRGBColorSpace:Ge,SRGBTransfer:re,Scene:fd,ShaderChunk:Yt,ShaderLib:hn,ShaderMaterial:fn,ShadowMaterial:Ud,Shape:Ci,ShapeGeometry:Po,ShapePath:r_,ShapeUtils:un,ShortType:$l,Skeleton:yo,SkeletonHelper:qg,SkinnedMesh:_d,Source:Kn,Sphere:we,SphereGeometry:_r,Spherical:zg,SphericalHarmonics3:ef,SplineCurve:xc,SpotLight:$d,SpotLightHelper:Xg,Sprite:md,SpriteMaterial:lc,SrcAlphaFactor:ga,SrcAlphaSaturateFactor:Pu,SrcColorFactor:Tu,StaticCopyUsage:ip,StaticDrawUsage:er,StaticReadUsage:tp,StereoCamera:fg,StreamCopyUsage:rp,StreamDrawUsage:jf,StreamReadUsage:np,StringKeyframeTrack:Ni,SubtractEquation:vu,SubtractiveBlending:Dl,TOUCH:Tf,TangentSpaceNormalMap:ti,TetrahedronGeometry:Lo,Texture:_e,TextureLoader:rg,TextureUtils:u_,Timer:Og,TimestampQuery:op,TorusGeometry:Do,TorusKnotGeometry:Uo,Triangle:We,TriangleFanDrawMode:Nf,TriangleStripDrawMode:Uf,TrianglesDrawMode:Df,TubeGeometry:No,UVMapping:so,Uint16BufferAttribute:ac,Uint32BufferAttribute:oc,Uint8BufferAttribute:qp,Uint8ClampedBufferAttribute:Yp,Uniform:Ic,UniformsGroup:Dg,UniformsLib:ft,UniformsUtils:hd,UnsignedByteType:dn,UnsignedInt101111Type:Ql,UnsignedInt248Type:hs,UnsignedInt5999Type:Kl,UnsignedIntType:kn,UnsignedShort4444Type:ao,UnsignedShort5551Type:oo,UnsignedShortType:cs,VSMShadowMap:xn,Vector2:Q,Vector3:C,Vector4:te,VectorKeyframeTrack:lr,VideoFrameTexture:gm,VideoTexture:Sd,WebGL3DRenderTarget:Dp,WebGLArrayRenderTarget:Lp,WebGLCoordinateSystem:Qe,WebGLCubeRenderTarget:dd,WebGLRenderTarget:bn,WebGLRenderer:qy,WebGLUtils:_f,WebGPUCoordinateSystem:fs,WebXRController:pa,WireframeGeometry:Dd,WrapAroundEnding:js,ZeroCurvatureEnding:bi,ZeroFactor:bu,ZeroSlopeEnding:Ei,ZeroStencilOp:Bf,createCanvasElement:ad},Symbol.toStringTag,{value:"Module"}));export{Ic as $,Ig as A,Di as B,xt as C,Qd as D,Zs as E,vc as F,$g as G,_r as H,Eo as I,sg as J,vs as K,Tc as L,ye as M,ec as N,ee as O,_g as P,qe as Q,Oe as R,qg as S,Zy as T,hd as U,C as V,qy as W,Ii as X,lo as Y,Xe as Z,Gp as _,Ot as a,Od as a$,te as a0,ym as a1,$s as a2,Nn as a3,bn as a4,Ae as a5,En as a6,dn as a7,Ju as a8,Yy as a9,Le as aA,Xt as aB,oe as aC,Ol as aD,of as aE,Ht as aF,ho as aG,dd as aH,Pf as aI,ud as aJ,go as aK,Xl as aL,sf as aM,Lp as aN,co as aO,fo as aP,tn as aQ,Pc as aR,cs as aS,Yt as aT,gs as aU,Qf as aV,Nd as aW,as as aX,Mt as aY,ze as aZ,hc as a_,va as aa,$u as ab,ya as ac,yc as ad,Dn as ae,uc as af,ds as ag,hs as ah,kn as ai,po as aj,Ye as ak,Vn as al,rn as am,zd as an,Be as ao,vn as ap,Bn as aq,Fo as ar,_e as as,Ma as at,Ea as au,yn as av,ba as aw,Sa as ax,Ri as ay,xa as az,lr as b,hn as b$,Tn as b0,Md as b1,Hl as b2,Kt as b3,Zd as b4,yo as b5,cc as b6,Ll as b7,Ci as b8,Df as b9,ks as bA,Ks as bB,ja as bC,xs as bD,tf as bE,Jd as bF,$d as bG,Kd as bH,bo as bI,pr as bJ,Fd as bK,Bd as bL,Ai as bM,mo as bN,cg as bO,yd as bP,gd as bQ,vd as bR,_d as bS,nf as bT,jd as bU,xo as bV,_o as bW,kd as bX,so as bY,ft as bZ,Gu as b_,Nf as ba,Uf as bb,Vd as bc,jg as bd,md as be,lc as bf,e_ as bg,jn as bh,Wg as bi,We as bj,Ms as bk,wo as bl,r_ as bm,Km as bn,nc as bo,uo as bp,jt as bq,Yu as br,qu as bs,xd as bt,So as bu,Kn as bv,od as bw,Qs as bx,Zl as by,ss as bz,vr as c,xu as c$,Ug as c0,Pi as c1,Dd as c2,oo as c3,ao as c4,us as c5,dr as c6,jl as c7,ro as c8,$l as c9,Jg as cA,xn as cB,Yl as cC,wf as cD,t_ as cE,Ku as cF,Co as cG,Ao as cH,zn as cI,Fa as cJ,Vs as cK,Ta as cL,Ia as cM,Ra as cN,Ws as cO,wa as cP,Pa as cQ,qa as cR,La as cS,Vg as cT,io as cU,_c as cV,Ad as cW,Td as cX,dg as cY,Mc as cZ,Eu as c_,Jl as ca,_u as cb,pn as cc,ac as cd,un as ce,or as cf,_m as cg,Fn as ch,ti as ci,ku as cj,zu as ck,Bu as cl,Hd as cm,ug as cn,vo as co,xr as cp,i_ as cq,Wu as cr,gr as cs,Do as ct,Lo as cu,bd as cv,Io as cw,Qg as cx,Yg as cy,Xg as cz,cr as d,Cd as d0,ig as d1,Sd as d2,ga as d3,zf as d4,Fl as d5,yi as d6,$f as d7,Yf as d8,vm as d9,xm as da,Ca as db,Ka as dc,Qa as dd,Ja as de,$a as df,Gs as dg,Hs as dh,tc as di,Ql as dj,Kl as dk,Za as dl,re as dm,Hu as dn,rg as e,mg as f,Q as g,fn as h,Sn as i,Ge as j,Me as k,a_ as l,Ef as m,Tf as n,zg as o,ys as p,Jn as q,Ap as r,we as s,Fg as t,Pe as u,Vu as v,fd as w,Te as x,Ss as y,ei as z};
3840
+ }`;class Vy{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){const n=new dc(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new fn({vertexShader:zy,fragmentShader:ky,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ye(new Ss(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Hy extends En{constructor(t,e){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,f=null,m=null;const _=typeof XRWebGLBinding<"u",g=new Vy,p={},y=e.getContextAttributes();let v=null,x=null;const A=[],T=[],R=new Q;let I=null;const b=new Te;b.viewport=new te;const S=new Te;S.viewport=new te;const L=[b,S],F=new af;let z=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let et=A[Y];return et===void 0&&(et=new pa,A[Y]=et),et.getTargetRaySpace()},this.getControllerGrip=function(Y){let et=A[Y];return et===void 0&&(et=new pa,A[Y]=et),et.getGripSpace()},this.getHand=function(Y){let et=A[Y];return et===void 0&&(et=new pa,A[Y]=et),et.getHandSpace()};function q(Y){const et=T.indexOf(Y.inputSource);if(et===-1)return;const yt=A[et];yt!==void 0&&(yt.update(Y.inputSource,Y.frame,c||a),yt.dispatchEvent({type:Y.type,data:Y.inputSource}))}function W(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",W),i.removeEventListener("inputsourceschange",nt);for(let Y=0;Y<A.length;Y++){const et=T[Y];et!==null&&(T[Y]=null,A[Y].disconnect(et))}z=null,G=null,g.reset();for(const Y in p)delete p[Y];t.setRenderTarget(v),f=null,d=null,u=null,i=null,x=null,Qt.stop(),n.isPresenting=!1,t.setPixelRatio(I),t.setSize(R.width,R.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u===null&&_&&(u=new XRWebGLBinding(i,e)),u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(v=t.getRenderTarget(),i.addEventListener("select",q),i.addEventListener("selectstart",q),i.addEventListener("selectend",q),i.addEventListener("squeeze",q),i.addEventListener("squeezestart",q),i.addEventListener("squeezeend",q),i.addEventListener("end",W),i.addEventListener("inputsourceschange",nt),y.xrCompatible!==!0&&await e.makeXRCompatible(),I=t.getPixelRatio(),t.getSize(R),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let yt=null,Pt=null,Tt=null;y.depth&&(Tt=y.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,yt=y.stencil?ds:us,Pt=y.stencil?hs:kn);const Zt={colorFormat:e.RGBA8,depthFormat:Tt,scaleFactor:s};u=this.getBinding(),d=u.createProjectionLayer(Zt),i.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),x=new bn(d.textureWidth,d.textureHeight,{format:Oe,type:dn,depthTexture:new uc(d.textureWidth,d.textureHeight,Pt,void 0,void 0,void 0,void 0,void 0,void 0,yt),stencilBuffer:y.stencil,colorSpace:t.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const yt={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,e,yt),i.updateRenderState({baseLayer:f}),t.setPixelRatio(1),t.setSize(f.framebufferWidth,f.framebufferHeight,!1),x=new bn(f.framebufferWidth,f.framebufferHeight,{format:Oe,type:dn,colorSpace:t.outputColorSpace,stencilBuffer:y.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),Qt.setContext(i),Qt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function nt(Y){for(let et=0;et<Y.removed.length;et++){const yt=Y.removed[et],Pt=T.indexOf(yt);Pt>=0&&(T[Pt]=null,A[Pt].disconnect(yt))}for(let et=0;et<Y.added.length;et++){const yt=Y.added[et];let Pt=T.indexOf(yt);if(Pt===-1){for(let Zt=0;Zt<A.length;Zt++)if(Zt>=T.length){T.push(yt),Pt=Zt;break}else if(T[Zt]===null){T[Zt]=yt,Pt=Zt;break}if(Pt===-1)break}const Tt=A[Pt];Tt&&Tt.connect(yt)}}const H=new C,ut=new C;function _t(Y,et,yt){H.setFromMatrixPosition(et.matrixWorld),ut.setFromMatrixPosition(yt.matrixWorld);const Pt=H.distanceTo(ut),Tt=et.projectionMatrix.elements,Zt=yt.projectionMatrix.elements,ce=Tt[14]/(Tt[10]-1),P=Tt[14]/(Tt[10]+1),tt=(Tt[9]+1)/Tt[5],$=(Tt[9]-1)/Tt[5],J=(Tt[8]-1)/Tt[0],Z=(Zt[8]+1)/Zt[0],ct=ce*J,it=ce*Z,ht=Pt/(-J+Z),kt=ht*-J;if(et.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(kt),Y.translateZ(ht),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Tt[10]===-1)Y.projectionMatrix.copy(et.projectionMatrix),Y.projectionMatrixInverse.copy(et.projectionMatrixInverse);else{const zt=ce+ht,w=P+ht,M=ct-kt,O=it+(Pt-kt),V=tt*P/w*zt,j=$*P/w*zt;Y.projectionMatrix.makePerspective(M,O,V,j,zt,w),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function St(Y,et){et===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(et.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;let et=Y.near,yt=Y.far;g.texture!==null&&(g.depthNear>0&&(et=g.depthNear),g.depthFar>0&&(yt=g.depthFar)),F.near=S.near=b.near=et,F.far=S.far=b.far=yt,(z!==F.near||G!==F.far)&&(i.updateRenderState({depthNear:F.near,depthFar:F.far}),z=F.near,G=F.far),F.layers.mask=Y.layers.mask|6,b.layers.mask=F.layers.mask&3,S.layers.mask=F.layers.mask&5;const Pt=Y.parent,Tt=F.cameras;St(F,Pt);for(let Zt=0;Zt<Tt.length;Zt++)St(Tt[Zt],Pt);Tt.length===2?_t(F,b,S):F.projectionMatrix.copy(b.projectionMatrix),Gt(Y,F,Pt)};function Gt(Y,et,yt){yt===null?Y.matrix.copy(et.matrixWorld):(Y.matrix.copy(yt.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(et.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(et.projectionMatrix),Y.projectionMatrixInverse.copy(et.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=ps*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(Y){l=Y,d!==null&&(d.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(F)},this.getCameraTexture=function(Y){return p[Y]};let $t=null;function se(Y,et){if(h=et.getViewerPose(c||a),m=et,h!==null){const yt=h.views;f!==null&&(t.setRenderTargetFramebuffer(x,f.framebuffer),t.setRenderTarget(x));let Pt=!1;yt.length!==F.cameras.length&&(F.cameras.length=0,Pt=!0);for(let P=0;P<yt.length;P++){const tt=yt[P];let $=null;if(f!==null)$=f.getViewport(tt);else{const Z=u.getViewSubImage(d,tt);$=Z.viewport,P===0&&(t.setRenderTargetTextures(x,Z.colorTexture,Z.depthStencilTexture),t.setRenderTarget(x))}let J=L[P];J===void 0&&(J=new Te,J.layers.enable(P),J.viewport=new te,L[P]=J),J.matrix.fromArray(tt.transform.matrix),J.matrix.decompose(J.position,J.quaternion,J.scale),J.projectionMatrix.fromArray(tt.projectionMatrix),J.projectionMatrixInverse.copy(J.projectionMatrix).invert(),J.viewport.set($.x,$.y,$.width,$.height),P===0&&(F.matrix.copy(J.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),Pt===!0&&F.cameras.push(J)}const Tt=i.enabledFeatures;if(Tt&&Tt.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){u=n.getBinding();const P=u.getDepthInformation(yt[0]);P&&P.isValid&&P.texture&&g.init(P,i.renderState)}if(Tt&&Tt.includes("camera-access")&&_){t.state.unbindTexture(),u=n.getBinding();for(let P=0;P<yt.length;P++){const tt=yt[P].camera;if(tt){let $=p[tt];$||($=new dc,p[tt]=$);const J=u.getCameraImage(tt);$.sourceTexture=J}}}}for(let yt=0;yt<A.length;yt++){const Pt=T[yt],Tt=A[yt];Pt!==null&&Tt!==void 0&&Tt.update(Pt,et,c||a)}$t&&$t(Y,et),et.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:et}),m=null}const Qt=new df;Qt.setAnimationLoop(se),this.setAnimationLoop=function(Y){$t=Y},this.dispose=function(){}}}const vi=new tn,Gy=new Ot;function Wy(r,t){function e(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function n(g,p){p.color.getRGB(g.fogColor.value,cd(r)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function i(g,p,y,v,x){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(g,p):p.isMeshToonMaterial?(s(g,p),u(g,p)):p.isMeshPhongMaterial?(s(g,p),h(g,p)):p.isMeshStandardMaterial?(s(g,p),d(g,p),p.isMeshPhysicalMaterial&&f(g,p,x)):p.isMeshMatcapMaterial?(s(g,p),m(g,p)):p.isMeshDepthMaterial?s(g,p):p.isMeshDistanceMaterial?(s(g,p),_(g,p)):p.isMeshNormalMaterial?s(g,p):p.isLineBasicMaterial?(a(g,p),p.isLineDashedMaterial&&o(g,p)):p.isPointsMaterial?l(g,p,y,v):p.isSpriteMaterial?c(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,e(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===Be&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,e(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===Be&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,e(p.displacementMap,g.displacementMapTransform),g.displacementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,e(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const y=t.get(p),v=y.envMap,x=y.envMapRotation;v&&(g.envMap.value=v,vi.copy(x),vi.x*=-1,vi.y*=-1,vi.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(vi.y*=-1,vi.z*=-1),g.envMapRotation.value.setFromMatrix4(Gy.makeRotationFromEuler(vi)),g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,y,v){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*y,g.scale.value=v*.5,p.map&&(g.map.value=p.map,e(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,y){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Be&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const y=t.get(p).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Xy(r,t,e,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,v){const x=v.program;n.uniformBlockBinding(y,x)}function c(y,v){let x=i[y.id];x===void 0&&(m(y),x=h(y),i[y.id]=x,y.addEventListener("dispose",g));const A=v.program;n.updateUBOMapping(y,A);const T=t.render.frame;s[y.id]!==T&&(d(y),s[y.id]=T)}function h(y){const v=u();y.__bindingPointIndex=v;const x=r.createBuffer(),A=y.__size,T=y.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,A,T),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,v,x),x}function u(){for(let y=0;y<o;y++)if(a.indexOf(y)===-1)return a.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const v=i[y.id],x=y.uniforms,A=y.__cache;r.bindBuffer(r.UNIFORM_BUFFER,v);for(let T=0,R=x.length;T<R;T++){const I=Array.isArray(x[T])?x[T]:[x[T]];for(let b=0,S=I.length;b<S;b++){const L=I[b];if(f(L,T,b,A)===!0){const F=L.__offset,z=Array.isArray(L.value)?L.value:[L.value];let G=0;for(let q=0;q<z.length;q++){const W=z[q],nt=_(W);typeof W=="number"||typeof W=="boolean"?(L.__data[0]=W,r.bufferSubData(r.UNIFORM_BUFFER,F+G,L.__data)):W.isMatrix3?(L.__data[0]=W.elements[0],L.__data[1]=W.elements[1],L.__data[2]=W.elements[2],L.__data[3]=0,L.__data[4]=W.elements[3],L.__data[5]=W.elements[4],L.__data[6]=W.elements[5],L.__data[7]=0,L.__data[8]=W.elements[6],L.__data[9]=W.elements[7],L.__data[10]=W.elements[8],L.__data[11]=0):(W.toArray(L.__data,G),G+=nt.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,F,L.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(y,v,x,A){const T=y.value,R=v+"_"+x;if(A[R]===void 0)return typeof T=="number"||typeof T=="boolean"?A[R]=T:A[R]=T.clone(),!0;{const I=A[R];if(typeof T=="number"||typeof T=="boolean"){if(I!==T)return A[R]=T,!0}else if(I.equals(T)===!1)return I.copy(T),!0}return!1}function m(y){const v=y.uniforms;let x=0;const A=16;for(let R=0,I=v.length;R<I;R++){const b=Array.isArray(v[R])?v[R]:[v[R]];for(let S=0,L=b.length;S<L;S++){const F=b[S],z=Array.isArray(F.value)?F.value:[F.value];for(let G=0,q=z.length;G<q;G++){const W=z[G],nt=_(W),H=x%A,ut=H%nt.boundary,_t=H+ut;x+=ut,_t!==0&&A-_t<nt.storage&&(x+=A-_t),F.__data=new Float32Array(nt.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=x,x+=nt.storage}}}const T=x%A;return T>0&&(x+=A-T),y.__size=x,y.__cache={},this}function _(y){const v={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(v.boundary=4,v.storage=4):y.isVector2?(v.boundary=8,v.storage=8):y.isVector3||y.isColor?(v.boundary=16,v.storage=12):y.isVector4?(v.boundary=16,v.storage=16):y.isMatrix3?(v.boundary=48,v.storage=48):y.isMatrix4?(v.boundary=64,v.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),v}function g(y){const v=y.target;v.removeEventListener("dispose",g);const x=a.indexOf(v.__bindingPointIndex);a.splice(x,1),r.deleteBuffer(i[v.id]),delete i[v.id],delete s[v.id]}function p(){for(const y in i)r.deleteBuffer(i[y]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}class qy{constructor(t={}){const{canvas:e=ad(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1}=t;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const m=new Uint32Array(4),_=new Int32Array(4);let g=null,p=null;const y=[],v=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Fn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const x=this;let A=!1;this._outputColorSpace=Ge;let T=0,R=0,I=null,b=-1,S=null;const L=new te,F=new te;let z=null;const G=new xt(0);let q=0,W=e.width,nt=e.height,H=1,ut=null,_t=null;const St=new te(0,0,W,nt),Gt=new te(0,0,W,nt);let $t=!1;const se=new Ms;let Qt=!1,Y=!1;const et=new Ot,yt=new C,Pt=new te,Tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Zt=!1;function ce(){return I===null?H:1}let P=n;function tt(E,U){return e.getContext(E,U)}try{const E={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r180"),e.addEventListener("webglcontextlost",dt,!1),e.addEventListener("webglcontextrestored",bt,!1),e.addEventListener("webglcontextcreationerror",rt,!1),P===null){const U="webgl2";if(P=tt(U,E),P===null)throw tt(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let $,J,Z,ct,it,ht,kt,zt,w,M,O,V,j,X,Rt,lt,At,wt,st,gt,Ft,It,pt,qt;function D(){$=new iv(P),$.init(),It=new _f(P,$),J=new $x(P,$,t,It),Z=new Oy(P,$),J.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),ct=new av(P),it=new Ey,ht=new By(P,$,Z,it,J,It,ct),kt=new Qx(x),zt=new nv(x),w=new d_(P),pt=new Zx(P,w),M=new sv(P,w,ct,pt),O=new lv(P,M,w,ct),st=new ov(P,J,ht),lt=new Kx(it),V=new by(x,kt,zt,$,J,pt,lt),j=new Wy(x,it),X=new Ay,Rt=new Ly($),wt=new Yx(x,kt,zt,Z,O,f,l),At=new Ny(x,O,J),qt=new Xy(P,ct,J,Z),gt=new Jx(P,$,ct),Ft=new rv(P,$,ct),ct.programs=V.programs,x.capabilities=J,x.extensions=$,x.properties=it,x.renderLists=X,x.shadowMap=At,x.state=Z,x.info=ct}D();const ot=new Hy(x,P);this.xr=ot,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const E=$.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=$.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(E){E!==void 0&&(H=E,this.setSize(W,nt,!1))},this.getSize=function(E){return E.set(W,nt)},this.setSize=function(E,U,B=!0){if(ot.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=E,nt=U,e.width=Math.floor(E*H),e.height=Math.floor(U*H),B===!0&&(e.style.width=E+"px",e.style.height=U+"px"),this.setViewport(0,0,E,U)},this.getDrawingBufferSize=function(E){return E.set(W*H,nt*H).floor()},this.setDrawingBufferSize=function(E,U,B){W=E,nt=U,H=B,e.width=Math.floor(E*B),e.height=Math.floor(U*B),this.setViewport(0,0,E,U)},this.getCurrentViewport=function(E){return E.copy(L)},this.getViewport=function(E){return E.copy(St)},this.setViewport=function(E,U,B,k){E.isVector4?St.set(E.x,E.y,E.z,E.w):St.set(E,U,B,k),Z.viewport(L.copy(St).multiplyScalar(H).round())},this.getScissor=function(E){return E.copy(Gt)},this.setScissor=function(E,U,B,k){E.isVector4?Gt.set(E.x,E.y,E.z,E.w):Gt.set(E,U,B,k),Z.scissor(F.copy(Gt).multiplyScalar(H).round())},this.getScissorTest=function(){return $t},this.setScissorTest=function(E){Z.setScissorTest($t=E)},this.setOpaqueSort=function(E){ut=E},this.setTransparentSort=function(E){_t=E},this.getClearColor=function(E){return E.copy(wt.getClearColor())},this.setClearColor=function(){wt.setClearColor(...arguments)},this.getClearAlpha=function(){return wt.getClearAlpha()},this.setClearAlpha=function(){wt.setClearAlpha(...arguments)},this.clear=function(E=!0,U=!0,B=!0){let k=0;if(E){let N=!1;if(I!==null){const at=I.texture.format;N=at===ho||at===co||at===dr}if(N){const at=I.texture.type,mt=at===dn||at===kn||at===cs||at===hs||at===ao||at===oo,Et=wt.getClearColor(),vt=wt.getClearAlpha(),Ut=Et.r,Bt=Et.g,Lt=Et.b;mt?(m[0]=Ut,m[1]=Bt,m[2]=Lt,m[3]=vt,P.clearBufferuiv(P.COLOR,0,m)):(_[0]=Ut,_[1]=Bt,_[2]=Lt,_[3]=vt,P.clearBufferiv(P.COLOR,0,_))}else k|=P.COLOR_BUFFER_BIT}U&&(k|=P.DEPTH_BUFFER_BIT),B&&(k|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(k)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",dt,!1),e.removeEventListener("webglcontextrestored",bt,!1),e.removeEventListener("webglcontextcreationerror",rt,!1),wt.dispose(),X.dispose(),Rt.dispose(),it.dispose(),kt.dispose(),zt.dispose(),O.dispose(),pt.dispose(),qt.dispose(),V.dispose(),ot.dispose(),ot.removeEventListener("sessionstart",mn),ot.removeEventListener("sessionend",Dc),si.stop()};function dt(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),A=!0}function bt(){console.log("THREE.WebGLRenderer: Context Restored."),A=!1;const E=ct.autoReset,U=At.enabled,B=At.autoUpdate,k=At.needsUpdate,N=At.type;D(),ct.autoReset=E,At.enabled=U,At.autoUpdate=B,At.needsUpdate=k,At.type=N}function rt(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function K(E){const U=E.target;U.removeEventListener("dispose",K),Ct(U)}function Ct(E){Vt(E),it.remove(E)}function Vt(E){const U=it.get(E).programs;U!==void 0&&(U.forEach(function(B){V.releaseProgram(B)}),E.isShaderMaterial&&V.releaseShaderCache(E))}this.renderBufferDirect=function(E,U,B,k,N,at){U===null&&(U=Tt);const mt=N.isMesh&&N.matrixWorld.determinant()<0,Et=xf(E,U,B,k,N);Z.setMaterial(k,mt);let vt=B.index,Ut=1;if(k.wireframe===!0){if(vt=M.getWireframeAttribute(B),vt===void 0)return;Ut=2}const Bt=B.drawRange,Lt=B.attributes.position;let Jt=Bt.start*Ut,ae=(Bt.start+Bt.count)*Ut;at!==null&&(Jt=Math.max(Jt,at.start*Ut),ae=Math.min(ae,(at.start+at.count)*Ut)),vt!==null?(Jt=Math.max(Jt,0),ae=Math.min(ae,vt.count)):Lt!=null&&(Jt=Math.max(Jt,0),ae=Math.min(ae,Lt.count));const me=ae-Jt;if(me<0||me===1/0)return;pt.setup(N,k,Et,B,vt);let ue,le=gt;if(vt!==null&&(ue=w.get(vt),le=Ft,le.setIndex(ue)),N.isMesh)k.wireframe===!0?(Z.setLineWidth(k.wireframeLinewidth*ce()),le.setMode(P.LINES)):le.setMode(P.TRIANGLES);else if(N.isLine){let Dt=k.linewidth;Dt===void 0&&(Dt=1),Z.setLineWidth(Dt*ce()),N.isLineSegments?le.setMode(P.LINES):N.isLineLoop?le.setMode(P.LINE_LOOP):le.setMode(P.LINE_STRIP)}else N.isPoints?le.setMode(P.POINTS):N.isSprite&&le.setMode(P.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)ir("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),le.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if($.get("WEBGL_multi_draw"))le.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const Dt=N._multiDrawStarts,de=N._multiDrawCounts,ne=N._multiDrawCount,Ze=vt?w.get(vt).bytesPerElement:1,Fi=it.get(k).currentProgram.getUniforms();for(let Je=0;Je<ne;Je++)Fi.setValue(P,"_gl_DrawID",Je),le.render(Dt[Je]/Ze,de[Je])}else if(N.isInstancedMesh)le.renderInstances(Jt,me,N.count);else if(B.isInstancedBufferGeometry){const Dt=B._maxInstanceCount!==void 0?B._maxInstanceCount:1/0,de=Math.min(B.instanceCount,Dt);le.renderInstances(Jt,me,de)}else le.render(Jt,me)};function he(E,U,B){E.transparent===!0&&E.side===vn&&E.forceSinglePass===!1?(E.side=Be,E.needsUpdate=!0,Mr(E,U,B),E.side=Bn,E.needsUpdate=!0,Mr(E,U,B),E.side=vn):Mr(E,U,B)}this.compile=function(E,U,B=null){B===null&&(B=E),p=Rt.get(B),p.init(U),v.push(p),B.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),E!==B&&E.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),p.setupLights();const k=new Set;return E.traverse(function(N){if(!(N.isMesh||N.isPoints||N.isLine||N.isSprite))return;const at=N.material;if(at)if(Array.isArray(at))for(let mt=0;mt<at.length;mt++){const Et=at[mt];he(Et,B,N),k.add(Et)}else he(at,B,N),k.add(at)}),p=v.pop(),k},this.compileAsync=function(E,U,B=null){const k=this.compile(E,U,B);return new Promise(N=>{function at(){if(k.forEach(function(mt){it.get(mt).currentProgram.isReady()&&k.delete(mt)}),k.size===0){N(E);return}setTimeout(at,10)}$.get("KHR_parallel_shader_compile")!==null?at():setTimeout(at,10)})};let ie=null;function An(E){ie&&ie(E)}function mn(){si.stop()}function Dc(){si.start()}const si=new df;si.setAnimationLoop(An),typeof self<"u"&&si.setContext(self),this.setAnimationLoop=function(E){ie=E,ot.setAnimationLoop(E),E===null?si.stop():si.start()},ot.addEventListener("sessionstart",mn),ot.addEventListener("sessionend",Dc),this.render=function(E,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),ot.enabled===!0&&ot.isPresenting===!0&&(ot.cameraAutoUpdate===!0&&ot.updateCamera(U),U=ot.getCamera()),E.isScene===!0&&E.onBeforeRender(x,E,U,I),p=Rt.get(E,v.length),p.init(U),v.push(p),et.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),se.setFromProjectionMatrix(et,Qe,U.reversedDepth),Y=this.localClippingEnabled,Qt=lt.init(this.clippingPlanes,Y),g=X.get(E,y.length),g.init(),y.push(g),ot.enabled===!0&&ot.isPresenting===!0){const at=x.xr.getDepthSensingMesh();at!==null&&zo(at,U,-1/0,x.sortObjects)}zo(E,U,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(ut,_t),Zt=ot.enabled===!1||ot.isPresenting===!1||ot.hasDepthSensing()===!1,Zt&&wt.addToRenderList(g,E),this.info.render.frame++,Qt===!0&&lt.beginShadows();const B=p.state.shadowsArray;At.render(B,E,U),Qt===!0&&lt.endShadows(),this.info.autoReset===!0&&this.info.reset();const k=g.opaque,N=g.transmissive;if(p.setupLights(),U.isArrayCamera){const at=U.cameras;if(N.length>0)for(let mt=0,Et=at.length;mt<Et;mt++){const vt=at[mt];Nc(k,N,E,vt)}Zt&&wt.render(E);for(let mt=0,Et=at.length;mt<Et;mt++){const vt=at[mt];Uc(g,E,vt,vt.viewport)}}else N.length>0&&Nc(k,N,E,U),Zt&&wt.render(E),Uc(g,E,U);I!==null&&R===0&&(ht.updateMultisampleRenderTarget(I),ht.updateRenderTargetMipmap(I)),E.isScene===!0&&E.onAfterRender(x,E,U),pt.resetDefaultState(),b=-1,S=null,v.pop(),v.length>0?(p=v[v.length-1],Qt===!0&&lt.setGlobalState(x.clippingPlanes,p.state.camera)):p=null,y.pop(),y.length>0?g=y[y.length-1]:g=null};function zo(E,U,B,k){if(E.visible===!1)return;if(E.layers.test(U.layers)){if(E.isGroup)B=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(U);else if(E.isLight)p.pushLight(E),E.castShadow&&p.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||se.intersectsSprite(E)){k&&Pt.setFromMatrixPosition(E.matrixWorld).applyMatrix4(et);const mt=O.update(E),Et=E.material;Et.visible&&g.push(E,mt,Et,B,Pt.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||se.intersectsObject(E))){const mt=O.update(E),Et=E.material;if(k&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Pt.copy(E.boundingSphere.center)):(mt.boundingSphere===null&&mt.computeBoundingSphere(),Pt.copy(mt.boundingSphere.center)),Pt.applyMatrix4(E.matrixWorld).applyMatrix4(et)),Array.isArray(Et)){const vt=mt.groups;for(let Ut=0,Bt=vt.length;Ut<Bt;Ut++){const Lt=vt[Ut],Jt=Et[Lt.materialIndex];Jt&&Jt.visible&&g.push(E,mt,Jt,B,Pt.z,Lt)}}else Et.visible&&g.push(E,mt,Et,B,Pt.z,null)}}const at=E.children;for(let mt=0,Et=at.length;mt<Et;mt++)zo(at[mt],U,B,k)}function Uc(E,U,B,k){const N=E.opaque,at=E.transmissive,mt=E.transparent;p.setupLightsView(B),Qt===!0&&lt.setGlobalState(x.clippingPlanes,B),k&&Z.viewport(L.copy(k)),N.length>0&&yr(N,U,B),at.length>0&&yr(at,U,B),mt.length>0&&yr(mt,U,B),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Nc(E,U,B,k){if((B.isScene===!0?B.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[k.id]===void 0&&(p.state.transmissionRenderTarget[k.id]=new bn(1,1,{generateMipmaps:!0,type:$.has("EXT_color_buffer_half_float")||$.has("EXT_color_buffer_float")?vs:dn,minFilter:yn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace}));const at=p.state.transmissionRenderTarget[k.id],mt=k.viewport||L;at.setSize(mt.z*x.transmissionResolutionScale,mt.w*x.transmissionResolutionScale);const Et=x.getRenderTarget(),vt=x.getActiveCubeFace(),Ut=x.getActiveMipmapLevel();x.setRenderTarget(at),x.getClearColor(G),q=x.getClearAlpha(),q<1&&x.setClearColor(16777215,.5),x.clear(),Zt&&wt.render(B);const Bt=x.toneMapping;x.toneMapping=Fn;const Lt=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),p.setupLightsView(k),Qt===!0&&lt.setGlobalState(x.clippingPlanes,k),yr(E,B,k),ht.updateMultisampleRenderTarget(at),ht.updateRenderTargetMipmap(at),$.has("WEBGL_multisampled_render_to_texture")===!1){let Jt=!1;for(let ae=0,me=U.length;ae<me;ae++){const ue=U[ae],le=ue.object,Dt=ue.geometry,de=ue.material,ne=ue.group;if(de.side===vn&&le.layers.test(k.layers)){const Ze=de.side;de.side=Be,de.needsUpdate=!0,Fc(le,B,k,Dt,de,ne),de.side=Ze,de.needsUpdate=!0,Jt=!0}}Jt===!0&&(ht.updateMultisampleRenderTarget(at),ht.updateRenderTargetMipmap(at))}x.setRenderTarget(Et,vt,Ut),x.setClearColor(G,q),Lt!==void 0&&(k.viewport=Lt),x.toneMapping=Bt}function yr(E,U,B){const k=U.isScene===!0?U.overrideMaterial:null;for(let N=0,at=E.length;N<at;N++){const mt=E[N],Et=mt.object,vt=mt.geometry,Ut=mt.group;let Bt=mt.material;Bt.allowOverride===!0&&k!==null&&(Bt=k),Et.layers.test(B.layers)&&Fc(Et,U,B,vt,Bt,Ut)}}function Fc(E,U,B,k,N,at){E.onBeforeRender(x,U,B,k,N,at),E.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),N.onBeforeRender(x,U,B,k,E,at),N.transparent===!0&&N.side===vn&&N.forceSinglePass===!1?(N.side=Be,N.needsUpdate=!0,x.renderBufferDirect(B,U,k,N,E,at),N.side=Bn,N.needsUpdate=!0,x.renderBufferDirect(B,U,k,N,E,at),N.side=vn):x.renderBufferDirect(B,U,k,N,E,at),E.onAfterRender(x,U,B,k,N,at)}function Mr(E,U,B){U.isScene!==!0&&(U=Tt);const k=it.get(E),N=p.state.lights,at=p.state.shadowsArray,mt=N.state.version,Et=V.getParameters(E,N.state,at,U,B),vt=V.getProgramCacheKey(Et);let Ut=k.programs;k.environment=E.isMeshStandardMaterial?U.environment:null,k.fog=U.fog,k.envMap=(E.isMeshStandardMaterial?zt:kt).get(E.envMap||k.environment),k.envMapRotation=k.environment!==null&&E.envMap===null?U.environmentRotation:E.envMapRotation,Ut===void 0&&(E.addEventListener("dispose",K),Ut=new Map,k.programs=Ut);let Bt=Ut.get(vt);if(Bt!==void 0){if(k.currentProgram===Bt&&k.lightsStateVersion===mt)return Bc(E,Et),Bt}else Et.uniforms=V.getUniforms(E),E.onBeforeCompile(Et,x),Bt=V.acquireProgram(Et,vt),Ut.set(vt,Bt),k.uniforms=Et.uniforms;const Lt=k.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Lt.clippingPlanes=lt.uniform),Bc(E,Et),k.needsLights=yf(E),k.lightsStateVersion=mt,k.needsLights&&(Lt.ambientLightColor.value=N.state.ambient,Lt.lightProbe.value=N.state.probe,Lt.directionalLights.value=N.state.directional,Lt.directionalLightShadows.value=N.state.directionalShadow,Lt.spotLights.value=N.state.spot,Lt.spotLightShadows.value=N.state.spotShadow,Lt.rectAreaLights.value=N.state.rectArea,Lt.ltc_1.value=N.state.rectAreaLTC1,Lt.ltc_2.value=N.state.rectAreaLTC2,Lt.pointLights.value=N.state.point,Lt.pointLightShadows.value=N.state.pointShadow,Lt.hemisphereLights.value=N.state.hemi,Lt.directionalShadowMap.value=N.state.directionalShadowMap,Lt.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Lt.spotShadowMap.value=N.state.spotShadowMap,Lt.spotLightMatrix.value=N.state.spotLightMatrix,Lt.spotLightMap.value=N.state.spotLightMap,Lt.pointShadowMap.value=N.state.pointShadowMap,Lt.pointShadowMatrix.value=N.state.pointShadowMatrix),k.currentProgram=Bt,k.uniformsList=null,Bt}function Oc(E){if(E.uniformsList===null){const U=E.currentProgram.getUniforms();E.uniformsList=ma.seqWithValue(U.seq,E.uniforms)}return E.uniformsList}function Bc(E,U){const B=it.get(E);B.outputColorSpace=U.outputColorSpace,B.batching=U.batching,B.batchingColor=U.batchingColor,B.instancing=U.instancing,B.instancingColor=U.instancingColor,B.instancingMorph=U.instancingMorph,B.skinning=U.skinning,B.morphTargets=U.morphTargets,B.morphNormals=U.morphNormals,B.morphColors=U.morphColors,B.morphTargetsCount=U.morphTargetsCount,B.numClippingPlanes=U.numClippingPlanes,B.numIntersection=U.numClipIntersection,B.vertexAlphas=U.vertexAlphas,B.vertexTangents=U.vertexTangents,B.toneMapping=U.toneMapping}function xf(E,U,B,k,N){U.isScene!==!0&&(U=Tt),ht.resetTextureUnits();const at=U.fog,mt=k.isMeshStandardMaterial?U.environment:null,Et=I===null?x.outputColorSpace:I.isXRRenderTarget===!0?I.texture.colorSpace:Ii,vt=(k.isMeshStandardMaterial?zt:kt).get(k.envMap||mt),Ut=k.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,Bt=!!B.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Lt=!!B.morphAttributes.position,Jt=!!B.morphAttributes.normal,ae=!!B.morphAttributes.color;let me=Fn;k.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(me=x.toneMapping);const ue=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,le=ue!==void 0?ue.length:0,Dt=it.get(k),de=p.state.lights;if(Qt===!0&&(Y===!0||E!==S)){const De=E===S&&k.id===b;lt.setState(k,E,De)}let ne=!1;k.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==de.state.version||Dt.outputColorSpace!==Et||N.isBatchedMesh&&Dt.batching===!1||!N.isBatchedMesh&&Dt.batching===!0||N.isBatchedMesh&&Dt.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&Dt.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&Dt.instancing===!1||!N.isInstancedMesh&&Dt.instancing===!0||N.isSkinnedMesh&&Dt.skinning===!1||!N.isSkinnedMesh&&Dt.skinning===!0||N.isInstancedMesh&&Dt.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Dt.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&Dt.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&Dt.instancingMorph===!1&&N.morphTexture!==null||Dt.envMap!==vt||k.fog===!0&&Dt.fog!==at||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==lt.numPlanes||Dt.numIntersection!==lt.numIntersection)||Dt.vertexAlphas!==Ut||Dt.vertexTangents!==Bt||Dt.morphTargets!==Lt||Dt.morphNormals!==Jt||Dt.morphColors!==ae||Dt.toneMapping!==me||Dt.morphTargetsCount!==le)&&(ne=!0):(ne=!0,Dt.__version=k.version);let Ze=Dt.currentProgram;ne===!0&&(Ze=Mr(k,U,N));let Fi=!1,Je=!1,Es=!1;const fe=Ze.getUniforms(),en=Dt.uniforms;if(Z.useProgram(Ze.program)&&(Fi=!0,Je=!0,Es=!0),k.id!==b&&(b=k.id,Je=!0),Fi||S!==E){Z.buffers.depth.getReversed()&&E.reversedDepth!==!0&&(E._reversedDepth=!0,E.updateProjectionMatrix()),fe.setValue(P,"projectionMatrix",E.projectionMatrix),fe.setValue(P,"viewMatrix",E.matrixWorldInverse);const ke=fe.map.cameraPosition;ke!==void 0&&ke.setValue(P,yt.setFromMatrixPosition(E.matrixWorld)),J.logarithmicDepthBuffer&&fe.setValue(P,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&fe.setValue(P,"isOrthographic",E.isOrthographicCamera===!0),S!==E&&(S=E,Je=!0,Es=!0)}if(N.isSkinnedMesh){fe.setOptional(P,N,"bindMatrix"),fe.setOptional(P,N,"bindMatrixInverse");const De=N.skeleton;De&&(De.boneTexture===null&&De.computeBoneTexture(),fe.setValue(P,"boneTexture",De.boneTexture,ht))}N.isBatchedMesh&&(fe.setOptional(P,N,"batchingTexture"),fe.setValue(P,"batchingTexture",N._matricesTexture,ht),fe.setOptional(P,N,"batchingIdTexture"),fe.setValue(P,"batchingIdTexture",N._indirectTexture,ht),fe.setOptional(P,N,"batchingColorTexture"),N._colorsTexture!==null&&fe.setValue(P,"batchingColorTexture",N._colorsTexture,ht));const nn=B.morphAttributes;if((nn.position!==void 0||nn.normal!==void 0||nn.color!==void 0)&&st.update(N,B,Ze),(Je||Dt.receiveShadow!==N.receiveShadow)&&(Dt.receiveShadow=N.receiveShadow,fe.setValue(P,"receiveShadow",N.receiveShadow)),k.isMeshGouraudMaterial&&k.envMap!==null&&(en.envMap.value=vt,en.flipEnvMap.value=vt.isCubeTexture&&vt.isRenderTargetTexture===!1?-1:1),k.isMeshStandardMaterial&&k.envMap===null&&U.environment!==null&&(en.envMapIntensity.value=U.environmentIntensity),Je&&(fe.setValue(P,"toneMappingExposure",x.toneMappingExposure),Dt.needsLights&&vf(en,Es),at&&k.fog===!0&&j.refreshFogUniforms(en,at),j.refreshMaterialUniforms(en,k,H,nt,p.state.transmissionRenderTarget[E.id]),ma.upload(P,Oc(Dt),en,ht)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(ma.upload(P,Oc(Dt),en,ht),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&fe.setValue(P,"center",N.center),fe.setValue(P,"modelViewMatrix",N.modelViewMatrix),fe.setValue(P,"normalMatrix",N.normalMatrix),fe.setValue(P,"modelMatrix",N.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const De=k.uniformsGroups;for(let ke=0,ko=De.length;ke<ko;ke++){const ri=De[ke];qt.update(ri,Ze),qt.bind(ri,Ze)}}return Ze}function vf(E,U){E.ambientLightColor.needsUpdate=U,E.lightProbe.needsUpdate=U,E.directionalLights.needsUpdate=U,E.directionalLightShadows.needsUpdate=U,E.pointLights.needsUpdate=U,E.pointLightShadows.needsUpdate=U,E.spotLights.needsUpdate=U,E.spotLightShadows.needsUpdate=U,E.rectAreaLights.needsUpdate=U,E.hemisphereLights.needsUpdate=U}function yf(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(E,U,B){const k=it.get(E);k.__autoAllocateDepthBuffer=E.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1&&(k.__useRenderToTexture=!1),it.get(E.texture).__webglTexture=U,it.get(E.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:B,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(E,U){const B=it.get(E);B.__webglFramebuffer=U,B.__useDefaultFramebuffer=U===void 0};const Mf=P.createFramebuffer();this.setRenderTarget=function(E,U=0,B=0){I=E,T=U,R=B;let k=!0,N=null,at=!1,mt=!1;if(E){const vt=it.get(E);if(vt.__useDefaultFramebuffer!==void 0)Z.bindFramebuffer(P.FRAMEBUFFER,null),k=!1;else if(vt.__webglFramebuffer===void 0)ht.setupRenderTarget(E);else if(vt.__hasExternalTextures)ht.rebindTextures(E,it.get(E.texture).__webglTexture,it.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const Lt=E.depthTexture;if(vt.__boundDepthTexture!==Lt){if(Lt!==null&&it.has(Lt)&&(E.width!==Lt.image.width||E.height!==Lt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ht.setupDepthRenderbuffer(E)}}const Ut=E.texture;(Ut.isData3DTexture||Ut.isDataArrayTexture||Ut.isCompressedArrayTexture)&&(mt=!0);const Bt=it.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(Bt[U])?N=Bt[U][B]:N=Bt[U],at=!0):E.samples>0&&ht.useMultisampledRTT(E)===!1?N=it.get(E).__webglMultisampledFramebuffer:Array.isArray(Bt)?N=Bt[B]:N=Bt,L.copy(E.viewport),F.copy(E.scissor),z=E.scissorTest}else L.copy(St).multiplyScalar(H).floor(),F.copy(Gt).multiplyScalar(H).floor(),z=$t;if(B!==0&&(N=Mf),Z.bindFramebuffer(P.FRAMEBUFFER,N)&&k&&Z.drawBuffers(E,N),Z.viewport(L),Z.scissor(F),Z.setScissorTest(z),at){const vt=it.get(E.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+U,vt.__webglTexture,B)}else if(mt){const vt=U;for(let Ut=0;Ut<E.textures.length;Ut++){const Bt=it.get(E.textures[Ut]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+Ut,Bt.__webglTexture,B,vt)}}else if(E!==null&&B!==0){const vt=it.get(E.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,vt.__webglTexture,B)}b=-1},this.readRenderTargetPixels=function(E,U,B,k,N,at,mt,Et=0){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let vt=it.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&mt!==void 0&&(vt=vt[mt]),vt){Z.bindFramebuffer(P.FRAMEBUFFER,vt);try{const Ut=E.textures[Et],Bt=Ut.format,Lt=Ut.type;if(!J.textureFormatReadable(Bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!J.textureTypeReadable(Lt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=E.width-k&&B>=0&&B<=E.height-N&&(E.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+Et),P.readPixels(U,B,k,N,It.convert(Bt),It.convert(Lt),at))}finally{const Ut=I!==null?it.get(I).__webglFramebuffer:null;Z.bindFramebuffer(P.FRAMEBUFFER,Ut)}}},this.readRenderTargetPixelsAsync=async function(E,U,B,k,N,at,mt,Et=0){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let vt=it.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&mt!==void 0&&(vt=vt[mt]),vt)if(U>=0&&U<=E.width-k&&B>=0&&B<=E.height-N){Z.bindFramebuffer(P.FRAMEBUFFER,vt);const Ut=E.textures[Et],Bt=Ut.format,Lt=Ut.type;if(!J.textureFormatReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!J.textureTypeReadable(Lt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Jt=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,Jt),P.bufferData(P.PIXEL_PACK_BUFFER,at.byteLength,P.STREAM_READ),E.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+Et),P.readPixels(U,B,k,N,It.convert(Bt),It.convert(Lt),0);const ae=I!==null?it.get(I).__webglFramebuffer:null;Z.bindFramebuffer(P.FRAMEBUFFER,ae);const me=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Cp(P,me,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,Jt),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,at),P.deleteBuffer(Jt),P.deleteSync(me),at}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(E,U=null,B=0){const k=Math.pow(2,-B),N=Math.floor(E.image.width*k),at=Math.floor(E.image.height*k),mt=U!==null?U.x:0,Et=U!==null?U.y:0;ht.setTexture2D(E,0),P.copyTexSubImage2D(P.TEXTURE_2D,B,0,0,mt,Et,N,at),Z.unbindTexture()};const Sf=P.createFramebuffer(),bf=P.createFramebuffer();this.copyTextureToTexture=function(E,U,B=null,k=null,N=0,at=null){at===null&&(N!==0?(ir("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),at=N,N=0):at=0);let mt,Et,vt,Ut,Bt,Lt,Jt,ae,me;const ue=E.isCompressedTexture?E.mipmaps[at]:E.image;if(B!==null)mt=B.max.x-B.min.x,Et=B.max.y-B.min.y,vt=B.isBox3?B.max.z-B.min.z:1,Ut=B.min.x,Bt=B.min.y,Lt=B.isBox3?B.min.z:0;else{const nn=Math.pow(2,-N);mt=Math.floor(ue.width*nn),Et=Math.floor(ue.height*nn),E.isDataArrayTexture?vt=ue.depth:E.isData3DTexture?vt=Math.floor(ue.depth*nn):vt=1,Ut=0,Bt=0,Lt=0}k!==null?(Jt=k.x,ae=k.y,me=k.z):(Jt=0,ae=0,me=0);const le=It.convert(U.format),Dt=It.convert(U.type);let de;U.isData3DTexture?(ht.setTexture3D(U,0),de=P.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?(ht.setTexture2DArray(U,0),de=P.TEXTURE_2D_ARRAY):(ht.setTexture2D(U,0),de=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,U.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,U.unpackAlignment);const ne=P.getParameter(P.UNPACK_ROW_LENGTH),Ze=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Fi=P.getParameter(P.UNPACK_SKIP_PIXELS),Je=P.getParameter(P.UNPACK_SKIP_ROWS),Es=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,ue.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,ue.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ut),P.pixelStorei(P.UNPACK_SKIP_ROWS,Bt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Lt);const fe=E.isDataArrayTexture||E.isData3DTexture,en=U.isDataArrayTexture||U.isData3DTexture;if(E.isDepthTexture){const nn=it.get(E),De=it.get(U),ke=it.get(nn.__renderTarget),ko=it.get(De.__renderTarget);Z.bindFramebuffer(P.READ_FRAMEBUFFER,ke.__webglFramebuffer),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,ko.__webglFramebuffer);for(let ri=0;ri<vt;ri++)fe&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,it.get(E).__webglTexture,N,Lt+ri),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,it.get(U).__webglTexture,at,me+ri)),P.blitFramebuffer(Ut,Bt,mt,Et,Jt,ae,mt,Et,P.DEPTH_BUFFER_BIT,P.NEAREST);Z.bindFramebuffer(P.READ_FRAMEBUFFER,null),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(N!==0||E.isRenderTargetTexture||it.has(E)){const nn=it.get(E),De=it.get(U);Z.bindFramebuffer(P.READ_FRAMEBUFFER,Sf),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,bf);for(let ke=0;ke<vt;ke++)fe?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,nn.__webglTexture,N,Lt+ke):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,nn.__webglTexture,N),en?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,De.__webglTexture,at,me+ke):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,De.__webglTexture,at),N!==0?P.blitFramebuffer(Ut,Bt,mt,Et,Jt,ae,mt,Et,P.COLOR_BUFFER_BIT,P.NEAREST):en?P.copyTexSubImage3D(de,at,Jt,ae,me+ke,Ut,Bt,mt,Et):P.copyTexSubImage2D(de,at,Jt,ae,Ut,Bt,mt,Et);Z.bindFramebuffer(P.READ_FRAMEBUFFER,null),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else en?E.isDataTexture||E.isData3DTexture?P.texSubImage3D(de,at,Jt,ae,me,mt,Et,vt,le,Dt,ue.data):U.isCompressedArrayTexture?P.compressedTexSubImage3D(de,at,Jt,ae,me,mt,Et,vt,le,ue.data):P.texSubImage3D(de,at,Jt,ae,me,mt,Et,vt,le,Dt,ue):E.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,at,Jt,ae,mt,Et,le,Dt,ue.data):E.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,at,Jt,ae,ue.width,ue.height,le,ue.data):P.texSubImage2D(P.TEXTURE_2D,at,Jt,ae,mt,Et,le,Dt,ue);P.pixelStorei(P.UNPACK_ROW_LENGTH,ne),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Ze),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Fi),P.pixelStorei(P.UNPACK_SKIP_ROWS,Je),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Es),at===0&&U.generateMipmaps&&P.generateMipmap(de),Z.unbindTexture()},this.initRenderTarget=function(E){it.get(E).__webglFramebuffer===void 0&&ht.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?ht.setTextureCube(E,0):E.isData3DTexture?ht.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?ht.setTexture2DArray(E,0):ht.setTexture2D(E,0),Z.unbindTexture()},this.resetState=function(){T=0,R=0,I=null,Z.reset(),pt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qe}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Kt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Kt._getUnpackColorSpace()}}const Zy=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Vu,AddEquation:$n,AddOperation:Ou,AdditiveAnimationBlendMode:nc,AdditiveBlending:Ll,AgXToneMapping:Gu,AlphaFormat:jl,AlwaysCompare:sd,AlwaysDepth:va,AlwaysStencilFunc:Fl,AmbientLight:jd,AnimationAction:hf,AnimationClip:cr,AnimationLoader:eg,AnimationMixer:Ig,AnimationObjectGroup:Cg,AnimationUtils:Km,ArcCurve:Ed,ArrayCamera:af,ArrowHelper:i_,AttachedBindMode:Nl,Audio:lf,AudioAnalyser:xg,AudioContext:wc,AudioListener:mg,AudioLoader:dg,AxesHelper:s_,BackSide:Be,BasicDepthPacking:Ju,BasicShadowMap:wf,BatchedMesh:vd,Bone:cc,BooleanKeyframeTrack:Ui,Box2:Vg,Box3:Pe,Box3Helper:e_,BoxGeometry:Di,BoxHelper:t_,BufferAttribute:oe,BufferGeometry:Xt,BufferGeometryLoader:rf,ByteType:Jl,Cache:Mn,Camera:go,CameraHelper:jg,CanvasTexture:ym,CapsuleGeometry:bo,CatmullRomCurve3:Td,CineonToneMapping:ku,CircleGeometry:Eo,ClampToEdgeWrapping:rn,Clock:of,Color:xt,ColorKeyframeTrack:Ec,ColorManagement:Kt,CompressedArrayTexture:xm,CompressedCubeTexture:vm,CompressedTexture:So,CompressedTextureLoader:ng,ConeGeometry:mr,ConstantAlphaFactor:Uu,ConstantColorFactor:Lu,Controls:a_,CubeCamera:ud,CubeReflectionMapping:zn,CubeRefractionMapping:Qn,CubeTexture:fr,CubeTextureLoader:ig,CubeUVReflectionMapping:xs,CubicBezierCurve:pc,CubicBezierCurve3:Ad,CubicInterpolant:Xd,CullFaceBack:Pl,CullFaceFront:gu,CullFaceFrontBack:Af,CullFaceNone:mu,Curve:pn,CurvePath:Cd,CustomBlending:xu,CustomToneMapping:Hu,CylinderGeometry:pr,Cylindrical:kg,Data3DTexture:po,DataArrayTexture:fo,DataTexture:Sn,DataTextureLoader:sg,DataUtils:Gp,DecrementStencilOp:Vf,DecrementWrapStencilOp:Gf,DefaultLoadingManager:Zd,DepthFormat:us,DepthStencilFormat:ds,DepthTexture:uc,DetachedBindMode:Xu,DirectionalLight:Qd,DirectionalLightHelper:Qg,DiscreteInterpolant:qd,DodecahedronGeometry:To,DoubleSide:vn,DstAlphaFactor:wu,DstColorFactor:Ru,DynamicCopyUsage:sp,DynamicDrawUsage:Qf,DynamicReadUsage:ep,EdgesGeometry:bd,EllipseCurve:Ao,EqualCompare:td,EqualDepth:Ma,EqualStencilFunc:Yf,EquirectangularReflectionMapping:Zs,EquirectangularRefractionMapping:Js,Euler:tn,EventDispatcher:En,ExternalTexture:dc,ExtrudeGeometry:wo,FileLoader:Vn,Float16BufferAttribute:$p,Float32BufferAttribute:Mt,FloatType:Xe,Fog:xo,FogExp2:_o,FramebufferTexture:_m,FrontSide:Bn,Frustum:Ms,FrustumArray:Mo,GLBufferAttribute:Ng,GLSL1:ap,GLSL3:Ol,GreaterCompare:ed,GreaterDepth:ba,GreaterEqualCompare:id,GreaterEqualDepth:Sa,GreaterEqualStencilFunc:Kf,GreaterStencilFunc:Jf,GridHelper:$g,Group:as,HalfFloatType:vs,HemisphereLight:Jd,HemisphereLightHelper:Jg,IcosahedronGeometry:Co,ImageBitmapLoader:ug,ImageLoader:hr,ImageUtils:od,IncrementStencilOp:kf,IncrementWrapStencilOp:Hf,InstancedBufferAttribute:gs,InstancedBufferGeometry:sf,InstancedInterleavedBuffer:Ug,InstancedMesh:xd,Int16BufferAttribute:Zp,Int32BufferAttribute:Jp,Int8BufferAttribute:Xp,IntType:ro,InterleavedBuffer:vo,InterleavedBufferAttribute:Pi,Interpolant:xr,InterpolateDiscrete:Qs,InterpolateLinear:ja,InterpolateSmooth:fa,InterpolationSamplingMode:cp,InterpolationSamplingType:lp,InvertStencilOp:Wf,KeepStencilOp:yi,KeyframeTrack:an,LOD:gd,LatheGeometry:Ro,Layers:mo,LessCompare:ju,LessDepth:ya,LessEqualCompare:ic,LessEqualDepth:Ri,LessEqualStencilFunc:Zf,LessStencilFunc:qf,Light:ii,LightProbe:nf,Line:jn,Line3:Wg,LineBasicMaterial:ze,LineCurve:mc,LineCurve3:wd,LineDashedMaterial:Hd,LineLoop:yd,LineSegments:Tn,LinearFilter:Me,LinearInterpolant:bc,LinearMipMapLinearFilter:Pf,LinearMipMapNearestFilter:If,LinearMipmapLinearFilter:yn,LinearMipmapNearestFilter:ks,LinearSRGBColorSpace:Ii,LinearToneMapping:Bu,LinearTransfer:tr,Loader:Ye,LoaderUtils:Hl,LoadingManager:Tc,LoopOnce:qu,LoopPingPong:Zu,LoopRepeat:Yu,MOUSE:Ef,Material:Le,MaterialLoader:Oo,MathUtils:Ap,Matrix2:Pc,Matrix3:Ht,Matrix4:Ot,MaxEquation:Su,Mesh:ye,MeshBasicMaterial:ei,MeshDepthMaterial:yc,MeshDistanceMaterial:Mc,MeshLambertMaterial:kd,MeshMatcapMaterial:Vd,MeshNormalMaterial:zd,MeshPhongMaterial:Od,MeshPhysicalMaterial:Fd,MeshStandardMaterial:vc,MeshToonMaterial:Bd,MinEquation:Mu,MirroredRepeatWrapping:Ks,MixOperation:Fu,MultiplyBlending:Ul,MultiplyOperation:ur,NearestFilter:Ae,NearestMipMapLinearFilter:Rf,NearestMipMapNearestFilter:Cf,NearestMipmapLinearFilter:ss,NearestMipmapNearestFilter:Zl,NeutralToneMapping:Wu,NeverCompare:Qu,NeverDepth:xa,NeverStencilFunc:Xf,NoBlending:Nn,NoColorSpace:Dn,NoToneMapping:Fn,NormalAnimationBlendMode:uo,NormalBlending:Ai,NotEqualCompare:nd,NotEqualDepth:Ea,NotEqualStencilFunc:$f,NumberKeyframeTrack:or,Object3D:ee,ObjectLoader:cg,ObjectSpaceNormalMap:Ku,OctahedronGeometry:gr,OneFactor:Eu,OneMinusConstantAlphaFactor:Nu,OneMinusConstantColorFactor:Du,OneMinusDstAlphaFactor:Cu,OneMinusDstColorFactor:Iu,OneMinusSrcAlphaFactor:_a,OneMinusSrcColorFactor:Au,OrthographicCamera:Fo,PCFShadowMap:Yl,PCFSoftShadowMap:_u,PMREMGenerator:Xl,Path:io,PerspectiveCamera:Te,Plane:Jn,PlaneGeometry:Ss,PlaneHelper:n_,PointLight:Kd,PointLightHelper:Yg,Points:Md,PointsMaterial:hc,PolarGridHelper:Kg,PolyhedronGeometry:ni,PositionalAudio:_g,PropertyBinding:jt,PropertyMixer:cf,QuadraticBezierCurve:gc,QuadraticBezierCurve3:_c,Quaternion:qe,QuaternionKeyframeTrack:vr,QuaternionLinearInterpolant:Yd,RED_GREEN_RGTC2_Format:Ka,RED_RGTC1_Format:Ja,REVISION:"180",RGBADepthPacking:$u,RGBAFormat:Oe,RGBAIntegerFormat:ho,RGBA_ASTC_10x10_Format:Ga,RGBA_ASTC_10x5_Format:ka,RGBA_ASTC_10x6_Format:Va,RGBA_ASTC_10x8_Format:Ha,RGBA_ASTC_12x10_Format:Wa,RGBA_ASTC_12x12_Format:Xa,RGBA_ASTC_4x4_Format:La,RGBA_ASTC_5x4_Format:Da,RGBA_ASTC_5x5_Format:Ua,RGBA_ASTC_6x5_Format:Na,RGBA_ASTC_6x6_Format:Fa,RGBA_ASTC_8x5_Format:Oa,RGBA_ASTC_8x6_Format:Ba,RGBA_ASTC_8x8_Format:za,RGBA_BPTC_Format:qa,RGBA_ETC2_EAC_Format:Pa,RGBA_PVRTC_2BPPV1_Format:Ca,RGBA_PVRTC_4BPPV1_Format:wa,RGBA_S3TC_DXT1_Format:Hs,RGBA_S3TC_DXT3_Format:Gs,RGBA_S3TC_DXT5_Format:Ws,RGBDepthPacking:Ff,RGBFormat:tc,RGBIntegerFormat:Lf,RGB_BPTC_SIGNED_Format:Ya,RGB_BPTC_UNSIGNED_Format:Za,RGB_ETC1_Format:Ra,RGB_ETC2_Format:Ia,RGB_PVRTC_2BPPV1_Format:Aa,RGB_PVRTC_4BPPV1_Format:Ta,RGB_S3TC_DXT1_Format:Vs,RGDepthPacking:Of,RGFormat:ec,RGIntegerFormat:co,RawShaderMaterial:Nd,Ray:ys,Raycaster:Fg,RectAreaLight:tf,RedFormat:lo,RedIntegerFormat:dr,ReinhardToneMapping:zu,RenderTarget:rc,RenderTarget3D:Pg,RepeatWrapping:$s,ReplaceStencilOp:zf,ReverseSubtractEquation:yu,RingGeometry:Io,SIGNED_RED_GREEN_RGTC2_Format:Qa,SIGNED_RED_RGTC1_Format:$a,SRGBColorSpace:Ge,SRGBTransfer:re,Scene:fd,ShaderChunk:Yt,ShaderLib:hn,ShaderMaterial:fn,ShadowMaterial:Ud,Shape:Ci,ShapeGeometry:Po,ShapePath:r_,ShapeUtils:un,ShortType:$l,Skeleton:yo,SkeletonHelper:qg,SkinnedMesh:_d,Source:Kn,Sphere:we,SphereGeometry:_r,Spherical:zg,SphericalHarmonics3:ef,SplineCurve:xc,SpotLight:$d,SpotLightHelper:Xg,Sprite:md,SpriteMaterial:lc,SrcAlphaFactor:ga,SrcAlphaSaturateFactor:Pu,SrcColorFactor:Tu,StaticCopyUsage:ip,StaticDrawUsage:er,StaticReadUsage:tp,StereoCamera:fg,StreamCopyUsage:rp,StreamDrawUsage:jf,StreamReadUsage:np,StringKeyframeTrack:Ni,SubtractEquation:vu,SubtractiveBlending:Dl,TOUCH:Tf,TangentSpaceNormalMap:ti,TetrahedronGeometry:Lo,Texture:_e,TextureLoader:rg,TextureUtils:u_,Timer:Og,TimestampQuery:op,TorusGeometry:Do,TorusKnotGeometry:Uo,Triangle:We,TriangleFanDrawMode:Nf,TriangleStripDrawMode:Uf,TrianglesDrawMode:Df,TubeGeometry:No,UVMapping:so,Uint16BufferAttribute:ac,Uint32BufferAttribute:oc,Uint8BufferAttribute:qp,Uint8ClampedBufferAttribute:Yp,Uniform:Ic,UniformsGroup:Dg,UniformsLib:ft,UniformsUtils:hd,UnsignedByteType:dn,UnsignedInt101111Type:Ql,UnsignedInt248Type:hs,UnsignedInt5999Type:Kl,UnsignedIntType:kn,UnsignedShort4444Type:ao,UnsignedShort5551Type:oo,UnsignedShortType:cs,VSMShadowMap:xn,Vector2:Q,Vector3:C,Vector4:te,VectorKeyframeTrack:lr,VideoFrameTexture:gm,VideoTexture:Sd,WebGL3DRenderTarget:Dp,WebGLArrayRenderTarget:Lp,WebGLCoordinateSystem:Qe,WebGLCubeRenderTarget:dd,WebGLRenderTarget:bn,WebGLRenderer:qy,WebGLUtils:_f,WebGPUCoordinateSystem:fs,WebXRController:pa,WireframeGeometry:Dd,WrapAroundEnding:js,ZeroCurvatureEnding:bi,ZeroFactor:bu,ZeroSlopeEnding:Ei,ZeroStencilOp:Bf,createCanvasElement:ad},Symbol.toStringTag,{value:"Module"}));export{va as $,Ig as A,Di as B,a_ as C,Eo as D,Zs as E,Ic as F,te as G,ym as H,$s as I,bn as J,Ae as K,Tc as L,ye as M,Nn as N,ee as O,_g as P,qe as Q,ys as R,qg as S,Zy as T,hd as U,C as V,qy as W,En as X,dn as Y,Ju as Z,Yy as _,Ot as a,Hl as a$,Me as a0,$u as a1,Xe as a2,ya as a3,yc as a4,Ii as a5,Dn as a6,uc as a7,ds as a8,hs as a9,Ol as aA,of as aB,Ht as aC,ho as aD,dd as aE,Pf as aF,ud as aG,go as aH,Xl as aI,sf as aJ,Lp as aK,co as aL,fo as aM,tn as aN,Pc as aO,cs as aP,Yt as aQ,gs as aR,Qf as aS,Nd as aT,as as aU,Mt as aV,ze as aW,hc as aX,Od as aY,Tn as aZ,Md as a_,kn as aa,Oe as ab,vs as ac,po as ad,Ye as ae,Vn as af,rn as ag,Sn as ah,lo as ai,zd as aj,Be as ak,vn as al,Bn as am,Fo as an,_e as ao,Ma as ap,Ea as aq,yn as ar,ba as as,Sa as at,Ri as au,xa as av,Le as aw,Xt as ax,oe as ay,ec as az,lr as b,so as b$,Kt as b0,Zd as b1,yo as b2,cc as b3,Ll as b4,Ci as b5,Df as b6,Nf as b7,Uf as b8,Vd as b9,Qd as bA,tf as bB,Jd as bC,$d as bD,Kd as bE,bo as bF,pr as bG,Fd as bH,Bd as bI,Ai as bJ,jd as bK,Hu as bL,Gu as bM,Fn as bN,$g as bO,Gp as bP,mo as bQ,cg as bR,yd as bS,gd as bT,vd as bU,_d as bV,nf as bW,xo as bX,_o as bY,sg as bZ,kd as b_,jg as ba,md as bb,lc as bc,e_ as bd,jn as be,Wg as bf,We as bg,Ms as bh,wo as bi,r_ as bj,Km as bk,nc as bl,uo as bm,Yu as bn,qu as bo,xd as bp,So as bq,Kn as br,od as bs,Qs as bt,Zl as bu,ss as bv,ks as bw,Ks as bx,ja as by,xs as bz,vr as c,Mc as c$,ft as c0,hn as c1,Ug as c2,Pi as c3,Dd as c4,oo as c5,ao as c6,us as c7,dr as c8,jl as c9,Xg as cA,Jg as cB,mr as cC,xn as cD,Yl as cE,wf as cF,t_ as cG,Ku as cH,Co as cI,Ao as cJ,zn as cK,Fa as cL,Vs as cM,Ta as cN,Ia as cO,Ra as cP,Ws as cQ,wa as cR,Pa as cS,qa as cT,La as cU,Vg as cV,io as cW,_c as cX,Ad as cY,Td as cZ,dg as c_,ro as ca,$l as cb,Jl as cc,_u as cd,pn as ce,ac as cf,un as cg,or as ch,_m as ci,ti as cj,ku as ck,zu as cl,Bu as cm,Hd as cn,ug as co,vo as cp,xr as cq,i_ as cr,Wu as cs,gr as ct,Do as cu,Lo as cv,bd as cw,Io as cx,Qg as cy,Yg as cz,cr as d,Eu as d0,xu as d1,Cd as d2,ig as d3,Sd as d4,ga as d5,zf as d6,Fl as d7,yi as d8,$f as d9,Yf as da,vm as db,xm as dc,Ca as dd,Ka as de,Qa as df,Ja as dg,$a as dh,Gs as di,Hs as dj,tc as dk,Ql as dl,Kl as dm,Za as dn,re as dp,rg as e,mg as f,Q as g,fn as h,jt as i,Pe as j,Ef as k,Tf as l,zg as m,Jn as n,Ap as o,we as p,Fg as q,Ge as r,Vu as s,fd as t,Te as u,xt as v,Ss as w,ei as x,vc as y,_r as z};