@splinetool/runtime 2.0.2 → 2.0.4

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 (349) hide show
  1. package/build/boolean.js +24 -0
  2. package/build/boolean.js.br +0 -0
  3. package/build/boolean.js.gz +0 -0
  4. package/build/boolean.wasm +0 -0
  5. package/build/boolean.wasm.br +0 -0
  6. package/build/boolean.wasm.gz +0 -0
  7. package/build/hana-ui.js +78 -46
  8. package/build/hana-ui.js.br +0 -0
  9. package/build/hana-ui.js.gz +0 -0
  10. package/build/hana-ui.wasm +0 -0
  11. package/build/hana-ui.wasm.br +0 -0
  12. package/build/hana-ui.wasm.gz +0 -0
  13. package/build/runtime-aiAssistant-RMA2DMFU.js +1 -0
  14. package/build/runtime-aiAssistant-RMA2DMFU.js.br +0 -0
  15. package/build/runtime-aiAssistant-RMA2DMFU.js.gz +0 -0
  16. package/build/runtime-apiServices-KA4FEP5Y.js +1 -0
  17. package/build/runtime-apiServices-KA4FEP5Y.js.br +0 -0
  18. package/build/runtime-apiServices-KA4FEP5Y.js.gz +0 -0
  19. package/build/{runtime-audio-Y3GYW4YQ.js → runtime-audio-BQSRM3W2.js} +1 -1
  20. package/build/runtime-audio-BQSRM3W2.js.br +0 -0
  21. package/build/runtime-audio-BQSRM3W2.js.gz +0 -0
  22. package/build/runtime-chunk-2PT2WH66.js +1 -0
  23. package/build/runtime-chunk-2PT2WH66.js.br +0 -0
  24. package/build/runtime-chunk-2PT2WH66.js.gz +0 -0
  25. package/build/{runtime-chunk-P2XISQYQ.js → runtime-chunk-36FZTFCC.js} +1 -1
  26. package/build/runtime-chunk-36FZTFCC.js.br +0 -0
  27. package/build/runtime-chunk-36FZTFCC.js.gz +0 -0
  28. package/build/runtime-chunk-3J5YHSQW.js +1 -0
  29. package/build/runtime-chunk-3J5YHSQW.js.br +0 -0
  30. package/build/runtime-chunk-3J5YHSQW.js.gz +0 -0
  31. package/build/{runtime-chunk-FF5REN2J.js → runtime-chunk-4I22JDL6.js} +1 -1
  32. package/build/runtime-chunk-4I22JDL6.js.br +0 -0
  33. package/build/runtime-chunk-4I22JDL6.js.gz +0 -0
  34. package/build/{runtime-chunk-Z5OH244S.js → runtime-chunk-5XUI4Z6R.js} +1 -1
  35. package/build/runtime-chunk-5XUI4Z6R.js.br +0 -0
  36. package/build/runtime-chunk-5XUI4Z6R.js.gz +0 -0
  37. package/build/runtime-chunk-6UUF5VIS.js +1 -0
  38. package/build/runtime-chunk-6UUF5VIS.js.br +0 -0
  39. package/build/runtime-chunk-6UUF5VIS.js.gz +0 -0
  40. package/build/{runtime-chunk-P3254QGK.js → runtime-chunk-CIBY4YG3.js} +1 -1
  41. package/build/runtime-chunk-CIBY4YG3.js.br +0 -0
  42. package/build/runtime-chunk-CIBY4YG3.js.gz +0 -0
  43. package/build/{runtime-chunk-MRUNX43X.js → runtime-chunk-DKGQ6OYZ.js} +1 -1
  44. package/build/runtime-chunk-DKGQ6OYZ.js.br +0 -0
  45. package/build/runtime-chunk-DKGQ6OYZ.js.gz +0 -0
  46. package/build/{runtime-chunk-A2LYIKKC.js → runtime-chunk-DSJY3WL2.js} +1 -1
  47. package/build/{runtime-chunk-A2LYIKKC.js.br → runtime-chunk-DSJY3WL2.js.br} +0 -0
  48. package/build/runtime-chunk-DSJY3WL2.js.gz +0 -0
  49. package/build/{runtime-chunk-RQ3ZQR4P.js → runtime-chunk-ESZD4IRS.js} +1 -1
  50. package/build/runtime-chunk-ESZD4IRS.js.br +0 -0
  51. package/build/runtime-chunk-ESZD4IRS.js.gz +0 -0
  52. package/build/{runtime-chunk-OEXC34HT.js → runtime-chunk-GPACKOH2.js} +1 -1
  53. package/build/runtime-chunk-GPACKOH2.js.br +0 -0
  54. package/build/runtime-chunk-GPACKOH2.js.gz +0 -0
  55. package/build/{runtime-chunk-BJVCOW72.js → runtime-chunk-I5QFGBIU.js} +1 -1
  56. package/build/runtime-chunk-I5QFGBIU.js.br +0 -0
  57. package/build/runtime-chunk-I5QFGBIU.js.gz +0 -0
  58. package/build/{runtime-chunk-HJS3VFEN.js → runtime-chunk-JNSHQPHC.js} +1 -1
  59. package/build/runtime-chunk-JNSHQPHC.js.br +0 -0
  60. package/build/runtime-chunk-JNSHQPHC.js.gz +0 -0
  61. package/build/{runtime-chunk-JFYHGEDN.js → runtime-chunk-LT4UVXE2.js} +1 -1
  62. package/build/runtime-chunk-LT4UVXE2.js.br +0 -0
  63. package/build/runtime-chunk-LT4UVXE2.js.gz +0 -0
  64. package/build/{runtime-chunk-PPLLJM75.js → runtime-chunk-NTW4X3NC.js} +1 -1
  65. package/build/runtime-chunk-NTW4X3NC.js.br +0 -0
  66. package/build/runtime-chunk-NTW4X3NC.js.gz +0 -0
  67. package/build/runtime-chunk-OOC7YSI5.js +1 -0
  68. package/build/runtime-chunk-OOC7YSI5.js.br +0 -0
  69. package/build/runtime-chunk-OOC7YSI5.js.gz +0 -0
  70. package/build/runtime-chunk-QVC5UDJO.js +1 -0
  71. package/build/runtime-chunk-QVC5UDJO.js.br +0 -0
  72. package/build/runtime-chunk-QVC5UDJO.js.gz +0 -0
  73. package/build/runtime-chunk-R7NC6CZZ.js +1 -0
  74. package/build/runtime-chunk-R7NC6CZZ.js.br +0 -0
  75. package/build/runtime-chunk-R7NC6CZZ.js.gz +0 -0
  76. package/build/{runtime-chunk-VRVV54WH.js → runtime-chunk-RF63UVAU.js} +1 -1
  77. package/build/runtime-chunk-RF63UVAU.js.br +0 -0
  78. package/build/runtime-chunk-RF63UVAU.js.gz +0 -0
  79. package/build/{runtime-chunk-TDCFE5IE.js → runtime-chunk-SL64ZYCB.js} +1 -1
  80. package/build/runtime-chunk-SL64ZYCB.js.br +0 -0
  81. package/build/runtime-chunk-SL64ZYCB.js.gz +0 -0
  82. package/build/{runtime-chunk-I47C4XJU.js → runtime-chunk-TPKGBIJU.js} +1 -1
  83. package/build/runtime-chunk-TPKGBIJU.js.br +0 -0
  84. package/build/runtime-chunk-TPKGBIJU.js.gz +0 -0
  85. package/build/{runtime-chunk-LSURXI4Y.js → runtime-chunk-V5NUL7BL.js} +1 -1
  86. package/build/runtime-chunk-V5NUL7BL.js.br +1 -0
  87. package/build/runtime-chunk-V5NUL7BL.js.gz +0 -0
  88. package/build/{runtime-chunk-OLJVVNDS.js → runtime-chunk-V7XDOE2W.js} +1 -1
  89. package/build/runtime-chunk-V7XDOE2W.js.br +0 -0
  90. package/build/runtime-chunk-V7XDOE2W.js.gz +0 -0
  91. package/build/{runtime-chunk-QHPFAHXN.js → runtime-chunk-W4ZCHGLQ.js} +1 -1
  92. package/build/runtime-chunk-W4ZCHGLQ.js.br +0 -0
  93. package/build/runtime-chunk-W4ZCHGLQ.js.gz +0 -0
  94. package/build/runtime-chunk-WHKBOV2O.js +1 -0
  95. package/build/runtime-chunk-WHKBOV2O.js.br +0 -0
  96. package/build/runtime-chunk-WHKBOV2O.js.gz +0 -0
  97. package/build/{runtime-chunk-E6JCDSXC.js → runtime-chunk-WMWQXAOH.js} +1 -1
  98. package/build/runtime-chunk-WMWQXAOH.js.br +0 -0
  99. package/build/runtime-chunk-WMWQXAOH.js.gz +0 -0
  100. package/build/runtime-chunk-YFAATRJU.js +1 -0
  101. package/build/runtime-chunk-YFAATRJU.js.br +0 -0
  102. package/build/runtime-chunk-YFAATRJU.js.gz +0 -0
  103. package/build/runtime-chunk-ZJPGZKPX.js +1 -0
  104. package/build/runtime-chunk-ZJPGZKPX.js.br +0 -0
  105. package/build/runtime-chunk-ZJPGZKPX.js.gz +0 -0
  106. package/build/{runtime-chunk-2SYZJBYJ.js → runtime-chunk-ZMXEX5NX.js} +1 -1
  107. package/build/runtime-chunk-ZMXEX5NX.js.br +0 -0
  108. package/build/runtime-chunk-ZMXEX5NX.js.gz +0 -0
  109. package/build/{runtime-classicRuntime-AMAXBOXT.js → runtime-classicRuntime-UOZ6RID5.js} +1 -1
  110. package/build/runtime-classicRuntime-UOZ6RID5.js.br +0 -0
  111. package/build/runtime-classicRuntime-UOZ6RID5.js.gz +0 -0
  112. package/build/runtime-cloners-DALMNZYL.js +1 -0
  113. package/build/runtime-cloners-DALMNZYL.js.br +0 -0
  114. package/build/runtime-cloners-DALMNZYL.js.gz +0 -0
  115. package/build/{runtime-components-EPAMFKSB.js → runtime-components-IGNRKI6T.js} +1 -1
  116. package/build/runtime-components-IGNRKI6T.js.br +0 -0
  117. package/build/runtime-components-IGNRKI6T.js.gz +0 -0
  118. package/build/runtime-conditional-DCOFCW5I.js +1 -0
  119. package/build/runtime-conditional-DCOFCW5I.js.br +0 -0
  120. package/build/runtime-conditional-DCOFCW5I.js.gz +0 -0
  121. package/build/{runtime-createDestroy-HLHRAAC4.js → runtime-createDestroy-JLB7IIQL.js} +1 -1
  122. package/build/runtime-createDestroy-JLB7IIQL.js.br +0 -0
  123. package/build/runtime-createDestroy-JLB7IIQL.js.gz +0 -0
  124. package/build/{runtime-dragDrop-K6LWK7FL.js → runtime-dragDrop-ERDSNA3S.js} +1 -1
  125. package/build/runtime-dragDrop-ERDSNA3S.js.br +0 -0
  126. package/build/runtime-dragDrop-ERDSNA3S.js.gz +0 -0
  127. package/build/runtime-gameControls-XKOQVZZC.js +1 -0
  128. package/build/runtime-gameControls-XKOQVZZC.js.br +0 -0
  129. package/build/runtime-gameControls-XKOQVZZC.js.gz +0 -0
  130. package/build/runtime-hair-EOZHA2BH.js +1 -0
  131. package/build/runtime-hair-EOZHA2BH.js.br +0 -0
  132. package/build/runtime-hair-EOZHA2BH.js.gz +0 -0
  133. package/build/runtime-mergeStaticGeometries-4Y3LE3VX.js +1 -0
  134. package/build/runtime-mergeStaticGeometries-4Y3LE3VX.js.br +0 -0
  135. package/build/runtime-mergeStaticGeometries-4Y3LE3VX.js.gz +0 -0
  136. package/build/{runtime-miscActions-L7BIGLEB.js → runtime-miscActions-KIRLTM7C.js} +1 -1
  137. package/build/runtime-miscActions-KIRLTM7C.js.br +0 -0
  138. package/build/runtime-miscActions-KIRLTM7C.js.gz +0 -0
  139. package/build/runtime-mouseHover-WULIJFG2.js +1 -0
  140. package/build/runtime-mouseHover-WULIJFG2.js.br +0 -0
  141. package/build/runtime-mouseHover-WULIJFG2.js.gz +0 -0
  142. package/build/{runtime-particles-W7YEQWJI.js → runtime-particles-NNV35DLD.js} +1 -1
  143. package/build/runtime-particles-NNV35DLD.js.br +0 -0
  144. package/build/runtime-particles-NNV35DLD.js.gz +0 -0
  145. package/build/{runtime-paths-CK327WCT.js → runtime-paths-RRXZ3PXM.js} +1 -1
  146. package/build/runtime-paths-RRXZ3PXM.js.br +0 -0
  147. package/build/runtime-paths-RRXZ3PXM.js.gz +0 -0
  148. package/build/runtime-resize-V6LZSOZB.js +1 -0
  149. package/build/runtime-resize-V6LZSOZB.js.br +0 -0
  150. package/build/runtime-resize-V6LZSOZB.js.gz +0 -0
  151. package/build/{runtime-sceneTransition-7AG4A4P5.js → runtime-sceneTransition-CP5TI3VP.js} +1 -1
  152. package/build/runtime-sceneTransition-CP5TI3VP.js.br +0 -0
  153. package/build/runtime-sceneTransition-CP5TI3VP.js.gz +0 -0
  154. package/build/{runtime-scroll-MNQPPLQL.js → runtime-scroll-Q7VGS5NM.js} +1 -1
  155. package/build/runtime-scroll-Q7VGS5NM.js.br +0 -0
  156. package/build/runtime-scroll-Q7VGS5NM.js.gz +0 -0
  157. package/build/runtime-shapeBlends-UN7GGFRG.js +1 -0
  158. package/build/runtime-shapeBlends-UN7GGFRG.js.br +0 -0
  159. package/build/runtime-shapeBlends-UN7GGFRG.js.gz +0 -0
  160. package/build/{runtime-text-5RIKJ4US.js → runtime-text-N6XLUSM2.js} +1 -1
  161. package/build/runtime-text-N6XLUSM2.js.br +0 -0
  162. package/build/runtime-text-N6XLUSM2.js.gz +0 -0
  163. package/build/{runtime-textInputs-YBGYTAMD.js → runtime-textInputs-IW2E6BNU.js} +1 -1
  164. package/build/runtime-textInputs-IW2E6BNU.js.br +0 -0
  165. package/build/runtime-textInputs-IW2E6BNU.js.gz +0 -0
  166. package/build/runtime-timeline-JA2JZIS7.js +1 -0
  167. package/build/runtime-timeline-JA2JZIS7.js.br +0 -0
  168. package/build/runtime-timeline-JA2JZIS7.js.gz +0 -0
  169. package/build/{runtime-tracking-2BXFBQQY.js → runtime-tracking-M57J2PGK.js} +1 -1
  170. package/build/runtime-tracking-M57J2PGK.js.br +0 -0
  171. package/build/runtime-tracking-M57J2PGK.js.gz +0 -0
  172. package/build/{runtime-transitions-6PZW2QIW.js → runtime-transitions-PELRDE7B.js} +1 -1
  173. package/build/runtime-transitions-PELRDE7B.js.br +0 -0
  174. package/build/runtime-transitions-PELRDE7B.js.gz +0 -0
  175. package/build/runtime-ui2d-IOB5Y76W.js +1 -0
  176. package/build/runtime-ui2d-IOB5Y76W.js.br +0 -0
  177. package/build/runtime-ui2d-IOB5Y76W.js.gz +0 -0
  178. package/build/{runtime-variables-U36KPJ5V.js → runtime-variables-Q6Q2JCGI.js} +1 -1
  179. package/build/runtime-variables-Q6Q2JCGI.js.br +0 -0
  180. package/build/runtime-variables-Q6Q2JCGI.js.gz +0 -0
  181. package/build/{runtime-vectorShapes-4HPEEN3B.js → runtime-vectorShapes-ISY7MWHY.js} +1 -1
  182. package/build/runtime-vectorShapes-ISY7MWHY.js.br +0 -0
  183. package/build/runtime-vectorShapes-ISY7MWHY.js.gz +0 -0
  184. package/build/runtime-video-DUDXGADJ.js +1 -0
  185. package/build/runtime-video-DUDXGADJ.js.br +0 -0
  186. package/build/runtime-video-DUDXGADJ.js.gz +0 -0
  187. package/build/runtime-webgpu-4ZCV5EAD.js +1 -0
  188. package/build/runtime-webgpu-4ZCV5EAD.js.br +0 -0
  189. package/build/runtime-webgpu-4ZCV5EAD.js.gz +0 -0
  190. package/build/runtime.cjs +365 -365
  191. package/build/runtime.js +1 -1
  192. package/build/runtime.js.br +0 -0
  193. package/build/runtime.js.gz +0 -0
  194. package/build/runtime.standalone.js +1 -1
  195. package/build/runtime.standalone.js.br +0 -0
  196. package/build/runtime.standalone.js.gz +0 -0
  197. package/build/runtime.standalone.webgl.js +1 -1
  198. package/build/runtime.standalone.webgl.js.br +0 -0
  199. package/build/runtime.standalone.webgl.js.gz +0 -0
  200. package/build/runtime.standalone.webgpu.js +1 -1
  201. package/build/runtime.standalone.webgpu.js.br +0 -0
  202. package/build/runtime.standalone.webgpu.js.gz +0 -0
  203. package/build/runtime.standalone.webgpu.micro.js +1 -1
  204. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  205. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  206. package/build/runtime.standalone.webgpu.min.js +1 -1
  207. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  208. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  209. package/package.json +1 -1
  210. package/build/runtime-aiAssistant-XJVJ7TQB.js +0 -1
  211. package/build/runtime-aiAssistant-XJVJ7TQB.js.br +0 -0
  212. package/build/runtime-aiAssistant-XJVJ7TQB.js.gz +0 -0
  213. package/build/runtime-apiServices-KAO5SQJZ.js +0 -1
  214. package/build/runtime-apiServices-KAO5SQJZ.js.br +0 -0
  215. package/build/runtime-apiServices-KAO5SQJZ.js.gz +0 -0
  216. package/build/runtime-audio-Y3GYW4YQ.js.br +0 -0
  217. package/build/runtime-audio-Y3GYW4YQ.js.gz +0 -0
  218. package/build/runtime-chunk-2SYZJBYJ.js.br +0 -0
  219. package/build/runtime-chunk-2SYZJBYJ.js.gz +0 -0
  220. package/build/runtime-chunk-2Y73BLCY.js +0 -1
  221. package/build/runtime-chunk-2Y73BLCY.js.br +0 -0
  222. package/build/runtime-chunk-2Y73BLCY.js.gz +0 -0
  223. package/build/runtime-chunk-A2LYIKKC.js.gz +0 -0
  224. package/build/runtime-chunk-BJVCOW72.js.br +0 -0
  225. package/build/runtime-chunk-BJVCOW72.js.gz +0 -0
  226. package/build/runtime-chunk-CTHMLYOZ.js +0 -1
  227. package/build/runtime-chunk-CTHMLYOZ.js.br +0 -0
  228. package/build/runtime-chunk-CTHMLYOZ.js.gz +0 -0
  229. package/build/runtime-chunk-E6JCDSXC.js.br +0 -0
  230. package/build/runtime-chunk-E6JCDSXC.js.gz +0 -0
  231. package/build/runtime-chunk-FF5REN2J.js.br +0 -0
  232. package/build/runtime-chunk-FF5REN2J.js.gz +0 -0
  233. package/build/runtime-chunk-HJS3VFEN.js.br +0 -0
  234. package/build/runtime-chunk-HJS3VFEN.js.gz +0 -0
  235. package/build/runtime-chunk-HL3PBPHE.js +0 -1
  236. package/build/runtime-chunk-HL3PBPHE.js.br +0 -0
  237. package/build/runtime-chunk-HL3PBPHE.js.gz +0 -0
  238. package/build/runtime-chunk-I47C4XJU.js.br +0 -0
  239. package/build/runtime-chunk-I47C4XJU.js.gz +0 -0
  240. package/build/runtime-chunk-JFYHGEDN.js.br +0 -0
  241. package/build/runtime-chunk-JFYHGEDN.js.gz +0 -0
  242. package/build/runtime-chunk-K4FLB6Y7.js +0 -1
  243. package/build/runtime-chunk-K4FLB6Y7.js.br +0 -0
  244. package/build/runtime-chunk-K4FLB6Y7.js.gz +0 -0
  245. package/build/runtime-chunk-LSURXI4Y.js.br +0 -2
  246. package/build/runtime-chunk-LSURXI4Y.js.gz +0 -0
  247. package/build/runtime-chunk-MM75L5X4.js +0 -1
  248. package/build/runtime-chunk-MM75L5X4.js.br +0 -0
  249. package/build/runtime-chunk-MM75L5X4.js.gz +0 -0
  250. package/build/runtime-chunk-MRUNX43X.js.br +0 -0
  251. package/build/runtime-chunk-MRUNX43X.js.gz +0 -0
  252. package/build/runtime-chunk-OEXC34HT.js.br +0 -0
  253. package/build/runtime-chunk-OEXC34HT.js.gz +0 -0
  254. package/build/runtime-chunk-OLJVVNDS.js.br +0 -0
  255. package/build/runtime-chunk-OLJVVNDS.js.gz +0 -0
  256. package/build/runtime-chunk-P2XISQYQ.js.br +0 -0
  257. package/build/runtime-chunk-P2XISQYQ.js.gz +0 -0
  258. package/build/runtime-chunk-P3254QGK.js.br +0 -0
  259. package/build/runtime-chunk-P3254QGK.js.gz +0 -0
  260. package/build/runtime-chunk-PPLLJM75.js.br +0 -0
  261. package/build/runtime-chunk-PPLLJM75.js.gz +0 -0
  262. package/build/runtime-chunk-QHPFAHXN.js.br +0 -0
  263. package/build/runtime-chunk-QHPFAHXN.js.gz +0 -0
  264. package/build/runtime-chunk-QZ35BPGB.js +0 -1
  265. package/build/runtime-chunk-QZ35BPGB.js.br +0 -0
  266. package/build/runtime-chunk-QZ35BPGB.js.gz +0 -0
  267. package/build/runtime-chunk-RAX4YJZF.js +0 -1
  268. package/build/runtime-chunk-RAX4YJZF.js.br +0 -0
  269. package/build/runtime-chunk-RAX4YJZF.js.gz +0 -0
  270. package/build/runtime-chunk-RQ3ZQR4P.js.br +0 -0
  271. package/build/runtime-chunk-RQ3ZQR4P.js.gz +0 -0
  272. package/build/runtime-chunk-SKLNU6XK.js +0 -1
  273. package/build/runtime-chunk-SKLNU6XK.js.br +0 -0
  274. package/build/runtime-chunk-SKLNU6XK.js.gz +0 -0
  275. package/build/runtime-chunk-TDCFE5IE.js.br +0 -0
  276. package/build/runtime-chunk-TDCFE5IE.js.gz +0 -0
  277. package/build/runtime-chunk-VRVV54WH.js.br +0 -0
  278. package/build/runtime-chunk-VRVV54WH.js.gz +0 -0
  279. package/build/runtime-chunk-WSJURWOC.js +0 -1
  280. package/build/runtime-chunk-WSJURWOC.js.br +0 -0
  281. package/build/runtime-chunk-WSJURWOC.js.gz +0 -0
  282. package/build/runtime-chunk-Z5OH244S.js.br +0 -0
  283. package/build/runtime-chunk-Z5OH244S.js.gz +0 -0
  284. package/build/runtime-classicRuntime-AMAXBOXT.js.br +0 -0
  285. package/build/runtime-classicRuntime-AMAXBOXT.js.gz +0 -0
  286. package/build/runtime-cloners-4W3AOAQX.js +0 -1
  287. package/build/runtime-cloners-4W3AOAQX.js.br +0 -1
  288. package/build/runtime-cloners-4W3AOAQX.js.gz +0 -0
  289. package/build/runtime-components-EPAMFKSB.js.br +0 -0
  290. package/build/runtime-components-EPAMFKSB.js.gz +0 -0
  291. package/build/runtime-conditional-3A423CXW.js +0 -1
  292. package/build/runtime-conditional-3A423CXW.js.br +0 -0
  293. package/build/runtime-conditional-3A423CXW.js.gz +0 -0
  294. package/build/runtime-createDestroy-HLHRAAC4.js.br +0 -0
  295. package/build/runtime-createDestroy-HLHRAAC4.js.gz +0 -0
  296. package/build/runtime-dragDrop-K6LWK7FL.js.br +0 -0
  297. package/build/runtime-dragDrop-K6LWK7FL.js.gz +0 -0
  298. package/build/runtime-gameControls-ZJUUKNHM.js +0 -1
  299. package/build/runtime-gameControls-ZJUUKNHM.js.br +0 -0
  300. package/build/runtime-gameControls-ZJUUKNHM.js.gz +0 -0
  301. package/build/runtime-hair-AGUMVL55.js +0 -1
  302. package/build/runtime-hair-AGUMVL55.js.br +0 -3
  303. package/build/runtime-hair-AGUMVL55.js.gz +0 -0
  304. package/build/runtime-mergeStaticGeometries-AOGKOEBX.js +0 -1
  305. package/build/runtime-mergeStaticGeometries-AOGKOEBX.js.br +0 -0
  306. package/build/runtime-mergeStaticGeometries-AOGKOEBX.js.gz +0 -0
  307. package/build/runtime-miscActions-L7BIGLEB.js.br +0 -0
  308. package/build/runtime-miscActions-L7BIGLEB.js.gz +0 -0
  309. package/build/runtime-mouseHover-BI5SRQSQ.js +0 -1
  310. package/build/runtime-mouseHover-BI5SRQSQ.js.br +0 -0
  311. package/build/runtime-mouseHover-BI5SRQSQ.js.gz +0 -0
  312. package/build/runtime-particles-W7YEQWJI.js.br +0 -0
  313. package/build/runtime-particles-W7YEQWJI.js.gz +0 -0
  314. package/build/runtime-paths-CK327WCT.js.br +0 -0
  315. package/build/runtime-paths-CK327WCT.js.gz +0 -0
  316. package/build/runtime-resize-RUUW4IXW.js +0 -1
  317. package/build/runtime-resize-RUUW4IXW.js.br +0 -0
  318. package/build/runtime-resize-RUUW4IXW.js.gz +0 -0
  319. package/build/runtime-sceneTransition-7AG4A4P5.js.br +0 -0
  320. package/build/runtime-sceneTransition-7AG4A4P5.js.gz +0 -0
  321. package/build/runtime-scroll-MNQPPLQL.js.br +0 -0
  322. package/build/runtime-scroll-MNQPPLQL.js.gz +0 -0
  323. package/build/runtime-shapeBlends-IP5LZ63L.js +0 -1
  324. package/build/runtime-shapeBlends-IP5LZ63L.js.br +0 -0
  325. package/build/runtime-shapeBlends-IP5LZ63L.js.gz +0 -0
  326. package/build/runtime-text-5RIKJ4US.js.br +0 -0
  327. package/build/runtime-text-5RIKJ4US.js.gz +0 -0
  328. package/build/runtime-textInputs-YBGYTAMD.js.br +0 -0
  329. package/build/runtime-textInputs-YBGYTAMD.js.gz +0 -0
  330. package/build/runtime-timeline-32GBWMFJ.js +0 -1
  331. package/build/runtime-timeline-32GBWMFJ.js.br +0 -0
  332. package/build/runtime-timeline-32GBWMFJ.js.gz +0 -0
  333. package/build/runtime-tracking-2BXFBQQY.js.br +0 -0
  334. package/build/runtime-tracking-2BXFBQQY.js.gz +0 -0
  335. package/build/runtime-transitions-6PZW2QIW.js.br +0 -0
  336. package/build/runtime-transitions-6PZW2QIW.js.gz +0 -0
  337. package/build/runtime-ui2d-VEQUBXIE.js +0 -1
  338. package/build/runtime-ui2d-VEQUBXIE.js.br +0 -0
  339. package/build/runtime-ui2d-VEQUBXIE.js.gz +0 -0
  340. package/build/runtime-variables-U36KPJ5V.js.br +0 -0
  341. package/build/runtime-variables-U36KPJ5V.js.gz +0 -0
  342. package/build/runtime-vectorShapes-4HPEEN3B.js.br +0 -0
  343. package/build/runtime-vectorShapes-4HPEEN3B.js.gz +0 -0
  344. package/build/runtime-video-TZNR7MEM.js +0 -1
  345. package/build/runtime-video-TZNR7MEM.js.br +0 -0
  346. package/build/runtime-video-TZNR7MEM.js.gz +0 -0
  347. package/build/runtime-webgpu-YNY4OXCZ.js +0 -1
  348. package/build/runtime-webgpu-YNY4OXCZ.js.br +0 -0
  349. package/build/runtime-webgpu-YNY4OXCZ.js.gz +0 -0
