@splinetool/runtime 2.0.33 → 2.0.34

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 (340) hide show
  1. package/build/{runtime-aiAssistant-O2CXSPWK.js → runtime-aiAssistant-CV4K5RNS.js} +1 -1
  2. package/build/runtime-aiAssistant-CV4K5RNS.js.br +0 -0
  3. package/build/runtime-aiAssistant-CV4K5RNS.js.gz +0 -0
  4. package/build/{runtime-apiServices-332YME3N.js → runtime-apiServices-IZQKNNJR.js} +1 -1
  5. package/build/runtime-apiServices-IZQKNNJR.js.br +0 -0
  6. package/build/runtime-apiServices-IZQKNNJR.js.gz +0 -0
  7. package/build/{runtime-audio-W35MH46I.js → runtime-audio-WTF7P43O.js} +1 -1
  8. package/build/runtime-audio-WTF7P43O.js.br +0 -0
  9. package/build/runtime-audio-WTF7P43O.js.gz +0 -0
  10. package/build/runtime-chunk-5LF7U7QS.js +1 -0
  11. package/build/runtime-chunk-5LF7U7QS.js.br +0 -0
  12. package/build/runtime-chunk-5LF7U7QS.js.gz +0 -0
  13. package/build/{runtime-chunk-5FPQ5FYG.js → runtime-chunk-6N7AWRP5.js} +1 -1
  14. package/build/runtime-chunk-6N7AWRP5.js.br +0 -0
  15. package/build/runtime-chunk-6N7AWRP5.js.gz +0 -0
  16. package/build/runtime-chunk-7K6XT4AJ.js +1 -0
  17. package/build/runtime-chunk-7K6XT4AJ.js.br +0 -0
  18. package/build/runtime-chunk-7K6XT4AJ.js.gz +0 -0
  19. package/build/{runtime-chunk-K3MJM76A.js → runtime-chunk-C6JZPJNZ.js} +1 -1
  20. package/build/runtime-chunk-C6JZPJNZ.js.br +0 -0
  21. package/build/runtime-chunk-C6JZPJNZ.js.gz +0 -0
  22. package/build/{runtime-chunk-TT2F77QZ.js → runtime-chunk-CYEPD4AW.js} +1 -1
  23. package/build/runtime-chunk-CYEPD4AW.js.br +0 -0
  24. package/build/runtime-chunk-CYEPD4AW.js.gz +0 -0
  25. package/build/{runtime-chunk-SB5SNGGM.js → runtime-chunk-D32RAGKA.js} +1 -1
  26. package/build/runtime-chunk-D32RAGKA.js.br +0 -0
  27. package/build/runtime-chunk-D32RAGKA.js.gz +0 -0
  28. package/build/{runtime-chunk-LDOZDZC7.js → runtime-chunk-DLE3IUI7.js} +1 -1
  29. package/build/{runtime-chunk-LDOZDZC7.js.br → runtime-chunk-DLE3IUI7.js.br} +0 -0
  30. package/build/runtime-chunk-DLE3IUI7.js.gz +0 -0
  31. package/build/{runtime-chunk-RYZ5Y2UD.js → runtime-chunk-DSDWSX4K.js} +1 -1
  32. package/build/runtime-chunk-DSDWSX4K.js.br +0 -0
  33. package/build/runtime-chunk-DSDWSX4K.js.gz +0 -0
  34. package/build/{runtime-chunk-7KG76FNY.js → runtime-chunk-FRDKMXAI.js} +1 -1
  35. package/build/runtime-chunk-FRDKMXAI.js.br +0 -0
  36. package/build/runtime-chunk-FRDKMXAI.js.gz +0 -0
  37. package/build/{runtime-chunk-PBQNNEHM.js → runtime-chunk-GDBYRW5V.js} +1 -1
  38. package/build/runtime-chunk-GDBYRW5V.js.br +0 -0
  39. package/build/runtime-chunk-GDBYRW5V.js.gz +0 -0
  40. package/build/runtime-chunk-GGSUJEGZ.js +1 -0
  41. package/build/runtime-chunk-GGSUJEGZ.js.br +0 -0
  42. package/build/runtime-chunk-GGSUJEGZ.js.gz +0 -0
  43. package/build/{runtime-chunk-DETJAPEW.js → runtime-chunk-GZQN42B3.js} +1 -1
  44. package/build/runtime-chunk-GZQN42B3.js.br +0 -0
  45. package/build/runtime-chunk-GZQN42B3.js.gz +0 -0
  46. package/build/runtime-chunk-HD7WF3XN.js +1 -0
  47. package/build/runtime-chunk-HD7WF3XN.js.br +0 -0
  48. package/build/runtime-chunk-HD7WF3XN.js.gz +0 -0
  49. package/build/{runtime-chunk-NCJON2ZQ.js → runtime-chunk-I5P7EXII.js} +1 -1
  50. package/build/runtime-chunk-I5P7EXII.js.br +0 -0
  51. package/build/runtime-chunk-I5P7EXII.js.gz +0 -0
  52. package/build/{runtime-chunk-Q2NJ34WP.js → runtime-chunk-IVRZSLHA.js} +1 -1
  53. package/build/runtime-chunk-IVRZSLHA.js.br +0 -0
  54. package/build/runtime-chunk-IVRZSLHA.js.gz +0 -0
  55. package/build/{runtime-chunk-PWCPVKZV.js → runtime-chunk-OVFCYZYZ.js} +1 -1
  56. package/build/runtime-chunk-OVFCYZYZ.js.br +0 -0
  57. package/build/runtime-chunk-OVFCYZYZ.js.gz +0 -0
  58. package/build/runtime-chunk-RSGNJXM5.js +1 -0
  59. package/build/runtime-chunk-RSGNJXM5.js.br +0 -0
  60. package/build/runtime-chunk-RSGNJXM5.js.gz +0 -0
  61. package/build/{runtime-chunk-B5IERHDJ.js → runtime-chunk-TGWBH5R7.js} +1 -1
  62. package/build/runtime-chunk-TGWBH5R7.js.br +0 -0
  63. package/build/runtime-chunk-TGWBH5R7.js.gz +0 -0
  64. package/build/{runtime-chunk-67LSERUX.js → runtime-chunk-TTZ2G6QT.js} +1 -1
  65. package/build/runtime-chunk-TTZ2G6QT.js.br +0 -0
  66. package/build/runtime-chunk-TTZ2G6QT.js.gz +0 -0
  67. package/build/{runtime-chunk-VKFSHS4O.js → runtime-chunk-UDEU4Z6E.js} +1 -1
  68. package/build/runtime-chunk-UDEU4Z6E.js.br +0 -0
  69. package/build/runtime-chunk-UDEU4Z6E.js.gz +0 -0
  70. package/build/{runtime-chunk-45XEVQ3G.js → runtime-chunk-UX572WOF.js} +1 -1
  71. package/build/runtime-chunk-UX572WOF.js.br +0 -0
  72. package/build/runtime-chunk-UX572WOF.js.gz +0 -0
  73. package/build/{runtime-chunk-FYZZPPDQ.js → runtime-chunk-VLIQBVUK.js} +1 -1
  74. package/build/runtime-chunk-VLIQBVUK.js.br +0 -0
  75. package/build/runtime-chunk-VLIQBVUK.js.gz +0 -0
  76. package/build/{runtime-chunk-H5PVAACQ.js → runtime-chunk-VW4KWDYB.js} +1 -1
  77. package/build/runtime-chunk-VW4KWDYB.js.br +0 -0
  78. package/build/runtime-chunk-VW4KWDYB.js.gz +0 -0
  79. package/build/{runtime-chunk-AN7KRN56.js → runtime-chunk-WA7PPDR7.js} +1 -1
  80. package/build/runtime-chunk-WA7PPDR7.js.br +0 -0
  81. package/build/runtime-chunk-WA7PPDR7.js.gz +0 -0
  82. package/build/{runtime-chunk-E6DD5XGN.js → runtime-chunk-WGBNHRF2.js} +1 -1
  83. package/build/runtime-chunk-WGBNHRF2.js.br +0 -0
  84. package/build/runtime-chunk-WGBNHRF2.js.gz +0 -0
  85. package/build/runtime-chunk-WKTS4T2Q.js +1 -0
  86. package/build/runtime-chunk-WKTS4T2Q.js.br +0 -0
  87. package/build/runtime-chunk-WKTS4T2Q.js.gz +0 -0
  88. package/build/{runtime-chunk-4PWCQGEO.js → runtime-chunk-XP7BWNAH.js} +1 -1
  89. package/build/runtime-chunk-XP7BWNAH.js.br +0 -0
  90. package/build/runtime-chunk-XP7BWNAH.js.gz +0 -0
  91. package/build/{runtime-chunk-Y5OIIRGT.js → runtime-chunk-Y4JEBPEG.js} +1 -1
  92. package/build/runtime-chunk-Y4JEBPEG.js.br +0 -0
  93. package/build/runtime-chunk-Y4JEBPEG.js.gz +0 -0
  94. package/build/{runtime-chunk-WTHIEJBK.js → runtime-chunk-Y5F2EZVH.js} +1 -1
  95. package/build/runtime-chunk-Y5F2EZVH.js.br +0 -0
  96. package/build/runtime-chunk-Y5F2EZVH.js.gz +0 -0
  97. package/build/{runtime-chunk-GD6DXFXU.js → runtime-chunk-YCBPXTSV.js} +1 -1
  98. package/build/runtime-chunk-YCBPXTSV.js.br +0 -0
  99. package/build/runtime-chunk-YCBPXTSV.js.gz +0 -0
  100. package/build/{runtime-chunk-XKVJRGT3.js → runtime-chunk-Z5B7LLYZ.js} +1 -1
  101. package/build/runtime-chunk-Z5B7LLYZ.js.br +3 -0
  102. package/build/runtime-chunk-Z5B7LLYZ.js.gz +0 -0
  103. package/build/{runtime-classicRuntime-G2NHV252.js → runtime-classicRuntime-KSASL42C.js} +1 -1
  104. package/build/runtime-classicRuntime-KSASL42C.js.br +0 -0
  105. package/build/runtime-classicRuntime-KSASL42C.js.gz +0 -0
  106. package/build/runtime-cloners-7ADG3PRA.js +1 -0
  107. package/build/runtime-cloners-7ADG3PRA.js.br +0 -0
  108. package/build/runtime-cloners-7ADG3PRA.js.gz +0 -0
  109. package/build/{runtime-components-RN6FVN37.js → runtime-components-LQB33NHS.js} +1 -1
  110. package/build/runtime-components-LQB33NHS.js.br +0 -0
  111. package/build/runtime-components-LQB33NHS.js.gz +0 -0
  112. package/build/{runtime-conditional-RPHIH6FU.js → runtime-conditional-3IFYLPUZ.js} +1 -1
  113. package/build/runtime-conditional-3IFYLPUZ.js.br +0 -0
  114. package/build/runtime-conditional-3IFYLPUZ.js.gz +0 -0
  115. package/build/{runtime-createDestroy-DF5QEIQ3.js → runtime-createDestroy-YK2TMU3U.js} +1 -1
  116. package/build/runtime-createDestroy-YK2TMU3U.js.br +0 -0
  117. package/build/runtime-createDestroy-YK2TMU3U.js.gz +0 -0
  118. package/build/{runtime-dragDrop-BIHQ5KZR.js → runtime-dragDrop-TQ4IK3SC.js} +1 -1
  119. package/build/runtime-dragDrop-TQ4IK3SC.js.br +0 -0
  120. package/build/runtime-dragDrop-TQ4IK3SC.js.gz +0 -0
  121. package/build/{runtime-gameControls-66ZOCHBQ.js → runtime-gameControls-6YEYCD2P.js} +1 -1
  122. package/build/runtime-gameControls-6YEYCD2P.js.br +0 -0
  123. package/build/runtime-gameControls-6YEYCD2P.js.gz +0 -0
  124. package/build/runtime-hair-PBSU5JJT.js +1 -0
  125. package/build/runtime-hair-PBSU5JJT.js.br +1 -0
  126. package/build/runtime-hair-PBSU5JJT.js.gz +0 -0
  127. package/build/{runtime-mergeStaticGeometries-HHUXK4BW.js → runtime-mergeStaticGeometries-E3CCR55I.js} +1 -1
  128. package/build/runtime-mergeStaticGeometries-E3CCR55I.js.br +0 -0
  129. package/build/runtime-mergeStaticGeometries-E3CCR55I.js.gz +0 -0
  130. package/build/runtime-miscActions-LAN6C7QV.js +1 -0
  131. package/build/runtime-miscActions-LAN6C7QV.js.br +0 -0
  132. package/build/runtime-miscActions-LAN6C7QV.js.gz +0 -0
  133. package/build/{runtime-mouseHover-3G4E5GAF.js → runtime-mouseHover-HTSRUTK4.js} +1 -1
  134. package/build/runtime-mouseHover-HTSRUTK4.js.br +0 -0
  135. package/build/runtime-mouseHover-HTSRUTK4.js.gz +0 -0
  136. package/build/{runtime-particles-PN3EYBDA.js → runtime-particles-VMCDVJ5L.js} +1 -1
  137. package/build/runtime-particles-VMCDVJ5L.js.br +0 -0
  138. package/build/runtime-particles-VMCDVJ5L.js.gz +0 -0
  139. package/build/{runtime-paths-GSK2JZMU.js → runtime-paths-67V5VNXJ.js} +1 -1
  140. package/build/runtime-paths-67V5VNXJ.js.br +0 -0
  141. package/build/runtime-paths-67V5VNXJ.js.gz +0 -0
  142. package/build/{runtime-resize-UW73Z5IN.js → runtime-resize-6RWYLE36.js} +1 -1
  143. package/build/runtime-resize-6RWYLE36.js.br +0 -0
  144. package/build/runtime-resize-6RWYLE36.js.gz +0 -0
  145. package/build/{runtime-sceneTransition-LPS7ZHS4.js → runtime-sceneTransition-G5NK2YS2.js} +1 -1
  146. package/build/runtime-sceneTransition-G5NK2YS2.js.br +0 -0
  147. package/build/runtime-sceneTransition-G5NK2YS2.js.gz +0 -0
  148. package/build/runtime-scroll-B4GUIFXT.js +1 -0
  149. package/build/runtime-scroll-B4GUIFXT.js.br +0 -0
  150. package/build/runtime-scroll-B4GUIFXT.js.gz +0 -0
  151. package/build/runtime-shapeBlends-7HXPJQO6.js +1 -0
  152. package/build/runtime-shapeBlends-7HXPJQO6.js.br +0 -0
  153. package/build/runtime-shapeBlends-7HXPJQO6.js.gz +0 -0
  154. package/build/{runtime-text-CGWVXLNC.js → runtime-text-LIAUYVEF.js} +1 -1
  155. package/build/runtime-text-LIAUYVEF.js.br +0 -0
  156. package/build/runtime-text-LIAUYVEF.js.gz +0 -0
  157. package/build/{runtime-textInputs-C5RWG2TR.js → runtime-textInputs-32IUVEXH.js} +1 -1
  158. package/build/runtime-textInputs-32IUVEXH.js.br +0 -0
  159. package/build/runtime-textInputs-32IUVEXH.js.gz +0 -0
  160. package/build/runtime-timeline-PKGP3JA7.js +1 -0
  161. package/build/runtime-timeline-PKGP3JA7.js.br +0 -0
  162. package/build/runtime-timeline-PKGP3JA7.js.gz +0 -0
  163. package/build/{runtime-tracking-4J3G5NE6.js → runtime-tracking-BRT7HL3Z.js} +1 -1
  164. package/build/runtime-tracking-BRT7HL3Z.js.br +0 -0
  165. package/build/runtime-tracking-BRT7HL3Z.js.gz +0 -0
  166. package/build/runtime-transitions-LJZKI2ZX.js +1 -0
  167. package/build/runtime-transitions-LJZKI2ZX.js.br +0 -0
  168. package/build/runtime-transitions-LJZKI2ZX.js.gz +0 -0
  169. package/build/{runtime-ui2d-Q7BEDZKY.js → runtime-ui2d-ZJ245NT2.js} +1 -1
  170. package/build/runtime-ui2d-ZJ245NT2.js.br +0 -0
  171. package/build/runtime-ui2d-ZJ245NT2.js.gz +0 -0
  172. package/build/{runtime-updater-7DBCK2D5.js → runtime-updater-BNOFPDRB.js} +1 -1
  173. package/build/runtime-updater-BNOFPDRB.js.br +2 -0
  174. package/build/runtime-updater-BNOFPDRB.js.gz +0 -0
  175. package/build/{runtime-variables-WUE23WSE.js → runtime-variables-UHMFC5KF.js} +1 -1
  176. package/build/runtime-variables-UHMFC5KF.js.br +0 -0
  177. package/build/runtime-variables-UHMFC5KF.js.gz +0 -0
  178. package/build/{runtime-vectorShapes-6XWTTMQC.js → runtime-vectorShapes-AILU5ZI6.js} +1 -1
  179. package/build/runtime-vectorShapes-AILU5ZI6.js.br +0 -0
  180. package/build/runtime-vectorShapes-AILU5ZI6.js.gz +0 -0
  181. package/build/{runtime-video-3WYFSQFW.js → runtime-video-HX4EHK3D.js} +1 -1
  182. package/build/runtime-video-HX4EHK3D.js.br +0 -0
  183. package/build/runtime-video-HX4EHK3D.js.gz +0 -0
  184. package/build/runtime-webgpu-OA6456OI.js +1 -0
  185. package/build/runtime-webgpu-OA6456OI.js.br +0 -0
  186. package/build/runtime-webgpu-OA6456OI.js.gz +0 -0
  187. package/build/runtime.cjs +319 -319
  188. package/build/runtime.js +1 -1
  189. package/build/runtime.js.br +0 -0
  190. package/build/runtime.js.gz +0 -0
  191. package/build/runtime.standalone.js +1 -1
  192. package/build/runtime.standalone.js.br +0 -0
  193. package/build/runtime.standalone.js.gz +0 -0
  194. package/build/runtime.standalone.webgl.js +1 -1
  195. package/build/runtime.standalone.webgl.js.br +0 -0
  196. package/build/runtime.standalone.webgl.js.gz +0 -0
  197. package/build/runtime.standalone.webgpu.js +1 -1
  198. package/build/runtime.standalone.webgpu.js.br +0 -0
  199. package/build/runtime.standalone.webgpu.js.gz +0 -0
  200. package/build/runtime.standalone.webgpu.micro.js +1 -1
  201. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  202. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  203. package/build/runtime.standalone.webgpu.min.js +1 -1
  204. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  205. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  206. package/package.json +1 -1
  207. package/build/runtime-aiAssistant-O2CXSPWK.js.br +0 -0
  208. package/build/runtime-aiAssistant-O2CXSPWK.js.gz +0 -0
  209. package/build/runtime-apiServices-332YME3N.js.br +0 -0
  210. package/build/runtime-apiServices-332YME3N.js.gz +0 -0
  211. package/build/runtime-audio-W35MH46I.js.br +0 -0
  212. package/build/runtime-audio-W35MH46I.js.gz +0 -0
  213. package/build/runtime-chunk-45XEVQ3G.js.br +0 -0
  214. package/build/runtime-chunk-45XEVQ3G.js.gz +0 -0
  215. package/build/runtime-chunk-4PWCQGEO.js.br +0 -0
  216. package/build/runtime-chunk-4PWCQGEO.js.gz +0 -0
  217. package/build/runtime-chunk-5CU7JBFG.js +0 -1
  218. package/build/runtime-chunk-5CU7JBFG.js.br +0 -0
  219. package/build/runtime-chunk-5CU7JBFG.js.gz +0 -0
  220. package/build/runtime-chunk-5FPQ5FYG.js.br +0 -0
  221. package/build/runtime-chunk-5FPQ5FYG.js.gz +0 -0
  222. package/build/runtime-chunk-67LSERUX.js.br +0 -0
  223. package/build/runtime-chunk-67LSERUX.js.gz +0 -0
  224. package/build/runtime-chunk-7KG76FNY.js.br +0 -0
  225. package/build/runtime-chunk-7KG76FNY.js.gz +0 -0
  226. package/build/runtime-chunk-AN7KRN56.js.br +0 -0
  227. package/build/runtime-chunk-AN7KRN56.js.gz +0 -0
  228. package/build/runtime-chunk-B5IERHDJ.js.br +0 -0
  229. package/build/runtime-chunk-B5IERHDJ.js.gz +0 -0
  230. package/build/runtime-chunk-DETJAPEW.js.br +0 -0
  231. package/build/runtime-chunk-DETJAPEW.js.gz +0 -0
  232. package/build/runtime-chunk-E6DD5XGN.js.br +0 -0
  233. package/build/runtime-chunk-E6DD5XGN.js.gz +0 -0
  234. package/build/runtime-chunk-FYZZPPDQ.js.br +0 -0
  235. package/build/runtime-chunk-FYZZPPDQ.js.gz +0 -0
  236. package/build/runtime-chunk-GD6DXFXU.js.br +0 -0
  237. package/build/runtime-chunk-GD6DXFXU.js.gz +0 -0
  238. package/build/runtime-chunk-H5PVAACQ.js.br +0 -0
  239. package/build/runtime-chunk-H5PVAACQ.js.gz +0 -0
  240. package/build/runtime-chunk-IX7AZI2Z.js +0 -1
  241. package/build/runtime-chunk-IX7AZI2Z.js.br +0 -0
  242. package/build/runtime-chunk-IX7AZI2Z.js.gz +0 -0
  243. package/build/runtime-chunk-K3MJM76A.js.br +0 -0
  244. package/build/runtime-chunk-K3MJM76A.js.gz +0 -0
  245. package/build/runtime-chunk-LDOZDZC7.js.gz +0 -0
  246. package/build/runtime-chunk-NCJON2ZQ.js.br +0 -0
  247. package/build/runtime-chunk-NCJON2ZQ.js.gz +0 -0
  248. package/build/runtime-chunk-PBQNNEHM.js.br +0 -0
  249. package/build/runtime-chunk-PBQNNEHM.js.gz +0 -0
  250. package/build/runtime-chunk-PWCPVKZV.js.br +0 -0
  251. package/build/runtime-chunk-PWCPVKZV.js.gz +0 -0
  252. package/build/runtime-chunk-Q2NJ34WP.js.br +0 -0
  253. package/build/runtime-chunk-Q2NJ34WP.js.gz +0 -0
  254. package/build/runtime-chunk-RYZ5Y2UD.js.br +0 -0
  255. package/build/runtime-chunk-RYZ5Y2UD.js.gz +0 -0
  256. package/build/runtime-chunk-SB5SNGGM.js.br +0 -0
  257. package/build/runtime-chunk-SB5SNGGM.js.gz +0 -0
  258. package/build/runtime-chunk-T5W7UUKQ.js +0 -1
  259. package/build/runtime-chunk-T5W7UUKQ.js.br +0 -0
  260. package/build/runtime-chunk-T5W7UUKQ.js.gz +0 -0
  261. package/build/runtime-chunk-TT2F77QZ.js.br +0 -0
  262. package/build/runtime-chunk-TT2F77QZ.js.gz +0 -0
  263. package/build/runtime-chunk-VDZLCK3P.js +0 -1
  264. package/build/runtime-chunk-VDZLCK3P.js.br +0 -0
  265. package/build/runtime-chunk-VDZLCK3P.js.gz +0 -0
  266. package/build/runtime-chunk-VKFSHS4O.js.br +0 -0
  267. package/build/runtime-chunk-VKFSHS4O.js.gz +0 -0
  268. package/build/runtime-chunk-WTHIEJBK.js.br +0 -0
  269. package/build/runtime-chunk-WTHIEJBK.js.gz +0 -0
  270. package/build/runtime-chunk-XKVJRGT3.js.br +0 -0
  271. package/build/runtime-chunk-XKVJRGT3.js.gz +0 -0
  272. package/build/runtime-chunk-Y5OIIRGT.js.br +0 -0
  273. package/build/runtime-chunk-Y5OIIRGT.js.gz +0 -0
  274. package/build/runtime-chunk-ZE3Y3273.js +0 -1
  275. package/build/runtime-chunk-ZE3Y3273.js.br +0 -0
  276. package/build/runtime-chunk-ZE3Y3273.js.gz +0 -0
  277. package/build/runtime-classicRuntime-G2NHV252.js.br +0 -0
  278. package/build/runtime-classicRuntime-G2NHV252.js.gz +0 -0
  279. package/build/runtime-cloners-DXUA5B7Z.js +0 -1
  280. package/build/runtime-cloners-DXUA5B7Z.js.br +0 -1
  281. package/build/runtime-cloners-DXUA5B7Z.js.gz +0 -0
  282. package/build/runtime-components-RN6FVN37.js.br +0 -0
  283. package/build/runtime-components-RN6FVN37.js.gz +0 -0
  284. package/build/runtime-conditional-RPHIH6FU.js.br +0 -0
  285. package/build/runtime-conditional-RPHIH6FU.js.gz +0 -0
  286. package/build/runtime-createDestroy-DF5QEIQ3.js.br +0 -0
  287. package/build/runtime-createDestroy-DF5QEIQ3.js.gz +0 -0
  288. package/build/runtime-dragDrop-BIHQ5KZR.js.br +0 -0
  289. package/build/runtime-dragDrop-BIHQ5KZR.js.gz +0 -0
  290. package/build/runtime-gameControls-66ZOCHBQ.js.br +0 -0
  291. package/build/runtime-gameControls-66ZOCHBQ.js.gz +0 -0
  292. package/build/runtime-hair-MA6FN35D.js +0 -1
  293. package/build/runtime-hair-MA6FN35D.js.br +0 -0
  294. package/build/runtime-hair-MA6FN35D.js.gz +0 -0
  295. package/build/runtime-mergeStaticGeometries-HHUXK4BW.js.br +0 -0
  296. package/build/runtime-mergeStaticGeometries-HHUXK4BW.js.gz +0 -0
  297. package/build/runtime-miscActions-24ZVLPRO.js +0 -1
  298. package/build/runtime-miscActions-24ZVLPRO.js.br +0 -0
  299. package/build/runtime-miscActions-24ZVLPRO.js.gz +0 -0
  300. package/build/runtime-mouseHover-3G4E5GAF.js.br +0 -0
  301. package/build/runtime-mouseHover-3G4E5GAF.js.gz +0 -0
  302. package/build/runtime-particles-PN3EYBDA.js.br +0 -0
  303. package/build/runtime-particles-PN3EYBDA.js.gz +0 -0
  304. package/build/runtime-paths-GSK2JZMU.js.br +0 -0
  305. package/build/runtime-paths-GSK2JZMU.js.gz +0 -0
  306. package/build/runtime-resize-UW73Z5IN.js.br +0 -0
  307. package/build/runtime-resize-UW73Z5IN.js.gz +0 -0
  308. package/build/runtime-sceneTransition-LPS7ZHS4.js.br +0 -0
  309. package/build/runtime-sceneTransition-LPS7ZHS4.js.gz +0 -0
  310. package/build/runtime-scroll-2RACPF3L.js +0 -1
  311. package/build/runtime-scroll-2RACPF3L.js.br +0 -0
  312. package/build/runtime-scroll-2RACPF3L.js.gz +0 -0
  313. package/build/runtime-shapeBlends-W3UDTX47.js +0 -1
  314. package/build/runtime-shapeBlends-W3UDTX47.js.br +0 -0
  315. package/build/runtime-shapeBlends-W3UDTX47.js.gz +0 -0
  316. package/build/runtime-text-CGWVXLNC.js.br +0 -0
  317. package/build/runtime-text-CGWVXLNC.js.gz +0 -0
  318. package/build/runtime-textInputs-C5RWG2TR.js.br +0 -0
  319. package/build/runtime-textInputs-C5RWG2TR.js.gz +0 -0
  320. package/build/runtime-timeline-3NEYLJHX.js +0 -1
  321. package/build/runtime-timeline-3NEYLJHX.js.br +0 -0
  322. package/build/runtime-timeline-3NEYLJHX.js.gz +0 -0
  323. package/build/runtime-tracking-4J3G5NE6.js.br +0 -0
  324. package/build/runtime-tracking-4J3G5NE6.js.gz +0 -0
  325. package/build/runtime-transitions-6WCGNZX7.js +0 -1
  326. package/build/runtime-transitions-6WCGNZX7.js.br +0 -0
  327. package/build/runtime-transitions-6WCGNZX7.js.gz +0 -0
  328. package/build/runtime-ui2d-Q7BEDZKY.js.br +0 -0
  329. package/build/runtime-ui2d-Q7BEDZKY.js.gz +0 -0
  330. package/build/runtime-updater-7DBCK2D5.js.br +0 -1
  331. package/build/runtime-updater-7DBCK2D5.js.gz +0 -0
  332. package/build/runtime-variables-WUE23WSE.js.br +0 -0
  333. package/build/runtime-variables-WUE23WSE.js.gz +0 -0
  334. package/build/runtime-vectorShapes-6XWTTMQC.js.br +0 -0
  335. package/build/runtime-vectorShapes-6XWTTMQC.js.gz +0 -0
  336. package/build/runtime-video-3WYFSQFW.js.br +0 -0
  337. package/build/runtime-video-3WYFSQFW.js.gz +0 -0
  338. package/build/runtime-webgpu-TEJIPT3H.js +0 -1
  339. package/build/runtime-webgpu-TEJIPT3H.js.br +0 -0
  340. package/build/runtime-webgpu-TEJIPT3H.js.gz +0 -0
