@splinetool/runtime 2.0.25 → 2.0.27

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 (263) hide show
  1. package/build/{runtime-chunk-W6CBB6HF.js → runtime-chunk-26DBBUXP.js} +1 -1
  2. package/build/runtime-chunk-26DBBUXP.js.br +0 -0
  3. package/build/runtime-chunk-26DBBUXP.js.gz +0 -0
  4. package/build/{runtime-chunk-IT5GSRUQ.js → runtime-chunk-6UJ5JOQP.js} +1 -1
  5. package/build/runtime-chunk-6UJ5JOQP.js.br +0 -0
  6. package/build/runtime-chunk-6UJ5JOQP.js.gz +0 -0
  7. package/build/{runtime-chunk-ZAQHRZOM.js → runtime-chunk-ESSYLO5K.js} +1 -1
  8. package/build/runtime-chunk-ESSYLO5K.js.br +0 -0
  9. package/build/runtime-chunk-ESSYLO5K.js.gz +0 -0
  10. package/build/{runtime-chunk-III3PY57.js → runtime-chunk-F6RDX4M2.js} +1 -1
  11. package/build/runtime-chunk-F6RDX4M2.js.br +0 -0
  12. package/build/runtime-chunk-F6RDX4M2.js.gz +0 -0
  13. package/build/{runtime-chunk-6G2UV3Q3.js → runtime-chunk-H5VZQLYA.js} +1 -1
  14. package/build/{runtime-chunk-6G2UV3Q3.js.br → runtime-chunk-H5VZQLYA.js.br} +0 -0
  15. package/build/runtime-chunk-H5VZQLYA.js.gz +0 -0
  16. package/build/{runtime-chunk-OD3BRITR.js → runtime-chunk-IOF7TM7C.js} +1 -1
  17. package/build/runtime-chunk-IOF7TM7C.js.br +0 -0
  18. package/build/runtime-chunk-IOF7TM7C.js.gz +0 -0
  19. package/build/{runtime-chunk-CZOW5UET.js → runtime-chunk-J362S5H7.js} +1 -1
  20. package/build/runtime-chunk-J362S5H7.js.br +0 -0
  21. package/build/runtime-chunk-J362S5H7.js.gz +0 -0
  22. package/build/{runtime-chunk-A6KXWGB5.js → runtime-chunk-J7LRIDY2.js} +1 -1
  23. package/build/runtime-chunk-J7LRIDY2.js.br +0 -0
  24. package/build/runtime-chunk-J7LRIDY2.js.gz +0 -0
  25. package/build/{runtime-chunk-YK4LBPDN.js → runtime-chunk-JXBURRB4.js} +1 -1
  26. package/build/runtime-chunk-JXBURRB4.js.br +0 -0
  27. package/build/runtime-chunk-JXBURRB4.js.gz +0 -0
  28. package/build/{runtime-chunk-ZP5E3FUX.js → runtime-chunk-LQUI2XCJ.js} +1 -1
  29. package/build/runtime-chunk-LQUI2XCJ.js.br +0 -0
  30. package/build/runtime-chunk-LQUI2XCJ.js.gz +0 -0
  31. package/build/{runtime-chunk-5JV6Q5VM.js → runtime-chunk-MJDYWOWK.js} +1 -1
  32. package/build/runtime-chunk-MJDYWOWK.js.br +0 -0
  33. package/build/runtime-chunk-MJDYWOWK.js.gz +0 -0
  34. package/build/{runtime-chunk-TTYK7PPG.js → runtime-chunk-NBDV3A7D.js} +1 -1
  35. package/build/{runtime-chunk-TTYK7PPG.js.br → runtime-chunk-NBDV3A7D.js.br} +0 -0
  36. package/build/{runtime-chunk-TTYK7PPG.js.gz → runtime-chunk-NBDV3A7D.js.gz} +0 -0
  37. package/build/{runtime-chunk-K7HUQUBO.js → runtime-chunk-OD6QVEIF.js} +1 -1
  38. package/build/runtime-chunk-OD6QVEIF.js.br +0 -0
  39. package/build/runtime-chunk-OD6QVEIF.js.gz +0 -0
  40. package/build/{runtime-chunk-DGOXAYKE.js → runtime-chunk-PXDY3IWO.js} +1 -1
  41. package/build/runtime-chunk-PXDY3IWO.js.br +0 -0
  42. package/build/runtime-chunk-PXDY3IWO.js.gz +0 -0
  43. package/build/{runtime-chunk-XKB5FGZ7.js → runtime-chunk-QDF7PADZ.js} +1 -1
  44. package/build/{runtime-chunk-XKB5FGZ7.js.br → runtime-chunk-QDF7PADZ.js.br} +0 -0
  45. package/build/runtime-chunk-QDF7PADZ.js.gz +0 -0
  46. package/build/runtime-chunk-RBSYXNI5.js +1 -0
  47. package/build/runtime-chunk-RBSYXNI5.js.br +0 -0
  48. package/build/runtime-chunk-RBSYXNI5.js.gz +0 -0
  49. package/build/{runtime-chunk-RYPQ4UYZ.js → runtime-chunk-S37K5VV5.js} +1 -1
  50. package/build/runtime-chunk-S37K5VV5.js.br +0 -0
  51. package/build/runtime-chunk-S37K5VV5.js.gz +0 -0
  52. package/build/{runtime-chunk-COQMTU7H.js → runtime-chunk-SHOX6WJ3.js} +1 -1
  53. package/build/runtime-chunk-SHOX6WJ3.js.br +0 -0
  54. package/build/runtime-chunk-SHOX6WJ3.js.gz +0 -0
  55. package/build/{runtime-chunk-XV4XI3BX.js → runtime-chunk-SY3NKCSI.js} +1 -1
  56. package/build/runtime-chunk-SY3NKCSI.js.br +0 -0
  57. package/build/runtime-chunk-SY3NKCSI.js.gz +0 -0
  58. package/build/{runtime-chunk-IQDIX4JZ.js → runtime-chunk-SYSV3PRC.js} +1 -1
  59. package/build/runtime-chunk-SYSV3PRC.js.br +0 -0
  60. package/build/runtime-chunk-SYSV3PRC.js.gz +0 -0
  61. package/build/{runtime-chunk-7TJXMO5V.js → runtime-chunk-TQNNI2FL.js} +1 -1
  62. package/build/runtime-chunk-TQNNI2FL.js.br +0 -0
  63. package/build/runtime-chunk-TQNNI2FL.js.gz +0 -0
  64. package/build/{runtime-chunk-JK5SZBXI.js → runtime-chunk-U6E6B4F2.js} +1 -1
  65. package/build/runtime-chunk-U6E6B4F2.js.br +0 -0
  66. package/build/runtime-chunk-U6E6B4F2.js.gz +0 -0
  67. package/build/{runtime-chunk-W3AWVQGD.js → runtime-chunk-UGRMZ63N.js} +1 -1
  68. package/build/runtime-chunk-UGRMZ63N.js.br +0 -0
  69. package/build/runtime-chunk-UGRMZ63N.js.gz +0 -0
  70. package/build/{runtime-chunk-2G3XRBSE.js → runtime-chunk-Z7QBR5P5.js} +1 -1
  71. package/build/runtime-chunk-Z7QBR5P5.js.br +0 -0
  72. package/build/runtime-chunk-Z7QBR5P5.js.gz +0 -0
  73. package/build/{runtime-chunk-UNCE2XMH.js → runtime-chunk-ZUNT2AWI.js} +1 -1
  74. package/build/runtime-chunk-ZUNT2AWI.js.br +0 -0
  75. package/build/runtime-chunk-ZUNT2AWI.js.gz +0 -0
  76. package/build/{runtime-classicRuntime-VISVFQLA.js → runtime-classicRuntime-RMKRFJX7.js} +1 -1
  77. package/build/runtime-classicRuntime-RMKRFJX7.js.br +0 -0
  78. package/build/runtime-classicRuntime-RMKRFJX7.js.gz +0 -0
  79. package/build/{runtime-cloners-DA5GJ2YG.js → runtime-cloners-XXEZRLPJ.js} +1 -1
  80. package/build/runtime-cloners-XXEZRLPJ.js.br +0 -0
  81. package/build/runtime-cloners-XXEZRLPJ.js.gz +0 -0
  82. package/build/{runtime-components-45VFYEWA.js → runtime-components-KLWPKJCD.js} +1 -1
  83. package/build/runtime-components-KLWPKJCD.js.br +0 -0
  84. package/build/runtime-components-KLWPKJCD.js.gz +0 -0
  85. package/build/{runtime-createDestroy-7WD5EPLW.js → runtime-createDestroy-OEWMNDJU.js} +1 -1
  86. package/build/runtime-createDestroy-OEWMNDJU.js.br +0 -0
  87. package/build/runtime-createDestroy-OEWMNDJU.js.gz +0 -0
  88. package/build/{runtime-dragDrop-ME2ZSZKX.js → runtime-dragDrop-LKB22YGO.js} +1 -1
  89. package/build/runtime-dragDrop-LKB22YGO.js.br +0 -0
  90. package/build/runtime-dragDrop-LKB22YGO.js.gz +0 -0
  91. package/build/{runtime-gameControls-GXMGUAHJ.js → runtime-gameControls-24HTAYDT.js} +1 -1
  92. package/build/runtime-gameControls-24HTAYDT.js.br +0 -0
  93. package/build/runtime-gameControls-24HTAYDT.js.gz +0 -0
  94. package/build/{runtime-hair-5KIPB6G4.js → runtime-hair-VKMXM2HN.js} +1 -1
  95. package/build/runtime-hair-VKMXM2HN.js.br +3 -0
  96. package/build/runtime-hair-VKMXM2HN.js.gz +0 -0
  97. package/build/{runtime-mergeStaticGeometries-JADSU6ON.js → runtime-mergeStaticGeometries-LHKAYDJF.js} +1 -1
  98. package/build/runtime-mergeStaticGeometries-LHKAYDJF.js.br +0 -0
  99. package/build/runtime-mergeStaticGeometries-LHKAYDJF.js.gz +0 -0
  100. package/build/{runtime-miscActions-HV3LXJC4.js → runtime-miscActions-2ZXULNTS.js} +1 -1
  101. package/build/runtime-miscActions-2ZXULNTS.js.br +0 -0
  102. package/build/runtime-miscActions-2ZXULNTS.js.gz +0 -0
  103. package/build/{runtime-mouseHover-4FLOQ33Q.js → runtime-mouseHover-X3SUIUNE.js} +1 -1
  104. package/build/runtime-mouseHover-X3SUIUNE.js.br +0 -0
  105. package/build/runtime-mouseHover-X3SUIUNE.js.gz +0 -0
  106. package/build/{runtime-particles-IWZ2A2ZT.js → runtime-particles-AHP5WNPJ.js} +1 -1
  107. package/build/runtime-particles-AHP5WNPJ.js.br +0 -0
  108. package/build/runtime-particles-AHP5WNPJ.js.gz +0 -0
  109. package/build/{runtime-paths-7VX3FIAI.js → runtime-paths-B4YOK3H7.js} +1 -1
  110. package/build/runtime-paths-B4YOK3H7.js.br +0 -0
  111. package/build/runtime-paths-B4YOK3H7.js.gz +0 -0
  112. package/build/{runtime-resize-ANAQRV3G.js → runtime-resize-6YQJXUV3.js} +1 -1
  113. package/build/runtime-resize-6YQJXUV3.js.br +0 -0
  114. package/build/runtime-resize-6YQJXUV3.js.gz +0 -0
  115. package/build/{runtime-sceneTransition-WMJAE4CW.js → runtime-sceneTransition-YABGBVI2.js} +1 -1
  116. package/build/runtime-sceneTransition-YABGBVI2.js.br +0 -0
  117. package/build/runtime-sceneTransition-YABGBVI2.js.gz +0 -0
  118. package/build/{runtime-scroll-6LPASL7K.js → runtime-scroll-NLQD3ZBC.js} +1 -1
  119. package/build/runtime-scroll-NLQD3ZBC.js.br +0 -0
  120. package/build/runtime-scroll-NLQD3ZBC.js.gz +0 -0
  121. package/build/runtime-shapeBlends-H2MWUFZ2.js +1 -0
  122. package/build/runtime-shapeBlends-H2MWUFZ2.js.br +0 -0
  123. package/build/runtime-shapeBlends-H2MWUFZ2.js.gz +0 -0
  124. package/build/{runtime-text-CMK26YI5.js → runtime-text-VFKGAFAH.js} +1 -1
  125. package/build/runtime-text-VFKGAFAH.js.br +0 -0
  126. package/build/runtime-text-VFKGAFAH.js.gz +0 -0
  127. package/build/{runtime-textInputs-3MC2BBQI.js → runtime-textInputs-2RUIT3YF.js} +1 -1
  128. package/build/runtime-textInputs-2RUIT3YF.js.br +0 -0
  129. package/build/runtime-textInputs-2RUIT3YF.js.gz +0 -0
  130. package/build/{runtime-timeline-GNNPV7ZF.js → runtime-timeline-2JDILE3C.js} +1 -1
  131. package/build/runtime-timeline-2JDILE3C.js.br +0 -0
  132. package/build/runtime-timeline-2JDILE3C.js.gz +0 -0
  133. package/build/{runtime-tracking-FCGTKPDC.js → runtime-tracking-E3EU2NCE.js} +1 -1
  134. package/build/runtime-tracking-E3EU2NCE.js.br +0 -0
  135. package/build/runtime-tracking-E3EU2NCE.js.gz +0 -0
  136. package/build/{runtime-transitions-6M3RBBMQ.js → runtime-transitions-5Q3K5NPG.js} +1 -1
  137. package/build/runtime-transitions-5Q3K5NPG.js.br +0 -0
  138. package/build/runtime-transitions-5Q3K5NPG.js.gz +0 -0
  139. package/build/{runtime-ui2d-XSGM4BYR.js → runtime-ui2d-2M3VG4T4.js} +1 -1
  140. package/build/runtime-ui2d-2M3VG4T4.js.br +0 -0
  141. package/build/runtime-ui2d-2M3VG4T4.js.gz +0 -0
  142. package/build/{runtime-vectorShapes-474UD7EK.js → runtime-vectorShapes-HBC6LEXK.js} +1 -1
  143. package/build/runtime-vectorShapes-HBC6LEXK.js.br +0 -0
  144. package/build/runtime-vectorShapes-HBC6LEXK.js.gz +0 -0
  145. package/build/{runtime-webgpu-VBBMA2RD.js → runtime-webgpu-CNMVROCO.js} +1 -1
  146. package/build/runtime-webgpu-CNMVROCO.js.br +0 -0
  147. package/build/runtime-webgpu-CNMVROCO.js.gz +0 -0
  148. package/build/runtime.cjs +6 -6
  149. package/build/runtime.js +1 -1
  150. package/build/runtime.js.br +0 -0
  151. package/build/runtime.js.gz +0 -0
  152. package/build/runtime.standalone.js +1 -1
  153. package/build/runtime.standalone.js.br +0 -0
  154. package/build/runtime.standalone.js.gz +0 -0
  155. package/build/runtime.standalone.webgl.js +1 -1
  156. package/build/runtime.standalone.webgl.js.br +0 -0
  157. package/build/runtime.standalone.webgl.js.gz +0 -0
  158. package/build/runtime.standalone.webgpu.js +1 -1
  159. package/build/runtime.standalone.webgpu.js.br +0 -0
  160. package/build/runtime.standalone.webgpu.js.gz +0 -0
  161. package/build/runtime.standalone.webgpu.micro.js +1 -1
  162. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  163. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  164. package/build/runtime.standalone.webgpu.min.js +1 -1
  165. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  166. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  167. package/package.json +1 -1
  168. package/build/runtime-chunk-2G3XRBSE.js.br +0 -0
  169. package/build/runtime-chunk-2G3XRBSE.js.gz +0 -0
  170. package/build/runtime-chunk-5JV6Q5VM.js.br +0 -0
  171. package/build/runtime-chunk-5JV6Q5VM.js.gz +0 -0
  172. package/build/runtime-chunk-6G2UV3Q3.js.gz +0 -0
  173. package/build/runtime-chunk-7TJXMO5V.js.br +0 -0
  174. package/build/runtime-chunk-7TJXMO5V.js.gz +0 -0
  175. package/build/runtime-chunk-A6KXWGB5.js.br +0 -0
  176. package/build/runtime-chunk-A6KXWGB5.js.gz +0 -0
  177. package/build/runtime-chunk-COQMTU7H.js.br +0 -0
  178. package/build/runtime-chunk-COQMTU7H.js.gz +0 -0
  179. package/build/runtime-chunk-CSJ2DZY7.js +0 -1
  180. package/build/runtime-chunk-CSJ2DZY7.js.br +0 -0
  181. package/build/runtime-chunk-CSJ2DZY7.js.gz +0 -0
  182. package/build/runtime-chunk-CZOW5UET.js.br +0 -0
  183. package/build/runtime-chunk-CZOW5UET.js.gz +0 -0
  184. package/build/runtime-chunk-DGOXAYKE.js.br +0 -0
  185. package/build/runtime-chunk-DGOXAYKE.js.gz +0 -0
  186. package/build/runtime-chunk-III3PY57.js.br +0 -0
  187. package/build/runtime-chunk-III3PY57.js.gz +0 -0
  188. package/build/runtime-chunk-IQDIX4JZ.js.br +0 -0
  189. package/build/runtime-chunk-IQDIX4JZ.js.gz +0 -0
  190. package/build/runtime-chunk-IT5GSRUQ.js.br +0 -0
  191. package/build/runtime-chunk-IT5GSRUQ.js.gz +0 -0
  192. package/build/runtime-chunk-JK5SZBXI.js.br +0 -0
  193. package/build/runtime-chunk-JK5SZBXI.js.gz +0 -0
  194. package/build/runtime-chunk-K7HUQUBO.js.br +0 -0
  195. package/build/runtime-chunk-K7HUQUBO.js.gz +0 -0
  196. package/build/runtime-chunk-OD3BRITR.js.br +0 -0
  197. package/build/runtime-chunk-OD3BRITR.js.gz +0 -0
  198. package/build/runtime-chunk-RYPQ4UYZ.js.br +0 -0
  199. package/build/runtime-chunk-RYPQ4UYZ.js.gz +0 -0
  200. package/build/runtime-chunk-UNCE2XMH.js.br +0 -0
  201. package/build/runtime-chunk-UNCE2XMH.js.gz +0 -0
  202. package/build/runtime-chunk-W3AWVQGD.js.br +0 -0
  203. package/build/runtime-chunk-W3AWVQGD.js.gz +0 -0
  204. package/build/runtime-chunk-W6CBB6HF.js.br +0 -0
  205. package/build/runtime-chunk-W6CBB6HF.js.gz +0 -0
  206. package/build/runtime-chunk-XKB5FGZ7.js.gz +0 -0
  207. package/build/runtime-chunk-XV4XI3BX.js.br +0 -0
  208. package/build/runtime-chunk-XV4XI3BX.js.gz +0 -0
  209. package/build/runtime-chunk-YK4LBPDN.js.br +0 -0
  210. package/build/runtime-chunk-YK4LBPDN.js.gz +0 -0
  211. package/build/runtime-chunk-ZAQHRZOM.js.br +0 -0
  212. package/build/runtime-chunk-ZAQHRZOM.js.gz +0 -0
  213. package/build/runtime-chunk-ZP5E3FUX.js.br +0 -0
  214. package/build/runtime-chunk-ZP5E3FUX.js.gz +0 -0
  215. package/build/runtime-classicRuntime-VISVFQLA.js.br +0 -0
  216. package/build/runtime-classicRuntime-VISVFQLA.js.gz +0 -0
  217. package/build/runtime-cloners-DA5GJ2YG.js.br +0 -0
  218. package/build/runtime-cloners-DA5GJ2YG.js.gz +0 -0
  219. package/build/runtime-components-45VFYEWA.js.br +0 -0
  220. package/build/runtime-components-45VFYEWA.js.gz +0 -0
  221. package/build/runtime-createDestroy-7WD5EPLW.js.br +0 -0
  222. package/build/runtime-createDestroy-7WD5EPLW.js.gz +0 -0
  223. package/build/runtime-dragDrop-ME2ZSZKX.js.br +0 -0
  224. package/build/runtime-dragDrop-ME2ZSZKX.js.gz +0 -0
  225. package/build/runtime-gameControls-GXMGUAHJ.js.br +0 -0
  226. package/build/runtime-gameControls-GXMGUAHJ.js.gz +0 -0
  227. package/build/runtime-hair-5KIPB6G4.js.br +0 -2
  228. package/build/runtime-hair-5KIPB6G4.js.gz +0 -0
  229. package/build/runtime-mergeStaticGeometries-JADSU6ON.js.br +0 -0
  230. package/build/runtime-mergeStaticGeometries-JADSU6ON.js.gz +0 -0
  231. package/build/runtime-miscActions-HV3LXJC4.js.br +0 -0
  232. package/build/runtime-miscActions-HV3LXJC4.js.gz +0 -0
  233. package/build/runtime-mouseHover-4FLOQ33Q.js.br +0 -0
  234. package/build/runtime-mouseHover-4FLOQ33Q.js.gz +0 -0
  235. package/build/runtime-particles-IWZ2A2ZT.js.br +0 -0
  236. package/build/runtime-particles-IWZ2A2ZT.js.gz +0 -0
  237. package/build/runtime-paths-7VX3FIAI.js.br +0 -0
  238. package/build/runtime-paths-7VX3FIAI.js.gz +0 -0
  239. package/build/runtime-resize-ANAQRV3G.js.br +0 -0
  240. package/build/runtime-resize-ANAQRV3G.js.gz +0 -0
  241. package/build/runtime-sceneTransition-WMJAE4CW.js.br +0 -0
  242. package/build/runtime-sceneTransition-WMJAE4CW.js.gz +0 -0
  243. package/build/runtime-scroll-6LPASL7K.js.br +0 -0
  244. package/build/runtime-scroll-6LPASL7K.js.gz +0 -0
  245. package/build/runtime-shapeBlends-M4GBLHA6.js +0 -1
  246. package/build/runtime-shapeBlends-M4GBLHA6.js.br +0 -3
  247. package/build/runtime-shapeBlends-M4GBLHA6.js.gz +0 -0
  248. package/build/runtime-text-CMK26YI5.js.br +0 -0
  249. package/build/runtime-text-CMK26YI5.js.gz +0 -0
  250. package/build/runtime-textInputs-3MC2BBQI.js.br +0 -0
  251. package/build/runtime-textInputs-3MC2BBQI.js.gz +0 -0
  252. package/build/runtime-timeline-GNNPV7ZF.js.br +0 -0
  253. package/build/runtime-timeline-GNNPV7ZF.js.gz +0 -0
  254. package/build/runtime-tracking-FCGTKPDC.js.br +0 -0
  255. package/build/runtime-tracking-FCGTKPDC.js.gz +0 -0
  256. package/build/runtime-transitions-6M3RBBMQ.js.br +0 -0
  257. package/build/runtime-transitions-6M3RBBMQ.js.gz +0 -0
  258. package/build/runtime-ui2d-XSGM4BYR.js.br +0 -0
  259. package/build/runtime-ui2d-XSGM4BYR.js.gz +0 -0
  260. package/build/runtime-vectorShapes-474UD7EK.js.br +0 -0
  261. package/build/runtime-vectorShapes-474UD7EK.js.gz +0 -0
  262. package/build/runtime-webgpu-VBBMA2RD.js.br +0 -0
  263. package/build/runtime-webgpu-VBBMA2RD.js.gz +0 -0
package/build/runtime.cjs CHANGED
@@ -3827,7 +3827,7 @@ void main() {
3827
3827
  squared_mean = squared_mean / samples;
3828
3828
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
3829
3829
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
3830
- }`,nZ=[new M(1,0,0),new M(-1,0,0),new M(0,1,0),new M(0,-1,0),new M(0,0,1),new M(0,0,-1)],rZ=[new M(0,-1,0),new M(0,-1,0),new M(0,0,1),new M(0,0,-1),new M(0,-1,0),new M(0,-1,0)],zN=new ne,My=new M,zA=new M;lZ=new ne,XN=new wt;XN.set(-1,0,0,0,1,0,0,0,1);uZ=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Ia=null;hS=class{constructor(t={}){let{canvas:e=mN(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:h=!1,outputBufferType:p=Dn}=t;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=o;let g=p,m=new Set([wp,A0,_0]),y=new Set([Dn,ws,Sp,Md,T0,M0]),v=new Uint32Array(4),b=new Int32Array(4),x=new M,S=null,E=null,T=[],w=[],_=null;this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Pa,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let A=this,C=!1,P=null,D=null,O=null,L=null;this._outputColorSpace=Rt;let U=0,G=0,Y=null,oe=-1,ee=null,J=new vt,Q=new vt,re=null,me=new Ze(0),ve=0,pe=e.width,Ee=e.height,ce=1,Se=null,Pe=null,Le=new vt(0,0,pe,Ee),ke=new vt(0,0,pe,Ee),Ce=!1,le=new lp,ye=!1,Te=!1,Ne=new ne,He=new M,Me=new vt,Oe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},B=!1;function fe(){return Y===null?ce:1}let W=n;function et(k,se){return e.getContext(k,se)}try{let k={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${zs}`),e.addEventListener("webglcontextlost",vr,!1),e.addEventListener("webglcontextrestored",Vn,!1),e.addEventListener("webglcontextcreationerror",no,!1),W===null){let se="webgl2";if(W=et(se,k),W===null)throw et(se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(k){throw Dt("WebGLRenderer: "+k.message),k}let Ge,z,I,q,Z,ae,be,Fe,ue,_e,Ke,xt,Je,Xe,rt,yt,Ut,$,Ye,Ae,$e,ot,Ue;function St(){Ge=new S$(W),Ge.init(),$e=new aZ(W,Ge),z=new v$(W,Ge,t,$e),I=new sZ(W,Ge),z.reversedDepthBuffer&&h&&I.buffers.depth.setReversed(!0),D=W.createFramebuffer(),O=W.createFramebuffer(),L=W.createFramebuffer(),q=new T$(W),Z=new WK,ae=new oZ(W,Ge,I,Z,z,$e,q),be=new x$(A),Fe=new DX(W),ot=new g$(W,Fe),ue=new w$(W,Fe,q,ot),_e=new _$(W,ue,Fe,ot,q),$=new M$(W,z,ae),rt=new b$(Z),Ke=new HK(A,be,Ge,z,ot,rt),xt=new cZ(A,Z),Je=new XK,Xe=new JK(Ge),Ut=new m$(A,be,I,_e,f,l),yt=new iZ(A,_e,z),Ue={update(){throw new Error("UniformsGroups are not supported by the Spline runtime")},bind(){throw new Error("UniformsGroups are not supported by the Spline runtime")},dispose(){}},Ye=new y$(W,Ge,q),Ae=new E$(W,Ge,q),q.programs=Ke.programs,A.capabilities=z,A.extensions=Ge,A.properties=Z,A.renderLists=Je,A.shadowMap=yt,A.state=I,A.info=q}St(),g!==Dn&&(_=new C$(g,e.width,e.height,a,r,s));let ft=Object.assign(new _n,{enabled:!1,isPresenting:!1,cameraAutoUpdate:!0,setFramebufferScaleFactor(){},setReferenceSpaceType(){},getReferenceSpace(){return null},setReferenceSpace(){},getBaseLayer(){return null},getBinding(){return null},getFrame(){return null},getSession(){return null},async setSession(){throw new Error("WebXR is not supported by the Spline runtime")},getEnvironmentBlendMode(){},getDepthTexture(){return null},updateCamera(){},getCamera(){return null},getFoveation(){},setFoveation(){},hasDepthSensing(){return!1},getDepthSensingMesh(){return null},setAnimationLoop(){},getController(){return null},getControllerGrip(){return null},getHand(){return null},dispose(){}});this.xr=ft,this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){let k=Ge.get("WEBGL_lose_context");k&&k.loseContext()},this.forceContextRestore=function(){let k=Ge.get("WEBGL_lose_context");k&&k.restoreContext()},this.getPixelRatio=function(){return ce},this.setPixelRatio=function(k){k!==void 0&&(ce=k,this.setSize(pe,Ee,!1))},this.getSize=function(k){return k.set(pe,Ee)},this.setSize=function(k,se,ge=!0){if(ft.isPresenting){Ct("WebGLRenderer: Can't change size while VR device is presenting.");return}pe=k,Ee=se,e.width=Math.floor(k*ce),e.height=Math.floor(se*ce),ge===!0&&(e.style.width=k+"px",e.style.height=se+"px"),_!==null&&_.setSize(e.width,e.height),this.setViewport(0,0,k,se)},this.getDrawingBufferSize=function(k){return k.set(pe*ce,Ee*ce).floor()},this.setDrawingBufferSize=function(k,se,ge){pe=k,Ee=se,ce=ge,e.width=Math.floor(k*ge),e.height=Math.floor(se*ge),this.setViewport(0,0,k,se)},this.setEffects=function(k){if(g===Dn){Dt("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(k){for(let se=0;se<k.length;se++)if(k[se].isOutputPass===!0){Ct("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}_.setEffects(k||[])},this.getCurrentViewport=function(k){return k.copy(J)},this.getViewport=function(k){return k.copy(Le)},this.setViewport=function(k,se,ge,de){k.isVector4?Le.set(k.x,k.y,k.z,k.w):Le.set(k,se,ge,de),I.viewport(J.copy(Le).multiplyScalar(ce).round())},this.getScissor=function(k){return k.copy(ke)},this.setScissor=function(k,se,ge,de){k.isVector4?ke.set(k.x,k.y,k.z,k.w):ke.set(k,se,ge,de),I.scissor(Q.copy(ke).multiplyScalar(ce).round())},this.getScissorTest=function(){return Ce},this.setScissorTest=function(k){I.setScissorTest(Ce=k)},this.setOpaqueSort=function(k){Se=k},this.setTransparentSort=function(k){Pe=k},this.getClearColor=function(k){return k.copy(Ut.getClearColor())},this.setClearColor=function(){Ut.setClearColor(...arguments)},this.getClearAlpha=function(){return Ut.getClearAlpha()},this.setClearAlpha=function(){Ut.setClearAlpha(...arguments)},this.clear=function(k=!0,se=!0,ge=!0){let de=0;if(k){let te=!1;if(Y!==null){let st=Y.texture.format;te=m.has(st)}if(te){let st=Y.texture.type,lt=y.has(st),it=Ut.getClearColor(),dt=Ut.getClearAlpha(),R=it.r,N=it.g,H=it.b;lt?(v[0]=R,v[1]=N,v[2]=H,v[3]=dt,W.clearBufferuiv(W.COLOR,0,v)):(b[0]=R,b[1]=N,b[2]=H,b[3]=dt,W.clearBufferiv(W.COLOR,0,b))}else de|=W.COLOR_BUFFER_BIT}se&&(de|=W.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ge&&(de|=W.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),de!==0&&W.clear(de)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(k){k.setRenderer(this),P=k},this.dispose=function(){e.removeEventListener("webglcontextlost",vr,!1),e.removeEventListener("webglcontextrestored",Vn,!1),e.removeEventListener("webglcontextcreationerror",no,!1),Ut.dispose(),Je.dispose(),Xe.dispose(),Z.dispose(),be.dispose(),_e.dispose(),ot.dispose(),Ue.dispose(),Ke.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",lx),ft.removeEventListener("sessionend",cx),ko.stop()};function vr(k){k.preventDefault(),Wg("WebGLRenderer: Context Lost."),C=!0}function Vn(){Wg("WebGLRenderer: Context Restored."),C=!1;let k=q.autoReset,se=yt.enabled,ge=yt.autoUpdate,de=yt.needsUpdate,te=yt.type;St(),q.autoReset=k,yt.enabled=se,yt.autoUpdate=ge,yt.needsUpdate=de,yt.type=te}function no(k){Dt("WebGLRenderer: A WebGL context could not be created. Reason: ",k.statusMessage)}function ro(k){let se=k.target;se.removeEventListener("dispose",ro),x_(se)}function x_(k){Eg(k),Z.remove(k)}function Eg(k){let se=Z.get(k).programs;se!==void 0&&(se.forEach(function(ge){Ke.releaseProgram(ge)}),k.isShaderMaterial&&Ke.releaseShaderCache(k))}this.renderBufferDirect=function(k,se,ge,de,te,st){se===null&&(se=Oe);let lt=te.isMesh&&te.matrixWorld.determinantAffine()<0,it=tr(k,se,ge,de,te);I.setMaterial(de,lt);let dt=ge.index,R=1;if(de.wireframe===!0){if(dt=ue.getWireframeAttribute(ge),dt===void 0)return;R=2}let N=ge.drawRange,H=ge.attributes.position,V=N.start*R,K=(N.start+N.count)*R;st!==null&&(V=Math.max(V,st.start*R),K=Math.min(K,(st.start+st.count)*R)),dt!==null?(V=Math.max(V,0),K=Math.min(K,dt.count)):H!=null&&(V=Math.max(V,0),K=Math.min(K,H.count));let Ie=K-V;if(Ie<0||Ie===1/0)return;ot.setup(te,de,it,ge,dt);let zn,Mn=Ye;if(dt!==null&&(zn=Fe.get(dt),Mn=Ae,Mn.setIndex(zn)),te.isMesh)de.wireframe===!0?(I.setLineWidth(de.wireframeLinewidth*fe()),Mn.setMode(W.LINES)):Mn.setMode(W.TRIANGLES);else if(te.isLine){let zr=de.linewidth;zr===void 0&&(zr=1),I.setLineWidth(zr*fe()),te.isLineSegments?Mn.setMode(W.LINES):te.isLineLoop?Mn.setMode(W.LINE_LOOP):Mn.setMode(W.LINE_STRIP)}else te.isPoints?Mn.setMode(W.POINTS):te.isSprite&&Mn.setMode(W.TRIANGLES);if(te.isBatchedMesh)if(Ge.get("WEBGL_multi_draw"))Mn.renderMultiDraw(te._multiDrawStarts,te._multiDrawCounts,te._multiDrawCount);else{let zr=te._multiDrawStarts,ct=te._multiDrawCounts,Ti=te._multiDrawCount,nn=dt?Fe.get(dt).bytesPerElement:1,io=Z.get(de).currentProgram.getUniforms();for(let Ea=0;Ea<Ti;Ea++)io.setValue(W,"_gl_DrawID",Ea),Mn.render(zr[Ea]/nn,ct[Ea])}else if(te.isInstancedMesh)Mn.renderInstances(V,Ie,te.count);else if(ge.isInstancedBufferGeometry){let zr=ge._maxInstanceCount!==void 0?ge._maxInstanceCount:1/0,ct=Math.min(ge.instanceCount,zr);Mn.renderInstances(V,Ie,ct)}else Mn.render(V,Ie)};function ax(k,se,ge){k.transparent===!0&&k.side===xr&&k.forceSinglePass===!1?(k.side=Hr,k.needsUpdate=!0,Jr(k,se,ge),k.side=ys,k.needsUpdate=!0,Jr(k,se,ge),k.side=xr):Jr(k,se,ge)}this.compile=function(k,se,ge=null){ge===null&&(ge=k),E=Xe.get(ge),E.init(se),w.push(E),ge.traverseVisible(function(te){te.isLight&&te.layers.test(se.layers)&&(E.pushLight(te),te.castShadow&&E.pushShadow(te))}),k!==ge&&k.traverseVisible(function(te){te.isLight&&te.layers.test(se.layers)&&(E.pushLight(te),te.castShadow&&E.pushShadow(te))}),E.setupLights();let de=new Set;return k.traverse(function(te){if(!(te.isMesh||te.isPoints||te.isLine||te.isSprite))return;let st=te.material;if(st)if(Array.isArray(st))for(let lt=0;lt<st.length;lt++){let it=st[lt];ax(it,ge,te),de.add(it)}else ax(st,ge,te),de.add(st)}),E=w.pop(),de},this.compileAsync=function(k,se,ge=null){let de=this.compile(k,se,ge);return new Promise(te=>{function st(){if(de.forEach(function(lt){Z.get(lt).currentProgram.isReady()&&de.delete(lt)}),de.size===0){te(k);return}setTimeout(st,10)}Ge.get("KHR_parallel_shader_compile")!==null?st():setTimeout(st,10)})};let Tg=null;function Mg(k){Tg&&Tg(k)}function lx(){ko.stop()}function cx(){ko.start()}let ko=new OX;ko.setAnimationLoop(Mg),typeof self<"u"&&ko.setContext(self),this.setAnimationLoop=function(k){Tg=k,ft.setAnimationLoop(k),k===null?ko.stop():ko.start()},ft.addEventListener("sessionstart",lx),ft.addEventListener("sessionend",cx),this.render=function(k,se){if(se!==void 0&&se.isCamera!==!0){Dt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;P!==null&&P.renderStart(k,se);let ge=ft.enabled===!0&&ft.isPresenting===!0,de=_!==null&&(Y===null||ge)&&_.begin(A,Y);if(k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),se.parent===null&&se.matrixWorldAutoUpdate===!0&&se.updateMatrixWorld(),ft.enabled===!0&&ft.isPresenting===!0&&(_===null||_.isCompositing()===!1)&&(ft.cameraAutoUpdate===!0&&ft.updateCamera(se),se=ft.getCamera()),k.isScene===!0&&k.onBeforeRender(A,k,se,Y),E=Xe.get(k,w.length),E.init(se),E.state.textureUnits=ae.getTextureUnits(),w.push(E),Ne.multiplyMatrices(se.projectionMatrix,se.matrixWorldInverse),le.setFromProjectionMatrix(Ne,Ho,se.reversedDepth),Te=this.localClippingEnabled,ye=rt.init(this.clippingPlanes,Te),S=Je.get(k,T.length),S.init(),T.push(S),ft.enabled===!0&&ft.isPresenting===!0){let lt=A.xr.getDepthSensingMesh();lt!==null&&_g(lt,se,-1/0,A.sortObjects)}_g(k,se,0,A.sortObjects),S.finish(),A.sortObjects===!0&&S.sort(Se,Pe,se.reversedDepth),B=ft.enabled===!1||ft.isPresenting===!1||ft.hasDepthSensing()===!1,B&&Ut.addToRenderList(S,k),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ye===!0&&rt.beginShadows();let te=E.state.shadowsArray;if(yt.render(te,k,se),ye===!0&&rt.endShadows(),(de&&_.hasRenderPass())===!1){let lt=S.opaque,it=S.transmissive;if(E.setupLights(),se.isArrayCamera){let dt=se.cameras;if(it.length>0)for(let R=0,N=dt.length;R<N;R++){let H=dt[R];dx(lt,it,k,H)}B&&Ut.render(k);for(let R=0,N=dt.length;R<N;R++){let H=dt[R];ux(S,k,H,H.viewport)}}else it.length>0&&dx(lt,it,k,se),B&&Ut.render(k),ux(S,k,se)}Y!==null&&G===0&&(ae.updateMultisampleRenderTarget(Y),ae.updateRenderTargetMipmap(Y)),de&&_.end(A),k.isScene===!0&&k.onAfterRender(A,k,se),ot.resetDefaultState(),oe=-1,ee=null,w.pop(),w.length>0?(E=w[w.length-1],ae.setTextureUnits(E.state.textureUnits),ye===!0&&rt.setGlobalState(A.clippingPlanes,E.state.camera)):E=null,T.pop(),T.length>0?S=T[T.length-1]:S=null,P!==null&&P.renderEnd()};function _g(k,se,ge,de){if(k.visible===!1)return;if(k.layers.test(se.layers)){if(k.isGroup)ge=k.renderOrder;else if(k.isLOD)k.autoUpdate===!0&&k.update(se);else if(k.isLightProbeGrid)E.pushLightProbeGrid(k);else if(k.isLight)E.pushLight(k),k.castShadow&&E.pushShadow(k);else if(k.isSprite){if(!k.frustumCulled||le.intersectsSprite(k)){de&&Me.setFromMatrixPosition(k.matrixWorld).applyMatrix4(Ne);let lt=_e.update(k),it=k.material;it.visible&&S.push(k,lt,it,ge,Me.z,null)}}else if((k.isMesh||k.isLine||k.isPoints)&&(!k.frustumCulled||le.intersectsObject(k))){let lt=_e.update(k),it=k.material;if(de&&(k.boundingSphere!==void 0?(k.boundingSphere===null&&k.computeBoundingSphere(),Me.copy(k.boundingSphere.center)):(lt.boundingSphere===null&&lt.computeBoundingSphere(),Me.copy(lt.boundingSphere.center)),Me.applyMatrix4(k.matrixWorld).applyMatrix4(Ne)),Array.isArray(it)){let dt=lt.groups;for(let R=0,N=dt.length;R<N;R++){let H=dt[R],V=it[H.materialIndex];V&&V.visible&&S.push(k,lt,V,ge,Me.z,H)}}else it.visible&&S.push(k,lt,it,ge,Me.z,null)}}let st=k.children;for(let lt=0,it=st.length;lt<it;lt++)_g(st[lt],se,ge,de)}function ux(k,se,ge,de){let{opaque:te,transmissive:st,transparent:lt}=k;E.setupLightsView(ge),ye===!0&&rt.setGlobalState(A.clippingPlanes,ge),de&&I.viewport(J.copy(de)),te.length>0&&Dh(te,se,ge),st.length>0&&Dh(st,se,ge),lt.length>0&&Dh(lt,se,ge),I.buffers.depth.setTest(!0),I.buffers.depth.setMask(!0),I.buffers.color.setMask(!0),I.setPolygonOffset(!1)}function dx(k,se,ge,de){if((ge.isScene===!0?ge.overrideMaterial:null)!==null)return;if(E.state.transmissionRenderTarget[de.id]===void 0){let V=Ge.has("EXT_color_buffer_half_float")||Ge.has("EXT_color_buffer_float");E.state.transmissionRenderTarget[de.id]=new Et(1,1,{generateMipmaps:!0,type:V?hr:Dn,minFilter:$o,samples:Math.max(4,z.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Jt.workingColorSpace})}let st=E.state.transmissionRenderTarget[de.id],lt=de.viewport||J;st.setSize(lt.z*A.transmissionResolutionScale,lt.w*A.transmissionResolutionScale);let it=A.getRenderTarget(),dt=A.getActiveCubeFace(),R=A.getActiveMipmapLevel();A.setRenderTarget(st),A.getClearColor(me),ve=A.getClearAlpha(),ve<1&&A.setClearColor(16777215,.5),A.clear(),B&&Ut.render(ge);let N=A.toneMapping;A.toneMapping=Pa;let H=de.viewport;if(de.viewport!==void 0&&(de.viewport=void 0),E.setupLightsView(de),ye===!0&&rt.setGlobalState(A.clippingPlanes,de),Dh(k,ge,de),ae.updateMultisampleRenderTarget(st),ae.updateRenderTargetMipmap(st),Ge.has("WEBGL_multisampled_render_to_texture")===!1){let V=!1;for(let K=0,Ie=se.length;K<Ie;K++){let zn=se[K],{object:Mn,geometry:zr,material:ct,group:Ti}=zn;if(ct.side===xr&&Mn.layers.test(de.layers)){let nn=ct.side;ct.side=Hr,ct.needsUpdate=!0,Lh(Mn,ge,de,zr,ct,Ti),ct.side=nn,ct.needsUpdate=!0,V=!0}}V===!0&&(ae.updateMultisampleRenderTarget(st),ae.updateRenderTargetMipmap(st))}A.setRenderTarget(it,dt,R),A.setClearColor(me,ve),H!==void 0&&(de.viewport=H),A.toneMapping=N}function Dh(k,se,ge){let de=se.isScene===!0?se.overrideMaterial:null;for(let te=0,st=k.length;te<st;te++){let lt=k[te],{object:it,geometry:dt,group:R}=lt,N=lt.material;N.allowOverride===!0&&de!==null&&(N=de),it.layers.test(ge.layers)&&Lh(it,se,ge,dt,N,R)}}function Lh(k,se,ge,de,te,st){k.onBeforeRender(A,se,ge,de,te,st),k.modelViewMatrix.multiplyMatrices(ge.matrixWorldInverse,k.matrixWorld),k.normalMatrix.getNormalMatrix(k.modelViewMatrix),te.onBeforeRender(A,se,ge,de,k,st),te.transparent===!0&&te.side===xr&&te.forceSinglePass===!1?(te.side=Hr,te.needsUpdate=!0,A.renderBufferDirect(ge,se,de,te,k,st),te.side=ys,te.needsUpdate=!0,A.renderBufferDirect(ge,se,de,te,k,st),te.side=xr):A.renderBufferDirect(ge,se,de,te,k,st),k.onAfterRender(A,se,ge,de,te,st)}function Jr(k,se,ge){se.isScene!==!0&&(se=Oe);let de=Z.get(k),te=E.state.lights,st=E.state.shadowsArray,lt=te.state.version,it=Ke.getParameters(k,te.state,st,se,ge,E.state.lightProbeGridArray),dt=Ke.getProgramCacheKey(it),R=de.programs;de.environment=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?se.environment:null,de.fog=se.fog;let N=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap;de.envMap=be.get(k.envMap||de.environment,N),de.envMapRotation=de.environment!==null&&k.envMap===null?se.environmentRotation:k.envMapRotation,R===void 0&&(k.addEventListener("dispose",ro),R=new Map,de.programs=R);let H=R.get(dt);if(H!==void 0){if(de.currentProgram===H&&de.lightsStateVersion===lt)return xl(k,it),H}else it.uniforms=Ke.getUniforms(k),P!==null&&k.isNodeMaterial&&P.build(k,ge,it),k.onBeforeCompile(it,A),H=Ke.acquireProgram(it,dt),R.set(dt,H),de.uniforms=it.uniforms;let V=de.uniforms;return(!k.isShaderMaterial&&!k.isRawShaderMaterial||k.clipping===!0)&&(V.clippingPlanes=rt.uniform),xl(k,it),de.needsLights=fx(k),de.lightsStateVersion=lt,de.needsLights&&(V.ambientLightColor.value=te.state.ambient,V.lightProbe.value=te.state.probe,V.directionalLights.value=te.state.directional,V.directionalLightShadows.value=te.state.directionalShadow,V.spotLights.value=te.state.spot,V.spotLightShadows.value=te.state.spotShadow,V.rectAreaLights.value=te.state.rectArea,V.ltc_1.value=te.state.rectAreaLTC1,V.ltc_2.value=te.state.rectAreaLTC2,V.pointLights.value=te.state.point,V.pointLightShadows.value=te.state.pointShadow,V.hemisphereLights.value=te.state.hemi,V.directionalShadowMatrix.value=te.state.directionalShadowMatrix,V.spotLightMatrix.value=te.state.spotLightMatrix,V.spotLightMap.value=te.state.spotLightMap,V.pointShadowMatrix.value=te.state.pointShadowMatrix),de.lightProbeGrid=E.state.lightProbeGridArray.length>0,de.currentProgram=H,de.uniformsList=null,H}function Ag(k){if(k.uniformsList===null){let se=k.currentProgram.getUniforms();k.uniformsList=Tp.seqWithValue(se.seq,k.uniforms)}return k.uniformsList}function xl(k,se){let ge=Z.get(k);ge.outputColorSpace=se.outputColorSpace,ge.batching=se.batching,ge.batchingColor=se.batchingColor,ge.instancing=se.instancing,ge.instancingColor=se.instancingColor,ge.instancingMorph=se.instancingMorph,ge.skinning=se.skinning,ge.morphTargets=se.morphTargets,ge.morphNormals=se.morphNormals,ge.morphColors=se.morphColors,ge.morphTargetsCount=se.morphTargetsCount,ge.numClippingPlanes=se.numClippingPlanes,ge.numIntersection=se.numClipIntersection,ge.vertexAlphas=se.vertexAlphas,ge.vertexTangents=se.vertexTangents,ge.toneMapping=se.toneMapping}function hx(k,se){if(k.length===0)return null;if(k.length===1)return k[0].texture!==null?k[0]:null;x.setFromMatrixPosition(se.matrixWorld);for(let ge=0,de=k.length;ge<de;ge++){let te=k[ge];if(te.texture!==null&&te.boundingBox.containsPoint(x))return te}return null}function tr(k,se,ge,de,te){se.isScene!==!0&&(se=Oe),ae.resetTextureUnits();let st=se.fog,lt=de.isMeshStandardMaterial||de.isMeshLambertMaterial||de.isMeshPhongMaterial?se.environment:null,it=Y===null?A.outputColorSpace:Y.isXRRenderTarget===!0?Y.texture.colorSpace:Jt.workingColorSpace,dt=de.isMeshStandardMaterial||de.isMeshLambertMaterial&&!de.envMap||de.isMeshPhongMaterial&&!de.envMap,R=be.get(de.envMap||lt,dt),N=de.vertexColors===!0&&!!ge.attributes.color&&ge.attributes.color.itemSize===4,H=!!ge.attributes.tangent&&(!!de.normalMap||de.anisotropy>0),V=!!ge.morphAttributes.position,K=!!ge.morphAttributes.normal,Ie=!!ge.morphAttributes.color,zn=Pa;de.toneMapped&&(Y===null||Y.isXRRenderTarget===!0)&&(zn=A.toneMapping);let Mn=ge.morphAttributes.position||ge.morphAttributes.normal||ge.morphAttributes.color,zr=Mn!==void 0?Mn.length:0,ct=Z.get(de),Ti=E.state.lights;if(ye===!0&&(Te===!0||k!==ee)){let ur=k===ee&&de.id===oe;rt.setState(de,k,ur)}let nn=!1;de.version===ct.__version?(ct.needsLights&&ct.lightsStateVersion!==Ti.state.version||ct.outputColorSpace!==it||te.isBatchedMesh&&ct.batching===!1||!te.isBatchedMesh&&ct.batching===!0||te.isBatchedMesh&&ct.batchingColor===!0&&te.colorTexture===null||te.isBatchedMesh&&ct.batchingColor===!1&&te.colorTexture!==null||te.isInstancedMesh&&ct.instancing===!1||!te.isInstancedMesh&&ct.instancing===!0||te.isSkinnedMesh&&ct.skinning===!1||!te.isSkinnedMesh&&ct.skinning===!0||te.isInstancedMesh&&ct.instancingColor===!0&&te.instanceColor===null||te.isInstancedMesh&&ct.instancingColor===!1&&te.instanceColor!==null||te.isInstancedMesh&&ct.instancingMorph===!0&&te.morphTexture===null||te.isInstancedMesh&&ct.instancingMorph===!1&&te.morphTexture!==null||ct.envMap!==R||de.fog===!0&&ct.fog!==st||ct.numClippingPlanes!==void 0&&(ct.numClippingPlanes!==rt.numPlanes||ct.numIntersection!==rt.numIntersection)||ct.vertexAlphas!==N||ct.vertexTangents!==H||ct.morphTargets!==V||ct.morphNormals!==K||ct.morphColors!==Ie||ct.toneMapping!==zn||ct.morphTargetsCount!==zr||!!ct.lightProbeGrid!=E.state.lightProbeGridArray.length>0)&&(nn=!0):(nn=!0,ct.__version=de.version);let io=ct.currentProgram;nn===!0&&(io=Jr(de,se,te),P&&de.isNodeMaterial&&P.onUpdateProgram(de,io,ct));let Ea=!1,Fc=!1,Nh=!1,Gn=io.getUniforms(),Gr=ct.uniforms;if(I.useProgram(io.program)&&(Ea=!0,Fc=!0,Nh=!0),de.id!==oe&&(oe=de.id,Fc=!0),ct.needsLights){let ur=hx(E.state.lightProbeGridArray,te);ct.lightProbeGrid!==ur&&(ct.lightProbeGrid=ur,Fc=!0)}if(Ea||ee!==k){I.buffers.depth.getReversed()&&k.reversedDepth!==!0&&(k._reversedDepth=!0,k.updateProjectionMatrix()),Gn.setValue(W,"projectionMatrix",k.projectionMatrix),Gn.setValue(W,"viewMatrix",k.matrixWorldInverse);let kc=Gn.map.cameraPosition;kc!==void 0&&kc.setValue(W,He.setFromMatrixPosition(k.matrixWorld)),z.logarithmicDepthBuffer&&Gn.setValue(W,"logDepthBufFC",2/(Math.log(k.far+1)/Math.LN2)),(de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshLambertMaterial||de.isMeshBasicMaterial||de.isMeshStandardMaterial||de.isShaderMaterial)&&Gn.setValue(W,"isOrthographic",k.isOrthographicCamera===!0),ee!==k&&(ee=k,Fc=!0,Nh=!0)}if(ct.needsLights&&(Ti.state.directionalShadowMap.length>0&&Gn.setValue(W,"directionalShadowMap",Ti.state.directionalShadowMap,ae),Ti.state.spotShadowMap.length>0&&Gn.setValue(W,"spotShadowMap",Ti.state.spotShadowMap,ae),Ti.state.pointShadowMap.length>0&&Gn.setValue(W,"pointShadowMap",Ti.state.pointShadowMap,ae)),te.isSkinnedMesh){Gn.setOptional(W,te,"bindMatrix"),Gn.setOptional(W,te,"bindMatrixInverse");let ur=te.skeleton;ur&&(ur.boneTexture===null&&ur.computeBoneTexture(),Gn.setValue(W,"boneTexture",ur.boneTexture,ae))}te.isBatchedMesh&&(Gn.setOptional(W,te,"batchingTexture"),Gn.setValue(W,"batchingTexture",te._matricesTexture,ae),Gn.setOptional(W,te,"batchingIdTexture"),Gn.setValue(W,"batchingIdTexture",te._indirectTexture,ae),Gn.setOptional(W,te,"batchingColorTexture"),te._colorsTexture!==null&&Gn.setValue(W,"batchingColorTexture",te._colorsTexture,ae));let Uc=ge.morphAttributes;if((Uc.position!==void 0||Uc.normal!==void 0||Uc.color!==void 0)&&$.update(te,ge,io),(Fc||ct.receiveShadow!==te.receiveShadow)&&(ct.receiveShadow=te.receiveShadow,Gn.setValue(W,"receiveShadow",te.receiveShadow)),(de.isMeshStandardMaterial||de.isMeshLambertMaterial||de.isMeshPhongMaterial)&&de.envMap===null&&se.environment!==null&&(Gr.envMapIntensity.value=se.environmentIntensity),Gr.dfgLUT!==void 0&&(Gr.dfgLUT.value=dZ()),Fc){if(Gn.setValue(W,"toneMappingExposure",A.toneMappingExposure),ct.needsLights&&px(Gr,Nh),st&&de.fog===!0&&xt.refreshFogUniforms(Gr,st),xt.refreshMaterialUniforms(Gr,de,ce,Ee,E.state.transmissionRenderTarget[k.id]),ct.needsLights&&ct.lightProbeGrid){let ur=ct.lightProbeGrid;Gr.probesSH.value=ur.texture,Gr.probesMin.value.copy(ur.boundingBox.min),Gr.probesMax.value.copy(ur.boundingBox.max),Gr.probesResolution.value.copy(ur.resolution)}Tp.upload(W,Ag(ct),Gr,ae)}if(de.isShaderMaterial&&de.uniformsNeedUpdate===!0&&(Tp.upload(W,Ag(ct),Gr,ae),de.uniformsNeedUpdate=!1),de.isSpriteMaterial&&Gn.setValue(W,"center",te.center),Gn.setValue(W,"modelViewMatrix",te.modelViewMatrix),Gn.setValue(W,"normalMatrix",te.normalMatrix),Gn.setValue(W,"modelMatrix",te.matrixWorld),te.previousModelViewMatrix&&Gn.setValue(W,"previousModelViewMatrix",te.previousModelViewMatrix),k.previousProjectionMatrix&&Gn.setValue(W,"previousProjectionMatrix",k.previousProjectionMatrix),de.uniformsGroups!==void 0){let ur=de.uniformsGroups;for(let kc=0,Bh=ur.length;kc<Bh;kc++){let WD=ur[kc];Ue.update(WD,io),Ue.bind(WD,io)}}return io}function px(k,se){k.ambientLightColor.needsUpdate=se,k.lightProbe.needsUpdate=se,k.directionalLights.needsUpdate=se,k.directionalLightShadows.needsUpdate=se,k.pointLights.needsUpdate=se,k.pointLightShadows.needsUpdate=se,k.spotLights.needsUpdate=se,k.spotLightShadows.needsUpdate=se,k.rectAreaLights.needsUpdate=se,k.hemisphereLights.needsUpdate=se}function fx(k){return k.isMeshLambertMaterial||k.isMeshToonMaterial||k.isMeshPhongMaterial||k.isMeshStandardMaterial||k.isShadowMaterial||k.isShaderMaterial&&k.lights===!0}this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return Y},this.setRenderTargetTextures=function(k,se,ge){let de=Z.get(k);de.__autoAllocateDepthBuffer=k.resolveDepthBuffer===!1,de.__autoAllocateDepthBuffer===!1&&(de.__useRenderToTexture=!1),Z.get(k.texture).__webglTexture=se,Z.get(k.depthTexture).__webglTexture=de.__autoAllocateDepthBuffer?void 0:ge,de.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(k,se){let ge=Z.get(k);ge.__webglFramebuffer=se,ge.__useDefaultFramebuffer=se===void 0},this.setRenderTarget=function(k,se=0,ge=0){Y=k,U=se,G=ge;let de=null,te=!1,st=!1;if(k){let it=Z.get(k);if(it.__useDefaultFramebuffer!==void 0){I.bindFramebuffer(W.FRAMEBUFFER,it.__webglFramebuffer),J.copy(k.viewport),Q.copy(k.scissor),re=k.scissorTest,I.viewport(J),I.scissor(Q),I.setScissorTest(re),oe=-1;return}else if(it.__webglFramebuffer===void 0)ae.setupRenderTarget(k);else if(it.__hasExternalTextures)ae.rebindTextures(k,Z.get(k.texture).__webglTexture,Z.get(k.depthTexture).__webglTexture);else if(k.depthBuffer){let N=k.depthTexture;if(it.__boundDepthTexture!==N){if(N!==null&&Z.has(N)&&(k.width!==N.image.width||k.height!==N.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");ae.setupDepthRenderbuffer(k)}}let dt=k.texture;(dt.isData3DTexture||dt.isDataArrayTexture||dt.isCompressedArrayTexture)&&(st=!0);let R=Z.get(k).__webglFramebuffer;k.isWebGLCubeRenderTarget?(Array.isArray(R[se])?de=R[se][ge]:de=R[se],te=!0):k.samples>0&&ae.useMultisampledRTT(k)===!1?de=Z.get(k).__webglMultisampledFramebuffer:Array.isArray(R)?de=R[ge]:de=R,J.copy(k.viewport),Q.copy(k.scissor),re=k.scissorTest}else J.copy(Le).multiplyScalar(ce).floor(),Q.copy(ke).multiplyScalar(ce).floor(),re=Ce;if(ge!==0&&(de=D),I.bindFramebuffer(W.FRAMEBUFFER,de)&&I.drawBuffers(k,de),I.viewport(J),I.scissor(Q),I.setScissorTest(re),te){let it=Z.get(k.texture);W.framebufferTexture2D(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_CUBE_MAP_POSITIVE_X+se,it.__webglTexture,ge)}else if(st){let it=se;for(let dt=0;dt<k.textures.length;dt++){let R=Z.get(k.textures[dt]);W.framebufferTextureLayer(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0+dt,R.__webglTexture,ge,it)}}else if(k!==null&&ge!==0){let it=Z.get(k.texture);W.framebufferTexture2D(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_2D,it.__webglTexture,ge)}oe=-1},this.readRenderTargetPixels=function(k,se,ge,de,te,st,lt,it=0){if(!(k&&k.isWebGLRenderTarget)){Dt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let dt=Z.get(k).__webglFramebuffer;if(k.isWebGLCubeRenderTarget&&lt!==void 0&&(dt=dt[lt]),dt){I.bindFramebuffer(W.FRAMEBUFFER,dt);try{let R=k.textures[it],N=R.format,H=R.type;if(k.textures.length>1&&W.readBuffer(W.COLOR_ATTACHMENT0+it),!z.textureFormatReadable(N)){Dt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!z.textureTypeReadable(H)){Dt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}se>=0&&se<=k.width-de&&ge>=0&&ge<=k.height-te&&W.readPixels(se,ge,de,te,$e.convert(N),$e.convert(H),st)}finally{let R=Y!==null?Z.get(Y).__webglFramebuffer:null;I.bindFramebuffer(W.FRAMEBUFFER,R)}}},this.readRenderTargetPixelsAsync=async function(k,se,ge,de,te,st,lt,it=0){if(!(k&&k.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let dt=Z.get(k).__webglFramebuffer;if(k.isWebGLCubeRenderTarget&&lt!==void 0&&(dt=dt[lt]),dt)if(se>=0&&se<=k.width-de&&ge>=0&&ge<=k.height-te){I.bindFramebuffer(W.FRAMEBUFFER,dt);let R=k.textures[it],N=R.format,H=R.type;if(k.textures.length>1&&W.readBuffer(W.COLOR_ATTACHMENT0+it),!z.textureFormatReadable(N))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!z.textureTypeReadable(H))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let V=W.createBuffer();W.bindBuffer(W.PIXEL_PACK_BUFFER,V),W.bufferData(W.PIXEL_PACK_BUFFER,st.byteLength,W.STREAM_READ),W.readPixels(se,ge,de,te,$e.convert(N),$e.convert(H),0);let K=Y!==null?Z.get(Y).__webglFramebuffer:null;I.bindFramebuffer(W.FRAMEBUFFER,K);let Ie=W.fenceSync(W.SYNC_GPU_COMMANDS_COMPLETE,0);return W.flush(),await yN(W,Ie,4),W.bindBuffer(W.PIXEL_PACK_BUFFER,V),W.getBufferSubData(W.PIXEL_PACK_BUFFER,0,st),W.deleteBuffer(V),W.deleteSync(Ie),st}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(k,se=null,ge=0){let de=Math.pow(2,-ge),te=Math.floor(k.image.width*de),st=Math.floor(k.image.height*de),lt=se!==null?se.x:0,it=se!==null?se.y:0;ae.setTexture2D(k,0),W.copyTexSubImage2D(W.TEXTURE_2D,ge,0,0,lt,it,te,st),I.unbindTexture()},this.copyTextureToTexture=function(k,se,ge=null,de=null,te=0,st=0){let lt,it,dt,R,N,H,V,K,Ie,zn=k.isCompressedTexture?k.mipmaps[st]:k.image;if(ge!==null)lt=ge.max.x-ge.min.x,it=ge.max.y-ge.min.y,dt=ge.isBox3?ge.max.z-ge.min.z:1,R=ge.min.x,N=ge.min.y,H=ge.isBox3?ge.min.z:0;else{let Gr=Math.pow(2,-te);lt=Math.floor(zn.width*Gr),it=Math.floor(zn.height*Gr),k.isDataArrayTexture?dt=zn.depth:k.isData3DTexture?dt=Math.floor(zn.depth*Gr):dt=1,R=0,N=0,H=0}de!==null?(V=de.x,K=de.y,Ie=de.z):(V=0,K=0,Ie=0);let Mn=$e.convert(se.format),zr=$e.convert(se.type),ct;se.isData3DTexture?(ae.setTexture3D(se,0),ct=W.TEXTURE_3D):se.isDataArrayTexture||se.isCompressedArrayTexture?(ae.setTexture2DArray(se,0),ct=W.TEXTURE_2D_ARRAY):(ae.setTexture2D(se,0),ct=W.TEXTURE_2D),I.activeTexture(W.TEXTURE0),I.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,se.flipY),I.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),I.pixelStorei(W.UNPACK_ALIGNMENT,se.unpackAlignment);let Ti=I.getParameter(W.UNPACK_ROW_LENGTH),nn=I.getParameter(W.UNPACK_IMAGE_HEIGHT),io=I.getParameter(W.UNPACK_SKIP_PIXELS),Ea=I.getParameter(W.UNPACK_SKIP_ROWS),Fc=I.getParameter(W.UNPACK_SKIP_IMAGES);I.pixelStorei(W.UNPACK_ROW_LENGTH,zn.width),I.pixelStorei(W.UNPACK_IMAGE_HEIGHT,zn.height),I.pixelStorei(W.UNPACK_SKIP_PIXELS,R),I.pixelStorei(W.UNPACK_SKIP_ROWS,N),I.pixelStorei(W.UNPACK_SKIP_IMAGES,H);let Nh=k.isDataArrayTexture||k.isData3DTexture,Gn=se.isDataArrayTexture||se.isData3DTexture;if(k.isDepthTexture){let Gr=Z.get(k),Uc=Z.get(se),ur=Z.get(Gr.__renderTarget),kc=Z.get(Uc.__renderTarget);I.bindFramebuffer(W.READ_FRAMEBUFFER,ur.__webglFramebuffer),I.bindFramebuffer(W.DRAW_FRAMEBUFFER,kc.__webglFramebuffer);for(let Bh=0;Bh<dt;Bh++)Nh&&(W.framebufferTextureLayer(W.READ_FRAMEBUFFER,W.COLOR_ATTACHMENT0,Z.get(k).__webglTexture,te,H+Bh),W.framebufferTextureLayer(W.DRAW_FRAMEBUFFER,W.COLOR_ATTACHMENT0,Z.get(se).__webglTexture,st,Ie+Bh)),W.blitFramebuffer(R,N,lt,it,V,K,lt,it,W.DEPTH_BUFFER_BIT,W.NEAREST);I.bindFramebuffer(W.READ_FRAMEBUFFER,null),I.bindFramebuffer(W.DRAW_FRAMEBUFFER,null)}else if(te!==0||k.isRenderTargetTexture||Z.has(k)){let Gr=Z.get(k),Uc=Z.get(se);I.bindFramebuffer(W.READ_FRAMEBUFFER,O),I.bindFramebuffer(W.DRAW_FRAMEBUFFER,L);for(let ur=0;ur<dt;ur++)Nh?W.framebufferTextureLayer(W.READ_FRAMEBUFFER,W.COLOR_ATTACHMENT0,Gr.__webglTexture,te,H+ur):W.framebufferTexture2D(W.READ_FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_2D,Gr.__webglTexture,te),Gn?W.framebufferTextureLayer(W.DRAW_FRAMEBUFFER,W.COLOR_ATTACHMENT0,Uc.__webglTexture,st,Ie+ur):W.framebufferTexture2D(W.DRAW_FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_2D,Uc.__webglTexture,st),te!==0?W.blitFramebuffer(R,N,lt,it,V,K,lt,it,W.COLOR_BUFFER_BIT,W.NEAREST):Gn?W.copyTexSubImage3D(ct,st,V,K,Ie+ur,R,N,lt,it):W.copyTexSubImage2D(ct,st,V,K,R,N,lt,it);I.bindFramebuffer(W.READ_FRAMEBUFFER,null),I.bindFramebuffer(W.DRAW_FRAMEBUFFER,null)}else Gn?k.isDataTexture||k.isData3DTexture?W.texSubImage3D(ct,st,V,K,Ie,lt,it,dt,Mn,zr,zn.data):se.isCompressedArrayTexture?W.compressedTexSubImage3D(ct,st,V,K,Ie,lt,it,dt,Mn,zn.data):W.texSubImage3D(ct,st,V,K,Ie,lt,it,dt,Mn,zr,zn):k.isDataTexture?W.texSubImage2D(W.TEXTURE_2D,st,V,K,lt,it,Mn,zr,zn.data):k.isCompressedTexture?W.compressedTexSubImage2D(W.TEXTURE_2D,st,V,K,zn.width,zn.height,Mn,zn.data):W.texSubImage2D(W.TEXTURE_2D,st,V,K,lt,it,Mn,zr,zn);I.pixelStorei(W.UNPACK_ROW_LENGTH,Ti),I.pixelStorei(W.UNPACK_IMAGE_HEIGHT,nn),I.pixelStorei(W.UNPACK_SKIP_PIXELS,io),I.pixelStorei(W.UNPACK_SKIP_ROWS,Ea),I.pixelStorei(W.UNPACK_SKIP_IMAGES,Fc),st===0&&se.generateMipmaps&&W.generateMipmap(ct),I.unbindTexture()},this.initRenderTarget=function(k){Z.get(k).__webglFramebuffer===void 0&&ae.setupRenderTarget(k)},this.initTexture=function(k){k.isCubeTexture?ae.setTextureCube(k,0):k.isData3DTexture?ae.setTexture3D(k,0):k.isDataArrayTexture||k.isCompressedArrayTexture?ae.setTexture2DArray(k,0):ae.setTexture2D(k,0),I.unbindTexture()},this.resetState=function(){U=0,G=0,Y=null,I.reset(),ot.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ho}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=Jt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Jt._getUnpackColorSpace()}}});var gZ,yZ,vZ,bZ,xZ,SZ,wZ,EZ,iC,ihe,TZ,MZ,she,Lp,lo,QN,fi,sC,JN,yS=F(()=>{"use strict";gZ=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),yZ=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),vZ=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Lp&&"ontouchend"in document,bZ=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,xZ=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,SZ=()=>{if(typeof window>"u")return!1;let i=navigator.userAgent,t=navigator.vendor;return/Safari/i.test(i)&&/Apple Computer/.test(t)},wZ=()=>{if(typeof window>"u")return null;let t=navigator.userAgent.match(/Version\/(\d+\.\d)/);return t&&t[1]},EZ=()=>{if(typeof window>"u")return;let t=new URLSearchParams(window.location.search).get("desktop-app-version");return t?(window.localStorage.setItem("desktop-app-version",t),t):window.localStorage.getItem("desktop-app-version")??"0.0.6"},iC=gZ(),ihe=iC?EZ():void 0,TZ=()=>{if(!(typeof window>"u"))return window.spline},MZ=TZ(),she=!!MZ?.isShellTabs,Lp=yZ(),lo=vZ(),QN=bZ(),fi=xZ(),sC=SZ(),JN=Number(wZ())});var e3=F(()=>{"use strict"});function Np(i){return Lp?i.metaKey:i.ctrlKey}function n3(i,t){return Math.abs(i+3*t)<=t3||Math.abs(i+3*window.devicePixelRatio*t)<=t3}function r3(i){return i.wheelDeltaY===0||i.deltaY===0?Lp&&i.shiftKey&&Math.abs(i.wheelDeltaX)>=120?!1:i.wheelDeltaX?n3(i.wheelDeltaX,i.deltaX):i.deltaMode===0:i.wheelDeltaY?n3(i.wheelDeltaY,i.deltaY):i.deltaMode===0}var t3,i3=F(()=>{"use strict";yS();t3=2});var s3=F(()=>{"use strict"});function o3(i){mt.includes(i)||mt.push(i)}function Bp(i){delete bS[i.pointerId];for(let t=0;t<mt.length;t++)if(mt[t].pointerId===i.pointerId){mt.splice(t,1);break}}function a3(){mt.splice(0,mt.length)}function xS(i){if(i.pointerType!=="touch")return;let t=bS[i.pointerId];t===void 0&&(t={x:0,y:0},bS[i.pointerId]=t),t.x=i.pageX,t.y=i.pageY}function SS(i){let t=i.pointerId===mt[0].pointerId?mt[1]:mt[0];return bS[t.pointerId]}function l3(i){Dy[i.key]=!0,vS[i.key]=vS[i.key]===void 0?1:vS[i.key]+1}function c3(i){if(Lp&&Dy.Meta)for(let t in Dy)Dy[t]=!1;else Dy[i.key]=!1;vS={}}function u3(i){i.addEventListener("pointerdown",o3,!0),i.addEventListener("pointerdown",xS,!0),i.addEventListener("pointermove",xS,!0),i.addEventListener("pointerup",Bp,!0),i.addEventListener("pointercancel",Bp,!0),i.addEventListener("pointerleave",Bp,!0),window.addEventListener("keydown",l3,!0),window.addEventListener("keyup",c3,!0)}function d3(i){i.removeEventListener("pointerdown",o3,!0),i.removeEventListener("pointerdown",xS,!0),i.removeEventListener("pointermove",xS,!0),i.removeEventListener("pointerup",Bp,!0),i.removeEventListener("pointercancel",Bp,!0),i.removeEventListener("pointerleave",Bp,!0),window.removeEventListener("keydown",l3,!0),window.removeEventListener("keyup",c3,!0)}var mt,bS,Dy,vS,h3=F(()=>{"use strict";yS();mt=[],bS={},Dy={},vS={}});var phe,p3=F(()=>{"use strict";phe=15+"%"});var _Z,AZ,f3,js,Hs,mhe,m3=F(()=>{"use strict";_Z="/community",AZ="/academy",f3=(()=>typeof window<"u"&&!!window.spline?.isShellTabs)(),js=f3?"/desktop/community":_Z,Hs=f3?"/desktop/academy":AZ,mhe={root:"/",home:"/home",files:"/files",new:"/new",newTab:"/new-tab",filesMatch:"/files/:uuidFolder?",filesFolder:i=>`/files/${i}`,filesFolderMatch:"/files/:uuidFolder",generate:"/generate",academy:Hs,academyMatch:`${Hs}/:subPage?`,academyCollections:`${Hs}/collections`,academyCollectionCategory:i=>`${Hs}/collections/${i}`,academyCollectionCategoryMatch:`${Hs}/collections/:collectionCategory`,academyCollectionContent:(i,t)=>`${Hs}/collections/${i}/${t}`,academyCollectionContentMatch:`${Hs}/collections/:collectionCategory/:pathName`,academyExplore:`${Hs}/explore`,academyTag:i=>`${Hs}/tag/${i}`,academyTagMatcher:`${Hs}/tag/:tag`,academyAllTutorials:`${Hs}/tutorials`,academyTutorial:i=>`${Hs}/tutorials/${i}`,academyTutorialMatch:`${Hs}/tutorials/:pathName`,archived:"/archived",archivedFolder:i=>`/archived/${i}`,archivedMatch:"/archived/:uuidFolder?",recent:"/recent",recentMatch:"/recent/:uuidFolder?",shared:"/shared",sharedMatch:"/shared/:uuidFolder?",file:i=>`/file/${i}`,fileMatch:"/file/:uuid",file2D:i=>`/ui/${i}`,file2DMatch:"/ui/:uuid",library:"/templates",libraryFile:i=>`/templates/${i}`,libraryFileMatch:"/templates/:uuid",starterFile:i=>`/starter/${i}`,starterFileMatch:"/starter/:uuid",libraryHanaFile:i=>`/ui/templates/${i}`,libraryHanaFileMatch:"/ui/templates/:uuid",fileOrLibraryMatch:"/(file|templates|starter)/:uuid",team:i=>`/workspace/${i}`,teamMatch:"/workspace/:uuidTeam",teamSettings:i=>`/workspace-settings/${i}`,teamSettingsMatch:"/workspace-settings/:uuidTeam",workspaceBilling:i=>`/workspace-settings/${i}/billing`,workspaceBillingMatch:"/workspace-settings/:uuidTeam/billing",workspaceMembers:i=>`/workspace-settings/${i}/members`,workspaceMembersMatch:"/workspace-settings/:uuidTeam/members",teamInvitationMatch:"/team-invitation/:uuidTeamLink",inbox:"/inbox",account:"/account",accountReferral:"/account/referral",accountMcp:"/account/mcp",accountWithPopup:"/account?pro",subscribe:{redirectAfter3DSecure:"/subscribe/redirect-after-3d-secure"},signin:{signin:"/signin",code:"/signin/code",desktopAuth:"/auth/desktop"},logout:"/logout",organizationHome:i=>`/${i}/home`,organizationHomeMatch:"/:orgPath/home",organizationTeams:i=>`/${i}/teams`,organizationTeamsMatch:"/:orgPath/teams",organizationMyFilesMatch:"/:orgPath/files/",organizationFiles:i=>`/${i}/files`,organizationFilesMatch:"/:orgPath/files/:uuidFolder?",organizationFilesFolder:(i,t)=>`/${i}/files/${t}`,organizationFilesFolderMatch:"/:orgPath/files/:uuidFolder",organizationShared:i=>`/${i}/shared`,organizationSharedMatch:"/:orgPath/shared",organizationSettings:i=>`/${i}/settings`,organizationSettingsMatch:"/:orgPath/settings",organizationInvitationMatch:"/organization-invitation/:uuidOrg",organizationMembers:i=>`/${i}/members`,organizationMembersMatch:"/:orgPath/members",organizationBilling:i=>`/${i}/billing`,organizationBillingMatch:"/:orgPath/billing",organizationTeamSettings:(i,t)=>`/${i}/team-settings/${t}`,organizationTeamSettingsMatch:"/:orgPath/team-settings/:uuidTeam",organizationTeam:(i,t)=>`/${i}/team/${t}`,organizationTeamMatch:"/:orgPath/team/:uuidTeam",organizationTeamInvitationMatch:"/:orgPath/team-invitation/:uuidTeamLink",project:i=>`/project/${i}`,projectFolder:(i,t)=>`/project/${i}/${t}`,projectMatch:"/project/:uuidProject/:uuidFolder?",community:js,communityMatch:`${js}/:subPage?`,communityFeed:`${js}/feed`,communityNotifications:`${js}/notifications`,communitySearch:`${js}/search`,communityHana:`${js}/hana`,communityHana3DShapes:`${js}/hana-3d-shapes`,communityTag:i=>`${js}/tag/${i}`,communityTagMatcher:`${js}/tag/:tag`,communityCollection:i=>`${js}/collection/${i}`,communityCollectionMatcher:`${js}/collection/:collection`,communityFile:i=>`${js}/file/${i}`,communityFileMatch:`${js}/file/:uuidCommunityFile?`,communityProfile:i=>`/@${i}`,communityProfileMatch:"/@(?<handle>[^/@]+)/",communityProfileSettings:"/account/profile",signup:{step1:"/signup/onboarding-step1",step2:"/signup/onboarding-step2",step3:"/signup/onboarding-step3"},tokenVerification:"/oauth/verify"}});var g3=F(()=>{"use strict"});function ru(i,t=0,e={}){let n=e.leading===!0,r=e.trailing!==!1,s=e.maxWait!==void 0?Math.max(e.maxWait,t):void 0,o,a,l,c,u,d=0,h=v=>{let b=a,x=l;return a=l=void 0,d=v,c=i.apply(x,b),c},p=v=>{if(u===void 0)return!0;let b=v-u,x=v-d;return b>=t||b<0||s!==void 0&&x>=s},f=v=>{let b=t-(v-u);return s!==void 0?Math.min(b,s-(v-d)):b},g=v=>(o=void 0,r&&a?h(v):(a=l=void 0,c)),m=()=>{let v=Date.now();p(v)?g(v):o=setTimeout(m,f(v))},y=function(...v){let b=Date.now(),x=p(b);if(a=v,l=this,u=b,x){if(o===void 0)return d=b,o=setTimeout(m,t),n?h(b):c;if(s!==void 0)return o=setTimeout(m,t),h(b)}return o===void 0&&(o=setTimeout(m,t)),c};return y.cancel=()=>{o!==void 0&&clearTimeout(o),d=0,a=u=l=o=void 0},y.flush=()=>o===void 0?c:g(Date.now()),y}function y3(i,t=0,e={}){return ru(i,t,{leading:e.leading!==!1,trailing:e.trailing!==!1,maxWait:t})}function iu(i){return Fp(i,new Map)}function Fp(i,t){if(i===null||typeof i!="object")return i;if(t.has(i))return t.get(i);if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp){let n=new RegExp(i.source,i.flags);return n.lastIndex=i.lastIndex,n}if(i instanceof ArrayBuffer)return i.slice(0);if(ArrayBuffer.isView(i))return new i.constructor(i.buffer.slice(0),i.byteOffset,i instanceof DataView?i.byteLength:i.length);if(i instanceof Map){let n=new Map;return t.set(i,n),i.forEach((r,s)=>n.set(Fp(s,t),Fp(r,t))),n}if(i instanceof Set){let n=new Set;return t.set(i,n),i.forEach(r=>n.add(Fp(r,t))),n}if(Array.isArray(i)){let n=new i.constructor(i.length);t.set(i,n);for(let[r,s]of Object.entries(i))n[r]=Fp(s,t);return n}let e=Object.create(Object.getPrototypeOf(i));t.set(i,e);for(let[n,r]of Object.entries(i))e[n]=Fp(r,t);return e}function ql(i,t){if(Object.is(i,t)||i!==i&&t!==t)return!0;if(i===null||t===null||typeof i!="object"||typeof t!="object")return!1;if(i instanceof Date||t instanceof Date)return i instanceof Date&&t instanceof Date&&i.getTime()===t.getTime();if(i instanceof RegExp||t instanceof RegExp)return i instanceof RegExp&&t instanceof RegExp&&i.source===t.source&&i.flags===t.flags;if(Array.isArray(i)||Array.isArray(t))return!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length?!1:i.every((r,s)=>ql(r,t[s]));if(ArrayBuffer.isView(i)||ArrayBuffer.isView(t))return!ArrayBuffer.isView(i)||!ArrayBuffer.isView(t)||i.constructor!==t.constructor||i.length!==t.length?!1:i.every((r,s)=>Object.is(r,t[s]));if(i instanceof Map||t instanceof Map){if(!(i instanceof Map)||!(t instanceof Map)||i.size!==t.size)return!1;for(let[r,s]of i)if(!t.has(r)||!ql(s,t.get(r)))return!1;return!0}if(i instanceof Set||t instanceof Set){if(!(i instanceof Set)||!(t instanceof Set)||i.size!==t.size)return!1;for(let r of i)if(!t.has(r))return!1;return!0}let e=Object.keys(i),n=Object.keys(t);return e.length!==n.length?!1:e.every(r=>Object.prototype.hasOwnProperty.call(t,r)&&ql(i[r],t[r]))}function Ly(i,t){let e={};for(let n of t)n in i&&(e[n]=i[n]);return e}function Ny(i,t){let e=new Set(t),n={};for(let[r,s]of Object.entries(i))e.has(r)||(n[r]=s);return n}function v3(i){if(!i||i.length===0)return;let t;for(let e of i)e===e&&(t===void 0||e>t)&&(t=e);return t}function b3(i,t){if(t===void 0)return i.replace(/\s+$/,"");let e=i.length;for(;e>0&&t.includes(i[e-1]);)e--;return i.slice(0,e)}var x3=F(()=>{"use strict"});var S3=F(()=>{"use strict"});var w3=F(()=>{"use strict"});var T3=Fh(wS=>{"use strict";var CZ=Symbol.for("react.transitional.element"),PZ=Symbol.for("react.fragment");function E3(i,t,e){var n=null;if(e!==void 0&&(n=""+e),t.key!==void 0&&(n=""+t.key),"key"in t){e={};for(var r in t)r!=="key"&&(e[r]=t[r])}else e=t;return t=e.ref,{$$typeof:CZ,type:i,key:n,ref:t!==void 0?t:null,props:e}}wS.Fragment=PZ;wS.jsx=E3;wS.jsxs=E3});var oC=Fh((whe,M3)=>{"use strict";M3.exports=T3()});var _3,A3=F(()=>{"use strict";_3=Qu(oC(),1)});function C3(i){return typeof i=="object"&&i!==null&&i[Xl]===!0&&typeof i.kind=="string"}function P3(i,t){let e=`<script>${t}<\/script>`,n=/<head(\s[^>]*)?>/i.exec(i);if(n){let s=n.index+n[0].length;return i.slice(0,s)+e+i.slice(s)}let r=/<html(\s[^>]*)?>/i.exec(i);if(r){let s=r.index+r[0].length;return i.slice(0,s)+`<head>${e}</head>`+i.slice(s)}return e+i}var Xl,ES=F(()=>{"use strict";Xl="__splineHtmlContent"});var I3,R3=F(()=>{"use strict";ES();I3=`(function () {
3830
+ }`,nZ=[new M(1,0,0),new M(-1,0,0),new M(0,1,0),new M(0,-1,0),new M(0,0,1),new M(0,0,-1)],rZ=[new M(0,-1,0),new M(0,-1,0),new M(0,0,1),new M(0,0,-1),new M(0,-1,0),new M(0,-1,0)],zN=new ne,My=new M,zA=new M;lZ=new ne,XN=new wt;XN.set(-1,0,0,0,1,0,0,0,1);uZ=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Ia=null;hS=class{constructor(t={}){let{canvas:e=mN(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:h=!1,outputBufferType:p=Dn}=t;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=o;let g=p,m=new Set([wp,A0,_0]),y=new Set([Dn,ws,Sp,Md,T0,M0]),v=new Uint32Array(4),b=new Int32Array(4),x=new M,S=null,E=null,T=[],w=[],_=null;this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Pa,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let A=this,C=!1,P=null,D=null,O=null,L=null;this._outputColorSpace=Rt;let U=0,G=0,Y=null,oe=-1,ee=null,J=new vt,Q=new vt,re=null,me=new Ze(0),ve=0,pe=e.width,Ee=e.height,ce=1,Se=null,Pe=null,Le=new vt(0,0,pe,Ee),ke=new vt(0,0,pe,Ee),Ce=!1,le=new lp,ye=!1,Te=!1,Ne=new ne,He=new M,Me=new vt,Oe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},B=!1;function fe(){return Y===null?ce:1}let W=n;function et(k,se){return e.getContext(k,se)}try{let k={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${zs}`),e.addEventListener("webglcontextlost",vr,!1),e.addEventListener("webglcontextrestored",Vn,!1),e.addEventListener("webglcontextcreationerror",no,!1),W===null){let se="webgl2";if(W=et(se,k),W===null)throw et(se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(k){throw Dt("WebGLRenderer: "+k.message),k}let Ge,z,I,q,Z,ae,be,Fe,ue,_e,Ke,xt,Je,Xe,rt,yt,Ut,$,Ye,Ae,$e,ot,Ue;function St(){Ge=new S$(W),Ge.init(),$e=new aZ(W,Ge),z=new v$(W,Ge,t,$e),I=new sZ(W,Ge),z.reversedDepthBuffer&&h&&I.buffers.depth.setReversed(!0),D=W.createFramebuffer(),O=W.createFramebuffer(),L=W.createFramebuffer(),q=new T$(W),Z=new WK,ae=new oZ(W,Ge,I,Z,z,$e,q),be=new x$(A),Fe=new DX(W),ot=new g$(W,Fe),ue=new w$(W,Fe,q,ot),_e=new _$(W,ue,Fe,ot,q),$=new M$(W,z,ae),rt=new b$(Z),Ke=new HK(A,be,Ge,z,ot,rt),xt=new cZ(A,Z),Je=new XK,Xe=new JK(Ge),Ut=new m$(A,be,I,_e,f,l),yt=new iZ(A,_e,z),Ue={update(){throw new Error("UniformsGroups are not supported by the Spline runtime")},bind(){throw new Error("UniformsGroups are not supported by the Spline runtime")},dispose(){}},Ye=new y$(W,Ge,q),Ae=new E$(W,Ge,q),q.programs=Ke.programs,A.capabilities=z,A.extensions=Ge,A.properties=Z,A.renderLists=Je,A.shadowMap=yt,A.state=I,A.info=q}St(),g!==Dn&&(_=new C$(g,e.width,e.height,a,r,s));let ft=Object.assign(new _n,{enabled:!1,isPresenting:!1,cameraAutoUpdate:!0,setFramebufferScaleFactor(){},setReferenceSpaceType(){},getReferenceSpace(){return null},setReferenceSpace(){},getBaseLayer(){return null},getBinding(){return null},getFrame(){return null},getSession(){return null},async setSession(){throw new Error("WebXR is not supported by the Spline runtime")},getEnvironmentBlendMode(){},getDepthTexture(){return null},updateCamera(){},getCamera(){return null},getFoveation(){},setFoveation(){},hasDepthSensing(){return!1},getDepthSensingMesh(){return null},setAnimationLoop(){},getController(){return null},getControllerGrip(){return null},getHand(){return null},dispose(){}});this.xr=ft,this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){let k=Ge.get("WEBGL_lose_context");k&&k.loseContext()},this.forceContextRestore=function(){let k=Ge.get("WEBGL_lose_context");k&&k.restoreContext()},this.getPixelRatio=function(){return ce},this.setPixelRatio=function(k){k!==void 0&&(ce=k,this.setSize(pe,Ee,!1))},this.getSize=function(k){return k.set(pe,Ee)},this.setSize=function(k,se,ge=!0){if(ft.isPresenting){Ct("WebGLRenderer: Can't change size while VR device is presenting.");return}pe=k,Ee=se,e.width=Math.floor(k*ce),e.height=Math.floor(se*ce),ge===!0&&(e.style.width=k+"px",e.style.height=se+"px"),_!==null&&_.setSize(e.width,e.height),this.setViewport(0,0,k,se)},this.getDrawingBufferSize=function(k){return k.set(pe*ce,Ee*ce).floor()},this.setDrawingBufferSize=function(k,se,ge){pe=k,Ee=se,ce=ge,e.width=Math.floor(k*ge),e.height=Math.floor(se*ge),this.setViewport(0,0,k,se)},this.setEffects=function(k){if(g===Dn){Dt("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(k){for(let se=0;se<k.length;se++)if(k[se].isOutputPass===!0){Ct("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}_.setEffects(k||[])},this.getCurrentViewport=function(k){return k.copy(J)},this.getViewport=function(k){return k.copy(Le)},this.setViewport=function(k,se,ge,de){k.isVector4?Le.set(k.x,k.y,k.z,k.w):Le.set(k,se,ge,de),I.viewport(J.copy(Le).multiplyScalar(ce).round())},this.getScissor=function(k){return k.copy(ke)},this.setScissor=function(k,se,ge,de){k.isVector4?ke.set(k.x,k.y,k.z,k.w):ke.set(k,se,ge,de),I.scissor(Q.copy(ke).multiplyScalar(ce).round())},this.getScissorTest=function(){return Ce},this.setScissorTest=function(k){I.setScissorTest(Ce=k)},this.setOpaqueSort=function(k){Se=k},this.setTransparentSort=function(k){Pe=k},this.getClearColor=function(k){return k.copy(Ut.getClearColor())},this.setClearColor=function(){Ut.setClearColor(...arguments)},this.getClearAlpha=function(){return Ut.getClearAlpha()},this.setClearAlpha=function(){Ut.setClearAlpha(...arguments)},this.clear=function(k=!0,se=!0,ge=!0){let de=0;if(k){let te=!1;if(Y!==null){let st=Y.texture.format;te=m.has(st)}if(te){let st=Y.texture.type,lt=y.has(st),it=Ut.getClearColor(),dt=Ut.getClearAlpha(),R=it.r,N=it.g,H=it.b;lt?(v[0]=R,v[1]=N,v[2]=H,v[3]=dt,W.clearBufferuiv(W.COLOR,0,v)):(b[0]=R,b[1]=N,b[2]=H,b[3]=dt,W.clearBufferiv(W.COLOR,0,b))}else de|=W.COLOR_BUFFER_BIT}se&&(de|=W.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ge&&(de|=W.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),de!==0&&W.clear(de)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(k){k.setRenderer(this),P=k},this.dispose=function(){e.removeEventListener("webglcontextlost",vr,!1),e.removeEventListener("webglcontextrestored",Vn,!1),e.removeEventListener("webglcontextcreationerror",no,!1),Ut.dispose(),Je.dispose(),Xe.dispose(),Z.dispose(),be.dispose(),_e.dispose(),ot.dispose(),Ue.dispose(),Ke.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",lx),ft.removeEventListener("sessionend",cx),ko.stop()};function vr(k){k.preventDefault(),Wg("WebGLRenderer: Context Lost."),C=!0}function Vn(){Wg("WebGLRenderer: Context Restored."),C=!1;let k=q.autoReset,se=yt.enabled,ge=yt.autoUpdate,de=yt.needsUpdate,te=yt.type;St(),q.autoReset=k,yt.enabled=se,yt.autoUpdate=ge,yt.needsUpdate=de,yt.type=te}function no(k){Dt("WebGLRenderer: A WebGL context could not be created. Reason: ",k.statusMessage)}function ro(k){let se=k.target;se.removeEventListener("dispose",ro),x_(se)}function x_(k){Eg(k),Z.remove(k)}function Eg(k){let se=Z.get(k).programs;se!==void 0&&(se.forEach(function(ge){Ke.releaseProgram(ge)}),k.isShaderMaterial&&Ke.releaseShaderCache(k))}this.renderBufferDirect=function(k,se,ge,de,te,st){se===null&&(se=Oe);let lt=te.isMesh&&te.matrixWorld.determinantAffine()<0,it=tr(k,se,ge,de,te);I.setMaterial(de,lt);let dt=ge.index,R=1;if(de.wireframe===!0){if(dt=ue.getWireframeAttribute(ge),dt===void 0)return;R=2}let N=ge.drawRange,H=ge.attributes.position,V=N.start*R,K=(N.start+N.count)*R;st!==null&&(V=Math.max(V,st.start*R),K=Math.min(K,(st.start+st.count)*R)),dt!==null?(V=Math.max(V,0),K=Math.min(K,dt.count)):H!=null&&(V=Math.max(V,0),K=Math.min(K,H.count));let Ie=K-V;if(Ie<0||Ie===1/0)return;ot.setup(te,de,it,ge,dt);let zn,Mn=Ye;if(dt!==null&&(zn=Fe.get(dt),Mn=Ae,Mn.setIndex(zn)),te.isMesh)de.wireframe===!0?(I.setLineWidth(de.wireframeLinewidth*fe()),Mn.setMode(W.LINES)):Mn.setMode(W.TRIANGLES);else if(te.isLine){let zr=de.linewidth;zr===void 0&&(zr=1),I.setLineWidth(zr*fe()),te.isLineSegments?Mn.setMode(W.LINES):te.isLineLoop?Mn.setMode(W.LINE_LOOP):Mn.setMode(W.LINE_STRIP)}else te.isPoints?Mn.setMode(W.POINTS):te.isSprite&&Mn.setMode(W.TRIANGLES);if(te.isBatchedMesh)if(Ge.get("WEBGL_multi_draw"))Mn.renderMultiDraw(te._multiDrawStarts,te._multiDrawCounts,te._multiDrawCount);else{let zr=te._multiDrawStarts,ct=te._multiDrawCounts,Ti=te._multiDrawCount,nn=dt?Fe.get(dt).bytesPerElement:1,io=Z.get(de).currentProgram.getUniforms();for(let Ea=0;Ea<Ti;Ea++)io.setValue(W,"_gl_DrawID",Ea),Mn.render(zr[Ea]/nn,ct[Ea])}else if(te.isInstancedMesh)Mn.renderInstances(V,Ie,te.count);else if(ge.isInstancedBufferGeometry){let zr=ge._maxInstanceCount!==void 0?ge._maxInstanceCount:1/0,ct=Math.min(ge.instanceCount,zr);Mn.renderInstances(V,Ie,ct)}else Mn.render(V,Ie)};function ax(k,se,ge){k.transparent===!0&&k.side===xr&&k.forceSinglePass===!1?(k.side=Hr,k.needsUpdate=!0,Jr(k,se,ge),k.side=ys,k.needsUpdate=!0,Jr(k,se,ge),k.side=xr):Jr(k,se,ge)}this.compile=function(k,se,ge=null){ge===null&&(ge=k),E=Xe.get(ge),E.init(se),w.push(E),ge.traverseVisible(function(te){te.isLight&&te.layers.test(se.layers)&&(E.pushLight(te),te.castShadow&&E.pushShadow(te))}),k!==ge&&k.traverseVisible(function(te){te.isLight&&te.layers.test(se.layers)&&(E.pushLight(te),te.castShadow&&E.pushShadow(te))}),E.setupLights();let de=new Set;return k.traverse(function(te){if(!(te.isMesh||te.isPoints||te.isLine||te.isSprite))return;let st=te.material;if(st)if(Array.isArray(st))for(let lt=0;lt<st.length;lt++){let it=st[lt];ax(it,ge,te),de.add(it)}else ax(st,ge,te),de.add(st)}),E=w.pop(),de},this.compileAsync=function(k,se,ge=null){let de=this.compile(k,se,ge);return new Promise(te=>{function st(){if(de.forEach(function(lt){Z.get(lt).currentProgram.isReady()&&de.delete(lt)}),de.size===0){te(k);return}setTimeout(st,10)}Ge.get("KHR_parallel_shader_compile")!==null?st():setTimeout(st,10)})};let Tg=null;function Mg(k){Tg&&Tg(k)}function lx(){ko.stop()}function cx(){ko.start()}let ko=new OX;ko.setAnimationLoop(Mg),typeof self<"u"&&ko.setContext(self),this.setAnimationLoop=function(k){Tg=k,ft.setAnimationLoop(k),k===null?ko.stop():ko.start()},ft.addEventListener("sessionstart",lx),ft.addEventListener("sessionend",cx),this.render=function(k,se){if(se!==void 0&&se.isCamera!==!0){Dt("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;P!==null&&P.renderStart(k,se);let ge=ft.enabled===!0&&ft.isPresenting===!0,de=_!==null&&(Y===null||ge)&&_.begin(A,Y);if(k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),se.parent===null&&se.matrixWorldAutoUpdate===!0&&se.updateMatrixWorld(),ft.enabled===!0&&ft.isPresenting===!0&&(_===null||_.isCompositing()===!1)&&(ft.cameraAutoUpdate===!0&&ft.updateCamera(se),se=ft.getCamera()),k.isScene===!0&&k.onBeforeRender(A,k,se,Y),E=Xe.get(k,w.length),E.init(se),E.state.textureUnits=ae.getTextureUnits(),w.push(E),Ne.multiplyMatrices(se.projectionMatrix,se.matrixWorldInverse),le.setFromProjectionMatrix(Ne,Ho,se.reversedDepth),Te=this.localClippingEnabled,ye=rt.init(this.clippingPlanes,Te),S=Je.get(k,T.length),S.init(),T.push(S),ft.enabled===!0&&ft.isPresenting===!0){let lt=A.xr.getDepthSensingMesh();lt!==null&&_g(lt,se,-1/0,A.sortObjects)}_g(k,se,0,A.sortObjects),S.finish(),A.sortObjects===!0&&S.sort(Se,Pe,se.reversedDepth),B=ft.enabled===!1||ft.isPresenting===!1||ft.hasDepthSensing()===!1,B&&Ut.addToRenderList(S,k),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ye===!0&&rt.beginShadows();let te=E.state.shadowsArray;if(yt.render(te,k,se),ye===!0&&rt.endShadows(),(de&&_.hasRenderPass())===!1){let lt=S.opaque,it=S.transmissive;if(E.setupLights(),se.isArrayCamera){let dt=se.cameras;if(it.length>0)for(let R=0,N=dt.length;R<N;R++){let H=dt[R];dx(lt,it,k,H)}B&&Ut.render(k);for(let R=0,N=dt.length;R<N;R++){let H=dt[R];ux(S,k,H,H.viewport)}}else it.length>0&&dx(lt,it,k,se),B&&Ut.render(k),ux(S,k,se)}Y!==null&&G===0&&(ae.updateMultisampleRenderTarget(Y),ae.updateRenderTargetMipmap(Y)),de&&_.end(A),k.isScene===!0&&k.onAfterRender(A,k,se),ot.resetDefaultState(),oe=-1,ee=null,w.pop(),w.length>0?(E=w[w.length-1],ae.setTextureUnits(E.state.textureUnits),ye===!0&&rt.setGlobalState(A.clippingPlanes,E.state.camera)):E=null,T.pop(),T.length>0?S=T[T.length-1]:S=null,P!==null&&P.renderEnd()};function _g(k,se,ge,de){if(k.visible===!1)return;if(k.layers.test(se.layers)){if(k.isGroup)ge=k.renderOrder;else if(k.isLOD)k.autoUpdate===!0&&k.update(se);else if(k.isLightProbeGrid)E.pushLightProbeGrid(k);else if(k.isLight)E.pushLight(k),k.castShadow&&E.pushShadow(k);else if(k.isSprite){if(!k.frustumCulled||le.intersectsSprite(k)){de&&Me.setFromMatrixPosition(k.matrixWorld).applyMatrix4(Ne);let lt=_e.update(k),it=k.material;it.visible&&S.push(k,lt,it,ge,Me.z,null)}}else if((k.isMesh||k.isLine||k.isPoints)&&(!k.frustumCulled||le.intersectsObject(k))){let lt=_e.update(k),it=k.material;if(de&&(k.boundingSphere!==void 0?(k.boundingSphere===null&&k.computeBoundingSphere(),Me.copy(k.boundingSphere.center)):(lt.boundingSphere===null&&lt.computeBoundingSphere(),Me.copy(lt.boundingSphere.center)),Me.applyMatrix4(k.matrixWorld).applyMatrix4(Ne)),Array.isArray(it)){let dt=lt.groups;for(let R=0,N=dt.length;R<N;R++){let H=dt[R],V=it[H.materialIndex];V&&V.visible&&S.push(k,lt,V,ge,Me.z,H)}}else it.visible&&S.push(k,lt,it,ge,Me.z,null)}}let st=k.children;for(let lt=0,it=st.length;lt<it;lt++)_g(st[lt],se,ge,de)}function ux(k,se,ge,de){let{opaque:te,transmissive:st,transparent:lt}=k;E.setupLightsView(ge),ye===!0&&rt.setGlobalState(A.clippingPlanes,ge),de&&I.viewport(J.copy(de)),te.length>0&&Dh(te,se,ge),st.length>0&&Dh(st,se,ge),lt.length>0&&Dh(lt,se,ge),I.buffers.depth.setTest(!0),I.buffers.depth.setMask(!0),I.buffers.color.setMask(!0),I.setPolygonOffset(!1)}function dx(k,se,ge,de){if((ge.isScene===!0?ge.overrideMaterial:null)!==null)return;if(E.state.transmissionRenderTarget[de.id]===void 0){let V=Ge.has("EXT_color_buffer_half_float")||Ge.has("EXT_color_buffer_float");E.state.transmissionRenderTarget[de.id]=new Et(1,1,{generateMipmaps:!0,type:V?hr:Dn,minFilter:$o,samples:Math.max(4,z.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Jt.workingColorSpace})}let st=E.state.transmissionRenderTarget[de.id],lt=de.viewport||J;st.setSize(lt.z*A.transmissionResolutionScale,lt.w*A.transmissionResolutionScale);let it=A.getRenderTarget(),dt=A.getActiveCubeFace(),R=A.getActiveMipmapLevel();A.setRenderTarget(st),A.getClearColor(me),ve=A.getClearAlpha(),ve<1&&A.setClearColor(16777215,.5),A.clear(),B&&Ut.render(ge);let N=A.toneMapping;A.toneMapping=Pa;let H=de.viewport;if(de.viewport!==void 0&&(de.viewport=void 0),E.setupLightsView(de),ye===!0&&rt.setGlobalState(A.clippingPlanes,de),Dh(k,ge,de),ae.updateMultisampleRenderTarget(st),ae.updateRenderTargetMipmap(st),Ge.has("WEBGL_multisampled_render_to_texture")===!1){let V=!1;for(let K=0,Ie=se.length;K<Ie;K++){let zn=se[K],{object:Mn,geometry:zr,material:ct,group:Ti}=zn;if(ct.side===xr&&Mn.layers.test(de.layers)){let nn=ct.side;ct.side=Hr,ct.needsUpdate=!0,Lh(Mn,ge,de,zr,ct,Ti),ct.side=nn,ct.needsUpdate=!0,V=!0}}V===!0&&(ae.updateMultisampleRenderTarget(st),ae.updateRenderTargetMipmap(st))}A.setRenderTarget(it,dt,R),A.setClearColor(me,ve),H!==void 0&&(de.viewport=H),A.toneMapping=N}function Dh(k,se,ge){let de=se.isScene===!0?se.overrideMaterial:null;for(let te=0,st=k.length;te<st;te++){let lt=k[te],{object:it,geometry:dt,group:R}=lt,N=lt.material;N.allowOverride===!0&&de!==null&&(N=de),it.layers.test(ge.layers)&&Lh(it,se,ge,dt,N,R)}}function Lh(k,se,ge,de,te,st){k.onBeforeRender(A,se,ge,de,te,st),k.modelViewMatrix.multiplyMatrices(ge.matrixWorldInverse,k.matrixWorld),k.normalMatrix.getNormalMatrix(k.modelViewMatrix),te.onBeforeRender(A,se,ge,de,k,st),te.transparent===!0&&te.side===xr&&te.forceSinglePass===!1?(te.side=Hr,te.needsUpdate=!0,A.renderBufferDirect(ge,se,de,te,k,st),te.side=ys,te.needsUpdate=!0,A.renderBufferDirect(ge,se,de,te,k,st),te.side=xr):A.renderBufferDirect(ge,se,de,te,k,st),k.onAfterRender(A,se,ge,de,te,st)}function Jr(k,se,ge){se.isScene!==!0&&(se=Oe);let de=Z.get(k),te=E.state.lights,st=E.state.shadowsArray,lt=te.state.version,it=Ke.getParameters(k,te.state,st,se,ge,E.state.lightProbeGridArray),dt=Ke.getProgramCacheKey(it),R=de.programs;de.environment=k.isMeshStandardMaterial||k.isMeshLambertMaterial||k.isMeshPhongMaterial?se.environment:null,de.fog=se.fog;let N=k.isMeshStandardMaterial||k.isMeshLambertMaterial&&!k.envMap||k.isMeshPhongMaterial&&!k.envMap;de.envMap=be.get(k.envMap||de.environment,N),de.envMapRotation=de.environment!==null&&k.envMap===null?se.environmentRotation:k.envMapRotation,R===void 0&&(k.addEventListener("dispose",ro),R=new Map,de.programs=R);let H=R.get(dt);if(H!==void 0){if(de.currentProgram===H&&de.lightsStateVersion===lt)return xl(k,it),H}else it.uniforms=Ke.getUniforms(k),P!==null&&k.isNodeMaterial&&P.build(k,ge,it),k.onBeforeCompile(it,A),H=Ke.acquireProgram(it,dt),R.set(dt,H),de.uniforms=it.uniforms;let V=de.uniforms;return(!k.isShaderMaterial&&!k.isRawShaderMaterial||k.clipping===!0)&&(V.clippingPlanes=rt.uniform),xl(k,it),de.needsLights=fx(k),de.lightsStateVersion=lt,de.needsLights&&(V.ambientLightColor.value=te.state.ambient,V.lightProbe.value=te.state.probe,V.directionalLights.value=te.state.directional,V.directionalLightShadows.value=te.state.directionalShadow,V.spotLights.value=te.state.spot,V.spotLightShadows.value=te.state.spotShadow,V.rectAreaLights.value=te.state.rectArea,V.ltc_1.value=te.state.rectAreaLTC1,V.ltc_2.value=te.state.rectAreaLTC2,V.pointLights.value=te.state.point,V.pointLightShadows.value=te.state.pointShadow,V.hemisphereLights.value=te.state.hemi,V.directionalShadowMatrix.value=te.state.directionalShadowMatrix,V.spotLightMatrix.value=te.state.spotLightMatrix,V.spotLightMap.value=te.state.spotLightMap,V.pointShadowMatrix.value=te.state.pointShadowMatrix),de.lightProbeGrid=E.state.lightProbeGridArray.length>0,de.currentProgram=H,de.uniformsList=null,H}function Ag(k){if(k.uniformsList===null){let se=k.currentProgram.getUniforms();k.uniformsList=Tp.seqWithValue(se.seq,k.uniforms)}return k.uniformsList}function xl(k,se){let ge=Z.get(k);ge.outputColorSpace=se.outputColorSpace,ge.batching=se.batching,ge.batchingColor=se.batchingColor,ge.instancing=se.instancing,ge.instancingColor=se.instancingColor,ge.instancingMorph=se.instancingMorph,ge.skinning=se.skinning,ge.morphTargets=se.morphTargets,ge.morphNormals=se.morphNormals,ge.morphColors=se.morphColors,ge.morphTargetsCount=se.morphTargetsCount,ge.numClippingPlanes=se.numClippingPlanes,ge.numIntersection=se.numClipIntersection,ge.vertexAlphas=se.vertexAlphas,ge.vertexTangents=se.vertexTangents,ge.toneMapping=se.toneMapping}function hx(k,se){if(k.length===0)return null;if(k.length===1)return k[0].texture!==null?k[0]:null;x.setFromMatrixPosition(se.matrixWorld);for(let ge=0,de=k.length;ge<de;ge++){let te=k[ge];if(te.texture!==null&&te.boundingBox.containsPoint(x))return te}return null}function tr(k,se,ge,de,te){se.isScene!==!0&&(se=Oe),ae.resetTextureUnits();let st=se.fog,lt=de.isMeshStandardMaterial||de.isMeshLambertMaterial||de.isMeshPhongMaterial?se.environment:null,it=Y===null?A.outputColorSpace:Y.isXRRenderTarget===!0?Y.texture.colorSpace:Jt.workingColorSpace,dt=de.isMeshStandardMaterial||de.isMeshLambertMaterial&&!de.envMap||de.isMeshPhongMaterial&&!de.envMap,R=be.get(de.envMap||lt,dt),N=de.vertexColors===!0&&!!ge.attributes.color&&ge.attributes.color.itemSize===4,H=!!ge.attributes.tangent&&(!!de.normalMap||de.anisotropy>0),V=!!ge.morphAttributes.position,K=!!ge.morphAttributes.normal,Ie=!!ge.morphAttributes.color,zn=Pa;de.toneMapped&&(Y===null||Y.isXRRenderTarget===!0)&&(zn=A.toneMapping);let Mn=ge.morphAttributes.position||ge.morphAttributes.normal||ge.morphAttributes.color,zr=Mn!==void 0?Mn.length:0,ct=Z.get(de),Ti=E.state.lights;if(ye===!0&&(Te===!0||k!==ee)){let ur=k===ee&&de.id===oe;rt.setState(de,k,ur)}let nn=!1;de.version===ct.__version?(ct.needsLights&&ct.lightsStateVersion!==Ti.state.version||ct.outputColorSpace!==it||te.isBatchedMesh&&ct.batching===!1||!te.isBatchedMesh&&ct.batching===!0||te.isBatchedMesh&&ct.batchingColor===!0&&te.colorTexture===null||te.isBatchedMesh&&ct.batchingColor===!1&&te.colorTexture!==null||te.isInstancedMesh&&ct.instancing===!1||!te.isInstancedMesh&&ct.instancing===!0||te.isSkinnedMesh&&ct.skinning===!1||!te.isSkinnedMesh&&ct.skinning===!0||te.isInstancedMesh&&ct.instancingColor===!0&&te.instanceColor===null||te.isInstancedMesh&&ct.instancingColor===!1&&te.instanceColor!==null||te.isInstancedMesh&&ct.instancingMorph===!0&&te.morphTexture===null||te.isInstancedMesh&&ct.instancingMorph===!1&&te.morphTexture!==null||ct.envMap!==R||de.fog===!0&&ct.fog!==st||ct.numClippingPlanes!==void 0&&(ct.numClippingPlanes!==rt.numPlanes||ct.numIntersection!==rt.numIntersection)||ct.vertexAlphas!==N||ct.vertexTangents!==H||ct.morphTargets!==V||ct.morphNormals!==K||ct.morphColors!==Ie||ct.toneMapping!==zn||ct.morphTargetsCount!==zr||!!ct.lightProbeGrid!=E.state.lightProbeGridArray.length>0)&&(nn=!0):(nn=!0,ct.__version=de.version);let io=ct.currentProgram;nn===!0&&(io=Jr(de,se,te),P&&de.isNodeMaterial&&P.onUpdateProgram(de,io,ct));let Ea=!1,Fc=!1,Nh=!1,Gn=io.getUniforms(),Gr=ct.uniforms;if(I.useProgram(io.program)&&(Ea=!0,Fc=!0,Nh=!0),de.id!==oe&&(oe=de.id,Fc=!0),ct.needsLights){let ur=hx(E.state.lightProbeGridArray,te);ct.lightProbeGrid!==ur&&(ct.lightProbeGrid=ur,Fc=!0)}if(Ea||ee!==k){I.buffers.depth.getReversed()&&k.reversedDepth!==!0&&(k._reversedDepth=!0,k.updateProjectionMatrix()),Gn.setValue(W,"projectionMatrix",k.projectionMatrix),Gn.setValue(W,"viewMatrix",k.matrixWorldInverse);let kc=Gn.map.cameraPosition;kc!==void 0&&kc.setValue(W,He.setFromMatrixPosition(k.matrixWorld)),z.logarithmicDepthBuffer&&Gn.setValue(W,"logDepthBufFC",2/(Math.log(k.far+1)/Math.LN2)),(de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshLambertMaterial||de.isMeshBasicMaterial||de.isMeshStandardMaterial||de.isShaderMaterial)&&Gn.setValue(W,"isOrthographic",k.isOrthographicCamera===!0),ee!==k&&(ee=k,Fc=!0,Nh=!0)}if(ct.needsLights&&(Ti.state.directionalShadowMap.length>0&&Gn.setValue(W,"directionalShadowMap",Ti.state.directionalShadowMap,ae),Ti.state.spotShadowMap.length>0&&Gn.setValue(W,"spotShadowMap",Ti.state.spotShadowMap,ae),Ti.state.pointShadowMap.length>0&&Gn.setValue(W,"pointShadowMap",Ti.state.pointShadowMap,ae)),te.isSkinnedMesh){Gn.setOptional(W,te,"bindMatrix"),Gn.setOptional(W,te,"bindMatrixInverse");let ur=te.skeleton;ur&&(ur.boneTexture===null&&ur.computeBoneTexture(),Gn.setValue(W,"boneTexture",ur.boneTexture,ae))}te.isBatchedMesh&&(Gn.setOptional(W,te,"batchingTexture"),Gn.setValue(W,"batchingTexture",te._matricesTexture,ae),Gn.setOptional(W,te,"batchingIdTexture"),Gn.setValue(W,"batchingIdTexture",te._indirectTexture,ae),Gn.setOptional(W,te,"batchingColorTexture"),te._colorsTexture!==null&&Gn.setValue(W,"batchingColorTexture",te._colorsTexture,ae));let Uc=ge.morphAttributes;if((Uc.position!==void 0||Uc.normal!==void 0||Uc.color!==void 0)&&$.update(te,ge,io),(Fc||ct.receiveShadow!==te.receiveShadow)&&(ct.receiveShadow=te.receiveShadow,Gn.setValue(W,"receiveShadow",te.receiveShadow)),(de.isMeshStandardMaterial||de.isMeshLambertMaterial||de.isMeshPhongMaterial)&&de.envMap===null&&se.environment!==null&&(Gr.envMapIntensity.value=se.environmentIntensity),Gr.dfgLUT!==void 0&&(Gr.dfgLUT.value=dZ()),Fc){if(Gn.setValue(W,"toneMappingExposure",A.toneMappingExposure),ct.needsLights&&px(Gr,Nh),st&&de.fog===!0&&xt.refreshFogUniforms(Gr,st),xt.refreshMaterialUniforms(Gr,de,ce,Ee,E.state.transmissionRenderTarget[k.id]),ct.needsLights&&ct.lightProbeGrid){let ur=ct.lightProbeGrid;Gr.probesSH.value=ur.texture,Gr.probesMin.value.copy(ur.boundingBox.min),Gr.probesMax.value.copy(ur.boundingBox.max),Gr.probesResolution.value.copy(ur.resolution)}Tp.upload(W,Ag(ct),Gr,ae)}if(de.isShaderMaterial&&de.uniformsNeedUpdate===!0&&(Tp.upload(W,Ag(ct),Gr,ae),de.uniformsNeedUpdate=!1),de.isSpriteMaterial&&Gn.setValue(W,"center",te.center),Gn.setValue(W,"modelViewMatrix",te.modelViewMatrix),Gn.setValue(W,"normalMatrix",te.normalMatrix),Gn.setValue(W,"modelMatrix",te.matrixWorld),te.previousModelViewMatrix&&Gn.setValue(W,"previousModelViewMatrix",te.previousModelViewMatrix),k.previousProjectionMatrix&&Gn.setValue(W,"previousProjectionMatrix",k.previousProjectionMatrix),de.uniformsGroups!==void 0){let ur=de.uniformsGroups;for(let kc=0,Bh=ur.length;kc<Bh;kc++){let WD=ur[kc];Ue.update(WD,io),Ue.bind(WD,io)}}return io}function px(k,se){k.ambientLightColor.needsUpdate=se,k.lightProbe.needsUpdate=se,k.directionalLights.needsUpdate=se,k.directionalLightShadows.needsUpdate=se,k.pointLights.needsUpdate=se,k.pointLightShadows.needsUpdate=se,k.spotLights.needsUpdate=se,k.spotLightShadows.needsUpdate=se,k.rectAreaLights.needsUpdate=se,k.hemisphereLights.needsUpdate=se}function fx(k){return k.isMeshLambertMaterial||k.isMeshToonMaterial||k.isMeshPhongMaterial||k.isMeshStandardMaterial||k.isShadowMaterial||k.isShaderMaterial&&k.lights===!0}this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return Y},this.setRenderTargetTextures=function(k,se,ge){let de=Z.get(k);de.__autoAllocateDepthBuffer=k.resolveDepthBuffer===!1,de.__autoAllocateDepthBuffer===!1&&(de.__useRenderToTexture=!1),Z.get(k.texture).__webglTexture=se,Z.get(k.depthTexture).__webglTexture=de.__autoAllocateDepthBuffer?void 0:ge,de.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(k,se){let ge=Z.get(k);ge.__webglFramebuffer=se,ge.__useDefaultFramebuffer=se===void 0},this.setRenderTarget=function(k,se=0,ge=0){Y=k,U=se,G=ge;let de=null,te=!1,st=!1;if(k){let it=Z.get(k);if(it.__useDefaultFramebuffer!==void 0){I.bindFramebuffer(W.FRAMEBUFFER,it.__webglFramebuffer),J.copy(k.viewport),Q.copy(k.scissor),re=k.scissorTest,I.viewport(J),I.scissor(Q),I.setScissorTest(re),oe=-1;return}else if(it.__webglFramebuffer===void 0)ae.setupRenderTarget(k);else if(it.__hasExternalTextures)ae.rebindTextures(k,Z.get(k.texture).__webglTexture,Z.get(k.depthTexture).__webglTexture);else if(k.depthBuffer){let N=k.depthTexture;if(it.__boundDepthTexture!==N){if(N!==null&&Z.has(N)&&(k.width!==N.image.width||k.height!==N.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");ae.setupDepthRenderbuffer(k)}}let dt=k.texture;(dt.isData3DTexture||dt.isDataArrayTexture||dt.isCompressedArrayTexture)&&(st=!0);let R=Z.get(k).__webglFramebuffer;k.isWebGLCubeRenderTarget?(Array.isArray(R[se])?de=R[se][ge]:de=R[se],te=!0):k.samples>0&&ae.useMultisampledRTT(k)===!1?de=Z.get(k).__webglMultisampledFramebuffer:Array.isArray(R)?de=R[ge]:de=R,J.copy(k.viewport),Q.copy(k.scissor),re=k.scissorTest}else J.copy(Le).multiplyScalar(ce).floor(),Q.copy(ke).multiplyScalar(ce).floor(),re=Ce;if(ge!==0&&(de=D),I.bindFramebuffer(W.FRAMEBUFFER,de)&&I.drawBuffers(k,de),I.viewport(J),I.scissor(Q),I.setScissorTest(re),te){let it=Z.get(k.texture);W.framebufferTexture2D(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_CUBE_MAP_POSITIVE_X+se,it.__webglTexture,ge)}else if(st){let it=se;for(let dt=0;dt<k.textures.length;dt++){let R=Z.get(k.textures[dt]);W.framebufferTextureLayer(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0+dt,R.__webglTexture,ge,it)}}else if(k!==null&&ge!==0){let it=Z.get(k.texture);W.framebufferTexture2D(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_2D,it.__webglTexture,ge)}oe=-1},this.readRenderTargetPixels=function(k,se,ge,de,te,st,lt,it=0){if(!(k&&k.isWebGLRenderTarget)){Dt("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let dt=Z.get(k).__webglFramebuffer;if(k.isWebGLCubeRenderTarget&&lt!==void 0&&(dt=dt[lt]),dt){I.bindFramebuffer(W.FRAMEBUFFER,dt);try{let R=k.textures[it],N=R.format,H=R.type;if(k.textures.length>1&&W.readBuffer(W.COLOR_ATTACHMENT0+it),!z.textureFormatReadable(N)){Dt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!z.textureTypeReadable(H)){Dt("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}se>=0&&se<=k.width-de&&ge>=0&&ge<=k.height-te&&W.readPixels(se,ge,de,te,$e.convert(N),$e.convert(H),st)}finally{let R=Y!==null?Z.get(Y).__webglFramebuffer:null;I.bindFramebuffer(W.FRAMEBUFFER,R)}}},this.readRenderTargetPixelsAsync=async function(k,se,ge,de,te,st,lt,it=0){if(!(k&&k.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let dt=Z.get(k).__webglFramebuffer;if(k.isWebGLCubeRenderTarget&&lt!==void 0&&(dt=dt[lt]),dt)if(se>=0&&se<=k.width-de&&ge>=0&&ge<=k.height-te){I.bindFramebuffer(W.FRAMEBUFFER,dt);let R=k.textures[it],N=R.format,H=R.type;if(k.textures.length>1&&W.readBuffer(W.COLOR_ATTACHMENT0+it),!z.textureFormatReadable(N))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!z.textureTypeReadable(H))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let V=W.createBuffer();W.bindBuffer(W.PIXEL_PACK_BUFFER,V),W.bufferData(W.PIXEL_PACK_BUFFER,st.byteLength,W.STREAM_READ),W.readPixels(se,ge,de,te,$e.convert(N),$e.convert(H),0);let K=Y!==null?Z.get(Y).__webglFramebuffer:null;I.bindFramebuffer(W.FRAMEBUFFER,K);let Ie=W.fenceSync(W.SYNC_GPU_COMMANDS_COMPLETE,0);return W.flush(),await yN(W,Ie,4),W.bindBuffer(W.PIXEL_PACK_BUFFER,V),W.getBufferSubData(W.PIXEL_PACK_BUFFER,0,st),W.deleteBuffer(V),W.deleteSync(Ie),st}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(k,se=null,ge=0){let de=Math.pow(2,-ge),te=Math.floor(k.image.width*de),st=Math.floor(k.image.height*de),lt=se!==null?se.x:0,it=se!==null?se.y:0;ae.setTexture2D(k,0),W.copyTexSubImage2D(W.TEXTURE_2D,ge,0,0,lt,it,te,st),I.unbindTexture()},this.copyTextureToTexture=function(k,se,ge=null,de=null,te=0,st=0){let lt,it,dt,R,N,H,V,K,Ie,zn=k.isCompressedTexture?k.mipmaps[st]:k.image;if(ge!==null)lt=ge.max.x-ge.min.x,it=ge.max.y-ge.min.y,dt=ge.isBox3?ge.max.z-ge.min.z:1,R=ge.min.x,N=ge.min.y,H=ge.isBox3?ge.min.z:0;else{let Gr=Math.pow(2,-te);lt=Math.floor(zn.width*Gr),it=Math.floor(zn.height*Gr),k.isDataArrayTexture?dt=zn.depth:k.isData3DTexture?dt=Math.floor(zn.depth*Gr):dt=1,R=0,N=0,H=0}de!==null?(V=de.x,K=de.y,Ie=de.z):(V=0,K=0,Ie=0);let Mn=$e.convert(se.format),zr=$e.convert(se.type),ct;se.isData3DTexture?(ae.setTexture3D(se,0),ct=W.TEXTURE_3D):se.isDataArrayTexture||se.isCompressedArrayTexture?(ae.setTexture2DArray(se,0),ct=W.TEXTURE_2D_ARRAY):(ae.setTexture2D(se,0),ct=W.TEXTURE_2D),I.activeTexture(W.TEXTURE0),I.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,se.flipY),I.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),I.pixelStorei(W.UNPACK_ALIGNMENT,se.unpackAlignment);let Ti=I.getParameter(W.UNPACK_ROW_LENGTH),nn=I.getParameter(W.UNPACK_IMAGE_HEIGHT),io=I.getParameter(W.UNPACK_SKIP_PIXELS),Ea=I.getParameter(W.UNPACK_SKIP_ROWS),Fc=I.getParameter(W.UNPACK_SKIP_IMAGES);I.pixelStorei(W.UNPACK_ROW_LENGTH,zn.width),I.pixelStorei(W.UNPACK_IMAGE_HEIGHT,zn.height),I.pixelStorei(W.UNPACK_SKIP_PIXELS,R),I.pixelStorei(W.UNPACK_SKIP_ROWS,N),I.pixelStorei(W.UNPACK_SKIP_IMAGES,H);let Nh=k.isDataArrayTexture||k.isData3DTexture,Gn=se.isDataArrayTexture||se.isData3DTexture;if(k.isDepthTexture){let Gr=Z.get(k),Uc=Z.get(se),ur=Z.get(Gr.__renderTarget),kc=Z.get(Uc.__renderTarget);I.bindFramebuffer(W.READ_FRAMEBUFFER,ur.__webglFramebuffer),I.bindFramebuffer(W.DRAW_FRAMEBUFFER,kc.__webglFramebuffer);for(let Bh=0;Bh<dt;Bh++)Nh&&(W.framebufferTextureLayer(W.READ_FRAMEBUFFER,W.COLOR_ATTACHMENT0,Z.get(k).__webglTexture,te,H+Bh),W.framebufferTextureLayer(W.DRAW_FRAMEBUFFER,W.COLOR_ATTACHMENT0,Z.get(se).__webglTexture,st,Ie+Bh)),W.blitFramebuffer(R,N,lt,it,V,K,lt,it,W.DEPTH_BUFFER_BIT,W.NEAREST);I.bindFramebuffer(W.READ_FRAMEBUFFER,null),I.bindFramebuffer(W.DRAW_FRAMEBUFFER,null)}else if(te!==0||k.isRenderTargetTexture||Z.has(k)){let Gr=Z.get(k),Uc=Z.get(se);I.bindFramebuffer(W.READ_FRAMEBUFFER,O),I.bindFramebuffer(W.DRAW_FRAMEBUFFER,L);for(let ur=0;ur<dt;ur++)Nh?W.framebufferTextureLayer(W.READ_FRAMEBUFFER,W.COLOR_ATTACHMENT0,Gr.__webglTexture,te,H+ur):W.framebufferTexture2D(W.READ_FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_2D,Gr.__webglTexture,te),Gn?W.framebufferTextureLayer(W.DRAW_FRAMEBUFFER,W.COLOR_ATTACHMENT0,Uc.__webglTexture,st,Ie+ur):W.framebufferTexture2D(W.DRAW_FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_2D,Uc.__webglTexture,st),te!==0?W.blitFramebuffer(R,N,lt,it,V,K,lt,it,W.COLOR_BUFFER_BIT,W.NEAREST):Gn?W.copyTexSubImage3D(ct,st,V,K,Ie+ur,R,N,lt,it):W.copyTexSubImage2D(ct,st,V,K,R,N,lt,it);I.bindFramebuffer(W.READ_FRAMEBUFFER,null),I.bindFramebuffer(W.DRAW_FRAMEBUFFER,null)}else Gn?k.isDataTexture||k.isData3DTexture?W.texSubImage3D(ct,st,V,K,Ie,lt,it,dt,Mn,zr,zn.data):se.isCompressedArrayTexture?W.compressedTexSubImage3D(ct,st,V,K,Ie,lt,it,dt,Mn,zn.data):W.texSubImage3D(ct,st,V,K,Ie,lt,it,dt,Mn,zr,zn):k.isDataTexture?W.texSubImage2D(W.TEXTURE_2D,st,V,K,lt,it,Mn,zr,zn.data):k.isCompressedTexture?W.compressedTexSubImage2D(W.TEXTURE_2D,st,V,K,zn.width,zn.height,Mn,zn.data):W.texSubImage2D(W.TEXTURE_2D,st,V,K,lt,it,Mn,zr,zn);I.pixelStorei(W.UNPACK_ROW_LENGTH,Ti),I.pixelStorei(W.UNPACK_IMAGE_HEIGHT,nn),I.pixelStorei(W.UNPACK_SKIP_PIXELS,io),I.pixelStorei(W.UNPACK_SKIP_ROWS,Ea),I.pixelStorei(W.UNPACK_SKIP_IMAGES,Fc),st===0&&se.generateMipmaps&&W.generateMipmap(ct),I.unbindTexture()},this.initRenderTarget=function(k){Z.get(k).__webglFramebuffer===void 0&&ae.setupRenderTarget(k)},this.initTexture=function(k){k.isCubeTexture?ae.setTextureCube(k,0):k.isData3DTexture?ae.setTexture3D(k,0):k.isDataArrayTexture||k.isCompressedArrayTexture?ae.setTexture2DArray(k,0):ae.setTexture2D(k,0),I.unbindTexture()},this.resetState=function(){U=0,G=0,Y=null,I.reset(),ot.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ho}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=Jt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Jt._getUnpackColorSpace()}}});var gZ,yZ,vZ,bZ,xZ,SZ,wZ,EZ,iC,ihe,TZ,MZ,she,Lp,lo,QN,fi,sC,JN,yS=F(()=>{"use strict";gZ=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),yZ=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),vZ=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Lp&&"ontouchend"in document,bZ=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,xZ=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,SZ=()=>{if(typeof window>"u")return!1;let i=navigator.userAgent,t=navigator.vendor;return/Safari/i.test(i)&&/Apple Computer/.test(t)},wZ=()=>{if(typeof window>"u")return null;let t=navigator.userAgent.match(/Version\/(\d+\.\d)/);return t&&t[1]},EZ=()=>{if(typeof window>"u")return;let t=new URLSearchParams(window.location.search).get("desktop-app-version");return t?(window.localStorage.setItem("desktop-app-version",t),t):window.localStorage.getItem("desktop-app-version")??"0.0.6"},iC=gZ(),ihe=iC?EZ():void 0,TZ=()=>{if(!(typeof window>"u"))return window.spline},MZ=TZ(),she=!!MZ?.isShellTabs,Lp=yZ(),lo=vZ(),QN=bZ(),fi=xZ(),sC=SZ(),JN=Number(wZ())});var e3=F(()=>{"use strict"});function Np(i){return Lp?i.metaKey:i.ctrlKey}function n3(i,t){return Math.abs(i+3*t)<=t3||Math.abs(i+3*window.devicePixelRatio*t)<=t3}function r3(i){return i.wheelDeltaY===0||i.deltaY===0?Lp&&i.shiftKey&&Math.abs(i.wheelDeltaX)>=120?!1:i.wheelDeltaX?n3(i.wheelDeltaX,i.deltaX):i.deltaMode===0:i.wheelDeltaY?n3(i.wheelDeltaY,i.deltaY):i.deltaMode===0}var t3,i3=F(()=>{"use strict";yS();t3=2});var s3=F(()=>{"use strict"});function o3(i){mt.includes(i)||mt.push(i)}function Bp(i){delete bS[i.pointerId];for(let t=0;t<mt.length;t++)if(mt[t].pointerId===i.pointerId){mt.splice(t,1);break}}function a3(){mt.splice(0,mt.length)}function xS(i){if(i.pointerType!=="touch")return;let t=bS[i.pointerId];t===void 0&&(t={x:0,y:0},bS[i.pointerId]=t),t.x=i.pageX,t.y=i.pageY}function SS(i){let t=i.pointerId===mt[0].pointerId?mt[1]:mt[0];return bS[t.pointerId]}function l3(i){Dy[i.key]=!0,vS[i.key]=vS[i.key]===void 0?1:vS[i.key]+1}function c3(i){if(Lp&&Dy.Meta)for(let t in Dy)Dy[t]=!1;else Dy[i.key]=!1;vS={}}function u3(i){i.addEventListener("pointerdown",o3,!0),i.addEventListener("pointerdown",xS,!0),i.addEventListener("pointermove",xS,!0),i.addEventListener("pointerup",Bp,!0),i.addEventListener("pointercancel",Bp,!0),i.addEventListener("pointerleave",Bp,!0),window.addEventListener("keydown",l3,!0),window.addEventListener("keyup",c3,!0)}function d3(i){i.removeEventListener("pointerdown",o3,!0),i.removeEventListener("pointerdown",xS,!0),i.removeEventListener("pointermove",xS,!0),i.removeEventListener("pointerup",Bp,!0),i.removeEventListener("pointercancel",Bp,!0),i.removeEventListener("pointerleave",Bp,!0),window.removeEventListener("keydown",l3,!0),window.removeEventListener("keyup",c3,!0)}var mt,bS,Dy,vS,h3=F(()=>{"use strict";yS();mt=[],bS={},Dy={},vS={}});var phe,p3=F(()=>{"use strict";phe=15+"%"});var _Z,AZ,f3,js,Hs,mhe,m3=F(()=>{"use strict";_Z="/community",AZ="/academy",f3=(()=>typeof window<"u"&&!!window.spline?.isShellTabs)(),js=f3?"/desktop/community":_Z,Hs=f3?"/desktop/academy":AZ,mhe={root:"/",home:"/home",files:"/files",new:"/new",newTab:"/new-tab",filesMatch:"/files/:uuidFolder?",filesFolder:i=>`/files/${i}`,filesFolderMatch:"/files/:uuidFolder",generate:"/generate",academy:Hs,academyMatch:`${Hs}/:subPage?`,academyCollections:`${Hs}/collections`,academyCollectionCategory:i=>`${Hs}/collections/${i}`,academyCollectionCategoryMatch:`${Hs}/collections/:collectionCategory`,academyCollectionContent:(i,t)=>`${Hs}/collections/${i}/${t}`,academyCollectionContentMatch:`${Hs}/collections/:collectionCategory/:pathName`,academyExplore:`${Hs}/explore`,academyTag:i=>`${Hs}/tag/${i}`,academyTagMatcher:`${Hs}/tag/:tag`,academyAllTutorials:`${Hs}/tutorials`,academyTutorial:i=>`${Hs}/tutorials/${i}`,academyTutorialMatch:`${Hs}/tutorials/:pathName`,archived:"/archived",archivedFolder:i=>`/archived/${i}`,archivedMatch:"/archived/:uuidFolder?",recent:"/recent",recentMatch:"/recent/:uuidFolder?",shared:"/shared",sharedMatch:"/shared/:uuidFolder?",file:i=>`/file/${i}`,fileMatch:"/file/:uuid",file2D:i=>`/ui/${i}`,file2DMatch:"/ui/:uuid",library:"/templates",libraryFile:i=>`/templates/${i}`,libraryFileMatch:"/templates/:uuid",starterFile:i=>`/starter/${i}`,starterFileMatch:"/starter/:uuid",libraryHanaFile:i=>`/ui/templates/${i}`,libraryHanaFileMatch:"/ui/templates/:uuid",fileOrLibraryMatch:"/(file|templates|starter)/:uuid",team:i=>`/workspace/${i}`,teamMatch:"/workspace/:uuidTeam",teamSettings:i=>`/workspace-settings/${i}`,teamSettingsMatch:"/workspace-settings/:uuidTeam",workspaceBilling:i=>`/workspace-settings/${i}/billing`,workspaceBillingMatch:"/workspace-settings/:uuidTeam/billing",workspaceMembers:i=>`/workspace-settings/${i}/members`,workspaceMembersMatch:"/workspace-settings/:uuidTeam/members",teamInvitationMatch:"/team-invitation/:uuidTeamLink",inbox:"/inbox",account:"/account",accountReferral:"/account/referral",accountMcp:"/account/mcp",accountWithPopup:"/account?pro",subscribe:{redirectAfter3DSecure:"/subscribe/redirect-after-3d-secure"},signin:{signin:"/signin",code:"/signin/code",desktopAuth:"/auth/desktop"},logout:"/logout",organizationHome:i=>`/${i}/home`,organizationHomeMatch:"/:orgPath/home",organizationTeams:i=>`/${i}/teams`,organizationTeamsMatch:"/:orgPath/teams",organizationMyFilesMatch:"/:orgPath/files/",organizationFiles:i=>`/${i}/files`,organizationFilesMatch:"/:orgPath/files/:uuidFolder?",organizationFilesFolder:(i,t)=>`/${i}/files/${t}`,organizationFilesFolderMatch:"/:orgPath/files/:uuidFolder",organizationShared:i=>`/${i}/shared`,organizationSharedMatch:"/:orgPath/shared",organizationSettings:i=>`/${i}/settings`,organizationSettingsMatch:"/:orgPath/settings",organizationInvitationMatch:"/organization-invitation/:uuidOrg",organizationMembers:i=>`/${i}/members`,organizationMembersMatch:"/:orgPath/members",organizationBilling:i=>`/${i}/billing`,organizationBillingMatch:"/:orgPath/billing",organizationTeamSettings:(i,t)=>`/${i}/team-settings/${t}`,organizationTeamSettingsMatch:"/:orgPath/team-settings/:uuidTeam",organizationTeam:(i,t)=>`/${i}/team/${t}`,organizationTeamMatch:"/:orgPath/team/:uuidTeam",organizationTeamInvitationMatch:"/:orgPath/team-invitation/:uuidTeamLink",project:i=>`/project/${i}`,projectFolder:(i,t)=>`/project/${i}/${t}`,projectMatch:"/project/:uuidProject/:uuidFolder?",community:js,communityMatch:`${js}/:subPage?`,communityFeed:`${js}/feed`,communityNotifications:`${js}/notifications`,communitySearch:`${js}/search`,communityHana:`${js}/hana`,communityHana3DShapes:`${js}/hana-3d-shapes`,communityTag:i=>`${js}/tag/${i}`,communityTagMatcher:`${js}/tag/:tag`,communityCollection:i=>`${js}/collection/${i}`,communityCollectionMatcher:`${js}/collection/:collection`,communityFile:i=>`${js}/file/${i}`,communityFileMatch:`${js}/file/:uuidCommunityFile?`,communityProfile:i=>`/@${i}`,communityProfileMatch:"/@(?<handle>[^/@]+)/",communityProfileSettings:"/account/profile",signup:{step1:"/signup/onboarding-step1",step2:"/signup/onboarding-step2",step3:"/signup/onboarding-step3"}}});var g3=F(()=>{"use strict"});function ru(i,t=0,e={}){let n=e.leading===!0,r=e.trailing!==!1,s=e.maxWait!==void 0?Math.max(e.maxWait,t):void 0,o,a,l,c,u,d=0,h=v=>{let b=a,x=l;return a=l=void 0,d=v,c=i.apply(x,b),c},p=v=>{if(u===void 0)return!0;let b=v-u,x=v-d;return b>=t||b<0||s!==void 0&&x>=s},f=v=>{let b=t-(v-u);return s!==void 0?Math.min(b,s-(v-d)):b},g=v=>(o=void 0,r&&a?h(v):(a=l=void 0,c)),m=()=>{let v=Date.now();p(v)?g(v):o=setTimeout(m,f(v))},y=function(...v){let b=Date.now(),x=p(b);if(a=v,l=this,u=b,x){if(o===void 0)return d=b,o=setTimeout(m,t),n?h(b):c;if(s!==void 0)return o=setTimeout(m,t),h(b)}return o===void 0&&(o=setTimeout(m,t)),c};return y.cancel=()=>{o!==void 0&&clearTimeout(o),d=0,a=u=l=o=void 0},y.flush=()=>o===void 0?c:g(Date.now()),y}function y3(i,t=0,e={}){return ru(i,t,{leading:e.leading!==!1,trailing:e.trailing!==!1,maxWait:t})}function iu(i){return Fp(i,new Map)}function Fp(i,t){if(i===null||typeof i!="object")return i;if(t.has(i))return t.get(i);if(i instanceof Date)return new Date(i.getTime());if(i instanceof RegExp){let n=new RegExp(i.source,i.flags);return n.lastIndex=i.lastIndex,n}if(i instanceof ArrayBuffer)return i.slice(0);if(ArrayBuffer.isView(i))return new i.constructor(i.buffer.slice(0),i.byteOffset,i instanceof DataView?i.byteLength:i.length);if(i instanceof Map){let n=new Map;return t.set(i,n),i.forEach((r,s)=>n.set(Fp(s,t),Fp(r,t))),n}if(i instanceof Set){let n=new Set;return t.set(i,n),i.forEach(r=>n.add(Fp(r,t))),n}if(Array.isArray(i)){let n=new i.constructor(i.length);t.set(i,n);for(let[r,s]of Object.entries(i))n[r]=Fp(s,t);return n}let e=Object.create(Object.getPrototypeOf(i));t.set(i,e);for(let[n,r]of Object.entries(i))e[n]=Fp(r,t);return e}function ql(i,t){if(Object.is(i,t)||i!==i&&t!==t)return!0;if(i===null||t===null||typeof i!="object"||typeof t!="object")return!1;if(i instanceof Date||t instanceof Date)return i instanceof Date&&t instanceof Date&&i.getTime()===t.getTime();if(i instanceof RegExp||t instanceof RegExp)return i instanceof RegExp&&t instanceof RegExp&&i.source===t.source&&i.flags===t.flags;if(Array.isArray(i)||Array.isArray(t))return!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length?!1:i.every((r,s)=>ql(r,t[s]));if(ArrayBuffer.isView(i)||ArrayBuffer.isView(t))return!ArrayBuffer.isView(i)||!ArrayBuffer.isView(t)||i.constructor!==t.constructor||i.length!==t.length?!1:i.every((r,s)=>Object.is(r,t[s]));if(i instanceof Map||t instanceof Map){if(!(i instanceof Map)||!(t instanceof Map)||i.size!==t.size)return!1;for(let[r,s]of i)if(!t.has(r)||!ql(s,t.get(r)))return!1;return!0}if(i instanceof Set||t instanceof Set){if(!(i instanceof Set)||!(t instanceof Set)||i.size!==t.size)return!1;for(let r of i)if(!t.has(r))return!1;return!0}let e=Object.keys(i),n=Object.keys(t);return e.length!==n.length?!1:e.every(r=>Object.prototype.hasOwnProperty.call(t,r)&&ql(i[r],t[r]))}function Ly(i,t){let e={};for(let n of t)n in i&&(e[n]=i[n]);return e}function Ny(i,t){let e=new Set(t),n={};for(let[r,s]of Object.entries(i))e.has(r)||(n[r]=s);return n}function v3(i){if(!i||i.length===0)return;let t;for(let e of i)e===e&&(t===void 0||e>t)&&(t=e);return t}function b3(i,t){if(t===void 0)return i.replace(/\s+$/,"");let e=i.length;for(;e>0&&t.includes(i[e-1]);)e--;return i.slice(0,e)}var x3=F(()=>{"use strict"});var S3=F(()=>{"use strict"});var w3=F(()=>{"use strict"});var T3=Fh(wS=>{"use strict";var CZ=Symbol.for("react.transitional.element"),PZ=Symbol.for("react.fragment");function E3(i,t,e){var n=null;if(e!==void 0&&(n=""+e),t.key!==void 0&&(n=""+t.key),"key"in t){e={};for(var r in t)r!=="key"&&(e[r]=t[r])}else e=t;return t=e.ref,{$$typeof:CZ,type:i,key:n,ref:t!==void 0?t:null,props:e}}wS.Fragment=PZ;wS.jsx=E3;wS.jsxs=E3});var oC=Fh((whe,M3)=>{"use strict";M3.exports=T3()});var _3,A3=F(()=>{"use strict";_3=Qu(oC(),1)});function C3(i){return typeof i=="object"&&i!==null&&i[Xl]===!0&&typeof i.kind=="string"}function P3(i,t){let e=`<script>${t}<\/script>`,n=/<head(\s[^>]*)?>/i.exec(i);if(n){let s=n.index+n[0].length;return i.slice(0,s)+e+i.slice(s)}let r=/<html(\s[^>]*)?>/i.exec(i);if(r){let s=r.index+r[0].length;return i.slice(0,s)+`<head>${e}</head>`+i.slice(s)}return e+i}var Xl,ES=F(()=>{"use strict";Xl="__splineHtmlContent"});var I3,R3=F(()=>{"use strict";ES();I3=`(function () {
3831
3831
  'use strict';
3832
3832
  var MARKER = ${JSON.stringify(Xl)};
3833
3833
  var callSeq = 1;
@@ -4124,14 +4124,14 @@ void main() {
4124
4124
  }
4125
4125
  post({ kind: 'ready' });
4126
4126
  }, 250);
4127
- })();`});function RZ(i,t){let e=[];for(let n of Object.keys(t))i[n]!==t[n]&&e.push({name:n,value:t[n]});return e}var IZ,Up,aC=F(()=>{"use strict";IZ=100;Up=class{constructor(t,e,n){this.deps=t;this.onConsole=e;this.onEvent=n;this.disposed=!1;this.eventUnsubs=new Map;this.variablePollHandle=null;this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let n=this.deps;switch(t){case"setVariable":{let r=n.setVariable(String(e[0]),e[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=e[0]??{},s=!0;for(let[o,a]of Object.entries(r)){let l=n.setVariable(o,a);l.warning&&this.onConsole("warn",l.warning),s=s&&l.ok}return s}case"getVariable":return n.getVariable(String(e[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(e[0]));case"getGeometry":{let r=n.getGeometry(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return n.updateObject(String(e[0]),e[1]??{});case"createObject":return n.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":{if(n.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(e[0])}case"setMaterial":{if(n.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.setMaterial(String(e[0]),e[1])}case"cloneObject":return n.cloneObject(String(e[0]),e[1]??{});case"removeObject":return n.removeObject(String(e[0]));case"spawnObject":{let r=n.spawnObject(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return n.destroyObject(String(e[0]));case"setInstanceTransforms":{let r=e[1]===null||e[1]===void 0?null:e[1],s=n.setInstanceTransforms(String(e[0]),r);return s<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),s}case"emitEvent":case"emitEventReverse":{let r=n.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return n.requestRender(),!0;case"listenEvent":{let r=String(e[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,n.addSplineEventListener(r,s=>{this.onEvent(r,s)})),!0}case"unlistenEvent":{let r=String(e[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:{let r=t;throw new Error(`Unknown spline bridge method: ${r}`)}}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=RZ(this.lastVariables??{},t);this.lastVariables=t;for(let n of e)this.onEvent("variableChange",n)},IZ))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function OZ(i,t,e,n){return[i[0]*t+i[4]*e+i[8]*n+i[12],i[1]*t+i[5]*e+i[9]*n+i[13],i[2]*t+i[6]*e+i[10]*n+i[14]]}function DZ(i){let t=i[0],e=i[4],n=i[8],r=i[1],s=i[5],o=i[9],a=i[2],l=i[6],c=i[10],u=t*(s*c-o*l)-e*(r*c-o*a)+n*(r*l-s*a);if(!isFinite(u)||Math.abs(u)<1e-12)return null;let d=1/u,h=[(s*c-o*l)*d,(n*l-e*c)*d,(e*o-n*s)*d,(o*a-r*c)*d,(t*c-n*a)*d,(n*r-t*o)*d,(r*l-s*a)*d,(e*a-t*l)*d,(t*s-e*r)*d];return[h[0],h[3],h[6],h[1],h[4],h[7],h[2],h[5],h[8]]}function O3(i,t){let e=i?.getAttribute("position");if(!e||!e.count)return null;let n=e.count,r=t??null,s=i.getIndex?.()??null,o=Math.floor((s?s.count:n)/3),a=1/0,l=1/0,c=1/0,u=-1/0,d=-1/0,h=-1/0,p=new Float32Array(n*3);for(let y=0;y<n;y++){let v=e.getX(y),b=e.getY(y),x=e.getZ(y);r&&([v,b,x]=OZ(r,v,b,x)),v<a&&(a=v),b<l&&(l=b),x<c&&(c=x),v>u&&(u=v),b>d&&(d=b),x>h&&(h=x),p[y*3]=v,p[y*3+1]=b,p[y*3+2]=x}let f={space:r?"world":"local",vertexCount:n,triangleCount:o,indexed:s!==null,bounds:{min:[a,l,c],max:[u,d,h],size:[u-a,d-l,h-c]},vertices:p};if(s){let y=new Uint32Array(s.count);for(let v=0;v<s.count;v++)y[v]=s.getX(v);f.indices=y}let g=i.getAttribute("normal");if(g&&g.count===n){let y=r?DZ(r):void 0;if(!r||y){let v=new Float32Array(n*3);for(let b=0;b<n;b++){let x=g.getX(b),S=g.getY(b),E=g.getZ(b);if(y){let T=y[0]*x+y[1]*S+y[2]*E,w=y[3]*x+y[4]*S+y[5]*E,_=y[6]*x+y[7]*S+y[8]*E,A=Math.hypot(T,w,_);A>1e-12?(x=T/A,S=w/A,E=_/A):(x=T,S=w,E=_)}v[b*3]=x,v[b*3+1]=S,v[b*3+2]=E}f.normals=v}}let m=i.getAttribute("uv");if(m&&m.count===n){let y=new Float32Array(n*2);for(let v=0;v<n;v++)y[v*2]=m.getX(v),y[v*2+1]=m.getY(v);f.uvs=y}return f}var D3=F(()=>{"use strict"});function L3(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let i=[],t=(r,s,o)=>{let a=new Event(o);try{typeof s=="function"?s.call(r,a):s.handleEvent?.(a)}catch(l){console.error(l)}},e=(r,s)=>{let o=new Set,a=r.addEventListener.bind(r),l=r.removeEventListener.bind(r),c=(d,h,p)=>{if(a(d,h,p),!s.includes(d)||h==null)return;let f={type:d,listener:h};o.add(f),queueMicrotask(()=>{!o.delete(f)||t(r,f.listener,f.type)})},u=(d,h,p)=>{l(d,h,p);for(let f of o)f.type===d&&f.listener===h&&o.delete(f)};Object.defineProperty(r,"addEventListener",{configurable:!0,writable:!0,value:c}),Object.defineProperty(r,"removeEventListener",{configurable:!0,writable:!0,value:u}),i.push(()=>{delete r.addEventListener,delete r.removeEventListener,o.clear()})};e(document,["DOMContentLoaded"]),e(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:r=>{typeof r=="function"&&queueMicrotask(()=>{try{r.call(window,new Event("load"))}catch(s){console.error(s)}})}}),i.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let r of i)r()}}var N3=F(()=>{"use strict"});var LZ,TS,B3=F(()=>{"use strict";ES();aC();LZ=6e3,TS=class{constructor(t,e,n){this.iframe=t;this.deps=e;this.onConsole=n;this.disposed=!1;this.handshakeSeen=!1;this.handshakeTimer=null;this.onMessage=t=>{if(this.disposed||t.source!==this.iframe.contentWindow)return;let e=t.data;!C3(e)||this.handleMessage(e)};this.host=new Up(e,n,(r,s)=>{this.sendEvent(r,s)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Xl]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},LZ)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[Xl]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(n){e=Promise.reject(n)}e.then(n=>{this.send({[Xl]:!0,kind:"result",id:t.id,ok:!0,value:n,error:void 0})},n=>{let r=n instanceof Error?n.message:String(n);this.send({[Xl]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(t.event);break}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[Xl]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let n=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":{e.dispatchEvent(new PointerEvent(t.type,{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break}case"click":case"dblclick":{e.dispatchEvent(new MouseEvent(t.type,{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,button:t.button,buttons:t.buttons}));break}case"wheel":{let s=new WheelEvent("wheel",{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(s,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(s,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(s);break}case"keydown":case"keyup":{e.dispatchEvent(new KeyboardEvent(t.type,{...r,key:t.key,code:t.code,repeat:t.repeat}));break}}}}});var gn=F(()=>{yS();e3();i3();s3();h3();p3();m3();g3();x3();S3();w3();A3();ES();R3();aC();D3();N3();B3()});var F3=F(()=>{"use strict"});function MS(i){return Array.isArray(i)?i:[i]}function Cd(i,t){let e=0;for(;e<i.length&&e<t.length;){if(i[e]<t[e])return-1;if(i[e]>t[e])return 1;e+=1}return e!==t.length?-1:e!==i.length?1:0}var U3=F(()=>{"use strict"});function Wr(i,t){return Object.setPrototypeOf(i,t),i}function _S(i){let t={...i};return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}function Oa(i,t,e){if(i===void 0?t===void 0?(i=0,t=10):i=t-10:t===void 0&&(t=i+10),i>t){let s=i;i=t,t=s}let n=[],r=1/(e+1);for(let s=0;s<e;s++){let o=i+(t-i)*(s+.75+Math.random()*.5)*r;n.push(o)}return n}function kp(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function k3(){return typeof process<"u"}var V3=F(()=>{"use strict"});function By(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let t=Object.getOwnPropertyNames(i);for(let e of t){let n=i[e];n&&typeof n=="object"&&By(n)}return Object.freeze(i)}function AS(i){for(let t of Object.keys(i))i[t]===void 0&&delete i[t];return i}var z3=F(()=>{"use strict"});var mi=F(()=>{F3();U3();V3();z3()});var CS,Pd,Fy,PS=F(()=>{"use strict";CS=class{},Pd=class extends CS{constructor(e){super();this.id=e}},Fy=class extends CS{constructor(e){super();this.data=e}}});var G3=F(()=>{"use strict"});var at,Uy=F(()=>{"use strict";at=class{modifyById(t,e){let n=this;if(n[t]===void 0)throw new Error("not expected");{let s={...n,[t]:e};return Object.setPrototypeOf(s,at.prototype),s}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let n=e[t.id],r;n===void 0?r={type:2,id:t.id}:r={type:1,id:t.id,data:n};let{id:s,data:o}=t,a={...e,[s]:o};return Object.setPrototypeOf(a,at.prototype),{data:a,actual:t,reverse:r}}else if(t.type===2){let{id:n}=t,r=e[n];if(r===void 0)return null;{let s={...e};return Object.setPrototypeOf(s,at.prototype),delete s[n],{data:s,actual:t,reverse:{type:1,id:n,data:r}}}}return null}}});var Vp,IS=F(()=>{"use strict";Vp=class extends Error{}});function j3(i,t){for(let e of i)t(e.id,e.data)!==!0&&j3(e.children,t)}function H3(i,t){if(t(i.id,i.data)!==!0)for(let e of i.children)H3(e,t)}var Ln,su=F(()=>{"use strict";mi();IS();mi();Ln=class extends Array{constructor(...e){super(...e);zi(this,"partialObjectCaches");zi(this,"objCaches");zi(this,"parentCaches");Object.setPrototypeOf(this,Ln.prototype)}deepFreeze(){let e=0;for(;e<this.length;)By(this[e]),e++}fillCaches0(e,n){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,n);for(let r of e.children)this.fillCaches0(r,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,n){if(!this.has(e))return!0;for(;e;){let r=this.parent(e);if(r===n)return!0;e=r}return!1}rootAcestor(e){for(;e;){let n=this.parent(e);if(n)e=n;else return e}return e}isDescendantOf(e,n){for(;e;){let r=this.parent(e);if(r===n)return!0;e=r}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let n=this.get(e);n!==void 0&&this.partialObjectCaches.set(e,n)}get(e){if(this.partialObjectCaches!==void 0){let n=this.partialObjectCaches.get(e);if(n!==void 0)return n}return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,n){if(e===null)this.traverse(n);else{let r=this.get(e);r&&H3(r,n)}}traverse(e){j3(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this.parent(e),o=this.childrenArray(s),a=o.findIndex(d=>d.id===e);if(a<0)throw new Error("not expected");let l=o[a];o=[...o],o[a]={...l,data:n};let c=new Map;return c.set(e,o[a]),this.modifyArrayBy(s,o,c)}}modifyArrayBy(e,n,r=void 0){let s=e,o=n;for(;s!==null;){let l=o,c=s;if(s=this.parent(s),s===void 0)throw new Error;o=this.childrenArray(s);let u=o.findIndex(d=>d.id===c);if(u<0)throw new Error;o=[...o],o[u]={...o[u],children:l},r&&r.set(c,o[u])}Object.setPrototypeOf(o,Ln.prototype);let a=o;if(r&&this.objCaches!==void 0&&this.parentCaches!==void 0){a.objCaches=this.objCaches;for(let[l,c]of r)a.objCaches.set(l,c);a.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else a.fillCaches();return a}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:n}){if(this.get(e)!==void 0)return!0;for(let r of n)if(this.checkDuplicatedIdRec(r))return!0;return!1}addOp(e){let{parent:n,fi:r,id:s,data:o,children:a}=e;if(n!==null&&this.get(n)===void 0)return null;if(this.checkDuplicatedIdRec(e))return null;{let l=n,c=this.childrenArray(l),u={fi:r,id:s,data:o,children:a};return c=[...c,u],c.sort((h,p)=>h.fi-p.fi),e.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:e,reverse:{type:8,id:s}}}}deleteOp(e){let{id:n}=e;if(this.get(n)===null)return null;{let r=this.parent(n);if(r===void 0)return null;let s=this.childrenArray(r),o=s.findIndex(c=>c.id===n);e.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(r,s),actual:e,reverse:{type:7,...a,parent:r}}}}moveOp(e){let{parent:n,fi:r,id:s}=e;if(n!==null&&this.get(n)===void 0)return this.deleteOp({type:8,id:s});if(n!==null){let p=n;for(;p!==null;){if(p===void 0)throw new Error;if(p===s)throw new Vp("cyclic tree");p=this.parent(p)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(p=>p.id===s);l=[...l];let u=l.splice(c,1)[0],d=this.modifyArrayBy(o,l);o=n,l=d.childrenArray(o);let h=u.fi;return u={...u,fi:r},l=[...l,u],l.sort((p,f)=>p.fi-f.fi),e.localIndex=l.indexOf(u),d=d.modifyArrayBy(o,l),{data:d,actual:e,reverse:{type:9,parent:a,fi:h,id:s}}}previous(e,n){if(n===null){let s=this.childrenArray(e);return s.length===0?null:s[s.length-1].id}let r=null;for(let s of this.childrenArray(e)){if(s.id===n)return r;r=s.id}return null}traverseSortNext(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(o=>o.id===e)+1;if(s<r.length)return r[s].id;if(n)return this.traverseSortNext(n)}}sortNext(e){let n=this.childrenArray(e);return n.length>0?n[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let n=this.childrenArray(e);return n.length>0?this.traverseSortPrevious(n[n.length-1].id):e}sortPrevious(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(o=>o.id===e)-1;return s>=0?this.traverseSortPrevious(r[s].id):n}}getAllSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r.id);s!==void 0&&n.push({...r,...s})}n.sort((r,s)=>Cd(r.sortKey,s.sortKey));for(let r of n)delete r.sortKey;return n}getAllIdSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r);s!==void 0&&n.push(s)}n.sort((r,s)=>Cd(r.sortKey,s.sortKey));for(let r of n)delete r.sortKey;return n.map(r=>r.id)}getWithSortKey(e){let n=e,r=[],s=this.get(n),o=s;if(s!==void 0){for(;n;)r.splice(0,0,s.fi),n=this.parent(n),n!==null&&(s=this.get(n));return{...o,sortKey:r}}}insertBeforeHelper(e,n,r){return this.insertAfterHelper(e,this.previous(e,n),r)}insertAfterHelper(e,n,r){let s=this.childrenArray(e);if(n===null){if(s.length===0)return Oa(0,r,r);{let o=s[0].fi;return Oa(o-r,o,r)}}else{let o=this.get(n);if(o===void 0||this.parent(n)!==e)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Oa(l,l+r,r)}else return Oa(o.fi,a.fi,r)}}}});var lC,ou,RS=F(()=>{"use strict";lC=null;(n=>{function i(r){lC=r}n.setPreservePrototype=i;function t(r,s){return Object.getPrototypeOf(r)===lC&&Object.setPrototypeOf(s,lC),s}n.tryPreservePrototype=t;function e(r,s){if(s.type!==0)return null;if(Array.isArray(r)){let o=s.props,a={},l=[...r],c=!1;if(o)for(let u of Object.keys(o)){let d=parseInt(u);if(isNaN(d))throw new Error("wrong index");a[u]=l[d],l[d]=o[u],c=!0}return c?{data:l,actual:s,reverse:{type:0,props:a}}:null}else{let o=s.props,a={},l={...r},c=!1;if(o)for(let u of Object.keys(o)){a[u]=l[u];let d=o[u];d===void 0?delete l[u]:l[u]=d,c=!0}return c?{data:n.tryPreservePrototype(r,l),actual:s,reverse:{type:0,props:a}}:null}}n.runOp=e})(ou||(ou={}))});var ze,au=F(()=>{"use strict";mi();mi();ze=class extends Array{constructor(...e){super(...e);zi(this,"objCaches");Object.setPrototypeOf(this,ze.prototype)}deepFreeze(){let e=0;for(;e<this.length;)By(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===e);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]={...a,data:n},this.modifyArrayBy(s)}}modifyArrayBy(e){Object.setPrototypeOf(e,ze.prototype);let n=e;return k3()||n.fillCaches(),n}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:n,id:r,data:s}=e,o=this,a={fi:n,id:r,data:s};return o=[...o,a],o.sort((c,u)=>c.fi-u.fi),e.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:e,reverse:{type:5,id:r}}}deleteOp(e){let{id:n}=e,r=this,s=r.findIndex(l=>l.id===n);if(s===-1)return null;e.localIndex=s,r=[...r];let o=r.splice(s,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:{type:4,...o}}}moveOp(e){let{fi:n,id:r}=e,s=this;s=[...s];let o=s.findIndex(u=>u.id===r);if(o===-1)return null;let a=s[o].fi,l={...s[o],fi:n};return s[o]=l,s.sort((u,d)=>u.fi-d.fi),e.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:e,reverse:{type:6,fi:a,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let n=null;for(let r of this){if(r.id===e)return n;n=r.id}return null}insertBeforeHelper(e,n){return this.insertAfterHelper(this.previous(e),n)}insertAfterHelper(e,n){let r=this;if(e===null){if(r.length===0)return Oa(0,n,n);{let s=r[0].fi;return Oa(s-n,s,n)}}else{let s=this.get(e);if(s===void 0)throw new Error("illegal args");let o=r.find(a=>a.fi>s.fi);if(o===void 0){let a=r[r.length-1].fi;return Oa(a,a+n,n)}else return Oa(s.fi,o.fi,n)}}}});function W3(i,t){return zp(i,t,null)??i}function q3(i,t){let e={cur:[],result:[],len:0};return i=zp(i,t,e)??i,[i,e.result]}function OS(i,t){return i===null?null:(i.cur[i.len]=t,i.len+=1,i)}function DS(i){i&&(i.len-=1)}function NZ(i){if(i===null)return null;i.result.push(i.cur.slice(0,i.len))}function X3(i,t,e){let n=!1,r=i.map(s=>{let o=s.id,a=t[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,e!==null))throw new Error("not supported");let l=zp(s.data,t,OS(e,o));DS(e),n=n||l!==void 0,l===void 0&&(l=s.data);let c=X3(s.children,t,e);return c!==void 0?n=!0:c=s.children,{...s,id:o,data:l,children:c}});if(n)return r}function BZ(i,t,e){let n=!1,r=i.map(s=>{let o=s.id,a=t[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,e!==null))throw new Error("not supported");let l=zp(s.data,t,OS(e,o));return DS(e),n=n||l!==void 0,l===void 0&&(l=s.data),{...s,id:o,data:l}});if(n)return Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}function zp(i,t,e){if(i instanceof Ln){let n=X3(i,t,e);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}else{if(i instanceof ze)return BZ(i,t,e);if(Array.isArray(i)){let n=!1,r=i.map((s,o)=>{let a=zp(s,t,OS(e,o));return DS(e),n=n||a!==void 0,a===void 0&&(a=s),a});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else if(i&&typeof i=="object"&&!kp(i)){let n={},r=!1;for(let[s,o]of Object.entries(i))if(s!=="name"&&s!=="variableId"){let a=t[s];if(typeof a=="string"){if(e!==null)throw new Error("not supported");r=!0,s=a}let l=zp(o,t,OS(e,s));DS(e),r=r||l!==void 0,l===void 0&&(l=o),n[s]=l}else n[s]=o;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else if(typeof i=="string"){let n=t[i];return n!==void 0&&NZ(e),n}else return}}var cC=F(()=>{"use strict";su();au();mi()});function Gp(i){return i&&typeof i=="object"&&i instanceof Zn}function uC(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,o=ky(r.data,t[s]);if(e=e||o!==void 0,o===void 0&&(o=r.data),r.children){let a=uC(r.children,t);return a!==void 0?e=!0:a=r.children,{...r,id:s,data:o,children:a}}else return{...r,id:s,data:o}});if(e)return n}function FZ(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,o=ky(r.data,t[s]);return e=e||o!==void 0,o===void 0&&(o=r.data),{...r,id:s,data:o}});if(e)return Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}function ky(i,t){if(!Gp(t))return t;if(i instanceof Ln){let e=uC(i,t);return e!==void 0&&Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e}else{if(i instanceof ze)return FZ(i,t);if(Array.isArray(i)){let e=!1,n=i.map((r,s)=>{let o=ky(r,t[s]);return e=e||o!==void 0,o===void 0&&(o=r),o});return e?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else{if(i instanceof Zn)return dC(i,t);if(i&&typeof i=="object"){let e={},n=!1;for(let[r,s]of Object.entries(i)){let o=ky(s,t[r]);n=n||o!==void 0,o===void 0&&(o=s),e[r]=o}return n?(Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e):void 0}}}}function dC(i,t){if(i===void 0)return t;if(t===void 0)return i;if(!Gp(t))return t;if(!Gp(i))return Da.apply(i,t);let e=new Set;for(let r of Object.keys(i))e.add(r);for(let r of Object.keys(t))e.add(r);let n=new Zn;for(let r of e){let s=dC(i===void 0?void 0:i[r],t===void 0?void 0:t[r]);n[r]=s}return n}var Zn,Da,LS=F(()=>{"use strict";su();au();Vy();mi();Zn=class{unusedFunOverridesTable(t){}runOp(t){let e=[],n=this,r=0,s={};for(;r<t.path.length;){if(e.push(n),n=n===void 0?void 0:n[t.path[r]],n!==void 0&&!Gp(n))return null;r+=1}n=n?_S(n):new Zn;for(let[l,c]of Object.entries(t.props)){let u=n[l];s[l]=u,c===void 0?delete n[l]:n[l]=c}for(;r>0;){if(Object.keys(n).length===0){let l=e[r-1];l&&(n=_S(l),delete n[t.path[r-1]])}else{let l=e[r-1];if(l){let c=_S(l);c[t.path[r-1]]=n,n=c}else{let c=new Zn;c[t.path[r-1]]=n,n=c}}r-=1}let o=Object.setPrototypeOf(n,Zn.prototype),a={...t,props:s};return{data:o,actual:t,reverse:a}}};(n=>{function i(r,s){return ky(r,s)??r}n.apply=i;function t(r,s){return dC(r,s)}n.merge=t;function e(r,s){let o=0,a=s.path,l=r;for(;o<a.length&&l!==void 0;){if(l=rr.zoomOnce(l,a[o]),l===void 0)return s;if(!Gp(l))return;o+=1}if(l===void 0)return s;if(!!Gp(l))if(s.type===0){let c={...s.props};for(let u of Object.keys(l))delete c[u];return{...s,props:c}}else if(s.type===1||s.type===4||s.type===7){let c=uC([s],l);return c?c[0]:s}else return s}n.filterOp=e})(Da||(Da={}))});var jp,Sr,zy,Y3=F(()=>{"use strict";Vy();Uy();su();IS();RS();au();cC();LS();(t=>{function i(e,n){let r=rr.zoom(n,e.path);if(typeof r=="object"){let s={};for(let o of Object.keys(e.props))s[o]=r[o];return{...e,props:s}}else return{...e,props:{}}}t.replaceProps=i})(jp||(jp={}));(a=>{function i(l,c){return{...l,path:l.path.slice(c)}}a.drop=i;function t(l,c){return e(l,c)?.data??l}a.applySimple=t;function e(l,c){let u=c.path,d=[];for(;;){let h;if(l instanceof Zn&&c.type===0&&(h=l.runOp({...c,path:u.slice(d.length)}),h===null&&(h=void 0)),h===void 0&&d.length===u.length&&(l instanceof Ln||l instanceof ze||l instanceof at?h=l.runOp(c):h=ou.runOp(l,c)),h!==void 0)if(h!==null){let g=h.data;for(let m=d.length-1;m>=0;m--){let y=u[m],v=d[m];if(v instanceof Ln){if(typeof y=="number")throw new Error("illegal arg");g=v.modifyById(y,g)}else if(v instanceof ze){if(typeof y=="number")throw new Error("illegal arg");g=v.modifyById(y,g)}else if(v instanceof at){if(typeof y=="number")throw new Error("illegal arg");g=v.modifyById(y,g)}else if(v instanceof Zn){let b={...v,[y]:g};g=Object.setPrototypeOf(b,Zn.prototype)}else if(typeof v=="object")if(Array.isArray(v)){if(typeof y=="string"&&(y=parseInt(y),isNaN(y)))throw new Error("Invalid path");let b=g;g=[...v],g[y]=b}else g=ou.tryPreservePrototype(v,{...v,[y]:g});else return null}return{data:g,actual:{...h.actual,path:u},reverse:{...h.reverse,path:u}}}else return null;let p=u[d.length],f;if(l instanceof Ln){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else if(l instanceof ze){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else l!==null&&(f=l[p]);if(f!==void 0)d.push(l),l=f;else return null}}a.apply=e;function n(l,c){for(let u=0;u<l.length&&u<c.length;u++)if(l[u]!==c[u])return!0;return!1}a.pathDisjoint=n;function r(l,c){if(l.length!==c.length)return!1;for(let u=0;u<l.length;u++)if(l[u]!==c[u])return!1;return!0}a.pathEq=r;function s(l,c){return n(l.path,c.path)}a.commutative=s;function o(l,c){return l.type===0&&c.type===0&&r(l.path,c.path)?Object.keys(l.props).every(u=>c.props[u]!==void 0):!1}a.subsumed=o})(Sr||(Sr={}));(l=>{function i(){return[]}l.empty=i;function t(c,u){let d=[];for(let h of c){let[p,...f]=h.path;p===u&&d.push({...h,path:f})}return d}l.removePrefix=t;function e(c,u){return c.map(d=>({...d,path:[u,...d.path]}))}l.addPrefix=e;function n(c,u){return[...c,...u]}l.concat=n;function r(c,u){return[...c.filter(h=>!u.some(p=>Sr.subsumed(h,p))),...u]}l.compress=r;function s(c,u){return c.every(d=>u.every(h=>Sr.commutative(d,h)))}l.commutative=s;function o(c,u){for(let d of u){let h=a(c,d);h!==null&&(c=h.data)}return c}l.applyAll=o;function a(c,u){let d=c,h=[],p=[];for(let f of u)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let g,m,y;if(f.type===3?(g=rr.zoom(d,[...f.path,f.id]),y=Sr.apply(d,{...f,type:2})):(g=rr.zoom(d,[...f.path,f.id,"value"]),y=Sr.apply(d,f)),y!==null){d=y.data;let[v,b]=q3(d,{[f.id]:g});d=v;for(let x=0;x<b.length;x++){let S=b[x],E=S.pop();if(typeof E=="number"){let T=[E];for(let _=x+1;_<b.length;_++){let A=b[_],C=A[A.length-1];if(typeof C=="number"&&rr.equal(S,A.slice(0,A.length-1)))T.push(C),b.splice(_,1);else break}let w=rr.zoom(d,S);m=w.map((_,A)=>T.includes(A)?f.id:_),g=w,E=S.pop()}else{if(E==="alphaOverride"||E==="alpha"){g/=100;let T=g,w=rr.zoom(d,S.slice(0,S.length-2)),_=w.layers.map(A=>A.id===S[S.length-1]?{...A,data:{...A.data,[E]:T}}:A);Object.setPrototypeOf(_,Object.getPrototypeOf(w.layers)),w.layers=_}m=f.id}h.push({type:0,path:S,props:{[E]:g}}),p.push({type:0,path:S,props:{[E]:m}})}p.push(y.reverse),h.push(y.actual)}}else{let g=Sr.apply(d,f);g!==null&&(h.push(g.actual),d=g.data,p.push(g.reverse))}}catch(g){if(g instanceof Vp)return null;throw g}return{data:d,actual:h,reverse:p.reverse()}}l.apply=a})(zy||(zy={}))});function hC(i,t,e){if(i.length>0){let n=i[i.length-1];if(n.type===0&&t.type===0&&rr.equal(n.path,e)){Object.assign(n.props,t.props);return}}i.push({...t,path:e})}function FS(i,t,e){return e instanceof Ln?new Hp(i,t,e):e instanceof ze?new Wp(i,t,e):e instanceof at?new Proxy(new fC(i,t,e),VZ):e!==null&&typeof e=="object"?kp(e)?e:new Proxy(new pC(i,t,e),kZ):e}function Rd(i){let t=new NS(i);return[FS(t,"",i),t]}function lu(i,t){let[e,n]=Rd(i);return t(e),n.result()}function Cr(i){return i instanceof Hp||i instanceof Wp?i._current:i!==null&&typeof i=="object"?i[$3]:i}var $3,UZ,BS,Id,pC,fC,K3,kZ,VZ,Hp,Wp,NS,mC=F(()=>{"use strict";Uy();su();RS();au();mi();Vy();$3=Symbol(),UZ=Symbol(),BS=Symbol(),Id=class{reportOp(t,e,n=[]){let r=this;if(e===null)return;r._current=e.data;let s=n;for(;!(r instanceof NS);){let o=r._path,a=r._current;if(o!==""&&s.splice(0,0,o),r=r._parent,r===null)return;r.update(o,a)}r.push(s,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let n=e[BS];n&&n(),delete this._children[t]}}}},pC=class extends Id{constructor(t,e,n){super(),this._parent=t,this._path=e,this._current=n}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=ou.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,ou.runOp(this._current,t),t.path)}},fC=class extends Id{constructor(t,e,n){super(),this._parent=t,this._path=e,this._current=n}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,at.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},K3={get(i,t){if(t===BS)return()=>{i._parent=null};if(t===$3)return i._current;if(t===UZ)return i;let{_current:e,_children:n}=i;if(t==="push"&&Array.isArray(e))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e[t],o=FS(i,t,s);return o!==s?(n===void 0&&(n={},i._children=n),n[t]=o,o):s},has(i,t){return t in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,t){let e=i._current,n=Reflect.getOwnPropertyDescriptor(e,t);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:e[t]}}},kZ={...K3,set(i,t,e){let n={type:0,props:{[t]:Cr(e)??e}};return i.deleteChildren(t),i.runOp(n),!0},deleteProperty(i,t){let e={type:0,props:{[t]:void 0}};return i.deleteChildren(t),i.runOp(e),!0}},VZ={...K3,set(i,t,e){return e===void 0?this.deleteProperty(i,t):(i.deleteChildren(t),i.runOp({type:1,id:t,data:e})),!0},deleteProperty(i,t){return i.runOp({type:2,id:t}),!0}},Hp=class extends Id{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[BS]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,n)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,o=FS(this,t,s);return o!==s?(n===void 0&&(n={},this._children=n),n[t]=o,o):s}add(t,e,n,r,s){this.runOp({type:7,parent:t,fi:e,id:n,data:r,children:s})}move(t,e,n){this.runOp({type:9,parent:t,fi:e,id:n})}insertAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.add(t,r[s],o.id,o.data,o.children)}}insertBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.add(t,r[s],o.id,o.data,o.children)}}moveAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.move(t,r[s],o)}}moveBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.move(t,r[s],o)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},Wp=class extends Id{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[BS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id,s=this._current[n].fi;t(this.data(this._current[n].id),r,s,n)}}find(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id;if(t(this.data(r),r))return this.get(r)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:n}=this._current.at(t);return{id:e,fi:n,data:this.data(e)}}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,o=FS(this,t,s);return o!==s?(n===void 0&&(n={},this._children=n),n[t]=o,o):s}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,n){this.runOp({type:4,fi:t,id:e,data:n})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}insertBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}moveAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}moveBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};NS=class extends Id{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,n,r){hC(this.ts,e,t),hC(this.actual,n,t),hC(this.reverse,r,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}});var rr,Vy=F(()=>{"use strict";PS();mC();au();su();mi();(s=>{function i(o,a){if(a.length===o.length){let l=0;for(;l<o.length;){if(o[l]!==a[l])return!1;l+=1}}else return!1;return!0}s.equal=i;function t(o,a,l){let c=n(l,o);if(c!==void 0&&typeof c=="object"&&c!==null){let u={...a};return Object.keys(c).forEach(d=>{delete u[d]}),u}else return a}s.removeOverridden=t;function e(o,a){if((o instanceof Ln||o instanceof Hp)&&typeof a=="string")return o.data(a);if((o instanceof ze||o instanceof Wp)&&typeof a=="string")return o.data(a);if(typeof a=="number"&&Array.isArray(o))return o[a];if(typeof a=="string"&&typeof o=="object"&&o!==null)return o[a]}s.zoomOnce=e;function n(o,a,l=0){for(;l<a.length&&o!==void 0;)o=e(o,a[l]),l+=1;return o}s.zoom=n;function r(o,a){let l=[];function c(u,d){if(u instanceof Pd&&u.id===a.id)l.push(d);else if(u instanceof ze)for(let h=0;h<u.length;h++)c(u[h].data,[...d,u[h].id]);else if(u instanceof Ln)u.traverse((h,p)=>{c(h,[...d,p])});else if(Array.isArray(u))for(let h=0;h<u.length;h++)c(u[h],[...d,h]);else{if(kp(u))return;if(typeof u=="object"&&u!==null)for(let h in u)c(u[h],[...d,h])}}return c(o,[]),l}s.findPathes=r})(rr||(rr={}))});var Z3=F(()=>{"use strict"});function Q3(i,t){let e=[];if(t.length===i.length){let n=0;for(;n<i.length;){if(t[n]==="*")e.push(i[n]);else if(i[n]!==t[n])return null;n+=1}}else return null;return e}function $t(i,t){let e=[];if(t.length<=i.length){let n=0;for(;n<t.length;){if(t[n]==="*")e.push(i[n]);else if(i[n]!==t[n])return null;n+=1}}else return null;return e}var J3=F(()=>{"use strict"});function US(i){try{if(!ir.trusted&&!uu){let e=dn.sharedLength||0;e<dn.length&&(dn.length=e)}let t;if(ir.randomAccessStructure&&tt[ie]<64&&tt[ie]>=32&&nB?(t=nB(tt,ie,uo,ir),tt=null,!(i&&i.lazy)&&t&&(t=t.toJSON()),ie=uo):t=qr(),Pi&&(ie=Pi.postBundlePosition,Pi=null),uu&&(dn.restoreStructures=null),ie==uo)dn&&dn.restoreStructures&&sB(),dn=null,tt=null,Yl&&(Yl=null);else{if(ie>uo)throw new Error("Unexpected end of MessagePack data");if(!uu){let e;try{e=JSON.stringify(t,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){e="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+e)}}return t}catch(t){throw dn&&dn.restoreStructures&&sB(),wC(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||ie>uo)&&(t.incomplete=!0),t}}function sB(){for(let i in dn.restoreStructures)dn[i]=dn.restoreStructures[i];dn.restoreStructures=null}function qr(){let i=tt[ie++];if(i<160)if(i<128){if(i<64)return i;{let t=dn[i&63]||ir.getStructures&&mB()[i&63];return t?(t.read||(t.read=EC(t,i&63)),t.read()):i}}else if(i<144)if(i-=128,ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=yB();n==="__proto__"&&(n="__proto_"),t[n]=qr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(qr(),qr());return t}else{i-=144;let t=new Array(i);for(let e=0;e<i;e++)t[e]=qr();return ir.freezeData?Object.freeze(t):t}else if(i<192){let t=i-160;if(La>=ie)return cu.slice(ie-co,(ie+=t)-co);if(La==0&&uo<140){let e=t<16?TC(t):gB(t);if(e!=null)return e}return SC(t)}else{let t;switch(i){case 192:return null;case 193:return Pi?(t=qr(),t>0?Pi[1].slice(Pi.position1,Pi.position1+=t):Pi[0].slice(Pi.position0,Pi.position0-=t)):fB;case 194:return!1;case 195:return!0;case 196:if(t=tt[ie++],t===void 0)throw new Error("Unexpected end of buffer");return gC(t);case 197:return t=sn.getUint16(ie),ie+=2,gC(t);case 198:return t=sn.getUint32(ie),ie+=4,gC(t);case 199:return Od(tt[ie++]);case 200:return t=sn.getUint16(ie),ie+=2,Od(t);case 201:return t=sn.getUint32(ie),ie+=4,Od(t);case 202:if(t=sn.getFloat32(ie),ir.useFloat32>2){let e=SB[(tt[ie]&127)<<1|tt[ie+1]>>7];return ie+=4,(e*t+(t>0?.5:-.5)>>0)/e}return ie+=4,t;case 203:return t=sn.getFloat64(ie),ie+=8,t;case 204:return tt[ie++];case 205:return t=sn.getUint16(ie),ie+=2,t;case 206:return t=sn.getUint32(ie),ie+=4,t;case 207:return ir.int64AsType==="number"?(t=sn.getUint32(ie)*4294967296,t+=sn.getUint32(ie+4)):ir.int64AsType==="string"?t=sn.getBigUint64(ie).toString():ir.int64AsType==="auto"?(t=sn.getBigUint64(ie),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=sn.getBigUint64(ie),ie+=8,t;case 208:return sn.getInt8(ie++);case 209:return t=sn.getInt16(ie),ie+=2,t;case 210:return t=sn.getInt32(ie),ie+=4,t;case 211:return ir.int64AsType==="number"?(t=sn.getInt32(ie)*4294967296,t+=sn.getUint32(ie+4)):ir.int64AsType==="string"?t=sn.getBigInt64(ie).toString():ir.int64AsType==="auto"?(t=sn.getBigInt64(ie),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=sn.getBigInt64(ie),ie+=8,t;case 212:if(t=tt[ie++],t==114)return dB(tt[ie++]&63);{let e=qi[t];if(e)return e.read?(ie++,e.read(qr())):e.noBuffer?(ie++,e()):e(tt.subarray(ie,++ie));throw new Error("Unknown extension "+t)}case 213:return t=tt[ie],t==114?(ie++,dB(tt[ie++]&63,tt[ie++])):Od(2);case 214:return Od(4);case 215:return Od(8);case 216:return Od(16);case 217:return t=tt[ie++],La>=ie?cu.slice(ie-co,(ie+=t)-co):GZ(t);case 218:return t=sn.getUint16(ie),ie+=2,La>=ie?cu.slice(ie-co,(ie+=t)-co):jZ(t);case 219:return t=sn.getUint32(ie),ie+=4,La>=ie?cu.slice(ie-co,(ie+=t)-co):HZ(t);case 220:return t=sn.getUint16(ie),ie+=2,aB(t);case 221:return t=sn.getUint32(ie),ie+=4,aB(t);case 222:return t=sn.getUint16(ie),ie+=2,lB(t);case 223:return t=sn.getUint32(ie),ie+=4,lB(t);default:if(i>=224)return i-256;if(i===void 0){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+i)}}}function EC(i,t){function e(){if(e.count++>tB){let r;try{r=i.read=new Function("r","return function(){return "+(ir.freezeData?"Object.freeze":"")+"({"+i.map(s=>s==="__proto__"?"__proto_:r()":zZ.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(qr)}catch{return tB=1/0,e()}return i.read0=r,i.highByte===0&&(i.read=oB(t,i.read)),r()}let n={};for(let r=0,s=i.length;r<s;r++){let o=i[r];o==="__proto__"&&(o="__proto_"),n[o]=qr()}return ir.freezeData?Object.freeze(n):n}return e.count=0,i.read0=e,i.highByte===0?oB(t,e):e}function mB(){let i=bB(()=>(tt=null,ir.getStructures()));return dn=ir._mergeStructures(i,dn)}function Gy(i){let t;if(i<16&&(t=TC(i)))return t;if(i>64&&yC)return yC.decode(tt.subarray(ie,ie+=i));let e=ie+i,n=[];for(t="";ie<e;){let r=tt[ie++];if((r&128)===0)n.push(r);else if((r&224)===192){let s=tt[ie++]&63,o=(r&31)<<6|s;o<128?n.push(65533):n.push(o)}else if((r&240)===224){let s=tt[ie++]&63,o=tt[ie++]&63,a=(r&31)<<12|s<<6|o;a<2048||a>=55296&&a<=57343?n.push(65533):n.push(a)}else if((r&248)===240){let s=tt[ie++]&63,o=tt[ie++]&63,a=tt[ie++]&63,l=(r&7)<<18|s<<12|o<<6|a;l<65536||l>1114111?n.push(65533):(l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l))}else n.push(65533);n.length>=4096&&(t+=Ci.apply(String,n),n.length=0)}return n.length>0&&(t+=Ci.apply(String,n)),t}function aB(i){let t=new Array(i);for(let e=0;e<i;e++)t[e]=qr();return ir.freezeData?Object.freeze(t):t}function lB(i){if(ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=yB();n==="__proto__"&&(n="__proto_"),t[n]=qr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(qr(),qr());return t}}function gB(i){let t=ie,e=new Array(i);for(let n=0;n<i;n++){let r=tt[ie++];if((r&128)>0){ie=t;return}e[n]=r}return Ci.apply(String,e)}function TC(i){if(i<4)if(i<2){if(i===0)return"";{let t=tt[ie++];if((t&128)>1){ie-=1;return}return Ci(t)}}else{let t=tt[ie++],e=tt[ie++];if((t&128)>0||(e&128)>0){ie-=2;return}if(i<3)return Ci(t,e);let n=tt[ie++];if((n&128)>0){ie-=3;return}return Ci(t,e,n)}else{let t=tt[ie++],e=tt[ie++],n=tt[ie++],r=tt[ie++];if((t&128)>0||(e&128)>0||(n&128)>0||(r&128)>0){ie-=4;return}if(i<6){if(i===4)return Ci(t,e,n,r);{let s=tt[ie++];if((s&128)>0){ie-=5;return}return Ci(t,e,n,r,s)}}else if(i<8){let s=tt[ie++],o=tt[ie++];if((s&128)>0||(o&128)>0){ie-=6;return}if(i<7)return Ci(t,e,n,r,s,o);let a=tt[ie++];if((a&128)>0){ie-=7;return}return Ci(t,e,n,r,s,o,a)}else{let s=tt[ie++],o=tt[ie++],a=tt[ie++],l=tt[ie++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){ie-=8;return}if(i<10){if(i===8)return Ci(t,e,n,r,s,o,a,l);{let c=tt[ie++];if((c&128)>0){ie-=9;return}return Ci(t,e,n,r,s,o,a,l,c)}}else if(i<12){let c=tt[ie++],u=tt[ie++];if((c&128)>0||(u&128)>0){ie-=10;return}if(i<11)return Ci(t,e,n,r,s,o,a,l,c,u);let d=tt[ie++];if((d&128)>0){ie-=11;return}return Ci(t,e,n,r,s,o,a,l,c,u,d)}else{let c=tt[ie++],u=tt[ie++],d=tt[ie++],h=tt[ie++];if((c&128)>0||(u&128)>0||(d&128)>0||(h&128)>0){ie-=12;return}if(i<14){if(i===12)return Ci(t,e,n,r,s,o,a,l,c,u,d,h);{let p=tt[ie++];if((p&128)>0){ie-=13;return}return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p)}}else{let p=tt[ie++],f=tt[ie++];if((p&128)>0||(f&128)>0){ie-=14;return}if(i<15)return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p,f);let g=tt[ie++];if((g&128)>0){ie-=15;return}return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p,f,g)}}}}}function cB(){let i=tt[ie++],t;if(i<192)t=i-160;else switch(i){case 217:t=tt[ie++];break;case 218:t=sn.getUint16(ie),ie+=2;break;case 219:t=sn.getUint32(ie),ie+=4;break;default:throw new Error("Expected string")}return Gy(t)}function gC(i){return ir.copyBuffers?Uint8Array.prototype.slice.call(tt,ie,ie+=i):tt.subarray(ie,ie+=i)}function Od(i){let t=tt[ie++];if(qi[t]){let e;return qi[t](tt.subarray(ie,e=ie+=i),n=>{ie=n;try{return qr()}finally{ie=e}})}else throw new Error("Unknown extension type "+t)}function yB(){let i=tt[ie++];if(i>=160&&i<192){if(i=i-160,La>=ie)return cu.slice(ie-co,(ie+=i)-co);if(!(La==0&&uo<180))return SC(i)}else return ie--,vB(qr());let t=(i<<5^(i>1?sn.getUint16(ie):i>0?tt[ie]:0))&4095,e=uB[t],n=ie,r=ie+i-3,s,o=0;if(e&&e.bytes==i){for(;n<r;){if(s=sn.getUint32(n),s!=e[o++]){n=1879048192;break}n+=4}for(r+=3;n<r;)if(s=tt[n++],s!=e[o++]){n=1879048192;break}if(n===r)return ie=n,e.string;r-=3,n=ie}for(e=[],uB[t]=e,e.bytes=i;n<r;)s=sn.getUint32(n),e.push(s),n+=4;for(r+=3;n<r;)s=tt[n++],e.push(s);let a=i<16?TC(i):gB(i);return a!=null?e.string=a:e.string=SC(i)}function vB(i){if(typeof i=="string")return i;if(typeof i=="number"||typeof i=="boolean"||typeof i=="bigint")return i.toString();if(i==null)return i+"";if(ir.allowArraysInMapKeys&&Array.isArray(i)&&i.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return i.flat().toString();throw new Error(`Invalid property type for record: ${typeof i}`)}function bB(i){iB&&iB();let t=uo,e=ie,n=bC,r=co,s=La,o=cu,a=vC,l=Yl,c=Pi,u=new Uint8Array(tt.slice(0,uo)),d=dn,h=dn.slice(0,dn.length),p=ir,f=uu,g=i();return uo=t,ie=e,bC=n,co=r,La=s,cu=o,vC=a,Yl=l,Pi=c,tt=u,uu=f,dn=d,dn.splice(0,dn.length,...h),ir=p,sn=new DataView(tt.buffer,tt.byteOffset,tt.byteLength),g}function wC(){tt=null,Yl=null,dn=null}function xB(i){i.unpack?qi[i.type]=i.unpack:qi[i.type]=i}var yC,tt,uo,ie,pB,vC,bC,ir,dn,cu,co,La,Pi,Yl,qi,sn,eB,xC,fB,uu,tB,nB,rB,iB,du,zZ,oB,SC,GZ,jZ,HZ,Ci,uB,dB,hB,WZ,qZ,XZ,SB,kS,bfe,xfe,Sfe,YZ,wfe,wB=F(()=>{try{yC=new TextDecoder}catch{}ie=0,pB=[],vC=pB,bC=0,ir={},co=0,La=0,qi=[],eB={useRecords:!1,mapsAsObjects:!0},xC=class{},fB=new xC;fB.name="MessagePack 0xC1";uu=!1,tB=2,du=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(tt)return bB(()=>(wC(),this?this.unpack(t,e):du.prototype.unpack.call(eB,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(uo=e.end||t.length,ie=e.start||0):(ie=0,uo=e>-1?e:t.length),bC=0,La=0,cu=null,vC=pB,Pi=null,tt=t;try{sn=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw tt=null,t instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof du){if(ir=this,this.structures)return dn=this.structures,US(e);(!dn||dn.length>0)&&(dn=[])}else ir=eB,(!dn||dn.length>0)&&(dn=[]);return US(e)}unpackMultiple(t,e){let n,r=0;try{uu=!0;let s=t.length,o=this?this.unpack(t,s):kS.unpack(t,s);if(e){if(e(o,r,ie)===!1)return;for(;ie<s;)if(r=ie,e(US(),r,ie)===!1)return}else{for(n=[o];ie<s;)r=ie,n.push(US());return n}}catch(s){throw s.lastPosition=r,s.values=n,s}finally{uu=!1,wC()}}_mergeStructures(t,e){rB&&(t=rB.call(this,t)),t=t||[],Object.isFrozen(t)&&(t=t.map(n=>n.slice(0)));for(let n=0,r=t.length;n<r;n++){let s=t[n];s&&(s.isShared=!0,n>=32&&(s.highByte=n-32>>5))}t.sharedLength=t.length;for(let n in e||[])if(n>=0){let r=t[n],s=e[n];s&&(r&&((t.restoreStructures||(t.restoreStructures=[]))[n]=r),t[n]=s)}return this.structures=t}decode(t,e){return this.unpack(t,e)}};zZ=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;oB=(i,t)=>function(){let e=tt[ie++];if(e===0)return t();let n=i<32?-(i+(e<<5)):i+(e<<5),r=dn[n]||mB()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=EC(r,i)),r.read()};SC=Gy,GZ=Gy,jZ=Gy,HZ=Gy;Ci=String.fromCharCode;uB=new Array(4096);dB=(i,t)=>{let e=qr().map(vB),n=i;t!==void 0&&(i=i<32?-((t<<5)+i):(t<<5)+i,e.highByte=t);let r=dn[i];return r&&(r.isShared||uu)&&((dn.restoreStructures||(dn.restoreStructures=[]))[i]=r),dn[i]=e,e.read=EC(e,n),(e.read0||e.read)()};qi[0]=()=>{};qi[0].noBuffer=!0;qi[66]=i=>{let t=i.byteLength%8||8,e=BigInt(i[0]&128?i[0]-256:i[0]);for(let n=1;n<t;n++)e<<=BigInt(8),e+=BigInt(i[n]);if(i.byteLength!==t){let n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=(s,o)=>{let a=o-s;if(a<=40){let d=n.getBigUint64(s);for(let h=s+8;h<o;h+=8)d<<=BigInt(64),d|=n.getBigUint64(h);return d}let l=s+(a>>4<<3),c=r(s,l),u=r(l,o);return c<<BigInt((o-l)*8)|u};e=e<<BigInt((n.byteLength-t)*8)|r(t,n.byteLength)}return e};hB={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};qi[101]=()=>{let i=qr();if(!hB[i[0]]){let t=Error(i[1],{cause:i[2]});return t.name=i[0],t}return hB[i[0]](i[1],{cause:i[2]})};qi[105]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=sn.getUint32(ie-4);Yl||(Yl=new Map);let e=tt[ie],n;e>=144&&e<160||e==220||e==221?n=[]:e>=128&&e<144||e==222||e==223?n=new Map:(e>=199&&e<=201||e>=212&&e<=216)&&tt[ie+1]===115?n=new Set:n={};let r={target:n};Yl.set(t,r);let s=qr();if(r.used)Object.assign(n,s);else return r.target=s;if(n instanceof Map)for(let[o,a]of s.entries())n.set(o,a);if(n instanceof Set)for(let o of Array.from(s))n.add(o);return n};qi[112]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=sn.getUint32(ie-4),e=Yl.get(t);return e.used=!0,e.target};qi[115]=()=>new Set(qr());WZ=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array"),qZ=typeof globalThis=="object"?globalThis:window;qi[116]=i=>{let t=i[0],e=Uint8Array.prototype.slice.call(i,1).buffer,n=WZ[t];if(!n){if(t===16)return e;if(t===17)return new DataView(e);throw new Error("Could not find typed array for code "+t)}return new qZ[n](e)};qi[120]=()=>{let i=qr();return new RegExp(i[0],i[1])};XZ=[];qi[98]=i=>{let t=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],e=ie;return ie+=t-i.length,Pi=XZ,Pi=[cB(),cB()],Pi.position0=0,Pi.position1=0,Pi.postBundlePosition=ie,ie=e,qr()};qi[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");SB=new Array(147);for(let i=0;i<256;i++)SB[i]=+("1e"+Math.floor(45.15-i*.30103));kS=new du({useRecords:!1}),bfe=kS.unpack,xfe=kS.unpackMultiple,Sfe=kS.unpack,YZ=new Float32Array(1),wfe=new Uint8Array(YZ.buffer,0,4)});var $Z,KZ,VS,EB=F(()=>{"use strict";wB();PS();LS();au();Uy();su();$Z=[{Class:at.prototype.constructor,type:1,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,at.prototype),i}},{Class:ze.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,ze.prototype),i}},{Class:Ln.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Ln.prototype),i}},{Class:Pd.prototype.constructor,type:4,write(i){return i.id},read(i){return new Pd(i)}},{Class:Fy.prototype.constructor,type:5,write(i){return i.data},read(i){return new Fy(i)}},{Class:Zn.prototype.constructor,type:6,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,Zn.prototype),i}}];for(let i of $Z)xB(i);KZ=new du({structuredClone:!0});(t=>{function i(e){return KZ.unpack(e)}t.deserialize=i})(VS||(VS={}))});var TB,Dd,MB=F(()=>{"use strict";EB();TB=i=>()=>{throw new Error(i+" is not available in the runtime build (decode-only CollabSerialize)")},Dd={deserialize:VS.deserialize,serialize:TB("CollabSerialize.serialize"),checksum:TB("CollabSerialize.checksum")}});var on=F(()=>{Vy();G3();IS();su();Uy();RS();au();Y3();Z3();mC();J3();PS();MB();cC();LS()});function jy(i){return i==="MouseDown"||i==="MouseUp"||i==="KeyDown"||i==="KeyUp"||i==="Collision"||i==="Trigger"}var _B,_C,Ld,zS,MC,AB,CB,PB,GS,jS,IB,RB,OB,DB,LB,HS,WS,NB,BB,FB,UB,AC=F(()=>{"use strict";on();X();(e=>{function i(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type}e.toEventUIType=i;function t(n){return n==="Distance"||n==="StateChange"?"Conditional":n}e.fromEventUIType=t})(_B||(_B={}));_C={["LookAt"]:[],["Follow"]:["Create"],["DragDrop"]:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseHover"]:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Scroll"]:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Start"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Conditional"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MousePress"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyPress"]:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["GameControl"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],["Collision"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Trigger"]:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Resize"]:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["VariableChange"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["API"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["WEBHOOK"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["AIAssistantListener"]:["SetVariable"],["AIAssistantTrigger"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(e=>{function i(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"}e.is=i;function t(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new ze}:{type:n,disabled:!1,name:"",key:void 0,actions:new ze}}e.defaultData=t})(Ld||(Ld={}));(e=>{function i(n){return{type:"Property",value:[n??null,"position","x"]}}e.propertyDefaultData=i,e.valueDefaultData={type:"Literal",value:0}})(zS||(zS={}));(n=>{function i(r){return{type:"Comparison",operator:"==",lOperand:zS.propertyDefaultData(r),rOperand:{...zS.valueDefaultData}}}n.comparisonDefaultData=i;function t(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}}n.distanceDefaultData=t;function e(r,s){return{type:"State",object:r??null,state:s??null}}n.stateDefaultData=e})(MC||(MC={}));(t=>{function i(e){return e.find(n=>n==="ifActions"||n==="elseActions")!==void 0}t.isConditionalSubActions=i})(AB||(AB={}));(e=>{function i(n){return n.type==="Conditional"}e.is=i;function t(n){return{type:"Conditional",disabled:!1,name:"",inActions:new ze,outActions:new ze,condition:MC.distanceDefaultData(n)}}e.defaultData=t})(CB||(CB={}));(t=>t.defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new ze,drop:new ze}})(PB||(PB={}));(t=>t.defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new ze})(GS||(GS={}));(t=>t.defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5})(jS||(jS={}));(e=>{function i(n){return n.type==="MouseHover"}e.is=i;function t(){return{type:"MouseHover",disabled:!1,name:"",actions:new ze}}e.defaultData=t})(IB||(IB={}));(e=>{function i(n){return n.type==="Scroll"}e.is=i;function t(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new ze}}e.defaultData=t})(RB||(RB={}));(e=>{function i(n){return n.type==="Start"}e.is=i;function t(){return{type:"Start",disabled:!1,name:"",actions:new ze}}e.defaultData=t})(OB||(OB={}));(e=>{function i(n){return n.type==="Collision"}e.is=i;function t(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new ze}}e.defaultData=t})(DB||(DB={}));(e=>{function i(n){return n.type==="Trigger"}e.is=i;function t(n,r){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new ze,triggerZone:"box",position:r.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}e.defaultData=t})(LB||(LB={}));(o=>{o.defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]};function t(a){return a.type==="Resize"}o.is=t;function e(a){return typeof a=="string"?a:"custom"}o.sizeToDevice=e;function n(a){return typeof a=="string"?[...o.defaultSizes[a]]:[...a]}o.deviceToSize=n;function r(){let a={size:"mobile",operator:"<",actions:new ze},l={size:"tablet",operator:"<",actions:new ze},c={size:[...o.defaultSizes.custom],operator:"<>",actions:new ze},u=new ze;return u.push({id:xe.generateUUID(),fi:0,data:a},{id:xe.generateUUID(),fi:1,data:l},{id:xe.generateUUID(),fi:2,data:c}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:u}}o.defaultData=r;function s(){return{size:[...o.defaultSizes.custom],operator:"<>",actions:new ze}}o.defaultBreakpointData=s})(HS||(HS={}));(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]};function t(r){return r.type==="VariableChange"}n.is=t;function e(){return{disabled:!1,type:"VariableChange",name:"",actions:new ze,variableId:"",objectId:null,property:"Position X"}}n.defaultData=e})(WS||(WS={}));(e=>{function i(n){return n.type==="API"}e.is=i;function t(){return{disabled:!1,type:"API",name:"",successActions:new ze,errorActions:new ze,userAPIId:""}}e.defaultData=t})(NB||(NB={}));(e=>{function i(n){return n.type==="WEBHOOK"}e.is=i;function t(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new ze,userWebhookId:""}}e.defaultData=t})(BB||(BB={}));(e=>{function i(n){return n.type==="AIAssistantListener"}e.is=i;function t(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new ze,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=t})(FB||(FB={}));(e=>{function i(n){return n.type==="AIAssistantTrigger"}e.is=i;function t(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new ze}}e.defaultData=t})(UB||(UB={}))});function zB(i){let t=typeof i;return i!==null&&(t==="object"||t==="function")}function CC(i){return typeof i=="string"&&i.length===36?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(i):!1}var po,pu,GB,wr,XS,Ws,ho,Nd,kB,hu,gr,Vt,qS,Bd,Qo,$l,VB,Es=F(()=>{"use strict";po="personal camera",pu="a218fcc3-276b-49b9-b485-49037fd14f5f",GB=2500134,wr=5526619,XS=(n=>(n.x="x",n.y="y",n.z="z",n))(XS||{});(p=>{function i(f,g){return f[0]===g[0]&&f[1]===g[1]}p.isEqual=i;function t(f,g,m){return[f[0]+(g[0]-f[0])*m,f[1]+(g[1]-f[1])*m]}p.lerp=t;function e(f,g){return[f[0]+g[0],f[1]+g[1]]}p.add=e;function n(f,g){return[f[0]-g[0],f[1]-g[1]]}p.sub=n;function r(f,g){return[f[0]*g[0],f[1]*g[1]]}p.multiply=r;function s(f,g){return[f[0]/g[0],f[1]/g[1]]}p.divide=s;function o(f,g){return Math.pow(g[0]-f[0],2)+Math.pow(g[1]-f[1],2)}p.distanceSquared=o;function a(f,g){return Math.sqrt(o(f,g))}p.distance=a;function l(f,g){return f[0]*g[0]+f[1]*g[1]}p.dot=l;function c(f,g){return[f[0]*g,f[1]*g]}p.scalarMultiply=c;function u(f,g,m){let y=p.sub(g,f),v=p.sub(m,f),b=p.dot(y,v)/p.dot(y,y),x=p.scalarMultiply(y,b);return p.add(f,x)}p.projectionOnto=u;function d(f,g,m){return a(f,u(f,g,m))}p.projectionOntoDistance=d;function h(f,g){return[(f[0]+g[0])*.5,(f[1]+g[1])*.5]}p.center=h})(Ws||(Ws={}));(a=>{function i(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]}a.isEqual=i;function t(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}a.add=t;function e(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]}a.sub=e;function n(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]}a.div=n;function r(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]}a.mul=r;function s(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])}a.dist=s;function o(l,c,u){return[l[0]+(c[0]-l[0])*u,l[1]+(c[1]-l[1])*u,l[2]+(c[2]-l[2])*u]}a.lerp=o})(ho||(ho={}));(e=>{function i(n,r){return n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3]}e.isEqual=i;function t(n,r,s){return[n[0]+(r[0]-n[0])*s,n[1]+(r[1]-n[1])*s,n[2]+(r[2]-n[2])*s,n[3]+(r[3]-n[3])*s]}e.lerp=t})(Nd||(Nd={}));(o=>{let i=180/Math.PI,t=Math.PI/180;function e(a){return typeof a=="number"?a*i:a}function n(a){return typeof a=="number"?a*t:a}function r(a){return[e(a[0]),e(a[1]),e(a[2])]}o.radToDeg=r;function s(a){return[n(a[0]),n(a[1]),n(a[2])]}o.degToRad=s})(kB||(kB={}));(r=>{r.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(s,o){for(let a=0;a<16;a++)if(s[a]!==o[a])return!1;return!0}r.isEqual=t;function e(s){return s??r.identity}r.simplify=e;function n(s,o){let a=o.slice(0);for(let l=0,c=o.length;l<c;l+=3){let u=s[3]*o[l]+s[7]*o[l+1]+s[11]*o[l+2]+s[15];a[l]=(s[0]*o[l]+s[4]*o[l+1]+s[8]*o[l+2]+s[12])/u,a[l+1]=(s[1]*o[l]+s[5]*o[l+1]+s[9]*o[l+2]+s[13])/u,a[l+2]=(s[2]*o[l]+s[6]*o[l+1]+s[10]*o[l+2]+s[14])/u}return a}r.applyMatrix4=n})(hu||(hu={}));(h=>{function i(p){return typeof p=="object"&&typeof p.r=="number"&&typeof p.g=="number"&&typeof p.b=="number"}h.isRGB=i,h.white={r:1,g:1,b:1},h.red={r:1,g:0,b:0},h.black={r:0,g:0,b:0};function r(p){return{r:Math.round(p.r*255),g:Math.round(p.g*255),b:Math.round(p.b*255),a:1}}h.toRgb255a1=r;function s(p){return{r:p.r,g:p.g,b:p.b}}h.clone=s;function o(p){return p=Math.floor(p),{r:(p>>16&255)/255,g:(p>>8&255)/255,b:(p&255)/255}}h.fromHex=o;function a(p){return Math.round(p.r*255)*65536+Math.round(p.g*255)*256+Math.round(p.b*255)}h.toHex=a;function l(p,f){return p.r===f.r&&p.g===f.g&&p.b===f.b}h.equals=l;function c(p,f){return p.r.toFixed(2)===f.r.toFixed(2)&&p.g.toFixed(2)===f.g.toFixed(2)&&p.b.toFixed(2)===f.b.toFixed(2)}h.equalsFixed=c;function u(p,f,g){return{r:p.r+(f.r-p.r)*g,g:p.g+(f.g-p.g)*g,b:p.b+(f.b-p.b)*g}}h.lerp=u;function d(p){return zB(p)?"r"in p&&"g"in p&&"b"in p&&!("a"in p):!1}h.is=d})(gr||(gr={}));(u=>{u.white={...gr.white,a:1};function t(d){return zB(d)?"r"in d&&"g"in d&&"b"in d&&"a"in d:!1}u.is=t,u.transparent={...gr.white,a:0};function n(d){return{r:d[0],g:d[1],b:d[2],a:d[3]}}u.from0to1=n;function r(d,h){return{...gr.fromHex(d),a:h}}u.fromHexAndA=r;function s(d){return{r:Math.round(d.r*255),g:Math.round(d.g*255),b:Math.round(d.b*255),a:d.a}}u.toRgb255a1=s;function o(d,h){return gr.equals(d,h)&&d.a===h.a}u.equals=o;function a(d,h){return gr.equalsFixed(d,h)&&d.a.toFixed(2)===h.a.toFixed(2)}u.equalsFixed=a;function l(d,h,p){return{r:d.r+(h.r-d.r)*p,g:d.g+(h.g-d.g)*p,b:d.b+(h.b-d.b)*p,a:d.a+(h.a-d.a)*p}}u.lerp=l;function c({r:d,g:h,b:p,a:f}=u.white){return`rgba(${d*255}, ${h*255}, ${p*255}, ${f})`}u.toStyle=c})(Vt||(Vt={}));(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]})(qS||(qS={}));Bd=(c=>(c[c.LINEAR=0]="LINEAR",c[c.EASE=1]="EASE",c[c.EASE_IN=2]="EASE_IN",c[c.EASE_OUT=3]="EASE_OUT",c[c.EASE_IN_OUT=4]="EASE_IN_OUT",c[c.CUBIC=5]="CUBIC",c[c.SPRING=6]="SPRING",c[c.ARC=7]="ARC",c[c.NONE=8]="NONE",c))(Bd||{});(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Qo||(Qo={}));(t=>t.defaultData={control1:[.5,0],control2:[.5,1]})($l||($l={}));(s=>(s.linear=[0,0,1,1],s.ease=[.25,.1,.25,1],s.easeIn=[.42,0,1,1],s.easeOut=[0,0,.58,1],s.easeInOut=[.42,0,.58,1]))(VB||(VB={}))});var jB,HB,WB,qB,XB,YB,$B,PC,KB,ZB,IC,QB,JB,eF,RC,tF,OC,nF,rF,iF,sF,oF,aF,lF,cF,uF=F(()=>{"use strict";on();AC();(t=>t.defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"})(jB||(jB={}));(t=>t.defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"})(HB||(HB={}));(t=>t.defaultData={type:"Link",name:"",url:null,context:"tab"})(WB||(WB={}));(t=>t.defaultData={type:"Destroy",name:"",objects:[],delay:0})(qB||(qB={}));(t=>t.defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"})(XB||(XB={}));(t=>t.defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"})(YB||(YB={}));(t=>t.defaultData={type:"Reset",name:"",delay:0})($B||($B={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1})(PC||(PC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(KB||(KB={}));(s=>(s.defaultData={type:"Audio",name:"",...PC.defaultData},s.hasAudioByActions=o=>o.some(({data:a})=>a.type==="Audio"&&a.interaction==="play"&&a.audio),s.hasAudioByEvents=o=>{for(let{data:a}of o)if(Ld.is(a)||a.type==="Start"||a.type==="Collision"){if(s.hasAudioByActions(a.actions))return!0}else if(a.type==="Conditional"){if(s.hasAudioByActions(a.inActions)||s.hasAudioByActions(a.outActions))return!0}else if(a.type==="GameControl"&&Object.values(a.gameActions).find(l=>s.hasAudioByActions(l)))return!0},s.getAudiosByActions=o=>{let a=[];return o.forEach(l=>{let c=l.data;c.type==="Audio"&&c.interaction==="play"&&c.audio&&a.push(l),c.type==="Conditional"&&(a.push(...s.getAudiosByActions(c.ifActions)),a.push(...s.getAudiosByActions(c.elseActions)))}),a},s.getAudiosByEvents=o=>{let a=[];return o.forEach(({data:l})=>{Ld.is(l)||l.type==="Collision"||l.type==="Start"||l.type==="Trigger"?a.push(...s.getAudiosByActions(l.actions)):l.type==="Conditional"?(a.push(...s.getAudiosByActions(l.inActions)),a.push(...s.getAudiosByActions(l.outActions))):l.type==="GameControl"?Object.values(l.gameActions).forEach(c=>{a.push(...s.getAudiosByActions(c))}):l.type==="DragDrop"&&(a.push(...s.getAudiosByActions(l.dragDropActions.drag)),a.push(...s.getAudiosByActions(l.dragDropActions.drop)))}),a}))(ZB||(ZB={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1/0})(IC||(IC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(QB||(QB={}));(s=>(s.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...IC.defaultData},s.hasVideoByActions=o=>o.some(({data:a})=>a.type==="Video"&&a.interaction==="play"&&a.layerId),s.hasVideoByObject=o=>{if(o.events){for(let{data:a}of o.events)if((Ld.is(a)||a.type==="Start")&&s.hasVideoByActions(a.actions))return!0}},s.getVideosByActions=o=>{let a=[];return o.forEach(l=>{let c=l.data;c.type==="Video"&&c.interaction==="play"&&c.layerId&&a.push(l)}),a},s.getVideosByEvents=o=>{let a=[];return o.forEach(({data:l})=>{(Ld.is(l)||l.type==="Start")&&a.push(...s.getVideosByActions(l.actions))}),a}))(JB||(JB={}));(t=>{function i(e){return{state:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}}t.defaultData=i})(eF||(eF={}));(t=>{function i(){return{tweens:new ze,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}}t.defaultData=i})(RC||(RC={}));(t=>{function i(e){return{type:"Transition",name:"",runMode:"Once",object:e??null,...RC.defaultData()}}t.defaultData=i})(tF||(tF={}));(t=>{function i(e){return{interaction:"play",timeline:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}}t.defaultData=i})(OC||(OC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(nF||(nF={}));(t=>{function i(e){return{type:"TimelineAnimation",name:"",...OC.defaultData(e)}}t.defaultData=i})(rF||(rF={}));(t=>{function i(e,n,r){return{type:"Animation",name:"",object:e,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}}t.defaultData=i})(iF||(iF={}));(t=>t.defaultData={type:"SetVariable",name:"",variableId:"",expression:[]})(sF||(sF={}));(t=>t.defaultData=()=>({type:"Conditional",name:"",ifActions:new ze,elseActions:new ze,condition:[]}))(oF||(oF={}));(t=>t.defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0})(aF||(aF={}));(t=>t.defaultData={type:"ClearLocalStorage",name:"",target:"all"})(lF||(lF={}));(t=>t.defaultData={name:"",type:"UserAPI"})(cF||(cF={}))});var dF,hF=F(()=>{"use strict";(e=>(e.emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),n=>n.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6))(dF||(dF={}))});var Jo,ea,DC=F(()=>{"use strict";(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(n){return e.all.includes(n)}e.is=t})(Jo||(Jo={}));(p=>{p.DefaultUp=[0,1,0],p.DefaultTargetOffset=1e3,p.MinTargetOffset=.001;function n(f){return f===void 0||!Number.isFinite(f)||f<p.MinTargetOffset?p.DefaultTargetOffset:f}p.sanitizeTargetOffset=n,p.DefaultAzimuth=-24,p.DefaultElevation=15;let o=p.DefaultAzimuth*Math.PI/180,a=p.DefaultElevation*Math.PI/180,l=180/Math.PI;p.DefaultPosition=[p.DefaultTargetOffset*Math.sin(o)*Math.cos(a),p.DefaultTargetOffset*Math.sin(a),p.DefaultTargetOffset*Math.cos(o)*Math.cos(a)],p.DefaultRotation=[Math.atan2(-Math.sin(a),Math.cos(o)*Math.cos(a))*l,Math.asin(Math.sin(o)*Math.cos(a))*l,Math.atan2(Math.sin(o)*Math.sin(a),Math.cos(o))*l],p.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:p.DefaultUp,isUpVectorFlipped:!1,targetOffset:p.DefaultTargetOffset};function h(f){return f.type==="PerspectiveCamera"?f.perspective?.zoom??1:f.orthographic?.zoom??1}p.getZoom=h})(ea||(ea={}))});var Na,YS,LC,$S,KS,ZS,QS,JS,NC=F(()=>{"use strict";(n=>{function i(r,s=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:Math.max(typeof r[0]=="number"?r[0]:1,typeof r[1]=="number"?r[1]:1)*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof r[0]=="number"?r[0]+r[0]:1)*s,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:r.map(o=>(typeof o=="number"?o:1)*(1+s)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}}n.defaultData=i;function t(r,s){let o={...r};if(LC.forEach(a=>{Object.assign(o,{[a]:s[a]??r[a]})}),o.radial={...r.radial},s.radial){let a=r.radial,l=s.radial;$S.forEach(c=>{Object.assign(o.radial,{[c]:l[c]??a[c]})})}if(o.linear={...r.linear},s.linear){let a=r.linear,l=s.linear;KS.forEach(c=>{Object.assign(o.linear,{[c]:l[c]??a[c]})})}if(o.grid={...r.grid},s.grid){let a=r.grid,l=s.grid;ZS.forEach(c=>{Object.assign(o.grid,{[c]:l[c]??a[c]})})}if(o.toObject={...r.toObject},s.toObject){let a=r.toObject,l=s.toObject;QS.forEach(c=>{Object.assign(o.toObject,{[c]:l[c]??a[c]})})}if(o.randomnessObject={...r.randomnessObject},s.randomnessObject){let a=r.randomnessObject,l=s.randomnessObject;JS.forEach(c=>{Object.assign(o.randomnessObject,{[c]:l[c]??a[c]})})}return o}n.merge=t;function e(r){return!!(r.randomnessObject||r.toObject)}n.isPartial=e})(Na||(Na={}));(n=>{n.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function e(r,s){let o=[];r.count!==void 0&&o.push({type:0,path:s,props:{count:r.count}});for(let a of t){let l=r[a];l&&Object.keys(l).length>0&&o.push({type:0,path:[...s,a],props:l})}return o}n.toOps=e})(YS||(YS={}));LC=["count"],$S=["radius","start","end","position","scale","rotation"],KS=["position","scale","rotation"],ZS=["count","size"],QS=["count","position","scale","rotation"],JS=["strength","scale","rotation","position","movement","seed","freqScale"]});var e1,t1,BC=F(()=>{"use strict";Es();(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(n){return e.all.includes(n)}e.is=t})(e1||(e1={}));(e=>{function i(n){return t(n)}e.defaultData=i;function t(n){if(n==="PointLight")return{type:n,color:Vt.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(n==="SpotLight")return{type:n,color:Vt.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(n==="DirectionalLight")return{type:n,color:Vt.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(t1||(t1={}))});var qp,FC=F(()=>{"use strict";(n=>(n.defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},n.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},n.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:n.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...n.defaultCollisionData}))(qp||(qp={}))});var n1,UC=F(()=>{"use strict";(e=>(e.defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]))(n1||(n1={}))});var fu,r1=F(()=>{"use strict";(t=>t.defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]})(fu||(fu={}))});var s1,kC,VC,i1,pF,zC=F(()=>{"use strict";s1=(n=>(n[n.Front=0]="Front",n[n.Back=1]="Back",n[n.Double=2]="Double",n))(s1||{});(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(n,r){return n.castShadow===r.castShadow&&n.receiveShadow===r.receiveShadow}e.equals=t})(kC||(kC={}));(e=>{e.defaultData={flatShading:!1,wireframe:!1,side:0};function t(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}e.equals=t})(VC||(VC={}));(t=>t.defaultData={...VC.defaultData,...kC.defaultData})(i1||(i1={}));(t=>{function i(e,n){let r=[];if("material"in e){let s=typeof e.material=="string"?n.materials[e.material]??n.lib.materials[e.material]?.asset:e.material;s&&r.push(s)}else if("materials"in e)for(let s of e.materials){let o=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;o&&r.push(o)}return r}t.getMaterialData=i})(pF||(pF={}))});var Xp,GC=F(()=>{"use strict";(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(Xp||(Xp={}))});function yF(i){return i.type!=="displace"}var fF,mF,Hy,gF,o1,Yp,a1,jC,HC,l1,WC,qC,$p,c1,Qn,An,Kp=F(()=>{"use strict";on();Es();GC();Es();(t=>{function i(e){return e==="texture"||e==="video"||e==="color"||e==="depth"||e==="normal"||e==="gradient"||e==="noise"||e==="fresnel"||e==="cavity"||e==="dust"||e==="rainbow"||e==="toon"||e==="outline"||e==="particle"||e==="transmission"||e==="reflection"||e==="matcap"||e==="displace"||e==="pattern"||e==="vertexColor"||e==="light"}t.is=i})(fF||(fF={}));(t=>{function i(e){return e==="luminance"||e==="r"||e==="g"||e==="b"||e==="a"}t.is=i})(mF||(mF={}));(t=>{function i(e){return typeof e=="object"&&e!==null&&e.image!=null}t.is=i})(Hy||(Hy={}));(t=>{function i(e){return e==="phong"||e==="toon"||e==="lambert"||e==="physical"}t.is=i})(gF||(gF={}));o1=(n=>(n[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",n))(o1||{}),Yp=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(Yp||{}),a1=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(a1||{}),jC=(s=>(s[s.UV=0]="UV",s[s.Planar=1]="Planar",s[s.Spherical=2]="Spherical",s[s.Cylindrical=3]="Cylindrical",s[s.Triplanar=4]="Triplanar",s))(jC||{}),HC=(o=>(o[o.Simplex=0]="Simplex",o[o.SimplexFractal=1]="SimplexFractal",o[o.Ashima=2]="Ashima",o[o.Fbm=3]="Fbm",o[o.Perlin=4]="Perlin",o[o.Voronoi=5]="Voronoi",o))(HC||{}),l1=(l=>(l[l.F1=0]="F1",l[l.F2=1]="F2",l[l.F2MinusF1=2]="F2MinusF1",l[l.SmoothBlend=3]="SmoothBlend",l[l.Edge=4]="Edge",l[l.Power=5]="Power",l[l.Lines=6]="Lines",l[l.Cells=7]="Cells",l))(l1||{}),WC=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(WC||{}),qC=(l=>(l[l.Circle=0]="Circle",l[l.Ring=1]="Ring",l[l.Polygon=2]="Polygon",l[l.Cross=3]="Cross",l[l.Diamond=4]="Diamond",l[l.Checkerboard=5]="Checkerboard",l[l.Line=6]="Line",l[l.Wave=7]="Wave",l))(qC||{}),$p=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],c1=["wrapping","image","video","name","minFilter","magFilter"];(s=>{function i(o,a){let{texture:l,...c}=a;if(Object.assign(o,c),l){let u=o.texture;u&&Object.assign(u,l)}}s.patch=i;function t(o){return{...s.defaultData("color"),color:o}}s.defaultColorLayer=t;function e(o,a){return o==="light"&&a?n(a):r(o)}s.defaultData=e;function n(o){let a={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...a,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...a,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...a,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...a,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}function r(o){let a={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...a,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...a,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Xp.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...a,type:"color",color:gr.fromHex(wr)};case"vertexColor":return{...a,type:"vertexColor"};case"depth":return{...a,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...a,type:"normal",cnormal:[1,1,1]};case"gradient":return{...a,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...a,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...gr.fromHex(6710886),a:1},colorB:{...gr.fromHex(6710886),a:1},colorC:{...gr.fromHex(16777215),a:1},colorD:{...gr.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...a,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...a,type:"fresnel",color:Vt.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...a,type:"dust",color:Vt.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...a,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...a,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Vt.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...a,type:"outline",outlineColor:Vt.fromHexAndA(0,1),contourColor:Vt.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...a,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...a,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...a,type:"reflection",blur:0,thickness:10/1e4,steps:60,stepSize:5/1e3,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...a,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...gr.fromHex(0),a:1},colorB:{...gr.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}})(Qn||(Qn={}));(u=>{function i(d){return!d.layers.some(p=>p.data.type==="texture"&&p.data.projection!==0||p.data.type==="depth"&&!p.data.isWorldSpace||p.data.type==="noise"||p.data.type==="dust"&&p.data.noiseStrength!==0||p.data.type==="displace")}u.isMergable=i;function t(d){let h="";return d.layers.forEach(p=>{Object.entries(p.data).forEach(([f,g])=>{h+=`${f}${g}`,Array.isArray(g)?g.forEach(m=>h+=`${m}`):typeof g=="object"?Object.values(g).forEach(m=>{typeof m=="number"?h+=`${m.toFixed(4)}`:h+=`${m}`}):h+=`${g}`})}),h}u.getHash=t;function e(){return{layers:new ze}}u.defaultEmptyData=e;function n(d="layer1",h="layer2"){return s("physical",d,h)}u.defaultData=n;function r(d,h){return{...d,name:h}}u.withName=r;function s(d,h="layer1",p="layer2",f=gr.fromHex(16777215)){let g=new ze;return g.push({fi:0,data:Qn.defaultData("light",d),id:h}),g.push({fi:1,data:Qn.defaultData("color"),id:p}),{layers:g}}u.defaultTwoLayerData=s;function o(d,h,p="layer1",f="layer2"){let g=new ze;return g.push({fi:0,data:Qn.defaultData("light",h),id:p}),g.push({fi:1,data:Qn.defaultColorLayer(d),id:f}),{layers:g}}u.defaultColorMaterial=o;function a(d){let h=Qn.defaultData("texture");d&&Object.assign(h.texture,{image:d});let p=new ze;return p.push({fi:0,data:h,id:"layer1"}),p.push({fi:1,data:{...Qn.defaultData("transmission"),alpha:1},id:"layer2"}),p.push({fi:2,data:{...Qn.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:p}}u.defaultUIObjectMaterial=a;function l(d,h="physical",p="layer1",f="layer2"){let g=Qn.defaultData("texture");Object.assign(g.texture,{image:d});let m=new ze;return m.push({fi:0,data:g,id:p}),m.push({fi:1,data:Qn.defaultData("light",h),id:f}),{layers:m}}u.defaultTwoLayerTextureData=l;function c(d,h="physical",p="layer1",f="layer2"){let g=Qn.defaultData("video");Object.assign(g.texture,{video:d});let m=new ze;return m.push({fi:0,data:g,id:p}),m.push({fi:1,data:Qn.defaultData("light",h),id:f}),{layers:m}}u.defaultTwoLayerVideoTextureData=c})(An||(An={}))});var Zp,vF,bF=F(()=>{"use strict";Zp="Roboto_regular",vF="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"});var Fd,XC=F(()=>{"use strict";on();(t=>{function i(){return{points:new ze,roundness:0,shapeHoles:[],isClosed:!1}}t.defaultData=i})(Fd||(Fd={}))});var Qp,Ud,u1,d1,Wy,YC=F(()=>{"use strict";on();(t=>{function i(){return{points:new ze,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}t.defaultData=i})(Qp||(Qp={}));Ud={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(t=>{function i(e,n){let r={...e};return Wy.forEach(s=>{Object.assign(r,{[s]:n[s]??e[s]})}),r}t.merge=i})(u1||(u1={}));d1={shape:Ud,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},Wy=["depth","offset","angle","twist","startScale","endScale"]});var qy,h1,fo,p1,f1=F(()=>{"use strict";XC();YC();(n=>{function i(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="UIGeometry"}n.is2DParametricMesh=i;function t(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="BooleanGeometry"||r==="TextGeometry"||r==="InputGeometry"||r==="DecalGeometry"}n.isParametricMesh=t;function e(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="TextGeometry"||r==="SubdivGeometry"||r==="NonParametricGeometry"}n.isSwappableGeometry=e})(qy||(qy={}));(t=>{function i(e,n){let r={...e};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...e.extrusion},Object.assign(r.extrusion,u1.merge(r.extrusion,n.extrusion))),r}t.merge=i})(h1||(h1={}));(t=>{function i(e){if(e==="RectangleGeometry")return{width:320,height:320,type:e,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="UIGeometry")return{type:e,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(e==="PathGeometry")return{type:e,width:1,height:1,depth:1,path:Qp.defaultData(),extrusion:d1};if(e==="VectorGeometry")return{width:1,height:1,type:e,subdivisions:12,shape:Fd.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="BooleanGeometry")return{type:e,operation:2,width:0,height:0,depth:0,phongAngle:35};if(e==="ShapeBlendGeometry")return{type:e,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(e==="DecalGeometry")return{type:e,width:200,height:200,depth:200,offset:1};if(e==="TextGeometry")return{type:e,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="InputGeometry")return{...t.defaultData("TextGeometry"),type:e,editable:!0};if(e==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")}t.defaultData=i})(fo||(fo={}));p1=["width","height","depth"]});var Br,$C=F(()=>{"use strict";Es();(o=>{o.defaultData={enabled:!1,useBackgroundColor:!1,color:gr.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0};function t(a){return a.mode??"linear"}o.getMode=t;function e(a){let l=t(a);return l==="height"?1:l==="both"?2:0}o.getModeIndex=e;function n(a){return a.density??o.defaultData.density}o.getDensity=n;function r(a){return a.heightFalloff??o.defaultData.heightFalloff}o.getHeightFalloff=r;function s(a){return a.heightBase??o.defaultData.heightBase}o.getHeightBase=s})(Br||(Br={}))});var KC,Ba,m1=F(()=>{"use strict";(t=>t.defaultData={image:null,rotation:0,blur:32,showBackground:!0})(KC||(KC={}));(t=>t.defaultData={enabled:!1,mode:"hdri",hdri:KC.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2})(Ba||(Ba={}))});var Jp,ZC=F(()=>{"use strict";(e=>{let i={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:{...i,blendFunction:16,granularity:15},bloom:{...i,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...i,offset:[2,2]},vignette:{...i,darkness:1,offset:0},hueSaturation:{...i,hue:3,saturation:0},brightnessContrast:{...i,brightness:.25,contrast:0},depthOfField:{...i,focusDistance:100,focalLength:20,bokehScale:5},noise:{...i,blendFunction:16}}})(Jp||(Jp={}))});var kd,QC,JC,eP,mu,tP,g1,y1=F(()=>{"use strict";$C();m1();ZC();Es();(e=>{e.defaultData={type:"normal",softShadowQuality:"low"};function t(n){return n==null?!1:n.type===void 0||n.type==="soft"}e.isSoft=t})(kd||(kd={}));(t=>t.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(QC||(QC={}));(t=>t.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(JC||(JC={}));(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1};function t(n){return n===void 0||n.pipeline==="classic"&&(n.toneMapping==="none"||n.toneMapping==="aces")&&n.exposure===1}e.isUntouched=t})(eP||(eP={}));(t=>t.defaultData={usePhysics:!1,gravity:-10})(mu||(mu={}));(t=>t.defaultData={playCamera:po,gameControlObject:null})(tP||(tP={}));(t=>t.defaultData={backgroundColor:Vt.fromHexAndA(GB,1),postprocessing:Jp.defaultData,fog:Br.defaultData,sky:Ba.defaultData,globalPhysics:mu.defaultData,ambient:QC.defaultData,ao:JC.defaultData,shadow:kd.defaultData,publish:tP.defaultData,grading:eP.defaultData})(g1||(g1={}))});var v1,xF=F(()=>{"use strict";(t=>t.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(v1||(v1={}))});var SF,ef,AF,Fr,tf,wF,EF,TF,MF,mo,Vd,nf,rf,go,ta,_F,na,Xy=F(()=>{"use strict";on();DC();BC();FC();UC();r1();zC();Es();Kp();f1();NC();mi();y1();xF();(e=>{function i(n){return n==="Component"||n==="Instance"}e.isComponentRelated=i;function t(n){return n==="Empty"||n==="Instance"}e.isEmptyOrComponent=t})(SF||(SF={}));(r=>{r.identity={...qS.identity,hiddenMatrix:hu.identity};function t(s){return{position:s.position,rotation:s.rotation,scale:s.scale,pivot:s.pivot,pivotRotation:s.pivotRotation,hiddenMatrix:s.hiddenMatrix}}r.fromObject=t;function e(s,o){return{position:o?.position||s.position,rotation:o?.rotation||s.rotation,pivot:o?.pivot||s.pivot,pivotRotation:o?.pivotRotation||s.pivotRotation,scale:o?.scale||s.scale,hiddenMatrix:o?.hiddenMatrix||s.hiddenMatrix}}r.merge=e;function n(s,o){return AS({position:ho.isEqual(s.position,o.position)?void 0:o.position,rotation:ho.isEqual(s.rotation,o.rotation)?void 0:o.rotation,scale:ho.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:hu.isEqual(s.hiddenMatrix,o.hiddenMatrix)?void 0:o.hiddenMatrix})}r.diff=n})(ef||(ef={}));AF=["slide","offset"];(t=>t.defaultData={states:new ze,events:new ze,visible:!0,raycastLock:!1,physics:fu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...ef.identity,cloner:null})(Fr||(Fr={}));(t=>t.defaultData={type:"Empty",...Fr.defaultData})(tf||(tf={}));(t=>t.defaultData={type:"ParticleCollider",...v1.defaultData,...Fr.defaultData})(wF||(wF={}));(t=>t.defaultData={type:"Component",...Fr.defaultData})(EF||(EF={}));(t=>t.defaultData={type:"Particle",...Fr.defaultData,...qp.defaultData})(TF||(TF={}));(t=>t.defaultData={type:"Hair",...Fr.defaultData,...n1.defaultData})(MF||(MF={}));(t=>t.defaultData={type:"Mesh",...Fr.defaultData,...i1.defaultData})(mo||(mo={}));(t=>t.defaultData={...Fr.defaultData,...ef.identity,position:ea.DefaultPosition,rotation:ea.DefaultRotation,...ea.defaultData})(Vd||(Vd={}));(e=>{function i(n){return{...Fr.defaultData,...t1.defaultData(n)}}e.defaultData=i,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(nf||(nf={}));(e=>{function i(n,r,s=0){for(;s<r.length;){let o=n?n[r[s]]:void 0;if(r.length===s+1)return o;if(o)n=o.descendants,s+=1;else return}}e.resolveWithDes=i;function t(n,r,s=0){let o=i(n,r,s);if(o){let a=Object.keys(o);if(a.length===1&&a[0]==="descendants")return}return o}e.resolve=t})(rf||(rf={}));(s=>{s.rootOverrideProps=["physics","events"],s.compositeNonOptionalOverrideProps=["geometry"],s.compositeEntireOverrideOverrideProps=["material"];function n(o,a){return{...Fr.defaultData,...a,component:o,overrides:new Zn,physics:void 0,events:void 0,type:"Instance"}}s.ofComponent=n;function r(o){let a=ef.fromObject(o.data);return n(o.id,a)}s.fromComponentData=r})(go||(go={}));(e=>{e.defaultData={type:"Page",...Fr.defaultData,physics:{...fu.defaultData,fusedBody:!1},...g1.defaultData,camera:Vd.defaultData,timelines:new at};function t(n){return n.uiScene!==void 0}e.isUIPage=t})(ta||(ta={}));(a=>(a.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:hu.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:fu.defaultData,states:new ze,events:new ze,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...ea.defaultData},a.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},a.defaultMeshObject={name:"Rectangle",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("RectangleGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultBooleanObject={name:"Boolean",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("BooleanGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultShapeBlendObject={name:"Shape Blend",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("ShapeBlendGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultTextObject={name:"Text",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("TextGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultInputObject={name:"Input",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("InputGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")}))(_F||(_F={}));(r=>{function i(s,o){let a={name:o};return s.type==="Mesh"?(a.geometry={},"material"in s&&(a.material={layers:new Zn}),"materials"in s&&(a.materials=s.materials.map(l=>({layers:new Zn})))):Jo.is(s.type)&&(a.perspective={},a.orthographic={}),a}r.newEmpty=i;function t(s,o){if(o===void 0)return s;let a={...s};return"material"in a&&"material"in o&&o.material&&(a.material=lu(a.material,l=>{if(typeof l!="string")for(let[c,u]of Object.entries(o.material.layers)){let d=l.layers.data(c);d&&Qn.patch(d,u)}}).data),a.materials&&o.materials&&(a.materials=lu(a.materials,l=>{for(let c=0;c<a.materials.length;c++){let u=o.materials[c];if(typeof u!="string")for(let[d,h]of Object.entries(u.layers)){let p=l[c]?.layers?.data(d);p&&Qn.patch(p,h)}}}).data),a}function e(s,o){let a,l=[],c={orthographic:0,perspective:0,geometry:0};function u(d,h){for(let[p,f]of Object.entries(h.layers)){let{texture:g,...m}=f;if(g!==void 0&&Object.keys(g).length>0){let y={path:[...d,"layers",p,"texture"],props:g,type:0};l.push(y)}if(Object.keys(m).length>0){let y={path:[...d,"layers",p],props:m,type:0};l.push(y)}}}for(let[d,h]of Object.entries(o)){let p=h;if(d!=="name")if(d==="cloner")l.push(...YS.toOps(p,["cloner"]));else if(d==="pathSnapping")l.push({path:[d],props:{slide:p.slide,offset:p.offset},type:0});else if(d==="material")u(["material"],p);else if(d==="materials")for(let[f,g]of Object.entries(p))u(["materials",f],g);else if(c[d]===0){if(d==="geometry"&&p.extrusion!==void 0){let f={path:[d,"extrusion"],props:p.extrusion,type:0};l.push(f),p={...p},delete p.extrusion}if(Object.keys(p).length>0){let f={path:[d],props:p,type:0};l.push(f)}}else a===void 0&&(a={path:[],props:{},type:0},l.push(a)),a.props[d]=p}return l}r.toOps=e;function n(s,o){if(o===void 0)return s;let a={...s};if(Object.assign(a,ef.merge(a,o)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:o.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:o.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Jo.is(s.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let l=o;l.orthographic?.zoom!==void 0&&(a.orthographic.zoom=l.orthographic.zoom),l.perspective?.zoom!==void 0&&(a.perspective.zoom=l.perspective.zoom),l.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=l.isUpVectorFlipped),l.targetOffset!==void 0&&(a.targetOffset=l.targetOffset)}else if(s.type==="Mesh")"geometry"in o&&Object.assign(a,{geometry:h1.merge(a.geometry,o.geometry)}),(o.material||o.materials)&&(a=t(a,o)),a.cloner&&"cloner"in o&&Object.assign(a,{cloner:Na.merge(a.cloner,o.cloner)});else if(s.type==="Empty")a.cloner&&"cloner"in o&&Object.assign(a,{cloner:Na.merge(a.cloner,o.cloner)});else if(e1.is(s.type)){let l=o;l.intensity!==void 0&&(a.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?a.color=l.color:a.color=gr.clone(l.color))}return a}r.patch=n})(na||(na={}))});var sf,b1=F(()=>{"use strict";(t=>t.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0})(sf||(sf={}))});var yo,Yy=F(()=>{"use strict";b1();Es();(t=>t.defaultData={orbitControls:sf.defaultData,playPage:pu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,n)=>{let r=0,s=0;return n<5?s=-30:n<10&&(s=30),n===0||n===10||n===5?r=30:(n===4||n===11||n===9)&&(r=-30),[120,[r,s],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0})(yo||(yo={}))});var nP,rP,Zl,iP=F(()=>{"use strict";(t=>t.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(nP||(nP={}));(t=>t.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(rP||(rP={}));(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...nP.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:rP.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(Zl||(Zl={}))});var vo,Ql,x1=F(()=>{"use strict";Xy();on();Yy();Es();mi();iP();(r=>{function i(s){return s.find(o=>o.data.type==="Page"&&o.data.globalPhysics.usePhysics)!==void 0}r.physicsEnabled=i;function t(s,o){let a=s.find(l=>l.data.type==="Page"&&l.data.timelines?.[o]!==void 0);return a&&a.data.timelines?.[o]}r.findTimeline=t;function e(s,o){let a=s.scene.objects.get(o);if(a&&a.data.type==="Component")return a;{let l=s.shared.lib.components[o];if(l)return{...l.asset,id:o}}}r.getComponentData=e;function n(s,o,a){s.scene.objects.traverseFrom(o,(l,c)=>{if(c.type==="Instance"){let u=e(s,c.component)?.data;u&&a(l,c,u.events)}else a(l,c,c.events)})}r.traverseModuleInstances=n})(vo||(vo={}));(c=>{c.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",c.defaultLight={fi:-1,data:nf.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]};function e(u=!0,d=[]){let h=[];u&&h.push({...c.defaultLight}),h.push(...d);let p=new Ln;return p.push({fi:1,id:pu,data:{...ta.defaultData,name:"Scene 1"},children:h}),p}c.createDefaultObjectTreeWithPage=e,c.defaultData={objects:e(),publish:yo.defaultData,styles:Zl.defaultData()},c.emptyDataWithoutPage=function(){return{objects:new Ln,publish:yo.defaultData,styles:Zl.defaultData()}},c.emptyDataWithPage=function(u=!0){return{objects:e(u),publish:yo.defaultData,styles:Zl.defaultData()}},c.emptyData=function(){return{objects:new Ln,publish:{...yo.defaultData},styles:Zl.defaultData()}};function a(u){return{...c.defaultData,objects:Wr(u,Ln.prototype)}}c.withObjs=a;function l(u,d){return a([{id:u,data:d,children:[],fi:0}])}c.withObj=l})(Ql||(Ql={}))});var of,sP=F(()=>{"use strict";(t=>t.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}})(of||(of={}))});var S1,CF,Er,oP,PF,IF,ra,as,w1=F(()=>{"use strict";on();mi();(e=>(e.defaultData=n=>({url:n,name:"New Webhook",parametersSchemas:new ze}),e.defaultParameterValueByType=n=>n==="number"?0:n==="boolean"?!1:""))(S1||(S1={}));(t=>t.defaultData=(e,n="GET")=>({url:e,method:n,name:"New API",headers:new ze,queries:new ze,autoStart:!0}))(CF||(CF={}));(s=>{function i(o){return o.textValue!==void 0}s.isTextValue=i;function t(o){return typeof o=="number"}s.isNumber=t;function e(o){return typeof o=="boolean"}s.isBoolean=e;function n(o){return i(o)?"string":e(o)?"boolean":"number"}s.typeOfVariable=n;function r(o){return s.isTextValue(o)?Array.isArray(o.textValue)?o.textValue.map(a=>a.toString().padStart(o.padding??2,"0")).join(o.deliminator??":")+(o.suffix!==void 0?" "+o.suffix:""):o.textValue.toString():s.isBoolean(o)?o?"True":"False":s.isNumber(o)?parseFloat(o.toFixed(3)).toString():o.toString()}s.getDisplayedValue=r})(Er||(Er={}));(t=>t.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(oP||(oP={}));(t=>t.all=[...oP.all,"components"])(PF||(PF={}));(t=>{function i(){return{images:new at,videos:new at,colors:new at,audios:new at,particles:new at,fonts:new at,materials:new at,components:new at,variables:new at,userAPIs:new at,userWebhooks:new at}}t.defaultData=i})(IF||(IF={}));(t=>{function i(){return{images:new at,videos:new at,colors:new at,audios:new at,particles:new at,fonts:new at,materials:new at,components:new at,variables:new at,userAPIs:new at,userWebhooks:new at}}t.defaultData=i})(ra||(ra={}));(s=>{function i(){let o={};return o["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},Wr(o,at.prototype)}s.defaultColors=i;function t(){return Wr({},at.prototype)}s.defaultImages=t;function e(){return{catelogs:new at,materials:new at,images:new at,videos:new at,colors:new at,audios:new at,particles:new at,fonts:new at,variables:new ze,userAPIs:new at,userWebhooks:new at,lib:ra.defaultData()}}s.emptyData=e;function n(o){switch(o){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let a=[0,0,0];return{name:"Time",value:{textValue:a,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:a,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",o)}}s.defaultVariables=n;function r(o,a){if(a.format==="HH:mm:ss"){let l=Math.floor(o/3600),c=Math.floor((o-l*3600)/60),u=Math.round(o-l*3600-c*60);return{textValue:[l,c,u]}}else if(a.format==="mm:ss"){let l=Math.floor(o/60),c=Math.round(o-l*60);return{textValue:[l,c]}}else return a.format==="number"?o=Math.round(o):o=Math.round(o*1e3)/1e3,o}s.getFormattedTimerTime=r})(as||(as={}))});var RF=F(()=>{"use strict"});var gu,aP=F(()=>{"use strict";on();x1();sP();w1();(l=>{l.defaultData={schema:131,scene:Ql.defaultData,frames:new at().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",of.defaultData),shared:{...as.emptyData(),colors:as.defaultColors()}},l.createDefaultData=function(){return Dd.deserialize(Dd.serialize(l.defaultData))},l.emptyDataForImports=function(){let c=Ql.emptyDataWithPage();return{schema:131,scene:c,frames:new at().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",of.defaultData),shared:{...as.emptyData(),colors:as.defaultColors(),images:as.defaultImages()}}},l.emptyData=function(){return{schema:131,scene:Ql.emptyDataWithPage(),frames:new at().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",of.defaultData),shared:as.emptyData()}},l.clipboard2dData=function(){return{schema:131,scene:Ql.emptyData(),frames:new at,shared:as.emptyData()}};function s(c){return{...c,shared:{...c.shared,lib:ra.defaultData()}}}l.withoutLib=s;function o(c,u){return vo.getComponentData(c,u)}l.getComponentData=o;function a(c){let u=Object.values(c.shared.userAPIs);for(let d of u){let h=d.headers;for(let p of h)if(p.data.key.toLowerCase()==="authorization"&&p.data.value!=="")return!0}return!1}l.hasSensitiveData=a})(gu||(gu={}))});var E1,OF=F(()=>{"use strict";(t=>t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"})(E1||(E1={}))});function Jl(i,t=[0,0]){let e=i&&!isNaN(i[0])?i[0]:t[0],n=i&&!isNaN(i[1])?i[1]:t[1];return[e,n]}function $y(i,t,e){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=t??{...$l.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:o}=e??{...Qo.defaultData},a=new lP(n,r,s,o),l=a.solve(1);return()=>c=>a.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}var DF,LF,ec,af,lP,cP=F(()=>{"use strict";on();Es();(t=>{function i(e,n){return{id:e,name:n,duration:5,objectTimelines:new at}}t.defaultData=i})(DF||(DF={}));(t=>{function i(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"}t.is=i})(LF||(LF={}));(x=>{function i(S,E){let T=[0,0],w=[1,1];if(S?.cubicControls)T=Jl(S.cubicControls.control1,T);else switch(S?.type){case 2:T=[.42,0];break;case 3:T=[0,0];break;case 4:T=[.42,0];break;case 1:T=[.25,.1];break;case 0:T=[0,0];break;case 7:T=[.25,1];break}if(E?.cubicControls)w=Jl(E.cubicControls.control2,w);else switch(E?.type){case 2:w=[1,1];break;case 3:w=[.58,1];break;case 4:w=[.58,1];break;case 1:w=[.25,1];break;case 0:w=[1,1];break;case 7:w=[.5,1];break}return{control1:T,control2:w}}x.getControlsWithDefault=i,x.BEZIER_PRESETS=[0,1,2,3,4,7];function e(S){if(!x.BEZIER_PRESETS.includes(S))return;let E={type:S};return{control1:i(E).control1,control2:i(void 0,E).control2}}x.presetHandles=e;let n=.001;function r(S,E){return Math.abs(S[0]-E[0])<n&&Math.abs(S[1]-E[1])<n}function s(S){return x.BEZIER_PRESETS.find(E=>{let T=e(E);return T!==void 0&&r(T.control1,S.control1)&&r(T.control2,S.control2)})}x.presetForHandles=s;function o(S){return{id:S,keyframes:new ze}}x.defaultData=o,x.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"];function l(S){let E=x.ROOT_PROPERTY_ORDER.indexOf(S[0]);return E===-1?x.ROOT_PROPERTY_ORDER.length:E}x.rowOrder=l;function c(S){return S.layerId??S.path.join(".")}x.propertyKey=c;function u(S,E){let T=new Map;for(let w of S){let _=w.data;if(E?.(_))continue;let A=c(_),C=T.get(A);C||(C={id:A,path:_.path,keyframes:[],layerId:_.layerId,index:_.index},T.set(A,C)),_.isPlaceholder?C.placeholder=w.id:C.keyframes.push(w)}return[...T.values()].sort((w,_)=>{let A=l(w.path)-l(_.path);return A!==0?A:(w.index??0)-(_.index??0)})}x.groupKeyframes=u;function d(S){let E=S[S.length-1];return af.includes(E)?E:void 0}x.rowAxis=d;function h(S){return S.layerId?S.layerId:(d(S.path)?S.path.slice(0,-1):S.path).join(".")}x.drawnRowKey=h;function p(S){let E=new Map;for(let T of S){let w=d(T.path),_=w?T.path.slice(0,-1):T.path,A=h(T),C=E.get(A);C||(C={id:A,path:_,layerId:T.layerId,index:T.index,tracks:[]},E.set(A,C)),C.tracks.push({axis:w,property:T})}return[...E.values()]}x.drawnRows=p;function f(S){return[...S].sort((E,T)=>E.data.time-T.data.time)}x.sortedKeyframes=f;function g(S){return["material",S.type==="light"?`${S.category} lighting`:S.type]}x.materialLayerPath=g;function m(S,E){return S.map(({data:T,id:w},_)=>y(E(),g(T),{layerId:w,index:_}))}x.createMaterialGroup=m;function y(S,E,T){return{id:S,data:{id:S,time:T?.time??0,path:E,value:{},layerId:T?.layerId,index:T?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}x.placeholderKeyframe=y;function v(S){return Object.entries(S).reduce((E,[T,w])=>(typeof w!="string"&&E.push({name:w.name}),E),[])}x.createName=v,x.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:$y(3),duration:1e3},opacity:{value:[0,1],easing:$y(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:$y(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:$y(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:$y(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(ec||(ec={}));af=["x","y","z"],lP=class{constructor(t=1,e=100,n=10,r=0){this.mass=t,this.stiffness=e,this.damping=n,this.initialVelocity=r,this.m_w0=Math.sqrt(e/t),this.m_zeta=n/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0+-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(t){return this.m_zeta<1?t=Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):t=(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0),1-t}getDuration(){let t=.16666666666666666,e=0,n=0;for(;;)if(e+=t,this.solve(e)===1){if(n++,n>=16)break}else n=0;return e*t*1e3}}});var lf,cf,T1=F(()=>{"use strict";Es();on();(t=>t.list=["idle","move","jump","run"])(lf||(lf={}));(e=>(e.defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:e.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new ze,move:new ze,jump:new ze,run:new ze},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Vt.fromHexAndA(3728051,1)}}))(cf||(cf={}))});function zd(i,...t){let e={};for(let n of t.flat())i!=null&&n in i&&(e[n]=i[n]);return e}function NF(i){i.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let e=t.colorA,n=t.colorB,r=[[e.r,e.g,e.b,e.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let a=2;a<10;a++)r.push(r[1]),s.push(1);let o={...zd(Cr(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,o)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let e={...Cr(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,e)}})}function Fa(i,t){Object.values(i.shared.materials).forEach(e=>t(e))}function Ua(i,t){i.scene.objects.traverse((e,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=An.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&t(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=An.defaultTwoLayerData("phong")),t(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=An.defaultTwoLayerData("phong")),t(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==Zn.prototype&&t(r.material)})})}function ZZ(i){Object.assign(i.scene.publish,{orbitControls:{...sf.defaultData,...Cr(i.scene.publish.orbitControls)}})}function QZ(i){Object.assign(i.scene.publish.settings,{video:{...yo.defaultData.settings.video,...Cr(i.scene.publish.settings.video)}})}function JZ(i){function t(e){if(e.layers){for(let n of Object.values(e.layers))if(n){for(let[r,s]of Object.entries(n))if(($p.includes(r)||typeof s=="boolean")&&delete n[r],r==="texture")for(let[o,a]of Object.entries(s))(c1.includes(o)||typeof a=="boolean")&&delete s[o]}}}i.scene.objects.traverse((e,n)=>{n.states.forEach(r=>{let s=r;s.material?t(s.material):s.materials&&s.materials.forEach(o=>{t(o)})})})}function eQ(i){i.scene.publish.withBackground=!0}function tQ(i){i.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function nQ(i){i.scene.objects.traverse((t,e)=>{let n=e.cloner;n&&(n.radial.scale=n.radial.scale.map(r=>r+1),n.linear.scale=n.linear.scale.map(r=>r+1))})}function rQ(i){i.scene.objects.traverse((t,e)=>{let n=e.geometry;n&&(n.type==="DodecahedronGeometry"||n.type==="IcosahedronGeometry")&&(n.detail=Math.round(n.detail))})}function iQ(i){i.scene.objects.traverse((t,e)=>{let n=i.scene.objects.unproxy().parent(t);if(n){let r=Cr(i.scene.objects.data(n));r&&r.type==="Mesh"&&r.geometry.type==="BooleanGeometry"&&e.type==="Mesh"&&(e.visible=Cr(e).booleanExclude!==!0)}})}function sQ(i){i.scene.objects.traverse((t,e)=>{if(e.type==="Mesh"){let n=e;e.geometry.type==="NonParametricGeometry"?n.material!==void 0&&delete n.material:n.materials!==void 0&&delete n.materials}})}function oQ(i){function t(n){Object.setPrototypeOf(n,Zn.prototype),n.texture&&Object.setPrototypeOf(n.texture,Zn.prototype)}function e(n){Object.setPrototypeOf(n,Zn.prototype);for(let r in n)t(n[r])}i.scene.objects.traverse((n,r)=>{r.states.forEach(s=>{let o=s;if(o.material){let a=Cr(o.material).layers;e(a),o.material.layers=a}if(o.materials)for(let a=0;a<o.materials.length;a++){let l=o.materials[a],c=Cr(l).layers;e(c),l.layers=c}})})}function BF(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("lambert"))}function uP(i){!i.layers||i.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let e=[...t.colors];e.push(t.colors[9]);let n=[...t.steps];n.push(t.steps[9]);let r={...Cr(t),colors:e,steps:n};Object.assign(t,r)}})}function aQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&(e.geometry.type==="BooleanGeometry"||e.geometry.type==="SubdivGeometry")&&(e.geometry.phongAngle=35)})}function FF(i){i.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(n=>{typeof n!="string"&&uP(n)}):"material"in e&&typeof e.material!="string"&&uP(e.material)}),Object.values(i.shared.materials).forEach(t=>uP(t))}function lQ(i){i.scene.environment.ambientLight.softShadows=!1,i.scene.environment.ambientLight.softShadowQuality="low",i.scene.objects.traverse((t,e)=>{(e.type==="DirectionalLight"||e.type==="SpotLight")&&(e.shadowResolution=1024,e.shadowRadius=1,e.depth=1e5)}),i.shared.penumbraSize=new Array(5).fill(.5)}function cQ(i){i.shared.audios=Wr({},at.prototype)}function uQ(i){i.shared.videos=Wr({},at.prototype)}function dQ(i){let t=i.shared.materials;Object.entries(t).forEach(([e,n])=>{if(!n.layers){let r={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(t,{[e]:r})}})}function hQ(i){Object.entries(Cr(i.shared.images)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete i.shared.images[n]}),Object.entries(Cr(i.shared.audios)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete i.shared.audios[n]})}function pQ(i){i.scene.publish.settings.web.preload=!1}function UF(i){i.layers&&i.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function kF(i){i.layers&&i.layers.forEach(t=>{yF(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function fQ(i){i.shared.fonts=Wr({},at.prototype)}function mQ(i){return i.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function gQ(i){let t=[];i.scene.objects.traverse((e,n)=>{let r=n;if(r.type==="TextFrame"){let s=An.defaultTwoLayerData("phong"),o=typeof r.color=="string"?i.shared.colors[r.color]:r.color;s.layers[1].data.color={r:o.r,g:o.g,b:o.b},s.layers[1].data.alpha=r.alpha;let a=mQ(r.font);i.shared.fonts[a]===void 0&&(i.shared.fonts[a]={name:a});let l={name:r.name,...Fr.defaultData,...mo.defaultData,flatShading:!1,wireframe:!1,geometry:{...fo.defaultData("TextGeometry"),width:r.width,height:r.height,font:a,depth:0,horizontalAlign:r.horizontalAlign,verticalAlign:r.verticalAlign,fontSize:r.fontSize*1.40625,lineHeight:r.lineHeight/1.40625,letterSpacing:r.letterSpacing-1,text:r.text,textTransform:r.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:s,states:Cr(r.states),events:Cr(r.events),visible:r.visible,raycastLock:r.raycastLock,position:r.position,rotation:r.rotation,scale:r.scale,hiddenMatrix:r.hiddenMatrix},c=Cr(i.scene.objects).parent(e);i.scene.objects.insertAfter(c??null,e,[{id:e+"new",data:l,children:[]}]),t.push(e)}}),t.forEach(e=>{i.scene.objects.delete(e)})}function yQ(i){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};i.scene.objects.traverse((e,n)=>{n.events.forEach(r=>{if(!!t[Number(r.type)])if(Object.assign(r,{type:t[Number(r.type)]}),r.type==="Audio"&&"audioEvent"in r&&(Object.assign(r,{playAudio:r.audioEvent}),delete r.audioEvent),r.type==="GameControl")Object.assign(r,{gameActions:{idle:new ze,move:new ze,jump:new ze}});else{let s=new ze;Object.assign(r,{actions:s}),(r.type==="MouseDown"||r.type==="MouseUp"||r.type==="KeyDown"||r.type==="KeyUp")&&"url"in r&&s.push({fi:0,id:xe.generateUUID(),data:{type:"Link",url:r.url,delay:0}}),"targets"in r&&(r.targets.forEach((o,a,l)=>{let c={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},u={easing:o.easing,duration:o.duration};o.easing===6?Object.assign(u,zd(o,"mass","stiffness","damping","velocity")):o.easing===5&&Object.assign(u,{control1:{...o.control1},control2:{...o.control2}});let d={repeat:o.repeat?-1:0,delay:o.delay,delayDirection:o.delayDirection,direction:o.cycle&&o.rewind?"pingpong-rewind":o.cycle?"pingpong":"normal"},h={state:o.state,...d,...u},p={allowSlerp:!0,type:"Transition",object:o.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new ze({fi:0,id:xe.generateUUID(),data:c},{fi:1,id:xe.generateUUID(),data:h})};s.push({fi:l,id:a,data:p})}),delete r.targets)}})})}function vQ(i){i.scene.objects.traverse((t,e)=>{function n(r,s){let o=new ze,a=[];if(e.events.forEach((l,c,u)=>{if(l.type==="Audio"&&l.trigger===s){let d;a.push(c),l.interaction==="play"?d={...zd(l,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in l?l.after:void 0,toggle:"after"in l?l.toggle:void 0,type:"Audio"}:(l.interaction==="pause"||l.interaction==="stop")&&(d={...zd(l,"interaction","delay","object","playAudio"),type:"Audio"}),d&&o.push({fi:u,id:c,data:d})}}),a.forEach(l=>e.events.delete(l)),o.length){let l=e.events.find(c=>c.type===r)?.data;l?"actions"in l&&l.actions.insertBefore(null,o):e.events.insertBefore(null,[{id:xe.generateUUID(),data:{type:r,actions:o}}])}}n("Start","start"),n("MouseDown","mouseDown"),n("MouseUp","mouseUp"),n("KeyDown","keyDown"),n("KeyUp","keyUp")})}function VF(i){let t=i.layers.find(e=>e.type==="light")?.data;if(t?.category==="basic"){let e=Qn.defaultData("light","phong"),n=t;Object.assign(n,e),n.visible=!1}}function zF(i){Fa(i,VF),Ua(i,VF)}function bQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="SubdivGeometry"&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}function xQ(i){i.scene.objects.traverse((t,e)=>{(e.type==="Empty"||e.type==="Mesh")&&e.cloner&&!e.cloner.randomnessObject&&!e.cloner.toObject&&!e.cloner.randomness&&(e.cloner={...e.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}function SQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="NonParametricGeometry"&&!("material"in e)&&!("materials"in e)&&(e.material=An.defaultTwoLayerData("phong"))})}function wQ(i){i.scene.publish.orbitControls.autoZoom===void 0&&(i.scene.publish.orbitControls.autoZoom=!1),i.scene.objects.traverse((t,e)=>{(e.type==="OrthographicCamera"||e.type==="PerspectiveCamera")&&(e.orthographic.autoZoom===void 0&&(e.orthographic.autoZoom=!1),e.orthographic.autoZoomFrustumSize===void 0&&(e.orthographic.autoZoomFrustumSize=790))})}function EQ(i){i.scene.objects.traverse((t,e)=>{e.pathSnapping===void 0&&(e.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),e.pathSnapping.offset===void 0&&(e.pathSnapping.offset=0)})}function TQ(i){i.scene.publish.mouseEventTarget===void 0&&(i.scene.publish.mouseEventTarget="canvas"),i.scene.publish.settings.web.hint===void 0&&(i.scene.publish.settings.web.hint=!1)}function MQ(i){let{video:t}=i.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function _Q(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.resetYPosition=Math.abs(n.resetYPosition-e.position[1]))})})}function AQ(i){let t=i.scene.environment.usePhysics;i.scene.objects.traverse((e,n)=>{t&&n.physics===null?n.collision=!1:n.collision="visibility"})}function CQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.navmesh=cf.defaultDataThirdPerson.navmesh)})})}function PQ(i){i.scene.styles||(i.scene.styles=Zl.defaultData())}function GF(i){i.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function IQ(i){i.scene.environment.ambientLight.occlusion===void 0&&(i.scene.environment.ambientLight.occlusion=!1),i.scene.environment.ambientLight.aoFullRes===void 0&&(i.scene.environment.ambientLight.aoFullRes=!1),i.scene.environment.ambientLight.radius===void 0&&(i.scene.environment.ambientLight.radius=256),i.scene.environment.ambientLight.bias===void 0&&(i.scene.environment.ambientLight.bias=.5),i.scene.environment.ambientLight.aoColor===void 0&&(i.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Ua(i,GF),Fa(i,GF)}function RQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&Object.assign(n.gameActions,{run:new ze})})})}function OQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.keyAssignments=[...n.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}function jF(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function HF(i,t){if(t<1&&(Ua(i,NF),Fa(i,NF),i.schema=1),t<2&&(ZZ(i),i.schema=2),t<3&&(JZ(i),i.schema=3),t<4&&(eQ(i),i.schema=4),t<5&&(tQ(i),i.schema=5),t<6&&(nQ(i),i.schema=6),t<7&&(rQ(i),i.schema=7),t<8&&(i.schema=8),t<9&&(FF(i),i.schema=9),t<10&&(aQ(i),i.schema=10),t<11&&(lQ(i),i.schema=11),t<12&&(FF(i),i.schema=12),t<13&&(cQ(i),i.schema=13),t<14&&(dQ(i),i.schema=14),t<15&&(hQ(i),i.schema=15),t<16&&(pQ(i),i.schema=16),t<17&&(Ua(i,UF),Fa(i,UF),i.schema=17),t<18&&(Ua(i,BF),Fa(i,BF),i.schema=18),t<19&&(QZ(i),i.schema=19),t<20&&(fQ(i),gQ(i),i.schema=20),t<21&&(yQ(i),vQ(i),i.schema=21),t<22&&(zF(i),i.schema=22),t<23&&(bQ(i),i.schema=23),t<24&&(xQ(i),i.schema=24),(t<25||i.shared.videos===void 0)&&(uQ(i),t<25&&(i.schema=25)),t<26&&(iQ(i),i.schema=26),t<27&&(sQ(i),i.schema=27),t<28&&(zF(i),i.schema=28),t<29&&(oQ(i),i.schema=29),t<30&&(SQ(i),i.schema=30),t<31&&(wQ(i),i.schema=31),t<33&&(EQ(i),i.schema=33),t<34&&(TQ(i),i.schema=34),t<35&&(MQ(i),i.schema=35),t<36&&(_Q(i),i.schema=36),t<37&&(AQ(i),i.schema=37),t<38&&(Ua(i,kF),Fa(i,kF),i.schema=38),t<39&&(CQ(i),i.schema=39),t<40&&(PQ(i),i.schema=40),t<41&&(IQ(i),i.schema=41),t<42&&(RQ(i),i.schema=42),t<43&&(OQ(i),i.schema=43),t<99){Ua(i,jF),Fa(i,jF),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=po);let e=Cr(i.scene.objects),n=i.scene.objects;i.scene.publish.playPage=pu,n.insertBefore(null,null,[{id:pu,data:{...ta.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:zd(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:zd(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...mu.defaultData,...zd(i.scene.environment,"usePhysics","gravity")},camera:Cr(i.scene.ownerCamera)??ta.defaultData.camera,name:"Scene"},children:[]}]);for(let o of e)o.id!==Ql.TRASH_CAN_ID&&n.move(pu,o.fi,o.id);let r=0,s=0;i.shared.penumbraSize&&i.scene.objects.traverse((o,a)=>{a.type==="DirectionalLight"?(a.penumbraSize=i.shared.penumbraSize[Math.min(r,2)],r+=1):a.type==="SpotLight"&&(a.penumbraSize=i.shared.penumbraSize[3+Math.min(s,1)],s+=1),(a.physics===void 0||a.physics===null)&&a.type!=="Instance"&&(a.physics={},Object.assign(a.physics,fu.defaultData)),a.physics!==void 0&&a.physics!==null&&(a.physics.enabled=a.collision??"visibility",delete a.collision)}),i.schema=99}}var WF=F(()=>{"use strict";Kp();Es();b1();Xy();on();Yy();mi();X();f1();T1();iP();x1();r1();y1()});var JF={};Uh(JF,{updateAllMaterials:()=>ZF,updateDocumentSchema:()=>pP,updateLibSchema:()=>tJ,updateMaterialSchema:()=>UQ,updateObjectStateRec:()=>df,updateObjectsSchema:()=>KF,updateTextValues:()=>BQ});function qF(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function DQ(i){i.scene.objects.traverse((t,e)=>{let n=e.geometry;n&&n.type==="PathGeometry"&&(n.extrusion.capType="flat",n.extrusion.bevel=50,n.extrusion.bevelSides=6,n.extrusion.shape.type==="Custom"&&(n.extrusion.shape.shapeQuality="low"))})}function LQ(i){Array.isArray(Cr(i.events))&&i.events?.forEach(t=>{"disabled"in t||(t.disabled=!1),(t.type==="MouseDown"||t.type==="MouseUp"||t.type==="MousePress")&&(t.mode=t.mode||"Object")})}function XF(i){i.rotation=i.rotation.slice(0,3).map(t=>t*uf)}function $F(i){XF(i),i.type==="Page"&&XF(i.camera),i.states?.forEach(e=>{e.rotation===void 0||e.rotation===null||(e.rotation=e.rotation.slice(0,3).map(n=>n*uf))});let t=i.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*uf),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*uf),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=uf,t.extrusion.twist*=uf),i.type==="Mesh"&&i.geometry.type==="TextGeometry"&&(i.geometry.text={textValue:i.geometry.text}),Array.isArray(Cr(i.events))&&i.events?.forEach(e=>{(e.type==="MouseDown"||e.type==="MouseUp"||e.type==="MousePress"||e.type==="KeyDown"||e.type==="KeyUp"||e.type==="KeyPress"||e.type==="Collision"||e.type==="Trigger")&&(e.runMode=e.toggle?"Toggle":"Repeat")})}function NQ(i){i.shared.variables=Wr({},at.prototype)}function BQ(i){i.scene.objects.traverse((t,e)=>{})}function FQ(i){let t=Cr(i.shared.variables);i.shared.variables=Wr(Object.entries(t??{}).map(([e,n],r)=>({fi:r,id:e,data:n})),ze.prototype)}function UQ(i){let t=i.schema??104;t!==131&&t<130&&(M1(i.asset),i.schema=130)}function df(i,t){t(i.data);for(let e of i.children)df(e,t)}function KF(i){let t=i.schema??104;t!==131&&(t<105&&(df(i.asset,$F),i.schema=105),t<118&&(df(i.asset,QF),i.schema=118),t<121&&(df(i.asset,hP),i.schema=121),t<130&&(df(i.asset,kQ),i.schema=130))}function ZF(i,t){Ua(i,t),Fa(i,t),Object.values(i.shared.lib.materials).forEach(e=>t(e.asset))}function M1(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("phong"))}function kQ(i){"materials"in i?i.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&M1(t)}):"material"in i&&i.material!==void 0&&typeof i.material!="string"&&M1(i.material)}function VQ(i){i.shared.particles=Wr({},at.prototype),i.shared.lib&&(i.shared.lib.particles=ra.defaultData().particles)}function zQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Particle"&&typeof e.renderMaterial.size=="number"&&Object.assign(e.renderMaterial,{size:[e.renderMaterial.size,e.renderMaterial.size]})})}function GQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Page"&&(e.postprocessing.depthOfField.focusDistance=100,e.postprocessing.depthOfField.focalLength=20,e.postprocessing.depthOfField.bokehScale=5)})}function jQ(i){i.scene.objects.traverse((t,e)=>{Array.isArray(Cr(e.events))!==!1&&e.events?.forEach(n=>{let r=n.runMode;n.type==="MouseDown"||n.type==="MouseUp"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="Collision"||n.type==="Trigger"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode=r??"Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode=r==="Toggle"?"Toggle":"Normal")}):n.type==="MouseHover"||n.type==="MousePress"||n.type==="KeyPress"?n.actions?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")}):n.type==="GameControl"?(delete n.actions,Object.keys(n.gameActions).forEach(o=>{n.gameActions[o]?.forEach(a=>{a.type==="Transition"&&(a.runMode="Repeat"),a.type==="Animation"&&(a.runMode="Normal")})})):n.type==="DragDrop"?(delete n.actions,n.dragDropActions?.drag?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")}),n.dragDropActions?.drop?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")})):n.type==="Resize"?(delete n.actions,n.breakpoints?.forEach(s=>{s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})})):n.type==="Start"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Once"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}):n.type==="VariableChange"||n.type==="Scroll"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}):n.type==="Conditional"&&(delete n.actions,n.inActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}),n.outActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}))})})}function HQ(i){i.shared.userAPIs=Wr({},at.prototype),i.shared.userWebhooks=Wr({},at.prototype),i.shared.lib&&(i.shared.lib.userAPIs=ra.defaultData().userAPIs,i.shared.lib.userWebhooks=ra.defaultData().userWebhooks)}function WQ(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=yo.defaultData.settings.videoStatic)}function QF(i){i.timelineAnimations=Wr({},at.prototype)}function qQ(i){let t=[];return i?(i.forEach((e,n)=>{let{path:r,keyframes:s}=e.data,o=r[0]==="material"?e.id:void 0;if(!s?.length){t.push(ec.placeholderKeyframe(e.id,r,{layerId:o,index:n}));return}s.forEach(({id:a,data:l})=>{t.push({id:a,data:{...l,path:r,layerId:o,index:n}})})}),t.sort((e,n)=>e.data.time-n.data.time),new ze(...t.map((e,n)=>({...e,fi:n})))):new ze}function XQ(i){let t=i.shared,e=t.timelineAnimations;if(!e)return;let n=i.scene.objects,r=n.unproxy().find(s=>s.data.type==="Page")?.id;for(let[s,o]of Object.entries(e)){let a=Wr({},at.prototype),l=0,c=Boolean(o.loop);for(let[p,f]of Object.entries(o.mapping??{})){let m=n.data(p)?.timelineAnimations?.[f];!m||(l=Math.max(l,m.to??0),c=c||Boolean(m.loop),a[p]={id:p,keyframes:qQ(m.properties?.unproxy())})}let u=o.page??r,d=u?n.data(u):void 0;if(!d||d.type!=="Page")continue;let h=d.timelines??(d.timelines=Wr({},at.prototype));h[s]={id:s,name:o.name,duration:l||5,...c?{loop:c}:{},objectTimelines:a}}delete t.timelineAnimations,n.traverse((s,o)=>{delete o.timelineAnimations})}function YQ(i){i.scene.objects.traverse((t,e)=>{let n=e.states;if(!n)return;let r=e.timelineAnimations,s=[];n.forEach((o,a)=>{(o.isAnimation||r?.[a])&&s.push(a)}),s.forEach(o=>n.delete(o))})}function KQ(i){for(let{id:t,data:e}of[...i.unproxy()]){let n=e.path?.[0];if(!n||!$Q.includes(n))continue;let r=dP(e.value);if(!r.length)continue;let s=i.data(t);if(!s)continue;let o=e.value,[a,...l]=r;for(let c of l){let u=xe.generateUUID();i.insertBefore(null,[{id:u,data:{...e,id:u,path:[n,c],value:o[c],easing:ZQ(e.easing)}}])}s.path=[n,a],s.value=o[a]}}function dP(i){return i===null||typeof i!="object"?[]:af.filter(t=>t in i)}function ZQ(i){let t=i?.cubicControls;return{...i,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...i?.springParameters?{springParameters:{...i.springParameters}}:{}}}function QQ(i,t){return Math.abs(i[0]-t[0])<1e-6&&Math.abs(i[1]-t[1])<1e-6}function JQ(i){let t=[];for(let e of ec.groupKeyframes(i)){let n=new Set(e.keyframes.flatMap(s=>dP(s.data.value))),r=n.size?[...n].map(s=>e.keyframes.filter(o=>dP(o.data.value).includes(s))):[e.keyframes];for(let s of r){let o=[...s].sort((a,l)=>a.data.time-l.data.time);for(let a=0;a+1<o.length;a++)t.push({left:o[a],right:o[a+1]})}}return t}function eJ(i){let t=JQ([...i.unproxy()]),e=new Map,n=new Set;for(let{left:s,right:o}of t){let a=s.data.easing?.type,c=(a===void 0?void 0:ec.presetHandles(a))?.control2??(a===5?Jl(o.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!c)continue;let u=e.get(o.id);u?QQ(u,c)||n.add(o.id):e.set(o.id,c)}let r=new Map;for(let{id:s,data:o}of i.unproxy()){let a=o.easing?.type,l=a===void 0?void 0:ec.presetHandles(a);l&&r.set(s,l.control1)}for(let{left:s,right:o}of t)n.has(o.id)&&r.delete(s.id);for(let[s,o]of r){let a=i.data(s);!a?.easing||(a.easing.cubicControls={control1:o,control2:Jl(a.easing.cubicControls?.control2,[1,1])},a.easing.type=5)}for(let{left:s,right:o}of t){if(!r.has(s.id))continue;let a=i.data(o.id),l=e.get(o.id);!a?.easing||!l||(a.easing.cubicControls={control1:Jl(a.easing.cubicControls?.control1,[0,0]),control2:l})}}function YF(i,t){i.scene.objects.traverse((e,n)=>{let r=n;if(!(r.type!=="Page"||!r.timelines))for(let s of Object.values(r.timelines))for(let o of Object.values(s.objectTimelines??{}))t(o.keyframes)})}function hP(i){i.pivot=[0,0,0],i.pivotRotation=[0,0,0]}function tJ(i){}function pP(i){let t=i.schema??0;if(t!==131){if(t>131){console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads ${131}). Update @splinetool/runtime to the latest version to load it correctly.`);return}console.warn("updating from ",t,"to ",131),HF(i,t),t<100&&(i.scene.publish.joystickSizeAndXYOffset===void 0&&(i.scene.publish.joystickSizeAndXYOffset=yo.defaultData.joystickSizeAndXYOffset),i.schema=100),t<101&&(Ua(i,qF),Fa(i,qF),i.schema=101),t<102&&(DQ(i),i.schema=102),t<104&&(i.shared.catelogs=new at,i.shared.lib=ra.defaultData(),i.schema=104),t<105&&(NQ(i),i.scene.objects.traverse((e,n)=>{$F(n)}),i.schema=105);for(let e of Object.values(i.shared.lib.components))KF(e);t<106&&(FQ(i),i.schema=106),t<107&&(i.shared.lib.variables=ra.defaultData().variables,i.schema=107),t<109&&(VQ(i),i.schema=109),t<110&&(zQ(i),i.schema=110),t<111&&(i.scene.objects.traverse((e,n)=>{LQ(n)}),i.schema=111),t<112&&(GQ(i),i.schema=112),t<113&&(jQ(i),i.schema=113),t<114&&(i.scene.publish.settings.web.imageQuality===void 0&&(i.scene.publish.settings.web.imageQuality=70),i.schema=114),t<115&&(HQ(i),i.schema=115),t<116&&(WQ(i),i.schema=116),t<117&&(i.scene.publish.settings.web.pixelRatioMobile===void 0&&(i.scene.publish.settings.web.pixelRatioMobile=0),i.scene.publish.settings.web.pixelRatioDesktop===void 0&&(i.scene.publish.settings.web.pixelRatioDesktop=0),i.schema=117),t<118&&(i.shared.timelineAnimations=Wr({},at.prototype),i.scene.objects.traverse((e,n)=>{QF(n)}),i.schema=118),t<119&&(i.scene.publish.settings.videoStatic.format=gu.defaultData.scene.publish.settings.videoStatic.format,i.scene.publish.settings.videoStatic.imageFormat=gu.defaultData.scene.publish.settings.videoStatic.imageFormat,i.schema=119),t<120&&(i.scene.publish.settings.image.colorSpace="display-p3",i.scene.publish.settings.videoStatic.colorSpace="display-p3",i.schema=120),t<121&&(i.scene.objects.traverse((e,n)=>{hP(n),n.type==="Page"&&n.camera!==void 0&&hP(n.camera)}),i.schema=121),t<122&&(delete i.scene.publish.settings.video,i.scene.publish.orbitControls.rotationSpeed=gu.defaultData.scene.publish.orbitControls.rotationSpeed,i.schema=122),t<123&&(i.scene.objects.traverse((e,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=Ba.defaultData)}),i.schema=123),t<124&&(t>=123&&i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=Ba.defaultData.lighting))}),i.schema=124),t<125&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=Ba.defaultData.lightingIntensity)}),i.schema=125),t<126&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...Ba.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Ba.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),i.schema=126),t<127&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),i.schema=127),t<128&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),i.schema=128),t<129&&(i.scene.objects.traverse((e,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=ta.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),i.schema=129),t<130&&(ZF(i,M1),i.schema=130),t<131&&(YQ(i),XQ(i),YF(i,KQ),YF(i,eJ),i.schema=131)}}var uf,$Q,Ky=F(()=>{X();aP();on();cP();WF();Yy();Kp();mi();w1();Xy();m1();uf=180/Math.PI;$Q=["position","rotation","scale","shape size"]});var eU,_1,fP,tU,A1,tc,Zy,hf,C1,mP,pf,gP,yP,nU,Qy,vP,nc,P1,rU=F(()=>{"use strict";Es();on();mi();(t=>{function i(e){return!0}t.is=i})(eU||(eU={}));(n=>{n.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]};function t(r,s){return{position:s?.position??r.position,rotation:s?.rotation??r.rotation,scale:s?.scale??r.scale,shear:s?.shear??r.shear}}n.merge=t;function e(r,s){return AS({position:Ws.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:Ws.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&Ws.isEqual(r.shear,s.shear)?void 0:s.shear})}n.diff=e})(_1||(_1={}));(t=>t.defaultData={horizontalConstraint:0,verticalConstraint:0})(fP||(fP={}));(t=>t.defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8})(tU||(tU={}));(t=>t.defaultData={opacity:1,fill:{color:Vt.fromHexAndA(wr,1),enabled:!0},stroke:{color:Vt.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Vt.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Vt.from0to1([0,0,0,1]),enabled:!1,spread:0}})(A1||(A1={}));(s=>{function i(o,a){return{name:a}}s.newEmpty=i;function t(o,a){if(a===void 0)return o;let l={...o},c=["width","height","cornerRadius"];for(let u of c)u in l&&u in a&&a[u]!==void 0&&Object.assign(l,{[u]:a[u]});return l}function e(o,a){if(a===void 0)return o;let l={...o};return"fill"in l&&"fill"in a&&a.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...a.fill}}),"stroke"in l&&"stroke"in a&&a.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...a.stroke}}),"layerBlur"in l&&"layerBlur"in a&&a.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...a.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in a&&a.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...a.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in a&&a.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...a.dropShadow}}),"innerShadow"in l&&"innerShadow"in a&&a.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...a.innerShadow}}),l}function n(o,a){if(a===void 0)return o;let l={...o};return Object.assign(l,_1.merge(l,a)),l=t(l,a),l=e(l,a),l}s.patch=n;function r(o,a){let l,c=[];for(let[u,d]of Object.entries(a))u!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},c.push(l)),l.props[u]=d);return c}s.toOps=r})(tc||(tc={}));(t=>t.defaultData={..._1.defaultData,...fP.defaultData,states:new ze,events:new ze,visible:!0,raycastLock:!1})(Zy||(Zy={}));(t=>t.defaultData={...Zy.defaultData,...A1.defaultData})(hf||(hf={}));(t=>t.defaultData={cornerRadius:[0,0,0,0]})(C1||(C1={}));(t=>t.defaultData={...hf.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(mP||(mP={}));(t=>t.defaultData={...hf.defaultData,...C1.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(pf||(pf={}));(t=>t.defaultData={...hf.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"})(gP||(gP={}));(t=>t.defaultData={...hf.defaultData,type:"path2d",path:"",name:"Path"})(yP||(yP={}));(t=>{function i(e){return e.type==="ellipse2d"||e.type==="rectangle2d"||e.type==="text2d"||e.type==="vector2d"||e.type==="path2d"}t.is=i})(nU||(nU={}));(t=>t.defaultData={...Zy.defaultData,name:"Group",type:"group2d"})(Qy||(Qy={}));(t=>t.defaultData=()=>({...Zy.defaultData,...C1.defaultData,...A1.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Vt.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Vt.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(vP||(vP={}));(s=>{function i(o){switch(o){case"rectangle2d":return{...pf.defaultData};case"ellipse2d":return{...mP.defaultData};case"text2d":return{...gP.defaultData};case"vector2d":return{...pf.defaultData};case"path2d":return{...yP.defaultData};case"frame2d":return{...vP.defaultData()};case"group2d":return{...Qy.defaultData}}}s.defaultData=i;function t(o){return"width"in o&&"height"in o?[typeof o.width=="number"?o.width*.5:0,typeof o.height=="number"?o.height*.5:0]:[0,0]}s.getPivot=t;function e(o){return o.type==="rectangle2d"||o.type==="ellipse2d"||o.type==="text2d"||o.type==="frame2d"}s.isResizeable=e;function n(o){return o.type==="frame2d"&&o.autoLayout!==void 0}s.isAutoLayoutable=n;function r(o){return o.type==="rectangle2d"||o.type==="frame2d"}s.hasCorners=r})(nc||(nc={}));(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new Ln},e.emptyData=function(){return{type:"scene2d",objects:new Ln}}))(P1||(P1={}))});var iU=F(()=>{"use strict";uF();hF();DC();NC();aP();AC();OF();GC();$C();m1();Ky();sP();f1();r1();BC();Kp();zC();ZC();Es();Yy();Xy();b1();YC();w1();x1();bF();XC();T1();y1();FC();UC();rU()});function ia(i,t=!1){let e=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new De,c=0;for(let u=0;u<i.length;++u){let d=i[u],h=0;if(e!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),h++}if(h!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[p]===void 0&&(o[p]=[]),o[p].push(d.morphAttributes[p])}if(t){let p;if(e)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(e){let u=0,d=[];for(let h=0;h<i.length;++h){let p=i[h].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+u);u+=i[h].attributes.position.count}l.setIndex(d)}for(let u in s){let d=sU(s[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(let u in o){let d=o[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let h=0;h<d;++h){let p=[];for(let g=0;g<o[u].length;++g)p.push(o[u][g][h]);let f=sU(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(f)}}}return l}function sU(i){let t,e,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=u.itemSize),e!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*e}let o=new t(s),a=new je(o,e,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let d=l/e;for(let h=0,p=u.count;h<p;h++)for(let f=0;f<e;f++){let g=u.getComponent(h,f);a.setComponent(h+d,f,g)}}else o.set(u.array,l);l+=u.count*e}return r!==void 0&&(a.gpuType=r),a}function oU(i,t=1e-4){t=Math.max(t,Number.EPSILON);let e={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],d=["getX","getY","getZ","getW"],h=["setX","setY","setZ","setW"];for(let v=0,b=a.length;v<b;v++){let x=a[v],S=i.attributes[x];l[x]=new S.constructor(new S.array.constructor(S.count*S.itemSize),S.itemSize,S.normalized);let E=i.morphAttributes[x];E&&(c[x]||(c[x]=[]),E.forEach((T,w)=>{let _=new T.array.constructor(T.count*T.itemSize);c[x][w]=new T.constructor(_,T.itemSize,T.normalized)}))}let p=t*.5,f=Math.log10(1/t),g=Math.pow(10,f),m=p*g;for(let v=0;v<s;v++){let b=n?n.getX(v):v,x="";for(let S=0,E=a.length;S<E;S++){let T=a[S],w=i.getAttribute(T),_=w.itemSize;for(let A=0;A<_;A++)x+=`${~~(w[d[A]](b)*g+m)},`}if(x in e)u.push(e[x]);else{for(let S=0,E=a.length;S<E;S++){let T=a[S],w=i.getAttribute(T),_=i.morphAttributes[T],A=w.itemSize,C=l[T],P=c[T];for(let D=0;D<A;D++){let O=d[D],L=h[D];if(C[L](o,w[O](b)),_)for(let U=0,G=_.length;U<G;U++)P[U][L](o,_[U][O](b))}}e[x]=o,u.push(o),o++}}let y=i.clone();for(let v in i.attributes){let b=l[v];if(y.setAttribute(v,new b.constructor(b.array.slice(0,o*b.itemSize),b.itemSize,b.normalized)),v in c)for(let x=0;x<c[v].length;x++){let S=c[v][x];y.morphAttributes[v][x]=new S.constructor(S.array.slice(0,o*S.itemSize),S.itemSize,S.normalized)}}return y.setIndex(u),y}var ff=F(()=>{X()});function rJ(i){let t=1/0,e=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let u=0;u<i.length;u+=3){let d=i[u],h=i[u+1],p=i[u+2];t=Math.min(t,d),e=Math.min(e,h),n=Math.min(n,p),r=Math.max(r,d),s=Math.max(s,h),o=Math.max(o,p)}let a=r-t,l=s-e,c=o-n;return{width:a,height:l,depth:c}}function iJ(i){let{userData:t,data:e}=i,n=e?.groups,r=e?.attributes??{},s=e?.morphAttributes??{},o=e?.interleavedBuffers,a=e?.arrayBuffers,l=e?.index,c;r.position!==void 0&&Array.isArray(r.position.array)&&(c=rJ(r.position.array));let u={...t===void 0?{}:t.parameters,data:{attributes:r,morphAttributes:s,interleavedBuffers:o,arrayBuffers:a},...c===void 0?{}:c,type:"NonParametricGeometry"};return l!==void 0&&Object.assign(u.data,{index:l}),n!==void 0&&Object.assign(u.data,{groups:n.map(d=>({...d,materialIndex:d.materialIndex??0}))}),u}function lU(i){let t=i.points.length/7,e=new ze;for(let n=0;n<t;n++){let r=n*7,s=i.points[r+0],o=i.points[r+1],a=i.points[r+2],l=i.points[r+3],c=i.points[r+4],u=i.points[r+5],d=i.points[r+6];e.push({fi:n,id:xe.generateUUID(),data:{roundness:d,position:[s,o],areControlsDirectionsMirrored:!0,controlPrevious:{position:[a,l]},controlNext:{position:[c,u]}}})}return{points:e,isClosed:i.isClosed,roundness:i.roundness,shapeHoles:i.shapeHoles?.map(n=>lU(n))??[]}}function bP(i){let{userData:t,uuid:e,...n}=i;if(t===void 0||t.type==="NonParametricGeometry")return iJ(i);if(t.type==="SubdivGeometry"){let o="SubdivGeometry",a=n.data?.attributes;if(a?.positionWASM===void 0){let c=new De;if(a?.position===void 0||a?.faceMap===void 0)return null;let u=a.position.array,d=a.faceMap.array,h=n.data.index.array;c.setAttribute("position",new Ve(u,3)),c.setIndex(new Us(h,1));let p=oU(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(g[d[y]]++,f.push(...new Set(m.slice(3*y,3*y+6))),y+=2):(f.push(...m.slice(3*y,3*y+3)),y++);a.indexWASM={array:f},a.positionWASM=p.attributes.position,a.verticesPerFaceWASM={array:g}}if(a?.positionWASM===void 0||a?.positionWASM.length===0||a?.indexWASM===void 0||a?.indexWASM.length===0||a?.verticesPerFaceWASM===void 0||a?.verticesPerFaceWASM.length===0)return null;let l={type:o,...sJ(a.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let c in a)c==="positionWASM"?l[c]=new Float32Array(a[c].array):c==="indexWASM"?l[c]=new Int32Array(a[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(a[c].array));return l.scaleBaked=[1,1,1],l}let r=t.type,s=t.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:lU(t.shape),type:r}):r==="LatheGeometry"?{...t.parameters,type:r,points:(t?.parameters.points??[]).map(o=>[o.x,o.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function sJ(i){return aU.setFromArray(i),aU.getSize(I1),{width:I1.x,height:I1.y,depth:I1.z}}var ybe,vbe,bbe,xbe,Sbe,aU,I1,cU=F(()=>{on();X();ff();ybe=new ne,vbe=new qe,bbe=new qt,xbe=new M,Sbe=new M,aU=new Nt,I1=new M});var uU=F(()=>{"use strict"});var _be,dU=F(()=>{"use strict";on();Ky();_be={...zy,updateSchema(i){return(i.schema??0)<131?lu(i,pP):(i.schema??0)-131},asyncKeys(){return[]}}});var Pbe,Ibe,hU=F(()=>{"use strict";Kp();Pbe=new Set(["type","category","visible","noiseType","isMask","bumpMap","roughnessMap",...$p]),Ibe=new Set(c1)});var pt=F(()=>{iU();uU();RF();Ky();dU();cP();hU();T1();on()});function pU(i){for(let t of oJ)i.enable(t)}var oJ,ls,mf,fU,ka=F(()=>{oJ=[3,4,8,9];ls=5,mf=3,fU=32});var Va,gf=F(()=>{"use strict";X();Va=i=>{var t;return t=class extends i{},t.geometryHelper=new ni(30,30,30),t}});var O1,xP,mU,za,yf=F(()=>{"use strict";X();O1=new Hi,xP=new nr,mU=new ne,za=(i,t,e,n,r=!1,s=i)=>{let o=t,a=s.matrixWorld;if(o.boundingSphere===null&&o.computeBoundingSphere(),xP.copy(o.boundingSphere),xP.applyMatrix4(a),e.ray.intersectsSphere(xP)===!1||(mU.copy(a).invert(),O1.copy(e.ray).applyMatrix4(mU),o.boundingBox!==null&&O1.intersectsBox(o.boundingBox)===!1))return;let l,c,u,d,h=o.index,p=o.attributes.position,f=o.drawRange,g,m;if(r===!1){let v=Math.max(0,f.start),b=Math.min(h.count,f.start+f.count);for(g=v,m=b;g<m;g+=3)if(c=h.getX(g),u=h.getX(g+1),d=h.getX(g+2),l=y(i,e,O1,p,c,u,d),l){l.faceIndex=Math.floor(g/3),n.push(l);return}}else{let b=o.attributes.position,x=new M,S=new M,E=new M,T=new M,w=2,A=1/((s.scale.x+s.scale.y+s.scale.z)/3),C=A*A,P=Math.max(0,f.start),D=Math.min(b.count,f.start+f.count);for(let O=P,L=D-1;O<L;O+=w){if(x.fromBufferAttribute(b,O),S.fromBufferAttribute(b,O+1),O1.distanceSqToSegment(x,S,T,E)>C)continue;T.applyMatrix4(s.matrixWorld);let G=e.ray.origin.distanceTo(T);G<e.near||G>e.far||n.push({distance:G,point:E.clone().applyMatrix4(s.matrixWorld),object:i})}}function y(v,b,x,S,E,T,w){let _=new M,A=new M,C=new M,P=new M,D=new M;if(_.fromBufferAttribute(S,E),A.fromBufferAttribute(S,T),C.fromBufferAttribute(S,w),x.intersectTriangle(_,A,C,!1,P)===null)return null;D.copy(P),D.applyMatrix4(v.matrixWorld);let L=b.ray.origin.distanceTo(D);return L<b.near||L>b.far?null:{faceIndex:1,distance:L,point:D.clone(),object:v}}}});var aJ,gU,lJ,yU,xo,Jy=F(()=>{"use strict";X();gf();yf();aJ=new M(1,1,1),gU=new M,lJ=new M,yU=new qe,xo=class extends Va(gy){constructor(e,n=15){super(n);this.object=e;this.dummy=new Bs;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,n){za(this.object,xo.geometryHelper,e,n,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(gU,yU,lJ),this.matrix.compose(gU,yU,aJ),super.updateMatrixWorld(e)}updateWorldMatrix(e,n){}}});var Gd,jd,yu,bU,cJ,uJ,vU,ev,xU=F(()=>{"use strict";X();Gd=new M,jd=new M,yu=new ne,bU=[new M(-1,1,1),new M(-1,-1,1),new M(1,-1,1),new M(1,1,1),new M(-1,1,-1),new M(-1,-1,-1),new M(1,-1,-1),new M(1,1,-1)],cJ=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],uJ=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],vU=(i,t,e)=>{i.updateEntityBoxSize(Gd,jd),yu.copy(t).multiply(i.matrixWorld),jd.x===0&&jd.y===0&&jd.z===0?e.push(new M(Gd.x,Gd.y,Gd.z).applyMatrix4(yu)):bU.forEach(n=>{e.push(n.clone().multiply(jd).add(Gd).applyMatrix4(yu))})},ev=class extends Nt{constructor(){super(...arguments);this.matrix=new ne;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(n=>n.clone()),this.faces=e.faces.map(n=>n.clone()),this.edges=e.edges.map(n=>n.clone()),this.centerEdges=e.centerEdges.map(n=>n.clone()),this}setFromObjectSize(e,n=!1){e.updateWorldMatrix(!1,n),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let r=new ne().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,n)}expandByObjectSize(e,n,r=!1){let s=[];if(r===!0){let o=[];e.traverseEntity(a=>{if(a.visible||a.cloner&&a.data.visible){if(!("geometry"in a)){yu.copy(n).multiply(a.matrixWorld),o.push(new M().applyMatrix4(yu));return}vU(a,n,s)}}),s.length===0&&s.push(...o)}else vU(e,n,s);return this.setFromPoints(s)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(yu.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(jd).multiplyScalar(.5),this.getCenter(Gd),yu.copy(this.matrix).setPosition(Gd),this.vertices=bU.map(e=>e.clone().multiply(jd).applyMatrix4(yu))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=cJ.map(([e,n])=>new ri(this.vertices[e],this.vertices[n])),this.centerEdges=this.edges.map(e=>e.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=uJ.map(([e,n])=>this.vertices[e].clone().add(this.vertices[n]).multiplyScalar(.5))}}});var So,tv=F(()=>{"use strict";So={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function vu(i){return i?.isParticleSystem===!0}function sa(i){return i?.isHairSystem===!0}function Ts(i){return i?.isShapeBlendEntity===!0}function Hd(i){return i?.isPathObject===!0}function Pr(i){return i?.isObject2D===!0}function yr(i){return i?.isUIObject===!0}function SU(i){return typeof i=="object"&&i!==null&&"booleanOp"in i}function rc(i){return i?.isCloner===!0}function Ga(i){return i?.isClone===!0}function vf(i){return i?.isComponentObject===!0}var pr=F(()=>{});function Mt(i){EU.add(i)}function TU(i){return EU.has(i)}function Jn(i,t){let e=`${i}:${t}`;wU.has(e)||wU.add(e)}function Wd(i,t){MU.set(i,t)}function D1(i){return MU.get(i)}function wo(i,t){_U.set(i,t)}function L1(i){return _U.get(i)}function nv(i,t){AU.set(i,t)}function N1(i){return AU.get(i)}function CU(i){wP=i,SP!==null&&i.setHanaUIWasmUrl(SP)}function PU(i){SP=i,wP?.setHanaUIWasmUrl(i)}function rv(){return wP}var EU,wU,MU,_U,AU,wP,SP,Qt=F(()=>{EU=new Set;wU=new Set;MU=new Map,_U=new Map;AU=new Map;wP=null,SP=null});function IU(i){let t=i.elements;ja.set(t[0],t[1],t[2]),Ha.set(t[4],t[5],t[6]),ic.set(t[8],t[9],t[10])}function hJ(i,t){i.set(1,0,0).cross(t),i.lengthSq()<=F1&&i.set(0,1,0).cross(t),i.normalize()}function RU(){let i=Math.max(ja.lengthSq(),Ha.lengthSq(),ic.lengthSq());ja.lengthSq()>F1*i?Eo.copy(ja).normalize():Eo.set(1,0,0),To.crossVectors(ic,Eo),To.lengthSq()<=F1*i&&(To.copy(Ha).addScaledVector(Eo,-Ha.dot(Eo)),To.lengthSq()<=F1*i&&hJ(To,Eo)),To.normalize(),bf.crossVectors(Eo,To)}function pJ(){let i=ja.length(),t=Ha.length(),e=ic.length(),n=Math.max(i,t,e);if(n-i>B1||n-t>B1||n-e>B1)return!0;let r=B1*n*n;return Math.abs(ja.dot(Ha))>r||Math.abs(ja.dot(ic))>r||Math.abs(Ha.dot(ic))>r}function OU(i,t,e){return IU(i),RU(),t.makeBasis(Eo,To,bf),e.set(Eo.dot(ja),Eo.dot(Ha),Eo.dot(ic),0,To.dot(ja),To.dot(Ha),To.dot(ic),0,bf.dot(ja),bf.dot(Ha),bf.dot(ic),0,0,0,0,1),pJ()}function EP(i){return IU(i),RU(),dJ.makeBasis(Eo,To,bf)}var ja,Ha,ic,Eo,To,bf,dJ,F1,B1,TP=F(()=>{"use strict";X();ja=new M,Ha=new M,ic=new M,Eo=new M,To=new M,bf=new M,dJ=new ne,F1=1e-12,B1=.01});var MP,sc,xf,Sf=F(()=>{"use strict";X();TP();MP=new ne;(t=>{function i(e){return e&&e.__isSPEObject}t.is=i})(sc||(sc={}));xf=i=>class extends i{constructor(){super(...arguments);this.previousModelViewMatrix=new ne;this.copyPreviousMatrix=!0;this.hiddenMatrix=new ne;this.pivotMatrix=new ne;this.matrixWorldRigid=new ne;this.shearScale=new ne;this.shearScaleInv=new ne}get __isSPEObject(){return!0}getPhysicsLocalMatrix(n){return this.rigidBody?.isDynamic()?(n.copy(this.matrixWorld),this.hasNonUniformScale&&n.multiply(this.shearScaleInv),this.parent&&n.premultiply(MP.copy(this.parent.matrixWorld).invert()),n.premultiply(MP.copy(this.hiddenMatrix).invert()),n.multiply(MP.copy(this.pivotMatrix).invert()),!0):!1}isDescendantOf(n){n instanceof Zt&&(n=n.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===n)return!0;r=r.parent}return!1}updateMatrixWorld(n){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,n=!0);for(let r of this.children)r.updateMatrixWorld(n)}updateWorldMatrix(n,r){let s=this.parent;if(n&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),r)for(let o of this.children)o.updateWorldMatrix(!1,!0)}traverseChildren(n,r=0){for(let s of this.children)sc.is(s)&&s.traverseObject(n,r+1)}traverseObject(n,r=0){if(n(this,r)!==!0)for(let o of this.children)sc.is(o)&&o.traverseObject(n,r+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=OU(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(n,r){this.updateWorldMatrix(!0,!1);let s=new ne().copy(this.matrixWorld).invert();return n.parent!==null&&(n.parent.updateWorldMatrix(!0,!1),s.multiply(n.parent.matrixWorld)),"hiddenMatrix"in n&&n.hiddenMatrix instanceof ne?n.hiddenMatrix.premultiply(s):n.applyMatrix4(s),n.updateWorldMatrix(!1,!1),this.add(n),r!==void 0&&(this.children.pop(),this.children.splice(r,0,n)),this}copy(n,r=!1){return super.copy(n,r),this.hasNonUniformScale=n.hasNonUniformScale,this}onAfterRender(n,r,s,o,a,l){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function NU(i,t,e){return qd.subVectors(t,i),k1.subVectors(t,e),qd.cross(k1).length()<=U1}function V1(i){let t=BU.get(i.points);if(t!==void 0&&t.isClosed===i.isClosed)return t.curve;let e=fJ(i);return BU.set(i.points,{isClosed:i.isClosed,curve:e}),e}function fJ(i){let t=i.points,e=[t[0]],n=[new M(...t[0].data.position)];wf.copy(n[0]);for(let f=0;f<t.length-1;f++)qd.fromArray(t[f].data.position),k1.fromArray(t[f+1].data.position),iv.subVectors(qd,wf),sv.subVectors(qd,k1),iv.cross(sv).length()>U1&&(e.push(t[f]),n.push(new M().copy(qd)),wf.copy(qd));let r=t[t.length-1];e.push(r),n.push(new M(...r.data.position));let s=i.isClosed,o=e.length-(s?0:1),a=e.length,l=[],c=[];for(let f=0;f<a;f++){let g=e[f].data;l.push(new M(...g.controlPrevious.position)),c.push(new M(...g.controlNext.position))}let u=[];for(let f=0;f<o;f++){let g=f===a-1?0:f+1;u.push(NU(n[f],c[f],n[g])&&NU(n[f],l[g],n[g]))}let d=[];for(let f=0;f<a;f++){let g=e[f].data,m=n[f],y={position:m,prevDir:void 0,nextDir:void 0,controlPrevious:l[f],controlNext:c[f],tan:void 0,baseRoundness:g.roundness,removedLength:0};if(d.push(y),g.roundness===0||!s&&(f===0||f===a-1))continue;let v=s&&f==0?a-1:f-1,b=s&&f==a-1?0:f+1,x=new M().subVectors(n[v],m).normalize(),S=new M().subVectors(n[b],m).normalize();y.prevDir=x,y.nextDir=S;let E=u[s&&f===0?a-1:f-1],T=u[f];if(E&&T){Ef.addVectors(x,S).normalize();let w=wf.crossVectors(Ef,x).length()/x.dot(Ef);y.tan=w,y.removedLength=g.roundness/w}}for(let f=0;f<o;f++){let g=f,m=s&&f===a-1?0:f+1,y=d[g],v=d[m];if(y.removedLength!==0||v.removedLength!==0){let b=y.position.distanceTo(v.position);y.removedLength=Math.min(y.removedLength,b/2),v.removedLength=Math.min(v.removedLength,b/2)}}let h=new Array(2*a).fill(null);for(let f=0;f<o;f++){let g=f,m=s&&f===a-1?0:f+1,y=d[g],v=d[m],b=null;if(!u[f])y.position.distanceTo(v.position)>U1&&(b=new $c(y.position,y.controlNext,v.controlPrevious,v.position));else{let x=y.position.clone(),S=v.position.clone();(y.removedLength!==0||v.removedLength!==0)&&(y.nextDir&&x.add(wf.copy(y.nextDir).setLength(y.removedLength)),v.prevDir&&S.add(wf.copy(v.prevDir).setLength(v.removedLength))),x.distanceTo(S)>U1&&(b=new $c(x,x.clone().lerp(S,.3),S.clone().lerp(x,.3),S))}h[2*f+1]=b}for(let f=0;f<a;f++){let g=d[f];if(g.removedLength===0)continue;let m=g.position,y=g.prevDir.clone().multiplyScalar(g.removedLength).add(m),v=g.nextDir.clone().multiplyScalar(g.removedLength).add(m),b=g.tan*g.removedLength;Ef.addVectors(g.prevDir,g.nextDir).normalize(),iv.copy(y).lerp(v,.5);let x=y.distanceTo(v)/2;LU.copy(Ef).multiplyScalar(Math.sqrt(Math.pow(b,2)-Math.pow(x,2))).add(iv),_P.copy(Ef).multiplyScalar(-b).add(LU);let S=m.distanceTo(_P)/m.distanceTo(iv);sv.copy(g.prevDir).multiplyScalar(S*m.distanceTo(y)).add(m),DU.copy(sv).lerp(_P,2);let E=y.clone().lerp(sv,4/3),T=v.clone().lerp(DU,4/3);h[2*f]=new $c(y,E,T,v)}let p=new AP;for(let f=0;f<h.length;f++){let g=h[f];g&&p.add(g)}return p}var AP,U1,qd,k1,wf,Ef,iv,_P,sv,DU,LU,BU,CP=F(()=>{"use strict";X();AP=class extends up{constructor(){super()}getPoints(t=12){let e=[],n,r=this.getCurveLengths(),o=r[r.length-1]/r.length;for(let a=0,l=this.curves;a<l.length;a++){let c=l[a],u=a===0?r[a]:r[a]-r[a-1],d=Math.ceil(t*u/o),h=c.getPoints(d);for(let p=0;p<h.length;p++){let f=h[p];n&&n.equals(f)||(e.push(f),n=f)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}},U1=.001,qd=new M,k1=new M,wf=new M,Ef=new M,iv=new M,_P=new M,sv=new M,DU=new M,LU=new M;BU=new WeakMap});var Ot,Wa,mJ,gJ,ov,FU,PP,IP,yJ,UU,kU,Tf,Xi=F(()=>{"use strict";X();pt();xU();on();tv();pr();Qt();Sf();CP();gn();(t=>{function i(e){return e&&e.__isEntity}t.is=i})(Ot||(Ot={}));Wa=i=>Ot.is(i),mJ={type:"completeState",isfromEntity:!0},gJ=["x","y","z"],ov=new M,FU=new M(1,1,1),PP=new qe,IP=new qt,yJ=new M().set(0,1,0),UU=new ne,kU=new ne,Tf=i=>class extends xf(i){constructor(){super(...arguments);this.raycastLock=!1;this.scaleLock=!1;this.disposed=!1;this.stateSelection=null;this.destroyedInAction=!1;this.instances=[];this.prevState=null;this.currentState=null;this.currentAnimationAction=null;this.reversibleToState=null;this.transitionState={settled:!0,state:null};this.currentTransitionEvent=null;this.previousAction=null;this._singleBBox=new ev;this._recursiveBBox=new ev;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this._needApplyPathSnapping=!0;this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(n){let r=this.children[n];if(Ot.is(r))return r}entityChildrenCount(){let n=this.children.length;for(;n--;)if(Ot.is(this.children[n]))return n+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let n=this;for(;n.data.type!=="Instance";){let r=n.parent;if(Ot.is(r))n=r;else return}return n}forInstancesRec(n){this.instances.forEach(r=>{r.disposed||n(r),r.forInstancesRec(n)})}super_Entity(n,r){typeof n=="string"&&(this.uuid=n),this.identity=n,this.data=r,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(n,r,s=!1){if(!(this.data.states.length===0&&!s)){for(let o of this.data.states)na.toOps(this.data,o.data).forEach(l=>{let c=jp.replaceProps(l,this.data);this.dataPatched=this.data,this.updateByPatchedOp(c,this.data,r)});if(n!==null){let o=this.data.states.data(n);o&&(this.dataPatched=na.patch(this.data,o),na.toOps(this.data,o).forEach(l=>{this.updateByPatchedOp(l,this.dataPatched,r)}))}s&&this.updateTransformState(this.dataPatched,r),this.stateSelection=n,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(n,r){n.setScalar(0),r.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(n=>{Wa(n)&&n.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(n=>{n.resetBBoxNeedsUpdateSelf()})}find(n){let r;return this.traverseEntity(s=>{s.uuid===n&&(r=s)}),r}traverseSortNextHelper(){let n=this.parent;if(n){let r=n.children,s=r.indexOf(this)+1;if(Ot.is(r[s]))return r[s];if(Ot.is(n))return n.traverseSortNextHelper()}}sortNext(){let n=this.children;return this.children.length>0&&Ot.is(this.children[0])?n[0]:this.traverseSortNextHelper()}goUp(n){let r=this;for(;n>0&&r!==null;)r=r.parent,n-=1;return r}hasAnccestorOrSelf(n){return this===n||this.hasAnccestor(n)}hasAnccestor(n){let r=this.parent;for(;r;){if(n===r)return!0;r=r.parent}return!1}countToAccestor(n){let r=0,s=this;for(;s!==n;){if(s===null)return-1;s=s.parent,r+=1}return r}forEachEntity(n){for(let r of this.children)Wa(r)&&n(r)}traverseEntityAncestors(n){this.traverseAncestors(r=>{Ot.is(r)&&n(r)})}traverseConcreteEntity(n,r=0){if(n(this,r)!==!0)for(let o of this.children)Wa(o)&&o.isConcreteEntity&&o.traverseEntity(n,r+1)}traverseEntity(n,r=0){if(n(this,r)!==!0)for(let o of this.children)Wa(o)&&o.traverseEntity(n,r+1)}traverseVisibleEntity(n){n(this);for(let r of this.children)Wa(r)&&r.visible&&r.traverseVisibleEntity(n)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(n){super.updateMatrixWorld(n),this.dispatchEvent({type:"updateMatrixWorld"})}copy(n,r=!1){return super.copy(n,r),this.dataPatched=n.dataPatched,this.raycastLock=n.raycastLock,this.scaleLock=n.scaleLock,this.hiddenMatrix.copy(n.hiddenMatrix),this}hasEntityChild(){return this.children.some(n=>Wa(n))}isAncestorOf(n){if(this.uuid===n)return!1;let r=!1;return this.traverseEntity(s=>{s.uuid===n&&(r=!0)}),r}toObjectTransformState(n=[]){this.updateWorldMatrix(!0,!1);let r={position:this.position.toArray(),rotation:[this.rotation.x*xe.RAD2DEG,this.rotation.y*xe.RAD2DEG,this.rotation.z*xe.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return Ny(r,n)}getTransformValues(n,r,s){return r[n].map((o,a)=>s?.shared.getVariable(o,[this.uuid,n,gJ[a]])??o)}updateTransformState(n,r){let s=!1;if(n.position&&(this.position.fromArray(this.getTransformValues("position",n,r)),s=!0),n.rotation&&(ov.fromArray(this.getTransformValues("rotation",n,r)).multiplyScalar(xe.DEG2RAD),this.rotation.setFromVector3(ov),s=!0),n.scale&&(this.scale.fromArray(this.getTransformValues("scale",n,r)),s=!0),n.hiddenMatrix!==void 0&&(s=!0,this.hiddenMatrix.fromArray(n.hiddenMatrix??hu.identity)),n.pivot!==void 0||n.pivotRotation!==void 0){if(s=!0,n.pivot!==void 0&&n.pivotRotation!==void 0)this.pivotMatrix.compose(ov.fromArray(n.pivot).negate(),PP.setFromEuler(IP.fromArray(n.pivotRotation.map(o=>o*xe.DEG2RAD))).invert(),FU);else if(n.pivot!==void 0)this.pivotMatrix.setPosition(-n.pivot[0],-n.pivot[1],-n.pivot[2]);else if(n.pivotRotation!==void 0){let o=ov.setFromMatrixPosition(this.pivotMatrix);PP.setFromEuler(IP.fromArray(n.pivotRotation.map(a=>a*xe.DEG2RAD))).invert(),this.pivotMatrix.compose(o,PP,FU)}}return s&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(o=>{o.invalidateClonerTransform(this)})),n.position&&n.rotation&&n.scale&&n.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),s}onVariableUpdate(n=!1){if(n){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)}),this.requestRender()}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let n of this.children)Ot.is(n)&&n.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(n=>{Ot.is(n)&&n.disposeRecursively()})}toState(n=[]){let r={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(n)};return Ny(r,n)}updateByObjUpdateOp(n,r){n!==void 0&&this.updateByOp({type:0,props:n,path:[]},{...this.data,...n},r,!1)}updateByOp(n,r,s,o){let a=this.data;this.data=r;let l=n,c=$t(n.path,["states","*"]);if(c!==null){if(n.type===0){let[u]=c;if(this?.stateSelection===u){let d={...n.props};if(delete d.name,Object.values(n.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let p=rr.zoom(h,n.path.slice(2));if(p)for(let f in n.props)n.props[f]===void 0&&f in p&&(d[f]=p[f])}}l={...n,props:d,path:n.path.slice(2)}}}}else if(n.type===0){let u=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(u!==void 0){if(n.props.name!==void 0&&u.name){let{name:h,...p}=u;u=p}if(n.props.material!==void 0&&"material"in u){let{material:h,...p}=u;u=p}let d=rr.removeOverridden(n.path,n.props,u);l={...n,props:d}}}if(this.updateByPatchedOpBase(l,na.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),s),$t(n.path,["overrides"])){let u=[],d=[...n.path];for(u.push(d[1]),d.splice(0,2);d.length>0&&d[0]==="descendants";)u.push(d[1]),d.splice(0,2);if(u[u.length-1]===void 0){if(n.type===0)for(let h of Object.keys(n.props)){u[u.length-1]=h;let p=s.scene.findInstance([this.uuid,...u]);p&&(p.overrideData=n.props[h],p.updateState(Da.apply(p.component.data,p.overrideData),s))}}else{let h=s.scene.findInstance([this.uuid,...u]);if(h){let p=rr.zoom(h.component.data,d);if(n={...n,path:d},n.type===0){let f=n.props;if(p)for(let[g,m]of Object.entries(n.props))m===void 0&&(f===n.props&&(f={...n.props}),f[g]=p[g]);n={...n,props:f}}h.overrideData=rf.resolve(r.overrides,u),h.updateByOp(n,Sr.applySimple(h.data,n),s,!1)}}}else if(this.instances.length>0){let u;if(n.path.length===0&&n.type===0){let d;for(let h of go.rootOverrideProps)h in n.props&&(d===void 0&&(d={}),d[h]=n.props[h]);d&&(u={...n,props:d})}else for(let d of go.rootOverrideProps)if($t(n.path,[d])){u=n;break}u!==void 0&&this.instances.forEach(d=>{if(d.isInstanceRoot){let h=Da.filterOp(d.overrideData,u);h&&d.updateByOp(h,Sr.applySimple(d.data,h),s,!0)}}),this.instances.forEach(d=>{if(!d.isInstanceRoot){let h=Da.filterOp(d.overrideData,n);if(h){let p;a===d.data&&n===h?p=r:p=Sr.applySimple(d.data,h),d.updateByOp(h,p,s,!0)}}})}}updateByPatchedOpBase(n,r,s){if(this.dataPatched=r,n.path.length===0&&n.type===0)n.props.type!==void 0&&!Jo.is(n.props.type)&&So.changeEntityProptotype(this,r,s);else if(n.path.length===1&&n.path[0]==="geometry"&&n.type===0&&"type"in n.props){So.changeEntityProptotype(this,r,s);for(let o of this.children)Ot.is(o)&&o.updateVisible(s.scene)}this.updateByPatchedOp(n,r,s)}updateByPatchedOp(n,r,s){if(n.path.length===0&&n.type===0?this.updateState(n.props,s):n.type===0&&("resolutionLevel"in n.props||"useChildrenColors"in n.props)&&this.updateState(r,s),n.path[0]==="morphTargetInfluences"&&n.type===0){let a=r.morphTargetInfluences.get(n.path[1])?.data.name;a&&this.updateMorphInfluences(a,s.shared.getVariable(n.props.value,[this.uuid,"morphTargetInfluences",a]))}if($t(n.path,["pathSnapping"])!==null&&this.updatePathSnapping(r.pathSnapping),$t(n.path,["cloner"])!==null){let o=Sr.drop(n,1);o.path.length===0&&o.type===0&&o.props.disabled===!0?this.setFromClonerState(null,s):this.cloner?this.cloner.updateState(r.cloner,s):(this.setFromClonerState(r.cloner,s),this.expandCloner(s)),this.updateVisible(s.scene)}}updatePathSnapping(n=this.dataPatched.pathSnapping){this._updatedPathSnapping=n,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(n){if(this._needApplyPathSnapping===!1)return;let r=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,s=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,o=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(r===null)return;let l=n.find(r);if(!l)return;this._needApplyPathSnapping=!1;let c=l.data;if(c.geometry.path.points.length<=1)return;let u=V1(c.geometry.path),d=(s+o)%1;s+o===1&&d===0&&(d=1);let h=null;try{h=u.curves.length?u.getPointAt(d):null}catch(g){!1&&(console.warn(`The aligned path on ${this.name} is invalid. (${l.name})`),console.error(g))}if(h===null)return;l.updateMatrixWorld();let p=this.parent?UU.copy(this.parent.matrixWorld).invert():UU.identity();p.multiply(l.matrixWorld),h.applyMatrix4(p);let f={position:h.toArray(),rotation:c.rotation};if(a==="tangential"){let g=kU.extractRotation(l.matrixWorld),m=u.getTangentAt(d).applyMatrix4(g).add(h),y=kU.lookAt(h,m,yJ),v=ov.setFromEuler(IP.setFromRotationMatrix(y)).multiplyScalar(xe.RAD2DEG);f={...f,rotation:v.toArray()}}this.updateTransformState(f),this.traverseEntity(g=>{g._cameraType&&g.dispatchEvent(mJ)})}updateVisible(n){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!n)return;let r=!1;this.traverseEntity(s=>{if(s.data.type==="Splat")return r=!0,!0}),r&&n.reloadSplats()}updateState_Entity(n,r){n.name!==void 0&&(this.name=n.name),n.raycastLock!==void 0&&(this.raycastLock=n.raycastLock),n.visible!==void 0&&(this.updateVisible(r?.scene),this.resetBBoxNeedsUpdate()),r&&"cloner"in n&&n.cloner!==void 0&&(this.setFromClonerState(n.cloner,r),this.updateVisible(r.scene)),this.updateTransformState(n,r)}get attachedSurfaceCloners(){return this.children.filter(n=>rc(n)&&n.parameters.type==="toObject")}setFromClonerState(n,r){if(!this.disposed)if(n===null||n.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(So.Cloner===null){Jn("cloners","a cloner");return}this.cloner=new So.Cloner(this,n),r.scene.addPendingExpandCloner(this)}else this.cloner.updateState(n,r)}expandCloner(n){!this.disposed&&this.cloner&&this.cloner.expandClones(n)}invalidateClonerTransform(n){this.cloner&&this.cloner.invalidateTransform(n)}requestRender(){this.dispatchEvent({type:"requestRender"})}}});var z1,Mo,bu=F(()=>{"use strict";X();Xi();(t=>t.is=e=>"objectHelper"in e)(z1||(z1={}));Mo=(i,t)=>class extends Tf(i){constructor(){super(...arguments);this.objectHelper=new t(this);this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(r,s){this.objectHelper.raycast(r,s)}showGizmos(){for(let r in this.gizmos){let s=this.gizmos[r];s instanceof jl&&(s.visible=!0)}}updateEntityBoxSize(r,s){this.objectHelper.visible&&this.geometryHelper instanceof ni?(r.setScalar(0),s.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(r,s)}hideGizmos(){for(let r in this.gizmos){let s=this.gizmos[r];s instanceof jl&&(s.visible=!1)}}}});var cs,av=F(()=>{"use strict";X();Jy();bu();cs=class extends Mo(Bs,xo){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function oa(i,t,e,n,r,s,o){G1.set(r,s,o).unproject(n);let a=t[i];if(a!==void 0){let l=e.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],G1.x,G1.y,G1.z)}}var G1,_o,RP,j1,VU=F(()=>{"use strict";X();gf();yf();G1=new M,_o=new xs,RP=class extends Nl{constructor(e){let n=new De,r=new ks({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Ze(15711266),c=new Ze(15711266),u=new Ze(2857471);d("n1","n2",l),d("n2","n4",l),d("n4","n3",l),d("n3","n1",l),d("f1","f2",l),d("f2","f4",l),d("f4","f3",l),d("f3","f1",l),d("n1","f1",l),d("n2","f2",l),d("n3","f3",l),d("n4","f4",l),d("p","n1",c),d("p","n2",c),d("p","n3",c),d("p","n4",c),d("u1","u2",u),d("u2","u3",u),d("u3","u1",u);function d(p,f,g){h(p,g),h(f,g)}function h(p,f){s.push(0,0,0),o.push(f.r,f.g,f.b),a[p]===void 0&&(a[p]=[]),a[p].push(s.length/3-1)}n.setAttribute("position",new Ve(s,3)),n.setAttribute("color",new Ve(o,3));super(n,r);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,n=this.pointMap,r=!0;_o.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=r?.8:1e-4;oa("n1",n,e,_o,-s,-o,a),oa("n2",n,e,_o,s,-o,a),oa("n3",n,e,_o,-s,o,a),oa("n4",n,e,_o,s,o,a);let l=a;oa("f1",n,e,_o,-s,-o,l),oa("f2",n,e,_o,s,-o,l),oa("f3",n,e,_o,-s,o,l),oa("f4",n,e,_o,s,o,l);let c=l,u=.5;oa("u1",n,e,_o,s*.7*u,o*1.1,c),oa("u2",n,e,_o,-s*.7*u,o*1.1,c),oa("u3",n,e,_o,0,o*(1.1+.9*u),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};j1=class extends Va(RP){constructor(e){super(e);this.object=e;this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,n){za(this.object,this.geometry,e,n,!0)}}});function zU(i){return 1-Math.pow(1-i,3)}var H1,Mf,OP,DP,LP,lv,NP,qa,hn,Xs=F(()=>{"use strict";X();VU();pt();bu();gn();H1=790;Mf=new M,OP=new M,DP=new qe,LP=new M,lv=new M,NP=new M,qa=class extends Mo(xs,j1){constructor(e="",n={...Vd.defaultData,name:""}){super();this._cameraType="OrthographicCamera";this.targetOffset=ea.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.wasMovedByUser=!1;this.wasMovedBySwitchCameraAction=!1;this._createdAt=typeof performance<"u"?performance.now():0;this._tickProjectionTransition=()=>{let e=this._projectionTransition;if(e===void 0)return;if(this.disposed){this._endProjectionTransition();return}e.raf=requestAnimationFrame(this._tickProjectionTransition);let n=qa.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),n?.()};this.super_Entity(e,n),this.previousProjectionMatrix=new ne,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,s=this.height;this.orthoCamera=new Yo(r*-.5,r*.5,s*.5,s*-.5,-5e4,1e4),this.perspCamera=new Xo(45,r/s,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(e){let n=qa.projectionTransitionsEnabled;qa.projectionTransitionsEnabled=!1;try{return e()}finally{qa.projectionTransitionsEnabled=n}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,n){e==="PerspectiveCamera"?this.perspCamera.near=n:this.orthoCamera.near=n}setZoom(e,n){n>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=n:this.orthoCamera.zoom=n)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,n,r){typeof e=="number"&&(e=new M(e,n,r)),super.lookAt(e),this.getWorldPosition(Mf),this.targetOffset=Mf.distanceTo(e)}getTarget(e=new M){return this.getWorldDirection(OP),this.getWorldPosition(Mf),OP.multiplyScalar(this.targetOffset),e.copy(Mf).add(OP),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Mf),Mf.distanceTo(e)}updateUp(){this.getWorldQuaternion(DP),LP.set(0,0,1).applyQuaternion(DP),lv.copy(Zt.DEFAULT_UP),this.isUpVectorFlipped&&lv.negate(),lv.applyQuaternion(DP),NP.copy(Zt.DEFAULT_UP).projectOnPlane(LP),this.angleOffsetFromUp=NP.angleTo(lv),this.angleOffsetFromUp*=NP.cross(lv).dot(LP)>=0?1:-1}updateTransformState(e,n){let r=super.updateTransformState(e,n);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(e){let n=e.getWorldPosition(new M),s=e.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:n.clone().add(s),target:n}}getViewToTarget(e){let r=this.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:e.clone().sub(r),target:e}}getViewToObject(e){let n=new M;return e.getWorldPosition(n),this.getViewToTarget(n)}setViewplaneSize(e,n,r=!1){if(this.aspect=e/n,r){let s=e>n?this.aspect:1,o=e>n?1:this.aspect;this.left=-H1*.5*s,this.right=H1*.5*s,this.top=H1*.5*(1/o),this.bottom=-H1*.5*(1/o)}else this.left=-e*.5,this.right=e*.5,this.top=n*.5,this.bottom=-n*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let e=this._projectionTransition;if(e===void 0)return 1;let n=(performance.now()-e.start)/e.duration;return n>=1?1:n<=0?0:zU(n)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return qa.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=qa.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let n=this._projectionTransition;n===void 0&&(n={from:new ne,blend:new ne,blendInverse:new ne,start:0,duration:qa.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=n),n.from.copy(this.projectionMatrix),n.start=performance.now(),n.duration=qa.projectionTransitionDuration,n.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(n.requestRender=e),n.raf!==0&&cancelAnimationFrame(n.raf),n.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let n=(performance.now()-e.start)/e.duration;if(n>=1){this._endProjectionTransition();return}let r=zU(n),s=e.from.elements,o=this._activeSubCamera.projectionMatrix.elements,a=e.blend.elements,l=e.referenceDepth,c=Math.max(1e-6,s[15]-s[11]*l),u=Math.max(1e-6,o[15]-o[11]*l),d=r*c/(r*c+(1-r)*u);for(let h=0;h<16;h++)a[h]=s[h]+(o[h]-s[h])*d;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let n=this._activeSubCamera;this.projectionMatrix=n.projectionMatrix,this.projectionMatrixInverse=n.projectionMatrixInverse}_syncProjectionTransition(e){let n=e._projectionTransition;if(n===void 0){this._projectionTransition!==void 0&&this._endProjectionTransition();return}let r=this._projectionTransition;r===void 0?(r={from:new ne,blend:new ne,blendInverse:new ne,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):r.raf!==0&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(n.from),r.start=n.start,r.duration=n.duration,r.referenceDepth=n.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,n,r,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,n,r,s,o,a):this.orthoCamera.setViewOffset(e,n,r,s,o,a),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,n){return super.copy(e,n),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=ea.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){let n={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ny(n,e)}updateCameraSubtype(e,n){let r=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";n.zoom!==void 0&&this.setZoom(r,n.zoom),n.near!==void 0&&this.setNear(r,n.near),n.fov!==void 0&&r==="PerspectiveCamera"&&(this.fov=n.fov)}updateState(e,n){this.updateCameraState(e,n)}updateCameraState(e,n){this.updateState_Entity(e,n),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(n?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(r=>typeof r=="number"?r:0)),e.targetOffset!==void 0&&(this.targetOffset=ea.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},hn=qa;hn.projectionTransitionsEnabled=!1,hn.projectionTransitionDuration=350,hn.projectionTransitionMinAgeMs=1e3});function W1(i){return i.type==="TorusGeometry"&&i.arc===360}var GU,BP,cv,_f=F(()=>{"use strict";X();GU=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??n),s=Math.abs(e.depth??n),o=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(e,{width:n,height:r,depth:s,radius:o,segments:Math.round(e.segments),pathSegments:Math.round(e.pathSegments),cornerSegments:Math.round(e.cornerSegments)})}}static build(i){let{width:t,height:e,depth:n,radius:r,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:d}=i.parameters,h=new cv(!1,t,e,n,r,s,o,a,l,c,u,d);return Object.assign(h,{userData:{...i,type:"HelixGeometry"}})}},BP=new Us([0,0,0],1);cv=class extends De{constructor(t=!0,e=1,n=1,r=1,s=1,o=1,a=1,l=1,c=1,u=1,d=1,h=1){if(super(),o===0)return;let p=t&&o===1;p&&(h=0),d>100&&(d=100),d===0&&(h=0);let f=()=>new M,g=new M,m=f(),y=f(),v=f(),b,x,S,E,T,w,_,A,C=f(),P=f(),D=f(),O=f(),L=f(),U=f(),G=f(),Y=f(),oe=n-2*l+.001,ee=oe/o,J=Math.ceil(a*o),Q=J+1,re=oe/J,me=-oe/2,ve=u+1,pe=2*Math.PI/u,Ee=Math.PI/2/h,ce=.01,Se=Math.min((1-d/100)*l,l-ce),Pe=l-Se,Le=0,ke=2,Ce=h*ke+ke,le=ve*Ce/ke,ye=le+ve*Q,Te=Math.max(0,ve*(Q+Ce)),[Ne,He,Me]=[3,3,2].map(be=>Array(Te*be).fill(0)),Oe=[],B=s-l;function fe(be,Fe){let ue=Math.PI/2;w=Fe*re,A=2*Math.PI*(w%ee)/ee+ue,w+=me,_=Math.sin(A)*B,T=Math.cos(A)*B,t?be.set(T,_,w):be.set(T,w,_)}fe(g,-1e-10),fe(m,0),C.copy(g),fe(g,1);let W=g.distanceTo(m),et=p?0:Pe+Se,Ge=W*J+2*et,z=Se,I=Ge-et;for(let be=0;be<=J;be++){fe(y,be),Y.subVectors(y,C).normalize(),C.copy(y),U.copy(y).setComponent(+t+1,0).normalize(),G.crossVectors(Y,U).normalize();let Fe=be===0,ue=be===J,_e=Fe?3*Math.PI/2:Ee,Ke=Fe?z:I,xt=Fe?ve:ye,Je=Fe?0:Te-ve,Xe=Y.clone().multiplyScalar(Fe?-Pe:Pe).add(y),rt=Y.clone().multiplyScalar(Fe?-1:1).normalize();for(let yt=0;yt<ve;yt++){let Ut=yt*pe;if(P.addVectors(g.copy(U).multiplyScalar(l*Math.cos(Ut)),m.copy(G).multiplyScalar(l*Math.sin(Ut))),D.copy(P).normalize(),Fe||ue){p||(Le=Je+yt,[0,1,2].forEach($=>{Ne[Le*3+$]=Xe.getComponent($),He[Le*3+$]=rt.getComponent($)}),Me[Le*2]=+ue,Me[Le*2+1]=yt/u),m.copy(D).multiplyScalar(Se),v.addVectors(y,m);for(let $=0;$<h;$++){let Ye=$*Ee+_e;O.addVectors(g.copy(Y).multiplyScalar(Pe*Math.sin(Ye)),m.copy(D).multiplyScalar(Pe*Math.cos(Ye))),L.copy(O).normalize(),m.addVectors(v,O),O.normalize(),Le=xt+$*ve+yt,[0,1,2].forEach($e=>{Ne[Le*3+$e]=m.getComponent($e),He[Le*3+$e]=L.getComponent($e)});let Ae=+Fe+Math.sin(Ye);Me[Le*2]=(Ke+Pe*Ae)/Ge,Me[Le*2+1]=yt/u}}m.addVectors(y,P),Le=le+be*ve+yt,[0,1,2].forEach($=>{Ne[Le*3+$]=m.getComponent($),He[Le*3+$]=D.getComponent($)}),Me[Le*2]=(et+be*W)/Ge,Me[Le*2+1]=yt/u}}let q=Q+2*h+ke,[Z,ae]=[+p,q-1];for(let be=Z;be<=ae-1;be++){let Fe=p&&be===ae-1;for(let ue=0;ue<ve-1;ue++)b=be*ve+ue,x=b+1,S=(Fe?ue:b)+ve,E=(Fe?ue+1:x)+ve,be===0?Oe.push(x,E,S):be===q-2?Oe.push(b,x,S):Oe.push(b,x,S,x,E,S)}this.setIndex(Oe),this.setAttribute("position",new Ve(Ne,3)),this.setAttribute("normal",new Ve(He,3)),this.setAttribute("uv",new Ve(Me,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t=this.userData.parameters,e=Math.ceil(t.tubularSegments),n=t.radialSegments,r=n+1,s=[],o,a,l,c;for(let u=1;u<e;u++)for(let d=0;d<n;d++)o=u*r+d,a=o+1,l=o+r,c=a+r,s.push(o,a,l,a,c,l);for(let u=0;u<n;u++)o=e*r+u,a=o+1,l=u+r,c=u+1+r,s.push(o,a,l,a,c,l);return BP.array=new Uint32Array(s),BP.count=s.length,BP}}});function HU(i){if(q1)return q1;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.25/build"),s=import("./boolean.js"),[o,a]=await Promise.all([s,fetch(`${n}/boolean.wasm`).then(l=>l.arrayBuffer())]);await o.default({module_or_path:a}),uv=o}return q1=t(),q1}function Y1(){if(uv===void 0)throw new Error("boolean-wasm is not loaded");return uv}function FP(i){let t=X1.get(i);if(t===void 0)throw new Error("Unknown csg mesh set handle "+i);return t}function UP(i){return X1.set(++jU,i),jU}function SJ(i,t){if(t&&i.userData.positions!==void 0){let a=i.userData,l=[];for(let c=0,u=0;c<a.verticesPerFace.length;c++){let d=a.verticesPerFace[c];for(let h=1;h<d-1;h++)l.push(a.indices[u],a.indices[u+h],a.indices[u+h+1]);u+=d}return{positions:a.positions instanceof Float32Array?a.positions:new Float32Array(a.positions),indices:new Uint32Array(l)}}let e;W1(i.userData.parameters)?e=i.getClosedTorusIndicesForBooleanOrSubdiv():e=i.getIndex();let n=i.getAttribute("position"),r;if(e===null){r=new Uint32Array(n.count);for(let a=0;a<r.length;a++)r[a]=a}else e.array instanceof Uint32Array?r=e.array:r=new Uint32Array(e.array);let s=i.getAttribute("normal"),o=s!==void 0&&s.itemSize===3&&s.count===n.count&&s.array instanceof Float32Array&&s.isInterleavedBufferAttribute!==!0?s.array:void 0;return{positions:n.array,indices:r,normals:o}}function WU(i,t,e){if(uv===void 0)return-1;let{positions:n,indices:r,normals:s}=SJ(i,t);return UP(new uv.CsgMesh(n,r,s))}function qU(i,t){let e=Y1(),n=xJ[t];if(n===void 0)throw new Error("Unknown boolean operation "+t);let r=i.map(FP);if(r.length===1)return e.clone_mesh(r[0]);let s=[],o;if(t===2&&r.length>2){let a=r[0];for(let l=1;l<r.length-1;l++)a=e.boolean_mesh(a,r[l],0),s.push(a);o=e.boolean_mesh(r[r.length-1],a,2)}else if(t===2)o=e.boolean_mesh(r[1],r[0],2);else{let a=r[r.length-1];for(let l=0;l<r.length-1&&(a=e.boolean_mesh(a,r[l],n),s.push(a),a.tri_count()!==0);l++);o=a,s.pop()}for(let a of s)a.free();return o}function XU(i,t,e,n){let r=Y1(),s=qU(i,t),o=r.mesh_render_data(s,Math.max(n,0));if(e.setAttribute("position",new Ve(o.positions(),3)),e.setAttribute("normal",new Ve(o.normals(),3)),o.free(),e.boundingSphere===null&&(e.boundingSphere=new nr),s.tri_count()===0)e.boundingSphere.center.set(0,0,0),e.boundingSphere.radius=0,e.userData.parameters={width:0,height:0,depth:0};else{let a=s.bounds();e.boundingSphere.center.set(a[0],a[1],a[2]),e.boundingSphere.radius=(a[3]**2+a[4]**2+a[5]**2)**.5,e.userData.parameters={width:a[3]*2,height:a[4]*2,depth:a[5]*2}}return UP(s)}function YU(i,t){let e=Y1(),n=qU(i,t),r=e.mesh_topological_data(n),s=r.positions(),o=r.indices();r.free(),n.free();let a=new Uint8Array(o.length/3).fill(3);return{positions:s,indices:o,verticesPerFace:a}}function $1(i,t){FP(i).transform(new Float32Array(t.elements))}function K1(i){let t=X1.get(i);t!==void 0&&(t.free(),X1.delete(i))}function $U(i,t){let e=Y1();return UP(e.instanced_union(FP(i),t))}var uv,X1,jU,q1,xJ,dv=F(()=>{X();_f();X1=new Map,jU=0;xJ={[0]:0,[1]:1,[2]:2}});function Xd(i){return i!==null&&"booleanOp"in i}var Af,KU=F(()=>{"use strict";X();Xi();dv();Af=class extends Tf(Ht){constructor(){super(...arguments);this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new ne}updateVisible(e){super.updateVisible(e),this.visible=!Xd(this.parent)&&this.visible,Xd(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Xd(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(K1(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Xd(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof Af&&(e.freeBooleanPointer(),Xd(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,n){let r=super.updateTransformState(e,n);return r&&Xd(this.parent)&&this.invalidateDownstreamBooleanData(!0),r}onVariableUpdate(e=!1){super.onVariableUpdate(e),Xd(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}});function ZU(){return wJ}var wJ,QU=F(()=>{"use strict";wJ=null});function hv(i,t=0,e=i.count,n,r){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let d=t;d<e;d++){let h=i.getX(d),p=i.getY(d),f=i.getZ(d);h<s&&(s=h),p<o&&(o=p),f<a&&(a=f),h>l&&(l=h),p>c&&(c=p),f>u&&(u=f)}Z1.min.set(s,o,a),Z1.max.set(l,c,u),Z1.getCenter(n),Z1.getSize(r).multiplyScalar(.5)}var Z1,EJ,TJ,Kt,ii=F(()=>{"use strict";X();KU();QU();Z1=new Nt;EJ=new De,TJ=new ti,Kt=class extends Af{constructor(t,e){super(EJ,TJ),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let n=ZU();if(n!==null){n(this,t,e);return}super.raycast(t,e)}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?hv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}}});function Yd(i){return i?.isClassicNodeMaterial===!0}function JU(i){return i?.isClassicSharedMaterial===!0}var Q1=F(()=>{"use strict"});var yn,Ao=F(()=>{X();yn=class extends Ze{constructor(e,n,r,s){super(e,n,r);this.isColorA=!0;this.a=s}setRGBA(e,n,r,s){super.setRGB(e,n,r),this.a=s}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,n="srgb"){let r;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(r=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=o==="rgba"?parseFloat(s[4]):1,super.setStyle(e,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=o==="hsla"?parseFloat(s[4]):1,super.setStyle(e,n);break}}return super.setStyle(e,n)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}});var oc,VP=F(()=>{"use strict";Ao();oc=class extends yn{}});var J1,ek=F(()=>{"use strict";J1=class{constructor(t=1e3*10){this.timeout=t;this.cache=new Map;this.head={data:null,time:0,src:null,next:null,prev:null};this.tail={data:null,time:1/0,src:null,next:null,prev:null};this.hasClean=!1;this.cleanupTimer=null;this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let n=e;e=e.next,e.prev=this.head,this.head.next=e,n.next=null,n.prev=null,n.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),n=this.cache.get(t);return n===void 0?(n={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,n)):(n.time=e,n.prev.next=n.next,n.next.prev=n.prev),n.prev=this.tail.prev,n.next=this.tail,this.tail.prev.next=n,this.tail.prev=n,this.scheduleCleanup(),n.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}});function tk(i){return typeof i=="string"?i:(pv||(pv=new zP),pv.load(i))}function nk(){pv&&pv.disposeAll()}var zP,pv,GP=F(()=>{ek();zP=class extends J1{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}});var ew,tw,jP=F(()=>{"use strict";ew=class{constructor(t,e){this.data=t;this.cache=e;this.refCount=0}deref(){if(this.refCount===0&&!1)throw new Error("ref count -1?");this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){if(this.refCount!==0&&!1)throw new Error("ref count is not 0")}},tw=class{constructor(){this.cache=new Map}remove(t){if(this.cache.delete(t.data)===!1&&!1)throw new Error("ref count remove non-exists")}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}});var nw,rk=F(()=>{X();nw=class extends iy{constructor(t){super(t),this.type=hr}parse(t){let o=function(w,_){switch(w){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(_||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(_||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(_||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(_||""))}},u=`
4127
+ })();`});function RZ(i,t){let e=[];for(let n of Object.keys(t))i[n]!==t[n]&&e.push({name:n,value:t[n]});return e}var IZ,Up,aC=F(()=>{"use strict";IZ=100;Up=class{constructor(t,e,n){this.deps=t;this.onConsole=e;this.onEvent=n;this.disposed=!1;this.eventUnsubs=new Map;this.variablePollHandle=null;this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let n=this.deps;switch(t){case"setVariable":{let r=n.setVariable(String(e[0]),e[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=e[0]??{},s=!0;for(let[o,a]of Object.entries(r)){let l=n.setVariable(o,a);l.warning&&this.onConsole("warn",l.warning),s=s&&l.ok}return s}case"getVariable":return n.getVariable(String(e[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(e[0]));case"getGeometry":{let r=n.getGeometry(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return n.updateObject(String(e[0]),e[1]??{});case"createObject":return n.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":{if(n.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(e[0])}case"setMaterial":{if(n.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.setMaterial(String(e[0]),e[1])}case"cloneObject":return n.cloneObject(String(e[0]),e[1]??{});case"removeObject":return n.removeObject(String(e[0]));case"spawnObject":{let r=n.spawnObject(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return n.destroyObject(String(e[0]));case"setInstanceTransforms":{let r=e[1]===null||e[1]===void 0?null:e[1],s=n.setInstanceTransforms(String(e[0]),r);return s<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),s}case"emitEvent":case"emitEventReverse":{let r=n.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return n.requestRender(),!0;case"listenEvent":{let r=String(e[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,n.addSplineEventListener(r,s=>{this.onEvent(r,s)})),!0}case"unlistenEvent":{let r=String(e[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:{let r=t;throw new Error(`Unknown spline bridge method: ${r}`)}}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=RZ(this.lastVariables??{},t);this.lastVariables=t;for(let n of e)this.onEvent("variableChange",n)},IZ))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function OZ(i,t,e,n){return[i[0]*t+i[4]*e+i[8]*n+i[12],i[1]*t+i[5]*e+i[9]*n+i[13],i[2]*t+i[6]*e+i[10]*n+i[14]]}function DZ(i){let t=i[0],e=i[4],n=i[8],r=i[1],s=i[5],o=i[9],a=i[2],l=i[6],c=i[10],u=t*(s*c-o*l)-e*(r*c-o*a)+n*(r*l-s*a);if(!isFinite(u)||Math.abs(u)<1e-12)return null;let d=1/u,h=[(s*c-o*l)*d,(n*l-e*c)*d,(e*o-n*s)*d,(o*a-r*c)*d,(t*c-n*a)*d,(n*r-t*o)*d,(r*l-s*a)*d,(e*a-t*l)*d,(t*s-e*r)*d];return[h[0],h[3],h[6],h[1],h[4],h[7],h[2],h[5],h[8]]}function O3(i,t){let e=i?.getAttribute("position");if(!e||!e.count)return null;let n=e.count,r=t??null,s=i.getIndex?.()??null,o=Math.floor((s?s.count:n)/3),a=1/0,l=1/0,c=1/0,u=-1/0,d=-1/0,h=-1/0,p=new Float32Array(n*3);for(let y=0;y<n;y++){let v=e.getX(y),b=e.getY(y),x=e.getZ(y);r&&([v,b,x]=OZ(r,v,b,x)),v<a&&(a=v),b<l&&(l=b),x<c&&(c=x),v>u&&(u=v),b>d&&(d=b),x>h&&(h=x),p[y*3]=v,p[y*3+1]=b,p[y*3+2]=x}let f={space:r?"world":"local",vertexCount:n,triangleCount:o,indexed:s!==null,bounds:{min:[a,l,c],max:[u,d,h],size:[u-a,d-l,h-c]},vertices:p};if(s){let y=new Uint32Array(s.count);for(let v=0;v<s.count;v++)y[v]=s.getX(v);f.indices=y}let g=i.getAttribute("normal");if(g&&g.count===n){let y=r?DZ(r):void 0;if(!r||y){let v=new Float32Array(n*3);for(let b=0;b<n;b++){let x=g.getX(b),S=g.getY(b),E=g.getZ(b);if(y){let T=y[0]*x+y[1]*S+y[2]*E,w=y[3]*x+y[4]*S+y[5]*E,_=y[6]*x+y[7]*S+y[8]*E,A=Math.hypot(T,w,_);A>1e-12?(x=T/A,S=w/A,E=_/A):(x=T,S=w,E=_)}v[b*3]=x,v[b*3+1]=S,v[b*3+2]=E}f.normals=v}}let m=i.getAttribute("uv");if(m&&m.count===n){let y=new Float32Array(n*2);for(let v=0;v<n;v++)y[v*2]=m.getX(v),y[v*2+1]=m.getY(v);f.uvs=y}return f}var D3=F(()=>{"use strict"});function L3(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let i=[],t=(r,s,o)=>{let a=new Event(o);try{typeof s=="function"?s.call(r,a):s.handleEvent?.(a)}catch(l){console.error(l)}},e=(r,s)=>{let o=new Set,a=r.addEventListener.bind(r),l=r.removeEventListener.bind(r),c=(d,h,p)=>{if(a(d,h,p),!s.includes(d)||h==null)return;let f={type:d,listener:h};o.add(f),queueMicrotask(()=>{!o.delete(f)||t(r,f.listener,f.type)})},u=(d,h,p)=>{l(d,h,p);for(let f of o)f.type===d&&f.listener===h&&o.delete(f)};Object.defineProperty(r,"addEventListener",{configurable:!0,writable:!0,value:c}),Object.defineProperty(r,"removeEventListener",{configurable:!0,writable:!0,value:u}),i.push(()=>{delete r.addEventListener,delete r.removeEventListener,o.clear()})};e(document,["DOMContentLoaded"]),e(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:r=>{typeof r=="function"&&queueMicrotask(()=>{try{r.call(window,new Event("load"))}catch(s){console.error(s)}})}}),i.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let r of i)r()}}var N3=F(()=>{"use strict"});var LZ,TS,B3=F(()=>{"use strict";ES();aC();LZ=6e3,TS=class{constructor(t,e,n){this.iframe=t;this.deps=e;this.onConsole=n;this.disposed=!1;this.handshakeSeen=!1;this.handshakeTimer=null;this.onMessage=t=>{if(this.disposed||t.source!==this.iframe.contentWindow)return;let e=t.data;!C3(e)||this.handleMessage(e)};this.host=new Up(e,n,(r,s)=>{this.sendEvent(r,s)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Xl]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},LZ)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[Xl]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(n){e=Promise.reject(n)}e.then(n=>{this.send({[Xl]:!0,kind:"result",id:t.id,ok:!0,value:n,error:void 0})},n=>{let r=n instanceof Error?n.message:String(n);this.send({[Xl]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(t.event);break}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[Xl]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let n=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":{e.dispatchEvent(new PointerEvent(t.type,{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break}case"click":case"dblclick":{e.dispatchEvent(new MouseEvent(t.type,{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,button:t.button,buttons:t.buttons}));break}case"wheel":{let s=new WheelEvent("wheel",{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(s,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(s,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(s);break}case"keydown":case"keyup":{e.dispatchEvent(new KeyboardEvent(t.type,{...r,key:t.key,code:t.code,repeat:t.repeat}));break}}}}});var gn=F(()=>{yS();e3();i3();s3();h3();p3();m3();g3();x3();S3();w3();A3();ES();R3();aC();D3();N3();B3()});var F3=F(()=>{"use strict"});function MS(i){return Array.isArray(i)?i:[i]}function Cd(i,t){let e=0;for(;e<i.length&&e<t.length;){if(i[e]<t[e])return-1;if(i[e]>t[e])return 1;e+=1}return e!==t.length?-1:e!==i.length?1:0}var U3=F(()=>{"use strict"});function Wr(i,t){return Object.setPrototypeOf(i,t),i}function _S(i){let t={...i};return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}function Oa(i,t,e){if(i===void 0?t===void 0?(i=0,t=10):i=t-10:t===void 0&&(t=i+10),i>t){let s=i;i=t,t=s}let n=[],r=1/(e+1);for(let s=0;s<e;s++){let o=i+(t-i)*(s+.75+Math.random()*.5)*r;n.push(o)}return n}function kp(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function k3(){return typeof process<"u"}var V3=F(()=>{"use strict"});function By(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let t=Object.getOwnPropertyNames(i);for(let e of t){let n=i[e];n&&typeof n=="object"&&By(n)}return Object.freeze(i)}function AS(i){for(let t of Object.keys(i))i[t]===void 0&&delete i[t];return i}var z3=F(()=>{"use strict"});var mi=F(()=>{F3();U3();V3();z3()});var CS,Pd,Fy,PS=F(()=>{"use strict";CS=class{},Pd=class extends CS{constructor(e){super();this.id=e}},Fy=class extends CS{constructor(e){super();this.data=e}}});var G3=F(()=>{"use strict"});var at,Uy=F(()=>{"use strict";at=class{modifyById(t,e){let n=this;if(n[t]===void 0)throw new Error("not expected");{let s={...n,[t]:e};return Object.setPrototypeOf(s,at.prototype),s}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let n=e[t.id],r;n===void 0?r={type:2,id:t.id}:r={type:1,id:t.id,data:n};let{id:s,data:o}=t,a={...e,[s]:o};return Object.setPrototypeOf(a,at.prototype),{data:a,actual:t,reverse:r}}else if(t.type===2){let{id:n}=t,r=e[n];if(r===void 0)return null;{let s={...e};return Object.setPrototypeOf(s,at.prototype),delete s[n],{data:s,actual:t,reverse:{type:1,id:n,data:r}}}}return null}}});var Vp,IS=F(()=>{"use strict";Vp=class extends Error{}});function j3(i,t){for(let e of i)t(e.id,e.data)!==!0&&j3(e.children,t)}function H3(i,t){if(t(i.id,i.data)!==!0)for(let e of i.children)H3(e,t)}var Ln,su=F(()=>{"use strict";mi();IS();mi();Ln=class extends Array{constructor(...e){super(...e);zi(this,"partialObjectCaches");zi(this,"objCaches");zi(this,"parentCaches");Object.setPrototypeOf(this,Ln.prototype)}deepFreeze(){let e=0;for(;e<this.length;)By(this[e]),e++}fillCaches0(e,n){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,n);for(let r of e.children)this.fillCaches0(r,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,n){if(!this.has(e))return!0;for(;e;){let r=this.parent(e);if(r===n)return!0;e=r}return!1}rootAcestor(e){for(;e;){let n=this.parent(e);if(n)e=n;else return e}return e}isDescendantOf(e,n){for(;e;){let r=this.parent(e);if(r===n)return!0;e=r}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let n=this.get(e);n!==void 0&&this.partialObjectCaches.set(e,n)}get(e){if(this.partialObjectCaches!==void 0){let n=this.partialObjectCaches.get(e);if(n!==void 0)return n}return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,n){if(e===null)this.traverse(n);else{let r=this.get(e);r&&H3(r,n)}}traverse(e){j3(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this.parent(e),o=this.childrenArray(s),a=o.findIndex(d=>d.id===e);if(a<0)throw new Error("not expected");let l=o[a];o=[...o],o[a]={...l,data:n};let c=new Map;return c.set(e,o[a]),this.modifyArrayBy(s,o,c)}}modifyArrayBy(e,n,r=void 0){let s=e,o=n;for(;s!==null;){let l=o,c=s;if(s=this.parent(s),s===void 0)throw new Error;o=this.childrenArray(s);let u=o.findIndex(d=>d.id===c);if(u<0)throw new Error;o=[...o],o[u]={...o[u],children:l},r&&r.set(c,o[u])}Object.setPrototypeOf(o,Ln.prototype);let a=o;if(r&&this.objCaches!==void 0&&this.parentCaches!==void 0){a.objCaches=this.objCaches;for(let[l,c]of r)a.objCaches.set(l,c);a.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else a.fillCaches();return a}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:n}){if(this.get(e)!==void 0)return!0;for(let r of n)if(this.checkDuplicatedIdRec(r))return!0;return!1}addOp(e){let{parent:n,fi:r,id:s,data:o,children:a}=e;if(n!==null&&this.get(n)===void 0)return null;if(this.checkDuplicatedIdRec(e))return null;{let l=n,c=this.childrenArray(l),u={fi:r,id:s,data:o,children:a};return c=[...c,u],c.sort((h,p)=>h.fi-p.fi),e.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:e,reverse:{type:8,id:s}}}}deleteOp(e){let{id:n}=e;if(this.get(n)===null)return null;{let r=this.parent(n);if(r===void 0)return null;let s=this.childrenArray(r),o=s.findIndex(c=>c.id===n);e.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(r,s),actual:e,reverse:{type:7,...a,parent:r}}}}moveOp(e){let{parent:n,fi:r,id:s}=e;if(n!==null&&this.get(n)===void 0)return this.deleteOp({type:8,id:s});if(n!==null){let p=n;for(;p!==null;){if(p===void 0)throw new Error;if(p===s)throw new Vp("cyclic tree");p=this.parent(p)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(p=>p.id===s);l=[...l];let u=l.splice(c,1)[0],d=this.modifyArrayBy(o,l);o=n,l=d.childrenArray(o);let h=u.fi;return u={...u,fi:r},l=[...l,u],l.sort((p,f)=>p.fi-f.fi),e.localIndex=l.indexOf(u),d=d.modifyArrayBy(o,l),{data:d,actual:e,reverse:{type:9,parent:a,fi:h,id:s}}}previous(e,n){if(n===null){let s=this.childrenArray(e);return s.length===0?null:s[s.length-1].id}let r=null;for(let s of this.childrenArray(e)){if(s.id===n)return r;r=s.id}return null}traverseSortNext(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(o=>o.id===e)+1;if(s<r.length)return r[s].id;if(n)return this.traverseSortNext(n)}}sortNext(e){let n=this.childrenArray(e);return n.length>0?n[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let n=this.childrenArray(e);return n.length>0?this.traverseSortPrevious(n[n.length-1].id):e}sortPrevious(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(o=>o.id===e)-1;return s>=0?this.traverseSortPrevious(r[s].id):n}}getAllSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r.id);s!==void 0&&n.push({...r,...s})}n.sort((r,s)=>Cd(r.sortKey,s.sortKey));for(let r of n)delete r.sortKey;return n}getAllIdSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r);s!==void 0&&n.push(s)}n.sort((r,s)=>Cd(r.sortKey,s.sortKey));for(let r of n)delete r.sortKey;return n.map(r=>r.id)}getWithSortKey(e){let n=e,r=[],s=this.get(n),o=s;if(s!==void 0){for(;n;)r.splice(0,0,s.fi),n=this.parent(n),n!==null&&(s=this.get(n));return{...o,sortKey:r}}}insertBeforeHelper(e,n,r){return this.insertAfterHelper(e,this.previous(e,n),r)}insertAfterHelper(e,n,r){let s=this.childrenArray(e);if(n===null){if(s.length===0)return Oa(0,r,r);{let o=s[0].fi;return Oa(o-r,o,r)}}else{let o=this.get(n);if(o===void 0||this.parent(n)!==e)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Oa(l,l+r,r)}else return Oa(o.fi,a.fi,r)}}}});var lC,ou,RS=F(()=>{"use strict";lC=null;(n=>{function i(r){lC=r}n.setPreservePrototype=i;function t(r,s){return Object.getPrototypeOf(r)===lC&&Object.setPrototypeOf(s,lC),s}n.tryPreservePrototype=t;function e(r,s){if(s.type!==0)return null;if(Array.isArray(r)){let o=s.props,a={},l=[...r],c=!1;if(o)for(let u of Object.keys(o)){let d=parseInt(u);if(isNaN(d))throw new Error("wrong index");a[u]=l[d],l[d]=o[u],c=!0}return c?{data:l,actual:s,reverse:{type:0,props:a}}:null}else{let o=s.props,a={},l={...r},c=!1;if(o)for(let u of Object.keys(o)){a[u]=l[u];let d=o[u];d===void 0?delete l[u]:l[u]=d,c=!0}return c?{data:n.tryPreservePrototype(r,l),actual:s,reverse:{type:0,props:a}}:null}}n.runOp=e})(ou||(ou={}))});var ze,au=F(()=>{"use strict";mi();mi();ze=class extends Array{constructor(...e){super(...e);zi(this,"objCaches");Object.setPrototypeOf(this,ze.prototype)}deepFreeze(){let e=0;for(;e<this.length;)By(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===e);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]={...a,data:n},this.modifyArrayBy(s)}}modifyArrayBy(e){Object.setPrototypeOf(e,ze.prototype);let n=e;return k3()||n.fillCaches(),n}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:n,id:r,data:s}=e,o=this,a={fi:n,id:r,data:s};return o=[...o,a],o.sort((c,u)=>c.fi-u.fi),e.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:e,reverse:{type:5,id:r}}}deleteOp(e){let{id:n}=e,r=this,s=r.findIndex(l=>l.id===n);if(s===-1)return null;e.localIndex=s,r=[...r];let o=r.splice(s,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:{type:4,...o}}}moveOp(e){let{fi:n,id:r}=e,s=this;s=[...s];let o=s.findIndex(u=>u.id===r);if(o===-1)return null;let a=s[o].fi,l={...s[o],fi:n};return s[o]=l,s.sort((u,d)=>u.fi-d.fi),e.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:e,reverse:{type:6,fi:a,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let n=null;for(let r of this){if(r.id===e)return n;n=r.id}return null}insertBeforeHelper(e,n){return this.insertAfterHelper(this.previous(e),n)}insertAfterHelper(e,n){let r=this;if(e===null){if(r.length===0)return Oa(0,n,n);{let s=r[0].fi;return Oa(s-n,s,n)}}else{let s=this.get(e);if(s===void 0)throw new Error("illegal args");let o=r.find(a=>a.fi>s.fi);if(o===void 0){let a=r[r.length-1].fi;return Oa(a,a+n,n)}else return Oa(s.fi,o.fi,n)}}}});function W3(i,t){return zp(i,t,null)??i}function q3(i,t){let e={cur:[],result:[],len:0};return i=zp(i,t,e)??i,[i,e.result]}function OS(i,t){return i===null?null:(i.cur[i.len]=t,i.len+=1,i)}function DS(i){i&&(i.len-=1)}function NZ(i){if(i===null)return null;i.result.push(i.cur.slice(0,i.len))}function X3(i,t,e){let n=!1,r=i.map(s=>{let o=s.id,a=t[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,e!==null))throw new Error("not supported");let l=zp(s.data,t,OS(e,o));DS(e),n=n||l!==void 0,l===void 0&&(l=s.data);let c=X3(s.children,t,e);return c!==void 0?n=!0:c=s.children,{...s,id:o,data:l,children:c}});if(n)return r}function BZ(i,t,e){let n=!1,r=i.map(s=>{let o=s.id,a=t[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,e!==null))throw new Error("not supported");let l=zp(s.data,t,OS(e,o));return DS(e),n=n||l!==void 0,l===void 0&&(l=s.data),{...s,id:o,data:l}});if(n)return Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}function zp(i,t,e){if(i instanceof Ln){let n=X3(i,t,e);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}else{if(i instanceof ze)return BZ(i,t,e);if(Array.isArray(i)){let n=!1,r=i.map((s,o)=>{let a=zp(s,t,OS(e,o));return DS(e),n=n||a!==void 0,a===void 0&&(a=s),a});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else if(i&&typeof i=="object"&&!kp(i)){let n={},r=!1;for(let[s,o]of Object.entries(i))if(s!=="name"&&s!=="variableId"){let a=t[s];if(typeof a=="string"){if(e!==null)throw new Error("not supported");r=!0,s=a}let l=zp(o,t,OS(e,s));DS(e),r=r||l!==void 0,l===void 0&&(l=o),n[s]=l}else n[s]=o;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else if(typeof i=="string"){let n=t[i];return n!==void 0&&NZ(e),n}else return}}var cC=F(()=>{"use strict";su();au();mi()});function Gp(i){return i&&typeof i=="object"&&i instanceof Zn}function uC(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,o=ky(r.data,t[s]);if(e=e||o!==void 0,o===void 0&&(o=r.data),r.children){let a=uC(r.children,t);return a!==void 0?e=!0:a=r.children,{...r,id:s,data:o,children:a}}else return{...r,id:s,data:o}});if(e)return n}function FZ(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,o=ky(r.data,t[s]);return e=e||o!==void 0,o===void 0&&(o=r.data),{...r,id:s,data:o}});if(e)return Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}function ky(i,t){if(!Gp(t))return t;if(i instanceof Ln){let e=uC(i,t);return e!==void 0&&Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e}else{if(i instanceof ze)return FZ(i,t);if(Array.isArray(i)){let e=!1,n=i.map((r,s)=>{let o=ky(r,t[s]);return e=e||o!==void 0,o===void 0&&(o=r),o});return e?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else{if(i instanceof Zn)return dC(i,t);if(i&&typeof i=="object"){let e={},n=!1;for(let[r,s]of Object.entries(i)){let o=ky(s,t[r]);n=n||o!==void 0,o===void 0&&(o=s),e[r]=o}return n?(Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e):void 0}}}}function dC(i,t){if(i===void 0)return t;if(t===void 0)return i;if(!Gp(t))return t;if(!Gp(i))return Da.apply(i,t);let e=new Set;for(let r of Object.keys(i))e.add(r);for(let r of Object.keys(t))e.add(r);let n=new Zn;for(let r of e){let s=dC(i===void 0?void 0:i[r],t===void 0?void 0:t[r]);n[r]=s}return n}var Zn,Da,LS=F(()=>{"use strict";su();au();Vy();mi();Zn=class{unusedFunOverridesTable(t){}runOp(t){let e=[],n=this,r=0,s={};for(;r<t.path.length;){if(e.push(n),n=n===void 0?void 0:n[t.path[r]],n!==void 0&&!Gp(n))return null;r+=1}n=n?_S(n):new Zn;for(let[l,c]of Object.entries(t.props)){let u=n[l];s[l]=u,c===void 0?delete n[l]:n[l]=c}for(;r>0;){if(Object.keys(n).length===0){let l=e[r-1];l&&(n=_S(l),delete n[t.path[r-1]])}else{let l=e[r-1];if(l){let c=_S(l);c[t.path[r-1]]=n,n=c}else{let c=new Zn;c[t.path[r-1]]=n,n=c}}r-=1}let o=Object.setPrototypeOf(n,Zn.prototype),a={...t,props:s};return{data:o,actual:t,reverse:a}}};(n=>{function i(r,s){return ky(r,s)??r}n.apply=i;function t(r,s){return dC(r,s)}n.merge=t;function e(r,s){let o=0,a=s.path,l=r;for(;o<a.length&&l!==void 0;){if(l=rr.zoomOnce(l,a[o]),l===void 0)return s;if(!Gp(l))return;o+=1}if(l===void 0)return s;if(!!Gp(l))if(s.type===0){let c={...s.props};for(let u of Object.keys(l))delete c[u];return{...s,props:c}}else if(s.type===1||s.type===4||s.type===7){let c=uC([s],l);return c?c[0]:s}else return s}n.filterOp=e})(Da||(Da={}))});var jp,Sr,zy,Y3=F(()=>{"use strict";Vy();Uy();su();IS();RS();au();cC();LS();(t=>{function i(e,n){let r=rr.zoom(n,e.path);if(typeof r=="object"){let s={};for(let o of Object.keys(e.props))s[o]=r[o];return{...e,props:s}}else return{...e,props:{}}}t.replaceProps=i})(jp||(jp={}));(a=>{function i(l,c){return{...l,path:l.path.slice(c)}}a.drop=i;function t(l,c){return e(l,c)?.data??l}a.applySimple=t;function e(l,c){let u=c.path,d=[];for(;;){let h;if(l instanceof Zn&&c.type===0&&(h=l.runOp({...c,path:u.slice(d.length)}),h===null&&(h=void 0)),h===void 0&&d.length===u.length&&(l instanceof Ln||l instanceof ze||l instanceof at?h=l.runOp(c):h=ou.runOp(l,c)),h!==void 0)if(h!==null){let g=h.data;for(let m=d.length-1;m>=0;m--){let y=u[m],v=d[m];if(v instanceof Ln){if(typeof y=="number")throw new Error("illegal arg");g=v.modifyById(y,g)}else if(v instanceof ze){if(typeof y=="number")throw new Error("illegal arg");g=v.modifyById(y,g)}else if(v instanceof at){if(typeof y=="number")throw new Error("illegal arg");g=v.modifyById(y,g)}else if(v instanceof Zn){let b={...v,[y]:g};g=Object.setPrototypeOf(b,Zn.prototype)}else if(typeof v=="object")if(Array.isArray(v)){if(typeof y=="string"&&(y=parseInt(y),isNaN(y)))throw new Error("Invalid path");let b=g;g=[...v],g[y]=b}else g=ou.tryPreservePrototype(v,{...v,[y]:g});else return null}return{data:g,actual:{...h.actual,path:u},reverse:{...h.reverse,path:u}}}else return null;let p=u[d.length],f;if(l instanceof Ln){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else if(l instanceof ze){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else l!==null&&(f=l[p]);if(f!==void 0)d.push(l),l=f;else return null}}a.apply=e;function n(l,c){for(let u=0;u<l.length&&u<c.length;u++)if(l[u]!==c[u])return!0;return!1}a.pathDisjoint=n;function r(l,c){if(l.length!==c.length)return!1;for(let u=0;u<l.length;u++)if(l[u]!==c[u])return!1;return!0}a.pathEq=r;function s(l,c){return n(l.path,c.path)}a.commutative=s;function o(l,c){return l.type===0&&c.type===0&&r(l.path,c.path)?Object.keys(l.props).every(u=>c.props[u]!==void 0):!1}a.subsumed=o})(Sr||(Sr={}));(l=>{function i(){return[]}l.empty=i;function t(c,u){let d=[];for(let h of c){let[p,...f]=h.path;p===u&&d.push({...h,path:f})}return d}l.removePrefix=t;function e(c,u){return c.map(d=>({...d,path:[u,...d.path]}))}l.addPrefix=e;function n(c,u){return[...c,...u]}l.concat=n;function r(c,u){return[...c.filter(h=>!u.some(p=>Sr.subsumed(h,p))),...u]}l.compress=r;function s(c,u){return c.every(d=>u.every(h=>Sr.commutative(d,h)))}l.commutative=s;function o(c,u){for(let d of u){let h=a(c,d);h!==null&&(c=h.data)}return c}l.applyAll=o;function a(c,u){let d=c,h=[],p=[];for(let f of u)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let g,m,y;if(f.type===3?(g=rr.zoom(d,[...f.path,f.id]),y=Sr.apply(d,{...f,type:2})):(g=rr.zoom(d,[...f.path,f.id,"value"]),y=Sr.apply(d,f)),y!==null){d=y.data;let[v,b]=q3(d,{[f.id]:g});d=v;for(let x=0;x<b.length;x++){let S=b[x],E=S.pop();if(typeof E=="number"){let T=[E];for(let _=x+1;_<b.length;_++){let A=b[_],C=A[A.length-1];if(typeof C=="number"&&rr.equal(S,A.slice(0,A.length-1)))T.push(C),b.splice(_,1);else break}let w=rr.zoom(d,S);m=w.map((_,A)=>T.includes(A)?f.id:_),g=w,E=S.pop()}else{if(E==="alphaOverride"||E==="alpha"){g/=100;let T=g,w=rr.zoom(d,S.slice(0,S.length-2)),_=w.layers.map(A=>A.id===S[S.length-1]?{...A,data:{...A.data,[E]:T}}:A);Object.setPrototypeOf(_,Object.getPrototypeOf(w.layers)),w.layers=_}m=f.id}h.push({type:0,path:S,props:{[E]:g}}),p.push({type:0,path:S,props:{[E]:m}})}p.push(y.reverse),h.push(y.actual)}}else{let g=Sr.apply(d,f);g!==null&&(h.push(g.actual),d=g.data,p.push(g.reverse))}}catch(g){if(g instanceof Vp)return null;throw g}return{data:d,actual:h,reverse:p.reverse()}}l.apply=a})(zy||(zy={}))});function hC(i,t,e){if(i.length>0){let n=i[i.length-1];if(n.type===0&&t.type===0&&rr.equal(n.path,e)){Object.assign(n.props,t.props);return}}i.push({...t,path:e})}function FS(i,t,e){return e instanceof Ln?new Hp(i,t,e):e instanceof ze?new Wp(i,t,e):e instanceof at?new Proxy(new fC(i,t,e),VZ):e!==null&&typeof e=="object"?kp(e)?e:new Proxy(new pC(i,t,e),kZ):e}function Rd(i){let t=new NS(i);return[FS(t,"",i),t]}function lu(i,t){let[e,n]=Rd(i);return t(e),n.result()}function Cr(i){return i instanceof Hp||i instanceof Wp?i._current:i!==null&&typeof i=="object"?i[$3]:i}var $3,UZ,BS,Id,pC,fC,K3,kZ,VZ,Hp,Wp,NS,mC=F(()=>{"use strict";Uy();su();RS();au();mi();Vy();$3=Symbol(),UZ=Symbol(),BS=Symbol(),Id=class{reportOp(t,e,n=[]){let r=this;if(e===null)return;r._current=e.data;let s=n;for(;!(r instanceof NS);){let o=r._path,a=r._current;if(o!==""&&s.splice(0,0,o),r=r._parent,r===null)return;r.update(o,a)}r.push(s,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let n=e[BS];n&&n(),delete this._children[t]}}}},pC=class extends Id{constructor(t,e,n){super(),this._parent=t,this._path=e,this._current=n}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=ou.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,ou.runOp(this._current,t),t.path)}},fC=class extends Id{constructor(t,e,n){super(),this._parent=t,this._path=e,this._current=n}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,at.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},K3={get(i,t){if(t===BS)return()=>{i._parent=null};if(t===$3)return i._current;if(t===UZ)return i;let{_current:e,_children:n}=i;if(t==="push"&&Array.isArray(e))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e[t],o=FS(i,t,s);return o!==s?(n===void 0&&(n={},i._children=n),n[t]=o,o):s},has(i,t){return t in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,t){let e=i._current,n=Reflect.getOwnPropertyDescriptor(e,t);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:e[t]}}},kZ={...K3,set(i,t,e){let n={type:0,props:{[t]:Cr(e)??e}};return i.deleteChildren(t),i.runOp(n),!0},deleteProperty(i,t){let e={type:0,props:{[t]:void 0}};return i.deleteChildren(t),i.runOp(e),!0}},VZ={...K3,set(i,t,e){return e===void 0?this.deleteProperty(i,t):(i.deleteChildren(t),i.runOp({type:1,id:t,data:e})),!0},deleteProperty(i,t){return i.runOp({type:2,id:t}),!0}},Hp=class extends Id{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[BS]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,n)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,o=FS(this,t,s);return o!==s?(n===void 0&&(n={},this._children=n),n[t]=o,o):s}add(t,e,n,r,s){this.runOp({type:7,parent:t,fi:e,id:n,data:r,children:s})}move(t,e,n){this.runOp({type:9,parent:t,fi:e,id:n})}insertAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.add(t,r[s],o.id,o.data,o.children)}}insertBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.add(t,r[s],o.id,o.data,o.children)}}moveAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.move(t,r[s],o)}}moveBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.move(t,r[s],o)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},Wp=class extends Id{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[BS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id,s=this._current[n].fi;t(this.data(this._current[n].id),r,s,n)}}find(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id;if(t(this.data(r),r))return this.get(r)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:n}=this._current.at(t);return{id:e,fi:n,data:this.data(e)}}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,o=FS(this,t,s);return o!==s?(n===void 0&&(n={},this._children=n),n[t]=o,o):s}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,n){this.runOp({type:4,fi:t,id:e,data:n})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}insertBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}moveAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}moveBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};NS=class extends Id{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,n,r){hC(this.ts,e,t),hC(this.actual,n,t),hC(this.reverse,r,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}});var rr,Vy=F(()=>{"use strict";PS();mC();au();su();mi();(s=>{function i(o,a){if(a.length===o.length){let l=0;for(;l<o.length;){if(o[l]!==a[l])return!1;l+=1}}else return!1;return!0}s.equal=i;function t(o,a,l){let c=n(l,o);if(c!==void 0&&typeof c=="object"&&c!==null){let u={...a};return Object.keys(c).forEach(d=>{delete u[d]}),u}else return a}s.removeOverridden=t;function e(o,a){if((o instanceof Ln||o instanceof Hp)&&typeof a=="string")return o.data(a);if((o instanceof ze||o instanceof Wp)&&typeof a=="string")return o.data(a);if(typeof a=="number"&&Array.isArray(o))return o[a];if(typeof a=="string"&&typeof o=="object"&&o!==null)return o[a]}s.zoomOnce=e;function n(o,a,l=0){for(;l<a.length&&o!==void 0;)o=e(o,a[l]),l+=1;return o}s.zoom=n;function r(o,a){let l=[];function c(u,d){if(u instanceof Pd&&u.id===a.id)l.push(d);else if(u instanceof ze)for(let h=0;h<u.length;h++)c(u[h].data,[...d,u[h].id]);else if(u instanceof Ln)u.traverse((h,p)=>{c(h,[...d,p])});else if(Array.isArray(u))for(let h=0;h<u.length;h++)c(u[h],[...d,h]);else{if(kp(u))return;if(typeof u=="object"&&u!==null)for(let h in u)c(u[h],[...d,h])}}return c(o,[]),l}s.findPathes=r})(rr||(rr={}))});var Z3=F(()=>{"use strict"});function Q3(i,t){let e=[];if(t.length===i.length){let n=0;for(;n<i.length;){if(t[n]==="*")e.push(i[n]);else if(i[n]!==t[n])return null;n+=1}}else return null;return e}function $t(i,t){let e=[];if(t.length<=i.length){let n=0;for(;n<t.length;){if(t[n]==="*")e.push(i[n]);else if(i[n]!==t[n])return null;n+=1}}else return null;return e}var J3=F(()=>{"use strict"});function US(i){try{if(!ir.trusted&&!uu){let e=dn.sharedLength||0;e<dn.length&&(dn.length=e)}let t;if(ir.randomAccessStructure&&tt[ie]<64&&tt[ie]>=32&&nB?(t=nB(tt,ie,uo,ir),tt=null,!(i&&i.lazy)&&t&&(t=t.toJSON()),ie=uo):t=qr(),Pi&&(ie=Pi.postBundlePosition,Pi=null),uu&&(dn.restoreStructures=null),ie==uo)dn&&dn.restoreStructures&&sB(),dn=null,tt=null,Yl&&(Yl=null);else{if(ie>uo)throw new Error("Unexpected end of MessagePack data");if(!uu){let e;try{e=JSON.stringify(t,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){e="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+e)}}return t}catch(t){throw dn&&dn.restoreStructures&&sB(),wC(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||ie>uo)&&(t.incomplete=!0),t}}function sB(){for(let i in dn.restoreStructures)dn[i]=dn.restoreStructures[i];dn.restoreStructures=null}function qr(){let i=tt[ie++];if(i<160)if(i<128){if(i<64)return i;{let t=dn[i&63]||ir.getStructures&&mB()[i&63];return t?(t.read||(t.read=EC(t,i&63)),t.read()):i}}else if(i<144)if(i-=128,ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=yB();n==="__proto__"&&(n="__proto_"),t[n]=qr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(qr(),qr());return t}else{i-=144;let t=new Array(i);for(let e=0;e<i;e++)t[e]=qr();return ir.freezeData?Object.freeze(t):t}else if(i<192){let t=i-160;if(La>=ie)return cu.slice(ie-co,(ie+=t)-co);if(La==0&&uo<140){let e=t<16?TC(t):gB(t);if(e!=null)return e}return SC(t)}else{let t;switch(i){case 192:return null;case 193:return Pi?(t=qr(),t>0?Pi[1].slice(Pi.position1,Pi.position1+=t):Pi[0].slice(Pi.position0,Pi.position0-=t)):fB;case 194:return!1;case 195:return!0;case 196:if(t=tt[ie++],t===void 0)throw new Error("Unexpected end of buffer");return gC(t);case 197:return t=sn.getUint16(ie),ie+=2,gC(t);case 198:return t=sn.getUint32(ie),ie+=4,gC(t);case 199:return Od(tt[ie++]);case 200:return t=sn.getUint16(ie),ie+=2,Od(t);case 201:return t=sn.getUint32(ie),ie+=4,Od(t);case 202:if(t=sn.getFloat32(ie),ir.useFloat32>2){let e=SB[(tt[ie]&127)<<1|tt[ie+1]>>7];return ie+=4,(e*t+(t>0?.5:-.5)>>0)/e}return ie+=4,t;case 203:return t=sn.getFloat64(ie),ie+=8,t;case 204:return tt[ie++];case 205:return t=sn.getUint16(ie),ie+=2,t;case 206:return t=sn.getUint32(ie),ie+=4,t;case 207:return ir.int64AsType==="number"?(t=sn.getUint32(ie)*4294967296,t+=sn.getUint32(ie+4)):ir.int64AsType==="string"?t=sn.getBigUint64(ie).toString():ir.int64AsType==="auto"?(t=sn.getBigUint64(ie),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=sn.getBigUint64(ie),ie+=8,t;case 208:return sn.getInt8(ie++);case 209:return t=sn.getInt16(ie),ie+=2,t;case 210:return t=sn.getInt32(ie),ie+=4,t;case 211:return ir.int64AsType==="number"?(t=sn.getInt32(ie)*4294967296,t+=sn.getUint32(ie+4)):ir.int64AsType==="string"?t=sn.getBigInt64(ie).toString():ir.int64AsType==="auto"?(t=sn.getBigInt64(ie),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=sn.getBigInt64(ie),ie+=8,t;case 212:if(t=tt[ie++],t==114)return dB(tt[ie++]&63);{let e=qi[t];if(e)return e.read?(ie++,e.read(qr())):e.noBuffer?(ie++,e()):e(tt.subarray(ie,++ie));throw new Error("Unknown extension "+t)}case 213:return t=tt[ie],t==114?(ie++,dB(tt[ie++]&63,tt[ie++])):Od(2);case 214:return Od(4);case 215:return Od(8);case 216:return Od(16);case 217:return t=tt[ie++],La>=ie?cu.slice(ie-co,(ie+=t)-co):GZ(t);case 218:return t=sn.getUint16(ie),ie+=2,La>=ie?cu.slice(ie-co,(ie+=t)-co):jZ(t);case 219:return t=sn.getUint32(ie),ie+=4,La>=ie?cu.slice(ie-co,(ie+=t)-co):HZ(t);case 220:return t=sn.getUint16(ie),ie+=2,aB(t);case 221:return t=sn.getUint32(ie),ie+=4,aB(t);case 222:return t=sn.getUint16(ie),ie+=2,lB(t);case 223:return t=sn.getUint32(ie),ie+=4,lB(t);default:if(i>=224)return i-256;if(i===void 0){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+i)}}}function EC(i,t){function e(){if(e.count++>tB){let r;try{r=i.read=new Function("r","return function(){return "+(ir.freezeData?"Object.freeze":"")+"({"+i.map(s=>s==="__proto__"?"__proto_:r()":zZ.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(qr)}catch{return tB=1/0,e()}return i.read0=r,i.highByte===0&&(i.read=oB(t,i.read)),r()}let n={};for(let r=0,s=i.length;r<s;r++){let o=i[r];o==="__proto__"&&(o="__proto_"),n[o]=qr()}return ir.freezeData?Object.freeze(n):n}return e.count=0,i.read0=e,i.highByte===0?oB(t,e):e}function mB(){let i=bB(()=>(tt=null,ir.getStructures()));return dn=ir._mergeStructures(i,dn)}function Gy(i){let t;if(i<16&&(t=TC(i)))return t;if(i>64&&yC)return yC.decode(tt.subarray(ie,ie+=i));let e=ie+i,n=[];for(t="";ie<e;){let r=tt[ie++];if((r&128)===0)n.push(r);else if((r&224)===192){let s=tt[ie++]&63,o=(r&31)<<6|s;o<128?n.push(65533):n.push(o)}else if((r&240)===224){let s=tt[ie++]&63,o=tt[ie++]&63,a=(r&31)<<12|s<<6|o;a<2048||a>=55296&&a<=57343?n.push(65533):n.push(a)}else if((r&248)===240){let s=tt[ie++]&63,o=tt[ie++]&63,a=tt[ie++]&63,l=(r&7)<<18|s<<12|o<<6|a;l<65536||l>1114111?n.push(65533):(l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l))}else n.push(65533);n.length>=4096&&(t+=Ci.apply(String,n),n.length=0)}return n.length>0&&(t+=Ci.apply(String,n)),t}function aB(i){let t=new Array(i);for(let e=0;e<i;e++)t[e]=qr();return ir.freezeData?Object.freeze(t):t}function lB(i){if(ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=yB();n==="__proto__"&&(n="__proto_"),t[n]=qr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(qr(),qr());return t}}function gB(i){let t=ie,e=new Array(i);for(let n=0;n<i;n++){let r=tt[ie++];if((r&128)>0){ie=t;return}e[n]=r}return Ci.apply(String,e)}function TC(i){if(i<4)if(i<2){if(i===0)return"";{let t=tt[ie++];if((t&128)>1){ie-=1;return}return Ci(t)}}else{let t=tt[ie++],e=tt[ie++];if((t&128)>0||(e&128)>0){ie-=2;return}if(i<3)return Ci(t,e);let n=tt[ie++];if((n&128)>0){ie-=3;return}return Ci(t,e,n)}else{let t=tt[ie++],e=tt[ie++],n=tt[ie++],r=tt[ie++];if((t&128)>0||(e&128)>0||(n&128)>0||(r&128)>0){ie-=4;return}if(i<6){if(i===4)return Ci(t,e,n,r);{let s=tt[ie++];if((s&128)>0){ie-=5;return}return Ci(t,e,n,r,s)}}else if(i<8){let s=tt[ie++],o=tt[ie++];if((s&128)>0||(o&128)>0){ie-=6;return}if(i<7)return Ci(t,e,n,r,s,o);let a=tt[ie++];if((a&128)>0){ie-=7;return}return Ci(t,e,n,r,s,o,a)}else{let s=tt[ie++],o=tt[ie++],a=tt[ie++],l=tt[ie++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){ie-=8;return}if(i<10){if(i===8)return Ci(t,e,n,r,s,o,a,l);{let c=tt[ie++];if((c&128)>0){ie-=9;return}return Ci(t,e,n,r,s,o,a,l,c)}}else if(i<12){let c=tt[ie++],u=tt[ie++];if((c&128)>0||(u&128)>0){ie-=10;return}if(i<11)return Ci(t,e,n,r,s,o,a,l,c,u);let d=tt[ie++];if((d&128)>0){ie-=11;return}return Ci(t,e,n,r,s,o,a,l,c,u,d)}else{let c=tt[ie++],u=tt[ie++],d=tt[ie++],h=tt[ie++];if((c&128)>0||(u&128)>0||(d&128)>0||(h&128)>0){ie-=12;return}if(i<14){if(i===12)return Ci(t,e,n,r,s,o,a,l,c,u,d,h);{let p=tt[ie++];if((p&128)>0){ie-=13;return}return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p)}}else{let p=tt[ie++],f=tt[ie++];if((p&128)>0||(f&128)>0){ie-=14;return}if(i<15)return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p,f);let g=tt[ie++];if((g&128)>0){ie-=15;return}return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p,f,g)}}}}}function cB(){let i=tt[ie++],t;if(i<192)t=i-160;else switch(i){case 217:t=tt[ie++];break;case 218:t=sn.getUint16(ie),ie+=2;break;case 219:t=sn.getUint32(ie),ie+=4;break;default:throw new Error("Expected string")}return Gy(t)}function gC(i){return ir.copyBuffers?Uint8Array.prototype.slice.call(tt,ie,ie+=i):tt.subarray(ie,ie+=i)}function Od(i){let t=tt[ie++];if(qi[t]){let e;return qi[t](tt.subarray(ie,e=ie+=i),n=>{ie=n;try{return qr()}finally{ie=e}})}else throw new Error("Unknown extension type "+t)}function yB(){let i=tt[ie++];if(i>=160&&i<192){if(i=i-160,La>=ie)return cu.slice(ie-co,(ie+=i)-co);if(!(La==0&&uo<180))return SC(i)}else return ie--,vB(qr());let t=(i<<5^(i>1?sn.getUint16(ie):i>0?tt[ie]:0))&4095,e=uB[t],n=ie,r=ie+i-3,s,o=0;if(e&&e.bytes==i){for(;n<r;){if(s=sn.getUint32(n),s!=e[o++]){n=1879048192;break}n+=4}for(r+=3;n<r;)if(s=tt[n++],s!=e[o++]){n=1879048192;break}if(n===r)return ie=n,e.string;r-=3,n=ie}for(e=[],uB[t]=e,e.bytes=i;n<r;)s=sn.getUint32(n),e.push(s),n+=4;for(r+=3;n<r;)s=tt[n++],e.push(s);let a=i<16?TC(i):gB(i);return a!=null?e.string=a:e.string=SC(i)}function vB(i){if(typeof i=="string")return i;if(typeof i=="number"||typeof i=="boolean"||typeof i=="bigint")return i.toString();if(i==null)return i+"";if(ir.allowArraysInMapKeys&&Array.isArray(i)&&i.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return i.flat().toString();throw new Error(`Invalid property type for record: ${typeof i}`)}function bB(i){iB&&iB();let t=uo,e=ie,n=bC,r=co,s=La,o=cu,a=vC,l=Yl,c=Pi,u=new Uint8Array(tt.slice(0,uo)),d=dn,h=dn.slice(0,dn.length),p=ir,f=uu,g=i();return uo=t,ie=e,bC=n,co=r,La=s,cu=o,vC=a,Yl=l,Pi=c,tt=u,uu=f,dn=d,dn.splice(0,dn.length,...h),ir=p,sn=new DataView(tt.buffer,tt.byteOffset,tt.byteLength),g}function wC(){tt=null,Yl=null,dn=null}function xB(i){i.unpack?qi[i.type]=i.unpack:qi[i.type]=i}var yC,tt,uo,ie,pB,vC,bC,ir,dn,cu,co,La,Pi,Yl,qi,sn,eB,xC,fB,uu,tB,nB,rB,iB,du,zZ,oB,SC,GZ,jZ,HZ,Ci,uB,dB,hB,WZ,qZ,XZ,SB,kS,bfe,xfe,Sfe,YZ,wfe,wB=F(()=>{try{yC=new TextDecoder}catch{}ie=0,pB=[],vC=pB,bC=0,ir={},co=0,La=0,qi=[],eB={useRecords:!1,mapsAsObjects:!0},xC=class{},fB=new xC;fB.name="MessagePack 0xC1";uu=!1,tB=2,du=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(tt)return bB(()=>(wC(),this?this.unpack(t,e):du.prototype.unpack.call(eB,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(uo=e.end||t.length,ie=e.start||0):(ie=0,uo=e>-1?e:t.length),bC=0,La=0,cu=null,vC=pB,Pi=null,tt=t;try{sn=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw tt=null,t instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof du){if(ir=this,this.structures)return dn=this.structures,US(e);(!dn||dn.length>0)&&(dn=[])}else ir=eB,(!dn||dn.length>0)&&(dn=[]);return US(e)}unpackMultiple(t,e){let n,r=0;try{uu=!0;let s=t.length,o=this?this.unpack(t,s):kS.unpack(t,s);if(e){if(e(o,r,ie)===!1)return;for(;ie<s;)if(r=ie,e(US(),r,ie)===!1)return}else{for(n=[o];ie<s;)r=ie,n.push(US());return n}}catch(s){throw s.lastPosition=r,s.values=n,s}finally{uu=!1,wC()}}_mergeStructures(t,e){rB&&(t=rB.call(this,t)),t=t||[],Object.isFrozen(t)&&(t=t.map(n=>n.slice(0)));for(let n=0,r=t.length;n<r;n++){let s=t[n];s&&(s.isShared=!0,n>=32&&(s.highByte=n-32>>5))}t.sharedLength=t.length;for(let n in e||[])if(n>=0){let r=t[n],s=e[n];s&&(r&&((t.restoreStructures||(t.restoreStructures=[]))[n]=r),t[n]=s)}return this.structures=t}decode(t,e){return this.unpack(t,e)}};zZ=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;oB=(i,t)=>function(){let e=tt[ie++];if(e===0)return t();let n=i<32?-(i+(e<<5)):i+(e<<5),r=dn[n]||mB()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=EC(r,i)),r.read()};SC=Gy,GZ=Gy,jZ=Gy,HZ=Gy;Ci=String.fromCharCode;uB=new Array(4096);dB=(i,t)=>{let e=qr().map(vB),n=i;t!==void 0&&(i=i<32?-((t<<5)+i):(t<<5)+i,e.highByte=t);let r=dn[i];return r&&(r.isShared||uu)&&((dn.restoreStructures||(dn.restoreStructures=[]))[i]=r),dn[i]=e,e.read=EC(e,n),(e.read0||e.read)()};qi[0]=()=>{};qi[0].noBuffer=!0;qi[66]=i=>{let t=i.byteLength%8||8,e=BigInt(i[0]&128?i[0]-256:i[0]);for(let n=1;n<t;n++)e<<=BigInt(8),e+=BigInt(i[n]);if(i.byteLength!==t){let n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=(s,o)=>{let a=o-s;if(a<=40){let d=n.getBigUint64(s);for(let h=s+8;h<o;h+=8)d<<=BigInt(64),d|=n.getBigUint64(h);return d}let l=s+(a>>4<<3),c=r(s,l),u=r(l,o);return c<<BigInt((o-l)*8)|u};e=e<<BigInt((n.byteLength-t)*8)|r(t,n.byteLength)}return e};hB={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};qi[101]=()=>{let i=qr();if(!hB[i[0]]){let t=Error(i[1],{cause:i[2]});return t.name=i[0],t}return hB[i[0]](i[1],{cause:i[2]})};qi[105]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=sn.getUint32(ie-4);Yl||(Yl=new Map);let e=tt[ie],n;e>=144&&e<160||e==220||e==221?n=[]:e>=128&&e<144||e==222||e==223?n=new Map:(e>=199&&e<=201||e>=212&&e<=216)&&tt[ie+1]===115?n=new Set:n={};let r={target:n};Yl.set(t,r);let s=qr();if(r.used)Object.assign(n,s);else return r.target=s;if(n instanceof Map)for(let[o,a]of s.entries())n.set(o,a);if(n instanceof Set)for(let o of Array.from(s))n.add(o);return n};qi[112]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=sn.getUint32(ie-4),e=Yl.get(t);return e.used=!0,e.target};qi[115]=()=>new Set(qr());WZ=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array"),qZ=typeof globalThis=="object"?globalThis:window;qi[116]=i=>{let t=i[0],e=Uint8Array.prototype.slice.call(i,1).buffer,n=WZ[t];if(!n){if(t===16)return e;if(t===17)return new DataView(e);throw new Error("Could not find typed array for code "+t)}return new qZ[n](e)};qi[120]=()=>{let i=qr();return new RegExp(i[0],i[1])};XZ=[];qi[98]=i=>{let t=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],e=ie;return ie+=t-i.length,Pi=XZ,Pi=[cB(),cB()],Pi.position0=0,Pi.position1=0,Pi.postBundlePosition=ie,ie=e,qr()};qi[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");SB=new Array(147);for(let i=0;i<256;i++)SB[i]=+("1e"+Math.floor(45.15-i*.30103));kS=new du({useRecords:!1}),bfe=kS.unpack,xfe=kS.unpackMultiple,Sfe=kS.unpack,YZ=new Float32Array(1),wfe=new Uint8Array(YZ.buffer,0,4)});var $Z,KZ,VS,EB=F(()=>{"use strict";wB();PS();LS();au();Uy();su();$Z=[{Class:at.prototype.constructor,type:1,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,at.prototype),i}},{Class:ze.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,ze.prototype),i}},{Class:Ln.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Ln.prototype),i}},{Class:Pd.prototype.constructor,type:4,write(i){return i.id},read(i){return new Pd(i)}},{Class:Fy.prototype.constructor,type:5,write(i){return i.data},read(i){return new Fy(i)}},{Class:Zn.prototype.constructor,type:6,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,Zn.prototype),i}}];for(let i of $Z)xB(i);KZ=new du({structuredClone:!0});(t=>{function i(e){return KZ.unpack(e)}t.deserialize=i})(VS||(VS={}))});var TB,Dd,MB=F(()=>{"use strict";EB();TB=i=>()=>{throw new Error(i+" is not available in the runtime build (decode-only CollabSerialize)")},Dd={deserialize:VS.deserialize,serialize:TB("CollabSerialize.serialize"),checksum:TB("CollabSerialize.checksum")}});var on=F(()=>{Vy();G3();IS();su();Uy();RS();au();Y3();Z3();mC();J3();PS();MB();cC();LS()});function jy(i){return i==="MouseDown"||i==="MouseUp"||i==="KeyDown"||i==="KeyUp"||i==="Collision"||i==="Trigger"}var _B,_C,Ld,zS,MC,AB,CB,PB,GS,jS,IB,RB,OB,DB,LB,HS,WS,NB,BB,FB,UB,AC=F(()=>{"use strict";on();X();(e=>{function i(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type}e.toEventUIType=i;function t(n){return n==="Distance"||n==="StateChange"?"Conditional":n}e.fromEventUIType=t})(_B||(_B={}));_C={["LookAt"]:[],["Follow"]:["Create"],["DragDrop"]:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseHover"]:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Scroll"]:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Start"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Conditional"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MousePress"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyPress"]:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["GameControl"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],["Collision"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Trigger"]:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Resize"]:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["VariableChange"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["API"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["WEBHOOK"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["AIAssistantListener"]:["SetVariable"],["AIAssistantTrigger"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(e=>{function i(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"}e.is=i;function t(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new ze}:{type:n,disabled:!1,name:"",key:void 0,actions:new ze}}e.defaultData=t})(Ld||(Ld={}));(e=>{function i(n){return{type:"Property",value:[n??null,"position","x"]}}e.propertyDefaultData=i,e.valueDefaultData={type:"Literal",value:0}})(zS||(zS={}));(n=>{function i(r){return{type:"Comparison",operator:"==",lOperand:zS.propertyDefaultData(r),rOperand:{...zS.valueDefaultData}}}n.comparisonDefaultData=i;function t(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}}n.distanceDefaultData=t;function e(r,s){return{type:"State",object:r??null,state:s??null}}n.stateDefaultData=e})(MC||(MC={}));(t=>{function i(e){return e.find(n=>n==="ifActions"||n==="elseActions")!==void 0}t.isConditionalSubActions=i})(AB||(AB={}));(e=>{function i(n){return n.type==="Conditional"}e.is=i;function t(n){return{type:"Conditional",disabled:!1,name:"",inActions:new ze,outActions:new ze,condition:MC.distanceDefaultData(n)}}e.defaultData=t})(CB||(CB={}));(t=>t.defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new ze,drop:new ze}})(PB||(PB={}));(t=>t.defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new ze})(GS||(GS={}));(t=>t.defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5})(jS||(jS={}));(e=>{function i(n){return n.type==="MouseHover"}e.is=i;function t(){return{type:"MouseHover",disabled:!1,name:"",actions:new ze}}e.defaultData=t})(IB||(IB={}));(e=>{function i(n){return n.type==="Scroll"}e.is=i;function t(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new ze}}e.defaultData=t})(RB||(RB={}));(e=>{function i(n){return n.type==="Start"}e.is=i;function t(){return{type:"Start",disabled:!1,name:"",actions:new ze}}e.defaultData=t})(OB||(OB={}));(e=>{function i(n){return n.type==="Collision"}e.is=i;function t(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new ze}}e.defaultData=t})(DB||(DB={}));(e=>{function i(n){return n.type==="Trigger"}e.is=i;function t(n,r){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new ze,triggerZone:"box",position:r.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}e.defaultData=t})(LB||(LB={}));(o=>{o.defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]};function t(a){return a.type==="Resize"}o.is=t;function e(a){return typeof a=="string"?a:"custom"}o.sizeToDevice=e;function n(a){return typeof a=="string"?[...o.defaultSizes[a]]:[...a]}o.deviceToSize=n;function r(){let a={size:"mobile",operator:"<",actions:new ze},l={size:"tablet",operator:"<",actions:new ze},c={size:[...o.defaultSizes.custom],operator:"<>",actions:new ze},u=new ze;return u.push({id:xe.generateUUID(),fi:0,data:a},{id:xe.generateUUID(),fi:1,data:l},{id:xe.generateUUID(),fi:2,data:c}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:u}}o.defaultData=r;function s(){return{size:[...o.defaultSizes.custom],operator:"<>",actions:new ze}}o.defaultBreakpointData=s})(HS||(HS={}));(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]};function t(r){return r.type==="VariableChange"}n.is=t;function e(){return{disabled:!1,type:"VariableChange",name:"",actions:new ze,variableId:"",objectId:null,property:"Position X"}}n.defaultData=e})(WS||(WS={}));(e=>{function i(n){return n.type==="API"}e.is=i;function t(){return{disabled:!1,type:"API",name:"",successActions:new ze,errorActions:new ze,userAPIId:""}}e.defaultData=t})(NB||(NB={}));(e=>{function i(n){return n.type==="WEBHOOK"}e.is=i;function t(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new ze,userWebhookId:""}}e.defaultData=t})(BB||(BB={}));(e=>{function i(n){return n.type==="AIAssistantListener"}e.is=i;function t(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new ze,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=t})(FB||(FB={}));(e=>{function i(n){return n.type==="AIAssistantTrigger"}e.is=i;function t(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new ze}}e.defaultData=t})(UB||(UB={}))});function zB(i){let t=typeof i;return i!==null&&(t==="object"||t==="function")}function CC(i){return typeof i=="string"&&i.length===36?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(i):!1}var po,pu,GB,wr,XS,Ws,ho,Nd,kB,hu,gr,Vt,qS,Bd,Qo,$l,VB,Es=F(()=>{"use strict";po="personal camera",pu="a218fcc3-276b-49b9-b485-49037fd14f5f",GB=2500134,wr=5526619,XS=(n=>(n.x="x",n.y="y",n.z="z",n))(XS||{});(p=>{function i(f,g){return f[0]===g[0]&&f[1]===g[1]}p.isEqual=i;function t(f,g,m){return[f[0]+(g[0]-f[0])*m,f[1]+(g[1]-f[1])*m]}p.lerp=t;function e(f,g){return[f[0]+g[0],f[1]+g[1]]}p.add=e;function n(f,g){return[f[0]-g[0],f[1]-g[1]]}p.sub=n;function r(f,g){return[f[0]*g[0],f[1]*g[1]]}p.multiply=r;function s(f,g){return[f[0]/g[0],f[1]/g[1]]}p.divide=s;function o(f,g){return Math.pow(g[0]-f[0],2)+Math.pow(g[1]-f[1],2)}p.distanceSquared=o;function a(f,g){return Math.sqrt(o(f,g))}p.distance=a;function l(f,g){return f[0]*g[0]+f[1]*g[1]}p.dot=l;function c(f,g){return[f[0]*g,f[1]*g]}p.scalarMultiply=c;function u(f,g,m){let y=p.sub(g,f),v=p.sub(m,f),b=p.dot(y,v)/p.dot(y,y),x=p.scalarMultiply(y,b);return p.add(f,x)}p.projectionOnto=u;function d(f,g,m){return a(f,u(f,g,m))}p.projectionOntoDistance=d;function h(f,g){return[(f[0]+g[0])*.5,(f[1]+g[1])*.5]}p.center=h})(Ws||(Ws={}));(a=>{function i(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]}a.isEqual=i;function t(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}a.add=t;function e(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]}a.sub=e;function n(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]}a.div=n;function r(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]}a.mul=r;function s(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])}a.dist=s;function o(l,c,u){return[l[0]+(c[0]-l[0])*u,l[1]+(c[1]-l[1])*u,l[2]+(c[2]-l[2])*u]}a.lerp=o})(ho||(ho={}));(e=>{function i(n,r){return n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3]}e.isEqual=i;function t(n,r,s){return[n[0]+(r[0]-n[0])*s,n[1]+(r[1]-n[1])*s,n[2]+(r[2]-n[2])*s,n[3]+(r[3]-n[3])*s]}e.lerp=t})(Nd||(Nd={}));(o=>{let i=180/Math.PI,t=Math.PI/180;function e(a){return typeof a=="number"?a*i:a}function n(a){return typeof a=="number"?a*t:a}function r(a){return[e(a[0]),e(a[1]),e(a[2])]}o.radToDeg=r;function s(a){return[n(a[0]),n(a[1]),n(a[2])]}o.degToRad=s})(kB||(kB={}));(r=>{r.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(s,o){for(let a=0;a<16;a++)if(s[a]!==o[a])return!1;return!0}r.isEqual=t;function e(s){return s??r.identity}r.simplify=e;function n(s,o){let a=o.slice(0);for(let l=0,c=o.length;l<c;l+=3){let u=s[3]*o[l]+s[7]*o[l+1]+s[11]*o[l+2]+s[15];a[l]=(s[0]*o[l]+s[4]*o[l+1]+s[8]*o[l+2]+s[12])/u,a[l+1]=(s[1]*o[l]+s[5]*o[l+1]+s[9]*o[l+2]+s[13])/u,a[l+2]=(s[2]*o[l]+s[6]*o[l+1]+s[10]*o[l+2]+s[14])/u}return a}r.applyMatrix4=n})(hu||(hu={}));(h=>{function i(p){return typeof p=="object"&&typeof p.r=="number"&&typeof p.g=="number"&&typeof p.b=="number"}h.isRGB=i,h.white={r:1,g:1,b:1},h.red={r:1,g:0,b:0},h.black={r:0,g:0,b:0};function r(p){return{r:Math.round(p.r*255),g:Math.round(p.g*255),b:Math.round(p.b*255),a:1}}h.toRgb255a1=r;function s(p){return{r:p.r,g:p.g,b:p.b}}h.clone=s;function o(p){return p=Math.floor(p),{r:(p>>16&255)/255,g:(p>>8&255)/255,b:(p&255)/255}}h.fromHex=o;function a(p){return Math.round(p.r*255)*65536+Math.round(p.g*255)*256+Math.round(p.b*255)}h.toHex=a;function l(p,f){return p.r===f.r&&p.g===f.g&&p.b===f.b}h.equals=l;function c(p,f){return p.r.toFixed(2)===f.r.toFixed(2)&&p.g.toFixed(2)===f.g.toFixed(2)&&p.b.toFixed(2)===f.b.toFixed(2)}h.equalsFixed=c;function u(p,f,g){return{r:p.r+(f.r-p.r)*g,g:p.g+(f.g-p.g)*g,b:p.b+(f.b-p.b)*g}}h.lerp=u;function d(p){return zB(p)?"r"in p&&"g"in p&&"b"in p&&!("a"in p):!1}h.is=d})(gr||(gr={}));(u=>{u.white={...gr.white,a:1};function t(d){return zB(d)?"r"in d&&"g"in d&&"b"in d&&"a"in d:!1}u.is=t,u.transparent={...gr.white,a:0};function n(d){return{r:d[0],g:d[1],b:d[2],a:d[3]}}u.from0to1=n;function r(d,h){return{...gr.fromHex(d),a:h}}u.fromHexAndA=r;function s(d){return{r:Math.round(d.r*255),g:Math.round(d.g*255),b:Math.round(d.b*255),a:d.a}}u.toRgb255a1=s;function o(d,h){return gr.equals(d,h)&&d.a===h.a}u.equals=o;function a(d,h){return gr.equalsFixed(d,h)&&d.a.toFixed(2)===h.a.toFixed(2)}u.equalsFixed=a;function l(d,h,p){return{r:d.r+(h.r-d.r)*p,g:d.g+(h.g-d.g)*p,b:d.b+(h.b-d.b)*p,a:d.a+(h.a-d.a)*p}}u.lerp=l;function c({r:d,g:h,b:p,a:f}=u.white){return`rgba(${d*255}, ${h*255}, ${p*255}, ${f})`}u.toStyle=c})(Vt||(Vt={}));(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]})(qS||(qS={}));Bd=(c=>(c[c.LINEAR=0]="LINEAR",c[c.EASE=1]="EASE",c[c.EASE_IN=2]="EASE_IN",c[c.EASE_OUT=3]="EASE_OUT",c[c.EASE_IN_OUT=4]="EASE_IN_OUT",c[c.CUBIC=5]="CUBIC",c[c.SPRING=6]="SPRING",c[c.ARC=7]="ARC",c[c.NONE=8]="NONE",c))(Bd||{});(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Qo||(Qo={}));(t=>t.defaultData={control1:[.5,0],control2:[.5,1]})($l||($l={}));(s=>(s.linear=[0,0,1,1],s.ease=[.25,.1,.25,1],s.easeIn=[.42,0,1,1],s.easeOut=[0,0,.58,1],s.easeInOut=[.42,0,.58,1]))(VB||(VB={}))});var jB,HB,WB,qB,XB,YB,$B,PC,KB,ZB,IC,QB,JB,eF,RC,tF,OC,nF,rF,iF,sF,oF,aF,lF,cF,uF=F(()=>{"use strict";on();AC();(t=>t.defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"})(jB||(jB={}));(t=>t.defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"})(HB||(HB={}));(t=>t.defaultData={type:"Link",name:"",url:null,context:"tab"})(WB||(WB={}));(t=>t.defaultData={type:"Destroy",name:"",objects:[],delay:0})(qB||(qB={}));(t=>t.defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"})(XB||(XB={}));(t=>t.defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"})(YB||(YB={}));(t=>t.defaultData={type:"Reset",name:"",delay:0})($B||($B={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1})(PC||(PC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(KB||(KB={}));(s=>(s.defaultData={type:"Audio",name:"",...PC.defaultData},s.hasAudioByActions=o=>o.some(({data:a})=>a.type==="Audio"&&a.interaction==="play"&&a.audio),s.hasAudioByEvents=o=>{for(let{data:a}of o)if(Ld.is(a)||a.type==="Start"||a.type==="Collision"){if(s.hasAudioByActions(a.actions))return!0}else if(a.type==="Conditional"){if(s.hasAudioByActions(a.inActions)||s.hasAudioByActions(a.outActions))return!0}else if(a.type==="GameControl"&&Object.values(a.gameActions).find(l=>s.hasAudioByActions(l)))return!0},s.getAudiosByActions=o=>{let a=[];return o.forEach(l=>{let c=l.data;c.type==="Audio"&&c.interaction==="play"&&c.audio&&a.push(l),c.type==="Conditional"&&(a.push(...s.getAudiosByActions(c.ifActions)),a.push(...s.getAudiosByActions(c.elseActions)))}),a},s.getAudiosByEvents=o=>{let a=[];return o.forEach(({data:l})=>{Ld.is(l)||l.type==="Collision"||l.type==="Start"||l.type==="Trigger"?a.push(...s.getAudiosByActions(l.actions)):l.type==="Conditional"?(a.push(...s.getAudiosByActions(l.inActions)),a.push(...s.getAudiosByActions(l.outActions))):l.type==="GameControl"?Object.values(l.gameActions).forEach(c=>{a.push(...s.getAudiosByActions(c))}):l.type==="DragDrop"&&(a.push(...s.getAudiosByActions(l.dragDropActions.drag)),a.push(...s.getAudiosByActions(l.dragDropActions.drop)))}),a}))(ZB||(ZB={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1/0})(IC||(IC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(QB||(QB={}));(s=>(s.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...IC.defaultData},s.hasVideoByActions=o=>o.some(({data:a})=>a.type==="Video"&&a.interaction==="play"&&a.layerId),s.hasVideoByObject=o=>{if(o.events){for(let{data:a}of o.events)if((Ld.is(a)||a.type==="Start")&&s.hasVideoByActions(a.actions))return!0}},s.getVideosByActions=o=>{let a=[];return o.forEach(l=>{let c=l.data;c.type==="Video"&&c.interaction==="play"&&c.layerId&&a.push(l)}),a},s.getVideosByEvents=o=>{let a=[];return o.forEach(({data:l})=>{(Ld.is(l)||l.type==="Start")&&a.push(...s.getVideosByActions(l.actions))}),a}))(JB||(JB={}));(t=>{function i(e){return{state:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}}t.defaultData=i})(eF||(eF={}));(t=>{function i(){return{tweens:new ze,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}}t.defaultData=i})(RC||(RC={}));(t=>{function i(e){return{type:"Transition",name:"",runMode:"Once",object:e??null,...RC.defaultData()}}t.defaultData=i})(tF||(tF={}));(t=>{function i(e){return{interaction:"play",timeline:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}}t.defaultData=i})(OC||(OC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(nF||(nF={}));(t=>{function i(e){return{type:"TimelineAnimation",name:"",...OC.defaultData(e)}}t.defaultData=i})(rF||(rF={}));(t=>{function i(e,n,r){return{type:"Animation",name:"",object:e,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}}t.defaultData=i})(iF||(iF={}));(t=>t.defaultData={type:"SetVariable",name:"",variableId:"",expression:[]})(sF||(sF={}));(t=>t.defaultData=()=>({type:"Conditional",name:"",ifActions:new ze,elseActions:new ze,condition:[]}))(oF||(oF={}));(t=>t.defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0})(aF||(aF={}));(t=>t.defaultData={type:"ClearLocalStorage",name:"",target:"all"})(lF||(lF={}));(t=>t.defaultData={name:"",type:"UserAPI"})(cF||(cF={}))});var dF,hF=F(()=>{"use strict";(e=>(e.emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),n=>n.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6))(dF||(dF={}))});var Jo,ea,DC=F(()=>{"use strict";(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(n){return e.all.includes(n)}e.is=t})(Jo||(Jo={}));(p=>{p.DefaultUp=[0,1,0],p.DefaultTargetOffset=1e3,p.MinTargetOffset=.001;function n(f){return f===void 0||!Number.isFinite(f)||f<p.MinTargetOffset?p.DefaultTargetOffset:f}p.sanitizeTargetOffset=n,p.DefaultAzimuth=-24,p.DefaultElevation=15;let o=p.DefaultAzimuth*Math.PI/180,a=p.DefaultElevation*Math.PI/180,l=180/Math.PI;p.DefaultPosition=[p.DefaultTargetOffset*Math.sin(o)*Math.cos(a),p.DefaultTargetOffset*Math.sin(a),p.DefaultTargetOffset*Math.cos(o)*Math.cos(a)],p.DefaultRotation=[Math.atan2(-Math.sin(a),Math.cos(o)*Math.cos(a))*l,Math.asin(Math.sin(o)*Math.cos(a))*l,Math.atan2(Math.sin(o)*Math.sin(a),Math.cos(o))*l],p.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:p.DefaultUp,isUpVectorFlipped:!1,targetOffset:p.DefaultTargetOffset};function h(f){return f.type==="PerspectiveCamera"?f.perspective?.zoom??1:f.orthographic?.zoom??1}p.getZoom=h})(ea||(ea={}))});var Na,YS,LC,$S,KS,ZS,QS,JS,NC=F(()=>{"use strict";(n=>{function i(r,s=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:Math.max(typeof r[0]=="number"?r[0]:1,typeof r[1]=="number"?r[1]:1)*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof r[0]=="number"?r[0]+r[0]:1)*s,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:r.map(o=>(typeof o=="number"?o:1)*(1+s)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}}n.defaultData=i;function t(r,s){let o={...r};if(LC.forEach(a=>{Object.assign(o,{[a]:s[a]??r[a]})}),o.radial={...r.radial},s.radial){let a=r.radial,l=s.radial;$S.forEach(c=>{Object.assign(o.radial,{[c]:l[c]??a[c]})})}if(o.linear={...r.linear},s.linear){let a=r.linear,l=s.linear;KS.forEach(c=>{Object.assign(o.linear,{[c]:l[c]??a[c]})})}if(o.grid={...r.grid},s.grid){let a=r.grid,l=s.grid;ZS.forEach(c=>{Object.assign(o.grid,{[c]:l[c]??a[c]})})}if(o.toObject={...r.toObject},s.toObject){let a=r.toObject,l=s.toObject;QS.forEach(c=>{Object.assign(o.toObject,{[c]:l[c]??a[c]})})}if(o.randomnessObject={...r.randomnessObject},s.randomnessObject){let a=r.randomnessObject,l=s.randomnessObject;JS.forEach(c=>{Object.assign(o.randomnessObject,{[c]:l[c]??a[c]})})}return o}n.merge=t;function e(r){return!!(r.randomnessObject||r.toObject)}n.isPartial=e})(Na||(Na={}));(n=>{n.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function e(r,s){let o=[];r.count!==void 0&&o.push({type:0,path:s,props:{count:r.count}});for(let a of t){let l=r[a];l&&Object.keys(l).length>0&&o.push({type:0,path:[...s,a],props:l})}return o}n.toOps=e})(YS||(YS={}));LC=["count"],$S=["radius","start","end","position","scale","rotation"],KS=["position","scale","rotation"],ZS=["count","size"],QS=["count","position","scale","rotation"],JS=["strength","scale","rotation","position","movement","seed","freqScale"]});var e1,t1,BC=F(()=>{"use strict";Es();(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(n){return e.all.includes(n)}e.is=t})(e1||(e1={}));(e=>{function i(n){return t(n)}e.defaultData=i;function t(n){if(n==="PointLight")return{type:n,color:Vt.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(n==="SpotLight")return{type:n,color:Vt.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(n==="DirectionalLight")return{type:n,color:Vt.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(t1||(t1={}))});var qp,FC=F(()=>{"use strict";(n=>(n.defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},n.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},n.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:n.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...n.defaultCollisionData}))(qp||(qp={}))});var n1,UC=F(()=>{"use strict";(e=>(e.defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]))(n1||(n1={}))});var fu,r1=F(()=>{"use strict";(t=>t.defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]})(fu||(fu={}))});var s1,kC,VC,i1,pF,zC=F(()=>{"use strict";s1=(n=>(n[n.Front=0]="Front",n[n.Back=1]="Back",n[n.Double=2]="Double",n))(s1||{});(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(n,r){return n.castShadow===r.castShadow&&n.receiveShadow===r.receiveShadow}e.equals=t})(kC||(kC={}));(e=>{e.defaultData={flatShading:!1,wireframe:!1,side:0};function t(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}e.equals=t})(VC||(VC={}));(t=>t.defaultData={...VC.defaultData,...kC.defaultData})(i1||(i1={}));(t=>{function i(e,n){let r=[];if("material"in e){let s=typeof e.material=="string"?n.materials[e.material]??n.lib.materials[e.material]?.asset:e.material;s&&r.push(s)}else if("materials"in e)for(let s of e.materials){let o=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;o&&r.push(o)}return r}t.getMaterialData=i})(pF||(pF={}))});var Xp,GC=F(()=>{"use strict";(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(Xp||(Xp={}))});function yF(i){return i.type!=="displace"}var fF,mF,Hy,gF,o1,Yp,a1,jC,HC,l1,WC,qC,$p,c1,Qn,An,Kp=F(()=>{"use strict";on();Es();GC();Es();(t=>{function i(e){return e==="texture"||e==="video"||e==="color"||e==="depth"||e==="normal"||e==="gradient"||e==="noise"||e==="fresnel"||e==="cavity"||e==="dust"||e==="rainbow"||e==="toon"||e==="outline"||e==="particle"||e==="transmission"||e==="reflection"||e==="matcap"||e==="displace"||e==="pattern"||e==="vertexColor"||e==="light"}t.is=i})(fF||(fF={}));(t=>{function i(e){return e==="luminance"||e==="r"||e==="g"||e==="b"||e==="a"}t.is=i})(mF||(mF={}));(t=>{function i(e){return typeof e=="object"&&e!==null&&e.image!=null}t.is=i})(Hy||(Hy={}));(t=>{function i(e){return e==="phong"||e==="toon"||e==="lambert"||e==="physical"}t.is=i})(gF||(gF={}));o1=(n=>(n[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",n))(o1||{}),Yp=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(Yp||{}),a1=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(a1||{}),jC=(s=>(s[s.UV=0]="UV",s[s.Planar=1]="Planar",s[s.Spherical=2]="Spherical",s[s.Cylindrical=3]="Cylindrical",s[s.Triplanar=4]="Triplanar",s))(jC||{}),HC=(o=>(o[o.Simplex=0]="Simplex",o[o.SimplexFractal=1]="SimplexFractal",o[o.Ashima=2]="Ashima",o[o.Fbm=3]="Fbm",o[o.Perlin=4]="Perlin",o[o.Voronoi=5]="Voronoi",o))(HC||{}),l1=(l=>(l[l.F1=0]="F1",l[l.F2=1]="F2",l[l.F2MinusF1=2]="F2MinusF1",l[l.SmoothBlend=3]="SmoothBlend",l[l.Edge=4]="Edge",l[l.Power=5]="Power",l[l.Lines=6]="Lines",l[l.Cells=7]="Cells",l))(l1||{}),WC=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(WC||{}),qC=(l=>(l[l.Circle=0]="Circle",l[l.Ring=1]="Ring",l[l.Polygon=2]="Polygon",l[l.Cross=3]="Cross",l[l.Diamond=4]="Diamond",l[l.Checkerboard=5]="Checkerboard",l[l.Line=6]="Line",l[l.Wave=7]="Wave",l))(qC||{}),$p=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],c1=["wrapping","image","video","name","minFilter","magFilter"];(s=>{function i(o,a){let{texture:l,...c}=a;if(Object.assign(o,c),l){let u=o.texture;u&&Object.assign(u,l)}}s.patch=i;function t(o){return{...s.defaultData("color"),color:o}}s.defaultColorLayer=t;function e(o,a){return o==="light"&&a?n(a):r(o)}s.defaultData=e;function n(o){let a={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...a,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...a,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...a,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...a,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}function r(o){let a={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...a,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...a,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Xp.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...a,type:"color",color:gr.fromHex(wr)};case"vertexColor":return{...a,type:"vertexColor"};case"depth":return{...a,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...a,type:"normal",cnormal:[1,1,1]};case"gradient":return{...a,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...a,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...gr.fromHex(6710886),a:1},colorB:{...gr.fromHex(6710886),a:1},colorC:{...gr.fromHex(16777215),a:1},colorD:{...gr.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...a,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...a,type:"fresnel",color:Vt.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...a,type:"dust",color:Vt.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...a,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...a,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Vt.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...a,type:"outline",outlineColor:Vt.fromHexAndA(0,1),contourColor:Vt.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...a,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...a,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...a,type:"reflection",blur:0,thickness:10/1e4,steps:60,stepSize:5/1e3,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...a,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...gr.fromHex(0),a:1},colorB:{...gr.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}})(Qn||(Qn={}));(u=>{function i(d){return!d.layers.some(p=>p.data.type==="texture"&&p.data.projection!==0||p.data.type==="depth"&&!p.data.isWorldSpace||p.data.type==="noise"||p.data.type==="dust"&&p.data.noiseStrength!==0||p.data.type==="displace")}u.isMergable=i;function t(d){let h="";return d.layers.forEach(p=>{Object.entries(p.data).forEach(([f,g])=>{h+=`${f}${g}`,Array.isArray(g)?g.forEach(m=>h+=`${m}`):typeof g=="object"?Object.values(g).forEach(m=>{typeof m=="number"?h+=`${m.toFixed(4)}`:h+=`${m}`}):h+=`${g}`})}),h}u.getHash=t;function e(){return{layers:new ze}}u.defaultEmptyData=e;function n(d="layer1",h="layer2"){return s("physical",d,h)}u.defaultData=n;function r(d,h){return{...d,name:h}}u.withName=r;function s(d,h="layer1",p="layer2",f=gr.fromHex(16777215)){let g=new ze;return g.push({fi:0,data:Qn.defaultData("light",d),id:h}),g.push({fi:1,data:Qn.defaultData("color"),id:p}),{layers:g}}u.defaultTwoLayerData=s;function o(d,h,p="layer1",f="layer2"){let g=new ze;return g.push({fi:0,data:Qn.defaultData("light",h),id:p}),g.push({fi:1,data:Qn.defaultColorLayer(d),id:f}),{layers:g}}u.defaultColorMaterial=o;function a(d){let h=Qn.defaultData("texture");d&&Object.assign(h.texture,{image:d});let p=new ze;return p.push({fi:0,data:h,id:"layer1"}),p.push({fi:1,data:{...Qn.defaultData("transmission"),alpha:1},id:"layer2"}),p.push({fi:2,data:{...Qn.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:p}}u.defaultUIObjectMaterial=a;function l(d,h="physical",p="layer1",f="layer2"){let g=Qn.defaultData("texture");Object.assign(g.texture,{image:d});let m=new ze;return m.push({fi:0,data:g,id:p}),m.push({fi:1,data:Qn.defaultData("light",h),id:f}),{layers:m}}u.defaultTwoLayerTextureData=l;function c(d,h="physical",p="layer1",f="layer2"){let g=Qn.defaultData("video");Object.assign(g.texture,{video:d});let m=new ze;return m.push({fi:0,data:g,id:p}),m.push({fi:1,data:Qn.defaultData("light",h),id:f}),{layers:m}}u.defaultTwoLayerVideoTextureData=c})(An||(An={}))});var Zp,vF,bF=F(()=>{"use strict";Zp="Roboto_regular",vF="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"});var Fd,XC=F(()=>{"use strict";on();(t=>{function i(){return{points:new ze,roundness:0,shapeHoles:[],isClosed:!1}}t.defaultData=i})(Fd||(Fd={}))});var Qp,Ud,u1,d1,Wy,YC=F(()=>{"use strict";on();(t=>{function i(){return{points:new ze,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}t.defaultData=i})(Qp||(Qp={}));Ud={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(t=>{function i(e,n){let r={...e};return Wy.forEach(s=>{Object.assign(r,{[s]:n[s]??e[s]})}),r}t.merge=i})(u1||(u1={}));d1={shape:Ud,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},Wy=["depth","offset","angle","twist","startScale","endScale"]});var qy,h1,fo,p1,f1=F(()=>{"use strict";XC();YC();(n=>{function i(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="UIGeometry"}n.is2DParametricMesh=i;function t(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="BooleanGeometry"||r==="TextGeometry"||r==="InputGeometry"||r==="DecalGeometry"}n.isParametricMesh=t;function e(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="TextGeometry"||r==="SubdivGeometry"||r==="NonParametricGeometry"}n.isSwappableGeometry=e})(qy||(qy={}));(t=>{function i(e,n){let r={...e};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...e.extrusion},Object.assign(r.extrusion,u1.merge(r.extrusion,n.extrusion))),r}t.merge=i})(h1||(h1={}));(t=>{function i(e){if(e==="RectangleGeometry")return{width:320,height:320,type:e,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="UIGeometry")return{type:e,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(e==="PathGeometry")return{type:e,width:1,height:1,depth:1,path:Qp.defaultData(),extrusion:d1};if(e==="VectorGeometry")return{width:1,height:1,type:e,subdivisions:12,shape:Fd.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="BooleanGeometry")return{type:e,operation:2,width:0,height:0,depth:0,phongAngle:35};if(e==="ShapeBlendGeometry")return{type:e,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(e==="DecalGeometry")return{type:e,width:200,height:200,depth:200,offset:1};if(e==="TextGeometry")return{type:e,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="InputGeometry")return{...t.defaultData("TextGeometry"),type:e,editable:!0};if(e==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")}t.defaultData=i})(fo||(fo={}));p1=["width","height","depth"]});var Br,$C=F(()=>{"use strict";Es();(o=>{o.defaultData={enabled:!1,useBackgroundColor:!1,color:gr.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0};function t(a){return a.mode??"linear"}o.getMode=t;function e(a){let l=t(a);return l==="height"?1:l==="both"?2:0}o.getModeIndex=e;function n(a){return a.density??o.defaultData.density}o.getDensity=n;function r(a){return a.heightFalloff??o.defaultData.heightFalloff}o.getHeightFalloff=r;function s(a){return a.heightBase??o.defaultData.heightBase}o.getHeightBase=s})(Br||(Br={}))});var KC,Ba,m1=F(()=>{"use strict";(t=>t.defaultData={image:null,rotation:0,blur:32,showBackground:!0})(KC||(KC={}));(t=>t.defaultData={enabled:!1,mode:"hdri",hdri:KC.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2})(Ba||(Ba={}))});var Jp,ZC=F(()=>{"use strict";(e=>{let i={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:{...i,blendFunction:16,granularity:15},bloom:{...i,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...i,offset:[2,2]},vignette:{...i,darkness:1,offset:0},hueSaturation:{...i,hue:3,saturation:0},brightnessContrast:{...i,brightness:.25,contrast:0},depthOfField:{...i,focusDistance:100,focalLength:20,bokehScale:5},noise:{...i,blendFunction:16}}})(Jp||(Jp={}))});var kd,QC,JC,eP,mu,tP,g1,y1=F(()=>{"use strict";$C();m1();ZC();Es();(e=>{e.defaultData={type:"normal",softShadowQuality:"low"};function t(n){return n==null?!1:n.type===void 0||n.type==="soft"}e.isSoft=t})(kd||(kd={}));(t=>t.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(QC||(QC={}));(t=>t.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(JC||(JC={}));(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1};function t(n){return n===void 0||n.pipeline==="classic"&&(n.toneMapping==="none"||n.toneMapping==="aces")&&n.exposure===1}e.isUntouched=t})(eP||(eP={}));(t=>t.defaultData={usePhysics:!1,gravity:-10})(mu||(mu={}));(t=>t.defaultData={playCamera:po,gameControlObject:null})(tP||(tP={}));(t=>t.defaultData={backgroundColor:Vt.fromHexAndA(GB,1),postprocessing:Jp.defaultData,fog:Br.defaultData,sky:Ba.defaultData,globalPhysics:mu.defaultData,ambient:QC.defaultData,ao:JC.defaultData,shadow:kd.defaultData,publish:tP.defaultData,grading:eP.defaultData})(g1||(g1={}))});var v1,xF=F(()=>{"use strict";(t=>t.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(v1||(v1={}))});var SF,ef,AF,Fr,tf,wF,EF,TF,MF,mo,Vd,nf,rf,go,ta,_F,na,Xy=F(()=>{"use strict";on();DC();BC();FC();UC();r1();zC();Es();Kp();f1();NC();mi();y1();xF();(e=>{function i(n){return n==="Component"||n==="Instance"}e.isComponentRelated=i;function t(n){return n==="Empty"||n==="Instance"}e.isEmptyOrComponent=t})(SF||(SF={}));(r=>{r.identity={...qS.identity,hiddenMatrix:hu.identity};function t(s){return{position:s.position,rotation:s.rotation,scale:s.scale,pivot:s.pivot,pivotRotation:s.pivotRotation,hiddenMatrix:s.hiddenMatrix}}r.fromObject=t;function e(s,o){return{position:o?.position||s.position,rotation:o?.rotation||s.rotation,pivot:o?.pivot||s.pivot,pivotRotation:o?.pivotRotation||s.pivotRotation,scale:o?.scale||s.scale,hiddenMatrix:o?.hiddenMatrix||s.hiddenMatrix}}r.merge=e;function n(s,o){return AS({position:ho.isEqual(s.position,o.position)?void 0:o.position,rotation:ho.isEqual(s.rotation,o.rotation)?void 0:o.rotation,scale:ho.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:hu.isEqual(s.hiddenMatrix,o.hiddenMatrix)?void 0:o.hiddenMatrix})}r.diff=n})(ef||(ef={}));AF=["slide","offset"];(t=>t.defaultData={states:new ze,events:new ze,visible:!0,raycastLock:!1,physics:fu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...ef.identity,cloner:null})(Fr||(Fr={}));(t=>t.defaultData={type:"Empty",...Fr.defaultData})(tf||(tf={}));(t=>t.defaultData={type:"ParticleCollider",...v1.defaultData,...Fr.defaultData})(wF||(wF={}));(t=>t.defaultData={type:"Component",...Fr.defaultData})(EF||(EF={}));(t=>t.defaultData={type:"Particle",...Fr.defaultData,...qp.defaultData})(TF||(TF={}));(t=>t.defaultData={type:"Hair",...Fr.defaultData,...n1.defaultData})(MF||(MF={}));(t=>t.defaultData={type:"Mesh",...Fr.defaultData,...i1.defaultData})(mo||(mo={}));(t=>t.defaultData={...Fr.defaultData,...ef.identity,position:ea.DefaultPosition,rotation:ea.DefaultRotation,...ea.defaultData})(Vd||(Vd={}));(e=>{function i(n){return{...Fr.defaultData,...t1.defaultData(n)}}e.defaultData=i,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(nf||(nf={}));(e=>{function i(n,r,s=0){for(;s<r.length;){let o=n?n[r[s]]:void 0;if(r.length===s+1)return o;if(o)n=o.descendants,s+=1;else return}}e.resolveWithDes=i;function t(n,r,s=0){let o=i(n,r,s);if(o){let a=Object.keys(o);if(a.length===1&&a[0]==="descendants")return}return o}e.resolve=t})(rf||(rf={}));(s=>{s.rootOverrideProps=["physics","events"],s.compositeNonOptionalOverrideProps=["geometry"],s.compositeEntireOverrideOverrideProps=["material"];function n(o,a){return{...Fr.defaultData,...a,component:o,overrides:new Zn,physics:void 0,events:void 0,type:"Instance"}}s.ofComponent=n;function r(o){let a=ef.fromObject(o.data);return n(o.id,a)}s.fromComponentData=r})(go||(go={}));(e=>{e.defaultData={type:"Page",...Fr.defaultData,physics:{...fu.defaultData,fusedBody:!1},...g1.defaultData,camera:Vd.defaultData,timelines:new at};function t(n){return n.uiScene!==void 0}e.isUIPage=t})(ta||(ta={}));(a=>(a.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:hu.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:fu.defaultData,states:new ze,events:new ze,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...ea.defaultData},a.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},a.defaultMeshObject={name:"Rectangle",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("RectangleGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultBooleanObject={name:"Boolean",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("BooleanGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultShapeBlendObject={name:"Shape Blend",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("ShapeBlendGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultTextObject={name:"Text",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("TextGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultInputObject={name:"Input",...Fr.defaultData,...mo.defaultData,geometry:fo.defaultData("InputGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")}))(_F||(_F={}));(r=>{function i(s,o){let a={name:o};return s.type==="Mesh"?(a.geometry={},"material"in s&&(a.material={layers:new Zn}),"materials"in s&&(a.materials=s.materials.map(l=>({layers:new Zn})))):Jo.is(s.type)&&(a.perspective={},a.orthographic={}),a}r.newEmpty=i;function t(s,o){if(o===void 0)return s;let a={...s};return"material"in a&&"material"in o&&o.material&&(a.material=lu(a.material,l=>{if(typeof l!="string")for(let[c,u]of Object.entries(o.material.layers)){let d=l.layers.data(c);d&&Qn.patch(d,u)}}).data),a.materials&&o.materials&&(a.materials=lu(a.materials,l=>{for(let c=0;c<a.materials.length;c++){let u=o.materials[c];if(typeof u!="string")for(let[d,h]of Object.entries(u.layers)){let p=l[c]?.layers?.data(d);p&&Qn.patch(p,h)}}}).data),a}function e(s,o){let a,l=[],c={orthographic:0,perspective:0,geometry:0};function u(d,h){for(let[p,f]of Object.entries(h.layers)){let{texture:g,...m}=f;if(g!==void 0&&Object.keys(g).length>0){let y={path:[...d,"layers",p,"texture"],props:g,type:0};l.push(y)}if(Object.keys(m).length>0){let y={path:[...d,"layers",p],props:m,type:0};l.push(y)}}}for(let[d,h]of Object.entries(o)){let p=h;if(d!=="name")if(d==="cloner")l.push(...YS.toOps(p,["cloner"]));else if(d==="pathSnapping")l.push({path:[d],props:{slide:p.slide,offset:p.offset},type:0});else if(d==="material")u(["material"],p);else if(d==="materials")for(let[f,g]of Object.entries(p))u(["materials",f],g);else if(c[d]===0){if(d==="geometry"&&p.extrusion!==void 0){let f={path:[d,"extrusion"],props:p.extrusion,type:0};l.push(f),p={...p},delete p.extrusion}if(Object.keys(p).length>0){let f={path:[d],props:p,type:0};l.push(f)}}else a===void 0&&(a={path:[],props:{},type:0},l.push(a)),a.props[d]=p}return l}r.toOps=e;function n(s,o){if(o===void 0)return s;let a={...s};if(Object.assign(a,ef.merge(a,o)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:o.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:o.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Jo.is(s.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let l=o;l.orthographic?.zoom!==void 0&&(a.orthographic.zoom=l.orthographic.zoom),l.perspective?.zoom!==void 0&&(a.perspective.zoom=l.perspective.zoom),l.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=l.isUpVectorFlipped),l.targetOffset!==void 0&&(a.targetOffset=l.targetOffset)}else if(s.type==="Mesh")"geometry"in o&&Object.assign(a,{geometry:h1.merge(a.geometry,o.geometry)}),(o.material||o.materials)&&(a=t(a,o)),a.cloner&&"cloner"in o&&Object.assign(a,{cloner:Na.merge(a.cloner,o.cloner)});else if(s.type==="Empty")a.cloner&&"cloner"in o&&Object.assign(a,{cloner:Na.merge(a.cloner,o.cloner)});else if(e1.is(s.type)){let l=o;l.intensity!==void 0&&(a.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?a.color=l.color:a.color=gr.clone(l.color))}return a}r.patch=n})(na||(na={}))});var sf,b1=F(()=>{"use strict";(t=>t.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0})(sf||(sf={}))});var yo,Yy=F(()=>{"use strict";b1();Es();(t=>t.defaultData={orbitControls:sf.defaultData,playPage:pu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,n)=>{let r=0,s=0;return n<5?s=-30:n<10&&(s=30),n===0||n===10||n===5?r=30:(n===4||n===11||n===9)&&(r=-30),[120,[r,s],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0})(yo||(yo={}))});var nP,rP,Zl,iP=F(()=>{"use strict";(t=>t.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(nP||(nP={}));(t=>t.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(rP||(rP={}));(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...nP.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:rP.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(Zl||(Zl={}))});var vo,Ql,x1=F(()=>{"use strict";Xy();on();Yy();Es();mi();iP();(r=>{function i(s){return s.find(o=>o.data.type==="Page"&&o.data.globalPhysics.usePhysics)!==void 0}r.physicsEnabled=i;function t(s,o){let a=s.find(l=>l.data.type==="Page"&&l.data.timelines?.[o]!==void 0);return a&&a.data.timelines?.[o]}r.findTimeline=t;function e(s,o){let a=s.scene.objects.get(o);if(a&&a.data.type==="Component")return a;{let l=s.shared.lib.components[o];if(l)return{...l.asset,id:o}}}r.getComponentData=e;function n(s,o,a){s.scene.objects.traverseFrom(o,(l,c)=>{if(c.type==="Instance"){let u=e(s,c.component)?.data;u&&a(l,c,u.events)}else a(l,c,c.events)})}r.traverseModuleInstances=n})(vo||(vo={}));(c=>{c.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",c.defaultLight={fi:-1,data:nf.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]};function e(u=!0,d=[]){let h=[];u&&h.push({...c.defaultLight}),h.push(...d);let p=new Ln;return p.push({fi:1,id:pu,data:{...ta.defaultData,name:"Scene 1"},children:h}),p}c.createDefaultObjectTreeWithPage=e,c.defaultData={objects:e(),publish:yo.defaultData,styles:Zl.defaultData()},c.emptyDataWithoutPage=function(){return{objects:new Ln,publish:yo.defaultData,styles:Zl.defaultData()}},c.emptyDataWithPage=function(u=!0){return{objects:e(u),publish:yo.defaultData,styles:Zl.defaultData()}},c.emptyData=function(){return{objects:new Ln,publish:{...yo.defaultData},styles:Zl.defaultData()}};function a(u){return{...c.defaultData,objects:Wr(u,Ln.prototype)}}c.withObjs=a;function l(u,d){return a([{id:u,data:d,children:[],fi:0}])}c.withObj=l})(Ql||(Ql={}))});var of,sP=F(()=>{"use strict";(t=>t.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}})(of||(of={}))});var S1,CF,Er,oP,PF,IF,ra,as,w1=F(()=>{"use strict";on();mi();(e=>(e.defaultData=n=>({url:n,name:"New Webhook",parametersSchemas:new ze}),e.defaultParameterValueByType=n=>n==="number"?0:n==="boolean"?!1:""))(S1||(S1={}));(t=>t.defaultData=(e,n="GET")=>({url:e,method:n,name:"New API",headers:new ze,queries:new ze,autoStart:!0}))(CF||(CF={}));(s=>{function i(o){return o.textValue!==void 0}s.isTextValue=i;function t(o){return typeof o=="number"}s.isNumber=t;function e(o){return typeof o=="boolean"}s.isBoolean=e;function n(o){return i(o)?"string":e(o)?"boolean":"number"}s.typeOfVariable=n;function r(o){return s.isTextValue(o)?Array.isArray(o.textValue)?o.textValue.map(a=>a.toString().padStart(o.padding??2,"0")).join(o.deliminator??":")+(o.suffix!==void 0?" "+o.suffix:""):o.textValue.toString():s.isBoolean(o)?o?"True":"False":s.isNumber(o)?parseFloat(o.toFixed(3)).toString():o.toString()}s.getDisplayedValue=r})(Er||(Er={}));(t=>t.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(oP||(oP={}));(t=>t.all=[...oP.all,"components"])(PF||(PF={}));(t=>{function i(){return{images:new at,videos:new at,colors:new at,audios:new at,particles:new at,fonts:new at,materials:new at,components:new at,variables:new at,userAPIs:new at,userWebhooks:new at}}t.defaultData=i})(IF||(IF={}));(t=>{function i(){return{images:new at,videos:new at,colors:new at,audios:new at,particles:new at,fonts:new at,materials:new at,components:new at,variables:new at,userAPIs:new at,userWebhooks:new at}}t.defaultData=i})(ra||(ra={}));(s=>{function i(){let o={};return o["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},Wr(o,at.prototype)}s.defaultColors=i;function t(){return Wr({},at.prototype)}s.defaultImages=t;function e(){return{catelogs:new at,materials:new at,images:new at,videos:new at,colors:new at,audios:new at,particles:new at,fonts:new at,variables:new ze,userAPIs:new at,userWebhooks:new at,lib:ra.defaultData()}}s.emptyData=e;function n(o){switch(o){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let a=[0,0,0];return{name:"Time",value:{textValue:a,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:a,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",o)}}s.defaultVariables=n;function r(o,a){if(a.format==="HH:mm:ss"){let l=Math.floor(o/3600),c=Math.floor((o-l*3600)/60),u=Math.round(o-l*3600-c*60);return{textValue:[l,c,u]}}else if(a.format==="mm:ss"){let l=Math.floor(o/60),c=Math.round(o-l*60);return{textValue:[l,c]}}else return a.format==="number"?o=Math.round(o):o=Math.round(o*1e3)/1e3,o}s.getFormattedTimerTime=r})(as||(as={}))});var RF=F(()=>{"use strict"});var gu,aP=F(()=>{"use strict";on();x1();sP();w1();(l=>{l.defaultData={schema:131,scene:Ql.defaultData,frames:new at().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",of.defaultData),shared:{...as.emptyData(),colors:as.defaultColors()}},l.createDefaultData=function(){return Dd.deserialize(Dd.serialize(l.defaultData))},l.emptyDataForImports=function(){let c=Ql.emptyDataWithPage();return{schema:131,scene:c,frames:new at().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",of.defaultData),shared:{...as.emptyData(),colors:as.defaultColors(),images:as.defaultImages()}}},l.emptyData=function(){return{schema:131,scene:Ql.emptyDataWithPage(),frames:new at().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",of.defaultData),shared:as.emptyData()}},l.clipboard2dData=function(){return{schema:131,scene:Ql.emptyData(),frames:new at,shared:as.emptyData()}};function s(c){return{...c,shared:{...c.shared,lib:ra.defaultData()}}}l.withoutLib=s;function o(c,u){return vo.getComponentData(c,u)}l.getComponentData=o;function a(c){let u=Object.values(c.shared.userAPIs);for(let d of u){let h=d.headers;for(let p of h)if(p.data.key.toLowerCase()==="authorization"&&p.data.value!=="")return!0}return!1}l.hasSensitiveData=a})(gu||(gu={}))});var E1,OF=F(()=>{"use strict";(t=>t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"})(E1||(E1={}))});function Jl(i,t=[0,0]){let e=i&&!isNaN(i[0])?i[0]:t[0],n=i&&!isNaN(i[1])?i[1]:t[1];return[e,n]}function $y(i,t,e){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=t??{...$l.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:o}=e??{...Qo.defaultData},a=new lP(n,r,s,o),l=a.solve(1);return()=>c=>a.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}var DF,LF,ec,af,lP,cP=F(()=>{"use strict";on();Es();(t=>{function i(e,n){return{id:e,name:n,duration:5,objectTimelines:new at}}t.defaultData=i})(DF||(DF={}));(t=>{function i(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"}t.is=i})(LF||(LF={}));(x=>{function i(S,E){let T=[0,0],w=[1,1];if(S?.cubicControls)T=Jl(S.cubicControls.control1,T);else switch(S?.type){case 2:T=[.42,0];break;case 3:T=[0,0];break;case 4:T=[.42,0];break;case 1:T=[.25,.1];break;case 0:T=[0,0];break;case 7:T=[.25,1];break}if(E?.cubicControls)w=Jl(E.cubicControls.control2,w);else switch(E?.type){case 2:w=[1,1];break;case 3:w=[.58,1];break;case 4:w=[.58,1];break;case 1:w=[.25,1];break;case 0:w=[1,1];break;case 7:w=[.5,1];break}return{control1:T,control2:w}}x.getControlsWithDefault=i,x.BEZIER_PRESETS=[0,1,2,3,4,7];function e(S){if(!x.BEZIER_PRESETS.includes(S))return;let E={type:S};return{control1:i(E).control1,control2:i(void 0,E).control2}}x.presetHandles=e;let n=.001;function r(S,E){return Math.abs(S[0]-E[0])<n&&Math.abs(S[1]-E[1])<n}function s(S){return x.BEZIER_PRESETS.find(E=>{let T=e(E);return T!==void 0&&r(T.control1,S.control1)&&r(T.control2,S.control2)})}x.presetForHandles=s;function o(S){return{id:S,keyframes:new ze}}x.defaultData=o,x.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"];function l(S){let E=x.ROOT_PROPERTY_ORDER.indexOf(S[0]);return E===-1?x.ROOT_PROPERTY_ORDER.length:E}x.rowOrder=l;function c(S){return S.layerId??S.path.join(".")}x.propertyKey=c;function u(S,E){let T=new Map;for(let w of S){let _=w.data;if(E?.(_))continue;let A=c(_),C=T.get(A);C||(C={id:A,path:_.path,keyframes:[],layerId:_.layerId,index:_.index},T.set(A,C)),_.isPlaceholder?C.placeholder=w.id:C.keyframes.push(w)}return[...T.values()].sort((w,_)=>{let A=l(w.path)-l(_.path);return A!==0?A:(w.index??0)-(_.index??0)})}x.groupKeyframes=u;function d(S){let E=S[S.length-1];return af.includes(E)?E:void 0}x.rowAxis=d;function h(S){return S.layerId?S.layerId:(d(S.path)?S.path.slice(0,-1):S.path).join(".")}x.drawnRowKey=h;function p(S){let E=new Map;for(let T of S){let w=d(T.path),_=w?T.path.slice(0,-1):T.path,A=h(T),C=E.get(A);C||(C={id:A,path:_,layerId:T.layerId,index:T.index,tracks:[]},E.set(A,C)),C.tracks.push({axis:w,property:T})}return[...E.values()]}x.drawnRows=p;function f(S){return[...S].sort((E,T)=>E.data.time-T.data.time)}x.sortedKeyframes=f;function g(S){return["material",S.type==="light"?`${S.category} lighting`:S.type]}x.materialLayerPath=g;function m(S,E){return S.map(({data:T,id:w},_)=>y(E(),g(T),{layerId:w,index:_}))}x.createMaterialGroup=m;function y(S,E,T){return{id:S,data:{id:S,time:T?.time??0,path:E,value:{},layerId:T?.layerId,index:T?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}x.placeholderKeyframe=y;function v(S){return Object.entries(S).reduce((E,[T,w])=>(typeof w!="string"&&E.push({name:w.name}),E),[])}x.createName=v,x.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:$y(3),duration:1e3},opacity:{value:[0,1],easing:$y(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:$y(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:$y(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:$y(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(ec||(ec={}));af=["x","y","z"],lP=class{constructor(t=1,e=100,n=10,r=0){this.mass=t,this.stiffness=e,this.damping=n,this.initialVelocity=r,this.m_w0=Math.sqrt(e/t),this.m_zeta=n/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0+-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(t){return this.m_zeta<1?t=Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):t=(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0),1-t}getDuration(){let t=.16666666666666666,e=0,n=0;for(;;)if(e+=t,this.solve(e)===1){if(n++,n>=16)break}else n=0;return e*t*1e3}}});var lf,cf,T1=F(()=>{"use strict";Es();on();(t=>t.list=["idle","move","jump","run"])(lf||(lf={}));(e=>(e.defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:e.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new ze,move:new ze,jump:new ze,run:new ze},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Vt.fromHexAndA(3728051,1)}}))(cf||(cf={}))});function zd(i,...t){let e={};for(let n of t.flat())i!=null&&n in i&&(e[n]=i[n]);return e}function NF(i){i.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let e=t.colorA,n=t.colorB,r=[[e.r,e.g,e.b,e.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let a=2;a<10;a++)r.push(r[1]),s.push(1);let o={...zd(Cr(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,o)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let e={...Cr(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,e)}})}function Fa(i,t){Object.values(i.shared.materials).forEach(e=>t(e))}function Ua(i,t){i.scene.objects.traverse((e,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=An.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&t(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=An.defaultTwoLayerData("phong")),t(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=An.defaultTwoLayerData("phong")),t(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==Zn.prototype&&t(r.material)})})}function ZZ(i){Object.assign(i.scene.publish,{orbitControls:{...sf.defaultData,...Cr(i.scene.publish.orbitControls)}})}function QZ(i){Object.assign(i.scene.publish.settings,{video:{...yo.defaultData.settings.video,...Cr(i.scene.publish.settings.video)}})}function JZ(i){function t(e){if(e.layers){for(let n of Object.values(e.layers))if(n){for(let[r,s]of Object.entries(n))if(($p.includes(r)||typeof s=="boolean")&&delete n[r],r==="texture")for(let[o,a]of Object.entries(s))(c1.includes(o)||typeof a=="boolean")&&delete s[o]}}}i.scene.objects.traverse((e,n)=>{n.states.forEach(r=>{let s=r;s.material?t(s.material):s.materials&&s.materials.forEach(o=>{t(o)})})})}function eQ(i){i.scene.publish.withBackground=!0}function tQ(i){i.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function nQ(i){i.scene.objects.traverse((t,e)=>{let n=e.cloner;n&&(n.radial.scale=n.radial.scale.map(r=>r+1),n.linear.scale=n.linear.scale.map(r=>r+1))})}function rQ(i){i.scene.objects.traverse((t,e)=>{let n=e.geometry;n&&(n.type==="DodecahedronGeometry"||n.type==="IcosahedronGeometry")&&(n.detail=Math.round(n.detail))})}function iQ(i){i.scene.objects.traverse((t,e)=>{let n=i.scene.objects.unproxy().parent(t);if(n){let r=Cr(i.scene.objects.data(n));r&&r.type==="Mesh"&&r.geometry.type==="BooleanGeometry"&&e.type==="Mesh"&&(e.visible=Cr(e).booleanExclude!==!0)}})}function sQ(i){i.scene.objects.traverse((t,e)=>{if(e.type==="Mesh"){let n=e;e.geometry.type==="NonParametricGeometry"?n.material!==void 0&&delete n.material:n.materials!==void 0&&delete n.materials}})}function oQ(i){function t(n){Object.setPrototypeOf(n,Zn.prototype),n.texture&&Object.setPrototypeOf(n.texture,Zn.prototype)}function e(n){Object.setPrototypeOf(n,Zn.prototype);for(let r in n)t(n[r])}i.scene.objects.traverse((n,r)=>{r.states.forEach(s=>{let o=s;if(o.material){let a=Cr(o.material).layers;e(a),o.material.layers=a}if(o.materials)for(let a=0;a<o.materials.length;a++){let l=o.materials[a],c=Cr(l).layers;e(c),l.layers=c}})})}function BF(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("lambert"))}function uP(i){!i.layers||i.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let e=[...t.colors];e.push(t.colors[9]);let n=[...t.steps];n.push(t.steps[9]);let r={...Cr(t),colors:e,steps:n};Object.assign(t,r)}})}function aQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&(e.geometry.type==="BooleanGeometry"||e.geometry.type==="SubdivGeometry")&&(e.geometry.phongAngle=35)})}function FF(i){i.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(n=>{typeof n!="string"&&uP(n)}):"material"in e&&typeof e.material!="string"&&uP(e.material)}),Object.values(i.shared.materials).forEach(t=>uP(t))}function lQ(i){i.scene.environment.ambientLight.softShadows=!1,i.scene.environment.ambientLight.softShadowQuality="low",i.scene.objects.traverse((t,e)=>{(e.type==="DirectionalLight"||e.type==="SpotLight")&&(e.shadowResolution=1024,e.shadowRadius=1,e.depth=1e5)}),i.shared.penumbraSize=new Array(5).fill(.5)}function cQ(i){i.shared.audios=Wr({},at.prototype)}function uQ(i){i.shared.videos=Wr({},at.prototype)}function dQ(i){let t=i.shared.materials;Object.entries(t).forEach(([e,n])=>{if(!n.layers){let r={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(t,{[e]:r})}})}function hQ(i){Object.entries(Cr(i.shared.images)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete i.shared.images[n]}),Object.entries(Cr(i.shared.audios)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete i.shared.audios[n]})}function pQ(i){i.scene.publish.settings.web.preload=!1}function UF(i){i.layers&&i.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function kF(i){i.layers&&i.layers.forEach(t=>{yF(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function fQ(i){i.shared.fonts=Wr({},at.prototype)}function mQ(i){return i.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function gQ(i){let t=[];i.scene.objects.traverse((e,n)=>{let r=n;if(r.type==="TextFrame"){let s=An.defaultTwoLayerData("phong"),o=typeof r.color=="string"?i.shared.colors[r.color]:r.color;s.layers[1].data.color={r:o.r,g:o.g,b:o.b},s.layers[1].data.alpha=r.alpha;let a=mQ(r.font);i.shared.fonts[a]===void 0&&(i.shared.fonts[a]={name:a});let l={name:r.name,...Fr.defaultData,...mo.defaultData,flatShading:!1,wireframe:!1,geometry:{...fo.defaultData("TextGeometry"),width:r.width,height:r.height,font:a,depth:0,horizontalAlign:r.horizontalAlign,verticalAlign:r.verticalAlign,fontSize:r.fontSize*1.40625,lineHeight:r.lineHeight/1.40625,letterSpacing:r.letterSpacing-1,text:r.text,textTransform:r.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:s,states:Cr(r.states),events:Cr(r.events),visible:r.visible,raycastLock:r.raycastLock,position:r.position,rotation:r.rotation,scale:r.scale,hiddenMatrix:r.hiddenMatrix},c=Cr(i.scene.objects).parent(e);i.scene.objects.insertAfter(c??null,e,[{id:e+"new",data:l,children:[]}]),t.push(e)}}),t.forEach(e=>{i.scene.objects.delete(e)})}function yQ(i){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};i.scene.objects.traverse((e,n)=>{n.events.forEach(r=>{if(!!t[Number(r.type)])if(Object.assign(r,{type:t[Number(r.type)]}),r.type==="Audio"&&"audioEvent"in r&&(Object.assign(r,{playAudio:r.audioEvent}),delete r.audioEvent),r.type==="GameControl")Object.assign(r,{gameActions:{idle:new ze,move:new ze,jump:new ze}});else{let s=new ze;Object.assign(r,{actions:s}),(r.type==="MouseDown"||r.type==="MouseUp"||r.type==="KeyDown"||r.type==="KeyUp")&&"url"in r&&s.push({fi:0,id:xe.generateUUID(),data:{type:"Link",url:r.url,delay:0}}),"targets"in r&&(r.targets.forEach((o,a,l)=>{let c={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},u={easing:o.easing,duration:o.duration};o.easing===6?Object.assign(u,zd(o,"mass","stiffness","damping","velocity")):o.easing===5&&Object.assign(u,{control1:{...o.control1},control2:{...o.control2}});let d={repeat:o.repeat?-1:0,delay:o.delay,delayDirection:o.delayDirection,direction:o.cycle&&o.rewind?"pingpong-rewind":o.cycle?"pingpong":"normal"},h={state:o.state,...d,...u},p={allowSlerp:!0,type:"Transition",object:o.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new ze({fi:0,id:xe.generateUUID(),data:c},{fi:1,id:xe.generateUUID(),data:h})};s.push({fi:l,id:a,data:p})}),delete r.targets)}})})}function vQ(i){i.scene.objects.traverse((t,e)=>{function n(r,s){let o=new ze,a=[];if(e.events.forEach((l,c,u)=>{if(l.type==="Audio"&&l.trigger===s){let d;a.push(c),l.interaction==="play"?d={...zd(l,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in l?l.after:void 0,toggle:"after"in l?l.toggle:void 0,type:"Audio"}:(l.interaction==="pause"||l.interaction==="stop")&&(d={...zd(l,"interaction","delay","object","playAudio"),type:"Audio"}),d&&o.push({fi:u,id:c,data:d})}}),a.forEach(l=>e.events.delete(l)),o.length){let l=e.events.find(c=>c.type===r)?.data;l?"actions"in l&&l.actions.insertBefore(null,o):e.events.insertBefore(null,[{id:xe.generateUUID(),data:{type:r,actions:o}}])}}n("Start","start"),n("MouseDown","mouseDown"),n("MouseUp","mouseUp"),n("KeyDown","keyDown"),n("KeyUp","keyUp")})}function VF(i){let t=i.layers.find(e=>e.type==="light")?.data;if(t?.category==="basic"){let e=Qn.defaultData("light","phong"),n=t;Object.assign(n,e),n.visible=!1}}function zF(i){Fa(i,VF),Ua(i,VF)}function bQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="SubdivGeometry"&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}function xQ(i){i.scene.objects.traverse((t,e)=>{(e.type==="Empty"||e.type==="Mesh")&&e.cloner&&!e.cloner.randomnessObject&&!e.cloner.toObject&&!e.cloner.randomness&&(e.cloner={...e.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}function SQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="NonParametricGeometry"&&!("material"in e)&&!("materials"in e)&&(e.material=An.defaultTwoLayerData("phong"))})}function wQ(i){i.scene.publish.orbitControls.autoZoom===void 0&&(i.scene.publish.orbitControls.autoZoom=!1),i.scene.objects.traverse((t,e)=>{(e.type==="OrthographicCamera"||e.type==="PerspectiveCamera")&&(e.orthographic.autoZoom===void 0&&(e.orthographic.autoZoom=!1),e.orthographic.autoZoomFrustumSize===void 0&&(e.orthographic.autoZoomFrustumSize=790))})}function EQ(i){i.scene.objects.traverse((t,e)=>{e.pathSnapping===void 0&&(e.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),e.pathSnapping.offset===void 0&&(e.pathSnapping.offset=0)})}function TQ(i){i.scene.publish.mouseEventTarget===void 0&&(i.scene.publish.mouseEventTarget="canvas"),i.scene.publish.settings.web.hint===void 0&&(i.scene.publish.settings.web.hint=!1)}function MQ(i){let{video:t}=i.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function _Q(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.resetYPosition=Math.abs(n.resetYPosition-e.position[1]))})})}function AQ(i){let t=i.scene.environment.usePhysics;i.scene.objects.traverse((e,n)=>{t&&n.physics===null?n.collision=!1:n.collision="visibility"})}function CQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.navmesh=cf.defaultDataThirdPerson.navmesh)})})}function PQ(i){i.scene.styles||(i.scene.styles=Zl.defaultData())}function GF(i){i.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function IQ(i){i.scene.environment.ambientLight.occlusion===void 0&&(i.scene.environment.ambientLight.occlusion=!1),i.scene.environment.ambientLight.aoFullRes===void 0&&(i.scene.environment.ambientLight.aoFullRes=!1),i.scene.environment.ambientLight.radius===void 0&&(i.scene.environment.ambientLight.radius=256),i.scene.environment.ambientLight.bias===void 0&&(i.scene.environment.ambientLight.bias=.5),i.scene.environment.ambientLight.aoColor===void 0&&(i.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Ua(i,GF),Fa(i,GF)}function RQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&Object.assign(n.gameActions,{run:new ze})})})}function OQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.keyAssignments=[...n.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}function jF(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function HF(i,t){if(t<1&&(Ua(i,NF),Fa(i,NF),i.schema=1),t<2&&(ZZ(i),i.schema=2),t<3&&(JZ(i),i.schema=3),t<4&&(eQ(i),i.schema=4),t<5&&(tQ(i),i.schema=5),t<6&&(nQ(i),i.schema=6),t<7&&(rQ(i),i.schema=7),t<8&&(i.schema=8),t<9&&(FF(i),i.schema=9),t<10&&(aQ(i),i.schema=10),t<11&&(lQ(i),i.schema=11),t<12&&(FF(i),i.schema=12),t<13&&(cQ(i),i.schema=13),t<14&&(dQ(i),i.schema=14),t<15&&(hQ(i),i.schema=15),t<16&&(pQ(i),i.schema=16),t<17&&(Ua(i,UF),Fa(i,UF),i.schema=17),t<18&&(Ua(i,BF),Fa(i,BF),i.schema=18),t<19&&(QZ(i),i.schema=19),t<20&&(fQ(i),gQ(i),i.schema=20),t<21&&(yQ(i),vQ(i),i.schema=21),t<22&&(zF(i),i.schema=22),t<23&&(bQ(i),i.schema=23),t<24&&(xQ(i),i.schema=24),(t<25||i.shared.videos===void 0)&&(uQ(i),t<25&&(i.schema=25)),t<26&&(iQ(i),i.schema=26),t<27&&(sQ(i),i.schema=27),t<28&&(zF(i),i.schema=28),t<29&&(oQ(i),i.schema=29),t<30&&(SQ(i),i.schema=30),t<31&&(wQ(i),i.schema=31),t<33&&(EQ(i),i.schema=33),t<34&&(TQ(i),i.schema=34),t<35&&(MQ(i),i.schema=35),t<36&&(_Q(i),i.schema=36),t<37&&(AQ(i),i.schema=37),t<38&&(Ua(i,kF),Fa(i,kF),i.schema=38),t<39&&(CQ(i),i.schema=39),t<40&&(PQ(i),i.schema=40),t<41&&(IQ(i),i.schema=41),t<42&&(RQ(i),i.schema=42),t<43&&(OQ(i),i.schema=43),t<99){Ua(i,jF),Fa(i,jF),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=po);let e=Cr(i.scene.objects),n=i.scene.objects;i.scene.publish.playPage=pu,n.insertBefore(null,null,[{id:pu,data:{...ta.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:zd(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:zd(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...mu.defaultData,...zd(i.scene.environment,"usePhysics","gravity")},camera:Cr(i.scene.ownerCamera)??ta.defaultData.camera,name:"Scene"},children:[]}]);for(let o of e)o.id!==Ql.TRASH_CAN_ID&&n.move(pu,o.fi,o.id);let r=0,s=0;i.shared.penumbraSize&&i.scene.objects.traverse((o,a)=>{a.type==="DirectionalLight"?(a.penumbraSize=i.shared.penumbraSize[Math.min(r,2)],r+=1):a.type==="SpotLight"&&(a.penumbraSize=i.shared.penumbraSize[3+Math.min(s,1)],s+=1),(a.physics===void 0||a.physics===null)&&a.type!=="Instance"&&(a.physics={},Object.assign(a.physics,fu.defaultData)),a.physics!==void 0&&a.physics!==null&&(a.physics.enabled=a.collision??"visibility",delete a.collision)}),i.schema=99}}var WF=F(()=>{"use strict";Kp();Es();b1();Xy();on();Yy();mi();X();f1();T1();iP();x1();r1();y1()});var JF={};Uh(JF,{updateAllMaterials:()=>ZF,updateDocumentSchema:()=>pP,updateLibSchema:()=>tJ,updateMaterialSchema:()=>UQ,updateObjectStateRec:()=>df,updateObjectsSchema:()=>KF,updateTextValues:()=>BQ});function qF(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function DQ(i){i.scene.objects.traverse((t,e)=>{let n=e.geometry;n&&n.type==="PathGeometry"&&(n.extrusion.capType="flat",n.extrusion.bevel=50,n.extrusion.bevelSides=6,n.extrusion.shape.type==="Custom"&&(n.extrusion.shape.shapeQuality="low"))})}function LQ(i){Array.isArray(Cr(i.events))&&i.events?.forEach(t=>{"disabled"in t||(t.disabled=!1),(t.type==="MouseDown"||t.type==="MouseUp"||t.type==="MousePress")&&(t.mode=t.mode||"Object")})}function XF(i){i.rotation=i.rotation.slice(0,3).map(t=>t*uf)}function $F(i){XF(i),i.type==="Page"&&XF(i.camera),i.states?.forEach(e=>{e.rotation===void 0||e.rotation===null||(e.rotation=e.rotation.slice(0,3).map(n=>n*uf))});let t=i.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*uf),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*uf),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=uf,t.extrusion.twist*=uf),i.type==="Mesh"&&i.geometry.type==="TextGeometry"&&(i.geometry.text={textValue:i.geometry.text}),Array.isArray(Cr(i.events))&&i.events?.forEach(e=>{(e.type==="MouseDown"||e.type==="MouseUp"||e.type==="MousePress"||e.type==="KeyDown"||e.type==="KeyUp"||e.type==="KeyPress"||e.type==="Collision"||e.type==="Trigger")&&(e.runMode=e.toggle?"Toggle":"Repeat")})}function NQ(i){i.shared.variables=Wr({},at.prototype)}function BQ(i){i.scene.objects.traverse((t,e)=>{})}function FQ(i){let t=Cr(i.shared.variables);i.shared.variables=Wr(Object.entries(t??{}).map(([e,n],r)=>({fi:r,id:e,data:n})),ze.prototype)}function UQ(i){let t=i.schema??104;t!==131&&t<130&&(M1(i.asset),i.schema=130)}function df(i,t){t(i.data);for(let e of i.children)df(e,t)}function KF(i){let t=i.schema??104;t!==131&&(t<105&&(df(i.asset,$F),i.schema=105),t<118&&(df(i.asset,QF),i.schema=118),t<121&&(df(i.asset,hP),i.schema=121),t<130&&(df(i.asset,kQ),i.schema=130))}function ZF(i,t){Ua(i,t),Fa(i,t),Object.values(i.shared.lib.materials).forEach(e=>t(e.asset))}function M1(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("phong"))}function kQ(i){"materials"in i?i.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&M1(t)}):"material"in i&&i.material!==void 0&&typeof i.material!="string"&&M1(i.material)}function VQ(i){i.shared.particles=Wr({},at.prototype),i.shared.lib&&(i.shared.lib.particles=ra.defaultData().particles)}function zQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Particle"&&typeof e.renderMaterial.size=="number"&&Object.assign(e.renderMaterial,{size:[e.renderMaterial.size,e.renderMaterial.size]})})}function GQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Page"&&(e.postprocessing.depthOfField.focusDistance=100,e.postprocessing.depthOfField.focalLength=20,e.postprocessing.depthOfField.bokehScale=5)})}function jQ(i){i.scene.objects.traverse((t,e)=>{Array.isArray(Cr(e.events))!==!1&&e.events?.forEach(n=>{let r=n.runMode;n.type==="MouseDown"||n.type==="MouseUp"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="Collision"||n.type==="Trigger"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode=r??"Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode=r==="Toggle"?"Toggle":"Normal")}):n.type==="MouseHover"||n.type==="MousePress"||n.type==="KeyPress"?n.actions?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")}):n.type==="GameControl"?(delete n.actions,Object.keys(n.gameActions).forEach(o=>{n.gameActions[o]?.forEach(a=>{a.type==="Transition"&&(a.runMode="Repeat"),a.type==="Animation"&&(a.runMode="Normal")})})):n.type==="DragDrop"?(delete n.actions,n.dragDropActions?.drag?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")}),n.dragDropActions?.drop?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")})):n.type==="Resize"?(delete n.actions,n.breakpoints?.forEach(s=>{s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"||o.type==="SwitchCamera")&&(o.runMode="Toggle")})})):n.type==="Start"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Once"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}):n.type==="VariableChange"||n.type==="Scroll"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}):n.type==="Conditional"&&(delete n.actions,n.inActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}),n.outActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}))})})}function HQ(i){i.shared.userAPIs=Wr({},at.prototype),i.shared.userWebhooks=Wr({},at.prototype),i.shared.lib&&(i.shared.lib.userAPIs=ra.defaultData().userAPIs,i.shared.lib.userWebhooks=ra.defaultData().userWebhooks)}function WQ(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=yo.defaultData.settings.videoStatic)}function QF(i){i.timelineAnimations=Wr({},at.prototype)}function qQ(i){let t=[];return i?(i.forEach((e,n)=>{let{path:r,keyframes:s}=e.data,o=r[0]==="material"?e.id:void 0;if(!s?.length){t.push(ec.placeholderKeyframe(e.id,r,{layerId:o,index:n}));return}s.forEach(({id:a,data:l})=>{t.push({id:a,data:{...l,path:r,layerId:o,index:n}})})}),t.sort((e,n)=>e.data.time-n.data.time),new ze(...t.map((e,n)=>({...e,fi:n})))):new ze}function XQ(i){let t=i.shared,e=t.timelineAnimations;if(!e)return;let n=i.scene.objects,r=n.unproxy().find(s=>s.data.type==="Page")?.id;for(let[s,o]of Object.entries(e)){let a=Wr({},at.prototype),l=0,c=Boolean(o.loop);for(let[p,f]of Object.entries(o.mapping??{})){let m=n.data(p)?.timelineAnimations?.[f];!m||(l=Math.max(l,m.to??0),c=c||Boolean(m.loop),a[p]={id:p,keyframes:qQ(m.properties?.unproxy())})}let u=o.page??r,d=u?n.data(u):void 0;if(!d||d.type!=="Page")continue;let h=d.timelines??(d.timelines=Wr({},at.prototype));h[s]={id:s,name:o.name,duration:l||5,...c?{loop:c}:{},objectTimelines:a}}delete t.timelineAnimations,n.traverse((s,o)=>{delete o.timelineAnimations})}function YQ(i){i.scene.objects.traverse((t,e)=>{let n=e.states;if(!n)return;let r=e.timelineAnimations,s=[];n.forEach((o,a)=>{(o.isAnimation||r?.[a])&&s.push(a)}),s.forEach(o=>n.delete(o))})}function KQ(i){for(let{id:t,data:e}of[...i.unproxy()]){let n=e.path?.[0];if(!n||!$Q.includes(n))continue;let r=dP(e.value);if(!r.length)continue;let s=i.data(t);if(!s)continue;let o=e.value,[a,...l]=r;for(let c of l){let u=xe.generateUUID();i.insertBefore(null,[{id:u,data:{...e,id:u,path:[n,c],value:o[c],easing:ZQ(e.easing)}}])}s.path=[n,a],s.value=o[a]}}function dP(i){return i===null||typeof i!="object"?[]:af.filter(t=>t in i)}function ZQ(i){let t=i?.cubicControls;return{...i,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...i?.springParameters?{springParameters:{...i.springParameters}}:{}}}function QQ(i,t){return Math.abs(i[0]-t[0])<1e-6&&Math.abs(i[1]-t[1])<1e-6}function JQ(i){let t=[];for(let e of ec.groupKeyframes(i)){let n=new Set(e.keyframes.flatMap(s=>dP(s.data.value))),r=n.size?[...n].map(s=>e.keyframes.filter(o=>dP(o.data.value).includes(s))):[e.keyframes];for(let s of r){let o=[...s].sort((a,l)=>a.data.time-l.data.time);for(let a=0;a+1<o.length;a++)t.push({left:o[a],right:o[a+1]})}}return t}function eJ(i){let t=JQ([...i.unproxy()]),e=new Map,n=new Set;for(let{left:s,right:o}of t){let a=s.data.easing?.type,c=(a===void 0?void 0:ec.presetHandles(a))?.control2??(a===5?Jl(o.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!c)continue;let u=e.get(o.id);u?QQ(u,c)||n.add(o.id):e.set(o.id,c)}let r=new Map;for(let{id:s,data:o}of i.unproxy()){let a=o.easing?.type,l=a===void 0?void 0:ec.presetHandles(a);l&&r.set(s,l.control1)}for(let{left:s,right:o}of t)n.has(o.id)&&r.delete(s.id);for(let[s,o]of r){let a=i.data(s);!a?.easing||(a.easing.cubicControls={control1:o,control2:Jl(a.easing.cubicControls?.control2,[1,1])},a.easing.type=5)}for(let{left:s,right:o}of t){if(!r.has(s.id))continue;let a=i.data(o.id),l=e.get(o.id);!a?.easing||!l||(a.easing.cubicControls={control1:Jl(a.easing.cubicControls?.control1,[0,0]),control2:l})}}function YF(i,t){i.scene.objects.traverse((e,n)=>{let r=n;if(!(r.type!=="Page"||!r.timelines))for(let s of Object.values(r.timelines))for(let o of Object.values(s.objectTimelines??{}))t(o.keyframes)})}function hP(i){i.pivot=[0,0,0],i.pivotRotation=[0,0,0]}function tJ(i){}function pP(i){let t=i.schema??0;if(t!==131){if(t>131){console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads ${131}). Update @splinetool/runtime to the latest version to load it correctly.`);return}console.warn("updating from ",t,"to ",131),HF(i,t),t<100&&(i.scene.publish.joystickSizeAndXYOffset===void 0&&(i.scene.publish.joystickSizeAndXYOffset=yo.defaultData.joystickSizeAndXYOffset),i.schema=100),t<101&&(Ua(i,qF),Fa(i,qF),i.schema=101),t<102&&(DQ(i),i.schema=102),t<104&&(i.shared.catelogs=new at,i.shared.lib=ra.defaultData(),i.schema=104),t<105&&(NQ(i),i.scene.objects.traverse((e,n)=>{$F(n)}),i.schema=105);for(let e of Object.values(i.shared.lib.components))KF(e);t<106&&(FQ(i),i.schema=106),t<107&&(i.shared.lib.variables=ra.defaultData().variables,i.schema=107),t<109&&(VQ(i),i.schema=109),t<110&&(zQ(i),i.schema=110),t<111&&(i.scene.objects.traverse((e,n)=>{LQ(n)}),i.schema=111),t<112&&(GQ(i),i.schema=112),t<113&&(jQ(i),i.schema=113),t<114&&(i.scene.publish.settings.web.imageQuality===void 0&&(i.scene.publish.settings.web.imageQuality=70),i.schema=114),t<115&&(HQ(i),i.schema=115),t<116&&(WQ(i),i.schema=116),t<117&&(i.scene.publish.settings.web.pixelRatioMobile===void 0&&(i.scene.publish.settings.web.pixelRatioMobile=0),i.scene.publish.settings.web.pixelRatioDesktop===void 0&&(i.scene.publish.settings.web.pixelRatioDesktop=0),i.schema=117),t<118&&(i.shared.timelineAnimations=Wr({},at.prototype),i.scene.objects.traverse((e,n)=>{QF(n)}),i.schema=118),t<119&&(i.scene.publish.settings.videoStatic.format=gu.defaultData.scene.publish.settings.videoStatic.format,i.scene.publish.settings.videoStatic.imageFormat=gu.defaultData.scene.publish.settings.videoStatic.imageFormat,i.schema=119),t<120&&(i.scene.publish.settings.image.colorSpace="display-p3",i.scene.publish.settings.videoStatic.colorSpace="display-p3",i.schema=120),t<121&&(i.scene.objects.traverse((e,n)=>{hP(n),n.type==="Page"&&n.camera!==void 0&&hP(n.camera)}),i.schema=121),t<122&&(delete i.scene.publish.settings.video,i.scene.publish.orbitControls.rotationSpeed=gu.defaultData.scene.publish.orbitControls.rotationSpeed,i.schema=122),t<123&&(i.scene.objects.traverse((e,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=Ba.defaultData)}),i.schema=123),t<124&&(t>=123&&i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=Ba.defaultData.lighting))}),i.schema=124),t<125&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=Ba.defaultData.lightingIntensity)}),i.schema=125),t<126&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...Ba.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Ba.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),i.schema=126),t<127&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),i.schema=127),t<128&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),i.schema=128),t<129&&(i.scene.objects.traverse((e,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=ta.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),i.schema=129),t<130&&(ZF(i,M1),i.schema=130),t<131&&(YQ(i),XQ(i),YF(i,KQ),YF(i,eJ),i.schema=131)}}var uf,$Q,Ky=F(()=>{X();aP();on();cP();WF();Yy();Kp();mi();w1();Xy();m1();uf=180/Math.PI;$Q=["position","rotation","scale","shape size"]});var eU,_1,fP,tU,A1,tc,Zy,hf,C1,mP,pf,gP,yP,nU,Qy,vP,nc,P1,rU=F(()=>{"use strict";Es();on();mi();(t=>{function i(e){return!0}t.is=i})(eU||(eU={}));(n=>{n.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]};function t(r,s){return{position:s?.position??r.position,rotation:s?.rotation??r.rotation,scale:s?.scale??r.scale,shear:s?.shear??r.shear}}n.merge=t;function e(r,s){return AS({position:Ws.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:Ws.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&Ws.isEqual(r.shear,s.shear)?void 0:s.shear})}n.diff=e})(_1||(_1={}));(t=>t.defaultData={horizontalConstraint:0,verticalConstraint:0})(fP||(fP={}));(t=>t.defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8})(tU||(tU={}));(t=>t.defaultData={opacity:1,fill:{color:Vt.fromHexAndA(wr,1),enabled:!0},stroke:{color:Vt.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Vt.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Vt.from0to1([0,0,0,1]),enabled:!1,spread:0}})(A1||(A1={}));(s=>{function i(o,a){return{name:a}}s.newEmpty=i;function t(o,a){if(a===void 0)return o;let l={...o},c=["width","height","cornerRadius"];for(let u of c)u in l&&u in a&&a[u]!==void 0&&Object.assign(l,{[u]:a[u]});return l}function e(o,a){if(a===void 0)return o;let l={...o};return"fill"in l&&"fill"in a&&a.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...a.fill}}),"stroke"in l&&"stroke"in a&&a.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...a.stroke}}),"layerBlur"in l&&"layerBlur"in a&&a.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...a.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in a&&a.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...a.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in a&&a.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...a.dropShadow}}),"innerShadow"in l&&"innerShadow"in a&&a.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...a.innerShadow}}),l}function n(o,a){if(a===void 0)return o;let l={...o};return Object.assign(l,_1.merge(l,a)),l=t(l,a),l=e(l,a),l}s.patch=n;function r(o,a){let l,c=[];for(let[u,d]of Object.entries(a))u!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},c.push(l)),l.props[u]=d);return c}s.toOps=r})(tc||(tc={}));(t=>t.defaultData={..._1.defaultData,...fP.defaultData,states:new ze,events:new ze,visible:!0,raycastLock:!1})(Zy||(Zy={}));(t=>t.defaultData={...Zy.defaultData,...A1.defaultData})(hf||(hf={}));(t=>t.defaultData={cornerRadius:[0,0,0,0]})(C1||(C1={}));(t=>t.defaultData={...hf.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(mP||(mP={}));(t=>t.defaultData={...hf.defaultData,...C1.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(pf||(pf={}));(t=>t.defaultData={...hf.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"})(gP||(gP={}));(t=>t.defaultData={...hf.defaultData,type:"path2d",path:"",name:"Path"})(yP||(yP={}));(t=>{function i(e){return e.type==="ellipse2d"||e.type==="rectangle2d"||e.type==="text2d"||e.type==="vector2d"||e.type==="path2d"}t.is=i})(nU||(nU={}));(t=>t.defaultData={...Zy.defaultData,name:"Group",type:"group2d"})(Qy||(Qy={}));(t=>t.defaultData=()=>({...Zy.defaultData,...C1.defaultData,...A1.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Vt.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Vt.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(vP||(vP={}));(s=>{function i(o){switch(o){case"rectangle2d":return{...pf.defaultData};case"ellipse2d":return{...mP.defaultData};case"text2d":return{...gP.defaultData};case"vector2d":return{...pf.defaultData};case"path2d":return{...yP.defaultData};case"frame2d":return{...vP.defaultData()};case"group2d":return{...Qy.defaultData}}}s.defaultData=i;function t(o){return"width"in o&&"height"in o?[typeof o.width=="number"?o.width*.5:0,typeof o.height=="number"?o.height*.5:0]:[0,0]}s.getPivot=t;function e(o){return o.type==="rectangle2d"||o.type==="ellipse2d"||o.type==="text2d"||o.type==="frame2d"}s.isResizeable=e;function n(o){return o.type==="frame2d"&&o.autoLayout!==void 0}s.isAutoLayoutable=n;function r(o){return o.type==="rectangle2d"||o.type==="frame2d"}s.hasCorners=r})(nc||(nc={}));(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new Ln},e.emptyData=function(){return{type:"scene2d",objects:new Ln}}))(P1||(P1={}))});var iU=F(()=>{"use strict";uF();hF();DC();NC();aP();AC();OF();GC();$C();m1();Ky();sP();f1();r1();BC();Kp();zC();ZC();Es();Yy();Xy();b1();YC();w1();x1();bF();XC();T1();y1();FC();UC();rU()});function ia(i,t=!1){let e=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new De,c=0;for(let u=0;u<i.length;++u){let d=i[u],h=0;if(e!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),h++}if(h!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[p]===void 0&&(o[p]=[]),o[p].push(d.morphAttributes[p])}if(t){let p;if(e)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(e){let u=0,d=[];for(let h=0;h<i.length;++h){let p=i[h].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+u);u+=i[h].attributes.position.count}l.setIndex(d)}for(let u in s){let d=sU(s[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(let u in o){let d=o[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let h=0;h<d;++h){let p=[];for(let g=0;g<o[u].length;++g)p.push(o[u][g][h]);let f=sU(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(f)}}}return l}function sU(i){let t,e,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=u.itemSize),e!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*e}let o=new t(s),a=new je(o,e,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let d=l/e;for(let h=0,p=u.count;h<p;h++)for(let f=0;f<e;f++){let g=u.getComponent(h,f);a.setComponent(h+d,f,g)}}else o.set(u.array,l);l+=u.count*e}return r!==void 0&&(a.gpuType=r),a}function oU(i,t=1e-4){t=Math.max(t,Number.EPSILON);let e={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],d=["getX","getY","getZ","getW"],h=["setX","setY","setZ","setW"];for(let v=0,b=a.length;v<b;v++){let x=a[v],S=i.attributes[x];l[x]=new S.constructor(new S.array.constructor(S.count*S.itemSize),S.itemSize,S.normalized);let E=i.morphAttributes[x];E&&(c[x]||(c[x]=[]),E.forEach((T,w)=>{let _=new T.array.constructor(T.count*T.itemSize);c[x][w]=new T.constructor(_,T.itemSize,T.normalized)}))}let p=t*.5,f=Math.log10(1/t),g=Math.pow(10,f),m=p*g;for(let v=0;v<s;v++){let b=n?n.getX(v):v,x="";for(let S=0,E=a.length;S<E;S++){let T=a[S],w=i.getAttribute(T),_=w.itemSize;for(let A=0;A<_;A++)x+=`${~~(w[d[A]](b)*g+m)},`}if(x in e)u.push(e[x]);else{for(let S=0,E=a.length;S<E;S++){let T=a[S],w=i.getAttribute(T),_=i.morphAttributes[T],A=w.itemSize,C=l[T],P=c[T];for(let D=0;D<A;D++){let O=d[D],L=h[D];if(C[L](o,w[O](b)),_)for(let U=0,G=_.length;U<G;U++)P[U][L](o,_[U][O](b))}}e[x]=o,u.push(o),o++}}let y=i.clone();for(let v in i.attributes){let b=l[v];if(y.setAttribute(v,new b.constructor(b.array.slice(0,o*b.itemSize),b.itemSize,b.normalized)),v in c)for(let x=0;x<c[v].length;x++){let S=c[v][x];y.morphAttributes[v][x]=new S.constructor(S.array.slice(0,o*S.itemSize),S.itemSize,S.normalized)}}return y.setIndex(u),y}var ff=F(()=>{X()});function rJ(i){let t=1/0,e=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let u=0;u<i.length;u+=3){let d=i[u],h=i[u+1],p=i[u+2];t=Math.min(t,d),e=Math.min(e,h),n=Math.min(n,p),r=Math.max(r,d),s=Math.max(s,h),o=Math.max(o,p)}let a=r-t,l=s-e,c=o-n;return{width:a,height:l,depth:c}}function iJ(i){let{userData:t,data:e}=i,n=e?.groups,r=e?.attributes??{},s=e?.morphAttributes??{},o=e?.interleavedBuffers,a=e?.arrayBuffers,l=e?.index,c;r.position!==void 0&&Array.isArray(r.position.array)&&(c=rJ(r.position.array));let u={...t===void 0?{}:t.parameters,data:{attributes:r,morphAttributes:s,interleavedBuffers:o,arrayBuffers:a},...c===void 0?{}:c,type:"NonParametricGeometry"};return l!==void 0&&Object.assign(u.data,{index:l}),n!==void 0&&Object.assign(u.data,{groups:n.map(d=>({...d,materialIndex:d.materialIndex??0}))}),u}function lU(i){let t=i.points.length/7,e=new ze;for(let n=0;n<t;n++){let r=n*7,s=i.points[r+0],o=i.points[r+1],a=i.points[r+2],l=i.points[r+3],c=i.points[r+4],u=i.points[r+5],d=i.points[r+6];e.push({fi:n,id:xe.generateUUID(),data:{roundness:d,position:[s,o],areControlsDirectionsMirrored:!0,controlPrevious:{position:[a,l]},controlNext:{position:[c,u]}}})}return{points:e,isClosed:i.isClosed,roundness:i.roundness,shapeHoles:i.shapeHoles?.map(n=>lU(n))??[]}}function bP(i){let{userData:t,uuid:e,...n}=i;if(t===void 0||t.type==="NonParametricGeometry")return iJ(i);if(t.type==="SubdivGeometry"){let o="SubdivGeometry",a=n.data?.attributes;if(a?.positionWASM===void 0){let c=new De;if(a?.position===void 0||a?.faceMap===void 0)return null;let u=a.position.array,d=a.faceMap.array,h=n.data.index.array;c.setAttribute("position",new Ve(u,3)),c.setIndex(new Us(h,1));let p=oU(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(g[d[y]]++,f.push(...new Set(m.slice(3*y,3*y+6))),y+=2):(f.push(...m.slice(3*y,3*y+3)),y++);a.indexWASM={array:f},a.positionWASM=p.attributes.position,a.verticesPerFaceWASM={array:g}}if(a?.positionWASM===void 0||a?.positionWASM.length===0||a?.indexWASM===void 0||a?.indexWASM.length===0||a?.verticesPerFaceWASM===void 0||a?.verticesPerFaceWASM.length===0)return null;let l={type:o,...sJ(a.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let c in a)c==="positionWASM"?l[c]=new Float32Array(a[c].array):c==="indexWASM"?l[c]=new Int32Array(a[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(a[c].array));return l.scaleBaked=[1,1,1],l}let r=t.type,s=t.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:lU(t.shape),type:r}):r==="LatheGeometry"?{...t.parameters,type:r,points:(t?.parameters.points??[]).map(o=>[o.x,o.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function sJ(i){return aU.setFromArray(i),aU.getSize(I1),{width:I1.x,height:I1.y,depth:I1.z}}var ybe,vbe,bbe,xbe,Sbe,aU,I1,cU=F(()=>{on();X();ff();ybe=new ne,vbe=new qe,bbe=new qt,xbe=new M,Sbe=new M,aU=new Nt,I1=new M});var uU=F(()=>{"use strict"});var _be,dU=F(()=>{"use strict";on();Ky();_be={...zy,updateSchema(i){return(i.schema??0)<131?lu(i,pP):(i.schema??0)-131},asyncKeys(){return[]}}});var Pbe,Ibe,hU=F(()=>{"use strict";Kp();Pbe=new Set(["type","category","visible","noiseType","isMask","bumpMap","roughnessMap",...$p]),Ibe=new Set(c1)});var pt=F(()=>{iU();uU();RF();Ky();dU();cP();hU();T1();on()});function pU(i){for(let t of oJ)i.enable(t)}var oJ,ls,mf,fU,ka=F(()=>{oJ=[3,4,8,9];ls=5,mf=3,fU=32});var Va,gf=F(()=>{"use strict";X();Va=i=>{var t;return t=class extends i{},t.geometryHelper=new ni(30,30,30),t}});var O1,xP,mU,za,yf=F(()=>{"use strict";X();O1=new Hi,xP=new nr,mU=new ne,za=(i,t,e,n,r=!1,s=i)=>{let o=t,a=s.matrixWorld;if(o.boundingSphere===null&&o.computeBoundingSphere(),xP.copy(o.boundingSphere),xP.applyMatrix4(a),e.ray.intersectsSphere(xP)===!1||(mU.copy(a).invert(),O1.copy(e.ray).applyMatrix4(mU),o.boundingBox!==null&&O1.intersectsBox(o.boundingBox)===!1))return;let l,c,u,d,h=o.index,p=o.attributes.position,f=o.drawRange,g,m;if(r===!1){let v=Math.max(0,f.start),b=Math.min(h.count,f.start+f.count);for(g=v,m=b;g<m;g+=3)if(c=h.getX(g),u=h.getX(g+1),d=h.getX(g+2),l=y(i,e,O1,p,c,u,d),l){l.faceIndex=Math.floor(g/3),n.push(l);return}}else{let b=o.attributes.position,x=new M,S=new M,E=new M,T=new M,w=2,A=1/((s.scale.x+s.scale.y+s.scale.z)/3),C=A*A,P=Math.max(0,f.start),D=Math.min(b.count,f.start+f.count);for(let O=P,L=D-1;O<L;O+=w){if(x.fromBufferAttribute(b,O),S.fromBufferAttribute(b,O+1),O1.distanceSqToSegment(x,S,T,E)>C)continue;T.applyMatrix4(s.matrixWorld);let G=e.ray.origin.distanceTo(T);G<e.near||G>e.far||n.push({distance:G,point:E.clone().applyMatrix4(s.matrixWorld),object:i})}}function y(v,b,x,S,E,T,w){let _=new M,A=new M,C=new M,P=new M,D=new M;if(_.fromBufferAttribute(S,E),A.fromBufferAttribute(S,T),C.fromBufferAttribute(S,w),x.intersectTriangle(_,A,C,!1,P)===null)return null;D.copy(P),D.applyMatrix4(v.matrixWorld);let L=b.ray.origin.distanceTo(D);return L<b.near||L>b.far?null:{faceIndex:1,distance:L,point:D.clone(),object:v}}}});var aJ,gU,lJ,yU,xo,Jy=F(()=>{"use strict";X();gf();yf();aJ=new M(1,1,1),gU=new M,lJ=new M,yU=new qe,xo=class extends Va(gy){constructor(e,n=15){super(n);this.object=e;this.dummy=new Bs;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,n){za(this.object,xo.geometryHelper,e,n,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(gU,yU,lJ),this.matrix.compose(gU,yU,aJ),super.updateMatrixWorld(e)}updateWorldMatrix(e,n){}}});var Gd,jd,yu,bU,cJ,uJ,vU,ev,xU=F(()=>{"use strict";X();Gd=new M,jd=new M,yu=new ne,bU=[new M(-1,1,1),new M(-1,-1,1),new M(1,-1,1),new M(1,1,1),new M(-1,1,-1),new M(-1,-1,-1),new M(1,-1,-1),new M(1,1,-1)],cJ=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],uJ=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],vU=(i,t,e)=>{i.updateEntityBoxSize(Gd,jd),yu.copy(t).multiply(i.matrixWorld),jd.x===0&&jd.y===0&&jd.z===0?e.push(new M(Gd.x,Gd.y,Gd.z).applyMatrix4(yu)):bU.forEach(n=>{e.push(n.clone().multiply(jd).add(Gd).applyMatrix4(yu))})},ev=class extends Nt{constructor(){super(...arguments);this.matrix=new ne;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(n=>n.clone()),this.faces=e.faces.map(n=>n.clone()),this.edges=e.edges.map(n=>n.clone()),this.centerEdges=e.centerEdges.map(n=>n.clone()),this}setFromObjectSize(e,n=!1){e.updateWorldMatrix(!1,n),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let r=new ne().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,n)}expandByObjectSize(e,n,r=!1){let s=[];if(r===!0){let o=[];e.traverseEntity(a=>{if(a.visible||a.cloner&&a.data.visible){if(!("geometry"in a)){yu.copy(n).multiply(a.matrixWorld),o.push(new M().applyMatrix4(yu));return}vU(a,n,s)}}),s.length===0&&s.push(...o)}else vU(e,n,s);return this.setFromPoints(s)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(yu.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(jd).multiplyScalar(.5),this.getCenter(Gd),yu.copy(this.matrix).setPosition(Gd),this.vertices=bU.map(e=>e.clone().multiply(jd).applyMatrix4(yu))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=cJ.map(([e,n])=>new ri(this.vertices[e],this.vertices[n])),this.centerEdges=this.edges.map(e=>e.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=uJ.map(([e,n])=>this.vertices[e].clone().add(this.vertices[n]).multiplyScalar(.5))}}});var So,tv=F(()=>{"use strict";So={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function vu(i){return i?.isParticleSystem===!0}function sa(i){return i?.isHairSystem===!0}function Ts(i){return i?.isShapeBlendEntity===!0}function Hd(i){return i?.isPathObject===!0}function Pr(i){return i?.isObject2D===!0}function yr(i){return i?.isUIObject===!0}function SU(i){return typeof i=="object"&&i!==null&&"booleanOp"in i}function rc(i){return i?.isCloner===!0}function Ga(i){return i?.isClone===!0}function vf(i){return i?.isComponentObject===!0}var pr=F(()=>{});function Mt(i){EU.add(i)}function TU(i){return EU.has(i)}function Jn(i,t){let e=`${i}:${t}`;wU.has(e)||wU.add(e)}function Wd(i,t){MU.set(i,t)}function D1(i){return MU.get(i)}function wo(i,t){_U.set(i,t)}function L1(i){return _U.get(i)}function nv(i,t){AU.set(i,t)}function N1(i){return AU.get(i)}function CU(i){wP=i,SP!==null&&i.setHanaUIWasmUrl(SP)}function PU(i){SP=i,wP?.setHanaUIWasmUrl(i)}function rv(){return wP}var EU,wU,MU,_U,AU,wP,SP,Qt=F(()=>{EU=new Set;wU=new Set;MU=new Map,_U=new Map;AU=new Map;wP=null,SP=null});function IU(i){let t=i.elements;ja.set(t[0],t[1],t[2]),Ha.set(t[4],t[5],t[6]),ic.set(t[8],t[9],t[10])}function hJ(i,t){i.set(1,0,0).cross(t),i.lengthSq()<=F1&&i.set(0,1,0).cross(t),i.normalize()}function RU(){let i=Math.max(ja.lengthSq(),Ha.lengthSq(),ic.lengthSq());ja.lengthSq()>F1*i?Eo.copy(ja).normalize():Eo.set(1,0,0),To.crossVectors(ic,Eo),To.lengthSq()<=F1*i&&(To.copy(Ha).addScaledVector(Eo,-Ha.dot(Eo)),To.lengthSq()<=F1*i&&hJ(To,Eo)),To.normalize(),bf.crossVectors(Eo,To)}function pJ(){let i=ja.length(),t=Ha.length(),e=ic.length(),n=Math.max(i,t,e);if(n-i>B1||n-t>B1||n-e>B1)return!0;let r=B1*n*n;return Math.abs(ja.dot(Ha))>r||Math.abs(ja.dot(ic))>r||Math.abs(Ha.dot(ic))>r}function OU(i,t,e){return IU(i),RU(),t.makeBasis(Eo,To,bf),e.set(Eo.dot(ja),Eo.dot(Ha),Eo.dot(ic),0,To.dot(ja),To.dot(Ha),To.dot(ic),0,bf.dot(ja),bf.dot(Ha),bf.dot(ic),0,0,0,0,1),pJ()}function EP(i){return IU(i),RU(),dJ.makeBasis(Eo,To,bf)}var ja,Ha,ic,Eo,To,bf,dJ,F1,B1,TP=F(()=>{"use strict";X();ja=new M,Ha=new M,ic=new M,Eo=new M,To=new M,bf=new M,dJ=new ne,F1=1e-12,B1=.01});var MP,sc,xf,Sf=F(()=>{"use strict";X();TP();MP=new ne;(t=>{function i(e){return e&&e.__isSPEObject}t.is=i})(sc||(sc={}));xf=i=>class extends i{constructor(){super(...arguments);this.previousModelViewMatrix=new ne;this.copyPreviousMatrix=!0;this.hiddenMatrix=new ne;this.pivotMatrix=new ne;this.matrixWorldRigid=new ne;this.shearScale=new ne;this.shearScaleInv=new ne}get __isSPEObject(){return!0}getPhysicsLocalMatrix(n){return this.rigidBody?.isDynamic()?(n.copy(this.matrixWorld),this.hasNonUniformScale&&n.multiply(this.shearScaleInv),this.parent&&n.premultiply(MP.copy(this.parent.matrixWorld).invert()),n.premultiply(MP.copy(this.hiddenMatrix).invert()),n.multiply(MP.copy(this.pivotMatrix).invert()),!0):!1}isDescendantOf(n){n instanceof Zt&&(n=n.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===n)return!0;r=r.parent}return!1}updateMatrixWorld(n){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,n=!0);for(let r of this.children)r.updateMatrixWorld(n)}updateWorldMatrix(n,r){let s=this.parent;if(n&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),r)for(let o of this.children)o.updateWorldMatrix(!1,!0)}traverseChildren(n,r=0){for(let s of this.children)sc.is(s)&&s.traverseObject(n,r+1)}traverseObject(n,r=0){if(n(this,r)!==!0)for(let o of this.children)sc.is(o)&&o.traverseObject(n,r+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=OU(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(n,r){this.updateWorldMatrix(!0,!1);let s=new ne().copy(this.matrixWorld).invert();return n.parent!==null&&(n.parent.updateWorldMatrix(!0,!1),s.multiply(n.parent.matrixWorld)),"hiddenMatrix"in n&&n.hiddenMatrix instanceof ne?n.hiddenMatrix.premultiply(s):n.applyMatrix4(s),n.updateWorldMatrix(!1,!1),this.add(n),r!==void 0&&(this.children.pop(),this.children.splice(r,0,n)),this}copy(n,r=!1){return super.copy(n,r),this.hasNonUniformScale=n.hasNonUniformScale,this}onAfterRender(n,r,s,o,a,l){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function NU(i,t,e){return qd.subVectors(t,i),k1.subVectors(t,e),qd.cross(k1).length()<=U1}function V1(i){let t=BU.get(i.points);if(t!==void 0&&t.isClosed===i.isClosed)return t.curve;let e=fJ(i);return BU.set(i.points,{isClosed:i.isClosed,curve:e}),e}function fJ(i){let t=i.points,e=[t[0]],n=[new M(...t[0].data.position)];wf.copy(n[0]);for(let f=0;f<t.length-1;f++)qd.fromArray(t[f].data.position),k1.fromArray(t[f+1].data.position),iv.subVectors(qd,wf),sv.subVectors(qd,k1),iv.cross(sv).length()>U1&&(e.push(t[f]),n.push(new M().copy(qd)),wf.copy(qd));let r=t[t.length-1];e.push(r),n.push(new M(...r.data.position));let s=i.isClosed,o=e.length-(s?0:1),a=e.length,l=[],c=[];for(let f=0;f<a;f++){let g=e[f].data;l.push(new M(...g.controlPrevious.position)),c.push(new M(...g.controlNext.position))}let u=[];for(let f=0;f<o;f++){let g=f===a-1?0:f+1;u.push(NU(n[f],c[f],n[g])&&NU(n[f],l[g],n[g]))}let d=[];for(let f=0;f<a;f++){let g=e[f].data,m=n[f],y={position:m,prevDir:void 0,nextDir:void 0,controlPrevious:l[f],controlNext:c[f],tan:void 0,baseRoundness:g.roundness,removedLength:0};if(d.push(y),g.roundness===0||!s&&(f===0||f===a-1))continue;let v=s&&f==0?a-1:f-1,b=s&&f==a-1?0:f+1,x=new M().subVectors(n[v],m).normalize(),S=new M().subVectors(n[b],m).normalize();y.prevDir=x,y.nextDir=S;let E=u[s&&f===0?a-1:f-1],T=u[f];if(E&&T){Ef.addVectors(x,S).normalize();let w=wf.crossVectors(Ef,x).length()/x.dot(Ef);y.tan=w,y.removedLength=g.roundness/w}}for(let f=0;f<o;f++){let g=f,m=s&&f===a-1?0:f+1,y=d[g],v=d[m];if(y.removedLength!==0||v.removedLength!==0){let b=y.position.distanceTo(v.position);y.removedLength=Math.min(y.removedLength,b/2),v.removedLength=Math.min(v.removedLength,b/2)}}let h=new Array(2*a).fill(null);for(let f=0;f<o;f++){let g=f,m=s&&f===a-1?0:f+1,y=d[g],v=d[m],b=null;if(!u[f])y.position.distanceTo(v.position)>U1&&(b=new $c(y.position,y.controlNext,v.controlPrevious,v.position));else{let x=y.position.clone(),S=v.position.clone();(y.removedLength!==0||v.removedLength!==0)&&(y.nextDir&&x.add(wf.copy(y.nextDir).setLength(y.removedLength)),v.prevDir&&S.add(wf.copy(v.prevDir).setLength(v.removedLength))),x.distanceTo(S)>U1&&(b=new $c(x,x.clone().lerp(S,.3),S.clone().lerp(x,.3),S))}h[2*f+1]=b}for(let f=0;f<a;f++){let g=d[f];if(g.removedLength===0)continue;let m=g.position,y=g.prevDir.clone().multiplyScalar(g.removedLength).add(m),v=g.nextDir.clone().multiplyScalar(g.removedLength).add(m),b=g.tan*g.removedLength;Ef.addVectors(g.prevDir,g.nextDir).normalize(),iv.copy(y).lerp(v,.5);let x=y.distanceTo(v)/2;LU.copy(Ef).multiplyScalar(Math.sqrt(Math.pow(b,2)-Math.pow(x,2))).add(iv),_P.copy(Ef).multiplyScalar(-b).add(LU);let S=m.distanceTo(_P)/m.distanceTo(iv);sv.copy(g.prevDir).multiplyScalar(S*m.distanceTo(y)).add(m),DU.copy(sv).lerp(_P,2);let E=y.clone().lerp(sv,4/3),T=v.clone().lerp(DU,4/3);h[2*f]=new $c(y,E,T,v)}let p=new AP;for(let f=0;f<h.length;f++){let g=h[f];g&&p.add(g)}return p}var AP,U1,qd,k1,wf,Ef,iv,_P,sv,DU,LU,BU,CP=F(()=>{"use strict";X();AP=class extends up{constructor(){super()}getPoints(t=12){let e=[],n,r=this.getCurveLengths(),o=r[r.length-1]/r.length;for(let a=0,l=this.curves;a<l.length;a++){let c=l[a],u=a===0?r[a]:r[a]-r[a-1],d=Math.ceil(t*u/o),h=c.getPoints(d);for(let p=0;p<h.length;p++){let f=h[p];n&&n.equals(f)||(e.push(f),n=f)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}},U1=.001,qd=new M,k1=new M,wf=new M,Ef=new M,iv=new M,_P=new M,sv=new M,DU=new M,LU=new M;BU=new WeakMap});var Ot,Wa,mJ,gJ,ov,FU,PP,IP,yJ,UU,kU,Tf,Xi=F(()=>{"use strict";X();pt();xU();on();tv();pr();Qt();Sf();CP();gn();(t=>{function i(e){return e&&e.__isEntity}t.is=i})(Ot||(Ot={}));Wa=i=>Ot.is(i),mJ={type:"completeState",isfromEntity:!0},gJ=["x","y","z"],ov=new M,FU=new M(1,1,1),PP=new qe,IP=new qt,yJ=new M().set(0,1,0),UU=new ne,kU=new ne,Tf=i=>class extends xf(i){constructor(){super(...arguments);this.raycastLock=!1;this.scaleLock=!1;this.disposed=!1;this.stateSelection=null;this.destroyedInAction=!1;this.instances=[];this.prevState=null;this.currentState=null;this.currentAnimationAction=null;this.reversibleToState=null;this.transitionState={settled:!0,state:null};this.currentTransitionEvent=null;this.previousAction=null;this._singleBBox=new ev;this._recursiveBBox=new ev;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this._needApplyPathSnapping=!0;this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(n){let r=this.children[n];if(Ot.is(r))return r}entityChildrenCount(){let n=this.children.length;for(;n--;)if(Ot.is(this.children[n]))return n+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let n=this;for(;n.data.type!=="Instance";){let r=n.parent;if(Ot.is(r))n=r;else return}return n}forInstancesRec(n){this.instances.forEach(r=>{r.disposed||n(r),r.forInstancesRec(n)})}super_Entity(n,r){typeof n=="string"&&(this.uuid=n),this.identity=n,this.data=r,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(n,r,s=!1){if(!(this.data.states.length===0&&!s)){for(let o of this.data.states)na.toOps(this.data,o.data).forEach(l=>{let c=jp.replaceProps(l,this.data);this.dataPatched=this.data,this.updateByPatchedOp(c,this.data,r)});if(n!==null){let o=this.data.states.data(n);o&&(this.dataPatched=na.patch(this.data,o),na.toOps(this.data,o).forEach(l=>{this.updateByPatchedOp(l,this.dataPatched,r)}))}s&&this.updateTransformState(this.dataPatched,r),this.stateSelection=n,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(n,r){n.setScalar(0),r.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(n=>{Wa(n)&&n.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(n=>{n.resetBBoxNeedsUpdateSelf()})}find(n){let r;return this.traverseEntity(s=>{s.uuid===n&&(r=s)}),r}traverseSortNextHelper(){let n=this.parent;if(n){let r=n.children,s=r.indexOf(this)+1;if(Ot.is(r[s]))return r[s];if(Ot.is(n))return n.traverseSortNextHelper()}}sortNext(){let n=this.children;return this.children.length>0&&Ot.is(this.children[0])?n[0]:this.traverseSortNextHelper()}goUp(n){let r=this;for(;n>0&&r!==null;)r=r.parent,n-=1;return r}hasAnccestorOrSelf(n){return this===n||this.hasAnccestor(n)}hasAnccestor(n){let r=this.parent;for(;r;){if(n===r)return!0;r=r.parent}return!1}countToAccestor(n){let r=0,s=this;for(;s!==n;){if(s===null)return-1;s=s.parent,r+=1}return r}forEachEntity(n){for(let r of this.children)Wa(r)&&n(r)}traverseEntityAncestors(n){this.traverseAncestors(r=>{Ot.is(r)&&n(r)})}traverseConcreteEntity(n,r=0){if(n(this,r)!==!0)for(let o of this.children)Wa(o)&&o.isConcreteEntity&&o.traverseEntity(n,r+1)}traverseEntity(n,r=0){if(n(this,r)!==!0)for(let o of this.children)Wa(o)&&o.traverseEntity(n,r+1)}traverseVisibleEntity(n){n(this);for(let r of this.children)Wa(r)&&r.visible&&r.traverseVisibleEntity(n)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(n){super.updateMatrixWorld(n),this.dispatchEvent({type:"updateMatrixWorld"})}copy(n,r=!1){return super.copy(n,r),this.dataPatched=n.dataPatched,this.raycastLock=n.raycastLock,this.scaleLock=n.scaleLock,this.hiddenMatrix.copy(n.hiddenMatrix),this}hasEntityChild(){return this.children.some(n=>Wa(n))}isAncestorOf(n){if(this.uuid===n)return!1;let r=!1;return this.traverseEntity(s=>{s.uuid===n&&(r=!0)}),r}toObjectTransformState(n=[]){this.updateWorldMatrix(!0,!1);let r={position:this.position.toArray(),rotation:[this.rotation.x*xe.RAD2DEG,this.rotation.y*xe.RAD2DEG,this.rotation.z*xe.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return Ny(r,n)}getTransformValues(n,r,s){return r[n].map((o,a)=>s?.shared.getVariable(o,[this.uuid,n,gJ[a]])??o)}updateTransformState(n,r){let s=!1;if(n.position&&(this.position.fromArray(this.getTransformValues("position",n,r)),s=!0),n.rotation&&(ov.fromArray(this.getTransformValues("rotation",n,r)).multiplyScalar(xe.DEG2RAD),this.rotation.setFromVector3(ov),s=!0),n.scale&&(this.scale.fromArray(this.getTransformValues("scale",n,r)),s=!0),n.hiddenMatrix!==void 0&&(s=!0,this.hiddenMatrix.fromArray(n.hiddenMatrix??hu.identity)),n.pivot!==void 0||n.pivotRotation!==void 0){if(s=!0,n.pivot!==void 0&&n.pivotRotation!==void 0)this.pivotMatrix.compose(ov.fromArray(n.pivot).negate(),PP.setFromEuler(IP.fromArray(n.pivotRotation.map(o=>o*xe.DEG2RAD))).invert(),FU);else if(n.pivot!==void 0)this.pivotMatrix.setPosition(-n.pivot[0],-n.pivot[1],-n.pivot[2]);else if(n.pivotRotation!==void 0){let o=ov.setFromMatrixPosition(this.pivotMatrix);PP.setFromEuler(IP.fromArray(n.pivotRotation.map(a=>a*xe.DEG2RAD))).invert(),this.pivotMatrix.compose(o,PP,FU)}}return s&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(o=>{o.invalidateClonerTransform(this)})),n.position&&n.rotation&&n.scale&&n.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),s}onVariableUpdate(n=!1){if(n){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)}),this.requestRender()}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let n of this.children)Ot.is(n)&&n.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(n=>{Ot.is(n)&&n.disposeRecursively()})}toState(n=[]){let r={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(n)};return Ny(r,n)}updateByObjUpdateOp(n,r){n!==void 0&&this.updateByOp({type:0,props:n,path:[]},{...this.data,...n},r,!1)}updateByOp(n,r,s,o){let a=this.data;this.data=r;let l=n,c=$t(n.path,["states","*"]);if(c!==null){if(n.type===0){let[u]=c;if(this?.stateSelection===u){let d={...n.props};if(delete d.name,Object.values(n.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let p=rr.zoom(h,n.path.slice(2));if(p)for(let f in n.props)n.props[f]===void 0&&f in p&&(d[f]=p[f])}}l={...n,props:d,path:n.path.slice(2)}}}}else if(n.type===0){let u=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(u!==void 0){if(n.props.name!==void 0&&u.name){let{name:h,...p}=u;u=p}if(n.props.material!==void 0&&"material"in u){let{material:h,...p}=u;u=p}let d=rr.removeOverridden(n.path,n.props,u);l={...n,props:d}}}if(this.updateByPatchedOpBase(l,na.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),s),$t(n.path,["overrides"])){let u=[],d=[...n.path];for(u.push(d[1]),d.splice(0,2);d.length>0&&d[0]==="descendants";)u.push(d[1]),d.splice(0,2);if(u[u.length-1]===void 0){if(n.type===0)for(let h of Object.keys(n.props)){u[u.length-1]=h;let p=s.scene.findInstance([this.uuid,...u]);p&&(p.overrideData=n.props[h],p.updateState(Da.apply(p.component.data,p.overrideData),s))}}else{let h=s.scene.findInstance([this.uuid,...u]);if(h){let p=rr.zoom(h.component.data,d);if(n={...n,path:d},n.type===0){let f=n.props;if(p)for(let[g,m]of Object.entries(n.props))m===void 0&&(f===n.props&&(f={...n.props}),f[g]=p[g]);n={...n,props:f}}h.overrideData=rf.resolve(r.overrides,u),h.updateByOp(n,Sr.applySimple(h.data,n),s,!1)}}}else if(this.instances.length>0){let u;if(n.path.length===0&&n.type===0){let d;for(let h of go.rootOverrideProps)h in n.props&&(d===void 0&&(d={}),d[h]=n.props[h]);d&&(u={...n,props:d})}else for(let d of go.rootOverrideProps)if($t(n.path,[d])){u=n;break}u!==void 0&&this.instances.forEach(d=>{if(d.isInstanceRoot){let h=Da.filterOp(d.overrideData,u);h&&d.updateByOp(h,Sr.applySimple(d.data,h),s,!0)}}),this.instances.forEach(d=>{if(!d.isInstanceRoot){let h=Da.filterOp(d.overrideData,n);if(h){let p;a===d.data&&n===h?p=r:p=Sr.applySimple(d.data,h),d.updateByOp(h,p,s,!0)}}})}}updateByPatchedOpBase(n,r,s){if(this.dataPatched=r,n.path.length===0&&n.type===0)n.props.type!==void 0&&!Jo.is(n.props.type)&&So.changeEntityProptotype(this,r,s);else if(n.path.length===1&&n.path[0]==="geometry"&&n.type===0&&"type"in n.props){So.changeEntityProptotype(this,r,s);for(let o of this.children)Ot.is(o)&&o.updateVisible(s.scene)}this.updateByPatchedOp(n,r,s)}updateByPatchedOp(n,r,s){if(n.path.length===0&&n.type===0?this.updateState(n.props,s):n.type===0&&("resolutionLevel"in n.props||"useChildrenColors"in n.props)&&this.updateState(r,s),n.path[0]==="morphTargetInfluences"&&n.type===0){let a=r.morphTargetInfluences.get(n.path[1])?.data.name;a&&this.updateMorphInfluences(a,s.shared.getVariable(n.props.value,[this.uuid,"morphTargetInfluences",a]))}if($t(n.path,["pathSnapping"])!==null&&this.updatePathSnapping(r.pathSnapping),$t(n.path,["cloner"])!==null){let o=Sr.drop(n,1);o.path.length===0&&o.type===0&&o.props.disabled===!0?this.setFromClonerState(null,s):this.cloner?this.cloner.updateState(r.cloner,s):(this.setFromClonerState(r.cloner,s),this.expandCloner(s)),this.updateVisible(s.scene)}}updatePathSnapping(n=this.dataPatched.pathSnapping){this._updatedPathSnapping=n,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(n){if(this._needApplyPathSnapping===!1)return;let r=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,s=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,o=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(r===null)return;let l=n.find(r);if(!l)return;this._needApplyPathSnapping=!1;let c=l.data;if(c.geometry.path.points.length<=1)return;let u=V1(c.geometry.path),d=(s+o)%1;s+o===1&&d===0&&(d=1);let h=null;try{h=u.curves.length?u.getPointAt(d):null}catch(g){!1&&(console.warn(`The aligned path on ${this.name} is invalid. (${l.name})`),console.error(g))}if(h===null)return;l.updateMatrixWorld();let p=this.parent?UU.copy(this.parent.matrixWorld).invert():UU.identity();p.multiply(l.matrixWorld),h.applyMatrix4(p);let f={position:h.toArray(),rotation:c.rotation};if(a==="tangential"){let g=kU.extractRotation(l.matrixWorld),m=u.getTangentAt(d).applyMatrix4(g).add(h),y=kU.lookAt(h,m,yJ),v=ov.setFromEuler(IP.setFromRotationMatrix(y)).multiplyScalar(xe.RAD2DEG);f={...f,rotation:v.toArray()}}this.updateTransformState(f),this.traverseEntity(g=>{g._cameraType&&g.dispatchEvent(mJ)})}updateVisible(n){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!n)return;let r=!1;this.traverseEntity(s=>{if(s.data.type==="Splat")return r=!0,!0}),r&&n.reloadSplats()}updateState_Entity(n,r){n.name!==void 0&&(this.name=n.name),n.raycastLock!==void 0&&(this.raycastLock=n.raycastLock),n.visible!==void 0&&(this.updateVisible(r?.scene),this.resetBBoxNeedsUpdate()),r&&"cloner"in n&&n.cloner!==void 0&&(this.setFromClonerState(n.cloner,r),this.updateVisible(r.scene)),this.updateTransformState(n,r)}get attachedSurfaceCloners(){return this.children.filter(n=>rc(n)&&n.parameters.type==="toObject")}setFromClonerState(n,r){if(!this.disposed)if(n===null||n.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(So.Cloner===null){Jn("cloners","a cloner");return}this.cloner=new So.Cloner(this,n),r.scene.addPendingExpandCloner(this)}else this.cloner.updateState(n,r)}expandCloner(n){!this.disposed&&this.cloner&&this.cloner.expandClones(n)}invalidateClonerTransform(n){this.cloner&&this.cloner.invalidateTransform(n)}requestRender(){this.dispatchEvent({type:"requestRender"})}}});var z1,Mo,bu=F(()=>{"use strict";X();Xi();(t=>t.is=e=>"objectHelper"in e)(z1||(z1={}));Mo=(i,t)=>class extends Tf(i){constructor(){super(...arguments);this.objectHelper=new t(this);this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(r,s){this.objectHelper.raycast(r,s)}showGizmos(){for(let r in this.gizmos){let s=this.gizmos[r];s instanceof jl&&(s.visible=!0)}}updateEntityBoxSize(r,s){this.objectHelper.visible&&this.geometryHelper instanceof ni?(r.setScalar(0),s.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(r,s)}hideGizmos(){for(let r in this.gizmos){let s=this.gizmos[r];s instanceof jl&&(s.visible=!1)}}}});var cs,av=F(()=>{"use strict";X();Jy();bu();cs=class extends Mo(Bs,xo){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function oa(i,t,e,n,r,s,o){G1.set(r,s,o).unproject(n);let a=t[i];if(a!==void 0){let l=e.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],G1.x,G1.y,G1.z)}}var G1,_o,RP,j1,VU=F(()=>{"use strict";X();gf();yf();G1=new M,_o=new xs,RP=class extends Nl{constructor(e){let n=new De,r=new ks({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Ze(15711266),c=new Ze(15711266),u=new Ze(2857471);d("n1","n2",l),d("n2","n4",l),d("n4","n3",l),d("n3","n1",l),d("f1","f2",l),d("f2","f4",l),d("f4","f3",l),d("f3","f1",l),d("n1","f1",l),d("n2","f2",l),d("n3","f3",l),d("n4","f4",l),d("p","n1",c),d("p","n2",c),d("p","n3",c),d("p","n4",c),d("u1","u2",u),d("u2","u3",u),d("u3","u1",u);function d(p,f,g){h(p,g),h(f,g)}function h(p,f){s.push(0,0,0),o.push(f.r,f.g,f.b),a[p]===void 0&&(a[p]=[]),a[p].push(s.length/3-1)}n.setAttribute("position",new Ve(s,3)),n.setAttribute("color",new Ve(o,3));super(n,r);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,n=this.pointMap,r=!0;_o.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=r?.8:1e-4;oa("n1",n,e,_o,-s,-o,a),oa("n2",n,e,_o,s,-o,a),oa("n3",n,e,_o,-s,o,a),oa("n4",n,e,_o,s,o,a);let l=a;oa("f1",n,e,_o,-s,-o,l),oa("f2",n,e,_o,s,-o,l),oa("f3",n,e,_o,-s,o,l),oa("f4",n,e,_o,s,o,l);let c=l,u=.5;oa("u1",n,e,_o,s*.7*u,o*1.1,c),oa("u2",n,e,_o,-s*.7*u,o*1.1,c),oa("u3",n,e,_o,0,o*(1.1+.9*u),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};j1=class extends Va(RP){constructor(e){super(e);this.object=e;this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,n){za(this.object,this.geometry,e,n,!0)}}});function zU(i){return 1-Math.pow(1-i,3)}var H1,Mf,OP,DP,LP,lv,NP,qa,hn,Xs=F(()=>{"use strict";X();VU();pt();bu();gn();H1=790;Mf=new M,OP=new M,DP=new qe,LP=new M,lv=new M,NP=new M,qa=class extends Mo(xs,j1){constructor(e="",n={...Vd.defaultData,name:""}){super();this._cameraType="OrthographicCamera";this.targetOffset=ea.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.wasMovedByUser=!1;this.wasMovedBySwitchCameraAction=!1;this._createdAt=typeof performance<"u"?performance.now():0;this._tickProjectionTransition=()=>{let e=this._projectionTransition;if(e===void 0)return;if(this.disposed){this._endProjectionTransition();return}e.raf=requestAnimationFrame(this._tickProjectionTransition);let n=qa.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),n?.()};this.super_Entity(e,n),this.previousProjectionMatrix=new ne,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,s=this.height;this.orthoCamera=new Yo(r*-.5,r*.5,s*.5,s*-.5,-5e4,1e4),this.perspCamera=new Xo(45,r/s,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(e){let n=qa.projectionTransitionsEnabled;qa.projectionTransitionsEnabled=!1;try{return e()}finally{qa.projectionTransitionsEnabled=n}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,n){e==="PerspectiveCamera"?this.perspCamera.near=n:this.orthoCamera.near=n}setZoom(e,n){n>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=n:this.orthoCamera.zoom=n)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,n,r){typeof e=="number"&&(e=new M(e,n,r)),super.lookAt(e),this.getWorldPosition(Mf),this.targetOffset=Mf.distanceTo(e)}getTarget(e=new M){return this.getWorldDirection(OP),this.getWorldPosition(Mf),OP.multiplyScalar(this.targetOffset),e.copy(Mf).add(OP),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Mf),Mf.distanceTo(e)}updateUp(){this.getWorldQuaternion(DP),LP.set(0,0,1).applyQuaternion(DP),lv.copy(Zt.DEFAULT_UP),this.isUpVectorFlipped&&lv.negate(),lv.applyQuaternion(DP),NP.copy(Zt.DEFAULT_UP).projectOnPlane(LP),this.angleOffsetFromUp=NP.angleTo(lv),this.angleOffsetFromUp*=NP.cross(lv).dot(LP)>=0?1:-1}updateTransformState(e,n){let r=super.updateTransformState(e,n);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(e){let n=e.getWorldPosition(new M),s=e.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:n.clone().add(s),target:n}}getViewToTarget(e){let r=this.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:e.clone().sub(r),target:e}}getViewToObject(e){let n=new M;return e.getWorldPosition(n),this.getViewToTarget(n)}setViewplaneSize(e,n,r=!1){if(this.aspect=e/n,r){let s=e>n?this.aspect:1,o=e>n?1:this.aspect;this.left=-H1*.5*s,this.right=H1*.5*s,this.top=H1*.5*(1/o),this.bottom=-H1*.5*(1/o)}else this.left=-e*.5,this.right=e*.5,this.top=n*.5,this.bottom=-n*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let e=this._projectionTransition;if(e===void 0)return 1;let n=(performance.now()-e.start)/e.duration;return n>=1?1:n<=0?0:zU(n)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return qa.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=qa.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let n=this._projectionTransition;n===void 0&&(n={from:new ne,blend:new ne,blendInverse:new ne,start:0,duration:qa.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=n),n.from.copy(this.projectionMatrix),n.start=performance.now(),n.duration=qa.projectionTransitionDuration,n.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(n.requestRender=e),n.raf!==0&&cancelAnimationFrame(n.raf),n.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let n=(performance.now()-e.start)/e.duration;if(n>=1){this._endProjectionTransition();return}let r=zU(n),s=e.from.elements,o=this._activeSubCamera.projectionMatrix.elements,a=e.blend.elements,l=e.referenceDepth,c=Math.max(1e-6,s[15]-s[11]*l),u=Math.max(1e-6,o[15]-o[11]*l),d=r*c/(r*c+(1-r)*u);for(let h=0;h<16;h++)a[h]=s[h]+(o[h]-s[h])*d;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let n=this._activeSubCamera;this.projectionMatrix=n.projectionMatrix,this.projectionMatrixInverse=n.projectionMatrixInverse}_syncProjectionTransition(e){let n=e._projectionTransition;if(n===void 0){this._projectionTransition!==void 0&&this._endProjectionTransition();return}let r=this._projectionTransition;r===void 0?(r={from:new ne,blend:new ne,blendInverse:new ne,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):r.raf!==0&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(n.from),r.start=n.start,r.duration=n.duration,r.referenceDepth=n.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,n,r,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,n,r,s,o,a):this.orthoCamera.setViewOffset(e,n,r,s,o,a),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,n){return super.copy(e,n),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=ea.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){let n={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ny(n,e)}updateCameraSubtype(e,n){let r=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";n.zoom!==void 0&&this.setZoom(r,n.zoom),n.near!==void 0&&this.setNear(r,n.near),n.fov!==void 0&&r==="PerspectiveCamera"&&(this.fov=n.fov)}updateState(e,n){this.updateCameraState(e,n)}updateCameraState(e,n){this.updateState_Entity(e,n),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(n?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(r=>typeof r=="number"?r:0)),e.targetOffset!==void 0&&(this.targetOffset=ea.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},hn=qa;hn.projectionTransitionsEnabled=!1,hn.projectionTransitionDuration=350,hn.projectionTransitionMinAgeMs=1e3});function W1(i){return i.type==="TorusGeometry"&&i.arc===360}var GU,BP,cv,_f=F(()=>{"use strict";X();GU=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??n),s=Math.abs(e.depth??n),o=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(e,{width:n,height:r,depth:s,radius:o,segments:Math.round(e.segments),pathSegments:Math.round(e.pathSegments),cornerSegments:Math.round(e.cornerSegments)})}}static build(i){let{width:t,height:e,depth:n,radius:r,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:d}=i.parameters,h=new cv(!1,t,e,n,r,s,o,a,l,c,u,d);return Object.assign(h,{userData:{...i,type:"HelixGeometry"}})}},BP=new Us([0,0,0],1);cv=class extends De{constructor(t=!0,e=1,n=1,r=1,s=1,o=1,a=1,l=1,c=1,u=1,d=1,h=1){if(super(),o===0)return;let p=t&&o===1;p&&(h=0),d>100&&(d=100),d===0&&(h=0);let f=()=>new M,g=new M,m=f(),y=f(),v=f(),b,x,S,E,T,w,_,A,C=f(),P=f(),D=f(),O=f(),L=f(),U=f(),G=f(),Y=f(),oe=n-2*l+.001,ee=oe/o,J=Math.ceil(a*o),Q=J+1,re=oe/J,me=-oe/2,ve=u+1,pe=2*Math.PI/u,Ee=Math.PI/2/h,ce=.01,Se=Math.min((1-d/100)*l,l-ce),Pe=l-Se,Le=0,ke=2,Ce=h*ke+ke,le=ve*Ce/ke,ye=le+ve*Q,Te=Math.max(0,ve*(Q+Ce)),[Ne,He,Me]=[3,3,2].map(be=>Array(Te*be).fill(0)),Oe=[],B=s-l;function fe(be,Fe){let ue=Math.PI/2;w=Fe*re,A=2*Math.PI*(w%ee)/ee+ue,w+=me,_=Math.sin(A)*B,T=Math.cos(A)*B,t?be.set(T,_,w):be.set(T,w,_)}fe(g,-1e-10),fe(m,0),C.copy(g),fe(g,1);let W=g.distanceTo(m),et=p?0:Pe+Se,Ge=W*J+2*et,z=Se,I=Ge-et;for(let be=0;be<=J;be++){fe(y,be),Y.subVectors(y,C).normalize(),C.copy(y),U.copy(y).setComponent(+t+1,0).normalize(),G.crossVectors(Y,U).normalize();let Fe=be===0,ue=be===J,_e=Fe?3*Math.PI/2:Ee,Ke=Fe?z:I,xt=Fe?ve:ye,Je=Fe?0:Te-ve,Xe=Y.clone().multiplyScalar(Fe?-Pe:Pe).add(y),rt=Y.clone().multiplyScalar(Fe?-1:1).normalize();for(let yt=0;yt<ve;yt++){let Ut=yt*pe;if(P.addVectors(g.copy(U).multiplyScalar(l*Math.cos(Ut)),m.copy(G).multiplyScalar(l*Math.sin(Ut))),D.copy(P).normalize(),Fe||ue){p||(Le=Je+yt,[0,1,2].forEach($=>{Ne[Le*3+$]=Xe.getComponent($),He[Le*3+$]=rt.getComponent($)}),Me[Le*2]=+ue,Me[Le*2+1]=yt/u),m.copy(D).multiplyScalar(Se),v.addVectors(y,m);for(let $=0;$<h;$++){let Ye=$*Ee+_e;O.addVectors(g.copy(Y).multiplyScalar(Pe*Math.sin(Ye)),m.copy(D).multiplyScalar(Pe*Math.cos(Ye))),L.copy(O).normalize(),m.addVectors(v,O),O.normalize(),Le=xt+$*ve+yt,[0,1,2].forEach($e=>{Ne[Le*3+$e]=m.getComponent($e),He[Le*3+$e]=L.getComponent($e)});let Ae=+Fe+Math.sin(Ye);Me[Le*2]=(Ke+Pe*Ae)/Ge,Me[Le*2+1]=yt/u}}m.addVectors(y,P),Le=le+be*ve+yt,[0,1,2].forEach($=>{Ne[Le*3+$]=m.getComponent($),He[Le*3+$]=D.getComponent($)}),Me[Le*2]=(et+be*W)/Ge,Me[Le*2+1]=yt/u}}let q=Q+2*h+ke,[Z,ae]=[+p,q-1];for(let be=Z;be<=ae-1;be++){let Fe=p&&be===ae-1;for(let ue=0;ue<ve-1;ue++)b=be*ve+ue,x=b+1,S=(Fe?ue:b)+ve,E=(Fe?ue+1:x)+ve,be===0?Oe.push(x,E,S):be===q-2?Oe.push(b,x,S):Oe.push(b,x,S,x,E,S)}this.setIndex(Oe),this.setAttribute("position",new Ve(Ne,3)),this.setAttribute("normal",new Ve(He,3)),this.setAttribute("uv",new Ve(Me,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t=this.userData.parameters,e=Math.ceil(t.tubularSegments),n=t.radialSegments,r=n+1,s=[],o,a,l,c;for(let u=1;u<e;u++)for(let d=0;d<n;d++)o=u*r+d,a=o+1,l=o+r,c=a+r,s.push(o,a,l,a,c,l);for(let u=0;u<n;u++)o=e*r+u,a=o+1,l=u+r,c=u+1+r,s.push(o,a,l,a,c,l);return BP.array=new Uint32Array(s),BP.count=s.length,BP}}});function HU(i){if(q1)return q1;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.27/build"),s=import("./boolean.js"),[o,a]=await Promise.all([s,fetch(`${n}/boolean.wasm`).then(l=>l.arrayBuffer())]);await o.default({module_or_path:a}),uv=o}return q1=t(),q1}function Y1(){if(uv===void 0)throw new Error("boolean-wasm is not loaded");return uv}function FP(i){let t=X1.get(i);if(t===void 0)throw new Error("Unknown csg mesh set handle "+i);return t}function UP(i){return X1.set(++jU,i),jU}function SJ(i,t){if(t&&i.userData.positions!==void 0){let a=i.userData,l=[];for(let c=0,u=0;c<a.verticesPerFace.length;c++){let d=a.verticesPerFace[c];for(let h=1;h<d-1;h++)l.push(a.indices[u],a.indices[u+h],a.indices[u+h+1]);u+=d}return{positions:a.positions instanceof Float32Array?a.positions:new Float32Array(a.positions),indices:new Uint32Array(l)}}let e;W1(i.userData.parameters)?e=i.getClosedTorusIndicesForBooleanOrSubdiv():e=i.getIndex();let n=i.getAttribute("position"),r;if(e===null){r=new Uint32Array(n.count);for(let a=0;a<r.length;a++)r[a]=a}else e.array instanceof Uint32Array?r=e.array:r=new Uint32Array(e.array);let s=i.getAttribute("normal"),o=s!==void 0&&s.itemSize===3&&s.count===n.count&&s.array instanceof Float32Array&&s.isInterleavedBufferAttribute!==!0?s.array:void 0;return{positions:n.array,indices:r,normals:o}}function WU(i,t,e){if(uv===void 0)return-1;let{positions:n,indices:r,normals:s}=SJ(i,t);return UP(new uv.CsgMesh(n,r,s))}function qU(i,t){let e=Y1(),n=xJ[t];if(n===void 0)throw new Error("Unknown boolean operation "+t);let r=i.map(FP);if(r.length===1)return e.clone_mesh(r[0]);let s=[],o;if(t===2&&r.length>2){let a=r[0];for(let l=1;l<r.length-1;l++)a=e.boolean_mesh(a,r[l],0),s.push(a);o=e.boolean_mesh(r[r.length-1],a,2)}else if(t===2)o=e.boolean_mesh(r[1],r[0],2);else{let a=r[r.length-1];for(let l=0;l<r.length-1&&(a=e.boolean_mesh(a,r[l],n),s.push(a),a.tri_count()!==0);l++);o=a,s.pop()}for(let a of s)a.free();return o}function XU(i,t,e,n){let r=Y1(),s=qU(i,t),o=r.mesh_render_data(s,Math.max(n,0));if(e.setAttribute("position",new Ve(o.positions(),3)),e.setAttribute("normal",new Ve(o.normals(),3)),o.free(),e.boundingSphere===null&&(e.boundingSphere=new nr),s.tri_count()===0)e.boundingSphere.center.set(0,0,0),e.boundingSphere.radius=0,e.userData.parameters={width:0,height:0,depth:0};else{let a=s.bounds();e.boundingSphere.center.set(a[0],a[1],a[2]),e.boundingSphere.radius=(a[3]**2+a[4]**2+a[5]**2)**.5,e.userData.parameters={width:a[3]*2,height:a[4]*2,depth:a[5]*2}}return UP(s)}function YU(i,t){let e=Y1(),n=qU(i,t),r=e.mesh_topological_data(n),s=r.positions(),o=r.indices();r.free(),n.free();let a=new Uint8Array(o.length/3).fill(3);return{positions:s,indices:o,verticesPerFace:a}}function $1(i,t){FP(i).transform(new Float32Array(t.elements))}function K1(i){let t=X1.get(i);t!==void 0&&(t.free(),X1.delete(i))}function $U(i,t){let e=Y1();return UP(e.instanced_union(FP(i),t))}var uv,X1,jU,q1,xJ,dv=F(()=>{X();_f();X1=new Map,jU=0;xJ={[0]:0,[1]:1,[2]:2}});function Xd(i){return i!==null&&"booleanOp"in i}var Af,KU=F(()=>{"use strict";X();Xi();dv();Af=class extends Tf(Ht){constructor(){super(...arguments);this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new ne}updateVisible(e){super.updateVisible(e),this.visible=!Xd(this.parent)&&this.visible,Xd(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Xd(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(K1(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Xd(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof Af&&(e.freeBooleanPointer(),Xd(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,n){let r=super.updateTransformState(e,n);return r&&Xd(this.parent)&&this.invalidateDownstreamBooleanData(!0),r}onVariableUpdate(e=!1){super.onVariableUpdate(e),Xd(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}});function ZU(){return wJ}var wJ,QU=F(()=>{"use strict";wJ=null});function hv(i,t=0,e=i.count,n,r){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let d=t;d<e;d++){let h=i.getX(d),p=i.getY(d),f=i.getZ(d);h<s&&(s=h),p<o&&(o=p),f<a&&(a=f),h>l&&(l=h),p>c&&(c=p),f>u&&(u=f)}Z1.min.set(s,o,a),Z1.max.set(l,c,u),Z1.getCenter(n),Z1.getSize(r).multiplyScalar(.5)}var Z1,EJ,TJ,Kt,ii=F(()=>{"use strict";X();KU();QU();Z1=new Nt;EJ=new De,TJ=new ti,Kt=class extends Af{constructor(t,e){super(EJ,TJ),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let n=ZU();if(n!==null){n(this,t,e);return}super.raycast(t,e)}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?hv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}}});function Yd(i){return i?.isClassicNodeMaterial===!0}function JU(i){return i?.isClassicSharedMaterial===!0}var Q1=F(()=>{"use strict"});var yn,Ao=F(()=>{X();yn=class extends Ze{constructor(e,n,r,s){super(e,n,r);this.isColorA=!0;this.a=s}setRGBA(e,n,r,s){super.setRGB(e,n,r),this.a=s}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,n="srgb"){let r;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(r=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=o==="rgba"?parseFloat(s[4]):1,super.setStyle(e,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=o==="hsla"?parseFloat(s[4]):1,super.setStyle(e,n);break}}return super.setStyle(e,n)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}});var oc,VP=F(()=>{"use strict";Ao();oc=class extends yn{}});var J1,ek=F(()=>{"use strict";J1=class{constructor(t=1e3*10){this.timeout=t;this.cache=new Map;this.head={data:null,time:0,src:null,next:null,prev:null};this.tail={data:null,time:1/0,src:null,next:null,prev:null};this.hasClean=!1;this.cleanupTimer=null;this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let n=e;e=e.next,e.prev=this.head,this.head.next=e,n.next=null,n.prev=null,n.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),n=this.cache.get(t);return n===void 0?(n={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,n)):(n.time=e,n.prev.next=n.next,n.next.prev=n.prev),n.prev=this.tail.prev,n.next=this.tail,this.tail.prev.next=n,this.tail.prev=n,this.scheduleCleanup(),n.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}});function tk(i){return typeof i=="string"?i:(pv||(pv=new zP),pv.load(i))}function nk(){pv&&pv.disposeAll()}var zP,pv,GP=F(()=>{ek();zP=class extends J1{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}});var ew,tw,jP=F(()=>{"use strict";ew=class{constructor(t,e){this.data=t;this.cache=e;this.refCount=0}deref(){if(this.refCount===0&&!1)throw new Error("ref count -1?");this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){if(this.refCount!==0&&!1)throw new Error("ref count is not 0")}},tw=class{constructor(){this.cache=new Map}remove(t){if(this.cache.delete(t.data)===!1&&!1)throw new Error("ref count remove non-exists")}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}});var nw,rk=F(()=>{X();nw=class extends iy{constructor(t){super(t),this.type=hr}parse(t){let o=function(w,_){switch(w){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(_||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(_||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(_||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(_||""))}},u=`
4128
4128
  `,d=function(w,_,A){_=_||1024;let P=w.pos,D=-1,O=0,L="",U=String.fromCharCode.apply(null,new Uint16Array(w.subarray(P,P+128)));for(;0>(D=U.indexOf(u))&&O<_&&P<w.byteLength;)L+=U,O+=U.length,P+=128,U=String.fromCharCode.apply(null,new Uint16Array(w.subarray(P,P+128)));return-1<D?(A!==!1&&(w.pos+=O+D+1),L+U.slice(0,D)):!1},h=function(w){let _=/^#\?(\S+)/,A=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,C=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,P=/^\s*FORMAT=(\S+)\s*$/,D=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,O={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},L,U;for((w.pos>=w.byteLength||!(L=d(w)))&&o(1,"no header found"),(U=L.match(_))||o(3,"bad initial token"),O.valid|=1,O.programtype=U[1],O.string+=L+`
4129
4129
  `;L=d(w),L!==!1;){if(O.string+=L+`
4130
4130
  `,L.charAt(0)==="#"){O.comments+=L+`
4131
4131
  `;continue}if((U=L.match(A))&&(O.gamma=parseFloat(U[1])),(U=L.match(C))&&(O.exposure=parseFloat(U[1])),(U=L.match(P))&&(O.valid|=2,O.format=U[1]),(U=L.match(D))&&(O.valid|=4,O.height=parseInt(U[1],10),O.width=parseInt(U[2],10)),O.valid&2&&O.valid&4)break}return O.valid&2||o(3,"missing format specifier"),O.valid&4||o(3,"missing image size specifier"),O},p=function(w,_,A){let C=_;if(C<8||C>32767||w[0]!==2||w[1]!==2||w[2]&128)return new Uint8Array(w);C!==(w[2]<<8|w[3])&&o(3,"wrong scanline width");let P=new Uint8Array(4*_*A);P.length||o(4,"unable to allocate buffer space");let D=0,O=0,L=4*C,U=new Uint8Array(4),G=new Uint8Array(L),Y=A;for(;Y>0&&O<w.byteLength;){O+4>w.byteLength&&o(1),U[0]=w[O++],U[1]=w[O++],U[2]=w[O++],U[3]=w[O++],(U[0]!=2||U[1]!=2||(U[2]<<8|U[3])!=C)&&o(3,"bad rgbe scanline format");let oe=0,ee;for(;oe<L&&O<w.byteLength;){ee=w[O++];let Q=ee>128;if(Q&&(ee-=128),(ee===0||oe+ee>L)&&o(3,"bad scanline data"),Q){let re=w[O++];for(let me=0;me<ee;me++)G[oe++]=re}else G.set(w.subarray(O,O+ee),oe),oe+=ee,O+=ee}let J=C;for(let Q=0;Q<J;Q++){let re=0;P[D]=G[Q+re],re+=C,P[D+1]=G[Q+re],re+=C,P[D+2]=G[Q+re],re+=C,P[D+3]=G[Q+re],D+=4}Y--}return P},f=function(w,_,A,C){let P=w[_+3],D=Math.pow(2,P-128)/255;A[C+0]=w[_+0]*D,A[C+1]=w[_+1]*D,A[C+2]=w[_+2]*D,A[C+3]=1},g=function(w,_,A,C){let P=w[_+3],D=Math.pow(2,P-128)/255;A[C+0]=Fs.toHalfFloat(Math.min(w[_+0]*D,65504)),A[C+1]=Fs.toHalfFloat(Math.min(w[_+1]*D,65504)),A[C+2]=Fs.toHalfFloat(Math.min(w[_+2]*D,65504)),A[C+3]=Fs.toHalfFloat(1)},m=new Uint8Array(t);m.pos=0;let y=h(m),v=y.width,b=y.height,x=p(m.subarray(m.pos),v,b),S,E,T;switch(this.type){case Wt:T=x.length/4;let w=new Float32Array(T*4);for(let A=0;A<T;A++)f(x,A*4,w,A*4);S=w,E=Wt;break;case hr:T=x.length/4;let _=new Uint16Array(T*4);for(let A=0;A<T;A++)g(x,A*4,_,A*4);S=_,E=hr;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:v,height:b,data:S,header:y.string,gamma:y.gamma,exposure:y.exposure,type:E,colorSpace:Ma,minFilter:ht,magFilter:ht,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function HP(i){return i.length>2&&i[0]===35&&i[1]===63}function ik(i){try{let t=new nw().parse(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength));if(!t||!t.width||!t.height)return null;let{width:e,height:n}=t,r=t.data,s=new Uint16Array(r.length),o=e*4,a=u=>Fs.toHalfFloat(Math.pow(Math.max(Fs.fromHalfFloat(u),0),1/2.2)),l=new Map,c=u=>{let d=l.get(u);return d===void 0&&(d=a(u),l.set(u,d)),d};for(let u=0;u<n;u++){let d=u*o,h=(n-1-u)*o;for(let p=0;p<o;p+=4)s[h+p]=c(r[d+p]),s[h+p+1]=c(r[d+p+1]),s[h+p+2]=c(r[d+p+2]),s[h+p+3]=r[d+p+3]}return{isSplineHdr:!0,data:s,width:e,height:n}}catch{return null}}function sk(i){let t=new Hn(i.data,i.width,i.height,qn,hr);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var ok=F(()=>{"use strict";X();rk()});var MJ,Cf,WP=F(()=>{"use strict";X();GP();jP();ok();MJ=0,Cf=class extends ew{constructor(e,n){super(e,n.imageHolderCache);this.data=e;this.shared=n;this.instanceId=++MJ;this.loaded=!1;this.isVideo=!1;this.isBuffer=!1;this.isHdr=!1;this._cache={[1e3]:{},[1001]:{},[1002]:{}};this.isVideo=e.type==="video",this.isBuffer=e.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let n=()=>{this.loaded=!0;for(let r of Object.values(this._cache))for(let s of Object.values(r))for(let o of Object.values(s))o&&(o.image=this.img,o.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof e!="string"){let r=new FileReader;r.readAsDataURL(new Blob([e],{type:"video/mp4"}));let s;await new Promise(o=>{r.onloadend=a=>{s=a.target?.result,o(null)}}),this.img.src=s}else this.img.src=e;this.img.onloadeddata=()=>{n()}}else if(e instanceof Uint8Array?HP(e):typeof e=="string"&&/\.hdr($|[?#])/i.test(e)){let r=e instanceof Uint8Array?e:null;if(r===null)try{r=new Uint8Array(await(await fetch(e)).arrayBuffer())}catch{r=null}let s=r!==null&&HP(r)?ik(r):null;s!==null&&(this.isHdr=!0,this.img=s,n())}else this.img=new Image,this.img.src=tk(e),this.img.onload=n,await new Promise(r=>{this.img.onload=()=>{n(),r(null)}})}getTexture(e,n=1008,r=1006){let s=this._cache[e]?.[n]?.[r];if(s)return s;{let o;return this.isBuffer?o=this.img.texture:this.isVideo?o=new $g(this.img,void 0,e,e):this.isHdr?(o=sk(this.img),o.wrapS=e,o.wrapT=e,o.magFilter=r,o.minFilter=n):o=new mn(this.img,void 0,e,e,r,n),this.isBuffer||(o.anisotropy=8,o.generateMipmaps=n===1008),this.loaded&&(o.needsUpdate=!0),this._cache[e]===void 0&&(this._cache[e]={}),this._cache[e][n]===void 0&&(this._cache[e][n]={}),this._cache[e][n][r]=o,o}}setNeedsUpdate(e){if(!this.isBuffer)for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let s of Object.values(r))s&&(s.needsUpdate=e)}disposeTextures(){for(let[e,n]of Object.entries(this._cache))for(let[r,s]of Object.entries(n))for(let[o,a]of Object.entries(s))a?.dispose(),this._cache[e]!==void 0&&this._cache[e][r]!==void 0&&(this._cache[e][r][o]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}});var Ys,rw=F(()=>{"use strict";WP();Ys=class extends Cf{}});function lk(i){if(typeof i=="string")return i;let t=ak.get(i);return t||(t={url:URL.createObjectURL(new Blob([i]))},ak.set(i,t)),t.url}var ak,ck=F(()=>{"use strict";ak=new Map});function pk(){if(uk)return;if(iw)return iw;async function i(){await import("./howler.js"),dk(window!==void 0?window:global),uk=!0}return iw=i(),iw}var dk,hk,uk,iw,qP=F(()=>{hk=new Promise(i=>{dk=i}),uk=!1});function fk(i,t){i.forEach(e=>{"dragDropActions"in e.data?(t.push(...e.data.dragDropActions.drag),t.push(...e.data.dragDropActions.drop)):"inActions"in e.data?(t.push(...e.data.inActions),t.push(...e.data.outActions)):"gameActions"in e.data?(t.push(...e.data.gameActions.idle),t.push(...e.data.gameActions.move),t.push(...e.data.gameActions.jump),t.push(...e.data.gameActions.run)):"breakpoints"in e.data?e.data.breakpoints.forEach(n=>{t.push(...n.data.actions)}):"actions"in e.data&&(t.push(...e.data.actions),e.data.actions.forEach(n=>{n.data.type==="Conditional"&&n.data.ifActions&&(t.push(...n.data.ifActions),t.push(...n.data.elseActions))}))})}function gk(i){let t=!1,e=[];return i.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((s,o)=>{if(o.events===void 0||Array.isArray(o.events)===!1)return!0;fk(o.events,e),t=t||e.some(a=>a.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;fk(r.events,e),t=t||e.some(s=>s.data.type==="Audio")}),t}var mk,ac,sw=F(()=>{ck();qP();hk.then(i=>mk=i);ac=class{constructor({src:t,volume:e,delay:n,loop:r}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._status="stopped";this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)};let s;typeof t=="string"?s={src:t}:s={src:lk(t),format:"wav"},this.sound=new mk.Howl(s),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),n!==void 0&&(this.delay=n),r!==void 0&&(this.loop=r)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,n){this.sound.on(t,e,n)}off(t,e,n){this.sound.off(t,e,n)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function vk(i){yk=i}function bk(){return yk}function XP(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&(n.geometry.type==="TextGeometry"||n.geometry.type==="InputGeometry")&&(t=!0)}),t}var yk,ow=F(()=>{yk=null});function xk(i){return new j(i.y,-i.x)}var aw,fv,mv=F(()=>{"use strict";X();aw=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=i.parameters?.radiusTop,n=i.parameters?.radiusBottom,r=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},i.parameters);r.thetaLength=xe.clamp(r.thetaLength,0,360),r.hollow=xe.clamp(r.hollow??0,0,1);let s=r.width/2,o=r.radiusTop??s,a=r.radiusBottom??s;if(o===a?(o=s,a=s):o>a?(o=s,a=a*s/o):(o=o*s/a,a=s),r.shapeBlendNode){o=e??s,a=n??s;let l=Math.max(o,a)*2;r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:o,radiusBottom:a})}}static build(i){let{width:t,depth:e,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:u,cornerRadius:d,cornerSegments:h,hollow:p}=i.parameters,f;l===0?(f=new De,f.setAttribute("position",new Ve([],3))):d||p?f=new fv(c,u,n,r,s,o,a,l*Math.PI/180,d,d,h,p):f=new Aa(c,u,n,r,s,o,a,l*Math.PI/180);let g=e/t;return g!==1&&f.scale(1,1,g),Object.assign(f,{userData:{...i,type:"CylinderGeometry"}})}};fv=class extends De{constructor(t,e,n,r,s,o,a,l,c,u,d,h,p=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,n=n||1,r=Math.floor(r)||8,s=Math.floor(s)||1,o=o!==void 0?o:!1,a=a!==void 0?a:0,l=l!==void 0?l:Math.PI*2,o&&(c=0,u=0);let f=n/2;p&&t==0&&(t=c),p&&e==0&&(e=u);let g=new j(t,f),m=new j(e,-f),y=null,v=null,b=null,x=null,S=g.clone().sub(m),E=0,T=0,w=0;h>0&&(E=Math.min(t,e)*(1-h),T=t-E,w=e-E);let _=g.clone();_.x-=E;let A=Math.PI-S.angle(),C=S.angle(),P=Math.tan(C/2),D=Math.tan(A/2),O=P+D,L=h?O:D,U=h?O:P;if(c=Math.min(c,(t-T)/L,S.length()/O),u=Math.min(u,(e-w)/U,S.length()/O),c>0){let Me=c/P;y=g.clone().sub(new j(Me,c)),h&&(b=y.clone(),b.x-=E-O*c),g.sub(S.clone().setLength(Me))}if(u>0){let Me=u/D;v=m.clone().sub(new j(Me,-u)),m.add(S.clone().setLength(Me)),h&&(x=v.clone(),x.x-=E-O*u,_.sub(S.clone().setLength(Me)))}S=g.clone().sub(m);let G=S.length()<.5,Y=[],oe=[],ee=[],J=[],Q=[],re=[],me=(Me,Oe,B,fe,W)=>{for(let et=0;et<d+1;et++){let Ge=et/d,z=fe<0?Ge:1-Ge;W&&(z-=1),z*=Me;let I=Math.sin(z),q=Math.cos(z)*fe,Z=q*Oe+B.y;Y.push(I*Oe+B.x),oe.push(Z),ee.push(I),J.push(q),Q.push(.5+Z/n),re.push(!1)}},ve=(Me,Oe,B)=>{let fe=[Me,Oe];B<0&&fe.reverse();for(let W of fe)Y.push(W),oe.push(f*B),ee.push(0),J.push(B),Q.push(.5),re.push(!0)};if(x&&v?(me(A,u,x,-1,!0),me(C,u,v,-1,!1)):v?(ve(v.x,0,-1),me(C,u,v,-1,!1)):o||ve(e,w,-1),!G){let Me=xk(S).normalize();for(let Oe=0;Oe<=s;Oe++){let B=Oe/s,fe=S.y*B+m.y;Y.push(S.x*B+m.x),oe.push(fe),ee.push(Me.x),J.push(Me.y),Q.push(.5+fe/n),re.push(!1)}}if(b&&y?(me(A,c,y,1,!1),me(C,c,b,1,!0)):y?(me(A,c,y,1,!1),ve(y.x,0,1)):o||ve(t,T,1),h&&!G){let Me=xk(S).multiplyScalar(-1).normalize();for(let Oe=0;Oe<=s;Oe++){let B=Oe/s,fe=S.y*-B+_.y;Y.push(S.x*-B+_.x),oe.push(fe),ee.push(Me.x),J.push(Me.y),Q.push(.5+fe/n),re.push(!1)}}let pe=Y.length,ce=pe+(h&&!o?1:0),Se=(Me,Oe)=>Me*pe+(Oe===pe?0:Oe),Pe=l<Math.PI*2,Le=(r+1)*pe+(Pe?2*(1+ce):0),ke=new Float32Array(Le*3),Ce=new Float32Array(Le*3),le=new Float32Array(Le*2),ye=Le-1>65535?new Uint32Array(r*Math.max(0,ce-1)*6+(Pe?2*(ce+1)*3:0)):new Uint16Array(r*Math.max(0,ce-1)*6+(Pe?2*(ce+1)*3:0)),Te=0,Ne=0;for(let Me=0;Me<=r;Me++){let Oe=Me/r,B=Oe*l+a,fe=Math.sin(B),W=Math.cos(B);for(let et=0;et<pe;et++){let Ge=Ne*3,z=Ne*2,I=Y[et],q=ee[et];ke[Ge]=I*fe,ke[Ge+1]=oe[et],ke[Ge+2]=I*W,Ce[Ge]=q*fe,Ce[Ge+1]=J[et],Ce[Ge+2]=q*W,re[et]?(le[z]=.5,le[z+1]=.5):(le[z]=Oe,le[z+1]=Q[et]),Ne++}}for(let Me=0;Me<r;Me++)for(let Oe=0;Oe<ce-1;Oe++){if(o&&h&&Oe==s)continue;let B=Se(Me,Oe),fe=Se(Me+1,Oe),W=Se(Me+1,Oe+1),et=Se(Me,Oe+1),Ge=ke[W*3+0],z=ke[W*3+2];ye[Te++]=B,ye[Te++]=fe,ye[Te++]=et,(Ge!=0||z!=0)&&(ye[Te++]=fe,ye[Te++]=W,ye[Te++]=et)}Pe&&(He(-1,0,a),He(1,r*pe,a+l)),this.setIndex(new je(ye.slice(0,Te),1)),this.setAttribute("position",new je(ke,3)),this.setAttribute("normal",new je(Ce,3)),this.setAttribute("uv",new je(le,2));function He(Me,Oe,B){let fe=Math.sin(B),W=Math.cos(B),et=-W,Ge=fe,z=Me<0?(be,Fe,ue)=>{ye[Te++]=be,ye[Te++]=Fe,ye[Te++]=ue}:(be,Fe,ue)=>{ye[Te++]=be,ye[Te++]=ue,ye[Te++]=Fe},I=(t+e+T+w)/4,q=Ne*3,Z=Ne*2;ke[q]=I*fe,ke[q+1]=0,ke[q+2]=I*W,Ce[q]=et,Ce[q+1]=0,Ce[q+2]=Ge,le[Z]=.5,le[Z+1]=.5;let ae=Ne++;for(let be=0;be<ce;be++){let Fe=(Oe+(be===pe?0:be))*3;q=Ne*3,Z=Ne*2,ke[q]=ke[Fe],ke[q+1]=ke[Fe+1],ke[q+2]=ke[Fe+2],Ce[q]=et,Ce[q+1]=0,Ce[q+2]=Ge;let ue=Fe/3*2|0;le[Z]=le[ue],le[Z+1]=le[ue+1],Ne++}for(let be=ae+1;be<Ne-1;be++)z(ae,be,be+1);z(ae,Ne-1,ae+1)}}}});var Sk,YP=F(()=>{"use strict";X();mv();Sk=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},i.parameters);return e.thetaLength=xe.clamp(e.thetaLength,0,360),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,depth:e,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:u,cornerSegments:d}=i.parameters,h;l===0?(h=new De,h.setAttribute("position",new Ve([],3))):c>0||u>0||l<360?h=new fv(0,t/2,n,r,s,o,a,l*Math.PI/180,c,u,d,0,!0):h=new Bl(t/2,n,r,s,o);let p=e/t;return p!==1&&h.scale(1,1,p),Object.assign(h,{userData:{...i,type:"ConeGeometry"}})}}});var wk,$P,KP,ZP=F(()=>{"use strict";X();wk=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,widthSegments:r,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a===0?c=new ni(t,e,n,r,s,o):c=new KP(t,e,n,r,s,o,a,l),Object.assign(c,{userData:{...i,type:"CubeGeometry"}})}},$P=Math.PI/2,KP=class extends De{constructor(t=1,e=1,n=1,r=1,s=1,o=1,a=0,l=4){super(),this.type="BoxGeometry",r=Math.floor(r),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,t/2,e/2,n/2);let c=a>0,u=l+1,h=2*((o+1)*(s+1)+(r+1)*(o+1)+(r+1)*(s+1))+(c?u*4*(o+1+(r+1)+(s+1))+8*(u*(u+1)/2):0),p=2*(o*s+r*o+r*s)+(c?l*4*(o+r+s):0),f=c?8*l*l:0,g=new Float32Array(h*3),m=new Float32Array(h*3),y=new Float32Array(h*2),v=h-1>65535?new Uint32Array(p*6+f*3):new Uint16Array(p*6+f*3),b=0,x=0,S=new Float64Array(u),E=new Float64Array(u),T=new Float64Array(u),w=new Float64Array(u);for(let L=0;L<u;L++){let U=L/l*$P;S[L]=Math.sin(U)*a,E[L]=(1-Math.cos(U))*a,T[L]=Math.sin(U),w[L]=Math.cos(U)}let _=u*(u+1)/2,A=new Float64Array(_*3),C=new Float64Array(_*3);{let L=new M(t/2,e/2,n/2);L.subScalar(a);let U=0;for(let G=0;G<=l;G++){let Y=$P*(1-G/l),oe=Math.cos(Y),ee=Math.sin(Y),J=0;for(let Q=0;Q<=G;Q++){let re=Math.cos(J),me=Math.sin(J),ve=oe*re,pe=ee,Ee=oe*me;A[U*3]=ve,A[U*3+1]=pe,A[U*3+2]=Ee,C[U*3]=L.x+ve*a,C[U*3+1]=L.y+pe*a,C[U*3+2]=L.z+Ee*a,U++,J+=$P/G}}}P("z","y","x",-1,-1,n,e,t,o,s),P("z","y","x",1,-1,n,e,-t,o,s),P("x","z","y",1,1,t,n,e,r,o),P("x","z","y",1,-1,t,n,-e,r,o),P("x","y","z",1,-1,t,e,n,r,s),P("x","y","z",-1,-1,t,e,-n,r,s),a>0&&(D("z","y","x",-1,-1,1,n,e,t,o),D("z","y","x",1,-1,-1,n,e,t,o),D("z","y","x",-1,1,-1,n,e,t,o),D("z","y","x",1,1,1,n,e,t,o),D("x","y","z",-1,-1,-1,t,e,n,r),D("x","y","z",1,-1,1,t,e,n,r),D("x","y","z",-1,1,1,t,e,n,r),D("x","y","z",1,1,-1,t,e,n,r),D("y","x","z",-1,-1,1,e,t,n,s),D("y","x","z",1,-1,-1,e,t,n,s),D("y","x","z",1,1,1,e,t,n,s),D("y","x","z",-1,1,-1,e,t,n,s),O(1,1,1),O(-1,1,1),O(1,-1,1),O(-1,-1,1),O(1,1,-1),O(-1,1,-1),O(1,-1,-1),O(-1,-1,-1)),this.setIndex(new je(v,1)),this.setAttribute("position",new je(g,3)),this.setAttribute("normal",new je(m,3)),this.setAttribute("uv",new je(y,2));function P(L,U,G,Y,oe,ee,J,Q,re,me){let ve=(ee-2*a)/re,pe=(J-2*a)/me,Ee=ee/2-a,ce=J/2-a,Se=Q/2,Pe=re+1,Le=me+1,ke=0,Ce=new M;for(let le=0;le<Le;le++){let ye=le*pe-ce;for(let Te=0;Te<Pe;Te++){let Ne=Te*ve-Ee,He=(b+ke)*3,Me=(b+ke)*2;Ce[L]=Ne*Y,Ce[U]=ye*oe,Ce[G]=Se,g[He]=Ce.x,g[He+1]=Ce.y,g[He+2]=Ce.z,Ce[L]=0,Ce[U]=0,Ce[G]=Q>0?1:-1,m[He]=Ce.x,m[He+1]=Ce.y,m[He+2]=Ce.z,y[Me]=Te/re,y[Me+1]=1-le/me,ke+=1}}for(let le=0;le<me;le++)for(let ye=0;ye<re;ye++){let Te=b+ye+Pe*le,Ne=b+ye+Pe*(le+1),He=b+(ye+1)+Pe*(le+1),Me=b+(ye+1)+Pe*le;v[x++]=Te,v[x++]=Ne,v[x++]=Me,v[x++]=Ne,v[x++]=He,v[x++]=Me}b+=ke}function D(L,U,G,Y,oe,ee,J,Q,re,me){let ve=(J-2*a)/me,pe=J/2-a,Ee=Q/2-a,ce=re/2,Se=me+1,Pe=0,Le=new M,ke=new M;for(let Ce=0;Ce<l+1;Ce++){Le[U]=(Ee+S[Ce])*oe,Le[G]=(ce-E[Ce])*ee,ke[L]=0,ke[U]=T[Ce]*Math.sign(Le[U]),ke[G]=w[Ce]*Math.sign(Le[G]);for(let le=0;le<Se;le++){let ye=le*ve-pe;Le[L]=ye*Y;let Te=(b+Pe)*3,Ne=(b+Pe)*2;g[Te]=Le.x,g[Te+1]=Le.y,g[Te+2]=Le.z,m[Te]=ke.x,m[Te+1]=ke.y,m[Te+2]=ke.z,y[Ne]=le/me,y[Ne+1]=0,Pe+=1}}for(let Ce=0;Ce<l;Ce++)for(let le=0;le<me;le++){let ye=b+le+Se*Ce,Te=b+le+Se*(Ce+1),Ne=b+(le+1)+Se*(Ce+1),He=b+(le+1)+Se*Ce;v[x++]=ye,v[x++]=Te,v[x++]=He,v[x++]=Te,v[x++]=Ne,v[x++]=He}b+=Pe}function O(L,U,G){let oe=L*U*G>0?(J,Q,re)=>{v[x++]=J,v[x++]=Q,v[x++]=re}:(J,Q,re)=>{v[x++]=J,v[x++]=re,v[x++]=Q},ee=b;for(let J=0;J<_;J++){let Q=J*3,re=b*3,me=b*2;g[re]=L*C[Q],g[re+1]=U*C[Q+1],g[re+2]=G*C[Q+2],m[re]=L*A[Q],m[re+1]=U*A[Q+1],m[re+2]=G*A[Q+2],y[me]=0,y[me+1]=0,b++}for(let J=0;J<l;J++){let Q=ee+J*(J+1)/2,re=ee+(J+1)*(J+2)/2;oe(Q,re+1,re);for(let me=1;me<=J;me++)oe(Q+me-1,Q+me,re+me),oe(Q+me,re+me+1,re+me)}}}}});var xu,QP=F(()=>{"use strict";X();xu=class extends De{constructor(t=[],e=[],n="",r=1,s=.2,o=4){super(),this.type="PolyhedronGeometryRound";let a,l,c,u=0;d(),h(),this.setAttribute("position",new je(new Float32Array(a.subarray(0,u)),3)),this.setAttribute("normal",new je(new Float32Array(l.subarray(0,u)),3)),this.setAttribute("uv",new je(new Float32Array(c.subarray(0,u/3*2)),2));return;function d(){s=Math.min(1-1e-5,s),s==0&&(o=0);let f={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[n],g=new M,m=g.clone(),y=new Rn,v=s*r,b=r-v,x=o+1,S=new M,E=(le,ye)=>S.subVectors(le,ye).normalize(),T=(le,ye)=>Array(le).fill(void 0).map(ye),w=T(t.length/3,(le,ye)=>new M().fromArray(t,ye*3).setLength(r)),_=[],A=1e6;for(let le=0;le<w.length;le++){let ye=w[le],Te=[],Ne,He,Me,Oe=1e10,B=-1;for(;(B=e.indexOf(le,B+1))!=-1;){let Ge=B-B%3;Ne=e[Ge+(B+1)%3],He=e[Ge+(B+2)%3],Me=ye.distanceToSquared(w[Ne]),Oe=Math.min(Oe,Me),Te.push([Ne,He,Me])}Oe+=1e-6;let fe=[],W=0,et=Te.length;for(let Ge=0;Ge<et;Ge++){[Ne,He,Me]=Te[W];let z=_[Ne]?.includes(le)==!0;Me<=Oe&&fe.push(Ne+ +z*A),W=Te.findIndex(I=>I[0]==He)}_.push(fe)}let C=[];{let le=0,ye=0,Te,Ne,He=f==3;for(let Me=0;Me<=o;Me++){Te=Me*(Me+1)/2,Ne=(Me+1)*(Me+2)/2;for(let Oe=0;Oe<o-Me;Oe++)[le,ye]=[Te+Oe+Me+2,Ne+Oe+Me+3],C.push(Te,Ne,...He?[ye,Te]:[le,Ne],ye,le),[Te,Ne]=[le,ye];C.push(Te,Ne,Te+o+2)}}let P=0;for(let le=0;le<_.length;le++)for(let ye=0;ye<f;ye++)_[le][ye]<A&&P++;let D=w.length*f*C.length*3,O=P*x*6*3,L=P*2*3*3,U=D+O+L;a=new Float64Array(U),l=new Float64Array(U),c=new Float64Array(U/3*2);let G=(le,ye,Te)=>{let Ne=u/3*2;c[Ne]=Math.atan2(Te,-le)/2/Math.PI+.5,c[Ne+1]=1-(Math.atan2(-ye,Math.sqrt(le*le+Te*Te))/Math.PI+.5)},Y=le=>{a[u]=le.x,a[u+1]=le.y,a[u+2]=le.z,l[u]=S.x,l[u+1]=S.y,l[u+2]=S.z,G(le.x,le.y,le.z),u+=3},oe=le=>{a[u]=le[0].x,a[u+1]=le[0].y,a[u+2]=le[0].z,l[u]=le[1].x,l[u+1]=le[1].y,l[u+2]=le[1].z,G(le[0].x,le[0].y,le[0].z),u+=3},ee=(o+2)*(o+3)/2,J=new Float64Array(ee*3),Q=new Float64Array(ee*3),re=new Float64Array(ee*2),me=T(f*2*x,()=>new M),ve=T(o*Math.max(0,o-1)/2,()=>new M),pe=g.clone(),Ee=g.clone(),ce=g.clone(),Se=g.clone(),Pe=g.clone(),Le=[],ke=T(w.length,()=>T(f,()=>g.clone()));for(let le=0;le<w.length;le++){g.copy(w[le]).normalize(),pe.copy(g).multiplyScalar(b);let ye=_[le];for(let fe=0;fe<ye.length;fe++){let W=ye[fe],et=ye[(fe+1)%f];y.setFromPointsAndIndices(w,le,W%A,et%A),y.b.sub(y.a).setLength(1e10).add(y.a),y.c.sub(y.a).setLength(1e10).add(y.a),y.closestPointToPoint(pe,ke[le][fe])}let Te=0,Ne=[],He=[],Me=new M;o==0&&[...ke[le]].reduce((fe,W)=>fe.add(W),Me).multiplyScalar(1/f);for(let fe=0;fe<f;fe++){let W=[],et=(fe-1+f)%f,Ge=ke[le][et],z=ke[le][fe];g.copy(Ge).sub(pe),m.copy(z).sub(pe);let I=pe.angleTo(g),q=g.angleTo(m),Z=Math.cos(I)*v;o==0?Ee.copy(Me):Ee.copy(pe).setLength(b+Z),Ne.push(Z);let ae=[Ee,Ge,z];for(let be=0;be<2;be++){let Fe=ae[be],ue=ae[be+1];Se.subVectors(Fe,pe),Pe.subVectors(ue,pe),ce.crossVectors(Se,Pe).normalize();for(let _e=0;_e<x;_e++){let Ke=[I,q][be]*_e/x;g.copy(Se).applyAxisAngle(ce,Ke).add(pe),me[Te++].copy(g),be&&(E(g,pe),W.push([_e==0?Fe:g.clone(),S.clone()]))}be&&(E(ue,pe),W.push([ue,S.clone()]))}He.push(W)}Le.push(He);let Oe=2*x,B=2;for(let fe=0;fe<f;fe++){let W=Oe*fe,et=Oe*((fe+1)%f),Ge=0,z=[me[W]];for(let I=1;I<x;I++){let q=me[W+I],Z=me[et+I];z.push(q);for(let ae=1,be=I-B+1;ae<=be;ae++)g.lerpVectors(q,Z,ae/(be+1)),g.sub(pe).setLength(Ne[fe]).add(pe),z.push(ve[Ge++].copy(g));z.push(Z)}for(let I=0;I<x;I++)z.push(me[I+x+W]);z.push(me[et+x]);for(let I=0,q=z.length;I<q;I++){let Z=z[I],ae=I*3,be=I*2;J[ae]=Z.x,J[ae+1]=Z.y,J[ae+2]=Z.z,E(Z,pe),Q[ae]=S.x,Q[ae+1]=S.y,Q[ae+2]=S.z,re[be]=Math.atan2(Z.z,-Z.x)/2/Math.PI+.5,re[be+1]=1-(Math.atan2(-Z.y,Math.sqrt(Z.x*Z.x+Z.z*Z.z))/Math.PI+.5)}for(let I=0,q=C.length;I<q;I++){let Z=C[I]*3,ae=C[I]*2,be=u/3*2;a[u]=J[Z],a[u+1]=J[Z+1],a[u+2]=J[Z+2],l[u]=Q[Z],l[u+1]=Q[Z+1],l[u+2]=Q[Z+2],c[be]=re[ae],c[be+1]=re[ae+1],u+=3}}}let Ce=[];for(let le=0;le<_.length;le++)for(let ye=0;ye<f;ye++){let Te=_[le][ye];if(Te<A){let Ne=_[Te].findIndex(Oe=>Oe%A==le),He=Le[le][ye],Me=Le[Te][Ne];for(let Oe=0;Oe<x;Oe++){let B=He[Oe],fe=Me[x-Oe],W=He[Oe+1],et=Me[x-(Oe+1)];oe(B),oe(fe),oe(W),oe(W),oe(fe),oe(et)}Ce.push(He[0][0],Me[x][0],He[x][0],Me[0][0])}}for(;Ce.length;){let le,ye,Te,[Ne,He]=Ce.splice(0,2);le=He;let Me=[Ne];for(;Ne!=le;)Me.push(le),ye=Ce.indexOf(le),Te=ye%2,le=Ce.splice(ye-Te,2)[1-Te];S.subVectors(Me[0],Me[1]).cross(g.subVectors(Me[0],Me[2])).normalize();let Oe=S.dot(Me[0])<0;Oe&&S.negate();for(let B=1;B<=Me.length-2;B++)Y(Me[B+ +Oe]),Y(Me[B+1-+Oe]),Y(Me[0])}}function h(){let p=new M,f=new M,g=new M,m=new M,y=new j,v=new j,b=new j,x=(T,w,_,A)=>{A<0&&T.x===1&&(c[w]=T.x-1),_.x===0&&_.z===0&&(c[w]=A/2/Math.PI+.5)};for(let T=0,w=0;T<u;T+=9,w+=6){p.set(a[T+0],a[T+1],a[T+2]),f.set(a[T+3],a[T+4],a[T+5]),g.set(a[T+6],a[T+7],a[T+8]),y.set(c[w+0],c[w+1]),v.set(c[w+2],c[w+3]),b.set(c[w+4],c[w+5]),m.copy(p).add(f).add(g).divideScalar(3);let _=E(m);x(y,w+0,p,_),x(v,w+2,f,_),x(b,w+4,g,_)}let S=u/3*2;for(let T=0;T<S;T+=6){let w=c[T+0],_=c[T+2],A=c[T+4],C=Math.max(w,_,A),P=Math.min(w,_,A);C>.9&&P<.1&&(w<.2&&(c[T+0]+=1),_<.2&&(c[T+2]+=1),A<.2&&(c[T+4]+=1))}function E(T){return Math.atan2(T.z,-T.x)}}}static fromJSON(t){return new xu(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}});var Ek,gv,JP=F(()=>{"use strict";QP();X();Ek=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,detail:r,corner:s,cornerSides:o}=i.parameters,a=r===0&&s!==0?new gv(t*.5,s,o):new hd(t*.5,r),l=e/t,c=n/t;return(l!==1||c!==1)&&a.scale(1,l,c),Object.assign(a,{userData:{...i,type:"DodecahedronGeometry"}})}},gv=class extends xu{constructor(t=1,e=.2,n=4){let r=(1+Math.sqrt(5))/2,s=1/r,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-r,0,-s,r,0,s,-r,0,s,r,-s,-r,0,-s,r,0,s,-r,0,s,r,0,-r,0,-s,r,0,-s,-r,0,s,r,0,s],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],l="DodecahedronGeometry";super(o,a,l,t,e,n),this.type=l}static fromJSON(t){return new gv(t.radius,t.corner,t.cornerSides)}}});function Tk(i,t=new j){let e=i.length();return t.set(-i.y/e,i.x/e)}function Ck(i){let t=new j;t.addVectors(i.v0,Rf.subVectors(i.v1,i.v0).multiplyScalar(2/3));let e=new j;return e.addVectors(i.v2,lw.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new Ni(i.v0,t,e,i.v2)}function vv(i,t,e=Number.EPSILON){return Math.abs(i-t)<e}function IJ(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function RJ(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function n2(i,t,e){let n=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2));return Math.acos((r*r+n*n-s*s)/(2*r*n))}function Pk(i,t,e){return Mk(i,t)&&Mk(t,e)&&e2(i.position,t.position,e.position)}function e2(i,t,e){return Rf.copy(t).sub(i).cross(lw.copy(e).sub(i))===0}function Ik(i,t,e,n,r){let s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),o=(i.y+t.y)/2,a=(i.x+t.x)/2,l=Math.sqrt(Math.pow(e,2)-Math.pow(s/2,2))*(i.y-t.y)/s,c=Math.sqrt(Math.pow(e,2)-Math.pow(s/2,2))*(t.x-i.x)/s;return n.set(a+l,o+c),r.set(a-l,o-c),[n,r]}function Rk(i,t,e){let n=i.distanceTo(e),r=t.distanceTo(e);return n<r?t:i}function Ok(i,t,e,n,r,s){let o=t.x-i.x,a=t.y-i.y,l=e.x-i.x,c=e.y-i.y,u=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),d;return n2(t,i,e)>Math.PI&&(u*=-1),vv(c,a)?d=(a+c)*(n/u-.5)*8/3/(o-l):d=(o+l)*(n/u-.5)*8/3/(c-a),r.set(t.x-d*a,t.y+d*o),s.set(e.x+d*c,e.y-d*l),[r,s]}function r2(i,t){return i.position.equals(i.controls[1].position)&&t.position.equals(t.controls[0].position)}function Mk(i,t){return e2(i.position,i.controls[1].position,t.position)&&e2(i.position,t.controls[0].position,t.position)}function Dk(i,t,e,n,r=.5){let s=Rf.subVectors(t,i).multiplyScalar(r).add(i),o=lw.subVectors(e,t).multiplyScalar(r).add(t),a=_J.subVectors(n,e).multiplyScalar(r).add(e),l=s,c=AJ.subVectors(o,s).multiplyScalar(r).add(s),u=CJ.subVectors(a,o).multiplyScalar(r).add(o),d=a,h=PJ.subVectors(u,c).multiplyScalar(r).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,h.x,h.y,u.x,u.y,d.x,d.y,n.x,n.y]}function Lk(i,t,e=12,n=!0){let r=Ak.set(0,0,0),s,o=0,a=[];for(let l=0;l<t.length;l++){let c=t2(t[l]),u=Rf,d=Su(c,e);a.push(d);for(let h=0;h<=d;h++)if(c instanceof Ni||c instanceof vs||c instanceof _i){if(c.getPoint(h/d,u),r.set(u.x,u.y,0),s!==void 0&&RJ(s,r))continue;s===void 0&&(s=_k),s.copy(r),i.setXYZ(o,r.x,r.y,r.z),o++}}return n&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),i}function Nk(i,t,e,n=12,r=!0){let s=Ak.set(0,0,0),o=0,a=[];for(let l=0;l<t.length;l++){if(e[l]===!1)continue;let c,u=t2(t[l]),d=Rf,h=Su(u,n);a.push(h);for(let p=0;p<=h;p++)if(u instanceof Ni||u instanceof vs||u instanceof _i){if(u.getPoint(p/h,d),s.set(d.x,d.y,0),c?.equals(s))continue;c===void 0?c=_k:(i.setXYZ(o,c.x,c.y,c.z),o++,i.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return r&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),a}function i2(i,t=12,e=!1){let n=[];for(let r=0,s=i.length;r<s;r++){let o=i[r],a=0;if(e&&o.roundedCurveCorner!==void 0){let l=Su(o.roundedCurveCorner,t)*.5;r>0&&(n[r-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=Su(o.curveAfter,t)),n.push(a)}return i.length>0&&e&&i[0].roundedCurveCorner!==void 0&&(n[i.length-1]+=Su(i[0].roundedCurveCorner,t)*.5),n}function Su(i,t=12){return i&&i instanceof Yc?t*2:i&&(i instanceof _i||i instanceof cp)?1:i&&i instanceof pd?t*i.points.length:t}function Bk(i,t,e=12,n=!0){let r,s=0;for(let o=0;o<t.length;o++){let a=t2(t[o]),l=Su(a,e),c=Rf;for(let u=0;u<=l;u++)if(a instanceof Ni||a instanceof vs||a instanceof _i){if(a.getPoint(u/l,c),r!==void 0&&IJ(r,c,yv))continue;r===void 0&&(r=lw),r.copy(c),i.push(c.x,c.y),s++}}return vv(i[0],i[i.length-2],yv)&&vv(i[1],i[i.length-1],yv)&&(i.pop(),i.pop()),n&&s>1&&!(vv(i[s-1],i[1],yv)&&vv(i[s-2],i[0],yv))&&(i.push(i[0],i[1]),s++),i}var yv,Pf,If,aa,t2,Rf,lw,_J,AJ,CJ,PJ,_k,Ak,s2=F(()=>{"use strict";X();yv=1e-12,Pf=class{constructor(t){this.position=new j;this.startPosition=new j;this.uuid=xe.generateUUID();this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new Pf(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},If=class extends Pf{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new If(this.parent).copy(this)}},aa=class extends Pf{constructor(e,n){super(n);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new If(this),new If(this))}static create(e,n){let r=new aa(e,new j(...n.position));return r.controls[0].position.set(...n.controlPrevious.position),r.controls[1].position.set(...n.controlNext.position),r.roundness=n.roundness,r.areControlsDirectionsMirrored=n.areControlsDirectionsMirrored,r}getOppositeControl(e){let n=this.controls.indexOf(e);return n===0?this.controls[1]:n===1?this.controls[0]:null}applyOffsetToControls(e,n=1){for(let r=0,s=this.controls.length;r<s;r++){let o=this.controls[r];this.position.distanceTo(o.position)<=n?o.position.copy(this.position):o.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new aa(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let e=this.curveBefore?.getTangentAt(1),n=this.curveAfter?.getTangentAt(0);return[e,n]}computeNormals(e=new j,n=new j){let[r,s]=this.computeTangents();return r&&s&&(Tk(r,e),Tk(s,n)),[e,n]}computeTangent(e=new j){let[n,r]=this.computeTangents();return n&&r&&e.copy(n).add(r).normalize(),e}computeNormal(e=new j){let[n,r]=this.computeNormals();return e.copy(n).add(r).normalize(),e}};t2=i=>i,Rf=new j,lw=new j,_J=new j,AJ=new j,CJ=new j,PJ=new j,_k=new M,Ak=new M});var o2,OJ,DJ,LJ,NJ,BJ,vn,lc=F(()=>{"use strict";X();s2();o2=new j,OJ=new j,DJ=new j,LJ=new j,NJ=new j,BJ=new j,vn=class extends Ca{constructor(e=100,n=100){super();this.points=[];this.shapeHoles=[];this.plane=new br(new M(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this.isText=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=xe.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=n}static createFromState(e,n,r){let s=new vn;return s.isClosed=e.isClosed,s.points=e.points.map(o=>aa.create(o.id,o.data)),typeof e.roundness=="number"&&(s.roundness=e.roundness),s.shapeHoles=e.shapeHoles.map(o=>vn.createFromState(o)),n!==void 0&&r!==void 0&&s.applySize(n,r),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let n=0,r=this.points.length;n<r;n++)this.points[n].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(n=>this.getPointIndexById(n)).filter(n=>n>=0)}getPointIndexById(e){let n=this.points.length,r=this.points.findIndex(s=>s.uuid===e);if(r<0){let s=n;for(let o=0,a=this.shapeHoles.length;o<a;o++){let l=this.shapeHoles[o],c=l.points.length,u=l.getPointIndexById(e);if(u<0)s+=c;else return u+s}}return r}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let n=this.points.length;for(let r=0,s=this.shapeHoles.length;r<s;r++){let o=this.shapeHoles[r],a=e-n;if(a<=o.points.length-1)return o.points[a];n+=o.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let n=this.points.indexOf(e);if(n>=0)return n;if(n=this.points.length,this.shapeHoles.length>0)for(let r=0,s=this.shapeHoles.length;r<s;r++){let o=this.shapeHoles[r],a=o.points.indexOf(e);if(a>=0)return n+a;n+=o.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(n=>n.points));return[...this.points,...e]}applySize(e,n){e===0&&(e=.001),n===0&&(n=.001),this._width=e,this._height=n}applyScale(e,n){let r=o2.set(e,n);for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];a.position.multiply(r),a.controls[0].position.multiply(r),a.controls[1].position.multiply(r)}for(let s=0,o=this.shapeHoles.length;s<o;s++)this.shapeHoles[s].applyScale(e,n);this._update()}createPoint(e,n=0,r=xe.generateUUID()){let s;e instanceof j?s=e:s=new j(e,n);let o=new aa(r,s);return o.roundness=this.roundness,o}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,n){this.points.splice(n,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];if(s.uuid===e)return s}for(let n=0,r=this.shapeHoles.length;n<r;n++){let o=this.shapeHoles[n].getPointByUuid(e);if(o)return o}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let n=this.points.indexOf(e);n>=0&&this.points.splice(n,1),this.needsUpdate=!0}removePointById(e){let n=this.points.find(r=>r.uuid===e);n&&this.removePoint(n)}update(){for(let e=0,n=this.shapeHoles.length;e<n;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,n=12,r=!1){this.subdivision=n,this.curveDivisions===void 0&&this.computeCurveDivisions(n);let s=r?this.roundedCurveDivisions:this.curveDivisions;return Lk(e,r?this.roundedCurves:this.curves,n,this.autoClose),s.reduce((o,a)=>o+a,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=i2(this.points,e,!1),this.roundedCurveDivisions=i2(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,n,r=12){return Nk(e,this.curves,n,r,this.autoClose).reduce((o,a)=>o+a,0)*2}extractShapePointsToFlatArray(e,n=12){return this.subdivision=n,this.curveDivisions===void 0&&this.computeCurveDivisions(n),Bk(e,this.roundedCurves,n,this.autoClose)}getCurveIndexFromVertexId(e,n=!1){let r=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=n?this.roundedCurveDivisions:this.curveDivisions,o=0;n&&this.points[0].roundedCurveCorner!==void 0&&(o=Su(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=e-o;a<0&&(a+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let u=s[l];if(a<r+u)return[l,(a-r+1)/u];r+=u}return[0,1]}getCurveT(e,n,r){let s=this.points[e],o=this.points[e>=this.points.length-1?0:e+1],a=this.curveDivisions,l=a[e];if(r2(s,o)){let d=s.position.distanceTo(o.position);return s.position.distanceTo(o2.set(r.x,r.y))/d}let c=0;for(let d=0;d<e;d++)c+=a[d];return(n-c)/l}dispose(){}_applyCurveForPoint(e,n){r2(n,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(n.controls[1].position.x,n.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let r=this.curves[this.curves.length-1];e.curveBefore=r,n.curveAfter=r;let s=r.clone();e.roundedCurveBefore=s,n.roundedCurveAfter=s,e.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];if(n===0)this.moveTo(s.position.x,s.position.y);else{let o=this.points[n-1];this._applyCurveForPoint(s,o)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let n=this.points[0],r=this.points[this.points.length-1];this._applyCurveForPoint(n,r)}if(this.points.length>2){let n=0;for(let r=0,s=this.points.length;r<s;r++){let o=this.points[r],a=this.points[r-1]??this.points[this.points.length-1],l=this.points[r+1]??this.points[0],c=o.roundness,u=a&&l&&Pk(a,o,l);if(!o.controlsMoved()&&c>0&&!u){let d=o.curveBefore,h=o.curveAfter;if(d===void 0||h===void 0)continue;let p=o.roundedCurveBefore,f=o.roundedCurveAfter,g=d instanceof _i?d.v1.distanceTo(d.v2):d.getLength(),m=h instanceof _i?h.v1.distanceTo(h.v2):h.getLength(),y=Math.min(c,g*.499),v=Math.min(c,m*.499),b=Math.min(y,v),x=1-b/g,S=b/m,E=d.getPointAt(x,o2),T=h.getPointAt(S,OJ);this._subSplitCurve(d,p,x,E,void 0),this._subSplitCurve(h,f,S,void 0,T);let w;if(this.useCubicForRoundedCorners){let _=n2(E,o.position,T)/2,A=Math.tan(_)*E.distanceTo(o.position),[C,P]=Ik(E,T,A,DJ,LJ),D=Rk(C,P,o.position),[O,L]=Ok(D,E,T,A,NJ,BJ);w=new Ni(E.clone(),O.clone(),L.clone(),T.clone())}else w=new vs(E.clone(),o.position.clone(),T.clone());o.roundedCurveCorner=w,this.roundedCurves.splice(r+n,0,w),n++}}}}_subSplitCurve(e,n,r,s,o){if(e instanceof _i)s!==void 0&&n.v2.copy(s),o!==void 0&&n.v1.copy(o);else{let a=e,l=n,c=a.getUtoTmapping(r,0),u=Dk(a.v0,a.v1,a.v2,a.v3,c);return s!==void 0&&(l.v0.set(u[0],u[1]),l.v1.set(u[2],u[3]),l.v2.set(u[4],u[5]),l.v3.set(u[6],u[7])),o!==void 0&&(l.v0.set(u[6],u[7]),l.v1.set(u[8],u[9]),l.v2.set(u[10],u[11]),l.v3.set(u[12],u[13])),l}return n}clone(){let e=new vn(this._width,this._height);return e.points=this.points.map(n=>n.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(n=>n.clone()),e}toJSON(){return{points:this.points.reduce((e,n)=>e.concat(n.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let n=e.points.length/7;for(let r=0;r<n;r++){let s=r*7,o=e.points[s+0],a=e.points[s+1],l=e.points[s+2],c=e.points[s+3],u=e.points[s+4],d=e.points[s+5],h=e.points[s+6],p=new aa(xe.generateUUID(),new j(o,a));p.controls[0].position.set(l,c),p.controls[1].position.set(u,d),p.roundness=h,this.points.push(p)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(r=>{let s=new vn;return s.fromJSON(r),s}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,n=!1){this.isText=n;let r=(o,a)=>{a instanceof Ni&&a.v3.equals(o.position)&&o.controls[0].position.copy(a.v2)},s=o=>{let a=[],l,c;for(l=0,c=o.length;l<c;l++)o[l]instanceof vs&&(o[l]=Ck(o[l]));for(l=0,c=o.length;l<c;l++){let h=o[l],p=l>0?o[l-1]:null,f;h instanceof Ni?(f=this.createPoint(h.v0),f.controls[1].position.copy(h.v1)):h instanceof _i&&(f=this.createPoint(h.v1)),f!==void 0&&(p!==null&&r(f,p),a.push(f))}let u=o[o.length-1],d=!1;return u instanceof Ni?u.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(u.v2),d=!0):u instanceof _i&&u.v2.equals(a[0].position)&&(d=!0),this.isClosed=d,a};return this.points=s(e.curves),e instanceof Ca&&(this.shapeHoles=e.holes.map(o=>{let a=new vn;return a.fromShape(o),a})),this.update(),this}updatePoint(e,n){let r=this.getPointByUuid(e);r&&(n.position!==void 0&&r.position.fromArray(n.position),n.roundness!==void 0&&(r.roundness=n.roundness),n.areControlsDirectionsMirrored!==void 0&&(r.areControlsDirectionsMirrored=n.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,n){let s=this.getPointByUuid(e)?.controls[0];s&&(n.position&&s.position.fromArray(n.position),this.needsUpdate=!0)}updateNextControl(e,n){let s=this.getPointByUuid(e)?.controls[1];s&&(n.position&&s.position.fromArray(n.position),this.needsUpdate=!0)}}});function a2({x:i,y:t},e,n,r,s){return{x:i*e+r,y:t*n+s}}function FJ(i,t){let e=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),n=Math.cos(i),r=Math.sin(i),s=Math.cos(i+t),o=Math.sin(i+t);return[{x:n-r*e,y:r+n*e},{x:s+o*e,y:o-s*e},{x:s,y:o}]}function Fk(i,t,e,n){let r=i*n-t*e<0?-1:1,s=Math.min(1,Math.max(-1,i*e+t*n));return r*Math.acos(s)}function UJ(i,t,e,n,r,s,o,a,l,c){let u=Math.pow(r,2),d=Math.pow(s,2),h=Math.pow(o,2),p=Math.pow(a,2),f=u*d-u*p-d*h;f<0&&(f=0),f/=u*p+d*h,f=Math.sqrt(f)*(l===c?-1:1);let g=f*r/s*a,m=f*-s/r*o,y=g+(i+e)/2,v=m+(t+n)/2,b=(o-g)/r,x=(a-m)/s,S=(-o-g)/r,E=(-a-m)/s,T=Fk(1,0,b,x),w=Fk(b,x,S,E);return!c&&w>0&&(w-=l2),c&&w<0&&(w+=l2),{centerx:y,centery:v,ang1:T,ang2:w}}function Uk({px:i,py:t,cx:e,cy:n,rx:r,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(r===0||s===0)return[];let c=(i-e)/2,u=(t-n)/2;if(c===0&&u===0)return[];r=Math.abs(r),s=Math.abs(s);let d=Math.pow(c,2)/Math.pow(r,2)+Math.pow(u,2)/Math.pow(s,2);d>1&&(r*=Math.sqrt(d),s*=Math.sqrt(d));let h=UJ(i,t,e,n,r,s,c,u,o,a),{ang1:p,ang2:f}=h,{centerx:g,centery:m}=h,y=Math.abs(f)/(l2/4);Math.abs(1-y)<1e-7&&(y=1);let v=Math.max(Math.ceil(y),1);f/=v;for(let b=0;b<v;b++)l.push(FJ(p,f)),p+=f;return l.map(b=>{let{x,y:S}=a2(b[0],r,s,g,m),{x:E,y:T}=a2(b[1],r,s,g,m),{x:w,y:_}=a2(b[2],r,s,g,m);return{x1:x,y1:S,x2:E,y2:T,x:w,y:_}})}var l2,kk=F(()=>{"use strict";l2=Math.PI*2});function It(i,t){if(!i)throw t||"Assertion Failed!"}function la(i){var t=i.windingRule,e=t===void 0?an.ODD:t,n=i.elementType,r=n===void 0?Ir.POLYGONS:n,s=i.polySize,o=s===void 0?3:s,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,u=c===void 0?[0,0,1]:c,d=i.contours,h=d===void 0?[]:d,p=i.strict,f=p===void 0?!0:p,g=i.debug,m=g===void 0?!1:g;if(!h&&f)throw new Error("Contours can't be empty");if(!!h){var y=new GJ;i.edgeCreateCallback&&(y.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(y.vertexIdCallback=i.vertexIdCallback);for(var v=0;v<h.length;v++)y.addContour(l||2,h[v]);return y.tesselate(e,r,o,l,u,f),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:m?y.mesh:void 0}}}var an,Ir,_t,bv,cw,Of,Vk,zk,Gk,kJ,c2,jk,VJ,zJ,GJ,h1e,p1e,f1e,m1e,g1e,y1e,v1e,b1e,$d=F(()=>{(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(an||(an={}));(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Ir||(Ir={}));_t=function(){function i(){}return i.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},i.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},i.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},i.edgeGoesLeft=function(t){return i.vertLeq(t.Dst,t.Org)},i.edgeGoesRight=function(t){return i.vertLeq(t.Org,t.Dst)},i.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},i.edgeEval=function(t,e,n){It(i.vertLeq(t,e)&&i.vertLeq(e,n));var r=e.s-t.s,s=n.s-e.s;return r+s>0?r<s?e.t-t.t+(t.t-n.t)*(r/(r+s)):e.t-n.t+(n.t-t.t)*(s/(r+s)):0},i.edgeSign=function(t,e,n){It(i.vertLeq(t,e)&&i.vertLeq(e,n));var r=e.s-t.s,s=n.s-e.s;return r+s>0?(e.t-n.t)*r+(e.t-t.t)*s:0},i.transEval=function(t,e,n){It(i.transLeq(t,e)&&i.transLeq(e,n));var r=e.t-t.t,s=n.t-e.t;return r+s>0?r<s?e.s-t.s+(t.s-n.s)*(r/(r+s)):e.s-n.s+(n.s-t.s)*(s/(r+s)):0},i.transSign=function(t,e,n){It(i.transLeq(t,e)&&i.transLeq(e,n));var r=e.t-t.t,s=n.t-e.t;return r+s>0?(e.s-n.s)*r+(e.s-t.s)*s:0},i.vertCCW=function(t,e,n){return t.s*(e.t-n.t)+e.s*(n.t-t.t)+n.s*(t.t-e.t)>=0},i.interpolate=function(t,e,n,r){return t=t<0?0:t,n=n<0?0:n,t<=n?n===0?(e+r)/2:e+(r-e)*(t/(t+n)):r+(e-r)*(n/(t+n))},i.intersect=function(t,e,n,r,s){var o,a,l;i.vertLeq(t,e)||(l=t,t=e,e=l),i.vertLeq(n,r)||(l=n,n=r,r=l),i.vertLeq(t,n)||(l=t,t=n,n=l,l=e,e=r,r=l),i.vertLeq(n,e)?i.vertLeq(e,r)?(o=i.edgeEval(t,n,e),a=i.edgeEval(n,e,r),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,n.s,a,e.s)):(o=i.edgeSign(t,n,e),a=-i.edgeSign(t,r,e),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,n.s,a,r.s)):s.s=(n.s+e.s)/2,i.transLeq(t,e)||(l=t,t=e,e=l),i.transLeq(n,r)||(l=n,n=r,r=l),i.transLeq(t,n)||(l=t,t=n,n=l,l=e,e=r,r=l),i.transLeq(n,e)?i.transLeq(e,r)?(o=i.transEval(t,n,e),a=i.transEval(n,e,r),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,n.t,a,e.t)):(o=i.transSign(t,n,e),a=-i.transSign(t,r,e),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,n.t,a,r.t)):s.t=(n.t+e.t)/2},i}(),bv=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),cw=function(){function i(t){this.side=t,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(t){this.Sym.Lface=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(t){this.Sym.Org=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(t){this.Sym.Lnext=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(t){this.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(t){this.Lnext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(t){this.Sym.Onext=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(t){this.Sym.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(t){this.Sym.Lnext.Sym=t},enumerable:!0,configurable:!0}),i}(),Of=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return i}(),Vk=function(){function i(){var t=new Of,e=new bv,n=new cw(0),r=new cw(1);t.next=t.prev=t,t.anEdge=null,e.next=e.prev=e,n.next=n,n.Sym=r,r.next=r,r.Sym=n,this.vHead=t,this.fHead=e,this.eHead=n,this.eHeadSym=r}return i.prototype.makeEdge_=function(t){var e=new cw(0),n=new cw(1);t.Sym.side<t.side&&(t=t.Sym);var r=t.Sym.next;return n.next=r,r.Sym.next=e,e.next=t,t.Sym.next=n,e.Sym=n,e.Onext=e,e.Lnext=n,e.Org=null,e.Lface=null,e.winding=0,e.activeRegion=null,n.Sym=e,n.Onext=n,n.Lnext=e,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,e},i.prototype.splice_=function(t,e){var n=t.Onext,r=e.Onext;n.Sym.Lnext=e,r.Sym.Lnext=t,t.Onext=r,e.Onext=n},i.prototype.makeVertex_=function(t,e,n){var r=t;It(r,"Vertex can't be null!");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=e;var o=e;do o.Org=r,o=o.Onext;while(o!==e)},i.prototype.makeFace_=function(t,e,n){var r=t;It(r,"Face can't be null");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=e,r.trail=null,r.marked=!1,r.inside=n.inside;var o=e;do o.Lface=r,o=o.Lnext;while(o!==e)},i.prototype.killEdge_=function(t){t.Sym.side<t.side&&(t=t.Sym);var e=t.next,n=t.Sym.next;e.Sym.next=n,n.Sym.next=e},i.prototype.killVertex_=function(t,e){var n=t.anEdge,r=n;do r.Org=e,r=r.Onext;while(r!==n);var s=t.prev,o=t.next;o.prev=s,s.next=o},i.prototype.killFace_=function(t,e){var n=t.anEdge,r=n;do r.Lface=e,r=r.Lnext;while(r!==n);var s=t.prev,o=t.next;o.prev=s,s.next=o},i.prototype.makeEdge=function(){var t=new Of,e=new Of,n=new bv,r=this.makeEdge_(this.eHead);return this.makeVertex_(t,r,this.vHead),this.makeVertex_(e,r.Sym,this.vHead),this.makeFace_(n,r,this.fHead),r},i.prototype.splice=function(t,e){var n=!1,r=!1;if(t!==e){if(e.Org!==t.Org&&(r=!0,this.killVertex_(e.Org,t.Org)),e.Lface!==t.Lface&&(n=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(e,t),!r){var s=new Of;this.makeVertex_(s,e,t.Org),t.Org.anEdge=t}if(!n){var o=new bv;this.makeFace_(o,e,t.Lface),t.Lface.anEdge=t}}},i.prototype.delete=function(t){var e=t.Sym,n=!1;if(t.Lface!==t.Rface&&(n=!0,this.killFace_(t.Lface,t.Rface)),t.Onext===t)this.killVertex_(t.Org,null);else if(t.Rface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev),!n){var r=new bv;this.makeFace_(r,t,t.Lface)}e.Onext===e?(this.killVertex_(e.Org,null),this.killFace_(e.Lface,null)):(t.Lface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev)),this.killEdge_(t)},i.prototype.addEdgeVertex=function(t){var e=this.makeEdge_(t),n=e.Sym;this.splice_(e,t.Lnext),e.Org=t.Dst;var r=new Of;return this.makeVertex_(r,n,e.Org),e.Lface=n.Lface=t.Lface,e},i.prototype.splitEdge=function(t){var e=this.addEdgeVertex(t),n=e.Sym;return this.splice_(t.Sym,t.Sym.Oprev),this.splice_(t.Sym,n),t.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=t.Rface,n.winding=t.winding,n.Sym.winding=t.Sym.winding,n.idx=t.idx,n.Sym.idx=t.Sym.idx,n},i.prototype.connect=function(t,e){var n=!1,r=this.makeEdge_(t),s=r.Sym;if(e.Lface!==t.Lface&&(n=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(r,t.Lnext),this.splice_(s,e),r.Org=t.Dst,s.Org=e.Org,r.Lface=s.Lface=t.Lface,t.Lface.anEdge=s,!n){var o=new bv;this.makeFace_(o,r,t.Lface)}return r},i.prototype.zapFace=function(t){var e=t.anEdge,n,r,s,o,a;r=e.Lnext;do n=r,r=n.Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),s=n.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=e);o=t.prev,a=t.next,a.prev=o,o.next=a},i.prototype.countFaceVerts_=function(t){var e=t.anEdge,n=0;do n++,e=e.Lnext;while(e!==t.anEdge);return n},i.prototype.mergeConvexFaces=function(t){var e,n,r,s,o,a,l;for(e=this.fHead.next;e!==this.fHead;e=e.next)if(!!e.inside)for(n=e.anEdge,o=n.Org;r=n.Lnext,s=n.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(e),l=this.countFaceVerts_(s.Lface),a+l-2<=t&&_t.vertCCW(n.Lprev.Org,n.Org,s.Lnext.Lnext.Org)&&_t.vertCCW(s.Lprev.Org,s.Org,n.Lnext.Lnext.Org)&&(r=s.Lnext,this.delete(s),n=null,s=null)),!(n&&n.Lnext.Org===o);)n=r;return!0},i.prototype.check=function(){var t=this.fHead,e=this.vHead,n=this.eHead,r,s,o,a,l,c;for(s=t,s=t;(r=s.next)!==t;s=r){It(r.prev===s),l=r.anEdge;do It(l.Sym!==l),It(l.Sym.Sym===l),It(l.Lnext.Onext.Sym===l),It(l.Onext.Sym.Lnext===l),It(l.Lface===r),l=l.Lnext;while(l!==r.anEdge)}for(It(r.prev===s&&r.anEdge===null),a=e,a=e;(o=a.next)!==e;a=o){It(o.prev===a),l=o.anEdge;do It(l.Sym!==l),It(l.Sym.Sym===l),It(l.Lnext.Onext.Sym===l),It(l.Onext.Sym.Lnext===l),It(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(It(o.prev===a&&o.anEdge===null),c=n,c=n;(l=c.next)!==n;c=l)It(l.Sym.next===c.Sym),It(l.Sym!==l),It(l.Sym.Sym===l),It(l.Org!==null),It(l.Dst!==null),It(l.Lnext.Onext.Sym===l),It(l.Onext.Sym.Lnext===l);It(l.Sym.next===c.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},i}(),zk=function(){function i(){this.handle=null}return i}(),Gk=function(){function i(){this.key=null,this.node=0}return i}(),kJ=function(){function i(t,e){this.leq=e,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=t,this.nodes=[],this.handles=[];for(var n=0;n<t+1;n++)this.nodes[n]=new zk,this.handles[n]=new Gk;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(t){var e=this.nodes,n=this.handles,r,s,o;for(r=e[t].handle;;){if(o=t<<1,o<this.size&&this.leq(n[e[o+1].handle].key,n[e[o].handle].key)&&++o,It(o<=this.max),s=e[o].handle,o>this.size||this.leq(n[r].key,n[s].key)){e[t].handle=r,n[r].node=t;break}e[t].handle=s,n[s].node=t,t=o}},i.prototype.floatUp_=function(t){var e=this.nodes,n=this.handles,r,s,o;for(r=e[t].handle;;){if(o=t>>1,s=e[o].handle,o===0||this.leq(n[s].key,n[r].key)){e[t].handle=r,n[r].node=t;break}e[t].handle=s,n[s].node=t,t=o}},i.prototype.init=function(){for(var t=this.size;t>=1;--t)this.floatDown_(t);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(t){var e,n;if(e=++this.size,e*2>this.max){this.max*=2;var r,s;for(s=this.nodes.length,this.nodes.length=this.max+1,r=s;r<this.nodes.length;r++)this.nodes[r]=new zk;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new Gk}return this.freeList===0?n=e:(n=this.freeList,this.freeList=this.handles[n].node),this.nodes[e].handle=n,this.handles[n].node=e,this.handles[n].key=t,this.initialized&&this.floatUp_(e),n},i.prototype.extractMin=function(){var t=this.nodes,e=this.handles,n=t[1].handle,r=e[n].key;return this.size>0&&(t[1].handle=t[this.size].handle,e[t[1].handle].node=1,e[n].key=null,e[n].node=this.freeList,this.freeList=n,--this.size,this.size>0&&this.floatDown_(1)),r},i.prototype.delete=function(t){var e=this.nodes,n=this.handles,r;It(t>=1&&t<=this.max&&n[t].key!==null),r=n[t].node,e[r].handle=e[this.size].handle,n[e[r].handle].node=r,--this.size,r<=this.size&&(r<=1||this.leq(n[e[r>>1].handle].key,n[e[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),n[t].key=null,n[t].node=this.freeList,this.freeList=t},i}(),c2=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),jk=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),VJ=function(){function i(t,e){this.frame=t,this.leq=e,this.head=new jk,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(t){return this.insertBefore(this.head,t)},i.prototype.search=function(t){var e=this.head;do e=e.next;while(e.key!==null&&!this.leq(this.frame,t,e.key));return e},i.prototype.insertBefore=function(t,e){do t=t.prev;while(t.key!==null&&!this.leq(this.frame,t.key,e));var n=new jk;return n.key=e,n.next=t.next,t.next.prev=n,n.prev=t,t.next=n,n},i.prototype.delete=function(t){t.next.prev=t.prev,t.prev.next=t.next},i}(),zJ=function(){function i(){}return i.regionBelow=function(t){return t.nodeUp.prev.key},i.regionAbove=function(t){return t.nodeUp.next.key},i.debugEvent=function(t){},i.addWinding=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.edgeLeq=function(t,e,n){var r=t.event,s=e.eUp,o=n.eUp;if(s.Dst===r)return o.Dst===r?_t.vertLeq(s.Org,o.Org)?_t.edgeSign(o.Dst,s.Org,o.Org)<=0:_t.edgeSign(s.Dst,o.Org,s.Org)>=0:_t.edgeSign(o.Dst,r,o.Org)<=0;if(o.Dst===r)return _t.edgeSign(s.Dst,r,s.Org)>=0;var a=_t.edgeEval(s.Dst,r,s.Org),l=_t.edgeEval(o.Dst,r,o.Org);return a>=l},i.deleteRegion=function(t,e){e.fixUpperEdge&&It(e.eUp.winding===0),e.eUp.activeRegion=null,t.dict.delete(e.nodeUp)},i.fixUpperEdge=function(t,e,n){It(e.fixUpperEdge),t.mesh.delete(e.eUp),e.fixUpperEdge=!1,e.eUp=n,n.activeRegion=e},i.topLeftRegion=function(t,e){var n=e.eUp.Org,r;do e=i.regionAbove(e);while(e.eUp.Org===n);if(e.fixUpperEdge){if(r=t.mesh.connect(i.regionBelow(e).eUp.Sym,e.eUp.Lnext),r===null)return null;i.fixUpperEdge(t,e,r),e=i.regionAbove(e)}return e},i.topRightRegion=function(t){var e=t.eUp.Dst;do t=i.regionAbove(t);while(t.eUp.Dst===e);return t},i.addRegionBelow=function(t,e,n){var r=new c2;return r.eUp=n,r.nodeUp=t.dict.insertBefore(e.nodeUp,r),r.fixUpperEdge=!1,r.sentinel=!1,r.dirty=!1,n.activeRegion=r,r},i.isWindingInside=function(t,e){switch(t.windingRule){case an.ODD:return(e&1)!==0;case an.NONZERO:return e!==0;case an.POSITIVE:return e>0;case an.NEGATIVE:return e<0;case an.ABS_GEQ_TWO:return e>=2||e<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(t,e){e.windingNumber=i.regionAbove(e).windingNumber+e.eUp.winding,e.inside=i.isWindingInside(t,e.windingNumber)},i.finishRegion=function(t,e){var n=e.eUp,r=n.Lface;r.inside=e.inside,r.anEdge=n,i.deleteRegion(t,e)},i.finishLeftRegions=function(t,e,n){for(var r,s=null,o=e,a=e.eUp;o!==n;){if(o.fixUpperEdge=!1,s=i.regionBelow(o),r=s.eUp,r.Org!=a.Org){if(!s.fixUpperEdge){i.finishRegion(t,o);break}r=t.mesh.connect(a.Lprev,r.Sym),i.fixUpperEdge(t,s,r)}a.Onext!==r&&(t.mesh.splice(r.Oprev,r),t.mesh.splice(a,r)),i.finishRegion(t,o),a=s.eUp,o=s}return a},i.addRightEdges=function(t,e,n,r,s,o){var a,l,c,u,d=!0;c=n;do It(_t.vertLeq(c.Org,c.Dst)),i.addRegionBelow(t,e,c.Sym),c=c.Onext;while(c!==r);for(s===null&&(s=i.regionBelow(e).eUp.Rprev),l=e,u=s;a=i.regionBelow(l),c=a.eUp.Sym,c.Org===u.Org;)c.Onext!==u&&(t.mesh.splice(c.Oprev,c),t.mesh.splice(u.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=i.isWindingInside(t,a.windingNumber),l.dirty=!0,!d&&i.checkForRightSplice(t,l)&&(i.addWinding(c,u),i.deleteRegion(t,l),t.mesh.delete(u)),d=!1,l=a,u=c;l.dirty=!0,It(l.windingNumber-c.winding===a.windingNumber),o&&i.walkDirtyRegions(t,l)},i.spliceMergeVertices=function(t,e,n){t.mesh.splice(e,n)},i.vertexWeights=function(t,e,n){var r=_t.vertL1dist(e,t),s=_t.vertL1dist(n,t),o=.5*s/(r+s),a=.5*r/(r+s);t.coords[0]+=o*e.coords[0]+a*n.coords[0],t.coords[1]+=o*e.coords[1]+a*n.coords[1],t.coords[2]+=o*e.coords[2]+a*n.coords[2]},i.getIntersectData=function(t,e,n,r,s,o){e.coords[0]=e.coords[1]=e.coords[2]=0,e.idx=-1,i.vertexWeights(e,n,r),i.vertexWeights(e,s,o)},i.checkForRightSplice=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp;if(_t.vertLeq(r.Org,s.Org)){if(_t.edgeSign(s.Dst,r.Org,s.Org)>0)return!1;_t.vertEq(r.Org,s.Org)?r.Org!==s.Org&&(t.pq.delete(r.Org.pqHandle),i.spliceMergeVertices(t,s.Oprev,r)):(t.mesh.splitEdge(s.Sym),t.mesh.splice(r,s.Oprev),e.dirty=n.dirty=!0)}else{if(_t.edgeSign(r.Dst,s.Org,r.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(r.Sym),t.mesh.splice(s.Oprev,r)}return!0},i.checkForLeftSplice=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp,o;if(It(!_t.vertEq(r.Dst,s.Dst)),_t.vertLeq(r.Dst,s.Dst)){if(_t.edgeSign(r.Dst,s.Dst,r.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,o=t.mesh.splitEdge(r),t.mesh.splice(s.Sym,o),o.Lface.inside=e.inside}else{if(_t.edgeSign(s.Dst,r.Dst,s.Org)>0)return!1;e.dirty=n.dirty=!0,o=t.mesh.splitEdge(s),t.mesh.splice(r.Lnext,s.Sym),o.Rface.inside=e.inside}return!0},i.checkForIntersect=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp,o=r.Org,a=s.Org,l=r.Dst,c=s.Dst,u,d,h=new Of,p,f;if(It(!_t.vertEq(c,l)),It(_t.edgeSign(l,t.event,o)<=0),It(_t.edgeSign(c,t.event,a)>=0),It(o!==t.event&&a!==t.event),It(!e.fixUpperEdge&&!n.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),d=Math.max(a.t,c.t),u>d))return!1;if(_t.vertLeq(o,a)){if(_t.edgeSign(c,o,a)>0)return!1}else if(_t.edgeSign(l,a,o)<0)return!1;return i.debugEvent(t),_t.intersect(l,o,c,a,h),It(Math.min(o.t,l.t)<=h.t),It(h.t<=Math.max(a.t,c.t)),It(Math.min(c.s,l.s)<=h.s),It(h.s<=Math.max(a.s,o.s)),_t.vertLeq(h,t.event)&&(h.s=t.event.s,h.t=t.event.t),p=_t.vertLeq(o,a)?o:a,_t.vertLeq(p,h)&&(h.s=p.s,h.t=p.t),_t.vertEq(h,o)||_t.vertEq(h,a)?(i.checkForRightSplice(t,e),!1):!_t.vertEq(l,t.event)&&_t.edgeSign(l,t.event,h)>=0||!_t.vertEq(c,t.event)&&_t.edgeSign(c,t.event,h)<=0?c===t.event?(t.mesh.splitEdge(r.Sym),t.mesh.splice(s.Sym,r),e=i.topLeftRegion(t,e),r=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),n),i.addRightEdges(t,e,r.Oprev,r,r,!0),!0):l===t.event?(t.mesh.splitEdge(s.Sym),t.mesh.splice(r.Lnext,s.Oprev),n=e,e=i.topRightRegion(e),f=i.regionBelow(e).eUp.Rprev,n.eUp=s.Oprev,s=i.finishLeftRegions(t,n,null),i.addRightEdges(t,e,s.Onext,r.Rprev,f,!0),!0):(_t.edgeSign(l,t.event,h)>=0&&(i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(r.Sym),r.Org.s=t.event.s,r.Org.t=t.event.t),_t.edgeSign(c,t.event,h)<=0&&(e.dirty=n.dirty=!0,t.mesh.splitEdge(s.Sym),s.Org.s=t.event.s,s.Org.t=t.event.t),!1):(t.mesh.splitEdge(r.Sym),t.mesh.splitEdge(s.Sym),t.mesh.splice(s.Oprev,r),r.Org.s=h.s,r.Org.t=h.t,r.Org.pqHandle=t.pq.insert(r.Org),i.getIntersectData(t,r.Org,o,l,a,c),i.regionAbove(e).dirty=e.dirty=n.dirty=!0,!1)},i.walkDirtyRegions=function(t,e){for(var n=i.regionBelow(e),r,s;;){for(;n.dirty;)e=n,n=i.regionBelow(n);if(!e.dirty&&(n=e,e=i.regionAbove(e),e===null||!e.dirty))return;if(e.dirty=!1,r=e.eUp,s=n.eUp,r.Dst!==s.Dst&&i.checkForLeftSplice(t,e)&&(n.fixUpperEdge?(i.deleteRegion(t,n),t.mesh.delete(s),n=i.regionBelow(e),s=n.eUp):e.fixUpperEdge&&(i.deleteRegion(t,e),t.mesh.delete(r),e=i.regionAbove(n),r=e.eUp)),r.Org!==s.Org)if(r.Dst!==s.Dst&&!e.fixUpperEdge&&!n.fixUpperEdge&&(r.Dst===t.event||s.Dst===t.event)){if(i.checkForIntersect(t,e))return}else i.checkForRightSplice(t,e);r.Org===s.Org&&r.Dst===s.Dst&&(i.addWinding(s,r),i.deleteRegion(t,e),t.mesh.delete(r),e=i.regionAbove(n))}},i.connectRightVertex=function(t,e,n){var r,s=n.Onext,o=i.regionBelow(e),a=e.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(t,e),_t.vertEq(a.Org,t.event)&&(t.mesh.splice(s.Oprev,a),e=i.topLeftRegion(t,e),s=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),o),c=!0),_t.vertEq(l.Org,t.event)&&(t.mesh.splice(n,l.Oprev),n=i.finishLeftRegions(t,o,null),c=!0),c){i.addRightEdges(t,e,n.Onext,s,s,!0);return}_t.vertLeq(l.Org,a.Org)?r=l.Oprev:r=a,r=t.mesh.connect(n.Lprev,r),i.addRightEdges(t,e,r,r.Onext,r.Onext,!1),r.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(t,e)},i.connectLeftDegenerate=function(t,e,n){var r,s,o,a,l;if(r=e.eUp,_t.vertEq(r.Org,n)){It(!1),i.spliceMergeVertices(t,r,n.anEdge);return}if(!_t.vertEq(r.Dst,n)){t.mesh.splitEdge(r.Sym),e.fixUpperEdge&&(t.mesh.delete(r.Onext),e.fixUpperEdge=!1),t.mesh.splice(n.anEdge,r),i.sweepEvent(t,n);return}It(!1),e=i.topRightRegion(e),l=i.regionBelow(e),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(It(s!==o),i.deleteRegion(t,l),t.mesh.delete(o),o=s.Oprev),t.mesh.splice(n.anEdge,o),_t.edgeGoesLeft(s)||(s=null),i.addRightEdges(t,e,o.Onext,a,s,!0)},i.connectLeftVertex=function(t,e){var n,r,s,o,a,l,c=new c2;if(c.eUp=e.anEdge.Sym,n=t.dict.search(c).key,r=i.regionBelow(n),!!r){if(o=n.eUp,a=r.eUp,_t.edgeSign(o.Dst,e,o.Org)===0){i.connectLeftDegenerate(t,n,e);return}if(s=_t.vertLeq(a.Dst,o.Dst)?n:r,n.inside||s.fixUpperEdge){if(s===n)l=t.mesh.connect(e.anEdge.Sym,o.Lnext);else{var u=t.mesh.connect(a.Dnext,e.anEdge);l=u.Sym}s.fixUpperEdge?i.fixUpperEdge(t,s,l):i.computeWinding(t,i.addRegionBelow(t,n,l)),i.sweepEvent(t,e)}else i.addRightEdges(t,n,e.anEdge,e.anEdge,null,!0)}},i.sweepEvent=function(t,e){t.event=e,i.debugEvent(t);for(var n=e.anEdge;n.activeRegion===null;)if(n=n.Onext,n===e.anEdge){i.connectLeftVertex(t,e);return}var r=i.topLeftRegion(t,n.activeRegion);It(r!==null);var s=i.regionBelow(r),o=s.eUp,a=i.finishLeftRegions(t,s,null);a.Onext===o?i.connectRightVertex(t,r,a):i.addRightEdges(t,r,a.Onext,o,o,!0)},i.addSentinel=function(t,e,n,r){var s=new c2,o=t.mesh.makeEdge();o.Org.s=n,o.Org.t=r,o.Dst.s=e,o.Dst.t=r,t.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=t.dict.insert(s)},i.initEdgeDict=function(t){t.dict=new VJ(t,i.edgeLeq);var e=t.bmax[0]-t.bmin[0],n=t.bmax[1]-t.bmin[1],r=t.bmin[0]-e,s=t.bmax[0]+e,o=t.bmin[1]-n,a=t.bmax[1]+n;i.addSentinel(t,r,s,o),i.addSentinel(t,r,s,a)},i.doneEdgeDict=function(t){for(var e,n=0;(e=t.dict.min().key)!==null;)e.sentinel||(It(e.fixUpperEdge),It(++n===1)),It(e.windingNumber===0),i.deleteRegion(t,e)},i.removeDegenerateEdges=function(t){var e,n,r,s=t.mesh.eHead;for(e=s.next;e!==s;e=n)n=e.next,r=e.Lnext,_t.vertEq(e.Org,e.Dst)&&e.Lnext.Lnext!==e&&(i.spliceMergeVertices(t,r,e),t.mesh.delete(e),e=r,r=e.Lnext),r.Lnext===e&&(r!==e&&((r===n||r===n.Sym)&&(n=n.next),t.mesh.delete(r)),(e===n||e===n.Sym)&&(n=n.next),t.mesh.delete(e))},i.initPriorityQ=function(t){var e,n,r,s=0;for(r=t.mesh.vHead,n=r.next;n!==r;n=n.next)s++;for(s+=8,e=t.pq=new kJ(s,_t.vertLeq),r=t.mesh.vHead,n=r.next;n!==r;n=n.next)n.pqHandle=e.insert(n);return n!==r?!1:(e.init(),!0)},i.donePriorityQ=function(t){t.pq=null},i.removeDegenerateFaces=function(t,e){var n,r,s;for(n=e.fHead.next;n!==e.fHead;n=r)r=n.next,s=n.anEdge,It(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),t.mesh.delete(s));return!0},i.computeInterior=function(t,e){e===void 0&&(e=!0);var n,r;if(i.removeDegenerateEdges(t),!i.initPriorityQ(t))return!1;for(i.initEdgeDict(t);(n=t.pq.extractMin())!==null;){for(;r=t.pq.min(),!(r===null||!_t.vertEq(r,n));)r=t.pq.extractMin(),i.spliceMergeVertices(t,n.anEdge,r.anEdge);i.sweepEvent(t,n)}return t.event=t.dict.min().key.eUp.Org,i.debugEvent(t),i.doneEdgeDict(t),i.donePriorityQ(t),i.removeDegenerateFaces(t,t.mesh)?(e&&t.mesh.check(),!0):!1},i}(),GJ=function(){function i(){this.mesh=new Vk,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=an.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.prototype.normalize_=function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];if(!e)throw"Zero-size vector!";e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},i.prototype.longAxis_=function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},i.prototype.computeNormal_=function(t){var e,n,r,s,o,a,l=[0,0,0],c=[0,0,0],u=[0,0,0],d=[0,0,0],h=[0,0,0],p=[null,null,null],f=[null,null,null],g=this.mesh.vHead;e=g.next;for(var m=0;m<3;++m)s=e.coords[m],c[m]=s,f[m]=e,l[m]=s,p[m]=e;for(e=g.next;e!==g;e=e.next)for(var y=0;y<3;++y)s=e.coords[y],s<c[y]&&(c[y]=s,f[y]=e),s>l[y]&&(l[y]=s,p[y]=e);var v=0;if(l[1]-c[1]>l[0]-c[0]&&(v=1),l[2]-c[2]>l[v]-c[v]&&(v=2),c[v]>=l[v]){t[0]=0,t[1]=0,t[2]=1;return}for(a=0,n=f[v],r=p[v],u[0]=n.coords[0]-r.coords[0],u[1]=n.coords[1]-r.coords[1],u[2]=n.coords[2]-r.coords[2],e=g.next;e!==g;e=e.next)d[0]=e.coords[0]-r.coords[0],d[1]=e.coords[1]-r.coords[1],d[2]=e.coords[2]-r.coords[2],h[0]=u[1]*d[2]-u[2]*d[1],h[1]=u[2]*d[0]-u[0]*d[2],h[2]=u[0]*d[1]-u[1]*d[0],o=h[0]*h[0]+h[1]*h[1]+h[2]*h[2],o>a&&(a=o,t[0]=h[0],t[1]=h[1],t[2]=h[2]);a<=0&&(t[0]=t[1]=t[2]=0,t[this.longAxis_(u)]=1)},i.prototype.checkOrientation_=function(){for(var t=this.mesh.fHead,e,n=this.mesh.vHead,r,s=0,o=t.next;o!==t;o=o.next)if(r=o.anEdge,!(r.winding<=0))do s+=(r.Org.s-r.Dst.s)*(r.Org.t+r.Dst.t),r=r.Lnext;while(r!==o.anEdge);if(s<0){for(e=n.next;e!==n;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var t=this.mesh.vHead,e=[0,0,0],n,r,s=!1;e[0]=this.normal[0],e[1]=this.normal[1],e[2]=this.normal[2],!e[0]&&!e[1]&&!e[2]&&(this.computeNormal_(e),s=!0),n=this.sUnit,r=this.tUnit;var o=this.longAxis_(e);n[o]=0,n[(o+1)%3]=1,n[(o+2)%3]=0,r[o]=0,r[(o+1)%3]=0,r[(o+2)%3]=e[o]>0?1:-1;for(var a=t.next;a!==t;a=a.next)a.s=this.dot_(a.coords,n),a.t=this.dot_(a.coords,r);s&&this.checkOrientation_();for(var l=!0,c=t.next;c!==t;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.prototype.tessellateMonoRegion_=function(t,e){var n,r;if(n=e.anEdge,!(n.Lnext!==n&&n.Lnext.Lnext!==n))throw"Mono region invalid";for(;_t.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;_t.vertLeq(n.Org,n.Dst);n=n.Lnext);r=n.Lprev;for(var s=void 0;n.Lnext!==r;)if(_t.vertLeq(n.Dst,r.Org)){for(;r.Lnext!==n&&(_t.edgeGoesLeft(r.Lnext)||_t.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)s=t.connect(r.Lnext,r),r=s.Sym;r=r.Lprev}else{for(;r.Lnext!==n&&(_t.edgeGoesRight(n.Lprev)||_t.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)s=t.connect(n,n.Lprev),n=s.Sym;n=n.Lnext}if(r.Lnext===n)throw"Mono region invalid";for(;r.Lnext.Lnext!==n;)s=t.connect(r.Lnext,r),r=s.Sym;return!0},i.prototype.tessellateInterior_=function(t){for(var e,n=t.fHead.next;n!==t.fHead;n=e)if(e=n.next,n.inside&&!this.tessellateMonoRegion_(t,n))return!1;return!0},i.prototype.discardExterior_=function(t){for(var e,n=t.fHead.next;n!==t.fHead;n=e)e=n.next,n.inside||t.zapFace(n)},i.prototype.setWindingNumber_=function(t,e,n){for(var r,s=t.eHead.next;s!==t.eHead;s=r)r=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?e:-e:n?t.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(t){return!t.Rface||!t.Rface.inside?-1:t.Rface.n},i.prototype.outputPolymesh_=function(t,e,n,r){var s,o=0,a=0,l;n>3&&t.mergeConvexFaces(n);for(var c=t.vHead.next;c!==t.vHead;c=c.next)c.n=-1;for(var u=t.fHead.next;u!==t.fHead;u=u.next)if(u.n=-1,!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;c.n===-1&&(c.n=a,a++),l++,s=s.Lnext}while(s!==u.anEdge);if(l>n)throw"Face vertex greater that support polygon";u.n=o,++o}this.elementCount=o,e===Ir.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*n,this.vertexCount=a,this.vertices=[],this.vertices.length=a*r,this.vertexIndices=[],this.vertexIndices.length=a;for(var c=t.vHead.next;c!==t.vHead;c=c.next)if(c.n!==-1){var d=c.n*r;this.vertices[d+0]=c.coords[0],this.vertices[d+1]=c.coords[1],r>2&&(this.vertices[d+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var h=0,u=t.fHead.next;u!==t.fHead;u=u.next)if(!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;this.elements[h++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var p=l;p<n;++p)this.elements[h++]=-1;if(e===Ir.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[h++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var f=l;f<n;++f)this.elements[h++]=-1}}},i.prototype.outputContours_=function(t,e){var n,r,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var a=t.fHead.next;a!==t.fHead;a=a.next)if(!!a.inside){r=n=a.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==r);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*e,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,u=0;s=0;for(var a=t.fHead.next;a!==t.fHead;a=a.next)if(!!a.inside){o=0,r=n=a.anEdge;do this.vertices[l++]=n.Org.coords[0],this.vertices[l++]=n.Org.coords[1],e>2&&(this.vertices[l++]=n.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(n):n.Org.idx,o++,n=n.Lnext;while(n!==r);this.elements[u++]=s,this.elements[u++]=o,s+=o}},i.prototype.addContour=function(t,e){this.mesh===null&&(this.mesh=new Vk),t<2&&(t=2),t>3&&(t=3);for(var n=null,r=0;r<e.length;r+=t)n===null?(n=this.mesh.makeEdge(),this.mesh.splice(n,n.Sym)):(this.mesh.splitEdge(n),n=n.Lnext),n.Org.coords[0]=e[r+0],n.Org.coords[1]=e[r+1],t>2?n.Org.coords[2]=e[r+2]:n.Org.coords[2]=0,n.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(n),n.winding=1,n.Sym.winding=-1},i.prototype.tesselate=function(t,e,n,r,s,o){if(t===void 0&&(t=an.ODD),e===void 0&&(e=Ir.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=t,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),zJ.computeInterior(this,o);var a=this.mesh;return e===Ir.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),e===Ir.BOUNDARY_CONTOURS?this.outputContours_(a,r):this.outputPolymesh_(a,e,n,r),!0},i}();h1e=an.ODD,p1e=an.NONZERO,f1e=an.POSITIVE,m1e=an.NEGATIVE,g1e=an.ABS_GEQ_TWO,y1e=Ir.POLYGONS,v1e=Ir.CONNECTED_POLYGONS,b1e=Ir.BOUNDARY_CONTOURS});var uw,xv,Hk=F(()=>{"use strict";uw=class{constructor(t=256,e=!1){this.capacity=t,this.size=0,this.debug=e,this.debug&&console.log(`allocating with cap ${t}`);let n=t*uw.eSize;this.buffer=new ArrayBuffer(n);let r=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*r,3*t),s+=3*t,this.normals=new Float32Array(this.buffer,s*r,3*t),s+=3*t,this.uvs=new Float32Array(this.buffer,s*r,2*t)}realloc(t,e=!1){if(t<this.size)throw Error("cannot shrink buffer");if(t<=this.capacity&&!e)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${t}`);let n=t*uw.eSize,r=new ArrayBuffer(n),s=Float32Array.BYTES_PER_ELEMENT,o=0,a=new Float32Array(r,o*s,3*t);o+=3*t;let l=new Float32Array(r,o*s,3*t);o+=3*t;let c=new Float32Array(r,o*s,2*t);e?(a.set(this.positions.subarray(0,this.size*3)),l.set(this.normals.subarray(0,this.size*3)),c.set(this.uvs.subarray(0,this.size*2))):(a.set(this.positions),l.set(this.normals),c.set(this.uvs)),this.buffer=r,this.positions=a,this.normals=l,this.uvs=c,this.capacity=t}get(t=1){let e=this.size+t;if(e>this.capacity){let r=this.capacity;for(;e>r;)r*=2;this.realloc(r)}let n=this.size;return this.size=e,n}reserve(t){let e=this.size+t;e>this.capacity&&this.realloc(e)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},xv=uw;xv.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT});var Sv,Wk=F(()=>{Sv=class{constructor(t=[],e=(n,r)=>n<r?-1:n>r?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:n}=this,r=e[t];for(;t>0;){let s=t-1>>1,o=e[s];if(n(r,o)>=0)break;e[t]=o,t=s}e[t]=r}_down(t){let{data:e,compare:n}=this,r=this.length>>1,s=e[t];for(;t<r;){let o=(t<<1)+1,a=o+1;if(a<this.length&&n(e[a],e[o])<0&&(o=a),n(e[o],s)>=0)break;e[t]=e[o],t=o}e[t]=s}}});function u2(i,t,e=1,n=!1){let r=1/0,s=1/0,o=-1/0,a=-1/0;for(let[v,b]of i[0])v<r&&(r=v),b<s&&(s=b),v>o&&(o=v),b>a&&(a=b);let l=o-r,c=a-s,u=Math.max(e,Math.min(l,c));if(u===e){let v=[r,s];return v.distance=0,v.distance}let d=new Sv([],(v,b)=>b.max-v.max),h=HJ(i),p=new dw(r+l/2,s+c/2,0,i);p.d>h.d&&(h=p);let f=2;function g(v,b,x){let S=new dw(v,b,x,i);if(f++,S.max>h.d+e&&d.push(S),S.d>h.d&&(h=S,n&&console.log(`found best ${Math.round(1e4*S.d)/1e4} after ${f} probes`),h.d>t))return t}let m=u/2;for(let v=r;v<o;v+=u)for(let b=s;b<a;b+=u)g(v+m,b+m,m);for(;d.length;){let{max:v,x:b,y:x,h:S}=d.pop();if(v-h.d<=e)break;m=S/2,g(b-m,x-m,m),g(b+m,x-m,m),g(b-m,x+m,m),g(b+m,x+m,m)}n&&console.log(`num probes: ${f}
4132
4132
  best distance: ${h.d}`);let y=[h.x,h.y];return y.distance=h.d,y.distance}function dw(i,t,e,n){this.x=i,this.y=t,this.h=e,this.d=jJ(i,t,n),this.max=this.d+this.h*Math.SQRT2}function jJ(i,t,e){let n=!1,r=1/0;for(let s of e)for(let o=0,a=s.length,l=a-1;o<a;l=o++){let c=s[o],u=s[l];c[1]>t!=u[1]>t&&i<(u[0]-c[0])*(t-c[1])/(u[1]-c[1])+c[0]&&(n=!n),r=Math.min(r,WJ(i,t,c,u))}return r===0?0:(n?1:-1)*Math.sqrt(r)}function HJ(i){let t=0,e=0,n=0,r=i[0];for(let o=0,a=r.length,l=a-1;o<a;l=o++){let c=r[o],u=r[l],d=c[0]*u[1]-u[0]*c[1];e+=(c[0]+u[0])*d,n+=(c[1]+u[1])*d,t+=d*3}let s=new dw(e/t,n/t,0,i);return t===0||s.d<0?new dw(r[0][0],r[0][1],0,i):s}function WJ(i,t,e,n){let r=e[0],s=e[1],o=n[0]-r,a=n[1]-s;if(o!==0||a!==0){let l=((i-r)*o+(t-s)*a)/(o*o+a*a);l>1?(r=n[0],s=n[1]):l>0&&(r+=o*l,s+=a*l)}return o=i-r,a=t-s,o*o+a*a}var qk=F(()=>{"use strict";Wk()});var wv,h2,p2,d2,wu,hw=F(()=>{"use strict";X();$d();Hk();gn();qk();wv={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},h2={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},p2={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0},d2=(i,t)=>([e,n])=>(n<e&&(n+=t),(i>=e?i:i+t)<=n),wu=class extends De{constructor(e,n,r=0,s=12,o=3,a=an.ODD,l=!1){super();this.forPathBevel=l;this.type="ShapeGeometry";this.vertexCache={};this._shape=e,this._depth=n,this._curveSegments=s,this._bevelSegmentsInput=o;let c=this._shape.extractShapePointsToFlatArray([],s),u=this._shape.shapeHoles.map(C=>{let P=C.extractShapePointsToFlatArray([],s),D=[];for(let O=P.length-1;O>=1;O-=2){let L=P[O-1],U=P[O-0];D.push(L,U)}return D}),d=[],h=[];for(let C=0;C<c.length;C+=2)h.push([c[C],c[C+1]]);d.push(h);for(let C=0;C<u.length;C++){let P=u[C],D=[];for(let O=0;O<P.length;O+=2)D.push([P[O],P[O+1]]);d.push(D)}let p;e.isText?p=new zl().setFromPoints(e.points.map(P=>P.position)).getSize(new j).length()*.1:d[0].length===0?p=r:r>0?p=u2(d,r):p=1e-5,r<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(r,p,n/2),this._bevelSegments=Math.floor(o));let f;try{f=la({windingRule:a,elementType:Ir.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[c]})}catch{f=wv}let g;try{g=la({windingRule:an.ODD,elementType:Ir.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...u]})}catch{g=h2}if(!f)throw new Error("error generating geometry");let m=f.elementCount;if(g){f.elementCount+=g.elementCount;for(let C=0;C<g.elements.length;C++){let P=g.elements[C],D=C%2===0?f.vertexCount:0;f.elements.push(P+D)}for(let C=0;C<g.vertexIndices.length;C++){let P=g.vertexIndices[C],D=f.vertexCount;f.vertexIndices.push(P+D)}for(let C=0;C<g.vertices.length;C++){let P=g.vertices[C];f.vertices.push(P)}}let y=1/0,v=-1/0,b=1/0,x=-1/0;for(let C=0,P=f.vertexCount;C<P;C++){let D=C*2,O=f.vertices[D+0],L=f.vertices[D+1];O<y&&(y=O),O>v&&(v=O),L<b&&(b=L),L>x&&(x=L)}this._minX=y,this._minY=b,this._width=v-y,this._height=x-b,this._buffer=new xv(this._computeBufferEstimatedSize(f));let S=[],E=[];for(let C=f.elementCount-1;C>=0;C--){let P=C>=m,D=C*2,O=f.elements[D+0],L=f.elements[D+1],U=O+L,G={start:O,count:L,normals:[],continuous:[],concave:[]},Y=O,oe=U-1,ee=O+1,J=this._shape.roundedCurves.length;do{let pe=Y-O,Ee=f.vertices[oe*2+0],ce=f.vertices[oe*2+1],Se=f.vertices[Y*2+0],Pe=f.vertices[Y*2+1],Le=f.vertices[ee*2+0],ke=f.vertices[ee*2+1],Ce=Se-Ee,le=Pe-ce,ye=Math.sqrt(Ce*Ce+le*le);Ce/=ye,le/=ye;let Te=Se-Le,Ne=Pe-ke,He=Math.sqrt(Te*Te+Ne*Ne);Te/=He,Ne/=He,G.normals[pe*2+0]=-Ne,G.normals[pe*2+1]=Te,G.concave[pe]=Ce*Ne-le*Te>0;let Me=f.vertexIndices[Y];if(Array.isArray(Me))G.continuous[pe]=!1;else{let[Oe,B]=this._shape.getCurveIndexFromVertexId(Me-1,!0);if(B>0&&B<1)G.continuous[pe]=!0;else{let fe=B===1?Oe+1:Oe-1;fe=(fe+J)%J;let W=B===1?0:1,et=this._shape.roundedCurves[Oe].getTangent(B),Ge=this._shape.roundedCurves[fe].getTangent(W);G.continuous[pe]=et.dot(Ge)>.95}}P&&(G.normals[pe*2+0]*=-1,G.normals[pe*2+1]*=-1),[oe,Y,ee]=[Y,ee,ee+1],ee>=U&&(ee-=L)}while(ee!==O+1);let Q=[];Q.push({bevelI:0,angle:0,size:0,boundary:{vertices:f.vertices.slice(O*2,U*2),vertexCount:L,vertexIndices:new Array(L).fill(!0).map((pe,Ee)=>[Ee,Ee]),elements:[0,L],elementCount:1,mesh:null},reverseMap:[],insetPoints:f.vertices.slice(O*2,U*2)});let re=0;for(let pe=1;pe<=this._bevelSegments;pe++){let Ee=pe/this._bevelSegments*Math.PI/2,ce=(1-Math.cos(Ee))*this._bevel,Se=[],Pe=[],Le=[],ke=[],Ce=0;for(let ye=0;ye<L;ye++){let Te=ye*2,Ne=(ye-1+L)%L*2,He=f.vertices[G.start*2+Te+0],Me=f.vertices[G.start*2+Te+1],Oe=-G.normals[Ne+0]*ce,B=-G.normals[Ne+1]*ce,fe=-G.normals[Te+0]*ce,W=-G.normals[Te+1]*ce;if(G.concave[ye]||!G.concave[ye]&&P){let et=Math.atan2(B,Oe),Ge=Math.atan2(W,fe);Ge>et&&(Ge-=Math.PI*2);let z=Ge-et;if(G.continuous[ye]||P){let I=et+z/2,q=Math.cos(I)*ce,Z=Math.sin(I)*ce;Se[2*Ce+0]=He+q*(P?-1:1),Se[2*Ce+1]=Me+Z*(P?-1:1),ke[Ce]=ye,Ce++}else{let I=Math.max(1,Math.floor(s/4*Math.abs(z)/Math.PI));for(let q=0;q<=I;q++){let Z=et+z*(q/I),ae=Math.cos(Z)*ce,be=Math.sin(Z)*ce;Se[2*Ce+0]=He+ae,Se[2*Ce+1]=Me+be,ke[Ce]=ye,Ce++}}}else Se[2*Ce+0]=He+Oe,Se[2*Ce+1]=Me+B,ke[Ce]=ye,Pe[ye]=Ce,Ce++,Se[2*Ce+0]=He,Se[2*Ce+1]=Me,ke[Ce]=ye,Ce++,Se[2*Ce+0]=He+fe,Se[2*Ce+1]=Me+W,ke[Ce]=ye,Le[ye]=Ce,Ce++}let le=la({windingRule:an.POSITIVE,elementType:Ir.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[Se],edgeCreateCallback:ye=>{let Ne=ye.Org.idx,He=ke[Ne],Me=ke[(Ne+1)%ke.length];ye.idx=[He,Me],ye.Sym.idx=[Me,He]},vertexIdCallback:ye=>{let Te=ye.Lprev.idx;return[Te?Te[1]:0,ye.idx?ye.idx[0]:0]}});if(!le)throw console.log("Error"),new Error(`error generating bevel geometry for ${pe}'th loop`);if(!le.vertexCount){let ye=(pe-1)/this._bevelSegments*Math.PI/2;re=(1-Math.sin(ye))*this._bevel;break}for(let ye=0;ye<le.vertexIndices.length;ye++){let[Te,Ne]=le.vertexIndices[ye];if(Te===Ne)continue;let He=Ne;Ne<Te&&(He+=L);for(let Me=Te;Me<He;Me++){let Oe=Me%L,B=(Me+1)%L;if(!G.continuous[Oe]||!G.continuous[B]){le.vertexIndices[ye]=[Te,Oe],le.vertexIndices.splice(ye+1,0,[B,Ne]),le.vertices.splice((ye+1)*2,0,le.vertices[ye*2],le.vertices[ye*2+1]);break}}}Q.push({bevelI:pe,angle:Ee,size:ce,boundary:le,reverseMap:ke,insetPoints:Se})}let me=(pe,Ee,ce)=>{let Se=0,Pe=pe.boundary.vertexIndices.length;for(;Se<Pe&&ce(pe.boundary.vertexIndices[Ee]);)Ee=(Ee+1)%Pe,Se++;return Se},ve=S.length;for(let pe=1;pe<Q.length;pe++){let Ee=Q[pe-1],ce=Q[pe],Se=Ee.boundary.vertexIndices.length,Pe=ce.boundary.vertexIndices.length;if(!Se||!Pe)break;let Le=G.concave.length,ke=0,Ce=d2(ke,L);for(;!Ee.boundary.vertexIndices.filter(Ce).length||!ce.boundary.vertexIndices.filter(Ce).length;)ke++,Ce=d2(ke,L);let le=Ee.boundary.vertexIndices.findIndex(Ce),ye=ce.boundary.vertexIndices.findIndex(Ce);do le=(le+1)%Se;while(Ce(Ee.boundary.vertexIndices[le]));do ye=(ye+1)%Pe;while(Ce(ce.boundary.vertexIndices[ye]));ke=(ke+1)%L;let Te=ke,Ne=0,He=this._buildBevelVert(G,Ee,(le-1+Se)%Se,void 0,Ne),Me=this._buildBevelVert(G,ce,(ye-1+Pe)%Pe,void 0,Ne),Oe=He,B=Me,fe,W,et=!1;do{Ne=(ke||Le)/Le,Ce=d2(ke,L);let Ge=me(Ee,le,Ce),z=me(ce,ye,Ce),I=et;if(et=!1,Ge&&!z){for(let q=0;q<Ge;q++)fe=this._buildBevelVert(G,Ee,(le+q)%Se,q/(Ge-1),Ne),S.push(Oe.topN,fe.topP,B.topN),l===!1&&S.push(fe.bottomP,Oe.bottomN,B.bottomN),Oe=fe;et=!0}else if(!Ge&&z)for(let q=0;q<z;q++)W=this._buildBevelVert(G,ce,(ye+q)%Pe,q/(z-1),Ne),S.push(B.topN,Oe.topP,W.topP),l===!1&&S.push(Oe.bottomP,B.bottomN,W.bottomP),B=W;else if(Ge&&z)if(fe=this._buildBevelVert(G,Ee,le,0,Ne),W=this._buildBevelVert(G,ce,ye,0,Ne),I?(S.push(Oe.topN,W.topP,B.topN),S.push(Oe.topN,fe.topP,W.topP),l===!1&&(S.push(W.bottomP,Oe.bottomN,B.bottomN),S.push(W.bottomP,fe.bottomP,Oe.bottomN))):(S.push(B.topN,Oe.topN,fe.topP),S.push(B.topN,fe.topP,W.topP),l===!1&&(S.push(fe.bottomP,Oe.bottomN,B.bottomN),S.push(fe.bottomP,B.bottomN,W.bottomP))),Oe=fe,B=W,Ge===z)for(let q=1;q<Ge;q++)fe=this._buildBevelVert(G,Ee,(le+q)%Se,q/(Ge-1),Ne),W=this._buildBevelVert(G,ce,(ye+q)%Pe,q/(z-1),Ne),S.push(Oe.topN,fe.topP,B.topN),S.push(B.topN,fe.topP,W.topP),l===!1&&(S.push(fe.bottomP,Oe.bottomN,B.bottomN),S.push(fe.bottomP,B.bottomN,W.bottomP)),Oe=fe,B=W;else if(Ge>z){let q=Ge/z,Z=0;for(let ae=1;ae<Ge;ae++)fe=this._buildBevelVert(G,Ee,(le+ae)%Se,ae/(Ge-1),Ne),S.push(Oe.topN,fe.topP,B.topN),l===!1&&S.push(fe.bottomP,Oe.bottomN,B.bottomN),Oe=fe,ae>(Z+1)*q&&(Z++,W=this._buildBevelVert(G,ce,(ye+Z)%Pe,Z/(z-1),Ne),S.push(B.topN,fe.topP,W.topP),l===!1&&S.push(fe.bottomP,B.bottomN,W.bottomP),B=W)}else{let q=z/Ge,Z=0;for(let ae=1;ae<z;ae++)W=this._buildBevelVert(G,ce,(ye+ae)%Pe,ae/(z-1),Ne),S.push(B.topN,fe.topP,W.topP),l===!1&&S.push(fe.bottomP,B.bottomN,W.bottomP),B=W,ae>(Z+1)*q&&(Z++,fe=this._buildBevelVert(G,Ee,(le+Z)%Se,Z/(Ge-1),Ne),S.push(Oe.topN,fe.topP,B.topN),l===!1&&S.push(fe.bottomP,Oe.bottomN,B.bottomN),Oe=fe)}le=(le+Ge)%Se,ye=(ye+z)%Pe,ke=(ke+1)%Le}while(ke!==Te)}if(l===!1&&this._depth>this._bevel*2&&this._buildWall(Q,G,S),P){let pe=[];for(let Ee=S.length-1;Ee>=ve+2;Ee-=3){let ce=S[Ee-2],Se=S[Ee-1],Pe=S[Ee-0];pe.push(Pe,Se,ce)}S.splice(ve,S.length-ve,...pe)}if(P){let pe=[];for(let Ee=Q[Q.length-1].boundary.vertices.length-1;Ee>=1;Ee-=2){let ce=Q[Q.length-1].boundary.vertices[Ee-1],Se=Q[Q.length-1].boundary.vertices[Ee-0];pe.push(ce,Se)}E.push(pe)}if(!P){let pe=Q[Q.length-1],Ee;try{Ee=la({windingRule:Q.length>1?an.POSITIVE:an.ODD,elementType:Ir.POLYGONS,vertexSize:2,strict:!0,contours:[pe.insetPoints,...E]})}catch{Ee=p2}if(!Ee)throw new Error("Error generating geometry for surface");u.length===0&&this._bevel<p&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let ce=0;ce<Ee.elementCount*3;ce+=3){let Se=this._buildSurfaceVert(Ee,Ee.elements[ce+0],re),Pe=this._buildSurfaceVert(Ee,Ee.elements[ce+1],re),Le=this._buildSurfaceVert(Ee,Ee.elements[ce+2],re);S.push(Se.top,Pe.top,Le.top),l===!1&&S.push(Le.bottom,Pe.bottom,Se.bottom)}}this.vertexCache={}}this._buffer.shrink();let T=new je(Uint32Array.from(S),1),w=new je(this._buffer.positions,3),_=new je(this._buffer.normals,3),A=new je(this._buffer.uvs,2);w.needsUpdate=!0,_.needsUpdate=!0,A.needsUpdate=!0,T.needsUpdate=!0,this.setAttribute("position",w),this.setAttribute("normal",_),this.setAttribute("uv",A),this.setIndex(T)}_computeBufferEstimatedSize(e){return e.vertexCount*2*(2+this._bevelSegments)}_buildWall(e,n,r){let s=e[0];for(let o=0,a=s.boundary.vertexCount;o<a;o++){let l=this._buildBevelVert(n,s,o),c=this._buildBevelVert(n,s,(o+1)%a);r.push(c.topP,l.topN,l.bottomN),r.push(c.topP,l.bottomN,c.bottomP)}}_buildSurfaceVert(e,n,r){let s=n.toString();if(s in this.vertexCache)return this.vertexCache[s];let o=e.vertices[n*2+0],a=e.vertices[n*2+1],l=(o-this._minX)/this._width,c=(a-this._minY)/this._height;this.forPathBevel&&(c=1);let u=this._buffer.get(this.forPathBevel?1:2),d=u*3,h=u*2,p={top:u+0,bottom:u+1};return this._buffer.positions[d+0]=o,this._buffer.positions[d+1]=a,this._buffer.positions[d+2]=this.forPathBevel?this._bevel:this._depth-r,this._buffer.normals[d+0]=0,this._buffer.normals[d+1]=0,this._buffer.normals[d+2]=1,this._buffer.uvs[h+0]=l,this._buffer.uvs[h+1]=c,this.forPathBevel===!1&&(this._buffer.positions[d+3]=o,this._buffer.positions[d+4]=a,this._buffer.positions[d+5]=r,this._buffer.normals[d+3]=0,this._buffer.normals[d+4]=0,this._buffer.normals[d+5]=-1,this._buffer.uvs[h+2]=l,this._buffer.uvs[h+3]=c),this.vertexCache[s]=p,p}_buildBevelVert(e,n,r,s=1,o){let a=`${n.bevelI}:${r}`;if(a in this.vertexCache&&o!==0&&o!==1&&(!o||o===this.vertexCache[a].pathBevelUCoord))return this.vertexCache[a];let[l,c]=n.boundary.vertexIndices[r],u,d,h,p;l!==c?(d=l,u=c,p=!1,h=e.continuous[d]&&e.continuous[u]):(u=l,d=(u-1+e.count)%e.count,p=e.concave[u]&&n.bevelI>0,h=e.continuous[u]||p);let f=Math.cos(n.angle),g=Math.sin(n.angle),m=r*2,y=u*2,v=d*2,b=n.boundary.vertices[m+0],x=n.boundary.vertices[m+1],S=(1-g)*this._bevel,E=(b-this._minX)/this._width,T=(x-this._minY)/this._height;this.forPathBevel&&(o!==void 0&&(E=o),T=1);let w=e.normals[y+0],_=e.normals[y+1],A=e.normals[v+0],C=e.normals[v+1];if(p){let U=A-w,G=C-_;w=w+U*(1-s),_=_+G*(1-s);let Y=Math.sqrt(w*w+_*_);w/=Y,_/=Y}let P=this.forPathBevel?this._buffer.get(h?1:2):this._buffer.get(h?2:4),D=P*3,O=P*2,L={i:r,fi:u,topP:P+0,topN:P+0,bottomP:P+1,bottomN:P+1,pathBevelUCoord:o};return this._buffer.positions[D+0]=b,this._buffer.positions[D+1]=x,this._buffer.positions[D+2]=(this.forPathBevel?this._bevel:this._depth)-S,this._buffer.normals[D+0]=w*f,this._buffer.normals[D+1]=_*f,this._buffer.normals[D+2]=g,this._buffer.uvs[O+0]=E,this._buffer.uvs[O+1]=T,this.forPathBevel===!1&&(this._buffer.positions[D+3]=b,this._buffer.positions[D+4]=x,this._buffer.positions[D+5]=S,this._buffer.normals[D+3]=w*f,this._buffer.normals[D+4]=_*f,this._buffer.normals[D+5]=-g,this._buffer.uvs[O+2]=T,this._buffer.uvs[O+3]=E),h||(this.forPathBevel?(P+=1,D+=3,O+=2):(P+=2,D+=6,O+=4),L.topP=P+0,L.bottomP=P+1,this._buffer.positions[D+0]=b,this._buffer.positions[D+1]=x,this._buffer.positions[D+2]=(this.forPathBevel?this._bevel:this._depth)-S,this._buffer.normals[D+0]=A*f,this._buffer.normals[D+1]=C*f,this._buffer.normals[D+2]=g,this._buffer.uvs[O+0]=E,this._buffer.uvs[O+1]=T,this.forPathBevel===!1&&(this._buffer.positions[D+3]=b,this._buffer.positions[D+4]=x,this._buffer.positions[D+5]=S,this._buffer.normals[D+3]=A*f,this._buffer.normals[D+4]=C*f,this._buffer.normals[D+5]=-g,this._buffer.uvs[O+2]=T,this._buffer.uvs[O+3]=E)),this.vertexCache[a]=L,L}clone(){let e=new wu(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=iu(this.userData),e}}});var Df,f2=F(()=>{"use strict";X();$d();gn();hw();Df=class extends De{constructor(e,n=12,r={}){super();this.type="ShapeGeometry";this.windingRule=an.ODD;this.elementType=Ir.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=e,this._curveSegments=n,this._triangulationOptions=Object.assign({windingRule:an.ODD,elementType:Ir.POLYGONS,polySize:3,vertexSize:2,strict:!0},r);let s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(f=>f.extractShapePointsToFlatArray([],this._curveSegments)),a,l=!0,c=!0,u,d;for(let f=0,g=s.length/2;f<g;f++){let m=f*2,y=s[m+0],v=s[m+1];if(u!==void 0&&y!==u&&(l=!1),d!==void 0&&v!==d&&(c=!1),u=y,d=v,!l&&!c)break}if(!l&&!c)try{a=la({contours:[s,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{a=wv}let h=a?.vertexCount??1,p=a?.elementCount??1;if(this._positionAttribute=new je(new Float32Array(h*3),3),this._normalAttribute=new je(new Float32Array(h*3),3),this._uvAttribute=new je(new Float32Array(h*2),2),this._indexAttribute=new je(new Uint32Array(p*3),1),a){let f=1/0,g=-1/0,m=1/0,y=-1/0;for(let x=0,S=h;x<S;x++){let E=x*2,T=a.vertices[E+0],w=a.vertices[E+1];T<f&&(f=T),T>g&&(g=T),w<m&&(m=w),w>y&&(y=w)}let v=g-f,b=y-m;for(let x=0,S=h;x<S;x++){let E=x*2,T=a.vertices[E+0],w=a.vertices[E+1],_=(T-f)/v,A=(w-m)/b;this._positionAttribute.setXYZ(x,T,w,0),this._normalAttribute.setXYZ(x,0,0,1),this._uvAttribute.setXY(x,_,A)}for(let x=0,S=p;x<S;x++){let E=x*3,T=a.elements[E+0],w=a.elements[E+1],_=a.elements[E+2];this._indexAttribute.setX(E+0,T),this._indexAttribute.setX(E+1,w),this._indexAttribute.setX(E+2,_)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,(a?.elementCount??1)*3)}clone(){let e=new Df(this._shape,this._curveSegments);return e.userData=iu(this.userData),e}}});var Lf,Xk=F(()=>{"use strict";$d();gn();hw();Lf=class extends wu{constructor(e,n,r=0,s=12,o=3,a=an.ODD){super(e,n,r,s,o,a);this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return e.vertexCount*2*(2+this._bevelSegments)}_buildWall(e,n,r){let s=e[0];for(let o=0,a=s.boundary.vertexCount;o<a;o++){let l=this._buildBevelVert(n,s,o),c=this._buildBevelVert(n,s,(o+1)%a);r.push(c.topP,l.topN,l.bottomN),r.push(c.topP,l.bottomN,c.bottomP)}}clone(){let e=new Lf(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=iu(this.userData),e}}});var Ms,cc=F(()=>{"use strict";lc();f2();Xk();$d();Ms=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:an.ODD},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),o=i.shape??t?.shape,a=o?.roundness??e.roundness,l;o!==void 0&&(o instanceof vn?(l=o,(l.width!==n||l.height!==r)&&l.applySize(n,r)):l=new vn(n,r).fromJSON(o),i.parameters?.roundness!==void 0&&i.parameters?.roundness>0&&l.update());let c=l??new vn(n,r);return{parameters:Object.assign(e,{width:n,height:r,depth:s,roundness:a}),shape:c}}static build(i){let{depth:t,extrudeBevelSize:e,extrudeBevelSegments:n,subdivisions:r,roundness:s,windingRule:o}=i.parameters;i.shape.roundness=s;let a;return t<=0?a=new Df(i.shape,r,{windingRule:o}):a=new Lf(i.shape,t,e,r,n,o),Object.assign(a,{userData:{...i,type:"VectorGeometry"}})}}});function qJ(i,t,e,n,r,s){if(n>=$k)return r>30||r%4===0?(YJ(i,t,e,s),Math.round(r/4)):Yk(i,n,r,t,e,s);n=Math.max(n,.001);let o={x:0,y:e},a=n+Math.PI*.5,l={x:Math.cos(a)*t,y:Math.sin(a)*e},c=Uk({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:t,ry:e,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?XJ(i,o.x,o.y,c,r,t,e,s):Yk(i,n,r,t,e,s)}function XJ(i,t,e,n,r,s,o,a){let l=Math.round(r/n.length);i.addPoint(Nf(t,e));for(let c=0,u=n.length;c<u;c++){let d=n[c],h=i.points[c],p=Nf(d.x,d.y);h.controls[1].position.set(d.x1,d.y1),p.controls[0].position.set(d.x2,d.y2),i.addPoint(p)}return a>0?Kk(i,s,o,a):i.addPoint(Nf(0,0)),l}function Yk(i,t,e,n,r,s){let o=-t/e;for(let a=0;a<=e;a++){let l=o*a,c=Math.sin(l)*n,u=Math.cos(l)*r;i.addPoint(Nf(c,u))}return t<$k?s>0?Kk(i,n,r,s):i.addPoint(Nf(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&Zk(i,n,r,s)),1}function YJ(i,t,e,n=0,r=0,s=0){let o=.5522847498,a=t*o,l=e*o;i.addPoint(pw(r-t,s,r-t,s-l,r-t,s+l)),i.addPoint(pw(r,s+e,r-a,s+e,r+a,s+e)),i.addPoint(pw(r+t,s,r+t,s+l,r+t,s-l)),i.addPoint(pw(r,s-e,r+a,s-e,r-a,s-e)),n>0&&Zk(i,t,e,n)}function Nf(i,t){return new aa(xe.generateUUID(),new j(i,t))}function pw(i,t,e,n,r,s){let o=Nf(i,t);return o.controls[0].position.set(e,n),o.controls[1].position.set(r,s),o}function Kk(i,t,e,n){Qk(i,t,e,n).forEach(s=>i.addPoint(s))}function Zk(i,t,e,n){let r=Qk(i,t,e,n),s=new vn;r.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function Qk(i,t,e,n){let r=n*t/100,s=r*(Math.abs(e)/Math.abs(t)),o=new j(r/t,s/e),a=i.points.map(l=>{let c=l.clone();return c.uuid=xe.generateUUID(),c}).reverse();return a.forEach(l=>{l.position.multiply(o);let c=l.controls[0].position.clone().multiply(o),u=l.controls[1].position.clone().multiply(o);l.controls[0].position.copy(u),l.controls[1].position.copy(c)}),a}var $k,Bf,Ev=F(()=>{"use strict";lc();s2();kk();cc();X();$k=Math.PI*2,Bf=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return e.angle=xe.clamp(e.angle,0,360),{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:n,angle:r,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c=i.shape,u=t*.5,d=e*.5,h=qJ(c,u,d,r*Math.PI/180,n,s);c.isClosed=!0,c.update();let p;return r===0?(p=new De,p.setAttribute("position",new Ve([],3))):p=Ms.create({shape:c,parameters:{subdivisions:h,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}}),Object.assign(p,{userData:{...i,type:"EllipseGeometry"}})}}});var Jk,Tv,m2=F(()=>{"use strict";X();QP();Jk=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,detail:r,corner:s,cornerSides:o}=i.parameters,a=r===0&&s!==0?new Tv(t*.5,s,o):new gd(t*.5,r),l=e/t,c=n/t;return(l!==1||c!==1)&&a.scale(1,l,c),Object.assign(a,{userData:{...i,type:"IcosahedronGeometry"}})}},Tv=class extends xu{constructor(t=1,e=.2,n=4){let r=(1+Math.sqrt(5))/2,s=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a="IcosahedronGeometry";super(s,o,a,t,e,n),this.type=a}static fromJSON(t){return new Tv(t.radius,t.corner,t.cornerSides)}}});var eV,g2=F(()=>{"use strict";X();eV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){(i.parameters?.points??[]).forEach(n=>{Array.isArray(n)&&(n.x=n[0],n.y=n[1])});let e=Object.assign({},t?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{points:t,segments:e,verticalSegments:n}=i.parameters,r=new Ca;r.moveTo(t[0].x,t[0].y),r.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let s=new yd(r.extractPoints(n).shape,e);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...i,type:"LatheGeometry"}})}}});function Ff(i,t){return Math.abs(t-i)/2+Math.min(i,t)}function $J(i){let t=i.getAttribute("position");if(t===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let e=i.getAttribute("uv"),n=i.getIndex(),r=t.count,s=new Map,o=new Uint32Array(r),a=[],l=0;for(let g=0;g<r;g++){let m=t.getX(g),y=t.getY(g),v=t.getZ(g),b=Math.round(m*y2),x=Math.round(y*y2),S=Math.round(v*y2),E=s.get(b);E===void 0&&(E=new Map,s.set(b,E));let T=E.get(x);T===void 0&&(T=new Map,E.set(x,T));let w=T.get(S);w===void 0&&(w=l++,T.set(S,w),a.push(m,y,v)),o[g]=w}let c=[],u=[],d=e===void 0?null:[],h=n!==null?n.count:r,p=(g,m)=>{let y=n!==null?n.getX(g):g,v=n!==null?n.getX(g+1):g+1,b=n!==null?n.getX(g+2):g+2;if(!(y<r&&v<r&&b<r))return;let x=o[y],S=o[v],E=o[b];x===S||S===E||E===x||(c.push(x,S,E),u.push(m),d!==null&&d.push(e.getX(y),e.getY(y),e.getX(v),e.getY(v),e.getX(b),e.getY(b)))},f=i.groups;if(f.length>0)for(let g=0;g<f.length;g++){let m=f[g],y=m.materialIndex===void 0?0:m.materialIndex,v=Math.max(m.start,0),b=Math.min(m.start+m.count,h);for(let x=v;x<b&&x+2<h;x+=3)p(x,y)}else for(let g=0;g+2<h;g+=3)p(g,0);return{positions:Float64Array.from(a),faces:Uint32Array.from(c),materialIndices:u,uvs:d===null?null:Float64Array.from(d)}}function KJ(i){let{positions:t,faces:e,materialIndices:n,uvs:r}=i,s=t.length/3,o=e.length/3,a=r!==null&&o>0,l=o*3,c=new Uint32Array(l),u=new Uint32Array(l),d=new Uint32Array(l),h=new Uint32Array(l),p=new Uint32Array(l),f=0,g=8;for(;g<l*2;)g*=2;let m=g-1,y=new Int32Array(g).fill(-1),v=(O,L)=>{let U=(Math.imul(O,2654435761)^L)&m;for(;;){let G=y[U];if(G===-1)return y[U]=f,c[f]=O,u[f]=L,f++;if(c[G]===O&&u[G]===L)return G;U=U+1&m}},b=(O,L)=>{let U=O<L?O:L,G=O<L?L:O,Y=(Math.imul(U,2654435761)^G)&m;for(;;){let oe=y[Y];if(c[oe]===U&&u[oe]===G)return oe;Y=Y+1&m}},x=new Uint32Array(s),S=new Float64Array(s*3),E=(O,L,U)=>{let G=O<L?v(O,L):v(L,O),Y=++d[G];Y===1?h[G]=U:Y===2&&(p[G]=U),x[O]++,x[L]++,S[O*3]+=t[L*3],S[O*3+1]+=t[L*3+1],S[O*3+2]+=t[L*3+2],S[L*3]+=t[O*3],S[L*3+1]+=t[O*3+1],S[L*3+2]+=t[O*3+2]};for(let O=0;O<o;O++){let L=e[O*3],U=e[O*3+1],G=e[O*3+2];E(L,U,G),E(U,G,L),E(G,L,U)}let T=new Float64Array(f*3);for(let O=0;O<f;O++){let L=c[O]*3,U=u[O]*3;if(d[O]===2){let oe=h[O]*3,ee=p[O]*3;T[O*3]=(t[L]+t[U])*.375+(t[oe]+t[ee])*.125,T[O*3+1]=(t[L+1]+t[U+1])*.375+(t[oe+1]+t[ee+1])*.125,T[O*3+2]=(t[L+2]+t[U+2])*.375+(t[oe+2]+t[ee+2])*.125}else T[O*3]=(t[L]+t[U])*.5,T[O*3+1]=(t[L+1]+t[U+1])*.5,T[O*3+2]=(t[L+2]+t[U+2])*.5}let w=new Float64Array(s*3),_;for(let O=0;O<s;O++){let L=x[O];L===3?_=3/16:L>3&&(_=3/(8*L));let U=1-L*Number(_),G=Number(_);L===2&&(U=3/4,G=1/8),w[O*3]=t[O*3]*U+S[O*3]*G,w[O*3+1]=t[O*3+1]*U+S[O*3+1]*G,w[O*3+2]=t[O*3+2]*U+S[O*3+2]*G}let A=new Float64Array((s+f)*3);A.set(w),A.set(T,s*3);let C=new Uint32Array(o*12),P=new Array(o*4),D=a?new Float64Array(o*24):null;for(let O=0;O<o;O++){let L=e[O*3],U=e[O*3+1],G=e[O*3+2],Y=b(L,U)+s,oe=b(U,G)+s,ee=b(G,L)+s,J=O*12;C[J++]=Y,C[J++]=oe,C[J++]=ee,C[J++]=L,C[J++]=Y,C[J++]=ee,C[J++]=U,C[J++]=oe,C[J++]=Y,C[J++]=G,C[J++]=ee,C[J++]=oe;let Q=n[O];if(P[O*4]=Q,P[O*4+1]=Q,P[O*4+2]=Q,P[O*4+3]=Q,D!==null){let re=O*6,me=r[re],ve=r[re+1],pe=r[re+2],Ee=r[re+3],ce=r[re+4],Se=r[re+5],Pe=Ff(me,pe),Le=Ff(ve,Ee),ke=Ff(pe,ce),Ce=Ff(Ee,Se),le=Ff(me,ce),ye=Ff(ve,Se),Te=O*24;D[Te++]=Pe,D[Te++]=Le,D[Te++]=ke,D[Te++]=Ce,D[Te++]=le,D[Te++]=ye,D[Te++]=me,D[Te++]=ve,D[Te++]=Pe,D[Te++]=Le,D[Te++]=le,D[Te++]=ye,D[Te++]=pe,D[Te++]=Ee,D[Te++]=ke,D[Te++]=Ce,D[Te++]=Pe,D[Te++]=Le,D[Te++]=ce,D[Te++]=Se,D[Te++]=le,D[Te++]=ye,D[Te++]=ke,D[Te++]=Ce}}return{positions:A,faces:C,materialIndices:P,uvs:D}}function ZJ(i,t){let{positions:e,faces:n,materialIndices:r,uvs:s}=i,o=e.length/3,a=n.length/3,l=new Float64Array(o*3);for(let f=0;f<a;f++){let g=n[f*3]*3,m=n[f*3+1]*3,y=n[f*3+2]*3,v=e[y]-e[m],b=e[y+1]-e[m+1],x=e[y+2]-e[m+2],S=e[g]-e[m],E=e[g+1]-e[m+1],T=e[g+2]-e[m+2],w=b*T-x*E,_=x*S-v*T,A=v*E-b*S;l[g]+=w,l[g+1]+=_,l[g+2]+=A,l[m]+=w,l[m+1]+=_,l[m+2]+=A,l[y]+=w,l[y+1]+=_,l[y+2]+=A}for(let f=0;f<o;f++){let g=l[f*3],m=l[f*3+1],y=l[f*3+2],v=Math.sqrt(g*g+m*m+y*y)||1;l[f*3]=g/v,l[f*3+1]=m/v,l[f*3+2]=y/v}let c=a*3,u=new Float32Array(c*3),d=new Float32Array(c*3),h=s!==null&&s.length>0?new Float32Array(c*2):null;for(let f=0;f<c;f++){let g=n[f]*3;u[f*3]=e[g],u[f*3+1]=e[g+1],u[f*3+2]=e[g+2],d[f*3]=l[g],d[f*3+1]=l[g+1],d[f*3+2]=l[g+2]}h!==null&&h.set(s.subarray(0,c*2));let p=new De;p.setAttribute("position",new je(u,3)),c>0&&(p.setAttribute("normal",new je(d,3)),p.setAttribute("color",new je(new Float32Array(c*3).fill(1),3))),h!==null&&p.setAttribute("uv",new je(h,2));for(let f=0;f<a;){let g=r[f],m=f;do f++;while(f<a&&r[f]===g);p.addGroup(m*3,(f-m)*3,g)}return t.boundingBox!==null&&(p.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(p.boundingSphere=t.boundingSphere.clone()),p}var y2,fw,tV=F(()=>{"use strict";X();y2=1e4;fw=class{constructor(t=1){this.subdivisions=t}modify(t){let e=$J(t),n=this.subdivisions;for(;n-- >0;)e=KJ(e);return ZJ(e,t)}}});function QJ(i){let t=new Nt,e=i.attributes.position;return e?(t.setFromBufferAttribute(e),t):(t.makeEmpty(),t)}var gi,nV,v2=F(()=>{"use strict";X();tV();gi=new M,nV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=i.geometry??t?.geometry??new De().copy(new ni(100,100,100)),n;t===void 0?(e.computeBoundingBox(),e.boundingBox.getSize(gi),n={width:gi.x,height:gi.y,depth:gi.z,subdivisions:0}):n=t.parameters;let r={...n,...i.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:e}}static build(i){let{width:t,height:e,depth:n,subdivisions:r}=i.parameters,s=i.geometry??new De().copy(new ni(100,100,100)),o=s.userData.parameters;o===void 0?(s.boundingBox=QJ(s),s.boundingBox.getSize(gi)):gi.set(o.width,o.height,o.depth),(t!==gi.x||e!==gi.y||n!==gi.z)&&s.scale(gi.x===0?1:t/gi.x,gi.y===0?1:e/gi.y,gi.z===0?1:n/gi.z);let a=s.originalGeometry;try{r>0?(a===void 0||o?.subdivisions!==r)&&(a===void 0&&(a=s),s=new fw(r).modify(a)):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return a!==void 0&&Object.assign(s,{originalGeometry:a}),delete i.geometry,Object.assign(s,{userData:{...i,type:"NonParametricGeometry"}})}static loadFromUrl(i,t,e){new Sd(e).load(i,r=>{let s=this.normalizeInputs({geometry:r});r.boundingBox.getSize(gi);let o=100/gi.x;Object.assign(s.parameters,{width:100,height:gi.y*o,depth:gi.z*o}),t(this.build(s))})}}});var mw,gw=F(()=>{"use strict";lc();cc();mw=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}=i.parameters,l=i.shape,c=t*.5,u=e*.5,d=0,h=0,p=2*Math.PI/n;for(let g=0;g<n;g++){let m=p*g,y=d+Math.sin(m)*c,v=h+Math.cos(m)*u;l.addPoint(l.createPoint(y,v))}l.isClosed=!0;for(let g=0,m=l.points.length;g<m;g++)l.points[g].roundness=r;l.roundness=r,l.update();let f=Ms.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(f,{userData:{...i,type:"PolygonGeometry"}})}}});function Mv(i,t,e){e.x=i.x*t.x,e.y=i.y,e.z=i.x*t.y}function b2(i,t,e,n,r,s){let o=JJ.copy(t).sub(i),a=eee.copy(e).sub(i),l=o.angleTo(a);if(o.normalize(),a.normalize(),n===r){let c=o.add(a).normalize();s.copy(i).addScaledVector(c,n/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(i),s.addScaledVector(o,r/Math.sin(c)),s.addScaledVector(a,n/Math.sin(c))}}function tee(i,t,e){let n=i.clone().sub(t),r=e.clone().sub(t);return n.projectOnVector(r),n.add(t)}var rV,JJ,eee,x2,S2=F(()=>{"use strict";X();rV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,radialSegments:r,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=new x2(t*.5,e,r,s,o,a,l),u=n/t;return u!==1&&c.scale(1,1,u),Object.assign(c,{userData:{...i,type:"PyramidGeometry"}})}};JJ=new M,eee=new M;x2=class extends De{constructor(t=.5,e=1,n=4,r=1,s=!1,o=0,a=4){super(),n=Math.floor(Math.max(3,n)),r=Math.floor(r),a=Math.floor(a);let l=[],c=[],u=[],d=[],h=0,p=e/2,f=Math.PI/n,g=t*Math.cos(Math.PI/n),m=2*Math.PI/n,y=(n-2)*Math.PI/n,v=Math.PI-y,b=new M(0,-p,0),x=new M(0,p,0),S=new j(t,-p),E=new j(g,-p),T=new j(0,x.y).sub(E),w=new j(0,x.y).sub(S),_=new j(T.y,-T.x).normalize(),A=new j(w.y,-w.x).normalize(),P=t*Math.cos(Math.PI/n)*Math.tan((Math.PI-T.angle())/2)-1e-8;o=Math.min(o,P);let D;{let ee=new M(_.x,_.y,0),J=new M(Math.cos(m)*ee.x,ee.y,Math.sin(m)*ee.x);D=ee.angleTo(J)}let O=o/Math.tan((Math.PI-T.angle())/2),L=o/Math.tan((Math.PI-D)/2),U=new M;if(!s){c.push(b.x,b.y,b.z),u.push(0,-1,0),d.push(0,0);let ee=h++,J=[],Q=S.clone(),re=O/Math.cos(Math.PI/n);Q.x-=re;for(let me=0;me<n;me++){let ve=me/n*Math.PI*2+f,pe=new j(Math.sin(ve),Math.cos(ve));Mv(Q,pe,U),c.push(U.x,U.y,U.z),u.push(0,-1,0),d.push(0,0),J.push(h++)}for(let me=0;me<J.length;me++)l.push(J[me],ee,J[(me+1)%J.length])}let G=[];{let ee=new M,J=new M,Q=new M,re=new M,me=new M,ve=new M;for(let pe=0;pe<n;pe++){let Ee=pe/n*Math.PI*2+f,ce=(pe+.5)/n*Math.PI*2+f,Se=(pe+1)/n*Math.PI*2+f,Pe=new j(Math.sin(Ee),Math.cos(Ee)),Le=new j(Math.sin(ce),Math.cos(ce)),ke=new j(Math.sin(Se),Math.cos(Se));Mv(S,Pe,J),Mv(S,ke,Q),Mv(_,Le,ee),b2(x,J,Q,L,L,re),c.push(re.x,re.y,re.z),b2(J,x,Q,L,O,me),c.push(me.x,me.y,me.z),b2(Q,J,x,O,L,ve),c.push(ve.x,ve.y,ve.z),u.push(ee.x,ee.y,ee.z),u.push(ee.x,ee.y,ee.z),u.push(ee.x,ee.y,ee.z),d.push(0,0),d.push(0,0),d.push(0,0);let Ce=h++,le=h++,ye=h++;if(l.push(Ce,le,ye),o>0){{let He=J.clone().add(Q).multiplyScalar(.5),Me=x.clone().sub(He).normalize(),B=b.clone().sub(He).normalize().add(Me).normalize().multiplyScalar(-1),fe=ve.clone().sub(me);Y(He,fe,B,T.angle())}let Te,Ne;{let He=new M;Mv(A,ke,He);let Me=ve.clone().add(re).multiplyScalar(.5);Me=tee(Me,Q,x);let Oe=ve.clone().sub(re);[Te,Ne]=Y(Me,Oe,He,D,re.y)}{let He=Te,Me=He.clone().setY(0).normalize(),Oe=new M(0,-1,0),B=Me.clone().cross(Oe);oe(He,Me,Oe,B)}G.concat(Ne);{let He=T.angle(),Me=Math.PI-He,Oe=x.clone();Oe.y-=o/Math.sin(He-Math.PI/2);let B=new M,fe=[];for(let et=0;et<a;et++){let Ge=[],z=Math.PI/2-Me*et/a,I=Math.cos(z),q=Math.sin(z),Z=ce;for(let ae=0;ae<=et;ae++){let be=Math.cos(Z),Fe=Math.sin(Z);ee.x=I*Fe,ee.y=q,ee.z=I*be,B.copy(Oe).addScaledVector(ee,o),c.push(B.x,B.y,B.z),u.push(ee.x,ee.y,ee.z),d.push(0,0),Ge.push(h++),Z+=Math.PI*2/et/n}fe.push(Ge)}Ne.reverse(),fe.push(Ne);let W=fe.length-1;for(let et=0;et<W;et++){let Ge=fe[et],z=fe[et+1],I=Ge.length-1;l.push(z[1],Ge[0],z[0]);for(let q=1;q<=I;q++)l.push(Ge[q],Ge[q-1],z[q]),l.push(z[q+1],Ge[q],z[q])}}}}}this.setIndex(l),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(u,3)),this.setAttribute("uv",new Ve(d,2));function Y(ee,J,Q,re,me){let ve=-re/2,pe=(Math.PI-re)/2,Ee=J.clone().normalize().cross(Q);ee.addScaledVector(Q,-o/Math.sin(pe));let ce=new M,Se=new M,Pe=1,Le=h,ke=[];for(let Ce=0;Ce<=a;Ce++){let le=ve+Ce/a*re;Se.set(0,0,0),Se.addScaledVector(Ee,Math.sin(le)),Se.addScaledVector(Q,Math.cos(le));for(let ye=0;ye<=Pe;ye++){let Te=ye/Pe-.5;if(ce.copy(ee),ce.addScaledVector(J,Te),ce.addScaledVector(Se,o),me!=null){let Ne=Math.max(0,ce.y-me);ce.addScaledVector(J,-Ne/J.y)}c.push(ce.x,ce.y,ce.z),u.push(Se.x,Se.y,Se.z),d.push(0,0),ye===0&&ke.push(h),h++}}for(let Ce=0;Ce<a;Ce++)for(let le=0;le<Pe;le++){let ye=Le+le+(Pe+1)*Ce,Te=ye+(Pe+1),Ne=Te+1,He=ye+1;l.push(ye,Te,He),l.push(Te,Ne,He)}return[ee.clone().addScaledVector(J,.5),ke]}function oe(ee,J,Q,re){let me=Math.PI/2,ve=w.angle()-me,pe=[],Ee=new M,ce=new M;for(let Pe=0;Pe<=a;Pe++){let Le=[],ke=Pe/a;for(let Ce=0;Ce<=Pe;Ce++){let ye=((Pe?Ce/Pe:0)-.5)*v,Te=Math.cos(ye),Ne=Math.sin(ye),He=Math.atan(Math.tan(ve)*Te),Me=(me+He)*ke,Oe=Math.cos(Me),B=Math.sin(Me);Ee.set(0,0,0),Ee.addScaledVector(J,B*Te),Ee.addScaledVector(Q,Oe),Ee.addScaledVector(re,B*Ne),ce.copy(ee).addScaledVector(Ee,o),c.push(ce.x,ce.y,ce.z),u.push(Ee.x,Ee.y,Ee.z),d.push(0,0),Le.push(h++)}pe.push(Le)}let Se=pe.length-1;for(let Pe=0;Pe<Se;Pe++){let Le=pe[Pe],ke=pe[Pe+1],Ce=Le.length-1;l.push(Le[0],ke[1],ke[0]);for(let le=1;le<=Ce;le++)l.push(Le[le-1],Le[le],ke[le]),l.push(Le[le],ke[le+1],ke[le])}}}}});var Uf,_v=F(()=>{"use strict";lc();cc();Uf=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),n=Object.assign(t?.ui??{enabledIndieCorners:!1},i.ui);return{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)}),ui:n}}static build(i){let t=i.shape,{width:e,height:n,cornerRadius:r,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c={x:e*.5,y:n*.5},u={x:-c.x,y:-c.y},d={x:c.x,y:c.y};function h(x,S,E){return S>e&&E>n?Math.min(x*e/S,x*n/E):S>e?x*e/S:E>n?x*n/E:x}let p=[];p[0]=r[0]===0?0:h(r[0],r[0]+r[3],r[0]+r[1]),p[1]=r[1]===0?0:h(r[1],r[1]+r[2],r[1]+r[0]),p[2]=r[2]===0?0:h(r[2],r[2]+r[1],r[2]+r[3]),p[3]=r[3]===0?0:h(r[3],r[3]+r[0],r[3]+r[2]);let f=u.x,g=d.x,m=d.y,y=u.y;t.addPoint(t.createPoint(f,m)),t.addPoint(t.createPoint(g,m)),t.addPoint(t.createPoint(g,y)),t.addPoint(t.createPoint(f,y)),t.isClosed=!0;let v=!0;for(let x=0,S=t.points.length;x<S;x++)t.points[x].roundness=p[x],x>0&&p[x]!==p[x-1]&&(v=!1);v&&(t.roundness=p[0]),t.useCubicForRoundedCorners=s!==1,t.update();let b=Ms.create({shape:t,parameters:{depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(b,{userData:{...i,type:"RectangleGeometry"}})}}});var iV,w2=F(()=>{"use strict";X();iV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},i.parameters);return e.thetaLength=xe.clamp(e.thetaLength,0,180),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t=100,height:e=t,depth:n=t,widthSegments:r=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,u;return c===0?(u=new De,u.setAttribute("position",new Ve([],3))):u=new ss(.5*t,r,s,o,a,l,c*xe.DEG2RAD),u.scale(1,e/t,n/t),Object.assign(u,{userData:{...i,type:"SphereGeometry"}})}}});var sV,E2=F(()=>{"use strict";X();sV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:0})}}static build(i){let{width:t=100,height:e=t,widthSegments:n=8,heightSegments:r=8}=i.parameters,s=new ui(t,e,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...i,type:"PlaneGeometry"}})}}});var oV,T2,M2=F(()=>{"use strict";X();oV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,angle:r,cornerRadius:s,cornerSegments:o}=i.parameters,a=new T2(t,e,n,r,s,o);return Object.assign(a,{userData:{...i,type:"BackdropGeometry"}})}},T2=class extends De{constructor(t=1,e=1,n=1,r=90,s=10,o=24){super(),this.type="BackdropGeometry";let a=[],l=[],c=[],u=.001;s==0&&(o=1),o=Math.max(1,Math.floor(o)),s=Math.min(s,100),r=Math.min(180-u,r),r*=Math.PI/180;let d=[],h=Math.PI/2,p=(ce=0,Se=0,Pe=0)=>new M(ce,Se,Pe),f=p(),g=p(),[m,y,v]=[e/2,t/2,n/2],b=-y,x=+y,[S,E,T]=[p(b,-m,+v),p(b,-m,-v),p(b,+m,-v)],w=(ce,Se=!1)=>Math.sin(ce-Math.PI/(1+ +Se)),_=(ce,Se=!1)=>Math.cos(ce-Math.PI/(1+ +Se));T.y=Math.sin(r)*e-m;let A=Math.cos(r)*e-v,C=S.z-u;r<=h?(T.z=Math.min(A,C),T.z==C&&(T.y-=(A-C)/Math.tan(h-r))):E.z=Math.min(E.z-A-v,S.z-u),f.subVectors(S,E),g.subVectors(T,E);let P=Math.min(f.length(),g.length())*s/100,D=P*Math.tan(r/2),O=P/Math.cos(r/2),L=f.clone().normalize().add(g.normalize()).setLength(O).add(E);f.set(0,w(r,!0),_(r,!0)),d.push([T,f.clone()]);let U=(Math.PI-r)/o;for(let ce=0;ce<=o;ce++){let Se=h+r+ce*U;f.set(0,Math.sin(Se)*D,Math.cos(Se)*D),f.add(L),g.set(0,w(Se),_(Se)),d.push([f.clone(),g.clone()])}d.push([S,p(0,1,0)]);let G=Math.sin(U/2)*D*2,Y=d.length-1,oe=d[0][0].distanceTo(d[1][0]),ee=d[Y-1][0].distanceTo(d[Y][0]),J=oe+G*o+ee;d[0].push(1);for(let ce=0;ce<=o;ce++)d[ce+1].push(1-(oe+ce*G)/J);d[Y].push(0);let[Q,re,me]=d[0],ve,pe,Ee;for(let ce=1;ce<d.length;ce++)[ve,pe,Ee]=d[ce],a.push(b,Q.y,Q.z,b,ve.y,ve.z,x,Q.y,Q.z,x,Q.y,Q.z,b,ve.y,ve.z,x,ve.y,ve.z),l.push(0,re.y,re.z,0,pe.y,pe.z,0,re.y,re.z,0,re.y,re.z,0,pe.y,pe.z,0,pe.y,pe.z),c.push(0,me,0,Ee,1,me,1,me,0,Ee,1,Ee),[Q,re,me]=[ve,pe,Ee];this.setAttribute("position",new Ve(a,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(c,2))}}});var yw,vw=F(()=>{"use strict";lc();cc();yw=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}=i.parameters,u=i.shape,d=t*.5,h=e*.5,p=0,f=0,g=o*Math.PI/360/r,m=Math.PI/2*3*-1,y=d*n/100,v=h*n/100;if(r===3&&n===50){g=2*Math.PI/r;for(let x=0;x<r;x++){let S=g*x,E=p+Math.sin(S)*d,T=f+Math.cos(S)*h;u.addPoint(u.createPoint(E,T))}}else for(let x=0;x<r;x++){let S=p+Math.cos(m)*d,E=f+Math.sin(m)*h;u.addPoint(u.createPoint(S,E)),m+=g,S=p+Math.cos(m)*y,E=f+Math.sin(m)*v,u.addPoint(u.createPoint(S,E)),m+=g}u.isClosed=!0;for(let x=0,S=u.points.length;x<S;x++)u.points[x].roundness=s;u.roundness=s,u.update();let b=Ms.create({shape:u,parameters:{roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(b,{userData:{...i,type:"StarGeometry"}})}}});var aV,_2=F(()=>{"use strict";X();aV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e}=i.parameters,n=new ui(t,e);return Object.assign(n,{userData:{...i,type:"TextFrameGeometry"}})}}});function nee(i,t,e,n,r,s,o,a,l,c,u){[t,e]=[e,t],o=t/2;let d=xe.clamp(r/360,0,1);if(d===0){let h=new De;return h.setAttribute("position",new Ve([],3)),h}return d===1&&(c=0),new cv(!0,i,t,e,n,d,s,o,a,l,c,u)}var lV,A2=F(()=>{"use strict";X();_f();lV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width);e.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(e.depth??e.width*.25));return{parameters:Object.assign(e,{width:n,height:r,depth:s})}}static build(i){let{width:t,height:e,depth:n,radialSegments:r,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=nee(t,e,n,t*.5,o,s,0,0,r,a,l);return c.scale(1,e/t,1),Object.assign(c,{userData:{...i,type:"TorusGeometry"}})}}});var cV,C2=F(()=>{"use strict";X();cV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width),tube:e.tube??e.width*.125})}}static build(i){let{width:t,tube:e,tubularSegments:n,radialSegments:r,p:s,q:o}=i.parameters,a=t*.5;a!==e&&(a-=e);let l=new vd(a,e,n,r,s,o);return Object.assign(l,{userData:{...i,type:"TorusKnotGeometry"}})}}});var uV,P2=F(()=>{"use strict";lc();cc();uV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width*(e.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t=100,height:e,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a}=i.parameters,l=i.shape,c=t*.5,u=e*.5;a?(l.addPoint(l.createPoint(-c,u)),l.addPoint(l.createPoint(c,-u)),l.addPoint(l.createPoint(-c,-u))):(l.addPoint(l.createPoint(0,u)),l.addPoint(l.createPoint(c,-u)),l.addPoint(l.createPoint(-c,-u))),l.isClosed=!0;for(let h=0,p=l.points.length;h<p;h++)l.points[h].roundness=n;l.roundness=n,l.update();let d=Ms.create({shape:l,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(d,{userData:{...i,type:"TriangleGeometry"}})}}});var dV=F(()=>{"use strict"});var oEe,aEe,lEe,cEe,uEe,dEe,hEe,hV=F(()=>{"use strict";X();oEe=new nr,aEe=new ne,lEe=new Hi,cEe=new M,uEe=new M,dEe=new M,hEe=new M});function pV(){let i=new De;return i.setAttribute("position",new je(new Float32Array([]),3)),i.setIndex(new je(new Uint16Array([]),1)),i}function lee(i,t,e,n){let r=typeof i.width=="string"?Number(n.getVariable(i.width)):i.width,s=[""],o="";for(let a of e)o+=a,a===" "||a===`
4133
4133
  `?(s[s.length-1]+=o,o="",a===`
4134
- `&&s.push("")):t.getTextWidth(s[s.length-1]+o,i)>r&&(s[s.length-1].length&&s.push(""),t.getTextWidth(s[s.length-1]+o,i)>r&&(o.length===1?(s[s.length-1]+=o,o=""):(s[s.length-1]+=o.slice(0,-1),o=o[o.length-1],s.push(""))));return s[s.length-1]+=o,s}var see,oee,aee,kf,I2=F(()=>{"use strict";mi();pt();$d();X();ff();lc();cc();see=pV().attributes,oee=12,aee=1,kf=class extends De{constructor(e,n){super();this.isTextGeometry=!0;this.charWidths=[];this.charCoords=[];this.wrappedText=[];this.isLowResolution=!1;this.vectorShapes=[];Object.assign(this.attributes,see),this.userData={parameters:e,type:"TextGeometry"};let r=n.getFont(e.font);r?.isLoaded?(this.font=r,this.update(e,n)):this.updateFont(e.font,n).then(()=>{this.update(e,n),n?.requestRender()})}async updateFont(e,n){let r=n.getFont(e);r&&(this.font=r,await r.loadingPromise)}update(e,n){let r=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!r?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:s,height:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,text:u,textTransform:d}=e,h=Er.getDisplayedValue(u),p=d===2?h.toUpperCase():d===3?h.toLowerCase():h,f=lee(e,r,p,n),{shapes:g,charWidths:m,charCoords:y}=r.generateShapes(f,e,n),v=(typeof s=="number"?s:Number(n.getVariable(s)))*.5,b=(typeof o=="number"?o:Number(n.getVariable(o)))*.5,x=g.map(T=>new vn().fromShape(T,!0));this.vectorShapes=x;let S=x.map(T=>Ms.create({shape:T,parameters:{depth:a,extrudeBevelSegments:c,extrudeBevelSize:l,windingRule:a<=0?an.NONZERO:an.ODD,subdivisions:this.isLowResolution&&a>0?aee:oee}})),E=S.length?ia(S):pV();E.translate(-v,b,0),this.dispose(),this.wrappedText=f,this.charCoords=y,this.charWidths=m,this.deleteAttribute("extrudeNormal"),Object.entries(E.attributes).forEach(([T,w])=>{this.setAttribute(T,w)}),this.setIndex(E.index),this.computeBoundingSphere()}clone(){let e=Wr(new De,kf.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([n,r])=>{this.setAttribute(n,r)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,n){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},n)}get text(){return this.userData.parameters.text??""}}});function gV(i){if(fV)return;if(bw)return bw;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.25/build"),s=import("./process.js"),[o,a]=await Promise.all([s,fetch(`${n}/process.wasm`).then(u=>u.arrayBuffer())]),l=o.default,c=await l({wasmBinary:a});mV(c),fV=!0}return bw=t(),bw}var mV,xw,fV,bw,Av=F(()=>{xw=new Promise(i=>{mV=i}),fV=!1});function Sw(i,t){if(Object.keys(i.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let e=Object.keys(i.attributes),n=Object.keys(t.attributes);if(e.length!==n.length)return!1;for(let a of n){let l=i.attributes[a],c=t.attributes[a];if(l===void 0||l.isInterleavedBufferAttribute===!0||c.isInterleavedBufferAttribute===!0||l.itemSize!==c.itemSize||l.normalized!==c.normalized||l.array.constructor!==c.array.constructor||l.array.length!==c.array.length)return!1}let r=i.index,s=t.index;if(r===null!=(s===null))return!1;let o=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let a=r.array.constructor,l=s.array.constructor;if(a!==l){if(a!==Uint32Array||l!==Uint16Array)return!1;o=!0}}if(i.groups.length!==t.groups.length)return!1;for(let a=0;a<t.groups.length;a++){let l=i.groups[a],c=t.groups[a];if(l.start!==c.start||l.count!==c.count||l.materialIndex!==c.materialIndex)return!1}for(let a of n){let l=i.attributes[a],c=t.attributes[a];l.array.set(c.array),l.needsUpdate=!0}if(r!==null&&s!==null){if(o){let a=r.array,l=s.array;for(let c=0,u=l.length;c<u;c++){let d=l[c];a[c]=d===65535?4294967295:d}}else r.array.set(s.array);r.needsUpdate=!0}return i.drawRange.start=t.drawRange.start,i.drawRange.count=t.drawRange.count,i.userData=t.userData,i.boundingBox=null,i.boundingSphere=null,!0}function Cv(i,t,e,n){let r=i.position.array,s=i.normal.array,o=cee.makeScale(t,e,n).invert().elements,a,l,c;for(let u=0,d=r.length;u<d;u+=3)r[u]*=t,r[u+1]*=e,r[u+2]*=n,a=s[u],l=s[u+1],c=s[u+2],s[u]=o[0]*a+o[4]*l+o[8]*c,s[u+1]=o[1]*a+o[5]*l+o[9]*c,s[u+2]=o[2]*a+o[6]*l+o[10]*c;i.position.needsUpdate=!0,i.normal.needsUpdate=!0}var cee,R2=F(()=>{"use strict";X();cee=new ne});function Tw(i){let t=Object.keys(i);return t.length===1&&t[0]==="subdivisions"}function Pv(i,t){let e=t?t.count:i.count,n=0,r=1e4,s=new Map,o=new Uint32Array(e),a=[];for(let u=0;u<e;u++){let d=t?t.getX(u):u,h=i.getX(d),p=i.getY(d),f=i.getZ(d),g=Math.round(h*r),m=Math.round(p*r),y=Math.round(f*r),v=s.get(g);v===void 0&&(v=new Map,s.set(g,v));let b=v.get(m);b===void 0&&(b=new Map,v.set(m,b));let x=b.get(y);x===void 0&&(x=n++,b.set(y,x),a.push(h,p,f)),o[u]=x}let l=[],c=[];for(let u=0;u<o.length;u+=3)o[u]===o[u+1]||o[u]===o[u+2]||o[u+1]===o[u+2]||(l.push(o[u],o[u+1],o[u+2]),c.push(t?t.getX(u):u,t?t.getX(u+1):u+1,t?t.getX(u+2):u+2));return{positions:a,triIndices:l,triOriginals:c}}function uee(i,t,e,n,r){let s=[],o=[],a=r?e.getAttribute("uv"):void 0,l=a&&a.itemSize===2?[]:void 0,c=h=>{if(l){let p=r[h];l.push(a.getX(p),a.getY(p))}};if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let h=e.userData.shape.extractShapePointsToFlatArray([]),p=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&p<=24&&p%4===0&&e.userData.parameters.angle>=360){let m=h.length/2/p;h=h.filter((y,v)=>Math.floor(v/2)%m===0)}let f=0;for(let m=0;m<h.length;m+=2)f+=(h[m]-h[(m===0?h.length:m)-2])*(h[m+1]+h[(m===0?h.length:m)-1]);i.length=0;let g=0;if(f<0)for(let m=0;m<h.length;m+=2)i.push(h[m],h[m+1],0),s.push(g++);else for(let m=h.length-2;m>=0;m-=2)i.push(h[m],h[m+1],0),s.push(g++);return o.push(g),{indices:s,verticesPerFace:o}}let u=new Float32Array([e.userData.parameters.depth])[0],d=0;for(;d<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let h=0;if((i[t[d]*3+2]===u||i[t[d]*3+2]===0)&&h++,(i[t[d+1]*3+2]===u||i[t[d+1]*3+2]===0)&&h++,(i[t[d+2]*3+2]===u||i[t[d+2]*3+2]===0)&&h++,h===3)break}if(t[d+1]===t[d+3]&&t[d+2]===t[d+5]||t[d+0]===t[d+3]&&t[d+2]===t[d+4]){Ew.set(i[t[d]*3],i[t[d]*3+1],i[t[d]*3+2]),O2.set(i[t[d+1]*3],i[t[d+1]*3+1],i[t[d+1]*3+2]),D2.set(i[t[d+4]*3],i[t[d+4]*3+1],i[t[d+4]*3+2]),L2.set(i[t[d+5]*3],i[t[d+5]*3+1],i[t[d+5]*3+2]),O2.sub(Ew).normalize(),D2.sub(Ew).normalize(),L2.sub(Ew).normalize();let h=O2.cross(D2).dot(L2),p=d;Math.abs(h)>.005||n&&n.some((f,g)=>g%2===1?!1:p>=n[g]&&p<n[g+1])?(s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),o.push(3),d+=3):(s.push(t[d],t[d+1],t[d+4],t[d+5]),c(d),c(d+1),c(d+4),c(d+5),o.push(4),d+=6)}else s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),o.push(3),d+=3}if(e.useNgonForTopBottomFaceDuringBake){let h=[],p=[],f=0;for(let g=0,m=0;g<i.length;g+=3,m++)i[g+2]===0&&(h.push(m),f++),i[g+2]===u&&p.push(m);if(e.userData.parameters.extrudeBevelSize===0){let g=p[0];p[0]=p[1],p[1]=g}h.reverse(),s.push(...h,...p),o.push(f,f),l=void 0}return{indices:s,verticesPerFace:o,uvs:l}}var ww,Vf,gt,yV,vV,bV,Xn,Ew,O2,D2,L2,Kd=F(()=>{"use strict";X();Av();pt();Iv();R2();_f();ww=new Nt,Vf=new M;xw.then(i=>{gt=i});yV=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),vV=new Uint32Array([0,1,2,3]),bV=new Uint8Array([4]),Xn=class extends De{constructor(e,n){super();this.data=e;this.flatShading=n;this.subdivPointer=0;this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,n){this.freeSubdivPointer();let r=this.data.scaleBaked.map(l=>typeof l=="number"?l:1),s=ho.div(n.map(l=>typeof l=="number"?l:0),r);if(s.every(l=>l===1))return;this.subdividedGeometry&&Cv(this.subdividedGeometry.attributes,...s),this.originalGeometry&&Cv(this.originalGeometry.attributes,...s),this.data=e;let o=this.userData.parameters;this.userData.parameters={width:o.width*s[0],height:o.height*s[1],depth:o.depth*s[2]},this.originalGeometry.boundingSphere.center.multiply(Vf.fromArray(s));let a=Vf.set(o.width,o.height,o.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let n=e.phongAngle??35;this.flatShading&&(n=-1);let r=null;if(e.subdivisions>0){let o=0;try{o=Xn.allocate(e),r=Xn.buildRefined(o,e.subdivisions,n)}catch(a){console.error(a,e)}finally{o&&Xn.freeSubdivPointer(o)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let s=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=s}rebuild(){let e,n,r;try{({originalGeometry:e,subdividedGeometry:n,subdivPointer:r}=Xn.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new ni(100,100,100),r=0}this.subdivPointer=r,this.originalGeometry=e,this.subdividedGeometry=n??void 0;let s=this.subdividedGeometry??this.originalGeometry;Object.assign(this,s),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Xn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new nr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let n=e.attributes.position,r=e.boundingSphere.center;ww.setFromBufferAttribute(n),ww.getCenter(r),e.boundingSphere.radius=r.distanceTo(ww.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ww.getSize(Vf);let s={width:Vf.x,height:Vf.y,depth:Vf.z};return this.userData.parameters=s,s}static build(e,n,r,s){let o,a,l=e?.phongAngle??35;r===!1&&(l=-1),n&&(gt.free_bvh(n),gt.free_subdivision_surface(n));try{o=Xn.allocate(e,s)}catch(u){console.error(u,e),o=Xn.allocate({positionWASM:yV,indexWASM:vV,verticesPerFaceWASM:bV},s)}gt.set_destination_refinement_level(o,0);let c=Xn.buildLevel(o,!0,l);return e.subdivisions>0?a=Xn.buildRefined(o,e.subdivisions,l):a=null,{subdivPointer:o,originalGeometry:c,subdividedGeometry:a}}static buildRefined(e,n,r){try{return gt.set_destination_refinement_level(e,n),Xn.buildLevel(e,!1,r)??null}catch{try{return gt.set_destination_refinement_level(e,n-1),Xn.buildLevel(e,!1,r)??null}catch{return null}}}static primitiveToQuads(e,n,r){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let s=e.shape!==void 0||e.path!==void 0?n.geometry:Co(e,r,!1,n),o;W1(e)?o=s.getClosedTorusIndicesForBooleanOrSubdiv():o=s.getIndex();let{positions:a,triIndices:l,triOriginals:c}=Pv(s.getAttribute("position"),o),u;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let f=e.radialSegments*e.heightSegments*3*2,g=f+e.radialSegments*3;u=[f,g]}let{indices:d,verticesPerFace:h,uvs:p}=uee(a,l,s,u,c);return{positions:a,indices:d,verticesPerFace:h,uvs:p}}static allocate(e,n){let r,s,o,a=[],l=[];e.positionWASM&&e.positionWASM.length>0?(r=e.positionWASM,s=e.indexWASM,o=e.verticesPerFaceWASM,gt.alloc_subdivision_surface_uvs&&e.uvWASM&&e.uvWASM.length===s.length*2&&(l=e.uvWASM)):(r=yV,s=vV,o=bV);let c=r.length,u=s.length,d=o.length,h=r.length+a.length+l.length,p=s.length+o.length,f=h*Float32Array.BYTES_PER_ELEMENT+p*Uint32Array.BYTES_PER_ELEMENT,g=h*Float32Array.BYTES_PER_ELEMENT,m=gt._malloc(f),y=new Float32Array(gt.HEAPF32.buffer,m,h),v=new Uint32Array(gt.HEAPU32.buffer,m+g,p);y.set(r,0),y.set(a,r.length),y.set(l,r.length+a.length),v.set(s,0),v.set(o,s.length);let b;e?.scaleBaked?.some(E=>E!==1)&&(b=new ne().makeScale(...e.scaleBaked.map(E=>typeof E=="number"?E:1))),n&&(b?b.premultiply(n):b=n);let x=m+(r.length+a.length)*Float32Array.BYTES_PER_ELEMENT,S=l.length?b?gt.alloc_subdivision_surface_uvs2(m,c,m+g,u,m+g+s.length*Uint32Array.BYTES_PER_ELEMENT,d,x,l.length,b.elements):gt.alloc_subdivision_surface_uvs(m,c,m+g,u,m+g+s.length*Uint32Array.BYTES_PER_ELEMENT,d,x,l.length):b?gt.alloc_subdivision_surface2(m,c,m+g,u,m+g+s.length*Uint32Array.BYTES_PER_ELEMENT,d,b.elements):gt.alloc_subdivision_surface(m,c,m+g,u,m+g+s.length*Uint32Array.BYTES_PER_ELEMENT,d);return gt._free(m),S}static buildLevel(e,n,r,s,o,a=!1){let l=o?gt.get_mesh_data2(e,n?gt.Level.CONTROL:gt.Level.REFINED,r,o.elements):gt.get_mesh_data(e,n?gt.Level.CONTROL:gt.Level.REFINED,r),c=10,u=gt.HEAPU32.subarray(l>>2,(l>>2)+c),d=u.subarray(4,4+4),h=0,p=gt.HEAPU32[u[h]>>2],f=gt.HEAPF32.subarray(p>>2,(p>>2)+d[h]);h++;let g=gt.HEAPU32[u[h]>>2],m=gt.HEAPF32.subarray(g>>2,(g>>2)+d[h]);h++;let y=gt.HEAPU32[u[h]>>2],v=gt.HEAPU32.subarray(y>>2,(y>>2)+d[h]);h++;let b=gt.HEAPU32[u[h]>>2],x=gt.HEAPU32.subarray(b>>2,(b>>2)+d[h]);h++;let S;if(gt.alloc_subdivision_surface_uvs){let T=u[9];if(T>0){let w=gt.HEAPU32[u[8]>>2];S=gt.HEAPF32.subarray(w>>2,(w>>2)+T)}}if(s===void 0){let T=new De;if(T.setIndex(new Us(x,1)),T.setAttribute("position",new Ve(f,3)),T.setAttribute("normal",new Ve(m,3)),S&&T.setAttribute("uv",new Ve(S,2)),n){T.setAttribute("faceMap",new Us(v,1));let w=new Float32Array(m.length/3*4).fill(0);T.setAttribute("color",new je(w,4))}return gt.free_mesh_data(l),T.userData.type="SubdivGeometry",T}if(s.getAttribute("position").copyArray(f),s.getAttribute("normal").copyArray(m),s.attributes.position.needsUpdate=!0,s.attributes.normal.needsUpdate=!0,a){let T=s.getIndex();T!==null&&T.array.length===x.length&&(T.copyArray(x),T.needsUpdate=!0)}let E=s.getAttribute("uv");S&&E&&E.array.length===S.length&&(E.copyArray(S),E.needsUpdate=!0),gt.free_mesh_data(l)}static freeSubdivPointer(e){gt.free_bvh(e),gt.free_subdivision_surface(e)}static buildControlCageWireframe(e,n,r){let s=gt.get_wireframe_data_for_base_level(e),o=4,a=gt.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+2),c=0,u=gt.HEAPU32[a[c]>>2],d=gt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let h=gt.HEAPU32[a[c]>>2],p=gt.HEAPU32.subarray(h>>2,(h>>2)+l[c]);if(n===void 0){let f=new De;f.setAttribute("position",new Ve(d,3));let g=new Float32Array(d.length);for(let m=0,y=d.length;m<y;)g[m++]=r.r,g[m++]=r.g,g[m++]=r.b;return f.setAttribute("color",new je(g,3)),f.setIndex(new Us(p,1)),gt.free_wireframe_data_for_base_level(s),f}n.getAttribute("position").copyArray(d),n.attributes.position.needsUpdate=!0,gt.free_wireframe_data_for_base_level(s)}static updateCollabMesh(e,n,r){let s=n===0;s||gt.set_destination_refinement_level(e,n);let o=r?gt.get_topological_data2(e,s?gt.Level.CONTROL:gt.Level.REFINED,r.elements):gt.get_topological_data(e,s?gt.Level.CONTROL:gt.Level.REFINED),a=8,l=gt.HEAPU32.subarray(o>>2,(o>>2)+a),c=l.subarray(3,3+3),u=0,d=gt.HEAPU32[l[u]>>2],h=new Float32Array(gt.HEAPF32.subarray(d>>2,(d>>2)+c[u]));u++;let p=gt.HEAPU32[l[u]>>2],f=new Uint32Array(gt.HEAPU32.subarray(p>>2,(p>>2)+c[u]));u++;let g=gt.HEAPU32[l[u]>>2],m=new Uint8Array(gt.HEAPU32.subarray(g>>2,(g>>2)+c[u])),y;if(gt.alloc_subdivision_surface_uvs){let v=l[7];if(v>0){let b=gt.HEAPU32[l[6]>>2];y=new Float32Array(gt.HEAPF32.subarray(b>>2,(b>>2)+v))}}return gt.free_topological_data(o),{positions:h,indices:f,verticesPerFace:m,uvs:y}}};Ew=new M,O2=new M,D2=new M,L2=new M});var N2,Mw,B2=F(()=>{"use strict";YP();ZP();mv();JP();Ev();_f();m2();g2();v2();gw();S2();_v();w2();E2();M2();vw();_2();A2();C2();P2();cc();Qt();YP();ZP();mv();JP();Ev();dV();_f();m2();g2();v2();gw();S2();_v();w2();E2();M2();vw();_2();A2();C2();P2();cc();hV();f2();I2();Kd();Av();dv();N2={ConeGeometry:Sk,CubeGeometry:wk,CylinderGeometry:aw,DodecahedronGeometry:Ek,EllipseGeometry:Bf,HelixGeometry:GU,IcosahedronGeometry:Jk,LatheGeometry:eV,NonParametricGeometry:nV,PolygonGeometry:mw,PyramidGeometry:rV,RectangleGeometry:Uf,SphereGeometry:iV,PlaneGeometry:sV,BackdropGeometry:oV,StarGeometry:yw,TextFrameGeometry:aV,TorusGeometry:lV,TorusKnotGeometry:cV,TriangleGeometry:uV,VectorGeometry:Ms},Mw=i=>{let t=N2[i.type]??N1(i.type);if(t===void 0)throw new Error(`No geometry factory registered for "${i.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(i)}});function Co(i,t,e,n){let r,s,o;i.type==="PathGeometry"?(s=JSON.parse(JSON.stringify(i)),o=[[],["extrusion"]]):(s={...i},o=[[]]);for(let c of o){let u=s;for(let d of c)u=u[d];for(r in u){let d=u[r];CC(d)&&!dee.includes(r)&&(u[r]=t.getVariable(d,[n.uuid,"geometry",...c,r]),CC(u[r])&&(u[r]=1))}}let a={parameters:s,type:s.type};if(s.type==="PathGeometry")a.path=s.path;else if(s.type==="VectorGeometry"){let c=vn.createFromState(s.shape,s.width,s.height);a.shape=c}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),a.geometry=new Sd().parse(s),a.geometry.groups.length===0){let c=a.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else if(s.type==="SubdivGeometry"){let c=new Xn(s,e);return c.data=i,c}else if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=N1(s.type);if(c)return c.create(s,t);Jn("text",`a ${s.type}`);let u=vn.createFromState(Fd.defaultData(),100,100);return Mw({...s,shape:u,type:"VectorGeometry"})}else if(s.type==="UIGeometry")return Uf.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}});let l;try{l=Mw(a)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${a}`);let u=vn.createFromState(Fd.defaultData(),100,100);a.shape=u,a.type="VectorGeometry",l=Mw(a)}return l}var dee,Iv=F(()=>{"use strict";pt();X();B2();Qt();_v();lc();Kd();dee=["font"]});var F2,Rv,xV=F(()=>{"use strict";Iv();F2=class{constructor(){this.objects=new Map;this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,n){let r=this.objects.get(t);return r===void 0?(r=this.createObject(t,e,n),this.objects.set(t,r)):r.isShared=!0,r}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let n=this.objects.get(t);if(n&&n.isShared!==!0)return this.objects.delete(t),this.objects.set(e,n),n}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){let n=this.objects.get(t);e===n?this.unreachable.delete(t):!1&&console.warn("Reachable but deleted",t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},Rv=class extends F2{constructor(e){super();this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,n,r){let s=Co(e,n,this.flatShading,r);return s.computeBoundingSphere(),s}}});function TV(i){_w=i}function zf(){return _w}function MV(i){U2=i}function _V(){if(_w==="webgpu"){if(SV!==void 0)return SV;wV||(wV=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(U2===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return U2}function Aw(i,t){return _V().createRootMaterial(i,t)}function V2(i,t,e){return _V().createSharedMaterial(i,t,e)}function z2(i){return i.getLayersOfType===void 0&&Object.assign(i,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),i}function CV(i){AV=i}function PV(){let i=_w==="webgpu"&&EV!==void 0?EV:AV;return i===void 0?null:z2(i())}function Cw(){return hee}function IV(i){k2=i}function RV(i,t){return k2===void 0?!1:k2(i,t)}var _w,SV,U2,wV,EV,AV,hee,k2,uc=F(()=>{_w="webgl",wV=!1});var OV,DV=F(()=>{"use strict";OV={markNeedsUpdateRendererDirty:()=>{}}});function Xa(i,t){let e=0;if(!i.layers||i.layers.length===0)return!1;let n=i.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(t.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of i.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let o of r.data.colors)if(o[3]<1){s=o[3];break}}else if(s===1&&r.data.type==="noise"){let o=t.color(r.data.colorA).a,a=t.color(r.data.colorB).a,l=t.color(r.data.colorC).a,c=t.color(r.data.colorD).a,u=Math.min(o,Math.min(a,Math.min(l,c)));u<1&&(s=u)}e+=(1-e)*s}}return e<1}var Pw=F(()=>{"use strict"});function G2(i){let t=typeof i=="string"?i:i.type;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function ca(i){return typeof i=="string"||typeof i=="number"&&i!==0}var Po,Qe,Gf,LV,Ya=F(()=>{"use strict";Po=(i,t,e)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof i=="number"?i*100:i,e)??100)/100))??1,Qe=(i,t,e)=>typeof i=="number"?i:t.getVariable(i,e);Gf={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},LV={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}});var j2,pee,Yr,Zd=F(()=>{"use strict";X();Sf();j2=class extends xf(Zt){},pee=i=>i.type==="Mesh",Yr=class extends j2{constructor(e){super();this.object=e;this.isClone=!0;this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,n){}expand(){let e=0,n=this.object.entityChildren(e);for(;n;){let r=this.children[e];r?.object!==n&&(r&&this.remove(r),r=new Yr(n),this.add(r),this.children.splice(e,0,this.children.pop()),r.matrixWorldNeedsUpdate=!0,r.matrixAutoUpdate=!1,r.matrix=n.matrix,r.hiddenMatrix=n.hiddenMatrix,r.pivotMatrix=n.pivotMatrix),r.expand(),e+=1,n=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let e=this.object.cloner;return e!==void 0&&this.parent===e&&(e.instancingActive||e.insideBoolean)?!1:this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return pee(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}}});function FV(i){NV=i}function H2(){return NV}function UV(i){BV=i}function kV(){return BV}var NV,BV,Iw=F(()=>{"use strict";NV=null,BV=null});function Rw(i){return"variable_"+i}var VV,zV,GV,gee,jV,W2,q2,Eu,r_e,Ow=F(()=>{"use strict";pt();VP();WP();rw();Ao();sw();ow();xV();uc();jP();DV();Pw();Ya();Xi();Zd();on();X();Iw();Qt();VV=new ne,zV=new M,GV=new qe,gee=new M,jV=new qt,W2=class extends tw{constructor(e){super();this.shared=e}create(e){return new Cf(e,this.shared)}},q2=class{constructor(t,e={},n=!0,r=!1){this.data=t;this.needsJitter=n;this.enableLocalStorageForPersistentVariables=r;this.geometryCache=new Rv(!0);this.geometryCache2=new Rv(!1);this.imageHolderCache=new W2(this);this.thisContext={scene:OV,shared:this};this.deletedImage=new Ys(E1.emptyImage,this);this.deletedVideo=new Ys(Xp.defaultVideo,this);this.materials={};this.images={};this.uiBuffers={};this.videos={};this.colors={};this.audios={};this.particles={};this.fonts={};this.variables={};this.userAPIs={};this.userWebhooks={};this.mouseProperty=null;this.raycastProperty=null;this.requestRender=()=>{this._requestRender&&this._requestRender()};this.transientGeometryKeys=new WeakSet;if(e.images)for(let[s,o]of Object.entries(e.images))this.addImage(s,o);if(e.videos)for(let[s,o]of Object.entries(e.videos))this.addVideo(s,o);if(e.audios)for(let[s,o]of Object.entries(e.audios))this.addAudio(s,o);if(e.particles)for(let[s,o]of Object.entries(e.particles))this.addParticle(s,o);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=V2(An.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,n=!1){this.data=t,this.resetLib(t.lib);for(let{id:r,data:s}of t.variables)this.addVariableHolder(r,s),e&&this.updateVariableHolder(r,s);for(let[r,s]of Object.entries(t.userAPIs??{}))this.addUserAPI(r,s);for(let[r,s]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(r,s);if(!n){for(let[r,s]of Object.entries(t.images))this.addImage(r,s);for(let[r,s]of Object.entries(t.videos))this.addVideo(r,s)}for(let[r,s]of Object.entries(t.colors))this.addColor(r,s);for(let[r,s]of Object.entries(t.lib.materials))this.addMaterial(r,s.asset);for(let[r,s]of Object.entries(t.materials))this.addMaterial(r,s);for(let[r,s]of Object.entries(t.audios))this.addAudio(r,s);for(let[r,s]of Object.entries(t.particles))this.addParticle(r,s);for(let[r,s]of Object.entries(t.fonts))this.addFont(r,s)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:An.defaultTwoLayerData("phong").layers}),this.materials[t]){let n=this.materials[t];n.reset(e,this.thisContext),n.dispose()}else{let n=V2(e,this.thisContext,t);this.materials[t]=n}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){let e=this.materials[t];return e}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:An.defaultTwoLayerData("phong").layers}),Aw(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Ys(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Ys(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Ys(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new oc(e.r,e.g,e.b,e.a):this.colors[t]=new oc(e.r,e.g,e.b,1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let n=this.colors[t];return this.colors[t].r=e.r??n.r,this.colors[t].g=e.g??n.g,this.colors[t].b=e.b??n.b,this.colors[t].a=e.a??n.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t=="string"){let n=this.getColor(t);n?e=n:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new yn(0,0,0,0))}else return"a"in t?new yn(t.r,t.g,t.b,t.a):new yn(t.r,t.g,t.b,1);return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof ac)return e;{let n=new ac({src:e.data});return this.audios[t]=n,n}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof ac&&e.dispose(),delete this.audios[t])}addFont(t,e){let n=bk();if(n===null){Jn("text","a font asset");return}this.fonts[t]=new n(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof ac&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let n=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let r=localStorage.getItem(Rw(t));n=r!==null?JSON.parse(r):e.value}return this.variables[t]={value:n,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(Rw(t),JSON.stringify(e));let n=e;for(;typeof n=="string";)n=this.variables[n].value;let r=this.entityOpContext.scene,s=!1;for(let o=this.variables[t].locations.length-1;o>=0;o--){let a=this.variables[t].locations[o];if(a[0]==="material"){let l=a[1],c=n,u={scene:r,shared:this},d=a.slice(2);r.traverseMaterial(p=>{let f=p.root??p;f.uuid===l&&f.onVariableUpdate(d,c,u)});let h=this.materials[l];h&&h.onVariableUpdate(d,c,u)}else{let l=r.find(a[0]);if(l===void 0){this.variables[t].locations.splice(o,1);continue}if(s=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let c=1;c<a.length-1;c++)l=l[a[c]];a[1]==="rotation"?l[a[a.length-1]]=n*xe.DEG2RAD:l[a[a.length-1]]=n}if(l=r.find(a[0]),l.type==="ParticleEmitter"&&l.updateVariableState(n,a),Ot.is(l))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")l.onVariableUpdate();else if(a[1]==="geometry"){let c=l;l.component&&(c=l.component);let u=c.dataPatched;c.chooseGeoemtryCache(this).forceDelete(u.geometry),c.createGeometryDelayed(this.entityOpContext),c.onVariableUpdate(!0),c.invalidateDownstreamBooleanData(),c.instances.forEach(d=>{let h=d.dataPatched;d.chooseGeoemtryCache(this).forceDelete(h.geometry),d.createGeometryDelayed(this.entityOpContext),d.onVariableUpdate(!0),d.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&l.updateMorphInfluences(a[2],n)}}return s&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||typeof s.type!="string"||s.type==="VectorGeometry"||s.type==="PathGeometry")return!1;let o=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let u of Object.keys(s))a.set(o(u),u);let l={};for(let[u,d]of Object.entries(e??{})){let h=a.get(o(u));if(h===void 0||h==="type"||h==="font"||h==="shape"||h==="path"||h==="data")continue;if(h==="text"){(typeof d=="string"||typeof d=="number")&&(l[h]={textValue:String(d)});continue}let p=s[h];typeof d=="number"&&isFinite(d)&&(typeof p=="number"||typeof p=="string")&&(l[h]=d)}if(Object.keys(l).length===0)return!1;let c={...s,...l};return n.dataPatched={...r,geometry:c},this.transientGeometryKeys.has(s)&&n.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(c),n.createGeometryDelayed(this.entityOpContext),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let r=e.dataPatched?.geometry;return!r||!this.transientGeometryKeys.has(r)?!1:(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(r),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0)}updateEntityGeometryVertices(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||s.type!=="NonParametricGeometry")return!1;let o=e?.vertices;if(o===void 0||typeof o.length!="number"||o.length<9||o.length%3!==0||o.length/3>q2.MAX_TRANSIENT_VERTICES)return!1;let a=o instanceof Float32Array?o:Float32Array.from(o),l=a.length/3,c;if(e.normals!==void 0){if(e.normals.length!==a.length)return!1;c=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}let u;if(e.uvs!==void 0){if(e.uvs.length!==l*2)return!1;u=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}let d;if(e.indices!==void 0){let E=l>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(E.length===0||E.length%3!==0)return!1;for(let T=0;T<E.length;T++)if(E[T]>=l)return!1;d={array:E,itemSize:1,type:E.constructor.name,normalized:!1}}else{let E=s.data,T=E?.index;if(T?.array?.length){let w=(E?.attributes?.position?.array?.length??0)/3;if(l<w){let _=T.array;for(let A=0;A<_.length;A++)if(_[A]>=l)return!1}d=T}}let h=1/0,p=1/0,f=1/0,g=-1/0,m=-1/0,y=-1/0;for(let E=0;E<a.length;E+=3){let T=a[E],w=a[E+1],_=a[E+2];T<h&&(h=T),T>g&&(g=T),w<p&&(p=w),w>m&&(m=w),_<f&&(f=_),_>y&&(y=_)}let v=(E,T)=>({array:E,itemSize:T,type:"Float32Array",normalized:!1}),b={position:v(a,3)};c&&(b.normal=v(c,3)),u&&(b.uv=v(u,2));let x={...s,width:g-h,height:m-p,depth:y-f,data:{attributes:b,...d?{index:d}:{}}},S=this.transientGeometryKeys.has(s);return n.dataPatched={...r,geometry:x},this.transientGeometryKeys.add(x),n.applyTransientGeometryData(this.entityOpContext,S),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let n=t;n.component&&(n=n.component);let r=n.cloner;if(r===void 0)return-1;let s=r.children,o=Math.PI/180,a=!1;if(e===null)for(let l of s)l.transformOverride!==void 0&&(l.transformOverride=void 0,a=!0);else if(Array.isArray(e)){let l=Math.min(e.length,s.length);for(let c=0;c<l;c++){let u=e[c],d=s[c];if(u==null){d.transformOverride!==void 0&&(d.transformOverride=void 0,a=!0);continue}let h=d.transformOverride??{position:[d.position.x,d.position.y,d.position.z],rotation:[d.rotation.x,d.rotation.y,d.rotation.z],scale:[d.scale.x,d.scale.y,d.scale.z]};u.position&&(typeof u.position.x=="number"&&(h.position[0]=u.position.x),typeof u.position.y=="number"&&(h.position[1]=u.position.y),typeof u.position.z=="number"&&(h.position[2]=u.position.z)),u.rotation&&(typeof u.rotation.x=="number"&&(h.rotation[0]=u.rotation.x*o),typeof u.rotation.y=="number"&&(h.rotation[1]=u.rotation.y*o),typeof u.rotation.z=="number"&&(h.rotation[2]=u.rotation.z*o)),u.scale&&(typeof u.scale.x=="number"&&(h.scale[0]=u.scale.x),typeof u.scale.y=="number"&&(h.scale[1]=u.scale.y),typeof u.scale.z=="number"&&(h.scale[2]=u.scale.z)),d.transformOverride=h,d.position.fromArray(h.position),d.rotation.fromArray(h.rotation),d.scale.fromArray(h.scale),d.updateMatrix(),d.hasNonUniformScale&&(d.updateMatrixWorld(),d.updateMatrixWorldRigid())}}else return s.length;return a?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(n),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),s.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let n=t.parent;if(n===null)return;let r=new Yr(t);r.playModeVisible=e.visible!==!1,r.expand(),typeof e.name=="string"&&(r.name=e.name);let s=Math.PI/180;return r.position.copy(t.position),r.rotation.copy(t.rotation),r.scale.copy(t.scale),r.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(r.position.x=e.position.x),typeof e.position.y=="number"&&(r.position.y=e.position.y),typeof e.position.z=="number"&&(r.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(r.rotation.x=e.rotation.x*s),typeof e.rotation.y=="number"&&(r.rotation.y=e.rotation.y*s),typeof e.rotation.z=="number"&&(r.rotation.z=e.rotation.z*s)),e.scale&&(typeof e.scale.x=="number"&&(r.scale.x=e.scale.x),typeof e.scale.y=="number"&&(r.scale.y=e.scale.y),typeof e.scale.z=="number"&&(r.scale.z=e.scale.z)),r.updateMatrix(),n.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let n=t.material;if(!n)return!1;let r=[];for(let u of Array.isArray(n)?n:[n]){let d=u.root??u;d&&Array.isArray(d.layers)&&d.data&&!r.includes(d)&&r.push(d)}if(r.length===0)return!1;let s={scene:this.entityOpContext.scene,shared:this},o=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=u=>{if(typeof u=="string"){let d=new yn(1,1,1,1);try{d.set(u)}catch{return null}return{r:d.r,g:d.g,b:d.b,a:void 0}}if(u&&typeof u=="object"&&"r"in u){let d=u;if([d.r,d.g,d.b].some(p=>typeof p!="number"||!isFinite(p)))return null;let h=Math.max(d.r,d.g,d.b)>1?1/255:1;return{r:d.r*h,g:d.g*h,b:d.b*h,a:typeof d.a=="number"?Math.max(0,Math.min(d.a,1)):void 0}}return null},l=(u,d,h)=>{if(!u.hasValue(d))return!1;let p=u.getValue(d);if(!p||typeof p!="object"||!p.isColor)return!1;let f=h.a??(typeof p.a=="number"?p.a:1);return p instanceof oc?u.setValue(d,new yn(h.r,h.g,h.b,f)):typeof p.setRGBA=="function"?p.setRGBA(h.r,h.g,h.b,f):p.setRGB(h.r,h.g,h.b),!0},c=!1;for(let u of r){let d=u.data.layers??[],h=p=>u.layers.find(f=>f.uuid===p);if(e.color!==void 0){let p=a(e.color),f=d.find(m=>m.data.type==="color"),g=f&&h(f.id);if(p&&g&&l(g,"color",p)&&(c=!0,p.a!==void 0)){let m=p.a<1?!0:Xa(u.data,this);u.setTransparent?u.setTransparent(m,s.scene):u.transparent=m}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(u.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),s),c=!0);for(let p of e.layers??[]){if(!p||typeof p!="object")continue;let f=typeof p.id=="string"?d.find(v=>v.id===p.id):typeof p.index=="number"?d[p.index]:typeof p.type=="string"?d.find(v=>v.data.type===p.type):void 0,g=f&&h(f.id);if(!f||!g)continue;let m=Gf[f.data.type]??[],y=Object.keys(f.data);for(let[v,b]of Object.entries(p)){if(v==="id"||v==="index"||v==="type")continue;let x=y.find(E=>E===v)??y.find(E=>o(E)===o(v))??v;if(m.includes(x))continue;let S=a(b);if(S&&l(g,x,S)){c=!0;continue}if(typeof b=="number"&&isFinite(b))u.onVariableUpdate?.(["layer",f.id,x],b,s),c=!0;else if(Array.isArray(b)&&b.length<=3&&b.every(E=>typeof E=="number"&&isFinite(E))){let E=["x","y","z"];b.forEach((T,w)=>{u.onVariableUpdate?.(["layer",f.id,x,E[w]],T,s)}),c=!0}}}}return c&&this.requestRender(),c}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let n=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return n.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&n?.getPhysicsLocalMatrix?.(VV))return VV.decompose(zV,GV,gee),t[1]==="position"?zV[t[2]]:(jV.setFromQuaternion(GV,n.rotation.order),jV[t[2]]*xe.RAD2DEG);for(let r=1;r<t.length;r++)n=n[t[r]];return t[1]==="rotation"&&(n*=xe.RAD2DEG),n}for(let n in this.variables){if(e===void 0)break;let r=this.variables[n],s=r.locations?.findIndex(o=>rr.equal(o,e));s!==void 0&&s!==-1&&r.locations.splice(s,1)}if(typeof t=="string"){let n=t,r=t;do{if(r=n,this.variables[n]===void 0)break;let s=this.variables[n].value;e&&this.variables[r]!==void 0&&this.variables[r].locations.push(e),n=s}while(typeof n=="string");return n}else return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,n]of Object.entries(t.images))this.addImage(e,n.asset);for(let[e,n]of Object.entries(t.audios))this.addAudio(e,n.asset);for(let[e,n]of Object.entries(t.particles))this.addParticle(e,n.asset);for(let[e,n]of Object.entries(t.colors))this.addColor(e,n.asset);for(let[e,n]of Object.entries(t.fonts))this.addFont(e,n.asset);for(let[e,n]of Object.entries(t.videos))this.addVideo(e,n.asset);for(let[e,n]of Object.entries(t.variables))this.addVariableHolder(e,n.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,n){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(Sr.drop(t,2),e.materials[t.path[1]],{shared:this,scene:n});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,n):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let r=e.userAPIs[t.path[1]];if(r){let s=t.type===0&&t.props.debounce===void 0,o=this.getUserAPI(t.path[1]);o!==void 0&&o===this.openAIRealtime?o.update(r):o?.update(r,this,s)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let r=e.userWebhooks[t.path[1]];r&&this.getUserWebhook(t.path[1])?.update(r)}}else t.path[0]==="lib"&&this.updateLibByOp(Sr.drop(t,1),n)}updateFont(t,e,n){if(e.props.url){let r=this.getFont(t),s={...this.data.fonts[t],url:e.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),n.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let n=kV();return n===null?(Jn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=n(e,t,this),!1)}else{let n=H2();return n===null?(Jn("api-services","a user API integration"),!1):(this.userAPIs[t]=n.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let n=H2();return n===null?(Jn("api-services","a user webhook"),!1):(this.userWebhooks[t]=n.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}},Eu=q2;Eu.MAX_TRANSIENT_VERTICES=6e4;r_e=new Eu(as.emptyData())});function Dw(i){return Yd(i)||i?.isTSLNodeMaterial===!0}function HV(i){return JU(i)||i?.isTSLSharedMaterial===!0}var X2=F(()=>{"use strict";Q1()});var Tr,Tu=F(()=>{pt();ii();uc();X2();on();mi();Tr=class extends Kt{setMaterialOverride(e,n){this.materialOverride=z2(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),n.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,n,r){if(super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.syncShadowCatcher(r),Q3(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[s,o]of Object.entries(e.props)){let a=this.material[Number(s)],l=r.shared.material(o);l!==a&&Tr.disposeOneMaterial(a),this.material[Number(s)]=l}else if($t(e.path,["material"])){let s=this.material;!Array.isArray(s)&&typeof s?.updateByOp=="function"&&"material"in n&&typeof n.material!="string"&&s.updateByOp(Sr.drop(e,1),n.material,r)}else if($t(e.path,["materials","*"])&&Array.isArray(this.material)){let s=e.path[1];if("materials"in n&&s<this.material.length){let o=n.materials[s];typeof o!="string"&&this.material[s].updateByOp(Sr.drop(e,2),o,r)}}}get needsAO(){return this.material!==void 0?(Array.isArray(this.material)?this.material[0]:this.material).hasAO:!1}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&!!this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):(this.layers.mask&1<<9)!==0&&this.layers.set(0)}updateState(e,n){super.updateState(e,n),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let r=this.dataPatched;this.syncShapeBlendNodeLayer();let s;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(s={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let o=this.materialOverride!==void 0;!o&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,s),n.scene.markNeedsUpdateRendererDirty()),!o&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(l=>n.shared.material(l).getFlavor(r.flatShading,r.side,r.wireframe)),n.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],n.scene.markNeedsUpdateRendererDirty()));let a=this.data;if(!o&&a.geometry?.type!=="NonParametricGeometry"&&"materials"in a&&a.materials!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(a.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!o&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let l=0;l<this.material.length;l++)this.material[l]=this.material[l].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,s);this.syncShadowCatcher(n)}shadowCatcherActive(){let e=this.dataPatched,n=e.geometry?.type;return e.shadowCatcher===!0&&(n==="RectangleGeometry"||n==="PlaneGeometry")}syncShadowCatcher(e){let n=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let r=PV();if(r===null)return;this.shadowCatcherMaterial=r}this.shadowCatcherMaterial.side=n.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,e.scene.markNeedsUpdateRendererDirty()):"material"in n&&n.material!==void 0&&(this.material=e.shared.material(n.material).getFlavor(n.flatShading,n.side,n.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=n.castShadow,this.receiveShadow=n.receiveShadow)}static disposeOneMaterial(e){Dw(e)&&!HV(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&MS(this.material).forEach(e=>{Tr.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}});var WV,qV,XV,yee,YV,Xt,Yi=F(()=>{"use strict";pt();on();Ow();Tu();X();Iv();Kd();R2();WV=new M,qV=new vt,XV=new vt,yee=new M,YV=new ne,Xt=class extends Tr{constructor(e,n,r){super(e,n);this.data=n;this.isSkinnedMesh=!1;this.localGeometry=void 0,n.bindMode&&n.bindMatrix&&(this.bindMode=n.bindMode,this.bindMatrix=new ne().fromArray(n.bindMatrix),this.bindMatrixInverse=new ne)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof De&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof De?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Eu){let e=this.geometryCreateDeleyed,n=this.chooseGeoemtryCache(e),r=this.dataPatched.geometry;this.geometryCreateDeleyed=n.get(r,e,this),this._geometryCacheKey=r}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return qy.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return qy.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.updateByPatchedOpGeometry(Sr.drop(e,1),n.geometry,r)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,n){this.invalidateDownstreamBooleanData();let r=this.data.geometry.type;if(r==="NonParametricGeometry"||r==="SubdivGeometry"){let s=e;if(this.localGeometry===void 0){let p={...this.data.geometry,...s};this.localGeometry=Co(p,n,this.data.flatShading,this)}let o,a,l;s.scaleBaked?[o,a,l]=s.scaleBaked:{width:o,height:a,depth:l}=s;let c=this.localGeometry.userData,u=typeof o=="number"?o:1,d=typeof a=="number"?a:1,h=typeof l=="number"?l:1;c.sxPrev!==void 0&&Cv(this.localGeometry.attributes,u/c.sxPrev,d/c.syPrev,h/c.szPrev),c.sxPrev=u,c.syPrev=d,c.szPrev=h}else{let s={...this.data.geometry,...e},o=Co(s,n,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&Sw(this.localGeometry,o)?o.dispose():(this.localGeometry?.dispose(),this.localGeometry=o)}}refreshAttachedClonersInteractions(e){for(let n of this.attachedSurfaceCloners)n.update(e)}refreshAttachedCloners(e){for(let n of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(n.object)}refreshAttachedPaths(e){for(let n of this.attachedPaths)e.scene.addPendingCommand(()=>n.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,n,r){let s=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Xn&&this.chooseGeoemtryCache(r.shared).mutateIfUnique(this.geometryCreateDeleyed.data,n)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(n,e.props.scaleBaked),this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)),!s&&e.type===0&&e.path.length===0&&Tw(e.props)&&this.geometryCreateDeleyed instanceof Xn&&this.chooseGeoemtryCache(r.shared).mutateIfUnique(this.geometryCreateDeleyed.data,n)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(n),this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)),!s&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof De&&!(this.geometryCreateDeleyed instanceof Xn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let o=r.shared,a=this.chooseGeoemtryCache(o),l=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===l&&l.isShared!==!0){let u=this.dataPatched.geometry,d=Co(u,o,this.data.flatShading,this);Sw(l,d)?(d.dispose(),l.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,u)):(d.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(u,d),this.geometryCreateDeleyed=d),this._geometryCacheKey=u,s=!0,this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)}}s||(r.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(r)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,n){this.createGeometryDelayed(n)}applyTransientGeometryData(e,n){let r=e.shared,s=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof De&&!(this.geometryCreateDeleyed instanceof Xn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let o=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(o.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let c=Co(s,r,this.data.flatShading,this);Sw(a,c)?(c.dispose(),a.computeBoundingSphere(),o.mutateIfUnique(this._geometryCacheKey,s)):(c.computeBoundingSphere(),o.forceDelete(this._geometryCacheKey),o.adopt(s,c),this.geometryCreateDeleyed=c),this._geometryCacheKey=s,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e);return}}n&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(r).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,n){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,n);let r=e.morphTargetInfluences;if(r){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:s,value:o}}of r)this.updateMorphInfluences(s,n.shared.getVariable(o,[this.uuid,"morphTargetInfluences",s]))}super.updateState(e,n)}updateMorphInfluences(e,n){if(this.morphTargetDictionary===void 0)return;let r=this.morphTargetDictionary[e];r!==void 0&&(this.morphTargetInfluences[r]=n)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;this.is2DType?e.set(0,0,r.depth*.5):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)):r.centerOffset?e.fromArray(r.centerOffset):e.setScalar(0),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,n){this.skeleton=e,this.isSkinnedMesh=!0,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let n=new vt,r=this.geometry.attributes.skinWeight;for(let s=0,o=r.count;s<o;s++){n.fromBufferAttribute(r,s);let a=1/n.manhattanLength();a!==1/0?n.multiplyScalar(a):n.set(1,0,0,0),r.setXYZW(s,n.x,n.y,n.z,n.w)}}boneTransform(e,n){let r=this.skeleton;if(r===void 0)return;let s=this.geometry;qV.fromBufferAttribute(s.attributes.skinIndex,e),XV.fromBufferAttribute(s.attributes.skinWeight,e),WV.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let o=0;o<4;o++){let a=XV.getComponent(o);if(a!==0){let l=qV.getComponent(o);YV.multiplyMatrices(r.bones[l].matrixWorld,r.boneInverses[l]),n.addScaledVector(yee.copy(WV).applyMatrix4(YV),a)}}return n.applyMatrix4(this.bindMatrixInverse)}}});function vee(i){if(i.geometry.attributes.extrudeNormal||!i.geometry.attributes.position||!i.geometry.attributes.normal)return;let t=new Map,e=i.geometry.attributes,n=e.position.array,r=e.normal.array,s=new Float32Array(n.length);for(let o=0;o<n.length;o+=3){let a=`${n[o]}_${n[o+1]}_${n[o+2]}`,l=new M(r[o],r[o+1],r[o+2]);t.has(a)?t.get(a)?.normals.push(l):t.set(a,{normals:[l],result:new M})}t.forEach((o,a)=>{for(let l of o.normals)o.result.add(l);o.result.divideScalar(o.normals.length)});for(let o=0;o<n.length;o+=3){let a=`${n[o]}_${n[o+1]}_${n[o+2]}`,l=t.get(a)?.result;l&&(s[o]=l.x,s[o+1]=l.y,s[o+2]=l.z)}i.geometry.setAttribute("extrudeNormal",new Ve(s,3))}function bee(i){if(i.geometry.attributes.extrudeNormals||!i.geometry.attributes.position)return;let e=i.geometry.attributes.position.array,n=new Float32Array(e.length),r=new M;for(let s=0;s<e.length;s+=3)r.set(e[s],e[s+1],e[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;i.geometry.setAttribute("extrudeNormal",new Ve(n,3))}function $a(i){if(Array.isArray(i.material)){for(let t of i.material)if(t.getLayersOfType("outline").length===0)return}else if(!Yd(i.material)||i.material.getLayersOfType("outline").length===0)return;i instanceof Xt&&i.is2DAndNoDepth?bee(i):vee(i)}function Y2(i){return Math.min(2047,Math.max(1,Math.round(i*2048)))/2048}function Ka(i){if(!i.geometry.attributes.position)return;let t=i.geometry.attributes,e=t.position.array,n=t.randomColor;if(n!==void 0&&n.count*3===e.length)return;let r=new Float32Array(e.length),s=parseInt(i.uuid.replace(/\D/g,"")),o=[Y2(xe.seededRandom(s)),Y2(xe.seededRandom(s+1e4)),Y2(xe.seededRandom(s+2e4))];for(let a=0;a<e.length;a++)r[a]=o[a%3];i.geometry.setAttribute("randomColor",new je(r,3))}var Ov=F(()=>{"use strict";X();Q1();Yi()});function K2(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function See(i,t){let e=i.cloner;return e!==void 0&&e.parent===t?e:void 0}function ZV(i,t,e,n){let r=(t.children.length+1)*16;Nw.length<r&&(Nw=new Float32Array(r));let s=0,o=l=>{l.toArray(Nw,s*16),s++},a=t.parameters.hideBase!==!0;a&&o(n),$V.multiplyMatrices(i.hiddenMatrix,i.matrix);for(let l of t.children)!Ga(l)||l.playModeVisible===!1||(KV.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),$2.multiplyMatrices($V,KV),!(a&&$2.equals(n))&&o($2));try{return s===0?0:$U(e,Nw.subarray(0,s*16))}finally{K1(e)}}var Mu,xee,$V,KV,$2,Nw,_s,Hf=F(()=>{ii();X();dv();Ov();Tu();pr();Mu=new ne,xee=new ne,$V=new ne,KV=new ne,$2=new ne;Nw=new Float32Array(0);_s=class extends Tr{constructor(e,n,r){super(e,n);this.data=n;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.geometry=new De;this.onAfterRender=(e,n,r,s,o,a)=>{super.onAfterRender(e,n,r,s,o,a),this.recomputeBoolean()};this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,n=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let s=0;s<this.children.length;s++){let o=this.children[s];o instanceof _s&&o.dataPatched.visible===!0&&o.recomputeBoolean(e===!0,n)}this.meshSetAddresses=[];for(let s=0;s<this.children.length;s++){let o=this.children[s];if(o instanceof Kt&&o.dataPatched.visible===!0&&o.geometry.attributes.position?.count>0&&o.geometry.drawRange.count>0&&o.booleanMeshSetAddress!==0){Mu.multiplyMatrices(o.hiddenMatrix,o.matrix).multiply(o.pivotMatrix);try{let a=See(o,this);if(o.booleanMeshSetAddress===-1){if((o.geometry.index??o.geometry.getAttribute("position")).count/3<15e5){let l=WU(o.geometry,e===!0,n);o.booleanMeshSetAddress=a===void 0||l===-1?l:ZV(o,a,l,Mu)}if(o.booleanMeshSetAddress===-1)return;a===void 0&&$1(o.booleanMeshSetAddress,Mu),o.booleanMatrixInvOld.copy(Mu).invert(),o.booleanWasTransformed=!1}else o instanceof _s&&o.needsTransformForDownstream===!0?(a===void 0?$1(o.booleanMeshSetAddress,Mu):o.booleanMeshSetAddress=ZV(o,a,o.booleanMeshSetAddress,Mu),o.needsTransformForDownstream=!1):o.booleanWasTransformed===!0&&($1(o.booleanMeshSetAddress,xee.multiplyMatrices(Mu,o.booleanMatrixInvOld)),o.booleanMatrixInvOld.copy(Mu).invert(),o.booleanWasTransformed=!1)}catch(a){console.error(a),o.booleanMeshSetAddress=0,o.geometry.userData.booleanOperationDidFail=!0;continue}if(o.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(o.booleanMeshSetAddress),o.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let s=this.geometry;s.dispose(),this.geometry=new De,this.geometry.userData=s.userData,this.geometry.boundingSphere=s.boundingSphere,this.geometry.setAttribute("position",new Ve([],3))}this.geometry.setDrawRange(0,0);return}if(e===!0)return YU(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new De,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=XU(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(s){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(s)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,$a(this),Ka(this)}dispose(){super.dispose(),this.geometry.dispose()}}});var Wf,qf,Xf=F(()=>{X();Xi();bu();(t=>{function i(e){return Ot.is(e)&&e instanceof Vl}t.is=i})(Wf||(Wf={}));qf=(i,t)=>class extends Mo(i,t){updateState_Light(n,r){if(this.updateState_Entity(n,r),n.color!==void 0&&(this.color=r.shared.color(n.color)),n.intensity!==void 0&&(this.intensity=n.intensity*Math.PI),n.depth!==void 0){let s=this.shadow;s.camera.far=n.depth,s.needsUpdate=!0}n.shadows!==void 0&&(this.castShadow=n.shadows)}}});var As,us,Dv,dc=F(()=>{Hf();ii();bu();As=i=>i instanceof Kt,us=i=>i!==null&&i instanceof _s,Dv=i=>z1.is(i)});function Nee(i,t){try{let e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(i),n=r=>Number(e.find(s=>s.type===r)?.value);return new Date(n("year"),n("month")-1,n("day"),n("hour"),n("minute"),n("second"),i.getMilliseconds())}catch{return new Date(NaN)}}function yi(i,t){return t.color(i)}function eI(i=new Date,t){let e=t.format,n=i.getSeconds(),r=i;t&&t.timeZone!==null&&(r=Nee(new Date,t.timeZone));let s=r.getHours(),o=r.getMinutes(),a;t.format12h24h==="12ampm"&&(a=s>=12?"PM":"AM");let l=s;t.format12h24h!=="24"&&(l=s%12,l===0&&(l=12));let c,u;switch(e){case"HH:mm:ss":c=[l,o,n];break;case"HH:mm":c=[l,o];break;case"HH":c=[l],a=void 0;break;case"mm":c=[o],a=void 0;break;case"ss":c=[n],a=void 0;break;case"year":u=r.getFullYear();break;case"month":u=r.getMonth()+1;break;case"dayOfYear":u=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=r.getDate();break;case"secondOfDay":u=s*60*60+o*60+n;break;default:console.error("Unknown time format",e),u=0;break}return c!==void 0?{textValue:c,suffix:a}:u}var kw=F(()=>{"use strict"});var Kf,oz=F(()=>{"use strict";X();gf();yf();Kf=class extends Va(my){constructor(e,n=15,r=10066329){super(e,n,r);this.object=e;this.added=!1;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,n){za(this.object,Kf.geometryHelper,e,n)}}});function Bee(i,t){i.shadow.camera.right=t/2,i.shadow.camera.left=-t/2,i.shadow.camera.top=t/2,i.shadow.camera.bottom=-t/2,i.shadow.needsUpdate=!0}var hc,Vw=F(()=>{"use strict";X();oz();Xf();hc=class extends qf(uy,Kf){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.top=1250,s.bottom=-1250,s.right=1250,s.left=-1250,s.near=-1e4,s.far=2500;let o=new Gl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Gl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let n=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&Bee(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),n&&this.update()}}});function nI(i){return i instanceof Tr&&i.needsAO&&!Ts(i)&&i.isDecalObject!==!0}function rI(i){let t=i.cloner;if(!(!t||!Array.isArray(t.children)))for(let e of t.children)e?.layers&&(e.layers.mask=i.layers.mask)}function iI(i){return i.getLayersOfType("reflection").filter(t=>t.data.visible).length}function az(i,t){let e={outline:!1,cavity:!1},n=i.layers.mask&tI,r=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),o=iI(t),a=t.getLayersOfType("cavity");return(s.length>0||a.length>0)&&(i.layers.set(8),r.length>0&&i.layers.enable(3),o>0&&i.layers.enable(4),e.outline=s.length>0,e.cavity=a.length>0,Ka(i),$a(i)),r.length===0&&s.length===0&&a.length===0&&o===0&&i.layers.set(0),n&&i.layers.set(9),!n&&nI(i)&&i.layers.enable(5),rI(i),e}function lz(i,t){if(!t.layers)return!1;let e=i.layers.mask&tI,n=!1,r=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),o=iI(t),a=t.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(i.layers.set(3),(s.length>0||a.length>0)&&i.layers.enable(8),o>0&&i.layers.enable(4),n=!0),r.length===0&&s.length===0&&a.length===0&&o===0&&i.layers.set(0),e&&i.layers.set(9),!e&&nI(i)&&i.layers.enable(5),rI(i),n}function cz(i,t){var l;if(!t.layers)return!1;let e=i.layers.mask&tI,n=!1,r=iI(t),s=t.getLayersOfType("transmission").filter(c=>c.data.visible),o=t.getLayersOfType("outline").filter(c=>c.data.visible),a=t.getLayersOfType("cavity").filter(c=>c.data.visible);return r>0&&((l=i.userData).__splinePlanarMirror??(l.__splinePlanarMirror=0),i.layers.set(4),s.length>0&&i.layers.enable(3),(o.length>0||a.length>0)&&i.layers.enable(8),n=!0),r===0&&s.length===0&&o.length===0&&a.length===0&&i.layers.set(0),e&&i.layers.set(9),!e&&nI(i)&&i.layers.enable(5),rI(i),n}function dz(i){let t={outline:!1,cavity:!1},e=n=>{t.outline=t.outline||n.outline,t.cavity=t.cavity||n.cavity};return i.traverseEntity(n=>{if(n instanceof Tr)if(Array.isArray(n.material))for(let r=0;r<n.material.length;r++)e(az(n,n.material[r]));else e(az(n,n.material))}),t}function hz(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Tr)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)lz(e,e.material[n])&&(t=!0);else lz(e,e.material)&&(t=!0)}),t}function pz(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Tr)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)cz(e,e.material[n])&&(t=!0);else cz(e,e.material)&&(t=!0)}),t}function Nv(i,t,e,n=!1){let r=i.cloner;if(r){let s=null;if(i.raycast===Ht.prototype.raycast||i.raycast===Kt.prototype.raycast){let o=i.geometry;o&&(o.boundingSphere===null&&o.computeBoundingSphere(),s=o.boundingSphere)}for(let o of r.children){if(s!==null&&(uz.copy(s).applyMatrix4(o.matrixWorld),!t.ray.intersectsSphere(uz)))continue;let a=Uee.copy(o.matrixWorld).invert(),l=kee.copy(t.ray).applyMatrix4(a),c=i.matrixWorld;l.applyMatrix4(c);let u=Fee;u.set(l.origin,l.direction),u.near=t.near,u.far=t.far,u.layers.mask=t.layers.mask;let d=u.intersectObject(i,!1);d.length>0&&e.push({...d[0],object:n?o:i})}}}var tI,Fee,Uee,kee,uz,sI=F(()=>{"use strict";pr();Ov();ii();Tu();X();tI=1<<9;Fee=new wd,Uee=new ne,kee=new Hi,uz=new nr});var Gw,Bv,fz=F(()=>{"use strict";X();gf();yf();Gw=class extends Va(py){constructor(e,n=6710886){super(e,n);this.object=e;this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,n){za(this.object,Gw.geometryHelper,e,n)}update(){if(this.object!==void 0){let e=Gw._vector,n=this.object.distance?this.object.distance:1e3,r=n*Math.tan(this.object.angle);this.cone.scale.set(r,r,n),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},Bv=Gw;Bv._vector=new M});var mz,gz,yz,pc,jw=F(()=>{"use strict";X();fz();Xf();mz=new M,gz=new M,yz=new qe,pc=class extends qf(ly,Bv){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.fov=xe.RAD2DEG*2*this.angle,s.aspect=1,s.near=100,s.far=2500;let o=new Gl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Gl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),gz.setFromMatrixPosition(this.matrixWorld),yz.setFromRotationMatrix(this.matrixWorld),mz.copy(this.up).applyQuaternion(yz).negate().multiplyScalar(this.distance),this.target.position.copy(gz).add(mz),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});var Cn,Qa=F(()=>{pt();Xs();X();Xi();Ao();kw();ka();Vw();on();uc();X();Tu();dc();sI();jw();Qt();Hf();Cn=class extends Tf(dr){constructor(e,n,r){super();this.data=n;this.bgColor=new yn(1,1,1,1);this.fog=null;this.backupFog=new ld(16777215,.1,2e3);this.fogUseBGColor=!1;this.fogMode="linear";this.fogDensity=Br.getDensity({});this.fogHeightFalloff=Br.getHeightFalloff({});this.fogHeightBase=Br.getHeightBase({});this.isActive=!1;this.skyState=null;this.skyStateVersion=0;this.gradingState=null;this.skyHdriHolder=null;this.aoColor=new Ze;this.penumbraSizeArrayCache=null;if(this.super_Entity(e,n),this.personalCamera=new hn(po,{...Vd.defaultData,...n.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new oy(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),n.uiScene){let s=rv();s===null?Jn("ui-2d","a page's 2D scene"):this.uiScene=new s.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",n.uiScene,{dpr:window.devicePixelRatio,shared:r.shared})}else n.uiFrame&&this.createUICanvas(n.uiFrame,r)}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,n){let r=rv();if(r===null){Jn("ui-2d","a page's UI canvas");return}this.uiCanvas=new r.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,n),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,n){e.color!==void 0&&(this.ambientLight.color=yi(e.color,n)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(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(n=>{n instanceof _s&&n.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof Tr)if(Array.isArray(e.material))for(let n of e.material)n.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let n=this.data.shadow,r=kd.isSoft(n);RV(r,n?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,n){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let r=this.scene;r.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=yi(e.color,n),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Br.getMode(e),this.fogDensity=Br.getDensity(e),this.fogHeightFalloff=Br.getHeightFalloff(e),this.fogHeightBase=Br.getHeightBase(e)}updateSky(e,n){this.skyState=e??null,this.skyStateVersion++;let r=e?.hdri?.image;this.skyHdriHolder=r!=null?n.image(r):null}updateAo(e,n){e.aoColor!==void 0&&(this.aoColor=yi(e.aoColor,n))}updateByOp(e,n,r,s){let o=this.data.uiFrame;super.updateByOp(e,n,r,s);let a=n;$t(e.path,["fog"])?this.updateFog(a.fog,r.shared):$t(e.path,["sky"])?this.updateSky(a.sky,r.shared):$t(e.path,["grading"])?this.gradingState=a.grading??null:$t(e.path,["ao"])?this.updateAo(a.ao,r.shared):$t(e.path,["ambient"])?this.updateAmbientLight(a.ambient,r.shared):$t(e.path,["shadow"])?this.updateShadow(a.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||o!==a.uiFrame)&&this.updateUIFrame(e.props.uiFrame,r)}updateUIFrame(e,n){e?(this.uiCanvas||this.createUICanvas(e,n),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,n){this.updateState_Entity(e,n),e.backgroundColor!==void 0&&this.setBackgroundColor(yi(e.backgroundColor,n.shared)),e.fog!==void 0&&this.updateFog(e.fog,n.shared),e.sky!==void 0&&this.updateSky(e.sky,n.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,n.shared),e.ao!==void 0&&this.updateAo(e.ao,n.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,n){}raycast(e,n){super.raycast(e,n)}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 this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(ls).fill(.5);let e=0,n=0;this.traverseEntity(r=>{if(!r.visible)return!0;r instanceof hc&&r.visible&&e<mf&&(this.penumbraSizeArrayCache[e]=r.data.penumbraSize??.5,e+=1),r instanceof pc&&r.visible&&e<ls-mf&&(this.penumbraSizeArrayCache[mf+n]=r.data.penumbraSize??.5,n+=1)})}raycastWithClones(e){let n=[],r=s=>{for(let o of s.children){let a=o.cloner;Ot.is(o)&&(o.visible||a?.object.data.visible)&&((As(o)||Dv(o)&&this.scene.enableHelpers&&o.objectHelper.visible)&&(e.intersectObject(o,!1,n),Nv(o,e,n,!0)),r(o))}};return r(this),n}updateEntity2DByOp(e,n,r,s){this.uiCanvas?.updateEntity2DByOp(e,n,r,s)}}});function pI(){return Zee}function kz(i){hI=i}function Jw(){if(hI===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return hI}function eE(i){return i?.isWebGPUSplineRenderer===!0}var Zee,hI,fI=F(()=>{"use strict";Zee=null,hI=null});var tl,lE=F(()=>{"use strict";X();Jy();bu();tl=class extends Mo(Bs,xo){constructor(e,n,r){super();this.super_Entity(e,n),this.context=r,this.objectHelper.update()}updateState(e,n){this.updateState_Entity(e,n)}}});var Zz=Fh((bI,Kz)=>{(function(i,t){typeof bI=="object"?Kz.exports=t():typeof define=="function"&&define.amd?define(t):i.Alea=t()})(bI,function(){"use strict";return i.importState=function(e){var n=new i;return n.importState(e),n},i;function i(){return function(e){var n=0,r=0,s=0,o=1;e.length==0&&(e=[+new Date]);var a=t();n=a(" "),r=a(" "),s=a(" ");for(var l=0;l<e.length;l++)n-=a(e[l]),n<0&&(n+=1),r-=a(e[l]),r<0&&(r+=1),s-=a(e[l]),s<0&&(s+=1);a=null;var c=function(){var u=2091639*n+o*23283064365386963e-26;return n=r,r=s,s=u-(o=u|0)};return c.next=c,c.uint32=function(){return c()*4294967296},c.fract53=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.version="Alea 0.9",c.args=e,c.exportState=function(){return[n,r,s,o]},c.importState=function(u){n=+u[0]||0,r=+u[1]||0,s=+u[2]||0,o=+u[3]||0},c}(Array.prototype.slice.call(arguments))}function t(){var e=4022871197,n=function(r){r=r.toString();for(var s=0;s<r.length;s++){e+=r.charCodeAt(s);var o=.02519603282416938*e;e=o>>>0,o-=e,o*=e,e=o>>>0,o-=e,e+=o*4294967296}return(e>>>0)*23283064365386963e-26};return n.version="Mash 0.9",n}})});function nG(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var rl,qv,ha,tm=F(()=>{ii();X();Kd();Ov();Yi();rl=new Nt,qv=new M;ha=class extends Xt{constructor(e,n,r){super(e,n,r);this.data=n;this.hiddenMatrixOld=new ne;this.smoothShading=!0;this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:s,subdivPointer:o}=Xn.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=o,r!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=r),s!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=s??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,$a(this),Ka(this),this.calcBoundingBox(),n&&(this.localGeometry.uuid=n)}updateState(e,n){if(super.updateState(e,n),e.flatShading!==void 0){let r=this.material;this.material=Array.isArray(r)?r.map(s=>s.getFlavor(!1,s.side,s.wireframe)):r.getFlavor(!1,r.side,r.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(n)}}updateMesh(e=!1,n=!1,r=!1){n&&this.subdividedGeometry||Xn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0,r),this.subdividedGeometry&&Xn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let e=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Xn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Xn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,$a(this),Ka(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}raycast(e,n){let r=this.localGeometry;this.localGeometry=this.originalGeometryNew,Kt.prototype.raycast.call(this,e,n),this.localGeometry=r}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;e.boundingSphere===null&&(e.boundingSphere=new nr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let n=e.attributes.position,r=e.boundingSphere.center;rl.setFromBufferAttribute(n),rl.getCenter(r),e.boundingSphere.radius=r.distanceTo(rl.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),rl.getSize(qv),this.hasNonUniformScale&&qv.divide(this.scale);let s={width:qv.x,height:qv.y,depth:qv.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let n=this.originalGeometry;rl.min.set(e[0],e[2],e[4]),rl.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(rl.min.applyMatrix4(this.shearScaleInv),rl.max.applyMatrix4(this.shearScaleInv)),n.boundingSphere===null&&(n.boundingSphere=new nr);let r=n.boundingSphere.center;rl.getCenter(r),n.boundingSphere.radius=r.distanceTo(rl.max)}freeSubdivPointer(){this.subdivPointer&&(Xn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry,r=n?.uuid,s=n?.userData.parameters,o=e.subdivisions>0?Xn.buildRefined(this.subdivPointer,e.subdivisions,this.smoothShading?e.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=o??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,$a(this),Ka(this),s!==void 0&&(this.localGeometry.userData.parameters=s),r&&(this.localGeometry.uuid=r)}updateByPatchedOpGeometry(e,n,r){super.updateByPatchedOpGeometry(e,n,r),this.localGeometry&&(e.type===0&&e.path.length===0&&Tw(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(n):this.createGeometryByControls(n))}}});function Kv(i){if(i.component){let t=i.component.instances.indexOf(i);t>=0&&i.component.instances.splice(t,1);for(let e of i.children)Ot.is(e)&&Kv(e)}}var OI=F(()=>{"use strict";Xi()});var YG=Fh((YOe,XG)=>{"use strict";function Nte(i,t){function e(){this.constructor=i}e.prototype=t.prototype,i.prototype=new e}function oh(i,t,e,n){this.message=i,this.expected=t,this.found=e,this.location=n,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,oh)}Nte(oh,Error);oh.buildMessage=function(i,t){var e={literal:function(c){return'"'+r(c.text)+'"'},class:function(c){var u="",d;for(d=0;d<c.parts.length;d++)u+=c.parts[d]instanceof Array?s(c.parts[d][0])+"-"+s(c.parts[d][1]):s(c.parts[d]);return"["+(c.inverted?"^":"")+u+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function n(c){return c.charCodeAt(0).toString(16).toUpperCase()}function r(c){return c.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(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function s(c){return c.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(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function o(c){return e[c.type](c)}function a(c){var u=new Array(c.length),d,h;for(d=0;d<c.length;d++)u[d]=o(c[d]);if(u.sort(),u.length>0){for(d=1,h=1;d<u.length;d++)u[d-1]!==u[d]&&(u[h]=u[d],h++);u.length=h}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}function l(c){return c?'"'+r(c)+'"':"end of input"}return"Expected "+a(i)+" but "+l(t)+" found."};function Bte(i,t){t=t!==void 0?t:{};var e={},n={svg_path:$},r=$,s=function(R){if(!R)return[];for(var N=[],H=0;H<R.length;H++)N=N.concat.apply(N,R[H]);var V=N[0];return V&&V.code=="m"&&(delete V.relative,V.code="M"),N},o=function(R,N){return st(R,N)},a=/^[Mm]/,l=ue(["M","m"],!1,!1),c=function(R,N,H){var V=dt(R,[N]);return H&&(V=V.concat(dt(R=="M"?"L":"l",H[1]))),V},u=/^[Zz]/,d=ue(["Z","z"],!1,!1),h=function(){return dt("Z")},p=/^[Ll]/,f=ue(["L","l"],!1,!1),g=function(R,N){return dt(R,N)},m=/^[Hh]/,y=ue(["H","h"],!1,!1),v=function(R,N){return dt(R,N.map(function(H){return{x:H}}))},b=/^[Vv]/,x=ue(["V","v"],!1,!1),S=function(R,N){return dt(R,N.map(function(H){return{y:H}}))},E=/^[Cc]/,T=ue(["C","c"],!1,!1),w=function(R,N,H){return{x1:R.x,y1:R.y,x2:N.x,y2:N.y,x:H.x,y:H.y}},_=/^[Ss]/,A=ue(["S","s"],!1,!1),C=function(R,N){return{x2:R.x,y2:R.y,x:N.x,y:N.y}},P=/^[Qq]/,D=ue(["Q","q"],!1,!1),O=function(R,N){return{x1:R.x,y1:R.y,x:N.x,y:N.y}},L=/^[Tt]/,U=ue(["T","t"],!1,!1),G=/^[Aa]/,Y=ue(["A","a"],!1,!1),oe=function(R,N,H,V,K,Ie){return{rx:R,ry:N,xAxisRotation:H,largeArc:V,sweep:K,x:Ie.x,y:Ie.y}},ee=function(R,N){return{x:R,y:N}},J=function(R){return R*1},Q=function(R){return R.join("")*1},re=/^[01]/,me=ue(["0","1"],!1,!1),ve=function(R){return R=="1"},pe=function(){return""},Ee=",",ce=Fe(",",!1),Se=function(R){return R.join("")},Pe=".",Le=Fe(".",!1),ke=/^[eE]/,Ce=ue(["e","E"],!1,!1),le=/^[+\-]/,ye=ue(["+","-"],!1,!1),Te=/^[0-9]/,Ne=ue([["0","9"]],!1,!1),He=function(R){return R.join("")},Me=/^[ \t\n\r]/,Oe=ue([" "," ",`
4134
+ `&&s.push("")):t.getTextWidth(s[s.length-1]+o,i)>r&&(s[s.length-1].length&&s.push(""),t.getTextWidth(s[s.length-1]+o,i)>r&&(o.length===1?(s[s.length-1]+=o,o=""):(s[s.length-1]+=o.slice(0,-1),o=o[o.length-1],s.push(""))));return s[s.length-1]+=o,s}var see,oee,aee,kf,I2=F(()=>{"use strict";mi();pt();$d();X();ff();lc();cc();see=pV().attributes,oee=12,aee=1,kf=class extends De{constructor(e,n){super();this.isTextGeometry=!0;this.charWidths=[];this.charCoords=[];this.wrappedText=[];this.isLowResolution=!1;this.vectorShapes=[];Object.assign(this.attributes,see),this.userData={parameters:e,type:"TextGeometry"};let r=n.getFont(e.font);r?.isLoaded?(this.font=r,this.update(e,n)):this.updateFont(e.font,n).then(()=>{this.update(e,n),n?.requestRender()})}async updateFont(e,n){let r=n.getFont(e);r&&(this.font=r,await r.loadingPromise)}update(e,n){let r=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!r?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:s,height:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,text:u,textTransform:d}=e,h=Er.getDisplayedValue(u),p=d===2?h.toUpperCase():d===3?h.toLowerCase():h,f=lee(e,r,p,n),{shapes:g,charWidths:m,charCoords:y}=r.generateShapes(f,e,n),v=(typeof s=="number"?s:Number(n.getVariable(s)))*.5,b=(typeof o=="number"?o:Number(n.getVariable(o)))*.5,x=g.map(T=>new vn().fromShape(T,!0));this.vectorShapes=x;let S=x.map(T=>Ms.create({shape:T,parameters:{depth:a,extrudeBevelSegments:c,extrudeBevelSize:l,windingRule:a<=0?an.NONZERO:an.ODD,subdivisions:this.isLowResolution&&a>0?aee:oee}})),E=S.length?ia(S):pV();E.translate(-v,b,0),this.dispose(),this.wrappedText=f,this.charCoords=y,this.charWidths=m,this.deleteAttribute("extrudeNormal"),Object.entries(E.attributes).forEach(([T,w])=>{this.setAttribute(T,w)}),this.setIndex(E.index),this.computeBoundingSphere()}clone(){let e=Wr(new De,kf.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([n,r])=>{this.setAttribute(n,r)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,n){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},n)}get text(){return this.userData.parameters.text??""}}});function gV(i){if(fV)return;if(bw)return bw;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.27/build"),s=import("./process.js"),[o,a]=await Promise.all([s,fetch(`${n}/process.wasm`).then(u=>u.arrayBuffer())]),l=o.default,c=await l({wasmBinary:a});mV(c),fV=!0}return bw=t(),bw}var mV,xw,fV,bw,Av=F(()=>{xw=new Promise(i=>{mV=i}),fV=!1});function Sw(i,t){if(Object.keys(i.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let e=Object.keys(i.attributes),n=Object.keys(t.attributes);if(e.length!==n.length)return!1;for(let a of n){let l=i.attributes[a],c=t.attributes[a];if(l===void 0||l.isInterleavedBufferAttribute===!0||c.isInterleavedBufferAttribute===!0||l.itemSize!==c.itemSize||l.normalized!==c.normalized||l.array.constructor!==c.array.constructor||l.array.length!==c.array.length)return!1}let r=i.index,s=t.index;if(r===null!=(s===null))return!1;let o=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let a=r.array.constructor,l=s.array.constructor;if(a!==l){if(a!==Uint32Array||l!==Uint16Array)return!1;o=!0}}if(i.groups.length!==t.groups.length)return!1;for(let a=0;a<t.groups.length;a++){let l=i.groups[a],c=t.groups[a];if(l.start!==c.start||l.count!==c.count||l.materialIndex!==c.materialIndex)return!1}for(let a of n){let l=i.attributes[a],c=t.attributes[a];l.array.set(c.array),l.needsUpdate=!0}if(r!==null&&s!==null){if(o){let a=r.array,l=s.array;for(let c=0,u=l.length;c<u;c++){let d=l[c];a[c]=d===65535?4294967295:d}}else r.array.set(s.array);r.needsUpdate=!0}return i.drawRange.start=t.drawRange.start,i.drawRange.count=t.drawRange.count,i.userData=t.userData,i.boundingBox=null,i.boundingSphere=null,!0}function Cv(i,t,e,n){let r=i.position.array,s=i.normal.array,o=cee.makeScale(t,e,n).invert().elements,a,l,c;for(let u=0,d=r.length;u<d;u+=3)r[u]*=t,r[u+1]*=e,r[u+2]*=n,a=s[u],l=s[u+1],c=s[u+2],s[u]=o[0]*a+o[4]*l+o[8]*c,s[u+1]=o[1]*a+o[5]*l+o[9]*c,s[u+2]=o[2]*a+o[6]*l+o[10]*c;i.position.needsUpdate=!0,i.normal.needsUpdate=!0}var cee,R2=F(()=>{"use strict";X();cee=new ne});function Tw(i){let t=Object.keys(i);return t.length===1&&t[0]==="subdivisions"}function Pv(i,t){let e=t?t.count:i.count,n=0,r=1e4,s=new Map,o=new Uint32Array(e),a=[];for(let u=0;u<e;u++){let d=t?t.getX(u):u,h=i.getX(d),p=i.getY(d),f=i.getZ(d),g=Math.round(h*r),m=Math.round(p*r),y=Math.round(f*r),v=s.get(g);v===void 0&&(v=new Map,s.set(g,v));let b=v.get(m);b===void 0&&(b=new Map,v.set(m,b));let x=b.get(y);x===void 0&&(x=n++,b.set(y,x),a.push(h,p,f)),o[u]=x}let l=[],c=[];for(let u=0;u<o.length;u+=3)o[u]===o[u+1]||o[u]===o[u+2]||o[u+1]===o[u+2]||(l.push(o[u],o[u+1],o[u+2]),c.push(t?t.getX(u):u,t?t.getX(u+1):u+1,t?t.getX(u+2):u+2));return{positions:a,triIndices:l,triOriginals:c}}function uee(i,t,e,n,r){let s=[],o=[],a=r?e.getAttribute("uv"):void 0,l=a&&a.itemSize===2?[]:void 0,c=h=>{if(l){let p=r[h];l.push(a.getX(p),a.getY(p))}};if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let h=e.userData.shape.extractShapePointsToFlatArray([]),p=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&p<=24&&p%4===0&&e.userData.parameters.angle>=360){let m=h.length/2/p;h=h.filter((y,v)=>Math.floor(v/2)%m===0)}let f=0;for(let m=0;m<h.length;m+=2)f+=(h[m]-h[(m===0?h.length:m)-2])*(h[m+1]+h[(m===0?h.length:m)-1]);i.length=0;let g=0;if(f<0)for(let m=0;m<h.length;m+=2)i.push(h[m],h[m+1],0),s.push(g++);else for(let m=h.length-2;m>=0;m-=2)i.push(h[m],h[m+1],0),s.push(g++);return o.push(g),{indices:s,verticesPerFace:o}}let u=new Float32Array([e.userData.parameters.depth])[0],d=0;for(;d<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let h=0;if((i[t[d]*3+2]===u||i[t[d]*3+2]===0)&&h++,(i[t[d+1]*3+2]===u||i[t[d+1]*3+2]===0)&&h++,(i[t[d+2]*3+2]===u||i[t[d+2]*3+2]===0)&&h++,h===3)break}if(t[d+1]===t[d+3]&&t[d+2]===t[d+5]||t[d+0]===t[d+3]&&t[d+2]===t[d+4]){Ew.set(i[t[d]*3],i[t[d]*3+1],i[t[d]*3+2]),O2.set(i[t[d+1]*3],i[t[d+1]*3+1],i[t[d+1]*3+2]),D2.set(i[t[d+4]*3],i[t[d+4]*3+1],i[t[d+4]*3+2]),L2.set(i[t[d+5]*3],i[t[d+5]*3+1],i[t[d+5]*3+2]),O2.sub(Ew).normalize(),D2.sub(Ew).normalize(),L2.sub(Ew).normalize();let h=O2.cross(D2).dot(L2),p=d;Math.abs(h)>.005||n&&n.some((f,g)=>g%2===1?!1:p>=n[g]&&p<n[g+1])?(s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),o.push(3),d+=3):(s.push(t[d],t[d+1],t[d+4],t[d+5]),c(d),c(d+1),c(d+4),c(d+5),o.push(4),d+=6)}else s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),o.push(3),d+=3}if(e.useNgonForTopBottomFaceDuringBake){let h=[],p=[],f=0;for(let g=0,m=0;g<i.length;g+=3,m++)i[g+2]===0&&(h.push(m),f++),i[g+2]===u&&p.push(m);if(e.userData.parameters.extrudeBevelSize===0){let g=p[0];p[0]=p[1],p[1]=g}h.reverse(),s.push(...h,...p),o.push(f,f),l=void 0}return{indices:s,verticesPerFace:o,uvs:l}}var ww,Vf,gt,yV,vV,bV,Xn,Ew,O2,D2,L2,Kd=F(()=>{"use strict";X();Av();pt();Iv();R2();_f();ww=new Nt,Vf=new M;xw.then(i=>{gt=i});yV=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),vV=new Uint32Array([0,1,2,3]),bV=new Uint8Array([4]),Xn=class extends De{constructor(e,n){super();this.data=e;this.flatShading=n;this.subdivPointer=0;this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,n){this.freeSubdivPointer();let r=this.data.scaleBaked.map(l=>typeof l=="number"?l:1),s=ho.div(n.map(l=>typeof l=="number"?l:0),r);if(s.every(l=>l===1))return;this.subdividedGeometry&&Cv(this.subdividedGeometry.attributes,...s),this.originalGeometry&&Cv(this.originalGeometry.attributes,...s),this.data=e;let o=this.userData.parameters;this.userData.parameters={width:o.width*s[0],height:o.height*s[1],depth:o.depth*s[2]},this.originalGeometry.boundingSphere.center.multiply(Vf.fromArray(s));let a=Vf.set(o.width,o.height,o.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let n=e.phongAngle??35;this.flatShading&&(n=-1);let r=null;if(e.subdivisions>0){let o=0;try{o=Xn.allocate(e),r=Xn.buildRefined(o,e.subdivisions,n)}catch(a){console.error(a,e)}finally{o&&Xn.freeSubdivPointer(o)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let s=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=s}rebuild(){let e,n,r;try{({originalGeometry:e,subdividedGeometry:n,subdivPointer:r}=Xn.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new ni(100,100,100),r=0}this.subdivPointer=r,this.originalGeometry=e,this.subdividedGeometry=n??void 0;let s=this.subdividedGeometry??this.originalGeometry;Object.assign(this,s),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Xn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new nr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let n=e.attributes.position,r=e.boundingSphere.center;ww.setFromBufferAttribute(n),ww.getCenter(r),e.boundingSphere.radius=r.distanceTo(ww.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ww.getSize(Vf);let s={width:Vf.x,height:Vf.y,depth:Vf.z};return this.userData.parameters=s,s}static build(e,n,r,s){let o,a,l=e?.phongAngle??35;r===!1&&(l=-1),n&&(gt.free_bvh(n),gt.free_subdivision_surface(n));try{o=Xn.allocate(e,s)}catch(u){console.error(u,e),o=Xn.allocate({positionWASM:yV,indexWASM:vV,verticesPerFaceWASM:bV},s)}gt.set_destination_refinement_level(o,0);let c=Xn.buildLevel(o,!0,l);return e.subdivisions>0?a=Xn.buildRefined(o,e.subdivisions,l):a=null,{subdivPointer:o,originalGeometry:c,subdividedGeometry:a}}static buildRefined(e,n,r){try{return gt.set_destination_refinement_level(e,n),Xn.buildLevel(e,!1,r)??null}catch{try{return gt.set_destination_refinement_level(e,n-1),Xn.buildLevel(e,!1,r)??null}catch{return null}}}static primitiveToQuads(e,n,r){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let s=e.shape!==void 0||e.path!==void 0?n.geometry:Co(e,r,!1,n),o;W1(e)?o=s.getClosedTorusIndicesForBooleanOrSubdiv():o=s.getIndex();let{positions:a,triIndices:l,triOriginals:c}=Pv(s.getAttribute("position"),o),u;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let f=e.radialSegments*e.heightSegments*3*2,g=f+e.radialSegments*3;u=[f,g]}let{indices:d,verticesPerFace:h,uvs:p}=uee(a,l,s,u,c);return{positions:a,indices:d,verticesPerFace:h,uvs:p}}static allocate(e,n){let r,s,o,a=[],l=[];e.positionWASM&&e.positionWASM.length>0?(r=e.positionWASM,s=e.indexWASM,o=e.verticesPerFaceWASM,gt.alloc_subdivision_surface_uvs&&e.uvWASM&&e.uvWASM.length===s.length*2&&(l=e.uvWASM)):(r=yV,s=vV,o=bV);let c=r.length,u=s.length,d=o.length,h=r.length+a.length+l.length,p=s.length+o.length,f=h*Float32Array.BYTES_PER_ELEMENT+p*Uint32Array.BYTES_PER_ELEMENT,g=h*Float32Array.BYTES_PER_ELEMENT,m=gt._malloc(f),y=new Float32Array(gt.HEAPF32.buffer,m,h),v=new Uint32Array(gt.HEAPU32.buffer,m+g,p);y.set(r,0),y.set(a,r.length),y.set(l,r.length+a.length),v.set(s,0),v.set(o,s.length);let b;e?.scaleBaked?.some(E=>E!==1)&&(b=new ne().makeScale(...e.scaleBaked.map(E=>typeof E=="number"?E:1))),n&&(b?b.premultiply(n):b=n);let x=m+(r.length+a.length)*Float32Array.BYTES_PER_ELEMENT,S=l.length?b?gt.alloc_subdivision_surface_uvs2(m,c,m+g,u,m+g+s.length*Uint32Array.BYTES_PER_ELEMENT,d,x,l.length,b.elements):gt.alloc_subdivision_surface_uvs(m,c,m+g,u,m+g+s.length*Uint32Array.BYTES_PER_ELEMENT,d,x,l.length):b?gt.alloc_subdivision_surface2(m,c,m+g,u,m+g+s.length*Uint32Array.BYTES_PER_ELEMENT,d,b.elements):gt.alloc_subdivision_surface(m,c,m+g,u,m+g+s.length*Uint32Array.BYTES_PER_ELEMENT,d);return gt._free(m),S}static buildLevel(e,n,r,s,o,a=!1){let l=o?gt.get_mesh_data2(e,n?gt.Level.CONTROL:gt.Level.REFINED,r,o.elements):gt.get_mesh_data(e,n?gt.Level.CONTROL:gt.Level.REFINED,r),c=10,u=gt.HEAPU32.subarray(l>>2,(l>>2)+c),d=u.subarray(4,4+4),h=0,p=gt.HEAPU32[u[h]>>2],f=gt.HEAPF32.subarray(p>>2,(p>>2)+d[h]);h++;let g=gt.HEAPU32[u[h]>>2],m=gt.HEAPF32.subarray(g>>2,(g>>2)+d[h]);h++;let y=gt.HEAPU32[u[h]>>2],v=gt.HEAPU32.subarray(y>>2,(y>>2)+d[h]);h++;let b=gt.HEAPU32[u[h]>>2],x=gt.HEAPU32.subarray(b>>2,(b>>2)+d[h]);h++;let S;if(gt.alloc_subdivision_surface_uvs){let T=u[9];if(T>0){let w=gt.HEAPU32[u[8]>>2];S=gt.HEAPF32.subarray(w>>2,(w>>2)+T)}}if(s===void 0){let T=new De;if(T.setIndex(new Us(x,1)),T.setAttribute("position",new Ve(f,3)),T.setAttribute("normal",new Ve(m,3)),S&&T.setAttribute("uv",new Ve(S,2)),n){T.setAttribute("faceMap",new Us(v,1));let w=new Float32Array(m.length/3*4).fill(0);T.setAttribute("color",new je(w,4))}return gt.free_mesh_data(l),T.userData.type="SubdivGeometry",T}if(s.getAttribute("position").copyArray(f),s.getAttribute("normal").copyArray(m),s.attributes.position.needsUpdate=!0,s.attributes.normal.needsUpdate=!0,a){let T=s.getIndex();T!==null&&T.array.length===x.length&&(T.copyArray(x),T.needsUpdate=!0)}let E=s.getAttribute("uv");S&&E&&E.array.length===S.length&&(E.copyArray(S),E.needsUpdate=!0),gt.free_mesh_data(l)}static freeSubdivPointer(e){gt.free_bvh(e),gt.free_subdivision_surface(e)}static buildControlCageWireframe(e,n,r){let s=gt.get_wireframe_data_for_base_level(e),o=4,a=gt.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+2),c=0,u=gt.HEAPU32[a[c]>>2],d=gt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let h=gt.HEAPU32[a[c]>>2],p=gt.HEAPU32.subarray(h>>2,(h>>2)+l[c]);if(n===void 0){let f=new De;f.setAttribute("position",new Ve(d,3));let g=new Float32Array(d.length);for(let m=0,y=d.length;m<y;)g[m++]=r.r,g[m++]=r.g,g[m++]=r.b;return f.setAttribute("color",new je(g,3)),f.setIndex(new Us(p,1)),gt.free_wireframe_data_for_base_level(s),f}n.getAttribute("position").copyArray(d),n.attributes.position.needsUpdate=!0,gt.free_wireframe_data_for_base_level(s)}static updateCollabMesh(e,n,r){let s=n===0;s||gt.set_destination_refinement_level(e,n);let o=r?gt.get_topological_data2(e,s?gt.Level.CONTROL:gt.Level.REFINED,r.elements):gt.get_topological_data(e,s?gt.Level.CONTROL:gt.Level.REFINED),a=8,l=gt.HEAPU32.subarray(o>>2,(o>>2)+a),c=l.subarray(3,3+3),u=0,d=gt.HEAPU32[l[u]>>2],h=new Float32Array(gt.HEAPF32.subarray(d>>2,(d>>2)+c[u]));u++;let p=gt.HEAPU32[l[u]>>2],f=new Uint32Array(gt.HEAPU32.subarray(p>>2,(p>>2)+c[u]));u++;let g=gt.HEAPU32[l[u]>>2],m=new Uint8Array(gt.HEAPU32.subarray(g>>2,(g>>2)+c[u])),y;if(gt.alloc_subdivision_surface_uvs){let v=l[7];if(v>0){let b=gt.HEAPU32[l[6]>>2];y=new Float32Array(gt.HEAPF32.subarray(b>>2,(b>>2)+v))}}return gt.free_topological_data(o),{positions:h,indices:f,verticesPerFace:m,uvs:y}}};Ew=new M,O2=new M,D2=new M,L2=new M});var N2,Mw,B2=F(()=>{"use strict";YP();ZP();mv();JP();Ev();_f();m2();g2();v2();gw();S2();_v();w2();E2();M2();vw();_2();A2();C2();P2();cc();Qt();YP();ZP();mv();JP();Ev();dV();_f();m2();g2();v2();gw();S2();_v();w2();E2();M2();vw();_2();A2();C2();P2();cc();hV();f2();I2();Kd();Av();dv();N2={ConeGeometry:Sk,CubeGeometry:wk,CylinderGeometry:aw,DodecahedronGeometry:Ek,EllipseGeometry:Bf,HelixGeometry:GU,IcosahedronGeometry:Jk,LatheGeometry:eV,NonParametricGeometry:nV,PolygonGeometry:mw,PyramidGeometry:rV,RectangleGeometry:Uf,SphereGeometry:iV,PlaneGeometry:sV,BackdropGeometry:oV,StarGeometry:yw,TextFrameGeometry:aV,TorusGeometry:lV,TorusKnotGeometry:cV,TriangleGeometry:uV,VectorGeometry:Ms},Mw=i=>{let t=N2[i.type]??N1(i.type);if(t===void 0)throw new Error(`No geometry factory registered for "${i.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(i)}});function Co(i,t,e,n){let r,s,o;i.type==="PathGeometry"?(s=JSON.parse(JSON.stringify(i)),o=[[],["extrusion"]]):(s={...i},o=[[]]);for(let c of o){let u=s;for(let d of c)u=u[d];for(r in u){let d=u[r];CC(d)&&!dee.includes(r)&&(u[r]=t.getVariable(d,[n.uuid,"geometry",...c,r]),CC(u[r])&&(u[r]=1))}}let a={parameters:s,type:s.type};if(s.type==="PathGeometry")a.path=s.path;else if(s.type==="VectorGeometry"){let c=vn.createFromState(s.shape,s.width,s.height);a.shape=c}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),a.geometry=new Sd().parse(s),a.geometry.groups.length===0){let c=a.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else if(s.type==="SubdivGeometry"){let c=new Xn(s,e);return c.data=i,c}else if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=N1(s.type);if(c)return c.create(s,t);Jn("text",`a ${s.type}`);let u=vn.createFromState(Fd.defaultData(),100,100);return Mw({...s,shape:u,type:"VectorGeometry"})}else if(s.type==="UIGeometry")return Uf.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}});let l;try{l=Mw(a)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${a}`);let u=vn.createFromState(Fd.defaultData(),100,100);a.shape=u,a.type="VectorGeometry",l=Mw(a)}return l}var dee,Iv=F(()=>{"use strict";pt();X();B2();Qt();_v();lc();Kd();dee=["font"]});var F2,Rv,xV=F(()=>{"use strict";Iv();F2=class{constructor(){this.objects=new Map;this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,n){let r=this.objects.get(t);return r===void 0?(r=this.createObject(t,e,n),this.objects.set(t,r)):r.isShared=!0,r}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let n=this.objects.get(t);if(n&&n.isShared!==!0)return this.objects.delete(t),this.objects.set(e,n),n}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){let n=this.objects.get(t);e===n?this.unreachable.delete(t):!1&&console.warn("Reachable but deleted",t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},Rv=class extends F2{constructor(e){super();this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,n,r){let s=Co(e,n,this.flatShading,r);return s.computeBoundingSphere(),s}}});function TV(i){_w=i}function zf(){return _w}function MV(i){U2=i}function _V(){if(_w==="webgpu"){if(SV!==void 0)return SV;wV||(wV=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(U2===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return U2}function Aw(i,t){return _V().createRootMaterial(i,t)}function V2(i,t,e){return _V().createSharedMaterial(i,t,e)}function z2(i){return i.getLayersOfType===void 0&&Object.assign(i,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),i}function CV(i){AV=i}function PV(){let i=_w==="webgpu"&&EV!==void 0?EV:AV;return i===void 0?null:z2(i())}function Cw(){return hee}function IV(i){k2=i}function RV(i,t){return k2===void 0?!1:k2(i,t)}var _w,SV,U2,wV,EV,AV,hee,k2,uc=F(()=>{_w="webgl",wV=!1});var OV,DV=F(()=>{"use strict";OV={markNeedsUpdateRendererDirty:()=>{}}});function Xa(i,t){let e=0;if(!i.layers||i.layers.length===0)return!1;let n=i.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(t.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of i.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let o of r.data.colors)if(o[3]<1){s=o[3];break}}else if(s===1&&r.data.type==="noise"){let o=t.color(r.data.colorA).a,a=t.color(r.data.colorB).a,l=t.color(r.data.colorC).a,c=t.color(r.data.colorD).a,u=Math.min(o,Math.min(a,Math.min(l,c)));u<1&&(s=u)}e+=(1-e)*s}}return e<1}var Pw=F(()=>{"use strict"});function G2(i){let t=typeof i=="string"?i:i.type;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function ca(i){return typeof i=="string"||typeof i=="number"&&i!==0}var Po,Qe,Gf,LV,Ya=F(()=>{"use strict";Po=(i,t,e)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof i=="number"?i*100:i,e)??100)/100))??1,Qe=(i,t,e)=>typeof i=="number"?i:t.getVariable(i,e);Gf={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},LV={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}});var j2,pee,Yr,Zd=F(()=>{"use strict";X();Sf();j2=class extends xf(Zt){},pee=i=>i.type==="Mesh",Yr=class extends j2{constructor(e){super();this.object=e;this.isClone=!0;this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,n){}expand(){let e=0,n=this.object.entityChildren(e);for(;n;){let r=this.children[e];r?.object!==n&&(r&&this.remove(r),r=new Yr(n),this.add(r),this.children.splice(e,0,this.children.pop()),r.matrixWorldNeedsUpdate=!0,r.matrixAutoUpdate=!1,r.matrix=n.matrix,r.hiddenMatrix=n.hiddenMatrix,r.pivotMatrix=n.pivotMatrix),r.expand(),e+=1,n=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let e=this.object.cloner;return e!==void 0&&this.parent===e&&(e.instancingActive||e.insideBoolean)?!1:this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return pee(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}}});function FV(i){NV=i}function H2(){return NV}function UV(i){BV=i}function kV(){return BV}var NV,BV,Iw=F(()=>{"use strict";NV=null,BV=null});function Rw(i){return"variable_"+i}var VV,zV,GV,gee,jV,W2,q2,Eu,r_e,Ow=F(()=>{"use strict";pt();VP();WP();rw();Ao();sw();ow();xV();uc();jP();DV();Pw();Ya();Xi();Zd();on();X();Iw();Qt();VV=new ne,zV=new M,GV=new qe,gee=new M,jV=new qt,W2=class extends tw{constructor(e){super();this.shared=e}create(e){return new Cf(e,this.shared)}},q2=class{constructor(t,e={},n=!0,r=!1){this.data=t;this.needsJitter=n;this.enableLocalStorageForPersistentVariables=r;this.geometryCache=new Rv(!0);this.geometryCache2=new Rv(!1);this.imageHolderCache=new W2(this);this.thisContext={scene:OV,shared:this};this.deletedImage=new Ys(E1.emptyImage,this);this.deletedVideo=new Ys(Xp.defaultVideo,this);this.materials={};this.images={};this.uiBuffers={};this.videos={};this.colors={};this.audios={};this.particles={};this.fonts={};this.variables={};this.userAPIs={};this.userWebhooks={};this.mouseProperty=null;this.raycastProperty=null;this.requestRender=()=>{this._requestRender&&this._requestRender()};this.transientGeometryKeys=new WeakSet;if(e.images)for(let[s,o]of Object.entries(e.images))this.addImage(s,o);if(e.videos)for(let[s,o]of Object.entries(e.videos))this.addVideo(s,o);if(e.audios)for(let[s,o]of Object.entries(e.audios))this.addAudio(s,o);if(e.particles)for(let[s,o]of Object.entries(e.particles))this.addParticle(s,o);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=V2(An.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,n=!1){this.data=t,this.resetLib(t.lib);for(let{id:r,data:s}of t.variables)this.addVariableHolder(r,s),e&&this.updateVariableHolder(r,s);for(let[r,s]of Object.entries(t.userAPIs??{}))this.addUserAPI(r,s);for(let[r,s]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(r,s);if(!n){for(let[r,s]of Object.entries(t.images))this.addImage(r,s);for(let[r,s]of Object.entries(t.videos))this.addVideo(r,s)}for(let[r,s]of Object.entries(t.colors))this.addColor(r,s);for(let[r,s]of Object.entries(t.lib.materials))this.addMaterial(r,s.asset);for(let[r,s]of Object.entries(t.materials))this.addMaterial(r,s);for(let[r,s]of Object.entries(t.audios))this.addAudio(r,s);for(let[r,s]of Object.entries(t.particles))this.addParticle(r,s);for(let[r,s]of Object.entries(t.fonts))this.addFont(r,s)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:An.defaultTwoLayerData("phong").layers}),this.materials[t]){let n=this.materials[t];n.reset(e,this.thisContext),n.dispose()}else{let n=V2(e,this.thisContext,t);this.materials[t]=n}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){let e=this.materials[t];return e}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:An.defaultTwoLayerData("phong").layers}),Aw(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Ys(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Ys(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Ys(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new oc(e.r,e.g,e.b,e.a):this.colors[t]=new oc(e.r,e.g,e.b,1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let n=this.colors[t];return this.colors[t].r=e.r??n.r,this.colors[t].g=e.g??n.g,this.colors[t].b=e.b??n.b,this.colors[t].a=e.a??n.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t=="string"){let n=this.getColor(t);n?e=n:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new yn(0,0,0,0))}else return"a"in t?new yn(t.r,t.g,t.b,t.a):new yn(t.r,t.g,t.b,1);return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof ac)return e;{let n=new ac({src:e.data});return this.audios[t]=n,n}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof ac&&e.dispose(),delete this.audios[t])}addFont(t,e){let n=bk();if(n===null){Jn("text","a font asset");return}this.fonts[t]=new n(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof ac&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let n=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let r=localStorage.getItem(Rw(t));n=r!==null?JSON.parse(r):e.value}return this.variables[t]={value:n,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(Rw(t),JSON.stringify(e));let n=e;for(;typeof n=="string";)n=this.variables[n].value;let r=this.entityOpContext.scene,s=!1;for(let o=this.variables[t].locations.length-1;o>=0;o--){let a=this.variables[t].locations[o];if(a[0]==="material"){let l=a[1],c=n,u={scene:r,shared:this},d=a.slice(2);r.traverseMaterial(p=>{let f=p.root??p;f.uuid===l&&f.onVariableUpdate(d,c,u)});let h=this.materials[l];h&&h.onVariableUpdate(d,c,u)}else{let l=r.find(a[0]);if(l===void 0){this.variables[t].locations.splice(o,1);continue}if(s=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let c=1;c<a.length-1;c++)l=l[a[c]];a[1]==="rotation"?l[a[a.length-1]]=n*xe.DEG2RAD:l[a[a.length-1]]=n}if(l=r.find(a[0]),l.type==="ParticleEmitter"&&l.updateVariableState(n,a),Ot.is(l))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")l.onVariableUpdate();else if(a[1]==="geometry"){let c=l;l.component&&(c=l.component);let u=c.dataPatched;c.chooseGeoemtryCache(this).forceDelete(u.geometry),c.createGeometryDelayed(this.entityOpContext),c.onVariableUpdate(!0),c.invalidateDownstreamBooleanData(),c.instances.forEach(d=>{let h=d.dataPatched;d.chooseGeoemtryCache(this).forceDelete(h.geometry),d.createGeometryDelayed(this.entityOpContext),d.onVariableUpdate(!0),d.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&l.updateMorphInfluences(a[2],n)}}return s&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||typeof s.type!="string"||s.type==="VectorGeometry"||s.type==="PathGeometry")return!1;let o=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let u of Object.keys(s))a.set(o(u),u);let l={};for(let[u,d]of Object.entries(e??{})){let h=a.get(o(u));if(h===void 0||h==="type"||h==="font"||h==="shape"||h==="path"||h==="data")continue;if(h==="text"){(typeof d=="string"||typeof d=="number")&&(l[h]={textValue:String(d)});continue}let p=s[h];typeof d=="number"&&isFinite(d)&&(typeof p=="number"||typeof p=="string")&&(l[h]=d)}if(Object.keys(l).length===0)return!1;let c={...s,...l};return n.dataPatched={...r,geometry:c},this.transientGeometryKeys.has(s)&&n.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(c),n.createGeometryDelayed(this.entityOpContext),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let r=e.dataPatched?.geometry;return!r||!this.transientGeometryKeys.has(r)?!1:(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(r),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0)}updateEntityGeometryVertices(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||s.type!=="NonParametricGeometry")return!1;let o=e?.vertices;if(o===void 0||typeof o.length!="number"||o.length<9||o.length%3!==0||o.length/3>q2.MAX_TRANSIENT_VERTICES)return!1;let a=o instanceof Float32Array?o:Float32Array.from(o),l=a.length/3,c;if(e.normals!==void 0){if(e.normals.length!==a.length)return!1;c=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}let u;if(e.uvs!==void 0){if(e.uvs.length!==l*2)return!1;u=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}let d;if(e.indices!==void 0){let E=l>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(E.length===0||E.length%3!==0)return!1;for(let T=0;T<E.length;T++)if(E[T]>=l)return!1;d={array:E,itemSize:1,type:E.constructor.name,normalized:!1}}else{let E=s.data,T=E?.index;if(T?.array?.length){let w=(E?.attributes?.position?.array?.length??0)/3;if(l<w){let _=T.array;for(let A=0;A<_.length;A++)if(_[A]>=l)return!1}d=T}}let h=1/0,p=1/0,f=1/0,g=-1/0,m=-1/0,y=-1/0;for(let E=0;E<a.length;E+=3){let T=a[E],w=a[E+1],_=a[E+2];T<h&&(h=T),T>g&&(g=T),w<p&&(p=w),w>m&&(m=w),_<f&&(f=_),_>y&&(y=_)}let v=(E,T)=>({array:E,itemSize:T,type:"Float32Array",normalized:!1}),b={position:v(a,3)};c&&(b.normal=v(c,3)),u&&(b.uv=v(u,2));let x={...s,width:g-h,height:m-p,depth:y-f,data:{attributes:b,...d?{index:d}:{}}},S=this.transientGeometryKeys.has(s);return n.dataPatched={...r,geometry:x},this.transientGeometryKeys.add(x),n.applyTransientGeometryData(this.entityOpContext,S),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let n=t;n.component&&(n=n.component);let r=n.cloner;if(r===void 0)return-1;let s=r.children,o=Math.PI/180,a=!1;if(e===null)for(let l of s)l.transformOverride!==void 0&&(l.transformOverride=void 0,a=!0);else if(Array.isArray(e)){let l=Math.min(e.length,s.length);for(let c=0;c<l;c++){let u=e[c],d=s[c];if(u==null){d.transformOverride!==void 0&&(d.transformOverride=void 0,a=!0);continue}let h=d.transformOverride??{position:[d.position.x,d.position.y,d.position.z],rotation:[d.rotation.x,d.rotation.y,d.rotation.z],scale:[d.scale.x,d.scale.y,d.scale.z]};u.position&&(typeof u.position.x=="number"&&(h.position[0]=u.position.x),typeof u.position.y=="number"&&(h.position[1]=u.position.y),typeof u.position.z=="number"&&(h.position[2]=u.position.z)),u.rotation&&(typeof u.rotation.x=="number"&&(h.rotation[0]=u.rotation.x*o),typeof u.rotation.y=="number"&&(h.rotation[1]=u.rotation.y*o),typeof u.rotation.z=="number"&&(h.rotation[2]=u.rotation.z*o)),u.scale&&(typeof u.scale.x=="number"&&(h.scale[0]=u.scale.x),typeof u.scale.y=="number"&&(h.scale[1]=u.scale.y),typeof u.scale.z=="number"&&(h.scale[2]=u.scale.z)),d.transformOverride=h,d.position.fromArray(h.position),d.rotation.fromArray(h.rotation),d.scale.fromArray(h.scale),d.updateMatrix(),d.hasNonUniformScale&&(d.updateMatrixWorld(),d.updateMatrixWorldRigid())}}else return s.length;return a?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(n),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),s.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let n=t.parent;if(n===null)return;let r=new Yr(t);r.playModeVisible=e.visible!==!1,r.expand(),typeof e.name=="string"&&(r.name=e.name);let s=Math.PI/180;return r.position.copy(t.position),r.rotation.copy(t.rotation),r.scale.copy(t.scale),r.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(r.position.x=e.position.x),typeof e.position.y=="number"&&(r.position.y=e.position.y),typeof e.position.z=="number"&&(r.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(r.rotation.x=e.rotation.x*s),typeof e.rotation.y=="number"&&(r.rotation.y=e.rotation.y*s),typeof e.rotation.z=="number"&&(r.rotation.z=e.rotation.z*s)),e.scale&&(typeof e.scale.x=="number"&&(r.scale.x=e.scale.x),typeof e.scale.y=="number"&&(r.scale.y=e.scale.y),typeof e.scale.z=="number"&&(r.scale.z=e.scale.z)),r.updateMatrix(),n.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let n=t.material;if(!n)return!1;let r=[];for(let u of Array.isArray(n)?n:[n]){let d=u.root??u;d&&Array.isArray(d.layers)&&d.data&&!r.includes(d)&&r.push(d)}if(r.length===0)return!1;let s={scene:this.entityOpContext.scene,shared:this},o=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=u=>{if(typeof u=="string"){let d=new yn(1,1,1,1);try{d.set(u)}catch{return null}return{r:d.r,g:d.g,b:d.b,a:void 0}}if(u&&typeof u=="object"&&"r"in u){let d=u;if([d.r,d.g,d.b].some(p=>typeof p!="number"||!isFinite(p)))return null;let h=Math.max(d.r,d.g,d.b)>1?1/255:1;return{r:d.r*h,g:d.g*h,b:d.b*h,a:typeof d.a=="number"?Math.max(0,Math.min(d.a,1)):void 0}}return null},l=(u,d,h)=>{if(!u.hasValue(d))return!1;let p=u.getValue(d);if(!p||typeof p!="object"||!p.isColor)return!1;let f=h.a??(typeof p.a=="number"?p.a:1);return p instanceof oc?u.setValue(d,new yn(h.r,h.g,h.b,f)):typeof p.setRGBA=="function"?p.setRGBA(h.r,h.g,h.b,f):p.setRGB(h.r,h.g,h.b),!0},c=!1;for(let u of r){let d=u.data.layers??[],h=p=>u.layers.find(f=>f.uuid===p);if(e.color!==void 0){let p=a(e.color),f=d.find(m=>m.data.type==="color"),g=f&&h(f.id);if(p&&g&&l(g,"color",p)&&(c=!0,p.a!==void 0)){let m=p.a<1?!0:Xa(u.data,this);u.setTransparent?u.setTransparent(m,s.scene):u.transparent=m}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(u.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),s),c=!0);for(let p of e.layers??[]){if(!p||typeof p!="object")continue;let f=typeof p.id=="string"?d.find(v=>v.id===p.id):typeof p.index=="number"?d[p.index]:typeof p.type=="string"?d.find(v=>v.data.type===p.type):void 0,g=f&&h(f.id);if(!f||!g)continue;let m=Gf[f.data.type]??[],y=Object.keys(f.data);for(let[v,b]of Object.entries(p)){if(v==="id"||v==="index"||v==="type")continue;let x=y.find(E=>E===v)??y.find(E=>o(E)===o(v))??v;if(m.includes(x))continue;let S=a(b);if(S&&l(g,x,S)){c=!0;continue}if(typeof b=="number"&&isFinite(b))u.onVariableUpdate?.(["layer",f.id,x],b,s),c=!0;else if(Array.isArray(b)&&b.length<=3&&b.every(E=>typeof E=="number"&&isFinite(E))){let E=["x","y","z"];b.forEach((T,w)=>{u.onVariableUpdate?.(["layer",f.id,x,E[w]],T,s)}),c=!0}}}}return c&&this.requestRender(),c}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let n=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return n.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&n?.getPhysicsLocalMatrix?.(VV))return VV.decompose(zV,GV,gee),t[1]==="position"?zV[t[2]]:(jV.setFromQuaternion(GV,n.rotation.order),jV[t[2]]*xe.RAD2DEG);for(let r=1;r<t.length;r++)n=n[t[r]];return t[1]==="rotation"&&(n*=xe.RAD2DEG),n}for(let n in this.variables){if(e===void 0)break;let r=this.variables[n],s=r.locations?.findIndex(o=>rr.equal(o,e));s!==void 0&&s!==-1&&r.locations.splice(s,1)}if(typeof t=="string"){let n=t,r=t;do{if(r=n,this.variables[n]===void 0)break;let s=this.variables[n].value;e&&this.variables[r]!==void 0&&this.variables[r].locations.push(e),n=s}while(typeof n=="string");return n}else return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,n]of Object.entries(t.images))this.addImage(e,n.asset);for(let[e,n]of Object.entries(t.audios))this.addAudio(e,n.asset);for(let[e,n]of Object.entries(t.particles))this.addParticle(e,n.asset);for(let[e,n]of Object.entries(t.colors))this.addColor(e,n.asset);for(let[e,n]of Object.entries(t.fonts))this.addFont(e,n.asset);for(let[e,n]of Object.entries(t.videos))this.addVideo(e,n.asset);for(let[e,n]of Object.entries(t.variables))this.addVariableHolder(e,n.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,n){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(Sr.drop(t,2),e.materials[t.path[1]],{shared:this,scene:n});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,n):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let r=e.userAPIs[t.path[1]];if(r){let s=t.type===0&&t.props.debounce===void 0,o=this.getUserAPI(t.path[1]);o!==void 0&&o===this.openAIRealtime?o.update(r):o?.update(r,this,s)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let r=e.userWebhooks[t.path[1]];r&&this.getUserWebhook(t.path[1])?.update(r)}}else t.path[0]==="lib"&&this.updateLibByOp(Sr.drop(t,1),n)}updateFont(t,e,n){if(e.props.url){let r=this.getFont(t),s={...this.data.fonts[t],url:e.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),n.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let n=kV();return n===null?(Jn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=n(e,t,this),!1)}else{let n=H2();return n===null?(Jn("api-services","a user API integration"),!1):(this.userAPIs[t]=n.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let n=H2();return n===null?(Jn("api-services","a user webhook"),!1):(this.userWebhooks[t]=n.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}},Eu=q2;Eu.MAX_TRANSIENT_VERTICES=6e4;r_e=new Eu(as.emptyData())});function Dw(i){return Yd(i)||i?.isTSLNodeMaterial===!0}function HV(i){return JU(i)||i?.isTSLSharedMaterial===!0}var X2=F(()=>{"use strict";Q1()});var Tr,Tu=F(()=>{pt();ii();uc();X2();on();mi();Tr=class extends Kt{setMaterialOverride(e,n){this.materialOverride=z2(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),n.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,n,r){if(super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.syncShadowCatcher(r),Q3(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[s,o]of Object.entries(e.props)){let a=this.material[Number(s)],l=r.shared.material(o);l!==a&&Tr.disposeOneMaterial(a),this.material[Number(s)]=l}else if($t(e.path,["material"])){let s=this.material;!Array.isArray(s)&&typeof s?.updateByOp=="function"&&"material"in n&&typeof n.material!="string"&&s.updateByOp(Sr.drop(e,1),n.material,r)}else if($t(e.path,["materials","*"])&&Array.isArray(this.material)){let s=e.path[1];if("materials"in n&&s<this.material.length){let o=n.materials[s];typeof o!="string"&&this.material[s].updateByOp(Sr.drop(e,2),o,r)}}}get needsAO(){return this.material!==void 0?(Array.isArray(this.material)?this.material[0]:this.material).hasAO:!1}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&!!this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):(this.layers.mask&1<<9)!==0&&this.layers.set(0)}updateState(e,n){super.updateState(e,n),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let r=this.dataPatched;this.syncShapeBlendNodeLayer();let s;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(s={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let o=this.materialOverride!==void 0;!o&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,s),n.scene.markNeedsUpdateRendererDirty()),!o&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(l=>n.shared.material(l).getFlavor(r.flatShading,r.side,r.wireframe)),n.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],n.scene.markNeedsUpdateRendererDirty()));let a=this.data;if(!o&&a.geometry?.type!=="NonParametricGeometry"&&"materials"in a&&a.materials!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(a.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!o&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let l=0;l<this.material.length;l++)this.material[l]=this.material[l].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,s);this.syncShadowCatcher(n)}shadowCatcherActive(){let e=this.dataPatched,n=e.geometry?.type;return e.shadowCatcher===!0&&(n==="RectangleGeometry"||n==="PlaneGeometry")}syncShadowCatcher(e){let n=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let r=PV();if(r===null)return;this.shadowCatcherMaterial=r}this.shadowCatcherMaterial.side=n.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,e.scene.markNeedsUpdateRendererDirty()):"material"in n&&n.material!==void 0&&(this.material=e.shared.material(n.material).getFlavor(n.flatShading,n.side,n.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=n.castShadow,this.receiveShadow=n.receiveShadow)}static disposeOneMaterial(e){Dw(e)&&!HV(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&MS(this.material).forEach(e=>{Tr.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}});var WV,qV,XV,yee,YV,Xt,Yi=F(()=>{"use strict";pt();on();Ow();Tu();X();Iv();Kd();R2();WV=new M,qV=new vt,XV=new vt,yee=new M,YV=new ne,Xt=class extends Tr{constructor(e,n,r){super(e,n);this.data=n;this.isSkinnedMesh=!1;this.localGeometry=void 0,n.bindMode&&n.bindMatrix&&(this.bindMode=n.bindMode,this.bindMatrix=new ne().fromArray(n.bindMatrix),this.bindMatrixInverse=new ne)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof De&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof De?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Eu){let e=this.geometryCreateDeleyed,n=this.chooseGeoemtryCache(e),r=this.dataPatched.geometry;this.geometryCreateDeleyed=n.get(r,e,this),this._geometryCacheKey=r}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return qy.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return qy.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.updateByPatchedOpGeometry(Sr.drop(e,1),n.geometry,r)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,n){this.invalidateDownstreamBooleanData();let r=this.data.geometry.type;if(r==="NonParametricGeometry"||r==="SubdivGeometry"){let s=e;if(this.localGeometry===void 0){let p={...this.data.geometry,...s};this.localGeometry=Co(p,n,this.data.flatShading,this)}let o,a,l;s.scaleBaked?[o,a,l]=s.scaleBaked:{width:o,height:a,depth:l}=s;let c=this.localGeometry.userData,u=typeof o=="number"?o:1,d=typeof a=="number"?a:1,h=typeof l=="number"?l:1;c.sxPrev!==void 0&&Cv(this.localGeometry.attributes,u/c.sxPrev,d/c.syPrev,h/c.szPrev),c.sxPrev=u,c.syPrev=d,c.szPrev=h}else{let s={...this.data.geometry,...e},o=Co(s,n,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&Sw(this.localGeometry,o)?o.dispose():(this.localGeometry?.dispose(),this.localGeometry=o)}}refreshAttachedClonersInteractions(e){for(let n of this.attachedSurfaceCloners)n.update(e)}refreshAttachedCloners(e){for(let n of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(n.object)}refreshAttachedPaths(e){for(let n of this.attachedPaths)e.scene.addPendingCommand(()=>n.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,n,r){let s=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Xn&&this.chooseGeoemtryCache(r.shared).mutateIfUnique(this.geometryCreateDeleyed.data,n)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(n,e.props.scaleBaked),this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)),!s&&e.type===0&&e.path.length===0&&Tw(e.props)&&this.geometryCreateDeleyed instanceof Xn&&this.chooseGeoemtryCache(r.shared).mutateIfUnique(this.geometryCreateDeleyed.data,n)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(n),this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)),!s&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof De&&!(this.geometryCreateDeleyed instanceof Xn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let o=r.shared,a=this.chooseGeoemtryCache(o),l=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===l&&l.isShared!==!0){let u=this.dataPatched.geometry,d=Co(u,o,this.data.flatShading,this);Sw(l,d)?(d.dispose(),l.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,u)):(d.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(u,d),this.geometryCreateDeleyed=d),this._geometryCacheKey=u,s=!0,this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)}}s||(r.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(r)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,n){this.createGeometryDelayed(n)}applyTransientGeometryData(e,n){let r=e.shared,s=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof De&&!(this.geometryCreateDeleyed instanceof Xn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let o=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(o.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let c=Co(s,r,this.data.flatShading,this);Sw(a,c)?(c.dispose(),a.computeBoundingSphere(),o.mutateIfUnique(this._geometryCacheKey,s)):(c.computeBoundingSphere(),o.forceDelete(this._geometryCacheKey),o.adopt(s,c),this.geometryCreateDeleyed=c),this._geometryCacheKey=s,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e);return}}n&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(r).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,n){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,n);let r=e.morphTargetInfluences;if(r){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:s,value:o}}of r)this.updateMorphInfluences(s,n.shared.getVariable(o,[this.uuid,"morphTargetInfluences",s]))}super.updateState(e,n)}updateMorphInfluences(e,n){if(this.morphTargetDictionary===void 0)return;let r=this.morphTargetDictionary[e];r!==void 0&&(this.morphTargetInfluences[r]=n)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;this.is2DType?e.set(0,0,r.depth*.5):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)):r.centerOffset?e.fromArray(r.centerOffset):e.setScalar(0),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,n){this.skeleton=e,this.isSkinnedMesh=!0,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let n=new vt,r=this.geometry.attributes.skinWeight;for(let s=0,o=r.count;s<o;s++){n.fromBufferAttribute(r,s);let a=1/n.manhattanLength();a!==1/0?n.multiplyScalar(a):n.set(1,0,0,0),r.setXYZW(s,n.x,n.y,n.z,n.w)}}boneTransform(e,n){let r=this.skeleton;if(r===void 0)return;let s=this.geometry;qV.fromBufferAttribute(s.attributes.skinIndex,e),XV.fromBufferAttribute(s.attributes.skinWeight,e),WV.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let o=0;o<4;o++){let a=XV.getComponent(o);if(a!==0){let l=qV.getComponent(o);YV.multiplyMatrices(r.bones[l].matrixWorld,r.boneInverses[l]),n.addScaledVector(yee.copy(WV).applyMatrix4(YV),a)}}return n.applyMatrix4(this.bindMatrixInverse)}}});function vee(i){if(i.geometry.attributes.extrudeNormal||!i.geometry.attributes.position||!i.geometry.attributes.normal)return;let t=new Map,e=i.geometry.attributes,n=e.position.array,r=e.normal.array,s=new Float32Array(n.length);for(let o=0;o<n.length;o+=3){let a=`${n[o]}_${n[o+1]}_${n[o+2]}`,l=new M(r[o],r[o+1],r[o+2]);t.has(a)?t.get(a)?.normals.push(l):t.set(a,{normals:[l],result:new M})}t.forEach((o,a)=>{for(let l of o.normals)o.result.add(l);o.result.divideScalar(o.normals.length)});for(let o=0;o<n.length;o+=3){let a=`${n[o]}_${n[o+1]}_${n[o+2]}`,l=t.get(a)?.result;l&&(s[o]=l.x,s[o+1]=l.y,s[o+2]=l.z)}i.geometry.setAttribute("extrudeNormal",new Ve(s,3))}function bee(i){if(i.geometry.attributes.extrudeNormals||!i.geometry.attributes.position)return;let e=i.geometry.attributes.position.array,n=new Float32Array(e.length),r=new M;for(let s=0;s<e.length;s+=3)r.set(e[s],e[s+1],e[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;i.geometry.setAttribute("extrudeNormal",new Ve(n,3))}function $a(i){if(Array.isArray(i.material)){for(let t of i.material)if(t.getLayersOfType("outline").length===0)return}else if(!Yd(i.material)||i.material.getLayersOfType("outline").length===0)return;i instanceof Xt&&i.is2DAndNoDepth?bee(i):vee(i)}function Y2(i){return Math.min(2047,Math.max(1,Math.round(i*2048)))/2048}function Ka(i){if(!i.geometry.attributes.position)return;let t=i.geometry.attributes,e=t.position.array,n=t.randomColor;if(n!==void 0&&n.count*3===e.length)return;let r=new Float32Array(e.length),s=parseInt(i.uuid.replace(/\D/g,"")),o=[Y2(xe.seededRandom(s)),Y2(xe.seededRandom(s+1e4)),Y2(xe.seededRandom(s+2e4))];for(let a=0;a<e.length;a++)r[a]=o[a%3];i.geometry.setAttribute("randomColor",new je(r,3))}var Ov=F(()=>{"use strict";X();Q1();Yi()});function K2(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function See(i,t){let e=i.cloner;return e!==void 0&&e.parent===t?e:void 0}function ZV(i,t,e,n){let r=(t.children.length+1)*16;Nw.length<r&&(Nw=new Float32Array(r));let s=0,o=l=>{l.toArray(Nw,s*16),s++},a=t.parameters.hideBase!==!0;a&&o(n),$V.multiplyMatrices(i.hiddenMatrix,i.matrix);for(let l of t.children)!Ga(l)||l.playModeVisible===!1||(KV.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),$2.multiplyMatrices($V,KV),!(a&&$2.equals(n))&&o($2));try{return s===0?0:$U(e,Nw.subarray(0,s*16))}finally{K1(e)}}var Mu,xee,$V,KV,$2,Nw,_s,Hf=F(()=>{ii();X();dv();Ov();Tu();pr();Mu=new ne,xee=new ne,$V=new ne,KV=new ne,$2=new ne;Nw=new Float32Array(0);_s=class extends Tr{constructor(e,n,r){super(e,n);this.data=n;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.geometry=new De;this.onAfterRender=(e,n,r,s,o,a)=>{super.onAfterRender(e,n,r,s,o,a),this.recomputeBoolean()};this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,n=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let s=0;s<this.children.length;s++){let o=this.children[s];o instanceof _s&&o.dataPatched.visible===!0&&o.recomputeBoolean(e===!0,n)}this.meshSetAddresses=[];for(let s=0;s<this.children.length;s++){let o=this.children[s];if(o instanceof Kt&&o.dataPatched.visible===!0&&o.geometry.attributes.position?.count>0&&o.geometry.drawRange.count>0&&o.booleanMeshSetAddress!==0){Mu.multiplyMatrices(o.hiddenMatrix,o.matrix).multiply(o.pivotMatrix);try{let a=See(o,this);if(o.booleanMeshSetAddress===-1){if((o.geometry.index??o.geometry.getAttribute("position")).count/3<15e5){let l=WU(o.geometry,e===!0,n);o.booleanMeshSetAddress=a===void 0||l===-1?l:ZV(o,a,l,Mu)}if(o.booleanMeshSetAddress===-1)return;a===void 0&&$1(o.booleanMeshSetAddress,Mu),o.booleanMatrixInvOld.copy(Mu).invert(),o.booleanWasTransformed=!1}else o instanceof _s&&o.needsTransformForDownstream===!0?(a===void 0?$1(o.booleanMeshSetAddress,Mu):o.booleanMeshSetAddress=ZV(o,a,o.booleanMeshSetAddress,Mu),o.needsTransformForDownstream=!1):o.booleanWasTransformed===!0&&($1(o.booleanMeshSetAddress,xee.multiplyMatrices(Mu,o.booleanMatrixInvOld)),o.booleanMatrixInvOld.copy(Mu).invert(),o.booleanWasTransformed=!1)}catch(a){console.error(a),o.booleanMeshSetAddress=0,o.geometry.userData.booleanOperationDidFail=!0;continue}if(o.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(o.booleanMeshSetAddress),o.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let s=this.geometry;s.dispose(),this.geometry=new De,this.geometry.userData=s.userData,this.geometry.boundingSphere=s.boundingSphere,this.geometry.setAttribute("position",new Ve([],3))}this.geometry.setDrawRange(0,0);return}if(e===!0)return YU(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new De,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=XU(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(s){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(s)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,$a(this),Ka(this)}dispose(){super.dispose(),this.geometry.dispose()}}});var Wf,qf,Xf=F(()=>{X();Xi();bu();(t=>{function i(e){return Ot.is(e)&&e instanceof Vl}t.is=i})(Wf||(Wf={}));qf=(i,t)=>class extends Mo(i,t){updateState_Light(n,r){if(this.updateState_Entity(n,r),n.color!==void 0&&(this.color=r.shared.color(n.color)),n.intensity!==void 0&&(this.intensity=n.intensity*Math.PI),n.depth!==void 0){let s=this.shadow;s.camera.far=n.depth,s.needsUpdate=!0}n.shadows!==void 0&&(this.castShadow=n.shadows)}}});var As,us,Dv,dc=F(()=>{Hf();ii();bu();As=i=>i instanceof Kt,us=i=>i!==null&&i instanceof _s,Dv=i=>z1.is(i)});function Nee(i,t){try{let e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(i),n=r=>Number(e.find(s=>s.type===r)?.value);return new Date(n("year"),n("month")-1,n("day"),n("hour"),n("minute"),n("second"),i.getMilliseconds())}catch{return new Date(NaN)}}function yi(i,t){return t.color(i)}function eI(i=new Date,t){let e=t.format,n=i.getSeconds(),r=i;t&&t.timeZone!==null&&(r=Nee(new Date,t.timeZone));let s=r.getHours(),o=r.getMinutes(),a;t.format12h24h==="12ampm"&&(a=s>=12?"PM":"AM");let l=s;t.format12h24h!=="24"&&(l=s%12,l===0&&(l=12));let c,u;switch(e){case"HH:mm:ss":c=[l,o,n];break;case"HH:mm":c=[l,o];break;case"HH":c=[l],a=void 0;break;case"mm":c=[o],a=void 0;break;case"ss":c=[n],a=void 0;break;case"year":u=r.getFullYear();break;case"month":u=r.getMonth()+1;break;case"dayOfYear":u=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=r.getDate();break;case"secondOfDay":u=s*60*60+o*60+n;break;default:console.error("Unknown time format",e),u=0;break}return c!==void 0?{textValue:c,suffix:a}:u}var kw=F(()=>{"use strict"});var Kf,oz=F(()=>{"use strict";X();gf();yf();Kf=class extends Va(my){constructor(e,n=15,r=10066329){super(e,n,r);this.object=e;this.added=!1;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,n){za(this.object,Kf.geometryHelper,e,n)}}});function Bee(i,t){i.shadow.camera.right=t/2,i.shadow.camera.left=-t/2,i.shadow.camera.top=t/2,i.shadow.camera.bottom=-t/2,i.shadow.needsUpdate=!0}var hc,Vw=F(()=>{"use strict";X();oz();Xf();hc=class extends qf(uy,Kf){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.top=1250,s.bottom=-1250,s.right=1250,s.left=-1250,s.near=-1e4,s.far=2500;let o=new Gl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Gl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let n=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&Bee(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),n&&this.update()}}});function nI(i){return i instanceof Tr&&i.needsAO&&!Ts(i)&&i.isDecalObject!==!0}function rI(i){let t=i.cloner;if(!(!t||!Array.isArray(t.children)))for(let e of t.children)e?.layers&&(e.layers.mask=i.layers.mask)}function iI(i){return i.getLayersOfType("reflection").filter(t=>t.data.visible).length}function az(i,t){let e={outline:!1,cavity:!1},n=i.layers.mask&tI,r=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),o=iI(t),a=t.getLayersOfType("cavity");return(s.length>0||a.length>0)&&(i.layers.set(8),r.length>0&&i.layers.enable(3),o>0&&i.layers.enable(4),e.outline=s.length>0,e.cavity=a.length>0,Ka(i),$a(i)),r.length===0&&s.length===0&&a.length===0&&o===0&&i.layers.set(0),n&&i.layers.set(9),!n&&nI(i)&&i.layers.enable(5),rI(i),e}function lz(i,t){if(!t.layers)return!1;let e=i.layers.mask&tI,n=!1,r=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),o=iI(t),a=t.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(i.layers.set(3),(s.length>0||a.length>0)&&i.layers.enable(8),o>0&&i.layers.enable(4),n=!0),r.length===0&&s.length===0&&a.length===0&&o===0&&i.layers.set(0),e&&i.layers.set(9),!e&&nI(i)&&i.layers.enable(5),rI(i),n}function cz(i,t){var l;if(!t.layers)return!1;let e=i.layers.mask&tI,n=!1,r=iI(t),s=t.getLayersOfType("transmission").filter(c=>c.data.visible),o=t.getLayersOfType("outline").filter(c=>c.data.visible),a=t.getLayersOfType("cavity").filter(c=>c.data.visible);return r>0&&((l=i.userData).__splinePlanarMirror??(l.__splinePlanarMirror=0),i.layers.set(4),s.length>0&&i.layers.enable(3),(o.length>0||a.length>0)&&i.layers.enable(8),n=!0),r===0&&s.length===0&&o.length===0&&a.length===0&&i.layers.set(0),e&&i.layers.set(9),!e&&nI(i)&&i.layers.enable(5),rI(i),n}function dz(i){let t={outline:!1,cavity:!1},e=n=>{t.outline=t.outline||n.outline,t.cavity=t.cavity||n.cavity};return i.traverseEntity(n=>{if(n instanceof Tr)if(Array.isArray(n.material))for(let r=0;r<n.material.length;r++)e(az(n,n.material[r]));else e(az(n,n.material))}),t}function hz(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Tr)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)lz(e,e.material[n])&&(t=!0);else lz(e,e.material)&&(t=!0)}),t}function pz(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Tr)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)cz(e,e.material[n])&&(t=!0);else cz(e,e.material)&&(t=!0)}),t}function Nv(i,t,e,n=!1){let r=i.cloner;if(r){let s=null;if(i.raycast===Ht.prototype.raycast||i.raycast===Kt.prototype.raycast){let o=i.geometry;o&&(o.boundingSphere===null&&o.computeBoundingSphere(),s=o.boundingSphere)}for(let o of r.children){if(s!==null&&(uz.copy(s).applyMatrix4(o.matrixWorld),!t.ray.intersectsSphere(uz)))continue;let a=Uee.copy(o.matrixWorld).invert(),l=kee.copy(t.ray).applyMatrix4(a),c=i.matrixWorld;l.applyMatrix4(c);let u=Fee;u.set(l.origin,l.direction),u.near=t.near,u.far=t.far,u.layers.mask=t.layers.mask;let d=u.intersectObject(i,!1);d.length>0&&e.push({...d[0],object:n?o:i})}}}var tI,Fee,Uee,kee,uz,sI=F(()=>{"use strict";pr();Ov();ii();Tu();X();tI=1<<9;Fee=new wd,Uee=new ne,kee=new Hi,uz=new nr});var Gw,Bv,fz=F(()=>{"use strict";X();gf();yf();Gw=class extends Va(py){constructor(e,n=6710886){super(e,n);this.object=e;this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,n){za(this.object,Gw.geometryHelper,e,n)}update(){if(this.object!==void 0){let e=Gw._vector,n=this.object.distance?this.object.distance:1e3,r=n*Math.tan(this.object.angle);this.cone.scale.set(r,r,n),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},Bv=Gw;Bv._vector=new M});var mz,gz,yz,pc,jw=F(()=>{"use strict";X();fz();Xf();mz=new M,gz=new M,yz=new qe,pc=class extends qf(ly,Bv){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.fov=xe.RAD2DEG*2*this.angle,s.aspect=1,s.near=100,s.far=2500;let o=new Gl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Gl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),gz.setFromMatrixPosition(this.matrixWorld),yz.setFromRotationMatrix(this.matrixWorld),mz.copy(this.up).applyQuaternion(yz).negate().multiplyScalar(this.distance),this.target.position.copy(gz).add(mz),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});var Cn,Qa=F(()=>{pt();Xs();X();Xi();Ao();kw();ka();Vw();on();uc();X();Tu();dc();sI();jw();Qt();Hf();Cn=class extends Tf(dr){constructor(e,n,r){super();this.data=n;this.bgColor=new yn(1,1,1,1);this.fog=null;this.backupFog=new ld(16777215,.1,2e3);this.fogUseBGColor=!1;this.fogMode="linear";this.fogDensity=Br.getDensity({});this.fogHeightFalloff=Br.getHeightFalloff({});this.fogHeightBase=Br.getHeightBase({});this.isActive=!1;this.skyState=null;this.skyStateVersion=0;this.gradingState=null;this.skyHdriHolder=null;this.aoColor=new Ze;this.penumbraSizeArrayCache=null;if(this.super_Entity(e,n),this.personalCamera=new hn(po,{...Vd.defaultData,...n.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new oy(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),n.uiScene){let s=rv();s===null?Jn("ui-2d","a page's 2D scene"):this.uiScene=new s.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",n.uiScene,{dpr:window.devicePixelRatio,shared:r.shared})}else n.uiFrame&&this.createUICanvas(n.uiFrame,r)}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,n){let r=rv();if(r===null){Jn("ui-2d","a page's UI canvas");return}this.uiCanvas=new r.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,n),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,n){e.color!==void 0&&(this.ambientLight.color=yi(e.color,n)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(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(n=>{n instanceof _s&&n.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof Tr)if(Array.isArray(e.material))for(let n of e.material)n.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let n=this.data.shadow,r=kd.isSoft(n);RV(r,n?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,n){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let r=this.scene;r.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=yi(e.color,n),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Br.getMode(e),this.fogDensity=Br.getDensity(e),this.fogHeightFalloff=Br.getHeightFalloff(e),this.fogHeightBase=Br.getHeightBase(e)}updateSky(e,n){this.skyState=e??null,this.skyStateVersion++;let r=e?.hdri?.image;this.skyHdriHolder=r!=null?n.image(r):null}updateAo(e,n){e.aoColor!==void 0&&(this.aoColor=yi(e.aoColor,n))}updateByOp(e,n,r,s){let o=this.data.uiFrame;super.updateByOp(e,n,r,s);let a=n;$t(e.path,["fog"])?this.updateFog(a.fog,r.shared):$t(e.path,["sky"])?this.updateSky(a.sky,r.shared):$t(e.path,["grading"])?this.gradingState=a.grading??null:$t(e.path,["ao"])?this.updateAo(a.ao,r.shared):$t(e.path,["ambient"])?this.updateAmbientLight(a.ambient,r.shared):$t(e.path,["shadow"])?this.updateShadow(a.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||o!==a.uiFrame)&&this.updateUIFrame(e.props.uiFrame,r)}updateUIFrame(e,n){e?(this.uiCanvas||this.createUICanvas(e,n),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,n){this.updateState_Entity(e,n),e.backgroundColor!==void 0&&this.setBackgroundColor(yi(e.backgroundColor,n.shared)),e.fog!==void 0&&this.updateFog(e.fog,n.shared),e.sky!==void 0&&this.updateSky(e.sky,n.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,n.shared),e.ao!==void 0&&this.updateAo(e.ao,n.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,n){}raycast(e,n){super.raycast(e,n)}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 this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(ls).fill(.5);let e=0,n=0;this.traverseEntity(r=>{if(!r.visible)return!0;r instanceof hc&&r.visible&&e<mf&&(this.penumbraSizeArrayCache[e]=r.data.penumbraSize??.5,e+=1),r instanceof pc&&r.visible&&e<ls-mf&&(this.penumbraSizeArrayCache[mf+n]=r.data.penumbraSize??.5,n+=1)})}raycastWithClones(e){let n=[],r=s=>{for(let o of s.children){let a=o.cloner;Ot.is(o)&&(o.visible||a?.object.data.visible)&&((As(o)||Dv(o)&&this.scene.enableHelpers&&o.objectHelper.visible)&&(e.intersectObject(o,!1,n),Nv(o,e,n,!0)),r(o))}};return r(this),n}updateEntity2DByOp(e,n,r,s){this.uiCanvas?.updateEntity2DByOp(e,n,r,s)}}});function pI(){return Zee}function kz(i){hI=i}function Jw(){if(hI===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return hI}function eE(i){return i?.isWebGPUSplineRenderer===!0}var Zee,hI,fI=F(()=>{"use strict";Zee=null,hI=null});var tl,lE=F(()=>{"use strict";X();Jy();bu();tl=class extends Mo(Bs,xo){constructor(e,n,r){super();this.super_Entity(e,n),this.context=r,this.objectHelper.update()}updateState(e,n){this.updateState_Entity(e,n)}}});var Zz=Fh((bI,Kz)=>{(function(i,t){typeof bI=="object"?Kz.exports=t():typeof define=="function"&&define.amd?define(t):i.Alea=t()})(bI,function(){"use strict";return i.importState=function(e){var n=new i;return n.importState(e),n},i;function i(){return function(e){var n=0,r=0,s=0,o=1;e.length==0&&(e=[+new Date]);var a=t();n=a(" "),r=a(" "),s=a(" ");for(var l=0;l<e.length;l++)n-=a(e[l]),n<0&&(n+=1),r-=a(e[l]),r<0&&(r+=1),s-=a(e[l]),s<0&&(s+=1);a=null;var c=function(){var u=2091639*n+o*23283064365386963e-26;return n=r,r=s,s=u-(o=u|0)};return c.next=c,c.uint32=function(){return c()*4294967296},c.fract53=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.version="Alea 0.9",c.args=e,c.exportState=function(){return[n,r,s,o]},c.importState=function(u){n=+u[0]||0,r=+u[1]||0,s=+u[2]||0,o=+u[3]||0},c}(Array.prototype.slice.call(arguments))}function t(){var e=4022871197,n=function(r){r=r.toString();for(var s=0;s<r.length;s++){e+=r.charCodeAt(s);var o=.02519603282416938*e;e=o>>>0,o-=e,o*=e,e=o>>>0,o-=e,e+=o*4294967296}return(e>>>0)*23283064365386963e-26};return n.version="Mash 0.9",n}})});function nG(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var rl,qv,ha,tm=F(()=>{ii();X();Kd();Ov();Yi();rl=new Nt,qv=new M;ha=class extends Xt{constructor(e,n,r){super(e,n,r);this.data=n;this.hiddenMatrixOld=new ne;this.smoothShading=!0;this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:s,subdivPointer:o}=Xn.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=o,r!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=r),s!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=s??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,$a(this),Ka(this),this.calcBoundingBox(),n&&(this.localGeometry.uuid=n)}updateState(e,n){if(super.updateState(e,n),e.flatShading!==void 0){let r=this.material;this.material=Array.isArray(r)?r.map(s=>s.getFlavor(!1,s.side,s.wireframe)):r.getFlavor(!1,r.side,r.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(n)}}updateMesh(e=!1,n=!1,r=!1){n&&this.subdividedGeometry||Xn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0,r),this.subdividedGeometry&&Xn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let e=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Xn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Xn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,$a(this),Ka(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}raycast(e,n){let r=this.localGeometry;this.localGeometry=this.originalGeometryNew,Kt.prototype.raycast.call(this,e,n),this.localGeometry=r}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;e.boundingSphere===null&&(e.boundingSphere=new nr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let n=e.attributes.position,r=e.boundingSphere.center;rl.setFromBufferAttribute(n),rl.getCenter(r),e.boundingSphere.radius=r.distanceTo(rl.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),rl.getSize(qv),this.hasNonUniformScale&&qv.divide(this.scale);let s={width:qv.x,height:qv.y,depth:qv.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let n=this.originalGeometry;rl.min.set(e[0],e[2],e[4]),rl.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(rl.min.applyMatrix4(this.shearScaleInv),rl.max.applyMatrix4(this.shearScaleInv)),n.boundingSphere===null&&(n.boundingSphere=new nr);let r=n.boundingSphere.center;rl.getCenter(r),n.boundingSphere.radius=r.distanceTo(rl.max)}freeSubdivPointer(){this.subdivPointer&&(Xn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry,r=n?.uuid,s=n?.userData.parameters,o=e.subdivisions>0?Xn.buildRefined(this.subdivPointer,e.subdivisions,this.smoothShading?e.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=o??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,$a(this),Ka(this),s!==void 0&&(this.localGeometry.userData.parameters=s),r&&(this.localGeometry.uuid=r)}updateByPatchedOpGeometry(e,n,r){super.updateByPatchedOpGeometry(e,n,r),this.localGeometry&&(e.type===0&&e.path.length===0&&Tw(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(n):this.createGeometryByControls(n))}}});function Kv(i){if(i.component){let t=i.component.instances.indexOf(i);t>=0&&i.component.instances.splice(t,1);for(let e of i.children)Ot.is(e)&&Kv(e)}}var OI=F(()=>{"use strict";Xi()});var YG=Fh((YOe,XG)=>{"use strict";function Nte(i,t){function e(){this.constructor=i}e.prototype=t.prototype,i.prototype=new e}function oh(i,t,e,n){this.message=i,this.expected=t,this.found=e,this.location=n,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,oh)}Nte(oh,Error);oh.buildMessage=function(i,t){var e={literal:function(c){return'"'+r(c.text)+'"'},class:function(c){var u="",d;for(d=0;d<c.parts.length;d++)u+=c.parts[d]instanceof Array?s(c.parts[d][0])+"-"+s(c.parts[d][1]):s(c.parts[d]);return"["+(c.inverted?"^":"")+u+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function n(c){return c.charCodeAt(0).toString(16).toUpperCase()}function r(c){return c.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(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function s(c){return c.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(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function o(c){return e[c.type](c)}function a(c){var u=new Array(c.length),d,h;for(d=0;d<c.length;d++)u[d]=o(c[d]);if(u.sort(),u.length>0){for(d=1,h=1;d<u.length;d++)u[d-1]!==u[d]&&(u[h]=u[d],h++);u.length=h}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}function l(c){return c?'"'+r(c)+'"':"end of input"}return"Expected "+a(i)+" but "+l(t)+" found."};function Bte(i,t){t=t!==void 0?t:{};var e={},n={svg_path:$},r=$,s=function(R){if(!R)return[];for(var N=[],H=0;H<R.length;H++)N=N.concat.apply(N,R[H]);var V=N[0];return V&&V.code=="m"&&(delete V.relative,V.code="M"),N},o=function(R,N){return st(R,N)},a=/^[Mm]/,l=ue(["M","m"],!1,!1),c=function(R,N,H){var V=dt(R,[N]);return H&&(V=V.concat(dt(R=="M"?"L":"l",H[1]))),V},u=/^[Zz]/,d=ue(["Z","z"],!1,!1),h=function(){return dt("Z")},p=/^[Ll]/,f=ue(["L","l"],!1,!1),g=function(R,N){return dt(R,N)},m=/^[Hh]/,y=ue(["H","h"],!1,!1),v=function(R,N){return dt(R,N.map(function(H){return{x:H}}))},b=/^[Vv]/,x=ue(["V","v"],!1,!1),S=function(R,N){return dt(R,N.map(function(H){return{y:H}}))},E=/^[Cc]/,T=ue(["C","c"],!1,!1),w=function(R,N,H){return{x1:R.x,y1:R.y,x2:N.x,y2:N.y,x:H.x,y:H.y}},_=/^[Ss]/,A=ue(["S","s"],!1,!1),C=function(R,N){return{x2:R.x,y2:R.y,x:N.x,y:N.y}},P=/^[Qq]/,D=ue(["Q","q"],!1,!1),O=function(R,N){return{x1:R.x,y1:R.y,x:N.x,y:N.y}},L=/^[Tt]/,U=ue(["T","t"],!1,!1),G=/^[Aa]/,Y=ue(["A","a"],!1,!1),oe=function(R,N,H,V,K,Ie){return{rx:R,ry:N,xAxisRotation:H,largeArc:V,sweep:K,x:Ie.x,y:Ie.y}},ee=function(R,N){return{x:R,y:N}},J=function(R){return R*1},Q=function(R){return R.join("")*1},re=/^[01]/,me=ue(["0","1"],!1,!1),ve=function(R){return R=="1"},pe=function(){return""},Ee=",",ce=Fe(",",!1),Se=function(R){return R.join("")},Pe=".",Le=Fe(".",!1),ke=/^[eE]/,Ce=ue(["e","E"],!1,!1),le=/^[+\-]/,ye=ue(["+","-"],!1,!1),Te=/^[0-9]/,Ne=ue([["0","9"]],!1,!1),He=function(R){return R.join("")},Me=/^[ \t\n\r]/,Oe=ue([" "," ",`
4135
4135
  `,"\r"],!1,!1),B=0,fe=0,W=[{line:1,column:1}],et=0,Ge=[],z=0,I;if("startRule"in t){if(!(t.startRule in n))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');r=n[t.startRule]}function q(){return i.substring(fe,B)}function Z(){return Xe(fe,B)}function ae(R,N){throw N=N!==void 0?N:Xe(fe,B),Ut([xt(R)],i.substring(fe,B),N)}function be(R,N){throw N=N!==void 0?N:Xe(fe,B),yt(R,N)}function Fe(R,N){return{type:"literal",text:R,ignoreCase:N}}function ue(R,N,H){return{type:"class",parts:R,inverted:N,ignoreCase:H}}function _e(){return{type:"any"}}function Ke(){return{type:"end"}}function xt(R){return{type:"other",description:R}}function Je(R){var N=W[R],H;if(N)return N;for(H=R-1;!W[H];)H--;for(N=W[H],N={line:N.line,column:N.column};H<R;)i.charCodeAt(H)===10?(N.line++,N.column=1):N.column++,H++;return W[R]=N,N}function Xe(R,N){var H=Je(R),V=Je(N);return{start:{offset:R,line:H.line,column:H.column},end:{offset:N,line:V.line,column:V.column}}}function rt(R){B<et||(B>et&&(et=B,Ge=[]),Ge.push(R))}function yt(R,N){return new oh(R,null,null,N)}function Ut(R,N,H){return new oh(oh.buildMessage(R,N),R,N,H)}function $(){var R,N,H,V,K;for(R=B,N=[],H=te();H!==e;)N.push(H),H=te();if(N!==e)if(H=Ye(),H===e&&(H=null),H!==e){for(V=[],K=te();K!==e;)V.push(K),K=te();V!==e?(fe=R,N=s(H),R=N):(B=R,R=e)}else B=R,R=e;else B=R,R=e;return R}function Ye(){var R,N,H,V,K,Ie;if(R=B,N=Ae(),N!==e){for(H=[],V=B,K=[],Ie=te();Ie!==e;)K.push(Ie),Ie=te();for(K!==e?(Ie=Ae(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);V!==e;){for(H.push(V),V=B,K=[],Ie=te();Ie!==e;)K.push(Ie),Ie=te();K!==e?(Ie=Ae(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e)}H!==e?(fe=R,N=o(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function Ae(){var R,N,H,V,K,Ie;if(R=B,N=ot(),N!==e){for(H=[],V=B,K=[],Ie=te();Ie!==e;)K.push(Ie),Ie=te();for(K!==e?(Ie=$e(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);V!==e;){for(H.push(V),V=B,K=[],Ie=te();Ie!==e;)K.push(Ie),Ie=te();K!==e?(Ie=$e(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e)}H!==e?(fe=R,N=o(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function $e(){var R;return R=Ue(),R===e&&(R=St(),R===e&&(R=vr(),R===e&&(R=no(),R===e&&(R=ro(),R===e&&(R=ax(),R===e&&(R=lx(),R===e&&(R=_g(),R===e&&(R=dx())))))))),R}function ot(){var R,N,H,V,K,Ie,zn;if(R=B,a.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(l)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Jr(),V!==e?(K=B,Ie=tr(),Ie===e&&(Ie=null),Ie!==e?(zn=ft(),zn!==e?(Ie=[Ie,zn],K=Ie):(B=K,K=e)):(B=K,K=e),K===e&&(K=null),K!==e?(fe=R,N=c(N,V,K),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function Ue(){var R,N;return R=B,u.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(d)),N!==e&&(fe=R,N=h()),R=N,R}function St(){var R,N,H,V;if(R=B,p.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(f)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=ft(),V!==e?(fe=R,N=g(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function ft(){var R,N,H,V,K,Ie;if(R=B,N=Jr(),N!==e){for(H=[],V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Jr(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Jr(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);H!==e?(fe=R,N=o(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function vr(){var R,N,H,V;if(R=B,m.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(y)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Vn(),V!==e?(fe=R,N=v(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function Vn(){var R,N,H,V,K,Ie;if(R=B,N=xl(),N!==e){for(H=[],V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=xl(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=xl(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);H!==e?(fe=R,N=o(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function no(){var R,N,H,V;if(R=B,b.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(x)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Vn(),V!==e?(fe=R,N=S(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function ro(){var R,N,H,V;if(R=B,E.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(T)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=x_(),V!==e?(fe=R,N=g(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function x_(){var R,N,H,V,K,Ie;if(R=B,N=Eg(),N!==e){for(H=[],V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Eg(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Eg(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);H!==e?(fe=R,N=o(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function Eg(){var R,N,H,V,K,Ie;return R=B,N=Jr(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=Jr(),V!==e?(K=tr(),K===e&&(K=null),K!==e?(Ie=Jr(),Ie!==e?(fe=R,N=w(N,V,Ie),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function ax(){var R,N,H,V;if(R=B,_.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(A)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Tg(),V!==e?(fe=R,N=g(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function Tg(){var R,N,H,V,K,Ie;if(R=B,N=Mg(),N!==e){for(H=[],V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Mg(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Mg(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);H!==e?(fe=R,N=o(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function Mg(){var R,N,H,V;return R=B,N=Jr(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=Jr(),V!==e?(fe=R,N=C(N,V),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function lx(){var R,N,H,V;if(R=B,P.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(D)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=cx(),V!==e?(fe=R,N=g(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function cx(){var R,N,H,V,K,Ie;if(R=B,N=ko(),N!==e){for(H=[],V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=ko(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=ko(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);H!==e?(fe=R,N=o(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function ko(){var R,N,H,V;return R=B,N=Jr(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=Jr(),V!==e?(fe=R,N=O(N,V),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function _g(){var R,N,H,V;if(R=B,L.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(U)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=ux(),V!==e?(fe=R,N=g(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function ux(){var R,N,H,V,K,Ie;if(R=B,N=Jr(),N!==e){for(H=[],V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Jr(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Jr(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);H!==e?(fe=R,N=o(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function dx(){var R,N,H,V;if(R=B,G.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(Y)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Dh(),V!==e?(fe=R,N=g(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function Dh(){var R,N,H,V,K,Ie;if(R=B,N=Lh(),N!==e){for(H=[],V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Lh(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,K=tr(),K===e&&(K=null),K!==e?(Ie=Lh(),Ie!==e?(K=[K,Ie],V=K):(B=V,V=e)):(B=V,V=e);H!==e?(fe=R,N=o(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function Lh(){var R,N,H,V,K,Ie,zn,Mn,zr,ct,Ti,nn;return R=B,N=Ag(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=Ag(),V!==e?(K=tr(),K===e&&(K=null),K!==e?(Ie=xl(),Ie!==e?(zn=tr(),zn!==e?(Mn=hx(),Mn!==e?(zr=tr(),zr===e&&(zr=null),zr!==e?(ct=hx(),ct!==e?(Ti=tr(),Ti===e&&(Ti=null),Ti!==e?(nn=Jr(),nn!==e?(fe=R,N=oe(N,V,Ie,Mn,ct,nn),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function Jr(){var R,N,H,V;return R=B,N=xl(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=xl(),V!==e?(fe=R,N=ee(N,V),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function Ag(){var R,N;return R=B,N=fx(),N===e&&(N=de()),N!==e&&(fe=R,N=J(N)),R=N,R}function xl(){var R,N,H,V;return R=B,N=B,H=ge(),H===e&&(H=null),H!==e?(V=fx(),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e),N===e&&(N=B,H=ge(),H===e&&(H=null),H!==e?(V=de(),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e)),N!==e&&(fe=R,N=Q(N)),R=N,R}function hx(){var R,N;return R=B,re.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(me)),N!==e&&(fe=R,N=ve(N)),R=N,R}function tr(){var R,N,H,V,K;if(R=B,N=[],H=te(),H!==e)for(;H!==e;)N.push(H),H=te();else N=e;if(N!==e)if(H=px(),H===e&&(H=null),H!==e){for(V=[],K=te();K!==e;)V.push(K),K=te();V!==e?(N=[N,H,V],R=N):(B=R,R=e)}else B=R,R=e;else B=R,R=e;if(R===e){if(R=B,N=B,H=px(),H!==e){for(V=[],K=te();K!==e;)V.push(K),K=te();V!==e?(H=[H,V],N=H):(B=N,N=e)}else B=N,N=e;N!==e&&(fe=R,N=pe()),R=N}return R}function px(){var R;return i.charCodeAt(B)===44?(R=Ee,B++):(R=e,z===0&&rt(ce)),R}function fx(){var R,N,H,V;return R=B,N=B,H=k(),H!==e?(V=se(),V===e&&(V=null),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e),N===e&&(N=B,H=de(),H!==e?(V=se(),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e)),N!==e&&(fe=R,N=Se(N)),R=N,R}function k(){var R,N,H,V,K;return R=B,N=B,H=de(),H===e&&(H=null),H!==e?(i.charCodeAt(B)===46?(V=Pe,B++):(V=e,z===0&&rt(Le)),V!==e?(K=de(),K!==e?(H=[H,V,K],N=H):(B=N,N=e)):(B=N,N=e)):(B=N,N=e),N===e&&(N=B,H=de(),H!==e?(i.charCodeAt(B)===46?(V=Pe,B++):(V=e,z===0&&rt(Le)),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e)),N!==e&&(fe=R,N=Se(N)),R=N,R}function se(){var R,N,H,V,K;return R=B,N=B,ke.test(i.charAt(B))?(H=i.charAt(B),B++):(H=e,z===0&&rt(Ce)),H!==e?(V=ge(),V===e&&(V=null),V!==e?(K=de(),K!==e?(H=[H,V,K],N=H):(B=N,N=e)):(B=N,N=e)):(B=N,N=e),N!==e&&(fe=R,N=Se(N)),R=N,R}function ge(){var R;return le.test(i.charAt(B))?(R=i.charAt(B),B++):(R=e,z===0&&rt(ye)),R}function de(){var R,N,H;if(R=B,N=[],Te.test(i.charAt(B))?(H=i.charAt(B),B++):(H=e,z===0&&rt(Ne)),H!==e)for(;H!==e;)N.push(H),Te.test(i.charAt(B))?(H=i.charAt(B),B++):(H=e,z===0&&rt(Ne));else N=e;return N!==e&&(fe=R,N=He(N)),R=N,R}function te(){var R,N;return R=B,Me.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(Oe)),N!==e&&(fe=R,N=pe()),R=N,R}function st(R,N){if(!N)return[R];for(var H=[R],V=0,K=N.length;V<K;V++)H[V+1]=N[V][1];return H}var lt={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 it in lt)lt[it.toUpperCase()]=lt[it];function dt(R,N){N||(N=[{}]);for(var H=N.length;H--;){var V={code:R,command:lt[R]};R==R.toLowerCase()&&(V.relative=!0);for(var K in N[H])V[K]=N[H][K];N[H]=V}return N}if(I=r(),I!==e&&B===i.length)return I;throw I!==e&&B<i.length&&rt(Ke()),Ut(Ge,et<i.length?i.charAt(et):null,et<i.length?Xe(et,et+1):Xe(et,et))}XG.exports={SyntaxError:oh,parse:Bte}});var EE=Fh(($Oe,$G)=>{var wE=YG().parse;wE.parseSVG=wE;wE.makeAbsolute=Fte;$G.exports=wE;function Fte(i){var t,e={x:0,y:0},n={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return i.forEach(function(r){r.command==="moveto"&&(t=r),r.x0=e.x,r.y0=e.y;for(var s in n)s in r&&(r[s]+=r.relative?r[n[s]]:0);"x"in r||(r.x=e.x),"y"in r||(r.y=e.y),r.relative=!1,r.code=r.code.toUpperCase(),r.command=="closepath"&&(r.x=t.x,r.y=t.y),e=r}),i}});function c4(i){DE.add(i)}function u4(i){if(DE.size===0)return;let t=Array.from(DE);DE.clear();for(let e of t)e.render(i)}var DE,VI=F(()=>{"use strict";DE=new Set});var Gm,FH=F(()=>{"use strict";X();gf();yf();Gm=class extends Va(fy){constructor(e,n=15,r=6710886){super(e,n,r);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,n){za(this.object,Gm.geometryHelper,e,n)}}});var vh,dO=F(()=>{"use strict";X();FH();Xf();vh=class extends qf(cy,Gm){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.fov=90,s.aspect=1,s.near=100,s.far=2500;let o=new M(-s.far+this.position.x,-s.far+this.position.y,-s.far+this.position.z),a=new M(s.far+this.position.x,s.far+this.position.y,s.far+this.position.z),l=new Nt(o,a),c=new jl(l,new Ze(16755200));c.visible=!1,this.gizmos.shadowmap=c,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let t in this.gizmos){let e=this.gizmos[t];if(e instanceof jl){let n=this.shadow.camera,r=new M(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),s=new M(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z);e.box.set(r,s),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});function f5(i){let t=p5.get(i);return t===void 0&&(t=ese++,p5.set(i,t)),t}function tse(i){return i.isShared===!0}function nse(i){let t=Ga(i)?i.object:i;return t.geometry!==void 0?t:void 0}function rse(i){let t=i;for(;t!==null;){let e=t.states;if(e!==void 0&&Object.keys(e).length>0)return!0;t=t.parent}return!1}function m5(i){if(i.isMesh!==!0)return"not-a-mesh";if(Ts(i)||yr(i)||sa(i)||vu(i))return"excluded-type";let e=nse(i);if(e===void 0)return"not-a-mesh";let n=e.material;if(n===void 0)return"not-a-mesh";if(Array.isArray(n))return"array-material";let r=e.builtSharedGeometry;if(r===void 0)return"unrealized-geometry";if(!tse(r))return"unshared-geometry";if(r.attributes.position===void 0)return"empty-geometry";if(r.morphAttributes.position!==void 0)return"morph";if(e.isSkinnedMesh===!0)return"skinned";let s=e.morphTargetInfluences;if(s!==void 0&&s.length>0)return"morph";if(r.drawRange.start!==0||r.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let o=n;return o.positionNode!=null||o.castShadowPositionNode!=null?"position-node":o.transparent===!0?"transparent":e.userData?.__splinePlanarMirror!==void 0?"reflection":rse(e)?"interaction-states":{object:i,owner:e,geometry:r,material:n,key:ise(i,e,r,n)}}function ise(i,t,e,n){let r=i,s=t;return[f5(e),f5(n),r.layers?.mask??0,r.renderOrder??0,(r.castShadow??s.castShadow)===!0?1:0,(r.receiveShadow??s.receiveShadow)===!0?1:0].join(":")}var p5,ese,g5=F(()=>{"use strict";pr();p5=new WeakMap,ese=1});function y5(i){for(let t of TO)if(i<=t)return t;return MO}var TO,MO,EO,bM,v5=F(()=>{"use strict";X();TO=[8,32,128,512],MO=TO[TO.length-1];EO=new ne().makeScale(0,0,0),bM=class extends Ll{constructor(e,n,r,s){super(e,n,r);this.isInstanceGroup=!0;this.members=new Array(r).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(s);for(let o=0;o<r;o++)this.setMatrixAt(o,EO);this.instanceMatrix.needsUpdate=!0}adoptPassState(e){this.layers.mask=e.layers.mask,this.renderOrder=e.renderOrder,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow}assign(e,n){this.members[e]=n}writeSlot(e,n,r){return r===!1?(this.setMatrixAt(e,EO),!1):(this.setMatrixAt(e,n.matrixWorld),!0)}park(e){this.members[e]=null,this.setMatrixAt(e,EO)}get memberCount(){let e=0;for(let n of this.members)n!==null&&e++;return e}}});function b5(i,t){let e=t.get(i);if(e!==void 0)return e;let n=i.visible&&(i.parent===null||b5(i.parent,t));return t.set(i,n),n}var sse,xM,x5=F(()=>{"use strict";g5();v5();sse=8,xM=class{constructor(t=sse){this.minGroupSize=t;this.groups=[];this.groupKeys=new WeakMap;this.placements=new Map;this.visibilityMemo=new Map;this.page=null;this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}}}update(t,e){this.page!==t&&(this.teardown(),this.page=t,e=!0),t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh()}reconcile(t){let e={},n=new Map;t.traverse(o=>{if(o.isInstanceGroup===!0)return;let a=m5(o);if(typeof a=="string"){e[a]=(e[a]??0)+1;return}let l=n.get(a.key);l===void 0?n.set(a.key,[a]):l.push(a)});let r=new Map;for(let[o,a]of n)for(let l of a)r.set(l.object,o);let s=!1;for(let[o,a]of this.placements)r.get(o)!==this.groupKeys.get(a.group)&&this.parkPlacement(o,a);for(let o=this.groups.length-1;o>=0;o--){let a=this.groups[o];a.memberCount>=this.minGroupSize||(this.destroyGroup(a),this.groups.splice(o,1),s=!0)}for(let[o,a]of n){let l=a.filter(u=>!this.placements.has(u.object));if(l.length===0)continue;let c=0;for(let u of this.groups){if(c>=l.length)break;if(this.groupKeys.get(u)!==o)continue;let{members:d}=u;for(let h=0;h<d.length&&c<l.length;h++)d[h]===null&&this.place(u,h,l[c++].object)}for(;l.length-c>=this.minGroupSize;){let u=l.slice(c,c+MO);this.groups.push(this.createGroup(t,o,u)),c+=u.length,s=!0}}s&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=e}createGroup(t,e,n){let r=n[0],s=new bM(r.geometry,r.material,y5(n.length),r.object);this.groupKeys.set(s,e);for(let o=0;o<n.length;o++)this.place(s,o,n[o].object);return t.add(s),s}destroyGroup(t){for(let e=0;e<t.members.length;e++){let n=t.members[e];n!==null&&this.parkPlacement(n,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,n){t.assign(e,n),this.placements.set(n,{group:t,slot:e}),n.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(){this.visibilityMemo.clear();for(let t of this.groups){let{members:e}=t,n=null;for(let r=0;r<e.length;r++){let s=e[r];s!==null&&(n===null&&(n=s),t.writeSlot(r,s,b5(s,this.visibilityMemo)))}n!==null&&(t.adoptPassState(n),t.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null}publishGroupStats(){let t=0;for(let e of this.groups){let n=e.memberCount;n>0&&(t+=n-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}}});function cse(i,t,e){e.length=0;let{axis:n,sign:r,limit:s}=t;for(let o=0;o<i.length;o++){let a=i[o],l=i[(o+1)%i.length],c=(n===0?a.px:n===1?a.py:a.pz)*r-s,u=(n===0?l.px:n===1?l.py:l.pz)*r-s,d=c<=0,h=u<=0;if(d&&e.push(a),d!==h){let p=c/(c-u);e.push({px:a.px+(l.px-a.px)*p,py:a.py+(l.py-a.py)*p,pz:a.pz+(l.pz-a.pz)*p,nx:a.nx+(l.nx-a.nx)*p,ny:a.ny+(l.ny-a.ny)*p,nz:a.nz+(l.nz-a.nz)*p})}}return e}function use(i,t,e,n,r,s,o,a,l){let c=i.geometry,u=c.getAttribute("position");if(u===void 0||u.count===0)return!0;let d=c.getAttribute("normal"),h=c.getIndex(),p=h!==null?h.count:u.count;if(p>ose)return!0;let f=c.drawRange.start,g=c.drawRange.count===1/0?p-f:Math.min(c.drawRange.count,p-f),m=f+g;Bb.copy(i.objectToDecal),SM.getNormalMatrix(Bb);let y=[],v=[];for(let b=f;b+2<m;b+=3){let x=h!==null?h.getX(b):b,S=h!==null?h.getX(b+1):b+1,E=h!==null?h.getX(b+2):b+2;if(Ac.fromBufferAttribute(u,x).applyMatrix4(Bb),Gu.fromBufferAttribute(u,S).applyMatrix4(Bb),ju.fromBufferAttribute(u,E).applyMatrix4(Bb),Ac.z>e&&Gu.z>e&&ju.z>e||Ac.z<-e&&Gu.z<-e&&ju.z<-e)continue;Rs.subVectors(Gu,Ac),S5.subVectors(ju,Ac),xh.crossVectors(Rs,S5);let T=xh.length();if(!(T===0||xh.z/T<=lse)){if(y.length=0,d!==void 0)Rs.fromBufferAttribute(d,x).applyMatrix3(SM),y.push({px:Ac.x,py:Ac.y,pz:Ac.z,nx:Rs.x,ny:Rs.y,nz:Rs.z}),Rs.fromBufferAttribute(d,S).applyMatrix3(SM),y.push({px:Gu.x,py:Gu.y,pz:Gu.z,nx:Rs.x,ny:Rs.y,nz:Rs.z}),Rs.fromBufferAttribute(d,E).applyMatrix3(SM),y.push({px:ju.x,py:ju.y,pz:ju.z,nx:Rs.x,ny:Rs.y,nz:Rs.z});else{xh.divideScalar(T);for(let w of[Ac,Gu,ju])y.push({px:w.x,py:w.y,pz:w.z,nx:xh.x,ny:xh.y,nz:xh.z})}for(let w of t){if(y.length===0)break;let _=cse(y,w,v);v=y,y=_}if(!(y.length<3)){if(o.length/3+(y.length-2)*3>ase)return!1;for(let w=1;w+1<y.length;w++)for(let _ of[y[0],y[w],y[w+1]]){l.push(_.px*n+.5,_.py*r+.5);let A=_.nx,C=_.ny,P=_.nz,D=Math.hypot(A,C,P);D>0?(A/=D,C/=D,P/=D):(A=0,C=0,P=1),o.push(_.px+A*s,_.py+C*s,_.pz+P*s),a.push(A,C,P)}}}}return!0}function w5(i,t){let e=Math.max(Math.abs(t.width),1e-6),n=Math.max(Math.abs(t.height),1e-6),r=Math.max(Math.abs(t.depth),1e-6),s=[{axis:0,sign:1,limit:e/2},{axis:0,sign:-1,limit:e/2},{axis:1,sign:1,limit:n/2},{axis:1,sign:-1,limit:n/2},{axis:2,sign:1,limit:r/2},{axis:2,sign:-1,limit:r/2}],o=[],a=[],l=[];for(let u of i)if(!use(u,s,r/2,1/e,1/n,t.offset,o,a,l))break;let c=new De;return c.setAttribute("position",new Ve(o,3)),c.setAttribute("normal",new Ve(a,3)),c.setAttribute("uv",new Ve(l,2)),o.length===0?(c.setDrawRange(0,0),c.boundingSphere=new nr):c.computeBoundingSphere(),c}var ose,ase,lse,Bb,SM,Ac,Gu,ju,Rs,S5,xh,E5=F(()=>{"use strict";X();ose=15e5,ase=3e5,lse=.01,Bb=new ne,SM=new wt,Ac=new M,Gu=new M,ju=new M,Rs=new M,S5=new M,xh=new M});var _O,T5,M5,_5,Wm,A5=F(()=>{"use strict";X();on();Tu();ii();Xi();E5();Ov();_O=new Nt,T5=new Nt,M5=new ne,_5=new M,Wm=class extends Tr{constructor(e,n,r){super(e,n);this.data=n;this.geometry=new De;this.lastSignature=[];this.nextSignature=[];this.scanned=[];this.lastParams={width:0,height:0,depth:0,offset:0};this.context=r;let s=this.data.geometry;this.lastParams={width:this.resolveNumber(s.width,0),height:this.resolveNumber(s.height,0),depth:this.resolveNumber(s.depth,0),offset:s.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(e,n){if(typeof e=="number")return e;let r=Number(this.context.shared.getVariable(e));return Number.isFinite(r)?r:n}currentParams(){let e=this.dataPatched.geometry;return{width:this.resolveNumber(e.width,this.lastParams.width),height:this.resolveNumber(e.height,this.lastParams.height),depth:this.resolveNumber(e.depth,this.lastParams.depth),offset:e.offset??0}}projectionRoot(){let e=this.parent;for(;e!==null&&Ot.is(e);){if(e.data?.type==="Page")return e;e=e.parent}return this.context.scene}scanTargets(e,n,r){let s=this.scanned;s.length=0;let o=this.projectionRoot();if(o===null)return s;_O.makeEmpty();for(let a=0;a<8;a++)_5.set((a&1?.5:-.5)*e,(a&2?.5:-.5)*n,(a&4?.5:-.5)*r).applyMatrix4(this.matrixWorld),_O.expandByPoint(_5);return o.traverse(a=>{if(a===this||!Ot.is(a)||!(a instanceof Kt)||a instanceof Wm||a.dataPatched?.type!=="Mesh"||!a.visible||a.destroyedInAction||(a.layers.mask&1<<9)!==0)return;let l=a.geometry,c=l?.getAttribute("position");c===void 0||c.count===0||l.drawRange.count!==0&&(l.boundingBox===null&&l.computeBoundingBox(),T5.copy(l.boundingBox).applyMatrix4(a.matrixWorld),_O.intersectsBox(T5)&&s.push(a))}),s}collectSignature(e,n,r){e.length=0,e.push(r.width,r.height,r.depth,r.offset);for(let s of this.matrixWorld.elements)e.push(s);for(let s of n){e.push(s.id,s.geometry.id);let o=s.geometry.getAttribute("position");e.push(o===void 0?-1:"version"in o?o.version:o.data.version);let a=s.geometry.getIndex();e.push(a!==null?a.version:-1),e.push(s.geometry.drawRange.count===1/0?-1:s.geometry.drawRange.count);for(let l of s.matrixWorld.elements)e.push(l)}}signaturesEqual(e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let e=this.currentParams(),n=this.scanTargets(e.width,e.height,e.depth);if(this.collectSignature(this.nextSignature,n,e),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let r=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=r,this.lastParams=e,M5.copy(this.matrixWorld).invert();let s=n.map(a=>({geometry:a.geometry,objectToDecal:new ne().multiplyMatrices(M5,a.matrixWorld)}));return this.geometry.dispose(),this.geometry=w5(s,e),this.geometry.userData={type:"DecalGeometry",parameters:{width:e.width,height:e.height,depth:e.depth}},$a(this),Ka(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(e,n){let r=this.currentParams();e.setScalar(0),n.set(r.width,r.height,r.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}}});var wM,C5=F(()=>{"use strict";X();Jy();bu();wM=class extends Mo(ap,xo){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}}});function dse(){try{let i=window.location.href;if(i.includes("reducesubdiv=")){let t=i.indexOf("reducesubdiv=")+13;return parseInt(i.slice(t,t+1))}}catch{}}function hse(i,t,e){AO!==void 0&&t?.geometry&&"subdivisions"in t.geometry&&(t.geometry.subdivisions??0)>AO&&Object.assign(t.geometry,{subdivisions:AO});let n;if(t.geometry.type==="TextGeometry"||t.geometry.type==="InputGeometry"){let r=L1(t.geometry.type);return r?r(i,t,e):(Jn(t.geometry.type==="InputGeometry"?"textinputs":"text",`a Mesh with ${t.geometry.type}`),new Xt(i,t,e))}else if(t.geometry.type==="SubdivGeometry")n=new ha(i,t,e);else if(t.geometry.type==="PathGeometry"||t.geometry.type==="VectorGeometry"||t.geometry.type==="ShapeBlendGeometry"){let r=L1(t.geometry.type);r?n=r(i,t,e):(Jn(t.geometry.type==="ShapeBlendGeometry"?"shape-blends":t.geometry.type==="PathGeometry"?"3d-paths":"vector-shapes",`a Mesh with ${t.geometry.type}`),n=new Xt(i,t,e))}else if(t.geometry.type==="BooleanGeometry")n=new _s(i,t,e);else if(t.geometry.type==="DecalGeometry")n=new Wm(i,t,e);else if(t.geometry.type==="UIGeometry"){let r=L1("UIGeometry");r?n=r(i,t,e):(Jn("ui-2d","a Mesh with UIGeometry"),n=new Xt(i,t,e))}else n=new Xt(i,t,e);return n}function EM(i,t,e){if(console.assert(t.type!==void 0),t.type==="Mesh")return hse(i,t,e);if(t.type==="Empty")return new cs(i,t);if(t.type==="Particle"){let n=D1("Particle");return n?n(i,t,e):(Jn("particles","a Particle system"),new cs(i,t))}else{if(t.type==="ParticleCollider")return new tl(i,t,e);if(t.type==="Hair"){let n=D1("Hair");return n?n(i,t,e):(Jn("hair","a Hair System"),new cs(i,t))}else{if(t.type==="Splat")return new cs(i,t);if(t.type==="Bone")return new wM(i,t);if(t.type==="Page")return new Cn(i,t,e);if(t.type==="PointLight")return new vh(i,t,e);if(t.type==="SpotLight")return new pc(i,t,e);if(t.type==="DirectionalLight")return new hc(i,t,e);if(t.type==="Component"||t.type==="Instance"){let n=D1(t.type);return n?n(i,t,e):(Jn("components",`a ${t.type}`),new cs(i,t))}else if(Jo.is(t.type))return new hn(i,t)}}return console.error(t),new cs(i,t)}function pse(i,t,e){let n=EM(i.identity,t,e),r=i.children,s=i.attachedPaths,o=i.parent,a=i.component,l=i.instances,c=i.overrideData,u=i.uuid,d=i.stateSelection;i.dispose();for(let h of Object.keys(i))delete i[h];Object.setPrototypeOf(i,Object.getPrototypeOf(n));for(let h of Object.keys(n))i[h]=n[h];i.children=[...i.children,...r],i.attachedPaths=s,i.parent=o,i.component=a,i.instances=l,i.uuid=u,i.overrideData=c,i.updateState(i.data,e),d&&i.changeSelectedState(d,e),i.resetBBoxNeedsUpdate()}function P5(i,t,e,n){i.updateByOp(t,e,n,!1)}var AO,I5=F(()=>{"use strict";pt();tm();Hf();A5();Yi();av();dO();jw();Vw();Xs();tv();C5();Qa();lE();Qt();AO=dse();So.createEntity=EM;So.changeEntityProptotype=pse});var TM,R5=F(()=>{"use strict";TM=class{constructor(){this._constraints=new Map}setConstraint(t,e){e===null?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((n,r)=>{let s=[r,n],o=n;for(;this._constraints.has(o);){if(o=this._constraints.get(o),s.includes(o)){console.warn(`circular dependency detected: ${s.join(" -> ")}`);break}e.has(o)||s.push(o)}for(let a=s.length-2;a>=0;a--)if(!e.has(s[a])){let l=t.find(s[a]);l?l.applyPathSnapping(t):console.warn(`missing entity ${s[a]}`),e.add(s[a])}})}findDependency(t,e){let n=t;for(;this._constraints.has(n);)if(n=this._constraints.get(n),n===e)return!0;return!1}}});var O5,D5=F(()=>{"use strict";O5="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"});var L5,N5=F(()=>{"use strict";L5=`
4136
4136
  function sortWorker(self) {
4137
4137
  let wasmInstance;
@@ -9786,7 +9786,7 @@ void main() {
9786
9786
  gl_FragColor = texture(inputTexture, vUv);
9787
9787
  gVelocity = vec4(0.0);
9788
9788
  }
9789
- `,n.pyramidTextureSize.value=new j(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(s.uniforms,n)};this.material.shapeBlendhack=r,this.material.root.shapeBlendhack=r}dispose(){super.dispose(),$z()?.release(this)}},$v=PI;$v.streamCompaction=new aE;var yte=new ne,vte=new ne,rm=new qe,sh=new M,vE=new M,bte=new qe;function xte(i,t=0){let e=this.children.length;for(;e--;){let n=this.children[e];sc.is(n)&&AG.call(n,i,t+1)}}function AG(i,t=0){if(i(this,t)!==!0){let n=this.children.length;for(;n--;){let r=this.children[n];sc.is(r)&&AG.call(r,i,t+1)}}}function Ste(){if(this.shapesDataTexture.value===void 0){let m=new Hn(new Float32Array(4*$r*fc),$r,fc,qn,Wt);this.shapesDataTexture.value=m}let i=this.shapesDataTexture.value,t=i.image.data,e=0,n=0,r=this.data.geometry.blendRange,s=yte.copy(this.matrixWorld).invert(),o=this._npart,a=0;this._meshSdfWanted.clear();let l=null;if(xte.call(this,m=>{if(m.visible===!1)return!0;let y;if(m instanceof $s)return;if(m instanceof tl||vu(m))return;m instanceof Yr?y=m.object:y=m;let v=m.data?.cloner;if(Ot.is(m)&&v&&!v.hideBase&&v.type!=="radial"&&v.disabled!==!0||!(y instanceof Xt))return;let b=y.geometry.userData.parameters,x=b?.shapeBlendNode??y.dataPatched?.geometry?.shapeBlendNode;if(x===void 0)return;if(vte.multiplyMatrices(s,m.matrixWorld).decompose(vE,rm,sh),b?.type==="TorusGeometry"&&b.arc!==360){let O=b.arc*Math.PI/180;O=O/4,rm.multiply(bte.set(0,0,Math.sin(O),Math.cos(O)))}let E=x.overrideGlobalBlend?x.blendRange:r;E=E/this.bboxSize*2,t[a*4]=(vE.x-this.bboxOffset)/this.bboxSize*2,t[a*4+1]=(vE.y-this.bboxOffset)/this.bboxSize*2,t[a*4+2]=(vE.z-this.bboxOffset)/this.bboxSize*2,t[a*4+3]=x.operation===0?1:x.operation===2?-1:-2,t[$r*4+a*4]=-rm.x,t[$r*4+a*4+1]=-rm.y,t[$r*4+a*4+2]=-rm.z,t[$r*4+a*4+3]=rm.w;let T=new Float32Array(4),w=0,_=E;if(b?.type==="SphereGeometry")b.width===b.height&&b.width===b.depth?T[0]=0:T[0]=1,T[1]=b.width/this.bboxSize,T[2]=b.height/this.bboxSize,T[3]=b.depth/this.bboxSize,_=Math.max(T[1],T[2],T[3])*sh.x+E;else if(b?.type==="CubeGeometry"){w=b.cornerRadius;let O=b.width,L=b.height,U=b.depth;T[0]=2,T[1]=(O-2*w)/this.bboxSize,T[2]=(L-2*w)/this.bboxSize,T[3]=(U-2*w)/this.bboxSize,_=Math.sqrt(O**2+L**2+U**2)/this.bboxSize*sh.x+E}else if(b?.type==="CylinderGeometry"){w=b.cornerRadius;let O=b.height,L=b.radiusBottom,U=b.radiusTop;if(U>=L){let G=Math.atan2(U-L,O),Y=(Math.PI/2-G)/2;U-=w/Math.tan(Y),L-=w*Math.tan(Y)}else if(L>U){let G=Math.atan2(L-U,O),Y=(Math.PI/2-G)/2;U-=w*Math.tan(Y),L-=w/Math.tan(Y)}T[1]=(b.height-2*w)/this.bboxSize,L===U?(T[0]=3,T[2]=L/this.bboxSize*2):(T[0]=4,T[2]=L/this.bboxSize*2,T[3]=U/this.bboxSize*2),_=(Math.hypot(T[1],Math.max(Math.abs(T[2]),Math.abs(T[3])))+w/this.bboxSize*2)*sh.x+E}else if(b?.type==="TorusGeometry"){if(T[0]=5,T[1]=(b.width-b.depth)/this.bboxSize,T[2]=b.depth/this.bboxSize,b.arc!==360){T[0]=6,T[3]=T[1],t[$r*12+a*4+3]=T[2];let O=2*Math.atan2(T[2]/2,T[1]),L=b.arc*Math.PI/180/2-O;T[1]=Math.sin(L),T[2]=Math.cos(L)}_=b.width*sh.x/this.bboxSize+E}else{let O=y.geometry;(l??(l=new Set)).add(O.uuid);let L=this._meshSdfBaked.get(O.uuid),U=gte(O);if((L===void 0||L.posVersion!==U)&&this._meshSdfWanted.set(O.uuid,O),L===void 0)return;T[0]=7,T[1]=L.slot,T[2]=L.boxHalf.x/this.bboxSize*2,T[3]=L.boxHalf.y/this.bboxSize*2,t[$r*12+a*4+3]=L.boxHalf.z/this.bboxSize*2,_=Math.hypot(L.boxHalf.x,L.boxHalf.y,L.boxHalf.z)/this.bboxSize*2*sh.x+E}t.set(T,$r*8+a*4),e=Math.max(e,_),n=Math.max(n,E),this._reach[a]=_,t[$r*12+a*4]=E,t[$r*12+a*4+1]=w/this.bboxSize*2,t[$r*12+a*4+2]=sh.x;let A=Array.isArray(y.material)?y.material[0]:y.material,C=A,P,D;if(C?.getShapeBlendBaseColor){let O=C.getShapeBlendBaseColor();P=O,D=O.a}else A?.uniforms?.nodeU0!==void 0?(P=A.uniforms.nodeU0.node.value,D=A.uniforms.nodeU1?.value??1):(P={r:1,g:1,b:1},D=1);x.operation!==0&&!x.useColor&&(D=-1),t[$r*16+a*4]=P.r,t[$r*16+a*4+1]=P.g,t[$r*16+a*4+2]=P.b,t[$r*16+a*4+3]=D,D<1&&this.material.defines?.SHAPEBLEND_C===1&&(this.material.transparent=!0),a++}),this._meshSdfBaked.size>0){let m=l??new Set;for(let y of this._meshSdfBaked.keys())m.has(y)||this._meshSdfBaked.delete(y)}this.npart=a,this._maxBlendK=n;let c=e*1.1+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=c;let u=this._prevShapeData,d=o!==a,h=u===null||this._prevSpan!==c||d,p=h||CI,f=this._fieldDirtyMin.set(1/0,1/0,1/0),g=this._fieldDirtyMax.set(-1/0,-1/0,-1/0);if(u!==null){let m=Math.max(a,o);for(let y=0;y<m;y++){let v=!1;for(let C=0;C<fc;C++){let P=$r*4*C+y*4;if(t[P]!==u[P]||t[P+1]!==u[P+1]||t[P+2]!==u[P+2]||t[P+3]!==u[P+3]){v=!0;break}}if(!v)continue;if(h=!0,p)break;let b=t[y*4],x=t[y*4+1],S=t[y*4+2],E=u[y*4],T=u[y*4+1],w=u[y*4+2],_=this._reach[y],A=this._prevReach[y];if(!Number.isFinite(b+x+S+_)||!Number.isFinite(E+T+w+A)){p=!0;continue}f.x=Math.min(f.x,b-_,E-A),f.y=Math.min(f.y,x-_,T-A),f.z=Math.min(f.z,S-_,w-A),g.x=Math.max(g.x,b+_,E+A),g.y=Math.max(g.y,x+_,T+A),g.z=Math.max(g.z,S+_,w+A)}}return CI&&(h=!0),this._fieldDirtyFull=p||f.x===1/0,h&&(u===null?this._prevShapeData=new Float32Array(t):u.set(t),this._prevReach.set(this._reach),this._prevSpan=c,i.needsUpdate=!0),h}Qt();wo("ShapeBlendGeometry",(i,t,e)=>new $v(i,t,e));Mt("shape-blends");ii();Yi();var bE=class extends Xt{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?hv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}};Qt();wo("VectorGeometry",(i,t,e)=>new bE(i,t,e));Mt("vector-shapes");Yi();ii();Ev();gw();_v();vw();var xE=class extends Xt{constructor(e,n,r){super(e,n,r);this.isPathObject=!0;this._shapeId=null;this._lastShapeParams=null;this._lastShape=null;this._context=r}updateState(e,n){super.updateState(e,n),this.updateShape(),this.refreshAttachedCloners(n)}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let s in e)typeof e[s]=="string"&&(e[s]=this._context.shared.getVariable(e[s],[this.uuid,"geometry","extrusion","shape",s]));let n;if(e.type==="Custom"){let s=e.shapeId;if(s!==this._shapeId&&this.detachShape(),s){this._shapeId=s;let o=this._context.scene.find(s);o?.data&&(o.attachedPaths.add(this),n=o.geometry.userData?.shape),n||this._context.scene.addPendingCommand(()=>this.updateShape())}}else if(this._lastShape!==null&&this._sameShapeParams(e))n=this._lastShape;else{let s;switch(e.type){case"Rectangle":s=Uf;break;case"Ellipse":s=Bf;break;case"Polygon":s=mw;break;case"Star":s=yw;break;default:throw new Error(`Unknown shape type: ${e.type}`)}n=s.create({parameters:e}).userData.shape,this._lastShapeParams=e,this._lastShape=n??null}let r=this.geometry;n&&r.inputs&&(r.inputs.shapeData=n,r.build())}_sameShapeParams(e){let n=this._lastShapeParams;if(n===null)return!1;for(let r in e)if(!Object.is(e[r],n[r]))return!1;for(let r in n)if(!(r in e))return!1;return!0}detachShape(){this._shapeId!==null&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}supportsInPlaceGeometryUpdate(){return!1}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,n){return super.updateTransformState(e,n)}updateGeometryInteractions(e,n){super.updateGeometryInteractions(e,n),this.updateShape()}updateEntityBoxSize(e,n){let r=this.geometry.getAttribute("position");r!==void 0&&r.count>0?hv(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,e,n):super.updateEntityBoxSize(e,n)}};$d();X();pt();Ev();hw();CP();function CG(i,t){let e=2*Math.PI;return(i%e+e)%e===(t%e+e)%e}var wte=new ne,Ete=new ne,Tte=new ne,PG=new M,IG=new M,RG=new M,Mte=new M,_te=new M,Ate=new M,Cte=new M,OG=new WeakMap,II=new WeakMap,DG=new WeakMap;function Pte(i,t,e){let n=[new M,new M,new M],r=[new M,new M,new M];return i.extractBasis(n[0],n[1],n[2]),t.extractBasis(r[0],r[1],r[2]),n.forEach((s,o)=>{let a=r[o],l=xe.lerp(s.length(),a.length(),e);s.lerp(a,e).setLength(l)}),new ne().makeBasis(n[0],n[1],n[2])}function LG(i){i.setIndex(null),i.setAttribute("position",new je(new Float32Array(0),3)),i.setAttribute("normal",new je(new Float32Array(0),3)),i.setAttribute("uv",new je(new Float32Array(0),2)),i.setDrawRange(0,0)}var NG=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),o=t?.shapeData??Bf.create({parameters:{...Ud,width:typeof Ud.width=="number"?Ud.width:100,height:typeof Ud.height=="number"?Ud.height:100}}).userData.shape;return{path:i.path??Qp.defaultData(),parameters:Object.assign(e,{width:n,height:r,depth:s,extrusion:{...d1,...e.extrusion}}),shapeData:o}}static build(i){if(i.path.points.length>=2){let e=new RI(i);return Object.assign(e,{userData:{...i,type:"PathGeometry"}})}else{let e=new De;return LG(e),Object.assign(e,{userData:{...i,type:"PathGeometry"}})}}},RI=class extends De{constructor(e){super();this.type="PathExtrusionGeometry",this.inputs=e,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&this.inputs.parameters.extrusion.depth===1}_isOpenEnded(){let e=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&e.depth===1)||!CG(e.twist,0)||e.startScale!==e.endScale}build(){let{points:e,matrices:n}=this._getSampledPath();if(e.length<2){LG(this);return}let{depth:r,offset:s}=this.inputs.parameters.extrusion;r=Math.max(0,Math.min(r,1)),s=Math.max(0,Math.min(s,1));let o=this.inputs.path.isClosed?e.length:e.length-1,a=Math.floor(s*o),l=this.inputs.path.isClosed?Math.ceil((r+s)*o):Math.ceil(Math.min(1,r+s)*o),c=Math.min(Math.max(2,l-a+1),o+2),u=[],d=[];for(let re=0;re<c;re++){let me=this.inputs.path.isClosed?(re+a)%e.length:Math.min(re+a,e.length-1);u.push(e[me].clone()),d.push(n[me].clone())}let h=(re,me,ve)=>{u[re]=u[re].clone().lerp(u[me],ve),d[re]=Pte(d[re],d[me],ve)},p=0,f=s*o%1;(!this.inputs.path.isClosed||r<=1)&&(f||s===0)&&(p=f,h(0,1,p));let g=0,m=(s+r)*o%1;if((this.inputs.path.isClosed&&r<=1||!this.inputs.path.isClosed&&s+r<1)&&m&&(g=m,h(u.length-1,u.length-2,1-g)),r===0){let re=u.length-1;u[re].copy(u[0]),d[re].copy(d[0])}this._applyPathModifiers(d,p,g);let{bevel:y,bevelSides:v}=this.inputs.parameters.extrusion,b=y>0?this.inputs.parameters.extrusion.capType:"flat",x=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(x=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:S,infos:E,vertices:T}=this._getShapePoints(x),w=0,_;if(b==="round"){let re=this.inputs.shapeData,me=DG.get(re);me!==void 0&&me.bevel===y&&me.curveSegments===x&&me.bevelSides===v?_=me.geometry:(_=new wu(re,2*y,y,x,v,void 0,!0),DG.set(re,{bevel:y,curveSegments:x,bevelSides:v,geometry:_})),w=_.getAttribute("position").count}let A=0,C=0;E.sort((re,me)=>re.start-me.start),E.forEach(re=>{re.verticesStart=A,re.verticesCount=re.continuous.reduce((me,ve,pe)=>me+(pe===0||!ve?2:1),0),C+=re.verticesCount,A=C});let P=C*c,D,O=0;this._isOpenEnded()&&b==="flat"&&(D=this._getSurfaceTesselation(S),O=D.vertexCount);let L=P+2*O+w*2,U=P+2*O,G={positions:new Float32Array(L*3),normals:new Float32Array(L*3),uvs:new Float32Array(L*2)},Y=_?_.getIndex().array:null,oe=0;E.forEach(re=>{oe+=re.count});let ee=oe*(c-1)*6+(D?2*D.elementCount*3:0)+(Y?2*Y.length:0),J=new Uint32Array(ee),Q=0;if(E.forEach(re=>{Q=this._extrudeRegion(re,T,d,u,G,J,Q,this._isGeometryClosed()&&!this._isOpenEnded())}),D&&(Q=this._closeEnd(D,P,J,Q,G,d[0],u[0],!1),Q=this._closeEnd(D,P+O,J,Q,G,d[d.length-1],u[u.length-1],!0)),_){G.positions.set(_.getAttribute("position").array,U*3),G.normals.set(_.getAttribute("normal").array,U*3),G.uvs.set(_.getAttribute("uv").array,U*2);for(let pe=U;pe<U+w;pe++)G.uvs[pe*2+1]=1e-4;let re=Q;for(let pe=0;pe<Y.length;pe++)J[Q++]=Y[pe]+U;U+=w,G.positions.set(_.getAttribute("position").array,U*3),G.normals.set(_.getAttribute("normal").array,U*3),G.uvs.set(_.getAttribute("uv").array,U*2);let me=Q;for(let pe=0;pe<Y.length;pe++)J[Q++]=Y[pe]+U;this.setAttribute("position",new je(G.positions,3)),this.setAttribute("normal",new je(G.normals,3)),this.setAttribute("uv",new je(G.uvs,2)),this._setIndexFromUint32(J);let ve=wte;ve.copy(d[d.length-1]).setPosition(u[u.length-1]),this.applyMatrix4OnRange(ve,U,L),ve.copy(d[0]).setPosition(u[0]).multiply(Ete.makeScale(1,1,-1)),this.applyMatrix4OnRange(ve,U-w,U),this.reverseIndicesOnRange(re,me)}else this.setAttribute("position",new je(G.positions,3)),this.setAttribute("normal",new je(G.normals,3)),this.setAttribute("uv",new je(G.uvs,2)),this._setIndexFromUint32(J)}_setIndexFromUint32(e){let n=!1;for(let r=e.length-1;r>=0;--r)if(e[r]>=65535){n=!0;break}this.setIndex(new je(n?e:new Uint16Array(e),1))}_getSampledPath(){let e=this.inputs.path,n=V1(e),r=OG.get(n);if(r===void 0||r.subdivisions!==e.subdivisions||r.subdivisionMode!==e.subdivisionMode){let s=this._extractPathPoints(n),o=s.length<2?[]:this._computeBasisMatrices(s);r={subdivisions:e.subdivisions,subdivisionMode:e.subdivisionMode,points:s,matrices:o},OG.set(n,r)}return r}_extractPathPoints(e){let n=this.inputs.path.subdivisions,r=this.inputs.path.subdivisionMode==="uniform"?e.getSpacedPoints(n*4):e.getPoints(n);if(r.length<2)return[];let s=[r[0]];return r.forEach(a=>{s[s.length-1].distanceToSquared(a)>.001&&s.push(a)}),this.inputs.path.isClosed&&s[s.length-1].distanceTo(s[0])<.001&&s.pop(),s}_computeBasisMatrices(e){let n=[],r=e.length,s=this.inputs.path.isClosed,o=new M,a=new M,l=new M,c=new M,u=new M(0,1,0);for(let m=0;m<r;m++){let y=e[m],v;m===0?v=s?e[e.length-2]:PG.copy(y).multiplyScalar(2).sub(e[1]):v=e[m-1];let b;m===r-1?b=s?e[1]:PG.copy(y).multiplyScalar(2).sub(e[m-1]):b=e[m+1],IG.subVectors(y,v).normalize(),RG.subVectors(b,y).normalize();let x=Mte.addVectors(IG,RG).normalize();l.copy(x),m===0&&(x.equals(u)||_te.copy(x).negate().equals(u))&&u.set(0,0,1);let S=Ate.crossVectors(u,x).normalize(),E=Cte.crossVectors(x,S).normalize();u.copy(E),c.copy(S),m===0&&(o.copy(E),a.copy(x));let T=new ne().makeBasis(S,E,x);n.push(T)}let d=s?a:l,h=s?o:new M(0,1,0),p=d.clone().cross(c).normalize(),f=Math.acos(h.dot(p));if(isNaN(f))return n;let g=h.clone().cross(p);d.dot(g)>0&&(f*=-1);for(let m=1;m<n.length;m++)n[m].multiply(Tte.makeRotationZ(f*m/n.length));return n}_applyPathModifiers(e,n,r){let s=e.length,{angle:o,twist:a,startScale:l,endScale:c}=this.inputs.parameters.extrusion,u=new ne,d=new ne;return e.forEach((h,p)=>{let f=p===0?0:p===s-1?1:(p-n)/(s-(r===0?0:1)-(n+(1-r)));u.makeRotationZ(xe.lerp(o,o+a,f)*xe.DEG2RAD);let g=xe.lerp(l,c,f);d.makeScale(g,g,g),h.multiply(u).multiply(d)}),e}_getShapePoints(e,n=an.ODD){let r=this.inputs.shapeData,s=II.get(r);return(s===void 0||s.curveSegments!==e||s.windingRule!==n)&&(s={curveSegments:e,windingRule:n,shapePoints:this._computeShapePoints(e,n)},II.set(r,s)),s.shapePoints}_getSurfaceTesselation(e){let n=II.get(this.inputs.shapeData);if(n?.surfaceTesselation!==void 0)return n.surfaceTesselation;let r;try{r=la({windingRule:an.ODD,elementType:Ir.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:e})}catch{r=p2}return n!==void 0&&(n.surfaceTesselation=r),r}_computeShapePoints(e=12,n=an.ODD){let r=this.inputs.shapeData,s=r.extractShapePointsToFlatArray([],e),o=r.shapeHoles.map(g=>{let m=g.extractShapePointsToFlatArray([],e),y=[];for(let v=m.length-1;v>=1;v-=2){let b=m[v-1],x=m[v-0];y.push(b,x)}return y}),a;try{a=la({windingRule:n,elementType:Ir.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]})}catch{a=wv}let l;try{l=la({windingRule:an.ODD,elementType:Ir.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...o]})}catch{l=h2}if(!a)throw new Error("error generating geometry");let c=a.elementCount;if(l){a.elementCount+=l.elementCount;for(let g=0;g<l.elements.length;g++){let m=l.elements[g],y=g%2===0?a.vertexCount:0;a.elements.push(m+y)}for(let g=0;g<l.vertexIndices.length;g++){let m=l.vertexIndices[g],y=a.vertexCount;a.vertexIndices.push(m+y)}for(let g=0;g<l.vertices.length;g++){let m=l.vertices[g];a.vertices.push(m)}}let u=1/0,d=-1/0,h=1/0,p=-1/0;for(let g=0,m=a.vertexCount;g<m;g++){let y=g*2,v=a.vertices[y+0],b=a.vertices[y+1];v<u&&(u=v),v>d&&(d=v),b<h&&(h=b),b>p&&(p=b)}let f=[];for(let g=a.elementCount-1;g>=0;g--){let m=g>=c,y=g*2,v=a.elements[y+0],b=a.elements[y+1],x=v+b,S={start:v,count:b,normals:[],isHole:m,continuous:[],verticesStart:0,verticesCount:0};f.push(S);let E=v,T=x-1,w=v+1,_=r.roundedCurves.length;do{let A=E-v,C=a.vertices[T*2+0],P=a.vertices[T*2+1],D=a.vertices[E*2+0],O=a.vertices[E*2+1],L=a.vertices[w*2+0],U=a.vertices[w*2+1],G=D-C,Y=O-P,oe=Math.sqrt(G*G+Y*Y);G/=oe,Y/=oe;let ee=D-L,J=O-U,Q=Math.sqrt(ee*ee+J*J);ee/=Q,J/=Q,S.normals[A*2+0]=-J,S.normals[A*2+1]=ee;let re=a.vertexIndices[E];if(Array.isArray(re))S.continuous[A]=!1;else{let[me,ve]=r.getCurveIndexFromVertexId(re-1,!0);if(ve>0&&ve<1)S.continuous[A]=!0;else{let pe=ve===1?me+1:me-1;pe=(pe+_)%_;let Ee=ve===1?0:1,ce=r.roundedCurves[me].getTangent(ve),Se=r.roundedCurves[pe].getTangent(Ee);S.continuous[A]=ce.dot(Se)>.95}}m&&(S.normals[A*2+0]*=-1,S.normals[A*2+1]*=-1),[T,E,w]=[E,w,w+1],w>=x&&(w-=b)}while(w!==v+1)}return{regions:[s,...o],infos:f,vertices:a.vertices}}_insertVertex(e,n,r,s,o){let a=n*2,l=n*3;e.positions[l+0]=r.x,e.positions[l+1]=r.y,e.positions[l+2]=r.z,e.normals[l+0]=s.x,e.normals[l+1]=s.y,e.normals[l+2]=s.z,e.uvs[a+0]=o.x,e.uvs[a+1]=o.y}_extrudeRegion(e,n,r,s,o,a,l,c){let u=e.wallTemplate;if(u===void 0){u=[];for(let x=0;x<e.count;x++){let S=(e.start+x)*2,E=n[S+0],T=n[S+1],w,_;if(e.continuous[x])w=e.normals[x*2+0],_=e.normals[x*2+1];else{let C=x===0?(e.start+e.count-1)*2:S-2,P=E-n[C+0];w=-(T-n[C+1]),_=P,e.isHole||(w=-w,_=-_)}let A=x===0?1:x/e.count;if(u.push(E,T,w,_,A,0),!e.continuous[x]||x===0)if(x===0)u.push(E,T,e.normals[0],e.normals[1],0,1);else{let C=x===e.count-1?e.start*2:S+2,P=n[C+0]-E;w=-(n[C+1]-T),_=P,e.isHole||(w=-w,_=-_),u.push(E,T,w,_,A,1)}}e.wallTemplate=u}let d=r.length,h=u.length,p=o.positions,f=o.normals,g=o.uvs;for(let x=0;x<d;x++){let S=r[x].elements,E=S[0],T=S[1],w=S[2],_=S[4],A=S[5],C=S[6],P=S[12],D=S[13],O=S[14],L=s[x],U=x/(d-1),G=0,Y=0,oe=0,ee=e.verticesStart*d+e.verticesCount*x;for(let J=0;J<h;J+=6){if(u[J+5]===0){let Pe=u[J+0],Le=u[J+1];G=E*Pe+_*Le+P+L.x,Y=T*Pe+A*Le+D+L.y,oe=w*Pe+C*Le+O+L.z}let Q=u[J+2],re=u[J+3],me=E*Q+_*re+P,ve=T*Q+A*re+D,pe=w*Q+C*re+O,Ee=1/(Math.sqrt(me*me+ve*ve+pe*pe)||1);me*=Ee,ve*=Ee,pe*=Ee;let ce=ee*2,Se=ee*3;p[Se+0]=G,p[Se+1]=Y,p[Se+2]=oe,f[Se+0]=me,f[Se+1]=ve,f[Se+2]=pe,g[ce+0]=u[J+4],g[ce+1]=U,ee++}}let m=e.wallQuadPattern;if(m===void 0){m=[];let x=0;for(let S=0;S<e.count;S++)(!e.continuous[S]||S===0)&&x++,m.push(x,S===e.count-1?0:x+1),x++;e.wallQuadPattern=m}let y=d-1,v=m.length,b=e.isHole;for(let x=0;x<y;x++){let S=e.verticesStart*d+e.verticesCount*x,E=S+e.verticesCount;for(let T=0;T<v;T+=2){let w=S+m[T],_=S+m[T+1],A=E+m[T+1],C=E+m[T];b?(a[l++]=w,a[l++]=A,a[l++]=_,a[l++]=w,a[l++]=C,a[l++]=A):(a[l++]=w,a[l++]=_,a[l++]=A,a[l++]=w,a[l++]=A,a[l++]=C)}}return l}_closeEnd(e,n,r,s,o,a,l,c){let u=e.vertexCount,d=new M(0,0,c?-1:1).applyMatrix4(a),h=new M,p=new j;for(let g=0;g<u;g++){let m=2*g;h.set(e.vertices[m+0],e.vertices[m+1],0).applyMatrix4(a).add(l),this._insertVertex(o,n+g,h,d,p)}let f=e.elements;for(let g=0;g<e.elementCount;g++){let m=3*g;r[s++]=f[m+0]+n,r[s++]=f[m+(c?1:2)]+n,r[s++]=f[m+(c?2:1)]+n}return s}applyMatrix4OnRange(e,n,r){let s=e.elements,o=new wt().getNormalMatrix(e).elements,a,l,c,u,d=this.attributes.position,h=this.attributes.normal;if(!d||!h)return;let p=d.array,f=h.array,g=d.itemSize;for(let m=n*g,y=r*g;m<y;m+=g)a=p[m+0],l=p[m+1],c=p[m+2],u=1/(s[3]*a+s[7]*l+s[11]*c+s[15]),p[m+0]=(s[0]*a+s[4]*l+s[8]*c+s[12])*u,p[m+1]=(s[1]*a+s[5]*l+s[9]*c+s[13])*u,p[m+2]=(s[2]*a+s[6]*l+s[10]*c+s[14])*u,a=f[m+0],l=f[m+1],c=f[m+2],f[m+0]=o[0]*a+o[3]*l+o[6]*c,f[m+1]=o[1]*a+o[4]*l+o[7]*c,f[m+2]=o[2]*a+o[5]*l+o[8]*c;d.needsUpdate=!0,h.needsUpdate=!0}reverseIndicesOnRange(e,n){let r=this.index;if(r){for(let s=e;s<n;s+=3){let o=r.getX(s),a=r.getX(s+1),l=r.getX(s+2);r.setXYZ(s,l,a,o)}r.needsUpdate=!0}}};Qt();wo("PathGeometry",(i,t,e)=>new xE(i,t,e));nv("PathGeometry",NG);Mt("3d-paths");tv();Qt();So.Cloner=$s;Mt("cloners");on();gn();pt();X();Jy();tv();Xi();bu();Yi();OI();var Zv=class extends Mo(Bs,xo){constructor(e,n,r){super();this.isComponentObject=!0;n.type==="Instance"&&typeof e=="string"&&(n=this.transformAssignData(n,r)),this.super_Entity(e,n),this.objectHelper.update()}get isComponentRoot(){return this.data.type==="Component"&&typeof this.identity=="string"}get isInstanceRoot(){return this.data.type==="Instance"&&typeof this.identity=="string"}transformAssignData(e,n){let r=gu.getComponentData({scene:n.scene.data,shared:n.shared.data},e.component);if(r){let s,o;for(let a of go.rootOverrideProps)e[a]===void 0?(s===void 0&&(s={...e}),s[a]=r.data[a]):(o===void 0&&(o={}),o[a]=e[a],s===void 0&&(s={...e}),s[a]=Da.apply(r.data[a],e[a]));return this.overrideData=o,s}else return{...Fr.defaultData,...e,...Ly(Fr.defaultData,go.rootOverrideProps)}}updateByOp(e,n,r,s){let o;if(this.isInstanceRoot&&!s){if(n=this.transformAssignData(n,r),e.type===0&&e.path.length===0&&this.component)for(let a of go.rootOverrideProps)a in e.props&&e.props[a]===void 0&&(o===void 0&&(o={...e,props:{...e.props}}),o.props[a]=this.component.data[a]);else if(e.type===0&&e.path.length>0&&go.rootOverrideProps.includes(e.path[0])){let a=e.path[0];o===void 0&&(o={...e,path:[],props:{[a]:n[a]}})}}super.updateByOp(o??e,n,r,s)}updateState(e,n){this.updateState_Entity(e,n)}expandInstanceChildren(e){let n=this.data;if(this.component===void 0){let r=e.scene.find(n.component)??null,s=!1;if(r!==this.oldComponent){if(this.oldComponent){let o=0;for(let a of this.children)if(Ot.is(a))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),Kv(a),o+=1;else break;this.children.splice(0,o)}s=!0}if(r){let o={};FG(e,[this.uuid],n.overrides,this,r,r,0,s,o);for(let a of this.children)if(Ot.is(a)){let l=a.data;l.type==="Empty"&&l.animations&&a.traverseEntity(c=>{let u=c.dataPatched;if(c instanceof Xt&&u.bones&&u.boneInverses){let d=c.dataPatched;if(d.bones&&d.boneInverses){let h=d.bones.map(g=>e.scene.find(o[g])),p=d.boneInverses.map(g=>new ne().fromArray(g)),f=new Dl(h,p);c.bind(f,c.bindMatrix)}}else c.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function BG(i,t,e,n){return i.component===t&&ql(i.identity,n)?i.overrideData===e?2:1:0}function FG(i,t,e,n,r,s,o,a,l){if(o>50)return!1;if(n.component!==r){if(n.component){let u=n.component.instances.indexOf(n);u>=0&&n.component.instances.splice(u,1)}r.instances.find(u=>u===n)||r.instances.push(n),n.component=r}r instanceof Zv&&r.isInstanceRoot&&r.expandInstanceChildren(i);let c=0;for(let u of r.children)if(Ot.is(u)){let d=[...t,...typeof u.identity=="string"?[u.identity]:u.identity],h=rf.resolve(e,d,1);h!=null&&!(h instanceof Zn)&&(Object.setPrototypeOf(h,Zn.prototype),console.error("wrong prototype"));let p=null,f;if(!a){let g=n.children[c];if(p=Ot.is(g)?g:null,p!==null){let m=BG(p,u,h,d);f=m>=1?p.stateSelection:void 0,m!==2&&(p=null)}if(p===null&&(p=i.scene.findInstance(d)??null,p!==null)){let m=BG(p,u,h,d);if(f=m>=1?p.stateSelection:void 0,m!==2)p=null;else{let y=p.parent.children.indexOf(p);p.parent.children.splice(y,1),n.children.splice(c,0,p),p.parent===n?(y<=c&&console.error("not possible"),void 0):(p.parent=n,p.matrixWorldNeedsUpdate=!0,p.resetBBoxNeedsUpdate(),p.updateVisible(),i.pendingDeletes.delete(p),void 0)}}}if(p===null){let g=h?Da.apply(u.data,h):u.data;Jo.is(g.type)&&(g={...g,type:"Empty"}),p=So.createEntity(d,g,i),p.overrideData=h,n.add(p),n.children.splice(n.children.length-1,1),n.children.splice(c,0,p),p.updateState(p.data,i),f&&p.changeSelectedState(f,i),i.scene.registerInstanceAndSetUuid(p)}if(p.isBone){let g=p.identity[p.identity.length-1];l[g]=p.uuid}c+=1,FG(i,t,e,p,u,s,o+1,a,l)}if(!a){let u=c;for(;;){let d=n.children[c];if(Ot.is(d))i.pendingDeletes.add(d);else break;c+=1}n.children.splice(u,c-u)}return!0}Qt();var UG=(i,t,e)=>new Zv(i,t,e);Wd("Component",UG);Wd("Instance",UG);Mt("components");var DI=1e-10;function kG(i){let t=i[0][0],e=i[1][0],n=i[0][1],r=i[1][1],s=Math.sqrt(t*t+e*e),o=s>DI?t/s:1,a=s>DI?e/s:0,l=o*t+a*e,c=o*r-a*n,u=o*n+a*r;return{rotation:Math.atan2(a,o),scale:[l,c],shear:[Math.abs(c)>DI?u/c:0,0]}}function VG({rotation:i,scale:t,shear:e}){let n=Math.cos(i),r=Math.sin(i),s=e[0]*t[1],o=e[1]*t[0];return[n*t[0]-r*o,r*t[0]+n*o,n*s-r*t[1],r*s+n*t[1]]}var At;(S=>{function i(){return[1,0,0,0,1,0,0,0,1]}S.identity=i;function t(E,T=S.identity()){for(let w=0,_=E.length;w<_;w++)T[w]=E[w];return T}S.copy=t;function e(E,T,w,_,A,C){return S.setAbcdef(S.identity(),E,T,w,_,A,C)}S.create=e;function n(E,T,w,_,A,C,P){return E[0]=T,E[1]=_,E[2]=C,E[3]=w,E[4]=A,E[5]=P,E}S.setAbcdef=n;function r(E,T){let[w,_,A,C,P,D]=o(E),[O,L,U,G,Y,oe]=o(T),ee=O*w+L*A,J=O*_+L*C,Q=U*w+G*A,re=U*_+G*C,me=Y*w+oe*A+P,ve=Y*_+oe*C+D;return S.create(ee,J,Q,re,me,ve)}S.append=r;function s(E,T){let[w,_,A,C,P,D]=o(E),[O,L,U,G,Y,oe]=o(T),ee=w,J=_,Q=A,re=C;(O!==1||L!==0||U!==0||G!==1)&&(ee=w*O+_*U,J=w*L+_*G,Q=A*O+C*U,re=A*L+C*G);let me=P*O+D*U+Y,ve=P*L+D*G+oe;return S.create(ee,J,Q,re,me,ve)}S.prepend=s;function o(E){return[E[0],E[3],E[1],E[4],E[2],E[5]]}S.getAbcdef=o;function a(E){let[T,w,_,A,C,P]=S.getAbcdef(E),D=T*A-w*_,O=A/D,L=-w/D,U=-_/D,G=T/D,Y=(_*P-A*C)/D,oe=-(T*P-w*C)/D;return S.create(O,L,U,G,Y,oe)}S.invert=a;function l([E,T],w){let[_,A,C,P,D,O]=S.getAbcdef(w);return[_*E+C*T+D,A*E+P*T+O]}S.apply=l;function c(E,T){let[w,_,A,C,P,D]=S.getAbcdef(T),O=1/(w*C+A*-_),[L,U]=E;return[C*O*L+-A*O*U+(D*A-P*C)*O,w*O*U+-_*O*L+(-D*w+P*_)*O]}S.applyInverse=c;function u(E,T,w=T){let[_,A,C,P,D,O]=S.getAbcdef(E);return S.setAbcdef(E,_*T,A*w,C*T,P*w,D*T,O*w),E}S.scale=u;function d(E,T){let w=Math.cos(T),_=Math.sin(T),[A,C,P,D,O,L]=S.getAbcdef(E);return S.setAbcdef(E,A*w-C*_,A*_+C*w,P*w-D*_,P*_+D*w,O*w-L*_,O*_+L*w),E}S.rotate=d;function h(E,T,w){let[_,A]=w,C=S.translate(E,-_,-A);return C=S.rotate(C,T),C=S.translate(C,_,A),C}S.rotateAround=h;function p(E,T,w){let[_,A,C,P,D,O]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,P,D+T,O+w),E}S.translate=p;function f(E,T,w){let[_,A,C,P]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,P,T,w),E}S.setTranslate=f;function g(E,T,w){let[_,A,C,P]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,P,T,w),E}S.setPosition=g;function m(E){let[T,w,_,A]=S.getAbcdef(E),C=Math.sqrt(T*T+w*w),P=Math.sqrt(_*_+A*A);return[C,P]}S.getScale=m;function y(E){let[,,,,T,w]=S.getAbcdef(E);return[T,w]}S.getPosition=y;function v(E,T){return S.decompose(E,T).rotation}S.getRotation=v;function b(E,T){let[w,_,A,C,P,D]=S.getAbcdef(E),{rotation:O,scale:L,shear:U}=kG([[w,A],[_,C]]);return{position:[P+(T[0]*w+T[1]*A)-T[0],D+(T[0]*_+T[1]*C)-T[1]],scale:L,rotation:O,shear:U,pivot:T}}S.decompose=b;function x(E,T,w,_,A=[0,0]){let[C,P]=E,[D,O]=_,[L,U,G,Y]=VG({rotation:w,scale:T,shear:A}),oe=C-(D*L+O*G)+D,ee=P-(D*U+O*Y)+O;return S.create(L,U,G,Y,oe,ee)}S.compose=x})(At||(At={}));function Ite(i,t){let[[e,n],[r,s]]=i,[[o,a],[l,c]]=t,u=(e-r)*(a-c)-(n-s)*(o-l);if(u===0)return!1;let d=((e-o)*(a-c)-(n-a)*(o-l))/u,h=-((e-r)*(n-a)-(n-s)*(e-o))/u;return d>=0&&d<=1&&h>=0&&h<=1}var GG=[[-1,1],[-1,-1],[1,-1],[1,1]],zG=(i,t,e)=>{let n=i.getCenter(),r=i.getHalfSize(),s=At.append(t,i.worldMatrix);r[0]===0&&r[1]===0?e.push(At.apply(n,s)):GG.forEach(o=>{let a=[o[0]*r[0]+n[0],o[1]*r[1]+n[1]];e.push(At.apply(a,s))})},Pu=class{constructor(){this.matrix=At.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(),At.copy(t.worldMatrix,this.matrix);let n=At.invert(t.worldMatrix);this.expandByObjectSize(t,n,e)}expandByObjectSize(t,e,n=!1){let r=[],s=t.isBaseGroup===!0?t:void 0;n===!0&&s!==void 0?s.traverse(o=>{o.visible&&zG(o,e,r)}):zG(t,e,r),this.setFromPoints(r)}setFromSize(t,e,n){this.makeEmpty(),At.copy(n,this.matrix),this.expandBySize(t,e,n)}expandBySize(t,e,n){[At.apply([0,0],n),At.apply([0,e],n),At.apply([t,e],n),At.apply([t,0],n)].forEach(s=>this.expandByPoint(s))}getCenter(){let[t,e]=this.min,[n,r]=this.getHalfSize();return At.apply([t+n,e+r],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}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(),n=this.getCenter(),[r,s,o,a]=At.getAbcdef(this.matrix),l=At.create(r,s,o,a,n[0],n[1]);this.vertices=GG.map(([c,u])=>At.apply([c*t,u*e],l))}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 n=this.matrix;return e&&(n=At.append(e.worldMatrix,n)),At.applyInverse(t,n)}intersects(t,e,n){return this.intersectsInLocalSpace(...this.project([t,e],n))}intersectsInLocalSpace(t,e){let{min:n,max:r}=this;return t>=n[0]&&t<=r[0]&&e>=n[1]&&e<=r[1]}containsPoint(t){let[e,n]=t,[r,s]=this.min,[o,a]=this.max;return e>=r&&e<=o&&n>=s&&n<=a}intersectsBBox2D(t){for(let e=0,n=this.edges.length;e<n;e++){let r=this.edges[e];for(let s=0,o=t.edges.length;s<o;s++){let a=t.edges[s];if(Ite(r,a))return!0}}for(let e=0,n=t.vertices.length;e<n;e++){let r=t.vertices[e];if(this.containsPoint(r))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],At.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new Pu;return t.copy(this),t}};pt();var Rte='{"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":{}}',jG=()=>JSON.parse(Rte);async function Ote(i,t){return await i.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(i.Engine.prototype,"scene")||Object.defineProperty(i.Engine.prototype,"scene",{get:function(){let e=Object.create(i.SceneController.prototype);return e.__wbg_ptr=this.__wbg_ptr,e}}),{createEngine:e=>i.Engine.create(e,jG(),!0)}}var SE,Qv;function Dte(i){SE=i}function LI(){if(!Qv){if(!SE)return Promise.reject(new Error("HanaRenderer: no Hana UI loader registered. Call setHanaUILoader() from the host app before initializing a HanaRenderer."));Qv=SE(),Qv.catch(()=>{Qv=void 0})}return Qv}var HG;function Lte(){let i=typeof process<"u"?"2.0.25":void 0;return`https://cdn.spline.design/@splinetool/runtime${i?`@${i}`:""}/build/hana-ui.wasm`}function WG(i){HG=i}function qG(){return SE||Dte(async()=>{let t=await import("./hana-ui.js");return Ote(t,HG??Lte())}),LI().then(()=>{})}var TE=Qu(EE(),1);function KG(i){let t=[],e;try{e=(0,TE.makeAbsolute)((0,TE.parseSVG)(i))}catch(c){return console.error("[HanaRenderer] Failed to parse SVG path:",c),t}let n=0,r=0,s=0,o=0,a=null,l=null;for(let c of e){let u=null,d=null;switch(c.code){case"M":n=s=c.x,r=o=c.y,t.push({MoveTo:{x:n,y:r}});break;case"L":n=c.x,r=c.y,t.push({LineTo:{x:n,y:r}});break;case"H":n=c.x,t.push({LineTo:{x:n,y:r}});break;case"V":r=c.y,t.push({LineTo:{x:n,y:r}});break;case"C":{let h={x:c.x1,y:c.y1},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"S":{let h=a?{x:2*n-a.x,y:2*r-a.y}:{x:n,y:r},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"Q":{let h={x:c.x1,y:c.y1};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"T":{let h=l?{x:2*n-l.x,y:2*r-l.y}:{x:n,y:r};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"A":{let h=n,p=r;n=c.x,r=c.y,Ute(t,h,p,c.rx,c.ry,c.xAxisRotation,c.largeArc,c.sweep,n,r);break}case"Z":n=s,r=o,t.push("ClosePath");break}a=u,l=d}return t}function Ute(i,t,e,n,r,s,o,a,l,c){if(t===l&&e===c)return;if(n=Math.abs(n),r=Math.abs(r),n===0||r===0){i.push({LineTo:{x:l,y:c}});return}let u=s*Math.PI/180,d=Math.cos(u),h=Math.sin(u),p=(t-l)/2,f=(e-c)/2,g=d*p+h*f,m=-h*p+d*f,y=g*g/(n*n)+m*m/(r*r);if(y>1){let ee=Math.sqrt(y);n*=ee,r*=ee}let v=n*n,b=r*r,x=v*b-v*m*m-b*g*g,S=v*m*m+b*g*g,E=(o!==a?1:-1)*Math.sqrt(Math.max(0,x/S)),T=E*(n*m)/r,w=E*(-r*g)/n,_=d*T-h*w+(t+l)/2,A=h*T+d*w+(e+c)/2,C=Math.atan2((m-w)/r,(g-T)/n),D=Math.atan2((-m-w)/r,(-g-T)/n)-C;!a&&D>0?D-=2*Math.PI:a&&D<0&&(D+=2*Math.PI);let O=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2))),L=D/O,U=4/3*Math.tan(L/4),G=C,Y=t,oe=e;for(let ee=0;ee<O;ee++){let J=G+L,Q=Math.cos(G),re=Math.sin(G),me=Math.cos(J),ve=Math.sin(J),pe=_+n*me*d-r*ve*h,Ee=A+n*me*h+r*ve*d,ce=-n*re*d-r*Q*h,Se=-n*re*h+r*Q*d,Pe=-n*ve*d-r*me*h,Le=-n*ve*h+r*me*d;i.push({CurveTo:[{x:Y+U*ce,y:oe+U*Se},{x:pe-U*Pe,y:Ee-U*Le},{x:pe,y:Ee}]}),G=J,Y=pe,oe=Ee}}var _E=.5522847498307936,zte=150,Gte=5*60*1e3,jte=(2728+680)/2816,Hte=1536/2816;function Wte(i){try{let t=new DataView(i),e=t.getUint32(0);if(e!==65536&&e!==1330926671&&e!==1953658213)return;let n=t.getUint16(4),r=-1,s=-1;for(let c=0;c<n;c++){let u=12+c*16,d=t.getUint32(u);d===1751474532&&(r=t.getUint32(u+8)),d===1330851634&&(s=t.getUint32(u+8))}if(r<0||s<0)return;let o=t.getUint16(r+18),a=t.getUint16(s);if(o===0||a<2)return;let l=t.getInt16(s+86);return l>0?l/o:void 0}catch{return}}var ZG=!1;function QG(){ZG||(ZG=!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 AE=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=At.identity();this._stack=[];this._clips=[];this._pathEls=[];this._simpleShape=null;this._pathPrimitives=0;this._fillColor=Vt.transparent;this._strokeColor=Vt.transparent;this._lineWidth=1;this._strokeMode="inside";this._layerBlur=0;this._backgroundBlur=0;this._dropShadowBlur=0;this._dropShadowOffsetX=0;this._dropShadowOffsetY=0;this._dropShadowColor=Vt.transparent;this._innerShadowBlur=0;this._innerShadowOffsetX=0;this._innerShadowOffsetY=0;this._innerShadowSpread=0;this._innerShadowColor=Vt.transparent;this._fonts=new Map;this._fontsFlushed=new Set;this._fontXPerEm=new Map;this._measureCache=new Map;try{let n=t.getBoundingClientRect();t.width=n.width*e,t.height=n.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 LI(),this._engine=await this._context.createEngine(this.canvas)}catch(t){this._crashed=!0,console.error("[HanaRenderer] Failed to load the Hana UI engine; UI scenes will not render.",t);return}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||typeof e.scene.isUiFontLoaded!="function"){t();return}let n=()=>{let o=!1;return this._guard(()=>{o=e.scene.isUiFontLoaded()}),o};if(n()){t();return}let r=Date.now(),s=setInterval(()=>{if(this._crashed||Date.now()-r>Gte){clearInterval(s);return}n()&&(clearInterval(s),t())},zte)})}_syncViewport(){let t=this._engine;if(!t||this._crashed)return;let e=this._width,n=this._height;this.canvas.style.width=e+"px",this.canvas.style.height=n+"px",this.canvas.width=Math.max(1,Math.ceil(e*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(n*this._dpr)),this._guard(()=>{t.resize([e,n],this._dpr),t.scene.updateCamera({position:[e/2,n/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(e){this._crashed=!0,console.error("[HanaRenderer] Hana engine call failed; disabling this renderer instance.",e)}}async loadFont(t,e){try{let n=await fetch(t);if(!n.ok){console.error(`[HanaRenderer] loadFont: ${t} returned HTTP ${n.status}; skipping "${e}"`);return}let r=await n.arrayBuffer();if(r.byteLength===0){console.error(`[HanaRenderer] loadFont: ${t} was empty; skipping "${e}"`);return}this.registerFont(r,e)}catch(n){console.error(`[HanaRenderer] loadFont failed for "${e}" (${t}):`,n)}}registerFont(t,e){if(this._fonts.has(e))return;this._fonts.set(e,t);let n=Wte(t);n!==void 0&&this._fontXPerEm.set(e,n),this._flushFonts()}_flushFonts(){let t=this._engine;if(!!t)for(let[e,n]of this._fonts)this._fontsFlushed.has(e)||(this._fontsFlushed.add(e),this._guard(()=>{t.scene.addLocalFont(e,new Uint8Array(n))}))}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:At.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 n=At.identity();if(this.camera?.enabled&&(n=At.append(n,this.camera.worldMatrix),e)){let r=At.getScale(this.camera.worldMatrix);n=At.scale(n,1/r[0],1/r[1])}this._ctm=At.append(n,t)}transform(t){this._ctm=At.append(this._ctm,t)}beginPath(){this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0}closePath(){this._pathEls.length!==0&&this._pathEls[this._pathEls.length-1]!=="ClosePath"&&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,n,r,s,o){this._startFreeform(),this._pathEls.push({CurveTo:[{x:t,y:e},{x:n,y:r},{x:s,y:o}]})}quadraticCurveTo(t,e,n,r){this._startFreeform(),this._pathEls.push({QuadTo:[{x:t,y:e},{x:n,y:r}]})}path(t){this._startFreeform(),this._pathEls.push(...KG(t))}rect(t,e,n,r,s=0,o=0,a=0,l=0){if(!t4([t,e,n,r]))return;let c={x:t,y:e,w:n,h:r,radii:[s,o,a,l]};this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"rect",rect:c,smoothing:0}:null,n4(this._pathEls,c)}ellipse(t,e,n,r,s,o,a,l){if(!!t4([t,e,n,r])){if(n<0||r<0)throw Error("radii cannot be negative");this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"ellipse",cx:t,cy:e,rx:n,ry:r}:null,$te(this._pathEls,t,e,n,r)}}clipRect(t,e,n,r,s=0,o=0,a=0,l=0){let c=At.invert(this._ctm);!c||this._clips.push({m:At.copy(this._ctm),inv:c,rect:{x:t,y:e,w:n,h:r,radii:[s,o,a,l]}})}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 n=this._classifyShape();if(!n)return;let r=this._applyClips(n);if(r==="skip")return;if(!t&&r!==n){let o=Jv(n);if(o){this._emitClippedRectStroke(o,e);return}}n=r;let s={shape:n,color:t?im(this._fillColor):[0,0,0,0],transform:At.getAbcdef(this._ctm)};t||(s.stroke=this._strokeDesc()),e&&(s.effect_chain=e),this._shapes.push(s)}_emitClippedRectStroke(t,e){let n=this._lineWidth,r=this._strokeMode==="outside"?n:this._strokeMode==="center"?n/2:0,s=n-r,o=Math.min(t.w,t.h)/2,a=t.radii.map(y=>Math.max(0,Math.min(y,o))),l={x:t.x-r,y:t.y-r,w:t.w+r*2,h:t.h+r*2,radii:a.map(y=>y>0?y+r:0)},c=t.w-s*2,u=t.h-s*2,d=c>0&&u>0?{x:t.x+s,y:t.y+s,w:c,h:u,radii:a.map(y=>Math.max(0,y-s))}:null,h=this._applyClips(ME(l,0));if(h==="skip")return;let p=Jv(h)??l,f=null;if(d){let y=this._applyClips(ME(d,0));f=y==="skip"?null:Jv(y)??d}let g=[];n4(g,p),f&&Yte(g,f);let m={shape:{Custom:g},color:im(this._strokeColor),transform:At.getAbcdef(this._ctm)};e&&(m.effect_chain=e),this._shapes.push(m)}_classifyShape(){let t=this._simpleShape;return t?t.kind==="rect"?ME(t.rect,t.smoothing):{Ellipse:{center_x:t.cx,center_y:t.cy,rx:t.rx,ry:t.ry}}:this._pathEls.length===0?null:{Custom:this._pathEls.slice()}}_strokeDesc(){return{width:this._lineWidth,line_join:"Miter",color:im(this._strokeColor),align:qte[this._strokeMode],cap:"Butt"}}_effectChain(t){let e=this.camera?.scale??1,n=[];if(t&&this._dropShadowColor.a>0&&n.push({DropShadow:{position:[this._dropShadowOffsetX*e,this._dropShadowOffsetY*e],blur:{Uniform:{size:2*this._dropShadowBlur*e}},spread:0,color:im(this._dropShadowColor)}}),t&&this._backgroundBlur>0){let[r,s]=At.getScale(this._ctm),o=(r+s)/2;n.push({BackgroundBlur:{blur:{Uniform:{size:2*this._backgroundBlur*o}}}})}if(this._layerBlur>0&&n.push({LayerBlur:{blur:{Uniform:{size:2*this._layerBlur*e}}}}),t&&this._innerShadowColor.a>0){let[r,s,o,a]=At.getAbcdef(this._ctm),l=this._innerShadowOffsetX,c=this._innerShadowOffsetY;n.push({InnerShadow:{position:[r*l+o*c,s*l+a*c],blur:{Uniform:{size:2*this._innerShadowBlur*e}},spread:this._innerShadowSpread*e,color:im(this._innerShadowColor)}})}return n.length>0?n:void 0}_applyClips(t,e=this._ctm){if(this._clips.length===0)return t;let n=t;for(let r of this._clips){let s=At.append(r.inv,e),[o,a,l,c,u,d]=At.getAbcdef(s),h=Math.abs(a)<=1e-6*(Math.abs(o)+Math.abs(c))&&Math.abs(l)<=1e-6*(Math.abs(o)+Math.abs(c)),p=Xte(n);if(!p)return n;if(!h){QG();continue}let f=o*p.minX+u,g=o*p.maxX+u,m=c*p.minY+d,y=c*p.maxY+d,v=Math.min(f,g),b=Math.max(f,g),x=Math.min(m,y),S=Math.max(m,y),E=r.rect,T=Math.max(v,E.x),w=Math.max(x,E.y),_=Math.min(b,E.x+E.w),A=Math.min(S,E.y+E.h);if(T>=_||w>=A)return"skip";if(T===v&&w===x&&_===b&&A===S)continue;let P=Jv(n);if(!P||o===0||c===0){QG();continue}let D=(T-u)/o,O=(_-u)/o,L=(w-d)/c,U=(A-d)/c,G=Math.min(D,O),Y=Math.min(L,U),oe=Math.abs(O-D),ee=Math.abs(U-L),[J,Q,re,me]=P.radii,ve=G!==P.x,pe=Y!==P.y,Ee=G+oe!==P.x+P.w,ce=Y+ee!==P.y+P.h,Se=Math.min(oe,ee)/2,Pe=[ve||pe?0:Math.min(J,Se),Ee||pe?0:Math.min(Q,Se),Ee||ce?0:Math.min(re,Se),ve||ce?0:Math.min(me,Se)];n=ME({x:G,y:Y,w:oe,h:ee,radii:Pe},0)}return n}drawText(t,e){let n=this._fontXPerEm.get(e.font),r=n?n/Hte:1,s={TextSimple:{text:t,font_size:e.fontSize*jte*r,size:[e.width,e.height],horizontal_align:JG[e.horizontalAlign]??"Left",vertical_align:e4[e.verticalAlign]??"Top"}},o=this._effectChain(!0),a=this._fillColor.a>0,l=this._strokeColor.a>0&&this._lineWidth>0;if(a||l||o){let c=At.append(this._ctm,At.translate(At.identity(),e.x,e.y));if(this._applyClips(s,c)!=="skip"){let u={shape:s,color:a?im(this._fillColor):[0,0,0,0],transform:At.getAbcdef(c)};l&&(u.stroke=this._strokeDesc()),o&&(u.effect_chain=o),this._shapes.push(u)}}return{height:this._measureTextHeight(t,e)}}_measureTextHeight(t,e){let n=`${e.font}|${e.fontSize}|${e.lineHeight}|${e.letterSpacing}|${e.width}|${t}`,r=this._measureCache.get(n);if(r!==void 0)return r;let s=0,o=this._engine;if(o&&!this._crashed&&this._fontsFlushed.has(e.font))try{let[,a]=o.scene.measureTextNaturalSize({size:[e.width,e.height],text:t,fontSize:e.fontSize,horizontalAlign:JG[e.horizontalAlign]??"Left",verticalAlign:e4[e.verticalAlign]??"Top",lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textTransform:"None",font:e.font,version:0,autoSize:"None",truncate:"None"});s=a}catch{}if(!(s>0)){let a=e.fontSize*.55+Math.max(0,e.letterSpacing),l=Math.max(1,Math.floor(e.width/a)),c=0;for(let u of t.split(`
9789
+ `,n.pyramidTextureSize.value=new j(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(s.uniforms,n)};this.material.shapeBlendhack=r,this.material.root.shapeBlendhack=r}dispose(){super.dispose(),$z()?.release(this)}},$v=PI;$v.streamCompaction=new aE;var yte=new ne,vte=new ne,rm=new qe,sh=new M,vE=new M,bte=new qe;function xte(i,t=0){let e=this.children.length;for(;e--;){let n=this.children[e];sc.is(n)&&AG.call(n,i,t+1)}}function AG(i,t=0){if(i(this,t)!==!0){let n=this.children.length;for(;n--;){let r=this.children[n];sc.is(r)&&AG.call(r,i,t+1)}}}function Ste(){if(this.shapesDataTexture.value===void 0){let m=new Hn(new Float32Array(4*$r*fc),$r,fc,qn,Wt);this.shapesDataTexture.value=m}let i=this.shapesDataTexture.value,t=i.image.data,e=0,n=0,r=this.data.geometry.blendRange,s=yte.copy(this.matrixWorld).invert(),o=this._npart,a=0;this._meshSdfWanted.clear();let l=null;if(xte.call(this,m=>{if(m.visible===!1)return!0;let y;if(m instanceof $s)return;if(m instanceof tl||vu(m))return;m instanceof Yr?y=m.object:y=m;let v=m.data?.cloner;if(Ot.is(m)&&v&&!v.hideBase&&v.type!=="radial"&&v.disabled!==!0||!(y instanceof Xt))return;let b=y.geometry.userData.parameters,x=b?.shapeBlendNode??y.dataPatched?.geometry?.shapeBlendNode;if(x===void 0)return;if(vte.multiplyMatrices(s,m.matrixWorld).decompose(vE,rm,sh),b?.type==="TorusGeometry"&&b.arc!==360){let O=b.arc*Math.PI/180;O=O/4,rm.multiply(bte.set(0,0,Math.sin(O),Math.cos(O)))}let E=x.overrideGlobalBlend?x.blendRange:r;E=E/this.bboxSize*2,t[a*4]=(vE.x-this.bboxOffset)/this.bboxSize*2,t[a*4+1]=(vE.y-this.bboxOffset)/this.bboxSize*2,t[a*4+2]=(vE.z-this.bboxOffset)/this.bboxSize*2,t[a*4+3]=x.operation===0?1:x.operation===2?-1:-2,t[$r*4+a*4]=-rm.x,t[$r*4+a*4+1]=-rm.y,t[$r*4+a*4+2]=-rm.z,t[$r*4+a*4+3]=rm.w;let T=new Float32Array(4),w=0,_=E;if(b?.type==="SphereGeometry")b.width===b.height&&b.width===b.depth?T[0]=0:T[0]=1,T[1]=b.width/this.bboxSize,T[2]=b.height/this.bboxSize,T[3]=b.depth/this.bboxSize,_=Math.max(T[1],T[2],T[3])*sh.x+E;else if(b?.type==="CubeGeometry"){w=b.cornerRadius;let O=b.width,L=b.height,U=b.depth;T[0]=2,T[1]=(O-2*w)/this.bboxSize,T[2]=(L-2*w)/this.bboxSize,T[3]=(U-2*w)/this.bboxSize,_=Math.sqrt(O**2+L**2+U**2)/this.bboxSize*sh.x+E}else if(b?.type==="CylinderGeometry"){w=b.cornerRadius;let O=b.height,L=b.radiusBottom,U=b.radiusTop;if(U>=L){let G=Math.atan2(U-L,O),Y=(Math.PI/2-G)/2;U-=w/Math.tan(Y),L-=w*Math.tan(Y)}else if(L>U){let G=Math.atan2(L-U,O),Y=(Math.PI/2-G)/2;U-=w*Math.tan(Y),L-=w/Math.tan(Y)}T[1]=(b.height-2*w)/this.bboxSize,L===U?(T[0]=3,T[2]=L/this.bboxSize*2):(T[0]=4,T[2]=L/this.bboxSize*2,T[3]=U/this.bboxSize*2),_=(Math.hypot(T[1],Math.max(Math.abs(T[2]),Math.abs(T[3])))+w/this.bboxSize*2)*sh.x+E}else if(b?.type==="TorusGeometry"){if(T[0]=5,T[1]=(b.width-b.depth)/this.bboxSize,T[2]=b.depth/this.bboxSize,b.arc!==360){T[0]=6,T[3]=T[1],t[$r*12+a*4+3]=T[2];let O=2*Math.atan2(T[2]/2,T[1]),L=b.arc*Math.PI/180/2-O;T[1]=Math.sin(L),T[2]=Math.cos(L)}_=b.width*sh.x/this.bboxSize+E}else{let O=y.geometry;(l??(l=new Set)).add(O.uuid);let L=this._meshSdfBaked.get(O.uuid),U=gte(O);if((L===void 0||L.posVersion!==U)&&this._meshSdfWanted.set(O.uuid,O),L===void 0)return;T[0]=7,T[1]=L.slot,T[2]=L.boxHalf.x/this.bboxSize*2,T[3]=L.boxHalf.y/this.bboxSize*2,t[$r*12+a*4+3]=L.boxHalf.z/this.bboxSize*2,_=Math.hypot(L.boxHalf.x,L.boxHalf.y,L.boxHalf.z)/this.bboxSize*2*sh.x+E}t.set(T,$r*8+a*4),e=Math.max(e,_),n=Math.max(n,E),this._reach[a]=_,t[$r*12+a*4]=E,t[$r*12+a*4+1]=w/this.bboxSize*2,t[$r*12+a*4+2]=sh.x;let A=Array.isArray(y.material)?y.material[0]:y.material,C=A,P,D;if(C?.getShapeBlendBaseColor){let O=C.getShapeBlendBaseColor();P=O,D=O.a}else A?.uniforms?.nodeU0!==void 0?(P=A.uniforms.nodeU0.node.value,D=A.uniforms.nodeU1?.value??1):(P={r:1,g:1,b:1},D=1);x.operation!==0&&!x.useColor&&(D=-1),t[$r*16+a*4]=P.r,t[$r*16+a*4+1]=P.g,t[$r*16+a*4+2]=P.b,t[$r*16+a*4+3]=D,D<1&&this.material.defines?.SHAPEBLEND_C===1&&(this.material.transparent=!0),a++}),this._meshSdfBaked.size>0){let m=l??new Set;for(let y of this._meshSdfBaked.keys())m.has(y)||this._meshSdfBaked.delete(y)}this.npart=a,this._maxBlendK=n;let c=e*1.1+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=c;let u=this._prevShapeData,d=o!==a,h=u===null||this._prevSpan!==c||d,p=h||CI,f=this._fieldDirtyMin.set(1/0,1/0,1/0),g=this._fieldDirtyMax.set(-1/0,-1/0,-1/0);if(u!==null){let m=Math.max(a,o);for(let y=0;y<m;y++){let v=!1;for(let C=0;C<fc;C++){let P=$r*4*C+y*4;if(t[P]!==u[P]||t[P+1]!==u[P+1]||t[P+2]!==u[P+2]||t[P+3]!==u[P+3]){v=!0;break}}if(!v)continue;if(h=!0,p)break;let b=t[y*4],x=t[y*4+1],S=t[y*4+2],E=u[y*4],T=u[y*4+1],w=u[y*4+2],_=this._reach[y],A=this._prevReach[y];if(!Number.isFinite(b+x+S+_)||!Number.isFinite(E+T+w+A)){p=!0;continue}f.x=Math.min(f.x,b-_,E-A),f.y=Math.min(f.y,x-_,T-A),f.z=Math.min(f.z,S-_,w-A),g.x=Math.max(g.x,b+_,E+A),g.y=Math.max(g.y,x+_,T+A),g.z=Math.max(g.z,S+_,w+A)}}return CI&&(h=!0),this._fieldDirtyFull=p||f.x===1/0,h&&(u===null?this._prevShapeData=new Float32Array(t):u.set(t),this._prevReach.set(this._reach),this._prevSpan=c,i.needsUpdate=!0),h}Qt();wo("ShapeBlendGeometry",(i,t,e)=>new $v(i,t,e));Mt("shape-blends");ii();Yi();var bE=class extends Xt{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?hv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}};Qt();wo("VectorGeometry",(i,t,e)=>new bE(i,t,e));Mt("vector-shapes");Yi();ii();Ev();gw();_v();vw();var xE=class extends Xt{constructor(e,n,r){super(e,n,r);this.isPathObject=!0;this._shapeId=null;this._lastShapeParams=null;this._lastShape=null;this._context=r}updateState(e,n){super.updateState(e,n),this.updateShape(),this.refreshAttachedCloners(n)}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let s in e)typeof e[s]=="string"&&(e[s]=this._context.shared.getVariable(e[s],[this.uuid,"geometry","extrusion","shape",s]));let n;if(e.type==="Custom"){let s=e.shapeId;if(s!==this._shapeId&&this.detachShape(),s){this._shapeId=s;let o=this._context.scene.find(s);o?.data&&(o.attachedPaths.add(this),n=o.geometry.userData?.shape),n||this._context.scene.addPendingCommand(()=>this.updateShape())}}else if(this._lastShape!==null&&this._sameShapeParams(e))n=this._lastShape;else{let s;switch(e.type){case"Rectangle":s=Uf;break;case"Ellipse":s=Bf;break;case"Polygon":s=mw;break;case"Star":s=yw;break;default:throw new Error(`Unknown shape type: ${e.type}`)}n=s.create({parameters:e}).userData.shape,this._lastShapeParams=e,this._lastShape=n??null}let r=this.geometry;n&&r.inputs&&(r.inputs.shapeData=n,r.build())}_sameShapeParams(e){let n=this._lastShapeParams;if(n===null)return!1;for(let r in e)if(!Object.is(e[r],n[r]))return!1;for(let r in n)if(!(r in e))return!1;return!0}detachShape(){this._shapeId!==null&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}supportsInPlaceGeometryUpdate(){return!1}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,n){return super.updateTransformState(e,n)}updateGeometryInteractions(e,n){super.updateGeometryInteractions(e,n),this.updateShape()}updateEntityBoxSize(e,n){let r=this.geometry.getAttribute("position");r!==void 0&&r.count>0?hv(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,e,n):super.updateEntityBoxSize(e,n)}};$d();X();pt();Ev();hw();CP();function CG(i,t){let e=2*Math.PI;return(i%e+e)%e===(t%e+e)%e}var wte=new ne,Ete=new ne,Tte=new ne,PG=new M,IG=new M,RG=new M,Mte=new M,_te=new M,Ate=new M,Cte=new M,OG=new WeakMap,II=new WeakMap,DG=new WeakMap;function Pte(i,t,e){let n=[new M,new M,new M],r=[new M,new M,new M];return i.extractBasis(n[0],n[1],n[2]),t.extractBasis(r[0],r[1],r[2]),n.forEach((s,o)=>{let a=r[o],l=xe.lerp(s.length(),a.length(),e);s.lerp(a,e).setLength(l)}),new ne().makeBasis(n[0],n[1],n[2])}function LG(i){i.setIndex(null),i.setAttribute("position",new je(new Float32Array(0),3)),i.setAttribute("normal",new je(new Float32Array(0),3)),i.setAttribute("uv",new je(new Float32Array(0),2)),i.setDrawRange(0,0)}var NG=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),o=t?.shapeData??Bf.create({parameters:{...Ud,width:typeof Ud.width=="number"?Ud.width:100,height:typeof Ud.height=="number"?Ud.height:100}}).userData.shape;return{path:i.path??Qp.defaultData(),parameters:Object.assign(e,{width:n,height:r,depth:s,extrusion:{...d1,...e.extrusion}}),shapeData:o}}static build(i){if(i.path.points.length>=2){let e=new RI(i);return Object.assign(e,{userData:{...i,type:"PathGeometry"}})}else{let e=new De;return LG(e),Object.assign(e,{userData:{...i,type:"PathGeometry"}})}}},RI=class extends De{constructor(e){super();this.type="PathExtrusionGeometry",this.inputs=e,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&this.inputs.parameters.extrusion.depth===1}_isOpenEnded(){let e=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&e.depth===1)||!CG(e.twist,0)||e.startScale!==e.endScale}build(){let{points:e,matrices:n}=this._getSampledPath();if(e.length<2){LG(this);return}let{depth:r,offset:s}=this.inputs.parameters.extrusion;r=Math.max(0,Math.min(r,1)),s=Math.max(0,Math.min(s,1));let o=this.inputs.path.isClosed?e.length:e.length-1,a=Math.floor(s*o),l=this.inputs.path.isClosed?Math.ceil((r+s)*o):Math.ceil(Math.min(1,r+s)*o),c=Math.min(Math.max(2,l-a+1),o+2),u=[],d=[];for(let re=0;re<c;re++){let me=this.inputs.path.isClosed?(re+a)%e.length:Math.min(re+a,e.length-1);u.push(e[me].clone()),d.push(n[me].clone())}let h=(re,me,ve)=>{u[re]=u[re].clone().lerp(u[me],ve),d[re]=Pte(d[re],d[me],ve)},p=0,f=s*o%1;(!this.inputs.path.isClosed||r<=1)&&(f||s===0)&&(p=f,h(0,1,p));let g=0,m=(s+r)*o%1;if((this.inputs.path.isClosed&&r<=1||!this.inputs.path.isClosed&&s+r<1)&&m&&(g=m,h(u.length-1,u.length-2,1-g)),r===0){let re=u.length-1;u[re].copy(u[0]),d[re].copy(d[0])}this._applyPathModifiers(d,p,g);let{bevel:y,bevelSides:v}=this.inputs.parameters.extrusion,b=y>0?this.inputs.parameters.extrusion.capType:"flat",x=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(x=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:S,infos:E,vertices:T}=this._getShapePoints(x),w=0,_;if(b==="round"){let re=this.inputs.shapeData,me=DG.get(re);me!==void 0&&me.bevel===y&&me.curveSegments===x&&me.bevelSides===v?_=me.geometry:(_=new wu(re,2*y,y,x,v,void 0,!0),DG.set(re,{bevel:y,curveSegments:x,bevelSides:v,geometry:_})),w=_.getAttribute("position").count}let A=0,C=0;E.sort((re,me)=>re.start-me.start),E.forEach(re=>{re.verticesStart=A,re.verticesCount=re.continuous.reduce((me,ve,pe)=>me+(pe===0||!ve?2:1),0),C+=re.verticesCount,A=C});let P=C*c,D,O=0;this._isOpenEnded()&&b==="flat"&&(D=this._getSurfaceTesselation(S),O=D.vertexCount);let L=P+2*O+w*2,U=P+2*O,G={positions:new Float32Array(L*3),normals:new Float32Array(L*3),uvs:new Float32Array(L*2)},Y=_?_.getIndex().array:null,oe=0;E.forEach(re=>{oe+=re.count});let ee=oe*(c-1)*6+(D?2*D.elementCount*3:0)+(Y?2*Y.length:0),J=new Uint32Array(ee),Q=0;if(E.forEach(re=>{Q=this._extrudeRegion(re,T,d,u,G,J,Q,this._isGeometryClosed()&&!this._isOpenEnded())}),D&&(Q=this._closeEnd(D,P,J,Q,G,d[0],u[0],!1),Q=this._closeEnd(D,P+O,J,Q,G,d[d.length-1],u[u.length-1],!0)),_){G.positions.set(_.getAttribute("position").array,U*3),G.normals.set(_.getAttribute("normal").array,U*3),G.uvs.set(_.getAttribute("uv").array,U*2);for(let pe=U;pe<U+w;pe++)G.uvs[pe*2+1]=1e-4;let re=Q;for(let pe=0;pe<Y.length;pe++)J[Q++]=Y[pe]+U;U+=w,G.positions.set(_.getAttribute("position").array,U*3),G.normals.set(_.getAttribute("normal").array,U*3),G.uvs.set(_.getAttribute("uv").array,U*2);let me=Q;for(let pe=0;pe<Y.length;pe++)J[Q++]=Y[pe]+U;this.setAttribute("position",new je(G.positions,3)),this.setAttribute("normal",new je(G.normals,3)),this.setAttribute("uv",new je(G.uvs,2)),this._setIndexFromUint32(J);let ve=wte;ve.copy(d[d.length-1]).setPosition(u[u.length-1]),this.applyMatrix4OnRange(ve,U,L),ve.copy(d[0]).setPosition(u[0]).multiply(Ete.makeScale(1,1,-1)),this.applyMatrix4OnRange(ve,U-w,U),this.reverseIndicesOnRange(re,me)}else this.setAttribute("position",new je(G.positions,3)),this.setAttribute("normal",new je(G.normals,3)),this.setAttribute("uv",new je(G.uvs,2)),this._setIndexFromUint32(J)}_setIndexFromUint32(e){let n=!1;for(let r=e.length-1;r>=0;--r)if(e[r]>=65535){n=!0;break}this.setIndex(new je(n?e:new Uint16Array(e),1))}_getSampledPath(){let e=this.inputs.path,n=V1(e),r=OG.get(n);if(r===void 0||r.subdivisions!==e.subdivisions||r.subdivisionMode!==e.subdivisionMode){let s=this._extractPathPoints(n),o=s.length<2?[]:this._computeBasisMatrices(s);r={subdivisions:e.subdivisions,subdivisionMode:e.subdivisionMode,points:s,matrices:o},OG.set(n,r)}return r}_extractPathPoints(e){let n=this.inputs.path.subdivisions,r=this.inputs.path.subdivisionMode==="uniform"?e.getSpacedPoints(n*4):e.getPoints(n);if(r.length<2)return[];let s=[r[0]];return r.forEach(a=>{s[s.length-1].distanceToSquared(a)>.001&&s.push(a)}),this.inputs.path.isClosed&&s[s.length-1].distanceTo(s[0])<.001&&s.pop(),s}_computeBasisMatrices(e){let n=[],r=e.length,s=this.inputs.path.isClosed,o=new M,a=new M,l=new M,c=new M,u=new M(0,1,0);for(let m=0;m<r;m++){let y=e[m],v;m===0?v=s?e[e.length-2]:PG.copy(y).multiplyScalar(2).sub(e[1]):v=e[m-1];let b;m===r-1?b=s?e[1]:PG.copy(y).multiplyScalar(2).sub(e[m-1]):b=e[m+1],IG.subVectors(y,v).normalize(),RG.subVectors(b,y).normalize();let x=Mte.addVectors(IG,RG).normalize();l.copy(x),m===0&&(x.equals(u)||_te.copy(x).negate().equals(u))&&u.set(0,0,1);let S=Ate.crossVectors(u,x).normalize(),E=Cte.crossVectors(x,S).normalize();u.copy(E),c.copy(S),m===0&&(o.copy(E),a.copy(x));let T=new ne().makeBasis(S,E,x);n.push(T)}let d=s?a:l,h=s?o:new M(0,1,0),p=d.clone().cross(c).normalize(),f=Math.acos(h.dot(p));if(isNaN(f))return n;let g=h.clone().cross(p);d.dot(g)>0&&(f*=-1);for(let m=1;m<n.length;m++)n[m].multiply(Tte.makeRotationZ(f*m/n.length));return n}_applyPathModifiers(e,n,r){let s=e.length,{angle:o,twist:a,startScale:l,endScale:c}=this.inputs.parameters.extrusion,u=new ne,d=new ne;return e.forEach((h,p)=>{let f=p===0?0:p===s-1?1:(p-n)/(s-(r===0?0:1)-(n+(1-r)));u.makeRotationZ(xe.lerp(o,o+a,f)*xe.DEG2RAD);let g=xe.lerp(l,c,f);d.makeScale(g,g,g),h.multiply(u).multiply(d)}),e}_getShapePoints(e,n=an.ODD){let r=this.inputs.shapeData,s=II.get(r);return(s===void 0||s.curveSegments!==e||s.windingRule!==n)&&(s={curveSegments:e,windingRule:n,shapePoints:this._computeShapePoints(e,n)},II.set(r,s)),s.shapePoints}_getSurfaceTesselation(e){let n=II.get(this.inputs.shapeData);if(n?.surfaceTesselation!==void 0)return n.surfaceTesselation;let r;try{r=la({windingRule:an.ODD,elementType:Ir.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:e})}catch{r=p2}return n!==void 0&&(n.surfaceTesselation=r),r}_computeShapePoints(e=12,n=an.ODD){let r=this.inputs.shapeData,s=r.extractShapePointsToFlatArray([],e),o=r.shapeHoles.map(g=>{let m=g.extractShapePointsToFlatArray([],e),y=[];for(let v=m.length-1;v>=1;v-=2){let b=m[v-1],x=m[v-0];y.push(b,x)}return y}),a;try{a=la({windingRule:n,elementType:Ir.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]})}catch{a=wv}let l;try{l=la({windingRule:an.ODD,elementType:Ir.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...o]})}catch{l=h2}if(!a)throw new Error("error generating geometry");let c=a.elementCount;if(l){a.elementCount+=l.elementCount;for(let g=0;g<l.elements.length;g++){let m=l.elements[g],y=g%2===0?a.vertexCount:0;a.elements.push(m+y)}for(let g=0;g<l.vertexIndices.length;g++){let m=l.vertexIndices[g],y=a.vertexCount;a.vertexIndices.push(m+y)}for(let g=0;g<l.vertices.length;g++){let m=l.vertices[g];a.vertices.push(m)}}let u=1/0,d=-1/0,h=1/0,p=-1/0;for(let g=0,m=a.vertexCount;g<m;g++){let y=g*2,v=a.vertices[y+0],b=a.vertices[y+1];v<u&&(u=v),v>d&&(d=v),b<h&&(h=b),b>p&&(p=b)}let f=[];for(let g=a.elementCount-1;g>=0;g--){let m=g>=c,y=g*2,v=a.elements[y+0],b=a.elements[y+1],x=v+b,S={start:v,count:b,normals:[],isHole:m,continuous:[],verticesStart:0,verticesCount:0};f.push(S);let E=v,T=x-1,w=v+1,_=r.roundedCurves.length;do{let A=E-v,C=a.vertices[T*2+0],P=a.vertices[T*2+1],D=a.vertices[E*2+0],O=a.vertices[E*2+1],L=a.vertices[w*2+0],U=a.vertices[w*2+1],G=D-C,Y=O-P,oe=Math.sqrt(G*G+Y*Y);G/=oe,Y/=oe;let ee=D-L,J=O-U,Q=Math.sqrt(ee*ee+J*J);ee/=Q,J/=Q,S.normals[A*2+0]=-J,S.normals[A*2+1]=ee;let re=a.vertexIndices[E];if(Array.isArray(re))S.continuous[A]=!1;else{let[me,ve]=r.getCurveIndexFromVertexId(re-1,!0);if(ve>0&&ve<1)S.continuous[A]=!0;else{let pe=ve===1?me+1:me-1;pe=(pe+_)%_;let Ee=ve===1?0:1,ce=r.roundedCurves[me].getTangent(ve),Se=r.roundedCurves[pe].getTangent(Ee);S.continuous[A]=ce.dot(Se)>.95}}m&&(S.normals[A*2+0]*=-1,S.normals[A*2+1]*=-1),[T,E,w]=[E,w,w+1],w>=x&&(w-=b)}while(w!==v+1)}return{regions:[s,...o],infos:f,vertices:a.vertices}}_insertVertex(e,n,r,s,o){let a=n*2,l=n*3;e.positions[l+0]=r.x,e.positions[l+1]=r.y,e.positions[l+2]=r.z,e.normals[l+0]=s.x,e.normals[l+1]=s.y,e.normals[l+2]=s.z,e.uvs[a+0]=o.x,e.uvs[a+1]=o.y}_extrudeRegion(e,n,r,s,o,a,l,c){let u=e.wallTemplate;if(u===void 0){u=[];for(let x=0;x<e.count;x++){let S=(e.start+x)*2,E=n[S+0],T=n[S+1],w,_;if(e.continuous[x])w=e.normals[x*2+0],_=e.normals[x*2+1];else{let C=x===0?(e.start+e.count-1)*2:S-2,P=E-n[C+0];w=-(T-n[C+1]),_=P,e.isHole||(w=-w,_=-_)}let A=x===0?1:x/e.count;if(u.push(E,T,w,_,A,0),!e.continuous[x]||x===0)if(x===0)u.push(E,T,e.normals[0],e.normals[1],0,1);else{let C=x===e.count-1?e.start*2:S+2,P=n[C+0]-E;w=-(n[C+1]-T),_=P,e.isHole||(w=-w,_=-_),u.push(E,T,w,_,A,1)}}e.wallTemplate=u}let d=r.length,h=u.length,p=o.positions,f=o.normals,g=o.uvs;for(let x=0;x<d;x++){let S=r[x].elements,E=S[0],T=S[1],w=S[2],_=S[4],A=S[5],C=S[6],P=S[12],D=S[13],O=S[14],L=s[x],U=x/(d-1),G=0,Y=0,oe=0,ee=e.verticesStart*d+e.verticesCount*x;for(let J=0;J<h;J+=6){if(u[J+5]===0){let Pe=u[J+0],Le=u[J+1];G=E*Pe+_*Le+P+L.x,Y=T*Pe+A*Le+D+L.y,oe=w*Pe+C*Le+O+L.z}let Q=u[J+2],re=u[J+3],me=E*Q+_*re+P,ve=T*Q+A*re+D,pe=w*Q+C*re+O,Ee=1/(Math.sqrt(me*me+ve*ve+pe*pe)||1);me*=Ee,ve*=Ee,pe*=Ee;let ce=ee*2,Se=ee*3;p[Se+0]=G,p[Se+1]=Y,p[Se+2]=oe,f[Se+0]=me,f[Se+1]=ve,f[Se+2]=pe,g[ce+0]=u[J+4],g[ce+1]=U,ee++}}let m=e.wallQuadPattern;if(m===void 0){m=[];let x=0;for(let S=0;S<e.count;S++)(!e.continuous[S]||S===0)&&x++,m.push(x,S===e.count-1?0:x+1),x++;e.wallQuadPattern=m}let y=d-1,v=m.length,b=e.isHole;for(let x=0;x<y;x++){let S=e.verticesStart*d+e.verticesCount*x,E=S+e.verticesCount;for(let T=0;T<v;T+=2){let w=S+m[T],_=S+m[T+1],A=E+m[T+1],C=E+m[T];b?(a[l++]=w,a[l++]=A,a[l++]=_,a[l++]=w,a[l++]=C,a[l++]=A):(a[l++]=w,a[l++]=_,a[l++]=A,a[l++]=w,a[l++]=A,a[l++]=C)}}return l}_closeEnd(e,n,r,s,o,a,l,c){let u=e.vertexCount,d=new M(0,0,c?-1:1).applyMatrix4(a),h=new M,p=new j;for(let g=0;g<u;g++){let m=2*g;h.set(e.vertices[m+0],e.vertices[m+1],0).applyMatrix4(a).add(l),this._insertVertex(o,n+g,h,d,p)}let f=e.elements;for(let g=0;g<e.elementCount;g++){let m=3*g;r[s++]=f[m+0]+n,r[s++]=f[m+(c?1:2)]+n,r[s++]=f[m+(c?2:1)]+n}return s}applyMatrix4OnRange(e,n,r){let s=e.elements,o=new wt().getNormalMatrix(e).elements,a,l,c,u,d=this.attributes.position,h=this.attributes.normal;if(!d||!h)return;let p=d.array,f=h.array,g=d.itemSize;for(let m=n*g,y=r*g;m<y;m+=g)a=p[m+0],l=p[m+1],c=p[m+2],u=1/(s[3]*a+s[7]*l+s[11]*c+s[15]),p[m+0]=(s[0]*a+s[4]*l+s[8]*c+s[12])*u,p[m+1]=(s[1]*a+s[5]*l+s[9]*c+s[13])*u,p[m+2]=(s[2]*a+s[6]*l+s[10]*c+s[14])*u,a=f[m+0],l=f[m+1],c=f[m+2],f[m+0]=o[0]*a+o[3]*l+o[6]*c,f[m+1]=o[1]*a+o[4]*l+o[7]*c,f[m+2]=o[2]*a+o[5]*l+o[8]*c;d.needsUpdate=!0,h.needsUpdate=!0}reverseIndicesOnRange(e,n){let r=this.index;if(r){for(let s=e;s<n;s+=3){let o=r.getX(s),a=r.getX(s+1),l=r.getX(s+2);r.setXYZ(s,l,a,o)}r.needsUpdate=!0}}};Qt();wo("PathGeometry",(i,t,e)=>new xE(i,t,e));nv("PathGeometry",NG);Mt("3d-paths");tv();Qt();So.Cloner=$s;Mt("cloners");on();gn();pt();X();Jy();tv();Xi();bu();Yi();OI();var Zv=class extends Mo(Bs,xo){constructor(e,n,r){super();this.isComponentObject=!0;n.type==="Instance"&&typeof e=="string"&&(n=this.transformAssignData(n,r)),this.super_Entity(e,n),this.objectHelper.update()}get isComponentRoot(){return this.data.type==="Component"&&typeof this.identity=="string"}get isInstanceRoot(){return this.data.type==="Instance"&&typeof this.identity=="string"}transformAssignData(e,n){let r=gu.getComponentData({scene:n.scene.data,shared:n.shared.data},e.component);if(r){let s,o;for(let a of go.rootOverrideProps)e[a]===void 0?(s===void 0&&(s={...e}),s[a]=r.data[a]):(o===void 0&&(o={}),o[a]=e[a],s===void 0&&(s={...e}),s[a]=Da.apply(r.data[a],e[a]));return this.overrideData=o,s}else return{...Fr.defaultData,...e,...Ly(Fr.defaultData,go.rootOverrideProps)}}updateByOp(e,n,r,s){let o;if(this.isInstanceRoot&&!s){if(n=this.transformAssignData(n,r),e.type===0&&e.path.length===0&&this.component)for(let a of go.rootOverrideProps)a in e.props&&e.props[a]===void 0&&(o===void 0&&(o={...e,props:{...e.props}}),o.props[a]=this.component.data[a]);else if(e.type===0&&e.path.length>0&&go.rootOverrideProps.includes(e.path[0])){let a=e.path[0];o===void 0&&(o={...e,path:[],props:{[a]:n[a]}})}}super.updateByOp(o??e,n,r,s)}updateState(e,n){this.updateState_Entity(e,n)}expandInstanceChildren(e){let n=this.data;if(this.component===void 0){let r=e.scene.find(n.component)??null,s=!1;if(r!==this.oldComponent){if(this.oldComponent){let o=0;for(let a of this.children)if(Ot.is(a))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),Kv(a),o+=1;else break;this.children.splice(0,o)}s=!0}if(r){let o={};FG(e,[this.uuid],n.overrides,this,r,r,0,s,o);for(let a of this.children)if(Ot.is(a)){let l=a.data;l.type==="Empty"&&l.animations&&a.traverseEntity(c=>{let u=c.dataPatched;if(c instanceof Xt&&u.bones&&u.boneInverses){let d=c.dataPatched;if(d.bones&&d.boneInverses){let h=d.bones.map(g=>e.scene.find(o[g])),p=d.boneInverses.map(g=>new ne().fromArray(g)),f=new Dl(h,p);c.bind(f,c.bindMatrix)}}else c.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function BG(i,t,e,n){return i.component===t&&ql(i.identity,n)?i.overrideData===e?2:1:0}function FG(i,t,e,n,r,s,o,a,l){if(o>50)return!1;if(n.component!==r){if(n.component){let u=n.component.instances.indexOf(n);u>=0&&n.component.instances.splice(u,1)}r.instances.find(u=>u===n)||r.instances.push(n),n.component=r}r instanceof Zv&&r.isInstanceRoot&&r.expandInstanceChildren(i);let c=0;for(let u of r.children)if(Ot.is(u)){let d=[...t,...typeof u.identity=="string"?[u.identity]:u.identity],h=rf.resolve(e,d,1);h!=null&&!(h instanceof Zn)&&(Object.setPrototypeOf(h,Zn.prototype),console.error("wrong prototype"));let p=null,f;if(!a){let g=n.children[c];if(p=Ot.is(g)?g:null,p!==null){let m=BG(p,u,h,d);f=m>=1?p.stateSelection:void 0,m!==2&&(p=null)}if(p===null&&(p=i.scene.findInstance(d)??null,p!==null)){let m=BG(p,u,h,d);if(f=m>=1?p.stateSelection:void 0,m!==2)p=null;else{let y=p.parent.children.indexOf(p);p.parent.children.splice(y,1),n.children.splice(c,0,p),p.parent===n?(y<=c&&console.error("not possible"),void 0):(p.parent=n,p.matrixWorldNeedsUpdate=!0,p.resetBBoxNeedsUpdate(),p.updateVisible(),i.pendingDeletes.delete(p),void 0)}}}if(p===null){let g=h?Da.apply(u.data,h):u.data;Jo.is(g.type)&&(g={...g,type:"Empty"}),p=So.createEntity(d,g,i),p.overrideData=h,n.add(p),n.children.splice(n.children.length-1,1),n.children.splice(c,0,p),p.updateState(p.data,i),f&&p.changeSelectedState(f,i),i.scene.registerInstanceAndSetUuid(p)}if(p.isBone){let g=p.identity[p.identity.length-1];l[g]=p.uuid}c+=1,FG(i,t,e,p,u,s,o+1,a,l)}if(!a){let u=c;for(;;){let d=n.children[c];if(Ot.is(d))i.pendingDeletes.add(d);else break;c+=1}n.children.splice(u,c-u)}return!0}Qt();var UG=(i,t,e)=>new Zv(i,t,e);Wd("Component",UG);Wd("Instance",UG);Mt("components");var DI=1e-10;function kG(i){let t=i[0][0],e=i[1][0],n=i[0][1],r=i[1][1],s=Math.sqrt(t*t+e*e),o=s>DI?t/s:1,a=s>DI?e/s:0,l=o*t+a*e,c=o*r-a*n,u=o*n+a*r;return{rotation:Math.atan2(a,o),scale:[l,c],shear:[Math.abs(c)>DI?u/c:0,0]}}function VG({rotation:i,scale:t,shear:e}){let n=Math.cos(i),r=Math.sin(i),s=e[0]*t[1],o=e[1]*t[0];return[n*t[0]-r*o,r*t[0]+n*o,n*s-r*t[1],r*s+n*t[1]]}var At;(S=>{function i(){return[1,0,0,0,1,0,0,0,1]}S.identity=i;function t(E,T=S.identity()){for(let w=0,_=E.length;w<_;w++)T[w]=E[w];return T}S.copy=t;function e(E,T,w,_,A,C){return S.setAbcdef(S.identity(),E,T,w,_,A,C)}S.create=e;function n(E,T,w,_,A,C,P){return E[0]=T,E[1]=_,E[2]=C,E[3]=w,E[4]=A,E[5]=P,E}S.setAbcdef=n;function r(E,T){let[w,_,A,C,P,D]=o(E),[O,L,U,G,Y,oe]=o(T),ee=O*w+L*A,J=O*_+L*C,Q=U*w+G*A,re=U*_+G*C,me=Y*w+oe*A+P,ve=Y*_+oe*C+D;return S.create(ee,J,Q,re,me,ve)}S.append=r;function s(E,T){let[w,_,A,C,P,D]=o(E),[O,L,U,G,Y,oe]=o(T),ee=w,J=_,Q=A,re=C;(O!==1||L!==0||U!==0||G!==1)&&(ee=w*O+_*U,J=w*L+_*G,Q=A*O+C*U,re=A*L+C*G);let me=P*O+D*U+Y,ve=P*L+D*G+oe;return S.create(ee,J,Q,re,me,ve)}S.prepend=s;function o(E){return[E[0],E[3],E[1],E[4],E[2],E[5]]}S.getAbcdef=o;function a(E){let[T,w,_,A,C,P]=S.getAbcdef(E),D=T*A-w*_,O=A/D,L=-w/D,U=-_/D,G=T/D,Y=(_*P-A*C)/D,oe=-(T*P-w*C)/D;return S.create(O,L,U,G,Y,oe)}S.invert=a;function l([E,T],w){let[_,A,C,P,D,O]=S.getAbcdef(w);return[_*E+C*T+D,A*E+P*T+O]}S.apply=l;function c(E,T){let[w,_,A,C,P,D]=S.getAbcdef(T),O=1/(w*C+A*-_),[L,U]=E;return[C*O*L+-A*O*U+(D*A-P*C)*O,w*O*U+-_*O*L+(-D*w+P*_)*O]}S.applyInverse=c;function u(E,T,w=T){let[_,A,C,P,D,O]=S.getAbcdef(E);return S.setAbcdef(E,_*T,A*w,C*T,P*w,D*T,O*w),E}S.scale=u;function d(E,T){let w=Math.cos(T),_=Math.sin(T),[A,C,P,D,O,L]=S.getAbcdef(E);return S.setAbcdef(E,A*w-C*_,A*_+C*w,P*w-D*_,P*_+D*w,O*w-L*_,O*_+L*w),E}S.rotate=d;function h(E,T,w){let[_,A]=w,C=S.translate(E,-_,-A);return C=S.rotate(C,T),C=S.translate(C,_,A),C}S.rotateAround=h;function p(E,T,w){let[_,A,C,P,D,O]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,P,D+T,O+w),E}S.translate=p;function f(E,T,w){let[_,A,C,P]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,P,T,w),E}S.setTranslate=f;function g(E,T,w){let[_,A,C,P]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,P,T,w),E}S.setPosition=g;function m(E){let[T,w,_,A]=S.getAbcdef(E),C=Math.sqrt(T*T+w*w),P=Math.sqrt(_*_+A*A);return[C,P]}S.getScale=m;function y(E){let[,,,,T,w]=S.getAbcdef(E);return[T,w]}S.getPosition=y;function v(E,T){return S.decompose(E,T).rotation}S.getRotation=v;function b(E,T){let[w,_,A,C,P,D]=S.getAbcdef(E),{rotation:O,scale:L,shear:U}=kG([[w,A],[_,C]]);return{position:[P+(T[0]*w+T[1]*A)-T[0],D+(T[0]*_+T[1]*C)-T[1]],scale:L,rotation:O,shear:U,pivot:T}}S.decompose=b;function x(E,T,w,_,A=[0,0]){let[C,P]=E,[D,O]=_,[L,U,G,Y]=VG({rotation:w,scale:T,shear:A}),oe=C-(D*L+O*G)+D,ee=P-(D*U+O*Y)+O;return S.create(L,U,G,Y,oe,ee)}S.compose=x})(At||(At={}));function Ite(i,t){let[[e,n],[r,s]]=i,[[o,a],[l,c]]=t,u=(e-r)*(a-c)-(n-s)*(o-l);if(u===0)return!1;let d=((e-o)*(a-c)-(n-a)*(o-l))/u,h=-((e-r)*(n-a)-(n-s)*(e-o))/u;return d>=0&&d<=1&&h>=0&&h<=1}var GG=[[-1,1],[-1,-1],[1,-1],[1,1]],zG=(i,t,e)=>{let n=i.getCenter(),r=i.getHalfSize(),s=At.append(t,i.worldMatrix);r[0]===0&&r[1]===0?e.push(At.apply(n,s)):GG.forEach(o=>{let a=[o[0]*r[0]+n[0],o[1]*r[1]+n[1]];e.push(At.apply(a,s))})},Pu=class{constructor(){this.matrix=At.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(),At.copy(t.worldMatrix,this.matrix);let n=At.invert(t.worldMatrix);this.expandByObjectSize(t,n,e)}expandByObjectSize(t,e,n=!1){let r=[],s=t.isBaseGroup===!0?t:void 0;n===!0&&s!==void 0?s.traverse(o=>{o.visible&&zG(o,e,r)}):zG(t,e,r),this.setFromPoints(r)}setFromSize(t,e,n){this.makeEmpty(),At.copy(n,this.matrix),this.expandBySize(t,e,n)}expandBySize(t,e,n){[At.apply([0,0],n),At.apply([0,e],n),At.apply([t,e],n),At.apply([t,0],n)].forEach(s=>this.expandByPoint(s))}getCenter(){let[t,e]=this.min,[n,r]=this.getHalfSize();return At.apply([t+n,e+r],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}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(),n=this.getCenter(),[r,s,o,a]=At.getAbcdef(this.matrix),l=At.create(r,s,o,a,n[0],n[1]);this.vertices=GG.map(([c,u])=>At.apply([c*t,u*e],l))}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 n=this.matrix;return e&&(n=At.append(e.worldMatrix,n)),At.applyInverse(t,n)}intersects(t,e,n){return this.intersectsInLocalSpace(...this.project([t,e],n))}intersectsInLocalSpace(t,e){let{min:n,max:r}=this;return t>=n[0]&&t<=r[0]&&e>=n[1]&&e<=r[1]}containsPoint(t){let[e,n]=t,[r,s]=this.min,[o,a]=this.max;return e>=r&&e<=o&&n>=s&&n<=a}intersectsBBox2D(t){for(let e=0,n=this.edges.length;e<n;e++){let r=this.edges[e];for(let s=0,o=t.edges.length;s<o;s++){let a=t.edges[s];if(Ite(r,a))return!0}}for(let e=0,n=t.vertices.length;e<n;e++){let r=t.vertices[e];if(this.containsPoint(r))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],At.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new Pu;return t.copy(this),t}};pt();var Rte='{"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":{}}',jG=()=>JSON.parse(Rte);async function Ote(i,t){return await i.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(i.Engine.prototype,"scene")||Object.defineProperty(i.Engine.prototype,"scene",{get:function(){let e=Object.create(i.SceneController.prototype);return e.__wbg_ptr=this.__wbg_ptr,e}}),{createEngine:e=>i.Engine.create(e,jG(),!0)}}var SE,Qv;function Dte(i){SE=i}function LI(){if(!Qv){if(!SE)return Promise.reject(new Error("HanaRenderer: no Hana UI loader registered. Call setHanaUILoader() from the host app before initializing a HanaRenderer."));Qv=SE(),Qv.catch(()=>{Qv=void 0})}return Qv}var HG;function Lte(){let i=typeof process<"u"?"2.0.27":void 0;return`https://cdn.spline.design/@splinetool/runtime${i?`@${i}`:""}/build/hana-ui.wasm`}function WG(i){HG=i}function qG(){return SE||Dte(async()=>{let t=await import("./hana-ui.js");return Ote(t,HG??Lte())}),LI().then(()=>{})}var TE=Qu(EE(),1);function KG(i){let t=[],e;try{e=(0,TE.makeAbsolute)((0,TE.parseSVG)(i))}catch(c){return console.error("[HanaRenderer] Failed to parse SVG path:",c),t}let n=0,r=0,s=0,o=0,a=null,l=null;for(let c of e){let u=null,d=null;switch(c.code){case"M":n=s=c.x,r=o=c.y,t.push({MoveTo:{x:n,y:r}});break;case"L":n=c.x,r=c.y,t.push({LineTo:{x:n,y:r}});break;case"H":n=c.x,t.push({LineTo:{x:n,y:r}});break;case"V":r=c.y,t.push({LineTo:{x:n,y:r}});break;case"C":{let h={x:c.x1,y:c.y1},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"S":{let h=a?{x:2*n-a.x,y:2*r-a.y}:{x:n,y:r},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"Q":{let h={x:c.x1,y:c.y1};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"T":{let h=l?{x:2*n-l.x,y:2*r-l.y}:{x:n,y:r};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"A":{let h=n,p=r;n=c.x,r=c.y,Ute(t,h,p,c.rx,c.ry,c.xAxisRotation,c.largeArc,c.sweep,n,r);break}case"Z":n=s,r=o,t.push("ClosePath");break}a=u,l=d}return t}function Ute(i,t,e,n,r,s,o,a,l,c){if(t===l&&e===c)return;if(n=Math.abs(n),r=Math.abs(r),n===0||r===0){i.push({LineTo:{x:l,y:c}});return}let u=s*Math.PI/180,d=Math.cos(u),h=Math.sin(u),p=(t-l)/2,f=(e-c)/2,g=d*p+h*f,m=-h*p+d*f,y=g*g/(n*n)+m*m/(r*r);if(y>1){let ee=Math.sqrt(y);n*=ee,r*=ee}let v=n*n,b=r*r,x=v*b-v*m*m-b*g*g,S=v*m*m+b*g*g,E=(o!==a?1:-1)*Math.sqrt(Math.max(0,x/S)),T=E*(n*m)/r,w=E*(-r*g)/n,_=d*T-h*w+(t+l)/2,A=h*T+d*w+(e+c)/2,C=Math.atan2((m-w)/r,(g-T)/n),D=Math.atan2((-m-w)/r,(-g-T)/n)-C;!a&&D>0?D-=2*Math.PI:a&&D<0&&(D+=2*Math.PI);let O=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2))),L=D/O,U=4/3*Math.tan(L/4),G=C,Y=t,oe=e;for(let ee=0;ee<O;ee++){let J=G+L,Q=Math.cos(G),re=Math.sin(G),me=Math.cos(J),ve=Math.sin(J),pe=_+n*me*d-r*ve*h,Ee=A+n*me*h+r*ve*d,ce=-n*re*d-r*Q*h,Se=-n*re*h+r*Q*d,Pe=-n*ve*d-r*me*h,Le=-n*ve*h+r*me*d;i.push({CurveTo:[{x:Y+U*ce,y:oe+U*Se},{x:pe-U*Pe,y:Ee-U*Le},{x:pe,y:Ee}]}),G=J,Y=pe,oe=Ee}}var _E=.5522847498307936,zte=150,Gte=5*60*1e3,jte=(2728+680)/2816,Hte=1536/2816;function Wte(i){try{let t=new DataView(i),e=t.getUint32(0);if(e!==65536&&e!==1330926671&&e!==1953658213)return;let n=t.getUint16(4),r=-1,s=-1;for(let c=0;c<n;c++){let u=12+c*16,d=t.getUint32(u);d===1751474532&&(r=t.getUint32(u+8)),d===1330851634&&(s=t.getUint32(u+8))}if(r<0||s<0)return;let o=t.getUint16(r+18),a=t.getUint16(s);if(o===0||a<2)return;let l=t.getInt16(s+86);return l>0?l/o:void 0}catch{return}}var ZG=!1;function QG(){ZG||(ZG=!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 AE=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=At.identity();this._stack=[];this._clips=[];this._pathEls=[];this._simpleShape=null;this._pathPrimitives=0;this._fillColor=Vt.transparent;this._strokeColor=Vt.transparent;this._lineWidth=1;this._strokeMode="inside";this._layerBlur=0;this._backgroundBlur=0;this._dropShadowBlur=0;this._dropShadowOffsetX=0;this._dropShadowOffsetY=0;this._dropShadowColor=Vt.transparent;this._innerShadowBlur=0;this._innerShadowOffsetX=0;this._innerShadowOffsetY=0;this._innerShadowSpread=0;this._innerShadowColor=Vt.transparent;this._fonts=new Map;this._fontsFlushed=new Set;this._fontXPerEm=new Map;this._measureCache=new Map;try{let n=t.getBoundingClientRect();t.width=n.width*e,t.height=n.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 LI(),this._engine=await this._context.createEngine(this.canvas)}catch(t){this._crashed=!0,console.error("[HanaRenderer] Failed to load the Hana UI engine; UI scenes will not render.",t);return}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||typeof e.scene.isUiFontLoaded!="function"){t();return}let n=()=>{let o=!1;return this._guard(()=>{o=e.scene.isUiFontLoaded()}),o};if(n()){t();return}let r=Date.now(),s=setInterval(()=>{if(this._crashed||Date.now()-r>Gte){clearInterval(s);return}n()&&(clearInterval(s),t())},zte)})}_syncViewport(){let t=this._engine;if(!t||this._crashed)return;let e=this._width,n=this._height;this.canvas.style.width=e+"px",this.canvas.style.height=n+"px",this.canvas.width=Math.max(1,Math.ceil(e*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(n*this._dpr)),this._guard(()=>{t.resize([e,n],this._dpr),t.scene.updateCamera({position:[e/2,n/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(e){this._crashed=!0,console.error("[HanaRenderer] Hana engine call failed; disabling this renderer instance.",e)}}async loadFont(t,e){try{let n=await fetch(t);if(!n.ok){console.error(`[HanaRenderer] loadFont: ${t} returned HTTP ${n.status}; skipping "${e}"`);return}let r=await n.arrayBuffer();if(r.byteLength===0){console.error(`[HanaRenderer] loadFont: ${t} was empty; skipping "${e}"`);return}this.registerFont(r,e)}catch(n){console.error(`[HanaRenderer] loadFont failed for "${e}" (${t}):`,n)}}registerFont(t,e){if(this._fonts.has(e))return;this._fonts.set(e,t);let n=Wte(t);n!==void 0&&this._fontXPerEm.set(e,n),this._flushFonts()}_flushFonts(){let t=this._engine;if(!!t)for(let[e,n]of this._fonts)this._fontsFlushed.has(e)||(this._fontsFlushed.add(e),this._guard(()=>{t.scene.addLocalFont(e,new Uint8Array(n))}))}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:At.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 n=At.identity();if(this.camera?.enabled&&(n=At.append(n,this.camera.worldMatrix),e)){let r=At.getScale(this.camera.worldMatrix);n=At.scale(n,1/r[0],1/r[1])}this._ctm=At.append(n,t)}transform(t){this._ctm=At.append(this._ctm,t)}beginPath(){this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0}closePath(){this._pathEls.length!==0&&this._pathEls[this._pathEls.length-1]!=="ClosePath"&&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,n,r,s,o){this._startFreeform(),this._pathEls.push({CurveTo:[{x:t,y:e},{x:n,y:r},{x:s,y:o}]})}quadraticCurveTo(t,e,n,r){this._startFreeform(),this._pathEls.push({QuadTo:[{x:t,y:e},{x:n,y:r}]})}path(t){this._startFreeform(),this._pathEls.push(...KG(t))}rect(t,e,n,r,s=0,o=0,a=0,l=0){if(!t4([t,e,n,r]))return;let c={x:t,y:e,w:n,h:r,radii:[s,o,a,l]};this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"rect",rect:c,smoothing:0}:null,n4(this._pathEls,c)}ellipse(t,e,n,r,s,o,a,l){if(!!t4([t,e,n,r])){if(n<0||r<0)throw Error("radii cannot be negative");this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"ellipse",cx:t,cy:e,rx:n,ry:r}:null,$te(this._pathEls,t,e,n,r)}}clipRect(t,e,n,r,s=0,o=0,a=0,l=0){let c=At.invert(this._ctm);!c||this._clips.push({m:At.copy(this._ctm),inv:c,rect:{x:t,y:e,w:n,h:r,radii:[s,o,a,l]}})}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 n=this._classifyShape();if(!n)return;let r=this._applyClips(n);if(r==="skip")return;if(!t&&r!==n){let o=Jv(n);if(o){this._emitClippedRectStroke(o,e);return}}n=r;let s={shape:n,color:t?im(this._fillColor):[0,0,0,0],transform:At.getAbcdef(this._ctm)};t||(s.stroke=this._strokeDesc()),e&&(s.effect_chain=e),this._shapes.push(s)}_emitClippedRectStroke(t,e){let n=this._lineWidth,r=this._strokeMode==="outside"?n:this._strokeMode==="center"?n/2:0,s=n-r,o=Math.min(t.w,t.h)/2,a=t.radii.map(y=>Math.max(0,Math.min(y,o))),l={x:t.x-r,y:t.y-r,w:t.w+r*2,h:t.h+r*2,radii:a.map(y=>y>0?y+r:0)},c=t.w-s*2,u=t.h-s*2,d=c>0&&u>0?{x:t.x+s,y:t.y+s,w:c,h:u,radii:a.map(y=>Math.max(0,y-s))}:null,h=this._applyClips(ME(l,0));if(h==="skip")return;let p=Jv(h)??l,f=null;if(d){let y=this._applyClips(ME(d,0));f=y==="skip"?null:Jv(y)??d}let g=[];n4(g,p),f&&Yte(g,f);let m={shape:{Custom:g},color:im(this._strokeColor),transform:At.getAbcdef(this._ctm)};e&&(m.effect_chain=e),this._shapes.push(m)}_classifyShape(){let t=this._simpleShape;return t?t.kind==="rect"?ME(t.rect,t.smoothing):{Ellipse:{center_x:t.cx,center_y:t.cy,rx:t.rx,ry:t.ry}}:this._pathEls.length===0?null:{Custom:this._pathEls.slice()}}_strokeDesc(){return{width:this._lineWidth,line_join:"Miter",color:im(this._strokeColor),align:qte[this._strokeMode],cap:"Butt"}}_effectChain(t){let e=this.camera?.scale??1,n=[];if(t&&this._dropShadowColor.a>0&&n.push({DropShadow:{position:[this._dropShadowOffsetX*e,this._dropShadowOffsetY*e],blur:{Uniform:{size:2*this._dropShadowBlur*e}},spread:0,color:im(this._dropShadowColor)}}),t&&this._backgroundBlur>0){let[r,s]=At.getScale(this._ctm),o=(r+s)/2;n.push({BackgroundBlur:{blur:{Uniform:{size:2*this._backgroundBlur*o}}}})}if(this._layerBlur>0&&n.push({LayerBlur:{blur:{Uniform:{size:2*this._layerBlur*e}}}}),t&&this._innerShadowColor.a>0){let[r,s,o,a]=At.getAbcdef(this._ctm),l=this._innerShadowOffsetX,c=this._innerShadowOffsetY;n.push({InnerShadow:{position:[r*l+o*c,s*l+a*c],blur:{Uniform:{size:2*this._innerShadowBlur*e}},spread:this._innerShadowSpread*e,color:im(this._innerShadowColor)}})}return n.length>0?n:void 0}_applyClips(t,e=this._ctm){if(this._clips.length===0)return t;let n=t;for(let r of this._clips){let s=At.append(r.inv,e),[o,a,l,c,u,d]=At.getAbcdef(s),h=Math.abs(a)<=1e-6*(Math.abs(o)+Math.abs(c))&&Math.abs(l)<=1e-6*(Math.abs(o)+Math.abs(c)),p=Xte(n);if(!p)return n;if(!h){QG();continue}let f=o*p.minX+u,g=o*p.maxX+u,m=c*p.minY+d,y=c*p.maxY+d,v=Math.min(f,g),b=Math.max(f,g),x=Math.min(m,y),S=Math.max(m,y),E=r.rect,T=Math.max(v,E.x),w=Math.max(x,E.y),_=Math.min(b,E.x+E.w),A=Math.min(S,E.y+E.h);if(T>=_||w>=A)return"skip";if(T===v&&w===x&&_===b&&A===S)continue;let P=Jv(n);if(!P||o===0||c===0){QG();continue}let D=(T-u)/o,O=(_-u)/o,L=(w-d)/c,U=(A-d)/c,G=Math.min(D,O),Y=Math.min(L,U),oe=Math.abs(O-D),ee=Math.abs(U-L),[J,Q,re,me]=P.radii,ve=G!==P.x,pe=Y!==P.y,Ee=G+oe!==P.x+P.w,ce=Y+ee!==P.y+P.h,Se=Math.min(oe,ee)/2,Pe=[ve||pe?0:Math.min(J,Se),Ee||pe?0:Math.min(Q,Se),Ee||ce?0:Math.min(re,Se),ve||ce?0:Math.min(me,Se)];n=ME({x:G,y:Y,w:oe,h:ee,radii:Pe},0)}return n}drawText(t,e){let n=this._fontXPerEm.get(e.font),r=n?n/Hte:1,s={TextSimple:{text:t,font_size:e.fontSize*jte*r,size:[e.width,e.height],horizontal_align:JG[e.horizontalAlign]??"Left",vertical_align:e4[e.verticalAlign]??"Top"}},o=this._effectChain(!0),a=this._fillColor.a>0,l=this._strokeColor.a>0&&this._lineWidth>0;if(a||l||o){let c=At.append(this._ctm,At.translate(At.identity(),e.x,e.y));if(this._applyClips(s,c)!=="skip"){let u={shape:s,color:a?im(this._fillColor):[0,0,0,0],transform:At.getAbcdef(c)};l&&(u.stroke=this._strokeDesc()),o&&(u.effect_chain=o),this._shapes.push(u)}}return{height:this._measureTextHeight(t,e)}}_measureTextHeight(t,e){let n=`${e.font}|${e.fontSize}|${e.lineHeight}|${e.letterSpacing}|${e.width}|${t}`,r=this._measureCache.get(n);if(r!==void 0)return r;let s=0,o=this._engine;if(o&&!this._crashed&&this._fontsFlushed.has(e.font))try{let[,a]=o.scene.measureTextNaturalSize({size:[e.width,e.height],text:t,fontSize:e.fontSize,horizontalAlign:JG[e.horizontalAlign]??"Left",verticalAlign:e4[e.verticalAlign]??"Top",lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textTransform:"None",font:e.font,version:0,autoSize:"None",truncate:"None"});s=a}catch{}if(!(s>0)){let a=e.fontSize*.55+Math.max(0,e.letterSpacing),l=Math.max(1,Math.floor(e.width/a)),c=0;for(let u of t.split(`
9790
9790
  `))c+=Math.max(1,Math.ceil(u.length/l));s=c*e.fontSize*e.lineHeight}return this._measureCache.size>512&&this._measureCache.clear(),this._measureCache.set(n,s),s}clear(){this._shapes=[],this._ctm=At.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())}},qte={inside:"Inside",outside:"Outside",center:"Center"},JG={[1]:"Left",[2]:"Right",[3]:"Center",[4]:"Justify"},e4={[1]:"Top",[2]:"Center",[3]:"Bottom"};function im({r:i,g:t,b:e,a:n}){return[i,t,e,n]}function t4(i){for(let t=0;t<i.length;t++)if(i[t]!==void 0&&!Number.isFinite(i[t]))return!1;return!0}function ME(i,t){let[e,n,r,s]=i.radii;return e===0&&n===0&&r===0&&s===0?{Rectangle:{x:i.x,y:i.y,width:i.w,height:i.h}}:{RoundedRectangle:{x:i.x,y:i.y,width:i.w,height:i.h,radius:[e,n,r,s],corner_smoothing:t}}}function Jv(i){if("Rectangle"in i){let t=i.Rectangle;return{x:t.x,y:t.y,w:t.width,h:t.height,radii:[0,0,0,0]}}if("RoundedRectangle"in i){let t=i.RoundedRectangle;return{x:t.x,y:t.y,w:t.width,h:t.height,radii:[t.radius[0],t.radius[1],t.radius[2],t.radius[3]]}}return null}function Xte(i){let t=Jv(i);if(t)return{minX:t.x,minY:t.y,maxX:t.x+t.w,maxY:t.y+t.h};if("Ellipse"in i){let e=i.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 i){let e=i.TextSimple;return{minX:0,minY:0,maxX:e.size[0],maxY:e.size[1]}}if("Custom"in i){let e=1/0,n=1/0,r=-1/0,s=-1/0,o=a=>{a.x<e&&(e=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>s&&(s=a.y)};for(let a of i.Custom)a!=="ClosePath"&&("MoveTo"in a?o(a.MoveTo):"LineTo"in a?o(a.LineTo):"QuadTo"in a?a.QuadTo.forEach(o):"CurveTo"in a&&a.CurveTo.forEach(o));return e===1/0?null:{minX:e,minY:n,maxX:r,maxY:s}}return null}function n4(i,t){let{x:e,y:n,w:r,h:s}=t,o=Math.min(r,s)/2,[a,l,c,u]=t.radii.map(h=>Math.max(0,Math.min(h,o)));if(a===0&&l===0&&c===0&&u===0){i.push({MoveTo:{x:e,y:n}},{LineTo:{x:e+r,y:n}},{LineTo:{x:e+r,y:n+s}},{LineTo:{x:e,y:n+s}},"ClosePath");return}let d=1-_E;i.push({MoveTo:{x:e+a,y:n}}),i.push({LineTo:{x:e+r-l,y:n}}),l>0&&i.push({CurveTo:[{x:e+r-l*d,y:n},{x:e+r,y:n+l*d},{x:e+r,y:n+l}]}),i.push({LineTo:{x:e+r,y:n+s-c}}),c>0&&i.push({CurveTo:[{x:e+r,y:n+s-c*d},{x:e+r-c*d,y:n+s},{x:e+r-c,y:n+s}]}),i.push({LineTo:{x:e+u,y:n+s}}),u>0&&i.push({CurveTo:[{x:e+u*d,y:n+s},{x:e,y:n+s-u*d},{x:e,y:n+s-u}]}),i.push({LineTo:{x:e,y:n+a}}),a>0&&i.push({CurveTo:[{x:e,y:n+a*d},{x:e+a*d,y:n},{x:e+a,y:n}]}),i.push("ClosePath")}function Yte(i,t){let{x:e,y:n,w:r,h:s}=t,o=Math.min(r,s)/2,[a,l,c,u]=t.radii.map(h=>Math.max(0,Math.min(h,o)));if(a===0&&l===0&&c===0&&u===0){i.push({MoveTo:{x:e,y:n}},{LineTo:{x:e,y:n+s}},{LineTo:{x:e+r,y:n+s}},{LineTo:{x:e+r,y:n}},"ClosePath");return}let d=1-_E;i.push({MoveTo:{x:e+a,y:n}}),a>0&&i.push({CurveTo:[{x:e+a*d,y:n},{x:e,y:n+a*d},{x:e,y:n+a}]}),i.push({LineTo:{x:e,y:n+s-u}}),u>0&&i.push({CurveTo:[{x:e,y:n+s-u*d},{x:e+u*d,y:n+s},{x:e+u,y:n+s}]}),i.push({LineTo:{x:e+r-c,y:n+s}}),c>0&&i.push({CurveTo:[{x:e+r-c*d,y:n+s},{x:e+r,y:n+s-c*d},{x:e+r,y:n+s-c}]}),i.push({LineTo:{x:e+r,y:n+l}}),l>0&&i.push({CurveTo:[{x:e+r,y:n+l*d},{x:e+r-l*d,y:n},{x:e+r-l,y:n}]}),i.push("ClosePath")}function $te(i,t,e,n,r){let s=n*_E,o=r*_E;i.push({MoveTo:{x:t+n,y:e}},{CurveTo:[{x:t+n,y:e+o},{x:t+s,y:e+r},{x:t,y:e+r}]},{CurveTo:[{x:t-s,y:e+r},{x:t-n,y:e+o},{x:t-n,y:e}]},{CurveTo:[{x:t-n,y:e-o},{x:t-s,y:e-r},{x:t,y:e-r}]},{CurveTo:[{x:t+s,y:e-r},{x:t+n,y:e-o},{x:t+n,y:e}]},"ClosePath")}function NI(i){let t=!1;return i.scene.objects.traverse((e,n)=>{(n.type==="Mesh"&&n.geometry.type==="UIGeometry"||n.type==="Page"&&n.uiFrame!==void 0)&&(t=!0)}),t}pt();pt();var Kte=Math.PI/180,hDe=180/Math.PI;function r4(i,t,e,n,r,s){let o=i-e,a=t-n;return o*o/(r*r)+a*a/(s*s)<=1}function i4(i){return i*Kte}on();function gc(i){return{all:i=i||new Map,on:function(t,e){var n=i.get(t);n?n.push(e):i.set(t,[e])},off:function(t,e){var n=i.get(t);n&&(e?n.splice(n.indexOf(e)>>>0,1):i.set(t,[]))},emit:function(t,e){var n=i.get(t);n&&n.slice().map(function(r){r(e)}),(n=i.get("*"))&&n.slice().map(function(r){r(t,e)})}}}var yc=class{constructor(t,e,n){this.uuid=t;this.data=e;this.isObject2D=!0;this.localMatrix=At.identity();this.worldMatrix=At.identity();this.ignoreCameraZoom=!1;this.visible=!0;this._singleBBox=new Pu;this._recursiveBBox=new Pu;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=gc();this.dpr=n.dpr??1,this.dataPatched=e}project(t,e){let n=this.worldMatrix;return e&&(n=At.append(e.worldMatrix,n)),At.applyInverse(t,n)}intersects(t,e,n,r=!1){return this.visible&&!this.data.raycastLock&&this.intersectsInLocalSpace(...this.project([t,e],n),r)}intersectsInLocalSpace(t,e,n=!1){let{min:r,max:s}=n?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=At.compose(this.position,this.scale,i4(this.rotation),nc.getPivot(this.dataPatched),this.shear)}updateWorldMatrix(t,e,n){let r=this.parent;e&&r!==null&&r!==void 0&&r.updateWorldMatrix(t,!0,!1),t&&this.updateLocalMatrix(),this.parent?this.worldMatrix=At.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=At.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return nc.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;t.position!==void 0&&(e=!0,this.position=t.position),t.rotation!==void 0&&(e=!0,this.rotation=t.rotation),t.scale!==void 0&&(e=!0,this.scale=t.scale),t.shear!==void 0&&(e=!0,this.shear=t.shear),e&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(t,e,n){t.type===0&&t.props.visible!==void 0&&(this.visible=t.props.visible),this.data=e,this.data=e;let r=t,s=$t(t.path,["states","*"]);if(s!==null){if(t.type===0){let[o]=s;if(this?.stateSelection===o){let a={...t.props};if(delete a.name,Object.values(t.props).some(l=>l===void 0)){let l=this.data;if(l!==void 0){let c=rr.zoom(l,t.path.slice(2));if(c)for(let u in t.props)t.props[u]===void 0&&u in c&&(a[u]=c[u])}}r={...t,props:a,path:t.path.slice(2)}}}}else if(t.type===0){let o=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(o!==void 0){if(t.props.name!==void 0&&o.name){let{name:l,...c}=o;o=c}let a=rr.removeOverridden(t.path,t.props,o);r={...t,props:a}}}this.updateByPatchedOpBase(r,tc.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n)}changeSelectedState(t,e,n=!1){if(!(this.data.states.length===0&&!n)){for(let r of this.data.states)tc.toOps(this.data,r.data).forEach(o=>{let a=jp.replaceProps(o,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,e)});if(t!==null){let r=this.data.states.data(t);r&&(this.dataPatched=tc.patch(this.data,r),tc.toOps(this.data,r).forEach(o=>{this.updateByPatchedOp(o,this.dataPatched,e)}))}n&&this.updateTransformState(this.dataPatched),this.stateSelection=t}}updateState(t,e){t.name!==void 0&&(this.name=t.name),t.visible!==void 0&&(this.visible=t.visible),this.updateTransformState(t)}updateByPatchedOpBase(t,e,n){this.dataPatched=e,this.updateByPatchedOp(t,e,n)}updateByPatchedOp(t,e,n){t.path.length===0&&t.type===0&&this.updateState(t.props,n),this.requestRender()}traverseFrameAncestors(t){this.traverseAncestors(e=>{e.data.type==="frame2d"&&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 yc(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 n=e.indexOf(this)+1;return e[n]?e[n]:t.traverseSortNextHelper()}}}sortNext(){let t=this.children;return t&&t.length>0&&t[0]?t[0]:this.traverseSortNextHelper()}isDescendantOf(t){t instanceof yc&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}};on();pt();var eb=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.color=Vt.transparent;this.blurRadius=0;this.offset=[0,0];this.spread=0;this.update(e)}update(t){t.color!==void 0&&(this.color=t.color),t.enabled!==void 0&&(this.enabled=t.enabled),t.blurRadius!==void 0&&(this.blurRadius=t.blurRadius),t.offset!==void 0&&(this.offset=t.offset),t.spread!==void 0&&(this.spread=t.spread)}};var tb=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.radius=0;this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.radius!==void 0&&(this.radius=t.radius)}};pt();var CE=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.color=Vt.transparent;this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.color!==void 0&&(this.color=t.color)}};pt();var PE=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.color=Vt.transparent;this.thickness=0;this.mode="inside";this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.color!==void 0&&(this.color=t.color),t.thickness!==void 0&&(this.thickness=t.thickness),t.mode!==void 0&&(this.mode=t.mode)}};var sr=class extends yc{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.autoClose=!0;this.fill=new CE(e+"-fill",n.fill,r),this.stroke=new PE(e+"-stroke",n.stroke,r),this.dropShadow=new eb(e+"-dropShadow",n.dropShadow,r),this.innerShadow=new eb(e+"-innerShadow",n.innerShadow,r),this.backgroundBlur=new tb(e+"-backgroundBlur",n.backgroundBlur,r),this.layerBlur=new tb(e+"-layerBlur",n.layerBlur,r)}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:Vt.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Vt.transparent,e.strokeMode=this.stroke.mode,e.lineWidth=this.stroke.thickness}applyFilters(e){this.layerBlur.enabled?e.layerBlur=this.layerBlur.radius*5:e.layerBlur=0,this.backgroundBlur.enabled?e.backgroundBlur=this.backgroundBlur.radius*5:e.backgroundBlur=0,this.dropShadow.enabled?(e.dropShadowBlur=this.dropShadow.blurRadius*5,e.dropShadowColor=this.dropShadow.color,e.dropShadowOffsetX=this.dropShadow.offset[0],e.dropShadowOffsetY=this.dropShadow.offset[1]):e.dropShadowColor=Vt.transparent,this.innerShadow.enabled?(e.innerShadowSpread=this.innerShadow.spread,e.innerShadowBlur=this.innerShadow.blurRadius*5,e.innerShadowColor=this.innerShadow.color,e.innerShadowOffsetX=this.innerShadow.offset[0],e.innerShadowOffsetY=this.innerShadow.offset[1]):e.innerShadowColor=Vt.transparent}innerDraw(e){}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.applyFilters(e),this.applyFillStroke(e),e.beginPath(),this.innerDraw(e),this.autoClose&&e.closePath(),this.fill.enabled&&e.fill(),this.stroke.enabled&&e.stroke(),e.restore())}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.type===0&&($t(e.path,["fill"])?this.fill.update(e.props):$t(e.path,["stroke"])?this.stroke.update(e.props):$t(e.path,["dropShadow"])?this.dropShadow.update(e.props):$t(e.path,["innerShadow"])?this.innerShadow.update(e.props):$t(e.path,["layerBlur"])?this.layerBlur.update(e.props):$t(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}updateState(e,n){super.updateState(e,n),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur)}clone(e){let n=new sr(this.uuid,this.data,e);return n.parent=void 0,n}};var Iu=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.width=0;this.height=0;this.updateState(n,r)}innerDraw(e){e.ellipse(this.width*.5,this.height*.5,this.width*.5,this.height*.5,0,0,Math.PI*2)}intersectsInLocalSpace(e,n){return r4(e,n,this.width*.5,this.height*.5,this.width*.5,this.height*.5)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,n){super.updateState(e,n),this.updateSizeState(e)}clone(e){let n=new Iu(this.uuid,this.data,e);return n.parent=void 0,n}};var Ro=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.width=0;this.height=0;this.cornerRadius=[0,0,0,0];this.updateState(n,r)}innerDraw(e){e.rect(0,0,this.width,this.height,...this.cornerRadius)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,n){super.updateState(e,n),this.updateSizeState(e),this.updateCornerState(e)}clone(e){let n=new Ro(this.uuid,this.data,e);return n.parent=void 0,n}};pt();var Ru=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this._textHeight=0;this._textHeightDirty=!0;this.width=0;this.height=0;this.updateState(n,r)}get textHeight(){return this._textHeight}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:Vt.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Vt.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}innerDraw(e){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&e.registerFont(this._fontHolder.arrayBuffer,this.data.font);let n=this.data.textTransform,r=this.data.text.textValue.toString(),s=n===2?r.toUpperCase():n===3?r.toLowerCase():r,{height:o}=e.drawText(s,{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=o}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(e,{shared:n}){e.font!==void 0&&(this._fontHolder=n.getFont(e.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then(()=>{this.requestRender()}))}updateState(e,n){super.updateState(e,n),this.updateSizeState(e),this.updateFontState(e,n)}clone(e){let n=new Ru(this.uuid,this.data,e);return n.parent=void 0,n}};var sm=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.curves=[];this.extremasBBox={min:[0,0],max:[0,0]};this.updateState(n,r)}computeExtremas(){this.curves.length===0&&this.computeCurves();let e=this.curves.map(s=>IE.extremas(s)),n=[1/0,1/0],r=[-1/0,-1/0];for(let s=0,o=e.length;s<o;s++){let a=e[s];a[0][0]<n[0]&&(n[0]=a[0][0]),a[0][1]<n[1]&&(n[1]=a[0][1]),a[1][0]>r[0]&&(r[0]=a[1][0]),a[1][1]>r[1]&&(r[1]=a[1][1])}return this.extremasBBox.min=[n[0],n[1]],this.extremasBBox.max=[r[0],r[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let r=1,s=this.data.points.length;r<s;r++){let o=this.data.points[r].data,a=this.data.points[r-1].data,l={start:a.position,cp1:a.controlNext.position,cp2:o.controlPrevious.position,end:o.position};this.curves.push(l)}let e=this.data.points[0].data,n=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let r={start:n.position,cp1:n.controlNext.position,cp2:e.controlPrevious.position,end:e.position};this.curves.push(r)}}getCenter(){let[e,n]=this.extremasBBox.min,[r,s]=this.getHalfSize();return[e+r,n+s]}getHalfSize(){let{min:e,max:n}=this.extremasBBox;return[(n[0]-e[0])*.5,(n[1]-e[1])*.5]}innerDraw(e){for(let s=0,o=this.data.points.length;s<o;s++){let a=this.data.points[s].data;if(s===0){let[l,c]=a.position;e.moveTo(l,c)}else{let l=this.data.points[s-1].data,[c,u]=l.controlNext.position,[d,h]=a.controlPrevious.position,[p,f]=a.position,g={start:l.position,cp1:l.controlNext.position,cp2:a.controlPrevious.position,end:a.position};IE.derive(g),e.bezierCurveTo(c,u,d,h,p,f)}}let n=this.data.points[0].data,r=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let[s,o]=r.controlNext.position,[a,l]=n.controlPrevious.position,[c,u]=n.position;e.bezierCurveTo(s,o,a,l,c,u)}}updateState(e,n){super.updateState(e,n),this.computeExtremas()}clone(e){let n=new sm(this.uuid,this.data,e);return n.parent=void 0,n}},IE;(s=>{function i(o){let a=o.start,l=o.cp1,c=o.cp2,u=o.end,d=[3*(l[0]-a[0]),3*(l[1]-a[1])],h=[3*(c[0]-l[0]),3*(c[1]-l[1])],p=[3*(u[0]-c[0]),3*(u[1]-c[1])],f={start:d,cp:h,end:p};return o.derivative=f,f.derivative=BI.derive(f),f}s.derive=i;function t(o,a,l,c=!1){let u=o-2*a+l;if(u!==0){let d=-Math.sqrt(Math.abs(a*a-o*l)),h=-o+a,p=-(d+h)/u,f=-(-d+h)/u;return[p,f]}else if(a!==l&&u===0)return[(2*a-l)/(2*(a-l))];return[]}function e(o){let a=o.derivative??s.derive(o),l=a.start,c=a.cp,u=a.end;return[t(l[0],c[0],u[0]),t(l[1],c[1],u[1])]}s.droot=e;function n(o){let[a,l]=s.droot(o),c=[o.start[0],o.end[0]],u=[o.start[1],o.end[1]];for(let d of a)c.push(s.compute(o,Math.min(1,Math.max(0,d)))[0]);for(let d of l)u.push(s.compute(o,Math.min(1,Math.max(0,d)))[1]);return c.sort((d,h)=>d-h),u.sort((d,h)=>d-h),[[c[0],u[0]],[c[c.length-1],u[u.length-1]]]}s.extremas=n;function r(o,a){if(a===0)return[...o.start];if(a===1)return[...o.end];let l=1-a,c=l*l,u=a*a,d=c*l,h=c*a*3,p=l*u*3,f=a*u;return[d*o.start[0]+h*o.cp1[0]+p*o.cp2[0]+f*o.end[0],d*o.start[1]+h*o.cp1[1]+p*o.cp2[1]+f*o.end[1]]}s.compute=r})(IE||(IE={}));var BI;(n=>{function i(r){let s=r.start,o=r.cp,a=r.end,l=[2*(o[0]-s[0]),2*(o[1]-s[1])],c=[2*(a[0]-o[0]),2*(a[1]-o[1])],u={start:l,end:c};return u.derivative=FI.derive(u),r.derivative=u,u}n.derive=i;function t(r){let s=r.derivative??n.derive(r),o=s.start,a=s.end;return[o[0]!==a[0]?o[0]/(o[0]-a[0]):0,o[1]!==a[1]?o[1]/(o[1]-a[1]):0]}n.droot=t;function e(r,s){if(s===0)return[...r.start];if(s===1)return[...r.end];let o=1-s,a=o*o,l=s*s,c=a,u=o*s*2,d=l;return[c*r.start[0]+u*r.cp[0]+d*r.end[0],c*r.start[1]+u*r.cp[1]+d*r.end[1]]}n.compute=e})(BI||(BI={}));var FI;(e=>{function i(n){let r=n.start,s=n.end,o=[s[0]-r[0],s[1]-r[1]];return n.derivative=o,n.derivative}e.derive=i;function t(n,r){if(r===0)return[...n.start];if(r===1)return[...n.end];let s=n.start,o=n.end;return[s[0]+(o[0]-s[0])*r,s[1]+(o[1]-s[1])*r]}e.compute=t})(FI||(FI={}));var hs=class extends yc{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.context=r;this.isBaseGroup=!0;this.children=[]}add(e){e.parent&&e.parent instanceof hs&&e.parent.remove(e),this.children.push(e),e.parent=this}remove(e){let n=this.children.indexOf(e);n>=0&&(this.children.splice(n,1),e.parent=void 0)}traverse(e){let n=e(this);if(n!==!0)for(let r of this.children)r instanceof hs?r.traverse(e):n=e(r)}intersectsChildrenHelper(e,n,r,s,o){for(let a of this.children)if(a.intersects(e,n,r,!1)&&(o.push(a),s)||a instanceof hs&&a.intersectsChildrenHelper(e,n,r,s,o))return!0;return!1}intersectsChildren(e,n,r,s=!1,o=[],a=!1){return this.intersectsChildrenHelper(e,n,r,s,o),o}intersectsChildrenHelperReverse(e,n,r,s,o){for(let a of this.children)if(a instanceof hs&&a.intersectsChildrenHelperReverse(e,n,r,s,o)||a.intersects(e,n,r,!1)&&(o.push(a),s))return!0;return!1}intersectsChildrenReverse(e,n,r,s=!1,o=[],a=!1){return this.intersectsChildrenHelperReverse(e,n,r,s,o),o}updateWorldMatrix(e,n,r){if(super.updateWorldMatrix(e,n,r),r&&this.children)for(let s of this.children)s.updateWorldMatrix(e,!1,!0)}find(e){let n;return this.traverse(r=>{r.uuid===e&&(n=r)}),n}innerDrawChildren(e){for(let n=this.children.length-1;n>=0;n--)this.children[n].draw(e)}resetBBoxNeedsUpdate(){super.resetBBoxNeedsUpdate(),this.traverse(e=>{e.resetBBoxNeedsUpdateSelf()})}clone(e){let n=new hs(this.uuid,this.data,e);n.parent=void 0;for(let r of this.children)n.add(r.clone(e));return n}},Ps=class extends hs{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.updateState(n,r)}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.innerDrawChildren(e),e.restore())}clone(e){let n=new Ps(this.uuid,this.data,e);n.parent=void 0;for(let r of this.children)n.add(r.clone(e));return n}};pt();on();var Bi=class extends hs{constructor(e,n,r){super(e,n,r);this.uuid=e;this.width=0;this.height=0;this.clipped=!0;this.background=new Ro(e+"-background",pf.defaultData,r),this.background.parent=this,this.updateState(n,r)}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(e){this.background.cornerRadius=e}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(e,n,r){super.updateWorldMatrix(e,n,r),this.background?.updateWorldMatrix(e,n,r)}draw(e){if(!this.visible)return;e.save();let n=this.width,r=this.height;this.applyTransforms(e),this.background.width=n,this.background.height=r,this.background.draw(e),this.clipped&&e.clipRect(0,0,n,r,...this.cornerRadius),this.innerDrawChildren(e),e.restore()}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,n){super.updateState(e,n),this.updateSizeState(e),this.updateCornerState(e),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur),e.clipped!==void 0&&(this.clipped=e.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.type===0&&($t(e.path,["fill"])?this.fill.update(e.props):$t(e.path,["stroke"])?this.stroke.update(e.props):$t(e.path,["dropShadow"])?this.dropShadow.update(e.props):$t(e.path,["innerShadow"])?this.innerShadow.update(e.props):$t(e.path,["layerBlur"])?this.layerBlur.update(e.props):$t(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}clone(e){let n=new Bi(this.uuid,this.data,e);n.parent=void 0;for(let r of this.children)n.add(r.clone(e));return n}};pt();var s4=Qu(EE(),1),RE=new Map,Zte=4096,om=null;function Qte(i){let t=RE.get(i);if(t!==void 0)return t;if(om===null||!om.isConnected){let n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("aria-hidden","true"),n.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none",om=document.createElementNS("http://www.w3.org/2000/svg","path"),n.appendChild(om),document.body.appendChild(n)}om.setAttribute("d",i);let e=om.getBBox();return RE.size>=Zte&&RE.clear(),RE.set(i,e),e}var vc=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this._pathBBox=new DOMRect;this.path="";this.updateState(n,r),this.autoClose=!1,this.computeSVGBBox()}computeSVGBBox(){let e=this.path;o4(this.path)&&(console.warn("Invalid SVG path",this.uuid),e=""),this._pathBBox=Qte(e)}innerDraw(e){e.path(this.path)}intersectsInLocalSpace(e,n){return e>=this._pathBBox.x&&e<=this._pathBBox.x+this._pathBBox.width&&n>=this._pathBBox.y&&n<=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(e,n){super.updateState(e,n),e.path!==void 0&&(this.path=e.path,this.computeSVGBBox())}clone(e){let n=new vc(this.uuid,this.data,e);return n.parent=void 0,n}};function o4(i){return/NaN/.test(i)}function a4(i,t=1,e=1){if(t<=0||e<=0)return i;if(o4(i))return console.warn("Cannot scale invalid path",i),OE([]);if(t===1&&e===1)return i;try{let r=(0,s4.parseSVG)(i).map(s=>{let o={...s};return"x"in o&&(o.x=o.x*t),"y"in o&&(o.y=o.y*e),"x1"in o&&(o.x1=o.x1*t),"x2"in o&&(o.x2=o.x2*t),"y1"in o&&(o.y1=o.y1*e),"y2"in o&&(o.y2=o.y2*e),"rx"in o&&(o.rx=o.rx*t),"ry"in o&&(o.ry=o.ry*e),o});return OE(r)}catch(n){return console.warn("Error parsing SVG path",n),OE([])}}function OE(i){let t=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"],e;return i.map(n=>{let r=[];t.forEach(o=>{if(o in n){let a=n[o]*1;r.length&&a>=0&&r.push(","),r.push(a)}});let s=(e===n.code?r[0]<0?"":",":n.code)+r.join("");return e=n.code,s}).join("")}function l4(i,t,e){switch(t.type){case"ellipse2d":return new Iu(i,t,e);case"rectangle2d":return new Ro(i,t,e);case"text2d":return new Ru(i,t,e);case"vector2d":return new sm(i,t,e);case"path2d":return new vc(i,t,e);case"frame2d":return new Bi(i,t,e);case"group2d":default:return new Ps(i,t,e)}}mi();var UI=class{constructor(t,e,n){this.uuid=t;this.data=e;this.group=new Ps(UI.GROUP_ID,{...Qy.defaultData},n),this.createChildrenObjects(e.objects,this.group,n)}createObject(t,e,n,r,s,o){let a=l4(t,e,o);a&&(r.add(a),r.children.splice(s,0,r.children.pop()),a.updateWorldMatrix(),n.length>0&&(a instanceof Ps||a instanceof Bi)&&this.createChildrenObjects(n,a,o))}createChildrenObjects(t,e,n){let r=0;for(let s of t)this.createObject(s.id,s.data,s.children,e,r,n),r+=1}draw(t){this.group.draw(t)}updateEntityByOp(t,e,n,r){let s=this.find(t);if(s)try{s.updateByOp(e,n,{shared:r})}catch(o){console.error(o)}}updateTreeByOp(t,e){if(t.path.length===0&&t.type===7){let n=t.parent===null?this.group:this.find(t.parent);n!==void 0&&n instanceof hs&&(this.createObject(t.id,t.data,t.children,n,t.localIndex,e),n.requestRender())}else if(t.path.length===0&&t.type===8){let n=this.find(t.id);if(n!==void 0&&n.parent!==void 0&&n.parent instanceof hs){let r=n.parent;n.resetBBoxNeedsUpdate(),r?.remove(n),r?.requestRender()}}else if(t.path.length===0&&t.type===9){let n=this.find(t.id);if(n!==void 0){let r=n.parent,s=t.parent===null?this:this.find(t.parent);if(s===void 0&&!1&&console.error("unexpected",s,t),s instanceof hs||s===this){s.add(n);let o=t.localIndex;s.children.splice(o,0,s.children.pop()),n.updateWorldMatrix(!0,!1,!0),r?.requestRender(),n.requestRender()}n.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,n,r=!1,s=[]){return this.group.intersectsChildren(t,e,n,r,s,!0)}intersectsChildrenReverse(t,e,n,r=!1,s=[]){return this.group.intersectsChildrenReverse(t,e,n,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(e===void 0)return;let n=[],r=e;for(;r!==this.group;){let s=r;r=r.parent;let o=r.children.indexOf(s);n.splice(0,0,o)}return{entity:e,sortKey:n}}getAllSorted(t){let e=[];for(let n of t){let r=this.getWithSortKey(n.id);r!==void 0&&e.push(r)}return e.sort((n,r)=>Cd(n.sortKey,r.sortKey)),e.map(n=>n.entity)}},ah=UI;ah.GROUP_ID="scene2d";function kI({constraints:i,newParentWidth:t,newParentHeight:e,initialParentWidth:n,initialParentHeight:r,objectInitialWidth:s,objectInitialHeight:o,objectInitialPosition:a}){let{horizontalConstraint:l,verticalConstraint:c}=i,u=t-n,d=e-r,h=s,p=o,f=a[0],g=a[1];if(l!==0){if(l===1)f+=u;else if(l===3)f+=u/2;else if(l===2)h=Math.max(1,h+u);else if(l===4){let m=t/n;h*=m,f*=m}}if(c!==0){if(c===1)g+=d;else if(c===3)g+=d/2;else if(c===2)p=Math.max(1,p+d);else if(c===4){let m=e/r;p*=m,g*=m}}return{width:h,height:p,position:[f,g]}}var Jte=Qu(EE(),1);var mNe={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{mm:1,px:1,cm:1,in:1,pt:1,pc:1}};Yi();on();pt();X();VI();function zI(i,t,e,n){return n?e:2048/Math.max(1,i,t)}function d4(i,t,e,n){let r=zI(i,t,e,n),s=Math.max(e,512/Math.min(i,t)),o=Math.min(s,r);return{width:Math.max(1,Math.ceil(i*o)),height:Math.max(1,Math.ceil(t*o))}}var ene=`
9791
9791
  varying vec2 vUv;
9792
9792
  void main() {
@@ -9802,7 +9802,7 @@ void main() {
9802
9802
  `,e),d=e.horizontalAlign===1?u:0,h=this.getLineInitialOffsetX(a[0],l,e.horizontalAlign,t[0],u),p=this.getLineInitialOffsetY(o,t.length,c,s,e.verticalAlign),f=[],g=t.map(()=>[]),m=t.map(()=>[]);for(let v=0;v<t.length;v++){let b=t[v],x={features:{liga:!0},letterSpacing:e.letterSpacing},S=[];try{S=r.stringToGlyphs(b,x)}catch(A){this.warnLayoutError(A)}h=this.getLineInitialOffsetX(a[v],l,e.horizontalAlign,b,u);let E=[];try{E=this.reverseLigaturesTable(r,b,S)}catch(A){this.warnLayoutError(A)}let T=this.computeSpaceWidthForLine(t,v,e,n),w=0,_=S[0];_&&e.horizontalAlign===2&&_.leftSideBearing!==void 0&&(h-=_.leftSideBearing*s);try{this.font?.forEachGlyph(b,h,p,e.fontSize,x,(A,C,P,D,O)=>{let L=A.index===0?`
9803
9803
  `:A.unicode?String.fromCharCode(A.unicode):void 0,U=E[w],G=0;if(L===`
9804
9804
  `)G=d;else if(L===" ")G=T;else{let Y=this.createPath(A,s,C,P,e);Y&&(G=Y.offsetX,f.push(Y.path))}if(!U||U.replacements.length===1)m[v].push([C,P]),g[v].push(G);else{let Y=U.replacements.map(Q=>(r.glyphs.get(Q).advanceWidth??0)*s),oe=Y.reduce((Q,re)=>Q+=re,0),ee=Y.map(Q=>Q/oe),J=C;for(let Q=0;Q<ee.length;Q++){let re=G*ee[Q];m[v].push([J,P]),g[v].push(re),J+=re}}w++})}catch(A){this.warnLayoutError(A)}p-=o}let y=[];for(let v=0,b=f.length;v<b;v++)y.push(...f[v].toShapes());return{shapes:y,charWidths:g,lineWidths:a,charCoords:m}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,n,r,s){return(n===3||n===2)&&r.indexOf(`
9805
- `)>=0&&(t-=s),n===3?e*.5-t*.5:n===2?e-t:0}getLineInitialOffsetY(t,e,n,r,s){let o=e*t,a=Math.abs(this.ascender-this.descender)*r,l=t-a,c=-this.ascender*r-l/2;return s===3?-(n-o-c):s===2?-(n*.5-o*.5-c):c}createPath(t,e,n,r,s){let o=t.getPath(n,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!o){console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");return}let a=new NE,l=(t.advanceWidth??1)*e;if(t)for(let c of o.commands){let u=a.currentPath?.currentPoint;if(!(u&&c.type!=="Z"&&u.x===c.x&&-u.y===c.y))switch(c.type){case"M":a.moveTo(c.x,-c.y);break;case"L":a.lineTo(c.x,-c.y);break;case"Q":a.quadraticCurveTo(c.x1,-c.y1,c.x,-c.y);break;case"C":a.bezierCurveTo(c.x1,-c.y1,c.x2,-c.y2,c.x,-c.y);break}}return a.subPaths.forEach(c=>{let u=fne(c.curves);u!==void 0&&c.currentPoint.distanceTo(u)>0&&c.lineTo(u.x,u.y)}),{offsetX:l,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}computeSpaceWidthForLine(t,e,n,r){let s=this.getCharWidth(" ",n),o=t[e];if(o){let a=this.countSpaces(o.trimEnd());if(n.horizontalAlign===4&&e<t.length-1&&a){let l=typeof n.width=="string"?Number(r.getVariable(n.width)):n.width,c=this.getTextWidth(o,n);return(l-(c-a*s))/a}}return s}countSpaces(t){return(t.match(/ /g)||[]).length}};function fne(i){if(i.length){let t=i[0];if(t instanceof _i)return t.v1;if(t instanceof Ni||t instanceof vs)return t.v0}}ow();Qt();wo("TextGeometry",(i,t,e)=>new Au(i,t,e));var y4={create:(i,t)=>new kf(i,t)};nv("TextGeometry",y4);nv("InputGeometry",y4);vk(FE);Mt("text");pt();var UE=200,v4=null;function b4(i){v4=i}function KI(){return v4}function x4(i){let t=!1;return i.scene.objects.forEach(e=>{e.data.type==="Page"&&!t&&e.data.publish.gameControlObject&&vo.traverseModuleInstances(i,e.id,(r,s,o)=>{for(let a of o)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(t=!0)})}),t}gn();var rb=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return Math.sqrt(e*e+n*n)},S4=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return mne(Math.atan2(n,e))},w4=(i,t,e)=>{let n={x:0,y:0};return e=VE(e),n.x=i.x-t*Math.cos(e),n.y=i.y-t*Math.sin(e),n},VE=i=>i*(Math.PI/180),mne=i=>i*(180/Math.PI),E4=i=>isNaN(i.buttons)?i.pressure!==0:i.buttons!==0,kE=new Map,T4=i=>{kE.has(i)&&clearTimeout(kE.get(i)),kE.set(i,setTimeout(function(){kE.delete(i),i()},100))},lm=(i,t,e)=>{let n=t.split(/[ ,]+/g),r;for(let s=0;s<n.length;s+=1)r=n[s],i.addEventListener?i.addEventListener(r,e,!1):i.attachEvent&&i.attachEvent(r,e)},cm=(i,t,e)=>{let n=t.split(/[ ,]+/g),r;for(let s=0;s<n.length;s+=1)r=n[s],i.removeEventListener?i.removeEventListener(r,e):i.detachEvent&&i.detachEvent(r,e)};var zE=i=>(i.preventDefault(),i.type.match(/^touch/)?i.changedTouches:i),ZI=()=>{if(typeof window>"u")return;let i=window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,t=window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;return{x:i,y:t}},GE=(i,t)=>{t.top||t.right||t.bottom||t.left?(i.style.top=t.top,i.style.right=t.right,i.style.bottom=t.bottom,i.style.left=t.left):(i.style.left=t.x+"px",i.style.top=t.y+"px")},jE=(i,t,e)=>{let n=_4(i);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof t=="string")n[r]=t+" "+e;else{let s="";for(let o=0,a=t.length;o<a;o+=1)s+=t[o]+" "+e+", ";n[r]=s.slice(0,-2)}return n},M4=(i,t)=>{let e=_4(i);for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t);return e},_4=i=>{let t={};return t[i]="",["webkit","Moz","o"].forEach(function(n){t[n+i.charAt(0).toUpperCase()+i.slice(1)]=""}),t},HE=(i,t)=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e]);return i},A4=(i,t)=>{let e={};for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&Object.prototype.hasOwnProperty.call(t,n)?e[n]=t[n]:Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);return e},ib=(i,t)=>{if(i.length)for(let e=0,n=i.length;e<n;e+=1)t(i[e]);else t(i)},C4=(i,t,e)=>({x:Math.min(Math.max(i.x,t.x-e),t.x+e),y:Math.min(Math.max(i.y,t.y-e),t.y+e)});typeof window<"u"&&(P4="ontouchstart"in window,I4=!!window.PointerEvent,R4=!!window.MSPointerEvent);var P4,I4,R4,sb={touch:{start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},pointer:{start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"},MSPointer:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},um,ob={};I4?um=sb.pointer:R4?um=sb.MSPointer:P4?(um=sb.touch,ob=sb.mouse):um=sb.mouse;function lh(){}lh.prototype.on=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]=e._handlers_[r]||[],e._handlers_[r].push(t);return e};lh.prototype.off=function(i,t){var e=this;return e._handlers_=e._handlers_||{},i===void 0?e._handlers_={}:t===void 0?e._handlers_[i]=null:e._handlers_[i]&&e._handlers_[i].indexOf(t)>=0&&e._handlers_[i].splice(e._handlers_[i].indexOf(t),1),e};lh.prototype.trigger=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]&&e._handlers_[r].length&&e._handlers_[r].forEach(function(o){o.call(e,{type:r,target:e},t)})};lh.prototype.config=function(i){var t=this;t.options=t.defaults||{},i&&(t.options=A4(t.options,i))};lh.prototype.bindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},e._domHandlers_[t]=function(){typeof e["on"+t]=="function"?e["on"+t].apply(e,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},lm(i,um[t],e._domHandlers_[t]),ob[t]&&lm(i,ob[t],e._domHandlers_[t]),e};lh.prototype.unbindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},cm(i,um[t],e._domHandlers_[t]),ob[t]&&cm(i,ob[t],e._domHandlers_[t]),delete e._domHandlers_[t],this};var dm=lh;function vi(i,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=i,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=vi.id,vi.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}vi.prototype=new dm;vi.constructor=vi;vi.id=0;vi.prototype.buildEl=function(i){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)};vi.prototype.stylize=function(){if(this.options.dataOnly)return this;var i=this.options.fadeTime+"ms",t=M4("borderRadius","50%"),e=jE("transition","opacity",i),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},HE(n.el,e),this.options.shape==="circle"&&HE(n.back,t),HE(n.front,t),this.applyStyles(n),this};vi.prototype.applyStyles=function(i){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var e in i[t])this.ui[t].style[e]=i[t][e];return this};vi.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};vi.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};vi.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null};vi.prototype.show=function(i){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof i=="function"&&i.call(this)},t.options.fadeTime)),t};vi.prototype.hide=function(i){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var e=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=e,typeof i=="function"&&i.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let e=t.options.restJoystick,n={};n.x=e===!0||e.x!==!1?0:t.instance.frontPosition.x,n.y=e===!0||e.y!==!1?0:t.instance.frontPosition.y,t.setPosition(i,n)}return t};vi.prototype.setPosition=function(i,t){var e=this;e.frontPosition={x:t.x,y:t.y};var n=e.options.fadeTime+"ms",r={};r.front=jE("transition",["top","left"],n);var s={front:{}};s.front={left:e.frontPosition.x+"px",top:e.frontPosition.y+"px"},e.applyStyles(r),e.applyStyles(s),e.restTimeout=setTimeout(function(){typeof i=="function"&&i.call(e),e.restCallback()},e.options.fadeTime)};vi.prototype.restCallback=function(){var i=this,t={};t.front=jE("transition","none",""),i.applyStyles(t),i.trigger("rested",i.instance)};vi.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};vi.prototype.computeDirection=function(i){var t=i.angle.radian,e=Math.PI/4,n=Math.PI/2,r,s,o;if(t>e&&t<e*3&&!i.lockX?r="up":t>-e&&t<=e&&!i.lockY?r="left":t>-e*3&&t<=-e&&!i.lockX?r="down":i.lockY||(r="right"),i.lockY||(t>-n&&t<n?s="left":s="right"),i.lockX||(t>0?o="up":o="down"),i.force>this.options.threshold){var a={},l;for(l in this.direction)Object.prototype.hasOwnProperty.call(this.direction,l)&&(a[l]=this.direction[l]);var c={};this.direction={x:s,y:o,angle:r},i.direction=this.direction;for(l in a)a[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return i;(!c.x||!c.y)&&this.trigger("plain",i),c.x||this.trigger("plain:"+s,i),c.y||this.trigger("plain:"+o,i),c.angle||this.trigger("dir dir:"+r,i)}else this.resetDirection();return i};var O4=vi;function Kr(i,t){var e=this;e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.pressureIntervals={},e.manager=i,e.id=Kr.id,Kr.id+=1,e.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},e.config(t),(e.options.mode==="static"||e.options.mode==="semi")&&(e.options.multitouch=!1),e.options.multitouch||(e.options.maxNumberOfNipples=1);let n=getComputedStyle(e.options.zone.parentElement);return n&&n.display==="flex"&&(e.parentIsFlex=!0),e.updateBox(),e.prepareNipples(),e.bindings(),e.begin(),e.nipples}Kr.prototype=new dm;Kr.constructor=Kr;Kr.id=0;Kr.prototype.prepareNipples=function(){var i=this,t=i.nipples;t.on=i.on.bind(i),t.off=i.off.bind(i),t.options=i.options,t.destroy=i.destroy.bind(i),t.ids=i.ids,t.id=i.id,t.processOnMove=i.processOnMove.bind(i),t.processOnEnd=i.processOnEnd.bind(i),t.get=function(e){if(e===void 0)return t[0];for(var n=0,r=t.length;n<r;n+=1)if(t[n].identifier===e)return t[n];return!1}};Kr.prototype.bindings=function(){var i=this;i.bindEvt(i.options.zone,"start"),i.options.zone.style.touchAction="none",i.options.zone.style.msTouchAction="none"};Kr.prototype.begin=function(){var i=this,t=i.options;if(t.mode==="static"){var e=i.createNipple(t.position,i.manager.getIdentifier());e.add(),i.idles.push(e)}};Kr.prototype.createNipple=function(i,t){var e=this,n=e.manager.scroll,r={},s=e.options,o={x:e.parentIsFlex?n.x:n.x+e.box.left,y:e.parentIsFlex?n.y:n.y+e.box.top};if(i.x&&i.y)r={x:i.x-o.x,y:i.y-o.y};else if(i.top||i.right||i.bottom||i.left){var a=document.createElement("DIV");a.style.display="hidden",a.style.top=i.top,a.style.right=i.right,a.style.bottom=i.bottom,a.style.left=i.left,a.style.position="absolute",s.zone.appendChild(a);var l=a.getBoundingClientRect();s.zone.removeChild(a),r=i,i={x:l.left+n.x,y:l.top+n.y}}var c=new O4(e,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:t,position:i,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(GE(c.ui.el,r),GE(c.ui.front,c.frontPosition)),e.nipples.push(c),e.trigger("added "+c.identifier+":added",c),e.manager.trigger("added "+c.identifier+":added",c),e.bindNipple(c),c};Kr.prototype.updateBox=function(){var i=this;i.box=i.options.zone.getBoundingClientRect()};Kr.prototype.bindNipple=function(i){var t=this,e,n=function(r,s){e=r.type+" "+s.id+":"+r.type,t.trigger(e,s)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",n),i.on("dir:up dir:right dir:down dir:left",n),i.on("plain:up plain:right plain:down plain:left",n)};Kr.prototype.pressureFn=function(i,t,e){var n=this,r=0;clearInterval(n.pressureIntervals[e]),n.pressureIntervals[e]=setInterval(function(){var s=i.force||i.pressure||i.webkitForce||0;s!==r&&(t.trigger("pressure",s),n.trigger("pressure "+t.identifier+":pressure",s),r=s)}.bind(n),100)};Kr.prototype.onstart=function(i){var t=this,e=t.options,n=i;i=zE(i),t.updateBox();var r=function(s){t.actives.length<e.maxNumberOfNipples?t.processOnStart(s):n.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(o){if(Object.values(n.touches).findIndex(function(l){return l.identifier===o})<0){var a=[i[0]];a.identifier=o,t.processOnEnd(a)}}),t.actives.length<e.maxNumberOfNipples&&t.processOnStart(s))};return ib(i,r),t.manager.bindDocument(),!1};Kr.prototype.processOnStart=function(i){var t=this,e=t.options,n,r=t.manager.getIdentifier(i),s=i.force||i.pressure||i.webkitForce||0,o={x:i.pageX,y:i.pageY},a=t.getOrCreate(r,o);a.identifier!==r&&t.manager.removeIdentifier(a.identifier),a.identifier=r;var l=function(u){u.trigger("start",u),t.trigger("start "+u.id+":start",u),u.show(),s>0&&t.pressureFn(i,u,u.identifier),t.processOnMove(i)};if((n=t.idles.indexOf(a))>=0&&t.idles.splice(n,1),t.actives.push(a),t.ids.push(a.identifier),e.mode!=="semi")l(a);else{var c=rb(o,a.position);if(c<=e.catchDistance)l(a);else{a.destroy(),t.processOnStart(i);return}}return a};Kr.prototype.getOrCreate=function(i,t){var e=this,n=e.options,r;return/(semi|static)/.test(n.mode)?(r=e.idles[0],r?(e.idles.splice(0,1),r):n.mode==="semi"?e.createNipple(t,i):(console.warn("Coudln't find the needed nipple."),!1)):(r=e.createNipple(t,i),r)};Kr.prototype.processOnMove=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.scroll;if(!E4(i)){this.processOnEnd(i);return}if(!r){console.error("Found zombie joystick with ID "+n),t.manager.removeIdentifier(n);return}if(e.dynamicPage){var o=r.el.getBoundingClientRect();r.position={x:s.x+o.left,y:s.y+o.top}}r.identifier=n;var a=r.options.size/2,l={x:i.pageX,y:i.pageY};e.lockX&&(l.y=r.position.y),e.lockY&&(l.x=r.position.x);var c=rb(l,r.position),u=S4(l,r.position),d=VE(u),h=c/a,p={distance:c,position:l},f,g;if(r.options.shape==="circle"?(f=Math.min(c,a),g=w4(r.position,f,u)):(g=C4(l,r.position,a),f=rb(g,r.position)),e.follow){if(c>a){let b=l.x-g.x,x=l.y-g.y;r.position.x+=b,r.position.y+=x,r.el.style.top=r.position.y-(t.box.top+s.y)+"px",r.el.style.left=r.position.x-(t.box.left+s.x)+"px",c=rb(l,r.position)}}else l=g,c=f;var m=l.x-r.position.x,y=l.y-r.position.y;r.frontPosition={x:m,y},e.dataOnly||GE(r.ui.front,r.frontPosition);var v={identifier:r.identifier,position:l,force:h,pressure:i.force||i.pressure||i.webkitForce||0,distance:c,angle:{radian:d,degree:u},vector:{x:m/a,y:-y/a},raw:p,instance:r,lockX:e.lockX,lockY:e.lockY};v=r.computeDirection(v),v.angle={radian:VE(180-u),degree:180-u},r.trigger("move",v),t.trigger("move "+r.id+":move",v)};Kr.prototype.processOnEnd=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.removeIdentifier(r.identifier);!r||(e.dataOnly||r.hide(function(){e.mode==="dynamic"&&(r.trigger("removed",r),t.trigger("removed "+r.id+":removed",r),t.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(t.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),t.trigger("end "+r.id+":end",r),t.ids.indexOf(r.identifier)>=0&&t.ids.splice(t.ids.indexOf(r.identifier),1),t.actives.indexOf(r)>=0&&t.actives.splice(t.actives.indexOf(r),1),/(semi|static)/.test(e.mode)?t.idles.push(r):t.nipples.indexOf(r)>=0&&t.nipples.splice(t.nipples.indexOf(r),1),t.manager.unbindDocument(),/(semi|static)/.test(e.mode)&&(t.manager.ids[s.id]=s.identifier))};Kr.prototype.onDestroyed=function(i,t){var e=this;e.nipples.indexOf(t)>=0&&e.nipples.splice(e.nipples.indexOf(t),1),e.actives.indexOf(t)>=0&&e.actives.splice(e.actives.indexOf(t),1),e.idles.indexOf(t)>=0&&e.idles.splice(e.idles.indexOf(t),1),e.ids.indexOf(t.identifier)>=0&&e.ids.splice(e.ids.indexOf(t.identifier),1),e.manager.removeIdentifier(t.identifier),e.manager.unbindDocument()};Kr.prototype.destroy=function(){var i=this;i.unbindEvt(i.options.zone,"start"),i.nipples.forEach(function(e){e.destroy()});for(var t in i.pressureIntervals)Object.prototype.hasOwnProperty.call(i.pressureIntervals,t)&&clearInterval(i.pressureIntervals[t]);i.trigger("destroyed",i.nipples),i.manager.unbindDocument(),i.off(),i.pressureIntervals={},i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.manager=null};var D4=Kr;function si(i){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=ZI(),t._windowBound=!1,t.config(i),t.prepareCollections();var e=function(){var n;t.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:t.scroll.x+n.left,y:t.scroll.y+n.top}})})};return t._onResize=function(){T4(e)},t._onScroll=function(){t.scroll=ZI()},t.collections}si.prototype=new dm;si.constructor=si;si.prototype.prepareCollections=function(){var i=this;i.collections.create=i.create.bind(i),i.collections.on=i.on.bind(i),i.collections.off=i.off.bind(i),i.collections.destroy=i.destroy.bind(i),i.collections.get=function(t){var e;return i.collections.every(function(n){return e=n.get(t),!e}),e}};si.prototype.create=function(i){return this.createCollection(i)};si.prototype.bindWindowEvents=function(){var i=this;i._windowBound||typeof window>"u"||(i._windowBound=!0,lm(window,"resize",i._onResize),lm(window,"scroll",i._onScroll))};si.prototype.unbindWindowEvents=function(){var i=this;!i._windowBound||typeof window>"u"||(i._windowBound=!1,cm(window,"resize",i._onResize),cm(window,"scroll",i._onScroll))};si.prototype.createCollection=function(i){var t=this,e=new D4(t,i);return t.bindCollection(e),t.collections.push(e),t.bindWindowEvents(),e};si.prototype.bindCollection=function(i){var t=this,e,n=function(r,s){e=r.type+" "+s.id+":"+r.type,t.trigger(e,s)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",n),i.on("dir:up dir:right dir:down dir:left",n),i.on("plain:up plain:right plain:down plain:left",n)};si.prototype.bindDocument=function(){var i=this;i.binded||(i.bindEvt(document,"move").bindEvt(document,"end"),i.binded=!0)};si.prototype.unbindDocument=function(i){var t=this;(!Object.keys(t.ids).length||i===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};si.prototype.getIdentifier=function(i){var t;return i?(t=i.identifier===void 0?i.pointerId:i.identifier,t===void 0&&(t=this.latest||0)):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]};si.prototype.removeIdentifier=function(i){var t={};for(var e in this.ids)if(this.ids[e]===i){t.id=e,t.identifier=this.ids[e],delete this.ids[e];break}return t};si.prototype.onmove=function(i){var t=this;return t.onAny("move",i),!1};si.prototype.onend=function(i){var t=this;return t.onAny("end",i),!1};si.prototype.oncancel=function(i){var t=this;return t.onAny("end",i),!1};si.prototype.onAny=function(i,t){var e=this,n,r="processOn"+i.charAt(0).toUpperCase()+i.slice(1);t=zE(t);var s=function(a,l,c){c.ids.indexOf(l)>=0&&(c[r](a),a._found_=!0)},o=function(a){n=e.getIdentifier(a),ib(e.collections,s.bind(null,a,n)),a._found_||e.removeIdentifier(n)};return ib(t,o),!1};si.prototype.destroy=function(){var i=this;i.unbindDocument(!0),i.unbindWindowEvents(),i.ids={},i.index=0,i.collections.forEach(function(t){t.destroy()}),i.collections=[],i.off()};si.prototype.onDestroyed=function(i,t){var e=this;if(e.collections.indexOf(t)<0)return!1;e.collections.splice(e.collections.indexOf(t),1),e.collections.length===0&&e.unbindWindowEvents()};var L4=si;var hm=null;function N4(){return hm||(hm=new L4),hm}var gne={create:function(i){return N4().create(i)},destroy:function(){hm&&(hm.destroy(),hm=null)},get factory(){return N4()}},B4=gne;gn();pt();X();Xs();Xi();pt();var F4=null;function U4(i){F4=i}function qE(){return F4}var k4,V4=new Promise(i=>{k4=i});var XE;function z4(i){if(XE)return XE;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.25/build"),s=import("./physics.js"),[o,a]=await Promise.all([s,fetch(`${n}/physics.wasm`).then(l=>l.arrayBuffer())]);await o.init(a),k4(o)}return XE=t(),XE}pr();Xi();Qt();lE();X();X();Kd();function QI(i){let t=i.elements,e=t[0]**2+t[1]**2+t[2]**2,n=t[4]**2+t[5]**2+t[6]**2,r=t[8]**2+t[9]**2+t[10]**2,s=t[0]**2+t[4]**2+t[8]**2,o=t[1]**2+t[5]**2+t[9]**2,a=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return e<l||n<l||r<l||s<l||o<l||a<l}function ma(i,t){let e=new De;if(t&&QI(t))return e.setAttribute("position",new Ve([],3)),e.setIndex([]),e;if(!i.getAttribute("position"))return e.setAttribute("position",new Ve([],3)),e.setIndex([]),e;let{positions:n,triIndices:r}=Pv(i.getAttribute("position"),i.getIndex());return e.setAttribute("position",new Ve(n,3)),e.setIndex(r),t&&e.applyMatrix4(t),e}ff();var YE=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.initialDisabled=!1;this.actions=ln(e,e.actions,r,s,o,n),this.target=e.target}disconnect(){Nn(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}};var ab=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.page=r;this.currentIntersectedObjects=[];this.actions=ln(e,e.actions,r,s,o,n),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let l=r.scene.find(a);l&&this.triggeringObjects.push(l)}}isValidTriggeringObject(t){return this.target==="all"?!0:this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){Nn(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?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()))}};pr();var cn;V4.then(i=>cn=i);var oi=new M,Oo=new qe,Ou=new M,vBe=new qt(0,0,0,"YXZ"),G4=new qt(0,0,0,"XYZ"),ga=new M,JI=new M,eR=new M(1,1,1),pm=new qe,$E=new ne,j4=new ne,yne={type:"updateMatrix"},H4=new qe,tR=new nr,vne=.5,bne=.7,nR=.01,ZE={type:"beginEvent",eventName:"Collision"},xne={type:"beginEvent",eventName:"Trigger"};function W4(i){if(vo.physicsEnabled(i.scene.objects))return!0;let t=!1;return i.scene.objects.traverse((e,n)=>{if(n.events){if(Array.isArray(n.events)){for(let r of n.events)if(r.data.disabled!==!0&&r.data.type==="GameControl"&&r.data.collisionEnabled){t=!0;break}}else for(let r of Object.values(n.events))if(r.disabled!==!0&&r.type==="GameControl"&&r.collisionEnabled){t=!0;break}}}),t}var lb=i=>i.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.hiddenMatrix!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function fm(i){return SU(Ga(i)?i.object:i)}var KE=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()!==cn.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,n,r]=this.rigidBodyToMesh.get(t.handle);if(oi.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),Oo.copy(t.rotation()),e.matrixWorld.compose(oi,Oo,n),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(yne),r){let s=e.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(e.matrixWorld);for(let o of s.children)o.updateMatrixWorld(!0)}for(let o of e.children)o.updateMatrixWorld(!0)}};this.accumulator=0;this.handleCollisionEvents=(t,e,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[t]?(r=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),r&&s&&r.isValidTriggeringObject(s)){r.dispatch();return}for(let o=this.sharedGameControlGlobals.createdObjects.length-1;o>=0;o--){let a=this.sharedGameControlGlobals.createdObjects[o];if(a.userData.hasCollisionDestroy&&(a.rigidBody?.collider(0).handle===t||a.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(o,1),a.removeFromParent();let l=a.rigidBody;requestAnimationFrame(()=>{a.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),a.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let o=this.sharedGameControlGlobals.colliderToEntity.get(e),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a===void 0)return;for(let l of a)l.data.target==="character"&&this.dispatchCollisionEvent(l,o,e)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let o=this.sharedGameControlGlobals.colliderToEntity.get(t),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a===void 0)return;for(let l of a)l.data.target==="character"&&this.dispatchCollisionEvent(l,o,t)}else{let o=this.sharedGameControlGlobals.colliderToEntity.get(t),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a!==void 0)for(let u of a)u.data.target==="scene"&&this.dispatchCollisionEvent(u,o,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(e),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let u of c)u.data.target==="scene"&&this.dispatchCollisionEvent(u,l,e)}};this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=UE,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events){if(n.data.disabled===!0)continue;let r=n.data.actions?.find(s=>s.data.type==="Destroy")?.data;if(r)for(let s of r.objects){let o=this.page.scene.find(s);o&&(o.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events)if(!(n.data.disabled===!0||n.data.type!=="DragDrop"))for(let r of n.data.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(qE()===null){Jn("collision-bvh","trigger/collision detection");return}let t=[],e=[];if(this.page.traverseChildren(n=>{let r,s=n instanceof tl,o=vu(n);if(rc(n)||s||o)return;Ga(n)?r=n.object:r=n;let a=r.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let l=n.geometry,c=r.userData.hasDestroy===!0,u=r.userData.hasDrag===!0;if(lb(a)||c||u||r.dataPatched.events.some(d=>d.data.disabled!==!0&&(d.data.type==="GameControl"||d.data.type==="Follow")))return n.updateMatrixWorldRigid(),this.addBoundsTree(n),!0;if(l){let d=l.getAttribute("position");if(d!==void 0&&d.count>0){t.push({geometry:l,matrixWorld:n.matrixWorld}),e.push(l.id,this._staticBVHIdOf(d),d.version,l.index!==null?this._staticBVHIdOf(l.index):-1,l.index!==null?l.index.version:-1);for(let h of n.matrixWorld.elements)e.push(h)}}if(fm(n))return!0}),t.length>0){let n=this._staticBVHCache;if(n!==void 0&&n.signature.length===e.length&&n.signature.every((a,l)=>a===e[l])){this.sharedGameControlGlobals.staticMeshBVH=n.bvh;return}let r=t.map(a=>ma(a.geometry,a.matrixWorld)),s=ia(r,!1),o=new(qE())(s);this._staticBVHCache={signature:e,bvh:o},this.sharedGameControlGlobals.staticMeshBVH=o}}addRigidBody(t,e,n){if(QI(t.matrixWorld))return;let r=[],s="geometry"in t?t.geometry:void 0,o=e.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(ma(s,t.shearScale)),o.physics.fusedBody){let a=this.gatherChildrenGeom(t,r);t.traverseObject(a),t.children.forEach(c=>c.updateMatrixWorld(!0));let l=t.cloner;l&&l.objectForSample===void 0&&o.physics.rigidBody==="dynamic"&&(l.traverseObject(a),l.children.forEach(c=>c.updateMatrixWorld(!0)))}if(r.length>0){let a,l=!1,c=!n.fromCreate&&o.physics.rigidBody==="dynamic"||n.fromCreate&&n.dynamic;c?(a=cn.RigidBodyDesc.dynamic(),a.setLinearDamping(o.physics.damping).setAngularDamping(o.physics.damping).setAdditionalMass(1e-9).setGravityScale(o.physics.gravityScale).enabledRotations(...o.physics.enabledRotation).enabledTranslations(...o.physics.enabledTranslation)):(n.hasTransformAnim||n.hasFollow||n.hasDrag)&&!n.fromCreate?(a=cn.RigidBodyDesc.kinematicPositionBased(),l=!0):a=cn.RigidBodyDesc.fixed();let u=ia(r);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(oi,Oo,Ou),t.position0=oi.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Oo.clone(),oi.divideScalar(this.pixelsPerMeter),a.setTranslation(oi.x,oi.y,oi.z).setRotation(Oo),s?u?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):u?.scale(Ou.x/this.pixelsPerMeter,Ou.y/this.pixelsPerMeter,Ou.z/this.pixelsPerMeter);let d=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),h=!(o.geometry===void 0||o.geometry.type==="SubdivGeometry"||o.geometry.type==="NonParametricGeometry"||o.geometry.type==="BooleanGeometry"||o.geometry.type==="VectorGeometry"||o.geometry.type==="StarGeometry"||o.geometry.type==="RectangleGeometry"||o.geometry.type==="EllipseGeometry"||o.geometry.type==="TriangleGeometry"||o.geometry.type==="TorusGeometry"||o.geometry.type==="HelixGeometry");try{this.addCollider(d,o.physics,u,e,h)}catch{try{this.addCollider(d,o.physics,u,e,!1)}catch(p){console.error(p)}}if(d.numColliders()===0){this.sharedGameControlGlobals.rapierWorld.removeRigidBody(d);return}c?this.rigidBodyToMesh.set(d.handle,[t,Ou.clone(),o.physics.fusedBody]):l?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(d.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,d,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=d}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(ma(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(n=>n.updateMatrixWorld(!0)),e.length>0){let n=ia(e,!1);t.bvhGeometry=n,n.getAttribute("position").count>0?(t.bvhGeometry.boundsTree=new(qE())(n),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):!1&&console.warn(`ControlsManager.addBoundsTree: object "${t.name}" has empty geometry`)}}addCollider(t,e,n,r,s=!0){if(n?.getAttribute("position").count===0||n?.getIndex()?.count===0)return;let o;n&&(e.colliderType==="trimesh"?o=cn.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array):o=cn.ColliderDesc.convexMesh(n.getAttribute("position").array,s?n.getIndex().array:void 0)),o.setFrictionCombineRule(cn.CoefficientCombineRule.Average).setRestitutionCombineRule(cn.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(l=>l.target==="scene")&&a.setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let n=fm(t);return(r,s)=>{if(s===0)return;if(n&&r.parent===t)return!0;let o;if(rc(r))if(r.objectForSample){if(r.objectForSample.dataPatched.physics.fusedBody)return;o=r.object}else return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Ga(r))o=r.object;else if(o=r,o.dataPatched.cloner?.hideBase)return!0;let a=o.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;s===1?t.hasNonUniformScale?r.matrixWorld.multiplyMatrices(t.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let l=r.geometry;if(l?.getAttribute("position")!==void 0&&e.push(ma(l,r.matrixWorld)),fm(r))return!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,n=!1;this.page.traverseEntity(a=>{for(let l of a.dataPatched.events)if(l.data.disabled===!1&&l.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=KI();if(r!==null?n=r.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||n:this.page.data.publish.gameControlObject!==null&&Jn("game-controls","the scene's game controls"),n===!1){let{enableRotate:a,enablePan:l,enableZoom:c,autoRotate:u,hoverRotatePanMode:d}=this.eventManager.publish.orbitControls;(a||l||c||u||d!==0)&&(this.orbitControls=new Zf(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 s=this.renderer.domElement.width/this.renderer.getPixelRatio(),o=this.renderer.domElement.height/this.renderer.getPixelRatio();KI()?.createJoysticks(this,s,o),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new cn.World(new cn.Vector3(0,this.gravity,0)),this.events=new cn.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let l;if(rc(a))if(a.objectForSample){if(a.objectForSample.dataPatched.physics.fusedBody)return;l=a.object}else return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Ga(a))l=a.object;else{if(vu(a)||sa(a)||a instanceof tl)return;if(l=a,l.dataPatched.cloner?.disabled===!1&&l.dataPatched.cloner?.hideBase&&l.dataPatched.physics?.fusedBody!==!0)return!0}let c=l.dataPatched,u;for(let y of c.events)y.data.disabled!==!0&&y.data.type==="GameControl"&&(u=y.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let d=lb(c),h=!1,p=l.userData.hasDestroy,f=l.userData.hasDrag,g=!1;for(let y of c.events)if(y.data.disabled!==!0){if(y.data.type==="Collision"){h=!0;let v=new YE(y.id,y.data,l,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].every(b=>b.id!==y.id)?this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]=[v]}else if(y.data.type==="Follow"){g=!0;let v=y.data.target;a.traverseVisible(b=>{b.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let m=a.geometry;if(u!==void 0){let y=cn.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(oi,Oo,Ou),a.position0=oi.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Oo.clone(),oi.divideScalar(this.pixelsPerMeter),y.setTranslation(oi.x,oi.y,oi.z).setRotation(Oo);let v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(y);a.rigidBody=v;let b;u.collider.type==="sphere"?b=cn.ColliderDesc.ball(u.collider.radius/this.pixelsPerMeter):u.collider.type==="capsule"?b=cn.ColliderDesc.capsule((u.collider.height/2-u.collider.radius)/this.pixelsPerMeter,u.collider.radius/this.pixelsPerMeter):b=cn.ColliderDesc.cuboid(u.collider.width/this.pixelsPerMeter/2,u.collider.height/this.pixelsPerMeter/2,u.collider.depth/this.pixelsPerMeter/2),b.setFrictionCombineRule(cn.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(cn.CoefficientCombineRule.Min);let x=this.sharedGameControlGlobals.rapierWorld.createCollider(b,v);this.sharedGameControlGlobals.colliderToEntity.set(x.handle,l),oi.fromArray(u.collider.position.map(E=>typeof E=="number"?E:0)).multiply(Ou.setFromMatrixScale(l.matrixWorld)).divideScalar(this.pixelsPerMeter),x.setTranslationWrtParent(oi);let S=new qe().setFromEuler(new qt().setFromVector3(new M().fromArray(u.collider.rotation.map(E=>typeof E=="number"?E:0))));x.setRotationWrtParent(S),x.setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(l,!0)}else c.physics.rigidBody==="dynamic"||d||g||p||f||h?(this.addRigidBody(a,l,{hasFollow:g,hasTransformAnim:d,hasDrag:f}),this.generateSensorColliderDescs(l,c.physics.fusedBody)):(m&&t.push(ma(m,a.matrixWorld)),c.physics.fusedBody&&!fm(a)&&a.traverseObject((y,v)=>{if(v===0)return;let b;if(rc(y))if(y.objectForSample){if(y.objectForSample.dataPatched.physics.fusedBody)return;b=y.object}else return y.object.dataPatched.physics.fusedBody===!0&&y.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else{if(vu(y)||sa(y)||y instanceof tl)return;if(Ga(y))b=y.object;else if(b=y,b.dataPatched.cloner?.hideBase)return!0}let x=b.dataPatched;if(x.physics.enabled==="visibility"?!x.visible:!x.physics.enabled)return!0;let S=y.geometry;if(S?.getAttribute("position")!==void 0&&t.push(ma(S,y.matrixWorld)),fm(y))return!0}),this.generateSensorColliderDescs(l,c.physics.fusedBody,e));if(c.physics?.fusedBody===!0||u||fm(a))return!0}),t.length===0)return;let n=ia(t),r=n.getIndex().count>0;if(!r&&e.length===0)return;n.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let s=cn.RigidBodyDesc.fixed(),o=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s);if(r){let a=cn.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array).setFrictionCombineRule(cn.CoefficientCombineRule.Multiply).setRestitutionCombineRule(cn.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,o)}for(let[a,l]of e){let c=this.sharedGameControlGlobals.rapierWorld.createCollider(a,o);this.sensorToTriggerEvent[c.handle]=l}}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(e.data.type==="Trigger"&&e.data.disabled!==!0){let n=new ab(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),r=new ne().compose(ga.fromArray(e.data.position.map(s=>typeof s=="number"?s:0)),pm.setFromEuler(G4.fromArray(e.data.rotation.map(s=>typeof s=="number"?s:0))),eR);if(e.data.triggerZone==="box"){let s=new Nt;s.min.fromArray(e.data.size.map(o=>typeof o=="number"?o:0)).multiplyScalar(-.5),s.max.fromArray(e.data.size.map(o=>typeof o=="number"?o:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([s,r,t,n])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,r,t,n])}}),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(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let n=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let r=t/1e3;r<n&&r>n*.55&&(r=n),this.accumulator+=r;let s=performance.now(),o=0,a=6;for(;this.accumulator>=n&&o<a&&(e=this.stepPhysics()&&e,this.accumulator-=n,o++,!(performance.now()-s>n*1e3)););this.accumulator=this.accumulator%n}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(oi,Oo,Ou);let e=t;e.prevQ===void 0?(e.prevQ=Oo.clone(),e.prevT=oi.clone()):(e.prevQ.copy(Oo),e.prevT.copy(oi))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,n,r]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(r)||(n.setBodyType(cn.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(n.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,n=t.linvel(),r=t.translation(),s=Math.hypot(n.x,n.z);for(let o=0;o<t.numColliders();o++){let a=t.collider(o);e.contactPairsWith(a,l=>{let c=l.parent();if(c===null||!c.isDynamic())return;let u=c.translation(),d=-1/0,h=0,p=0;if(e.contactPair(a,l,v=>{let b=v.normal(),S=b.x*(u.x-r.x)+b.y*(u.y-r.y)+b.z*(u.z-r.z)<0?-1:1;if(Math.abs(b.y)>bne)return;let E=S*b.x,T=S*b.z,w=Math.hypot(E,T);if(w<1e-4)return;let _=(n.x*E+n.z*T)/w;_>d&&(d=_,h=E/w,p=T/w)}),d===-1/0)return;let f=n.x*h+n.z*p;if(f<-nR)return;let g=c.linvel();if(s>nR&&f>nR){let v=g.x*h+g.z*p;if(v<=0)return;let b=Math.min(v,f);c.setLinvel({x:h*b,y:g.y,z:p*b},!0);return}let m=g.x*h+g.z*p-Math.max(0,f);if(m<=0)return;let y=m*(1-vne);c.setLinvel({x:g.x-h*y,y:g.y,z:g.z-p*y},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let e of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(e),e.rigidBody.setNextKinematicTranslation(oi.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(Oo);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,n){let r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(n))._parent,s;if(e.cloner){for(let o of e.cloner.children)if(o.rigidBody===r){s=o;break}}t.dispatch(s),e.dispatchEvent(ZE)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,n){let r=j4.copy(t.matrixWorld).invert();t.traverseEntity((s,o)=>{if(e===!1&&o===1)return!0;for(let a of s.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let l=new ab(a.id,a.data,s,this.page,this.sharedAssets,this.eventManager),c;if(a.data.triggerZone==="box"?c=cn.ColliderDesc.cuboid(...a.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):c=cn.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),c.setDensity(0).setSensor(!0).setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS),ga.fromArray(a.data.position.map(u=>typeof u=="number"?u:0)),pm.setFromEuler(G4.fromArray(a.data.rotation.map(u=>typeof u=="number"?u:0))),$E.compose(ga,pm,eR).premultiply(s.matrixWorld),n?($E.decompose(ga,pm,JI),c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_FIXED|cn.ActiveCollisionTypes.DYNAMIC_FIXED)):($E.premultiply(r).decompose(ga,pm,JI),t.rigidBody.bodyType()===cn.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===cn.RigidBodyType.Fixed?c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_FIXED|cn.ActiveCollisionTypes.DYNAMIC_FIXED):c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_KINEMATIC|cn.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),ga.divideScalar(this.pixelsPerMeter),c.setTranslation(ga.x,ga.y,ga.z),c.setRotation(pm),n)n.push([c,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(c,t.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[n,r,s,o]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let l=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(s===l||o.isValidTriggeringObject(Ot.is(l)?l:l.object)===!1)continue;let c=j4.copy(s.matrixWorld).decompose(ga,H4,JI).compose(ga,H4,eR).multiply(r),u=$E.copy(l.matrixWorld).invert().multiply(c),d=l.bvhGeometry.boundsTree;n instanceof Nt?t=d.intersectsBox(n,u):(tR.radius=n,tR.center.setFromMatrixPosition(u),t=d.intersectsSphere(tR)),t?o.currentIntersectedObjects.indexOf(l)===-1&&(o.currentIntersectedObjects.push(l),o.dispatch(),s.dispatchEvent(xne)):o.currentIntersectedObjects=o.currentIntersectedObjects.filter(h=>h!==l)}}}};Zd();X();mv();on();uc();var q4=4,rR=8;var iR=.02,sR=.3,Sne=65,X4=new M,Y4=new M,wne=new M,$i=new M,bc=new M,mm=new M,oR=new ne,$4=new ne,Ene=new ne,Ks=new qe,ch=new qe,gm=new qt(0,0,0,"YXZ"),Tne=new M(1,0,0),ol=new M(0,1,0),Mne=new M(0,0,1),K4=new M(1,1,1),aR=[],Z4=i=>aR[i]??(aR[i]=new M),lR=new M,_ne=new M,Ane=new M,Cne=new M,Q4=new qe,Pne=new M,J4=new qe,Ine=1,Rne=.025,One=16e-6,ej=12,Dne=20,Ii=new ri,Do=new Nt,Lne={type:"requestRender"},Nne={type:"updateMatrix"},QE=class extends _n{constructor(e,n,r,s,o,a,l,c,u){super();this.object=e;this.domElement=n;this.data=r;this.gloabalPhysics=s;this.controlsManager=o;this.cameraFollow=a;this.camera=l;this.page=c;this.sharedAssets=u;this.enableDamping=!0;this.hiddenMatrix0=new ne;this.target0=new M;this.zoom0=1;this.rotForce=1;this.moveForce=1;this.pixelsPerMeter=UE;this.euler0=new qt(0,0,0,"YXZ");this.position0Cam=new M;this.quat0Cam=new qe;this.scale0Cam=new M;this.hiddenMatrix0Cam=new ne;this.threshEndTranslate=.01;this.threshEndRotate=1e-8;this.threshEndRotVel=.005;this.collider={type:"capsule",radius:40,segment:new ri(new M(0,-40,0),new M(0,40,0)),matrix:new ne,position:new M,rotation:new qe};this.euler=new qt(0,0,0,"YXZ");this.eulerDelta=new M;this.lastPosition=new M;this.lastCameraQuaternion=new qe;this.lastCameraPosition=new M;this.PI_2=Math.PI/2;this.prevMouse=new j;this.velocityTarget=new M;this.velocity=new M;this.directionXZ=new M;this.rotVelocityStick=new M;this.rotVelocityTarget=new M;this.rotVelocity=new M;this.rotDirection=new M;this.nonColliderRotOffset=new ne;this.nonColliderPosOffset=new ne;this.firstPointerId=-1;this.rot=new M;this.path=[];this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0};this.onObject=!1;this.actionState={};this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]];this.collisionEnabled=!0;this.offsetMatrix=new ne;this.objectToTarget=new M;this.objectToTarget0=new M;this.objectToCamXZ=new M;this.objectToCamXZ0=new M;this.targetToCamera=new M;this.targetToCamera0=new M;this.cameraPolarAxis0=new M;this.targetPos=new M;this.targetQuat=new qe;this.lerpFactorPos=new M().setScalar(.3);this.lerpFactorPosStart=.3;this.lerpFactorPosEnd=.3;this.lerpFactorRotStart=.3;this.lerpFactorRotEnd=.3;this.lerpFactorPosCamera=.3;this.lerpFactorRotCamera=.3;this.objXZQuat=new qe;this.objXZQuatInv=new qe;this.objXZRotMat=new ne;this.isFirstPerson=!1;this.didHit=!1;this.groundVelocity=new M;this.pushedVelocity=new M;this.groundYRotation=0;this.objectRealQuat=new qe;this.colliderWorldQuat=new qe;this.groundNormal=new M;this.groundTilt=new qe;this.groundTiltInv=new qe;this.lastHitObj=null;this.isFirstFrame=!0;this.rotationAccumWhenOrientWithCamera=0;this.navMeshPathDest=null;this.position=new M;this.quaternion=new qe;this.scale=new M;this.initialAction=!0;this.onPointerDown=e=>{!(e.target===this.domElement||e.target instanceof HTMLElement&&e.target.tagName==="SPLINE-VIEWER"&&e.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!fi&&!sC&&this.domElement.requestPointerLock(),this.prevMouse.set(e.clientX,e.clientY))};this.onPointerUp=e=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),e.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()};this.onPointerMove=e=>{if(e.pointerId!==this.firstPointerId)return;let n=e.clientX-this.prevMouse.x,r=e.clientY-this.prevMouse.y;this.prevMouse.set(e.clientX,e.clientY),e.pointerType==="mouse"&&this.rotBy!=="keys"&&(sC&&JN<15.5&&!fi?(this.eulerDelta.y=-n*this.mouseOrbitSensitivity,this.eulerDelta.x=-r*this.mouseOrbitSensitivity):(this.eulerDelta.y=-e.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-e.movementY*this.mouseOrbitSensitivity)),e.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-n*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-r*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()};this.onPointerlockChange=e=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?QE.isLocked=!0:QE.isLocked=!1};this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")};this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0};this.onKeyDown=e=>{!(e.target instanceof HTMLInputElement)&&(e.code==="ArrowLeft"||e.code==="ArrowUp"||e.code==="ArrowRight"||e.code==="ArrowDown"||e.code==="Space")&&e.preventDefault();for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]){this.movementState[n[0]]=1;break}this.controlsManager.requestRender()};this.onKeyUp=e=>{for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]||e.code.slice(3,e.code.length).toUpperCase()===n[1]){this.movementState[n[0]]=0;break}};this.copyVRGamePadValues=(e,n)=>{for(let r=2;r<4;r++){let s=e.axes[r];n===0?r===2?this.movementState.movePosX=s:this.movementState.movePosZ=s:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,r===2?this.movementState.rotPosY=s:this.moveMode==="fly"&&(this.movementState.moveNegY=s))}};this.sharedGameControlGlobals=o.sharedGameControlGlobals,e===l&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let d=this.euler0.clone(),h=d.y;if(this.objectRealQuat.copy(this.quaternion),d.y=0,this.quaternion.setFromEuler(d),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),d.set(0,h,0),this.quaternion.setFromEuler(d),this.rot.setFromEuler(d),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let m=new M(0,0,-1).applyQuaternion(this.camera.quaternion),y=new M().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(y),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ);let v;Math.abs(m.y)<1e-6?(y.y=0,m.y=0,v=y.projectOnVector(m)):y.y/m.y>0?v=m.multiplyScalar(y.y/m.y):v=m.multiplyScalar(y.length()),this.targetToCamera0.copy(v).negate();let b=this.camera.position.clone().add(v);this.objectToTarget0.subVectors(b,this.position);let x=new qt().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-x.x,x.x=0,x.z=0,x.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(x)}if(this.object instanceof hn&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=r.rotByTouch??"joystick",this.rotBy=r.rotBy??"keys",this.rotationMode=r.rotationMode??"normal",this.moveMode=r.moveMode??"walk",this.collisionEnabled=r.collisionEnabled,this.speedTranslate=(r.speedTranslate??250)*Ine,this.speedOrbit=(r.speedRotate??100)*Rne,this.mouseOrbitSensitivity=(r.speedRotate??100)*One,this.keyAssignments=r.keyAssignments.map(m=>{let y=[m[0],m[1]];return y[1]==="\u25B2"?y[1]="ArrowUp":y[1]==="\u25C0"?y[1]="ArrowLeft":y[1]==="\u25BC"?y[1]="ArrowDown":y[1]==="\u25B6"?y[1]="ArrowRight":y[1]==="\u21E7"?y[1]="Shift":y[1]==="\u21B5"?y[1]="Enter":y[1]==="Space"?y[1]=" ":y[1]==="\u2318"?y[1]="Meta":y[1]==="Ctrl"?y[1]="Control":y[1]==="Esc"&&(y[1]="Escape"),y}),r.rotBy==="mouse"){let m;m=this.keyAssignments.findIndex(y=>y[0]==="rotNegX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(y=>y[0]==="rotPosX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(y=>y[0]==="rotPosY"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(y=>y[0]==="rotNegY"),m!==-1&&(this.keyAssignments[m][1]="")}this.lerpFactorPosStart=1-.02**(1/((r.delayPos[0]??.3)*60)),this.lerpFactorPosEnd=1-.02**(1/((r.delayPos[1]??.3)*60)),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/((r.delayRot[0]??.3)*60)),this.lerpFactorRotEnd=1-.02**(1/((r.delayRot[1]??.3)*60)),this.lerpFactorPosCamera=1-.02**(1/((r.delayPosCamera??.3)*60)),this.lerpFactorRotCamera=1-.02**(1/((r.delayRotCamera??.3)*60)),this.gravity=(this.gloabalPhysics.gravity??mu.defaultData.gravity)*ej,this.usePhysics=this.gloabalPhysics.usePhysics??mu.defaultData.usePhysics,this.jumpPower=r.jumpPower*Dne,this.resetYPosition=this.position.y+Math.abs(r.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=r.alignToGround??!1,this.orientMode=r.autoOrientMove?r.orientMode:"none",this.orientWith=r.orientWith??cf.defaultDataThirdPerson.orientWith,this.slopeThresh=Sne*Math.PI/180,r.collider.type==="capsule"?(this.collider.radius=r.collider.radius,this.collider.segment.start.y=r.collider.height/2-r.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=r.collider.height*iR/this.pixelsPerMeter,this.stepThresh=r.collider.height*sR/this.pixelsPerMeter,this.colliderHeight=r.collider.height):r.collider.type==="sphere"?(this.collider.radius=r.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*r.collider.radius*iR/this.pixelsPerMeter,this.stepThresh=2*r.collider.radius*sR/this.pixelsPerMeter,this.colliderHeight=r.collider.radius*2):(this.offset=r.collider.height*iR/this.pixelsPerMeter,this.stepThresh=r.collider.height*sR/this.pixelsPerMeter,this.colliderHeight=r.collider.height),this.collider.type=r.collider.type;let p=new M().fromArray(r.collider.position.map(m=>typeof m=="number"?m:0)),f=new qe().setFromEuler(new qt().fromArray([...r.collider.rotation.map(m=>typeof m=="number"?m:0),"XYZ"]));this.collider.position.copy(p).multiply(this.scale),this.collider.rotation.copy(f),this.collider.matrix.compose(p,f,K4),r.cameraXAxis!==void 0&&(this.cameraXAxis=r.cameraXAxis,this.cameraYAxis=r.cameraYAxis,this.minPolarAngle=r.cameraRotXLimits[0],this.maxPolarAngle=r.cameraRotXLimits[1],this.minAzimuthAngleRel=r.cameraRotYLimits[0],this.maxAzimuthAngleRel=r.cameraRotYLimits[1]),this.forwardDir=r.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=r.runMultiplier??2;let g=r.navmesh.destinationHelperRadius*2;if(g>0){let m=new ze;m.push({fi:0,data:{...Qn.defaultData("light","phong"),alpha:0},id:"layer1"}),m.push({fi:0,data:{...Qn.defaultData("color"),color:r.navmesh.destinationHelperColor,alpha:r.navmesh.destinationHelperColor.a},id:"layer2"});let y=Aw({layers:m},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Ht(aw.create({parameters:{width:g,height:g/10,hollow:.7}}),y),this.navMeshPathDest.material.userData.opacity0=r.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let n=new qt().setFromQuaternion(this.quaternion,"YXZ"),r=n.y;this.objectRealQuat.copy(this.quaternion),n.y=0,this.quaternion.setFromEuler(n),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),n.set(0,r,0),this.quaternion.setFromEuler(n),this.rot.setFromEuler(n),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof hn?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,n=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},lf.list.forEach(r=>{this.actions[r]=ln({...e,disabled:!1,type:"GameControl"},e.gameActions[r],this.page,n,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),Nn(this.actions.idle),Nn(this.actions.move),Nn(this.actions.run),Nn(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(n=>{n.play()}),this.actions[e].Animation.forEach(n=>{n.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(n=>{n.play()}),this.actions[e].Create.forEach(n=>{n.dispatchStart()}),this.actions[e].Audio.forEach(n=>{n.dispatchGameControl("start")}),this.actions[e].Particles.forEach(n=>{n.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(n=>{n.stop(),n.object.currentState!==null&&n.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(n=>{n.stop()}),this.actions[e].Create.forEach(n=>{n.dispatchStop()}),this.actions[e].Audio.forEach(n=>{n.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(n=>{n.dispatchGameControl("stop")})))}get colliderWorldPosition(){return $i.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let n=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let r=n*60,s=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let a=bc.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*ej),1)*(this.gravity>0?1:-1):this.velocity.y)*n,0).divideScalar(this.pixelsPerMeter),l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,rR,void 0,void 0,this.object.rigidBody);if(l){this.onObject=!0,this.groundNormal.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(s=!0),l.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let c=l.collider.parent(),u=c!==null&&c.isKinematic()?c:null,d=u===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(u.handle);if(u!==null&&d?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition($i).add(this.collider.position).divideScalar(this.pixelsPerMeter),p=u.velocityAtPoint(h);this.groundVelocity.set(p.x,p.y,p.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=u.angvel().y*n}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*r),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let a=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let l=$i.subVectors(this.path[1],this.position),c=bc.subVectors(this.path[1],this.path[0]);l.dot(c)<0?this.path.shift():(this.directionXZ.x=c.x,this.directionXZ.z=c.z),a.opacity=a.userData.opacity0}else a.opacity-=.05*a.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**r),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**r),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**r)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let o=wne.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let a=bc.copy(o);a.y=0,o.set(0,o.y,a.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let a=$i;this.camera.getWorldDirection(a);let l=mm.copy(ol).multiplyScalar(a.dot(ol));a.sub(l);let c=bc.copy(this.directionXZ);c.x*=-1,this.rot.y=a.angleTo(c)*(a.cross(c).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(gm.setFromVector3(this.rot),this.moveMode==="walk"&&(gm.x=0),o.applyEuler(gm),s&&(ch.setFromUnitVectors(ol,this.groundNormal),o.applyQuaternion(ch)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let a=0;for(let l of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(l.rigidBody===void 0||l.prevQ===void 0)continue;(l.hasNonUniformScale?l.matrixWorldRigid:l.matrixWorld).decompose(lR,Q4,_ne);let c=this.object.getWorldPosition(Ane).add(this.collider.position).sub(lR);J4.copy(l.prevQ).invert().premultiply(Q4);let u=mm.subVectors(lR,l.prevT).add(Cne.copy(c).applyQuaternion(J4).sub(c)).divideScalar(n).divideScalar(this.pixelsPerMeter),d=l.rigidBody.collider(0).castCollider(u,this.object.rigidBody.collider(0),$i.copy(o).divideScalar(this.pixelsPerMeter),0,n,!1);u.multiplyScalar(this.pixelsPerMeter);let h=Ot.is(l)?l:l.object;if(d!==null&&this.lastHitObj!==h){let p;l instanceof Yr&&(p=l);let f=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(f)for(let g of f)g.data.target==="character"&&(g.dispatch(p),h.dispatchEvent(ZE));this.lastHitObj=h}d!==null&&(Math.abs(u.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=u.x),Math.abs(u.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=u.y),Math.abs(u.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=u.z),Z4(a++).copy(d.normal1).applyQuaternion(l.quaternion))}if(a>0){for(let l=0;l<a;l++){let c=Z4(l),u=c.dot(o);u<0&&o.addScaledVector(c,-u)}o.add(this.pushedVelocity)}else o.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(n),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**r):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**r),this.euler.x+=this.rotVelocity.x*n,this.euler.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*n),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(ol,this.euler.y-this.euler0.y);let a=bc.copy(this.objectToCamXZ).normalize(),l=mm.copy(o).multiplyScalar(n);l.y=0;let c=l.sub($i.copy(a).multiplyScalar(l.dot(a))).cross(a).y;this.euler.y-=Math.atan2(c,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=xe.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=xe.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=xe.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(gm.copy(this.euler),gm.y=0,this.nonColliderRotOffset.makeRotationFromEuler(gm)),Ks.setFromAxisAngle(Tne,this.rot.x),ch.setFromAxisAngle(ol,this.rot.y),ch.multiply(Ks),Ks.setFromAxisAngle(Mne,this.rot.z),ch.multiply(Ks),this.quaternion.copy(ch),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let a=bc.copy(o).multiplyScalar(n/this.pixelsPerMeter),l=null;this.didHit=!1;let c=new M;for(let h=0;h<5;h++){let p=a.length(),f=mm.copy(a).normalize();if(l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),this.colliderWorldQuat,f,this.object.rigidBody.collider(0).shape,0,p,!1,rR|q4,void 0,void 0,this.object.rigidBody),l!==null){this.didHit=!0;let g=this.sharedGameControlGlobals.colliderToEntity.get(l.collider.handle);if(g!==this.lastHitObj&&h===0){this.lastHitObj=g;let b=this.sharedGameControlGlobals.entityToCollisionEvents[g?.uuid];if(b){for(let x of b)if(x.data.target==="character"){let S=(this.sharedGameControlGlobals.rapierWorld?.getCollider(l.collider.handle))._parent,E;if(g.cloner){for(let T of g.cloner.children)if(T.rigidBody===S){E=T;break}}x.dispatch(E),g.dispatchEvent(ZE)}}}let m=X4.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat),y=Y4.copy(f).multiplyScalar(l.time_of_impact).dot(m),v=l.time_of_impact;if(v===0&&(this.position.y+=this.offset*this.pixelsPerMeter),y>this.offset&&(v=l.time_of_impact*(y-this.offset)/y,c.addScaledVector(f,v)),a.copy(f).multiplyScalar(p-v),Math.acos(-m.y)>this.slopeThresh){let b=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),x=mm.copy(l.witness2).applyQuaternion(this.colliderWorldQuat);x.y=0;let S=b.add(x);S.y+=this.stepThresh;let E=this.sharedGameControlGlobals.rapierWorld.castShape(S,this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,rR|q4,void 0,void 0,this.object.rigidBody);E!==null&&E.time_of_impact===0&&(m.y=0,m.normalize())}a.addScaledVector(m,-a.dot(m))}else{h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),c.add(a);break}}this.position.addScaledVector(c,this.pixelsPerMeter),$i.copy(this.position).divideScalar(this.pixelsPerMeter),Ks.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let u=this.object.rigidBody,d=u!==void 0&&Pne.copy($i).sub(u.translation()).lengthSq()>1;u!==void 0&&(d?(u.setTranslation($i,!0),u.setRotation(Ks,!0)):(u.setNextKinematicTranslation($i),u.setNextKinematicRotation(Ks)))}else{let a=this.onObject?1:5,l=o.multiplyScalar(n/a);for(let c=0;c<a;c++)this.position.add(l),this.collisionAdjustment(n/a)}else this.position.addScaledVector(o,n);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let a=this.objectToTarget.add(this.position),l=this.targetToCamera.add(a);oR.lookAt(l,a,ol).setPosition(l),oR.decompose(this.targetPos,this.targetQuat,$i),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**r),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**r),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=xe.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=xe.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(Nne),this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)?!1:(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(Lne),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Ks.setFromAxisAngle(ol,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?xe.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e);let n;this.cameraXAxis==="Limit"?n=xe.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):n=xe.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let r=$i.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&r.applyQuaternion(e);let s=ch.setFromAxisAngle(r,n);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(s)}groundTiltAdjustment(e){ol.angleTo(e)*180/Math.PI<15||ol.angleTo(e)*180/Math.PI>85?Ks.identity():Ks.setFromUnitVectors(ol,e),this.groundTilt.slerp(Ks,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let n=Y4.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let r=oR.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose($i,Ks,bc).compose($i,Ks,K4);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(o=>{if(o===this.object||o.isDescendantOf(this.object)||!o.bvhGeometry||!o.bvhGeometry.boundsTree)return;Do.makeEmpty(),o.updateMatrixWorldRigid();let a=o.matrixWorldRigid,l=$4.copy(a).invert(),c=Ene.copy($4).multiply(r);Ii.copy(this.collider.segment),Ii.start.applyMatrix4(c),Ii.end.applyMatrix4(c);let u=X4.copy(this.position).applyMatrix4(l);Do.expandByPoint(Ii.start),Do.expandByPoint(Ii.end),Do.min.addScalar(-this.collider.radius),Do.max.addScalar(this.collider.radius),o.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder(d){return d.distanceToPoint(Ii.end)},intersectsBounds:d=>d.intersectsBox(Do),intersectsTriangle:d=>{let h=$i,p=bc,f=d.closestPointToSegment(Ii,h,p);if(f<this.collider.radius){let g=this.collider.radius-f,m=p.sub(h).normalize(),y=mm.copy(u);y.addScaledVector(m,g);let v=y.applyMatrix4(a).sub(this.position);n.add(v),Ii.start.addScaledVector(m,g),Ii.end.addScaledVector(m,g)}}})}),Do.makeEmpty(),Ii.copy(this.collider.segment),Ii.start.applyMatrix4(r),Ii.end.applyMatrix4(r),Do.expandByPoint(Ii.start),Do.expandByPoint(Ii.end),Do.min.addScalar(-this.collider.radius),Do.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder(o){return o.distanceToPoint(Ii.end)},intersectsBounds:o=>o.intersectsBox(Do),intersectsTriangle:o=>{let a=$i,l=bc,c=o.closestPointToSegment(Ii,a,l);if(c<this.collider.radius){let u=this.collider.radius-c,d=l.sub(a).normalize();this.alignToGround&&this.groundTiltAdjustment(d),n.addScaledVector(d,u),Ii.start.addScaledVector(d,u),Ii.end.addScaledVector(d,u)}}}),this.onObject=Math.abs(n.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let s=Math.max(0,n.length()-1e-5);n.normalize().multiplyScalar(s),this.position.add(n)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},cb=QE;cb.isLocked=!1;X();ff();Zd();Kd();var tj,nj=new Promise(i=>{tj=i});var cR,JE;function rj(i){if(JE)return JE;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.25/build");typeof window<"u"&&(cR=new URL(n.endsWith("/")?n:`${n}/`,window.location.href).href);let s=import("./navmesh.js"),[o,a]=await Promise.all([s,fetch(`${n}/navmesh.wasm`).then(u=>u.arrayBuffer())]),l=o.default,c=await l({wasmBinary:a});tj(c)}return JE=t(),JE}gn();var Bne=!1?typeof window<"u"?window.location.href:"":"https://cdn.spline.design/@splinetool/runtime@2.0.25/build/",Fne=i=>`
9805
+ `)>=0&&(t-=s),n===3?e*.5-t*.5:n===2?e-t:0}getLineInitialOffsetY(t,e,n,r,s){let o=e*t,a=Math.abs(this.ascender-this.descender)*r,l=t-a,c=-this.ascender*r-l/2;return s===3?-(n-o-c):s===2?-(n*.5-o*.5-c):c}createPath(t,e,n,r,s){let o=t.getPath(n,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!o){console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");return}let a=new NE,l=(t.advanceWidth??1)*e;if(t)for(let c of o.commands){let u=a.currentPath?.currentPoint;if(!(u&&c.type!=="Z"&&u.x===c.x&&-u.y===c.y))switch(c.type){case"M":a.moveTo(c.x,-c.y);break;case"L":a.lineTo(c.x,-c.y);break;case"Q":a.quadraticCurveTo(c.x1,-c.y1,c.x,-c.y);break;case"C":a.bezierCurveTo(c.x1,-c.y1,c.x2,-c.y2,c.x,-c.y);break}}return a.subPaths.forEach(c=>{let u=fne(c.curves);u!==void 0&&c.currentPoint.distanceTo(u)>0&&c.lineTo(u.x,u.y)}),{offsetX:l,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}computeSpaceWidthForLine(t,e,n,r){let s=this.getCharWidth(" ",n),o=t[e];if(o){let a=this.countSpaces(o.trimEnd());if(n.horizontalAlign===4&&e<t.length-1&&a){let l=typeof n.width=="string"?Number(r.getVariable(n.width)):n.width,c=this.getTextWidth(o,n);return(l-(c-a*s))/a}}return s}countSpaces(t){return(t.match(/ /g)||[]).length}};function fne(i){if(i.length){let t=i[0];if(t instanceof _i)return t.v1;if(t instanceof Ni||t instanceof vs)return t.v0}}ow();Qt();wo("TextGeometry",(i,t,e)=>new Au(i,t,e));var y4={create:(i,t)=>new kf(i,t)};nv("TextGeometry",y4);nv("InputGeometry",y4);vk(FE);Mt("text");pt();var UE=200,v4=null;function b4(i){v4=i}function KI(){return v4}function x4(i){let t=!1;return i.scene.objects.forEach(e=>{e.data.type==="Page"&&!t&&e.data.publish.gameControlObject&&vo.traverseModuleInstances(i,e.id,(r,s,o)=>{for(let a of o)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(t=!0)})}),t}gn();var rb=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return Math.sqrt(e*e+n*n)},S4=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return mne(Math.atan2(n,e))},w4=(i,t,e)=>{let n={x:0,y:0};return e=VE(e),n.x=i.x-t*Math.cos(e),n.y=i.y-t*Math.sin(e),n},VE=i=>i*(Math.PI/180),mne=i=>i*(180/Math.PI),E4=i=>isNaN(i.buttons)?i.pressure!==0:i.buttons!==0,kE=new Map,T4=i=>{kE.has(i)&&clearTimeout(kE.get(i)),kE.set(i,setTimeout(function(){kE.delete(i),i()},100))},lm=(i,t,e)=>{let n=t.split(/[ ,]+/g),r;for(let s=0;s<n.length;s+=1)r=n[s],i.addEventListener?i.addEventListener(r,e,!1):i.attachEvent&&i.attachEvent(r,e)},cm=(i,t,e)=>{let n=t.split(/[ ,]+/g),r;for(let s=0;s<n.length;s+=1)r=n[s],i.removeEventListener?i.removeEventListener(r,e):i.detachEvent&&i.detachEvent(r,e)};var zE=i=>(i.preventDefault(),i.type.match(/^touch/)?i.changedTouches:i),ZI=()=>{if(typeof window>"u")return;let i=window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,t=window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;return{x:i,y:t}},GE=(i,t)=>{t.top||t.right||t.bottom||t.left?(i.style.top=t.top,i.style.right=t.right,i.style.bottom=t.bottom,i.style.left=t.left):(i.style.left=t.x+"px",i.style.top=t.y+"px")},jE=(i,t,e)=>{let n=_4(i);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof t=="string")n[r]=t+" "+e;else{let s="";for(let o=0,a=t.length;o<a;o+=1)s+=t[o]+" "+e+", ";n[r]=s.slice(0,-2)}return n},M4=(i,t)=>{let e=_4(i);for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t);return e},_4=i=>{let t={};return t[i]="",["webkit","Moz","o"].forEach(function(n){t[n+i.charAt(0).toUpperCase()+i.slice(1)]=""}),t},HE=(i,t)=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e]);return i},A4=(i,t)=>{let e={};for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&Object.prototype.hasOwnProperty.call(t,n)?e[n]=t[n]:Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);return e},ib=(i,t)=>{if(i.length)for(let e=0,n=i.length;e<n;e+=1)t(i[e]);else t(i)},C4=(i,t,e)=>({x:Math.min(Math.max(i.x,t.x-e),t.x+e),y:Math.min(Math.max(i.y,t.y-e),t.y+e)});typeof window<"u"&&(P4="ontouchstart"in window,I4=!!window.PointerEvent,R4=!!window.MSPointerEvent);var P4,I4,R4,sb={touch:{start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},pointer:{start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"},MSPointer:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},um,ob={};I4?um=sb.pointer:R4?um=sb.MSPointer:P4?(um=sb.touch,ob=sb.mouse):um=sb.mouse;function lh(){}lh.prototype.on=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]=e._handlers_[r]||[],e._handlers_[r].push(t);return e};lh.prototype.off=function(i,t){var e=this;return e._handlers_=e._handlers_||{},i===void 0?e._handlers_={}:t===void 0?e._handlers_[i]=null:e._handlers_[i]&&e._handlers_[i].indexOf(t)>=0&&e._handlers_[i].splice(e._handlers_[i].indexOf(t),1),e};lh.prototype.trigger=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]&&e._handlers_[r].length&&e._handlers_[r].forEach(function(o){o.call(e,{type:r,target:e},t)})};lh.prototype.config=function(i){var t=this;t.options=t.defaults||{},i&&(t.options=A4(t.options,i))};lh.prototype.bindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},e._domHandlers_[t]=function(){typeof e["on"+t]=="function"?e["on"+t].apply(e,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},lm(i,um[t],e._domHandlers_[t]),ob[t]&&lm(i,ob[t],e._domHandlers_[t]),e};lh.prototype.unbindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},cm(i,um[t],e._domHandlers_[t]),ob[t]&&cm(i,ob[t],e._domHandlers_[t]),delete e._domHandlers_[t],this};var dm=lh;function vi(i,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=i,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=vi.id,vi.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}vi.prototype=new dm;vi.constructor=vi;vi.id=0;vi.prototype.buildEl=function(i){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)};vi.prototype.stylize=function(){if(this.options.dataOnly)return this;var i=this.options.fadeTime+"ms",t=M4("borderRadius","50%"),e=jE("transition","opacity",i),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},HE(n.el,e),this.options.shape==="circle"&&HE(n.back,t),HE(n.front,t),this.applyStyles(n),this};vi.prototype.applyStyles=function(i){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var e in i[t])this.ui[t].style[e]=i[t][e];return this};vi.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};vi.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};vi.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null};vi.prototype.show=function(i){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof i=="function"&&i.call(this)},t.options.fadeTime)),t};vi.prototype.hide=function(i){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var e=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=e,typeof i=="function"&&i.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let e=t.options.restJoystick,n={};n.x=e===!0||e.x!==!1?0:t.instance.frontPosition.x,n.y=e===!0||e.y!==!1?0:t.instance.frontPosition.y,t.setPosition(i,n)}return t};vi.prototype.setPosition=function(i,t){var e=this;e.frontPosition={x:t.x,y:t.y};var n=e.options.fadeTime+"ms",r={};r.front=jE("transition",["top","left"],n);var s={front:{}};s.front={left:e.frontPosition.x+"px",top:e.frontPosition.y+"px"},e.applyStyles(r),e.applyStyles(s),e.restTimeout=setTimeout(function(){typeof i=="function"&&i.call(e),e.restCallback()},e.options.fadeTime)};vi.prototype.restCallback=function(){var i=this,t={};t.front=jE("transition","none",""),i.applyStyles(t),i.trigger("rested",i.instance)};vi.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};vi.prototype.computeDirection=function(i){var t=i.angle.radian,e=Math.PI/4,n=Math.PI/2,r,s,o;if(t>e&&t<e*3&&!i.lockX?r="up":t>-e&&t<=e&&!i.lockY?r="left":t>-e*3&&t<=-e&&!i.lockX?r="down":i.lockY||(r="right"),i.lockY||(t>-n&&t<n?s="left":s="right"),i.lockX||(t>0?o="up":o="down"),i.force>this.options.threshold){var a={},l;for(l in this.direction)Object.prototype.hasOwnProperty.call(this.direction,l)&&(a[l]=this.direction[l]);var c={};this.direction={x:s,y:o,angle:r},i.direction=this.direction;for(l in a)a[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return i;(!c.x||!c.y)&&this.trigger("plain",i),c.x||this.trigger("plain:"+s,i),c.y||this.trigger("plain:"+o,i),c.angle||this.trigger("dir dir:"+r,i)}else this.resetDirection();return i};var O4=vi;function Kr(i,t){var e=this;e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.pressureIntervals={},e.manager=i,e.id=Kr.id,Kr.id+=1,e.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},e.config(t),(e.options.mode==="static"||e.options.mode==="semi")&&(e.options.multitouch=!1),e.options.multitouch||(e.options.maxNumberOfNipples=1);let n=getComputedStyle(e.options.zone.parentElement);return n&&n.display==="flex"&&(e.parentIsFlex=!0),e.updateBox(),e.prepareNipples(),e.bindings(),e.begin(),e.nipples}Kr.prototype=new dm;Kr.constructor=Kr;Kr.id=0;Kr.prototype.prepareNipples=function(){var i=this,t=i.nipples;t.on=i.on.bind(i),t.off=i.off.bind(i),t.options=i.options,t.destroy=i.destroy.bind(i),t.ids=i.ids,t.id=i.id,t.processOnMove=i.processOnMove.bind(i),t.processOnEnd=i.processOnEnd.bind(i),t.get=function(e){if(e===void 0)return t[0];for(var n=0,r=t.length;n<r;n+=1)if(t[n].identifier===e)return t[n];return!1}};Kr.prototype.bindings=function(){var i=this;i.bindEvt(i.options.zone,"start"),i.options.zone.style.touchAction="none",i.options.zone.style.msTouchAction="none"};Kr.prototype.begin=function(){var i=this,t=i.options;if(t.mode==="static"){var e=i.createNipple(t.position,i.manager.getIdentifier());e.add(),i.idles.push(e)}};Kr.prototype.createNipple=function(i,t){var e=this,n=e.manager.scroll,r={},s=e.options,o={x:e.parentIsFlex?n.x:n.x+e.box.left,y:e.parentIsFlex?n.y:n.y+e.box.top};if(i.x&&i.y)r={x:i.x-o.x,y:i.y-o.y};else if(i.top||i.right||i.bottom||i.left){var a=document.createElement("DIV");a.style.display="hidden",a.style.top=i.top,a.style.right=i.right,a.style.bottom=i.bottom,a.style.left=i.left,a.style.position="absolute",s.zone.appendChild(a);var l=a.getBoundingClientRect();s.zone.removeChild(a),r=i,i={x:l.left+n.x,y:l.top+n.y}}var c=new O4(e,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:t,position:i,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(GE(c.ui.el,r),GE(c.ui.front,c.frontPosition)),e.nipples.push(c),e.trigger("added "+c.identifier+":added",c),e.manager.trigger("added "+c.identifier+":added",c),e.bindNipple(c),c};Kr.prototype.updateBox=function(){var i=this;i.box=i.options.zone.getBoundingClientRect()};Kr.prototype.bindNipple=function(i){var t=this,e,n=function(r,s){e=r.type+" "+s.id+":"+r.type,t.trigger(e,s)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",n),i.on("dir:up dir:right dir:down dir:left",n),i.on("plain:up plain:right plain:down plain:left",n)};Kr.prototype.pressureFn=function(i,t,e){var n=this,r=0;clearInterval(n.pressureIntervals[e]),n.pressureIntervals[e]=setInterval(function(){var s=i.force||i.pressure||i.webkitForce||0;s!==r&&(t.trigger("pressure",s),n.trigger("pressure "+t.identifier+":pressure",s),r=s)}.bind(n),100)};Kr.prototype.onstart=function(i){var t=this,e=t.options,n=i;i=zE(i),t.updateBox();var r=function(s){t.actives.length<e.maxNumberOfNipples?t.processOnStart(s):n.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(o){if(Object.values(n.touches).findIndex(function(l){return l.identifier===o})<0){var a=[i[0]];a.identifier=o,t.processOnEnd(a)}}),t.actives.length<e.maxNumberOfNipples&&t.processOnStart(s))};return ib(i,r),t.manager.bindDocument(),!1};Kr.prototype.processOnStart=function(i){var t=this,e=t.options,n,r=t.manager.getIdentifier(i),s=i.force||i.pressure||i.webkitForce||0,o={x:i.pageX,y:i.pageY},a=t.getOrCreate(r,o);a.identifier!==r&&t.manager.removeIdentifier(a.identifier),a.identifier=r;var l=function(u){u.trigger("start",u),t.trigger("start "+u.id+":start",u),u.show(),s>0&&t.pressureFn(i,u,u.identifier),t.processOnMove(i)};if((n=t.idles.indexOf(a))>=0&&t.idles.splice(n,1),t.actives.push(a),t.ids.push(a.identifier),e.mode!=="semi")l(a);else{var c=rb(o,a.position);if(c<=e.catchDistance)l(a);else{a.destroy(),t.processOnStart(i);return}}return a};Kr.prototype.getOrCreate=function(i,t){var e=this,n=e.options,r;return/(semi|static)/.test(n.mode)?(r=e.idles[0],r?(e.idles.splice(0,1),r):n.mode==="semi"?e.createNipple(t,i):(console.warn("Coudln't find the needed nipple."),!1)):(r=e.createNipple(t,i),r)};Kr.prototype.processOnMove=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.scroll;if(!E4(i)){this.processOnEnd(i);return}if(!r){console.error("Found zombie joystick with ID "+n),t.manager.removeIdentifier(n);return}if(e.dynamicPage){var o=r.el.getBoundingClientRect();r.position={x:s.x+o.left,y:s.y+o.top}}r.identifier=n;var a=r.options.size/2,l={x:i.pageX,y:i.pageY};e.lockX&&(l.y=r.position.y),e.lockY&&(l.x=r.position.x);var c=rb(l,r.position),u=S4(l,r.position),d=VE(u),h=c/a,p={distance:c,position:l},f,g;if(r.options.shape==="circle"?(f=Math.min(c,a),g=w4(r.position,f,u)):(g=C4(l,r.position,a),f=rb(g,r.position)),e.follow){if(c>a){let b=l.x-g.x,x=l.y-g.y;r.position.x+=b,r.position.y+=x,r.el.style.top=r.position.y-(t.box.top+s.y)+"px",r.el.style.left=r.position.x-(t.box.left+s.x)+"px",c=rb(l,r.position)}}else l=g,c=f;var m=l.x-r.position.x,y=l.y-r.position.y;r.frontPosition={x:m,y},e.dataOnly||GE(r.ui.front,r.frontPosition);var v={identifier:r.identifier,position:l,force:h,pressure:i.force||i.pressure||i.webkitForce||0,distance:c,angle:{radian:d,degree:u},vector:{x:m/a,y:-y/a},raw:p,instance:r,lockX:e.lockX,lockY:e.lockY};v=r.computeDirection(v),v.angle={radian:VE(180-u),degree:180-u},r.trigger("move",v),t.trigger("move "+r.id+":move",v)};Kr.prototype.processOnEnd=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.removeIdentifier(r.identifier);!r||(e.dataOnly||r.hide(function(){e.mode==="dynamic"&&(r.trigger("removed",r),t.trigger("removed "+r.id+":removed",r),t.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(t.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),t.trigger("end "+r.id+":end",r),t.ids.indexOf(r.identifier)>=0&&t.ids.splice(t.ids.indexOf(r.identifier),1),t.actives.indexOf(r)>=0&&t.actives.splice(t.actives.indexOf(r),1),/(semi|static)/.test(e.mode)?t.idles.push(r):t.nipples.indexOf(r)>=0&&t.nipples.splice(t.nipples.indexOf(r),1),t.manager.unbindDocument(),/(semi|static)/.test(e.mode)&&(t.manager.ids[s.id]=s.identifier))};Kr.prototype.onDestroyed=function(i,t){var e=this;e.nipples.indexOf(t)>=0&&e.nipples.splice(e.nipples.indexOf(t),1),e.actives.indexOf(t)>=0&&e.actives.splice(e.actives.indexOf(t),1),e.idles.indexOf(t)>=0&&e.idles.splice(e.idles.indexOf(t),1),e.ids.indexOf(t.identifier)>=0&&e.ids.splice(e.ids.indexOf(t.identifier),1),e.manager.removeIdentifier(t.identifier),e.manager.unbindDocument()};Kr.prototype.destroy=function(){var i=this;i.unbindEvt(i.options.zone,"start"),i.nipples.forEach(function(e){e.destroy()});for(var t in i.pressureIntervals)Object.prototype.hasOwnProperty.call(i.pressureIntervals,t)&&clearInterval(i.pressureIntervals[t]);i.trigger("destroyed",i.nipples),i.manager.unbindDocument(),i.off(),i.pressureIntervals={},i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.manager=null};var D4=Kr;function si(i){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=ZI(),t._windowBound=!1,t.config(i),t.prepareCollections();var e=function(){var n;t.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:t.scroll.x+n.left,y:t.scroll.y+n.top}})})};return t._onResize=function(){T4(e)},t._onScroll=function(){t.scroll=ZI()},t.collections}si.prototype=new dm;si.constructor=si;si.prototype.prepareCollections=function(){var i=this;i.collections.create=i.create.bind(i),i.collections.on=i.on.bind(i),i.collections.off=i.off.bind(i),i.collections.destroy=i.destroy.bind(i),i.collections.get=function(t){var e;return i.collections.every(function(n){return e=n.get(t),!e}),e}};si.prototype.create=function(i){return this.createCollection(i)};si.prototype.bindWindowEvents=function(){var i=this;i._windowBound||typeof window>"u"||(i._windowBound=!0,lm(window,"resize",i._onResize),lm(window,"scroll",i._onScroll))};si.prototype.unbindWindowEvents=function(){var i=this;!i._windowBound||typeof window>"u"||(i._windowBound=!1,cm(window,"resize",i._onResize),cm(window,"scroll",i._onScroll))};si.prototype.createCollection=function(i){var t=this,e=new D4(t,i);return t.bindCollection(e),t.collections.push(e),t.bindWindowEvents(),e};si.prototype.bindCollection=function(i){var t=this,e,n=function(r,s){e=r.type+" "+s.id+":"+r.type,t.trigger(e,s)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",n),i.on("dir:up dir:right dir:down dir:left",n),i.on("plain:up plain:right plain:down plain:left",n)};si.prototype.bindDocument=function(){var i=this;i.binded||(i.bindEvt(document,"move").bindEvt(document,"end"),i.binded=!0)};si.prototype.unbindDocument=function(i){var t=this;(!Object.keys(t.ids).length||i===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};si.prototype.getIdentifier=function(i){var t;return i?(t=i.identifier===void 0?i.pointerId:i.identifier,t===void 0&&(t=this.latest||0)):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]};si.prototype.removeIdentifier=function(i){var t={};for(var e in this.ids)if(this.ids[e]===i){t.id=e,t.identifier=this.ids[e],delete this.ids[e];break}return t};si.prototype.onmove=function(i){var t=this;return t.onAny("move",i),!1};si.prototype.onend=function(i){var t=this;return t.onAny("end",i),!1};si.prototype.oncancel=function(i){var t=this;return t.onAny("end",i),!1};si.prototype.onAny=function(i,t){var e=this,n,r="processOn"+i.charAt(0).toUpperCase()+i.slice(1);t=zE(t);var s=function(a,l,c){c.ids.indexOf(l)>=0&&(c[r](a),a._found_=!0)},o=function(a){n=e.getIdentifier(a),ib(e.collections,s.bind(null,a,n)),a._found_||e.removeIdentifier(n)};return ib(t,o),!1};si.prototype.destroy=function(){var i=this;i.unbindDocument(!0),i.unbindWindowEvents(),i.ids={},i.index=0,i.collections.forEach(function(t){t.destroy()}),i.collections=[],i.off()};si.prototype.onDestroyed=function(i,t){var e=this;if(e.collections.indexOf(t)<0)return!1;e.collections.splice(e.collections.indexOf(t),1),e.collections.length===0&&e.unbindWindowEvents()};var L4=si;var hm=null;function N4(){return hm||(hm=new L4),hm}var gne={create:function(i){return N4().create(i)},destroy:function(){hm&&(hm.destroy(),hm=null)},get factory(){return N4()}},B4=gne;gn();pt();X();Xs();Xi();pt();var F4=null;function U4(i){F4=i}function qE(){return F4}var k4,V4=new Promise(i=>{k4=i});var XE;function z4(i){if(XE)return XE;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.27/build"),s=import("./physics.js"),[o,a]=await Promise.all([s,fetch(`${n}/physics.wasm`).then(l=>l.arrayBuffer())]);await o.init(a),k4(o)}return XE=t(),XE}pr();Xi();Qt();lE();X();X();Kd();function QI(i){let t=i.elements,e=t[0]**2+t[1]**2+t[2]**2,n=t[4]**2+t[5]**2+t[6]**2,r=t[8]**2+t[9]**2+t[10]**2,s=t[0]**2+t[4]**2+t[8]**2,o=t[1]**2+t[5]**2+t[9]**2,a=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return e<l||n<l||r<l||s<l||o<l||a<l}function ma(i,t){let e=new De;if(t&&QI(t))return e.setAttribute("position",new Ve([],3)),e.setIndex([]),e;if(!i.getAttribute("position"))return e.setAttribute("position",new Ve([],3)),e.setIndex([]),e;let{positions:n,triIndices:r}=Pv(i.getAttribute("position"),i.getIndex());return e.setAttribute("position",new Ve(n,3)),e.setIndex(r),t&&e.applyMatrix4(t),e}ff();var YE=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.initialDisabled=!1;this.actions=ln(e,e.actions,r,s,o,n),this.target=e.target}disconnect(){Nn(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}};var ab=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.page=r;this.currentIntersectedObjects=[];this.actions=ln(e,e.actions,r,s,o,n),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let l=r.scene.find(a);l&&this.triggeringObjects.push(l)}}isValidTriggeringObject(t){return this.target==="all"?!0:this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){Nn(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?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()))}};pr();var cn;V4.then(i=>cn=i);var oi=new M,Oo=new qe,Ou=new M,vBe=new qt(0,0,0,"YXZ"),G4=new qt(0,0,0,"XYZ"),ga=new M,JI=new M,eR=new M(1,1,1),pm=new qe,$E=new ne,j4=new ne,yne={type:"updateMatrix"},H4=new qe,tR=new nr,vne=.5,bne=.7,nR=.01,ZE={type:"beginEvent",eventName:"Collision"},xne={type:"beginEvent",eventName:"Trigger"};function W4(i){if(vo.physicsEnabled(i.scene.objects))return!0;let t=!1;return i.scene.objects.traverse((e,n)=>{if(n.events){if(Array.isArray(n.events)){for(let r of n.events)if(r.data.disabled!==!0&&r.data.type==="GameControl"&&r.data.collisionEnabled){t=!0;break}}else for(let r of Object.values(n.events))if(r.disabled!==!0&&r.type==="GameControl"&&r.collisionEnabled){t=!0;break}}}),t}var lb=i=>i.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.hiddenMatrix!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function fm(i){return SU(Ga(i)?i.object:i)}var KE=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()!==cn.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,n,r]=this.rigidBodyToMesh.get(t.handle);if(oi.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),Oo.copy(t.rotation()),e.matrixWorld.compose(oi,Oo,n),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(yne),r){let s=e.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(e.matrixWorld);for(let o of s.children)o.updateMatrixWorld(!0)}for(let o of e.children)o.updateMatrixWorld(!0)}};this.accumulator=0;this.handleCollisionEvents=(t,e,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[t]?(r=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),r&&s&&r.isValidTriggeringObject(s)){r.dispatch();return}for(let o=this.sharedGameControlGlobals.createdObjects.length-1;o>=0;o--){let a=this.sharedGameControlGlobals.createdObjects[o];if(a.userData.hasCollisionDestroy&&(a.rigidBody?.collider(0).handle===t||a.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(o,1),a.removeFromParent();let l=a.rigidBody;requestAnimationFrame(()=>{a.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),a.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let o=this.sharedGameControlGlobals.colliderToEntity.get(e),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a===void 0)return;for(let l of a)l.data.target==="character"&&this.dispatchCollisionEvent(l,o,e)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let o=this.sharedGameControlGlobals.colliderToEntity.get(t),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a===void 0)return;for(let l of a)l.data.target==="character"&&this.dispatchCollisionEvent(l,o,t)}else{let o=this.sharedGameControlGlobals.colliderToEntity.get(t),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a!==void 0)for(let u of a)u.data.target==="scene"&&this.dispatchCollisionEvent(u,o,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(e),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let u of c)u.data.target==="scene"&&this.dispatchCollisionEvent(u,l,e)}};this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=UE,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events){if(n.data.disabled===!0)continue;let r=n.data.actions?.find(s=>s.data.type==="Destroy")?.data;if(r)for(let s of r.objects){let o=this.page.scene.find(s);o&&(o.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events)if(!(n.data.disabled===!0||n.data.type!=="DragDrop"))for(let r of n.data.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(qE()===null){Jn("collision-bvh","trigger/collision detection");return}let t=[],e=[];if(this.page.traverseChildren(n=>{let r,s=n instanceof tl,o=vu(n);if(rc(n)||s||o)return;Ga(n)?r=n.object:r=n;let a=r.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let l=n.geometry,c=r.userData.hasDestroy===!0,u=r.userData.hasDrag===!0;if(lb(a)||c||u||r.dataPatched.events.some(d=>d.data.disabled!==!0&&(d.data.type==="GameControl"||d.data.type==="Follow")))return n.updateMatrixWorldRigid(),this.addBoundsTree(n),!0;if(l){let d=l.getAttribute("position");if(d!==void 0&&d.count>0){t.push({geometry:l,matrixWorld:n.matrixWorld}),e.push(l.id,this._staticBVHIdOf(d),d.version,l.index!==null?this._staticBVHIdOf(l.index):-1,l.index!==null?l.index.version:-1);for(let h of n.matrixWorld.elements)e.push(h)}}if(fm(n))return!0}),t.length>0){let n=this._staticBVHCache;if(n!==void 0&&n.signature.length===e.length&&n.signature.every((a,l)=>a===e[l])){this.sharedGameControlGlobals.staticMeshBVH=n.bvh;return}let r=t.map(a=>ma(a.geometry,a.matrixWorld)),s=ia(r,!1),o=new(qE())(s);this._staticBVHCache={signature:e,bvh:o},this.sharedGameControlGlobals.staticMeshBVH=o}}addRigidBody(t,e,n){if(QI(t.matrixWorld))return;let r=[],s="geometry"in t?t.geometry:void 0,o=e.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(ma(s,t.shearScale)),o.physics.fusedBody){let a=this.gatherChildrenGeom(t,r);t.traverseObject(a),t.children.forEach(c=>c.updateMatrixWorld(!0));let l=t.cloner;l&&l.objectForSample===void 0&&o.physics.rigidBody==="dynamic"&&(l.traverseObject(a),l.children.forEach(c=>c.updateMatrixWorld(!0)))}if(r.length>0){let a,l=!1,c=!n.fromCreate&&o.physics.rigidBody==="dynamic"||n.fromCreate&&n.dynamic;c?(a=cn.RigidBodyDesc.dynamic(),a.setLinearDamping(o.physics.damping).setAngularDamping(o.physics.damping).setAdditionalMass(1e-9).setGravityScale(o.physics.gravityScale).enabledRotations(...o.physics.enabledRotation).enabledTranslations(...o.physics.enabledTranslation)):(n.hasTransformAnim||n.hasFollow||n.hasDrag)&&!n.fromCreate?(a=cn.RigidBodyDesc.kinematicPositionBased(),l=!0):a=cn.RigidBodyDesc.fixed();let u=ia(r);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(oi,Oo,Ou),t.position0=oi.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Oo.clone(),oi.divideScalar(this.pixelsPerMeter),a.setTranslation(oi.x,oi.y,oi.z).setRotation(Oo),s?u?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):u?.scale(Ou.x/this.pixelsPerMeter,Ou.y/this.pixelsPerMeter,Ou.z/this.pixelsPerMeter);let d=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),h=!(o.geometry===void 0||o.geometry.type==="SubdivGeometry"||o.geometry.type==="NonParametricGeometry"||o.geometry.type==="BooleanGeometry"||o.geometry.type==="VectorGeometry"||o.geometry.type==="StarGeometry"||o.geometry.type==="RectangleGeometry"||o.geometry.type==="EllipseGeometry"||o.geometry.type==="TriangleGeometry"||o.geometry.type==="TorusGeometry"||o.geometry.type==="HelixGeometry");try{this.addCollider(d,o.physics,u,e,h)}catch{try{this.addCollider(d,o.physics,u,e,!1)}catch(p){console.error(p)}}if(d.numColliders()===0){this.sharedGameControlGlobals.rapierWorld.removeRigidBody(d);return}c?this.rigidBodyToMesh.set(d.handle,[t,Ou.clone(),o.physics.fusedBody]):l?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(d.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,d,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=d}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(ma(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(n=>n.updateMatrixWorld(!0)),e.length>0){let n=ia(e,!1);t.bvhGeometry=n,n.getAttribute("position").count>0?(t.bvhGeometry.boundsTree=new(qE())(n),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):!1&&console.warn(`ControlsManager.addBoundsTree: object "${t.name}" has empty geometry`)}}addCollider(t,e,n,r,s=!0){if(n?.getAttribute("position").count===0||n?.getIndex()?.count===0)return;let o;n&&(e.colliderType==="trimesh"?o=cn.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array):o=cn.ColliderDesc.convexMesh(n.getAttribute("position").array,s?n.getIndex().array:void 0)),o.setFrictionCombineRule(cn.CoefficientCombineRule.Average).setRestitutionCombineRule(cn.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(l=>l.target==="scene")&&a.setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let n=fm(t);return(r,s)=>{if(s===0)return;if(n&&r.parent===t)return!0;let o;if(rc(r))if(r.objectForSample){if(r.objectForSample.dataPatched.physics.fusedBody)return;o=r.object}else return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Ga(r))o=r.object;else if(o=r,o.dataPatched.cloner?.hideBase)return!0;let a=o.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;s===1?t.hasNonUniformScale?r.matrixWorld.multiplyMatrices(t.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let l=r.geometry;if(l?.getAttribute("position")!==void 0&&e.push(ma(l,r.matrixWorld)),fm(r))return!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,n=!1;this.page.traverseEntity(a=>{for(let l of a.dataPatched.events)if(l.data.disabled===!1&&l.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=KI();if(r!==null?n=r.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||n:this.page.data.publish.gameControlObject!==null&&Jn("game-controls","the scene's game controls"),n===!1){let{enableRotate:a,enablePan:l,enableZoom:c,autoRotate:u,hoverRotatePanMode:d}=this.eventManager.publish.orbitControls;(a||l||c||u||d!==0)&&(this.orbitControls=new Zf(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 s=this.renderer.domElement.width/this.renderer.getPixelRatio(),o=this.renderer.domElement.height/this.renderer.getPixelRatio();KI()?.createJoysticks(this,s,o),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new cn.World(new cn.Vector3(0,this.gravity,0)),this.events=new cn.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let l;if(rc(a))if(a.objectForSample){if(a.objectForSample.dataPatched.physics.fusedBody)return;l=a.object}else return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Ga(a))l=a.object;else{if(vu(a)||sa(a)||a instanceof tl)return;if(l=a,l.dataPatched.cloner?.disabled===!1&&l.dataPatched.cloner?.hideBase&&l.dataPatched.physics?.fusedBody!==!0)return!0}let c=l.dataPatched,u;for(let y of c.events)y.data.disabled!==!0&&y.data.type==="GameControl"&&(u=y.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let d=lb(c),h=!1,p=l.userData.hasDestroy,f=l.userData.hasDrag,g=!1;for(let y of c.events)if(y.data.disabled!==!0){if(y.data.type==="Collision"){h=!0;let v=new YE(y.id,y.data,l,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].every(b=>b.id!==y.id)?this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]=[v]}else if(y.data.type==="Follow"){g=!0;let v=y.data.target;a.traverseVisible(b=>{b.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let m=a.geometry;if(u!==void 0){let y=cn.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(oi,Oo,Ou),a.position0=oi.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Oo.clone(),oi.divideScalar(this.pixelsPerMeter),y.setTranslation(oi.x,oi.y,oi.z).setRotation(Oo);let v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(y);a.rigidBody=v;let b;u.collider.type==="sphere"?b=cn.ColliderDesc.ball(u.collider.radius/this.pixelsPerMeter):u.collider.type==="capsule"?b=cn.ColliderDesc.capsule((u.collider.height/2-u.collider.radius)/this.pixelsPerMeter,u.collider.radius/this.pixelsPerMeter):b=cn.ColliderDesc.cuboid(u.collider.width/this.pixelsPerMeter/2,u.collider.height/this.pixelsPerMeter/2,u.collider.depth/this.pixelsPerMeter/2),b.setFrictionCombineRule(cn.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(cn.CoefficientCombineRule.Min);let x=this.sharedGameControlGlobals.rapierWorld.createCollider(b,v);this.sharedGameControlGlobals.colliderToEntity.set(x.handle,l),oi.fromArray(u.collider.position.map(E=>typeof E=="number"?E:0)).multiply(Ou.setFromMatrixScale(l.matrixWorld)).divideScalar(this.pixelsPerMeter),x.setTranslationWrtParent(oi);let S=new qe().setFromEuler(new qt().setFromVector3(new M().fromArray(u.collider.rotation.map(E=>typeof E=="number"?E:0))));x.setRotationWrtParent(S),x.setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(l,!0)}else c.physics.rigidBody==="dynamic"||d||g||p||f||h?(this.addRigidBody(a,l,{hasFollow:g,hasTransformAnim:d,hasDrag:f}),this.generateSensorColliderDescs(l,c.physics.fusedBody)):(m&&t.push(ma(m,a.matrixWorld)),c.physics.fusedBody&&!fm(a)&&a.traverseObject((y,v)=>{if(v===0)return;let b;if(rc(y))if(y.objectForSample){if(y.objectForSample.dataPatched.physics.fusedBody)return;b=y.object}else return y.object.dataPatched.physics.fusedBody===!0&&y.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else{if(vu(y)||sa(y)||y instanceof tl)return;if(Ga(y))b=y.object;else if(b=y,b.dataPatched.cloner?.hideBase)return!0}let x=b.dataPatched;if(x.physics.enabled==="visibility"?!x.visible:!x.physics.enabled)return!0;let S=y.geometry;if(S?.getAttribute("position")!==void 0&&t.push(ma(S,y.matrixWorld)),fm(y))return!0}),this.generateSensorColliderDescs(l,c.physics.fusedBody,e));if(c.physics?.fusedBody===!0||u||fm(a))return!0}),t.length===0)return;let n=ia(t),r=n.getIndex().count>0;if(!r&&e.length===0)return;n.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let s=cn.RigidBodyDesc.fixed(),o=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s);if(r){let a=cn.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array).setFrictionCombineRule(cn.CoefficientCombineRule.Multiply).setRestitutionCombineRule(cn.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,o)}for(let[a,l]of e){let c=this.sharedGameControlGlobals.rapierWorld.createCollider(a,o);this.sensorToTriggerEvent[c.handle]=l}}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(e.data.type==="Trigger"&&e.data.disabled!==!0){let n=new ab(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),r=new ne().compose(ga.fromArray(e.data.position.map(s=>typeof s=="number"?s:0)),pm.setFromEuler(G4.fromArray(e.data.rotation.map(s=>typeof s=="number"?s:0))),eR);if(e.data.triggerZone==="box"){let s=new Nt;s.min.fromArray(e.data.size.map(o=>typeof o=="number"?o:0)).multiplyScalar(-.5),s.max.fromArray(e.data.size.map(o=>typeof o=="number"?o:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([s,r,t,n])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,r,t,n])}}),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(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let n=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let r=t/1e3;r<n&&r>n*.55&&(r=n),this.accumulator+=r;let s=performance.now(),o=0,a=6;for(;this.accumulator>=n&&o<a&&(e=this.stepPhysics()&&e,this.accumulator-=n,o++,!(performance.now()-s>n*1e3)););this.accumulator=this.accumulator%n}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(oi,Oo,Ou);let e=t;e.prevQ===void 0?(e.prevQ=Oo.clone(),e.prevT=oi.clone()):(e.prevQ.copy(Oo),e.prevT.copy(oi))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,n,r]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(r)||(n.setBodyType(cn.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(n.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,n=t.linvel(),r=t.translation(),s=Math.hypot(n.x,n.z);for(let o=0;o<t.numColliders();o++){let a=t.collider(o);e.contactPairsWith(a,l=>{let c=l.parent();if(c===null||!c.isDynamic())return;let u=c.translation(),d=-1/0,h=0,p=0;if(e.contactPair(a,l,v=>{let b=v.normal(),S=b.x*(u.x-r.x)+b.y*(u.y-r.y)+b.z*(u.z-r.z)<0?-1:1;if(Math.abs(b.y)>bne)return;let E=S*b.x,T=S*b.z,w=Math.hypot(E,T);if(w<1e-4)return;let _=(n.x*E+n.z*T)/w;_>d&&(d=_,h=E/w,p=T/w)}),d===-1/0)return;let f=n.x*h+n.z*p;if(f<-nR)return;let g=c.linvel();if(s>nR&&f>nR){let v=g.x*h+g.z*p;if(v<=0)return;let b=Math.min(v,f);c.setLinvel({x:h*b,y:g.y,z:p*b},!0);return}let m=g.x*h+g.z*p-Math.max(0,f);if(m<=0)return;let y=m*(1-vne);c.setLinvel({x:g.x-h*y,y:g.y,z:g.z-p*y},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let e of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(e),e.rigidBody.setNextKinematicTranslation(oi.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(Oo);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,n){let r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(n))._parent,s;if(e.cloner){for(let o of e.cloner.children)if(o.rigidBody===r){s=o;break}}t.dispatch(s),e.dispatchEvent(ZE)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,n){let r=j4.copy(t.matrixWorld).invert();t.traverseEntity((s,o)=>{if(e===!1&&o===1)return!0;for(let a of s.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let l=new ab(a.id,a.data,s,this.page,this.sharedAssets,this.eventManager),c;if(a.data.triggerZone==="box"?c=cn.ColliderDesc.cuboid(...a.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):c=cn.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),c.setDensity(0).setSensor(!0).setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS),ga.fromArray(a.data.position.map(u=>typeof u=="number"?u:0)),pm.setFromEuler(G4.fromArray(a.data.rotation.map(u=>typeof u=="number"?u:0))),$E.compose(ga,pm,eR).premultiply(s.matrixWorld),n?($E.decompose(ga,pm,JI),c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_FIXED|cn.ActiveCollisionTypes.DYNAMIC_FIXED)):($E.premultiply(r).decompose(ga,pm,JI),t.rigidBody.bodyType()===cn.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===cn.RigidBodyType.Fixed?c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_FIXED|cn.ActiveCollisionTypes.DYNAMIC_FIXED):c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_KINEMATIC|cn.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),ga.divideScalar(this.pixelsPerMeter),c.setTranslation(ga.x,ga.y,ga.z),c.setRotation(pm),n)n.push([c,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(c,t.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[n,r,s,o]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let l=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(s===l||o.isValidTriggeringObject(Ot.is(l)?l:l.object)===!1)continue;let c=j4.copy(s.matrixWorld).decompose(ga,H4,JI).compose(ga,H4,eR).multiply(r),u=$E.copy(l.matrixWorld).invert().multiply(c),d=l.bvhGeometry.boundsTree;n instanceof Nt?t=d.intersectsBox(n,u):(tR.radius=n,tR.center.setFromMatrixPosition(u),t=d.intersectsSphere(tR)),t?o.currentIntersectedObjects.indexOf(l)===-1&&(o.currentIntersectedObjects.push(l),o.dispatch(),s.dispatchEvent(xne)):o.currentIntersectedObjects=o.currentIntersectedObjects.filter(h=>h!==l)}}}};Zd();X();mv();on();uc();var q4=4,rR=8;var iR=.02,sR=.3,Sne=65,X4=new M,Y4=new M,wne=new M,$i=new M,bc=new M,mm=new M,oR=new ne,$4=new ne,Ene=new ne,Ks=new qe,ch=new qe,gm=new qt(0,0,0,"YXZ"),Tne=new M(1,0,0),ol=new M(0,1,0),Mne=new M(0,0,1),K4=new M(1,1,1),aR=[],Z4=i=>aR[i]??(aR[i]=new M),lR=new M,_ne=new M,Ane=new M,Cne=new M,Q4=new qe,Pne=new M,J4=new qe,Ine=1,Rne=.025,One=16e-6,ej=12,Dne=20,Ii=new ri,Do=new Nt,Lne={type:"requestRender"},Nne={type:"updateMatrix"},QE=class extends _n{constructor(e,n,r,s,o,a,l,c,u){super();this.object=e;this.domElement=n;this.data=r;this.gloabalPhysics=s;this.controlsManager=o;this.cameraFollow=a;this.camera=l;this.page=c;this.sharedAssets=u;this.enableDamping=!0;this.hiddenMatrix0=new ne;this.target0=new M;this.zoom0=1;this.rotForce=1;this.moveForce=1;this.pixelsPerMeter=UE;this.euler0=new qt(0,0,0,"YXZ");this.position0Cam=new M;this.quat0Cam=new qe;this.scale0Cam=new M;this.hiddenMatrix0Cam=new ne;this.threshEndTranslate=.01;this.threshEndRotate=1e-8;this.threshEndRotVel=.005;this.collider={type:"capsule",radius:40,segment:new ri(new M(0,-40,0),new M(0,40,0)),matrix:new ne,position:new M,rotation:new qe};this.euler=new qt(0,0,0,"YXZ");this.eulerDelta=new M;this.lastPosition=new M;this.lastCameraQuaternion=new qe;this.lastCameraPosition=new M;this.PI_2=Math.PI/2;this.prevMouse=new j;this.velocityTarget=new M;this.velocity=new M;this.directionXZ=new M;this.rotVelocityStick=new M;this.rotVelocityTarget=new M;this.rotVelocity=new M;this.rotDirection=new M;this.nonColliderRotOffset=new ne;this.nonColliderPosOffset=new ne;this.firstPointerId=-1;this.rot=new M;this.path=[];this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0};this.onObject=!1;this.actionState={};this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]];this.collisionEnabled=!0;this.offsetMatrix=new ne;this.objectToTarget=new M;this.objectToTarget0=new M;this.objectToCamXZ=new M;this.objectToCamXZ0=new M;this.targetToCamera=new M;this.targetToCamera0=new M;this.cameraPolarAxis0=new M;this.targetPos=new M;this.targetQuat=new qe;this.lerpFactorPos=new M().setScalar(.3);this.lerpFactorPosStart=.3;this.lerpFactorPosEnd=.3;this.lerpFactorRotStart=.3;this.lerpFactorRotEnd=.3;this.lerpFactorPosCamera=.3;this.lerpFactorRotCamera=.3;this.objXZQuat=new qe;this.objXZQuatInv=new qe;this.objXZRotMat=new ne;this.isFirstPerson=!1;this.didHit=!1;this.groundVelocity=new M;this.pushedVelocity=new M;this.groundYRotation=0;this.objectRealQuat=new qe;this.colliderWorldQuat=new qe;this.groundNormal=new M;this.groundTilt=new qe;this.groundTiltInv=new qe;this.lastHitObj=null;this.isFirstFrame=!0;this.rotationAccumWhenOrientWithCamera=0;this.navMeshPathDest=null;this.position=new M;this.quaternion=new qe;this.scale=new M;this.initialAction=!0;this.onPointerDown=e=>{!(e.target===this.domElement||e.target instanceof HTMLElement&&e.target.tagName==="SPLINE-VIEWER"&&e.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!fi&&!sC&&this.domElement.requestPointerLock(),this.prevMouse.set(e.clientX,e.clientY))};this.onPointerUp=e=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),e.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()};this.onPointerMove=e=>{if(e.pointerId!==this.firstPointerId)return;let n=e.clientX-this.prevMouse.x,r=e.clientY-this.prevMouse.y;this.prevMouse.set(e.clientX,e.clientY),e.pointerType==="mouse"&&this.rotBy!=="keys"&&(sC&&JN<15.5&&!fi?(this.eulerDelta.y=-n*this.mouseOrbitSensitivity,this.eulerDelta.x=-r*this.mouseOrbitSensitivity):(this.eulerDelta.y=-e.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-e.movementY*this.mouseOrbitSensitivity)),e.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-n*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-r*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()};this.onPointerlockChange=e=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?QE.isLocked=!0:QE.isLocked=!1};this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")};this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0};this.onKeyDown=e=>{!(e.target instanceof HTMLInputElement)&&(e.code==="ArrowLeft"||e.code==="ArrowUp"||e.code==="ArrowRight"||e.code==="ArrowDown"||e.code==="Space")&&e.preventDefault();for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]){this.movementState[n[0]]=1;break}this.controlsManager.requestRender()};this.onKeyUp=e=>{for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]||e.code.slice(3,e.code.length).toUpperCase()===n[1]){this.movementState[n[0]]=0;break}};this.copyVRGamePadValues=(e,n)=>{for(let r=2;r<4;r++){let s=e.axes[r];n===0?r===2?this.movementState.movePosX=s:this.movementState.movePosZ=s:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,r===2?this.movementState.rotPosY=s:this.moveMode==="fly"&&(this.movementState.moveNegY=s))}};this.sharedGameControlGlobals=o.sharedGameControlGlobals,e===l&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let d=this.euler0.clone(),h=d.y;if(this.objectRealQuat.copy(this.quaternion),d.y=0,this.quaternion.setFromEuler(d),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),d.set(0,h,0),this.quaternion.setFromEuler(d),this.rot.setFromEuler(d),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let m=new M(0,0,-1).applyQuaternion(this.camera.quaternion),y=new M().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(y),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ);let v;Math.abs(m.y)<1e-6?(y.y=0,m.y=0,v=y.projectOnVector(m)):y.y/m.y>0?v=m.multiplyScalar(y.y/m.y):v=m.multiplyScalar(y.length()),this.targetToCamera0.copy(v).negate();let b=this.camera.position.clone().add(v);this.objectToTarget0.subVectors(b,this.position);let x=new qt().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-x.x,x.x=0,x.z=0,x.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(x)}if(this.object instanceof hn&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=r.rotByTouch??"joystick",this.rotBy=r.rotBy??"keys",this.rotationMode=r.rotationMode??"normal",this.moveMode=r.moveMode??"walk",this.collisionEnabled=r.collisionEnabled,this.speedTranslate=(r.speedTranslate??250)*Ine,this.speedOrbit=(r.speedRotate??100)*Rne,this.mouseOrbitSensitivity=(r.speedRotate??100)*One,this.keyAssignments=r.keyAssignments.map(m=>{let y=[m[0],m[1]];return y[1]==="\u25B2"?y[1]="ArrowUp":y[1]==="\u25C0"?y[1]="ArrowLeft":y[1]==="\u25BC"?y[1]="ArrowDown":y[1]==="\u25B6"?y[1]="ArrowRight":y[1]==="\u21E7"?y[1]="Shift":y[1]==="\u21B5"?y[1]="Enter":y[1]==="Space"?y[1]=" ":y[1]==="\u2318"?y[1]="Meta":y[1]==="Ctrl"?y[1]="Control":y[1]==="Esc"&&(y[1]="Escape"),y}),r.rotBy==="mouse"){let m;m=this.keyAssignments.findIndex(y=>y[0]==="rotNegX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(y=>y[0]==="rotPosX"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(y=>y[0]==="rotPosY"),m!==-1&&(this.keyAssignments[m][1]=""),m=this.keyAssignments.findIndex(y=>y[0]==="rotNegY"),m!==-1&&(this.keyAssignments[m][1]="")}this.lerpFactorPosStart=1-.02**(1/((r.delayPos[0]??.3)*60)),this.lerpFactorPosEnd=1-.02**(1/((r.delayPos[1]??.3)*60)),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/((r.delayRot[0]??.3)*60)),this.lerpFactorRotEnd=1-.02**(1/((r.delayRot[1]??.3)*60)),this.lerpFactorPosCamera=1-.02**(1/((r.delayPosCamera??.3)*60)),this.lerpFactorRotCamera=1-.02**(1/((r.delayRotCamera??.3)*60)),this.gravity=(this.gloabalPhysics.gravity??mu.defaultData.gravity)*ej,this.usePhysics=this.gloabalPhysics.usePhysics??mu.defaultData.usePhysics,this.jumpPower=r.jumpPower*Dne,this.resetYPosition=this.position.y+Math.abs(r.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=r.alignToGround??!1,this.orientMode=r.autoOrientMove?r.orientMode:"none",this.orientWith=r.orientWith??cf.defaultDataThirdPerson.orientWith,this.slopeThresh=Sne*Math.PI/180,r.collider.type==="capsule"?(this.collider.radius=r.collider.radius,this.collider.segment.start.y=r.collider.height/2-r.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=r.collider.height*iR/this.pixelsPerMeter,this.stepThresh=r.collider.height*sR/this.pixelsPerMeter,this.colliderHeight=r.collider.height):r.collider.type==="sphere"?(this.collider.radius=r.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*r.collider.radius*iR/this.pixelsPerMeter,this.stepThresh=2*r.collider.radius*sR/this.pixelsPerMeter,this.colliderHeight=r.collider.radius*2):(this.offset=r.collider.height*iR/this.pixelsPerMeter,this.stepThresh=r.collider.height*sR/this.pixelsPerMeter,this.colliderHeight=r.collider.height),this.collider.type=r.collider.type;let p=new M().fromArray(r.collider.position.map(m=>typeof m=="number"?m:0)),f=new qe().setFromEuler(new qt().fromArray([...r.collider.rotation.map(m=>typeof m=="number"?m:0),"XYZ"]));this.collider.position.copy(p).multiply(this.scale),this.collider.rotation.copy(f),this.collider.matrix.compose(p,f,K4),r.cameraXAxis!==void 0&&(this.cameraXAxis=r.cameraXAxis,this.cameraYAxis=r.cameraYAxis,this.minPolarAngle=r.cameraRotXLimits[0],this.maxPolarAngle=r.cameraRotXLimits[1],this.minAzimuthAngleRel=r.cameraRotYLimits[0],this.maxAzimuthAngleRel=r.cameraRotYLimits[1]),this.forwardDir=r.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=r.runMultiplier??2;let g=r.navmesh.destinationHelperRadius*2;if(g>0){let m=new ze;m.push({fi:0,data:{...Qn.defaultData("light","phong"),alpha:0},id:"layer1"}),m.push({fi:0,data:{...Qn.defaultData("color"),color:r.navmesh.destinationHelperColor,alpha:r.navmesh.destinationHelperColor.a},id:"layer2"});let y=Aw({layers:m},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Ht(aw.create({parameters:{width:g,height:g/10,hollow:.7}}),y),this.navMeshPathDest.material.userData.opacity0=r.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let n=new qt().setFromQuaternion(this.quaternion,"YXZ"),r=n.y;this.objectRealQuat.copy(this.quaternion),n.y=0,this.quaternion.setFromEuler(n),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),n.set(0,r,0),this.quaternion.setFromEuler(n),this.rot.setFromEuler(n),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof hn?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,n=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},lf.list.forEach(r=>{this.actions[r]=ln({...e,disabled:!1,type:"GameControl"},e.gameActions[r],this.page,n,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),Nn(this.actions.idle),Nn(this.actions.move),Nn(this.actions.run),Nn(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(n=>{n.play()}),this.actions[e].Animation.forEach(n=>{n.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(n=>{n.play()}),this.actions[e].Create.forEach(n=>{n.dispatchStart()}),this.actions[e].Audio.forEach(n=>{n.dispatchGameControl("start")}),this.actions[e].Particles.forEach(n=>{n.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(n=>{n.stop(),n.object.currentState!==null&&n.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(n=>{n.stop()}),this.actions[e].Create.forEach(n=>{n.dispatchStop()}),this.actions[e].Audio.forEach(n=>{n.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(n=>{n.dispatchGameControl("stop")})))}get colliderWorldPosition(){return $i.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let n=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let r=n*60,s=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let a=bc.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*ej),1)*(this.gravity>0?1:-1):this.velocity.y)*n,0).divideScalar(this.pixelsPerMeter),l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,rR,void 0,void 0,this.object.rigidBody);if(l){this.onObject=!0,this.groundNormal.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(s=!0),l.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let c=l.collider.parent(),u=c!==null&&c.isKinematic()?c:null,d=u===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(u.handle);if(u!==null&&d?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition($i).add(this.collider.position).divideScalar(this.pixelsPerMeter),p=u.velocityAtPoint(h);this.groundVelocity.set(p.x,p.y,p.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=u.angvel().y*n}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*r),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let a=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let l=$i.subVectors(this.path[1],this.position),c=bc.subVectors(this.path[1],this.path[0]);l.dot(c)<0?this.path.shift():(this.directionXZ.x=c.x,this.directionXZ.z=c.z),a.opacity=a.userData.opacity0}else a.opacity-=.05*a.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**r),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**r),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**r)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let o=wne.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let a=bc.copy(o);a.y=0,o.set(0,o.y,a.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let a=$i;this.camera.getWorldDirection(a);let l=mm.copy(ol).multiplyScalar(a.dot(ol));a.sub(l);let c=bc.copy(this.directionXZ);c.x*=-1,this.rot.y=a.angleTo(c)*(a.cross(c).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(gm.setFromVector3(this.rot),this.moveMode==="walk"&&(gm.x=0),o.applyEuler(gm),s&&(ch.setFromUnitVectors(ol,this.groundNormal),o.applyQuaternion(ch)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let a=0;for(let l of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(l.rigidBody===void 0||l.prevQ===void 0)continue;(l.hasNonUniformScale?l.matrixWorldRigid:l.matrixWorld).decompose(lR,Q4,_ne);let c=this.object.getWorldPosition(Ane).add(this.collider.position).sub(lR);J4.copy(l.prevQ).invert().premultiply(Q4);let u=mm.subVectors(lR,l.prevT).add(Cne.copy(c).applyQuaternion(J4).sub(c)).divideScalar(n).divideScalar(this.pixelsPerMeter),d=l.rigidBody.collider(0).castCollider(u,this.object.rigidBody.collider(0),$i.copy(o).divideScalar(this.pixelsPerMeter),0,n,!1);u.multiplyScalar(this.pixelsPerMeter);let h=Ot.is(l)?l:l.object;if(d!==null&&this.lastHitObj!==h){let p;l instanceof Yr&&(p=l);let f=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(f)for(let g of f)g.data.target==="character"&&(g.dispatch(p),h.dispatchEvent(ZE));this.lastHitObj=h}d!==null&&(Math.abs(u.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=u.x),Math.abs(u.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=u.y),Math.abs(u.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=u.z),Z4(a++).copy(d.normal1).applyQuaternion(l.quaternion))}if(a>0){for(let l=0;l<a;l++){let c=Z4(l),u=c.dot(o);u<0&&o.addScaledVector(c,-u)}o.add(this.pushedVelocity)}else o.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(n),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**r):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**r),this.euler.x+=this.rotVelocity.x*n,this.euler.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*n),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(ol,this.euler.y-this.euler0.y);let a=bc.copy(this.objectToCamXZ).normalize(),l=mm.copy(o).multiplyScalar(n);l.y=0;let c=l.sub($i.copy(a).multiplyScalar(l.dot(a))).cross(a).y;this.euler.y-=Math.atan2(c,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=xe.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=xe.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=xe.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(gm.copy(this.euler),gm.y=0,this.nonColliderRotOffset.makeRotationFromEuler(gm)),Ks.setFromAxisAngle(Tne,this.rot.x),ch.setFromAxisAngle(ol,this.rot.y),ch.multiply(Ks),Ks.setFromAxisAngle(Mne,this.rot.z),ch.multiply(Ks),this.quaternion.copy(ch),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let a=bc.copy(o).multiplyScalar(n/this.pixelsPerMeter),l=null;this.didHit=!1;let c=new M;for(let h=0;h<5;h++){let p=a.length(),f=mm.copy(a).normalize();if(l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),this.colliderWorldQuat,f,this.object.rigidBody.collider(0).shape,0,p,!1,rR|q4,void 0,void 0,this.object.rigidBody),l!==null){this.didHit=!0;let g=this.sharedGameControlGlobals.colliderToEntity.get(l.collider.handle);if(g!==this.lastHitObj&&h===0){this.lastHitObj=g;let b=this.sharedGameControlGlobals.entityToCollisionEvents[g?.uuid];if(b){for(let x of b)if(x.data.target==="character"){let S=(this.sharedGameControlGlobals.rapierWorld?.getCollider(l.collider.handle))._parent,E;if(g.cloner){for(let T of g.cloner.children)if(T.rigidBody===S){E=T;break}}x.dispatch(E),g.dispatchEvent(ZE)}}}let m=X4.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat),y=Y4.copy(f).multiplyScalar(l.time_of_impact).dot(m),v=l.time_of_impact;if(v===0&&(this.position.y+=this.offset*this.pixelsPerMeter),y>this.offset&&(v=l.time_of_impact*(y-this.offset)/y,c.addScaledVector(f,v)),a.copy(f).multiplyScalar(p-v),Math.acos(-m.y)>this.slopeThresh){let b=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),x=mm.copy(l.witness2).applyQuaternion(this.colliderWorldQuat);x.y=0;let S=b.add(x);S.y+=this.stepThresh;let E=this.sharedGameControlGlobals.rapierWorld.castShape(S,this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,rR|q4,void 0,void 0,this.object.rigidBody);E!==null&&E.time_of_impact===0&&(m.y=0,m.normalize())}a.addScaledVector(m,-a.dot(m))}else{h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),c.add(a);break}}this.position.addScaledVector(c,this.pixelsPerMeter),$i.copy(this.position).divideScalar(this.pixelsPerMeter),Ks.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let u=this.object.rigidBody,d=u!==void 0&&Pne.copy($i).sub(u.translation()).lengthSq()>1;u!==void 0&&(d?(u.setTranslation($i,!0),u.setRotation(Ks,!0)):(u.setNextKinematicTranslation($i),u.setNextKinematicRotation(Ks)))}else{let a=this.onObject?1:5,l=o.multiplyScalar(n/a);for(let c=0;c<a;c++)this.position.add(l),this.collisionAdjustment(n/a)}else this.position.addScaledVector(o,n);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let a=this.objectToTarget.add(this.position),l=this.targetToCamera.add(a);oR.lookAt(l,a,ol).setPosition(l),oR.decompose(this.targetPos,this.targetQuat,$i),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**r),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**r),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=xe.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=xe.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(Nne),this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)?!1:(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(Lne),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Ks.setFromAxisAngle(ol,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?xe.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e);let n;this.cameraXAxis==="Limit"?n=xe.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):n=xe.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let r=$i.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&r.applyQuaternion(e);let s=ch.setFromAxisAngle(r,n);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(s)}groundTiltAdjustment(e){ol.angleTo(e)*180/Math.PI<15||ol.angleTo(e)*180/Math.PI>85?Ks.identity():Ks.setFromUnitVectors(ol,e),this.groundTilt.slerp(Ks,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let n=Y4.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let r=oR.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose($i,Ks,bc).compose($i,Ks,K4);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(o=>{if(o===this.object||o.isDescendantOf(this.object)||!o.bvhGeometry||!o.bvhGeometry.boundsTree)return;Do.makeEmpty(),o.updateMatrixWorldRigid();let a=o.matrixWorldRigid,l=$4.copy(a).invert(),c=Ene.copy($4).multiply(r);Ii.copy(this.collider.segment),Ii.start.applyMatrix4(c),Ii.end.applyMatrix4(c);let u=X4.copy(this.position).applyMatrix4(l);Do.expandByPoint(Ii.start),Do.expandByPoint(Ii.end),Do.min.addScalar(-this.collider.radius),Do.max.addScalar(this.collider.radius),o.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder(d){return d.distanceToPoint(Ii.end)},intersectsBounds:d=>d.intersectsBox(Do),intersectsTriangle:d=>{let h=$i,p=bc,f=d.closestPointToSegment(Ii,h,p);if(f<this.collider.radius){let g=this.collider.radius-f,m=p.sub(h).normalize(),y=mm.copy(u);y.addScaledVector(m,g);let v=y.applyMatrix4(a).sub(this.position);n.add(v),Ii.start.addScaledVector(m,g),Ii.end.addScaledVector(m,g)}}})}),Do.makeEmpty(),Ii.copy(this.collider.segment),Ii.start.applyMatrix4(r),Ii.end.applyMatrix4(r),Do.expandByPoint(Ii.start),Do.expandByPoint(Ii.end),Do.min.addScalar(-this.collider.radius),Do.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder(o){return o.distanceToPoint(Ii.end)},intersectsBounds:o=>o.intersectsBox(Do),intersectsTriangle:o=>{let a=$i,l=bc,c=o.closestPointToSegment(Ii,a,l);if(c<this.collider.radius){let u=this.collider.radius-c,d=l.sub(a).normalize();this.alignToGround&&this.groundTiltAdjustment(d),n.addScaledVector(d,u),Ii.start.addScaledVector(d,u),Ii.end.addScaledVector(d,u)}}}),this.onObject=Math.abs(n.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let s=Math.max(0,n.length()-1e-5);n.normalize().multiplyScalar(s),this.position.add(n)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},cb=QE;cb.isLocked=!1;X();ff();Zd();Kd();var tj,nj=new Promise(i=>{tj=i});var cR,JE;function rj(i){if(JE)return JE;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.27/build");typeof window<"u"&&(cR=new URL(n.endsWith("/")?n:`${n}/`,window.location.href).href);let s=import("./navmesh.js"),[o,a]=await Promise.all([s,fetch(`${n}/navmesh.wasm`).then(u=>u.arrayBuffer())]),l=o.default,c=await l({wasmBinary:a});tj(c)}return JE=t(),JE}gn();var Bne=!1?typeof window<"u"?window.location.href:"":"https://cdn.spline.design/@splinetool/runtime@2.0.27/build/",Fne=i=>`
9806
9806
  (async function() {
9807
9807
  const [wasmImport, wasmBinary] = await Promise.all([
9808
9808
  import('${i}' + 'navmesh.js'),
@@ -9887,4 +9887,4 @@ onmessage = function(messageEvent) {
9887
9887
  [${kM}] { pointer-events: none; }
9888
9888
  [${kM}] > * { pointer-events: auto; }
9889
9889
  [${kM}] [data-spline-passthrough] { pointer-events: none; }
9890
- `,Ym=class{constructor(t,e,n,r,s){this.container=t;this.host=e;this.observer=n;this.previousSplineGlobal=r;this.removeLateLifecycleShim=s}static mount(t,e,n,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let o=document.createElement("div");o.setAttribute(kM,"");let a=o.style;a.position="absolute",a.overflow="hidden";let l=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};l();let c=new ResizeObserver(l);c.observe(e),c.observe(s);let u=document.createElement("style");u.textContent=koe,o.appendChild(u);let d=new DOMParser().parseFromString(n,"text/html"),h=Array.from(d.querySelectorAll("script"));for(let x of h)x.remove();for(let x of Array.from(d.head.children))(x.tagName==="STYLE"||x.tagName==="LINK"&&x.rel==="stylesheet")&&o.appendChild(x);for(;d.body.firstChild;)o.appendChild(d.body.firstChild);s.insertBefore(o,e.nextSibling);let p=(x,S)=>{x==="warn"?console.warn(`[spline html] ${S}`):x==="error"&&console.error(`[spline html] ${S}`)},f=new Map,g=new Up(YO(t,e,r),p,(x,S)=>{let E=f.get(x);if(!!E)for(let T of E)try{T(S)}catch(w){console.error(w)}}),m=(x,S)=>{try{return Promise.resolve(g.execute(x,S))}catch(E){return Promise.reject(E)}},y={ready:Promise.resolve(),setVariable:(x,S)=>m("setVariable",[x,S]),setVariables:x=>m("setVariables",[x]),getVariable:x=>m("getVariable",[x]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:x=>m("findObjectByName",[x]),findObjectById:x=>m("findObjectById",[x]),getGeometry:(x,S)=>m("getGeometry",[x,S??{}]),updateObject:(x,S)=>m("updateObject",[x,S]),createObject:(x,S)=>m("createObject",[x,S??{}]),createCustomMaterial:x=>m("createCustomMaterial",[x]),setMaterial:(x,S)=>m("setMaterial",[x,S]),cloneObject:(x,S)=>m("cloneObject",[x,S??{}]),removeObject:x=>m("removeObject",[x]),spawnObject:(x,S)=>m("spawnObject",[x,S??{}]),destroyObject:x=>m("destroyObject",[x]),setInstanceTransforms:(x,S)=>m("setInstanceTransforms",[x,S??null]),emitEvent:(x,S)=>m("emitEvent",[x,S]),emitEventReverse:(x,S)=>m("emitEventReverse",[x,S]),requestRender:()=>m("requestRender",[]),addEventListener:(x,S)=>{if(typeof S!="function")return;let E=f.get(x);E||(E=new Set,f.set(x,E),m("listenEvent",[x])),E.add(S)},removeEventListener:(x,S)=>{let E=f.get(x);!E||(E.delete(S),E.size===0&&(f.delete(x),m("unlistenEvent",[x])))}},v=window.spline;window.spline=y;let b=L3();for(let x of h){let S=document.createElement("script");for(let E of Array.from(x.attributes))S.setAttribute(E.name,E.value);x.src?S.async=!1:S.textContent=x.textContent,o.appendChild(S)}return new Ym(o,g,c,v,b)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};pt();on();X();B2();Ao();function HW(i,t){let e=i.length/3,n=new Map,r=new Array(e);for(let l=0;l<e;l++){let c=`${Math.round(i[3*l]*1e4)},${Math.round(i[3*l+1]*1e4)},${Math.round(i[3*l+2]*1e4)}`,u=n.get(c);u===void 0?(n.set(c,l),r[l]=l):r[l]=u}let s=new Map;for(let l=0;l+2<t.length;l+=3){let c=r[t[l]],u=r[t[l+1]],d=r[t[l+2]];for(let[h,p]of[[c,u],[u,d],[d,c]]){if(h===p)continue;let f=h<p?h+"_"+p:p+"_"+h;s.set(f,(s.get(f)??0)+1)}}let o=s.size>0;for(let l of s.values())if(l!==2){o=!1;break}if(!o)return{closed:!1,inverted:!1};let a=0;for(let l=0;l+2<t.length;l+=3){let c=t[l]*3,u=t[l+1]*3,d=t[l+2]*3,h=i[c],p=i[c+1],f=i[c+2],g=i[u],m=i[u+1],y=i[u+2],v=i[d],b=i[d+1],x=i[d+2];a+=h*(m*x-y*b)+p*(y*v-g*x)+f*(g*b-m*v)}return{closed:!0,inverted:a<0}}on();pt();cU();uc();function $W(i){return typeof i=="object"&&i!==null&&i.isMaterial===!0}function KO(i){if(typeof i.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!$W(i.material))return{options:i};let t=i.material;if(t.isNodeMaterial===!0){let e=Cw()?.NodeMaterial;if(e!==void 0&&t instanceof e)return{options:{...i,material:void 0},material:t};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(t.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...i,material:void 0},material:t}}var Voe=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),WW="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",zoe={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Goe={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},joe={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},Hoe={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},Woe={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function KW(i){if(typeof i!="string"||i.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${WW}.`);let t=i.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),e=Goe[t];if(e)return{objectType:e};let n=zoe[t];if(n)return{objectType:"Mesh",geometryType:n};let r=joe[t];throw r?new Error(`createObject: '${i}' is not supported \u2014 ${r}`):new Error(`createObject: '${i}' is not a creatable Spline type \u2014 use one of ${WW}, e.g. createObject('Cube', { width: 200 }).`)}function Yb(i,t){return i===void 0?[t[0],t[1],t[2]]:Array.isArray(i)?[i[0]??t[0],i[1]??t[1],i[2]??t[2]]:[i.x??t[0],i.y??t[1],i.z??t[2]]}function ZW(i){return typeof i=="number"?[i,i,i]:Yb(i,[1,1,1])}function qoe(i){let t=i.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)||/^(rgb|hsl)a?\(/.test(t)||Ze.NAMES[t]!==void 0}function $O(i){let t=new yn(0,0,0,1);return t.setStyle(i),{r:t.r,g:t.g,b:t.b}}function Xoe(i){let t=Object.entries(i.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>e!=="'undefined'");return t.length?t.join(", "):"(none)"}function qW(i,t){let e=i.material??(i.color!==void 0?{color:i.color}:void 0);if(e===void 0)return An.defaultColorMaterial(XW(wr),"physical","layer1","layer2");if(typeof e=="string"){for(let[o,a]of Object.entries(t.shared.materials))if(o===e||a.name===e)return o;if(qoe(e))return An.defaultColorMaterial($O(e),"physical","layer1","layer2");throw new Error(`createObject: material '${e}' matches no shared material in this document (available: ${Xoe(t)}) and is not a valid CSS color.`)}if(typeof e=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if($W(e))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=e.color!==void 0?$O(e.color):XW(wr),r=An.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(o=>o.data.type==="light");if(s){let o={};e.roughness!==void 0&&(o.roughness=e.roughness),e.metalness!==void 0&&(o.metalness=e.metalness),e.reflectivity!==void 0&&(o.reflectivity=e.reflectivity),Object.assign(s.data,o)}if(e.alpha!==void 0){let o=r.layers.find(a=>a.data.type==="color");o&&Object.assign(o.data,{alpha:e.alpha})}return r}function XW(i){return{r:(i>>16&255)/255,g:(i>>8&255)/255,b:(i&255)/255}}function Yoe(i){let t={};for(let[e,n]of Object.entries(i))!Voe.has(e)&&n!==void 0&&(t[e]=n);return t}function $oe(i){let t=fo.defaultData("TextGeometry"),{text:e,...n}=i,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=r*350/16),r!==void 0&&n.height===void 0&&(n.height=r*50/16),Object.assign(t,n),e!==void 0&&Object.assign(t,{text:{textValue:String(e)}}),t}var YW=6e4;function VM(i){return Array.isArray(i)?i:ArrayBuffer.isView(i)&&!(i instanceof DataView)?Array.from(i):null}function Koe(i){let t=VM(i.vertices);if(!t||t.length<9||t.length%3!==0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let e=t.length/3;if(e>YW)throw new Error(`createObject('CustomMesh'): too many vertices (${e}); keep it under ${YW}.`);let n=VM(i.indices);if(n&&n.length){let d=n.find(h=>!Number.isInteger(h)||h<0||h>=e);if(d!==void 0)throw new Error(`createObject('CustomMesh'): index ${d} is out of range (mesh has ${e} vertices).`)}else n=null;let r=new De;r.setAttribute("position",new Ve(t,3));let s=VM(i.normals),o=s!==null&&s.length===t.length;o&&r.setAttribute("normal",new Ve(s,3));let a=VM(i.uvs);a&&a.length===e*2&&r.setAttribute("uv",new Ve(a,2));let l=!1;if(!o){let d=n??Array.from({length:e},(f,g)=>g),{closed:h,inverted:p}=HW(t,d);if(h&&p){for(let f=0;f+2<d.length;f+=3){let g=d[f+1];d[f+1]=d[f+2],d[f+2]=g}n=d}else h||(l=!0)}n&&r.setIndex(n),o||r.computeVertexNormals();let c=r.toJSON();return{geometry:bP({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:c.data}),doubleSide:l}}function Zoe(i,t){let n=N2[i].normalizeInputs({parameters:t});return bP({userData:{type:i,...n}})}function QW(i,t,e){let{objectType:n,geometryType:r}=i,s=Yoe(t),o={states:new ze,events:new ze};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=Koe(s);Object.assign(o,mo.defaultData,{geometry:l,materials:[qW(t,e)]}),c&&(o.side=2)}else Object.assign(o,mo.defaultData,{geometry:r==="TextGeometry"?$oe(s):Zoe(r,s),material:qW(t,e)});t.castShadow!==void 0&&(o.castShadow=t.castShadow),t.receiveShadow!==void 0&&(o.receiveShadow=t.receiveShadow)}else n==="Empty"?Object.assign(o,tf.defaultData):(Object.assign(o,nf.defaultData(n),s),t.color!==void 0&&(o.color=$O(t.color)));o.visible=t.visible??!0,o.position=Yb(t.position,[0,0,0]),o.rotation=Yb(t.rotation,[0,0,0]),o.scale=ZW(t.scale);let a=(r&&Hoe[r])??Woe[n]??n;return o.name=t.name??JW(a,e.scene.objects),o}function JW(i,t){let e=new Set;if(t.traverse((r,s)=>{e.add(s.name??"")}),!e.has(i))return i;let n=2;for(;e.has(`${i} ${n}`);)n++;return`${i} ${n}`}function e6(i,t){let e=xe.generateUUID();if(i.data.type==="Component")return{data:{...go.fromComponentData(i),name:i.data.name+" Instance"},id:e,fi:i.fi,children:[]};t[i.id]=e;let n=i.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,o])=>{let a=xe.generateUUID(),l=o.indexOf(r),c=l!==-1?o.slice(0,l)+a+o.slice(l+r.length):o;return[a,s,c]})}),{...i,id:e,data:n,children:i.children.map(r=>e6(r,t))}}function t6(i){let t={},e=e6(i,t);return W3(e,t)}function n6(i,t,e){let n={...i.data};return t.position!==void 0&&(n.position=Yb(t.position,[0,0,0])),t.rotation!==void 0&&(n.rotation=Yb(t.rotation,[0,0,0])),t.scale!==void 0&&(n.scale=ZW(t.scale)),t.visible!==void 0&&(n.visible=t.visible),n.name=t.name??JW(`${i.data.name??"Object"} Copy`,e),{...i,data:n}}uc();pr();sw();Ao();function r6(i){let t=Array.isArray(i)?i[0]:i,e=t.layers?.map(Qoe)??[],n=t.layers?.find(r=>r.type==="light");return{layers:e,alpha:n?.node.alphaOverride?.value??1}}function Qoe(i){return i.type==="texture"||i.type==="video"||i.type==="matcap"?{...i.data,updateTexture(t){return i.color.texture.image.updateSrc(t)}}:{...i.data}}function i6(i,t,e){let n=Array.isArray(e)?e[0]:e;if(i[0]==="layers"){let r=parseInt(i[1]),s=n.layers[r],o=i[2];s&&o&&Joe(i.slice(2),t,s)}else i[0]==="alpha"&&n.layers.forEach(r=>{r.type==="light"&&r.node.alphaOverride!==void 0&&(r.node.alphaOverride.value=t,t<1&&(n.transparent=!0))})}var $b=new yn(0,0,0,1);function Joe(i,t,e){let n=i[0];try{if(nae(n,e.type,i.slice(1)))if(n==="colors"){if(i.length<2)throw new Error("You cannot mutate the colors array, only its items");let r=parseInt(i[1]),o=e.getValue(n)?.[r];if(o)$b.setStyle(t),o.set($b.r,$b.g,$b.b,$b.a);else throw new Error("Color index out of range")}else e.getValue(n)?.setStyle(t);else if(n==="texture"||n==="video"){let r=e.color;eae(i.slice(1),t,r,e)}else{let r=i[1],s=e.getValue(n);s?.isVector3&&r!==void 0||s?.isVector2&&r!==void 0?s.setComponent(parseInt(r),t):e.setValue(n,t)}}catch(r){console.error("Error setting material value",r)}}function eae(i,t,e,n){let r=i[0];if(r==="repeat"||r==="offset"||r==="rotation"){let s=n.getNode("mat"),o=s&&typeof s.updateMatrix=="function"?s:n.getValue("mat");if(!o)return;if(r==="rotation")o.rotation=parseFloat(t);else{let a=i[1];if(a===void 0)t instanceof Array&&t.length===2&&Object.assign(o,{[r]:t});else{let l=o[r],c=parseInt(a)===0?[parseFloat(t),l[1]]:[l[0],parseFloat(t)];Object.assign(o,{[r]:c})}}o.updateMatrix()}else r==="wrapping"||r==="minFilter"||r==="magFilter"?r==="wrapping"?e.texture.wrap=t:e.texture[r]=t:r==="image"&&i[1]==="data"&&e.texture.image.updateSrc(t)}var tae={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};function nae(i,t,e){return!!tae[t]?.includes(i)}pt();pt();var hle=new j;function ple(i){let t="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";i.endsWith(".spline")?console.warn(t+" The .spline files are only meant to be used by the Editor."):i.endsWith(".splinecode")||console.warn(t)}async function fle(i){}function jq(i){let t=new yn(0,0,0,1);try{t.setStyle(i)}catch(e){console.error(e)}return t}var HD=class{constructor(t,{renderOnDemand:e,renderMode:n="auto",wasmPath:r,renderer:s,htmlContentMode:o="sandbox"}={}){this._rendererBackend="webgl";this._rendererAuto=!1;this._rendererConfigured=!1;this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._htmlContentMode="sandbox";this._variablesCache=new Map;this._isPaused=!1;this._renderRequested=!1;this._skipRender=!1;this.time=performance.now();this.dt=0;this.currentTAAFrame=0;this.disposed=!1;this._requestRenderAutoMode=()=>{this._skipRender=!1};this.requestRender=()=>{this._renderRequested=!0};this.render=t=>{if(this.time=t,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),!this._renderer){this._perfs?.end();return}if(!this._isPaused&&(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){this._perfs?.end();return}if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<fU?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{e.type==="ParticleSystem"&&(e.update(this.dt),this._skipRender=!1),sa(e)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&e.warnClassicFallbackOnce(),e.isSimulating&&(e.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()};this._resize=t=>{if(!!this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=hle.set(this._viewportWidth,this._viewportHeight)),t){let e=this._viewportWidth,n=this._viewportHeight;this._renderer.setSize(e-1,n-1,!1),this._renderer.setSize(e,n,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}};this._debouncedResize=ru(this._resize,10);this._onScroll=t=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())};if(this.canvas=t,this._htmlContentMode=o,this.renderMode=e?"auto":n,r!==void 0&&(this._wasmPath=b3(r,"/")),this._rendererBackend=s??"webgl",s===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(o6(),s6)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),u3(t)}async _createRenderer(){if(this._rendererBackend==="webgpu"&&!1)try{}catch{}if(this._rendererBackend==="webgpu"&&!1)try{try{}catch{}}catch(t){}{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(jD(),GD));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}throw this._failWebGPURequired(),new Error("[spline] This runtime build is WebGPU-only and the browser provides no WebGPU adapter.")}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,n=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=n*t;let r=this.canvas.getContext("2d");r&&(r.scale(t,t),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",e/2,n/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,n){ple(t),this.disposed=!1;let s=await(await fetch(t,n)).arrayBuffer();await this.start(s,{variables:e})}async start(t,{interactive:e=!0,variables:n}={}){if(this.disposed)return;kr.init();let r=await Z5(t);this._data=r;let s=Q5(r);r.version&&(0,Hq.default)(r.version,"2.0.25")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),tW(this._wasmPath));let o=fle(r);await Promise.all([o,s.length&&LO(this._wasmPath),K2(r)&&HU(this._wasmPath),nG(r)&&gV(this._wasmPath),vo.physicsEnabled(r.scene.objects)&&z4(this._wasmPath),XP(r)&&$I(),CO(r)&&W5(),gk(r)&&pk(),NI(r)&&o.then(()=>rv()?.loadHanaUIRUNTIME()),x4(r)&&rj(this._wasmPath)].filter(Boolean)),s.length&&await NO(s),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=r.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu"){this._failWebGPURequired();return}let l=nW(r);if(this._rendererBackend==="webgpu"&&!1)try{}catch(p){}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(jD(),GD)),VW(l)]),TV((this._rendererBackend,"webgl"));let c=new RM(r);if(c.resetPersonalCameraFromDocumentData(),this._scene=c.scene,this._sharedAssetsManager=c.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:p}=await Promise.resolve().then(()=>(Gq(),zq)),f=performance.now();p(r,c.scene);let g=performance.now();console.log("Merged geometries in ",g-f," ms")}K2(r)&&this._scene.traverse(p=>{us(p)&&p.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(p=>{rc(p)&&p.pendingMediaLoad&&p.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(p=>{p.type==="ParticleSystem"&&(p.wakeUp(),p.data.autoPlay?p.start():p.stop()),sa(p)&&p.setPlayMode(!0)});let u=Object.keys(r.shared.fonts).map(p=>this._sharedAssetsManager.getFont(p).loadingPromise);if(Promise.all(u).then(()=>{this.disposed||(c.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),XP(r)&&W4(r)&&await Promise.all(u),NI(r)){let p=[];this._scene.traverseEntity(f=>{(yr(f)||f instanceof Cn)&&f.uiCanvas&&p.push(f.uiCanvas)}),await Promise.all(p.map(f=>f.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),Fm(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0;let p=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),f=this._getPixelRatio(p()?r.scene.publish.settings.web.pixelRatioMobile:r.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(f),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark){let g=this._sharedAssetsManager.getImage("SplineWatermark");await g.loadPromise;let m=g.getTexture(1001);this._renderer.pipeline.setWatermark(m)}}CO(r)&&this._scene.initializeSplatViewer(),r.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(r.scene.blueNoiseTextureData);let d=Object.values(r.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(d.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=d.size[0],this._viewportHeight=d.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new Kw(this._renderer,this._camera,new j(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(d.allowResponsive??!1)&&d.preset==="fullscreen"),e){let p=new Bw(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,d);this._scene.updateMatrixWorld(!0),this._controls=new KE(p),this._animationControls=new OM(this._scene,this._requestRenderAutoMode),this._eventManager=new qw(r.scene.publish,this._controls,this._animationControls,p,r.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),n!==void 0&&this.setVariables(n),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let h=r.scene.publish.htmlContent?.html;if(e&&h&&this._htmlContentMode!=="none"){let p={shared:this._sharedAssetsManager,findEntity:f=>this._scene?.getObjectByProperty("uuid",f)??this._scene?.getObjectByName(f)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?Ym.mount(this,this.canvas,h,p):Xm.mount(this,this.canvas,h,p))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[n,r]of e)this.setVariable(n,r)}}setVariable(t,e){let n=this._getVariableByName(t);if(n&&!("dynamicVariableType"in n.data)){let r=e;typeof n.data.value=="number"?r=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof n.data.value=="boolean"?r=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()==="false"?!1:!!e:typeof n.data.value!="string"&&n.data.value.textValue!==void 0&&(r=e.toString());let s=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(n.id,s),this.requestRender(),this._requestRenderAutoMode()}else n===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in n.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let n=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(n)}}_getVariableValue(t){return typeof t!="string"&&Er.isTextValue(t)?Er.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(n=>n.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(e.uuid!==po&&!this._scene.isInvisibleObjects(e)&&!(e instanceof Cn)){let n=this._createProxyObject(e);n&&t.push(n)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof Zf&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=jq(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,nk(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{gS.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,d3(this.canvas),document.removeEventListener("scroll",this._onScroll),kr.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);let n;t.traverseAncestors(d=>{d instanceof Cn&&(n=d.name)});let r=this._sharedAssetsManager,s={shared:r,scene:this._scene},o=d=>{if(d===null||d==="Base State")return null;if(d&&t.data.states){let h=t.data.states.find(p=>p.data.name===d);return h?h.id:void 0}},a="material"in t?t.material:void 0,l=t.materialOverride,c={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:n,material:l??(a?r6(a):void 0),parentUuid:t.parent instanceof Cn||t instanceof Wu?void 0:t.parent?.uuid,emitEvent(d){t.dispatchEvent({type:"userEvent",eventName:d})},emitEventReverse(d){t.dispatchEvent({type:"userEvent",eventName:d,reverse:!0})},hide(){t.visible&&(t.visible=!1,s.shared.requestRender())},show(){t.visible||(t.visible=!0,s.shared.requestRender())},get state(){let d=t.stateSelection;if(d!==null)return t.data.states.find(({id:h})=>h===d)?.data.name},set state(d){let h;if(d!==void 0){let p=typeof d=="string"?t.data.states.find(({id:f})=>f===d):t.data.states[d];if(p)h=p.id;else{let f=typeof d=="string"?o(d):void 0;f&&(h=f)}}t.changeSelectedState(h??null,s),t.currentState=h??null,t.dispatchEvent({type:"completeState",state:h??null}),s.shared.requestRender()},transition(d){let h=c5();if(h===null)return Jn("transitions","obj.transition()"),{transition(E){return this},play(){return this},pause(){return this},reset(){return this},seek(E){return this}};let p=this,f,g=[],m,y=!1,v=()=>{m=new Vm({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},g.map(S=>S.runner))},b={update(S){m?.update(S),m?.isPlaying!==!0&&kr.remove(b)}},x={transition({from:S,to:E,duration:T,delay:w,..._}){let A=o(S);A===void 0&&(A=f);let C=o(E);return f=C,g.push(new h(t,A,C,{state:C,repeat:0,delay:w??0,delayDirection:"start-once",direction:"normal",duration:T??1e3,..._,..._.easing===6?Qo.defaultData:_.easing===5?$l.defaultData:{}},r,!1,e.activePage,{onBegin:()=>{(S&&A||S==="Base State"&&!A)&&(p.state=A??void 0)},onComplete:()=>{p.state=C??void 0}})),v(),this},play(){return m?(y=!0,m.play(kr.time),m.isPlaying&&kr.add(b),this):this},pause(){return m?.stop(),kr.remove(b),this},reset(){return this.pause(),y=!1,v(),m?.seek(0),this},seek(S){let E=g.reduce((T,w)=>T+w.runner.duration,0);return E>0&&m?.seek(S/1e3/E),this}};return x.transition(d),(d.autoPlay??!0)&&queueMicrotask(()=>{y||x.play()}),x},set color(d){let h=jq(d);if(Wf.is(t)){t.color=h;return}else if(t.type!=="Mesh"||!("material"in t)||!(t instanceof Tr))return;let p={r:h.r,g:h.g,b:h.b,a:h.a},f=t.materialOverride;if(f!==void 0){let y=f.color;y?.isColor===!0&&typeof y.setStyle=="function"&&(y.setStyle(d),s.shared.requestRender());return}let g=Array.isArray(t.material)?t.material[0]:t.material,m=g.data.layers.find(y=>y.data.type==="color")?.id;if(m)g.updateByOp({type:0,path:["layers",m],props:{color:{...p}}},g.data,s);else{let y=g.data,v=y.layers.find(_=>_.data.type==="light");if(!v)return;let b=y.layers.indexOf(v)===0?v:null,x=y.layers.at(b?y.layers.indexOf(b)+1:0),S=b?b.fi+(x?(x.fi-b.fi)/2:1):x?x.fi/2:1,E={type:4,fi:S,id:xe.generateUUID(),data:{...Qn.defaultData("color"),color:p},localIndex:0},T=y.layers.insertAfterHelper(b?.id??null,1),w=y.layers.runOp({...E,fi:T[0]}).data;Object.assign(g.data,{layers:w}),g.updateByOp({...E,path:["layers"]},g.data,s)}}},u=gS(c,(d,h)=>{let p=t[d],f=mle(d);f[0]==="material"&&a&&l===void 0&&i6(f.slice(1),h,a),typeof p!="object"&&Object.getOwnPropertyDescriptor(t,d)?.writable&&(t[d]=h),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,u),u}setUIWasmUrl(t){PU(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let n;if(typeof e=="string")if(e.endsWith(".splinegeometry")){let u=await(await fetch(e)).arrayBuffer();n=new Uint8Array(u)}else throw new Error("Only .splinegeometry format is supported");else n=e;let r=Dd.deserialize(n),s="data"in r&&r.data.draco!==void 0;s&&await LO(this._wasmPath);let o=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!o){console.warn(`Object ${t} not found`);return}if(o.data.type!=="Mesh"||!(o instanceof Tr)){console.warn(`Object ${t} is not a mesh`);return}let a=o,l={...a.data,geometry:r};s&&await NO([l]),a.updateByOp({type:0,path:[],props:{geometry:l.geometry}},l,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let c of a.data.states){let u={...c.data};a.states||(a.states={}),a.states[c.id]=na.patch(l,u)}return n}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let n=e.path;Array.isArray(n)&&n.length===2&&n[0]==="scene"&&n[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,n=this._findEntity(e);if(!n)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return n.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=Cw();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let n=t(e);if(typeof n!="object"||n===null||n.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return n}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let n=this._scene;if(!n)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t.uuid,s=this._findEntity(r);if(!s)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(s instanceof Tr))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let o=typeof e=="function"?await this.createCustomMaterial(e):e;if(zf()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=KO({material:o});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(a.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let s=KW(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let{options:o,material:a}=KO(e);if(a!==void 0){if(s.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(zf()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}let l,c;if(s.geometryType==="TextGeometry"){if(!TU("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await $I(),c=e.font??Zp,r.shared.fonts[c]===void 0){if(c!==Zp){let y=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${c}' is not in this document \u2014 available fonts: ${y||"(none)"}.`)}l={name:Zp,url:vF}}}let u=this._resolveParentId(e.parent),d=QW(s,o,r),h=xe.generateUUID(),[p,f]=Rd(r);l&&(p.shared.fonts[Zp]=l),p.scene.objects.insertAfter(u,null,[{id:h,data:d,children:[]}]);let g=f.result();if(l&&this._sharedAssetsManager.addFont(Zp,l),c!==void 0){let y=this._sharedAssetsManager.getFont(c);y&&await y.loadingPromise}this._applyDocumentTransaction(g);let m=n.find(h);return a!==void 0&&m.setMaterialOverride(a,{scene:n,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(m)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let s=typeof t=="string"?t:t?.uuid,o=s?this._findEntity(s):void 0;if(!o)throw new Error(`cloneObject: '${s}' \u2014 no object with that name or uuid in the scene.`);if(o instanceof Cn)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(o.uuid);if(!a)throw new Error(`cloneObject: '${s}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let l=n6(t6(a),e,r.scene.objects),c=e.parent!==void 0?this._resolveParentId(e.parent):r.scene.objects.parent(o.uuid)??null,u=e.parent!==void 0?null:o.uuid,[d,h]=Rd(r);d.scene.objects.insertAfter(c,u,[l]),this._applyDocumentTransaction(h.result());let p=n.find(l.id);return this._requestRenderAutoMode(),this._createProxyObject(p)}removeObject(t){let e=this._scene,n=this._data;if(this.disposed||!e||!n)return!1;let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)return!1;if(s instanceof Cn)throw new Error("removeObject: pages cannot be removed.");if(s.data.type==="PerspectiveCamera"||s.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(n.scene.objects.get(s.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let o=[];s.traverseEntity(c=>{o.push(c.uuid)});let[a,l]=Rd(n);a.scene.objects.delete(s.uuid),this._applyDocumentTransaction(l.result());for(let c of o){let u=this._proxyObjectCache.get(c);u&&(gS.unsubscribe(u),this._proxyObjectCache.delete(c))}return this._requestRenderAutoMode(),!0}};function mle(i){return i.split(".")}
9890
+ `,Ym=class{constructor(t,e,n,r,s){this.container=t;this.host=e;this.observer=n;this.previousSplineGlobal=r;this.removeLateLifecycleShim=s}static mount(t,e,n,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let o=document.createElement("div");o.setAttribute(kM,"");let a=o.style;a.position="absolute",a.overflow="hidden";let l=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};l();let c=new ResizeObserver(l);c.observe(e),c.observe(s);let u=document.createElement("style");u.textContent=koe,o.appendChild(u);let d=new DOMParser().parseFromString(n,"text/html"),h=Array.from(d.querySelectorAll("script"));for(let x of h)x.remove();for(let x of Array.from(d.head.children))(x.tagName==="STYLE"||x.tagName==="LINK"&&x.rel==="stylesheet")&&o.appendChild(x);for(;d.body.firstChild;)o.appendChild(d.body.firstChild);s.insertBefore(o,e.nextSibling);let p=(x,S)=>{x==="warn"?console.warn(`[spline html] ${S}`):x==="error"&&console.error(`[spline html] ${S}`)},f=new Map,g=new Up(YO(t,e,r),p,(x,S)=>{let E=f.get(x);if(!!E)for(let T of E)try{T(S)}catch(w){console.error(w)}}),m=(x,S)=>{try{return Promise.resolve(g.execute(x,S))}catch(E){return Promise.reject(E)}},y={ready:Promise.resolve(),setVariable:(x,S)=>m("setVariable",[x,S]),setVariables:x=>m("setVariables",[x]),getVariable:x=>m("getVariable",[x]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:x=>m("findObjectByName",[x]),findObjectById:x=>m("findObjectById",[x]),getGeometry:(x,S)=>m("getGeometry",[x,S??{}]),updateObject:(x,S)=>m("updateObject",[x,S]),createObject:(x,S)=>m("createObject",[x,S??{}]),createCustomMaterial:x=>m("createCustomMaterial",[x]),setMaterial:(x,S)=>m("setMaterial",[x,S]),cloneObject:(x,S)=>m("cloneObject",[x,S??{}]),removeObject:x=>m("removeObject",[x]),spawnObject:(x,S)=>m("spawnObject",[x,S??{}]),destroyObject:x=>m("destroyObject",[x]),setInstanceTransforms:(x,S)=>m("setInstanceTransforms",[x,S??null]),emitEvent:(x,S)=>m("emitEvent",[x,S]),emitEventReverse:(x,S)=>m("emitEventReverse",[x,S]),requestRender:()=>m("requestRender",[]),addEventListener:(x,S)=>{if(typeof S!="function")return;let E=f.get(x);E||(E=new Set,f.set(x,E),m("listenEvent",[x])),E.add(S)},removeEventListener:(x,S)=>{let E=f.get(x);!E||(E.delete(S),E.size===0&&(f.delete(x),m("unlistenEvent",[x])))}},v=window.spline;window.spline=y;let b=L3();for(let x of h){let S=document.createElement("script");for(let E of Array.from(x.attributes))S.setAttribute(E.name,E.value);x.src?S.async=!1:S.textContent=x.textContent,o.appendChild(S)}return new Ym(o,g,c,v,b)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};pt();on();X();B2();Ao();function HW(i,t){let e=i.length/3,n=new Map,r=new Array(e);for(let l=0;l<e;l++){let c=`${Math.round(i[3*l]*1e4)},${Math.round(i[3*l+1]*1e4)},${Math.round(i[3*l+2]*1e4)}`,u=n.get(c);u===void 0?(n.set(c,l),r[l]=l):r[l]=u}let s=new Map;for(let l=0;l+2<t.length;l+=3){let c=r[t[l]],u=r[t[l+1]],d=r[t[l+2]];for(let[h,p]of[[c,u],[u,d],[d,c]]){if(h===p)continue;let f=h<p?h+"_"+p:p+"_"+h;s.set(f,(s.get(f)??0)+1)}}let o=s.size>0;for(let l of s.values())if(l!==2){o=!1;break}if(!o)return{closed:!1,inverted:!1};let a=0;for(let l=0;l+2<t.length;l+=3){let c=t[l]*3,u=t[l+1]*3,d=t[l+2]*3,h=i[c],p=i[c+1],f=i[c+2],g=i[u],m=i[u+1],y=i[u+2],v=i[d],b=i[d+1],x=i[d+2];a+=h*(m*x-y*b)+p*(y*v-g*x)+f*(g*b-m*v)}return{closed:!0,inverted:a<0}}on();pt();cU();uc();function $W(i){return typeof i=="object"&&i!==null&&i.isMaterial===!0}function KO(i){if(typeof i.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!$W(i.material))return{options:i};let t=i.material;if(t.isNodeMaterial===!0){let e=Cw()?.NodeMaterial;if(e!==void 0&&t instanceof e)return{options:{...i,material:void 0},material:t};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(t.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...i,material:void 0},material:t}}var Voe=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),WW="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",zoe={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Goe={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},joe={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},Hoe={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},Woe={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function KW(i){if(typeof i!="string"||i.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${WW}.`);let t=i.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),e=Goe[t];if(e)return{objectType:e};let n=zoe[t];if(n)return{objectType:"Mesh",geometryType:n};let r=joe[t];throw r?new Error(`createObject: '${i}' is not supported \u2014 ${r}`):new Error(`createObject: '${i}' is not a creatable Spline type \u2014 use one of ${WW}, e.g. createObject('Cube', { width: 200 }).`)}function Yb(i,t){return i===void 0?[t[0],t[1],t[2]]:Array.isArray(i)?[i[0]??t[0],i[1]??t[1],i[2]??t[2]]:[i.x??t[0],i.y??t[1],i.z??t[2]]}function ZW(i){return typeof i=="number"?[i,i,i]:Yb(i,[1,1,1])}function qoe(i){let t=i.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)||/^(rgb|hsl)a?\(/.test(t)||Ze.NAMES[t]!==void 0}function $O(i){let t=new yn(0,0,0,1);return t.setStyle(i),{r:t.r,g:t.g,b:t.b}}function Xoe(i){let t=Object.entries(i.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>e!=="'undefined'");return t.length?t.join(", "):"(none)"}function qW(i,t){let e=i.material??(i.color!==void 0?{color:i.color}:void 0);if(e===void 0)return An.defaultColorMaterial(XW(wr),"physical","layer1","layer2");if(typeof e=="string"){for(let[o,a]of Object.entries(t.shared.materials))if(o===e||a.name===e)return o;if(qoe(e))return An.defaultColorMaterial($O(e),"physical","layer1","layer2");throw new Error(`createObject: material '${e}' matches no shared material in this document (available: ${Xoe(t)}) and is not a valid CSS color.`)}if(typeof e=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if($W(e))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=e.color!==void 0?$O(e.color):XW(wr),r=An.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(o=>o.data.type==="light");if(s){let o={};e.roughness!==void 0&&(o.roughness=e.roughness),e.metalness!==void 0&&(o.metalness=e.metalness),e.reflectivity!==void 0&&(o.reflectivity=e.reflectivity),Object.assign(s.data,o)}if(e.alpha!==void 0){let o=r.layers.find(a=>a.data.type==="color");o&&Object.assign(o.data,{alpha:e.alpha})}return r}function XW(i){return{r:(i>>16&255)/255,g:(i>>8&255)/255,b:(i&255)/255}}function Yoe(i){let t={};for(let[e,n]of Object.entries(i))!Voe.has(e)&&n!==void 0&&(t[e]=n);return t}function $oe(i){let t=fo.defaultData("TextGeometry"),{text:e,...n}=i,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=r*350/16),r!==void 0&&n.height===void 0&&(n.height=r*50/16),Object.assign(t,n),e!==void 0&&Object.assign(t,{text:{textValue:String(e)}}),t}var YW=6e4;function VM(i){return Array.isArray(i)?i:ArrayBuffer.isView(i)&&!(i instanceof DataView)?Array.from(i):null}function Koe(i){let t=VM(i.vertices);if(!t||t.length<9||t.length%3!==0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let e=t.length/3;if(e>YW)throw new Error(`createObject('CustomMesh'): too many vertices (${e}); keep it under ${YW}.`);let n=VM(i.indices);if(n&&n.length){let d=n.find(h=>!Number.isInteger(h)||h<0||h>=e);if(d!==void 0)throw new Error(`createObject('CustomMesh'): index ${d} is out of range (mesh has ${e} vertices).`)}else n=null;let r=new De;r.setAttribute("position",new Ve(t,3));let s=VM(i.normals),o=s!==null&&s.length===t.length;o&&r.setAttribute("normal",new Ve(s,3));let a=VM(i.uvs);a&&a.length===e*2&&r.setAttribute("uv",new Ve(a,2));let l=!1;if(!o){let d=n??Array.from({length:e},(f,g)=>g),{closed:h,inverted:p}=HW(t,d);if(h&&p){for(let f=0;f+2<d.length;f+=3){let g=d[f+1];d[f+1]=d[f+2],d[f+2]=g}n=d}else h||(l=!0)}n&&r.setIndex(n),o||r.computeVertexNormals();let c=r.toJSON();return{geometry:bP({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:c.data}),doubleSide:l}}function Zoe(i,t){let n=N2[i].normalizeInputs({parameters:t});return bP({userData:{type:i,...n}})}function QW(i,t,e){let{objectType:n,geometryType:r}=i,s=Yoe(t),o={states:new ze,events:new ze};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=Koe(s);Object.assign(o,mo.defaultData,{geometry:l,materials:[qW(t,e)]}),c&&(o.side=2)}else Object.assign(o,mo.defaultData,{geometry:r==="TextGeometry"?$oe(s):Zoe(r,s),material:qW(t,e)});t.castShadow!==void 0&&(o.castShadow=t.castShadow),t.receiveShadow!==void 0&&(o.receiveShadow=t.receiveShadow)}else n==="Empty"?Object.assign(o,tf.defaultData):(Object.assign(o,nf.defaultData(n),s),t.color!==void 0&&(o.color=$O(t.color)));o.visible=t.visible??!0,o.position=Yb(t.position,[0,0,0]),o.rotation=Yb(t.rotation,[0,0,0]),o.scale=ZW(t.scale);let a=(r&&Hoe[r])??Woe[n]??n;return o.name=t.name??JW(a,e.scene.objects),o}function JW(i,t){let e=new Set;if(t.traverse((r,s)=>{e.add(s.name??"")}),!e.has(i))return i;let n=2;for(;e.has(`${i} ${n}`);)n++;return`${i} ${n}`}function e6(i,t){let e=xe.generateUUID();if(i.data.type==="Component")return{data:{...go.fromComponentData(i),name:i.data.name+" Instance"},id:e,fi:i.fi,children:[]};t[i.id]=e;let n=i.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,o])=>{let a=xe.generateUUID(),l=o.indexOf(r),c=l!==-1?o.slice(0,l)+a+o.slice(l+r.length):o;return[a,s,c]})}),{...i,id:e,data:n,children:i.children.map(r=>e6(r,t))}}function t6(i){let t={},e=e6(i,t);return W3(e,t)}function n6(i,t,e){let n={...i.data};return t.position!==void 0&&(n.position=Yb(t.position,[0,0,0])),t.rotation!==void 0&&(n.rotation=Yb(t.rotation,[0,0,0])),t.scale!==void 0&&(n.scale=ZW(t.scale)),t.visible!==void 0&&(n.visible=t.visible),n.name=t.name??JW(`${i.data.name??"Object"} Copy`,e),{...i,data:n}}uc();pr();sw();Ao();function r6(i){let t=Array.isArray(i)?i[0]:i,e=t.layers?.map(Qoe)??[],n=t.layers?.find(r=>r.type==="light");return{layers:e,alpha:n?.node.alphaOverride?.value??1}}function Qoe(i){return i.type==="texture"||i.type==="video"||i.type==="matcap"?{...i.data,updateTexture(t){return i.color.texture.image.updateSrc(t)}}:{...i.data}}function i6(i,t,e){let n=Array.isArray(e)?e[0]:e;if(i[0]==="layers"){let r=parseInt(i[1]),s=n.layers[r],o=i[2];s&&o&&Joe(i.slice(2),t,s)}else i[0]==="alpha"&&n.layers.forEach(r=>{r.type==="light"&&r.node.alphaOverride!==void 0&&(r.node.alphaOverride.value=t,t<1&&(n.transparent=!0))})}var $b=new yn(0,0,0,1);function Joe(i,t,e){let n=i[0];try{if(nae(n,e.type,i.slice(1)))if(n==="colors"){if(i.length<2)throw new Error("You cannot mutate the colors array, only its items");let r=parseInt(i[1]),o=e.getValue(n)?.[r];if(o)$b.setStyle(t),o.set($b.r,$b.g,$b.b,$b.a);else throw new Error("Color index out of range")}else e.getValue(n)?.setStyle(t);else if(n==="texture"||n==="video"){let r=e.color;eae(i.slice(1),t,r,e)}else{let r=i[1],s=e.getValue(n);s?.isVector3&&r!==void 0||s?.isVector2&&r!==void 0?s.setComponent(parseInt(r),t):e.setValue(n,t)}}catch(r){console.error("Error setting material value",r)}}function eae(i,t,e,n){let r=i[0];if(r==="repeat"||r==="offset"||r==="rotation"){let s=n.getNode("mat"),o=s&&typeof s.updateMatrix=="function"?s:n.getValue("mat");if(!o)return;if(r==="rotation")o.rotation=parseFloat(t);else{let a=i[1];if(a===void 0)t instanceof Array&&t.length===2&&Object.assign(o,{[r]:t});else{let l=o[r],c=parseInt(a)===0?[parseFloat(t),l[1]]:[l[0],parseFloat(t)];Object.assign(o,{[r]:c})}}o.updateMatrix()}else r==="wrapping"||r==="minFilter"||r==="magFilter"?r==="wrapping"?e.texture.wrap=t:e.texture[r]=t:r==="image"&&i[1]==="data"&&e.texture.image.updateSrc(t)}var tae={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};function nae(i,t,e){return!!tae[t]?.includes(i)}pt();pt();var hle=new j;function ple(i){let t="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";i.endsWith(".spline")?console.warn(t+" The .spline files are only meant to be used by the Editor."):i.endsWith(".splinecode")||console.warn(t)}async function fle(i){}function jq(i){let t=new yn(0,0,0,1);try{t.setStyle(i)}catch(e){console.error(e)}return t}var HD=class{constructor(t,{renderOnDemand:e,renderMode:n="auto",wasmPath:r,renderer:s,htmlContentMode:o="sandbox"}={}){this._rendererBackend="webgl";this._rendererAuto=!1;this._rendererConfigured=!1;this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._htmlContentMode="sandbox";this._variablesCache=new Map;this._isPaused=!1;this._renderRequested=!1;this._skipRender=!1;this.time=performance.now();this.dt=0;this.currentTAAFrame=0;this.disposed=!1;this._requestRenderAutoMode=()=>{this._skipRender=!1};this.requestRender=()=>{this._renderRequested=!0};this.render=t=>{if(this.time=t,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),!this._renderer){this._perfs?.end();return}if(!this._isPaused&&(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){this._perfs?.end();return}if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<fU?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{e.type==="ParticleSystem"&&(e.update(this.dt),this._skipRender=!1),sa(e)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&e.warnClassicFallbackOnce(),e.isSimulating&&(e.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()};this._resize=t=>{if(!!this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=hle.set(this._viewportWidth,this._viewportHeight)),t){let e=this._viewportWidth,n=this._viewportHeight;this._renderer.setSize(e-1,n-1,!1),this._renderer.setSize(e,n,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}};this._debouncedResize=ru(this._resize,10);this._onScroll=t=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())};if(this.canvas=t,this._htmlContentMode=o,this.renderMode=e?"auto":n,r!==void 0&&(this._wasmPath=b3(r,"/")),this._rendererBackend=s??"webgl",s===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(o6(),s6)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),u3(t)}async _createRenderer(){if(this._rendererBackend==="webgpu"&&!1)try{}catch{}if(this._rendererBackend==="webgpu"&&!1)try{try{}catch{}}catch(t){}{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(jD(),GD));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}throw this._failWebGPURequired(),new Error("[spline] This runtime build is WebGPU-only and the browser provides no WebGPU adapter.")}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,n=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=n*t;let r=this.canvas.getContext("2d");r&&(r.scale(t,t),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",e/2,n/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,n){ple(t),this.disposed=!1;let s=await(await fetch(t,n)).arrayBuffer();await this.start(s,{variables:e})}async start(t,{interactive:e=!0,variables:n}={}){if(this.disposed)return;kr.init();let r=await Z5(t);this._data=r;let s=Q5(r);r.version&&(0,Hq.default)(r.version,"2.0.27")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),tW(this._wasmPath));let o=fle(r);await Promise.all([o,s.length&&LO(this._wasmPath),K2(r)&&HU(this._wasmPath),nG(r)&&gV(this._wasmPath),vo.physicsEnabled(r.scene.objects)&&z4(this._wasmPath),XP(r)&&$I(),CO(r)&&W5(),gk(r)&&pk(),NI(r)&&o.then(()=>rv()?.loadHanaUIRUNTIME()),x4(r)&&rj(this._wasmPath)].filter(Boolean)),s.length&&await NO(s),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=r.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu"){this._failWebGPURequired();return}let l=nW(r);if(this._rendererBackend==="webgpu"&&!1)try{}catch(p){}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(jD(),GD)),VW(l)]),TV((this._rendererBackend,"webgl"));let c=new RM(r);if(c.resetPersonalCameraFromDocumentData(),this._scene=c.scene,this._sharedAssetsManager=c.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:p}=await Promise.resolve().then(()=>(Gq(),zq)),f=performance.now();p(r,c.scene);let g=performance.now();console.log("Merged geometries in ",g-f," ms")}K2(r)&&this._scene.traverse(p=>{us(p)&&p.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(p=>{rc(p)&&p.pendingMediaLoad&&p.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(p=>{p.type==="ParticleSystem"&&(p.wakeUp(),p.data.autoPlay?p.start():p.stop()),sa(p)&&p.setPlayMode(!0)});let u=Object.keys(r.shared.fonts).map(p=>this._sharedAssetsManager.getFont(p).loadingPromise);if(Promise.all(u).then(()=>{this.disposed||(c.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),XP(r)&&W4(r)&&await Promise.all(u),NI(r)){let p=[];this._scene.traverseEntity(f=>{(yr(f)||f instanceof Cn)&&f.uiCanvas&&p.push(f.uiCanvas)}),await Promise.all(p.map(f=>f.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),Fm(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0;let p=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),f=this._getPixelRatio(p()?r.scene.publish.settings.web.pixelRatioMobile:r.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(f),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark){let g=this._sharedAssetsManager.getImage("SplineWatermark");await g.loadPromise;let m=g.getTexture(1001);this._renderer.pipeline.setWatermark(m)}}CO(r)&&this._scene.initializeSplatViewer(),r.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(r.scene.blueNoiseTextureData);let d=Object.values(r.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(d.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=d.size[0],this._viewportHeight=d.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new Kw(this._renderer,this._camera,new j(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(d.allowResponsive??!1)&&d.preset==="fullscreen"),e){let p=new Bw(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,d);this._scene.updateMatrixWorld(!0),this._controls=new KE(p),this._animationControls=new OM(this._scene,this._requestRenderAutoMode),this._eventManager=new qw(r.scene.publish,this._controls,this._animationControls,p,r.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),n!==void 0&&this.setVariables(n),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let h=r.scene.publish.htmlContent?.html;if(e&&h&&this._htmlContentMode!=="none"){let p={shared:this._sharedAssetsManager,findEntity:f=>this._scene?.getObjectByProperty("uuid",f)??this._scene?.getObjectByName(f)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?Ym.mount(this,this.canvas,h,p):Xm.mount(this,this.canvas,h,p))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[n,r]of e)this.setVariable(n,r)}}setVariable(t,e){let n=this._getVariableByName(t);if(n&&!("dynamicVariableType"in n.data)){let r=e;typeof n.data.value=="number"?r=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof n.data.value=="boolean"?r=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()==="false"?!1:!!e:typeof n.data.value!="string"&&n.data.value.textValue!==void 0&&(r=e.toString());let s=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(n.id,s),this.requestRender(),this._requestRenderAutoMode()}else n===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in n.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let n=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(n)}}_getVariableValue(t){return typeof t!="string"&&Er.isTextValue(t)?Er.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(n=>n.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(e.uuid!==po&&!this._scene.isInvisibleObjects(e)&&!(e instanceof Cn)){let n=this._createProxyObject(e);n&&t.push(n)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof Zf&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=jq(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,nk(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{gS.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,d3(this.canvas),document.removeEventListener("scroll",this._onScroll),kr.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);let n;t.traverseAncestors(d=>{d instanceof Cn&&(n=d.name)});let r=this._sharedAssetsManager,s={shared:r,scene:this._scene},o=d=>{if(d===null||d==="Base State")return null;if(d&&t.data.states){let h=t.data.states.find(p=>p.data.name===d);return h?h.id:void 0}},a="material"in t?t.material:void 0,l=t.materialOverride,c={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:n,material:l??(a?r6(a):void 0),parentUuid:t.parent instanceof Cn||t instanceof Wu?void 0:t.parent?.uuid,emitEvent(d){t.dispatchEvent({type:"userEvent",eventName:d})},emitEventReverse(d){t.dispatchEvent({type:"userEvent",eventName:d,reverse:!0})},hide(){t.visible&&(t.visible=!1,s.shared.requestRender())},show(){t.visible||(t.visible=!0,s.shared.requestRender())},get state(){let d=t.stateSelection;if(d!==null)return t.data.states.find(({id:h})=>h===d)?.data.name},set state(d){let h;if(d!==void 0){let p=typeof d=="string"?t.data.states.find(({id:f})=>f===d):t.data.states[d];if(p)h=p.id;else{let f=typeof d=="string"?o(d):void 0;f&&(h=f)}}t.changeSelectedState(h??null,s),t.currentState=h??null,t.dispatchEvent({type:"completeState",state:h??null}),s.shared.requestRender()},transition(d){let h=c5();if(h===null)return Jn("transitions","obj.transition()"),{transition(E){return this},play(){return this},pause(){return this},reset(){return this},seek(E){return this}};let p=this,f,g=[],m,y=!1,v=()=>{m=new Vm({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},g.map(S=>S.runner))},b={update(S){m?.update(S),m?.isPlaying!==!0&&kr.remove(b)}},x={transition({from:S,to:E,duration:T,delay:w,..._}){let A=o(S);A===void 0&&(A=f);let C=o(E);return f=C,g.push(new h(t,A,C,{state:C,repeat:0,delay:w??0,delayDirection:"start-once",direction:"normal",duration:T??1e3,..._,..._.easing===6?Qo.defaultData:_.easing===5?$l.defaultData:{}},r,!1,e.activePage,{onBegin:()=>{(S&&A||S==="Base State"&&!A)&&(p.state=A??void 0)},onComplete:()=>{p.state=C??void 0}})),v(),this},play(){return m?(y=!0,m.play(kr.time),m.isPlaying&&kr.add(b),this):this},pause(){return m?.stop(),kr.remove(b),this},reset(){return this.pause(),y=!1,v(),m?.seek(0),this},seek(S){let E=g.reduce((T,w)=>T+w.runner.duration,0);return E>0&&m?.seek(S/1e3/E),this}};return x.transition(d),(d.autoPlay??!0)&&queueMicrotask(()=>{y||x.play()}),x},set color(d){let h=jq(d);if(Wf.is(t)){t.color=h;return}else if(t.type!=="Mesh"||!("material"in t)||!(t instanceof Tr))return;let p={r:h.r,g:h.g,b:h.b,a:h.a},f=t.materialOverride;if(f!==void 0){let y=f.color;y?.isColor===!0&&typeof y.setStyle=="function"&&(y.setStyle(d),s.shared.requestRender());return}let g=Array.isArray(t.material)?t.material[0]:t.material,m=g.data.layers.find(y=>y.data.type==="color")?.id;if(m)g.updateByOp({type:0,path:["layers",m],props:{color:{...p}}},g.data,s);else{let y=g.data,v=y.layers.find(_=>_.data.type==="light");if(!v)return;let b=y.layers.indexOf(v)===0?v:null,x=y.layers.at(b?y.layers.indexOf(b)+1:0),S=b?b.fi+(x?(x.fi-b.fi)/2:1):x?x.fi/2:1,E={type:4,fi:S,id:xe.generateUUID(),data:{...Qn.defaultData("color"),color:p},localIndex:0},T=y.layers.insertAfterHelper(b?.id??null,1),w=y.layers.runOp({...E,fi:T[0]}).data;Object.assign(g.data,{layers:w}),g.updateByOp({...E,path:["layers"]},g.data,s)}}},u=gS(c,(d,h)=>{let p=t[d],f=mle(d);f[0]==="material"&&a&&l===void 0&&i6(f.slice(1),h,a),typeof p!="object"&&Object.getOwnPropertyDescriptor(t,d)?.writable&&(t[d]=h),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,u),u}setUIWasmUrl(t){PU(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let n;if(typeof e=="string")if(e.endsWith(".splinegeometry")){let u=await(await fetch(e)).arrayBuffer();n=new Uint8Array(u)}else throw new Error("Only .splinegeometry format is supported");else n=e;let r=Dd.deserialize(n),s="data"in r&&r.data.draco!==void 0;s&&await LO(this._wasmPath);let o=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!o){console.warn(`Object ${t} not found`);return}if(o.data.type!=="Mesh"||!(o instanceof Tr)){console.warn(`Object ${t} is not a mesh`);return}let a=o,l={...a.data,geometry:r};s&&await NO([l]),a.updateByOp({type:0,path:[],props:{geometry:l.geometry}},l,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let c of a.data.states){let u={...c.data};a.states||(a.states={}),a.states[c.id]=na.patch(l,u)}return n}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let n=e.path;Array.isArray(n)&&n.length===2&&n[0]==="scene"&&n[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,n=this._findEntity(e);if(!n)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return n.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=Cw();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let n=t(e);if(typeof n!="object"||n===null||n.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return n}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let n=this._scene;if(!n)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t.uuid,s=this._findEntity(r);if(!s)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(s instanceof Tr))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let o=typeof e=="function"?await this.createCustomMaterial(e):e;if(zf()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=KO({material:o});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(a.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let s=KW(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let{options:o,material:a}=KO(e);if(a!==void 0){if(s.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(zf()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}let l,c;if(s.geometryType==="TextGeometry"){if(!TU("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await $I(),c=e.font??Zp,r.shared.fonts[c]===void 0){if(c!==Zp){let y=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${c}' is not in this document \u2014 available fonts: ${y||"(none)"}.`)}l={name:Zp,url:vF}}}let u=this._resolveParentId(e.parent),d=QW(s,o,r),h=xe.generateUUID(),[p,f]=Rd(r);l&&(p.shared.fonts[Zp]=l),p.scene.objects.insertAfter(u,null,[{id:h,data:d,children:[]}]);let g=f.result();if(l&&this._sharedAssetsManager.addFont(Zp,l),c!==void 0){let y=this._sharedAssetsManager.getFont(c);y&&await y.loadingPromise}this._applyDocumentTransaction(g);let m=n.find(h);return a!==void 0&&m.setMaterialOverride(a,{scene:n,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(m)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let s=typeof t=="string"?t:t?.uuid,o=s?this._findEntity(s):void 0;if(!o)throw new Error(`cloneObject: '${s}' \u2014 no object with that name or uuid in the scene.`);if(o instanceof Cn)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(o.uuid);if(!a)throw new Error(`cloneObject: '${s}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let l=n6(t6(a),e,r.scene.objects),c=e.parent!==void 0?this._resolveParentId(e.parent):r.scene.objects.parent(o.uuid)??null,u=e.parent!==void 0?null:o.uuid,[d,h]=Rd(r);d.scene.objects.insertAfter(c,u,[l]),this._applyDocumentTransaction(h.result());let p=n.find(l.id);return this._requestRenderAutoMode(),this._createProxyObject(p)}removeObject(t){let e=this._scene,n=this._data;if(this.disposed||!e||!n)return!1;let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)return!1;if(s instanceof Cn)throw new Error("removeObject: pages cannot be removed.");if(s.data.type==="PerspectiveCamera"||s.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(n.scene.objects.get(s.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let o=[];s.traverseEntity(c=>{o.push(c.uuid)});let[a,l]=Rd(n);a.scene.objects.delete(s.uuid),this._applyDocumentTransaction(l.result());for(let c of o){let u=this._proxyObjectCache.get(c);u&&(gS.unsubscribe(u),this._proxyObjectCache.delete(c))}return this._requestRenderAutoMode(),!0}};function mle(i){return i.split(".")}