@splinetool/runtime 2.0.161 → 2.0.162

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 (313) hide show
  1. package/build/{runtime-bloom-AZYRBSQA.js → runtime-bloom-TOGQ4SYJ.js} +1 -1
  2. package/build/runtime-bloom-TOGQ4SYJ.js.br +0 -0
  3. package/build/runtime-bloom-TOGQ4SYJ.js.gz +0 -0
  4. package/build/{runtime-brightnessContrast-WEQJQA5H.js → runtime-brightnessContrast-WI5PDIGZ.js} +1 -1
  5. package/build/runtime-brightnessContrast-WI5PDIGZ.js.br +0 -0
  6. package/build/runtime-brightnessContrast-WI5PDIGZ.js.gz +0 -0
  7. package/build/{runtime-chromaticAberration-GO2J5L4S.js → runtime-chromaticAberration-LTILKILG.js} +1 -1
  8. package/build/runtime-chromaticAberration-LTILKILG.js.br +0 -0
  9. package/build/runtime-chromaticAberration-LTILKILG.js.gz +0 -0
  10. package/build/{runtime-chunk-S5UEI4DR.js → runtime-chunk-2TFVH5EZ.js} +1 -1
  11. package/build/runtime-chunk-2TFVH5EZ.js.br +0 -0
  12. package/build/runtime-chunk-2TFVH5EZ.js.gz +0 -0
  13. package/build/{runtime-chunk-SEEDV66Z.js → runtime-chunk-4QO3H2QB.js} +1 -1
  14. package/build/{runtime-chunk-SEEDV66Z.js.br → runtime-chunk-4QO3H2QB.js.br} +0 -0
  15. package/build/runtime-chunk-4QO3H2QB.js.gz +0 -0
  16. package/build/{runtime-chunk-YI4JK7UO.js → runtime-chunk-6Y3JPTQ2.js} +1 -1
  17. package/build/runtime-chunk-6Y3JPTQ2.js.br +0 -0
  18. package/build/runtime-chunk-6Y3JPTQ2.js.gz +0 -0
  19. package/build/{runtime-chunk-3L424UNZ.js → runtime-chunk-773MEN5O.js} +1 -1
  20. package/build/{runtime-chunk-3L424UNZ.js.br → runtime-chunk-773MEN5O.js.br} +0 -0
  21. package/build/{runtime-chunk-3L424UNZ.js.gz → runtime-chunk-773MEN5O.js.gz} +0 -0
  22. package/build/{runtime-chunk-UCF5M2I6.js → runtime-chunk-AHZOOXOP.js} +1 -1
  23. package/build/runtime-chunk-AHZOOXOP.js.br +0 -0
  24. package/build/runtime-chunk-AHZOOXOP.js.gz +0 -0
  25. package/build/{runtime-chunk-TJP5IVFO.js → runtime-chunk-B2HUMYND.js} +1 -1
  26. package/build/runtime-chunk-B2HUMYND.js.br +0 -0
  27. package/build/runtime-chunk-B2HUMYND.js.gz +0 -0
  28. package/build/{runtime-chunk-Y3KCBH76.js → runtime-chunk-BRIJCTL7.js} +1 -1
  29. package/build/runtime-chunk-BRIJCTL7.js.br +0 -0
  30. package/build/runtime-chunk-BRIJCTL7.js.gz +0 -0
  31. package/build/{runtime-chunk-FX42TWCV.js → runtime-chunk-C6TXOTUG.js} +1 -1
  32. package/build/runtime-chunk-C6TXOTUG.js.br +0 -0
  33. package/build/runtime-chunk-C6TXOTUG.js.gz +0 -0
  34. package/build/{runtime-chunk-CAU75OZB.js → runtime-chunk-E2NZABAD.js} +1 -1
  35. package/build/runtime-chunk-E2NZABAD.js.br +0 -0
  36. package/build/{runtime-chunk-CAU75OZB.js.gz → runtime-chunk-E2NZABAD.js.gz} +0 -0
  37. package/build/{runtime-chunk-X77TCT7I.js → runtime-chunk-E2YEYTL3.js} +1 -1
  38. package/build/runtime-chunk-E2YEYTL3.js.br +0 -0
  39. package/build/runtime-chunk-E2YEYTL3.js.gz +0 -0
  40. package/build/runtime-chunk-EQYKQCNZ.js +1 -0
  41. package/build/runtime-chunk-EQYKQCNZ.js.br +0 -0
  42. package/build/runtime-chunk-EQYKQCNZ.js.gz +0 -0
  43. package/build/{runtime-chunk-R2FZWI7L.js → runtime-chunk-FKH52AGC.js} +1 -1
  44. package/build/runtime-chunk-FKH52AGC.js.br +0 -0
  45. package/build/runtime-chunk-FKH52AGC.js.gz +0 -0
  46. package/build/{runtime-chunk-WCP7DFUY.js → runtime-chunk-HOQIP3UO.js} +1 -1
  47. package/build/runtime-chunk-HOQIP3UO.js.br +0 -0
  48. package/build/runtime-chunk-HOQIP3UO.js.gz +0 -0
  49. package/build/{runtime-chunk-ARNZDNZ5.js → runtime-chunk-IVAJEJLH.js} +1 -1
  50. package/build/runtime-chunk-IVAJEJLH.js.br +0 -0
  51. package/build/runtime-chunk-IVAJEJLH.js.gz +0 -0
  52. package/build/{runtime-chunk-YQALJ3YA.js → runtime-chunk-KNCQ2KNA.js} +1 -1
  53. package/build/runtime-chunk-KNCQ2KNA.js.br +0 -0
  54. package/build/runtime-chunk-KNCQ2KNA.js.gz +0 -0
  55. package/build/{runtime-chunk-6I3BABUM.js → runtime-chunk-NA24TLD4.js} +1 -1
  56. package/build/runtime-chunk-NA24TLD4.js.br +0 -0
  57. package/build/runtime-chunk-NA24TLD4.js.gz +0 -0
  58. package/build/{runtime-chunk-R2MDXWNY.js → runtime-chunk-NSLP4QTS.js} +1 -1
  59. package/build/runtime-chunk-NSLP4QTS.js.br +0 -0
  60. package/build/runtime-chunk-NSLP4QTS.js.gz +0 -0
  61. package/build/{runtime-chunk-XKCF5GDT.js → runtime-chunk-OUMINMP2.js} +1 -1
  62. package/build/runtime-chunk-OUMINMP2.js.br +0 -0
  63. package/build/runtime-chunk-OUMINMP2.js.gz +0 -0
  64. package/build/{runtime-chunk-FPOAHQL3.js → runtime-chunk-PNRVSCPS.js} +1 -1
  65. package/build/runtime-chunk-PNRVSCPS.js.br +0 -0
  66. package/build/runtime-chunk-PNRVSCPS.js.gz +0 -0
  67. package/build/{runtime-chunk-ZPZWHJB5.js → runtime-chunk-T5DDK5OQ.js} +1 -1
  68. package/build/runtime-chunk-T5DDK5OQ.js.br +0 -0
  69. package/build/runtime-chunk-T5DDK5OQ.js.gz +0 -0
  70. package/build/{runtime-chunk-J3AY7A6D.js → runtime-chunk-TOQFUFTK.js} +1 -1
  71. package/build/runtime-chunk-TOQFUFTK.js.br +1 -0
  72. package/build/runtime-chunk-TOQFUFTK.js.gz +0 -0
  73. package/build/{runtime-chunk-D3YUMVV2.js → runtime-chunk-TVTRYIWX.js} +1 -1
  74. package/build/runtime-chunk-TVTRYIWX.js.br +0 -0
  75. package/build/runtime-chunk-TVTRYIWX.js.gz +0 -0
  76. package/build/{runtime-chunk-KEVKWE7V.js → runtime-chunk-VMP5GX6V.js} +1 -1
  77. package/build/runtime-chunk-VMP5GX6V.js.br +0 -0
  78. package/build/runtime-chunk-VMP5GX6V.js.gz +0 -0
  79. package/build/{runtime-chunk-7JZHIVIE.js → runtime-chunk-X2II7COD.js} +1 -1
  80. package/build/runtime-chunk-X2II7COD.js.br +0 -0
  81. package/build/runtime-chunk-X2II7COD.js.gz +0 -0
  82. package/build/{runtime-chunk-APKU3YYA.js → runtime-chunk-X4VLERKT.js} +1 -1
  83. package/build/runtime-chunk-X4VLERKT.js.br +0 -0
  84. package/build/runtime-chunk-X4VLERKT.js.gz +0 -0
  85. package/build/{runtime-chunk-Y7GWLY3V.js → runtime-chunk-ZCXLJDDE.js} +1 -1
  86. package/build/runtime-chunk-ZCXLJDDE.js.br +1 -0
  87. package/build/runtime-chunk-ZCXLJDDE.js.gz +0 -0
  88. package/build/{runtime-chunk-RALJRND3.js → runtime-chunk-ZJBXAYK6.js} +1 -1
  89. package/build/runtime-chunk-ZJBXAYK6.js.br +0 -0
  90. package/build/runtime-chunk-ZJBXAYK6.js.gz +0 -0
  91. package/build/{runtime-classicRuntime-3OM2N25U.js → runtime-classicRuntime-3QO7PU2T.js} +1 -1
  92. package/build/runtime-classicRuntime-3QO7PU2T.js.br +0 -0
  93. package/build/runtime-classicRuntime-3QO7PU2T.js.gz +0 -0
  94. package/build/{runtime-cloners-WSYWA5ER.js → runtime-cloners-TC7Y3VWB.js} +1 -1
  95. package/build/runtime-cloners-TC7Y3VWB.js.br +0 -0
  96. package/build/runtime-cloners-TC7Y3VWB.js.gz +0 -0
  97. package/build/{runtime-components-OJLETIM4.js → runtime-components-VAHD7EW5.js} +1 -1
  98. package/build/runtime-components-VAHD7EW5.js.br +0 -0
  99. package/build/runtime-components-VAHD7EW5.js.gz +0 -0
  100. package/build/{runtime-createDestroy-2N4SCER3.js → runtime-createDestroy-TI7PHMNL.js} +1 -1
  101. package/build/runtime-createDestroy-TI7PHMNL.js.br +0 -0
  102. package/build/runtime-createDestroy-TI7PHMNL.js.gz +0 -0
  103. package/build/{runtime-depthOfField-JWGMZTMT.js → runtime-depthOfField-H5W275NE.js} +1 -1
  104. package/build/runtime-depthOfField-H5W275NE.js.br +0 -0
  105. package/build/runtime-depthOfField-H5W275NE.js.gz +0 -0
  106. package/build/{runtime-dragDrop-WYPV3QDK.js → runtime-dragDrop-KELMQHH7.js} +1 -1
  107. package/build/runtime-dragDrop-KELMQHH7.js.br +0 -0
  108. package/build/runtime-dragDrop-KELMQHH7.js.gz +0 -0
  109. package/build/{runtime-gameControls-3XOIAHXD.js → runtime-gameControls-QLGCIVXF.js} +1 -1
  110. package/build/runtime-gameControls-QLGCIVXF.js.br +0 -0
  111. package/build/runtime-gameControls-QLGCIVXF.js.gz +0 -0
  112. package/build/{runtime-hair-TQL4XBNY.js → runtime-hair-TP54K4TC.js} +1 -1
  113. package/build/runtime-hair-TP54K4TC.js.br +0 -0
  114. package/build/runtime-hair-TP54K4TC.js.gz +0 -0
  115. package/build/{runtime-hueSaturation-JFSLUMFA.js → runtime-hueSaturation-6KAZEI7Y.js} +1 -1
  116. package/build/runtime-hueSaturation-6KAZEI7Y.js.br +0 -0
  117. package/build/runtime-hueSaturation-6KAZEI7Y.js.gz +0 -0
  118. package/build/{runtime-mergeStaticGeometries-N7N222AD.js → runtime-mergeStaticGeometries-OW5L3CIG.js} +1 -1
  119. package/build/runtime-mergeStaticGeometries-OW5L3CIG.js.br +0 -0
  120. package/build/runtime-mergeStaticGeometries-OW5L3CIG.js.gz +0 -0
  121. package/build/{runtime-miscActions-JQO2WQCN.js → runtime-miscActions-35GO45T4.js} +1 -1
  122. package/build/runtime-miscActions-35GO45T4.js.br +0 -0
  123. package/build/runtime-miscActions-35GO45T4.js.gz +0 -0
  124. package/build/{runtime-mouseHover-X3APMLF7.js → runtime-mouseHover-MRKVXHDG.js} +1 -1
  125. package/build/runtime-mouseHover-MRKVXHDG.js.br +0 -0
  126. package/build/runtime-mouseHover-MRKVXHDG.js.gz +0 -0
  127. package/build/{runtime-noise-T6QUZXNL.js → runtime-noise-AFPLPZPZ.js} +1 -1
  128. package/build/runtime-noise-AFPLPZPZ.js.br +0 -0
  129. package/build/runtime-noise-AFPLPZPZ.js.gz +0 -0
  130. package/build/{runtime-particles-MRMHJLVS.js → runtime-particles-XPZWO76J.js} +1 -1
  131. package/build/runtime-particles-XPZWO76J.js.br +0 -0
  132. package/build/runtime-particles-XPZWO76J.js.gz +0 -0
  133. package/build/{runtime-paths-VUYUX4CL.js → runtime-paths-MEMYY2PV.js} +1 -1
  134. package/build/runtime-paths-MEMYY2PV.js.br +0 -0
  135. package/build/runtime-paths-MEMYY2PV.js.gz +0 -0
  136. package/build/{runtime-pixelation-XL32HHQ3.js → runtime-pixelation-XOWPUHQQ.js} +1 -1
  137. package/build/runtime-pixelation-XOWPUHQQ.js.br +0 -0
  138. package/build/runtime-pixelation-XOWPUHQQ.js.gz +0 -0
  139. package/build/{runtime-resize-HTMZDDUB.js → runtime-resize-TOVVP7QN.js} +1 -1
  140. package/build/runtime-resize-TOVVP7QN.js.br +0 -0
  141. package/build/runtime-resize-TOVVP7QN.js.gz +0 -0
  142. package/build/{runtime-sceneTransition-X4AHNGUD.js → runtime-sceneTransition-PXHFV74P.js} +1 -1
  143. package/build/runtime-sceneTransition-PXHFV74P.js.br +0 -0
  144. package/build/runtime-sceneTransition-PXHFV74P.js.gz +0 -0
  145. package/build/{runtime-scroll-FRB22LCS.js → runtime-scroll-WJ5WS42C.js} +1 -1
  146. package/build/runtime-scroll-WJ5WS42C.js.br +0 -0
  147. package/build/runtime-scroll-WJ5WS42C.js.gz +0 -0
  148. package/build/runtime-shapeBlends-AM66S2OE.js +1 -0
  149. package/build/runtime-shapeBlends-AM66S2OE.js.br +0 -0
  150. package/build/runtime-shapeBlends-AM66S2OE.js.gz +0 -0
  151. package/build/{runtime-text-HWI2HJRR.js → runtime-text-TRNWNFNK.js} +1 -1
  152. package/build/runtime-text-TRNWNFNK.js.br +0 -0
  153. package/build/runtime-text-TRNWNFNK.js.gz +0 -0
  154. package/build/{runtime-textInputs-77HD6CUE.js → runtime-textInputs-BQWEPOD7.js} +1 -1
  155. package/build/runtime-textInputs-BQWEPOD7.js.br +0 -0
  156. package/build/runtime-textInputs-BQWEPOD7.js.gz +0 -0
  157. package/build/{runtime-timeline-CJTR4QKE.js → runtime-timeline-YVBWCK6S.js} +1 -1
  158. package/build/runtime-timeline-YVBWCK6S.js.br +0 -0
  159. package/build/runtime-timeline-YVBWCK6S.js.gz +0 -0
  160. package/build/{runtime-tracking-5XAAQOHM.js → runtime-tracking-GPJAVW6L.js} +1 -1
  161. package/build/runtime-tracking-GPJAVW6L.js.br +0 -0
  162. package/build/runtime-tracking-GPJAVW6L.js.gz +0 -0
  163. package/build/{runtime-transitions-MUC3XJNU.js → runtime-transitions-JIHES3SC.js} +1 -1
  164. package/build/runtime-transitions-JIHES3SC.js.br +0 -0
  165. package/build/runtime-transitions-JIHES3SC.js.gz +0 -0
  166. package/build/{runtime-ui2d-A3EXZNGO.js → runtime-ui2d-VSA4VC6Q.js} +1 -1
  167. package/build/runtime-ui2d-VSA4VC6Q.js.br +0 -0
  168. package/build/runtime-ui2d-VSA4VC6Q.js.gz +0 -0
  169. package/build/{runtime-vectorShapes-4QQBRQDQ.js → runtime-vectorShapes-GXQBUTJC.js} +1 -1
  170. package/build/runtime-vectorShapes-GXQBUTJC.js.br +0 -0
  171. package/build/runtime-vectorShapes-GXQBUTJC.js.gz +0 -0
  172. package/build/{runtime-vignette-OLCPV74G.js → runtime-vignette-7IWYEHFI.js} +1 -1
  173. package/build/runtime-vignette-7IWYEHFI.js.br +0 -0
  174. package/build/runtime-vignette-7IWYEHFI.js.gz +0 -0
  175. package/build/{runtime-webgpu-TO23442C.js → runtime-webgpu-6OOZEOGS.js} +1 -1
  176. package/build/runtime-webgpu-6OOZEOGS.js.br +0 -0
  177. package/build/runtime-webgpu-6OOZEOGS.js.gz +0 -0
  178. package/build/runtime.cjs +7 -7
  179. package/build/runtime.js +1 -1
  180. package/build/runtime.js.br +0 -0
  181. package/build/runtime.js.gz +0 -0
  182. package/build/runtime.standalone.js +1 -1
  183. package/build/runtime.standalone.js.br +0 -0
  184. package/build/runtime.standalone.js.gz +0 -0
  185. package/build/runtime.standalone.webgl.js +1 -1
  186. package/build/runtime.standalone.webgl.js.br +0 -0
  187. package/build/runtime.standalone.webgl.js.gz +0 -0
  188. package/build/runtime.standalone.webgpu.js +1 -1
  189. package/build/runtime.standalone.webgpu.js.br +0 -0
  190. package/build/runtime.standalone.webgpu.js.gz +0 -0
  191. package/build/runtime.standalone.webgpu.micro.js +1 -1
  192. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  193. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  194. package/build/runtime.standalone.webgpu.min.js +1 -1
  195. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  196. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  197. package/package.json +1 -1
  198. package/build/runtime-bloom-AZYRBSQA.js.br +0 -0
  199. package/build/runtime-bloom-AZYRBSQA.js.gz +0 -0
  200. package/build/runtime-brightnessContrast-WEQJQA5H.js.br +0 -0
  201. package/build/runtime-brightnessContrast-WEQJQA5H.js.gz +0 -0
  202. package/build/runtime-chromaticAberration-GO2J5L4S.js.br +0 -0
  203. package/build/runtime-chromaticAberration-GO2J5L4S.js.gz +0 -0
  204. package/build/runtime-chunk-6I3BABUM.js.br +0 -0
  205. package/build/runtime-chunk-6I3BABUM.js.gz +0 -0
  206. package/build/runtime-chunk-7JZHIVIE.js.br +0 -0
  207. package/build/runtime-chunk-7JZHIVIE.js.gz +0 -0
  208. package/build/runtime-chunk-APKU3YYA.js.br +0 -0
  209. package/build/runtime-chunk-APKU3YYA.js.gz +0 -0
  210. package/build/runtime-chunk-ARNZDNZ5.js.br +0 -0
  211. package/build/runtime-chunk-ARNZDNZ5.js.gz +0 -0
  212. package/build/runtime-chunk-CAU75OZB.js.br +0 -0
  213. package/build/runtime-chunk-D3YUMVV2.js.br +0 -0
  214. package/build/runtime-chunk-D3YUMVV2.js.gz +0 -0
  215. package/build/runtime-chunk-FPOAHQL3.js.br +0 -0
  216. package/build/runtime-chunk-FPOAHQL3.js.gz +0 -0
  217. package/build/runtime-chunk-FX42TWCV.js.br +0 -0
  218. package/build/runtime-chunk-FX42TWCV.js.gz +0 -0
  219. package/build/runtime-chunk-J3AY7A6D.js.br +0 -1
  220. package/build/runtime-chunk-J3AY7A6D.js.gz +0 -0
  221. package/build/runtime-chunk-KEVKWE7V.js.br +0 -0
  222. package/build/runtime-chunk-KEVKWE7V.js.gz +0 -0
  223. package/build/runtime-chunk-R2FZWI7L.js.br +0 -0
  224. package/build/runtime-chunk-R2FZWI7L.js.gz +0 -0
  225. package/build/runtime-chunk-R2MDXWNY.js.br +0 -0
  226. package/build/runtime-chunk-R2MDXWNY.js.gz +0 -0
  227. package/build/runtime-chunk-RALJRND3.js.br +0 -0
  228. package/build/runtime-chunk-RALJRND3.js.gz +0 -0
  229. package/build/runtime-chunk-S5UEI4DR.js.br +0 -0
  230. package/build/runtime-chunk-S5UEI4DR.js.gz +0 -0
  231. package/build/runtime-chunk-SEEDV66Z.js.gz +0 -0
  232. package/build/runtime-chunk-TJP5IVFO.js.br +0 -0
  233. package/build/runtime-chunk-TJP5IVFO.js.gz +0 -0
  234. package/build/runtime-chunk-TTAYL3F7.js +0 -1
  235. package/build/runtime-chunk-TTAYL3F7.js.br +0 -0
  236. package/build/runtime-chunk-TTAYL3F7.js.gz +0 -0
  237. package/build/runtime-chunk-UCF5M2I6.js.br +0 -0
  238. package/build/runtime-chunk-UCF5M2I6.js.gz +0 -0
  239. package/build/runtime-chunk-WCP7DFUY.js.br +0 -0
  240. package/build/runtime-chunk-WCP7DFUY.js.gz +0 -0
  241. package/build/runtime-chunk-X77TCT7I.js.br +0 -0
  242. package/build/runtime-chunk-X77TCT7I.js.gz +0 -0
  243. package/build/runtime-chunk-XKCF5GDT.js.br +0 -0
  244. package/build/runtime-chunk-XKCF5GDT.js.gz +0 -0
  245. package/build/runtime-chunk-Y3KCBH76.js.br +0 -0
  246. package/build/runtime-chunk-Y3KCBH76.js.gz +0 -0
  247. package/build/runtime-chunk-Y7GWLY3V.js.br +0 -0
  248. package/build/runtime-chunk-Y7GWLY3V.js.gz +0 -0
  249. package/build/runtime-chunk-YI4JK7UO.js.br +0 -0
  250. package/build/runtime-chunk-YI4JK7UO.js.gz +0 -0
  251. package/build/runtime-chunk-YQALJ3YA.js.br +0 -0
  252. package/build/runtime-chunk-YQALJ3YA.js.gz +0 -0
  253. package/build/runtime-chunk-ZPZWHJB5.js.br +0 -0
  254. package/build/runtime-chunk-ZPZWHJB5.js.gz +0 -0
  255. package/build/runtime-classicRuntime-3OM2N25U.js.br +0 -0
  256. package/build/runtime-classicRuntime-3OM2N25U.js.gz +0 -0
  257. package/build/runtime-cloners-WSYWA5ER.js.br +0 -0
  258. package/build/runtime-cloners-WSYWA5ER.js.gz +0 -0
  259. package/build/runtime-components-OJLETIM4.js.br +0 -0
  260. package/build/runtime-components-OJLETIM4.js.gz +0 -0
  261. package/build/runtime-createDestroy-2N4SCER3.js.br +0 -0
  262. package/build/runtime-createDestroy-2N4SCER3.js.gz +0 -0
  263. package/build/runtime-depthOfField-JWGMZTMT.js.br +0 -0
  264. package/build/runtime-depthOfField-JWGMZTMT.js.gz +0 -0
  265. package/build/runtime-dragDrop-WYPV3QDK.js.br +0 -0
  266. package/build/runtime-dragDrop-WYPV3QDK.js.gz +0 -0
  267. package/build/runtime-gameControls-3XOIAHXD.js.br +0 -0
  268. package/build/runtime-gameControls-3XOIAHXD.js.gz +0 -0
  269. package/build/runtime-hair-TQL4XBNY.js.br +0 -1
  270. package/build/runtime-hair-TQL4XBNY.js.gz +0 -0
  271. package/build/runtime-hueSaturation-JFSLUMFA.js.br +0 -0
  272. package/build/runtime-hueSaturation-JFSLUMFA.js.gz +0 -0
  273. package/build/runtime-mergeStaticGeometries-N7N222AD.js.br +0 -0
  274. package/build/runtime-mergeStaticGeometries-N7N222AD.js.gz +0 -0
  275. package/build/runtime-miscActions-JQO2WQCN.js.br +0 -0
  276. package/build/runtime-miscActions-JQO2WQCN.js.gz +0 -0
  277. package/build/runtime-mouseHover-X3APMLF7.js.br +0 -0
  278. package/build/runtime-mouseHover-X3APMLF7.js.gz +0 -0
  279. package/build/runtime-noise-T6QUZXNL.js.br +0 -0
  280. package/build/runtime-noise-T6QUZXNL.js.gz +0 -0
  281. package/build/runtime-particles-MRMHJLVS.js.br +0 -0
  282. package/build/runtime-particles-MRMHJLVS.js.gz +0 -0
  283. package/build/runtime-paths-VUYUX4CL.js.br +0 -0
  284. package/build/runtime-paths-VUYUX4CL.js.gz +0 -0
  285. package/build/runtime-pixelation-XL32HHQ3.js.br +0 -0
  286. package/build/runtime-pixelation-XL32HHQ3.js.gz +0 -0
  287. package/build/runtime-resize-HTMZDDUB.js.br +0 -0
  288. package/build/runtime-resize-HTMZDDUB.js.gz +0 -0
  289. package/build/runtime-sceneTransition-X4AHNGUD.js.br +0 -0
  290. package/build/runtime-sceneTransition-X4AHNGUD.js.gz +0 -0
  291. package/build/runtime-scroll-FRB22LCS.js.br +0 -0
  292. package/build/runtime-scroll-FRB22LCS.js.gz +0 -0
  293. package/build/runtime-shapeBlends-S7C3QIM2.js +0 -1
  294. package/build/runtime-shapeBlends-S7C3QIM2.js.br +0 -0
  295. package/build/runtime-shapeBlends-S7C3QIM2.js.gz +0 -0
  296. package/build/runtime-text-HWI2HJRR.js.br +0 -0
  297. package/build/runtime-text-HWI2HJRR.js.gz +0 -0
  298. package/build/runtime-textInputs-77HD6CUE.js.br +0 -0
  299. package/build/runtime-textInputs-77HD6CUE.js.gz +0 -0
  300. package/build/runtime-timeline-CJTR4QKE.js.br +0 -0
  301. package/build/runtime-timeline-CJTR4QKE.js.gz +0 -0
  302. package/build/runtime-tracking-5XAAQOHM.js.br +0 -0
  303. package/build/runtime-tracking-5XAAQOHM.js.gz +0 -0
  304. package/build/runtime-transitions-MUC3XJNU.js.br +0 -0
  305. package/build/runtime-transitions-MUC3XJNU.js.gz +0 -0
  306. package/build/runtime-ui2d-A3EXZNGO.js.br +0 -0
  307. package/build/runtime-ui2d-A3EXZNGO.js.gz +0 -0
  308. package/build/runtime-vectorShapes-4QQBRQDQ.js.br +0 -0
  309. package/build/runtime-vectorShapes-4QQBRQDQ.js.gz +0 -0
  310. package/build/runtime-vignette-OLCPV74G.js.br +0 -0
  311. package/build/runtime-vignette-OLCPV74G.js.gz +0 -0
  312. package/build/runtime-webgpu-TO23442C.js.br +0 -0
  313. package/build/runtime-webgpu-TO23442C.js.gz +0 -0