@@ -0,0 +1 @@
1
+ import{b as e,d as t}from"./runtime-chunk-4YV3EXSU.js";import{c as i}from"./runtime-chunk-NSD7DU3P.js";import{a as r,b as s,f as n,h as a,k as o,l,m as h,v as d}from"./runtime-chunk-5LF7U7QS.js";import{c as u}from"./runtime-chunk-RTLL6WIB.js";import{a as p}from"./runtime-chunk-C6JZPJNZ.js";import{c,i as g}from"./runtime-chunk-TZCHGFVF.js";import{Fa as m,Ga as f,H as y,T as v,a as b,c as x,da as w,ga as S,k as M,la as O,n as P,z as A}from"./runtime-chunk-WKTS4T2Q.js";import{$c as _,Aa as C,Ba as E,Cc as I,Dc as D,Ec as L,Ed as U,Fc as z,Fd as B,Gd as R,Hd as G,He as T,Ib as N,Ic as k,Id as F,Ja as V,Jb as j,Jc as H,Jd as q,Ld as W,Md as Y,Nd as X,Oc as $,Od as Z,Pc as J,Qe as K,Rc as Q,Rd as ee,Tc as te,Td as ie,Ud as re,Vd as se,Wc as ne,Wd as ae,Xc as oe,Yc as le,Yd as he,Zc as de,bd as ue,cd as pe,dd as ce,nd as ge,qa as me,rd as fe,se as ye,yd as ve}from"./runtime-chunk-BVVSZMXD.js";function be(e,t=!1){let i=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),n={},a={},o=e[0].morphTargetsRelative,l=new ce,h=0;for(let d=0;d<e.length;++d){let u=e[d],p=0;if(i!==(null!==u.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let e in u.attributes){if(!r.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===n[e]&&(n[e]=[]),n[e].push(u.attributes[e]),p++}if(p!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". Make sure all geometries have the same number of attributes."),null;if(o!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let e in u.morphAttributes){if(!s.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". .morphAttributes must be consistent throughout all geometries."),null;void 0===a[e]&&(a[e]=[]),a[e].push(u.morphAttributes[e])}if(t){let e;if(i)e=u.index.count;else{if(void 0===u.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". The geometry must have either an index or a position attribute"),null;e=u.attributes.position.count}l.addGroup(h,e,d),h+=e}}if(i){let t=0,i=[];for(let r=0;r<e.length;++r){let s=e[r].index;for(let e=0;e<s.count;++e)i.push(s.getX(e)+t);t+=e[r].attributes.position.count}l.setIndex(i)}for(let e in n){let t=xe(n[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" attribute."),null;l.setAttribute(e,t)}for(let e in a){let t=a[e][0].length;if(0!==t){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let i=0;i<t;++i){let t=[];for(let r=0;r<a[e].length;++r)t.push(a[e][r][i]);let r=xe(t);if(!r)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" morphAttribute."),null;l.morphAttributes[e].push(r)}}}return l}function xe(e){let t,i,r,s=-1,n=0;for(let a=0;a<e.length;++a){let o=e[a];if(void 0===t&&(t=o.array.constructor),t!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===i&&(i=o.itemSize),i!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===r&&(r=o.normalized),r!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===s&&(s=o.gpuType),s!==o.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;n+=o.count*i}let a=new t(n),o=new de(a,i,r),l=0;for(let t=0;t<e.length;++t){let r=e[t];if(r.isInterleavedBufferAttribute){let e=l/i;for(let t=0,s=r.count;t<s;t++)for(let s=0;s<i;s++){let i=r.getComponent(t,s);o.setComponent(t+e,s,i)}}else a.set(r.array,l);l+=r.count*i}return void 0!==s&&(o.gpuType=s),o}function we(e,t=1e-4){t=Math.max(t,Number.EPSILON);let i={},r=e.getIndex(),s=e.getAttribute("position"),n=r?r.count:s.count,a=0,o=Object.keys(e.attributes),l={},h={},d=[],u=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"];for(let t=0,i=o.length;t<i;t++){let i=o[t],r=e.attributes[i];l[i]=new r.constructor(new r.array.constructor(r.count*r.itemSize),r.itemSize,r.normalized);let s=e.morphAttributes[i];s&&(h[i]||(h[i]=[]),s.forEach((e,t)=>{let r=new e.array.constructor(e.count*e.itemSize);h[i][t]=new e.constructor(r,e.itemSize,e.normalized)}))}let c=.5*t,g=Math.log10(1/t),m=Math.pow(10,g),f=c*m;for(let t=0;t<n;t++){let s=r?r.getX(t):t,n="";for(let t=0,i=o.length;t<i;t++){let i=o[t],r=e.getAttribute(i),a=r.itemSize;for(let e=0;e<a;e++)n+=~~(r[u[e]](s)*m+f)+","}if(n in i)d.push(i[n]);else{for(let t=0,i=o.length;t<i;t++){let i=o[t],r=e.getAttribute(i),n=e.morphAttributes[i],d=r.itemSize,c=l[i],g=h[i];for(let e=0;e<d;e++){let t=u[e],i=p[e];if(c[i](a,r[t](s)),n)for(let e=0,r=n.length;e<r;e++)g[e][i](a,n[e][t](s))}}i[n]=a,d.push(a),a++}}let y=e.clone();for(let t in e.attributes){let e=l[t];if(y.setAttribute(t,new e.constructor(e.array.slice(0,a*e.itemSize),e.itemSize,e.normalized)),t in h)for(let e=0;e<h[t].length;e++){let i=h[t][e];y.morphAttributes[t][e]=new i.constructor(i.array.slice(0,a*i.itemSize),i.itemSize,i.normalized)}}return y.setIndex(d),y}var Se,Me,Oe,Pe=null;function Ae(e){Pe=e}function _e(e){let t=!1;return e.scene.objects.traverse((e,i)=>{"Mesh"===i.type&&("TextGeometry"===i.geometry.type||"InputGeometry"===i.geometry.type)&&(t=!0)}),t}function Ce(e,t){if(!e)throw t||"Assertion Failed!"}(Me=Se||(Se={}))[Me.ODD=0]="ODD",Me[Me.NONZERO=1]="NONZERO",Me[Me.POSITIVE=2]="POSITIVE",Me[Me.NEGATIVE=3]="NEGATIVE",Me[Me.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(Oe||(Oe={}));var Ee=function(){function e(){}return e.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},e.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},e.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},e.edgeGoesLeft=function(t){return e.vertLeq(t.Dst,t.Org)},e.edgeGoesRight=function(t){return e.vertLeq(t.Org,t.Dst)},e.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},e.edgeEval=function(t,i,r){Ce(e.vertLeq(t,i)&&e.vertLeq(i,r));var s=i.s-t.s,n=r.s-i.s;return s+n>0?s<n?i.t-t.t+(t.t-r.t)*(s/(s+n)):i.t-r.t+(r.t-t.t)*(n/(s+n)):0},e.edgeSign=function(t,i,r){Ce(e.vertLeq(t,i)&&e.vertLeq(i,r));var s=i.s-t.s,n=r.s-i.s;return s+n>0?(i.t-r.t)*s+(i.t-t.t)*n:0},e.transEval=function(t,i,r){Ce(e.transLeq(t,i)&&e.transLeq(i,r));var s=i.t-t.t,n=r.t-i.t;return s+n>0?s<n?i.s-t.s+(t.s-r.s)*(s/(s+n)):i.s-r.s+(r.s-t.s)*(n/(s+n)):0},e.transSign=function(t,i,r){Ce(e.transLeq(t,i)&&e.transLeq(i,r));var s=i.t-t.t,n=r.t-i.t;return s+n>0?(i.s-r.s)*s+(i.s-t.s)*n:0},e.vertCCW=function(e,t,i){return e.s*(t.t-i.t)+t.s*(i.t-e.t)+i.s*(e.t-t.t)>=0},e.interpolate=function(e,t,i,r){return(e=e<0?0:e)<=(i=i<0?0:i)?0===i?(t+r)/2:t+e/(e+i)*(r-t):r+i/(e+i)*(t-r)},e.intersect=function(t,i,r,s,n){var a,o,l;e.vertLeq(t,i)||(l=t,t=i,i=l),e.vertLeq(r,s)||(l=r,r=s,s=l),e.vertLeq(t,r)||(l=t,t=r,r=l,l=i,i=s,s=l),e.vertLeq(r,i)?e.vertLeq(i,s)?((a=e.edgeEval(t,r,i))+(o=e.edgeEval(r,i,s))<0&&(a=-a,o=-o),n.s=e.interpolate(a,r.s,o,i.s)):((a=e.edgeSign(t,r,i))+(o=-e.edgeSign(t,s,i))<0&&(a=-a,o=-o),n.s=e.interpolate(a,r.s,o,s.s)):n.s=(r.s+i.s)/2,e.transLeq(t,i)||(l=t,t=i,i=l),e.transLeq(r,s)||(l=r,r=s,s=l),e.transLeq(t,r)||(l=t,t=r,r=l,l=i,i=s,s=l),e.transLeq(r,i)?e.transLeq(i,s)?((a=e.transEval(t,r,i))+(o=e.transEval(r,i,s))<0&&(a=-a,o=-o),n.t=e.interpolate(a,r.t,o,i.t)):((a=e.transSign(t,r,i))+(o=-e.transSign(t,s,i))<0&&(a=-a,o=-o),n.t=e.interpolate(a,r.t,o,s.t)):n.t=(r.t+i.t)/2},e}(),Ie=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},De=function(){function e(e){this.side=e,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(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),e}(),Le=function(){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},Ue=function(){function e(){var e=new Le,t=new Ie,i=new De(0),r=new De(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,i.next=i,i.Sym=r,r.next=r,r.Sym=i,this.vHead=e,this.fHead=t,this.eHead=i,this.eHeadSym=r}return e.prototype.makeEdge_=function(e){var t=new De(0),i=new De(1);e.Sym.side<e.side&&(e=e.Sym);var r=e.Sym.next;return i.next=r,r.Sym.next=t,t.next=e,e.Sym.next=i,t.Sym=i,t.Onext=t,t.Lnext=i,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,i.Sym=t,i.Onext=i,i.Lnext=t,i.Org=null,i.Lface=null,i.winding=0,i.activeRegion=null,t},e.prototype.splice_=function(e,t){var i=e.Onext,r=t.Onext;i.Sym.Lnext=t,r.Sym.Lnext=e,e.Onext=r,t.Onext=i},e.prototype.makeVertex_=function(e,t,i){var r=e;Ce(r,"Vertex can't be null!");var s=i.prev;r.prev=s,s.next=r,r.next=i,i.prev=r,r.anEdge=t;var n=t;do{n.Org=r,n=n.Onext}while(n!==t)},e.prototype.makeFace_=function(e,t,i){var r=e;Ce(r,"Face can't be null");var s=i.prev;r.prev=s,s.next=r,r.next=i,i.prev=r,r.anEdge=t,r.trail=null,r.marked=!1,r.inside=i.inside;var n=t;do{n.Lface=r,n=n.Lnext}while(n!==t)},e.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,i=e.Sym.next;t.Sym.next=i,i.Sym.next=t},e.prototype.killVertex_=function(e,t){var i=e.anEdge,r=i;do{r.Org=t,r=r.Onext}while(r!==i);var s=e.prev,n=e.next;n.prev=s,s.next=n},e.prototype.killFace_=function(e,t){var i=e.anEdge,r=i;do{r.Lface=t,r=r.Lnext}while(r!==i);var s=e.prev,n=e.next;n.prev=s,s.next=n},e.prototype.makeEdge=function(){var e=new Le,t=new Le,i=new Ie,r=this.makeEdge_(this.eHead);return this.makeVertex_(e,r,this.vHead),this.makeVertex_(t,r.Sym,this.vHead),this.makeFace_(i,r,this.fHead),r},e.prototype.splice=function(e,t){var i=!1,r=!1;if(e!==t){if(t.Org!==e.Org&&(r=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!r){var s=new Le;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!i){var n=new Ie;this.makeFace_(n,t,e.Lface),e.Lface.anEdge=e}}},e.prototype.delete=function(e){var t=e.Sym,i=!1;if(e.Lface!==e.Rface&&(i=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!i){var r=new Ie;this.makeFace_(r,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},e.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),i=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var r=new Le;return this.makeVertex_(r,i,t.Org),t.Lface=i.Lface=e.Lface,t},e.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e).Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,t),e.Dst=t.Org,t.Dst.anEdge=t.Sym,t.Rface=e.Rface,t.winding=e.winding,t.Sym.winding=e.Sym.winding,t.idx=e.idx,t.Sym.idx=e.Sym.idx,t},e.prototype.connect=function(e,t){var i=!1,r=this.makeEdge_(e),s=r.Sym;if(t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(r,e.Lnext),this.splice_(s,t),r.Org=e.Dst,s.Org=t.Org,r.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!i){var n=new Ie;this.makeFace_(n,r,e.Lface)}return r},e.prototype.zapFace=function(e){var t,i,r,s,n,a=e.anEdge;i=a.Lnext;do{i=(t=i).Lnext,t.Lface=null,null===t.Rface&&(t.Onext===t?this.killVertex_(t.Org,null):(t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),(r=t.Sym).Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),this.killEdge_(t))}while(t!=a);s=e.prev,(n=e.next).prev=s,s.next=n},e.prototype.countFaceVerts_=function(e){var t=e.anEdge,i=0;do{i++,t=t.Lnext}while(t!==e.anEdge);return i},e.prototype.mergeConvexFaces=function(e){var t,i,r,s,n;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(t.inside)for(n=(i=t.anEdge).Org;r=i.Lnext,(s=i.Sym)&&s.Lface&&s.Lface.inside&&this.countFaceVerts_(t)+this.countFaceVerts_(s.Lface)-2<=e&&Ee.vertCCW(i.Lprev.Org,i.Org,s.Lnext.Lnext.Org)&&Ee.vertCCW(s.Lprev.Org,s.Org,i.Lnext.Lnext.Org)&&(r=s.Lnext,this.delete(s),i=null,s=null),!i||i.Lnext.Org!==n;)i=r;return!0},e.prototype.check=function(){var e,t,i,r,s,n,a=this.fHead,o=this.vHead,l=this.eHead;for(t=a,t=a;(e=t.next)!==a;t=e){Ce(e.prev===t),s=e.anEdge;do{Ce(s.Sym!==s),Ce(s.Sym.Sym===s),Ce(s.Lnext.Onext.Sym===s),Ce(s.Onext.Sym.Lnext===s),Ce(s.Lface===e),s=s.Lnext}while(s!==e.anEdge)}for(Ce(e.prev===t&&null===e.anEdge),r=o,r=o;(i=r.next)!==o;r=i){Ce(i.prev===r),s=i.anEdge;do{Ce(s.Sym!==s),Ce(s.Sym.Sym===s),Ce(s.Lnext.Onext.Sym===s),Ce(s.Onext.Sym.Lnext===s),Ce(s.Org===i),s=s.Onext}while(s!==i.anEdge)}for(Ce(i.prev===r&&null===i.anEdge),n=l,n=l;(s=n.next)!==l;n=s)Ce(s.Sym.next===n.Sym),Ce(s.Sym!==s),Ce(s.Sym.Sym===s),Ce(null!==s.Org),Ce(null!==s.Dst),Ce(s.Lnext.Onext.Sym===s),Ce(s.Onext.Sym.Lnext===s);Ce(s.Sym.next===n.Sym&&s.Sym===this.eHeadSym&&s.Sym.Sym===s&&null===s.Org&&null===s.Dst&&null===s.Lface&&null===s.Rface)},e}(),ze=function(){this.handle=null},Be=function(){this.key=null,this.node=0},Re=function(){function e(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var i=0;i<e+1;i++)this.nodes[i]=new ze,this.handles[i]=new Be;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(e){var t,i,r,s=this.nodes,n=this.handles;for(t=s[e].handle;;){if((r=e<<1)<this.size&&this.leq(n[s[r+1].handle].key,n[s[r].handle].key)&&++r,Ce(r<=this.max),i=s[r].handle,r>this.size||this.leq(n[t].key,n[i].key)){s[e].handle=t,n[t].node=e;break}s[e].handle=i,n[i].node=e,e=r}},e.prototype.floatUp_=function(e){var t,i,r,s=this.nodes,n=this.handles;for(t=s[e].handle;;){if(i=s[r=e>>1].handle,0===r||this.leq(n[i].key,n[t].key)){s[e].handle=t,n[t].node=e;break}s[e].handle=i,n[i].node=e,e=r}},e.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(e){var t,i;if(2*(t=++this.size)>this.max){var r,s;for(this.max*=2,s=this.nodes.length,this.nodes.length=this.max+1,r=s;r<this.nodes.length;r++)this.nodes[r]=new ze;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new Be}return 0===this.freeList?i=t:(i=this.freeList,this.freeList=this.handles[i].node),this.nodes[t].handle=i,this.handles[i].node=t,this.handles[i].key=e,this.initialized&&this.floatUp_(t),i},e.prototype.extractMin=function(){var e=this.nodes,t=this.handles,i=e[1].handle,r=t[i].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[i].key=null,t[i].node=this.freeList,this.freeList=i,--this.size,this.size>0&&this.floatDown_(1)),r},e.prototype.delete=function(e){var t,i=this.nodes,r=this.handles;Ce(e>=1&&e<=this.max&&null!==r[e].key),i[t=r[e].node].handle=i[this.size].handle,r[i[t].handle].node=t,--this.size,t<=this.size&&(t<=1||this.leq(r[i[t>>1].handle].key,r[i[t].handle].key)?this.floatDown_(t):this.floatUp_(t)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},e}(),Ge=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},Te=function(){this.key=null,this.next=null,this.prev=null},Ne=function(){function e(e,t){this.frame=e,this.leq=t,this.head=new Te,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(e){return this.insertBefore(this.head,e)},e.prototype.search=function(e){var t=this.head;do{t=t.next}while(null!==t.key&&!this.leq(this.frame,e,t.key));return t},e.prototype.insertBefore=function(e,t){do{e=e.prev}while(null!==e.key&&!this.leq(this.frame,e.key,t));var i=new Te;return i.key=t,i.next=e.next,e.next.prev=i,i.prev=e,e.next=i,i},e.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},e}(),ke=function(){function e(){}return e.regionBelow=function(e){return e.nodeUp.prev.key},e.regionAbove=function(e){return e.nodeUp.next.key},e.debugEvent=function(e){},e.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.edgeLeq=function(e,t,i){var r=e.event,s=t.eUp,n=i.eUp;return s.Dst===r?n.Dst===r?Ee.vertLeq(s.Org,n.Org)?Ee.edgeSign(n.Dst,s.Org,n.Org)<=0:Ee.edgeSign(s.Dst,n.Org,s.Org)>=0:Ee.edgeSign(n.Dst,r,n.Org)<=0:n.Dst===r?Ee.edgeSign(s.Dst,r,s.Org)>=0:Ee.edgeEval(s.Dst,r,s.Org)>=Ee.edgeEval(n.Dst,r,n.Org)},e.deleteRegion=function(e,t){t.fixUpperEdge&&Ce(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},e.fixUpperEdge=function(e,t,i){Ce(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=i,i.activeRegion=t},e.topLeftRegion=function(t,i){var r,s=i.eUp.Org;do{i=e.regionAbove(i)}while(i.eUp.Org===s);if(i.fixUpperEdge){if(null===(r=t.mesh.connect(e.regionBelow(i).eUp.Sym,i.eUp.Lnext)))return null;e.fixUpperEdge(t,i,r),i=e.regionAbove(i)}return i},e.topRightRegion=function(t){var i=t.eUp.Dst;do{t=e.regionAbove(t)}while(t.eUp.Dst===i);return t},e.addRegionBelow=function(e,t,i){var r=new Ge;return r.eUp=i,r.nodeUp=e.dict.insertBefore(t.nodeUp,r),r.fixUpperEdge=!1,r.sentinel=!1,r.dirty=!1,i.activeRegion=r,r},e.isWindingInside=function(e,t){switch(e.windingRule){case Se.ODD:return!!(1&t);case Se.NONZERO:return 0!==t;case Se.POSITIVE:return t>0;case Se.NEGATIVE:return t<0;case Se.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(t,i){i.windingNumber=e.regionAbove(i).windingNumber+i.eUp.winding,i.inside=e.isWindingInside(t,i.windingNumber)},e.finishRegion=function(t,i){var r=i.eUp,s=r.Lface;s.inside=i.inside,s.anEdge=r,e.deleteRegion(t,i)},e.finishLeftRegions=function(t,i,r){for(var s,n=null,a=i,o=i.eUp;a!==r;){if(a.fixUpperEdge=!1,(s=(n=e.regionBelow(a)).eUp).Org!=o.Org){if(!n.fixUpperEdge){e.finishRegion(t,a);break}s=t.mesh.connect(o.Lprev,s.Sym),e.fixUpperEdge(t,n,s)}o.Onext!==s&&(t.mesh.splice(s.Oprev,s),t.mesh.splice(o,s)),e.finishRegion(t,a),o=n.eUp,a=n}return o},e.addRightEdges=function(t,i,r,s,n,a){var o,l,h,d,u=!0;h=r;do{Ce(Ee.vertLeq(h.Org,h.Dst)),e.addRegionBelow(t,i,h.Sym),h=h.Onext}while(h!==s);for(null===n&&(n=e.regionBelow(i).eUp.Rprev),l=i,d=n;(h=(o=e.regionBelow(l)).eUp.Sym).Org===d.Org;)h.Onext!==d&&(t.mesh.splice(h.Oprev,h),t.mesh.splice(d.Oprev,h)),o.windingNumber=l.windingNumber-h.winding,o.inside=e.isWindingInside(t,o.windingNumber),l.dirty=!0,!u&&e.checkForRightSplice(t,l)&&(e.addWinding(h,d),e.deleteRegion(t,l),t.mesh.delete(d)),u=!1,l=o,d=h;l.dirty=!0,Ce(l.windingNumber-h.winding===o.windingNumber),a&&e.walkDirtyRegions(t,l)},e.spliceMergeVertices=function(e,t,i){e.mesh.splice(t,i)},e.vertexWeights=function(e,t,i){var r=Ee.vertL1dist(t,e),s=Ee.vertL1dist(i,e),n=.5*s/(r+s),a=.5*r/(r+s);e.coords[0]+=n*t.coords[0]+a*i.coords[0],e.coords[1]+=n*t.coords[1]+a*i.coords[1],e.coords[2]+=n*t.coords[2]+a*i.coords[2]},e.getIntersectData=function(t,i,r,s,n,a){i.coords[0]=i.coords[1]=i.coords[2]=0,i.idx=-1,e.vertexWeights(i,r,s),e.vertexWeights(i,n,a)},e.checkForRightSplice=function(t,i){var r=e.regionBelow(i),s=i.eUp,n=r.eUp;if(Ee.vertLeq(s.Org,n.Org)){if(Ee.edgeSign(n.Dst,s.Org,n.Org)>0)return!1;Ee.vertEq(s.Org,n.Org)?s.Org!==n.Org&&(t.pq.delete(s.Org.pqHandle),e.spliceMergeVertices(t,n.Oprev,s)):(t.mesh.splitEdge(n.Sym),t.mesh.splice(s,n.Oprev),i.dirty=r.dirty=!0)}else{if(Ee.edgeSign(s.Dst,n.Org,s.Org)<0)return!1;e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(s.Sym),t.mesh.splice(n.Oprev,s)}return!0},e.checkForLeftSplice=function(t,i){var r,s=e.regionBelow(i),n=i.eUp,a=s.eUp;if(Ce(!Ee.vertEq(n.Dst,a.Dst)),Ee.vertLeq(n.Dst,a.Dst)){if(Ee.edgeSign(n.Dst,a.Dst,n.Org)<0)return!1;e.regionAbove(i).dirty=i.dirty=!0,r=t.mesh.splitEdge(n),t.mesh.splice(a.Sym,r),r.Lface.inside=i.inside}else{if(Ee.edgeSign(a.Dst,n.Dst,a.Org)>0)return!1;i.dirty=s.dirty=!0,r=t.mesh.splitEdge(a),t.mesh.splice(n.Lnext,a.Sym),r.Rface.inside=i.inside}return!0},e.checkForIntersect=function(t,i){var r,s,n=e.regionBelow(i),a=i.eUp,o=n.eUp,l=a.Org,h=o.Org,d=a.Dst,u=o.Dst,p=new Le;if(Ce(!Ee.vertEq(u,d)),Ce(Ee.edgeSign(d,t.event,l)<=0),Ce(Ee.edgeSign(u,t.event,h)>=0),Ce(l!==t.event&&h!==t.event),Ce(!i.fixUpperEdge&&!n.fixUpperEdge),l===h||Math.min(l.t,d.t)>Math.max(h.t,u.t))return!1;if(Ee.vertLeq(l,h)){if(Ee.edgeSign(u,l,h)>0)return!1}else if(Ee.edgeSign(d,h,l)<0)return!1;return e.debugEvent(t),Ee.intersect(d,l,u,h,p),Ce(Math.min(l.t,d.t)<=p.t),Ce(p.t<=Math.max(h.t,u.t)),Ce(Math.min(u.s,d.s)<=p.s),Ce(p.s<=Math.max(h.s,l.s)),Ee.vertLeq(p,t.event)&&(p.s=t.event.s,p.t=t.event.t),r=Ee.vertLeq(l,h)?l:h,Ee.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),Ee.vertEq(p,l)||Ee.vertEq(p,h)?(e.checkForRightSplice(t,i),!1):!Ee.vertEq(d,t.event)&&Ee.edgeSign(d,t.event,p)>=0||!Ee.vertEq(u,t.event)&&Ee.edgeSign(u,t.event,p)<=0?u===t.event?(t.mesh.splitEdge(a.Sym),t.mesh.splice(o.Sym,a),i=e.topLeftRegion(t,i),a=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),n),e.addRightEdges(t,i,a.Oprev,a,a,!0),!0):d===t.event?(t.mesh.splitEdge(o.Sym),t.mesh.splice(a.Lnext,o.Oprev),n=i,i=e.topRightRegion(i),s=e.regionBelow(i).eUp.Rprev,n.eUp=o.Oprev,o=e.finishLeftRegions(t,n,null),e.addRightEdges(t,i,o.Onext,a.Rprev,s,!0),!0):(Ee.edgeSign(d,t.event,p)>=0&&(e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(a.Sym),a.Org.s=t.event.s,a.Org.t=t.event.t),Ee.edgeSign(u,t.event,p)<=0&&(i.dirty=n.dirty=!0,t.mesh.splitEdge(o.Sym),o.Org.s=t.event.s,o.Org.t=t.event.t),!1):(t.mesh.splitEdge(a.Sym),t.mesh.splitEdge(o.Sym),t.mesh.splice(o.Oprev,a),a.Org.s=p.s,a.Org.t=p.t,a.Org.pqHandle=t.pq.insert(a.Org),e.getIntersectData(t,a.Org,l,d,h,u),e.regionAbove(i).dirty=i.dirty=n.dirty=!0,!1)},e.walkDirtyRegions=function(t,i){for(var r,s,n=e.regionBelow(i);;){for(;n.dirty;)i=n,n=e.regionBelow(n);if(!i.dirty&&(n=i,null===(i=e.regionAbove(i))||!i.dirty))return;if(i.dirty=!1,r=i.eUp,s=n.eUp,r.Dst!==s.Dst&&e.checkForLeftSplice(t,i)&&(n.fixUpperEdge?(e.deleteRegion(t,n),t.mesh.delete(s),s=(n=e.regionBelow(i)).eUp):i.fixUpperEdge&&(e.deleteRegion(t,i),t.mesh.delete(r),r=(i=e.regionAbove(n)).eUp)),r.Org!==s.Org)if(r.Dst===s.Dst||i.fixUpperEdge||n.fixUpperEdge||r.Dst!==t.event&&s.Dst!==t.event)e.checkForRightSplice(t,i);else if(e.checkForIntersect(t,i))return;r.Org===s.Org&&r.Dst===s.Dst&&(e.addWinding(s,r),e.deleteRegion(t,i),t.mesh.delete(r),i=e.regionAbove(n))}},e.connectRightVertex=function(t,i,r){var s,n=r.Onext,a=e.regionBelow(i),o=i.eUp,l=a.eUp,h=!1;o.Dst!==l.Dst&&e.checkForIntersect(t,i),Ee.vertEq(o.Org,t.event)&&(t.mesh.splice(n.Oprev,o),i=e.topLeftRegion(t,i),n=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),a),h=!0),Ee.vertEq(l.Org,t.event)&&(t.mesh.splice(r,l.Oprev),r=e.finishLeftRegions(t,a,null),h=!0),h?e.addRightEdges(t,i,r.Onext,n,n,!0):(s=Ee.vertLeq(l.Org,o.Org)?l.Oprev:o,s=t.mesh.connect(r.Lprev,s),e.addRightEdges(t,i,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(t,i))},e.connectLeftDegenerate=function(t,i,r){var s,n,a,o,l;return s=i.eUp,Ee.vertEq(s.Org,r)?(Ce(!1),void e.spliceMergeVertices(t,s,r.anEdge)):Ee.vertEq(s.Dst,r)?(Ce(!1),i=e.topRightRegion(i),n=o=(a=(l=e.regionBelow(i)).eUp.Sym).Onext,l.fixUpperEdge&&(Ce(n!==a),e.deleteRegion(t,l),t.mesh.delete(a),a=n.Oprev),t.mesh.splice(r.anEdge,a),Ee.edgeGoesLeft(n)||(n=null),void e.addRightEdges(t,i,a.Onext,o,n,!0)):(t.mesh.splitEdge(s.Sym),i.fixUpperEdge&&(t.mesh.delete(s.Onext),i.fixUpperEdge=!1),t.mesh.splice(r.anEdge,s),void e.sweepEvent(t,r))},e.connectLeftVertex=function(t,i){var r,s,n,a,o,l,h=new Ge;if(h.eUp=i.anEdge.Sym,r=t.dict.search(h).key,s=e.regionBelow(r)){if(a=r.eUp,o=s.eUp,0===Ee.edgeSign(a.Dst,i,a.Org))return void e.connectLeftDegenerate(t,r,i);n=Ee.vertLeq(o.Dst,a.Dst)?r:s,r.inside||n.fixUpperEdge?(l=n===r?t.mesh.connect(i.anEdge.Sym,a.Lnext):t.mesh.connect(o.Dnext,i.anEdge).Sym,n.fixUpperEdge?e.fixUpperEdge(t,n,l):e.computeWinding(t,e.addRegionBelow(t,r,l)),e.sweepEvent(t,i)):e.addRightEdges(t,r,i.anEdge,i.anEdge,null,!0)}},e.sweepEvent=function(t,i){t.event=i,e.debugEvent(t);for(var r=i.anEdge;null===r.activeRegion;)if((r=r.Onext)===i.anEdge)return void e.connectLeftVertex(t,i);var s=e.topLeftRegion(t,r.activeRegion);Ce(null!==s);var n=e.regionBelow(s),a=n.eUp,o=e.finishLeftRegions(t,n,null);o.Onext===a?e.connectRightVertex(t,s,o):e.addRightEdges(t,s,o.Onext,a,a,!0)},e.addSentinel=function(e,t,i,r){var s=new Ge,n=e.mesh.makeEdge();n.Org.s=i,n.Org.t=r,n.Dst.s=t,n.Dst.t=r,e.event=n.Dst,s.eUp=n,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},e.initEdgeDict=function(t){t.dict=new Ne(t,e.edgeLeq);var i=t.bmax[0]-t.bmin[0],r=t.bmax[1]-t.bmin[1],s=t.bmin[0]-i,n=t.bmax[0]+i,a=t.bmin[1]-r,o=t.bmax[1]+r;e.addSentinel(t,s,n,a),e.addSentinel(t,s,n,o)},e.doneEdgeDict=function(t){for(var i,r=0;null!==(i=t.dict.min().key);)i.sentinel||(Ce(i.fixUpperEdge),Ce(1===++r)),Ce(0===i.windingNumber),e.deleteRegion(t,i)},e.removeDegenerateEdges=function(t){var i,r,s,n=t.mesh.eHead;for(i=n.next;i!==n;i=r)r=i.next,s=i.Lnext,Ee.vertEq(i.Org,i.Dst)&&i.Lnext.Lnext!==i&&(e.spliceMergeVertices(t,s,i),t.mesh.delete(i),s=(i=s).Lnext),s.Lnext===i&&(s!==i&&((s===r||s===r.Sym)&&(r=r.next),t.mesh.delete(s)),(i===r||i===r.Sym)&&(r=r.next),t.mesh.delete(i))},e.initPriorityQ=function(e){var t,i,r,s=0;for(i=(r=e.mesh.vHead).next;i!==r;i=i.next)s++;for(s+=8,t=e.pq=new Re(s,Ee.vertLeq),i=(r=e.mesh.vHead).next;i!==r;i=i.next)i.pqHandle=t.insert(i);return i===r&&(t.init(),!0)},e.donePriorityQ=function(e){e.pq=null},e.removeDegenerateFaces=function(t,i){var r,s,n;for(r=i.fHead.next;r!==i.fHead;r=s)s=r.next,Ce((n=r.anEdge).Lnext!==n),n.Lnext.Lnext===n&&(e.addWinding(n.Onext,n),t.mesh.delete(n));return!0},e.computeInterior=function(t,i){var r,s;if(void 0===i&&(i=!0),e.removeDegenerateEdges(t),!e.initPriorityQ(t))return!1;for(e.initEdgeDict(t);null!==(r=t.pq.extractMin());){for(;null!==(s=t.pq.min())&&Ee.vertEq(s,r);)s=t.pq.extractMin(),e.spliceMergeVertices(t,r.anEdge,s.anEdge);e.sweepEvent(t,r)}return t.event=t.dict.min().key.eUp.Org,e.debugEvent(t),e.doneEdgeDict(t),e.donePriorityQ(t),!!e.removeDegenerateFaces(t,t.mesh)&&(i&&t.mesh.check(),!0)},e}(),Fe=function(){function e(){this.mesh=new Ue,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=Se.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 e.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},e.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},e.prototype.computeNormal_=function(e){var t,i,r,s,n,a,o=[0,0,0],l=[0,0,0],h=[0,0,0],d=[0,0,0],u=[0,0,0],p=[null,null,null],c=[null,null,null],g=this.mesh.vHead;t=g.next;for(var m=0;m<3;++m)s=t.coords[m],l[m]=s,c[m]=t,o[m]=s,p[m]=t;for(t=g.next;t!==g;t=t.next)for(var f=0;f<3;++f)(s=t.coords[f])<l[f]&&(l[f]=s,c[f]=t),s>o[f]&&(o[f]=s,p[f]=t);var y=0;if(o[1]-l[1]>o[0]-l[0]&&(y=1),o[2]-l[2]>o[y]-l[y]&&(y=2),l[y]>=o[y])return e[0]=0,e[1]=0,void(e[2]=1);for(a=0,i=c[y],r=p[y],h[0]=i.coords[0]-r.coords[0],h[1]=i.coords[1]-r.coords[1],h[2]=i.coords[2]-r.coords[2],t=g.next;t!==g;t=t.next)d[0]=t.coords[0]-r.coords[0],d[1]=t.coords[1]-r.coords[1],d[2]=t.coords[2]-r.coords[2],u[0]=h[1]*d[2]-h[2]*d[1],u[1]=h[2]*d[0]-h[0]*d[2],u[2]=h[0]*d[1]-h[1]*d[0],(n=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>a&&(a=n,e[0]=u[0],e[1]=u[1],e[2]=u[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(h)]=1)},e.prototype.checkOrientation_=function(){for(var e,t,i=this.mesh.fHead,r=this.mesh.vHead,s=0,n=i.next;n!==i;n=n.next)if(!((t=n.anEdge).winding<=0))do{s+=(t.Org.s-t.Dst.s)*(t.Org.t+t.Dst.t),t=t.Lnext}while(t!==n.anEdge);if(s<0){for(e=r.next;e!==r;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]}},e.prototype.projectPolygon_=function(){var e,t,i=this.mesh.vHead,r=[0,0,0],s=!1;r[0]=this.normal[0],r[1]=this.normal[1],r[2]=this.normal[2],!r[0]&&!r[1]&&!r[2]&&(this.computeNormal_(r),s=!0),e=this.sUnit,t=this.tUnit;var n=this.longAxis_(r);e[n]=0,e[(n+1)%3]=1,e[(n+2)%3]=0,t[n]=0,t[(n+1)%3]=0,t[(n+2)%3]=r[n]>0?1:-1;for(var a=i.next;a!==i;a=a.next)a.s=this.dot_(a.coords,e),a.t=this.dot_(a.coords,t);s&&this.checkOrientation_();for(var o=!0,l=i.next;l!==i;l=l.next)o?(this.bmin[0]=this.bmax[0]=l.s,this.bmin[1]=this.bmax[1]=l.t,o=!1):(l.s<this.bmin[0]&&(this.bmin[0]=l.s),l.s>this.bmax[0]&&(this.bmax[0]=l.s),l.t<this.bmin[1]&&(this.bmin[1]=l.t),l.t>this.bmax[1]&&(this.bmax[1]=l.t))},e.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.prototype.tessellateMonoRegion_=function(e,t){var i,r;if((i=t.anEdge).Lnext===i||i.Lnext.Lnext===i)throw"Mono region invalid";for(;Ee.vertLeq(i.Dst,i.Org);i=i.Lprev);for(;Ee.vertLeq(i.Org,i.Dst);i=i.Lnext);for(r=i.Lprev;i.Lnext!==r;)if(Ee.vertLeq(i.Dst,r.Org)){for(;r.Lnext!==i&&(Ee.edgeGoesLeft(r.Lnext)||Ee.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)r=e.connect(r.Lnext,r).Sym;r=r.Lprev}else{for(;r.Lnext!==i&&(Ee.edgeGoesRight(i.Lprev)||Ee.edgeSign(i.Dst,i.Org,i.Lprev.Org)>=0);)i=e.connect(i,i.Lprev).Sym;i=i.Lnext}if(r.Lnext===i)throw"Mono region invalid";for(;r.Lnext.Lnext!==i;)r=e.connect(r.Lnext,r).Sym;return!0},e.prototype.tessellateInterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)if(t=i.next,i.inside&&!this.tessellateMonoRegion_(e,i))return!1;return!0},e.prototype.discardExterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)t=i.next,i.inside||e.zapFace(i)},e.prototype.setWindingNumber_=function(e,t,i){for(var r,s=e.eHead.next;s!==e.eHead;s=r)r=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:i?e.delete(s):s.winding=0},e.prototype.getNeighbourFace_=function(e){return e.Rface&&e.Rface.inside?e.Rface.n:-1},e.prototype.outputPolymesh_=function(e,t,i,r){var s,n,a=0,o=0;i>3&&e.mergeConvexFaces(i);for(var l=e.vHead.next;l!==e.vHead;l=l.next)l.n=-1;for(var h=e.fHead.next;h!==e.fHead;h=h.next)if(h.n=-1,h.inside){s=h.anEdge,n=0;do{-1===(l=s.Org).n&&(l.n=o,o++),n++,s=s.Lnext}while(s!==h.anEdge);if(n>i)throw"Face vertex greater that support polygon";h.n=a,++a}for(this.elementCount=a,t===Oe.CONNECTED_POLYGONS&&(a*=2),this.elements=[],this.elements.length=a*i,this.vertexCount=o,this.vertices=[],this.vertices.length=o*r,this.vertexIndices=[],this.vertexIndices.length=o,l=e.vHead.next;l!==e.vHead;l=l.next)if(-1!==l.n){var d=l.n*r;this.vertices[d+0]=l.coords[0],this.vertices[d+1]=l.coords[1],r>2&&(this.vertices[d+2]=l.coords[2]),this.vertexIndices[l.n]=l.idx}var u=0;for(h=e.fHead.next;h!==e.fHead;h=h.next)if(h.inside){s=h.anEdge,n=0;do{l=s.Org,this.elements[u++]=l.n,n++,s=s.Lnext}while(s!==h.anEdge);for(var p=n;p<i;++p)this.elements[u++]=-1;if(t===Oe.CONNECTED_POLYGONS){s=h.anEdge;do{this.elements[u++]=this.getNeighbourFace_(s),s=s.Lnext}while(s!==h.anEdge);for(var c=n;c<i;++c)this.elements[u++]=-1}}},e.prototype.outputContours_=function(e,t){var i,r,s=0,n=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(a.inside){r=i=a.anEdge;do{this.vertexCount++,i=i.Lnext}while(i!==r);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var o=0,l=0,h=0;for(s=0,a=e.fHead.next;a!==e.fHead;a=a.next)if(a.inside){n=0,r=i=a.anEdge;do{this.vertices[o++]=i.Org.coords[0],this.vertices[o++]=i.Org.coords[1],t>2&&(this.vertices[o++]=i.Org.coords[2]),this.vertexIndices[l++]=this.vertexIdCallback?this.vertexIdCallback(i):i.Org.idx,n++,i=i.Lnext}while(i!==r);this.elements[h++]=s,this.elements[h++]=n,s+=n}},e.prototype.addContour=function(e,t){null===this.mesh&&(this.mesh=new Ue),e<2&&(e=2),e>3&&(e=3);for(var i=null,r=0;r<t.length;r+=e)null===i?(i=this.mesh.makeEdge(),this.mesh.splice(i,i.Sym)):(this.mesh.splitEdge(i),i=i.Lnext),i.Org.coords[0]=t[r+0],i.Org.coords[1]=t[r+1],i.Org.coords[2]=e>2?t[r+2]:0,i.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(i),i.winding=1,i.Sym.winding=-1},e.prototype.tesselate=function(e,t,i,r,s,n){if(void 0===e&&(e=Se.ODD),void 0===t&&(t=Oe.POLYGONS),void 0===n&&(n=!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=e,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),ke.computeInterior(this,n);var a=this.mesh;return t===Oe.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),n&&a.check(),t===Oe.BOUNDARY_CONTOURS?this.outputContours_(a,r):this.outputPolymesh_(a,t,i,r),!0},e}();function Ve(e){var t=e.windingRule,i=void 0===t?Se.ODD:t,r=e.elementType,s=void 0===r?Oe.POLYGONS:r,n=e.polySize,a=void 0===n?3:n,o=e.vertexSize,l=void 0===o?2:o,h=e.normal,d=void 0===h?[0,0,1]:h,u=e.contours,p=void 0===u?[]:u,c=e.strict,g=void 0===c||c,m=e.debug,f=void 0!==m&&m;if(!p&&g)throw new Error("Contours can't be empty");if(p){var y=new Fe;e.edgeCreateCallback&&(y.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(y.vertexIdCallback=e.vertexIdCallback);for(var v=0;v<p.length;v++)y.addContour(l||2,p[v]);return y.tesselate(i,s,a,l,d,g),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:f?y.mesh:void 0}}}Se.ODD,Se.NONZERO,Se.POSITIVE,Se.NEGATIVE,Se.ABS_GEQ_TWO,Oe.POLYGONS,Oe.CONNECTED_POLYGONS,Oe.BOUNDARY_CONTOURS;var je=1e-12,He=class{constructor(e){this.position=new D,this.startPosition=new D,this.uuid=I.generateUUID(),this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new He(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},qe=class extends He{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new qe(this.parent).copy(this)}},We=class extends He{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new qe(this),new qe(this))}static create(e,t){let i=new We(e,new D(...t.position));return i.controls[0].position.set(...t.controlPrevious.position),i.controls[1].position.set(...t.controlNext.position),i.roundness=t.roundness,i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,i}getOppositeControl(e){let t=this.controls.indexOf(e);return 0===t?this.controls[1]:1===t?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let i=0,r=this.controls.length;i<r;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=t?r.position.copy(this.position):r.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 We(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),t=this.curveAfter?.getTangentAt(0);return[e,t]}computeNormals(e=new D,t=new D){let[i,r]=this.computeTangents();return i&&r&&(Ye(i,e),Ye(r,t)),[e,t]}computeTangent(e=new D){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new D){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}};function Ye(e,t=new D){let i=e.length();return t.set(-e.y/i,e.x/i)}var Xe=e=>e,$e=new D,Ze=new D,Je=new D,Ke=new D,Qe=new D,et=new D,tt=new z,it=new z;function rt(e){let t=new D;t.addVectors(e.v0,$e.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new D;return i.addVectors(e.v2,Ze.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new q(e.v0,t,i,e.v2)}function st(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function nt(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function at(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function ot(e,t,i){let r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),n=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));return Math.acos((s*s+r*r-n*n)/(2*s*r))}function lt(e,t,i){return gt(e,t)&&gt(t,i)&&ht(e.position,t.position,i.position)}function ht(e,t,i){return 0===$e.copy(t).sub(e).cross(Ze.copy(i).sub(e))}function dt(e,t,i,r,s){let n=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),a=(e.y+t.y)/2,o=(e.x+t.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(n/2,2))*(e.y-t.y)/n,h=Math.sqrt(Math.pow(i,2)-Math.pow(n/2,2))*(t.x-e.x)/n;return r.set(o+l,a+h),s.set(o-l,a-h),[r,s]}function ut(e,t,i){return e.distanceTo(i)<t.distanceTo(i)?t:e}function pt(e,t,i,r,s,n){let a,o=t.x-e.x,l=t.y-e.y,h=i.x-e.x,d=i.y-e.y,u=Math.sqrt((o+h)*(o+h)+(l+d)*(l+d));return ot(t,e,i)>Math.PI&&(u*=-1),a=st(d,l)?(l+d)*(r/u-.5)*8/3/(o-h):(o+h)*(r/u-.5)*8/3/(d-l),s.set(t.x-a*l,t.y+a*o),n.set(i.x+a*d,i.y-a*h),[s,n]}function ct(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function gt(e,t){return ht(e.position,e.controls[1].position,t.position)&&ht(e.position,t.controls[0].position,t.position)}function mt(e,t=12,i=!1){let r=[];for(let s=0,n=e.length;s<n;s++){let n=e[s],a=0;if(i&&void 0!==n.roundedCurveCorner){let e=.5*ft(n.roundedCurveCorner,t);s>0&&(r[s-1]+=e),a+=e}void 0!==n.curveAfter&&(a+=ft(n.curveAfter,t)),r.push(a)}return e.length>0&&i&&void 0!==e[0].roundedCurveCorner&&(r[e.length-1]+=.5*ft(e[0].roundedCurveCorner,t)),r}function ft(e,t=12){return e&&e instanceof F?2*t:e&&(e instanceof W||e instanceof Y)?1:e&&e instanceof Z?t*e.points.length:t}var yt=new D,vt=new D,bt=new D,xt=new D,wt=new D,St=new D,Mt=class extends ee{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new fe(new z(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=I.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new Mt;return r.isClosed=e.isClosed,r.points=e.points.map(e=>We.create(e.id,e.data)),"number"==typeof e.roundness&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(e=>Mt.createFromState(e)),void 0!==t&&void 0!==i&&r.applySize(t,i),r.update(),r}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 t=0,i=this.points.length;t<i;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(e){let t=this.points.length,i=this.points.findIndex(t=>t.uuid===e);if(i<0){let i=t;for(let t=0,r=this.shapeHoles.length;t<r;t++){let r=this.shapeHoles[t],s=r.points.length,n=r.getPointIndexById(e);if(!(n<0))return n+i;i+=s}}return i}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let t=this.points.length;for(let i=0,r=this.shapeHoles.length;i<r;i++){let r=this.shapeHoles[i],s=e-t;if(s<=r.points.length-1)return r.points[s];t+=r.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let i=0,r=this.shapeHoles.length;i<r;i++){let r=this.shapeHoles[i],s=r.points.indexOf(e);if(s>=0)return t+s;t+=r.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...e]}applySize(e,t){0===e&&(e=.001),0===t&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let i=yt.set(e,t);for(let e=0,t=this.points.length;e<t;e++){let t=this.points[e];t.position.multiply(i),t.controls[0].position.multiply(i),t.controls[1].position.multiply(i)}for(let i=0,r=this.shapeHoles.length;i<r;i++)this.shapeHoles[i].applyScale(e,t);this._update()}createPoint(e,t=0,i=I.generateUUID()){let r;r=e instanceof D?e:new D(e,t);let s=new We(i,r);return s.roundness=this.roundness,s}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];if(i.uuid===e)return i}for(let t=0,i=this.shapeHoles.length;t<i;t++){let i=this.shapeHoles[t].getPointByUuid(e);if(i)return i}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(t=>t.uuid===e);t&&this.removePoint(t)}update(){for(let e=0,t=this.shapeHoles.length;e<t;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,t=12,i=!1){this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t);let r=i?this.roundedCurveDivisions:this.curveDivisions;return function(e,t,i=12,r=!0){let s,n=it.set(0,0,0),a=0,o=[];for(let r=0;r<t.length;r++){let l=Xe(t[r]),h=$e,d=ft(l,i);o.push(d);for(let t=0;t<=d;t++)if(l instanceof q||l instanceof X||l instanceof W){if(l.getPoint(t/d,h),n.set(h.x,h.y,0),void 0!==s&&at(s,n))continue;void 0===s&&(s=tt),s.copy(n),e.setXYZ(a,n.x,n.y,n.z),a++}}r&&a>1&&(e.getX(a-1)!==e.getX(0)||e.getY(a-1)!==e.getY(0)||e.getZ(a-1)!==e.getZ(0))&&(e.setXYZ(a,e.getX(0),e.getY(0),e.getZ(0)),a++)}(e,i?this.roundedCurves:this.curves,t,this.autoClose),r.reduce((e,t)=>e+t,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=mt(this.points,e,!1),this.roundedCurveDivisions=mt(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(e,t,i,r=12,s=!0){let n=it.set(0,0,0),a=0,o=[];for(let s=0;s<t.length;s++){if(!1===i[s])continue;let l,h=Xe(t[s]),d=$e,u=ft(h,r);o.push(u);for(let t=0;t<=u;t++)if(h instanceof q||h instanceof X||h instanceof W){if(h.getPoint(t/u,d),n.set(d.x,d.y,0),l?.equals(n))continue;void 0===l?l=tt:(e.setXYZ(a,l.x,l.y,l.z),a++,e.setXYZ(a,n.x,n.y,n.z),a++),l.copy(n)}}return s&&a>1&&!(e.getX(a-1)===e.getX(0)&&e.getY(a-1)===e.getY(0)&&e.getZ(a-1)===e.getZ(0))&&(e.setXYZ(a,e.getX(0),e.getY(0),e.getZ(0)),a++),o}(e,this.curves,t,i,this.autoClose).reduce((e,t)=>e+t,0)}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t),function(e,t,i=12,r=!0){let s,n=0;for(let r=0;r<t.length;r++){let a=Xe(t[r]),o=ft(a,i),l=$e;for(let t=0;t<=o;t++)if(a instanceof q||a instanceof X||a instanceof W){if(a.getPoint(t/o,l),void 0!==s&&nt(s,l,je))continue;void 0===s&&(s=Ze),s.copy(l),e.push(l.x,l.y),n++}}return st(e[0],e[e.length-2],je)&&st(e[1],e[e.length-1],je)&&(e.pop(),e.pop()),r&&n>1&&!(st(e[n-1],e[1],je)&&st(e[n-2],e[0],je))&&(e.push(e[0],e[1]),n++),e}(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let i=0;void 0===this.curveDivisions&&this.computeCurveDivisions(this.subdivision);let r=t?this.roundedCurveDivisions:this.curveDivisions,s=0;t&&void 0!==this.points[0].roundedCurveCorner&&(s=.5*ft(this.points[0].roundedCurveCorner,this.subdivision));let n=e-s;n<0&&(n+=r.reduce((e,t)=>e+t,0));for(let e=0,t=r.length;e<t;e++){let t=r[e];if(n<i+t)return[e,(n-i+1)/t];i+=t}return[0,1]}getCurveT(e,t,i){let r=this.points[e],s=this.points[e>=this.points.length-1?0:e+1],n=this.curveDivisions,a=n[e];if(ct(r,s)){let e=r.position.distanceTo(s.position);return r.position.distanceTo(yt.set(i.x,i.y))/e}let o=0;for(let t=0;t<e;t++)o+=n[t];return(t-o)/a}dispose(){}_applyCurveForPoint(e,t){ct(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let i=this.curves[this.curves.length-1];e.curveBefore=i,t.curveAfter=i;let r=i.clone();e.roundedCurveBefore=r,t.roundedCurveAfter=r,e.roundedCurveCorner=void 0,this.roundedCurves.push(r)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,t=this.points.length;e<t;e++){let t=this.points[e];if(0===e)this.moveTo(t.position.x,t.position.y);else{let i=this.points[e-1];this._applyCurveForPoint(t,i)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let e=this.points[0],t=this.points[this.points.length-1];this._applyCurveForPoint(e,t)}if(this.points.length>2){let e=0;for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t],r=this.points[t-1]??this.points[this.points.length-1],s=this.points[t+1]??this.points[0],n=i.roundness,a=r&&s&&lt(r,i,s);if(!i.controlsMoved()&&n>0&&!a){let r=i.curveBefore,s=i.curveAfter;if(void 0===r||void 0===s)continue;let a,o=i.roundedCurveBefore,l=i.roundedCurveAfter,h=r instanceof W?r.v1.distanceTo(r.v2):r.getLength(),d=s instanceof W?s.v1.distanceTo(s.v2):s.getLength(),u=Math.min(n,.499*h),p=Math.min(n,.499*d),c=Math.min(u,p),g=1-c/h,m=c/d,f=r.getPointAt(g,yt),y=s.getPointAt(m,vt);if(this._subSplitCurve(r,o,g,f,void 0),this._subSplitCurve(s,l,m,void 0,y),this.useCubicForRoundedCorners){let e=ot(f,i.position,y)/2,t=Math.tan(e)*f.distanceTo(i.position),[r,s]=dt(f,y,t,bt,xt),n=ut(r,s,i.position),[o,l]=pt(n,f,y,t,wt,St);a=new q(f.clone(),o.clone(),l.clone(),y.clone())}else a=new X(f.clone(),i.position.clone(),y.clone());i.roundedCurveCorner=a,this.roundedCurves.splice(t+e,0,a),e++}}}}_subSplitCurve(e,t,i,r,s){if(!(e instanceof W)){let n=e,a=t,o=n.getUtoTmapping(i,0),l=function(e,t,i,r,s=.5){let n=$e.subVectors(t,e).multiplyScalar(s).add(e),a=Ze.subVectors(i,t).multiplyScalar(s).add(t),o=Je.subVectors(r,i).multiplyScalar(s).add(i),l=n,h=Ke.subVectors(a,n).multiplyScalar(s).add(n),d=Qe.subVectors(o,a).multiplyScalar(s).add(a),u=o,p=et.subVectors(d,h).multiplyScalar(s).add(h);return[e.x,e.y,l.x,l.y,h.x,h.y,p.x,p.y,d.x,d.y,u.x,u.y,r.x,r.y]}(n.v0,n.v1,n.v2,n.v3,o);return void 0!==r&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),void 0!==s&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return void 0!==r&&t.v2.copy(r),void 0!==s&&t.v1.copy(s),t}clone(){let e=new Mt(this._width,this._height);return e.points=this.points.map(e=>e.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(e=>e.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let i=0;i<t;i++){let t=7*i,r=e.points[t+0],s=e.points[t+1],n=e.points[t+2],a=e.points[t+3],o=e.points[t+4],l=e.points[t+5],h=e.points[t+6],d=new We(I.generateUUID(),new D(r,s));d.controls[0].position.set(n,a),d.controls[1].position.set(o,l),d.roundness=h,this.points.push(d)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(e=>{let t=new Mt;return t.fromJSON(e),t}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,t=!1){this.isText=t;let i=(e,t)=>{t instanceof q&&t.v3.equals(e.position)&&e.controls[0].position.copy(t.v2)};return this.points=(e=>{let t,r,s=[];for(t=0,r=e.length;t<r;t++)e[t]instanceof X&&(e[t]=rt(e[t]));for(t=0,r=e.length;t<r;t++){let r,n=e[t],a=t>0?e[t-1]:null;n instanceof q?(r=this.createPoint(n.v0),r.controls[1].position.copy(n.v1)):n instanceof W&&(r=this.createPoint(n.v1)),void 0!==r&&(null!==a&&i(r,a),s.push(r))}let n=e[e.length-1],a=!1;return n instanceof q?n.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(n.v2),a=!0):n instanceof W&&n.v2.equals(s[0].position)&&(a=!0),this.isClosed=a,s})(e.curves),e instanceof ee&&(this.shapeHoles=e.holes.map(e=>{let t=new Mt;return t.fromShape(e),t})),this.update(),this}updatePoint(e,t){let i=this.getPointByUuid(e);i&&(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.roundness&&(i.roundness=t.roundness),void 0!==t.areControlsDirectionsMirrored&&(i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,t){let i=this.getPointByUuid(e)?.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}updateNextControl(e,t){let i=this.getPointByUuid(e)?.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}},Ot=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let i=e*Ot.eSize;this.buffer=new ArrayBuffer(i);let r=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*r,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*r,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*r,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} → ${e}`);let i=e*Ot.eSize,r=new ArrayBuffer(i),s=Float32Array.BYTES_PER_ELEMENT,n=0,a=new Float32Array(r,n*s,3*e);n+=3*e;let o=new Float32Array(r,n*s,3*e);n+=3*e;let l=new Float32Array(r,n*s,2*e);t?(a.set(this.positions.subarray(0,3*this.size)),o.set(this.normals.subarray(0,3*this.size)),l.set(this.uvs.subarray(0,2*this.size))):(a.set(this.positions),o.set(this.normals),l.set(this.uvs)),this.buffer=r,this.positions=a,this.normals=o,this.uvs=l,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let e=this.capacity;for(;t>e;)e*=2;this.realloc(e)}let i=this.size;return this.size=t,i}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} → ${this.size}`),this.realloc(this.size,!0)}},Pt=Ot;Pt.eSize=8*Float32Array.BYTES_PER_ELEMENT;var At=class{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let s=e-1>>1,n=t[s];if(i(r,n)>=0)break;t[e]=n,e=s}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,s=t[e];for(;e<r;){let r=1+(e<<1),n=r+1;if(n<this.length&&i(t[n],t[r])<0&&(r=n),i(t[r],s)>=0)break;t[e]=t[r],e=r}t[e]=s}};function _t(e,t,i,r){this.x=e,this.y=t,this.h=i,this.d=function(e,t,i){let r=!1,s=1/0;for(let n of i)for(let i=0,a=n.length,o=a-1;i<a;o=i++){let a=n[i],l=n[o];a[1]>t!=l[1]>t&&e<(l[0]-a[0])*(t-a[1])/(l[1]-a[1])+a[0]&&(r=!r),s=Math.min(s,Ct(e,t,a,l))}return 0===s?0:(r?1:-1)*Math.sqrt(s)}(e,t,r),this.max=this.d+this.h*Math.SQRT2}function Ct(e,t,i,r){let s=i[0],n=i[1],a=r[0]-s,o=r[1]-n;if(0!==a||0!==o){let i=((e-s)*a+(t-n)*o)/(a*a+o*o);i>1?(s=r[0],n=r[1]):i>0&&(s+=a*i,n+=o*i)}return a=e-s,o=t-n,a*a+o*o}var Et={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},It={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},Dt={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},Lt=(e,t)=>([i,r])=>(r<i&&(r+=t),(e>=i?e:e+t)<=r),Ut=class extends ce{constructor(e,t,i=0,r=12,s=3,n=Se.ODD,a=!1){super(),this.forPathBevel=a,this.type="ShapeGeometry",this.vertexCache={},this._shape=e,this._depth=t,this._curveSegments=r,this._bevelSegmentsInput=s;let o,l,h,d=this._shape.extractShapePointsToFlatArray([],r),u=this._shape.shapeHoles.map(e=>{let t=e.extractShapePointsToFlatArray([],r),i=[];for(let e=t.length-1;e>=1;e-=2){let r=t[e-1],s=t[e-0];i.push(r,s)}return i}),p=[],c=[];for(let e=0;e<d.length;e+=2)c.push([d[e],d[e+1]]);p.push(c);for(let e=0;e<u.length;e++){let t=u[e],i=[];for(let e=0;e<t.length;e+=2)i.push([t[e],t[e+1]]);p.push(i)}o=e.isText?.1*(new K).setFromPoints(e.points.map(e=>e.position)).getSize(new D).length():0===p[0].length?i:i>0?function(e,t,i=1,r=!1){let s=1/0,n=1/0,a=-1/0,o=-1/0;for(let[t,i]of e[0])t<s&&(s=t),i<n&&(n=i),t>a&&(a=t),i>o&&(o=i);let l=a-s,h=o-n,d=Math.max(i,Math.min(l,h));if(d===i){let e=[s,n];return e.distance=0,e.distance}let u=new At([],(e,t)=>t.max-e.max),p=function(e){let t=0,i=0,r=0,s=e[0];for(let e=0,n=s.length,a=n-1;e<n;a=e++){let n=s[e],o=s[a],l=n[0]*o[1]-o[0]*n[1];i+=(n[0]+o[0])*l,r+=(n[1]+o[1])*l,t+=3*l}let n=new _t(i/t,r/t,0,e);return 0===t||n.d<0?new _t(s[0][0],s[0][1],0,e):n}(e),c=new _t(s+l/2,n+h/2,0,e);c.d>p.d&&(p=c);let g=2;function m(s,n,a){let o=new _t(s,n,a,e);if(g++,o.max>p.d+i&&u.push(o),o.d>p.d&&(p=o,r&&console.log(`found best ${Math.round(1e4*o.d)/1e4} after ${g} probes`),p.d>t))return t}let f=d/2;for(let e=s;e<a;e+=d)for(let t=n;t<o;t+=d)m(e+f,t+f,f);for(;u.length;){let{max:e,x:t,y:r,h:s}=u.pop();if(e-p.d<=i)break;f=s/2,m(t-f,r-f,f),m(t+f,r-f,f),m(t-f,r+f,f),m(t+f,r+f,f)}r&&console.log(`num probes: ${g}\nbest distance: ${p.d}`);let y=[p.x,p.y];return y.distance=p.d,y.distance}(p,i):1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,o,t/2),this._bevelSegments=Math.floor(s));try{l=Ve({windingRule:n,elementType:Oe.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[d]})}catch{l=Et}try{h=Ve({windingRule:Se.ODD,elementType:Oe.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...u]})}catch{h=It}if(!l)throw new Error("error generating geometry");let g=l.elementCount;if(h){l.elementCount+=h.elementCount;for(let e=0;e<h.elements.length;e++){let t=h.elements[e],i=e%2==0?l.vertexCount:0;l.elements.push(t+i)}for(let e=0;e<h.vertexIndices.length;e++){let t=h.vertexIndices[e],i=l.vertexCount;l.vertexIndices.push(t+i)}for(let e=0;e<h.vertices.length;e++){let t=h.vertices[e];l.vertices.push(t)}}let m=1/0,f=-1/0,y=1/0,v=-1/0;for(let e=0,t=l.vertexCount;e<t;e++){let t=2*e,i=l.vertices[t+0],r=l.vertices[t+1];i<m&&(m=i),i>f&&(f=i),r<y&&(y=r),r>v&&(v=r)}this._minX=m,this._minY=y,this._width=f-m,this._height=v-y,this._buffer=new Pt(this._computeBufferEstimatedSize(l));let b=[],x=[];for(let e=l.elementCount-1;e>=0;e--){let t=e>=g,i=2*e,s=l.elements[i+0],n=l.elements[i+1],h=s+n,d={start:s,count:n,normals:[],continuous:[],concave:[]},p=s,c=h-1,m=s+1,f=this._shape.roundedCurves.length;do{let e=p-s,i=l.vertices[2*c+0],r=l.vertices[2*c+1],a=l.vertices[2*p+0],o=l.vertices[2*p+1],u=l.vertices[2*m+0],g=l.vertices[2*m+1],y=a-i,v=o-r,b=Math.sqrt(y*y+v*v);y/=b,v/=b;let x=a-u,w=o-g,S=Math.sqrt(x*x+w*w);x/=S,w/=S,d.normals[2*e+0]=-w,d.normals[2*e+1]=x,d.concave[e]=y*w-v*x>0;let M=l.vertexIndices[p];if(Array.isArray(M))d.continuous[e]=!1;else{let[t,i]=this._shape.getCurveIndexFromVertexId(M-1,!0);if(i>0&&i<1)d.continuous[e]=!0;else{let r=1===i?t+1:t-1;r=(r+f)%f;let s=1===i?0:1,n=this._shape.roundedCurves[t].getTangent(i),a=this._shape.roundedCurves[r].getTangent(s);d.continuous[e]=n.dot(a)>.95}}t&&(d.normals[2*e+0]*=-1,d.normals[2*e+1]*=-1),[c,p,m]=[p,m,m+1],m>=h&&(m-=n)}while(m!==s+1);let y=[];y.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*s,2*h),vertexCount:n,vertexIndices:new Array(n).fill(!0).map((e,t)=>[t,t]),elements:[0,n],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(2*s,2*h)});let v=0;for(let e=1;e<=this._bevelSegments;e++){let i=e/this._bevelSegments*Math.PI/2,s=(1-Math.cos(i))*this._bevel,a=[],o=[],h=[],u=[],p=0;for(let e=0;e<n;e++){let i=2*e,c=(e-1+n)%n*2,g=l.vertices[2*d.start+i+0],m=l.vertices[2*d.start+i+1],f=-d.normals[c+0]*s,y=-d.normals[c+1]*s,v=-d.normals[i+0]*s,b=-d.normals[i+1]*s;if(d.concave[e]||!d.concave[e]&&t){let i=Math.atan2(y,f),n=Math.atan2(b,v);n>i&&(n-=2*Math.PI);let o=n-i;if(d.continuous[e]||t){let r=i+o/2,n=Math.cos(r)*s,l=Math.sin(r)*s;a[2*p+0]=g+n*(t?-1:1),a[2*p+1]=m+l*(t?-1:1),u[p]=e,p++}else{let t=Math.max(1,Math.floor(r/4*Math.abs(o)/Math.PI));for(let r=0;r<=t;r++){let n=i+o*(r/t),l=Math.cos(n)*s,h=Math.sin(n)*s;a[2*p+0]=g+l,a[2*p+1]=m+h,u[p]=e,p++}}}else a[2*p+0]=g+f,a[2*p+1]=m+y,u[p]=e,o[e]=p,p++,a[2*p+0]=g,a[2*p+1]=m,u[p]=e,p++,a[2*p+0]=g+v,a[2*p+1]=m+b,u[p]=e,h[e]=p,p++}let c=Ve({windingRule:Se.POSITIVE,elementType:Oe.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[a],edgeCreateCallback:e=>{let t=e.Org.idx,i=u[t],r=u[(t+1)%u.length];e.idx=[i,r],e.Sym.idx=[r,i]},vertexIdCallback:e=>{let t=e.Lprev.idx;return[t?t[1]:0,e.idx?e.idx[0]:0]}});if(!c)throw console.log("Error"),new Error(`error generating bevel geometry for ${e}'th loop`);if(!c.vertexCount){let t=(e-1)/this._bevelSegments*Math.PI/2;v=(1-Math.sin(t))*this._bevel;break}for(let e=0;e<c.vertexIndices.length;e++){let[t,i]=c.vertexIndices[e];if(t===i)continue;let r=i;i<t&&(r+=n);for(let s=t;s<r;s++){let r=s%n,a=(s+1)%n;if(!d.continuous[r]||!d.continuous[a]){c.vertexIndices[e]=[t,r],c.vertexIndices.splice(e+1,0,[a,i]),c.vertices.splice(2*(e+1),0,c.vertices[2*e],c.vertices[2*e+1]);break}}}y.push({bevelI:e,angle:i,size:s,boundary:c,reverseMap:u,insetPoints:a})}let w=(e,t,i)=>{let r=0,s=e.boundary.vertexIndices.length;for(;r<s&&i(e.boundary.vertexIndices[t]);)t=(t+1)%s,r++;return r},S=b.length;for(let e=1;e<y.length;e++){let t=y[e-1],i=y[e],r=t.boundary.vertexIndices.length,s=i.boundary.vertexIndices.length;if(!r||!s)break;let o=d.concave.length,l=0,h=Lt(l,n);for(;!t.boundary.vertexIndices.filter(h).length||!i.boundary.vertexIndices.filter(h).length;)l++,h=Lt(l,n);let u=t.boundary.vertexIndices.findIndex(h),p=i.boundary.vertexIndices.findIndex(h);do{u=(u+1)%r}while(h(t.boundary.vertexIndices[u]));do{p=(p+1)%s}while(h(i.boundary.vertexIndices[p]));l=(l+1)%n;let c,g,m=l,f=0,v=this._buildBevelVert(d,t,(u-1+r)%r,void 0,f),x=this._buildBevelVert(d,i,(p-1+s)%s,void 0,f),S=!1;do{f=(l||o)/o,h=Lt(l,n);let e=w(t,u,h),m=w(i,p,h),y=S;if(S=!1,e&&!m){for(let i=0;i<e;i++)c=this._buildBevelVert(d,t,(u+i)%r,i/(e-1),f),b.push(v.topN,c.topP,x.topN),!1===a&&b.push(c.bottomP,v.bottomN,x.bottomN),v=c;S=!0}else if(!e&&m)for(let e=0;e<m;e++)g=this._buildBevelVert(d,i,(p+e)%s,e/(m-1),f),b.push(x.topN,v.topP,g.topP),!1===a&&b.push(v.bottomP,x.bottomN,g.bottomP),x=g;else if(e&&m)if(c=this._buildBevelVert(d,t,u,0,f),g=this._buildBevelVert(d,i,p,0,f),y?(b.push(v.topN,g.topP,x.topN),b.push(v.topN,c.topP,g.topP),!1===a&&(b.push(g.bottomP,v.bottomN,x.bottomN),b.push(g.bottomP,c.bottomP,v.bottomN))):(b.push(x.topN,v.topN,c.topP),b.push(x.topN,c.topP,g.topP),!1===a&&(b.push(c.bottomP,v.bottomN,x.bottomN),b.push(c.bottomP,x.bottomN,g.bottomP))),v=c,x=g,e===m)for(let n=1;n<e;n++)c=this._buildBevelVert(d,t,(u+n)%r,n/(e-1),f),g=this._buildBevelVert(d,i,(p+n)%s,n/(m-1),f),b.push(v.topN,c.topP,x.topN),b.push(x.topN,c.topP,g.topP),!1===a&&(b.push(c.bottomP,v.bottomN,x.bottomN),b.push(c.bottomP,x.bottomN,g.bottomP)),v=c,x=g;else if(e>m){let n=e/m,o=0;for(let l=1;l<e;l++)c=this._buildBevelVert(d,t,(u+l)%r,l/(e-1),f),b.push(v.topN,c.topP,x.topN),!1===a&&b.push(c.bottomP,v.bottomN,x.bottomN),v=c,l>(o+1)*n&&(o++,g=this._buildBevelVert(d,i,(p+o)%s,o/(m-1),f),b.push(x.topN,c.topP,g.topP),!1===a&&b.push(c.bottomP,x.bottomN,g.bottomP),x=g)}else{let n=m/e,o=0;for(let l=1;l<m;l++)g=this._buildBevelVert(d,i,(p+l)%s,l/(m-1),f),b.push(x.topN,c.topP,g.topP),!1===a&&b.push(c.bottomP,x.bottomN,g.bottomP),x=g,l>(o+1)*n&&(o++,c=this._buildBevelVert(d,t,(u+o)%r,o/(e-1),f),b.push(v.topN,c.topP,x.topN),!1===a&&b.push(c.bottomP,v.bottomN,x.bottomN),v=c)}u=(u+e)%r,p=(p+m)%s,l=(l+1)%o}while(l!==m)}if(!1===a&&this._depth>2*this._bevel&&this._buildWall(y,d,b),t){let e=[];for(let t=b.length-1;t>=S+2;t-=3){let i=b[t-2],r=b[t-1],s=b[t-0];e.push(s,r,i)}b.splice(S,b.length-S,...e)}if(t){let e=[];for(let t=y[y.length-1].boundary.vertices.length-1;t>=1;t-=2){let i=y[y.length-1].boundary.vertices[t-1],r=y[y.length-1].boundary.vertices[t-0];e.push(i,r)}x.push(e)}if(!t){let e,t=y[y.length-1];try{e=Ve({windingRule:y.length>1?Se.POSITIVE:Se.ODD,elementType:Oe.POLYGONS,vertexSize:2,strict:!0,contours:[t.insetPoints,...x]})}catch{e=Dt}if(!e)throw new Error("Error generating geometry for surface");0===u.length&&this._bevel<o&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let t=0;t<3*e.elementCount;t+=3){let i=this._buildSurfaceVert(e,e.elements[t+0],v),r=this._buildSurfaceVert(e,e.elements[t+1],v),s=this._buildSurfaceVert(e,e.elements[t+2],v);b.push(i.top,r.top,s.top),!1===a&&b.push(s.bottom,r.bottom,i.bottom)}}this.vertexCache={}}this._buffer.shrink();let w=new de(Uint32Array.from(b),1),S=new de(this._buffer.positions,3),M=new de(this._buffer.normals,3),O=new de(this._buffer.uvs,2);S.needsUpdate=!0,M.needsUpdate=!0,O.needsUpdate=!0,w.needsUpdate=!0,this.setAttribute("position",S),this.setAttribute("normal",M),this.setAttribute("uv",O),this.setIndex(w)}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let e=0,s=r.boundary.vertexCount;e<s;e++){let n=this._buildBevelVert(t,r,e),a=this._buildBevelVert(t,r,(e+1)%s);i.push(a.topP,n.topN,n.bottomN),i.push(a.topP,n.bottomN,a.bottomP)}}_buildSurfaceVert(e,t,i){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let s=e.vertices[2*t+0],n=e.vertices[2*t+1],a=(s-this._minX)/this._width,o=(n-this._minY)/this._height;this.forPathBevel&&(o=1);let l=this._buffer.get(this.forPathBevel?1:2),h=3*l,d=2*l,u={top:l+0,bottom:l+1};return this._buffer.positions[h+0]=s,this._buffer.positions[h+1]=n,this._buffer.positions[h+2]=this.forPathBevel?this._bevel:this._depth-i,this._buffer.normals[h+0]=0,this._buffer.normals[h+1]=0,this._buffer.normals[h+2]=1,this._buffer.uvs[d+0]=a,this._buffer.uvs[d+1]=o,!1===this.forPathBevel&&(this._buffer.positions[h+3]=s,this._buffer.positions[h+4]=n,this._buffer.positions[h+5]=i,this._buffer.normals[h+3]=0,this._buffer.normals[h+4]=0,this._buffer.normals[h+5]=-1,this._buffer.uvs[d+2]=a,this._buffer.uvs[d+3]=o),this.vertexCache[r]=u,u}_buildBevelVert(e,t,i,r=1,s){let n=`${t.bevelI}:${i}`;if(n in this.vertexCache&&0!==s&&1!==s&&(!s||s===this.vertexCache[n].pathBevelUCoord))return this.vertexCache[n];let a,o,l,h,[d,u]=t.boundary.vertexIndices[i];d!==u?(o=d,a=u,h=!1,l=e.continuous[o]&&e.continuous[a]):(a=d,o=(a-1+e.count)%e.count,h=e.concave[a]&&t.bevelI>0,l=e.continuous[a]||h);let p=Math.cos(t.angle),c=Math.sin(t.angle),g=2*i,m=2*a,f=2*o,y=t.boundary.vertices[g+0],v=t.boundary.vertices[g+1],b=(1-c)*this._bevel,x=(y-this._minX)/this._width,w=(v-this._minY)/this._height;this.forPathBevel&&(void 0!==s&&(x=s),w=1);let S=e.normals[m+0],M=e.normals[m+1],O=e.normals[f+0],P=e.normals[f+1];if(h){S+=(O-S)*(1-r),M+=(P-M)*(1-r);let e=Math.sqrt(S*S+M*M);S/=e,M/=e}let A=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),_=3*A,C=2*A,E={i:i,fi:a,topP:A+0,topN:A+0,bottomP:A+1,bottomN:A+1,pathBevelUCoord:s};return this._buffer.positions[_+0]=y,this._buffer.positions[_+1]=v,this._buffer.positions[_+2]=(this.forPathBevel?this._bevel:this._depth)-b,this._buffer.normals[_+0]=S*p,this._buffer.normals[_+1]=M*p,this._buffer.normals[_+2]=c,this._buffer.uvs[C+0]=x,this._buffer.uvs[C+1]=w,!1===this.forPathBevel&&(this._buffer.positions[_+3]=y,this._buffer.positions[_+4]=v,this._buffer.positions[_+5]=b,this._buffer.normals[_+3]=S*p,this._buffer.normals[_+4]=M*p,this._buffer.normals[_+5]=-c,this._buffer.uvs[C+2]=w,this._buffer.uvs[C+3]=x),l||(this.forPathBevel?(A+=1,_+=3,C+=2):(A+=2,_+=6,C+=4),E.topP=A+0,E.bottomP=A+1,this._buffer.positions[_+0]=y,this._buffer.positions[_+1]=v,this._buffer.positions[_+2]=(this.forPathBevel?this._bevel:this._depth)-b,this._buffer.normals[_+0]=O*p,this._buffer.normals[_+1]=P*p,this._buffer.normals[_+2]=c,this._buffer.uvs[C+0]=x,this._buffer.uvs[C+1]=w,!1===this.forPathBevel&&(this._buffer.positions[_+3]=y,this._buffer.positions[_+4]=v,this._buffer.positions[_+5]=b,this._buffer.normals[_+3]=O*p,this._buffer.normals[_+4]=P*p,this._buffer.normals[_+5]=-c,this._buffer.uvs[C+2]=w,this._buffer.uvs[C+3]=x)),this.vertexCache[n]=E,E}clone(){let e=new Ut(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=u(this.userData),e}},zt=class extends ce{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=Se.ODD,this.elementType=Oe.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:Se.ODD,elementType:Oe.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r,s,n,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(e=>e.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,h=!0;for(let e=0,t=a.length/2;e<t;e++){let t=2*e,i=a[t+0],r=a[t+1];if(void 0!==s&&i!==s&&(l=!1),void 0!==n&&r!==n&&(h=!1),s=i,n=r,!l&&!h)break}if(!l&&!h)try{r=Ve({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{r=Et}let d=r?.vertexCount??1,u=r?.elementCount??1;if(this._positionAttribute=new de(new Float32Array(3*d),3),this._normalAttribute=new de(new Float32Array(3*d),3),this._uvAttribute=new de(new Float32Array(2*d),2),this._indexAttribute=new de(new Uint32Array(3*u),1),r){let e=1/0,t=-1/0,i=1/0,s=-1/0;for(let n=0,a=d;n<a;n++){let a=2*n,o=r.vertices[a+0],l=r.vertices[a+1];o<e&&(e=o),o>t&&(t=o),l<i&&(i=l),l>s&&(s=l)}let n=t-e,a=s-i;for(let t=0,s=d;t<s;t++){let s=2*t,o=r.vertices[s+0],l=r.vertices[s+1],h=(o-e)/n,d=(l-i)/a;this._positionAttribute.setXYZ(t,o,l,0),this._normalAttribute.setXYZ(t,0,0,1),this._uvAttribute.setXY(t,h,d)}for(let e=0,t=u;e<t;e++){let t=3*e,i=r.elements[t+0],s=r.elements[t+1],n=r.elements[t+2];this._indexAttribute.setX(t+0,i),this._indexAttribute.setX(t+1,s),this._indexAttribute.setX(t+2,n)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,3*(r?.elementCount??1))}clone(){let e=new zt(this._shape,this._curveSegments);return e.userData=u(this.userData),e}},Bt=class extends Ut{constructor(e,t,i=0,r=12,s=3,n=Se.ODD){super(e,t,i,r,s,n),this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let e=0,s=r.boundary.vertexCount;e<s;e++){let n=this._buildBevelVert(t,r,e),a=this._buildBevelVert(t,r,(e+1)%s);i.push(a.topP,n.topN,n.bottomN),i.push(a.topP,n.bottomN,a.bottomP)}}clone(){let e=new Bt(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=u(this.userData),e}},Rt=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i,r=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Se.ODD},e.parameters),s=Math.abs(r.width),n=Math.abs(r.height??r.width),a=Math.abs(r.depth??0),o=e.shape??t?.shape,l=o?.roundness??r.roundness;void 0!==o&&(o instanceof Mt?(i=o,(i.width!==s||i.height!==n)&&i.applySize(s,n)):i=new Mt(s,n).fromJSON(o),void 0!==e.parameters?.roundness&&e.parameters?.roundness>0&&i.update());let h=i??new Mt(s,n);return{parameters:Object.assign(r,{width:s,height:n,depth:a,roundness:l}),shape:h}}static build(e){let t,{depth:i,extrudeBevelSize:r,extrudeBevelSegments:s,subdivisions:n,roundness:a,windingRule:o}=e.parameters;return e.shape.roundness=a,t=i<=0?new zt(e.shape,n,{windingRule:o}):new Bt(e.shape,i,r,n,s,o),Object.assign(t,{userData:{...e,type:"VectorGeometry"}})}};function Gt(){let e=new ce;return e.setAttribute("position",new de(new Float32Array([]),3)),e.setIndex(new de(new Uint16Array([]),1)),e}var Tt,Nt,kt,Ft,Vt,jt,Ht=Gt().attributes,qt=class extends ce{constructor(e,t){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,Ht),this.userData={parameters:e,type:"TextGeometry"};let i=t.getFont(e.font);i?.isLoaded?(this.font=i,this.update(e,t)):this.updateFont(e.font,t).then(()=>{this.update(e,t),t?.requestRender()})}async updateFont(e,t){let i=t.getFont(e);i&&(this.font=i,await i.loadingPromise)}update(e,t){let i=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:r,height:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:h}=e,d=m.getDisplayedValue(l),u=function(e,t,i,r){let s="string"==typeof e.width?Number(r.getVariable(e.width)):e.width,n=[""],a="";for(let r of i)a+=r," "===r||"\n"===r?(n[n.length-1]+=a,a="","\n"===r&&n.push("")):t.getTextWidth(n[n.length-1]+a,e)>s&&(n[n.length-1].length&&n.push(""),t.getTextWidth(n[n.length-1]+a,e)>s&&(1===a.length?(n[n.length-1]+=a,a=""):(n[n.length-1]+=a.slice(0,-1),a=a[a.length-1],n.push(""))));return n[n.length-1]+=a,n}(e,i,2===h?d.toUpperCase():3===h?d.toLowerCase():d,t),{shapes:p,charWidths:c,charCoords:g}=i.generateShapes(u,e,t),f=.5*("number"==typeof r?r:Number(t.getVariable(r))),y=.5*("number"==typeof s?s:Number(t.getVariable(s))),v=p.map(e=>(new Mt).fromShape(e,!0));this.vectorShapes=v;let b=v.map(e=>Rt.create({shape:e,parameters:{depth:n,extrudeBevelSegments:o,extrudeBevelSize:a,windingRule:n<=0?Se.NONZERO:Se.ODD,subdivisions:this.isLowResolution&&n>0?1:12}})),x=b.length?be(b):Gt();x.translate(-f,y,0),this.dispose(),this.wrappedText=u,this.charCoords=g,this.charWidths=c,this.deleteAttribute("extrudeNormal"),Object.entries(x.attributes).forEach(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(x.index),this.computeBoundingSphere()}clone(){let e=x(new ce,qt.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},t)}get text(){return this.userData.parameters.text??""}},Wt="webgl",Yt=!1;function Xt(e){Wt=e}function $t(){return Wt}function Zt(e){Tt=e}function Jt(e){Nt=e}function Kt(){if("webgpu"===Wt){if(void 0!==Tt)return Tt;Yt||(Yt=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered — import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(void 0===Nt)throw new Error('[spe] Classic (WebGL) materials are not available in this build — it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return Nt}function Qt(e,t){return Kt().createRootMaterial(e,t)}function ei(e,t,i){return Kt().createSharedMaterial(e,t,i)}function ti(e){return void 0===e.getLayersOfType&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function ii(e){kt=e}function ri(e){Ft=e}function si(e){Vt=e}function ni(){return Vt}function ai(e){jt=e}function oi(e,t){return void 0!==jt&&jt(e,t)}var li=[3,4,8,9];function hi(e){for(let t of li)e.enable(t)}var di,ui=5,pi=3,ci=32,gi=class extends te{constructor(e,t,i,r){super(e,t,i),this.isColorA=!0,this.a=r}setRGBA(e,t,i,r){super.setRGB(e,t,i),this.a=r}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,t="srgb"){let i;if("transparent"===e)return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let r,s=i[1],n=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a="rgba"===s?parseFloat(r[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a="hsla"===s?parseFloat(r[4]):1,super.setStyle(e,t)}}return super.setStyle(e,t)}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}},mi=class{constructor(e=1e4){this.timeout=e,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(...e){}remove(e){let t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev,t.next=null,t.prev=null,t.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 e=Date.now(),t=this.head.next;for(;t.time<e-this.timeout;){this.dispose(t.src,t.data),this.cache.delete(t.src);let e=t;t=t.next,t.prev=this.head,this.head.next=t,e.next=null,e.prev=null,e.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(e){return this.cache.get(e)?.data}load(e){let t=Date.now(),i=this.cache.get(e);return void 0===i?(i={data:this.create(e),src:e,time:t,next:null,prev:null},this.cache.set(e,i)):(i.time=t,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){null!==this.cleanupTimer&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((e,t)=>{this.dispose(t,e.data),e.next=null,e.prev=null,e.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}},fi=class extends mi{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}};function yi(){di&&di.disposeAll()}var vi=class{constructor(e,t){this.data=e,this.cache=t,this.refCount=0}deref(){this.refCount,this.refCount-=1,0===this.refCount&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},bi=class{constructor(){this.cache=new Map}remove(e){this.cache.delete(e.data)}load(e){let t=this.cache.get(e);return void 0===t&&(t=this.create(e),this.cache.set(e,t)),t.refCount+=1,t}},xi=class extends ye{constructor(e){super(e),this.type=E}parse(e){let t=function(e,t){switch(e){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(t||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(t||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(t||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(t||""))}},i=function(e,t,i){t=t||1024;let r=e.pos,s=-1,n=0,a="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));for(;0>(s=o.indexOf("\n"))&&n<t&&r<e.byteLength;)a+=o,n+=o.length,r+=128,o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<s&&(!1!==i&&(e.pos+=n+s+1),a+o.slice(0,s))},r=function(e,t,i,r){let s=e[t+3],n=Math.pow(2,s-128)/255;i[r+0]=e[t+0]*n,i[r+1]=e[t+1]*n,i[r+2]=e[t+2]*n,i[r+3]=1},s=function(e,t,i,r){let s=e[t+3],n=Math.pow(2,s-128)/255;i[r+0]=le.toHalfFloat(Math.min(e[t+0]*n,65504)),i[r+1]=le.toHalfFloat(Math.min(e[t+1]*n,65504)),i[r+2]=le.toHalfFloat(Math.min(e[t+2]*n,65504)),i[r+3]=le.toHalfFloat(1)},n=new Uint8Array(e);n.pos=0;let a,o,l,h=function(e){let r,s,n=/^#\?(\S+)/,a=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,l=/^\s*FORMAT=(\S+)\s*$/,h=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,d={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((e.pos>=e.byteLength||!(r=i(e)))&&t(1,"no header found"),(s=r.match(n))||t(3,"bad initial token"),d.valid|=1,d.programtype=s[1],d.string+=r+"\n";r=i(e),!1!==r;)if(d.string+=r+"\n","#"!==r.charAt(0)){if((s=r.match(a))&&(d.gamma=parseFloat(s[1])),(s=r.match(o))&&(d.exposure=parseFloat(s[1])),(s=r.match(l))&&(d.valid|=2,d.format=s[1]),(s=r.match(h))&&(d.valid|=4,d.height=parseInt(s[1],10),d.width=parseInt(s[2],10)),2&d.valid&&4&d.valid)break}else d.comments+=r+"\n";return 2&d.valid||t(3,"missing format specifier"),4&d.valid||t(3,"missing image size specifier"),d}(n),d=h.width,u=h.height,p=function(e,i,r){let s=i;if(s<8||s>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);s!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");let n=new Uint8Array(4*i*r);n.length||t(4,"unable to allocate buffer space");let a=0,o=0,l=4*s,h=new Uint8Array(4),d=new Uint8Array(l),u=r;for(;u>0&&o<e.byteLength;){o+4>e.byteLength&&t(1),h[0]=e[o++],h[1]=e[o++],h[2]=e[o++],h[3]=e[o++],(2!=h[0]||2!=h[1]||(h[2]<<8|h[3])!=s)&&t(3,"bad rgbe scanline format");let i,r=0;for(;r<l&&o<e.byteLength;){i=e[o++];let s=i>128;if(s&&(i-=128),(0===i||r+i>l)&&t(3,"bad scanline data"),s){let t=e[o++];for(let e=0;e<i;e++)d[r++]=t}else d.set(e.subarray(o,o+i),r),r+=i,o+=i}let p=s;for(let e=0;e<p;e++){let t=0;n[a]=d[e+t],t+=s,n[a+1]=d[e+t],t+=s,n[a+2]=d[e+t],t+=s,n[a+3]=d[e+t],a+=4}u--}return n}(n.subarray(n.pos),d,u);switch(this.type){case C:l=p.length/4;let e=new Float32Array(4*l);for(let t=0;t<l;t++)r(p,4*t,e,4*t);a=e,o=C;break;case E:l=p.length/4;let t=new Uint16Array(4*l);for(let e=0;e<l;e++)s(p,4*e,t,4*e);a=t,o=E;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:d,height:u,data:a,header:h.string,gamma:h.gamma,exposure:h.exposure,type:o,colorSpace:j,minFilter:me,magFilter:me,generateMipmaps:!1,flipY:!0}}setDataType(e){return this.type=e,this}};function wi(e){return e.length>2&&35===e[0]&&63===e[1]}function Si(e){return"object"==typeof e&&null!==e&&!0===e.isSplineHdr}function Mi(e){let t=new ge(e.data,e.width,e.height,V,E);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var Oi=0,Pi=class extends vi{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.instanceId=++Oi,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this._cacheSrgb={1e3:{},1001:{},1002:{}},this.isVideo="video"===e.type,this.isBuffer=!0===e.isWebGLRenderTarget,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 t=()=>{this.loaded=!0,this.forEachTexture(e=>{e.image=this.img,e.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,"string"!=typeof e){let t,i=new FileReader;i.readAsDataURL(new Blob([e],{type:"video/mp4"})),await new Promise(e=>{i.onloadend=i=>{t=i.target?.result,e(null)}}),this.img.src=t}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else if(e instanceof Uint8Array?wi(e):"string"==typeof e&&/\.hdr($|[?#])/i.test(e)){let i=e instanceof Uint8Array?e:null;if(null===i)try{i=new Uint8Array(await(await fetch(e)).arrayBuffer())}catch{i=null}let r=null!==i&&wi(i)?function(e){try{let t=(new xi).parse(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));if(!t||!t.width||!t.height)return null;let{width:i,height:r}=t,s=t.data,n=new Uint16Array(s.length),a=4*i,o=e=>le.toHalfFloat(Math.pow(Math.max(le.fromHalfFloat(e),0),1/2.2)),l=new Map,h=e=>{let t=l.get(e);return void 0===t&&(t=o(e),l.set(e,t)),t};for(let e=0;e<r;e++){let t=e*a,i=(r-1-e)*a;for(let e=0;e<a;e+=4)n[i+e]=h(s[t+e]),n[i+e+1]=h(s[t+e+1]),n[i+e+2]=h(s[t+e+2]),n[i+e+3]=s[t+e+3]}return{isSplineHdr:!0,data:n,width:i,height:r}}catch{return null}}(i):null;null!==r&&(this.isHdr=!0,this.img=r,t())}else this.img=new Image,this.img.src=function(e){return"string"==typeof e?e:(di||(di=new fi),di.load(e))}(e),this.img.onload=t,await new Promise(e=>{this.img.onload=()=>{t(),e(null)}})}get hardwareSrgbDecode(){return!this.isBuffer&&!this.isHdr}getTexture(e,t=1008,i=1006,r=!1){r&&!this.hardwareSrgbDecode&&(r=!1);let s=r?this._cacheSrgb:this._cache,n=s[e]?.[t]?.[i];if(n)return n;{let n;return this.isBuffer?n=this.img.texture:this.isVideo?n=new ve(this.img,void 0,e,e):this.isHdr?(n=Mi(this.img),n.wrapS=e,n.wrapT=e,n.magFilter=i,n.minFilter=t):n=new k(this.img,void 0,e,e,i,t),this.isBuffer||(n.anisotropy=8,n.generateMipmaps=1008===t),r&&(n.colorSpace=N),this.loaded&&(n.needsUpdate=!0),void 0===s[e]&&(s[e]={}),void 0===s[e][t]&&(s[e][t]={}),s[e][t][i]=n,n}}forEachTexture(e){for(let t of[this._cache,this._cacheSrgb])for(let i of Object.values(t))for(let t of Object.values(i))for(let i of Object.values(t))i&&e(i)}setNeedsUpdate(e){this.isBuffer||this.forEachTexture(t=>{t.needsUpdate=e})}disposeTextures(){this.forEachTexture(e=>e.dispose()),this._cache={1e3:{},1001:{},1002:{}},this._cacheSrgb={1e3:{},1001:{},1002:{}}}dispose(){super.dispose(),this.disposeTextures()}},Ai=class extends Pi{},_i=2*Math.PI;function Ci({x:e,y:t},i,r,s,n){return{x:e*i+s,y:t*r+n}}function Ei(e,t){let i=1.5707963267948966===t?.551915024494:-1.5707963267948966===t?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(e),s=Math.sin(e),n=Math.cos(e+t),a=Math.sin(e+t);return[{x:r-s*i,y:s+r*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function Ii(e,t,i,r){let s=e*r-t*i<0?-1:1,n=Math.min(1,Math.max(-1,e*i+t*r));return s*Math.acos(n)}var Di=2*Math.PI,Li=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return i.angle=I.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof Mt?e.shape:new Mt,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let t,{width:i,height:r,spikes:s,angle:n,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=e.parameters,d=e.shape,u=function(e,t,i,r,s,n){if(r>=Di)return s>30||s%4==0?(function(e,t,i,r=0,s=0,n=0){let a=.5522847498,o=t*a,l=i*a;e.addPoint(Bi(s-t,n,s-t,n-l,s-t,n+l)),e.addPoint(Bi(s,n+i,s-o,n+i,s+o,n+i)),e.addPoint(Bi(s+t,n,s+t,n+l,s+t,n-l)),e.addPoint(Bi(s,n-i,s+o,n-i,s-o,n-i)),r>0&&Gi(e,t,i,r)}(e,t,i,n),Math.round(s/4)):Ui(e,r,s,t,i,n);let a={x:0,y:i},o=(r=Math.max(r,.001))+.5*Math.PI,l={x:Math.cos(o)*t,y:Math.sin(o)*i},h=function({px:e,py:t,cx:i,cy:r,rx:s,ry:n,largeArcFlag:a,sweepFlag:o}){let l=[];if(0===s||0===n)return[];let h=(e-i)/2,d=(t-r)/2;if(0===h&&0===d)return[];s=Math.abs(s),n=Math.abs(n);let u=Math.pow(h,2)/Math.pow(s,2)+Math.pow(d,2)/Math.pow(n,2);u>1&&(s*=Math.sqrt(u),n*=Math.sqrt(u));let p=function(e,t,i,r,s,n,a,o,l,h){let d=Math.pow(s,2),u=Math.pow(n,2),p=Math.pow(a,2),c=Math.pow(o,2),g=d*u-d*c-u*p;g<0&&(g=0),g/=d*c+u*p,g=Math.sqrt(g)*(l===h?-1:1);let m=g*s/n*o,f=g*-n/s*a,y=m+(e+i)/2,v=f+(t+r)/2,b=(a-m)/s,x=(o-f)/n,w=(-a-m)/s,S=(-o-f)/n,M=Ii(1,0,b,x),O=Ii(b,x,w,S);return!h&&O>0&&(O-=_i),h&&O<0&&(O+=_i),{centerx:y,centery:v,ang1:M,ang2:O}}(e,t,i,r,s,n,h,d,a,o),{ang1:c,ang2:g}=p,{centerx:m,centery:f}=p,y=Math.abs(g)/(_i/4);Math.abs(1-y)<1e-7&&(y=1);let v=Math.max(Math.ceil(y),1);g/=v;for(let e=0;e<v;e++)l.push(Ei(c,g)),c+=g;return l.map(e=>{let{x:t,y:i}=Ci(e[0],s,n,m,f),{x:r,y:a}=Ci(e[1],s,n,m,f),{x:o,y:l}=Ci(e[2],s,n,m,f);return{x1:t,y1:i,x2:r,y2:a,x:o,y:l}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:t,ry:i,largeArcFlag:r>Math.PI,sweepFlag:!0});return s>30||s%h.length===0?function(e,t,i,r,s,n,a,o){let l=Math.round(s/r.length);e.addPoint(zi(t,i));for(let t=0,i=r.length;t<i;t++){let i=r[t],s=e.points[t],n=zi(i.x,i.y);s.controls[1].position.set(i.x1,i.y1),n.controls[0].position.set(i.x2,i.y2),e.addPoint(n)}return o>0?Ri(e,n,a,o):e.addPoint(zi(0,0)),l}(e,a.x,a.y,h,s,t,i,n):Ui(e,r,s,t,i,n)}(d,.5*i,.5*r,n*Math.PI/180,s,a);return d.isClosed=!0,d.update(),0===n?(t=new ce,t.setAttribute("position",new ue([],3))):t=Rt.create({shape:d,parameters:{subdivisions:u,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}};function Ui(e,t,i,r,s,n){let a=-t/i;for(let t=0;t<=i;t++){let i=a*t,n=Math.sin(i)*r,o=Math.cos(i)*s;e.addPoint(zi(n,o))}return t<Di?n>0?Ri(e,r,s,n):e.addPoint(zi(0,0)):(e.removePoint(e.points[e.points.length-1]),n>0&&Gi(e,r,s,n)),1}function zi(e,t){return new We(I.generateUUID(),new D(e,t))}function Bi(e,t,i,r,s,n){let a=zi(e,t);return a.controls[0].position.set(i,r),a.controls[1].position.set(s,n),a}function Ri(e,t,i,r){Ti(e,t,i,r).forEach(t=>e.addPoint(t))}function Gi(e,t,i,r){let s=Ti(e,t,i,r),n=new Mt;s.forEach(e=>n.addPoint(e)),n.isClosed=!0,e.shapeHoles.push(n)}function Ti(e,t,i,r){let s=r*t/100,n=s*(Math.abs(i)/Math.abs(t)),a=new D(s/t,n/i),o=e.points.map(e=>{let t=e.clone();return t.uuid=I.generateUUID(),t}).reverse();return o.forEach(e=>{e.position.multiply(a);let t=e.controls[0].position.clone().multiply(a),i=e.controls[1].position.clone().multiply(a);e.controls[0].position.copy(i),e.controls[1].position.copy(t)}),o}var Ni,ki,Fi=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:e.shape&&e.shape instanceof Mt?e.shape:new Mt,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,spikes:r,cornerRadius:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o}=e.parameters,l=e.shape,h=.5*t,d=.5*i,u=2*Math.PI/r;for(let e=0;e<r;e++){let t=u*e,i=0+Math.sin(t)*h,r=0+Math.cos(t)*d;l.addPoint(l.createPoint(i,r))}l.isClosed=!0;for(let e=0,t=l.points.length;e<t;e++)l.points[e].roundness=s;l.roundness=s,l.update();let p=Rt.create({shape:l,parameters:{roundness:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o}});return Object.assign(p,{userData:{...e,type:"PolygonGeometry"}})}},Vi=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters),r=Object.assign(t?.ui??{enabledIndieCorners:!1},e.ui);return{shape:e.shape&&e.shape instanceof Mt?e.shape:new Mt,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:r}}static build(e){let t=e.shape,{width:i,height:r,cornerRadius:s,cornerType:n,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}=e.parameters,h={x:.5*i,y:.5*r},d={x:-h.x,y:-h.y},u={x:h.x,y:h.y};function p(e,t,s){return t>i&&s>r?Math.min(e*i/t,e*r/s):t>i?e*i/t:s>r?e*r/s:e}let c=[];c[0]=0===s[0]?0:p(s[0],s[0]+s[3],s[0]+s[1]),c[1]=0===s[1]?0:p(s[1],s[1]+s[2],s[1]+s[0]),c[2]=0===s[2]?0:p(s[2],s[2]+s[1],s[2]+s[3]),c[3]=0===s[3]?0:p(s[3],s[3]+s[0],s[3]+s[2]);let g=d.x,m=u.x,f=u.y,y=d.y;t.addPoint(t.createPoint(g,f)),t.addPoint(t.createPoint(m,f)),t.addPoint(t.createPoint(m,y)),t.addPoint(t.createPoint(g,y)),t.isClosed=!0;let v=!0;for(let e=0,i=t.points.length;e<i;e++)t.points[e].roundness=c[e],e>0&&c[e]!==c[e-1]&&(v=!1);v&&(t.roundness=c[0]),t.useCubicForRoundedCorners=1!==n,t.update();let b=Rt.create({shape:t,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(b,{userData:{...e,type:"RectangleGeometry"}})}},ji=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return{shape:e.shape&&e.shape instanceof Mt?e.shape:new Mt,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,innerRadiusPercent:r,spikes:s,cornerRadius:n,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=e.parameters,d=e.shape,u=.5*t,p=.5*i,c=a*Math.PI/360/s,g=Math.PI/2*3*-1,m=u*r/100,f=p*r/100;if(3===s&&50===r){c=2*Math.PI/s;for(let e=0;e<s;e++){let t=c*e,i=0+Math.sin(t)*u,r=0+Math.cos(t)*p;d.addPoint(d.createPoint(i,r))}}else for(let e=0;e<s;e++){let e=0+Math.cos(g)*u,t=0+Math.sin(g)*p;d.addPoint(d.createPoint(e,t)),g+=c,e=0+Math.cos(g)*m,t=0+Math.sin(g)*f,d.addPoint(d.createPoint(e,t)),g+=c}d.isClosed=!0;for(let e=0,t=d.points.length;e<t;e++)d.points[e].roundness=n;d.roundness=n,d.update();let y=Rt.create({shape:d,parameters:{roundness:n,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}});return Object.assign(y,{userData:{...e,type:"StarGeometry"}})}},Hi=new Promise(e=>{Ni=e}),qi=!1;function Wi(e){if(!qi)return ki||(ki=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.34/build",i=import("./process.js"),[r,s]=await Promise.all([i,fetch(`${t}/process.wasm`).then(e=>e.arrayBuffer())]),n=r.default,a=await n({wasmBinary:s});Ni(a),qi=!0}())}var Yi=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=e.parameters?.radiusTop,r=e.parameters?.radiusBottom,s=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);s.thetaLength=I.clamp(s.thetaLength,0,360),s.hollow=I.clamp(s.hollow??0,0,1);let n=s.width/2,a=s.radiusTop??n,o=s.radiusBottom??n;if(a===o?(a=n,o=n):a>o?(a=n,o=o*n/a):(a=a*n/o,o=n),s.shapeBlendNode){a=i??n,o=r??n;let e=2*Math.max(a,o);s.width=e,s.depth=e}return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(s.height??s.width),depth:Math.abs(s.depth??s.width),radiusTop:a,radiusBottom:o})}}static build(e){let t,{width:i,depth:r,height:s,radialSegments:n,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,radiusTop:d,radiusBottom:u,cornerRadius:p,cornerSegments:c,hollow:g}=e.parameters;0===h?(t=new ce,t.setAttribute("position",new ue([],3))):t=p||g?new $i(d,u,s,n,a,o,l,h*Math.PI/180,p,p,c,g):new B(d,u,s,n,a,o,l,h*Math.PI/180);let m=r/i;return 1!==m&&t.scale(1,1,m),Object.assign(t,{userData:{...e,type:"CylinderGeometry"}})}};function Xi(e){return new D(e.y,-e.x)}var $i=class extends ce{constructor(e,t,i,r,s,n,a,o,l,h,d,u,p=!1){super(),this.type="RoundedCylinderBufferGeometry",e=void 0!==e?e:1,t=void 0!==t?t:1,i=i||1,r=Math.floor(r)||8,s=Math.floor(s)||1,n=void 0!==n&&n,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,n&&(l=0,h=0);let c=i/2;p&&0==e&&(e=l),p&&0==t&&(t=h);let g=new D(e,c),m=new D(t,-c),f=null,y=null,v=null,b=null,x=g.clone().sub(m),w=0,S=0,M=0;u>0&&(w=Math.min(e,t)*(1-u),S=e-w,M=t-w);let O=g.clone();O.x-=w;let P=Math.PI-x.angle(),A=x.angle(),_=Math.tan(A/2),C=Math.tan(P/2),E=_+C,I=u?E:C,L=u?E:_;if(l=Math.min(l,(e-S)/I,x.length()/E),h=Math.min(h,(t-M)/L,x.length()/E),l>0){let e=l/_;f=g.clone().sub(new D(e,l)),u&&(v=f.clone(),v.x-=w-E*l),g.sub(x.clone().setLength(e))}if(h>0){let e=h/C;y=m.clone().sub(new D(e,-h)),m.add(x.clone().setLength(e)),u&&(b=y.clone(),b.x-=w-E*h,O.sub(x.clone().setLength(e)))}x=g.clone().sub(m);let U=x.length()<.5,z=[],B=[],R=[],G=[],T=[],N=[],k=(e,t,r,s,n)=>{for(let a=0;a<d+1;a++){let o=a/d,l=s<0?o:1-o;n&&(l-=1),l*=e;let h=Math.sin(l),u=Math.cos(l)*s,p=u*t+r.y;z.push(h*t+r.x),B.push(p),R.push(h),G.push(u),T.push(.5+p/i),N.push(!1)}},F=(e,t,i)=>{let r=[e,t];i<0&&r.reverse();for(let e of r)z.push(e),B.push(c*i),R.push(0),G.push(i),T.push(.5),N.push(!0)};if(b&&y?(k(P,h,b,-1,!0),k(A,h,y,-1,!1)):y?(F(y.x,0,-1),k(A,h,y,-1,!1)):n||F(t,M,-1),!U){let e=Xi(x).normalize();for(let t=0;t<=s;t++){let r=t/s,n=x.y*r+m.y;z.push(x.x*r+m.x),B.push(n),R.push(e.x),G.push(e.y),T.push(.5+n/i),N.push(!1)}}if(v&&f?(k(P,l,f,1,!1),k(A,l,v,1,!0)):f?(k(P,l,f,1,!1),F(f.x,0,1)):n||F(e,S,1),u&&!U){let e=Xi(x).multiplyScalar(-1).normalize();for(let t=0;t<=s;t++){let r=t/s,n=x.y*-r+O.y;z.push(x.x*-r+O.x),B.push(n),R.push(e.x),G.push(e.y),T.push(.5+n/i),N.push(!1)}}let V=z.length,j=V+(u&&!n?1:0),H=(e,t)=>e*V+(t===V?0:t),q=o<2*Math.PI,W=(r+1)*V+(q?2*(1+j):0),Y=new Float32Array(3*W),X=new Float32Array(3*W),$=new Float32Array(2*W),Z=W-1>65535?new Uint32Array(r*Math.max(0,j-1)*6+(q?2*(j+1)*3:0)):new Uint16Array(r*Math.max(0,j-1)*6+(q?2*(j+1)*3:0)),J=0,K=0;for(let e=0;e<=r;e++){let t=e/r,i=t*o+a,s=Math.sin(i),n=Math.cos(i);for(let e=0;e<V;e++){let i=3*K,r=2*K,a=z[e],o=R[e];Y[i]=a*s,Y[i+1]=B[e],Y[i+2]=a*n,X[i]=o*s,X[i+1]=G[e],X[i+2]=o*n,N[e]?($[r]=.5,$[r+1]=.5):($[r]=t,$[r+1]=T[e]),K++}}for(let e=0;e<r;e++)for(let t=0;t<j-1;t++){if(n&&u&&t==s)continue;let i=H(e,t),r=H(e+1,t),a=H(e+1,t+1),o=H(e,t+1),l=Y[3*a+0],h=Y[3*a+2];Z[J++]=i,Z[J++]=r,Z[J++]=o,(0!=l||0!=h)&&(Z[J++]=r,Z[J++]=a,Z[J++]=o)}function Q(i,r,s){let n=Math.sin(s),a=Math.cos(s),o=-a,l=n,h=i<0?(e,t,i)=>{Z[J++]=e,Z[J++]=t,Z[J++]=i}:(e,t,i)=>{Z[J++]=e,Z[J++]=i,Z[J++]=t},d=(e+t+S+M)/4,u=3*K,p=2*K;Y[u]=d*n,Y[u+1]=0,Y[u+2]=d*a,X[u]=o,X[u+1]=0,X[u+2]=l,$[p]=.5,$[p+1]=.5;let c=K++;for(let e=0;e<j;e++){let t=3*(r+(e===V?0:e));u=3*K,p=2*K,Y[u]=Y[t],Y[u+1]=Y[t+1],Y[u+2]=Y[t+2],X[u]=o,X[u+1]=0,X[u+2]=l;let i=t/3*2|0;$[p]=$[i],$[p+1]=$[i+1],K++}for(let e=c+1;e<K-1;e++)h(c,e,e+1);h(c,K-1,c+1)}q&&(Q(-1,0,a),Q(1,r*V,a+o)),this.setIndex(new de(Z.slice(0,J),1)),this.setAttribute("position",new de(Y,3)),this.setAttribute("normal",new de(X,3)),this.setAttribute("uv",new de($,2))}},Zi=Math.PI/2,Ji=class extends ce{constructor(e=1,t=1,i=1,r=1,s=1,n=1,a=0,o=4){super(),this.type="BoxGeometry",r=Math.floor(r),s=Math.floor(s),n=Math.floor(n),o=Math.floor(o);let l=(a=Math.min(a,e/2,t/2,i/2))>0,h=o+1,d=2*((n+1)*(s+1)+(r+1)*(n+1)+(r+1)*(s+1))+(l?4*h*(n+1+(r+1)+(s+1))+h*(h+1)/2*8:0),u=2*(n*s+r*n+r*s)+(l?4*o*(n+r+s):0),p=l?8*o*o:0,c=new Float32Array(3*d),g=new Float32Array(3*d),m=new Float32Array(2*d),f=d-1>65535?new Uint32Array(6*u+3*p):new Uint16Array(6*u+3*p),y=0,v=0,b=new Float64Array(h),x=new Float64Array(h),w=new Float64Array(h),S=new Float64Array(h);for(let e=0;e<h;e++){let t=e/o*Zi;b[e]=Math.sin(t)*a,x[e]=(1-Math.cos(t))*a,w[e]=Math.sin(t),S[e]=Math.cos(t)}let M=h*(h+1)/2,O=new Float64Array(3*M),P=new Float64Array(3*M);{let r=new z(e/2,t/2,i/2);r.subScalar(a);let s=0;for(let e=0;e<=o;e++){let t=Zi*(1-e/o),i=Math.cos(t),n=Math.sin(t),l=0;for(let t=0;t<=e;t++){let t=i*Math.cos(l),o=n,h=i*Math.sin(l);O[3*s]=t,O[3*s+1]=o,O[3*s+2]=h,P[3*s]=r.x+t*a,P[3*s+1]=r.y+o*a,P[3*s+2]=r.z+h*a,s++,l+=Zi/e}}}function A(e,t,i,r,s,n,o,l,h,d){let u=(n-2*a)/h,p=(o-2*a)/d,b=n/2-a,x=o/2-a,w=l/2,S=h+1,M=d+1,O=0,P=new z;for(let n=0;n<M;n++){let a=n*p-x;for(let o=0;o<S;o++){let p=o*u-b,f=3*(y+O),v=2*(y+O);P[e]=p*r,P[t]=a*s,P[i]=w,c[f]=P.x,c[f+1]=P.y,c[f+2]=P.z,P[e]=0,P[t]=0,P[i]=l>0?1:-1,g[f]=P.x,g[f+1]=P.y,g[f+2]=P.z,m[v]=o/h,m[v+1]=1-n/d,O+=1}}for(let e=0;e<d;e++)for(let t=0;t<h;t++){let i=y+t+S*e,r=y+t+S*(e+1),s=y+(t+1)+S*(e+1),n=y+(t+1)+S*e;f[v++]=i,f[v++]=r,f[v++]=n,f[v++]=r,f[v++]=s,f[v++]=n}y+=O}function _(e,t,i,r,s,n,l,h,d,u){let p=(l-2*a)/u,M=l/2-a,O=h/2-a,P=d/2,A=u+1,_=0,C=new z,E=new z;for(let a=0;a<o+1;a++){C[t]=(O+b[a])*s,C[i]=(P-x[a])*n,E[e]=0,E[t]=w[a]*Math.sign(C[t]),E[i]=S[a]*Math.sign(C[i]);for(let t=0;t<A;t++){let i=t*p-M;C[e]=i*r;let s=3*(y+_),n=2*(y+_);c[s]=C.x,c[s+1]=C.y,c[s+2]=C.z,g[s]=E.x,g[s+1]=E.y,g[s+2]=E.z,m[n]=t/u,m[n+1]=0,_+=1}}for(let e=0;e<o;e++)for(let t=0;t<u;t++){let i=y+t+A*e,r=y+t+A*(e+1),s=y+(t+1)+A*(e+1),n=y+(t+1)+A*e;f[v++]=i,f[v++]=r,f[v++]=n,f[v++]=r,f[v++]=s,f[v++]=n}y+=_}function C(e,t,i){let r=e*t*i>0?(e,t,i)=>{f[v++]=e,f[v++]=t,f[v++]=i}:(e,t,i)=>{f[v++]=e,f[v++]=i,f[v++]=t},s=y;for(let r=0;r<M;r++){let s=3*r,n=3*y,a=2*y;c[n]=e*P[s],c[n+1]=t*P[s+1],c[n+2]=i*P[s+2],g[n]=e*O[s],g[n+1]=t*O[s+1],g[n+2]=i*O[s+2],m[a]=0,m[a+1]=0,y++}for(let e=0;e<o;e++){let t=s+e*(e+1)/2,i=s+(e+1)*(e+2)/2;r(t,i+1,i);for(let s=1;s<=e;s++)r(t+s-1,t+s,i+s),r(t+s,i+s+1,i+s)}}A("z","y","x",-1,-1,i,t,e,n,s),A("z","y","x",1,-1,i,t,-e,n,s),A("x","z","y",1,1,e,i,t,r,n),A("x","z","y",1,-1,e,i,-t,r,n),A("x","y","z",1,-1,e,t,i,r,s),A("x","y","z",-1,-1,e,t,-i,r,s),a>0&&(_("z","y","x",-1,-1,1,i,t,e,n),_("z","y","x",1,-1,-1,i,t,e,n),_("z","y","x",-1,1,-1,i,t,e,n),_("z","y","x",1,1,1,i,t,e,n),_("x","y","z",-1,-1,-1,e,t,i,r),_("x","y","z",1,-1,1,e,t,i,r),_("x","y","z",-1,1,1,e,t,i,r),_("x","y","z",1,1,-1,e,t,i,r),_("y","x","z",-1,-1,1,t,e,i,s),_("y","x","z",1,-1,-1,t,e,i,s),_("y","x","z",1,1,1,t,e,i,s),_("y","x","z",-1,1,-1,t,e,i,s),C(1,1,1),C(-1,1,1),C(1,-1,1),C(-1,-1,1),C(1,1,-1),C(-1,1,-1),C(1,-1,-1),C(-1,-1,-1)),this.setIndex(new de(f,1)),this.setAttribute("position",new de(c,3)),this.setAttribute("normal",new de(g,3)),this.setAttribute("uv",new de(m,2))}},Ki=class extends ce{constructor(e=[],t=[],i="",r=1,s=.2,n=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,h=0;return function(){0==(s=Math.min(.99999,s))&&(n=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],u=new z,p=u.clone(),c=new ne,g=s*r,m=r-g,f=n+1,y=new z,v=(e,t)=>y.subVectors(e,t).normalize(),b=(e,t)=>Array(e).fill(void 0).map(t),x=b(e.length/3,(t,i)=>(new z).fromArray(e,3*i).setLength(r)),w=[],S=1e6;for(let e=0;e<x.length;e++){let i,r,s,n=x[e],a=[],o=1e10,l=-1;for(;-1!=(l=t.indexOf(e,l+1));){let e=l-l%3;i=t[e+(l+1)%3],r=t[e+(l+2)%3],s=n.distanceToSquared(x[i]),o=Math.min(o,s),a.push([i,r,s])}o+=1e-6;let h=[],d=0,u=a.length;for(let t=0;t<u;t++){[i,r,s]=a[d];let t=1==w[i]?.includes(e);s<=o&&h.push(i+ +t*S),d=a.findIndex(e=>e[0]==r)}w.push(h)}let M=[];{let e,t,i=0,r=0,s=3==d;for(let a=0;a<=n;a++){e=a*(a+1)/2,t=(a+1)*(a+2)/2;for(let o=0;o<n-a;o++)[i,r]=[e+o+a+2,t+o+a+3],M.push(e,t,...s?[r,e]:[i,t],r,i),[e,t]=[i,r];M.push(e,t,e+n+2)}}let O=0;for(let e=0;e<w.length;e++)for(let t=0;t<d;t++)w[e][t]<S&&O++;let P=x.length*d*M.length*3+O*f*6*3+2*O*3*3;a=new Float64Array(P),o=new Float64Array(P),l=new Float64Array(P/3*2);let A=(e,t,i)=>{let r=h/3*2;l[r]=Math.atan2(i,-e)/2/Math.PI+.5,l[r+1]=1-(Math.atan2(-t,Math.sqrt(e*e+i*i))/Math.PI+.5)},_=e=>{a[h]=e.x,a[h+1]=e.y,a[h+2]=e.z,o[h]=y.x,o[h+1]=y.y,o[h+2]=y.z,A(e.x,e.y,e.z),h+=3},C=e=>{a[h]=e[0].x,a[h+1]=e[0].y,a[h+2]=e[0].z,o[h]=e[1].x,o[h+1]=e[1].y,o[h+2]=e[1].z,A(e[0].x,e[0].y,e[0].z),h+=3},E=(n+2)*(n+3)/2,I=new Float64Array(3*E),D=new Float64Array(3*E),L=new Float64Array(2*E),U=b(2*d*f,()=>new z),B=b(n*Math.max(0,n-1)/2,()=>new z),R=u.clone(),G=u.clone(),T=u.clone(),N=u.clone(),k=u.clone(),F=[],V=b(x.length,()=>b(d,()=>u.clone()));for(let e=0;e<x.length;e++){u.copy(x[e]).normalize(),R.copy(u).multiplyScalar(m);let t=w[e];for(let i=0;i<t.length;i++){let r=t[i],s=t[(i+1)%d];c.setFromPointsAndIndices(x,e,r%S,s%S),c.b.sub(c.a).setLength(1e10).add(c.a),c.c.sub(c.a).setLength(1e10).add(c.a),c.closestPointToPoint(R,V[e][i])}let i=0,r=[],s=[],b=new z;0==n&&[...V[e]].reduce((e,t)=>e.add(t),b).multiplyScalar(1/d);for(let t=0;t<d;t++){let a=[],o=(t-1+d)%d,l=V[e][o],h=V[e][t];u.copy(l).sub(R),p.copy(h).sub(R);let c=R.angleTo(u),x=u.angleTo(p),w=Math.cos(c)*g;0==n?G.copy(b):G.copy(R).setLength(m+w),r.push(w);let S=[G,l,h];for(let e=0;e<2;e++){let t=S[e],r=S[e+1];N.subVectors(t,R),k.subVectors(r,R),T.crossVectors(N,k).normalize();for(let r=0;r<f;r++){let s=[c,x][e]*r/f;u.copy(N).applyAxisAngle(T,s).add(R),U[i++].copy(u),e&&(v(u,R),a.push([0==r?t:u.clone(),y.clone()]))}e&&(v(r,R),a.push([r,y.clone()]))}s.push(a)}F.push(s);let O=2*f,P=2;for(let e=0;e<d;e++){let t=O*e,i=O*((e+1)%d),s=0,n=[U[t]];for(let a=1;a<f;a++){let o=U[t+a],l=U[i+a];n.push(o);for(let t=1,i=a-P+1;t<=i;t++)u.lerpVectors(o,l,t/(i+1)),u.sub(R).setLength(r[e]).add(R),n.push(B[s++].copy(u));n.push(l)}for(let e=0;e<f;e++)n.push(U[e+f+t]);n.push(U[i+f]);for(let e=0,t=n.length;e<t;e++){let t=n[e],i=3*e,r=2*e;I[i]=t.x,I[i+1]=t.y,I[i+2]=t.z,v(t,R),D[i]=y.x,D[i+1]=y.y,D[i+2]=y.z,L[r]=Math.atan2(t.z,-t.x)/2/Math.PI+.5,L[r+1]=1-(Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5)}for(let e=0,t=M.length;e<t;e++){let t=3*M[e],i=2*M[e],r=h/3*2;a[h]=I[t],a[h+1]=I[t+1],a[h+2]=I[t+2],o[h]=D[t],o[h+1]=D[t+1],o[h+2]=D[t+2],l[r]=L[i],l[r+1]=L[i+1],h+=3}}}let j=[];for(let e=0;e<w.length;e++)for(let t=0;t<d;t++){let i=w[e][t];if(i<S){let r=w[i].findIndex(t=>t%S==e),s=F[e][t],n=F[i][r];for(let e=0;e<f;e++){let t=s[e],i=n[f-e],r=s[e+1],a=n[f-(e+1)];C(t),C(i),C(r),C(r),C(i),C(a)}j.push(s[0][0],n[f][0],s[f][0],n[0][0])}}for(;j.length;){let e,t,i,[r,s]=j.splice(0,2);e=s;let n=[r];for(;r!=e;)n.push(e),t=j.indexOf(e),i=t%2,e=j.splice(t-i,2)[1-i];y.subVectors(n[0],n[1]).cross(u.subVectors(n[0],n[2])).normalize();let a=y.dot(n[0])<0;a&&y.negate();for(let e=1;e<=n.length-2;e++)_(n[e+ +a]),_(n[e+1-+a]),_(n[0])}}(),function(){let e=new z,t=new z,i=new z,r=new z,s=new D,n=new D,o=new D,d=(e,t,i,r)=>{r<0&&1===e.x&&(l[t]=e.x-1),0===i.x&&0===i.z&&(l[t]=r/2/Math.PI+.5)};for(let u=0,c=0;u<h;u+=9,c+=6){e.set(a[u+0],a[u+1],a[u+2]),t.set(a[u+3],a[u+4],a[u+5]),i.set(a[u+6],a[u+7],a[u+8]),s.set(l[c+0],l[c+1]),n.set(l[c+2],l[c+3]),o.set(l[c+4],l[c+5]),r.copy(e).add(t).add(i).divideScalar(3);let h=p(r);d(s,c+0,e,h),d(n,c+2,t,h),d(o,c+4,i,h)}let u=h/3*2;for(let e=0;e<u;e+=6){let t=l[e+0],i=l[e+2],r=l[e+4],s=Math.max(t,i,r),n=Math.min(t,i,r);s>.9&&n<.1&&(t<.2&&(l[e+0]+=1),i<.2&&(l[e+2]+=1),r<.2&&(l[e+4]+=1))}function p(e){return Math.atan2(e.z,-e.x)}}(),this.setAttribute("position",new de(new Float32Array(a.subarray(0,h)),3)),this.setAttribute("normal",new de(new Float32Array(o.subarray(0,h)),3)),void this.setAttribute("uv",new de(new Float32Array(l.subarray(0,h/3*2)),2))}static fromJSON(e){return new Ki(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}},Qi=class extends Ki{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,s=1/r,n="DodecahedronGeometry";super([-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],[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],n,e,t,i),this.type=n}static fromJSON(e){return new Qi(e.radius,e.corner,e.cornerSides)}},er=class extends Ki{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,s="IcosahedronGeometry";super([-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],[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],s,e,t,i),this.type=s}static fromJSON(e){return new er(e.radius,e.corner,e.cornerSides)}},tr=1e4;function ir(e,t){return Math.abs(t-e)/2+Math.min(e,t)}var rr=class{constructor(e=1){this.subdivisions=e}modify(e){let t=function(e){let t=e.getAttribute("position");if(void 0===t)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let i=e.getAttribute("uv"),r=e.getIndex(),s=t.count,n=new Map,a=new Uint32Array(s),o=[],l=0;for(let e=0;e<s;e++){let i=t.getX(e),r=t.getY(e),s=t.getZ(e),h=Math.round(i*tr),d=Math.round(r*tr),u=Math.round(s*tr),p=n.get(h);void 0===p&&(p=new Map,n.set(h,p));let c=p.get(d);void 0===c&&(c=new Map,p.set(d,c));let g=c.get(u);void 0===g&&(g=l++,c.set(u,g),o.push(i,r,s)),a[e]=g}let h=[],d=[],u=void 0===i?null:[],p=null!==r?r.count:s,c=(e,t)=>{let n=null!==r?r.getX(e):e,o=null!==r?r.getX(e+1):e+1,l=null!==r?r.getX(e+2):e+2;if(!(n<s&&o<s&&l<s))return;let p=a[n],c=a[o],g=a[l];p===c||c===g||g===p||(h.push(p,c,g),d.push(t),null!==u&&u.push(i.getX(n),i.getY(n),i.getX(o),i.getY(o),i.getX(l),i.getY(l)))},g=e.groups;if(g.length>0)for(let e=0;e<g.length;e++){let t=g[e],i=void 0===t.materialIndex?0:t.materialIndex,r=Math.max(t.start,0),s=Math.min(t.start+t.count,p);for(let e=r;e<s&&e+2<p;e+=3)c(e,i)}else for(let e=0;e+2<p;e+=3)c(e,0);return{positions:Float64Array.from(o),faces:Uint32Array.from(h),materialIndices:d,uvs:null===u?null:Float64Array.from(u)}}(e),i=this.subdivisions;for(;i-- >0;)t=sr(t);return function(e,t){let{positions:i,faces:r,materialIndices:s,uvs:n}=e,a=i.length/3,o=r.length/3,l=new Float64Array(3*a);for(let e=0;e<o;e++){let t=3*r[3*e],s=3*r[3*e+1],n=3*r[3*e+2],a=i[n]-i[s],o=i[n+1]-i[s+1],h=i[n+2]-i[s+2],d=i[t]-i[s],u=i[t+1]-i[s+1],p=i[t+2]-i[s+2],c=o*p-h*u,g=h*d-a*p,m=a*u-o*d;l[t]+=c,l[t+1]+=g,l[t+2]+=m,l[s]+=c,l[s+1]+=g,l[s+2]+=m,l[n]+=c,l[n+1]+=g,l[n+2]+=m}for(let e=0;e<a;e++){let t=l[3*e],i=l[3*e+1],r=l[3*e+2],s=Math.sqrt(t*t+i*i+r*r)||1;l[3*e]=t/s,l[3*e+1]=i/s,l[3*e+2]=r/s}let h=3*o,d=new Float32Array(3*h),u=new Float32Array(3*h),p=null!==n&&n.length>0?new Float32Array(2*h):null;for(let e=0;e<h;e++){let t=3*r[e];d[3*e]=i[t],d[3*e+1]=i[t+1],d[3*e+2]=i[t+2],u[3*e]=l[t],u[3*e+1]=l[t+1],u[3*e+2]=l[t+2]}null!==p&&p.set(n.subarray(0,2*h));let c=new ce;c.setAttribute("position",new de(d,3)),h>0&&(c.setAttribute("normal",new de(u,3)),c.setAttribute("color",new de(new Float32Array(3*h).fill(1),3))),null!==p&&c.setAttribute("uv",new de(p,2));for(let e=0;e<o;){let t=s[e],i=e;do{e++}while(e<o&&s[e]===t);c.addGroup(3*i,3*(e-i),t)}return null!==t.boundingBox&&(c.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(c.boundingSphere=t.boundingSphere.clone()),c}(t,e)}};function sr(e){let{positions:t,faces:i,materialIndices:r,uvs:s}=e,n=t.length/3,a=i.length/3,o=null!==s&&a>0,l=3*a,h=new Uint32Array(l),d=new Uint32Array(l),u=new Uint32Array(l),p=new Uint32Array(l),c=new Uint32Array(l),g=0,m=8;for(;m<2*l;)m*=2;let f=m-1,y=new Int32Array(m).fill(-1),v=(e,t)=>{let i=(Math.imul(e,2654435761)^t)&f;for(;;){let r=y[i];if(-1===r)return y[i]=g,h[g]=e,d[g]=t,g++;if(h[r]===e&&d[r]===t)return r;i=i+1&f}},b=(e,t)=>{let i=e<t?e:t,r=e<t?t:e,s=(Math.imul(i,2654435761)^r)&f;for(;;){let e=y[s];if(h[e]===i&&d[e]===r)return e;s=s+1&f}},x=new Uint32Array(n),w=new Float64Array(3*n),S=(e,i,r)=>{let s=e<i?v(e,i):v(i,e),n=++u[s];1===n?p[s]=r:2===n&&(c[s]=r),x[e]++,x[i]++,w[3*e]+=t[3*i],w[3*e+1]+=t[3*i+1],w[3*e+2]+=t[3*i+2],w[3*i]+=t[3*e],w[3*i+1]+=t[3*e+1],w[3*i+2]+=t[3*e+2]};for(let e=0;e<a;e++){let t=i[3*e],r=i[3*e+1],s=i[3*e+2];S(t,r,s),S(r,s,t),S(s,t,r)}let M=new Float64Array(3*g);for(let e=0;e<g;e++){let i=3*h[e],r=3*d[e];if(2===u[e]){let s=3*p[e],n=3*c[e];M[3*e]=.375*(t[i]+t[r])+.125*(t[s]+t[n]),M[3*e+1]=.375*(t[i+1]+t[r+1])+.125*(t[s+1]+t[n+1]),M[3*e+2]=.375*(t[i+2]+t[r+2])+.125*(t[s+2]+t[n+2])}else M[3*e]=.5*(t[i]+t[r]),M[3*e+1]=.5*(t[i+1]+t[r+1]),M[3*e+2]=.5*(t[i+2]+t[r+2])}let O,P=new Float64Array(3*n);for(let e=0;e<n;e++){let i=x[e];3===i?O=3/16:i>3&&(O=3/(8*i));let r=1-i*Number(O),s=Number(O);2===i&&(r=3/4,s=1/8),P[3*e]=t[3*e]*r+w[3*e]*s,P[3*e+1]=t[3*e+1]*r+w[3*e+1]*s,P[3*e+2]=t[3*e+2]*r+w[3*e+2]*s}let A=new Float64Array(3*(n+g));A.set(P),A.set(M,3*n);let _=new Uint32Array(12*a),C=new Array(4*a),E=o?new Float64Array(24*a):null;for(let e=0;e<a;e++){let t=i[3*e],a=i[3*e+1],o=i[3*e+2],l=b(t,a)+n,h=b(a,o)+n,d=b(o,t)+n,u=12*e;_[u++]=l,_[u++]=h,_[u++]=d,_[u++]=t,_[u++]=l,_[u++]=d,_[u++]=a,_[u++]=h,_[u++]=l,_[u++]=o,_[u++]=d,_[u++]=h;let p=r[e];if(C[4*e]=p,C[4*e+1]=p,C[4*e+2]=p,C[4*e+3]=p,null!==E){let t=6*e,i=s[t],r=s[t+1],n=s[t+2],a=s[t+3],o=s[t+4],l=s[t+5],h=ir(i,n),d=ir(r,a),u=ir(n,o),p=ir(a,l),c=ir(i,o),g=ir(r,l),m=24*e;E[m++]=h,E[m++]=d,E[m++]=u,E[m++]=p,E[m++]=c,E[m++]=g,E[m++]=i,E[m++]=r,E[m++]=h,E[m++]=d,E[m++]=c,E[m++]=g,E[m++]=n,E[m++]=a,E[m++]=u,E[m++]=p,E[m++]=h,E[m++]=d,E[m++]=o,E[m++]=l,E[m++]=c,E[m++]=g,E[m++]=u,E[m++]=p}}return{positions:A,faces:_,materialIndices:C,uvs:E}}var nr=new z;function ar(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}var or=new z,lr=new z;function hr(e,t,i,r,s,n){let a=or.copy(t).sub(e),o=lr.copy(i).sub(e),l=a.angleTo(o);if(a.normalize(),o.normalize(),r===s){let t=a.add(o).normalize();n.copy(e).addScaledVector(t,r/Math.sin(l/2))}else{let t=a.angleTo(o);n.copy(e),n.addScaledVector(a,s/Math.sin(t)),n.addScaledVector(o,r/Math.sin(t))}}function dr(e,t,i){let r=e.clone().sub(t),s=i.clone().sub(t);return r.projectOnVector(s),r.add(t)}var ur=class extends ce{constructor(e=.5,t=1,i=4,r=1,s=!1,n=0,a=4){super(),i=Math.floor(Math.max(3,i)),r=Math.floor(r),a=Math.floor(a);let o,l=[],h=[],d=[],u=[],p=0,c=t/2,g=Math.PI/i,m=e*Math.cos(Math.PI/i),f=2*Math.PI/i,y=(i-2)*Math.PI/i,v=Math.PI-y,b=new z(0,-c,0),x=new z(0,c,0),w=new D(e,-c),S=new D(m,-c),M=new D(0,x.y).sub(S),O=new D(0,x.y).sub(w),P=new D(M.y,-M.x).normalize(),A=new D(O.y,-O.x).normalize(),_=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-M.angle())/2)-1e-8;n=Math.min(n,_);{let e=new z(P.x,P.y,0),t=new z(Math.cos(f)*e.x,e.y,Math.sin(f)*e.x);o=e.angleTo(t)}let C=n/Math.tan((Math.PI-M.angle())/2),E=n/Math.tan((Math.PI-o)/2),I=new z;if(!s){h.push(b.x,b.y,b.z),d.push(0,-1,0),u.push(0,0);let e=p++,t=[],r=w.clone(),s=C/Math.cos(Math.PI/i);r.x-=s;for(let e=0;e<i;e++){let s=e/i*Math.PI*2+g;ar(r,new D(Math.sin(s),Math.cos(s)),I),h.push(I.x,I.y,I.z),d.push(0,-1,0),u.push(0,0),t.push(p++)}for(let i=0;i<t.length;i++)l.push(t[i],e,t[(i+1)%t.length])}let L=[];{let e=new z,t=new z,r=new z,s=new z,c=new z,m=new z;for(let f=0;f<i;f++){let y=f/i*Math.PI*2+g,v=(f+.5)/i*Math.PI*2+g,S=(f+1)/i*Math.PI*2+g,O=new D(Math.sin(y),Math.cos(y)),_=new D(Math.sin(v),Math.cos(v)),I=new D(Math.sin(S),Math.cos(S));ar(w,O,t),ar(w,I,r),ar(P,_,e),hr(x,t,r,E,E,s),h.push(s.x,s.y,s.z),hr(t,x,r,E,C,c),h.push(c.x,c.y,c.z),hr(r,t,x,C,E,m),h.push(m.x,m.y,m.z),d.push(e.x,e.y,e.z),d.push(e.x,e.y,e.z),d.push(e.x,e.y,e.z),u.push(0,0),u.push(0,0),u.push(0,0);let R=p++,G=p++,T=p++;if(l.push(R,G,T),n>0){{let e=t.clone().add(r).multiplyScalar(.5),i=x.clone().sub(e).normalize(),s=b.clone().sub(e).normalize().add(i).normalize().multiplyScalar(-1);U(e,m.clone().sub(c),s,M.angle())}let g,f;{let e=new z;ar(A,I,e);let t=m.clone().add(s).multiplyScalar(.5);t=dr(t,r,x);let i=m.clone().sub(s);[g,f]=U(t,i,e,o,s.y)}{let e=g,t=e.clone().setY(0).normalize(),i=new z(0,-1,0),r=t.clone().cross(i);B(e,t,i,r)}L.concat(f);{let t=M.angle(),r=Math.PI-t,s=x.clone();s.y-=n/Math.sin(t-Math.PI/2);let o=new z,c=[];for(let t=0;t<a;t++){let l=[],g=Math.PI/2-r*t/a,m=Math.cos(g),f=Math.sin(g),y=v;for(let r=0;r<=t;r++){let r=Math.cos(y),a=Math.sin(y);e.x=m*a,e.y=f,e.z=m*r,o.copy(s).addScaledVector(e,n),h.push(o.x,o.y,o.z),d.push(e.x,e.y,e.z),u.push(0,0),l.push(p++),y+=2*Math.PI/t/i}c.push(l)}f.reverse(),c.push(f);let g=c.length-1;for(let e=0;e<g;e++){let t=c[e],i=c[e+1],r=t.length-1;l.push(i[1],t[0],i[0]);for(let e=1;e<=r;e++)l.push(t[e],t[e-1],i[e]),l.push(i[e+1],t[e],i[e])}}}}}function U(e,t,i,r,s){let o=-r/2,c=(Math.PI-r)/2,g=t.clone().normalize().cross(i);e.addScaledVector(i,-n/Math.sin(c));let m=new z,f=new z,y=p,v=[];for(let l=0;l<=a;l++){let c=o+l/a*r;f.set(0,0,0),f.addScaledVector(g,Math.sin(c)),f.addScaledVector(i,Math.cos(c));for(let i=0;i<=1;i++){let r=i/1-.5;if(m.copy(e),m.addScaledVector(t,r),m.addScaledVector(f,n),null!=s){let e=Math.max(0,m.y-s);m.addScaledVector(t,-e/t.y)}h.push(m.x,m.y,m.z),d.push(f.x,f.y,f.z),u.push(0,0),0===i&&v.push(p),p++}}for(let e=0;e<a;e++)for(let t=0;t<1;t++){let i=y+t+2*e,r=i+2,s=r+1,n=i+1;l.push(i,r,n),l.push(r,s,n)}return[e.clone().addScaledVector(t,.5),v]}function B(e,t,i,r){let s=Math.PI/2,o=O.angle()-s,c=[],g=new z,m=new z;for(let l=0;l<=a;l++){let f=[],y=l/a;for(let a=0;a<=l;a++){let c=((l?a/l:0)-.5)*v,b=Math.cos(c),x=Math.sin(c),w=(s+Math.atan(Math.tan(o)*b))*y,S=Math.cos(w),M=Math.sin(w);g.set(0,0,0),g.addScaledVector(t,M*b),g.addScaledVector(i,S),g.addScaledVector(r,M*x),m.copy(e).addScaledVector(g,n),h.push(m.x,m.y,m.z),d.push(g.x,g.y,g.z),u.push(0,0),f.push(p++)}c.push(f)}let f=c.length-1;for(let e=0;e<f;e++){let t=c[e],i=c[e+1],r=t.length-1;l.push(t[0],i[1],i[0]);for(let e=1;e<=r;e++)l.push(t[e-1],t[e],i[e]),l.push(t[e],i[e+1],i[e])}}this.setIndex(l),this.setAttribute("position",new ue(h,3)),this.setAttribute("normal",new ue(d,3)),this.setAttribute("uv",new ue(u,2))}},pr=class extends ce{constructor(e=1,t=1,i=1,r=90,s=10,n=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],h=.001;0==s&&(n=1),n=Math.max(1,Math.floor(n)),s=Math.min(s,100),r=Math.min(180-h,r),r*=Math.PI/180;let d=[],u=Math.PI/2,p=(e=0,t=0,i=0)=>new z(e,t,i),c=p(),g=p(),[m,f,y]=[t/2,e/2,i/2],v=-f,b=+f,[x,w,S]=[p(v,-m,+y),p(v,-m,-y),p(v,+m,-y)],M=(e,t=!1)=>Math.sin(e-Math.PI/(+t+1)),O=(e,t=!1)=>Math.cos(e-Math.PI/(+t+1));S.y=Math.sin(r)*t-m;let P=Math.cos(r)*t-y,A=x.z-h;r<=u?(S.z=Math.min(P,A),S.z==A&&(S.y-=(P-A)/Math.tan(u-r))):w.z=Math.min(w.z-P-y,x.z-h),c.subVectors(x,w),g.subVectors(S,w);let _=Math.min(c.length(),g.length())*s/100,C=_*Math.tan(r/2),E=_/Math.cos(r/2),I=c.clone().normalize().add(g.normalize()).setLength(E).add(w);c.set(0,M(r,!0),O(r,!0)),d.push([S,c.clone()]);let D=(Math.PI-r)/n;for(let e=0;e<=n;e++){let t=u+r+e*D;c.set(0,Math.sin(t)*C,Math.cos(t)*C),c.add(I),g.set(0,M(t),O(t)),d.push([c.clone(),g.clone()])}d.push([x,p(0,1,0)]);let L=Math.sin(D/2)*C*2,U=d.length-1,B=d[0][0].distanceTo(d[1][0]),R=B+L*n+d[U-1][0].distanceTo(d[U][0]);d[0].push(1);for(let e=0;e<=n;e++)d[e+1].push(1-(B+e*L)/R);d[U].push(0);let G,T,N,[k,F,V]=d[0];for(let e=1;e<d.length;e++)[G,T,N]=d[e],a.push(v,k.y,k.z,v,G.y,G.z,b,k.y,k.z,b,k.y,k.z,v,G.y,G.z,b,G.y,G.z),o.push(0,F.y,F.z,0,T.y,T.z,0,F.y,F.z,0,F.y,F.z,0,T.y,T.z,0,T.y,T.z),l.push(0,V,0,N,1,V,1,V,0,N,1,N),[k,F,V]=[G,T,N];this.setAttribute("position",new ue(a,3)),this.setAttribute("normal",new ue(o,3)),this.setAttribute("uv",new ue(l,2))}},cr={ConeGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},e.parameters);return i.thetaLength=I.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let t,{width:i,depth:r,height:s,radialSegments:n,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,cornerRadiusTop:d,cornerRadiusBottom:u,cornerSegments:p}=e.parameters;0===h?(t=new ce,t.setAttribute("position",new ue([],3))):t=d>0||u>0||h<360?new $i(0,i/2,s,n,a,o,l,h*Math.PI/180,d,u,p,0,!0):new R(i/2,s,n,a,o);let c=r/i;return 1!==c&&t.scale(1,1,c),Object.assign(t,{userData:{...e,type:"ConeGeometry"}})}},CubeGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let t,{width:i,height:r,depth:s,widthSegments:n,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:h}=e.parameters;return t=0===l?new U(i,r,s,n,a,o):new Ji(i,r,s,n,a,o,l,h),Object.assign(t,{userData:{...e,type:"CubeGeometry"}})}},CylinderGeometry:Yi,DodecahedronGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,detail:s,corner:n,cornerSides:a}=e.parameters,o=0===s&&0!==n?new Qi(.5*t,n,a):new G(.5*t,s),l=i/t,h=r/t;return(1!==l||1!==h)&&o.scale(1,l,h),Object.assign(o,{userData:{...e,type:"DodecahedronGeometry"}})}},EllipseGeometry:Li,HelixGeometry:o,IcosahedronGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,detail:s,corner:n,cornerSides:a}=e.parameters,o=0===s&&0!==n?new er(.5*t,n,a):new ie(.5*t,s),l=i/t,h=r/t;return(1!==l||1!==h)&&o.scale(1,l,h),Object.assign(o,{userData:{...e,type:"IcosahedronGeometry"}})}},LatheGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){(e.parameters?.points??[]).forEach(e=>{Array.isArray(e)&&(e.x=e[0],e.y=e[1])});let i=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}]},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{points:t,segments:i,verticalSegments:r}=e.parameters,s=new ee;s.moveTo(t[0].x,t[0].y),s.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let n=new re(s.extractPoints(r).shape,i);return n.rotateZ(Math.PI),Object.assign(n,{userData:{...e,type:"LatheGeometry"}})}},NonParametricGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i,r=e.geometry??t?.geometry??(new ce).copy(new U(100,100,100));void 0===t?(r.computeBoundingBox(),r.boundingBox.getSize(nr),i={width:nr.x,height:nr.y,depth:nr.z,subdivisions:0}):i=t.parameters;let s={...i,...e.parameters};return{parameters:{width:Math.abs(s.width),height:Math.abs(s.height),depth:Math.abs(s.depth),subdivisions:Math.abs(s.subdivisions)},geometry:r}}static build(e){let{width:t,height:i,depth:r,subdivisions:s}=e.parameters,n=e.geometry??(new ce).copy(new U(100,100,100)),a=n.userData.parameters;void 0===a?(n.boundingBox=function(e){let t=new oe,i=e.attributes.position;return i?(t.setFromBufferAttribute(i),t):(t.makeEmpty(),t)}(n),n.boundingBox.getSize(nr)):nr.set(a.width,a.height,a.depth),(t!==nr.x||i!==nr.y||r!==nr.z)&&n.scale(0===nr.x?1:t/nr.x,0===nr.y?1:i/nr.y,0===nr.z?1:r/nr.z);let o=n.originalGeometry;try{s>0?(void 0===o||a?.subdivisions!==s)&&(void 0===o&&(o=n),n=new rr(s).modify(o)):(void 0!==o&&(n=o),o=void 0,void 0===n.getAttribute("normal")&&n.computeVertexNormals())}catch{void 0!==o&&(n=o),o=void 0,void 0===n.getAttribute("normal")&&n.computeVertexNormals()}return void 0!==o&&Object.assign(n,{originalGeometry:o}),delete e.geometry,Object.assign(n,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new T(i).load(e,e=>{let i=this.normalizeInputs({geometry:e});e.boundingBox.getSize(nr);let r=100/nr.x;Object.assign(i.parameters,{width:100,height:nr.y*r,depth:nr.z*r}),t(this.build(i))})}},PolygonGeometry:Fi,PyramidGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,radialSegments:s,heightSegments:n,openEnded:a,cornerRadius:o,cornerSegments:l}=e.parameters,h=new ur(.5*t,i,s,n,a,o,l),d=r/t;return 1!==d&&h.scale(1,1,d),Object.assign(h,{userData:{...e,type:"PyramidGeometry"}})}},RectangleGeometry:Vi,SphereGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return i.thetaLength=I.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let t,{width:i=100,height:r=i,depth:s=i,widthSegments:n=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:h,thetaLength:d}=e.parameters;return 0===d?(t=new ce,t.setAttribute("position",new ue([],3))):t=new ae(.5*i,n,a,o,l,h,d*I.DEG2RAD),t.scale(1,r/i,s/i),Object.assign(t,{userData:{...e,type:"SphereGeometry"}})}},PlaneGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(e){let{width:t=100,height:i=t,widthSegments:r=8,heightSegments:s=8}=e.parameters,n=new se(t,i,r,s);return n.scale(1,1,1),Object.assign(n,{userData:{...e,type:"PlaneGeometry"}})}},BackdropGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,angle:s,cornerRadius:n,cornerSegments:a}=e.parameters,o=new pr(t,i,r,s,n,a);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},StarGeometry:ji,TextFrameGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i}=e.parameters,r=new se(t,i);return Object.assign(r,{userData:{...e,type:"TextFrameGeometry"}})}},TorusGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??i.width);i.shapeBlendNode&&(s=r);let n=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:r,height:s,depth:n})}}static build(e){let{width:t,height:i,depth:r,radialSegments:s,tubularSegments:n,arc:a,cornerRadius:o,cornerSegments:l}=e.parameters,d=function(e,t,i,r,s,n,a,o,l,d,u){[t,i]=[i,t],a=t/2;let p=I.clamp(s/360,0,1);if(0===p){let e=new ce;return e.setAttribute("position",new ue([],3)),e}return 1===p&&(d=0),new h(!0,e,t,i,r,p,n,a,0,l,d,u)}(t,i,r,.5*t,a,n,0,0,s,o,l);return d.scale(1,i/t,1),Object.assign(d,{userData:{...e,type:"TorusGeometry"}})}},TorusKnotGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(e){let{width:t,tube:i,tubularSegments:r,radialSegments:s,p:n,q:a}=e.parameters,o=.5*t;o!==i&&(o-=i);let l=new he(o,i,r,s,n,a);return Object.assign(l,{userData:{...e,type:"TorusKnotGeometry"}})}},TriangleGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},e.parameters);return{shape:e.shape&&e.shape instanceof Mt?e.shape:new Mt,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t=100,height:i,cornerRadius:r,depth:s,extrudeBevelSize:n,extrudeBevelSegments:a,isRect:o}=e.parameters,l=e.shape,h=.5*t,d=.5*i;o?(l.addPoint(l.createPoint(-h,d)),l.addPoint(l.createPoint(h,-d)),l.addPoint(l.createPoint(-h,-d))):(l.addPoint(l.createPoint(0,d)),l.addPoint(l.createPoint(h,-d)),l.addPoint(l.createPoint(-h,-d))),l.isClosed=!0;for(let e=0,t=l.points.length;e<t;e++)l.points[e].roundness=r;l.roundness=r,l.update();let u=Rt.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:n,extrudeBevelSegments:a}});return Object.assign(u,{userData:{...e,type:"TriangleGeometry"}})}},VectorGeometry:Rt},gr=e=>{let t=cr[e.type]??g(e.type);if(void 0===t)throw new Error(`No geometry factory registered for "${e.type}" — was its feature compiled out of this runtime build?`);return t.create(e)},mr=["font"];function fr(e,t,i,r){let s,n,a;"PathGeometry"===e.type?(n=JSON.parse(JSON.stringify(e)),a=[[],["extrusion"]]):(n={...e},a=[[]]);for(let e of a){let i=n;for(let t of e)i=i[t];for(s in i){let n=i[s];y(n)&&!mr.includes(s)&&(i[s]=t.getVariable(n,[r.uuid,"geometry",...e,s]),y(i[s])&&(i[s]=1))}}let o,l={parameters:n,type:n.type};if("PathGeometry"===n.type)l.path=n.path;else if("VectorGeometry"===n.type){let e=Mt.createFromState(n.shape,n.width,n.height);l.shape=e}else if("NonParametricGeometry"===n.type){if(n.data.groups&&n.data.groups?.forEach(e=>e.materialIndex=Math.max(e.materialIndex??0,0)),l.geometry=(new T).parse(n),0===l.geometry.groups.length){let e=l.geometry;e.addGroup(0,Math.max(e.getIndex()?.count??0,e.getAttribute("position").count),0)}}else{if("SubdivGeometry"===n.type){let t=new Er(n,i);return t.data=e,t}if("TextGeometry"===n.type||"InputGeometry"===n.type){let e=g(n.type);if(e)return e.create(n,t);c("text",`a ${n.type}`);let i=Mt.createFromState(S.defaultData(),100,100);return gr({...n,shape:i,type:"VectorGeometry"})}if("UIGeometry"===n.type)return Vi.create({parameters:{width:n.width,height:n.height,cornerRadius:n.cornerRadius,cornerType:n.cornerType}})}try{o=gr(l)}catch(e){console.error(e),console.error(`Error generating geometry with inputs: ${l}`);let t=Mt.createFromState(S.defaultData(),100,100);l.shape=t,l.type="VectorGeometry",o=gr(l)}return o}var yr=new $;function vr(e,t){if(Object.keys(e.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let i=Object.keys(e.attributes),r=Object.keys(t.attributes);if(i.length!==r.length)return!1;for(let i of r){let r=e.attributes[i],s=t.attributes[i];if(void 0===r||!0===r.isInterleavedBufferAttribute||!0===s.isInterleavedBufferAttribute||r.itemSize!==s.itemSize||r.normalized!==s.normalized||r.array.constructor!==s.array.constructor||r.array.length!==s.array.length)return!1}let s=e.index,n=t.index;if(null===s!=(null===n))return!1;let a=!1;if(null!==s&&null!==n){if(s.array.length!==n.array.length)return!1;let e=s.array.constructor,t=n.array.constructor;if(e!==t){if(e!==Uint32Array||t!==Uint16Array)return!1;a=!0}}if(e.groups.length!==t.groups.length)return!1;for(let i=0;i<t.groups.length;i++){let r=e.groups[i],s=t.groups[i];if(r.start!==s.start||r.count!==s.count||r.materialIndex!==s.materialIndex)return!1}for(let i of r){let r=e.attributes[i],s=t.attributes[i];r.array.set(s.array),r.needsUpdate=!0}if(null!==s&&null!==n){if(a){let e=s.array,t=n.array;for(let i=0,r=t.length;i<r;i++){let r=t[i];e[i]=65535===r?4294967295:r}}else s.array.set(n.array);s.needsUpdate=!0}return e.drawRange.start=t.drawRange.start,e.drawRange.count=t.drawRange.count,e.userData=t.userData,e.boundingBox=null,e.boundingSphere=null,!0}function br(e,t,i,r){let s,n,a,o=e.position.array,l=e.normal.array,h=yr.makeScale(t,i,r).invert().elements;for(let e=0,d=o.length;e<d;e+=3)o[e]*=t,o[e+1]*=i,o[e+2]*=r,s=l[e],n=l[e+1],a=l[e+2],l[e]=h[0]*s+h[4]*n+h[8]*a,l[e+1]=h[1]*s+h[5]*n+h[9]*a,l[e+2]=h[2]*s+h[6]*n+h[10]*a;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var xr,wr=new oe,Sr=new z;Hi.then(e=>{xr=e});var Mr=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Or=new Uint32Array([0,1,2,3]),Pr=new Uint8Array([4]);function Ar(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===e?t:-1}function _r(e){if(null!=e){if(Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView))return e;if("object"==typeof e)return function(e){let t=Object.keys(e),i=0;for(let e of t){let t=Ar(e);t>=i&&(i=t+1)}if(0===i||i>t.length)return;let r=new Array(i);for(let t=0;t<i;t++){let i=e[t];if("number"!=typeof i)return;r[t]=i}return r}(e)}}function Cr(e){if(null==e)return"missing";if(Array.isArray(e))return`Array(${e.length})`;if(ArrayBuffer.isView(e)){let t=e;return`${e.constructor.name}(${t.length})`}if("object"!=typeof e)return typeof e;let t=Object.keys(e),i=t.filter(e=>-1===Ar(e)),r=0;for(let e of t){let t=Ar(e);t>=r&&(r=t+1)}let s=e,n=-1,a=-1;for(let e=0;e<r;e++)e in s?"number"!=typeof s[e]&&-1===a&&(a=e):-1===n&&(n=e);let o=[`${t.length} keys`,"max index "+(r-1)];return-1!==n&&o.push(`first missing index ${n}`),-1!==a&&o.push(`non-number at ${a} (${typeof s[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}var Er=class extends ce{constructor(e,t){super(),this.data=e,this.flatShading=t,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,t){this.freeSubdivPointer();let i=this.data.scaleBaked.map(e=>"number"==typeof e?e:1),r=A.div(t.map(e=>"number"==typeof e?e:0),i);if(r.every(e=>1===e))return;this.subdividedGeometry&&br(this.subdividedGeometry.attributes,...r),this.originalGeometry&&br(this.originalGeometry.attributes,...r),this.data=e;let s=this.userData.parameters;this.userData.parameters={width:s.width*r[0],height:s.height*r[1],depth:s.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(Sr.fromArray(r));let n=Sr.set(s.width,s.height,s.depth).length();this.originalGeometry.boundingSphere.radius=n/2}ensureSubdivPointer(){return 0===this.subdivPointer&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let t=e.phongAngle??35;this.flatShading&&(t=-1);let i=null;if(e.subdivisions>0){let r=0;try{r=Er.allocate(e),i=Er.buildRefined(r,e.subdivisions,t)}catch(t){console.error(t,e)}finally{r&&Er.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let r=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=r}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=Er.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new U(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Er.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new pe,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;wr.setFromBufferAttribute(t),wr.getCenter(i),e.boundingSphere.radius=i.distanceTo(wr.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),wr.getSize(Sr);let r={width:Sr.x,height:Sr.y,depth:Sr.z};return this.userData.parameters=r,r}static build(e,t,i,r){let s,n,a=e?.phongAngle??35;!1===i&&(a=-1),t&&(xr.free_bvh(t),xr.free_subdivision_surface(t));try{s=Er.allocate(e,r)}catch(t){console.error(t,e),s=Er.allocate({positionWASM:Mr,indexWASM:Or,verticesPerFaceWASM:Pr},r)}xr.set_destination_refinement_level(s,0);let o=Er.buildLevel(s,!0,a);return n=e.subdivisions>0?Er.buildRefined(s,e.subdivisions,a):null,{subdivPointer:s,originalGeometry:o,subdividedGeometry:n}}static buildRefined(e,t,i){try{return xr.set_destination_refinement_level(e,t),Er.buildLevel(e,!1,i)??null}catch{try{return xr.set_destination_refinement_level(e,t-1),Er.buildLevel(e,!1,i)??null}catch{return null}}}static primitiveToQuads(e,t,i){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),"DodecahedronGeometry"===e.type&&(e.detail=0);let r,s=void 0!==e.shape||void 0!==e.path?t.geometry:fr(e,i,!1,t);r=l(e)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let n,{positions:a,triIndices:o,triOriginals:h}=Dr(s.getAttribute("position"),r);if("CylinderGeometry"===e.type&&0===e.cornerRadius&&0===e.hollow&&!1===e.openEnded){let t=e.radialSegments*e.heightSegments*3*2;n=[t,t+3*e.radialSegments]}let{indices:d,verticesPerFace:u,uvs:p}=function(e,t,i,r,s){let n=[],a=[],o=s?i.getAttribute("uv"):void 0,l=o&&2===o.itemSize?[]:void 0,h=e=>{if(l){let t=s[e];l.push(o.getX(t),o.getY(t))}};if(void 0!==i.userData.shape&&0===i.userData.parameters.depth&&0===i.userData.shape.shapeHoles.length){let t=i.userData.shape.extractShapePointsToFlatArray([]),r=i.userData.parameters.spikes;if("EllipseGeometry"===i.userData.type&&r<=24&&r%4==0&&i.userData.parameters.angle>=360){let e=t.length/2/r;t=t.filter((t,i)=>Math.floor(i/2)%e===0)}let s=0;for(let e=0;e<t.length;e+=2)s+=(t[e]-t[(0===e?t.length:e)-2])*(t[e+1]+t[(0===e?t.length:e)-1]);e.length=0;let o=0;if(s<0)for(let i=0;i<t.length;i+=2)e.push(t[i],t[i+1],0),n.push(o++);else for(let i=t.length-2;i>=0;i-=2)e.push(t[i],t[i+1],0),n.push(o++);return a.push(o),{indices:n,verticesPerFace:a}}let d=new Float32Array([i.userData.parameters.depth])[0],u=0;for(;u<t.length;){if(i.useNgonForTopBottomFaceDuringBake){let i=0;if((e[3*t[u]+2]===d||0===e[3*t[u]+2])&&i++,(e[3*t[u+1]+2]===d||0===e[3*t[u+1]+2])&&i++,(e[3*t[u+2]+2]===d||0===e[3*t[u+2]+2])&&i++,3===i)break}if(t[u+1]===t[u+3]&&t[u+2]===t[u+5]||t[u+0]===t[u+3]&&t[u+2]===t[u+4]){Lr.set(e[3*t[u]],e[3*t[u]+1],e[3*t[u]+2]),Ur.set(e[3*t[u+1]],e[3*t[u+1]+1],e[3*t[u+1]+2]),zr.set(e[3*t[u+4]],e[3*t[u+4]+1],e[3*t[u+4]+2]),Br.set(e[3*t[u+5]],e[3*t[u+5]+1],e[3*t[u+5]+2]),Ur.sub(Lr).normalize(),zr.sub(Lr).normalize(),Br.sub(Lr).normalize();let i=Ur.cross(zr).dot(Br),s=u;Math.abs(i)>.005||r&&r.some((e,t)=>t%2!=1&&s>=r[t]&&s<r[t+1])?(n.push(t[u],t[u+1],t[u+2]),h(u),h(u+1),h(u+2),a.push(3),u+=3):(n.push(t[u],t[u+1],t[u+4],t[u+5]),h(u),h(u+1),h(u+4),h(u+5),a.push(4),u+=6)}else n.push(t[u],t[u+1],t[u+2]),h(u),h(u+1),h(u+2),a.push(3),u+=3}if(i.useNgonForTopBottomFaceDuringBake){let t=[],r=[],s=0;for(let i=0,n=0;i<e.length;i+=3,n++)0===e[i+2]&&(t.push(n),s++),e[i+2]===d&&r.push(n);if(0===i.userData.parameters.extrudeBevelSize){let e=r[0];r[0]=r[1],r[1]=e}t.reverse(),n.push(...t,...r),a.push(s,s),l=void 0}return{indices:n,verticesPerFace:a,uvs:l}}(a,o,s,n,h);return{positions:a,indices:d,verticesPerFace:u,uvs:p}}static allocate(e,t){let i,r,s,n=[],a=[],o=_r(e.positionWASM),l=_r(e.indexWASM),h=_r(e.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!h?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology — positionWASM ${Cr(e.positionWASM)}, indexWASM ${Cr(e.indexWASM)}, verticesPerFaceWASM ${Cr(e.verticesPerFaceWASM)}`);i=o,r=l,s=h;let t=_r(e.uvWASM);xr.alloc_subdivision_surface_uvs&&t&&t.length===2*r.length&&(a=t)}else i=Mr,r=Or,s=Pr;let d=i.length,u=r.length,p=s.length,c=i.length+n.length+a.length,g=r.length+s.length,m=c*Float32Array.BYTES_PER_ELEMENT+g*Uint32Array.BYTES_PER_ELEMENT,f=c*Float32Array.BYTES_PER_ELEMENT,y=xr._malloc(m);if(!y)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${m}) failed`);let v,b=new Float32Array(xr.HEAPF32.buffer,y,c),x=new Uint32Array(xr.HEAPU32.buffer,y+f,g);b.set(i,0),b.set(n,i.length),b.set(a,i.length+n.length),x.set(r,0),x.set(s,r.length),e?.scaleBaked?.some(e=>1!==e)&&(v=(new $).makeScale(...e.scaleBaked.map(e=>"number"==typeof e?e:1))),t&&(v?v.premultiply(t):v=t);let w=y+(i.length+n.length)*Float32Array.BYTES_PER_ELEMENT,S=a.length?v?xr.alloc_subdivision_surface_uvs2(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,w,a.length,v.elements):xr.alloc_subdivision_surface_uvs(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,w,a.length):v?xr.alloc_subdivision_surface2(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,v.elements):xr.alloc_subdivision_surface(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p);return xr._free(y),S}static buildLevel(e,t,i,r,s,n=!1){let a=s?xr.get_mesh_data2(e,t?xr.Level.CONTROL:xr.Level.REFINED,i,s.elements):xr.get_mesh_data(e,t?xr.Level.CONTROL:xr.Level.REFINED,i),o=xr.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),h=0,d=xr.HEAPU32[o[h]>>2],u=xr.HEAPF32.subarray(d>>2,(d>>2)+l[h]);h++;let p=xr.HEAPU32[o[h]>>2],c=xr.HEAPF32.subarray(p>>2,(p>>2)+l[h]);h++;let g=xr.HEAPU32[o[h]>>2],m=xr.HEAPU32.subarray(g>>2,(g>>2)+l[h]);h++;let f,y=xr.HEAPU32[o[h]>>2],v=xr.HEAPU32.subarray(y>>2,(y>>2)+l[h]);if(h++,xr.alloc_subdivision_surface_uvs){let e=o[9];if(e>0){let t=xr.HEAPU32[o[8]>>2];f=xr.HEAPF32.subarray(t>>2,(t>>2)+e)}}if(void 0===r){let e=new ce;if(e.setIndex(new _(v,1)),e.setAttribute("position",new ue(u,3)),e.setAttribute("normal",new ue(c,3)),f&&e.setAttribute("uv",new ue(f,2)),t){e.setAttribute("faceMap",new _(m,1));let t=new Float32Array(c.length/3*4).fill(0);e.setAttribute("color",new de(t,4))}return xr.free_mesh_data(a),e.userData.type="SubdivGeometry",e}if(r.getAttribute("position").copyArray(u),r.getAttribute("normal").copyArray(c),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,n){let e=r.getIndex();null!==e&&e.array.length===v.length&&(e.copyArray(v),e.needsUpdate=!0)}let b=r.getAttribute("uv");f&&b&&b.array.length===f.length&&(b.copyArray(f),b.needsUpdate=!0),xr.free_mesh_data(a)}static freeSubdivPointer(e){xr.free_bvh(e),xr.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=xr.get_wireframe_data_for_base_level(e),s=xr.HEAPU32.subarray(r>>2,4+(r>>2)),n=s.subarray(2,4),a=0,o=xr.HEAPU32[s[a]>>2],l=xr.HEAPF32.subarray(o>>2,(o>>2)+n[a]);a++;let h=xr.HEAPU32[s[a]>>2],d=xr.HEAPU32.subarray(h>>2,(h>>2)+n[a]);if(void 0===t){let e=new ce;e.setAttribute("position",new ue(l,3));let t=new Float32Array(l.length);for(let e=0,r=l.length;e<r;)t[e++]=i.r,t[e++]=i.g,t[e++]=i.b;return e.setAttribute("color",new de(t,3)),e.setIndex(new _(d,1)),xr.free_wireframe_data_for_base_level(r),e}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,xr.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=0===t;r||xr.set_destination_refinement_level(e,t);let s=i?xr.get_topological_data2(e,r?xr.Level.CONTROL:xr.Level.REFINED,i.elements):xr.get_topological_data(e,r?xr.Level.CONTROL:xr.Level.REFINED),n=xr.HEAPU32.subarray(s>>2,8+(s>>2)),a=n.subarray(3,6),o=0,l=xr.HEAPU32[n[o]>>2],h=new Float32Array(xr.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let d=xr.HEAPU32[n[o]>>2],u=new Uint32Array(xr.HEAPU32.subarray(d>>2,(d>>2)+a[o]));o++;let p,c=xr.HEAPU32[n[o]>>2],g=new Uint8Array(xr.HEAPU32.subarray(c>>2,(c>>2)+a[o]));if(xr.alloc_subdivision_surface_uvs){let e=n[7];if(e>0){let t=xr.HEAPU32[n[6]>>2];p=new Float32Array(xr.HEAPF32.subarray(t>>2,(t>>2)+e))}}return xr.free_topological_data(s),{positions:h,indices:u,verticesPerFace:g,uvs:p}}};function Ir(e){let t=Object.keys(e);return 1===t.length&&"subdivisions"===t[0]}function Dr(e,t){let i=t?t.count:e.count,r=0,s=1e4,n=new Map,a=new Uint32Array(i),o=[];for(let l=0;l<i;l++){let i=t?t.getX(l):l,h=e.getX(i),d=e.getY(i),u=e.getZ(i),p=Math.round(h*s),c=Math.round(d*s),g=Math.round(u*s),m=n.get(p);void 0===m&&(m=new Map,n.set(p,m));let f=m.get(c);void 0===f&&(f=new Map,m.set(c,f));let y=f.get(g);void 0===y&&(y=r++,f.set(g,y),o.push(h,d,u)),a[l]=y}let l=[],h=[];for(let e=0;e<a.length;e+=3)a[e]===a[e+1]||a[e]===a[e+2]||a[e+1]===a[e+2]||(l.push(a[e],a[e+1],a[e+2]),h.push(t?t.getX(e):e,t?t.getX(e+1):e+1,t?t.getX(e+2):e+2));return{positions:o,triIndices:l,triOriginals:h}}var Lr=new z,Ur=new z,zr=new z,Br=new z;function Rr(e,t){let i=0;if(!e.layers||0===e.layers.length)return!1;let r=e.layers?.find(e=>"light"===e.data.type);if(r){let e=r.data,i=Number(t.getVariable(e.alphaOverride));if(("string"==typeof e.alphaOverride?i/100:e.alphaOverride)<1)return!0}for(let r of e.layers){if("displace"!==r.data.type&&r.data.isMask)return!0;if("displace"!==r.data.type&&"alpha"in r.data&&"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"!==r.data.type){let e=r.data.visible?r.data.alpha:0;if("string"==typeof e&&(e=Math.max(0,Math.min(1,Number(t.getVariable(e)??100)/100))),1===e&&"depth"===r.data.type||"gradient"===r.data.type){for(let t of r.data.colors)if(t[3]<1){e=t[3];break}}else if(1===e&&"noise"===r.data.type){let i=t.color(r.data.colorA).a,s=t.color(r.data.colorB).a,n=t.color(r.data.colorC).a,a=t.color(r.data.colorD).a,o=Math.min(i,Math.min(s,Math.min(n,a)));o<1&&(e=o)}i+=(1-i)*e}}return i<1}var Gr=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable("number"==typeof e?100*e:e,i)??100)/100))??1,Tr=(e,t,i)=>"number"==typeof e?e:t.getVariable(e,i);function Nr(e){let t="string"==typeof e?e:e.type;return"texture"===t||"video"===t||"displace_map"===t||"matcap"===t}function kr(e){return"string"==typeof e||"number"==typeof e&&0!==e}var Fr={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"]},Vr={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]},jr=class extends(n(Q)){},Hr=class extends jr{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];i?.object!==t&&(i&&this.remove(i),i=new Hr(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=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(void 0===e||this.parent!==e||!e.instancingActive&&!e.insideBoolean)&&(void 0!==this.playModeVisible?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&!0===this.object.dataPatched.cloner?.hideBase)}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return(()=>"Mesh"===this.object.type)()}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){}},qr=class extends gi{},Wr=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(e){return this.objects.get(e)}get size(){return this.objects.size}get(e,t,i){let r=this.objects.get(e);return void 0===r?(r=this.createObject(e,t,i),this.objects.set(e,r)):r.isShared=!0,r}forceDelete(e){let t=this.objects.get(e);t&&(this.disposeObject(t),this.objects.delete(e))}adopt(e,t){this.objects.set(e,t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&!0!==i.isShared)return this.objects.delete(e),this.objects.set(t,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(e,t){t===this.objects.get(e)&&this.unreachable.delete(e)}endGc(){this.unreachable.forEach(e=>{this.disposeObject(this.objects.get(e)),this.objects.delete(e)}),this.unreachable.clear()}dispose(){this.objects.forEach(e=>{this.disposeObject(e)}),this.objects.clear()}},Yr=class extends Wr{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=fr(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}},Xr={markNeedsUpdateRendererDirty:()=>{}};function $r(e){return"variable_"+e}var Zr=new $,Jr=new z,Kr=new L,Qr=new z,es=new J,ts=class extends bi{constructor(e){super(),this.shared=e}create(e){return new Pi(e,this.shared)}},is=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new Yr(!0),this.geometryCache2=new Yr(!1),this.imageHolderCache=new ts(this),this.thisContext={scene:Xr,shared:this},this.deletedImage=new Ai(p.emptyImage,this),this.deletedVideo=new Ai(v.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,t.images)for(let[e,i]of Object.entries(t.images))this.addImage(e,i);if(t.videos)for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i);if(t.audios)for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i);if(t.particles)for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i);this.reset(e)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=ei(w.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(e){this._requestRender=e}getImageLoadPromises(){return Object.values(this.images).map(e=>e.loadPromise)}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1,i=!1){this.data=e,this.resetLib(e.lib);for(let{id:i,data:r}of e.variables)this.addVariableHolder(i,r),t&&this.updateVariableHolder(i,r);for(let[t,i]of Object.entries(e.userAPIs??{}))this.addUserAPI(t,i);for(let[t,i]of Object.entries(e.userWebhooks??{}))this.addUserWebhook(t,i);if(!i){for(let[t,i]of Object.entries(e.images))this.addImage(t,i);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i)}for(let[t,i]of Object.entries(e.colors))this.addColor(t,i);for(let[t,i]of Object.entries(e.lib.materials))this.addMaterial(t,i.asset);for(let[t,i]of Object.entries(e.materials))this.addMaterial(t,i);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i)}addMaterial(e,t){if(void 0===t.layers&&(t={...t,layers:w.defaultTwoLayerData("phong").layers}),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=ei(t,this.thisContext,e);this.materials[e]=i}}deleteMaterial(e){this.materials[e]&&(this.materials[e].nodeMaterialDispose(),delete this.materials[e])}getMaterial(e){return this.materials[e]}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return"string"==typeof e?this.getMaterialOrDeletedPlaceholder(e):null==e?(console.error("material is undefined or null"),this.deletedMaterial):(void 0===e.layers&&(e={...e,layers:w.defaultTwoLayerData("phong").layers}),Qt(e,this.thisContext))}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[e].updateSrc(t.data),!0):(this.images[e]=new Ai(t,this),!1)}deleteImage(e){let t=this.images[e];t&&(t.dispose(),delete this.images[e])}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return"string"==typeof e?this.getImage(e):this.imageHolderCache.load(e)}addUIBuffer(e,t){return this.uiBuffers[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[e].updateSrc(t),!0):(this.uiBuffers[e]=new Ai(t,this),!1)}uiBuffer(e){return this.uiBuffers[e]}addVideo(e,t){return this.videos[e]?(this.videos[e].updateSrc(t.data),!0):(this.videos[e]=new Ai(t,this),!1)}deleteVideo(e){let t=this.videos[e];t&&(t.dispose(),delete this.videos[e])}getVideo(e){return this.videos[e]??this.deletedVideo}video(e){return"string"==typeof e?this.getVideo(e):this.imageHolderCache.load(e)}addColor(e,t){return this.colors[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):(this.colors[e]=new qr(t.r,t.g,t.b,"a"in t?t.a:1),!1)}updateColor(e,t){if(this.colors[e]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[e];return this.colors[e].r=t.r??i.r,this.colors[e].g=t.g??i.g,this.colors[e].b=t.b??i.b,this.colors[e].a=t.a??i.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}getColorNames(){return Object.values(this.data.colors).map(e=>e.name)}getColorByName(e){for(let t in this.data.colors)if(this.data.colors[t].name===e)return{color:this.colors[t],id:t}}color(e){let t;if("string"!=typeof e)return new gi(e.r,e.g,e.b,"a"in e?e.a:1);{let i=this.getColor(e);i?t=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new gi(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof i)return t;{let r=new i({src:t.data});return this.audios[e]=r,r}}addParticle(e,t){this.particles[e]=t}getParticle(e){return this.particles[e]}deleteParticle(e){this.particles[e]&&delete this.particles[e]}deleteAudio(e){let t=this.audios[e];t&&(t instanceof i&&t.dispose(),delete this.audios[e])}addFont(e,t){let i=Pe;null!==i?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):c("text","a font asset")}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof i&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){if(void 0===this.variables[e]){let i=t.value;if(this.enableLocalStorageForPersistentVariables&&t.persistent){let r=localStorage.getItem($r(e));i=null!==r?JSON.parse(r):t.value}return this.variables[e]={value:i,locations:[],persistent:t.persistent},"dynamicVariableType"in t&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0),!0}return this.variables[e].value=t.value,!1}resetDynamicVariablePlayState(){for(let e in this.variables)void 0!==this.variables[e].dynamicVariablePlayState&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(void 0===this.variables[e])return!1;this.variables[e].value=t,this.enableLocalStorageForPersistentVariables&&this.variables[e].persistent&&localStorage.setItem($r(e),JSON.stringify(t));let i=t;for(;"string"==typeof i;)i=this.variables[i].value;let r=this.entityOpContext.scene,s=!1;for(let t=this.variables[e].locations.length-1;t>=0;t--){let n=this.variables[e].locations[t];if("material"===n[0]){let e=n[1],t=i,s={scene:r,shared:this},a=n.slice(2);r.traverseMaterial(i=>{let r=i.root??i;r.uuid===e&&r.onVariableUpdate(a,t,s)});let o=this.materials[e];o&&o.onVariableUpdate(a,t,s)}else{let o=r.find(n[0]);if(void 0===o){this.variables[e].locations.splice(t,1);continue}if(s=!0,"geometry"!==n[1]&&"particles"!==n[1]){for(let e=1;e<n.length-1;e++)o=o[n[e]];"rotation"===n[1]?o[n[n.length-1]]=i*I.DEG2RAD:o[n[n.length-1]]=i}if(o=r.find(n[0]),"ParticleEmitter"===o.type&&o.updateVariableState(i,n),a.is(o))if("position"===n[1]||"rotation"===n[1]||"scale"===n[1])o.onVariableUpdate();else if("geometry"===n[1]){let e=o;o.component&&(e=o.component);let t=e.dataPatched;e.chooseGeoemtryCache(this).forceDelete(t.geometry),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),e.instances.forEach(e=>{let t=e.dataPatched;e.chooseGeoemtryCache(this).forceDelete(t.geometry),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData()})}else"morphTargetInfluences"===n[1]&&o.updateMorphInfluences(n[2],i)}}return s&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(e,t){let i=e;if(i.component&&(i=i.component),"function"!=typeof i.chooseGeoemtryCache)return!1;let r=i.dataPatched,s=r?.geometry;if(!s||"string"!=typeof s.type||"VectorGeometry"===s.type||"PathGeometry"===s.type)return!1;let n=e=>e.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let e of Object.keys(s))a.set(n(e),e);let o={};for(let[e,i]of Object.entries(t??{})){let t=a.get(n(e));if(void 0===t||"type"===t||"font"===t||"shape"===t||"path"===t||"data"===t)continue;if("text"===t){("string"==typeof i||"number"==typeof i)&&(o[t]={textValue:String(i)});continue}let r=s[t];"number"==typeof i&&isFinite(i)&&("number"==typeof r||"string"==typeof r)&&(o[t]=i)}if(0===Object.keys(o).length)return!1;let l={...s,...o};return i.dataPatched={...r,geometry:l},this.transientGeometryKeys.has(s)&&i.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(e){let t=e;if(t.component&&(t=t.component),"function"!=typeof t.chooseGeoemtryCache)return!1;let i=t.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(t.dataPatched=t.data,t.chooseGeoemtryCache(this).forceDelete(i),t.createGeometryDelayed(this.entityOpContext),t.onVariableUpdate(!0),t.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(e,t){let i=e;if(i.component&&(i=i.component),"function"!=typeof i.chooseGeoemtryCache)return!1;let r=i.dataPatched,s=r?.geometry;if(!s||"NonParametricGeometry"!==s.type)return!1;let n=t?.vertices;if(void 0===n||"number"!=typeof n.length||n.length<9||n.length%3!=0||n.length/3>is.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,h=n instanceof Float32Array?n:Float32Array.from(n),d=h.length/3;if(void 0!==t.normals){if(t.normals.length!==h.length)return!1;a=t.normals instanceof Float32Array?t.normals:Float32Array.from(t.normals)}if(void 0!==t.uvs){if(t.uvs.length!==2*d)return!1;o=t.uvs instanceof Float32Array?t.uvs:Float32Array.from(t.uvs)}if(void 0!==t.indices){let e=d>65535?Uint32Array.from(t.indices):Uint16Array.from(t.indices);if(0===e.length||e.length%3!=0)return!1;for(let t=0;t<e.length;t++)if(e[t]>=d)return!1;l={array:e,itemSize:1,type:e.constructor.name,normalized:!1}}else{let e=s.data,t=e?.index;if(t?.array?.length){if(d<(e?.attributes?.position?.array?.length??0)/3){let e=t.array;for(let t=0;t<e.length;t++)if(e[t]>=d)return!1}l=t}}let u=1/0,p=1/0,c=1/0,g=-1/0,m=-1/0,f=-1/0;for(let e=0;e<h.length;e+=3){let t=h[e],i=h[e+1],r=h[e+2];t<u&&(u=t),t>g&&(g=t),i<p&&(p=i),i>m&&(m=i),r<c&&(c=r),r>f&&(f=r)}let y=(e,t)=>({array:e,itemSize:t,type:"Float32Array",normalized:!1}),v={position:y(h,3)};a&&(v.normal=y(a,3)),o&&(v.uv=y(o,2));let b={...s,width:g-u,height:m-p,depth:f-c,data:{attributes:v,...l?{index:l}:{}}},x=this.transientGeometryKeys.has(s);return i.dataPatched={...r,geometry:b},this.transientGeometryKeys.add(b),i.applyTransientGeometryData(this.entityOpContext,x),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(e,t){let i=e;i.component&&(i=i.component);let r=i.cloner;if(void 0===r)return-1;let s=r.children,n=Math.PI/180,a=!1;if(null===t)for(let e of s)void 0!==e.transformOverride&&(e.transformOverride=void 0,a=!0);else{if(!Array.isArray(t))return s.length;{let e=Math.min(t.length,s.length);for(let i=0;i<e;i++){let e=t[i],r=s[i];if(null==e){void 0!==r.transformOverride&&(r.transformOverride=void 0,a=!0);continue}let o=r.transformOverride??{position:[r.position.x,r.position.y,r.position.z],rotation:[r.rotation.x,r.rotation.y,r.rotation.z],scale:[r.scale.x,r.scale.y,r.scale.z]};e.position&&("number"==typeof e.position.x&&(o.position[0]=e.position.x),"number"==typeof e.position.y&&(o.position[1]=e.position.y),"number"==typeof e.position.z&&(o.position[2]=e.position.z)),e.rotation&&("number"==typeof e.rotation.x&&(o.rotation[0]=e.rotation.x*n),"number"==typeof e.rotation.y&&(o.rotation[1]=e.rotation.y*n),"number"==typeof e.rotation.z&&(o.rotation[2]=e.rotation.z*n)),e.scale&&("number"==typeof e.scale.x&&(o.scale[0]=e.scale.x),"number"==typeof e.scale.y&&(o.scale[1]=e.scale.y),"number"==typeof e.scale.z&&(o.scale[2]=e.scale.z)),r.transformOverride=o,r.position.fromArray(o.position),r.rotation.fromArray(o.rotation),r.scale.fromArray(o.scale),r.updateMatrix(),r.hasNonUniformScale&&(r.updateMatrixWorld(),r.updateMatrixWorldRigid())}}}return a?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),s.length}spawnRuntimeClone(e,t={}){if("function"!=typeof e.entityChildren)return;let i=e.parent;if(null===i)return;let r=new Hr(e);r.playModeVisible=!1!==t.visible,r.expand(),"string"==typeof t.name&&(r.name=t.name);let s=Math.PI/180;return r.position.copy(e.position),r.rotation.copy(e.rotation),r.scale.copy(e.scale),r.hiddenMatrix.copy(e.hiddenMatrix),t.position&&("number"==typeof t.position.x&&(r.position.x=t.position.x),"number"==typeof t.position.y&&(r.position.y=t.position.y),"number"==typeof t.position.z&&(r.position.z=t.position.z)),t.rotation&&("number"==typeof t.rotation.x&&(r.rotation.x=t.rotation.x*s),"number"==typeof t.rotation.y&&(r.rotation.y=t.rotation.y*s),"number"==typeof t.rotation.z&&(r.rotation.z=t.rotation.z*s)),t.scale&&("number"==typeof t.scale.x&&(r.scale.x=t.scale.x),"number"==typeof t.scale.y&&(r.scale.y=t.scale.y),"number"==typeof t.scale.z&&(r.scale.z=t.scale.z)),r.updateMatrix(),i.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(e){e.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(e,t){let i=e.material;if(!i)return!1;let r=[];for(let e of Array.isArray(i)?i:[i]){let t=e.root??e;t&&Array.isArray(t.layers)&&t.data&&!r.includes(t)&&r.push(t)}if(0===r.length)return!1;let s={scene:this.entityOpContext.scene,shared:this},n=e=>e.toLowerCase().replace(/[\s_.-]+/g,""),a=e=>{if("string"==typeof e){let t=new gi(1,1,1,1);try{t.set(e)}catch{return null}return{r:t.r,g:t.g,b:t.b,a:void 0}}if(e&&"object"==typeof e&&"r"in e){let t=e;if([t.r,t.g,t.b].some(e=>"number"!=typeof e||!isFinite(e)))return null;let i=Math.max(t.r,t.g,t.b)>1?1/255:1;return{r:t.r*i,g:t.g*i,b:t.b*i,a:"number"==typeof t.a?Math.max(0,Math.min(t.a,1)):void 0}}return null},o=(e,t,i)=>{if(!e.hasValue(t))return!1;let r=e.getValue(t);if(!r||"object"!=typeof r||!r.isColor)return!1;let s=i.a??("number"==typeof r.a?r.a:1);return r instanceof qr?e.setValue(t,new gi(i.r,i.g,i.b,s)):"function"==typeof r.setRGBA?r.setRGBA(i.r,i.g,i.b,s):r.setRGB(i.r,i.g,i.b),!0},l=!1;for(let e of r){let i=e.data.layers??[],r=t=>e.layers.find(e=>e.uuid===t);if(void 0!==t.color){let n=a(t.color),h=i.find(e=>"color"===e.data.type),d=h&&r(h.id);if(n&&d&&o(d,"color",n)&&(l=!0,void 0!==n.a)){let t=n.a<1||Rr(e.data,this);e.setTransparent?e.setTransparent(t,s.scene):e.transparent=t}}"number"==typeof t.alpha&&isFinite(t.alpha)&&(e.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(t.alpha,100)),s),l=!0);for(let h of t.layers??[]){if(!h||"object"!=typeof h)continue;let t="string"==typeof h.id?i.find(e=>e.id===h.id):"number"==typeof h.index?i[h.index]:"string"==typeof h.type?i.find(e=>e.data.type===h.type):void 0,d=t&&r(t.id);if(!t||!d)continue;let u=Fr[t.data.type]??[],p=Object.keys(t.data);for(let[i,r]of Object.entries(h)){if("id"===i||"index"===i||"type"===i)continue;let h=p.find(e=>e===i)??p.find(e=>n(e)===n(i))??i;if(u.includes(h))continue;let c=a(r);if(c&&o(d,h,c))l=!0;else if("number"==typeof r&&isFinite(r))e.onVariableUpdate?.(["layer",t.id,h],r,s),l=!0;else if(Array.isArray(r)&&r.length<=3&&r.every(e=>"number"==typeof e&&isFinite(e))){let i=["x","y","z"];r.forEach((r,n)=>{e.onVariableUpdate?.(["layer",t.id,h,i[n]],r,s)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(e){this.variables[e]&&delete this.variables[e]}getVariable(e,t){if(Array.isArray(e)){if("mouse"===e[0])return this.mouseProperty?.[e[1]]??0;if("raycast"===e[0])return this.raycastProperty?.[e[1]]??0;let t=this.entityOpContext.scene.find(e[0]);if("width"===e[1]||"height"===e[1]||"depth"===e[1])return t.geometry.userData.parameters[e[1]];if(("position"===e[1]||"rotation"===e[1])&&e.length>2&&t?.getPhysicsLocalMatrix?.(Zr))return Zr.decompose(Jr,Kr,Qr),"position"===e[1]?Jr[e[2]]:(es.setFromQuaternion(Kr,t.rotation.order),es[e[2]]*I.RAD2DEG);for(let i=1;i<e.length;i++)t=t[e[i]];return"rotation"===e[1]&&(t*=I.RAD2DEG),t}for(let e in this.variables){if(void 0===t)break;let i=this.variables[e],r=i.locations?.findIndex(e=>P.equal(e,t));void 0!==r&&-1!==r&&i.locations.splice(r,1)}if("string"==typeof e){let i=e,r=e;do{if(r=i,void 0===this.variables[i])break;let e=this.variables[i].value;t&&void 0!==this.variables[r]&&this.variables[r].locations.push(t),i=e}while("string"==typeof i);return i}return e}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(e=>e.data.name)}getVariableByName(e){for(let t of this.data.variables)if(t.data.name===e)return{variable:t.data,id:t.id}}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){"images"===e.path[0]?1===e.path.length&&1===e.type?this.addImage(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteImage(e.id):"videos"===e.path[0]?1===e.path.length&&1===e.type?this.addVideo(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVideo(e.id):"audios"===e.path[0]?1===e.path.length&&1===e.type?this.addAudio(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteAudio(e.id):"particles"===e.path[0]?1===e.path.length&&1===e.type?this.addParticle(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteParticle(e.id):"colors"===e.path[0]?1===e.path.length&&1===e.type?this.addColor(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteColor(e.id):"materials"===e.path[0]?1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteMaterial(e.id):"fonts"===e.path[0]?1===e.path.length&&1===e.type?this.addFont(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteFont(e.id):"variables"===e.path[0]?1===e.path.length&&1===e.type?this.addVariableHolder(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVariable(e.id):"components"===e.path[0]&&t.updateByLibOp(e,this)}updateByOp(e,t,i){if(this.data=t,"images"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addImage(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteImage(e.id);else if("videos"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addVideo(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteVideo(e.id);else if("audios"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):1===e.path.length&&1===e.type?this.addAudio(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteAudio(e.id);else if("particles"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.addParticle(e.path[1],t.particles[e.path[1]]):1===e.path.length&&1===e.type?this.addParticle(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteParticle(e.id);else if("colors"===e.path[0])2===e.path.length&&0===e.type?this.updateColor(e.path[1],e.props):1===e.path.length&&1===e.type?this.addColor(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteColor(e.id);else if("materials"===e.path[0])1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data):1===e.path.length&&2===e.type?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp(M.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i});else if("fonts"===e.path[0])2===e.path.length&&0===e.type?this.updateFont(e.path[1],e,i):1===e.path.length&&1===e.type?this.addFont(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteFont(e.id);else if("variables"===e.path[0])2===e.path.length&&0===e.type?"value"in e.props?this.updateVariable(e.path[1],e.props.value):"persistent"in e.props&&(this.variables[e.path[1]].persistent=e.props.persistent):1===e.path.length&&4===e.type?this.addVariableHolder(e.id,e.data):1===e.path.length&&5===e.type&&this.deleteVariable(e.id);else if("userAPIs"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserAPI(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserAPI(e.id);else if("string"==typeof e.path[1]){let i=t.userAPIs[e.path[1]];if(i){let t=0===e.type&&void 0===e.props.debounce,r=this.getUserAPI(e.path[1]);void 0!==r&&r===this.openAIRealtime?r.update(i):r?.update(i,this,t)}}}else if("userWebhooks"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserWebhook(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserWebhook(e.id);else if("string"==typeof e.path[1]){let i=t.userWebhooks[e.path[1]];i&&this.getUserWebhook(e.path[1])?.update(i)}}else"lib"===e.path[0]&&this.updateLibByOp(M.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),s={...this.data.fonts[e],url:t.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(i,r){if(this.userAPIs[i])return this.userAPIs[i].update(r,this),!0;if(this.openAIRealtime?.id===i)return this.openAIRealtime.update(r),!0;if("VoiceAssistant"===r.integration?.type){let e=t();return null===e?(c("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=e(r,i,this),!1)}{let t=e();return null===t?(c("api-services","a user API integration"),!1):(this.userAPIs[i]=t.createUserAPI(i,r,this),!1)}}getUserAPI(e){return this.openAIRealtime?.id===e?this.openAIRealtime:this.userAPIs[e]}getUserAPIs(){return this.userAPIs}deleteUserAPI(e){let t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}addUserWebhook(t,i){if(this.userWebhooks[t])return this.userWebhooks[t].update(i),!0;{let r=e();return null===r?(c("api-services","a user webhook"),!1):(this.userWebhooks[t]=r.createUserWebhook(t,i),!1)}}getUserWebhook(e){return this.userWebhooks[e]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(e){let t=this.userWebhooks[e];t&&(t.dispose(),delete this.userWebhooks[e])}get scene(){return this.entityOpContext.scene}},rs=is;function ss(e){return!0===e?.isClassicNodeMaterial}function ns(e){return ss(e)||!0===e?.isTSLNodeMaterial}rs.MAX_TRANSIENT_VERTICES=6e4,new rs(f.emptyData());var as=class extends d{setMaterialOverride(e,t){this.materialOverride=ti(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),t.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),s(e.path,["geometry"])&&this.syncShadowCatcher(i),null!==r(e.path,["materials"])&&0===e.type&&Array.isArray(this.material))for(let[t,r]of Object.entries(e.props)){let e=this.material[Number(t)],s=i.shared.material(r);s!==e&&as.disposeOneMaterial(e),this.material[Number(t)]=s}else if(s(e.path,["material"])){let r=this.material;!Array.isArray(r)&&"function"==typeof r?.updateByOp&&"material"in t&&"string"!=typeof t.material&&r.updateByOp(M.drop(e,1),t.material,i)}else if(s(e.path,["materials","*"])&&Array.isArray(this.material)){let r=e.path[1];if("materials"in t&&r<this.material.length){let s=t.materials[r];"string"!=typeof s&&this.material[r].updateByOp(M.drop(e,2),s,i)}}}get needsAO(){return void 0!==this.material&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){"Mesh"===this.dataPatched.type&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(e,t){super.updateState(e,t),void 0!==e.castShadow&&(this.castShadow=e.castShadow),void 0!==e.receiveShadow&&(this.receiveShadow=e.receiveShadow);let i,r=this.dataPatched;this.syncShapeBlendNodeLayer(),"Mesh"===this.dataPatched.type&&"ShapeBlendGeometry"===this.dataPatched.geometry.type&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let s=void 0!==this.materialOverride;!s&&"NonParametricGeometry"!==e.geometry?.type&&"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,i),t.scene.markNeedsUpdateRendererDirty()),!s&&("NonParametricGeometry"===e.geometry?.type||"materials"in e)&&("materials"in e&&void 0!==e.materials?(this.disposeMaterial(),this.material=e.materials.map(e=>t.shared.material(e).getFlavor(r.flatShading,r.side,r.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let n=this.data;if(!s&&"NonParametricGeometry"!==n.geometry?.type&&"materials"in n&&void 0!==n.materials&&(this.disposeMaterial(),this.material=t.shared.material(n.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!s&&(void 0!==e.flatShading||void 0!==e.wireframe||void 0!==e.side))if(Array.isArray(this.material))for(let e=0;e<this.material.length;e++)this.material[e]=this.material[e].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i);this.syncShadowCatcher(t)}shadowCatcherActive(){let e=this.dataPatched,t=e.geometry?.type;return!0===e.shadowCatcher&&("RectangleGeometry"===t||"PlaneGeometry"===t)}syncShadowCatcher(e){let t=this.dataPatched;if(this.shadowCatcherActive()){if(void 0===this.shadowCatcherMaterial){let e=function(){let e="webgpu"===Wt&&void 0!==kt?kt:Ft;return void 0===e?null:ti(e())}();if(null===e)return;this.shadowCatcherMaterial=e}this.shadowCatcherMaterial.side=t.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 void 0!==this.shadowCatcherMaterial&&this.material===this.shadowCatcherMaterial&&(void 0!==this.materialOverride?(this.material=this.materialOverride,e.scene.markNeedsUpdateRendererDirty()):"material"in t&&void 0!==t.material&&(this.material=e.shared.material(t.material).getFlavor(t.flatShading,t.side,t.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow)}static disposeOneMaterial(e){ns(e)&&!function(e){return function(e){return!0===e?.isClassicSharedMaterial}(e)||!0===e?.isTSLSharedMaterial}(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&b(this.material).forEach(e=>{as.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}},os=new z,ls=new H,hs=new H,ds=new z,us=new $,ps=class extends as{constructor(e,t,i){super(e,t),this.data=t,this.isSkinnedMesh=!1,this.localGeometry=void 0,t.bindMode&&t.bindMatrix&&(this.bindMode=t.bindMode,this.bindMatrix=(new $).fromArray(t.bindMatrix),this.bindMatrixInverse=new $)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return!0!==e.isTextGeometry}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof ce&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(void 0===this.localGeometry)return this.geometryCreateDeleyed instanceof ce?this.geometryCreateDeleyed:void 0}get geometry(){if(void 0!==this.localGeometry)return this.localGeometry;if(this.geometryCreateDeleyed instanceof rs){let e=this.geometryCreateDeleyed,t=this.chooseGeoemtryCache(e),i=this.dataPatched.geometry;this.geometryCreateDeleyed=t.get(i,e,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return O.is2DParametricMesh(e.type)&&0===e.depth}get is2DType(){return O.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return"NonParametricGeometry"===this.geometry.userData.type}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),s(e.path,["geometry"])&&this.updateByPatchedOpGeometry(M.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(void 0!==e&&void 0!==e.sxPrev)return[e.sxPrev,e.syPrev,e.szPrev]}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if("NonParametricGeometry"===i||"SubdivGeometry"===i){let i,r,s,n=e;if(void 0===this.localGeometry){let e={...this.data.geometry,...n};this.localGeometry=fr(e,t,this.data.flatShading,this)}n.scaleBaked?[i,r,s]=n.scaleBaked:({width:i,height:r,depth:s}=n);let a=this.localGeometry.userData,o="number"==typeof i?i:1,l="number"==typeof r?r:1,h="number"==typeof s?s:1;void 0!==a.sxPrev&&br(this.localGeometry.attributes,o/a.sxPrev,l/a.syPrev,h/a.szPrev),a.sxPrev=o,a.syPrev=l,a.szPrev=h}else{let i=fr({...this.data.geometry,...e},t,this.data.flatShading,this);void 0!==this.localGeometry&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&vr(this.localGeometry,i)?i.dispose():(this.localGeometry?.dispose(),this.localGeometry=i)}}refreshAttachedClonersInteractions(e){for(let t of this.attachedSurfaceCloners)t.update(e)}refreshAttachedCloners(e){for(let t of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(t.object)}refreshAttachedPaths(e){for(let t of this.attachedPaths)e.scene.addPendingCommand(()=>t.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,t,i){let r=!1;if(0===e.type&&0===e.path.length&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Er&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&0===e.type&&0===e.path.length&&Ir(e.props)&&this.geometryCreateDeleyed instanceof Er&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(t),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&0===e.type&&0===e.path.length&&this.geometryCreateDeleyed instanceof ce&&!(this.geometryCreateDeleyed instanceof Er)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&void 0!==this._geometryCacheKey){let e=i.shared,t=this.chooseGeoemtryCache(e),s=this.geometryCreateDeleyed;if(t.getCached(this._geometryCacheKey)===s&&!0!==s.isShared){let n=this.dataPatched.geometry,a=fr(n,e,this.data.flatShading,this);vr(s,a)?(a.dispose(),s.computeBoundingSphere(),t.mutateIfUnique(this._geometryCacheKey,n)):(a.computeBoundingSphere(),t.forceDelete(this._geometryCacheKey),t.adopt(n,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=n,r=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}applyTransientGeometryData(e,t){let i=e.shared,r=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof ce&&!(this.geometryCreateDeleyed instanceof Er)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&void 0!==this._geometryCacheKey){let t=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(t.getCached(this._geometryCacheKey)===s&&!0!==s.isShared){let n=fr(r,i,this.data.flatShading,this);return vr(s,n)?(n.dispose(),s.computeBoundingSphere(),t.mutateIfUnique(this._geometryCacheKey,r)):(n.computeBoundingSphere(),t.forceDelete(this._geometryCacheKey),t.adopt(r,n),this.geometryCreateDeleyed=n),this._geometryCacheKey=r,this.refreshAttachedCloners(e),void this.refreshAttachedPaths(e)}}t&&void 0!==this._geometryCacheKey&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,t){void 0!==e.geometry&&this.updateGeometryOnStateUpdate(e.geometry,t);let i=e.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:e,value:r}}of i)this.updateMorphInfluences(e,t.shared.getVariable(r,[this.uuid,"morphTargetInfluences",e]))}super.updateState(e,t)}updateMorphInfluences(e,t){if(void 0===this.morphTargetDictionary)return;let i=this.morphTargetDictionary[e];void 0!==i&&(this.morphTargetInfluences[i]=t)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&0===this.geometry.groups.length&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,t){let i=this.geometry.userData.parameters;this.is2DType?e.set(0,0,.5*i.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?e.fromArray(i.centerOffset):e.setScalar(0),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let t=new H,i=this.geometry.attributes.skinWeight;for(let e=0,r=i.count;e<r;e++){t.fromBufferAttribute(i,e);let r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),i.setXYZW(e,t.x,t.y,t.z,t.w)}}boneTransform(e,t){let i=this.skeleton;if(void 0===i)return;let r=this.geometry;ls.fromBufferAttribute(r.attributes.skinIndex,e),hs.fromBufferAttribute(r.attributes.skinWeight,e),os.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=hs.getComponent(e);if(0!==r){let s=ls.getComponent(e);us.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(ds.copy(os).applyMatrix4(us),r)}}return t.applyMatrix4(this.bindMatrixInverse)}};export{be as a,we as b,hi as c,ui as d,pi as e,ci as f,ss as g,gi as h,qr as i,yi as j,Si as k,Mi as l,Ai as m,Ae as n,_e as o,Yi as p,Se as q,Oe as r,Ve as s,Et as t,It as u,Dt as v,Ut as w,Li as x,Fi as y,Vi as z,ji as A,qt as B,Hi as C,Wi as D,Er as E,Ir as F,Dr as G,cr as H,fr as I,Xt as J,$t as K,Zt as L,Jt as M,Qt as N,ii as O,ri as P,si as Q,ni as R,ai as S,oi as T,Rr as U,Gr as V,Tr as W,Nr as X,kr as Y,Fr as Z,Vr as _,Hr as $,$r as aa,rs as ba,ns as ca,as as da,ps as ea};
@@ -1 +1 @@
1
- import{D as e,d as a,e as t,f as r,w as n,y as o}from"./runtime-chunk-ZE3Y3273.js";var i,d,l,u,s,f,c,p,h,g,A,b,m,y,w,D,v,k,B,S,j,x;(i||(i={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"},(d||(d={})).is=function(e){return!0},(u=l||(l={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},u.merge=function(e,a){return{position:a?.position??e.position,rotation:a?.rotation??e.rotation,scale:a?.scale??e.scale,shear:a?.shear??e.shear}},u.diff=function(e,t){return a({position:o.isEqual(e.position,t.position)?void 0:t.position,rotation:e.rotation===t.rotation?void 0:t.rotation,scale:o.isEqual(e.scale,t.scale)?void 0:t.scale,shear:e.shear&&t.shear&&o.isEqual(e.shear,t.shear)?void 0:t.shear})},(s||(s={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(f||(f={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(c||(c={})).defaultData={opacity:1,fill:{color:e.fromHexAndA(n,1),enabled:!0},stroke:{color:e.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:e.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:e.from0to1([0,0,0,1]),enabled:!1,spread:0}},(h=p||(p={})).newEmpty=function(e,a){return{name:a}},h.patch=function(e,a){if(void 0===a)return e;let t={...e};return Object.assign(t,l.merge(t,a)),t=function(e,a){if(void 0===a)return e;let t={...e},r=["width","height","cornerRadius"];for(let e of r)e in t&&e in a&&void 0!==a[e]&&Object.assign(t,{[e]:a[e]});return t}(t,a),t=function(e,a){if(void 0===a)return e;let t={...e};return"fill"in t&&"fill"in a&&void 0!==a.fill&&Object.assign(t,{fill:{...t.fill,...a.fill}}),"stroke"in t&&"stroke"in a&&void 0!==a.stroke&&Object.assign(t,{stroke:{...t.stroke,...a.stroke}}),"layerBlur"in t&&"layerBlur"in a&&void 0!==a.layerBlur&&Object.assign(t,{layerBlur:{...t.layerBlur,...a.layerBlur}}),"backgroundBlur"in t&&"backgroundBlur"in a&&void 0!==a.backgroundBlur&&Object.assign(t,{backgroundBlur:{...t.backgroundBlur,...a.backgroundBlur}}),"dropShadow"in t&&"dropShadow"in a&&void 0!==a.dropShadow&&Object.assign(t,{dropShadow:{...t.dropShadow,...a.dropShadow}}),"innerShadow"in t&&"innerShadow"in a&&void 0!==a.innerShadow&&Object.assign(t,{innerShadow:{...t.innerShadow,...a.innerShadow}}),t}(t,a),t},h.toOps=function(e,a){let t,r=[];for(let[e,n]of Object.entries(a))"name"!==e&&(void 0===t&&(t={path:[],props:{},type:0},r.push(t)),t.props[e]=n);return r},(g||(g={})).defaultData={...l.defaultData,...s.defaultData,states:new r,events:new r,visible:!0,raycastLock:!1},(A||(A={})).defaultData={...g.defaultData,...c.defaultData},(b||(b={})).defaultData={cornerRadius:[0,0,0,0]},(m||(m={})).defaultData={...A.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(y||(y={})).defaultData={...A.defaultData,...b.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(w||(w={})).defaultData={...A.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"},(D||(D={})).defaultData={...A.defaultData,type:"path2d",path:"",name:"Path"},(v||(v={})).is=function(e){return"ellipse2d"===e.type||"rectangle2d"===e.type||"text2d"===e.type||"vector2d"===e.type||"path2d"===e.type},(k||(k={})).defaultData={...g.defaultData,name:"Group",type:"group2d"},(B||(B={})).defaultData=()=>({...g.defaultData,...b.defaultData,...c.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:e.fromHexAndA(4737101,1),enabled:!0},stroke:{color:e.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(e=>{e.defaultData=function(e){switch(e){case"rectangle2d":case"vector2d":return{...y.defaultData};case"ellipse2d":return{...m.defaultData};case"text2d":return{...w.defaultData};case"path2d":return{...D.defaultData};case"frame2d":return{...B.defaultData()};case"group2d":return{...k.defaultData}}},e.getPivot=function(e){return"width"in e&&"height"in e?["number"==typeof e.width?.5*e.width:0,"number"==typeof e.height?.5*e.height:0]:[0,0]},e.isResizeable=function(e){return"rectangle2d"===e.type||"ellipse2d"===e.type||"text2d"===e.type||"frame2d"===e.type},e.isAutoLayoutable=function(e){return"frame2d"===e.type&&void 0!==e.autoLayout},e.hasCorners=function(e){return"rectangle2d"===e.type||"frame2d"===e.type}})(S||(S={})),(x=j||(j={})).defaultData={name:"UI",type:"scene2d",objects:new t},x.emptyData=function(){return{type:"scene2d",objects:new t}};export{i as a,p as b,y as c,k as d,S as e,j as f};
1
+ import{D as e,d as a,e as t,f as r,w as n,y as o}from"./runtime-chunk-WKTS4T2Q.js";var i,d,l,u,s,f,c,p,h,g,A,b,m,y,w,D,v,k,S,B,j,x;(i||(i={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"},(d||(d={})).is=function(e){return!0},(u=l||(l={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},u.merge=function(e,a){return{position:a?.position??e.position,rotation:a?.rotation??e.rotation,scale:a?.scale??e.scale,shear:a?.shear??e.shear}},u.diff=function(e,t){return a({position:o.isEqual(e.position,t.position)?void 0:t.position,rotation:e.rotation===t.rotation?void 0:t.rotation,scale:o.isEqual(e.scale,t.scale)?void 0:t.scale,shear:e.shear&&t.shear&&o.isEqual(e.shear,t.shear)?void 0:t.shear})},(s||(s={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(f||(f={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(c||(c={})).defaultData={opacity:1,fill:{color:e.fromHexAndA(n,1),enabled:!0},stroke:{color:e.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:e.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:e.from0to1([0,0,0,1]),enabled:!1,spread:0}},(h=p||(p={})).newEmpty=function(e,a){return{name:a}},h.patch=function(e,a){if(void 0===a)return e;let t={...e};return Object.assign(t,l.merge(t,a)),t=function(e,a){if(void 0===a)return e;let t={...e},r=["width","height","cornerRadius"];for(let e of r)e in t&&e in a&&void 0!==a[e]&&Object.assign(t,{[e]:a[e]});return t}(t,a),t=function(e,a){if(void 0===a)return e;let t={...e};return"fill"in t&&"fill"in a&&void 0!==a.fill&&Object.assign(t,{fill:{...t.fill,...a.fill}}),"stroke"in t&&"stroke"in a&&void 0!==a.stroke&&Object.assign(t,{stroke:{...t.stroke,...a.stroke}}),"layerBlur"in t&&"layerBlur"in a&&void 0!==a.layerBlur&&Object.assign(t,{layerBlur:{...t.layerBlur,...a.layerBlur}}),"backgroundBlur"in t&&"backgroundBlur"in a&&void 0!==a.backgroundBlur&&Object.assign(t,{backgroundBlur:{...t.backgroundBlur,...a.backgroundBlur}}),"dropShadow"in t&&"dropShadow"in a&&void 0!==a.dropShadow&&Object.assign(t,{dropShadow:{...t.dropShadow,...a.dropShadow}}),"innerShadow"in t&&"innerShadow"in a&&void 0!==a.innerShadow&&Object.assign(t,{innerShadow:{...t.innerShadow,...a.innerShadow}}),t}(t,a),t},h.toOps=function(e,a){let t,r=[];for(let[e,n]of Object.entries(a))"name"!==e&&(void 0===t&&(t={path:[],props:{},type:0},r.push(t)),t.props[e]=n);return r},(g||(g={})).defaultData={...l.defaultData,...s.defaultData,states:new r,events:new r,visible:!0,raycastLock:!1},(A||(A={})).defaultData={...g.defaultData,...c.defaultData},(b||(b={})).defaultData={cornerRadius:[0,0,0,0]},(m||(m={})).defaultData={...A.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(y||(y={})).defaultData={...A.defaultData,...b.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(w||(w={})).defaultData={...A.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"},(D||(D={})).defaultData={...A.defaultData,type:"path2d",path:"",name:"Path"},(v||(v={})).is=function(e){return"ellipse2d"===e.type||"rectangle2d"===e.type||"text2d"===e.type||"vector2d"===e.type||"path2d"===e.type},(k||(k={})).defaultData={...g.defaultData,name:"Group",type:"group2d"},(S||(S={})).defaultData=()=>({...g.defaultData,...b.defaultData,...c.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:e.fromHexAndA(4737101,1),enabled:!0},stroke:{color:e.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(e=>{e.defaultData=function(e){switch(e){case"rectangle2d":case"vector2d":return{...y.defaultData};case"ellipse2d":return{...m.defaultData};case"text2d":return{...w.defaultData};case"path2d":return{...D.defaultData};case"frame2d":return{...S.defaultData()};case"group2d":return{...k.defaultData}}},e.getPivot=function(e){return"width"in e&&"height"in e?["number"==typeof e.width?.5*e.width:0,"number"==typeof e.height?.5*e.height:0]:[0,0]},e.isResizeable=function(e){return"rectangle2d"===e.type||"ellipse2d"===e.type||"text2d"===e.type||"frame2d"===e.type},e.isAutoLayoutable=function(e){return"frame2d"===e.type&&void 0!==e.autoLayout},e.hasCorners=function(e){return"rectangle2d"===e.type||"frame2d"===e.type}})(B||(B={})),(x=j||(j={})).defaultData={name:"UI",type:"scene2d",objects:new t},x.emptyData=function(){return{type:"scene2d",objects:new t}};export{i as a,p as b,y as c,k as d,B as e,j as f};
@@ -1 +1 @@
1
- import{j as e}from"./runtime-chunk-T5W7UUKQ.js";import{Ed as t,Fc as r,Oc as i,We as n,cd as a,jd as o}from"./runtime-chunk-BVVSZMXD.js";var s;(s||(s={})).is=e=>"objectHelper"in e;var l=(r,i)=>class extends(e(r)){constructor(){super(...arguments),this.objectHelper=new i(this),this.gizmos={}}get geometryHelper(){return i.geometryHelper}raycast(e,t){this.objectHelper.raycast(e,t)}showGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof n&&(t.visible=!0)}}updateEntityBoxSize(e,r){this.objectHelper.visible&&this.geometryHelper instanceof t?(e.setScalar(0),r.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(e,r)}hideGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof n&&(t.visible=!1)}}},c=e=>{var r;return(r=class extends e{}).geometryHelper=new t(30,30,30),r},p=new o,u=new a,m=new i,f=(e,t,i,n,a=!1,o=e)=>{let s=t,l=o.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),u.copy(s.boundingSphere),u.applyMatrix4(l),!1===i.ray.intersectsSphere(u)||(m.copy(l).invert(),p.copy(i.ray).applyMatrix4(m),null!==s.boundingBox&&!1===p.intersectsBox(s.boundingBox)))return;let c,f,h,d,g,y,x=s.index,b=s.attributes.position,w=s.drawRange;if(!1===a){for(g=Math.max(0,w.start),y=Math.min(x.count,w.start+w.count);g<y;g+=3)if(f=x.getX(g),h=x.getX(g+1),d=x.getX(g+2),c=B(e,i,p,b,f,h,d),c)return c.faceIndex=Math.floor(g/3),void n.push(c)}else{let t=s.attributes.position,a=new r,l=new r,c=new r,u=new r,m=2,f=1/((o.scale.x+o.scale.y+o.scale.z)/3),h=f*f;for(let r=Math.max(0,w.start),s=Math.min(t.count,w.start+w.count)-1;r<s;r+=m){if(a.fromBufferAttribute(t,r),l.fromBufferAttribute(t,r+1),p.distanceSqToSegment(a,l,u,c)>h)continue;u.applyMatrix4(o.matrixWorld);let s=i.ray.origin.distanceTo(u);s<i.near||s>i.far||n.push({distance:s,point:c.clone().applyMatrix4(o.matrixWorld),object:e})}}function B(e,t,i,n,a,o,s){let l=new r,c=new r,p=new r,u=new r,m=new r;if(l.fromBufferAttribute(n,a),c.fromBufferAttribute(n,o),p.fromBufferAttribute(n,s),null===i.intersectTriangle(l,c,p,!1,u))return null;m.copy(u),m.applyMatrix4(e.matrixWorld);let f=t.ray.origin.distanceTo(m);return f<t.near||f>t.far?null:{faceIndex:1,distance:f,point:m.clone(),object:e}}};export{c as a,f as b,s as c,l as d};
1
+ import{j as e}from"./runtime-chunk-5LF7U7QS.js";import{Ed as t,Fc as r,Oc as i,We as n,cd as a,jd as o}from"./runtime-chunk-BVVSZMXD.js";var s;(s||(s={})).is=e=>"objectHelper"in e;var l=(r,i)=>class extends(e(r)){constructor(){super(...arguments),this.objectHelper=new i(this),this.gizmos={}}get geometryHelper(){return i.geometryHelper}raycast(e,t){this.objectHelper.raycast(e,t)}showGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof n&&(t.visible=!0)}}updateEntityBoxSize(e,r){this.objectHelper.visible&&this.geometryHelper instanceof t?(e.setScalar(0),r.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(e,r)}hideGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof n&&(t.visible=!1)}}},c=e=>{var r;return(r=class extends e{}).geometryHelper=new t(30,30,30),r},p=new o,u=new a,m=new i,f=(e,t,i,n,a=!1,o=e)=>{let s=t,l=o.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),u.copy(s.boundingSphere),u.applyMatrix4(l),!1===i.ray.intersectsSphere(u)||(m.copy(l).invert(),p.copy(i.ray).applyMatrix4(m),null!==s.boundingBox&&!1===p.intersectsBox(s.boundingBox)))return;let c,f,h,d,g,y,x=s.index,b=s.attributes.position,w=s.drawRange;if(!1===a){for(g=Math.max(0,w.start),y=Math.min(x.count,w.start+w.count);g<y;g+=3)if(f=x.getX(g),h=x.getX(g+1),d=x.getX(g+2),c=B(e,i,p,b,f,h,d),c)return c.faceIndex=Math.floor(g/3),void n.push(c)}else{let t=s.attributes.position,a=new r,l=new r,c=new r,u=new r,m=2,f=1/((o.scale.x+o.scale.y+o.scale.z)/3),h=f*f;for(let r=Math.max(0,w.start),s=Math.min(t.count,w.start+w.count)-1;r<s;r+=m){if(a.fromBufferAttribute(t,r),l.fromBufferAttribute(t,r+1),p.distanceSqToSegment(a,l,u,c)>h)continue;u.applyMatrix4(o.matrixWorld);let s=i.ray.origin.distanceTo(u);s<i.near||s>i.far||n.push({distance:s,point:c.clone().applyMatrix4(o.matrixWorld),object:e})}}function B(e,t,i,n,a,o,s){let l=new r,c=new r,p=new r,u=new r,m=new r;if(l.fromBufferAttribute(n,a),c.fromBufferAttribute(n,o),p.fromBufferAttribute(n,s),null===i.intersectTriangle(l,c,p,!1,u))return null;m.copy(u),m.applyMatrix4(e.matrixWorld);let f=t.ray.origin.distanceTo(m);return f<t.near||f>t.far?null:{faceIndex:1,distance:f,point:m.clone(),object:e}}};export{c as a,f as b,s as c,l as d};