@splinetool/runtime 2.0.8 → 2.0.10

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 (279) hide show
  1. package/build/hana-ui.js +122 -42
  2. package/build/hana-ui.js.br +0 -0
  3. package/build/hana-ui.js.gz +0 -0
  4. package/build/hana-ui.wasm +0 -0
  5. package/build/hana-ui.wasm.br +0 -0
  6. package/build/hana-ui.wasm.gz +0 -0
  7. package/build/{runtime-chunk-PDASWDVC.js → runtime-chunk-4LKRNVPP.js} +1 -1
  8. package/build/{runtime-chunk-PDASWDVC.js.br → runtime-chunk-4LKRNVPP.js.br} +0 -0
  9. package/build/runtime-chunk-4LKRNVPP.js.gz +0 -0
  10. package/build/{runtime-chunk-DK66VKWP.js → runtime-chunk-7FDJ7IIR.js} +1 -1
  11. package/build/runtime-chunk-7FDJ7IIR.js.br +0 -0
  12. package/build/runtime-chunk-7FDJ7IIR.js.gz +0 -0
  13. package/build/{runtime-chunk-23QXG35G.js → runtime-chunk-BLFFIB2B.js} +1 -1
  14. package/build/runtime-chunk-BLFFIB2B.js.br +0 -0
  15. package/build/runtime-chunk-BLFFIB2B.js.gz +0 -0
  16. package/build/{runtime-chunk-DHWGP6NU.js → runtime-chunk-CDR3AZNB.js} +1 -1
  17. package/build/runtime-chunk-CDR3AZNB.js.br +0 -0
  18. package/build/runtime-chunk-CDR3AZNB.js.gz +0 -0
  19. package/build/{runtime-chunk-HZ6FL5GH.js → runtime-chunk-CDYE22J6.js} +1 -1
  20. package/build/runtime-chunk-CDYE22J6.js.br +0 -0
  21. package/build/runtime-chunk-CDYE22J6.js.gz +0 -0
  22. package/build/runtime-chunk-DZIH7EMN.js +1 -0
  23. package/build/runtime-chunk-DZIH7EMN.js.br +0 -0
  24. package/build/runtime-chunk-DZIH7EMN.js.gz +0 -0
  25. package/build/{runtime-chunk-TAY7IXEZ.js → runtime-chunk-FN2C54JM.js} +1 -1
  26. package/build/runtime-chunk-FN2C54JM.js.br +0 -0
  27. package/build/runtime-chunk-FN2C54JM.js.gz +0 -0
  28. package/build/runtime-chunk-I6B5A36U.js +1 -0
  29. package/build/runtime-chunk-I6B5A36U.js.br +0 -0
  30. package/build/runtime-chunk-I6B5A36U.js.gz +0 -0
  31. package/build/{runtime-chunk-E3IEBR27.js → runtime-chunk-JSRKKIOS.js} +1 -1
  32. package/build/runtime-chunk-JSRKKIOS.js.br +0 -0
  33. package/build/runtime-chunk-JSRKKIOS.js.gz +0 -0
  34. package/build/{runtime-chunk-BMA5KYBS.js → runtime-chunk-KKDM5MC5.js} +1 -1
  35. package/build/runtime-chunk-KKDM5MC5.js.br +0 -0
  36. package/build/runtime-chunk-KKDM5MC5.js.gz +0 -0
  37. package/build/{runtime-chunk-3GRN37GY.js → runtime-chunk-L2C7JGYG.js} +1 -1
  38. package/build/runtime-chunk-L2C7JGYG.js.br +0 -0
  39. package/build/runtime-chunk-L2C7JGYG.js.gz +0 -0
  40. package/build/{runtime-chunk-GZ7C2GJM.js → runtime-chunk-LQL2PJVX.js} +1 -1
  41. package/build/runtime-chunk-LQL2PJVX.js.br +0 -0
  42. package/build/runtime-chunk-LQL2PJVX.js.gz +0 -0
  43. package/build/{runtime-chunk-EJJZJ5MV.js → runtime-chunk-M4BPCY7K.js} +1 -1
  44. package/build/runtime-chunk-M4BPCY7K.js.br +0 -0
  45. package/build/runtime-chunk-M4BPCY7K.js.gz +0 -0
  46. package/build/{runtime-chunk-CKT62HES.js → runtime-chunk-MOZWC42D.js} +1 -1
  47. package/build/runtime-chunk-MOZWC42D.js.br +0 -0
  48. package/build/runtime-chunk-MOZWC42D.js.gz +0 -0
  49. package/build/{runtime-chunk-RLYG5YBB.js → runtime-chunk-MVJAFW5H.js} +1 -1
  50. package/build/runtime-chunk-MVJAFW5H.js.br +1 -0
  51. package/build/runtime-chunk-MVJAFW5H.js.gz +0 -0
  52. package/build/{runtime-chunk-USGQ26QU.js → runtime-chunk-QSJVWNNM.js} +1 -1
  53. package/build/runtime-chunk-QSJVWNNM.js.br +0 -0
  54. package/build/runtime-chunk-QSJVWNNM.js.gz +0 -0
  55. package/build/{runtime-chunk-F3ZACLZW.js → runtime-chunk-RTRWO43P.js} +1 -1
  56. package/build/runtime-chunk-RTRWO43P.js.br +0 -0
  57. package/build/runtime-chunk-RTRWO43P.js.gz +0 -0
  58. package/build/{runtime-chunk-HK23JJVH.js → runtime-chunk-RX3SW5K2.js} +1 -1
  59. package/build/runtime-chunk-RX3SW5K2.js.br +0 -0
  60. package/build/runtime-chunk-RX3SW5K2.js.gz +0 -0
  61. package/build/{runtime-chunk-5RXW5MNJ.js → runtime-chunk-UHCXLQHA.js} +1 -1
  62. package/build/runtime-chunk-UHCXLQHA.js.br +0 -0
  63. package/build/runtime-chunk-UHCXLQHA.js.gz +0 -0
  64. package/build/{runtime-chunk-AELTGHV2.js → runtime-chunk-VNO2DW74.js} +1 -1
  65. package/build/{runtime-chunk-AELTGHV2.js.br → runtime-chunk-VNO2DW74.js.br} +0 -0
  66. package/build/runtime-chunk-VNO2DW74.js.gz +0 -0
  67. package/build/{runtime-chunk-UIM3XKIT.js → runtime-chunk-WQ2NXI3U.js} +1 -1
  68. package/build/runtime-chunk-WQ2NXI3U.js.br +0 -0
  69. package/build/runtime-chunk-WQ2NXI3U.js.gz +0 -0
  70. package/build/{runtime-chunk-557KVSJL.js → runtime-chunk-YO3XFDZF.js} +1 -1
  71. package/build/runtime-chunk-YO3XFDZF.js.br +0 -0
  72. package/build/runtime-chunk-YO3XFDZF.js.gz +0 -0
  73. package/build/{runtime-chunk-32KZP4YN.js → runtime-chunk-YS7K3AW3.js} +1 -1
  74. package/build/runtime-chunk-YS7K3AW3.js.br +0 -0
  75. package/build/runtime-chunk-YS7K3AW3.js.gz +0 -0
  76. package/build/{runtime-chunk-YULW5JRE.js → runtime-chunk-ZASM3KKC.js} +1 -1
  77. package/build/runtime-chunk-ZASM3KKC.js.br +0 -0
  78. package/build/runtime-chunk-ZASM3KKC.js.gz +0 -0
  79. package/build/{runtime-chunk-OUXEWX5Z.js → runtime-chunk-ZLOMOV3N.js} +1 -1
  80. package/build/runtime-chunk-ZLOMOV3N.js.br +0 -0
  81. package/build/runtime-chunk-ZLOMOV3N.js.gz +0 -0
  82. package/build/{runtime-chunk-5JEZ42OM.js → runtime-chunk-ZM7N5SZG.js} +1 -1
  83. package/build/runtime-chunk-ZM7N5SZG.js.br +0 -0
  84. package/build/runtime-chunk-ZM7N5SZG.js.gz +0 -0
  85. package/build/{runtime-classicRuntime-U672GAGM.js → runtime-classicRuntime-A3DEJ3YH.js} +1 -1
  86. package/build/runtime-classicRuntime-A3DEJ3YH.js.br +0 -0
  87. package/build/runtime-classicRuntime-A3DEJ3YH.js.gz +0 -0
  88. package/build/{runtime-cloners-2AC7OZRC.js → runtime-cloners-UFF7A36S.js} +1 -1
  89. package/build/runtime-cloners-UFF7A36S.js.br +1 -0
  90. package/build/runtime-cloners-UFF7A36S.js.gz +0 -0
  91. package/build/{runtime-components-L63NUGAO.js → runtime-components-EESAIEPO.js} +1 -1
  92. package/build/runtime-components-EESAIEPO.js.br +0 -0
  93. package/build/runtime-components-EESAIEPO.js.gz +0 -0
  94. package/build/{runtime-createDestroy-QHHQ6LYS.js → runtime-createDestroy-WBIIVRMC.js} +1 -1
  95. package/build/runtime-createDestroy-WBIIVRMC.js.br +0 -0
  96. package/build/runtime-createDestroy-WBIIVRMC.js.gz +0 -0
  97. package/build/{runtime-dragDrop-YBSWK3ET.js → runtime-dragDrop-D45J5GQ5.js} +1 -1
  98. package/build/runtime-dragDrop-D45J5GQ5.js.br +0 -0
  99. package/build/runtime-dragDrop-D45J5GQ5.js.gz +0 -0
  100. package/build/{runtime-gameControls-DSJRSTW5.js → runtime-gameControls-GNLQ3FT6.js} +1 -1
  101. package/build/runtime-gameControls-GNLQ3FT6.js.br +0 -0
  102. package/build/runtime-gameControls-GNLQ3FT6.js.gz +0 -0
  103. package/build/{runtime-hair-V4RTCES2.js → runtime-hair-55OFZZFY.js} +1 -1
  104. package/build/runtime-hair-55OFZZFY.js.br +1 -0
  105. package/build/runtime-hair-55OFZZFY.js.gz +0 -0
  106. package/build/{runtime-mergeStaticGeometries-VXENKMD4.js → runtime-mergeStaticGeometries-NLUOSGZB.js} +1 -1
  107. package/build/runtime-mergeStaticGeometries-NLUOSGZB.js.br +0 -0
  108. package/build/runtime-mergeStaticGeometries-NLUOSGZB.js.gz +0 -0
  109. package/build/{runtime-miscActions-RPUPHHGJ.js → runtime-miscActions-5YY5ARQT.js} +1 -1
  110. package/build/runtime-miscActions-5YY5ARQT.js.br +0 -0
  111. package/build/runtime-miscActions-5YY5ARQT.js.gz +0 -0
  112. package/build/{runtime-mouseHover-HG6AHA2L.js → runtime-mouseHover-MTTJI6DT.js} +1 -1
  113. package/build/runtime-mouseHover-MTTJI6DT.js.br +0 -0
  114. package/build/runtime-mouseHover-MTTJI6DT.js.gz +0 -0
  115. package/build/{runtime-particles-ZHE2MC33.js → runtime-particles-VZVZJ35I.js} +1 -1
  116. package/build/runtime-particles-VZVZJ35I.js.br +0 -0
  117. package/build/runtime-particles-VZVZJ35I.js.gz +0 -0
  118. package/build/{runtime-paths-GN6E6ZYL.js → runtime-paths-4UDUBYZN.js} +1 -1
  119. package/build/runtime-paths-4UDUBYZN.js.br +0 -0
  120. package/build/runtime-paths-4UDUBYZN.js.gz +0 -0
  121. package/build/{runtime-resize-LACR4RFK.js → runtime-resize-QYCZUOPF.js} +1 -1
  122. package/build/runtime-resize-QYCZUOPF.js.br +0 -0
  123. package/build/runtime-resize-QYCZUOPF.js.gz +0 -0
  124. package/build/{runtime-sceneTransition-QLPFYHHY.js → runtime-sceneTransition-FC5TQNCH.js} +1 -1
  125. package/build/runtime-sceneTransition-FC5TQNCH.js.br +0 -0
  126. package/build/runtime-sceneTransition-FC5TQNCH.js.gz +0 -0
  127. package/build/{runtime-scroll-WZZBT2XR.js → runtime-scroll-VKMCDMAZ.js} +1 -1
  128. package/build/runtime-scroll-VKMCDMAZ.js.br +0 -0
  129. package/build/runtime-scroll-VKMCDMAZ.js.gz +0 -0
  130. package/build/runtime-shapeBlends-3QLNRN2O.js +1 -0
  131. package/build/runtime-shapeBlends-3QLNRN2O.js.br +4 -0
  132. package/build/runtime-shapeBlends-3QLNRN2O.js.gz +0 -0
  133. package/build/{runtime-text-UADJSRL4.js → runtime-text-IYCY3PFB.js} +1 -1
  134. package/build/runtime-text-IYCY3PFB.js.br +0 -0
  135. package/build/runtime-text-IYCY3PFB.js.gz +0 -0
  136. package/build/{runtime-textInputs-7U3TTJ4X.js → runtime-textInputs-LFDWIRLC.js} +1 -1
  137. package/build/runtime-textInputs-LFDWIRLC.js.br +0 -0
  138. package/build/runtime-textInputs-LFDWIRLC.js.gz +0 -0
  139. package/build/runtime-timeline-WNUPRRKW.js +1 -0
  140. package/build/runtime-timeline-WNUPRRKW.js.br +0 -0
  141. package/build/runtime-timeline-WNUPRRKW.js.gz +0 -0
  142. package/build/{runtime-tracking-MC74576T.js → runtime-tracking-HMTCBZ7J.js} +1 -1
  143. package/build/runtime-tracking-HMTCBZ7J.js.br +0 -0
  144. package/build/runtime-tracking-HMTCBZ7J.js.gz +0 -0
  145. package/build/{runtime-transitions-S22YS7E6.js → runtime-transitions-NPD3CNKU.js} +1 -1
  146. package/build/runtime-transitions-NPD3CNKU.js.br +0 -0
  147. package/build/runtime-transitions-NPD3CNKU.js.gz +0 -0
  148. package/build/{runtime-ui2d-EX3RBXPP.js → runtime-ui2d-NZTQW5UJ.js} +1 -1
  149. package/build/runtime-ui2d-NZTQW5UJ.js.br +0 -0
  150. package/build/runtime-ui2d-NZTQW5UJ.js.gz +0 -0
  151. package/build/{runtime-vectorShapes-J5Y3LMND.js → runtime-vectorShapes-26IDV3ZL.js} +1 -1
  152. package/build/runtime-vectorShapes-26IDV3ZL.js.br +0 -0
  153. package/build/runtime-vectorShapes-26IDV3ZL.js.gz +0 -0
  154. package/build/{runtime-webgpu-LDZ3N2D5.js → runtime-webgpu-CDBERG7X.js} +1 -1
  155. package/build/runtime-webgpu-CDBERG7X.js.br +0 -0
  156. package/build/runtime-webgpu-CDBERG7X.js.gz +0 -0
  157. package/build/runtime.cjs +5 -5
  158. package/build/runtime.js +1 -1
  159. package/build/runtime.js.br +0 -0
  160. package/build/runtime.js.gz +0 -0
  161. package/build/runtime.standalone.js +1 -1
  162. package/build/runtime.standalone.js.br +0 -0
  163. package/build/runtime.standalone.js.gz +0 -0
  164. package/build/runtime.standalone.webgl.js +1 -1
  165. package/build/runtime.standalone.webgl.js.br +0 -0
  166. package/build/runtime.standalone.webgl.js.gz +0 -0
  167. package/build/runtime.standalone.webgpu.js +1 -1
  168. package/build/runtime.standalone.webgpu.js.br +0 -0
  169. package/build/runtime.standalone.webgpu.js.gz +0 -0
  170. package/build/runtime.standalone.webgpu.micro.js +1 -1
  171. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  172. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  173. package/build/runtime.standalone.webgpu.min.js +1 -1
  174. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  175. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  176. package/build/snippets/hana-82e9eb82a79dead4/js-imports.js +204 -77
  177. package/package.json +1 -1
  178. package/build/runtime-chunk-23QXG35G.js.br +0 -0
  179. package/build/runtime-chunk-23QXG35G.js.gz +0 -0
  180. package/build/runtime-chunk-32KZP4YN.js.br +0 -0
  181. package/build/runtime-chunk-32KZP4YN.js.gz +0 -0
  182. package/build/runtime-chunk-3GRN37GY.js.br +0 -0
  183. package/build/runtime-chunk-3GRN37GY.js.gz +0 -0
  184. package/build/runtime-chunk-557KVSJL.js.br +0 -0
  185. package/build/runtime-chunk-557KVSJL.js.gz +0 -0
  186. package/build/runtime-chunk-5JEZ42OM.js.br +0 -0
  187. package/build/runtime-chunk-5JEZ42OM.js.gz +0 -0
  188. package/build/runtime-chunk-5RXW5MNJ.js.br +0 -0
  189. package/build/runtime-chunk-5RXW5MNJ.js.gz +0 -0
  190. package/build/runtime-chunk-AELTGHV2.js.gz +0 -0
  191. package/build/runtime-chunk-BMA5KYBS.js.br +0 -0
  192. package/build/runtime-chunk-BMA5KYBS.js.gz +0 -0
  193. package/build/runtime-chunk-CKT62HES.js.br +0 -0
  194. package/build/runtime-chunk-CKT62HES.js.gz +0 -0
  195. package/build/runtime-chunk-DHWGP6NU.js.br +0 -0
  196. package/build/runtime-chunk-DHWGP6NU.js.gz +0 -0
  197. package/build/runtime-chunk-DK66VKWP.js.br +0 -0
  198. package/build/runtime-chunk-DK66VKWP.js.gz +0 -0
  199. package/build/runtime-chunk-E3IEBR27.js.br +0 -0
  200. package/build/runtime-chunk-E3IEBR27.js.gz +0 -0
  201. package/build/runtime-chunk-EJJZJ5MV.js.br +0 -0
  202. package/build/runtime-chunk-EJJZJ5MV.js.gz +0 -0
  203. package/build/runtime-chunk-F3ZACLZW.js.br +0 -0
  204. package/build/runtime-chunk-F3ZACLZW.js.gz +0 -0
  205. package/build/runtime-chunk-GZ7C2GJM.js.br +0 -0
  206. package/build/runtime-chunk-GZ7C2GJM.js.gz +0 -0
  207. package/build/runtime-chunk-HK23JJVH.js.br +0 -0
  208. package/build/runtime-chunk-HK23JJVH.js.gz +0 -0
  209. package/build/runtime-chunk-HZ6FL5GH.js.br +0 -0
  210. package/build/runtime-chunk-HZ6FL5GH.js.gz +0 -0
  211. package/build/runtime-chunk-KE6HNYUL.js +0 -1
  212. package/build/runtime-chunk-KE6HNYUL.js.br +0 -0
  213. package/build/runtime-chunk-KE6HNYUL.js.gz +0 -0
  214. package/build/runtime-chunk-KNL33WN7.js +0 -1
  215. package/build/runtime-chunk-KNL33WN7.js.br +0 -0
  216. package/build/runtime-chunk-KNL33WN7.js.gz +0 -0
  217. package/build/runtime-chunk-OUXEWX5Z.js.br +0 -0
  218. package/build/runtime-chunk-OUXEWX5Z.js.gz +0 -0
  219. package/build/runtime-chunk-PDASWDVC.js.gz +0 -0
  220. package/build/runtime-chunk-RLYG5YBB.js.br +0 -1
  221. package/build/runtime-chunk-RLYG5YBB.js.gz +0 -0
  222. package/build/runtime-chunk-TAY7IXEZ.js.br +0 -0
  223. package/build/runtime-chunk-TAY7IXEZ.js.gz +0 -0
  224. package/build/runtime-chunk-UIM3XKIT.js.br +0 -0
  225. package/build/runtime-chunk-UIM3XKIT.js.gz +0 -0
  226. package/build/runtime-chunk-USGQ26QU.js.br +0 -0
  227. package/build/runtime-chunk-USGQ26QU.js.gz +0 -0
  228. package/build/runtime-chunk-YULW5JRE.js.br +0 -0
  229. package/build/runtime-chunk-YULW5JRE.js.gz +0 -0
  230. package/build/runtime-classicRuntime-U672GAGM.js.br +0 -0
  231. package/build/runtime-classicRuntime-U672GAGM.js.gz +0 -0
  232. package/build/runtime-cloners-2AC7OZRC.js.br +0 -0
  233. package/build/runtime-cloners-2AC7OZRC.js.gz +0 -0
  234. package/build/runtime-components-L63NUGAO.js.br +0 -0
  235. package/build/runtime-components-L63NUGAO.js.gz +0 -0
  236. package/build/runtime-createDestroy-QHHQ6LYS.js.br +0 -0
  237. package/build/runtime-createDestroy-QHHQ6LYS.js.gz +0 -0
  238. package/build/runtime-dragDrop-YBSWK3ET.js.br +0 -0
  239. package/build/runtime-dragDrop-YBSWK3ET.js.gz +0 -0
  240. package/build/runtime-gameControls-DSJRSTW5.js.br +0 -0
  241. package/build/runtime-gameControls-DSJRSTW5.js.gz +0 -0
  242. package/build/runtime-hair-V4RTCES2.js.br +0 -2
  243. package/build/runtime-hair-V4RTCES2.js.gz +0 -0
  244. package/build/runtime-mergeStaticGeometries-VXENKMD4.js.br +0 -0
  245. package/build/runtime-mergeStaticGeometries-VXENKMD4.js.gz +0 -0
  246. package/build/runtime-miscActions-RPUPHHGJ.js.br +0 -0
  247. package/build/runtime-miscActions-RPUPHHGJ.js.gz +0 -0
  248. package/build/runtime-mouseHover-HG6AHA2L.js.br +0 -0
  249. package/build/runtime-mouseHover-HG6AHA2L.js.gz +0 -0
  250. package/build/runtime-particles-ZHE2MC33.js.br +0 -0
  251. package/build/runtime-particles-ZHE2MC33.js.gz +0 -0
  252. package/build/runtime-paths-GN6E6ZYL.js.br +0 -0
  253. package/build/runtime-paths-GN6E6ZYL.js.gz +0 -0
  254. package/build/runtime-resize-LACR4RFK.js.br +0 -0
  255. package/build/runtime-resize-LACR4RFK.js.gz +0 -0
  256. package/build/runtime-sceneTransition-QLPFYHHY.js.br +0 -0
  257. package/build/runtime-sceneTransition-QLPFYHHY.js.gz +0 -0
  258. package/build/runtime-scroll-WZZBT2XR.js.br +0 -0
  259. package/build/runtime-scroll-WZZBT2XR.js.gz +0 -0
  260. package/build/runtime-shapeBlends-O6ATLCCA.js +0 -1
  261. package/build/runtime-shapeBlends-O6ATLCCA.js.br +0 -0
  262. package/build/runtime-shapeBlends-O6ATLCCA.js.gz +0 -0
  263. package/build/runtime-text-UADJSRL4.js.br +0 -0
  264. package/build/runtime-text-UADJSRL4.js.gz +0 -0
  265. package/build/runtime-textInputs-7U3TTJ4X.js.br +0 -0
  266. package/build/runtime-textInputs-7U3TTJ4X.js.gz +0 -0
  267. package/build/runtime-timeline-JXKHKUAC.js +0 -1
  268. package/build/runtime-timeline-JXKHKUAC.js.br +0 -0
  269. package/build/runtime-timeline-JXKHKUAC.js.gz +0 -0
  270. package/build/runtime-tracking-MC74576T.js.br +0 -0
  271. package/build/runtime-tracking-MC74576T.js.gz +0 -0
  272. package/build/runtime-transitions-S22YS7E6.js.br +0 -0
  273. package/build/runtime-transitions-S22YS7E6.js.gz +0 -0
  274. package/build/runtime-ui2d-EX3RBXPP.js.br +0 -0
  275. package/build/runtime-ui2d-EX3RBXPP.js.gz +0 -0
  276. package/build/runtime-vectorShapes-J5Y3LMND.js.br +0 -0
  277. package/build/runtime-vectorShapes-J5Y3LMND.js.gz +0 -0
  278. package/build/runtime-webgpu-LDZ3N2D5.js.br +0 -0
  279. package/build/runtime-webgpu-LDZ3N2D5.js.gz +0 -0
