@splinetool/runtime 2.0.1 → 2.0.3

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 (301) hide show
  1. package/build/boolean.js +24 -0
  2. package/build/boolean.js.br +0 -0
  3. package/build/boolean.js.gz +0 -0
  4. package/build/boolean.wasm +0 -0
  5. package/build/boolean.wasm.br +0 -0
  6. package/build/boolean.wasm.gz +0 -0
  7. package/build/hana-ui.js +63 -46
  8. package/build/hana-ui.js.br +0 -0
  9. package/build/hana-ui.js.gz +0 -0
  10. package/build/hana-ui.wasm +0 -0
  11. package/build/hana-ui.wasm.br +0 -0
  12. package/build/hana-ui.wasm.gz +0 -0
  13. package/build/runtime-chunk-2PT2WH66.js +1 -0
  14. package/build/runtime-chunk-2PT2WH66.js.br +0 -0
  15. package/build/runtime-chunk-2PT2WH66.js.gz +0 -0
  16. package/build/{runtime-chunk-XLOQIQSS.js → runtime-chunk-32ZE2X4C.js} +1 -1
  17. package/build/runtime-chunk-32ZE2X4C.js.br +0 -0
  18. package/build/runtime-chunk-32ZE2X4C.js.gz +0 -0
  19. package/build/{runtime-chunk-O5NBGIBR.js → runtime-chunk-4FAMJWEB.js} +1 -1
  20. package/build/runtime-chunk-4FAMJWEB.js.br +0 -0
  21. package/build/runtime-chunk-4FAMJWEB.js.gz +0 -0
  22. package/build/{runtime-chunk-LATYCOUS.js → runtime-chunk-6UQ4Z4JG.js} +1 -1
  23. package/build/{runtime-chunk-LATYCOUS.js.br → runtime-chunk-6UQ4Z4JG.js.br} +0 -0
  24. package/build/runtime-chunk-6UQ4Z4JG.js.gz +0 -0
  25. package/build/{runtime-chunk-BXPWRF47.js → runtime-chunk-BCJEHBXX.js} +1 -1
  26. package/build/runtime-chunk-BCJEHBXX.js.br +0 -0
  27. package/build/runtime-chunk-BCJEHBXX.js.gz +0 -0
  28. package/build/{runtime-chunk-FDRTCOJ5.js → runtime-chunk-D2IFC55F.js} +1 -1
  29. package/build/runtime-chunk-D2IFC55F.js.br +0 -0
  30. package/build/runtime-chunk-D2IFC55F.js.gz +0 -0
  31. package/build/{runtime-chunk-J2I4VBHR.js → runtime-chunk-D6NWJJTR.js} +1 -1
  32. package/build/runtime-chunk-D6NWJJTR.js.br +0 -0
  33. package/build/runtime-chunk-D6NWJJTR.js.gz +0 -0
  34. package/build/{runtime-chunk-2VFLTNIU.js → runtime-chunk-EXHPAC6T.js} +1 -1
  35. package/build/runtime-chunk-EXHPAC6T.js.br +0 -0
  36. package/build/runtime-chunk-EXHPAC6T.js.gz +0 -0
  37. package/build/{runtime-chunk-H6BPTR74.js → runtime-chunk-G5XH52BM.js} +1 -1
  38. package/build/runtime-chunk-G5XH52BM.js.br +0 -0
  39. package/build/runtime-chunk-G5XH52BM.js.gz +0 -0
  40. package/build/{runtime-chunk-ARTGMJ7O.js → runtime-chunk-MC3OVJQU.js} +1 -1
  41. package/build/runtime-chunk-MC3OVJQU.js.br +0 -0
  42. package/build/runtime-chunk-MC3OVJQU.js.gz +0 -0
  43. package/build/{runtime-chunk-5CH7XRKY.js → runtime-chunk-MVRGHRTL.js} +1 -1
  44. package/build/runtime-chunk-MVRGHRTL.js.br +0 -0
  45. package/build/runtime-chunk-MVRGHRTL.js.gz +0 -0
  46. package/build/{runtime-chunk-EAXCCTR5.js → runtime-chunk-NGWM5WPD.js} +1 -1
  47. package/build/runtime-chunk-NGWM5WPD.js.br +0 -0
  48. package/build/runtime-chunk-NGWM5WPD.js.gz +0 -0
  49. package/build/{runtime-chunk-YUK55LCN.js → runtime-chunk-NRJDJMQZ.js} +1 -1
  50. package/build/runtime-chunk-NRJDJMQZ.js.br +0 -0
  51. package/build/runtime-chunk-NRJDJMQZ.js.gz +0 -0
  52. package/build/{runtime-chunk-7NBWIU4W.js → runtime-chunk-PXPQZ7SX.js} +1 -1
  53. package/build/runtime-chunk-PXPQZ7SX.js.br +0 -0
  54. package/build/runtime-chunk-PXPQZ7SX.js.gz +0 -0
  55. package/build/runtime-chunk-Q4H7PFTE.js +1 -0
  56. package/build/runtime-chunk-Q4H7PFTE.js.br +0 -0
  57. package/build/runtime-chunk-Q4H7PFTE.js.gz +0 -0
  58. package/build/runtime-chunk-QFGFABLH.js +1 -0
  59. package/build/runtime-chunk-QFGFABLH.js.br +0 -0
  60. package/build/runtime-chunk-QFGFABLH.js.gz +0 -0
  61. package/build/{runtime-chunk-44SAPZDZ.js → runtime-chunk-RAAW7WHN.js} +1 -1
  62. package/build/runtime-chunk-RAAW7WHN.js.br +0 -0
  63. package/build/runtime-chunk-RAAW7WHN.js.gz +0 -0
  64. package/build/{runtime-chunk-5VJGAC3M.js → runtime-chunk-SQKBNW2G.js} +1 -1
  65. package/build/runtime-chunk-SQKBNW2G.js.br +0 -0
  66. package/build/runtime-chunk-SQKBNW2G.js.gz +0 -0
  67. package/build/{runtime-chunk-H6T5LPRN.js → runtime-chunk-TQBPVLGB.js} +1 -1
  68. package/build/runtime-chunk-TQBPVLGB.js.br +0 -0
  69. package/build/runtime-chunk-TQBPVLGB.js.gz +0 -0
  70. package/build/{runtime-chunk-YVNDW5TV.js → runtime-chunk-U5ACSO5E.js} +1 -1
  71. package/build/runtime-chunk-U5ACSO5E.js.br +0 -0
  72. package/build/runtime-chunk-U5ACSO5E.js.gz +0 -0
  73. package/build/{runtime-chunk-HER7UVU3.js → runtime-chunk-W7THORYR.js} +1 -1
  74. package/build/runtime-chunk-W7THORYR.js.br +0 -0
  75. package/build/runtime-chunk-W7THORYR.js.gz +0 -0
  76. package/build/{runtime-chunk-JFAQQYSH.js → runtime-chunk-XTKPUDRE.js} +1 -1
  77. package/build/runtime-chunk-XTKPUDRE.js.br +0 -0
  78. package/build/runtime-chunk-XTKPUDRE.js.gz +0 -0
  79. package/build/{runtime-chunk-T6CHRQ6N.js → runtime-chunk-XV2ZLRKD.js} +1 -1
  80. package/build/runtime-chunk-XV2ZLRKD.js.br +0 -0
  81. package/build/runtime-chunk-XV2ZLRKD.js.gz +0 -0
  82. package/build/{runtime-chunk-UK4GQHMO.js → runtime-chunk-Y2GFSK5L.js} +1 -1
  83. package/build/runtime-chunk-Y2GFSK5L.js.br +0 -0
  84. package/build/runtime-chunk-Y2GFSK5L.js.gz +0 -0
  85. package/build/runtime-chunk-ZHNGVKGZ.js +1 -0
  86. package/build/runtime-chunk-ZHNGVKGZ.js.br +0 -0
  87. package/build/runtime-chunk-ZHNGVKGZ.js.gz +0 -0
  88. package/build/{runtime-chunk-DJJZN367.js → runtime-chunk-ZLW3UWOA.js} +1 -1
  89. package/build/runtime-chunk-ZLW3UWOA.js.br +0 -0
  90. package/build/runtime-chunk-ZLW3UWOA.js.gz +0 -0
  91. package/build/{runtime-chunk-W7QPV37Y.js → runtime-chunk-ZULFQKQK.js} +1 -1
  92. package/build/runtime-chunk-ZULFQKQK.js.br +0 -0
  93. package/build/runtime-chunk-ZULFQKQK.js.gz +0 -0
  94. package/build/{runtime-classicRuntime-F5CEZRNL.js → runtime-classicRuntime-IFIIFBNS.js} +1 -1
  95. package/build/runtime-classicRuntime-IFIIFBNS.js.br +0 -0
  96. package/build/runtime-classicRuntime-IFIIFBNS.js.gz +0 -0
  97. package/build/runtime-cloners-WEF7XIM4.js +1 -0
  98. package/build/runtime-cloners-WEF7XIM4.js.br +2 -0
  99. package/build/runtime-cloners-WEF7XIM4.js.gz +0 -0
  100. package/build/{runtime-components-DYNXEVOC.js → runtime-components-LNJJ3QLB.js} +1 -1
  101. package/build/runtime-components-LNJJ3QLB.js.br +0 -0
  102. package/build/runtime-components-LNJJ3QLB.js.gz +0 -0
  103. package/build/{runtime-createDestroy-FUUG7UAK.js → runtime-createDestroy-DWI7C4WO.js} +1 -1
  104. package/build/runtime-createDestroy-DWI7C4WO.js.br +0 -0
  105. package/build/runtime-createDestroy-DWI7C4WO.js.gz +0 -0
  106. package/build/{runtime-dragDrop-GPFMU3ZB.js → runtime-dragDrop-46CHKTIE.js} +1 -1
  107. package/build/runtime-dragDrop-46CHKTIE.js.br +0 -0
  108. package/build/runtime-dragDrop-46CHKTIE.js.gz +0 -0
  109. package/build/runtime-gameControls-YA2YP4UH.js +1 -0
  110. package/build/runtime-gameControls-YA2YP4UH.js.br +0 -0
  111. package/build/runtime-gameControls-YA2YP4UH.js.gz +0 -0
  112. package/build/{runtime-hair-YOTI2EFL.js → runtime-hair-XVWLJEZC.js} +1 -1
  113. package/build/runtime-hair-XVWLJEZC.js.br +3 -0
  114. package/build/runtime-hair-XVWLJEZC.js.gz +0 -0
  115. package/build/runtime-mergeStaticGeometries-O5XKFANJ.js +1 -0
  116. package/build/runtime-mergeStaticGeometries-O5XKFANJ.js.br +0 -0
  117. package/build/runtime-mergeStaticGeometries-O5XKFANJ.js.gz +0 -0
  118. package/build/{runtime-miscActions-INSZA2CP.js → runtime-miscActions-IRARI4E6.js} +1 -1
  119. package/build/runtime-miscActions-IRARI4E6.js.br +0 -0
  120. package/build/runtime-miscActions-IRARI4E6.js.gz +0 -0
  121. package/build/{runtime-mouseHover-GZW7KW6H.js → runtime-mouseHover-3LVJJIFG.js} +1 -1
  122. package/build/runtime-mouseHover-3LVJJIFG.js.br +0 -0
  123. package/build/runtime-mouseHover-3LVJJIFG.js.gz +0 -0
  124. package/build/{runtime-particles-T2CREK6M.js → runtime-particles-INK4LA4P.js} +1 -1
  125. package/build/runtime-particles-INK4LA4P.js.br +0 -0
  126. package/build/runtime-particles-INK4LA4P.js.gz +0 -0
  127. package/build/{runtime-paths-PRHQFJ3X.js → runtime-paths-LRTW3RNL.js} +1 -1
  128. package/build/runtime-paths-LRTW3RNL.js.br +0 -0
  129. package/build/runtime-paths-LRTW3RNL.js.gz +0 -0
  130. package/build/{runtime-resize-SM6PZWJY.js → runtime-resize-4OIVU46M.js} +1 -1
  131. package/build/runtime-resize-4OIVU46M.js.br +0 -0
  132. package/build/runtime-resize-4OIVU46M.js.gz +0 -0
  133. package/build/{runtime-sceneTransition-JUZVB2S3.js → runtime-sceneTransition-X7RGRC3W.js} +1 -1
  134. package/build/runtime-sceneTransition-X7RGRC3W.js.br +0 -0
  135. package/build/runtime-sceneTransition-X7RGRC3W.js.gz +0 -0
  136. package/build/{runtime-scroll-Q6NRRL4F.js → runtime-scroll-VK7XXJPE.js} +1 -1
  137. package/build/runtime-scroll-VK7XXJPE.js.br +0 -0
  138. package/build/runtime-scroll-VK7XXJPE.js.gz +0 -0
  139. package/build/runtime-shapeBlends-VLITROES.js +1 -0
  140. package/build/runtime-shapeBlends-VLITROES.js.br +2 -0
  141. package/build/runtime-shapeBlends-VLITROES.js.gz +0 -0
  142. package/build/{runtime-text-TBHPCNPL.js → runtime-text-KC66JGLC.js} +1 -1
  143. package/build/runtime-text-KC66JGLC.js.br +0 -0
  144. package/build/runtime-text-KC66JGLC.js.gz +0 -0
  145. package/build/{runtime-textInputs-4HQER44D.js → runtime-textInputs-Y7CREUMS.js} +1 -1
  146. package/build/runtime-textInputs-Y7CREUMS.js.br +0 -0
  147. package/build/runtime-textInputs-Y7CREUMS.js.gz +0 -0
  148. package/build/{runtime-timeline-UKR4DEQS.js → runtime-timeline-KTMKRAZU.js} +1 -1
  149. package/build/runtime-timeline-KTMKRAZU.js.br +0 -0
  150. package/build/runtime-timeline-KTMKRAZU.js.gz +0 -0
  151. package/build/{runtime-tracking-5HISHPEY.js → runtime-tracking-FA45SGZJ.js} +1 -1
  152. package/build/runtime-tracking-FA45SGZJ.js.br +0 -0
  153. package/build/runtime-tracking-FA45SGZJ.js.gz +0 -0
  154. package/build/{runtime-transitions-FBNOSFXY.js → runtime-transitions-A7UP5OMB.js} +1 -1
  155. package/build/runtime-transitions-A7UP5OMB.js.br +0 -0
  156. package/build/runtime-transitions-A7UP5OMB.js.gz +0 -0
  157. package/build/{runtime-ui2d-3AMS3CSG.js → runtime-ui2d-XLYMHVMW.js} +1 -1
  158. package/build/runtime-ui2d-XLYMHVMW.js.br +0 -0
  159. package/build/runtime-ui2d-XLYMHVMW.js.gz +0 -0
  160. package/build/{runtime-vectorShapes-GIS26ELU.js → runtime-vectorShapes-MA6PKTF5.js} +1 -1
  161. package/build/runtime-vectorShapes-MA6PKTF5.js.br +0 -0
  162. package/build/runtime-vectorShapes-MA6PKTF5.js.gz +0 -0
  163. package/build/runtime-video-7GHZOZRJ.js +1 -0
  164. package/build/runtime-video-7GHZOZRJ.js.br +0 -0
  165. package/build/runtime-video-7GHZOZRJ.js.gz +0 -0
  166. package/build/runtime-webgpu-JPQ4VPBY.js +1 -0
  167. package/build/runtime-webgpu-JPQ4VPBY.js.br +0 -0
  168. package/build/runtime-webgpu-JPQ4VPBY.js.gz +0 -0
  169. package/build/runtime.cjs +359 -359
  170. package/build/runtime.js +1 -1
  171. package/build/runtime.js.br +0 -0
  172. package/build/runtime.js.gz +0 -0
  173. package/build/runtime.standalone.js +1 -1
  174. package/build/runtime.standalone.js.br +0 -0
  175. package/build/runtime.standalone.js.gz +0 -0
  176. package/build/runtime.standalone.webgl.js +1 -1
  177. package/build/runtime.standalone.webgl.js.br +0 -0
  178. package/build/runtime.standalone.webgl.js.gz +0 -0
  179. package/build/runtime.standalone.webgpu.js +1 -1
  180. package/build/runtime.standalone.webgpu.js.br +0 -0
  181. package/build/runtime.standalone.webgpu.js.gz +0 -0
  182. package/build/runtime.standalone.webgpu.micro.js +1 -1
  183. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  184. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  185. package/build/runtime.standalone.webgpu.min.js +1 -1
  186. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  187. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  188. package/package.json +1 -1
  189. package/build/runtime-chunk-23QOKH2J.js +0 -1
  190. package/build/runtime-chunk-23QOKH2J.js.br +0 -0
  191. package/build/runtime-chunk-23QOKH2J.js.gz +0 -0
  192. package/build/runtime-chunk-2VFLTNIU.js.br +0 -0
  193. package/build/runtime-chunk-2VFLTNIU.js.gz +0 -0
  194. package/build/runtime-chunk-44SAPZDZ.js.br +0 -0
  195. package/build/runtime-chunk-44SAPZDZ.js.gz +0 -0
  196. package/build/runtime-chunk-5CH7XRKY.js.br +0 -0
  197. package/build/runtime-chunk-5CH7XRKY.js.gz +0 -0
  198. package/build/runtime-chunk-5VJGAC3M.js.br +0 -0
  199. package/build/runtime-chunk-5VJGAC3M.js.gz +0 -0
  200. package/build/runtime-chunk-7NBWIU4W.js.br +0 -0
  201. package/build/runtime-chunk-7NBWIU4W.js.gz +0 -0
  202. package/build/runtime-chunk-ARTGMJ7O.js.br +0 -0
  203. package/build/runtime-chunk-ARTGMJ7O.js.gz +0 -0
  204. package/build/runtime-chunk-BXPWRF47.js.br +0 -0
  205. package/build/runtime-chunk-BXPWRF47.js.gz +0 -0
  206. package/build/runtime-chunk-CRYQVRO6.js +0 -1
  207. package/build/runtime-chunk-CRYQVRO6.js.br +0 -0
  208. package/build/runtime-chunk-CRYQVRO6.js.gz +0 -0
  209. package/build/runtime-chunk-DJJZN367.js.br +0 -0
  210. package/build/runtime-chunk-DJJZN367.js.gz +0 -0
  211. package/build/runtime-chunk-EAXCCTR5.js.br +0 -0
  212. package/build/runtime-chunk-EAXCCTR5.js.gz +0 -0
  213. package/build/runtime-chunk-FDRTCOJ5.js.br +0 -0
  214. package/build/runtime-chunk-FDRTCOJ5.js.gz +0 -0
  215. package/build/runtime-chunk-H6BPTR74.js.br +0 -0
  216. package/build/runtime-chunk-H6BPTR74.js.gz +0 -0
  217. package/build/runtime-chunk-H6T5LPRN.js.br +0 -0
  218. package/build/runtime-chunk-H6T5LPRN.js.gz +0 -0
  219. package/build/runtime-chunk-HER7UVU3.js.br +0 -0
  220. package/build/runtime-chunk-HER7UVU3.js.gz +0 -0
  221. package/build/runtime-chunk-J2I4VBHR.js.br +0 -0
  222. package/build/runtime-chunk-J2I4VBHR.js.gz +0 -0
  223. package/build/runtime-chunk-JFAQQYSH.js.br +0 -0
  224. package/build/runtime-chunk-JFAQQYSH.js.gz +0 -0
  225. package/build/runtime-chunk-LATYCOUS.js.gz +0 -0
  226. package/build/runtime-chunk-O5NBGIBR.js.br +0 -0
  227. package/build/runtime-chunk-O5NBGIBR.js.gz +0 -0
  228. package/build/runtime-chunk-QZ35BPGB.js +0 -1
  229. package/build/runtime-chunk-QZ35BPGB.js.br +0 -0
  230. package/build/runtime-chunk-QZ35BPGB.js.gz +0 -0
  231. package/build/runtime-chunk-T6CHRQ6N.js.br +0 -0
  232. package/build/runtime-chunk-T6CHRQ6N.js.gz +0 -0
  233. package/build/runtime-chunk-UK4GQHMO.js.br +0 -0
  234. package/build/runtime-chunk-UK4GQHMO.js.gz +0 -0
  235. package/build/runtime-chunk-W7QPV37Y.js.br +0 -1
  236. package/build/runtime-chunk-W7QPV37Y.js.gz +0 -0
  237. package/build/runtime-chunk-WQXDDUFV.js +0 -1
  238. package/build/runtime-chunk-WQXDDUFV.js.br +0 -0
  239. package/build/runtime-chunk-WQXDDUFV.js.gz +0 -0
  240. package/build/runtime-chunk-XLOQIQSS.js.br +0 -0
  241. package/build/runtime-chunk-XLOQIQSS.js.gz +0 -0
  242. package/build/runtime-chunk-YUK55LCN.js.br +0 -0
  243. package/build/runtime-chunk-YUK55LCN.js.gz +0 -0
  244. package/build/runtime-chunk-YVNDW5TV.js.br +0 -0
  245. package/build/runtime-chunk-YVNDW5TV.js.gz +0 -0
  246. package/build/runtime-classicRuntime-F5CEZRNL.js.br +0 -0
  247. package/build/runtime-classicRuntime-F5CEZRNL.js.gz +0 -0
  248. package/build/runtime-cloners-BLAFVALM.js +0 -1
  249. package/build/runtime-cloners-BLAFVALM.js.br +0 -0
  250. package/build/runtime-cloners-BLAFVALM.js.gz +0 -0
  251. package/build/runtime-components-DYNXEVOC.js.br +0 -0
  252. package/build/runtime-components-DYNXEVOC.js.gz +0 -0
  253. package/build/runtime-createDestroy-FUUG7UAK.js.br +0 -0
  254. package/build/runtime-createDestroy-FUUG7UAK.js.gz +0 -0
  255. package/build/runtime-dragDrop-GPFMU3ZB.js.br +0 -0
  256. package/build/runtime-dragDrop-GPFMU3ZB.js.gz +0 -0
  257. package/build/runtime-gameControls-TGEINRCX.js +0 -1
  258. package/build/runtime-gameControls-TGEINRCX.js.br +0 -0
  259. package/build/runtime-gameControls-TGEINRCX.js.gz +0 -0
  260. package/build/runtime-hair-YOTI2EFL.js.br +0 -0
  261. package/build/runtime-hair-YOTI2EFL.js.gz +0 -0
  262. package/build/runtime-mergeStaticGeometries-JI7YWYGH.js +0 -1
  263. package/build/runtime-mergeStaticGeometries-JI7YWYGH.js.br +0 -3
  264. package/build/runtime-mergeStaticGeometries-JI7YWYGH.js.gz +0 -0
  265. package/build/runtime-miscActions-INSZA2CP.js.br +0 -0
  266. package/build/runtime-miscActions-INSZA2CP.js.gz +0 -0
  267. package/build/runtime-mouseHover-GZW7KW6H.js.br +0 -0
  268. package/build/runtime-mouseHover-GZW7KW6H.js.gz +0 -0
  269. package/build/runtime-particles-T2CREK6M.js.br +0 -0
  270. package/build/runtime-particles-T2CREK6M.js.gz +0 -0
  271. package/build/runtime-paths-PRHQFJ3X.js.br +0 -0
  272. package/build/runtime-paths-PRHQFJ3X.js.gz +0 -0
  273. package/build/runtime-resize-SM6PZWJY.js.br +0 -0
  274. package/build/runtime-resize-SM6PZWJY.js.gz +0 -0
  275. package/build/runtime-sceneTransition-JUZVB2S3.js.br +0 -0
  276. package/build/runtime-sceneTransition-JUZVB2S3.js.gz +0 -0
  277. package/build/runtime-scroll-Q6NRRL4F.js.br +0 -0
  278. package/build/runtime-scroll-Q6NRRL4F.js.gz +0 -0
  279. package/build/runtime-shapeBlends-CPHLT3XC.js +0 -1
  280. package/build/runtime-shapeBlends-CPHLT3XC.js.br +0 -0
  281. package/build/runtime-shapeBlends-CPHLT3XC.js.gz +0 -0
  282. package/build/runtime-text-TBHPCNPL.js.br +0 -0
  283. package/build/runtime-text-TBHPCNPL.js.gz +0 -0
  284. package/build/runtime-textInputs-4HQER44D.js.br +0 -0
  285. package/build/runtime-textInputs-4HQER44D.js.gz +0 -0
  286. package/build/runtime-timeline-UKR4DEQS.js.br +0 -0
  287. package/build/runtime-timeline-UKR4DEQS.js.gz +0 -0
  288. package/build/runtime-tracking-5HISHPEY.js.br +0 -0
  289. package/build/runtime-tracking-5HISHPEY.js.gz +0 -0
  290. package/build/runtime-transitions-FBNOSFXY.js.br +0 -0
  291. package/build/runtime-transitions-FBNOSFXY.js.gz +0 -0
  292. package/build/runtime-ui2d-3AMS3CSG.js.br +0 -0
  293. package/build/runtime-ui2d-3AMS3CSG.js.gz +0 -0
  294. package/build/runtime-vectorShapes-GIS26ELU.js.br +0 -0
  295. package/build/runtime-vectorShapes-GIS26ELU.js.gz +0 -0
  296. package/build/runtime-video-TZNR7MEM.js +0 -1
  297. package/build/runtime-video-TZNR7MEM.js.br +0 -0
  298. package/build/runtime-video-TZNR7MEM.js.gz +0 -0
  299. package/build/runtime-webgpu-LYDFJW3X.js +0 -1
  300. package/build/runtime-webgpu-LYDFJW3X.js.br +0 -0
  301. package/build/runtime-webgpu-LYDFJW3X.js.gz +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splinetool/runtime",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Spline is a collaborative design platform for creating production-ready interactive experiences in multiple dimensions. © 2025 Spline, Inc.",