@@ -1 +1 @@
1
- import{b as t}from"./runtime-chunk-N2ZRGNPR.js";import{a as e,c as i}from"./runtime-chunk-VAVYZ35B.js";import{b as s,c as o,d as a,e as n}from"./runtime-chunk-FQNSP44B.js";import{a as r}from"./runtime-chunk-J3AY7A6D.js";import{L as h,a as l}from"./runtime-chunk-ARNZDNZ5.js";import{f as d,g as c}from"./runtime-chunk-UNI3D2MC.js";import{h as p}from"./runtime-chunk-CAU75OZB.js";import{a as m}from"./runtime-chunk-RTLL6WIB.js";import{a as u,b as y,g as v,h as g,i as f}from"./runtime-chunk-2PT2WH66.js";import{c as b}from"./runtime-chunk-TZCHGFVF.js";import{Ga as E,Ta as P,Ua as C}from"./runtime-chunk-ADHKZQMB.js";import{Dc as M,Fc as x,Gc as T,Hc as D,Qc as S,Qe as w,Rc as R,Tc as j,Zc as L,b as G,dd as B,ed as A,fd as W}from"./runtime-chunk-KPOUV3HD.js";var O=200,I=null;function F(t){I=t}function k(){return I}function V(t){let e=!1;return t.scene.objects.forEach(i=>{"Page"===i.data.type&&!e&&i.data.publish.gameControlObject&&E.traverseModuleInstances(t,i.id,(t,i,s)=>{for(let t of s)"GameControl"===t.data.type&&t.data.navmesh.enabled&&(e=!0)})}),e}function z(t){return s?t.metaKey:t.ctrlKey}function H(t,e){return Math.abs(t+3*e)<=2||Math.abs(t+3*window.devicePixelRatio*e)<=2}var Z={type:"change"},U={type:"start"},Y={type:"end",nonOrbit:!0},X={type:"end",nonOrbit:!1},N={type:"end",isZoom:!0,nonOrbit:!0},K={type:"end",changed:!1},_={type:"cameraAnimatingInTimeline"},q=new T,Q=new x,J=2*Math.PI,$=new D,tt=new x,et=new D,it=new T,st=new S,ot={type:"requestRender"},at=class extends M{constructor(t,i,s={isPlayMode:!1,isExport:!1},a){super(),this.object=t,this.domElement=i,this.options=s,this.timelineState=a,this.enabled=!0,this.useKeyEvents=!0,this.enableDamping=!1,this.enableZoom=!0,this.enableRotate=!0,this.enablePan=!0,this.autoRotate=!1,this.rotationLimitsMode=0,this.panLimitsMode=0,this.rotationSoftLimit=2,this.panSoftLimit=2,this.hoverRotatePanMode=0,this.zoomLimitsEnabled=!1,this.mouseButtons=[0,5],this.mouseButtonsPlay=[3,4,5],this.touches=[null,G.DOLLY_ROTATE,G.PAN],this.offset=new D,this.eye=new D,this.lastPosition=new D,this.lastQuaternion=new T,this.current=new x,this.overShoot=new x,this.overRatio=new x,this.spherical=new w,this.sphericalDelta=new w,this.panOffset=new D,this.panLeftV=new D,this.panUpV=new D,this.panV=new D,this.rotateStart=new x,this.rotateEnd=new x,this.rotateDelta=new x,this.panStart=new x,this.panEnd=new x,this.panDelta=new x,this.dollyStart=new x,this.dollyEnd=new x,this.dollyDelta=new x,this.rotationRangeFactor=new x,this.panRangeFactor=new x,this.state=-1,this.zoomChanged=!1,this.isPointerDown=!1,this.isThetaFlipped=!1,this.prevScale=0,this.scale=1,this.gesture=!1,this.lastTrackpadPanTime=-1/0,this.lastMouseWheelZoomTime=-1/0,this.timer=-1,this.timerHover=-1,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPhi=0,this.maxPhi=Math.PI,this.minTheta=-1/0,this.maxTheta=1/0,this.minH=0,this.maxH=Math.PI,this.minV=-1/0,this.maxV=1/0,this.autoRotateClockwise=!0,this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.resetHoverEffectOnPointerLeave=!1,this.hasChange=!1,this.useWindowEvents=!1,this.isTouchZoom=!0,this.autoRotateSpeed=2,this.dampingFactor=.125,this.zoomSpeed=2,this.rotateSpeed=1,this.rotateFactor=1,this.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=t=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=t.camera,this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)},this.update=()=>{this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(et,it,$),this.offset.copy(et).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&-1===this.state&&this.rotateLeft((!0===this.autoRotateClockwise?1:-1)*this.getAutoRotationAngle()),0!==this.rotationLimitsMode&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),2!==this.rotationLimitsMode&&(this.spherical.phi+=this.sphericalDelta.phi),(1!==this.rotationLimitsMode||!0===this.autoRotate)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&this.object.isPerspectiveCamera&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),0!==this.panLimitsMode&&(this.target.applyQuaternion(q.copy(it).invert()),this.panOffset.applyQuaternion(q),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(it),this.panOffset.applyQuaternion(it)),2===this.panLimitsMode&&(this.panOffset.y=0),1===this.panLimitsMode&&(this.panOffset.x=0),-1!==this.state||this.gesture?(this.target.add(this.panOffset),this.panOffset.set(0,0,0)):(this.panOffset.multiplyScalar(1-this.dampingFactor),this.target.add(this.panOffset)),this.offset.setFromSpherical(this.spherical),et.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(st.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(st));let t=this.spherical.phi%J;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(j.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),t>0&&t>Math.PI||t<0&&t>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),-1===this.state||!0===this.enableDamping){let t=1===this.hoverRotatePanMode?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-t,this.sphericalDelta.phi*=1-t}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8)return this.dispatchEvent(Z),this.object.dispatchEvent(ot),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),void(this.isCurrentlyDamping=!0);this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.isCurrentlyDamping=!1},this.onPointerDown=t=>{!1!==this.enabled&&("touch"===t.pointerType||"pen"===t.pointerType&&n?this.onPointerDownTouch(t):this.onPointerDownMouse(t),-1!==this.state&&(this.isPointerDown=!0,this.dispatchEvent(U),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&n||this.domElement.setPointerCapture(t.pointerId)))},this.onPointerLeave=t=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(1===this.hoverRotatePanMode?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,$.subVectors(this.position0,this.target0),this.spherical.setFromVector3($),this.sphericalDelta.theta+=this.spherical.theta,this.sphericalDelta.phi+=this.spherical.phi,this.sphericalDelta.theta/=8,this.sphericalDelta.phi/=8):2===this.hoverRotatePanMode&&this.panOffset.subVectors(this.target0,this.target).divideScalar(8),this.update()):this.pointerLeaveEvent=t},this.onPointerEnter=t=>{this.resetHoverEffectOnPointerLeave||void 0===this.pointerLeaveEvent?tt.set(t.clientX-this.domElement.clientWidth/2,t.clientY-this.domElement.clientHeight/2):tt.set(t.clientX-this.pointerLeaveEvent.clientX,t.clientY-this.pointerLeaveEvent.clientY),1===this.hoverRotatePanMode?(this.rotateDelta.copy(tt).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(Q,-this.object.angleOffsetFromUp),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight),this.rotateStart.set(t.clientX,t.clientY)):2===this.hoverRotatePanMode&&(this.panDelta.copy(tt).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(t.clientX,t.clientY)),this.update()},this.onPointerMove=t=>{this.timelineState?.isPlayingCameraAnimation?this.dispatchEvent(_):!1!==this.enabled&&(this.checkRaycastLock()||("touch"===t.pointerType||"pen"===t.pointerType&&n?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t),t.stopPropagation()))},this.onPointerUp=t=>{this.isPointerDown=!1,0===e.length&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),e.length>1&&t.preventDefault(),this.hasChange?this.dispatchEvent(0===this.state?X:Y):this.dispatchEvent(K),this.state=-1,t&&(t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&n||this.domElement.releasePointerCapture(t.pointerId))},this.onPointerDownMouse=t=>{let e;switch(e=this.useKeyEvents?this.mouseButtons[t.button]:this.mouseButtonsPlay[t.button],e){case 0:if(!0!==t.altKey||t.shiftKey||z(t)){if(" "===this.key){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 4:if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(z(t)||t.shiftKey){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(z(t)||t.shiftKey){if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}else{if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(!1===this.enableRotate)return;this.handleMouseMoveRotate(t);break;case 1:if(!1===this.enableZoom)return;this.handleMouseMoveDolly(t);break;case 2:if(!1===this.enablePan)return;this.handleMouseMovePan(t)}this.object.wasMovedByUser=!0},this.onPointerDownTouch=t=>{switch(e.length>1&&t.preventDefault(),this.touches[e.length-1]){case G.ROTATE:if(!1===this.enableRotate)return void(this.state=-1);this.handleTouchStartRotate(),this.state=3;break;case G.PAN:if(!1===this.enablePan)return void(this.state=-1);this.handleTouchStartPan(),this.state=4;break;case G.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(),this.state=5;break;case G.DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=t=>{switch(e.length>1&&t.preventDefault(),this.state){case 3:if(!1===this.enableRotate)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(!1===this.enablePan)return;this.handleTouchMovePan(t),this.update();break;case 5:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=m(()=>{this.zoomChanged?this.dispatchEvent(N):this.dispatchEvent(Y),this.zoomChanged=!1},33),this.onMouseWheel=t=>{if(!1!==this.enabled&&(!1!==this.enableZoom||!1!==this.enablePan)&&!this.checkRaycastLock()){if(!this.options.isExport&&this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth&&t.preventDefault(),this.dispatchEvent(U),this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(_);t.ctrlKey&&this.enableZoom&&t.preventDefault(),this.handleMouseWheel(t),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0}},this.onGesture=t=>{if(t.preventDefault(),!1!==this.enabled&&!this.checkRaycastLock()&&!o){if(this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(_);if("gesturechange"===t.type){if(!1===this.enableZoom||!1===this.isTouchZoom)return;this.dispatchEvent(U),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(Y)}},this.onContextMenu=t=>{t.preventDefault()},this.onTouchEnd=t=>{t.preventDefault()},this.onKeyDown=t=>{!1!==this.enabled&&(this.key=t.key," "===t.key&&this.dispatchEvent(U))},this.onKeyUp=t=>{this.key=void 0,!1!==this.enabled&&(-1!==this.state&&"Alt"===t.key&&this.onPointerUp(e[0])," "===t.key&&this.dispatchEvent(Y))},this.onPointerHover=t=>{"mouse"!==t.pointerType||!1===this.enabled||-1!==this.state||2===this.hoverRotatePanMode&&this.isPanOverShoot||1===this.hoverRotatePanMode&&this.isRotateOverShoot||(this.isPointerDown=!0,2===this.hoverRotatePanMode?this.handleMouseMovePan(t,this.hoverRotatePanStrength):1===this.hoverRotatePanMode&&this.handleMouseMoveRotate(t,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=t=>{t.isfromEntity&&this.options.isPlayMode||(this.enabled=!0,this.needsUpdate=!0,this.object.updateUp(),this.object.getTarget(this.target))},this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat0=this.object.quaternion.clone(),this.isUpVectorFlipped0=this.object.isUpVectorFlipped,this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(et,it,$),this.offset.copy(et).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.initialSphericalRadius=this.spherical.radius,this.addEventListenersToCamera()}dispatchEvent(t){"start"===t.type?this.hasChange=!1:this.hasChange=!0,super.dispatchEvent(t)}addEventListenersToCamera(){this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)}removeEventListenersFromCamera(){this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange)}updateUseWindowEvents(t){if(window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("pointermove",this.onPointerHover),this.useWindowEvents=t,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover)),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}}fromJSON(t,e){this.rotateFactor=t.rotationSpeed??1,this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.thetaIsFree=t.rotationHorizontalOffset.min===t.rotationHorizontalOffset.max&&t.rotationHorizontalOffset.min===Math.PI,this.phiIsFree=t.rotationVerticalOffset.min===t.rotationVerticalOffset.max&&t.rotationVerticalOffset.min===Math.PI,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.hoverRotateDamping=t.hoverRotateDamping??this.dampingFactor,this.useWindowEvents="window"===e,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=t.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,this.autoRotateSpeed=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let s=this.object.getTarget().applyQuaternion(q.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+s.y,this.maxV=t.panVerticalOffset.max+s.y,this.minH=-t.panHorizontalOffset.min+s.x,this.maxH=t.panHorizontalOffset.max+s.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=nt(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=nt(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=nt(nt(this.spherical.theta)-t.rotationHorizontalOffset.min),this.maxTheta=nt(nt(this.spherical.theta)+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,1===t.orbitTouches&&(this.touches[0]=G.ROTATE),1===t.panTouches&&(this.touches[0]=G.PAN),2===t.orbitTouches&&(this.touches[1]=G.DOLLY_ROTATE),2===t.panTouches&&(this.touches[1]=G.DOLLY_PAN),3===t.orbitTouches&&(this.touches[2]=G.ROTATE),3===t.panTouches&&(this.touches[2]=G.PAN),this.isTouchZoom=t.isTouchZoom,this.resetHoverEffectOnPointerLeave=t.resetHoverEffectOnPointerLeave??!1}connect(){if(this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture),this.domElement.addEventListener("touchend",this.onTouchEnd),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}this.pointerLeaveEvent=void 0}dispose(){this.removeEventListenersFromCamera(),this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,e,i,s,o,a,n,r){let h,l,d;this.overShoot.set(0,0),t instanceof D?(h=t.x,l=t.y,this.current.set(this.target.x,this.target.y),d=!0):(h=t.theta,l=t.phi,this.current.set(nt(this.spherical.theta),nt(this.spherical.phi)),d=!1),0===i&&(this.current.x+=h,this.current.y+=l),(3===e||2===e)&&(!d&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x)),(3===e||1===e)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<n&&(this.overShoot.y=n-this.current.y)),d||(this.overShoot.x=nt(this.overShoot.x),this.overShoot.y=nt(this.overShoot.y)),0!==i?(this.overRatio.copy(this.overShoot).divide(r),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),1===i&&(this.overRatio.x=rt(Math.abs(this.overRatio.x)),this.overRatio.y=rt(Math.abs(this.overRatio.y))),this.isPointerDown||1===i?2===i&&(this.overRatio.x>.9&&!this.thetaIsFree||this.overRatio.y>.9&&!this.phiIsFree)?this.isPointerDown=!1:(h*this.overShoot.x<0&&!this.thetaIsFree&&(h*=1-this.overRatio.x),l*this.overShoot.y<0&&!this.phiIsFree&&(l*=1-this.overRatio.y)):2===i&&(!d&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||d&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(h=.05*this.overShoot.x),this.phiIsFree||(l=.05*this.overShoot.y),d?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):d?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(h+=this.overShoot.x,l+=this.overShoot.y),t instanceof D?(t.x=h,t.y=l):(this.thetaIsFree||(t.theta=h),this.phiIsFree||(t.phi=l))}setEnableDampingSpeed(t){this.enableDamping=t,this.rotateSpeed=(!0===t?.2:1)*this.rotateFactor}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0,this.panOffset.set(0,0,0)}setTarget(t,e,i){this.stopDamping(),this.target.set(t,e,i)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,e){this.panLeftV.setFromMatrixColumn(e,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,e){this.panUpV.setFromMatrixColumn(e,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,e){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/i.clientHeight,this.object.matrixWorld),this.panUp(2*e*o/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(Z)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(Z)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(Z)}setZoom(t){if(this.dispatchEvent(U),this.object.isPerspectiveCamera){let e=this.initialSphericalRadius/t/this.spherical.radius;this.scale=e}else this.object.isOrthographicCamera&&(this.object.zoom=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0);this.dispatchEvent(Y)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,e=1){void 0!==t.movementX?this.rotateDelta.set(t.movementX,t.movementY):(this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd)),this.rotateDelta.multiplyScalar(this.rotateSpeed*e).rotateAround(Q,-this.object.angleOffsetFromUp);let i=this.domElement,s=this.useWindowEvents?window.innerHeight:i.clientHeight,o=2*Math.PI*this.rotateDelta.x/s,a=2*Math.PI*this.rotateDelta.y/s;this.rotateLeft(o),this.rotateUp(a),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,e=1){void 0!==t.movementX?this.panDelta.set(t.movementX,t.movementY):(this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panStart.copy(this.panEnd)),this.panDelta.multiplyScalar(this.panSpeed*e),this.pan(this.panDelta.x,this.panDelta.y),this.update()}handleMouseWheel(t){if(0===t.deltaX&&0===t.deltaY)return;let e=!0===t.ctrlKey||!0===z(t),i=!1===z(t)&&!0===(0===(r=t).wheelDeltaY||0===r.deltaY?!(s&&r.shiftKey&&Math.abs(r.wheelDeltaX)>=120)&&(r.wheelDeltaX?H(r.wheelDeltaX,r.deltaX):0===r.deltaMode):r.wheelDeltaY?H(r.wheelDeltaY,r.deltaY):0===r.deltaMode),o=!1===e&&(!0===this.gesture||t.timeStamp-this.lastTrackpadPanTime<300),n=!1===e&&!1===o&&t.timeStamp-this.lastMouseWheelZoomTime<300;var r;if(!1!==a||!1!==n||!0!==i&&!0!==o){if(!1===this.enableZoom)return;this.gesture&&(window.clearTimeout(this.timer),this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Y)),!1===e&&!1===i&&(this.lastMouseWheelZoomTime=t.timeStamp),0===t.deltaY?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}else{if(!1===this.enablePan)return;let e=!1===this.gesture&&!1===o;this.lastTrackpadPanTime=t.timeStamp,this.gesture||(this.gesture=!0,this.isPointerDown=!0),!1===e&&(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(this.panSpeed),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Y)},100)}}handleTouchStartRotate(){if(2===e.length){let t=.5*(e[0].pageX+e[1].pageX),i=.5*(e[0].pageY+e[1].pageY);this.rotateStart.set(t,i)}else this.rotateStart.set(e[0].pageX,e[0].pageY)}handleTouchStartPan(){if(2===e.length){let t=.5*(e[0].pageX+e[1].pageX),i=.5*(e[0].pageY+e[1].pageY);this.panStart.set(t,i)}else this.panStart.set(e[0].pageX,e[0].pageY)}handleTouchStartDolly(){let t=e[0].pageX-e[1].pageX,i=e[0].pageY-e[1].pageY,s=Math.sqrt(t*t+i*i);this.dollyStart.set(0,s)}handleTouchStartDollyPan(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(2===e.length){let e=i(t),s=.5*(t.pageX+e.x),o=.5*(t.pageY+e.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==e[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);let s=this.domElement;s&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/s.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/s.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(2===e.length){let e=i(t),s=.5*(t.pageX+e.x),o=.5*(t.pageY+e.y);this.panEnd.set(s,o)}else{if(t.pointerId!==e[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let e=i(t),s=t.pageX-e.x,o=t.pageY-e.y,a=Math.sqrt(s*s+o*o);this.dollyEnd.set(0,a),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}checkRaycastLock(){if(this.object.data.raycastLock){if(this.options.isPlayMode)return!1;{let t=this.options?.showCameraLock;return t&&t(),!0}}return!1}};function nt(t){let e=2*Math.PI;for(;t<=-Math.PI;)t+=e;for(;t>Math.PI;)t-=e;return t}function rt(t){return 1-Math.pow(1-t,4)}var ht,lt,dt=new Promise(t=>{ht=t});function ct(t){return lt||(lt=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.161/build",i=import("./physics.js"),[s,o]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(t=>t.arrayBuffer())]);await s.init(o),ht(s)}())}function pt(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,s=e[4]**2+e[5]**2+e[6]**2,o=e[8]**2+e[9]**2+e[10]**2,a=e[0]**2+e[4]**2+e[8]**2,n=e[1]**2+e[5]**2+e[9]**2,r=e[2]**2+e[6]**2+e[10]**2,h=1e-8;return i<h||s<h||o<h||a<h||n<h||r<h}function mt(t,e){let i=new W;if(e&&pt(e))return i.setAttribute("position",new B([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new B([],3)),i.setIndex([]),i;let{positions:s,triIndices:o}=h(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new B(s,3)),i.setIndex(o),e&&i.applyMatrix4(e),i}var ut,yt=class{constructor(t,e,i,s,o,a){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=d(e,e.actions,s,o,a,i),this.target=e.target}disconnect(){c(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>t.play()),this.actions.Animation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},vt=class{constructor(t,e,i,s,o,a){this.id=t,this.data=e,this.object=i,this.page=s,this.currentIntersectedObjects=[],this.actions=d(e,e.actions,s,o,a,i),this.target=e.target,this.triggeringObjects=[];for(let t of e.triggeringObjects){let e=s.scene.findFrom(t,i);e&&this.triggeringObjects.push(e)}}isValidTriggeringObject(t){return"all"===this.target||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){c(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};dt.then(t=>ut=t);var gt=new D,ft=new T,bt=new D,Et=new D(1,1,1),Pt=(new R(0,0,0,"YXZ"),new R(0,0,0,"XYZ")),Ct=new D,Mt=new D,xt=new T,Tt=new S,Dt=new S,St={type:"updateMatrix"},wt=(new T,new A),Rt=.01,jt={type:"beginEvent",eventName:"Collision"},Lt={type:"beginEvent",eventName:"Trigger"};function Gt(t){if(E.physicsEnabled(t.scene.objects))return!0;let e=!1;return t.scene.objects.traverse((t,i)=>{if(i.events)if(Array.isArray(i.events)){for(let t of i.events)if(!0!==t.data.disabled&&"GameControl"===t.data.type&&t.data.collisionEnabled){e=!0;break}}else for(let t of Object.values(i.events))if(!0!==t.disabled&&"GameControl"===t.type&&t.collisionEnabled){e=!0;break}}),e}var Bt=t=>t.states.some(t=>void 0!==t.data.position||void 0!==t.data.rotation||void 0!==t.data.shear||void 0!==t.data.cloner||void 0!==t.data.pathSnapping);function At(t){return v(f(t)?t.object:t)}var Wt,Ot,It,Ft=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=t=>{if(t.bodyType()!==ut.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,i]=this.rigidBodyToMesh.get(t.handle);if(gt.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),ft.copy(t.rotation()),e.matrixWorld.makeRotationFromQuaternion(ft).setPosition(gt),e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(St),i){let t=e.cloner;if(t&&void 0===t.objectForSample){t.matrixWorld.copy(e.matrixWorld);for(let e of t.children)e.updateMatrixWorld(!0)}for(let t of e.children)t.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(t,e,i)=>{if(!1===i)return;let s,o;if(this.sensorToTriggerEvent[t]?(s=this.sensorToTriggerEvent[t],o=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(s=this.sensorToTriggerEvent[e],o=this.sharedGameControlGlobals.colliderToEntity.get(t)),s&&o&&s.isValidTriggeringObject(o))s.dispatch();else{for(let i=this.sharedGameControlGlobals.createdObjects.length-1;i>=0;i--){let s=this.sharedGameControlGlobals.createdObjects[i];if(s.userData.hasCollisionDestroy&&(s.rigidBody?.collider(0).handle===t||s.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(i,1),s.removeFromParent();let t=s.rigidBody;requestAnimationFrame(()=>{s.rigidBody===t&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(t),s.rigidBody=void 0)});break}}if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let t=this.sharedGameControlGlobals.colliderToEntity.get(e),i=this.sharedGameControlGlobals.entityToCollisionEvents[t.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,t,e)}else if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let e=this.sharedGameControlGlobals.colliderToEntity.get(t),i=this.sharedGameControlGlobals.entityToCollisionEvents[e.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,e,t)}else{let i=this.sharedGameControlGlobals.colliderToEntity.get(t),s=this.sharedGameControlGlobals.entityToCollisionEvents[i.uuid];if(void 0!==s)for(let e of s)"scene"===e.data.target&&this.dispatchCollisionEvent(e,i,t);let o=this.sharedGameControlGlobals.colliderToEntity.get(e),a=this.sharedGameControlGlobals.entityToCollisionEvents[o?.uuid];if(void 0!==a)for(let t of a)"scene"===t.data.target&&this.dispatchCollisionEvent(t,o,e)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events){if(!0===t.data.disabled)continue;let e=t.data.actions?.find(t=>"Destroy"===t.data.type)?.data;if(e)for(let t of e.objects){let e=this.page.scene.find(t);e&&(e.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events)if(!0!==t.data.disabled&&"DragDrop"===t.data.type)for(let e of t.data.objects){let t=this.page.scene.find(e);t&&(t.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return void 0===e&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(null===t())return void b("collision-bvh","trigger/collision detection");let e=[],i=[];if(this.page.traverseChildren(t=>{let s,o=t instanceof r,a=u(t);if(g(t)||o||a)return;s=f(t)?t.object:t;let n=s.dataPatched;if("visibility"===n.physics?.enabled?!n.visible:!n.physics?.enabled)return!0;let h=t.geometry,l=!0===s.userData.hasDestroy,d=!0===s.userData.hasDrag;if(Bt(n)||l||d||s.dataPatched.events.some(t=>!0!==t.data.disabled&&("GameControl"===t.data.type||"Follow"===t.data.type)))return t.updateMatrixWorldRigid(),this.addBoundsTree(t),!0;if(h){let s=h.getAttribute("position");if(void 0!==s&&s.count>0){e.push({geometry:h,matrixWorld:t.matrixWorld}),i.push(h.id,this._staticBVHIdOf(s),s.version,null!==h.index?this._staticBVHIdOf(h.index):-1,null!==h.index?h.index.version:-1);for(let e of t.matrixWorld.elements)i.push(e)}}return!!At(t)||void 0}),e.length>0){let s=this._staticBVHCache;if(void 0!==s&&s.signature.length===i.length&&s.signature.every((t,e)=>t===i[e]))return void(this.sharedGameControlGlobals.staticMeshBVH=s.bvh);let o=e.map(t=>mt(t.geometry,t.matrixWorld)),a=l(o,!1),n=new(t())(a);this._staticBVHCache={signature:i,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(t,e,i){if(pt(t.matrixWorld))return;let s=[],o="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(void 0!==o?.getAttribute("position")&&s.push(mt(o,t.shearScale)),a.physics.fusedBody){let e=this.gatherChildrenGeom(t,s);t.traverseObject(e),t.children.forEach(t=>t.updateMatrixWorld(!0));let i=t.cloner;i&&void 0===i.objectForSample&&"dynamic"===a.physics.rigidBody&&(i.traverseObject(e),i.children.forEach(t=>t.updateMatrixWorld(!0)))}if(s.length>0){let o,n=!1,r=!i.fromCreate&&"dynamic"===a.physics.rigidBody||i.fromCreate&&i.dynamic;r?(o=ut.RigidBodyDesc.dynamic(),o.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(o=ut.RigidBodyDesc.kinematicPositionBased(),n=!0):o=ut.RigidBodyDesc.fixed();let h=l(s);gt.setFromMatrixPosition(t.matrixWorld),ft.setFromRotationMatrix(t.matrixWorldRigid),t.position0=gt.clone().divideScalar(this.pixelsPerMeter),t.rotation0=ft.clone(),gt.divideScalar(this.pixelsPerMeter),o.setTranslation(gt.x,gt.y,gt.z).setRotation(ft),h?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let d=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o),c=!(void 0===a.geometry||"SubdivGeometry"===a.geometry.type||"NonParametricGeometry"===a.geometry.type||"BooleanGeometry"===a.geometry.type||"VectorGeometry"===a.geometry.type||"StarGeometry"===a.geometry.type||"RectangleGeometry"===a.geometry.type||"EllipseGeometry"===a.geometry.type||"TriangleGeometry"===a.geometry.type||"TorusGeometry"===a.geometry.type||"HelixGeometry"===a.geometry.type);try{this.addCollider(d,a.physics,h,e,c)}catch{try{this.addCollider(d,a.physics,h,e,!1)}catch(t){console.error(t)}}if(0===d.numColliders())return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(d);r?this.rigidBodyToMesh.set(d.handle,[t,a.physics.fusedBody]):n?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(d.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,d,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=d}}addBoundsTree(e){let i=[];if(void 0!==e.geometry?.getAttribute("position")&&e.geometry?.getAttribute("position").count>0&&i.push(mt(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,i)),e.children.forEach(t=>t.updateMatrixWorld(!0)),i.length>0){let s=l(i,!1);e.bvhGeometry=s,s.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(t())(s),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(t,e,i,s,o=!0){if(0===i?.getAttribute("position").count||0===i?.getIndex()?.count)return;let a;i&&(a="trimesh"===e.colliderType?ut.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):ut.ColliderDesc.convexMesh(i.getAttribute("position").array,o?i.getIndex().array:void 0)),a.setFrictionCombineRule(ut.CoefficientCombineRule.Average).setRestitutionCombineRule(ut.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let n=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t);this.sharedGameControlGlobals.colliderToEntity.set(n.handle,s),this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]?.some(t=>"scene"===t.target)&&n.setActiveEvents(ut.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=At(t);return(s,o)=>{if(0===o)return;if(i&&s.parent===t)return!0;let a;if(g(s)){if(!s.objectForSample)return!0===s.object.dataPatched.physics.fusedBody&&"dynamic"===s.object.dataPatched.physics.rigidBody||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;a=s.object}else if(f(s))a=s.object;else if(a=s,a.dataPatched.cloner?.hideBase)return!0;let n=a.dataPatched;if("visibility"===n.physics.enabled?!n.visible:!n.physics.enabled)return!0;1===o?s.matrixWorld.copy(t.shearScale):s.matrixWorld.copy(s.parent.matrixWorld),s.matrixWorld.multiply(s.matrix);let r=s.geometry;return void 0!==r?.getAttribute("position")&&e.push(mt(r,s.matrixWorld)),!!At(s)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(!1===e.data.disabled&&"Trigger"===e.data.type)return this.needsCollisionDetection=!0,!0});let s=k();if(null!==s?i=s.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:null!==this.page.data.publish.gameControlObject&&b("game-controls","the scene's game controls"),!1===i){let{enableRotate:t,enablePan:i,enableZoom:s,autoRotate:o,hoverRotatePanMode:a}=this.eventManager.publish.orbitControls;(t||i||s||o||0!==a)&&(this.orbitControls=new at(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let o=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();k()?.createJoysticks(this,o,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(t=>t.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new ut.World(new ut.Vector3(0,this.gravity,0)),this.events=new ut.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(i=>{let s;if(g(i)){if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;if(i.objectForSample.dataPatched.physics.fusedBody)return;s=i.object}else if(f(i))s=i.object;else{if(u(i)||y(i)||i instanceof r)return;if(s=i,!1===s.dataPatched.cloner?.disabled&&s.dataPatched.cloner?.hideBase&&!0!==s.dataPatched.physics?.fusedBody)return!0}let o,a=s.dataPatched;for(let t of a.events)!0!==t.data.disabled&&"GameControl"===t.data.type&&(o=t.data);if(!a.physics||("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled))return!0;i.updateMatrixWorldRigid();let n=Bt(a),h=!1,l=s.userData.hasDestroy,d=s.userData.hasDrag,c=!1;for(let t of a.events)if(!0!==t.data.disabled)if("Collision"===t.data.type){h=!0;let e=new yt(t.id,t.data,s,this.page,this.sharedAssets,this.eventManager);e.initialDisabled=!0,this.collisionEvents.push(e),this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid].every(e=>e.id!==t.id)?this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid].push(e):this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]=[e]}else if("Follow"===t.data.type){c=!0;let e=t.data.target;i.traverseVisible(t=>{t.userData.isFollowingObj=e})}"dynamic"===a.physics.rigidBody&&!1===a.physics.fusedBody&&(i.matrixWorldFusedFalse=i.matrixWorld.clone());let p=i.geometry;if(void 0!==o){let t=ut.RigidBodyDesc.kinematicPositionBased();(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(gt,ft,bt),i.position0=gt.clone().divideScalar(this.pixelsPerMeter),i.rotation0=ft.clone(),gt.divideScalar(this.pixelsPerMeter),t.setTranslation(gt.x,gt.y,gt.z).setRotation(ft);let e,n=this.sharedGameControlGlobals.rapierWorld.createRigidBody(t);i.rigidBody=n,e="sphere"===o.collider.type?ut.ColliderDesc.ball(o.collider.radius/this.pixelsPerMeter):"capsule"===o.collider.type?ut.ColliderDesc.capsule((o.collider.height/2-o.collider.radius)/this.pixelsPerMeter,o.collider.radius/this.pixelsPerMeter):ut.ColliderDesc.cuboid(o.collider.width/this.pixelsPerMeter/2,o.collider.height/this.pixelsPerMeter/2,o.collider.depth/this.pixelsPerMeter/2),e.setFrictionCombineRule(ut.CoefficientCombineRule.Average).setDensity(a.physics.density).setFriction(a.physics.friction).setRestitution(0).setRestitutionCombineRule(ut.CoefficientCombineRule.Min);let r=this.sharedGameControlGlobals.rapierWorld.createCollider(e,n);this.sharedGameControlGlobals.colliderToEntity.set(r.handle,s),gt.fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)).multiply(bt.setFromMatrixScale(s.matrixWorld)).divideScalar(this.pixelsPerMeter),r.setTranslationWrtParent(gt);let h=(new T).setFromEuler((new R).setFromVector3((new D).fromArray(o.collider.rotation.map(t=>"number"==typeof t?t:0))));r.setRotationWrtParent(h),r.setActiveEvents(ut.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(s,!0)}else"dynamic"===a.physics.rigidBody||n||c||l||d||h?(this.addRigidBody(i,s,{hasFollow:c,hasTransformAnim:n,hasDrag:d}),this.generateSensorColliderDescs(s,a.physics.fusedBody)):(p&&t.push(mt(p,i.matrixWorld)),a.physics.fusedBody&&!At(i)&&i.traverseObject((e,i)=>{if(0===i)return;let s;if(g(e)){if(!e.objectForSample)return!0===e.object.dataPatched.physics.fusedBody&&"dynamic"===e.object.dataPatched.physics.rigidBody||void 0;if(e.objectForSample.dataPatched.physics.fusedBody)return;s=e.object}else{if(u(e)||y(e)||e instanceof r)return;if(f(e))s=e.object;else if(s=e,s.dataPatched.cloner?.hideBase)return!0}let o=s.dataPatched;if("visibility"===o.physics.enabled?!o.visible:!o.physics.enabled)return!0;let a=e.geometry;return void 0!==a?.getAttribute("position")&&t.push(mt(a,e.matrixWorld)),!!At(e)||void 0}),this.generateSensorColliderDescs(s,a.physics.fusedBody,e));return!(!0!==a.physics?.fusedBody&&!o&&!At(i))||void 0}),0===t.length)return;let i=l(t),s=i.getIndex().count>0;if(!s&&0===e.length)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let o=ut.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o);if(s){let t=ut.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(ut.CoefficientCombineRule.Multiply).setRestitutionCombineRule(ut.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(t,a)}for(let[t,i]of e){let e=this.sharedGameControlGlobals.rapierWorld.createCollider(t,a);this.sensorToTriggerEvent[e.handle]=i}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let i=new vt(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),s=(new S).compose(Ct.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),xt.setFromEuler(Pt.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Et);if("box"===e.data.triggerZone){let o=new L;o.min.fromArray(e.data.size.map(t=>"number"==typeof t?t:0)).multiplyScalar(-.5),o.max.fromArray(e.data.size.map(t=>"number"==typeof t?t:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([o,s,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,s,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(void 0!==this.orbitControls&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):2===this.initializationCounter&&this.gameControl&&(e=!this.gameControl.update(t)&&e),!1===this.usePhysics&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(0===t)e=this.stepPhysics()&&e;else{let s=t/1e3;s<i&&s>.55*i&&(s=i),this.accumulator+=s;let o=performance.now(),a=0,n=6;for(;this.accumulator>=i&&a<n&&(e=this.stepPhysics()&&e,this.accumulator-=i,a++,!(performance.now()-o>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(gt,ft,bt);let e=t;void 0===e.prevQ?(e.prevQ=ft.clone(),e.prevT=gt.clone()):(e.prevQ.copy(ft),e.prevT.copy(gt))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,s]=this.fixedBodiesToWatch[t];e.rigidBody===i?(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(s)||(i.setBodyType(ut.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1)):this.fixedBodiesToWatch.splice(t,1)}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(void 0===t)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),s=t.translation(),o=Math.hypot(i.x,i.z);for(let a=0;a<t.numColliders();a++){let n=t.collider(a);e.contactPairsWith(n,t=>{let a=t.parent();if(null===a||!a.isDynamic())return;let r=a.translation(),h=-1/0,l=0,d=0;if(e.contactPair(n,t,t=>{let e=t.normal(),o=e.x*(r.x-s.x)+e.y*(r.y-s.y)+e.z*(r.z-s.z)<0?-1:1;if(Math.abs(e.y)>.7)return;let a=o*e.x,n=o*e.z,c=Math.hypot(a,n);if(c<1e-4)return;let p=(i.x*a+i.z*n)/c;p>h&&(h=p,l=a/c,d=n/c)}),h===-1/0)return;let c=i.x*l+i.z*d;if(c<-Rt)return;let p=a.linvel();if(o>Rt&&c>Rt){let t=p.x*l+p.z*d;if(t<=0)return;let e=Math.min(t,c);return void a.setLinvel({x:l*e,y:p.y,z:d*e},!0)}let m=p.x*l+p.z*d-Math.max(0,c);if(m<=0)return;let u=.5*m;a.setLinvel({x:p.x-l*u,y:p.y,z:p.z-d*u},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let t=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[e,i]of t)void 0!==i.rigidBody?(this.recordPhysicsPose(i),i.rigidBody.setNextKinematicTranslation(gt.divideScalar(this.pixelsPerMeter)),i.rigidBody.setNextKinematicRotation(ft)):t.delete(e);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)!0!==t.rigidBody?.isKinematic()&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let s,o=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner)for(let t of e.cloner.children)if(t.rigidBody===o){s=t;break}t.dispatch(s),e.dispatchEvent(jt)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let s=Dt.copy(t.matrixWorld).invert();t.traverseEntity((o,a)=>{if(!1===e&&1===a)return!0;for(let e of o.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let a,n=new vt(e.id,e.data,o,this.page,this.sharedAssets,this.eventManager);if(a="box"===e.data.triggerZone?ut.ColliderDesc.cuboid(...e.data.size.map(t=>("number"==typeof t?t:1)/(2*this.pixelsPerMeter))):ut.ColliderDesc.ball(e.data.radius/this.pixelsPerMeter),a.setDensity(0).setSensor(!0).setActiveEvents(ut.ActiveEvents.COLLISION_EVENTS),Ct.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),xt.setFromEuler(Pt.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Tt.makeRotationFromEuler(Pt).setPosition(Ct).premultiply(o.matrixWorld),i?(C(Tt,{translation:Ct,quaternion:xt,scale:Mt}),a.setActiveCollisionTypes(ut.ActiveCollisionTypes.KINEMATIC_FIXED|ut.ActiveCollisionTypes.DYNAMIC_FIXED)):(C(Tt.premultiply(s),{translation:Ct,quaternion:xt,scale:Mt}),t.rigidBody.bodyType()===ut.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===ut.RigidBodyType.Fixed?a.setActiveCollisionTypes(ut.ActiveCollisionTypes.KINEMATIC_FIXED|ut.ActiveCollisionTypes.DYNAMIC_FIXED):a.setActiveCollisionTypes(ut.ActiveCollisionTypes.KINEMATIC_KINEMATIC|ut.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Ct.divideScalar(this.pixelsPerMeter),a.setTranslation(Ct.x,Ct.y,Ct.z),a.setRotation(xt),i)i.push([a,n]);else{let e=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t.rigidBody);this.sensorToTriggerEvent[e.handle]=n}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,s,o,a]=this.sharedGameControlGlobals.triggers[e];for(let e=0;e<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;e++){let n=this.sharedGameControlGlobals.entitiesWithTransformAnim[e];if(o===n||!1===a.isValidTriggeringObject(p.is(n)?n:n.object))continue;let r=Dt.copy(P(o.matrixWorld)).copyPosition(o.matrixWorld).multiply(s),h=Tt.copy(n.matrixWorld).invert().multiply(r),l=n.bvhGeometry.boundsTree;i instanceof L?t=l.intersectsBox(i,h):(wt.radius=i,wt.center.setFromMatrixPosition(h),t=l.intersectsSphere(wt)),t?-1===a.currentIntersectedObjects.indexOf(n)&&(a.currentIntersectedObjects.push(n),a.dispatch(),o.dispatchEvent(Lt)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(t=>t!==n)}}}},kt=new Promise(t=>{Wt=t});function Vt(t){return It||(It=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.161/build";typeof window<"u"&&(Ot=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[s,o]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(t=>t.arrayBuffer())]),a=s.default,n=await a({wasmBinary:o});Wt(n)}())}export{at as a,ct as b,O as c,F as d,V as e,mt as f,jt as g,Gt as h,Bt as i,Ft as j,kt as k,Ot as l,Vt as m};
1
+ import{b as t}from"./runtime-chunk-N2ZRGNPR.js";import{a as e,c as i}from"./runtime-chunk-VAVYZ35B.js";import{b as s,c as o,d as a,e as n}from"./runtime-chunk-FQNSP44B.js";import{a as r}from"./runtime-chunk-TOQFUFTK.js";import{L as h,a as l}from"./runtime-chunk-IVAJEJLH.js";import{f as d,g as c}from"./runtime-chunk-UNI3D2MC.js";import{h as p}from"./runtime-chunk-E2NZABAD.js";import{a as m}from"./runtime-chunk-RTLL6WIB.js";import{a as u,b as y,g as v,h as g,i as f}from"./runtime-chunk-2PT2WH66.js";import{c as b}from"./runtime-chunk-TZCHGFVF.js";import{Ga as E,Ta as P,Ua as C}from"./runtime-chunk-ADHKZQMB.js";import{Dc as M,Fc as x,Gc as T,Hc as D,Qc as S,Qe as w,Rc as R,Tc as j,Zc as L,b as G,dd as B,ed as A,fd as W}from"./runtime-chunk-KPOUV3HD.js";var O=200,I=null;function F(t){I=t}function k(){return I}function V(t){let e=!1;return t.scene.objects.forEach(i=>{"Page"===i.data.type&&!e&&i.data.publish.gameControlObject&&E.traverseModuleInstances(t,i.id,(t,i,s)=>{for(let t of s)"GameControl"===t.data.type&&t.data.navmesh.enabled&&(e=!0)})}),e}function z(t){return s?t.metaKey:t.ctrlKey}function H(t,e){return Math.abs(t+3*e)<=2||Math.abs(t+3*window.devicePixelRatio*e)<=2}var Z={type:"change"},U={type:"start"},Y={type:"end",nonOrbit:!0},X={type:"end",nonOrbit:!1},N={type:"end",isZoom:!0,nonOrbit:!0},K={type:"end",changed:!1},_={type:"cameraAnimatingInTimeline"},q=new T,Q=new x,J=2*Math.PI,$=new D,tt=new x,et=new D,it=new T,st=new S,ot={type:"requestRender"},at=class extends M{constructor(t,i,s={isPlayMode:!1,isExport:!1},a){super(),this.object=t,this.domElement=i,this.options=s,this.timelineState=a,this.enabled=!0,this.useKeyEvents=!0,this.enableDamping=!1,this.enableZoom=!0,this.enableRotate=!0,this.enablePan=!0,this.autoRotate=!1,this.rotationLimitsMode=0,this.panLimitsMode=0,this.rotationSoftLimit=2,this.panSoftLimit=2,this.hoverRotatePanMode=0,this.zoomLimitsEnabled=!1,this.mouseButtons=[0,5],this.mouseButtonsPlay=[3,4,5],this.touches=[null,G.DOLLY_ROTATE,G.PAN],this.offset=new D,this.eye=new D,this.lastPosition=new D,this.lastQuaternion=new T,this.current=new x,this.overShoot=new x,this.overRatio=new x,this.spherical=new w,this.sphericalDelta=new w,this.panOffset=new D,this.panLeftV=new D,this.panUpV=new D,this.panV=new D,this.rotateStart=new x,this.rotateEnd=new x,this.rotateDelta=new x,this.panStart=new x,this.panEnd=new x,this.panDelta=new x,this.dollyStart=new x,this.dollyEnd=new x,this.dollyDelta=new x,this.rotationRangeFactor=new x,this.panRangeFactor=new x,this.state=-1,this.zoomChanged=!1,this.isPointerDown=!1,this.isThetaFlipped=!1,this.prevScale=0,this.scale=1,this.gesture=!1,this.lastTrackpadPanTime=-1/0,this.lastMouseWheelZoomTime=-1/0,this.timer=-1,this.timerHover=-1,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPhi=0,this.maxPhi=Math.PI,this.minTheta=-1/0,this.maxTheta=1/0,this.minH=0,this.maxH=Math.PI,this.minV=-1/0,this.maxV=1/0,this.autoRotateClockwise=!0,this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.resetHoverEffectOnPointerLeave=!1,this.hasChange=!1,this.useWindowEvents=!1,this.isTouchZoom=!0,this.autoRotateSpeed=2,this.dampingFactor=.125,this.zoomSpeed=2,this.rotateSpeed=1,this.rotateFactor=1,this.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=t=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=t.camera,this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)},this.update=()=>{this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(et,it,$),this.offset.copy(et).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&-1===this.state&&this.rotateLeft((!0===this.autoRotateClockwise?1:-1)*this.getAutoRotationAngle()),0!==this.rotationLimitsMode&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),2!==this.rotationLimitsMode&&(this.spherical.phi+=this.sphericalDelta.phi),(1!==this.rotationLimitsMode||!0===this.autoRotate)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&this.object.isPerspectiveCamera&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),0!==this.panLimitsMode&&(this.target.applyQuaternion(q.copy(it).invert()),this.panOffset.applyQuaternion(q),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(it),this.panOffset.applyQuaternion(it)),2===this.panLimitsMode&&(this.panOffset.y=0),1===this.panLimitsMode&&(this.panOffset.x=0),-1!==this.state||this.gesture?(this.target.add(this.panOffset),this.panOffset.set(0,0,0)):(this.panOffset.multiplyScalar(1-this.dampingFactor),this.target.add(this.panOffset)),this.offset.setFromSpherical(this.spherical),et.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(st.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(st));let t=this.spherical.phi%J;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(j.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),t>0&&t>Math.PI||t<0&&t>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),-1===this.state||!0===this.enableDamping){let t=1===this.hoverRotatePanMode?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-t,this.sphericalDelta.phi*=1-t}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8)return this.dispatchEvent(Z),this.object.dispatchEvent(ot),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),void(this.isCurrentlyDamping=!0);this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.isCurrentlyDamping=!1},this.onPointerDown=t=>{!1!==this.enabled&&("touch"===t.pointerType||"pen"===t.pointerType&&n?this.onPointerDownTouch(t):this.onPointerDownMouse(t),-1!==this.state&&(this.isPointerDown=!0,this.dispatchEvent(U),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&n||this.domElement.setPointerCapture(t.pointerId)))},this.onPointerLeave=t=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(1===this.hoverRotatePanMode?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,$.subVectors(this.position0,this.target0),this.spherical.setFromVector3($),this.sphericalDelta.theta+=this.spherical.theta,this.sphericalDelta.phi+=this.spherical.phi,this.sphericalDelta.theta/=8,this.sphericalDelta.phi/=8):2===this.hoverRotatePanMode&&this.panOffset.subVectors(this.target0,this.target).divideScalar(8),this.update()):this.pointerLeaveEvent=t},this.onPointerEnter=t=>{this.resetHoverEffectOnPointerLeave||void 0===this.pointerLeaveEvent?tt.set(t.clientX-this.domElement.clientWidth/2,t.clientY-this.domElement.clientHeight/2):tt.set(t.clientX-this.pointerLeaveEvent.clientX,t.clientY-this.pointerLeaveEvent.clientY),1===this.hoverRotatePanMode?(this.rotateDelta.copy(tt).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(Q,-this.object.angleOffsetFromUp),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight),this.rotateStart.set(t.clientX,t.clientY)):2===this.hoverRotatePanMode&&(this.panDelta.copy(tt).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(t.clientX,t.clientY)),this.update()},this.onPointerMove=t=>{this.timelineState?.isPlayingCameraAnimation?this.dispatchEvent(_):!1!==this.enabled&&(this.checkRaycastLock()||("touch"===t.pointerType||"pen"===t.pointerType&&n?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t),t.stopPropagation()))},this.onPointerUp=t=>{this.isPointerDown=!1,0===e.length&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),e.length>1&&t.preventDefault(),this.hasChange?this.dispatchEvent(0===this.state?X:Y):this.dispatchEvent(K),this.state=-1,t&&(t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&n||this.domElement.releasePointerCapture(t.pointerId))},this.onPointerDownMouse=t=>{let e;switch(e=this.useKeyEvents?this.mouseButtons[t.button]:this.mouseButtonsPlay[t.button],e){case 0:if(!0!==t.altKey||t.shiftKey||z(t)){if(" "===this.key){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 4:if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(z(t)||t.shiftKey){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(z(t)||t.shiftKey){if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}else{if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(!1===this.enableRotate)return;this.handleMouseMoveRotate(t);break;case 1:if(!1===this.enableZoom)return;this.handleMouseMoveDolly(t);break;case 2:if(!1===this.enablePan)return;this.handleMouseMovePan(t)}this.object.wasMovedByUser=!0},this.onPointerDownTouch=t=>{switch(e.length>1&&t.preventDefault(),this.touches[e.length-1]){case G.ROTATE:if(!1===this.enableRotate)return void(this.state=-1);this.handleTouchStartRotate(),this.state=3;break;case G.PAN:if(!1===this.enablePan)return void(this.state=-1);this.handleTouchStartPan(),this.state=4;break;case G.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(),this.state=5;break;case G.DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=t=>{switch(e.length>1&&t.preventDefault(),this.state){case 3:if(!1===this.enableRotate)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(!1===this.enablePan)return;this.handleTouchMovePan(t),this.update();break;case 5:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=m(()=>{this.zoomChanged?this.dispatchEvent(N):this.dispatchEvent(Y),this.zoomChanged=!1},33),this.onMouseWheel=t=>{if(!1!==this.enabled&&(!1!==this.enableZoom||!1!==this.enablePan)&&!this.checkRaycastLock()){if(!this.options.isExport&&this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth&&t.preventDefault(),this.dispatchEvent(U),this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(_);t.ctrlKey&&this.enableZoom&&t.preventDefault(),this.handleMouseWheel(t),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0}},this.onGesture=t=>{if(t.preventDefault(),!1!==this.enabled&&!this.checkRaycastLock()&&!o){if(this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(_);if("gesturechange"===t.type){if(!1===this.enableZoom||!1===this.isTouchZoom)return;this.dispatchEvent(U),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(Y)}},this.onContextMenu=t=>{t.preventDefault()},this.onTouchEnd=t=>{t.preventDefault()},this.onKeyDown=t=>{!1!==this.enabled&&(this.key=t.key," "===t.key&&this.dispatchEvent(U))},this.onKeyUp=t=>{this.key=void 0,!1!==this.enabled&&(-1!==this.state&&"Alt"===t.key&&this.onPointerUp(e[0])," "===t.key&&this.dispatchEvent(Y))},this.onPointerHover=t=>{"mouse"!==t.pointerType||!1===this.enabled||-1!==this.state||2===this.hoverRotatePanMode&&this.isPanOverShoot||1===this.hoverRotatePanMode&&this.isRotateOverShoot||(this.isPointerDown=!0,2===this.hoverRotatePanMode?this.handleMouseMovePan(t,this.hoverRotatePanStrength):1===this.hoverRotatePanMode&&this.handleMouseMoveRotate(t,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=t=>{t.isfromEntity&&this.options.isPlayMode||(this.enabled=!0,this.needsUpdate=!0,this.object.updateUp(),this.object.getTarget(this.target))},this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat0=this.object.quaternion.clone(),this.isUpVectorFlipped0=this.object.isUpVectorFlipped,this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(et,it,$),this.offset.copy(et).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.initialSphericalRadius=this.spherical.radius,this.addEventListenersToCamera()}dispatchEvent(t){"start"===t.type?this.hasChange=!1:this.hasChange=!0,super.dispatchEvent(t)}addEventListenersToCamera(){this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)}removeEventListenersFromCamera(){this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange)}updateUseWindowEvents(t){if(window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("pointermove",this.onPointerHover),this.useWindowEvents=t,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover)),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}}fromJSON(t,e){this.rotateFactor=t.rotationSpeed??1,this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.thetaIsFree=t.rotationHorizontalOffset.min===t.rotationHorizontalOffset.max&&t.rotationHorizontalOffset.min===Math.PI,this.phiIsFree=t.rotationVerticalOffset.min===t.rotationVerticalOffset.max&&t.rotationVerticalOffset.min===Math.PI,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.hoverRotateDamping=t.hoverRotateDamping??this.dampingFactor,this.useWindowEvents="window"===e,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=t.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,this.autoRotateSpeed=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let s=this.object.getTarget().applyQuaternion(q.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+s.y,this.maxV=t.panVerticalOffset.max+s.y,this.minH=-t.panHorizontalOffset.min+s.x,this.maxH=t.panHorizontalOffset.max+s.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=nt(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=nt(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=nt(nt(this.spherical.theta)-t.rotationHorizontalOffset.min),this.maxTheta=nt(nt(this.spherical.theta)+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,1===t.orbitTouches&&(this.touches[0]=G.ROTATE),1===t.panTouches&&(this.touches[0]=G.PAN),2===t.orbitTouches&&(this.touches[1]=G.DOLLY_ROTATE),2===t.panTouches&&(this.touches[1]=G.DOLLY_PAN),3===t.orbitTouches&&(this.touches[2]=G.ROTATE),3===t.panTouches&&(this.touches[2]=G.PAN),this.isTouchZoom=t.isTouchZoom,this.resetHoverEffectOnPointerLeave=t.resetHoverEffectOnPointerLeave??!1}connect(){if(this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture),this.domElement.addEventListener("touchend",this.onTouchEnd),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}this.pointerLeaveEvent=void 0}dispose(){this.removeEventListenersFromCamera(),this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,e,i,s,o,a,n,r){let h,l,d;this.overShoot.set(0,0),t instanceof D?(h=t.x,l=t.y,this.current.set(this.target.x,this.target.y),d=!0):(h=t.theta,l=t.phi,this.current.set(nt(this.spherical.theta),nt(this.spherical.phi)),d=!1),0===i&&(this.current.x+=h,this.current.y+=l),(3===e||2===e)&&(!d&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x)),(3===e||1===e)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<n&&(this.overShoot.y=n-this.current.y)),d||(this.overShoot.x=nt(this.overShoot.x),this.overShoot.y=nt(this.overShoot.y)),0!==i?(this.overRatio.copy(this.overShoot).divide(r),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),1===i&&(this.overRatio.x=rt(Math.abs(this.overRatio.x)),this.overRatio.y=rt(Math.abs(this.overRatio.y))),this.isPointerDown||1===i?2===i&&(this.overRatio.x>.9&&!this.thetaIsFree||this.overRatio.y>.9&&!this.phiIsFree)?this.isPointerDown=!1:(h*this.overShoot.x<0&&!this.thetaIsFree&&(h*=1-this.overRatio.x),l*this.overShoot.y<0&&!this.phiIsFree&&(l*=1-this.overRatio.y)):2===i&&(!d&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||d&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(h=.05*this.overShoot.x),this.phiIsFree||(l=.05*this.overShoot.y),d?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):d?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(h+=this.overShoot.x,l+=this.overShoot.y),t instanceof D?(t.x=h,t.y=l):(this.thetaIsFree||(t.theta=h),this.phiIsFree||(t.phi=l))}setEnableDampingSpeed(t){this.enableDamping=t,this.rotateSpeed=(!0===t?.2:1)*this.rotateFactor}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0,this.panOffset.set(0,0,0)}setTarget(t,e,i){this.stopDamping(),this.target.set(t,e,i)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,e){this.panLeftV.setFromMatrixColumn(e,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,e){this.panUpV.setFromMatrixColumn(e,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,e){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/i.clientHeight,this.object.matrixWorld),this.panUp(2*e*o/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(Z)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(Z)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(Z)}setZoom(t){if(this.dispatchEvent(U),this.object.isPerspectiveCamera){let e=this.initialSphericalRadius/t/this.spherical.radius;this.scale=e}else this.object.isOrthographicCamera&&(this.object.zoom=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0);this.dispatchEvent(Y)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,e=1){void 0!==t.movementX?this.rotateDelta.set(t.movementX,t.movementY):(this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd)),this.rotateDelta.multiplyScalar(this.rotateSpeed*e).rotateAround(Q,-this.object.angleOffsetFromUp);let i=this.domElement,s=this.useWindowEvents?window.innerHeight:i.clientHeight,o=2*Math.PI*this.rotateDelta.x/s,a=2*Math.PI*this.rotateDelta.y/s;this.rotateLeft(o),this.rotateUp(a),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,e=1){void 0!==t.movementX?this.panDelta.set(t.movementX,t.movementY):(this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panStart.copy(this.panEnd)),this.panDelta.multiplyScalar(this.panSpeed*e),this.pan(this.panDelta.x,this.panDelta.y),this.update()}handleMouseWheel(t){if(0===t.deltaX&&0===t.deltaY)return;let e=!0===t.ctrlKey||!0===z(t),i=!1===z(t)&&!0===(0===(r=t).wheelDeltaY||0===r.deltaY?!(s&&r.shiftKey&&Math.abs(r.wheelDeltaX)>=120)&&(r.wheelDeltaX?H(r.wheelDeltaX,r.deltaX):0===r.deltaMode):r.wheelDeltaY?H(r.wheelDeltaY,r.deltaY):0===r.deltaMode),o=!1===e&&(!0===this.gesture||t.timeStamp-this.lastTrackpadPanTime<300),n=!1===e&&!1===o&&t.timeStamp-this.lastMouseWheelZoomTime<300;var r;if(!1!==a||!1!==n||!0!==i&&!0!==o){if(!1===this.enableZoom)return;this.gesture&&(window.clearTimeout(this.timer),this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Y)),!1===e&&!1===i&&(this.lastMouseWheelZoomTime=t.timeStamp),0===t.deltaY?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}else{if(!1===this.enablePan)return;let e=!1===this.gesture&&!1===o;this.lastTrackpadPanTime=t.timeStamp,this.gesture||(this.gesture=!0,this.isPointerDown=!0),!1===e&&(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(this.panSpeed),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Y)},100)}}handleTouchStartRotate(){if(2===e.length){let t=.5*(e[0].pageX+e[1].pageX),i=.5*(e[0].pageY+e[1].pageY);this.rotateStart.set(t,i)}else this.rotateStart.set(e[0].pageX,e[0].pageY)}handleTouchStartPan(){if(2===e.length){let t=.5*(e[0].pageX+e[1].pageX),i=.5*(e[0].pageY+e[1].pageY);this.panStart.set(t,i)}else this.panStart.set(e[0].pageX,e[0].pageY)}handleTouchStartDolly(){let t=e[0].pageX-e[1].pageX,i=e[0].pageY-e[1].pageY,s=Math.sqrt(t*t+i*i);this.dollyStart.set(0,s)}handleTouchStartDollyPan(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(2===e.length){let e=i(t),s=.5*(t.pageX+e.x),o=.5*(t.pageY+e.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==e[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);let s=this.domElement;s&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/s.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/s.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(2===e.length){let e=i(t),s=.5*(t.pageX+e.x),o=.5*(t.pageY+e.y);this.panEnd.set(s,o)}else{if(t.pointerId!==e[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let e=i(t),s=t.pageX-e.x,o=t.pageY-e.y,a=Math.sqrt(s*s+o*o);this.dollyEnd.set(0,a),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}checkRaycastLock(){if(this.object.data.raycastLock){if(this.options.isPlayMode)return!1;{let t=this.options?.showCameraLock;return t&&t(),!0}}return!1}};function nt(t){let e=2*Math.PI;for(;t<=-Math.PI;)t+=e;for(;t>Math.PI;)t-=e;return t}function rt(t){return 1-Math.pow(1-t,4)}var ht,lt,dt=new Promise(t=>{ht=t});function ct(t){return lt||(lt=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.162/build",i=import("./physics.js"),[s,o]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(t=>t.arrayBuffer())]);await s.init(o),ht(s)}())}function pt(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,s=e[4]**2+e[5]**2+e[6]**2,o=e[8]**2+e[9]**2+e[10]**2,a=e[0]**2+e[4]**2+e[8]**2,n=e[1]**2+e[5]**2+e[9]**2,r=e[2]**2+e[6]**2+e[10]**2,h=1e-8;return i<h||s<h||o<h||a<h||n<h||r<h}function mt(t,e){let i=new W;if(e&&pt(e))return i.setAttribute("position",new B([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new B([],3)),i.setIndex([]),i;let{positions:s,triIndices:o}=h(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new B(s,3)),i.setIndex(o),e&&i.applyMatrix4(e),i}var ut,yt=class{constructor(t,e,i,s,o,a){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=d(e,e.actions,s,o,a,i),this.target=e.target}disconnect(){c(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>t.play()),this.actions.Animation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},vt=class{constructor(t,e,i,s,o,a){this.id=t,this.data=e,this.object=i,this.page=s,this.currentIntersectedObjects=[],this.actions=d(e,e.actions,s,o,a,i),this.target=e.target,this.triggeringObjects=[];for(let t of e.triggeringObjects){let e=s.scene.findFrom(t,i);e&&this.triggeringObjects.push(e)}}isValidTriggeringObject(t){return"all"===this.target||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){c(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};dt.then(t=>ut=t);var gt=new D,ft=new T,bt=new D,Et=new D(1,1,1),Pt=(new R(0,0,0,"YXZ"),new R(0,0,0,"XYZ")),Ct=new D,Mt=new D,xt=new T,Tt=new S,Dt=new S,St={type:"updateMatrix"},wt=(new T,new A),Rt=.01,jt={type:"beginEvent",eventName:"Collision"},Lt={type:"beginEvent",eventName:"Trigger"};function Gt(t){if(E.physicsEnabled(t.scene.objects))return!0;let e=!1;return t.scene.objects.traverse((t,i)=>{if(i.events)if(Array.isArray(i.events)){for(let t of i.events)if(!0!==t.data.disabled&&"GameControl"===t.data.type&&t.data.collisionEnabled){e=!0;break}}else for(let t of Object.values(i.events))if(!0!==t.disabled&&"GameControl"===t.type&&t.collisionEnabled){e=!0;break}}),e}var Bt=t=>t.states.some(t=>void 0!==t.data.position||void 0!==t.data.rotation||void 0!==t.data.shear||void 0!==t.data.cloner||void 0!==t.data.pathSnapping);function At(t){return v(f(t)?t.object:t)}var Wt,Ot,It,Ft=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=t=>{if(t.bodyType()!==ut.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,i]=this.rigidBodyToMesh.get(t.handle);if(gt.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),ft.copy(t.rotation()),e.matrixWorld.makeRotationFromQuaternion(ft).setPosition(gt),e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(St),i){let t=e.cloner;if(t&&void 0===t.objectForSample){t.matrixWorld.copy(e.matrixWorld);for(let e of t.children)e.updateMatrixWorld(!0)}for(let t of e.children)t.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(t,e,i)=>{if(!1===i)return;let s,o;if(this.sensorToTriggerEvent[t]?(s=this.sensorToTriggerEvent[t],o=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(s=this.sensorToTriggerEvent[e],o=this.sharedGameControlGlobals.colliderToEntity.get(t)),s&&o&&s.isValidTriggeringObject(o))s.dispatch();else{for(let i=this.sharedGameControlGlobals.createdObjects.length-1;i>=0;i--){let s=this.sharedGameControlGlobals.createdObjects[i];if(s.userData.hasCollisionDestroy&&(s.rigidBody?.collider(0).handle===t||s.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(i,1),s.removeFromParent();let t=s.rigidBody;requestAnimationFrame(()=>{s.rigidBody===t&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(t),s.rigidBody=void 0)});break}}if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let t=this.sharedGameControlGlobals.colliderToEntity.get(e),i=this.sharedGameControlGlobals.entityToCollisionEvents[t.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,t,e)}else if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let e=this.sharedGameControlGlobals.colliderToEntity.get(t),i=this.sharedGameControlGlobals.entityToCollisionEvents[e.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,e,t)}else{let i=this.sharedGameControlGlobals.colliderToEntity.get(t),s=this.sharedGameControlGlobals.entityToCollisionEvents[i.uuid];if(void 0!==s)for(let e of s)"scene"===e.data.target&&this.dispatchCollisionEvent(e,i,t);let o=this.sharedGameControlGlobals.colliderToEntity.get(e),a=this.sharedGameControlGlobals.entityToCollisionEvents[o?.uuid];if(void 0!==a)for(let t of a)"scene"===t.data.target&&this.dispatchCollisionEvent(t,o,e)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events){if(!0===t.data.disabled)continue;let e=t.data.actions?.find(t=>"Destroy"===t.data.type)?.data;if(e)for(let t of e.objects){let e=this.page.scene.find(t);e&&(e.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events)if(!0!==t.data.disabled&&"DragDrop"===t.data.type)for(let e of t.data.objects){let t=this.page.scene.find(e);t&&(t.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return void 0===e&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(null===t())return void b("collision-bvh","trigger/collision detection");let e=[],i=[];if(this.page.traverseChildren(t=>{let s,o=t instanceof r,a=u(t);if(g(t)||o||a)return;s=f(t)?t.object:t;let n=s.dataPatched;if("visibility"===n.physics?.enabled?!n.visible:!n.physics?.enabled)return!0;let h=t.geometry,l=!0===s.userData.hasDestroy,d=!0===s.userData.hasDrag;if(Bt(n)||l||d||s.dataPatched.events.some(t=>!0!==t.data.disabled&&("GameControl"===t.data.type||"Follow"===t.data.type)))return t.updateMatrixWorldRigid(),this.addBoundsTree(t),!0;if(h){let s=h.getAttribute("position");if(void 0!==s&&s.count>0){e.push({geometry:h,matrixWorld:t.matrixWorld}),i.push(h.id,this._staticBVHIdOf(s),s.version,null!==h.index?this._staticBVHIdOf(h.index):-1,null!==h.index?h.index.version:-1);for(let e of t.matrixWorld.elements)i.push(e)}}return!!At(t)||void 0}),e.length>0){let s=this._staticBVHCache;if(void 0!==s&&s.signature.length===i.length&&s.signature.every((t,e)=>t===i[e]))return void(this.sharedGameControlGlobals.staticMeshBVH=s.bvh);let o=e.map(t=>mt(t.geometry,t.matrixWorld)),a=l(o,!1),n=new(t())(a);this._staticBVHCache={signature:i,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(t,e,i){if(pt(t.matrixWorld))return;let s=[],o="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(void 0!==o?.getAttribute("position")&&s.push(mt(o,t.shearScale)),a.physics.fusedBody){let e=this.gatherChildrenGeom(t,s);t.traverseObject(e),t.children.forEach(t=>t.updateMatrixWorld(!0));let i=t.cloner;i&&void 0===i.objectForSample&&"dynamic"===a.physics.rigidBody&&(i.traverseObject(e),i.children.forEach(t=>t.updateMatrixWorld(!0)))}if(s.length>0){let o,n=!1,r=!i.fromCreate&&"dynamic"===a.physics.rigidBody||i.fromCreate&&i.dynamic;r?(o=ut.RigidBodyDesc.dynamic(),o.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(o=ut.RigidBodyDesc.kinematicPositionBased(),n=!0):o=ut.RigidBodyDesc.fixed();let h=l(s);gt.setFromMatrixPosition(t.matrixWorld),ft.setFromRotationMatrix(t.matrixWorldRigid),t.position0=gt.clone().divideScalar(this.pixelsPerMeter),t.rotation0=ft.clone(),gt.divideScalar(this.pixelsPerMeter),o.setTranslation(gt.x,gt.y,gt.z).setRotation(ft),h?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let d=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o),c=!(void 0===a.geometry||"SubdivGeometry"===a.geometry.type||"NonParametricGeometry"===a.geometry.type||"BooleanGeometry"===a.geometry.type||"VectorGeometry"===a.geometry.type||"StarGeometry"===a.geometry.type||"RectangleGeometry"===a.geometry.type||"EllipseGeometry"===a.geometry.type||"TriangleGeometry"===a.geometry.type||"TorusGeometry"===a.geometry.type||"HelixGeometry"===a.geometry.type);try{this.addCollider(d,a.physics,h,e,c)}catch{try{this.addCollider(d,a.physics,h,e,!1)}catch(t){console.error(t)}}if(0===d.numColliders())return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(d);r?this.rigidBodyToMesh.set(d.handle,[t,a.physics.fusedBody]):n?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(d.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,d,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=d}}addBoundsTree(e){let i=[];if(void 0!==e.geometry?.getAttribute("position")&&e.geometry?.getAttribute("position").count>0&&i.push(mt(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,i)),e.children.forEach(t=>t.updateMatrixWorld(!0)),i.length>0){let s=l(i,!1);e.bvhGeometry=s,s.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(t())(s),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(t,e,i,s,o=!0){if(0===i?.getAttribute("position").count||0===i?.getIndex()?.count)return;let a;i&&(a="trimesh"===e.colliderType?ut.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):ut.ColliderDesc.convexMesh(i.getAttribute("position").array,o?i.getIndex().array:void 0)),a.setFrictionCombineRule(ut.CoefficientCombineRule.Average).setRestitutionCombineRule(ut.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let n=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t);this.sharedGameControlGlobals.colliderToEntity.set(n.handle,s),this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]?.some(t=>"scene"===t.target)&&n.setActiveEvents(ut.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=At(t);return(s,o)=>{if(0===o)return;if(i&&s.parent===t)return!0;let a;if(g(s)){if(!s.objectForSample)return!0===s.object.dataPatched.physics.fusedBody&&"dynamic"===s.object.dataPatched.physics.rigidBody||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;a=s.object}else if(f(s))a=s.object;else if(a=s,a.dataPatched.cloner?.hideBase)return!0;let n=a.dataPatched;if("visibility"===n.physics.enabled?!n.visible:!n.physics.enabled)return!0;1===o?s.matrixWorld.copy(t.shearScale):s.matrixWorld.copy(s.parent.matrixWorld),s.matrixWorld.multiply(s.matrix);let r=s.geometry;return void 0!==r?.getAttribute("position")&&e.push(mt(r,s.matrixWorld)),!!At(s)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(!1===e.data.disabled&&"Trigger"===e.data.type)return this.needsCollisionDetection=!0,!0});let s=k();if(null!==s?i=s.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:null!==this.page.data.publish.gameControlObject&&b("game-controls","the scene's game controls"),!1===i){let{enableRotate:t,enablePan:i,enableZoom:s,autoRotate:o,hoverRotatePanMode:a}=this.eventManager.publish.orbitControls;(t||i||s||o||0!==a)&&(this.orbitControls=new at(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let o=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();k()?.createJoysticks(this,o,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(t=>t.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new ut.World(new ut.Vector3(0,this.gravity,0)),this.events=new ut.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(i=>{let s;if(g(i)){if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;if(i.objectForSample.dataPatched.physics.fusedBody)return;s=i.object}else if(f(i))s=i.object;else{if(u(i)||y(i)||i instanceof r)return;if(s=i,!1===s.dataPatched.cloner?.disabled&&s.dataPatched.cloner?.hideBase&&!0!==s.dataPatched.physics?.fusedBody)return!0}let o,a=s.dataPatched;for(let t of a.events)!0!==t.data.disabled&&"GameControl"===t.data.type&&(o=t.data);if(!a.physics||("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled))return!0;i.updateMatrixWorldRigid();let n=Bt(a),h=!1,l=s.userData.hasDestroy,d=s.userData.hasDrag,c=!1;for(let t of a.events)if(!0!==t.data.disabled)if("Collision"===t.data.type){h=!0;let e=new yt(t.id,t.data,s,this.page,this.sharedAssets,this.eventManager);e.initialDisabled=!0,this.collisionEvents.push(e),this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid].every(e=>e.id!==t.id)?this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid].push(e):this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]=[e]}else if("Follow"===t.data.type){c=!0;let e=t.data.target;i.traverseVisible(t=>{t.userData.isFollowingObj=e})}"dynamic"===a.physics.rigidBody&&!1===a.physics.fusedBody&&(i.matrixWorldFusedFalse=i.matrixWorld.clone());let p=i.geometry;if(void 0!==o){let t=ut.RigidBodyDesc.kinematicPositionBased();(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(gt,ft,bt),i.position0=gt.clone().divideScalar(this.pixelsPerMeter),i.rotation0=ft.clone(),gt.divideScalar(this.pixelsPerMeter),t.setTranslation(gt.x,gt.y,gt.z).setRotation(ft);let e,n=this.sharedGameControlGlobals.rapierWorld.createRigidBody(t);i.rigidBody=n,e="sphere"===o.collider.type?ut.ColliderDesc.ball(o.collider.radius/this.pixelsPerMeter):"capsule"===o.collider.type?ut.ColliderDesc.capsule((o.collider.height/2-o.collider.radius)/this.pixelsPerMeter,o.collider.radius/this.pixelsPerMeter):ut.ColliderDesc.cuboid(o.collider.width/this.pixelsPerMeter/2,o.collider.height/this.pixelsPerMeter/2,o.collider.depth/this.pixelsPerMeter/2),e.setFrictionCombineRule(ut.CoefficientCombineRule.Average).setDensity(a.physics.density).setFriction(a.physics.friction).setRestitution(0).setRestitutionCombineRule(ut.CoefficientCombineRule.Min);let r=this.sharedGameControlGlobals.rapierWorld.createCollider(e,n);this.sharedGameControlGlobals.colliderToEntity.set(r.handle,s),gt.fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)).multiply(bt.setFromMatrixScale(s.matrixWorld)).divideScalar(this.pixelsPerMeter),r.setTranslationWrtParent(gt);let h=(new T).setFromEuler((new R).setFromVector3((new D).fromArray(o.collider.rotation.map(t=>"number"==typeof t?t:0))));r.setRotationWrtParent(h),r.setActiveEvents(ut.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(s,!0)}else"dynamic"===a.physics.rigidBody||n||c||l||d||h?(this.addRigidBody(i,s,{hasFollow:c,hasTransformAnim:n,hasDrag:d}),this.generateSensorColliderDescs(s,a.physics.fusedBody)):(p&&t.push(mt(p,i.matrixWorld)),a.physics.fusedBody&&!At(i)&&i.traverseObject((e,i)=>{if(0===i)return;let s;if(g(e)){if(!e.objectForSample)return!0===e.object.dataPatched.physics.fusedBody&&"dynamic"===e.object.dataPatched.physics.rigidBody||void 0;if(e.objectForSample.dataPatched.physics.fusedBody)return;s=e.object}else{if(u(e)||y(e)||e instanceof r)return;if(f(e))s=e.object;else if(s=e,s.dataPatched.cloner?.hideBase)return!0}let o=s.dataPatched;if("visibility"===o.physics.enabled?!o.visible:!o.physics.enabled)return!0;let a=e.geometry;return void 0!==a?.getAttribute("position")&&t.push(mt(a,e.matrixWorld)),!!At(e)||void 0}),this.generateSensorColliderDescs(s,a.physics.fusedBody,e));return!(!0!==a.physics?.fusedBody&&!o&&!At(i))||void 0}),0===t.length)return;let i=l(t),s=i.getIndex().count>0;if(!s&&0===e.length)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let o=ut.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o);if(s){let t=ut.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(ut.CoefficientCombineRule.Multiply).setRestitutionCombineRule(ut.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(t,a)}for(let[t,i]of e){let e=this.sharedGameControlGlobals.rapierWorld.createCollider(t,a);this.sensorToTriggerEvent[e.handle]=i}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let i=new vt(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),s=(new S).compose(Ct.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),xt.setFromEuler(Pt.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Et);if("box"===e.data.triggerZone){let o=new L;o.min.fromArray(e.data.size.map(t=>"number"==typeof t?t:0)).multiplyScalar(-.5),o.max.fromArray(e.data.size.map(t=>"number"==typeof t?t:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([o,s,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,s,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(void 0!==this.orbitControls&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):2===this.initializationCounter&&this.gameControl&&(e=!this.gameControl.update(t)&&e),!1===this.usePhysics&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(0===t)e=this.stepPhysics()&&e;else{let s=t/1e3;s<i&&s>.55*i&&(s=i),this.accumulator+=s;let o=performance.now(),a=0,n=6;for(;this.accumulator>=i&&a<n&&(e=this.stepPhysics()&&e,this.accumulator-=i,a++,!(performance.now()-o>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(gt,ft,bt);let e=t;void 0===e.prevQ?(e.prevQ=ft.clone(),e.prevT=gt.clone()):(e.prevQ.copy(ft),e.prevT.copy(gt))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,s]=this.fixedBodiesToWatch[t];e.rigidBody===i?(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(s)||(i.setBodyType(ut.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1)):this.fixedBodiesToWatch.splice(t,1)}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(void 0===t)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),s=t.translation(),o=Math.hypot(i.x,i.z);for(let a=0;a<t.numColliders();a++){let n=t.collider(a);e.contactPairsWith(n,t=>{let a=t.parent();if(null===a||!a.isDynamic())return;let r=a.translation(),h=-1/0,l=0,d=0;if(e.contactPair(n,t,t=>{let e=t.normal(),o=e.x*(r.x-s.x)+e.y*(r.y-s.y)+e.z*(r.z-s.z)<0?-1:1;if(Math.abs(e.y)>.7)return;let a=o*e.x,n=o*e.z,c=Math.hypot(a,n);if(c<1e-4)return;let p=(i.x*a+i.z*n)/c;p>h&&(h=p,l=a/c,d=n/c)}),h===-1/0)return;let c=i.x*l+i.z*d;if(c<-Rt)return;let p=a.linvel();if(o>Rt&&c>Rt){let t=p.x*l+p.z*d;if(t<=0)return;let e=Math.min(t,c);return void a.setLinvel({x:l*e,y:p.y,z:d*e},!0)}let m=p.x*l+p.z*d-Math.max(0,c);if(m<=0)return;let u=.5*m;a.setLinvel({x:p.x-l*u,y:p.y,z:p.z-d*u},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let t=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[e,i]of t)void 0!==i.rigidBody?(this.recordPhysicsPose(i),i.rigidBody.setNextKinematicTranslation(gt.divideScalar(this.pixelsPerMeter)),i.rigidBody.setNextKinematicRotation(ft)):t.delete(e);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)!0!==t.rigidBody?.isKinematic()&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let s,o=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner)for(let t of e.cloner.children)if(t.rigidBody===o){s=t;break}t.dispatch(s),e.dispatchEvent(jt)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let s=Dt.copy(t.matrixWorld).invert();t.traverseEntity((o,a)=>{if(!1===e&&1===a)return!0;for(let e of o.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let a,n=new vt(e.id,e.data,o,this.page,this.sharedAssets,this.eventManager);if(a="box"===e.data.triggerZone?ut.ColliderDesc.cuboid(...e.data.size.map(t=>("number"==typeof t?t:1)/(2*this.pixelsPerMeter))):ut.ColliderDesc.ball(e.data.radius/this.pixelsPerMeter),a.setDensity(0).setSensor(!0).setActiveEvents(ut.ActiveEvents.COLLISION_EVENTS),Ct.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),xt.setFromEuler(Pt.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Tt.makeRotationFromEuler(Pt).setPosition(Ct).premultiply(o.matrixWorld),i?(C(Tt,{translation:Ct,quaternion:xt,scale:Mt}),a.setActiveCollisionTypes(ut.ActiveCollisionTypes.KINEMATIC_FIXED|ut.ActiveCollisionTypes.DYNAMIC_FIXED)):(C(Tt.premultiply(s),{translation:Ct,quaternion:xt,scale:Mt}),t.rigidBody.bodyType()===ut.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===ut.RigidBodyType.Fixed?a.setActiveCollisionTypes(ut.ActiveCollisionTypes.KINEMATIC_FIXED|ut.ActiveCollisionTypes.DYNAMIC_FIXED):a.setActiveCollisionTypes(ut.ActiveCollisionTypes.KINEMATIC_KINEMATIC|ut.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Ct.divideScalar(this.pixelsPerMeter),a.setTranslation(Ct.x,Ct.y,Ct.z),a.setRotation(xt),i)i.push([a,n]);else{let e=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t.rigidBody);this.sensorToTriggerEvent[e.handle]=n}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,s,o,a]=this.sharedGameControlGlobals.triggers[e];for(let e=0;e<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;e++){let n=this.sharedGameControlGlobals.entitiesWithTransformAnim[e];if(o===n||!1===a.isValidTriggeringObject(p.is(n)?n:n.object))continue;let r=Dt.copy(P(o.matrixWorld)).copyPosition(o.matrixWorld).multiply(s),h=Tt.copy(n.matrixWorld).invert().multiply(r),l=n.bvhGeometry.boundsTree;i instanceof L?t=l.intersectsBox(i,h):(wt.radius=i,wt.center.setFromMatrixPosition(h),t=l.intersectsSphere(wt)),t?-1===a.currentIntersectedObjects.indexOf(n)&&(a.currentIntersectedObjects.push(n),a.dispatch(),o.dispatchEvent(Lt)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(t=>t!==n)}}}},kt=new Promise(t=>{Wt=t});function Vt(t){return It||(It=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.162/build";typeof window<"u"&&(Ot=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[s,o]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(t=>t.arrayBuffer())]),a=s.default,n=await a({wasmBinary:o});Wt(n)}())}export{at as a,ct as b,O as c,F as d,V as e,mt as f,jt as g,Gt as h,Bt as i,Ft as j,kt as k,Ot as l,Vt as m};
@@ -1 +1 @@
1
- import{v as e}from"./runtime-chunk-CAU75OZB.js";import{$c as t,Gc as s,Hc as a,Hd as i,Ib as r,Ic as n,Ie as h,Qc as o,Vc as l,Yd as d,Zd as c,md as u,nd as g}from"./runtime-chunk-KPOUV3HD.js";var p=null;function b(e){p=e}function S(){return p}var m=null;function f(e){m=e}function M(){return m}var y=new l;function R(e,t,s){return y.setRGB(e,t,s,r),{r:y.r,g:y.g,b:y.b}}var w=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t,x=e=>Array.isArray(e)&&"number"==typeof e[0]&&"number"==typeof e[1]?[e[0],e[1]]:[0,0];function v(e,t,s){let a,i=w(e.angle,0),[r,n]=x(e.offset),[h,o]=x(e.morph),l=e.colors??[],d=e.steps??[],c=Math.min(10,l.length,d.length);if(0===c)return[1,1,1,1];if(1===e.gradientType){let e=3*(t+h)-(t+r)-1,l=3*(s+o)-(s+n)-1;a=Math.hypot(e,l)+i}else if(2===e.gradientType){let e=-1*Math.atan2(t+h-.5+r,s+o-.5+n),l=i/Math.PI/-2+.5*e/Math.PI;a=l-Math.floor(l)}else{let e=.5+h/(0!==t?t:1e-6),l=o/(0!==s?s:1e-6),d=Math.cos(i)*e-Math.sin(i)*l,c=Math.sin(i)*e+Math.cos(i)*l,u=d*d+c*c;a=u>1e-12?(((t-.5+r)/2+d/2)*d+((s-.5+n)/2+c/2)*c)/u:0}let u=l[0][0],g=l[0][1],p=l[0][2],b=l[0][3];for(let t=1;t<c;t++){let s=d[t-1],i=d[t]-s,r=0!==i?Math.min(1,Math.max(0,(a-s)/i)):a>=s?1:0;e.smooth&&(r=r*r*(3-2*r)),u+=(l[t][0]-u)*r,g+=(l[t][1]-g)*r,p+=(l[t][2]-p)*r,b+=(l[t][3]-b)*r}return[u,g,p,b]}function A(e,t){let s=e,a=s?.data?.layers;if(a&&"function"==typeof a.forEach){let e=t,s=[];return a.forEach(t=>{let a=t.data;if(!1===a.visible||!0===a.isMask)return;let i=w(a.alpha,1);if(!(i<=0))if("color"===a.type){let t,r=a.color;"string"==typeof r?t="function"==typeof e?.color?e.color(r):void 0:r&&"number"==typeof r.r&&(t=r),t&&s.push({kind:"color",layer:a,rgb:{...R(t.r,t.g,t.b),a:t.a??1},alpha:i})}else"gradient"===a.type&&s.push({kind:"gradient",layer:a,alpha:i})}),0===s.length?null:(e,t)=>{let a=1,i=1,r=1,n=!0;for(let h of s){let s,o,l,d;if("color"===h.kind)({r:s,g:o,b:l}=h.rgb),d=h.rgb.a;else{let[a,i,r,n]=v(h.layer,e,t);({r:s,g:o,b:l}=R(a,i,r)),d=n}let c=n?1:Math.min(1,Math.max(0,d*h.alpha));a+=(s-a)*c,i+=(o-i)*c,r+=(l-r)*c,n=!1}return{r:a,g:i,b:r}}}if(s?.color&&!0===s.color.isColor){let{r:e,g:t,b:a}=s.color;return()=>({r:e,g:t,b:a})}return null}var j=32,I=16384,B=32*I,H=100;function F(e,t){if("torus"===e){let e=t()*Math.PI*2,s=t()*Math.PI*2,a=Math.cos(e),i=Math.sin(e),r=Math.cos(s),n=Math.sin(s);return{x:(1.4+.7*r)*a,y:-(1.4+.7*r)*i,z:.7*n,nx:r*a,ny:-r*i,nz:n,cr:1,cg:1,cb:1}}if("cylinder"===e){let e=t()*Math.PI*2,s=Math.cos(e),a=Math.sin(e);return{x:.8*s,y:1.6*(t()-.5),z:.8*a,nx:s,ny:0,nz:a,cr:1,cg:1,cb:1}}let s=t()*Math.PI*2,a=2*t()-1,i=Math.acos(a),r=Math.sin(i)*Math.cos(s),n=Math.cos(i),h=Math.sin(i)*Math.sin(s);return{x:r,y:n,z:h,nx:r,ny:n,nz:h,cr:1,cg:1,cb:1}}function W(e){let{geometry:t,matrix:s}=e,a=t.getAttribute("position");if(!a||a.count<3)return null;let i=t.getAttribute("normal"),r=t.getAttribute("uv"),h=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:a.count/3;if(l<1)return null;let d=(e,t)=>o?o.getX(3*e+t):3*e+t,c=s?s.elements:null,u=s?(new n).getNormalMatrix(s).elements:null,g=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[0]*t+c[4]*s+c[8]*i+c[12]:t},p=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[1]*t+c[5]*s+c[9]*i+c[13]:s},b=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[2]*t+c[6]*s+c[10]*i+c[14]:i},S=new Float64Array(l),m=0;for(let e=0;e<l;e++){let t=d(e,0),s=d(e,1),a=d(e,2),i=g(t),r=p(t),n=b(t),h=g(s)-i,o=p(s)-r,l=b(s)-n,c=g(a)-i,u=p(a)-r,f=b(a)-n,M=o*f-l*u,y=l*c-h*f,R=h*u-o*c;m+=.5*Math.sqrt(M*M+y*y+R*R),S[e]=m}return m<=0?null:{total:m,sample:(t,s)=>{let a=0,n=l-1;for(;a<n;){let e=a+n>>1;S[e]<t?a=e+1:n=e}let o=a,c=d(o,0),m=d(o,1),f=d(o,2),M=s(),y=s();M+y>1&&(M=1-M,y=1-y);let R,w,x,v=1-M-y,A=g(c)*v+g(m)*M+g(f)*y,j=p(c)*v+p(m)*M+p(f)*y,I=b(c)*v+b(m)*M+b(f)*y;if(i){if(R=i.getX(c)*v+i.getX(m)*M+i.getX(f)*y,w=i.getY(c)*v+i.getY(m)*M+i.getY(f)*y,x=i.getZ(c)*v+i.getZ(m)*M+i.getZ(f)*y,u){let e=u[0]*R+u[3]*w+u[6]*x,t=u[1]*R+u[4]*w+u[7]*x,s=u[2]*R+u[5]*w+u[8]*x;R=e,w=t,x=s}}else{let e=g(c),t=p(c),s=b(c),a=g(m)-e,i=p(m)-t,r=b(m)-s,n=g(f)-e,h=p(f)-t,o=b(f)-s;R=i*o-r*h,w=r*n-a*o,x=a*h-i*n}let B=Math.sqrt(R*R+w*w+x*x)||1,H=1,F=1,W=1;if(h)H=h.getX(c)*v+h.getX(m)*M+h.getX(f)*y,F=h.getY(c)*v+h.getY(m)*M+h.getY(f)*y,W=h.getZ(c)*v+h.getZ(m)*M+h.getZ(f)*y;else if(e.sampleColor){let t=r?r.getX(c)*v+r.getX(m)*M+r.getX(f)*y:.5,s=r?r.getY(c)*v+r.getY(m)*M+r.getY(f)*y:.5,a=e.sampleColor(t,s);a&&(H=a.r,F=a.g,W=a.b)}return{x:A,y:j,z:I,nx:R/B,ny:w/B,nz:x/B,cr:H,cg:F,cb:W}}}}function k(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),I),s=function(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(e.seed??1337),a="object"===e.shape&&e.sampler,i=a?e.samplerRadius??H:H,r=new Float32Array(4*B),n=new Float32Array(B),h=new Float32Array(4*I).fill(1);for(let o=0;o<t;o++){let t=a?e.sampler(s):F(e.shape,s),l=a?t.x:t.x*i,d=a?t.y:t.y*i,c=a?t.z:t.z*i,{nx:u,ny:g,nz:p}=t;h[4*o+0]=t.cr,h[4*o+1]=t.cg,h[4*o+2]=t.cb;let b,S,m,f=32*o,M=(1.8+.8*s())*e.hairLength*i/31,y=.5+1.5*s(),R=(.02+.06*s())*i;Math.abs(g)<.99?(b=-p,S=0,m=u):(b=1,S=0,m=0);let w=Math.sqrt(b*b+S*S+m*m)||1;for(let e=0;e<32;e++){let t=e/31,s=t*t*.4*i,a=R*Math.sin(t*y*Math.PI*2),h=4*(f+e);r[h+0]=l+u*M*e+a*b/w,r[h+1]=d+g*M*e-s+a*S/w,r[h+2]=c+p*M*e+a*m/w,r[h+3]=0===e?0:1,e<31&&(n[f+e]=M)}}return{initialPositions:r,restLengths:n,unitScale:i,rootColors:h}}var C=1/60,O=4,P=new o,L=new s,z=new a,q=new a,X=class extends e{constructor(e,i,r){super(e,i),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new s,this.lastBonePos=new a,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=r,this.data=i,this.geometry.setAttribute("position",new t(new Float32Array(0),3)),this.material=new u({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new g(new d(H,48,32),new u({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let n=new h;n.setAttribute("position",new t(new Float32Array(12),3)),n.setIndex([0,2,1,2,3,1]),n.instanceCount=0,this.ribbonMesh=new g(n,new u({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=i.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:i.guideStrands,hairLength:i.hairLength,spreadRadius:i.spreadRadius,headShape:i.headShape,baseObjectId:i.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*C*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(L,z);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(L))<.9999995||this.lastBonePos.distanceToSquared(z)>1e-8),s=this.motionFingerprint(),a=!this.hasLastBone||t||this.resetRequested||s!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(L),this.lastBonePos.copy(z),this.lastMotionFingerprint=s,this.hasLastBone=!0,this.settledSimSeconds=a?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer — the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((void 0!==e.guideStrands||void 0!==e.hairLength||void 0!==e.spreadRadius||void 0!==e.headShape||void 0!==e.baseObjectId)&&this.regenerate(),(void 0!==e.headShape||void 0!==e.baseObjectId)&&this.applyScalpState(),void 0!==e.headColor){let t=this.scalpMesh.material;!0===t.isMeshBasicMaterial&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,r)}(void 0!==e.castShadow||void 0!==e.receiveShadow)&&this.applyShadowState(),void 0!==e.autoPlay&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(null===t||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let s=null===t||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),s&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:s,hairLength:a}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,"object"===e&&t){let e=this.context.scene.find(t);if(e){this.baseFoundAtRegen=!0,e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?function(e){let t=[];for(let s of e){let e=W(s);e&&t.push(e)}if(0===t.length)return null;let s=new Float64Array(t.length),a=0;for(let e=0;e<t.length;e++)a+=t[e].total,s[e]=a;return a<=0?null:e=>{let i=e()*a,r=0,n=t.length-1;for(;r<n;){let e=r+n>>1;s[e]<i?r=e+1:n=e}let h=0===r?i:i-s[r-1];return t[r].sample(h,e)}}(t.sources):null;if(this.baseSourceGeomsAtRegen=t?.sources.map(e=>e.geometry)??[],this.baseSourceHashesAtRegen=t?.hashes??[],this.baseColorHashAtRegen=t?.colorHash??0,t&&i){let r=this.baseWorldScale(e),n=Math.max(t.radius*r,.001);this.baseScaleAtRegen=r;let h=r;return k({shape:"object",guideStrands:s,hairLength:a,sampler:e=>{let t=i(e);return{...t,x:t.x*h,y:t.y*h,z:t.z*h}},samplerRadius:n})}}}return k({shape:"object"===e?"sphere":e,guideStrands:s,hairLength:a})}collectBaseSources(e){let t=[],s=[],a=0,i=0;P.copy(e.matrixWorld).invert();let r=P.clone(),n=h=>{if(!0===h.isHairSystem||h!==e&&!1===h.visible)return;let l=h.geometry;if(!0===h.isMesh&&l&&(l.getAttribute("position")?.count??0)>=3){let n=h===e?void 0:(new o).multiplyMatrices(r,h.matrixWorld),d=Array.isArray(h.material)?h.material[0]:h.material;t.push({geometry:l,matrix:n,sampleColor:A(d,this.context.shared)??void 0}),s.push(X.matrixHash(n)),i+=function(e,t){let s=e,a=0,i=1,r=e=>{a+=e*i,i+=1},n=s?.data?.layers;if(n&&"function"==typeof n.forEach){let e=t;n.forEach(t=>{let s=t.data;if(!1!==s.visible)if("color"===s.type){let t=s.color,a="string"==typeof t?"function"==typeof e?.color?e.color(t):void 0:t;a&&"number"==typeof a.r&&(r(a.r),r(a.g),r(a.b)),r(w(s.alpha,1))}else if("gradient"===s.type){let e=s;for(let t of e.colors??[])r(t[0]),r(t[1]),r(t[2]),r(t[3]);for(let t of e.steps??[])r(t);r(w(e.angle,0)),r(e.gradientType),r(e.smooth?1:0)}})}else s?.color&&!0===s.color.isColor&&(r(s.color.r),r(s.color.g),r(s.color.b));return a}(d,this.context.shared),null===l.boundingSphere&&l.computeBoundingSphere();let c=l.boundingSphere;if(c){let e=0,t=1;n?(z.copy(c.center).applyMatrix4(n),e=z.length(),t=X.matrixMaxScale(n)):e=c.center.length(),a=Math.max(a,e+c.radius*t)}}for(let e of h.children)n(e)};return n(e),0===t.length?null:{sources:t,hashes:s,radius:Math.max(a,.001),colorHash:i}}static matrixHash(e){if(!e)return 0;let t=e.elements,s=0;for(let e=0;e<16;e++)s+=t[e]*(e+1);return s}static matrixMaxScale(e){let t=e.elements,s=Math.hypot(t[0],t[1],t[2]),a=Math.hypot(t[4],t[5],t[6]),i=Math.hypot(t[8],t[9],t[10]);return Math.max(s,a,i,1e-6)}baseWorldScale(e){return P.copy(e.matrixWorld).decompose(z,L,q),Math.max(Math.abs(q.x),Math.abs(q.y),Math.abs(q.z),1e-6)}get widthWorldScale(){return"object"===this.data.headShape&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if("object"!==this.data.headShape||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),s=t?.sources??[],a=t?.hashes??[],i=this.baseSourceGeomsAtRegen,r=this.baseSourceHashesAtRegen,n=s.length!==i.length;if(!n)for(let e=0;e<s.length;e++)if(s[e].geometry!==i[e]||Math.abs(a[e]-r[e])>1e-4*Math.max(Math.abs(r[e]),1)){n=!0;break}if(!n&&"object"===this.data.hairColorSource&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(n=!0),!n&&s.length>0){let t=this.baseWorldScale(e);n=Math.abs(t-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}n&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t="object"===e&&null!==this.data.baseObjectId;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry="torus"===e?new c(140,70,24,48):"cylinder"===e?new i(80,80,160,48,1):new d(H,48,32))}boneTransform(e,t){let s=this.matrixWorld;if("object"===this.data.headShape&&this.data.baseObjectId){let e=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;e&&(s=e)}P.copy(s).decompose(t,e,q)}raycast(e,t){if(!this.scalpMesh.visible)return;let s=[];this.scalpMesh.raycast(e,s);for(let e of s)e.object=this,t.push(e)}get shadowBoundsRadius(){let e="torus"===this.data.headShape?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(L,e),e}updateEntityBoxSize(e,t){let s=this.shadowBoundsRadius;e.set(0,0,0),t.set(s,s,s)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),M()?.release(this)}};export{b as a,S as b,f as c,M as d,j as e,I as f,B as g,H as h,C as i,O as j,X as k};
1
+ import{v as e}from"./runtime-chunk-E2NZABAD.js";import{$c as t,Gc as s,Hc as a,Hd as i,Ib as r,Ic as n,Ie as h,Qc as o,Vc as l,Yd as d,Zd as c,md as u,nd as g}from"./runtime-chunk-KPOUV3HD.js";var p=null;function b(e){p=e}function S(){return p}var m=null;function f(e){m=e}function M(){return m}var y=new l;function R(e,t,s){return y.setRGB(e,t,s,r),{r:y.r,g:y.g,b:y.b}}var w=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t,x=e=>Array.isArray(e)&&"number"==typeof e[0]&&"number"==typeof e[1]?[e[0],e[1]]:[0,0];function v(e,t,s){let a,i=w(e.angle,0),[r,n]=x(e.offset),[h,o]=x(e.morph),l=e.colors??[],d=e.steps??[],c=Math.min(10,l.length,d.length);if(0===c)return[1,1,1,1];if(1===e.gradientType){let e=3*(t+h)-(t+r)-1,l=3*(s+o)-(s+n)-1;a=Math.hypot(e,l)+i}else if(2===e.gradientType){let e=-1*Math.atan2(t+h-.5+r,s+o-.5+n),l=i/Math.PI/-2+.5*e/Math.PI;a=l-Math.floor(l)}else{let e=.5+h/(0!==t?t:1e-6),l=o/(0!==s?s:1e-6),d=Math.cos(i)*e-Math.sin(i)*l,c=Math.sin(i)*e+Math.cos(i)*l,u=d*d+c*c;a=u>1e-12?(((t-.5+r)/2+d/2)*d+((s-.5+n)/2+c/2)*c)/u:0}let u=l[0][0],g=l[0][1],p=l[0][2],b=l[0][3];for(let t=1;t<c;t++){let s=d[t-1],i=d[t]-s,r=0!==i?Math.min(1,Math.max(0,(a-s)/i)):a>=s?1:0;e.smooth&&(r=r*r*(3-2*r)),u+=(l[t][0]-u)*r,g+=(l[t][1]-g)*r,p+=(l[t][2]-p)*r,b+=(l[t][3]-b)*r}return[u,g,p,b]}function A(e,t){let s=e,a=s?.data?.layers;if(a&&"function"==typeof a.forEach){let e=t,s=[];return a.forEach(t=>{let a=t.data;if(!1===a.visible||!0===a.isMask)return;let i=w(a.alpha,1);if(!(i<=0))if("color"===a.type){let t,r=a.color;"string"==typeof r?t="function"==typeof e?.color?e.color(r):void 0:r&&"number"==typeof r.r&&(t=r),t&&s.push({kind:"color",layer:a,rgb:{...R(t.r,t.g,t.b),a:t.a??1},alpha:i})}else"gradient"===a.type&&s.push({kind:"gradient",layer:a,alpha:i})}),0===s.length?null:(e,t)=>{let a=1,i=1,r=1,n=!0;for(let h of s){let s,o,l,d;if("color"===h.kind)({r:s,g:o,b:l}=h.rgb),d=h.rgb.a;else{let[a,i,r,n]=v(h.layer,e,t);({r:s,g:o,b:l}=R(a,i,r)),d=n}let c=n?1:Math.min(1,Math.max(0,d*h.alpha));a+=(s-a)*c,i+=(o-i)*c,r+=(l-r)*c,n=!1}return{r:a,g:i,b:r}}}if(s?.color&&!0===s.color.isColor){let{r:e,g:t,b:a}=s.color;return()=>({r:e,g:t,b:a})}return null}var j=32,I=16384,B=32*I,H=100;function F(e,t){if("torus"===e){let e=t()*Math.PI*2,s=t()*Math.PI*2,a=Math.cos(e),i=Math.sin(e),r=Math.cos(s),n=Math.sin(s);return{x:(1.4+.7*r)*a,y:-(1.4+.7*r)*i,z:.7*n,nx:r*a,ny:-r*i,nz:n,cr:1,cg:1,cb:1}}if("cylinder"===e){let e=t()*Math.PI*2,s=Math.cos(e),a=Math.sin(e);return{x:.8*s,y:1.6*(t()-.5),z:.8*a,nx:s,ny:0,nz:a,cr:1,cg:1,cb:1}}let s=t()*Math.PI*2,a=2*t()-1,i=Math.acos(a),r=Math.sin(i)*Math.cos(s),n=Math.cos(i),h=Math.sin(i)*Math.sin(s);return{x:r,y:n,z:h,nx:r,ny:n,nz:h,cr:1,cg:1,cb:1}}function W(e){let{geometry:t,matrix:s}=e,a=t.getAttribute("position");if(!a||a.count<3)return null;let i=t.getAttribute("normal"),r=t.getAttribute("uv"),h=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:a.count/3;if(l<1)return null;let d=(e,t)=>o?o.getX(3*e+t):3*e+t,c=s?s.elements:null,u=s?(new n).getNormalMatrix(s).elements:null,g=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[0]*t+c[4]*s+c[8]*i+c[12]:t},p=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[1]*t+c[5]*s+c[9]*i+c[13]:s},b=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[2]*t+c[6]*s+c[10]*i+c[14]:i},S=new Float64Array(l),m=0;for(let e=0;e<l;e++){let t=d(e,0),s=d(e,1),a=d(e,2),i=g(t),r=p(t),n=b(t),h=g(s)-i,o=p(s)-r,l=b(s)-n,c=g(a)-i,u=p(a)-r,f=b(a)-n,M=o*f-l*u,y=l*c-h*f,R=h*u-o*c;m+=.5*Math.sqrt(M*M+y*y+R*R),S[e]=m}return m<=0?null:{total:m,sample:(t,s)=>{let a=0,n=l-1;for(;a<n;){let e=a+n>>1;S[e]<t?a=e+1:n=e}let o=a,c=d(o,0),m=d(o,1),f=d(o,2),M=s(),y=s();M+y>1&&(M=1-M,y=1-y);let R,w,x,v=1-M-y,A=g(c)*v+g(m)*M+g(f)*y,j=p(c)*v+p(m)*M+p(f)*y,I=b(c)*v+b(m)*M+b(f)*y;if(i){if(R=i.getX(c)*v+i.getX(m)*M+i.getX(f)*y,w=i.getY(c)*v+i.getY(m)*M+i.getY(f)*y,x=i.getZ(c)*v+i.getZ(m)*M+i.getZ(f)*y,u){let e=u[0]*R+u[3]*w+u[6]*x,t=u[1]*R+u[4]*w+u[7]*x,s=u[2]*R+u[5]*w+u[8]*x;R=e,w=t,x=s}}else{let e=g(c),t=p(c),s=b(c),a=g(m)-e,i=p(m)-t,r=b(m)-s,n=g(f)-e,h=p(f)-t,o=b(f)-s;R=i*o-r*h,w=r*n-a*o,x=a*h-i*n}let B=Math.sqrt(R*R+w*w+x*x)||1,H=1,F=1,W=1;if(h)H=h.getX(c)*v+h.getX(m)*M+h.getX(f)*y,F=h.getY(c)*v+h.getY(m)*M+h.getY(f)*y,W=h.getZ(c)*v+h.getZ(m)*M+h.getZ(f)*y;else if(e.sampleColor){let t=r?r.getX(c)*v+r.getX(m)*M+r.getX(f)*y:.5,s=r?r.getY(c)*v+r.getY(m)*M+r.getY(f)*y:.5,a=e.sampleColor(t,s);a&&(H=a.r,F=a.g,W=a.b)}return{x:A,y:j,z:I,nx:R/B,ny:w/B,nz:x/B,cr:H,cg:F,cb:W}}}}function k(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),I),s=function(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(e.seed??1337),a="object"===e.shape&&e.sampler,i=a?e.samplerRadius??H:H,r=new Float32Array(4*B),n=new Float32Array(B),h=new Float32Array(4*I).fill(1);for(let o=0;o<t;o++){let t=a?e.sampler(s):F(e.shape,s),l=a?t.x:t.x*i,d=a?t.y:t.y*i,c=a?t.z:t.z*i,{nx:u,ny:g,nz:p}=t;h[4*o+0]=t.cr,h[4*o+1]=t.cg,h[4*o+2]=t.cb;let b,S,m,f=32*o,M=(1.8+.8*s())*e.hairLength*i/31,y=.5+1.5*s(),R=(.02+.06*s())*i;Math.abs(g)<.99?(b=-p,S=0,m=u):(b=1,S=0,m=0);let w=Math.sqrt(b*b+S*S+m*m)||1;for(let e=0;e<32;e++){let t=e/31,s=t*t*.4*i,a=R*Math.sin(t*y*Math.PI*2),h=4*(f+e);r[h+0]=l+u*M*e+a*b/w,r[h+1]=d+g*M*e-s+a*S/w,r[h+2]=c+p*M*e+a*m/w,r[h+3]=0===e?0:1,e<31&&(n[f+e]=M)}}return{initialPositions:r,restLengths:n,unitScale:i,rootColors:h}}var C=1/60,O=4,P=new o,L=new s,z=new a,q=new a,X=class extends e{constructor(e,i,r){super(e,i),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new s,this.lastBonePos=new a,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=r,this.data=i,this.geometry.setAttribute("position",new t(new Float32Array(0),3)),this.material=new u({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new g(new d(H,48,32),new u({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let n=new h;n.setAttribute("position",new t(new Float32Array(12),3)),n.setIndex([0,2,1,2,3,1]),n.instanceCount=0,this.ribbonMesh=new g(n,new u({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=i.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:i.guideStrands,hairLength:i.hairLength,spreadRadius:i.spreadRadius,headShape:i.headShape,baseObjectId:i.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*C*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(L,z);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(L))<.9999995||this.lastBonePos.distanceToSquared(z)>1e-8),s=this.motionFingerprint(),a=!this.hasLastBone||t||this.resetRequested||s!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(L),this.lastBonePos.copy(z),this.lastMotionFingerprint=s,this.hasLastBone=!0,this.settledSimSeconds=a?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer — the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((void 0!==e.guideStrands||void 0!==e.hairLength||void 0!==e.spreadRadius||void 0!==e.headShape||void 0!==e.baseObjectId)&&this.regenerate(),(void 0!==e.headShape||void 0!==e.baseObjectId)&&this.applyScalpState(),void 0!==e.headColor){let t=this.scalpMesh.material;!0===t.isMeshBasicMaterial&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,r)}(void 0!==e.castShadow||void 0!==e.receiveShadow)&&this.applyShadowState(),void 0!==e.autoPlay&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(null===t||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let s=null===t||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),s&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:s,hairLength:a}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,"object"===e&&t){let e=this.context.scene.find(t);if(e){this.baseFoundAtRegen=!0,e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?function(e){let t=[];for(let s of e){let e=W(s);e&&t.push(e)}if(0===t.length)return null;let s=new Float64Array(t.length),a=0;for(let e=0;e<t.length;e++)a+=t[e].total,s[e]=a;return a<=0?null:e=>{let i=e()*a,r=0,n=t.length-1;for(;r<n;){let e=r+n>>1;s[e]<i?r=e+1:n=e}let h=0===r?i:i-s[r-1];return t[r].sample(h,e)}}(t.sources):null;if(this.baseSourceGeomsAtRegen=t?.sources.map(e=>e.geometry)??[],this.baseSourceHashesAtRegen=t?.hashes??[],this.baseColorHashAtRegen=t?.colorHash??0,t&&i){let r=this.baseWorldScale(e),n=Math.max(t.radius*r,.001);this.baseScaleAtRegen=r;let h=r;return k({shape:"object",guideStrands:s,hairLength:a,sampler:e=>{let t=i(e);return{...t,x:t.x*h,y:t.y*h,z:t.z*h}},samplerRadius:n})}}}return k({shape:"object"===e?"sphere":e,guideStrands:s,hairLength:a})}collectBaseSources(e){let t=[],s=[],a=0,i=0;P.copy(e.matrixWorld).invert();let r=P.clone(),n=h=>{if(!0===h.isHairSystem||h!==e&&!1===h.visible)return;let l=h.geometry;if(!0===h.isMesh&&l&&(l.getAttribute("position")?.count??0)>=3){let n=h===e?void 0:(new o).multiplyMatrices(r,h.matrixWorld),d=Array.isArray(h.material)?h.material[0]:h.material;t.push({geometry:l,matrix:n,sampleColor:A(d,this.context.shared)??void 0}),s.push(X.matrixHash(n)),i+=function(e,t){let s=e,a=0,i=1,r=e=>{a+=e*i,i+=1},n=s?.data?.layers;if(n&&"function"==typeof n.forEach){let e=t;n.forEach(t=>{let s=t.data;if(!1!==s.visible)if("color"===s.type){let t=s.color,a="string"==typeof t?"function"==typeof e?.color?e.color(t):void 0:t;a&&"number"==typeof a.r&&(r(a.r),r(a.g),r(a.b)),r(w(s.alpha,1))}else if("gradient"===s.type){let e=s;for(let t of e.colors??[])r(t[0]),r(t[1]),r(t[2]),r(t[3]);for(let t of e.steps??[])r(t);r(w(e.angle,0)),r(e.gradientType),r(e.smooth?1:0)}})}else s?.color&&!0===s.color.isColor&&(r(s.color.r),r(s.color.g),r(s.color.b));return a}(d,this.context.shared),null===l.boundingSphere&&l.computeBoundingSphere();let c=l.boundingSphere;if(c){let e=0,t=1;n?(z.copy(c.center).applyMatrix4(n),e=z.length(),t=X.matrixMaxScale(n)):e=c.center.length(),a=Math.max(a,e+c.radius*t)}}for(let e of h.children)n(e)};return n(e),0===t.length?null:{sources:t,hashes:s,radius:Math.max(a,.001),colorHash:i}}static matrixHash(e){if(!e)return 0;let t=e.elements,s=0;for(let e=0;e<16;e++)s+=t[e]*(e+1);return s}static matrixMaxScale(e){let t=e.elements,s=Math.hypot(t[0],t[1],t[2]),a=Math.hypot(t[4],t[5],t[6]),i=Math.hypot(t[8],t[9],t[10]);return Math.max(s,a,i,1e-6)}baseWorldScale(e){return P.copy(e.matrixWorld).decompose(z,L,q),Math.max(Math.abs(q.x),Math.abs(q.y),Math.abs(q.z),1e-6)}get widthWorldScale(){return"object"===this.data.headShape&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if("object"!==this.data.headShape||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),s=t?.sources??[],a=t?.hashes??[],i=this.baseSourceGeomsAtRegen,r=this.baseSourceHashesAtRegen,n=s.length!==i.length;if(!n)for(let e=0;e<s.length;e++)if(s[e].geometry!==i[e]||Math.abs(a[e]-r[e])>1e-4*Math.max(Math.abs(r[e]),1)){n=!0;break}if(!n&&"object"===this.data.hairColorSource&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(n=!0),!n&&s.length>0){let t=this.baseWorldScale(e);n=Math.abs(t-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}n&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t="object"===e&&null!==this.data.baseObjectId;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry="torus"===e?new c(140,70,24,48):"cylinder"===e?new i(80,80,160,48,1):new d(H,48,32))}boneTransform(e,t){let s=this.matrixWorld;if("object"===this.data.headShape&&this.data.baseObjectId){let e=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;e&&(s=e)}P.copy(s).decompose(t,e,q)}raycast(e,t){if(!this.scalpMesh.visible)return;let s=[];this.scalpMesh.raycast(e,s);for(let e of s)e.object=this,t.push(e)}get shadowBoundsRadius(){let e="torus"===this.data.headShape?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(L,e),e}updateEntityBoxSize(e,t){let s=this.shadowBoundsRadius;e.set(0,0,0),t.set(s,s,s)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),M()?.release(this)}};export{b as a,S as b,f as c,M as d,j as e,I as f,B as g,H as h,C as i,O as j,X as k};
@@ -1 +1 @@
1
- import{a as e,b as i}from"./runtime-chunk-APKU3YYA.js";import{J as t,K as s,oa as o}from"./runtime-chunk-ARNZDNZ5.js";import{v as r}from"./runtime-chunk-CAU75OZB.js";import{Hc as a,Zc as d,ed as h}from"./runtime-chunk-KPOUV3HD.js";var n=new d,u=new a;function l(e){let i=!1;return e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&"SubdivGeometry"===t.geometry.type&&(i=!0)}),i}var m=class extends o{constructor(e,i,t){super(e,i,t),this.data=i,this.smoothShading=!0,this.skipReactionUpdate=!1,this.shearCompensationIsActive=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return void 0!==this.localGeometry?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return void 0!==this.localGeometry?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,i){let t=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),i.set(t.width,t.height,t.depth??0).multiplyScalar(.5)}createGeometryByControls(s){if(!0===this.skipReactionUpdate)return;let o=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:a,subdivPointer:d}=t.build(s,this.subdivPointer,this.smoothShading,this.shearScale);this.subdivPointer=d,void 0!==r&&(this.originalGeometry?.dispose(),this.originalGeometry=r),void 0!==a&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=a??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),this.calcBoundingBox(),o&&(this.localGeometry.uuid=o)}updateState(e,i){if(super.updateState(e,i),void 0!==e.flatShading){let t=this.material;this.material=Array.isArray(t)?t.map(e=>e.getFlavor(!1,e.side,e.wireframe)):t.getFlavor(!1,t.side,t.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(i)}}updateMesh(e=!1,i=!1,s=!1){i&&this.subdividedGeometry||t.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0,s),this.subdividedGeometry&&t.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){let s=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=t.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=t.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),this.calcBoundingBox(),s&&(this.localGeometry.uuid=s)}raycast(e,i){let t=this.localGeometry;this.localGeometry=this.originalGeometryNew,r.prototype.raycast.call(this,e,i),this.localGeometry=t}activateShearCompensation(){this.shearCompensationIsActive=!0,this.matrixWorld.copy(this.matrixWorldRigid)}deactivateShearCompensation(){this.shearCompensationIsActive=!1,this.updateMatrixWorld(!0)}updateMatrixWorld(e){!0!==this.shearCompensationIsActive&&super.updateMatrixWorld(e)}updateWorldMatrix(e,i){!0!==this.shearCompensationIsActive&&super.updateWorldMatrix(e,i)}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new h,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let i=e.attributes.position,t=e.boundingSphere.center;n.setFromBufferAttribute(i),n.getCenter(t),e.boundingSphere.radius=t.distanceTo(n.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),n.getSize(u),u.divide(this.scale);let s={width:u.x,height:u.y,depth:u.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let i=this.originalGeometry;n.min.set(e[0],e[2],e[4]),n.max.set(e[1],e[3],e[5]),n.min.applyMatrix4(this.shearScaleInv),n.max.applyMatrix4(this.shearScaleInv),null===i.boundingSphere&&(i.boundingSphere=new h);let t=i.boundingSphere.center;n.getCenter(t),i.boundingSphere.radius=t.distanceTo(n.max)}freeSubdivPointer(){this.subdivPointer&&(t.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(s){if(!0===this.skipReactionUpdate)return;let o=this.localGeometry,r=o?.uuid,a=o?.userData.parameters,d=s.subdivisions>0?t.buildRefined(this.subdivPointer,s.subdivisions,this.smoothShading?s.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=d??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),void 0!==a&&(this.localGeometry.userData.parameters=a),r&&(this.localGeometry.uuid=r)}updateByPatchedOpGeometry(e,i,t){super.updateByPatchedOpGeometry(e,i,t),this.localGeometry&&(0===e.type&&0===e.path.length&&s(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(i):this.createGeometryByControls(i))}};export{l as a,m as b};
1
+ import{a as e,b as i}from"./runtime-chunk-X4VLERKT.js";import{J as t,K as s,oa as o}from"./runtime-chunk-IVAJEJLH.js";import{v as r}from"./runtime-chunk-E2NZABAD.js";import{Hc as a,Zc as d,ed as h}from"./runtime-chunk-KPOUV3HD.js";var n=new d,u=new a;function l(e){let i=!1;return e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&"SubdivGeometry"===t.geometry.type&&(i=!0)}),i}var m=class extends o{constructor(e,i,t){super(e,i,t),this.data=i,this.smoothShading=!0,this.skipReactionUpdate=!1,this.shearCompensationIsActive=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return void 0!==this.localGeometry?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return void 0!==this.localGeometry?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,i){let t=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),i.set(t.width,t.height,t.depth??0).multiplyScalar(.5)}createGeometryByControls(s){if(!0===this.skipReactionUpdate)return;let o=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:a,subdivPointer:d}=t.build(s,this.subdivPointer,this.smoothShading,this.shearScale);this.subdivPointer=d,void 0!==r&&(this.originalGeometry?.dispose(),this.originalGeometry=r),void 0!==a&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=a??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),this.calcBoundingBox(),o&&(this.localGeometry.uuid=o)}updateState(e,i){if(super.updateState(e,i),void 0!==e.flatShading){let t=this.material;this.material=Array.isArray(t)?t.map(e=>e.getFlavor(!1,e.side,e.wireframe)):t.getFlavor(!1,t.side,t.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(i)}}updateMesh(e=!1,i=!1,s=!1){i&&this.subdividedGeometry||t.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e?this.shearScaleInv:void 0,s),this.subdividedGeometry&&t.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){let s=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=t.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=t.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),this.calcBoundingBox(),s&&(this.localGeometry.uuid=s)}raycast(e,i){let t=this.localGeometry;this.localGeometry=this.originalGeometryNew,r.prototype.raycast.call(this,e,i),this.localGeometry=t}activateShearCompensation(){this.shearCompensationIsActive=!0,this.matrixWorld.copy(this.matrixWorldRigid)}deactivateShearCompensation(){this.shearCompensationIsActive=!1,this.updateMatrixWorld(!0)}updateMatrixWorld(e){!0!==this.shearCompensationIsActive&&super.updateMatrixWorld(e)}updateWorldMatrix(e,i){!0!==this.shearCompensationIsActive&&super.updateWorldMatrix(e,i)}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new h,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let i=e.attributes.position,t=e.boundingSphere.center;n.setFromBufferAttribute(i),n.getCenter(t),e.boundingSphere.radius=t.distanceTo(n.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),n.getSize(u),u.divide(this.scale);let s={width:u.x,height:u.y,depth:u.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let i=this.originalGeometry;n.min.set(e[0],e[2],e[4]),n.max.set(e[1],e[3],e[5]),n.min.applyMatrix4(this.shearScaleInv),n.max.applyMatrix4(this.shearScaleInv),null===i.boundingSphere&&(i.boundingSphere=new h);let t=i.boundingSphere.center;n.getCenter(t),i.boundingSphere.radius=t.distanceTo(n.max)}freeSubdivPointer(){this.subdivPointer&&(t.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(s){if(!0===this.skipReactionUpdate)return;let o=this.localGeometry,r=o?.uuid,a=o?.userData.parameters,d=s.subdivisions>0?t.buildRefined(this.subdivPointer,s.subdivisions,this.smoothShading?s.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=d??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),void 0!==a&&(this.localGeometry.userData.parameters=a),r&&(this.localGeometry.uuid=r)}updateByPatchedOpGeometry(e,i,t){super.updateByPatchedOpGeometry(e,i,t),this.localGeometry&&(0===e.type&&0===e.path.length&&s(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(i):this.createGeometryByControls(i))}};export{l as a,m as b};
@@ -1 +1 @@
1
- import{a as t}from"./runtime-chunk-SEEDV66Z.js";import{d as e}from"./runtime-chunk-FX42TWCV.js";import{Uc as s}from"./runtime-chunk-KPOUV3HD.js";var r=class extends(e(s,t)){constructor(t,e,s){super(),this.super_Entity(t,e),this.context=s,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}};export{r as a};
1
+ import{a as t}from"./runtime-chunk-4QO3H2QB.js";import{d as e}from"./runtime-chunk-C6TXOTUG.js";import{Uc as s}from"./runtime-chunk-KPOUV3HD.js";var r=class extends(e(s,t)){constructor(t,e,s){super(),this.super_Entity(t,e),this.context=s,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}};export{r as a};
@@ -0,0 +1 @@
1
+ G �q,�^Z>=Pt�.՛Kz4(tgs���& $� \��"EQ���J�}�k`�,)����[y��Yph�3��MP�!��K�ڗ��}�D
@@ -1 +1 @@
1
- import{a as e,b as t}from"./runtime-chunk-7JZHIVIE.js";import{a,c as i,g as s,i as r}from"./runtime-chunk-KEVKWE7V.js";import{a as n}from"./runtime-chunk-TU4KDRKR.js";import{a as l,b as o}from"./runtime-chunk-APKU3YYA.js";import{Y as h,d as u,e as c,i as d,na as p}from"./runtime-chunk-ARNZDNZ5.js";import{b as y,h as g,j as f,v as m}from"./runtime-chunk-CAU75OZB.js";import{c as b}from"./runtime-chunk-2PT2WH66.js";import{c as v,l as C}from"./runtime-chunk-TZCHGFVF.js";import{Aa as k,ra as S,ua as A,w}from"./runtime-chunk-ADHKZQMB.js";import{Pe as F,Qc as L,Vc as O,Wc as H,Xc as j,ed as B,ld as D,nd as M,xe as U}from"./runtime-chunk-KPOUV3HD.js";function T(e){return e instanceof p&&e.needsAO&&!b(e)&&!0!==e.isDecalObject}function z(e){let t=e.cloner;if(t&&Array.isArray(t.children))for(let a of t.children)a?.layers&&(a.layers.mask=e.layers.mask)}function P(e){return e.getLayersOfType("reflection").filter(e=>e.data.visible).length}function E(e){return e.getLayersOfType("reflection").some(e=>e.data.visible&&1===e.data.mirror)}function x(e){let t=1/0,a=-1/0;for(let i of e.getLayersOfType("reflection")){let e=i.data;if(!e.visible||1===e.mirror)continue;let s="number"==typeof e.blur?e.blur:null;t=Math.min(t,s??0),a=Math.max(a,s??10)}return t===1/0?null:{min:t,max:a}}function I(e){for(let t of e.getLayersOfType("reflection")){let e=t.data;if(!e.visible)continue;let{blur:a,thickness:i,steps:s,stepSize:r}=e;return"number"!=typeof a||"number"!=typeof i||"number"!=typeof s||"number"!=typeof r?"variable":{blur:a,thickness:i,steps:s,stepSize:r,tracingMode:1===e.tracingMode?1:0}}return null}function V(e,t){let a={outline:!1,cavity:!1},i=512&e.layers.mask,s=t.getLayersOfType("transmission"),r=t.getLayersOfType("outline"),n=P(t),h=t.getLayersOfType("cavity");return(r.length>0||h.length>0)&&(e.layers.set(8),s.length>0&&e.layers.enable(3),n>0&&e.layers.enable(4),a.outline=r.length>0,a.cavity=h.length>0,o(e),l(e)),0===s.length&&0===r.length&&0===h.length&&0===n&&e.layers.set(0),i&&e.layers.set(9),!i&&T(e)&&e.layers.enable(5),z(e),a}function W(e,t){if(!t.layers)return!1;let a=512&e.layers.mask,i=!1,s=t.getLayersOfType("transmission").filter(e=>e.data.visible),r=t.getLayersOfType("outline").filter(e=>e.data.visible),n=P(t),l=t.getLayersOfType("cavity").filter(e=>e.data.visible);return s.length>0&&(e.layers.set(3),(r.length>0||l.length>0)&&e.layers.enable(8),n>0&&e.layers.enable(4),i=!0),0===s.length&&0===r.length&&0===l.length&&0===n&&e.layers.set(0),a&&e.layers.set(9),!a&&T(e)&&e.layers.enable(5),z(e),i}function K(e,t){var a;if(!t.layers)return!1;let i=512&e.layers.mask,s=!1,r=P(t),n=t.getLayersOfType("transmission").filter(e=>e.data.visible),l=t.getLayersOfType("outline").filter(e=>e.data.visible),o=t.getLayersOfType("cavity").filter(e=>e.data.visible);return r>0&&((a=e.userData).__splinePlanarMirror??(a.__splinePlanarMirror=0),e.layers.set(4),n.length>0&&e.layers.enable(3),(l.length>0||o.length>0)&&e.layers.enable(8),s=!0),0===r&&0===n.length&&0===l.length&&0===o.length&&e.layers.set(0),i&&e.layers.set(9),!i&&T(e)&&e.layers.enable(5),z(e),s}function Z(e){let t={outline:!1,cavity:!1},a=e=>{t.outline=t.outline||e.outline,t.cavity=t.cavity||e.cavity};return e.traverseEntity(e=>{if(e instanceof p)if(Array.isArray(e.material))for(let t=0;t<e.material.length;t++)a(V(e,e.material[t]));else a(V(e,e.material))}),t}function _(e){let t=!1;return e.traverseEntity(e=>{if(e instanceof p)if(Array.isArray(e.material))for(let a=0;a<e.material.length;a++)W(e,e.material[a])&&(t=!0);else W(e,e.material)&&(t=!0)}),t}function G(e){let t=!1;return e.traverseEntity(e=>{if(e instanceof p)if(Array.isArray(e.material))for(let a=0;a<e.material.length;a++)K(e,e.material[a])&&(t=!0);else K(e,e.material)&&(t=!0)}),t}var Q=new F,R=new L,Y=new D,N=new B;function J(e,t,a,i=!1){let s=e.cloner;if(s){let r=null;if((e.raycast===M.prototype.raycast||e.raycast===m.prototype.raycast)&&!0!==e.isSkinnedMesh){let t=e.geometry;t&&(null===t.boundingSphere&&t.computeBoundingSphere(),r=t.boundingSphere)}for(let n of s.children){if(null!==r&&(N.copy(r).applyMatrix4(n.matrixWorld),!t.ray.intersectsSphere(N)))continue;let s=R.copy(n.matrixWorld).invert(),l=Y.copy(t.ray).applyMatrix4(s),o=e.matrixWorld;l.applyMatrix4(o);let h=Q;h.set(l.origin,l.direction),h.near=t.near,h.far=t.far,h.layers.mask=t.layers.mask;let u=h.intersectObject(e,!1);u.length>0&&a.push({...u[0],object:i?n:e})}}}var X=class extends(f(j)){constructor(e,t,i){if(super(),this.data=t,this.bgColor=new d(1,1,1,1),this.fog=null,this.backupFog=new H(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=S.getDensity({}),this.fogHeightFalloff=S.getHeightFalloff({}),this.fogHeightBase=S.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new O,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new a(w,{...k.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new U(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene){let a=C();null===a?v("ui-2d","a page's 2D scene"):this.uiScene=new a.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else t.uiFrame&&this.createUICanvas(t.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,t){let a=C();null!==a?(this.uiCanvas=new a.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})):v("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(e){this.bgColor=e,!0===this.fogUseBGColor&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){void 0!==e.color&&(this.ambientLight.color=n(e.color,t)),void 0!==e.intensity&&(this.ambientLight.intensity=e.intensity*Math.PI),void 0!==e.enabled&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(e=>{e instanceof i&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof p)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(void 0===e.softShadowQuality&&void 0===e.type||!this.isActive)return;let t=this.data.shadow,a=A.isSoft(t);h(a,t?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=n(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=S.getMode(e),this.fogDensity=S.getDensity(e),this.fogHeightFalloff=S.getHeightFalloff(e),this.fogHeightBase=S.getHeightBase(e)}updateSky(e,t){this.skyState=e??null,this.skyStateVersion++;let a=e?.hdri?.image;this.skyHdriHolder=null!=a?t.image(a):null}updateAo(e,t){void 0!==e.aoColor&&(this.aoColor=n(e.aoColor,t))}updateByOp(e,t,a,i){let s=this.data.uiFrame;super.updateByOp(e,t,a,i);let r=t;y(e.path,["fog"])?this.updateFog(r.fog,a.shared):y(e.path,["sky"])?this.updateSky(r.sky,a.shared):y(e.path,["grading"])?this.gradingState=r.grading??null:y(e.path,["ao"])?this.updateAo(r.ao,a.shared):y(e.path,["ambient"])?this.updateAmbientLight(r.ambient,a.shared):y(e.path,["shadow"])?this.updateShadow(r.shadow):0===e.type&&0===e.path.length&&(void 0!==e.props.uiFrame||s!==r.uiFrame)&&this.updateUIFrame(e.props.uiFrame,a)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),void 0!==e.backgroundColor&&this.setBackgroundColor(n(e.backgroundColor,t.shared)),void 0!==e.fog&&this.updateFog(e.fog,t.shared),void 0!==e.sky&&this.updateSky(e.sky,t.shared),void 0!==e.grading&&(this.gradingState=e.grading),void 0!==e.ambient&&this.updateAmbientLight(e.ambient,t.shared),void 0!==e.ao&&this.updateAo(e.ao,t.shared),void 0!==e.shadow&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e instanceof a&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){let e=this.scene?.find(this.data.publish.playCamera);return e instanceof a?e:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return null===this.penumbraSizeArrayCache&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(u).fill(.5);let a=0,i=0;this.traverseEntity(s=>{if(!s.visible)return!0;s instanceof e&&s.visible&&a<c&&(this.penumbraSizeArrayCache[a]=s.data.penumbraSize??.5,a+=1),s instanceof t&&s.visible&&a<u-c&&(this.penumbraSizeArrayCache[c+i]=s.data.penumbraSize??.5,i+=1)})}raycastWithClones(e){let t=[],a=i=>{for(let n of i.children){let i=n.cloner;g.is(n)&&(n.visible||i?.object.data.visible)&&((s(n)||r(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),J(n,e,t,!0)),a(n))}};return a(this),t}updateEntity2DByOp(e,t,a,i){this.uiCanvas?.updateEntity2DByOp(e,t,a,i)}};export{E as a,x as b,I as c,Z as d,_ as e,G as f,J as g,X as h};
1
+ import{a as e,b as t}from"./runtime-chunk-X2II7COD.js";import{a,c as i,g as s,i as r}from"./runtime-chunk-VMP5GX6V.js";import{a as n}from"./runtime-chunk-TU4KDRKR.js";import{a as l,b as o}from"./runtime-chunk-X4VLERKT.js";import{Y as h,d as u,e as c,i as d,na as p}from"./runtime-chunk-IVAJEJLH.js";import{b as y,h as g,j as f,v as m}from"./runtime-chunk-E2NZABAD.js";import{c as b}from"./runtime-chunk-2PT2WH66.js";import{c as v,l as C}from"./runtime-chunk-TZCHGFVF.js";import{Aa as k,ra as S,ua as A,w}from"./runtime-chunk-ADHKZQMB.js";import{Pe as F,Qc as L,Vc as O,Wc as H,Xc as j,ed as B,ld as D,nd as M,xe as T}from"./runtime-chunk-KPOUV3HD.js";function U(e){return e instanceof p&&e.needsAO&&!b(e)&&!0!==e.isDecalObject}function z(e){let t=e.cloner;if(t&&Array.isArray(t.children))for(let a of t.children)a?.layers&&(a.layers.mask=e.layers.mask)}function P(e){return e.getLayersOfType("reflection").filter(e=>e.data.visible).length}function E(e){return e.getLayersOfType("reflection").some(e=>e.data.visible&&1===e.data.mirror)}function I(e){let t=1/0,a=-1/0;for(let i of e.getLayersOfType("reflection")){let e=i.data;if(!e.visible||1===e.mirror)continue;let s="number"==typeof e.blur?e.blur:null;t=Math.min(t,s??0),a=Math.max(a,s??10)}return t===1/0?null:{min:t,max:a}}function x(e){for(let t of e.getLayersOfType("reflection")){let e=t.data;if(!e.visible)continue;let{blur:a,thickness:i,steps:s,stepSize:r}=e;return"number"!=typeof a||"number"!=typeof i||"number"!=typeof s||"number"!=typeof r?"variable":{blur:a,thickness:i,steps:s,stepSize:r,tracingMode:1===e.tracingMode?1:0}}return null}function V(e,t){let a={outline:!1,cavity:!1},i=512&e.layers.mask,s=t.getLayersOfType("transmission"),r=t.getLayersOfType("outline"),n=P(t),h=t.getLayersOfType("cavity");return(r.length>0||h.length>0)&&(e.layers.set(8),s.length>0&&e.layers.enable(3),n>0&&e.layers.enable(4),a.outline=r.length>0,a.cavity=h.length>0,o(e),l(e)),0===s.length&&0===r.length&&0===h.length&&0===n&&e.layers.set(0),i&&e.layers.set(9),!i&&U(e)&&e.layers.enable(5),z(e),a}function W(e,t){if(!t.layers)return!1;let a=512&e.layers.mask,i=!1,s=t.getLayersOfType("transmission").filter(e=>e.data.visible),r=t.getLayersOfType("outline").filter(e=>e.data.visible),n=P(t),l=t.getLayersOfType("cavity").filter(e=>e.data.visible);return s.length>0&&(e.layers.set(3),(r.length>0||l.length>0)&&e.layers.enable(8),n>0&&e.layers.enable(4),i=!0),0===s.length&&0===r.length&&0===l.length&&0===n&&e.layers.set(0),a&&e.layers.set(9),!a&&U(e)&&e.layers.enable(5),z(e),i}function _(e,t){var a;if(!t.layers)return!1;let i=512&e.layers.mask,s=!1,r=P(t),n=t.getLayersOfType("transmission").filter(e=>e.data.visible),l=t.getLayersOfType("outline").filter(e=>e.data.visible),o=t.getLayersOfType("cavity").filter(e=>e.data.visible);return r>0&&((a=e.userData).__splinePlanarMirror??(a.__splinePlanarMirror=0),e.layers.set(4),n.length>0&&e.layers.enable(3),(l.length>0||o.length>0)&&e.layers.enable(8),s=!0),0===r&&0===n.length&&0===l.length&&0===o.length&&e.layers.set(0),i&&e.layers.set(9),!i&&U(e)&&e.layers.enable(5),z(e),s}function G(e){let t={outline:!1,cavity:!1},a=e=>{t.outline=t.outline||e.outline,t.cavity=t.cavity||e.cavity};return e.traverseEntity(e=>{if(e instanceof p)if(Array.isArray(e.material))for(let t=0;t<e.material.length;t++)a(V(e,e.material[t]));else a(V(e,e.material))}),t}function K(e){let t=!1;return e.traverseEntity(e=>{if(e instanceof p)if(Array.isArray(e.material))for(let a=0;a<e.material.length;a++)W(e,e.material[a])&&(t=!0);else W(e,e.material)&&(t=!0)}),t}function Q(e){let t=!1;return e.traverseEntity(e=>{if(e instanceof p)if(Array.isArray(e.material))for(let a=0;a<e.material.length;a++)_(e,e.material[a])&&(t=!0);else _(e,e.material)&&(t=!0)}),t}var R=new F,X=new L,Z=new D,J=new B;function N(e,t,a,i=!1){let s=e.cloner;if(s){let r=null;if((e.raycast===M.prototype.raycast||e.raycast===m.prototype.raycast)&&!0!==e.isSkinnedMesh){let t=e.geometry;t&&(null===t.boundingSphere&&t.computeBoundingSphere(),r=t.boundingSphere)}for(let n of s.children){if(null!==r&&(J.copy(r).applyMatrix4(n.matrixWorld),!t.ray.intersectsSphere(J)))continue;let s=X.copy(n.matrixWorld).invert(),l=Z.copy(t.ray).applyMatrix4(s),o=e.matrixWorld;l.applyMatrix4(o);let h=R;h.set(l.origin,l.direction),h.near=t.near,h.far=t.far,h.layers.mask=t.layers.mask;let u=h.intersectObject(e,!1);u.length>0&&a.push({...u[0],object:i?n:e})}}}var Y=class extends(f(j)){constructor(e,t,i){if(super(),this.data=t,this.bgColor=new d(1,1,1,1),this.fog=null,this.backupFog=new H(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=S.getDensity({}),this.fogHeightFalloff=S.getHeightFalloff({}),this.fogHeightBase=S.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new O,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new a(w,{...k.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new T(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene){let a=C();null===a?v("ui-2d","a page's 2D scene"):this.uiScene=new a.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else t.uiFrame&&this.createUICanvas(t.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,t){let a=C();null!==a?(this.uiCanvas=new a.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})):v("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(e){this.bgColor=e,!0===this.fogUseBGColor&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){void 0!==e.color&&(this.ambientLight.color=n(e.color,t)),void 0!==e.intensity&&(this.ambientLight.intensity=e.intensity*Math.PI),void 0!==e.enabled&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(e=>{e instanceof i&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof p)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(void 0===e.softShadowQuality&&void 0===e.type||!this.isActive)return;let t=this.data.shadow,a=A.isSoft(t);h(a,t?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=n(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=S.getMode(e),this.fogDensity=S.getDensity(e),this.fogHeightFalloff=S.getHeightFalloff(e),this.fogHeightBase=S.getHeightBase(e)}updateSky(e,t){this.skyState=e??null,this.skyStateVersion++;let a=e?.hdri?.image;this.skyHdriHolder=null!=a?t.image(a):null}updateAo(e,t){void 0!==e.aoColor&&(this.aoColor=n(e.aoColor,t))}updateByOp(e,t,a,i){let s=this.data.uiFrame;super.updateByOp(e,t,a,i);let r=t;y(e.path,["fog"])?this.updateFog(r.fog,a.shared):y(e.path,["sky"])?this.updateSky(r.sky,a.shared):y(e.path,["grading"])?this.gradingState=r.grading??null:y(e.path,["ao"])?this.updateAo(r.ao,a.shared):y(e.path,["ambient"])?this.updateAmbientLight(r.ambient,a.shared):y(e.path,["shadow"])?this.updateShadow(r.shadow):0===e.type&&0===e.path.length&&(void 0!==e.props.uiFrame||s!==r.uiFrame)&&this.updateUIFrame(e.props.uiFrame,a)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),void 0!==e.backgroundColor&&this.setBackgroundColor(n(e.backgroundColor,t.shared)),void 0!==e.fog&&this.updateFog(e.fog,t.shared),void 0!==e.sky&&this.updateSky(e.sky,t.shared),void 0!==e.grading&&(this.gradingState=e.grading),void 0!==e.ambient&&this.updateAmbientLight(e.ambient,t.shared),void 0!==e.ao&&this.updateAo(e.ao,t.shared),void 0!==e.shadow&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e instanceof a&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){let e=this.scene?.find(this.data.publish.playCamera);return e instanceof a?e:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return null===this.penumbraSizeArrayCache&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(u).fill(.5);let a=0,i=0;this.traverseEntity(s=>{if(!s.visible)return!0;s instanceof e&&s.visible&&a<c&&(this.penumbraSizeArrayCache[a]=s.data.penumbraSize??.5,a+=1),s instanceof t&&s.visible&&a<u-c&&(this.penumbraSizeArrayCache[c+i]=s.data.penumbraSize??.5,i+=1)})}raycastWithClones(e){let t=[],a=i=>{for(let n of i.children){let i=n.cloner;g.is(n)&&(n.visible||i?.object.data.visible)&&((s(n)||r(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),N(n,e,t,!0)),a(n))}};return a(this),t}updateEntity2DByOp(e,t,a,i){this.uiCanvas?.updateEntity2DByOp(e,t,a,i)}};export{E as a,I as b,x as c,G as d,K as e,Q as f,N as g,Y as h};
@@ -1 +1 @@
1
- import{a as e,b as t}from"./runtime-chunk-APKU3YYA.js";import{a as r,b as i,c as s,d as o}from"./runtime-chunk-FX42TWCV.js";import{na as a}from"./runtime-chunk-ARNZDNZ5.js";import{h as n,o as h,p,q as c,r as m,s as d,t as l,v as u}from"./runtime-chunk-CAU75OZB.js";import{f}from"./runtime-chunk-RTLL6WIB.js";import{i as g}from"./runtime-chunk-2PT2WH66.js";import{Aa as y,K as v}from"./runtime-chunk-ADHKZQMB.js";import{Ce as C,Gc as b,Hc as T,Qc as j,Tc as w,Vc as P,dd as M,fd as x,wd as A,we as O,yd as S,ye as _,ze as F}from"./runtime-chunk-KPOUV3HD.js";var D=new T,W=new _,V=class extends S{constructor(e){let t=new x,r=new A({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={},a=new P(15711266),n=new P(15711266),h=new P(2857471);function p(e,t,r){c(e,r),c(t,r)}function c(e,t){i.push(0,0,0),s.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(i.length/3-1)}p("n1","n2",a),p("n2","n4",a),p("n4","n3",a),p("n3","n1",a),p("f1","f2",a),p("f2","f4",a),p("f4","f3",a),p("f3","f1",a),p("n1","f1",a),p("n2","f2",a),p("n3","f3",a),p("n4","f4",a),p("p","n1",n),p("p","n2",n),p("p","n3",n),p("p","n4",n),p("u1","u2",h),p("u2","u3",h),p("u3","u1",h),t.setAttribute("position",new M(i,3)),t.setAttribute("color",new M(s,3)),super(t,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){let e=this.geometry,t=this.pointMap;W.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let r=.8;U("n1",t,e,W,-1,-1,r),U("n2",t,e,W,1,-1,r),U("n3",t,e,W,-1,1,r),U("n4",t,e,W,1,1,r);let i=r;U("f1",t,e,W,-1,-1,i),U("f2",t,e,W,1,-1,i),U("f3",t,e,W,-1,1,i),U("f4",t,e,W,1,1,i);let s=i;U("u1",t,e,W,.35,1.1,s),U("u2",t,e,W,-.35,1.1,s),U("u3",t,e,W,0,1.55,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function U(e,t,r,i,s,o,a){D.set(s,o,a).unproject(i);let n=t[e];if(void 0!==n){let e=r.getAttribute("position");for(let t=0,r=n.length;t<r;t++)e.setXYZ(n[t],D.x,D.y,D.z)}}var z=class extends(r(V)){constructor(e){super(e),this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){i(this.object,this.geometry,e,t,!0)}};function B(e){return 1-Math.pow(1-e,3)}var I=new T,L=new T,H=new b,k=new T,R=new T,q=new T,E=class extends(o(_,z)){constructor(e="",t={...y.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=v.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let e=this._projectionTransition;if(void 0===e)return;if(this.disposed)return void this._endProjectionTransition();e.raf=requestAnimationFrame(this._tickProjectionTransition);let t=E.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),t?.()},this.super_Entity(e,t),this.previousProjectionMatrix=new j,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,i=this.height;this.orthoCamera=new C(-.5*r,.5*r,.5*i,-.5*i,-5e4,1e4),this.perspCamera=new F(45,r/i,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(e){let t=E.projectionTransitionsEnabled;E.projectionTransitionsEnabled=!1;try{return e()}finally{E.projectionTransitionsEnabled=t}}get isPerspectiveCamera(){return"PerspectiveCamera"===this.cameraType}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,t){"PerspectiveCamera"===e?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&("PerspectiveCamera"===e?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){"PerspectiveCamera"===e?this.toPerspective():"OrthographicCamera"===e&&this.toOrthographic()}get near(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near}set near(e){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,r){"number"==typeof e&&(e=new T(e,t,r)),super.lookAt(e),this.getWorldPosition(I),this.targetOffset=I.distanceTo(e)}getTarget(e=new T){return this.getWorldDirection(L),this.getWorldPosition(I),L.multiplyScalar(this.targetOffset),e.copy(I).add(L),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(I),I.distanceTo(e)}updateUp(){this.getWorldQuaternion(H),k.set(0,0,1).applyQuaternion(H),R.copy(w.DEFAULT_UP),this.isUpVectorFlipped&&R.negate(),R.applyQuaternion(H),q.copy(w.DEFAULT_UP).projectOnPlane(k),this.angleOffsetFromUp=q.angleTo(R),this.angleOffsetFromUp*=q.cross(R).dot(k)>=0?1:-1}updateTransformState(e,t){let r=super.updateTransformState(e,t);return void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(e){let t=e.getWorldPosition(new T),r=e.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:t.clone().add(r),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new T;return e.getWorldPosition(t),this.getViewToTarget(t)}setViewplaneSize(e,t,r=!1){if(this.aspect=e/t,r){let r=e>t?this.aspect:1,i=e>t?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/i*395,this.bottom=1/i*-395}else this.left=.5*-e,this.right=.5*e,this.top=.5*t,this.bottom=.5*-t;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return void 0!==this._projectionTransition}get projectionTransitionProgress(){let e=this._projectionTransition;if(void 0===e)return 1;let t=(performance.now()-e.start)/e.duration;return t>=1?1:t<=0?0:B(t)}get _activeSubCamera(){return"PerspectiveCamera"===this._cameraType?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return E.projectionTransitionsEnabled&&"function"==typeof requestAnimationFrame&&typeof performance<"u"&&performance.now()-this._createdAt>=E.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let t=this._projectionTransition;void 0===t&&(t={from:new j,blend:new j,blendInverse:new j,start:0,duration:E.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=t),t.from.copy(this.projectionMatrix),t.start=performance.now(),t.duration=E.projectionTransitionDuration,t.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(t.requestRender=e),0!==t.raf&&cancelAnimationFrame(t.raf),t.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(void 0===e)return;let t=(performance.now()-e.start)/e.duration;if(t>=1)return void this._endProjectionTransition();let r=B(t),i=e.from.elements,s=this._activeSubCamera.projectionMatrix.elements,o=e.blend.elements,a=e.referenceDepth,n=Math.max(1e-6,i[15]-i[11]*a),h=r*n/(r*n+(1-r)*Math.max(1e-6,s[15]-s[11]*a));for(let e=0;e<16;e++)o[e]=i[e]+(s[e]-i[e])*h;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(void 0===e)return;0!==e.raf&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let t=this._activeSubCamera;this.projectionMatrix=t.projectionMatrix,this.projectionMatrixInverse=t.projectionMatrixInverse}_syncProjectionTransition(e){let t=e._projectionTransition;if(void 0===t)return void(void 0!==this._projectionTransition&&this._endProjectionTransition());let r=this._projectionTransition;void 0===r?(r={from:new j,blend:new j,blendInverse:new j,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):0!==r.raf&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(t.from),r.start=t.start,r.duration=t.duration,r.referenceDepth=t.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,r,i,s,o){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(e,t,r,i,s,o):this.orthoCamera.setViewOffset(e,t,r,i,s,o),this._applyProjectionTransition()}clearViewOffset(){"PerspectiveCamera"===this._cameraType?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){"PerspectiveCamera"===this._cameraType?this.toPerspective():"OrthographicCamera"===this._cameraType&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=null===e.view?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=v.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){let t={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return f(t,e)}updateCameraSubtype(e,t){let r="perspective"===e?"PerspectiveCamera":"OrthographicCamera";void 0!==t.zoom&&this.setZoom(r,t.zoom),void 0!==t.near&&this.setNear(r,t.near),void 0!==t.fov&&"PerspectiveCamera"===r&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),void 0!==e.far&&(this.far=e.far),void 0!==e.orthographic&&this.updateCameraSubtype("orthographic",e.orthographic),void 0!==e.perspective&&this.updateCameraSubtype("perspective",e.perspective),void 0!==e.type&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(t?.shared.requestRender),this.cameraType=e.type),void 0!==e.up&&this.up.fromArray(e.up.map(e=>"number"==typeof e?e:0)),void 0!==e.targetOffset&&(this.targetOffset=v.sanitizeTargetOffset(e.targetOffset)),void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,r){super.updateByPatchedOp(e,t,r),1===e.path.length&&0===e.type&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},Z=E;Z.projectionTransitionsEnabled=!1,Z.projectionTransitionDuration=350,Z.projectionTransitionMinAgeMs=1e3;var G=new j,N=new j,Q=new j,K=new j,Y=new j;function X(e){let t=!1;return e.scene.objects.traverse((e,r)=>{"BooleanGeometry"===r.geometry?.type&&(t=!0)}),t}function $(e,t){let r=e.cloner;return void 0!==r&&r.parent===t?r:void 0}var J=new Float32Array(0);function ee(e,t,r,i){let s=16*(t.children.length+1);J.length<s&&(J=new Float32Array(s));let o=0,a=e=>{e.toArray(J,16*o),o++},n=!0!==t.parameters.hideBase;n&&a(i),Q.copy(e.matrix);for(let e of t.children)!g(e)||!1===e.playModeVisible||(K.copy(e.matrix).multiply(e.pivotMatrix),Y.multiplyMatrices(Q,K),(!n||!Y.equals(i))&&a(Y));try{return 0===o?0:l(r,J.subarray(0,16*o))}finally{d(r)}}var te=class extends a{constructor(e,t,r){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new x,this.onAfterRender=(e,t,r,i,s,o)=>{super.onAfterRender(e,t,r,i,s,o),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,t,r){super.updateByPatchedOp(e,t,r),1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&void 0!==e.props.operation&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(r,i=!0){if(-1!==this.booleanMeshSetAddress&&!r)return;for(let e=0;e<this.children.length;e++){let t=this.children[e];t instanceof te&&!0===t.dataPatched.visible&&t.recomputeBoolean(!0===r,i)}this.meshSetAddresses=[];for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t instanceof u&&!0===t.dataPatched.visible&&t.geometry.attributes.position?.count>0&&t.geometry.drawRange.count>0&&0!==t.booleanMeshSetAddress){G.copy(t.matrix).multiply(t.pivotMatrix);try{let e=$(t,this);if(-1===t.booleanMeshSetAddress){if((t.geometry.index??t.geometry.getAttribute("position")).count/3<15e5){let s=h(t.geometry,!0===r,i);t.booleanMeshSetAddress=void 0===e||-1===s?s:ee(t,e,s,G)}if(-1===t.booleanMeshSetAddress)return;void 0===e&&m(t.booleanMeshSetAddress,G),t.booleanMatrixInvOld.copy(G).invert(),t.booleanWasTransformed=!1}else t instanceof te&&!0===t.needsTransformForDownstream?(void 0===e?m(t.booleanMeshSetAddress,G):t.booleanMeshSetAddress=ee(t,e,t.booleanMeshSetAddress,G),t.needsTransformForDownstream=!1):!0===t.booleanWasTransformed&&(m(t.booleanMeshSetAddress,N.multiplyMatrices(G,t.booleanMatrixInvOld)),t.booleanMatrixInvOld.copy(G).invert(),t.booleanWasTransformed=!1)}catch(e){console.error(e),t.booleanMeshSetAddress=0,t.geometry.userData.booleanOperationDidFail=!0;continue}if(0===t.booleanMeshSetAddress)continue;this.meshSetAddresses.push(t.booleanMeshSetAddress),t.geometry.userData.booleanOperationDidFail=!1}}if(0===this.meshSetAddresses.length){if(0!==this.geometry.getAttribute("position")?.array.length){let e=this.geometry;e.dispose(),this.geometry=new x,this.geometry.userData=e.userData,this.geometry.boundingSphere=e.boundingSphere,this.geometry.setAttribute("position",new M([],3))}return void this.geometry.setDrawRange(0,0)}if(!0===r)return c(this.meshSetAddresses,this.booleanOp);let s=this.geometry;s.dispose(),this.geometry=new x,this.geometry.userData=s.userData,this.geometry.boundingSphere=s.boundingSphere;try{this.booleanMeshSetAddress=p(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(e){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(e)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,e(this),t(this)}dispose(){super.dispose(),this.geometry.dispose()}},re=new WeakSet;function ie(e){return e.isPointLight?1:(e.isSpotLight,3)}function se(e){return e.isDirectionalLight?0:e.isSpotLight?1:2}var oe,ae=[];function ne(e){ae.length=0,e.traverseVisible(e=>{(function(e){let t=e;return!0===t.isPointLight||!0===t.isSpotLight||!0===t.isDirectionalLight})(e)&&(!0===e.castShadow||re.has(e))&&ae.push(e)});let t=!1;if(0===ae.length)return t;ae.sort((e,t)=>se(e)-se(t)||e.id-t.id);let r=12;for(let e of ae){let i=ie(e);i<=r?(r-=i,re.delete(e)&&(e.castShadow=!0,t=!0)):!0===e.castShadow&&(e.castShadow=!1,re.add(e))}return ae.length=0,t}(oe||(oe={})).is=function(e){return n.is(e)&&e instanceof O};var he=(e,t)=>class extends(o(e,t)){updateState_Light(e,t){if(this.updateState_Entity(e,t),void 0!==e.color&&(this.color=t.shared.color(e.color)),void 0!==e.intensity&&(this.intensity=e.intensity*Math.PI),void 0!==e.depth){let t=this.shadow;t.camera.far=e.depth,t.needsUpdate=!0}void 0!==e.shadows&&(function(e){re.delete(e)}(this),this.castShadow=e.shadows)}},pe=e=>e instanceof u,ce=e=>null!==e&&e instanceof te,me=e=>s.is(e);export{Z as a,X as b,te as c,ne as d,oe as e,he as f,pe as g,ce as h,me as i};
1
+ import{a as e,b as t}from"./runtime-chunk-X4VLERKT.js";import{a as r,b as i,c as s,d as o}from"./runtime-chunk-C6TXOTUG.js";import{na as a}from"./runtime-chunk-IVAJEJLH.js";import{h as n,o as h,p,q as c,r as m,s as d,t as l,v as u}from"./runtime-chunk-E2NZABAD.js";import{f}from"./runtime-chunk-RTLL6WIB.js";import{i as g}from"./runtime-chunk-2PT2WH66.js";import{Aa as y,K as v}from"./runtime-chunk-ADHKZQMB.js";import{Ce as C,Gc as T,Hc as b,Qc as j,Tc as w,Vc as P,dd as M,fd as x,wd as O,we as A,yd as S,ye as _,ze as F}from"./runtime-chunk-KPOUV3HD.js";var D=new b,V=new _,W=class extends S{constructor(e){let t=new x,r=new O({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={},a=new P(15711266),n=new P(15711266),h=new P(2857471);function p(e,t,r){c(e,r),c(t,r)}function c(e,t){i.push(0,0,0),s.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(i.length/3-1)}p("n1","n2",a),p("n2","n4",a),p("n4","n3",a),p("n3","n1",a),p("f1","f2",a),p("f2","f4",a),p("f4","f3",a),p("f3","f1",a),p("n1","f1",a),p("n2","f2",a),p("n3","f3",a),p("n4","f4",a),p("p","n1",n),p("p","n2",n),p("p","n3",n),p("p","n4",n),p("u1","u2",h),p("u2","u3",h),p("u3","u1",h),t.setAttribute("position",new M(i,3)),t.setAttribute("color",new M(s,3)),super(t,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){let e=this.geometry,t=this.pointMap;V.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let r=.8;U("n1",t,e,V,-1,-1,r),U("n2",t,e,V,1,-1,r),U("n3",t,e,V,-1,1,r),U("n4",t,e,V,1,1,r);let i=r;U("f1",t,e,V,-1,-1,i),U("f2",t,e,V,1,-1,i),U("f3",t,e,V,-1,1,i),U("f4",t,e,V,1,1,i);let s=i;U("u1",t,e,V,.35,1.1,s),U("u2",t,e,V,-.35,1.1,s),U("u3",t,e,V,0,1.55,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function U(e,t,r,i,s,o,a){D.set(s,o,a).unproject(i);let n=t[e];if(void 0!==n){let e=r.getAttribute("position");for(let t=0,r=n.length;t<r;t++)e.setXYZ(n[t],D.x,D.y,D.z)}}var I=class extends(r(W)){constructor(e){super(e),this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){i(this.object,this.geometry,e,t,!0)}};function z(e){return 1-Math.pow(1-e,3)}var B=new b,L=new b,H=new T,E=new b,k=new b,R=new b,q=class extends(o(_,I)){constructor(e="",t={...y.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=v.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let e=this._projectionTransition;if(void 0===e)return;if(this.disposed)return void this._endProjectionTransition();e.raf=requestAnimationFrame(this._tickProjectionTransition);let t=q.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),t?.()},this.super_Entity(e,t),this.previousProjectionMatrix=new j,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,i=this.height;this.orthoCamera=new C(-.5*r,.5*r,.5*i,-.5*i,-5e4,1e4),this.perspCamera=new F(45,r/i,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(e){let t=q.projectionTransitionsEnabled;q.projectionTransitionsEnabled=!1;try{return e()}finally{q.projectionTransitionsEnabled=t}}get isPerspectiveCamera(){return"PerspectiveCamera"===this.cameraType}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,t){"PerspectiveCamera"===e?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&("PerspectiveCamera"===e?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){"PerspectiveCamera"===e?this.toPerspective():"OrthographicCamera"===e&&this.toOrthographic()}get near(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near}set near(e){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,r){"number"==typeof e&&(e=new b(e,t,r)),super.lookAt(e),this.getWorldPosition(B),this.targetOffset=B.distanceTo(e)}getTarget(e=new b){return this.getWorldDirection(L),this.getWorldPosition(B),L.multiplyScalar(this.targetOffset),e.copy(B).add(L),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(B),B.distanceTo(e)}updateUp(){this.getWorldQuaternion(H),E.set(0,0,1).applyQuaternion(H),k.copy(w.DEFAULT_UP),this.isUpVectorFlipped&&k.negate(),k.applyQuaternion(H),R.copy(w.DEFAULT_UP).projectOnPlane(E),this.angleOffsetFromUp=R.angleTo(k),this.angleOffsetFromUp*=R.cross(k).dot(E)>=0?1:-1}updateTransformState(e,t){let r=super.updateTransformState(e,t);return void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(e){let t=e.getWorldPosition(new b),r=e.getWorldDirection(new b).multiplyScalar(this.targetOffset);return{position:t.clone().add(r),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new b).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new b;return e.getWorldPosition(t),this.getViewToTarget(t)}setViewplaneSize(e,t,r=!1){if(this.aspect=e/t,r){let r=e>t?this.aspect:1,i=e>t?1:this.aspect;this.left=-395*r,this.right=395*r,this.top=1/i*395,this.bottom=1/i*-395}else this.left=.5*-e,this.right=.5*e,this.top=.5*t,this.bottom=.5*-t;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return void 0!==this._projectionTransition}get projectionTransitionProgress(){let e=this._projectionTransition;if(void 0===e)return 1;let t=(performance.now()-e.start)/e.duration;return t>=1?1:t<=0?0:z(t)}get _activeSubCamera(){return"PerspectiveCamera"===this._cameraType?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return q.projectionTransitionsEnabled&&"function"==typeof requestAnimationFrame&&typeof performance<"u"&&performance.now()-this._createdAt>=q.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let t=this._projectionTransition;void 0===t&&(t={from:new j,blend:new j,blendInverse:new j,start:0,duration:q.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=t),t.from.copy(this.projectionMatrix),t.start=performance.now(),t.duration=q.projectionTransitionDuration,t.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(t.requestRender=e),0!==t.raf&&cancelAnimationFrame(t.raf),t.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(void 0===e)return;let t=(performance.now()-e.start)/e.duration;if(t>=1)return void this._endProjectionTransition();let r=z(t),i=e.from.elements,s=this._activeSubCamera.projectionMatrix.elements,o=e.blend.elements,a=e.referenceDepth,n=Math.max(1e-6,i[15]-i[11]*a),h=r*n/(r*n+(1-r)*Math.max(1e-6,s[15]-s[11]*a));for(let e=0;e<16;e++)o[e]=i[e]+(s[e]-i[e])*h;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(void 0===e)return;0!==e.raf&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let t=this._activeSubCamera;this.projectionMatrix=t.projectionMatrix,this.projectionMatrixInverse=t.projectionMatrixInverse}_syncProjectionTransition(e){let t=e._projectionTransition;if(void 0===t)return void(void 0!==this._projectionTransition&&this._endProjectionTransition());let r=this._projectionTransition;void 0===r?(r={from:new j,blend:new j,blendInverse:new j,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):0!==r.raf&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(t.from),r.start=t.start,r.duration=t.duration,r.referenceDepth=t.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,r,i,s,o){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(e,t,r,i,s,o):this.orthoCamera.setViewOffset(e,t,r,i,s,o),this._applyProjectionTransition()}clearViewOffset(){"PerspectiveCamera"===this._cameraType?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){"PerspectiveCamera"===this._cameraType?this.toPerspective():"OrthographicCamera"===this._cameraType&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=null===e.view?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=v.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){let t={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return f(t,e)}updateCameraSubtype(e,t){let r="perspective"===e?"PerspectiveCamera":"OrthographicCamera";void 0!==t.zoom&&this.setZoom(r,t.zoom),void 0!==t.near&&this.setNear(r,t.near),void 0!==t.fov&&"PerspectiveCamera"===r&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),void 0!==e.far&&(this.far=e.far),void 0!==e.orthographic&&this.updateCameraSubtype("orthographic",e.orthographic),void 0!==e.perspective&&this.updateCameraSubtype("perspective",e.perspective),void 0!==e.type&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(t?.shared.requestRender),this.cameraType=e.type),void 0!==e.up&&this.up.fromArray(e.up.map(e=>"number"==typeof e?e:0)),void 0!==e.targetOffset&&(this.targetOffset=v.sanitizeTargetOffset(e.targetOffset)),void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,r){super.updateByPatchedOp(e,t,r),1===e.path.length&&0===e.type&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},G=q;G.projectionTransitionsEnabled=!1,G.projectionTransitionDuration=350,G.projectionTransitionMinAgeMs=1e3;var N=new j,Q=new j,Z=new j,K=new j,X=new j;function J(e){let t=!1;return e.scene.objects.traverse((e,r)=>{"BooleanGeometry"===r.geometry?.type&&(t=!0)}),t}function Y(e,t){let r=e.cloner;return void 0!==r&&r.parent===t?r:void 0}var $=new Float32Array(0);function ee(e,t,r,i){let s=16*(t.children.length+1);$.length<s&&($=new Float32Array(s));let o=0,a=e=>{e.toArray($,16*o),o++},n=!0!==t.parameters.hideBase;n&&a(i),Z.copy(e.matrix);for(let e of t.children)!g(e)||!1===e.playModeVisible||(K.copy(e.matrix).multiply(e.pivotMatrix),X.multiplyMatrices(Z,K),(!n||!X.equals(i))&&a(X));try{return 0===o?0:l(r,$.subarray(0,16*o))}finally{d(r)}}var te=class extends a{constructor(e,t,r){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new x,this.onAfterRender=(e,t,r,i,s,o)=>{super.onAfterRender(e,t,r,i,s,o),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,t,r){super.updateByPatchedOp(e,t,r),1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&void 0!==e.props.operation&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(r,i=!0){if(-1!==this.booleanMeshSetAddress&&!r)return;for(let e=0;e<this.children.length;e++){let t=this.children[e];t instanceof te&&!0===t.dataPatched.visible&&t.recomputeBoolean(!0===r,i)}this.meshSetAddresses=[];for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t instanceof u&&!0===t.dataPatched.visible&&t.geometry.attributes.position?.count>0&&t.geometry.drawRange.count>0&&0!==t.booleanMeshSetAddress){N.copy(t.matrix).multiply(t.pivotMatrix);try{let e=Y(t,this);if(-1===t.booleanMeshSetAddress){if((t.geometry.index??t.geometry.getAttribute("position")).count/3<15e5){let s=h(t.geometry,!0===r,i);t.booleanMeshSetAddress=void 0===e||-1===s?s:ee(t,e,s,N)}if(-1===t.booleanMeshSetAddress)return;void 0===e&&m(t.booleanMeshSetAddress,N),t.booleanMatrixInvOld.copy(N).invert(),t.booleanWasTransformed=!1}else t instanceof te&&!0===t.needsTransformForDownstream?(void 0===e?m(t.booleanMeshSetAddress,N):t.booleanMeshSetAddress=ee(t,e,t.booleanMeshSetAddress,N),t.needsTransformForDownstream=!1):!0===t.booleanWasTransformed&&(m(t.booleanMeshSetAddress,Q.multiplyMatrices(N,t.booleanMatrixInvOld)),t.booleanMatrixInvOld.copy(N).invert(),t.booleanWasTransformed=!1)}catch(e){console.error(e),t.booleanMeshSetAddress=0,t.geometry.userData.booleanOperationDidFail=!0;continue}if(0===t.booleanMeshSetAddress)continue;this.meshSetAddresses.push(t.booleanMeshSetAddress),t.geometry.userData.booleanOperationDidFail=!1}}if(0===this.meshSetAddresses.length){if(0!==this.geometry.getAttribute("position")?.array.length){let e=this.geometry;e.dispose(),this.geometry=new x,this.geometry.userData=e.userData,this.geometry.boundingSphere=e.boundingSphere,this.geometry.setAttribute("position",new M([],3))}return void this.geometry.setDrawRange(0,0)}if(!0===r)return c(this.meshSetAddresses,this.booleanOp);let s=this.geometry;s.dispose(),this.geometry=new x,this.geometry.userData=s.userData,this.geometry.boundingSphere=s.boundingSphere;try{this.booleanMeshSetAddress=p(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(e){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(e)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,e(this),t(this)}dispose(){super.dispose(),this.geometry.dispose()}},re=new WeakSet;function ie(e){return e.isPointLight?1:(e.isSpotLight,3)}function se(e){return e.isDirectionalLight?0:e.isSpotLight?1:2}var oe,ae=[];function ne(e){ae.length=0,e.traverseVisible(e=>{(function(e){let t=e;return!0===t.isPointLight||!0===t.isSpotLight||!0===t.isDirectionalLight})(e)&&(!0===e.castShadow||re.has(e))&&ae.push(e)});let t=!1;if(0===ae.length)return t;ae.sort((e,t)=>se(e)-se(t)||e.id-t.id);let r=12;for(let e of ae){let i=ie(e);i<=r?(r-=i,re.delete(e)&&(e.castShadow=!0,t=!0)):!0===e.castShadow&&(e.castShadow=!1,re.add(e))}return ae.length=0,t}(oe||(oe={})).is=function(e){return n.is(e)&&e instanceof A};var he=(e,t)=>class extends(o(e,t)){updateState_Light(e,t){if(this.updateState_Entity(e,t),void 0!==e.color&&(this.color=t.shared.color(e.color)),void 0!==e.intensity&&(this.intensity=e.intensity*Math.PI),void 0!==e.depth){let t=this.shadow;t.camera.far=e.depth,t.needsUpdate=!0}void 0!==e.shadows&&(function(e){re.delete(e)}(this),this.castShadow=e.shadows)}},pe=e=>e instanceof u,ce=e=>null!==e&&e instanceof te,me=e=>s.is(e);export{G as a,J as b,te as c,ne as d,oe as e,he as f,pe as g,ce as h,me as i};