@@ -1 +1 @@
1
- import{v as e}from"./runtime-chunk-CKT62HES.js";import{Ec as t,Fc as s,Fd as a,Gc as i,Ge as r,Ib as n,Oc as h,Tc as o,Wd as l,Xd as d,Zc as c,kd as u,ld as g}from"./runtime-chunk-VGN7YHB7.js";var p=null;function b(e){p=e}function S(){return p}var m=null;function f(e){m=e}function M(){return m}var y=new o;function R(e,t,s){return y.setRGB(e,t,s,n),{r:y.r,g:y.g,b:y.b}}var w=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t,x=e=>Array.isArray(e)&&"number"==typeof e[0]&&"number"==typeof e[1]?[e[0],e[1]]:[0,0];function v(e,t,s){let a,i=w(e.angle,0),[r,n]=x(e.offset),[h,o]=x(e.morph),l=e.colors??[],d=e.steps??[],c=Math.min(10,l.length,d.length);if(0===c)return[1,1,1,1];if(1===e.gradientType){let e=3*(t+h)-(t+r)-1,l=3*(s+o)-(s+n)-1;a=Math.hypot(e,l)+i}else if(2===e.gradientType){let e=-1*Math.atan2(t+h-.5+r,s+o-.5+n),l=i/Math.PI/-2+.5*e/Math.PI;a=l-Math.floor(l)}else{let e=.5+h/(0!==t?t:1e-6),l=o/(0!==s?s:1e-6),d=Math.cos(i)*e-Math.sin(i)*l,c=Math.sin(i)*e+Math.cos(i)*l,u=d*d+c*c;a=u>1e-12?(((t-.5+r)/2+d/2)*d+((s-.5+n)/2+c/2)*c)/u:0}let u=l[0][0],g=l[0][1],p=l[0][2],b=l[0][3];for(let t=1;t<c;t++){let s=d[t-1],i=d[t]-s,r=0!==i?Math.min(1,Math.max(0,(a-s)/i)):a>=s?1:0;e.smooth&&(r=r*r*(3-2*r)),u+=(l[t][0]-u)*r,g+=(l[t][1]-g)*r,p+=(l[t][2]-p)*r,b+=(l[t][3]-b)*r}return[u,g,p,b]}function A(e,t){let s=e,a=s?.data?.layers;if(a&&"function"==typeof a.forEach){let e=t,s=[];return a.forEach(t=>{let a=t.data;if(!1===a.visible||!0===a.isMask)return;let i=w(a.alpha,1);if(!(i<=0))if("color"===a.type){let t,r=a.color;"string"==typeof r?t="function"==typeof e?.color?e.color(r):void 0:r&&"number"==typeof r.r&&(t=r),t&&s.push({kind:"color",layer:a,rgb:{...R(t.r,t.g,t.b),a:t.a??1},alpha:i})}else"gradient"===a.type&&s.push({kind:"gradient",layer:a,alpha:i})}),0===s.length?null:(e,t)=>{let a=1,i=1,r=1,n=!0;for(let h of s){let s,o,l,d;if("color"===h.kind)({r:s,g:o,b:l}=h.rgb),d=h.rgb.a;else{let[a,i,r,n]=v(h.layer,e,t);({r:s,g:o,b:l}=R(a,i,r)),d=n}let c=n?1:Math.min(1,Math.max(0,d*h.alpha));a+=(s-a)*c,i+=(o-i)*c,r+=(l-r)*c,n=!1}return{r:a,g:i,b:r}}}if(s?.color&&!0===s.color.isColor){let{r:e,g:t,b:a}=s.color;return()=>({r:e,g:t,b:a})}return null}var j=32,I=16384,F=32*I,B=100;function W(e,t){if("torus"===e){let e=t()*Math.PI*2,s=t()*Math.PI*2,a=Math.cos(e),i=Math.sin(e),r=Math.cos(s),n=Math.sin(s);return{x:(1.4+.7*r)*a,y:-(1.4+.7*r)*i,z:.7*n,nx:r*a,ny:-r*i,nz:n,cr:1,cg:1,cb:1}}if("cylinder"===e){let e=t()*Math.PI*2,s=Math.cos(e),a=Math.sin(e);return{x:.8*s,y:1.6*(t()-.5),z:.8*a,nx:s,ny:0,nz:a,cr:1,cg:1,cb:1}}let s=t()*Math.PI*2,a=2*t()-1,i=Math.acos(a),r=Math.sin(i)*Math.cos(s),n=Math.cos(i),h=Math.sin(i)*Math.sin(s);return{x:r,y:n,z:h,nx:r,ny:n,nz:h,cr:1,cg:1,cb:1}}function k(e){let{geometry:t,matrix:s}=e,a=t.getAttribute("position");if(!a||a.count<3)return null;let r=t.getAttribute("normal"),n=t.getAttribute("uv"),h=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:a.count/3;if(l<1)return null;let d=(e,t)=>o?o.getX(3*e+t):3*e+t,c=s?s.elements:null,u=s?(new i).getNormalMatrix(s).elements:null,g=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[0]*t+c[4]*s+c[8]*i+c[12]:t},p=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[1]*t+c[5]*s+c[9]*i+c[13]:s},b=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[2]*t+c[6]*s+c[10]*i+c[14]:i},S=new Float64Array(l),m=0;for(let e=0;e<l;e++){let t=d(e,0),s=d(e,1),a=d(e,2),i=g(t),r=p(t),n=b(t),h=g(s)-i,o=p(s)-r,l=b(s)-n,c=g(a)-i,u=p(a)-r,f=b(a)-n,M=o*f-l*u,y=l*c-h*f,R=h*u-o*c;m+=.5*Math.sqrt(M*M+y*y+R*R),S[e]=m}return m<=0?null:{total:m,sample:(t,s)=>{let a=0,i=l-1;for(;a<i;){let e=a+i>>1;S[e]<t?a=e+1:i=e}let o=a,c=d(o,0),m=d(o,1),f=d(o,2),M=s(),y=s();M+y>1&&(M=1-M,y=1-y);let R,w,x,v=1-M-y,A=g(c)*v+g(m)*M+g(f)*y,j=p(c)*v+p(m)*M+p(f)*y,I=b(c)*v+b(m)*M+b(f)*y;if(r){if(R=r.getX(c)*v+r.getX(m)*M+r.getX(f)*y,w=r.getY(c)*v+r.getY(m)*M+r.getY(f)*y,x=r.getZ(c)*v+r.getZ(m)*M+r.getZ(f)*y,u){let e=u[0]*R+u[3]*w+u[6]*x,t=u[1]*R+u[4]*w+u[7]*x,s=u[2]*R+u[5]*w+u[8]*x;R=e,w=t,x=s}}else{let e=g(c),t=p(c),s=b(c),a=g(m)-e,i=p(m)-t,r=b(m)-s,n=g(f)-e,h=p(f)-t,o=b(f)-s;R=i*o-r*h,w=r*n-a*o,x=a*h-i*n}let F=Math.sqrt(R*R+w*w+x*x)||1,B=1,W=1,k=1;if(h)B=h.getX(c)*v+h.getX(m)*M+h.getX(f)*y,W=h.getY(c)*v+h.getY(m)*M+h.getY(f)*y,k=h.getZ(c)*v+h.getZ(m)*M+h.getZ(f)*y;else if(e.sampleColor){let t=n?n.getX(c)*v+n.getX(m)*M+n.getX(f)*y:.5,s=n?n.getY(c)*v+n.getY(m)*M+n.getY(f)*y:.5,a=e.sampleColor(t,s);a&&(B=a.r,W=a.g,k=a.b)}return{x:A,y:j,z:I,nx:R/F,ny:w/F,nz:x/F,cr:B,cg:W,cb:k}}}}function H(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),I),s=function(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(e.seed??1337),a="object"===e.shape&&e.sampler,i=a?e.samplerRadius??B:B,r=new Float32Array(4*F),n=new Float32Array(F),h=new Float32Array(4*I).fill(1);for(let o=0;o<t;o++){let t=a?e.sampler(s):W(e.shape,s),l=a?t.x:t.x*i,d=a?t.y:t.y*i,c=a?t.z:t.z*i,{nx:u,ny:g,nz:p}=t;h[4*o+0]=t.cr,h[4*o+1]=t.cg,h[4*o+2]=t.cb;let b,S,m,f=32*o,M=(1.8+.8*s())*e.hairLength*i/31,y=.5+1.5*s(),R=(.02+.06*s())*i;Math.abs(g)<.99?(b=-p,S=0,m=u):(b=1,S=0,m=0);let w=Math.sqrt(b*b+S*S+m*m)||1;for(let e=0;e<32;e++){let t=e/31,s=t*t*.4*i,a=R*Math.sin(t*y*Math.PI*2),h=4*(f+e);r[h+0]=l+u*M*e+a*b/w,r[h+1]=d+g*M*e-s+a*S/w,r[h+2]=c+p*M*e+a*m/w,r[h+3]=0===e?0:1,e<31&&(n[f+e]=M)}}return{initialPositions:r,restLengths:n,unitScale:i,rootColors:h}}var C=1/60,O=4,L=new h,P=new t,z=new s,q=new s,G=class extends e{constructor(e,a,i){super(e,a),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new t,this.lastBonePos=new s,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=i,this.data=a,this.geometry.setAttribute("position",new c(new Float32Array(0),3)),this.material=new u({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new g(new l(B,48,32),new u({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let n=new r;n.setAttribute("position",new c(new Float32Array(12),3)),n.setIndex([0,2,1,2,3,1]),n.instanceCount=0,this.ribbonMesh=new g(n,new u({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=a.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:a.guideStrands,hairLength:a.hairLength,spreadRadius:a.spreadRadius,headShape:a.headShape,baseObjectId:a.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*C*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(P,z);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(P))<.9999995||this.lastBonePos.distanceToSquared(z)>1e-8),s=this.motionFingerprint(),a=!this.hasLastBone||t||this.resetRequested||s!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(P),this.lastBonePos.copy(z),this.lastMotionFingerprint=s,this.hasLastBone=!0,this.settledSimSeconds=a?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer — the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((void 0!==e.guideStrands||void 0!==e.hairLength||void 0!==e.spreadRadius||void 0!==e.headShape||void 0!==e.baseObjectId)&&this.regenerate(),(void 0!==e.headShape||void 0!==e.baseObjectId)&&this.applyScalpState(),void 0!==e.headColor){let t=this.scalpMesh.material;!0===t.isMeshBasicMaterial&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,n)}(void 0!==e.castShadow||void 0!==e.receiveShadow)&&this.applyShadowState(),void 0!==e.autoPlay&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(null===t||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let s=null===t||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),s&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:s,hairLength:a}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,"object"===e&&t){let e=this.context.scene.find(t);if(e){this.baseFoundAtRegen=!0,e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?function(e){let t=[];for(let s of e){let e=k(s);e&&t.push(e)}if(0===t.length)return null;let s=new Float64Array(t.length),a=0;for(let e=0;e<t.length;e++)a+=t[e].total,s[e]=a;return a<=0?null:e=>{let i=e()*a,r=0,n=t.length-1;for(;r<n;){let e=r+n>>1;s[e]<i?r=e+1:n=e}let h=0===r?i:i-s[r-1];return t[r].sample(h,e)}}(t.sources):null;if(this.baseSourceGeomsAtRegen=t?.sources.map(e=>e.geometry)??[],this.baseSourceHashesAtRegen=t?.hashes??[],this.baseColorHashAtRegen=t?.colorHash??0,t&&i){let r=this.baseWorldScale(e),n=Math.max(t.radius*r,.001);this.baseScaleAtRegen=r;let h=r;return H({shape:"object",guideStrands:s,hairLength:a,sampler:e=>{let t=i(e);return{...t,x:t.x*h,y:t.y*h,z:t.z*h}},samplerRadius:n})}}}return H({shape:"object"===e?"sphere":e,guideStrands:s,hairLength:a})}collectBaseSources(e){let t=[],s=[],a=0,i=0;L.copy(e.matrixWorld).invert();let r=L.clone(),n=o=>{if(!0===o.isHairSystem||o!==e&&!1===o.visible)return;let l=o.geometry;if(!0===o.isMesh&&l&&(l.getAttribute("position")?.count??0)>=3){let n=o===e?void 0:(new h).multiplyMatrices(r,o.matrixWorld),d=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:n,sampleColor:A(d,this.context.shared)??void 0}),s.push(G.matrixHash(n)),i+=function(e,t){let s=e,a=0,i=1,r=e=>{a+=e*i,i+=1},n=s?.data?.layers;if(n&&"function"==typeof n.forEach){let e=t;n.forEach(t=>{let s=t.data;if(!1!==s.visible)if("color"===s.type){let t=s.color,a="string"==typeof t?"function"==typeof e?.color?e.color(t):void 0:t;a&&"number"==typeof a.r&&(r(a.r),r(a.g),r(a.b)),r(w(s.alpha,1))}else if("gradient"===s.type){let e=s;for(let t of e.colors??[])r(t[0]),r(t[1]),r(t[2]),r(t[3]);for(let t of e.steps??[])r(t);r(w(e.angle,0)),r(e.gradientType),r(e.smooth?1:0)}})}else s?.color&&!0===s.color.isColor&&(r(s.color.r),r(s.color.g),r(s.color.b));return a}(d,this.context.shared),null===l.boundingSphere&&l.computeBoundingSphere();let c=l.boundingSphere;if(c){let e=0,t=1;n?(z.copy(c.center).applyMatrix4(n),e=z.length(),t=G.matrixMaxScale(n)):e=c.center.length(),a=Math.max(a,e+c.radius*t)}}for(let e of o.children)n(e)};return n(e),0===t.length?null:{sources:t,hashes:s,radius:Math.max(a,.001),colorHash:i}}static matrixHash(e){if(!e)return 0;let t=e.elements,s=0;for(let e=0;e<16;e++)s+=t[e]*(e+1);return s}static matrixMaxScale(e){let t=e.elements,s=Math.hypot(t[0],t[1],t[2]),a=Math.hypot(t[4],t[5],t[6]),i=Math.hypot(t[8],t[9],t[10]);return Math.max(s,a,i,1e-6)}baseWorldScale(e){return L.copy(e.matrixWorld).decompose(z,P,q),Math.max(Math.abs(q.x),Math.abs(q.y),Math.abs(q.z),1e-6)}get widthWorldScale(){return"object"===this.data.headShape&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if("object"!==this.data.headShape||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),s=t?.sources??[],a=t?.hashes??[],i=this.baseSourceGeomsAtRegen,r=this.baseSourceHashesAtRegen,n=s.length!==i.length;if(!n)for(let e=0;e<s.length;e++)if(s[e].geometry!==i[e]||Math.abs(a[e]-r[e])>1e-4*Math.max(Math.abs(r[e]),1)){n=!0;break}if(!n&&"object"===this.data.hairColorSource&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(n=!0),!n&&s.length>0){let t=this.baseWorldScale(e);n=Math.abs(t-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}n&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t="object"===e&&null!==this.data.baseObjectId;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry="torus"===e?new d(140,70,24,48):"cylinder"===e?new a(80,80,160,48,1):new l(B,48,32))}boneTransform(e,t){let s=this.matrixWorld;if("object"===this.data.headShape&&this.data.baseObjectId){let e=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;e&&(s=e)}L.copy(s).decompose(t,e,q)}raycast(e,t){if(!this.scalpMesh.visible)return;let s=[];this.scalpMesh.raycast(e,s);for(let e of s)e.object=this,t.push(e)}get shadowBoundsRadius(){let e="torus"===this.data.headShape?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(P,e),e}updateEntityBoxSize(e,t){let s=this.shadowBoundsRadius;e.set(0,0,0),t.set(s,s,s)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),M()?.release(this)}};export{b as a,S as b,f as c,M as d,j as e,I as f,F as g,B as h,C as i,O as j,G as k};
1
+ import{v as e}from"./runtime-chunk-MOZWC42D.js";import{Ec as t,Fc as s,Fd as a,Gc as i,Ge as r,Ib as n,Oc as h,Tc as o,Wd as l,Xd as d,Zc as c,kd as u,ld as g}from"./runtime-chunk-VGN7YHB7.js";var p=null;function b(e){p=e}function S(){return p}var m=null;function f(e){m=e}function M(){return m}var y=new o;function R(e,t,s){return y.setRGB(e,t,s,n),{r:y.r,g:y.g,b:y.b}}var w=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t,x=e=>Array.isArray(e)&&"number"==typeof e[0]&&"number"==typeof e[1]?[e[0],e[1]]:[0,0];function v(e,t,s){let a,i=w(e.angle,0),[r,n]=x(e.offset),[h,o]=x(e.morph),l=e.colors??[],d=e.steps??[],c=Math.min(10,l.length,d.length);if(0===c)return[1,1,1,1];if(1===e.gradientType){let e=3*(t+h)-(t+r)-1,l=3*(s+o)-(s+n)-1;a=Math.hypot(e,l)+i}else if(2===e.gradientType){let e=-1*Math.atan2(t+h-.5+r,s+o-.5+n),l=i/Math.PI/-2+.5*e/Math.PI;a=l-Math.floor(l)}else{let e=.5+h/(0!==t?t:1e-6),l=o/(0!==s?s:1e-6),d=Math.cos(i)*e-Math.sin(i)*l,c=Math.sin(i)*e+Math.cos(i)*l,u=d*d+c*c;a=u>1e-12?(((t-.5+r)/2+d/2)*d+((s-.5+n)/2+c/2)*c)/u:0}let u=l[0][0],g=l[0][1],p=l[0][2],b=l[0][3];for(let t=1;t<c;t++){let s=d[t-1],i=d[t]-s,r=0!==i?Math.min(1,Math.max(0,(a-s)/i)):a>=s?1:0;e.smooth&&(r=r*r*(3-2*r)),u+=(l[t][0]-u)*r,g+=(l[t][1]-g)*r,p+=(l[t][2]-p)*r,b+=(l[t][3]-b)*r}return[u,g,p,b]}function A(e,t){let s=e,a=s?.data?.layers;if(a&&"function"==typeof a.forEach){let e=t,s=[];return a.forEach(t=>{let a=t.data;if(!1===a.visible||!0===a.isMask)return;let i=w(a.alpha,1);if(!(i<=0))if("color"===a.type){let t,r=a.color;"string"==typeof r?t="function"==typeof e?.color?e.color(r):void 0:r&&"number"==typeof r.r&&(t=r),t&&s.push({kind:"color",layer:a,rgb:{...R(t.r,t.g,t.b),a:t.a??1},alpha:i})}else"gradient"===a.type&&s.push({kind:"gradient",layer:a,alpha:i})}),0===s.length?null:(e,t)=>{let a=1,i=1,r=1,n=!0;for(let h of s){let s,o,l,d;if("color"===h.kind)({r:s,g:o,b:l}=h.rgb),d=h.rgb.a;else{let[a,i,r,n]=v(h.layer,e,t);({r:s,g:o,b:l}=R(a,i,r)),d=n}let c=n?1:Math.min(1,Math.max(0,d*h.alpha));a+=(s-a)*c,i+=(o-i)*c,r+=(l-r)*c,n=!1}return{r:a,g:i,b:r}}}if(s?.color&&!0===s.color.isColor){let{r:e,g:t,b:a}=s.color;return()=>({r:e,g:t,b:a})}return null}var j=32,I=16384,F=32*I,W=100;function B(e,t){if("torus"===e){let e=t()*Math.PI*2,s=t()*Math.PI*2,a=Math.cos(e),i=Math.sin(e),r=Math.cos(s),n=Math.sin(s);return{x:(1.4+.7*r)*a,y:-(1.4+.7*r)*i,z:.7*n,nx:r*a,ny:-r*i,nz:n,cr:1,cg:1,cb:1}}if("cylinder"===e){let e=t()*Math.PI*2,s=Math.cos(e),a=Math.sin(e);return{x:.8*s,y:1.6*(t()-.5),z:.8*a,nx:s,ny:0,nz:a,cr:1,cg:1,cb:1}}let s=t()*Math.PI*2,a=2*t()-1,i=Math.acos(a),r=Math.sin(i)*Math.cos(s),n=Math.cos(i),h=Math.sin(i)*Math.sin(s);return{x:r,y:n,z:h,nx:r,ny:n,nz:h,cr:1,cg:1,cb:1}}function k(e){let{geometry:t,matrix:s}=e,a=t.getAttribute("position");if(!a||a.count<3)return null;let r=t.getAttribute("normal"),n=t.getAttribute("uv"),h=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:a.count/3;if(l<1)return null;let d=(e,t)=>o?o.getX(3*e+t):3*e+t,c=s?s.elements:null,u=s?(new i).getNormalMatrix(s).elements:null,g=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[0]*t+c[4]*s+c[8]*i+c[12]:t},p=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[1]*t+c[5]*s+c[9]*i+c[13]:s},b=e=>{let t=a.getX(e),s=a.getY(e),i=a.getZ(e);return c?c[2]*t+c[6]*s+c[10]*i+c[14]:i},S=new Float64Array(l),m=0;for(let e=0;e<l;e++){let t=d(e,0),s=d(e,1),a=d(e,2),i=g(t),r=p(t),n=b(t),h=g(s)-i,o=p(s)-r,l=b(s)-n,c=g(a)-i,u=p(a)-r,f=b(a)-n,M=o*f-l*u,y=l*c-h*f,R=h*u-o*c;m+=.5*Math.sqrt(M*M+y*y+R*R),S[e]=m}return m<=0?null:{total:m,sample:(t,s)=>{let a=0,i=l-1;for(;a<i;){let e=a+i>>1;S[e]<t?a=e+1:i=e}let o=a,c=d(o,0),m=d(o,1),f=d(o,2),M=s(),y=s();M+y>1&&(M=1-M,y=1-y);let R,w,x,v=1-M-y,A=g(c)*v+g(m)*M+g(f)*y,j=p(c)*v+p(m)*M+p(f)*y,I=b(c)*v+b(m)*M+b(f)*y;if(r){if(R=r.getX(c)*v+r.getX(m)*M+r.getX(f)*y,w=r.getY(c)*v+r.getY(m)*M+r.getY(f)*y,x=r.getZ(c)*v+r.getZ(m)*M+r.getZ(f)*y,u){let e=u[0]*R+u[3]*w+u[6]*x,t=u[1]*R+u[4]*w+u[7]*x,s=u[2]*R+u[5]*w+u[8]*x;R=e,w=t,x=s}}else{let e=g(c),t=p(c),s=b(c),a=g(m)-e,i=p(m)-t,r=b(m)-s,n=g(f)-e,h=p(f)-t,o=b(f)-s;R=i*o-r*h,w=r*n-a*o,x=a*h-i*n}let F=Math.sqrt(R*R+w*w+x*x)||1,W=1,B=1,k=1;if(h)W=h.getX(c)*v+h.getX(m)*M+h.getX(f)*y,B=h.getY(c)*v+h.getY(m)*M+h.getY(f)*y,k=h.getZ(c)*v+h.getZ(m)*M+h.getZ(f)*y;else if(e.sampleColor){let t=n?n.getX(c)*v+n.getX(m)*M+n.getX(f)*y:.5,s=n?n.getY(c)*v+n.getY(m)*M+n.getY(f)*y:.5,a=e.sampleColor(t,s);a&&(W=a.r,B=a.g,k=a.b)}return{x:A,y:j,z:I,nx:R/F,ny:w/F,nz:x/F,cr:W,cg:B,cb:k}}}}function C(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),I),s=function(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(e.seed??1337),a="object"===e.shape&&e.sampler,i=a?e.samplerRadius??W:W,r=new Float32Array(4*F),n=new Float32Array(F),h=new Float32Array(4*I).fill(1);for(let o=0;o<t;o++){let t=a?e.sampler(s):B(e.shape,s),l=a?t.x:t.x*i,d=a?t.y:t.y*i,c=a?t.z:t.z*i,{nx:u,ny:g,nz:p}=t;h[4*o+0]=t.cr,h[4*o+1]=t.cg,h[4*o+2]=t.cb;let b,S,m,f=32*o,M=(1.8+.8*s())*e.hairLength*i/31,y=.5+1.5*s(),R=(.02+.06*s())*i;Math.abs(g)<.99?(b=-p,S=0,m=u):(b=1,S=0,m=0);let w=Math.sqrt(b*b+S*S+m*m)||1;for(let e=0;e<32;e++){let t=e/31,s=t*t*.4*i,a=R*Math.sin(t*y*Math.PI*2),h=4*(f+e);r[h+0]=l+u*M*e+a*b/w,r[h+1]=d+g*M*e-s+a*S/w,r[h+2]=c+p*M*e+a*m/w,r[h+3]=0===e?0:1,e<31&&(n[f+e]=M)}}return{initialPositions:r,restLengths:n,unitScale:i,rootColors:h}}var H=1/60,O=4,L=new h,P=new t,z=new s,q=new s,G=class extends e{constructor(e,a,i){super(e,a),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.settledSimSeconds=0,this.lastMotionFingerprint=0,this.lastBoneQuat=new t,this.lastBonePos=new s,this.hasLastBone=!1,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=i,this.data=a,this.geometry.setAttribute("position",new c(new Float32Array(0),3)),this.material=new u({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new g(new l(W,48,32),new u({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let n=new r;n.setAttribute("position",new c(new Float32Array(12),3)),n.setIndex([0,2,1,2,3,1]),n.instanceCount=0,this.ribbonMesh=new g(n,new u({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=a.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:a.guideStrands,hairLength:a.hairLength,spreadRadius:a.spreadRadius,headShape:a.headShape,baseObjectId:a.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*H*2),this.trackMotionRest(e/1e3))}trackMotionRest(e){this.boneTransform(P,z);let t=this.hasLastBone&&(Math.abs(this.lastBoneQuat.dot(P))<.9999995||this.lastBonePos.distanceToSquared(z)>1e-8),s=this.motionFingerprint(),a=!this.hasLastBone||t||this.resetRequested||s!==this.lastMotionFingerprint||this.data.windStrength>.001;this.lastBoneQuat.copy(P),this.lastBonePos.copy(z),this.lastMotionFingerprint=s,this.hasLastBone=!0,this.settledSimSeconds=a?0:this.settledSimSeconds+e}motionFingerprint(){let e=this.data;return e.gravity+2*e.damping+3*e.localStiffness+4*e.globalStiffness+5*e.globalRange+6*e.stiffnessFalloff+7*e.windStrength+8*e.vspCoefficient+9*e.kink+10*e.kinkFrequency+11*e.clumpStrength+12*e.clumpSize+13*e.clumpTipScale}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}get isMotionSettled(){return this.settledSimSeconds>6}get isVisiblyAnimating(){return this.isSimulating&&!this.isMotionSettled}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0,this.settledSimSeconds=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer — the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((void 0!==e.guideStrands||void 0!==e.hairLength||void 0!==e.spreadRadius||void 0!==e.headShape||void 0!==e.baseObjectId)&&this.regenerate(),(void 0!==e.headShape||void 0!==e.baseObjectId)&&this.applyScalpState(),void 0!==e.headColor){let t=this.scalpMesh.material;!0===t.isMeshBasicMaterial&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,n)}(void 0!==e.castShadow||void 0!==e.receiveShadow)&&this.applyShadowState(),void 0!==e.autoPlay&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.castShadow=e,this.receiveShadow=t,this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(null===t||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let s=null===t||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),s&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:s,hairLength:a}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,"object"===e&&t){let e=this.context.scene.find(t);if(e){this.baseFoundAtRegen=!0,e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?function(e){let t=[];for(let s of e){let e=k(s);e&&t.push(e)}if(0===t.length)return null;let s=new Float64Array(t.length),a=0;for(let e=0;e<t.length;e++)a+=t[e].total,s[e]=a;return a<=0?null:e=>{let i=e()*a,r=0,n=t.length-1;for(;r<n;){let e=r+n>>1;s[e]<i?r=e+1:n=e}let h=0===r?i:i-s[r-1];return t[r].sample(h,e)}}(t.sources):null;if(this.baseSourceGeomsAtRegen=t?.sources.map(e=>e.geometry)??[],this.baseSourceHashesAtRegen=t?.hashes??[],this.baseColorHashAtRegen=t?.colorHash??0,t&&i){let r=this.baseWorldScale(e),n=Math.max(t.radius*r,.001);this.baseScaleAtRegen=r;let h=r;return C({shape:"object",guideStrands:s,hairLength:a,sampler:e=>{let t=i(e);return{...t,x:t.x*h,y:t.y*h,z:t.z*h}},samplerRadius:n})}}}return C({shape:"object"===e?"sphere":e,guideStrands:s,hairLength:a})}collectBaseSources(e){let t=[],s=[],a=0,i=0;L.copy(e.matrixWorld).invert();let r=L.clone(),n=o=>{if(!0===o.isHairSystem||o!==e&&!1===o.visible)return;let l=o.geometry;if(!0===o.isMesh&&l&&(l.getAttribute("position")?.count??0)>=3){let n=o===e?void 0:(new h).multiplyMatrices(r,o.matrixWorld),d=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:n,sampleColor:A(d,this.context.shared)??void 0}),s.push(G.matrixHash(n)),i+=function(e,t){let s=e,a=0,i=1,r=e=>{a+=e*i,i+=1},n=s?.data?.layers;if(n&&"function"==typeof n.forEach){let e=t;n.forEach(t=>{let s=t.data;if(!1!==s.visible)if("color"===s.type){let t=s.color,a="string"==typeof t?"function"==typeof e?.color?e.color(t):void 0:t;a&&"number"==typeof a.r&&(r(a.r),r(a.g),r(a.b)),r(w(s.alpha,1))}else if("gradient"===s.type){let e=s;for(let t of e.colors??[])r(t[0]),r(t[1]),r(t[2]),r(t[3]);for(let t of e.steps??[])r(t);r(w(e.angle,0)),r(e.gradientType),r(e.smooth?1:0)}})}else s?.color&&!0===s.color.isColor&&(r(s.color.r),r(s.color.g),r(s.color.b));return a}(d,this.context.shared),null===l.boundingSphere&&l.computeBoundingSphere();let c=l.boundingSphere;if(c){let e=0,t=1;n?(z.copy(c.center).applyMatrix4(n),e=z.length(),t=G.matrixMaxScale(n)):e=c.center.length(),a=Math.max(a,e+c.radius*t)}}for(let e of o.children)n(e)};return n(e),0===t.length?null:{sources:t,hashes:s,radius:Math.max(a,.001),colorHash:i}}static matrixHash(e){if(!e)return 0;let t=e.elements,s=0;for(let e=0;e<16;e++)s+=t[e]*(e+1);return s}static matrixMaxScale(e){let t=e.elements,s=Math.hypot(t[0],t[1],t[2]),a=Math.hypot(t[4],t[5],t[6]),i=Math.hypot(t[8],t[9],t[10]);return Math.max(s,a,i,1e-6)}baseWorldScale(e){return L.copy(e.matrixWorld).decompose(z,P,q),Math.max(Math.abs(q.x),Math.abs(q.y),Math.abs(q.z),1e-6)}get widthWorldScale(){return"object"===this.data.headShape&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if("object"!==this.data.headShape||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),s=t?.sources??[],a=t?.hashes??[],i=this.baseSourceGeomsAtRegen,r=this.baseSourceHashesAtRegen,n=s.length!==i.length;if(!n)for(let e=0;e<s.length;e++)if(s[e].geometry!==i[e]||Math.abs(a[e]-r[e])>1e-4*Math.max(Math.abs(r[e]),1)){n=!0;break}if(!n&&"object"===this.data.hairColorSource&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(n=!0),!n&&s.length>0){let t=this.baseWorldScale(e);n=Math.abs(t-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}n&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t="object"===e&&null!==this.data.baseObjectId;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry="torus"===e?new d(140,70,24,48):"cylinder"===e?new a(80,80,160,48,1):new l(W,48,32))}boneTransform(e,t){let s=this.matrixWorld;if("object"===this.data.headShape&&this.data.baseObjectId){let e=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;e&&(s=e)}L.copy(s).decompose(t,e,q)}raycast(e,t){if(!this.scalpMesh.visible)return;let s=[];this.scalpMesh.raycast(e,s);for(let e of s)e.object=this,t.push(e)}get shadowBoundsRadius(){let e="torus"===this.data.headShape?2.6:1.5;return this.roots.unitScale*(e+2.6*Math.max(this.data.hairLength,0))}getShadowBoundsCenter(e){return this.boneTransform(P,e),e}updateEntityBoxSize(e,t){let s=this.shadowBoundsRadius;e.set(0,0,0),t.set(s,s,s)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),M()?.release(this)}};export{b as a,S as b,f as c,M as d,j as e,I as f,F as g,W as h,H as i,O as j,G as k};
@@ -1 +1 @@
1
- import{a as t}from"./runtime-chunk-5RXW5MNJ.js";import{e}from"./runtime-chunk-YULW5JRE.js";import{c as i}from"./runtime-chunk-DK66VKWP.js";import{i as r}from"./runtime-chunk-CKT62HES.js";import{j as s}from"./runtime-chunk-2PT2WH66.js";import{Fc as n,Ne as o,dd as a,ud as h,vd as c}from"./runtime-chunk-VGN7YHB7.js";var d=class extends o{constructor(){super(),i(this.layers)}setFromCamera(t,e){e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):e.isPerspectiveCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(e),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(t,e=!0,i=[]){return t.forEach(t=>{t.visible&&this.intersectObject(t,e,i)}),i}createRaycastLineHelper(){let t=new h({color:65280,linewidth:10}),e=new n(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),i=new n(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),r=this.camera.far-this.camera.near,s=(new n).addVectors(e,i.multiplyScalar(r)),o=new a;return o.setFromPoints([e,s]),new c(o,t)}},u=e=>e instanceof t||s(e);function l(t,e){return t.distance-e.distance}function m(t,i,s){if(r(i)&&i.visible){e(i)&&i.raycast(t,s);for(let e of i.children)m(t,e,s)}}function f(t,e,i,r=!1){if(!r&&!i.some(e=>void 0!==w(t,e)))return[];let s=[];return e.children.forEach(e=>m(t,e,s)),s.sort(l),s}function p(t){let e=[];if(t.length){let i=t[0].object;r(i)&&e.push(i);let s=i.parent;for(;s;)u(s)&&e.push(s),s=s.parent}return e}function y(t,e,i,r){let s=t.frame;if(s){let t=e[0]*s.width,n=(1-e[1])*s.height;for(let e of i){let i=e===s.uuid?s:s.find(e);if(i?.intersects(t,n))return r(i),!0}}return!1}function w(t,i){if(e(i)){if(i.visible){let e=[];return i.raycast(t,e),e.length?e[0]:void 0}}else if(u(i))return g(t,i)}function g(t,i){if(r(i)&&i.visible){if(e(i)){let e=[];if(i.raycast(t,e),e.length)return e[0]}for(let e of i.children){let i=g(t,e);if(i)return i}}}var v=class{constructor(t,e,i,r,s,n,o,a){this.renderer=t,this.publish=e,this.scene=i,this.getCamera=r,this.sharedAssets=s,this.requestRender=n,this.isExport=o,this.frame=a,this.raycaster=new d,this._useWindowEvents=!1,this.pointerWorld={x:0,y:0},this.pointerScreen={x:0,y:0},this._useWindowEvents="window"===e.mouseEventTarget,this.domElement=t.domElement,this.eventElement=this._useWindowEvents?window:t.domElement,this._domRect=this.domElement.getBoundingClientRect()}get stopRaycast(){return this.publish.stopRaycast}get page(){return this.scene.activePage}set useWindowEvents(t){this._useWindowEvents=t,this.eventElement=t?window:this.renderer.domElement}get useWindowEvents(){return this._useWindowEvents}set domRect(t){this._domRect=t}get domRect(){return this._domRect}updateRaycaster(t){let{pageX:e,pageY:i}=t.touches?.length>0?t.touches[0]:t;this.pointerWorld=function(t,e,i){return{x:(t-(i.left+window.scrollX))/i.width*2-1,y:-(e-(i.top+window.scrollY))/i.height*2+1}}(e,i,this._domRect),this.pointerScreen=function(t,e,i){return{x:(t-(i.left+window.scrollX))/i.width,y:1-(e-(i.top+window.scrollY))/i.height}}(e,i,this._domRect),this.raycaster.setFromCamera(this.pointerWorld,this.getCamera())}dispose(){this.scene=void 0,this.sharedAssets=void 0,this.publish=void 0,this.getCamera=void 0,this.requestRender=void 0,this.frame=void 0,this.isExport=void 0}};export{f as a,p as b,y as c,w as d,v as e};
1
+ import{a as t}from"./runtime-chunk-UHCXLQHA.js";import{e}from"./runtime-chunk-ZASM3KKC.js";import{c as i}from"./runtime-chunk-7FDJ7IIR.js";import{i as r}from"./runtime-chunk-MOZWC42D.js";import{j as s}from"./runtime-chunk-2PT2WH66.js";import{Fc as n,Ne as o,dd as a,ud as h,vd as c}from"./runtime-chunk-VGN7YHB7.js";var d=class extends o{constructor(){super(),i(this.layers)}setFromCamera(t,e){e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):e.isPerspectiveCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(e),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(t,e=!0,i=[]){return t.forEach(t=>{t.visible&&this.intersectObject(t,e,i)}),i}createRaycastLineHelper(){let t=new h({color:65280,linewidth:10}),e=new n(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),i=new n(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),r=this.camera.far-this.camera.near,s=(new n).addVectors(e,i.multiplyScalar(r)),o=new a;return o.setFromPoints([e,s]),new c(o,t)}},u=e=>e instanceof t||s(e);function l(t,e){return t.distance-e.distance}function m(t,i,s){if(r(i)&&i.visible){e(i)&&i.raycast(t,s);for(let e of i.children)m(t,e,s)}}function f(t,e,i,r=!1){if(!r&&!i.some(e=>void 0!==w(t,e)))return[];let s=[];return e.children.forEach(e=>m(t,e,s)),s.sort(l),s}function p(t){let e=[];if(t.length){let i=t[0].object;r(i)&&e.push(i);let s=i.parent;for(;s;)u(s)&&e.push(s),s=s.parent}return e}function y(t,e,i,r){let s=t.frame;if(s){let t=e[0]*s.width,n=(1-e[1])*s.height;for(let e of i){let i=e===s.uuid?s:s.find(e);if(i?.intersects(t,n))return r(i),!0}}return!1}function w(t,i){if(e(i)){if(i.visible){let e=[];return i.raycast(t,e),e.length?e[0]:void 0}}else if(u(i))return g(t,i)}function g(t,i){if(r(i)&&i.visible){if(e(i)){let e=[];if(i.raycast(t,e),e.length)return e[0]}for(let e of i.children){let i=g(t,e);if(i)return i}}}var v=class{constructor(t,e,i,r,s,n,o,a){this.renderer=t,this.publish=e,this.scene=i,this.getCamera=r,this.sharedAssets=s,this.requestRender=n,this.isExport=o,this.frame=a,this.raycaster=new d,this._useWindowEvents=!1,this.pointerWorld={x:0,y:0},this.pointerScreen={x:0,y:0},this._useWindowEvents="window"===e.mouseEventTarget,this.domElement=t.domElement,this.eventElement=this._useWindowEvents?window:t.domElement,this._domRect=this.domElement.getBoundingClientRect()}get stopRaycast(){return this.publish.stopRaycast}get page(){return this.scene.activePage}set useWindowEvents(t){this._useWindowEvents=t,this.eventElement=t?window:this.renderer.domElement}get useWindowEvents(){return this._useWindowEvents}set domRect(t){this._domRect=t}get domRect(){return this._domRect}updateRaycaster(t){let{pageX:e,pageY:i}=t.touches?.length>0?t.touches[0]:t;this.pointerWorld=function(t,e,i){return{x:(t-(i.left+window.scrollX))/i.width*2-1,y:-(e-(i.top+window.scrollY))/i.height*2+1}}(e,i,this._domRect),this.pointerScreen=function(t,e,i){return{x:(t-(i.left+window.scrollX))/i.width,y:1-(e-(i.top+window.scrollY))/i.height}}(e,i,this._domRect),this.raycaster.setFromCamera(this.pointerWorld,this.getCamera())}dispose(){this.scene=void 0,this.sharedAssets=void 0,this.publish=void 0,this.getCamera=void 0,this.requestRender=void 0,this.frame=void 0,this.isExport=void 0}};export{f as a,p as b,y as c,w as d,v as e};
@@ -1 +1 @@
1
- import{a as e,b as t}from"./runtime-chunk-F3ZACLZW.js";import{b as a,e as i,g as r}from"./runtime-chunk-YULW5JRE.js";import{a as s}from"./runtime-chunk-TU4KDRKR.js";import{a as n}from"./runtime-chunk-32KZP4YN.js";import{a as l,b as o}from"./runtime-chunk-EJJZJ5MV.js";import{T as h,d as u,da as c,e as d,h as p}from"./runtime-chunk-DK66VKWP.js";import{b as y,h as m,j as g,v as f}from"./runtime-chunk-CKT62HES.js";import{c as b}from"./runtime-chunk-2PT2WH66.js";import{c as v,l as C}from"./runtime-chunk-TZCHGFVF.js";import{qa as k,ta as S,w as A,za as w}from"./runtime-chunk-VPEJ5BFD.js";import{Ne as F,Oc as L,Tc as O,Uc as j,Vc as H,cd as T,jd as B,ld as D,ve as M}from"./runtime-chunk-VGN7YHB7.js";function U(e){return e instanceof c&&e.needsAO&&!b(e)&&!0!==e.isDecalObject}function z(e){let t=e.cloner;if(t&&Array.isArray(t.children))for(let a of t.children)a?.layers&&(a.layers.mask=e.layers.mask)}function E(e){return e.getLayersOfType("reflection").filter(e=>e.data.visible).length}function P(e){return e.getLayersOfType("reflection").some(e=>e.data.visible&&1===e.data.mirror)}function x(e){let t=1/0,a=-1/0;for(let i of e.getLayersOfType("reflection")){let e=i.data;if(!e.visible||1===e.mirror)continue;let r="number"==typeof e.blur?e.blur:null;t=Math.min(t,r??0),a=Math.max(a,r??10)}return t===1/0?null:{min:t,max:a}}function I(e){for(let t of e.getLayersOfType("reflection")){let e=t.data;if(!e.visible)continue;let{blur:a,thickness:i,steps:r,stepSize:s}=e;return"number"!=typeof a||"number"!=typeof i||"number"!=typeof r||"number"!=typeof s?"variable":{blur:a,thickness:i,steps:r,stepSize:s,tracingMode:1===e.tracingMode?1:0}}return null}function V(e,t){let a={outline:!1,cavity:!1},i=512&e.layers.mask,r=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),n=E(t),h=t.getLayersOfType("cavity");return(s.length>0||h.length>0)&&(e.layers.set(8),r.length>0&&e.layers.enable(3),n>0&&e.layers.enable(4),a.outline=s.length>0,a.cavity=h.length>0,o(e),l(e)),0===r.length&&0===s.length&&0===h.length&&0===n&&e.layers.set(0),i&&e.layers.set(9),!i&&U(e)&&e.layers.enable(5),z(e),a}function W(e,t){if(!t.layers)return!1;let a=512&e.layers.mask,i=!1,r=t.getLayersOfType("transmission").filter(e=>e.data.visible),s=t.getLayersOfType("outline").filter(e=>e.data.visible),n=E(t),l=t.getLayersOfType("cavity").filter(e=>e.data.visible);return r.length>0&&(e.layers.set(3),(s.length>0||l.length>0)&&e.layers.enable(8),n>0&&e.layers.enable(4),i=!0),0===r.length&&0===s.length&&0===l.length&&0===n&&e.layers.set(0),a&&e.layers.set(9),!a&&U(e)&&e.layers.enable(5),z(e),i}function K(e,t){var a;if(!t.layers)return!1;let i=512&e.layers.mask,r=!1,s=E(t),n=t.getLayersOfType("transmission").filter(e=>e.data.visible),l=t.getLayersOfType("outline").filter(e=>e.data.visible),o=t.getLayersOfType("cavity").filter(e=>e.data.visible);return s>0&&((a=e.userData).__splinePlanarMirror??(a.__splinePlanarMirror=0),e.layers.set(4),n.length>0&&e.layers.enable(3),(l.length>0||o.length>0)&&e.layers.enable(8),r=!0),0===s&&0===n.length&&0===l.length&&0===o.length&&e.layers.set(0),i&&e.layers.set(9),!i&&U(e)&&e.layers.enable(5),z(e),r}function _(e){let t={outline:!1,cavity:!1},a=e=>{t.outline=t.outline||e.outline,t.cavity=t.cavity||e.cavity};return e.traverseEntity(e=>{if(e instanceof c)if(Array.isArray(e.material))for(let t=0;t<e.material.length;t++)a(V(e,e.material[t]));else a(V(e,e.material))}),t}function G(e){let t=!1;return e.traverseEntity(e=>{if(e instanceof c)if(Array.isArray(e.material))for(let a=0;a<e.material.length;a++)W(e,e.material[a])&&(t=!0);else W(e,e.material)&&(t=!0)}),t}function J(e){let t=!1;return e.traverseEntity(e=>{if(e instanceof c)if(Array.isArray(e.material))for(let a=0;a<e.material.length;a++)K(e,e.material[a])&&(t=!0);else K(e,e.material)&&(t=!0)}),t}var Z=new F,R=new L,N=new B,Y=new T;function Q(e,t,a,i=!1){let r=e.cloner;if(r){let s=null;if(e.raycast===D.prototype.raycast||e.raycast===f.prototype.raycast){let t=e.geometry;t&&(null===t.boundingSphere&&t.computeBoundingSphere(),s=t.boundingSphere)}for(let n of r.children){if(null!==s&&(Y.copy(s).applyMatrix4(n.matrixWorld),!t.ray.intersectsSphere(Y)))continue;let r=R.copy(n.matrixWorld).invert(),l=N.copy(t.ray).applyMatrix4(r),o=e.matrixWorld;l.applyMatrix4(o);let h=Z;h.set(l.origin,l.direction),h.near=t.near,h.far=t.far,h.layers.mask=t.layers.mask;let u=h.intersectObject(e,!1);u.length>0&&a.push({...u[0],object:i?n:e})}}}var q=class extends(g(H)){constructor(e,t,a){if(super(),this.data=t,this.bgColor=new p(1,1,1,1),this.fog=null,this.backupFog=new j(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=k.getDensity({}),this.fogHeightFalloff=k.getHeightFalloff({}),this.fogHeightBase=k.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new O,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new n(A,{...w.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new M(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene){let i=C();null===i?v("ui-2d","a page's 2D scene"):this.uiScene=new i.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:a.shared})}else t.uiFrame&&this.createUICanvas(t.uiFrame,a)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,t){let a=C();null!==a?(this.uiCanvas=new a.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})):v("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(e){this.bgColor=e,!0===this.fogUseBGColor&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){void 0!==e.color&&(this.ambientLight.color=s(e.color,t)),void 0!==e.intensity&&(this.ambientLight.intensity=e.intensity*Math.PI),void 0!==e.enabled&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(e=>{e instanceof a&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof c)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(void 0===e.softShadowQuality&&void 0===e.type||!this.isActive)return;let t=this.data.shadow,a=S.isSoft(t);h(a,t?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=s(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=k.getMode(e),this.fogDensity=k.getDensity(e),this.fogHeightFalloff=k.getHeightFalloff(e),this.fogHeightBase=k.getHeightBase(e)}updateSky(e,t){this.skyState=e??null,this.skyStateVersion++;let a=e?.hdri?.image;this.skyHdriHolder=null!=a?t.image(a):null}updateAo(e,t){void 0!==e.aoColor&&(this.aoColor=s(e.aoColor,t))}updateByOp(e,t,a,i){let r=this.data.uiFrame;super.updateByOp(e,t,a,i);let s=t;y(e.path,["fog"])?this.updateFog(s.fog,a.shared):y(e.path,["sky"])?this.updateSky(s.sky,a.shared):y(e.path,["grading"])?this.gradingState=s.grading??null:y(e.path,["ao"])?this.updateAo(s.ao,a.shared):y(e.path,["ambient"])?this.updateAmbientLight(s.ambient,a.shared):y(e.path,["shadow"])?this.updateShadow(s.shadow):0===e.type&&0===e.path.length&&(void 0!==e.props.uiFrame||r!==s.uiFrame)&&this.updateUIFrame(e.props.uiFrame,a)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),void 0!==e.backgroundColor&&this.setBackgroundColor(s(e.backgroundColor,t.shared)),void 0!==e.fog&&this.updateFog(e.fog,t.shared),void 0!==e.sky&&this.updateSky(e.sky,t.shared),void 0!==e.grading&&(this.gradingState=e.grading),void 0!==e.ambient&&this.updateAmbientLight(e.ambient,t.shared),void 0!==e.ao&&this.updateAo(e.ao,t.shared),void 0!==e.shadow&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return null===this.penumbraSizeArrayCache&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(u).fill(.5);let a=0,i=0;this.traverseEntity(r=>{if(!r.visible)return!0;r instanceof e&&r.visible&&a<d&&(this.penumbraSizeArrayCache[a]=r.data.penumbraSize??.5,a+=1),r instanceof t&&r.visible&&a<u-d&&(this.penumbraSizeArrayCache[d+i]=r.data.penumbraSize??.5,i+=1)})}raycastWithClones(e){let t=[],a=s=>{for(let n of s.children){let s=n.cloner;m.is(n)&&(n.visible||s?.object.data.visible)&&((i(n)||r(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),Q(n,e,t,!0)),a(n))}};return a(this),t}updateEntity2DByOp(e,t,a,i){this.uiCanvas?.updateEntity2DByOp(e,t,a,i)}};export{P as a,x as b,I as c,_ as d,G as e,J as f,Q as g,q as h};
1
+ import{a as e,b as t}from"./runtime-chunk-RTRWO43P.js";import{b as a,e as i,g as r}from"./runtime-chunk-ZASM3KKC.js";import{a as s}from"./runtime-chunk-TU4KDRKR.js";import{a as n}from"./runtime-chunk-YS7K3AW3.js";import{a as l,b as o}from"./runtime-chunk-M4BPCY7K.js";import{T as h,d as u,da as c,e as d,h as p}from"./runtime-chunk-7FDJ7IIR.js";import{b as y,h as m,j as g,v as f}from"./runtime-chunk-MOZWC42D.js";import{c as b}from"./runtime-chunk-2PT2WH66.js";import{c as v,l as C}from"./runtime-chunk-TZCHGFVF.js";import{qa as S,ta as k,w as A,za as w}from"./runtime-chunk-VPEJ5BFD.js";import{Ne as F,Oc as L,Tc as O,Uc as j,Vc as H,cd as B,jd as T,ld as M,ve as D}from"./runtime-chunk-VGN7YHB7.js";function U(e){return e instanceof c&&e.needsAO&&!b(e)&&!0!==e.isDecalObject}function z(e){let t=e.cloner;if(t&&Array.isArray(t.children))for(let a of t.children)a?.layers&&(a.layers.mask=e.layers.mask)}function P(e){return e.getLayersOfType("reflection").filter(e=>e.data.visible).length}function I(e){return e.getLayersOfType("reflection").some(e=>e.data.visible&&1===e.data.mirror)}function x(e){let t=1/0,a=-1/0;for(let i of e.getLayersOfType("reflection")){let e=i.data;if(!e.visible||1===e.mirror)continue;let r="number"==typeof e.blur?e.blur:null;t=Math.min(t,r??0),a=Math.max(a,r??10)}return t===1/0?null:{min:t,max:a}}function E(e){for(let t of e.getLayersOfType("reflection")){let e=t.data;if(!e.visible)continue;let{blur:a,thickness:i,steps:r,stepSize:s}=e;return"number"!=typeof a||"number"!=typeof i||"number"!=typeof r||"number"!=typeof s?"variable":{blur:a,thickness:i,steps:r,stepSize:s,tracingMode:1===e.tracingMode?1:0}}return null}function W(e,t){let a={outline:!1,cavity:!1},i=512&e.layers.mask,r=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),n=P(t),h=t.getLayersOfType("cavity");return(s.length>0||h.length>0)&&(e.layers.set(8),r.length>0&&e.layers.enable(3),n>0&&e.layers.enable(4),a.outline=s.length>0,a.cavity=h.length>0,o(e),l(e)),0===r.length&&0===s.length&&0===h.length&&0===n&&e.layers.set(0),i&&e.layers.set(9),!i&&U(e)&&e.layers.enable(5),z(e),a}function V(e,t){if(!t.layers)return!1;let a=512&e.layers.mask,i=!1,r=t.getLayersOfType("transmission").filter(e=>e.data.visible),s=t.getLayersOfType("outline").filter(e=>e.data.visible),n=P(t),l=t.getLayersOfType("cavity").filter(e=>e.data.visible);return r.length>0&&(e.layers.set(3),(s.length>0||l.length>0)&&e.layers.enable(8),n>0&&e.layers.enable(4),i=!0),0===r.length&&0===s.length&&0===l.length&&0===n&&e.layers.set(0),a&&e.layers.set(9),!a&&U(e)&&e.layers.enable(5),z(e),i}function K(e,t){var a;if(!t.layers)return!1;let i=512&e.layers.mask,r=!1,s=P(t),n=t.getLayersOfType("transmission").filter(e=>e.data.visible),l=t.getLayersOfType("outline").filter(e=>e.data.visible),o=t.getLayersOfType("cavity").filter(e=>e.data.visible);return s>0&&((a=e.userData).__splinePlanarMirror??(a.__splinePlanarMirror=0),e.layers.set(4),n.length>0&&e.layers.enable(3),(l.length>0||o.length>0)&&e.layers.enable(8),r=!0),0===s&&0===n.length&&0===l.length&&0===o.length&&e.layers.set(0),i&&e.layers.set(9),!i&&U(e)&&e.layers.enable(5),z(e),r}function R(e){let t={outline:!1,cavity:!1},a=e=>{t.outline=t.outline||e.outline,t.cavity=t.cavity||e.cavity};return e.traverseEntity(e=>{if(e instanceof c)if(Array.isArray(e.material))for(let t=0;t<e.material.length;t++)a(W(e,e.material[t]));else a(W(e,e.material))}),t}function _(e){let t=!1;return e.traverseEntity(e=>{if(e instanceof c)if(Array.isArray(e.material))for(let a=0;a<e.material.length;a++)V(e,e.material[a])&&(t=!0);else V(e,e.material)&&(t=!0)}),t}function G(e){let t=!1;return e.traverseEntity(e=>{if(e instanceof c)if(Array.isArray(e.material))for(let a=0;a<e.material.length;a++)K(e,e.material[a])&&(t=!0);else K(e,e.material)&&(t=!0)}),t}var Y=new F,Z=new L,J=new T,N=new B;function Q(e,t,a,i=!1){let r=e.cloner;if(r){let s=null;if(e.raycast===M.prototype.raycast||e.raycast===f.prototype.raycast){let t=e.geometry;t&&(null===t.boundingSphere&&t.computeBoundingSphere(),s=t.boundingSphere)}for(let n of r.children){if(null!==s&&(N.copy(s).applyMatrix4(n.matrixWorld),!t.ray.intersectsSphere(N)))continue;let r=Z.copy(n.matrixWorld).invert(),l=J.copy(t.ray).applyMatrix4(r),o=e.matrixWorld;l.applyMatrix4(o);let h=Y;h.set(l.origin,l.direction),h.near=t.near,h.far=t.far,h.layers.mask=t.layers.mask;let u=h.intersectObject(e,!1);u.length>0&&a.push({...u[0],object:i?n:e})}}}var q=class extends(g(H)){constructor(e,t,a){if(super(),this.data=t,this.bgColor=new p(1,1,1,1),this.fog=null,this.backupFog=new j(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=S.getDensity({}),this.fogHeightFalloff=S.getHeightFalloff({}),this.fogHeightBase=S.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new O,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new n(A,{...w.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new D(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene){let i=C();null===i?v("ui-2d","a page's 2D scene"):this.uiScene=new i.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:a.shared})}else t.uiFrame&&this.createUICanvas(t.uiFrame,a)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,t){let a=C();null!==a?(this.uiCanvas=new a.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})):v("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(e){this.bgColor=e,!0===this.fogUseBGColor&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){void 0!==e.color&&(this.ambientLight.color=s(e.color,t)),void 0!==e.intensity&&(this.ambientLight.intensity=e.intensity*Math.PI),void 0!==e.enabled&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(e=>{e instanceof a&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof c)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(void 0===e.softShadowQuality&&void 0===e.type||!this.isActive)return;let t=this.data.shadow,a=k.isSoft(t);h(a,t?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=s(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=S.getMode(e),this.fogDensity=S.getDensity(e),this.fogHeightFalloff=S.getHeightFalloff(e),this.fogHeightBase=S.getHeightBase(e)}updateSky(e,t){this.skyState=e??null,this.skyStateVersion++;let a=e?.hdri?.image;this.skyHdriHolder=null!=a?t.image(a):null}updateAo(e,t){void 0!==e.aoColor&&(this.aoColor=s(e.aoColor,t))}updateByOp(e,t,a,i){let r=this.data.uiFrame;super.updateByOp(e,t,a,i);let s=t;y(e.path,["fog"])?this.updateFog(s.fog,a.shared):y(e.path,["sky"])?this.updateSky(s.sky,a.shared):y(e.path,["grading"])?this.gradingState=s.grading??null:y(e.path,["ao"])?this.updateAo(s.ao,a.shared):y(e.path,["ambient"])?this.updateAmbientLight(s.ambient,a.shared):y(e.path,["shadow"])?this.updateShadow(s.shadow):0===e.type&&0===e.path.length&&(void 0!==e.props.uiFrame||r!==s.uiFrame)&&this.updateUIFrame(e.props.uiFrame,a)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),void 0!==e.backgroundColor&&this.setBackgroundColor(s(e.backgroundColor,t.shared)),void 0!==e.fog&&this.updateFog(e.fog,t.shared),void 0!==e.sky&&this.updateSky(e.sky,t.shared),void 0!==e.grading&&(this.gradingState=e.grading),void 0!==e.ambient&&this.updateAmbientLight(e.ambient,t.shared),void 0!==e.ao&&this.updateAo(e.ao,t.shared),void 0!==e.shadow&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return null===this.penumbraSizeArrayCache&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(u).fill(.5);let a=0,i=0;this.traverseEntity(r=>{if(!r.visible)return!0;r instanceof e&&r.visible&&a<d&&(this.penumbraSizeArrayCache[a]=r.data.penumbraSize??.5,a+=1),r instanceof t&&r.visible&&a<u-d&&(this.penumbraSizeArrayCache[d+i]=r.data.penumbraSize??.5,i+=1)})}raycastWithClones(e){let t=[],a=s=>{for(let n of s.children){let s=n.cloner;m.is(n)&&(n.visible||s?.object.data.visible)&&((i(n)||r(n)&&this.scene.enableHelpers&&n.objectHelper.visible)&&(e.intersectObject(n,!1,t),Q(n,e,t,!0)),a(n))}};return a(this),t}updateEntity2DByOp(e,t,a,i){this.uiCanvas?.updateEntity2DByOp(e,t,a,i)}};export{I as a,x as b,E as c,R as d,_ as e,G as f,Q as g,q as h};
@@ -0,0 +1 @@
1
+ import{b as t}from"./runtime-chunk-N2ZRGNPR.js";import{a as e,c as i}from"./runtime-chunk-VAVYZ35B.js";import{b as s,c as o,d as a,e as n}from"./runtime-chunk-FQNSP44B.js";import{a as r}from"./runtime-chunk-MVJAFW5H.js";import{G as h,a as l}from"./runtime-chunk-7FDJ7IIR.js";import{f as d,g as c}from"./runtime-chunk-EPHVY3XO.js";import{h as p}from"./runtime-chunk-MOZWC42D.js";import{a as m,b as u,g as y,h as v,i as g}from"./runtime-chunk-2PT2WH66.js";import{a as f}from"./runtime-chunk-4KZXQGUQ.js";import{c as b}from"./runtime-chunk-TZCHGFVF.js";import{Fa as E}from"./runtime-chunk-VPEJ5BFD.js";import{Bc as P,Dc as C,Ec as M,Fc as x,Oc as T,Oe as D,Pc as S,Rc as w,Xc as R,b as j,bd as G,cd as L,dd as B}from"./runtime-chunk-VGN7YHB7.js";var A=200,W=null;function O(t){W=t}function I(){return W}function F(t){let e=!1;return t.scene.objects.forEach(i=>{"Page"===i.data.type&&!e&&i.data.publish.gameControlObject&&E.traverseModuleInstances(t,i.id,(t,i,s)=>{for(let t of s)"GameControl"===t.data.type&&t.data.navmesh.enabled&&(e=!0)})}),e}function k(t){return s?t.metaKey:t.ctrlKey}function V(t,e){return Math.abs(t+3*e)<=2||Math.abs(t+3*window.devicePixelRatio*e)<=2}var z={type:"change"},H={type:"start"},Z={type:"end",nonOrbit:!0},U={type:"end",nonOrbit:!1},Y={type:"end",isZoom:!0,nonOrbit:!0},X={type:"end",changed:!1},N={type:"cameraAnimatingInTimeline"},K=new M,_=new C,q=2*Math.PI,Q=new x,J=new C,$=new x,tt=new M,et=new T,it={type:"requestRender"},st=class extends P{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,j.DOLLY_ROTATE,j.PAN],this.offset=new x,this.eye=new x,this.lastPosition=new x,this.lastQuaternion=new M,this.current=new C,this.overShoot=new C,this.overRatio=new C,this.spherical=new D,this.sphericalDelta=new D,this.panOffset=new x,this.panLeftV=new x,this.panUpV=new x,this.panV=new x,this.rotateStart=new C,this.rotateEnd=new C,this.rotateDelta=new C,this.panStart=new C,this.panEnd=new C,this.panDelta=new C,this.dollyStart=new C,this.dollyEnd=new C,this.dollyDelta=new C,this.rotationRangeFactor=new C,this.panRangeFactor=new C,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($,tt,Q),this.offset.copy($).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(K.copy(tt).invert()),this.panOffset.applyQuaternion(K),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(tt),this.panOffset.applyQuaternion(tt)),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),$.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(et.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(et));let t=this.spherical.phi%q;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(w.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),t>0&&t>Math.PI||t<0&&t>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),-1===this.state||!0===this.enableDamping){let t=1===this.hoverRotatePanMode?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-t,this.sphericalDelta.phi*=1-t}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8)return this.dispatchEvent(z),this.object.dispatchEvent(it),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(H),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?J.set(t.clientX-this.domElement.clientWidth/2,t.clientY-this.domElement.clientHeight/2):J.set(t.clientX-this.pointerLeaveEvent.clientX,t.clientY-this.pointerLeaveEvent.clientY),1===this.hoverRotatePanMode?(this.rotateDelta.copy(J).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(_,-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(J).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(N):!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?U:Z):this.dispatchEvent(X),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||k(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(k(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(k(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 j.ROTATE:if(!1===this.enableRotate)return void(this.state=-1);this.handleTouchStartRotate(),this.state=3;break;case j.PAN:if(!1===this.enablePan)return void(this.state=-1);this.handleTouchStartPan(),this.state=4;break;case j.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(),this.state=5;break;case j.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=f(()=>{this.zoomChanged?this.dispatchEvent(Y):this.dispatchEvent(Z),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(H),this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(N);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(N);if("gesturechange"===t.type){if(!1===this.enableZoom||!1===this.isTouchZoom)return;this.dispatchEvent(H),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(Z)}},this.onContextMenu=t=>{t.preventDefault()},this.onTouchEnd=t=>{t.preventDefault()},this.onKeyDown=t=>{!1!==this.enabled&&(this.key=t.key," "===t.key&&this.dispatchEvent(H))},this.onKeyUp=t=>{this.key=void 0,!1!==this.enabled&&(-1!==this.state&&"Alt"===t.key&&this.onPointerUp(e[0])," "===t.key&&this.dispatchEvent(Z))},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($,tt,Q),this.offset.copy($).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(K.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=ot(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=ot(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=ot(ot(this.spherical.theta)-t.rotationHorizontalOffset.min),this.maxTheta=ot(ot(this.spherical.theta)+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,1===t.orbitTouches&&(this.touches[0]=j.ROTATE),1===t.panTouches&&(this.touches[0]=j.PAN),2===t.orbitTouches&&(this.touches[1]=j.DOLLY_ROTATE),2===t.panTouches&&(this.touches[1]=j.DOLLY_PAN),3===t.orbitTouches&&(this.touches[2]=j.ROTATE),3===t.panTouches&&(this.touches[2]=j.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 x?(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(ot(this.spherical.theta),ot(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=ot(this.overShoot.x),this.overShoot.y=ot(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=at(Math.abs(this.overRatio.x)),this.overRatio.y=at(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 x?(t.x=h,t.y=l):(this.thetaIsFree||(t.theta=h),this.phiIsFree||(t.phi=l))}setEnableDampingSpeed(t){this.enableDamping=t,this.rotateSpeed=(!0===t?.2:1)*this.rotateFactor}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0,this.panOffset.set(0,0,0)}setTarget(t,e,i){this.stopDamping(),this.target.set(t,e,i)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,e){this.panLeftV.setFromMatrixColumn(e,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,e){this.panUpV.setFromMatrixColumn(e,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,e){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/i.clientHeight,this.object.matrixWorld),this.panUp(2*e*o/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(z)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(z)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(z)}setZoom(t){if(this.dispatchEvent(H),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(Z)}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(_,-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===k(t),i=!1===k(t)&&!0===(0===(r=t).wheelDeltaY||0===r.deltaY?!(s&&r.shiftKey&&Math.abs(r.wheelDeltaX)>=120)&&(r.wheelDeltaX?V(r.wheelDeltaX,r.deltaX):0===r.deltaMode):r.wheelDeltaY?V(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(Z)),!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(Z)},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 ot(t){let e=2*Math.PI;for(;t<=-Math.PI;)t+=e;for(;t>Math.PI;)t-=e;return t}function at(t){return 1-Math.pow(1-t,4)}var nt,rt,ht=new Promise(t=>{nt=t});function lt(t){return rt||(rt=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.10/build",i=import("./physics.js"),[s,o]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(t=>t.arrayBuffer())]);await s.init(o),nt(s)}())}function dt(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 ct(t,e){let i=new B;if(e&&dt(e))return i.setAttribute("position",new G([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new G([],3)),i.setIndex([]),i;let{positions:s,triIndices:o}=h(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new G(s,3)),i.setIndex(o),e&&i.applyMatrix4(e),i}var pt,mt=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()))}},ut=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()))}};ht.then(t=>pt=t);var yt=new x,vt=new M,gt=new x,ft=(new S(0,0,0,"YXZ"),new S(0,0,0,"XYZ")),bt=new x,Et=new x,Pt=new x(1,1,1),Ct=new M,Mt=new T,xt=new T,Tt={type:"updateMatrix"},Dt=new M,St=new L,wt=.01,Rt={type:"beginEvent",eventName:"Collision"},jt={type:"beginEvent",eventName:"Trigger"};function Gt(t){if(E.physicsEnabled(t.scene.objects))return!0;let e=!1;return t.scene.objects.traverse((t,i)=>{if(i.events)if(Array.isArray(i.events)){for(let t of i.events)if(!0!==t.data.disabled&&"GameControl"===t.data.type&&t.data.collisionEnabled){e=!0;break}}else for(let t of Object.values(i.events))if(!0!==t.disabled&&"GameControl"===t.type&&t.collisionEnabled){e=!0;break}}),e}var Lt=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);function Bt(t){return y(g(t)?t.object:t)}var At,Wt,Ot,It=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()!==pt.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,i,s]=this.rigidBodyToMesh.get(t.handle);if(yt.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),vt.copy(t.rotation()),e.matrixWorld.compose(yt,vt,i),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(Tt),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();let t=s.rigidBody;requestAnimationFrame(()=>{s.rigidBody===t&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(t),s.rigidBody=void 0)});break}}if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let t=this.sharedGameControlGlobals.colliderToEntity.get(e),i=this.sharedGameControlGlobals.entityToCollisionEvents[t.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,t,e)}else if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let e=this.sharedGameControlGlobals.colliderToEntity.get(t),i=this.sharedGameControlGlobals.entityToCollisionEvents[e.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,e,t)}else{let i=this.sharedGameControlGlobals.colliderToEntity.get(t),s=this.sharedGameControlGlobals.entityToCollisionEvents[i.uuid];if(void 0!==s)for(let e of s)"scene"===e.data.target&&this.dispatchCollisionEvent(e,i,t);let o=this.sharedGameControlGlobals.colliderToEntity.get(e),a=this.sharedGameControlGlobals.entityToCollisionEvents[o?.uuid];if(void 0!==a)for(let t of a)"scene"===t.data.target&&this.dispatchCollisionEvent(t,o,e)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events){if(!0===t.data.disabled)continue;let e=t.data.actions?.find(t=>"Destroy"===t.data.type)?.data;if(e)for(let t of e.objects){let e=this.page.scene.find(t);e&&(e.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events)if(!0!==t.data.disabled&&"DragDrop"===t.data.type)for(let e of t.data.objects){let t=this.page.scene.find(e);t&&(t.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return void 0===e&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(null===t())return void b("collision-bvh","trigger/collision detection");let e=[],i=[];if(this.page.traverseChildren(t=>{let s,o=t instanceof r,a=m(t);if(v(t)||o||a)return;s=g(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(Lt(n)||l||d||s.dataPatched.events.some(t=>!0!==t.data.disabled&&("GameControl"===t.data.type||"Follow"===t.data.type)))return t.updateMatrixWorldRigid(),this.addBoundsTree(t),!0;if(h){let s=h.getAttribute("position");if(void 0!==s&&s.count>0){e.push({geometry:h,matrixWorld:t.matrixWorld}),i.push(h.id,this._staticBVHIdOf(s),s.version,null!==h.index?this._staticBVHIdOf(h.index):-1,null!==h.index?h.index.version:-1);for(let e of t.matrixWorld.elements)i.push(e)}}return!!Bt(t)||void 0}),e.length>0){let s=this._staticBVHCache;if(void 0!==s&&s.signature.length===i.length&&s.signature.every((t,e)=>t===i[e]))return void(this.sharedGameControlGlobals.staticMeshBVH=s.bvh);let o=e.map(t=>ct(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(dt(t.matrixWorld))return;let s=[],o="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(void 0!==o?.getAttribute("position")&&s.push(ct(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=pt.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=pt.RigidBodyDesc.kinematicPositionBased(),r=!0):n=pt.RigidBodyDesc.fixed();let d=l(s);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(yt,vt,gt),t.position0=yt.clone().divideScalar(this.pixelsPerMeter),t.rotation0=vt.clone(),yt.divideScalar(this.pixelsPerMeter),n.setTranslation(yt.x,yt.y,yt.z).setRotation(vt),o?d?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):d?.scale(gt.x/this.pixelsPerMeter,gt.y/this.pixelsPerMeter,gt.z/this.pixelsPerMeter);let c=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n),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)}}if(0===c.numColliders())return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(c);h?this.rigidBodyToMesh.set(c.handle,[t,gt.clone(),a.physics.fusedBody]):r?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(c.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,c,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=c}}addBoundsTree(e){let i=[];if(void 0!==e.geometry?.getAttribute("position")&&e.geometry?.getAttribute("position").count>0&&i.push(ct(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,i)),e.children.forEach(t=>t.updateMatrixWorld(!0)),i.length>0){let s=l(i,!1);e.bvhGeometry=s,s.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(t())(s),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(t,e,i,s,o=!0){if(0===i?.getAttribute("position").count||0===i?.getIndex()?.count)return;let a;i&&(a="trimesh"===e.colliderType?pt.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):pt.ColliderDesc.convexMesh(i.getAttribute("position").array,o?i.getIndex().array:void 0)),a.setFrictionCombineRule(pt.CoefficientCombineRule.Average).setRestitutionCombineRule(pt.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(pt.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=Bt(t);return(s,o)=>{if(0===o)return;if(i&&s.parent===t)return!0;let a;if(v(s)){if(!s.objectForSample)return!0===s.object.dataPatched.physics.fusedBody&&"dynamic"===s.object.dataPatched.physics.rigidBody||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;a=s.object}else if(g(s))a=s.object;else if(a=s,a.dataPatched.cloner?.hideBase)return!0;let n=a.dataPatched;if("visibility"===n.physics.enabled?!n.visible:!n.physics.enabled)return!0;1===o?t.hasNonUniformScale?s.matrixWorld.multiplyMatrices(t.shearScale,s.hiddenMatrix):s.matrixWorld.copy(s.hiddenMatrix):s.matrixWorld.multiplyMatrices(s.parent.matrixWorld,s.hiddenMatrix),s.matrixWorld.multiply(s.matrix);let r=s.geometry;return void 0!==r?.getAttribute("position")&&e.push(ct(r,s.matrixWorld)),!!Bt(s)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(!1===e.data.disabled&&"Trigger"===e.data.type)return this.needsCollisionDetection=!0,!0});let s=I();if(null!==s?i=s.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:null!==this.page.data.publish.gameControlObject&&b("game-controls","the scene's game controls"),!1===i){let{enableRotate:t,enablePan:i,enableZoom:s,autoRotate:o,hoverRotatePanMode:a}=this.eventManager.publish.orbitControls;(t||i||s||o||0!==a)&&(this.orbitControls=new st(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();I()?.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 pt.World(new pt.Vector3(0,this.gravity,0)),this.events=new pt.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(i=>{let s;if(v(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(g(i))s=i.object;else{if(m(i)||u(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=Lt(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 mt(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=pt.RigidBodyDesc.kinematicPositionBased();(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(yt,vt,gt),i.position0=yt.clone().divideScalar(this.pixelsPerMeter),i.rotation0=vt.clone(),yt.divideScalar(this.pixelsPerMeter),t.setTranslation(yt.x,yt.y,yt.z).setRotation(vt);let e,n=this.sharedGameControlGlobals.rapierWorld.createRigidBody(t);i.rigidBody=n,e="sphere"===o.collider.type?pt.ColliderDesc.ball(o.collider.radius/this.pixelsPerMeter):"capsule"===o.collider.type?pt.ColliderDesc.capsule((o.collider.height/2-o.collider.radius)/this.pixelsPerMeter,o.collider.radius/this.pixelsPerMeter):pt.ColliderDesc.cuboid(o.collider.width/this.pixelsPerMeter/2,o.collider.height/this.pixelsPerMeter/2,o.collider.depth/this.pixelsPerMeter/2),e.setFrictionCombineRule(pt.CoefficientCombineRule.Average).setDensity(a.physics.density).setFriction(a.physics.friction).setRestitution(0).setRestitutionCombineRule(pt.CoefficientCombineRule.Min);let r=this.sharedGameControlGlobals.rapierWorld.createCollider(e,n);this.sharedGameControlGlobals.colliderToEntity.set(r.handle,s),yt.fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)).multiply(gt.setFromMatrixScale(s.matrixWorld)).divideScalar(this.pixelsPerMeter),r.setTranslationWrtParent(yt);let h=(new M).setFromEuler((new S).setFromVector3((new x).fromArray(o.collider.rotation.map(t=>"number"==typeof t?t:0))));r.setRotationWrtParent(h),r.setActiveEvents(pt.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(ct(p,i.matrixWorld)),a.physics.fusedBody&&!Bt(i)&&i.traverseObject((e,i)=>{if(0===i)return;let s;if(v(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)||u(e)||e instanceof r)return;if(g(e))s=e.object;else if(s=e,s.dataPatched.cloner?.hideBase)return!0}let o=s.dataPatched;if("visibility"===o.physics.enabled?!o.visible:!o.physics.enabled)return!0;let a=e.geometry;return void 0!==a?.getAttribute("position")&&t.push(ct(a,e.matrixWorld)),!!Bt(e)||void 0}),this.generateSensorColliderDescs(s,a.physics.fusedBody,e));return!(!0!==a.physics?.fusedBody&&!o&&!Bt(i))||void 0}),0===t.length)return;let i=l(t),s=i.getIndex().count>0;if(!s&&0===e.length)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let o=pt.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o);if(s){let t=pt.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(pt.CoefficientCombineRule.Multiply).setRestitutionCombineRule(pt.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(t,a)}for(let[t,i]of e){let e=this.sharedGameControlGlobals.rapierWorld.createCollider(t,a);this.sensorToTriggerEvent[e.handle]=i}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let i=new ut(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),s=(new T).compose(bt.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),Ct.setFromEuler(ft.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Pt);if("box"===e.data.triggerZone){let o=new R;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(yt,vt,gt);let e=t;void 0===e.prevQ?(e.prevQ=vt.clone(),e.prevT=yt.clone()):(e.prevQ.copy(vt),e.prevT.copy(yt))}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(pt.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<-wt)return;let p=a.linvel();if(o>wt&&c>wt){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(yt.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(vt);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(Rt)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let s=xt.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 ut(e.id,e.data,o,this.page,this.sharedAssets,this.eventManager);if(a="box"===e.data.triggerZone?pt.ColliderDesc.cuboid(...e.data.size.map(t=>("number"==typeof t?t:1)/(2*this.pixelsPerMeter))):pt.ColliderDesc.ball(e.data.radius/this.pixelsPerMeter),a.setDensity(0).setSensor(!0).setActiveEvents(pt.ActiveEvents.COLLISION_EVENTS),bt.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),Ct.setFromEuler(ft.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Mt.compose(bt,Ct,Pt).premultiply(o.matrixWorld),i?(Mt.decompose(bt,Ct,Et),a.setActiveCollisionTypes(pt.ActiveCollisionTypes.KINEMATIC_FIXED|pt.ActiveCollisionTypes.DYNAMIC_FIXED)):(Mt.premultiply(s).decompose(bt,Ct,Et),t.rigidBody.bodyType()===pt.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===pt.RigidBodyType.Fixed?a.setActiveCollisionTypes(pt.ActiveCollisionTypes.KINEMATIC_FIXED|pt.ActiveCollisionTypes.DYNAMIC_FIXED):a.setActiveCollisionTypes(pt.ActiveCollisionTypes.KINEMATIC_KINEMATIC|pt.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),bt.divideScalar(this.pixelsPerMeter),a.setTranslation(bt.x,bt.y,bt.z),a.setRotation(Ct),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=xt.copy(o.matrixWorld).decompose(bt,Dt,Et).compose(bt,Dt,Pt).multiply(s),h=Mt.copy(n.matrixWorld).invert().multiply(r),l=n.bvhGeometry.boundsTree;i instanceof R?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(jt)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(t=>t!==n)}}}},Ft=new Promise(t=>{At=t});function kt(t){return Ot||(Ot=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.10/build";typeof window<"u"&&(Wt=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[s,o]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(t=>t.arrayBuffer())]),a=s.default,n=await a({wasmBinary:o});At(n)}())}export{st as a,lt as b,A as c,O as d,F as e,ct as f,Rt as g,Gt as h,Lt as i,It as j,Ft as k,Wt as l,kt as m};
@@ -1 +1 @@
1
- import{a as e}from"./runtime-chunk-TU4KDRKR.js";import{W as o}from"./runtime-chunk-DK66VKWP.js";import{Dc as n,Fc as t,Jc as r}from"./runtime-chunk-VGN7YHB7.js";var i={enabled:!1},s=new WeakMap;function a(e){if(!i.enabled)return e;let o=s.get(e);return o||(o={...e,bloom:{...e.bloom,kernelSize:0},depthOfField:{...e.depthOfField,enabled:!1}},s.set(e,o)),o}var c=new WeakSet;function l(e){if(!e.isPointLight&&!e.isSpotLight&&!e.isDirectionalLight)return!1;if(i.enabled){if(!0===e.castShadow)return e.castShadow=!1,c.add(e),!0}else if(c.has(e)&&(c.delete(e),!1===e.castShadow))return e.castShadow=!0,!0;return!1}function u(i,s){switch(i.type){case"cavity":return function(e,o){return{...h(e,o),ridge:e.ridge,valley:e.valley}}(i,s);case"dust":return function(n,t){return{...h(n,t),color:e(n.color,t),coverage:o(n.coverage,t)??.2,softness:o(n.softness,t)??.2,noiseStrength:o(n.noiseStrength,t)??.2,noiseScale:o(n.noiseScale,t)??1}}(i,s);case"fresnel":return function(o,n){let{bias:t,scale:r,intensity:i,factor:s,color:a}=o;return{...h(o,n),color:e(a,n),bias:t,scale:r,intensity:i,factor:s}}(i,s);case"gradient":return function(e,o){let{gradientType:t,smooth:i,colors:s,steps:a,angle:c,offset:l,morph:u}=e;return{...h(e,o),gradientType:t,smooth:i,colors:s.map(e=>new r(e[0],e[1],e[2],e[3])),num:s.length,steps:a,offset:new n(...l.map(e=>"number"==typeof e?e:0)),morph:new n(...u.map(e=>"number"==typeof e?e:0)),angle:c}}(i,s);case"depth":return function(e,o){let{gradientType:n,near:i,far:s,isVector:a,isWorldSpace:c,origin:l,direction:u,colors:f,steps:p,smooth:m}=e;return{...h(e,o),gradientType:n,near:i,far:s,isVector:a,isWorldSpace:c,origin:new t(...l),direction:u?new t(...u):new t(1,0,0),colors:f.map(e=>void 0!==e?new r(e[0],e[1],e[2],e[3]):new r(0,0,0,0)),steps:p.slice(0,f.length),smooth:m}}(i,s);case"normal":return function(e,o){let{cnormal:n}=e;return{...h(e,o),cnormal:new t(n[0],n[1],n[2])}}(i,s);case"noise":return function(o,r){return{...h(o,r),scale:o.scale,move:o.move,fA:new n(...o.fA.map(e=>"number"==typeof e?e:0)),fB:new n(...o.fB.map(e=>"number"==typeof e?e:0)),size:new t(...o.size),distortion:new n(...o.distortion.map(e=>"number"==typeof e?e:0)),colorA:e(o.colorA,r),colorB:e(o.colorB,r),colorC:e(o.colorC,r),colorD:e(o.colorD,r),noiseType:o.noiseType,voronoiStyle:o.voronoiStyle,highCut:o.highCut,lowCut:o.lowCut,smoothness:o.smoothness,seed:o.seed,quality:o.quality}}(i,s);case"rainbow":return function(e,o){return{...h(e,o),filmThickness:e.filmThickness,movement:e.movement,wavelengths:new t(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new t(...e.offset)}}(i,s);case"toon":return function(o,n){return{...h(o,n),positioning:o.positioning,colors:o.colors.map(e=>new r(e[0],e[1],e[2],e[3])),num:o.colors.length,steps:o.steps,source:new t(...o.source),isWorldSpace:o.isWorldSpace,noiseStrength:o.noiseStrength,noiseScale:o.noiseScale,shadowColor:e(o.shadowColor,n),offset:new t(...o.offset)}}(i,s);case"outline":return function(o,n){return{...h(o,n),outlineColor:e(o.outlineColor,n),contourColor:e(o.contourColor,n),outlineWidth:o.outlineWidth,contourWidth:o.contourWidth,outlineThreshold:o.outlineThreshold,contourThreshold:o.contourThreshold,outlineSmoothing:o.outlineSmoothing,contourFrequency:o.contourFrequency,contourDirection:new t(...o.contourDirection),positionalLines:o.positionalLines,compensation:o.compensation}}(i,s);case"transmission":return function(o,n){return{...h(o,n),thickness:o.thickness,ior:o.ior,roughness:o.roughness,attenuationColor:void 0!==o.attenuationColor?e(o.attenuationColor,n):{r:1,g:1,b:1,a:1},attenuationDistance:o.attenuationDistance??0}}(i,s);case"reflection":return function(e,n){return{...h(e,n),blur:o(e.blur,n)??0,thickness:o(e.thickness,n)??.001,steps:o(e.steps,n)??60,stepSize:o(e.stepSize,n)??.005,tracingMode:e.tracingMode,mirror:e.mirror??0}}(i,s);case"pattern":return function(o,t){return{...h(o,t),style:o.style,projection:o.projection,axis:o.axis,blending:o.blending,offset:new n(...o.offset.map(e=>"number"==typeof e?e:0)),colorA:e(o.colorA,t),colorB:e(o.colorB,t),frequency:new n(...o.frequency.map(e=>"number"==typeof e?e:0)),size:o.size,variation:o.variation,smoothness:o.smoothness,zigzag:o.zigzag,rotation:o.rotation,vertical:new n(...o.vertical.map(e=>"number"==typeof e?e:0)),horizontal:new n(...o.horizontal.map(e=>"number"==typeof e?e:0)),sides:o.sides}}(i,s);case"vertexColor":return h(i,s);default:return function(o,n){return{...h(o,n),color:e(o.color,n)}}(i,s)}}function f(e){return{type:e.type}}function h(e,o){let{alpha:n,mode:t,isMask:r}=e,i="string"==typeof n?Number(o.getVariable(n)??100)/100:n;return{...f(e),alpha:i,mode:t,isMask:r}}export{i as a,a as b,l as c,u as d};
1
+ import{a as e}from"./runtime-chunk-TU4KDRKR.js";import{W as o}from"./runtime-chunk-7FDJ7IIR.js";import{Dc as n,Fc as t,Jc as r}from"./runtime-chunk-VGN7YHB7.js";var i={enabled:!1},s=new WeakMap;function a(e){if(!i.enabled)return e;let o=s.get(e);return o||(o={...e,bloom:{...e.bloom,kernelSize:0},depthOfField:{...e.depthOfField,enabled:!1}},s.set(e,o)),o}var c=new WeakSet;function l(e){if(!e.isPointLight&&!e.isSpotLight&&!e.isDirectionalLight)return!1;if(i.enabled){if(!0===e.castShadow)return e.castShadow=!1,c.add(e),!0}else if(c.has(e)&&(c.delete(e),!1===e.castShadow))return e.castShadow=!0,!0;return!1}function u(i,s){switch(i.type){case"cavity":return function(e,o){return{...h(e,o),ridge:e.ridge,valley:e.valley}}(i,s);case"dust":return function(n,t){return{...h(n,t),color:e(n.color,t),coverage:o(n.coverage,t)??.2,softness:o(n.softness,t)??.2,noiseStrength:o(n.noiseStrength,t)??.2,noiseScale:o(n.noiseScale,t)??1}}(i,s);case"fresnel":return function(o,n){let{bias:t,scale:r,intensity:i,factor:s,color:a}=o;return{...h(o,n),color:e(a,n),bias:t,scale:r,intensity:i,factor:s}}(i,s);case"gradient":return function(e,o){let{gradientType:t,smooth:i,colors:s,steps:a,angle:c,offset:l,morph:u}=e;return{...h(e,o),gradientType:t,smooth:i,colors:s.map(e=>new r(e[0],e[1],e[2],e[3])),num:s.length,steps:a,offset:new n(...l.map(e=>"number"==typeof e?e:0)),morph:new n(...u.map(e=>"number"==typeof e?e:0)),angle:c}}(i,s);case"depth":return function(e,o){let{gradientType:n,near:i,far:s,isVector:a,isWorldSpace:c,origin:l,direction:u,colors:f,steps:p,smooth:m}=e;return{...h(e,o),gradientType:n,near:i,far:s,isVector:a,isWorldSpace:c,origin:new t(...l),direction:u?new t(...u):new t(1,0,0),colors:f.map(e=>void 0!==e?new r(e[0],e[1],e[2],e[3]):new r(0,0,0,0)),steps:p.slice(0,f.length),smooth:m}}(i,s);case"normal":return function(e,o){let{cnormal:n}=e;return{...h(e,o),cnormal:new t(n[0],n[1],n[2])}}(i,s);case"noise":return function(o,r){return{...h(o,r),scale:o.scale,move:o.move,fA:new n(...o.fA.map(e=>"number"==typeof e?e:0)),fB:new n(...o.fB.map(e=>"number"==typeof e?e:0)),size:new t(...o.size),distortion:new n(...o.distortion.map(e=>"number"==typeof e?e:0)),colorA:e(o.colorA,r),colorB:e(o.colorB,r),colorC:e(o.colorC,r),colorD:e(o.colorD,r),noiseType:o.noiseType,voronoiStyle:o.voronoiStyle,highCut:o.highCut,lowCut:o.lowCut,smoothness:o.smoothness,seed:o.seed,quality:o.quality}}(i,s);case"rainbow":return function(e,o){return{...h(e,o),filmThickness:e.filmThickness,movement:e.movement,wavelengths:new t(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new t(...e.offset)}}(i,s);case"toon":return function(o,n){return{...h(o,n),positioning:o.positioning,colors:o.colors.map(e=>new r(e[0],e[1],e[2],e[3])),num:o.colors.length,steps:o.steps,source:new t(...o.source),isWorldSpace:o.isWorldSpace,noiseStrength:o.noiseStrength,noiseScale:o.noiseScale,shadowColor:e(o.shadowColor,n),offset:new t(...o.offset)}}(i,s);case"outline":return function(o,n){return{...h(o,n),outlineColor:e(o.outlineColor,n),contourColor:e(o.contourColor,n),outlineWidth:o.outlineWidth,contourWidth:o.contourWidth,outlineThreshold:o.outlineThreshold,contourThreshold:o.contourThreshold,outlineSmoothing:o.outlineSmoothing,contourFrequency:o.contourFrequency,contourDirection:new t(...o.contourDirection),positionalLines:o.positionalLines,compensation:o.compensation}}(i,s);case"transmission":return function(o,n){return{...h(o,n),thickness:o.thickness,ior:o.ior,roughness:o.roughness,attenuationColor:void 0!==o.attenuationColor?e(o.attenuationColor,n):{r:1,g:1,b:1,a:1},attenuationDistance:o.attenuationDistance??0}}(i,s);case"reflection":return function(e,n){return{...h(e,n),blur:o(e.blur,n)??0,thickness:o(e.thickness,n)??.001,steps:o(e.steps,n)??60,stepSize:o(e.stepSize,n)??.005,tracingMode:e.tracingMode,mirror:e.mirror??0}}(i,s);case"pattern":return function(o,t){return{...h(o,t),style:o.style,projection:o.projection,axis:o.axis,blending:o.blending,offset:new n(...o.offset.map(e=>"number"==typeof e?e:0)),colorA:e(o.colorA,t),colorB:e(o.colorB,t),frequency:new n(...o.frequency.map(e=>"number"==typeof e?e:0)),size:o.size,variation:o.variation,smoothness:o.smoothness,zigzag:o.zigzag,rotation:o.rotation,vertical:new n(...o.vertical.map(e=>"number"==typeof e?e:0)),horizontal:new n(...o.horizontal.map(e=>"number"==typeof e?e:0)),sides:o.sides}}(i,s);case"vertexColor":return h(i,s);default:return function(o,n){return{...h(o,n),color:e(o.color,n)}}(i,s)}}function f(e){return{type:e.type}}function h(e,o){let{alpha:n,mode:t,isMask:r}=e,i="string"==typeof n?Number(o.getVariable(n)??100)/100:n;return{...f(e),alpha:i,mode:t,isMask:r}}export{i as a,a as b,l as c,u as d};
@@ -0,0 +1 @@
1
+ import{a as t}from"./runtime-chunk-NTUTXO7Q.js";import{b as e}from"./runtime-chunk-MOZWC42D.js";import{b as i,c as r,d as s,e as n}from"./runtime-chunk-U4QOT2PX.js";import{E as a,b as h,k as o,o as l}from"./runtime-chunk-VPEJ5BFD.js";import{a as d,b as u}from"./runtime-chunk-ML3Z74BL.js";var c,p,f,x=d((t,e)=>{function i(t,e,r,s){this.message=t,this.expected=e,this.found=r,this.location=s,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,i)}!function(t,e){function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i}(i,Error),i.buildMessage=function(t,e){var i,r={literal:function(t){return'"'+n(t.text)+'"'},class:function(t){var e,i="";for(e=0;e<t.parts.length;e++)i+=t.parts[e]instanceof Array?a(t.parts[e][0])+"-"+a(t.parts[e][1]):a(t.parts[e]);return"["+(t.inverted?"^":"")+i+"]"},any:function(t){return"any character"},end:function(t){return"end of input"},other:function(t){return t.description}};function s(t){return t.charCodeAt(0).toString(16).toUpperCase()}function n(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+s(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+s(t)})}function a(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+s(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+s(t)})}function h(t){return r[t.type](t)}return"Expected "+function(t){var e,i,r=new Array(t.length);for(e=0;e<t.length;e++)r[e]=h(t[e]);if(r.sort(),r.length>0){for(e=1,i=1;e<r.length;e++)r[e-1]!==r[e]&&(r[i]=r[e],i++);r.length=i}switch(r.length){case 1:return r[0];case 2:return r[0]+" or "+r[1];default:return r.slice(0,-1).join(", ")+", or "+r[r.length-1]}}(t)+" but "+((i=e)?'"'+n(i)+'"':"end of input")+" found."},e.exports={SyntaxError:i,parse:function(t,e){e=void 0!==e?e:{};var r,s={},n={svg_path:xt},a=xt,h=function(t){if(!t)return[];for(var e=[],i=0;i<t.length;i++)e=e.concat.apply(e,t[i]);var r=e[0];return r&&"m"==r.code&&(delete r.relative,r.code="M"),e},o=function(t,e){return function(t,e){if(!e)return[t];for(var i=[t],r=0,s=e.length;r<s;r++)i[r+1]=e[r][1];return i}(t,e)},l=/^[Mm]/,d=ut(["M","m"],!1,!1),u=function(t,e,i){var r=jt(t,[e]);return i&&(r=r.concat(jt("M"==t?"L":"l",i[1]))),r},c=/^[Zz]/,p=ut(["Z","z"],!1,!1),f=function(){return jt("Z")},x=/^[Ll]/,g=ut(["L","l"],!1,!1),m=function(t,e){return jt(t,e)},y=/^[Hh]/,v=ut(["H","h"],!1,!1),w=function(t,e){return jt(t,e.map(function(t){return{x:t}}))},_=/^[Vv]/,S=ut(["V","v"],!1,!1),B=function(t,e){return jt(t,e.map(function(t){return{y:t}}))},b=/^[Cc]/,M=ut(["C","c"],!1,!1),C=function(t,e,i){return{x1:t.x,y1:t.y,x2:e.x,y2:e.y,x:i.x,y:i.y}},k=/^[Ss]/,A=ut(["S","s"],!1,!1),T=function(t,e){return{x2:t.x,y2:t.y,x:e.x,y:e.y}},P=/^[Qq]/,z=ut(["Q","q"],!1,!1),R=function(t,e){return{x1:t.x,y1:t.y,x:e.x,y:e.y}},O=/^[Tt]/,E=ut(["T","t"],!1,!1),H=/^[Aa]/,L=ut(["A","a"],!1,!1),F=function(t,e,i,r,s,n){return{rx:t,ry:e,xAxisRotation:i,largeArc:r,sweep:s,x:n.x,y:n.y}},U=function(t,e){return{x:t,y:e}},N=function(t){return 1*t},j=function(t){return 1*t.join("")},I=/^[01]/,D=ut(["0","1"],!1,!1),W=function(t){return"1"==t},X=function(){return""},V=",",q=dt(",",!1),Y=function(t){return t.join("")},$=".",G=dt(".",!1),Q=/^[eE]/,Z=ut(["e","E"],!1,!1),J=/^[+\-]/,K=ut(["+","-"],!1,!1),tt=/^[0-9]/,et=ut([["0","9"]],!1,!1),it=function(t){return t.join("")},rt=/^[ \t\n\r]/,st=ut([" ","\t","\n","\r"],!1,!1),nt=0,at=[{line:1,column:1}],ht=0,ot=[],lt=0;if("startRule"in e){if(!(e.startRule in n))throw new Error("Can't start parsing from rule \""+e.startRule+'".');a=n[e.startRule]}function dt(t,e){return{type:"literal",text:t,ignoreCase:e}}function ut(t,e,i){return{type:"class",parts:t,inverted:e,ignoreCase:i}}function ct(e){var i,r=at[e];if(r)return r;for(i=e-1;!at[i];)i--;for(r={line:(r=at[i]).line,column:r.column};i<e;)10===t.charCodeAt(i)?(r.line++,r.column=1):r.column++,i++;return at[e]=r,r}function pt(t,e){var i=ct(t),r=ct(e);return{start:{offset:t,line:i.line,column:i.column},end:{offset:e,line:r.line,column:r.column}}}function ft(t){nt<ht||(nt>ht&&(ht=nt,ot=[]),ot.push(t))}function xt(){var t,e,i,r,n;for(t=nt,e=[],i=Et();i!==s;)e.push(i),i=Et();if(e!==s)if(i=function(){var t,e,i,r,n,a;if(t=nt,(e=gt())!==s){for(i=[],r=nt,n=[],a=Et();a!==s;)n.push(a),a=Et();for(n!==s&&(a=gt())!==s?r=n=[n,a]:(nt=r,r=s);r!==s;){for(i.push(r),r=nt,n=[],a=Et();a!==s;)n.push(a),a=Et();n!==s&&(a=gt())!==s?r=n=[n,a]:(nt=r,r=s)}i!==s?t=e=o(e,i):(nt=t,t=s)}else nt=t,t=s;return t}(),i===s&&(i=null),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s?t=e=h(i):(nt=t,t=s)}else nt=t,t=s;else nt=t,t=s;return t}function gt(){var e,i,r,n,a,h;if(e=nt,i=function(){var e,i,r,n,a,h,o;if(e=nt,l.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(d)),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s&&(n=bt())!==s?(a=nt,(h=At())===s&&(h=null),h!==s&&(o=yt())!==s?a=h=[h,o]:(nt=a,a=s),a===s&&(a=null),a!==s?e=i=u(i,n,a):(nt=e,e=s)):(nt=e,e=s)}else nt=e,e=s;return e}(),i!==s){for(r=[],n=nt,a=[],h=Et();h!==s;)a.push(h),h=Et();for(a!==s&&(h=mt())!==s?n=a=[a,h]:(nt=n,n=s);n!==s;){for(r.push(n),n=nt,a=[],h=Et();h!==s;)a.push(h),h=Et();a!==s&&(h=mt())!==s?n=a=[a,h]:(nt=n,n=s)}r!==s?e=i=o(i,r):(nt=e,e=s)}else nt=e,e=s;return e}function mt(){var e,i;return c.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(p)),i!==s&&(i=f()),(e=i)===s&&(e=function(){var e,i,r,n;if(e=nt,x.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(g)),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s&&(n=yt())!==s?e=i=m(i,n):(nt=e,e=s)}else nt=e,e=s;return e}())===s&&(e=function(){var e,i,r,n;if(e=nt,y.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(v)),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s&&(n=vt())!==s?e=i=w(i,n):(nt=e,e=s)}else nt=e,e=s;return e}())===s&&(e=function(){var e,i,r,n;if(e=nt,_.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(S)),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s&&(n=vt())!==s?e=i=B(i,n):(nt=e,e=s)}else nt=e,e=s;return e}())===s&&(e=function(){var e,i,r,n;if(e=nt,b.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(M)),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s?(n=function(){var t,e,i,r,n,a;if(t=nt,(e=wt())!==s){for(i=[],r=nt,(n=At())===s&&(n=null),n!==s&&(a=wt())!==s?r=n=[n,a]:(nt=r,r=s);r!==s;)i.push(r),r=nt,(n=At())===s&&(n=null),n!==s&&(a=wt())!==s?r=n=[n,a]:(nt=r,r=s);i!==s?t=e=o(e,i):(nt=t,t=s)}else nt=t,t=s;return t}(),n!==s?e=i=m(i,n):(nt=e,e=s)):(nt=e,e=s)}else nt=e,e=s;return e}())===s&&(e=function(){var e,i,r,n;if(e=nt,k.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(A)),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s?(n=function(){var t,e,i,r,n,a;if(t=nt,(e=_t())!==s){for(i=[],r=nt,(n=At())===s&&(n=null),n!==s&&(a=_t())!==s?r=n=[n,a]:(nt=r,r=s);r!==s;)i.push(r),r=nt,(n=At())===s&&(n=null),n!==s&&(a=_t())!==s?r=n=[n,a]:(nt=r,r=s);i!==s?t=e=o(e,i):(nt=t,t=s)}else nt=t,t=s;return t}(),n!==s?e=i=m(i,n):(nt=e,e=s)):(nt=e,e=s)}else nt=e,e=s;return e}())===s&&(e=function(){var e,i,r,n;if(e=nt,P.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(z)),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s?(n=function(){var t,e,i,r,n,a;if(t=nt,(e=St())!==s){for(i=[],r=nt,(n=At())===s&&(n=null),n!==s&&(a=St())!==s?r=n=[n,a]:(nt=r,r=s);r!==s;)i.push(r),r=nt,(n=At())===s&&(n=null),n!==s&&(a=St())!==s?r=n=[n,a]:(nt=r,r=s);i!==s?t=e=o(e,i):(nt=t,t=s)}else nt=t,t=s;return t}(),n!==s?e=i=m(i,n):(nt=e,e=s)):(nt=e,e=s)}else nt=e,e=s;return e}())===s&&(e=function(){var e,i,r,n;if(e=nt,O.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(E)),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s?(n=function(){var t,e,i,r,n,a;if(t=nt,(e=bt())!==s){for(i=[],r=nt,(n=At())===s&&(n=null),n!==s&&(a=bt())!==s?r=n=[n,a]:(nt=r,r=s);r!==s;)i.push(r),r=nt,(n=At())===s&&(n=null),n!==s&&(a=bt())!==s?r=n=[n,a]:(nt=r,r=s);i!==s?t=e=o(e,i):(nt=t,t=s)}else nt=t,t=s;return t}(),n!==s?e=i=m(i,n):(nt=e,e=s)):(nt=e,e=s)}else nt=e,e=s;return e}())===s&&(e=function(){var e,i,r,n;if(e=nt,H.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(L)),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s?(n=function(){var t,e,i,r,n,a;if(t=nt,(e=Bt())!==s){for(i=[],r=nt,(n=At())===s&&(n=null),n!==s&&(a=Bt())!==s?r=n=[n,a]:(nt=r,r=s);r!==s;)i.push(r),r=nt,(n=At())===s&&(n=null),n!==s&&(a=Bt())!==s?r=n=[n,a]:(nt=r,r=s);i!==s?t=e=o(e,i):(nt=t,t=s)}else nt=t,t=s;return t}(),n!==s?e=i=m(i,n):(nt=e,e=s)):(nt=e,e=s)}else nt=e,e=s;return e}()),e}function yt(){var t,e,i,r,n,a;if(t=nt,(e=bt())!==s){for(i=[],r=nt,(n=At())===s&&(n=null),n!==s&&(a=bt())!==s?r=n=[n,a]:(nt=r,r=s);r!==s;)i.push(r),r=nt,(n=At())===s&&(n=null),n!==s&&(a=bt())!==s?r=n=[n,a]:(nt=r,r=s);i!==s?t=e=o(e,i):(nt=t,t=s)}else nt=t,t=s;return t}function vt(){var t,e,i,r,n,a;if(t=nt,(e=Ct())!==s){for(i=[],r=nt,(n=At())===s&&(n=null),n!==s&&(a=Ct())!==s?r=n=[n,a]:(nt=r,r=s);r!==s;)i.push(r),r=nt,(n=At())===s&&(n=null),n!==s&&(a=Ct())!==s?r=n=[n,a]:(nt=r,r=s);i!==s?t=e=o(e,i):(nt=t,t=s)}else nt=t,t=s;return t}function wt(){var t,e,i,r,n,a;return t=nt,(e=bt())!==s?((i=At())===s&&(i=null),i!==s&&(r=bt())!==s?((n=At())===s&&(n=null),n!==s&&(a=bt())!==s?t=e=C(e,r,a):(nt=t,t=s)):(nt=t,t=s)):(nt=t,t=s),t}function _t(){var t,e,i,r;return t=nt,(e=bt())!==s?((i=At())===s&&(i=null),i!==s&&(r=bt())!==s?t=e=T(e,r):(nt=t,t=s)):(nt=t,t=s),t}function St(){var t,e,i,r;return t=nt,(e=bt())!==s?((i=At())===s&&(i=null),i!==s&&(r=bt())!==s?t=e=R(e,r):(nt=t,t=s)):(nt=t,t=s),t}function Bt(){var t,e,i,r,n,a,h,o,l,d,u;return t=nt,(e=Mt())!==s?((i=At())===s&&(i=null),i!==s&&(r=Mt())!==s?((n=At())===s&&(n=null),n!==s&&(a=Ct())!==s&&At()!==s&&(h=kt())!==s?((o=At())===s&&(o=null),o!==s&&(l=kt())!==s?((d=At())===s&&(d=null),d!==s&&(u=bt())!==s?t=e=F(e,r,a,h,l,u):(nt=t,t=s)):(nt=t,t=s)):(nt=t,t=s)):(nt=t,t=s)):(nt=t,t=s),t}function bt(){var t,e,i,r;return t=nt,(e=Ct())!==s?((i=At())===s&&(i=null),i!==s&&(r=Ct())!==s?t=e=U(e,r):(nt=t,t=s)):(nt=t,t=s),t}function Mt(){var t;return(t=Pt())===s&&(t=Ot()),t!==s&&(t=N(t)),t}function Ct(){var t,e,i;return t=nt,(e=Rt())===s&&(e=null),e!==s&&(i=Pt())!==s?t=e=[e,i]:(nt=t,t=s),t===s&&(t=nt,(e=Rt())===s&&(e=null),e!==s&&(i=Ot())!==s?t=e=[e,i]:(nt=t,t=s)),t!==s&&(t=j(t)),t}function kt(){var e;return I.test(t.charAt(nt))?(e=t.charAt(nt),nt++):(e=s,0===lt&&ft(D)),e!==s&&(e=W(e)),e}function At(){var t,e,i,r,n;if(t=nt,e=[],(i=Et())!==s)for(;i!==s;)e.push(i),i=Et();else e=s;if(e!==s)if((i=Tt())===s&&(i=null),i!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s?t=e=[e,i,r]:(nt=t,t=s)}else nt=t,t=s;else nt=t,t=s;if(t===s){if(t=nt,e=nt,(i=Tt())!==s){for(r=[],n=Et();n!==s;)r.push(n),n=Et();r!==s?e=i=[i,r]:(nt=e,e=s)}else nt=e,e=s;e!==s&&(e=X()),t=e}return t}function Tt(){var e;return 44===t.charCodeAt(nt)?(e=V,nt++):(e=s,0===lt&&ft(q)),e}function Pt(){var e,i,r;return e=nt,i=function(){var e,i,r,n;return e=nt,(i=Ot())===s&&(i=null),i!==s?(46===t.charCodeAt(nt)?(r=$,nt++):(r=s,0===lt&&ft(G)),r!==s&&(n=Ot())!==s?e=i=[i,r,n]:(nt=e,e=s)):(nt=e,e=s),e===s&&(e=nt,(i=Ot())!==s?(46===t.charCodeAt(nt)?(r=$,nt++):(r=s,0===lt&&ft(G)),r!==s?e=i=[i,r]:(nt=e,e=s)):(nt=e,e=s)),e!==s&&(e=Y(e)),e}(),i!==s?((r=zt())===s&&(r=null),r!==s?e=i=[i,r]:(nt=e,e=s)):(nt=e,e=s),e===s&&(e=nt,(i=Ot())!==s&&(r=zt())!==s?e=i=[i,r]:(nt=e,e=s)),e!==s&&(e=Y(e)),e}function zt(){var e,i,r,n;return e=nt,Q.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(Z)),i!==s?((r=Rt())===s&&(r=null),r!==s&&(n=Ot())!==s?e=i=[i,r,n]:(nt=e,e=s)):(nt=e,e=s),e!==s&&(e=Y(e)),e}function Rt(){var e;return J.test(t.charAt(nt))?(e=t.charAt(nt),nt++):(e=s,0===lt&&ft(K)),e}function Ot(){var e,i;if(e=[],tt.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(et)),i!==s)for(;i!==s;)e.push(i),tt.test(t.charAt(nt))?(i=t.charAt(nt),nt++):(i=s,0===lt&&ft(et));else e=s;return e!==s&&(e=it(e)),e}function Et(){var e;return rt.test(t.charAt(nt))?(e=t.charAt(nt),nt++):(e=s,0===lt&&ft(st)),e!==s&&(e=X()),e}var Ht,Lt,Ft,Ut={m:"moveto",l:"lineto",h:"horizontal lineto",v:"vertical lineto",c:"curveto",s:"smooth curveto",q:"quadratic curveto",t:"smooth quadratic curveto",a:"elliptical arc",z:"closepath"};for(var Nt in Ut)Ut[Nt.toUpperCase()]=Ut[Nt];function jt(t,e){e||(e=[{}]);for(var i=e.length;i--;){var r={code:t,command:Ut[t]};for(var s in t==t.toLowerCase()&&(r.relative=!0),e[i])r[s]=e[i][s];e[i]=r}return e}if((r=a())!==s&&nt===t.length)return r;throw r!==s&&nt<t.length&&ft({type:"end"}),Ht=ot,Lt=ht<t.length?t.charAt(ht):null,Ft=ht<t.length?pt(ht,ht+1):pt(ht,ht),new i(i.buildMessage(Ht,Lt),Ht,Lt,Ft)}}}),g=d((t,e)=>{var i=x().parse;i.parseSVG=i,i.makeAbsolute=function(t){var e,i={x:0,y:0},r={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return t.forEach(function(t){for(var s in"moveto"===t.command&&(e=t),t.x0=i.x,t.y0=i.y,r)s in t&&(t[s]+=t.relative?t[r[s]]:0);"x"in t||(t.x=i.x),"y"in t||(t.y=i.y),t.relative=!1,t.code=t.code.toUpperCase(),"closepath"==t.command&&(t.x=e.x,t.y=e.y),i=t}),t},e.exports=i});function m(){if(!p){if(!c)return Promise.reject(new Error("HanaRenderer: no Hana UI loader registered. Call setHanaUILoader() from the host app before initializing a HanaRenderer."));(p=c()).catch(()=>{p=void 0})}return p}function y(t){f=t}function v(){return c||(c=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let e=Object.create(t.SceneController.prototype);return e.__wbg_ptr=this.__wbg_ptr,e}}),{createEngine:e=>t.Engine.create(e,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await import("./hana-ui.js"),f??function(){let t=typeof process<"u"?"2.0.10":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),m().then(()=>{})}var w=Math.PI/180;Math.PI;var _,S=1e-10;function B(t,e){let[[i,r],[s,n]]=t,[[a,h],[o,l]]=e,d=(i-s)*(h-l)-(r-n)*(a-o);if(0===d)return!1;let u=((i-a)*(h-l)-(r-h)*(a-o))/d,c=-((i-s)*(r-h)-(r-n)*(i-a))/d;return u>=0&&u<=1&&c>=0&&c<=1}(t=>{function e(t){return[t[0],t[3],t[1],t[4],t[2],t[5]]}t.identity=function(){return[1,0,0,0,1,0,0,0,1]},t.copy=function(e,i=t.identity()){for(let t=0,r=e.length;t<r;t++)i[t]=e[t];return i},t.create=function(e,i,r,s,n,a){return t.setAbcdef(t.identity(),e,i,r,s,n,a)},t.setAbcdef=function(t,e,i,r,s,n,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=s,t[5]=a,t},t.append=function(i,r){let[s,n,a,h,o,l]=e(i),[d,u,c,p,f,x]=e(r),g=d*s+u*a,m=d*n+u*h,y=c*s+p*a,v=c*n+p*h,w=f*s+x*a+o,_=f*n+x*h+l;return t.create(g,m,y,v,w,_)},t.prepend=function(i,r){let[s,n,a,h,o,l]=e(i),[d,u,c,p,f,x]=e(r),g=s,m=n,y=a,v=h;(1!==d||0!==u||0!==c||1!==p)&&(g=s*d+n*c,m=s*u+n*p,y=a*d+h*c,v=a*u+h*p);let w=o*d+l*c+f,_=o*u+l*p+x;return t.create(g,m,y,v,w,_)},t.getAbcdef=e,t.invert=function(e){let[i,r,s,n,a,h]=t.getAbcdef(e),o=i*n-r*s,l=n/o,d=-r/o,u=-s/o,c=i/o,p=(s*h-n*a)/o,f=-(i*h-r*a)/o;return t.create(l,d,u,c,p,f)},t.apply=function([e,i],r){let[s,n,a,h,o,l]=t.getAbcdef(r);return[s*e+a*i+o,n*e+h*i+l]},t.applyInverse=function(e,i){let[r,s,n,a,h,o]=t.getAbcdef(i),l=1/(r*a+n*-s),[d,u]=e;return[a*l*d+-n*l*u+(o*n-h*a)*l,r*l*u+-s*l*d+(-o*r+h*s)*l]},t.scale=function(e,i,r=i){let[s,n,a,h,o,l]=t.getAbcdef(e);return t.setAbcdef(e,s*i,n*r,a*i,h*r,o*i,l*r),e},t.rotate=function(e,i){let r=Math.cos(i),s=Math.sin(i),[n,a,h,o,l,d]=t.getAbcdef(e);return t.setAbcdef(e,n*r-a*s,n*s+a*r,h*r-o*s,h*s+o*r,l*r-d*s,l*s+d*r),e},t.rotateAround=function(e,i,r){let[s,n]=r,a=t.translate(e,-s,-n);return a=t.rotate(a,i),a=t.translate(a,s,n),a},t.translate=function(e,i,r){let[s,n,a,h,o,l]=t.getAbcdef(e);return t.setAbcdef(e,s,n,a,h,o+i,l+r),e},t.setTranslate=function(e,i,r){let[s,n,a,h]=t.getAbcdef(e);return t.setAbcdef(e,s,n,a,h,i,r),e},t.setPosition=function(e,i,r){let[s,n,a,h]=t.getAbcdef(e);return t.setAbcdef(e,s,n,a,h,i,r),e},t.getScale=function(e){let[i,r,s,n]=t.getAbcdef(e);return[Math.sqrt(i*i+r*r),Math.sqrt(s*s+n*n)]},t.getPosition=function(e){let[,,,,i,r]=t.getAbcdef(e);return[i,r]},t.getRotation=function(e,i){return t.decompose(e,i).rotation},t.decompose=function(e,i){let[r,s,n,a,h,o]=t.getAbcdef(e),{rotation:l,scale:d,shear:u}=function(t){let e=t[0][0],i=t[1][0],r=t[0][1],s=t[1][1],n=Math.sqrt(e*e+i*i),a=n>S?e/n:1,h=n>S?i/n:0,o=a*e+h*i,l=a*s-h*r,d=a*r+h*s;return{rotation:Math.atan2(h,a),scale:[o,l],shear:[Math.abs(l)>S?d/l:0,0]}}([[r,n],[s,a]]);return{position:[h+(i[0]*r+i[1]*n)-i[0],o+(i[0]*s+i[1]*a)-i[1]],scale:d,rotation:l,shear:u,pivot:i}},t.compose=function(e,i,r,s,n=[0,0]){let[a,h]=e,[o,l]=s,[d,u,c,p]=function({rotation:t,scale:e,shear:i}){let r=Math.cos(t),s=Math.sin(t),n=i[0]*e[1],a=i[1]*e[0];return[r*e[0]-s*a,s*e[0]+r*a,r*n-s*e[1],s*n+r*e[1]]}({rotation:r,scale:i,shear:n}),f=a-(o*d+l*c)+o,x=h-(o*u+l*p)+l;return t.create(d,u,c,p,f,x)}})(_||(_={}));var b,M,C,k,A,T=[[-1,1],[-1,-1],[1,-1],[1,1]],P=(t,e,i)=>{let r=t.getCenter(),s=t.getHalfSize(),n=_.append(e,t.worldMatrix);0===s[0]&&0===s[1]?i.push(_.apply(r,n)):T.forEach(t=>{let e=[t[0]*s[0]+r[0],t[1]*s[1]+r[1]];i.push(_.apply(e,n))})},z=class{constructor(){this.matrix=_.identity(),this.min=[1/0,1/0],this.max=[-1/0,-1/0],this.vertices=[],this.edges=[]}setFromObjectSize(t,e=!1){t.updateWorldMatrix(),this.makeEmpty(),_.copy(t.worldMatrix,this.matrix);let i=_.invert(t.worldMatrix);this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let r=[],s=!0===t.isBaseGroup?t:void 0;!0===i&&void 0!==s?s.traverse(t=>{t.visible&&P(t,e,r)}):P(t,e,r),this.setFromPoints(r)}setFromSize(t,e,i){this.makeEmpty(),_.copy(i,this.matrix),this.expandBySize(t,e,i)}expandBySize(t,e,i){[_.apply([0,0],i),_.apply([0,e],i),_.apply([t,e],i),_.apply([t,0],i)].forEach(t=>this.expandByPoint(t))}getCenter(){let[t,e]=this.min,[i,r]=this.getHalfSize();return _.apply([t+i,e+r],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[.5*(this.max[0]-this.min[0]),.5*(this.max[1]-this.min[1])]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(t){this.makeEmpty();for(let e of t)this.expandByPoint(e)}expandByPoint(t){this.min=[Math.min(this.min[0],t[0]),Math.min(this.min[1],t[1])],this.max=[Math.max(this.max[0],t[0]),Math.max(this.max[1],t[1])]}computeVertices(){let[t,e]=this.getHalfSize(),i=this.getCenter(),[r,s,n,a]=_.getAbcdef(this.matrix),h=_.create(r,s,n,a,i[0],i[1]);this.vertices=T.map(([i,r])=>_.apply([i*t,r*e],h))}computeEdges(){this.edges=[];for(let t=0,e=this.vertices.length;t<e;++t)this.edges.push([this.vertices[t],this.vertices[(t+1)%e]])}project(t,e){let i=this.matrix;return e&&(i=_.append(e.worldMatrix,i)),_.applyInverse(t,i)}intersects(t,e,i){return this.intersectsInLocalSpace(...this.project([t,e],i))}intersectsInLocalSpace(t,e){let{min:i,max:r}=this;return t>=i[0]&&t<=r[0]&&e>=i[1]&&e<=r[1]}containsPoint(t){let[e,i]=t,[r,s]=this.min,[n,a]=this.max;return e>=r&&e<=n&&i>=s&&i<=a}intersectsBBox2D(t){for(let e=0,i=this.edges.length;e<i;e++){let i=this.edges[e];for(let e=0,r=t.edges.length;e<r;e++)if(B(i,t.edges[e]))return!0}for(let e=0,i=t.vertices.length;e<i;e++){let i=t.vertices[e];if(this.containsPoint(i))return!0}return!1}ensureMinMax(){let t=this.min,e=this.max;this.min=[Math.min(t[0],e[0]),Math.min(t[1],e[1])],this.max=[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}copy(t){this.min=[...t.min],this.max=[...t.max],_.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new z;return t.copy(this),t}},R=class{constructor(e,i,r){this.uuid=e,this.data=i,this.isObject2D=!0,this.localMatrix=_.identity(),this.worldMatrix=_.identity(),this.ignoreCameraZoom=!1,this.visible=!0,this._singleBBox=new z,this._recursiveBBox=new z,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.stateSelection=null,this.prevState=null,this.currentState=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this.name="",this.position=[0,0],this.scale=[1,1],this.rotation=0,this.shear=[0,0],this.emitter=t(),this.dpr=r.dpr??1,this.dataPatched=i}project(t,e){let i=this.worldMatrix;return e&&(i=_.append(e.worldMatrix,i)),_.applyInverse(t,i)}intersects(t,e,i,r=!1){return this.visible&&!this.data.raycastLock&&this.intersectsInLocalSpace(...this.project([t,e],i),r)}intersectsInLocalSpace(t,e,i=!1){let{min:r,max:s}=i?this.recursiveBBox:this.singleBBox;return t>=r[0]&&t<=s[0]&&e>=r[1]&&e<=s[1]}applyTransforms(t){t.setTransform(this.worldMatrix,this.ignoreCameraZoom)}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges()),this._recursiveBBox}updateLocalMatrix(){this.localMatrix=_.compose(this.position,this.scale,this.rotation*w,n.getPivot(this.dataPatched),this.shear)}updateWorldMatrix(t,e,i){let r=this.parent;e&&null!=r&&r.updateWorldMatrix(t,!0,!1),t&&this.updateLocalMatrix(),this.parent?this.worldMatrix=_.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=_.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return n.getPivot(this.data)}getCenter(){return[0,0]}getHalfSize(){return[0,0]}get id(){return this.uuid}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{t.resetBBoxNeedsUpdateSelf()})}updateTransformState(t){let e=!1;void 0!==t.position&&(e=!0,this.position=t.position),void 0!==t.rotation&&(e=!0,this.rotation=t.rotation),void 0!==t.scale&&(e=!0,this.scale=t.scale),void 0!==t.shear&&(e=!0,this.shear=t.shear),e&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(t,r,s){0===t.type&&void 0!==t.props.visible&&(this.visible=t.props.visible),this.data=r,this.data=r;let n=t,a=e(t.path,["states","*"]);if(null!==a){if(0===t.type){let[e]=a;if(this?.stateSelection===e){let e={...t.props};if(delete e.name,Object.values(t.props).some(t=>void 0===t)){let i=this.data;if(void 0!==i){let r=l.zoom(i,t.path.slice(2));if(r)for(let i in t.props)void 0===t.props[i]&&i in r&&(e[i]=r[i])}}n={...t,props:e,path:t.path.slice(2)}}}}else if(0===t.type){let e=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==e){if(void 0!==t.props.name&&e.name){let{name:t,...i}=e;e=i}let i=l.removeOverridden(t.path,t.props,e);n={...t,props:i}}}this.updateByPatchedOpBase(n,i.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),s)}changeSelectedState(t,e,r=!1){if(0!==this.data.states.length||r){for(let t of this.data.states)i.toOps(this.data,t.data).forEach(t=>{let i=o.replaceProps(t,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,e)});if(null!==t){let r=this.data.states.data(t);r&&(this.dataPatched=i.patch(this.data,r),i.toOps(this.data,r).forEach(t=>{this.updateByPatchedOp(t,this.dataPatched,e)}))}r&&this.updateTransformState(this.dataPatched),this.stateSelection=t}}updateState(t,e){void 0!==t.name&&(this.name=t.name),void 0!==t.visible&&(this.visible=t.visible),this.updateTransformState(t)}updateByPatchedOpBase(t,e,i){this.dataPatched=e,this.updateByPatchedOp(t,e,i)}updateByPatchedOp(t,e,i){0===t.path.length&&0===t.type&&this.updateState(t.props,i),this.requestRender()}traverseFrameAncestors(t){this.traverseAncestors(e=>{"frame2d"===e.data.type&&t(e)})}traverseAncestors(t){let e=this.parent;for(;e;)t(e),e=e.parent}requestRender(){this.traverseFrameAncestors(t=>{t.requestRender()})}clone(t){let e=new R(this.uuid,this.data,t);return e.parent=void 0,e}addEventListener(t,e){this.emitter.on(t,e)}removeEventListener(t,e){this.emitter.off(t,e)}dispatchEvent(t){this.emitter.emit(t.type,{...t,target:t.target??this})}traverseSortNextHelper(){let t=this.parent;if(t){let e=t.children;if(e){let i=e.indexOf(this)+1;return e[i]?e[i]:t.traverseSortNextHelper()}}}sortNext(){let t=this.children;return t&&t.length>0&&t[0]?t[0]:this.traverseSortNextHelper()}isDescendantOf(t){t instanceof R&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}},O=class{constructor(t,e,i){this.uuid=t,this.data=e,this.enabled=!1,this.color=a.transparent,this.blurRadius=0,this.offset=[0,0],this.spread=0,this.update(e)}update(t){void 0!==t.color&&(this.color=t.color),void 0!==t.enabled&&(this.enabled=t.enabled),void 0!==t.blurRadius&&(this.blurRadius=t.blurRadius),void 0!==t.offset&&(this.offset=t.offset),void 0!==t.spread&&(this.spread=t.spread)}},E=class{constructor(t,e,i){this.uuid=t,this.data=e,this.enabled=!1,this.radius=0,this.update(e)}update(t){void 0!==t.enabled&&(this.enabled=t.enabled),void 0!==t.radius&&(this.radius=t.radius)}},H=class{constructor(t,e,i){this.uuid=t,this.data=e,this.enabled=!1,this.color=a.transparent,this.update(e)}update(t){void 0!==t.enabled&&(this.enabled=t.enabled),void 0!==t.color&&(this.color=t.color)}},L=class{constructor(t,e,i){this.uuid=t,this.data=e,this.enabled=!1,this.color=a.transparent,this.thickness=0,this.mode="inside",this.update(e)}update(t){void 0!==t.enabled&&(this.enabled=t.enabled),void 0!==t.color&&(this.color=t.color),void 0!==t.thickness&&(this.thickness=t.thickness),void 0!==t.mode&&(this.mode=t.mode)}},F=class extends R{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.autoClose=!0,this.fill=new H(t+"-fill",e.fill,i),this.stroke=new L(t+"-stroke",e.stroke,i),this.dropShadow=new O(t+"-dropShadow",e.dropShadow,i),this.innerShadow=new O(t+"-innerShadow",e.innerShadow,i),this.backgroundBlur=new E(t+"-backgroundBlur",e.backgroundBlur,i),this.layerBlur=new E(t+"-layerBlur",e.layerBlur,i)}applyFillStroke(t){t.fillColor=this.fill.enabled?this.fill.color:a.transparent,t.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:a.transparent,t.strokeMode=this.stroke.mode,t.lineWidth=this.stroke.thickness}applyFilters(t){this.layerBlur.enabled?t.layerBlur=5*this.layerBlur.radius:t.layerBlur=0,this.backgroundBlur.enabled?t.backgroundBlur=5*this.backgroundBlur.radius:t.backgroundBlur=0,this.dropShadow.enabled?(t.dropShadowBlur=5*this.dropShadow.blurRadius,t.dropShadowColor=this.dropShadow.color,t.dropShadowOffsetX=this.dropShadow.offset[0],t.dropShadowOffsetY=this.dropShadow.offset[1]):t.dropShadowColor=a.transparent,this.innerShadow.enabled?(t.innerShadowSpread=this.innerShadow.spread,t.innerShadowBlur=5*this.innerShadow.blurRadius,t.innerShadowColor=this.innerShadow.color,t.innerShadowOffsetX=this.innerShadow.offset[0],t.innerShadowOffsetY=this.innerShadow.offset[1]):t.innerShadowColor=a.transparent}innerDraw(t){}draw(t){!this.visible||(t.save(),this.applyTransforms(t),this.applyFilters(t),this.applyFillStroke(t),t.beginPath(),this.innerDraw(t),this.autoClose&&t.closePath(),this.fill.enabled&&t.fill(),this.stroke.enabled&&t.stroke(),t.restore())}updateByPatchedOp(t,i,r){super.updateByPatchedOp(t,i,r),0===t.type&&(e(t.path,["fill"])?this.fill.update(t.props):e(t.path,["stroke"])?this.stroke.update(t.props):e(t.path,["dropShadow"])?this.dropShadow.update(t.props):e(t.path,["innerShadow"])?this.innerShadow.update(t.props):e(t.path,["layerBlur"])?this.layerBlur.update(t.props):e(t.path,["backgroundBlur"])?this.backgroundBlur.update(t.props):this.resetBBoxNeedsUpdate())}updateState(t,e){super.updateState(t,e),void 0!==t.fill&&this.fill.update(t.fill),void 0!==t.stroke&&this.stroke.update(t.stroke),void 0!==t.dropShadow&&this.dropShadow.update(t.dropShadow),void 0!==t.innerShadow&&this.innerShadow.update(t.innerShadow),void 0!==t.layerBlur&&this.layerBlur.update(t.layerBlur),void 0!==t.backgroundBlur&&this.backgroundBlur.update(t.backgroundBlur)}clone(t){let e=new F(this.uuid,this.data,t);return e.parent=void 0,e}},U=class extends F{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.width=0,this.height=0,this.updateState(e,i)}innerDraw(t){t.ellipse(.5*this.width,.5*this.height,.5*this.width,.5*this.height,0,0,2*Math.PI)}intersectsInLocalSpace(t,e){return function(t,e,i,r,s,n){let a=t-i,h=e-r;return a*a/(s*s)+h*h/(n*n)<=1}(t,e,.5*this.width,.5*this.height,.5*this.width,.5*this.height)}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateSizeState(t){let e=!1;void 0!==t.width&&(this.width="number"==typeof t.width?t.width:this.width,e=!0),void 0!==t.height&&(this.height="number"==typeof t.height?t.height:this.height,e=!0),e&&this.updateWorldMatrix(!0,!1,!0)}updateState(t,e){super.updateState(t,e),this.updateSizeState(t)}clone(t){let e=new U(this.uuid,this.data,t);return e.parent=void 0,e}},N=class extends F{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.width=0,this.height=0,this.cornerRadius=[0,0,0,0],this.updateState(e,i)}innerDraw(t){t.rect(0,0,this.width,this.height,...this.cornerRadius)}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateCornerState(t){void 0!==t.cornerRadius&&(this.cornerRadius=t.cornerRadius)}updateSizeState(t){let e=!1;void 0!==t.width&&(this.width="number"==typeof t.width?t.width:this.width,e=!0),void 0!==t.height&&(this.height="number"==typeof t.height?t.height:this.height,e=!0),e&&this.updateWorldMatrix(!0,!1,!0)}updateState(t,e){super.updateState(t,e),this.updateSizeState(t),this.updateCornerState(t)}clone(t){let e=new N(this.uuid,this.data,t);return e.parent=void 0,e}},j=class extends F{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this._textHeight=0,this._textHeightDirty=!0,this.width=0,this.height=0,this.updateState(e,i)}get textHeight(){return this._textHeight}applyFillStroke(t){t.fillColor=this.fill.enabled?this.fill.color:a.transparent,t.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:a.transparent,t.strokeMode="center",t.lineWidth=this.stroke.thickness}innerDraw(t){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&t.registerFont(this._fontHolder.arrayBuffer,this.data.font);let e=this.data.textTransform,i=this.data.text.textValue.toString(),r=2===e?i.toUpperCase():3===e?i.toLowerCase():i,{height:s}=t.drawText(r,{x:0,y:0,width:this.width,height:this.height,fontSize:this.data.fontSize,lineHeight:this.data.lineHeight??1,letterSpacing:this.data.letterSpacing??0,horizontalAlign:this.data.horizontalAlign,verticalAlign:this.data.verticalAlign,font:this.data.font});this._textHeight=s}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateSizeState(t){let e=!1;void 0!==t.width&&(this.width="number"==typeof t.width?t.width:this.width,e=!0),void 0!==t.height&&(this.height="number"==typeof t.height?t.height:this.height,e=!0),e&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(t,{shared:e}){void 0!==t.font&&(this._fontHolder=e.getFont(t.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then(()=>{this.requestRender()}))}updateState(t,e){super.updateState(t,e),this.updateSizeState(t),this.updateFontState(t,e)}clone(t){let e=new j(this.uuid,this.data,t);return e.parent=void 0,e}},I=class extends F{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.curves=[],this.extremasBBox={min:[0,0],max:[0,0]},this.updateState(e,i)}computeExtremas(){0===this.curves.length&&this.computeCurves();let t=this.curves.map(t=>b.extremas(t)),e=[1/0,1/0],i=[-1/0,-1/0];for(let r=0,s=t.length;r<s;r++){let s=t[r];s[0][0]<e[0]&&(e[0]=s[0][0]),s[0][1]<e[1]&&(e[1]=s[0][1]),s[1][0]>i[0]&&(i[0]=s[1][0]),s[1][1]>i[1]&&(i[1]=s[1][1])}return this.extremasBBox.min=[e[0],e[1]],this.extremasBBox.max=[i[0],i[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let t=1,e=this.data.points.length;t<e;t++){let e=this.data.points[t].data,i=this.data.points[t-1].data,r={start:i.position,cp1:i.controlNext.position,cp2:e.controlPrevious.position,end:e.position};this.curves.push(r)}let t=this.data.points[0].data,e=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let i={start:e.position,cp1:e.controlNext.position,cp2:t.controlPrevious.position,end:t.position};this.curves.push(i)}}getCenter(){let[t,e]=this.extremasBBox.min,[i,r]=this.getHalfSize();return[t+i,e+r]}getHalfSize(){let{min:t,max:e}=this.extremasBBox;return[.5*(e[0]-t[0]),.5*(e[1]-t[1])]}innerDraw(t){for(let e=0,i=this.data.points.length;e<i;e++){let i=this.data.points[e].data;if(0===e){let[e,r]=i.position;t.moveTo(e,r)}else{let r=this.data.points[e-1].data,[s,n]=r.controlNext.position,[a,h]=i.controlPrevious.position,[o,l]=i.position,d={start:r.position,cp1:r.controlNext.position,cp2:i.controlPrevious.position,end:i.position};b.derive(d),t.bezierCurveTo(s,n,a,h,o,l)}}let e=this.data.points[0].data,i=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let[r,s]=i.controlNext.position,[n,a]=e.controlPrevious.position,[h,o]=e.position;t.bezierCurveTo(r,s,n,a,h,o)}}updateState(t,e){super.updateState(t,e),this.computeExtremas()}clone(t){let e=new I(this.uuid,this.data,t);return e.parent=void 0,e}};(t=>{function e(t,e,i,r=!1){let s=t-2*e+i;if(0!==s){let r=-Math.sqrt(Math.abs(e*e-t*i)),n=-t+e;return[-(r+n)/s,-(-r+n)/s]}return e!==i&&0===s?[(2*e-i)/(2*(e-i))]:[]}t.derive=function(t){let e=t.start,i=t.cp1,r=t.cp2,s=t.end,n={start:[3*(i[0]-e[0]),3*(i[1]-e[1])],cp:[3*(r[0]-i[0]),3*(r[1]-i[1])],end:[3*(s[0]-r[0]),3*(s[1]-r[1])]};return t.derivative=n,n.derivative=M.derive(n),n},t.droot=function(i){let r=i.derivative??t.derive(i),s=r.start,n=r.cp,a=r.end;return[e(s[0],n[0],a[0]),e(s[1],n[1],a[1])]},t.extremas=function(e){let[i,r]=t.droot(e),s=[e.start[0],e.end[0]],n=[e.start[1],e.end[1]];for(let r of i)s.push(t.compute(e,Math.min(1,Math.max(0,r)))[0]);for(let i of r)n.push(t.compute(e,Math.min(1,Math.max(0,i)))[1]);return s.sort((t,e)=>t-e),n.sort((t,e)=>t-e),[[s[0],n[0]],[s[s.length-1],n[n.length-1]]]},t.compute=function(t,e){if(0===e)return[...t.start];if(1===e)return[...t.end];let i=1-e,r=i*i,s=e*e,n=r*i,a=r*e*3,h=i*s*3,o=e*s;return[n*t.start[0]+a*t.cp1[0]+h*t.cp2[0]+o*t.end[0],n*t.start[1]+a*t.cp1[1]+h*t.cp2[1]+o*t.end[1]]}})(b||(b={})),(C=M||(M={})).derive=function(t){let e=t.start,i=t.cp,r=t.end,s={start:[2*(i[0]-e[0]),2*(i[1]-e[1])],end:[2*(r[0]-i[0]),2*(r[1]-i[1])]};return s.derivative=k.derive(s),t.derivative=s,s},C.droot=function(t){let e=t.derivative??C.derive(t),i=e.start,r=e.end;return[i[0]!==r[0]?i[0]/(i[0]-r[0]):0,i[1]!==r[1]?i[1]/(i[1]-r[1]):0]},C.compute=function(t,e){if(0===e)return[...t.start];if(1===e)return[...t.end];let i=1-e,r=i*i,s=i*e*2,n=e*e;return[r*t.start[0]+s*t.cp[0]+n*t.end[0],r*t.start[1]+s*t.cp[1]+n*t.end[1]]},(A=k||(k={})).derive=function(t){let e=t.start,i=t.end,r=[i[0]-e[0],i[1]-e[1]];return t.derivative=r,t.derivative},A.compute=function(t,e){if(0===e)return[...t.start];if(1===e)return[...t.end];let i=t.start,r=t.end;return[i[0]+(r[0]-i[0])*e,i[1]+(r[1]-i[1])*e]};var D=class extends R{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.context=i,this.isBaseGroup=!0,this.children=[]}add(t){t.parent&&t.parent instanceof D&&t.parent.remove(t),this.children.push(t),t.parent=this}remove(t){let e=this.children.indexOf(t);e>=0&&(this.children.splice(e,1),t.parent=void 0)}traverse(t){let e=t(this);if(!0!==e)for(let i of this.children)i instanceof D?i.traverse(t):e=t(i)}intersectsChildrenHelper(t,e,i,r,s){for(let n of this.children)if(n.intersects(t,e,i,!1)&&(s.push(n),r)||n instanceof D&&n.intersectsChildrenHelper(t,e,i,r,s))return!0;return!1}intersectsChildren(t,e,i,r=!1,s=[],n=!1){return this.intersectsChildrenHelper(t,e,i,r,s),s}intersectsChildrenHelperReverse(t,e,i,r,s){for(let n of this.children)if(n instanceof D&&n.intersectsChildrenHelperReverse(t,e,i,r,s)||n.intersects(t,e,i,!1)&&(s.push(n),r))return!0;return!1}intersectsChildrenReverse(t,e,i,r=!1,s=[],n=!1){return this.intersectsChildrenHelperReverse(t,e,i,r,s),s}updateWorldMatrix(t,e,i){if(super.updateWorldMatrix(t,e,i),i&&this.children)for(let e of this.children)e.updateWorldMatrix(t,!1,!0)}find(t){let e;return this.traverse(i=>{i.uuid===t&&(e=i)}),e}innerDrawChildren(t){for(let e=this.children.length-1;e>=0;e--)this.children[e].draw(t)}resetBBoxNeedsUpdate(){super.resetBBoxNeedsUpdate(),this.traverse(t=>{t.resetBBoxNeedsUpdateSelf()})}clone(t){let e=new D(this.uuid,this.data,t);e.parent=void 0;for(let i of this.children)e.add(i.clone(t));return e}},W=class extends D{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.updateState(e,i)}draw(t){!this.visible||(t.save(),this.applyTransforms(t),this.innerDrawChildren(t),t.restore())}clone(t){let e=new W(this.uuid,this.data,t);e.parent=void 0;for(let i of this.children)e.add(i.clone(t));return e}},X=class extends D{constructor(t,e,i){super(t,e,i),this.uuid=t,this.width=0,this.height=0,this.clipped=!0,this.background=new N(t+"-background",r.defaultData,i),this.background.parent=this,this.updateState(e,i)}get fill(){return this.background.fill}get stroke(){return this.background.stroke}get backgroundBlur(){return this.background.backgroundBlur}get layerBlur(){return this.background.layerBlur}get dropShadow(){return this.background.dropShadow}get innerShadow(){return this.background.innerShadow}get cornerRadius(){return this.background.cornerRadius}set cornerRadius(t){this.background.cornerRadius=t}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(t,e,i){super.updateWorldMatrix(t,e,i),this.background?.updateWorldMatrix(t,e,i)}draw(t){if(!this.visible)return;t.save();let e=this.width,i=this.height;this.applyTransforms(t),this.background.width=e,this.background.height=i,this.background.draw(t),this.clipped&&t.clipRect(0,0,e,i,...this.cornerRadius),this.innerDrawChildren(t),t.restore()}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateCornerState(t){void 0!==t.cornerRadius&&(this.cornerRadius=t.cornerRadius)}updateSizeState(t){let e=!1;void 0!==t.width&&(this.width="number"==typeof t.width?t.width:this.width,e=!0),void 0!==t.height&&(this.height="number"==typeof t.height?t.height:this.height,e=!0),e&&this.updateWorldMatrix(!0,!1,!0)}updateState(t,e){super.updateState(t,e),this.updateSizeState(t),this.updateCornerState(t),void 0!==t.fill&&this.fill.update(t.fill),void 0!==t.stroke&&this.stroke.update(t.stroke),void 0!==t.dropShadow&&this.dropShadow.update(t.dropShadow),void 0!==t.innerShadow&&this.innerShadow.update(t.innerShadow),void 0!==t.layerBlur&&this.layerBlur.update(t.layerBlur),void 0!==t.backgroundBlur&&this.backgroundBlur.update(t.backgroundBlur),void 0!==t.clipped&&(this.clipped=t.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(t,i,r){super.updateByPatchedOp(t,i,r),0===t.type&&(e(t.path,["fill"])?this.fill.update(t.props):e(t.path,["stroke"])?this.stroke.update(t.props):e(t.path,["dropShadow"])?this.dropShadow.update(t.props):e(t.path,["innerShadow"])?this.innerShadow.update(t.props):e(t.path,["layerBlur"])?this.layerBlur.update(t.props):e(t.path,["backgroundBlur"])?this.backgroundBlur.update(t.props):this.resetBBoxNeedsUpdate())}clone(t){let e=new X(this.uuid,this.data,t);e.parent=void 0;for(let i of this.children)e.add(i.clone(t));return e}},V=u(g(),1),q=new Map,Y=null,$=class extends F{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this._pathBBox=new DOMRect,this.path="",this.updateState(e,i),this.autoClose=!1,this.computeSVGBBox()}computeSVGBBox(){let t=this.path;G(this.path)&&(console.warn("Invalid SVG path",this.uuid),t=""),this._pathBBox=function(t){let e=q.get(t);if(void 0!==e)return e;if(null===Y||!Y.isConnected){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none",Y=document.createElementNS("http://www.w3.org/2000/svg","path"),t.appendChild(Y),document.body.appendChild(t)}Y.setAttribute("d",t);let i=Y.getBBox();return q.size>=4096&&q.clear(),q.set(t,i),i}(t)}innerDraw(t){t.path(this.path)}intersectsInLocalSpace(t,e){return t>=this._pathBBox.x&&t<=this._pathBBox.x+this._pathBBox.width&&e>=this._pathBBox.y&&e<=this._pathBBox.y+this._pathBBox.height}getCenter(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}getHalfSize(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}updateState(t,e){super.updateState(t,e),void 0!==t.path&&(this.path=t.path,this.computeSVGBBox())}clone(t){let e=new $(this.uuid,this.data,t);return e.parent=void 0,e}};function G(t){return/NaN/.test(t)}function Q(t,e=1,i=1){if(e<=0||i<=0)return t;if(G(t))return console.warn("Cannot scale invalid path",t),Z([]);if(1===e&&1===i)return t;try{return Z((0,V.parseSVG)(t).map(t=>{let r={...t};return"x"in r&&(r.x=r.x*e),"y"in r&&(r.y=r.y*i),"x1"in r&&(r.x1=r.x1*e),"x2"in r&&(r.x2=r.x2*e),"y1"in r&&(r.y1=r.y1*i),"y2"in r&&(r.y2=r.y2*i),"rx"in r&&(r.rx=r.rx*e),"ry"in r&&(r.ry=r.ry*i),r}))}catch(t){return console.warn("Error parsing SVG path",t),Z([])}}function Z(t){let e,i=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"];return t.map(t=>{let r=[];i.forEach(e=>{if(e in t){let i=1*t[e];r.length&&i>=0&&r.push(","),r.push(i)}});let s=(e===t.code?r[0]<0?"":",":t.code)+r.join("");return e=t.code,s}).join("")}var J=class{constructor(t,e,i){this.uuid=t,this.data=e,this.group=new W(J.GROUP_ID,{...s.defaultData},i),this.createChildrenObjects(e.objects,this.group,i)}createObject(t,e,i,r,s,n){let a=function(t,e,i){switch(e.type){case"ellipse2d":return new U(t,e,i);case"rectangle2d":return new N(t,e,i);case"text2d":return new j(t,e,i);case"vector2d":return new I(t,e,i);case"path2d":return new $(t,e,i);case"frame2d":return new X(t,e,i);default:return new W(t,e,i)}}(t,e,n);a&&(r.add(a),r.children.splice(s,0,r.children.pop()),a.updateWorldMatrix(),i.length>0&&(a instanceof W||a instanceof X)&&this.createChildrenObjects(i,a,n))}createChildrenObjects(t,e,i){let r=0;for(let s of t)this.createObject(s.id,s.data,s.children,e,r,i),r+=1}draw(t){this.group.draw(t)}updateEntityByOp(t,e,i,r){let s=this.find(t);if(s)try{s.updateByOp(e,i,{shared:r})}catch(t){console.error(t)}}updateTreeByOp(t,e){if(0===t.path.length&&7===t.type){let i=null===t.parent?this.group:this.find(t.parent);void 0!==i&&i instanceof D&&(this.createObject(t.id,t.data,t.children,i,t.localIndex,e),i.requestRender())}else if(0===t.path.length&&8===t.type){let e=this.find(t.id);if(void 0!==e&&void 0!==e.parent&&e.parent instanceof D){let t=e.parent;e.resetBBoxNeedsUpdate(),t?.remove(e),t?.requestRender()}}else if(0===t.path.length&&9===t.type){let e=this.find(t.id);if(void 0!==e){let i=e.parent,r=null===t.parent?this:this.find(t.parent);if(r instanceof D||r===this){r.add(e);let s=t.localIndex;r.children.splice(s,0,r.children.pop()),e.updateWorldMatrix(!0,!1,!0),i?.requestRender(),e.requestRender()}e.resetBBoxNeedsUpdate()}}}add(t){this.group.add(t)}remove(t){this.group.remove(t)}traverse(t){this.group.traverse(e=>{e!==this.group&&t(e)})}intersectsChildren(t,e,i,r=!1,s=[]){return this.group.intersectsChildren(t,e,i,r,s,!0)}intersectsChildrenReverse(t,e,i,r=!1,s=[]){return this.group.intersectsChildrenReverse(t,e,i,r,s,!0)}find(t){return this.group.find(t)}get children(){return this.group.children}project(t,e){return this.group.project(t,e)}getWithSortKey(t){let e=this.find(t);if(void 0===e)return;let i=[],r=e;for(;r!==this.group;){let t=r;r=r.parent;let e=r.children.indexOf(t);i.splice(0,0,e)}return{entity:e,sortKey:i}}getAllSorted(t){let e=[];for(let i of t){let t=this.getWithSortKey(i.id);void 0!==t&&e.push(t)}return e.sort((t,e)=>h(t.sortKey,e.sortKey)),e.map(t=>t.entity)}},K=J;K.GROUP_ID="scene2d";var tt=u(g(),1);function et(t,e,i,r,s,n,a,h,o,l){if(e===o&&i===l)return;if(r=Math.abs(r),s=Math.abs(s),0===r||0===s)return void t.push({LineTo:{x:o,y:l}});let d=n*Math.PI/180,u=Math.cos(d),c=Math.sin(d),p=(e-o)/2,f=(i-l)/2,x=u*p+c*f,g=-c*p+u*f,m=x*x/(r*r)+g*g/(s*s);if(m>1){let t=Math.sqrt(m);r*=t,s*=t}let y=r*r,v=s*s,w=y*v-y*g*g-v*x*x,_=y*g*g+v*x*x,S=(a!==h?1:-1)*Math.sqrt(Math.max(0,w/_)),B=S*(r*g)/s,b=S*(-s*x)/r,M=u*B-c*b+(e+o)/2,C=c*B+u*b+(i+l)/2,k=Math.atan2((g-b)/s,(x-B)/r),A=Math.atan2((-g-b)/s,(-x-B)/r)-k;!h&&A>0?A-=2*Math.PI:h&&A<0&&(A+=2*Math.PI);let T=Math.max(1,Math.ceil(Math.abs(A)/(Math.PI/2))),P=A/T,z=4/3*Math.tan(P/4),R=k,O=e,E=i;for(let e=0;e<T;e++){let e=R+P,i=Math.cos(R),n=Math.sin(R),a=Math.cos(e),h=Math.sin(e),o=M+r*a*u-s*h*c,l=C+r*a*c+s*h*u,d=-r*n*u-s*i*c,p=-r*n*c+s*i*u,f=-r*h*u-s*a*c,x=-r*h*c+s*a*u;t.push({CurveTo:[{x:O+z*d,y:E+z*p},{x:o-z*f,y:l-z*x},{x:o,y:l}]}),R=e,O=o,E=l}}var it=.5522847498307936,rt=3408/2816,st=1536/2816,nt=!1;function at(){nt||(nt=!0,console.warn("[HanaRenderer] clipRect: precise clipping of rotated/complex content is not supported by the Hana UI overlay yet; drawing unclipped. (Axis-aligned rectangles are clipped geometrically.)"))}var ht=class{constructor(t,e=1){this.canvas=t,this._dpr=e,this._width=0,this._height=0,this._isSizeDirty=!1,this._crashed=!1,this._shapes=[],this._lastPushedJSON="",this._ctm=_.identity(),this._stack=[],this._clips=[],this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0,this._fillColor=a.transparent,this._strokeColor=a.transparent,this._lineWidth=1,this._strokeMode="inside",this._layerBlur=0,this._backgroundBlur=0,this._dropShadowBlur=0,this._dropShadowOffsetX=0,this._dropShadowOffsetY=0,this._dropShadowColor=a.transparent,this._innerShadowBlur=0,this._innerShadowOffsetX=0,this._innerShadowOffsetY=0,this._innerShadowSpread=0,this._innerShadowColor=a.transparent,this._fonts=new Map,this._fontsFlushed=new Set,this._fontXPerEm=new Map,this._measureCache=new Map;try{let i=t.getBoundingClientRect();t.width=i.width*e,t.height=i.height*e}catch{console.log(t.width,e)}}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this._isSizeDirty=!0}get width(){return this._width}get height(){return this._height}async init(){if(!this._engine&&!this._crashed){try{this._context=await m(),this._engine=await this._context.createEngine(this.canvas)}catch(t){return this._crashed=!0,void console.error("[HanaRenderer] Failed to load the Hana UI engine; UI scenes will not render.",t)}if(this._width>0&&this._height>0)this._syncViewport();else{let t=this.canvas.getBoundingClientRect();t.width>0&&t.height>0&&(this._width=t.width,this._height=t.height,this._syncViewport())}this._flushFonts(),this.uiFontReady=this._watchUiFont()}}_watchUiFont(){return new Promise(t=>{let e=this._engine;if(!e||"function"!=typeof e.scene.isUiFontLoaded)return void t();let i=()=>{let t=!1;return this._guard(()=>{t=e.scene.isUiFontLoaded()}),t};if(i())return void t();let r=Date.now(),s=setInterval(()=>{this._crashed||Date.now()-r>3e5?clearInterval(s):i()&&(clearInterval(s),t())},150)})}_syncViewport(){let t=this._engine;if(!t||this._crashed)return;let e=this._width,i=this._height;this.canvas.style.width=e+"px",this.canvas.style.height=i+"px",this.canvas.width=Math.max(1,Math.ceil(e*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(i*this._dpr)),this._guard(()=>{t.resize([e,i],this._dpr),t.scene.updateCamera({position:[e/2,i/2],zoom:1})})}setSize(t,e){!this._isSizeDirty&&t===this._width&&e===this._height||(this._isSizeDirty=!1,this._width=t,this._height=e,this._engine?this._syncViewport():(this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",this.canvas.width=Math.max(1,Math.ceil(t*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(e*this._dpr))))}_guard(t){if(!this._crashed)try{t()}catch(t){this._crashed=!0,console.error("[HanaRenderer] Hana engine call failed; disabling this renderer instance.",t)}}async loadFont(t,e){try{let i=await fetch(t);if(!i.ok)return void console.error(`[HanaRenderer] loadFont: ${t} returned HTTP ${i.status}; skipping "${e}"`);let r=await i.arrayBuffer();if(0===r.byteLength)return void console.error(`[HanaRenderer] loadFont: ${t} was empty; skipping "${e}"`);this.registerFont(r,e)}catch(i){console.error(`[HanaRenderer] loadFont failed for "${e}" (${t}):`,i)}}registerFont(t,e){if(this._fonts.has(e))return;this._fonts.set(e,t);let i=function(t){try{let e=new DataView(t),i=e.getUint32(0);if(65536!==i&&1330926671!==i&&1953658213!==i)return;let r=e.getUint16(4),s=-1,n=-1;for(let t=0;t<r;t++){let i=12+16*t,r=e.getUint32(i);1751474532===r&&(s=e.getUint32(i+8)),1330851634===r&&(n=e.getUint32(i+8))}if(s<0||n<0)return;let a=e.getUint16(s+18),h=e.getUint16(n);if(0===a||h<2)return;let o=e.getInt16(n+86);return o>0?o/a:void 0}catch{return}}(t);void 0!==i&&this._fontXPerEm.set(e,i),this._flushFonts()}_flushFonts(){let t=this._engine;if(t)for(let[e,i]of this._fonts)this._fontsFlushed.has(e)||(this._fontsFlushed.add(e),this._guard(()=>{t.scene.addLocalFont(e,new Uint8Array(i))}))}set strokeColor(t){this._strokeColor=t}set fillColor(t){this._fillColor=t}set lineWidth(t){this._lineWidth=t}set strokeMode(t){this._strokeMode=t}set dropShadowBlur(t){this._dropShadowBlur=t}set dropShadowColor(t){this._dropShadowColor=t}set dropShadowOffsetX(t){this._dropShadowOffsetX=t}set dropShadowOffsetY(t){this._dropShadowOffsetY=t}set innerShadowBlur(t){this._innerShadowBlur=t}set innerShadowColor(t){this._innerShadowColor=t}set innerShadowOffsetX(t){this._innerShadowOffsetX=t}set innerShadowOffsetY(t){this._innerShadowOffsetY=t}set innerShadowSpread(t){this._innerShadowSpread=t}set layerBlur(t){this._layerBlur=t}set backgroundBlur(t){this._backgroundBlur=t}save(){this._stack.push({ctm:_.copy(this._ctm),clipLen:this._clips.length})}restore(){let t=this._stack.pop();!t||(this._ctm=t.ctm,this._clips.length=t.clipLen)}setTransform(t,e=!1){let i=_.identity();if(this.camera?.enabled&&(i=_.append(i,this.camera.worldMatrix),e)){let t=_.getScale(this.camera.worldMatrix);i=_.scale(i,1/t[0],1/t[1])}this._ctm=_.append(i,t)}transform(t){this._ctm=_.append(this._ctm,t)}beginPath(){this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0}closePath(){0!==this._pathEls.length&&"ClosePath"!==this._pathEls[this._pathEls.length-1]&&this._pathEls.push("ClosePath")}_startFreeform(){this._simpleShape=null,this._pathPrimitives++}moveTo(t,e){this._startFreeform(),this._pathEls.push({MoveTo:{x:t,y:e}})}lineTo(t,e){this._startFreeform(),this._pathEls.push({LineTo:{x:t,y:e}})}bezierCurveTo(t,e,i,r,s,n){this._startFreeform(),this._pathEls.push({CurveTo:[{x:t,y:e},{x:i,y:r},{x:s,y:n}]})}quadraticCurveTo(t,e,i,r){this._startFreeform(),this._pathEls.push({QuadTo:[{x:t,y:e},{x:i,y:r}]})}path(t){this._startFreeform(),this._pathEls.push(...function(t){let e,i=[];try{e=(0,tt.makeAbsolute)((0,tt.parseSVG)(t))}catch(t){return console.error("[HanaRenderer] Failed to parse SVG path:",t),i}let r=0,s=0,n=0,a=0,h=null,o=null;for(let t of e){let e=null,l=null;switch(t.code){case"M":r=n=t.x,s=a=t.y,i.push({MoveTo:{x:r,y:s}});break;case"L":r=t.x,s=t.y,i.push({LineTo:{x:r,y:s}});break;case"H":r=t.x,i.push({LineTo:{x:r,y:s}});break;case"V":s=t.y,i.push({LineTo:{x:r,y:s}});break;case"C":{let n={x:t.x1,y:t.y1},a={x:t.x2,y:t.y2};r=t.x,s=t.y,i.push({CurveTo:[n,a,{x:r,y:s}]}),e=a;break}case"S":{let n=h?{x:2*r-h.x,y:2*s-h.y}:{x:r,y:s},a={x:t.x2,y:t.y2};r=t.x,s=t.y,i.push({CurveTo:[n,a,{x:r,y:s}]}),e=a;break}case"Q":{let e={x:t.x1,y:t.y1};r=t.x,s=t.y,i.push({QuadTo:[e,{x:r,y:s}]}),l=e;break}case"T":{let e=o?{x:2*r-o.x,y:2*s-o.y}:{x:r,y:s};r=t.x,s=t.y,i.push({QuadTo:[e,{x:r,y:s}]}),l=e;break}case"A":{let e=r,n=s;r=t.x,s=t.y,et(i,e,n,t.rx,t.ry,t.xAxisRotation,t.largeArc,t.sweep,r,s);break}case"Z":r=n,s=a,i.push("ClosePath")}h=e,o=l}return i}(t))}rect(t,e,i,r,s=0,n=0,a=0,h=0){if(!ct([t,e,i,r]))return;let o={x:t,y:e,w:i,h:r,radii:[s,n,a,h]};this._pathPrimitives++,this._simpleShape=1===this._pathPrimitives&&0===this._pathEls.length?{kind:"rect",rect:o,smoothing:0}:null,gt(this._pathEls,o)}ellipse(t,e,i,r,s,n,a,h){if(ct([t,e,i,r])){if(i<0||r<0)throw Error("radii cannot be negative");this._pathPrimitives++,this._simpleShape=1===this._pathPrimitives&&0===this._pathEls.length?{kind:"ellipse",cx:t,cy:e,rx:i,ry:r}:null,function(t,e,i,r,s){let n=r*it,a=s*it;t.push({MoveTo:{x:e+r,y:i}},{CurveTo:[{x:e+r,y:i+a},{x:e+n,y:i+s},{x:e,y:i+s}]},{CurveTo:[{x:e-n,y:i+s},{x:e-r,y:i+a},{x:e-r,y:i}]},{CurveTo:[{x:e-r,y:i-a},{x:e-n,y:i-s},{x:e,y:i-s}]},{CurveTo:[{x:e+n,y:i-s},{x:e+r,y:i-a},{x:e+r,y:i}]},"ClosePath")}(this._pathEls,t,e,i,r)}}clipRect(t,e,i,r,s=0,n=0,a=0,h=0){let o=_.invert(this._ctm);!o||this._clips.push({m:_.copy(this._ctm),inv:o,rect:{x:t,y:e,w:i,h:r,radii:[s,n,a,h]}})}fill(){this._emit(!0)}stroke(){this._strokeColor.a<=0||this._lineWidth<=0||this._emit(!1)}_emit(t){let e=this._effectChain(t);if(t&&this._fillColor.a<=0&&!e)return;let i=this._classifyShape();if(!i)return;let r=this._applyClips(i);if("skip"===r)return;if(!t&&r!==i){let t=ft(i);if(t)return void this._emitClippedRectStroke(t,e)}i=r;let s={shape:i,color:t?ut(this._fillColor):[0,0,0,0],transform:_.getAbcdef(this._ctm)};t||(s.stroke=this._strokeDesc()),e&&(s.effect_chain=e),this._shapes.push(s)}_emitClippedRectStroke(t,e){let i=this._lineWidth,r="outside"===this._strokeMode?i:"center"===this._strokeMode?i/2:0,s=i-r,n=Math.min(t.w,t.h)/2,a=t.radii.map(t=>Math.max(0,Math.min(t,n))),h={x:t.x-r,y:t.y-r,w:t.w+2*r,h:t.h+2*r,radii:a.map(t=>t>0?t+r:0)},o=t.w-2*s,l=t.h-2*s,d=o>0&&l>0?{x:t.x+s,y:t.y+s,w:o,h:l,radii:a.map(t=>Math.max(0,t-s))}:null,u=this._applyClips(pt(h,0));if("skip"===u)return;let c=ft(u)??h,p=null;if(d){let t=this._applyClips(pt(d,0));p="skip"===t?null:ft(t)??d}let f=[];gt(f,c),p&&function(t,e){let{x:i,y:r,w:s,h:n}=e,a=Math.min(s,n)/2,[h,o,l,d]=e.radii.map(t=>Math.max(0,Math.min(t,a)));if(0===h&&0===o&&0===l&&0===d)return void t.push({MoveTo:{x:i,y:r}},{LineTo:{x:i,y:r+n}},{LineTo:{x:i+s,y:r+n}},{LineTo:{x:i+s,y:r}},"ClosePath");let u=1-it;t.push({MoveTo:{x:i+h,y:r}}),h>0&&t.push({CurveTo:[{x:i+h*u,y:r},{x:i,y:r+h*u},{x:i,y:r+h}]}),t.push({LineTo:{x:i,y:r+n-d}}),d>0&&t.push({CurveTo:[{x:i,y:r+n-d*u},{x:i+d*u,y:r+n},{x:i+d,y:r+n}]}),t.push({LineTo:{x:i+s-l,y:r+n}}),l>0&&t.push({CurveTo:[{x:i+s-l*u,y:r+n},{x:i+s,y:r+n-l*u},{x:i+s,y:r+n-l}]}),t.push({LineTo:{x:i+s,y:r+o}}),o>0&&t.push({CurveTo:[{x:i+s,y:r+o*u},{x:i+s-o*u,y:r},{x:i+s-o,y:r}]}),t.push("ClosePath")}(f,p);let x={shape:{Custom:f},color:ut(this._strokeColor),transform:_.getAbcdef(this._ctm)};e&&(x.effect_chain=e),this._shapes.push(x)}_classifyShape(){let t=this._simpleShape;return t?"rect"===t.kind?pt(t.rect,t.smoothing):{Ellipse:{center_x:t.cx,center_y:t.cy,rx:t.rx,ry:t.ry}}:0===this._pathEls.length?null:{Custom:this._pathEls.slice()}}_strokeDesc(){return{width:this._lineWidth,line_join:"Miter",color:ut(this._strokeColor),align:ot[this._strokeMode],cap:"Butt"}}_effectChain(t){let e=this.camera?.scale??1,i=[];if(t&&this._dropShadowColor.a>0&&i.push({DropShadow:{position:[this._dropShadowOffsetX*e,this._dropShadowOffsetY*e],blur:{Uniform:{size:2*this._dropShadowBlur*e}},spread:0,color:ut(this._dropShadowColor)}}),t&&this._backgroundBlur>0){let[t,e]=_.getScale(this._ctm),r=(t+e)/2;i.push({BackgroundBlur:{blur:{Uniform:{size:2*this._backgroundBlur*r}}}})}if(this._layerBlur>0&&i.push({LayerBlur:{blur:{Uniform:{size:2*this._layerBlur*e}}}}),t&&this._innerShadowColor.a>0){let[t,r,s,n]=_.getAbcdef(this._ctm),a=this._innerShadowOffsetX,h=this._innerShadowOffsetY;i.push({InnerShadow:{position:[t*a+s*h,r*a+n*h],blur:{Uniform:{size:2*this._innerShadowBlur*e}},spread:this._innerShadowSpread*e,color:ut(this._innerShadowColor)}})}return i.length>0?i:void 0}_applyClips(t){if(0===this._clips.length)return t;let e=t;for(let t of this._clips){let i=_.append(t.inv,this._ctm),[r,s,n,a,h,o]=_.getAbcdef(i),l=Math.abs(s)<=1e-6*(Math.abs(r)+Math.abs(a))&&Math.abs(n)<=1e-6*(Math.abs(r)+Math.abs(a)),d=xt(e);if(!d)return e;if(!l){at();continue}let u=r*d.minX+h,c=r*d.maxX+h,p=a*d.minY+o,f=a*d.maxY+o,x=Math.min(u,c),g=Math.max(u,c),m=Math.min(p,f),y=Math.max(p,f),v=t.rect,w=Math.max(x,v.x),S=Math.max(m,v.y),B=Math.min(g,v.x+v.w),b=Math.min(y,v.y+v.h);if(w>=B||S>=b)return"skip";if(w===x&&S===m&&B===g&&b===y)continue;let M=ft(e);if(!M||0===r||0===a){at();continue}let C=(w-h)/r,k=(B-h)/r,A=(S-o)/a,T=(b-o)/a,P=Math.min(C,k),z=Math.min(A,T),R=Math.abs(k-C),O=Math.abs(T-A),[E,H,L,F]=M.radii,U=P!==M.x,N=z!==M.y,j=P+R!==M.x+M.w,I=z+O!==M.y+M.h,D=Math.min(R,O)/2;e=pt({x:P,y:z,w:R,h:O,radii:[U||N?0:Math.min(E,D),j||N?0:Math.min(H,D),j||I?0:Math.min(L,D),U||I?0:Math.min(F,D)]},0)}return e}drawText(t,e){let i=this._fontXPerEm.get(e.font),r=i?i/st:1,s={TextSimple:{text:t,font_size:e.fontSize*rt*r,size:[e.width,e.height],horizontal_align:lt[e.horizontalAlign]??"Left",vertical_align:dt[e.verticalAlign]??"Top"}},n=this._effectChain(!0),a=this._fillColor.a>0,h=this._strokeColor.a>0&&this._lineWidth>0;if(a||h||n){let t={shape:s,color:a?ut(this._fillColor):[0,0,0,0],transform:_.getAbcdef(_.append(this._ctm,_.translate(_.identity(),e.x,e.y)))};h&&(t.stroke=this._strokeDesc()),n&&(t.effect_chain=n),this._shapes.push(t)}return{height:this._measureTextHeight(t,e)}}_measureTextHeight(t,e){let i=`${e.font}|${e.fontSize}|${e.lineHeight}|${e.letterSpacing}|${e.width}|${t}`,r=this._measureCache.get(i);if(void 0!==r)return r;let s=0,n=this._engine;if(n&&!this._crashed&&this._fontsFlushed.has(e.font))try{let[,i]=n.scene.measureTextNaturalSize({size:[e.width,e.height],text:t,fontSize:e.fontSize,horizontalAlign:lt[e.horizontalAlign]??"Left",verticalAlign:dt[e.verticalAlign]??"Top",lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textTransform:"None",font:e.font,version:0,autoSize:"None",truncate:"None"});s=i}catch{}if(!(s>0)){let i=.55*e.fontSize+Math.max(0,e.letterSpacing),r=Math.max(1,Math.floor(e.width/i)),n=0;for(let e of t.split("\n"))n+=Math.max(1,Math.ceil(e.length/r));s=n*e.fontSize*e.lineHeight}return this._measureCache.size>512&&this._measureCache.clear(),this._measureCache.set(i,s),s}clear(){this._shapes=[],this._ctm=_.identity(),this._stack.length=0,this._clips.length=0}render(){let t=this._engine;if(!t||this._crashed)return;let e=JSON.stringify(this._shapes);e!==this._lastPushedJSON&&(this._guard(()=>t.scene.updateUiShapes(this._shapes)),this._lastPushedJSON=e),this._guard(()=>t.onFrame())}},ot={inside:"Inside",outside:"Outside",center:"Center"},lt={1:"Left",2:"Right",3:"Center",4:"Justify"},dt={1:"Top",2:"Center",3:"Bottom"};function ut({r:t,g:e,b:i,a:r}){return[t,e,i,r]}function ct(t){for(let e=0;e<t.length;e++)if(void 0!==t[e]&&!Number.isFinite(t[e]))return!1;return!0}function pt(t,e){let[i,r,s,n]=t.radii;return 0===i&&0===r&&0===s&&0===n?{Rectangle:{x:t.x,y:t.y,width:t.w,height:t.h}}:{RoundedRectangle:{x:t.x,y:t.y,width:t.w,height:t.h,radius:[i,r,s,n],corner_smoothing:e}}}function ft(t){if("Rectangle"in t){let e=t.Rectangle;return{x:e.x,y:e.y,w:e.width,h:e.height,radii:[0,0,0,0]}}if("RoundedRectangle"in t){let e=t.RoundedRectangle;return{x:e.x,y:e.y,w:e.width,h:e.height,radii:[e.radius[0],e.radius[1],e.radius[2],e.radius[3]]}}return null}function xt(t){let e=ft(t);if(e)return{minX:e.x,minY:e.y,maxX:e.x+e.w,maxY:e.y+e.h};if("Ellipse"in t){let e=t.Ellipse;return{minX:e.center_x-e.rx,minY:e.center_y-e.ry,maxX:e.center_x+e.rx,maxY:e.center_y+e.ry}}if("TextSimple"in t){let e=t.TextSimple;return{minX:0,minY:0,maxX:e.size[0],maxY:e.size[1]}}if("Custom"in t){let e=1/0,i=1/0,r=-1/0,s=-1/0,n=t=>{t.x<e&&(e=t.x),t.y<i&&(i=t.y),t.x>r&&(r=t.x),t.y>s&&(s=t.y)};for(let e of t.Custom)"ClosePath"!==e&&("MoveTo"in e?n(e.MoveTo):"LineTo"in e?n(e.LineTo):"QuadTo"in e?e.QuadTo.forEach(n):"CurveTo"in e&&e.CurveTo.forEach(n));return e===1/0?null:{minX:e,minY:i,maxX:r,maxY:s}}return null}function gt(t,e){let{x:i,y:r,w:s,h:n}=e,a=Math.min(s,n)/2,[h,o,l,d]=e.radii.map(t=>Math.max(0,Math.min(t,a)));if(0===h&&0===o&&0===l&&0===d)return void t.push({MoveTo:{x:i,y:r}},{LineTo:{x:i+s,y:r}},{LineTo:{x:i+s,y:r+n}},{LineTo:{x:i,y:r+n}},"ClosePath");let u=1-it;t.push({MoveTo:{x:i+h,y:r}}),t.push({LineTo:{x:i+s-o,y:r}}),o>0&&t.push({CurveTo:[{x:i+s-o*u,y:r},{x:i+s,y:r+o*u},{x:i+s,y:r+o}]}),t.push({LineTo:{x:i+s,y:r+n-l}}),l>0&&t.push({CurveTo:[{x:i+s,y:r+n-l*u},{x:i+s-l*u,y:r+n},{x:i+s-l,y:r+n}]}),t.push({LineTo:{x:i+d,y:r+n}}),d>0&&t.push({CurveTo:[{x:i+d*u,y:r+n},{x:i,y:r+n-d*u},{x:i,y:r+n-d}]}),t.push({LineTo:{x:i,y:r+h}}),h>0&&t.push({CurveTo:[{x:i,y:r+h*u},{x:i+h*u,y:r},{x:i+h,y:r}]}),t.push("ClosePath")}function mt({constraints:t,newParentWidth:e,newParentHeight:i,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:n,objectInitialHeight:a,objectInitialPosition:h}){let{horizontalConstraint:o,verticalConstraint:l}=t,d=e-r,u=i-s,c=n,p=a,f=h[0],x=h[1];if(0!==o)if(1===o)f+=d;else if(3===o)f+=d/2;else if(2===o)c=Math.max(1,c+d);else if(4===o){let t=e/r;c*=t,f*=t}if(0!==l)if(1===l)x+=u;else if(3===l)x+=u/2;else if(2===l)p=Math.max(1,p+u);else if(4===l){let t=i/s;p*=t,x*=t}return{width:c,height:p,position:[f,x]}}u(g(),1);export{_ as a,y as b,v as c,ht as d,F as e,U as f,N as g,j as h,W as i,X as j,$ as k,Q as l,K as m,mt as n};
@@ -1 +1 @@
1
- import{a as e,b as i}from"./runtime-chunk-EJJZJ5MV.js";import{E as t,F as s,ea as o}from"./runtime-chunk-DK66VKWP.js";import{v as r}from"./runtime-chunk-CKT62HES.js";import{Fc as h,Oc as a,Xc as d,cd as n}from"./runtime-chunk-VGN7YHB7.js";var l=new d,u=new h;function m(e){let i=!1;return e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&"SubdivGeometry"===t.geometry.type&&(i=!0)}),i}var y=class extends o{constructor(e,i,t){super(e,i,t),this.data=i,this.hiddenMatrixOld=new a,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return void 0!==this.localGeometry?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return void 0!==this.localGeometry?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,i){let t=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),i.set(t.width,t.height,t.depth??0).multiplyScalar(.5)}createGeometryByControls(s){if(!0===this.skipReactionUpdate)return;let o=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:h,subdivPointer:a}=t.build(s,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=a,void 0!==r&&(this.originalGeometry?.dispose(),this.originalGeometry=r),void 0!==h&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=h??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),this.calcBoundingBox(),o&&(this.localGeometry.uuid=o)}updateState(e,i){if(super.updateState(e,i),void 0!==e.flatShading){let t=this.material;this.material=Array.isArray(t)?t.map(e=>e.getFlavor(!1,e.side,e.wireframe)):t.getFlavor(!1,t.side,t.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(i)}}updateMesh(e=!1,i=!1,s=!1){i&&this.subdividedGeometry||t.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0,s),this.subdividedGeometry&&t.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let s=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=t.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=t.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),this.calcBoundingBox(),s&&(this.localGeometry.uuid=s)}raycast(e,i){let t=this.localGeometry;this.localGeometry=this.originalGeometryNew,r.prototype.raycast.call(this,e,i),this.localGeometry=t}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new n,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let i=e.attributes.position,t=e.boundingSphere.center;l.setFromBufferAttribute(i),l.getCenter(t),e.boundingSphere.radius=t.distanceTo(l.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),l.getSize(u),this.hasNonUniformScale&&u.divide(this.scale);let s={width:u.x,height:u.y,depth:u.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let i=this.originalGeometry;l.min.set(e[0],e[2],e[4]),l.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(l.min.applyMatrix4(this.shearScaleInv),l.max.applyMatrix4(this.shearScaleInv)),null===i.boundingSphere&&(i.boundingSphere=new n);let t=i.boundingSphere.center;l.getCenter(t),i.boundingSphere.radius=t.distanceTo(l.max)}freeSubdivPointer(){this.subdivPointer&&(t.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(s){if(!0===this.skipReactionUpdate)return;let o=this.localGeometry,r=o?.uuid,h=o?.userData.parameters,a=s.subdivisions>0?t.buildRefined(this.subdivPointer,s.subdivisions,this.smoothShading?s.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=a??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),void 0!==h&&(this.localGeometry.userData.parameters=h),r&&(this.localGeometry.uuid=r)}updateByPatchedOpGeometry(e,i,t){super.updateByPatchedOpGeometry(e,i,t),this.localGeometry&&(0===e.type&&0===e.path.length&&s(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(i):this.createGeometryByControls(i))}};export{m as a,y as b};
1
+ import{a as e,b as i}from"./runtime-chunk-M4BPCY7K.js";import{E as t,F as s,ea as o}from"./runtime-chunk-7FDJ7IIR.js";import{v as r}from"./runtime-chunk-MOZWC42D.js";import{Fc as h,Oc as a,Xc as d,cd as n}from"./runtime-chunk-VGN7YHB7.js";var l=new d,u=new h;function m(e){let i=!1;return e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&"SubdivGeometry"===t.geometry.type&&(i=!0)}),i}var y=class extends o{constructor(e,i,t){super(e,i,t),this.data=i,this.hiddenMatrixOld=new a,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return void 0!==this.localGeometry?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return void 0!==this.localGeometry?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,i){let t=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),i.set(t.width,t.height,t.depth??0).multiplyScalar(.5)}createGeometryByControls(s){if(!0===this.skipReactionUpdate)return;let o=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:h,subdivPointer:a}=t.build(s,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=a,void 0!==r&&(this.originalGeometry?.dispose(),this.originalGeometry=r),void 0!==h&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=h??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),this.calcBoundingBox(),o&&(this.localGeometry.uuid=o)}updateState(e,i){if(super.updateState(e,i),void 0!==e.flatShading){let t=this.material;this.material=Array.isArray(t)?t.map(e=>e.getFlavor(!1,e.side,e.wireframe)):t.getFlavor(!1,t.side,t.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(i)}}updateMesh(e=!1,i=!1,s=!1){i&&this.subdividedGeometry||t.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0,s),this.subdividedGeometry&&t.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let s=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=t.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=t.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),this.calcBoundingBox(),s&&(this.localGeometry.uuid=s)}raycast(e,i){let t=this.localGeometry;this.localGeometry=this.originalGeometryNew,r.prototype.raycast.call(this,e,i),this.localGeometry=t}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new n,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let i=e.attributes.position,t=e.boundingSphere.center;l.setFromBufferAttribute(i),l.getCenter(t),e.boundingSphere.radius=t.distanceTo(l.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),l.getSize(u),this.hasNonUniformScale&&u.divide(this.scale);let s={width:u.x,height:u.y,depth:u.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let i=this.originalGeometry;l.min.set(e[0],e[2],e[4]),l.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(l.min.applyMatrix4(this.shearScaleInv),l.max.applyMatrix4(this.shearScaleInv)),null===i.boundingSphere&&(i.boundingSphere=new n);let t=i.boundingSphere.center;l.getCenter(t),i.boundingSphere.radius=t.distanceTo(l.max)}freeSubdivPointer(){this.subdivPointer&&(t.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(s){if(!0===this.skipReactionUpdate)return;let o=this.localGeometry,r=o?.uuid,h=o?.userData.parameters,a=s.subdivisions>0?t.buildRefined(this.subdivPointer,s.subdivisions,this.smoothShading?s.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=a??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,e(this),i(this),void 0!==h&&(this.localGeometry.userData.parameters=h),r&&(this.localGeometry.uuid=r)}updateByPatchedOpGeometry(e,i,t){super.updateByPatchedOpGeometry(e,i,t),this.localGeometry&&(0===e.type&&0===e.path.length&&s(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(i):this.createGeometryByControls(i))}};export{m as a,y as b};