@@ -1 +0,0 @@
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 s,b as r,f as n,h as a,k as o,l,m as h,t as d}from"./runtime-chunk-2Y73BLCY.js";import{c as u}from"./runtime-chunk-4KZXQGUQ.js";import{a as p,b as c}from"./runtime-chunk-Z5OH244S.js";import{c as m,i as g}from"./runtime-chunk-TZCHGFVF.js";import{A as f,Ha as y,Ia as v,J as b,V as x,a as w,c as S,fa as M,ia as O,l as A,na as P,o as _}from"./runtime-chunk-OW6T4XFV.js";import{$c as C,Aa as E,Ba as I,Cc as D,Dc as L,Ec as U,Ed as z,Fc as B,Fd as R,Gd as G,Hd as T,He 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 Z,Od as J,Pc as $,Qe as K,Rc as Q,Rd as ee,Tc as te,Td as ie,Ud as se,Vd as re,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 me,qa as ge,rd as fe,se as ye,yd as ve}from"./runtime-chunk-VGN7YHB7.js";function be(e,t=!1){let i=null!==e[0].index,s=new Set(Object.keys(e[0].attributes)),r=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(!s.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!==s.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(!r.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 s=0;s<e.length;++s){let r=e[s].index;for(let e=0;e<r.count;++e)i.push(r.getX(e)+t);t+=e[s].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 s=0;s<a[e].length;++s)t.push(a[e][s][i]);let s=xe(t);if(!s)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" morphAttribute."),null;l.morphAttributes[e].push(s)}}}return l}function xe(e){let t,i,s,r=-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===s&&(s=o.normalized),s!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===r&&(r=o.gpuType),r!==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,s),l=0;for(let t=0;t<e.length;++t){let s=e[t];if(s.isInterleavedBufferAttribute){let e=l/i;for(let t=0,r=s.count;t<r;t++)for(let r=0;r<i;r++){let i=s.getComponent(t,r);o.setComponent(t+e,r,i)}}else a.set(s.array,l);l+=s.count*i}return void 0!==r&&(o.gpuType=r),o}function we(e,t=1e-4){t=Math.max(t,Number.EPSILON);let i={},s=e.getIndex(),r=e.getAttribute("position"),n=s?s.count:r.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],s=e.attributes[i];l[i]=new s.constructor(new s.array.constructor(s.count*s.itemSize),s.itemSize,s.normalized);let r=e.morphAttributes[i];r&&(h[i]||(h[i]=[]),r.forEach((e,t)=>{let s=new e.array.constructor(e.count*e.itemSize);h[i][t]=new e.constructor(s,e.itemSize,e.normalized)}))}let c=.5*t,m=Math.log10(1/t),g=Math.pow(10,m),f=c*g;for(let t=0;t<n;t++){let r=s?s.getX(t):t,n="";for(let t=0,i=o.length;t<i;t++){let i=o[t],s=e.getAttribute(i),a=s.itemSize;for(let e=0;e<a;e++)n+=~~(s[u[e]](r)*g+f)+","}if(n in i)d.push(i[n]);else{for(let t=0,i=o.length;t<i;t++){let i=o[t],s=e.getAttribute(i),n=e.morphAttributes[i],d=s.itemSize,c=l[i],m=h[i];for(let e=0;e<d;e++){let t=u[e],i=p[e];if(c[i](a,s[t](r)),n)for(let e=0,s=n.length;e<s;e++)m[e][i](a,n[e][t](r))}}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,Ae=null;function Pe(e){Ae=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,s){Ce(e.vertLeq(t,i)&&e.vertLeq(i,s));var r=i.s-t.s,n=s.s-i.s;return r+n>0?r<n?i.t-t.t+(t.t-s.t)*(r/(r+n)):i.t-s.t+(s.t-t.t)*(n/(r+n)):0},e.edgeSign=function(t,i,s){Ce(e.vertLeq(t,i)&&e.vertLeq(i,s));var r=i.s-t.s,n=s.s-i.s;return r+n>0?(i.t-s.t)*r+(i.t-t.t)*n:0},e.transEval=function(t,i,s){Ce(e.transLeq(t,i)&&e.transLeq(i,s));var r=i.t-t.t,n=s.t-i.t;return r+n>0?r<n?i.s-t.s+(t.s-s.s)*(r/(r+n)):i.s-s.s+(s.s-t.s)*(n/(r+n)):0},e.transSign=function(t,i,s){Ce(e.transLeq(t,i)&&e.transLeq(i,s));var r=i.t-t.t,n=s.t-i.t;return r+n>0?(i.s-s.s)*r+(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,s){return(e=e<0?0:e)<=(i=i<0?0:i)?0===i?(t+s)/2:t+e/(e+i)*(s-t):s+i/(e+i)*(t-s)},e.intersect=function(t,i,s,r,n){var a,o,l;e.vertLeq(t,i)||(l=t,t=i,i=l),e.vertLeq(s,r)||(l=s,s=r,r=l),e.vertLeq(t,s)||(l=t,t=s,s=l,l=i,i=r,r=l),e.vertLeq(s,i)?e.vertLeq(i,r)?((a=e.edgeEval(t,s,i))+(o=e.edgeEval(s,i,r))<0&&(a=-a,o=-o),n.s=e.interpolate(a,s.s,o,i.s)):((a=e.edgeSign(t,s,i))+(o=-e.edgeSign(t,r,i))<0&&(a=-a,o=-o),n.s=e.interpolate(a,s.s,o,r.s)):n.s=(s.s+i.s)/2,e.transLeq(t,i)||(l=t,t=i,i=l),e.transLeq(s,r)||(l=s,s=r,r=l),e.transLeq(t,s)||(l=t,t=s,s=l,l=i,i=r,r=l),e.transLeq(s,i)?e.transLeq(i,r)?((a=e.transEval(t,s,i))+(o=e.transEval(s,i,r))<0&&(a=-a,o=-o),n.t=e.interpolate(a,s.t,o,i.t)):((a=e.transSign(t,s,i))+(o=-e.transSign(t,r,i))<0&&(a=-a,o=-o),n.t=e.interpolate(a,s.t,o,r.t)):n.t=(s.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),s=new De(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,i.next=i,i.Sym=s,s.next=s,s.Sym=i,this.vHead=e,this.fHead=t,this.eHead=i,this.eHeadSym=s}return e.prototype.makeEdge_=function(e){var t=new De(0),i=new De(1);e.Sym.side<e.side&&(e=e.Sym);var s=e.Sym.next;return i.next=s,s.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,s=t.Onext;i.Sym.Lnext=t,s.Sym.Lnext=e,e.Onext=s,t.Onext=i},e.prototype.makeVertex_=function(e,t,i){var s=e;Ce(s,"Vertex can't be null!");var r=i.prev;s.prev=r,r.next=s,s.next=i,i.prev=s,s.anEdge=t;var n=t;do{n.Org=s,n=n.Onext}while(n!==t)},e.prototype.makeFace_=function(e,t,i){var s=e;Ce(s,"Face can't be null");var r=i.prev;s.prev=r,r.next=s,s.next=i,i.prev=s,s.anEdge=t,s.trail=null,s.marked=!1,s.inside=i.inside;var n=t;do{n.Lface=s,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,s=i;do{s.Org=t,s=s.Onext}while(s!==i);var r=e.prev,n=e.next;n.prev=r,r.next=n},e.prototype.killFace_=function(e,t){var i=e.anEdge,s=i;do{s.Lface=t,s=s.Lnext}while(s!==i);var r=e.prev,n=e.next;n.prev=r,r.next=n},e.prototype.makeEdge=function(){var e=new Le,t=new Le,i=new Ie,s=this.makeEdge_(this.eHead);return this.makeVertex_(e,s,this.vHead),this.makeVertex_(t,s.Sym,this.vHead),this.makeFace_(i,s,this.fHead),s},e.prototype.splice=function(e,t){var i=!1,s=!1;if(e!==t){if(t.Org!==e.Org&&(s=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!s){var r=new Le;this.makeVertex_(r,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 s=new Ie;this.makeFace_(s,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 s=new Le;return this.makeVertex_(s,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,s=this.makeEdge_(e),r=s.Sym;if(t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(s,e.Lnext),this.splice_(r,t),s.Org=e.Dst,r.Org=t.Org,s.Lface=r.Lface=e.Lface,e.Lface.anEdge=r,!i){var n=new Ie;this.makeFace_(n,s,e.Lface)}return s},e.prototype.zapFace=function(e){var t,i,s,r,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)),(s=t.Sym).Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(t))}while(t!=a);r=e.prev,(n=e.next).prev=r,r.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,s,r,n;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(t.inside)for(n=(i=t.anEdge).Org;s=i.Lnext,(r=i.Sym)&&r.Lface&&r.Lface.inside&&this.countFaceVerts_(t)+this.countFaceVerts_(r.Lface)-2<=e&&Ee.vertCCW(i.Lprev.Org,i.Org,r.Lnext.Lnext.Org)&&Ee.vertCCW(r.Lprev.Org,r.Org,i.Lnext.Lnext.Org)&&(s=r.Lnext,this.delete(r),i=null,r=null),!i||i.Lnext.Org!==n;)i=s;return!0},e.prototype.check=function(){var e,t,i,s,r,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),r=e.anEdge;do{Ce(r.Sym!==r),Ce(r.Sym.Sym===r),Ce(r.Lnext.Onext.Sym===r),Ce(r.Onext.Sym.Lnext===r),Ce(r.Lface===e),r=r.Lnext}while(r!==e.anEdge)}for(Ce(e.prev===t&&null===e.anEdge),s=o,s=o;(i=s.next)!==o;s=i){Ce(i.prev===s),r=i.anEdge;do{Ce(r.Sym!==r),Ce(r.Sym.Sym===r),Ce(r.Lnext.Onext.Sym===r),Ce(r.Onext.Sym.Lnext===r),Ce(r.Org===i),r=r.Onext}while(r!==i.anEdge)}for(Ce(i.prev===s&&null===i.anEdge),n=l,n=l;(r=n.next)!==l;n=r)Ce(r.Sym.next===n.Sym),Ce(r.Sym!==r),Ce(r.Sym.Sym===r),Ce(null!==r.Org),Ce(null!==r.Dst),Ce(r.Lnext.Onext.Sym===r),Ce(r.Onext.Sym.Lnext===r);Ce(r.Sym.next===n.Sym&&r.Sym===this.eHeadSym&&r.Sym.Sym===r&&null===r.Org&&null===r.Dst&&null===r.Lface&&null===r.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,s,r=this.nodes,n=this.handles;for(t=r[e].handle;;){if((s=e<<1)<this.size&&this.leq(n[r[s+1].handle].key,n[r[s].handle].key)&&++s,Ce(s<=this.max),i=r[s].handle,s>this.size||this.leq(n[t].key,n[i].key)){r[e].handle=t,n[t].node=e;break}r[e].handle=i,n[i].node=e,e=s}},e.prototype.floatUp_=function(e){var t,i,s,r=this.nodes,n=this.handles;for(t=r[e].handle;;){if(i=r[s=e>>1].handle,0===s||this.leq(n[i].key,n[t].key)){r[e].handle=t,n[t].node=e;break}r[e].handle=i,n[i].node=e,e=s}},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 s,r;for(this.max*=2,r=this.nodes.length,this.nodes.length=this.max+1,s=r;s<this.nodes.length;s++)this.nodes[s]=new ze;for(r=this.handles.length,this.handles.length=this.max+1,s=r;s<this.handles.length;s++)this.handles[s]=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,s=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)),s},e.prototype.delete=function(e){var t,i=this.nodes,s=this.handles;Ce(e>=1&&e<=this.max&&null!==s[e].key),i[t=s[e].node].handle=i[this.size].handle,s[i[t].handle].node=t,--this.size,t<=this.size&&(t<=1||this.leq(s[i[t>>1].handle].key,s[i[t].handle].key)?this.floatDown_(t):this.floatUp_(t)),s[e].key=null,s[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 s=e.event,r=t.eUp,n=i.eUp;return r.Dst===s?n.Dst===s?Ee.vertLeq(r.Org,n.Org)?Ee.edgeSign(n.Dst,r.Org,n.Org)<=0:Ee.edgeSign(r.Dst,n.Org,r.Org)>=0:Ee.edgeSign(n.Dst,s,n.Org)<=0:n.Dst===s?Ee.edgeSign(r.Dst,s,r.Org)>=0:Ee.edgeEval(r.Dst,s,r.Org)>=Ee.edgeEval(n.Dst,s,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 s,r=i.eUp.Org;do{i=e.regionAbove(i)}while(i.eUp.Org===r);if(i.fixUpperEdge){if(null===(s=t.mesh.connect(e.regionBelow(i).eUp.Sym,i.eUp.Lnext)))return null;e.fixUpperEdge(t,i,s),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 s=new Ge;return s.eUp=i,s.nodeUp=e.dict.insertBefore(t.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,i.activeRegion=s,s},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 s=i.eUp,r=s.Lface;r.inside=i.inside,r.anEdge=s,e.deleteRegion(t,i)},e.finishLeftRegions=function(t,i,s){for(var r,n=null,a=i,o=i.eUp;a!==s;){if(a.fixUpperEdge=!1,(r=(n=e.regionBelow(a)).eUp).Org!=o.Org){if(!n.fixUpperEdge){e.finishRegion(t,a);break}r=t.mesh.connect(o.Lprev,r.Sym),e.fixUpperEdge(t,n,r)}o.Onext!==r&&(t.mesh.splice(r.Oprev,r),t.mesh.splice(o,r)),e.finishRegion(t,a),o=n.eUp,a=n}return o},e.addRightEdges=function(t,i,s,r,n,a){var o,l,h,d,u=!0;h=s;do{Ce(Ee.vertLeq(h.Org,h.Dst)),e.addRegionBelow(t,i,h.Sym),h=h.Onext}while(h!==r);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 s=Ee.vertL1dist(t,e),r=Ee.vertL1dist(i,e),n=.5*r/(s+r),a=.5*s/(s+r);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,s,r,n,a){i.coords[0]=i.coords[1]=i.coords[2]=0,i.idx=-1,e.vertexWeights(i,s,r),e.vertexWeights(i,n,a)},e.checkForRightSplice=function(t,i){var s=e.regionBelow(i),r=i.eUp,n=s.eUp;if(Ee.vertLeq(r.Org,n.Org)){if(Ee.edgeSign(n.Dst,r.Org,n.Org)>0)return!1;Ee.vertEq(r.Org,n.Org)?r.Org!==n.Org&&(t.pq.delete(r.Org.pqHandle),e.spliceMergeVertices(t,n.Oprev,r)):(t.mesh.splitEdge(n.Sym),t.mesh.splice(r,n.Oprev),i.dirty=s.dirty=!0)}else{if(Ee.edgeSign(r.Dst,n.Org,r.Org)<0)return!1;e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(r.Sym),t.mesh.splice(n.Oprev,r)}return!0},e.checkForLeftSplice=function(t,i){var s,r=e.regionBelow(i),n=i.eUp,a=r.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,s=t.mesh.splitEdge(n),t.mesh.splice(a.Sym,s),s.Lface.inside=i.inside}else{if(Ee.edgeSign(a.Dst,n.Dst,a.Org)>0)return!1;i.dirty=r.dirty=!0,s=t.mesh.splitEdge(a),t.mesh.splice(n.Lnext,a.Sym),s.Rface.inside=i.inside}return!0},e.checkForIntersect=function(t,i){var s,r,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),s=Ee.vertLeq(l,h)?l:h,Ee.vertLeq(s,p)&&(p.s=s.s,p.t=s.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),r=e.regionBelow(i).eUp.Rprev,n.eUp=o.Oprev,o=e.finishLeftRegions(t,n,null),e.addRightEdges(t,i,o.Onext,a.Rprev,r,!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 s,r,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,s=i.eUp,r=n.eUp,s.Dst!==r.Dst&&e.checkForLeftSplice(t,i)&&(n.fixUpperEdge?(e.deleteRegion(t,n),t.mesh.delete(r),r=(n=e.regionBelow(i)).eUp):i.fixUpperEdge&&(e.deleteRegion(t,i),t.mesh.delete(s),s=(i=e.regionAbove(n)).eUp)),s.Org!==r.Org)if(s.Dst===r.Dst||i.fixUpperEdge||n.fixUpperEdge||s.Dst!==t.event&&r.Dst!==t.event)e.checkForRightSplice(t,i);else if(e.checkForIntersect(t,i))return;s.Org===r.Org&&s.Dst===r.Dst&&(e.addWinding(r,s),e.deleteRegion(t,i),t.mesh.delete(s),i=e.regionAbove(n))}},e.connectRightVertex=function(t,i,s){var r,n=s.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(s,l.Oprev),s=e.finishLeftRegions(t,a,null),h=!0),h?e.addRightEdges(t,i,s.Onext,n,n,!0):(r=Ee.vertLeq(l.Org,o.Org)?l.Oprev:o,r=t.mesh.connect(s.Lprev,r),e.addRightEdges(t,i,r,r.Onext,r.Onext,!1),r.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(t,i))},e.connectLeftDegenerate=function(t,i,s){var r,n,a,o,l;return r=i.eUp,Ee.vertEq(r.Org,s)?(Ce(!1),void e.spliceMergeVertices(t,r,s.anEdge)):Ee.vertEq(r.Dst,s)?(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(s.anEdge,a),Ee.edgeGoesLeft(n)||(n=null),void e.addRightEdges(t,i,a.Onext,o,n,!0)):(t.mesh.splitEdge(r.Sym),i.fixUpperEdge&&(t.mesh.delete(r.Onext),i.fixUpperEdge=!1),t.mesh.splice(s.anEdge,r),void e.sweepEvent(t,s))},e.connectLeftVertex=function(t,i){var s,r,n,a,o,l,h=new Ge;if(h.eUp=i.anEdge.Sym,s=t.dict.search(h).key,r=e.regionBelow(s)){if(a=s.eUp,o=r.eUp,0===Ee.edgeSign(a.Dst,i,a.Org))return void e.connectLeftDegenerate(t,s,i);n=Ee.vertLeq(o.Dst,a.Dst)?s:r,s.inside||n.fixUpperEdge?(l=n===s?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,s,l)),e.sweepEvent(t,i)):e.addRightEdges(t,s,i.anEdge,i.anEdge,null,!0)}},e.sweepEvent=function(t,i){t.event=i,e.debugEvent(t);for(var s=i.anEdge;null===s.activeRegion;)if((s=s.Onext)===i.anEdge)return void e.connectLeftVertex(t,i);var r=e.topLeftRegion(t,s.activeRegion);Ce(null!==r);var n=e.regionBelow(r),a=n.eUp,o=e.finishLeftRegions(t,n,null);o.Onext===a?e.connectRightVertex(t,r,o):e.addRightEdges(t,r,o.Onext,a,a,!0)},e.addSentinel=function(e,t,i,s){var r=new Ge,n=e.mesh.makeEdge();n.Org.s=i,n.Org.t=s,n.Dst.s=t,n.Dst.t=s,e.event=n.Dst,r.eUp=n,r.windingNumber=0,r.inside=!1,r.fixUpperEdge=!1,r.sentinel=!0,r.dirty=!1,r.nodeUp=e.dict.insert(r)},e.initEdgeDict=function(t){t.dict=new Ne(t,e.edgeLeq);var i=t.bmax[0]-t.bmin[0],s=t.bmax[1]-t.bmin[1],r=t.bmin[0]-i,n=t.bmax[0]+i,a=t.bmin[1]-s,o=t.bmax[1]+s;e.addSentinel(t,r,n,a),e.addSentinel(t,r,n,o)},e.doneEdgeDict=function(t){for(var i,s=0;null!==(i=t.dict.min().key);)i.sentinel||(Ce(i.fixUpperEdge),Ce(1===++s)),Ce(0===i.windingNumber),e.deleteRegion(t,i)},e.removeDegenerateEdges=function(t){var i,s,r,n=t.mesh.eHead;for(i=n.next;i!==n;i=s)s=i.next,r=i.Lnext,Ee.vertEq(i.Org,i.Dst)&&i.Lnext.Lnext!==i&&(e.spliceMergeVertices(t,r,i),t.mesh.delete(i),r=(i=r).Lnext),r.Lnext===i&&(r!==i&&((r===s||r===s.Sym)&&(s=s.next),t.mesh.delete(r)),(i===s||i===s.Sym)&&(s=s.next),t.mesh.delete(i))},e.initPriorityQ=function(e){var t,i,s,r=0;for(i=(s=e.mesh.vHead).next;i!==s;i=i.next)r++;for(r+=8,t=e.pq=new Re(r,Ee.vertLeq),i=(s=e.mesh.vHead).next;i!==s;i=i.next)i.pqHandle=t.insert(i);return i===s&&(t.init(),!0)},e.donePriorityQ=function(e){e.pq=null},e.removeDegenerateFaces=function(t,i){var s,r,n;for(s=i.fHead.next;s!==i.fHead;s=r)r=s.next,Ce((n=s.anEdge).Lnext!==n),n.Lnext.Lnext===n&&(e.addWinding(n.Onext,n),t.mesh.delete(n));return!0},e.computeInterior=function(t,i){var s,r;if(void 0===i&&(i=!0),e.removeDegenerateEdges(t),!e.initPriorityQ(t))return!1;for(e.initEdgeDict(t);null!==(s=t.pq.extractMin());){for(;null!==(r=t.pq.min())&&Ee.vertEq(r,s);)r=t.pq.extractMin(),e.spliceMergeVertices(t,s.anEdge,r.anEdge);e.sweepEvent(t,s)}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,s,r,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],m=this.mesh.vHead;t=m.next;for(var g=0;g<3;++g)r=t.coords[g],l[g]=r,c[g]=t,o[g]=r,p[g]=t;for(t=m.next;t!==m;t=t.next)for(var f=0;f<3;++f)(r=t.coords[f])<l[f]&&(l[f]=r,c[f]=t),r>o[f]&&(o[f]=r,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],s=p[y],h[0]=i.coords[0]-s.coords[0],h[1]=i.coords[1]-s.coords[1],h[2]=i.coords[2]-s.coords[2],t=m.next;t!==m;t=t.next)d[0]=t.coords[0]-s.coords[0],d[1]=t.coords[1]-s.coords[1],d[2]=t.coords[2]-s.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,s=this.mesh.vHead,r=0,n=i.next;n!==i;n=n.next)if(!((t=n.anEdge).winding<=0))do{r+=(t.Org.s-t.Dst.s)*(t.Org.t+t.Dst.t),t=t.Lnext}while(t!==n.anEdge);if(r<0){for(e=s.next;e!==s;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,s=[0,0,0],r=!1;s[0]=this.normal[0],s[1]=this.normal[1],s[2]=this.normal[2],!s[0]&&!s[1]&&!s[2]&&(this.computeNormal_(s),r=!0),e=this.sUnit,t=this.tUnit;var n=this.longAxis_(s);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]=s[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);r&&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,s;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(s=i.Lprev;i.Lnext!==s;)if(Ee.vertLeq(i.Dst,s.Org)){for(;s.Lnext!==i&&(Ee.edgeGoesLeft(s.Lnext)||Ee.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)s=e.connect(s.Lnext,s).Sym;s=s.Lprev}else{for(;s.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(s.Lnext===i)throw"Mono region invalid";for(;s.Lnext.Lnext!==i;)s=e.connect(s.Lnext,s).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 s,r=e.eHead.next;r!==e.eHead;r=s)s=r.next,r.Rface.inside!==r.Lface.inside?r.winding=r.Lface.inside?t:-t:i?e.delete(r):r.winding=0},e.prototype.getNeighbourFace_=function(e){return e.Rface&&e.Rface.inside?e.Rface.n:-1},e.prototype.outputPolymesh_=function(e,t,i,s){var r,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){r=h.anEdge,n=0;do{-1===(l=r.Org).n&&(l.n=o,o++),n++,r=r.Lnext}while(r!==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*s,this.vertexIndices=[],this.vertexIndices.length=o,l=e.vHead.next;l!==e.vHead;l=l.next)if(-1!==l.n){var d=l.n*s;this.vertices[d+0]=l.coords[0],this.vertices[d+1]=l.coords[1],s>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){r=h.anEdge,n=0;do{l=r.Org,this.elements[u++]=l.n,n++,r=r.Lnext}while(r!==h.anEdge);for(var p=n;p<i;++p)this.elements[u++]=-1;if(t===Oe.CONNECTED_POLYGONS){r=h.anEdge;do{this.elements[u++]=this.getNeighbourFace_(r),r=r.Lnext}while(r!==h.anEdge);for(var c=n;c<i;++c)this.elements[u++]=-1}}},e.prototype.outputContours_=function(e,t){var i,s,r=0,n=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(a.inside){s=i=a.anEdge;do{this.vertexCount++,i=i.Lnext}while(i!==s);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(r=0,a=e.fHead.next;a!==e.fHead;a=a.next)if(a.inside){n=0,s=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!==s);this.elements[h++]=r,this.elements[h++]=n,r+=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,s=0;s<t.length;s+=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[s+0],i.Org.coords[1]=t[s+1],i.Org.coords[2]=e>2?t[s+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,s,r,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,r&&(this.normal[0]=r[0],this.normal[1]=r[1],this.normal[2]=r[2]),this.windingRule=e,s<2&&(s=2),s>3&&(s=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,s):this.outputPolymesh_(a,t,i,s),!0},e}();function Ve(e){var t=e.windingRule,i=void 0===t?Se.ODD:t,s=e.elementType,r=void 0===s?Oe.POLYGONS:s,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,m=void 0===c||c,g=e.debug,f=void 0!==g&&g;if(!p&&m)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,r,a,l,d,m),{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 L,this.startPosition=new L,this.uuid=D.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 L(...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,s=this.controls.length;i<s;i++){let s=this.controls[i];this.position.distanceTo(s.position)<=t?s.position.copy(this.position):s.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 L,t=new L){let[i,s]=this.computeTangents();return i&&s&&(Ye(i,e),Ye(s,t)),[e,t]}computeTangent(e=new L){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new L){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}};function Ye(e,t=new L){let i=e.length();return t.set(-e.y/i,e.x/i)}var Xe=e=>e,Ze=new L,Je=new L,$e=new L,Ke=new L,Qe=new L,et=new L,tt=new B,it=new B;function st(e){let t=new L;t.addVectors(e.v0,Ze.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new L;return i.addVectors(e.v2,Je.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new q(e.v0,t,i,e.v2)}function rt(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 s=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),r=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((r*r+s*s-n*n)/(2*r*s))}function lt(e,t,i){return mt(e,t)&&mt(t,i)&&ht(e.position,t.position,i.position)}function ht(e,t,i){return 0===Ze.copy(t).sub(e).cross(Je.copy(i).sub(e))}function dt(e,t,i,s,r){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 s.set(o+l,a+h),r.set(o-l,a-h),[s,r]}function ut(e,t,i){return e.distanceTo(i)<t.distanceTo(i)?t:e}function pt(e,t,i,s,r,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=rt(d,l)?(l+d)*(s/u-.5)*8/3/(o-h):(o+h)*(s/u-.5)*8/3/(d-l),r.set(t.x-a*l,t.y+a*o),n.set(i.x+a*d,i.y-a*h),[r,n]}function ct(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function mt(e,t){return ht(e.position,e.controls[1].position,t.position)&&ht(e.position,t.controls[0].position,t.position)}function gt(e,t=12,i=!1){let s=[];for(let r=0,n=e.length;r<n;r++){let n=e[r],a=0;if(i&&void 0!==n.roundedCurveCorner){let e=.5*ft(n.roundedCurveCorner,t);r>0&&(s[r-1]+=e),a+=e}void 0!==n.curveAfter&&(a+=ft(n.curveAfter,t)),s.push(a)}return e.length>0&&i&&void 0!==e[0].roundedCurveCorner&&(s[e.length-1]+=.5*ft(e[0].roundedCurveCorner,t)),s}function ft(e,t=12){return e&&e instanceof F?2*t:e&&(e instanceof W||e instanceof Y)?1:e&&e instanceof J?t*e.points.length:t}var yt=new L,vt=new L,bt=new L,xt=new L,wt=new L,St=new L,Mt=class extends ee{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new fe(new B(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=D.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let s=new Mt;return s.isClosed=e.isClosed,s.points=e.points.map(e=>We.create(e.id,e.data)),"number"==typeof e.roundness&&(s.roundness=e.roundness),s.shapeHoles=e.shapeHoles.map(e=>Mt.createFromState(e)),void 0!==t&&void 0!==i&&s.applySize(t,i),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let 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,s=this.shapeHoles.length;t<s;t++){let s=this.shapeHoles[t],r=s.points.length,n=s.getPointIndexById(e);if(!(n<0))return n+i;i+=r}}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,s=this.shapeHoles.length;i<s;i++){let s=this.shapeHoles[i],r=e-t;if(r<=s.points.length-1)return s.points[r];t+=s.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,s=this.shapeHoles.length;i<s;i++){let s=this.shapeHoles[i],r=s.points.indexOf(e);if(r>=0)return t+r;t+=s.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,s=this.shapeHoles.length;i<s;i++)this.shapeHoles[i].applyScale(e,t);this._update()}createPoint(e,t=0,i=D.generateUUID()){let s;s=e instanceof L?e:new L(e,t);let r=new We(i,s);return r.roundness=this.roundness,r}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 s=i?this.roundedCurveDivisions:this.curveDivisions;return function(e,t,i=12,s=!0){let r,n=it.set(0,0,0),a=0,o=[];for(let s=0;s<t.length;s++){let l=Xe(t[s]),h=Ze,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!==r&&at(r,n))continue;void 0===r&&(r=tt),r.copy(n),e.setXYZ(a,n.x,n.y,n.z),a++}}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++)}(e,i?this.roundedCurves:this.curves,t,this.autoClose),s.reduce((e,t)=>e+t,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=gt(this.points,e,!1),this.roundedCurveDivisions=gt(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(e,t,i,s=12,r=!0){let n=it.set(0,0,0),a=0,o=[];for(let r=0;r<t.length;r++){if(!1===i[r])continue;let l,h=Xe(t[r]),d=Ze,u=ft(h,s);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 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++),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,s=!0){let r,n=0;for(let s=0;s<t.length;s++){let a=Xe(t[s]),o=ft(a,i),l=Ze;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!==r&&nt(r,l,je))continue;void 0===r&&(r=Je),r.copy(l),e.push(l.x,l.y),n++}}return rt(e[0],e[e.length-2],je)&&rt(e[1],e[e.length-1],je)&&(e.pop(),e.pop()),s&&n>1&&!(rt(e[n-1],e[1],je)&&rt(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 s=t?this.roundedCurveDivisions:this.curveDivisions,r=0;t&&void 0!==this.points[0].roundedCurveCorner&&(r=.5*ft(this.points[0].roundedCurveCorner,this.subdivision));let n=e-r;n<0&&(n+=s.reduce((e,t)=>e+t,0));for(let e=0,t=s.length;e<t;e++){let t=s[e];if(n<i+t)return[e,(n-i+1)/t];i+=t}return[0,1]}getCurveT(e,t,i){let s=this.points[e],r=this.points[e>=this.points.length-1?0:e+1],n=this.curveDivisions,a=n[e];if(ct(s,r)){let e=s.position.distanceTo(r.position);return s.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 s=i.clone();e.roundedCurveBefore=s,t.roundedCurveAfter=s,e.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_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],s=this.points[t-1]??this.points[this.points.length-1],r=this.points[t+1]??this.points[0],n=i.roundness,a=s&&r&&lt(s,i,r);if(!i.controlsMoved()&&n>0&&!a){let s=i.curveBefore,r=i.curveAfter;if(void 0===s||void 0===r)continue;let a,o=i.roundedCurveBefore,l=i.roundedCurveAfter,h=s instanceof W?s.v1.distanceTo(s.v2):s.getLength(),d=r instanceof W?r.v1.distanceTo(r.v2):r.getLength(),u=Math.min(n,.499*h),p=Math.min(n,.499*d),c=Math.min(u,p),m=1-c/h,g=c/d,f=s.getPointAt(m,yt),y=r.getPointAt(g,vt);if(this._subSplitCurve(s,o,m,f,void 0),this._subSplitCurve(r,l,g,void 0,y),this.useCubicForRoundedCorners){let e=ot(f,i.position,y)/2,t=Math.tan(e)*f.distanceTo(i.position),[s,r]=dt(f,y,t,bt,xt),n=ut(s,r,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,s,r){if(!(e instanceof W)){let n=e,a=t,o=n.getUtoTmapping(i,0),l=function(e,t,i,s,r=.5){let n=Ze.subVectors(t,e).multiplyScalar(r).add(e),a=Je.subVectors(i,t).multiplyScalar(r).add(t),o=$e.subVectors(s,i).multiplyScalar(r).add(i),l=n,h=Ke.subVectors(a,n).multiplyScalar(r).add(n),d=Qe.subVectors(o,a).multiplyScalar(r).add(a),u=o,p=et.subVectors(d,h).multiplyScalar(r).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,s.x,s.y]}(n.v0,n.v1,n.v2,n.v3,o);return void 0!==s&&(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!==r&&(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!==s&&t.v2.copy(s),void 0!==r&&t.v1.copy(r),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,s=e.points[t+0],r=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(D.generateUUID(),new L(s,r));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,s,r=[];for(t=0,s=e.length;t<s;t++)e[t]instanceof X&&(e[t]=st(e[t]));for(t=0,s=e.length;t<s;t++){let s,n=e[t],a=t>0?e[t-1]:null;n instanceof q?(s=this.createPoint(n.v0),s.controls[1].position.copy(n.v1)):n instanceof W&&(s=this.createPoint(n.v1)),void 0!==s&&(null!==a&&i(s,a),r.push(s))}let n=e[e.length-1],a=!1;return n instanceof q?n.v3.equals(r[0].position)&&(r[0].controls[0].position.copy(n.v2),a=!0):n instanceof W&&n.v2.equals(r[0].position)&&(a=!0),this.isClosed=a,r})(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 s=Float32Array.BYTES_PER_ELEMENT,r=0;this.positions=new Float32Array(this.buffer,r*s,3*e),r+=3*e,this.normals=new Float32Array(this.buffer,r*s,3*e),r+=3*e,this.uvs=new Float32Array(this.buffer,r*s,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,s=new ArrayBuffer(i),r=Float32Array.BYTES_PER_ELEMENT,n=0,a=new Float32Array(s,n*r,3*e);n+=3*e;let o=new Float32Array(s,n*r,3*e);n+=3*e;let l=new Float32Array(s,n*r,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=s,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)}},At=Ot;At.eSize=8*Float32Array.BYTES_PER_ELEMENT;var Pt=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,s=t[e];for(;e>0;){let r=e-1>>1,n=t[r];if(i(s,n)>=0)break;t[e]=n,e=r}t[e]=s}_down(e){let{data:t,compare:i}=this,s=this.length>>1,r=t[e];for(;e<s;){let s=1+(e<<1),n=s+1;if(n<this.length&&i(t[n],t[s])<0&&(s=n),i(t[s],r)>=0)break;t[e]=t[s],e=s}t[e]=r}};function _t(e,t,i,s){this.x=e,this.y=t,this.h=i,this.d=function(e,t,i){let s=!1,r=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]&&(s=!s),r=Math.min(r,Ct(e,t,a,l))}return 0===r?0:(s?1:-1)*Math.sqrt(r)}(e,t,s),this.max=this.d+this.h*Math.SQRT2}function Ct(e,t,i,s){let r=i[0],n=i[1],a=s[0]-r,o=s[1]-n;if(0!==a||0!==o){let i=((e-r)*a+(t-n)*o)/(a*a+o*o);i>1?(r=s[0],n=s[1]):i>0&&(r+=a*i,n+=o*i)}return a=e-r,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,s])=>(s<i&&(s+=t),(e>=i?e:e+t)<=s),Ut=class extends ce{constructor(e,t,i=0,s=12,r=3,n=Se.ODD,a=!1){super(),this.forPathBevel=a,this.type="ShapeGeometry",this.vertexCache={},this._shape=e,this._depth=t,this._curveSegments=s,this._bevelSegmentsInput=r;let o,l,h,d=this._shape.extractShapePointsToFlatArray([],s),u=this._shape.shapeHoles.map(e=>{let t=e.extractShapePointsToFlatArray([],s),i=[];for(let e=t.length-1;e>=1;e-=2){let s=t[e-1],r=t[e-0];i.push(s,r)}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 L).length():0===p[0].length?i:i>0?function(e,t,i=1,s=!1){let r=1/0,n=1/0,a=-1/0,o=-1/0;for(let[t,i]of e[0])t<r&&(r=t),i<n&&(n=i),t>a&&(a=t),i>o&&(o=i);let l=a-r,h=o-n,d=Math.max(i,Math.min(l,h));if(d===i){let e=[r,n];return e.distance=0,e.distance}let u=new Pt([],(e,t)=>t.max-e.max),p=function(e){let t=0,i=0,s=0,r=e[0];for(let e=0,n=r.length,a=n-1;e<n;a=e++){let n=r[e],o=r[a],l=n[0]*o[1]-o[0]*n[1];i+=(n[0]+o[0])*l,s+=(n[1]+o[1])*l,t+=3*l}let n=new _t(i/t,s/t,0,e);return 0===t||n.d<0?new _t(r[0][0],r[0][1],0,e):n}(e),c=new _t(r+l/2,n+h/2,0,e);c.d>p.d&&(p=c);let m=2;function g(r,n,a){let o=new _t(r,n,a,e);if(m++,o.max>p.d+i&&u.push(o),o.d>p.d&&(p=o,s&&console.log(`found best ${Math.round(1e4*o.d)/1e4} after ${m} probes`),p.d>t))return t}let f=d/2;for(let e=r;e<a;e+=d)for(let t=n;t<o;t+=d)g(e+f,t+f,f);for(;u.length;){let{max:e,x:t,y:s,h:r}=u.pop();if(e-p.d<=i)break;f=r/2,g(t-f,s-f,f),g(t+f,s-f,f),g(t-f,s+f,f),g(t+f,s+f,f)}s&&console.log(`num probes: ${m}\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(r));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 m=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 g=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],s=l.vertices[t+1];i<g&&(g=i),i>f&&(f=i),s<y&&(y=s),s>v&&(v=s)}this._minX=g,this._minY=y,this._width=f-g,this._height=v-y,this._buffer=new At(this._computeBufferEstimatedSize(l));let b=[],x=[];for(let e=l.elementCount-1;e>=0;e--){let t=e>=m,i=2*e,r=l.elements[i+0],n=l.elements[i+1],h=r+n,d={start:r,count:n,normals:[],continuous:[],concave:[]},p=r,c=h-1,g=r+1,f=this._shape.roundedCurves.length;do{let e=p-r,i=l.vertices[2*c+0],s=l.vertices[2*c+1],a=l.vertices[2*p+0],o=l.vertices[2*p+1],u=l.vertices[2*g+0],m=l.vertices[2*g+1],y=a-i,v=o-s,b=Math.sqrt(y*y+v*v);y/=b,v/=b;let x=a-u,w=o-m,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 s=1===i?t+1:t-1;s=(s+f)%f;let r=1===i?0:1,n=this._shape.roundedCurves[t].getTangent(i),a=this._shape.roundedCurves[s].getTangent(r);d.continuous[e]=n.dot(a)>.95}}t&&(d.normals[2*e+0]*=-1,d.normals[2*e+1]*=-1),[c,p,g]=[p,g,g+1],g>=h&&(g-=n)}while(g!==r+1);let y=[];y.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*r,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*r,2*h)});let v=0;for(let e=1;e<=this._bevelSegments;e++){let i=e/this._bevelSegments*Math.PI/2,r=(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,m=l.vertices[2*d.start+i+0],g=l.vertices[2*d.start+i+1],f=-d.normals[c+0]*r,y=-d.normals[c+1]*r,v=-d.normals[i+0]*r,b=-d.normals[i+1]*r;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 s=i+o/2,n=Math.cos(s)*r,l=Math.sin(s)*r;a[2*p+0]=m+n*(t?-1:1),a[2*p+1]=g+l*(t?-1:1),u[p]=e,p++}else{let t=Math.max(1,Math.floor(s/4*Math.abs(o)/Math.PI));for(let s=0;s<=t;s++){let n=i+o*(s/t),l=Math.cos(n)*r,h=Math.sin(n)*r;a[2*p+0]=m+l,a[2*p+1]=g+h,u[p]=e,p++}}}else a[2*p+0]=m+f,a[2*p+1]=g+y,u[p]=e,o[e]=p,p++,a[2*p+0]=m,a[2*p+1]=g,u[p]=e,p++,a[2*p+0]=m+v,a[2*p+1]=g+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],s=u[(t+1)%u.length];e.idx=[i,s],e.Sym.idx=[s,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 s=i;i<t&&(s+=n);for(let r=t;r<s;r++){let s=r%n,a=(r+1)%n;if(!d.continuous[s]||!d.continuous[a]){c.vertexIndices[e]=[t,s],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:r,boundary:c,reverseMap:u,insetPoints:a})}let w=(e,t,i)=>{let s=0,r=e.boundary.vertexIndices.length;for(;s<r&&i(e.boundary.vertexIndices[t]);)t=(t+1)%r,s++;return s},S=b.length;for(let e=1;e<y.length;e++){let t=y[e-1],i=y[e],s=t.boundary.vertexIndices.length,r=i.boundary.vertexIndices.length;if(!s||!r)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)%s}while(h(t.boundary.vertexIndices[u]));do{p=(p+1)%r}while(h(i.boundary.vertexIndices[p]));l=(l+1)%n;let c,m,g=l,f=0,v=this._buildBevelVert(d,t,(u-1+s)%s,void 0,f),x=this._buildBevelVert(d,i,(p-1+r)%r,void 0,f),S=!1;do{f=(l||o)/o,h=Lt(l,n);let e=w(t,u,h),g=w(i,p,h),y=S;if(S=!1,e&&!g){for(let i=0;i<e;i++)c=this._buildBevelVert(d,t,(u+i)%s,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&&g)for(let e=0;e<g;e++)m=this._buildBevelVert(d,i,(p+e)%r,e/(g-1),f),b.push(x.topN,v.topP,m.topP),!1===a&&b.push(v.bottomP,x.bottomN,m.bottomP),x=m;else if(e&&g)if(c=this._buildBevelVert(d,t,u,0,f),m=this._buildBevelVert(d,i,p,0,f),y?(b.push(v.topN,m.topP,x.topN),b.push(v.topN,c.topP,m.topP),!1===a&&(b.push(m.bottomP,v.bottomN,x.bottomN),b.push(m.bottomP,c.bottomP,v.bottomN))):(b.push(x.topN,v.topN,c.topP),b.push(x.topN,c.topP,m.topP),!1===a&&(b.push(c.bottomP,v.bottomN,x.bottomN),b.push(c.bottomP,x.bottomN,m.bottomP))),v=c,x=m,e===g)for(let n=1;n<e;n++)c=this._buildBevelVert(d,t,(u+n)%s,n/(e-1),f),m=this._buildBevelVert(d,i,(p+n)%r,n/(g-1),f),b.push(v.topN,c.topP,x.topN),b.push(x.topN,c.topP,m.topP),!1===a&&(b.push(c.bottomP,v.bottomN,x.bottomN),b.push(c.bottomP,x.bottomN,m.bottomP)),v=c,x=m;else if(e>g){let n=e/g,o=0;for(let l=1;l<e;l++)c=this._buildBevelVert(d,t,(u+l)%s,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++,m=this._buildBevelVert(d,i,(p+o)%r,o/(g-1),f),b.push(x.topN,c.topP,m.topP),!1===a&&b.push(c.bottomP,x.bottomN,m.bottomP),x=m)}else{let n=g/e,o=0;for(let l=1;l<g;l++)m=this._buildBevelVert(d,i,(p+l)%r,l/(g-1),f),b.push(x.topN,c.topP,m.topP),!1===a&&b.push(c.bottomP,x.bottomN,m.bottomP),x=m,l>(o+1)*n&&(o++,c=this._buildBevelVert(d,t,(u+o)%s,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)%s,p=(p+g)%r,l=(l+1)%o}while(l!==g)}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],s=b[t-1],r=b[t-0];e.push(r,s,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],s=y[y.length-1].boundary.vertices[t-0];e.push(i,s)}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),s=this._buildSurfaceVert(e,e.elements[t+1],v),r=this._buildSurfaceVert(e,e.elements[t+2],v);b.push(i.top,s.top,r.top),!1===a&&b.push(r.bottom,s.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 s=e[0];for(let e=0,r=s.boundary.vertexCount;e<r;e++){let n=this._buildBevelVert(t,s,e),a=this._buildBevelVert(t,s,(e+1)%r);i.push(a.topP,n.topN,n.bottomN),i.push(a.topP,n.bottomN,a.bottomP)}}_buildSurfaceVert(e,t,i){let s=t.toString();if(s in this.vertexCache)return this.vertexCache[s];let r=e.vertices[2*t+0],n=e.vertices[2*t+1],a=(r-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]=r,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]=r,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[s]=u,u}_buildBevelVert(e,t,i,s=1,r){let n=`${t.bevelI}:${i}`;if(n in this.vertexCache&&0!==r&&1!==r&&(!r||r===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),m=2*i,g=2*a,f=2*o,y=t.boundary.vertices[m+0],v=t.boundary.vertices[m+1],b=(1-c)*this._bevel,x=(y-this._minX)/this._width,w=(v-this._minY)/this._height;this.forPathBevel&&(void 0!==r&&(x=r),w=1);let S=e.normals[g+0],M=e.normals[g+1],O=e.normals[f+0],A=e.normals[f+1];if(h){S+=(O-S)*(1-s),M+=(A-M)*(1-s);let e=Math.sqrt(S*S+M*M);S/=e,M/=e}let P=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),_=3*P,C=2*P,E={i:i,fi:a,topP:P+0,topN:P+0,bottomP:P+1,bottomN:P+1,pathBevelUCoord:r};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?(P+=1,_+=3,C+=2):(P+=2,_+=6,C+=4),E.topP=P+0,E.bottomP=P+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]=A*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]=A*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 s,r,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],s=a[t+1];if(void 0!==r&&i!==r&&(l=!1),void 0!==n&&s!==n&&(h=!1),r=i,n=s,!l&&!h)break}if(!l&&!h)try{s=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{s=Et}let d=s?.vertexCount??1,u=s?.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),s){let e=1/0,t=-1/0,i=1/0,r=-1/0;for(let n=0,a=d;n<a;n++){let a=2*n,o=s.vertices[a+0],l=s.vertices[a+1];o<e&&(e=o),o>t&&(t=o),l<i&&(i=l),l>r&&(r=l)}let n=t-e,a=r-i;for(let t=0,r=d;t<r;t++){let r=2*t,o=s.vertices[r+0],l=s.vertices[r+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=s.elements[t+0],r=s.elements[t+1],n=s.elements[t+2];this._indexAttribute.setX(t+0,i),this._indexAttribute.setX(t+1,r),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*(s?.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,s=12,r=3,n=Se.ODD){super(e,t,i,s,r,n),this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let s=e[0];for(let e=0,r=s.boundary.vertexCount;e<r;e++){let n=this._buildBevelVert(t,s,e),a=this._buildBevelVert(t,s,(e+1)%r);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,s=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Se.ODD},e.parameters),r=Math.abs(s.width),n=Math.abs(s.height??s.width),a=Math.abs(s.depth??0),o=e.shape??t?.shape,l=o?.roundness??s.roundness;void 0!==o&&(o instanceof Mt?(i=o,(i.width!==r||i.height!==n)&&i.applySize(r,n)):i=new Mt(r,n).fromJSON(o),void 0!==e.parameters?.roundness&&e.parameters?.roundness>0&&i.update());let h=i??new Mt(r,n);return{parameters:Object.assign(s,{width:r,height:n,depth:a,roundness:l}),shape:h}}static build(e){let t,{depth:i,extrudeBevelSize:s,extrudeBevelSegments:r,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,s,n,r,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:s,height:r,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:h}=e,d=y.getDisplayedValue(l),u=function(e,t,i,s){let r="string"==typeof e.width?Number(s.getVariable(e.width)):e.width,n=[""],a="";for(let s of i)a+=s," "===s||"\n"===s?(n[n.length-1]+=a,a="","\n"===s&&n.push("")):t.getTextWidth(n[n.length-1]+a,e)>r&&(n[n.length-1].length&&n.push(""),t.getTextWidth(n[n.length-1]+a,e)>r&&(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:m}=i.generateShapes(u,e,t),g=.5*("number"==typeof s?s:Number(t.getVariable(s))),f=.5*("number"==typeof r?r:Number(t.getVariable(r))),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(-g,f,0),this.dispose(),this.wrappedText=u,this.charCoords=m,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=S(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 Zt(){return Wt}function Jt(e){Tt=e}function $t(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 si(e){Ft=e}function ri(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,mi=class extends te{constructor(e,t,i,s){super(e,t,i),this.isColorA=!0,this.a=s}setRGBA(e,t,i,s){super.setRGB(e,t,i),this.a=s}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,t="srgb"){let i;if("transparent"===e)return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let s,r=i[1],n=i[2];switch(r){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a="rgba"===r?parseFloat(s[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a="hsla"===r?parseFloat(s[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}},gi=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 gi{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(){if(0===this.refCount&&p)throw new Error("ref count -1?");this.refCount-=1,0===this.refCount&&(this.cache.remove(this),this.dispose())}dispose(){if(0!==this.refCount&&p)throw new Error("ref count is not 0")}},bi=class{constructor(){this.cache=new Map}remove(e){if(!1===this.cache.delete(e.data)&&p)throw new Error("ref count remove non-exists")}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=I}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 s=e.pos,r=-1,n=0,a="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));for(;0>(r=o.indexOf("\n"))&&n<t&&s<e.byteLength;)a+=o,n+=o.length,s+=128,o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));return-1<r&&(!1!==i&&(e.pos+=n+r+1),a+o.slice(0,r))},s=function(e,t,i,s){let r=e[t+3],n=Math.pow(2,r-128)/255;i[s+0]=e[t+0]*n,i[s+1]=e[t+1]*n,i[s+2]=e[t+2]*n,i[s+3]=1},r=function(e,t,i,s){let r=e[t+3],n=Math.pow(2,r-128)/255;i[s+0]=le.toHalfFloat(Math.min(e[t+0]*n,65504)),i[s+1]=le.toHalfFloat(Math.min(e[t+1]*n,65504)),i[s+2]=le.toHalfFloat(Math.min(e[t+2]*n,65504)),i[s+3]=le.toHalfFloat(1)},n=new Uint8Array(e);n.pos=0;let a,o,l,h=function(e){let s,r,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||!(s=i(e)))&&t(1,"no header found"),(r=s.match(n))||t(3,"bad initial token"),d.valid|=1,d.programtype=r[1],d.string+=s+"\n";s=i(e),!1!==s;)if(d.string+=s+"\n","#"!==s.charAt(0)){if((r=s.match(a))&&(d.gamma=parseFloat(r[1])),(r=s.match(o))&&(d.exposure=parseFloat(r[1])),(r=s.match(l))&&(d.valid|=2,d.format=r[1]),(r=s.match(h))&&(d.valid|=4,d.height=parseInt(r[1],10),d.width=parseInt(r[2],10)),2&d.valid&&4&d.valid)break}else d.comments+=s+"\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,s){let r=i;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");let n=new Uint8Array(4*i*s);n.length||t(4,"unable to allocate buffer space");let a=0,o=0,l=4*r,h=new Uint8Array(4),d=new Uint8Array(l),u=s;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])!=r)&&t(3,"bad rgbe scanline format");let i,s=0;for(;s<l&&o<e.byteLength;){i=e[o++];let r=i>128;if(r&&(i-=128),(0===i||s+i>l)&&t(3,"bad scanline data"),r){let t=e[o++];for(let e=0;e<i;e++)d[s++]=t}else d.set(e.subarray(o,o+i),s),s+=i,o+=i}let p=r;for(let e=0;e<p;e++){let t=0;n[a]=d[e+t],t+=r,n[a+1]=d[e+t],t+=r,n[a+2]=d[e+t],t+=r,n[a+3]=d[e+t],a+=4}u--}return n}(n.subarray(n.pos),d,u);switch(this.type){case E:l=p.length/4;let e=new Float32Array(4*l);for(let t=0;t<l;t++)s(p,4*t,e,4*t);a=e,o=E;break;case I:l=p.length/4;let t=new Uint16Array(4*l);for(let e=0;e<l;e++)r(p,4*e,t,4*e);a=t,o=I;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:ge,magFilter:ge,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 me(e.data,e.width,e.height,V,I);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var Oi=0,Ai=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.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;for(let e of Object.values(this._cache))for(let t of Object.values(e))for(let e of Object.values(t))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 s=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:s}=t,r=t.data,n=new Uint16Array(r.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<s;e++){let t=e*a,i=(s-1-e)*a;for(let e=0;e<a;e+=4)n[i+e]=h(r[t+e]),n[i+e+1]=h(r[t+e+1]),n[i+e+2]=h(r[t+e+2]),n[i+e+3]=r[t+e+3]}return{isSplineHdr:!0,data:n,width:i,height:s}}catch{return null}}(i):null;null!==s&&(this.isHdr=!0,this.img=s,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)}})}getTexture(e,t=1008,i=1006){let s=this._cache[e]?.[t]?.[i];if(s)return s;{let s;return this.isBuffer?s=this.img.texture:this.isVideo?s=new ve(this.img,void 0,e,e):this.isHdr?(s=Mi(this.img),s.wrapS=e,s.wrapT=e,s.magFilter=i,s.minFilter=t):s=new k(this.img,void 0,e,e,i,t),this.isBuffer||(s.anisotropy=8,s.generateMipmaps=1008===t),this.loaded&&(s.needsUpdate=!0),void 0===this._cache[e]&&(this._cache[e]={}),void 0===this._cache[e][t]&&(this._cache[e][t]={}),this._cache[e][t][i]=s,s}}setNeedsUpdate(e){if(!this.isBuffer)for(let t of Object.values(this._cache))for(let i of Object.values(t))for(let t of Object.values(i))t&&(t.needsUpdate=e)}disposeTextures(){for(let[e,t]of Object.entries(this._cache))for(let[i,s]of Object.entries(t))for(let[t,r]of Object.entries(s))r?.dispose(),void 0!==this._cache[e]&&void 0!==this._cache[e][i]&&(this._cache[e][i][t]=void 0)}dispose(){super.dispose(),this.disposeTextures()}},Pi=class extends Ai{},_i=2*Math.PI;function Ci({x:e,y:t},i,s,r,n){return{x:e*i+r,y:t*s+n}}function Ei(e,t){let i=1.5707963267948966===t?.551915024494:-1.5707963267948966===t?-.551915024494:1.3333333333333333*Math.tan(t/4),s=Math.cos(e),r=Math.sin(e),n=Math.cos(e+t),a=Math.sin(e+t);return[{x:s-r*i,y:r+s*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function Ii(e,t,i,s){let r=e*s-t*i<0?-1:1,n=Math.min(1,Math.max(-1,e*i+t*s));return r*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=D.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:s,spikes:r,angle:n,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=e.parameters,d=e.shape,u=function(e,t,i,s,r,n){if(s>=Di)return r>30||r%4==0?(function(e,t,i,s=0,r=0,n=0){let a=.5522847498,o=t*a,l=i*a;e.addPoint(Bi(r-t,n,r-t,n-l,r-t,n+l)),e.addPoint(Bi(r,n+i,r-o,n+i,r+o,n+i)),e.addPoint(Bi(r+t,n,r+t,n+l,r+t,n-l)),e.addPoint(Bi(r,n-i,r+o,n-i,r-o,n-i)),s>0&&Gi(e,t,i,s)}(e,t,i,n),Math.round(r/4)):Ui(e,s,r,t,i,n);let a={x:0,y:i},o=(s=Math.max(s,.001))+.5*Math.PI,l={x:Math.cos(o)*t,y:Math.sin(o)*i},h=function({px:e,py:t,cx:i,cy:s,rx:r,ry:n,largeArcFlag:a,sweepFlag:o}){let l=[];if(0===r||0===n)return[];let h=(e-i)/2,d=(t-s)/2;if(0===h&&0===d)return[];r=Math.abs(r),n=Math.abs(n);let u=Math.pow(h,2)/Math.pow(r,2)+Math.pow(d,2)/Math.pow(n,2);u>1&&(r*=Math.sqrt(u),n*=Math.sqrt(u));let p=function(e,t,i,s,r,n,a,o,l,h){let d=Math.pow(r,2),u=Math.pow(n,2),p=Math.pow(a,2),c=Math.pow(o,2),m=d*u-d*c-u*p;m<0&&(m=0),m/=d*c+u*p,m=Math.sqrt(m)*(l===h?-1:1);let g=m*r/n*o,f=m*-n/r*a,y=g+(e+i)/2,v=f+(t+s)/2,b=(a-g)/r,x=(o-f)/n,w=(-a-g)/r,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,s,r,n,h,d,a,o),{ang1:c,ang2:m}=p,{centerx:g,centery:f}=p,y=Math.abs(m)/(_i/4);Math.abs(1-y)<1e-7&&(y=1);let v=Math.max(Math.ceil(y),1);m/=v;for(let e=0;e<v;e++)l.push(Ei(c,m)),c+=m;return l.map(e=>{let{x:t,y:i}=Ci(e[0],r,n,g,f),{x:s,y:a}=Ci(e[1],r,n,g,f),{x:o,y:l}=Ci(e[2],r,n,g,f);return{x1:t,y1:i,x2:s,y2:a,x:o,y:l}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:t,ry:i,largeArcFlag:s>Math.PI,sweepFlag:!0});return r>30||r%h.length===0?function(e,t,i,s,r,n,a,o){let l=Math.round(r/s.length);e.addPoint(zi(t,i));for(let t=0,i=s.length;t<i;t++){let i=s[t],r=e.points[t],n=zi(i.x,i.y);r.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,r,t,i,n):Ui(e,s,r,t,i,n)}(d,.5*i,.5*s,n*Math.PI/180,r,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,s,r,n){let a=-t/i;for(let t=0;t<=i;t++){let i=a*t,n=Math.sin(i)*s,o=Math.cos(i)*r;e.addPoint(zi(n,o))}return t<Di?n>0?Ri(e,s,r,n):e.addPoint(zi(0,0)):(e.removePoint(e.points[e.points.length-1]),n>0&&Gi(e,s,r,n)),1}function zi(e,t){return new We(D.generateUUID(),new L(e,t))}function Bi(e,t,i,s,r,n){let a=zi(e,t);return a.controls[0].position.set(i,s),a.controls[1].position.set(r,n),a}function Ri(e,t,i,s){Ti(e,t,i,s).forEach(t=>e.addPoint(t))}function Gi(e,t,i,s){let r=Ti(e,t,i,s),n=new Mt;r.forEach(e=>n.addPoint(e)),n.isClosed=!0,e.shapeHoles.push(n)}function Ti(e,t,i,s){let r=s*t/100,n=r*(Math.abs(i)/Math.abs(t)),a=new L(r/t,n/i),o=e.points.map(e=>{let t=e.clone();return t.uuid=D.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:s,cornerRadius:r,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o}=e.parameters,l=e.shape,h=.5*t,d=.5*i,u=2*Math.PI/s;for(let e=0;e<s;e++){let t=u*e,i=0+Math.sin(t)*h,s=0+Math.cos(t)*d;l.addPoint(l.createPoint(i,s))}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 p=Rt.create({shape:l,parameters:{roundness:r,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),s=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:s}}static build(e){let t=e.shape,{width:i,height:s,cornerRadius:r,cornerType:n,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}=e.parameters,h={x:.5*i,y:.5*s},d={x:-h.x,y:-h.y},u={x:h.x,y:h.y};function p(e,t,r){return t>i&&r>s?Math.min(e*i/t,e*s/r):t>i?e*i/t:r>s?e*s/r:e}let c=[];c[0]=0===r[0]?0:p(r[0],r[0]+r[3],r[0]+r[1]),c[1]=0===r[1]?0:p(r[1],r[1]+r[2],r[1]+r[0]),c[2]=0===r[2]?0:p(r[2],r[2]+r[1],r[2]+r[3]),c[3]=0===r[3]?0:p(r[3],r[3]+r[0],r[3]+r[2]);let m=d.x,g=u.x,f=u.y,y=d.y;t.addPoint(t.createPoint(m,f)),t.addPoint(t.createPoint(g,f)),t.addPoint(t.createPoint(g,y)),t.addPoint(t.createPoint(m,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:s,spikes:r,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/r,m=Math.PI/2*3*-1,g=u*s/100,f=p*s/100;if(3===r&&50===s){c=2*Math.PI/r;for(let e=0;e<r;e++){let t=c*e,i=0+Math.sin(t)*u,s=0+Math.cos(t)*p;d.addPoint(d.createPoint(i,s))}}else for(let e=0;e<r;e++){let e=0+Math.cos(m)*u,t=0+Math.sin(m)*p;d.addPoint(d.createPoint(e,t)),m+=c,e=0+Math.cos(m)*g,t=0+Math.sin(m)*f,d.addPoint(d.createPoint(e,t)),m+=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??(p?".":"https://cdn.spline.design/@splinetool/runtime@2.0.2/build"),i=import("./process.js"),[s,r]=await Promise.all([i,fetch(`${t}/process.wasm`).then(e=>e.arrayBuffer())]),n=s.default,a=await n({wasmBinary:r});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,s=e.parameters?.radiusBottom,r=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);r.thetaLength=D.clamp(r.thetaLength,0,360),r.hollow=D.clamp(r.hollow??0,0,1);let n=r.width/2,a=r.radiusTop??n,o=r.radiusBottom??n;if(a===o?(a=n,o=n):a>o?(a=n,o=o*n/a):(a=a*n/o,o=n),r.shapeBlendNode){a=i??n,o=s??n;let e=2*Math.max(a,o);r.width=e,r.depth=e}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:a,radiusBottom:o})}}static build(e){let t,{width:i,depth:s,height:r,radialSegments:n,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,radiusTop:d,radiusBottom:u,cornerRadius:p,cornerSegments:c,hollow:m}=e.parameters;0===h?(t=new ce,t.setAttribute("position",new ue([],3))):t=p||m?new Zi(d,u,r,n,a,o,l,h*Math.PI/180,p,p,c,m):new R(d,u,r,n,a,o,l,h*Math.PI/180);let g=s/i;return 1!==g&&t.scale(1,1,g),Object.assign(t,{userData:{...e,type:"CylinderGeometry"}})}};function Xi(e){return new L(e.y,-e.x)}var Zi=class extends ce{constructor(e,t,i,s,r,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,s=Math.floor(s)||8,r=Math.floor(r)||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 m=new L(e,c),g=new L(t,-c),f=null,y=null,v=null,b=null,x=m.clone().sub(g),w=0,S=0,M=0;u>0&&(w=Math.min(e,t)*(1-u),S=e-w,M=t-w);let O=m.clone();O.x-=w;let A=Math.PI-x.angle(),P=x.angle(),_=Math.tan(P/2),C=Math.tan(A/2),E=_+C,I=u?E:C,D=u?E:_;if(l=Math.min(l,(e-S)/I,x.length()/E),h=Math.min(h,(t-M)/D,x.length()/E),l>0){let e=l/_;f=m.clone().sub(new L(e,l)),u&&(v=f.clone(),v.x-=w-E*l),m.sub(x.clone().setLength(e))}if(h>0){let e=h/C;y=g.clone().sub(new L(e,-h)),g.add(x.clone().setLength(e)),u&&(b=y.clone(),b.x-=w-E*h,O.sub(x.clone().setLength(e)))}x=m.clone().sub(g);let U=x.length()<.5,z=[],B=[],R=[],G=[],T=[],N=[],k=(e,t,s,r,n)=>{for(let a=0;a<d+1;a++){let o=a/d,l=r<0?o:1-o;n&&(l-=1),l*=e;let h=Math.sin(l),u=Math.cos(l)*r,p=u*t+s.y;z.push(h*t+s.x),B.push(p),R.push(h),G.push(u),T.push(.5+p/i),N.push(!1)}},F=(e,t,i)=>{let s=[e,t];i<0&&s.reverse();for(let e of s)z.push(e),B.push(c*i),R.push(0),G.push(i),T.push(.5),N.push(!0)};if(b&&y?(k(A,h,b,-1,!0),k(P,h,y,-1,!1)):y?(F(y.x,0,-1),k(P,h,y,-1,!1)):n||F(t,M,-1),!U){let e=Xi(x).normalize();for(let t=0;t<=r;t++){let s=t/r,n=x.y*s+g.y;z.push(x.x*s+g.x),B.push(n),R.push(e.x),G.push(e.y),T.push(.5+n/i),N.push(!1)}}if(v&&f?(k(A,l,f,1,!1),k(P,l,v,1,!0)):f?(k(A,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<=r;t++){let s=t/r,n=x.y*-s+O.y;z.push(x.x*-s+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=(s+1)*V+(q?2*(1+j):0),Y=new Float32Array(3*W),X=new Float32Array(3*W),Z=new Float32Array(2*W),J=W-1>65535?new Uint32Array(s*Math.max(0,j-1)*6+(q?2*(j+1)*3:0)):new Uint16Array(s*Math.max(0,j-1)*6+(q?2*(j+1)*3:0)),$=0,K=0;for(let e=0;e<=s;e++){let t=e/s,i=t*o+a,r=Math.sin(i),n=Math.cos(i);for(let e=0;e<V;e++){let i=3*K,s=2*K,a=z[e],o=R[e];Y[i]=a*r,Y[i+1]=B[e],Y[i+2]=a*n,X[i]=o*r,X[i+1]=G[e],X[i+2]=o*n,N[e]?(Z[s]=.5,Z[s+1]=.5):(Z[s]=t,Z[s+1]=T[e]),K++}}for(let e=0;e<s;e++)for(let t=0;t<j-1;t++){if(n&&u&&t==r)continue;let i=H(e,t),s=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];J[$++]=i,J[$++]=s,J[$++]=o,(0!=l||0!=h)&&(J[$++]=s,J[$++]=a,J[$++]=o)}function Q(i,s,r){let n=Math.sin(r),a=Math.cos(r),o=-a,l=n,h=i<0?(e,t,i)=>{J[$++]=e,J[$++]=t,J[$++]=i}:(e,t,i)=>{J[$++]=e,J[$++]=i,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,Z[p]=.5,Z[p+1]=.5;let c=K++;for(let e=0;e<j;e++){let t=3*(s+(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;Z[p]=Z[i],Z[p+1]=Z[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,s*V,a+o)),this.setIndex(new de(J.slice(0,$),1)),this.setAttribute("position",new de(Y,3)),this.setAttribute("normal",new de(X,3)),this.setAttribute("uv",new de(Z,2))}},Ji=Math.PI/2,$i=class extends ce{constructor(e=1,t=1,i=1,s=1,r=1,n=1,a=0,o=4){super(),this.type="BoxGeometry",s=Math.floor(s),r=Math.floor(r),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)*(r+1)+(s+1)*(n+1)+(s+1)*(r+1))+(l?4*h*(n+1+(s+1)+(r+1))+h*(h+1)/2*8:0),u=2*(n*r+s*n+s*r)+(l?4*o*(n+s+r):0),p=l?8*o*o:0,c=new Float32Array(3*d),m=new Float32Array(3*d),g=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*Ji;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),A=new Float64Array(3*M);{let s=new B(e/2,t/2,i/2);s.subScalar(a);let r=0;for(let e=0;e<=o;e++){let t=Ji*(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*r]=t,O[3*r+1]=o,O[3*r+2]=h,A[3*r]=s.x+t*a,A[3*r+1]=s.y+o*a,A[3*r+2]=s.z+h*a,r++,l+=Ji/e}}}function P(e,t,i,s,r,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,A=new B;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);A[e]=p*s,A[t]=a*r,A[i]=w,c[f]=A.x,c[f+1]=A.y,c[f+2]=A.z,A[e]=0,A[t]=0,A[i]=l>0?1:-1,m[f]=A.x,m[f+1]=A.y,m[f+2]=A.z,g[v]=o/h,g[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,s=y+t+S*(e+1),r=y+(t+1)+S*(e+1),n=y+(t+1)+S*e;f[v++]=i,f[v++]=s,f[v++]=n,f[v++]=s,f[v++]=r,f[v++]=n}y+=O}function _(e,t,i,s,r,n,l,h,d,u){let p=(l-2*a)/u,M=l/2-a,O=h/2-a,A=d/2,P=u+1,_=0,C=new B,E=new B;for(let a=0;a<o+1;a++){C[t]=(O+b[a])*r,C[i]=(A-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<P;t++){let i=t*p-M;C[e]=i*s;let r=3*(y+_),n=2*(y+_);c[r]=C.x,c[r+1]=C.y,c[r+2]=C.z,m[r]=E.x,m[r+1]=E.y,m[r+2]=E.z,g[n]=t/u,g[n+1]=0,_+=1}}for(let e=0;e<o;e++)for(let t=0;t<u;t++){let i=y+t+P*e,s=y+t+P*(e+1),r=y+(t+1)+P*(e+1),n=y+(t+1)+P*e;f[v++]=i,f[v++]=s,f[v++]=n,f[v++]=s,f[v++]=r,f[v++]=n}y+=_}function C(e,t,i){let s=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},r=y;for(let s=0;s<M;s++){let r=3*s,n=3*y,a=2*y;c[n]=e*A[r],c[n+1]=t*A[r+1],c[n+2]=i*A[r+2],m[n]=e*O[r],m[n+1]=t*O[r+1],m[n+2]=i*O[r+2],g[a]=0,g[a+1]=0,y++}for(let e=0;e<o;e++){let t=r+e*(e+1)/2,i=r+(e+1)*(e+2)/2;s(t,i+1,i);for(let r=1;r<=e;r++)s(t+r-1,t+r,i+r),s(t+r,i+r+1,i+r)}}P("z","y","x",-1,-1,i,t,e,n,r),P("z","y","x",1,-1,i,t,-e,n,r),P("x","z","y",1,1,e,i,t,s,n),P("x","z","y",1,-1,e,i,-t,s,n),P("x","y","z",1,-1,e,t,i,s,r),P("x","y","z",-1,-1,e,t,-i,s,r),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,s),_("x","y","z",1,-1,1,e,t,i,s),_("x","y","z",-1,1,1,e,t,i,s),_("x","y","z",1,1,-1,e,t,i,s),_("y","x","z",-1,-1,1,t,e,i,r),_("y","x","z",1,-1,-1,t,e,i,r),_("y","x","z",1,1,1,t,e,i,r),_("y","x","z",-1,1,-1,t,e,i,r),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(m,3)),this.setAttribute("uv",new de(g,2))}},Ki=class extends ce{constructor(e=[],t=[],i="",s=1,r=.2,n=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,h=0;return function(){0==(r=Math.min(.99999,r))&&(n=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],u=new B,p=u.clone(),c=new ne,m=r*s,g=s-m,f=n+1,y=new B,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 B).fromArray(e,3*i).setLength(s)),w=[],S=1e6;for(let e=0;e<x.length;e++){let i,s,r,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],s=t[e+(l+2)%3],r=n.distanceToSquared(x[i]),o=Math.min(o,r),a.push([i,s,r])}o+=1e-6;let h=[],d=0,u=a.length;for(let t=0;t<u;t++){[i,s,r]=a[d];let t=1==w[i]?.includes(e);r<=o&&h.push(i+ +t*S),d=a.findIndex(e=>e[0]==s)}w.push(h)}let M=[];{let e,t,i=0,s=0,r=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,s]=[e+o+a+2,t+o+a+3],M.push(e,t,...r?[s,e]:[i,t],s,i),[e,t]=[i,s];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 A=x.length*d*M.length*3+O*f*6*3+2*O*3*3;a=new Float64Array(A),o=new Float64Array(A),l=new Float64Array(A/3*2);let P=(e,t,i)=>{let s=h/3*2;l[s]=Math.atan2(i,-e)/2/Math.PI+.5,l[s+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,P(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,P(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 B),z=b(n*Math.max(0,n-1)/2,()=>new B),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(g);let t=w[e];for(let i=0;i<t.length;i++){let s=t[i],r=t[(i+1)%d];c.setFromPointsAndIndices(x,e,s%S,r%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,s=[],r=[],b=new B;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)*m;0==n?G.copy(b):G.copy(R).setLength(g+w),s.push(w);let S=[G,l,h];for(let e=0;e<2;e++){let t=S[e],s=S[e+1];N.subVectors(t,R),k.subVectors(s,R),T.crossVectors(N,k).normalize();for(let s=0;s<f;s++){let r=[c,x][e]*s/f;u.copy(N).applyAxisAngle(T,r).add(R),U[i++].copy(u),e&&(v(u,R),a.push([0==s?t:u.clone(),y.clone()]))}e&&(v(s,R),a.push([s,y.clone()]))}r.push(a)}F.push(r);let O=2*f,A=2;for(let e=0;e<d;e++){let t=O*e,i=O*((e+1)%d),r=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-A+1;t<=i;t++)u.lerpVectors(o,l,t/(i+1)),u.sub(R).setLength(s[e]).add(R),n.push(z[r++].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,s=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[s]=Math.atan2(t.z,-t.x)/2/Math.PI+.5,L[s+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],s=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[s]=L[i],l[s+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 s=w[i].findIndex(t=>t%S==e),r=F[e][t],n=F[i][s];for(let e=0;e<f;e++){let t=r[e],i=n[f-e],s=r[e+1],a=n[f-(e+1)];C(t),C(i),C(s),C(s),C(i),C(a)}j.push(r[0][0],n[f][0],r[f][0],n[0][0])}}for(;j.length;){let e,t,i,[s,r]=j.splice(0,2);e=r;let n=[s];for(;s!=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 B,t=new B,i=new B,s=new B,r=new L,n=new L,o=new L,d=(e,t,i,s)=>{s<0&&1===e.x&&(l[t]=e.x-1),0===i.x&&0===i.z&&(l[t]=s/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]),r.set(l[c+0],l[c+1]),n.set(l[c+2],l[c+3]),o.set(l[c+4],l[c+5]),s.copy(e).add(t).add(i).divideScalar(3);let h=p(s);d(r,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],s=l[e+4],r=Math.max(t,i,s),n=Math.min(t,i,s);r>.9&&n<.1&&(t<.2&&(l[e+0]+=1),i<.2&&(l[e+2]+=1),s<.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 s=(1+Math.sqrt(5))/2,r=1/s,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,-r,-s,0,-r,s,0,r,-s,0,r,s,-r,-s,0,-r,s,0,r,-s,0,r,s,0,-s,0,-r,s,0,-r,-s,0,r,s,0,r],[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)}},es=class extends Ki{constructor(e=1,t=.2,i=4){let s=(1+Math.sqrt(5))/2,r="IcosahedronGeometry";super([-1,s,0,1,s,0,-1,-s,0,1,-s,0,0,-1,s,0,1,s,0,-1,-s,0,1,-s,s,0,-1,s,0,1,-s,0,-1,-s,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],r,e,t,i),this.type=r}static fromJSON(e){return new es(e.radius,e.corner,e.cornerSides)}},ts=1e4;function is(e,t){return Math.abs(t-e)/2+Math.min(e,t)}var ss=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"),s=e.getIndex(),r=t.count,n=new Map,a=new Uint32Array(r),o=[],l=0;for(let e=0;e<r;e++){let i=t.getX(e),s=t.getY(e),r=t.getZ(e),h=Math.round(i*ts),d=Math.round(s*ts),u=Math.round(r*ts),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 m=c.get(u);void 0===m&&(m=l++,c.set(u,m),o.push(i,s,r)),a[e]=m}let h=[],d=[],u=void 0===i?null:[],p=null!==s?s.count:r,c=(e,t)=>{let n=null!==s?s.getX(e):e,o=null!==s?s.getX(e+1):e+1,l=null!==s?s.getX(e+2):e+2;if(!(n<r&&o<r&&l<r))return;let p=a[n],c=a[o],m=a[l];p===c||c===m||m===p||(h.push(p,c,m),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)))},m=e.groups;if(m.length>0)for(let e=0;e<m.length;e++){let t=m[e],i=void 0===t.materialIndex?0:t.materialIndex,s=Math.max(t.start,0),r=Math.min(t.start+t.count,p);for(let e=s;e<r&&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=rs(t);return function(e,t){let{positions:i,faces:s,materialIndices:r,uvs:n}=e,a=i.length/3,o=s.length/3,l=new Float64Array(3*a);for(let e=0;e<o;e++){let t=3*s[3*e],r=3*s[3*e+1],n=3*s[3*e+2],a=i[n]-i[r],o=i[n+1]-i[r+1],h=i[n+2]-i[r+2],d=i[t]-i[r],u=i[t+1]-i[r+1],p=i[t+2]-i[r+2],c=o*p-h*u,m=h*d-a*p,g=a*u-o*d;l[t]+=c,l[t+1]+=m,l[t+2]+=g,l[r]+=c,l[r+1]+=m,l[r+2]+=g,l[n]+=c,l[n+1]+=m,l[n+2]+=g}for(let e=0;e<a;e++){let t=l[3*e],i=l[3*e+1],s=l[3*e+2],r=Math.sqrt(t*t+i*i+s*s)||1;l[3*e]=t/r,l[3*e+1]=i/r,l[3*e+2]=s/r}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*s[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=r[e],i=e;do{e++}while(e<o&&r[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 rs(e){let{positions:t,faces:i,materialIndices:s,uvs:r}=e,n=t.length/3,a=i.length/3,o=null!==r&&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),m=0,g=8;for(;g<2*l;)g*=2;let f=g-1,y=new Int32Array(g).fill(-1),v=(e,t)=>{let i=(Math.imul(e,2654435761)^t)&f;for(;;){let s=y[i];if(-1===s)return y[i]=m,h[m]=e,d[m]=t,m++;if(h[s]===e&&d[s]===t)return s;i=i+1&f}},b=(e,t)=>{let i=e<t?e:t,s=e<t?t:e,r=(Math.imul(i,2654435761)^s)&f;for(;;){let e=y[r];if(h[e]===i&&d[e]===s)return e;r=r+1&f}},x=new Uint32Array(n),w=new Float64Array(3*n),S=(e,i,s)=>{let r=e<i?v(e,i):v(i,e),n=++u[r];1===n?p[r]=s:2===n&&(c[r]=s),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],s=i[3*e+1],r=i[3*e+2];S(t,s,r),S(s,r,t),S(r,t,s)}let M=new Float64Array(3*m);for(let e=0;e<m;e++){let i=3*h[e],s=3*d[e];if(2===u[e]){let r=3*p[e],n=3*c[e];M[3*e]=.375*(t[i]+t[s])+.125*(t[r]+t[n]),M[3*e+1]=.375*(t[i+1]+t[s+1])+.125*(t[r+1]+t[n+1]),M[3*e+2]=.375*(t[i+2]+t[s+2])+.125*(t[r+2]+t[n+2])}else M[3*e]=.5*(t[i]+t[s]),M[3*e+1]=.5*(t[i+1]+t[s+1]),M[3*e+2]=.5*(t[i+2]+t[s+2])}let O,A=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 s=1-i*Number(O),r=Number(O);2===i&&(s=3/4,r=1/8),A[3*e]=t[3*e]*s+w[3*e]*r,A[3*e+1]=t[3*e+1]*s+w[3*e+1]*r,A[3*e+2]=t[3*e+2]*s+w[3*e+2]*r}let P=new Float64Array(3*(n+m));P.set(A),P.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=s[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=r[t],s=r[t+1],n=r[t+2],a=r[t+3],o=r[t+4],l=r[t+5],h=is(i,n),d=is(s,a),u=is(n,o),p=is(a,l),c=is(i,o),m=is(s,l),g=24*e;E[g++]=h,E[g++]=d,E[g++]=u,E[g++]=p,E[g++]=c,E[g++]=m,E[g++]=i,E[g++]=s,E[g++]=h,E[g++]=d,E[g++]=c,E[g++]=m,E[g++]=n,E[g++]=a,E[g++]=u,E[g++]=p,E[g++]=h,E[g++]=d,E[g++]=o,E[g++]=l,E[g++]=c,E[g++]=m,E[g++]=u,E[g++]=p}}return{positions:P,faces:_,materialIndices:C,uvs:E}}var ns=new B;function as(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}var os=new B,ls=new B;function hs(e,t,i,s,r,n){let a=os.copy(t).sub(e),o=ls.copy(i).sub(e),l=a.angleTo(o);if(a.normalize(),o.normalize(),s===r){let t=a.add(o).normalize();n.copy(e).addScaledVector(t,s/Math.sin(l/2))}else{let t=a.angleTo(o);n.copy(e),n.addScaledVector(a,r/Math.sin(t)),n.addScaledVector(o,s/Math.sin(t))}}function ds(e,t,i){let s=e.clone().sub(t),r=i.clone().sub(t);return s.projectOnVector(r),s.add(t)}var us=class extends ce{constructor(e=.5,t=1,i=4,s=1,r=!1,n=0,a=4){super(),i=Math.floor(Math.max(3,i)),s=Math.floor(s),a=Math.floor(a);let o,l=[],h=[],d=[],u=[],p=0,c=t/2,m=Math.PI/i,g=e*Math.cos(Math.PI/i),f=2*Math.PI/i,y=(i-2)*Math.PI/i,v=Math.PI-y,b=new B(0,-c,0),x=new B(0,c,0),w=new L(e,-c),S=new L(g,-c),M=new L(0,x.y).sub(S),O=new L(0,x.y).sub(w),A=new L(M.y,-M.x).normalize(),P=new L(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 B(A.x,A.y,0),t=new B(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 B;if(!r){h.push(b.x,b.y,b.z),d.push(0,-1,0),u.push(0,0);let e=p++,t=[],s=w.clone(),r=C/Math.cos(Math.PI/i);s.x-=r;for(let e=0;e<i;e++){let r=e/i*Math.PI*2+m;as(s,new L(Math.sin(r),Math.cos(r)),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 D=[];{let e=new B,t=new B,s=new B,r=new B,c=new B,g=new B;for(let f=0;f<i;f++){let y=f/i*Math.PI*2+m,v=(f+.5)/i*Math.PI*2+m,S=(f+1)/i*Math.PI*2+m,O=new L(Math.sin(y),Math.cos(y)),_=new L(Math.sin(v),Math.cos(v)),I=new L(Math.sin(S),Math.cos(S));as(w,O,t),as(w,I,s),as(A,_,e),hs(x,t,s,E,E,r),h.push(r.x,r.y,r.z),hs(t,x,s,E,C,c),h.push(c.x,c.y,c.z),hs(s,t,x,C,E,g),h.push(g.x,g.y,g.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(s).multiplyScalar(.5),i=x.clone().sub(e).normalize(),r=b.clone().sub(e).normalize().add(i).normalize().multiplyScalar(-1);U(e,g.clone().sub(c),r,M.angle())}let m,f;{let e=new B;as(P,I,e);let t=g.clone().add(r).multiplyScalar(.5);t=ds(t,s,x);let i=g.clone().sub(r);[m,f]=U(t,i,e,o,r.y)}{let e=m,t=e.clone().setY(0).normalize(),i=new B(0,-1,0),s=t.clone().cross(i);z(e,t,i,s)}D.concat(f);{let t=M.angle(),s=Math.PI-t,r=x.clone();r.y-=n/Math.sin(t-Math.PI/2);let o=new B,c=[];for(let t=0;t<a;t++){let l=[],m=Math.PI/2-s*t/a,g=Math.cos(m),f=Math.sin(m),y=v;for(let s=0;s<=t;s++){let s=Math.cos(y),a=Math.sin(y);e.x=g*a,e.y=f,e.z=g*s,o.copy(r).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 m=c.length-1;for(let e=0;e<m;e++){let t=c[e],i=c[e+1],s=t.length-1;l.push(i[1],t[0],i[0]);for(let e=1;e<=s;e++)l.push(t[e],t[e-1],i[e]),l.push(i[e+1],t[e],i[e])}}}}}function U(e,t,i,s,r){let o=-s/2,c=(Math.PI-s)/2,m=t.clone().normalize().cross(i);e.addScaledVector(i,-n/Math.sin(c));let g=new B,f=new B,y=p,v=[];for(let l=0;l<=a;l++){let c=o+l/a*s;f.set(0,0,0),f.addScaledVector(m,Math.sin(c)),f.addScaledVector(i,Math.cos(c));for(let i=0;i<=1;i++){let s=i/1-.5;if(g.copy(e),g.addScaledVector(t,s),g.addScaledVector(f,n),null!=r){let e=Math.max(0,g.y-r);g.addScaledVector(t,-e/t.y)}h.push(g.x,g.y,g.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,s=i+2,r=s+1,n=i+1;l.push(i,s,n),l.push(s,r,n)}return[e.clone().addScaledVector(t,.5),v]}function z(e,t,i,s){let r=Math.PI/2,o=O.angle()-r,c=[],m=new B,g=new B;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=(r+Math.atan(Math.tan(o)*b))*y,S=Math.cos(w),M=Math.sin(w);m.set(0,0,0),m.addScaledVector(t,M*b),m.addScaledVector(i,S),m.addScaledVector(s,M*x),g.copy(e).addScaledVector(m,n),h.push(g.x,g.y,g.z),d.push(m.x,m.y,m.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],s=t.length-1;l.push(t[0],i[1],i[0]);for(let e=1;e<=s;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))}},ps=class extends ce{constructor(e=1,t=1,i=1,s=90,r=10,n=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],h=.001;0==r&&(n=1),n=Math.max(1,Math.floor(n)),r=Math.min(r,100),s=Math.min(180-h,s),s*=Math.PI/180;let d=[],u=Math.PI/2,p=(e=0,t=0,i=0)=>new B(e,t,i),c=p(),m=p(),[g,f,y]=[t/2,e/2,i/2],v=-f,b=+f,[x,w,S]=[p(v,-g,+y),p(v,-g,-y),p(v,+g,-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(s)*t-g;let A=Math.cos(s)*t-y,P=x.z-h;s<=u?(S.z=Math.min(A,P),S.z==P&&(S.y-=(A-P)/Math.tan(u-s))):w.z=Math.min(w.z-A-y,x.z-h),c.subVectors(x,w),m.subVectors(S,w);let _=Math.min(c.length(),m.length())*r/100,C=_*Math.tan(s/2),E=_/Math.cos(s/2),I=c.clone().normalize().add(m.normalize()).setLength(E).add(w);c.set(0,M(s,!0),O(s,!0)),d.push([S,c.clone()]);let D=(Math.PI-s)/n;for(let e=0;e<=n;e++){let t=u+s+e*D;c.set(0,Math.sin(t)*C,Math.cos(t)*C),c.add(I),m.set(0,M(t),O(t)),d.push([c.clone(),m.clone()])}d.push([x,p(0,1,0)]);let L=Math.sin(D/2)*C*2,U=d.length-1,z=d[0][0].distanceTo(d[1][0]),R=z+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-(z+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))}},cs={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=D.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:s,height:r,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 Zi(0,i/2,r,n,a,o,l,h*Math.PI/180,d,u,p,0,!0):new G(i/2,r,n,a,o);let c=s/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:s,depth:r,widthSegments:n,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:h}=e.parameters;return t=0===l?new z(i,s,r,n,a,o):new $i(i,s,r,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:s,detail:r,corner:n,cornerSides:a}=e.parameters,o=0===r&&0!==n?new Qi(.5*t,n,a):new T(.5*t,r),l=i/t,h=s/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:s,detail:r,corner:n,cornerSides:a}=e.parameters,o=0===r&&0!==n?new es(.5*t,n,a):new ie(.5*t,r),l=i/t,h=s/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:s}=e.parameters,r=new ee;r.moveTo(t[0].x,t[0].y),r.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let n=new se(r.extractPoints(s).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,s=e.geometry??t?.geometry??(new ce).copy(new z(100,100,100));void 0===t?(s.computeBoundingBox(),s.boundingBox.getSize(ns),i={width:ns.x,height:ns.y,depth:ns.z,subdivisions:0}):i=t.parameters;let r={...i,...e.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:s}}static build(e){let{width:t,height:i,depth:s,subdivisions:r}=e.parameters,n=e.geometry??(new ce).copy(new z(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(ns)):ns.set(a.width,a.height,a.depth),(t!==ns.x||i!==ns.y||s!==ns.z)&&n.scale(0===ns.x?1:t/ns.x,0===ns.y?1:i/ns.y,0===ns.z?1:s/ns.z);let o=n.originalGeometry;try{r>0?(void 0===o||a?.subdivisions!==r)&&(void 0===o&&(o=n),n=new ss(r).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 N(i).load(e,e=>{let i=this.normalizeInputs({geometry:e});e.boundingBox.getSize(ns);let s=100/ns.x;Object.assign(i.parameters,{width:100,height:ns.y*s,depth:ns.z*s}),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:s,radialSegments:r,heightSegments:n,openEnded:a,cornerRadius:o,cornerSegments:l}=e.parameters,h=new us(.5*t,i,r,n,a,o,l),d=s/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=D.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:s=i,depth:r=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*D.DEG2RAD),t.scale(1,s/i,r/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:s=8,heightSegments:r=8}=e.parameters,n=new re(t,i,s,r);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:s,angle:r,cornerRadius:n,cornerSegments:a}=e.parameters,o=new ps(t,i,s,r,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,s=new re(t,i);return Object.assign(s,{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),s=Math.abs(i.width),r=Math.abs(i.height??i.width);i.shapeBlendNode&&(r=s);let n=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:s,height:r,depth:n})}}static build(e){let{width:t,height:i,depth:s,radialSegments:r,tubularSegments:n,arc:a,cornerRadius:o,cornerSegments:l}=e.parameters,d=function(e,t,i,s,r,n,a,o,l,d,u){[t,i]=[i,t],a=t/2;let p=D.clamp(r/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,s,p,n,a,0,l,d,u)}(t,i,s,.5*t,a,n,0,0,r,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:s,radialSegments:r,p:n,q:a}=e.parameters,o=.5*t;o!==i&&(o-=i);let l=new he(o,i,s,r,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:s,depth:r,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=s;l.roundness=s,l.update();let u=Rt.create({shape:l,parameters:{roundness:s,depth:r,extrudeBevelSize:n,extrudeBevelSegments:a}});return Object.assign(u,{userData:{...e,type:"TriangleGeometry"}})}},VectorGeometry:Rt},ms=e=>{let t=cs[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)},gs=["font"];function fs(e,t,i,s){let r,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(r in i){let n=i[r];b(n)&&!gs.includes(r)&&(i[r]=t.getVariable(n,[s.uuid,"geometry",...e,r]),b(i[r])&&(i[r]=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 N).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 Ps(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);m("text",`a ${n.type}`);let i=Mt.createFromState(O.defaultData(),100,100);return ms({...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=ms(l)}catch(e){console.error(e),console.error(`Error generating geometry with inputs: ${l}`);let t=Mt.createFromState(O.defaultData(),100,100);l.shape=t,l.type="VectorGeometry",o=ms(l)}return o}var ys=new Z;function vs(e,t){if(Object.keys(e.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let i=Object.keys(e.attributes),s=Object.keys(t.attributes);if(i.length!==s.length)return!1;for(let i of s){let s=e.attributes[i],r=t.attributes[i];if(void 0===s||!0===s.isInterleavedBufferAttribute||!0===r.isInterleavedBufferAttribute||s.itemSize!==r.itemSize||s.normalized!==r.normalized||s.array.constructor!==r.array.constructor||s.array.length!==r.array.length)return!1}let r=e.index,n=t.index;if(null===r!=(null===n))return!1;let a=!1;if(null!==r&&null!==n){if(r.array.length!==n.array.length)return!1;let e=r.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 s=e.groups[i],r=t.groups[i];if(s.start!==r.start||s.count!==r.count||s.materialIndex!==r.materialIndex)return!1}for(let i of s){let s=e.attributes[i],r=t.attributes[i];s.array.set(r.array),s.needsUpdate=!0}if(null!==r&&null!==n){if(a){let e=r.array,t=n.array;for(let i=0,s=t.length;i<s;i++){let s=t[i];e[i]=65535===s?4294967295:s}}else r.array.set(n.array);r.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 bs(e,t,i,s){let r,n,a,o=e.position.array,l=e.normal.array,h=ys.makeScale(t,i,s).invert().elements;for(let e=0,d=o.length;e<d;e+=3)o[e]*=t,o[e+1]*=i,o[e+2]*=s,r=l[e],n=l[e+1],a=l[e+2],l[e]=h[0]*r+h[4]*n+h[8]*a,l[e+1]=h[1]*r+h[5]*n+h[9]*a,l[e+2]=h[2]*r+h[6]*n+h[10]*a;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var xs,ws=new oe,Ss=new B;Hi.then(e=>{xs=e});var Ms=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Os=new Uint32Array([0,1,2,3]),As=new Uint8Array([4]),Ps=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),s=f.div(t.map(e=>"number"==typeof e?e:0),i);if(s.every(e=>1===e))return;this.subdividedGeometry&&bs(this.subdividedGeometry.attributes,...s),this.originalGeometry&&bs(this.originalGeometry.attributes,...s),this.data=e;let r=this.userData.parameters;this.userData.parameters={width:r.width*s[0],height:r.height*s[1],depth:r.depth*s[2]},this.originalGeometry.boundingSphere.center.multiply(Ss.fromArray(s));let n=Ss.set(r.width,r.height,r.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 s=0;try{s=Ps.allocate(e),i=Ps.buildRefined(s,e.subdivisions,t)}catch(t){console.error(t,e)}finally{s&&Ps.freeSubdivPointer(s)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let s=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=s}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=Ps.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new z(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0;let s=this.subdividedGeometry??this.originalGeometry;Object.assign(this,s),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Ps.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;ws.setFromBufferAttribute(t),ws.getCenter(i),e.boundingSphere.radius=i.distanceTo(ws.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ws.getSize(Ss);let s={width:Ss.x,height:Ss.y,depth:Ss.z};return this.userData.parameters=s,s}static build(e,t,i,s){let r,n,a=e?.phongAngle??35;!1===i&&(a=-1),t&&(xs.free_bvh(t),xs.free_subdivision_surface(t));try{r=Ps.allocate(e,s)}catch(t){console.error(t,e),r=Ps.allocate({positionWASM:Ms,indexWASM:Os,verticesPerFaceWASM:As},s)}xs.set_destination_refinement_level(r,0);let o=Ps.buildLevel(r,!0,a);return n=e.subdivisions>0?Ps.buildRefined(r,e.subdivisions,a):null,{subdivPointer:r,originalGeometry:o,subdividedGeometry:n}}static buildRefined(e,t,i){try{return xs.set_destination_refinement_level(e,t),Ps.buildLevel(e,!1,i)??null}catch{try{return xs.set_destination_refinement_level(e,t-1),Ps.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 s,r=void 0!==e.shape||void 0!==e.path?t.geometry:fs(e,i,!1,t);s=l(e)?r.getClosedTorusIndicesForBooleanOrSubdiv():r.getIndex();let n,{positions:a,triIndices:o,triOriginals:h}=Cs(r.getAttribute("position"),s);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,s,r){let n=[],a=[],o=r?i.getAttribute("uv"):void 0,l=o&&2===o.itemSize?[]:void 0,h=e=>{if(l){let t=r[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([]),s=i.userData.parameters.spikes;if("EllipseGeometry"===i.userData.type&&s<=24&&s%4==0&&i.userData.parameters.angle>=360){let e=t.length/2/s;t=t.filter((t,i)=>Math.floor(i/2)%e===0)}let r=0;for(let e=0;e<t.length;e+=2)r+=(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(r<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]){Es.set(e[3*t[u]],e[3*t[u]+1],e[3*t[u]+2]),Is.set(e[3*t[u+1]],e[3*t[u+1]+1],e[3*t[u+1]+2]),Ds.set(e[3*t[u+4]],e[3*t[u+4]+1],e[3*t[u+4]+2]),Ls.set(e[3*t[u+5]],e[3*t[u+5]+1],e[3*t[u+5]+2]),Is.sub(Es).normalize(),Ds.sub(Es).normalize(),Ls.sub(Es).normalize();let i=Is.cross(Ds).dot(Ls),r=u;Math.abs(i)>.005||s&&s.some((e,t)=>t%2!=1&&r>=s[t]&&r<s[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=[],s=[],r=0;for(let i=0,n=0;i<e.length;i+=3,n++)0===e[i+2]&&(t.push(n),r++),e[i+2]===d&&s.push(n);if(0===i.userData.parameters.extrudeBevelSize){let e=s[0];s[0]=s[1],s[1]=e}t.reverse(),n.push(...t,...s),a.push(r,r),l=void 0}return{indices:n,verticesPerFace:a,uvs:l}}(a,o,r,n,h);return{positions:a,indices:d,verticesPerFace:u,uvs:p}}static allocate(e,t){let i,s,r,n=[],a=[];e.positionWASM&&e.positionWASM.length>0?(i=e.positionWASM,s=e.indexWASM,r=e.verticesPerFaceWASM,xs.alloc_subdivision_surface_uvs&&e.uvWASM&&e.uvWASM.length===2*s.length&&(a=e.uvWASM)):(i=Ms,s=Os,r=As);let o,l=i.length,h=s.length,d=r.length,u=i.length+n.length+a.length,p=s.length+r.length,c=u*Float32Array.BYTES_PER_ELEMENT+p*Uint32Array.BYTES_PER_ELEMENT,m=u*Float32Array.BYTES_PER_ELEMENT,g=xs._malloc(c),f=new Float32Array(xs.HEAPF32.buffer,g,u),y=new Uint32Array(xs.HEAPU32.buffer,g+m,p);f.set(i,0),f.set(n,i.length),f.set(a,i.length+n.length),y.set(s,0),y.set(r,s.length),e?.scaleBaked?.some(e=>1!==e)&&(o=(new Z).makeScale(...e.scaleBaked.map(e=>"number"==typeof e?e:1))),t&&(o?o.premultiply(t):o=t);let v=g+(i.length+n.length)*Float32Array.BYTES_PER_ELEMENT,b=a.length?o?xs.alloc_subdivision_surface_uvs2(g,l,g+m,h,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d,v,a.length,o.elements):xs.alloc_subdivision_surface_uvs(g,l,g+m,h,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d,v,a.length):o?xs.alloc_subdivision_surface2(g,l,g+m,h,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d,o.elements):xs.alloc_subdivision_surface(g,l,g+m,h,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d);return xs._free(g),b}static buildLevel(e,t,i,s,r,n=!1){let a=r?xs.get_mesh_data2(e,t?xs.Level.CONTROL:xs.Level.REFINED,i,r.elements):xs.get_mesh_data(e,t?xs.Level.CONTROL:xs.Level.REFINED,i),o=xs.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),h=0,d=xs.HEAPU32[o[h]>>2],u=xs.HEAPF32.subarray(d>>2,(d>>2)+l[h]);h++;let p=xs.HEAPU32[o[h]>>2],c=xs.HEAPF32.subarray(p>>2,(p>>2)+l[h]);h++;let m=xs.HEAPU32[o[h]>>2],g=xs.HEAPU32.subarray(m>>2,(m>>2)+l[h]);h++;let f,y=xs.HEAPU32[o[h]>>2],v=xs.HEAPU32.subarray(y>>2,(y>>2)+l[h]);if(h++,xs.alloc_subdivision_surface_uvs){let e=o[9];if(e>0){let t=xs.HEAPU32[o[8]>>2];f=xs.HEAPF32.subarray(t>>2,(t>>2)+e)}}if(void 0===s){let e=new ce;if(e.setIndex(new C(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 C(g,1));let t=new Float32Array(c.length/3*4).fill(0);e.setAttribute("color",new de(t,4))}return xs.free_mesh_data(a),e.userData.type="SubdivGeometry",e}if(s.getAttribute("position").copyArray(u),s.getAttribute("normal").copyArray(c),s.attributes.position.needsUpdate=!0,s.attributes.normal.needsUpdate=!0,n){let e=s.getIndex();null!==e&&e.array.length===v.length&&(e.copyArray(v),e.needsUpdate=!0)}let b=s.getAttribute("uv");f&&b&&b.array.length===f.length&&(b.copyArray(f),b.needsUpdate=!0),xs.free_mesh_data(a)}static freeSubdivPointer(e){xs.free_bvh(e),xs.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let s=xs.get_wireframe_data_for_base_level(e),r=xs.HEAPU32.subarray(s>>2,4+(s>>2)),n=r.subarray(2,4),a=0,o=xs.HEAPU32[r[a]>>2],l=xs.HEAPF32.subarray(o>>2,(o>>2)+n[a]);a++;let h=xs.HEAPU32[r[a]>>2],d=xs.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,s=l.length;e<s;)t[e++]=i.r,t[e++]=i.g,t[e++]=i.b;return e.setAttribute("color",new de(t,3)),e.setIndex(new C(d,1)),xs.free_wireframe_data_for_base_level(s),e}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,xs.free_wireframe_data_for_base_level(s)}static updateCollabMesh(e,t,i){let s=0===t;s||xs.set_destination_refinement_level(e,t);let r=i?xs.get_topological_data2(e,s?xs.Level.CONTROL:xs.Level.REFINED,i.elements):xs.get_topological_data(e,s?xs.Level.CONTROL:xs.Level.REFINED),n=xs.HEAPU32.subarray(r>>2,8+(r>>2)),a=n.subarray(3,6),o=0,l=xs.HEAPU32[n[o]>>2],h=new Float32Array(xs.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let d=xs.HEAPU32[n[o]>>2],u=new Uint32Array(xs.HEAPU32.subarray(d>>2,(d>>2)+a[o]));o++;let p,c=xs.HEAPU32[n[o]>>2],m=new Uint8Array(xs.HEAPU32.subarray(c>>2,(c>>2)+a[o]));if(xs.alloc_subdivision_surface_uvs){let e=n[7];if(e>0){let t=xs.HEAPU32[n[6]>>2];p=new Float32Array(xs.HEAPF32.subarray(t>>2,(t>>2)+e))}}return xs.free_topological_data(r),{positions:h,indices:u,verticesPerFace:m,uvs:p}}};function _s(e){let t=Object.keys(e);return 1===t.length&&"subdivisions"===t[0]}function Cs(e,t){let i=t?t.count:e.count,s=0,r=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*r),c=Math.round(d*r),m=Math.round(u*r),g=n.get(p);void 0===g&&(g=new Map,n.set(p,g));let f=g.get(c);void 0===f&&(f=new Map,g.set(c,f));let y=f.get(m);void 0===y&&(y=s++,f.set(m,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 Es=new B,Is=new B,Ds=new B,Ls=new B;function Us(e,t){let i=0;if(!e.layers||0===e.layers.length)return!1;let s=e.layers?.find(e=>"light"===e.data.type);if(s){let e=s.data,i=Number(t.getVariable(e.alphaOverride));if(("string"==typeof e.alphaOverride?i/100:e.alphaOverride)<1)return!0}for(let s of e.layers){if("displace"!==s.data.type&&s.data.isMask)return!0;if("displace"!==s.data.type&&"alpha"in s.data&&"light"!==s.data.type&&"fresnel"!==s.data.type&&"cavity"!==s.data.type&&"dust"!==s.data.type&&"texture"!==s.data.type&&"matcap"!==s.data.type&&"rainbow"!==s.data.type&&"outline"!==s.data.type&&"pattern"!==s.data.type){let e=s.data.visible?s.data.alpha:0;if("string"==typeof e&&(e=Math.max(0,Math.min(1,Number(t.getVariable(e)??100)/100))),1===e&&"depth"===s.data.type||"gradient"===s.data.type){for(let t of s.data.colors)if(t[3]<1){e=t[3];break}}else if(1===e&&"noise"===s.data.type){let i=t.color(s.data.colorA).a,r=t.color(s.data.colorB).a,n=t.color(s.data.colorC).a,a=t.color(s.data.colorD).a,o=Math.min(i,Math.min(r,Math.min(n,a)));o<1&&(e=o)}i+=(1-i)*e}}return i<1}var zs=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable("number"==typeof e?100*e:e,i)??100)/100))??1,Bs=(e,t,i)=>"number"==typeof e?e:t.getVariable(e,i);function Rs(e){let t="string"==typeof e?e:e.type;return"texture"===t||"video"===t||"displace_map"===t||"matcap"===t}function Gs(e){return"string"==typeof e||"number"==typeof e&&0!==e}var Ts={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"]},Ns={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]},ks=class extends(n(Q)){},Fs=class extends ks{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 Fs(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)&&(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){}},Vs=class extends mi{},js=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 s=this.objects.get(e);return void 0===s?(s=this.createObject(e,t,i),this.objects.set(e,s)):s.isShared=!0,s}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):p&&console.warn("Reachable but deleted",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()}},Hs=class extends js{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let s=fs(e,t,this.flatShading,i);return s.computeBoundingSphere(),s}},qs={markNeedsUpdateRendererDirty:()=>{}};function Ws(e){return"variable_"+e}var Ys=new Z,Xs=new B,Zs=new U,Js=new B,$s=new $,Ks=class extends bi{constructor(e){super(),this.shared=e}create(e){return new Ai(e,this.shared)}},Qs=class{constructor(e,t={},i=!0,s=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=s,this.geometryCache=new Hs(!0),this.geometryCache2=new Hs(!1),this.imageHolderCache=new Ks(this),this.thisContext={scene:qs,shared:this},this.deletedImage=new Pi(c.emptyImage,this),this.deletedVideo=new Pi(x.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.timelineAnimations={},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(M.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:s}of e.variables)this.addVariableHolder(i,s),t&&this.updateVariableHolder(i,s);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.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);for(let[t,i]of Object.entries(e.timelineAnimations??{}))this.addAnimation(t,i)}addMaterial(e,t){if(void 0===t.layers&&(t={...t,layers:M.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:M.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 Pi(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 Pi(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 Pi(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 Vs(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 mi(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 mi(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 s=new i({src:t.data});return this.audios[e]=s,s}}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=Ae;null!==i?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):m("text","a font asset")}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}addAnimation(e,t){this.timelineAnimations[e]=t}getAnimation(e){return this.timelineAnimations[e]}deleteAniamtion(e){this.timelineAnimations[e]&&delete this.timelineAnimations[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 s=localStorage.getItem(Ws(e));i=null!==s?JSON.parse(s):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(Ws(e),JSON.stringify(t));let i=t;for(;"string"==typeof i;)i=this.variables[i].value;let s=this.entityOpContext.scene,r=!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,r={scene:s,shared:this},a=n.slice(2);s.traverseMaterial(i=>{let s=i.root??i;s.uuid===e&&s.onVariableUpdate(a,t,r)});let o=this.materials[e];o&&o.onVariableUpdate(a,t,r)}else{let o=s.find(n[0]);if(void 0===o){this.variables[e].locations.splice(t,1);continue}if(r=!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*D.DEG2RAD:o[n[n.length-1]]=i}if(o=s.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 r&&s.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(e,t){let i=e;if(i.component&&(i=i.component),"function"!=typeof i.chooseGeoemtryCache)return!1;let s=i.dataPatched,r=s?.geometry;if(!r||"string"!=typeof r.type||"VectorGeometry"===r.type||"PathGeometry"===r.type)return!1;let n=e=>e.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let e of Object.keys(r))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 s=r[t];"number"==typeof i&&isFinite(i)&&("number"==typeof s||"string"==typeof s)&&(o[t]=i)}if(0===Object.keys(o).length)return!1;let l={...r,...o};return i.dataPatched={...s,geometry:l},this.transientGeometryKeys.has(r)&&i.chooseGeoemtryCache(this).forceDelete(s.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 s=i.dataPatched,r=s?.geometry;if(!r||"NonParametricGeometry"!==r.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>Qs.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=r.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,m=-1/0,g=-1/0,f=-1/0;for(let e=0;e<h.length;e+=3){let t=h[e],i=h[e+1],s=h[e+2];t<u&&(u=t),t>m&&(m=t),i<p&&(p=i),i>g&&(g=i),s<c&&(c=s),s>f&&(f=s)}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={...r,width:m-u,height:g-p,depth:f-c,data:{attributes:v,...l?{index:l}:{}}},x=this.transientGeometryKeys.has(r);return i.dataPatched={...s,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 s=i.cloner;if(void 0===s)return-1;let r=s.children,n=Math.PI/180,a=!1;if(null===t)for(let e of r)void 0!==e.transformOverride&&(e.transformOverride=void 0,a=!0);else{if(!Array.isArray(t))return r.length;{let e=Math.min(t.length,r.length);for(let i=0;i<e;i++){let e=t[i],s=r[i];if(null==e){void 0!==s.transformOverride&&(s.transformOverride=void 0,a=!0);continue}let o=s.transformOverride??{position:[s.position.x,s.position.y,s.position.z],rotation:[s.rotation.x,s.rotation.y,s.rotation.z],scale:[s.scale.x,s.scale.y,s.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)),s.transformOverride=o,s.position.fromArray(o.position),s.rotation.fromArray(o.rotation),s.scale.fromArray(o.scale),s.updateMatrix(),s.hasNonUniformScale&&(s.updateMatrixWorld(),s.updateMatrixWorldRigid())}}}return a?s.update(this.entityOpContext):s.syncInstanceMatrices(),s.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r.length}spawnRuntimeClone(e,t={}){if("function"!=typeof e.entityChildren)return;let i=e.parent;if(null===i)return;let s=new Fs(e);s.playModeVisible=!1!==t.visible,s.expand(),"string"==typeof t.name&&(s.name=t.name);let r=Math.PI/180;return s.position.copy(e.position),s.rotation.copy(e.rotation),s.scale.copy(e.scale),s.hiddenMatrix.copy(e.hiddenMatrix),t.position&&("number"==typeof t.position.x&&(s.position.x=t.position.x),"number"==typeof t.position.y&&(s.position.y=t.position.y),"number"==typeof t.position.z&&(s.position.z=t.position.z)),t.rotation&&("number"==typeof t.rotation.x&&(s.rotation.x=t.rotation.x*r),"number"==typeof t.rotation.y&&(s.rotation.y=t.rotation.y*r),"number"==typeof t.rotation.z&&(s.rotation.z=t.rotation.z*r)),t.scale&&("number"==typeof t.scale.x&&(s.scale.x=t.scale.x),"number"==typeof t.scale.y&&(s.scale.y=t.scale.y),"number"==typeof t.scale.z&&(s.scale.z=t.scale.z)),s.updateMatrix(),i.add(s),s.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),s}destroyRuntimeClone(e){e.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(e,t){let i=e.material;if(!i)return!1;let s=[];for(let e of Array.isArray(i)?i:[i]){let t=e.root??e;t&&Array.isArray(t.layers)&&t.data&&!s.includes(t)&&s.push(t)}if(0===s.length)return!1;let r={scene:this.entityOpContext.scene,shared:this},n=e=>e.toLowerCase().replace(/[\s_.-]+/g,""),a=e=>{if("string"==typeof e){let t=new mi(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 s=e.getValue(t);if(!s||"object"!=typeof s||!s.isColor)return!1;let r=i.a??("number"==typeof s.a?s.a:1);return s instanceof Vs?e.setValue(t,new mi(i.r,i.g,i.b,r)):"function"==typeof s.setRGBA?s.setRGBA(i.r,i.g,i.b,r):s.setRGB(i.r,i.g,i.b),!0},l=!1;for(let e of s){let i=e.data.layers??[],s=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&&s(h.id);if(n&&d&&o(d,"color",n)&&(l=!0,void 0!==n.a)){let t=n.a<1||Us(e.data,this);e.setTransparent?e.setTransparent(t,r.scene):e.transparent=t}}"number"==typeof t.alpha&&isFinite(t.alpha)&&(e.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(t.alpha,100)),r),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&&s(t.id);if(!t||!d)continue;let u=Ts[t.data.type]??[],p=Object.keys(t.data);for(let[i,s]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(s);if(c&&o(d,h,c))l=!0;else if("number"==typeof s&&isFinite(s))e.onVariableUpdate?.(["layer",t.id,h],s,r),l=!0;else if(Array.isArray(s)&&s.length<=3&&s.every(e=>"number"==typeof e&&isFinite(e))){let i=["x","y","z"];s.forEach((s,n)=>{e.onVariableUpdate?.(["layer",t.id,h,i[n]],s,r)}),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?.(Ys))return Ys.decompose(Xs,Zs,Js),"position"===e[1]?Xs[e[2]]:($s.setFromQuaternion(Zs,t.rotation.order),$s[e[2]]*D.RAD2DEG);for(let i=1;i<e.length;i++)t=t[e[i]];return"rotation"===e[1]&&(t*=D.RAD2DEG),t}for(let e in this.variables){if(void 0===t)break;let i=this.variables[e],s=i.locations?.findIndex(e=>_.equal(e,t));void 0!==s&&-1!==s&&i.locations.splice(s,1)}if("string"==typeof e){let i=e,s=e;do{if(s=i,void 0===this.variables[i])break;let e=this.variables[i].value;t&&void 0!==this.variables[s]&&this.variables[s].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.materials))this.addMaterial(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(A.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,s=this.getUserAPI(e.path[1]);void 0!==s&&s===this.openAIRealtime?s.update(i):s?.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(A.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let s=this.getFont(e),r={...this.data.fonts[e],url:t.props.url};s.update(r),s.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(i,s){if(this.userAPIs[i])return this.userAPIs[i].update(s,this),!0;if(this.openAIRealtime?.id===i)return this.openAIRealtime.update(s),!0;if("VoiceAssistant"===s.integration?.type){let e=t();return null===e?(m("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=e(s,i,this),!1)}{let t=e();return null===t?(m("api-services","a user API integration"),!1):(this.userAPIs[i]=t.createUserAPI(i,s,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 s=e();return null===s?(m("api-services","a user webhook"),!1):(this.userWebhooks[t]=s.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}},er=Qs;function tr(e){return!0===e?.isClassicNodeMaterial}function ir(e){return tr(e)||!0===e?.isTSLNodeMaterial}er.MAX_TRANSIENT_VERTICES=6e4,new er(v.emptyData());var sr=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),r(e.path,["geometry"])&&this.syncShadowCatcher(i),null!==s(e.path,["materials"])&&0===e.type&&Array.isArray(this.material))for(let[t,s]of Object.entries(e.props)){let e=this.material[Number(t)],r=i.shared.material(s);r!==e&&sr.disposeOneMaterial(e),this.material[Number(t)]=r}else if(r(e.path,["material"])){let s=this.material;!Array.isArray(s)&&"function"==typeof s?.updateByOp&&"material"in t&&"string"!=typeof t.material&&s.updateByOp(A.drop(e,1),t.material,i)}else if(r(e.path,["materials","*"])&&Array.isArray(this.material)){let s=e.path[1];if("materials"in t&&s<this.material.length){let r=t.materials[s];"string"!=typeof r&&this.material[s].updateByOp(A.drop(e,2),r,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,s=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 r=void 0!==this.materialOverride;!r&&"NonParametricGeometry"!==e.geometry?.type&&"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(s.flatShading,s.side,s.wireframe,i),t.scene.markNeedsUpdateRendererDirty()),!r&&("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(s.flatShading,s.side,s.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(s.flatShading,s.side,s.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let n=this.data;if(!r&&"NonParametricGeometry"!==n.geometry?.type&&"materials"in n&&void 0!==n.materials&&(this.disposeMaterial(),this.material=t.shared.material(n.materials[0]).getFlavor(s.flatShading,s.side,s.wireframe)),!r&&(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(s.flatShading,s.side,s.wireframe);else this.material=this.material.getFlavor(s.flatShading,s.side,s.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){ir(e)&&!function(e){return function(e){return!0===e?.isClassicSharedMaterial}(e)||!0===e?.isTSLSharedMaterial}(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&w(this.material).forEach(e=>{sr.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}},rr=new B,nr=new H,ar=new H,or=new B,lr=new Z,hr=class extends sr{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 Z).fromArray(t.bindMatrix),this.bindMatrixInverse=new Z)}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 er){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 P.is2DParametricMesh(e.type)&&0===e.depth}get is2DType(){return P.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return"NonParametricGeometry"===this.geometry.userData.type}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),r(e.path,["geometry"])&&this.updateByPatchedOpGeometry(A.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if("NonParametricGeometry"===i||"SubdivGeometry"===i){let i,s,r,n=e;if(void 0===this.localGeometry){let e={...this.data.geometry,...n};this.localGeometry=fs(e,t,this.data.flatShading,this)}n.scaleBaked?[i,s,r]=n.scaleBaked:({width:i,height:s,depth:r}=n);let a=this.localGeometry.userData,o="number"==typeof i?i:1,l="number"==typeof s?s:1,h="number"==typeof r?r:1;void 0!==a.sxPrev&&bs(this.localGeometry.attributes,o/a.sxPrev,l/a.syPrev,h/a.szPrev),a.sxPrev=o,a.syPrev=l,a.szPrev=h}else{let i=fs({...this.data.geometry,...e},t,this.data.flatShading,this);void 0!==this.localGeometry&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&vs(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 s=!1;if(0===e.type&&0===e.path.length&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Ps&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!s&&0===e.type&&0===e.path.length&&_s(e.props)&&this.geometryCreateDeleyed instanceof Ps&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(t),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!s&&0===e.type&&0===e.path.length&&this.geometryCreateDeleyed instanceof ce&&!(this.geometryCreateDeleyed instanceof Ps)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&void 0!==this._geometryCacheKey){let e=i.shared,t=this.chooseGeoemtryCache(e),r=this.geometryCreateDeleyed;if(t.getCached(this._geometryCacheKey)===r&&!0!==r.isShared){let n=this.dataPatched.geometry,a=fs(n,e,this.data.flatShading,this);vs(r,a)?(a.dispose(),r.computeBoundingSphere(),t.mutateIfUnique(this._geometryCacheKey,n)):(a.computeBoundingSphere(),t.forceDelete(this._geometryCacheKey),t.adopt(n,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=n,s=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}s||(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,s=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof ce&&!(this.geometryCreateDeleyed instanceof Ps)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&void 0!==this._geometryCacheKey){let t=this.chooseGeoemtryCache(i),r=this.geometryCreateDeleyed;if(t.getCached(this._geometryCacheKey)===r&&!0!==r.isShared){let n=fs(s,i,this.data.flatShading,this);return vs(r,n)?(n.dispose(),r.computeBoundingSphere(),t.mutateIfUnique(this._geometryCacheKey,s)):(n.computeBoundingSphere(),t.forceDelete(this._geometryCacheKey),t.adopt(s,n),this.geometryCreateDeleyed=n),this._geometryCacheKey=s,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:s}}of i)this.updateMorphInfluences(e,t.shared.getVariable(s,[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,s=i.count;e<s;e++){t.fromBufferAttribute(i,e);let s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):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 s=this.geometry;nr.fromBufferAttribute(s.attributes.skinIndex,e),ar.fromBufferAttribute(s.attributes.skinWeight,e),rr.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let s=ar.getComponent(e);if(0!==s){let r=nr.getComponent(e);lr.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),t.addScaledVector(or.copy(rr).applyMatrix4(lr),s)}}return t.applyMatrix4(this.bindMatrixInverse)}};export{be as a,we as b,hi as c,ui as d,pi as e,ci as f,tr as g,mi as h,Vs as i,yi as j,Si as k,Mi as l,Pi as m,Pe 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,Ps as E,_s as F,Cs as G,cs as H,fs as I,Xt as J,Zt as K,Jt as L,$t as M,Qt as N,ii as O,si as P,ri as Q,ni as R,ai as S,oi as T,Us as U,zs as V,Bs as W,Rs as X,Gs as Y,Ts as Z,Ns as _,Fs as $,Ws as aa,er as ba,ir as ca,sr as da,hr as ea};
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file