5
5
  "keywords": [
6
6
  "spline",
@@ -1 +0,0 @@
1
- import{a as e,b as t}from"./runtime-chunk-ARTGMJ7O.js";import{c as s,d as o}from"./runtime-chunk-FDRTCOJ5.js";import{da as r}from"./runtime-chunk-YUK55LCN.js";import{h as a,o as i,p as n,q as h,r as d,t as l}from"./runtime-chunk-DJJZN367.js";import{Oc as m,bd as p,dd as u,ue as c}from"./runtime-chunk-VGN7YHB7.js";var g=new m,y=new m;function b(e){let t=!1;return e.scene.objects.traverse((e,s)=>{"BooleanGeometry"===s.geometry?.type&&(t=!0)}),t}var f,A=class extends r{constructor(e,t,s){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new u,this.onAfterRender=(e,t,s,o,r,a)=>{super.onAfterRender(e,t,s,o,r,a),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,s){super.updateByPatchedOp(e,t,s),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(s,o=!0){if(-1!==this.booleanMeshSetAddress&&!s)return;for(let e=0;e<this.children.length;e++){let t=this.children[e];t instanceof A&&!0===t.dataPatched.visible&&t.recomputeBoolean(!0===s,o)}this.meshSetAddresses=[];for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t instanceof l&&!0===t.dataPatched.visible&&t.geometry.attributes.position?.count>0&&t.geometry.drawRange.count>0&&0!==t.booleanMeshSetAddress){g.multiplyMatrices(t.hiddenMatrix,t.matrix).multiply(t.pivotMatrix);try{if(-1===t.booleanMeshSetAddress){if((t.geometry.index??t.geometry.getAttribute("position")).count/3<15e5&&(t.booleanMeshSetAddress=i(t.geometry,!0===s,o)),-1===t.booleanMeshSetAddress)return;d(t.booleanMeshSetAddress,g),t.booleanMatrixInvOld.copy(g).invert(),t.booleanWasTransformed=!1}else t instanceof A&&!0===t.needsTransformForDownstream?(d(t.booleanMeshSetAddress,g),t.needsTransformForDownstream=!1):!0===t.booleanWasTransformed&&(d(t.booleanMeshSetAddress,y.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}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 u,this.geometry.userData=e.userData,this.geometry.boundingSphere=e.boundingSphere,this.geometry.setAttribute("position",new p([],3))}return void this.geometry.setDrawRange(0,0)}if(!0===s)return h(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new u,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=n(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()}};(f||(f={})).is=function(e){return a.is(e)&&e instanceof c};var S=(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&&(this.castShadow=e.shadows)}},M=e=>e instanceof l,v=e=>null!==e&&e instanceof A,D=e=>s.is(e);export{b as a,A as b,f as c,S as d,M as e,v as f,D as g};
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
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-W7QPV37Y.js";import{G as h,a as l}from"./runtime-chunk-YUK55LCN.js";import{f as d,g as c}from"./runtime-chunk-MM75L5X4.js";import{h as p}from"./runtime-chunk-DJJZN367.js";import{a as m,g as u,h as y}from"./runtime-chunk-QZ35BPGB.js";import{a as v}from"./runtime-chunk-4KZXQGUQ.js";import{a as g}from"./runtime-chunk-Z5OH244S.js";import{c as f}from"./runtime-chunk-TZCHGFVF.js";import{Fa as b}from"./runtime-chunk-OW6T4XFV.js";import{Bc as E,Dc as P,Ec as C,Fc as M,Oc as x,Oe as T,Pc as S,Rc as D,Xc as w,b as R,bd as j,cd as G,dd as L}from"./runtime-chunk-VGN7YHB7.js";var B=200,A=null;function W(t){A=t}function O(){return A}function I(t){let e=!1;return t.scene.objects.forEach(i=>{"Page"===i.data.type&&!e&&i.data.publish.gameControlObject&&b.traverseModuleInstances(t,i.id,(t,i,s)=>{for(let t of s)"GameControl"===t.data.type&&t.data.navmesh.enabled&&(e=!0)})}),e}function F(t){return s?t.metaKey:t.ctrlKey}function k(t,e){return Math.abs(t+3*e)<=2||Math.abs(t+3*window.devicePixelRatio*e)<=2}var V={type:"change"},z={type:"start"},H={type:"end",nonOrbit:!0},Z={type:"end",nonOrbit:!1},U={type:"end",isZoom:!0,nonOrbit:!0},Y={type:"end",changed:!1},X={type:"cameraAnimatingInTimeline"},N=new C,K=new P,_=2*Math.PI,Q=new M,q=new P,J=new M,$=new C,tt=new x,et={type:"requestRender"},it=class extends E{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,R.DOLLY_ROTATE,R.PAN],this.offset=new M,this.eye=new M,this.lastPosition=new M,this.lastQuaternion=new C,this.current=new P,this.overShoot=new P,this.overRatio=new P,this.spherical=new T,this.sphericalDelta=new T,this.panOffset=new M,this.panLeftV=new M,this.panUpV=new M,this.panV=new M,this.rotateStart=new P,this.rotateEnd=new P,this.rotateDelta=new P,this.panStart=new P,this.panEnd=new P,this.panDelta=new P,this.dollyStart=new P,this.dollyEnd=new P,this.dollyDelta=new P,this.rotationRangeFactor=new P,this.panRangeFactor=new P,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(J,$,Q),this.offset.copy(J).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(N.copy($).invert()),this.panOffset.applyQuaternion(N),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion($),this.panOffset.applyQuaternion($)),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),J.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(tt.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(tt));let t=this.spherical.phi%_;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(D.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(V),this.object.dispatchEvent(et),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(z),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,Q.subVectors(this.position0,this.target0),this.spherical.setFromVector3(Q),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?q.set(t.clientX-this.domElement.clientWidth/2,t.clientY-this.domElement.clientHeight/2):q.set(t.clientX-this.pointerLeaveEvent.clientX,t.clientY-this.pointerLeaveEvent.clientY),1===this.hoverRotatePanMode?(this.rotateDelta.copy(q).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(K,-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(q).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(X):!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?Z:H):this.dispatchEvent(Y),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||F(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(F(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(F(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 R.ROTATE:if(!1===this.enableRotate)return void(this.state=-1);this.handleTouchStartRotate(),this.state=3;break;case R.PAN:if(!1===this.enablePan)return void(this.state=-1);this.handleTouchStartPan(),this.state=4;break;case R.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(),this.state=5;break;case R.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=v(()=>{this.zoomChanged?this.dispatchEvent(U):this.dispatchEvent(H),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(z),this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(X);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(X);if("gesturechange"===t.type){if(!1===this.enableZoom||!1===this.isTouchZoom)return;this.dispatchEvent(z),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(H)}},this.onContextMenu=t=>{t.preventDefault()},this.onTouchEnd=t=>{t.preventDefault()},this.onKeyDown=t=>{!1!==this.enabled&&(this.key=t.key," "===t.key&&this.dispatchEvent(z))},this.onKeyUp=t=>{this.key=void 0,!1!==this.enabled&&(-1!==this.state&&"Alt"===t.key&&this.onPointerUp(e[0])," "===t.key&&this.dispatchEvent(H))},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(J,$,Q),this.offset.copy(J).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(N.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=st(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=st(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=st(st(this.spherical.theta)-t.rotationHorizontalOffset.min),this.maxTheta=st(st(this.spherical.theta)+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,1===t.orbitTouches&&(this.touches[0]=R.ROTATE),1===t.panTouches&&(this.touches[0]=R.PAN),2===t.orbitTouches&&(this.touches[1]=R.DOLLY_ROTATE),2===t.panTouches&&(this.touches[1]=R.DOLLY_PAN),3===t.orbitTouches&&(this.touches[2]=R.ROTATE),3===t.panTouches&&(this.touches[2]=R.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 M?(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(st(this.spherical.theta),st(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=st(this.overShoot.x),this.overShoot.y=st(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=ot(Math.abs(this.overRatio.x)),this.overRatio.y=ot(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 M?(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(V)}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(V)}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(V)}setZoom(t){if(this.dispatchEvent(z),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(H)}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(K,-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===F(t),i=!1===F(t)&&!0===(0===(r=t).wheelDeltaY||0===r.deltaY?!(s&&r.shiftKey&&Math.abs(r.wheelDeltaX)>=120)&&(r.wheelDeltaX?k(r.wheelDeltaX,r.deltaX):0===r.deltaMode):r.wheelDeltaY?k(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(H)),!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(H)},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 st(t){let e=2*Math.PI;for(;t<=-Math.PI;)t+=e;for(;t>Math.PI;)t-=e;return t}function ot(t){return 1-Math.pow(1-t,4)}var at,nt,rt=new Promise(t=>{at=t});function ht(t){return nt||(nt=async function(){let e=t??(g?".":"https://cdn.spline.design/@splinetool/runtime@2.0.1/build"),i=import("./physics.js"),[s,o]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(t=>t.arrayBuffer())]);await s.init(o),at(s)}())}function lt(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 dt(t,e){let i=new L;if(e&&lt(e))return i.setAttribute("position",new j([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new j([],3)),i.setIndex([]),i;let{positions:s,triIndices:o}=h(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new j(s,3)),i.setIndex(o),e&&i.applyMatrix4(e),i}var ct,pt=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=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Animation.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.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()))}},mt=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.find(t);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=>{"Toggle"===t.data.runMode?t.toggle():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()))}};rt.then(t=>ct=t);var ut=new M,yt=new C,vt=new M,gt=(new S(0,0,0,"YXZ"),new S(0,0,0,"XYZ")),ft=new M,bt=new M,Et=new M(1,1,1),Pt=new C,Ct=new x,Mt=new x,xt={type:"updateMatrix"},Tt=new C,St=new G,Dt=.01,wt={type:"beginEvent",eventName:"Collision"},Rt={type:"beginEvent",eventName:"Trigger"};function jt(t){if(b.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 Gt,Lt,Bt=t=>t.states.some(t=>void 0!==t.data.position||void 0!==t.data.rotation||void 0!==t.data.hiddenMatrix||void 0!==t.data.cloner||void 0!==t.data.pathSnapping),At=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()!==ct.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,i,s]=this.rigidBodyToMesh.get(t.handle);if(ut.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),yt.copy(t.rotation()),e.matrixWorld.compose(ut,yt,i),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(xt),s){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(),requestAnimationFrame(()=>this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(s.rigidBody));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 f("collision-bvh","trigger/collision detection");let e=[],i=[];if(this.page.traverseChildren(t=>{let s,o=t instanceof r,a=m(t);if(u(t)||o||a)return;s=y(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)}}}),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=>dt(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(lt(t.matrixWorld))return;let s=[],o="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(void 0!==o?.getAttribute("position")&&s.push(dt(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 n,r=!1,h=!i.fromCreate&&"dynamic"===a.physics.rigidBody||i.fromCreate&&i.dynamic;h?(n=ct.RigidBodyDesc.dynamic(),n.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?(n=ct.RigidBodyDesc.kinematicPositionBased(),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t),r=!0):n=ct.RigidBodyDesc.fixed();let d=l(s);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(ut,yt,vt),t.position0=ut.clone().divideScalar(this.pixelsPerMeter),t.rotation0=yt.clone(),ut.divideScalar(this.pixelsPerMeter),n.setTranslation(ut.x,ut.y,ut.z).setRotation(yt),o?d?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):d?.scale(vt.x/this.pixelsPerMeter,vt.y/this.pixelsPerMeter,vt.z/this.pixelsPerMeter);let c=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n);h?this.rigidBodyToMesh.set(c.handle,[t,vt.clone(),a.physics.fusedBody]):r?this.sharedGameControlGlobals.kinematicBodyToEntity.set(c.handle,t):this.fixedBodiesToWatch.push([t,c,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]);let p=!(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(c,a.physics,d,e,p)}catch{try{this.addCollider(c,a.physics,d,e,!1)}catch(t){console.error(t)}}t.rigidBody=c}}addBoundsTree(e){let i=[];if(void 0!==e.geometry?.getAttribute("position")&&e.geometry?.getAttribute("position").count>0&&i.push(dt(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)):g&&console.warn(`ControlsManager.addBoundsTree: object "${e.name}" has empty geometry`)}}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?ct.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):ct.ColliderDesc.convexMesh(i.getAttribute("position").array,o?i.getIndex().array:void 0)),a.setFrictionCombineRule(ct.CoefficientCombineRule.Average).setRestitutionCombineRule(ct.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(ct.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){return(i,s)=>{if(0===s)return;let o;if(u(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;o=i.object}else if(y(i))o=i.object;else if(o=i,o.dataPatched.cloner?.hideBase)return!0;let a=o.dataPatched;if("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled)return!0;1===s?t.hasNonUniformScale?i.matrixWorld.multiplyMatrices(t.shearScale,i.hiddenMatrix):i.matrixWorld.copy(i.hiddenMatrix):i.matrixWorld.multiplyMatrices(i.parent.matrixWorld,i.hiddenMatrix),i.matrixWorld.multiply(i.matrix);let n=i.geometry;void 0!==n?.getAttribute("position")&&e.push(dt(n,i.matrixWorld))}}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=O();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&&f("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 it(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();O()?.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 ct.World(new ct.Vector3(0,this.gravity,0)),this.events=new ct.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(i=>{let s;if(u(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(y(i))s=i.object;else{if(m(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 pt(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=ct.RigidBodyDesc.kinematicPositionBased();(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(ut,yt,vt),i.position0=ut.clone().divideScalar(this.pixelsPerMeter),i.rotation0=yt.clone(),ut.divideScalar(this.pixelsPerMeter),t.setTranslation(ut.x,ut.y,ut.z).setRotation(yt);let e,n=this.sharedGameControlGlobals.rapierWorld.createRigidBody(t);i.rigidBody=n,e="sphere"===o.collider.type?ct.ColliderDesc.ball(o.collider.radius/this.pixelsPerMeter):"capsule"===o.collider.type?ct.ColliderDesc.capsule((o.collider.height/2-o.collider.radius)/this.pixelsPerMeter,o.collider.radius/this.pixelsPerMeter):ct.ColliderDesc.cuboid(o.collider.width/this.pixelsPerMeter/2,o.collider.height/this.pixelsPerMeter/2,o.collider.depth/this.pixelsPerMeter/2),e.setFrictionCombineRule(ct.CoefficientCombineRule.Average).setDensity(a.physics.density).setFriction(a.physics.friction).setRestitution(0).setRestitutionCombineRule(ct.CoefficientCombineRule.Min);let r=this.sharedGameControlGlobals.rapierWorld.createCollider(e,n);this.sharedGameControlGlobals.colliderToEntity.set(r.handle,s),ut.fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)).multiply(vt.setFromMatrixScale(s.matrixWorld)).divideScalar(this.pixelsPerMeter),r.setTranslationWrtParent(ut);let h=(new C).setFromEuler((new S).setFromVector3((new M).fromArray(o.collider.rotation.map(t=>"number"==typeof t?t:0))));r.setRotationWrtParent(h),r.setActiveEvents(ct.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(dt(p,i.matrixWorld)),a.physics.fusedBody&&i.traverseObject((e,i)=>{if(0===i)return;let s;if(u(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(m(e)||e instanceof r)return;if(y(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;void 0!==a?.getAttribute("position")&&t.push(dt(a,e.matrixWorld))}),this.generateSensorColliderDescs(s,a.physics.fusedBody,e));return!(!0!==a.physics?.fusedBody&&!o)||void 0}),0===t.length)return;let i=l(t);i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let s=ct.RigidBodyDesc.fixed(),o=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s),a=ct.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(ct.CoefficientCombineRule.Multiply).setRestitutionCombineRule(ct.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,o);for(let[t,i]of e){let e=this.sharedGameControlGlobals.rapierWorld.createCollider(t,o);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 mt(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),s=(new x).compose(ft.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),Pt.setFromEuler(gt.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Et);if("box"===e.data.triggerZone){let o=new w;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(ut,yt,vt);let e=t;void 0===e.prevQ?(e.prevQ=yt.clone(),e.prevT=ut.clone()):(e.prevQ.copy(yt),e.prevT.copy(ut))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,s]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(s)||(i.setBodyType(ct.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),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<-Dt)return;let p=a.linvel();if(o>Dt&&c>Dt){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();for(let t of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(t),t.rigidBody.setNextKinematicTranslation(ut.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(yt);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(wt)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let s=Mt.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 mt(e.id,e.data,o,this.page,this.sharedAssets,this.eventManager);if(a="box"===e.data.triggerZone?ct.ColliderDesc.cuboid(...e.data.size.map(t=>("number"==typeof t?t:1)/(2*this.pixelsPerMeter))):ct.ColliderDesc.ball(e.data.radius/this.pixelsPerMeter),a.setDensity(0).setSensor(!0).setActiveEvents(ct.ActiveEvents.COLLISION_EVENTS),ft.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),Pt.setFromEuler(gt.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Ct.compose(ft,Pt,Et).premultiply(o.matrixWorld),i?(Ct.decompose(ft,Pt,bt),a.setActiveCollisionTypes(ct.ActiveCollisionTypes.KINEMATIC_FIXED|ct.ActiveCollisionTypes.DYNAMIC_FIXED)):(Ct.premultiply(s).decompose(ft,Pt,bt),t.rigidBody.bodyType()===ct.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===ct.RigidBodyType.Fixed?a.setActiveCollisionTypes(ct.ActiveCollisionTypes.KINEMATIC_FIXED|ct.ActiveCollisionTypes.DYNAMIC_FIXED):a.setActiveCollisionTypes(ct.ActiveCollisionTypes.KINEMATIC_KINEMATIC|ct.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),ft.divideScalar(this.pixelsPerMeter),a.setTranslation(ft.x,ft.y,ft.z),a.setRotation(Pt),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=Mt.copy(o.matrixWorld).decompose(ft,Tt,bt).compose(ft,Tt,Et).multiply(s),h=Ct.copy(n.matrixWorld).invert().multiply(r),l=n.bvhGeometry.boundsTree;i instanceof w?t=l.intersectsBox(i,h):(St.radius=i,St.center.setFromMatrixPosition(h),t=l.intersectsSphere(St)),t?-1===a.currentIntersectedObjects.indexOf(n)&&(a.currentIntersectedObjects.push(n),a.dispatch(),o.dispatchEvent(Rt)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(t=>t!==n)}}}},Wt=new Promise(t=>{Gt=t});function Ot(t){return Lt||(Lt=async function(){let e=t??(g?".":"https://cdn.spline.design/@splinetool/runtime@2.0.1/build"),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});Gt(n)}())}export{it as a,ht as b,B as c,W as d,I as e,dt as f,wt as g,jt as h,Bt as i,At as j,Wt as k,Ot as l};
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- function n(n){return!0===n?.isParticleSystem}function t(n){return!0===n?.isHairSystem}function e(n){return!0===n?.isShapeBlendEntity}function i(n){return!0===n?.isPathObject}function r(n){return!0===n?.isObject2D}function s(n){return!0===n?.isUIObject}function u(n){return!0===n?.isCloner}function c(n){return!0===n?.isClone}function a(n){return!0===n?.isComponentObject}export{n as a,t as b,e as c,i as d,r as e,s as f,u as g,c as h,a as i};
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- G ��8�K��Z7U�����"~����y�_]�;���[w�ΟH�^Bk���̞%�p�q+/P1 M|f�����a��۵/��9�<�wa~��@��b-DzAj� �����~N���GG��o�q�D'�����^Ǿ�&HkDTf�>�eݝ
Binary file
@@ -1 +0,0 @@
1
- import{a as t}from"./runtime-chunk-44SAPZDZ.js";import{b as e}from"./runtime-chunk-J2I4VBHR.js";import{$ as r,C as i}from"./runtime-chunk-YUK55LCN.js";import{f as s,t as n}from"./runtime-chunk-DJJZN367.js";import{c as a}from"./runtime-chunk-QZ35BPGB.js";import{c as o}from"./runtime-chunk-4KZXQGUQ.js";import{M as l}from"./runtime-chunk-OW6T4XFV.js";import{Cc as h,Ec as d,Fc as c,Oc as u,Pc as m,Rc as p,Wc as f,qd as y}from"./runtime-chunk-VGN7YHB7.js";import{a as b,b as x}from"./runtime-chunk-ML3Z74BL.js";var g=x(b((t,e)=>{var r,i;r=t,i=function(){return t.importState=function(e){var r=new t;return r.importState(e),r},t;function t(){return function(t){var e=0,r=0,i=0,s=1;0==t.length&&(t=[+new Date]);var n=function(){var t=4022871197,e=function(e){e=e.toString();for(var r=0;r<e.length;r++){var i=.02519603282416938*(t+=e.charCodeAt(r));i-=t=i>>>0,t=(i*=t)>>>0,t+=4294967296*(i-=t)}return 2.3283064365386963e-10*(t>>>0)};return e.version="Mash 0.9",e}();e=n(" "),r=n(" "),i=n(" ");for(var a=0;a<t.length;a++)(e-=n(t[a]))<0&&(e+=1),(r-=n(t[a]))<0&&(r+=1),(i-=n(t[a]))<0&&(i+=1);n=null;var o=function(){var t=2091639*e+2.3283064365386963e-10*s;return e=r,r=i,i=t-(s=0|t)};return o.next=o,o.uint32=function(){return 4294967296*o()},o.fract53=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.version="Alea 0.9",o.args=t,o.exportState=function(){return[e,r,i,s]},o.importState=function(t){e=+t[0]||0,r=+t[1]||0,i=+t[2]||0,s=+t[3]||0},o}(Array.prototype.slice.call(arguments))}},"object"==typeof t?e.exports=i():"function"==typeof define&&define.amd?define(i):r.Alea=i()})()),M=.5*(Math.sqrt(3)-1),v=(3-Math.sqrt(3))/6,w=1/3,j=1/6,A=(Math.sqrt(5),Math.sqrt(5),t=>0|Math.floor(t)),S=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),F=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);function _(t){let e=new Uint8Array(512);for(let t=0;t<256;t++)e[t]=t;for(let r=0;r<255;r++){let i=r+~~(t()*(256-r)),s=e[r];e[r]=e[i],e[i]=s}for(let t=256;t<512;t++)e[t]=e[t-256];return e}var z=new f,W=class{constructor(t){this.weightAttribute=null;let e=t.geometry;if(!e.isBufferGeometry||3!==e.attributes.position.itemSize)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");e.index&&(e=e.toNonIndexed()),this.geometry=e,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let t=this.positionAttribute,e=new Float32Array(t.count/3);for(let r=0;r<t.count;r+=3){let i=1;z.a.fromBufferAttribute(t,r),z.b.fromBufferAttribute(t,r+1),z.c.fromBufferAttribute(t,r+2),i*=z.getArea(),e[r/3]=i}this.distribution=new Float32Array(t.count/3);let r=0;for(let t=0;t<e.length;t++)r+=e[t],this.distribution[t]=r;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e){if(this.distribution){let r=this.distribution[this.distribution.length-1],i=this.binarySearch(this.randomFunction()*r);return this.sampleFace(i,t,e)}}binarySearch(t){if(!this.distribution)return 0;let e=this.distribution,r=0,i=e.length-1,s=-1;for(;r<=i;){let n=Math.ceil((r+i)/2);if(0===n||e[n-1]<=t&&e[n]>t){s=n;break}t<e[n]?i=n-1:r=n+1}return s}sampleFace(t,e,r){let i=this.randomFunction(),s=this.randomFunction();return i+s>1&&(i=1-i,s=1-s),z.a.fromBufferAttribute(this.positionAttribute,3*t),z.b.fromBufferAttribute(this.positionAttribute,3*t+1),z.c.fromBufferAttribute(this.positionAttribute,3*t+2),e.set(0,0,0).addScaledVector(z.a,i).addScaledVector(z.b,s).addScaledVector(z.c,1-(i+s)),z.getNormal(r),this}},C={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},O={polygon_center:0,edge:1,vertex:2},N=(t,e)=>(r,i)=>e&&0!==r&&0!==t?t*i/100:0,P=(t,e)=>{let r=Math.abs(e),i=-1*r;return(t- -1)*(r-i)/2+i},V=new c,T=new c,k=new c,R=new c;function I(t,e){let r=k.fromArray(t),i=R.fromArray(e);T.copy(i).sub(r);let s=T.length();return T.normalize().multiplyScalar(.5*s),V.copy(r).add(T).toArray()}var U,D,B,q,E=new f,G=new c,L=new c,$=new c,Z=class extends y{},Q=class extends Z{constructor(t,e){super(void 0,void 0,e),this.source=t,this.isClonerInstancedMesh=!0,this.hiddenMatrix=new u,this.pivotMatrix=new u,this.previousModelViewMatrix=new u,this.copyPreviousMatrix=!0,this.capacity=e,this.count=0,this.matrixAutoUpdate=!1}raycast(t,e){}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(let e of this.children)e.updateMatrixWorld(t)}updateWorldMatrix(t,e){let r=this.parent;if(t&&null!==r&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),e)for(let t of this.children)t.updateWorldMatrix(!1,!0)}onAfterRender(t,e,r,i,s,n){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}get visible(){return this.source.visible||this.source.dataPatched.visible&&!0===this.source.dataPatched.cloner?.hideBase}set visible(t){}get castShadow(){return this.source.castShadow}set castShadow(t){}get receiveShadow(){return this.source.receiveShadow}set receiveShadow(t){}get layers(){return this.source.layers}set layers(t){}get geometry(){return this.source.geometry}set geometry(t){}get material(){return this.source.material}set material(t){}get morphTargetInfluences(){return this.source.morphTargetInfluences}set morphTargetInfluences(t){}},H=t=>.5*(1-Math.cos(t*Math.PI)),J=class{constructor(){this.perlin=new Array(4096)}noise(t,e=0,r=0){if(null==this.perlin){this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=Math.random()}t<0&&(t=-t),e<0&&(e=-e),r<0&&(r=-r);let i,s,n,a,o,l=Math.floor(t),h=Math.floor(e),d=Math.floor(r),c=t-l,u=e-h,m=r-d,p=0,f=.5;for(let t=0;t<4;t++){let t=l+(h<<4)+(d<<8);i=H(c),s=H(u),n=this.perlin[4095&t],n+=i*(this.perlin[t+1&4095]-n),a=this.perlin[t+16&4095],a+=i*(this.perlin[t+16+1&4095]-a),n+=s*(a-n),t+=256,a=this.perlin[4095&t],a+=i*(this.perlin[t+1&4095]-a),o=this.perlin[t+16&4095],o+=i*(this.perlin[t+16+1&4095]-o),a+=s*(o-a),n+=H(m)*(a-n),p+=n*f,f*=.5,l<<=1,c*=2,h<<=1,u*=2,d<<=1,m*=2,c>=1&&(l++,c--),u>=1&&(h++,u--),m>=1&&(d++,m--)}return p}noiseSeed(t){let e=(()=>{let t,e;return{setSeed(r){e=t=(r??4294967296*Math.random())>>>0},getSeed:()=>t,rand:()=>(e=(1664525*e+1013904223)%4294967296,e/4294967296)}})();e.setSeed(t),this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=e.rand()}},K=1e-4,X=new c,Y=new c;i.then(t=>{D=[(U=t).get_face_center,U.get_edge_midpoint,U.get_vertex_position],B=[U.get_face_normal,U.get_edge_normal,U.get_vertex_normal],q=[U.face_count,U.edge_count,U.vertex_count]}),new u;var tt=new u,et=new u,rt=new u,it=new u,st=new u,nt=new u,at=new u,ot=new c,lt=new c,ht=new c,dt=new c,ct=new c,ut=new c,mt=new c,pt=new c,ft=new c,yt=new c,bt=new c,xt=new m,gt=new d;function Mt(t){return t?t.version??t.data?.version??0:-1}function vt(t,e){return["number"==typeof t?.[0]?t[0]:"string"==typeof t?.[0]&&e?parseFloat(String(e.shared.getVariable(t[0])??"0")):0,"number"==typeof t?.[1]?t[1]:"string"==typeof t?.[1]&&e?parseFloat(String(e.shared.getVariable(t[1])??"0")):0,"number"==typeof t?.[2]?t[2]:"string"==typeof t?.[2]&&e?parseFloat(String(e.shared.getVariable(t[2])??"0")):0]}var wt=class{constructor(t,e){this.data=t,this.is3D=e,this.perlin=new J,"perlin"===t.noiseType?(this.perlin.noiseSeed(t.seed),this.noise=e?(t,e,r)=>this.perlin.noise(t,e,r):t=>this.perlin.noise(t)):this.noise=e?function(t=Math.random){let e=_(t),r=new Float64Array(e).map(t=>F[t%12*3]),i=new Float64Array(e).map(t=>F[t%12*3+1]),s=new Float64Array(e).map(t=>F[t%12*3+2]);return function(t,n,a){let o,l,h,d,c,u,m,p,f,y,b=(t+n+a)*w,x=A(t+b),g=A(n+b),M=A(a+b),v=(x+g+M)*j,S=t-(x-v),F=n-(g-v),_=a-(M-v);S>=F?F>=_?(c=1,u=0,m=0,p=1,f=1,y=0):S>=_?(c=1,u=0,m=0,p=1,f=0,y=1):(c=0,u=0,m=1,p=1,f=0,y=1):F<_?(c=0,u=0,m=1,p=0,f=1,y=1):S<_?(c=0,u=1,m=0,p=0,f=1,y=1):(c=0,u=1,m=0,p=1,f=1,y=0);let z=S-c+j,W=F-u+j,C=_-m+j,O=S-p+2*j,N=F-f+2*j,P=_-y+2*j,V=S-1+.5,T=F-1+.5,k=_-1+.5,R=255&x,I=255&g,U=255&M,D=.6-S*S-F*F-_*_;if(D<0)o=0;else{let t=R+e[I+e[U]];D*=D,o=D*D*(r[t]*S+i[t]*F+s[t]*_)}let B=.6-z*z-W*W-C*C;if(B<0)l=0;else{let t=R+c+e[I+u+e[U+m]];B*=B,l=B*B*(r[t]*z+i[t]*W+s[t]*C)}let q=.6-O*O-N*N-P*P;if(q<0)h=0;else{let t=R+p+e[I+f+e[U+y]];q*=q,h=q*q*(r[t]*O+i[t]*N+s[t]*P)}let E=.6-V*V-T*T-k*k;if(E<0)d=0;else{let t=R+1+e[I+1+e[U+1]];E*=E,d=E*E*(r[t]*V+i[t]*T+s[t]*k)}return 32*(o+l+h+d)}}((0,g.default)(t.seed)):function(t=Math.random){let e=_(t),r=new Float64Array(e).map(t=>S[t%12*2]),i=new Float64Array(e).map(t=>S[t%12*2+1]);return function(t,s){let n,a,o=0,l=0,h=0,d=(t+s)*M,c=A(t+d),u=A(s+d),m=(c+u)*v,p=t-(c-m),f=s-(u-m);p>f?(n=1,a=0):(n=0,a=1);let y=p-n+v,b=f-a+v,x=p-1+2*v,g=f-1+2*v,w=255&c,j=255&u,S=.5-p*p-f*f;if(S>=0){let t=w+e[j];S*=S,o=S*S*(r[t]*p+i[t]*f)}let F=.5-y*y-b*b;if(F>=0){let t=w+n+e[j+a];F*=F,l=F*F*(r[t]*y+i[t]*b)}let _=.5-x*x-g*g;if(_>=0){let t=w+1+e[j+1];_*=_,h=_*_*(r[t]*x+i[t]*g)}return 70*(o+l+h)}}((0,g.default)(t.seed??""))}},jt=class extends(s(p)){constructor(t,e){super(),this.parameters=e,this.isCloner=!0,this.objectForSample=void 0,this._pendingMediaLoad=!1,this.random=null,this.surfaceSamplerCache=null,this.surfacePointsCache=null,this.object=t}resetOnMove(){this.removeFromParent(),this.parent=null}removeFromParent(){return super.removeFromParent(),this.instancedMesh?.removeFromParent(),this}dispose(){this.removeFromParent(),this._disposeInstancedMesh()}expandClones(t){if(null===this.parent)this.updateState(this.parameters,t);else{for(let t of this.children)t instanceof r&&t.expand();this._syncInstancedMesh()}}invalidateTransform(t){this.matrixWorldNeedsUpdate=!0}onObjUpdateMatrix(){"toObject"!==this.parameters.type&&(this.matrixWorldNeedsUpdate=!0)}update(t){switch(this._updateCount(t),this.parameters.type){case"radial":this._updateRadial(this.parameters,t);break;case"linear":this._updateLinear(this.parameters,t);break;case"grid":this._updateGrid(this.parameters,t);break;case"toObject":this._updateToObject(this.parameters,t)}for(let t of this.children){let e=t.transformOverride;void 0!==e&&(t.position.fromArray(e.position),t.rotation.fromArray(e.rotation),t.scale.fromArray(e.scale)),t.updateMatrix(),t.hasNonUniformScale&&(t.updateMatrixWorld(),t.updateMatrixWorldRigid())}this._syncInstancedMesh()}get instancingActive(){return void 0!==this.instancedMesh}_instancingEligible(){if(!0!==this.parameters.instanced)return!1;let t=this.object;return!(t.entityChildrenCount()>0||!0!==t.isMesh||a(t)||!0===t.isDecalObject)}_syncInstancedMesh(){if(!this._instancingEligible())return void this._disposeInstancedMesh();let t=this.instancedMesh;if(void 0!==t&&t.capacity<this.children.length&&(this._disposeInstancedMesh(),t=void 0),void 0===t){let e=Math.max(8,Math.ceil(1.5*this.children.length));t=this.instancedMesh=new Q(this.object,e)}t.matrix=this.matrix,t.hiddenMatrix=this.hiddenMatrix,t.matrixWorldNeedsUpdate=!0,t.parent!==this.parent&&(t.removeFromParent(),this.parent?.add(t)),this.syncInstanceMatrices()}syncInstanceMatrices(){let t=this.instancedMesh;if(void 0===t)return;let e=0;for(let r of this.children)!1!==r.playModeVisible&&(et.multiplyMatrices(r.hiddenMatrix,r.matrix).multiply(r.pivotMatrix),t.setMatrixAt(e++,et));t.count=e,t.instanceMatrix.needsUpdate=!0,t.boundingSphere=null}_disposeInstancedMesh(){let t=this.instancedMesh;void 0!==t&&(this.instancedMesh=void 0,t.removeFromParent(),t.dispose())}_updateCount(t,e){let i;if(void 0!==e)i=e;else{let e=vt(this.parameters.grid.count,t);i="grid"===this.parameters.type?Math.round(e[0])*Math.round(e[1])*Math.round(e[2]):this.parameters.count}if("toObject"===this.parameters.type)if(this.parameters.toObject.object){if(void 0===e&&"random"!==this.parameters.toObject.spreadType)return}else i=0;if(this.children.length!==i)if(this.children.length<i)for(let t=0,e=i-this.children.length;t<e;++t){let t=new r(this.object);t.expand(),this.add(t)}else for(;this.children.length>i;){let t=this.children.pop();t.parent=null,t.dispatchEvent({type:"removed"}),this.dispatchEvent({type:"childremoved",child:t})}}getRandom(t,e=!1){return(null===this.random||this.random.data.seed!==t.seed||this.random.data.noiseType!==t.noiseType||this.random.is3D!==e)&&(this.random=new wt(t,e)),this.random}_updateRadial(t,e){let r,i=t.radial,s=i.start*h.DEG2RAD,n=s-i.end*h.DEG2RAD,a=vt(i.rotation,e),o=new m(a[0],a[1],a[2]);switch(i.axis){case"z":r=new c(0,0,1);break;case"y":r=new c(0,1,0);break;default:r=new c(1,0,0)}let d=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,u=!0===this.parameters.randomness&&0!==d.strength?this.getRandom(d):null,p=vt(i.scale,e),f=vt(i.position,e),y=vt(d.scale,e),b=vt(d.position,e),x=vt(d.rotation,e),g=n/t.count,M=N(d.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let n=t*(d.freqScale/10)+d.movement,a=null===u?0:u.noise(n,n,n),l=t+1;e.scale.x=p[0]+M(l,P(a,y[0]))||K,e.scale.y=p[1]+M(l,P(a,y[1]))||K,e.scale.z=p[2]+M(l,P(a,y[2]))||K;let h=g*t-s;switch(i.axis){default:case"x":xt.set(0,h,0);break;case"y":xt.set(0,0,h);break;case"z":xt.set(h,0,0)}mt.copy(r).applyQuaternion(gt.setFromEuler(xt)).multiplyScalar(i.radius),e.position.set(mt.x+(f[0]+M(l,P(a,b[0]))),mt.y+(f[1]+M(l,P(a,b[1]))),mt.z+(f[2]+M(l,P(a,b[2]))));let c=M(l,P(a,x[0])),m=M(l,P(a,x[1])),v=M(l,P(a,x[2]));!0===i.alignment?e.rotation.set(xt.x+(o.x+c),xt.y+(o.y+m),xt.z+(o.z+v)):e.rotation.set(o.x+c,o.y+m,o.z+v)}}_updateLinear(t,e){if("linear"!==t.type)throw new Error;let r=t.linear,i=vt(r.rotation,e),s=vt(r.scale,e),n=vt(r.position,e),a=new m(i[0]??0,i[1]??0,i[2]??0),o=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,h=vt(o.rotation,e),d=vt(o.scale,e),c=vt(o.position,e),u=!0===this.parameters.randomness&&0!==o.strength?this.getRandom(o):null,p=N(o.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let r=t*(o.freqScale/10)+o.movement,i=null===u?0:u.noise(r,r,r),l=t+1,m=p(l,P(i,h[0])),f=p(l,P(i,h[1])),y=p(l,P(i,h[2]));e.scale.x=1+(s[0]-1)*t+p(l,P(i,d[0]))||K,e.scale.y=1+(s[1]-1)*t+p(l,P(i,d[1]))||K,e.scale.z=1+(s[2]-1)*t+p(l,P(i,d[2]))||K,e.rotation.set(a.x*t+m,a.y*t+f,a.z*t+y),e.position.x=n[0]*t+p(l,P(i,c[0])),e.position.y=n[1]*t+p(l,P(i,c[1])),e.position.z=n[2]*t+p(l,P(i,c[2]))}}_updateGrid(t,e){let r=0,i=t.grid,s=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,n=vt(s.scale,e),a=vt(s.rotation,e),o=vt(s.position,e),h=!0===this.parameters.randomness&&0!==s.strength?this.getRandom(s,!0):null,d=N(s.strength,this.parameters.randomness),u=vt(i.count,e),m=vt(i.size,e);if(!0===i.useCenter){let t={x:u[0]%2==0?2:1,y:u[1]%2==0?2:1,z:u[2]%2==0?2:1},e=new c(m[0]*(u[0]-t.x)*.5,m[1]*(u[1]-t.y)*.5,m[2]*(u[2]-t.z)*.5);for(let t=0;t<u[0];t++)for(let i=0;i<u[1];i++)for(let l=0;l<u[2];l++){let c=this.children[r++];if(!c)continue;let u=null===h?0:h.noise((t+1)*(s.freqScale/10)+s.movement,(i+1)*(s.freqScale/10)+s.movement,(l+1)*(s.freqScale/10)+s.movement);c.scale.x=1+d(r,P(u,n[0]))||K,c.scale.y=1+d(r,P(u,n[1]))||K,c.scale.z=1+d(r,P(u,n[2]))||K;let p=d(r,P(u,a[0])),f=d(r,P(u,a[1])),y=d(r,P(u,a[2]));c.rotation.set(p,f,y),c.position.x=m[0]*t-e.x+d(r,P(u,o[0])),c.position.y=m[1]*i-e.y+d(r,P(u,o[1])),c.position.z=m[2]*l-e.z+d(r,P(u,o[2]))}}else for(let t=0;t<u[0];t++)for(let e=0;e<u[1];e++)for(let i=0;i<u[2];i++){let l=this.children[r++];if(!l)continue;let c=null===h?0:h.noise((t+1)*(s.freqScale/10)+s.movement,(e+1)*(s.freqScale/10)+s.movement,(i+1)*(s.freqScale/10)+s.movement);l.scale.x=1+d(r,P(c,n[0]))||K,l.scale.y=1+d(r,P(c,n[1]))||K,l.scale.z=1+d(r,P(c,n[2]))||K;let u=d(r,P(c,a[0])),p=d(r,P(c,a[1])),f=d(r,P(c,a[2]));l.rotation.set(u,p,f),l.position.x=m[0]*t+d(r,P(c,o[0])),l.position.y=-m[1]*e+d(r,P(c,o[1])),l.position.z=-m[2]*i+d(r,P(c,o[2]))}}_updateToObject(r,i){if("toObject"!==r.type)throw new Error;let{toObject:s}=r,n=vt(s.rotation,i),a=vt(s.position,i),o=vt(s.scale,i),h=new m(n[0],n[1],n[2]),d=r.randomnessObject??l.defaultData([1,1,1]).randomnessObject,c=vt(d.rotation,i),u=vt(d.position,i),p=vt(d.scale,i),f=!0===this.parameters.randomness&&0!==d.strength?this.getRandom(d):null,y=N(d.strength,this.parameters.randomness);if(!s.object){for(let[,t]of this.children.entries())t.position.set(0,0,0),t.scale.setScalar(1),t.rotation.set(0,0,0);return this.objectForSample=void 0,void this.invalidateSurfaceCaches()}if(!this.objectForSample)return;if(this.objectForSample instanceof t){if(!this.objectForSample.font?.isLoaded||void 0===this.objectForSample.geometry.attributes.position)return void(this._pendingMediaLoad=!0);this._pendingMediaLoad=!1}if(void 0===this.objectForSample.geometry&&this.objectForSample.isAncestorOf(this.object.uuid))return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) seem to be a child/descendant of the object it's being cloned to. Please re-parent it so that they are siblings instead.`);let b=this.getSubdivData();if(b.length>0){let t=Math.round(b.length*s.count/100);this._updateCount(i,t)}else{let t=this.objectForSample.geometry.getAttribute("position");if(!t||isNaN(t.count)||0===t.count)return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`)}this.objectForSample.updateMatrixWorld();let x="random"===s.spreadType,M=null;x&&(M=this.getSurfaceSampler(),M.setRandomGenerator((0,g.default)(this.object.uuid+s.seed)));let v=C[s.axis],w=this.children;ot.fromArray(v),rt.copy(this.object.hiddenMatrix).invert();let j=this.objectForSample instanceof e;j&&it.copy(this.objectForSample.matrixWorld).invert(),"normal"!==s.align&&this.object.getWorldDirection(ut),yt.set(ot.y,ot.z,ot.x).normalize(),bt.copy(yt).cross(ot).normalize(),nt.makeBasis(yt,ot,bt).invert();for(let[t,e]of w.entries()){let r=t*(d.freqScale/10)+d.movement,i=null===f?0:f.noise(r,r,r),n=t+1,l=y(n,P(i,c[0])),m=y(n,P(i,c[1])),g=y(n,P(i,c[2]));x?M.sample(ht,dt):(b.length&&(ht.fromArray(b[t].pos),dt.fromArray(b[t].norm)),j&&ht.applyMatrix4(it)),ht.applyMatrix4(rt),e.position.copy(ht);let v="normal"===s.align?dt:ut,w=lt.fromArray(a);lt.x+=y(n,P(i,u[0])),lt.y+=y(n,P(i,u[1])),lt.z+=y(n,P(i,u[2]));let A=Math.acos(v.dot(ot)),S=ct.crossVectors(ot,v).normalize(),F=tt.makeRotationAxis(S,A);pt.copy(v).cross(this.object.up).normalize(),ft.copy(pt).cross(v).normalize(),st.makeBasis(pt,v,ft),at.multiplyMatrices(st,nt),xt.setFromRotationMatrix(at),w.applyMatrix4(F),e.position.add(w),e.rotation.set(xt.x+h.x+l,xt.y+h.y+m,xt.z+h.z+g),e.scale.set(1+o[0]+y(n,P(i,p[0]))||K,1+o[1]+y(n,P(i,p[1]))||K,1+o[2]+y(n,P(i,p[2]))||K),e.scale.multiply(this.object.scale),e.hiddenMatrix=this.object.hiddenMatrix}}getSurfaceSampler(){let t=this.objectForSample,e=t.geometry,r=e.getAttribute("position"),i=e.index,s=this.surfaceSamplerCache;if(null!==s&&s.geometry===e&&s.position===r&&s.positionVersion===Mt(r)&&s.index===i&&s.indexVersion===(null===i?-1:i.version))return s.sampler;let n=new W(t).build();return this.surfaceSamplerCache={geometry:e,position:r,positionVersion:Mt(r),index:i,indexVersion:null===i?-1:i.version,sampler:n},n}invalidateSurfaceCaches(){this.surfaceSamplerCache=null,this.surfacePointsCache=null}getSubdivData(){if(!this.objectForSample)return[];let t=this.parameters.toObject.spreadType;if("random"===t)return[];let r=this.objectForSample instanceof e,i=this.objectForSample.geometry;if(!r&&i){let e=this.surfacePointsCache,r=i.getAttribute("position");if(null!==e&&e.spreadType===t&&e.geometry===i&&e.position===r&&e.positionVersion===Mt(r)&&e.index===i.index&&e.indexVersion===(null===i.index?-1:i.index.version))return e.points}let s=new Map,n=(t,e)=>{let r=Math.round(1e4*t[0])+"_"+Math.round(1e4*t[1])+"_"+Math.round(1e4*t[2]),i=s.get(r);i?(i.pos[0]+=t[0],i.pos[1]+=t[1],i.pos[2]+=t[2],i.norm[0]+=e[0],i.norm[1]+=e[1],i.norm[2]+=e[2],i.count+=1):s.set(r,{pos:[...t],norm:[...e],count:1})};if(r){let e=this.objectForSample,r=O[t],i=q[r],s=D[r],a=B[r],o=i(e.subdivPointerNew);for(let t=0;t<=o-1;t++){let r=s(e.subdivPointerNew,t),i=a(e.subdivPointerNew,t);X.fromArray(r).applyMatrix4(e.matrixWorld),Y.fromArray(i),n(X.toArray(),Y.toArray())}}else(i.index?function(t){let e=[],r=Math.floor(t.index.count/3);for(let i=0;i<r;i++)if(G.fromArray(t.index.array,3*i),E.setFromAttributeAndIndices(t.attributes.position,G.x,G.y,G.z),E.getNormal(L),E.getMidpoint($),!(isNaN($.x)||isNaN($.y)||isNaN($.z))){let{a:t,b:r,c:i}=E,s=t.toArray(),n=r.toArray(),a=i.toArray(),o=t.distanceTo(r),l=r.distanceTo(i),h=i.distanceTo(t),d=I(s,n),c=I(n,a),u=I(a,s),m=[o,l,h],p=Math.max(...m),f=m.filter(t=>Math.round(t)===Math.round(p)).length>1,y=[],b=E.getMidpoint($).toArray();p===o&&!f&&(y=[c,u,u],b=d),p===l&&!f&&(y=[d,u,u],b=c),p===h&&!f&&(y=[d,c,c],b=u),f&&(y=[d,c,u]),e.push({vertices:[s,n,a],faceCenters:y,midpoint:b,norm:E.getNormal(L).toArray()})}return e}(i):function(t){let e=[],{position:r}=t.attributes;for(let t=0;t<r.count;t++){E.setFromAttributeAndIndices(r,3*t,3*t+1,3*t+2),E.getNormal(L),E.getMidpoint($);let i=E.a.toArray(),s=E.b.toArray(),n=E.c.toArray();e.push({vertices:[i,s,n],faceCenters:[I(i,s),I(s,n),I(n,i)],midpoint:$.toArray(),norm:L.toArray()})}return e}(i)).forEach((e,r)=>{"polygon_center"===t&&n(e.midpoint,e.norm),"vertex"===t&&(n(e.vertices[0],e.norm),n(e.vertices[1],e.norm),n(e.vertices[2],e.norm)),"edge"===t&&(n(e.faceCenters[0],e.norm),n(e.faceCenters[1],e.norm),n(e.faceCenters[2],e.norm))});let a=Array.from(s.values());for(let t of a)t.pos[0]/=t.count,t.pos[1]/=t.count,t.pos[2]/=t.count,t.norm[0]/=t.count,t.norm[1]/=t.count,t.norm[2]/=t.count;if(!r&&i){let e=i.getAttribute("position");this.surfacePointsCache={spreadType:t,geometry:i,position:e,positionVersion:Mt(e),index:i.index,indexVersion:null===i.index?-1:i.index.version,points:a}}return a}updateState(t,e){if(this.parameters=o(t),"toObject"!==this.parameters.type)this.invalidateSurfaceCaches(),(null===this.parent||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.hiddenMatrix=this.object.hiddenMatrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(null===this.parent||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent(),this.invalidateSurfaceCaches();let t=e.scene.find(this.parameters.toObject.object);this.objectForSample=t instanceof n?t:void 0,this.matrix=new u,this.hiddenMatrix=new u,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,t&&t.add(this)}this.update(e)}get pendingMediaLoad(){return this._pendingMediaLoad}};export{jt as a};
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- import{a as r}from"./runtime-chunk-WQXDDUFV.js";import"./runtime-chunk-44SAPZDZ.js";import"./runtime-chunk-J2I4VBHR.js";import"./runtime-chunk-ARTGMJ7O.js";import"./runtime-chunk-YUK55LCN.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{c as m}from"./runtime-chunk-DJJZN367.js";import"./runtime-chunk-QZ35BPGB.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-Z5OH244S.js";import{a as n}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-OW6T4XFV.js";import"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";m.Cloner=r,n("cloners");
@@ -1 +0,0 @@
1
- import{a as t}from"./runtime-chunk-WQXDDUFV.js";import"./runtime-chunk-44SAPZDZ.js";import{c as e,d as i,f as o,g as s,i as n,k as r}from"./runtime-chunk-CRYQVRO6.js";import"./runtime-chunk-N2ZRGNPR.js";import{a}from"./runtime-chunk-VAVYZ35B.js";import{e as h,f as l,g as c}from"./runtime-chunk-FQNSP44B.js";import{a as d}from"./runtime-chunk-HER7UVU3.js";import"./runtime-chunk-W7QPV37Y.js";import"./runtime-chunk-J2I4VBHR.js";import"./runtime-chunk-ARTGMJ7O.js";import"./runtime-chunk-LATYCOUS.js";import"./runtime-chunk-FDRTCOJ5.js";import{$ as m,G as p,N as u,a as y,p as g}from"./runtime-chunk-YUK55LCN.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f,g as v}from"./runtime-chunk-MM75L5X4.js";import{h as b}from"./runtime-chunk-DJJZN367.js";import"./runtime-chunk-QZ35BPGB.js";import"./runtime-chunk-4KZXQGUQ.js";import{a as x}from"./runtime-chunk-Z5OH244S.js";import{a as w}from"./runtime-chunk-TZCHGFVF.js";import{Ka as P,La as M,ea as E,g as S,ua as j}from"./runtime-chunk-OW6T4XFV.js";import{Bc as A,Cc as T,Dc as D,Ec as k,Fc as C,Oc as O,Pc as z,Re as R,Xc as F,Zc as _,dd as X,ld as W}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var N=(t,e)=>{let i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)},V=t=>t*(Math.PI/180),L=new Map,I=(t,e,i)=>{let o,s=e.split(/[ ,]+/g);for(let e=0;e<s.length;e+=1)o=s[e],t.addEventListener?t.addEventListener(o,i,!1):t.attachEvent&&t.attachEvent(o,i)},Q=(t,e,i)=>{let o,s=e.split(/[ ,]+/g);for(let e=0;e<s.length;e+=1)o=s[e],t.removeEventListener?t.removeEventListener(o,i):t.detachEvent&&t.detachEvent(o,i)},Y=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),Z=()=>{if(!(typeof window>"u"))return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},B=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},G=(t,e,i)=>{let o=q(t);for(let t in o)if(Object.prototype.hasOwnProperty.call(o,t))if("string"==typeof e)o[t]=e+" "+i;else{let s="";for(let t=0,o=e.length;t<o;t+=1)s+=e[t]+" "+i+", ";o[t]=s.slice(0,-2)}return o},q=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},U=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},H=(t,e)=>{if(t.length)for(let i=0,o=t.length;i<o;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(J="ontouchstart"in window,K=!!window.PointerEvent,$=!!window.MSPointerEvent);var J,K,$,tt,et={start:"mousedown",move:"mousemove",end:"mouseup"},it={};function ot(){}K?tt={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:$?tt={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:J?(tt={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},it=et):tt=et,ot.prototype.on=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],o._handlers_[i]=o._handlers_[i]||[],o._handlers_[i].push(e);return o},ot.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},void 0===t?i._handlers_={}:void 0===e?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},ot.prototype.trigger=function(t,e){var i,o=this,s=t.split(/[ ,]+/g);o._handlers_=o._handlers_||{};for(var n=0;n<s.length;n+=1)i=s[n],o._handlers_[i]&&o._handlers_[i].length&&o._handlers_[i].forEach(function(t){t.call(o,{type:i,target:o},e)})},ot.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((t,e)=>{let i={};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&Object.prototype.hasOwnProperty.call(e,o)?i[o]=e[o]:Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o]);return i})(e.options,t))},ot.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){"function"==typeof i["on"+e]?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},I(t,tt[e],i._domHandlers_[e]),it[e]&&I(t,it[e],i._domHandlers_[e]),i},ot.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},Q(t,tt[e],i._domHandlers_[e]),it[e]&&Q(t,it[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var st=ot;function nt(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=nt.id,nt.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}nt.prototype=new st,nt.constructor=nt,nt.id=0,nt.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},nt.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let t=q("borderRadius");for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]="50%");return t})(),i=G("transition","opacity",t),o={};return o.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},o.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},o.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},U(o.el,i),"circle"===this.options.shape&&U(o.back,e),U(o.front,e),this.applyStyles(o),this},nt.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},nt.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},nt.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},nt.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},nt.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),"function"==typeof t&&t.call(this)},e.options.fadeTime)),e},nt.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i="dynamic"===e.options.mode?"none":"block";e.ui.el.style.display=i,"function"==typeof t&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,o={};o.x=!0===i||!1!==i.x?0:e.instance.frontPosition.x,o.y=!0===i||!1!==i.y?0:e.instance.frontPosition.y,e.setPosition(t,o)}return e},nt.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var o=i.options.fadeTime+"ms",s={};s.front=G("transition",["top","left"],o);var n={front:{}};n.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(s),i.applyStyles(n),i.restTimeout=setTimeout(function(){"function"==typeof t&&t.call(i),i.restCallback()},i.options.fadeTime)},nt.prototype.restCallback=function(){var t=this,e={};e.front=G("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},nt.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},nt.prototype.computeDirection=function(t){var e,i,o,s=t.angle.radian,n=Math.PI/4,r=Math.PI/2;if(s>n&&s<3*n&&!t.lockX?e="up":s>-n&&s<=n&&!t.lockY?e="left":s>3*-n&&s<=-n&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=s>-r&&s<r?"left":"right"),t.lockX||(o=s>0?"up":"down"),t.force>this.options.threshold){var a,h={};for(a in this.direction)Object.prototype.hasOwnProperty.call(this.direction,a)&&(h[a]=this.direction[a]);var l={};for(a in this.direction={x:i,y:o,angle:e},t.direction=this.direction,h)h[a]===this.direction[a]&&(l[a]=!0);if(l.x&&l.y&&l.angle)return t;(!l.x||!l.y)&&this.trigger("plain",t),l.x||this.trigger("plain:"+i,t),l.y||this.trigger("plain:"+o,t),l.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var rt=nt;function at(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=at.id,at.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),("static"===i.options.mode||"semi"===i.options.mode)&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let o=getComputedStyle(i.options.zone.parentElement);return o&&"flex"===o.display&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}at.prototype=new st,at.constructor=at,at.id=0,at.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(t){if(void 0===t)return e[0];for(var i=0,o=e.length;i<o;i+=1)if(e[i].identifier===t)return e[i];return!1}},at.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},at.prototype.begin=function(){var t=this,e=t.options;if("static"===e.mode){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},at.prototype.createNipple=function(t,e){var i=this,o=i.manager.scroll,s={},n=i.options,r=i.parentIsFlex?o.x:o.x+i.box.left,a=i.parentIsFlex?o.y:o.y+i.box.top;if(t.x&&t.y)s={x:t.x-r,y:t.y-a};else if(t.top||t.right||t.bottom||t.left){var h=document.createElement("DIV");h.style.display="hidden",h.style.top=t.top,h.style.right=t.right,h.style.bottom=t.bottom,h.style.left=t.left,h.style.position="absolute",n.zone.appendChild(h);var l=h.getBoundingClientRect();n.zone.removeChild(h),s=t,t={x:l.left+o.x,y:l.top+o.y}}var c=new rt(i,{color:n.color,size:n.size,threshold:n.threshold,fadeTime:n.fadeTime,dataOnly:n.dataOnly,restJoystick:n.restJoystick,restOpacity:n.restOpacity,mode:n.mode,identifier:e,position:t,zone:n.zone,frontPosition:{x:0,y:0},shape:n.shape});return n.dataOnly||(B(c.ui.el,s),B(c.ui.front,c.frontPosition)),i.nipples.push(c),i.trigger("added "+c.identifier+":added",c),i.manager.trigger("added "+c.identifier+":added",c),i.bindNipple(c),c},at.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},at.prototype.bindNipple=function(t){var e,i=this,o=function(t,o){e=t.type+" "+o.id+":"+t.type,i.trigger(e,o)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",o),t.on("dir:up dir:right dir:down dir:left",o),t.on("plain:up plain:right plain:down plain:left",o)},at.prototype.pressureFn=function(t,e,i){var o=this,s=0;clearInterval(o.pressureIntervals[i]),o.pressureIntervals[i]=setInterval(function(){var i=t.force||t.pressure||t.webkitForce||0;i!==s&&(e.trigger("pressure",i),o.trigger("pressure "+e.identifier+":pressure",i),s=i)}.bind(o),100)},at.prototype.onstart=function(t){var e=this,i=e.options,o=t;return t=Y(t),e.updateBox(),H(t,function(s){e.actives.length<i.maxNumberOfNipples?e.processOnStart(s):o.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(i){if(Object.values(o.touches).findIndex(function(t){return t.identifier===i})<0){var s=[t[0]];s.identifier=i,e.processOnEnd(s)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(s))}),e.manager.bindDocument(),!1},at.prototype.processOnStart=function(t){var e,i=this,o=i.options,s=i.manager.getIdentifier(t),n=t.force||t.pressure||t.webkitForce||0,r={x:t.pageX,y:t.pageY},a=i.getOrCreate(s,r);a.identifier!==s&&i.manager.removeIdentifier(a.identifier),a.identifier=s;var h=function(e){e.trigger("start",e),i.trigger("start "+e.id+":start",e),e.show(),n>0&&i.pressureFn(t,e,e.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(a))>=0&&i.idles.splice(e,1),i.actives.push(a),i.ids.push(a.identifier),"semi"!==o.mode)h(a);else{if(!(N(r,a.position)<=o.catchDistance))return a.destroy(),void i.processOnStart(t);h(a)}return a},at.prototype.getOrCreate=function(t,e){var i,o=this,s=o.options;return/(semi|static)/.test(s.mode)?(i=o.idles[0])?(o.idles.splice(0,1),i):"semi"===s.mode?o.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=o.createNipple(e,t)},at.prototype.processOnMove=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),n=e.manager.scroll;if((t=>isNaN(t.buttons)?0!==t.pressure:0!==t.buttons)(t)){if(!s)return console.error("Found zombie joystick with ID "+o),void e.manager.removeIdentifier(o);if(i.dynamicPage){var r=s.el.getBoundingClientRect();s.position={x:n.x+r.left,y:n.y+r.top}}s.identifier=o;var a=s.options.size/2,h={x:t.pageX,y:t.pageY};i.lockX&&(h.y=s.position.y),i.lockY&&(h.x=s.position.x);var l,c,d=N(h,s.position),m=((t,e)=>{let i=e.x-t.x,o=e.y-t.y;return(t=>t*(180/Math.PI))(Math.atan2(o,i))})(h,s.position),p=V(m),u=d/a,y={distance:d,position:h};if("circle"===s.options.shape?(l=Math.min(d,a),c=((t,e,i)=>{let o={x:0,y:0};return i=V(i),o.x=t.x-e*Math.cos(i),o.y=t.y-e*Math.sin(i),o})(s.position,l,m)):(c=((t,e,i)=>({x:Math.min(Math.max(t.x,e.x-i),e.x+i),y:Math.min(Math.max(t.y,e.y-i),e.y+i)}))(h,s.position,a),l=N(c,s.position)),i.follow){if(d>a){let t=h.x-c.x,i=h.y-c.y;s.position.x+=t,s.position.y+=i,s.el.style.top=s.position.y-(e.box.top+n.y)+"px",s.el.style.left=s.position.x-(e.box.left+n.x)+"px",d=N(h,s.position)}}else h=c,d=l;var g=h.x-s.position.x,f=h.y-s.position.y;s.frontPosition={x:g,y:f},i.dataOnly||B(s.ui.front,s.frontPosition);var v={identifier:s.identifier,position:h,force:u,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:m},vector:{x:g/a,y:-f/a},raw:y,instance:s,lockX:i.lockX,lockY:i.lockY};(v=s.computeDirection(v)).angle={radian:V(180-m),degree:180-m},s.trigger("move",v),e.trigger("move "+s.id+":move",v)}else this.processOnEnd(t)},at.prototype.processOnEnd=function(t){var e=this,i=e.options,o=e.manager.getIdentifier(t),s=e.nipples.get(o),n=e.manager.removeIdentifier(s.identifier);!s||(i.dataOnly||s.hide(function(){"dynamic"===i.mode&&(s.trigger("removed",s),e.trigger("removed "+s.id+":removed",s),e.manager.trigger("removed "+s.id+":removed",s),s.destroy())}),clearInterval(e.pressureIntervals[s.identifier]),s.resetDirection(),s.trigger("end",s),e.trigger("end "+s.id+":end",s),e.ids.indexOf(s.identifier)>=0&&e.ids.splice(e.ids.indexOf(s.identifier),1),e.actives.indexOf(s)>=0&&e.actives.splice(e.actives.indexOf(s),1),/(semi|static)/.test(i.mode)?e.idles.push(s):e.nipples.indexOf(s)>=0&&e.nipples.splice(e.nipples.indexOf(s),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[n.id]=n.identifier))},at.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},at.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(t){t.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var ht=at;function lt(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=Z(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var t;e.collections.forEach(function(i){i.forEach(function(i){t=i.el.getBoundingClientRect(),i.position={x:e.scroll.x+t.left,y:e.scroll.y+t.top}})})};return e._onResize=function(){(t=>{L.has(t)&&clearTimeout(L.get(t)),L.set(t,setTimeout(function(){L.delete(t),t()},100))})(i)},e._onScroll=function(){e.scroll=Z()},e.collections}lt.prototype=new st,lt.constructor=lt,lt.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(t){return!(i=t.get(e))}),i}},lt.prototype.create=function(t){return this.createCollection(t)},lt.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,I(window,"resize",t._onResize),I(window,"scroll",t._onScroll))},lt.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,Q(window,"resize",t._onResize),Q(window,"scroll",t._onScroll))},lt.prototype.createCollection=function(t){var e=this,i=new ht(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},lt.prototype.bindCollection=function(t){var e,i=this,o=function(t,o){e=t.type+" "+o.id+":"+t.type,i.trigger(e,o)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",o),t.on("dir:up dir:right dir:down dir:left",o),t.on("plain:up plain:right plain:down plain:left",o)},lt.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},lt.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||!0===t)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},lt.prototype.getIdentifier=function(t){var e;return t?void 0===(e=void 0===t.identifier?t.pointerId:t.identifier)&&(e=this.latest||0):e=this.index,void 0===this.ids[e]&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},lt.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},lt.prototype.onmove=function(t){return this.onAny("move",t),!1},lt.prototype.onend=function(t){return this.onAny("end",t),!1},lt.prototype.oncancel=function(t){return this.onAny("end",t),!1},lt.prototype.onAny=function(t,e){var i,o=this,s="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=Y(e);var n=function(t,e,i){i.ids.indexOf(e)>=0&&(i[s](t),t._found_=!0)};return H(e,function(t){i=o.getIdentifier(t),H(o.collections,n.bind(null,t,i)),t._found_||o.removeIdentifier(i)}),!1},lt.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(t){t.destroy()}),t.collections=[],t.off()},lt.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),0===i.collections.length&&i.unbindWindowEvents()};var ct=lt,dt=null;function mt(){return dt||(dt=new ct),dt}var pt={create:function(t){return mt().create(t)},destroy:function(){dt&&(dt.destroy(),dt=null)},get factory(){return mt()}},ut=.02,yt=new C,gt=new C,ft=new C,vt=new C,bt=new C,xt=new C,wt=new O,Pt=new O,Mt=new O,Et=new k,St=new k,jt=new z(0,0,0,"YXZ"),At=new C(1,0,0),Tt=new C(0,1,0),Dt=new C(0,0,1),kt=new C(1,1,1),Ct=[],Ot=t=>Ct[t]??(Ct[t]=new C),zt=new C,Rt=new C,Ft=new C,_t=new C,Xt=new k,Wt=new C,Nt=new k,Vt=new R,Lt=new F,It={type:"requestRender"},Qt={type:"updateMatrix"},Yt=class extends A{constructor(t,i,o,s,n,r,a,m,p){super(),this.object=t,this.domElement=i,this.data=o,this.gloabalPhysics=s,this.controlsManager=n,this.cameraFollow=r,this.camera=a,this.page=m,this.sharedAssets=p,this.enableDamping=!0,this.hiddenMatrix0=new O,this.target0=new C,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=e,this.euler0=new z(0,0,0,"YXZ"),this.position0Cam=new C,this.quat0Cam=new k,this.scale0Cam=new C,this.hiddenMatrix0Cam=new O,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new R(new C(0,-40,0),new C(0,40,0)),matrix:new O,position:new C,rotation:new k},this.euler=new z(0,0,0,"YXZ"),this.eulerDelta=new C,this.lastPosition=new C,this.lastCameraQuaternion=new k,this.lastCameraPosition=new C,this.PI_2=Math.PI/2,this.prevMouse=new D,this.velocityTarget=new C,this.velocity=new C,this.directionXZ=new C,this.rotVelocityStick=new C,this.rotVelocityTarget=new C,this.rotVelocity=new C,this.rotDirection=new C,this.nonColliderRotOffset=new O,this.nonColliderPosOffset=new O,this.firstPointerId=-1,this.rot=new C,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new O,this.objectToTarget=new C,this.objectToTarget0=new C,this.objectToCamXZ=new C,this.objectToCamXZ0=new C,this.targetToCamera=new C,this.targetToCamera0=new C,this.cameraPolarAxis0=new C,this.targetPos=new C,this.targetQuat=new k,this.lerpFactorPos=(new C).setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new k,this.objXZQuatInv=new k,this.objXZRotMat=new O,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new C,this.pushedVelocity=new C,this.groundYRotation=0,this.objectRealQuat=new k,this.colliderWorldQuat=new k,this.groundNormal=new C,this.groundTilt=new k,this.groundTiltInv=new k,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new C,this.quaternion=new k,this.scale=new C,this.initialAction=!0,this.onPointerDown=t=>{!(t.target===this.domElement||t.target instanceof HTMLElement&&"SPLINE-VIEWER"===t.target.tagName&&t.target.shadowRoot?.contains(this.domElement))||-1!==this.firstPointerId||(this.firstPointerId=t.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),"keys"!==this.rotBy&&!h&&!l&&this.domElement.requestPointerLock(),this.prevMouse.set(t.clientX,t.clientY))},this.onPointerUp=t=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),"mouse"===t.pointerType&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=t=>{if(t.pointerId!==this.firstPointerId)return;let e=t.clientX-this.prevMouse.x,i=t.clientY-this.prevMouse.y;this.prevMouse.set(t.clientX,t.clientY),"mouse"===t.pointerType&&"keys"!==this.rotBy&&(l&&c<15.5&&!h?(this.eulerDelta.y=-e*this.mouseOrbitSensitivity,this.eulerDelta.x=-i*this.mouseOrbitSensitivity):(this.eulerDelta.y=-t.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-t.movementY*this.mouseOrbitSensitivity)),"mouse"!==t.pointerType&&"drag"===this.rotByTouch&&(this.eulerDelta.y=-e*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-i*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=t=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?Yt.isLocked=!0:Yt.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let t in this.movementState)this.movementState[t]=0},this.onKeyDown=t=>{!(t.target instanceof HTMLInputElement)&&("ArrowLeft"===t.code||"ArrowUp"===t.code||"ArrowRight"===t.code||"ArrowDown"===t.code||"Space"===t.code)&&t.preventDefault();for(let e of this.keyAssignments)if(t.key.toUpperCase()===e[1]||t.key===e[1]){this.movementState[e[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=t=>{for(let e of this.keyAssignments)if(t.key.toUpperCase()===e[1]||t.key===e[1]||t.code.slice(3,t.code.length).toUpperCase()===e[1]){this.movementState[e[0]]=0;break}},this.copyVRGamePadValues=(t,e)=>{for(let i=2;i<4;i++){let o=t.axes[i];0===e?2===i?this.movementState.movePosX=o:this.movementState.movePosZ=o:(t.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,2===i?this.movementState.rotPosY=o:"fly"===this.moveMode&&(this.movementState.moveNegY=o))}},this.sharedGameControlGlobals=n.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let y=this.euler0.clone(),f=y.y;if(this.objectRealQuat.copy(this.quaternion),y.y=0,this.quaternion.setFromEuler(y),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),y.set(0,f,0),this.quaternion.setFromEuler(y),this.rot.setFromEuler(y),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||!0===this.cameraFollow)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),!0===this.cameraFollow){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let t,e=new C(0,0,-1).applyQuaternion(this.camera.quaternion),i=(new C).subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(i),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(e.y)<1e-6?(i.y=0,e.y=0,t=i.projectOnVector(e)):t=i.y/e.y>0?e.multiplyScalar(i.y/e.y):e.multiplyScalar(i.length()),this.targetToCamera0.copy(t).negate();let o=this.camera.position.clone().add(t);this.objectToTarget0.subVectors(o,this.position);let s=(new z).setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-s.x,s.x=0,s.z=0,s.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(s)}if(this.object instanceof d&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=o.rotByTouch??"joystick",this.rotBy=o.rotBy??"keys",this.rotationMode=o.rotationMode??"normal",this.moveMode=o.moveMode??"walk",this.collisionEnabled=o.collisionEnabled,this.speedTranslate=1*(o.speedTranslate??250),this.speedOrbit=.025*(o.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(o.speedRotate??100),this.keyAssignments=o.keyAssignments.map(t=>{let e=[t[0],t[1]];return"▲"===e[1]?e[1]="ArrowUp":"◀"===e[1]?e[1]="ArrowLeft":"▼"===e[1]?e[1]="ArrowDown":"▶"===e[1]?e[1]="ArrowRight":"⇧"===e[1]?e[1]="Shift":"↵"===e[1]?e[1]="Enter":"Space"===e[1]?e[1]=" ":"⌘"===e[1]?e[1]="Meta":"Ctrl"===e[1]?e[1]="Control":"Esc"===e[1]&&(e[1]="Escape"),e}),"mouse"===o.rotBy){let t;t=this.keyAssignments.findIndex(t=>"rotNegX"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotPosX"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotPosY"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotNegY"===t[0]),-1!==t&&(this.keyAssignments[t][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(o.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(o.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(o.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(o.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(o.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(o.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??j.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??j.defaultData.usePhysics,this.jumpPower=20*o.jumpPower,this.resetYPosition=this.position.y+Math.abs(o.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=o.alignToGround??!1,this.orientMode=o.autoOrientMove?o.orientMode:"none",this.orientWith=o.orientWith??M.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,"capsule"===o.collider.type?(this.collider.radius=o.collider.radius,this.collider.segment.start.y=o.collider.height/2-o.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=o.collider.height*ut/this.pixelsPerMeter,this.stepThresh=.3*o.collider.height/this.pixelsPerMeter,this.colliderHeight=o.collider.height):"sphere"===o.collider.type?(this.collider.radius=o.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*o.collider.radius*ut/this.pixelsPerMeter,this.stepThresh=2*o.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*o.collider.radius):(this.offset=o.collider.height*ut/this.pixelsPerMeter,this.stepThresh=.3*o.collider.height/this.pixelsPerMeter,this.colliderHeight=o.collider.height),this.collider.type=o.collider.type;let v=(new C).fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)),b=(new k).setFromEuler((new z).fromArray([...o.collider.rotation.map(t=>"number"==typeof t?t:0),"XYZ"]));this.collider.position.copy(v).multiply(this.scale),this.collider.rotation.copy(b),this.collider.matrix.compose(v,b,kt),void 0!==o.cameraXAxis&&(this.cameraXAxis=o.cameraXAxis,this.cameraYAxis=o.cameraYAxis,this.minPolarAngle=o.cameraRotXLimits[0],this.maxPolarAngle=o.cameraRotXLimits[1],this.minAzimuthAngleRel=o.cameraRotYLimits[0],this.maxAzimuthAngleRel=o.cameraRotYLimits[1]),this.forwardDir=o.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=o.runMultiplier??2;let x=2*o.navmesh.destinationHelperRadius;if(x>0){let t=new S;t.push({fi:0,data:{...E.defaultData("light","phong"),alpha:0},id:"layer1"}),t.push({fi:0,data:{...E.defaultData("color"),color:o.navmesh.destinationHelperColor,alpha:o.navmesh.destinationHelperColor.a},id:"layer2"});let e=u({layers:t},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new W(g.create({parameters:{width:x,height:x/10,hollow:.7}}),e),this.navMeshPathDest.material.userData.opacity0=o.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let t=(new z).setFromQuaternion(this.quaternion,"YXZ"),e=t.y;this.objectRealQuat.copy(this.quaternion),t.y=0,this.quaternion.setFromEuler(t),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),t.set(0,e,0),this.quaternion.setFromEuler(t),this.rot.setFromEuler(t),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof d?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();!0===this.cameraFollow&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;void 0!==t.gameActions&&(this.actions={},P.list.forEach(i=>{this.actions[i]=f({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),v(this.actions.idle),v(this.actions.move),v(this.actions.run),v(this.actions.jump)}dispatchStartEvent(t){void 0!==this.actions[t]&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(t=>{t.play()}),this.actions[t].Animation.forEach(t=>{t.play(!1===this.initialAction)}),this.actions[t].TimelineAnimation.forEach(t=>{t.play()}),this.actions[t].Create.forEach(t=>{t.dispatchStart()}),this.actions[t].Audio.forEach(t=>{t.dispatchGameControl("start")}),this.actions[t].Particles.forEach(t=>{t.dispatchGameControl("start")})))}dispatchStopEvent(t){void 0!==this.actions[t]&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(t=>{t.stop()}),this.actions[t].Create.forEach(t=>{t.dispatchStop()}),this.actions[t].Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(t=>{t.dispatchGameControl("stop")})))}get colliderWorldPosition(){return vt.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,o=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let t=bt.set(0,(0===this.velocity.y?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),i=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(i){this.onObject=!0,this.groundNormal.set(i.normal2.x,i.normal2.y,i.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(o=!0),0===i.collider.parent()?.bodyType()&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let t=i.collider.parent(),s=null!==t&&t.isKinematic()?t:null,n=null===s?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(s.handle);if(null!==s&&n?.userData.isFollowingObj!==this.object.uuid){let t=this.object.getWorldPosition(vt).add(this.collider.position).divideScalar(this.pixelsPerMeter),i=s.velocityAtPoint(t);this.groundVelocity.set(i.x,i.y,i.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=s.angvel().y*e}}else this.onObject=!1}if("walk"===this.moveMode&&this.collisionEnabled&&(1===this.movementState.jump&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),"fly"===this.moveMode&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,"+z"===this.forwardDir&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let t=this.navMeshPathDest.material;if("walk"===this.moveMode&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let e=vt.subVectors(this.path[1],this.position),i=bt.subVectors(this.path[1],this.path[0]);e.dot(i)<0?this.path.shift():(this.directionXZ.x=i.x,this.directionXZ.z=i.z),t.opacity=t.userData.opacity0}else t.opacity-=.05*t.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,("walk"===this.moveMode?this.velocityTarget.x+this.velocityTarget.z===0:0===this.velocityTarget.manhattanLength())?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),"walk"===this.moveMode&&(this.lerpFactorPos.y=1),!1===this.didHit&&0===this.pushedVelocity.manhattanLength()||!1===this.usePhysics?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),("walk"===this.moveMode?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||"fly"===this.moveMode)&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let n=ft.copy(this.velocity);if("none"!==this.orientMode&&!1===this.isFirstPerson){let t=bt.copy(n);t.y=0,n.set(0,n.y,t.length()*("+z"===this.forwardDir?1:-1))}if(this.directionXZ.manhattanLength()>0&&"none"!==this.orientMode&&!1===this.isFirstPerson)if("camera"===this.orientWith&&this.path.length<=1){let t=vt;this.camera.getWorldDirection(t);let e=xt.copy(Tt).multiplyScalar(t.dot(Tt));t.sub(e);let i=bt.copy(this.directionXZ);i.x*=-1,this.rot.y=t.angleTo(i)*(t.cross(i).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*("+z"===this.forwardDir?1:-1);if(jt.setFromVector3(this.rot),"walk"===this.moveMode&&(jt.x=0),n.applyEuler(jt),o&&(St.setFromUnitVectors(Tt,this.groundNormal),n.applyQuaternion(St)),!0===this.usePhysics&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let t=0;for(let i of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(void 0===i.rigidBody||void 0===i.prevQ)continue;(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(zt,Xt,Rt);let o=this.object.getWorldPosition(Ft).add(this.collider.position).sub(zt);Nt.copy(i.prevQ).invert().premultiply(Xt);let r=xt.subVectors(zt,i.prevT).add(_t.copy(o).applyQuaternion(Nt).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),a=i.rigidBody.collider(0).castCollider(r,this.object.rigidBody.collider(0),vt.copy(n).divideScalar(this.pixelsPerMeter),0,e,!1);r.multiplyScalar(this.pixelsPerMeter);let h=b.is(i)?i:i.object;if(null!==a&&this.lastHitObj!==h){let t;i instanceof m&&(t=i);let e=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(e)for(let i of e)"character"===i.data.target&&(i.dispatch(t),h.dispatchEvent(s));this.lastHitObj=h}null!==a&&(Math.abs(r.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=r.x),Math.abs(r.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=r.y),Math.abs(r.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=r.z),Ot(t++).copy(a.normal1).applyQuaternion(i.quaternion))}if(t>0){for(let e=0;e<t;e++){let t=Ot(e),i=t.dot(n);i<0&&n.addScaledVector(t,-i)}n.add(this.pushedVelocity)}else n.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),"normal"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)||"steer"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||"walk"===this.moveMode)?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,"normal"===this.rotationMode&&(this.movementState.rotPosY||this.movementState.rotNegY)||"steer"===this.rotationMode&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),0===this.rotVelocityTarget.manhattanLength()?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,0===this.rotVelocityTarget.y&&0===this.directionXZ.manhattanLength()?this.rotationAccumWhenOrientWithCamera=0:(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),!1===this.isFirstPerson&&"none"!==this.orientMode&&this.directionXZ.manhattanLength()>0){if("radial"===this.orientMode){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Tt,this.euler.y-this.euler0.y);let t=bt.copy(this.objectToCamXZ).normalize(),i=xt.copy(n).multiplyScalar(e);i.y=0;let o=i.sub(vt.copy(t).multiplyScalar(i.dot(t))).cross(t).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,0!==this.rotVelocityTarget.y&&(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.euler.y=this.rot.y);if(!0===this.cameraFollow&&("walk"===this.moveMode?"Limit"===this.cameraXAxis?this.euler.x=T.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=T.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):"Limit"===this.cameraXAxis&&(this.euler.x=T.clamp(this.euler.x,-this.PI_2,this.PI_2))),"fly"===this.moveMode?this.rot.x=this.euler.x:this.isFirstPerson&&(jt.copy(this.euler),jt.y=0,this.nonColliderRotOffset.makeRotationFromEuler(jt)),Et.setFromAxisAngle(At,this.rot.x),St.setFromAxisAngle(Tt,this.rot.y),St.multiply(Et),Et.setFromAxisAngle(Dt,this.rot.z),St.multiply(Et),this.quaternion.copy(St),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let t=bt.copy(n).multiplyScalar(e/this.pixelsPerMeter),i=null;this.didHit=!1;let o=new C;for(let e=0;e<5;e++){let n=t.length(),r=xt.copy(t).normalize();if(i=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,r,this.object.rigidBody.collider(0).shape,0,n,!1,12,void 0,void 0,this.object.rigidBody),null===i){0===e&&0!==this.directionXZ.manhattanLength()&&(this.lastHitObj=null),o.add(t);break}{this.didHit=!0;let a=this.sharedGameControlGlobals.colliderToEntity.get(i.collider.handle);if(a!==this.lastHitObj&&0===e){this.lastHitObj=a;let t=this.sharedGameControlGlobals.entityToCollisionEvents[a?.uuid];if(t)for(let e of t)if("character"===e.data.target){let t,o=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i.collider.handle))._parent;if(a.cloner)for(let e of a.cloner.children)if(e.rigidBody===o){t=e;break}e.dispatch(t),a.dispatchEvent(s)}}let h=yt.set(i.normal2.x,i.normal2.y,i.normal2.z).applyQuaternion(this.colliderWorldQuat),l=gt.copy(r).multiplyScalar(i.time_of_impact).dot(h),c=i.time_of_impact;if(0===c&&(this.position.y+=this.offset*this.pixelsPerMeter),l>this.offset&&(c=i.time_of_impact*(l-this.offset)/l,o.addScaledVector(r,c)),t.copy(r).multiplyScalar(n-c),Math.acos(-h.y)>this.slopeThresh){let e=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),s=xt.copy(i.witness2).applyQuaternion(this.colliderWorldQuat);s.y=0;let n=e.add(s);n.y+=this.stepThresh;let r=this.sharedGameControlGlobals.rapierWorld.castShape(n,this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);null!==r&&0===r.time_of_impact&&(h.y=0,h.normalize())}t.addScaledVector(h,-t.dot(h))}}this.position.addScaledVector(o,this.pixelsPerMeter),vt.copy(this.position).divideScalar(this.pixelsPerMeter),Et.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let r=this.object.rigidBody,a=void 0!==r&&Wt.copy(vt).sub(r.translation()).lengthSq()>1;void 0!==r&&(a?(r.setTranslation(vt,!0),r.setRotation(Et,!0)):(r.setNextKinematicTranslation(vt),r.setNextKinematicRotation(Et)))}else{let t=this.onObject?1:5,i=n.multiplyScalar(e/t);for(let o=0;o<t;o++)this.position.add(i),this.collisionAdjustment(e/t)}else this.position.addScaledVector(n,e);if("walk"===this.moveMode&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),!0===this.cameraFollow){this.updateFollowArms();let t=this.objectToTarget.add(this.position),e=this.targetToCamera.add(t);wt.lookAt(e,t,Tt).setPosition(e),wt.decompose(this.targetPos,this.targetQuat,vt),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),"Limit"===this.cameraYAxis&&"cartesian"===this.orientMode&&(this.euler.y=T.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=T.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(Qt),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(void 0===this.camera||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&("fly"===this.moveMode||!0===this.onObject||!1===this.collisionEnabled)&&(null===this.navMeshPathDest||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(It),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=Et.setFromAxisAngle(Tt,"Limit"===this.cameraYAxis&&"radial"!==this.orientMode?T.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&this.objectToTarget.applyQuaternion(e),t="Limit"===this.cameraXAxis?T.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):T.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=vt.copy(this.cameraPolarAxis0);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&i.applyQuaternion(e);let o=St.setFromAxisAngle(i,t);"Locked"!==this.cameraYAxis&&this.targetToCamera.applyQuaternion(e),"Locked"!==this.cameraXAxis&&this.targetToCamera.applyQuaternion(o)}groundTiltAdjustment(t){180*Tt.angleTo(t)/Math.PI<15||180*Tt.angleTo(t)/Math.PI>85?Et.identity():Et.setFromUnitVectors(Tt,t),this.groundTilt.slerp(Et,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=gt.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=wt.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(vt,Et,bt).compose(vt,Et,kt);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(t=>{if(t===this.object||t.isDescendantOf(this.object)||!t.bvhGeometry||!t.bvhGeometry.boundsTree)return;Lt.makeEmpty(),t.updateMatrixWorldRigid();let o=t.matrixWorldRigid,s=Pt.copy(o).invert(),n=Mt.copy(Pt).multiply(i);Vt.copy(this.collider.segment),Vt.start.applyMatrix4(n),Vt.end.applyMatrix4(n);let r=yt.copy(this.position).applyMatrix4(s);Lt.expandByPoint(Vt.start),Lt.expandByPoint(Vt.end),Lt.min.addScalar(-this.collider.radius),Lt.max.addScalar(this.collider.radius),t.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Vt.end),intersectsBounds:t=>t.intersectsBox(Lt),intersectsTriangle:t=>{let i=vt,s=bt,n=t.closestPointToSegment(Vt,i,s);if(n<this.collider.radius){let t=this.collider.radius-n,a=s.sub(i).normalize(),h=xt.copy(r);h.addScaledVector(a,t);let l=h.applyMatrix4(o).sub(this.position);e.add(l),Vt.start.addScaledVector(a,t),Vt.end.addScaledVector(a,t)}}})}),Lt.makeEmpty(),Vt.copy(this.collider.segment),Vt.start.applyMatrix4(i),Vt.end.applyMatrix4(i),Lt.expandByPoint(Vt.start),Lt.expandByPoint(Vt.end),Lt.min.addScalar(-this.collider.radius),Lt.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:t=>t.distanceToPoint(Vt.end),intersectsBounds:t=>t.intersectsBox(Lt),intersectsTriangle:t=>{let i=vt,o=bt,s=t.closestPointToSegment(Vt,i,o);if(s<this.collider.radius){let t=this.collider.radius-s,n=o.sub(i).normalize();this.alignToGround&&this.groundTiltAdjustment(n),e.addScaledVector(n,t),Vt.start.addScaledVector(n,t),Vt.end.addScaledVector(n,t)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let o=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(o),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},Zt=Yt;Zt.isLocked=!1;var Bt,Gt,qt,Ut=x?typeof window<"u"?window.location.href:"":"https://cdn.spline.design/@splinetool/runtime@2.0.1/build/",Ht=`\n(async function() {\n\tconst [wasmImport, wasmBinary] = await Promise.all([\n\t\timport('${Ut}' + 'navmesh.js'),\n\t\tfetch('${Ut}' + 'navmesh.wasm').then((res) => res.arrayBuffer()),\n\t]);\n\tconst wasmModule = wasmImport.default;\n\tself.module = await wasmModule({ wasmBinary });\n\tpostMessage('ready');\n})();\n`,Jt={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};r.then(t=>{Bt=t,Gt=new t.Vec3,qt=new t.Vec3});var Kt=new C,$t=class{constructor(e=!1,i=!1){this.usePhysics=e,this.isExport=i,this.onPointerDown=t=>{if(1!==a.length)return;let{raycaster:e,page:i}=this.eventContext;this.eventContext.updateRaycaster(t);let o=i.raycastWithClones(e);if(0!==o.length){if(this.gameControl){let t=Kt.copy(this.gameControl.colliderWorldPosition);t.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(t,o[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(e,i)=>s=>{let r;if(s instanceof t){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;r=s.object}else if(s instanceof m)r=s.object;else if(r=s,!1===r.dataPatched.cloner?.disabled&&r.dataPatched.cloner?.hideBase&&!0!==r.dataPatched.physics?.fusedBody)return!0;if(i&&!r.userData.navmesh)return;let a=r.dataPatched;if(!a.visible&&!0!==a.physics?.enabled)return!0;s.updateMatrixWorldRigid();let h=n(a),l=r.userData.hasDestroy,c=r.userData.hasDrag,d=!1,p=!1;for(let t of a.events)!0!==t.data.disabled&&("GameControl"===t.data.type?d=!0:"Follow"===t.data.type&&(p=!0));if(d||h||p||l||c)return!0;if(this.usePhysics&&"dynamic"===a.physics?.rigidBody){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in s&&s.geometry&&e.push(o(s.geometry,s.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return s.traverseObject((i,s)=>{if(0===s)return;let n;if(i instanceof t){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;n=i.object}else if(i instanceof m)n=i.object;else if(n=i,i.dataPatched.cloner?.hideBase)return!0;let r=n.dataPatched;if(!r.visible&&!0!==r.physics?.enabled)return!0;"geometry"in i&&i.geometry&&e.push(o(i.geometry,i.matrixWorld))}),!0},this.traverseNoPhysics=(e,i)=>s=>{let r;if(s instanceof t)return;r=s instanceof m?s.object:s;let a=r.dataPatched;if("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled)return!0;if(i&&!r.userData.navmesh)return;let h=s.geometry,l=!0===r.userData.hasDestroy,c=!0===r.userData.hasDrag;if(n(a)||l||c||r.dataPatched.events.some(t=>!0!==t.data.disabled&&"GameControl"===t.data.type))return!0;h&&e.push(o(h,s.matrixWorld))},this.navmeshWasm=Bt,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(i?Ht:"\n(async function() {\n\tconst [wasmImport, wasmBinary] = await Promise.all([\n\t\timport(self.location.origin + '/_libraries/navmesh.js'),\n\t\tfetch(self.location.origin + '/_libraries/navmesh.wasm').then((res) => res.arrayBuffer()),\n\t]);\n\tconst wasmModule = wasmImport.default;\n\tself.module = await wasmModule({ wasmBinary });\n\tpostMessage('ready');\n})();\n")+"\n\nonmessage = function(messageEvent) {\n\tconst meshData = messageEvent.data;\n\tconst positions = meshData[0];\n\tconst offset = meshData[1];\n\tconst indices = meshData[2];\n\tconst indicesLength = meshData[3];\n\tconst parameters = meshData[4];\n\n\tconst module = self.module;\n\tconst rc = new module.rcConfig();\n\trc.cs = parameters.cs;\n\trc.ch = parameters.ch;\n\trc.borderSize = parameters.borderSize ? parameters.borderSize : 0;\n\trc.tileSize = parameters.tileSize ? parameters.tileSize : 0;\n\trc.walkableSlopeAngle = parameters.walkableSlopeAngle;\n\trc.walkableHeight = parameters.walkableHeight;\n\trc.walkableClimb = parameters.walkableClimb;\n\trc.walkableRadius = parameters.walkableRadius;\n\trc.maxEdgeLen = parameters.maxEdgeLen;\n\trc.maxSimplificationError = parameters.maxSimplificationError;\n\trc.minRegionArea = parameters.minRegionArea;\n\trc.mergeRegionArea = parameters.mergeRegionArea;\n\trc.maxVertsPerPoly = parameters.maxVertsPerPoly;\n\trc.detailSampleDist = parameters.detailSampleDist;\n\trc.detailSampleMaxError = parameters.detailSampleMaxError;\n\n\tif (!self.navMesh) {\n\t\tself.navMesh = new module.NavMesh();\n\t}\n\tself.navMesh.build(positions, offset, indices, indicesLength, rc);\n\n\tconst navmeshData = navMesh.getNavmeshData();\n\tconst arrView = new Uint8Array(module.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);\n\tconst ret = new Uint8Array(navmeshData.size);\n\tret.set(arrView);\n\tnavMesh.freeNavmeshData(navmeshData);\n\n\tpostMessage(ret);\n}\n"])),this._worker=new Worker(this._workerURL),this.whenWorkerReady=new Promise(t=>{this._worker.addEventListener("message",()=>t(),{once:!0})})}init(t,e,i){this.gameControl=e,this.eventContext=i,this.setDefaultQueryExtent((new C).setScalar(t.ch*t.walkableRadius*1.2)),this._worker.onmessage=()=>{this.createNavMesh(i.page,t,t=>{this.buildFromNavmeshData(t.data)})},this.eventContext.renderer.domElement.addEventListener("pointerdown",this.onPointerDown)}createNavMesh(t,e,i){e.objects.forEach(e=>{let i=t.scene.find(e);i.traverseEntity(t=>{t.userData.navmesh=!0}),i.cloner?.traverseObject(t=>{t.userData.navmesh=!0})});let o=[],s=(this.usePhysics?this.traverseWithPhysics:this.traverseNoPhysics)(o,"custom"===e.zones);if(t.traverseChildren(s),e.objects.forEach(e=>{let i=t.scene.find(e);i.traverseEntity(t=>{t.userData.navmesh=void 0}),i.cloner?.traverseObject(t=>{t.userData.navmesh=void 0})}),0===o.length)return!1;let n=y(o),{positions:r,triIndices:a}=p(n.getAttribute("position"),n.getIndex());return this._worker.postMessage([r,r.length/3,a,a.length,{...Jt,...e}]),this._worker.onmessage=i,!0}createDebugNavGeometry(){let t,e,i=this.navMesh.getDebugNavMesh(),o=i.getTriangleCount(),s=new Uint32Array(3*o),n=new Float32Array(3*o*3);for(t=0;t<3*o;t++)s[t]=t;for(t=0;t<o;t++)for(e=0;e<3;e++){let o=i.getTriangle(t).getPoint(e);n[9*t+3*e+0]=o.x,n[9*t+3*e+1]=o.y,n[9*t+3*e+2]=o.z}let r=new X;return r.setIndex(new _(s,1)),r.setAttribute("position",new _(n,3)),r}getClosestPoint(t){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.getClosestPoint(Gt)}getClosestPointToRef(t,e){Gt.x=t.x,Gt.y=t.y,Gt.z=t.z;let i=this.navMesh.getClosestPoint(Gt);e.set(i.x,i.y,i.z)}getRandomPointAround(t,e){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.getRandomPointAround(Gt,e)}getRandomPointAroundToRef(t,e,i){Gt.x=t.x,Gt.y=t.y,Gt.z=t.z;let o=this.navMesh.getRandomPointAround(Gt,e);i.set(o.x,o.y,o.z)}moveAlong(t,e){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,qt.x=e.x,qt.y=e.y,qt.z=e.z,this.navMesh.moveAlong(Gt,qt)}moveAlongToRef(t,e,i){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,qt.x=e.x,qt.y=e.y,qt.z=e.z,this.navMesh.moveAlong(Gt,qt)}computePath(t,e){let i=this.getClosestPoint(e);if(qt.x=i.x,qt.y=i.y,qt.z=i.z,Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)+Math.pow(e.z-i.z,2))>this.getDefaultQueryExtent().y)return[];this.getClosestPoint(t);let o=this.navMesh.computePath(Gt,qt),s=o.getPointCount(),n=[];for(let t=0;t<s;t++){let e=o.getPoint(t);n.push(new C(e.x,e.y,e.z))}return n}createCrowd(t,e){return new te(this,t,e)}setDefaultQueryExtent(t){Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.setDefaultQueryExtent(Gt)}getDefaultQueryExtent(){return this.navMesh.getDefaultQueryExtent()}buildFromNavmeshData(t){let e=t.length*t.BYTES_PER_ELEMENT,i=this.navmeshWasm._malloc(e),o=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,i,e);o.set(t);let s=new this.navmeshWasm.NavmeshData;s.dataPointer=o.byteOffset,s.size=t.length,this.navMesh.buildFromNavmeshData(s),this.navmeshWasm._free(o.byteOffset)}getNavmeshData(){let t=this.navMesh.getNavmeshData(),e=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,t.dataPointer,t.size),i=new Uint8Array(t.size);return i.set(e),this.navMesh.freeNavmeshData(t),i}getDefaultQueryExtentToRef(t){let e=this.navMesh.getDefaultQueryExtent();t.set(e.x,e.y,e.z)}dispose(){this.navMesh.destroy(),this._worker.terminate(),URL.revokeObjectURL(this._workerURL),this.eventContext?.renderer.domElement.removeEventListener("pointerdown",this.onPointerDown)}addCylinderObstacle(t,e,i){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,this.navMesh.addCylinderObstacle(Gt,e,i)}addBoxObstacle(t,e,i){return Gt.x=t.x,Gt.y=t.y,Gt.z=t.z,qt.x=e.x,qt.y=e.y,qt.z=e.z,this.navMesh.addBoxObstacle(Gt,qt,i)}removeObstacle(t){this.navMesh.removeObstacle(t)}isSupported(){return void 0!==this.navmeshWasm}},te=class{constructor(t,e,i){this.navmeshWasmWrapper=t,this.transforms=[],this.agents=new Array,this.reachRadii=new Array,this._agentDestinationArmed=new Array,this._agentDestination=new Array,this.crowd=new this.navmeshWasmWrapper.navmeshWasm.Crowd(e,i,this.navmeshWasmWrapper.navMesh.getNavMesh())}onReachTarget(t,e){}addAgent(t,e,i){let o=new this.navmeshWasmWrapper.navmeshWasm.dtCrowdAgentParams;o.radius=e.radius,o.height=e.height,o.maxAcceleration=e.maxAcceleration,o.maxSpeed=e.maxSpeed,o.collisionQueryRange=e.collisionQueryRange,o.pathOptimizationRange=e.pathOptimizationRange,o.separationWeight=e.separationWeight,o.updateFlags=7,o.obstacleAvoidanceType=0,o.queryFilterType=0,o.userData=0;let s=this.crowd.addAgent(new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z),o);return this.transforms.push(i),this.agents.push(s),this.reachRadii.push(e.reachRadius?e.reachRadius:e.radius),this._agentDestinationArmed.push(!1),this._agentDestination.push(new C(0,0,0)),s}getAgentPosition(t){return this.crowd.getAgentPosition(t)}getAgentPositionToRef(t,e){let i=this.crowd.getAgentPosition(t);e.set(i.x,i.y,i.z)}getAgentVelocity(t){return this.crowd.getAgentVelocity(t)}getAgentVelocityToRef(t,e){let i=this.crowd.getAgentVelocity(t);e.set(i.x,i.y,i.z)}getAgentNextTargetPath(t){return this.crowd.getAgentNextTargetPath(t)}getAgentNextTargetPathToRef(t,e){let i=this.crowd.getAgentNextTargetPath(t);e.set(i.x,i.y,i.z)}getAgentState(t){return this.crowd.getAgentState(t)}overOffmeshConnection(t){return this.crowd.overOffmeshConnection(t)}agentGoto(t,e){this.crowd.agentGoto(t,new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z));let i=this.agents.indexOf(t);i>-1&&(this._agentDestinationArmed[i]=!0,this._agentDestination[i].set(e.x,e.y,e.z))}agentTeleport(t,e){this.crowd.agentTeleport(t,new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z))}updateAgentParameters(t,e){let i=this.crowd.getAgentParameters(t);void 0!==e.radius&&(i.radius=e.radius),void 0!==e.height&&(i.height=e.height),void 0!==e.maxAcceleration&&(i.maxAcceleration=e.maxAcceleration),void 0!==e.maxSpeed&&(i.maxSpeed=e.maxSpeed),void 0!==e.collisionQueryRange&&(i.collisionQueryRange=e.collisionQueryRange),void 0!==e.pathOptimizationRange&&(i.pathOptimizationRange=e.pathOptimizationRange),void 0!==e.separationWeight&&(i.separationWeight=e.separationWeight),this.crowd.setAgentParameters(t,i)}removeAgent(t){this.crowd.removeAgent(t);let e=this.agents.indexOf(t);e>-1&&(this.agents.splice(e,1),this.transforms.splice(e,1),this.reachRadii.splice(e,1),this._agentDestinationArmed.splice(e,1),this._agentDestination.splice(e,1))}getAgents(){return this.agents}update(t){if(this.navmeshWasmWrapper.navMesh.update(),t<=.001)return;let e=1/60;{let i=Math.floor(t/e);i>10&&(i=10),i<1&&(i=1);let o=t/i;for(let t=0;t<i;t++)this.crowd.update(o)}for(let t=0;t<this.agents.length;t++){let e=this.agents[t],i=this.getAgentPosition(e);if(this.transforms[t].copy(i),this._agentDestinationArmed[t]){let o=i.x-this._agentDestination[t].x,s=i.z-this._agentDestination[t].z,n=this.reachRadii[t],r=this._agentDestination[t].y-this.reachRadii[t],a=this._agentDestination[t].y+this.reachRadii[t],h=o*o+s*s;i.y>r&&i.y<a&&h<n*n&&(this.onReachTarget(e,this._agentDestination[t]),this._agentDestinationArmed[t]=!1)}}}setDefaultQueryExtent(t){let e=new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z);this.crowd.setDefaultQueryExtent(e)}getDefaultQueryExtent(){return this.crowd.getDefaultQueryExtent()}getDefaultQueryExtentToRef(t){let e=this.crowd.getDefaultQueryExtent();t.set(e.x,e.y,e.z)}getCorners(t){let e,i=this.crowd.getCorners(t),o=i.getPointCount(),s=[];for(e=0;e<o;e++){let t=i.getPoint(e);s.push(new C(t.x,t.y,t.z))}return s}dispose(){this.crowd.destroy()}};i({setup:function(t){let{manager:e,camera:i}=t,o=!1,s=5,n=8,r=9,a="drag",l=e.page.data.publish.gameControlObject,c=null!==l?e.page.find(l):null,d=null;if(c)for(let t of c.data.events){if(t.data.disabled||"GameControl"!==t.data.type)continue;let i=c;for(;e.usePhysics&&null!==(i=i.parent)?.parent;)i.data.physics;t.data.collisionEnabled&&(e.needsCollisionDetection=!0),null===d&&(d=t.data)}if(c&&d&&(!0===c.data.visible||!0===c.data.physics.enabled)){o=o||d.camera===i.uuid||c.uuid===i.uuid;let l=new Zt(c,t.renderer.domElement,d,t.eventContext.page.data.globalPhysics,e,c.uuid!==i.uuid&&d.camera===i.uuid,i,e.page,t.sharedAssets);e.gameControl=l,s=d.joystickPosLoc,n=d.joystickRotLoc,r=d.jumpTouchButtonLoc,a=d.rotByTouch,h&&d.touchControl&&(e.joystickToGameControls[s]="pos","walk"===d.moveMode&&(e.joystickToGameControls[r]="jmp"),"joystick"===a&&(e.joystickToGameControls[n]="rot"))}if(e.gameControl&&e.gameControl.data.navmesh.enabled){let i=e.gameControl.data;if(!e.navigationMeshWrapper){let o;e.navigationMeshWrapper=new $t(e.usePhysics,t.isExport),o="sphere"===i.collider.type?2*i.collider.radius:i.collider.height,o=Math.floor(o/i.navmesh.ch-1),e.navigationMeshWrapper.init({...i.navmesh,walkableHeight:o},e.gameControl,t.eventContext)}}return o},createJoysticks:function(t,e,i){t.joystickToGameControls.forEach((o,s)=>{let n=document.body.appendChild(document.createElement("div")),[r,a,h]=t.eventManager.eventContext.publish.joystickSizeAndXYOffset[s],l=(e-5*r)/4+r,c={},d="jmp"===o,m=d?0:r;s<10?(s<5?c.top=m/2:c.bottom=m/2,c.left=m/2+s%5*l):10===s?(c.left=m/2,c.top=i/2):(c.right=m/2,c.top=i/2),c.top?c.top-=a[1]:c.bottom+=a[1],c.left?c.left+=a[0]:c.right-=a[0];for(let t in c)c[t]+="px";if(d){let e=n.appendChild(document.createElement("div"));Object.assign(e.style,c,{position:"absolute",width:r+"px",height:r+"px",backgroundColor:`rgba(255,255,255,${"show"===h?.4:0})`,zIndex:"9999",borderRadius:r+"px",border:"show"===h?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let i=r/16*16*.4;return"show"===h&&(e.innerHTML=`\n\t\t\t\t\t\t<svg width="${i}" height="${.4*r}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t\t\t<path d="M2 10L8 4L14 10" stroke="black" stroke-opacity="40%" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t`),e.addEventListener("pointerdown",()=>{t.gameControl.movementState.jump=1,t.requestRender()}),e.addEventListener("touchend",t=>t.preventDefault()),void(t.joysticks[s]=[void 0,n])}let p={zone:n,mode:"static",position:c,size:r};"hide"===h&&(p.restOpacity=0);let u=pt.create(p);u.on("move",(e,i)=>{let s=t.gameControl;"pos"===o?i.force<.2?s.moveForce=0:(s.movementState.movePosZ=Math.sin(-i.angle.radian),s.movementState.movePosX=Math.cos(-i.angle.radian),i.force>1.2?s.movementState.run=1:s.movementState.run=0,i.force<.3?s.moveForce=(i.force-.2)/.1:s.moveForce=1):"rot"===o&&(i.force<.2?s.rotForce=0:(s.movementState.rotPosX=i.vector.y,s.movementState.rotPosY=-i.vector.x,i.force<.3?s.rotForce=(i.force-.2)/.1:s.rotForce=1)),t.requestRender()}),u.on("end",(e,i)=>{let s=t.gameControl;"pos"===o?(s.movementState.movePosZ=0,s.movementState.movePosX=0,s.moveForce=1):"rot"===o&&(s.movementState.rotPosX=0,s.movementState.rotPosY=0,s.rotForce=1)}),t.joysticks[s]=[u,n]})}}),w("game-controls");