@splinetool/runtime 2.0.11 → 2.0.13

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 (270) hide show
  1. package/build/{runtime-chunk-H3NZ2DPE.js → runtime-chunk-2GAIM5RJ.js} +1 -1
  2. package/build/runtime-chunk-2GAIM5RJ.js.br +0 -0
  3. package/build/runtime-chunk-2GAIM5RJ.js.gz +0 -0
  4. package/build/{runtime-chunk-ALDD75EK.js → runtime-chunk-2S2NQ44M.js} +1 -1
  5. package/build/runtime-chunk-2S2NQ44M.js.br +0 -0
  6. package/build/runtime-chunk-2S2NQ44M.js.gz +0 -0
  7. package/build/{runtime-chunk-7UK5TXXX.js → runtime-chunk-3IBXKX7I.js} +1 -1
  8. package/build/runtime-chunk-3IBXKX7I.js.br +0 -0
  9. package/build/runtime-chunk-3IBXKX7I.js.gz +0 -0
  10. package/build/{runtime-chunk-5GCT2MXQ.js → runtime-chunk-4GNBET46.js} +1 -1
  11. package/build/runtime-chunk-4GNBET46.js.br +0 -0
  12. package/build/runtime-chunk-4GNBET46.js.gz +0 -0
  13. package/build/{runtime-chunk-CSQ34B7E.js → runtime-chunk-5POGWSQZ.js} +1 -1
  14. package/build/runtime-chunk-5POGWSQZ.js.br +0 -0
  15. package/build/runtime-chunk-5POGWSQZ.js.gz +0 -0
  16. package/build/{runtime-chunk-MQKKQEK3.js → runtime-chunk-A7IMJ4FJ.js} +1 -1
  17. package/build/runtime-chunk-A7IMJ4FJ.js.br +0 -0
  18. package/build/{runtime-chunk-MQKKQEK3.js.gz → runtime-chunk-A7IMJ4FJ.js.gz} +0 -0
  19. package/build/{runtime-chunk-DX665HUE.js → runtime-chunk-ALTKMFUV.js} +1 -1
  20. package/build/runtime-chunk-ALTKMFUV.js.br +0 -0
  21. package/build/runtime-chunk-ALTKMFUV.js.gz +0 -0
  22. package/build/{runtime-chunk-DA36J6OU.js → runtime-chunk-BEWQ5BW5.js} +1 -1
  23. package/build/runtime-chunk-BEWQ5BW5.js.br +0 -0
  24. package/build/runtime-chunk-BEWQ5BW5.js.gz +0 -0
  25. package/build/{runtime-chunk-HLXTXF7I.js → runtime-chunk-ESL2VL5C.js} +1 -1
  26. package/build/runtime-chunk-ESL2VL5C.js.br +0 -0
  27. package/build/runtime-chunk-ESL2VL5C.js.gz +0 -0
  28. package/build/{runtime-chunk-4ENGAWL7.js → runtime-chunk-F5CUMYOK.js} +1 -1
  29. package/build/runtime-chunk-F5CUMYOK.js.br +0 -0
  30. package/build/runtime-chunk-F5CUMYOK.js.gz +0 -0
  31. package/build/{runtime-chunk-BY4Y72LZ.js → runtime-chunk-HKFPEE5F.js} +1 -1
  32. package/build/runtime-chunk-HKFPEE5F.js.br +0 -0
  33. package/build/runtime-chunk-HKFPEE5F.js.gz +0 -0
  34. package/build/{runtime-chunk-FJ3HZ257.js → runtime-chunk-ITI3UXPR.js} +1 -1
  35. package/build/runtime-chunk-ITI3UXPR.js.br +0 -0
  36. package/build/runtime-chunk-ITI3UXPR.js.gz +0 -0
  37. package/build/{runtime-chunk-O6F5QJHF.js → runtime-chunk-JIIVUL2M.js} +1 -1
  38. package/build/runtime-chunk-JIIVUL2M.js.br +0 -0
  39. package/build/runtime-chunk-JIIVUL2M.js.gz +0 -0
  40. package/build/{runtime-chunk-K3MY5TZT.js → runtime-chunk-JLL5C22M.js} +1 -1
  41. package/build/runtime-chunk-JLL5C22M.js.br +0 -0
  42. package/build/runtime-chunk-JLL5C22M.js.gz +0 -0
  43. package/build/{runtime-chunk-XT53PDQV.js → runtime-chunk-JSOWOATQ.js} +1 -1
  44. package/build/runtime-chunk-JSOWOATQ.js.br +0 -0
  45. package/build/runtime-chunk-JSOWOATQ.js.gz +0 -0
  46. package/build/{runtime-chunk-DQMOB5OU.js → runtime-chunk-MJYVLFQT.js} +1 -1
  47. package/build/runtime-chunk-MJYVLFQT.js.br +0 -0
  48. package/build/runtime-chunk-MJYVLFQT.js.gz +0 -0
  49. package/build/{runtime-chunk-FYQSEYL5.js → runtime-chunk-OUQPS3VD.js} +1 -1
  50. package/build/runtime-chunk-OUQPS3VD.js.br +0 -0
  51. package/build/runtime-chunk-OUQPS3VD.js.gz +0 -0
  52. package/build/{runtime-chunk-FBNDPGTS.js → runtime-chunk-PS74VRLB.js} +1 -1
  53. package/build/runtime-chunk-PS74VRLB.js.br +0 -0
  54. package/build/runtime-chunk-PS74VRLB.js.gz +0 -0
  55. package/build/{runtime-chunk-CUGQPKPQ.js → runtime-chunk-QMMGYOLW.js} +1 -1
  56. package/build/runtime-chunk-QMMGYOLW.js.br +0 -0
  57. package/build/runtime-chunk-QMMGYOLW.js.gz +0 -0
  58. package/build/{runtime-chunk-OWPKF7IL.js → runtime-chunk-SJQBQYDG.js} +1 -1
  59. package/build/runtime-chunk-SJQBQYDG.js.br +0 -0
  60. package/build/runtime-chunk-SJQBQYDG.js.gz +0 -0
  61. package/build/{runtime-chunk-NHLFGFU5.js → runtime-chunk-T4UMOSIQ.js} +1 -1
  62. package/build/runtime-chunk-T4UMOSIQ.js.br +0 -0
  63. package/build/runtime-chunk-T4UMOSIQ.js.gz +0 -0
  64. package/build/{runtime-chunk-I5YVCEFL.js → runtime-chunk-VAANBQKN.js} +1 -1
  65. package/build/runtime-chunk-VAANBQKN.js.br +0 -0
  66. package/build/runtime-chunk-VAANBQKN.js.gz +0 -0
  67. package/build/{runtime-chunk-AVO7AFZY.js → runtime-chunk-WILQUYJ4.js} +1 -1
  68. package/build/runtime-chunk-WILQUYJ4.js.br +0 -0
  69. package/build/runtime-chunk-WILQUYJ4.js.gz +0 -0
  70. package/build/{runtime-chunk-T7HEAOAP.js → runtime-chunk-WWYY25M2.js} +1 -1
  71. package/build/runtime-chunk-WWYY25M2.js.br +0 -0
  72. package/build/runtime-chunk-WWYY25M2.js.gz +0 -0
  73. package/build/{runtime-chunk-Q23Z6MJP.js → runtime-chunk-XUHTMJJD.js} +1 -1
  74. package/build/runtime-chunk-XUHTMJJD.js.br +0 -0
  75. package/build/runtime-chunk-XUHTMJJD.js.gz +0 -0
  76. package/build/{runtime-chunk-LEHYVJOU.js → runtime-chunk-YH55FWRI.js} +1 -1
  77. package/build/runtime-chunk-YH55FWRI.js.br +0 -0
  78. package/build/runtime-chunk-YH55FWRI.js.gz +0 -0
  79. package/build/{runtime-classicRuntime-K34VIFGP.js → runtime-classicRuntime-ZJP7UOQK.js} +1 -1
  80. package/build/runtime-classicRuntime-ZJP7UOQK.js.br +0 -0
  81. package/build/runtime-classicRuntime-ZJP7UOQK.js.gz +0 -0
  82. package/build/{runtime-cloners-3Y3EIRQD.js → runtime-cloners-V4TFNW2E.js} +1 -1
  83. package/build/runtime-cloners-V4TFNW2E.js.br +0 -0
  84. package/build/runtime-cloners-V4TFNW2E.js.gz +0 -0
  85. package/build/{runtime-components-OIRGNZ53.js → runtime-components-P5ZGYATF.js} +1 -1
  86. package/build/runtime-components-P5ZGYATF.js.br +0 -0
  87. package/build/runtime-components-P5ZGYATF.js.gz +0 -0
  88. package/build/{runtime-createDestroy-IXF6AHPT.js → runtime-createDestroy-MAV4GFE6.js} +1 -1
  89. package/build/runtime-createDestroy-MAV4GFE6.js.br +0 -0
  90. package/build/runtime-createDestroy-MAV4GFE6.js.gz +0 -0
  91. package/build/{runtime-dragDrop-XMMLZ4DN.js → runtime-dragDrop-IZ74WMYA.js} +1 -1
  92. package/build/runtime-dragDrop-IZ74WMYA.js.br +0 -0
  93. package/build/runtime-dragDrop-IZ74WMYA.js.gz +0 -0
  94. package/build/{runtime-gameControls-AJVDYQ34.js → runtime-gameControls-ALSYS4GT.js} +1 -1
  95. package/build/runtime-gameControls-ALSYS4GT.js.br +0 -0
  96. package/build/runtime-gameControls-ALSYS4GT.js.gz +0 -0
  97. package/build/{runtime-hair-LL7HBW3N.js → runtime-hair-PML4TDM4.js} +1 -1
  98. package/build/runtime-hair-PML4TDM4.js.br +1 -0
  99. package/build/runtime-hair-PML4TDM4.js.gz +0 -0
  100. package/build/{runtime-mergeStaticGeometries-SLURKUQL.js → runtime-mergeStaticGeometries-OPJK4T22.js} +1 -1
  101. package/build/runtime-mergeStaticGeometries-OPJK4T22.js.br +0 -0
  102. package/build/runtime-mergeStaticGeometries-OPJK4T22.js.gz +0 -0
  103. package/build/{runtime-miscActions-MYXVSOXT.js → runtime-miscActions-JZQXYHKG.js} +1 -1
  104. package/build/runtime-miscActions-JZQXYHKG.js.br +0 -0
  105. package/build/runtime-miscActions-JZQXYHKG.js.gz +0 -0
  106. package/build/{runtime-mouseHover-VNG5G3EV.js → runtime-mouseHover-FM43SWSA.js} +1 -1
  107. package/build/runtime-mouseHover-FM43SWSA.js.br +0 -0
  108. package/build/runtime-mouseHover-FM43SWSA.js.gz +0 -0
  109. package/build/{runtime-particles-WY5ERTQY.js → runtime-particles-NY5M47HQ.js} +1 -1
  110. package/build/runtime-particles-NY5M47HQ.js.br +0 -0
  111. package/build/runtime-particles-NY5M47HQ.js.gz +0 -0
  112. package/build/{runtime-paths-EBK4AK5D.js → runtime-paths-LU43LMTP.js} +1 -1
  113. package/build/runtime-paths-LU43LMTP.js.br +0 -0
  114. package/build/runtime-paths-LU43LMTP.js.gz +0 -0
  115. package/build/{runtime-resize-ARFL653M.js → runtime-resize-BWOD7P3W.js} +1 -1
  116. package/build/runtime-resize-BWOD7P3W.js.br +0 -0
  117. package/build/runtime-resize-BWOD7P3W.js.gz +0 -0
  118. package/build/{runtime-sceneTransition-U767Q26P.js → runtime-sceneTransition-4R6LM4MA.js} +1 -1
  119. package/build/runtime-sceneTransition-4R6LM4MA.js.br +0 -0
  120. package/build/runtime-sceneTransition-4R6LM4MA.js.gz +0 -0
  121. package/build/{runtime-scroll-PJN2KY5P.js → runtime-scroll-KEVND4W5.js} +1 -1
  122. package/build/runtime-scroll-KEVND4W5.js.br +0 -0
  123. package/build/runtime-scroll-KEVND4W5.js.gz +0 -0
  124. package/build/runtime-shapeBlends-LXJ4P3XD.js +1 -0
  125. package/build/runtime-shapeBlends-LXJ4P3XD.js.br +0 -0
  126. package/build/runtime-shapeBlends-LXJ4P3XD.js.gz +0 -0
  127. package/build/{runtime-text-BIQDLMVM.js → runtime-text-43V5BJGN.js} +1 -1
  128. package/build/runtime-text-43V5BJGN.js.br +0 -0
  129. package/build/runtime-text-43V5BJGN.js.gz +0 -0
  130. package/build/{runtime-textInputs-PBVRLIAG.js → runtime-textInputs-WPBZO7XI.js} +1 -1
  131. package/build/runtime-textInputs-WPBZO7XI.js.br +0 -0
  132. package/build/runtime-textInputs-WPBZO7XI.js.gz +0 -0
  133. package/build/{runtime-timeline-FZBQAKBM.js → runtime-timeline-AERFJWNC.js} +1 -1
  134. package/build/runtime-timeline-AERFJWNC.js.br +0 -0
  135. package/build/runtime-timeline-AERFJWNC.js.gz +0 -0
  136. package/build/{runtime-tracking-OGGWBM2F.js → runtime-tracking-T55DMPAI.js} +1 -1
  137. package/build/runtime-tracking-T55DMPAI.js.br +0 -0
  138. package/build/runtime-tracking-T55DMPAI.js.gz +0 -0
  139. package/build/{runtime-transitions-UZMSVIQQ.js → runtime-transitions-SLQEEKRO.js} +1 -1
  140. package/build/runtime-transitions-SLQEEKRO.js.br +0 -0
  141. package/build/runtime-transitions-SLQEEKRO.js.gz +0 -0
  142. package/build/{runtime-ui2d-3SFWWIHX.js → runtime-ui2d-FPEODT3M.js} +1 -1
  143. package/build/runtime-ui2d-FPEODT3M.js.br +0 -0
  144. package/build/runtime-ui2d-FPEODT3M.js.gz +0 -0
  145. package/build/{runtime-vectorShapes-LG23IGW6.js → runtime-vectorShapes-ZXLM5DCY.js} +1 -1
  146. package/build/runtime-vectorShapes-ZXLM5DCY.js.br +0 -0
  147. package/build/runtime-vectorShapes-ZXLM5DCY.js.gz +0 -0
  148. package/build/{runtime-webgpu-HA7LX6HX.js → runtime-webgpu-WHAEJKRX.js} +1 -1
  149. package/build/runtime-webgpu-WHAEJKRX.js.br +0 -0
  150. package/build/runtime-webgpu-WHAEJKRX.js.gz +0 -0
  151. package/build/runtime.cjs +5 -5
  152. package/build/runtime.js +1 -1
  153. package/build/runtime.js.br +0 -0
  154. package/build/runtime.js.gz +0 -0
  155. package/build/runtime.standalone.js +1 -1
  156. package/build/runtime.standalone.js.br +0 -0
  157. package/build/runtime.standalone.js.gz +0 -0
  158. package/build/runtime.standalone.webgl.js +1 -1
  159. package/build/runtime.standalone.webgl.js.br +0 -0
  160. package/build/runtime.standalone.webgl.js.gz +0 -0
  161. package/build/runtime.standalone.webgpu.js +1 -1
  162. package/build/runtime.standalone.webgpu.js.br +0 -0
  163. package/build/runtime.standalone.webgpu.js.gz +0 -0
  164. package/build/runtime.standalone.webgpu.micro.js +1 -1
  165. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  166. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  167. package/build/runtime.standalone.webgpu.min.js +1 -1
  168. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  169. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  170. package/package.json +1 -1
  171. package/build/runtime-chunk-4ENGAWL7.js.br +0 -0
  172. package/build/runtime-chunk-4ENGAWL7.js.gz +0 -0
  173. package/build/runtime-chunk-5GCT2MXQ.js.br +0 -0
  174. package/build/runtime-chunk-5GCT2MXQ.js.gz +0 -0
  175. package/build/runtime-chunk-7UK5TXXX.js.br +0 -0
  176. package/build/runtime-chunk-7UK5TXXX.js.gz +0 -0
  177. package/build/runtime-chunk-ALDD75EK.js.br +0 -0
  178. package/build/runtime-chunk-ALDD75EK.js.gz +0 -0
  179. package/build/runtime-chunk-AVO7AFZY.js.br +0 -0
  180. package/build/runtime-chunk-AVO7AFZY.js.gz +0 -0
  181. package/build/runtime-chunk-BY4Y72LZ.js.br +0 -0
  182. package/build/runtime-chunk-BY4Y72LZ.js.gz +0 -0
  183. package/build/runtime-chunk-CSQ34B7E.js.br +0 -0
  184. package/build/runtime-chunk-CSQ34B7E.js.gz +0 -0
  185. package/build/runtime-chunk-CUGQPKPQ.js.br +0 -0
  186. package/build/runtime-chunk-CUGQPKPQ.js.gz +0 -0
  187. package/build/runtime-chunk-DA36J6OU.js.br +0 -0
  188. package/build/runtime-chunk-DA36J6OU.js.gz +0 -0
  189. package/build/runtime-chunk-DQMOB5OU.js.br +0 -0
  190. package/build/runtime-chunk-DQMOB5OU.js.gz +0 -0
  191. package/build/runtime-chunk-DX665HUE.js.br +0 -0
  192. package/build/runtime-chunk-DX665HUE.js.gz +0 -0
  193. package/build/runtime-chunk-FBNDPGTS.js.br +0 -0
  194. package/build/runtime-chunk-FBNDPGTS.js.gz +0 -0
  195. package/build/runtime-chunk-FJ3HZ257.js.br +0 -0
  196. package/build/runtime-chunk-FJ3HZ257.js.gz +0 -0
  197. package/build/runtime-chunk-FYQSEYL5.js.br +0 -0
  198. package/build/runtime-chunk-FYQSEYL5.js.gz +0 -0
  199. package/build/runtime-chunk-H3NZ2DPE.js.br +0 -0
  200. package/build/runtime-chunk-H3NZ2DPE.js.gz +0 -0
  201. package/build/runtime-chunk-HLXTXF7I.js.br +0 -0
  202. package/build/runtime-chunk-HLXTXF7I.js.gz +0 -0
  203. package/build/runtime-chunk-I5YVCEFL.js.br +0 -0
  204. package/build/runtime-chunk-I5YVCEFL.js.gz +0 -0
  205. package/build/runtime-chunk-K3MY5TZT.js.br +0 -0
  206. package/build/runtime-chunk-K3MY5TZT.js.gz +0 -0
  207. package/build/runtime-chunk-LEHYVJOU.js.br +0 -0
  208. package/build/runtime-chunk-LEHYVJOU.js.gz +0 -0
  209. package/build/runtime-chunk-MQKKQEK3.js.br +0 -0
  210. package/build/runtime-chunk-NHLFGFU5.js.br +0 -0
  211. package/build/runtime-chunk-NHLFGFU5.js.gz +0 -0
  212. package/build/runtime-chunk-O6F5QJHF.js.br +0 -0
  213. package/build/runtime-chunk-O6F5QJHF.js.gz +0 -0
  214. package/build/runtime-chunk-OWPKF7IL.js.br +0 -0
  215. package/build/runtime-chunk-OWPKF7IL.js.gz +0 -0
  216. package/build/runtime-chunk-Q23Z6MJP.js.br +0 -0
  217. package/build/runtime-chunk-Q23Z6MJP.js.gz +0 -0
  218. package/build/runtime-chunk-T7HEAOAP.js.br +0 -0
  219. package/build/runtime-chunk-T7HEAOAP.js.gz +0 -0
  220. package/build/runtime-chunk-XT53PDQV.js.br +0 -0
  221. package/build/runtime-chunk-XT53PDQV.js.gz +0 -0
  222. package/build/runtime-classicRuntime-K34VIFGP.js.br +0 -0
  223. package/build/runtime-classicRuntime-K34VIFGP.js.gz +0 -0
  224. package/build/runtime-cloners-3Y3EIRQD.js.br +0 -1
  225. package/build/runtime-cloners-3Y3EIRQD.js.gz +0 -0
  226. package/build/runtime-components-OIRGNZ53.js.br +0 -0
  227. package/build/runtime-components-OIRGNZ53.js.gz +0 -0
  228. package/build/runtime-createDestroy-IXF6AHPT.js.br +0 -0
  229. package/build/runtime-createDestroy-IXF6AHPT.js.gz +0 -0
  230. package/build/runtime-dragDrop-XMMLZ4DN.js.br +0 -0
  231. package/build/runtime-dragDrop-XMMLZ4DN.js.gz +0 -0
  232. package/build/runtime-gameControls-AJVDYQ34.js.br +0 -0
  233. package/build/runtime-gameControls-AJVDYQ34.js.gz +0 -0
  234. package/build/runtime-hair-LL7HBW3N.js.br +0 -2
  235. package/build/runtime-hair-LL7HBW3N.js.gz +0 -0
  236. package/build/runtime-mergeStaticGeometries-SLURKUQL.js.br +0 -0
  237. package/build/runtime-mergeStaticGeometries-SLURKUQL.js.gz +0 -0
  238. package/build/runtime-miscActions-MYXVSOXT.js.br +0 -0
  239. package/build/runtime-miscActions-MYXVSOXT.js.gz +0 -0
  240. package/build/runtime-mouseHover-VNG5G3EV.js.br +0 -0
  241. package/build/runtime-mouseHover-VNG5G3EV.js.gz +0 -0
  242. package/build/runtime-particles-WY5ERTQY.js.br +0 -0
  243. package/build/runtime-particles-WY5ERTQY.js.gz +0 -0
  244. package/build/runtime-paths-EBK4AK5D.js.br +0 -0
  245. package/build/runtime-paths-EBK4AK5D.js.gz +0 -0
  246. package/build/runtime-resize-ARFL653M.js.br +0 -0
  247. package/build/runtime-resize-ARFL653M.js.gz +0 -0
  248. package/build/runtime-sceneTransition-U767Q26P.js.br +0 -0
  249. package/build/runtime-sceneTransition-U767Q26P.js.gz +0 -0
  250. package/build/runtime-scroll-PJN2KY5P.js.br +0 -0
  251. package/build/runtime-scroll-PJN2KY5P.js.gz +0 -0
  252. package/build/runtime-shapeBlends-QL2RV3WU.js +0 -1
  253. package/build/runtime-shapeBlends-QL2RV3WU.js.br +0 -4
  254. package/build/runtime-shapeBlends-QL2RV3WU.js.gz +0 -0
  255. package/build/runtime-text-BIQDLMVM.js.br +0 -0
  256. package/build/runtime-text-BIQDLMVM.js.gz +0 -0
  257. package/build/runtime-textInputs-PBVRLIAG.js.br +0 -0
  258. package/build/runtime-textInputs-PBVRLIAG.js.gz +0 -0
  259. package/build/runtime-timeline-FZBQAKBM.js.br +0 -0
  260. package/build/runtime-timeline-FZBQAKBM.js.gz +0 -0
  261. package/build/runtime-tracking-OGGWBM2F.js.br +0 -0
  262. package/build/runtime-tracking-OGGWBM2F.js.gz +0 -0
  263. package/build/runtime-transitions-UZMSVIQQ.js.br +0 -0
  264. package/build/runtime-transitions-UZMSVIQQ.js.gz +0 -0
  265. package/build/runtime-ui2d-3SFWWIHX.js.br +0 -0
  266. package/build/runtime-ui2d-3SFWWIHX.js.gz +0 -0
  267. package/build/runtime-vectorShapes-LG23IGW6.js.br +0 -0
  268. package/build/runtime-vectorShapes-LG23IGW6.js.gz +0 -0
  269. package/build/runtime-webgpu-HA7LX6HX.js.br +0 -0
  270. package/build/runtime-webgpu-HA7LX6HX.js.gz +0 -0
package/build/runtime.cjs CHANGED
@@ -4124,14 +4124,14 @@ void main() {
4124
4124
  }
4125
4125
  post({ kind: 'ready' });
4126
4126
  }, 250);
4127
- })();`});function GZ(i,t){let e=[];for(let n of Object.keys(t))i[n]!==t[n]&&e.push({name:n,value:t[n]});return e}var zZ,kp,nC=F(()=>{"use strict";zZ=100;kp=class{constructor(t,e,n){this.deps=t;this.onConsole=e;this.onEvent=n;this.disposed=!1;this.eventUnsubs=new Map;this.variablePollHandle=null;this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let n=this.deps;switch(t){case"setVariable":{let r=n.setVariable(String(e[0]),e[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=e[0]??{},s=!0;for(let[a,o]of Object.entries(r)){let l=n.setVariable(a,o);l.warning&&this.onConsole("warn",l.warning),s=s&&l.ok}return s}case"getVariable":return n.getVariable(String(e[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(e[0]));case"getGeometry":{let r=n.getGeometry(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return n.updateObject(String(e[0]),e[1]??{});case"createObject":return n.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":{if(n.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(e[0])}case"setMaterial":{if(n.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.setMaterial(String(e[0]),e[1])}case"cloneObject":return n.cloneObject(String(e[0]),e[1]??{});case"removeObject":return n.removeObject(String(e[0]));case"spawnObject":{let r=n.spawnObject(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return n.destroyObject(String(e[0]));case"setInstanceTransforms":{let r=e[1]===null||e[1]===void 0?null:e[1],s=n.setInstanceTransforms(String(e[0]),r);return s<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),s}case"emitEvent":case"emitEventReverse":{let r=n.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return n.requestRender(),!0;case"listenEvent":{let r=String(e[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,n.addSplineEventListener(r,s=>{this.onEvent(r,s)})),!0}case"unlistenEvent":{let r=String(e[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:{let r=t;throw new Error(`Unknown spline bridge method: ${r}`)}}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=GZ(this.lastVariables??{},t);this.lastVariables=t;for(let n of e)this.onEvent("variableChange",n)},zZ))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function jZ(i,t,e,n){return[i[0]*t+i[4]*e+i[8]*n+i[12],i[1]*t+i[5]*e+i[9]*n+i[13],i[2]*t+i[6]*e+i[10]*n+i[14]]}function HZ(i){let t=i[0],e=i[4],n=i[8],r=i[1],s=i[5],a=i[9],o=i[2],l=i[6],c=i[10],u=t*(s*c-a*l)-e*(r*c-a*o)+n*(r*l-s*o);if(!isFinite(u)||Math.abs(u)<1e-12)return null;let d=1/u,h=[(s*c-a*l)*d,(n*l-e*c)*d,(e*a-n*s)*d,(a*o-r*c)*d,(t*c-n*o)*d,(n*r-t*a)*d,(r*l-s*o)*d,(e*o-t*l)*d,(t*s-e*r)*d];return[h[0],h[3],h[6],h[1],h[4],h[7],h[2],h[5],h[8]]}function N3(i,t){let e=i?.getAttribute("position");if(!e||!e.count)return null;let n=e.count,r=t??null,s=i.getIndex?.()??null,a=Math.floor((s?s.count:n)/3),o=1/0,l=1/0,c=1/0,u=-1/0,d=-1/0,h=-1/0,p=new Float32Array(n*3);for(let y=0;y<n;y++){let v=e.getX(y),b=e.getY(y),x=e.getZ(y);r&&([v,b,x]=jZ(r,v,b,x)),v<o&&(o=v),b<l&&(l=b),x<c&&(c=x),v>u&&(u=v),b>d&&(d=b),x>h&&(h=x),p[y*3]=v,p[y*3+1]=b,p[y*3+2]=x}let f={space:r?"world":"local",vertexCount:n,triangleCount:a,indexed:s!==null,bounds:{min:[o,l,c],max:[u,d,h],size:[u-o,d-l,h-c]},vertices:p};if(s){let y=new Uint32Array(s.count);for(let v=0;v<s.count;v++)y[v]=s.getX(v);f.indices=y}let m=i.getAttribute("normal");if(m&&m.count===n){let y=r?HZ(r):void 0;if(!r||y){let v=new Float32Array(n*3);for(let b=0;b<n;b++){let x=m.getX(b),S=m.getY(b),E=m.getZ(b);if(y){let M=y[0]*x+y[1]*S+y[2]*E,w=y[3]*x+y[4]*S+y[5]*E,T=y[6]*x+y[7]*S+y[8]*E,A=Math.hypot(M,w,T);A>1e-12?(x=M/A,S=w/A,E=T/A):(x=M,S=w,E=T)}v[b*3]=x,v[b*3+1]=S,v[b*3+2]=E}f.normals=v}}let g=i.getAttribute("uv");if(g&&g.count===n){let y=new Float32Array(n*2);for(let v=0;v<n;v++)y[v*2]=g.getX(v),y[v*2+1]=g.getY(v);f.uvs=y}return f}var B3=F(()=>{"use strict"});function F3(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let i=[],t=(r,s,a)=>{let o=new Event(a);try{typeof s=="function"?s.call(r,o):s.handleEvent?.(o)}catch(l){console.error(l)}},e=(r,s)=>{let a=new Set,o=r.addEventListener.bind(r),l=r.removeEventListener.bind(r),c=(d,h,p)=>{if(o(d,h,p),!s.includes(d)||h==null)return;let f={type:d,listener:h};a.add(f),queueMicrotask(()=>{!a.delete(f)||t(r,f.listener,f.type)})},u=(d,h,p)=>{l(d,h,p);for(let f of a)f.type===d&&f.listener===h&&a.delete(f)};Object.defineProperty(r,"addEventListener",{configurable:!0,writable:!0,value:c}),Object.defineProperty(r,"removeEventListener",{configurable:!0,writable:!0,value:u}),i.push(()=>{delete r.addEventListener,delete r.removeEventListener,a.clear()})};e(document,["DOMContentLoaded"]),e(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:r=>{typeof r=="function"&&queueMicrotask(()=>{try{r.call(window,new Event("load"))}catch(s){console.error(s)}})}}),i.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let r of i)r()}}var U3=F(()=>{"use strict"});var WZ,ES,k3=F(()=>{"use strict";wS();nC();WZ=6e3,ES=class{constructor(t,e,n){this.iframe=t;this.deps=e;this.onConsole=n;this.disposed=!1;this.handshakeSeen=!1;this.handshakeTimer=null;this.onMessage=t=>{if(this.disposed||t.source!==this.iframe.contentWindow)return;let e=t.data;!O3(e)||this.handleMessage(e)};this.host=new kp(e,n,(r,s)=>{this.sendEvent(r,s)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Jl]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},WZ)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[Jl]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(n){e=Promise.reject(n)}e.then(n=>{this.send({[Jl]:!0,kind:"result",id:t.id,ok:!0,value:n,error:void 0})},n=>{let r=n instanceof Error?n.message:String(n);this.send({[Jl]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(t.event);break}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[Jl]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let n=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":{e.dispatchEvent(new PointerEvent(t.type,{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break}case"click":case"dblclick":{e.dispatchEvent(new MouseEvent(t.type,{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,button:t.button,buttons:t.buttons}));break}case"wheel":{let s=new WheelEvent("wheel",{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(s,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(s,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(s);break}case"keydown":case"keyup":{e.dispatchEvent(new KeyboardEvent(t.type,{...r,key:t.key,code:t.code,repeat:t.repeat}));break}}}}});var hn=F(()=>{gS();r3();o3();l3();m3();g3();v3();b3();E3();M3();_3();I3();wS();L3();nC();B3();U3();k3()});var V3=F(()=>{"use strict"});function MS(i){return Array.isArray(i)?i:[i]}function Rd(i,t){let e=0;for(;e<i.length&&e<t.length;){if(i[e]<t[e])return-1;if(i[e]>t[e])return 1;e+=1}return e!==t.length?-1:e!==i.length?1:0}var z3=F(()=>{"use strict"});function fi(i,t){return Object.setPrototypeOf(i,t),i}function _S(i){let t={...i};return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}function Ro(i,t,e){if(i===void 0?t===void 0?(i=0,t=10):i=t-10:t===void 0&&(t=i+10),i>t){let s=i;i=t,t=s}let n=[],r=1/(e+1);for(let s=0;s<e;s++){let a=i+(t-i)*(s+.75+Math.random()*.5)*r;n.push(a)}return n}function Vp(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function G3(){return typeof process<"u"}var j3=F(()=>{"use strict"});function By(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let t=Object.getOwnPropertyNames(i);for(let e of t){let n=i[e];n&&typeof n=="object"&&By(n)}return Object.freeze(i)}function TS(i){for(let t of Object.keys(i))i[t]===void 0&&delete i[t];return i}var H3=F(()=>{"use strict"});var mi=F(()=>{V3();z3();j3();H3()});var AS,Dd,Fy,CS=F(()=>{"use strict";AS=class{},Dd=class extends AS{constructor(e){super();this.id=e}},Fy=class extends AS{constructor(e){super();this.data=e}}});var W3=F(()=>{"use strict"});var st,Uy=F(()=>{"use strict";st=class{modifyById(t,e){let n=this;if(n[t]===void 0)throw new Error("not expected");{let s={...n,[t]:e};return Object.setPrototypeOf(s,st.prototype),s}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let n=e[t.id],r;n===void 0?r={type:2,id:t.id}:r={type:1,id:t.id,data:n};let{id:s,data:a}=t,o={...e,[s]:a};return Object.setPrototypeOf(o,st.prototype),{data:o,actual:t,reverse:r}}else if(t.type===2){let{id:n}=t,r=e[n];if(r===void 0)return null;{let s={...e};return Object.setPrototypeOf(s,st.prototype),delete s[n],{data:s,actual:t,reverse:{type:1,id:n,data:r}}}}return null}}});var zp,PS=F(()=>{"use strict";zp=class extends Error{}});function q3(i,t){for(let e of i)t(e.id,e.data)!==!0&&q3(e.children,t)}function X3(i,t){if(t(i.id,i.data)!==!0)for(let e of i.children)X3(e,t)}var Ln,lu=F(()=>{"use strict";mi();PS();mi();Ln=class extends Array{constructor(...e){super(...e);Gi(this,"partialObjectCaches");Gi(this,"objCaches");Gi(this,"parentCaches");Object.setPrototypeOf(this,Ln.prototype)}deepFreeze(){let e=0;for(;e<this.length;)By(this[e]),e++}fillCaches0(e,n){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,n);for(let r of e.children)this.fillCaches0(r,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,n){if(!this.has(e))return!0;for(;e;){let r=this.parent(e);if(r===n)return!0;e=r}return!1}rootAcestor(e){for(;e;){let n=this.parent(e);if(n)e=n;else return e}return e}isDescendantOf(e,n){for(;e;){let r=this.parent(e);if(r===n)return!0;e=r}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let n=this.get(e);n!==void 0&&this.partialObjectCaches.set(e,n)}get(e){if(this.partialObjectCaches!==void 0){let n=this.partialObjectCaches.get(e);if(n!==void 0)return n}return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,n){if(e===null)this.traverse(n);else{let r=this.get(e);r&&X3(r,n)}}traverse(e){q3(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this.parent(e),a=this.childrenArray(s),o=a.findIndex(d=>d.id===e);if(o<0)throw new Error("not expected");let l=a[o];a=[...a],a[o]={...l,data:n};let c=new Map;return c.set(e,a[o]),this.modifyArrayBy(s,a,c)}}modifyArrayBy(e,n,r=void 0){let s=e,a=n;for(;s!==null;){let l=a,c=s;if(s=this.parent(s),s===void 0)throw new Error;a=this.childrenArray(s);let u=a.findIndex(d=>d.id===c);if(u<0)throw new Error;a=[...a],a[u]={...a[u],children:l},r&&r.set(c,a[u])}Object.setPrototypeOf(a,Ln.prototype);let o=a;if(r&&this.objCaches!==void 0&&this.parentCaches!==void 0){o.objCaches=this.objCaches;for(let[l,c]of r)o.objCaches.set(l,c);o.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else o.fillCaches();return o}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:n}){if(this.get(e)!==void 0)return!0;for(let r of n)if(this.checkDuplicatedIdRec(r))return!0;return!1}addOp(e){let{parent:n,fi:r,id:s,data:a,children:o}=e;if(n!==null&&this.get(n)===void 0)return null;if(this.checkDuplicatedIdRec(e))return null;{let l=n,c=this.childrenArray(l),u={fi:r,id:s,data:a,children:o};return c=[...c,u],c.sort((h,p)=>h.fi-p.fi),e.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:e,reverse:{type:8,id:s}}}}deleteOp(e){let{id:n}=e;if(this.get(n)===null)return null;{let r=this.parent(n);if(r===void 0)return null;let s=this.childrenArray(r),a=s.findIndex(c=>c.id===n);e.localIndex=a,s=[...s];let o=s.splice(a,1)[0];return{data:this.modifyArrayBy(r,s),actual:e,reverse:{type:7,...o,parent:r}}}}moveOp(e){let{parent:n,fi:r,id:s}=e;if(n!==null&&this.get(n)===void 0)return this.deleteOp({type:8,id:s});if(n!==null){let p=n;for(;p!==null;){if(p===void 0)throw new Error;if(p===s)throw new zp("cyclic tree");p=this.parent(p)}}let a=this.parent(s);if(a===void 0)return null;let o=a,l=this.childrenArray(a),c=l.findIndex(p=>p.id===s);l=[...l];let u=l.splice(c,1)[0],d=this.modifyArrayBy(a,l);a=n,l=d.childrenArray(a);let h=u.fi;return u={...u,fi:r},l=[...l,u],l.sort((p,f)=>p.fi-f.fi),e.localIndex=l.indexOf(u),d=d.modifyArrayBy(a,l),{data:d,actual:e,reverse:{type:9,parent:o,fi:h,id:s}}}previous(e,n){if(n===null){let s=this.childrenArray(e);return s.length===0?null:s[s.length-1].id}let r=null;for(let s of this.childrenArray(e)){if(s.id===n)return r;r=s.id}return null}traverseSortNext(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(a=>a.id===e)+1;if(s<r.length)return r[s].id;if(n)return this.traverseSortNext(n)}}sortNext(e){let n=this.childrenArray(e);return n.length>0?n[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let n=this.childrenArray(e);return n.length>0?this.traverseSortPrevious(n[n.length-1].id):e}sortPrevious(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(a=>a.id===e)-1;return s>=0?this.traverseSortPrevious(r[s].id):n}}getAllSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r.id);s!==void 0&&n.push({...r,...s})}n.sort((r,s)=>Rd(r.sortKey,s.sortKey));for(let r of n)delete r.sortKey;return n}getAllIdSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r);s!==void 0&&n.push(s)}n.sort((r,s)=>Rd(r.sortKey,s.sortKey));for(let r of n)delete r.sortKey;return n.map(r=>r.id)}getWithSortKey(e){let n=e,r=[],s=this.get(n),a=s;if(s!==void 0){for(;n;)r.splice(0,0,s.fi),n=this.parent(n),n!==null&&(s=this.get(n));return{...a,sortKey:r}}}insertBeforeHelper(e,n,r){return this.insertAfterHelper(e,this.previous(e,n),r)}insertAfterHelper(e,n,r){let s=this.childrenArray(e);if(n===null){if(s.length===0)return Ro(0,r,r);{let a=s[0].fi;return Ro(a-r,a,r)}}else{let a=this.get(n);if(a===void 0||this.parent(n)!==e)throw new Error("illegal args");let o=s.find(l=>l.fi>a.fi);if(o===void 0){let l=s[s.length-1].fi;return Ro(l,l+r,r)}else return Ro(a.fi,o.fi,r)}}}});var rC,cu,IS=F(()=>{"use strict";rC=null;(n=>{function i(r){rC=r}n.setPreservePrototype=i;function t(r,s){return Object.getPrototypeOf(r)===rC&&Object.setPrototypeOf(s,rC),s}n.tryPreservePrototype=t;function e(r,s){if(s.type!==0)return null;if(Array.isArray(r)){let a=s.props,o={},l=[...r],c=!1;if(a)for(let u of Object.keys(a)){let d=parseInt(u);if(isNaN(d))throw new Error("wrong index");o[u]=l[d],l[d]=a[u],c=!0}return c?{data:l,actual:s,reverse:{type:0,props:o}}:null}else{let a=s.props,o={},l={...r},c=!1;if(a)for(let u of Object.keys(a)){o[u]=l[u];let d=a[u];d===void 0?delete l[u]:l[u]=d,c=!0}return c?{data:n.tryPreservePrototype(r,l),actual:s,reverse:{type:0,props:o}}:null}}n.runOp=e})(cu||(cu={}))});var ze,uu=F(()=>{"use strict";mi();mi();ze=class extends Array{constructor(...e){super(...e);Gi(this,"objCaches");Object.setPrototypeOf(this,ze.prototype)}deepFreeze(){let e=0;for(;e<this.length;)By(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this,a=s.findIndex(c=>c.id===e);if(a<0)throw new Error("not expected");let o=s[a];return s=[...s],s[a]={...o,data:n},this.modifyArrayBy(s)}}modifyArrayBy(e){Object.setPrototypeOf(e,ze.prototype);let n=e;return G3()||n.fillCaches(),n}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:n,id:r,data:s}=e,a=this,o={fi:n,id:r,data:s};return a=[...a,o],a.sort((c,u)=>c.fi-u.fi),e.localIndex=a.indexOf(o),{data:this.modifyArrayBy(a),actual:e,reverse:{type:5,id:r}}}deleteOp(e){let{id:n}=e,r=this,s=r.findIndex(l=>l.id===n);if(s===-1)return null;e.localIndex=s,r=[...r];let a=r.splice(s,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:{type:4,...a}}}moveOp(e){let{fi:n,id:r}=e,s=this;s=[...s];let a=s.findIndex(u=>u.id===r);if(a===-1)return null;let o=s[a].fi,l={...s[a],fi:n};return s[a]=l,s.sort((u,d)=>u.fi-d.fi),e.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:e,reverse:{type:6,fi:o,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let n=null;for(let r of this){if(r.id===e)return n;n=r.id}return null}insertBeforeHelper(e,n){return this.insertAfterHelper(this.previous(e),n)}insertAfterHelper(e,n){let r=this;if(e===null){if(r.length===0)return Ro(0,n,n);{let s=r[0].fi;return Ro(s-n,s,n)}}else{let s=this.get(e);if(s===void 0)throw new Error("illegal args");let a=r.find(o=>o.fi>s.fi);if(a===void 0){let o=r[r.length-1].fi;return Ro(o,o+n,n)}else return Ro(s.fi,a.fi,n)}}}});function Y3(i,t){return Gp(i,t,null)??i}function $3(i,t){let e={cur:[],result:[],len:0};return i=Gp(i,t,e)??i,[i,e.result]}function OS(i,t){return i===null?null:(i.cur[i.len]=t,i.len+=1,i)}function RS(i){i&&(i.len-=1)}function qZ(i){if(i===null)return null;i.result.push(i.cur.slice(0,i.len))}function K3(i,t,e){let n=!1,r=i.map(s=>{let a=s.id,o=t[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,e!==null))throw new Error("not supported");let l=Gp(s.data,t,OS(e,a));RS(e),n=n||l!==void 0,l===void 0&&(l=s.data);let c=K3(s.children,t,e);return c!==void 0?n=!0:c=s.children,{...s,id:a,data:l,children:c}});if(n)return r}function XZ(i,t,e){let n=!1,r=i.map(s=>{let a=s.id,o=t[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,e!==null))throw new Error("not supported");let l=Gp(s.data,t,OS(e,a));return RS(e),n=n||l!==void 0,l===void 0&&(l=s.data),{...s,id:a,data:l}});if(n)return Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}function Gp(i,t,e){if(i instanceof Ln){let n=K3(i,t,e);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}else{if(i instanceof ze)return XZ(i,t,e);if(Array.isArray(i)){let n=!1,r=i.map((s,a)=>{let o=Gp(s,t,OS(e,a));return RS(e),n=n||o!==void 0,o===void 0&&(o=s),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else if(i&&typeof i=="object"&&!Vp(i)){let n={},r=!1;for(let[s,a]of Object.entries(i))if(s!=="name"&&s!=="variableId"){let o=t[s];if(typeof o=="string"){if(e!==null)throw new Error("not supported");r=!0,s=o}let l=Gp(a,t,OS(e,s));RS(e),r=r||l!==void 0,l===void 0&&(l=a),n[s]=l}else n[s]=a;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else if(typeof i=="string"){let n=t[i];return n!==void 0&&qZ(e),n}else return}}var iC=F(()=>{"use strict";lu();uu();mi()});function jp(i){return i&&typeof i=="object"&&i instanceof Zn}function sC(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,a=ky(r.data,t[s]);if(e=e||a!==void 0,a===void 0&&(a=r.data),r.children){let o=sC(r.children,t);return o!==void 0?e=!0:o=r.children,{...r,id:s,data:a,children:o}}else return{...r,id:s,data:a}});if(e)return n}function YZ(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,a=ky(r.data,t[s]);return e=e||a!==void 0,a===void 0&&(a=r.data),{...r,id:s,data:a}});if(e)return Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}function ky(i,t){if(!jp(t))return t;if(i instanceof Ln){let e=sC(i,t);return e!==void 0&&Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e}else{if(i instanceof ze)return YZ(i,t);if(Array.isArray(i)){let e=!1,n=i.map((r,s)=>{let a=ky(r,t[s]);return e=e||a!==void 0,a===void 0&&(a=r),a});return e?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else{if(i instanceof Zn)return aC(i,t);if(i&&typeof i=="object"){let e={},n=!1;for(let[r,s]of Object.entries(i)){let a=ky(s,t[r]);n=n||a!==void 0,a===void 0&&(a=s),e[r]=a}return n?(Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e):void 0}}}}function aC(i,t){if(i===void 0)return t;if(t===void 0)return i;if(!jp(t))return t;if(!jp(i))return Do.apply(i,t);let e=new Set;for(let r of Object.keys(i))e.add(r);for(let r of Object.keys(t))e.add(r);let n=new Zn;for(let r of e){let s=aC(i===void 0?void 0:i[r],t===void 0?void 0:t[r]);n[r]=s}return n}var Zn,Do,DS=F(()=>{"use strict";lu();uu();Vy();mi();Zn=class{unusedFunOverridesTable(t){}runOp(t){let e=[],n=this,r=0,s={};for(;r<t.path.length;){if(e.push(n),n=n===void 0?void 0:n[t.path[r]],n!==void 0&&!jp(n))return null;r+=1}n=n?_S(n):new Zn;for(let[l,c]of Object.entries(t.props)){let u=n[l];s[l]=u,c===void 0?delete n[l]:n[l]=c}for(;r>0;){if(Object.keys(n).length===0){let l=e[r-1];l&&(n=_S(l),delete n[t.path[r-1]])}else{let l=e[r-1];if(l){let c=_S(l);c[t.path[r-1]]=n,n=c}else{let c=new Zn;c[t.path[r-1]]=n,n=c}}r-=1}let a=Object.setPrototypeOf(n,Zn.prototype),o={...t,props:s};return{data:a,actual:t,reverse:o}}};(n=>{function i(r,s){return ky(r,s)??r}n.apply=i;function t(r,s){return aC(r,s)}n.merge=t;function e(r,s){let a=0,o=s.path,l=r;for(;a<o.length&&l!==void 0;){if(l=rr.zoomOnce(l,o[a]),l===void 0)return s;if(!jp(l))return;a+=1}if(l===void 0)return s;if(!!jp(l))if(s.type===0){let c={...s.props};for(let u of Object.keys(l))delete c[u];return{...s,props:c}}else if(s.type===1||s.type===4||s.type===7){let c=sC([s],l);return c?c[0]:s}else return s}n.filterOp=e})(Do||(Do={}))});var Hp,wr,zy,Z3=F(()=>{"use strict";Vy();Uy();lu();PS();IS();uu();iC();DS();(t=>{function i(e,n){let r=rr.zoom(n,e.path);if(typeof r=="object"){let s={};for(let a of Object.keys(e.props))s[a]=r[a];return{...e,props:s}}else return{...e,props:{}}}t.replaceProps=i})(Hp||(Hp={}));(o=>{function i(l,c){return{...l,path:l.path.slice(c)}}o.drop=i;function t(l,c){return e(l,c)?.data??l}o.applySimple=t;function e(l,c){let u=c.path,d=[];for(;;){let h;if(l instanceof Zn&&c.type===0&&(h=l.runOp({...c,path:u.slice(d.length)}),h===null&&(h=void 0)),h===void 0&&d.length===u.length&&(l instanceof Ln||l instanceof ze||l instanceof st?h=l.runOp(c):h=cu.runOp(l,c)),h!==void 0)if(h!==null){let m=h.data;for(let g=d.length-1;g>=0;g--){let y=u[g],v=d[g];if(v instanceof Ln){if(typeof y=="number")throw new Error("illegal arg");m=v.modifyById(y,m)}else if(v instanceof ze){if(typeof y=="number")throw new Error("illegal arg");m=v.modifyById(y,m)}else if(v instanceof st){if(typeof y=="number")throw new Error("illegal arg");m=v.modifyById(y,m)}else if(v instanceof Zn){let b={...v,[y]:m};m=Object.setPrototypeOf(b,Zn.prototype)}else if(typeof v=="object")if(Array.isArray(v)){if(typeof y=="string"&&(y=parseInt(y),isNaN(y)))throw new Error("Invalid path");let b=m;m=[...v],m[y]=b}else m=cu.tryPreservePrototype(v,{...v,[y]:m});else return null}return{data:m,actual:{...h.actual,path:u},reverse:{...h.reverse,path:u}}}else return null;let p=u[d.length],f;if(l instanceof Ln){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else if(l instanceof ze){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else l!==null&&(f=l[p]);if(f!==void 0)d.push(l),l=f;else return null}}o.apply=e;function n(l,c){for(let u=0;u<l.length&&u<c.length;u++)if(l[u]!==c[u])return!0;return!1}o.pathDisjoint=n;function r(l,c){if(l.length!==c.length)return!1;for(let u=0;u<l.length;u++)if(l[u]!==c[u])return!1;return!0}o.pathEq=r;function s(l,c){return n(l.path,c.path)}o.commutative=s;function a(l,c){return l.type===0&&c.type===0&&r(l.path,c.path)?Object.keys(l.props).every(u=>c.props[u]!==void 0):!1}o.subsumed=a})(wr||(wr={}));(l=>{function i(){return[]}l.empty=i;function t(c,u){let d=[];for(let h of c){let[p,...f]=h.path;p===u&&d.push({...h,path:f})}return d}l.removePrefix=t;function e(c,u){return c.map(d=>({...d,path:[u,...d.path]}))}l.addPrefix=e;function n(c,u){return[...c,...u]}l.concat=n;function r(c,u){return[...c.filter(h=>!u.some(p=>wr.subsumed(h,p))),...u]}l.compress=r;function s(c,u){return c.every(d=>u.every(h=>wr.commutative(d,h)))}l.commutative=s;function a(c,u){for(let d of u){let h=o(c,d);h!==null&&(c=h.data)}return c}l.applyAll=a;function o(c,u){let d=c,h=[],p=[];for(let f of u)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let m,g,y;if(f.type===3?(m=rr.zoom(d,[...f.path,f.id]),y=wr.apply(d,{...f,type:2})):(m=rr.zoom(d,[...f.path,f.id,"value"]),y=wr.apply(d,f)),y!==null){d=y.data;let[v,b]=$3(d,{[f.id]:m});d=v;for(let x=0;x<b.length;x++){let S=b[x],E=S.pop();if(typeof E=="number"){let M=[E];for(let T=x+1;T<b.length;T++){let A=b[T],C=A[A.length-1];if(typeof C=="number"&&rr.equal(S,A.slice(0,A.length-1)))M.push(C),b.splice(T,1);else break}let w=rr.zoom(d,S);g=w.map((T,A)=>M.includes(A)?f.id:T),m=w,E=S.pop()}else{if(E==="alphaOverride"||E==="alpha"){m/=100;let M=m,w=rr.zoom(d,S.slice(0,S.length-2)),T=w.layers.map(A=>A.id===S[S.length-1]?{...A,data:{...A.data,[E]:M}}:A);Object.setPrototypeOf(T,Object.getPrototypeOf(w.layers)),w.layers=T}g=f.id}h.push({type:0,path:S,props:{[E]:m}}),p.push({type:0,path:S,props:{[E]:g}})}p.push(y.reverse),h.push(y.actual)}}else{let m=wr.apply(d,f);m!==null&&(h.push(m.actual),d=m.data,p.push(m.reverse))}}catch(m){if(m instanceof zp)return null;throw m}return{data:d,actual:h,reverse:p.reverse()}}l.apply=o})(zy||(zy={}))});function oC(i,t,e){if(i.length>0){let n=i[i.length-1];if(n.type===0&&t.type===0&&rr.equal(n.path,e)){Object.assign(n.props,t.props);return}}i.push({...t,path:e})}function BS(i,t,e){return e instanceof Ln?new Wp(i,t,e):e instanceof ze?new qp(i,t,e):e instanceof st?new Proxy(new cC(i,t,e),ZZ):e!==null&&typeof e=="object"?Vp(e)?e:new Proxy(new lC(i,t,e),KZ):e}function Nd(i){let t=new LS(i);return[BS(t,"",i),t]}function du(i,t){let[e,n]=Nd(i);return t(e),n.result()}function Pr(i){return i instanceof Wp||i instanceof qp?i._current:i!==null&&typeof i=="object"?i[Q3]:i}var Q3,$Z,NS,Ld,lC,cC,J3,KZ,ZZ,Wp,qp,LS,uC=F(()=>{"use strict";Uy();lu();IS();uu();mi();Vy();Q3=Symbol(),$Z=Symbol(),NS=Symbol(),Ld=class{reportOp(t,e,n=[]){let r=this;if(e===null)return;r._current=e.data;let s=n;for(;!(r instanceof LS);){let a=r._path,o=r._current;if(a!==""&&s.splice(0,0,a),r=r._parent,r===null)return;r.update(a,o)}r.push(s,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let n=e[NS];n&&n(),delete this._children[t]}}}},lC=class extends Ld{constructor(t,e,n){super(),this._parent=t,this._path=e,this._current=n}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=cu.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,cu.runOp(this._current,t),t.path)}},cC=class extends Ld{constructor(t,e,n){super(),this._parent=t,this._path=e,this._current=n}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,st.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},J3={get(i,t){if(t===NS)return()=>{i._parent=null};if(t===Q3)return i._current;if(t===$Z)return i;let{_current:e,_children:n}=i;if(t==="push"&&Array.isArray(e))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e[t],a=BS(i,t,s);return a!==s?(n===void 0&&(n={},i._children=n),n[t]=a,a):s},has(i,t){return t in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,t){let e=i._current,n=Reflect.getOwnPropertyDescriptor(e,t);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:e[t]}}},KZ={...J3,set(i,t,e){let n={type:0,props:{[t]:Pr(e)??e}};return i.deleteChildren(t),i.runOp(n),!0},deleteProperty(i,t){let e={type:0,props:{[t]:void 0}};return i.deleteChildren(t),i.runOp(e),!0}},ZZ={...J3,set(i,t,e){return e===void 0?this.deleteProperty(i,t):(i.deleteChildren(t),i.runOp({type:1,id:t,data:e})),!0},deleteProperty(i,t){return i.runOp({type:2,id:t}),!0}},Wp=class extends Ld{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[NS]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,n)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,a=BS(this,t,s);return a!==s?(n===void 0&&(n={},this._children=n),n[t]=a,a):s}add(t,e,n,r,s){this.runOp({type:7,parent:t,fi:e,id:n,data:r,children:s})}move(t,e,n){this.runOp({type:9,parent:t,fi:e,id:n})}insertAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let a=n[s];this.add(t,r[s],a.id,a.data,a.children)}}insertBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let a=n[s];this.add(t,r[s],a.id,a.data,a.children)}}moveAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let a=n[s];this.move(t,r[s],a)}}moveBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let a=n[s];this.move(t,r[s],a)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},qp=class extends Ld{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[NS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id,s=this._current[n].fi;t(this.data(this._current[n].id),r,s,n)}}find(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id;if(t(this.data(r),r))return this.get(r)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:n}=this._current.at(t);return{id:e,fi:n,data:this.data(e)}}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,a=BS(this,t,s);return a!==s?(n===void 0&&(n={},this._children=n),n[t]=a,a):s}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,n){this.runOp({type:4,fi:t,id:e,data:n})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}insertBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}moveAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}moveBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};LS=class extends Ld{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,n,r){oC(this.ts,e,t),oC(this.actual,n,t),oC(this.reverse,r,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}});var rr,Vy=F(()=>{"use strict";CS();uC();uu();lu();mi();(s=>{function i(a,o){if(o.length===a.length){let l=0;for(;l<a.length;){if(a[l]!==o[l])return!1;l+=1}}else return!1;return!0}s.equal=i;function t(a,o,l){let c=n(l,a);if(c!==void 0&&typeof c=="object"&&c!==null){let u={...o};return Object.keys(c).forEach(d=>{delete u[d]}),u}else return o}s.removeOverridden=t;function e(a,o){if((a instanceof Ln||a instanceof Wp)&&typeof o=="string")return a.data(o);if((a instanceof ze||a instanceof qp)&&typeof o=="string")return a.data(o);if(typeof o=="number"&&Array.isArray(a))return a[o];if(typeof o=="string"&&typeof a=="object"&&a!==null)return a[o]}s.zoomOnce=e;function n(a,o,l=0){for(;l<o.length&&a!==void 0;)a=e(a,o[l]),l+=1;return a}s.zoom=n;function r(a,o){let l=[];function c(u,d){if(u instanceof Dd&&u.id===o.id)l.push(d);else if(u instanceof ze)for(let h=0;h<u.length;h++)c(u[h].data,[...d,u[h].id]);else if(u instanceof Ln)u.traverse((h,p)=>{c(h,[...d,p])});else if(Array.isArray(u))for(let h=0;h<u.length;h++)c(u[h],[...d,h]);else{if(Vp(u))return;if(typeof u=="object"&&u!==null)for(let h in u)c(u[h],[...d,h])}}return c(a,[]),l}s.findPathes=r})(rr||(rr={}))});var eB=F(()=>{"use strict"});function tB(i,t){let e=[];if(t.length===i.length){let n=0;for(;n<i.length;){if(t[n]==="*")e.push(i[n]);else if(i[n]!==t[n])return null;n+=1}}else return null;return e}function $t(i,t){let e=[];if(t.length<=i.length){let n=0;for(;n<t.length;){if(t[n]==="*")e.push(i[n]);else if(i[n]!==t[n])return null;n+=1}}else return null;return e}var nB=F(()=>{"use strict"});function FS(i){try{if(!ir.trusted&&!pu){let e=pn.sharedLength||0;e<pn.length&&(pn.length=e)}let t;if(ir.randomAccessStructure&&tt[ie]<64&&tt[ie]>=32&&sB?(t=sB(tt,ie,ha,ir),tt=null,!(i&&i.lazy)&&t&&(t=t.toJSON()),ie=ha):t=qr(),Ii&&(ie=Ii.postBundlePosition,Ii=null),pu&&(pn.restoreStructures=null),ie==ha)pn&&pn.restoreStructures&&lB(),pn=null,tt=null,ec&&(ec=null);else{if(ie>ha)throw new Error("Unexpected end of MessagePack data");if(!pu){let e;try{e=JSON.stringify(t,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){e="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+e)}}return t}catch(t){throw pn&&pn.restoreStructures&&lB(),yC(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||ie>ha)&&(t.incomplete=!0),t}}function lB(){for(let i in pn.restoreStructures)pn[i]=pn.restoreStructures[i];pn.restoreStructures=null}function qr(){let i=tt[ie++];if(i<160)if(i<128){if(i<64)return i;{let t=pn[i&63]||ir.getStructures&&vB()[i&63];return t?(t.read||(t.read=vC(t,i&63)),t.read()):i}}else if(i<144)if(i-=128,ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=xB();n==="__proto__"&&(n="__proto_"),t[n]=qr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(qr(),qr());return t}else{i-=144;let t=new Array(i);for(let e=0;e<i;e++)t[e]=qr();return ir.freezeData?Object.freeze(t):t}else if(i<192){let t=i-160;if(Lo>=ie)return hu.slice(ie-da,(ie+=t)-da);if(Lo==0&&ha<140){let e=t<16?bC(t):bB(t);if(e!=null)return e}return gC(t)}else{let t;switch(i){case 192:return null;case 193:return Ii?(t=qr(),t>0?Ii[1].slice(Ii.position1,Ii.position1+=t):Ii[0].slice(Ii.position0,Ii.position0-=t)):yB;case 194:return!1;case 195:return!0;case 196:if(t=tt[ie++],t===void 0)throw new Error("Unexpected end of buffer");return dC(t);case 197:return t=sn.getUint16(ie),ie+=2,dC(t);case 198:return t=sn.getUint32(ie),ie+=4,dC(t);case 199:return Bd(tt[ie++]);case 200:return t=sn.getUint16(ie),ie+=2,Bd(t);case 201:return t=sn.getUint32(ie),ie+=4,Bd(t);case 202:if(t=sn.getFloat32(ie),ir.useFloat32>2){let e=MB[(tt[ie]&127)<<1|tt[ie+1]>>7];return ie+=4,(e*t+(t>0?.5:-.5)>>0)/e}return ie+=4,t;case 203:return t=sn.getFloat64(ie),ie+=8,t;case 204:return tt[ie++];case 205:return t=sn.getUint16(ie),ie+=2,t;case 206:return t=sn.getUint32(ie),ie+=4,t;case 207:return ir.int64AsType==="number"?(t=sn.getUint32(ie)*4294967296,t+=sn.getUint32(ie+4)):ir.int64AsType==="string"?t=sn.getBigUint64(ie).toString():ir.int64AsType==="auto"?(t=sn.getBigUint64(ie),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=sn.getBigUint64(ie),ie+=8,t;case 208:return sn.getInt8(ie++);case 209:return t=sn.getInt16(ie),ie+=2,t;case 210:return t=sn.getInt32(ie),ie+=4,t;case 211:return ir.int64AsType==="number"?(t=sn.getInt32(ie)*4294967296,t+=sn.getUint32(ie+4)):ir.int64AsType==="string"?t=sn.getBigInt64(ie).toString():ir.int64AsType==="auto"?(t=sn.getBigInt64(ie),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=sn.getBigInt64(ie),ie+=8,t;case 212:if(t=tt[ie++],t==114)return fB(tt[ie++]&63);{let e=Xi[t];if(e)return e.read?(ie++,e.read(qr())):e.noBuffer?(ie++,e()):e(tt.subarray(ie,++ie));throw new Error("Unknown extension "+t)}case 213:return t=tt[ie],t==114?(ie++,fB(tt[ie++]&63,tt[ie++])):Bd(2);case 214:return Bd(4);case 215:return Bd(8);case 216:return Bd(16);case 217:return t=tt[ie++],Lo>=ie?hu.slice(ie-da,(ie+=t)-da):JZ(t);case 218:return t=sn.getUint16(ie),ie+=2,Lo>=ie?hu.slice(ie-da,(ie+=t)-da):eQ(t);case 219:return t=sn.getUint32(ie),ie+=4,Lo>=ie?hu.slice(ie-da,(ie+=t)-da):tQ(t);case 220:return t=sn.getUint16(ie),ie+=2,uB(t);case 221:return t=sn.getUint32(ie),ie+=4,uB(t);case 222:return t=sn.getUint16(ie),ie+=2,dB(t);case 223:return t=sn.getUint32(ie),ie+=4,dB(t);default:if(i>=224)return i-256;if(i===void 0){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+i)}}}function vC(i,t){function e(){if(e.count++>iB){let r;try{r=i.read=new Function("r","return function(){return "+(ir.freezeData?"Object.freeze":"")+"({"+i.map(s=>s==="__proto__"?"__proto_:r()":QZ.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(qr)}catch{return iB=1/0,e()}return i.read0=r,i.highByte===0&&(i.read=cB(t,i.read)),r()}let n={};for(let r=0,s=i.length;r<s;r++){let a=i[r];a==="__proto__"&&(a="__proto_"),n[a]=qr()}return ir.freezeData?Object.freeze(n):n}return e.count=0,i.read0=e,i.highByte===0?cB(t,e):e}function vB(){let i=wB(()=>(tt=null,ir.getStructures()));return pn=ir._mergeStructures(i,pn)}function Gy(i){let t;if(i<16&&(t=bC(i)))return t;if(i>64&&hC)return hC.decode(tt.subarray(ie,ie+=i));let e=ie+i,n=[];for(t="";ie<e;){let r=tt[ie++];if((r&128)===0)n.push(r);else if((r&224)===192){let s=tt[ie++]&63,a=(r&31)<<6|s;a<128?n.push(65533):n.push(a)}else if((r&240)===224){let s=tt[ie++]&63,a=tt[ie++]&63,o=(r&31)<<12|s<<6|a;o<2048||o>=55296&&o<=57343?n.push(65533):n.push(o)}else if((r&248)===240){let s=tt[ie++]&63,a=tt[ie++]&63,o=tt[ie++]&63,l=(r&7)<<18|s<<12|a<<6|o;l<65536||l>1114111?n.push(65533):(l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l))}else n.push(65533);n.length>=4096&&(t+=Pi.apply(String,n),n.length=0)}return n.length>0&&(t+=Pi.apply(String,n)),t}function uB(i){let t=new Array(i);for(let e=0;e<i;e++)t[e]=qr();return ir.freezeData?Object.freeze(t):t}function dB(i){if(ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=xB();n==="__proto__"&&(n="__proto_"),t[n]=qr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(qr(),qr());return t}}function bB(i){let t=ie,e=new Array(i);for(let n=0;n<i;n++){let r=tt[ie++];if((r&128)>0){ie=t;return}e[n]=r}return Pi.apply(String,e)}function bC(i){if(i<4)if(i<2){if(i===0)return"";{let t=tt[ie++];if((t&128)>1){ie-=1;return}return Pi(t)}}else{let t=tt[ie++],e=tt[ie++];if((t&128)>0||(e&128)>0){ie-=2;return}if(i<3)return Pi(t,e);let n=tt[ie++];if((n&128)>0){ie-=3;return}return Pi(t,e,n)}else{let t=tt[ie++],e=tt[ie++],n=tt[ie++],r=tt[ie++];if((t&128)>0||(e&128)>0||(n&128)>0||(r&128)>0){ie-=4;return}if(i<6){if(i===4)return Pi(t,e,n,r);{let s=tt[ie++];if((s&128)>0){ie-=5;return}return Pi(t,e,n,r,s)}}else if(i<8){let s=tt[ie++],a=tt[ie++];if((s&128)>0||(a&128)>0){ie-=6;return}if(i<7)return Pi(t,e,n,r,s,a);let o=tt[ie++];if((o&128)>0){ie-=7;return}return Pi(t,e,n,r,s,a,o)}else{let s=tt[ie++],a=tt[ie++],o=tt[ie++],l=tt[ie++];if((s&128)>0||(a&128)>0||(o&128)>0||(l&128)>0){ie-=8;return}if(i<10){if(i===8)return Pi(t,e,n,r,s,a,o,l);{let c=tt[ie++];if((c&128)>0){ie-=9;return}return Pi(t,e,n,r,s,a,o,l,c)}}else if(i<12){let c=tt[ie++],u=tt[ie++];if((c&128)>0||(u&128)>0){ie-=10;return}if(i<11)return Pi(t,e,n,r,s,a,o,l,c,u);let d=tt[ie++];if((d&128)>0){ie-=11;return}return Pi(t,e,n,r,s,a,o,l,c,u,d)}else{let c=tt[ie++],u=tt[ie++],d=tt[ie++],h=tt[ie++];if((c&128)>0||(u&128)>0||(d&128)>0||(h&128)>0){ie-=12;return}if(i<14){if(i===12)return Pi(t,e,n,r,s,a,o,l,c,u,d,h);{let p=tt[ie++];if((p&128)>0){ie-=13;return}return Pi(t,e,n,r,s,a,o,l,c,u,d,h,p)}}else{let p=tt[ie++],f=tt[ie++];if((p&128)>0||(f&128)>0){ie-=14;return}if(i<15)return Pi(t,e,n,r,s,a,o,l,c,u,d,h,p,f);let m=tt[ie++];if((m&128)>0){ie-=15;return}return Pi(t,e,n,r,s,a,o,l,c,u,d,h,p,f,m)}}}}}function hB(){let i=tt[ie++],t;if(i<192)t=i-160;else switch(i){case 217:t=tt[ie++];break;case 218:t=sn.getUint16(ie),ie+=2;break;case 219:t=sn.getUint32(ie),ie+=4;break;default:throw new Error("Expected string")}return Gy(t)}function dC(i){return ir.copyBuffers?Uint8Array.prototype.slice.call(tt,ie,ie+=i):tt.subarray(ie,ie+=i)}function Bd(i){let t=tt[ie++];if(Xi[t]){let e;return Xi[t](tt.subarray(ie,e=ie+=i),n=>{ie=n;try{return qr()}finally{ie=e}})}else throw new Error("Unknown extension type "+t)}function xB(){let i=tt[ie++];if(i>=160&&i<192){if(i=i-160,Lo>=ie)return hu.slice(ie-da,(ie+=i)-da);if(!(Lo==0&&ha<180))return gC(i)}else return ie--,SB(qr());let t=(i<<5^(i>1?sn.getUint16(ie):i>0?tt[ie]:0))&4095,e=pB[t],n=ie,r=ie+i-3,s,a=0;if(e&&e.bytes==i){for(;n<r;){if(s=sn.getUint32(n),s!=e[a++]){n=1879048192;break}n+=4}for(r+=3;n<r;)if(s=tt[n++],s!=e[a++]){n=1879048192;break}if(n===r)return ie=n,e.string;r-=3,n=ie}for(e=[],pB[t]=e,e.bytes=i;n<r;)s=sn.getUint32(n),e.push(s),n+=4;for(r+=3;n<r;)s=tt[n++],e.push(s);let o=i<16?bC(i):bB(i);return o!=null?e.string=o:e.string=gC(i)}function SB(i){if(typeof i=="string")return i;if(typeof i=="number"||typeof i=="boolean"||typeof i=="bigint")return i.toString();if(i==null)return i+"";if(ir.allowArraysInMapKeys&&Array.isArray(i)&&i.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return i.flat().toString();throw new Error(`Invalid property type for record: ${typeof i}`)}function wB(i){oB&&oB();let t=ha,e=ie,n=fC,r=da,s=Lo,a=hu,o=pC,l=ec,c=Ii,u=new Uint8Array(tt.slice(0,ha)),d=pn,h=pn.slice(0,pn.length),p=ir,f=pu,m=i();return ha=t,ie=e,fC=n,da=r,Lo=s,hu=a,pC=o,ec=l,Ii=c,tt=u,pu=f,pn=d,pn.splice(0,pn.length,...h),ir=p,sn=new DataView(tt.buffer,tt.byteOffset,tt.byteLength),m}function yC(){tt=null,ec=null,pn=null}function EB(i){i.unpack?Xi[i.type]=i.unpack:Xi[i.type]=i}var hC,tt,ha,ie,gB,pC,fC,ir,pn,hu,da,Lo,Ii,ec,Xi,sn,rB,mC,yB,pu,iB,sB,aB,oB,fu,QZ,cB,gC,JZ,eQ,tQ,Pi,pB,fB,mB,nQ,rQ,iQ,MB,US,Lfe,Nfe,Bfe,sQ,Ffe,_B=F(()=>{try{hC=new TextDecoder}catch{}ie=0,gB=[],pC=gB,fC=0,ir={},da=0,Lo=0,Xi=[],rB={useRecords:!1,mapsAsObjects:!0},mC=class{},yB=new mC;yB.name="MessagePack 0xC1";pu=!1,iB=2,fu=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(tt)return wB(()=>(yC(),this?this.unpack(t,e):fu.prototype.unpack.call(rB,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(ha=e.end||t.length,ie=e.start||0):(ie=0,ha=e>-1?e:t.length),fC=0,Lo=0,hu=null,pC=gB,Ii=null,tt=t;try{sn=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw tt=null,t instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof fu){if(ir=this,this.structures)return pn=this.structures,FS(e);(!pn||pn.length>0)&&(pn=[])}else ir=rB,(!pn||pn.length>0)&&(pn=[]);return FS(e)}unpackMultiple(t,e){let n,r=0;try{pu=!0;let s=t.length,a=this?this.unpack(t,s):US.unpack(t,s);if(e){if(e(a,r,ie)===!1)return;for(;ie<s;)if(r=ie,e(FS(),r,ie)===!1)return}else{for(n=[a];ie<s;)r=ie,n.push(FS());return n}}catch(s){throw s.lastPosition=r,s.values=n,s}finally{pu=!1,yC()}}_mergeStructures(t,e){aB&&(t=aB.call(this,t)),t=t||[],Object.isFrozen(t)&&(t=t.map(n=>n.slice(0)));for(let n=0,r=t.length;n<r;n++){let s=t[n];s&&(s.isShared=!0,n>=32&&(s.highByte=n-32>>5))}t.sharedLength=t.length;for(let n in e||[])if(n>=0){let r=t[n],s=e[n];s&&(r&&((t.restoreStructures||(t.restoreStructures=[]))[n]=r),t[n]=s)}return this.structures=t}decode(t,e){return this.unpack(t,e)}};QZ=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;cB=(i,t)=>function(){let e=tt[ie++];if(e===0)return t();let n=i<32?-(i+(e<<5)):i+(e<<5),r=pn[n]||vB()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=vC(r,i)),r.read()};gC=Gy,JZ=Gy,eQ=Gy,tQ=Gy;Pi=String.fromCharCode;pB=new Array(4096);fB=(i,t)=>{let e=qr().map(SB),n=i;t!==void 0&&(i=i<32?-((t<<5)+i):(t<<5)+i,e.highByte=t);let r=pn[i];return r&&(r.isShared||pu)&&((pn.restoreStructures||(pn.restoreStructures=[]))[i]=r),pn[i]=e,e.read=vC(e,n),(e.read0||e.read)()};Xi[0]=()=>{};Xi[0].noBuffer=!0;Xi[66]=i=>{let t=i.byteLength%8||8,e=BigInt(i[0]&128?i[0]-256:i[0]);for(let n=1;n<t;n++)e<<=BigInt(8),e+=BigInt(i[n]);if(i.byteLength!==t){let n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=(s,a)=>{let o=a-s;if(o<=40){let d=n.getBigUint64(s);for(let h=s+8;h<a;h+=8)d<<=BigInt(64),d|=n.getBigUint64(h);return d}let l=s+(o>>4<<3),c=r(s,l),u=r(l,a);return c<<BigInt((a-l)*8)|u};e=e<<BigInt((n.byteLength-t)*8)|r(t,n.byteLength)}return e};mB={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};Xi[101]=()=>{let i=qr();if(!mB[i[0]]){let t=Error(i[1],{cause:i[2]});return t.name=i[0],t}return mB[i[0]](i[1],{cause:i[2]})};Xi[105]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=sn.getUint32(ie-4);ec||(ec=new Map);let e=tt[ie],n;e>=144&&e<160||e==220||e==221?n=[]:e>=128&&e<144||e==222||e==223?n=new Map:(e>=199&&e<=201||e>=212&&e<=216)&&tt[ie+1]===115?n=new Set:n={};let r={target:n};ec.set(t,r);let s=qr();if(r.used)Object.assign(n,s);else return r.target=s;if(n instanceof Map)for(let[a,o]of s.entries())n.set(a,o);if(n instanceof Set)for(let a of Array.from(s))n.add(a);return n};Xi[112]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=sn.getUint32(ie-4),e=ec.get(t);return e.used=!0,e.target};Xi[115]=()=>new Set(qr());nQ=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array"),rQ=typeof globalThis=="object"?globalThis:window;Xi[116]=i=>{let t=i[0],e=Uint8Array.prototype.slice.call(i,1).buffer,n=nQ[t];if(!n){if(t===16)return e;if(t===17)return new DataView(e);throw new Error("Could not find typed array for code "+t)}return new rQ[n](e)};Xi[120]=()=>{let i=qr();return new RegExp(i[0],i[1])};iQ=[];Xi[98]=i=>{let t=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],e=ie;return ie+=t-i.length,Ii=iQ,Ii=[hB(),hB()],Ii.position0=0,Ii.position1=0,Ii.postBundlePosition=ie,ie=e,qr()};Xi[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");MB=new Array(147);for(let i=0;i<256;i++)MB[i]=+("1e"+Math.floor(45.15-i*.30103));US=new fu({useRecords:!1}),Lfe=US.unpack,Nfe=US.unpackMultiple,Bfe=US.unpack,sQ=new Float32Array(1),Ffe=new Uint8Array(sQ.buffer,0,4)});var aQ,oQ,kS,TB=F(()=>{"use strict";_B();CS();DS();uu();Uy();lu();aQ=[{Class:st.prototype.constructor,type:1,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,st.prototype),i}},{Class:ze.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,ze.prototype),i}},{Class:Ln.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Ln.prototype),i}},{Class:Dd.prototype.constructor,type:4,write(i){return i.id},read(i){return new Dd(i)}},{Class:Fy.prototype.constructor,type:5,write(i){return i.data},read(i){return new Fy(i)}},{Class:Zn.prototype.constructor,type:6,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,Zn.prototype),i}}];for(let i of aQ)EB(i);oQ=new fu({structuredClone:!0});(t=>{function i(e){return oQ.unpack(e)}t.deserialize=i})(kS||(kS={}))});var AB,Fd,CB=F(()=>{"use strict";TB();AB=i=>()=>{throw new Error(i+" is not available in the runtime build (decode-only CollabSerialize)")},Fd={deserialize:kS.deserialize,serialize:AB("CollabSerialize.serialize"),checksum:AB("CollabSerialize.checksum")}});var an=F(()=>{Vy();W3();PS();lu();Uy();IS();uu();Z3();eB();uC();nB();CS();CB();iC();DS()});function Xp(i){return i==="MouseDown"||i==="MouseUp"||i==="KeyDown"||i==="KeyUp"||i==="Collision"||i==="Trigger"}var PB,SC,Ud,VS,xC,IB,OB,RB,zS,GS,DB,LB,NB,BB,FB,jS,HS,UB,kB,VB,zB,wC=F(()=>{"use strict";an();Y();(e=>{function i(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type}e.toEventUIType=i;function t(n){return n==="Distance"||n==="StateChange"?"Conditional":n}e.fromEventUIType=t})(PB||(PB={}));SC={["LookAt"]:[],["Follow"]:["Create"],["DragDrop"]:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseHover"]:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Scroll"]:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Start"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Conditional"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MousePress"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyPress"]:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["GameControl"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],["Collision"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Trigger"]:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Resize"]:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["VariableChange"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["API"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["WEBHOOK"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["AIAssistantListener"]:["SetVariable"],["AIAssistantTrigger"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(e=>{function i(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"}e.is=i;function t(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new ze}:{type:n,disabled:!1,name:"",key:void 0,actions:new ze}}e.defaultData=t})(Ud||(Ud={}));(e=>{function i(n){return{type:"Property",value:[n??null,"position","x"]}}e.propertyDefaultData=i,e.valueDefaultData={type:"Literal",value:0}})(VS||(VS={}));(n=>{function i(r){return{type:"Comparison",operator:"==",lOperand:VS.propertyDefaultData(r),rOperand:{...VS.valueDefaultData}}}n.comparisonDefaultData=i;function t(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}}n.distanceDefaultData=t;function e(r,s){return{type:"State",object:r??null,state:s??null}}n.stateDefaultData=e})(xC||(xC={}));(t=>{function i(e){return e.find(n=>n==="ifActions"||n==="elseActions")!==void 0}t.isConditionalSubActions=i})(IB||(IB={}));(e=>{function i(n){return n.type==="Conditional"}e.is=i;function t(n){return{type:"Conditional",disabled:!1,name:"",inActions:new ze,outActions:new ze,condition:xC.distanceDefaultData(n)}}e.defaultData=t})(OB||(OB={}));(t=>t.defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new ze,drop:new ze}})(RB||(RB={}));(t=>t.defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new ze})(zS||(zS={}));(t=>t.defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5})(GS||(GS={}));(e=>{function i(n){return n.type==="MouseHover"}e.is=i;function t(){return{type:"MouseHover",disabled:!1,name:"",actions:new ze}}e.defaultData=t})(DB||(DB={}));(e=>{function i(n){return n.type==="Scroll"}e.is=i;function t(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new ze}}e.defaultData=t})(LB||(LB={}));(e=>{function i(n){return n.type==="Start"}e.is=i;function t(){return{type:"Start",disabled:!1,name:"",actions:new ze}}e.defaultData=t})(NB||(NB={}));(e=>{function i(n){return n.type==="Collision"}e.is=i;function t(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new ze}}e.defaultData=t})(BB||(BB={}));(e=>{function i(n){return n.type==="Trigger"}e.is=i;function t(n,r){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new ze,triggerZone:"box",position:r.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}e.defaultData=t})(FB||(FB={}));(a=>{a.defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]};function t(o){return o.type==="Resize"}a.is=t;function e(o){return typeof o=="string"?o:"custom"}a.sizeToDevice=e;function n(o){return typeof o=="string"?[...a.defaultSizes[o]]:[...o]}a.deviceToSize=n;function r(){let o={size:"mobile",operator:"<",actions:new ze},l={size:"tablet",operator:"<",actions:new ze},c={size:[...a.defaultSizes.custom],operator:"<>",actions:new ze},u=new ze;return u.push({id:we.generateUUID(),fi:0,data:o},{id:we.generateUUID(),fi:1,data:l},{id:we.generateUUID(),fi:2,data:c}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:u}}a.defaultData=r;function s(){return{size:[...a.defaultSizes.custom],operator:"<>",actions:new ze}}a.defaultBreakpointData=s})(jS||(jS={}));(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]};function t(r){return r.type==="VariableChange"}n.is=t;function e(){return{disabled:!1,type:"VariableChange",name:"",actions:new ze,variableId:"",objectId:null,property:"Position X"}}n.defaultData=e})(HS||(HS={}));(e=>{function i(n){return n.type==="API"}e.is=i;function t(){return{disabled:!1,type:"API",name:"",successActions:new ze,errorActions:new ze,userAPIId:""}}e.defaultData=t})(UB||(UB={}));(e=>{function i(n){return n.type==="WEBHOOK"}e.is=i;function t(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new ze,userWebhookId:""}}e.defaultData=t})(kB||(kB={}));(e=>{function i(n){return n.type==="AIAssistantListener"}e.is=i;function t(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new ze,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=t})(VB||(VB={}));(e=>{function i(n){return n.type==="AIAssistantTrigger"}e.is=i;function t(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new ze}}e.defaultData=t})(zB||(zB={}))});function jB(i){let t=typeof i;return i!==null&&(t==="object"||t==="function")}function EC(i){return typeof i=="string"&&i.length===36?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(i):!1}var fa,mu,HB,Er,qS,Xs,pa,kd,GB,No,yr,zt,WS,Vd,Yp,$p,tc,_s=F(()=>{"use strict";fa="personal camera",mu="a218fcc3-276b-49b9-b485-49037fd14f5f",HB=2500134,Er=5526619,qS=(n=>(n.x="x",n.y="y",n.z="z",n))(qS||{});(p=>{function i(f,m){return f[0]===m[0]&&f[1]===m[1]}p.isEqual=i;function t(f,m,g){return[f[0]+(m[0]-f[0])*g,f[1]+(m[1]-f[1])*g]}p.lerp=t;function e(f,m){return[f[0]+m[0],f[1]+m[1]]}p.add=e;function n(f,m){return[f[0]-m[0],f[1]-m[1]]}p.sub=n;function r(f,m){return[f[0]*m[0],f[1]*m[1]]}p.multiply=r;function s(f,m){return[f[0]/m[0],f[1]/m[1]]}p.divide=s;function a(f,m){return Math.pow(m[0]-f[0],2)+Math.pow(m[1]-f[1],2)}p.distanceSquared=a;function o(f,m){return Math.sqrt(a(f,m))}p.distance=o;function l(f,m){return f[0]*m[0]+f[1]*m[1]}p.dot=l;function c(f,m){return[f[0]*m,f[1]*m]}p.scalarMultiply=c;function u(f,m,g){let y=p.sub(m,f),v=p.sub(g,f),b=p.dot(y,v)/p.dot(y,y),x=p.scalarMultiply(y,b);return p.add(f,x)}p.projectionOnto=u;function d(f,m,g){return o(f,u(f,m,g))}p.projectionOntoDistance=d;function h(f,m){return[(f[0]+m[0])*.5,(f[1]+m[1])*.5]}p.center=h})(Xs||(Xs={}));(o=>{function i(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]}o.isEqual=i;function t(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}o.add=t;function e(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]}o.sub=e;function n(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]}o.div=n;function r(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]}o.mul=r;function s(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])}o.dist=s;function a(l,c,u){return[l[0]+(c[0]-l[0])*u,l[1]+(c[1]-l[1])*u,l[2]+(c[2]-l[2])*u]}o.lerp=a})(pa||(pa={}));(e=>{function i(n,r){return n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3]}e.isEqual=i;function t(n,r,s){return[n[0]+(r[0]-n[0])*s,n[1]+(r[1]-n[1])*s,n[2]+(r[2]-n[2])*s,n[3]+(r[3]-n[3])*s]}e.lerp=t})(kd||(kd={}));(a=>{let i=180/Math.PI,t=Math.PI/180;function e(o){return typeof o=="number"?o*i:o}function n(o){return typeof o=="number"?o*t:o}function r(o){return[e(o[0]),e(o[1]),e(o[2])]}a.radToDeg=r;function s(o){return[n(o[0]),n(o[1]),n(o[2])]}a.degToRad=s})(GB||(GB={}));(r=>{r.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(s,a){for(let o=0;o<16;o++)if(s[o]!==a[o])return!1;return!0}r.isEqual=t;function e(s){return s??r.identity}r.simplify=e;function n(s,a){let o=a.slice(0);for(let l=0,c=a.length;l<c;l+=3){let u=s[3]*a[l]+s[7]*a[l+1]+s[11]*a[l+2]+s[15];o[l]=(s[0]*a[l]+s[4]*a[l+1]+s[8]*a[l+2]+s[12])/u,o[l+1]=(s[1]*a[l]+s[5]*a[l+1]+s[9]*a[l+2]+s[13])/u,o[l+2]=(s[2]*a[l]+s[6]*a[l+1]+s[10]*a[l+2]+s[14])/u}return o}r.applyMatrix4=n})(No||(No={}));(h=>{function i(p){return typeof p=="object"&&typeof p.r=="number"&&typeof p.g=="number"&&typeof p.b=="number"}h.isRGB=i,h.white={r:1,g:1,b:1},h.red={r:1,g:0,b:0},h.black={r:0,g:0,b:0};function r(p){return{r:Math.round(p.r*255),g:Math.round(p.g*255),b:Math.round(p.b*255),a:1}}h.toRgb255a1=r;function s(p){return{r:p.r,g:p.g,b:p.b}}h.clone=s;function a(p){return p=Math.floor(p),{r:(p>>16&255)/255,g:(p>>8&255)/255,b:(p&255)/255}}h.fromHex=a;function o(p){return Math.round(p.r*255)*65536+Math.round(p.g*255)*256+Math.round(p.b*255)}h.toHex=o;function l(p,f){return p.r===f.r&&p.g===f.g&&p.b===f.b}h.equals=l;function c(p,f){return p.r.toFixed(2)===f.r.toFixed(2)&&p.g.toFixed(2)===f.g.toFixed(2)&&p.b.toFixed(2)===f.b.toFixed(2)}h.equalsFixed=c;function u(p,f,m){return{r:p.r+(f.r-p.r)*m,g:p.g+(f.g-p.g)*m,b:p.b+(f.b-p.b)*m}}h.lerp=u;function d(p){return jB(p)?"r"in p&&"g"in p&&"b"in p&&!("a"in p):!1}h.is=d})(yr||(yr={}));(u=>{u.white={...yr.white,a:1};function t(d){return jB(d)?"r"in d&&"g"in d&&"b"in d&&"a"in d:!1}u.is=t,u.transparent={...yr.white,a:0};function n(d){return{r:d[0],g:d[1],b:d[2],a:d[3]}}u.from0to1=n;function r(d,h){return{...yr.fromHex(d),a:h}}u.fromHexAndA=r;function s(d){return{r:Math.round(d.r*255),g:Math.round(d.g*255),b:Math.round(d.b*255),a:d.a}}u.toRgb255a1=s;function a(d,h){return yr.equals(d,h)&&d.a===h.a}u.equals=a;function o(d,h){return yr.equalsFixed(d,h)&&d.a.toFixed(2)===h.a.toFixed(2)}u.equalsFixed=o;function l(d,h,p){return{r:d.r+(h.r-d.r)*p,g:d.g+(h.g-d.g)*p,b:d.b+(h.b-d.b)*p,a:d.a+(h.a-d.a)*p}}u.lerp=l;function c({r:d,g:h,b:p,a:f}=u.white){return`rgba(${d*255}, ${h*255}, ${p*255}, ${f})`}u.toStyle=c})(zt||(zt={}));(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]})(WS||(WS={}));Vd=(c=>(c[c.LINEAR=0]="LINEAR",c[c.EASE=1]="EASE",c[c.EASE_IN=2]="EASE_IN",c[c.EASE_OUT=3]="EASE_OUT",c[c.EASE_IN_OUT=4]="EASE_IN_OUT",c[c.CUBIC=5]="CUBIC",c[c.SPRING=6]="SPRING",c[c.ARC=7]="ARC",c[c.NONE=8]="NONE",c))(Vd||{});(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Yp||(Yp={}));(t=>t.defaultData={control1:[.5,0],control2:[.5,1]})($p||($p={}));(s=>(s.linear=[0,0,1,1],s.ease=[.25,.1,.25,1],s.easeIn=[.42,0,1,1],s.easeOut=[0,0,.58,1],s.easeInOut=[.42,0,.58,1]))(tc||(tc={}))});var WB,qB,XB,YB,$B,KB,ZB,MC,QB,JB,_C,eF,tF,nF,TC,rF,AC,iF,sF,aF,oF,lF,cF,uF,dF,hF=F(()=>{"use strict";an();wC();(t=>t.defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"})(WB||(WB={}));(t=>t.defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"})(qB||(qB={}));(t=>t.defaultData={type:"Link",name:"",url:null,context:"tab"})(XB||(XB={}));(t=>t.defaultData={type:"Destroy",name:"",objects:[],delay:0})(YB||(YB={}));(t=>t.defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"})($B||($B={}));(t=>t.defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"})(KB||(KB={}));(t=>t.defaultData={type:"Reset",name:"",delay:0})(ZB||(ZB={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1})(MC||(MC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(QB||(QB={}));(s=>(s.defaultData={type:"Audio",name:"",...MC.defaultData},s.hasAudioByActions=a=>a.some(({data:o})=>o.type==="Audio"&&o.interaction==="play"&&o.audio),s.hasAudioByEvents=a=>{for(let{data:o}of a)if(Ud.is(o)||o.type==="Start"||o.type==="Collision"){if(s.hasAudioByActions(o.actions))return!0}else if(o.type==="Conditional"){if(s.hasAudioByActions(o.inActions)||s.hasAudioByActions(o.outActions))return!0}else if(o.type==="GameControl"&&Object.values(o.gameActions).find(l=>s.hasAudioByActions(l)))return!0},s.getAudiosByActions=a=>{let o=[];return a.forEach(l=>{let c=l.data;c.type==="Audio"&&c.interaction==="play"&&c.audio&&o.push(l),c.type==="Conditional"&&(o.push(...s.getAudiosByActions(c.ifActions)),o.push(...s.getAudiosByActions(c.elseActions)))}),o},s.getAudiosByEvents=a=>{let o=[];return a.forEach(({data:l})=>{Ud.is(l)||l.type==="Collision"||l.type==="Start"||l.type==="Trigger"?o.push(...s.getAudiosByActions(l.actions)):l.type==="Conditional"?(o.push(...s.getAudiosByActions(l.inActions)),o.push(...s.getAudiosByActions(l.outActions))):l.type==="GameControl"?Object.values(l.gameActions).forEach(c=>{o.push(...s.getAudiosByActions(c))}):l.type==="DragDrop"&&(o.push(...s.getAudiosByActions(l.dragDropActions.drag)),o.push(...s.getAudiosByActions(l.dragDropActions.drop)))}),o}))(JB||(JB={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1/0})(_C||(_C={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(eF||(eF={}));(s=>(s.defaultData={type:"Video",name:"",triggerAfter:"autoplay",..._C.defaultData},s.hasVideoByActions=a=>a.some(({data:o})=>o.type==="Video"&&o.interaction==="play"&&o.layerId),s.hasVideoByObject=a=>{if(a.events){for(let{data:o}of a.events)if((Ud.is(o)||o.type==="Start")&&s.hasVideoByActions(o.actions))return!0}},s.getVideosByActions=a=>{let o=[];return a.forEach(l=>{let c=l.data;c.type==="Video"&&c.interaction==="play"&&c.layerId&&o.push(l)}),o},s.getVideosByEvents=a=>{let o=[];return a.forEach(({data:l})=>{(Ud.is(l)||l.type==="Start")&&o.push(...s.getVideosByActions(l.actions))}),o}))(tF||(tF={}));(t=>{function i(e){return{state:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}}t.defaultData=i})(nF||(nF={}));(t=>{function i(){return{tweens:new ze,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}}t.defaultData=i})(TC||(TC={}));(t=>{function i(e){return{type:"Transition",name:"",runMode:"Once",object:e??null,...TC.defaultData()}}t.defaultData=i})(rF||(rF={}));(t=>{function i(e){return{interaction:"play",timeline:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}}t.defaultData=i})(AC||(AC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(iF||(iF={}));(t=>{function i(e){return{type:"TimelineAnimation",name:"",...AC.defaultData(e)}}t.defaultData=i})(sF||(sF={}));(t=>{function i(e,n,r){return{type:"Animation",name:"",object:e,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}}t.defaultData=i})(aF||(aF={}));(t=>t.defaultData={type:"SetVariable",name:"",variableId:"",expression:[]})(oF||(oF={}));(t=>t.defaultData=()=>({type:"Conditional",name:"",ifActions:new ze,elseActions:new ze,condition:[]}))(lF||(lF={}));(t=>t.defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0})(cF||(cF={}));(t=>t.defaultData={type:"ClearLocalStorage",name:"",target:"all"})(uF||(uF={}));(t=>t.defaultData={name:"",type:"UserAPI"})(dF||(dF={}))});var pF,fF=F(()=>{"use strict";(e=>(e.emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),n=>n.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6))(pF||(pF={}))});var Qa,Ja,CC=F(()=>{"use strict";(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(n){return e.all.includes(n)}e.is=t})(Qa||(Qa={}));(p=>{p.DefaultUp=[0,1,0],p.DefaultTargetOffset=1e3,p.MinTargetOffset=.001;function n(f){return f===void 0||!Number.isFinite(f)||f<p.MinTargetOffset?p.DefaultTargetOffset:f}p.sanitizeTargetOffset=n,p.DefaultAzimuth=-24,p.DefaultElevation=15;let a=p.DefaultAzimuth*Math.PI/180,o=p.DefaultElevation*Math.PI/180,l=180/Math.PI;p.DefaultPosition=[p.DefaultTargetOffset*Math.sin(a)*Math.cos(o),p.DefaultTargetOffset*Math.sin(o),p.DefaultTargetOffset*Math.cos(a)*Math.cos(o)],p.DefaultRotation=[Math.atan2(-Math.sin(o),Math.cos(a)*Math.cos(o))*l,Math.asin(Math.sin(a)*Math.cos(o))*l,Math.atan2(Math.sin(a)*Math.sin(o),Math.cos(a))*l],p.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:p.DefaultUp,isUpVectorFlipped:!1,targetOffset:p.DefaultTargetOffset};function h(f){return f.type==="PerspectiveCamera"?f.perspective?.zoom??1:f.orthographic?.zoom??1}p.getZoom=h})(Ja||(Ja={}))});var Bo,XS,PC,YS,$S,KS,ZS,QS,IC=F(()=>{"use strict";(n=>{function i(r,s=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:Math.max(typeof r[0]=="number"?r[0]:1,typeof r[1]=="number"?r[1]:1)*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof r[0]=="number"?r[0]+r[0]:1)*s,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:r.map(a=>(typeof a=="number"?a:1)*(1+s)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}}n.defaultData=i;function t(r,s){let a={...r};if(PC.forEach(o=>{Object.assign(a,{[o]:s[o]??r[o]})}),a.radial={...r.radial},s.radial){let o=r.radial,l=s.radial;YS.forEach(c=>{Object.assign(a.radial,{[c]:l[c]??o[c]})})}if(a.linear={...r.linear},s.linear){let o=r.linear,l=s.linear;$S.forEach(c=>{Object.assign(a.linear,{[c]:l[c]??o[c]})})}if(a.grid={...r.grid},s.grid){let o=r.grid,l=s.grid;KS.forEach(c=>{Object.assign(a.grid,{[c]:l[c]??o[c]})})}if(a.toObject={...r.toObject},s.toObject){let o=r.toObject,l=s.toObject;ZS.forEach(c=>{Object.assign(a.toObject,{[c]:l[c]??o[c]})})}if(a.randomnessObject={...r.randomnessObject},s.randomnessObject){let o=r.randomnessObject,l=s.randomnessObject;QS.forEach(c=>{Object.assign(a.randomnessObject,{[c]:l[c]??o[c]})})}return a}n.merge=t;function e(r){return!!(r.randomnessObject||r.toObject)}n.isPartial=e})(Bo||(Bo={}));(n=>{n.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function e(r,s){let a=[];r.count!==void 0&&a.push({type:0,path:s,props:{count:r.count}});for(let o of t){let l=r[o];l&&Object.keys(l).length>0&&a.push({type:0,path:[...s,o],props:l})}return a}n.toOps=e})(XS||(XS={}));PC=["count"],YS=["radius","start","end","position","scale","rotation"],$S=["position","scale","rotation"],KS=["count","size"],ZS=["count","position","scale","rotation"],QS=["strength","scale","rotation","position","movement","seed","freqScale"]});var JS,e1,OC=F(()=>{"use strict";_s();(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(n){return e.all.includes(n)}e.is=t})(JS||(JS={}));(e=>{function i(n){return t(n)}e.defaultData=i;function t(n){if(n==="PointLight")return{type:n,color:zt.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(n==="SpotLight")return{type:n,color:zt.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(n==="DirectionalLight")return{type:n,color:zt.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(e1||(e1={}))});var Kp,RC=F(()=>{"use strict";(n=>(n.defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},n.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},n.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:n.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...n.defaultCollisionData}))(Kp||(Kp={}))});var t1,DC=F(()=>{"use strict";(e=>(e.defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]))(t1||(t1={}))});var gu,n1=F(()=>{"use strict";(t=>t.defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]})(gu||(gu={}))});var i1,LC,NC,r1,mF,BC=F(()=>{"use strict";i1=(n=>(n[n.Front=0]="Front",n[n.Back=1]="Back",n[n.Double=2]="Double",n))(i1||{});(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(n,r){return n.castShadow===r.castShadow&&n.receiveShadow===r.receiveShadow}e.equals=t})(LC||(LC={}));(e=>{e.defaultData={flatShading:!1,wireframe:!1,side:0};function t(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}e.equals=t})(NC||(NC={}));(t=>t.defaultData={...NC.defaultData,...LC.defaultData})(r1||(r1={}));(t=>{function i(e,n){let r=[];if("material"in e){let s=typeof e.material=="string"?n.materials[e.material]??n.lib.materials[e.material]?.asset:e.material;s&&r.push(s)}else if("materials"in e)for(let s of e.materials){let a=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;a&&r.push(a)}return r}t.getMaterialData=i})(mF||(mF={}))});var Zp,FC=F(()=>{"use strict";(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(Zp||(Zp={}))});function bF(i){return i.type!=="displace"}var gF,yF,jy,vF,s1,Qp,a1,UC,kC,o1,VC,zC,l1,xF,Qn,An,Hy=F(()=>{"use strict";an();_s();FC();_s();(t=>{function i(e){return e==="texture"||e==="video"||e==="color"||e==="depth"||e==="normal"||e==="gradient"||e==="noise"||e==="fresnel"||e==="cavity"||e==="dust"||e==="rainbow"||e==="toon"||e==="outline"||e==="particle"||e==="transmission"||e==="reflection"||e==="matcap"||e==="displace"||e==="pattern"||e==="vertexColor"||e==="light"}t.is=i})(gF||(gF={}));(t=>{function i(e){return e==="luminance"||e==="r"||e==="g"||e==="b"||e==="a"}t.is=i})(yF||(yF={}));(t=>{function i(e){return typeof e=="object"&&e!==null&&e.image!=null}t.is=i})(jy||(jy={}));(t=>{function i(e){return e==="phong"||e==="toon"||e==="lambert"||e==="physical"}t.is=i})(vF||(vF={}));s1=(n=>(n[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",n))(s1||{}),Qp=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(Qp||{}),a1=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(a1||{}),UC=(s=>(s[s.UV=0]="UV",s[s.Planar=1]="Planar",s[s.Spherical=2]="Spherical",s[s.Cylindrical=3]="Cylindrical",s[s.Triplanar=4]="Triplanar",s))(UC||{}),kC=(a=>(a[a.Simplex=0]="Simplex",a[a.SimplexFractal=1]="SimplexFractal",a[a.Ashima=2]="Ashima",a[a.Fbm=3]="Fbm",a[a.Perlin=4]="Perlin",a[a.Voronoi=5]="Voronoi",a))(kC||{}),o1=(l=>(l[l.F1=0]="F1",l[l.F2=1]="F2",l[l.F2MinusF1=2]="F2MinusF1",l[l.SmoothBlend=3]="SmoothBlend",l[l.Edge=4]="Edge",l[l.Power=5]="Power",l[l.Lines=6]="Lines",l[l.Cells=7]="Cells",l))(o1||{}),VC=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(VC||{}),zC=(l=>(l[l.Circle=0]="Circle",l[l.Ring=1]="Ring",l[l.Polygon=2]="Polygon",l[l.Cross=3]="Cross",l[l.Diamond=4]="Diamond",l[l.Checkerboard=5]="Checkerboard",l[l.Line=6]="Line",l[l.Wave=7]="Wave",l))(zC||{}),l1=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],xF=["wrapping","image","video","name","minFilter","magFilter"];(s=>{function i(a,o){let{texture:l,...c}=o;if(Object.assign(a,c),l){let u=a.texture;u&&Object.assign(u,l)}}s.patch=i;function t(a){return{...s.defaultData("color"),color:a}}s.defaultColorLayer=t;function e(a,o){return a==="light"&&o?n(o):r(a)}s.defaultData=e;function n(a){let o={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(a){case"phong":return{...o,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...o,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...o,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...o,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}function r(a){let o={alpha:1,mode:0,isMask:!1,visible:!0};switch(a){case"texture":return{...o,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...o,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Zp.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...o,type:"color",color:yr.fromHex(Er)};case"vertexColor":return{...o,type:"vertexColor"};case"depth":return{...o,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...o,type:"normal",cnormal:[1,1,1]};case"gradient":return{...o,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...o,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...yr.fromHex(6710886),a:1},colorB:{...yr.fromHex(6710886),a:1},colorC:{...yr.fromHex(16777215),a:1},colorD:{...yr.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...o,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...o,type:"fresnel",color:zt.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...o,type:"dust",color:zt.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...o,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...o,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:zt.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...o,type:"outline",outlineColor:zt.fromHexAndA(0,1),contourColor:zt.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...o,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...o,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...o,type:"reflection",blur:0,thickness:10/1e4,steps:60,stepSize:5/1e3,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...o,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...yr.fromHex(0),a:1},colorB:{...yr.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}})(Qn||(Qn={}));(u=>{function i(d){return!d.layers.some(p=>p.data.type==="texture"&&p.data.projection!==0||p.data.type==="depth"&&!p.data.isWorldSpace||p.data.type==="noise"||p.data.type==="dust"&&p.data.noiseStrength!==0||p.data.type==="displace")}u.isMergable=i;function t(d){let h="";return d.layers.forEach(p=>{Object.entries(p.data).forEach(([f,m])=>{h+=`${f}${m}`,Array.isArray(m)?m.forEach(g=>h+=`${g}`):typeof m=="object"?Object.values(m).forEach(g=>{typeof g=="number"?h+=`${g.toFixed(4)}`:h+=`${g}`}):h+=`${m}`})}),h}u.getHash=t;function e(){return{layers:new ze}}u.defaultEmptyData=e;function n(d="layer1",h="layer2"){return s("physical",d,h)}u.defaultData=n;function r(d,h){return{...d,name:h}}u.withName=r;function s(d,h="layer1",p="layer2",f=yr.fromHex(16777215)){let m=new ze;return m.push({fi:0,data:Qn.defaultData("light",d),id:h}),m.push({fi:1,data:Qn.defaultData("color"),id:p}),{layers:m}}u.defaultTwoLayerData=s;function a(d,h,p="layer1",f="layer2"){let m=new ze;return m.push({fi:0,data:Qn.defaultData("light",h),id:p}),m.push({fi:1,data:Qn.defaultColorLayer(d),id:f}),{layers:m}}u.defaultColorMaterial=a;function o(d){let h=Qn.defaultData("texture");d&&Object.assign(h.texture,{image:d});let p=new ze;return p.push({fi:0,data:h,id:"layer1"}),p.push({fi:1,data:{...Qn.defaultData("transmission"),alpha:1},id:"layer2"}),p.push({fi:2,data:{...Qn.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:p}}u.defaultUIObjectMaterial=o;function l(d,h="physical",p="layer1",f="layer2"){let m=Qn.defaultData("texture");Object.assign(m.texture,{image:d});let g=new ze;return g.push({fi:0,data:m,id:p}),g.push({fi:1,data:Qn.defaultData("light",h),id:f}),{layers:g}}u.defaultTwoLayerTextureData=l;function c(d,h="physical",p="layer1",f="layer2"){let m=Qn.defaultData("video");Object.assign(m.texture,{video:d});let g=new ze;return g.push({fi:0,data:m,id:p}),g.push({fi:1,data:Qn.defaultData("light",h),id:f}),{layers:g}}u.defaultTwoLayerVideoTextureData=c})(An||(An={}))});var Jp,SF,wF=F(()=>{"use strict";Jp="Roboto_regular",SF="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"});var zd,GC=F(()=>{"use strict";an();(t=>{function i(){return{points:new ze,roundness:0,shapeHoles:[],isClosed:!1}}t.defaultData=i})(zd||(zd={}))});var ef,Gd,c1,u1,d1,jC=F(()=>{"use strict";an();(t=>{function i(){return{points:new ze,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}t.defaultData=i})(ef||(ef={}));Gd={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(t=>{function i(e,n){let r={...e};return d1.forEach(s=>{Object.assign(r,{[s]:n[s]??e[s]})}),r}t.merge=i})(c1||(c1={}));u1={shape:Gd,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},d1=["depth","offset","angle","twist","startScale","endScale"]});var Wy,h1,ma,p1,f1=F(()=>{"use strict";GC();jC();(n=>{function i(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="UIGeometry"}n.is2DParametricMesh=i;function t(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="BooleanGeometry"||r==="TextGeometry"||r==="InputGeometry"||r==="DecalGeometry"}n.isParametricMesh=t;function e(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="TextGeometry"||r==="SubdivGeometry"||r==="NonParametricGeometry"}n.isSwappableGeometry=e})(Wy||(Wy={}));(t=>{function i(e,n){let r={...e};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...e.extrusion},Object.assign(r.extrusion,c1.merge(r.extrusion,n.extrusion))),r}t.merge=i})(h1||(h1={}));(t=>{function i(e){if(e==="RectangleGeometry")return{width:320,height:320,type:e,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="UIGeometry")return{type:e,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(e==="PathGeometry")return{type:e,width:1,height:1,depth:1,path:ef.defaultData(),extrusion:u1};if(e==="VectorGeometry")return{width:1,height:1,type:e,subdivisions:12,shape:zd.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="BooleanGeometry")return{type:e,operation:2,width:0,height:0,depth:0,phongAngle:35};if(e==="ShapeBlendGeometry")return{type:e,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(e==="DecalGeometry")return{type:e,width:200,height:200,depth:200,offset:1};if(e==="TextGeometry")return{type:e,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="InputGeometry")return{...t.defaultData("TextGeometry"),type:e,editable:!0};if(e==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")}t.defaultData=i})(ma||(ma={}));p1=["width","height","depth"]});var Fr,HC=F(()=>{"use strict";_s();(a=>{a.defaultData={enabled:!1,useBackgroundColor:!1,color:yr.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0};function t(o){return o.mode??"linear"}a.getMode=t;function e(o){let l=t(o);return l==="height"?1:l==="both"?2:0}a.getModeIndex=e;function n(o){return o.density??a.defaultData.density}a.getDensity=n;function r(o){return o.heightFalloff??a.defaultData.heightFalloff}a.getHeightFalloff=r;function s(o){return o.heightBase??a.defaultData.heightBase}a.getHeightBase=s})(Fr||(Fr={}))});var WC,Fo,m1=F(()=>{"use strict";(t=>t.defaultData={image:null,rotation:0,blur:32,showBackground:!0})(WC||(WC={}));(t=>t.defaultData={enabled:!1,mode:"hdri",hdri:WC.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2})(Fo||(Fo={}))});var tf,qC=F(()=>{"use strict";(e=>{let i={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:{...i,blendFunction:16,granularity:15},bloom:{...i,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...i,offset:[2,2]},vignette:{...i,darkness:1,offset:0},hueSaturation:{...i,hue:3,saturation:0},brightnessContrast:{...i,brightness:.25,contrast:0},depthOfField:{...i,focusDistance:100,focalLength:20,bokehScale:5},noise:{...i,blendFunction:16}}})(tf||(tf={}))});var jd,XC,YC,$C,yu,KC,g1,y1=F(()=>{"use strict";HC();m1();qC();_s();(e=>{e.defaultData={type:"normal",softShadowQuality:"low"};function t(n){return n==null?!1:n.type===void 0||n.type==="soft"}e.isSoft=t})(jd||(jd={}));(t=>t.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(XC||(XC={}));(t=>t.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(YC||(YC={}));(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1};function t(n){return n===void 0||n.pipeline==="classic"&&(n.toneMapping==="none"||n.toneMapping==="aces")&&n.exposure===1}e.isUntouched=t})($C||($C={}));(t=>t.defaultData={usePhysics:!1,gravity:-10})(yu||(yu={}));(t=>t.defaultData={playCamera:fa,gameControlObject:null})(KC||(KC={}));(t=>t.defaultData={backgroundColor:zt.fromHexAndA(HB,1),postprocessing:tf.defaultData,fog:Fr.defaultData,sky:Fo.defaultData,globalPhysics:yu.defaultData,ambient:XC.defaultData,ao:YC.defaultData,shadow:jd.defaultData,publish:KC.defaultData,grading:$C.defaultData})(g1||(g1={}))});var v1,EF=F(()=>{"use strict";(t=>t.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(v1||(v1={}))});var MF,nf,IF,Ur,rf,_F,TF,AF,CF,ga,Hd,sf,af,ya,eo,PF,to,qy=F(()=>{"use strict";an();CC();OC();RC();DC();n1();BC();_s();Hy();f1();IC();mi();y1();EF();(e=>{function i(n){return n==="Component"||n==="Instance"}e.isComponentRelated=i;function t(n){return n==="Empty"||n==="Instance"}e.isEmptyOrComponent=t})(MF||(MF={}));(r=>{r.identity={...WS.identity,hiddenMatrix:No.identity};function t(s){return{position:s.position,rotation:s.rotation,scale:s.scale,pivot:s.pivot,pivotRotation:s.pivotRotation,hiddenMatrix:s.hiddenMatrix}}r.fromObject=t;function e(s,a){return{position:a?.position||s.position,rotation:a?.rotation||s.rotation,pivot:a?.pivot||s.pivot,pivotRotation:a?.pivotRotation||s.pivotRotation,scale:a?.scale||s.scale,hiddenMatrix:a?.hiddenMatrix||s.hiddenMatrix}}r.merge=e;function n(s,a){return TS({position:pa.isEqual(s.position,a.position)?void 0:a.position,rotation:pa.isEqual(s.rotation,a.rotation)?void 0:a.rotation,scale:pa.isEqual(s.scale,a.scale)?null:a.scale,hiddenMatrix:No.isEqual(s.hiddenMatrix,a.hiddenMatrix)?void 0:a.hiddenMatrix})}r.diff=n})(nf||(nf={}));IF=["slide","offset"];(t=>t.defaultData={states:new ze,events:new ze,timelineAnimations:new st,visible:!0,raycastLock:!1,physics:gu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...nf.identity,cloner:null})(Ur||(Ur={}));(t=>t.defaultData={type:"Empty",...Ur.defaultData})(rf||(rf={}));(t=>t.defaultData={type:"ParticleCollider",...v1.defaultData,...Ur.defaultData})(_F||(_F={}));(t=>t.defaultData={type:"Component",...Ur.defaultData})(TF||(TF={}));(t=>t.defaultData={type:"Particle",...Ur.defaultData,...Kp.defaultData})(AF||(AF={}));(t=>t.defaultData={type:"Hair",...Ur.defaultData,...t1.defaultData})(CF||(CF={}));(t=>t.defaultData={type:"Mesh",...Ur.defaultData,...r1.defaultData})(ga||(ga={}));(t=>t.defaultData={...Ur.defaultData,...nf.identity,position:Ja.DefaultPosition,rotation:Ja.DefaultRotation,...Ja.defaultData})(Hd||(Hd={}));(e=>{function i(n){return{...Ur.defaultData,...e1.defaultData(n)}}e.defaultData=i,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(sf||(sf={}));(e=>{function i(n,r,s=0){for(;s<r.length;){let a=n?n[r[s]]:void 0;if(r.length===s+1)return a;if(a)n=a.descendants,s+=1;else return}}e.resolveWithDes=i;function t(n,r,s=0){let a=i(n,r,s);if(a){let o=Object.keys(a);if(o.length===1&&o[0]==="descendants")return}return a}e.resolve=t})(af||(af={}));(s=>{s.rootOverrideProps=["physics","events"],s.compositeNonOptionalOverrideProps=["geometry"],s.compositeEntireOverrideOverrideProps=["material"];function n(a,o){return{...Ur.defaultData,...o,component:a,overrides:new Zn,physics:void 0,events:void 0,type:"Instance"}}s.ofComponent=n;function r(a){let o=nf.fromObject(a.data);return n(a.id,o)}s.fromComponentData=r})(ya||(ya={}));(e=>{e.defaultData={type:"Page",...Ur.defaultData,physics:{...gu.defaultData,fusedBody:!1},...g1.defaultData,camera:Hd.defaultData};function t(n){return n.uiScene!==void 0}e.isUIPage=t})(eo||(eo={}));(o=>(o.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:No.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:gu.defaultData,states:new ze,events:new ze,timelineAnimations:new st,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Ja.defaultData},o.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},o.defaultMeshObject={name:"Rectangle",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("RectangleGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},o.defaultBooleanObject={name:"Boolean",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("BooleanGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},o.defaultShapeBlendObject={name:"Shape Blend",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("ShapeBlendGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},o.defaultTextObject={name:"Text",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("TextGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},o.defaultInputObject={name:"Input",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("InputGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")}))(PF||(PF={}));(r=>{function i(s,a){let o={name:a};return s.type==="Mesh"?(o.geometry={},"material"in s&&(o.material={layers:new Zn}),"materials"in s&&(o.materials=s.materials.map(l=>({layers:new Zn})))):Qa.is(s.type)&&(o.perspective={},o.orthographic={}),o}r.newEmpty=i;function t(s,a){if(a===void 0)return s;let o={...s};return"material"in o&&"material"in a&&a.material&&(o.material=du(o.material,l=>{if(typeof l!="string")for(let[c,u]of Object.entries(a.material.layers)){let d=l.layers.data(c);d&&Qn.patch(d,u)}}).data),o.materials&&a.materials&&(o.materials=du(o.materials,l=>{for(let c=0;c<o.materials.length;c++){let u=a.materials[c];if(typeof u!="string")for(let[d,h]of Object.entries(u.layers)){let p=l[c]?.layers?.data(d);p&&Qn.patch(p,h)}}}).data),o}function e(s,a){let o,l=[],c={orthographic:0,perspective:0,geometry:0};function u(d,h){for(let[p,f]of Object.entries(h.layers)){let{texture:m,...g}=f;if(m!==void 0&&Object.keys(m).length>0){let y={path:[...d,"layers",p,"texture"],props:m,type:0};l.push(y)}if(Object.keys(g).length>0){let y={path:[...d,"layers",p],props:g,type:0};l.push(y)}}}for(let[d,h]of Object.entries(a)){let p=h;if(d!=="name")if(d==="cloner")l.push(...XS.toOps(p,["cloner"]));else if(d==="pathSnapping")l.push({path:[d],props:{slide:p.slide,offset:p.offset},type:0});else if(d==="material")u(["material"],p);else if(d==="materials")for(let[f,m]of Object.entries(p))u(["materials",f],m);else if(c[d]===0){if(d==="geometry"&&p.extrusion!==void 0){let f={path:[d,"extrusion"],props:p.extrusion,type:0};l.push(f),p={...p},delete p.extrusion}if(Object.keys(p).length>0){let f={path:[d],props:p,type:0};l.push(f)}}else o===void 0&&(o={path:[],props:{},type:0},l.push(o)),o.props[d]=p}return l}r.toOps=e;function n(s,a){if(a===void 0)return s;let o={...s};if(Object.assign(o,nf.merge(o,a)),Object.assign(o,{pathSnapping:Object.assign({},o.pathSnapping,{slide:a.pathSnapping?.slide??o.pathSnapping?.slide??0,offset:a.pathSnapping?.offset??o.pathSnapping?.offset??0})}),Qa.is(s.type)){o.orthographic={...o.orthographic},o.perspective={...o.perspective};let l=a;l.orthographic?.zoom!==void 0&&(o.orthographic.zoom=l.orthographic.zoom),l.perspective?.zoom!==void 0&&(o.perspective.zoom=l.perspective.zoom),l.isUpVectorFlipped!==void 0&&(o.isUpVectorFlipped=l.isUpVectorFlipped),l.targetOffset!==void 0&&(o.targetOffset=l.targetOffset)}else if(s.type==="Mesh")"geometry"in a&&Object.assign(o,{geometry:h1.merge(o.geometry,a.geometry)}),(a.material||a.materials)&&(o=t(o,a)),o.cloner&&"cloner"in a&&Object.assign(o,{cloner:Bo.merge(o.cloner,a.cloner)});else if(s.type==="Empty")o.cloner&&"cloner"in a&&Object.assign(o,{cloner:Bo.merge(o.cloner,a.cloner)});else if(JS.is(s.type)){let l=a;l.intensity!==void 0&&(o.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?o.color=l.color:o.color=yr.clone(l.color))}return o}r.patch=n})(to||(to={}))});var of,b1=F(()=>{"use strict";(t=>t.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0})(of||(of={}))});var va,Xy=F(()=>{"use strict";b1();_s();(t=>t.defaultData={orbitControls:of.defaultData,playPage:mu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,n)=>{let r=0,s=0;return n<5?s=-30:n<10&&(s=30),n===0||n===10||n===5?r=30:(n===4||n===11||n===9)&&(r=-30),[120,[r,s],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0})(va||(va={}))});var ZC,QC,rc,JC=F(()=>{"use strict";(t=>t.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(ZC||(ZC={}));(t=>t.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(QC||(QC={}));(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...ZC.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:QC.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(rc||(rc={}))});var Uo,ic,x1=F(()=>{"use strict";qy();an();Xy();_s();mi();JC();(n=>{function i(r){return r.find(s=>s.data.type==="Page"&&s.data.globalPhysics.usePhysics)!==void 0}n.physicsEnabled=i;function t(r,s){let a=r.scene.objects.get(s);if(a&&a.data.type==="Component")return a;{let o=r.shared.lib.components[s];if(o)return{...o.asset,id:s}}}n.getComponentData=t;function e(r,s,a){r.scene.objects.traverseFrom(s,(o,l)=>{if(l.type==="Instance"){let c=t(r,l.component)?.data;c&&a(o,l,c.events)}else a(o,l,l.events)})}n.traverseModuleInstances=e})(Uo||(Uo={}));(c=>{c.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",c.defaultLight={fi:-1,data:sf.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]};function e(u=!0,d=[]){let h=[];u&&h.push({...c.defaultLight}),h.push(...d);let p=new Ln;return p.push({fi:1,id:mu,data:{...eo.defaultData,name:"Scene 1"},children:h}),p}c.createDefaultObjectTreeWithPage=e,c.defaultData={objects:e(),publish:va.defaultData,styles:rc.defaultData()},c.emptyDataWithoutPage=function(){return{objects:new Ln,publish:va.defaultData,styles:rc.defaultData()}},c.emptyDataWithPage=function(u=!0){return{objects:e(u),publish:va.defaultData,styles:rc.defaultData()}},c.emptyData=function(){return{objects:new Ln,publish:{...va.defaultData},styles:rc.defaultData()}};function o(u){return{...c.defaultData,objects:fi(u,Ln.prototype)}}c.withObjs=o;function l(u,d){return o([{id:u,data:d,children:[],fi:0}])}c.withObj=l})(ic||(ic={}))});var lf,eP=F(()=>{"use strict";(t=>t.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}})(lf||(lf={}))});var S1,OF,Mr,tP,RF,DF,no,os,w1=F(()=>{"use strict";an();mi();(e=>(e.defaultData=n=>({url:n,name:"New Webhook",parametersSchemas:new ze}),e.defaultParameterValueByType=n=>n==="number"?0:n==="boolean"?!1:""))(S1||(S1={}));(t=>t.defaultData=(e,n="GET")=>({url:e,method:n,name:"New API",headers:new ze,queries:new ze,autoStart:!0}))(OF||(OF={}));(s=>{function i(a){return a.textValue!==void 0}s.isTextValue=i;function t(a){return typeof a=="number"}s.isNumber=t;function e(a){return typeof a=="boolean"}s.isBoolean=e;function n(a){return i(a)?"string":e(a)?"boolean":"number"}s.typeOfVariable=n;function r(a){return s.isTextValue(a)?Array.isArray(a.textValue)?a.textValue.map(o=>o.toString().padStart(a.padding??2,"0")).join(a.deliminator??":")+(a.suffix!==void 0?" "+a.suffix:""):a.textValue.toString():s.isBoolean(a)?a?"True":"False":s.isNumber(a)?parseFloat(a.toFixed(3)).toString():a.toString()}s.getDisplayedValue=r})(Mr||(Mr={}));(t=>t.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(tP||(tP={}));(t=>t.all=[...tP.all,"components"])(RF||(RF={}));(t=>{function i(){return{images:new st,videos:new st,colors:new st,audios:new st,particles:new st,fonts:new st,materials:new st,components:new st,variables:new st,userAPIs:new st,userWebhooks:new st,timelineAnimations:new st}}t.defaultData=i})(DF||(DF={}));(t=>{function i(){return{images:new st,videos:new st,colors:new st,audios:new st,particles:new st,fonts:new st,materials:new st,components:new st,variables:new st,userAPIs:new st,userWebhooks:new st,timelineAnimations:new st}}t.defaultData=i})(no||(no={}));(s=>{function i(){let a={};return a["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},fi(a,st.prototype)}s.defaultColors=i;function t(){return fi({},st.prototype)}s.defaultImages=t;function e(){return{catelogs:new st,materials:new st,images:new st,videos:new st,colors:new st,timelineAnimations:new st,audios:new st,particles:new st,fonts:new st,variables:new ze,userAPIs:new st,userWebhooks:new st,lib:no.defaultData()}}s.emptyData=e;function n(a){switch(a){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let o=[0,0,0];return{name:"Time",value:{textValue:o,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:o,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",a)}}s.defaultVariables=n;function r(a,o){if(o.format==="HH:mm:ss"){let l=Math.floor(a/3600),c=Math.floor((a-l*3600)/60),u=Math.round(a-l*3600-c*60);return{textValue:[l,c,u]}}else if(o.format==="mm:ss"){let l=Math.floor(a/60),c=Math.round(a-l*60);return{textValue:[l,c]}}else return o.format==="number"?a=Math.round(a):a=Math.round(a*1e3)/1e3,a}s.getFormattedTimerTime=r})(os||(os={}))});var LF=F(()=>{"use strict"});var vu,nP=F(()=>{"use strict";an();x1();eP();w1();(l=>{l.defaultData={schema:130,scene:ic.defaultData,frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",lf.defaultData),shared:{...os.emptyData(),colors:os.defaultColors()}},l.createDefaultData=function(){return Fd.deserialize(Fd.serialize(l.defaultData))},l.emptyDataForImports=function(){let c=ic.emptyDataWithPage();return{schema:130,scene:c,frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",lf.defaultData),shared:{...os.emptyData(),colors:os.defaultColors(),images:os.defaultImages()}}},l.emptyData=function(){return{schema:130,scene:ic.emptyDataWithPage(),frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",lf.defaultData),shared:os.emptyData()}},l.clipboard2dData=function(){return{schema:130,scene:ic.emptyData(),frames:new st,shared:os.emptyData()}};function s(c){return{...c,shared:{...c.shared,lib:no.defaultData()}}}l.withoutLib=s;function a(c,u){return Uo.getComponentData(c,u)}l.getComponentData=a;function o(c){let u=Object.values(c.shared.userAPIs);for(let d of u){let h=d.headers;for(let p of h)if(p.data.key.toLowerCase()==="authorization"&&p.data.value!=="")return!0}return!1}l.hasSensitiveData=o})(vu||(vu={}))});var E1,NF=F(()=>{"use strict";(t=>t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"})(E1||(E1={}))});var cf,uf,M1=F(()=>{"use strict";_s();an();(t=>t.list=["idle","move","jump","run"])(cf||(cf={}));(e=>(e.defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:e.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new ze,move:new ze,jump:new ze,run:new ze},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:zt.fromHexAndA(3728051,1)}}))(uf||(uf={}))});function Wd(i,...t){let e={};for(let n of t.flat())i!=null&&n in i&&(e[n]=i[n]);return e}function BF(i){i.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let e=t.colorA,n=t.colorB,r=[[e.r,e.g,e.b,e.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let o=2;o<10;o++)r.push(r[1]),s.push(1);let a={...Wd(Pr(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,a)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let e={...Pr(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,e)}})}function Vo(i,t){Object.values(i.shared.materials).forEach(e=>t(e))}function zo(i,t){i.scene.objects.traverse((e,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=An.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&t(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=An.defaultTwoLayerData("phong")),t(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=An.defaultTwoLayerData("phong")),t(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==Zn.prototype&&t(r.material)})})}function lQ(i){Object.assign(i.scene.publish,{orbitControls:{...of.defaultData,...Pr(i.scene.publish.orbitControls)}})}function cQ(i){Object.assign(i.scene.publish.settings,{video:{...va.defaultData.settings.video,...Pr(i.scene.publish.settings.video)}})}function uQ(i){function t(e){if(e.layers){for(let n of Object.values(e.layers))if(n){for(let[r,s]of Object.entries(n))if((l1.includes(r)||typeof s=="boolean")&&delete n[r],r==="texture")for(let[a,o]of Object.entries(s))(xF.includes(a)||typeof o=="boolean")&&delete s[a]}}}i.scene.objects.traverse((e,n)=>{n.states.forEach(r=>{let s=r;s.material?t(s.material):s.materials&&s.materials.forEach(a=>{t(a)})})})}function dQ(i){i.scene.publish.withBackground=!0}function hQ(i){i.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function pQ(i){i.scene.objects.traverse((t,e)=>{let n=e.cloner;n&&(n.radial.scale=n.radial.scale.map(r=>r+1),n.linear.scale=n.linear.scale.map(r=>r+1))})}function fQ(i){i.scene.objects.traverse((t,e)=>{let n=e.geometry;n&&(n.type==="DodecahedronGeometry"||n.type==="IcosahedronGeometry")&&(n.detail=Math.round(n.detail))})}function mQ(i){i.scene.objects.traverse((t,e)=>{let n=i.scene.objects.unproxy().parent(t);if(n){let r=Pr(i.scene.objects.data(n));r&&r.type==="Mesh"&&r.geometry.type==="BooleanGeometry"&&e.type==="Mesh"&&(e.visible=Pr(e).booleanExclude!==!0)}})}function gQ(i){i.scene.objects.traverse((t,e)=>{if(e.type==="Mesh"){let n=e;e.geometry.type==="NonParametricGeometry"?n.material!==void 0&&delete n.material:n.materials!==void 0&&delete n.materials}})}function yQ(i){function t(n){Object.setPrototypeOf(n,Zn.prototype),n.texture&&Object.setPrototypeOf(n.texture,Zn.prototype)}function e(n){Object.setPrototypeOf(n,Zn.prototype);for(let r in n)t(n[r])}i.scene.objects.traverse((n,r)=>{r.states.forEach(s=>{let a=s;if(a.material){let o=Pr(a.material).layers;e(o),a.material.layers=o}if(a.materials)for(let o=0;o<a.materials.length;o++){let l=a.materials[o],c=Pr(l).layers;e(c),l.layers=c}})})}function FF(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("lambert"))}function rP(i){!i.layers||i.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let e=[...t.colors];e.push(t.colors[9]);let n=[...t.steps];n.push(t.steps[9]);let r={...Pr(t),colors:e,steps:n};Object.assign(t,r)}})}function vQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&(e.geometry.type==="BooleanGeometry"||e.geometry.type==="SubdivGeometry")&&(e.geometry.phongAngle=35)})}function UF(i){i.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(n=>{typeof n!="string"&&rP(n)}):"material"in e&&typeof e.material!="string"&&rP(e.material)}),Object.values(i.shared.materials).forEach(t=>rP(t))}function bQ(i){i.scene.environment.ambientLight.softShadows=!1,i.scene.environment.ambientLight.softShadowQuality="low",i.scene.objects.traverse((t,e)=>{(e.type==="DirectionalLight"||e.type==="SpotLight")&&(e.shadowResolution=1024,e.shadowRadius=1,e.depth=1e5)}),i.shared.penumbraSize=new Array(5).fill(.5)}function xQ(i){i.shared.audios=fi({},st.prototype)}function SQ(i){i.shared.videos=fi({},st.prototype)}function wQ(i){let t=i.shared.materials;Object.entries(t).forEach(([e,n])=>{if(!n.layers){let r={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(t,{[e]:r})}})}function EQ(i){Object.entries(Pr(i.shared.images)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete i.shared.images[n]}),Object.entries(Pr(i.shared.audios)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete i.shared.audios[n]})}function MQ(i){i.scene.publish.settings.web.preload=!1}function kF(i){i.layers&&i.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function VF(i){i.layers&&i.layers.forEach(t=>{bF(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function _Q(i){i.shared.fonts=fi({},st.prototype)}function TQ(i){return i.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function AQ(i){let t=[];i.scene.objects.traverse((e,n)=>{let r=n;if(r.type==="TextFrame"){let s=An.defaultTwoLayerData("phong"),a=typeof r.color=="string"?i.shared.colors[r.color]:r.color;s.layers[1].data.color={r:a.r,g:a.g,b:a.b},s.layers[1].data.alpha=r.alpha;let o=TQ(r.font);i.shared.fonts[o]===void 0&&(i.shared.fonts[o]={name:o});let l={name:r.name,...Ur.defaultData,...ga.defaultData,flatShading:!1,wireframe:!1,geometry:{...ma.defaultData("TextGeometry"),width:r.width,height:r.height,font:o,depth:0,horizontalAlign:r.horizontalAlign,verticalAlign:r.verticalAlign,fontSize:r.fontSize*1.40625,lineHeight:r.lineHeight/1.40625,letterSpacing:r.letterSpacing-1,text:r.text,textTransform:r.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:s,states:Pr(r.states),events:Pr(r.events),visible:r.visible,raycastLock:r.raycastLock,position:r.position,rotation:r.rotation,scale:r.scale,hiddenMatrix:r.hiddenMatrix},c=Pr(i.scene.objects).parent(e);i.scene.objects.insertAfter(c??null,e,[{id:e+"new",data:l,children:[]}]),t.push(e)}}),t.forEach(e=>{i.scene.objects.delete(e)})}function CQ(i){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};i.scene.objects.traverse((e,n)=>{n.events.forEach(r=>{if(!!t[Number(r.type)])if(Object.assign(r,{type:t[Number(r.type)]}),r.type==="Audio"&&"audioEvent"in r&&(Object.assign(r,{playAudio:r.audioEvent}),delete r.audioEvent),r.type==="GameControl")Object.assign(r,{gameActions:{idle:new ze,move:new ze,jump:new ze}});else{let s=new ze;Object.assign(r,{actions:s}),(r.type==="MouseDown"||r.type==="MouseUp"||r.type==="KeyDown"||r.type==="KeyUp")&&"url"in r&&s.push({fi:0,id:we.generateUUID(),data:{type:"Link",url:r.url,delay:0}}),"targets"in r&&(r.targets.forEach((a,o,l)=>{let c={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},u={easing:a.easing,duration:a.duration};a.easing===6?Object.assign(u,Wd(a,"mass","stiffness","damping","velocity")):a.easing===5&&Object.assign(u,{control1:{...a.control1},control2:{...a.control2}});let d={repeat:a.repeat?-1:0,delay:a.delay,delayDirection:a.delayDirection,direction:a.cycle&&a.rewind?"pingpong-rewind":a.cycle?"pingpong":"normal"},h={state:a.state,...d,...u},p={allowSlerp:!0,type:"Transition",object:a.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new ze({fi:0,id:we.generateUUID(),data:c},{fi:1,id:we.generateUUID(),data:h})};s.push({fi:l,id:o,data:p})}),delete r.targets)}})})}function PQ(i){i.scene.objects.traverse((t,e)=>{function n(r,s){let a=new ze,o=[];if(e.events.forEach((l,c,u)=>{if(l.type==="Audio"&&l.trigger===s){let d;o.push(c),l.interaction==="play"?d={...Wd(l,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in l?l.after:void 0,toggle:"after"in l?l.toggle:void 0,type:"Audio"}:(l.interaction==="pause"||l.interaction==="stop")&&(d={...Wd(l,"interaction","delay","object","playAudio"),type:"Audio"}),d&&a.push({fi:u,id:c,data:d})}}),o.forEach(l=>e.events.delete(l)),a.length){let l=e.events.find(c=>c.type===r)?.data;l?"actions"in l&&l.actions.insertBefore(null,a):e.events.insertBefore(null,[{id:we.generateUUID(),data:{type:r,actions:a}}])}}n("Start","start"),n("MouseDown","mouseDown"),n("MouseUp","mouseUp"),n("KeyDown","keyDown"),n("KeyUp","keyUp")})}function zF(i){let t=i.layers.find(e=>e.type==="light")?.data;if(t?.category==="basic"){let e=Qn.defaultData("light","phong"),n=t;Object.assign(n,e),n.visible=!1}}function GF(i){Vo(i,zF),zo(i,zF)}function IQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="SubdivGeometry"&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}function OQ(i){i.scene.objects.traverse((t,e)=>{(e.type==="Empty"||e.type==="Mesh")&&e.cloner&&!e.cloner.randomnessObject&&!e.cloner.toObject&&!e.cloner.randomness&&(e.cloner={...e.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}function RQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="NonParametricGeometry"&&!("material"in e)&&!("materials"in e)&&(e.material=An.defaultTwoLayerData("phong"))})}function DQ(i){i.scene.publish.orbitControls.autoZoom===void 0&&(i.scene.publish.orbitControls.autoZoom=!1),i.scene.objects.traverse((t,e)=>{(e.type==="OrthographicCamera"||e.type==="PerspectiveCamera")&&(e.orthographic.autoZoom===void 0&&(e.orthographic.autoZoom=!1),e.orthographic.autoZoomFrustumSize===void 0&&(e.orthographic.autoZoomFrustumSize=790))})}function LQ(i){i.scene.objects.traverse((t,e)=>{e.pathSnapping===void 0&&(e.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),e.pathSnapping.offset===void 0&&(e.pathSnapping.offset=0)})}function NQ(i){i.scene.publish.mouseEventTarget===void 0&&(i.scene.publish.mouseEventTarget="canvas"),i.scene.publish.settings.web.hint===void 0&&(i.scene.publish.settings.web.hint=!1)}function BQ(i){let{video:t}=i.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function FQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.resetYPosition=Math.abs(n.resetYPosition-e.position[1]))})})}function UQ(i){let t=i.scene.environment.usePhysics;i.scene.objects.traverse((e,n)=>{t&&n.physics===null?n.collision=!1:n.collision="visibility"})}function kQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.navmesh=uf.defaultDataThirdPerson.navmesh)})})}function VQ(i){i.scene.styles||(i.scene.styles=rc.defaultData())}function jF(i){i.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function zQ(i){i.scene.environment.ambientLight.occlusion===void 0&&(i.scene.environment.ambientLight.occlusion=!1),i.scene.environment.ambientLight.aoFullRes===void 0&&(i.scene.environment.ambientLight.aoFullRes=!1),i.scene.environment.ambientLight.radius===void 0&&(i.scene.environment.ambientLight.radius=256),i.scene.environment.ambientLight.bias===void 0&&(i.scene.environment.ambientLight.bias=.5),i.scene.environment.ambientLight.aoColor===void 0&&(i.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),zo(i,jF),Vo(i,jF)}function GQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&Object.assign(n.gameActions,{run:new ze})})})}function jQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.keyAssignments=[...n.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}function HF(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function WF(i,t){if(t<1&&(zo(i,BF),Vo(i,BF),i.schema=1),t<2&&(lQ(i),i.schema=2),t<3&&(uQ(i),i.schema=3),t<4&&(dQ(i),i.schema=4),t<5&&(hQ(i),i.schema=5),t<6&&(pQ(i),i.schema=6),t<7&&(fQ(i),i.schema=7),t<8&&(i.schema=8),t<9&&(UF(i),i.schema=9),t<10&&(vQ(i),i.schema=10),t<11&&(bQ(i),i.schema=11),t<12&&(UF(i),i.schema=12),t<13&&(xQ(i),i.schema=13),t<14&&(wQ(i),i.schema=14),t<15&&(EQ(i),i.schema=15),t<16&&(MQ(i),i.schema=16),t<17&&(zo(i,kF),Vo(i,kF),i.schema=17),t<18&&(zo(i,FF),Vo(i,FF),i.schema=18),t<19&&(cQ(i),i.schema=19),t<20&&(_Q(i),AQ(i),i.schema=20),t<21&&(CQ(i),PQ(i),i.schema=21),t<22&&(GF(i),i.schema=22),t<23&&(IQ(i),i.schema=23),t<24&&(OQ(i),i.schema=24),(t<25||i.shared.videos===void 0)&&(SQ(i),t<25&&(i.schema=25)),t<26&&(mQ(i),i.schema=26),t<27&&(gQ(i),i.schema=27),t<28&&(GF(i),i.schema=28),t<29&&(yQ(i),i.schema=29),t<30&&(RQ(i),i.schema=30),t<31&&(DQ(i),i.schema=31),t<33&&(LQ(i),i.schema=33),t<34&&(NQ(i),i.schema=34),t<35&&(BQ(i),i.schema=35),t<36&&(FQ(i),i.schema=36),t<37&&(UQ(i),i.schema=37),t<38&&(zo(i,VF),Vo(i,VF),i.schema=38),t<39&&(kQ(i),i.schema=39),t<40&&(VQ(i),i.schema=40),t<41&&(zQ(i),i.schema=41),t<42&&(GQ(i),i.schema=42),t<43&&(jQ(i),i.schema=43),t<99){zo(i,HF),Vo(i,HF),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=fa);let e=Pr(i.scene.objects),n=i.scene.objects;i.scene.publish.playPage=mu,n.insertBefore(null,null,[{id:mu,data:{...eo.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Wd(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Wd(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...yu.defaultData,...Wd(i.scene.environment,"usePhysics","gravity")},camera:Pr(i.scene.ownerCamera)??eo.defaultData.camera,name:"Scene"},children:[]}]);for(let a of e)a.id!==ic.TRASH_CAN_ID&&n.move(mu,a.fi,a.id);let r=0,s=0;i.shared.penumbraSize&&i.scene.objects.traverse((a,o)=>{o.type==="DirectionalLight"?(o.penumbraSize=i.shared.penumbraSize[Math.min(r,2)],r+=1):o.type==="SpotLight"&&(o.penumbraSize=i.shared.penumbraSize[3+Math.min(s,1)],s+=1),(o.physics===void 0||o.physics===null)&&o.type!=="Instance"&&(o.physics={},Object.assign(o.physics,gu.defaultData)),o.physics!==void 0&&o.physics!==null&&(o.physics.enabled=o.collision??"visibility",delete o.collision)}),i.schema=99}}var qF=F(()=>{"use strict";Hy();_s();b1();qy();an();Xy();mi();Y();f1();M1();JC();x1();n1();y1()});var JF={};kh(JF,{updateAllMaterials:()=>ZF,updateDocumentSchema:()=>sP,updateLibSchema:()=>rJ,updateMaterialSchema:()=>$Q,updateObjectStateRec:()=>hf,updateObjectsSchema:()=>KF,updateTextValues:()=>XQ});function XF(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function HQ(i){i.scene.objects.traverse((t,e)=>{let n=e.geometry;n&&n.type==="PathGeometry"&&(n.extrusion.capType="flat",n.extrusion.bevel=50,n.extrusion.bevelSides=6,n.extrusion.shape.type==="Custom"&&(n.extrusion.shape.shapeQuality="low"))})}function WQ(i){Array.isArray(Pr(i.events))&&i.events?.forEach(t=>{"disabled"in t||(t.disabled=!1),(t.type==="MouseDown"||t.type==="MouseUp"||t.type==="MousePress")&&(t.mode=t.mode||"Object")})}function YF(i){i.rotation=i.rotation.slice(0,3).map(t=>t*df)}function $F(i){YF(i),i.type==="Page"&&YF(i.camera),i.states?.forEach(e=>{e.rotation===void 0||e.rotation===null||(e.rotation=e.rotation.slice(0,3).map(n=>n*df))});let t=i.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*df),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*df),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=df,t.extrusion.twist*=df),i.type==="Mesh"&&i.geometry.type==="TextGeometry"&&(i.geometry.text={textValue:i.geometry.text}),Array.isArray(Pr(i.events))&&i.events?.forEach(e=>{(e.type==="MouseDown"||e.type==="MouseUp"||e.type==="MousePress"||e.type==="KeyDown"||e.type==="KeyUp"||e.type==="KeyPress"||e.type==="Collision"||e.type==="Trigger")&&(e.runMode=e.toggle?"Toggle":"Repeat")})}function qQ(i){i.shared.variables=fi({},st.prototype)}function XQ(i){i.scene.objects.traverse((t,e)=>{})}function YQ(i){let t=Pr(i.shared.variables);i.shared.variables=fi(Object.entries(t??{}).map(([e,n],r)=>({fi:r,id:e,data:n})),ze.prototype)}function $Q(i){let t=i.schema??104;t!==130&&t<130&&(_1(i.asset),i.schema=130)}function hf(i,t){t(i.data);for(let e of i.children)hf(e,t)}function KF(i){let t=i.schema??104;t!==130&&(t<105&&(hf(i.asset,$F),i.schema=105),t<118&&(hf(i.asset,QF),i.schema=118),t<121&&(hf(i.asset,iP),i.schema=121),t<130&&(hf(i.asset,KQ),i.schema=130))}function ZF(i,t){zo(i,t),Vo(i,t),Object.values(i.shared.lib.materials).forEach(e=>t(e.asset))}function _1(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("phong"))}function KQ(i){"materials"in i?i.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&_1(t)}):"material"in i&&i.material!==void 0&&typeof i.material!="string"&&_1(i.material)}function ZQ(i){i.shared.particles=fi({},st.prototype),i.shared.lib&&(i.shared.lib.particles=no.defaultData().particles)}function QQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Particle"&&typeof e.renderMaterial.size=="number"&&Object.assign(e.renderMaterial,{size:[e.renderMaterial.size,e.renderMaterial.size]})})}function JQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Page"&&(e.postprocessing.depthOfField.focusDistance=100,e.postprocessing.depthOfField.focalLength=20,e.postprocessing.depthOfField.bokehScale=5)})}function eJ(i){i.scene.objects.traverse((t,e)=>{Array.isArray(Pr(e.events))!==!1&&e.events?.forEach(n=>{let r=n.runMode;n.type==="MouseDown"||n.type==="MouseUp"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="Collision"||n.type==="Trigger"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode=r??"Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode=r==="Toggle"?"Toggle":"Normal")}):n.type==="MouseHover"||n.type==="MousePress"||n.type==="KeyPress"?n.actions?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")}):n.type==="GameControl"?(delete n.actions,Object.keys(n.gameActions).forEach(a=>{n.gameActions[a]?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),o.type==="Animation"&&(o.runMode="Normal")})})):n.type==="DragDrop"?(delete n.actions,n.dragDropActions?.drag?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")}),n.dragDropActions?.drop?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")})):n.type==="Resize"?(delete n.actions,n.breakpoints?.forEach(s=>{s.actions?.forEach(a=>{(a.type==="Transition"||a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode="Toggle")})})):n.type==="Start"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Once"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}):n.type==="VariableChange"||n.type==="Scroll"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}):n.type==="Conditional"&&(delete n.actions,n.inActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}),n.outActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}))})})}function tJ(i){i.shared.userAPIs=fi({},st.prototype),i.shared.userWebhooks=fi({},st.prototype),i.shared.lib&&(i.shared.lib.userAPIs=no.defaultData().userAPIs,i.shared.lib.userWebhooks=no.defaultData().userWebhooks)}function nJ(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=va.defaultData.settings.videoStatic)}function QF(i){i.timelineAnimations=fi({},st.prototype)}function iP(i){i.pivot=[0,0,0],i.pivotRotation=[0,0,0]}function rJ(i){}function sP(i){let t=i.schema??0;if(t!==130){console.warn("updating from ",t,"to ",130),WF(i,t),t<100&&(i.scene.publish.joystickSizeAndXYOffset===void 0&&(i.scene.publish.joystickSizeAndXYOffset=va.defaultData.joystickSizeAndXYOffset),i.schema=100),t<101&&(zo(i,XF),Vo(i,XF),i.schema=101),t<102&&(HQ(i),i.schema=102),t<104&&(i.shared.catelogs=new st,i.shared.lib=no.defaultData(),i.schema=104),t<105&&(qQ(i),i.scene.objects.traverse((e,n)=>{$F(n)}),i.schema=105);for(let e of Object.values(i.shared.lib.components))KF(e);t<106&&(YQ(i),i.schema=106),t<107&&(i.shared.lib.variables=no.defaultData().variables,i.schema=107),t<109&&(ZQ(i),i.schema=109),t<110&&(QQ(i),i.schema=110),t<111&&(i.scene.objects.traverse((e,n)=>{WQ(n)}),i.schema=111),t<112&&(JQ(i),i.schema=112),t<113&&(eJ(i),i.schema=113),t<114&&(i.scene.publish.settings.web.imageQuality===void 0&&(i.scene.publish.settings.web.imageQuality=70),i.schema=114),t<115&&(tJ(i),i.schema=115),t<116&&(nJ(i),i.schema=116),t<117&&(i.scene.publish.settings.web.pixelRatioMobile===void 0&&(i.scene.publish.settings.web.pixelRatioMobile=0),i.scene.publish.settings.web.pixelRatioDesktop===void 0&&(i.scene.publish.settings.web.pixelRatioDesktop=0),i.schema=117),t<118&&(i.shared.timelineAnimations=fi({},st.prototype),i.scene.objects.traverse((e,n)=>{QF(n)}),i.schema=118),t<119&&(i.scene.publish.settings.videoStatic.format=vu.defaultData.scene.publish.settings.videoStatic.format,i.scene.publish.settings.videoStatic.imageFormat=vu.defaultData.scene.publish.settings.videoStatic.imageFormat,i.schema=119),t<120&&(i.scene.publish.settings.image.colorSpace="display-p3",i.scene.publish.settings.videoStatic.colorSpace="display-p3",i.schema=120),t<121&&(i.scene.objects.traverse((e,n)=>{iP(n),n.type==="Page"&&n.camera!==void 0&&iP(n.camera)}),i.schema=121),t<122&&(delete i.scene.publish.settings.video,i.scene.publish.orbitControls.rotationSpeed=vu.defaultData.scene.publish.orbitControls.rotationSpeed,i.schema=122),t<123&&(i.scene.objects.traverse((e,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=Fo.defaultData)}),i.schema=123),t<124&&(t>=123&&i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=Fo.defaultData.lighting))}),i.schema=124),t<125&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=Fo.defaultData.lightingIntensity)}),i.schema=125),t<126&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...Fo.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Fo.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),i.schema=126),t<127&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),i.schema=127),t<128&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),i.schema=128),t<129&&(i.scene.objects.traverse((e,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=eo.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),i.schema=129),t<130&&(ZF(i,_1),i.schema=130)}}var df,Yy=F(()=>{nP();an();qF();Xy();Hy();mi();w1();qy();m1();df=180/Math.PI});var eU,T1,aP,tU,A1,sc,$y,pf,C1,oP,ff,lP,cP,nU,Ky,uP,ac,P1,rU=F(()=>{"use strict";_s();an();mi();(t=>{function i(e){return!0}t.is=i})(eU||(eU={}));(n=>{n.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]};function t(r,s){return{position:s?.position??r.position,rotation:s?.rotation??r.rotation,scale:s?.scale??r.scale,shear:s?.shear??r.shear}}n.merge=t;function e(r,s){return TS({position:Xs.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:Xs.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&Xs.isEqual(r.shear,s.shear)?void 0:s.shear})}n.diff=e})(T1||(T1={}));(t=>t.defaultData={horizontalConstraint:0,verticalConstraint:0})(aP||(aP={}));(t=>t.defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8})(tU||(tU={}));(t=>t.defaultData={opacity:1,fill:{color:zt.fromHexAndA(Er,1),enabled:!0},stroke:{color:zt.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:zt.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:zt.from0to1([0,0,0,1]),enabled:!1,spread:0}})(A1||(A1={}));(s=>{function i(a,o){return{name:o}}s.newEmpty=i;function t(a,o){if(o===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let u of c)u in l&&u in o&&o[u]!==void 0&&Object.assign(l,{[u]:o[u]});return l}function e(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}function n(a,o){if(o===void 0)return a;let l={...a};return Object.assign(l,T1.merge(l,o)),l=t(l,o),l=e(l,o),l}s.patch=n;function r(a,o){let l,c=[];for(let[u,d]of Object.entries(o))u!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},c.push(l)),l.props[u]=d);return c}s.toOps=r})(sc||(sc={}));(t=>t.defaultData={...T1.defaultData,...aP.defaultData,states:new ze,events:new ze,visible:!0,raycastLock:!1})($y||($y={}));(t=>t.defaultData={...$y.defaultData,...A1.defaultData})(pf||(pf={}));(t=>t.defaultData={cornerRadius:[0,0,0,0]})(C1||(C1={}));(t=>t.defaultData={...pf.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(oP||(oP={}));(t=>t.defaultData={...pf.defaultData,...C1.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(ff||(ff={}));(t=>t.defaultData={...pf.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"})(lP||(lP={}));(t=>t.defaultData={...pf.defaultData,type:"path2d",path:"",name:"Path"})(cP||(cP={}));(t=>{function i(e){return e.type==="ellipse2d"||e.type==="rectangle2d"||e.type==="text2d"||e.type==="vector2d"||e.type==="path2d"}t.is=i})(nU||(nU={}));(t=>t.defaultData={...$y.defaultData,name:"Group",type:"group2d"})(Ky||(Ky={}));(t=>t.defaultData=()=>({...$y.defaultData,...C1.defaultData,...A1.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:zt.fromHexAndA(4737101,1),enabled:!0},stroke:{color:zt.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(uP||(uP={}));(s=>{function i(a){switch(a){case"rectangle2d":return{...ff.defaultData};case"ellipse2d":return{...oP.defaultData};case"text2d":return{...lP.defaultData};case"vector2d":return{...ff.defaultData};case"path2d":return{...cP.defaultData};case"frame2d":return{...uP.defaultData()};case"group2d":return{...Ky.defaultData}}}s.defaultData=i;function t(a){return"width"in a&&"height"in a?[typeof a.width=="number"?a.width*.5:0,typeof a.height=="number"?a.height*.5:0]:[0,0]}s.getPivot=t;function e(a){return a.type==="rectangle2d"||a.type==="ellipse2d"||a.type==="text2d"||a.type==="frame2d"}s.isResizeable=e;function n(a){return a.type==="frame2d"&&a.autoLayout!==void 0}s.isAutoLayoutable=n;function r(a){return a.type==="rectangle2d"||a.type==="frame2d"}s.hasCorners=r})(ac||(ac={}));(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new Ln},e.emptyData=function(){return{type:"scene2d",objects:new Ln}}))(P1||(P1={}))});var iU=F(()=>{"use strict";hF();fF();CC();IC();nP();wC();NF();FC();HC();m1();Yy();eP();f1();n1();OC();Hy();BC();qC();_s();Xy();qy();b1();jC();w1();x1();wF();GC();M1();y1();RC();DC();rU()});function ro(i,t=!1){let e=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},a={},o=i[0].morphTargetsRelative,l=new De,c=0;for(let u=0;u<i.length;++u){let d=i[u],h=0;if(e!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),h++}if(h!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(t){let p;if(e)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(e){let u=0,d=[];for(let h=0;h<i.length;++h){let p=i[h].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+u);u+=i[h].attributes.position.count}l.setIndex(d)}for(let u in s){let d=sU(s[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(let u in a){let d=a[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let h=0;h<d;++h){let p=[];for(let m=0;m<a[u].length;++m)p.push(a[u][m][h]);let f=sU(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(f)}}}return l}function sU(i){let t,e,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=u.itemSize),e!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*e}let a=new t(s),o=new je(a,e,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let d=l/e;for(let h=0,p=u.count;h<p;h++)for(let f=0;f<e;f++){let m=u.getComponent(h,f);o.setComponent(h+d,f,m)}}else a.set(u.array,l);l+=u.count*e}return r!==void 0&&(o.gpuType=r),o}function aU(i,t=1e-4){t=Math.max(t,Number.EPSILON);let e={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,a=0,o=Object.keys(i.attributes),l={},c={},u=[],d=["getX","getY","getZ","getW"],h=["setX","setY","setZ","setW"];for(let v=0,b=o.length;v<b;v++){let x=o[v],S=i.attributes[x];l[x]=new S.constructor(new S.array.constructor(S.count*S.itemSize),S.itemSize,S.normalized);let E=i.morphAttributes[x];E&&(c[x]||(c[x]=[]),E.forEach((M,w)=>{let T=new M.array.constructor(M.count*M.itemSize);c[x][w]=new M.constructor(T,M.itemSize,M.normalized)}))}let p=t*.5,f=Math.log10(1/t),m=Math.pow(10,f),g=p*m;for(let v=0;v<s;v++){let b=n?n.getX(v):v,x="";for(let S=0,E=o.length;S<E;S++){let M=o[S],w=i.getAttribute(M),T=w.itemSize;for(let A=0;A<T;A++)x+=`${~~(w[d[A]](b)*m+g)},`}if(x in e)u.push(e[x]);else{for(let S=0,E=o.length;S<E;S++){let M=o[S],w=i.getAttribute(M),T=i.morphAttributes[M],A=w.itemSize,C=l[M],P=c[M];for(let D=0;D<A;D++){let I=d[D],L=h[D];if(C[L](a,w[I](b)),T)for(let U=0,G=T.length;U<G;U++)P[U][L](a,T[U][I](b))}}e[x]=a,u.push(a),a++}}let y=i.clone();for(let v in i.attributes){let b=l[v];if(y.setAttribute(v,new b.constructor(b.array.slice(0,a*b.itemSize),b.itemSize,b.normalized)),v in c)for(let x=0;x<c[v].length;x++){let S=c[v][x];y.morphAttributes[v][x]=new S.constructor(S.array.slice(0,a*S.itemSize),S.itemSize,S.normalized)}}return y.setIndex(u),y}var mf=F(()=>{Y()});function sJ(i){let t=1/0,e=1/0,n=1/0,r=-1/0,s=-1/0,a=-1/0;for(let u=0;u<i.length;u+=3){let d=i[u],h=i[u+1],p=i[u+2];t=Math.min(t,d),e=Math.min(e,h),n=Math.min(n,p),r=Math.max(r,d),s=Math.max(s,h),a=Math.max(a,p)}let o=r-t,l=s-e,c=a-n;return{width:o,height:l,depth:c}}function aJ(i){let{userData:t,data:e}=i,n=e?.groups,r=e?.attributes??{},s=e?.morphAttributes??{},a=e?.interleavedBuffers,o=e?.arrayBuffers,l=e?.index,c;r.position!==void 0&&Array.isArray(r.position.array)&&(c=sJ(r.position.array));let u={...t===void 0?{}:t.parameters,data:{attributes:r,morphAttributes:s,interleavedBuffers:a,arrayBuffers:o},...c===void 0?{}:c,type:"NonParametricGeometry"};return l!==void 0&&Object.assign(u.data,{index:l}),n!==void 0&&Object.assign(u.data,{groups:n.map(d=>({...d,materialIndex:d.materialIndex??0}))}),u}function lU(i){let t=i.points.length/7,e=new ze;for(let n=0;n<t;n++){let r=n*7,s=i.points[r+0],a=i.points[r+1],o=i.points[r+2],l=i.points[r+3],c=i.points[r+4],u=i.points[r+5],d=i.points[r+6];e.push({fi:n,id:we.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,u]}}})}return{points:e,isClosed:i.isClosed,roundness:i.roundness,shapeHoles:i.shapeHoles?.map(n=>lU(n))??[]}}function dP(i){let{userData:t,uuid:e,...n}=i;if(t===void 0||t.type==="NonParametricGeometry")return aJ(i);if(t.type==="SubdivGeometry"){let a="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new De;if(o?.position===void 0||o?.faceMap===void 0)return null;let u=o.position.array,d=o.faceMap.array,h=n.data.index.array;c.setAttribute("position",new Ve(u,3)),c.setIndex(new Vs(h,1));let p=aU(c),f=[],m=new Array(d[d.length-1]+1).fill(3),g=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(m[d[y]]++,f.push(...new Set(g.slice(3*y,3*y+6))),y+=2):(f.push(...g.slice(3*y,3*y+3)),y++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:m}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...oJ(o.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=t.type,s=t.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:lU(t.shape),type:r}):r==="LatheGeometry"?{...t.parameters,type:r,points:(t?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function oJ(i){return oU.setFromArray(i),oU.getSize(I1),{width:I1.x,height:I1.y,depth:I1.z}}var Ebe,Mbe,_be,Tbe,Abe,oU,I1,cU=F(()=>{an();Y();mf();Ebe=new ne,Mbe=new qe,_be=new Xt,Tbe=new _,Abe=new _,oU=new Bt,I1=new _});var uU=F(()=>{"use strict"});var Rbe,dU=F(()=>{"use strict";an();Yy();Rbe={...zy,updateSchema(i){return(i.schema??0)<130?du(i,sP):(i.schema??0)-130},asyncKeys(){return[]}}});function Xr(i,t=[0,0]){let e=i&&!isNaN(i[0])?i[0]:t[0],n=i&&!isNaN(i[1])?i[1]:t[1];return[e,n]}function ls(i,t,e){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=t??{...$p.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=e??{...Yp.defaultData},o=new hP(n,r,s,a),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}function fU(i,t,e){let n=t;return{id:n,fi:e,data:{id:n,path:i,keyframes:new ze}}}var hU,pU,pP,hP,mU=F(()=>{"use strict";an();_s();(t=>{function i(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"}t.is=i})(hU||(hU={}));(s=>{function i(a,o){let l=[0,0],c=[1,1];if(a?.cubicControls)l=Xr(a.cubicControls.control1,l);else switch(a?.type){case 2:l=[.42,0];break;case 3:l=[0,0];break;case 4:l=[.42,0];break;case 1:l=[.25,.1];break;case 0:l=[0,0];break;case 7:l=[.25,1];break}if(o?.cubicControls)c=Xr(o.cubicControls.control2,c);else switch(o?.type){case 2:c=[1,1];break;case 3:c=[.58,1];break;case 4:c=[.58,1];break;case 1:c=[.25,1];break;case 0:c=[1,1];break;case 7:c=[.5,1];break}return{control1:l,control2:c}}s.getControlsWithDefault=i;function t(a,o){return{id:a,name:o,to:5,properties:new ze}}s.defaultData=t;function e(a){let o=new ze;return a.forEach(({data:l,id:c,fi:u})=>{if(l.type==="light"){let d=fU(["material",`${l.category} lighting`],c,u);o.push(d)}else{let d=fU(["material",l.type],c,u);o.push(d)}}),o}s.createMaterialGroup=e;function n(a){return Object.entries(a).reduce((o,[l,c])=>(typeof c!="string"&&o.push({name:c.name}),o),[])}s.createName=n,s.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:ls(3),duration:1e3},opacity:{value:[0,1],easing:ls(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:ls(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:ls(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:ls(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(pU||(pU={}));pP=["x","y","z"],hP=class{constructor(t=1,e=100,n=10,r=0){this.mass=t,this.stiffness=e,this.damping=n,this.initialVelocity=r,this.m_w0=Math.sqrt(e/t),this.m_zeta=n/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0+-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(t){return this.m_zeta<1?t=Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):t=(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0),1-t}getDuration(){let t=.16666666666666666,e=0,n=0;for(;;)if(e+=t,this.solve(e)===1){if(n++,n>=16)break}else n=0;return e*t*1e3}}});var ft=F(()=>{iU();uU();LF();Yy();dU();mU();M1();an()});function gU(i){for(let t of lJ)i.enable(t)}var lJ,cs,gf,yU,Go=F(()=>{lJ=[3,4,8,9];cs=5,gf=3,yU=32});var jo,yf=F(()=>{"use strict";Y();jo=i=>{var t;return t=class extends i{},t.geometryHelper=new ni(30,30,30),t}});var R1,fP,vU,Ho,vf=F(()=>{"use strict";Y();R1=new Wi,fP=new nr,vU=new ne,Ho=(i,t,e,n,r=!1,s=i)=>{let a=t,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),fP.copy(a.boundingSphere),fP.applyMatrix4(o),e.ray.intersectsSphere(fP)===!1||(vU.copy(o).invert(),R1.copy(e.ray).applyMatrix4(vU),a.boundingBox!==null&&R1.intersectsBox(a.boundingBox)===!1))return;let l,c,u,d,h=a.index,p=a.attributes.position,f=a.drawRange,m,g;if(r===!1){let v=Math.max(0,f.start),b=Math.min(h.count,f.start+f.count);for(m=v,g=b;m<g;m+=3)if(c=h.getX(m),u=h.getX(m+1),d=h.getX(m+2),l=y(i,e,R1,p,c,u,d),l){l.faceIndex=Math.floor(m/3),n.push(l);return}}else{let b=a.attributes.position,x=new _,S=new _,E=new _,M=new _,w=2,A=1/((s.scale.x+s.scale.y+s.scale.z)/3),C=A*A,P=Math.max(0,f.start),D=Math.min(b.count,f.start+f.count);for(let I=P,L=D-1;I<L;I+=w){if(x.fromBufferAttribute(b,I),S.fromBufferAttribute(b,I+1),R1.distanceSqToSegment(x,S,M,E)>C)continue;M.applyMatrix4(s.matrixWorld);let G=e.ray.origin.distanceTo(M);G<e.near||G>e.far||n.push({distance:G,point:E.clone().applyMatrix4(s.matrixWorld),object:i})}}function y(v,b,x,S,E,M,w){let T=new _,A=new _,C=new _,P=new _,D=new _;if(T.fromBufferAttribute(S,E),A.fromBufferAttribute(S,M),C.fromBufferAttribute(S,w),x.intersectTriangle(T,A,C,!1,P)===null)return null;D.copy(P),D.applyMatrix4(v.matrixWorld);let L=b.ray.origin.distanceTo(D);return L<b.near||L>b.far?null:{faceIndex:1,distance:L,point:D.clone(),object:v}}}});var cJ,bU,uJ,xU,ba,Zy=F(()=>{"use strict";Y();yf();vf();cJ=new _(1,1,1),bU=new _,uJ=new _,xU=new qe,ba=class extends jo(my){constructor(e,n=15){super(n);this.object=e;this.dummy=new Us;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,n){Ho(this.object,ba.geometryHelper,e,n,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(bU,xU,uJ),this.matrix.compose(bU,xU,cJ),super.updateMatrixWorld(e)}updateWorldMatrix(e,n){}}});var qd,Xd,bu,wU,dJ,hJ,SU,Qy,EU=F(()=>{"use strict";Y();qd=new _,Xd=new _,bu=new ne,wU=[new _(-1,1,1),new _(-1,-1,1),new _(1,-1,1),new _(1,1,1),new _(-1,1,-1),new _(-1,-1,-1),new _(1,-1,-1),new _(1,1,-1)],dJ=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],hJ=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],SU=(i,t,e)=>{i.updateEntityBoxSize(qd,Xd),bu.copy(t).multiply(i.matrixWorld),Xd.x===0&&Xd.y===0&&Xd.z===0?e.push(new _(qd.x,qd.y,qd.z).applyMatrix4(bu)):wU.forEach(n=>{e.push(n.clone().multiply(Xd).add(qd).applyMatrix4(bu))})},Qy=class extends Bt{constructor(){super(...arguments);this.matrix=new ne;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(n=>n.clone()),this.faces=e.faces.map(n=>n.clone()),this.edges=e.edges.map(n=>n.clone()),this.centerEdges=e.centerEdges.map(n=>n.clone()),this}setFromObjectSize(e,n=!1){e.updateWorldMatrix(!1,n),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let r=new ne().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,n)}expandByObjectSize(e,n,r=!1){let s=[];if(r===!0){let a=[];e.traverseEntity(o=>{if(o.visible||o.cloner&&o.data.visible){if(!("geometry"in o)){bu.copy(n).multiply(o.matrixWorld),a.push(new _().applyMatrix4(bu));return}SU(o,n,s)}}),s.length===0&&s.push(...a)}else SU(e,n,s);return this.setFromPoints(s)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(bu.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(Xd).multiplyScalar(.5),this.getCenter(qd),bu.copy(this.matrix).setPosition(qd),this.vertices=wU.map(e=>e.clone().multiply(Xd).applyMatrix4(bu))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=dJ.map(([e,n])=>new ri(this.vertices[e],this.vertices[n])),this.centerEdges=this.edges.map(e=>e.getCenter(new _))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=hJ.map(([e,n])=>this.vertices[e].clone().add(this.vertices[n]).multiplyScalar(.5))}}});var xa,Jy=F(()=>{"use strict";xa={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function xu(i){return i?.isParticleSystem===!0}function io(i){return i?.isHairSystem===!0}function Ts(i){return i?.isShapeBlendEntity===!0}function bf(i){return i?.isPathObject===!0}function Ir(i){return i?.isObject2D===!0}function vr(i){return i?.isUIObject===!0}function MU(i){return typeof i=="object"&&i!==null&&"booleanOp"in i}function oc(i){return i?.isCloner===!0}function Wo(i){return i?.isClone===!0}function xf(i){return i?.isComponentObject===!0}var fr=F(()=>{});function _t(i){TU.add(i)}function AU(i){return TU.has(i)}function Jn(i,t){let e=`${i}:${t}`;_U.has(e)||_U.add(e)}function Yd(i,t){CU.set(i,t)}function D1(i){return CU.get(i)}function Sa(i,t){PU.set(i,t)}function L1(i){return PU.get(i)}function ev(i,t){IU.set(i,t)}function N1(i){return IU.get(i)}function OU(i){gP=i,mP!==null&&i.setHanaUIWasmUrl(mP)}function RU(i){mP=i,gP?.setHanaUIWasmUrl(i)}function tv(){return gP}var TU,_U,CU,PU,IU,gP,mP,Qt=F(()=>{TU=new Set;_U=new Set;CU=new Map,PU=new Map;IU=new Map;gP=null,mP=null});function DU(i){let t=i.elements;qo.set(t[0],t[1],t[2]),Xo.set(t[4],t[5],t[6]),lc.set(t[8],t[9],t[10])}function fJ(i,t){i.set(1,0,0).cross(t),i.lengthSq()<=F1&&i.set(0,1,0).cross(t),i.normalize()}function LU(){let i=Math.max(qo.lengthSq(),Xo.lengthSq(),lc.lengthSq());qo.lengthSq()>F1*i?wa.copy(qo).normalize():wa.set(1,0,0),Ea.crossVectors(lc,wa),Ea.lengthSq()<=F1*i&&(Ea.copy(Xo).addScaledVector(wa,-Xo.dot(wa)),Ea.lengthSq()<=F1*i&&fJ(Ea,wa)),Ea.normalize(),Sf.crossVectors(wa,Ea)}function mJ(){let i=qo.length(),t=Xo.length(),e=lc.length(),n=Math.max(i,t,e);if(n-i>B1||n-t>B1||n-e>B1)return!0;let r=B1*n*n;return Math.abs(qo.dot(Xo))>r||Math.abs(qo.dot(lc))>r||Math.abs(Xo.dot(lc))>r}function NU(i,t,e){return DU(i),LU(),t.makeBasis(wa,Ea,Sf),e.set(wa.dot(qo),wa.dot(Xo),wa.dot(lc),0,Ea.dot(qo),Ea.dot(Xo),Ea.dot(lc),0,Sf.dot(qo),Sf.dot(Xo),Sf.dot(lc),0,0,0,0,1),mJ()}function yP(i){return DU(i),LU(),pJ.makeBasis(wa,Ea,Sf)}var qo,Xo,lc,wa,Ea,Sf,pJ,F1,B1,vP=F(()=>{"use strict";Y();qo=new _,Xo=new _,lc=new _,wa=new _,Ea=new _,Sf=new _,pJ=new ne,F1=1e-12,B1=.01});var bP,cc,wf,Ef=F(()=>{"use strict";Y();vP();bP=new ne;(t=>{function i(e){return e&&e.__isSPEObject}t.is=i})(cc||(cc={}));wf=i=>class extends i{constructor(){super(...arguments);this.previousModelViewMatrix=new ne;this.copyPreviousMatrix=!0;this.hiddenMatrix=new ne;this.pivotMatrix=new ne;this.matrixWorldRigid=new ne;this.shearScale=new ne;this.shearScaleInv=new ne}get __isSPEObject(){return!0}getPhysicsLocalMatrix(n){return this.rigidBody?.isDynamic()?(n.copy(this.matrixWorld),this.hasNonUniformScale&&n.multiply(this.shearScaleInv),this.parent&&n.premultiply(bP.copy(this.parent.matrixWorld).invert()),n.premultiply(bP.copy(this.hiddenMatrix).invert()),n.multiply(bP.copy(this.pivotMatrix).invert()),!0):!1}isDescendantOf(n){n instanceof Zt&&(n=n.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===n)return!0;r=r.parent}return!1}updateMatrixWorld(n){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,n=!0);for(let r of this.children)r.updateMatrixWorld(n)}updateWorldMatrix(n,r){let s=this.parent;if(n&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),r)for(let a of this.children)a.updateWorldMatrix(!1,!0)}traverseChildren(n,r=0){for(let s of this.children)cc.is(s)&&s.traverseObject(n,r+1)}traverseObject(n,r=0){if(n(this,r)!==!0)for(let a of this.children)cc.is(a)&&a.traverseObject(n,r+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=NU(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(n,r){this.updateWorldMatrix(!0,!1);let s=new ne().copy(this.matrixWorld).invert();return n.parent!==null&&(n.parent.updateWorldMatrix(!0,!1),s.multiply(n.parent.matrixWorld)),"hiddenMatrix"in n&&n.hiddenMatrix instanceof ne?n.hiddenMatrix.premultiply(s):n.applyMatrix4(s),n.updateWorldMatrix(!1,!1),this.add(n),r!==void 0&&(this.children.pop(),this.children.splice(r,0,n)),this}copy(n,r=!1){return super.copy(n,r),this.hasNonUniformScale=n.hasNonUniformScale,this}onAfterRender(n,r,s,a,o,l){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function UU(i,t,e){return $d.subVectors(t,i),k1.subVectors(t,e),$d.cross(k1).length()<=U1}function V1(i){let t=kU.get(i.points);if(t!==void 0&&t.isClosed===i.isClosed)return t.curve;let e=gJ(i);return kU.set(i.points,{isClosed:i.isClosed,curve:e}),e}function gJ(i){let t=i.points,e=[t[0]],n=[new _(...t[0].data.position)];Mf.copy(n[0]);for(let f=0;f<t.length-1;f++)$d.fromArray(t[f].data.position),k1.fromArray(t[f+1].data.position),nv.subVectors($d,Mf),rv.subVectors($d,k1),nv.cross(rv).length()>U1&&(e.push(t[f]),n.push(new _().copy($d)),Mf.copy($d));let r=t[t.length-1];e.push(r),n.push(new _(...r.data.position));let s=i.isClosed,a=e.length-(s?0:1),o=e.length,l=[],c=[];for(let f=0;f<o;f++){let m=e[f].data;l.push(new _(...m.controlPrevious.position)),c.push(new _(...m.controlNext.position))}let u=[];for(let f=0;f<a;f++){let m=f===o-1?0:f+1;u.push(UU(n[f],c[f],n[m])&&UU(n[f],l[m],n[m]))}let d=[];for(let f=0;f<o;f++){let m=e[f].data,g=n[f],y={position:g,prevDir:void 0,nextDir:void 0,controlPrevious:l[f],controlNext:c[f],tan:void 0,baseRoundness:m.roundness,removedLength:0};if(d.push(y),m.roundness===0||!s&&(f===0||f===o-1))continue;let v=s&&f==0?o-1:f-1,b=s&&f==o-1?0:f+1,x=new _().subVectors(n[v],g).normalize(),S=new _().subVectors(n[b],g).normalize();y.prevDir=x,y.nextDir=S;let E=u[s&&f===0?o-1:f-1],M=u[f];if(E&&M){_f.addVectors(x,S).normalize();let w=Mf.crossVectors(_f,x).length()/x.dot(_f);y.tan=w,y.removedLength=m.roundness/w}}for(let f=0;f<a;f++){let m=f,g=s&&f===o-1?0:f+1,y=d[m],v=d[g];if(y.removedLength!==0||v.removedLength!==0){let b=y.position.distanceTo(v.position);y.removedLength=Math.min(y.removedLength,b/2),v.removedLength=Math.min(v.removedLength,b/2)}}let h=new Array(2*o).fill(null);for(let f=0;f<a;f++){let m=f,g=s&&f===o-1?0:f+1,y=d[m],v=d[g],b=null;if(!u[f])y.position.distanceTo(v.position)>U1&&(b=new Qc(y.position,y.controlNext,v.controlPrevious,v.position));else{let x=y.position.clone(),S=v.position.clone();(y.removedLength!==0||v.removedLength!==0)&&(y.nextDir&&x.add(Mf.copy(y.nextDir).setLength(y.removedLength)),v.prevDir&&S.add(Mf.copy(v.prevDir).setLength(v.removedLength))),x.distanceTo(S)>U1&&(b=new Qc(x,x.clone().lerp(S,.3),S.clone().lerp(x,.3),S))}h[2*f+1]=b}for(let f=0;f<o;f++){let m=d[f];if(m.removedLength===0)continue;let g=m.position,y=m.prevDir.clone().multiplyScalar(m.removedLength).add(g),v=m.nextDir.clone().multiplyScalar(m.removedLength).add(g),b=m.tan*m.removedLength;_f.addVectors(m.prevDir,m.nextDir).normalize(),nv.copy(y).lerp(v,.5);let x=y.distanceTo(v)/2;FU.copy(_f).multiplyScalar(Math.sqrt(Math.pow(b,2)-Math.pow(x,2))).add(nv),xP.copy(_f).multiplyScalar(-b).add(FU);let S=g.distanceTo(xP)/g.distanceTo(nv);rv.copy(m.prevDir).multiplyScalar(S*g.distanceTo(y)).add(g),BU.copy(rv).lerp(xP,2);let E=y.clone().lerp(rv,4/3),M=v.clone().lerp(BU,4/3);h[2*f]=new Qc(y,E,M,v)}let p=new SP;for(let f=0;f<h.length;f++){let m=h[f];m&&p.add(m)}return p}var SP,U1,$d,k1,Mf,_f,nv,xP,rv,BU,FU,kU,wP=F(()=>{"use strict";Y();SP=class extends dp{constructor(){super()}getPoints(t=12){let e=[],n,r=this.getCurveLengths(),a=r[r.length-1]/r.length;for(let o=0,l=this.curves;o<l.length;o++){let c=l[o],u=o===0?r[o]:r[o]-r[o-1],d=Math.ceil(t*u/a),h=c.getPoints(d);for(let p=0;p<h.length;p++){let f=h[p];n&&n.equals(f)||(e.push(f),n=f)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}},U1=.001,$d=new _,k1=new _,Mf=new _,_f=new _,nv=new _,xP=new _,rv=new _,BU=new _,FU=new _;kU=new WeakMap});var Dt,Yo,yJ,vJ,iv,VU,EP,MP,bJ,zU,GU,Tf,Yi=F(()=>{"use strict";Y();ft();EU();an();Jy();fr();Qt();Ef();wP();hn();(t=>{function i(e){return e&&e.__isEntity}t.is=i})(Dt||(Dt={}));Yo=i=>Dt.is(i),yJ={type:"completeState",isfromEntity:!0},vJ=["x","y","z"],iv=new _,VU=new _(1,1,1),EP=new qe,MP=new Xt,bJ=new _().set(0,1,0),zU=new ne,GU=new ne,Tf=i=>class extends wf(i){constructor(){super(...arguments);this.raycastLock=!1;this.scaleLock=!1;this.disposed=!1;this.stateSelection=null;this.destroyedInAction=!1;this.instances=[];this.prevState=null;this.currentState=null;this.currentAnimationAction=null;this.reversibleToState=null;this.currentTransitionEvent=null;this.previousAction=null;this._singleBBox=new Qy;this._recursiveBBox=new Qy;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this._needApplyPathSnapping=!0;this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(n){let r=this.children[n];if(Dt.is(r))return r}entityChildrenCount(){let n=this.children.length;for(;n--;)if(Dt.is(this.children[n]))return n+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let n=this;for(;n.data.type!=="Instance";){let r=n.parent;if(Dt.is(r))n=r;else return}return n}forInstancesRec(n){this.instances.forEach(r=>{r.disposed||n(r),r.forInstancesRec(n)})}super_Entity(n,r){typeof n=="string"&&(this.uuid=n),this.identity=n,this.data=r,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(n,r,s=!1){if(!(this.data.states.length===0&&!s)){for(let a of this.data.states)to.toOps(this.data,a.data).forEach(l=>{let c=Hp.replaceProps(l,this.data);this.dataPatched=this.data,this.updateByPatchedOp(c,this.data,r)});if(n!==null){let a=this.data.states.data(n);a&&(this.dataPatched=to.patch(this.data,a),to.toOps(this.data,a).forEach(l=>{this.updateByPatchedOp(l,this.dataPatched,r)}))}s&&this.updateTransformState(this.dataPatched,r),this.stateSelection=n,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(n,r){n.setScalar(0),r.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(n=>{Yo(n)&&n.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(n=>{n.resetBBoxNeedsUpdateSelf()})}find(n){let r;return this.traverseEntity(s=>{s.uuid===n&&(r=s)}),r}traverseSortNextHelper(){let n=this.parent;if(n){let r=n.children,s=r.indexOf(this)+1;if(Dt.is(r[s]))return r[s];if(Dt.is(n))return n.traverseSortNextHelper()}}sortNext(){let n=this.children;return this.children.length>0&&Dt.is(this.children[0])?n[0]:this.traverseSortNextHelper()}goUp(n){let r=this;for(;n>0&&r!==null;)r=r.parent,n-=1;return r}hasAnccestorOrSelf(n){return this===n||this.hasAnccestor(n)}hasAnccestor(n){let r=this.parent;for(;r;){if(n===r)return!0;r=r.parent}return!1}countToAccestor(n){let r=0,s=this;for(;s!==n;){if(s===null)return-1;s=s.parent,r+=1}return r}forEachEntity(n){for(let r of this.children)Yo(r)&&n(r)}traverseEntityAncestors(n){this.traverseAncestors(r=>{Dt.is(r)&&n(r)})}traverseConcreteEntity(n,r=0){if(n(this,r)!==!0)for(let a of this.children)Yo(a)&&a.isConcreteEntity&&a.traverseEntity(n,r+1)}traverseEntity(n,r=0){if(n(this,r)!==!0)for(let a of this.children)Yo(a)&&a.traverseEntity(n,r+1)}traverseVisibleEntity(n){n(this);for(let r of this.children)Yo(r)&&r.visible&&r.traverseVisibleEntity(n)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(n){super.updateMatrixWorld(n),this.dispatchEvent({type:"updateMatrixWorld"})}copy(n,r=!1){return super.copy(n,r),this.dataPatched=n.dataPatched,this.raycastLock=n.raycastLock,this.scaleLock=n.scaleLock,this.hiddenMatrix.copy(n.hiddenMatrix),this}hasEntityChild(){return this.children.some(n=>Yo(n))}isAncestorOf(n){if(this.uuid===n)return!1;let r=!1;return this.traverseEntity(s=>{s.uuid===n&&(r=!0)}),r}toObjectTransformState(n=[]){this.updateWorldMatrix(!0,!1);let r={position:this.position.toArray(),rotation:[this.rotation.x*we.RAD2DEG,this.rotation.y*we.RAD2DEG,this.rotation.z*we.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return Ny(r,n)}getTransformValues(n,r,s){return r[n].map((a,o)=>s?.shared.getVariable(a,[this.uuid,n,vJ[o]])??a)}updateTransformState(n,r){let s=!1;if(n.position&&(this.position.fromArray(this.getTransformValues("position",n,r)),s=!0),n.rotation&&(iv.fromArray(this.getTransformValues("rotation",n,r)).multiplyScalar(we.DEG2RAD),this.rotation.setFromVector3(iv),s=!0),n.scale&&(this.scale.fromArray(this.getTransformValues("scale",n,r)),s=!0),n.hiddenMatrix!==void 0&&(s=!0,this.hiddenMatrix.fromArray(n.hiddenMatrix??No.identity)),n.pivot!==void 0||n.pivotRotation!==void 0){if(s=!0,n.pivot!==void 0&&n.pivotRotation!==void 0)this.pivotMatrix.compose(iv.fromArray(n.pivot).negate(),EP.setFromEuler(MP.fromArray(n.pivotRotation.map(a=>a*we.DEG2RAD))).invert(),VU);else if(n.pivot!==void 0)this.pivotMatrix.setPosition(-n.pivot[0],-n.pivot[1],-n.pivot[2]);else if(n.pivotRotation!==void 0){let a=iv.setFromMatrixPosition(this.pivotMatrix);EP.setFromEuler(MP.fromArray(n.pivotRotation.map(o=>o*we.DEG2RAD))).invert(),this.pivotMatrix.compose(a,EP,VU)}}return s&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(a=>{a.invalidateClonerTransform(this)})),n.position&&n.rotation&&n.scale&&n.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),s}onVariableUpdate(n=!1){if(n){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)}),this.requestRender()}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let n of this.children)Dt.is(n)&&n.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(n=>{Dt.is(n)&&n.disposeRecursively()})}toState(n=[]){let r={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(n)};return Ny(r,n)}updateByObjUpdateOp(n,r){n!==void 0&&this.updateByOp({type:0,props:n,path:[]},{...this.data,...n},r,!1)}updateByOp(n,r,s,a){let o=this.data;this.data=r;let l=n,c=$t(n.path,["states","*"]);if(c!==null){if(n.type===0){let[u]=c;if(this?.stateSelection===u){let d={...n.props};if(delete d.name,Object.values(n.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let p=rr.zoom(h,n.path.slice(2));if(p)for(let f in n.props)n.props[f]===void 0&&f in p&&(d[f]=p[f])}}l={...n,props:d,path:n.path.slice(2)}}}}else if(n.type===0){let u=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(u!==void 0){if(n.props.name!==void 0&&u.name){let{name:h,...p}=u;u=p}if(n.props.material!==void 0&&"material"in u){let{material:h,...p}=u;u=p}let d=rr.removeOverridden(n.path,n.props,u);l={...n,props:d}}}if(this.updateByPatchedOpBase(l,to.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),s),$t(n.path,["overrides"])){let u=[],d=[...n.path];for(u.push(d[1]),d.splice(0,2);d.length>0&&d[0]==="descendants";)u.push(d[1]),d.splice(0,2);if(u[u.length-1]===void 0){if(n.type===0)for(let h of Object.keys(n.props)){u[u.length-1]=h;let p=s.scene.findInstance([this.uuid,...u]);p&&(p.overrideData=n.props[h],p.updateState(Do.apply(p.component.data,p.overrideData),s))}}else{let h=s.scene.findInstance([this.uuid,...u]);if(h){let p=rr.zoom(h.component.data,d);if(n={...n,path:d},n.type===0){let f=n.props;if(p)for(let[m,g]of Object.entries(n.props))g===void 0&&(f===n.props&&(f={...n.props}),f[m]=p[m]);n={...n,props:f}}h.overrideData=af.resolve(r.overrides,u),h.updateByOp(n,wr.applySimple(h.data,n),s,!1)}}}else if(this.instances.length>0){let u;if(n.path.length===0&&n.type===0){let d;for(let h of ya.rootOverrideProps)h in n.props&&(d===void 0&&(d={}),d[h]=n.props[h]);d&&(u={...n,props:d})}else for(let d of ya.rootOverrideProps)if($t(n.path,[d])){u=n;break}u!==void 0&&this.instances.forEach(d=>{if(d.isInstanceRoot){let h=Do.filterOp(d.overrideData,u);h&&d.updateByOp(h,wr.applySimple(d.data,h),s,!0)}}),this.instances.forEach(d=>{if(!d.isInstanceRoot){let h=Do.filterOp(d.overrideData,n);if(h){let p;o===d.data&&n===h?p=r:p=wr.applySimple(d.data,h),d.updateByOp(h,p,s,!0)}}})}}updateByPatchedOpBase(n,r,s){if(this.dataPatched=r,n.path.length===0&&n.type===0)n.props.type!==void 0&&!Qa.is(n.props.type)&&xa.changeEntityProptotype(this,r,s);else if(n.path.length===1&&n.path[0]==="geometry"&&n.type===0&&"type"in n.props){xa.changeEntityProptotype(this,r,s);for(let a of this.children)Dt.is(a)&&a.updateVisible(s.scene)}this.updateByPatchedOp(n,r,s)}updateByPatchedOp(n,r,s){if(n.path.length===0&&n.type===0?this.updateState(n.props,s):n.type===0&&("resolutionLevel"in n.props||"useChildrenColors"in n.props)&&this.updateState(r,s),n.path[0]==="morphTargetInfluences"&&n.type===0){let o=r.morphTargetInfluences.get(n.path[1])?.data.name;o&&this.updateMorphInfluences(o,s.shared.getVariable(n.props.value,[this.uuid,"morphTargetInfluences",o]))}if($t(n.path,["pathSnapping"])!==null&&this.updatePathSnapping(r.pathSnapping),$t(n.path,["cloner"])!==null){let a=wr.drop(n,1);a.path.length===0&&a.type===0&&a.props.disabled===!0?this.setFromClonerState(null,s):this.cloner?this.cloner.updateState(r.cloner,s):(this.setFromClonerState(r.cloner,s),this.expandCloner(s)),this.updateVisible(s.scene)}}updatePathSnapping(n=this.dataPatched.pathSnapping){this._updatedPathSnapping=n,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(n){if(this._needApplyPathSnapping===!1)return;let r=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,s=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,a=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,o=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(r===null)return;let l=n.find(r);if(!l)return;this._needApplyPathSnapping=!1;let c=l.data;if(c.geometry.path.points.length<=1)return;let u=V1(c.geometry.path),d=(s+a)%1;s+a===1&&d===0&&(d=1);let h=null;try{h=u.curves.length?u.getPointAt(d):null}catch(m){!1&&(console.warn(`The aligned path on ${this.name} is invalid. (${l.name})`),console.error(m))}if(h===null)return;l.updateMatrixWorld();let p=this.parent?zU.copy(this.parent.matrixWorld).invert():zU.identity();p.multiply(l.matrixWorld),h.applyMatrix4(p);let f={position:h.toArray(),rotation:c.rotation};if(o==="tangential"){let m=GU.extractRotation(l.matrixWorld),g=u.getTangentAt(d).applyMatrix4(m).add(h),y=GU.lookAt(h,g,bJ),v=iv.setFromEuler(MP.setFromRotationMatrix(y)).multiplyScalar(we.RAD2DEG);f={...f,rotation:v.toArray()}}this.updateTransformState(f),this.traverseEntity(m=>{m._cameraType&&m.dispatchEvent(yJ)})}updateVisible(n){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!n)return;let r=!1;this.traverseEntity(s=>{if(s.data.type==="Splat")return r=!0,!0}),r&&n.reloadSplats()}updateState_Entity(n,r){n.name!==void 0&&(this.name=n.name),n.raycastLock!==void 0&&(this.raycastLock=n.raycastLock),n.visible!==void 0&&(this.updateVisible(r?.scene),this.resetBBoxNeedsUpdate()),r&&"cloner"in n&&n.cloner!==void 0&&(this.setFromClonerState(n.cloner,r),this.updateVisible(r.scene)),this.updateTransformState(n,r)}get attachedSurfaceCloners(){return this.children.filter(n=>oc(n)&&n.parameters.type==="toObject")}setFromClonerState(n,r){if(!this.disposed)if(n===null||n.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(xa.Cloner===null){Jn("cloners","a cloner");return}this.cloner=new xa.Cloner(this,n),r.scene.addPendingExpandCloner(this)}else this.cloner.updateState(n,r)}expandCloner(n){!this.disposed&&this.cloner&&this.cloner.expandClones(n)}invalidateClonerTransform(n){this.cloner&&this.cloner.invalidateTransform(n)}requestRender(){this.dispatchEvent({type:"requestRender"})}}});var z1,Ma,Su=F(()=>{"use strict";Y();Yi();(t=>t.is=e=>"objectHelper"in e)(z1||(z1={}));Ma=(i,t)=>class extends Tf(i){constructor(){super(...arguments);this.objectHelper=new t(this);this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(r,s){this.objectHelper.raycast(r,s)}showGizmos(){for(let r in this.gizmos){let s=this.gizmos[r];s instanceof $l&&(s.visible=!0)}}updateEntityBoxSize(r,s){this.objectHelper.visible&&this.geometryHelper instanceof ni?(r.setScalar(0),s.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(r,s)}hideGizmos(){for(let r in this.gizmos){let s=this.gizmos[r];s instanceof $l&&(s.visible=!1)}}}});var us,sv=F(()=>{"use strict";Y();Zy();Su();us=class extends Ma(Us,ba){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function so(i,t,e,n,r,s,a){G1.set(r,s,a).unproject(n);let o=t[i];if(o!==void 0){let l=e.getAttribute("position");for(let c=0,u=o.length;c<u;c++)l.setXYZ(o[c],G1.x,G1.y,G1.z)}}var G1,_a,_P,j1,jU=F(()=>{"use strict";Y();yf();vf();G1=new _,_a=new ws,_P=class extends zl{constructor(e){let n=new De,r=new zs({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],a=[],o={},l=new Ze(15711266),c=new Ze(15711266),u=new Ze(2857471);d("n1","n2",l),d("n2","n4",l),d("n4","n3",l),d("n3","n1",l),d("f1","f2",l),d("f2","f4",l),d("f4","f3",l),d("f3","f1",l),d("n1","f1",l),d("n2","f2",l),d("n3","f3",l),d("n4","f4",l),d("p","n1",c),d("p","n2",c),d("p","n3",c),d("p","n4",c),d("u1","u2",u),d("u2","u3",u),d("u3","u1",u);function d(p,f,m){h(p,m),h(f,m)}function h(p,f){s.push(0,0,0),a.push(f.r,f.g,f.b),o[p]===void 0&&(o[p]=[]),o[p].push(s.length/3-1)}n.setAttribute("position",new Ve(s,3)),n.setAttribute("color",new Ve(a,3));super(n,r);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){let e=this.geometry,n=this.pointMap,r=!0;_a.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,a=1,o=r?.8:1e-4;so("n1",n,e,_a,-s,-a,o),so("n2",n,e,_a,s,-a,o),so("n3",n,e,_a,-s,a,o),so("n4",n,e,_a,s,a,o);let l=o;so("f1",n,e,_a,-s,-a,l),so("f2",n,e,_a,s,-a,l),so("f3",n,e,_a,-s,a,l),so("f4",n,e,_a,s,a,l);let c=l,u=.5;so("u1",n,e,_a,s*.7*u,a*1.1,c),so("u2",n,e,_a,-s*.7*u,a*1.1,c),so("u3",n,e,_a,0,a*(1.1+.9*u),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};j1=class extends jo(_P){constructor(e){super(e);this.object=e;this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,n){Ho(this.object,this.geometry,e,n,!0)}}});function HU(i){return 1-Math.pow(1-i,3)}var H1,Af,TP,AP,CP,av,PP,$o,on,$s=F(()=>{"use strict";Y();jU();ft();Su();hn();H1=790;Af=new _,TP=new _,AP=new qe,CP=new _,av=new _,PP=new _,$o=class extends Ma(ws,j1){constructor(e="",n={...Hd.defaultData,name:""}){super();this._cameraType="OrthographicCamera";this.targetOffset=Ja.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.wasMovedByUser=!1;this.wasMovedBySwitchCameraAction=!1;this._createdAt=typeof performance<"u"?performance.now():0;this._tickProjectionTransition=()=>{let e=this._projectionTransition;if(e===void 0)return;if(this.disposed){this._endProjectionTransition();return}e.raf=requestAnimationFrame(this._tickProjectionTransition);let n=$o.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),n?.()};this.super_Entity(e,n),this.previousProjectionMatrix=new ne,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,s=this.height;this.orthoCamera=new Ya(r*-.5,r*.5,s*.5,s*-.5,-5e4,1e4),this.perspCamera=new Xa(45,r/s,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(e){let n=$o.projectionTransitionsEnabled;$o.projectionTransitionsEnabled=!1;try{return e()}finally{$o.projectionTransitionsEnabled=n}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,n){e==="PerspectiveCamera"?this.perspCamera.near=n:this.orthoCamera.near=n}setZoom(e,n){n>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=n:this.orthoCamera.zoom=n)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,n,r){typeof e=="number"&&(e=new _(e,n,r)),super.lookAt(e),this.getWorldPosition(Af),this.targetOffset=Af.distanceTo(e)}getTarget(e=new _){return this.getWorldDirection(TP),this.getWorldPosition(Af),TP.multiplyScalar(this.targetOffset),e.copy(Af).add(TP),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Af),Af.distanceTo(e)}updateUp(){this.getWorldQuaternion(AP),CP.set(0,0,1).applyQuaternion(AP),av.copy(Zt.DEFAULT_UP),this.isUpVectorFlipped&&av.negate(),av.applyQuaternion(AP),PP.copy(Zt.DEFAULT_UP).projectOnPlane(CP),this.angleOffsetFromUp=PP.angleTo(av),this.angleOffsetFromUp*=PP.cross(av).dot(CP)>=0?1:-1}updateTransformState(e,n){let r=super.updateTransformState(e,n);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(e){let n=e.getWorldPosition(new _),s=e.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:n.clone().add(s),target:n}}getViewToTarget(e){let r=this.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:e.clone().sub(r),target:e}}getViewToObject(e){let n=new _;return e.getWorldPosition(n),this.getViewToTarget(n)}setViewplaneSize(e,n,r=!1){if(this.aspect=e/n,r){let s=e>n?this.aspect:1,a=e>n?1:this.aspect;this.left=-H1*.5*s,this.right=H1*.5*s,this.top=H1*.5*(1/a),this.bottom=-H1*.5*(1/a)}else this.left=-e*.5,this.right=e*.5,this.top=n*.5,this.bottom=-n*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let e=this._projectionTransition;if(e===void 0)return 1;let n=(performance.now()-e.start)/e.duration;return n>=1?1:n<=0?0:HU(n)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return $o.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=$o.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let n=this._projectionTransition;n===void 0&&(n={from:new ne,blend:new ne,blendInverse:new ne,start:0,duration:$o.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=n),n.from.copy(this.projectionMatrix),n.start=performance.now(),n.duration=$o.projectionTransitionDuration,n.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(n.requestRender=e),n.raf!==0&&cancelAnimationFrame(n.raf),n.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let n=(performance.now()-e.start)/e.duration;if(n>=1){this._endProjectionTransition();return}let r=HU(n),s=e.from.elements,a=this._activeSubCamera.projectionMatrix.elements,o=e.blend.elements,l=e.referenceDepth,c=Math.max(1e-6,s[15]-s[11]*l),u=Math.max(1e-6,a[15]-a[11]*l),d=r*c/(r*c+(1-r)*u);for(let h=0;h<16;h++)o[h]=s[h]+(a[h]-s[h])*d;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let n=this._activeSubCamera;this.projectionMatrix=n.projectionMatrix,this.projectionMatrixInverse=n.projectionMatrixInverse}_syncProjectionTransition(e){let n=e._projectionTransition;if(n===void 0){this._projectionTransition!==void 0&&this._endProjectionTransition();return}let r=this._projectionTransition;r===void 0?(r={from:new ne,blend:new ne,blendInverse:new ne,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):r.raf!==0&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(n.from),r.start=n.start,r.duration=n.duration,r.referenceDepth=n.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,n,r,s,a,o){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,n,r,s,a,o):this.orthoCamera.setViewOffset(e,n,r,s,a,o),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,n){return super.copy(e,n),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=Ja.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){let n={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ny(n,e)}updateCameraSubtype(e,n){let r=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";n.zoom!==void 0&&this.setZoom(r,n.zoom),n.near!==void 0&&this.setNear(r,n.near),n.fov!==void 0&&r==="PerspectiveCamera"&&(this.fov=n.fov)}updateState(e,n){this.updateCameraState(e,n)}updateCameraState(e,n){this.updateState_Entity(e,n),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(n?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(r=>typeof r=="number"?r:0)),e.targetOffset!==void 0&&(this.targetOffset=Ja.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},on=$o;on.projectionTransitionsEnabled=!1,on.projectionTransitionDuration=350,on.projectionTransitionMinAgeMs=1e3});function W1(i){return i.type==="TorusGeometry"&&i.arc===360}var WU,IP,ov,Cf=F(()=>{"use strict";Y();WU=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??n),s=Math.abs(e.depth??n),a=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(e,{width:n,height:r,depth:s,radius:a,segments:Math.round(e.segments),pathSegments:Math.round(e.pathSegments),cornerSegments:Math.round(e.cornerSegments)})}}static build(i){let{width:t,height:e,depth:n,radius:r,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:d}=i.parameters,h=new ov(!1,t,e,n,r,s,a,o,l,c,u,d);return Object.assign(h,{userData:{...i,type:"HelixGeometry"}})}},IP=new Vs([0,0,0],1);ov=class extends De{constructor(t=!0,e=1,n=1,r=1,s=1,a=1,o=1,l=1,c=1,u=1,d=1,h=1){if(super(),a===0)return;let p=t&&a===1;p&&(h=0),d>100&&(d=100),d===0&&(h=0);let f=()=>new _,m=new _,g=f(),y=f(),v=f(),b,x,S,E,M,w,T,A,C=f(),P=f(),D=f(),I=f(),L=f(),U=f(),G=f(),X=f(),ae=n-2*l+.001,ee=ae/a,$=Math.ceil(o*a),K=$+1,re=ae/$,fe=-ae/2,ve=u+1,de=2*Math.PI/u,Se=Math.PI/2/h,oe=.01,be=Math.min((1-d/100)*l,l-oe),Oe=l-be,Le=0,ke=2,Ce=h*ke+ke,ce=ve*Ce/ke,ye=ce+ve*K,Me=Math.max(0,ve*(K+Ce)),[Ne,He,_e]=[3,3,2].map(xe=>Array(Me*xe).fill(0)),Re=[],B=s-l;function me(xe,Fe){let ue=Math.PI/2;w=Fe*re,A=2*Math.PI*(w%ee)/ee+ue,w+=fe,T=Math.sin(A)*B,M=Math.cos(A)*B,t?xe.set(M,T,w):xe.set(M,w,T)}me(m,-1e-10),me(g,0),C.copy(m),me(m,1);let W=m.distanceTo(g),et=p?0:Oe+be,Ge=W*$+2*et,z=be,O=Ge-et;for(let xe=0;xe<=$;xe++){me(y,xe),X.subVectors(y,C).normalize(),C.copy(y),U.copy(y).setComponent(+t+1,0).normalize(),G.crossVectors(X,U).normalize();let Fe=xe===0,ue=xe===$,Te=Fe?3*Math.PI/2:Se,Ke=Fe?z:O,xt=Fe?ve:ye,Je=Fe?0:Me-ve,Xe=X.clone().multiplyScalar(Fe?-Oe:Oe).add(y),rt=X.clone().multiplyScalar(Fe?-1:1).normalize();for(let yt=0;yt<ve;yt++){let kt=yt*de;if(P.addVectors(m.copy(U).multiplyScalar(l*Math.cos(kt)),g.copy(G).multiplyScalar(l*Math.sin(kt))),D.copy(P).normalize(),Fe||ue){p||(Le=Je+yt,[0,1,2].forEach(Z=>{Ne[Le*3+Z]=Xe.getComponent(Z),He[Le*3+Z]=rt.getComponent(Z)}),_e[Le*2]=+ue,_e[Le*2+1]=yt/u),g.copy(D).multiplyScalar(be),v.addVectors(y,g);for(let Z=0;Z<h;Z++){let Ye=Z*Se+Te;I.addVectors(m.copy(X).multiplyScalar(Oe*Math.sin(Ye)),g.copy(D).multiplyScalar(Oe*Math.cos(Ye))),L.copy(I).normalize(),g.addVectors(v,I),I.normalize(),Le=xt+Z*ve+yt,[0,1,2].forEach($e=>{Ne[Le*3+$e]=g.getComponent($e),He[Le*3+$e]=L.getComponent($e)});let Ae=+Fe+Math.sin(Ye);_e[Le*2]=(Ke+Oe*Ae)/Ge,_e[Le*2+1]=yt/u}}g.addVectors(y,P),Le=ce+xe*ve+yt,[0,1,2].forEach(Z=>{Ne[Le*3+Z]=g.getComponent(Z),He[Le*3+Z]=D.getComponent(Z)}),_e[Le*2]=(et+xe*W)/Ge,_e[Le*2+1]=yt/u}}let q=K+2*h+ke,[J,le]=[+p,q-1];for(let xe=J;xe<=le-1;xe++){let Fe=p&&xe===le-1;for(let ue=0;ue<ve-1;ue++)b=xe*ve+ue,x=b+1,S=(Fe?ue:b)+ve,E=(Fe?ue+1:x)+ve,xe===0?Re.push(x,E,S):xe===q-2?Re.push(b,x,S):Re.push(b,x,S,x,E,S)}this.setIndex(Re),this.setAttribute("position",new Ve(Ne,3)),this.setAttribute("normal",new Ve(He,3)),this.setAttribute("uv",new Ve(_e,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t=this.userData.parameters,e=Math.ceil(t.tubularSegments),n=t.radialSegments,r=n+1,s=[],a,o,l,c;for(let u=1;u<e;u++)for(let d=0;d<n;d++)a=u*r+d,o=a+1,l=a+r,c=o+r,s.push(a,o,l,o,c,l);for(let u=0;u<n;u++)a=e*r+u,o=a+1,l=u+r,c=u+1+r,s.push(a,o,l,o,c,l);return IP.array=new Uint32Array(s),IP.count=s.length,IP}}});function XU(i){if(q1)return q1;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.11/build"),s=import("./boolean.js"),[a,o]=await Promise.all([s,fetch(`${n}/boolean.wasm`).then(l=>l.arrayBuffer())]);await a.default({module_or_path:o}),lv=a}return q1=t(),q1}function Y1(){if(lv===void 0)throw new Error("boolean-wasm is not loaded");return lv}function OP(i){let t=X1.get(i);if(t===void 0)throw new Error("Unknown csg mesh set handle "+i);return t}function RP(i){return X1.set(++qU,i),qU}function EJ(i,t){if(t&&i.userData.positions!==void 0){let o=i.userData,l=[];for(let c=0,u=0;c<o.verticesPerFace.length;c++){let d=o.verticesPerFace[c];for(let h=1;h<d-1;h++)l.push(o.indices[u],o.indices[u+h],o.indices[u+h+1]);u+=d}return{positions:o.positions instanceof Float32Array?o.positions:new Float32Array(o.positions),indices:new Uint32Array(l)}}let e;W1(i.userData.parameters)?e=i.getClosedTorusIndicesForBooleanOrSubdiv():e=i.getIndex();let n=i.getAttribute("position"),r;if(e===null){r=new Uint32Array(n.count);for(let o=0;o<r.length;o++)r[o]=o}else e.array instanceof Uint32Array?r=e.array:r=new Uint32Array(e.array);let s=i.getAttribute("normal"),a=s!==void 0&&s.itemSize===3&&s.count===n.count&&s.array instanceof Float32Array&&s.isInterleavedBufferAttribute!==!0?s.array:void 0;return{positions:n.array,indices:r,normals:a}}function YU(i,t,e){if(lv===void 0)return-1;let{positions:n,indices:r,normals:s}=EJ(i,t);return RP(new lv.CsgMesh(n,r,s))}function $U(i,t){let e=Y1(),n=wJ[t];if(n===void 0)throw new Error("Unknown boolean operation "+t);let r=i.map(OP);if(r.length===1)return e.clone_mesh(r[0]);let s=[],a;if(t===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=e.boolean_mesh(o,r[l],0),s.push(o);a=e.boolean_mesh(r[r.length-1],o,2)}else if(t===2)a=e.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=e.boolean_mesh(o,r[l],n),s.push(o),o.tri_count()!==0);l++);a=o,s.pop()}for(let o of s)o.free();return a}function KU(i,t,e,n){let r=Y1(),s=$U(i,t),a=r.mesh_render_data(s,Math.max(n,0));if(e.setAttribute("position",new Ve(a.positions(),3)),e.setAttribute("normal",new Ve(a.normals(),3)),a.free(),e.boundingSphere===null&&(e.boundingSphere=new nr),s.tri_count()===0)e.boundingSphere.center.set(0,0,0),e.boundingSphere.radius=0,e.userData.parameters={width:0,height:0,depth:0};else{let o=s.bounds();e.boundingSphere.center.set(o[0],o[1],o[2]),e.boundingSphere.radius=(o[3]**2+o[4]**2+o[5]**2)**.5,e.userData.parameters={width:o[3]*2,height:o[4]*2,depth:o[5]*2}}return RP(s)}function ZU(i,t){let e=Y1(),n=$U(i,t),r=e.mesh_topological_data(n),s=r.positions(),a=r.indices();r.free(),n.free();let o=new Uint8Array(a.length/3).fill(3);return{positions:s,indices:a,verticesPerFace:o}}function $1(i,t){OP(i).transform(new Float32Array(t.elements))}function K1(i){let t=X1.get(i);t!==void 0&&(t.free(),X1.delete(i))}function QU(i,t){let e=Y1();return RP(e.instanced_union(OP(i),t))}var lv,X1,qU,q1,wJ,cv=F(()=>{Y();Cf();X1=new Map,qU=0;wJ={[0]:0,[1]:1,[2]:2}});function Kd(i){return i!==null&&"booleanOp"in i}var Pf,JU=F(()=>{"use strict";Y();Yi();cv();Pf=class extends Tf(Ht){constructor(){super(...arguments);this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new ne}updateVisible(e){super.updateVisible(e),this.visible=!Kd(this.parent)&&this.visible,Kd(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Kd(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(K1(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Kd(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof Pf&&(e.freeBooleanPointer(),Kd(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,n){let r=super.updateTransformState(e,n);return r&&Kd(this.parent)&&this.invalidateDownstreamBooleanData(!0),r}onVariableUpdate(e=!1){super.onVariableUpdate(e),Kd(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}});function ek(){return MJ}var MJ,tk=F(()=>{"use strict";MJ=null});function uv(i,t=0,e=i.count,n,r){let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,u=-1/0;for(let d=t;d<e;d++){let h=i.getX(d),p=i.getY(d),f=i.getZ(d);h<s&&(s=h),p<a&&(a=p),f<o&&(o=f),h>l&&(l=h),p>c&&(c=p),f>u&&(u=f)}Z1.min.set(s,a,o),Z1.max.set(l,c,u),Z1.getCenter(n),Z1.getSize(r).multiplyScalar(.5)}var Z1,_J,TJ,Kt,gi=F(()=>{"use strict";Y();JU();tk();Z1=new Bt;_J=new De,TJ=new ti,Kt=class extends Pf{constructor(t,e){super(_J,TJ),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let n=ek();if(n!==null){n(this,t,e);return}super.raycast(t,e)}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?uv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}}});function Zd(i){return i?.isClassicNodeMaterial===!0}function nk(i){return i?.isClassicSharedMaterial===!0}var Q1=F(()=>{"use strict"});var yn,Ta=F(()=>{Y();yn=class extends Ze{constructor(e,n,r,s){super(e,n,r);this.isColorA=!0;this.a=s}setRGBA(e,n,r,s){super.setRGB(e,n,r),this.a=s}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,n="srgb"){let r;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(r=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let s,a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.a=a==="rgba"?parseFloat(s[4]):1,super.setStyle(e,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.a=a==="hsla"?parseFloat(s[4]):1,super.setStyle(e,n);break}}return super.setStyle(e,n)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}});var uc,LP=F(()=>{"use strict";Ta();uc=class extends yn{}});var J1,rk=F(()=>{"use strict";J1=class{constructor(t=1e3*10){this.timeout=t;this.cache=new Map;this.head={data:null,time:0,src:null,next:null,prev:null};this.tail={data:null,time:1/0,src:null,next:null,prev:null};this.hasClean=!1;this.cleanupTimer=null;this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let n=e;e=e.next,e.prev=this.head,this.head.next=e,n.next=null,n.prev=null,n.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),n=this.cache.get(t);return n===void 0?(n={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,n)):(n.time=e,n.prev.next=n.next,n.next.prev=n.prev),n.prev=this.tail.prev,n.next=this.tail,this.tail.prev.next=n,this.tail.prev=n,this.scheduleCleanup(),n.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}});function ik(i){return typeof i=="string"?i:(dv||(dv=new NP),dv.load(i))}function sk(){dv&&dv.disposeAll()}var NP,dv,BP=F(()=>{rk();NP=class extends J1{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}});var ew,tw,FP=F(()=>{"use strict";ew=class{constructor(t,e){this.data=t;this.cache=e;this.refCount=0}deref(){if(this.refCount===0&&!1)throw new Error("ref count -1?");this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){if(this.refCount!==0&&!1)throw new Error("ref count is not 0")}},tw=class{constructor(){this.cache=new Map}remove(t){if(this.cache.delete(t.data)===!1&&!1)throw new Error("ref count remove non-exists")}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}});var nw,ak=F(()=>{Y();nw=class extends ry{constructor(t){super(t),this.type=pr}parse(t){let a=function(w,T){switch(w){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:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(T||""))}},u=`
4127
+ })();`});function GZ(i,t){let e=[];for(let n of Object.keys(t))i[n]!==t[n]&&e.push({name:n,value:t[n]});return e}var zZ,kp,nC=F(()=>{"use strict";zZ=100;kp=class{constructor(t,e,n){this.deps=t;this.onConsole=e;this.onEvent=n;this.disposed=!1;this.eventUnsubs=new Map;this.variablePollHandle=null;this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let n=this.deps;switch(t){case"setVariable":{let r=n.setVariable(String(e[0]),e[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=e[0]??{},s=!0;for(let[a,o]of Object.entries(r)){let l=n.setVariable(a,o);l.warning&&this.onConsole("warn",l.warning),s=s&&l.ok}return s}case"getVariable":return n.getVariable(String(e[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(e[0]));case"getGeometry":{let r=n.getGeometry(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return n.updateObject(String(e[0]),e[1]??{});case"createObject":return n.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":{if(n.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(e[0])}case"setMaterial":{if(n.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.setMaterial(String(e[0]),e[1])}case"cloneObject":return n.cloneObject(String(e[0]),e[1]??{});case"removeObject":return n.removeObject(String(e[0]));case"spawnObject":{let r=n.spawnObject(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.object}case"destroyObject":return n.destroyObject(String(e[0]));case"setInstanceTransforms":{let r=e[1]===null||e[1]===void 0?null:e[1],s=n.setInstanceTransforms(String(e[0]),r);return s<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),s}case"emitEvent":case"emitEventReverse":{let r=n.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return r.warning&&this.onConsole("warn",r.warning),r.ok}case"requestRender":return n.requestRender(),!0;case"listenEvent":{let r=String(e[0]);return r==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(r)||this.eventUnsubs.set(r,n.addSplineEventListener(r,s=>{this.onEvent(r,s)})),!0}case"unlistenEvent":{let r=String(e[0]);return r==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(r)?.(),this.eventUnsubs.delete(r)),!0}default:{let r=t;throw new Error(`Unknown spline bridge method: ${r}`)}}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=GZ(this.lastVariables??{},t);this.lastVariables=t;for(let n of e)this.onEvent("variableChange",n)},zZ))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function jZ(i,t,e,n){return[i[0]*t+i[4]*e+i[8]*n+i[12],i[1]*t+i[5]*e+i[9]*n+i[13],i[2]*t+i[6]*e+i[10]*n+i[14]]}function HZ(i){let t=i[0],e=i[4],n=i[8],r=i[1],s=i[5],a=i[9],o=i[2],l=i[6],c=i[10],u=t*(s*c-a*l)-e*(r*c-a*o)+n*(r*l-s*o);if(!isFinite(u)||Math.abs(u)<1e-12)return null;let d=1/u,h=[(s*c-a*l)*d,(n*l-e*c)*d,(e*a-n*s)*d,(a*o-r*c)*d,(t*c-n*o)*d,(n*r-t*a)*d,(r*l-s*o)*d,(e*o-t*l)*d,(t*s-e*r)*d];return[h[0],h[3],h[6],h[1],h[4],h[7],h[2],h[5],h[8]]}function N3(i,t){let e=i?.getAttribute("position");if(!e||!e.count)return null;let n=e.count,r=t??null,s=i.getIndex?.()??null,a=Math.floor((s?s.count:n)/3),o=1/0,l=1/0,c=1/0,u=-1/0,d=-1/0,h=-1/0,p=new Float32Array(n*3);for(let y=0;y<n;y++){let v=e.getX(y),b=e.getY(y),x=e.getZ(y);r&&([v,b,x]=jZ(r,v,b,x)),v<o&&(o=v),b<l&&(l=b),x<c&&(c=x),v>u&&(u=v),b>d&&(d=b),x>h&&(h=x),p[y*3]=v,p[y*3+1]=b,p[y*3+2]=x}let f={space:r?"world":"local",vertexCount:n,triangleCount:a,indexed:s!==null,bounds:{min:[o,l,c],max:[u,d,h],size:[u-o,d-l,h-c]},vertices:p};if(s){let y=new Uint32Array(s.count);for(let v=0;v<s.count;v++)y[v]=s.getX(v);f.indices=y}let m=i.getAttribute("normal");if(m&&m.count===n){let y=r?HZ(r):void 0;if(!r||y){let v=new Float32Array(n*3);for(let b=0;b<n;b++){let x=m.getX(b),S=m.getY(b),E=m.getZ(b);if(y){let M=y[0]*x+y[1]*S+y[2]*E,w=y[3]*x+y[4]*S+y[5]*E,T=y[6]*x+y[7]*S+y[8]*E,A=Math.hypot(M,w,T);A>1e-12?(x=M/A,S=w/A,E=T/A):(x=M,S=w,E=T)}v[b*3]=x,v[b*3+1]=S,v[b*3+2]=E}f.normals=v}}let g=i.getAttribute("uv");if(g&&g.count===n){let y=new Float32Array(n*2);for(let v=0;v<n;v++)y[v*2]=g.getX(v),y[v*2+1]=g.getY(v);f.uvs=y}return f}var B3=F(()=>{"use strict"});function F3(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let i=[],t=(r,s,a)=>{let o=new Event(a);try{typeof s=="function"?s.call(r,o):s.handleEvent?.(o)}catch(l){console.error(l)}},e=(r,s)=>{let a=new Set,o=r.addEventListener.bind(r),l=r.removeEventListener.bind(r),c=(d,h,p)=>{if(o(d,h,p),!s.includes(d)||h==null)return;let f={type:d,listener:h};a.add(f),queueMicrotask(()=>{!a.delete(f)||t(r,f.listener,f.type)})},u=(d,h,p)=>{l(d,h,p);for(let f of a)f.type===d&&f.listener===h&&a.delete(f)};Object.defineProperty(r,"addEventListener",{configurable:!0,writable:!0,value:c}),Object.defineProperty(r,"removeEventListener",{configurable:!0,writable:!0,value:u}),i.push(()=>{delete r.addEventListener,delete r.removeEventListener,a.clear()})};e(document,["DOMContentLoaded"]),e(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:r=>{typeof r=="function"&&queueMicrotask(()=>{try{r.call(window,new Event("load"))}catch(s){console.error(s)}})}}),i.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let r of i)r()}}var U3=F(()=>{"use strict"});var WZ,ES,k3=F(()=>{"use strict";wS();nC();WZ=6e3,ES=class{constructor(t,e,n){this.iframe=t;this.deps=e;this.onConsole=n;this.disposed=!1;this.handshakeSeen=!1;this.handshakeTimer=null;this.onMessage=t=>{if(this.disposed||t.source!==this.iframe.contentWindow)return;let e=t.data;!O3(e)||this.handleMessage(e)};this.host=new kp(e,n,(r,s)=>{this.sendEvent(r,s)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Jl]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},WZ)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[Jl]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(n){e=Promise.reject(n)}e.then(n=>{this.send({[Jl]:!0,kind:"result",id:t.id,ok:!0,value:n,error:void 0})},n=>{let r=n instanceof Error?n.message:String(n);this.send({[Jl]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:r}),this.onConsole("error",r)});break}case"input":this.dispatchInput(t.event);break}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[Jl]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let n=this.iframe.getBoundingClientRect(),r={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":{e.dispatchEvent(new PointerEvent(t.type,{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break}case"click":case"dblclick":{e.dispatchEvent(new MouseEvent(t.type,{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,button:t.button,buttons:t.buttons}));break}case"wheel":{let s=new WheelEvent("wheel",{...r,clientX:(t.x??0)+n.left,clientY:(t.y??0)+n.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(s,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(s,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(s);break}case"keydown":case"keyup":{e.dispatchEvent(new KeyboardEvent(t.type,{...r,key:t.key,code:t.code,repeat:t.repeat}));break}}}}});var hn=F(()=>{gS();r3();o3();l3();m3();g3();v3();b3();E3();M3();_3();I3();wS();L3();nC();B3();U3();k3()});var V3=F(()=>{"use strict"});function MS(i){return Array.isArray(i)?i:[i]}function Rd(i,t){let e=0;for(;e<i.length&&e<t.length;){if(i[e]<t[e])return-1;if(i[e]>t[e])return 1;e+=1}return e!==t.length?-1:e!==i.length?1:0}var z3=F(()=>{"use strict"});function fi(i,t){return Object.setPrototypeOf(i,t),i}function _S(i){let t={...i};return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}function Ro(i,t,e){if(i===void 0?t===void 0?(i=0,t=10):i=t-10:t===void 0&&(t=i+10),i>t){let s=i;i=t,t=s}let n=[],r=1/(e+1);for(let s=0;s<e;s++){let a=i+(t-i)*(s+.75+Math.random()*.5)*r;n.push(a)}return n}function Vp(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function G3(){return typeof process<"u"}var j3=F(()=>{"use strict"});function By(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let t=Object.getOwnPropertyNames(i);for(let e of t){let n=i[e];n&&typeof n=="object"&&By(n)}return Object.freeze(i)}function TS(i){for(let t of Object.keys(i))i[t]===void 0&&delete i[t];return i}var H3=F(()=>{"use strict"});var mi=F(()=>{V3();z3();j3();H3()});var AS,Dd,Fy,CS=F(()=>{"use strict";AS=class{},Dd=class extends AS{constructor(e){super();this.id=e}},Fy=class extends AS{constructor(e){super();this.data=e}}});var W3=F(()=>{"use strict"});var st,Uy=F(()=>{"use strict";st=class{modifyById(t,e){let n=this;if(n[t]===void 0)throw new Error("not expected");{let s={...n,[t]:e};return Object.setPrototypeOf(s,st.prototype),s}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let n=e[t.id],r;n===void 0?r={type:2,id:t.id}:r={type:1,id:t.id,data:n};let{id:s,data:a}=t,o={...e,[s]:a};return Object.setPrototypeOf(o,st.prototype),{data:o,actual:t,reverse:r}}else if(t.type===2){let{id:n}=t,r=e[n];if(r===void 0)return null;{let s={...e};return Object.setPrototypeOf(s,st.prototype),delete s[n],{data:s,actual:t,reverse:{type:1,id:n,data:r}}}}return null}}});var zp,PS=F(()=>{"use strict";zp=class extends Error{}});function q3(i,t){for(let e of i)t(e.id,e.data)!==!0&&q3(e.children,t)}function X3(i,t){if(t(i.id,i.data)!==!0)for(let e of i.children)X3(e,t)}var Ln,lu=F(()=>{"use strict";mi();PS();mi();Ln=class extends Array{constructor(...e){super(...e);Gi(this,"partialObjectCaches");Gi(this,"objCaches");Gi(this,"parentCaches");Object.setPrototypeOf(this,Ln.prototype)}deepFreeze(){let e=0;for(;e<this.length;)By(this[e]),e++}fillCaches0(e,n){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,n);for(let r of e.children)this.fillCaches0(r,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,n){if(!this.has(e))return!0;for(;e;){let r=this.parent(e);if(r===n)return!0;e=r}return!1}rootAcestor(e){for(;e;){let n=this.parent(e);if(n)e=n;else return e}return e}isDescendantOf(e,n){for(;e;){let r=this.parent(e);if(r===n)return!0;e=r}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}partialCache(e){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let n=this.get(e);n!==void 0&&this.partialObjectCaches.set(e,n)}get(e){if(this.partialObjectCaches!==void 0){let n=this.partialObjectCaches.get(e);if(n!==void 0)return n}return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,n){if(e===null)this.traverse(n);else{let r=this.get(e);r&&X3(r,n)}}traverse(e){q3(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this.parent(e),a=this.childrenArray(s),o=a.findIndex(d=>d.id===e);if(o<0)throw new Error("not expected");let l=a[o];a=[...a],a[o]={...l,data:n};let c=new Map;return c.set(e,a[o]),this.modifyArrayBy(s,a,c)}}modifyArrayBy(e,n,r=void 0){let s=e,a=n;for(;s!==null;){let l=a,c=s;if(s=this.parent(s),s===void 0)throw new Error;a=this.childrenArray(s);let u=a.findIndex(d=>d.id===c);if(u<0)throw new Error;a=[...a],a[u]={...a[u],children:l},r&&r.set(c,a[u])}Object.setPrototypeOf(a,Ln.prototype);let o=a;if(r&&this.objCaches!==void 0&&this.parentCaches!==void 0){o.objCaches=this.objCaches;for(let[l,c]of r)o.objCaches.set(l,c);o.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else o.fillCaches();return o}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:n}){if(this.get(e)!==void 0)return!0;for(let r of n)if(this.checkDuplicatedIdRec(r))return!0;return!1}addOp(e){let{parent:n,fi:r,id:s,data:a,children:o}=e;if(n!==null&&this.get(n)===void 0)return null;if(this.checkDuplicatedIdRec(e))return null;{let l=n,c=this.childrenArray(l),u={fi:r,id:s,data:a,children:o};return c=[...c,u],c.sort((h,p)=>h.fi-p.fi),e.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:e,reverse:{type:8,id:s}}}}deleteOp(e){let{id:n}=e;if(this.get(n)===null)return null;{let r=this.parent(n);if(r===void 0)return null;let s=this.childrenArray(r),a=s.findIndex(c=>c.id===n);e.localIndex=a,s=[...s];let o=s.splice(a,1)[0];return{data:this.modifyArrayBy(r,s),actual:e,reverse:{type:7,...o,parent:r}}}}moveOp(e){let{parent:n,fi:r,id:s}=e;if(n!==null&&this.get(n)===void 0)return this.deleteOp({type:8,id:s});if(n!==null){let p=n;for(;p!==null;){if(p===void 0)throw new Error;if(p===s)throw new zp("cyclic tree");p=this.parent(p)}}let a=this.parent(s);if(a===void 0)return null;let o=a,l=this.childrenArray(a),c=l.findIndex(p=>p.id===s);l=[...l];let u=l.splice(c,1)[0],d=this.modifyArrayBy(a,l);a=n,l=d.childrenArray(a);let h=u.fi;return u={...u,fi:r},l=[...l,u],l.sort((p,f)=>p.fi-f.fi),e.localIndex=l.indexOf(u),d=d.modifyArrayBy(a,l),{data:d,actual:e,reverse:{type:9,parent:o,fi:h,id:s}}}previous(e,n){if(n===null){let s=this.childrenArray(e);return s.length===0?null:s[s.length-1].id}let r=null;for(let s of this.childrenArray(e)){if(s.id===n)return r;r=s.id}return null}traverseSortNext(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(a=>a.id===e)+1;if(s<r.length)return r[s].id;if(n)return this.traverseSortNext(n)}}sortNext(e){let n=this.childrenArray(e);return n.length>0?n[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let n=this.childrenArray(e);return n.length>0?this.traverseSortPrevious(n[n.length-1].id):e}sortPrevious(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(a=>a.id===e)-1;return s>=0?this.traverseSortPrevious(r[s].id):n}}getAllSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r.id);s!==void 0&&n.push({...r,...s})}n.sort((r,s)=>Rd(r.sortKey,s.sortKey));for(let r of n)delete r.sortKey;return n}getAllIdSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r);s!==void 0&&n.push(s)}n.sort((r,s)=>Rd(r.sortKey,s.sortKey));for(let r of n)delete r.sortKey;return n.map(r=>r.id)}getWithSortKey(e){let n=e,r=[],s=this.get(n),a=s;if(s!==void 0){for(;n;)r.splice(0,0,s.fi),n=this.parent(n),n!==null&&(s=this.get(n));return{...a,sortKey:r}}}insertBeforeHelper(e,n,r){return this.insertAfterHelper(e,this.previous(e,n),r)}insertAfterHelper(e,n,r){let s=this.childrenArray(e);if(n===null){if(s.length===0)return Ro(0,r,r);{let a=s[0].fi;return Ro(a-r,a,r)}}else{let a=this.get(n);if(a===void 0||this.parent(n)!==e)throw new Error("illegal args");let o=s.find(l=>l.fi>a.fi);if(o===void 0){let l=s[s.length-1].fi;return Ro(l,l+r,r)}else return Ro(a.fi,o.fi,r)}}}});var rC,cu,IS=F(()=>{"use strict";rC=null;(n=>{function i(r){rC=r}n.setPreservePrototype=i;function t(r,s){return Object.getPrototypeOf(r)===rC&&Object.setPrototypeOf(s,rC),s}n.tryPreservePrototype=t;function e(r,s){if(s.type!==0)return null;if(Array.isArray(r)){let a=s.props,o={},l=[...r],c=!1;if(a)for(let u of Object.keys(a)){let d=parseInt(u);if(isNaN(d))throw new Error("wrong index");o[u]=l[d],l[d]=a[u],c=!0}return c?{data:l,actual:s,reverse:{type:0,props:o}}:null}else{let a=s.props,o={},l={...r},c=!1;if(a)for(let u of Object.keys(a)){o[u]=l[u];let d=a[u];d===void 0?delete l[u]:l[u]=d,c=!0}return c?{data:n.tryPreservePrototype(r,l),actual:s,reverse:{type:0,props:o}}:null}}n.runOp=e})(cu||(cu={}))});var ze,uu=F(()=>{"use strict";mi();mi();ze=class extends Array{constructor(...e){super(...e);Gi(this,"objCaches");Object.setPrototypeOf(this,ze.prototype)}deepFreeze(){let e=0;for(;e<this.length;)By(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this,a=s.findIndex(c=>c.id===e);if(a<0)throw new Error("not expected");let o=s[a];return s=[...s],s[a]={...o,data:n},this.modifyArrayBy(s)}}modifyArrayBy(e){Object.setPrototypeOf(e,ze.prototype);let n=e;return G3()||n.fillCaches(),n}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:n,id:r,data:s}=e,a=this,o={fi:n,id:r,data:s};return a=[...a,o],a.sort((c,u)=>c.fi-u.fi),e.localIndex=a.indexOf(o),{data:this.modifyArrayBy(a),actual:e,reverse:{type:5,id:r}}}deleteOp(e){let{id:n}=e,r=this,s=r.findIndex(l=>l.id===n);if(s===-1)return null;e.localIndex=s,r=[...r];let a=r.splice(s,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:{type:4,...a}}}moveOp(e){let{fi:n,id:r}=e,s=this;s=[...s];let a=s.findIndex(u=>u.id===r);if(a===-1)return null;let o=s[a].fi,l={...s[a],fi:n};return s[a]=l,s.sort((u,d)=>u.fi-d.fi),e.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:e,reverse:{type:6,fi:o,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let n=null;for(let r of this){if(r.id===e)return n;n=r.id}return null}insertBeforeHelper(e,n){return this.insertAfterHelper(this.previous(e),n)}insertAfterHelper(e,n){let r=this;if(e===null){if(r.length===0)return Ro(0,n,n);{let s=r[0].fi;return Ro(s-n,s,n)}}else{let s=this.get(e);if(s===void 0)throw new Error("illegal args");let a=r.find(o=>o.fi>s.fi);if(a===void 0){let o=r[r.length-1].fi;return Ro(o,o+n,n)}else return Ro(s.fi,a.fi,n)}}}});function Y3(i,t){return Gp(i,t,null)??i}function $3(i,t){let e={cur:[],result:[],len:0};return i=Gp(i,t,e)??i,[i,e.result]}function OS(i,t){return i===null?null:(i.cur[i.len]=t,i.len+=1,i)}function RS(i){i&&(i.len-=1)}function qZ(i){if(i===null)return null;i.result.push(i.cur.slice(0,i.len))}function K3(i,t,e){let n=!1,r=i.map(s=>{let a=s.id,o=t[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,e!==null))throw new Error("not supported");let l=Gp(s.data,t,OS(e,a));RS(e),n=n||l!==void 0,l===void 0&&(l=s.data);let c=K3(s.children,t,e);return c!==void 0?n=!0:c=s.children,{...s,id:a,data:l,children:c}});if(n)return r}function XZ(i,t,e){let n=!1,r=i.map(s=>{let a=s.id,o=t[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,e!==null))throw new Error("not supported");let l=Gp(s.data,t,OS(e,a));return RS(e),n=n||l!==void 0,l===void 0&&(l=s.data),{...s,id:a,data:l}});if(n)return Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}function Gp(i,t,e){if(i instanceof Ln){let n=K3(i,t,e);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}else{if(i instanceof ze)return XZ(i,t,e);if(Array.isArray(i)){let n=!1,r=i.map((s,a)=>{let o=Gp(s,t,OS(e,a));return RS(e),n=n||o!==void 0,o===void 0&&(o=s),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else if(i&&typeof i=="object"&&!Vp(i)){let n={},r=!1;for(let[s,a]of Object.entries(i))if(s!=="name"&&s!=="variableId"){let o=t[s];if(typeof o=="string"){if(e!==null)throw new Error("not supported");r=!0,s=o}let l=Gp(a,t,OS(e,s));RS(e),r=r||l!==void 0,l===void 0&&(l=a),n[s]=l}else n[s]=a;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else if(typeof i=="string"){let n=t[i];return n!==void 0&&qZ(e),n}else return}}var iC=F(()=>{"use strict";lu();uu();mi()});function jp(i){return i&&typeof i=="object"&&i instanceof Zn}function sC(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,a=ky(r.data,t[s]);if(e=e||a!==void 0,a===void 0&&(a=r.data),r.children){let o=sC(r.children,t);return o!==void 0?e=!0:o=r.children,{...r,id:s,data:a,children:o}}else return{...r,id:s,data:a}});if(e)return n}function YZ(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,a=ky(r.data,t[s]);return e=e||a!==void 0,a===void 0&&(a=r.data),{...r,id:s,data:a}});if(e)return Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}function ky(i,t){if(!jp(t))return t;if(i instanceof Ln){let e=sC(i,t);return e!==void 0&&Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e}else{if(i instanceof ze)return YZ(i,t);if(Array.isArray(i)){let e=!1,n=i.map((r,s)=>{let a=ky(r,t[s]);return e=e||a!==void 0,a===void 0&&(a=r),a});return e?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else{if(i instanceof Zn)return aC(i,t);if(i&&typeof i=="object"){let e={},n=!1;for(let[r,s]of Object.entries(i)){let a=ky(s,t[r]);n=n||a!==void 0,a===void 0&&(a=s),e[r]=a}return n?(Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e):void 0}}}}function aC(i,t){if(i===void 0)return t;if(t===void 0)return i;if(!jp(t))return t;if(!jp(i))return Do.apply(i,t);let e=new Set;for(let r of Object.keys(i))e.add(r);for(let r of Object.keys(t))e.add(r);let n=new Zn;for(let r of e){let s=aC(i===void 0?void 0:i[r],t===void 0?void 0:t[r]);n[r]=s}return n}var Zn,Do,DS=F(()=>{"use strict";lu();uu();Vy();mi();Zn=class{unusedFunOverridesTable(t){}runOp(t){let e=[],n=this,r=0,s={};for(;r<t.path.length;){if(e.push(n),n=n===void 0?void 0:n[t.path[r]],n!==void 0&&!jp(n))return null;r+=1}n=n?_S(n):new Zn;for(let[l,c]of Object.entries(t.props)){let u=n[l];s[l]=u,c===void 0?delete n[l]:n[l]=c}for(;r>0;){if(Object.keys(n).length===0){let l=e[r-1];l&&(n=_S(l),delete n[t.path[r-1]])}else{let l=e[r-1];if(l){let c=_S(l);c[t.path[r-1]]=n,n=c}else{let c=new Zn;c[t.path[r-1]]=n,n=c}}r-=1}let a=Object.setPrototypeOf(n,Zn.prototype),o={...t,props:s};return{data:a,actual:t,reverse:o}}};(n=>{function i(r,s){return ky(r,s)??r}n.apply=i;function t(r,s){return aC(r,s)}n.merge=t;function e(r,s){let a=0,o=s.path,l=r;for(;a<o.length&&l!==void 0;){if(l=rr.zoomOnce(l,o[a]),l===void 0)return s;if(!jp(l))return;a+=1}if(l===void 0)return s;if(!!jp(l))if(s.type===0){let c={...s.props};for(let u of Object.keys(l))delete c[u];return{...s,props:c}}else if(s.type===1||s.type===4||s.type===7){let c=sC([s],l);return c?c[0]:s}else return s}n.filterOp=e})(Do||(Do={}))});var Hp,wr,zy,Z3=F(()=>{"use strict";Vy();Uy();lu();PS();IS();uu();iC();DS();(t=>{function i(e,n){let r=rr.zoom(n,e.path);if(typeof r=="object"){let s={};for(let a of Object.keys(e.props))s[a]=r[a];return{...e,props:s}}else return{...e,props:{}}}t.replaceProps=i})(Hp||(Hp={}));(o=>{function i(l,c){return{...l,path:l.path.slice(c)}}o.drop=i;function t(l,c){return e(l,c)?.data??l}o.applySimple=t;function e(l,c){let u=c.path,d=[];for(;;){let h;if(l instanceof Zn&&c.type===0&&(h=l.runOp({...c,path:u.slice(d.length)}),h===null&&(h=void 0)),h===void 0&&d.length===u.length&&(l instanceof Ln||l instanceof ze||l instanceof st?h=l.runOp(c):h=cu.runOp(l,c)),h!==void 0)if(h!==null){let m=h.data;for(let g=d.length-1;g>=0;g--){let y=u[g],v=d[g];if(v instanceof Ln){if(typeof y=="number")throw new Error("illegal arg");m=v.modifyById(y,m)}else if(v instanceof ze){if(typeof y=="number")throw new Error("illegal arg");m=v.modifyById(y,m)}else if(v instanceof st){if(typeof y=="number")throw new Error("illegal arg");m=v.modifyById(y,m)}else if(v instanceof Zn){let b={...v,[y]:m};m=Object.setPrototypeOf(b,Zn.prototype)}else if(typeof v=="object")if(Array.isArray(v)){if(typeof y=="string"&&(y=parseInt(y),isNaN(y)))throw new Error("Invalid path");let b=m;m=[...v],m[y]=b}else m=cu.tryPreservePrototype(v,{...v,[y]:m});else return null}return{data:m,actual:{...h.actual,path:u},reverse:{...h.reverse,path:u}}}else return null;let p=u[d.length],f;if(l instanceof Ln){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else if(l instanceof ze){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else l!==null&&(f=l[p]);if(f!==void 0)d.push(l),l=f;else return null}}o.apply=e;function n(l,c){for(let u=0;u<l.length&&u<c.length;u++)if(l[u]!==c[u])return!0;return!1}o.pathDisjoint=n;function r(l,c){if(l.length!==c.length)return!1;for(let u=0;u<l.length;u++)if(l[u]!==c[u])return!1;return!0}o.pathEq=r;function s(l,c){return n(l.path,c.path)}o.commutative=s;function a(l,c){return l.type===0&&c.type===0&&r(l.path,c.path)?Object.keys(l.props).every(u=>c.props[u]!==void 0):!1}o.subsumed=a})(wr||(wr={}));(l=>{function i(){return[]}l.empty=i;function t(c,u){let d=[];for(let h of c){let[p,...f]=h.path;p===u&&d.push({...h,path:f})}return d}l.removePrefix=t;function e(c,u){return c.map(d=>({...d,path:[u,...d.path]}))}l.addPrefix=e;function n(c,u){return[...c,...u]}l.concat=n;function r(c,u){return[...c.filter(h=>!u.some(p=>wr.subsumed(h,p))),...u]}l.compress=r;function s(c,u){return c.every(d=>u.every(h=>wr.commutative(d,h)))}l.commutative=s;function a(c,u){for(let d of u){let h=o(c,d);h!==null&&(c=h.data)}return c}l.applyAll=a;function o(c,u){let d=c,h=[],p=[];for(let f of u)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let m,g,y;if(f.type===3?(m=rr.zoom(d,[...f.path,f.id]),y=wr.apply(d,{...f,type:2})):(m=rr.zoom(d,[...f.path,f.id,"value"]),y=wr.apply(d,f)),y!==null){d=y.data;let[v,b]=$3(d,{[f.id]:m});d=v;for(let x=0;x<b.length;x++){let S=b[x],E=S.pop();if(typeof E=="number"){let M=[E];for(let T=x+1;T<b.length;T++){let A=b[T],C=A[A.length-1];if(typeof C=="number"&&rr.equal(S,A.slice(0,A.length-1)))M.push(C),b.splice(T,1);else break}let w=rr.zoom(d,S);g=w.map((T,A)=>M.includes(A)?f.id:T),m=w,E=S.pop()}else{if(E==="alphaOverride"||E==="alpha"){m/=100;let M=m,w=rr.zoom(d,S.slice(0,S.length-2)),T=w.layers.map(A=>A.id===S[S.length-1]?{...A,data:{...A.data,[E]:M}}:A);Object.setPrototypeOf(T,Object.getPrototypeOf(w.layers)),w.layers=T}g=f.id}h.push({type:0,path:S,props:{[E]:m}}),p.push({type:0,path:S,props:{[E]:g}})}p.push(y.reverse),h.push(y.actual)}}else{let m=wr.apply(d,f);m!==null&&(h.push(m.actual),d=m.data,p.push(m.reverse))}}catch(m){if(m instanceof zp)return null;throw m}return{data:d,actual:h,reverse:p.reverse()}}l.apply=o})(zy||(zy={}))});function oC(i,t,e){if(i.length>0){let n=i[i.length-1];if(n.type===0&&t.type===0&&rr.equal(n.path,e)){Object.assign(n.props,t.props);return}}i.push({...t,path:e})}function BS(i,t,e){return e instanceof Ln?new Wp(i,t,e):e instanceof ze?new qp(i,t,e):e instanceof st?new Proxy(new cC(i,t,e),ZZ):e!==null&&typeof e=="object"?Vp(e)?e:new Proxy(new lC(i,t,e),KZ):e}function Nd(i){let t=new LS(i);return[BS(t,"",i),t]}function du(i,t){let[e,n]=Nd(i);return t(e),n.result()}function Pr(i){return i instanceof Wp||i instanceof qp?i._current:i!==null&&typeof i=="object"?i[Q3]:i}var Q3,$Z,NS,Ld,lC,cC,J3,KZ,ZZ,Wp,qp,LS,uC=F(()=>{"use strict";Uy();lu();IS();uu();mi();Vy();Q3=Symbol(),$Z=Symbol(),NS=Symbol(),Ld=class{reportOp(t,e,n=[]){let r=this;if(e===null)return;r._current=e.data;let s=n;for(;!(r instanceof LS);){let a=r._path,o=r._current;if(a!==""&&s.splice(0,0,a),r=r._parent,r===null)return;r.update(a,o)}r.push(s,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let n=e[NS];n&&n(),delete this._children[t]}}}},lC=class extends Ld{constructor(t,e,n){super(),this._parent=t,this._path=e,this._current=n}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=cu.tryPreservePrototype(this._current,{...this._current,[t]:e})}runOp(t){this.reportOp(t,cu.runOp(this._current,t),t.path)}},cC=class extends Ld{constructor(t,e,n){super(),this._parent=t,this._path=e,this._current=n}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,st.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},J3={get(i,t){if(t===NS)return()=>{i._parent=null};if(t===Q3)return i._current;if(t===$Z)return i;let{_current:e,_children:n}=i;if(t==="push"&&Array.isArray(e))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e[t],a=BS(i,t,s);return a!==s?(n===void 0&&(n={},i._children=n),n[t]=a,a):s},has(i,t){return t in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,t){let e=i._current,n=Reflect.getOwnPropertyDescriptor(e,t);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:e[t]}}},KZ={...J3,set(i,t,e){let n={type:0,props:{[t]:Pr(e)??e}};return i.deleteChildren(t),i.runOp(n),!0},deleteProperty(i,t){let e={type:0,props:{[t]:void 0}};return i.deleteChildren(t),i.runOp(e),!0}},ZZ={...J3,set(i,t,e){return e===void 0?this.deleteProperty(i,t):(i.deleteChildren(t),i.runOp({type:1,id:t,data:e})),!0},deleteProperty(i,t){return i.runOp({type:2,id:t}),!0}},Wp=class extends Ld{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[NS]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,n)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,a=BS(this,t,s);return a!==s?(n===void 0&&(n={},this._children=n),n[t]=a,a):s}add(t,e,n,r,s){this.runOp({type:7,parent:t,fi:e,id:n,data:r,children:s})}move(t,e,n){this.runOp({type:9,parent:t,fi:e,id:n})}insertAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let a=n[s];this.add(t,r[s],a.id,a.data,a.children)}}insertBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let a=n[s];this.add(t,r[s],a.id,a.data,a.children)}}moveAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let a=n[s];this.move(t,r[s],a)}}moveBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let a=n[s];this.move(t,r[s],a)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},qp=class extends Ld{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[NS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id,s=this._current[n].fi;t(this.data(this._current[n].id),r,s,n)}}find(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id;if(t(this.data(r),r))return this.get(r)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:n}=this._current.at(t);return{id:e,fi:n,data:this.data(e)}}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,a=BS(this,t,s);return a!==s?(n===void 0&&(n={},this._children=n),n[t]=a,a):s}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,n){this.runOp({type:4,fi:t,id:e,data:n})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}insertBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}moveAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}moveBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};LS=class extends Ld{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,n,r){oC(this.ts,e,t),oC(this.actual,n,t),oC(this.reverse,r,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}});var rr,Vy=F(()=>{"use strict";CS();uC();uu();lu();mi();(s=>{function i(a,o){if(o.length===a.length){let l=0;for(;l<a.length;){if(a[l]!==o[l])return!1;l+=1}}else return!1;return!0}s.equal=i;function t(a,o,l){let c=n(l,a);if(c!==void 0&&typeof c=="object"&&c!==null){let u={...o};return Object.keys(c).forEach(d=>{delete u[d]}),u}else return o}s.removeOverridden=t;function e(a,o){if((a instanceof Ln||a instanceof Wp)&&typeof o=="string")return a.data(o);if((a instanceof ze||a instanceof qp)&&typeof o=="string")return a.data(o);if(typeof o=="number"&&Array.isArray(a))return a[o];if(typeof o=="string"&&typeof a=="object"&&a!==null)return a[o]}s.zoomOnce=e;function n(a,o,l=0){for(;l<o.length&&a!==void 0;)a=e(a,o[l]),l+=1;return a}s.zoom=n;function r(a,o){let l=[];function c(u,d){if(u instanceof Dd&&u.id===o.id)l.push(d);else if(u instanceof ze)for(let h=0;h<u.length;h++)c(u[h].data,[...d,u[h].id]);else if(u instanceof Ln)u.traverse((h,p)=>{c(h,[...d,p])});else if(Array.isArray(u))for(let h=0;h<u.length;h++)c(u[h],[...d,h]);else{if(Vp(u))return;if(typeof u=="object"&&u!==null)for(let h in u)c(u[h],[...d,h])}}return c(a,[]),l}s.findPathes=r})(rr||(rr={}))});var eB=F(()=>{"use strict"});function tB(i,t){let e=[];if(t.length===i.length){let n=0;for(;n<i.length;){if(t[n]==="*")e.push(i[n]);else if(i[n]!==t[n])return null;n+=1}}else return null;return e}function $t(i,t){let e=[];if(t.length<=i.length){let n=0;for(;n<t.length;){if(t[n]==="*")e.push(i[n]);else if(i[n]!==t[n])return null;n+=1}}else return null;return e}var nB=F(()=>{"use strict"});function FS(i){try{if(!ir.trusted&&!pu){let e=pn.sharedLength||0;e<pn.length&&(pn.length=e)}let t;if(ir.randomAccessStructure&&tt[ie]<64&&tt[ie]>=32&&sB?(t=sB(tt,ie,ha,ir),tt=null,!(i&&i.lazy)&&t&&(t=t.toJSON()),ie=ha):t=qr(),Ii&&(ie=Ii.postBundlePosition,Ii=null),pu&&(pn.restoreStructures=null),ie==ha)pn&&pn.restoreStructures&&lB(),pn=null,tt=null,ec&&(ec=null);else{if(ie>ha)throw new Error("Unexpected end of MessagePack data");if(!pu){let e;try{e=JSON.stringify(t,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){e="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+e)}}return t}catch(t){throw pn&&pn.restoreStructures&&lB(),yC(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||ie>ha)&&(t.incomplete=!0),t}}function lB(){for(let i in pn.restoreStructures)pn[i]=pn.restoreStructures[i];pn.restoreStructures=null}function qr(){let i=tt[ie++];if(i<160)if(i<128){if(i<64)return i;{let t=pn[i&63]||ir.getStructures&&vB()[i&63];return t?(t.read||(t.read=vC(t,i&63)),t.read()):i}}else if(i<144)if(i-=128,ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=xB();n==="__proto__"&&(n="__proto_"),t[n]=qr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(qr(),qr());return t}else{i-=144;let t=new Array(i);for(let e=0;e<i;e++)t[e]=qr();return ir.freezeData?Object.freeze(t):t}else if(i<192){let t=i-160;if(Lo>=ie)return hu.slice(ie-da,(ie+=t)-da);if(Lo==0&&ha<140){let e=t<16?bC(t):bB(t);if(e!=null)return e}return gC(t)}else{let t;switch(i){case 192:return null;case 193:return Ii?(t=qr(),t>0?Ii[1].slice(Ii.position1,Ii.position1+=t):Ii[0].slice(Ii.position0,Ii.position0-=t)):yB;case 194:return!1;case 195:return!0;case 196:if(t=tt[ie++],t===void 0)throw new Error("Unexpected end of buffer");return dC(t);case 197:return t=sn.getUint16(ie),ie+=2,dC(t);case 198:return t=sn.getUint32(ie),ie+=4,dC(t);case 199:return Bd(tt[ie++]);case 200:return t=sn.getUint16(ie),ie+=2,Bd(t);case 201:return t=sn.getUint32(ie),ie+=4,Bd(t);case 202:if(t=sn.getFloat32(ie),ir.useFloat32>2){let e=MB[(tt[ie]&127)<<1|tt[ie+1]>>7];return ie+=4,(e*t+(t>0?.5:-.5)>>0)/e}return ie+=4,t;case 203:return t=sn.getFloat64(ie),ie+=8,t;case 204:return tt[ie++];case 205:return t=sn.getUint16(ie),ie+=2,t;case 206:return t=sn.getUint32(ie),ie+=4,t;case 207:return ir.int64AsType==="number"?(t=sn.getUint32(ie)*4294967296,t+=sn.getUint32(ie+4)):ir.int64AsType==="string"?t=sn.getBigUint64(ie).toString():ir.int64AsType==="auto"?(t=sn.getBigUint64(ie),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=sn.getBigUint64(ie),ie+=8,t;case 208:return sn.getInt8(ie++);case 209:return t=sn.getInt16(ie),ie+=2,t;case 210:return t=sn.getInt32(ie),ie+=4,t;case 211:return ir.int64AsType==="number"?(t=sn.getInt32(ie)*4294967296,t+=sn.getUint32(ie+4)):ir.int64AsType==="string"?t=sn.getBigInt64(ie).toString():ir.int64AsType==="auto"?(t=sn.getBigInt64(ie),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=sn.getBigInt64(ie),ie+=8,t;case 212:if(t=tt[ie++],t==114)return fB(tt[ie++]&63);{let e=Xi[t];if(e)return e.read?(ie++,e.read(qr())):e.noBuffer?(ie++,e()):e(tt.subarray(ie,++ie));throw new Error("Unknown extension "+t)}case 213:return t=tt[ie],t==114?(ie++,fB(tt[ie++]&63,tt[ie++])):Bd(2);case 214:return Bd(4);case 215:return Bd(8);case 216:return Bd(16);case 217:return t=tt[ie++],Lo>=ie?hu.slice(ie-da,(ie+=t)-da):JZ(t);case 218:return t=sn.getUint16(ie),ie+=2,Lo>=ie?hu.slice(ie-da,(ie+=t)-da):eQ(t);case 219:return t=sn.getUint32(ie),ie+=4,Lo>=ie?hu.slice(ie-da,(ie+=t)-da):tQ(t);case 220:return t=sn.getUint16(ie),ie+=2,uB(t);case 221:return t=sn.getUint32(ie),ie+=4,uB(t);case 222:return t=sn.getUint16(ie),ie+=2,dB(t);case 223:return t=sn.getUint32(ie),ie+=4,dB(t);default:if(i>=224)return i-256;if(i===void 0){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw new Error("Unknown MessagePack token "+i)}}}function vC(i,t){function e(){if(e.count++>iB){let r;try{r=i.read=new Function("r","return function(){return "+(ir.freezeData?"Object.freeze":"")+"({"+i.map(s=>s==="__proto__"?"__proto_:r()":QZ.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(qr)}catch{return iB=1/0,e()}return i.read0=r,i.highByte===0&&(i.read=cB(t,i.read)),r()}let n={};for(let r=0,s=i.length;r<s;r++){let a=i[r];a==="__proto__"&&(a="__proto_"),n[a]=qr()}return ir.freezeData?Object.freeze(n):n}return e.count=0,i.read0=e,i.highByte===0?cB(t,e):e}function vB(){let i=wB(()=>(tt=null,ir.getStructures()));return pn=ir._mergeStructures(i,pn)}function Gy(i){let t;if(i<16&&(t=bC(i)))return t;if(i>64&&hC)return hC.decode(tt.subarray(ie,ie+=i));let e=ie+i,n=[];for(t="";ie<e;){let r=tt[ie++];if((r&128)===0)n.push(r);else if((r&224)===192){let s=tt[ie++]&63,a=(r&31)<<6|s;a<128?n.push(65533):n.push(a)}else if((r&240)===224){let s=tt[ie++]&63,a=tt[ie++]&63,o=(r&31)<<12|s<<6|a;o<2048||o>=55296&&o<=57343?n.push(65533):n.push(o)}else if((r&248)===240){let s=tt[ie++]&63,a=tt[ie++]&63,o=tt[ie++]&63,l=(r&7)<<18|s<<12|a<<6|o;l<65536||l>1114111?n.push(65533):(l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l))}else n.push(65533);n.length>=4096&&(t+=Pi.apply(String,n),n.length=0)}return n.length>0&&(t+=Pi.apply(String,n)),t}function uB(i){let t=new Array(i);for(let e=0;e<i;e++)t[e]=qr();return ir.freezeData?Object.freeze(t):t}function dB(i){if(ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=xB();n==="__proto__"&&(n="__proto_"),t[n]=qr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(qr(),qr());return t}}function bB(i){let t=ie,e=new Array(i);for(let n=0;n<i;n++){let r=tt[ie++];if((r&128)>0){ie=t;return}e[n]=r}return Pi.apply(String,e)}function bC(i){if(i<4)if(i<2){if(i===0)return"";{let t=tt[ie++];if((t&128)>1){ie-=1;return}return Pi(t)}}else{let t=tt[ie++],e=tt[ie++];if((t&128)>0||(e&128)>0){ie-=2;return}if(i<3)return Pi(t,e);let n=tt[ie++];if((n&128)>0){ie-=3;return}return Pi(t,e,n)}else{let t=tt[ie++],e=tt[ie++],n=tt[ie++],r=tt[ie++];if((t&128)>0||(e&128)>0||(n&128)>0||(r&128)>0){ie-=4;return}if(i<6){if(i===4)return Pi(t,e,n,r);{let s=tt[ie++];if((s&128)>0){ie-=5;return}return Pi(t,e,n,r,s)}}else if(i<8){let s=tt[ie++],a=tt[ie++];if((s&128)>0||(a&128)>0){ie-=6;return}if(i<7)return Pi(t,e,n,r,s,a);let o=tt[ie++];if((o&128)>0){ie-=7;return}return Pi(t,e,n,r,s,a,o)}else{let s=tt[ie++],a=tt[ie++],o=tt[ie++],l=tt[ie++];if((s&128)>0||(a&128)>0||(o&128)>0||(l&128)>0){ie-=8;return}if(i<10){if(i===8)return Pi(t,e,n,r,s,a,o,l);{let c=tt[ie++];if((c&128)>0){ie-=9;return}return Pi(t,e,n,r,s,a,o,l,c)}}else if(i<12){let c=tt[ie++],u=tt[ie++];if((c&128)>0||(u&128)>0){ie-=10;return}if(i<11)return Pi(t,e,n,r,s,a,o,l,c,u);let d=tt[ie++];if((d&128)>0){ie-=11;return}return Pi(t,e,n,r,s,a,o,l,c,u,d)}else{let c=tt[ie++],u=tt[ie++],d=tt[ie++],h=tt[ie++];if((c&128)>0||(u&128)>0||(d&128)>0||(h&128)>0){ie-=12;return}if(i<14){if(i===12)return Pi(t,e,n,r,s,a,o,l,c,u,d,h);{let p=tt[ie++];if((p&128)>0){ie-=13;return}return Pi(t,e,n,r,s,a,o,l,c,u,d,h,p)}}else{let p=tt[ie++],f=tt[ie++];if((p&128)>0||(f&128)>0){ie-=14;return}if(i<15)return Pi(t,e,n,r,s,a,o,l,c,u,d,h,p,f);let m=tt[ie++];if((m&128)>0){ie-=15;return}return Pi(t,e,n,r,s,a,o,l,c,u,d,h,p,f,m)}}}}}function hB(){let i=tt[ie++],t;if(i<192)t=i-160;else switch(i){case 217:t=tt[ie++];break;case 218:t=sn.getUint16(ie),ie+=2;break;case 219:t=sn.getUint32(ie),ie+=4;break;default:throw new Error("Expected string")}return Gy(t)}function dC(i){return ir.copyBuffers?Uint8Array.prototype.slice.call(tt,ie,ie+=i):tt.subarray(ie,ie+=i)}function Bd(i){let t=tt[ie++];if(Xi[t]){let e;return Xi[t](tt.subarray(ie,e=ie+=i),n=>{ie=n;try{return qr()}finally{ie=e}})}else throw new Error("Unknown extension type "+t)}function xB(){let i=tt[ie++];if(i>=160&&i<192){if(i=i-160,Lo>=ie)return hu.slice(ie-da,(ie+=i)-da);if(!(Lo==0&&ha<180))return gC(i)}else return ie--,SB(qr());let t=(i<<5^(i>1?sn.getUint16(ie):i>0?tt[ie]:0))&4095,e=pB[t],n=ie,r=ie+i-3,s,a=0;if(e&&e.bytes==i){for(;n<r;){if(s=sn.getUint32(n),s!=e[a++]){n=1879048192;break}n+=4}for(r+=3;n<r;)if(s=tt[n++],s!=e[a++]){n=1879048192;break}if(n===r)return ie=n,e.string;r-=3,n=ie}for(e=[],pB[t]=e,e.bytes=i;n<r;)s=sn.getUint32(n),e.push(s),n+=4;for(r+=3;n<r;)s=tt[n++],e.push(s);let o=i<16?bC(i):bB(i);return o!=null?e.string=o:e.string=gC(i)}function SB(i){if(typeof i=="string")return i;if(typeof i=="number"||typeof i=="boolean"||typeof i=="bigint")return i.toString();if(i==null)return i+"";if(ir.allowArraysInMapKeys&&Array.isArray(i)&&i.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return i.flat().toString();throw new Error(`Invalid property type for record: ${typeof i}`)}function wB(i){oB&&oB();let t=ha,e=ie,n=fC,r=da,s=Lo,a=hu,o=pC,l=ec,c=Ii,u=new Uint8Array(tt.slice(0,ha)),d=pn,h=pn.slice(0,pn.length),p=ir,f=pu,m=i();return ha=t,ie=e,fC=n,da=r,Lo=s,hu=a,pC=o,ec=l,Ii=c,tt=u,pu=f,pn=d,pn.splice(0,pn.length,...h),ir=p,sn=new DataView(tt.buffer,tt.byteOffset,tt.byteLength),m}function yC(){tt=null,ec=null,pn=null}function EB(i){i.unpack?Xi[i.type]=i.unpack:Xi[i.type]=i}var hC,tt,ha,ie,gB,pC,fC,ir,pn,hu,da,Lo,Ii,ec,Xi,sn,rB,mC,yB,pu,iB,sB,aB,oB,fu,QZ,cB,gC,JZ,eQ,tQ,Pi,pB,fB,mB,nQ,rQ,iQ,MB,US,Lfe,Nfe,Bfe,sQ,Ffe,_B=F(()=>{try{hC=new TextDecoder}catch{}ie=0,gB=[],pC=gB,fC=0,ir={},da=0,Lo=0,Xi=[],rB={useRecords:!1,mapsAsObjects:!0},mC=class{},yB=new mC;yB.name="MessagePack 0xC1";pu=!1,iB=2,fu=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(tt)return wB(()=>(yC(),this?this.unpack(t,e):fu.prototype.unpack.call(rB,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(ha=e.end||t.length,ie=e.start||0):(ie=0,ha=e>-1?e:t.length),fC=0,Lo=0,hu=null,pC=gB,Ii=null,tt=t;try{sn=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw tt=null,t instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof fu){if(ir=this,this.structures)return pn=this.structures,FS(e);(!pn||pn.length>0)&&(pn=[])}else ir=rB,(!pn||pn.length>0)&&(pn=[]);return FS(e)}unpackMultiple(t,e){let n,r=0;try{pu=!0;let s=t.length,a=this?this.unpack(t,s):US.unpack(t,s);if(e){if(e(a,r,ie)===!1)return;for(;ie<s;)if(r=ie,e(FS(),r,ie)===!1)return}else{for(n=[a];ie<s;)r=ie,n.push(FS());return n}}catch(s){throw s.lastPosition=r,s.values=n,s}finally{pu=!1,yC()}}_mergeStructures(t,e){aB&&(t=aB.call(this,t)),t=t||[],Object.isFrozen(t)&&(t=t.map(n=>n.slice(0)));for(let n=0,r=t.length;n<r;n++){let s=t[n];s&&(s.isShared=!0,n>=32&&(s.highByte=n-32>>5))}t.sharedLength=t.length;for(let n in e||[])if(n>=0){let r=t[n],s=e[n];s&&(r&&((t.restoreStructures||(t.restoreStructures=[]))[n]=r),t[n]=s)}return this.structures=t}decode(t,e){return this.unpack(t,e)}};QZ=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;cB=(i,t)=>function(){let e=tt[ie++];if(e===0)return t();let n=i<32?-(i+(e<<5)):i+(e<<5),r=pn[n]||vB()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=vC(r,i)),r.read()};gC=Gy,JZ=Gy,eQ=Gy,tQ=Gy;Pi=String.fromCharCode;pB=new Array(4096);fB=(i,t)=>{let e=qr().map(SB),n=i;t!==void 0&&(i=i<32?-((t<<5)+i):(t<<5)+i,e.highByte=t);let r=pn[i];return r&&(r.isShared||pu)&&((pn.restoreStructures||(pn.restoreStructures=[]))[i]=r),pn[i]=e,e.read=vC(e,n),(e.read0||e.read)()};Xi[0]=()=>{};Xi[0].noBuffer=!0;Xi[66]=i=>{let t=i.byteLength%8||8,e=BigInt(i[0]&128?i[0]-256:i[0]);for(let n=1;n<t;n++)e<<=BigInt(8),e+=BigInt(i[n]);if(i.byteLength!==t){let n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=(s,a)=>{let o=a-s;if(o<=40){let d=n.getBigUint64(s);for(let h=s+8;h<a;h+=8)d<<=BigInt(64),d|=n.getBigUint64(h);return d}let l=s+(o>>4<<3),c=r(s,l),u=r(l,a);return c<<BigInt((a-l)*8)|u};e=e<<BigInt((n.byteLength-t)*8)|r(t,n.byteLength)}return e};mB={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};Xi[101]=()=>{let i=qr();if(!mB[i[0]]){let t=Error(i[1],{cause:i[2]});return t.name=i[0],t}return mB[i[0]](i[1],{cause:i[2]})};Xi[105]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=sn.getUint32(ie-4);ec||(ec=new Map);let e=tt[ie],n;e>=144&&e<160||e==220||e==221?n=[]:e>=128&&e<144||e==222||e==223?n=new Map:(e>=199&&e<=201||e>=212&&e<=216)&&tt[ie+1]===115?n=new Set:n={};let r={target:n};ec.set(t,r);let s=qr();if(r.used)Object.assign(n,s);else return r.target=s;if(n instanceof Map)for(let[a,o]of s.entries())n.set(a,o);if(n instanceof Set)for(let a of Array.from(s))n.add(a);return n};Xi[112]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=sn.getUint32(ie-4),e=ec.get(t);return e.used=!0,e.target};Xi[115]=()=>new Set(qr());nQ=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array"),rQ=typeof globalThis=="object"?globalThis:window;Xi[116]=i=>{let t=i[0],e=Uint8Array.prototype.slice.call(i,1).buffer,n=nQ[t];if(!n){if(t===16)return e;if(t===17)return new DataView(e);throw new Error("Could not find typed array for code "+t)}return new rQ[n](e)};Xi[120]=()=>{let i=qr();return new RegExp(i[0],i[1])};iQ=[];Xi[98]=i=>{let t=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],e=ie;return ie+=t-i.length,Ii=iQ,Ii=[hB(),hB()],Ii.position0=0,Ii.position1=0,Ii.postBundlePosition=ie,ie=e,qr()};Xi[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");MB=new Array(147);for(let i=0;i<256;i++)MB[i]=+("1e"+Math.floor(45.15-i*.30103));US=new fu({useRecords:!1}),Lfe=US.unpack,Nfe=US.unpackMultiple,Bfe=US.unpack,sQ=new Float32Array(1),Ffe=new Uint8Array(sQ.buffer,0,4)});var aQ,oQ,kS,TB=F(()=>{"use strict";_B();CS();DS();uu();Uy();lu();aQ=[{Class:st.prototype.constructor,type:1,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,st.prototype),i}},{Class:ze.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,ze.prototype),i}},{Class:Ln.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Ln.prototype),i}},{Class:Dd.prototype.constructor,type:4,write(i){return i.id},read(i){return new Dd(i)}},{Class:Fy.prototype.constructor,type:5,write(i){return i.data},read(i){return new Fy(i)}},{Class:Zn.prototype.constructor,type:6,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,Zn.prototype),i}}];for(let i of aQ)EB(i);oQ=new fu({structuredClone:!0});(t=>{function i(e){return oQ.unpack(e)}t.deserialize=i})(kS||(kS={}))});var AB,Fd,CB=F(()=>{"use strict";TB();AB=i=>()=>{throw new Error(i+" is not available in the runtime build (decode-only CollabSerialize)")},Fd={deserialize:kS.deserialize,serialize:AB("CollabSerialize.serialize"),checksum:AB("CollabSerialize.checksum")}});var an=F(()=>{Vy();W3();PS();lu();Uy();IS();uu();Z3();eB();uC();nB();CS();CB();iC();DS()});function Xp(i){return i==="MouseDown"||i==="MouseUp"||i==="KeyDown"||i==="KeyUp"||i==="Collision"||i==="Trigger"}var PB,SC,Ud,VS,xC,IB,OB,RB,zS,GS,DB,LB,NB,BB,FB,jS,HS,UB,kB,VB,zB,wC=F(()=>{"use strict";an();Y();(e=>{function i(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type}e.toEventUIType=i;function t(n){return n==="Distance"||n==="StateChange"?"Conditional":n}e.fromEventUIType=t})(PB||(PB={}));SC={["LookAt"]:[],["Follow"]:["Create"],["DragDrop"]:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseHover"]:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Scroll"]:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Start"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Conditional"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MousePress"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyPress"]:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["GameControl"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],["Collision"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Trigger"]:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Resize"]:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["VariableChange"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["API"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["WEBHOOK"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["AIAssistantListener"]:["SetVariable"],["AIAssistantTrigger"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(e=>{function i(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"}e.is=i;function t(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new ze}:{type:n,disabled:!1,name:"",key:void 0,actions:new ze}}e.defaultData=t})(Ud||(Ud={}));(e=>{function i(n){return{type:"Property",value:[n??null,"position","x"]}}e.propertyDefaultData=i,e.valueDefaultData={type:"Literal",value:0}})(VS||(VS={}));(n=>{function i(r){return{type:"Comparison",operator:"==",lOperand:VS.propertyDefaultData(r),rOperand:{...VS.valueDefaultData}}}n.comparisonDefaultData=i;function t(r){return{type:"Distance",toObject:r??null,fromObject:r??null,distance:200}}n.distanceDefaultData=t;function e(r,s){return{type:"State",object:r??null,state:s??null}}n.stateDefaultData=e})(xC||(xC={}));(t=>{function i(e){return e.find(n=>n==="ifActions"||n==="elseActions")!==void 0}t.isConditionalSubActions=i})(IB||(IB={}));(e=>{function i(n){return n.type==="Conditional"}e.is=i;function t(n){return{type:"Conditional",disabled:!1,name:"",inActions:new ze,outActions:new ze,condition:xC.distanceDefaultData(n)}}e.defaultData=t})(OB||(OB={}));(t=>t.defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new ze,drop:new ze}})(RB||(RB={}));(t=>t.defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new ze})(zS||(zS={}));(t=>t.defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5})(GS||(GS={}));(e=>{function i(n){return n.type==="MouseHover"}e.is=i;function t(){return{type:"MouseHover",disabled:!1,name:"",actions:new ze}}e.defaultData=t})(DB||(DB={}));(e=>{function i(n){return n.type==="Scroll"}e.is=i;function t(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new ze}}e.defaultData=t})(LB||(LB={}));(e=>{function i(n){return n.type==="Start"}e.is=i;function t(){return{type:"Start",disabled:!1,name:"",actions:new ze}}e.defaultData=t})(NB||(NB={}));(e=>{function i(n){return n.type==="Collision"}e.is=i;function t(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new ze}}e.defaultData=t})(BB||(BB={}));(e=>{function i(n){return n.type==="Trigger"}e.is=i;function t(n,r){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new ze,triggerZone:"box",position:r.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}e.defaultData=t})(FB||(FB={}));(a=>{a.defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]};function t(o){return o.type==="Resize"}a.is=t;function e(o){return typeof o=="string"?o:"custom"}a.sizeToDevice=e;function n(o){return typeof o=="string"?[...a.defaultSizes[o]]:[...o]}a.deviceToSize=n;function r(){let o={size:"mobile",operator:"<",actions:new ze},l={size:"tablet",operator:"<",actions:new ze},c={size:[...a.defaultSizes.custom],operator:"<>",actions:new ze},u=new ze;return u.push({id:we.generateUUID(),fi:0,data:o},{id:we.generateUUID(),fi:1,data:l},{id:we.generateUUID(),fi:2,data:c}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:u}}a.defaultData=r;function s(){return{size:[...a.defaultSizes.custom],operator:"<>",actions:new ze}}a.defaultBreakpointData=s})(jS||(jS={}));(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]};function t(r){return r.type==="VariableChange"}n.is=t;function e(){return{disabled:!1,type:"VariableChange",name:"",actions:new ze,variableId:"",objectId:null,property:"Position X"}}n.defaultData=e})(HS||(HS={}));(e=>{function i(n){return n.type==="API"}e.is=i;function t(){return{disabled:!1,type:"API",name:"",successActions:new ze,errorActions:new ze,userAPIId:""}}e.defaultData=t})(UB||(UB={}));(e=>{function i(n){return n.type==="WEBHOOK"}e.is=i;function t(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new ze,userWebhookId:""}}e.defaultData=t})(kB||(kB={}));(e=>{function i(n){return n.type==="AIAssistantListener"}e.is=i;function t(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new ze,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=t})(VB||(VB={}));(e=>{function i(n){return n.type==="AIAssistantTrigger"}e.is=i;function t(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new ze}}e.defaultData=t})(zB||(zB={}))});function jB(i){let t=typeof i;return i!==null&&(t==="object"||t==="function")}function EC(i){return typeof i=="string"&&i.length===36?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(i):!1}var fa,mu,HB,Er,qS,Xs,pa,kd,GB,No,yr,zt,WS,Vd,Yp,$p,tc,_s=F(()=>{"use strict";fa="personal camera",mu="a218fcc3-276b-49b9-b485-49037fd14f5f",HB=2500134,Er=5526619,qS=(n=>(n.x="x",n.y="y",n.z="z",n))(qS||{});(p=>{function i(f,m){return f[0]===m[0]&&f[1]===m[1]}p.isEqual=i;function t(f,m,g){return[f[0]+(m[0]-f[0])*g,f[1]+(m[1]-f[1])*g]}p.lerp=t;function e(f,m){return[f[0]+m[0],f[1]+m[1]]}p.add=e;function n(f,m){return[f[0]-m[0],f[1]-m[1]]}p.sub=n;function r(f,m){return[f[0]*m[0],f[1]*m[1]]}p.multiply=r;function s(f,m){return[f[0]/m[0],f[1]/m[1]]}p.divide=s;function a(f,m){return Math.pow(m[0]-f[0],2)+Math.pow(m[1]-f[1],2)}p.distanceSquared=a;function o(f,m){return Math.sqrt(a(f,m))}p.distance=o;function l(f,m){return f[0]*m[0]+f[1]*m[1]}p.dot=l;function c(f,m){return[f[0]*m,f[1]*m]}p.scalarMultiply=c;function u(f,m,g){let y=p.sub(m,f),v=p.sub(g,f),b=p.dot(y,v)/p.dot(y,y),x=p.scalarMultiply(y,b);return p.add(f,x)}p.projectionOnto=u;function d(f,m,g){return o(f,u(f,m,g))}p.projectionOntoDistance=d;function h(f,m){return[(f[0]+m[0])*.5,(f[1]+m[1])*.5]}p.center=h})(Xs||(Xs={}));(o=>{function i(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]}o.isEqual=i;function t(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}o.add=t;function e(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]}o.sub=e;function n(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]}o.div=n;function r(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]}o.mul=r;function s(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])}o.dist=s;function a(l,c,u){return[l[0]+(c[0]-l[0])*u,l[1]+(c[1]-l[1])*u,l[2]+(c[2]-l[2])*u]}o.lerp=a})(pa||(pa={}));(e=>{function i(n,r){return n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3]}e.isEqual=i;function t(n,r,s){return[n[0]+(r[0]-n[0])*s,n[1]+(r[1]-n[1])*s,n[2]+(r[2]-n[2])*s,n[3]+(r[3]-n[3])*s]}e.lerp=t})(kd||(kd={}));(a=>{let i=180/Math.PI,t=Math.PI/180;function e(o){return typeof o=="number"?o*i:o}function n(o){return typeof o=="number"?o*t:o}function r(o){return[e(o[0]),e(o[1]),e(o[2])]}a.radToDeg=r;function s(o){return[n(o[0]),n(o[1]),n(o[2])]}a.degToRad=s})(GB||(GB={}));(r=>{r.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(s,a){for(let o=0;o<16;o++)if(s[o]!==a[o])return!1;return!0}r.isEqual=t;function e(s){return s??r.identity}r.simplify=e;function n(s,a){let o=a.slice(0);for(let l=0,c=a.length;l<c;l+=3){let u=s[3]*a[l]+s[7]*a[l+1]+s[11]*a[l+2]+s[15];o[l]=(s[0]*a[l]+s[4]*a[l+1]+s[8]*a[l+2]+s[12])/u,o[l+1]=(s[1]*a[l]+s[5]*a[l+1]+s[9]*a[l+2]+s[13])/u,o[l+2]=(s[2]*a[l]+s[6]*a[l+1]+s[10]*a[l+2]+s[14])/u}return o}r.applyMatrix4=n})(No||(No={}));(h=>{function i(p){return typeof p=="object"&&typeof p.r=="number"&&typeof p.g=="number"&&typeof p.b=="number"}h.isRGB=i,h.white={r:1,g:1,b:1},h.red={r:1,g:0,b:0},h.black={r:0,g:0,b:0};function r(p){return{r:Math.round(p.r*255),g:Math.round(p.g*255),b:Math.round(p.b*255),a:1}}h.toRgb255a1=r;function s(p){return{r:p.r,g:p.g,b:p.b}}h.clone=s;function a(p){return p=Math.floor(p),{r:(p>>16&255)/255,g:(p>>8&255)/255,b:(p&255)/255}}h.fromHex=a;function o(p){return Math.round(p.r*255)*65536+Math.round(p.g*255)*256+Math.round(p.b*255)}h.toHex=o;function l(p,f){return p.r===f.r&&p.g===f.g&&p.b===f.b}h.equals=l;function c(p,f){return p.r.toFixed(2)===f.r.toFixed(2)&&p.g.toFixed(2)===f.g.toFixed(2)&&p.b.toFixed(2)===f.b.toFixed(2)}h.equalsFixed=c;function u(p,f,m){return{r:p.r+(f.r-p.r)*m,g:p.g+(f.g-p.g)*m,b:p.b+(f.b-p.b)*m}}h.lerp=u;function d(p){return jB(p)?"r"in p&&"g"in p&&"b"in p&&!("a"in p):!1}h.is=d})(yr||(yr={}));(u=>{u.white={...yr.white,a:1};function t(d){return jB(d)?"r"in d&&"g"in d&&"b"in d&&"a"in d:!1}u.is=t,u.transparent={...yr.white,a:0};function n(d){return{r:d[0],g:d[1],b:d[2],a:d[3]}}u.from0to1=n;function r(d,h){return{...yr.fromHex(d),a:h}}u.fromHexAndA=r;function s(d){return{r:Math.round(d.r*255),g:Math.round(d.g*255),b:Math.round(d.b*255),a:d.a}}u.toRgb255a1=s;function a(d,h){return yr.equals(d,h)&&d.a===h.a}u.equals=a;function o(d,h){return yr.equalsFixed(d,h)&&d.a.toFixed(2)===h.a.toFixed(2)}u.equalsFixed=o;function l(d,h,p){return{r:d.r+(h.r-d.r)*p,g:d.g+(h.g-d.g)*p,b:d.b+(h.b-d.b)*p,a:d.a+(h.a-d.a)*p}}u.lerp=l;function c({r:d,g:h,b:p,a:f}=u.white){return`rgba(${d*255}, ${h*255}, ${p*255}, ${f})`}u.toStyle=c})(zt||(zt={}));(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]})(WS||(WS={}));Vd=(c=>(c[c.LINEAR=0]="LINEAR",c[c.EASE=1]="EASE",c[c.EASE_IN=2]="EASE_IN",c[c.EASE_OUT=3]="EASE_OUT",c[c.EASE_IN_OUT=4]="EASE_IN_OUT",c[c.CUBIC=5]="CUBIC",c[c.SPRING=6]="SPRING",c[c.ARC=7]="ARC",c[c.NONE=8]="NONE",c))(Vd||{});(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Yp||(Yp={}));(t=>t.defaultData={control1:[.5,0],control2:[.5,1]})($p||($p={}));(s=>(s.linear=[0,0,1,1],s.ease=[.25,.1,.25,1],s.easeIn=[.42,0,1,1],s.easeOut=[0,0,.58,1],s.easeInOut=[.42,0,.58,1]))(tc||(tc={}))});var WB,qB,XB,YB,$B,KB,ZB,MC,QB,JB,_C,eF,tF,nF,TC,rF,AC,iF,sF,aF,oF,lF,cF,uF,dF,hF=F(()=>{"use strict";an();wC();(t=>t.defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"})(WB||(WB={}));(t=>t.defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"})(qB||(qB={}));(t=>t.defaultData={type:"Link",name:"",url:null,context:"tab"})(XB||(XB={}));(t=>t.defaultData={type:"Destroy",name:"",objects:[],delay:0})(YB||(YB={}));(t=>t.defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"})($B||($B={}));(t=>t.defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"})(KB||(KB={}));(t=>t.defaultData={type:"Reset",name:"",delay:0})(ZB||(ZB={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1})(MC||(MC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(QB||(QB={}));(s=>(s.defaultData={type:"Audio",name:"",...MC.defaultData},s.hasAudioByActions=a=>a.some(({data:o})=>o.type==="Audio"&&o.interaction==="play"&&o.audio),s.hasAudioByEvents=a=>{for(let{data:o}of a)if(Ud.is(o)||o.type==="Start"||o.type==="Collision"){if(s.hasAudioByActions(o.actions))return!0}else if(o.type==="Conditional"){if(s.hasAudioByActions(o.inActions)||s.hasAudioByActions(o.outActions))return!0}else if(o.type==="GameControl"&&Object.values(o.gameActions).find(l=>s.hasAudioByActions(l)))return!0},s.getAudiosByActions=a=>{let o=[];return a.forEach(l=>{let c=l.data;c.type==="Audio"&&c.interaction==="play"&&c.audio&&o.push(l),c.type==="Conditional"&&(o.push(...s.getAudiosByActions(c.ifActions)),o.push(...s.getAudiosByActions(c.elseActions)))}),o},s.getAudiosByEvents=a=>{let o=[];return a.forEach(({data:l})=>{Ud.is(l)||l.type==="Collision"||l.type==="Start"||l.type==="Trigger"?o.push(...s.getAudiosByActions(l.actions)):l.type==="Conditional"?(o.push(...s.getAudiosByActions(l.inActions)),o.push(...s.getAudiosByActions(l.outActions))):l.type==="GameControl"?Object.values(l.gameActions).forEach(c=>{o.push(...s.getAudiosByActions(c))}):l.type==="DragDrop"&&(o.push(...s.getAudiosByActions(l.dragDropActions.drag)),o.push(...s.getAudiosByActions(l.dragDropActions.drop)))}),o}))(JB||(JB={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1/0})(_C||(_C={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(eF||(eF={}));(s=>(s.defaultData={type:"Video",name:"",triggerAfter:"autoplay",..._C.defaultData},s.hasVideoByActions=a=>a.some(({data:o})=>o.type==="Video"&&o.interaction==="play"&&o.layerId),s.hasVideoByObject=a=>{if(a.events){for(let{data:o}of a.events)if((Ud.is(o)||o.type==="Start")&&s.hasVideoByActions(o.actions))return!0}},s.getVideosByActions=a=>{let o=[];return a.forEach(l=>{let c=l.data;c.type==="Video"&&c.interaction==="play"&&c.layerId&&o.push(l)}),o},s.getVideosByEvents=a=>{let o=[];return a.forEach(({data:l})=>{(Ud.is(l)||l.type==="Start")&&o.push(...s.getVideosByActions(l.actions))}),o}))(tF||(tF={}));(t=>{function i(e){return{state:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}}t.defaultData=i})(nF||(nF={}));(t=>{function i(){return{tweens:new ze,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}}t.defaultData=i})(TC||(TC={}));(t=>{function i(e){return{type:"Transition",name:"",runMode:"Once",object:e??null,...TC.defaultData()}}t.defaultData=i})(rF||(rF={}));(t=>{function i(e){return{interaction:"play",timeline:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}}t.defaultData=i})(AC||(AC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(iF||(iF={}));(t=>{function i(e){return{type:"TimelineAnimation",name:"",...AC.defaultData(e)}}t.defaultData=i})(sF||(sF={}));(t=>{function i(e,n,r){return{type:"Animation",name:"",object:e,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}}t.defaultData=i})(aF||(aF={}));(t=>t.defaultData={type:"SetVariable",name:"",variableId:"",expression:[]})(oF||(oF={}));(t=>t.defaultData=()=>({type:"Conditional",name:"",ifActions:new ze,elseActions:new ze,condition:[]}))(lF||(lF={}));(t=>t.defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0})(cF||(cF={}));(t=>t.defaultData={type:"ClearLocalStorage",name:"",target:"all"})(uF||(uF={}));(t=>t.defaultData={name:"",type:"UserAPI"})(dF||(dF={}))});var pF,fF=F(()=>{"use strict";(e=>(e.emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),n=>n.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6))(pF||(pF={}))});var Qa,Ja,CC=F(()=>{"use strict";(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(n){return e.all.includes(n)}e.is=t})(Qa||(Qa={}));(p=>{p.DefaultUp=[0,1,0],p.DefaultTargetOffset=1e3,p.MinTargetOffset=.001;function n(f){return f===void 0||!Number.isFinite(f)||f<p.MinTargetOffset?p.DefaultTargetOffset:f}p.sanitizeTargetOffset=n,p.DefaultAzimuth=-24,p.DefaultElevation=15;let a=p.DefaultAzimuth*Math.PI/180,o=p.DefaultElevation*Math.PI/180,l=180/Math.PI;p.DefaultPosition=[p.DefaultTargetOffset*Math.sin(a)*Math.cos(o),p.DefaultTargetOffset*Math.sin(o),p.DefaultTargetOffset*Math.cos(a)*Math.cos(o)],p.DefaultRotation=[Math.atan2(-Math.sin(o),Math.cos(a)*Math.cos(o))*l,Math.asin(Math.sin(a)*Math.cos(o))*l,Math.atan2(Math.sin(a)*Math.sin(o),Math.cos(a))*l],p.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:p.DefaultUp,isUpVectorFlipped:!1,targetOffset:p.DefaultTargetOffset};function h(f){return f.type==="PerspectiveCamera"?f.perspective?.zoom??1:f.orthographic?.zoom??1}p.getZoom=h})(Ja||(Ja={}))});var Bo,XS,PC,YS,$S,KS,ZS,QS,IC=F(()=>{"use strict";(n=>{function i(r,s=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:Math.max(typeof r[0]=="number"?r[0]:1,typeof r[1]=="number"?r[1]:1)*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof r[0]=="number"?r[0]+r[0]:1)*s,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:r.map(a=>(typeof a=="number"?a:1)*(1+s)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}}n.defaultData=i;function t(r,s){let a={...r};if(PC.forEach(o=>{Object.assign(a,{[o]:s[o]??r[o]})}),a.radial={...r.radial},s.radial){let o=r.radial,l=s.radial;YS.forEach(c=>{Object.assign(a.radial,{[c]:l[c]??o[c]})})}if(a.linear={...r.linear},s.linear){let o=r.linear,l=s.linear;$S.forEach(c=>{Object.assign(a.linear,{[c]:l[c]??o[c]})})}if(a.grid={...r.grid},s.grid){let o=r.grid,l=s.grid;KS.forEach(c=>{Object.assign(a.grid,{[c]:l[c]??o[c]})})}if(a.toObject={...r.toObject},s.toObject){let o=r.toObject,l=s.toObject;ZS.forEach(c=>{Object.assign(a.toObject,{[c]:l[c]??o[c]})})}if(a.randomnessObject={...r.randomnessObject},s.randomnessObject){let o=r.randomnessObject,l=s.randomnessObject;QS.forEach(c=>{Object.assign(a.randomnessObject,{[c]:l[c]??o[c]})})}return a}n.merge=t;function e(r){return!!(r.randomnessObject||r.toObject)}n.isPartial=e})(Bo||(Bo={}));(n=>{n.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function e(r,s){let a=[];r.count!==void 0&&a.push({type:0,path:s,props:{count:r.count}});for(let o of t){let l=r[o];l&&Object.keys(l).length>0&&a.push({type:0,path:[...s,o],props:l})}return a}n.toOps=e})(XS||(XS={}));PC=["count"],YS=["radius","start","end","position","scale","rotation"],$S=["position","scale","rotation"],KS=["count","size"],ZS=["count","position","scale","rotation"],QS=["strength","scale","rotation","position","movement","seed","freqScale"]});var JS,e1,OC=F(()=>{"use strict";_s();(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(n){return e.all.includes(n)}e.is=t})(JS||(JS={}));(e=>{function i(n){return t(n)}e.defaultData=i;function t(n){if(n==="PointLight")return{type:n,color:zt.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(n==="SpotLight")return{type:n,color:zt.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(n==="DirectionalLight")return{type:n,color:zt.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(e1||(e1={}))});var Kp,RC=F(()=>{"use strict";(n=>(n.defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},n.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},n.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:n.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...n.defaultCollisionData}))(Kp||(Kp={}))});var t1,DC=F(()=>{"use strict";(e=>(e.defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},e.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]))(t1||(t1={}))});var gu,n1=F(()=>{"use strict";(t=>t.defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]})(gu||(gu={}))});var i1,LC,NC,r1,mF,BC=F(()=>{"use strict";i1=(n=>(n[n.Front=0]="Front",n[n.Back=1]="Back",n[n.Double=2]="Double",n))(i1||{});(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(n,r){return n.castShadow===r.castShadow&&n.receiveShadow===r.receiveShadow}e.equals=t})(LC||(LC={}));(e=>{e.defaultData={flatShading:!1,wireframe:!1,side:0};function t(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}e.equals=t})(NC||(NC={}));(t=>t.defaultData={...NC.defaultData,...LC.defaultData})(r1||(r1={}));(t=>{function i(e,n){let r=[];if("material"in e){let s=typeof e.material=="string"?n.materials[e.material]??n.lib.materials[e.material]?.asset:e.material;s&&r.push(s)}else if("materials"in e)for(let s of e.materials){let a=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;a&&r.push(a)}return r}t.getMaterialData=i})(mF||(mF={}))});var Zp,FC=F(()=>{"use strict";(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(Zp||(Zp={}))});function bF(i){return i.type!=="displace"}var gF,yF,jy,vF,s1,Qp,a1,UC,kC,o1,VC,zC,l1,xF,Qn,An,Hy=F(()=>{"use strict";an();_s();FC();_s();(t=>{function i(e){return e==="texture"||e==="video"||e==="color"||e==="depth"||e==="normal"||e==="gradient"||e==="noise"||e==="fresnel"||e==="cavity"||e==="dust"||e==="rainbow"||e==="toon"||e==="outline"||e==="particle"||e==="transmission"||e==="reflection"||e==="matcap"||e==="displace"||e==="pattern"||e==="vertexColor"||e==="light"}t.is=i})(gF||(gF={}));(t=>{function i(e){return e==="luminance"||e==="r"||e==="g"||e==="b"||e==="a"}t.is=i})(yF||(yF={}));(t=>{function i(e){return typeof e=="object"&&e!==null&&e.image!=null}t.is=i})(jy||(jy={}));(t=>{function i(e){return e==="phong"||e==="toon"||e==="lambert"||e==="physical"}t.is=i})(vF||(vF={}));s1=(n=>(n[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",n))(s1||{}),Qp=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(Qp||{}),a1=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(a1||{}),UC=(s=>(s[s.UV=0]="UV",s[s.Planar=1]="Planar",s[s.Spherical=2]="Spherical",s[s.Cylindrical=3]="Cylindrical",s[s.Triplanar=4]="Triplanar",s))(UC||{}),kC=(a=>(a[a.Simplex=0]="Simplex",a[a.SimplexFractal=1]="SimplexFractal",a[a.Ashima=2]="Ashima",a[a.Fbm=3]="Fbm",a[a.Perlin=4]="Perlin",a[a.Voronoi=5]="Voronoi",a))(kC||{}),o1=(l=>(l[l.F1=0]="F1",l[l.F2=1]="F2",l[l.F2MinusF1=2]="F2MinusF1",l[l.SmoothBlend=3]="SmoothBlend",l[l.Edge=4]="Edge",l[l.Power=5]="Power",l[l.Lines=6]="Lines",l[l.Cells=7]="Cells",l))(o1||{}),VC=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(VC||{}),zC=(l=>(l[l.Circle=0]="Circle",l[l.Ring=1]="Ring",l[l.Polygon=2]="Polygon",l[l.Cross=3]="Cross",l[l.Diamond=4]="Diamond",l[l.Checkerboard=5]="Checkerboard",l[l.Line=6]="Line",l[l.Wave=7]="Wave",l))(zC||{}),l1=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],xF=["wrapping","image","video","name","minFilter","magFilter"];(s=>{function i(a,o){let{texture:l,...c}=o;if(Object.assign(a,c),l){let u=a.texture;u&&Object.assign(u,l)}}s.patch=i;function t(a){return{...s.defaultData("color"),color:a}}s.defaultColorLayer=t;function e(a,o){return a==="light"&&o?n(o):r(a)}s.defaultData=e;function n(a){let o={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(a){case"phong":return{...o,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...o,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...o,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...o,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}function r(a){let o={alpha:1,mode:0,isMask:!1,visible:!0};switch(a){case"texture":return{...o,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...o,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Zp.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...o,type:"color",color:yr.fromHex(Er)};case"vertexColor":return{...o,type:"vertexColor"};case"depth":return{...o,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...o,type:"normal",cnormal:[1,1,1]};case"gradient":return{...o,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...o,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...yr.fromHex(6710886),a:1},colorB:{...yr.fromHex(6710886),a:1},colorC:{...yr.fromHex(16777215),a:1},colorD:{...yr.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...o,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...o,type:"fresnel",color:zt.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...o,type:"dust",color:zt.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...o,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...o,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:zt.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...o,type:"outline",outlineColor:zt.fromHexAndA(0,1),contourColor:zt.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...o,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...o,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...o,type:"reflection",blur:0,thickness:10/1e4,steps:60,stepSize:5/1e3,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...o,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...yr.fromHex(0),a:1},colorB:{...yr.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}})(Qn||(Qn={}));(u=>{function i(d){return!d.layers.some(p=>p.data.type==="texture"&&p.data.projection!==0||p.data.type==="depth"&&!p.data.isWorldSpace||p.data.type==="noise"||p.data.type==="dust"&&p.data.noiseStrength!==0||p.data.type==="displace")}u.isMergable=i;function t(d){let h="";return d.layers.forEach(p=>{Object.entries(p.data).forEach(([f,m])=>{h+=`${f}${m}`,Array.isArray(m)?m.forEach(g=>h+=`${g}`):typeof m=="object"?Object.values(m).forEach(g=>{typeof g=="number"?h+=`${g.toFixed(4)}`:h+=`${g}`}):h+=`${m}`})}),h}u.getHash=t;function e(){return{layers:new ze}}u.defaultEmptyData=e;function n(d="layer1",h="layer2"){return s("physical",d,h)}u.defaultData=n;function r(d,h){return{...d,name:h}}u.withName=r;function s(d,h="layer1",p="layer2",f=yr.fromHex(16777215)){let m=new ze;return m.push({fi:0,data:Qn.defaultData("light",d),id:h}),m.push({fi:1,data:Qn.defaultData("color"),id:p}),{layers:m}}u.defaultTwoLayerData=s;function a(d,h,p="layer1",f="layer2"){let m=new ze;return m.push({fi:0,data:Qn.defaultData("light",h),id:p}),m.push({fi:1,data:Qn.defaultColorLayer(d),id:f}),{layers:m}}u.defaultColorMaterial=a;function o(d){let h=Qn.defaultData("texture");d&&Object.assign(h.texture,{image:d});let p=new ze;return p.push({fi:0,data:h,id:"layer1"}),p.push({fi:1,data:{...Qn.defaultData("transmission"),alpha:1},id:"layer2"}),p.push({fi:2,data:{...Qn.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:p}}u.defaultUIObjectMaterial=o;function l(d,h="physical",p="layer1",f="layer2"){let m=Qn.defaultData("texture");Object.assign(m.texture,{image:d});let g=new ze;return g.push({fi:0,data:m,id:p}),g.push({fi:1,data:Qn.defaultData("light",h),id:f}),{layers:g}}u.defaultTwoLayerTextureData=l;function c(d,h="physical",p="layer1",f="layer2"){let m=Qn.defaultData("video");Object.assign(m.texture,{video:d});let g=new ze;return g.push({fi:0,data:m,id:p}),g.push({fi:1,data:Qn.defaultData("light",h),id:f}),{layers:g}}u.defaultTwoLayerVideoTextureData=c})(An||(An={}))});var Jp,SF,wF=F(()=>{"use strict";Jp="Roboto_regular",SF="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"});var zd,GC=F(()=>{"use strict";an();(t=>{function i(){return{points:new ze,roundness:0,shapeHoles:[],isClosed:!1}}t.defaultData=i})(zd||(zd={}))});var ef,Gd,c1,u1,d1,jC=F(()=>{"use strict";an();(t=>{function i(){return{points:new ze,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}t.defaultData=i})(ef||(ef={}));Gd={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(t=>{function i(e,n){let r={...e};return d1.forEach(s=>{Object.assign(r,{[s]:n[s]??e[s]})}),r}t.merge=i})(c1||(c1={}));u1={shape:Gd,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},d1=["depth","offset","angle","twist","startScale","endScale"]});var Wy,h1,ma,p1,f1=F(()=>{"use strict";GC();jC();(n=>{function i(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="UIGeometry"}n.is2DParametricMesh=i;function t(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="BooleanGeometry"||r==="TextGeometry"||r==="InputGeometry"||r==="DecalGeometry"}n.isParametricMesh=t;function e(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="TextGeometry"||r==="SubdivGeometry"||r==="NonParametricGeometry"}n.isSwappableGeometry=e})(Wy||(Wy={}));(t=>{function i(e,n){let r={...e};return Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...e.extrusion},Object.assign(r.extrusion,c1.merge(r.extrusion,n.extrusion))),r}t.merge=i})(h1||(h1={}));(t=>{function i(e){if(e==="RectangleGeometry")return{width:320,height:320,type:e,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="UIGeometry")return{type:e,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(e==="PathGeometry")return{type:e,width:1,height:1,depth:1,path:ef.defaultData(),extrusion:u1};if(e==="VectorGeometry")return{width:1,height:1,type:e,subdivisions:12,shape:zd.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="BooleanGeometry")return{type:e,operation:2,width:0,height:0,depth:0,phongAngle:35};if(e==="ShapeBlendGeometry")return{type:e,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(e==="DecalGeometry")return{type:e,width:200,height:200,depth:200,offset:1};if(e==="TextGeometry")return{type:e,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(e==="InputGeometry")return{...t.defaultData("TextGeometry"),type:e,editable:!0};if(e==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")}t.defaultData=i})(ma||(ma={}));p1=["width","height","depth"]});var Fr,HC=F(()=>{"use strict";_s();(a=>{a.defaultData={enabled:!1,useBackgroundColor:!1,color:yr.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0};function t(o){return o.mode??"linear"}a.getMode=t;function e(o){let l=t(o);return l==="height"?1:l==="both"?2:0}a.getModeIndex=e;function n(o){return o.density??a.defaultData.density}a.getDensity=n;function r(o){return o.heightFalloff??a.defaultData.heightFalloff}a.getHeightFalloff=r;function s(o){return o.heightBase??a.defaultData.heightBase}a.getHeightBase=s})(Fr||(Fr={}))});var WC,Fo,m1=F(()=>{"use strict";(t=>t.defaultData={image:null,rotation:0,blur:32,showBackground:!0})(WC||(WC={}));(t=>t.defaultData={enabled:!1,mode:"hdri",hdri:WC.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2})(Fo||(Fo={}))});var tf,qC=F(()=>{"use strict";(e=>{let i={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:{...i,blendFunction:16,granularity:15},bloom:{...i,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...i,offset:[2,2]},vignette:{...i,darkness:1,offset:0},hueSaturation:{...i,hue:3,saturation:0},brightnessContrast:{...i,brightness:.25,contrast:0},depthOfField:{...i,focusDistance:100,focalLength:20,bokehScale:5},noise:{...i,blendFunction:16}}})(tf||(tf={}))});var jd,XC,YC,$C,yu,KC,g1,y1=F(()=>{"use strict";HC();m1();qC();_s();(e=>{e.defaultData={type:"normal",softShadowQuality:"low"};function t(n){return n==null?!1:n.type===void 0||n.type==="soft"}e.isSoft=t})(jd||(jd={}));(t=>t.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(XC||(XC={}));(t=>t.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(YC||(YC={}));(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1};function t(n){return n===void 0||n.pipeline==="classic"&&(n.toneMapping==="none"||n.toneMapping==="aces")&&n.exposure===1}e.isUntouched=t})($C||($C={}));(t=>t.defaultData={usePhysics:!1,gravity:-10})(yu||(yu={}));(t=>t.defaultData={playCamera:fa,gameControlObject:null})(KC||(KC={}));(t=>t.defaultData={backgroundColor:zt.fromHexAndA(HB,1),postprocessing:tf.defaultData,fog:Fr.defaultData,sky:Fo.defaultData,globalPhysics:yu.defaultData,ambient:XC.defaultData,ao:YC.defaultData,shadow:jd.defaultData,publish:KC.defaultData,grading:$C.defaultData})(g1||(g1={}))});var v1,EF=F(()=>{"use strict";(t=>t.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(v1||(v1={}))});var MF,nf,IF,Ur,rf,_F,TF,AF,CF,ga,Hd,sf,af,ya,eo,PF,to,qy=F(()=>{"use strict";an();CC();OC();RC();DC();n1();BC();_s();Hy();f1();IC();mi();y1();EF();(e=>{function i(n){return n==="Component"||n==="Instance"}e.isComponentRelated=i;function t(n){return n==="Empty"||n==="Instance"}e.isEmptyOrComponent=t})(MF||(MF={}));(r=>{r.identity={...WS.identity,hiddenMatrix:No.identity};function t(s){return{position:s.position,rotation:s.rotation,scale:s.scale,pivot:s.pivot,pivotRotation:s.pivotRotation,hiddenMatrix:s.hiddenMatrix}}r.fromObject=t;function e(s,a){return{position:a?.position||s.position,rotation:a?.rotation||s.rotation,pivot:a?.pivot||s.pivot,pivotRotation:a?.pivotRotation||s.pivotRotation,scale:a?.scale||s.scale,hiddenMatrix:a?.hiddenMatrix||s.hiddenMatrix}}r.merge=e;function n(s,a){return TS({position:pa.isEqual(s.position,a.position)?void 0:a.position,rotation:pa.isEqual(s.rotation,a.rotation)?void 0:a.rotation,scale:pa.isEqual(s.scale,a.scale)?null:a.scale,hiddenMatrix:No.isEqual(s.hiddenMatrix,a.hiddenMatrix)?void 0:a.hiddenMatrix})}r.diff=n})(nf||(nf={}));IF=["slide","offset"];(t=>t.defaultData={states:new ze,events:new ze,timelineAnimations:new st,visible:!0,raycastLock:!1,physics:gu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...nf.identity,cloner:null})(Ur||(Ur={}));(t=>t.defaultData={type:"Empty",...Ur.defaultData})(rf||(rf={}));(t=>t.defaultData={type:"ParticleCollider",...v1.defaultData,...Ur.defaultData})(_F||(_F={}));(t=>t.defaultData={type:"Component",...Ur.defaultData})(TF||(TF={}));(t=>t.defaultData={type:"Particle",...Ur.defaultData,...Kp.defaultData})(AF||(AF={}));(t=>t.defaultData={type:"Hair",...Ur.defaultData,...t1.defaultData})(CF||(CF={}));(t=>t.defaultData={type:"Mesh",...Ur.defaultData,...r1.defaultData})(ga||(ga={}));(t=>t.defaultData={...Ur.defaultData,...nf.identity,position:Ja.DefaultPosition,rotation:Ja.DefaultRotation,...Ja.defaultData})(Hd||(Hd={}));(e=>{function i(n){return{...Ur.defaultData,...e1.defaultData(n)}}e.defaultData=i,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(sf||(sf={}));(e=>{function i(n,r,s=0){for(;s<r.length;){let a=n?n[r[s]]:void 0;if(r.length===s+1)return a;if(a)n=a.descendants,s+=1;else return}}e.resolveWithDes=i;function t(n,r,s=0){let a=i(n,r,s);if(a){let o=Object.keys(a);if(o.length===1&&o[0]==="descendants")return}return a}e.resolve=t})(af||(af={}));(s=>{s.rootOverrideProps=["physics","events"],s.compositeNonOptionalOverrideProps=["geometry"],s.compositeEntireOverrideOverrideProps=["material"];function n(a,o){return{...Ur.defaultData,...o,component:a,overrides:new Zn,physics:void 0,events:void 0,type:"Instance"}}s.ofComponent=n;function r(a){let o=nf.fromObject(a.data);return n(a.id,o)}s.fromComponentData=r})(ya||(ya={}));(e=>{e.defaultData={type:"Page",...Ur.defaultData,physics:{...gu.defaultData,fusedBody:!1},...g1.defaultData,camera:Hd.defaultData};function t(n){return n.uiScene!==void 0}e.isUIPage=t})(eo||(eo={}));(o=>(o.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:No.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:gu.defaultData,states:new ze,events:new ze,timelineAnimations:new st,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Ja.defaultData},o.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},o.defaultMeshObject={name:"Rectangle",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("RectangleGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},o.defaultBooleanObject={name:"Boolean",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("BooleanGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},o.defaultShapeBlendObject={name:"Shape Blend",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("ShapeBlendGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},o.defaultTextObject={name:"Text",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("TextGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},o.defaultInputObject={name:"Input",...Ur.defaultData,...ga.defaultData,geometry:ma.defaultData("InputGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")}))(PF||(PF={}));(r=>{function i(s,a){let o={name:a};return s.type==="Mesh"?(o.geometry={},"material"in s&&(o.material={layers:new Zn}),"materials"in s&&(o.materials=s.materials.map(l=>({layers:new Zn})))):Qa.is(s.type)&&(o.perspective={},o.orthographic={}),o}r.newEmpty=i;function t(s,a){if(a===void 0)return s;let o={...s};return"material"in o&&"material"in a&&a.material&&(o.material=du(o.material,l=>{if(typeof l!="string")for(let[c,u]of Object.entries(a.material.layers)){let d=l.layers.data(c);d&&Qn.patch(d,u)}}).data),o.materials&&a.materials&&(o.materials=du(o.materials,l=>{for(let c=0;c<o.materials.length;c++){let u=a.materials[c];if(typeof u!="string")for(let[d,h]of Object.entries(u.layers)){let p=l[c]?.layers?.data(d);p&&Qn.patch(p,h)}}}).data),o}function e(s,a){let o,l=[],c={orthographic:0,perspective:0,geometry:0};function u(d,h){for(let[p,f]of Object.entries(h.layers)){let{texture:m,...g}=f;if(m!==void 0&&Object.keys(m).length>0){let y={path:[...d,"layers",p,"texture"],props:m,type:0};l.push(y)}if(Object.keys(g).length>0){let y={path:[...d,"layers",p],props:g,type:0};l.push(y)}}}for(let[d,h]of Object.entries(a)){let p=h;if(d!=="name")if(d==="cloner")l.push(...XS.toOps(p,["cloner"]));else if(d==="pathSnapping")l.push({path:[d],props:{slide:p.slide,offset:p.offset},type:0});else if(d==="material")u(["material"],p);else if(d==="materials")for(let[f,m]of Object.entries(p))u(["materials",f],m);else if(c[d]===0){if(d==="geometry"&&p.extrusion!==void 0){let f={path:[d,"extrusion"],props:p.extrusion,type:0};l.push(f),p={...p},delete p.extrusion}if(Object.keys(p).length>0){let f={path:[d],props:p,type:0};l.push(f)}}else o===void 0&&(o={path:[],props:{},type:0},l.push(o)),o.props[d]=p}return l}r.toOps=e;function n(s,a){if(a===void 0)return s;let o={...s};if(Object.assign(o,nf.merge(o,a)),Object.assign(o,{pathSnapping:Object.assign({},o.pathSnapping,{slide:a.pathSnapping?.slide??o.pathSnapping?.slide??0,offset:a.pathSnapping?.offset??o.pathSnapping?.offset??0})}),Qa.is(s.type)){o.orthographic={...o.orthographic},o.perspective={...o.perspective};let l=a;l.orthographic?.zoom!==void 0&&(o.orthographic.zoom=l.orthographic.zoom),l.perspective?.zoom!==void 0&&(o.perspective.zoom=l.perspective.zoom),l.isUpVectorFlipped!==void 0&&(o.isUpVectorFlipped=l.isUpVectorFlipped),l.targetOffset!==void 0&&(o.targetOffset=l.targetOffset)}else if(s.type==="Mesh")"geometry"in a&&Object.assign(o,{geometry:h1.merge(o.geometry,a.geometry)}),(a.material||a.materials)&&(o=t(o,a)),o.cloner&&"cloner"in a&&Object.assign(o,{cloner:Bo.merge(o.cloner,a.cloner)});else if(s.type==="Empty")o.cloner&&"cloner"in a&&Object.assign(o,{cloner:Bo.merge(o.cloner,a.cloner)});else if(JS.is(s.type)){let l=a;l.intensity!==void 0&&(o.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?o.color=l.color:o.color=yr.clone(l.color))}return o}r.patch=n})(to||(to={}))});var of,b1=F(()=>{"use strict";(t=>t.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0})(of||(of={}))});var va,Xy=F(()=>{"use strict";b1();_s();(t=>t.defaultData={orbitControls:of.defaultData,playPage:mu,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,n)=>{let r=0,s=0;return n<5?s=-30:n<10&&(s=30),n===0||n===10||n===5?r=30:(n===4||n===11||n===9)&&(r=-30),[120,[r,s],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0})(va||(va={}))});var ZC,QC,rc,JC=F(()=>{"use strict";(t=>t.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(ZC||(ZC={}));(t=>t.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(QC||(QC={}));(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...ZC.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:QC.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(rc||(rc={}))});var Uo,ic,x1=F(()=>{"use strict";qy();an();Xy();_s();mi();JC();(n=>{function i(r){return r.find(s=>s.data.type==="Page"&&s.data.globalPhysics.usePhysics)!==void 0}n.physicsEnabled=i;function t(r,s){let a=r.scene.objects.get(s);if(a&&a.data.type==="Component")return a;{let o=r.shared.lib.components[s];if(o)return{...o.asset,id:s}}}n.getComponentData=t;function e(r,s,a){r.scene.objects.traverseFrom(s,(o,l)=>{if(l.type==="Instance"){let c=t(r,l.component)?.data;c&&a(o,l,c.events)}else a(o,l,l.events)})}n.traverseModuleInstances=e})(Uo||(Uo={}));(c=>{c.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",c.defaultLight={fi:-1,data:sf.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]};function e(u=!0,d=[]){let h=[];u&&h.push({...c.defaultLight}),h.push(...d);let p=new Ln;return p.push({fi:1,id:mu,data:{...eo.defaultData,name:"Scene 1"},children:h}),p}c.createDefaultObjectTreeWithPage=e,c.defaultData={objects:e(),publish:va.defaultData,styles:rc.defaultData()},c.emptyDataWithoutPage=function(){return{objects:new Ln,publish:va.defaultData,styles:rc.defaultData()}},c.emptyDataWithPage=function(u=!0){return{objects:e(u),publish:va.defaultData,styles:rc.defaultData()}},c.emptyData=function(){return{objects:new Ln,publish:{...va.defaultData},styles:rc.defaultData()}};function o(u){return{...c.defaultData,objects:fi(u,Ln.prototype)}}c.withObjs=o;function l(u,d){return o([{id:u,data:d,children:[],fi:0}])}c.withObj=l})(ic||(ic={}))});var lf,eP=F(()=>{"use strict";(t=>t.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}})(lf||(lf={}))});var S1,OF,Mr,tP,RF,DF,no,os,w1=F(()=>{"use strict";an();mi();(e=>(e.defaultData=n=>({url:n,name:"New Webhook",parametersSchemas:new ze}),e.defaultParameterValueByType=n=>n==="number"?0:n==="boolean"?!1:""))(S1||(S1={}));(t=>t.defaultData=(e,n="GET")=>({url:e,method:n,name:"New API",headers:new ze,queries:new ze,autoStart:!0}))(OF||(OF={}));(s=>{function i(a){return a.textValue!==void 0}s.isTextValue=i;function t(a){return typeof a=="number"}s.isNumber=t;function e(a){return typeof a=="boolean"}s.isBoolean=e;function n(a){return i(a)?"string":e(a)?"boolean":"number"}s.typeOfVariable=n;function r(a){return s.isTextValue(a)?Array.isArray(a.textValue)?a.textValue.map(o=>o.toString().padStart(a.padding??2,"0")).join(a.deliminator??":")+(a.suffix!==void 0?" "+a.suffix:""):a.textValue.toString():s.isBoolean(a)?a?"True":"False":s.isNumber(a)?parseFloat(a.toFixed(3)).toString():a.toString()}s.getDisplayedValue=r})(Mr||(Mr={}));(t=>t.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(tP||(tP={}));(t=>t.all=[...tP.all,"components"])(RF||(RF={}));(t=>{function i(){return{images:new st,videos:new st,colors:new st,audios:new st,particles:new st,fonts:new st,materials:new st,components:new st,variables:new st,userAPIs:new st,userWebhooks:new st,timelineAnimations:new st}}t.defaultData=i})(DF||(DF={}));(t=>{function i(){return{images:new st,videos:new st,colors:new st,audios:new st,particles:new st,fonts:new st,materials:new st,components:new st,variables:new st,userAPIs:new st,userWebhooks:new st,timelineAnimations:new st}}t.defaultData=i})(no||(no={}));(s=>{function i(){let a={};return a["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},fi(a,st.prototype)}s.defaultColors=i;function t(){return fi({},st.prototype)}s.defaultImages=t;function e(){return{catelogs:new st,materials:new st,images:new st,videos:new st,colors:new st,timelineAnimations:new st,audios:new st,particles:new st,fonts:new st,variables:new ze,userAPIs:new st,userWebhooks:new st,lib:no.defaultData()}}s.emptyData=e;function n(a){switch(a){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let o=[0,0,0];return{name:"Time",value:{textValue:o,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:o,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",a)}}s.defaultVariables=n;function r(a,o){if(o.format==="HH:mm:ss"){let l=Math.floor(a/3600),c=Math.floor((a-l*3600)/60),u=Math.round(a-l*3600-c*60);return{textValue:[l,c,u]}}else if(o.format==="mm:ss"){let l=Math.floor(a/60),c=Math.round(a-l*60);return{textValue:[l,c]}}else return o.format==="number"?a=Math.round(a):a=Math.round(a*1e3)/1e3,a}s.getFormattedTimerTime=r})(os||(os={}))});var LF=F(()=>{"use strict"});var vu,nP=F(()=>{"use strict";an();x1();eP();w1();(l=>{l.defaultData={schema:130,scene:ic.defaultData,frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",lf.defaultData),shared:{...os.emptyData(),colors:os.defaultColors()}},l.createDefaultData=function(){return Fd.deserialize(Fd.serialize(l.defaultData))},l.emptyDataForImports=function(){let c=ic.emptyDataWithPage();return{schema:130,scene:c,frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",lf.defaultData),shared:{...os.emptyData(),colors:os.defaultColors(),images:os.defaultImages()}}},l.emptyData=function(){return{schema:130,scene:ic.emptyDataWithPage(),frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",lf.defaultData),shared:os.emptyData()}},l.clipboard2dData=function(){return{schema:130,scene:ic.emptyData(),frames:new st,shared:os.emptyData()}};function s(c){return{...c,shared:{...c.shared,lib:no.defaultData()}}}l.withoutLib=s;function a(c,u){return Uo.getComponentData(c,u)}l.getComponentData=a;function o(c){let u=Object.values(c.shared.userAPIs);for(let d of u){let h=d.headers;for(let p of h)if(p.data.key.toLowerCase()==="authorization"&&p.data.value!=="")return!0}return!1}l.hasSensitiveData=o})(vu||(vu={}))});var E1,NF=F(()=>{"use strict";(t=>t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"})(E1||(E1={}))});var cf,uf,M1=F(()=>{"use strict";_s();an();(t=>t.list=["idle","move","jump","run"])(cf||(cf={}));(e=>(e.defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:e.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new ze,move:new ze,jump:new ze,run:new ze},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:zt.fromHexAndA(3728051,1)}}))(uf||(uf={}))});function Wd(i,...t){let e={};for(let n of t.flat())i!=null&&n in i&&(e[n]=i[n]);return e}function BF(i){i.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let e=t.colorA,n=t.colorB,r=[[e.r,e.g,e.b,e.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let o=2;o<10;o++)r.push(r[1]),s.push(1);let a={...Wd(Pr(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,a)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let e={...Pr(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,e)}})}function Vo(i,t){Object.values(i.shared.materials).forEach(e=>t(e))}function zo(i,t){i.scene.objects.traverse((e,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=An.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&t(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=An.defaultTwoLayerData("phong")),t(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=An.defaultTwoLayerData("phong")),t(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==Zn.prototype&&t(r.material)})})}function lQ(i){Object.assign(i.scene.publish,{orbitControls:{...of.defaultData,...Pr(i.scene.publish.orbitControls)}})}function cQ(i){Object.assign(i.scene.publish.settings,{video:{...va.defaultData.settings.video,...Pr(i.scene.publish.settings.video)}})}function uQ(i){function t(e){if(e.layers){for(let n of Object.values(e.layers))if(n){for(let[r,s]of Object.entries(n))if((l1.includes(r)||typeof s=="boolean")&&delete n[r],r==="texture")for(let[a,o]of Object.entries(s))(xF.includes(a)||typeof o=="boolean")&&delete s[a]}}}i.scene.objects.traverse((e,n)=>{n.states.forEach(r=>{let s=r;s.material?t(s.material):s.materials&&s.materials.forEach(a=>{t(a)})})})}function dQ(i){i.scene.publish.withBackground=!0}function hQ(i){i.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function pQ(i){i.scene.objects.traverse((t,e)=>{let n=e.cloner;n&&(n.radial.scale=n.radial.scale.map(r=>r+1),n.linear.scale=n.linear.scale.map(r=>r+1))})}function fQ(i){i.scene.objects.traverse((t,e)=>{let n=e.geometry;n&&(n.type==="DodecahedronGeometry"||n.type==="IcosahedronGeometry")&&(n.detail=Math.round(n.detail))})}function mQ(i){i.scene.objects.traverse((t,e)=>{let n=i.scene.objects.unproxy().parent(t);if(n){let r=Pr(i.scene.objects.data(n));r&&r.type==="Mesh"&&r.geometry.type==="BooleanGeometry"&&e.type==="Mesh"&&(e.visible=Pr(e).booleanExclude!==!0)}})}function gQ(i){i.scene.objects.traverse((t,e)=>{if(e.type==="Mesh"){let n=e;e.geometry.type==="NonParametricGeometry"?n.material!==void 0&&delete n.material:n.materials!==void 0&&delete n.materials}})}function yQ(i){function t(n){Object.setPrototypeOf(n,Zn.prototype),n.texture&&Object.setPrototypeOf(n.texture,Zn.prototype)}function e(n){Object.setPrototypeOf(n,Zn.prototype);for(let r in n)t(n[r])}i.scene.objects.traverse((n,r)=>{r.states.forEach(s=>{let a=s;if(a.material){let o=Pr(a.material).layers;e(o),a.material.layers=o}if(a.materials)for(let o=0;o<a.materials.length;o++){let l=a.materials[o],c=Pr(l).layers;e(c),l.layers=c}})})}function FF(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("lambert"))}function rP(i){!i.layers||i.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let e=[...t.colors];e.push(t.colors[9]);let n=[...t.steps];n.push(t.steps[9]);let r={...Pr(t),colors:e,steps:n};Object.assign(t,r)}})}function vQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&(e.geometry.type==="BooleanGeometry"||e.geometry.type==="SubdivGeometry")&&(e.geometry.phongAngle=35)})}function UF(i){i.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(n=>{typeof n!="string"&&rP(n)}):"material"in e&&typeof e.material!="string"&&rP(e.material)}),Object.values(i.shared.materials).forEach(t=>rP(t))}function bQ(i){i.scene.environment.ambientLight.softShadows=!1,i.scene.environment.ambientLight.softShadowQuality="low",i.scene.objects.traverse((t,e)=>{(e.type==="DirectionalLight"||e.type==="SpotLight")&&(e.shadowResolution=1024,e.shadowRadius=1,e.depth=1e5)}),i.shared.penumbraSize=new Array(5).fill(.5)}function xQ(i){i.shared.audios=fi({},st.prototype)}function SQ(i){i.shared.videos=fi({},st.prototype)}function wQ(i){let t=i.shared.materials;Object.entries(t).forEach(([e,n])=>{if(!n.layers){let r={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(t,{[e]:r})}})}function EQ(i){Object.entries(Pr(i.shared.images)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete i.shared.images[n]}),Object.entries(Pr(i.shared.audios)).filter(n=>n[1].asset===!1).map(n=>n[0]).forEach(n=>{delete i.shared.audios[n]})}function MQ(i){i.scene.publish.settings.web.preload=!1}function kF(i){i.layers&&i.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function VF(i){i.layers&&i.layers.forEach(t=>{bF(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function _Q(i){i.shared.fonts=fi({},st.prototype)}function TQ(i){return i.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function AQ(i){let t=[];i.scene.objects.traverse((e,n)=>{let r=n;if(r.type==="TextFrame"){let s=An.defaultTwoLayerData("phong"),a=typeof r.color=="string"?i.shared.colors[r.color]:r.color;s.layers[1].data.color={r:a.r,g:a.g,b:a.b},s.layers[1].data.alpha=r.alpha;let o=TQ(r.font);i.shared.fonts[o]===void 0&&(i.shared.fonts[o]={name:o});let l={name:r.name,...Ur.defaultData,...ga.defaultData,flatShading:!1,wireframe:!1,geometry:{...ma.defaultData("TextGeometry"),width:r.width,height:r.height,font:o,depth:0,horizontalAlign:r.horizontalAlign,verticalAlign:r.verticalAlign,fontSize:r.fontSize*1.40625,lineHeight:r.lineHeight/1.40625,letterSpacing:r.letterSpacing-1,text:r.text,textTransform:r.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:s,states:Pr(r.states),events:Pr(r.events),visible:r.visible,raycastLock:r.raycastLock,position:r.position,rotation:r.rotation,scale:r.scale,hiddenMatrix:r.hiddenMatrix},c=Pr(i.scene.objects).parent(e);i.scene.objects.insertAfter(c??null,e,[{id:e+"new",data:l,children:[]}]),t.push(e)}}),t.forEach(e=>{i.scene.objects.delete(e)})}function CQ(i){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};i.scene.objects.traverse((e,n)=>{n.events.forEach(r=>{if(!!t[Number(r.type)])if(Object.assign(r,{type:t[Number(r.type)]}),r.type==="Audio"&&"audioEvent"in r&&(Object.assign(r,{playAudio:r.audioEvent}),delete r.audioEvent),r.type==="GameControl")Object.assign(r,{gameActions:{idle:new ze,move:new ze,jump:new ze}});else{let s=new ze;Object.assign(r,{actions:s}),(r.type==="MouseDown"||r.type==="MouseUp"||r.type==="KeyDown"||r.type==="KeyUp")&&"url"in r&&s.push({fi:0,id:we.generateUUID(),data:{type:"Link",url:r.url,delay:0}}),"targets"in r&&(r.targets.forEach((a,o,l)=>{let c={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},u={easing:a.easing,duration:a.duration};a.easing===6?Object.assign(u,Wd(a,"mass","stiffness","damping","velocity")):a.easing===5&&Object.assign(u,{control1:{...a.control1},control2:{...a.control2}});let d={repeat:a.repeat?-1:0,delay:a.delay,delayDirection:a.delayDirection,direction:a.cycle&&a.rewind?"pingpong-rewind":a.cycle?"pingpong":"normal"},h={state:a.state,...d,...u},p={allowSlerp:!0,type:"Transition",object:a.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new ze({fi:0,id:we.generateUUID(),data:c},{fi:1,id:we.generateUUID(),data:h})};s.push({fi:l,id:o,data:p})}),delete r.targets)}})})}function PQ(i){i.scene.objects.traverse((t,e)=>{function n(r,s){let a=new ze,o=[];if(e.events.forEach((l,c,u)=>{if(l.type==="Audio"&&l.trigger===s){let d;o.push(c),l.interaction==="play"?d={...Wd(l,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in l?l.after:void 0,toggle:"after"in l?l.toggle:void 0,type:"Audio"}:(l.interaction==="pause"||l.interaction==="stop")&&(d={...Wd(l,"interaction","delay","object","playAudio"),type:"Audio"}),d&&a.push({fi:u,id:c,data:d})}}),o.forEach(l=>e.events.delete(l)),a.length){let l=e.events.find(c=>c.type===r)?.data;l?"actions"in l&&l.actions.insertBefore(null,a):e.events.insertBefore(null,[{id:we.generateUUID(),data:{type:r,actions:a}}])}}n("Start","start"),n("MouseDown","mouseDown"),n("MouseUp","mouseUp"),n("KeyDown","keyDown"),n("KeyUp","keyUp")})}function zF(i){let t=i.layers.find(e=>e.type==="light")?.data;if(t?.category==="basic"){let e=Qn.defaultData("light","phong"),n=t;Object.assign(n,e),n.visible=!1}}function GF(i){Vo(i,zF),zo(i,zF)}function IQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="SubdivGeometry"&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}function OQ(i){i.scene.objects.traverse((t,e)=>{(e.type==="Empty"||e.type==="Mesh")&&e.cloner&&!e.cloner.randomnessObject&&!e.cloner.toObject&&!e.cloner.randomness&&(e.cloner={...e.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}function RQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="NonParametricGeometry"&&!("material"in e)&&!("materials"in e)&&(e.material=An.defaultTwoLayerData("phong"))})}function DQ(i){i.scene.publish.orbitControls.autoZoom===void 0&&(i.scene.publish.orbitControls.autoZoom=!1),i.scene.objects.traverse((t,e)=>{(e.type==="OrthographicCamera"||e.type==="PerspectiveCamera")&&(e.orthographic.autoZoom===void 0&&(e.orthographic.autoZoom=!1),e.orthographic.autoZoomFrustumSize===void 0&&(e.orthographic.autoZoomFrustumSize=790))})}function LQ(i){i.scene.objects.traverse((t,e)=>{e.pathSnapping===void 0&&(e.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),e.pathSnapping.offset===void 0&&(e.pathSnapping.offset=0)})}function NQ(i){i.scene.publish.mouseEventTarget===void 0&&(i.scene.publish.mouseEventTarget="canvas"),i.scene.publish.settings.web.hint===void 0&&(i.scene.publish.settings.web.hint=!1)}function BQ(i){let{video:t}=i.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function FQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.resetYPosition=Math.abs(n.resetYPosition-e.position[1]))})})}function UQ(i){let t=i.scene.environment.usePhysics;i.scene.objects.traverse((e,n)=>{t&&n.physics===null?n.collision=!1:n.collision="visibility"})}function kQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.navmesh=uf.defaultDataThirdPerson.navmesh)})})}function VQ(i){i.scene.styles||(i.scene.styles=rc.defaultData())}function jF(i){i.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function zQ(i){i.scene.environment.ambientLight.occlusion===void 0&&(i.scene.environment.ambientLight.occlusion=!1),i.scene.environment.ambientLight.aoFullRes===void 0&&(i.scene.environment.ambientLight.aoFullRes=!1),i.scene.environment.ambientLight.radius===void 0&&(i.scene.environment.ambientLight.radius=256),i.scene.environment.ambientLight.bias===void 0&&(i.scene.environment.ambientLight.bias=.5),i.scene.environment.ambientLight.aoColor===void 0&&(i.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),zo(i,jF),Vo(i,jF)}function GQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&Object.assign(n.gameActions,{run:new ze})})})}function jQ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.keyAssignments=[...n.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}function HF(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function WF(i,t){if(t<1&&(zo(i,BF),Vo(i,BF),i.schema=1),t<2&&(lQ(i),i.schema=2),t<3&&(uQ(i),i.schema=3),t<4&&(dQ(i),i.schema=4),t<5&&(hQ(i),i.schema=5),t<6&&(pQ(i),i.schema=6),t<7&&(fQ(i),i.schema=7),t<8&&(i.schema=8),t<9&&(UF(i),i.schema=9),t<10&&(vQ(i),i.schema=10),t<11&&(bQ(i),i.schema=11),t<12&&(UF(i),i.schema=12),t<13&&(xQ(i),i.schema=13),t<14&&(wQ(i),i.schema=14),t<15&&(EQ(i),i.schema=15),t<16&&(MQ(i),i.schema=16),t<17&&(zo(i,kF),Vo(i,kF),i.schema=17),t<18&&(zo(i,FF),Vo(i,FF),i.schema=18),t<19&&(cQ(i),i.schema=19),t<20&&(_Q(i),AQ(i),i.schema=20),t<21&&(CQ(i),PQ(i),i.schema=21),t<22&&(GF(i),i.schema=22),t<23&&(IQ(i),i.schema=23),t<24&&(OQ(i),i.schema=24),(t<25||i.shared.videos===void 0)&&(SQ(i),t<25&&(i.schema=25)),t<26&&(mQ(i),i.schema=26),t<27&&(gQ(i),i.schema=27),t<28&&(GF(i),i.schema=28),t<29&&(yQ(i),i.schema=29),t<30&&(RQ(i),i.schema=30),t<31&&(DQ(i),i.schema=31),t<33&&(LQ(i),i.schema=33),t<34&&(NQ(i),i.schema=34),t<35&&(BQ(i),i.schema=35),t<36&&(FQ(i),i.schema=36),t<37&&(UQ(i),i.schema=37),t<38&&(zo(i,VF),Vo(i,VF),i.schema=38),t<39&&(kQ(i),i.schema=39),t<40&&(VQ(i),i.schema=40),t<41&&(zQ(i),i.schema=41),t<42&&(GQ(i),i.schema=42),t<43&&(jQ(i),i.schema=43),t<99){zo(i,HF),Vo(i,HF),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=fa);let e=Pr(i.scene.objects),n=i.scene.objects;i.scene.publish.playPage=mu,n.insertBefore(null,null,[{id:mu,data:{...eo.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Wd(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Wd(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...yu.defaultData,...Wd(i.scene.environment,"usePhysics","gravity")},camera:Pr(i.scene.ownerCamera)??eo.defaultData.camera,name:"Scene"},children:[]}]);for(let a of e)a.id!==ic.TRASH_CAN_ID&&n.move(mu,a.fi,a.id);let r=0,s=0;i.shared.penumbraSize&&i.scene.objects.traverse((a,o)=>{o.type==="DirectionalLight"?(o.penumbraSize=i.shared.penumbraSize[Math.min(r,2)],r+=1):o.type==="SpotLight"&&(o.penumbraSize=i.shared.penumbraSize[3+Math.min(s,1)],s+=1),(o.physics===void 0||o.physics===null)&&o.type!=="Instance"&&(o.physics={},Object.assign(o.physics,gu.defaultData)),o.physics!==void 0&&o.physics!==null&&(o.physics.enabled=o.collision??"visibility",delete o.collision)}),i.schema=99}}var qF=F(()=>{"use strict";Hy();_s();b1();qy();an();Xy();mi();Y();f1();M1();JC();x1();n1();y1()});var JF={};kh(JF,{updateAllMaterials:()=>ZF,updateDocumentSchema:()=>sP,updateLibSchema:()=>rJ,updateMaterialSchema:()=>$Q,updateObjectStateRec:()=>hf,updateObjectsSchema:()=>KF,updateTextValues:()=>XQ});function XF(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function HQ(i){i.scene.objects.traverse((t,e)=>{let n=e.geometry;n&&n.type==="PathGeometry"&&(n.extrusion.capType="flat",n.extrusion.bevel=50,n.extrusion.bevelSides=6,n.extrusion.shape.type==="Custom"&&(n.extrusion.shape.shapeQuality="low"))})}function WQ(i){Array.isArray(Pr(i.events))&&i.events?.forEach(t=>{"disabled"in t||(t.disabled=!1),(t.type==="MouseDown"||t.type==="MouseUp"||t.type==="MousePress")&&(t.mode=t.mode||"Object")})}function YF(i){i.rotation=i.rotation.slice(0,3).map(t=>t*df)}function $F(i){YF(i),i.type==="Page"&&YF(i.camera),i.states?.forEach(e=>{e.rotation===void 0||e.rotation===null||(e.rotation=e.rotation.slice(0,3).map(n=>n*df))});let t=i.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*df),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*df),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=df,t.extrusion.twist*=df),i.type==="Mesh"&&i.geometry.type==="TextGeometry"&&(i.geometry.text={textValue:i.geometry.text}),Array.isArray(Pr(i.events))&&i.events?.forEach(e=>{(e.type==="MouseDown"||e.type==="MouseUp"||e.type==="MousePress"||e.type==="KeyDown"||e.type==="KeyUp"||e.type==="KeyPress"||e.type==="Collision"||e.type==="Trigger")&&(e.runMode=e.toggle?"Toggle":"Repeat")})}function qQ(i){i.shared.variables=fi({},st.prototype)}function XQ(i){i.scene.objects.traverse((t,e)=>{})}function YQ(i){let t=Pr(i.shared.variables);i.shared.variables=fi(Object.entries(t??{}).map(([e,n],r)=>({fi:r,id:e,data:n})),ze.prototype)}function $Q(i){let t=i.schema??104;t!==130&&t<130&&(_1(i.asset),i.schema=130)}function hf(i,t){t(i.data);for(let e of i.children)hf(e,t)}function KF(i){let t=i.schema??104;t!==130&&(t<105&&(hf(i.asset,$F),i.schema=105),t<118&&(hf(i.asset,QF),i.schema=118),t<121&&(hf(i.asset,iP),i.schema=121),t<130&&(hf(i.asset,KQ),i.schema=130))}function ZF(i,t){zo(i,t),Vo(i,t),Object.values(i.shared.lib.materials).forEach(e=>t(e.asset))}function _1(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("phong"))}function KQ(i){"materials"in i?i.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&_1(t)}):"material"in i&&i.material!==void 0&&typeof i.material!="string"&&_1(i.material)}function ZQ(i){i.shared.particles=fi({},st.prototype),i.shared.lib&&(i.shared.lib.particles=no.defaultData().particles)}function QQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Particle"&&typeof e.renderMaterial.size=="number"&&Object.assign(e.renderMaterial,{size:[e.renderMaterial.size,e.renderMaterial.size]})})}function JQ(i){i.scene.objects.traverse((t,e)=>{e.type==="Page"&&(e.postprocessing.depthOfField.focusDistance=100,e.postprocessing.depthOfField.focalLength=20,e.postprocessing.depthOfField.bokehScale=5)})}function eJ(i){i.scene.objects.traverse((t,e)=>{Array.isArray(Pr(e.events))!==!1&&e.events?.forEach(n=>{let r=n.runMode;n.type==="MouseDown"||n.type==="MouseUp"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="Collision"||n.type==="Trigger"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode=r??"Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode=r==="Toggle"?"Toggle":"Normal")}):n.type==="MouseHover"||n.type==="MousePress"||n.type==="KeyPress"?n.actions?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")}):n.type==="GameControl"?(delete n.actions,Object.keys(n.gameActions).forEach(a=>{n.gameActions[a]?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),o.type==="Animation"&&(o.runMode="Normal")})})):n.type==="DragDrop"?(delete n.actions,n.dragDropActions?.drag?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")}),n.dragDropActions?.drop?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Toggle")})):n.type==="Resize"?(delete n.actions,n.breakpoints?.forEach(s=>{s.actions?.forEach(a=>{(a.type==="Transition"||a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode="Toggle")})})):n.type==="Start"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Once"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}):n.type==="VariableChange"||n.type==="Scroll"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}):n.type==="Conditional"&&(delete n.actions,n.inActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}),n.outActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"||s.type==="SwitchCamera")&&(s.runMode="Normal")}))})})}function tJ(i){i.shared.userAPIs=fi({},st.prototype),i.shared.userWebhooks=fi({},st.prototype),i.shared.lib&&(i.shared.lib.userAPIs=no.defaultData().userAPIs,i.shared.lib.userWebhooks=no.defaultData().userWebhooks)}function nJ(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=va.defaultData.settings.videoStatic)}function QF(i){i.timelineAnimations=fi({},st.prototype)}function iP(i){i.pivot=[0,0,0],i.pivotRotation=[0,0,0]}function rJ(i){}function sP(i){let t=i.schema??0;if(t!==130){console.warn("updating from ",t,"to ",130),WF(i,t),t<100&&(i.scene.publish.joystickSizeAndXYOffset===void 0&&(i.scene.publish.joystickSizeAndXYOffset=va.defaultData.joystickSizeAndXYOffset),i.schema=100),t<101&&(zo(i,XF),Vo(i,XF),i.schema=101),t<102&&(HQ(i),i.schema=102),t<104&&(i.shared.catelogs=new st,i.shared.lib=no.defaultData(),i.schema=104),t<105&&(qQ(i),i.scene.objects.traverse((e,n)=>{$F(n)}),i.schema=105);for(let e of Object.values(i.shared.lib.components))KF(e);t<106&&(YQ(i),i.schema=106),t<107&&(i.shared.lib.variables=no.defaultData().variables,i.schema=107),t<109&&(ZQ(i),i.schema=109),t<110&&(QQ(i),i.schema=110),t<111&&(i.scene.objects.traverse((e,n)=>{WQ(n)}),i.schema=111),t<112&&(JQ(i),i.schema=112),t<113&&(eJ(i),i.schema=113),t<114&&(i.scene.publish.settings.web.imageQuality===void 0&&(i.scene.publish.settings.web.imageQuality=70),i.schema=114),t<115&&(tJ(i),i.schema=115),t<116&&(nJ(i),i.schema=116),t<117&&(i.scene.publish.settings.web.pixelRatioMobile===void 0&&(i.scene.publish.settings.web.pixelRatioMobile=0),i.scene.publish.settings.web.pixelRatioDesktop===void 0&&(i.scene.publish.settings.web.pixelRatioDesktop=0),i.schema=117),t<118&&(i.shared.timelineAnimations=fi({},st.prototype),i.scene.objects.traverse((e,n)=>{QF(n)}),i.schema=118),t<119&&(i.scene.publish.settings.videoStatic.format=vu.defaultData.scene.publish.settings.videoStatic.format,i.scene.publish.settings.videoStatic.imageFormat=vu.defaultData.scene.publish.settings.videoStatic.imageFormat,i.schema=119),t<120&&(i.scene.publish.settings.image.colorSpace="display-p3",i.scene.publish.settings.videoStatic.colorSpace="display-p3",i.schema=120),t<121&&(i.scene.objects.traverse((e,n)=>{iP(n),n.type==="Page"&&n.camera!==void 0&&iP(n.camera)}),i.schema=121),t<122&&(delete i.scene.publish.settings.video,i.scene.publish.orbitControls.rotationSpeed=vu.defaultData.scene.publish.orbitControls.rotationSpeed,i.schema=122),t<123&&(i.scene.objects.traverse((e,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=Fo.defaultData)}),i.schema=123),t<124&&(t>=123&&i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=Fo.defaultData.lighting))}),i.schema=124),t<125&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=Fo.defaultData.lightingIntensity)}),i.schema=125),t<126&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...Fo.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Fo.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),i.schema=126),t<127&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),i.schema=127),t<128&&(i.scene.objects.traverse((e,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),i.schema=128),t<129&&(i.scene.objects.traverse((e,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=eo.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),i.schema=129),t<130&&(ZF(i,_1),i.schema=130)}}var df,Yy=F(()=>{nP();an();qF();Xy();Hy();mi();w1();qy();m1();df=180/Math.PI});var eU,T1,aP,tU,A1,sc,$y,pf,C1,oP,ff,lP,cP,nU,Ky,uP,ac,P1,rU=F(()=>{"use strict";_s();an();mi();(t=>{function i(e){return!0}t.is=i})(eU||(eU={}));(n=>{n.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]};function t(r,s){return{position:s?.position??r.position,rotation:s?.rotation??r.rotation,scale:s?.scale??r.scale,shear:s?.shear??r.shear}}n.merge=t;function e(r,s){return TS({position:Xs.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:Xs.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&Xs.isEqual(r.shear,s.shear)?void 0:s.shear})}n.diff=e})(T1||(T1={}));(t=>t.defaultData={horizontalConstraint:0,verticalConstraint:0})(aP||(aP={}));(t=>t.defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8})(tU||(tU={}));(t=>t.defaultData={opacity:1,fill:{color:zt.fromHexAndA(Er,1),enabled:!0},stroke:{color:zt.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:zt.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:zt.from0to1([0,0,0,1]),enabled:!1,spread:0}})(A1||(A1={}));(s=>{function i(a,o){return{name:o}}s.newEmpty=i;function t(a,o){if(o===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let u of c)u in l&&u in o&&o[u]!==void 0&&Object.assign(l,{[u]:o[u]});return l}function e(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}function n(a,o){if(o===void 0)return a;let l={...a};return Object.assign(l,T1.merge(l,o)),l=t(l,o),l=e(l,o),l}s.patch=n;function r(a,o){let l,c=[];for(let[u,d]of Object.entries(o))u!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},c.push(l)),l.props[u]=d);return c}s.toOps=r})(sc||(sc={}));(t=>t.defaultData={...T1.defaultData,...aP.defaultData,states:new ze,events:new ze,visible:!0,raycastLock:!1})($y||($y={}));(t=>t.defaultData={...$y.defaultData,...A1.defaultData})(pf||(pf={}));(t=>t.defaultData={cornerRadius:[0,0,0,0]})(C1||(C1={}));(t=>t.defaultData={...pf.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(oP||(oP={}));(t=>t.defaultData={...pf.defaultData,...C1.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(ff||(ff={}));(t=>t.defaultData={...pf.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"})(lP||(lP={}));(t=>t.defaultData={...pf.defaultData,type:"path2d",path:"",name:"Path"})(cP||(cP={}));(t=>{function i(e){return e.type==="ellipse2d"||e.type==="rectangle2d"||e.type==="text2d"||e.type==="vector2d"||e.type==="path2d"}t.is=i})(nU||(nU={}));(t=>t.defaultData={...$y.defaultData,name:"Group",type:"group2d"})(Ky||(Ky={}));(t=>t.defaultData=()=>({...$y.defaultData,...C1.defaultData,...A1.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:zt.fromHexAndA(4737101,1),enabled:!0},stroke:{color:zt.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(uP||(uP={}));(s=>{function i(a){switch(a){case"rectangle2d":return{...ff.defaultData};case"ellipse2d":return{...oP.defaultData};case"text2d":return{...lP.defaultData};case"vector2d":return{...ff.defaultData};case"path2d":return{...cP.defaultData};case"frame2d":return{...uP.defaultData()};case"group2d":return{...Ky.defaultData}}}s.defaultData=i;function t(a){return"width"in a&&"height"in a?[typeof a.width=="number"?a.width*.5:0,typeof a.height=="number"?a.height*.5:0]:[0,0]}s.getPivot=t;function e(a){return a.type==="rectangle2d"||a.type==="ellipse2d"||a.type==="text2d"||a.type==="frame2d"}s.isResizeable=e;function n(a){return a.type==="frame2d"&&a.autoLayout!==void 0}s.isAutoLayoutable=n;function r(a){return a.type==="rectangle2d"||a.type==="frame2d"}s.hasCorners=r})(ac||(ac={}));(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new Ln},e.emptyData=function(){return{type:"scene2d",objects:new Ln}}))(P1||(P1={}))});var iU=F(()=>{"use strict";hF();fF();CC();IC();nP();wC();NF();FC();HC();m1();Yy();eP();f1();n1();OC();Hy();BC();qC();_s();Xy();qy();b1();jC();w1();x1();wF();GC();M1();y1();RC();DC();rU()});function ro(i,t=!1){let e=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},a={},o=i[0].morphTargetsRelative,l=new De,c=0;for(let u=0;u<i.length;++u){let d=i[u],h=0;if(e!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),h++}if(h!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(t){let p;if(e)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(e){let u=0,d=[];for(let h=0;h<i.length;++h){let p=i[h].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+u);u+=i[h].attributes.position.count}l.setIndex(d)}for(let u in s){let d=sU(s[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(let u in a){let d=a[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let h=0;h<d;++h){let p=[];for(let m=0;m<a[u].length;++m)p.push(a[u][m][h]);let f=sU(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(f)}}}return l}function sU(i){let t,e,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=u.itemSize),e!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*e}let a=new t(s),o=new je(a,e,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let d=l/e;for(let h=0,p=u.count;h<p;h++)for(let f=0;f<e;f++){let m=u.getComponent(h,f);o.setComponent(h+d,f,m)}}else a.set(u.array,l);l+=u.count*e}return r!==void 0&&(o.gpuType=r),o}function aU(i,t=1e-4){t=Math.max(t,Number.EPSILON);let e={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,a=0,o=Object.keys(i.attributes),l={},c={},u=[],d=["getX","getY","getZ","getW"],h=["setX","setY","setZ","setW"];for(let v=0,b=o.length;v<b;v++){let x=o[v],S=i.attributes[x];l[x]=new S.constructor(new S.array.constructor(S.count*S.itemSize),S.itemSize,S.normalized);let E=i.morphAttributes[x];E&&(c[x]||(c[x]=[]),E.forEach((M,w)=>{let T=new M.array.constructor(M.count*M.itemSize);c[x][w]=new M.constructor(T,M.itemSize,M.normalized)}))}let p=t*.5,f=Math.log10(1/t),m=Math.pow(10,f),g=p*m;for(let v=0;v<s;v++){let b=n?n.getX(v):v,x="";for(let S=0,E=o.length;S<E;S++){let M=o[S],w=i.getAttribute(M),T=w.itemSize;for(let A=0;A<T;A++)x+=`${~~(w[d[A]](b)*m+g)},`}if(x in e)u.push(e[x]);else{for(let S=0,E=o.length;S<E;S++){let M=o[S],w=i.getAttribute(M),T=i.morphAttributes[M],A=w.itemSize,C=l[M],P=c[M];for(let D=0;D<A;D++){let I=d[D],L=h[D];if(C[L](a,w[I](b)),T)for(let U=0,G=T.length;U<G;U++)P[U][L](a,T[U][I](b))}}e[x]=a,u.push(a),a++}}let y=i.clone();for(let v in i.attributes){let b=l[v];if(y.setAttribute(v,new b.constructor(b.array.slice(0,a*b.itemSize),b.itemSize,b.normalized)),v in c)for(let x=0;x<c[v].length;x++){let S=c[v][x];y.morphAttributes[v][x]=new S.constructor(S.array.slice(0,a*S.itemSize),S.itemSize,S.normalized)}}return y.setIndex(u),y}var mf=F(()=>{Y()});function sJ(i){let t=1/0,e=1/0,n=1/0,r=-1/0,s=-1/0,a=-1/0;for(let u=0;u<i.length;u+=3){let d=i[u],h=i[u+1],p=i[u+2];t=Math.min(t,d),e=Math.min(e,h),n=Math.min(n,p),r=Math.max(r,d),s=Math.max(s,h),a=Math.max(a,p)}let o=r-t,l=s-e,c=a-n;return{width:o,height:l,depth:c}}function aJ(i){let{userData:t,data:e}=i,n=e?.groups,r=e?.attributes??{},s=e?.morphAttributes??{},a=e?.interleavedBuffers,o=e?.arrayBuffers,l=e?.index,c;r.position!==void 0&&Array.isArray(r.position.array)&&(c=sJ(r.position.array));let u={...t===void 0?{}:t.parameters,data:{attributes:r,morphAttributes:s,interleavedBuffers:a,arrayBuffers:o},...c===void 0?{}:c,type:"NonParametricGeometry"};return l!==void 0&&Object.assign(u.data,{index:l}),n!==void 0&&Object.assign(u.data,{groups:n.map(d=>({...d,materialIndex:d.materialIndex??0}))}),u}function lU(i){let t=i.points.length/7,e=new ze;for(let n=0;n<t;n++){let r=n*7,s=i.points[r+0],a=i.points[r+1],o=i.points[r+2],l=i.points[r+3],c=i.points[r+4],u=i.points[r+5],d=i.points[r+6];e.push({fi:n,id:we.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,u]}}})}return{points:e,isClosed:i.isClosed,roundness:i.roundness,shapeHoles:i.shapeHoles?.map(n=>lU(n))??[]}}function dP(i){let{userData:t,uuid:e,...n}=i;if(t===void 0||t.type==="NonParametricGeometry")return aJ(i);if(t.type==="SubdivGeometry"){let a="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new De;if(o?.position===void 0||o?.faceMap===void 0)return null;let u=o.position.array,d=o.faceMap.array,h=n.data.index.array;c.setAttribute("position",new Ve(u,3)),c.setIndex(new Vs(h,1));let p=aU(c),f=[],m=new Array(d[d.length-1]+1).fill(3),g=p.getIndex().array;for(let y=0,v=d.length;y<v;)d[y]===d[y+1]?(m[d[y]]++,f.push(...new Set(g.slice(3*y,3*y+6))),y+=2):(f.push(...g.slice(3*y,3*y+3)),y++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:m}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...oJ(o.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=t.type,s=t.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:lU(t.shape),type:r}):r==="LatheGeometry"?{...t.parameters,type:r,points:(t?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function oJ(i){return oU.setFromArray(i),oU.getSize(I1),{width:I1.x,height:I1.y,depth:I1.z}}var Ebe,Mbe,_be,Tbe,Abe,oU,I1,cU=F(()=>{an();Y();mf();Ebe=new ne,Mbe=new qe,_be=new Xt,Tbe=new _,Abe=new _,oU=new Bt,I1=new _});var uU=F(()=>{"use strict"});var Rbe,dU=F(()=>{"use strict";an();Yy();Rbe={...zy,updateSchema(i){return(i.schema??0)<130?du(i,sP):(i.schema??0)-130},asyncKeys(){return[]}}});function Xr(i,t=[0,0]){let e=i&&!isNaN(i[0])?i[0]:t[0],n=i&&!isNaN(i[1])?i[1]:t[1];return[e,n]}function ls(i,t,e){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=t??{...$p.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=e??{...Yp.defaultData},o=new hP(n,r,s,a),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}function fU(i,t,e){let n=t;return{id:n,fi:e,data:{id:n,path:i,keyframes:new ze}}}var hU,pU,pP,hP,mU=F(()=>{"use strict";an();_s();(t=>{function i(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"}t.is=i})(hU||(hU={}));(s=>{function i(a,o){let l=[0,0],c=[1,1];if(a?.cubicControls)l=Xr(a.cubicControls.control1,l);else switch(a?.type){case 2:l=[.42,0];break;case 3:l=[0,0];break;case 4:l=[.42,0];break;case 1:l=[.25,.1];break;case 0:l=[0,0];break;case 7:l=[.25,1];break}if(o?.cubicControls)c=Xr(o.cubicControls.control2,c);else switch(o?.type){case 2:c=[1,1];break;case 3:c=[.58,1];break;case 4:c=[.58,1];break;case 1:c=[.25,1];break;case 0:c=[1,1];break;case 7:c=[.5,1];break}return{control1:l,control2:c}}s.getControlsWithDefault=i;function t(a,o){return{id:a,name:o,to:5,properties:new ze}}s.defaultData=t;function e(a){let o=new ze;return a.forEach(({data:l,id:c,fi:u})=>{if(l.type==="light"){let d=fU(["material",`${l.category} lighting`],c,u);o.push(d)}else{let d=fU(["material",l.type],c,u);o.push(d)}}),o}s.createMaterialGroup=e;function n(a){return Object.entries(a).reduce((o,[l,c])=>(typeof c!="string"&&o.push({name:c.name}),o),[])}s.createName=n,s.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:ls(3),duration:1e3},opacity:{value:[0,1],easing:ls(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:ls(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:ls(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:ls(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(pU||(pU={}));pP=["x","y","z"],hP=class{constructor(t=1,e=100,n=10,r=0){this.mass=t,this.stiffness=e,this.damping=n,this.initialVelocity=r,this.m_w0=Math.sqrt(e/t),this.m_zeta=n/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0+-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(t){return this.m_zeta<1?t=Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):t=(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0),1-t}getDuration(){let t=.16666666666666666,e=0,n=0;for(;;)if(e+=t,this.solve(e)===1){if(n++,n>=16)break}else n=0;return e*t*1e3}}});var ft=F(()=>{iU();uU();LF();Yy();dU();mU();M1();an()});function gU(i){for(let t of lJ)i.enable(t)}var lJ,cs,gf,yU,Go=F(()=>{lJ=[3,4,8,9];cs=5,gf=3,yU=32});var jo,yf=F(()=>{"use strict";Y();jo=i=>{var t;return t=class extends i{},t.geometryHelper=new ni(30,30,30),t}});var R1,fP,vU,Ho,vf=F(()=>{"use strict";Y();R1=new Wi,fP=new nr,vU=new ne,Ho=(i,t,e,n,r=!1,s=i)=>{let a=t,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),fP.copy(a.boundingSphere),fP.applyMatrix4(o),e.ray.intersectsSphere(fP)===!1||(vU.copy(o).invert(),R1.copy(e.ray).applyMatrix4(vU),a.boundingBox!==null&&R1.intersectsBox(a.boundingBox)===!1))return;let l,c,u,d,h=a.index,p=a.attributes.position,f=a.drawRange,m,g;if(r===!1){let v=Math.max(0,f.start),b=Math.min(h.count,f.start+f.count);for(m=v,g=b;m<g;m+=3)if(c=h.getX(m),u=h.getX(m+1),d=h.getX(m+2),l=y(i,e,R1,p,c,u,d),l){l.faceIndex=Math.floor(m/3),n.push(l);return}}else{let b=a.attributes.position,x=new _,S=new _,E=new _,M=new _,w=2,A=1/((s.scale.x+s.scale.y+s.scale.z)/3),C=A*A,P=Math.max(0,f.start),D=Math.min(b.count,f.start+f.count);for(let I=P,L=D-1;I<L;I+=w){if(x.fromBufferAttribute(b,I),S.fromBufferAttribute(b,I+1),R1.distanceSqToSegment(x,S,M,E)>C)continue;M.applyMatrix4(s.matrixWorld);let G=e.ray.origin.distanceTo(M);G<e.near||G>e.far||n.push({distance:G,point:E.clone().applyMatrix4(s.matrixWorld),object:i})}}function y(v,b,x,S,E,M,w){let T=new _,A=new _,C=new _,P=new _,D=new _;if(T.fromBufferAttribute(S,E),A.fromBufferAttribute(S,M),C.fromBufferAttribute(S,w),x.intersectTriangle(T,A,C,!1,P)===null)return null;D.copy(P),D.applyMatrix4(v.matrixWorld);let L=b.ray.origin.distanceTo(D);return L<b.near||L>b.far?null:{faceIndex:1,distance:L,point:D.clone(),object:v}}}});var cJ,bU,uJ,xU,ba,Zy=F(()=>{"use strict";Y();yf();vf();cJ=new _(1,1,1),bU=new _,uJ=new _,xU=new qe,ba=class extends jo(my){constructor(e,n=15){super(n);this.object=e;this.dummy=new Us;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,n){Ho(this.object,ba.geometryHelper,e,n,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(bU,xU,uJ),this.matrix.compose(bU,xU,cJ),super.updateMatrixWorld(e)}updateWorldMatrix(e,n){}}});var qd,Xd,bu,wU,dJ,hJ,SU,Qy,EU=F(()=>{"use strict";Y();qd=new _,Xd=new _,bu=new ne,wU=[new _(-1,1,1),new _(-1,-1,1),new _(1,-1,1),new _(1,1,1),new _(-1,1,-1),new _(-1,-1,-1),new _(1,-1,-1),new _(1,1,-1)],dJ=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],hJ=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],SU=(i,t,e)=>{i.updateEntityBoxSize(qd,Xd),bu.copy(t).multiply(i.matrixWorld),Xd.x===0&&Xd.y===0&&Xd.z===0?e.push(new _(qd.x,qd.y,qd.z).applyMatrix4(bu)):wU.forEach(n=>{e.push(n.clone().multiply(Xd).add(qd).applyMatrix4(bu))})},Qy=class extends Bt{constructor(){super(...arguments);this.matrix=new ne;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(n=>n.clone()),this.faces=e.faces.map(n=>n.clone()),this.edges=e.edges.map(n=>n.clone()),this.centerEdges=e.centerEdges.map(n=>n.clone()),this}setFromObjectSize(e,n=!1){e.updateWorldMatrix(!1,n),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let r=new ne().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,n)}expandByObjectSize(e,n,r=!1){let s=[];if(r===!0){let a=[];e.traverseEntity(o=>{if(o.visible||o.cloner&&o.data.visible){if(!("geometry"in o)){bu.copy(n).multiply(o.matrixWorld),a.push(new _().applyMatrix4(bu));return}SU(o,n,s)}}),s.length===0&&s.push(...a)}else SU(e,n,s);return this.setFromPoints(s)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(bu.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(Xd).multiplyScalar(.5),this.getCenter(qd),bu.copy(this.matrix).setPosition(qd),this.vertices=wU.map(e=>e.clone().multiply(Xd).applyMatrix4(bu))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=dJ.map(([e,n])=>new ri(this.vertices[e],this.vertices[n])),this.centerEdges=this.edges.map(e=>e.getCenter(new _))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=hJ.map(([e,n])=>this.vertices[e].clone().add(this.vertices[n]).multiplyScalar(.5))}}});var xa,Jy=F(()=>{"use strict";xa={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function xu(i){return i?.isParticleSystem===!0}function io(i){return i?.isHairSystem===!0}function Ts(i){return i?.isShapeBlendEntity===!0}function bf(i){return i?.isPathObject===!0}function Ir(i){return i?.isObject2D===!0}function vr(i){return i?.isUIObject===!0}function MU(i){return typeof i=="object"&&i!==null&&"booleanOp"in i}function oc(i){return i?.isCloner===!0}function Wo(i){return i?.isClone===!0}function xf(i){return i?.isComponentObject===!0}var fr=F(()=>{});function _t(i){TU.add(i)}function AU(i){return TU.has(i)}function Jn(i,t){let e=`${i}:${t}`;_U.has(e)||_U.add(e)}function Yd(i,t){CU.set(i,t)}function D1(i){return CU.get(i)}function Sa(i,t){PU.set(i,t)}function L1(i){return PU.get(i)}function ev(i,t){IU.set(i,t)}function N1(i){return IU.get(i)}function OU(i){gP=i,mP!==null&&i.setHanaUIWasmUrl(mP)}function RU(i){mP=i,gP?.setHanaUIWasmUrl(i)}function tv(){return gP}var TU,_U,CU,PU,IU,gP,mP,Qt=F(()=>{TU=new Set;_U=new Set;CU=new Map,PU=new Map;IU=new Map;gP=null,mP=null});function DU(i){let t=i.elements;qo.set(t[0],t[1],t[2]),Xo.set(t[4],t[5],t[6]),lc.set(t[8],t[9],t[10])}function fJ(i,t){i.set(1,0,0).cross(t),i.lengthSq()<=F1&&i.set(0,1,0).cross(t),i.normalize()}function LU(){let i=Math.max(qo.lengthSq(),Xo.lengthSq(),lc.lengthSq());qo.lengthSq()>F1*i?wa.copy(qo).normalize():wa.set(1,0,0),Ea.crossVectors(lc,wa),Ea.lengthSq()<=F1*i&&(Ea.copy(Xo).addScaledVector(wa,-Xo.dot(wa)),Ea.lengthSq()<=F1*i&&fJ(Ea,wa)),Ea.normalize(),Sf.crossVectors(wa,Ea)}function mJ(){let i=qo.length(),t=Xo.length(),e=lc.length(),n=Math.max(i,t,e);if(n-i>B1||n-t>B1||n-e>B1)return!0;let r=B1*n*n;return Math.abs(qo.dot(Xo))>r||Math.abs(qo.dot(lc))>r||Math.abs(Xo.dot(lc))>r}function NU(i,t,e){return DU(i),LU(),t.makeBasis(wa,Ea,Sf),e.set(wa.dot(qo),wa.dot(Xo),wa.dot(lc),0,Ea.dot(qo),Ea.dot(Xo),Ea.dot(lc),0,Sf.dot(qo),Sf.dot(Xo),Sf.dot(lc),0,0,0,0,1),mJ()}function yP(i){return DU(i),LU(),pJ.makeBasis(wa,Ea,Sf)}var qo,Xo,lc,wa,Ea,Sf,pJ,F1,B1,vP=F(()=>{"use strict";Y();qo=new _,Xo=new _,lc=new _,wa=new _,Ea=new _,Sf=new _,pJ=new ne,F1=1e-12,B1=.01});var bP,cc,wf,Ef=F(()=>{"use strict";Y();vP();bP=new ne;(t=>{function i(e){return e&&e.__isSPEObject}t.is=i})(cc||(cc={}));wf=i=>class extends i{constructor(){super(...arguments);this.previousModelViewMatrix=new ne;this.copyPreviousMatrix=!0;this.hiddenMatrix=new ne;this.pivotMatrix=new ne;this.matrixWorldRigid=new ne;this.shearScale=new ne;this.shearScaleInv=new ne}get __isSPEObject(){return!0}getPhysicsLocalMatrix(n){return this.rigidBody?.isDynamic()?(n.copy(this.matrixWorld),this.hasNonUniformScale&&n.multiply(this.shearScaleInv),this.parent&&n.premultiply(bP.copy(this.parent.matrixWorld).invert()),n.premultiply(bP.copy(this.hiddenMatrix).invert()),n.multiply(bP.copy(this.pivotMatrix).invert()),!0):!1}isDescendantOf(n){n instanceof Zt&&(n=n.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===n)return!0;r=r.parent}return!1}updateMatrixWorld(n){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,n=!0);for(let r of this.children)r.updateMatrixWorld(n)}updateWorldMatrix(n,r){let s=this.parent;if(n&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),r)for(let a of this.children)a.updateWorldMatrix(!1,!0)}traverseChildren(n,r=0){for(let s of this.children)cc.is(s)&&s.traverseObject(n,r+1)}traverseObject(n,r=0){if(n(this,r)!==!0)for(let a of this.children)cc.is(a)&&a.traverseObject(n,r+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=NU(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(n,r){this.updateWorldMatrix(!0,!1);let s=new ne().copy(this.matrixWorld).invert();return n.parent!==null&&(n.parent.updateWorldMatrix(!0,!1),s.multiply(n.parent.matrixWorld)),"hiddenMatrix"in n&&n.hiddenMatrix instanceof ne?n.hiddenMatrix.premultiply(s):n.applyMatrix4(s),n.updateWorldMatrix(!1,!1),this.add(n),r!==void 0&&(this.children.pop(),this.children.splice(r,0,n)),this}copy(n,r=!1){return super.copy(n,r),this.hasNonUniformScale=n.hasNonUniformScale,this}onAfterRender(n,r,s,a,o,l){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function UU(i,t,e){return $d.subVectors(t,i),k1.subVectors(t,e),$d.cross(k1).length()<=U1}function V1(i){let t=kU.get(i.points);if(t!==void 0&&t.isClosed===i.isClosed)return t.curve;let e=gJ(i);return kU.set(i.points,{isClosed:i.isClosed,curve:e}),e}function gJ(i){let t=i.points,e=[t[0]],n=[new _(...t[0].data.position)];Mf.copy(n[0]);for(let f=0;f<t.length-1;f++)$d.fromArray(t[f].data.position),k1.fromArray(t[f+1].data.position),nv.subVectors($d,Mf),rv.subVectors($d,k1),nv.cross(rv).length()>U1&&(e.push(t[f]),n.push(new _().copy($d)),Mf.copy($d));let r=t[t.length-1];e.push(r),n.push(new _(...r.data.position));let s=i.isClosed,a=e.length-(s?0:1),o=e.length,l=[],c=[];for(let f=0;f<o;f++){let m=e[f].data;l.push(new _(...m.controlPrevious.position)),c.push(new _(...m.controlNext.position))}let u=[];for(let f=0;f<a;f++){let m=f===o-1?0:f+1;u.push(UU(n[f],c[f],n[m])&&UU(n[f],l[m],n[m]))}let d=[];for(let f=0;f<o;f++){let m=e[f].data,g=n[f],y={position:g,prevDir:void 0,nextDir:void 0,controlPrevious:l[f],controlNext:c[f],tan:void 0,baseRoundness:m.roundness,removedLength:0};if(d.push(y),m.roundness===0||!s&&(f===0||f===o-1))continue;let v=s&&f==0?o-1:f-1,b=s&&f==o-1?0:f+1,x=new _().subVectors(n[v],g).normalize(),S=new _().subVectors(n[b],g).normalize();y.prevDir=x,y.nextDir=S;let E=u[s&&f===0?o-1:f-1],M=u[f];if(E&&M){_f.addVectors(x,S).normalize();let w=Mf.crossVectors(_f,x).length()/x.dot(_f);y.tan=w,y.removedLength=m.roundness/w}}for(let f=0;f<a;f++){let m=f,g=s&&f===o-1?0:f+1,y=d[m],v=d[g];if(y.removedLength!==0||v.removedLength!==0){let b=y.position.distanceTo(v.position);y.removedLength=Math.min(y.removedLength,b/2),v.removedLength=Math.min(v.removedLength,b/2)}}let h=new Array(2*o).fill(null);for(let f=0;f<a;f++){let m=f,g=s&&f===o-1?0:f+1,y=d[m],v=d[g],b=null;if(!u[f])y.position.distanceTo(v.position)>U1&&(b=new Qc(y.position,y.controlNext,v.controlPrevious,v.position));else{let x=y.position.clone(),S=v.position.clone();(y.removedLength!==0||v.removedLength!==0)&&(y.nextDir&&x.add(Mf.copy(y.nextDir).setLength(y.removedLength)),v.prevDir&&S.add(Mf.copy(v.prevDir).setLength(v.removedLength))),x.distanceTo(S)>U1&&(b=new Qc(x,x.clone().lerp(S,.3),S.clone().lerp(x,.3),S))}h[2*f+1]=b}for(let f=0;f<o;f++){let m=d[f];if(m.removedLength===0)continue;let g=m.position,y=m.prevDir.clone().multiplyScalar(m.removedLength).add(g),v=m.nextDir.clone().multiplyScalar(m.removedLength).add(g),b=m.tan*m.removedLength;_f.addVectors(m.prevDir,m.nextDir).normalize(),nv.copy(y).lerp(v,.5);let x=y.distanceTo(v)/2;FU.copy(_f).multiplyScalar(Math.sqrt(Math.pow(b,2)-Math.pow(x,2))).add(nv),xP.copy(_f).multiplyScalar(-b).add(FU);let S=g.distanceTo(xP)/g.distanceTo(nv);rv.copy(m.prevDir).multiplyScalar(S*g.distanceTo(y)).add(g),BU.copy(rv).lerp(xP,2);let E=y.clone().lerp(rv,4/3),M=v.clone().lerp(BU,4/3);h[2*f]=new Qc(y,E,M,v)}let p=new SP;for(let f=0;f<h.length;f++){let m=h[f];m&&p.add(m)}return p}var SP,U1,$d,k1,Mf,_f,nv,xP,rv,BU,FU,kU,wP=F(()=>{"use strict";Y();SP=class extends dp{constructor(){super()}getPoints(t=12){let e=[],n,r=this.getCurveLengths(),a=r[r.length-1]/r.length;for(let o=0,l=this.curves;o<l.length;o++){let c=l[o],u=o===0?r[o]:r[o]-r[o-1],d=Math.ceil(t*u/a),h=c.getPoints(d);for(let p=0;p<h.length;p++){let f=h[p];n&&n.equals(f)||(e.push(f),n=f)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}},U1=.001,$d=new _,k1=new _,Mf=new _,_f=new _,nv=new _,xP=new _,rv=new _,BU=new _,FU=new _;kU=new WeakMap});var Dt,Yo,yJ,vJ,iv,VU,EP,MP,bJ,zU,GU,Tf,Yi=F(()=>{"use strict";Y();ft();EU();an();Jy();fr();Qt();Ef();wP();hn();(t=>{function i(e){return e&&e.__isEntity}t.is=i})(Dt||(Dt={}));Yo=i=>Dt.is(i),yJ={type:"completeState",isfromEntity:!0},vJ=["x","y","z"],iv=new _,VU=new _(1,1,1),EP=new qe,MP=new Xt,bJ=new _().set(0,1,0),zU=new ne,GU=new ne,Tf=i=>class extends wf(i){constructor(){super(...arguments);this.raycastLock=!1;this.scaleLock=!1;this.disposed=!1;this.stateSelection=null;this.destroyedInAction=!1;this.instances=[];this.prevState=null;this.currentState=null;this.currentAnimationAction=null;this.reversibleToState=null;this.currentTransitionEvent=null;this.previousAction=null;this._singleBBox=new Qy;this._recursiveBBox=new Qy;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this._needApplyPathSnapping=!0;this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(n){let r=this.children[n];if(Dt.is(r))return r}entityChildrenCount(){let n=this.children.length;for(;n--;)if(Dt.is(this.children[n]))return n+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let n=this;for(;n.data.type!=="Instance";){let r=n.parent;if(Dt.is(r))n=r;else return}return n}forInstancesRec(n){this.instances.forEach(r=>{r.disposed||n(r),r.forInstancesRec(n)})}super_Entity(n,r){typeof n=="string"&&(this.uuid=n),this.identity=n,this.data=r,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(n,r,s=!1){if(!(this.data.states.length===0&&!s)){for(let a of this.data.states)to.toOps(this.data,a.data).forEach(l=>{let c=Hp.replaceProps(l,this.data);this.dataPatched=this.data,this.updateByPatchedOp(c,this.data,r)});if(n!==null){let a=this.data.states.data(n);a&&(this.dataPatched=to.patch(this.data,a),to.toOps(this.data,a).forEach(l=>{this.updateByPatchedOp(l,this.dataPatched,r)}))}s&&this.updateTransformState(this.dataPatched,r),this.stateSelection=n,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(n,r){n.setScalar(0),r.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(n=>{Yo(n)&&n.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(n=>{n.resetBBoxNeedsUpdateSelf()})}find(n){let r;return this.traverseEntity(s=>{s.uuid===n&&(r=s)}),r}traverseSortNextHelper(){let n=this.parent;if(n){let r=n.children,s=r.indexOf(this)+1;if(Dt.is(r[s]))return r[s];if(Dt.is(n))return n.traverseSortNextHelper()}}sortNext(){let n=this.children;return this.children.length>0&&Dt.is(this.children[0])?n[0]:this.traverseSortNextHelper()}goUp(n){let r=this;for(;n>0&&r!==null;)r=r.parent,n-=1;return r}hasAnccestorOrSelf(n){return this===n||this.hasAnccestor(n)}hasAnccestor(n){let r=this.parent;for(;r;){if(n===r)return!0;r=r.parent}return!1}countToAccestor(n){let r=0,s=this;for(;s!==n;){if(s===null)return-1;s=s.parent,r+=1}return r}forEachEntity(n){for(let r of this.children)Yo(r)&&n(r)}traverseEntityAncestors(n){this.traverseAncestors(r=>{Dt.is(r)&&n(r)})}traverseConcreteEntity(n,r=0){if(n(this,r)!==!0)for(let a of this.children)Yo(a)&&a.isConcreteEntity&&a.traverseEntity(n,r+1)}traverseEntity(n,r=0){if(n(this,r)!==!0)for(let a of this.children)Yo(a)&&a.traverseEntity(n,r+1)}traverseVisibleEntity(n){n(this);for(let r of this.children)Yo(r)&&r.visible&&r.traverseVisibleEntity(n)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(n){super.updateMatrixWorld(n),this.dispatchEvent({type:"updateMatrixWorld"})}copy(n,r=!1){return super.copy(n,r),this.dataPatched=n.dataPatched,this.raycastLock=n.raycastLock,this.scaleLock=n.scaleLock,this.hiddenMatrix.copy(n.hiddenMatrix),this}hasEntityChild(){return this.children.some(n=>Yo(n))}isAncestorOf(n){if(this.uuid===n)return!1;let r=!1;return this.traverseEntity(s=>{s.uuid===n&&(r=!0)}),r}toObjectTransformState(n=[]){this.updateWorldMatrix(!0,!1);let r={position:this.position.toArray(),rotation:[this.rotation.x*we.RAD2DEG,this.rotation.y*we.RAD2DEG,this.rotation.z*we.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return Ny(r,n)}getTransformValues(n,r,s){return r[n].map((a,o)=>s?.shared.getVariable(a,[this.uuid,n,vJ[o]])??a)}updateTransformState(n,r){let s=!1;if(n.position&&(this.position.fromArray(this.getTransformValues("position",n,r)),s=!0),n.rotation&&(iv.fromArray(this.getTransformValues("rotation",n,r)).multiplyScalar(we.DEG2RAD),this.rotation.setFromVector3(iv),s=!0),n.scale&&(this.scale.fromArray(this.getTransformValues("scale",n,r)),s=!0),n.hiddenMatrix!==void 0&&(s=!0,this.hiddenMatrix.fromArray(n.hiddenMatrix??No.identity)),n.pivot!==void 0||n.pivotRotation!==void 0){if(s=!0,n.pivot!==void 0&&n.pivotRotation!==void 0)this.pivotMatrix.compose(iv.fromArray(n.pivot).negate(),EP.setFromEuler(MP.fromArray(n.pivotRotation.map(a=>a*we.DEG2RAD))).invert(),VU);else if(n.pivot!==void 0)this.pivotMatrix.setPosition(-n.pivot[0],-n.pivot[1],-n.pivot[2]);else if(n.pivotRotation!==void 0){let a=iv.setFromMatrixPosition(this.pivotMatrix);EP.setFromEuler(MP.fromArray(n.pivotRotation.map(o=>o*we.DEG2RAD))).invert(),this.pivotMatrix.compose(a,EP,VU)}}return s&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(a=>{a.invalidateClonerTransform(this)})),n.position&&n.rotation&&n.scale&&n.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),s}onVariableUpdate(n=!1){if(n){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)}),this.requestRender()}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let n of this.children)Dt.is(n)&&n.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(n=>{Dt.is(n)&&n.disposeRecursively()})}toState(n=[]){let r={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(n)};return Ny(r,n)}updateByObjUpdateOp(n,r){n!==void 0&&this.updateByOp({type:0,props:n,path:[]},{...this.data,...n},r,!1)}updateByOp(n,r,s,a){let o=this.data;this.data=r;let l=n,c=$t(n.path,["states","*"]);if(c!==null){if(n.type===0){let[u]=c;if(this?.stateSelection===u){let d={...n.props};if(delete d.name,Object.values(n.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let p=rr.zoom(h,n.path.slice(2));if(p)for(let f in n.props)n.props[f]===void 0&&f in p&&(d[f]=p[f])}}l={...n,props:d,path:n.path.slice(2)}}}}else if(n.type===0){let u=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(u!==void 0){if(n.props.name!==void 0&&u.name){let{name:h,...p}=u;u=p}if(n.props.material!==void 0&&"material"in u){let{material:h,...p}=u;u=p}let d=rr.removeOverridden(n.path,n.props,u);l={...n,props:d}}}if(this.updateByPatchedOpBase(l,to.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),s),$t(n.path,["overrides"])){let u=[],d=[...n.path];for(u.push(d[1]),d.splice(0,2);d.length>0&&d[0]==="descendants";)u.push(d[1]),d.splice(0,2);if(u[u.length-1]===void 0){if(n.type===0)for(let h of Object.keys(n.props)){u[u.length-1]=h;let p=s.scene.findInstance([this.uuid,...u]);p&&(p.overrideData=n.props[h],p.updateState(Do.apply(p.component.data,p.overrideData),s))}}else{let h=s.scene.findInstance([this.uuid,...u]);if(h){let p=rr.zoom(h.component.data,d);if(n={...n,path:d},n.type===0){let f=n.props;if(p)for(let[m,g]of Object.entries(n.props))g===void 0&&(f===n.props&&(f={...n.props}),f[m]=p[m]);n={...n,props:f}}h.overrideData=af.resolve(r.overrides,u),h.updateByOp(n,wr.applySimple(h.data,n),s,!1)}}}else if(this.instances.length>0){let u;if(n.path.length===0&&n.type===0){let d;for(let h of ya.rootOverrideProps)h in n.props&&(d===void 0&&(d={}),d[h]=n.props[h]);d&&(u={...n,props:d})}else for(let d of ya.rootOverrideProps)if($t(n.path,[d])){u=n;break}u!==void 0&&this.instances.forEach(d=>{if(d.isInstanceRoot){let h=Do.filterOp(d.overrideData,u);h&&d.updateByOp(h,wr.applySimple(d.data,h),s,!0)}}),this.instances.forEach(d=>{if(!d.isInstanceRoot){let h=Do.filterOp(d.overrideData,n);if(h){let p;o===d.data&&n===h?p=r:p=wr.applySimple(d.data,h),d.updateByOp(h,p,s,!0)}}})}}updateByPatchedOpBase(n,r,s){if(this.dataPatched=r,n.path.length===0&&n.type===0)n.props.type!==void 0&&!Qa.is(n.props.type)&&xa.changeEntityProptotype(this,r,s);else if(n.path.length===1&&n.path[0]==="geometry"&&n.type===0&&"type"in n.props){xa.changeEntityProptotype(this,r,s);for(let a of this.children)Dt.is(a)&&a.updateVisible(s.scene)}this.updateByPatchedOp(n,r,s)}updateByPatchedOp(n,r,s){if(n.path.length===0&&n.type===0?this.updateState(n.props,s):n.type===0&&("resolutionLevel"in n.props||"useChildrenColors"in n.props)&&this.updateState(r,s),n.path[0]==="morphTargetInfluences"&&n.type===0){let o=r.morphTargetInfluences.get(n.path[1])?.data.name;o&&this.updateMorphInfluences(o,s.shared.getVariable(n.props.value,[this.uuid,"morphTargetInfluences",o]))}if($t(n.path,["pathSnapping"])!==null&&this.updatePathSnapping(r.pathSnapping),$t(n.path,["cloner"])!==null){let a=wr.drop(n,1);a.path.length===0&&a.type===0&&a.props.disabled===!0?this.setFromClonerState(null,s):this.cloner?this.cloner.updateState(r.cloner,s):(this.setFromClonerState(r.cloner,s),this.expandCloner(s)),this.updateVisible(s.scene)}}updatePathSnapping(n=this.dataPatched.pathSnapping){this._updatedPathSnapping=n,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(n){if(this._needApplyPathSnapping===!1)return;let r=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,s=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,a=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,o=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(r===null)return;let l=n.find(r);if(!l)return;this._needApplyPathSnapping=!1;let c=l.data;if(c.geometry.path.points.length<=1)return;let u=V1(c.geometry.path),d=(s+a)%1;s+a===1&&d===0&&(d=1);let h=null;try{h=u.curves.length?u.getPointAt(d):null}catch(m){!1&&(console.warn(`The aligned path on ${this.name} is invalid. (${l.name})`),console.error(m))}if(h===null)return;l.updateMatrixWorld();let p=this.parent?zU.copy(this.parent.matrixWorld).invert():zU.identity();p.multiply(l.matrixWorld),h.applyMatrix4(p);let f={position:h.toArray(),rotation:c.rotation};if(o==="tangential"){let m=GU.extractRotation(l.matrixWorld),g=u.getTangentAt(d).applyMatrix4(m).add(h),y=GU.lookAt(h,g,bJ),v=iv.setFromEuler(MP.setFromRotationMatrix(y)).multiplyScalar(we.RAD2DEG);f={...f,rotation:v.toArray()}}this.updateTransformState(f),this.traverseEntity(m=>{m._cameraType&&m.dispatchEvent(yJ)})}updateVisible(n){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!n)return;let r=!1;this.traverseEntity(s=>{if(s.data.type==="Splat")return r=!0,!0}),r&&n.reloadSplats()}updateState_Entity(n,r){n.name!==void 0&&(this.name=n.name),n.raycastLock!==void 0&&(this.raycastLock=n.raycastLock),n.visible!==void 0&&(this.updateVisible(r?.scene),this.resetBBoxNeedsUpdate()),r&&"cloner"in n&&n.cloner!==void 0&&(this.setFromClonerState(n.cloner,r),this.updateVisible(r.scene)),this.updateTransformState(n,r)}get attachedSurfaceCloners(){return this.children.filter(n=>oc(n)&&n.parameters.type==="toObject")}setFromClonerState(n,r){if(!this.disposed)if(n===null||n.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(xa.Cloner===null){Jn("cloners","a cloner");return}this.cloner=new xa.Cloner(this,n),r.scene.addPendingExpandCloner(this)}else this.cloner.updateState(n,r)}expandCloner(n){!this.disposed&&this.cloner&&this.cloner.expandClones(n)}invalidateClonerTransform(n){this.cloner&&this.cloner.invalidateTransform(n)}requestRender(){this.dispatchEvent({type:"requestRender"})}}});var z1,Ma,Su=F(()=>{"use strict";Y();Yi();(t=>t.is=e=>"objectHelper"in e)(z1||(z1={}));Ma=(i,t)=>class extends Tf(i){constructor(){super(...arguments);this.objectHelper=new t(this);this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(r,s){this.objectHelper.raycast(r,s)}showGizmos(){for(let r in this.gizmos){let s=this.gizmos[r];s instanceof $l&&(s.visible=!0)}}updateEntityBoxSize(r,s){this.objectHelper.visible&&this.geometryHelper instanceof ni?(r.setScalar(0),s.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(r,s)}hideGizmos(){for(let r in this.gizmos){let s=this.gizmos[r];s instanceof $l&&(s.visible=!1)}}}});var us,sv=F(()=>{"use strict";Y();Zy();Su();us=class extends Ma(Us,ba){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function so(i,t,e,n,r,s,a){G1.set(r,s,a).unproject(n);let o=t[i];if(o!==void 0){let l=e.getAttribute("position");for(let c=0,u=o.length;c<u;c++)l.setXYZ(o[c],G1.x,G1.y,G1.z)}}var G1,_a,_P,j1,jU=F(()=>{"use strict";Y();yf();vf();G1=new _,_a=new ws,_P=class extends zl{constructor(e){let n=new De,r=new zs({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],a=[],o={},l=new Ze(15711266),c=new Ze(15711266),u=new Ze(2857471);d("n1","n2",l),d("n2","n4",l),d("n4","n3",l),d("n3","n1",l),d("f1","f2",l),d("f2","f4",l),d("f4","f3",l),d("f3","f1",l),d("n1","f1",l),d("n2","f2",l),d("n3","f3",l),d("n4","f4",l),d("p","n1",c),d("p","n2",c),d("p","n3",c),d("p","n4",c),d("u1","u2",u),d("u2","u3",u),d("u3","u1",u);function d(p,f,m){h(p,m),h(f,m)}function h(p,f){s.push(0,0,0),a.push(f.r,f.g,f.b),o[p]===void 0&&(o[p]=[]),o[p].push(s.length/3-1)}n.setAttribute("position",new Ve(s,3)),n.setAttribute("color",new Ve(a,3));super(n,r);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){let e=this.geometry,n=this.pointMap,r=!0;_a.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,a=1,o=r?.8:1e-4;so("n1",n,e,_a,-s,-a,o),so("n2",n,e,_a,s,-a,o),so("n3",n,e,_a,-s,a,o),so("n4",n,e,_a,s,a,o);let l=o;so("f1",n,e,_a,-s,-a,l),so("f2",n,e,_a,s,-a,l),so("f3",n,e,_a,-s,a,l),so("f4",n,e,_a,s,a,l);let c=l,u=.5;so("u1",n,e,_a,s*.7*u,a*1.1,c),so("u2",n,e,_a,-s*.7*u,a*1.1,c),so("u3",n,e,_a,0,a*(1.1+.9*u),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};j1=class extends jo(_P){constructor(e){super(e);this.object=e;this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,n){Ho(this.object,this.geometry,e,n,!0)}}});function HU(i){return 1-Math.pow(1-i,3)}var H1,Af,TP,AP,CP,av,PP,$o,on,$s=F(()=>{"use strict";Y();jU();ft();Su();hn();H1=790;Af=new _,TP=new _,AP=new qe,CP=new _,av=new _,PP=new _,$o=class extends Ma(ws,j1){constructor(e="",n={...Hd.defaultData,name:""}){super();this._cameraType="OrthographicCamera";this.targetOffset=Ja.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.wasMovedByUser=!1;this.wasMovedBySwitchCameraAction=!1;this._createdAt=typeof performance<"u"?performance.now():0;this._tickProjectionTransition=()=>{let e=this._projectionTransition;if(e===void 0)return;if(this.disposed){this._endProjectionTransition();return}e.raf=requestAnimationFrame(this._tickProjectionTransition);let n=$o.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),n?.()};this.super_Entity(e,n),this.previousProjectionMatrix=new ne,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,s=this.height;this.orthoCamera=new Ya(r*-.5,r*.5,s*.5,s*-.5,-5e4,1e4),this.perspCamera=new Xa(45,r/s,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(e){let n=$o.projectionTransitionsEnabled;$o.projectionTransitionsEnabled=!1;try{return e()}finally{$o.projectionTransitionsEnabled=n}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,n){e==="PerspectiveCamera"?this.perspCamera.near=n:this.orthoCamera.near=n}setZoom(e,n){n>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=n:this.orthoCamera.zoom=n)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,n,r){typeof e=="number"&&(e=new _(e,n,r)),super.lookAt(e),this.getWorldPosition(Af),this.targetOffset=Af.distanceTo(e)}getTarget(e=new _){return this.getWorldDirection(TP),this.getWorldPosition(Af),TP.multiplyScalar(this.targetOffset),e.copy(Af).add(TP),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Af),Af.distanceTo(e)}updateUp(){this.getWorldQuaternion(AP),CP.set(0,0,1).applyQuaternion(AP),av.copy(Zt.DEFAULT_UP),this.isUpVectorFlipped&&av.negate(),av.applyQuaternion(AP),PP.copy(Zt.DEFAULT_UP).projectOnPlane(CP),this.angleOffsetFromUp=PP.angleTo(av),this.angleOffsetFromUp*=PP.cross(av).dot(CP)>=0?1:-1}updateTransformState(e,n){let r=super.updateTransformState(e,n);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(e){let n=e.getWorldPosition(new _),s=e.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:n.clone().add(s),target:n}}getViewToTarget(e){let r=this.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:e.clone().sub(r),target:e}}getViewToObject(e){let n=new _;return e.getWorldPosition(n),this.getViewToTarget(n)}setViewplaneSize(e,n,r=!1){if(this.aspect=e/n,r){let s=e>n?this.aspect:1,a=e>n?1:this.aspect;this.left=-H1*.5*s,this.right=H1*.5*s,this.top=H1*.5*(1/a),this.bottom=-H1*.5*(1/a)}else this.left=-e*.5,this.right=e*.5,this.top=n*.5,this.bottom=-n*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let e=this._projectionTransition;if(e===void 0)return 1;let n=(performance.now()-e.start)/e.duration;return n>=1?1:n<=0?0:HU(n)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return $o.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=$o.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let n=this._projectionTransition;n===void 0&&(n={from:new ne,blend:new ne,blendInverse:new ne,start:0,duration:$o.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=n),n.from.copy(this.projectionMatrix),n.start=performance.now(),n.duration=$o.projectionTransitionDuration,n.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,e&&(n.requestRender=e),n.raf!==0&&cancelAnimationFrame(n.raf),n.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;let n=(performance.now()-e.start)/e.duration;if(n>=1){this._endProjectionTransition();return}let r=HU(n),s=e.from.elements,a=this._activeSubCamera.projectionMatrix.elements,o=e.blend.elements,l=e.referenceDepth,c=Math.max(1e-6,s[15]-s[11]*l),u=Math.max(1e-6,a[15]-a[11]*l),d=r*c/(r*c+(1-r)*u);for(let h=0;h<16;h++)o[h]=s[h]+(a[h]-s[h])*d;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let n=this._activeSubCamera;this.projectionMatrix=n.projectionMatrix,this.projectionMatrixInverse=n.projectionMatrixInverse}_syncProjectionTransition(e){let n=e._projectionTransition;if(n===void 0){this._projectionTransition!==void 0&&this._endProjectionTransition();return}let r=this._projectionTransition;r===void 0?(r={from:new ne,blend:new ne,blendInverse:new ne,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):r.raf!==0&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(n.from),r.start=n.start,r.duration=n.duration,r.referenceDepth=n.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,n,r,s,a,o){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,n,r,s,a,o):this.orthoCamera.setViewOffset(e,n,r,s,a,o),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,n){return super.copy(e,n),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=Ja.sanitizeTargetOffset(e.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(e),this}toCameraState(e=[]){let n={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ny(n,e)}updateCameraSubtype(e,n){let r=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";n.zoom!==void 0&&this.setZoom(r,n.zoom),n.near!==void 0&&this.setNear(r,n.near),n.fov!==void 0&&r==="PerspectiveCamera"&&(this.fov=n.fov)}updateState(e,n){this.updateCameraState(e,n)}updateCameraState(e,n){this.updateState_Entity(e,n),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(e.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(n?.shared.requestRender),this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(r=>typeof r=="number"?r:0)),e.targetOffset!==void 0&&(this.targetOffset=Ja.sanitizeTargetOffset(e.targetOffset)),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},on=$o;on.projectionTransitionsEnabled=!1,on.projectionTransitionDuration=350,on.projectionTransitionMinAgeMs=1e3});function W1(i){return i.type==="TorusGeometry"&&i.arc===360}var WU,IP,ov,Cf=F(()=>{"use strict";Y();WU=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??n),s=Math.abs(e.depth??n),a=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(e,{width:n,height:r,depth:s,radius:a,segments:Math.round(e.segments),pathSegments:Math.round(e.pathSegments),cornerSegments:Math.round(e.cornerSegments)})}}static build(i){let{width:t,height:e,depth:n,radius:r,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:d}=i.parameters,h=new ov(!1,t,e,n,r,s,a,o,l,c,u,d);return Object.assign(h,{userData:{...i,type:"HelixGeometry"}})}},IP=new Vs([0,0,0],1);ov=class extends De{constructor(t=!0,e=1,n=1,r=1,s=1,a=1,o=1,l=1,c=1,u=1,d=1,h=1){if(super(),a===0)return;let p=t&&a===1;p&&(h=0),d>100&&(d=100),d===0&&(h=0);let f=()=>new _,m=new _,g=f(),y=f(),v=f(),b,x,S,E,M,w,T,A,C=f(),P=f(),D=f(),I=f(),L=f(),U=f(),G=f(),X=f(),ae=n-2*l+.001,ee=ae/a,$=Math.ceil(o*a),K=$+1,re=ae/$,fe=-ae/2,ve=u+1,de=2*Math.PI/u,Se=Math.PI/2/h,oe=.01,be=Math.min((1-d/100)*l,l-oe),Oe=l-be,Le=0,ke=2,Ce=h*ke+ke,ce=ve*Ce/ke,ye=ce+ve*K,Me=Math.max(0,ve*(K+Ce)),[Ne,He,_e]=[3,3,2].map(xe=>Array(Me*xe).fill(0)),Re=[],B=s-l;function me(xe,Fe){let ue=Math.PI/2;w=Fe*re,A=2*Math.PI*(w%ee)/ee+ue,w+=fe,T=Math.sin(A)*B,M=Math.cos(A)*B,t?xe.set(M,T,w):xe.set(M,w,T)}me(m,-1e-10),me(g,0),C.copy(m),me(m,1);let W=m.distanceTo(g),et=p?0:Oe+be,Ge=W*$+2*et,z=be,O=Ge-et;for(let xe=0;xe<=$;xe++){me(y,xe),X.subVectors(y,C).normalize(),C.copy(y),U.copy(y).setComponent(+t+1,0).normalize(),G.crossVectors(X,U).normalize();let Fe=xe===0,ue=xe===$,Te=Fe?3*Math.PI/2:Se,Ke=Fe?z:O,xt=Fe?ve:ye,Je=Fe?0:Me-ve,Xe=X.clone().multiplyScalar(Fe?-Oe:Oe).add(y),rt=X.clone().multiplyScalar(Fe?-1:1).normalize();for(let yt=0;yt<ve;yt++){let kt=yt*de;if(P.addVectors(m.copy(U).multiplyScalar(l*Math.cos(kt)),g.copy(G).multiplyScalar(l*Math.sin(kt))),D.copy(P).normalize(),Fe||ue){p||(Le=Je+yt,[0,1,2].forEach(Z=>{Ne[Le*3+Z]=Xe.getComponent(Z),He[Le*3+Z]=rt.getComponent(Z)}),_e[Le*2]=+ue,_e[Le*2+1]=yt/u),g.copy(D).multiplyScalar(be),v.addVectors(y,g);for(let Z=0;Z<h;Z++){let Ye=Z*Se+Te;I.addVectors(m.copy(X).multiplyScalar(Oe*Math.sin(Ye)),g.copy(D).multiplyScalar(Oe*Math.cos(Ye))),L.copy(I).normalize(),g.addVectors(v,I),I.normalize(),Le=xt+Z*ve+yt,[0,1,2].forEach($e=>{Ne[Le*3+$e]=g.getComponent($e),He[Le*3+$e]=L.getComponent($e)});let Ae=+Fe+Math.sin(Ye);_e[Le*2]=(Ke+Oe*Ae)/Ge,_e[Le*2+1]=yt/u}}g.addVectors(y,P),Le=ce+xe*ve+yt,[0,1,2].forEach(Z=>{Ne[Le*3+Z]=g.getComponent(Z),He[Le*3+Z]=D.getComponent(Z)}),_e[Le*2]=(et+xe*W)/Ge,_e[Le*2+1]=yt/u}}let q=K+2*h+ke,[J,le]=[+p,q-1];for(let xe=J;xe<=le-1;xe++){let Fe=p&&xe===le-1;for(let ue=0;ue<ve-1;ue++)b=xe*ve+ue,x=b+1,S=(Fe?ue:b)+ve,E=(Fe?ue+1:x)+ve,xe===0?Re.push(x,E,S):xe===q-2?Re.push(b,x,S):Re.push(b,x,S,x,E,S)}this.setIndex(Re),this.setAttribute("position",new Ve(Ne,3)),this.setAttribute("normal",new Ve(He,3)),this.setAttribute("uv",new Ve(_e,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t=this.userData.parameters,e=Math.ceil(t.tubularSegments),n=t.radialSegments,r=n+1,s=[],a,o,l,c;for(let u=1;u<e;u++)for(let d=0;d<n;d++)a=u*r+d,o=a+1,l=a+r,c=o+r,s.push(a,o,l,o,c,l);for(let u=0;u<n;u++)a=e*r+u,o=a+1,l=u+r,c=u+1+r,s.push(a,o,l,o,c,l);return IP.array=new Uint32Array(s),IP.count=s.length,IP}}});function XU(i){if(q1)return q1;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.13/build"),s=import("./boolean.js"),[a,o]=await Promise.all([s,fetch(`${n}/boolean.wasm`).then(l=>l.arrayBuffer())]);await a.default({module_or_path:o}),lv=a}return q1=t(),q1}function Y1(){if(lv===void 0)throw new Error("boolean-wasm is not loaded");return lv}function OP(i){let t=X1.get(i);if(t===void 0)throw new Error("Unknown csg mesh set handle "+i);return t}function RP(i){return X1.set(++qU,i),qU}function EJ(i,t){if(t&&i.userData.positions!==void 0){let o=i.userData,l=[];for(let c=0,u=0;c<o.verticesPerFace.length;c++){let d=o.verticesPerFace[c];for(let h=1;h<d-1;h++)l.push(o.indices[u],o.indices[u+h],o.indices[u+h+1]);u+=d}return{positions:o.positions instanceof Float32Array?o.positions:new Float32Array(o.positions),indices:new Uint32Array(l)}}let e;W1(i.userData.parameters)?e=i.getClosedTorusIndicesForBooleanOrSubdiv():e=i.getIndex();let n=i.getAttribute("position"),r;if(e===null){r=new Uint32Array(n.count);for(let o=0;o<r.length;o++)r[o]=o}else e.array instanceof Uint32Array?r=e.array:r=new Uint32Array(e.array);let s=i.getAttribute("normal"),a=s!==void 0&&s.itemSize===3&&s.count===n.count&&s.array instanceof Float32Array&&s.isInterleavedBufferAttribute!==!0?s.array:void 0;return{positions:n.array,indices:r,normals:a}}function YU(i,t,e){if(lv===void 0)return-1;let{positions:n,indices:r,normals:s}=EJ(i,t);return RP(new lv.CsgMesh(n,r,s))}function $U(i,t){let e=Y1(),n=wJ[t];if(n===void 0)throw new Error("Unknown boolean operation "+t);let r=i.map(OP);if(r.length===1)return e.clone_mesh(r[0]);let s=[],a;if(t===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=e.boolean_mesh(o,r[l],0),s.push(o);a=e.boolean_mesh(r[r.length-1],o,2)}else if(t===2)a=e.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=e.boolean_mesh(o,r[l],n),s.push(o),o.tri_count()!==0);l++);a=o,s.pop()}for(let o of s)o.free();return a}function KU(i,t,e,n){let r=Y1(),s=$U(i,t),a=r.mesh_render_data(s,Math.max(n,0));if(e.setAttribute("position",new Ve(a.positions(),3)),e.setAttribute("normal",new Ve(a.normals(),3)),a.free(),e.boundingSphere===null&&(e.boundingSphere=new nr),s.tri_count()===0)e.boundingSphere.center.set(0,0,0),e.boundingSphere.radius=0,e.userData.parameters={width:0,height:0,depth:0};else{let o=s.bounds();e.boundingSphere.center.set(o[0],o[1],o[2]),e.boundingSphere.radius=(o[3]**2+o[4]**2+o[5]**2)**.5,e.userData.parameters={width:o[3]*2,height:o[4]*2,depth:o[5]*2}}return RP(s)}function ZU(i,t){let e=Y1(),n=$U(i,t),r=e.mesh_topological_data(n),s=r.positions(),a=r.indices();r.free(),n.free();let o=new Uint8Array(a.length/3).fill(3);return{positions:s,indices:a,verticesPerFace:o}}function $1(i,t){OP(i).transform(new Float32Array(t.elements))}function K1(i){let t=X1.get(i);t!==void 0&&(t.free(),X1.delete(i))}function QU(i,t){let e=Y1();return RP(e.instanced_union(OP(i),t))}var lv,X1,qU,q1,wJ,cv=F(()=>{Y();Cf();X1=new Map,qU=0;wJ={[0]:0,[1]:1,[2]:2}});function Kd(i){return i!==null&&"booleanOp"in i}var Pf,JU=F(()=>{"use strict";Y();Yi();cv();Pf=class extends Tf(Ht){constructor(){super(...arguments);this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new ne}updateVisible(e){super.updateVisible(e),this.visible=!Kd(this.parent)&&this.visible,Kd(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Kd(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(K1(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Kd(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof Pf&&(e.freeBooleanPointer(),Kd(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,n){let r=super.updateTransformState(e,n);return r&&Kd(this.parent)&&this.invalidateDownstreamBooleanData(!0),r}onVariableUpdate(e=!1){super.onVariableUpdate(e),Kd(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}});function ek(){return MJ}var MJ,tk=F(()=>{"use strict";MJ=null});function uv(i,t=0,e=i.count,n,r){let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,u=-1/0;for(let d=t;d<e;d++){let h=i.getX(d),p=i.getY(d),f=i.getZ(d);h<s&&(s=h),p<a&&(a=p),f<o&&(o=f),h>l&&(l=h),p>c&&(c=p),f>u&&(u=f)}Z1.min.set(s,a,o),Z1.max.set(l,c,u),Z1.getCenter(n),Z1.getSize(r).multiplyScalar(.5)}var Z1,_J,TJ,Kt,gi=F(()=>{"use strict";Y();JU();tk();Z1=new Bt;_J=new De,TJ=new ti,Kt=class extends Pf{constructor(t,e){super(_J,TJ),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){let n=ek();if(n!==null){n(this,t,e);return}super.raycast(t,e)}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?uv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}}});function Zd(i){return i?.isClassicNodeMaterial===!0}function nk(i){return i?.isClassicSharedMaterial===!0}var Q1=F(()=>{"use strict"});var yn,Ta=F(()=>{Y();yn=class extends Ze{constructor(e,n,r,s){super(e,n,r);this.isColorA=!0;this.a=s}setRGBA(e,n,r,s){super.setRGB(e,n,r),this.a=s}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,n="srgb"){let r;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(r=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let s,a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.a=a==="rgba"?parseFloat(s[4]):1,super.setStyle(e,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.a=a==="hsla"?parseFloat(s[4]):1,super.setStyle(e,n);break}}return super.setStyle(e,n)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}});var uc,LP=F(()=>{"use strict";Ta();uc=class extends yn{}});var J1,rk=F(()=>{"use strict";J1=class{constructor(t=1e3*10){this.timeout=t;this.cache=new Map;this.head={data:null,time:0,src:null,next:null,prev:null};this.tail={data:null,time:1/0,src:null,next:null,prev:null};this.hasClean=!1;this.cleanupTimer=null;this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let n=e;e=e.next,e.prev=this.head,this.head.next=e,n.next=null,n.prev=null,n.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),n=this.cache.get(t);return n===void 0?(n={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,n)):(n.time=e,n.prev.next=n.next,n.next.prev=n.prev),n.prev=this.tail.prev,n.next=this.tail,this.tail.prev.next=n,this.tail.prev=n,this.scheduleCleanup(),n.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}});function ik(i){return typeof i=="string"?i:(dv||(dv=new NP),dv.load(i))}function sk(){dv&&dv.disposeAll()}var NP,dv,BP=F(()=>{rk();NP=class extends J1{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}});var ew,tw,FP=F(()=>{"use strict";ew=class{constructor(t,e){this.data=t;this.cache=e;this.refCount=0}deref(){if(this.refCount===0&&!1)throw new Error("ref count -1?");this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){if(this.refCount!==0&&!1)throw new Error("ref count is not 0")}},tw=class{constructor(){this.cache=new Map}remove(t){if(this.cache.delete(t.data)===!1&&!1)throw new Error("ref count remove non-exists")}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}});var nw,ak=F(()=>{Y();nw=class extends ry{constructor(t){super(t),this.type=pr}parse(t){let a=function(w,T){switch(w){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:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(T||""))}},u=`
4128
4128
  `,d=function(w,T,A){T=T||1024;let P=w.pos,D=-1,I=0,L="",U=String.fromCharCode.apply(null,new Uint16Array(w.subarray(P,P+128)));for(;0>(D=U.indexOf(u))&&I<T&&P<w.byteLength;)L+=U,I+=U.length,P+=128,U=String.fromCharCode.apply(null,new Uint16Array(w.subarray(P,P+128)));return-1<D?(A!==!1&&(w.pos+=I+D+1),L+U.slice(0,D)):!1},h=function(w){let T=/^#\?(\S+)/,A=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,C=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,P=/^\s*FORMAT=(\S+)\s*$/,D=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,I={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},L,U;for((w.pos>=w.byteLength||!(L=d(w)))&&a(1,"no header found"),(U=L.match(T))||a(3,"bad initial token"),I.valid|=1,I.programtype=U[1],I.string+=L+`
4129
4129
  `;L=d(w),L!==!1;){if(I.string+=L+`
4130
4130
  `,L.charAt(0)==="#"){I.comments+=L+`
4131
4131
  `;continue}if((U=L.match(A))&&(I.gamma=parseFloat(U[1])),(U=L.match(C))&&(I.exposure=parseFloat(U[1])),(U=L.match(P))&&(I.valid|=2,I.format=U[1]),(U=L.match(D))&&(I.valid|=4,I.height=parseInt(U[1],10),I.width=parseInt(U[2],10)),I.valid&2&&I.valid&4)break}return I.valid&2||a(3,"missing format specifier"),I.valid&4||a(3,"missing image size specifier"),I},p=function(w,T,A){let C=T;if(C<8||C>32767||w[0]!==2||w[1]!==2||w[2]&128)return new Uint8Array(w);C!==(w[2]<<8|w[3])&&a(3,"wrong scanline width");let P=new Uint8Array(4*T*A);P.length||a(4,"unable to allocate buffer space");let D=0,I=0,L=4*C,U=new Uint8Array(4),G=new Uint8Array(L),X=A;for(;X>0&&I<w.byteLength;){I+4>w.byteLength&&a(1),U[0]=w[I++],U[1]=w[I++],U[2]=w[I++],U[3]=w[I++],(U[0]!=2||U[1]!=2||(U[2]<<8|U[3])!=C)&&a(3,"bad rgbe scanline format");let ae=0,ee;for(;ae<L&&I<w.byteLength;){ee=w[I++];let K=ee>128;if(K&&(ee-=128),(ee===0||ae+ee>L)&&a(3,"bad scanline data"),K){let re=w[I++];for(let fe=0;fe<ee;fe++)G[ae++]=re}else G.set(w.subarray(I,I+ee),ae),ae+=ee,I+=ee}let $=C;for(let K=0;K<$;K++){let re=0;P[D]=G[K+re],re+=C,P[D+1]=G[K+re],re+=C,P[D+2]=G[K+re],re+=C,P[D+3]=G[K+re],D+=4}X--}return P},f=function(w,T,A,C){let P=w[T+3],D=Math.pow(2,P-128)/255;A[C+0]=w[T+0]*D,A[C+1]=w[T+1]*D,A[C+2]=w[T+2]*D,A[C+3]=1},m=function(w,T,A,C){let P=w[T+3],D=Math.pow(2,P-128)/255;A[C+0]=ks.toHalfFloat(Math.min(w[T+0]*D,65504)),A[C+1]=ks.toHalfFloat(Math.min(w[T+1]*D,65504)),A[C+2]=ks.toHalfFloat(Math.min(w[T+2]*D,65504)),A[C+3]=ks.toHalfFloat(1)},g=new Uint8Array(t);g.pos=0;let y=h(g),v=y.width,b=y.height,x=p(g.subarray(g.pos),v,b),S,E,M;switch(this.type){case Wt:M=x.length/4;let w=new Float32Array(M*4);for(let A=0;A<M;A++)f(x,A*4,w,A*4);S=w,E=Wt;break;case pr:M=x.length/4;let T=new Uint16Array(M*4);for(let A=0;A<M;A++)m(x,A*4,T,A*4);S=T,E=pr;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:v,height:b,data:S,header:y.string,gamma:y.gamma,exposure:y.exposure,type:E,colorSpace:_o,minFilter:ht,magFilter:ht,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function UP(i){return i.length>2&&i[0]===35&&i[1]===63}function ok(i){try{let t=new nw().parse(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength));if(!t||!t.width||!t.height)return null;let{width:e,height:n}=t,r=t.data,s=new Uint16Array(r.length),a=e*4,o=u=>ks.toHalfFloat(Math.pow(Math.max(ks.fromHalfFloat(u),0),1/2.2)),l=new Map,c=u=>{let d=l.get(u);return d===void 0&&(d=o(u),l.set(u,d)),d};for(let u=0;u<n;u++){let d=u*a,h=(n-1-u)*a;for(let p=0;p<a;p+=4)s[h+p]=c(r[d+p]),s[h+p+1]=c(r[d+p+1]),s[h+p+2]=c(r[d+p+2]),s[h+p+3]=r[d+p+3]}return{isSplineHdr:!0,data:s,width:e,height:n}}catch{return null}}function lk(i){let t=new Hn(i.data,i.width,i.height,qn,pr);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var ck=F(()=>{"use strict";Y();ak()});var AJ,If,kP=F(()=>{"use strict";Y();BP();FP();ck();AJ=0,If=class extends ew{constructor(e,n){super(e,n.imageHolderCache);this.data=e;this.shared=n;this.instanceId=++AJ;this.loaded=!1;this.isVideo=!1;this.isBuffer=!1;this.isHdr=!1;this._cache={[1e3]:{},[1001]:{},[1002]:{}};this.isVideo=e.type==="video",this.isBuffer=e.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let n=()=>{this.loaded=!0;for(let r of Object.values(this._cache))for(let s of Object.values(r))for(let a of Object.values(s))a&&(a.image=this.img,a.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof e!="string"){let r=new FileReader;r.readAsDataURL(new Blob([e],{type:"video/mp4"}));let s;await new Promise(a=>{r.onloadend=o=>{s=o.target?.result,a(null)}}),this.img.src=s}else this.img.src=e;this.img.onloadeddata=()=>{n()}}else if(e instanceof Uint8Array?UP(e):typeof e=="string"&&/\.hdr($|[?#])/i.test(e)){let r=e instanceof Uint8Array?e:null;if(r===null)try{r=new Uint8Array(await(await fetch(e)).arrayBuffer())}catch{r=null}let s=r!==null&&UP(r)?ok(r):null;s!==null&&(this.isHdr=!0,this.img=s,n())}else this.img=new Image,this.img.src=ik(e),this.img.onload=n,await new Promise(r=>{this.img.onload=()=>{n(),r(null)}})}getTexture(e,n=1008,r=1006){let s=this._cache[e]?.[n]?.[r];if(s)return s;{let a;return this.isBuffer?a=this.img.texture:this.isVideo?a=new Yg(this.img,void 0,e,e):this.isHdr?(a=lk(this.img),a.wrapS=e,a.wrapT=e,a.magFilter=r,a.minFilter=n):a=new gn(this.img,void 0,e,e,r,n),this.isBuffer||(a.anisotropy=8,a.generateMipmaps=n===1008),this.loaded&&(a.needsUpdate=!0),this._cache[e]===void 0&&(this._cache[e]={}),this._cache[e][n]===void 0&&(this._cache[e][n]={}),this._cache[e][n][r]=a,a}}setNeedsUpdate(e){if(!this.isBuffer)for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let s of Object.values(r))s&&(s.needsUpdate=e)}disposeTextures(){for(let[e,n]of Object.entries(this._cache))for(let[r,s]of Object.entries(n))for(let[a,o]of Object.entries(s))o?.dispose(),this._cache[e]!==void 0&&this._cache[e][r]!==void 0&&(this._cache[e][r][a]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}});var Ks,rw=F(()=>{"use strict";kP();Ks=class extends If{}});function dk(i){if(typeof i=="string")return i;let t=uk.get(i);return t||(t={url:URL.createObjectURL(new Blob([i]))},uk.set(i,t)),t.url}var uk,hk=F(()=>{"use strict";uk=new Map});function gk(){if(pk)return;if(iw)return iw;async function i(){await import("./howler.js"),fk(window!==void 0?window:global),pk=!0}return iw=i(),iw}var fk,mk,pk,iw,VP=F(()=>{mk=new Promise(i=>{fk=i}),pk=!1});function yk(i,t){i.forEach(e=>{"dragDropActions"in e.data?(t.push(...e.data.dragDropActions.drag),t.push(...e.data.dragDropActions.drop)):"inActions"in e.data?(t.push(...e.data.inActions),t.push(...e.data.outActions)):"gameActions"in e.data?(t.push(...e.data.gameActions.idle),t.push(...e.data.gameActions.move),t.push(...e.data.gameActions.jump),t.push(...e.data.gameActions.run)):"breakpoints"in e.data?e.data.breakpoints.forEach(n=>{t.push(...n.data.actions)}):"actions"in e.data&&(t.push(...e.data.actions),e.data.actions.forEach(n=>{n.data.type==="Conditional"&&n.data.ifActions&&(t.push(...n.data.ifActions),t.push(...n.data.elseActions))}))})}function bk(i){let t=!1,e=[];return i.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((s,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;yk(a.events,e),t=t||e.some(o=>o.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;yk(r.events,e),t=t||e.some(s=>s.data.type==="Audio")}),t}var vk,dc,sw=F(()=>{hk();VP();mk.then(i=>vk=i);dc=class{constructor({src:t,volume:e,delay:n,loop:r}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._status="stopped";this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)};let s;typeof t=="string"?s={src:t}:s={src:dk(t),format:"wav"},this.sound=new vk.Howl(s),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),n!==void 0&&(this.delay=n),r!==void 0&&(this.loop=r)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,n){this.sound.on(t,e,n)}off(t,e,n){this.sound.off(t,e,n)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function Sk(i){xk=i}function wk(){return xk}function zP(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&(n.geometry.type==="TextGeometry"||n.geometry.type==="InputGeometry")&&(t=!0)}),t}var xk,aw=F(()=>{xk=null});function Ek(i){return new j(i.y,-i.x)}var ow,hv,pv=F(()=>{"use strict";Y();ow=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=i.parameters?.radiusTop,n=i.parameters?.radiusBottom,r=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},i.parameters);r.thetaLength=we.clamp(r.thetaLength,0,360),r.hollow=we.clamp(r.hollow??0,0,1);let s=r.width/2,a=r.radiusTop??s,o=r.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),r.shapeBlendNode){a=e??s,o=n??s;let l=Math.max(a,o)*2;r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:a,radiusBottom:o})}}static build(i){let{width:t,depth:e,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l,radiusTop:c,radiusBottom:u,cornerRadius:d,cornerSegments:h,hollow:p}=i.parameters,f;l===0?(f=new De,f.setAttribute("position",new Ve([],3))):d||p?f=new hv(c,u,n,r,s,a,o,l*Math.PI/180,d,d,h,p):f=new Ao(c,u,n,r,s,a,o,l*Math.PI/180);let m=e/t;return m!==1&&f.scale(1,1,m),Object.assign(f,{userData:{...i,type:"CylinderGeometry"}})}};hv=class extends De{constructor(t,e,n,r,s,a,o,l,c,u,d,h,p=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,n=n||1,r=Math.floor(r)||8,s=Math.floor(s)||1,a=a!==void 0?a:!1,o=o!==void 0?o:0,l=l!==void 0?l:Math.PI*2,a&&(c=0,u=0);let f=n/2;p&&t==0&&(t=c),p&&e==0&&(e=u);let m=new j(t,f),g=new j(e,-f),y=null,v=null,b=null,x=null,S=m.clone().sub(g),E=0,M=0,w=0;h>0&&(E=Math.min(t,e)*(1-h),M=t-E,w=e-E);let T=m.clone();T.x-=E;let A=Math.PI-S.angle(),C=S.angle(),P=Math.tan(C/2),D=Math.tan(A/2),I=P+D,L=h?I:D,U=h?I:P;if(c=Math.min(c,(t-M)/L,S.length()/I),u=Math.min(u,(e-w)/U,S.length()/I),c>0){let _e=c/P;y=m.clone().sub(new j(_e,c)),h&&(b=y.clone(),b.x-=E-I*c),m.sub(S.clone().setLength(_e))}if(u>0){let _e=u/D;v=g.clone().sub(new j(_e,-u)),g.add(S.clone().setLength(_e)),h&&(x=v.clone(),x.x-=E-I*u,T.sub(S.clone().setLength(_e)))}S=m.clone().sub(g);let G=S.length()<.5,X=[],ae=[],ee=[],$=[],K=[],re=[],fe=(_e,Re,B,me,W)=>{for(let et=0;et<d+1;et++){let Ge=et/d,z=me<0?Ge:1-Ge;W&&(z-=1),z*=_e;let O=Math.sin(z),q=Math.cos(z)*me,J=q*Re+B.y;X.push(O*Re+B.x),ae.push(J),ee.push(O),$.push(q),K.push(.5+J/n),re.push(!1)}},ve=(_e,Re,B)=>{let me=[_e,Re];B<0&&me.reverse();for(let W of me)X.push(W),ae.push(f*B),ee.push(0),$.push(B),K.push(.5),re.push(!0)};if(x&&v?(fe(A,u,x,-1,!0),fe(C,u,v,-1,!1)):v?(ve(v.x,0,-1),fe(C,u,v,-1,!1)):a||ve(e,w,-1),!G){let _e=Ek(S).normalize();for(let Re=0;Re<=s;Re++){let B=Re/s,me=S.y*B+g.y;X.push(S.x*B+g.x),ae.push(me),ee.push(_e.x),$.push(_e.y),K.push(.5+me/n),re.push(!1)}}if(b&&y?(fe(A,c,y,1,!1),fe(C,c,b,1,!0)):y?(fe(A,c,y,1,!1),ve(y.x,0,1)):a||ve(t,M,1),h&&!G){let _e=Ek(S).multiplyScalar(-1).normalize();for(let Re=0;Re<=s;Re++){let B=Re/s,me=S.y*-B+T.y;X.push(S.x*-B+T.x),ae.push(me),ee.push(_e.x),$.push(_e.y),K.push(.5+me/n),re.push(!1)}}let de=X.length,oe=de+(h&&!a?1:0),be=(_e,Re)=>_e*de+(Re===de?0:Re),Oe=l<Math.PI*2,Le=(r+1)*de+(Oe?2*(1+oe):0),ke=new Float32Array(Le*3),Ce=new Float32Array(Le*3),ce=new Float32Array(Le*2),ye=Le-1>65535?new Uint32Array(r*Math.max(0,oe-1)*6+(Oe?2*(oe+1)*3:0)):new Uint16Array(r*Math.max(0,oe-1)*6+(Oe?2*(oe+1)*3:0)),Me=0,Ne=0;for(let _e=0;_e<=r;_e++){let Re=_e/r,B=Re*l+o,me=Math.sin(B),W=Math.cos(B);for(let et=0;et<de;et++){let Ge=Ne*3,z=Ne*2,O=X[et],q=ee[et];ke[Ge]=O*me,ke[Ge+1]=ae[et],ke[Ge+2]=O*W,Ce[Ge]=q*me,Ce[Ge+1]=$[et],Ce[Ge+2]=q*W,re[et]?(ce[z]=.5,ce[z+1]=.5):(ce[z]=Re,ce[z+1]=K[et]),Ne++}}for(let _e=0;_e<r;_e++)for(let Re=0;Re<oe-1;Re++){if(a&&h&&Re==s)continue;let B=be(_e,Re),me=be(_e+1,Re),W=be(_e+1,Re+1),et=be(_e,Re+1),Ge=ke[W*3+0],z=ke[W*3+2];ye[Me++]=B,ye[Me++]=me,ye[Me++]=et,(Ge!=0||z!=0)&&(ye[Me++]=me,ye[Me++]=W,ye[Me++]=et)}Oe&&(He(-1,0,o),He(1,r*de,o+l)),this.setIndex(new je(ye.slice(0,Me),1)),this.setAttribute("position",new je(ke,3)),this.setAttribute("normal",new je(Ce,3)),this.setAttribute("uv",new je(ce,2));function He(_e,Re,B){let me=Math.sin(B),W=Math.cos(B),et=-W,Ge=me,z=_e<0?(xe,Fe,ue)=>{ye[Me++]=xe,ye[Me++]=Fe,ye[Me++]=ue}:(xe,Fe,ue)=>{ye[Me++]=xe,ye[Me++]=ue,ye[Me++]=Fe},O=(t+e+M+w)/4,q=Ne*3,J=Ne*2;ke[q]=O*me,ke[q+1]=0,ke[q+2]=O*W,Ce[q]=et,Ce[q+1]=0,Ce[q+2]=Ge,ce[J]=.5,ce[J+1]=.5;let le=Ne++;for(let xe=0;xe<oe;xe++){let Fe=(Re+(xe===de?0:xe))*3;q=Ne*3,J=Ne*2,ke[q]=ke[Fe],ke[q+1]=ke[Fe+1],ke[q+2]=ke[Fe+2],Ce[q]=et,Ce[q+1]=0,Ce[q+2]=Ge;let ue=Fe/3*2|0;ce[J]=ce[ue],ce[J+1]=ce[ue+1],Ne++}for(let xe=le+1;xe<Ne-1;xe++)z(le,xe,xe+1);z(le,Ne-1,le+1)}}}});var Mk,GP=F(()=>{"use strict";Y();pv();Mk=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},i.parameters);return e.thetaLength=we.clamp(e.thetaLength,0,360),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,depth:e,height:n,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:u,cornerSegments:d}=i.parameters,h;l===0?(h=new De,h.setAttribute("position",new Ve([],3))):c>0||u>0||l<360?h=new hv(0,t/2,n,r,s,a,o,l*Math.PI/180,c,u,d,0,!0):h=new Gl(t/2,n,r,s,a);let p=e/t;return p!==1&&h.scale(1,1,p),Object.assign(h,{userData:{...i,type:"ConeGeometry"}})}}});var _k,jP,HP,WP=F(()=>{"use strict";Y();_k=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,widthSegments:r,heightSegments:s,depthSegments:a,cornerRadius:o,cornerSegments:l}=i.parameters,c;return o===0?c=new ni(t,e,n,r,s,a):c=new HP(t,e,n,r,s,a,o,l),Object.assign(c,{userData:{...i,type:"CubeGeometry"}})}},jP=Math.PI/2,HP=class extends De{constructor(t=1,e=1,n=1,r=1,s=1,a=1,o=0,l=4){super(),this.type="BoxGeometry",r=Math.floor(r),s=Math.floor(s),a=Math.floor(a),l=Math.floor(l),o=Math.min(o,t/2,e/2,n/2);let c=o>0,u=l+1,h=2*((a+1)*(s+1)+(r+1)*(a+1)+(r+1)*(s+1))+(c?u*4*(a+1+(r+1)+(s+1))+8*(u*(u+1)/2):0),p=2*(a*s+r*a+r*s)+(c?l*4*(a+r+s):0),f=c?8*l*l:0,m=new Float32Array(h*3),g=new Float32Array(h*3),y=new Float32Array(h*2),v=h-1>65535?new Uint32Array(p*6+f*3):new Uint16Array(p*6+f*3),b=0,x=0,S=new Float64Array(u),E=new Float64Array(u),M=new Float64Array(u),w=new Float64Array(u);for(let L=0;L<u;L++){let U=L/l*jP;S[L]=Math.sin(U)*o,E[L]=(1-Math.cos(U))*o,M[L]=Math.sin(U),w[L]=Math.cos(U)}let T=u*(u+1)/2,A=new Float64Array(T*3),C=new Float64Array(T*3);{let L=new _(t/2,e/2,n/2);L.subScalar(o);let U=0;for(let G=0;G<=l;G++){let X=jP*(1-G/l),ae=Math.cos(X),ee=Math.sin(X),$=0;for(let K=0;K<=G;K++){let re=Math.cos($),fe=Math.sin($),ve=ae*re,de=ee,Se=ae*fe;A[U*3]=ve,A[U*3+1]=de,A[U*3+2]=Se,C[U*3]=L.x+ve*o,C[U*3+1]=L.y+de*o,C[U*3+2]=L.z+Se*o,U++,$+=jP/G}}}P("z","y","x",-1,-1,n,e,t,a,s),P("z","y","x",1,-1,n,e,-t,a,s),P("x","z","y",1,1,t,n,e,r,a),P("x","z","y",1,-1,t,n,-e,r,a),P("x","y","z",1,-1,t,e,n,r,s),P("x","y","z",-1,-1,t,e,-n,r,s),o>0&&(D("z","y","x",-1,-1,1,n,e,t,a),D("z","y","x",1,-1,-1,n,e,t,a),D("z","y","x",-1,1,-1,n,e,t,a),D("z","y","x",1,1,1,n,e,t,a),D("x","y","z",-1,-1,-1,t,e,n,r),D("x","y","z",1,-1,1,t,e,n,r),D("x","y","z",-1,1,1,t,e,n,r),D("x","y","z",1,1,-1,t,e,n,r),D("y","x","z",-1,-1,1,e,t,n,s),D("y","x","z",1,-1,-1,e,t,n,s),D("y","x","z",1,1,1,e,t,n,s),D("y","x","z",-1,1,-1,e,t,n,s),I(1,1,1),I(-1,1,1),I(1,-1,1),I(-1,-1,1),I(1,1,-1),I(-1,1,-1),I(1,-1,-1),I(-1,-1,-1)),this.setIndex(new je(v,1)),this.setAttribute("position",new je(m,3)),this.setAttribute("normal",new je(g,3)),this.setAttribute("uv",new je(y,2));function P(L,U,G,X,ae,ee,$,K,re,fe){let ve=(ee-2*o)/re,de=($-2*o)/fe,Se=ee/2-o,oe=$/2-o,be=K/2,Oe=re+1,Le=fe+1,ke=0,Ce=new _;for(let ce=0;ce<Le;ce++){let ye=ce*de-oe;for(let Me=0;Me<Oe;Me++){let Ne=Me*ve-Se,He=(b+ke)*3,_e=(b+ke)*2;Ce[L]=Ne*X,Ce[U]=ye*ae,Ce[G]=be,m[He]=Ce.x,m[He+1]=Ce.y,m[He+2]=Ce.z,Ce[L]=0,Ce[U]=0,Ce[G]=K>0?1:-1,g[He]=Ce.x,g[He+1]=Ce.y,g[He+2]=Ce.z,y[_e]=Me/re,y[_e+1]=1-ce/fe,ke+=1}}for(let ce=0;ce<fe;ce++)for(let ye=0;ye<re;ye++){let Me=b+ye+Oe*ce,Ne=b+ye+Oe*(ce+1),He=b+(ye+1)+Oe*(ce+1),_e=b+(ye+1)+Oe*ce;v[x++]=Me,v[x++]=Ne,v[x++]=_e,v[x++]=Ne,v[x++]=He,v[x++]=_e}b+=ke}function D(L,U,G,X,ae,ee,$,K,re,fe){let ve=($-2*o)/fe,de=$/2-o,Se=K/2-o,oe=re/2,be=fe+1,Oe=0,Le=new _,ke=new _;for(let Ce=0;Ce<l+1;Ce++){Le[U]=(Se+S[Ce])*ae,Le[G]=(oe-E[Ce])*ee,ke[L]=0,ke[U]=M[Ce]*Math.sign(Le[U]),ke[G]=w[Ce]*Math.sign(Le[G]);for(let ce=0;ce<be;ce++){let ye=ce*ve-de;Le[L]=ye*X;let Me=(b+Oe)*3,Ne=(b+Oe)*2;m[Me]=Le.x,m[Me+1]=Le.y,m[Me+2]=Le.z,g[Me]=ke.x,g[Me+1]=ke.y,g[Me+2]=ke.z,y[Ne]=ce/fe,y[Ne+1]=0,Oe+=1}}for(let Ce=0;Ce<l;Ce++)for(let ce=0;ce<fe;ce++){let ye=b+ce+be*Ce,Me=b+ce+be*(Ce+1),Ne=b+(ce+1)+be*(Ce+1),He=b+(ce+1)+be*Ce;v[x++]=ye,v[x++]=Me,v[x++]=He,v[x++]=Me,v[x++]=Ne,v[x++]=He}b+=Oe}function I(L,U,G){let ae=L*U*G>0?($,K,re)=>{v[x++]=$,v[x++]=K,v[x++]=re}:($,K,re)=>{v[x++]=$,v[x++]=re,v[x++]=K},ee=b;for(let $=0;$<T;$++){let K=$*3,re=b*3,fe=b*2;m[re]=L*C[K],m[re+1]=U*C[K+1],m[re+2]=G*C[K+2],g[re]=L*A[K],g[re+1]=U*A[K+1],g[re+2]=G*A[K+2],y[fe]=0,y[fe+1]=0,b++}for(let $=0;$<l;$++){let K=ee+$*($+1)/2,re=ee+($+1)*($+2)/2;ae(K,re+1,re);for(let fe=1;fe<=$;fe++)ae(K+fe-1,K+fe,re+fe),ae(K+fe,re+fe+1,re+fe)}}}}});var wu,qP=F(()=>{"use strict";Y();wu=class extends De{constructor(t=[],e=[],n="",r=1,s=.2,a=4){super(),this.type="PolyhedronGeometryRound";let o,l,c,u=0;d(),h(),this.setAttribute("position",new je(new Float32Array(o.subarray(0,u)),3)),this.setAttribute("normal",new je(new Float32Array(l.subarray(0,u)),3)),this.setAttribute("uv",new je(new Float32Array(c.subarray(0,u/3*2)),2));return;function d(){s=Math.min(1-1e-5,s),s==0&&(a=0);let f={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[n],m=new _,g=m.clone(),y=new On,v=s*r,b=r-v,x=a+1,S=new _,E=(ce,ye)=>S.subVectors(ce,ye).normalize(),M=(ce,ye)=>Array(ce).fill(void 0).map(ye),w=M(t.length/3,(ce,ye)=>new _().fromArray(t,ye*3).setLength(r)),T=[],A=1e6;for(let ce=0;ce<w.length;ce++){let ye=w[ce],Me=[],Ne,He,_e,Re=1e10,B=-1;for(;(B=e.indexOf(ce,B+1))!=-1;){let Ge=B-B%3;Ne=e[Ge+(B+1)%3],He=e[Ge+(B+2)%3],_e=ye.distanceToSquared(w[Ne]),Re=Math.min(Re,_e),Me.push([Ne,He,_e])}Re+=1e-6;let me=[],W=0,et=Me.length;for(let Ge=0;Ge<et;Ge++){[Ne,He,_e]=Me[W];let z=T[Ne]?.includes(ce)==!0;_e<=Re&&me.push(Ne+ +z*A),W=Me.findIndex(O=>O[0]==He)}T.push(me)}let C=[];{let ce=0,ye=0,Me,Ne,He=f==3;for(let _e=0;_e<=a;_e++){Me=_e*(_e+1)/2,Ne=(_e+1)*(_e+2)/2;for(let Re=0;Re<a-_e;Re++)[ce,ye]=[Me+Re+_e+2,Ne+Re+_e+3],C.push(Me,Ne,...He?[ye,Me]:[ce,Ne],ye,ce),[Me,Ne]=[ce,ye];C.push(Me,Ne,Me+a+2)}}let P=0;for(let ce=0;ce<T.length;ce++)for(let ye=0;ye<f;ye++)T[ce][ye]<A&&P++;let D=w.length*f*C.length*3,I=P*x*6*3,L=P*2*3*3,U=D+I+L;o=new Float64Array(U),l=new Float64Array(U),c=new Float64Array(U/3*2);let G=(ce,ye,Me)=>{let Ne=u/3*2;c[Ne]=Math.atan2(Me,-ce)/2/Math.PI+.5,c[Ne+1]=1-(Math.atan2(-ye,Math.sqrt(ce*ce+Me*Me))/Math.PI+.5)},X=ce=>{o[u]=ce.x,o[u+1]=ce.y,o[u+2]=ce.z,l[u]=S.x,l[u+1]=S.y,l[u+2]=S.z,G(ce.x,ce.y,ce.z),u+=3},ae=ce=>{o[u]=ce[0].x,o[u+1]=ce[0].y,o[u+2]=ce[0].z,l[u]=ce[1].x,l[u+1]=ce[1].y,l[u+2]=ce[1].z,G(ce[0].x,ce[0].y,ce[0].z),u+=3},ee=(a+2)*(a+3)/2,$=new Float64Array(ee*3),K=new Float64Array(ee*3),re=new Float64Array(ee*2),fe=M(f*2*x,()=>new _),ve=M(a*Math.max(0,a-1)/2,()=>new _),de=m.clone(),Se=m.clone(),oe=m.clone(),be=m.clone(),Oe=m.clone(),Le=[],ke=M(w.length,()=>M(f,()=>m.clone()));for(let ce=0;ce<w.length;ce++){m.copy(w[ce]).normalize(),de.copy(m).multiplyScalar(b);let ye=T[ce];for(let me=0;me<ye.length;me++){let W=ye[me],et=ye[(me+1)%f];y.setFromPointsAndIndices(w,ce,W%A,et%A),y.b.sub(y.a).setLength(1e10).add(y.a),y.c.sub(y.a).setLength(1e10).add(y.a),y.closestPointToPoint(de,ke[ce][me])}let Me=0,Ne=[],He=[],_e=new _;a==0&&[...ke[ce]].reduce((me,W)=>me.add(W),_e).multiplyScalar(1/f);for(let me=0;me<f;me++){let W=[],et=(me-1+f)%f,Ge=ke[ce][et],z=ke[ce][me];m.copy(Ge).sub(de),g.copy(z).sub(de);let O=de.angleTo(m),q=m.angleTo(g),J=Math.cos(O)*v;a==0?Se.copy(_e):Se.copy(de).setLength(b+J),Ne.push(J);let le=[Se,Ge,z];for(let xe=0;xe<2;xe++){let Fe=le[xe],ue=le[xe+1];be.subVectors(Fe,de),Oe.subVectors(ue,de),oe.crossVectors(be,Oe).normalize();for(let Te=0;Te<x;Te++){let Ke=[O,q][xe]*Te/x;m.copy(be).applyAxisAngle(oe,Ke).add(de),fe[Me++].copy(m),xe&&(E(m,de),W.push([Te==0?Fe:m.clone(),S.clone()]))}xe&&(E(ue,de),W.push([ue,S.clone()]))}He.push(W)}Le.push(He);let Re=2*x,B=2;for(let me=0;me<f;me++){let W=Re*me,et=Re*((me+1)%f),Ge=0,z=[fe[W]];for(let O=1;O<x;O++){let q=fe[W+O],J=fe[et+O];z.push(q);for(let le=1,xe=O-B+1;le<=xe;le++)m.lerpVectors(q,J,le/(xe+1)),m.sub(de).setLength(Ne[me]).add(de),z.push(ve[Ge++].copy(m));z.push(J)}for(let O=0;O<x;O++)z.push(fe[O+x+W]);z.push(fe[et+x]);for(let O=0,q=z.length;O<q;O++){let J=z[O],le=O*3,xe=O*2;$[le]=J.x,$[le+1]=J.y,$[le+2]=J.z,E(J,de),K[le]=S.x,K[le+1]=S.y,K[le+2]=S.z,re[xe]=Math.atan2(J.z,-J.x)/2/Math.PI+.5,re[xe+1]=1-(Math.atan2(-J.y,Math.sqrt(J.x*J.x+J.z*J.z))/Math.PI+.5)}for(let O=0,q=C.length;O<q;O++){let J=C[O]*3,le=C[O]*2,xe=u/3*2;o[u]=$[J],o[u+1]=$[J+1],o[u+2]=$[J+2],l[u]=K[J],l[u+1]=K[J+1],l[u+2]=K[J+2],c[xe]=re[le],c[xe+1]=re[le+1],u+=3}}}let Ce=[];for(let ce=0;ce<T.length;ce++)for(let ye=0;ye<f;ye++){let Me=T[ce][ye];if(Me<A){let Ne=T[Me].findIndex(Re=>Re%A==ce),He=Le[ce][ye],_e=Le[Me][Ne];for(let Re=0;Re<x;Re++){let B=He[Re],me=_e[x-Re],W=He[Re+1],et=_e[x-(Re+1)];ae(B),ae(me),ae(W),ae(W),ae(me),ae(et)}Ce.push(He[0][0],_e[x][0],He[x][0],_e[0][0])}}for(;Ce.length;){let ce,ye,Me,[Ne,He]=Ce.splice(0,2);ce=He;let _e=[Ne];for(;Ne!=ce;)_e.push(ce),ye=Ce.indexOf(ce),Me=ye%2,ce=Ce.splice(ye-Me,2)[1-Me];S.subVectors(_e[0],_e[1]).cross(m.subVectors(_e[0],_e[2])).normalize();let Re=S.dot(_e[0])<0;Re&&S.negate();for(let B=1;B<=_e.length-2;B++)X(_e[B+ +Re]),X(_e[B+1-+Re]),X(_e[0])}}function h(){let p=new _,f=new _,m=new _,g=new _,y=new j,v=new j,b=new j,x=(M,w,T,A)=>{A<0&&M.x===1&&(c[w]=M.x-1),T.x===0&&T.z===0&&(c[w]=A/2/Math.PI+.5)};for(let M=0,w=0;M<u;M+=9,w+=6){p.set(o[M+0],o[M+1],o[M+2]),f.set(o[M+3],o[M+4],o[M+5]),m.set(o[M+6],o[M+7],o[M+8]),y.set(c[w+0],c[w+1]),v.set(c[w+2],c[w+3]),b.set(c[w+4],c[w+5]),g.copy(p).add(f).add(m).divideScalar(3);let T=E(g);x(y,w+0,p,T),x(v,w+2,f,T),x(b,w+4,m,T)}let S=u/3*2;for(let M=0;M<S;M+=6){let w=c[M+0],T=c[M+2],A=c[M+4],C=Math.max(w,T,A),P=Math.min(w,T,A);C>.9&&P<.1&&(w<.2&&(c[M+0]+=1),T<.2&&(c[M+2]+=1),A<.2&&(c[M+4]+=1))}function E(M){return Math.atan2(M.z,-M.x)}}}static fromJSON(t){return new wu(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}});var Tk,fv,XP=F(()=>{"use strict";qP();Y();Tk=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,detail:r,corner:s,cornerSides:a}=i.parameters,o=r===0&&s!==0?new fv(t*.5,s,a):new gd(t*.5,r),l=e/t,c=n/t;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...i,type:"DodecahedronGeometry"}})}},fv=class extends wu{constructor(t=1,e=.2,n=4){let r=(1+Math.sqrt(5))/2,s=1/r,a=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-r,0,-s,r,0,s,-r,0,s,r,-s,-r,0,-s,r,0,s,-r,0,s,r,0,-r,0,-s,r,0,-s,-r,0,s,r,0,s],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],l="DodecahedronGeometry";super(a,o,l,t,e,n),this.type=l}static fromJSON(t){return new fv(t.radius,t.corner,t.cornerSides)}}});function Ak(i,t=new j){let e=i.length();return t.set(-i.y/e,i.x/e)}function Ok(i){let t=new j;t.addVectors(i.v0,Df.subVectors(i.v1,i.v0).multiplyScalar(2/3));let e=new j;return e.addVectors(i.v2,lw.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new Bi(i.v0,t,e,i.v2)}function gv(i,t,e=Number.EPSILON){return Math.abs(i-t)<e}function RJ(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function DJ(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function KP(i,t,e){let n=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2));return Math.acos((r*r+n*n-s*s)/(2*r*n))}function Rk(i,t,e){return Ck(i,t)&&Ck(t,e)&&YP(i.position,t.position,e.position)}function YP(i,t,e){return Df.copy(t).sub(i).cross(lw.copy(e).sub(i))===0}function Dk(i,t,e,n,r){let s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),a=(i.y+t.y)/2,o=(i.x+t.x)/2,l=Math.sqrt(Math.pow(e,2)-Math.pow(s/2,2))*(i.y-t.y)/s,c=Math.sqrt(Math.pow(e,2)-Math.pow(s/2,2))*(t.x-i.x)/s;return n.set(o+l,a+c),r.set(o-l,a-c),[n,r]}function Lk(i,t,e){let n=i.distanceTo(e),r=t.distanceTo(e);return n<r?t:i}function Nk(i,t,e,n,r,s){let a=t.x-i.x,o=t.y-i.y,l=e.x-i.x,c=e.y-i.y,u=Math.sqrt((a+l)*(a+l)+(o+c)*(o+c)),d;return KP(t,i,e)>Math.PI&&(u*=-1),gv(c,o)?d=(o+c)*(n/u-.5)*8/3/(a-l):d=(a+l)*(n/u-.5)*8/3/(c-o),r.set(t.x-d*o,t.y+d*a),s.set(e.x+d*c,e.y-d*l),[r,s]}function ZP(i,t){return i.position.equals(i.controls[1].position)&&t.position.equals(t.controls[0].position)}function Ck(i,t){return YP(i.position,i.controls[1].position,t.position)&&YP(i.position,t.controls[0].position,t.position)}function Bk(i,t,e,n,r=.5){let s=Df.subVectors(t,i).multiplyScalar(r).add(i),a=lw.subVectors(e,t).multiplyScalar(r).add(t),o=CJ.subVectors(n,e).multiplyScalar(r).add(e),l=s,c=PJ.subVectors(a,s).multiplyScalar(r).add(s),u=IJ.subVectors(o,a).multiplyScalar(r).add(a),d=o,h=OJ.subVectors(u,c).multiplyScalar(r).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,h.x,h.y,u.x,u.y,d.x,d.y,n.x,n.y]}function Fk(i,t,e=12,n=!0){let r=Ik.set(0,0,0),s,a=0,o=[];for(let l=0;l<t.length;l++){let c=$P(t[l]),u=Df,d=Eu(c,e);o.push(d);for(let h=0;h<=d;h++)if(c instanceof Bi||c instanceof xs||c instanceof Ai){if(c.getPoint(h/d,u),r.set(u.x,u.y,0),s!==void 0&&DJ(s,r))continue;s===void 0&&(s=Pk),s.copy(r),i.setXYZ(a,r.x,r.y,r.z),a++}}return n&&a>1&&!(i.getX(a-1)===i.getX(0)&&i.getY(a-1)===i.getY(0)&&i.getZ(a-1)===i.getZ(0))&&(i.setXYZ(a,i.getX(0),i.getY(0),i.getZ(0)),a++),i}function Uk(i,t,e,n=12,r=!0){let s=Ik.set(0,0,0),a=0,o=[];for(let l=0;l<t.length;l++){if(e[l]===!1)continue;let c,u=$P(t[l]),d=Df,h=Eu(u,n);o.push(h);for(let p=0;p<=h;p++)if(u instanceof Bi||u instanceof xs||u instanceof Ai){if(u.getPoint(p/h,d),s.set(d.x,d.y,0),c?.equals(s))continue;c===void 0?c=Pk:(i.setXYZ(a,c.x,c.y,c.z),a++,i.setXYZ(a,s.x,s.y,s.z),a++),c.copy(s)}}return r&&a>1&&!(i.getX(a-1)===i.getX(0)&&i.getY(a-1)===i.getY(0)&&i.getZ(a-1)===i.getZ(0))&&(i.setXYZ(a,i.getX(0),i.getY(0),i.getZ(0)),a++),o}function QP(i,t=12,e=!1){let n=[];for(let r=0,s=i.length;r<s;r++){let a=i[r],o=0;if(e&&a.roundedCurveCorner!==void 0){let l=Eu(a.roundedCurveCorner,t)*.5;r>0&&(n[r-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=Eu(a.curveAfter,t)),n.push(o)}return i.length>0&&e&&i[0].roundedCurveCorner!==void 0&&(n[i.length-1]+=Eu(i[0].roundedCurveCorner,t)*.5),n}function Eu(i,t=12){return i&&i instanceof Zc?t*2:i&&(i instanceof Ai||i instanceof up)?1:i&&i instanceof yd?t*i.points.length:t}function kk(i,t,e=12,n=!0){let r,s=0;for(let a=0;a<t.length;a++){let o=$P(t[a]),l=Eu(o,e),c=Df;for(let u=0;u<=l;u++)if(o instanceof Bi||o instanceof xs||o instanceof Ai){if(o.getPoint(u/l,c),r!==void 0&&RJ(r,c,mv))continue;r===void 0&&(r=lw),r.copy(c),i.push(c.x,c.y),s++}}return gv(i[0],i[i.length-2],mv)&&gv(i[1],i[i.length-1],mv)&&(i.pop(),i.pop()),n&&s>1&&!(gv(i[s-1],i[1],mv)&&gv(i[s-2],i[0],mv))&&(i.push(i[0],i[1]),s++),i}var mv,Of,Rf,ao,$P,Df,lw,CJ,PJ,IJ,OJ,Pk,Ik,JP=F(()=>{"use strict";Y();mv=1e-12,Of=class{constructor(t){this.position=new j;this.startPosition=new j;this.uuid=we.generateUUID();this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new Of(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Rf=class extends Of{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new Rf(this.parent).copy(this)}},ao=class extends Of{constructor(e,n){super(n);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new Rf(this),new Rf(this))}static create(e,n){let r=new ao(e,new j(...n.position));return r.controls[0].position.set(...n.controlPrevious.position),r.controls[1].position.set(...n.controlNext.position),r.roundness=n.roundness,r.areControlsDirectionsMirrored=n.areControlsDirectionsMirrored,r}getOppositeControl(e){let n=this.controls.indexOf(e);return n===0?this.controls[1]:n===1?this.controls[0]:null}applyOffsetToControls(e,n=1){for(let r=0,s=this.controls.length;r<s;r++){let a=this.controls[r];this.position.distanceTo(a.position)<=n?a.position.copy(this.position):a.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 ao(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let e=this.curveBefore?.getTangentAt(1),n=this.curveAfter?.getTangentAt(0);return[e,n]}computeNormals(e=new j,n=new j){let[r,s]=this.computeTangents();return r&&s&&(Ak(r,e),Ak(s,n)),[e,n]}computeTangent(e=new j){let[n,r]=this.computeTangents();return n&&r&&e.copy(n).add(r).normalize(),e}computeNormal(e=new j){let[n,r]=this.computeNormals();return e.copy(n).add(r).normalize(),e}};$P=i=>i,Df=new j,lw=new j,CJ=new j,PJ=new j,IJ=new j,OJ=new j,Pk=new _,Ik=new _});var e2,LJ,NJ,BJ,FJ,UJ,vn,hc=F(()=>{"use strict";Y();JP();e2=new j,LJ=new j,NJ=new j,BJ=new j,FJ=new j,UJ=new j,vn=class extends Co{constructor(e=100,n=100){super();this.points=[];this.shapeHoles=[];this.plane=new xr(new _(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=we.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=n}static createFromState(e,n,r){let s=new vn;return s.isClosed=e.isClosed,s.points=e.points.map(a=>ao.create(a.id,a.data)),typeof e.roundness=="number"&&(s.roundness=e.roundness),s.shapeHoles=e.shapeHoles.map(a=>vn.createFromState(a)),n!==void 0&&r!==void 0&&s.applySize(n,r),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let n=0,r=this.points.length;n<r;n++)this.points[n].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(n=>this.getPointIndexById(n)).filter(n=>n>=0)}getPointIndexById(e){let n=this.points.length,r=this.points.findIndex(s=>s.uuid===e);if(r<0){let s=n;for(let a=0,o=this.shapeHoles.length;a<o;a++){let l=this.shapeHoles[a],c=l.points.length,u=l.getPointIndexById(e);if(u<0)s+=c;else return u+s}}return r}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let n=this.points.length;for(let r=0,s=this.shapeHoles.length;r<s;r++){let a=this.shapeHoles[r],o=e-n;if(o<=a.points.length-1)return a.points[o];n+=a.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let n=this.points.indexOf(e);if(n>=0)return n;if(n=this.points.length,this.shapeHoles.length>0)for(let r=0,s=this.shapeHoles.length;r<s;r++){let a=this.shapeHoles[r],o=a.points.indexOf(e);if(o>=0)return n+o;n+=a.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(n=>n.points));return[...this.points,...e]}applySize(e,n){e===0&&(e=.001),n===0&&(n=.001),this._width=e,this._height=n}applyScale(e,n){let r=e2.set(e,n);for(let s=0,a=this.points.length;s<a;s++){let o=this.points[s];o.position.multiply(r),o.controls[0].position.multiply(r),o.controls[1].position.multiply(r)}for(let s=0,a=this.shapeHoles.length;s<a;s++)this.shapeHoles[s].applyScale(e,n);this._update()}createPoint(e,n=0,r=we.generateUUID()){let s;e instanceof j?s=e:s=new j(e,n);let a=new ao(r,s);return a.roundness=this.roundness,a}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,n){this.points.splice(n,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];if(s.uuid===e)return s}for(let n=0,r=this.shapeHoles.length;n<r;n++){let a=this.shapeHoles[n].getPointByUuid(e);if(a)return a}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let n=this.points.indexOf(e);n>=0&&this.points.splice(n,1),this.needsUpdate=!0}removePointById(e){let n=this.points.find(r=>r.uuid===e);n&&this.removePoint(n)}update(){for(let e=0,n=this.shapeHoles.length;e<n;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,n=12,r=!1){this.subdivision=n,this.curveDivisions===void 0&&this.computeCurveDivisions(n);let s=r?this.roundedCurveDivisions:this.curveDivisions;return Fk(e,r?this.roundedCurves:this.curves,n,this.autoClose),s.reduce((a,o)=>a+o,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=QP(this.points,e,!1),this.roundedCurveDivisions=QP(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,n,r=12){return Uk(e,this.curves,n,r,this.autoClose).reduce((a,o)=>a+o,0)*2}extractShapePointsToFlatArray(e,n=12){return this.subdivision=n,this.curveDivisions===void 0&&this.computeCurveDivisions(n),kk(e,this.roundedCurves,n,this.autoClose)}getCurveIndexFromVertexId(e,n=!1){let r=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=n?this.roundedCurveDivisions:this.curveDivisions,a=0;n&&this.points[0].roundedCurveCorner!==void 0&&(a=Eu(this.points[0].roundedCurveCorner,this.subdivision)*.5);let o=e-a;o<0&&(o+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let u=s[l];if(o<r+u)return[l,(o-r+1)/u];r+=u}return[0,1]}getCurveT(e,n,r){let s=this.points[e],a=this.points[e>=this.points.length-1?0:e+1],o=this.curveDivisions,l=o[e];if(ZP(s,a)){let d=s.position.distanceTo(a.position);return s.position.distanceTo(e2.set(r.x,r.y))/d}let c=0;for(let d=0;d<e;d++)c+=o[d];return(n-c)/l}dispose(){}_applyCurveForPoint(e,n){ZP(n,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(n.controls[1].position.x,n.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let r=this.curves[this.curves.length-1];e.curveBefore=r,n.curveAfter=r;let s=r.clone();e.roundedCurveBefore=s,n.roundedCurveAfter=s,e.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];if(n===0)this.moveTo(s.position.x,s.position.y);else{let a=this.points[n-1];this._applyCurveForPoint(s,a)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let n=this.points[0],r=this.points[this.points.length-1];this._applyCurveForPoint(n,r)}if(this.points.length>2){let n=0;for(let r=0,s=this.points.length;r<s;r++){let a=this.points[r],o=this.points[r-1]??this.points[this.points.length-1],l=this.points[r+1]??this.points[0],c=a.roundness,u=o&&l&&Rk(o,a,l);if(!a.controlsMoved()&&c>0&&!u){let d=a.curveBefore,h=a.curveAfter;if(d===void 0||h===void 0)continue;let p=a.roundedCurveBefore,f=a.roundedCurveAfter,m=d instanceof Ai?d.v1.distanceTo(d.v2):d.getLength(),g=h instanceof Ai?h.v1.distanceTo(h.v2):h.getLength(),y=Math.min(c,m*.499),v=Math.min(c,g*.499),b=Math.min(y,v),x=1-b/m,S=b/g,E=d.getPointAt(x,e2),M=h.getPointAt(S,LJ);this._subSplitCurve(d,p,x,E,void 0),this._subSplitCurve(h,f,S,void 0,M);let w;if(this.useCubicForRoundedCorners){let T=KP(E,a.position,M)/2,A=Math.tan(T)*E.distanceTo(a.position),[C,P]=Dk(E,M,A,NJ,BJ),D=Lk(C,P,a.position),[I,L]=Nk(D,E,M,A,FJ,UJ);w=new Bi(E.clone(),I.clone(),L.clone(),M.clone())}else w=new xs(E.clone(),a.position.clone(),M.clone());a.roundedCurveCorner=w,this.roundedCurves.splice(r+n,0,w),n++}}}}_subSplitCurve(e,n,r,s,a){if(e instanceof Ai)s!==void 0&&n.v2.copy(s),a!==void 0&&n.v1.copy(a);else{let o=e,l=n,c=o.getUtoTmapping(r,0),u=Bk(o.v0,o.v1,o.v2,o.v3,c);return s!==void 0&&(l.v0.set(u[0],u[1]),l.v1.set(u[2],u[3]),l.v2.set(u[4],u[5]),l.v3.set(u[6],u[7])),a!==void 0&&(l.v0.set(u[6],u[7]),l.v1.set(u[8],u[9]),l.v2.set(u[10],u[11]),l.v3.set(u[12],u[13])),l}return n}clone(){let e=new vn(this._width,this._height);return e.points=this.points.map(n=>n.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(n=>n.clone()),e}toJSON(){return{points:this.points.reduce((e,n)=>e.concat(n.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let n=e.points.length/7;for(let r=0;r<n;r++){let s=r*7,a=e.points[s+0],o=e.points[s+1],l=e.points[s+2],c=e.points[s+3],u=e.points[s+4],d=e.points[s+5],h=e.points[s+6],p=new ao(we.generateUUID(),new j(a,o));p.controls[0].position.set(l,c),p.controls[1].position.set(u,d),p.roundness=h,this.points.push(p)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(r=>{let s=new vn;return s.fromJSON(r),s}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,n=!1){this.isText=n;let r=(a,o)=>{o instanceof Bi&&o.v3.equals(a.position)&&a.controls[0].position.copy(o.v2)},s=a=>{let o=[],l,c;for(l=0,c=a.length;l<c;l++)a[l]instanceof xs&&(a[l]=Ok(a[l]));for(l=0,c=a.length;l<c;l++){let h=a[l],p=l>0?a[l-1]:null,f;h instanceof Bi?(f=this.createPoint(h.v0),f.controls[1].position.copy(h.v1)):h instanceof Ai&&(f=this.createPoint(h.v1)),f!==void 0&&(p!==null&&r(f,p),o.push(f))}let u=a[a.length-1],d=!1;return u instanceof Bi?u.v3.equals(o[0].position)&&(o[0].controls[0].position.copy(u.v2),d=!0):u instanceof Ai&&u.v2.equals(o[0].position)&&(d=!0),this.isClosed=d,o};return this.points=s(e.curves),e instanceof Co&&(this.shapeHoles=e.holes.map(a=>{let o=new vn;return o.fromShape(a),o})),this.update(),this}updatePoint(e,n){let r=this.getPointByUuid(e);r&&(n.position!==void 0&&r.position.fromArray(n.position),n.roundness!==void 0&&(r.roundness=n.roundness),n.areControlsDirectionsMirrored!==void 0&&(r.areControlsDirectionsMirrored=n.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,n){let s=this.getPointByUuid(e)?.controls[0];s&&(n.position&&s.position.fromArray(n.position),this.needsUpdate=!0)}updateNextControl(e,n){let s=this.getPointByUuid(e)?.controls[1];s&&(n.position&&s.position.fromArray(n.position),this.needsUpdate=!0)}}});function t2({x:i,y:t},e,n,r,s){return{x:i*e+r,y:t*n+s}}function kJ(i,t){let e=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),n=Math.cos(i),r=Math.sin(i),s=Math.cos(i+t),a=Math.sin(i+t);return[{x:n-r*e,y:r+n*e},{x:s+a*e,y:a-s*e},{x:s,y:a}]}function Vk(i,t,e,n){let r=i*n-t*e<0?-1:1,s=Math.min(1,Math.max(-1,i*e+t*n));return r*Math.acos(s)}function VJ(i,t,e,n,r,s,a,o,l,c){let u=Math.pow(r,2),d=Math.pow(s,2),h=Math.pow(a,2),p=Math.pow(o,2),f=u*d-u*p-d*h;f<0&&(f=0),f/=u*p+d*h,f=Math.sqrt(f)*(l===c?-1:1);let m=f*r/s*o,g=f*-s/r*a,y=m+(i+e)/2,v=g+(t+n)/2,b=(a-m)/r,x=(o-g)/s,S=(-a-m)/r,E=(-o-g)/s,M=Vk(1,0,b,x),w=Vk(b,x,S,E);return!c&&w>0&&(w-=n2),c&&w<0&&(w+=n2),{centerx:y,centery:v,ang1:M,ang2:w}}function zk({px:i,py:t,cx:e,cy:n,rx:r,ry:s,largeArcFlag:a,sweepFlag:o}){let l=[];if(r===0||s===0)return[];let c=(i-e)/2,u=(t-n)/2;if(c===0&&u===0)return[];r=Math.abs(r),s=Math.abs(s);let d=Math.pow(c,2)/Math.pow(r,2)+Math.pow(u,2)/Math.pow(s,2);d>1&&(r*=Math.sqrt(d),s*=Math.sqrt(d));let h=VJ(i,t,e,n,r,s,c,u,a,o),{ang1:p,ang2:f}=h,{centerx:m,centery:g}=h,y=Math.abs(f)/(n2/4);Math.abs(1-y)<1e-7&&(y=1);let v=Math.max(Math.ceil(y),1);f/=v;for(let b=0;b<v;b++)l.push(kJ(p,f)),p+=f;return l.map(b=>{let{x,y:S}=t2(b[0],r,s,m,g),{x:E,y:M}=t2(b[1],r,s,m,g),{x:w,y:T}=t2(b[2],r,s,m,g);return{x1:x,y1:S,x2:E,y2:M,x:w,y:T}})}var n2,Gk=F(()=>{"use strict";n2=Math.PI*2});function It(i,t){if(!i)throw t||"Assertion Failed!"}function oo(i){var t=i.windingRule,e=t===void 0?ln.ODD:t,n=i.elementType,r=n===void 0?Or.POLYGONS:n,s=i.polySize,a=s===void 0?3:s,o=i.vertexSize,l=o===void 0?2:o,c=i.normal,u=c===void 0?[0,0,1]:c,d=i.contours,h=d===void 0?[]:d,p=i.strict,f=p===void 0?!0:p,m=i.debug,g=m===void 0?!1:m;if(!h&&f)throw new Error("Contours can't be empty");if(!!h){var y=new HJ;i.edgeCreateCallback&&(y.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(y.vertexIdCallback=i.vertexIdCallback);for(var v=0;v<h.length;v++)y.addContour(l||2,h[v]);return y.tesselate(e,r,a,l,u,f),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:g?y.mesh:void 0}}}var ln,Or,Tt,yv,cw,Lf,jk,Hk,Wk,zJ,r2,qk,GJ,jJ,HJ,v1e,b1e,x1e,S1e,w1e,E1e,M1e,_1e,Qd=F(()=>{(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(ln||(ln={}));(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Or||(Or={}));Tt=function(){function i(){}return i.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},i.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},i.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},i.edgeGoesLeft=function(t){return i.vertLeq(t.Dst,t.Org)},i.edgeGoesRight=function(t){return i.vertLeq(t.Org,t.Dst)},i.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},i.edgeEval=function(t,e,n){It(i.vertLeq(t,e)&&i.vertLeq(e,n));var r=e.s-t.s,s=n.s-e.s;return r+s>0?r<s?e.t-t.t+(t.t-n.t)*(r/(r+s)):e.t-n.t+(n.t-t.t)*(s/(r+s)):0},i.edgeSign=function(t,e,n){It(i.vertLeq(t,e)&&i.vertLeq(e,n));var r=e.s-t.s,s=n.s-e.s;return r+s>0?(e.t-n.t)*r+(e.t-t.t)*s:0},i.transEval=function(t,e,n){It(i.transLeq(t,e)&&i.transLeq(e,n));var r=e.t-t.t,s=n.t-e.t;return r+s>0?r<s?e.s-t.s+(t.s-n.s)*(r/(r+s)):e.s-n.s+(n.s-t.s)*(s/(r+s)):0},i.transSign=function(t,e,n){It(i.transLeq(t,e)&&i.transLeq(e,n));var r=e.t-t.t,s=n.t-e.t;return r+s>0?(e.s-n.s)*r+(e.s-t.s)*s:0},i.vertCCW=function(t,e,n){return t.s*(e.t-n.t)+e.s*(n.t-t.t)+n.s*(t.t-e.t)>=0},i.interpolate=function(t,e,n,r){return t=t<0?0:t,n=n<0?0:n,t<=n?n===0?(e+r)/2:e+(r-e)*(t/(t+n)):r+(e-r)*(n/(t+n))},i.intersect=function(t,e,n,r,s){var a,o,l;i.vertLeq(t,e)||(l=t,t=e,e=l),i.vertLeq(n,r)||(l=n,n=r,r=l),i.vertLeq(t,n)||(l=t,t=n,n=l,l=e,e=r,r=l),i.vertLeq(n,e)?i.vertLeq(e,r)?(a=i.edgeEval(t,n,e),o=i.edgeEval(n,e,r),a+o<0&&(a=-a,o=-o),s.s=i.interpolate(a,n.s,o,e.s)):(a=i.edgeSign(t,n,e),o=-i.edgeSign(t,r,e),a+o<0&&(a=-a,o=-o),s.s=i.interpolate(a,n.s,o,r.s)):s.s=(n.s+e.s)/2,i.transLeq(t,e)||(l=t,t=e,e=l),i.transLeq(n,r)||(l=n,n=r,r=l),i.transLeq(t,n)||(l=t,t=n,n=l,l=e,e=r,r=l),i.transLeq(n,e)?i.transLeq(e,r)?(a=i.transEval(t,n,e),o=i.transEval(n,e,r),a+o<0&&(a=-a,o=-o),s.t=i.interpolate(a,n.t,o,e.t)):(a=i.transSign(t,n,e),o=-i.transSign(t,r,e),a+o<0&&(a=-a,o=-o),s.t=i.interpolate(a,n.t,o,r.t)):s.t=(n.t+e.t)/2},i}(),yv=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),cw=function(){function i(t){this.side=t,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(t){this.Sym.Lface=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(t){this.Sym.Org=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(t){this.Sym.Lnext=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(t){this.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(t){this.Lnext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(t){this.Sym.Onext=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(t){this.Sym.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(t){this.Sym.Lnext.Sym=t},enumerable:!0,configurable:!0}),i}(),Lf=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return i}(),jk=function(){function i(){var t=new Lf,e=new yv,n=new cw(0),r=new cw(1);t.next=t.prev=t,t.anEdge=null,e.next=e.prev=e,n.next=n,n.Sym=r,r.next=r,r.Sym=n,this.vHead=t,this.fHead=e,this.eHead=n,this.eHeadSym=r}return i.prototype.makeEdge_=function(t){var e=new cw(0),n=new cw(1);t.Sym.side<t.side&&(t=t.Sym);var r=t.Sym.next;return n.next=r,r.Sym.next=e,e.next=t,t.Sym.next=n,e.Sym=n,e.Onext=e,e.Lnext=n,e.Org=null,e.Lface=null,e.winding=0,e.activeRegion=null,n.Sym=e,n.Onext=n,n.Lnext=e,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,e},i.prototype.splice_=function(t,e){var n=t.Onext,r=e.Onext;n.Sym.Lnext=e,r.Sym.Lnext=t,t.Onext=r,e.Onext=n},i.prototype.makeVertex_=function(t,e,n){var r=t;It(r,"Vertex can't be null!");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=e;var a=e;do a.Org=r,a=a.Onext;while(a!==e)},i.prototype.makeFace_=function(t,e,n){var r=t;It(r,"Face can't be null");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=e,r.trail=null,r.marked=!1,r.inside=n.inside;var a=e;do a.Lface=r,a=a.Lnext;while(a!==e)},i.prototype.killEdge_=function(t){t.Sym.side<t.side&&(t=t.Sym);var e=t.next,n=t.Sym.next;e.Sym.next=n,n.Sym.next=e},i.prototype.killVertex_=function(t,e){var n=t.anEdge,r=n;do r.Org=e,r=r.Onext;while(r!==n);var s=t.prev,a=t.next;a.prev=s,s.next=a},i.prototype.killFace_=function(t,e){var n=t.anEdge,r=n;do r.Lface=e,r=r.Lnext;while(r!==n);var s=t.prev,a=t.next;a.prev=s,s.next=a},i.prototype.makeEdge=function(){var t=new Lf,e=new Lf,n=new yv,r=this.makeEdge_(this.eHead);return this.makeVertex_(t,r,this.vHead),this.makeVertex_(e,r.Sym,this.vHead),this.makeFace_(n,r,this.fHead),r},i.prototype.splice=function(t,e){var n=!1,r=!1;if(t!==e){if(e.Org!==t.Org&&(r=!0,this.killVertex_(e.Org,t.Org)),e.Lface!==t.Lface&&(n=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(e,t),!r){var s=new Lf;this.makeVertex_(s,e,t.Org),t.Org.anEdge=t}if(!n){var a=new yv;this.makeFace_(a,e,t.Lface),t.Lface.anEdge=t}}},i.prototype.delete=function(t){var e=t.Sym,n=!1;if(t.Lface!==t.Rface&&(n=!0,this.killFace_(t.Lface,t.Rface)),t.Onext===t)this.killVertex_(t.Org,null);else if(t.Rface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev),!n){var r=new yv;this.makeFace_(r,t,t.Lface)}e.Onext===e?(this.killVertex_(e.Org,null),this.killFace_(e.Lface,null)):(t.Lface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev)),this.killEdge_(t)},i.prototype.addEdgeVertex=function(t){var e=this.makeEdge_(t),n=e.Sym;this.splice_(e,t.Lnext),e.Org=t.Dst;var r=new Lf;return this.makeVertex_(r,n,e.Org),e.Lface=n.Lface=t.Lface,e},i.prototype.splitEdge=function(t){var e=this.addEdgeVertex(t),n=e.Sym;return this.splice_(t.Sym,t.Sym.Oprev),this.splice_(t.Sym,n),t.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=t.Rface,n.winding=t.winding,n.Sym.winding=t.Sym.winding,n.idx=t.idx,n.Sym.idx=t.Sym.idx,n},i.prototype.connect=function(t,e){var n=!1,r=this.makeEdge_(t),s=r.Sym;if(e.Lface!==t.Lface&&(n=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(r,t.Lnext),this.splice_(s,e),r.Org=t.Dst,s.Org=e.Org,r.Lface=s.Lface=t.Lface,t.Lface.anEdge=s,!n){var a=new yv;this.makeFace_(a,r,t.Lface)}return r},i.prototype.zapFace=function(t){var e=t.anEdge,n,r,s,a,o;r=e.Lnext;do n=r,r=n.Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),s=n.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=e);a=t.prev,o=t.next,o.prev=a,a.next=o},i.prototype.countFaceVerts_=function(t){var e=t.anEdge,n=0;do n++,e=e.Lnext;while(e!==t.anEdge);return n},i.prototype.mergeConvexFaces=function(t){var e,n,r,s,a,o,l;for(e=this.fHead.next;e!==this.fHead;e=e.next)if(!!e.inside)for(n=e.anEdge,a=n.Org;r=n.Lnext,s=n.Sym,s&&s.Lface&&s.Lface.inside&&(o=this.countFaceVerts_(e),l=this.countFaceVerts_(s.Lface),o+l-2<=t&&Tt.vertCCW(n.Lprev.Org,n.Org,s.Lnext.Lnext.Org)&&Tt.vertCCW(s.Lprev.Org,s.Org,n.Lnext.Lnext.Org)&&(r=s.Lnext,this.delete(s),n=null,s=null)),!(n&&n.Lnext.Org===a);)n=r;return!0},i.prototype.check=function(){var t=this.fHead,e=this.vHead,n=this.eHead,r,s,a,o,l,c;for(s=t,s=t;(r=s.next)!==t;s=r){It(r.prev===s),l=r.anEdge;do It(l.Sym!==l),It(l.Sym.Sym===l),It(l.Lnext.Onext.Sym===l),It(l.Onext.Sym.Lnext===l),It(l.Lface===r),l=l.Lnext;while(l!==r.anEdge)}for(It(r.prev===s&&r.anEdge===null),o=e,o=e;(a=o.next)!==e;o=a){It(a.prev===o),l=a.anEdge;do It(l.Sym!==l),It(l.Sym.Sym===l),It(l.Lnext.Onext.Sym===l),It(l.Onext.Sym.Lnext===l),It(l.Org===a),l=l.Onext;while(l!==a.anEdge)}for(It(a.prev===o&&a.anEdge===null),c=n,c=n;(l=c.next)!==n;c=l)It(l.Sym.next===c.Sym),It(l.Sym!==l),It(l.Sym.Sym===l),It(l.Org!==null),It(l.Dst!==null),It(l.Lnext.Onext.Sym===l),It(l.Onext.Sym.Lnext===l);It(l.Sym.next===c.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},i}(),Hk=function(){function i(){this.handle=null}return i}(),Wk=function(){function i(){this.key=null,this.node=0}return i}(),zJ=function(){function i(t,e){this.leq=e,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=t,this.nodes=[],this.handles=[];for(var n=0;n<t+1;n++)this.nodes[n]=new Hk,this.handles[n]=new Wk;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(t){var e=this.nodes,n=this.handles,r,s,a;for(r=e[t].handle;;){if(a=t<<1,a<this.size&&this.leq(n[e[a+1].handle].key,n[e[a].handle].key)&&++a,It(a<=this.max),s=e[a].handle,a>this.size||this.leq(n[r].key,n[s].key)){e[t].handle=r,n[r].node=t;break}e[t].handle=s,n[s].node=t,t=a}},i.prototype.floatUp_=function(t){var e=this.nodes,n=this.handles,r,s,a;for(r=e[t].handle;;){if(a=t>>1,s=e[a].handle,a===0||this.leq(n[s].key,n[r].key)){e[t].handle=r,n[r].node=t;break}e[t].handle=s,n[s].node=t,t=a}},i.prototype.init=function(){for(var t=this.size;t>=1;--t)this.floatDown_(t);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(t){var e,n;if(e=++this.size,e*2>this.max){this.max*=2;var r,s;for(s=this.nodes.length,this.nodes.length=this.max+1,r=s;r<this.nodes.length;r++)this.nodes[r]=new Hk;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new Wk}return this.freeList===0?n=e:(n=this.freeList,this.freeList=this.handles[n].node),this.nodes[e].handle=n,this.handles[n].node=e,this.handles[n].key=t,this.initialized&&this.floatUp_(e),n},i.prototype.extractMin=function(){var t=this.nodes,e=this.handles,n=t[1].handle,r=e[n].key;return this.size>0&&(t[1].handle=t[this.size].handle,e[t[1].handle].node=1,e[n].key=null,e[n].node=this.freeList,this.freeList=n,--this.size,this.size>0&&this.floatDown_(1)),r},i.prototype.delete=function(t){var e=this.nodes,n=this.handles,r;It(t>=1&&t<=this.max&&n[t].key!==null),r=n[t].node,e[r].handle=e[this.size].handle,n[e[r].handle].node=r,--this.size,r<=this.size&&(r<=1||this.leq(n[e[r>>1].handle].key,n[e[r].handle].key)?this.floatDown_(r):this.floatUp_(r)),n[t].key=null,n[t].node=this.freeList,this.freeList=t},i}(),r2=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),qk=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),GJ=function(){function i(t,e){this.frame=t,this.leq=e,this.head=new qk,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(t){return this.insertBefore(this.head,t)},i.prototype.search=function(t){var e=this.head;do e=e.next;while(e.key!==null&&!this.leq(this.frame,t,e.key));return e},i.prototype.insertBefore=function(t,e){do t=t.prev;while(t.key!==null&&!this.leq(this.frame,t.key,e));var n=new qk;return n.key=e,n.next=t.next,t.next.prev=n,n.prev=t,t.next=n,n},i.prototype.delete=function(t){t.next.prev=t.prev,t.prev.next=t.next},i}(),jJ=function(){function i(){}return i.regionBelow=function(t){return t.nodeUp.prev.key},i.regionAbove=function(t){return t.nodeUp.next.key},i.debugEvent=function(t){},i.addWinding=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.edgeLeq=function(t,e,n){var r=t.event,s=e.eUp,a=n.eUp;if(s.Dst===r)return a.Dst===r?Tt.vertLeq(s.Org,a.Org)?Tt.edgeSign(a.Dst,s.Org,a.Org)<=0:Tt.edgeSign(s.Dst,a.Org,s.Org)>=0:Tt.edgeSign(a.Dst,r,a.Org)<=0;if(a.Dst===r)return Tt.edgeSign(s.Dst,r,s.Org)>=0;var o=Tt.edgeEval(s.Dst,r,s.Org),l=Tt.edgeEval(a.Dst,r,a.Org);return o>=l},i.deleteRegion=function(t,e){e.fixUpperEdge&&It(e.eUp.winding===0),e.eUp.activeRegion=null,t.dict.delete(e.nodeUp)},i.fixUpperEdge=function(t,e,n){It(e.fixUpperEdge),t.mesh.delete(e.eUp),e.fixUpperEdge=!1,e.eUp=n,n.activeRegion=e},i.topLeftRegion=function(t,e){var n=e.eUp.Org,r;do e=i.regionAbove(e);while(e.eUp.Org===n);if(e.fixUpperEdge){if(r=t.mesh.connect(i.regionBelow(e).eUp.Sym,e.eUp.Lnext),r===null)return null;i.fixUpperEdge(t,e,r),e=i.regionAbove(e)}return e},i.topRightRegion=function(t){var e=t.eUp.Dst;do t=i.regionAbove(t);while(t.eUp.Dst===e);return t},i.addRegionBelow=function(t,e,n){var r=new r2;return r.eUp=n,r.nodeUp=t.dict.insertBefore(e.nodeUp,r),r.fixUpperEdge=!1,r.sentinel=!1,r.dirty=!1,n.activeRegion=r,r},i.isWindingInside=function(t,e){switch(t.windingRule){case ln.ODD:return(e&1)!==0;case ln.NONZERO:return e!==0;case ln.POSITIVE:return e>0;case ln.NEGATIVE:return e<0;case ln.ABS_GEQ_TWO:return e>=2||e<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(t,e){e.windingNumber=i.regionAbove(e).windingNumber+e.eUp.winding,e.inside=i.isWindingInside(t,e.windingNumber)},i.finishRegion=function(t,e){var n=e.eUp,r=n.Lface;r.inside=e.inside,r.anEdge=n,i.deleteRegion(t,e)},i.finishLeftRegions=function(t,e,n){for(var r,s=null,a=e,o=e.eUp;a!==n;){if(a.fixUpperEdge=!1,s=i.regionBelow(a),r=s.eUp,r.Org!=o.Org){if(!s.fixUpperEdge){i.finishRegion(t,a);break}r=t.mesh.connect(o.Lprev,r.Sym),i.fixUpperEdge(t,s,r)}o.Onext!==r&&(t.mesh.splice(r.Oprev,r),t.mesh.splice(o,r)),i.finishRegion(t,a),o=s.eUp,a=s}return o},i.addRightEdges=function(t,e,n,r,s,a){var o,l,c,u,d=!0;c=n;do It(Tt.vertLeq(c.Org,c.Dst)),i.addRegionBelow(t,e,c.Sym),c=c.Onext;while(c!==r);for(s===null&&(s=i.regionBelow(e).eUp.Rprev),l=e,u=s;o=i.regionBelow(l),c=o.eUp.Sym,c.Org===u.Org;)c.Onext!==u&&(t.mesh.splice(c.Oprev,c),t.mesh.splice(u.Oprev,c)),o.windingNumber=l.windingNumber-c.winding,o.inside=i.isWindingInside(t,o.windingNumber),l.dirty=!0,!d&&i.checkForRightSplice(t,l)&&(i.addWinding(c,u),i.deleteRegion(t,l),t.mesh.delete(u)),d=!1,l=o,u=c;l.dirty=!0,It(l.windingNumber-c.winding===o.windingNumber),a&&i.walkDirtyRegions(t,l)},i.spliceMergeVertices=function(t,e,n){t.mesh.splice(e,n)},i.vertexWeights=function(t,e,n){var r=Tt.vertL1dist(e,t),s=Tt.vertL1dist(n,t),a=.5*s/(r+s),o=.5*r/(r+s);t.coords[0]+=a*e.coords[0]+o*n.coords[0],t.coords[1]+=a*e.coords[1]+o*n.coords[1],t.coords[2]+=a*e.coords[2]+o*n.coords[2]},i.getIntersectData=function(t,e,n,r,s,a){e.coords[0]=e.coords[1]=e.coords[2]=0,e.idx=-1,i.vertexWeights(e,n,r),i.vertexWeights(e,s,a)},i.checkForRightSplice=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp;if(Tt.vertLeq(r.Org,s.Org)){if(Tt.edgeSign(s.Dst,r.Org,s.Org)>0)return!1;Tt.vertEq(r.Org,s.Org)?r.Org!==s.Org&&(t.pq.delete(r.Org.pqHandle),i.spliceMergeVertices(t,s.Oprev,r)):(t.mesh.splitEdge(s.Sym),t.mesh.splice(r,s.Oprev),e.dirty=n.dirty=!0)}else{if(Tt.edgeSign(r.Dst,s.Org,r.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(r.Sym),t.mesh.splice(s.Oprev,r)}return!0},i.checkForLeftSplice=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp,a;if(It(!Tt.vertEq(r.Dst,s.Dst)),Tt.vertLeq(r.Dst,s.Dst)){if(Tt.edgeSign(r.Dst,s.Dst,r.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,a=t.mesh.splitEdge(r),t.mesh.splice(s.Sym,a),a.Lface.inside=e.inside}else{if(Tt.edgeSign(s.Dst,r.Dst,s.Org)>0)return!1;e.dirty=n.dirty=!0,a=t.mesh.splitEdge(s),t.mesh.splice(r.Lnext,s.Sym),a.Rface.inside=e.inside}return!0},i.checkForIntersect=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp,a=r.Org,o=s.Org,l=r.Dst,c=s.Dst,u,d,h=new Lf,p,f;if(It(!Tt.vertEq(c,l)),It(Tt.edgeSign(l,t.event,a)<=0),It(Tt.edgeSign(c,t.event,o)>=0),It(a!==t.event&&o!==t.event),It(!e.fixUpperEdge&&!n.fixUpperEdge),a===o||(u=Math.min(a.t,l.t),d=Math.max(o.t,c.t),u>d))return!1;if(Tt.vertLeq(a,o)){if(Tt.edgeSign(c,a,o)>0)return!1}else if(Tt.edgeSign(l,o,a)<0)return!1;return i.debugEvent(t),Tt.intersect(l,a,c,o,h),It(Math.min(a.t,l.t)<=h.t),It(h.t<=Math.max(o.t,c.t)),It(Math.min(c.s,l.s)<=h.s),It(h.s<=Math.max(o.s,a.s)),Tt.vertLeq(h,t.event)&&(h.s=t.event.s,h.t=t.event.t),p=Tt.vertLeq(a,o)?a:o,Tt.vertLeq(p,h)&&(h.s=p.s,h.t=p.t),Tt.vertEq(h,a)||Tt.vertEq(h,o)?(i.checkForRightSplice(t,e),!1):!Tt.vertEq(l,t.event)&&Tt.edgeSign(l,t.event,h)>=0||!Tt.vertEq(c,t.event)&&Tt.edgeSign(c,t.event,h)<=0?c===t.event?(t.mesh.splitEdge(r.Sym),t.mesh.splice(s.Sym,r),e=i.topLeftRegion(t,e),r=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),n),i.addRightEdges(t,e,r.Oprev,r,r,!0),!0):l===t.event?(t.mesh.splitEdge(s.Sym),t.mesh.splice(r.Lnext,s.Oprev),n=e,e=i.topRightRegion(e),f=i.regionBelow(e).eUp.Rprev,n.eUp=s.Oprev,s=i.finishLeftRegions(t,n,null),i.addRightEdges(t,e,s.Onext,r.Rprev,f,!0),!0):(Tt.edgeSign(l,t.event,h)>=0&&(i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(r.Sym),r.Org.s=t.event.s,r.Org.t=t.event.t),Tt.edgeSign(c,t.event,h)<=0&&(e.dirty=n.dirty=!0,t.mesh.splitEdge(s.Sym),s.Org.s=t.event.s,s.Org.t=t.event.t),!1):(t.mesh.splitEdge(r.Sym),t.mesh.splitEdge(s.Sym),t.mesh.splice(s.Oprev,r),r.Org.s=h.s,r.Org.t=h.t,r.Org.pqHandle=t.pq.insert(r.Org),i.getIntersectData(t,r.Org,a,l,o,c),i.regionAbove(e).dirty=e.dirty=n.dirty=!0,!1)},i.walkDirtyRegions=function(t,e){for(var n=i.regionBelow(e),r,s;;){for(;n.dirty;)e=n,n=i.regionBelow(n);if(!e.dirty&&(n=e,e=i.regionAbove(e),e===null||!e.dirty))return;if(e.dirty=!1,r=e.eUp,s=n.eUp,r.Dst!==s.Dst&&i.checkForLeftSplice(t,e)&&(n.fixUpperEdge?(i.deleteRegion(t,n),t.mesh.delete(s),n=i.regionBelow(e),s=n.eUp):e.fixUpperEdge&&(i.deleteRegion(t,e),t.mesh.delete(r),e=i.regionAbove(n),r=e.eUp)),r.Org!==s.Org)if(r.Dst!==s.Dst&&!e.fixUpperEdge&&!n.fixUpperEdge&&(r.Dst===t.event||s.Dst===t.event)){if(i.checkForIntersect(t,e))return}else i.checkForRightSplice(t,e);r.Org===s.Org&&r.Dst===s.Dst&&(i.addWinding(s,r),i.deleteRegion(t,e),t.mesh.delete(r),e=i.regionAbove(n))}},i.connectRightVertex=function(t,e,n){var r,s=n.Onext,a=i.regionBelow(e),o=e.eUp,l=a.eUp,c=!1;if(o.Dst!==l.Dst&&i.checkForIntersect(t,e),Tt.vertEq(o.Org,t.event)&&(t.mesh.splice(s.Oprev,o),e=i.topLeftRegion(t,e),s=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),a),c=!0),Tt.vertEq(l.Org,t.event)&&(t.mesh.splice(n,l.Oprev),n=i.finishLeftRegions(t,a,null),c=!0),c){i.addRightEdges(t,e,n.Onext,s,s,!0);return}Tt.vertLeq(l.Org,o.Org)?r=l.Oprev:r=o,r=t.mesh.connect(n.Lprev,r),i.addRightEdges(t,e,r,r.Onext,r.Onext,!1),r.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(t,e)},i.connectLeftDegenerate=function(t,e,n){var r,s,a,o,l;if(r=e.eUp,Tt.vertEq(r.Org,n)){It(!1),i.spliceMergeVertices(t,r,n.anEdge);return}if(!Tt.vertEq(r.Dst,n)){t.mesh.splitEdge(r.Sym),e.fixUpperEdge&&(t.mesh.delete(r.Onext),e.fixUpperEdge=!1),t.mesh.splice(n.anEdge,r),i.sweepEvent(t,n);return}It(!1),e=i.topRightRegion(e),l=i.regionBelow(e),a=l.eUp.Sym,s=o=a.Onext,l.fixUpperEdge&&(It(s!==a),i.deleteRegion(t,l),t.mesh.delete(a),a=s.Oprev),t.mesh.splice(n.anEdge,a),Tt.edgeGoesLeft(s)||(s=null),i.addRightEdges(t,e,a.Onext,o,s,!0)},i.connectLeftVertex=function(t,e){var n,r,s,a,o,l,c=new r2;if(c.eUp=e.anEdge.Sym,n=t.dict.search(c).key,r=i.regionBelow(n),!!r){if(a=n.eUp,o=r.eUp,Tt.edgeSign(a.Dst,e,a.Org)===0){i.connectLeftDegenerate(t,n,e);return}if(s=Tt.vertLeq(o.Dst,a.Dst)?n:r,n.inside||s.fixUpperEdge){if(s===n)l=t.mesh.connect(e.anEdge.Sym,a.Lnext);else{var u=t.mesh.connect(o.Dnext,e.anEdge);l=u.Sym}s.fixUpperEdge?i.fixUpperEdge(t,s,l):i.computeWinding(t,i.addRegionBelow(t,n,l)),i.sweepEvent(t,e)}else i.addRightEdges(t,n,e.anEdge,e.anEdge,null,!0)}},i.sweepEvent=function(t,e){t.event=e,i.debugEvent(t);for(var n=e.anEdge;n.activeRegion===null;)if(n=n.Onext,n===e.anEdge){i.connectLeftVertex(t,e);return}var r=i.topLeftRegion(t,n.activeRegion);It(r!==null);var s=i.regionBelow(r),a=s.eUp,o=i.finishLeftRegions(t,s,null);o.Onext===a?i.connectRightVertex(t,r,o):i.addRightEdges(t,r,o.Onext,a,a,!0)},i.addSentinel=function(t,e,n,r){var s=new r2,a=t.mesh.makeEdge();a.Org.s=n,a.Org.t=r,a.Dst.s=e,a.Dst.t=r,t.event=a.Dst,s.eUp=a,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=t.dict.insert(s)},i.initEdgeDict=function(t){t.dict=new GJ(t,i.edgeLeq);var e=t.bmax[0]-t.bmin[0],n=t.bmax[1]-t.bmin[1],r=t.bmin[0]-e,s=t.bmax[0]+e,a=t.bmin[1]-n,o=t.bmax[1]+n;i.addSentinel(t,r,s,a),i.addSentinel(t,r,s,o)},i.doneEdgeDict=function(t){for(var e,n=0;(e=t.dict.min().key)!==null;)e.sentinel||(It(e.fixUpperEdge),It(++n===1)),It(e.windingNumber===0),i.deleteRegion(t,e)},i.removeDegenerateEdges=function(t){var e,n,r,s=t.mesh.eHead;for(e=s.next;e!==s;e=n)n=e.next,r=e.Lnext,Tt.vertEq(e.Org,e.Dst)&&e.Lnext.Lnext!==e&&(i.spliceMergeVertices(t,r,e),t.mesh.delete(e),e=r,r=e.Lnext),r.Lnext===e&&(r!==e&&((r===n||r===n.Sym)&&(n=n.next),t.mesh.delete(r)),(e===n||e===n.Sym)&&(n=n.next),t.mesh.delete(e))},i.initPriorityQ=function(t){var e,n,r,s=0;for(r=t.mesh.vHead,n=r.next;n!==r;n=n.next)s++;for(s+=8,e=t.pq=new zJ(s,Tt.vertLeq),r=t.mesh.vHead,n=r.next;n!==r;n=n.next)n.pqHandle=e.insert(n);return n!==r?!1:(e.init(),!0)},i.donePriorityQ=function(t){t.pq=null},i.removeDegenerateFaces=function(t,e){var n,r,s;for(n=e.fHead.next;n!==e.fHead;n=r)r=n.next,s=n.anEdge,It(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),t.mesh.delete(s));return!0},i.computeInterior=function(t,e){e===void 0&&(e=!0);var n,r;if(i.removeDegenerateEdges(t),!i.initPriorityQ(t))return!1;for(i.initEdgeDict(t);(n=t.pq.extractMin())!==null;){for(;r=t.pq.min(),!(r===null||!Tt.vertEq(r,n));)r=t.pq.extractMin(),i.spliceMergeVertices(t,n.anEdge,r.anEdge);i.sweepEvent(t,n)}return t.event=t.dict.min().key.eUp.Org,i.debugEvent(t),i.doneEdgeDict(t),i.donePriorityQ(t),i.removeDegenerateFaces(t,t.mesh)?(e&&t.mesh.check(),!0):!1},i}(),HJ=function(){function i(){this.mesh=new jk,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=ln.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.prototype.normalize_=function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];if(!e)throw"Zero-size vector!";e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},i.prototype.longAxis_=function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},i.prototype.computeNormal_=function(t){var e,n,r,s,a,o,l=[0,0,0],c=[0,0,0],u=[0,0,0],d=[0,0,0],h=[0,0,0],p=[null,null,null],f=[null,null,null],m=this.mesh.vHead;e=m.next;for(var g=0;g<3;++g)s=e.coords[g],c[g]=s,f[g]=e,l[g]=s,p[g]=e;for(e=m.next;e!==m;e=e.next)for(var y=0;y<3;++y)s=e.coords[y],s<c[y]&&(c[y]=s,f[y]=e),s>l[y]&&(l[y]=s,p[y]=e);var v=0;if(l[1]-c[1]>l[0]-c[0]&&(v=1),l[2]-c[2]>l[v]-c[v]&&(v=2),c[v]>=l[v]){t[0]=0,t[1]=0,t[2]=1;return}for(o=0,n=f[v],r=p[v],u[0]=n.coords[0]-r.coords[0],u[1]=n.coords[1]-r.coords[1],u[2]=n.coords[2]-r.coords[2],e=m.next;e!==m;e=e.next)d[0]=e.coords[0]-r.coords[0],d[1]=e.coords[1]-r.coords[1],d[2]=e.coords[2]-r.coords[2],h[0]=u[1]*d[2]-u[2]*d[1],h[1]=u[2]*d[0]-u[0]*d[2],h[2]=u[0]*d[1]-u[1]*d[0],a=h[0]*h[0]+h[1]*h[1]+h[2]*h[2],a>o&&(o=a,t[0]=h[0],t[1]=h[1],t[2]=h[2]);o<=0&&(t[0]=t[1]=t[2]=0,t[this.longAxis_(u)]=1)},i.prototype.checkOrientation_=function(){for(var t=this.mesh.fHead,e,n=this.mesh.vHead,r,s=0,a=t.next;a!==t;a=a.next)if(r=a.anEdge,!(r.winding<=0))do s+=(r.Org.s-r.Dst.s)*(r.Org.t+r.Dst.t),r=r.Lnext;while(r!==a.anEdge);if(s<0){for(e=n.next;e!==n;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var t=this.mesh.vHead,e=[0,0,0],n,r,s=!1;e[0]=this.normal[0],e[1]=this.normal[1],e[2]=this.normal[2],!e[0]&&!e[1]&&!e[2]&&(this.computeNormal_(e),s=!0),n=this.sUnit,r=this.tUnit;var a=this.longAxis_(e);n[a]=0,n[(a+1)%3]=1,n[(a+2)%3]=0,r[a]=0,r[(a+1)%3]=0,r[(a+2)%3]=e[a]>0?1:-1;for(var o=t.next;o!==t;o=o.next)o.s=this.dot_(o.coords,n),o.t=this.dot_(o.coords,r);s&&this.checkOrientation_();for(var l=!0,c=t.next;c!==t;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.prototype.tessellateMonoRegion_=function(t,e){var n,r;if(n=e.anEdge,!(n.Lnext!==n&&n.Lnext.Lnext!==n))throw"Mono region invalid";for(;Tt.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;Tt.vertLeq(n.Org,n.Dst);n=n.Lnext);r=n.Lprev;for(var s=void 0;n.Lnext!==r;)if(Tt.vertLeq(n.Dst,r.Org)){for(;r.Lnext!==n&&(Tt.edgeGoesLeft(r.Lnext)||Tt.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)s=t.connect(r.Lnext,r),r=s.Sym;r=r.Lprev}else{for(;r.Lnext!==n&&(Tt.edgeGoesRight(n.Lprev)||Tt.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)s=t.connect(n,n.Lprev),n=s.Sym;n=n.Lnext}if(r.Lnext===n)throw"Mono region invalid";for(;r.Lnext.Lnext!==n;)s=t.connect(r.Lnext,r),r=s.Sym;return!0},i.prototype.tessellateInterior_=function(t){for(var e,n=t.fHead.next;n!==t.fHead;n=e)if(e=n.next,n.inside&&!this.tessellateMonoRegion_(t,n))return!1;return!0},i.prototype.discardExterior_=function(t){for(var e,n=t.fHead.next;n!==t.fHead;n=e)e=n.next,n.inside||t.zapFace(n)},i.prototype.setWindingNumber_=function(t,e,n){for(var r,s=t.eHead.next;s!==t.eHead;s=r)r=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?e:-e:n?t.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(t){return!t.Rface||!t.Rface.inside?-1:t.Rface.n},i.prototype.outputPolymesh_=function(t,e,n,r){var s,a=0,o=0,l;n>3&&t.mergeConvexFaces(n);for(var c=t.vHead.next;c!==t.vHead;c=c.next)c.n=-1;for(var u=t.fHead.next;u!==t.fHead;u=u.next)if(u.n=-1,!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;c.n===-1&&(c.n=o,o++),l++,s=s.Lnext}while(s!==u.anEdge);if(l>n)throw"Face vertex greater that support polygon";u.n=a,++a}this.elementCount=a,e===Or.CONNECTED_POLYGONS&&(a*=2),this.elements=[],this.elements.length=a*n,this.vertexCount=o,this.vertices=[],this.vertices.length=o*r,this.vertexIndices=[],this.vertexIndices.length=o;for(var c=t.vHead.next;c!==t.vHead;c=c.next)if(c.n!==-1){var d=c.n*r;this.vertices[d+0]=c.coords[0],this.vertices[d+1]=c.coords[1],r>2&&(this.vertices[d+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var h=0,u=t.fHead.next;u!==t.fHead;u=u.next)if(!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;this.elements[h++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var p=l;p<n;++p)this.elements[h++]=-1;if(e===Or.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[h++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var f=l;f<n;++f)this.elements[h++]=-1}}},i.prototype.outputContours_=function(t,e){var n,r,s=0,a=0;this.vertexCount=0,this.elementCount=0;for(var o=t.fHead.next;o!==t.fHead;o=o.next)if(!!o.inside){r=n=o.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==r);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*e,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,u=0;s=0;for(var o=t.fHead.next;o!==t.fHead;o=o.next)if(!!o.inside){a=0,r=n=o.anEdge;do this.vertices[l++]=n.Org.coords[0],this.vertices[l++]=n.Org.coords[1],e>2&&(this.vertices[l++]=n.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(n):n.Org.idx,a++,n=n.Lnext;while(n!==r);this.elements[u++]=s,this.elements[u++]=a,s+=a}},i.prototype.addContour=function(t,e){this.mesh===null&&(this.mesh=new jk),t<2&&(t=2),t>3&&(t=3);for(var n=null,r=0;r<e.length;r+=t)n===null?(n=this.mesh.makeEdge(),this.mesh.splice(n,n.Sym)):(this.mesh.splitEdge(n),n=n.Lnext),n.Org.coords[0]=e[r+0],n.Org.coords[1]=e[r+1],t>2?n.Org.coords[2]=e[r+2]:n.Org.coords[2]=0,n.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(n),n.winding=1,n.Sym.winding=-1},i.prototype.tesselate=function(t,e,n,r,s,a){if(t===void 0&&(t=ln.ODD),e===void 0&&(e=Or.POLYGONS),a===void 0&&(a=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=t,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),jJ.computeInterior(this,a);var o=this.mesh;return e===Or.BOUNDARY_CONTOURS?this.setWindingNumber_(o,1,!0):this.tessellateInterior_(o),a&&o.check(),e===Or.BOUNDARY_CONTOURS?this.outputContours_(o,r):this.outputPolymesh_(o,e,n,r),!0},i}();v1e=ln.ODD,b1e=ln.NONZERO,x1e=ln.POSITIVE,S1e=ln.NEGATIVE,w1e=ln.ABS_GEQ_TWO,E1e=Or.POLYGONS,M1e=Or.CONNECTED_POLYGONS,_1e=Or.BOUNDARY_CONTOURS});var uw,vv,Xk=F(()=>{"use strict";uw=class{constructor(t=256,e=!1){this.capacity=t,this.size=0,this.debug=e,this.debug&&console.log(`allocating with cap ${t}`);let n=t*uw.eSize;this.buffer=new ArrayBuffer(n);let r=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*r,3*t),s+=3*t,this.normals=new Float32Array(this.buffer,s*r,3*t),s+=3*t,this.uvs=new Float32Array(this.buffer,s*r,2*t)}realloc(t,e=!1){if(t<this.size)throw Error("cannot shrink buffer");if(t<=this.capacity&&!e)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${t}`);let n=t*uw.eSize,r=new ArrayBuffer(n),s=Float32Array.BYTES_PER_ELEMENT,a=0,o=new Float32Array(r,a*s,3*t);a+=3*t;let l=new Float32Array(r,a*s,3*t);a+=3*t;let c=new Float32Array(r,a*s,2*t);e?(o.set(this.positions.subarray(0,this.size*3)),l.set(this.normals.subarray(0,this.size*3)),c.set(this.uvs.subarray(0,this.size*2))):(o.set(this.positions),l.set(this.normals),c.set(this.uvs)),this.buffer=r,this.positions=o,this.normals=l,this.uvs=c,this.capacity=t}get(t=1){let e=this.size+t;if(e>this.capacity){let r=this.capacity;for(;e>r;)r*=2;this.realloc(r)}let n=this.size;return this.size=e,n}reserve(t){let e=this.size+t;e>this.capacity&&this.realloc(e)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},vv=uw;vv.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT});var bv,Yk=F(()=>{bv=class{constructor(t=[],e=(n,r)=>n<r?-1:n>r?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:n}=this,r=e[t];for(;t>0;){let s=t-1>>1,a=e[s];if(n(r,a)>=0)break;e[t]=a,t=s}e[t]=r}_down(t){let{data:e,compare:n}=this,r=this.length>>1,s=e[t];for(;t<r;){let a=(t<<1)+1,o=a+1;if(o<this.length&&n(e[o],e[a])<0&&(a=o),n(e[a],s)>=0)break;e[t]=e[a],t=a}e[t]=s}}});function i2(i,t,e=1,n=!1){let r=1/0,s=1/0,a=-1/0,o=-1/0;for(let[v,b]of i[0])v<r&&(r=v),b<s&&(s=b),v>a&&(a=v),b>o&&(o=b);let l=a-r,c=o-s,u=Math.max(e,Math.min(l,c));if(u===e){let v=[r,s];return v.distance=0,v.distance}let d=new bv([],(v,b)=>b.max-v.max),h=qJ(i),p=new dw(r+l/2,s+c/2,0,i);p.d>h.d&&(h=p);let f=2;function m(v,b,x){let S=new dw(v,b,x,i);if(f++,S.max>h.d+e&&d.push(S),S.d>h.d&&(h=S,n&&console.log(`found best ${Math.round(1e4*S.d)/1e4} after ${f} probes`),h.d>t))return t}let g=u/2;for(let v=r;v<a;v+=u)for(let b=s;b<o;b+=u)m(v+g,b+g,g);for(;d.length;){let{max:v,x:b,y:x,h:S}=d.pop();if(v-h.d<=e)break;g=S/2,m(b-g,x-g,g),m(b+g,x-g,g),m(b-g,x+g,g),m(b+g,x+g,g)}n&&console.log(`num probes: ${f}
4132
4132
  best distance: ${h.d}`);let y=[h.x,h.y];return y.distance=h.d,y.distance}function dw(i,t,e,n){this.x=i,this.y=t,this.h=e,this.d=WJ(i,t,n),this.max=this.d+this.h*Math.SQRT2}function WJ(i,t,e){let n=!1,r=1/0;for(let s of e)for(let a=0,o=s.length,l=o-1;a<o;l=a++){let c=s[a],u=s[l];c[1]>t!=u[1]>t&&i<(u[0]-c[0])*(t-c[1])/(u[1]-c[1])+c[0]&&(n=!n),r=Math.min(r,XJ(i,t,c,u))}return r===0?0:(n?1:-1)*Math.sqrt(r)}function qJ(i){let t=0,e=0,n=0,r=i[0];for(let a=0,o=r.length,l=o-1;a<o;l=a++){let c=r[a],u=r[l],d=c[0]*u[1]-u[0]*c[1];e+=(c[0]+u[0])*d,n+=(c[1]+u[1])*d,t+=d*3}let s=new dw(e/t,n/t,0,i);return t===0||s.d<0?new dw(r[0][0],r[0][1],0,i):s}function XJ(i,t,e,n){let r=e[0],s=e[1],a=n[0]-r,o=n[1]-s;if(a!==0||o!==0){let l=((i-r)*a+(t-s)*o)/(a*a+o*o);l>1?(r=n[0],s=n[1]):l>0&&(r+=a*l,s+=o*l)}return a=i-r,o=t-s,a*a+o*o}var $k=F(()=>{"use strict";Yk()});var xv,a2,o2,s2,Mu,hw=F(()=>{"use strict";Y();Qd();Xk();hn();$k();xv={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},a2={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},o2={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},s2=(i,t)=>([e,n])=>(n<e&&(n+=t),(i>=e?i:i+t)<=n),Mu=class extends De{constructor(e,n,r=0,s=12,a=3,o=ln.ODD,l=!1){super();this.forPathBevel=l;this.type="ShapeGeometry";this.vertexCache={};this._shape=e,this._depth=n,this._curveSegments=s,this._bevelSegmentsInput=a;let c=this._shape.extractShapePointsToFlatArray([],s),u=this._shape.shapeHoles.map(C=>{let P=C.extractShapePointsToFlatArray([],s),D=[];for(let I=P.length-1;I>=1;I-=2){let L=P[I-1],U=P[I-0];D.push(L,U)}return D}),d=[],h=[];for(let C=0;C<c.length;C+=2)h.push([c[C],c[C+1]]);d.push(h);for(let C=0;C<u.length;C++){let P=u[C],D=[];for(let I=0;I<P.length;I+=2)D.push([P[I],P[I+1]]);d.push(D)}let p;e.isText?p=new Xl().setFromPoints(e.points.map(P=>P.position)).getSize(new j).length()*.1:d[0].length===0?p=r:r>0?p=i2(d,r):p=1e-5,r<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(r,p,n/2),this._bevelSegments=Math.floor(a));let f;try{f=oo({windingRule:o,elementType:Or.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[c]})}catch{f=xv}let m;try{m=oo({windingRule:ln.ODD,elementType:Or.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...u]})}catch{m=a2}if(!f)throw new Error("error generating geometry");let g=f.elementCount;if(m){f.elementCount+=m.elementCount;for(let C=0;C<m.elements.length;C++){let P=m.elements[C],D=C%2===0?f.vertexCount:0;f.elements.push(P+D)}for(let C=0;C<m.vertexIndices.length;C++){let P=m.vertexIndices[C],D=f.vertexCount;f.vertexIndices.push(P+D)}for(let C=0;C<m.vertices.length;C++){let P=m.vertices[C];f.vertices.push(P)}}let y=1/0,v=-1/0,b=1/0,x=-1/0;for(let C=0,P=f.vertexCount;C<P;C++){let D=C*2,I=f.vertices[D+0],L=f.vertices[D+1];I<y&&(y=I),I>v&&(v=I),L<b&&(b=L),L>x&&(x=L)}this._minX=y,this._minY=b,this._width=v-y,this._height=x-b,this._buffer=new vv(this._computeBufferEstimatedSize(f));let S=[],E=[];for(let C=f.elementCount-1;C>=0;C--){let P=C>=g,D=C*2,I=f.elements[D+0],L=f.elements[D+1],U=I+L,G={start:I,count:L,normals:[],continuous:[],concave:[]},X=I,ae=U-1,ee=I+1,$=this._shape.roundedCurves.length;do{let de=X-I,Se=f.vertices[ae*2+0],oe=f.vertices[ae*2+1],be=f.vertices[X*2+0],Oe=f.vertices[X*2+1],Le=f.vertices[ee*2+0],ke=f.vertices[ee*2+1],Ce=be-Se,ce=Oe-oe,ye=Math.sqrt(Ce*Ce+ce*ce);Ce/=ye,ce/=ye;let Me=be-Le,Ne=Oe-ke,He=Math.sqrt(Me*Me+Ne*Ne);Me/=He,Ne/=He,G.normals[de*2+0]=-Ne,G.normals[de*2+1]=Me,G.concave[de]=Ce*Ne-ce*Me>0;let _e=f.vertexIndices[X];if(Array.isArray(_e))G.continuous[de]=!1;else{let[Re,B]=this._shape.getCurveIndexFromVertexId(_e-1,!0);if(B>0&&B<1)G.continuous[de]=!0;else{let me=B===1?Re+1:Re-1;me=(me+$)%$;let W=B===1?0:1,et=this._shape.roundedCurves[Re].getTangent(B),Ge=this._shape.roundedCurves[me].getTangent(W);G.continuous[de]=et.dot(Ge)>.95}}P&&(G.normals[de*2+0]*=-1,G.normals[de*2+1]*=-1),[ae,X,ee]=[X,ee,ee+1],ee>=U&&(ee-=L)}while(ee!==I+1);let K=[];K.push({bevelI:0,angle:0,size:0,boundary:{vertices:f.vertices.slice(I*2,U*2),vertexCount:L,vertexIndices:new Array(L).fill(!0).map((de,Se)=>[Se,Se]),elements:[0,L],elementCount:1,mesh:null},reverseMap:[],insetPoints:f.vertices.slice(I*2,U*2)});let re=0;for(let de=1;de<=this._bevelSegments;de++){let Se=de/this._bevelSegments*Math.PI/2,oe=(1-Math.cos(Se))*this._bevel,be=[],Oe=[],Le=[],ke=[],Ce=0;for(let ye=0;ye<L;ye++){let Me=ye*2,Ne=(ye-1+L)%L*2,He=f.vertices[G.start*2+Me+0],_e=f.vertices[G.start*2+Me+1],Re=-G.normals[Ne+0]*oe,B=-G.normals[Ne+1]*oe,me=-G.normals[Me+0]*oe,W=-G.normals[Me+1]*oe;if(G.concave[ye]||!G.concave[ye]&&P){let et=Math.atan2(B,Re),Ge=Math.atan2(W,me);Ge>et&&(Ge-=Math.PI*2);let z=Ge-et;if(G.continuous[ye]||P){let O=et+z/2,q=Math.cos(O)*oe,J=Math.sin(O)*oe;be[2*Ce+0]=He+q*(P?-1:1),be[2*Ce+1]=_e+J*(P?-1:1),ke[Ce]=ye,Ce++}else{let O=Math.max(1,Math.floor(s/4*Math.abs(z)/Math.PI));for(let q=0;q<=O;q++){let J=et+z*(q/O),le=Math.cos(J)*oe,xe=Math.sin(J)*oe;be[2*Ce+0]=He+le,be[2*Ce+1]=_e+xe,ke[Ce]=ye,Ce++}}}else be[2*Ce+0]=He+Re,be[2*Ce+1]=_e+B,ke[Ce]=ye,Oe[ye]=Ce,Ce++,be[2*Ce+0]=He,be[2*Ce+1]=_e,ke[Ce]=ye,Ce++,be[2*Ce+0]=He+me,be[2*Ce+1]=_e+W,ke[Ce]=ye,Le[ye]=Ce,Ce++}let ce=oo({windingRule:ln.POSITIVE,elementType:Or.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[be],edgeCreateCallback:ye=>{let Ne=ye.Org.idx,He=ke[Ne],_e=ke[(Ne+1)%ke.length];ye.idx=[He,_e],ye.Sym.idx=[_e,He]},vertexIdCallback:ye=>{let Me=ye.Lprev.idx;return[Me?Me[1]:0,ye.idx?ye.idx[0]:0]}});if(!ce)throw console.log("Error"),new Error(`error generating bevel geometry for ${de}'th loop`);if(!ce.vertexCount){let ye=(de-1)/this._bevelSegments*Math.PI/2;re=(1-Math.sin(ye))*this._bevel;break}for(let ye=0;ye<ce.vertexIndices.length;ye++){let[Me,Ne]=ce.vertexIndices[ye];if(Me===Ne)continue;let He=Ne;Ne<Me&&(He+=L);for(let _e=Me;_e<He;_e++){let Re=_e%L,B=(_e+1)%L;if(!G.continuous[Re]||!G.continuous[B]){ce.vertexIndices[ye]=[Me,Re],ce.vertexIndices.splice(ye+1,0,[B,Ne]),ce.vertices.splice((ye+1)*2,0,ce.vertices[ye*2],ce.vertices[ye*2+1]);break}}}K.push({bevelI:de,angle:Se,size:oe,boundary:ce,reverseMap:ke,insetPoints:be})}let fe=(de,Se,oe)=>{let be=0,Oe=de.boundary.vertexIndices.length;for(;be<Oe&&oe(de.boundary.vertexIndices[Se]);)Se=(Se+1)%Oe,be++;return be},ve=S.length;for(let de=1;de<K.length;de++){let Se=K[de-1],oe=K[de],be=Se.boundary.vertexIndices.length,Oe=oe.boundary.vertexIndices.length;if(!be||!Oe)break;let Le=G.concave.length,ke=0,Ce=s2(ke,L);for(;!Se.boundary.vertexIndices.filter(Ce).length||!oe.boundary.vertexIndices.filter(Ce).length;)ke++,Ce=s2(ke,L);let ce=Se.boundary.vertexIndices.findIndex(Ce),ye=oe.boundary.vertexIndices.findIndex(Ce);do ce=(ce+1)%be;while(Ce(Se.boundary.vertexIndices[ce]));do ye=(ye+1)%Oe;while(Ce(oe.boundary.vertexIndices[ye]));ke=(ke+1)%L;let Me=ke,Ne=0,He=this._buildBevelVert(G,Se,(ce-1+be)%be,void 0,Ne),_e=this._buildBevelVert(G,oe,(ye-1+Oe)%Oe,void 0,Ne),Re=He,B=_e,me,W,et=!1;do{Ne=(ke||Le)/Le,Ce=s2(ke,L);let Ge=fe(Se,ce,Ce),z=fe(oe,ye,Ce),O=et;if(et=!1,Ge&&!z){for(let q=0;q<Ge;q++)me=this._buildBevelVert(G,Se,(ce+q)%be,q/(Ge-1),Ne),S.push(Re.topN,me.topP,B.topN),l===!1&&S.push(me.bottomP,Re.bottomN,B.bottomN),Re=me;et=!0}else if(!Ge&&z)for(let q=0;q<z;q++)W=this._buildBevelVert(G,oe,(ye+q)%Oe,q/(z-1),Ne),S.push(B.topN,Re.topP,W.topP),l===!1&&S.push(Re.bottomP,B.bottomN,W.bottomP),B=W;else if(Ge&&z)if(me=this._buildBevelVert(G,Se,ce,0,Ne),W=this._buildBevelVert(G,oe,ye,0,Ne),O?(S.push(Re.topN,W.topP,B.topN),S.push(Re.topN,me.topP,W.topP),l===!1&&(S.push(W.bottomP,Re.bottomN,B.bottomN),S.push(W.bottomP,me.bottomP,Re.bottomN))):(S.push(B.topN,Re.topN,me.topP),S.push(B.topN,me.topP,W.topP),l===!1&&(S.push(me.bottomP,Re.bottomN,B.bottomN),S.push(me.bottomP,B.bottomN,W.bottomP))),Re=me,B=W,Ge===z)for(let q=1;q<Ge;q++)me=this._buildBevelVert(G,Se,(ce+q)%be,q/(Ge-1),Ne),W=this._buildBevelVert(G,oe,(ye+q)%Oe,q/(z-1),Ne),S.push(Re.topN,me.topP,B.topN),S.push(B.topN,me.topP,W.topP),l===!1&&(S.push(me.bottomP,Re.bottomN,B.bottomN),S.push(me.bottomP,B.bottomN,W.bottomP)),Re=me,B=W;else if(Ge>z){let q=Ge/z,J=0;for(let le=1;le<Ge;le++)me=this._buildBevelVert(G,Se,(ce+le)%be,le/(Ge-1),Ne),S.push(Re.topN,me.topP,B.topN),l===!1&&S.push(me.bottomP,Re.bottomN,B.bottomN),Re=me,le>(J+1)*q&&(J++,W=this._buildBevelVert(G,oe,(ye+J)%Oe,J/(z-1),Ne),S.push(B.topN,me.topP,W.topP),l===!1&&S.push(me.bottomP,B.bottomN,W.bottomP),B=W)}else{let q=z/Ge,J=0;for(let le=1;le<z;le++)W=this._buildBevelVert(G,oe,(ye+le)%Oe,le/(z-1),Ne),S.push(B.topN,me.topP,W.topP),l===!1&&S.push(me.bottomP,B.bottomN,W.bottomP),B=W,le>(J+1)*q&&(J++,me=this._buildBevelVert(G,Se,(ce+J)%be,J/(Ge-1),Ne),S.push(Re.topN,me.topP,B.topN),l===!1&&S.push(me.bottomP,Re.bottomN,B.bottomN),Re=me)}ce=(ce+Ge)%be,ye=(ye+z)%Oe,ke=(ke+1)%Le}while(ke!==Me)}if(l===!1&&this._depth>this._bevel*2&&this._buildWall(K,G,S),P){let de=[];for(let Se=S.length-1;Se>=ve+2;Se-=3){let oe=S[Se-2],be=S[Se-1],Oe=S[Se-0];de.push(Oe,be,oe)}S.splice(ve,S.length-ve,...de)}if(P){let de=[];for(let Se=K[K.length-1].boundary.vertices.length-1;Se>=1;Se-=2){let oe=K[K.length-1].boundary.vertices[Se-1],be=K[K.length-1].boundary.vertices[Se-0];de.push(oe,be)}E.push(de)}if(!P){let de=K[K.length-1],Se;try{Se=oo({windingRule:K.length>1?ln.POSITIVE:ln.ODD,elementType:Or.POLYGONS,vertexSize:2,strict:!0,contours:[de.insetPoints,...E]})}catch{Se=o2}if(!Se)throw new Error("Error generating geometry for surface");u.length===0&&this._bevel<p&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let oe=0;oe<Se.elementCount*3;oe+=3){let be=this._buildSurfaceVert(Se,Se.elements[oe+0],re),Oe=this._buildSurfaceVert(Se,Se.elements[oe+1],re),Le=this._buildSurfaceVert(Se,Se.elements[oe+2],re);S.push(be.top,Oe.top,Le.top),l===!1&&S.push(Le.bottom,Oe.bottom,be.bottom)}}this.vertexCache={}}this._buffer.shrink();let M=new je(Uint32Array.from(S),1),w=new je(this._buffer.positions,3),T=new je(this._buffer.normals,3),A=new je(this._buffer.uvs,2);w.needsUpdate=!0,T.needsUpdate=!0,A.needsUpdate=!0,M.needsUpdate=!0,this.setAttribute("position",w),this.setAttribute("normal",T),this.setAttribute("uv",A),this.setIndex(M)}_computeBufferEstimatedSize(e){return e.vertexCount*2*(2+this._bevelSegments)}_buildWall(e,n,r){let s=e[0];for(let a=0,o=s.boundary.vertexCount;a<o;a++){let l=this._buildBevelVert(n,s,a),c=this._buildBevelVert(n,s,(a+1)%o);r.push(c.topP,l.topN,l.bottomN),r.push(c.topP,l.bottomN,c.bottomP)}}_buildSurfaceVert(e,n,r){let s=n.toString();if(s in this.vertexCache)return this.vertexCache[s];let a=e.vertices[n*2+0],o=e.vertices[n*2+1],l=(a-this._minX)/this._width,c=(o-this._minY)/this._height;this.forPathBevel&&(c=1);let u=this._buffer.get(this.forPathBevel?1:2),d=u*3,h=u*2,p={top:u+0,bottom:u+1};return this._buffer.positions[d+0]=a,this._buffer.positions[d+1]=o,this._buffer.positions[d+2]=this.forPathBevel?this._bevel:this._depth-r,this._buffer.normals[d+0]=0,this._buffer.normals[d+1]=0,this._buffer.normals[d+2]=1,this._buffer.uvs[h+0]=l,this._buffer.uvs[h+1]=c,this.forPathBevel===!1&&(this._buffer.positions[d+3]=a,this._buffer.positions[d+4]=o,this._buffer.positions[d+5]=r,this._buffer.normals[d+3]=0,this._buffer.normals[d+4]=0,this._buffer.normals[d+5]=-1,this._buffer.uvs[h+2]=l,this._buffer.uvs[h+3]=c),this.vertexCache[s]=p,p}_buildBevelVert(e,n,r,s=1,a){let o=`${n.bevelI}:${r}`;if(o in this.vertexCache&&a!==0&&a!==1&&(!a||a===this.vertexCache[o].pathBevelUCoord))return this.vertexCache[o];let[l,c]=n.boundary.vertexIndices[r],u,d,h,p;l!==c?(d=l,u=c,p=!1,h=e.continuous[d]&&e.continuous[u]):(u=l,d=(u-1+e.count)%e.count,p=e.concave[u]&&n.bevelI>0,h=e.continuous[u]||p);let f=Math.cos(n.angle),m=Math.sin(n.angle),g=r*2,y=u*2,v=d*2,b=n.boundary.vertices[g+0],x=n.boundary.vertices[g+1],S=(1-m)*this._bevel,E=(b-this._minX)/this._width,M=(x-this._minY)/this._height;this.forPathBevel&&(a!==void 0&&(E=a),M=1);let w=e.normals[y+0],T=e.normals[y+1],A=e.normals[v+0],C=e.normals[v+1];if(p){let U=A-w,G=C-T;w=w+U*(1-s),T=T+G*(1-s);let X=Math.sqrt(w*w+T*T);w/=X,T/=X}let P=this.forPathBevel?this._buffer.get(h?1:2):this._buffer.get(h?2:4),D=P*3,I=P*2,L={i:r,fi:u,topP:P+0,topN:P+0,bottomP:P+1,bottomN:P+1,pathBevelUCoord:a};return this._buffer.positions[D+0]=b,this._buffer.positions[D+1]=x,this._buffer.positions[D+2]=(this.forPathBevel?this._bevel:this._depth)-S,this._buffer.normals[D+0]=w*f,this._buffer.normals[D+1]=T*f,this._buffer.normals[D+2]=m,this._buffer.uvs[I+0]=E,this._buffer.uvs[I+1]=M,this.forPathBevel===!1&&(this._buffer.positions[D+3]=b,this._buffer.positions[D+4]=x,this._buffer.positions[D+5]=S,this._buffer.normals[D+3]=w*f,this._buffer.normals[D+4]=T*f,this._buffer.normals[D+5]=-m,this._buffer.uvs[I+2]=M,this._buffer.uvs[I+3]=E),h||(this.forPathBevel?(P+=1,D+=3,I+=2):(P+=2,D+=6,I+=4),L.topP=P+0,L.bottomP=P+1,this._buffer.positions[D+0]=b,this._buffer.positions[D+1]=x,this._buffer.positions[D+2]=(this.forPathBevel?this._bevel:this._depth)-S,this._buffer.normals[D+0]=A*f,this._buffer.normals[D+1]=C*f,this._buffer.normals[D+2]=m,this._buffer.uvs[I+0]=E,this._buffer.uvs[I+1]=M,this.forPathBevel===!1&&(this._buffer.positions[D+3]=b,this._buffer.positions[D+4]=x,this._buffer.positions[D+5]=S,this._buffer.normals[D+3]=A*f,this._buffer.normals[D+4]=C*f,this._buffer.normals[D+5]=-m,this._buffer.uvs[I+2]=M,this._buffer.uvs[I+3]=E)),this.vertexCache[o]=L,L}clone(){let e=new Mu(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=ou(this.userData),e}}});var Nf,l2=F(()=>{"use strict";Y();Qd();hn();hw();Nf=class extends De{constructor(e,n=12,r={}){super();this.type="ShapeGeometry";this.windingRule=ln.ODD;this.elementType=Or.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=e,this._curveSegments=n,this._triangulationOptions=Object.assign({windingRule:ln.ODD,elementType:Or.POLYGONS,polySize:3,vertexSize:2,strict:!0},r);let s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),a=this._shape.shapeHoles.map(f=>f.extractShapePointsToFlatArray([],this._curveSegments)),o,l=!0,c=!0,u,d;for(let f=0,m=s.length/2;f<m;f++){let g=f*2,y=s[g+0],v=s[g+1];if(u!==void 0&&y!==u&&(l=!1),d!==void 0&&v!==d&&(c=!1),u=y,d=v,!l&&!c)break}if(!l&&!c)try{o=oo({contours:[s,...a],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{o=xv}let h=o?.vertexCount??1,p=o?.elementCount??1;if(this._positionAttribute=new je(new Float32Array(h*3),3),this._normalAttribute=new je(new Float32Array(h*3),3),this._uvAttribute=new je(new Float32Array(h*2),2),this._indexAttribute=new je(new Uint32Array(p*3),1),o){let f=1/0,m=-1/0,g=1/0,y=-1/0;for(let x=0,S=h;x<S;x++){let E=x*2,M=o.vertices[E+0],w=o.vertices[E+1];M<f&&(f=M),M>m&&(m=M),w<g&&(g=w),w>y&&(y=w)}let v=m-f,b=y-g;for(let x=0,S=h;x<S;x++){let E=x*2,M=o.vertices[E+0],w=o.vertices[E+1],T=(M-f)/v,A=(w-g)/b;this._positionAttribute.setXYZ(x,M,w,0),this._normalAttribute.setXYZ(x,0,0,1),this._uvAttribute.setXY(x,T,A)}for(let x=0,S=p;x<S;x++){let E=x*3,M=o.elements[E+0],w=o.elements[E+1],T=o.elements[E+2];this._indexAttribute.setX(E+0,M),this._indexAttribute.setX(E+1,w),this._indexAttribute.setX(E+2,T)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,(o?.elementCount??1)*3)}clone(){let e=new Nf(this._shape,this._curveSegments);return e.userData=ou(this.userData),e}}});var Bf,Kk=F(()=>{"use strict";Qd();hn();hw();Bf=class extends Mu{constructor(e,n,r=0,s=12,a=3,o=ln.ODD){super(e,n,r,s,a,o);this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return e.vertexCount*2*(2+this._bevelSegments)}_buildWall(e,n,r){let s=e[0];for(let a=0,o=s.boundary.vertexCount;a<o;a++){let l=this._buildBevelVert(n,s,a),c=this._buildBevelVert(n,s,(a+1)%o);r.push(c.topP,l.topN,l.bottomN),r.push(c.topP,l.bottomN,c.bottomP)}}clone(){let e=new Bf(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=ou(this.userData),e}}});var As,pc=F(()=>{"use strict";hc();l2();Kk();Qd();As=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:ln.ODD},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),a=i.shape??t?.shape,o=a?.roundness??e.roundness,l;a!==void 0&&(a instanceof vn?(l=a,(l.width!==n||l.height!==r)&&l.applySize(n,r)):l=new vn(n,r).fromJSON(a),i.parameters?.roundness!==void 0&&i.parameters?.roundness>0&&l.update());let c=l??new vn(n,r);return{parameters:Object.assign(e,{width:n,height:r,depth:s,roundness:o}),shape:c}}static build(i){let{depth:t,extrudeBevelSize:e,extrudeBevelSegments:n,subdivisions:r,roundness:s,windingRule:a}=i.parameters;i.shape.roundness=s;let o;return t<=0?o=new Nf(i.shape,r,{windingRule:a}):o=new Bf(i.shape,t,e,r,n,a),Object.assign(o,{userData:{...i,type:"VectorGeometry"}})}}});function YJ(i,t,e,n,r,s){if(n>=Qk)return r>30||r%4===0?(KJ(i,t,e,s),Math.round(r/4)):Zk(i,n,r,t,e,s);n=Math.max(n,.001);let a={x:0,y:e},o=n+Math.PI*.5,l={x:Math.cos(o)*t,y:Math.sin(o)*e},c=zk({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:t,ry:e,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?$J(i,a.x,a.y,c,r,t,e,s):Zk(i,n,r,t,e,s)}function $J(i,t,e,n,r,s,a,o){let l=Math.round(r/n.length);i.addPoint(Ff(t,e));for(let c=0,u=n.length;c<u;c++){let d=n[c],h=i.points[c],p=Ff(d.x,d.y);h.controls[1].position.set(d.x1,d.y1),p.controls[0].position.set(d.x2,d.y2),i.addPoint(p)}return o>0?Jk(i,s,a,o):i.addPoint(Ff(0,0)),l}function Zk(i,t,e,n,r,s){let a=-t/e;for(let o=0;o<=e;o++){let l=a*o,c=Math.sin(l)*n,u=Math.cos(l)*r;i.addPoint(Ff(c,u))}return t<Qk?s>0?Jk(i,n,r,s):i.addPoint(Ff(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&eV(i,n,r,s)),1}function KJ(i,t,e,n=0,r=0,s=0){let a=.5522847498,o=t*a,l=e*a;i.addPoint(pw(r-t,s,r-t,s-l,r-t,s+l)),i.addPoint(pw(r,s+e,r-o,s+e,r+o,s+e)),i.addPoint(pw(r+t,s,r+t,s+l,r+t,s-l)),i.addPoint(pw(r,s-e,r+o,s-e,r-o,s-e)),n>0&&eV(i,t,e,n)}function Ff(i,t){return new ao(we.generateUUID(),new j(i,t))}function pw(i,t,e,n,r,s){let a=Ff(i,t);return a.controls[0].position.set(e,n),a.controls[1].position.set(r,s),a}function Jk(i,t,e,n){tV(i,t,e,n).forEach(s=>i.addPoint(s))}function eV(i,t,e,n){let r=tV(i,t,e,n),s=new vn;r.forEach(a=>s.addPoint(a)),s.isClosed=!0,i.shapeHoles.push(s)}function tV(i,t,e,n){let r=n*t/100,s=r*(Math.abs(e)/Math.abs(t)),a=new j(r/t,s/e),o=i.points.map(l=>{let c=l.clone();return c.uuid=we.generateUUID(),c}).reverse();return o.forEach(l=>{l.position.multiply(a);let c=l.controls[0].position.clone().multiply(a),u=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(u),l.controls[1].position.copy(c)}),o}var Qk,Uf,Sv=F(()=>{"use strict";hc();JP();Gk();pc();Y();Qk=Math.PI*2,Uf=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return e.angle=we.clamp(e.angle,0,360),{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:n,angle:r,innerRadius:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}=i.parameters,c=i.shape,u=t*.5,d=e*.5,h=YJ(c,u,d,r*Math.PI/180,n,s);c.isClosed=!0,c.update();let p;return r===0?(p=new De,p.setAttribute("position",new Ve([],3))):p=As.create({shape:c,parameters:{subdivisions:h,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}}),Object.assign(p,{userData:{...i,type:"EllipseGeometry"}})}}});var nV,wv,c2=F(()=>{"use strict";Y();qP();nV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,detail:r,corner:s,cornerSides:a}=i.parameters,o=r===0&&s!==0?new wv(t*.5,s,a):new xd(t*.5,r),l=e/t,c=n/t;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...i,type:"IcosahedronGeometry"}})}},wv=class extends wu{constructor(t=1,e=.2,n=4){let r=(1+Math.sqrt(5))/2,s=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],a=[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],o="IcosahedronGeometry";super(s,a,o,t,e,n),this.type=o}static fromJSON(t){return new wv(t.radius,t.corner,t.cornerSides)}}});var rV,u2=F(()=>{"use strict";Y();rV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){(i.parameters?.points??[]).forEach(n=>{Array.isArray(n)&&(n.x=n[0],n.y=n[1])});let e=Object.assign({},t?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{points:t,segments:e,verticalSegments:n}=i.parameters,r=new Co;r.moveTo(t[0].x,t[0].y),r.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let s=new Sd(r.extractPoints(n).shape,e);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...i,type:"LatheGeometry"}})}}});function kf(i,t){return Math.abs(t-i)/2+Math.min(i,t)}function ZJ(i){let t=i.getAttribute("position");if(t===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let e=i.getAttribute("uv"),n=i.getIndex(),r=t.count,s=new Map,a=new Uint32Array(r),o=[],l=0;for(let m=0;m<r;m++){let g=t.getX(m),y=t.getY(m),v=t.getZ(m),b=Math.round(g*d2),x=Math.round(y*d2),S=Math.round(v*d2),E=s.get(b);E===void 0&&(E=new Map,s.set(b,E));let M=E.get(x);M===void 0&&(M=new Map,E.set(x,M));let w=M.get(S);w===void 0&&(w=l++,M.set(S,w),o.push(g,y,v)),a[m]=w}let c=[],u=[],d=e===void 0?null:[],h=n!==null?n.count:r,p=(m,g)=>{let y=n!==null?n.getX(m):m,v=n!==null?n.getX(m+1):m+1,b=n!==null?n.getX(m+2):m+2;if(!(y<r&&v<r&&b<r))return;let x=a[y],S=a[v],E=a[b];x===S||S===E||E===x||(c.push(x,S,E),u.push(g),d!==null&&d.push(e.getX(y),e.getY(y),e.getX(v),e.getY(v),e.getX(b),e.getY(b)))},f=i.groups;if(f.length>0)for(let m=0;m<f.length;m++){let g=f[m],y=g.materialIndex===void 0?0:g.materialIndex,v=Math.max(g.start,0),b=Math.min(g.start+g.count,h);for(let x=v;x<b&&x+2<h;x+=3)p(x,y)}else for(let m=0;m+2<h;m+=3)p(m,0);return{positions:Float64Array.from(o),faces:Uint32Array.from(c),materialIndices:u,uvs:d===null?null:Float64Array.from(d)}}function QJ(i){let{positions:t,faces:e,materialIndices:n,uvs:r}=i,s=t.length/3,a=e.length/3,o=r!==null&&a>0,l=a*3,c=new Uint32Array(l),u=new Uint32Array(l),d=new Uint32Array(l),h=new Uint32Array(l),p=new Uint32Array(l),f=0,m=8;for(;m<l*2;)m*=2;let g=m-1,y=new Int32Array(m).fill(-1),v=(I,L)=>{let U=(Math.imul(I,2654435761)^L)&g;for(;;){let G=y[U];if(G===-1)return y[U]=f,c[f]=I,u[f]=L,f++;if(c[G]===I&&u[G]===L)return G;U=U+1&g}},b=(I,L)=>{let U=I<L?I:L,G=I<L?L:I,X=(Math.imul(U,2654435761)^G)&g;for(;;){let ae=y[X];if(c[ae]===U&&u[ae]===G)return ae;X=X+1&g}},x=new Uint32Array(s),S=new Float64Array(s*3),E=(I,L,U)=>{let G=I<L?v(I,L):v(L,I),X=++d[G];X===1?h[G]=U:X===2&&(p[G]=U),x[I]++,x[L]++,S[I*3]+=t[L*3],S[I*3+1]+=t[L*3+1],S[I*3+2]+=t[L*3+2],S[L*3]+=t[I*3],S[L*3+1]+=t[I*3+1],S[L*3+2]+=t[I*3+2]};for(let I=0;I<a;I++){let L=e[I*3],U=e[I*3+1],G=e[I*3+2];E(L,U,G),E(U,G,L),E(G,L,U)}let M=new Float64Array(f*3);for(let I=0;I<f;I++){let L=c[I]*3,U=u[I]*3;if(d[I]===2){let ae=h[I]*3,ee=p[I]*3;M[I*3]=(t[L]+t[U])*.375+(t[ae]+t[ee])*.125,M[I*3+1]=(t[L+1]+t[U+1])*.375+(t[ae+1]+t[ee+1])*.125,M[I*3+2]=(t[L+2]+t[U+2])*.375+(t[ae+2]+t[ee+2])*.125}else M[I*3]=(t[L]+t[U])*.5,M[I*3+1]=(t[L+1]+t[U+1])*.5,M[I*3+2]=(t[L+2]+t[U+2])*.5}let w=new Float64Array(s*3),T;for(let I=0;I<s;I++){let L=x[I];L===3?T=3/16:L>3&&(T=3/(8*L));let U=1-L*Number(T),G=Number(T);L===2&&(U=3/4,G=1/8),w[I*3]=t[I*3]*U+S[I*3]*G,w[I*3+1]=t[I*3+1]*U+S[I*3+1]*G,w[I*3+2]=t[I*3+2]*U+S[I*3+2]*G}let A=new Float64Array((s+f)*3);A.set(w),A.set(M,s*3);let C=new Uint32Array(a*12),P=new Array(a*4),D=o?new Float64Array(a*24):null;for(let I=0;I<a;I++){let L=e[I*3],U=e[I*3+1],G=e[I*3+2],X=b(L,U)+s,ae=b(U,G)+s,ee=b(G,L)+s,$=I*12;C[$++]=X,C[$++]=ae,C[$++]=ee,C[$++]=L,C[$++]=X,C[$++]=ee,C[$++]=U,C[$++]=ae,C[$++]=X,C[$++]=G,C[$++]=ee,C[$++]=ae;let K=n[I];if(P[I*4]=K,P[I*4+1]=K,P[I*4+2]=K,P[I*4+3]=K,D!==null){let re=I*6,fe=r[re],ve=r[re+1],de=r[re+2],Se=r[re+3],oe=r[re+4],be=r[re+5],Oe=kf(fe,de),Le=kf(ve,Se),ke=kf(de,oe),Ce=kf(Se,be),ce=kf(fe,oe),ye=kf(ve,be),Me=I*24;D[Me++]=Oe,D[Me++]=Le,D[Me++]=ke,D[Me++]=Ce,D[Me++]=ce,D[Me++]=ye,D[Me++]=fe,D[Me++]=ve,D[Me++]=Oe,D[Me++]=Le,D[Me++]=ce,D[Me++]=ye,D[Me++]=de,D[Me++]=Se,D[Me++]=ke,D[Me++]=Ce,D[Me++]=Oe,D[Me++]=Le,D[Me++]=oe,D[Me++]=be,D[Me++]=ce,D[Me++]=ye,D[Me++]=ke,D[Me++]=Ce}}return{positions:A,faces:C,materialIndices:P,uvs:D}}function JJ(i,t){let{positions:e,faces:n,materialIndices:r,uvs:s}=i,a=e.length/3,o=n.length/3,l=new Float64Array(a*3);for(let f=0;f<o;f++){let m=n[f*3]*3,g=n[f*3+1]*3,y=n[f*3+2]*3,v=e[y]-e[g],b=e[y+1]-e[g+1],x=e[y+2]-e[g+2],S=e[m]-e[g],E=e[m+1]-e[g+1],M=e[m+2]-e[g+2],w=b*M-x*E,T=x*S-v*M,A=v*E-b*S;l[m]+=w,l[m+1]+=T,l[m+2]+=A,l[g]+=w,l[g+1]+=T,l[g+2]+=A,l[y]+=w,l[y+1]+=T,l[y+2]+=A}for(let f=0;f<a;f++){let m=l[f*3],g=l[f*3+1],y=l[f*3+2],v=Math.sqrt(m*m+g*g+y*y)||1;l[f*3]=m/v,l[f*3+1]=g/v,l[f*3+2]=y/v}let c=o*3,u=new Float32Array(c*3),d=new Float32Array(c*3),h=s!==null&&s.length>0?new Float32Array(c*2):null;for(let f=0;f<c;f++){let m=n[f]*3;u[f*3]=e[m],u[f*3+1]=e[m+1],u[f*3+2]=e[m+2],d[f*3]=l[m],d[f*3+1]=l[m+1],d[f*3+2]=l[m+2]}h!==null&&h.set(s.subarray(0,c*2));let p=new De;p.setAttribute("position",new je(u,3)),c>0&&(p.setAttribute("normal",new je(d,3)),p.setAttribute("color",new je(new Float32Array(c*3).fill(1),3))),h!==null&&p.setAttribute("uv",new je(h,2));for(let f=0;f<o;){let m=r[f],g=f;do f++;while(f<o&&r[f]===m);p.addGroup(g*3,(f-g)*3,m)}return t.boundingBox!==null&&(p.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(p.boundingSphere=t.boundingSphere.clone()),p}var d2,fw,iV=F(()=>{"use strict";Y();d2=1e4;fw=class{constructor(t=1){this.subdivisions=t}modify(t){let e=ZJ(t),n=this.subdivisions;for(;n-- >0;)e=QJ(e);return JJ(e,t)}}});function eee(i){let t=new Bt,e=i.attributes.position;return e?(t.setFromBufferAttribute(e),t):(t.makeEmpty(),t)}var yi,sV,h2=F(()=>{"use strict";Y();iV();yi=new _,sV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=i.geometry??t?.geometry??new De().copy(new ni(100,100,100)),n;t===void 0?(e.computeBoundingBox(),e.boundingBox.getSize(yi),n={width:yi.x,height:yi.y,depth:yi.z,subdivisions:0}):n=t.parameters;let r={...n,...i.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:e}}static build(i){let{width:t,height:e,depth:n,subdivisions:r}=i.parameters,s=i.geometry??new De().copy(new ni(100,100,100)),a=s.userData.parameters;a===void 0?(s.boundingBox=eee(s),s.boundingBox.getSize(yi)):yi.set(a.width,a.height,a.depth),(t!==yi.x||e!==yi.y||n!==yi.z)&&s.scale(yi.x===0?1:t/yi.x,yi.y===0?1:e/yi.y,yi.z===0?1:n/yi.z);let o=s.originalGeometry;try{r>0?(o===void 0||a?.subdivisions!==r)&&(o===void 0&&(o=s),s=new fw(r).modify(o)):(o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return o!==void 0&&Object.assign(s,{originalGeometry:o}),delete i.geometry,Object.assign(s,{userData:{...i,type:"NonParametricGeometry"}})}static loadFromUrl(i,t,e){new _d(e).load(i,r=>{let s=this.normalizeInputs({geometry:r});r.boundingBox.getSize(yi);let a=100/yi.x;Object.assign(s.parameters,{width:100,height:yi.y*a,depth:yi.z*a}),t(this.build(s))})}}});var mw,gw=F(()=>{"use strict";hc();pc();mw=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o}=i.parameters,l=i.shape,c=t*.5,u=e*.5,d=0,h=0,p=2*Math.PI/n;for(let m=0;m<n;m++){let g=p*m,y=d+Math.sin(g)*c,v=h+Math.cos(g)*u;l.addPoint(l.createPoint(y,v))}l.isClosed=!0;for(let m=0,g=l.points.length;m<g;m++)l.points[m].roundness=r;l.roundness=r,l.update();let f=As.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o}});return Object.assign(f,{userData:{...i,type:"PolygonGeometry"}})}}});function Ev(i,t,e){e.x=i.x*t.x,e.y=i.y,e.z=i.x*t.y}function p2(i,t,e,n,r,s){let a=tee.copy(t).sub(i),o=nee.copy(e).sub(i),l=a.angleTo(o);if(a.normalize(),o.normalize(),n===r){let c=a.add(o).normalize();s.copy(i).addScaledVector(c,n/Math.sin(l/2))}else{let c=a.angleTo(o);s.copy(i),s.addScaledVector(a,r/Math.sin(c)),s.addScaledVector(o,n/Math.sin(c))}}function ree(i,t,e){let n=i.clone().sub(t),r=e.clone().sub(t);return n.projectOnVector(r),n.add(t)}var aV,tee,nee,f2,m2=F(()=>{"use strict";Y();aV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,radialSegments:r,heightSegments:s,openEnded:a,cornerRadius:o,cornerSegments:l}=i.parameters,c=new f2(t*.5,e,r,s,a,o,l),u=n/t;return u!==1&&c.scale(1,1,u),Object.assign(c,{userData:{...i,type:"PyramidGeometry"}})}};tee=new _,nee=new _;f2=class extends De{constructor(t=.5,e=1,n=4,r=1,s=!1,a=0,o=4){super(),n=Math.floor(Math.max(3,n)),r=Math.floor(r),o=Math.floor(o);let l=[],c=[],u=[],d=[],h=0,p=e/2,f=Math.PI/n,m=t*Math.cos(Math.PI/n),g=2*Math.PI/n,y=(n-2)*Math.PI/n,v=Math.PI-y,b=new _(0,-p,0),x=new _(0,p,0),S=new j(t,-p),E=new j(m,-p),M=new j(0,x.y).sub(E),w=new j(0,x.y).sub(S),T=new j(M.y,-M.x).normalize(),A=new j(w.y,-w.x).normalize(),P=t*Math.cos(Math.PI/n)*Math.tan((Math.PI-M.angle())/2)-1e-8;a=Math.min(a,P);let D;{let ee=new _(T.x,T.y,0),$=new _(Math.cos(g)*ee.x,ee.y,Math.sin(g)*ee.x);D=ee.angleTo($)}let I=a/Math.tan((Math.PI-M.angle())/2),L=a/Math.tan((Math.PI-D)/2),U=new _;if(!s){c.push(b.x,b.y,b.z),u.push(0,-1,0),d.push(0,0);let ee=h++,$=[],K=S.clone(),re=I/Math.cos(Math.PI/n);K.x-=re;for(let fe=0;fe<n;fe++){let ve=fe/n*Math.PI*2+f,de=new j(Math.sin(ve),Math.cos(ve));Ev(K,de,U),c.push(U.x,U.y,U.z),u.push(0,-1,0),d.push(0,0),$.push(h++)}for(let fe=0;fe<$.length;fe++)l.push($[fe],ee,$[(fe+1)%$.length])}let G=[];{let ee=new _,$=new _,K=new _,re=new _,fe=new _,ve=new _;for(let de=0;de<n;de++){let Se=de/n*Math.PI*2+f,oe=(de+.5)/n*Math.PI*2+f,be=(de+1)/n*Math.PI*2+f,Oe=new j(Math.sin(Se),Math.cos(Se)),Le=new j(Math.sin(oe),Math.cos(oe)),ke=new j(Math.sin(be),Math.cos(be));Ev(S,Oe,$),Ev(S,ke,K),Ev(T,Le,ee),p2(x,$,K,L,L,re),c.push(re.x,re.y,re.z),p2($,x,K,L,I,fe),c.push(fe.x,fe.y,fe.z),p2(K,$,x,I,L,ve),c.push(ve.x,ve.y,ve.z),u.push(ee.x,ee.y,ee.z),u.push(ee.x,ee.y,ee.z),u.push(ee.x,ee.y,ee.z),d.push(0,0),d.push(0,0),d.push(0,0);let Ce=h++,ce=h++,ye=h++;if(l.push(Ce,ce,ye),a>0){{let He=$.clone().add(K).multiplyScalar(.5),_e=x.clone().sub(He).normalize(),B=b.clone().sub(He).normalize().add(_e).normalize().multiplyScalar(-1),me=ve.clone().sub(fe);X(He,me,B,M.angle())}let Me,Ne;{let He=new _;Ev(A,ke,He);let _e=ve.clone().add(re).multiplyScalar(.5);_e=ree(_e,K,x);let Re=ve.clone().sub(re);[Me,Ne]=X(_e,Re,He,D,re.y)}{let He=Me,_e=He.clone().setY(0).normalize(),Re=new _(0,-1,0),B=_e.clone().cross(Re);ae(He,_e,Re,B)}G.concat(Ne);{let He=M.angle(),_e=Math.PI-He,Re=x.clone();Re.y-=a/Math.sin(He-Math.PI/2);let B=new _,me=[];for(let et=0;et<o;et++){let Ge=[],z=Math.PI/2-_e*et/o,O=Math.cos(z),q=Math.sin(z),J=oe;for(let le=0;le<=et;le++){let xe=Math.cos(J),Fe=Math.sin(J);ee.x=O*Fe,ee.y=q,ee.z=O*xe,B.copy(Re).addScaledVector(ee,a),c.push(B.x,B.y,B.z),u.push(ee.x,ee.y,ee.z),d.push(0,0),Ge.push(h++),J+=Math.PI*2/et/n}me.push(Ge)}Ne.reverse(),me.push(Ne);let W=me.length-1;for(let et=0;et<W;et++){let Ge=me[et],z=me[et+1],O=Ge.length-1;l.push(z[1],Ge[0],z[0]);for(let q=1;q<=O;q++)l.push(Ge[q],Ge[q-1],z[q]),l.push(z[q+1],Ge[q],z[q])}}}}}this.setIndex(l),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(u,3)),this.setAttribute("uv",new Ve(d,2));function X(ee,$,K,re,fe){let ve=-re/2,de=(Math.PI-re)/2,Se=$.clone().normalize().cross(K);ee.addScaledVector(K,-a/Math.sin(de));let oe=new _,be=new _,Oe=1,Le=h,ke=[];for(let Ce=0;Ce<=o;Ce++){let ce=ve+Ce/o*re;be.set(0,0,0),be.addScaledVector(Se,Math.sin(ce)),be.addScaledVector(K,Math.cos(ce));for(let ye=0;ye<=Oe;ye++){let Me=ye/Oe-.5;if(oe.copy(ee),oe.addScaledVector($,Me),oe.addScaledVector(be,a),fe!=null){let Ne=Math.max(0,oe.y-fe);oe.addScaledVector($,-Ne/$.y)}c.push(oe.x,oe.y,oe.z),u.push(be.x,be.y,be.z),d.push(0,0),ye===0&&ke.push(h),h++}}for(let Ce=0;Ce<o;Ce++)for(let ce=0;ce<Oe;ce++){let ye=Le+ce+(Oe+1)*Ce,Me=ye+(Oe+1),Ne=Me+1,He=ye+1;l.push(ye,Me,He),l.push(Me,Ne,He)}return[ee.clone().addScaledVector($,.5),ke]}function ae(ee,$,K,re){let fe=Math.PI/2,ve=w.angle()-fe,de=[],Se=new _,oe=new _;for(let Oe=0;Oe<=o;Oe++){let Le=[],ke=Oe/o;for(let Ce=0;Ce<=Oe;Ce++){let ye=((Oe?Ce/Oe:0)-.5)*v,Me=Math.cos(ye),Ne=Math.sin(ye),He=Math.atan(Math.tan(ve)*Me),_e=(fe+He)*ke,Re=Math.cos(_e),B=Math.sin(_e);Se.set(0,0,0),Se.addScaledVector($,B*Me),Se.addScaledVector(K,Re),Se.addScaledVector(re,B*Ne),oe.copy(ee).addScaledVector(Se,a),c.push(oe.x,oe.y,oe.z),u.push(Se.x,Se.y,Se.z),d.push(0,0),Le.push(h++)}de.push(Le)}let be=de.length-1;for(let Oe=0;Oe<be;Oe++){let Le=de[Oe],ke=de[Oe+1],Ce=Le.length-1;l.push(Le[0],ke[1],ke[0]);for(let ce=1;ce<=Ce;ce++)l.push(Le[ce-1],Le[ce],ke[ce]),l.push(Le[ce],ke[ce+1],ke[ce])}}}}});var Vf,Mv=F(()=>{"use strict";hc();pc();Vf=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),n=Object.assign(t?.ui??{enabledIndieCorners:!1},i.ui);return{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)}),ui:n}}static build(i){let t=i.shape,{width:e,height:n,cornerRadius:r,cornerType:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}=i.parameters,c={x:e*.5,y:n*.5},u={x:-c.x,y:-c.y},d={x:c.x,y:c.y};function h(x,S,E){return S>e&&E>n?Math.min(x*e/S,x*n/E):S>e?x*e/S:E>n?x*n/E:x}let p=[];p[0]=r[0]===0?0:h(r[0],r[0]+r[3],r[0]+r[1]),p[1]=r[1]===0?0:h(r[1],r[1]+r[2],r[1]+r[0]),p[2]=r[2]===0?0:h(r[2],r[2]+r[1],r[2]+r[3]),p[3]=r[3]===0?0:h(r[3],r[3]+r[0],r[3]+r[2]);let f=u.x,m=d.x,g=d.y,y=u.y;t.addPoint(t.createPoint(f,g)),t.addPoint(t.createPoint(m,g)),t.addPoint(t.createPoint(m,y)),t.addPoint(t.createPoint(f,y)),t.isClosed=!0;let v=!0;for(let x=0,S=t.points.length;x<S;x++)t.points[x].roundness=p[x],x>0&&p[x]!==p[x-1]&&(v=!1);v&&(t.roundness=p[0]),t.useCubicForRoundedCorners=s!==1,t.update();let b=As.create({shape:t,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(b,{userData:{...i,type:"RectangleGeometry"}})}}});var oV,g2=F(()=>{"use strict";Y();oV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},i.parameters);return e.thetaLength=we.clamp(e.thetaLength,0,180),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t=100,height:e=t,depth:n=t,widthSegments:r=64,heightSegments:s=64,phiStart:a,phiLength:o,thetaStart:l,thetaLength:c}=i.parameters,u;return c===0?(u=new De,u.setAttribute("position",new Ve([],3))):u=new ss(.5*t,r,s,a,o,l,c*we.DEG2RAD),u.scale(1,e/t,n/t),Object.assign(u,{userData:{...i,type:"SphereGeometry"}})}}});var lV,y2=F(()=>{"use strict";Y();lV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:0})}}static build(i){let{width:t=100,height:e=t,widthSegments:n=8,heightSegments:r=8}=i.parameters,s=new ci(t,e,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...i,type:"PlaneGeometry"}})}}});var cV,v2,b2=F(()=>{"use strict";Y();cV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,angle:r,cornerRadius:s,cornerSegments:a}=i.parameters,o=new v2(t,e,n,r,s,a);return Object.assign(o,{userData:{...i,type:"BackdropGeometry"}})}},v2=class extends De{constructor(t=1,e=1,n=1,r=90,s=10,a=24){super(),this.type="BackdropGeometry";let o=[],l=[],c=[],u=.001;s==0&&(a=1),a=Math.max(1,Math.floor(a)),s=Math.min(s,100),r=Math.min(180-u,r),r*=Math.PI/180;let d=[],h=Math.PI/2,p=(oe=0,be=0,Oe=0)=>new _(oe,be,Oe),f=p(),m=p(),[g,y,v]=[e/2,t/2,n/2],b=-y,x=+y,[S,E,M]=[p(b,-g,+v),p(b,-g,-v),p(b,+g,-v)],w=(oe,be=!1)=>Math.sin(oe-Math.PI/(1+ +be)),T=(oe,be=!1)=>Math.cos(oe-Math.PI/(1+ +be));M.y=Math.sin(r)*e-g;let A=Math.cos(r)*e-v,C=S.z-u;r<=h?(M.z=Math.min(A,C),M.z==C&&(M.y-=(A-C)/Math.tan(h-r))):E.z=Math.min(E.z-A-v,S.z-u),f.subVectors(S,E),m.subVectors(M,E);let P=Math.min(f.length(),m.length())*s/100,D=P*Math.tan(r/2),I=P/Math.cos(r/2),L=f.clone().normalize().add(m.normalize()).setLength(I).add(E);f.set(0,w(r,!0),T(r,!0)),d.push([M,f.clone()]);let U=(Math.PI-r)/a;for(let oe=0;oe<=a;oe++){let be=h+r+oe*U;f.set(0,Math.sin(be)*D,Math.cos(be)*D),f.add(L),m.set(0,w(be),T(be)),d.push([f.clone(),m.clone()])}d.push([S,p(0,1,0)]);let G=Math.sin(U/2)*D*2,X=d.length-1,ae=d[0][0].distanceTo(d[1][0]),ee=d[X-1][0].distanceTo(d[X][0]),$=ae+G*a+ee;d[0].push(1);for(let oe=0;oe<=a;oe++)d[oe+1].push(1-(ae+oe*G)/$);d[X].push(0);let[K,re,fe]=d[0],ve,de,Se;for(let oe=1;oe<d.length;oe++)[ve,de,Se]=d[oe],o.push(b,K.y,K.z,b,ve.y,ve.z,x,K.y,K.z,x,K.y,K.z,b,ve.y,ve.z,x,ve.y,ve.z),l.push(0,re.y,re.z,0,de.y,de.z,0,re.y,re.z,0,re.y,re.z,0,de.y,de.z,0,de.y,de.z),c.push(0,fe,0,Se,1,fe,1,fe,0,Se,1,Se),[K,re,fe]=[ve,de,Se];this.setAttribute("position",new Ve(o,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(c,2))}}});var yw,vw=F(()=>{"use strict";hc();pc();yw=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}=i.parameters,u=i.shape,d=t*.5,h=e*.5,p=0,f=0,m=a*Math.PI/360/r,g=Math.PI/2*3*-1,y=d*n/100,v=h*n/100;if(r===3&&n===50){m=2*Math.PI/r;for(let x=0;x<r;x++){let S=m*x,E=p+Math.sin(S)*d,M=f+Math.cos(S)*h;u.addPoint(u.createPoint(E,M))}}else for(let x=0;x<r;x++){let S=p+Math.cos(g)*d,E=f+Math.sin(g)*h;u.addPoint(u.createPoint(S,E)),g+=m,S=p+Math.cos(g)*y,E=f+Math.sin(g)*v,u.addPoint(u.createPoint(S,E)),g+=m}u.isClosed=!0;for(let x=0,S=u.points.length;x<S;x++)u.points[x].roundness=s;u.roundness=s,u.update();let b=As.create({shape:u,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(b,{userData:{...i,type:"StarGeometry"}})}}});var uV,x2=F(()=>{"use strict";Y();uV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e}=i.parameters,n=new ci(t,e);return Object.assign(n,{userData:{...i,type:"TextFrameGeometry"}})}}});function iee(i,t,e,n,r,s,a,o,l,c,u){[t,e]=[e,t],a=t/2;let d=we.clamp(r/360,0,1);if(d===0){let h=new De;return h.setAttribute("position",new Ve([],3)),h}return d===1&&(c=0),new ov(!0,i,t,e,n,d,s,a,o,l,c,u)}var dV,S2=F(()=>{"use strict";Y();Cf();dV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width);e.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(e.depth??e.width*.25));return{parameters:Object.assign(e,{width:n,height:r,depth:s})}}static build(i){let{width:t,height:e,depth:n,radialSegments:r,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=i.parameters,c=iee(t,e,n,t*.5,a,s,0,0,r,o,l);return c.scale(1,e/t,1),Object.assign(c,{userData:{...i,type:"TorusGeometry"}})}}});var hV,w2=F(()=>{"use strict";Y();hV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width),tube:e.tube??e.width*.125})}}static build(i){let{width:t,tube:e,tubularSegments:n,radialSegments:r,p:s,q:a}=i.parameters,o=t*.5;o!==e&&(o-=e);let l=new wd(o,e,n,r,s,a);return Object.assign(l,{userData:{...i,type:"TorusKnotGeometry"}})}}});var pV,E2=F(()=>{"use strict";hc();pc();pV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof vn?i.shape:new vn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width*(e.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t=100,height:e,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,isRect:o}=i.parameters,l=i.shape,c=t*.5,u=e*.5;o?(l.addPoint(l.createPoint(-c,u)),l.addPoint(l.createPoint(c,-u)),l.addPoint(l.createPoint(-c,-u))):(l.addPoint(l.createPoint(0,u)),l.addPoint(l.createPoint(c,-u)),l.addPoint(l.createPoint(-c,-u))),l.isClosed=!0;for(let h=0,p=l.points.length;h<p;h++)l.points[h].roundness=n;l.roundness=n,l.update();let d=As.create({shape:l,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a}});return Object.assign(d,{userData:{...i,type:"TriangleGeometry"}})}}});var fV=F(()=>{"use strict"});var hEe,pEe,fEe,mEe,gEe,yEe,vEe,mV=F(()=>{"use strict";Y();hEe=new nr,pEe=new ne,fEe=new Wi,mEe=new _,gEe=new _,yEe=new _,vEe=new _});function gV(){let i=new De;return i.setAttribute("position",new je(new Float32Array([]),3)),i.setIndex(new je(new Uint16Array([]),1)),i}function uee(i,t,e,n){let r=typeof i.width=="string"?Number(n.getVariable(i.width)):i.width,s=[""],a="";for(let o of e)a+=o,o===" "||o===`
4133
4133
  `?(s[s.length-1]+=a,a="",o===`
4134
- `&&s.push("")):t.getTextWidth(s[s.length-1]+a,i)>r&&(s[s.length-1].length&&s.push(""),t.getTextWidth(s[s.length-1]+a,i)>r&&(a.length===1?(s[s.length-1]+=a,a=""):(s[s.length-1]+=a.slice(0,-1),a=a[a.length-1],s.push(""))));return s[s.length-1]+=a,s}var oee,lee,cee,zf,M2=F(()=>{"use strict";mi();ft();Qd();Y();mf();hc();pc();oee=gV().attributes,lee=12,cee=1,zf=class extends De{constructor(e,n){super();this.isTextGeometry=!0;this.charWidths=[];this.charCoords=[];this.wrappedText=[];this.isLowResolution=!1;this.vectorShapes=[];Object.assign(this.attributes,oee),this.userData={parameters:e,type:"TextGeometry"};let r=n.getFont(e.font);r?.isLoaded?(this.font=r,this.update(e,n)):this.updateFont(e.font,n).then(()=>{this.update(e,n),n?.requestRender()})}async updateFont(e,n){let r=n.getFont(e);r&&(this.font=r,await r.loadingPromise)}update(e,n){let r=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!r?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:s,height:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,text:u,textTransform:d}=e,h=Mr.getDisplayedValue(u),p=d===2?h.toUpperCase():d===3?h.toLowerCase():h,f=uee(e,r,p,n),{shapes:m,charWidths:g,charCoords:y}=r.generateShapes(f,e,n),v=(typeof s=="number"?s:Number(n.getVariable(s)))*.5,b=(typeof a=="number"?a:Number(n.getVariable(a)))*.5,x=m.map(M=>new vn().fromShape(M,!0));this.vectorShapes=x;let S=x.map(M=>As.create({shape:M,parameters:{depth:o,extrudeBevelSegments:c,extrudeBevelSize:l,windingRule:o<=0?ln.NONZERO:ln.ODD,subdivisions:this.isLowResolution&&o>0?cee:lee}})),E=S.length?ro(S):gV();E.translate(-v,b,0),this.dispose(),this.wrappedText=f,this.charCoords=y,this.charWidths=g,this.deleteAttribute("extrudeNormal"),Object.entries(E.attributes).forEach(([M,w])=>{this.setAttribute(M,w)}),this.setIndex(E.index),this.computeBoundingSphere()}clone(){let e=fi(new De,zf.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([n,r])=>{this.setAttribute(n,r)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,n){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},n)}get text(){return this.userData.parameters.text??""}}});function bV(i){if(yV)return;if(bw)return bw;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.11/build"),s=import("./process.js"),[a,o]=await Promise.all([s,fetch(`${n}/process.wasm`).then(u=>u.arrayBuffer())]),l=a.default,c=await l({wasmBinary:o});vV(c),yV=!0}return bw=t(),bw}var vV,xw,yV,bw,_v=F(()=>{xw=new Promise(i=>{vV=i}),yV=!1});function Sw(i,t){if(Object.keys(i.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let e=Object.keys(i.attributes),n=Object.keys(t.attributes);if(e.length!==n.length)return!1;for(let o of n){let l=i.attributes[o],c=t.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||c.isInterleavedBufferAttribute===!0||l.itemSize!==c.itemSize||l.normalized!==c.normalized||l.array.constructor!==c.array.constructor||l.array.length!==c.array.length)return!1}let r=i.index,s=t.index;if(r===null!=(s===null))return!1;let a=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let o=r.array.constructor,l=s.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;a=!0}}if(i.groups.length!==t.groups.length)return!1;for(let o=0;o<t.groups.length;o++){let l=i.groups[o],c=t.groups[o];if(l.start!==c.start||l.count!==c.count||l.materialIndex!==c.materialIndex)return!1}for(let o of n){let l=i.attributes[o],c=t.attributes[o];l.array.set(c.array),l.needsUpdate=!0}if(r!==null&&s!==null){if(a){let o=r.array,l=s.array;for(let c=0,u=l.length;c<u;c++){let d=l[c];o[c]=d===65535?4294967295:d}}else r.array.set(s.array);r.needsUpdate=!0}return i.drawRange.start=t.drawRange.start,i.drawRange.count=t.drawRange.count,i.userData=t.userData,i.boundingBox=null,i.boundingSphere=null,!0}function Tv(i,t,e,n){let r=i.position.array,s=i.normal.array,a=dee.makeScale(t,e,n).invert().elements,o,l,c;for(let u=0,d=r.length;u<d;u+=3)r[u]*=t,r[u+1]*=e,r[u+2]*=n,o=s[u],l=s[u+1],c=s[u+2],s[u]=a[0]*o+a[4]*l+a[8]*c,s[u+1]=a[1]*o+a[5]*l+a[9]*c,s[u+2]=a[2]*o+a[6]*l+a[10]*c;i.position.needsUpdate=!0,i.normal.needsUpdate=!0}var dee,_2=F(()=>{"use strict";Y();dee=new ne});function Mw(i){let t=Object.keys(i);return t.length===1&&t[0]==="subdivisions"}function Av(i,t){let e=t?t.count:i.count,n=0,r=1e4,s=new Map,a=new Uint32Array(e),o=[];for(let u=0;u<e;u++){let d=t?t.getX(u):u,h=i.getX(d),p=i.getY(d),f=i.getZ(d),m=Math.round(h*r),g=Math.round(p*r),y=Math.round(f*r),v=s.get(m);v===void 0&&(v=new Map,s.set(m,v));let b=v.get(g);b===void 0&&(b=new Map,v.set(g,b));let x=b.get(y);x===void 0&&(x=n++,b.set(y,x),o.push(h,p,f)),a[u]=x}let l=[],c=[];for(let u=0;u<a.length;u+=3)a[u]===a[u+1]||a[u]===a[u+2]||a[u+1]===a[u+2]||(l.push(a[u],a[u+1],a[u+2]),c.push(t?t.getX(u):u,t?t.getX(u+1):u+1,t?t.getX(u+2):u+2));return{positions:o,triIndices:l,triOriginals:c}}function hee(i,t,e,n,r){let s=[],a=[],o=r?e.getAttribute("uv"):void 0,l=o&&o.itemSize===2?[]:void 0,c=h=>{if(l){let p=r[h];l.push(o.getX(p),o.getY(p))}};if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let h=e.userData.shape.extractShapePointsToFlatArray([]),p=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&p<=24&&p%4===0&&e.userData.parameters.angle>=360){let g=h.length/2/p;h=h.filter((y,v)=>Math.floor(v/2)%g===0)}let f=0;for(let g=0;g<h.length;g+=2)f+=(h[g]-h[(g===0?h.length:g)-2])*(h[g+1]+h[(g===0?h.length:g)-1]);i.length=0;let m=0;if(f<0)for(let g=0;g<h.length;g+=2)i.push(h[g],h[g+1],0),s.push(m++);else for(let g=h.length-2;g>=0;g-=2)i.push(h[g],h[g+1],0),s.push(m++);return a.push(m),{indices:s,verticesPerFace:a}}let u=new Float32Array([e.userData.parameters.depth])[0],d=0;for(;d<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let h=0;if((i[t[d]*3+2]===u||i[t[d]*3+2]===0)&&h++,(i[t[d+1]*3+2]===u||i[t[d+1]*3+2]===0)&&h++,(i[t[d+2]*3+2]===u||i[t[d+2]*3+2]===0)&&h++,h===3)break}if(t[d+1]===t[d+3]&&t[d+2]===t[d+5]||t[d+0]===t[d+3]&&t[d+2]===t[d+4]){Ew.set(i[t[d]*3],i[t[d]*3+1],i[t[d]*3+2]),T2.set(i[t[d+1]*3],i[t[d+1]*3+1],i[t[d+1]*3+2]),A2.set(i[t[d+4]*3],i[t[d+4]*3+1],i[t[d+4]*3+2]),C2.set(i[t[d+5]*3],i[t[d+5]*3+1],i[t[d+5]*3+2]),T2.sub(Ew).normalize(),A2.sub(Ew).normalize(),C2.sub(Ew).normalize();let h=T2.cross(A2).dot(C2),p=d;Math.abs(h)>.005||n&&n.some((f,m)=>m%2===1?!1:p>=n[m]&&p<n[m+1])?(s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),a.push(3),d+=3):(s.push(t[d],t[d+1],t[d+4],t[d+5]),c(d),c(d+1),c(d+4),c(d+5),a.push(4),d+=6)}else s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),a.push(3),d+=3}if(e.useNgonForTopBottomFaceDuringBake){let h=[],p=[],f=0;for(let m=0,g=0;m<i.length;m+=3,g++)i[m+2]===0&&(h.push(g),f++),i[m+2]===u&&p.push(g);if(e.userData.parameters.extrudeBevelSize===0){let m=p[0];p[0]=p[1],p[1]=m}h.reverse(),s.push(...h,...p),a.push(f,f),l=void 0}return{indices:s,verticesPerFace:a,uvs:l}}var ww,Gf,gt,xV,SV,wV,Xn,Ew,T2,A2,C2,Jd=F(()=>{"use strict";Y();_v();ft();Cv();_2();Cf();ww=new Bt,Gf=new _;xw.then(i=>{gt=i});xV=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),SV=new Uint32Array([0,1,2,3]),wV=new Uint8Array([4]),Xn=class extends De{constructor(e,n){super();this.data=e;this.flatShading=n;this.subdivPointer=0;this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,n){this.freeSubdivPointer();let r=this.data.scaleBaked.map(l=>typeof l=="number"?l:1),s=pa.div(n.map(l=>typeof l=="number"?l:0),r);if(s.every(l=>l===1))return;this.subdividedGeometry&&Tv(this.subdividedGeometry.attributes,...s),this.originalGeometry&&Tv(this.originalGeometry.attributes,...s),this.data=e;let a=this.userData.parameters;this.userData.parameters={width:a.width*s[0],height:a.height*s[1],depth:a.depth*s[2]},this.originalGeometry.boundingSphere.center.multiply(Gf.fromArray(s));let o=Gf.set(a.width,a.height,a.depth).length();this.originalGeometry.boundingSphere.radius=o/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let n=e.phongAngle??35;this.flatShading&&(n=-1);let r=null;if(e.subdivisions>0){let a=0;try{a=Xn.allocate(e),r=Xn.buildRefined(a,e.subdivisions,n)}catch(o){console.error(o,e)}finally{a&&Xn.freeSubdivPointer(a)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let s=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=s}rebuild(){let e,n,r;try{({originalGeometry:e,subdividedGeometry:n,subdivPointer:r}=Xn.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new ni(100,100,100),r=0}this.subdivPointer=r,this.originalGeometry=e,this.subdividedGeometry=n??void 0;let s=this.subdividedGeometry??this.originalGeometry;Object.assign(this,s),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Xn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new nr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let n=e.attributes.position,r=e.boundingSphere.center;ww.setFromBufferAttribute(n),ww.getCenter(r),e.boundingSphere.radius=r.distanceTo(ww.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ww.getSize(Gf);let s={width:Gf.x,height:Gf.y,depth:Gf.z};return this.userData.parameters=s,s}static build(e,n,r,s){let a,o,l=e?.phongAngle??35;r===!1&&(l=-1),n&&(gt.free_bvh(n),gt.free_subdivision_surface(n));try{a=Xn.allocate(e,s)}catch(u){console.error(u,e),a=Xn.allocate({positionWASM:xV,indexWASM:SV,verticesPerFaceWASM:wV},s)}gt.set_destination_refinement_level(a,0);let c=Xn.buildLevel(a,!0,l);return e.subdivisions>0?o=Xn.buildRefined(a,e.subdivisions,l):o=null,{subdivPointer:a,originalGeometry:c,subdividedGeometry:o}}static buildRefined(e,n,r){try{return gt.set_destination_refinement_level(e,n),Xn.buildLevel(e,!1,r)??null}catch{try{return gt.set_destination_refinement_level(e,n-1),Xn.buildLevel(e,!1,r)??null}catch{return null}}}static primitiveToQuads(e,n,r){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let s=e.shape!==void 0||e.path!==void 0?n.geometry:Aa(e,r,!1,n),a;W1(e)?a=s.getClosedTorusIndicesForBooleanOrSubdiv():a=s.getIndex();let{positions:o,triIndices:l,triOriginals:c}=Av(s.getAttribute("position"),a),u;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let f=e.radialSegments*e.heightSegments*3*2,m=f+e.radialSegments*3;u=[f,m]}let{indices:d,verticesPerFace:h,uvs:p}=hee(o,l,s,u,c);return{positions:o,indices:d,verticesPerFace:h,uvs:p}}static allocate(e,n){let r,s,a,o=[],l=[];e.positionWASM&&e.positionWASM.length>0?(r=e.positionWASM,s=e.indexWASM,a=e.verticesPerFaceWASM,gt.alloc_subdivision_surface_uvs&&e.uvWASM&&e.uvWASM.length===s.length*2&&(l=e.uvWASM)):(r=xV,s=SV,a=wV);let c=r.length,u=s.length,d=a.length,h=r.length+o.length+l.length,p=s.length+a.length,f=h*Float32Array.BYTES_PER_ELEMENT+p*Uint32Array.BYTES_PER_ELEMENT,m=h*Float32Array.BYTES_PER_ELEMENT,g=gt._malloc(f),y=new Float32Array(gt.HEAPF32.buffer,g,h),v=new Uint32Array(gt.HEAPU32.buffer,g+m,p);y.set(r,0),y.set(o,r.length),y.set(l,r.length+o.length),v.set(s,0),v.set(a,s.length);let b;e?.scaleBaked?.some(E=>E!==1)&&(b=new ne().makeScale(...e.scaleBaked.map(E=>typeof E=="number"?E:1))),n&&(b?b.premultiply(n):b=n);let x=g+(r.length+o.length)*Float32Array.BYTES_PER_ELEMENT,S=l.length?b?gt.alloc_subdivision_surface_uvs2(g,c,g+m,u,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d,x,l.length,b.elements):gt.alloc_subdivision_surface_uvs(g,c,g+m,u,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d,x,l.length):b?gt.alloc_subdivision_surface2(g,c,g+m,u,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d,b.elements):gt.alloc_subdivision_surface(g,c,g+m,u,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d);return gt._free(g),S}static buildLevel(e,n,r,s,a,o=!1){let l=a?gt.get_mesh_data2(e,n?gt.Level.CONTROL:gt.Level.REFINED,r,a.elements):gt.get_mesh_data(e,n?gt.Level.CONTROL:gt.Level.REFINED,r),c=10,u=gt.HEAPU32.subarray(l>>2,(l>>2)+c),d=u.subarray(4,4+4),h=0,p=gt.HEAPU32[u[h]>>2],f=gt.HEAPF32.subarray(p>>2,(p>>2)+d[h]);h++;let m=gt.HEAPU32[u[h]>>2],g=gt.HEAPF32.subarray(m>>2,(m>>2)+d[h]);h++;let y=gt.HEAPU32[u[h]>>2],v=gt.HEAPU32.subarray(y>>2,(y>>2)+d[h]);h++;let b=gt.HEAPU32[u[h]>>2],x=gt.HEAPU32.subarray(b>>2,(b>>2)+d[h]);h++;let S;if(gt.alloc_subdivision_surface_uvs){let M=u[9];if(M>0){let w=gt.HEAPU32[u[8]>>2];S=gt.HEAPF32.subarray(w>>2,(w>>2)+M)}}if(s===void 0){let M=new De;if(M.setIndex(new Vs(x,1)),M.setAttribute("position",new Ve(f,3)),M.setAttribute("normal",new Ve(g,3)),S&&M.setAttribute("uv",new Ve(S,2)),n){M.setAttribute("faceMap",new Vs(v,1));let w=new Float32Array(g.length/3*4).fill(0);M.setAttribute("color",new je(w,4))}return gt.free_mesh_data(l),M.userData.type="SubdivGeometry",M}if(s.getAttribute("position").copyArray(f),s.getAttribute("normal").copyArray(g),s.attributes.position.needsUpdate=!0,s.attributes.normal.needsUpdate=!0,o){let M=s.getIndex();M!==null&&M.array.length===x.length&&(M.copyArray(x),M.needsUpdate=!0)}let E=s.getAttribute("uv");S&&E&&E.array.length===S.length&&(E.copyArray(S),E.needsUpdate=!0),gt.free_mesh_data(l)}static freeSubdivPointer(e){gt.free_bvh(e),gt.free_subdivision_surface(e)}static buildControlCageWireframe(e,n,r){let s=gt.get_wireframe_data_for_base_level(e),a=4,o=gt.HEAPU32.subarray(s>>2,(s>>2)+a),l=o.subarray(2,2+2),c=0,u=gt.HEAPU32[o[c]>>2],d=gt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let h=gt.HEAPU32[o[c]>>2],p=gt.HEAPU32.subarray(h>>2,(h>>2)+l[c]);if(n===void 0){let f=new De;f.setAttribute("position",new Ve(d,3));let m=new Float32Array(d.length);for(let g=0,y=d.length;g<y;)m[g++]=r.r,m[g++]=r.g,m[g++]=r.b;return f.setAttribute("color",new je(m,3)),f.setIndex(new Vs(p,1)),gt.free_wireframe_data_for_base_level(s),f}n.getAttribute("position").copyArray(d),n.attributes.position.needsUpdate=!0,gt.free_wireframe_data_for_base_level(s)}static updateCollabMesh(e,n,r){let s=n===0;s||gt.set_destination_refinement_level(e,n);let a=r?gt.get_topological_data2(e,s?gt.Level.CONTROL:gt.Level.REFINED,r.elements):gt.get_topological_data(e,s?gt.Level.CONTROL:gt.Level.REFINED),o=8,l=gt.HEAPU32.subarray(a>>2,(a>>2)+o),c=l.subarray(3,3+3),u=0,d=gt.HEAPU32[l[u]>>2],h=new Float32Array(gt.HEAPF32.subarray(d>>2,(d>>2)+c[u]));u++;let p=gt.HEAPU32[l[u]>>2],f=new Uint32Array(gt.HEAPU32.subarray(p>>2,(p>>2)+c[u]));u++;let m=gt.HEAPU32[l[u]>>2],g=new Uint8Array(gt.HEAPU32.subarray(m>>2,(m>>2)+c[u])),y;if(gt.alloc_subdivision_surface_uvs){let v=l[7];if(v>0){let b=gt.HEAPU32[l[6]>>2];y=new Float32Array(gt.HEAPF32.subarray(b>>2,(b>>2)+v))}}return gt.free_topological_data(a),{positions:h,indices:f,verticesPerFace:g,uvs:y}}};Ew=new _,T2=new _,A2=new _,C2=new _});var P2,_w,I2=F(()=>{"use strict";GP();WP();pv();XP();Sv();Cf();c2();u2();h2();gw();m2();Mv();g2();y2();b2();vw();x2();S2();w2();E2();pc();Qt();GP();WP();pv();XP();Sv();fV();Cf();c2();u2();h2();gw();m2();Mv();g2();y2();b2();vw();x2();S2();w2();E2();pc();mV();l2();M2();Jd();_v();cv();P2={ConeGeometry:Mk,CubeGeometry:_k,CylinderGeometry:ow,DodecahedronGeometry:Tk,EllipseGeometry:Uf,HelixGeometry:WU,IcosahedronGeometry:nV,LatheGeometry:rV,NonParametricGeometry:sV,PolygonGeometry:mw,PyramidGeometry:aV,RectangleGeometry:Vf,SphereGeometry:oV,PlaneGeometry:lV,BackdropGeometry:cV,StarGeometry:yw,TextFrameGeometry:uV,TorusGeometry:dV,TorusKnotGeometry:hV,TriangleGeometry:pV,VectorGeometry:As},_w=i=>{let t=P2[i.type]??N1(i.type);if(t===void 0)throw new Error(`No geometry factory registered for "${i.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(i)}});function Aa(i,t,e,n){let r,s,a;i.type==="PathGeometry"?(s=JSON.parse(JSON.stringify(i)),a=[[],["extrusion"]]):(s={...i},a=[[]]);for(let c of a){let u=s;for(let d of c)u=u[d];for(r in u){let d=u[r];EC(d)&&!pee.includes(r)&&(u[r]=t.getVariable(d,[n.uuid,"geometry",...c,r]),EC(u[r])&&(u[r]=1))}}let o={parameters:s,type:s.type};if(s.type==="PathGeometry")o.path=s.path;else if(s.type==="VectorGeometry"){let c=vn.createFromState(s.shape,s.width,s.height);o.shape=c}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),o.geometry=new _d().parse(s),o.geometry.groups.length===0){let c=o.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else if(s.type==="SubdivGeometry"){let c=new Xn(s,e);return c.data=i,c}else if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=N1(s.type);if(c)return c.create(s,t);Jn("text",`a ${s.type}`);let u=vn.createFromState(zd.defaultData(),100,100);return _w({...s,shape:u,type:"VectorGeometry"})}else if(s.type==="UIGeometry")return Vf.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}});let l;try{l=_w(o)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${o}`);let u=vn.createFromState(zd.defaultData(),100,100);o.shape=u,o.type="VectorGeometry",l=_w(o)}return l}var pee,Cv=F(()=>{"use strict";ft();Y();I2();Qt();Mv();hc();Jd();pee=["font"]});var O2,Pv,EV=F(()=>{"use strict";Cv();O2=class{constructor(){this.objects=new Map;this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,n){let r=this.objects.get(t);return r===void 0?(r=this.createObject(t,e,n),this.objects.set(t,r)):r.isShared=!0,r}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let n=this.objects.get(t);if(n&&n.isShared!==!0)return this.objects.delete(t),this.objects.set(e,n),n}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){let n=this.objects.get(t);e===n?this.unreachable.delete(t):!1&&console.warn("Reachable but deleted",t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},Pv=class extends O2{constructor(e){super();this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,n,r){let s=Aa(e,n,this.flatShading,r);return s.computeBoundingSphere(),s}}});function AV(i){Tw=i}function jf(){return Tw}function CV(i){R2=i}function PV(){if(Tw==="webgpu"){if(MV!==void 0)return MV;_V||(_V=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(R2===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return R2}function Aw(i,t){return PV().createRootMaterial(i,t)}function L2(i,t,e){return PV().createSharedMaterial(i,t,e)}function N2(i){return i.getLayersOfType===void 0&&Object.assign(i,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),i}function OV(i){IV=i}function RV(){let i=Tw==="webgpu"&&TV!==void 0?TV:IV;return i===void 0?null:N2(i())}function Cw(){return fee}function DV(i){D2=i}function LV(i,t){return D2===void 0?!1:D2(i,t)}var Tw,MV,R2,_V,TV,IV,fee,D2,fc=F(()=>{Tw="webgl",_V=!1});var NV,BV=F(()=>{"use strict";NV={markNeedsUpdateRendererDirty:()=>{}}});function Ko(i,t){let e=0;if(!i.layers||i.layers.length===0)return!1;let n=i.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(t.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of i.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let a of r.data.colors)if(a[3]<1){s=a[3];break}}else if(s===1&&r.data.type==="noise"){let a=t.color(r.data.colorA).a,o=t.color(r.data.colorB).a,l=t.color(r.data.colorC).a,c=t.color(r.data.colorD).a,u=Math.min(a,Math.min(o,Math.min(l,c)));u<1&&(s=u)}e+=(1-e)*s}}return e<1}var Pw=F(()=>{"use strict"});function B2(i){let t=typeof i=="string"?i:i.type;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function lo(i){return typeof i=="string"||typeof i=="number"&&i!==0}var Ca,Qe,Hf,FV,Zo=F(()=>{"use strict";Ca=(i,t,e)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof i=="number"?i*100:i,e)??100)/100))??1,Qe=(i,t,e)=>typeof i=="number"?i:t.getVariable(i,e);Hf={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"]},FV={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}});var F2,mee,Yr,eh=F(()=>{"use strict";Y();Ef();F2=class extends wf(Zt){},mee=i=>i.type==="Mesh",Yr=class extends F2{constructor(e){super();this.object=e;this.isClone=!0;this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,n){}expand(){let e=0,n=this.object.entityChildren(e);for(;n;){let r=this.children[e];r?.object!==n&&(r&&this.remove(r),r=new Yr(n),this.add(r),this.children.splice(e,0,this.children.pop()),r.matrixWorldNeedsUpdate=!0,r.matrixAutoUpdate=!1,r.matrix=n.matrix,r.hiddenMatrix=n.hiddenMatrix,r.pivotMatrix=n.pivotMatrix),r.expand(),e+=1,n=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let e=this.object.cloner;return e!==void 0&&this.parent===e&&(e.instancingActive||e.insideBoolean)?!1:this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return mee(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}}});function VV(i){UV=i}function U2(){return UV}function zV(i){kV=i}function GV(){return kV}var UV,kV,Iw=F(()=>{"use strict";UV=null,kV=null});function Ow(i){return"variable_"+i}var jV,HV,WV,vee,qV,k2,V2,_u,uTe,Rw=F(()=>{"use strict";ft();LP();kP();rw();Ta();sw();aw();EV();fc();FP();BV();Pw();Zo();Yi();eh();an();Y();Iw();Qt();jV=new ne,HV=new _,WV=new qe,vee=new _,qV=new Xt,k2=class extends tw{constructor(e){super();this.shared=e}create(e){return new If(e,this.shared)}},V2=class{constructor(t,e={},n=!0,r=!1){this.data=t;this.needsJitter=n;this.enableLocalStorageForPersistentVariables=r;this.geometryCache=new Pv(!0);this.geometryCache2=new Pv(!1);this.imageHolderCache=new k2(this);this.thisContext={scene:NV,shared:this};this.deletedImage=new Ks(E1.emptyImage,this);this.deletedVideo=new Ks(Zp.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;if(e.images)for(let[s,a]of Object.entries(e.images))this.addImage(s,a);if(e.videos)for(let[s,a]of Object.entries(e.videos))this.addVideo(s,a);if(e.audios)for(let[s,a]of Object.entries(e.audios))this.addAudio(s,a);if(e.particles)for(let[s,a]of Object.entries(e.particles))this.addParticle(s,a);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=L2(An.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,n=!1){this.data=t,this.resetLib(t.lib);for(let{id:r,data:s}of t.variables)this.addVariableHolder(r,s),e&&this.updateVariableHolder(r,s);for(let[r,s]of Object.entries(t.userAPIs??{}))this.addUserAPI(r,s);for(let[r,s]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(r,s);if(!n){for(let[r,s]of Object.entries(t.images))this.addImage(r,s);for(let[r,s]of Object.entries(t.videos))this.addVideo(r,s)}for(let[r,s]of Object.entries(t.colors))this.addColor(r,s);for(let[r,s]of Object.entries(t.lib.materials))this.addMaterial(r,s.asset);for(let[r,s]of Object.entries(t.materials))this.addMaterial(r,s);for(let[r,s]of Object.entries(t.audios))this.addAudio(r,s);for(let[r,s]of Object.entries(t.particles))this.addParticle(r,s);for(let[r,s]of Object.entries(t.fonts))this.addFont(r,s);for(let[r,s]of Object.entries(t.timelineAnimations??{}))this.addAnimation(r,s)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:An.defaultTwoLayerData("phong").layers}),this.materials[t]){let n=this.materials[t];n.reset(e,this.thisContext),n.dispose()}else{let n=L2(e,this.thisContext,t);this.materials[t]=n}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){let e=this.materials[t];return e}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:An.defaultTwoLayerData("phong").layers}),Aw(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Ks(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Ks(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Ks(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new uc(e.r,e.g,e.b,e.a):this.colors[t]=new uc(e.r,e.g,e.b,1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let n=this.colors[t];return this.colors[t].r=e.r??n.r,this.colors[t].g=e.g??n.g,this.colors[t].b=e.b??n.b,this.colors[t].a=e.a??n.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t=="string"){let n=this.getColor(t);n?e=n:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new yn(0,0,0,0))}else return"a"in t?new yn(t.r,t.g,t.b,t.a):new yn(t.r,t.g,t.b,1);return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof dc)return e;{let n=new dc({src:e.data});return this.audios[t]=n,n}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof dc&&e.dispose(),delete this.audios[t])}addFont(t,e){let n=wk();if(n===null){Jn("text","a font asset");return}this.fonts[t]=new n(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}addAnimation(t,e){this.timelineAnimations[t]=e}getAnimation(t){return this.timelineAnimations[t]}deleteAniamtion(t){this.timelineAnimations[t]&&delete this.timelineAnimations[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof dc&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let n=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let r=localStorage.getItem(Ow(t));n=r!==null?JSON.parse(r):e.value}return this.variables[t]={value:n,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(Ow(t),JSON.stringify(e));let n=e;for(;typeof n=="string";)n=this.variables[n].value;let r=this.entityOpContext.scene,s=!1;for(let a=this.variables[t].locations.length-1;a>=0;a--){let o=this.variables[t].locations[a];if(o[0]==="material"){let l=o[1],c=n,u={scene:r,shared:this},d=o.slice(2);r.traverseMaterial(p=>{let f=p.root??p;f.uuid===l&&f.onVariableUpdate(d,c,u)});let h=this.materials[l];h&&h.onVariableUpdate(d,c,u)}else{let l=r.find(o[0]);if(l===void 0){this.variables[t].locations.splice(a,1);continue}if(s=!0,o[1]!=="geometry"&&o[1]!=="particles"){for(let c=1;c<o.length-1;c++)l=l[o[c]];o[1]==="rotation"?l[o[o.length-1]]=n*we.DEG2RAD:l[o[o.length-1]]=n}if(l=r.find(o[0]),l.type==="ParticleEmitter"&&l.updateVariableState(n,o),Dt.is(l))if(o[1]==="position"||o[1]==="rotation"||o[1]==="scale")l.onVariableUpdate();else if(o[1]==="geometry"){let c=l;l.component&&(c=l.component);let u=c.dataPatched;c.chooseGeoemtryCache(this).forceDelete(u.geometry),c.createGeometryDelayed(this.entityOpContext),c.onVariableUpdate(!0),c.invalidateDownstreamBooleanData(),c.instances.forEach(d=>{let h=d.dataPatched;d.chooseGeoemtryCache(this).forceDelete(h.geometry),d.createGeometryDelayed(this.entityOpContext),d.onVariableUpdate(!0),d.invalidateDownstreamBooleanData()})}else o[1]==="morphTargetInfluences"&&l.updateMorphInfluences(o[2],n)}}return s&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||typeof s.type!="string"||s.type==="VectorGeometry"||s.type==="PathGeometry")return!1;let a=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),o=new Map;for(let u of Object.keys(s))o.set(a(u),u);let l={};for(let[u,d]of Object.entries(e??{})){let h=o.get(a(u));if(h===void 0||h==="type"||h==="font"||h==="shape"||h==="path"||h==="data")continue;if(h==="text"){(typeof d=="string"||typeof d=="number")&&(l[h]={textValue:String(d)});continue}let p=s[h];typeof d=="number"&&isFinite(d)&&(typeof p=="number"||typeof p=="string")&&(l[h]=d)}if(Object.keys(l).length===0)return!1;let c={...s,...l};return n.dataPatched={...r,geometry:c},this.transientGeometryKeys.has(s)&&n.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(c),n.createGeometryDelayed(this.entityOpContext),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let r=e.dataPatched?.geometry;return!r||!this.transientGeometryKeys.has(r)?!1:(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(r),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0)}updateEntityGeometryVertices(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||s.type!=="NonParametricGeometry")return!1;let a=e?.vertices;if(a===void 0||typeof a.length!="number"||a.length<9||a.length%3!==0||a.length/3>V2.MAX_TRANSIENT_VERTICES)return!1;let o=a instanceof Float32Array?a:Float32Array.from(a),l=o.length/3,c;if(e.normals!==void 0){if(e.normals.length!==o.length)return!1;c=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}let u;if(e.uvs!==void 0){if(e.uvs.length!==l*2)return!1;u=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}let d;if(e.indices!==void 0){let E=l>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(E.length===0||E.length%3!==0)return!1;for(let M=0;M<E.length;M++)if(E[M]>=l)return!1;d={array:E,itemSize:1,type:E.constructor.name,normalized:!1}}else{let E=s.data,M=E?.index;if(M?.array?.length){let w=(E?.attributes?.position?.array?.length??0)/3;if(l<w){let T=M.array;for(let A=0;A<T.length;A++)if(T[A]>=l)return!1}d=M}}let h=1/0,p=1/0,f=1/0,m=-1/0,g=-1/0,y=-1/0;for(let E=0;E<o.length;E+=3){let M=o[E],w=o[E+1],T=o[E+2];M<h&&(h=M),M>m&&(m=M),w<p&&(p=w),w>g&&(g=w),T<f&&(f=T),T>y&&(y=T)}let v=(E,M)=>({array:E,itemSize:M,type:"Float32Array",normalized:!1}),b={position:v(o,3)};c&&(b.normal=v(c,3)),u&&(b.uv=v(u,2));let x={...s,width:m-h,height:g-p,depth:y-f,data:{attributes:b,...d?{index:d}:{}}},S=this.transientGeometryKeys.has(s);return n.dataPatched={...r,geometry:x},this.transientGeometryKeys.add(x),n.applyTransientGeometryData(this.entityOpContext,S),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let n=t;n.component&&(n=n.component);let r=n.cloner;if(r===void 0)return-1;let s=r.children,a=Math.PI/180,o=!1;if(e===null)for(let l of s)l.transformOverride!==void 0&&(l.transformOverride=void 0,o=!0);else if(Array.isArray(e)){let l=Math.min(e.length,s.length);for(let c=0;c<l;c++){let u=e[c],d=s[c];if(u==null){d.transformOverride!==void 0&&(d.transformOverride=void 0,o=!0);continue}let h=d.transformOverride??{position:[d.position.x,d.position.y,d.position.z],rotation:[d.rotation.x,d.rotation.y,d.rotation.z],scale:[d.scale.x,d.scale.y,d.scale.z]};u.position&&(typeof u.position.x=="number"&&(h.position[0]=u.position.x),typeof u.position.y=="number"&&(h.position[1]=u.position.y),typeof u.position.z=="number"&&(h.position[2]=u.position.z)),u.rotation&&(typeof u.rotation.x=="number"&&(h.rotation[0]=u.rotation.x*a),typeof u.rotation.y=="number"&&(h.rotation[1]=u.rotation.y*a),typeof u.rotation.z=="number"&&(h.rotation[2]=u.rotation.z*a)),u.scale&&(typeof u.scale.x=="number"&&(h.scale[0]=u.scale.x),typeof u.scale.y=="number"&&(h.scale[1]=u.scale.y),typeof u.scale.z=="number"&&(h.scale[2]=u.scale.z)),d.transformOverride=h,d.position.fromArray(h.position),d.rotation.fromArray(h.rotation),d.scale.fromArray(h.scale),d.updateMatrix(),d.hasNonUniformScale&&(d.updateMatrixWorld(),d.updateMatrixWorldRigid())}}else return s.length;return o?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(n),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),s.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let n=t.parent;if(n===null)return;let r=new Yr(t);r.playModeVisible=e.visible!==!1,r.expand(),typeof e.name=="string"&&(r.name=e.name);let s=Math.PI/180;return r.position.copy(t.position),r.rotation.copy(t.rotation),r.scale.copy(t.scale),r.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(r.position.x=e.position.x),typeof e.position.y=="number"&&(r.position.y=e.position.y),typeof e.position.z=="number"&&(r.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(r.rotation.x=e.rotation.x*s),typeof e.rotation.y=="number"&&(r.rotation.y=e.rotation.y*s),typeof e.rotation.z=="number"&&(r.rotation.z=e.rotation.z*s)),e.scale&&(typeof e.scale.x=="number"&&(r.scale.x=e.scale.x),typeof e.scale.y=="number"&&(r.scale.y=e.scale.y),typeof e.scale.z=="number"&&(r.scale.z=e.scale.z)),r.updateMatrix(),n.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let n=t.material;if(!n)return!1;let r=[];for(let u of Array.isArray(n)?n:[n]){let d=u.root??u;d&&Array.isArray(d.layers)&&d.data&&!r.includes(d)&&r.push(d)}if(r.length===0)return!1;let s={scene:this.entityOpContext.scene,shared:this},a=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),o=u=>{if(typeof u=="string"){let d=new yn(1,1,1,1);try{d.set(u)}catch{return null}return{r:d.r,g:d.g,b:d.b,a:void 0}}if(u&&typeof u=="object"&&"r"in u){let d=u;if([d.r,d.g,d.b].some(p=>typeof p!="number"||!isFinite(p)))return null;let h=Math.max(d.r,d.g,d.b)>1?1/255:1;return{r:d.r*h,g:d.g*h,b:d.b*h,a:typeof d.a=="number"?Math.max(0,Math.min(d.a,1)):void 0}}return null},l=(u,d,h)=>{if(!u.hasValue(d))return!1;let p=u.getValue(d);if(!p||typeof p!="object"||!p.isColor)return!1;let f=h.a??(typeof p.a=="number"?p.a:1);return p instanceof uc?u.setValue(d,new yn(h.r,h.g,h.b,f)):typeof p.setRGBA=="function"?p.setRGBA(h.r,h.g,h.b,f):p.setRGB(h.r,h.g,h.b),!0},c=!1;for(let u of r){let d=u.data.layers??[],h=p=>u.layers.find(f=>f.uuid===p);if(e.color!==void 0){let p=o(e.color),f=d.find(g=>g.data.type==="color"),m=f&&h(f.id);if(p&&m&&l(m,"color",p)&&(c=!0,p.a!==void 0)){let g=p.a<1?!0:Ko(u.data,this);u.setTransparent?u.setTransparent(g,s.scene):u.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(u.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),s),c=!0);for(let p of e.layers??[]){if(!p||typeof p!="object")continue;let f=typeof p.id=="string"?d.find(v=>v.id===p.id):typeof p.index=="number"?d[p.index]:typeof p.type=="string"?d.find(v=>v.data.type===p.type):void 0,m=f&&h(f.id);if(!f||!m)continue;let g=Hf[f.data.type]??[],y=Object.keys(f.data);for(let[v,b]of Object.entries(p)){if(v==="id"||v==="index"||v==="type")continue;let x=y.find(E=>E===v)??y.find(E=>a(E)===a(v))??v;if(g.includes(x))continue;let S=o(b);if(S&&l(m,x,S)){c=!0;continue}if(typeof b=="number"&&isFinite(b))u.onVariableUpdate?.(["layer",f.id,x],b,s),c=!0;else if(Array.isArray(b)&&b.length<=3&&b.every(E=>typeof E=="number"&&isFinite(E))){let E=["x","y","z"];b.forEach((M,w)=>{u.onVariableUpdate?.(["layer",f.id,x,E[w]],M,s)}),c=!0}}}}return c&&this.requestRender(),c}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let n=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return n.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&n?.getPhysicsLocalMatrix?.(jV))return jV.decompose(HV,WV,vee),t[1]==="position"?HV[t[2]]:(qV.setFromQuaternion(WV,n.rotation.order),qV[t[2]]*we.RAD2DEG);for(let r=1;r<t.length;r++)n=n[t[r]];return t[1]==="rotation"&&(n*=we.RAD2DEG),n}for(let n in this.variables){if(e===void 0)break;let r=this.variables[n],s=r.locations?.findIndex(a=>rr.equal(a,e));s!==void 0&&s!==-1&&r.locations.splice(s,1)}if(typeof t=="string"){let n=t,r=t;do{if(r=n,this.variables[n]===void 0)break;let s=this.variables[n].value;e&&this.variables[r]!==void 0&&this.variables[r].locations.push(e),n=s}while(typeof n=="string");return n}else return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,n]of Object.entries(t.images))this.addImage(e,n.asset);for(let[e,n]of Object.entries(t.audios))this.addAudio(e,n.asset);for(let[e,n]of Object.entries(t.particles))this.addParticle(e,n.asset);for(let[e,n]of Object.entries(t.colors))this.addColor(e,n.asset);for(let[e,n]of Object.entries(t.fonts))this.addFont(e,n.asset);for(let[e,n]of Object.entries(t.videos))this.addVideo(e,n.asset);for(let[e,n]of Object.entries(t.variables))this.addVariableHolder(e,n.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,n){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(wr.drop(t,2),e.materials[t.path[1]],{shared:this,scene:n});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,n):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let r=e.userAPIs[t.path[1]];if(r){let s=t.type===0&&t.props.debounce===void 0,a=this.getUserAPI(t.path[1]);a!==void 0&&a===this.openAIRealtime?a.update(r):a?.update(r,this,s)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let r=e.userWebhooks[t.path[1]];r&&this.getUserWebhook(t.path[1])?.update(r)}}else t.path[0]==="lib"&&this.updateLibByOp(wr.drop(t,1),n)}updateFont(t,e,n){if(e.props.url){let r=this.getFont(t),s={...this.data.fonts[t],url:e.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),n.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let n=GV();return n===null?(Jn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=n(e,t,this),!1)}else{let n=U2();return n===null?(Jn("api-services","a user API integration"),!1):(this.userAPIs[t]=n.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let n=U2();return n===null?(Jn("api-services","a user webhook"),!1):(this.userWebhooks[t]=n.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}},_u=V2;_u.MAX_TRANSIENT_VERTICES=6e4;uTe=new _u(os.emptyData())});function Dw(i){return Zd(i)||i?.isTSLNodeMaterial===!0}function XV(i){return nk(i)||i?.isTSLSharedMaterial===!0}var z2=F(()=>{"use strict";Q1()});var _r,Tu=F(()=>{ft();gi();fc();z2();an();mi();_r=class extends Kt{setMaterialOverride(e,n){this.materialOverride=N2(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),n.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,n,r){if(super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.syncShadowCatcher(r),tB(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[s,a]of Object.entries(e.props)){let o=this.material[Number(s)],l=r.shared.material(a);l!==o&&_r.disposeOneMaterial(o),this.material[Number(s)]=l}else if($t(e.path,["material"])){let s=this.material;!Array.isArray(s)&&typeof s?.updateByOp=="function"&&"material"in n&&typeof n.material!="string"&&s.updateByOp(wr.drop(e,1),n.material,r)}else if($t(e.path,["materials","*"])&&Array.isArray(this.material)){let s=e.path[1];if("materials"in n&&s<this.material.length){let a=n.materials[s];typeof a!="string"&&this.material[s].updateByOp(wr.drop(e,2),a,r)}}}get needsAO(){return this.material!==void 0?(Array.isArray(this.material)?this.material[0]:this.material).hasAO:!1}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&!!this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):(this.layers.mask&1<<9)!==0&&this.layers.set(0)}updateState(e,n){super.updateState(e,n),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let r=this.dataPatched;this.syncShapeBlendNodeLayer();let s;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(s={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let a=this.materialOverride!==void 0;!a&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,s),n.scene.markNeedsUpdateRendererDirty()),!a&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(l=>n.shared.material(l).getFlavor(r.flatShading,r.side,r.wireframe)),n.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],n.scene.markNeedsUpdateRendererDirty()));let o=this.data;if(!a&&o.geometry?.type!=="NonParametricGeometry"&&"materials"in o&&o.materials!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(o.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!a&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let l=0;l<this.material.length;l++)this.material[l]=this.material[l].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,s);this.syncShadowCatcher(n)}shadowCatcherActive(){let e=this.dataPatched,n=e.geometry?.type;return e.shadowCatcher===!0&&(n==="RectangleGeometry"||n==="PlaneGeometry")}syncShadowCatcher(e){let n=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let r=RV();if(r===null)return;this.shadowCatcherMaterial=r}this.shadowCatcherMaterial.side=n.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,e.scene.markNeedsUpdateRendererDirty()):"material"in n&&n.material!==void 0&&(this.material=e.shared.material(n.material).getFlavor(n.flatShading,n.side,n.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=n.castShadow,this.receiveShadow=n.receiveShadow)}static disposeOneMaterial(e){Dw(e)&&!XV(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&MS(this.material).forEach(e=>{_r.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}});var YV,$V,KV,bee,ZV,qt,ds=F(()=>{"use strict";ft();an();Rw();Tu();Y();Cv();Jd();_2();YV=new _,$V=new vt,KV=new vt,bee=new _,ZV=new ne,qt=class extends _r{constructor(e,n,r){super(e,n);this.data=n;this.isSkinnedMesh=!1;this.localGeometry=void 0,n.bindMode&&n.bindMatrix&&(this.bindMode=n.bindMode,this.bindMatrix=new ne().fromArray(n.bindMatrix),this.bindMatrixInverse=new ne)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof De&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof De?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof _u){let e=this.geometryCreateDeleyed,n=this.chooseGeoemtryCache(e),r=this.dataPatched.geometry;this.geometryCreateDeleyed=n.get(r,e,this),this._geometryCacheKey=r}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return Wy.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return Wy.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.updateByPatchedOpGeometry(wr.drop(e,1),n.geometry,r)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,n){this.invalidateDownstreamBooleanData();let r=this.data.geometry.type;if(r==="NonParametricGeometry"||r==="SubdivGeometry"){let s=e;if(this.localGeometry===void 0){let p={...this.data.geometry,...s};this.localGeometry=Aa(p,n,this.data.flatShading,this)}let a,o,l;s.scaleBaked?[a,o,l]=s.scaleBaked:{width:a,height:o,depth:l}=s;let c=this.localGeometry.userData,u=typeof a=="number"?a:1,d=typeof o=="number"?o:1,h=typeof l=="number"?l:1;c.sxPrev!==void 0&&Tv(this.localGeometry.attributes,u/c.sxPrev,d/c.syPrev,h/c.szPrev),c.sxPrev=u,c.syPrev=d,c.szPrev=h}else{let s={...this.data.geometry,...e},a=Aa(s,n,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&Sw(this.localGeometry,a)?a.dispose():(this.localGeometry?.dispose(),this.localGeometry=a)}}refreshAttachedClonersInteractions(e){for(let n of this.attachedSurfaceCloners)n.update(e)}refreshAttachedCloners(e){for(let n of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(n.object)}refreshAttachedPaths(e){for(let n of this.attachedPaths)e.scene.addPendingCommand(()=>n.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,n,r){let s=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Xn&&this.chooseGeoemtryCache(r.shared).mutateIfUnique(this.geometryCreateDeleyed.data,n)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(n,e.props.scaleBaked),this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)),!s&&e.type===0&&e.path.length===0&&Mw(e.props)&&this.geometryCreateDeleyed instanceof Xn&&this.chooseGeoemtryCache(r.shared).mutateIfUnique(this.geometryCreateDeleyed.data,n)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(n),this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)),!s&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof De&&!(this.geometryCreateDeleyed instanceof Xn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let a=r.shared,o=this.chooseGeoemtryCache(a),l=this.geometryCreateDeleyed;if(o.getCached(this._geometryCacheKey)===l&&l.isShared!==!0){let u=this.dataPatched.geometry,d=Aa(u,a,this.data.flatShading,this);Sw(l,d)?(d.dispose(),l.computeBoundingSphere(),o.mutateIfUnique(this._geometryCacheKey,u)):(d.computeBoundingSphere(),o.forceDelete(this._geometryCacheKey),o.adopt(u,d),this.geometryCreateDeleyed=d),this._geometryCacheKey=u,s=!0,this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)}}s||(r.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(r)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,n){this.createGeometryDelayed(n)}applyTransientGeometryData(e,n){let r=e.shared,s=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof De&&!(this.geometryCreateDeleyed instanceof Xn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let a=this.chooseGeoemtryCache(r),o=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===o&&o.isShared!==!0){let c=Aa(s,r,this.data.flatShading,this);Sw(o,c)?(c.dispose(),o.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,s)):(c.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(s,c),this.geometryCreateDeleyed=c),this._geometryCacheKey=s,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e);return}}n&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(r).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,n){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,n);let r=e.morphTargetInfluences;if(r){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:s,value:a}}of r)this.updateMorphInfluences(s,n.shared.getVariable(a,[this.uuid,"morphTargetInfluences",s]))}super.updateState(e,n)}updateMorphInfluences(e,n){if(this.morphTargetDictionary===void 0)return;let r=this.morphTargetDictionary[e];r!==void 0&&(this.morphTargetInfluences[r]=n)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;this.is2DType?e.set(0,0,r.depth*.5):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)):r.centerOffset?e.fromArray(r.centerOffset):e.setScalar(0),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,n){this.skeleton=e,this.isSkinnedMesh=!0,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let n=new vt,r=this.geometry.attributes.skinWeight;for(let s=0,a=r.count;s<a;s++){n.fromBufferAttribute(r,s);let o=1/n.manhattanLength();o!==1/0?n.multiplyScalar(o):n.set(1,0,0,0),r.setXYZW(s,n.x,n.y,n.z,n.w)}}boneTransform(e,n){let r=this.skeleton;if(r===void 0)return;let s=this.geometry;$V.fromBufferAttribute(s.attributes.skinIndex,e),KV.fromBufferAttribute(s.attributes.skinWeight,e),YV.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let a=0;a<4;a++){let o=KV.getComponent(a);if(o!==0){let l=$V.getComponent(a);ZV.multiplyMatrices(r.bones[l].matrixWorld,r.boneInverses[l]),n.addScaledVector(bee.copy(YV).applyMatrix4(ZV),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}});function xee(i){if(i.geometry.attributes.extrudeNormal||!i.geometry.attributes.position||!i.geometry.attributes.normal)return;let t=new Map,e=i.geometry.attributes,n=e.position.array,r=e.normal.array,s=new Float32Array(n.length);for(let a=0;a<n.length;a+=3){let o=`${n[a]}_${n[a+1]}_${n[a+2]}`,l=new _(r[a],r[a+1],r[a+2]);t.has(o)?t.get(o)?.normals.push(l):t.set(o,{normals:[l],result:new _})}t.forEach((a,o)=>{for(let l of a.normals)a.result.add(l);a.result.divideScalar(a.normals.length)});for(let a=0;a<n.length;a+=3){let o=`${n[a]}_${n[a+1]}_${n[a+2]}`,l=t.get(o)?.result;l&&(s[a]=l.x,s[a+1]=l.y,s[a+2]=l.z)}i.geometry.setAttribute("extrudeNormal",new Ve(s,3))}function See(i){if(i.geometry.attributes.extrudeNormals||!i.geometry.attributes.position)return;let e=i.geometry.attributes.position.array,n=new Float32Array(e.length),r=new _;for(let s=0;s<e.length;s+=3)r.set(e[s],e[s+1],e[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;i.geometry.setAttribute("extrudeNormal",new Ve(n,3))}function Qo(i){if(Array.isArray(i.material)){for(let t of i.material)if(t.getLayersOfType("outline").length===0)return}else if(!Zd(i.material)||i.material.getLayersOfType("outline").length===0)return;i instanceof qt&&i.is2DAndNoDepth?See(i):xee(i)}function G2(i){return Math.min(2047,Math.max(1,Math.round(i*2048)))/2048}function Jo(i){if(!i.geometry.attributes.position)return;let t=i.geometry.attributes,e=t.position.array,n=t.randomColor;if(n!==void 0&&n.count*3===e.length)return;let r=new Float32Array(e.length),s=parseInt(i.uuid.replace(/\D/g,"")),a=[G2(we.seededRandom(s)),G2(we.seededRandom(s+1e4)),G2(we.seededRandom(s+2e4))];for(let o=0;o<e.length;o++)r[o]=a[o%3];i.geometry.setAttribute("randomColor",new je(r,3))}var Iv=F(()=>{"use strict";Y();Q1();ds()});function H2(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function Eee(i,t){let e=i.cloner;return e!==void 0&&e.parent===t?e:void 0}function ez(i,t,e,n){let r=(t.children.length+1)*16;Nw.length<r&&(Nw=new Float32Array(r));let s=0,a=l=>{l.toArray(Nw,s*16),s++},o=t.parameters.hideBase!==!0;o&&a(n),QV.multiplyMatrices(i.hiddenMatrix,i.matrix);for(let l of t.children)!Wo(l)||l.playModeVisible===!1||(JV.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),j2.multiplyMatrices(QV,JV),!(o&&j2.equals(n))&&a(j2));try{return s===0?0:QU(e,Nw.subarray(0,s*16))}finally{K1(e)}}var Au,wee,QV,JV,j2,Nw,Cs,qf=F(()=>{gi();Y();cv();Iv();Tu();fr();Au=new ne,wee=new ne,QV=new ne,JV=new ne,j2=new ne;Nw=new Float32Array(0);Cs=class extends _r{constructor(e,n,r){super(e,n);this.data=n;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.geometry=new De;this.onAfterRender=(e,n,r,s,a,o)=>{super.onAfterRender(e,n,r,s,a,o),this.recomputeBoolean()};this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,n=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let s=0;s<this.children.length;s++){let a=this.children[s];a instanceof Cs&&a.dataPatched.visible===!0&&a.recomputeBoolean(e===!0,n)}this.meshSetAddresses=[];for(let s=0;s<this.children.length;s++){let a=this.children[s];if(a instanceof Kt&&a.dataPatched.visible===!0&&a.geometry.attributes.position?.count>0&&a.geometry.drawRange.count>0&&a.booleanMeshSetAddress!==0){Au.multiplyMatrices(a.hiddenMatrix,a.matrix).multiply(a.pivotMatrix);try{let o=Eee(a,this);if(a.booleanMeshSetAddress===-1){if((a.geometry.index??a.geometry.getAttribute("position")).count/3<15e5){let l=YU(a.geometry,e===!0,n);a.booleanMeshSetAddress=o===void 0||l===-1?l:ez(a,o,l,Au)}if(a.booleanMeshSetAddress===-1)return;o===void 0&&$1(a.booleanMeshSetAddress,Au),a.booleanMatrixInvOld.copy(Au).invert(),a.booleanWasTransformed=!1}else a instanceof Cs&&a.needsTransformForDownstream===!0?(o===void 0?$1(a.booleanMeshSetAddress,Au):a.booleanMeshSetAddress=ez(a,o,a.booleanMeshSetAddress,Au),a.needsTransformForDownstream=!1):a.booleanWasTransformed===!0&&($1(a.booleanMeshSetAddress,wee.multiplyMatrices(Au,a.booleanMatrixInvOld)),a.booleanMatrixInvOld.copy(Au).invert(),a.booleanWasTransformed=!1)}catch(o){console.error(o),a.booleanMeshSetAddress=0,a.geometry.userData.booleanOperationDidFail=!0;continue}if(a.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(a.booleanMeshSetAddress),a.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let s=this.geometry;s.dispose(),this.geometry=new De,this.geometry.userData=s.userData,this.geometry.boundingSphere=s.boundingSphere,this.geometry.setAttribute("position",new Ve([],3))}this.geometry.setDrawRange(0,0);return}if(e===!0)return ZU(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new De,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=KU(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(s){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(s)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Qo(this),Jo(this)}dispose(){super.dispose(),this.geometry.dispose()}}});var Xf,Yf,$f=F(()=>{Y();Yi();Su();(t=>{function i(e){return Dt.is(e)&&e instanceof ql}t.is=i})(Xf||(Xf={}));Yf=(i,t)=>class extends Ma(i,t){updateState_Light(n,r){if(this.updateState_Entity(n,r),n.color!==void 0&&(this.color=r.shared.color(n.color)),n.intensity!==void 0&&(this.intensity=n.intensity*Math.PI),n.depth!==void 0){let s=this.shadow;s.camera.far=n.depth,s.needsUpdate=!0}n.shadows!==void 0&&(this.castShadow=n.shadows)}}});var Ps,hs,Ov,mc=F(()=>{qf();gi();Su();Ps=i=>i instanceof Kt,hs=i=>i!==null&&i instanceof Cs,Ov=i=>z1.is(i)});function Fee(i,t){try{let e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(i),n=r=>Number(e.find(s=>s.type===r)?.value);return new Date(n("year"),n("month")-1,n("day"),n("hour"),n("minute"),n("second"),i.getMilliseconds())}catch{return new Date(NaN)}}function vi(i,t){return t.color(i)}function Y2(i=new Date,t){let e=t.format,n=i.getSeconds(),r=i;t&&t.timeZone!==null&&(r=Fee(new Date,t.timeZone));let s=r.getHours(),a=r.getMinutes(),o;t.format12h24h==="12ampm"&&(o=s>=12?"PM":"AM");let l=s;t.format12h24h!=="24"&&(l=s%12,l===0&&(l=12));let c,u;switch(e){case"HH:mm:ss":c=[l,a,n];break;case"HH:mm":c=[l,a];break;case"HH":c=[l],o=void 0;break;case"mm":c=[a],o=void 0;break;case"ss":c=[n],o=void 0;break;case"year":u=r.getFullYear();break;case"month":u=r.getMonth()+1;break;case"dayOfYear":u=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=r.getDate();break;case"secondOfDay":u=s*60*60+a*60+n;break;default:console.error("Unknown time format",e),u=0;break}return c!==void 0?{textValue:c,suffix:o}:u}var kw=F(()=>{"use strict"});var Qf,cz=F(()=>{"use strict";Y();yf();vf();Qf=class extends jo(fy){constructor(e,n=15,r=10066329){super(e,n,r);this.object=e;this.added=!1;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,n){Ho(this.object,Qf.geometryHelper,e,n)}}});function Uee(i,t){i.shadow.camera.right=t/2,i.shadow.camera.left=-t/2,i.shadow.camera.top=t/2,i.shadow.camera.bottom=-t/2,i.shadow.needsUpdate=!0}var tl,Dv=F(()=>{"use strict";Y();cz();$f();tl=class extends Yf(cy,Qf){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.top=1250,s.bottom=-1250,s.right=1250,s.left=-1250,s.near=-1e4,s.far=2500;let a=new Yl(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Yl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let n=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&Uee(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),n&&this.update()}}});function K2(i){return i instanceof _r&&i.needsAO&&!Ts(i)&&i.isDecalObject!==!0}function Z2(i){let t=i.cloner;if(!(!t||!Array.isArray(t.children)))for(let e of t.children)e?.layers&&(e.layers.mask=i.layers.mask)}function Q2(i){return i.getLayersOfType("reflection").filter(t=>t.data.visible).length}function uz(i,t){let e={outline:!1,cavity:!1},n=i.layers.mask&$2,r=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),a=Q2(t),o=t.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(i.layers.set(8),r.length>0&&i.layers.enable(3),a>0&&i.layers.enable(4),e.outline=s.length>0,e.cavity=o.length>0,Jo(i),Qo(i)),r.length===0&&s.length===0&&o.length===0&&a===0&&i.layers.set(0),n&&i.layers.set(9),!n&&K2(i)&&i.layers.enable(5),Z2(i),e}function dz(i,t){if(!t.layers)return!1;let e=i.layers.mask&$2,n=!1,r=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),a=Q2(t),o=t.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(i.layers.set(3),(s.length>0||o.length>0)&&i.layers.enable(8),a>0&&i.layers.enable(4),n=!0),r.length===0&&s.length===0&&o.length===0&&a===0&&i.layers.set(0),e&&i.layers.set(9),!e&&K2(i)&&i.layers.enable(5),Z2(i),n}function hz(i,t){var l;if(!t.layers)return!1;let e=i.layers.mask&$2,n=!1,r=Q2(t),s=t.getLayersOfType("transmission").filter(c=>c.data.visible),a=t.getLayersOfType("outline").filter(c=>c.data.visible),o=t.getLayersOfType("cavity").filter(c=>c.data.visible);return r>0&&((l=i.userData).__splinePlanarMirror??(l.__splinePlanarMirror=0),i.layers.set(4),s.length>0&&i.layers.enable(3),(a.length>0||o.length>0)&&i.layers.enable(8),n=!0),r===0&&s.length===0&&a.length===0&&o.length===0&&i.layers.set(0),e&&i.layers.set(9),!e&&K2(i)&&i.layers.enable(5),Z2(i),n}function fz(i){let t={outline:!1,cavity:!1},e=n=>{t.outline=t.outline||n.outline,t.cavity=t.cavity||n.cavity};return i.traverseEntity(n=>{if(n instanceof _r)if(Array.isArray(n.material))for(let r=0;r<n.material.length;r++)e(uz(n,n.material[r]));else e(uz(n,n.material))}),t}function mz(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof _r)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)dz(e,e.material[n])&&(t=!0);else dz(e,e.material)&&(t=!0)}),t}function gz(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof _r)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)hz(e,e.material[n])&&(t=!0);else hz(e,e.material)&&(t=!0)}),t}function Lv(i,t,e,n=!1){let r=i.cloner;if(r){let s=null;if(i.raycast===Ht.prototype.raycast||i.raycast===Kt.prototype.raycast){let a=i.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of r.children){if(s!==null&&(pz.copy(s).applyMatrix4(a.matrixWorld),!t.ray.intersectsSphere(pz)))continue;let o=Vee.copy(a.matrixWorld).invert(),l=zee.copy(t.ray).applyMatrix4(o),c=i.matrixWorld;l.applyMatrix4(c);let u=kee;u.set(l.origin,l.direction),u.near=t.near,u.far=t.far,u.layers.mask=t.layers.mask;let d=u.intersectObject(i,!1);d.length>0&&e.push({...d[0],object:n?a:i})}}}var $2,kee,Vee,zee,pz,J2=F(()=>{"use strict";fr();Iv();gi();Tu();Y();$2=1<<9;kee=new Td,Vee=new ne,zee=new Wi,pz=new nr});var zw,Nv,yz=F(()=>{"use strict";Y();yf();vf();zw=class extends jo(hy){constructor(e,n=6710886){super(e,n);this.object=e;this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,n){Ho(this.object,zw.geometryHelper,e,n)}update(){if(this.object!==void 0){let e=zw._vector,n=this.object.distance?this.object.distance:1e3,r=n*Math.tan(this.object.angle);this.cone.scale.set(r,r,n),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let a=0,o=this.cone.material.length;a<o;a++)this.cone.material[a].color.set(s);else this.cone.material.color.set(s)}}},Nv=zw;Nv._vector=new _});var vz,bz,xz,nl,Bv=F(()=>{"use strict";Y();yz();$f();vz=new _,bz=new _,xz=new qe,nl=class extends Yf(oy,Nv){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.fov=we.RAD2DEG*2*this.angle,s.aspect=1,s.near=100,s.far=2500;let a=new Yl(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Yl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),bz.setFromMatrixPosition(this.matrixWorld),xz.setFromRotationMatrix(this.matrixWorld),vz.copy(this.up).applyQuaternion(xz).negate().multiplyScalar(this.distance),this.target.position.copy(bz).add(vz),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});var Cn,rl=F(()=>{ft();$s();Y();Yi();Ta();kw();Go();Dv();an();fc();Y();Tu();mc();J2();Bv();Qt();qf();Cn=class extends Tf(hr){constructor(e,n,r){super();this.data=n;this.bgColor=new yn(1,1,1,1);this.fog=null;this.backupFog=new hd(16777215,.1,2e3);this.fogUseBGColor=!1;this.fogMode="linear";this.fogDensity=Fr.getDensity({});this.fogHeightFalloff=Fr.getHeightFalloff({});this.fogHeightBase=Fr.getHeightBase({});this.isActive=!1;this.skyState=null;this.skyStateVersion=0;this.gradingState=null;this.skyHdriHolder=null;this.aoColor=new Ze;this.penumbraSizeArrayCache=null;if(this.super_Entity(e,n),this.personalCamera=new on(fa,{...Hd.defaultData,...n.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new sy(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),n.uiScene){let s=tv();s===null?Jn("ui-2d","a page's 2D scene"):this.uiScene=new s.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",n.uiScene,{dpr:window.devicePixelRatio,shared:r.shared})}else n.uiFrame&&this.createUICanvas(n.uiFrame,r)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,n){let r=tv();if(r===null){Jn("ui-2d","a page's UI canvas");return}this.uiCanvas=new r.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,n),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,n){e.color!==void 0&&(this.ambientLight.color=vi(e.color,n)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(n=>{n instanceof Cs&&n.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof _r)if(Array.isArray(e.material))for(let n of e.material)n.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let n=this.data.shadow,r=jd.isSoft(n);LV(r,n?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,n){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let r=this.scene;r.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=vi(e.color,n),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Fr.getMode(e),this.fogDensity=Fr.getDensity(e),this.fogHeightFalloff=Fr.getHeightFalloff(e),this.fogHeightBase=Fr.getHeightBase(e)}updateSky(e,n){this.skyState=e??null,this.skyStateVersion++;let r=e?.hdri?.image;this.skyHdriHolder=r!=null?n.image(r):null}updateAo(e,n){e.aoColor!==void 0&&(this.aoColor=vi(e.aoColor,n))}updateByOp(e,n,r,s){let a=this.data.uiFrame;super.updateByOp(e,n,r,s);let o=n;$t(e.path,["fog"])?this.updateFog(o.fog,r.shared):$t(e.path,["sky"])?this.updateSky(o.sky,r.shared):$t(e.path,["grading"])?this.gradingState=o.grading??null:$t(e.path,["ao"])?this.updateAo(o.ao,r.shared):$t(e.path,["ambient"])?this.updateAmbientLight(o.ambient,r.shared):$t(e.path,["shadow"])?this.updateShadow(o.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||a!==o.uiFrame)&&this.updateUIFrame(e.props.uiFrame,r)}updateUIFrame(e,n){e?(this.uiCanvas||this.createUICanvas(e,n),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,n){this.updateState_Entity(e,n),e.backgroundColor!==void 0&&this.setBackgroundColor(vi(e.backgroundColor,n.shared)),e.fog!==void 0&&this.updateFog(e.fog,n.shared),e.sky!==void 0&&this.updateSky(e.sky,n.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,n.shared),e.ao!==void 0&&this.updateAo(e.ao,n.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,n){}raycast(e,n){super.raycast(e,n)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(cs).fill(.5);let e=0,n=0;this.traverseEntity(r=>{if(!r.visible)return!0;r instanceof tl&&r.visible&&e<gf&&(this.penumbraSizeArrayCache[e]=r.data.penumbraSize??.5,e+=1),r instanceof nl&&r.visible&&e<cs-gf&&(this.penumbraSizeArrayCache[gf+n]=r.data.penumbraSize??.5,n+=1)})}raycastWithClones(e){let n=[],r=s=>{for(let a of s.children){let o=a.cloner;Dt.is(a)&&(a.visible||o?.object.data.visible)&&((Ps(a)||Ov(a)&&this.scene.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,n),Lv(a,e,n,!0)),r(a))}};return r(this),n}updateEntity2DByOp(e,n,r,s){this.uiCanvas?.updateEntity2DByOp(e,n,r,s)}}});function oI(){return ete}function Gz(i){aI=i}function Zw(){if(aI===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return aI}function Qw(i){return i?.isWebGPUSplineRenderer===!0}var ete,aI,lI=F(()=>{"use strict";ete=null,aI=null});var al,aE=F(()=>{"use strict";Y();Zy();Su();al=class extends Ma(Us,ba){constructor(e,n,r){super();this.super_Entity(e,n),this.context=r,this.objectHelper.update()}updateState(e,n){this.updateState_Entity(e,n)}}});var eG=Uh((pI,Jz)=>{(function(i,t){typeof pI=="object"?Jz.exports=t():typeof define=="function"&&define.amd?define(t):i.Alea=t()})(pI,function(){"use strict";return i.importState=function(e){var n=new i;return n.importState(e),n},i;function i(){return function(e){var n=0,r=0,s=0,a=1;e.length==0&&(e=[+new Date]);var o=t();n=o(" "),r=o(" "),s=o(" ");for(var l=0;l<e.length;l++)n-=o(e[l]),n<0&&(n+=1),r-=o(e[l]),r<0&&(r+=1),s-=o(e[l]),s<0&&(s+=1);o=null;var c=function(){var u=2091639*n+a*23283064365386963e-26;return n=r,r=s,s=u-(a=u|0)};return c.next=c,c.uint32=function(){return c()*4294967296},c.fract53=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.version="Alea 0.9",c.args=e,c.exportState=function(){return[n,r,s,a]},c.importState=function(u){n=+u[0]||0,r=+u[1]||0,s=+u[2]||0,a=+u[3]||0},c}(Array.prototype.slice.call(arguments))}function t(){var e=4022871197,n=function(r){r=r.toString();for(var s=0;s<r.length;s++){e+=r.charCodeAt(s);var a=.02519603282416938*e;e=a>>>0,a-=e,a*=e,e=a>>>0,a-=e,e+=a*4294967296}return(e>>>0)*23283064365386963e-26};return n.version="Mash 0.9",n}})});function sG(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var ll,qv,ho,rm=F(()=>{gi();Y();Jd();Iv();ds();ll=new Bt,qv=new _;ho=class extends qt{constructor(e,n,r){super(e,n,r);this.data=n;this.hiddenMatrixOld=new ne;this.smoothShading=!0;this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:s,subdivPointer:a}=Xn.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=a,r!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=r),s!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=s??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qo(this),Jo(this),this.calcBoundingBox(),n&&(this.localGeometry.uuid=n)}updateState(e,n){if(super.updateState(e,n),e.flatShading!==void 0){let r=this.material;this.material=Array.isArray(r)?r.map(s=>s.getFlavor(!1,s.side,s.wireframe)):r.getFlavor(!1,r.side,r.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(n)}}updateMesh(e=!1,n=!1,r=!1){n&&this.subdividedGeometry||Xn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0,r),this.subdividedGeometry&&Xn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let e=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Xn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Xn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qo(this),Jo(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}raycast(e,n){let r=this.localGeometry;this.localGeometry=this.originalGeometryNew,Kt.prototype.raycast.call(this,e,n),this.localGeometry=r}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new nr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let n=e.attributes.position,r=e.boundingSphere.center;ll.setFromBufferAttribute(n),ll.getCenter(r),e.boundingSphere.radius=r.distanceTo(ll.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ll.getSize(qv),this.hasNonUniformScale&&qv.divide(this.scale);let s={width:qv.x,height:qv.y,depth:qv.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let n=this.originalGeometry;ll.min.set(e[0],e[2],e[4]),ll.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(ll.min.applyMatrix4(this.shearScaleInv),ll.max.applyMatrix4(this.shearScaleInv)),n.boundingSphere===null&&(n.boundingSphere=new nr);let r=n.boundingSphere.center;ll.getCenter(r),n.boundingSphere.radius=r.distanceTo(ll.max)}freeSubdivPointer(){this.subdivPointer&&(Xn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry,r=n?.uuid,s=n?.userData.parameters,a=e.subdivisions>0?Xn.buildRefined(this.subdivPointer,e.subdivisions,this.smoothShading?e.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=a??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qo(this),Jo(this),s!==void 0&&(this.localGeometry.userData.parameters=s),r&&(this.localGeometry.uuid=r)}updateByPatchedOpGeometry(e,n,r){super.updateByPatchedOpGeometry(e,n,r),this.localGeometry&&(e.type===0&&e.path.length===0&&Mw(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(n):this.createGeometryByControls(n))}}});function Kv(i){if(i.component){let t=i.component.instances.indexOf(i);t>=0&&i.component.instances.splice(t,1);for(let e of i.children)Dt.is(e)&&Kv(e)}}var TI=F(()=>{"use strict";Yi()});var ZG=Uh((eDe,KG)=>{"use strict";function Ute(i,t){function e(){this.constructor=i}e.prototype=t.prototype,i.prototype=new e}function ch(i,t,e,n){this.message=i,this.expected=t,this.found=e,this.location=n,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ch)}Ute(ch,Error);ch.buildMessage=function(i,t){var e={literal:function(c){return'"'+r(c.text)+'"'},class:function(c){var u="",d;for(d=0;d<c.parts.length;d++)u+=c.parts[d]instanceof Array?s(c.parts[d][0])+"-"+s(c.parts[d][1]):s(c.parts[d]);return"["+(c.inverted?"^":"")+u+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function n(c){return c.charCodeAt(0).toString(16).toUpperCase()}function r(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function s(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function a(c){return e[c.type](c)}function o(c){var u=new Array(c.length),d,h;for(d=0;d<c.length;d++)u[d]=a(c[d]);if(u.sort(),u.length>0){for(d=1,h=1;d<u.length;d++)u[d-1]!==u[d]&&(u[h]=u[d],h++);u.length=h}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}function l(c){return c?'"'+r(c)+'"':"end of input"}return"Expected "+o(i)+" but "+l(t)+" found."};function kte(i,t){t=t!==void 0?t:{};var e={},n={svg_path:Z},r=Z,s=function(R){if(!R)return[];for(var N=[],H=0;H<R.length;H++)N=N.concat.apply(N,R[H]);var V=N[0];return V&&V.code=="m"&&(delete V.relative,V.code="M"),N},a=function(R,N){return at(R,N)},o=/^[Mm]/,l=ue(["M","m"],!1,!1),c=function(R,N,H){var V=dt(R,[N]);return H&&(V=V.concat(dt(R=="M"?"L":"l",H[1]))),V},u=/^[Zz]/,d=ue(["Z","z"],!1,!1),h=function(){return dt("Z")},p=/^[Ll]/,f=ue(["L","l"],!1,!1),m=function(R,N){return dt(R,N)},g=/^[Hh]/,y=ue(["H","h"],!1,!1),v=function(R,N){return dt(R,N.map(function(H){return{x:H}}))},b=/^[Vv]/,x=ue(["V","v"],!1,!1),S=function(R,N){return dt(R,N.map(function(H){return{y:H}}))},E=/^[Cc]/,M=ue(["C","c"],!1,!1),w=function(R,N,H){return{x1:R.x,y1:R.y,x2:N.x,y2:N.y,x:H.x,y:H.y}},T=/^[Ss]/,A=ue(["S","s"],!1,!1),C=function(R,N){return{x2:R.x,y2:R.y,x:N.x,y:N.y}},P=/^[Qq]/,D=ue(["Q","q"],!1,!1),I=function(R,N){return{x1:R.x,y1:R.y,x:N.x,y:N.y}},L=/^[Tt]/,U=ue(["T","t"],!1,!1),G=/^[Aa]/,X=ue(["A","a"],!1,!1),ae=function(R,N,H,V,Q,Pe){return{rx:R,ry:N,xAxisRotation:H,largeArc:V,sweep:Q,x:Pe.x,y:Pe.y}},ee=function(R,N){return{x:R,y:N}},$=function(R){return R*1},K=function(R){return R.join("")*1},re=/^[01]/,fe=ue(["0","1"],!1,!1),ve=function(R){return R=="1"},de=function(){return""},Se=",",oe=Fe(",",!1),be=function(R){return R.join("")},Oe=".",Le=Fe(".",!1),ke=/^[eE]/,Ce=ue(["e","E"],!1,!1),ce=/^[+\-]/,ye=ue(["+","-"],!1,!1),Me=/^[0-9]/,Ne=ue([["0","9"]],!1,!1),He=function(R){return R.join("")},_e=/^[ \t\n\r]/,Re=ue([" "," ",`
4134
+ `&&s.push("")):t.getTextWidth(s[s.length-1]+a,i)>r&&(s[s.length-1].length&&s.push(""),t.getTextWidth(s[s.length-1]+a,i)>r&&(a.length===1?(s[s.length-1]+=a,a=""):(s[s.length-1]+=a.slice(0,-1),a=a[a.length-1],s.push(""))));return s[s.length-1]+=a,s}var oee,lee,cee,zf,M2=F(()=>{"use strict";mi();ft();Qd();Y();mf();hc();pc();oee=gV().attributes,lee=12,cee=1,zf=class extends De{constructor(e,n){super();this.isTextGeometry=!0;this.charWidths=[];this.charCoords=[];this.wrappedText=[];this.isLowResolution=!1;this.vectorShapes=[];Object.assign(this.attributes,oee),this.userData={parameters:e,type:"TextGeometry"};let r=n.getFont(e.font);r?.isLoaded?(this.font=r,this.update(e,n)):this.updateFont(e.font,n).then(()=>{this.update(e,n),n?.requestRender()})}async updateFont(e,n){let r=n.getFont(e);r&&(this.font=r,await r.loadingPromise)}update(e,n){let r=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!r?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:s,height:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,text:u,textTransform:d}=e,h=Mr.getDisplayedValue(u),p=d===2?h.toUpperCase():d===3?h.toLowerCase():h,f=uee(e,r,p,n),{shapes:m,charWidths:g,charCoords:y}=r.generateShapes(f,e,n),v=(typeof s=="number"?s:Number(n.getVariable(s)))*.5,b=(typeof a=="number"?a:Number(n.getVariable(a)))*.5,x=m.map(M=>new vn().fromShape(M,!0));this.vectorShapes=x;let S=x.map(M=>As.create({shape:M,parameters:{depth:o,extrudeBevelSegments:c,extrudeBevelSize:l,windingRule:o<=0?ln.NONZERO:ln.ODD,subdivisions:this.isLowResolution&&o>0?cee:lee}})),E=S.length?ro(S):gV();E.translate(-v,b,0),this.dispose(),this.wrappedText=f,this.charCoords=y,this.charWidths=g,this.deleteAttribute("extrudeNormal"),Object.entries(E.attributes).forEach(([M,w])=>{this.setAttribute(M,w)}),this.setIndex(E.index),this.computeBoundingSphere()}clone(){let e=fi(new De,zf.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([n,r])=>{this.setAttribute(n,r)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,n){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},n)}get text(){return this.userData.parameters.text??""}}});function bV(i){if(yV)return;if(bw)return bw;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.13/build"),s=import("./process.js"),[a,o]=await Promise.all([s,fetch(`${n}/process.wasm`).then(u=>u.arrayBuffer())]),l=a.default,c=await l({wasmBinary:o});vV(c),yV=!0}return bw=t(),bw}var vV,xw,yV,bw,_v=F(()=>{xw=new Promise(i=>{vV=i}),yV=!1});function Sw(i,t){if(Object.keys(i.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let e=Object.keys(i.attributes),n=Object.keys(t.attributes);if(e.length!==n.length)return!1;for(let o of n){let l=i.attributes[o],c=t.attributes[o];if(l===void 0||l.isInterleavedBufferAttribute===!0||c.isInterleavedBufferAttribute===!0||l.itemSize!==c.itemSize||l.normalized!==c.normalized||l.array.constructor!==c.array.constructor||l.array.length!==c.array.length)return!1}let r=i.index,s=t.index;if(r===null!=(s===null))return!1;let a=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let o=r.array.constructor,l=s.array.constructor;if(o!==l){if(o!==Uint32Array||l!==Uint16Array)return!1;a=!0}}if(i.groups.length!==t.groups.length)return!1;for(let o=0;o<t.groups.length;o++){let l=i.groups[o],c=t.groups[o];if(l.start!==c.start||l.count!==c.count||l.materialIndex!==c.materialIndex)return!1}for(let o of n){let l=i.attributes[o],c=t.attributes[o];l.array.set(c.array),l.needsUpdate=!0}if(r!==null&&s!==null){if(a){let o=r.array,l=s.array;for(let c=0,u=l.length;c<u;c++){let d=l[c];o[c]=d===65535?4294967295:d}}else r.array.set(s.array);r.needsUpdate=!0}return i.drawRange.start=t.drawRange.start,i.drawRange.count=t.drawRange.count,i.userData=t.userData,i.boundingBox=null,i.boundingSphere=null,!0}function Tv(i,t,e,n){let r=i.position.array,s=i.normal.array,a=dee.makeScale(t,e,n).invert().elements,o,l,c;for(let u=0,d=r.length;u<d;u+=3)r[u]*=t,r[u+1]*=e,r[u+2]*=n,o=s[u],l=s[u+1],c=s[u+2],s[u]=a[0]*o+a[4]*l+a[8]*c,s[u+1]=a[1]*o+a[5]*l+a[9]*c,s[u+2]=a[2]*o+a[6]*l+a[10]*c;i.position.needsUpdate=!0,i.normal.needsUpdate=!0}var dee,_2=F(()=>{"use strict";Y();dee=new ne});function Mw(i){let t=Object.keys(i);return t.length===1&&t[0]==="subdivisions"}function Av(i,t){let e=t?t.count:i.count,n=0,r=1e4,s=new Map,a=new Uint32Array(e),o=[];for(let u=0;u<e;u++){let d=t?t.getX(u):u,h=i.getX(d),p=i.getY(d),f=i.getZ(d),m=Math.round(h*r),g=Math.round(p*r),y=Math.round(f*r),v=s.get(m);v===void 0&&(v=new Map,s.set(m,v));let b=v.get(g);b===void 0&&(b=new Map,v.set(g,b));let x=b.get(y);x===void 0&&(x=n++,b.set(y,x),o.push(h,p,f)),a[u]=x}let l=[],c=[];for(let u=0;u<a.length;u+=3)a[u]===a[u+1]||a[u]===a[u+2]||a[u+1]===a[u+2]||(l.push(a[u],a[u+1],a[u+2]),c.push(t?t.getX(u):u,t?t.getX(u+1):u+1,t?t.getX(u+2):u+2));return{positions:o,triIndices:l,triOriginals:c}}function hee(i,t,e,n,r){let s=[],a=[],o=r?e.getAttribute("uv"):void 0,l=o&&o.itemSize===2?[]:void 0,c=h=>{if(l){let p=r[h];l.push(o.getX(p),o.getY(p))}};if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let h=e.userData.shape.extractShapePointsToFlatArray([]),p=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&p<=24&&p%4===0&&e.userData.parameters.angle>=360){let g=h.length/2/p;h=h.filter((y,v)=>Math.floor(v/2)%g===0)}let f=0;for(let g=0;g<h.length;g+=2)f+=(h[g]-h[(g===0?h.length:g)-2])*(h[g+1]+h[(g===0?h.length:g)-1]);i.length=0;let m=0;if(f<0)for(let g=0;g<h.length;g+=2)i.push(h[g],h[g+1],0),s.push(m++);else for(let g=h.length-2;g>=0;g-=2)i.push(h[g],h[g+1],0),s.push(m++);return a.push(m),{indices:s,verticesPerFace:a}}let u=new Float32Array([e.userData.parameters.depth])[0],d=0;for(;d<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let h=0;if((i[t[d]*3+2]===u||i[t[d]*3+2]===0)&&h++,(i[t[d+1]*3+2]===u||i[t[d+1]*3+2]===0)&&h++,(i[t[d+2]*3+2]===u||i[t[d+2]*3+2]===0)&&h++,h===3)break}if(t[d+1]===t[d+3]&&t[d+2]===t[d+5]||t[d+0]===t[d+3]&&t[d+2]===t[d+4]){Ew.set(i[t[d]*3],i[t[d]*3+1],i[t[d]*3+2]),T2.set(i[t[d+1]*3],i[t[d+1]*3+1],i[t[d+1]*3+2]),A2.set(i[t[d+4]*3],i[t[d+4]*3+1],i[t[d+4]*3+2]),C2.set(i[t[d+5]*3],i[t[d+5]*3+1],i[t[d+5]*3+2]),T2.sub(Ew).normalize(),A2.sub(Ew).normalize(),C2.sub(Ew).normalize();let h=T2.cross(A2).dot(C2),p=d;Math.abs(h)>.005||n&&n.some((f,m)=>m%2===1?!1:p>=n[m]&&p<n[m+1])?(s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),a.push(3),d+=3):(s.push(t[d],t[d+1],t[d+4],t[d+5]),c(d),c(d+1),c(d+4),c(d+5),a.push(4),d+=6)}else s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),a.push(3),d+=3}if(e.useNgonForTopBottomFaceDuringBake){let h=[],p=[],f=0;for(let m=0,g=0;m<i.length;m+=3,g++)i[m+2]===0&&(h.push(g),f++),i[m+2]===u&&p.push(g);if(e.userData.parameters.extrudeBevelSize===0){let m=p[0];p[0]=p[1],p[1]=m}h.reverse(),s.push(...h,...p),a.push(f,f),l=void 0}return{indices:s,verticesPerFace:a,uvs:l}}var ww,Gf,gt,xV,SV,wV,Xn,Ew,T2,A2,C2,Jd=F(()=>{"use strict";Y();_v();ft();Cv();_2();Cf();ww=new Bt,Gf=new _;xw.then(i=>{gt=i});xV=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),SV=new Uint32Array([0,1,2,3]),wV=new Uint8Array([4]),Xn=class extends De{constructor(e,n){super();this.data=e;this.flatShading=n;this.subdivPointer=0;this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,n){this.freeSubdivPointer();let r=this.data.scaleBaked.map(l=>typeof l=="number"?l:1),s=pa.div(n.map(l=>typeof l=="number"?l:0),r);if(s.every(l=>l===1))return;this.subdividedGeometry&&Tv(this.subdividedGeometry.attributes,...s),this.originalGeometry&&Tv(this.originalGeometry.attributes,...s),this.data=e;let a=this.userData.parameters;this.userData.parameters={width:a.width*s[0],height:a.height*s[1],depth:a.depth*s[2]},this.originalGeometry.boundingSphere.center.multiply(Gf.fromArray(s));let o=Gf.set(a.width,a.height,a.depth).length();this.originalGeometry.boundingSphere.radius=o/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let n=e.phongAngle??35;this.flatShading&&(n=-1);let r=null;if(e.subdivisions>0){let a=0;try{a=Xn.allocate(e),r=Xn.buildRefined(a,e.subdivisions,n)}catch(o){console.error(o,e)}finally{a&&Xn.freeSubdivPointer(a)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let s=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=s}rebuild(){let e,n,r;try{({originalGeometry:e,subdividedGeometry:n,subdivPointer:r}=Xn.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new ni(100,100,100),r=0}this.subdivPointer=r,this.originalGeometry=e,this.subdividedGeometry=n??void 0;let s=this.subdividedGeometry??this.originalGeometry;Object.assign(this,s),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Xn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new nr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let n=e.attributes.position,r=e.boundingSphere.center;ww.setFromBufferAttribute(n),ww.getCenter(r),e.boundingSphere.radius=r.distanceTo(ww.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ww.getSize(Gf);let s={width:Gf.x,height:Gf.y,depth:Gf.z};return this.userData.parameters=s,s}static build(e,n,r,s){let a,o,l=e?.phongAngle??35;r===!1&&(l=-1),n&&(gt.free_bvh(n),gt.free_subdivision_surface(n));try{a=Xn.allocate(e,s)}catch(u){console.error(u,e),a=Xn.allocate({positionWASM:xV,indexWASM:SV,verticesPerFaceWASM:wV},s)}gt.set_destination_refinement_level(a,0);let c=Xn.buildLevel(a,!0,l);return e.subdivisions>0?o=Xn.buildRefined(a,e.subdivisions,l):o=null,{subdivPointer:a,originalGeometry:c,subdividedGeometry:o}}static buildRefined(e,n,r){try{return gt.set_destination_refinement_level(e,n),Xn.buildLevel(e,!1,r)??null}catch{try{return gt.set_destination_refinement_level(e,n-1),Xn.buildLevel(e,!1,r)??null}catch{return null}}}static primitiveToQuads(e,n,r){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let s=e.shape!==void 0||e.path!==void 0?n.geometry:Aa(e,r,!1,n),a;W1(e)?a=s.getClosedTorusIndicesForBooleanOrSubdiv():a=s.getIndex();let{positions:o,triIndices:l,triOriginals:c}=Av(s.getAttribute("position"),a),u;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let f=e.radialSegments*e.heightSegments*3*2,m=f+e.radialSegments*3;u=[f,m]}let{indices:d,verticesPerFace:h,uvs:p}=hee(o,l,s,u,c);return{positions:o,indices:d,verticesPerFace:h,uvs:p}}static allocate(e,n){let r,s,a,o=[],l=[];e.positionWASM&&e.positionWASM.length>0?(r=e.positionWASM,s=e.indexWASM,a=e.verticesPerFaceWASM,gt.alloc_subdivision_surface_uvs&&e.uvWASM&&e.uvWASM.length===s.length*2&&(l=e.uvWASM)):(r=xV,s=SV,a=wV);let c=r.length,u=s.length,d=a.length,h=r.length+o.length+l.length,p=s.length+a.length,f=h*Float32Array.BYTES_PER_ELEMENT+p*Uint32Array.BYTES_PER_ELEMENT,m=h*Float32Array.BYTES_PER_ELEMENT,g=gt._malloc(f),y=new Float32Array(gt.HEAPF32.buffer,g,h),v=new Uint32Array(gt.HEAPU32.buffer,g+m,p);y.set(r,0),y.set(o,r.length),y.set(l,r.length+o.length),v.set(s,0),v.set(a,s.length);let b;e?.scaleBaked?.some(E=>E!==1)&&(b=new ne().makeScale(...e.scaleBaked.map(E=>typeof E=="number"?E:1))),n&&(b?b.premultiply(n):b=n);let x=g+(r.length+o.length)*Float32Array.BYTES_PER_ELEMENT,S=l.length?b?gt.alloc_subdivision_surface_uvs2(g,c,g+m,u,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d,x,l.length,b.elements):gt.alloc_subdivision_surface_uvs(g,c,g+m,u,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d,x,l.length):b?gt.alloc_subdivision_surface2(g,c,g+m,u,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d,b.elements):gt.alloc_subdivision_surface(g,c,g+m,u,g+m+s.length*Uint32Array.BYTES_PER_ELEMENT,d);return gt._free(g),S}static buildLevel(e,n,r,s,a,o=!1){let l=a?gt.get_mesh_data2(e,n?gt.Level.CONTROL:gt.Level.REFINED,r,a.elements):gt.get_mesh_data(e,n?gt.Level.CONTROL:gt.Level.REFINED,r),c=10,u=gt.HEAPU32.subarray(l>>2,(l>>2)+c),d=u.subarray(4,4+4),h=0,p=gt.HEAPU32[u[h]>>2],f=gt.HEAPF32.subarray(p>>2,(p>>2)+d[h]);h++;let m=gt.HEAPU32[u[h]>>2],g=gt.HEAPF32.subarray(m>>2,(m>>2)+d[h]);h++;let y=gt.HEAPU32[u[h]>>2],v=gt.HEAPU32.subarray(y>>2,(y>>2)+d[h]);h++;let b=gt.HEAPU32[u[h]>>2],x=gt.HEAPU32.subarray(b>>2,(b>>2)+d[h]);h++;let S;if(gt.alloc_subdivision_surface_uvs){let M=u[9];if(M>0){let w=gt.HEAPU32[u[8]>>2];S=gt.HEAPF32.subarray(w>>2,(w>>2)+M)}}if(s===void 0){let M=new De;if(M.setIndex(new Vs(x,1)),M.setAttribute("position",new Ve(f,3)),M.setAttribute("normal",new Ve(g,3)),S&&M.setAttribute("uv",new Ve(S,2)),n){M.setAttribute("faceMap",new Vs(v,1));let w=new Float32Array(g.length/3*4).fill(0);M.setAttribute("color",new je(w,4))}return gt.free_mesh_data(l),M.userData.type="SubdivGeometry",M}if(s.getAttribute("position").copyArray(f),s.getAttribute("normal").copyArray(g),s.attributes.position.needsUpdate=!0,s.attributes.normal.needsUpdate=!0,o){let M=s.getIndex();M!==null&&M.array.length===x.length&&(M.copyArray(x),M.needsUpdate=!0)}let E=s.getAttribute("uv");S&&E&&E.array.length===S.length&&(E.copyArray(S),E.needsUpdate=!0),gt.free_mesh_data(l)}static freeSubdivPointer(e){gt.free_bvh(e),gt.free_subdivision_surface(e)}static buildControlCageWireframe(e,n,r){let s=gt.get_wireframe_data_for_base_level(e),a=4,o=gt.HEAPU32.subarray(s>>2,(s>>2)+a),l=o.subarray(2,2+2),c=0,u=gt.HEAPU32[o[c]>>2],d=gt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let h=gt.HEAPU32[o[c]>>2],p=gt.HEAPU32.subarray(h>>2,(h>>2)+l[c]);if(n===void 0){let f=new De;f.setAttribute("position",new Ve(d,3));let m=new Float32Array(d.length);for(let g=0,y=d.length;g<y;)m[g++]=r.r,m[g++]=r.g,m[g++]=r.b;return f.setAttribute("color",new je(m,3)),f.setIndex(new Vs(p,1)),gt.free_wireframe_data_for_base_level(s),f}n.getAttribute("position").copyArray(d),n.attributes.position.needsUpdate=!0,gt.free_wireframe_data_for_base_level(s)}static updateCollabMesh(e,n,r){let s=n===0;s||gt.set_destination_refinement_level(e,n);let a=r?gt.get_topological_data2(e,s?gt.Level.CONTROL:gt.Level.REFINED,r.elements):gt.get_topological_data(e,s?gt.Level.CONTROL:gt.Level.REFINED),o=8,l=gt.HEAPU32.subarray(a>>2,(a>>2)+o),c=l.subarray(3,3+3),u=0,d=gt.HEAPU32[l[u]>>2],h=new Float32Array(gt.HEAPF32.subarray(d>>2,(d>>2)+c[u]));u++;let p=gt.HEAPU32[l[u]>>2],f=new Uint32Array(gt.HEAPU32.subarray(p>>2,(p>>2)+c[u]));u++;let m=gt.HEAPU32[l[u]>>2],g=new Uint8Array(gt.HEAPU32.subarray(m>>2,(m>>2)+c[u])),y;if(gt.alloc_subdivision_surface_uvs){let v=l[7];if(v>0){let b=gt.HEAPU32[l[6]>>2];y=new Float32Array(gt.HEAPF32.subarray(b>>2,(b>>2)+v))}}return gt.free_topological_data(a),{positions:h,indices:f,verticesPerFace:g,uvs:y}}};Ew=new _,T2=new _,A2=new _,C2=new _});var P2,_w,I2=F(()=>{"use strict";GP();WP();pv();XP();Sv();Cf();c2();u2();h2();gw();m2();Mv();g2();y2();b2();vw();x2();S2();w2();E2();pc();Qt();GP();WP();pv();XP();Sv();fV();Cf();c2();u2();h2();gw();m2();Mv();g2();y2();b2();vw();x2();S2();w2();E2();pc();mV();l2();M2();Jd();_v();cv();P2={ConeGeometry:Mk,CubeGeometry:_k,CylinderGeometry:ow,DodecahedronGeometry:Tk,EllipseGeometry:Uf,HelixGeometry:WU,IcosahedronGeometry:nV,LatheGeometry:rV,NonParametricGeometry:sV,PolygonGeometry:mw,PyramidGeometry:aV,RectangleGeometry:Vf,SphereGeometry:oV,PlaneGeometry:lV,BackdropGeometry:cV,StarGeometry:yw,TextFrameGeometry:uV,TorusGeometry:dV,TorusKnotGeometry:hV,TriangleGeometry:pV,VectorGeometry:As},_w=i=>{let t=P2[i.type]??N1(i.type);if(t===void 0)throw new Error(`No geometry factory registered for "${i.type}" \u2014 was its feature compiled out of this runtime build?`);return t.create(i)}});function Aa(i,t,e,n){let r,s,a;i.type==="PathGeometry"?(s=JSON.parse(JSON.stringify(i)),a=[[],["extrusion"]]):(s={...i},a=[[]]);for(let c of a){let u=s;for(let d of c)u=u[d];for(r in u){let d=u[r];EC(d)&&!pee.includes(r)&&(u[r]=t.getVariable(d,[n.uuid,"geometry",...c,r]),EC(u[r])&&(u[r]=1))}}let o={parameters:s,type:s.type};if(s.type==="PathGeometry")o.path=s.path;else if(s.type==="VectorGeometry"){let c=vn.createFromState(s.shape,s.width,s.height);o.shape=c}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),o.geometry=new _d().parse(s),o.geometry.groups.length===0){let c=o.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else if(s.type==="SubdivGeometry"){let c=new Xn(s,e);return c.data=i,c}else if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=N1(s.type);if(c)return c.create(s,t);Jn("text",`a ${s.type}`);let u=vn.createFromState(zd.defaultData(),100,100);return _w({...s,shape:u,type:"VectorGeometry"})}else if(s.type==="UIGeometry")return Vf.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}});let l;try{l=_w(o)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${o}`);let u=vn.createFromState(zd.defaultData(),100,100);o.shape=u,o.type="VectorGeometry",l=_w(o)}return l}var pee,Cv=F(()=>{"use strict";ft();Y();I2();Qt();Mv();hc();Jd();pee=["font"]});var O2,Pv,EV=F(()=>{"use strict";Cv();O2=class{constructor(){this.objects=new Map;this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,n){let r=this.objects.get(t);return r===void 0?(r=this.createObject(t,e,n),this.objects.set(t,r)):r.isShared=!0,r}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}adopt(t,e){this.objects.set(t,e)}mutateIfUnique(t,e){let n=this.objects.get(t);if(n&&n.isShared!==!0)return this.objects.delete(t),this.objects.set(e,n),n}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){let n=this.objects.get(t);e===n?this.unreachable.delete(t):!1&&console.warn("Reachable but deleted",t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},Pv=class extends O2{constructor(e){super();this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,n,r){let s=Aa(e,n,this.flatShading,r);return s.computeBoundingSphere(),s}}});function AV(i){Tw=i}function jf(){return Tw}function CV(i){R2=i}function PV(){if(Tw==="webgpu"){if(MV!==void 0)return MV;_V||(_V=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(R2===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return R2}function Aw(i,t){return PV().createRootMaterial(i,t)}function L2(i,t,e){return PV().createSharedMaterial(i,t,e)}function N2(i){return i.getLayersOfType===void 0&&Object.assign(i,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),i}function OV(i){IV=i}function RV(){let i=Tw==="webgpu"&&TV!==void 0?TV:IV;return i===void 0?null:N2(i())}function Cw(){return fee}function DV(i){D2=i}function LV(i,t){return D2===void 0?!1:D2(i,t)}var Tw,MV,R2,_V,TV,IV,fee,D2,fc=F(()=>{Tw="webgl",_V=!1});var NV,BV=F(()=>{"use strict";NV={markNeedsUpdateRendererDirty:()=>{}}});function Ko(i,t){let e=0;if(!i.layers||i.layers.length===0)return!1;let n=i.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(t.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of i.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let a of r.data.colors)if(a[3]<1){s=a[3];break}}else if(s===1&&r.data.type==="noise"){let a=t.color(r.data.colorA).a,o=t.color(r.data.colorB).a,l=t.color(r.data.colorC).a,c=t.color(r.data.colorD).a,u=Math.min(a,Math.min(o,Math.min(l,c)));u<1&&(s=u)}e+=(1-e)*s}}return e<1}var Pw=F(()=>{"use strict"});function B2(i){let t=typeof i=="string"?i:i.type;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function lo(i){return typeof i=="string"||typeof i=="number"&&i!==0}var Ca,Qe,Hf,FV,Zo=F(()=>{"use strict";Ca=(i,t,e)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof i=="number"?i*100:i,e)??100)/100))??1,Qe=(i,t,e)=>typeof i=="number"?i:t.getVariable(i,e);Hf={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"]},FV={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}});var F2,mee,Yr,eh=F(()=>{"use strict";Y();Ef();F2=class extends wf(Zt){},mee=i=>i.type==="Mesh",Yr=class extends F2{constructor(e){super();this.object=e;this.isClone=!0;this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,n){}expand(){let e=0,n=this.object.entityChildren(e);for(;n;){let r=this.children[e];r?.object!==n&&(r&&this.remove(r),r=new Yr(n),this.add(r),this.children.splice(e,0,this.children.pop()),r.matrixWorldNeedsUpdate=!0,r.matrixAutoUpdate=!1,r.matrix=n.matrix,r.hiddenMatrix=n.hiddenMatrix,r.pivotMatrix=n.pivotMatrix),r.expand(),e+=1,n=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let e=this.object.cloner;return e!==void 0&&this.parent===e&&(e.instancingActive||e.insideBoolean)?!1:this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return mee(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}}});function VV(i){UV=i}function U2(){return UV}function zV(i){kV=i}function GV(){return kV}var UV,kV,Iw=F(()=>{"use strict";UV=null,kV=null});function Ow(i){return"variable_"+i}var jV,HV,WV,vee,qV,k2,V2,_u,uTe,Rw=F(()=>{"use strict";ft();LP();kP();rw();Ta();sw();aw();EV();fc();FP();BV();Pw();Zo();Yi();eh();an();Y();Iw();Qt();jV=new ne,HV=new _,WV=new qe,vee=new _,qV=new Xt,k2=class extends tw{constructor(e){super();this.shared=e}create(e){return new If(e,this.shared)}},V2=class{constructor(t,e={},n=!0,r=!1){this.data=t;this.needsJitter=n;this.enableLocalStorageForPersistentVariables=r;this.geometryCache=new Pv(!0);this.geometryCache2=new Pv(!1);this.imageHolderCache=new k2(this);this.thisContext={scene:NV,shared:this};this.deletedImage=new Ks(E1.emptyImage,this);this.deletedVideo=new Ks(Zp.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;if(e.images)for(let[s,a]of Object.entries(e.images))this.addImage(s,a);if(e.videos)for(let[s,a]of Object.entries(e.videos))this.addVideo(s,a);if(e.audios)for(let[s,a]of Object.entries(e.audios))this.addAudio(s,a);if(e.particles)for(let[s,a]of Object.entries(e.particles))this.addParticle(s,a);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=L2(An.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,n=!1){this.data=t,this.resetLib(t.lib);for(let{id:r,data:s}of t.variables)this.addVariableHolder(r,s),e&&this.updateVariableHolder(r,s);for(let[r,s]of Object.entries(t.userAPIs??{}))this.addUserAPI(r,s);for(let[r,s]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(r,s);if(!n){for(let[r,s]of Object.entries(t.images))this.addImage(r,s);for(let[r,s]of Object.entries(t.videos))this.addVideo(r,s)}for(let[r,s]of Object.entries(t.colors))this.addColor(r,s);for(let[r,s]of Object.entries(t.lib.materials))this.addMaterial(r,s.asset);for(let[r,s]of Object.entries(t.materials))this.addMaterial(r,s);for(let[r,s]of Object.entries(t.audios))this.addAudio(r,s);for(let[r,s]of Object.entries(t.particles))this.addParticle(r,s);for(let[r,s]of Object.entries(t.fonts))this.addFont(r,s);for(let[r,s]of Object.entries(t.timelineAnimations??{}))this.addAnimation(r,s)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:An.defaultTwoLayerData("phong").layers}),this.materials[t]){let n=this.materials[t];n.reset(e,this.thisContext),n.dispose()}else{let n=L2(e,this.thisContext,t);this.materials[t]=n}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){let e=this.materials[t];return e}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):(t.layers===void 0&&(t={...t,layers:An.defaultTwoLayerData("phong").layers}),Aw(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Ks(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Ks(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Ks(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new uc(e.r,e.g,e.b,e.a):this.colors[t]=new uc(e.r,e.g,e.b,1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let n=this.colors[t];return this.colors[t].r=e.r??n.r,this.colors[t].g=e.g??n.g,this.colors[t].b=e.b??n.b,this.colors[t].a=e.a??n.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t=="string"){let n=this.getColor(t);n?e=n:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new yn(0,0,0,0))}else return"a"in t?new yn(t.r,t.g,t.b,t.a):new yn(t.r,t.g,t.b,1);return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof dc)return e;{let n=new dc({src:e.data});return this.audios[t]=n,n}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof dc&&e.dispose(),delete this.audios[t])}addFont(t,e){let n=wk();if(n===null){Jn("text","a font asset");return}this.fonts[t]=new n(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}addAnimation(t,e){this.timelineAnimations[t]=e}getAnimation(t){return this.timelineAnimations[t]}deleteAniamtion(t){this.timelineAnimations[t]&&delete this.timelineAnimations[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof dc&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let n=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let r=localStorage.getItem(Ow(t));n=r!==null?JSON.parse(r):e.value}return this.variables[t]={value:n,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(Ow(t),JSON.stringify(e));let n=e;for(;typeof n=="string";)n=this.variables[n].value;let r=this.entityOpContext.scene,s=!1;for(let a=this.variables[t].locations.length-1;a>=0;a--){let o=this.variables[t].locations[a];if(o[0]==="material"){let l=o[1],c=n,u={scene:r,shared:this},d=o.slice(2);r.traverseMaterial(p=>{let f=p.root??p;f.uuid===l&&f.onVariableUpdate(d,c,u)});let h=this.materials[l];h&&h.onVariableUpdate(d,c,u)}else{let l=r.find(o[0]);if(l===void 0){this.variables[t].locations.splice(a,1);continue}if(s=!0,o[1]!=="geometry"&&o[1]!=="particles"){for(let c=1;c<o.length-1;c++)l=l[o[c]];o[1]==="rotation"?l[o[o.length-1]]=n*we.DEG2RAD:l[o[o.length-1]]=n}if(l=r.find(o[0]),l.type==="ParticleEmitter"&&l.updateVariableState(n,o),Dt.is(l))if(o[1]==="position"||o[1]==="rotation"||o[1]==="scale")l.onVariableUpdate();else if(o[1]==="geometry"){let c=l;l.component&&(c=l.component);let u=c.dataPatched;c.chooseGeoemtryCache(this).forceDelete(u.geometry),c.createGeometryDelayed(this.entityOpContext),c.onVariableUpdate(!0),c.invalidateDownstreamBooleanData(),c.instances.forEach(d=>{let h=d.dataPatched;d.chooseGeoemtryCache(this).forceDelete(h.geometry),d.createGeometryDelayed(this.entityOpContext),d.onVariableUpdate(!0),d.invalidateDownstreamBooleanData()})}else o[1]==="morphTargetInfluences"&&l.updateMorphInfluences(o[2],n)}}return s&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||typeof s.type!="string"||s.type==="VectorGeometry"||s.type==="PathGeometry")return!1;let a=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),o=new Map;for(let u of Object.keys(s))o.set(a(u),u);let l={};for(let[u,d]of Object.entries(e??{})){let h=o.get(a(u));if(h===void 0||h==="type"||h==="font"||h==="shape"||h==="path"||h==="data")continue;if(h==="text"){(typeof d=="string"||typeof d=="number")&&(l[h]={textValue:String(d)});continue}let p=s[h];typeof d=="number"&&isFinite(d)&&(typeof p=="number"||typeof p=="string")&&(l[h]=d)}if(Object.keys(l).length===0)return!1;let c={...s,...l};return n.dataPatched={...r,geometry:c},this.transientGeometryKeys.has(s)&&n.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(c),n.createGeometryDelayed(this.entityOpContext),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let r=e.dataPatched?.geometry;return!r||!this.transientGeometryKeys.has(r)?!1:(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(r),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0)}updateEntityGeometryVertices(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||s.type!=="NonParametricGeometry")return!1;let a=e?.vertices;if(a===void 0||typeof a.length!="number"||a.length<9||a.length%3!==0||a.length/3>V2.MAX_TRANSIENT_VERTICES)return!1;let o=a instanceof Float32Array?a:Float32Array.from(a),l=o.length/3,c;if(e.normals!==void 0){if(e.normals.length!==o.length)return!1;c=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}let u;if(e.uvs!==void 0){if(e.uvs.length!==l*2)return!1;u=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}let d;if(e.indices!==void 0){let E=l>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(E.length===0||E.length%3!==0)return!1;for(let M=0;M<E.length;M++)if(E[M]>=l)return!1;d={array:E,itemSize:1,type:E.constructor.name,normalized:!1}}else{let E=s.data,M=E?.index;if(M?.array?.length){let w=(E?.attributes?.position?.array?.length??0)/3;if(l<w){let T=M.array;for(let A=0;A<T.length;A++)if(T[A]>=l)return!1}d=M}}let h=1/0,p=1/0,f=1/0,m=-1/0,g=-1/0,y=-1/0;for(let E=0;E<o.length;E+=3){let M=o[E],w=o[E+1],T=o[E+2];M<h&&(h=M),M>m&&(m=M),w<p&&(p=w),w>g&&(g=w),T<f&&(f=T),T>y&&(y=T)}let v=(E,M)=>({array:E,itemSize:M,type:"Float32Array",normalized:!1}),b={position:v(o,3)};c&&(b.normal=v(c,3)),u&&(b.uv=v(u,2));let x={...s,width:m-h,height:g-p,depth:y-f,data:{attributes:b,...d?{index:d}:{}}},S=this.transientGeometryKeys.has(s);return n.dataPatched={...r,geometry:x},this.transientGeometryKeys.add(x),n.applyTransientGeometryData(this.entityOpContext,S),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let n=t;n.component&&(n=n.component);let r=n.cloner;if(r===void 0)return-1;let s=r.children,a=Math.PI/180,o=!1;if(e===null)for(let l of s)l.transformOverride!==void 0&&(l.transformOverride=void 0,o=!0);else if(Array.isArray(e)){let l=Math.min(e.length,s.length);for(let c=0;c<l;c++){let u=e[c],d=s[c];if(u==null){d.transformOverride!==void 0&&(d.transformOverride=void 0,o=!0);continue}let h=d.transformOverride??{position:[d.position.x,d.position.y,d.position.z],rotation:[d.rotation.x,d.rotation.y,d.rotation.z],scale:[d.scale.x,d.scale.y,d.scale.z]};u.position&&(typeof u.position.x=="number"&&(h.position[0]=u.position.x),typeof u.position.y=="number"&&(h.position[1]=u.position.y),typeof u.position.z=="number"&&(h.position[2]=u.position.z)),u.rotation&&(typeof u.rotation.x=="number"&&(h.rotation[0]=u.rotation.x*a),typeof u.rotation.y=="number"&&(h.rotation[1]=u.rotation.y*a),typeof u.rotation.z=="number"&&(h.rotation[2]=u.rotation.z*a)),u.scale&&(typeof u.scale.x=="number"&&(h.scale[0]=u.scale.x),typeof u.scale.y=="number"&&(h.scale[1]=u.scale.y),typeof u.scale.z=="number"&&(h.scale[2]=u.scale.z)),d.transformOverride=h,d.position.fromArray(h.position),d.rotation.fromArray(h.rotation),d.scale.fromArray(h.scale),d.updateMatrix(),d.hasNonUniformScale&&(d.updateMatrixWorld(),d.updateMatrixWorldRigid())}}else return s.length;return o?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(n),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),s.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let n=t.parent;if(n===null)return;let r=new Yr(t);r.playModeVisible=e.visible!==!1,r.expand(),typeof e.name=="string"&&(r.name=e.name);let s=Math.PI/180;return r.position.copy(t.position),r.rotation.copy(t.rotation),r.scale.copy(t.scale),r.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(r.position.x=e.position.x),typeof e.position.y=="number"&&(r.position.y=e.position.y),typeof e.position.z=="number"&&(r.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(r.rotation.x=e.rotation.x*s),typeof e.rotation.y=="number"&&(r.rotation.y=e.rotation.y*s),typeof e.rotation.z=="number"&&(r.rotation.z=e.rotation.z*s)),e.scale&&(typeof e.scale.x=="number"&&(r.scale.x=e.scale.x),typeof e.scale.y=="number"&&(r.scale.y=e.scale.y),typeof e.scale.z=="number"&&(r.scale.z=e.scale.z)),r.updateMatrix(),n.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let n=t.material;if(!n)return!1;let r=[];for(let u of Array.isArray(n)?n:[n]){let d=u.root??u;d&&Array.isArray(d.layers)&&d.data&&!r.includes(d)&&r.push(d)}if(r.length===0)return!1;let s={scene:this.entityOpContext.scene,shared:this},a=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),o=u=>{if(typeof u=="string"){let d=new yn(1,1,1,1);try{d.set(u)}catch{return null}return{r:d.r,g:d.g,b:d.b,a:void 0}}if(u&&typeof u=="object"&&"r"in u){let d=u;if([d.r,d.g,d.b].some(p=>typeof p!="number"||!isFinite(p)))return null;let h=Math.max(d.r,d.g,d.b)>1?1/255:1;return{r:d.r*h,g:d.g*h,b:d.b*h,a:typeof d.a=="number"?Math.max(0,Math.min(d.a,1)):void 0}}return null},l=(u,d,h)=>{if(!u.hasValue(d))return!1;let p=u.getValue(d);if(!p||typeof p!="object"||!p.isColor)return!1;let f=h.a??(typeof p.a=="number"?p.a:1);return p instanceof uc?u.setValue(d,new yn(h.r,h.g,h.b,f)):typeof p.setRGBA=="function"?p.setRGBA(h.r,h.g,h.b,f):p.setRGB(h.r,h.g,h.b),!0},c=!1;for(let u of r){let d=u.data.layers??[],h=p=>u.layers.find(f=>f.uuid===p);if(e.color!==void 0){let p=o(e.color),f=d.find(g=>g.data.type==="color"),m=f&&h(f.id);if(p&&m&&l(m,"color",p)&&(c=!0,p.a!==void 0)){let g=p.a<1?!0:Ko(u.data,this);u.setTransparent?u.setTransparent(g,s.scene):u.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(u.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),s),c=!0);for(let p of e.layers??[]){if(!p||typeof p!="object")continue;let f=typeof p.id=="string"?d.find(v=>v.id===p.id):typeof p.index=="number"?d[p.index]:typeof p.type=="string"?d.find(v=>v.data.type===p.type):void 0,m=f&&h(f.id);if(!f||!m)continue;let g=Hf[f.data.type]??[],y=Object.keys(f.data);for(let[v,b]of Object.entries(p)){if(v==="id"||v==="index"||v==="type")continue;let x=y.find(E=>E===v)??y.find(E=>a(E)===a(v))??v;if(g.includes(x))continue;let S=o(b);if(S&&l(m,x,S)){c=!0;continue}if(typeof b=="number"&&isFinite(b))u.onVariableUpdate?.(["layer",f.id,x],b,s),c=!0;else if(Array.isArray(b)&&b.length<=3&&b.every(E=>typeof E=="number"&&isFinite(E))){let E=["x","y","z"];b.forEach((M,w)=>{u.onVariableUpdate?.(["layer",f.id,x,E[w]],M,s)}),c=!0}}}}return c&&this.requestRender(),c}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let n=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return n.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&n?.getPhysicsLocalMatrix?.(jV))return jV.decompose(HV,WV,vee),t[1]==="position"?HV[t[2]]:(qV.setFromQuaternion(WV,n.rotation.order),qV[t[2]]*we.RAD2DEG);for(let r=1;r<t.length;r++)n=n[t[r]];return t[1]==="rotation"&&(n*=we.RAD2DEG),n}for(let n in this.variables){if(e===void 0)break;let r=this.variables[n],s=r.locations?.findIndex(a=>rr.equal(a,e));s!==void 0&&s!==-1&&r.locations.splice(s,1)}if(typeof t=="string"){let n=t,r=t;do{if(r=n,this.variables[n]===void 0)break;let s=this.variables[n].value;e&&this.variables[r]!==void 0&&this.variables[r].locations.push(e),n=s}while(typeof n=="string");return n}else return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,n]of Object.entries(t.images))this.addImage(e,n.asset);for(let[e,n]of Object.entries(t.audios))this.addAudio(e,n.asset);for(let[e,n]of Object.entries(t.particles))this.addParticle(e,n.asset);for(let[e,n]of Object.entries(t.colors))this.addColor(e,n.asset);for(let[e,n]of Object.entries(t.fonts))this.addFont(e,n.asset);for(let[e,n]of Object.entries(t.videos))this.addVideo(e,n.asset);for(let[e,n]of Object.entries(t.variables))this.addVariableHolder(e,n.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,n){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(wr.drop(t,2),e.materials[t.path[1]],{shared:this,scene:n});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,n):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let r=e.userAPIs[t.path[1]];if(r){let s=t.type===0&&t.props.debounce===void 0,a=this.getUserAPI(t.path[1]);a!==void 0&&a===this.openAIRealtime?a.update(r):a?.update(r,this,s)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let r=e.userWebhooks[t.path[1]];r&&this.getUserWebhook(t.path[1])?.update(r)}}else t.path[0]==="lib"&&this.updateLibByOp(wr.drop(t,1),n)}updateFont(t,e,n){if(e.props.url){let r=this.getFont(t),s={...this.data.fonts[t],url:e.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),n.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let n=GV();return n===null?(Jn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=n(e,t,this),!1)}else{let n=U2();return n===null?(Jn("api-services","a user API integration"),!1):(this.userAPIs[t]=n.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let n=U2();return n===null?(Jn("api-services","a user webhook"),!1):(this.userWebhooks[t]=n.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}},_u=V2;_u.MAX_TRANSIENT_VERTICES=6e4;uTe=new _u(os.emptyData())});function Dw(i){return Zd(i)||i?.isTSLNodeMaterial===!0}function XV(i){return nk(i)||i?.isTSLSharedMaterial===!0}var z2=F(()=>{"use strict";Q1()});var _r,Tu=F(()=>{ft();gi();fc();z2();an();mi();_r=class extends Kt{setMaterialOverride(e,n){this.materialOverride=N2(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),n.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,n,r){if(super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.syncShadowCatcher(r),tB(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[s,a]of Object.entries(e.props)){let o=this.material[Number(s)],l=r.shared.material(a);l!==o&&_r.disposeOneMaterial(o),this.material[Number(s)]=l}else if($t(e.path,["material"])){let s=this.material;!Array.isArray(s)&&typeof s?.updateByOp=="function"&&"material"in n&&typeof n.material!="string"&&s.updateByOp(wr.drop(e,1),n.material,r)}else if($t(e.path,["materials","*"])&&Array.isArray(this.material)){let s=e.path[1];if("materials"in n&&s<this.material.length){let a=n.materials[s];typeof a!="string"&&this.material[s].updateByOp(wr.drop(e,2),a,r)}}}get needsAO(){return this.material!==void 0?(Array.isArray(this.material)?this.material[0]:this.material).hasAO:!1}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&!!this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):(this.layers.mask&1<<9)!==0&&this.layers.set(0)}updateState(e,n){super.updateState(e,n),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let r=this.dataPatched;this.syncShapeBlendNodeLayer();let s;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(s={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let a=this.materialOverride!==void 0;!a&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,s),n.scene.markNeedsUpdateRendererDirty()),!a&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(l=>n.shared.material(l).getFlavor(r.flatShading,r.side,r.wireframe)),n.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],n.scene.markNeedsUpdateRendererDirty()));let o=this.data;if(!a&&o.geometry?.type!=="NonParametricGeometry"&&"materials"in o&&o.materials!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(o.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!a&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let l=0;l<this.material.length;l++)this.material[l]=this.material[l].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,s);this.syncShadowCatcher(n)}shadowCatcherActive(){let e=this.dataPatched,n=e.geometry?.type;return e.shadowCatcher===!0&&(n==="RectangleGeometry"||n==="PlaneGeometry")}syncShadowCatcher(e){let n=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let r=RV();if(r===null)return;this.shadowCatcherMaterial=r}this.shadowCatcherMaterial.side=n.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,e.scene.markNeedsUpdateRendererDirty()):"material"in n&&n.material!==void 0&&(this.material=e.shared.material(n.material).getFlavor(n.flatShading,n.side,n.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=n.castShadow,this.receiveShadow=n.receiveShadow)}static disposeOneMaterial(e){Dw(e)&&!XV(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&MS(this.material).forEach(e=>{_r.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}});var YV,$V,KV,bee,ZV,qt,ds=F(()=>{"use strict";ft();an();Rw();Tu();Y();Cv();Jd();_2();YV=new _,$V=new vt,KV=new vt,bee=new _,ZV=new ne,qt=class extends _r{constructor(e,n,r){super(e,n);this.data=n;this.isSkinnedMesh=!1;this.localGeometry=void 0,n.bindMode&&n.bindMatrix&&(this.bindMode=n.bindMode,this.bindMatrix=new ne().fromArray(n.bindMatrix),this.bindMatrixInverse=new ne)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof De&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof De?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof _u){let e=this.geometryCreateDeleyed,n=this.chooseGeoemtryCache(e),r=this.dataPatched.geometry;this.geometryCreateDeleyed=n.get(r,e,this),this._geometryCacheKey=r}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return Wy.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return Wy.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.updateByPatchedOpGeometry(wr.drop(e,1),n.geometry,r)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,n){this.invalidateDownstreamBooleanData();let r=this.data.geometry.type;if(r==="NonParametricGeometry"||r==="SubdivGeometry"){let s=e;if(this.localGeometry===void 0){let p={...this.data.geometry,...s};this.localGeometry=Aa(p,n,this.data.flatShading,this)}let a,o,l;s.scaleBaked?[a,o,l]=s.scaleBaked:{width:a,height:o,depth:l}=s;let c=this.localGeometry.userData,u=typeof a=="number"?a:1,d=typeof o=="number"?o:1,h=typeof l=="number"?l:1;c.sxPrev!==void 0&&Tv(this.localGeometry.attributes,u/c.sxPrev,d/c.syPrev,h/c.szPrev),c.sxPrev=u,c.syPrev=d,c.szPrev=h}else{let s={...this.data.geometry,...e},a=Aa(s,n,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&Sw(this.localGeometry,a)?a.dispose():(this.localGeometry?.dispose(),this.localGeometry=a)}}refreshAttachedClonersInteractions(e){for(let n of this.attachedSurfaceCloners)n.update(e)}refreshAttachedCloners(e){for(let n of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(n.object)}refreshAttachedPaths(e){for(let n of this.attachedPaths)e.scene.addPendingCommand(()=>n.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,n,r){let s=!1;if(e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Xn&&this.chooseGeoemtryCache(r.shared).mutateIfUnique(this.geometryCreateDeleyed.data,n)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(n,e.props.scaleBaked),this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)),!s&&e.type===0&&e.path.length===0&&Mw(e.props)&&this.geometryCreateDeleyed instanceof Xn&&this.chooseGeoemtryCache(r.shared).mutateIfUnique(this.geometryCreateDeleyed.data,n)===this.geometryCreateDeleyed&&(s=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(n),this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)),!s&&e.type===0&&e.path.length===0&&this.geometryCreateDeleyed instanceof De&&!(this.geometryCreateDeleyed instanceof Xn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let a=r.shared,o=this.chooseGeoemtryCache(a),l=this.geometryCreateDeleyed;if(o.getCached(this._geometryCacheKey)===l&&l.isShared!==!0){let u=this.dataPatched.geometry,d=Aa(u,a,this.data.flatShading,this);Sw(l,d)?(d.dispose(),l.computeBoundingSphere(),o.mutateIfUnique(this._geometryCacheKey,u)):(d.computeBoundingSphere(),o.forceDelete(this._geometryCacheKey),o.adopt(u,d),this.geometryCreateDeleyed=d),this._geometryCacheKey=u,s=!0,this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)}}s||(r.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(r)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,n){this.createGeometryDelayed(n)}applyTransientGeometryData(e,n){let r=e.shared,s=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof De&&!(this.geometryCreateDeleyed instanceof Xn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let a=this.chooseGeoemtryCache(r),o=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===o&&o.isShared!==!0){let c=Aa(s,r,this.data.flatShading,this);Sw(o,c)?(c.dispose(),o.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,s)):(c.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(s,c),this.geometryCreateDeleyed=c),this._geometryCacheKey=s,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e);return}}n&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(r).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,n){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,n);let r=e.morphTargetInfluences;if(r){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:s,value:a}}of r)this.updateMorphInfluences(s,n.shared.getVariable(a,[this.uuid,"morphTargetInfluences",s]))}super.updateState(e,n)}updateMorphInfluences(e,n){if(this.morphTargetDictionary===void 0)return;let r=this.morphTargetDictionary[e];r!==void 0&&(this.morphTargetInfluences[r]=n)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;this.is2DType?e.set(0,0,r.depth*.5):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)):r.centerOffset?e.fromArray(r.centerOffset):e.setScalar(0),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,n){this.skeleton=e,this.isSkinnedMesh=!0,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let n=new vt,r=this.geometry.attributes.skinWeight;for(let s=0,a=r.count;s<a;s++){n.fromBufferAttribute(r,s);let o=1/n.manhattanLength();o!==1/0?n.multiplyScalar(o):n.set(1,0,0,0),r.setXYZW(s,n.x,n.y,n.z,n.w)}}boneTransform(e,n){let r=this.skeleton;if(r===void 0)return;let s=this.geometry;$V.fromBufferAttribute(s.attributes.skinIndex,e),KV.fromBufferAttribute(s.attributes.skinWeight,e),YV.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let a=0;a<4;a++){let o=KV.getComponent(a);if(o!==0){let l=$V.getComponent(a);ZV.multiplyMatrices(r.bones[l].matrixWorld,r.boneInverses[l]),n.addScaledVector(bee.copy(YV).applyMatrix4(ZV),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}});function xee(i){if(i.geometry.attributes.extrudeNormal||!i.geometry.attributes.position||!i.geometry.attributes.normal)return;let t=new Map,e=i.geometry.attributes,n=e.position.array,r=e.normal.array,s=new Float32Array(n.length);for(let a=0;a<n.length;a+=3){let o=`${n[a]}_${n[a+1]}_${n[a+2]}`,l=new _(r[a],r[a+1],r[a+2]);t.has(o)?t.get(o)?.normals.push(l):t.set(o,{normals:[l],result:new _})}t.forEach((a,o)=>{for(let l of a.normals)a.result.add(l);a.result.divideScalar(a.normals.length)});for(let a=0;a<n.length;a+=3){let o=`${n[a]}_${n[a+1]}_${n[a+2]}`,l=t.get(o)?.result;l&&(s[a]=l.x,s[a+1]=l.y,s[a+2]=l.z)}i.geometry.setAttribute("extrudeNormal",new Ve(s,3))}function See(i){if(i.geometry.attributes.extrudeNormals||!i.geometry.attributes.position)return;let e=i.geometry.attributes.position.array,n=new Float32Array(e.length),r=new _;for(let s=0;s<e.length;s+=3)r.set(e[s],e[s+1],e[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;i.geometry.setAttribute("extrudeNormal",new Ve(n,3))}function Qo(i){if(Array.isArray(i.material)){for(let t of i.material)if(t.getLayersOfType("outline").length===0)return}else if(!Zd(i.material)||i.material.getLayersOfType("outline").length===0)return;i instanceof qt&&i.is2DAndNoDepth?See(i):xee(i)}function G2(i){return Math.min(2047,Math.max(1,Math.round(i*2048)))/2048}function Jo(i){if(!i.geometry.attributes.position)return;let t=i.geometry.attributes,e=t.position.array,n=t.randomColor;if(n!==void 0&&n.count*3===e.length)return;let r=new Float32Array(e.length),s=parseInt(i.uuid.replace(/\D/g,"")),a=[G2(we.seededRandom(s)),G2(we.seededRandom(s+1e4)),G2(we.seededRandom(s+2e4))];for(let o=0;o<e.length;o++)r[o]=a[o%3];i.geometry.setAttribute("randomColor",new je(r,3))}var Iv=F(()=>{"use strict";Y();Q1();ds()});function H2(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function Eee(i,t){let e=i.cloner;return e!==void 0&&e.parent===t?e:void 0}function ez(i,t,e,n){let r=(t.children.length+1)*16;Nw.length<r&&(Nw=new Float32Array(r));let s=0,a=l=>{l.toArray(Nw,s*16),s++},o=t.parameters.hideBase!==!0;o&&a(n),QV.multiplyMatrices(i.hiddenMatrix,i.matrix);for(let l of t.children)!Wo(l)||l.playModeVisible===!1||(JV.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),j2.multiplyMatrices(QV,JV),!(o&&j2.equals(n))&&a(j2));try{return s===0?0:QU(e,Nw.subarray(0,s*16))}finally{K1(e)}}var Au,wee,QV,JV,j2,Nw,Cs,qf=F(()=>{gi();Y();cv();Iv();Tu();fr();Au=new ne,wee=new ne,QV=new ne,JV=new ne,j2=new ne;Nw=new Float32Array(0);Cs=class extends _r{constructor(e,n,r){super(e,n);this.data=n;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.geometry=new De;this.onAfterRender=(e,n,r,s,a,o)=>{super.onAfterRender(e,n,r,s,a,o),this.recomputeBoolean()};this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,n=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let s=0;s<this.children.length;s++){let a=this.children[s];a instanceof Cs&&a.dataPatched.visible===!0&&a.recomputeBoolean(e===!0,n)}this.meshSetAddresses=[];for(let s=0;s<this.children.length;s++){let a=this.children[s];if(a instanceof Kt&&a.dataPatched.visible===!0&&a.geometry.attributes.position?.count>0&&a.geometry.drawRange.count>0&&a.booleanMeshSetAddress!==0){Au.multiplyMatrices(a.hiddenMatrix,a.matrix).multiply(a.pivotMatrix);try{let o=Eee(a,this);if(a.booleanMeshSetAddress===-1){if((a.geometry.index??a.geometry.getAttribute("position")).count/3<15e5){let l=YU(a.geometry,e===!0,n);a.booleanMeshSetAddress=o===void 0||l===-1?l:ez(a,o,l,Au)}if(a.booleanMeshSetAddress===-1)return;o===void 0&&$1(a.booleanMeshSetAddress,Au),a.booleanMatrixInvOld.copy(Au).invert(),a.booleanWasTransformed=!1}else a instanceof Cs&&a.needsTransformForDownstream===!0?(o===void 0?$1(a.booleanMeshSetAddress,Au):a.booleanMeshSetAddress=ez(a,o,a.booleanMeshSetAddress,Au),a.needsTransformForDownstream=!1):a.booleanWasTransformed===!0&&($1(a.booleanMeshSetAddress,wee.multiplyMatrices(Au,a.booleanMatrixInvOld)),a.booleanMatrixInvOld.copy(Au).invert(),a.booleanWasTransformed=!1)}catch(o){console.error(o),a.booleanMeshSetAddress=0,a.geometry.userData.booleanOperationDidFail=!0;continue}if(a.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(a.booleanMeshSetAddress),a.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let s=this.geometry;s.dispose(),this.geometry=new De,this.geometry.userData=s.userData,this.geometry.boundingSphere=s.boundingSphere,this.geometry.setAttribute("position",new Ve([],3))}this.geometry.setDrawRange(0,0);return}if(e===!0)return ZU(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new De,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=KU(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(s){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(s)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Qo(this),Jo(this)}dispose(){super.dispose(),this.geometry.dispose()}}});var Xf,Yf,$f=F(()=>{Y();Yi();Su();(t=>{function i(e){return Dt.is(e)&&e instanceof ql}t.is=i})(Xf||(Xf={}));Yf=(i,t)=>class extends Ma(i,t){updateState_Light(n,r){if(this.updateState_Entity(n,r),n.color!==void 0&&(this.color=r.shared.color(n.color)),n.intensity!==void 0&&(this.intensity=n.intensity*Math.PI),n.depth!==void 0){let s=this.shadow;s.camera.far=n.depth,s.needsUpdate=!0}n.shadows!==void 0&&(this.castShadow=n.shadows)}}});var Ps,hs,Ov,mc=F(()=>{qf();gi();Su();Ps=i=>i instanceof Kt,hs=i=>i!==null&&i instanceof Cs,Ov=i=>z1.is(i)});function Fee(i,t){try{let e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(i),n=r=>Number(e.find(s=>s.type===r)?.value);return new Date(n("year"),n("month")-1,n("day"),n("hour"),n("minute"),n("second"),i.getMilliseconds())}catch{return new Date(NaN)}}function vi(i,t){return t.color(i)}function Y2(i=new Date,t){let e=t.format,n=i.getSeconds(),r=i;t&&t.timeZone!==null&&(r=Fee(new Date,t.timeZone));let s=r.getHours(),a=r.getMinutes(),o;t.format12h24h==="12ampm"&&(o=s>=12?"PM":"AM");let l=s;t.format12h24h!=="24"&&(l=s%12,l===0&&(l=12));let c,u;switch(e){case"HH:mm:ss":c=[l,a,n];break;case"HH:mm":c=[l,a];break;case"HH":c=[l],o=void 0;break;case"mm":c=[a],o=void 0;break;case"ss":c=[n],o=void 0;break;case"year":u=r.getFullYear();break;case"month":u=r.getMonth()+1;break;case"dayOfYear":u=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=r.getDate();break;case"secondOfDay":u=s*60*60+a*60+n;break;default:console.error("Unknown time format",e),u=0;break}return c!==void 0?{textValue:c,suffix:o}:u}var kw=F(()=>{"use strict"});var Qf,cz=F(()=>{"use strict";Y();yf();vf();Qf=class extends jo(fy){constructor(e,n=15,r=10066329){super(e,n,r);this.object=e;this.added=!1;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,n){Ho(this.object,Qf.geometryHelper,e,n)}}});function Uee(i,t){i.shadow.camera.right=t/2,i.shadow.camera.left=-t/2,i.shadow.camera.top=t/2,i.shadow.camera.bottom=-t/2,i.shadow.needsUpdate=!0}var tl,Dv=F(()=>{"use strict";Y();cz();$f();tl=class extends Yf(cy,Qf){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.top=1250,s.bottom=-1250,s.right=1250,s.left=-1250,s.near=-1e4,s.far=2500;let a=new Yl(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Yl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let n=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&Uee(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),n&&this.update()}}});function K2(i){return i instanceof _r&&i.needsAO&&!Ts(i)&&i.isDecalObject!==!0}function Z2(i){let t=i.cloner;if(!(!t||!Array.isArray(t.children)))for(let e of t.children)e?.layers&&(e.layers.mask=i.layers.mask)}function Q2(i){return i.getLayersOfType("reflection").filter(t=>t.data.visible).length}function uz(i,t){let e={outline:!1,cavity:!1},n=i.layers.mask&$2,r=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),a=Q2(t),o=t.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(i.layers.set(8),r.length>0&&i.layers.enable(3),a>0&&i.layers.enable(4),e.outline=s.length>0,e.cavity=o.length>0,Jo(i),Qo(i)),r.length===0&&s.length===0&&o.length===0&&a===0&&i.layers.set(0),n&&i.layers.set(9),!n&&K2(i)&&i.layers.enable(5),Z2(i),e}function dz(i,t){if(!t.layers)return!1;let e=i.layers.mask&$2,n=!1,r=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),a=Q2(t),o=t.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(i.layers.set(3),(s.length>0||o.length>0)&&i.layers.enable(8),a>0&&i.layers.enable(4),n=!0),r.length===0&&s.length===0&&o.length===0&&a===0&&i.layers.set(0),e&&i.layers.set(9),!e&&K2(i)&&i.layers.enable(5),Z2(i),n}function hz(i,t){var l;if(!t.layers)return!1;let e=i.layers.mask&$2,n=!1,r=Q2(t),s=t.getLayersOfType("transmission").filter(c=>c.data.visible),a=t.getLayersOfType("outline").filter(c=>c.data.visible),o=t.getLayersOfType("cavity").filter(c=>c.data.visible);return r>0&&((l=i.userData).__splinePlanarMirror??(l.__splinePlanarMirror=0),i.layers.set(4),s.length>0&&i.layers.enable(3),(a.length>0||o.length>0)&&i.layers.enable(8),n=!0),r===0&&s.length===0&&a.length===0&&o.length===0&&i.layers.set(0),e&&i.layers.set(9),!e&&K2(i)&&i.layers.enable(5),Z2(i),n}function fz(i){let t={outline:!1,cavity:!1},e=n=>{t.outline=t.outline||n.outline,t.cavity=t.cavity||n.cavity};return i.traverseEntity(n=>{if(n instanceof _r)if(Array.isArray(n.material))for(let r=0;r<n.material.length;r++)e(uz(n,n.material[r]));else e(uz(n,n.material))}),t}function mz(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof _r)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)dz(e,e.material[n])&&(t=!0);else dz(e,e.material)&&(t=!0)}),t}function gz(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof _r)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)hz(e,e.material[n])&&(t=!0);else hz(e,e.material)&&(t=!0)}),t}function Lv(i,t,e,n=!1){let r=i.cloner;if(r){let s=null;if(i.raycast===Ht.prototype.raycast||i.raycast===Kt.prototype.raycast){let a=i.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of r.children){if(s!==null&&(pz.copy(s).applyMatrix4(a.matrixWorld),!t.ray.intersectsSphere(pz)))continue;let o=Vee.copy(a.matrixWorld).invert(),l=zee.copy(t.ray).applyMatrix4(o),c=i.matrixWorld;l.applyMatrix4(c);let u=kee;u.set(l.origin,l.direction),u.near=t.near,u.far=t.far,u.layers.mask=t.layers.mask;let d=u.intersectObject(i,!1);d.length>0&&e.push({...d[0],object:n?a:i})}}}var $2,kee,Vee,zee,pz,J2=F(()=>{"use strict";fr();Iv();gi();Tu();Y();$2=1<<9;kee=new Td,Vee=new ne,zee=new Wi,pz=new nr});var zw,Nv,yz=F(()=>{"use strict";Y();yf();vf();zw=class extends jo(hy){constructor(e,n=6710886){super(e,n);this.object=e;this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,n){Ho(this.object,zw.geometryHelper,e,n)}update(){if(this.object!==void 0){let e=zw._vector,n=this.object.distance?this.object.distance:1e3,r=n*Math.tan(this.object.angle);this.cone.scale.set(r,r,n),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let a=0,o=this.cone.material.length;a<o;a++)this.cone.material[a].color.set(s);else this.cone.material.color.set(s)}}},Nv=zw;Nv._vector=new _});var vz,bz,xz,nl,Bv=F(()=>{"use strict";Y();yz();$f();vz=new _,bz=new _,xz=new qe,nl=class extends Yf(oy,Nv){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.fov=we.RAD2DEG*2*this.angle,s.aspect=1,s.near=100,s.far=2500;let a=new Yl(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Yl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),bz.setFromMatrixPosition(this.matrixWorld),xz.setFromRotationMatrix(this.matrixWorld),vz.copy(this.up).applyQuaternion(xz).negate().multiplyScalar(this.distance),this.target.position.copy(bz).add(vz),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});var Cn,rl=F(()=>{ft();$s();Y();Yi();Ta();kw();Go();Dv();an();fc();Y();Tu();mc();J2();Bv();Qt();qf();Cn=class extends Tf(hr){constructor(e,n,r){super();this.data=n;this.bgColor=new yn(1,1,1,1);this.fog=null;this.backupFog=new hd(16777215,.1,2e3);this.fogUseBGColor=!1;this.fogMode="linear";this.fogDensity=Fr.getDensity({});this.fogHeightFalloff=Fr.getHeightFalloff({});this.fogHeightBase=Fr.getHeightBase({});this.isActive=!1;this.skyState=null;this.skyStateVersion=0;this.gradingState=null;this.skyHdriHolder=null;this.aoColor=new Ze;this.penumbraSizeArrayCache=null;if(this.super_Entity(e,n),this.personalCamera=new on(fa,{...Hd.defaultData,...n.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new sy(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),n.uiScene){let s=tv();s===null?Jn("ui-2d","a page's 2D scene"):this.uiScene=new s.Scene2D((Array.isArray(e)?e[0]:e)+"-ui",n.uiScene,{dpr:window.devicePixelRatio,shared:r.shared})}else n.uiFrame&&this.createUICanvas(n.uiFrame,r)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,n){let r=tv();if(r===null){Jn("ui-2d","a page's UI canvas");return}this.uiCanvas=new r.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,n),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,n){e.color!==void 0&&(this.ambientLight.color=vi(e.color,n)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(n=>{n instanceof Cs&&n.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof _r)if(Array.isArray(e.material))for(let n of e.material)n.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){if(e.softShadowQuality===void 0&&e.type===void 0||!this.isActive)return;let n=this.data.shadow,r=jd.isSoft(n);LV(r,n?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,n){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let r=this.scene;r.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=vi(e.color,n),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=Fr.getMode(e),this.fogDensity=Fr.getDensity(e),this.fogHeightFalloff=Fr.getHeightFalloff(e),this.fogHeightBase=Fr.getHeightBase(e)}updateSky(e,n){this.skyState=e??null,this.skyStateVersion++;let r=e?.hdri?.image;this.skyHdriHolder=r!=null?n.image(r):null}updateAo(e,n){e.aoColor!==void 0&&(this.aoColor=vi(e.aoColor,n))}updateByOp(e,n,r,s){let a=this.data.uiFrame;super.updateByOp(e,n,r,s);let o=n;$t(e.path,["fog"])?this.updateFog(o.fog,r.shared):$t(e.path,["sky"])?this.updateSky(o.sky,r.shared):$t(e.path,["grading"])?this.gradingState=o.grading??null:$t(e.path,["ao"])?this.updateAo(o.ao,r.shared):$t(e.path,["ambient"])?this.updateAmbientLight(o.ambient,r.shared):$t(e.path,["shadow"])?this.updateShadow(o.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||a!==o.uiFrame)&&this.updateUIFrame(e.props.uiFrame,r)}updateUIFrame(e,n){e?(this.uiCanvas||this.createUICanvas(e,n),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,n){this.updateState_Entity(e,n),e.backgroundColor!==void 0&&this.setBackgroundColor(vi(e.backgroundColor,n.shared)),e.fog!==void 0&&this.updateFog(e.fog,n.shared),e.sky!==void 0&&this.updateSky(e.sky,n.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,n.shared),e.ao!==void 0&&this.updateAo(e.ao,n.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,n){}raycast(e,n){super.raycast(e,n)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(cs).fill(.5);let e=0,n=0;this.traverseEntity(r=>{if(!r.visible)return!0;r instanceof tl&&r.visible&&e<gf&&(this.penumbraSizeArrayCache[e]=r.data.penumbraSize??.5,e+=1),r instanceof nl&&r.visible&&e<cs-gf&&(this.penumbraSizeArrayCache[gf+n]=r.data.penumbraSize??.5,n+=1)})}raycastWithClones(e){let n=[],r=s=>{for(let a of s.children){let o=a.cloner;Dt.is(a)&&(a.visible||o?.object.data.visible)&&((Ps(a)||Ov(a)&&this.scene.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,n),Lv(a,e,n,!0)),r(a))}};return r(this),n}updateEntity2DByOp(e,n,r,s){this.uiCanvas?.updateEntity2DByOp(e,n,r,s)}}});function oI(){return ete}function Gz(i){aI=i}function Zw(){if(aI===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return aI}function Qw(i){return i?.isWebGPUSplineRenderer===!0}var ete,aI,lI=F(()=>{"use strict";ete=null,aI=null});var al,aE=F(()=>{"use strict";Y();Zy();Su();al=class extends Ma(Us,ba){constructor(e,n,r){super();this.super_Entity(e,n),this.context=r,this.objectHelper.update()}updateState(e,n){this.updateState_Entity(e,n)}}});var eG=Uh((pI,Jz)=>{(function(i,t){typeof pI=="object"?Jz.exports=t():typeof define=="function"&&define.amd?define(t):i.Alea=t()})(pI,function(){"use strict";return i.importState=function(e){var n=new i;return n.importState(e),n},i;function i(){return function(e){var n=0,r=0,s=0,a=1;e.length==0&&(e=[+new Date]);var o=t();n=o(" "),r=o(" "),s=o(" ");for(var l=0;l<e.length;l++)n-=o(e[l]),n<0&&(n+=1),r-=o(e[l]),r<0&&(r+=1),s-=o(e[l]),s<0&&(s+=1);o=null;var c=function(){var u=2091639*n+a*23283064365386963e-26;return n=r,r=s,s=u-(a=u|0)};return c.next=c,c.uint32=function(){return c()*4294967296},c.fract53=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.version="Alea 0.9",c.args=e,c.exportState=function(){return[n,r,s,a]},c.importState=function(u){n=+u[0]||0,r=+u[1]||0,s=+u[2]||0,a=+u[3]||0},c}(Array.prototype.slice.call(arguments))}function t(){var e=4022871197,n=function(r){r=r.toString();for(var s=0;s<r.length;s++){e+=r.charCodeAt(s);var a=.02519603282416938*e;e=a>>>0,a-=e,a*=e,e=a>>>0,a-=e,e+=a*4294967296}return(e>>>0)*23283064365386963e-26};return n.version="Mash 0.9",n}})});function sG(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var ll,qv,ho,rm=F(()=>{gi();Y();Jd();Iv();ds();ll=new Bt,qv=new _;ho=class extends qt{constructor(e,n,r){super(e,n,r);this.data=n;this.hiddenMatrixOld=new ne;this.smoothShading=!0;this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:s,subdivPointer:a}=Xn.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=a,r!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=r),s!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=s??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qo(this),Jo(this),this.calcBoundingBox(),n&&(this.localGeometry.uuid=n)}updateState(e,n){if(super.updateState(e,n),e.flatShading!==void 0){let r=this.material;this.material=Array.isArray(r)?r.map(s=>s.getFlavor(!1,s.side,s.wireframe)):r.getFlavor(!1,r.side,r.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(n)}}updateMesh(e=!1,n=!1,r=!1){n&&this.subdividedGeometry||Xn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0,r),this.subdividedGeometry&&Xn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){let e=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Xn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Xn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qo(this),Jo(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}raycast(e,n){let r=this.localGeometry;this.localGeometry=this.originalGeometryNew,Kt.prototype.raycast.call(this,e,n),this.localGeometry=r}activateShearCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateShearCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new nr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let n=e.attributes.position,r=e.boundingSphere.center;ll.setFromBufferAttribute(n),ll.getCenter(r),e.boundingSphere.radius=r.distanceTo(ll.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ll.getSize(qv),this.hasNonUniformScale&&qv.divide(this.scale);let s={width:qv.x,height:qv.y,depth:qv.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let n=this.originalGeometry;ll.min.set(e[0],e[2],e[4]),ll.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(ll.min.applyMatrix4(this.shearScaleInv),ll.max.applyMatrix4(this.shearScaleInv)),n.boundingSphere===null&&(n.boundingSphere=new nr);let r=n.boundingSphere.center;ll.getCenter(r),n.boundingSphere.radius=r.distanceTo(ll.max)}freeSubdivPointer(){this.subdivPointer&&(Xn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry,r=n?.uuid,s=n?.userData.parameters,a=e.subdivisions>0?Xn.buildRefined(this.subdivPointer,e.subdivisions,this.smoothShading?e.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=a??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qo(this),Jo(this),s!==void 0&&(this.localGeometry.userData.parameters=s),r&&(this.localGeometry.uuid=r)}updateByPatchedOpGeometry(e,n,r){super.updateByPatchedOpGeometry(e,n,r),this.localGeometry&&(e.type===0&&e.path.length===0&&Mw(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(n):this.createGeometryByControls(n))}}});function Kv(i){if(i.component){let t=i.component.instances.indexOf(i);t>=0&&i.component.instances.splice(t,1);for(let e of i.children)Dt.is(e)&&Kv(e)}}var TI=F(()=>{"use strict";Yi()});var ZG=Uh((eDe,KG)=>{"use strict";function Ute(i,t){function e(){this.constructor=i}e.prototype=t.prototype,i.prototype=new e}function ch(i,t,e,n){this.message=i,this.expected=t,this.found=e,this.location=n,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ch)}Ute(ch,Error);ch.buildMessage=function(i,t){var e={literal:function(c){return'"'+r(c.text)+'"'},class:function(c){var u="",d;for(d=0;d<c.parts.length;d++)u+=c.parts[d]instanceof Array?s(c.parts[d][0])+"-"+s(c.parts[d][1]):s(c.parts[d]);return"["+(c.inverted?"^":"")+u+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function n(c){return c.charCodeAt(0).toString(16).toUpperCase()}function r(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function s(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function a(c){return e[c.type](c)}function o(c){var u=new Array(c.length),d,h;for(d=0;d<c.length;d++)u[d]=a(c[d]);if(u.sort(),u.length>0){for(d=1,h=1;d<u.length;d++)u[d-1]!==u[d]&&(u[h]=u[d],h++);u.length=h}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}function l(c){return c?'"'+r(c)+'"':"end of input"}return"Expected "+o(i)+" but "+l(t)+" found."};function kte(i,t){t=t!==void 0?t:{};var e={},n={svg_path:Z},r=Z,s=function(R){if(!R)return[];for(var N=[],H=0;H<R.length;H++)N=N.concat.apply(N,R[H]);var V=N[0];return V&&V.code=="m"&&(delete V.relative,V.code="M"),N},a=function(R,N){return at(R,N)},o=/^[Mm]/,l=ue(["M","m"],!1,!1),c=function(R,N,H){var V=dt(R,[N]);return H&&(V=V.concat(dt(R=="M"?"L":"l",H[1]))),V},u=/^[Zz]/,d=ue(["Z","z"],!1,!1),h=function(){return dt("Z")},p=/^[Ll]/,f=ue(["L","l"],!1,!1),m=function(R,N){return dt(R,N)},g=/^[Hh]/,y=ue(["H","h"],!1,!1),v=function(R,N){return dt(R,N.map(function(H){return{x:H}}))},b=/^[Vv]/,x=ue(["V","v"],!1,!1),S=function(R,N){return dt(R,N.map(function(H){return{y:H}}))},E=/^[Cc]/,M=ue(["C","c"],!1,!1),w=function(R,N,H){return{x1:R.x,y1:R.y,x2:N.x,y2:N.y,x:H.x,y:H.y}},T=/^[Ss]/,A=ue(["S","s"],!1,!1),C=function(R,N){return{x2:R.x,y2:R.y,x:N.x,y:N.y}},P=/^[Qq]/,D=ue(["Q","q"],!1,!1),I=function(R,N){return{x1:R.x,y1:R.y,x:N.x,y:N.y}},L=/^[Tt]/,U=ue(["T","t"],!1,!1),G=/^[Aa]/,X=ue(["A","a"],!1,!1),ae=function(R,N,H,V,Q,Pe){return{rx:R,ry:N,xAxisRotation:H,largeArc:V,sweep:Q,x:Pe.x,y:Pe.y}},ee=function(R,N){return{x:R,y:N}},$=function(R){return R*1},K=function(R){return R.join("")*1},re=/^[01]/,fe=ue(["0","1"],!1,!1),ve=function(R){return R=="1"},de=function(){return""},Se=",",oe=Fe(",",!1),be=function(R){return R.join("")},Oe=".",Le=Fe(".",!1),ke=/^[eE]/,Ce=ue(["e","E"],!1,!1),ce=/^[+\-]/,ye=ue(["+","-"],!1,!1),Me=/^[0-9]/,Ne=ue([["0","9"]],!1,!1),He=function(R){return R.join("")},_e=/^[ \t\n\r]/,Re=ue([" "," ",`
4135
4135
  `,"\r"],!1,!1),B=0,me=0,W=[{line:1,column:1}],et=0,Ge=[],z=0,O;if("startRule"in t){if(!(t.startRule in n))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');r=n[t.startRule]}function q(){return i.substring(me,B)}function J(){return Xe(me,B)}function le(R,N){throw N=N!==void 0?N:Xe(me,B),kt([xt(R)],i.substring(me,B),N)}function xe(R,N){throw N=N!==void 0?N:Xe(me,B),yt(R,N)}function Fe(R,N){return{type:"literal",text:R,ignoreCase:N}}function ue(R,N,H){return{type:"class",parts:R,inverted:N,ignoreCase:H}}function Te(){return{type:"any"}}function Ke(){return{type:"end"}}function xt(R){return{type:"other",description:R}}function Je(R){var N=W[R],H;if(N)return N;for(H=R-1;!W[H];)H--;for(N=W[H],N={line:N.line,column:N.column};H<R;)i.charCodeAt(H)===10?(N.line++,N.column=1):N.column++,H++;return W[R]=N,N}function Xe(R,N){var H=Je(R),V=Je(N);return{start:{offset:R,line:H.line,column:H.column},end:{offset:N,line:V.line,column:V.column}}}function rt(R){B<et||(B>et&&(et=B,Ge=[]),Ge.push(R))}function yt(R,N){return new ch(R,null,null,N)}function kt(R,N,H){return new ch(ch.buildMessage(R,N),R,N,H)}function Z(){var R,N,H,V,Q;for(R=B,N=[],H=te();H!==e;)N.push(H),H=te();if(N!==e)if(H=Ye(),H===e&&(H=null),H!==e){for(V=[],Q=te();Q!==e;)V.push(Q),Q=te();V!==e?(me=R,N=s(H),R=N):(B=R,R=e)}else B=R,R=e;else B=R,R=e;return R}function Ye(){var R,N,H,V,Q,Pe;if(R=B,N=Ae(),N!==e){for(H=[],V=B,Q=[],Pe=te();Pe!==e;)Q.push(Pe),Pe=te();for(Q!==e?(Pe=Ae(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);V!==e;){for(H.push(V),V=B,Q=[],Pe=te();Pe!==e;)Q.push(Pe),Pe=te();Q!==e?(Pe=Ae(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e)}H!==e?(me=R,N=a(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function Ae(){var R,N,H,V,Q,Pe;if(R=B,N=ot(),N!==e){for(H=[],V=B,Q=[],Pe=te();Pe!==e;)Q.push(Pe),Pe=te();for(Q!==e?(Pe=$e(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);V!==e;){for(H.push(V),V=B,Q=[],Pe=te();Pe!==e;)Q.push(Pe),Pe=te();Q!==e?(Pe=$e(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e)}H!==e?(me=R,N=a(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function $e(){var R;return R=Ue(),R===e&&(R=St(),R===e&&(R=br(),R===e&&(R=ia(),R===e&&(R=sa(),R===e&&(R=ax(),R===e&&(R=ox(),R===e&&(R=_g(),R===e&&(R=ux())))))))),R}function ot(){var R,N,H,V,Q,Pe,zn;if(R=B,o.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(l)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Jr(),V!==e?(Q=B,Pe=tr(),Pe===e&&(Pe=null),Pe!==e?(zn=pt(),zn!==e?(Pe=[Pe,zn],Q=Pe):(B=Q,Q=e)):(B=Q,Q=e),Q===e&&(Q=null),Q!==e?(me=R,N=c(N,V,Q),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function Ue(){var R,N;return R=B,u.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(d)),N!==e&&(me=R,N=h()),R=N,R}function St(){var R,N,H,V;if(R=B,p.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(f)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=pt(),V!==e?(me=R,N=m(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function pt(){var R,N,H,V,Q,Pe;if(R=B,N=Jr(),N!==e){for(H=[],V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Jr(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Jr(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);H!==e?(me=R,N=a(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function br(){var R,N,H,V;if(R=B,g.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(y)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Vn(),V!==e?(me=R,N=v(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function Vn(){var R,N,H,V,Q,Pe;if(R=B,N=Tl(),N!==e){for(H=[],V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Tl(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Tl(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);H!==e?(me=R,N=a(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function ia(){var R,N,H,V;if(R=B,b.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(x)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Vn(),V!==e?(me=R,N=S(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function sa(){var R,N,H,V;if(R=B,E.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(M)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=mT(),V!==e?(me=R,N=m(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function mT(){var R,N,H,V,Q,Pe;if(R=B,N=wg(),N!==e){for(H=[],V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=wg(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=wg(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);H!==e?(me=R,N=a(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function wg(){var R,N,H,V,Q,Pe;return R=B,N=Jr(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=Jr(),V!==e?(Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Jr(),Pe!==e?(me=R,N=w(N,V,Pe),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function ax(){var R,N,H,V;if(R=B,T.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(A)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Eg(),V!==e?(me=R,N=m(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function Eg(){var R,N,H,V,Q,Pe;if(R=B,N=Mg(),N!==e){for(H=[],V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Mg(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Mg(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);H!==e?(me=R,N=a(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function Mg(){var R,N,H,V;return R=B,N=Jr(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=Jr(),V!==e?(me=R,N=C(N,V),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function ox(){var R,N,H,V;if(R=B,P.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(D)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=lx(),V!==e?(me=R,N=m(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function lx(){var R,N,H,V,Q,Pe;if(R=B,N=ka(),N!==e){for(H=[],V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=ka(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=ka(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);H!==e?(me=R,N=a(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function ka(){var R,N,H,V;return R=B,N=Jr(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=Jr(),V!==e?(me=R,N=I(N,V),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function _g(){var R,N,H,V;if(R=B,L.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(U)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=cx(),V!==e?(me=R,N=m(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function cx(){var R,N,H,V,Q,Pe;if(R=B,N=Jr(),N!==e){for(H=[],V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Jr(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Jr(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);H!==e?(me=R,N=a(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function ux(){var R,N,H,V;if(R=B,G.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(X)),N!==e){for(H=[],V=te();V!==e;)H.push(V),V=te();H!==e?(V=Lh(),V!==e?(me=R,N=m(N,V),R=N):(B=R,R=e)):(B=R,R=e)}else B=R,R=e;return R}function Lh(){var R,N,H,V,Q,Pe;if(R=B,N=Nh(),N!==e){for(H=[],V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Nh(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);V!==e;)H.push(V),V=B,Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Nh(),Pe!==e?(Q=[Q,Pe],V=Q):(B=V,V=e)):(B=V,V=e);H!==e?(me=R,N=a(N,H),R=N):(B=R,R=e)}else B=R,R=e;return R}function Nh(){var R,N,H,V,Q,Pe,zn,_n,Gr,ct,_i,nn;return R=B,N=Tg(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=Tg(),V!==e?(Q=tr(),Q===e&&(Q=null),Q!==e?(Pe=Tl(),Pe!==e?(zn=tr(),zn!==e?(_n=dx(),_n!==e?(Gr=tr(),Gr===e&&(Gr=null),Gr!==e?(ct=dx(),ct!==e?(_i=tr(),_i===e&&(_i=null),_i!==e?(nn=Jr(),nn!==e?(me=R,N=ae(N,V,Pe,_n,ct,nn),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function Jr(){var R,N,H,V;return R=B,N=Tl(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(V=Tl(),V!==e?(me=R,N=ee(N,V),R=N):(B=R,R=e)):(B=R,R=e)):(B=R,R=e),R}function Tg(){var R,N;return R=B,N=px(),N===e&&(N=he()),N!==e&&(me=R,N=$(N)),R=N,R}function Tl(){var R,N,H,V;return R=B,N=B,H=ge(),H===e&&(H=null),H!==e?(V=px(),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e),N===e&&(N=B,H=ge(),H===e&&(H=null),H!==e?(V=he(),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e)),N!==e&&(me=R,N=K(N)),R=N,R}function dx(){var R,N;return R=B,re.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(fe)),N!==e&&(me=R,N=ve(N)),R=N,R}function tr(){var R,N,H,V,Q;if(R=B,N=[],H=te(),H!==e)for(;H!==e;)N.push(H),H=te();else N=e;if(N!==e)if(H=hx(),H===e&&(H=null),H!==e){for(V=[],Q=te();Q!==e;)V.push(Q),Q=te();V!==e?(N=[N,H,V],R=N):(B=R,R=e)}else B=R,R=e;else B=R,R=e;if(R===e){if(R=B,N=B,H=hx(),H!==e){for(V=[],Q=te();Q!==e;)V.push(Q),Q=te();V!==e?(H=[H,V],N=H):(B=N,N=e)}else B=N,N=e;N!==e&&(me=R,N=de()),R=N}return R}function hx(){var R;return i.charCodeAt(B)===44?(R=Se,B++):(R=e,z===0&&rt(oe)),R}function px(){var R,N,H,V;return R=B,N=B,H=k(),H!==e?(V=se(),V===e&&(V=null),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e),N===e&&(N=B,H=he(),H!==e?(V=se(),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e)),N!==e&&(me=R,N=be(N)),R=N,R}function k(){var R,N,H,V,Q;return R=B,N=B,H=he(),H===e&&(H=null),H!==e?(i.charCodeAt(B)===46?(V=Oe,B++):(V=e,z===0&&rt(Le)),V!==e?(Q=he(),Q!==e?(H=[H,V,Q],N=H):(B=N,N=e)):(B=N,N=e)):(B=N,N=e),N===e&&(N=B,H=he(),H!==e?(i.charCodeAt(B)===46?(V=Oe,B++):(V=e,z===0&&rt(Le)),V!==e?(H=[H,V],N=H):(B=N,N=e)):(B=N,N=e)),N!==e&&(me=R,N=be(N)),R=N,R}function se(){var R,N,H,V,Q;return R=B,N=B,ke.test(i.charAt(B))?(H=i.charAt(B),B++):(H=e,z===0&&rt(Ce)),H!==e?(V=ge(),V===e&&(V=null),V!==e?(Q=he(),Q!==e?(H=[H,V,Q],N=H):(B=N,N=e)):(B=N,N=e)):(B=N,N=e),N!==e&&(me=R,N=be(N)),R=N,R}function ge(){var R;return ce.test(i.charAt(B))?(R=i.charAt(B),B++):(R=e,z===0&&rt(ye)),R}function he(){var R,N,H;if(R=B,N=[],Me.test(i.charAt(B))?(H=i.charAt(B),B++):(H=e,z===0&&rt(Ne)),H!==e)for(;H!==e;)N.push(H),Me.test(i.charAt(B))?(H=i.charAt(B),B++):(H=e,z===0&&rt(Ne));else N=e;return N!==e&&(me=R,N=He(N)),R=N,R}function te(){var R,N;return R=B,_e.test(i.charAt(B))?(N=i.charAt(B),B++):(N=e,z===0&&rt(Re)),N!==e&&(me=R,N=de()),R=N,R}function at(R,N){if(!N)return[R];for(var H=[R],V=0,Q=N.length;V<Q;V++)H[V+1]=N[V][1];return H}var lt={m:"moveto",l:"lineto",h:"horizontal lineto",v:"vertical lineto",c:"curveto",s:"smooth curveto",q:"quadratic curveto",t:"smooth quadratic curveto",a:"elliptical arc",z:"closepath"};for(var it in lt)lt[it.toUpperCase()]=lt[it];function dt(R,N){N||(N=[{}]);for(var H=N.length;H--;){var V={code:R,command:lt[R]};R==R.toLowerCase()&&(V.relative=!0);for(var Q in N[H])V[Q]=N[H][Q];N[H]=V}return N}if(O=r(),O!==e&&B===i.length)return O;throw O!==e&&B<i.length&&rt(Ke()),kt(Ge,et<i.length?i.charAt(et):null,et<i.length?Xe(et,et+1):Xe(et,et))}KG.exports={SyntaxError:ch,parse:kte}});var SE=Uh((tDe,QG)=>{var xE=ZG().parse;xE.parseSVG=xE;xE.makeAbsolute=Vte;QG.exports=xE;function Vte(i){var t,e={x:0,y:0},n={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return i.forEach(function(r){r.command==="moveto"&&(t=r),r.x0=e.x,r.y0=e.y;for(var s in n)s in r&&(r[s]+=r.relative?r[n[s]]:0);"x"in r||(r.x=e.x),"y"in r||(r.y=e.y),r.relative=!1,r.code=r.code.toUpperCase(),r.command=="closepath"&&(r.x=t.x,r.y=t.y),e=r}),i}});function h4(i){OE.add(i)}function p4(i){if(OE.size===0)return;let t=Array.from(OE);OE.clear();for(let e of t)e.render(i)}var OE,LI=F(()=>{"use strict";OE=new Set});var Gm,XH=F(()=>{"use strict";Y();yf();vf();Gm=class extends jo(py){constructor(e,n=15,r=6710886){super(e,n,r);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,n){Ho(this.object,Gm.geometryHelper,e,n)}}});var Hu,r_=F(()=>{"use strict";Y();XH();$f();Hu=class extends Yf(ly,Gm){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.fov=90,s.aspect=1,s.near=100,s.far=2500;let a=new _(-s.far+this.position.x,-s.far+this.position.y,-s.far+this.position.z),o=new _(s.far+this.position.x,s.far+this.position.y,s.far+this.position.z),l=new Bt(a,o),c=new $l(l,new Ze(16755200));c.visible=!1,this.gizmos.shadowmap=c,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let t in this.gizmos){let e=this.gizmos[t];if(e instanceof $l){let n=this.shadow.camera,r=new _(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),s=new _(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z);e.box.set(r,s),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});function _5(i){let t=M5.get(i);return t===void 0&&(t=mse++,M5.set(i,t)),t}function gse(i){return i.isShared===!0}function yse(i){let t=Wo(i)?i.object:i;return t.geometry!==void 0?t:void 0}function vse(i){let t=i;for(;t!==null;){let e=t.states;if(e!==void 0&&Object.keys(e).length>0)return!0;t=t.parent}return!1}function T5(i){if(i.isMesh!==!0)return"not-a-mesh";if(Ts(i)||vr(i)||io(i)||xu(i))return"excluded-type";let e=yse(i);if(e===void 0)return"not-a-mesh";let n=e.material;if(n===void 0)return"not-a-mesh";if(Array.isArray(n))return"array-material";let r=e.builtSharedGeometry;if(r===void 0)return"unrealized-geometry";if(!gse(r))return"unshared-geometry";if(r.attributes.position===void 0)return"empty-geometry";if(r.morphAttributes.position!==void 0)return"morph";if(e.isSkinnedMesh===!0)return"skinned";let s=e.morphTargetInfluences;if(s!==void 0&&s.length>0)return"morph";if(r.drawRange.start!==0||r.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let a=n;return a.positionNode!=null||a.castShadowPositionNode!=null?"position-node":a.transparent===!0?"transparent":e.userData?.__splinePlanarMirror!==void 0?"reflection":vse(e)?"interaction-states":{object:i,owner:e,geometry:r,material:n,key:bse(i,e,r,n)}}function bse(i,t,e,n){let r=i,s=t;return[_5(e),_5(n),r.layers?.mask??0,r.renderOrder??0,(r.castShadow??s.castShadow)===!0?1:0,(r.receiveShadow??s.receiveShadow)===!0?1:0].join(":")}var M5,mse,A5=F(()=>{"use strict";fr();M5=new WeakMap,mse=1});function C5(i){for(let t of AR)if(i<=t)return t;return CR}var AR,CR,TR,f_,P5=F(()=>{"use strict";Y();AR=[8,32,128,512],CR=AR[AR.length-1];TR=new ne().makeScale(0,0,0),f_=class extends Vl{constructor(e,n,r,s){super(e,n,r);this.isInstanceGroup=!0;this.members=new Array(r).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(s);for(let a=0;a<r;a++)this.setMatrixAt(a,TR);this.instanceMatrix.needsUpdate=!0}adoptPassState(e){this.layers.mask=e.layers.mask,this.renderOrder=e.renderOrder,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow}assign(e,n){this.members[e]=n}writeSlot(e,n,r){return r===!1?(this.setMatrixAt(e,TR),!1):(this.setMatrixAt(e,n.matrixWorld),!0)}park(e){this.members[e]=null,this.setMatrixAt(e,TR)}get memberCount(){let e=0;for(let n of this.members)n!==null&&e++;return e}}});function I5(i,t){let e=t.get(i);if(e!==void 0)return e;let n=i.visible&&(i.parent===null||I5(i.parent,t));return t.set(i,n),n}var xse,m_,O5=F(()=>{"use strict";A5();P5();xse=8,m_=class{constructor(t=xse){this.minGroupSize=t;this.groups=[];this.groupKeys=new WeakMap;this.placements=new Map;this.visibilityMemo=new Map;this.page=null;this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}}}update(t,e){this.page!==t&&(this.teardown(),this.page=t,e=!0),t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh()}reconcile(t){let e={},n=new Map;t.traverse(a=>{if(a.isInstanceGroup===!0)return;let o=T5(a);if(typeof o=="string"){e[o]=(e[o]??0)+1;return}let l=n.get(o.key);l===void 0?n.set(o.key,[o]):l.push(o)});let r=new Map;for(let[a,o]of n)for(let l of o)r.set(l.object,a);let s=!1;for(let[a,o]of this.placements)r.get(a)!==this.groupKeys.get(o.group)&&this.parkPlacement(a,o);for(let a=this.groups.length-1;a>=0;a--){let o=this.groups[a];o.memberCount>=this.minGroupSize||(this.destroyGroup(o),this.groups.splice(a,1),s=!0)}for(let[a,o]of n){let l=o.filter(u=>!this.placements.has(u.object));if(l.length===0)continue;let c=0;for(let u of this.groups){if(c>=l.length)break;if(this.groupKeys.get(u)!==a)continue;let{members:d}=u;for(let h=0;h<d.length&&c<l.length;h++)d[h]===null&&this.place(u,h,l[c++].object)}for(;l.length-c>=this.minGroupSize;){let u=l.slice(c,c+CR);this.groups.push(this.createGroup(t,a,u)),c+=u.length,s=!0}}s&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=e}createGroup(t,e,n){let r=n[0],s=new f_(r.geometry,r.material,C5(n.length),r.object);this.groupKeys.set(s,e);for(let a=0;a<n.length;a++)this.place(s,a,n[a].object);return t.add(s),s}destroyGroup(t){for(let e=0;e<t.members.length;e++){let n=t.members[e];n!==null&&this.parkPlacement(n,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,n){t.assign(e,n),this.placements.set(n,{group:t,slot:e}),n.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(){this.visibilityMemo.clear();for(let t of this.groups){let{members:e}=t,n=null;for(let r=0;r<e.length;r++){let s=e[r];s!==null&&(n===null&&(n=s),t.writeSlot(r,s,I5(s,this.visibilityMemo)))}n!==null&&(t.adoptPassState(n),t.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null}publishGroupStats(){let t=0;for(let e of this.groups){let n=e.memberCount;n>0&&(t+=n-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}}});function Mse(i,t,e){e.length=0;let{axis:n,sign:r,limit:s}=t;for(let a=0;a<i.length;a++){let o=i[a],l=i[(a+1)%i.length],c=(n===0?o.px:n===1?o.py:o.pz)*r-s,u=(n===0?l.px:n===1?l.py:l.pz)*r-s,d=c<=0,h=u<=0;if(d&&e.push(o),d!==h){let p=c/(c-u);e.push({px:o.px+(l.px-o.px)*p,py:o.py+(l.py-o.py)*p,pz:o.pz+(l.pz-o.pz)*p,nx:o.nx+(l.nx-o.nx)*p,ny:o.ny+(l.ny-o.ny)*p,nz:o.nz+(l.nz-o.nz)*p})}}return e}function _se(i,t,e,n,r,s,a,o,l){let c=i.geometry,u=c.getAttribute("position");if(u===void 0||u.count===0)return!0;let d=c.getAttribute("normal"),h=c.getIndex(),p=h!==null?h.count:u.count;if(p>Sse)return!0;let f=c.drawRange.start,m=c.drawRange.count===1/0?p-f:Math.min(c.drawRange.count,p-f),g=f+m;Nb.copy(i.objectToDecal),g_.getNormalMatrix(Nb);let y=[],v=[];for(let b=f;b+2<g;b+=3){let x=h!==null?h.getX(b):b,S=h!==null?h.getX(b+1):b+1,E=h!==null?h.getX(b+2):b+2;if(Ic.fromBufferAttribute(u,x).applyMatrix4(Nb),qu.fromBufferAttribute(u,S).applyMatrix4(Nb),Xu.fromBufferAttribute(u,E).applyMatrix4(Nb),Ic.z>e&&qu.z>e&&Xu.z>e||Ic.z<-e&&qu.z<-e&&Xu.z<-e)continue;Ds.subVectors(qu,Ic),R5.subVectors(Xu,Ic),Sh.crossVectors(Ds,R5);let M=Sh.length();if(!(M===0||Sh.z/M<=Ese)){if(y.length=0,d!==void 0)Ds.fromBufferAttribute(d,x).applyMatrix3(g_),y.push({px:Ic.x,py:Ic.y,pz:Ic.z,nx:Ds.x,ny:Ds.y,nz:Ds.z}),Ds.fromBufferAttribute(d,S).applyMatrix3(g_),y.push({px:qu.x,py:qu.y,pz:qu.z,nx:Ds.x,ny:Ds.y,nz:Ds.z}),Ds.fromBufferAttribute(d,E).applyMatrix3(g_),y.push({px:Xu.x,py:Xu.y,pz:Xu.z,nx:Ds.x,ny:Ds.y,nz:Ds.z});else{Sh.divideScalar(M);for(let w of[Ic,qu,Xu])y.push({px:w.x,py:w.y,pz:w.z,nx:Sh.x,ny:Sh.y,nz:Sh.z})}for(let w of t){if(y.length===0)break;let T=Mse(y,w,v);v=y,y=T}if(!(y.length<3)){if(a.length/3+(y.length-2)*3>wse)return!1;for(let w=1;w+1<y.length;w++)for(let T of[y[0],y[w],y[w+1]]){l.push(T.px*n+.5,T.py*r+.5);let A=T.nx,C=T.ny,P=T.nz,D=Math.hypot(A,C,P);D>0?(A/=D,C/=D,P/=D):(A=0,C=0,P=1),a.push(T.px+A*s,T.py+C*s,T.pz+P*s),o.push(A,C,P)}}}}return!0}function D5(i,t){let e=Math.max(Math.abs(t.width),1e-6),n=Math.max(Math.abs(t.height),1e-6),r=Math.max(Math.abs(t.depth),1e-6),s=[{axis:0,sign:1,limit:e/2},{axis:0,sign:-1,limit:e/2},{axis:1,sign:1,limit:n/2},{axis:1,sign:-1,limit:n/2},{axis:2,sign:1,limit:r/2},{axis:2,sign:-1,limit:r/2}],a=[],o=[],l=[];for(let u of i)if(!_se(u,s,r/2,1/e,1/n,t.offset,a,o,l))break;let c=new De;return c.setAttribute("position",new Ve(a,3)),c.setAttribute("normal",new Ve(o,3)),c.setAttribute("uv",new Ve(l,2)),a.length===0?(c.setDrawRange(0,0),c.boundingSphere=new nr):c.computeBoundingSphere(),c}var Sse,wse,Ese,Nb,g_,Ic,qu,Xu,Ds,R5,Sh,L5=F(()=>{"use strict";Y();Sse=15e5,wse=3e5,Ese=.01,Nb=new ne,g_=new wt,Ic=new _,qu=new _,Xu=new _,Ds=new _,R5=new _,Sh=new _});var PR,N5,B5,F5,Hm,U5=F(()=>{"use strict";Y();an();Tu();gi();Yi();L5();Iv();PR=new Bt,N5=new Bt,B5=new ne,F5=new _,Hm=class extends _r{constructor(e,n,r){super(e,n);this.data=n;this.geometry=new De;this.lastSignature=[];this.nextSignature=[];this.scanned=[];this.lastParams={width:0,height:0,depth:0,offset:0};this.context=r;let s=this.data.geometry;this.lastParams={width:this.resolveNumber(s.width,0),height:this.resolveNumber(s.height,0),depth:this.resolveNumber(s.depth,0),offset:s.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(e,n){if(typeof e=="number")return e;let r=Number(this.context.shared.getVariable(e));return Number.isFinite(r)?r:n}currentParams(){let e=this.dataPatched.geometry;return{width:this.resolveNumber(e.width,this.lastParams.width),height:this.resolveNumber(e.height,this.lastParams.height),depth:this.resolveNumber(e.depth,this.lastParams.depth),offset:e.offset??0}}projectionRoot(){let e=this.parent;for(;e!==null&&Dt.is(e);){if(e.data?.type==="Page")return e;e=e.parent}return this.context.scene}scanTargets(e,n,r){let s=this.scanned;s.length=0;let a=this.projectionRoot();if(a===null)return s;PR.makeEmpty();for(let o=0;o<8;o++)F5.set((o&1?.5:-.5)*e,(o&2?.5:-.5)*n,(o&4?.5:-.5)*r).applyMatrix4(this.matrixWorld),PR.expandByPoint(F5);return a.traverse(o=>{if(o===this||!Dt.is(o)||!(o instanceof Kt)||o instanceof Hm||o.dataPatched?.type!=="Mesh"||!o.visible||o.destroyedInAction||(o.layers.mask&1<<9)!==0)return;let l=o.geometry,c=l?.getAttribute("position");c===void 0||c.count===0||l.drawRange.count!==0&&(l.boundingBox===null&&l.computeBoundingBox(),N5.copy(l.boundingBox).applyMatrix4(o.matrixWorld),PR.intersectsBox(N5)&&s.push(o))}),s}collectSignature(e,n,r){e.length=0,e.push(r.width,r.height,r.depth,r.offset);for(let s of this.matrixWorld.elements)e.push(s);for(let s of n){e.push(s.id,s.geometry.id);let a=s.geometry.getAttribute("position");e.push(a===void 0?-1:"version"in a?a.version:a.data.version);let o=s.geometry.getIndex();e.push(o!==null?o.version:-1),e.push(s.geometry.drawRange.count===1/0?-1:s.geometry.drawRange.count);for(let l of s.matrixWorld.elements)e.push(l)}}signaturesEqual(e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let e=this.currentParams(),n=this.scanTargets(e.width,e.height,e.depth);if(this.collectSignature(this.nextSignature,n,e),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let r=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=r,this.lastParams=e,B5.copy(this.matrixWorld).invert();let s=n.map(o=>({geometry:o.geometry,objectToDecal:new ne().multiplyMatrices(B5,o.matrixWorld)}));return this.geometry.dispose(),this.geometry=D5(s,e),this.geometry.userData={type:"DecalGeometry",parameters:{width:e.width,height:e.height,depth:e.depth}},Qo(this),Jo(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),$t(e.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(e,n){let r=this.currentParams();e.setScalar(0),n.set(r.width,r.height,r.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}}});var y_,k5=F(()=>{"use strict";Y();Zy();Su();y_=class extends Ma(lp,ba){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}}});function Tse(){try{let i=window.location.href;if(i.includes("reducesubdiv=")){let t=i.indexOf("reducesubdiv=")+13;return parseInt(i.slice(t,t+1))}}catch{}}function Ase(i,t,e){IR!==void 0&&t?.geometry&&"subdivisions"in t.geometry&&(t.geometry.subdivisions??0)>IR&&Object.assign(t.geometry,{subdivisions:IR});let n;if(t.geometry.type==="TextGeometry"||t.geometry.type==="InputGeometry"){let r=L1(t.geometry.type);return r?r(i,t,e):(Jn(t.geometry.type==="InputGeometry"?"textinputs":"text",`a Mesh with ${t.geometry.type}`),new qt(i,t,e))}else if(t.geometry.type==="SubdivGeometry")n=new ho(i,t,e);else if(t.geometry.type==="PathGeometry"||t.geometry.type==="VectorGeometry"||t.geometry.type==="ShapeBlendGeometry"){let r=L1(t.geometry.type);r?n=r(i,t,e):(Jn(t.geometry.type==="ShapeBlendGeometry"?"shape-blends":t.geometry.type==="PathGeometry"?"3d-paths":"vector-shapes",`a Mesh with ${t.geometry.type}`),n=new qt(i,t,e))}else if(t.geometry.type==="BooleanGeometry")n=new Cs(i,t,e);else if(t.geometry.type==="DecalGeometry")n=new Hm(i,t,e);else if(t.geometry.type==="UIGeometry"){let r=L1("UIGeometry");r?n=r(i,t,e):(Jn("ui-2d","a Mesh with UIGeometry"),n=new qt(i,t,e))}else n=new qt(i,t,e);return n}function v_(i,t,e){if(console.assert(t.type!==void 0),t.type==="Mesh")return Ase(i,t,e);if(t.type==="Empty")return new us(i,t);if(t.type==="Particle"){let n=D1("Particle");return n?n(i,t,e):(Jn("particles","a Particle system"),new us(i,t))}else{if(t.type==="ParticleCollider")return new al(i,t,e);if(t.type==="Hair"){let n=D1("Hair");return n?n(i,t,e):(Jn("hair","a Hair System"),new us(i,t))}else{if(t.type==="Splat")return new us(i,t);if(t.type==="Bone")return new y_(i,t);if(t.type==="Page")return new Cn(i,t,e);if(t.type==="PointLight")return new Hu(i,t,e);if(t.type==="SpotLight")return new nl(i,t,e);if(t.type==="DirectionalLight")return new tl(i,t,e);if(t.type==="Component"||t.type==="Instance"){let n=D1(t.type);return n?n(i,t,e):(Jn("components",`a ${t.type}`),new us(i,t))}else if(Qa.is(t.type))return new on(i,t)}}return console.error(t),new us(i,t)}function Cse(i,t,e){let n=v_(i.identity,t,e),r=i.children,s=i.attachedPaths,a=i.parent,o=i.component,l=i.instances,c=i.overrideData,u=i.uuid,d=i.stateSelection;i.dispose();for(let h of Object.keys(i))delete i[h];Object.setPrototypeOf(i,Object.getPrototypeOf(n));for(let h of Object.keys(n))i[h]=n[h];i.children=[...i.children,...r],i.attachedPaths=s,i.parent=a,i.component=o,i.instances=l,i.uuid=u,i.overrideData=c,i.updateState(i.data,e),d&&i.changeSelectedState(d,e),i.resetBBoxNeedsUpdate()}function V5(i,t,e,n){i.updateByOp(t,e,n,!1)}var IR,z5=F(()=>{"use strict";ft();rm();qf();U5();ds();sv();r_();Bv();Dv();$s();Jy();k5();rl();aE();Qt();IR=Tse();xa.createEntity=v_;xa.changeEntityProptotype=Cse});var b_,G5=F(()=>{"use strict";b_=class{constructor(){this._constraints=new Map}setConstraint(t,e){e===null?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((n,r)=>{let s=[r,n],a=n;for(;this._constraints.has(a);){if(a=this._constraints.get(a),s.includes(a)){console.warn(`circular dependency detected: ${s.join(" -> ")}`);break}e.has(a)||s.push(a)}for(let o=s.length-2;o>=0;o--)if(!e.has(s[o])){let l=t.find(s[o]);l?l.applyPathSnapping(t):console.warn(`missing entity ${s[o]}`),e.add(s[o])}})}findDependency(t,e){let n=t;for(;this._constraints.has(n);)if(n=this._constraints.get(n),n===e)return!0;return!1}}});var j5,H5=F(()=>{"use strict";j5="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"});var W5,q5=F(()=>{"use strict";W5=`
4136
4136
  function sortWorker(self) {
4137
4137
  let wasmInstance;
@@ -9786,7 +9786,7 @@ void main() {
9786
9786
  gl_FragColor = texture(inputTexture, vUv);
9787
9787
  gVelocity = vec4(0.0);
9788
9788
  }
9789
- `,n.pyramidTextureSize.value=new j(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(s.uniforms,n)};this.material.shapeBlendhack=r,this.material.root.shapeBlendhack=r}dispose(){super.dispose(),Qz()?.release(this)}},$v=EI;$v.streamCompaction=new sE;var xte=new ne,Ste=new ne,sm=new qe,lh=new _,gE=new _,wte=new qe;function Ete(i,t=0){let e=this.children.length;for(;e--;){let n=this.children[e];cc.is(n)&&IG.call(n,i,t+1)}}function IG(i,t=0){if(i(this,t)!==!0){let n=this.children.length;for(;n--;){let r=this.children[n];cc.is(r)&&IG.call(r,i,t+1)}}}function Mte(){if(this.shapesDataTexture.value===void 0){let g=new Hn(new Float32Array(4*$r*gc),$r,gc,qn,Wt);this.shapesDataTexture.value=g}let i=this.shapesDataTexture.value,t=i.image.data,e=0,n=0,r=this.data.geometry.blendRange,s=xte.copy(this.matrixWorld).invert(),a=this._npart,o=0;this._meshSdfWanted.clear();let l=null;if(Ete.call(this,g=>{if(g.visible===!1)return!0;let y;if(g instanceof Zs)return;if(g instanceof al||xu(g))return;g instanceof Yr?y=g.object:y=g;let v=g.data?.cloner;if(Dt.is(g)&&v&&!v.hideBase&&v.type!=="radial"&&v.disabled!==!0||!(y instanceof qt))return;let b=y.geometry.userData.parameters,x=b?.shapeBlendNode??y.dataPatched?.geometry?.shapeBlendNode;if(x===void 0)return;if(Ste.multiplyMatrices(s,g.matrixWorld).decompose(gE,sm,lh),b?.type==="TorusGeometry"&&b.arc!==360){let I=b.arc*Math.PI/180;I=I/4,sm.multiply(wte.set(0,0,Math.sin(I),Math.cos(I)))}let E=x.overrideGlobalBlend?x.blendRange:r;E=E/this.bboxSize*2,t[o*4]=(gE.x-this.bboxOffset)/this.bboxSize*2,t[o*4+1]=(gE.y-this.bboxOffset)/this.bboxSize*2,t[o*4+2]=(gE.z-this.bboxOffset)/this.bboxSize*2,t[o*4+3]=x.operation===0?1:x.operation===2?-1:-2,t[$r*4+o*4]=-sm.x,t[$r*4+o*4+1]=-sm.y,t[$r*4+o*4+2]=-sm.z,t[$r*4+o*4+3]=sm.w;let M=new Float32Array(4),w=0,T=E;if(b?.type==="SphereGeometry")b.width===b.height&&b.width===b.depth?M[0]=0:M[0]=1,M[1]=b.width/this.bboxSize,M[2]=b.height/this.bboxSize,M[3]=b.depth/this.bboxSize,T=Math.max(M[1],M[2],M[3])*lh.x+E;else if(b?.type==="CubeGeometry"){w=b.cornerRadius;let I=b.width,L=b.height,U=b.depth;M[0]=2,M[1]=(I-2*w)/this.bboxSize,M[2]=(L-2*w)/this.bboxSize,M[3]=(U-2*w)/this.bboxSize,T=Math.sqrt(I**2+L**2+U**2)/this.bboxSize*lh.x+E}else if(b?.type==="CylinderGeometry"){w=b.cornerRadius;let I=b.height,L=b.radiusBottom,U=b.radiusTop;if(U>=L){let G=Math.atan2(U-L,I),X=(Math.PI/2-G)/2;U-=w/Math.tan(X),L-=w*Math.tan(X)}else if(L>U){let G=Math.atan2(L-U,I),X=(Math.PI/2-G)/2;U-=w*Math.tan(X),L-=w/Math.tan(X)}M[1]=(b.height-2*w)/this.bboxSize,L===U?(M[0]=3,M[2]=L/this.bboxSize*2):(M[0]=4,M[2]=L/this.bboxSize*2,M[3]=U/this.bboxSize*2),T=(Math.hypot(M[1],Math.max(Math.abs(M[2]),Math.abs(M[3])))+w/this.bboxSize*2)*lh.x+E}else if(b?.type==="TorusGeometry"){if(M[0]=5,M[1]=(b.width-b.depth)/this.bboxSize,M[2]=b.depth/this.bboxSize,b.arc!==360){M[0]=6,M[3]=M[1],t[$r*12+o*4+3]=M[2];let I=2*Math.atan2(M[2]/2,M[1]),L=b.arc*Math.PI/180/2-I;M[1]=Math.sin(L),M[2]=Math.cos(L)}T=b.width*lh.x/this.bboxSize+E}else{let I=y.geometry;(l??(l=new Set)).add(I.uuid);let L=this._meshSdfBaked.get(I.uuid),U=bte(I);if((L===void 0||L.posVersion!==U)&&this._meshSdfWanted.set(I.uuid,I),L===void 0)return;M[0]=7,M[1]=L.slot,M[2]=L.boxHalf.x/this.bboxSize*2,M[3]=L.boxHalf.y/this.bboxSize*2,t[$r*12+o*4+3]=L.boxHalf.z/this.bboxSize*2,T=Math.hypot(L.boxHalf.x,L.boxHalf.y,L.boxHalf.z)/this.bboxSize*2*lh.x+E}t.set(M,$r*8+o*4),e=Math.max(e,T),n=Math.max(n,E),this._reach[o]=T,t[$r*12+o*4]=E,t[$r*12+o*4+1]=w/this.bboxSize*2,t[$r*12+o*4+2]=lh.x;let A=Array.isArray(y.material)?y.material[0]:y.material,C=A,P,D;if(C?.getShapeBlendBaseColor){let I=C.getShapeBlendBaseColor();P=I,D=I.a}else A?.uniforms?.nodeU0!==void 0?(P=A.uniforms.nodeU0.node.value,D=A.uniforms.nodeU1?.value??1):(P={r:1,g:1,b:1},D=1);x.operation!==0&&!x.useColor&&(D=-1),t[$r*16+o*4]=P.r,t[$r*16+o*4+1]=P.g,t[$r*16+o*4+2]=P.b,t[$r*16+o*4+3]=D,D<1&&this.material.defines?.SHAPEBLEND_C===1&&(this.material.transparent=!0),o++}),this._meshSdfBaked.size>0){let g=l??new Set;for(let y of this._meshSdfBaked.keys())g.has(y)||this._meshSdfBaked.delete(y)}this.npart=o,this._maxBlendK=n;let c=e*1.1+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=c;let u=this._prevShapeData,d=a!==o,h=u===null||this._prevSpan!==c||d,p=h||wI,f=this._fieldDirtyMin.set(1/0,1/0,1/0),m=this._fieldDirtyMax.set(-1/0,-1/0,-1/0);if(u!==null){let g=Math.max(o,a);for(let y=0;y<g;y++){let v=!1;for(let C=0;C<gc;C++){let P=$r*4*C+y*4;if(t[P]!==u[P]||t[P+1]!==u[P+1]||t[P+2]!==u[P+2]||t[P+3]!==u[P+3]){v=!0;break}}if(!v)continue;if(h=!0,p)break;let b=t[y*4],x=t[y*4+1],S=t[y*4+2],E=u[y*4],M=u[y*4+1],w=u[y*4+2],T=this._reach[y],A=this._prevReach[y];if(!Number.isFinite(b+x+S+T)||!Number.isFinite(E+M+w+A)){p=!0;continue}f.x=Math.min(f.x,b-T,E-A),f.y=Math.min(f.y,x-T,M-A),f.z=Math.min(f.z,S-T,w-A),m.x=Math.max(m.x,b+T,E+A),m.y=Math.max(m.y,x+T,M+A),m.z=Math.max(m.z,S+T,w+A)}}return wI&&(h=!0),this._fieldDirtyFull=p||f.x===1/0,h&&(u===null?this._prevShapeData=new Float32Array(t):u.set(t),this._prevReach.set(this._reach),this._prevSpan=c,i.needsUpdate=!0),h}Qt();Sa("ShapeBlendGeometry",(i,t,e)=>new $v(i,t,e));_t("shape-blends");gi();ds();var yE=class extends qt{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?uv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}};Qt();Sa("VectorGeometry",(i,t,e)=>new yE(i,t,e));_t("vector-shapes");ds();gi();Sv();gw();Mv();vw();var vE=class extends qt{constructor(e,n,r){super(e,n,r);this.isPathObject=!0;this._shapeId=null;this._lastShapeParams=null;this._lastShape=null;this._context=r}updateState(e,n){super.updateState(e,n),this.updateShape(),this.refreshAttachedCloners(n)}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let s in e)typeof e[s]=="string"&&(e[s]=this._context.shared.getVariable(e[s],[this.uuid,"geometry","extrusion","shape",s]));let n;if(e.type==="Custom"){let s=e.shapeId;if(s!==this._shapeId&&this.detachShape(),s){this._shapeId=s;let a=this._context.scene.find(s);a?.data&&(a.attachedPaths.add(this),n=a.geometry.userData?.shape),n||this._context.scene.addPendingCommand(()=>this.updateShape())}}else if(this._lastShape!==null&&this._sameShapeParams(e))n=this._lastShape;else{let s;switch(e.type){case"Rectangle":s=Vf;break;case"Ellipse":s=Uf;break;case"Polygon":s=mw;break;case"Star":s=yw;break;default:throw new Error(`Unknown shape type: ${e.type}`)}n=s.create({parameters:e}).userData.shape,this._lastShapeParams=e,this._lastShape=n??null}let r=this.geometry;n&&r.inputs&&(r.inputs.shapeData=n,r.build())}_sameShapeParams(e){let n=this._lastShapeParams;if(n===null)return!1;for(let r in e)if(!Object.is(e[r],n[r]))return!1;for(let r in n)if(!(r in e))return!1;return!0}detachShape(){this._shapeId!==null&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}supportsInPlaceGeometryUpdate(){return!1}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,n){return super.updateTransformState(e,n)}updateGeometryInteractions(e,n){super.updateGeometryInteractions(e,n),this.updateShape()}updateEntityBoxSize(e,n){let r=this.geometry.getAttribute("position");r!==void 0&&r.count>0?uv(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,e,n):super.updateEntityBoxSize(e,n)}};Qd();Y();ft();Sv();hw();wP();function OG(i,t){let e=2*Math.PI;return(i%e+e)%e===(t%e+e)%e}var _te=new ne,Tte=new ne,Ate=new ne,RG=new _,DG=new _,LG=new _,Cte=new _,Pte=new _,Ite=new _,Ote=new _,NG=new WeakMap,MI=new WeakMap,BG=new WeakMap;function Rte(i,t,e){let n=[new _,new _,new _],r=[new _,new _,new _];return i.extractBasis(n[0],n[1],n[2]),t.extractBasis(r[0],r[1],r[2]),n.forEach((s,a)=>{let o=r[a],l=we.lerp(s.length(),o.length(),e);s.lerp(o,e).setLength(l)}),new ne().makeBasis(n[0],n[1],n[2])}function FG(i){i.setIndex(null),i.setAttribute("position",new je(new Float32Array(0),3)),i.setAttribute("normal",new je(new Float32Array(0),3)),i.setAttribute("uv",new je(new Float32Array(0),2)),i.setDrawRange(0,0)}var UG=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),a=t?.shapeData??Uf.create({parameters:{...Gd,width:typeof Gd.width=="number"?Gd.width:100,height:typeof Gd.height=="number"?Gd.height:100}}).userData.shape;return{path:i.path??ef.defaultData(),parameters:Object.assign(e,{width:n,height:r,depth:s,extrusion:{...u1,...e.extrusion}}),shapeData:a}}static build(i){if(i.path.points.length>=2){let e=new _I(i);return Object.assign(e,{userData:{...i,type:"PathGeometry"}})}else{let e=new De;return FG(e),Object.assign(e,{userData:{...i,type:"PathGeometry"}})}}},_I=class extends De{constructor(e){super();this.type="PathExtrusionGeometry",this.inputs=e,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&this.inputs.parameters.extrusion.depth===1}_isOpenEnded(){let e=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&e.depth===1)||!OG(e.twist,0)||e.startScale!==e.endScale}build(){let{points:e,matrices:n}=this._getSampledPath();if(e.length<2){FG(this);return}let{depth:r,offset:s}=this.inputs.parameters.extrusion;r=Math.max(0,Math.min(r,1)),s=Math.max(0,Math.min(s,1));let a=this.inputs.path.isClosed?e.length:e.length-1,o=Math.floor(s*a),l=this.inputs.path.isClosed?Math.ceil((r+s)*a):Math.ceil(Math.min(1,r+s)*a),c=Math.min(Math.max(2,l-o+1),a+2),u=[],d=[];for(let re=0;re<c;re++){let fe=this.inputs.path.isClosed?(re+o)%e.length:Math.min(re+o,e.length-1);u.push(e[fe].clone()),d.push(n[fe].clone())}let h=(re,fe,ve)=>{u[re]=u[re].clone().lerp(u[fe],ve),d[re]=Rte(d[re],d[fe],ve)},p=0,f=s*a%1;(!this.inputs.path.isClosed||r<=1)&&(f||s===0)&&(p=f,h(0,1,p));let m=0,g=(s+r)*a%1;if((this.inputs.path.isClosed&&r<=1||!this.inputs.path.isClosed&&s+r<1)&&g&&(m=g,h(u.length-1,u.length-2,1-m)),r===0){let re=u.length-1;u[re].copy(u[0]),d[re].copy(d[0])}this._applyPathModifiers(d,p,m);let{bevel:y,bevelSides:v}=this.inputs.parameters.extrusion,b=y>0?this.inputs.parameters.extrusion.capType:"flat",x=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(x=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:S,infos:E,vertices:M}=this._getShapePoints(x),w=0,T;if(b==="round"){let re=this.inputs.shapeData,fe=BG.get(re);fe!==void 0&&fe.bevel===y&&fe.curveSegments===x&&fe.bevelSides===v?T=fe.geometry:(T=new Mu(re,2*y,y,x,v,void 0,!0),BG.set(re,{bevel:y,curveSegments:x,bevelSides:v,geometry:T})),w=T.getAttribute("position").count}let A=0,C=0;E.sort((re,fe)=>re.start-fe.start),E.forEach(re=>{re.verticesStart=A,re.verticesCount=re.continuous.reduce((fe,ve,de)=>fe+(de===0||!ve?2:1),0),C+=re.verticesCount,A=C});let P=C*c,D,I=0;this._isOpenEnded()&&b==="flat"&&(D=this._getSurfaceTesselation(S),I=D.vertexCount);let L=P+2*I+w*2,U=P+2*I,G={positions:new Float32Array(L*3),normals:new Float32Array(L*3),uvs:new Float32Array(L*2)},X=T?T.getIndex().array:null,ae=0;E.forEach(re=>{ae+=re.count});let ee=ae*(c-1)*6+(D?2*D.elementCount*3:0)+(X?2*X.length:0),$=new Uint32Array(ee),K=0;if(E.forEach(re=>{K=this._extrudeRegion(re,M,d,u,G,$,K,this._isGeometryClosed()&&!this._isOpenEnded())}),D&&(K=this._closeEnd(D,P,$,K,G,d[0],u[0],!1),K=this._closeEnd(D,P+I,$,K,G,d[d.length-1],u[u.length-1],!0)),T){G.positions.set(T.getAttribute("position").array,U*3),G.normals.set(T.getAttribute("normal").array,U*3),G.uvs.set(T.getAttribute("uv").array,U*2);for(let de=U;de<U+w;de++)G.uvs[de*2+1]=1e-4;let re=K;for(let de=0;de<X.length;de++)$[K++]=X[de]+U;U+=w,G.positions.set(T.getAttribute("position").array,U*3),G.normals.set(T.getAttribute("normal").array,U*3),G.uvs.set(T.getAttribute("uv").array,U*2);let fe=K;for(let de=0;de<X.length;de++)$[K++]=X[de]+U;this.setAttribute("position",new je(G.positions,3)),this.setAttribute("normal",new je(G.normals,3)),this.setAttribute("uv",new je(G.uvs,2)),this._setIndexFromUint32($);let ve=_te;ve.copy(d[d.length-1]).setPosition(u[u.length-1]),this.applyMatrix4OnRange(ve,U,L),ve.copy(d[0]).setPosition(u[0]).multiply(Tte.makeScale(1,1,-1)),this.applyMatrix4OnRange(ve,U-w,U),this.reverseIndicesOnRange(re,fe)}else this.setAttribute("position",new je(G.positions,3)),this.setAttribute("normal",new je(G.normals,3)),this.setAttribute("uv",new je(G.uvs,2)),this._setIndexFromUint32($)}_setIndexFromUint32(e){let n=!1;for(let r=e.length-1;r>=0;--r)if(e[r]>=65535){n=!0;break}this.setIndex(new je(n?e:new Uint16Array(e),1))}_getSampledPath(){let e=this.inputs.path,n=V1(e),r=NG.get(n);if(r===void 0||r.subdivisions!==e.subdivisions||r.subdivisionMode!==e.subdivisionMode){let s=this._extractPathPoints(n),a=s.length<2?[]:this._computeBasisMatrices(s);r={subdivisions:e.subdivisions,subdivisionMode:e.subdivisionMode,points:s,matrices:a},NG.set(n,r)}return r}_extractPathPoints(e){let n=this.inputs.path.subdivisions,r=this.inputs.path.subdivisionMode==="uniform"?e.getSpacedPoints(n*4):e.getPoints(n);if(r.length<2)return[];let s=[r[0]];return r.forEach(o=>{s[s.length-1].distanceToSquared(o)>.001&&s.push(o)}),this.inputs.path.isClosed&&s[s.length-1].distanceTo(s[0])<.001&&s.pop(),s}_computeBasisMatrices(e){let n=[],r=e.length,s=this.inputs.path.isClosed,a=new _,o=new _,l=new _,c=new _,u=new _(0,1,0);for(let g=0;g<r;g++){let y=e[g],v;g===0?v=s?e[e.length-2]:RG.copy(y).multiplyScalar(2).sub(e[1]):v=e[g-1];let b;g===r-1?b=s?e[1]:RG.copy(y).multiplyScalar(2).sub(e[g-1]):b=e[g+1],DG.subVectors(y,v).normalize(),LG.subVectors(b,y).normalize();let x=Cte.addVectors(DG,LG).normalize();l.copy(x),g===0&&(x.equals(u)||Pte.copy(x).negate().equals(u))&&u.set(0,0,1);let S=Ite.crossVectors(u,x).normalize(),E=Ote.crossVectors(x,S).normalize();u.copy(E),c.copy(S),g===0&&(a.copy(E),o.copy(x));let M=new ne().makeBasis(S,E,x);n.push(M)}let d=s?o:l,h=s?a:new _(0,1,0),p=d.clone().cross(c).normalize(),f=Math.acos(h.dot(p));if(isNaN(f))return n;let m=h.clone().cross(p);d.dot(m)>0&&(f*=-1);for(let g=1;g<n.length;g++)n[g].multiply(Ate.makeRotationZ(f*g/n.length));return n}_applyPathModifiers(e,n,r){let s=e.length,{angle:a,twist:o,startScale:l,endScale:c}=this.inputs.parameters.extrusion,u=new ne,d=new ne;return e.forEach((h,p)=>{let f=p===0?0:p===s-1?1:(p-n)/(s-(r===0?0:1)-(n+(1-r)));u.makeRotationZ(we.lerp(a,a+o,f)*we.DEG2RAD);let m=we.lerp(l,c,f);d.makeScale(m,m,m),h.multiply(u).multiply(d)}),e}_getShapePoints(e,n=ln.ODD){let r=this.inputs.shapeData,s=MI.get(r);return(s===void 0||s.curveSegments!==e||s.windingRule!==n)&&(s={curveSegments:e,windingRule:n,shapePoints:this._computeShapePoints(e,n)},MI.set(r,s)),s.shapePoints}_getSurfaceTesselation(e){let n=MI.get(this.inputs.shapeData);if(n?.surfaceTesselation!==void 0)return n.surfaceTesselation;let r;try{r=oo({windingRule:ln.ODD,elementType:Or.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:e})}catch{r=o2}return n!==void 0&&(n.surfaceTesselation=r),r}_computeShapePoints(e=12,n=ln.ODD){let r=this.inputs.shapeData,s=r.extractShapePointsToFlatArray([],e),a=r.shapeHoles.map(m=>{let g=m.extractShapePointsToFlatArray([],e),y=[];for(let v=g.length-1;v>=1;v-=2){let b=g[v-1],x=g[v-0];y.push(b,x)}return y}),o;try{o=oo({windingRule:n,elementType:Or.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]})}catch{o=xv}let l;try{l=oo({windingRule:ln.ODD,elementType:Or.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]})}catch{l=a2}if(!o)throw new Error("error generating geometry");let c=o.elementCount;if(l){o.elementCount+=l.elementCount;for(let m=0;m<l.elements.length;m++){let g=l.elements[m],y=m%2===0?o.vertexCount:0;o.elements.push(g+y)}for(let m=0;m<l.vertexIndices.length;m++){let g=l.vertexIndices[m],y=o.vertexCount;o.vertexIndices.push(g+y)}for(let m=0;m<l.vertices.length;m++){let g=l.vertices[m];o.vertices.push(g)}}let u=1/0,d=-1/0,h=1/0,p=-1/0;for(let m=0,g=o.vertexCount;m<g;m++){let y=m*2,v=o.vertices[y+0],b=o.vertices[y+1];v<u&&(u=v),v>d&&(d=v),b<h&&(h=b),b>p&&(p=b)}let f=[];for(let m=o.elementCount-1;m>=0;m--){let g=m>=c,y=m*2,v=o.elements[y+0],b=o.elements[y+1],x=v+b,S={start:v,count:b,normals:[],isHole:g,continuous:[],verticesStart:0,verticesCount:0};f.push(S);let E=v,M=x-1,w=v+1,T=r.roundedCurves.length;do{let A=E-v,C=o.vertices[M*2+0],P=o.vertices[M*2+1],D=o.vertices[E*2+0],I=o.vertices[E*2+1],L=o.vertices[w*2+0],U=o.vertices[w*2+1],G=D-C,X=I-P,ae=Math.sqrt(G*G+X*X);G/=ae,X/=ae;let ee=D-L,$=I-U,K=Math.sqrt(ee*ee+$*$);ee/=K,$/=K,S.normals[A*2+0]=-$,S.normals[A*2+1]=ee;let re=o.vertexIndices[E];if(Array.isArray(re))S.continuous[A]=!1;else{let[fe,ve]=r.getCurveIndexFromVertexId(re-1,!0);if(ve>0&&ve<1)S.continuous[A]=!0;else{let de=ve===1?fe+1:fe-1;de=(de+T)%T;let Se=ve===1?0:1,oe=r.roundedCurves[fe].getTangent(ve),be=r.roundedCurves[de].getTangent(Se);S.continuous[A]=oe.dot(be)>.95}}g&&(S.normals[A*2+0]*=-1,S.normals[A*2+1]*=-1),[M,E,w]=[E,w,w+1],w>=x&&(w-=b)}while(w!==v+1)}return{regions:[s,...a],infos:f,vertices:o.vertices}}_insertVertex(e,n,r,s,a){let o=n*2,l=n*3;e.positions[l+0]=r.x,e.positions[l+1]=r.y,e.positions[l+2]=r.z,e.normals[l+0]=s.x,e.normals[l+1]=s.y,e.normals[l+2]=s.z,e.uvs[o+0]=a.x,e.uvs[o+1]=a.y}_extrudeRegion(e,n,r,s,a,o,l,c){let u=e.wallTemplate;if(u===void 0){u=[];for(let x=0;x<e.count;x++){let S=(e.start+x)*2,E=n[S+0],M=n[S+1],w,T;if(e.continuous[x])w=e.normals[x*2+0],T=e.normals[x*2+1];else{let C=x===0?(e.start+e.count-1)*2:S-2,P=E-n[C+0];w=-(M-n[C+1]),T=P,e.isHole||(w=-w,T=-T)}let A=x===0?1:x/e.count;if(u.push(E,M,w,T,A,0),!e.continuous[x]||x===0)if(x===0)u.push(E,M,e.normals[0],e.normals[1],0,1);else{let C=x===e.count-1?e.start*2:S+2,P=n[C+0]-E;w=-(n[C+1]-M),T=P,e.isHole||(w=-w,T=-T),u.push(E,M,w,T,A,1)}}e.wallTemplate=u}let d=r.length,h=u.length,p=a.positions,f=a.normals,m=a.uvs;for(let x=0;x<d;x++){let S=r[x].elements,E=S[0],M=S[1],w=S[2],T=S[4],A=S[5],C=S[6],P=S[12],D=S[13],I=S[14],L=s[x],U=x/(d-1),G=0,X=0,ae=0,ee=e.verticesStart*d+e.verticesCount*x;for(let $=0;$<h;$+=6){if(u[$+5]===0){let Oe=u[$+0],Le=u[$+1];G=E*Oe+T*Le+P+L.x,X=M*Oe+A*Le+D+L.y,ae=w*Oe+C*Le+I+L.z}let K=u[$+2],re=u[$+3],fe=E*K+T*re+P,ve=M*K+A*re+D,de=w*K+C*re+I,Se=1/(Math.sqrt(fe*fe+ve*ve+de*de)||1);fe*=Se,ve*=Se,de*=Se;let oe=ee*2,be=ee*3;p[be+0]=G,p[be+1]=X,p[be+2]=ae,f[be+0]=fe,f[be+1]=ve,f[be+2]=de,m[oe+0]=u[$+4],m[oe+1]=U,ee++}}let g=e.wallQuadPattern;if(g===void 0){g=[];let x=0;for(let S=0;S<e.count;S++)(!e.continuous[S]||S===0)&&x++,g.push(x,S===e.count-1?0:x+1),x++;e.wallQuadPattern=g}let y=d-1,v=g.length,b=e.isHole;for(let x=0;x<y;x++){let S=e.verticesStart*d+e.verticesCount*x,E=S+e.verticesCount;for(let M=0;M<v;M+=2){let w=S+g[M],T=S+g[M+1],A=E+g[M+1],C=E+g[M];b?(o[l++]=w,o[l++]=A,o[l++]=T,o[l++]=w,o[l++]=C,o[l++]=A):(o[l++]=w,o[l++]=T,o[l++]=A,o[l++]=w,o[l++]=A,o[l++]=C)}}return l}_closeEnd(e,n,r,s,a,o,l,c){let u=e.vertexCount,d=new _(0,0,c?-1:1).applyMatrix4(o),h=new _,p=new j;for(let m=0;m<u;m++){let g=2*m;h.set(e.vertices[g+0],e.vertices[g+1],0).applyMatrix4(o).add(l),this._insertVertex(a,n+m,h,d,p)}let f=e.elements;for(let m=0;m<e.elementCount;m++){let g=3*m;r[s++]=f[g+0]+n,r[s++]=f[g+(c?1:2)]+n,r[s++]=f[g+(c?2:1)]+n}return s}applyMatrix4OnRange(e,n,r){let s=e.elements,a=new wt().getNormalMatrix(e).elements,o,l,c,u,d=this.attributes.position,h=this.attributes.normal;if(!d||!h)return;let p=d.array,f=h.array,m=d.itemSize;for(let g=n*m,y=r*m;g<y;g+=m)o=p[g+0],l=p[g+1],c=p[g+2],u=1/(s[3]*o+s[7]*l+s[11]*c+s[15]),p[g+0]=(s[0]*o+s[4]*l+s[8]*c+s[12])*u,p[g+1]=(s[1]*o+s[5]*l+s[9]*c+s[13])*u,p[g+2]=(s[2]*o+s[6]*l+s[10]*c+s[14])*u,o=f[g+0],l=f[g+1],c=f[g+2],f[g+0]=a[0]*o+a[3]*l+a[6]*c,f[g+1]=a[1]*o+a[4]*l+a[7]*c,f[g+2]=a[2]*o+a[5]*l+a[8]*c;d.needsUpdate=!0,h.needsUpdate=!0}reverseIndicesOnRange(e,n){let r=this.index;if(r){for(let s=e;s<n;s+=3){let a=r.getX(s),o=r.getX(s+1),l=r.getX(s+2);r.setXYZ(s,l,o,a)}r.needsUpdate=!0}}};Qt();Sa("PathGeometry",(i,t,e)=>new vE(i,t,e));ev("PathGeometry",UG);_t("3d-paths");Jy();Qt();xa.Cloner=Zs;_t("cloners");an();hn();ft();Y();Zy();Jy();Yi();Su();ds();TI();var Zv=class extends Ma(Us,ba){constructor(e,n,r){super();this.isComponentObject=!0;n.type==="Instance"&&typeof e=="string"&&(n=this.transformAssignData(n,r)),this.super_Entity(e,n),this.objectHelper.update()}get isComponentRoot(){return this.data.type==="Component"&&typeof this.identity=="string"}get isInstanceRoot(){return this.data.type==="Instance"&&typeof this.identity=="string"}transformAssignData(e,n){let r=vu.getComponentData({scene:n.scene.data,shared:n.shared.data},e.component);if(r){let s,a;for(let o of ya.rootOverrideProps)e[o]===void 0?(s===void 0&&(s={...e}),s[o]=r.data[o]):(a===void 0&&(a={}),a[o]=e[o],s===void 0&&(s={...e}),s[o]=Do.apply(r.data[o],e[o]));return this.overrideData=a,s}else return{...Ur.defaultData,...e,...Ly(Ur.defaultData,ya.rootOverrideProps)}}updateByOp(e,n,r,s){let a;if(this.isInstanceRoot&&!s){if(n=this.transformAssignData(n,r),e.type===0&&e.path.length===0&&this.component)for(let o of ya.rootOverrideProps)o in e.props&&e.props[o]===void 0&&(a===void 0&&(a={...e,props:{...e.props}}),a.props[o]=this.component.data[o]);else if(e.type===0&&e.path.length>0&&ya.rootOverrideProps.includes(e.path[0])){let o=e.path[0];a===void 0&&(a={...e,path:[],props:{[o]:n[o]}})}}super.updateByOp(a??e,n,r,s)}updateState(e,n){this.updateState_Entity(e,n)}expandInstanceChildren(e){let n=this.data;if(this.component===void 0){let r=e.scene.find(n.component)??null,s=!1;if(r!==this.oldComponent){if(this.oldComponent){let a=0;for(let o of this.children)if(Dt.is(o))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(o),Kv(o),a+=1;else break;this.children.splice(0,a)}s=!0}if(r){let a={};VG(e,[this.uuid],n.overrides,this,r,r,0,s,a);for(let o of this.children)if(Dt.is(o)){let l=o.data;l.type==="Empty"&&l.animations&&o.traverseEntity(c=>{let u=c.dataPatched;if(c instanceof qt&&u.bones&&u.boneInverses){let d=c.dataPatched;if(d.bones&&d.boneInverses){let h=d.bones.map(m=>e.scene.find(a[m])),p=d.boneInverses.map(m=>new ne().fromArray(m)),f=new kl(h,p);c.bind(f,c.bindMatrix)}}else c.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function kG(i,t,e,n){return i.component===t&&Ql(i.identity,n)?i.overrideData===e?2:1:0}function VG(i,t,e,n,r,s,a,o,l){if(a>50)return!1;if(n.component!==r){if(n.component){let u=n.component.instances.indexOf(n);u>=0&&n.component.instances.splice(u,1)}r.instances.find(u=>u===n)||r.instances.push(n),n.component=r}r instanceof Zv&&r.isInstanceRoot&&r.expandInstanceChildren(i);let c=0;for(let u of r.children)if(Dt.is(u)){let d=[...t,...typeof u.identity=="string"?[u.identity]:u.identity],h=af.resolve(e,d,1);h!=null&&!(h instanceof Zn)&&(Object.setPrototypeOf(h,Zn.prototype),console.error("wrong prototype"));let p=null,f;if(!o){let m=n.children[c];if(p=Dt.is(m)?m:null,p!==null){let g=kG(p,u,h,d);f=g>=1?p.stateSelection:void 0,g!==2&&(p=null)}if(p===null&&(p=i.scene.findInstance(d)??null,p!==null)){let g=kG(p,u,h,d);if(f=g>=1?p.stateSelection:void 0,g!==2)p=null;else{let y=p.parent.children.indexOf(p);p.parent.children.splice(y,1),n.children.splice(c,0,p),p.parent===n?(y<=c&&console.error("not possible"),void 0):(p.parent=n,p.matrixWorldNeedsUpdate=!0,p.resetBBoxNeedsUpdate(),p.updateVisible(),i.pendingDeletes.delete(p),void 0)}}}if(p===null){let m=h?Do.apply(u.data,h):u.data;Qa.is(m.type)&&(m={...m,type:"Empty"}),p=xa.createEntity(d,m,i),p.overrideData=h,n.add(p),n.children.splice(n.children.length-1,1),n.children.splice(c,0,p),p.updateState(p.data,i),f&&p.changeSelectedState(f,i),i.scene.registerInstanceAndSetUuid(p)}if(p.isBone){let m=p.identity[p.identity.length-1];l[m]=p.uuid}c+=1,VG(i,t,e,p,u,s,a+1,o,l)}if(!o){let u=c;for(;;){let d=n.children[c];if(Dt.is(d))i.pendingDeletes.add(d);else break;c+=1}n.children.splice(u,c-u)}return!0}Qt();var zG=(i,t,e)=>new Zv(i,t,e);Yd("Component",zG);Yd("Instance",zG);_t("components");var AI=1e-10;function GG(i){let t=i[0][0],e=i[1][0],n=i[0][1],r=i[1][1],s=Math.sqrt(t*t+e*e),a=s>AI?t/s:1,o=s>AI?e/s:0,l=a*t+o*e,c=a*r-o*n,u=a*n+o*r;return{rotation:Math.atan2(o,a),scale:[l,c],shear:[Math.abs(c)>AI?u/c:0,0]}}function jG({rotation:i,scale:t,shear:e}){let n=Math.cos(i),r=Math.sin(i),s=e[0]*t[1],a=e[1]*t[0];return[n*t[0]-r*a,r*t[0]+n*a,n*s-r*t[1],r*s+n*t[1]]}var At;(S=>{function i(){return[1,0,0,0,1,0,0,0,1]}S.identity=i;function t(E,M=S.identity()){for(let w=0,T=E.length;w<T;w++)M[w]=E[w];return M}S.copy=t;function e(E,M,w,T,A,C){return S.setAbcdef(S.identity(),E,M,w,T,A,C)}S.create=e;function n(E,M,w,T,A,C,P){return E[0]=M,E[1]=T,E[2]=C,E[3]=w,E[4]=A,E[5]=P,E}S.setAbcdef=n;function r(E,M){let[w,T,A,C,P,D]=a(E),[I,L,U,G,X,ae]=a(M),ee=I*w+L*A,$=I*T+L*C,K=U*w+G*A,re=U*T+G*C,fe=X*w+ae*A+P,ve=X*T+ae*C+D;return S.create(ee,$,K,re,fe,ve)}S.append=r;function s(E,M){let[w,T,A,C,P,D]=a(E),[I,L,U,G,X,ae]=a(M),ee=w,$=T,K=A,re=C;(I!==1||L!==0||U!==0||G!==1)&&(ee=w*I+T*U,$=w*L+T*G,K=A*I+C*U,re=A*L+C*G);let fe=P*I+D*U+X,ve=P*L+D*G+ae;return S.create(ee,$,K,re,fe,ve)}S.prepend=s;function a(E){return[E[0],E[3],E[1],E[4],E[2],E[5]]}S.getAbcdef=a;function o(E){let[M,w,T,A,C,P]=S.getAbcdef(E),D=M*A-w*T,I=A/D,L=-w/D,U=-T/D,G=M/D,X=(T*P-A*C)/D,ae=-(M*P-w*C)/D;return S.create(I,L,U,G,X,ae)}S.invert=o;function l([E,M],w){let[T,A,C,P,D,I]=S.getAbcdef(w);return[T*E+C*M+D,A*E+P*M+I]}S.apply=l;function c(E,M){let[w,T,A,C,P,D]=S.getAbcdef(M),I=1/(w*C+A*-T),[L,U]=E;return[C*I*L+-A*I*U+(D*A-P*C)*I,w*I*U+-T*I*L+(-D*w+P*T)*I]}S.applyInverse=c;function u(E,M,w=M){let[T,A,C,P,D,I]=S.getAbcdef(E);return S.setAbcdef(E,T*M,A*w,C*M,P*w,D*M,I*w),E}S.scale=u;function d(E,M){let w=Math.cos(M),T=Math.sin(M),[A,C,P,D,I,L]=S.getAbcdef(E);return S.setAbcdef(E,A*w-C*T,A*T+C*w,P*w-D*T,P*T+D*w,I*w-L*T,I*T+L*w),E}S.rotate=d;function h(E,M,w){let[T,A]=w,C=S.translate(E,-T,-A);return C=S.rotate(C,M),C=S.translate(C,T,A),C}S.rotateAround=h;function p(E,M,w){let[T,A,C,P,D,I]=S.getAbcdef(E);return S.setAbcdef(E,T,A,C,P,D+M,I+w),E}S.translate=p;function f(E,M,w){let[T,A,C,P]=S.getAbcdef(E);return S.setAbcdef(E,T,A,C,P,M,w),E}S.setTranslate=f;function m(E,M,w){let[T,A,C,P]=S.getAbcdef(E);return S.setAbcdef(E,T,A,C,P,M,w),E}S.setPosition=m;function g(E){let[M,w,T,A]=S.getAbcdef(E),C=Math.sqrt(M*M+w*w),P=Math.sqrt(T*T+A*A);return[C,P]}S.getScale=g;function y(E){let[,,,,M,w]=S.getAbcdef(E);return[M,w]}S.getPosition=y;function v(E,M){return S.decompose(E,M).rotation}S.getRotation=v;function b(E,M){let[w,T,A,C,P,D]=S.getAbcdef(E),{rotation:I,scale:L,shear:U}=GG([[w,A],[T,C]]);return{position:[P+(M[0]*w+M[1]*A)-M[0],D+(M[0]*T+M[1]*C)-M[1]],scale:L,rotation:I,shear:U,pivot:M}}S.decompose=b;function x(E,M,w,T,A=[0,0]){let[C,P]=E,[D,I]=T,[L,U,G,X]=jG({rotation:w,scale:M,shear:A}),ae=C-(D*L+I*G)+D,ee=P-(D*U+I*X)+I;return S.create(L,U,G,X,ae,ee)}S.compose=x})(At||(At={}));function Dte(i,t){let[[e,n],[r,s]]=i,[[a,o],[l,c]]=t,u=(e-r)*(o-c)-(n-s)*(a-l);if(u===0)return!1;let d=((e-a)*(o-c)-(n-o)*(a-l))/u,h=-((e-r)*(n-o)-(n-s)*(e-a))/u;return d>=0&&d<=1&&h>=0&&h<=1}var WG=[[-1,1],[-1,-1],[1,-1],[1,1]],HG=(i,t,e)=>{let n=i.getCenter(),r=i.getHalfSize(),s=At.append(t,i.worldMatrix);r[0]===0&&r[1]===0?e.push(At.apply(n,s)):WG.forEach(a=>{let o=[a[0]*r[0]+n[0],a[1]*r[1]+n[1]];e.push(At.apply(o,s))})},Ou=class{constructor(){this.matrix=At.identity();this.min=[1/0,1/0];this.max=[-1/0,-1/0];this.vertices=[];this.edges=[]}setFromObjectSize(t,e=!1){t.updateWorldMatrix(),this.makeEmpty(),At.copy(t.worldMatrix,this.matrix);let n=At.invert(t.worldMatrix);this.expandByObjectSize(t,n,e)}expandByObjectSize(t,e,n=!1){let r=[],s=t.isBaseGroup===!0?t:void 0;n===!0&&s!==void 0?s.traverse(a=>{a.visible&&HG(a,e,r)}):HG(t,e,r),this.setFromPoints(r)}setFromSize(t,e,n){this.makeEmpty(),At.copy(n,this.matrix),this.expandBySize(t,e,n)}expandBySize(t,e,n){[At.apply([0,0],n),At.apply([0,e],n),At.apply([t,e],n),At.apply([t,0],n)].forEach(s=>this.expandByPoint(s))}getCenter(){let[t,e]=this.min,[n,r]=this.getHalfSize();return At.apply([t+n,e+r],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(t){this.makeEmpty();for(let e of t)this.expandByPoint(e)}expandByPoint(t){this.min=[Math.min(this.min[0],t[0]),Math.min(this.min[1],t[1])],this.max=[Math.max(this.max[0],t[0]),Math.max(this.max[1],t[1])]}computeVertices(){let[t,e]=this.getHalfSize(),n=this.getCenter(),[r,s,a,o]=At.getAbcdef(this.matrix),l=At.create(r,s,a,o,n[0],n[1]);this.vertices=WG.map(([c,u])=>At.apply([c*t,u*e],l))}computeEdges(){this.edges=[];for(let t=0,e=this.vertices.length;t<e;++t)this.edges.push([this.vertices[t],this.vertices[(t+1)%e]])}project(t,e){let n=this.matrix;return e&&(n=At.append(e.worldMatrix,n)),At.applyInverse(t,n)}intersects(t,e,n){return this.intersectsInLocalSpace(...this.project([t,e],n))}intersectsInLocalSpace(t,e){let{min:n,max:r}=this;return t>=n[0]&&t<=r[0]&&e>=n[1]&&e<=r[1]}containsPoint(t){let[e,n]=t,[r,s]=this.min,[a,o]=this.max;return e>=r&&e<=a&&n>=s&&n<=o}intersectsBBox2D(t){for(let e=0,n=this.edges.length;e<n;e++){let r=this.edges[e];for(let s=0,a=t.edges.length;s<a;s++){let o=t.edges[s];if(Dte(r,o))return!0}}for(let e=0,n=t.vertices.length;e<n;e++){let r=t.vertices[e];if(this.containsPoint(r))return!0}return!1}ensureMinMax(){let t=this.min,e=this.max;this.min=[Math.min(t[0],e[0]),Math.min(t[1],e[1])],this.max=[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}copy(t){this.min=[...t.min],this.max=[...t.max],At.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new Ou;return t.copy(this),t}};ft();var Lte='{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}',qG=()=>JSON.parse(Lte);async function Nte(i,t){return await i.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(i.Engine.prototype,"scene")||Object.defineProperty(i.Engine.prototype,"scene",{get:function(){let e=Object.create(i.SceneController.prototype);return e.__wbg_ptr=this.__wbg_ptr,e}}),{createEngine:e=>i.Engine.create(e,qG(),!0)}}var bE,Qv;function Bte(i){bE=i}function CI(){if(!Qv){if(!bE)return Promise.reject(new Error("HanaRenderer: no Hana UI loader registered. Call setHanaUILoader() from the host app before initializing a HanaRenderer."));Qv=bE(),Qv.catch(()=>{Qv=void 0})}return Qv}var XG;function Fte(){let i=typeof process<"u"?"2.0.11":void 0;return`https://cdn.spline.design/@splinetool/runtime${i?`@${i}`:""}/build/hana-ui.wasm`}function YG(i){XG=i}function $G(){return bE||Bte(async()=>{let t=await import("./hana-ui.js");return Nte(t,XG??Fte())}),CI().then(()=>{})}var wE=nd(SE(),1);function JG(i){let t=[],e;try{e=(0,wE.makeAbsolute)((0,wE.parseSVG)(i))}catch(c){return console.error("[HanaRenderer] Failed to parse SVG path:",c),t}let n=0,r=0,s=0,a=0,o=null,l=null;for(let c of e){let u=null,d=null;switch(c.code){case"M":n=s=c.x,r=a=c.y,t.push({MoveTo:{x:n,y:r}});break;case"L":n=c.x,r=c.y,t.push({LineTo:{x:n,y:r}});break;case"H":n=c.x,t.push({LineTo:{x:n,y:r}});break;case"V":r=c.y,t.push({LineTo:{x:n,y:r}});break;case"C":{let h={x:c.x1,y:c.y1},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"S":{let h=o?{x:2*n-o.x,y:2*r-o.y}:{x:n,y:r},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"Q":{let h={x:c.x1,y:c.y1};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"T":{let h=l?{x:2*n-l.x,y:2*r-l.y}:{x:n,y:r};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"A":{let h=n,p=r;n=c.x,r=c.y,zte(t,h,p,c.rx,c.ry,c.xAxisRotation,c.largeArc,c.sweep,n,r);break}case"Z":n=s,r=a,t.push("ClosePath");break}o=u,l=d}return t}function zte(i,t,e,n,r,s,a,o,l,c){if(t===l&&e===c)return;if(n=Math.abs(n),r=Math.abs(r),n===0||r===0){i.push({LineTo:{x:l,y:c}});return}let u=s*Math.PI/180,d=Math.cos(u),h=Math.sin(u),p=(t-l)/2,f=(e-c)/2,m=d*p+h*f,g=-h*p+d*f,y=m*m/(n*n)+g*g/(r*r);if(y>1){let ee=Math.sqrt(y);n*=ee,r*=ee}let v=n*n,b=r*r,x=v*b-v*g*g-b*m*m,S=v*g*g+b*m*m,E=(a!==o?1:-1)*Math.sqrt(Math.max(0,x/S)),M=E*(n*g)/r,w=E*(-r*m)/n,T=d*M-h*w+(t+l)/2,A=h*M+d*w+(e+c)/2,C=Math.atan2((g-w)/r,(m-M)/n),D=Math.atan2((-g-w)/r,(-m-M)/n)-C;!o&&D>0?D-=2*Math.PI:o&&D<0&&(D+=2*Math.PI);let I=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2))),L=D/I,U=4/3*Math.tan(L/4),G=C,X=t,ae=e;for(let ee=0;ee<I;ee++){let $=G+L,K=Math.cos(G),re=Math.sin(G),fe=Math.cos($),ve=Math.sin($),de=T+n*fe*d-r*ve*h,Se=A+n*fe*h+r*ve*d,oe=-n*re*d-r*K*h,be=-n*re*h+r*K*d,Oe=-n*ve*d-r*fe*h,Le=-n*ve*h+r*fe*d;i.push({CurveTo:[{x:X+U*oe,y:ae+U*be},{x:de-U*Oe,y:Se-U*Le},{x:de,y:Se}]}),G=$,X=de,ae=Se}}var ME=.5522847498307936,Hte=150,Wte=5*60*1e3,qte=(2728+680)/2816,Xte=1536/2816;function Yte(i){try{let t=new DataView(i),e=t.getUint32(0);if(e!==65536&&e!==1330926671&&e!==1953658213)return;let n=t.getUint16(4),r=-1,s=-1;for(let c=0;c<n;c++){let u=12+c*16,d=t.getUint32(u);d===1751474532&&(r=t.getUint32(u+8)),d===1330851634&&(s=t.getUint32(u+8))}if(r<0||s<0)return;let a=t.getUint16(r+18),o=t.getUint16(s);if(a===0||o<2)return;let l=t.getInt16(s+86);return l>0?l/a:void 0}catch{return}}var e4=!1;function t4(){e4||(e4=!0,console.warn("[HanaRenderer] clipRect: precise clipping of rotated/complex content is not supported by the Hana UI overlay yet; drawing unclipped. (Axis-aligned rectangles are clipped geometrically.)"))}var _E=class{constructor(t,e=1){this.canvas=t;this._dpr=e;this._width=0;this._height=0;this._isSizeDirty=!1;this._crashed=!1;this._shapes=[];this._lastPushedJSON="";this._ctm=At.identity();this._stack=[];this._clips=[];this._pathEls=[];this._simpleShape=null;this._pathPrimitives=0;this._fillColor=zt.transparent;this._strokeColor=zt.transparent;this._lineWidth=1;this._strokeMode="inside";this._layerBlur=0;this._backgroundBlur=0;this._dropShadowBlur=0;this._dropShadowOffsetX=0;this._dropShadowOffsetY=0;this._dropShadowColor=zt.transparent;this._innerShadowBlur=0;this._innerShadowOffsetX=0;this._innerShadowOffsetY=0;this._innerShadowSpread=0;this._innerShadowColor=zt.transparent;this._fonts=new Map;this._fontsFlushed=new Set;this._fontXPerEm=new Map;this._measureCache=new Map;try{let n=t.getBoundingClientRect();t.width=n.width*e,t.height=n.height*e}catch{console.log(t.width,e)}}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this._isSizeDirty=!0}get width(){return this._width}get height(){return this._height}async init(){if(!(this._engine||this._crashed)){try{this._context=await CI(),this._engine=await this._context.createEngine(this.canvas)}catch(t){this._crashed=!0,console.error("[HanaRenderer] Failed to load the Hana UI engine; UI scenes will not render.",t);return}if(this._width>0&&this._height>0)this._syncViewport();else{let t=this.canvas.getBoundingClientRect();t.width>0&&t.height>0&&(this._width=t.width,this._height=t.height,this._syncViewport())}this._flushFonts(),this.uiFontReady=this._watchUiFont()}}_watchUiFont(){return new Promise(t=>{let e=this._engine;if(!e||typeof e.scene.isUiFontLoaded!="function"){t();return}let n=()=>{let a=!1;return this._guard(()=>{a=e.scene.isUiFontLoaded()}),a};if(n()){t();return}let r=Date.now(),s=setInterval(()=>{if(this._crashed||Date.now()-r>Wte){clearInterval(s);return}n()&&(clearInterval(s),t())},Hte)})}_syncViewport(){let t=this._engine;if(!t||this._crashed)return;let e=this._width,n=this._height;this.canvas.style.width=e+"px",this.canvas.style.height=n+"px",this.canvas.width=Math.max(1,Math.ceil(e*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(n*this._dpr)),this._guard(()=>{t.resize([e,n],this._dpr),t.scene.updateCamera({position:[e/2,n/2],zoom:1})})}setSize(t,e){!this._isSizeDirty&&t===this._width&&e===this._height||(this._isSizeDirty=!1,this._width=t,this._height=e,this._engine?this._syncViewport():(this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",this.canvas.width=Math.max(1,Math.ceil(t*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(e*this._dpr))))}_guard(t){if(!this._crashed)try{t()}catch(e){this._crashed=!0,console.error("[HanaRenderer] Hana engine call failed; disabling this renderer instance.",e)}}async loadFont(t,e){try{let n=await fetch(t);if(!n.ok){console.error(`[HanaRenderer] loadFont: ${t} returned HTTP ${n.status}; skipping "${e}"`);return}let r=await n.arrayBuffer();if(r.byteLength===0){console.error(`[HanaRenderer] loadFont: ${t} was empty; skipping "${e}"`);return}this.registerFont(r,e)}catch(n){console.error(`[HanaRenderer] loadFont failed for "${e}" (${t}):`,n)}}registerFont(t,e){if(this._fonts.has(e))return;this._fonts.set(e,t);let n=Yte(t);n!==void 0&&this._fontXPerEm.set(e,n),this._flushFonts()}_flushFonts(){let t=this._engine;if(!!t)for(let[e,n]of this._fonts)this._fontsFlushed.has(e)||(this._fontsFlushed.add(e),this._guard(()=>{t.scene.addLocalFont(e,new Uint8Array(n))}))}set strokeColor(t){this._strokeColor=t}set fillColor(t){this._fillColor=t}set lineWidth(t){this._lineWidth=t}set strokeMode(t){this._strokeMode=t}set dropShadowBlur(t){this._dropShadowBlur=t}set dropShadowColor(t){this._dropShadowColor=t}set dropShadowOffsetX(t){this._dropShadowOffsetX=t}set dropShadowOffsetY(t){this._dropShadowOffsetY=t}set innerShadowBlur(t){this._innerShadowBlur=t}set innerShadowColor(t){this._innerShadowColor=t}set innerShadowOffsetX(t){this._innerShadowOffsetX=t}set innerShadowOffsetY(t){this._innerShadowOffsetY=t}set innerShadowSpread(t){this._innerShadowSpread=t}set layerBlur(t){this._layerBlur=t}set backgroundBlur(t){this._backgroundBlur=t}save(){this._stack.push({ctm:At.copy(this._ctm),clipLen:this._clips.length})}restore(){let t=this._stack.pop();!t||(this._ctm=t.ctm,this._clips.length=t.clipLen)}setTransform(t,e=!1){let n=At.identity();if(this.camera?.enabled&&(n=At.append(n,this.camera.worldMatrix),e)){let r=At.getScale(this.camera.worldMatrix);n=At.scale(n,1/r[0],1/r[1])}this._ctm=At.append(n,t)}transform(t){this._ctm=At.append(this._ctm,t)}beginPath(){this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0}closePath(){this._pathEls.length!==0&&this._pathEls[this._pathEls.length-1]!=="ClosePath"&&this._pathEls.push("ClosePath")}_startFreeform(){this._simpleShape=null,this._pathPrimitives++}moveTo(t,e){this._startFreeform(),this._pathEls.push({MoveTo:{x:t,y:e}})}lineTo(t,e){this._startFreeform(),this._pathEls.push({LineTo:{x:t,y:e}})}bezierCurveTo(t,e,n,r,s,a){this._startFreeform(),this._pathEls.push({CurveTo:[{x:t,y:e},{x:n,y:r},{x:s,y:a}]})}quadraticCurveTo(t,e,n,r){this._startFreeform(),this._pathEls.push({QuadTo:[{x:t,y:e},{x:n,y:r}]})}path(t){this._startFreeform(),this._pathEls.push(...JG(t))}rect(t,e,n,r,s=0,a=0,o=0,l=0){if(!i4([t,e,n,r]))return;let c={x:t,y:e,w:n,h:r,radii:[s,a,o,l]};this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"rect",rect:c,smoothing:0}:null,s4(this._pathEls,c)}ellipse(t,e,n,r,s,a,o,l){if(!!i4([t,e,n,r])){if(n<0||r<0)throw Error("radii cannot be negative");this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"ellipse",cx:t,cy:e,rx:n,ry:r}:null,Qte(this._pathEls,t,e,n,r)}}clipRect(t,e,n,r,s=0,a=0,o=0,l=0){let c=At.invert(this._ctm);!c||this._clips.push({m:At.copy(this._ctm),inv:c,rect:{x:t,y:e,w:n,h:r,radii:[s,a,o,l]}})}fill(){this._emit(!0)}stroke(){this._strokeColor.a<=0||this._lineWidth<=0||this._emit(!1)}_emit(t){let e=this._effectChain(t);if(t&&this._fillColor.a<=0&&!e)return;let n=this._classifyShape();if(!n)return;let r=this._applyClips(n);if(r==="skip")return;if(!t&&r!==n){let a=Jv(n);if(a){this._emitClippedRectStroke(a,e);return}}n=r;let s={shape:n,color:t?am(this._fillColor):[0,0,0,0],transform:At.getAbcdef(this._ctm)};t||(s.stroke=this._strokeDesc()),e&&(s.effect_chain=e),this._shapes.push(s)}_emitClippedRectStroke(t,e){let n=this._lineWidth,r=this._strokeMode==="outside"?n:this._strokeMode==="center"?n/2:0,s=n-r,a=Math.min(t.w,t.h)/2,o=t.radii.map(y=>Math.max(0,Math.min(y,a))),l={x:t.x-r,y:t.y-r,w:t.w+r*2,h:t.h+r*2,radii:o.map(y=>y>0?y+r:0)},c=t.w-s*2,u=t.h-s*2,d=c>0&&u>0?{x:t.x+s,y:t.y+s,w:c,h:u,radii:o.map(y=>Math.max(0,y-s))}:null,h=this._applyClips(EE(l,0));if(h==="skip")return;let p=Jv(h)??l,f=null;if(d){let y=this._applyClips(EE(d,0));f=y==="skip"?null:Jv(y)??d}let m=[];s4(m,p),f&&Zte(m,f);let g={shape:{Custom:m},color:am(this._strokeColor),transform:At.getAbcdef(this._ctm)};e&&(g.effect_chain=e),this._shapes.push(g)}_classifyShape(){let t=this._simpleShape;return t?t.kind==="rect"?EE(t.rect,t.smoothing):{Ellipse:{center_x:t.cx,center_y:t.cy,rx:t.rx,ry:t.ry}}:this._pathEls.length===0?null:{Custom:this._pathEls.slice()}}_strokeDesc(){return{width:this._lineWidth,line_join:"Miter",color:am(this._strokeColor),align:$te[this._strokeMode],cap:"Butt"}}_effectChain(t){let e=this.camera?.scale??1,n=[];if(t&&this._dropShadowColor.a>0&&n.push({DropShadow:{position:[this._dropShadowOffsetX*e,this._dropShadowOffsetY*e],blur:{Uniform:{size:2*this._dropShadowBlur*e}},spread:0,color:am(this._dropShadowColor)}}),t&&this._backgroundBlur>0){let[r,s]=At.getScale(this._ctm),a=(r+s)/2;n.push({BackgroundBlur:{blur:{Uniform:{size:2*this._backgroundBlur*a}}}})}if(this._layerBlur>0&&n.push({LayerBlur:{blur:{Uniform:{size:2*this._layerBlur*e}}}}),t&&this._innerShadowColor.a>0){let[r,s,a,o]=At.getAbcdef(this._ctm),l=this._innerShadowOffsetX,c=this._innerShadowOffsetY;n.push({InnerShadow:{position:[r*l+a*c,s*l+o*c],blur:{Uniform:{size:2*this._innerShadowBlur*e}},spread:this._innerShadowSpread*e,color:am(this._innerShadowColor)}})}return n.length>0?n:void 0}_applyClips(t){if(this._clips.length===0)return t;let e=t;for(let n of this._clips){let r=At.append(n.inv,this._ctm),[s,a,o,l,c,u]=At.getAbcdef(r),d=Math.abs(a)<=1e-6*(Math.abs(s)+Math.abs(l))&&Math.abs(o)<=1e-6*(Math.abs(s)+Math.abs(l)),h=Kte(e);if(!h)return e;if(!d){t4();continue}let p=s*h.minX+c,f=s*h.maxX+c,m=l*h.minY+u,g=l*h.maxY+u,y=Math.min(p,f),v=Math.max(p,f),b=Math.min(m,g),x=Math.max(m,g),S=n.rect,E=Math.max(y,S.x),M=Math.max(b,S.y),w=Math.min(v,S.x+S.w),T=Math.min(x,S.y+S.h);if(E>=w||M>=T)return"skip";if(E===y&&M===b&&w===v&&T===x)continue;let C=Jv(e);if(!C||s===0||l===0){t4();continue}let P=(E-c)/s,D=(w-c)/s,I=(M-u)/l,L=(T-u)/l,U=Math.min(P,D),G=Math.min(I,L),X=Math.abs(D-P),ae=Math.abs(L-I),[ee,$,K,re]=C.radii,fe=U!==C.x,ve=G!==C.y,de=U+X!==C.x+C.w,Se=G+ae!==C.y+C.h,oe=Math.min(X,ae)/2,be=[fe||ve?0:Math.min(ee,oe),de||ve?0:Math.min($,oe),de||Se?0:Math.min(K,oe),fe||Se?0:Math.min(re,oe)];e=EE({x:U,y:G,w:X,h:ae,radii:be},0)}return e}drawText(t,e){let n=this._fontXPerEm.get(e.font),r=n?n/Xte:1,s={TextSimple:{text:t,font_size:e.fontSize*qte*r,size:[e.width,e.height],horizontal_align:n4[e.horizontalAlign]??"Left",vertical_align:r4[e.verticalAlign]??"Top"}},a=this._effectChain(!0),o=this._fillColor.a>0,l=this._strokeColor.a>0&&this._lineWidth>0;if(o||l||a){let c={shape:s,color:o?am(this._fillColor):[0,0,0,0],transform:At.getAbcdef(At.append(this._ctm,At.translate(At.identity(),e.x,e.y)))};l&&(c.stroke=this._strokeDesc()),a&&(c.effect_chain=a),this._shapes.push(c)}return{height:this._measureTextHeight(t,e)}}_measureTextHeight(t,e){let n=`${e.font}|${e.fontSize}|${e.lineHeight}|${e.letterSpacing}|${e.width}|${t}`,r=this._measureCache.get(n);if(r!==void 0)return r;let s=0,a=this._engine;if(a&&!this._crashed&&this._fontsFlushed.has(e.font))try{let[,o]=a.scene.measureTextNaturalSize({size:[e.width,e.height],text:t,fontSize:e.fontSize,horizontalAlign:n4[e.horizontalAlign]??"Left",verticalAlign:r4[e.verticalAlign]??"Top",lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textTransform:"None",font:e.font,version:0,autoSize:"None",truncate:"None"});s=o}catch{}if(!(s>0)){let o=e.fontSize*.55+Math.max(0,e.letterSpacing),l=Math.max(1,Math.floor(e.width/o)),c=0;for(let u of t.split(`
9789
+ `,n.pyramidTextureSize.value=new j(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(s.uniforms,n)};this.material.shapeBlendhack=r,this.material.root.shapeBlendhack=r}dispose(){super.dispose(),Qz()?.release(this)}},$v=EI;$v.streamCompaction=new sE;var xte=new ne,Ste=new ne,sm=new qe,lh=new _,gE=new _,wte=new qe;function Ete(i,t=0){let e=this.children.length;for(;e--;){let n=this.children[e];cc.is(n)&&IG.call(n,i,t+1)}}function IG(i,t=0){if(i(this,t)!==!0){let n=this.children.length;for(;n--;){let r=this.children[n];cc.is(r)&&IG.call(r,i,t+1)}}}function Mte(){if(this.shapesDataTexture.value===void 0){let g=new Hn(new Float32Array(4*$r*gc),$r,gc,qn,Wt);this.shapesDataTexture.value=g}let i=this.shapesDataTexture.value,t=i.image.data,e=0,n=0,r=this.data.geometry.blendRange,s=xte.copy(this.matrixWorld).invert(),a=this._npart,o=0;this._meshSdfWanted.clear();let l=null;if(Ete.call(this,g=>{if(g.visible===!1)return!0;let y;if(g instanceof Zs)return;if(g instanceof al||xu(g))return;g instanceof Yr?y=g.object:y=g;let v=g.data?.cloner;if(Dt.is(g)&&v&&!v.hideBase&&v.type!=="radial"&&v.disabled!==!0||!(y instanceof qt))return;let b=y.geometry.userData.parameters,x=b?.shapeBlendNode??y.dataPatched?.geometry?.shapeBlendNode;if(x===void 0)return;if(Ste.multiplyMatrices(s,g.matrixWorld).decompose(gE,sm,lh),b?.type==="TorusGeometry"&&b.arc!==360){let I=b.arc*Math.PI/180;I=I/4,sm.multiply(wte.set(0,0,Math.sin(I),Math.cos(I)))}let E=x.overrideGlobalBlend?x.blendRange:r;E=E/this.bboxSize*2,t[o*4]=(gE.x-this.bboxOffset)/this.bboxSize*2,t[o*4+1]=(gE.y-this.bboxOffset)/this.bboxSize*2,t[o*4+2]=(gE.z-this.bboxOffset)/this.bboxSize*2,t[o*4+3]=x.operation===0?1:x.operation===2?-1:-2,t[$r*4+o*4]=-sm.x,t[$r*4+o*4+1]=-sm.y,t[$r*4+o*4+2]=-sm.z,t[$r*4+o*4+3]=sm.w;let M=new Float32Array(4),w=0,T=E;if(b?.type==="SphereGeometry")b.width===b.height&&b.width===b.depth?M[0]=0:M[0]=1,M[1]=b.width/this.bboxSize,M[2]=b.height/this.bboxSize,M[3]=b.depth/this.bboxSize,T=Math.max(M[1],M[2],M[3])*lh.x+E;else if(b?.type==="CubeGeometry"){w=b.cornerRadius;let I=b.width,L=b.height,U=b.depth;M[0]=2,M[1]=(I-2*w)/this.bboxSize,M[2]=(L-2*w)/this.bboxSize,M[3]=(U-2*w)/this.bboxSize,T=Math.sqrt(I**2+L**2+U**2)/this.bboxSize*lh.x+E}else if(b?.type==="CylinderGeometry"){w=b.cornerRadius;let I=b.height,L=b.radiusBottom,U=b.radiusTop;if(U>=L){let G=Math.atan2(U-L,I),X=(Math.PI/2-G)/2;U-=w/Math.tan(X),L-=w*Math.tan(X)}else if(L>U){let G=Math.atan2(L-U,I),X=(Math.PI/2-G)/2;U-=w*Math.tan(X),L-=w/Math.tan(X)}M[1]=(b.height-2*w)/this.bboxSize,L===U?(M[0]=3,M[2]=L/this.bboxSize*2):(M[0]=4,M[2]=L/this.bboxSize*2,M[3]=U/this.bboxSize*2),T=(Math.hypot(M[1],Math.max(Math.abs(M[2]),Math.abs(M[3])))+w/this.bboxSize*2)*lh.x+E}else if(b?.type==="TorusGeometry"){if(M[0]=5,M[1]=(b.width-b.depth)/this.bboxSize,M[2]=b.depth/this.bboxSize,b.arc!==360){M[0]=6,M[3]=M[1],t[$r*12+o*4+3]=M[2];let I=2*Math.atan2(M[2]/2,M[1]),L=b.arc*Math.PI/180/2-I;M[1]=Math.sin(L),M[2]=Math.cos(L)}T=b.width*lh.x/this.bboxSize+E}else{let I=y.geometry;(l??(l=new Set)).add(I.uuid);let L=this._meshSdfBaked.get(I.uuid),U=bte(I);if((L===void 0||L.posVersion!==U)&&this._meshSdfWanted.set(I.uuid,I),L===void 0)return;M[0]=7,M[1]=L.slot,M[2]=L.boxHalf.x/this.bboxSize*2,M[3]=L.boxHalf.y/this.bboxSize*2,t[$r*12+o*4+3]=L.boxHalf.z/this.bboxSize*2,T=Math.hypot(L.boxHalf.x,L.boxHalf.y,L.boxHalf.z)/this.bboxSize*2*lh.x+E}t.set(M,$r*8+o*4),e=Math.max(e,T),n=Math.max(n,E),this._reach[o]=T,t[$r*12+o*4]=E,t[$r*12+o*4+1]=w/this.bboxSize*2,t[$r*12+o*4+2]=lh.x;let A=Array.isArray(y.material)?y.material[0]:y.material,C=A,P,D;if(C?.getShapeBlendBaseColor){let I=C.getShapeBlendBaseColor();P=I,D=I.a}else A?.uniforms?.nodeU0!==void 0?(P=A.uniforms.nodeU0.node.value,D=A.uniforms.nodeU1?.value??1):(P={r:1,g:1,b:1},D=1);x.operation!==0&&!x.useColor&&(D=-1),t[$r*16+o*4]=P.r,t[$r*16+o*4+1]=P.g,t[$r*16+o*4+2]=P.b,t[$r*16+o*4+3]=D,D<1&&this.material.defines?.SHAPEBLEND_C===1&&(this.material.transparent=!0),o++}),this._meshSdfBaked.size>0){let g=l??new Set;for(let y of this._meshSdfBaked.keys())g.has(y)||this._meshSdfBaked.delete(y)}this.npart=o,this._maxBlendK=n;let c=e*1.1+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=c;let u=this._prevShapeData,d=a!==o,h=u===null||this._prevSpan!==c||d,p=h||wI,f=this._fieldDirtyMin.set(1/0,1/0,1/0),m=this._fieldDirtyMax.set(-1/0,-1/0,-1/0);if(u!==null){let g=Math.max(o,a);for(let y=0;y<g;y++){let v=!1;for(let C=0;C<gc;C++){let P=$r*4*C+y*4;if(t[P]!==u[P]||t[P+1]!==u[P+1]||t[P+2]!==u[P+2]||t[P+3]!==u[P+3]){v=!0;break}}if(!v)continue;if(h=!0,p)break;let b=t[y*4],x=t[y*4+1],S=t[y*4+2],E=u[y*4],M=u[y*4+1],w=u[y*4+2],T=this._reach[y],A=this._prevReach[y];if(!Number.isFinite(b+x+S+T)||!Number.isFinite(E+M+w+A)){p=!0;continue}f.x=Math.min(f.x,b-T,E-A),f.y=Math.min(f.y,x-T,M-A),f.z=Math.min(f.z,S-T,w-A),m.x=Math.max(m.x,b+T,E+A),m.y=Math.max(m.y,x+T,M+A),m.z=Math.max(m.z,S+T,w+A)}}return wI&&(h=!0),this._fieldDirtyFull=p||f.x===1/0,h&&(u===null?this._prevShapeData=new Float32Array(t):u.set(t),this._prevReach.set(this._reach),this._prevSpan=c,i.needsUpdate=!0),h}Qt();Sa("ShapeBlendGeometry",(i,t,e)=>new $v(i,t,e));_t("shape-blends");gi();ds();var yE=class extends qt{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?uv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}};Qt();Sa("VectorGeometry",(i,t,e)=>new yE(i,t,e));_t("vector-shapes");ds();gi();Sv();gw();Mv();vw();var vE=class extends qt{constructor(e,n,r){super(e,n,r);this.isPathObject=!0;this._shapeId=null;this._lastShapeParams=null;this._lastShape=null;this._context=r}updateState(e,n){super.updateState(e,n),this.updateShape(),this.refreshAttachedCloners(n)}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let s in e)typeof e[s]=="string"&&(e[s]=this._context.shared.getVariable(e[s],[this.uuid,"geometry","extrusion","shape",s]));let n;if(e.type==="Custom"){let s=e.shapeId;if(s!==this._shapeId&&this.detachShape(),s){this._shapeId=s;let a=this._context.scene.find(s);a?.data&&(a.attachedPaths.add(this),n=a.geometry.userData?.shape),n||this._context.scene.addPendingCommand(()=>this.updateShape())}}else if(this._lastShape!==null&&this._sameShapeParams(e))n=this._lastShape;else{let s;switch(e.type){case"Rectangle":s=Vf;break;case"Ellipse":s=Uf;break;case"Polygon":s=mw;break;case"Star":s=yw;break;default:throw new Error(`Unknown shape type: ${e.type}`)}n=s.create({parameters:e}).userData.shape,this._lastShapeParams=e,this._lastShape=n??null}let r=this.geometry;n&&r.inputs&&(r.inputs.shapeData=n,r.build())}_sameShapeParams(e){let n=this._lastShapeParams;if(n===null)return!1;for(let r in e)if(!Object.is(e[r],n[r]))return!1;for(let r in n)if(!(r in e))return!1;return!0}detachShape(){this._shapeId!==null&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}supportsInPlaceGeometryUpdate(){return!1}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,n){return super.updateTransformState(e,n)}updateGeometryInteractions(e,n){super.updateGeometryInteractions(e,n),this.updateShape()}updateEntityBoxSize(e,n){let r=this.geometry.getAttribute("position");r!==void 0&&r.count>0?uv(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,e,n):super.updateEntityBoxSize(e,n)}};Qd();Y();ft();Sv();hw();wP();function OG(i,t){let e=2*Math.PI;return(i%e+e)%e===(t%e+e)%e}var _te=new ne,Tte=new ne,Ate=new ne,RG=new _,DG=new _,LG=new _,Cte=new _,Pte=new _,Ite=new _,Ote=new _,NG=new WeakMap,MI=new WeakMap,BG=new WeakMap;function Rte(i,t,e){let n=[new _,new _,new _],r=[new _,new _,new _];return i.extractBasis(n[0],n[1],n[2]),t.extractBasis(r[0],r[1],r[2]),n.forEach((s,a)=>{let o=r[a],l=we.lerp(s.length(),o.length(),e);s.lerp(o,e).setLength(l)}),new ne().makeBasis(n[0],n[1],n[2])}function FG(i){i.setIndex(null),i.setAttribute("position",new je(new Float32Array(0),3)),i.setAttribute("normal",new je(new Float32Array(0),3)),i.setAttribute("uv",new je(new Float32Array(0),2)),i.setDrawRange(0,0)}var UG=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),a=t?.shapeData??Uf.create({parameters:{...Gd,width:typeof Gd.width=="number"?Gd.width:100,height:typeof Gd.height=="number"?Gd.height:100}}).userData.shape;return{path:i.path??ef.defaultData(),parameters:Object.assign(e,{width:n,height:r,depth:s,extrusion:{...u1,...e.extrusion}}),shapeData:a}}static build(i){if(i.path.points.length>=2){let e=new _I(i);return Object.assign(e,{userData:{...i,type:"PathGeometry"}})}else{let e=new De;return FG(e),Object.assign(e,{userData:{...i,type:"PathGeometry"}})}}},_I=class extends De{constructor(e){super();this.type="PathExtrusionGeometry",this.inputs=e,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&this.inputs.parameters.extrusion.depth===1}_isOpenEnded(){let e=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&e.depth===1)||!OG(e.twist,0)||e.startScale!==e.endScale}build(){let{points:e,matrices:n}=this._getSampledPath();if(e.length<2){FG(this);return}let{depth:r,offset:s}=this.inputs.parameters.extrusion;r=Math.max(0,Math.min(r,1)),s=Math.max(0,Math.min(s,1));let a=this.inputs.path.isClosed?e.length:e.length-1,o=Math.floor(s*a),l=this.inputs.path.isClosed?Math.ceil((r+s)*a):Math.ceil(Math.min(1,r+s)*a),c=Math.min(Math.max(2,l-o+1),a+2),u=[],d=[];for(let re=0;re<c;re++){let fe=this.inputs.path.isClosed?(re+o)%e.length:Math.min(re+o,e.length-1);u.push(e[fe].clone()),d.push(n[fe].clone())}let h=(re,fe,ve)=>{u[re]=u[re].clone().lerp(u[fe],ve),d[re]=Rte(d[re],d[fe],ve)},p=0,f=s*a%1;(!this.inputs.path.isClosed||r<=1)&&(f||s===0)&&(p=f,h(0,1,p));let m=0,g=(s+r)*a%1;if((this.inputs.path.isClosed&&r<=1||!this.inputs.path.isClosed&&s+r<1)&&g&&(m=g,h(u.length-1,u.length-2,1-m)),r===0){let re=u.length-1;u[re].copy(u[0]),d[re].copy(d[0])}this._applyPathModifiers(d,p,m);let{bevel:y,bevelSides:v}=this.inputs.parameters.extrusion,b=y>0?this.inputs.parameters.extrusion.capType:"flat",x=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(x=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:S,infos:E,vertices:M}=this._getShapePoints(x),w=0,T;if(b==="round"){let re=this.inputs.shapeData,fe=BG.get(re);fe!==void 0&&fe.bevel===y&&fe.curveSegments===x&&fe.bevelSides===v?T=fe.geometry:(T=new Mu(re,2*y,y,x,v,void 0,!0),BG.set(re,{bevel:y,curveSegments:x,bevelSides:v,geometry:T})),w=T.getAttribute("position").count}let A=0,C=0;E.sort((re,fe)=>re.start-fe.start),E.forEach(re=>{re.verticesStart=A,re.verticesCount=re.continuous.reduce((fe,ve,de)=>fe+(de===0||!ve?2:1),0),C+=re.verticesCount,A=C});let P=C*c,D,I=0;this._isOpenEnded()&&b==="flat"&&(D=this._getSurfaceTesselation(S),I=D.vertexCount);let L=P+2*I+w*2,U=P+2*I,G={positions:new Float32Array(L*3),normals:new Float32Array(L*3),uvs:new Float32Array(L*2)},X=T?T.getIndex().array:null,ae=0;E.forEach(re=>{ae+=re.count});let ee=ae*(c-1)*6+(D?2*D.elementCount*3:0)+(X?2*X.length:0),$=new Uint32Array(ee),K=0;if(E.forEach(re=>{K=this._extrudeRegion(re,M,d,u,G,$,K,this._isGeometryClosed()&&!this._isOpenEnded())}),D&&(K=this._closeEnd(D,P,$,K,G,d[0],u[0],!1),K=this._closeEnd(D,P+I,$,K,G,d[d.length-1],u[u.length-1],!0)),T){G.positions.set(T.getAttribute("position").array,U*3),G.normals.set(T.getAttribute("normal").array,U*3),G.uvs.set(T.getAttribute("uv").array,U*2);for(let de=U;de<U+w;de++)G.uvs[de*2+1]=1e-4;let re=K;for(let de=0;de<X.length;de++)$[K++]=X[de]+U;U+=w,G.positions.set(T.getAttribute("position").array,U*3),G.normals.set(T.getAttribute("normal").array,U*3),G.uvs.set(T.getAttribute("uv").array,U*2);let fe=K;for(let de=0;de<X.length;de++)$[K++]=X[de]+U;this.setAttribute("position",new je(G.positions,3)),this.setAttribute("normal",new je(G.normals,3)),this.setAttribute("uv",new je(G.uvs,2)),this._setIndexFromUint32($);let ve=_te;ve.copy(d[d.length-1]).setPosition(u[u.length-1]),this.applyMatrix4OnRange(ve,U,L),ve.copy(d[0]).setPosition(u[0]).multiply(Tte.makeScale(1,1,-1)),this.applyMatrix4OnRange(ve,U-w,U),this.reverseIndicesOnRange(re,fe)}else this.setAttribute("position",new je(G.positions,3)),this.setAttribute("normal",new je(G.normals,3)),this.setAttribute("uv",new je(G.uvs,2)),this._setIndexFromUint32($)}_setIndexFromUint32(e){let n=!1;for(let r=e.length-1;r>=0;--r)if(e[r]>=65535){n=!0;break}this.setIndex(new je(n?e:new Uint16Array(e),1))}_getSampledPath(){let e=this.inputs.path,n=V1(e),r=NG.get(n);if(r===void 0||r.subdivisions!==e.subdivisions||r.subdivisionMode!==e.subdivisionMode){let s=this._extractPathPoints(n),a=s.length<2?[]:this._computeBasisMatrices(s);r={subdivisions:e.subdivisions,subdivisionMode:e.subdivisionMode,points:s,matrices:a},NG.set(n,r)}return r}_extractPathPoints(e){let n=this.inputs.path.subdivisions,r=this.inputs.path.subdivisionMode==="uniform"?e.getSpacedPoints(n*4):e.getPoints(n);if(r.length<2)return[];let s=[r[0]];return r.forEach(o=>{s[s.length-1].distanceToSquared(o)>.001&&s.push(o)}),this.inputs.path.isClosed&&s[s.length-1].distanceTo(s[0])<.001&&s.pop(),s}_computeBasisMatrices(e){let n=[],r=e.length,s=this.inputs.path.isClosed,a=new _,o=new _,l=new _,c=new _,u=new _(0,1,0);for(let g=0;g<r;g++){let y=e[g],v;g===0?v=s?e[e.length-2]:RG.copy(y).multiplyScalar(2).sub(e[1]):v=e[g-1];let b;g===r-1?b=s?e[1]:RG.copy(y).multiplyScalar(2).sub(e[g-1]):b=e[g+1],DG.subVectors(y,v).normalize(),LG.subVectors(b,y).normalize();let x=Cte.addVectors(DG,LG).normalize();l.copy(x),g===0&&(x.equals(u)||Pte.copy(x).negate().equals(u))&&u.set(0,0,1);let S=Ite.crossVectors(u,x).normalize(),E=Ote.crossVectors(x,S).normalize();u.copy(E),c.copy(S),g===0&&(a.copy(E),o.copy(x));let M=new ne().makeBasis(S,E,x);n.push(M)}let d=s?o:l,h=s?a:new _(0,1,0),p=d.clone().cross(c).normalize(),f=Math.acos(h.dot(p));if(isNaN(f))return n;let m=h.clone().cross(p);d.dot(m)>0&&(f*=-1);for(let g=1;g<n.length;g++)n[g].multiply(Ate.makeRotationZ(f*g/n.length));return n}_applyPathModifiers(e,n,r){let s=e.length,{angle:a,twist:o,startScale:l,endScale:c}=this.inputs.parameters.extrusion,u=new ne,d=new ne;return e.forEach((h,p)=>{let f=p===0?0:p===s-1?1:(p-n)/(s-(r===0?0:1)-(n+(1-r)));u.makeRotationZ(we.lerp(a,a+o,f)*we.DEG2RAD);let m=we.lerp(l,c,f);d.makeScale(m,m,m),h.multiply(u).multiply(d)}),e}_getShapePoints(e,n=ln.ODD){let r=this.inputs.shapeData,s=MI.get(r);return(s===void 0||s.curveSegments!==e||s.windingRule!==n)&&(s={curveSegments:e,windingRule:n,shapePoints:this._computeShapePoints(e,n)},MI.set(r,s)),s.shapePoints}_getSurfaceTesselation(e){let n=MI.get(this.inputs.shapeData);if(n?.surfaceTesselation!==void 0)return n.surfaceTesselation;let r;try{r=oo({windingRule:ln.ODD,elementType:Or.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:e})}catch{r=o2}return n!==void 0&&(n.surfaceTesselation=r),r}_computeShapePoints(e=12,n=ln.ODD){let r=this.inputs.shapeData,s=r.extractShapePointsToFlatArray([],e),a=r.shapeHoles.map(m=>{let g=m.extractShapePointsToFlatArray([],e),y=[];for(let v=g.length-1;v>=1;v-=2){let b=g[v-1],x=g[v-0];y.push(b,x)}return y}),o;try{o=oo({windingRule:n,elementType:Or.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]})}catch{o=xv}let l;try{l=oo({windingRule:ln.ODD,elementType:Or.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]})}catch{l=a2}if(!o)throw new Error("error generating geometry");let c=o.elementCount;if(l){o.elementCount+=l.elementCount;for(let m=0;m<l.elements.length;m++){let g=l.elements[m],y=m%2===0?o.vertexCount:0;o.elements.push(g+y)}for(let m=0;m<l.vertexIndices.length;m++){let g=l.vertexIndices[m],y=o.vertexCount;o.vertexIndices.push(g+y)}for(let m=0;m<l.vertices.length;m++){let g=l.vertices[m];o.vertices.push(g)}}let u=1/0,d=-1/0,h=1/0,p=-1/0;for(let m=0,g=o.vertexCount;m<g;m++){let y=m*2,v=o.vertices[y+0],b=o.vertices[y+1];v<u&&(u=v),v>d&&(d=v),b<h&&(h=b),b>p&&(p=b)}let f=[];for(let m=o.elementCount-1;m>=0;m--){let g=m>=c,y=m*2,v=o.elements[y+0],b=o.elements[y+1],x=v+b,S={start:v,count:b,normals:[],isHole:g,continuous:[],verticesStart:0,verticesCount:0};f.push(S);let E=v,M=x-1,w=v+1,T=r.roundedCurves.length;do{let A=E-v,C=o.vertices[M*2+0],P=o.vertices[M*2+1],D=o.vertices[E*2+0],I=o.vertices[E*2+1],L=o.vertices[w*2+0],U=o.vertices[w*2+1],G=D-C,X=I-P,ae=Math.sqrt(G*G+X*X);G/=ae,X/=ae;let ee=D-L,$=I-U,K=Math.sqrt(ee*ee+$*$);ee/=K,$/=K,S.normals[A*2+0]=-$,S.normals[A*2+1]=ee;let re=o.vertexIndices[E];if(Array.isArray(re))S.continuous[A]=!1;else{let[fe,ve]=r.getCurveIndexFromVertexId(re-1,!0);if(ve>0&&ve<1)S.continuous[A]=!0;else{let de=ve===1?fe+1:fe-1;de=(de+T)%T;let Se=ve===1?0:1,oe=r.roundedCurves[fe].getTangent(ve),be=r.roundedCurves[de].getTangent(Se);S.continuous[A]=oe.dot(be)>.95}}g&&(S.normals[A*2+0]*=-1,S.normals[A*2+1]*=-1),[M,E,w]=[E,w,w+1],w>=x&&(w-=b)}while(w!==v+1)}return{regions:[s,...a],infos:f,vertices:o.vertices}}_insertVertex(e,n,r,s,a){let o=n*2,l=n*3;e.positions[l+0]=r.x,e.positions[l+1]=r.y,e.positions[l+2]=r.z,e.normals[l+0]=s.x,e.normals[l+1]=s.y,e.normals[l+2]=s.z,e.uvs[o+0]=a.x,e.uvs[o+1]=a.y}_extrudeRegion(e,n,r,s,a,o,l,c){let u=e.wallTemplate;if(u===void 0){u=[];for(let x=0;x<e.count;x++){let S=(e.start+x)*2,E=n[S+0],M=n[S+1],w,T;if(e.continuous[x])w=e.normals[x*2+0],T=e.normals[x*2+1];else{let C=x===0?(e.start+e.count-1)*2:S-2,P=E-n[C+0];w=-(M-n[C+1]),T=P,e.isHole||(w=-w,T=-T)}let A=x===0?1:x/e.count;if(u.push(E,M,w,T,A,0),!e.continuous[x]||x===0)if(x===0)u.push(E,M,e.normals[0],e.normals[1],0,1);else{let C=x===e.count-1?e.start*2:S+2,P=n[C+0]-E;w=-(n[C+1]-M),T=P,e.isHole||(w=-w,T=-T),u.push(E,M,w,T,A,1)}}e.wallTemplate=u}let d=r.length,h=u.length,p=a.positions,f=a.normals,m=a.uvs;for(let x=0;x<d;x++){let S=r[x].elements,E=S[0],M=S[1],w=S[2],T=S[4],A=S[5],C=S[6],P=S[12],D=S[13],I=S[14],L=s[x],U=x/(d-1),G=0,X=0,ae=0,ee=e.verticesStart*d+e.verticesCount*x;for(let $=0;$<h;$+=6){if(u[$+5]===0){let Oe=u[$+0],Le=u[$+1];G=E*Oe+T*Le+P+L.x,X=M*Oe+A*Le+D+L.y,ae=w*Oe+C*Le+I+L.z}let K=u[$+2],re=u[$+3],fe=E*K+T*re+P,ve=M*K+A*re+D,de=w*K+C*re+I,Se=1/(Math.sqrt(fe*fe+ve*ve+de*de)||1);fe*=Se,ve*=Se,de*=Se;let oe=ee*2,be=ee*3;p[be+0]=G,p[be+1]=X,p[be+2]=ae,f[be+0]=fe,f[be+1]=ve,f[be+2]=de,m[oe+0]=u[$+4],m[oe+1]=U,ee++}}let g=e.wallQuadPattern;if(g===void 0){g=[];let x=0;for(let S=0;S<e.count;S++)(!e.continuous[S]||S===0)&&x++,g.push(x,S===e.count-1?0:x+1),x++;e.wallQuadPattern=g}let y=d-1,v=g.length,b=e.isHole;for(let x=0;x<y;x++){let S=e.verticesStart*d+e.verticesCount*x,E=S+e.verticesCount;for(let M=0;M<v;M+=2){let w=S+g[M],T=S+g[M+1],A=E+g[M+1],C=E+g[M];b?(o[l++]=w,o[l++]=A,o[l++]=T,o[l++]=w,o[l++]=C,o[l++]=A):(o[l++]=w,o[l++]=T,o[l++]=A,o[l++]=w,o[l++]=A,o[l++]=C)}}return l}_closeEnd(e,n,r,s,a,o,l,c){let u=e.vertexCount,d=new _(0,0,c?-1:1).applyMatrix4(o),h=new _,p=new j;for(let m=0;m<u;m++){let g=2*m;h.set(e.vertices[g+0],e.vertices[g+1],0).applyMatrix4(o).add(l),this._insertVertex(a,n+m,h,d,p)}let f=e.elements;for(let m=0;m<e.elementCount;m++){let g=3*m;r[s++]=f[g+0]+n,r[s++]=f[g+(c?1:2)]+n,r[s++]=f[g+(c?2:1)]+n}return s}applyMatrix4OnRange(e,n,r){let s=e.elements,a=new wt().getNormalMatrix(e).elements,o,l,c,u,d=this.attributes.position,h=this.attributes.normal;if(!d||!h)return;let p=d.array,f=h.array,m=d.itemSize;for(let g=n*m,y=r*m;g<y;g+=m)o=p[g+0],l=p[g+1],c=p[g+2],u=1/(s[3]*o+s[7]*l+s[11]*c+s[15]),p[g+0]=(s[0]*o+s[4]*l+s[8]*c+s[12])*u,p[g+1]=(s[1]*o+s[5]*l+s[9]*c+s[13])*u,p[g+2]=(s[2]*o+s[6]*l+s[10]*c+s[14])*u,o=f[g+0],l=f[g+1],c=f[g+2],f[g+0]=a[0]*o+a[3]*l+a[6]*c,f[g+1]=a[1]*o+a[4]*l+a[7]*c,f[g+2]=a[2]*o+a[5]*l+a[8]*c;d.needsUpdate=!0,h.needsUpdate=!0}reverseIndicesOnRange(e,n){let r=this.index;if(r){for(let s=e;s<n;s+=3){let a=r.getX(s),o=r.getX(s+1),l=r.getX(s+2);r.setXYZ(s,l,o,a)}r.needsUpdate=!0}}};Qt();Sa("PathGeometry",(i,t,e)=>new vE(i,t,e));ev("PathGeometry",UG);_t("3d-paths");Jy();Qt();xa.Cloner=Zs;_t("cloners");an();hn();ft();Y();Zy();Jy();Yi();Su();ds();TI();var Zv=class extends Ma(Us,ba){constructor(e,n,r){super();this.isComponentObject=!0;n.type==="Instance"&&typeof e=="string"&&(n=this.transformAssignData(n,r)),this.super_Entity(e,n),this.objectHelper.update()}get isComponentRoot(){return this.data.type==="Component"&&typeof this.identity=="string"}get isInstanceRoot(){return this.data.type==="Instance"&&typeof this.identity=="string"}transformAssignData(e,n){let r=vu.getComponentData({scene:n.scene.data,shared:n.shared.data},e.component);if(r){let s,a;for(let o of ya.rootOverrideProps)e[o]===void 0?(s===void 0&&(s={...e}),s[o]=r.data[o]):(a===void 0&&(a={}),a[o]=e[o],s===void 0&&(s={...e}),s[o]=Do.apply(r.data[o],e[o]));return this.overrideData=a,s}else return{...Ur.defaultData,...e,...Ly(Ur.defaultData,ya.rootOverrideProps)}}updateByOp(e,n,r,s){let a;if(this.isInstanceRoot&&!s){if(n=this.transformAssignData(n,r),e.type===0&&e.path.length===0&&this.component)for(let o of ya.rootOverrideProps)o in e.props&&e.props[o]===void 0&&(a===void 0&&(a={...e,props:{...e.props}}),a.props[o]=this.component.data[o]);else if(e.type===0&&e.path.length>0&&ya.rootOverrideProps.includes(e.path[0])){let o=e.path[0];a===void 0&&(a={...e,path:[],props:{[o]:n[o]}})}}super.updateByOp(a??e,n,r,s)}updateState(e,n){this.updateState_Entity(e,n)}expandInstanceChildren(e){let n=this.data;if(this.component===void 0){let r=e.scene.find(n.component)??null,s=!1;if(r!==this.oldComponent){if(this.oldComponent){let a=0;for(let o of this.children)if(Dt.is(o))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(o),Kv(o),a+=1;else break;this.children.splice(0,a)}s=!0}if(r){let a={};VG(e,[this.uuid],n.overrides,this,r,r,0,s,a);for(let o of this.children)if(Dt.is(o)){let l=o.data;l.type==="Empty"&&l.animations&&o.traverseEntity(c=>{let u=c.dataPatched;if(c instanceof qt&&u.bones&&u.boneInverses){let d=c.dataPatched;if(d.bones&&d.boneInverses){let h=d.bones.map(m=>e.scene.find(a[m])),p=d.boneInverses.map(m=>new ne().fromArray(m)),f=new kl(h,p);c.bind(f,c.bindMatrix)}}else c.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function kG(i,t,e,n){return i.component===t&&Ql(i.identity,n)?i.overrideData===e?2:1:0}function VG(i,t,e,n,r,s,a,o,l){if(a>50)return!1;if(n.component!==r){if(n.component){let u=n.component.instances.indexOf(n);u>=0&&n.component.instances.splice(u,1)}r.instances.find(u=>u===n)||r.instances.push(n),n.component=r}r instanceof Zv&&r.isInstanceRoot&&r.expandInstanceChildren(i);let c=0;for(let u of r.children)if(Dt.is(u)){let d=[...t,...typeof u.identity=="string"?[u.identity]:u.identity],h=af.resolve(e,d,1);h!=null&&!(h instanceof Zn)&&(Object.setPrototypeOf(h,Zn.prototype),console.error("wrong prototype"));let p=null,f;if(!o){let m=n.children[c];if(p=Dt.is(m)?m:null,p!==null){let g=kG(p,u,h,d);f=g>=1?p.stateSelection:void 0,g!==2&&(p=null)}if(p===null&&(p=i.scene.findInstance(d)??null,p!==null)){let g=kG(p,u,h,d);if(f=g>=1?p.stateSelection:void 0,g!==2)p=null;else{let y=p.parent.children.indexOf(p);p.parent.children.splice(y,1),n.children.splice(c,0,p),p.parent===n?(y<=c&&console.error("not possible"),void 0):(p.parent=n,p.matrixWorldNeedsUpdate=!0,p.resetBBoxNeedsUpdate(),p.updateVisible(),i.pendingDeletes.delete(p),void 0)}}}if(p===null){let m=h?Do.apply(u.data,h):u.data;Qa.is(m.type)&&(m={...m,type:"Empty"}),p=xa.createEntity(d,m,i),p.overrideData=h,n.add(p),n.children.splice(n.children.length-1,1),n.children.splice(c,0,p),p.updateState(p.data,i),f&&p.changeSelectedState(f,i),i.scene.registerInstanceAndSetUuid(p)}if(p.isBone){let m=p.identity[p.identity.length-1];l[m]=p.uuid}c+=1,VG(i,t,e,p,u,s,a+1,o,l)}if(!o){let u=c;for(;;){let d=n.children[c];if(Dt.is(d))i.pendingDeletes.add(d);else break;c+=1}n.children.splice(u,c-u)}return!0}Qt();var zG=(i,t,e)=>new Zv(i,t,e);Yd("Component",zG);Yd("Instance",zG);_t("components");var AI=1e-10;function GG(i){let t=i[0][0],e=i[1][0],n=i[0][1],r=i[1][1],s=Math.sqrt(t*t+e*e),a=s>AI?t/s:1,o=s>AI?e/s:0,l=a*t+o*e,c=a*r-o*n,u=a*n+o*r;return{rotation:Math.atan2(o,a),scale:[l,c],shear:[Math.abs(c)>AI?u/c:0,0]}}function jG({rotation:i,scale:t,shear:e}){let n=Math.cos(i),r=Math.sin(i),s=e[0]*t[1],a=e[1]*t[0];return[n*t[0]-r*a,r*t[0]+n*a,n*s-r*t[1],r*s+n*t[1]]}var At;(S=>{function i(){return[1,0,0,0,1,0,0,0,1]}S.identity=i;function t(E,M=S.identity()){for(let w=0,T=E.length;w<T;w++)M[w]=E[w];return M}S.copy=t;function e(E,M,w,T,A,C){return S.setAbcdef(S.identity(),E,M,w,T,A,C)}S.create=e;function n(E,M,w,T,A,C,P){return E[0]=M,E[1]=T,E[2]=C,E[3]=w,E[4]=A,E[5]=P,E}S.setAbcdef=n;function r(E,M){let[w,T,A,C,P,D]=a(E),[I,L,U,G,X,ae]=a(M),ee=I*w+L*A,$=I*T+L*C,K=U*w+G*A,re=U*T+G*C,fe=X*w+ae*A+P,ve=X*T+ae*C+D;return S.create(ee,$,K,re,fe,ve)}S.append=r;function s(E,M){let[w,T,A,C,P,D]=a(E),[I,L,U,G,X,ae]=a(M),ee=w,$=T,K=A,re=C;(I!==1||L!==0||U!==0||G!==1)&&(ee=w*I+T*U,$=w*L+T*G,K=A*I+C*U,re=A*L+C*G);let fe=P*I+D*U+X,ve=P*L+D*G+ae;return S.create(ee,$,K,re,fe,ve)}S.prepend=s;function a(E){return[E[0],E[3],E[1],E[4],E[2],E[5]]}S.getAbcdef=a;function o(E){let[M,w,T,A,C,P]=S.getAbcdef(E),D=M*A-w*T,I=A/D,L=-w/D,U=-T/D,G=M/D,X=(T*P-A*C)/D,ae=-(M*P-w*C)/D;return S.create(I,L,U,G,X,ae)}S.invert=o;function l([E,M],w){let[T,A,C,P,D,I]=S.getAbcdef(w);return[T*E+C*M+D,A*E+P*M+I]}S.apply=l;function c(E,M){let[w,T,A,C,P,D]=S.getAbcdef(M),I=1/(w*C+A*-T),[L,U]=E;return[C*I*L+-A*I*U+(D*A-P*C)*I,w*I*U+-T*I*L+(-D*w+P*T)*I]}S.applyInverse=c;function u(E,M,w=M){let[T,A,C,P,D,I]=S.getAbcdef(E);return S.setAbcdef(E,T*M,A*w,C*M,P*w,D*M,I*w),E}S.scale=u;function d(E,M){let w=Math.cos(M),T=Math.sin(M),[A,C,P,D,I,L]=S.getAbcdef(E);return S.setAbcdef(E,A*w-C*T,A*T+C*w,P*w-D*T,P*T+D*w,I*w-L*T,I*T+L*w),E}S.rotate=d;function h(E,M,w){let[T,A]=w,C=S.translate(E,-T,-A);return C=S.rotate(C,M),C=S.translate(C,T,A),C}S.rotateAround=h;function p(E,M,w){let[T,A,C,P,D,I]=S.getAbcdef(E);return S.setAbcdef(E,T,A,C,P,D+M,I+w),E}S.translate=p;function f(E,M,w){let[T,A,C,P]=S.getAbcdef(E);return S.setAbcdef(E,T,A,C,P,M,w),E}S.setTranslate=f;function m(E,M,w){let[T,A,C,P]=S.getAbcdef(E);return S.setAbcdef(E,T,A,C,P,M,w),E}S.setPosition=m;function g(E){let[M,w,T,A]=S.getAbcdef(E),C=Math.sqrt(M*M+w*w),P=Math.sqrt(T*T+A*A);return[C,P]}S.getScale=g;function y(E){let[,,,,M,w]=S.getAbcdef(E);return[M,w]}S.getPosition=y;function v(E,M){return S.decompose(E,M).rotation}S.getRotation=v;function b(E,M){let[w,T,A,C,P,D]=S.getAbcdef(E),{rotation:I,scale:L,shear:U}=GG([[w,A],[T,C]]);return{position:[P+(M[0]*w+M[1]*A)-M[0],D+(M[0]*T+M[1]*C)-M[1]],scale:L,rotation:I,shear:U,pivot:M}}S.decompose=b;function x(E,M,w,T,A=[0,0]){let[C,P]=E,[D,I]=T,[L,U,G,X]=jG({rotation:w,scale:M,shear:A}),ae=C-(D*L+I*G)+D,ee=P-(D*U+I*X)+I;return S.create(L,U,G,X,ae,ee)}S.compose=x})(At||(At={}));function Dte(i,t){let[[e,n],[r,s]]=i,[[a,o],[l,c]]=t,u=(e-r)*(o-c)-(n-s)*(a-l);if(u===0)return!1;let d=((e-a)*(o-c)-(n-o)*(a-l))/u,h=-((e-r)*(n-o)-(n-s)*(e-a))/u;return d>=0&&d<=1&&h>=0&&h<=1}var WG=[[-1,1],[-1,-1],[1,-1],[1,1]],HG=(i,t,e)=>{let n=i.getCenter(),r=i.getHalfSize(),s=At.append(t,i.worldMatrix);r[0]===0&&r[1]===0?e.push(At.apply(n,s)):WG.forEach(a=>{let o=[a[0]*r[0]+n[0],a[1]*r[1]+n[1]];e.push(At.apply(o,s))})},Ou=class{constructor(){this.matrix=At.identity();this.min=[1/0,1/0];this.max=[-1/0,-1/0];this.vertices=[];this.edges=[]}setFromObjectSize(t,e=!1){t.updateWorldMatrix(),this.makeEmpty(),At.copy(t.worldMatrix,this.matrix);let n=At.invert(t.worldMatrix);this.expandByObjectSize(t,n,e)}expandByObjectSize(t,e,n=!1){let r=[],s=t.isBaseGroup===!0?t:void 0;n===!0&&s!==void 0?s.traverse(a=>{a.visible&&HG(a,e,r)}):HG(t,e,r),this.setFromPoints(r)}setFromSize(t,e,n){this.makeEmpty(),At.copy(n,this.matrix),this.expandBySize(t,e,n)}expandBySize(t,e,n){[At.apply([0,0],n),At.apply([0,e],n),At.apply([t,e],n),At.apply([t,0],n)].forEach(s=>this.expandByPoint(s))}getCenter(){let[t,e]=this.min,[n,r]=this.getHalfSize();return At.apply([t+n,e+r],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(t){this.makeEmpty();for(let e of t)this.expandByPoint(e)}expandByPoint(t){this.min=[Math.min(this.min[0],t[0]),Math.min(this.min[1],t[1])],this.max=[Math.max(this.max[0],t[0]),Math.max(this.max[1],t[1])]}computeVertices(){let[t,e]=this.getHalfSize(),n=this.getCenter(),[r,s,a,o]=At.getAbcdef(this.matrix),l=At.create(r,s,a,o,n[0],n[1]);this.vertices=WG.map(([c,u])=>At.apply([c*t,u*e],l))}computeEdges(){this.edges=[];for(let t=0,e=this.vertices.length;t<e;++t)this.edges.push([this.vertices[t],this.vertices[(t+1)%e]])}project(t,e){let n=this.matrix;return e&&(n=At.append(e.worldMatrix,n)),At.applyInverse(t,n)}intersects(t,e,n){return this.intersectsInLocalSpace(...this.project([t,e],n))}intersectsInLocalSpace(t,e){let{min:n,max:r}=this;return t>=n[0]&&t<=r[0]&&e>=n[1]&&e<=r[1]}containsPoint(t){let[e,n]=t,[r,s]=this.min,[a,o]=this.max;return e>=r&&e<=a&&n>=s&&n<=o}intersectsBBox2D(t){for(let e=0,n=this.edges.length;e<n;e++){let r=this.edges[e];for(let s=0,a=t.edges.length;s<a;s++){let o=t.edges[s];if(Dte(r,o))return!0}}for(let e=0,n=t.vertices.length;e<n;e++){let r=t.vertices[e];if(this.containsPoint(r))return!0}return!1}ensureMinMax(){let t=this.min,e=this.max;this.min=[Math.min(t[0],e[0]),Math.min(t[1],e[1])],this.max=[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}copy(t){this.min=[...t.min],this.max=[...t.max],At.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new Ou;return t.copy(this),t}};ft();var Lte='{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}',qG=()=>JSON.parse(Lte);async function Nte(i,t){return await i.default(t?{module_or_path:t}:void 0),Object.getOwnPropertyDescriptor(i.Engine.prototype,"scene")||Object.defineProperty(i.Engine.prototype,"scene",{get:function(){let e=Object.create(i.SceneController.prototype);return e.__wbg_ptr=this.__wbg_ptr,e}}),{createEngine:e=>i.Engine.create(e,qG(),!0)}}var bE,Qv;function Bte(i){bE=i}function CI(){if(!Qv){if(!bE)return Promise.reject(new Error("HanaRenderer: no Hana UI loader registered. Call setHanaUILoader() from the host app before initializing a HanaRenderer."));Qv=bE(),Qv.catch(()=>{Qv=void 0})}return Qv}var XG;function Fte(){let i=typeof process<"u"?"2.0.13":void 0;return`https://cdn.spline.design/@splinetool/runtime${i?`@${i}`:""}/build/hana-ui.wasm`}function YG(i){XG=i}function $G(){return bE||Bte(async()=>{let t=await import("./hana-ui.js");return Nte(t,XG??Fte())}),CI().then(()=>{})}var wE=nd(SE(),1);function JG(i){let t=[],e;try{e=(0,wE.makeAbsolute)((0,wE.parseSVG)(i))}catch(c){return console.error("[HanaRenderer] Failed to parse SVG path:",c),t}let n=0,r=0,s=0,a=0,o=null,l=null;for(let c of e){let u=null,d=null;switch(c.code){case"M":n=s=c.x,r=a=c.y,t.push({MoveTo:{x:n,y:r}});break;case"L":n=c.x,r=c.y,t.push({LineTo:{x:n,y:r}});break;case"H":n=c.x,t.push({LineTo:{x:n,y:r}});break;case"V":r=c.y,t.push({LineTo:{x:n,y:r}});break;case"C":{let h={x:c.x1,y:c.y1},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"S":{let h=o?{x:2*n-o.x,y:2*r-o.y}:{x:n,y:r},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"Q":{let h={x:c.x1,y:c.y1};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"T":{let h=l?{x:2*n-l.x,y:2*r-l.y}:{x:n,y:r};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"A":{let h=n,p=r;n=c.x,r=c.y,zte(t,h,p,c.rx,c.ry,c.xAxisRotation,c.largeArc,c.sweep,n,r);break}case"Z":n=s,r=a,t.push("ClosePath");break}o=u,l=d}return t}function zte(i,t,e,n,r,s,a,o,l,c){if(t===l&&e===c)return;if(n=Math.abs(n),r=Math.abs(r),n===0||r===0){i.push({LineTo:{x:l,y:c}});return}let u=s*Math.PI/180,d=Math.cos(u),h=Math.sin(u),p=(t-l)/2,f=(e-c)/2,m=d*p+h*f,g=-h*p+d*f,y=m*m/(n*n)+g*g/(r*r);if(y>1){let ee=Math.sqrt(y);n*=ee,r*=ee}let v=n*n,b=r*r,x=v*b-v*g*g-b*m*m,S=v*g*g+b*m*m,E=(a!==o?1:-1)*Math.sqrt(Math.max(0,x/S)),M=E*(n*g)/r,w=E*(-r*m)/n,T=d*M-h*w+(t+l)/2,A=h*M+d*w+(e+c)/2,C=Math.atan2((g-w)/r,(m-M)/n),D=Math.atan2((-g-w)/r,(-m-M)/n)-C;!o&&D>0?D-=2*Math.PI:o&&D<0&&(D+=2*Math.PI);let I=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2))),L=D/I,U=4/3*Math.tan(L/4),G=C,X=t,ae=e;for(let ee=0;ee<I;ee++){let $=G+L,K=Math.cos(G),re=Math.sin(G),fe=Math.cos($),ve=Math.sin($),de=T+n*fe*d-r*ve*h,Se=A+n*fe*h+r*ve*d,oe=-n*re*d-r*K*h,be=-n*re*h+r*K*d,Oe=-n*ve*d-r*fe*h,Le=-n*ve*h+r*fe*d;i.push({CurveTo:[{x:X+U*oe,y:ae+U*be},{x:de-U*Oe,y:Se-U*Le},{x:de,y:Se}]}),G=$,X=de,ae=Se}}var ME=.5522847498307936,Hte=150,Wte=5*60*1e3,qte=(2728+680)/2816,Xte=1536/2816;function Yte(i){try{let t=new DataView(i),e=t.getUint32(0);if(e!==65536&&e!==1330926671&&e!==1953658213)return;let n=t.getUint16(4),r=-1,s=-1;for(let c=0;c<n;c++){let u=12+c*16,d=t.getUint32(u);d===1751474532&&(r=t.getUint32(u+8)),d===1330851634&&(s=t.getUint32(u+8))}if(r<0||s<0)return;let a=t.getUint16(r+18),o=t.getUint16(s);if(a===0||o<2)return;let l=t.getInt16(s+86);return l>0?l/a:void 0}catch{return}}var e4=!1;function t4(){e4||(e4=!0,console.warn("[HanaRenderer] clipRect: precise clipping of rotated/complex content is not supported by the Hana UI overlay yet; drawing unclipped. (Axis-aligned rectangles are clipped geometrically.)"))}var _E=class{constructor(t,e=1){this.canvas=t;this._dpr=e;this._width=0;this._height=0;this._isSizeDirty=!1;this._crashed=!1;this._shapes=[];this._lastPushedJSON="";this._ctm=At.identity();this._stack=[];this._clips=[];this._pathEls=[];this._simpleShape=null;this._pathPrimitives=0;this._fillColor=zt.transparent;this._strokeColor=zt.transparent;this._lineWidth=1;this._strokeMode="inside";this._layerBlur=0;this._backgroundBlur=0;this._dropShadowBlur=0;this._dropShadowOffsetX=0;this._dropShadowOffsetY=0;this._dropShadowColor=zt.transparent;this._innerShadowBlur=0;this._innerShadowOffsetX=0;this._innerShadowOffsetY=0;this._innerShadowSpread=0;this._innerShadowColor=zt.transparent;this._fonts=new Map;this._fontsFlushed=new Set;this._fontXPerEm=new Map;this._measureCache=new Map;try{let n=t.getBoundingClientRect();t.width=n.width*e,t.height=n.height*e}catch{console.log(t.width,e)}}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this._isSizeDirty=!0}get width(){return this._width}get height(){return this._height}async init(){if(!(this._engine||this._crashed)){try{this._context=await CI(),this._engine=await this._context.createEngine(this.canvas)}catch(t){this._crashed=!0,console.error("[HanaRenderer] Failed to load the Hana UI engine; UI scenes will not render.",t);return}if(this._width>0&&this._height>0)this._syncViewport();else{let t=this.canvas.getBoundingClientRect();t.width>0&&t.height>0&&(this._width=t.width,this._height=t.height,this._syncViewport())}this._flushFonts(),this.uiFontReady=this._watchUiFont()}}_watchUiFont(){return new Promise(t=>{let e=this._engine;if(!e||typeof e.scene.isUiFontLoaded!="function"){t();return}let n=()=>{let a=!1;return this._guard(()=>{a=e.scene.isUiFontLoaded()}),a};if(n()){t();return}let r=Date.now(),s=setInterval(()=>{if(this._crashed||Date.now()-r>Wte){clearInterval(s);return}n()&&(clearInterval(s),t())},Hte)})}_syncViewport(){let t=this._engine;if(!t||this._crashed)return;let e=this._width,n=this._height;this.canvas.style.width=e+"px",this.canvas.style.height=n+"px",this.canvas.width=Math.max(1,Math.ceil(e*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(n*this._dpr)),this._guard(()=>{t.resize([e,n],this._dpr),t.scene.updateCamera({position:[e/2,n/2],zoom:1})})}setSize(t,e){!this._isSizeDirty&&t===this._width&&e===this._height||(this._isSizeDirty=!1,this._width=t,this._height=e,this._engine?this._syncViewport():(this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",this.canvas.width=Math.max(1,Math.ceil(t*this._dpr)),this.canvas.height=Math.max(1,Math.ceil(e*this._dpr))))}_guard(t){if(!this._crashed)try{t()}catch(e){this._crashed=!0,console.error("[HanaRenderer] Hana engine call failed; disabling this renderer instance.",e)}}async loadFont(t,e){try{let n=await fetch(t);if(!n.ok){console.error(`[HanaRenderer] loadFont: ${t} returned HTTP ${n.status}; skipping "${e}"`);return}let r=await n.arrayBuffer();if(r.byteLength===0){console.error(`[HanaRenderer] loadFont: ${t} was empty; skipping "${e}"`);return}this.registerFont(r,e)}catch(n){console.error(`[HanaRenderer] loadFont failed for "${e}" (${t}):`,n)}}registerFont(t,e){if(this._fonts.has(e))return;this._fonts.set(e,t);let n=Yte(t);n!==void 0&&this._fontXPerEm.set(e,n),this._flushFonts()}_flushFonts(){let t=this._engine;if(!!t)for(let[e,n]of this._fonts)this._fontsFlushed.has(e)||(this._fontsFlushed.add(e),this._guard(()=>{t.scene.addLocalFont(e,new Uint8Array(n))}))}set strokeColor(t){this._strokeColor=t}set fillColor(t){this._fillColor=t}set lineWidth(t){this._lineWidth=t}set strokeMode(t){this._strokeMode=t}set dropShadowBlur(t){this._dropShadowBlur=t}set dropShadowColor(t){this._dropShadowColor=t}set dropShadowOffsetX(t){this._dropShadowOffsetX=t}set dropShadowOffsetY(t){this._dropShadowOffsetY=t}set innerShadowBlur(t){this._innerShadowBlur=t}set innerShadowColor(t){this._innerShadowColor=t}set innerShadowOffsetX(t){this._innerShadowOffsetX=t}set innerShadowOffsetY(t){this._innerShadowOffsetY=t}set innerShadowSpread(t){this._innerShadowSpread=t}set layerBlur(t){this._layerBlur=t}set backgroundBlur(t){this._backgroundBlur=t}save(){this._stack.push({ctm:At.copy(this._ctm),clipLen:this._clips.length})}restore(){let t=this._stack.pop();!t||(this._ctm=t.ctm,this._clips.length=t.clipLen)}setTransform(t,e=!1){let n=At.identity();if(this.camera?.enabled&&(n=At.append(n,this.camera.worldMatrix),e)){let r=At.getScale(this.camera.worldMatrix);n=At.scale(n,1/r[0],1/r[1])}this._ctm=At.append(n,t)}transform(t){this._ctm=At.append(this._ctm,t)}beginPath(){this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0}closePath(){this._pathEls.length!==0&&this._pathEls[this._pathEls.length-1]!=="ClosePath"&&this._pathEls.push("ClosePath")}_startFreeform(){this._simpleShape=null,this._pathPrimitives++}moveTo(t,e){this._startFreeform(),this._pathEls.push({MoveTo:{x:t,y:e}})}lineTo(t,e){this._startFreeform(),this._pathEls.push({LineTo:{x:t,y:e}})}bezierCurveTo(t,e,n,r,s,a){this._startFreeform(),this._pathEls.push({CurveTo:[{x:t,y:e},{x:n,y:r},{x:s,y:a}]})}quadraticCurveTo(t,e,n,r){this._startFreeform(),this._pathEls.push({QuadTo:[{x:t,y:e},{x:n,y:r}]})}path(t){this._startFreeform(),this._pathEls.push(...JG(t))}rect(t,e,n,r,s=0,a=0,o=0,l=0){if(!i4([t,e,n,r]))return;let c={x:t,y:e,w:n,h:r,radii:[s,a,o,l]};this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"rect",rect:c,smoothing:0}:null,s4(this._pathEls,c)}ellipse(t,e,n,r,s,a,o,l){if(!!i4([t,e,n,r])){if(n<0||r<0)throw Error("radii cannot be negative");this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"ellipse",cx:t,cy:e,rx:n,ry:r}:null,Qte(this._pathEls,t,e,n,r)}}clipRect(t,e,n,r,s=0,a=0,o=0,l=0){let c=At.invert(this._ctm);!c||this._clips.push({m:At.copy(this._ctm),inv:c,rect:{x:t,y:e,w:n,h:r,radii:[s,a,o,l]}})}fill(){this._emit(!0)}stroke(){this._strokeColor.a<=0||this._lineWidth<=0||this._emit(!1)}_emit(t){let e=this._effectChain(t);if(t&&this._fillColor.a<=0&&!e)return;let n=this._classifyShape();if(!n)return;let r=this._applyClips(n);if(r==="skip")return;if(!t&&r!==n){let a=Jv(n);if(a){this._emitClippedRectStroke(a,e);return}}n=r;let s={shape:n,color:t?am(this._fillColor):[0,0,0,0],transform:At.getAbcdef(this._ctm)};t||(s.stroke=this._strokeDesc()),e&&(s.effect_chain=e),this._shapes.push(s)}_emitClippedRectStroke(t,e){let n=this._lineWidth,r=this._strokeMode==="outside"?n:this._strokeMode==="center"?n/2:0,s=n-r,a=Math.min(t.w,t.h)/2,o=t.radii.map(y=>Math.max(0,Math.min(y,a))),l={x:t.x-r,y:t.y-r,w:t.w+r*2,h:t.h+r*2,radii:o.map(y=>y>0?y+r:0)},c=t.w-s*2,u=t.h-s*2,d=c>0&&u>0?{x:t.x+s,y:t.y+s,w:c,h:u,radii:o.map(y=>Math.max(0,y-s))}:null,h=this._applyClips(EE(l,0));if(h==="skip")return;let p=Jv(h)??l,f=null;if(d){let y=this._applyClips(EE(d,0));f=y==="skip"?null:Jv(y)??d}let m=[];s4(m,p),f&&Zte(m,f);let g={shape:{Custom:m},color:am(this._strokeColor),transform:At.getAbcdef(this._ctm)};e&&(g.effect_chain=e),this._shapes.push(g)}_classifyShape(){let t=this._simpleShape;return t?t.kind==="rect"?EE(t.rect,t.smoothing):{Ellipse:{center_x:t.cx,center_y:t.cy,rx:t.rx,ry:t.ry}}:this._pathEls.length===0?null:{Custom:this._pathEls.slice()}}_strokeDesc(){return{width:this._lineWidth,line_join:"Miter",color:am(this._strokeColor),align:$te[this._strokeMode],cap:"Butt"}}_effectChain(t){let e=this.camera?.scale??1,n=[];if(t&&this._dropShadowColor.a>0&&n.push({DropShadow:{position:[this._dropShadowOffsetX*e,this._dropShadowOffsetY*e],blur:{Uniform:{size:2*this._dropShadowBlur*e}},spread:0,color:am(this._dropShadowColor)}}),t&&this._backgroundBlur>0){let[r,s]=At.getScale(this._ctm),a=(r+s)/2;n.push({BackgroundBlur:{blur:{Uniform:{size:2*this._backgroundBlur*a}}}})}if(this._layerBlur>0&&n.push({LayerBlur:{blur:{Uniform:{size:2*this._layerBlur*e}}}}),t&&this._innerShadowColor.a>0){let[r,s,a,o]=At.getAbcdef(this._ctm),l=this._innerShadowOffsetX,c=this._innerShadowOffsetY;n.push({InnerShadow:{position:[r*l+a*c,s*l+o*c],blur:{Uniform:{size:2*this._innerShadowBlur*e}},spread:this._innerShadowSpread*e,color:am(this._innerShadowColor)}})}return n.length>0?n:void 0}_applyClips(t){if(this._clips.length===0)return t;let e=t;for(let n of this._clips){let r=At.append(n.inv,this._ctm),[s,a,o,l,c,u]=At.getAbcdef(r),d=Math.abs(a)<=1e-6*(Math.abs(s)+Math.abs(l))&&Math.abs(o)<=1e-6*(Math.abs(s)+Math.abs(l)),h=Kte(e);if(!h)return e;if(!d){t4();continue}let p=s*h.minX+c,f=s*h.maxX+c,m=l*h.minY+u,g=l*h.maxY+u,y=Math.min(p,f),v=Math.max(p,f),b=Math.min(m,g),x=Math.max(m,g),S=n.rect,E=Math.max(y,S.x),M=Math.max(b,S.y),w=Math.min(v,S.x+S.w),T=Math.min(x,S.y+S.h);if(E>=w||M>=T)return"skip";if(E===y&&M===b&&w===v&&T===x)continue;let C=Jv(e);if(!C||s===0||l===0){t4();continue}let P=(E-c)/s,D=(w-c)/s,I=(M-u)/l,L=(T-u)/l,U=Math.min(P,D),G=Math.min(I,L),X=Math.abs(D-P),ae=Math.abs(L-I),[ee,$,K,re]=C.radii,fe=U!==C.x,ve=G!==C.y,de=U+X!==C.x+C.w,Se=G+ae!==C.y+C.h,oe=Math.min(X,ae)/2,be=[fe||ve?0:Math.min(ee,oe),de||ve?0:Math.min($,oe),de||Se?0:Math.min(K,oe),fe||Se?0:Math.min(re,oe)];e=EE({x:U,y:G,w:X,h:ae,radii:be},0)}return e}drawText(t,e){let n=this._fontXPerEm.get(e.font),r=n?n/Xte:1,s={TextSimple:{text:t,font_size:e.fontSize*qte*r,size:[e.width,e.height],horizontal_align:n4[e.horizontalAlign]??"Left",vertical_align:r4[e.verticalAlign]??"Top"}},a=this._effectChain(!0),o=this._fillColor.a>0,l=this._strokeColor.a>0&&this._lineWidth>0;if(o||l||a){let c={shape:s,color:o?am(this._fillColor):[0,0,0,0],transform:At.getAbcdef(At.append(this._ctm,At.translate(At.identity(),e.x,e.y)))};l&&(c.stroke=this._strokeDesc()),a&&(c.effect_chain=a),this._shapes.push(c)}return{height:this._measureTextHeight(t,e)}}_measureTextHeight(t,e){let n=`${e.font}|${e.fontSize}|${e.lineHeight}|${e.letterSpacing}|${e.width}|${t}`,r=this._measureCache.get(n);if(r!==void 0)return r;let s=0,a=this._engine;if(a&&!this._crashed&&this._fontsFlushed.has(e.font))try{let[,o]=a.scene.measureTextNaturalSize({size:[e.width,e.height],text:t,fontSize:e.fontSize,horizontalAlign:n4[e.horizontalAlign]??"Left",verticalAlign:r4[e.verticalAlign]??"Top",lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textTransform:"None",font:e.font,version:0,autoSize:"None",truncate:"None"});s=o}catch{}if(!(s>0)){let o=e.fontSize*.55+Math.max(0,e.letterSpacing),l=Math.max(1,Math.floor(e.width/o)),c=0;for(let u of t.split(`
9790
9790
  `))c+=Math.max(1,Math.ceil(u.length/l));s=c*e.fontSize*e.lineHeight}return this._measureCache.size>512&&this._measureCache.clear(),this._measureCache.set(n,s),s}clear(){this._shapes=[],this._ctm=At.identity(),this._stack.length=0,this._clips.length=0}render(){let t=this._engine;if(!t||this._crashed)return;let e=JSON.stringify(this._shapes);e!==this._lastPushedJSON&&(this._guard(()=>t.scene.updateUiShapes(this._shapes)),this._lastPushedJSON=e),this._guard(()=>t.onFrame())}},$te={inside:"Inside",outside:"Outside",center:"Center"},n4={[1]:"Left",[2]:"Right",[3]:"Center",[4]:"Justify"},r4={[1]:"Top",[2]:"Center",[3]:"Bottom"};function am({r:i,g:t,b:e,a:n}){return[i,t,e,n]}function i4(i){for(let t=0;t<i.length;t++)if(i[t]!==void 0&&!Number.isFinite(i[t]))return!1;return!0}function EE(i,t){let[e,n,r,s]=i.radii;return e===0&&n===0&&r===0&&s===0?{Rectangle:{x:i.x,y:i.y,width:i.w,height:i.h}}:{RoundedRectangle:{x:i.x,y:i.y,width:i.w,height:i.h,radius:[e,n,r,s],corner_smoothing:t}}}function Jv(i){if("Rectangle"in i){let t=i.Rectangle;return{x:t.x,y:t.y,w:t.width,h:t.height,radii:[0,0,0,0]}}if("RoundedRectangle"in i){let t=i.RoundedRectangle;return{x:t.x,y:t.y,w:t.width,h:t.height,radii:[t.radius[0],t.radius[1],t.radius[2],t.radius[3]]}}return null}function Kte(i){let t=Jv(i);if(t)return{minX:t.x,minY:t.y,maxX:t.x+t.w,maxY:t.y+t.h};if("Ellipse"in i){let e=i.Ellipse;return{minX:e.center_x-e.rx,minY:e.center_y-e.ry,maxX:e.center_x+e.rx,maxY:e.center_y+e.ry}}if("TextSimple"in i){let e=i.TextSimple;return{minX:0,minY:0,maxX:e.size[0],maxY:e.size[1]}}if("Custom"in i){let e=1/0,n=1/0,r=-1/0,s=-1/0,a=o=>{o.x<e&&(e=o.x),o.y<n&&(n=o.y),o.x>r&&(r=o.x),o.y>s&&(s=o.y)};for(let o of i.Custom)o!=="ClosePath"&&("MoveTo"in o?a(o.MoveTo):"LineTo"in o?a(o.LineTo):"QuadTo"in o?o.QuadTo.forEach(a):"CurveTo"in o&&o.CurveTo.forEach(a));return e===1/0?null:{minX:e,minY:n,maxX:r,maxY:s}}return null}function s4(i,t){let{x:e,y:n,w:r,h:s}=t,a=Math.min(r,s)/2,[o,l,c,u]=t.radii.map(h=>Math.max(0,Math.min(h,a)));if(o===0&&l===0&&c===0&&u===0){i.push({MoveTo:{x:e,y:n}},{LineTo:{x:e+r,y:n}},{LineTo:{x:e+r,y:n+s}},{LineTo:{x:e,y:n+s}},"ClosePath");return}let d=1-ME;i.push({MoveTo:{x:e+o,y:n}}),i.push({LineTo:{x:e+r-l,y:n}}),l>0&&i.push({CurveTo:[{x:e+r-l*d,y:n},{x:e+r,y:n+l*d},{x:e+r,y:n+l}]}),i.push({LineTo:{x:e+r,y:n+s-c}}),c>0&&i.push({CurveTo:[{x:e+r,y:n+s-c*d},{x:e+r-c*d,y:n+s},{x:e+r-c,y:n+s}]}),i.push({LineTo:{x:e+u,y:n+s}}),u>0&&i.push({CurveTo:[{x:e+u*d,y:n+s},{x:e,y:n+s-u*d},{x:e,y:n+s-u}]}),i.push({LineTo:{x:e,y:n+o}}),o>0&&i.push({CurveTo:[{x:e,y:n+o*d},{x:e+o*d,y:n},{x:e+o,y:n}]}),i.push("ClosePath")}function Zte(i,t){let{x:e,y:n,w:r,h:s}=t,a=Math.min(r,s)/2,[o,l,c,u]=t.radii.map(h=>Math.max(0,Math.min(h,a)));if(o===0&&l===0&&c===0&&u===0){i.push({MoveTo:{x:e,y:n}},{LineTo:{x:e,y:n+s}},{LineTo:{x:e+r,y:n+s}},{LineTo:{x:e+r,y:n}},"ClosePath");return}let d=1-ME;i.push({MoveTo:{x:e+o,y:n}}),o>0&&i.push({CurveTo:[{x:e+o*d,y:n},{x:e,y:n+o*d},{x:e,y:n+o}]}),i.push({LineTo:{x:e,y:n+s-u}}),u>0&&i.push({CurveTo:[{x:e,y:n+s-u*d},{x:e+u*d,y:n+s},{x:e+u,y:n+s}]}),i.push({LineTo:{x:e+r-c,y:n+s}}),c>0&&i.push({CurveTo:[{x:e+r-c*d,y:n+s},{x:e+r,y:n+s-c*d},{x:e+r,y:n+s-c}]}),i.push({LineTo:{x:e+r,y:n+l}}),l>0&&i.push({CurveTo:[{x:e+r,y:n+l*d},{x:e+r-l*d,y:n},{x:e+r-l,y:n}]}),i.push("ClosePath")}function Qte(i,t,e,n,r){let s=n*ME,a=r*ME;i.push({MoveTo:{x:t+n,y:e}},{CurveTo:[{x:t+n,y:e+a},{x:t+s,y:e+r},{x:t,y:e+r}]},{CurveTo:[{x:t-s,y:e+r},{x:t-n,y:e+a},{x:t-n,y:e}]},{CurveTo:[{x:t-n,y:e-a},{x:t-s,y:e-r},{x:t,y:e-r}]},{CurveTo:[{x:t+s,y:e-r},{x:t+n,y:e-a},{x:t+n,y:e}]},"ClosePath")}function PI(i){let t=!1;return i.scene.objects.traverse((e,n)=>{(n.type==="Mesh"&&n.geometry.type==="UIGeometry"||n.type==="Page"&&n.uiFrame!==void 0)&&(t=!0)}),t}ft();ft();var Jte=Math.PI/180,vDe=180/Math.PI;function a4(i,t,e,n,r,s){let a=i-e,o=t-n;return a*a/(r*r)+o*o/(s*s)<=1}function o4(i){return i*Jte}an();function vc(i){return{all:i=i||new Map,on:function(t,e){var n=i.get(t);n?n.push(e):i.set(t,[e])},off:function(t,e){var n=i.get(t);n&&(e?n.splice(n.indexOf(e)>>>0,1):i.set(t,[]))},emit:function(t,e){var n=i.get(t);n&&n.slice().map(function(r){r(e)}),(n=i.get("*"))&&n.slice().map(function(r){r(t,e)})}}}var bc=class{constructor(t,e,n){this.uuid=t;this.data=e;this.isObject2D=!0;this.localMatrix=At.identity();this.worldMatrix=At.identity();this.ignoreCameraZoom=!1;this.visible=!0;this._singleBBox=new Ou;this._recursiveBBox=new Ou;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.stateSelection=null;this.prevState=null;this.currentState=null;this.reversibleToState=null;this.currentTransitionEvent=null;this.previousAction=null;this.name="";this.position=[0,0];this.scale=[1,1];this.rotation=0;this.shear=[0,0];this.emitter=vc();this.dpr=n.dpr??1,this.dataPatched=e}project(t,e){let n=this.worldMatrix;return e&&(n=At.append(e.worldMatrix,n)),At.applyInverse(t,n)}intersects(t,e,n,r=!1){return this.visible&&!this.data.raycastLock&&this.intersectsInLocalSpace(...this.project([t,e],n),r)}intersectsInLocalSpace(t,e,n=!1){let{min:r,max:s}=n?this.recursiveBBox:this.singleBBox;return t>=r[0]&&t<=s[0]&&e>=r[1]&&e<=s[1]}applyTransforms(t){t.setTransform(this.worldMatrix,this.ignoreCameraZoom)}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges()),this._recursiveBBox}updateLocalMatrix(){this.localMatrix=At.compose(this.position,this.scale,o4(this.rotation),ac.getPivot(this.dataPatched),this.shear)}updateWorldMatrix(t,e,n){let r=this.parent;e&&r!==null&&r!==void 0&&r.updateWorldMatrix(t,!0,!1),t&&this.updateLocalMatrix(),this.parent?this.worldMatrix=At.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=At.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return ac.getPivot(this.data)}getCenter(){return[0,0]}getHalfSize(){return[0,0]}get id(){return this.uuid}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{t.resetBBoxNeedsUpdateSelf()})}updateTransformState(t){let e=!1;t.position!==void 0&&(e=!0,this.position=t.position),t.rotation!==void 0&&(e=!0,this.rotation=t.rotation),t.scale!==void 0&&(e=!0,this.scale=t.scale),t.shear!==void 0&&(e=!0,this.shear=t.shear),e&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(t,e,n){t.type===0&&t.props.visible!==void 0&&(this.visible=t.props.visible),this.data=e,this.data=e;let r=t,s=$t(t.path,["states","*"]);if(s!==null){if(t.type===0){let[a]=s;if(this?.stateSelection===a){let o={...t.props};if(delete o.name,Object.values(t.props).some(l=>l===void 0)){let l=this.data;if(l!==void 0){let c=rr.zoom(l,t.path.slice(2));if(c)for(let u in t.props)t.props[u]===void 0&&u in c&&(o[u]=c[u])}}r={...t,props:o,path:t.path.slice(2)}}}}else if(t.type===0){let a=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(a!==void 0){if(t.props.name!==void 0&&a.name){let{name:l,...c}=a;a=c}let o=rr.removeOverridden(t.path,t.props,a);r={...t,props:o}}}this.updateByPatchedOpBase(r,sc.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n)}changeSelectedState(t,e,n=!1){if(!(this.data.states.length===0&&!n)){for(let r of this.data.states)sc.toOps(this.data,r.data).forEach(a=>{let o=Hp.replaceProps(a,this.data);this.dataPatched=this.data,this.updateByPatchedOp(o,this.data,e)});if(t!==null){let r=this.data.states.data(t);r&&(this.dataPatched=sc.patch(this.data,r),sc.toOps(this.data,r).forEach(a=>{this.updateByPatchedOp(a,this.dataPatched,e)}))}n&&this.updateTransformState(this.dataPatched),this.stateSelection=t}}updateState(t,e){t.name!==void 0&&(this.name=t.name),t.visible!==void 0&&(this.visible=t.visible),this.updateTransformState(t)}updateByPatchedOpBase(t,e,n){this.dataPatched=e,this.updateByPatchedOp(t,e,n)}updateByPatchedOp(t,e,n){t.path.length===0&&t.type===0&&this.updateState(t.props,n),this.requestRender()}traverseFrameAncestors(t){this.traverseAncestors(e=>{e.data.type==="frame2d"&&t(e)})}traverseAncestors(t){let e=this.parent;for(;e;)t(e),e=e.parent}requestRender(){this.traverseFrameAncestors(t=>{t.requestRender()})}clone(t){let e=new bc(this.uuid,this.data,t);return e.parent=void 0,e}addEventListener(t,e){this.emitter.on(t,e)}removeEventListener(t,e){this.emitter.off(t,e)}dispatchEvent(t){this.emitter.emit(t.type,{...t,target:t.target??this})}traverseSortNextHelper(){let t=this.parent;if(t){let e=t.children;if(e){let n=e.indexOf(this)+1;return e[n]?e[n]:t.traverseSortNextHelper()}}}sortNext(){let t=this.children;return t&&t.length>0&&t[0]?t[0]:this.traverseSortNextHelper()}isDescendantOf(t){t instanceof bc&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}};an();ft();var eb=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.color=zt.transparent;this.blurRadius=0;this.offset=[0,0];this.spread=0;this.update(e)}update(t){t.color!==void 0&&(this.color=t.color),t.enabled!==void 0&&(this.enabled=t.enabled),t.blurRadius!==void 0&&(this.blurRadius=t.blurRadius),t.offset!==void 0&&(this.offset=t.offset),t.spread!==void 0&&(this.spread=t.spread)}};var tb=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.radius=0;this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.radius!==void 0&&(this.radius=t.radius)}};ft();var TE=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.color=zt.transparent;this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.color!==void 0&&(this.color=t.color)}};ft();var AE=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.color=zt.transparent;this.thickness=0;this.mode="inside";this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.color!==void 0&&(this.color=t.color),t.thickness!==void 0&&(this.thickness=t.thickness),t.mode!==void 0&&(this.mode=t.mode)}};var sr=class extends bc{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.autoClose=!0;this.fill=new TE(e+"-fill",n.fill,r),this.stroke=new AE(e+"-stroke",n.stroke,r),this.dropShadow=new eb(e+"-dropShadow",n.dropShadow,r),this.innerShadow=new eb(e+"-innerShadow",n.innerShadow,r),this.backgroundBlur=new tb(e+"-backgroundBlur",n.backgroundBlur,r),this.layerBlur=new tb(e+"-layerBlur",n.layerBlur,r)}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:zt.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:zt.transparent,e.strokeMode=this.stroke.mode,e.lineWidth=this.stroke.thickness}applyFilters(e){this.layerBlur.enabled?e.layerBlur=this.layerBlur.radius*5:e.layerBlur=0,this.backgroundBlur.enabled?e.backgroundBlur=this.backgroundBlur.radius*5:e.backgroundBlur=0,this.dropShadow.enabled?(e.dropShadowBlur=this.dropShadow.blurRadius*5,e.dropShadowColor=this.dropShadow.color,e.dropShadowOffsetX=this.dropShadow.offset[0],e.dropShadowOffsetY=this.dropShadow.offset[1]):e.dropShadowColor=zt.transparent,this.innerShadow.enabled?(e.innerShadowSpread=this.innerShadow.spread,e.innerShadowBlur=this.innerShadow.blurRadius*5,e.innerShadowColor=this.innerShadow.color,e.innerShadowOffsetX=this.innerShadow.offset[0],e.innerShadowOffsetY=this.innerShadow.offset[1]):e.innerShadowColor=zt.transparent}innerDraw(e){}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.applyFilters(e),this.applyFillStroke(e),e.beginPath(),this.innerDraw(e),this.autoClose&&e.closePath(),this.fill.enabled&&e.fill(),this.stroke.enabled&&e.stroke(),e.restore())}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.type===0&&($t(e.path,["fill"])?this.fill.update(e.props):$t(e.path,["stroke"])?this.stroke.update(e.props):$t(e.path,["dropShadow"])?this.dropShadow.update(e.props):$t(e.path,["innerShadow"])?this.innerShadow.update(e.props):$t(e.path,["layerBlur"])?this.layerBlur.update(e.props):$t(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}updateState(e,n){super.updateState(e,n),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur)}clone(e){let n=new sr(this.uuid,this.data,e);return n.parent=void 0,n}};var Ru=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.width=0;this.height=0;this.updateState(n,r)}innerDraw(e){e.ellipse(this.width*.5,this.height*.5,this.width*.5,this.height*.5,0,0,Math.PI*2)}intersectsInLocalSpace(e,n){return a4(e,n,this.width*.5,this.height*.5,this.width*.5,this.height*.5)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,n){super.updateState(e,n),this.updateSizeState(e)}clone(e){let n=new Ru(this.uuid,this.data,e);return n.parent=void 0,n}};var Ia=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.width=0;this.height=0;this.cornerRadius=[0,0,0,0];this.updateState(n,r)}innerDraw(e){e.rect(0,0,this.width,this.height,...this.cornerRadius)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,n){super.updateState(e,n),this.updateSizeState(e),this.updateCornerState(e)}clone(e){let n=new Ia(this.uuid,this.data,e);return n.parent=void 0,n}};ft();var Du=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this._textHeight=0;this._textHeightDirty=!0;this.width=0;this.height=0;this.updateState(n,r)}get textHeight(){return this._textHeight}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:zt.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:zt.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}innerDraw(e){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&e.registerFont(this._fontHolder.arrayBuffer,this.data.font);let n=this.data.textTransform,r=this.data.text.textValue.toString(),s=n===2?r.toUpperCase():n===3?r.toLowerCase():r,{height:a}=e.drawText(s,{x:0,y:0,width:this.width,height:this.height,fontSize:this.data.fontSize,lineHeight:this.data.lineHeight??1,letterSpacing:this.data.letterSpacing??0,horizontalAlign:this.data.horizontalAlign,verticalAlign:this.data.verticalAlign,font:this.data.font});this._textHeight=a}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(e,{shared:n}){e.font!==void 0&&(this._fontHolder=n.getFont(e.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then(()=>{this.requestRender()}))}updateState(e,n){super.updateState(e,n),this.updateSizeState(e),this.updateFontState(e,n)}clone(e){let n=new Du(this.uuid,this.data,e);return n.parent=void 0,n}};var om=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.curves=[];this.extremasBBox={min:[0,0],max:[0,0]};this.updateState(n,r)}computeExtremas(){this.curves.length===0&&this.computeCurves();let e=this.curves.map(s=>CE.extremas(s)),n=[1/0,1/0],r=[-1/0,-1/0];for(let s=0,a=e.length;s<a;s++){let o=e[s];o[0][0]<n[0]&&(n[0]=o[0][0]),o[0][1]<n[1]&&(n[1]=o[0][1]),o[1][0]>r[0]&&(r[0]=o[1][0]),o[1][1]>r[1]&&(r[1]=o[1][1])}return this.extremasBBox.min=[n[0],n[1]],this.extremasBBox.max=[r[0],r[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let r=1,s=this.data.points.length;r<s;r++){let a=this.data.points[r].data,o=this.data.points[r-1].data,l={start:o.position,cp1:o.controlNext.position,cp2:a.controlPrevious.position,end:a.position};this.curves.push(l)}let e=this.data.points[0].data,n=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let r={start:n.position,cp1:n.controlNext.position,cp2:e.controlPrevious.position,end:e.position};this.curves.push(r)}}getCenter(){let[e,n]=this.extremasBBox.min,[r,s]=this.getHalfSize();return[e+r,n+s]}getHalfSize(){let{min:e,max:n}=this.extremasBBox;return[(n[0]-e[0])*.5,(n[1]-e[1])*.5]}innerDraw(e){for(let s=0,a=this.data.points.length;s<a;s++){let o=this.data.points[s].data;if(s===0){let[l,c]=o.position;e.moveTo(l,c)}else{let l=this.data.points[s-1].data,[c,u]=l.controlNext.position,[d,h]=o.controlPrevious.position,[p,f]=o.position,m={start:l.position,cp1:l.controlNext.position,cp2:o.controlPrevious.position,end:o.position};CE.derive(m),e.bezierCurveTo(c,u,d,h,p,f)}}let n=this.data.points[0].data,r=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let[s,a]=r.controlNext.position,[o,l]=n.controlPrevious.position,[c,u]=n.position;e.bezierCurveTo(s,a,o,l,c,u)}}updateState(e,n){super.updateState(e,n),this.computeExtremas()}clone(e){let n=new om(this.uuid,this.data,e);return n.parent=void 0,n}},CE;(s=>{function i(a){let o=a.start,l=a.cp1,c=a.cp2,u=a.end,d=[3*(l[0]-o[0]),3*(l[1]-o[1])],h=[3*(c[0]-l[0]),3*(c[1]-l[1])],p=[3*(u[0]-c[0]),3*(u[1]-c[1])],f={start:d,cp:h,end:p};return a.derivative=f,f.derivative=II.derive(f),f}s.derive=i;function t(a,o,l,c=!1){let u=a-2*o+l;if(u!==0){let d=-Math.sqrt(Math.abs(o*o-a*l)),h=-a+o,p=-(d+h)/u,f=-(-d+h)/u;return[p,f]}else if(o!==l&&u===0)return[(2*o-l)/(2*(o-l))];return[]}function e(a){let o=a.derivative??s.derive(a),l=o.start,c=o.cp,u=o.end;return[t(l[0],c[0],u[0]),t(l[1],c[1],u[1])]}s.droot=e;function n(a){let[o,l]=s.droot(a),c=[a.start[0],a.end[0]],u=[a.start[1],a.end[1]];for(let d of o)c.push(s.compute(a,Math.min(1,Math.max(0,d)))[0]);for(let d of l)u.push(s.compute(a,Math.min(1,Math.max(0,d)))[1]);return c.sort((d,h)=>d-h),u.sort((d,h)=>d-h),[[c[0],u[0]],[c[c.length-1],u[u.length-1]]]}s.extremas=n;function r(a,o){if(o===0)return[...a.start];if(o===1)return[...a.end];let l=1-o,c=l*l,u=o*o,d=c*l,h=c*o*3,p=l*u*3,f=o*u;return[d*a.start[0]+h*a.cp1[0]+p*a.cp2[0]+f*a.end[0],d*a.start[1]+h*a.cp1[1]+p*a.cp2[1]+f*a.end[1]]}s.compute=r})(CE||(CE={}));var II;(n=>{function i(r){let s=r.start,a=r.cp,o=r.end,l=[2*(a[0]-s[0]),2*(a[1]-s[1])],c=[2*(o[0]-a[0]),2*(o[1]-a[1])],u={start:l,end:c};return u.derivative=OI.derive(u),r.derivative=u,u}n.derive=i;function t(r){let s=r.derivative??n.derive(r),a=s.start,o=s.end;return[a[0]!==o[0]?a[0]/(a[0]-o[0]):0,a[1]!==o[1]?a[1]/(a[1]-o[1]):0]}n.droot=t;function e(r,s){if(s===0)return[...r.start];if(s===1)return[...r.end];let a=1-s,o=a*a,l=s*s,c=o,u=a*s*2,d=l;return[c*r.start[0]+u*r.cp[0]+d*r.end[0],c*r.start[1]+u*r.cp[1]+d*r.end[1]]}n.compute=e})(II||(II={}));var OI;(e=>{function i(n){let r=n.start,s=n.end,a=[s[0]-r[0],s[1]-r[1]];return n.derivative=a,n.derivative}e.derive=i;function t(n,r){if(r===0)return[...n.start];if(r===1)return[...n.end];let s=n.start,a=n.end;return[s[0]+(a[0]-s[0])*r,s[1]+(a[1]-s[1])*r]}e.compute=t})(OI||(OI={}));var fs=class extends bc{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.context=r;this.isBaseGroup=!0;this.children=[]}add(e){e.parent&&e.parent instanceof fs&&e.parent.remove(e),this.children.push(e),e.parent=this}remove(e){let n=this.children.indexOf(e);n>=0&&(this.children.splice(n,1),e.parent=void 0)}traverse(e){let n=e(this);if(n!==!0)for(let r of this.children)r instanceof fs?r.traverse(e):n=e(r)}intersectsChildrenHelper(e,n,r,s,a){for(let o of this.children)if(o.intersects(e,n,r,!1)&&(a.push(o),s)||o instanceof fs&&o.intersectsChildrenHelper(e,n,r,s,a))return!0;return!1}intersectsChildren(e,n,r,s=!1,a=[],o=!1){return this.intersectsChildrenHelper(e,n,r,s,a),a}intersectsChildrenHelperReverse(e,n,r,s,a){for(let o of this.children)if(o instanceof fs&&o.intersectsChildrenHelperReverse(e,n,r,s,a)||o.intersects(e,n,r,!1)&&(a.push(o),s))return!0;return!1}intersectsChildrenReverse(e,n,r,s=!1,a=[],o=!1){return this.intersectsChildrenHelperReverse(e,n,r,s,a),a}updateWorldMatrix(e,n,r){if(super.updateWorldMatrix(e,n,r),r&&this.children)for(let s of this.children)s.updateWorldMatrix(e,!1,!0)}find(e){let n;return this.traverse(r=>{r.uuid===e&&(n=r)}),n}innerDrawChildren(e){for(let n=this.children.length-1;n>=0;n--)this.children[n].draw(e)}resetBBoxNeedsUpdate(){super.resetBBoxNeedsUpdate(),this.traverse(e=>{e.resetBBoxNeedsUpdateSelf()})}clone(e){let n=new fs(this.uuid,this.data,e);n.parent=void 0;for(let r of this.children)n.add(r.clone(e));return n}},Os=class extends fs{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.updateState(n,r)}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.innerDrawChildren(e),e.restore())}clone(e){let n=new Os(this.uuid,this.data,e);n.parent=void 0;for(let r of this.children)n.add(r.clone(e));return n}};ft();an();var Fi=class extends fs{constructor(e,n,r){super(e,n,r);this.uuid=e;this.width=0;this.height=0;this.clipped=!0;this.background=new Ia(e+"-background",ff.defaultData,r),this.background.parent=this,this.updateState(n,r)}get fill(){return this.background.fill}get stroke(){return this.background.stroke}get backgroundBlur(){return this.background.backgroundBlur}get layerBlur(){return this.background.layerBlur}get dropShadow(){return this.background.dropShadow}get innerShadow(){return this.background.innerShadow}get cornerRadius(){return this.background.cornerRadius}set cornerRadius(e){this.background.cornerRadius=e}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(e,n,r){super.updateWorldMatrix(e,n,r),this.background?.updateWorldMatrix(e,n,r)}draw(e){if(!this.visible)return;e.save();let n=this.width,r=this.height;this.applyTransforms(e),this.background.width=n,this.background.height=r,this.background.draw(e),this.clipped&&e.clipRect(0,0,n,r,...this.cornerRadius),this.innerDrawChildren(e),e.restore()}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,n){super.updateState(e,n),this.updateSizeState(e),this.updateCornerState(e),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur),e.clipped!==void 0&&(this.clipped=e.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.type===0&&($t(e.path,["fill"])?this.fill.update(e.props):$t(e.path,["stroke"])?this.stroke.update(e.props):$t(e.path,["dropShadow"])?this.dropShadow.update(e.props):$t(e.path,["innerShadow"])?this.innerShadow.update(e.props):$t(e.path,["layerBlur"])?this.layerBlur.update(e.props):$t(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}clone(e){let n=new Fi(this.uuid,this.data,e);n.parent=void 0;for(let r of this.children)n.add(r.clone(e));return n}};ft();var l4=nd(SE(),1),PE=new Map,ene=4096,lm=null;function tne(i){let t=PE.get(i);if(t!==void 0)return t;if(lm===null||!lm.isConnected){let n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("aria-hidden","true"),n.style.cssText="position:absolute;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none",lm=document.createElementNS("http://www.w3.org/2000/svg","path"),n.appendChild(lm),document.body.appendChild(n)}lm.setAttribute("d",i);let e=lm.getBBox();return PE.size>=ene&&PE.clear(),PE.set(i,e),e}var xc=class extends sr{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this._pathBBox=new DOMRect;this.path="";this.updateState(n,r),this.autoClose=!1,this.computeSVGBBox()}computeSVGBBox(){let e=this.path;c4(this.path)&&(console.warn("Invalid SVG path",this.uuid),e=""),this._pathBBox=tne(e)}innerDraw(e){e.path(this.path)}intersectsInLocalSpace(e,n){return e>=this._pathBBox.x&&e<=this._pathBBox.x+this._pathBBox.width&&n>=this._pathBBox.y&&n<=this._pathBBox.y+this._pathBBox.height}getCenter(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}getHalfSize(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}updateState(e,n){super.updateState(e,n),e.path!==void 0&&(this.path=e.path,this.computeSVGBBox())}clone(e){let n=new xc(this.uuid,this.data,e);return n.parent=void 0,n}};function c4(i){return/NaN/.test(i)}function u4(i,t=1,e=1){if(t<=0||e<=0)return i;if(c4(i))return console.warn("Cannot scale invalid path",i),IE([]);if(t===1&&e===1)return i;try{let r=(0,l4.parseSVG)(i).map(s=>{let a={...s};return"x"in a&&(a.x=a.x*t),"y"in a&&(a.y=a.y*e),"x1"in a&&(a.x1=a.x1*t),"x2"in a&&(a.x2=a.x2*t),"y1"in a&&(a.y1=a.y1*e),"y2"in a&&(a.y2=a.y2*e),"rx"in a&&(a.rx=a.rx*t),"ry"in a&&(a.ry=a.ry*e),a});return IE(r)}catch(n){return console.warn("Error parsing SVG path",n),IE([])}}function IE(i){let t=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"],e;return i.map(n=>{let r=[];t.forEach(a=>{if(a in n){let o=n[a]*1;r.length&&o>=0&&r.push(","),r.push(o)}});let s=(e===n.code?r[0]<0?"":",":n.code)+r.join("");return e=n.code,s}).join("")}function d4(i,t,e){switch(t.type){case"ellipse2d":return new Ru(i,t,e);case"rectangle2d":return new Ia(i,t,e);case"text2d":return new Du(i,t,e);case"vector2d":return new om(i,t,e);case"path2d":return new xc(i,t,e);case"frame2d":return new Fi(i,t,e);case"group2d":default:return new Os(i,t,e)}}mi();var RI=class{constructor(t,e,n){this.uuid=t;this.data=e;this.group=new Os(RI.GROUP_ID,{...Ky.defaultData},n),this.createChildrenObjects(e.objects,this.group,n)}createObject(t,e,n,r,s,a){let o=d4(t,e,a);o&&(r.add(o),r.children.splice(s,0,r.children.pop()),o.updateWorldMatrix(),n.length>0&&(o instanceof Os||o instanceof Fi)&&this.createChildrenObjects(n,o,a))}createChildrenObjects(t,e,n){let r=0;for(let s of t)this.createObject(s.id,s.data,s.children,e,r,n),r+=1}draw(t){this.group.draw(t)}updateEntityByOp(t,e,n,r){let s=this.find(t);if(s)try{s.updateByOp(e,n,{shared:r})}catch(a){console.error(a)}}updateTreeByOp(t,e){if(t.path.length===0&&t.type===7){let n=t.parent===null?this.group:this.find(t.parent);n!==void 0&&n instanceof fs&&(this.createObject(t.id,t.data,t.children,n,t.localIndex,e),n.requestRender())}else if(t.path.length===0&&t.type===8){let n=this.find(t.id);if(n!==void 0&&n.parent!==void 0&&n.parent instanceof fs){let r=n.parent;n.resetBBoxNeedsUpdate(),r?.remove(n),r?.requestRender()}}else if(t.path.length===0&&t.type===9){let n=this.find(t.id);if(n!==void 0){let r=n.parent,s=t.parent===null?this:this.find(t.parent);if(s===void 0&&!1&&console.error("unexpected",s,t),s instanceof fs||s===this){s.add(n);let a=t.localIndex;s.children.splice(a,0,s.children.pop()),n.updateWorldMatrix(!0,!1,!0),r?.requestRender(),n.requestRender()}n.resetBBoxNeedsUpdate()}}}add(t){this.group.add(t)}remove(t){this.group.remove(t)}traverse(t){this.group.traverse(e=>{e!==this.group&&t(e)})}intersectsChildren(t,e,n,r=!1,s=[]){return this.group.intersectsChildren(t,e,n,r,s,!0)}intersectsChildrenReverse(t,e,n,r=!1,s=[]){return this.group.intersectsChildrenReverse(t,e,n,r,s,!0)}find(t){return this.group.find(t)}get children(){return this.group.children}project(t,e){return this.group.project(t,e)}getWithSortKey(t){let e=this.find(t);if(e===void 0)return;let n=[],r=e;for(;r!==this.group;){let s=r;r=r.parent;let a=r.children.indexOf(s);n.splice(0,0,a)}return{entity:e,sortKey:n}}getAllSorted(t){let e=[];for(let n of t){let r=this.getWithSortKey(n.id);r!==void 0&&e.push(r)}return e.sort((n,r)=>Rd(n.sortKey,r.sortKey)),e.map(n=>n.entity)}},uh=RI;uh.GROUP_ID="scene2d";function DI({constraints:i,newParentWidth:t,newParentHeight:e,initialParentWidth:n,initialParentHeight:r,objectInitialWidth:s,objectInitialHeight:a,objectInitialPosition:o}){let{horizontalConstraint:l,verticalConstraint:c}=i,u=t-n,d=e-r,h=s,p=a,f=o[0],m=o[1];if(l!==0){if(l===1)f+=u;else if(l===3)f+=u/2;else if(l===2)h=Math.max(1,h+u);else if(l===4){let g=t/n;h*=g,f*=g}}if(c!==0){if(c===1)m+=d;else if(c===3)m+=d/2;else if(c===2)p=Math.max(1,p+d);else if(c===4){let g=e/r;p*=g,m*=g}}return{width:h,height:p,position:[f,m]}}var nne=nd(SE(),1);var SNe={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{mm:1,px:1,cm:1,in:1,pt:1,pc:1}};ds();an();ft();Y();LI();function NI(i,t,e,n){return n?e:2048/Math.max(1,i,t)}function f4(i,t,e,n){let r=NI(i,t,e,n),s=Math.max(e,512/Math.min(i,t)),a=Math.min(s,r);return{width:Math.max(1,Math.ceil(i*a)),height:Math.max(1,Math.ceil(t*a))}}var rne=`
9791
9791
  varying vec2 vUv;
9792
9792
  void main() {
@@ -9802,7 +9802,7 @@ void main() {
9802
9802
  `,e),d=e.horizontalAlign===1?u:0,h=this.getLineInitialOffsetX(o[0],l,e.horizontalAlign,t[0],u),p=this.getLineInitialOffsetY(a,t.length,c,s,e.verticalAlign),f=[],m=t.map(()=>[]),g=t.map(()=>[]);for(let v=0;v<t.length;v++){let b=t[v],x={features:{liga:!0},letterSpacing:e.letterSpacing},S=[];try{S=r.stringToGlyphs(b,x)}catch(A){this.warnLayoutError(A)}h=this.getLineInitialOffsetX(o[v],l,e.horizontalAlign,b,u);let E=[];try{E=this.reverseLigaturesTable(r,b,S)}catch(A){this.warnLayoutError(A)}let M=this.computeSpaceWidthForLine(t,v,e,n),w=0,T=S[0];T&&e.horizontalAlign===2&&T.leftSideBearing!==void 0&&(h-=T.leftSideBearing*s);try{this.font?.forEachGlyph(b,h,p,e.fontSize,x,(A,C,P,D,I)=>{let L=A.index===0?`
9803
9803
  `:A.unicode?String.fromCharCode(A.unicode):void 0,U=E[w],G=0;if(L===`
9804
9804
  `)G=d;else if(L===" ")G=M;else{let X=this.createPath(A,s,C,P,e);X&&(G=X.offsetX,f.push(X.path))}if(!U||U.replacements.length===1)g[v].push([C,P]),m[v].push(G);else{let X=U.replacements.map(K=>(r.glyphs.get(K).advanceWidth??0)*s),ae=X.reduce((K,re)=>K+=re,0),ee=X.map(K=>K/ae),$=C;for(let K=0;K<ee.length;K++){let re=G*ee[K];g[v].push([$,P]),m[v].push(re),$+=re}}w++})}catch(A){this.warnLayoutError(A)}p-=a}let y=[];for(let v=0,b=f.length;v<b;v++)y.push(...f[v].toShapes());return{shapes:y,charWidths:m,lineWidths:o,charCoords:g}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,n,r,s){return(n===3||n===2)&&r.indexOf(`
9805
- `)>=0&&(t-=s),n===3?e*.5-t*.5:n===2?e-t:0}getLineInitialOffsetY(t,e,n,r,s){let a=e*t,o=Math.abs(this.ascender-this.descender)*r,l=t-o,c=-this.ascender*r-l/2;return s===3?-(n-a-c):s===2?-(n*.5-a*.5-c):c}createPath(t,e,n,r,s){let a=t.getPath(n,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!a){console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");return}let o=new DE,l=(t.advanceWidth??1)*e;if(t)for(let c of a.commands){let u=o.currentPath?.currentPoint;if(!(u&&c.type!=="Z"&&u.x===c.x&&-u.y===c.y))switch(c.type){case"M":o.moveTo(c.x,-c.y);break;case"L":o.lineTo(c.x,-c.y);break;case"Q":o.quadraticCurveTo(c.x1,-c.y1,c.x,-c.y);break;case"C":o.bezierCurveTo(c.x1,-c.y1,c.x2,-c.y2,c.x,-c.y);break}}return o.subPaths.forEach(c=>{let u=yne(c.curves);u!==void 0&&c.currentPoint.distanceTo(u)>0&&c.lineTo(u.x,u.y)}),{offsetX:l,path:o}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}computeSpaceWidthForLine(t,e,n,r){let s=this.getCharWidth(" ",n),a=t[e];if(a){let o=this.countSpaces(a.trimEnd());if(n.horizontalAlign===4&&e<t.length-1&&o){let l=typeof n.width=="string"?Number(r.getVariable(n.width)):n.width,c=this.getTextWidth(a,n);return(l-(c-o*s))/o}}return s}countSpaces(t){return(t.match(/ /g)||[]).length}};function yne(i){if(i.length){let t=i[0];if(t instanceof Ai)return t.v1;if(t instanceof Bi||t instanceof xs)return t.v0}}aw();Qt();Sa("TextGeometry",(i,t,e)=>new Pu(i,t,e));var x4={create:(i,t)=>new zf(i,t)};ev("TextGeometry",x4);ev("InputGeometry",x4);Sk(NE);_t("text");ft();var BE=200,S4=null;function w4(i){S4=i}function HI(){return S4}function E4(i){let t=!1;return i.scene.objects.forEach(e=>{e.data.type==="Page"&&!t&&e.data.publish.gameControlObject&&Uo.traverseModuleInstances(i,e.id,(r,s,a)=>{for(let o of a)o.data.type==="GameControl"&&o.data.navmesh.enabled&&(t=!0)})}),t}hn();var rb=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return Math.sqrt(e*e+n*n)},M4=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return vne(Math.atan2(n,e))},_4=(i,t,e)=>{let n={x:0,y:0};return e=UE(e),n.x=i.x-t*Math.cos(e),n.y=i.y-t*Math.sin(e),n},UE=i=>i*(Math.PI/180),vne=i=>i*(180/Math.PI),T4=i=>isNaN(i.buttons)?i.pressure!==0:i.buttons!==0,FE=new Map,A4=i=>{FE.has(i)&&clearTimeout(FE.get(i)),FE.set(i,setTimeout(function(){FE.delete(i),i()},100))},um=(i,t,e)=>{let n=t.split(/[ ,]+/g),r;for(let s=0;s<n.length;s+=1)r=n[s],i.addEventListener?i.addEventListener(r,e,!1):i.attachEvent&&i.attachEvent(r,e)},dm=(i,t,e)=>{let n=t.split(/[ ,]+/g),r;for(let s=0;s<n.length;s+=1)r=n[s],i.removeEventListener?i.removeEventListener(r,e):i.detachEvent&&i.detachEvent(r,e)};var kE=i=>(i.preventDefault(),i.type.match(/^touch/)?i.changedTouches:i),WI=()=>{if(typeof window>"u")return;let i=window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,t=window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;return{x:i,y:t}},VE=(i,t)=>{t.top||t.right||t.bottom||t.left?(i.style.top=t.top,i.style.right=t.right,i.style.bottom=t.bottom,i.style.left=t.left):(i.style.left=t.x+"px",i.style.top=t.y+"px")},zE=(i,t,e)=>{let n=P4(i);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof t=="string")n[r]=t+" "+e;else{let s="";for(let a=0,o=t.length;a<o;a+=1)s+=t[a]+" "+e+", ";n[r]=s.slice(0,-2)}return n},C4=(i,t)=>{let e=P4(i);for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t);return e},P4=i=>{let t={};return t[i]="",["webkit","Moz","o"].forEach(function(n){t[n+i.charAt(0).toUpperCase()+i.slice(1)]=""}),t},GE=(i,t)=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e]);return i},I4=(i,t)=>{let e={};for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&Object.prototype.hasOwnProperty.call(t,n)?e[n]=t[n]:Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);return e},ib=(i,t)=>{if(i.length)for(let e=0,n=i.length;e<n;e+=1)t(i[e]);else t(i)},O4=(i,t,e)=>({x:Math.min(Math.max(i.x,t.x-e),t.x+e),y:Math.min(Math.max(i.y,t.y-e),t.y+e)});typeof window<"u"&&(R4="ontouchstart"in window,D4=!!window.PointerEvent,L4=!!window.MSPointerEvent);var R4,D4,L4,sb={touch:{start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},pointer:{start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"},MSPointer:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},hm,ab={};D4?hm=sb.pointer:L4?hm=sb.MSPointer:R4?(hm=sb.touch,ab=sb.mouse):hm=sb.mouse;function dh(){}dh.prototype.on=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]=e._handlers_[r]||[],e._handlers_[r].push(t);return e};dh.prototype.off=function(i,t){var e=this;return e._handlers_=e._handlers_||{},i===void 0?e._handlers_={}:t===void 0?e._handlers_[i]=null:e._handlers_[i]&&e._handlers_[i].indexOf(t)>=0&&e._handlers_[i].splice(e._handlers_[i].indexOf(t),1),e};dh.prototype.trigger=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]&&e._handlers_[r].length&&e._handlers_[r].forEach(function(a){a.call(e,{type:r,target:e},t)})};dh.prototype.config=function(i){var t=this;t.options=t.defaults||{},i&&(t.options=I4(t.options,i))};dh.prototype.bindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},e._domHandlers_[t]=function(){typeof e["on"+t]=="function"?e["on"+t].apply(e,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},um(i,hm[t],e._domHandlers_[t]),ab[t]&&um(i,ab[t],e._domHandlers_[t]),e};dh.prototype.unbindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},dm(i,hm[t],e._domHandlers_[t]),ab[t]&&dm(i,ab[t],e._domHandlers_[t]),delete e._domHandlers_[t],this};var pm=dh;function bi(i,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=i,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=bi.id,bi.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}bi.prototype=new pm;bi.constructor=bi;bi.id=0;bi.prototype.buildEl=function(i){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)};bi.prototype.stylize=function(){if(this.options.dataOnly)return this;var i=this.options.fadeTime+"ms",t=C4("borderRadius","50%"),e=zE("transition","opacity",i),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},GE(n.el,e),this.options.shape==="circle"&&GE(n.back,t),GE(n.front,t),this.applyStyles(n),this};bi.prototype.applyStyles=function(i){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var e in i[t])this.ui[t].style[e]=i[t][e];return this};bi.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};bi.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};bi.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null};bi.prototype.show=function(i){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof i=="function"&&i.call(this)},t.options.fadeTime)),t};bi.prototype.hide=function(i){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var e=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=e,typeof i=="function"&&i.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let e=t.options.restJoystick,n={};n.x=e===!0||e.x!==!1?0:t.instance.frontPosition.x,n.y=e===!0||e.y!==!1?0:t.instance.frontPosition.y,t.setPosition(i,n)}return t};bi.prototype.setPosition=function(i,t){var e=this;e.frontPosition={x:t.x,y:t.y};var n=e.options.fadeTime+"ms",r={};r.front=zE("transition",["top","left"],n);var s={front:{}};s.front={left:e.frontPosition.x+"px",top:e.frontPosition.y+"px"},e.applyStyles(r),e.applyStyles(s),e.restTimeout=setTimeout(function(){typeof i=="function"&&i.call(e),e.restCallback()},e.options.fadeTime)};bi.prototype.restCallback=function(){var i=this,t={};t.front=zE("transition","none",""),i.applyStyles(t),i.trigger("rested",i.instance)};bi.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};bi.prototype.computeDirection=function(i){var t=i.angle.radian,e=Math.PI/4,n=Math.PI/2,r,s,a;if(t>e&&t<e*3&&!i.lockX?r="up":t>-e&&t<=e&&!i.lockY?r="left":t>-e*3&&t<=-e&&!i.lockX?r="down":i.lockY||(r="right"),i.lockY||(t>-n&&t<n?s="left":s="right"),i.lockX||(t>0?a="up":a="down"),i.force>this.options.threshold){var o={},l;for(l in this.direction)Object.prototype.hasOwnProperty.call(this.direction,l)&&(o[l]=this.direction[l]);var c={};this.direction={x:s,y:a,angle:r},i.direction=this.direction;for(l in o)o[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return i;(!c.x||!c.y)&&this.trigger("plain",i),c.x||this.trigger("plain:"+s,i),c.y||this.trigger("plain:"+a,i),c.angle||this.trigger("dir dir:"+r,i)}else this.resetDirection();return i};var N4=bi;function Kr(i,t){var e=this;e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.pressureIntervals={},e.manager=i,e.id=Kr.id,Kr.id+=1,e.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},e.config(t),(e.options.mode==="static"||e.options.mode==="semi")&&(e.options.multitouch=!1),e.options.multitouch||(e.options.maxNumberOfNipples=1);let n=getComputedStyle(e.options.zone.parentElement);return n&&n.display==="flex"&&(e.parentIsFlex=!0),e.updateBox(),e.prepareNipples(),e.bindings(),e.begin(),e.nipples}Kr.prototype=new pm;Kr.constructor=Kr;Kr.id=0;Kr.prototype.prepareNipples=function(){var i=this,t=i.nipples;t.on=i.on.bind(i),t.off=i.off.bind(i),t.options=i.options,t.destroy=i.destroy.bind(i),t.ids=i.ids,t.id=i.id,t.processOnMove=i.processOnMove.bind(i),t.processOnEnd=i.processOnEnd.bind(i),t.get=function(e){if(e===void 0)return t[0];for(var n=0,r=t.length;n<r;n+=1)if(t[n].identifier===e)return t[n];return!1}};Kr.prototype.bindings=function(){var i=this;i.bindEvt(i.options.zone,"start"),i.options.zone.style.touchAction="none",i.options.zone.style.msTouchAction="none"};Kr.prototype.begin=function(){var i=this,t=i.options;if(t.mode==="static"){var e=i.createNipple(t.position,i.manager.getIdentifier());e.add(),i.idles.push(e)}};Kr.prototype.createNipple=function(i,t){var e=this,n=e.manager.scroll,r={},s=e.options,a={x:e.parentIsFlex?n.x:n.x+e.box.left,y:e.parentIsFlex?n.y:n.y+e.box.top};if(i.x&&i.y)r={x:i.x-a.x,y:i.y-a.y};else if(i.top||i.right||i.bottom||i.left){var o=document.createElement("DIV");o.style.display="hidden",o.style.top=i.top,o.style.right=i.right,o.style.bottom=i.bottom,o.style.left=i.left,o.style.position="absolute",s.zone.appendChild(o);var l=o.getBoundingClientRect();s.zone.removeChild(o),r=i,i={x:l.left+n.x,y:l.top+n.y}}var c=new N4(e,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:t,position:i,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(VE(c.ui.el,r),VE(c.ui.front,c.frontPosition)),e.nipples.push(c),e.trigger("added "+c.identifier+":added",c),e.manager.trigger("added "+c.identifier+":added",c),e.bindNipple(c),c};Kr.prototype.updateBox=function(){var i=this;i.box=i.options.zone.getBoundingClientRect()};Kr.prototype.bindNipple=function(i){var t=this,e,n=function(r,s){e=r.type+" "+s.id+":"+r.type,t.trigger(e,s)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",n),i.on("dir:up dir:right dir:down dir:left",n),i.on("plain:up plain:right plain:down plain:left",n)};Kr.prototype.pressureFn=function(i,t,e){var n=this,r=0;clearInterval(n.pressureIntervals[e]),n.pressureIntervals[e]=setInterval(function(){var s=i.force||i.pressure||i.webkitForce||0;s!==r&&(t.trigger("pressure",s),n.trigger("pressure "+t.identifier+":pressure",s),r=s)}.bind(n),100)};Kr.prototype.onstart=function(i){var t=this,e=t.options,n=i;i=kE(i),t.updateBox();var r=function(s){t.actives.length<e.maxNumberOfNipples?t.processOnStart(s):n.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(a){if(Object.values(n.touches).findIndex(function(l){return l.identifier===a})<0){var o=[i[0]];o.identifier=a,t.processOnEnd(o)}}),t.actives.length<e.maxNumberOfNipples&&t.processOnStart(s))};return ib(i,r),t.manager.bindDocument(),!1};Kr.prototype.processOnStart=function(i){var t=this,e=t.options,n,r=t.manager.getIdentifier(i),s=i.force||i.pressure||i.webkitForce||0,a={x:i.pageX,y:i.pageY},o=t.getOrCreate(r,a);o.identifier!==r&&t.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(u){u.trigger("start",u),t.trigger("start "+u.id+":start",u),u.show(),s>0&&t.pressureFn(i,u,u.identifier),t.processOnMove(i)};if((n=t.idles.indexOf(o))>=0&&t.idles.splice(n,1),t.actives.push(o),t.ids.push(o.identifier),e.mode!=="semi")l(o);else{var c=rb(a,o.position);if(c<=e.catchDistance)l(o);else{o.destroy(),t.processOnStart(i);return}}return o};Kr.prototype.getOrCreate=function(i,t){var e=this,n=e.options,r;return/(semi|static)/.test(n.mode)?(r=e.idles[0],r?(e.idles.splice(0,1),r):n.mode==="semi"?e.createNipple(t,i):(console.warn("Coudln't find the needed nipple."),!1)):(r=e.createNipple(t,i),r)};Kr.prototype.processOnMove=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.scroll;if(!T4(i)){this.processOnEnd(i);return}if(!r){console.error("Found zombie joystick with ID "+n),t.manager.removeIdentifier(n);return}if(e.dynamicPage){var a=r.el.getBoundingClientRect();r.position={x:s.x+a.left,y:s.y+a.top}}r.identifier=n;var o=r.options.size/2,l={x:i.pageX,y:i.pageY};e.lockX&&(l.y=r.position.y),e.lockY&&(l.x=r.position.x);var c=rb(l,r.position),u=M4(l,r.position),d=UE(u),h=c/o,p={distance:c,position:l},f,m;if(r.options.shape==="circle"?(f=Math.min(c,o),m=_4(r.position,f,u)):(m=O4(l,r.position,o),f=rb(m,r.position)),e.follow){if(c>o){let b=l.x-m.x,x=l.y-m.y;r.position.x+=b,r.position.y+=x,r.el.style.top=r.position.y-(t.box.top+s.y)+"px",r.el.style.left=r.position.x-(t.box.left+s.x)+"px",c=rb(l,r.position)}}else l=m,c=f;var g=l.x-r.position.x,y=l.y-r.position.y;r.frontPosition={x:g,y},e.dataOnly||VE(r.ui.front,r.frontPosition);var v={identifier:r.identifier,position:l,force:h,pressure:i.force||i.pressure||i.webkitForce||0,distance:c,angle:{radian:d,degree:u},vector:{x:g/o,y:-y/o},raw:p,instance:r,lockX:e.lockX,lockY:e.lockY};v=r.computeDirection(v),v.angle={radian:UE(180-u),degree:180-u},r.trigger("move",v),t.trigger("move "+r.id+":move",v)};Kr.prototype.processOnEnd=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.removeIdentifier(r.identifier);!r||(e.dataOnly||r.hide(function(){e.mode==="dynamic"&&(r.trigger("removed",r),t.trigger("removed "+r.id+":removed",r),t.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(t.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),t.trigger("end "+r.id+":end",r),t.ids.indexOf(r.identifier)>=0&&t.ids.splice(t.ids.indexOf(r.identifier),1),t.actives.indexOf(r)>=0&&t.actives.splice(t.actives.indexOf(r),1),/(semi|static)/.test(e.mode)?t.idles.push(r):t.nipples.indexOf(r)>=0&&t.nipples.splice(t.nipples.indexOf(r),1),t.manager.unbindDocument(),/(semi|static)/.test(e.mode)&&(t.manager.ids[s.id]=s.identifier))};Kr.prototype.onDestroyed=function(i,t){var e=this;e.nipples.indexOf(t)>=0&&e.nipples.splice(e.nipples.indexOf(t),1),e.actives.indexOf(t)>=0&&e.actives.splice(e.actives.indexOf(t),1),e.idles.indexOf(t)>=0&&e.idles.splice(e.idles.indexOf(t),1),e.ids.indexOf(t.identifier)>=0&&e.ids.splice(e.ids.indexOf(t.identifier),1),e.manager.removeIdentifier(t.identifier),e.manager.unbindDocument()};Kr.prototype.destroy=function(){var i=this;i.unbindEvt(i.options.zone,"start"),i.nipples.forEach(function(e){e.destroy()});for(var t in i.pressureIntervals)Object.prototype.hasOwnProperty.call(i.pressureIntervals,t)&&clearInterval(i.pressureIntervals[t]);i.trigger("destroyed",i.nipples),i.manager.unbindDocument(),i.off(),i.pressureIntervals={},i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.manager=null};var B4=Kr;function ii(i){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=WI(),t._windowBound=!1,t.config(i),t.prepareCollections();var e=function(){var n;t.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:t.scroll.x+n.left,y:t.scroll.y+n.top}})})};return t._onResize=function(){A4(e)},t._onScroll=function(){t.scroll=WI()},t.collections}ii.prototype=new pm;ii.constructor=ii;ii.prototype.prepareCollections=function(){var i=this;i.collections.create=i.create.bind(i),i.collections.on=i.on.bind(i),i.collections.off=i.off.bind(i),i.collections.destroy=i.destroy.bind(i),i.collections.get=function(t){var e;return i.collections.every(function(n){return e=n.get(t),!e}),e}};ii.prototype.create=function(i){return this.createCollection(i)};ii.prototype.bindWindowEvents=function(){var i=this;i._windowBound||typeof window>"u"||(i._windowBound=!0,um(window,"resize",i._onResize),um(window,"scroll",i._onScroll))};ii.prototype.unbindWindowEvents=function(){var i=this;!i._windowBound||typeof window>"u"||(i._windowBound=!1,dm(window,"resize",i._onResize),dm(window,"scroll",i._onScroll))};ii.prototype.createCollection=function(i){var t=this,e=new B4(t,i);return t.bindCollection(e),t.collections.push(e),t.bindWindowEvents(),e};ii.prototype.bindCollection=function(i){var t=this,e,n=function(r,s){e=r.type+" "+s.id+":"+r.type,t.trigger(e,s)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",n),i.on("dir:up dir:right dir:down dir:left",n),i.on("plain:up plain:right plain:down plain:left",n)};ii.prototype.bindDocument=function(){var i=this;i.binded||(i.bindEvt(document,"move").bindEvt(document,"end"),i.binded=!0)};ii.prototype.unbindDocument=function(i){var t=this;(!Object.keys(t.ids).length||i===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};ii.prototype.getIdentifier=function(i){var t;return i?(t=i.identifier===void 0?i.pointerId:i.identifier,t===void 0&&(t=this.latest||0)):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]};ii.prototype.removeIdentifier=function(i){var t={};for(var e in this.ids)if(this.ids[e]===i){t.id=e,t.identifier=this.ids[e],delete this.ids[e];break}return t};ii.prototype.onmove=function(i){var t=this;return t.onAny("move",i),!1};ii.prototype.onend=function(i){var t=this;return t.onAny("end",i),!1};ii.prototype.oncancel=function(i){var t=this;return t.onAny("end",i),!1};ii.prototype.onAny=function(i,t){var e=this,n,r="processOn"+i.charAt(0).toUpperCase()+i.slice(1);t=kE(t);var s=function(o,l,c){c.ids.indexOf(l)>=0&&(c[r](o),o._found_=!0)},a=function(o){n=e.getIdentifier(o),ib(e.collections,s.bind(null,o,n)),o._found_||e.removeIdentifier(n)};return ib(t,a),!1};ii.prototype.destroy=function(){var i=this;i.unbindDocument(!0),i.unbindWindowEvents(),i.ids={},i.index=0,i.collections.forEach(function(t){t.destroy()}),i.collections=[],i.off()};ii.prototype.onDestroyed=function(i,t){var e=this;if(e.collections.indexOf(t)<0)return!1;e.collections.splice(e.collections.indexOf(t),1),e.collections.length===0&&e.unbindWindowEvents()};var F4=ii;var fm=null;function U4(){return fm||(fm=new F4),fm}var bne={create:function(i){return U4().create(i)},destroy:function(){fm&&(fm.destroy(),fm=null)},get factory(){return U4()}},k4=bne;hn();ft();Y();$s();Yi();ft();var V4=null;function z4(i){V4=i}function HE(){return V4}var G4,j4=new Promise(i=>{G4=i});var WE;function H4(i){if(WE)return WE;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.11/build"),s=import("./physics.js"),[a,o]=await Promise.all([s,fetch(`${n}/physics.wasm`).then(l=>l.arrayBuffer())]);await a.init(o),G4(a)}return WE=t(),WE}fr();Yi();Qt();aE();Y();Y();Jd();function qI(i){let t=i.elements,e=t[0]**2+t[1]**2+t[2]**2,n=t[4]**2+t[5]**2+t[6]**2,r=t[8]**2+t[9]**2+t[10]**2,s=t[0]**2+t[4]**2+t[8]**2,a=t[1]**2+t[5]**2+t[9]**2,o=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return e<l||n<l||r<l||s<l||a<l||o<l}function mo(i,t){let e=new De;if(t&&qI(t))return e.setAttribute("position",new Ve([],3)),e.setIndex([]),e;if(!i.getAttribute("position"))return e.setAttribute("position",new Ve([],3)),e.setIndex([]),e;let{positions:n,triIndices:r}=Av(i.getAttribute("position"),i.getIndex());return e.setAttribute("position",new Ve(n,3)),e.setIndex(r),t&&e.applyMatrix4(t),e}mf();var qE=class{constructor(t,e,n,r,s,a){this.id=t;this.data=e;this.object=n;this.initialDisabled=!1;this.actions=cn(e,e.actions,r,s,a,n),this.target=e.target}disconnect(){Nn(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}};var ob=class{constructor(t,e,n,r,s,a){this.id=t;this.data=e;this.object=n;this.page=r;this.currentIntersectedObjects=[];this.actions=cn(e,e.actions,r,s,a,n),this.target=e.target,this.triggeringObjects=[];for(let o of e.triggeringObjects){let l=r.scene.find(o);l&&this.triggeringObjects.push(l)}}isValidTriggeringObject(t){return this.target==="all"?!0:this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){Nn(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};fr();var un;j4.then(i=>un=i);var si=new _,Oa=new qe,Lu=new _,MBe=new Xt(0,0,0,"YXZ"),W4=new Xt(0,0,0,"XYZ"),go=new _,XI=new _,YI=new _(1,1,1),mm=new qe,XE=new ne,q4=new ne,xne={type:"updateMatrix"},X4=new qe,$I=new nr,Sne=.5,wne=.7,KI=.01,$E={type:"beginEvent",eventName:"Collision"},Ene={type:"beginEvent",eventName:"Trigger"};function Y4(i){if(Uo.physicsEnabled(i.scene.objects))return!0;let t=!1;return i.scene.objects.traverse((e,n)=>{if(n.events){if(Array.isArray(n.events)){for(let r of n.events)if(r.data.disabled!==!0&&r.data.type==="GameControl"&&r.data.collisionEnabled){t=!0;break}}else for(let r of Object.values(n.events))if(r.disabled!==!0&&r.type==="GameControl"&&r.collisionEnabled){t=!0;break}}}),t}var lb=i=>i.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.hiddenMatrix!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function gm(i){return MU(Wo(i)?i.object:i)}var YE=class{constructor(t){this.eventContext=t;this.isEnabled=!1;this.gameControl=null;this.joysticks=[];this.joystickToGameControls=[];this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}};this.sensorToTriggerEvent={};this.eventManager=void 0;this.needsCollisionDetection=!1;this.initializationCounter=-1;this.fixedBodiesToWatch=[];this.rigidBodyToMesh=new Map;this.nActiveRigidBodies=0;this.collisionEvents=[];this.isExport=!1;this.skipRender=!0;this._staticBVHAttrIds=new WeakMap;this._staticBVHNextAttrId=1;this.processRigidBody=t=>{if(t.bodyType()!==un.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,n,r]=this.rigidBodyToMesh.get(t.handle);if(si.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),Oa.copy(t.rotation()),e.matrixWorld.compose(si,Oa,n),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(xne),r){let s=e.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(e.matrixWorld);for(let a of s.children)a.updateMatrixWorld(!0)}for(let a of e.children)a.updateMatrixWorld(!0)}};this.accumulator=0;this.handleCollisionEvents=(t,e,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[t]?(r=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),r&&s&&r.isValidTriggeringObject(s)){r.dispatch();return}for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===t||o.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,t)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let u of o)u.data.target==="scene"&&this.dispatchCollisionEvent(u,a,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(e),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let u of c)u.data.target==="scene"&&this.dispatchCollisionEvent(u,l,e)}};this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=BE,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events){if(n.data.disabled===!0)continue;let r=n.data.actions?.find(s=>s.data.type==="Destroy")?.data;if(r)for(let s of r.objects){let a=this.page.scene.find(s);a&&(a.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events)if(!(n.data.disabled===!0||n.data.type!=="DragDrop"))for(let r of n.data.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(HE()===null){Jn("collision-bvh","trigger/collision detection");return}let t=[],e=[];if(this.page.traverseChildren(n=>{let r,s=n instanceof al,a=xu(n);if(oc(n)||s||a)return;Wo(n)?r=n.object:r=n;let o=r.dataPatched;if(o.physics?.enabled==="visibility"?!o.visible:!o.physics?.enabled)return!0;let l=n.geometry,c=r.userData.hasDestroy===!0,u=r.userData.hasDrag===!0;if(lb(o)||c||u||r.dataPatched.events.some(d=>d.data.disabled!==!0&&(d.data.type==="GameControl"||d.data.type==="Follow")))return n.updateMatrixWorldRigid(),this.addBoundsTree(n),!0;if(l){let d=l.getAttribute("position");if(d!==void 0&&d.count>0){t.push({geometry:l,matrixWorld:n.matrixWorld}),e.push(l.id,this._staticBVHIdOf(d),d.version,l.index!==null?this._staticBVHIdOf(l.index):-1,l.index!==null?l.index.version:-1);for(let h of n.matrixWorld.elements)e.push(h)}}if(gm(n))return!0}),t.length>0){let n=this._staticBVHCache;if(n!==void 0&&n.signature.length===e.length&&n.signature.every((o,l)=>o===e[l])){this.sharedGameControlGlobals.staticMeshBVH=n.bvh;return}let r=t.map(o=>mo(o.geometry,o.matrixWorld)),s=ro(r,!1),a=new(HE())(s);this._staticBVHCache={signature:e,bvh:a},this.sharedGameControlGlobals.staticMeshBVH=a}}addRigidBody(t,e,n){if(qI(t.matrixWorld))return;let r=[],s="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(mo(s,t.shearScale)),a.physics.fusedBody){let o=this.gatherChildrenGeom(t,r);t.traverseObject(o),t.children.forEach(c=>c.updateMatrixWorld(!0));let l=t.cloner;l&&l.objectForSample===void 0&&a.physics.rigidBody==="dynamic"&&(l.traverseObject(o),l.children.forEach(c=>c.updateMatrixWorld(!0)))}if(r.length>0){let o,l=!1,c=!n.fromCreate&&a.physics.rigidBody==="dynamic"||n.fromCreate&&n.dynamic;c?(o=un.RigidBodyDesc.dynamic(),o.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(n.hasTransformAnim||n.hasFollow||n.hasDrag)&&!n.fromCreate?(o=un.RigidBodyDesc.kinematicPositionBased(),l=!0):o=un.RigidBodyDesc.fixed();let u=ro(r);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(si,Oa,Lu),t.position0=si.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Oa.clone(),si.divideScalar(this.pixelsPerMeter),o.setTranslation(si.x,si.y,si.z).setRotation(Oa),s?u?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):u?.scale(Lu.x/this.pixelsPerMeter,Lu.y/this.pixelsPerMeter,Lu.z/this.pixelsPerMeter);let d=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o),h=!(a.geometry===void 0||a.geometry.type==="SubdivGeometry"||a.geometry.type==="NonParametricGeometry"||a.geometry.type==="BooleanGeometry"||a.geometry.type==="VectorGeometry"||a.geometry.type==="StarGeometry"||a.geometry.type==="RectangleGeometry"||a.geometry.type==="EllipseGeometry"||a.geometry.type==="TriangleGeometry"||a.geometry.type==="TorusGeometry"||a.geometry.type==="HelixGeometry");try{this.addCollider(d,a.physics,u,e,h)}catch{try{this.addCollider(d,a.physics,u,e,!1)}catch(p){console.error(p)}}if(d.numColliders()===0){this.sharedGameControlGlobals.rapierWorld.removeRigidBody(d);return}c?this.rigidBodyToMesh.set(d.handle,[t,Lu.clone(),a.physics.fusedBody]):l?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(d.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,d,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=d}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(mo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(n=>n.updateMatrixWorld(!0)),e.length>0){let n=ro(e,!1);t.bvhGeometry=n,n.getAttribute("position").count>0?(t.bvhGeometry.boundsTree=new(HE())(n),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):!1&&console.warn(`ControlsManager.addBoundsTree: object "${t.name}" has empty geometry`)}}addCollider(t,e,n,r,s=!0){if(n?.getAttribute("position").count===0||n?.getIndex()?.count===0)return;let a;n&&(e.colliderType==="trimesh"?a=un.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array):a=un.ColliderDesc.convexMesh(n.getAttribute("position").array,s?n.getIndex().array:void 0)),a.setFrictionCombineRule(un.CoefficientCombineRule.Average).setRestitutionCombineRule(un.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let o=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t);this.sharedGameControlGlobals.colliderToEntity.set(o.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(l=>l.target==="scene")&&o.setActiveEvents(un.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let n=gm(t);return(r,s)=>{if(s===0)return;if(n&&r.parent===t)return!0;let a;if(oc(r))if(r.objectForSample){if(r.objectForSample.dataPatched.physics.fusedBody)return;a=r.object}else return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Wo(r))a=r.object;else if(a=r,a.dataPatched.cloner?.hideBase)return!0;let o=a.dataPatched;if(o.physics.enabled==="visibility"?!o.visible:!o.physics.enabled)return!0;s===1?t.hasNonUniformScale?r.matrixWorld.multiplyMatrices(t.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let l=r.geometry;if(l?.getAttribute("position")!==void 0&&e.push(mo(l,r.matrixWorld)),gm(r))return!0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,n=!1;this.page.traverseEntity(o=>{for(let l of o.dataPatched.events)if(l.data.disabled===!1&&l.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=HI();if(r!==null?n=r.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||n:this.page.data.publish.gameControlObject!==null&&Jn("game-controls","the scene's game controls"),n===!1){let{enableRotate:o,enablePan:l,enableZoom:c,autoRotate:u,hoverRotatePanMode:d}=this.eventManager.publish.orbitControls;(o||l||c||u||d!==0)&&(this.orbitControls=new Jf(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let s=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();HI()?.createJoysticks(this,s,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(o=>o.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new un.World(new un.Vector3(0,this.gravity,0)),this.events=new un.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(o=>{let l;if(oc(o))if(o.objectForSample){if(o.objectForSample.dataPatched.physics.fusedBody)return;l=o.object}else return o.object.dataPatched.physics.fusedBody===!0&&o.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Wo(o))l=o.object;else{if(xu(o)||io(o)||o instanceof al)return;if(l=o,l.dataPatched.cloner?.disabled===!1&&l.dataPatched.cloner?.hideBase&&l.dataPatched.physics?.fusedBody!==!0)return!0}let c=l.dataPatched,u;for(let y of c.events)y.data.disabled!==!0&&y.data.type==="GameControl"&&(u=y.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;o.updateMatrixWorldRigid();let d=lb(c),h=!1,p=l.userData.hasDestroy,f=l.userData.hasDrag,m=!1;for(let y of c.events)if(y.data.disabled!==!0){if(y.data.type==="Collision"){h=!0;let v=new qE(y.id,y.data,l,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].every(b=>b.id!==y.id)?this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]=[v]}else if(y.data.type==="Follow"){m=!0;let v=y.data.target;o.traverseVisible(b=>{b.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(o.matrixWorldFusedFalse=o.matrixWorld.clone());let g=o.geometry;if(u!==void 0){let y=un.RigidBodyDesc.kinematicPositionBased();(o.hasNonUniformScale?o.matrixWorldRigid:o.matrixWorld).decompose(si,Oa,Lu),o.position0=si.clone().divideScalar(this.pixelsPerMeter),o.rotation0=Oa.clone(),si.divideScalar(this.pixelsPerMeter),y.setTranslation(si.x,si.y,si.z).setRotation(Oa);let v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(y);o.rigidBody=v;let b;u.collider.type==="sphere"?b=un.ColliderDesc.ball(u.collider.radius/this.pixelsPerMeter):u.collider.type==="capsule"?b=un.ColliderDesc.capsule((u.collider.height/2-u.collider.radius)/this.pixelsPerMeter,u.collider.radius/this.pixelsPerMeter):b=un.ColliderDesc.cuboid(u.collider.width/this.pixelsPerMeter/2,u.collider.height/this.pixelsPerMeter/2,u.collider.depth/this.pixelsPerMeter/2),b.setFrictionCombineRule(un.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(un.CoefficientCombineRule.Min);let x=this.sharedGameControlGlobals.rapierWorld.createCollider(b,v);this.sharedGameControlGlobals.colliderToEntity.set(x.handle,l),si.fromArray(u.collider.position.map(E=>typeof E=="number"?E:0)).multiply(Lu.setFromMatrixScale(l.matrixWorld)).divideScalar(this.pixelsPerMeter),x.setTranslationWrtParent(si);let S=new qe().setFromEuler(new Xt().setFromVector3(new _().fromArray(u.collider.rotation.map(E=>typeof E=="number"?E:0))));x.setRotationWrtParent(S),x.setActiveEvents(un.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(l,!0)}else c.physics.rigidBody==="dynamic"||d||m||p||f||h?(this.addRigidBody(o,l,{hasFollow:m,hasTransformAnim:d,hasDrag:f}),this.generateSensorColliderDescs(l,c.physics.fusedBody)):(g&&t.push(mo(g,o.matrixWorld)),c.physics.fusedBody&&!gm(o)&&o.traverseObject((y,v)=>{if(v===0)return;let b;if(oc(y))if(y.objectForSample){if(y.objectForSample.dataPatched.physics.fusedBody)return;b=y.object}else return y.object.dataPatched.physics.fusedBody===!0&&y.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else{if(xu(y)||io(y)||y instanceof al)return;if(Wo(y))b=y.object;else if(b=y,b.dataPatched.cloner?.hideBase)return!0}let x=b.dataPatched;if(x.physics.enabled==="visibility"?!x.visible:!x.physics.enabled)return!0;let S=y.geometry;if(S?.getAttribute("position")!==void 0&&t.push(mo(S,y.matrixWorld)),gm(y))return!0}),this.generateSensorColliderDescs(l,c.physics.fusedBody,e));if(c.physics?.fusedBody===!0||u||gm(o))return!0}),t.length===0)return;let n=ro(t),r=n.getIndex().count>0;if(!r&&e.length===0)return;n.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let s=un.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s);if(r){let o=un.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array).setFrictionCombineRule(un.CoefficientCombineRule.Multiply).setRestitutionCombineRule(un.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(o,a)}for(let[o,l]of e){let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,a);this.sensorToTriggerEvent[c.handle]=l}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let n=new ob(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),r=new ne().compose(go.fromArray(e.data.position.map(s=>typeof s=="number"?s:0)),mm.setFromEuler(W4.fromArray(e.data.rotation.map(s=>typeof s=="number"?s:0))),YI);if(e.data.triggerZone==="box"){let s=new Bt;s.min.fromArray(e.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(-.5),s.max.fromArray(e.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([s,r,t,n])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,r,t,n])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(!!this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let n=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let r=t/1e3;r<n&&r>n*.55&&(r=n),this.accumulator+=r;let s=performance.now(),a=0,o=6;for(;this.accumulator>=n&&a<o&&(e=this.stepPhysics()&&e,this.accumulator-=n,a++,!(performance.now()-s>n*1e3)););this.accumulator=this.accumulator%n}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(si,Oa,Lu);let e=t;e.prevQ===void 0?(e.prevQ=Oa.clone(),e.prevT=si.clone()):(e.prevQ.copy(Oa),e.prevT.copy(si))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,n,r]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(r)||(n.setBodyType(un.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(n.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,n=t.linvel(),r=t.translation(),s=Math.hypot(n.x,n.z);for(let a=0;a<t.numColliders();a++){let o=t.collider(a);e.contactPairsWith(o,l=>{let c=l.parent();if(c===null||!c.isDynamic())return;let u=c.translation(),d=-1/0,h=0,p=0;if(e.contactPair(o,l,v=>{let b=v.normal(),S=b.x*(u.x-r.x)+b.y*(u.y-r.y)+b.z*(u.z-r.z)<0?-1:1;if(Math.abs(b.y)>wne)return;let E=S*b.x,M=S*b.z,w=Math.hypot(E,M);if(w<1e-4)return;let T=(n.x*E+n.z*M)/w;T>d&&(d=T,h=E/w,p=M/w)}),d===-1/0)return;let f=n.x*h+n.z*p;if(f<-KI)return;let m=c.linvel();if(s>KI&&f>KI){let v=m.x*h+m.z*p;if(v<=0)return;let b=Math.min(v,f);c.setLinvel({x:h*b,y:m.y,z:p*b},!0);return}let g=m.x*h+m.z*p-Math.max(0,f);if(g<=0)return;let y=g*(1-Sne);c.setLinvel({x:m.x-h*y,y:m.y,z:m.z-p*y},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let e of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(e),e.rigidBody.setNextKinematicTranslation(si.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(Oa);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,n){let r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(n))._parent,s;if(e.cloner){for(let a of e.cloner.children)if(a.rigidBody===r){s=a;break}}t.dispatch(s),e.dispatchEvent($E)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,n){let r=q4.copy(t.matrixWorld).invert();t.traverseEntity((s,a)=>{if(e===!1&&a===1)return!0;for(let o of s.dataPatched.events)if(o.data.type==="Trigger"&&o.data.disabled!==!0){let l=new ob(o.id,o.data,s,this.page,this.sharedAssets,this.eventManager),c;if(o.data.triggerZone==="box"?c=un.ColliderDesc.cuboid(...o.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):c=un.ColliderDesc.ball(o.data.radius/this.pixelsPerMeter),c.setDensity(0).setSensor(!0).setActiveEvents(un.ActiveEvents.COLLISION_EVENTS),go.fromArray(o.data.position.map(u=>typeof u=="number"?u:0)),mm.setFromEuler(W4.fromArray(o.data.rotation.map(u=>typeof u=="number"?u:0))),XE.compose(go,mm,YI).premultiply(s.matrixWorld),n?(XE.decompose(go,mm,XI),c.setActiveCollisionTypes(un.ActiveCollisionTypes.KINEMATIC_FIXED|un.ActiveCollisionTypes.DYNAMIC_FIXED)):(XE.premultiply(r).decompose(go,mm,XI),t.rigidBody.bodyType()===un.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===un.RigidBodyType.Fixed?c.setActiveCollisionTypes(un.ActiveCollisionTypes.KINEMATIC_FIXED|un.ActiveCollisionTypes.DYNAMIC_FIXED):c.setActiveCollisionTypes(un.ActiveCollisionTypes.KINEMATIC_KINEMATIC|un.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),go.divideScalar(this.pixelsPerMeter),c.setTranslation(go.x,go.y,go.z),c.setRotation(mm),n)n.push([c,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(c,t.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[n,r,s,a]=this.sharedGameControlGlobals.triggers[e];for(let o=0;o<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;o++){let l=this.sharedGameControlGlobals.entitiesWithTransformAnim[o];if(s===l||a.isValidTriggeringObject(Dt.is(l)?l:l.object)===!1)continue;let c=q4.copy(s.matrixWorld).decompose(go,X4,XI).compose(go,X4,YI).multiply(r),u=XE.copy(l.matrixWorld).invert().multiply(c),d=l.bvhGeometry.boundsTree;n instanceof Bt?t=d.intersectsBox(n,u):($I.radius=n,$I.center.setFromMatrixPosition(u),t=d.intersectsSphere($I)),t?a.currentIntersectedObjects.indexOf(l)===-1&&(a.currentIntersectedObjects.push(l),a.dispatch(),s.dispatchEvent(Ene)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(h=>h!==l)}}}};eh();Y();pv();an();fc();var $4=4,ZI=8;var QI=.02,JI=.3,Mne=65,K4=new _,Z4=new _,_ne=new _,$i=new _,Sc=new _,ym=new _,eO=new ne,Q4=new ne,Tne=new ne,Qs=new qe,hh=new qe,vm=new Xt(0,0,0,"YXZ"),Ane=new _(1,0,0),dl=new _(0,1,0),Cne=new _(0,0,1),J4=new _(1,1,1),tO=[],ej=i=>tO[i]??(tO[i]=new _),nO=new _,Pne=new _,Ine=new _,One=new _,tj=new qe,Rne=new _,nj=new qe,Dne=1,Lne=.025,Nne=16e-6,rj=12,Bne=20,Oi=new ri,Ra=new Bt,Fne={type:"requestRender"},Une={type:"updateMatrix"},KE=class extends Tn{constructor(e,n,r,s,a,o,l,c,u){super();this.object=e;this.domElement=n;this.data=r;this.gloabalPhysics=s;this.controlsManager=a;this.cameraFollow=o;this.camera=l;this.page=c;this.sharedAssets=u;this.enableDamping=!0;this.hiddenMatrix0=new ne;this.target0=new _;this.zoom0=1;this.rotForce=1;this.moveForce=1;this.pixelsPerMeter=BE;this.euler0=new Xt(0,0,0,"YXZ");this.position0Cam=new _;this.quat0Cam=new qe;this.scale0Cam=new _;this.hiddenMatrix0Cam=new ne;this.threshEndTranslate=.01;this.threshEndRotate=1e-8;this.threshEndRotVel=.005;this.collider={type:"capsule",radius:40,segment:new ri(new _(0,-40,0),new _(0,40,0)),matrix:new ne,position:new _,rotation:new qe};this.euler=new Xt(0,0,0,"YXZ");this.eulerDelta=new _;this.lastPosition=new _;this.lastCameraQuaternion=new qe;this.lastCameraPosition=new _;this.PI_2=Math.PI/2;this.prevMouse=new j;this.velocityTarget=new _;this.velocity=new _;this.directionXZ=new _;this.rotVelocityStick=new _;this.rotVelocityTarget=new _;this.rotVelocity=new _;this.rotDirection=new _;this.nonColliderRotOffset=new ne;this.nonColliderPosOffset=new ne;this.firstPointerId=-1;this.rot=new _;this.path=[];this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0};this.onObject=!1;this.actionState={};this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]];this.collisionEnabled=!0;this.offsetMatrix=new ne;this.objectToTarget=new _;this.objectToTarget0=new _;this.objectToCamXZ=new _;this.objectToCamXZ0=new _;this.targetToCamera=new _;this.targetToCamera0=new _;this.cameraPolarAxis0=new _;this.targetPos=new _;this.targetQuat=new qe;this.lerpFactorPos=new _().setScalar(.3);this.lerpFactorPosStart=.3;this.lerpFactorPosEnd=.3;this.lerpFactorRotStart=.3;this.lerpFactorRotEnd=.3;this.lerpFactorPosCamera=.3;this.lerpFactorRotCamera=.3;this.objXZQuat=new qe;this.objXZQuatInv=new qe;this.objXZRotMat=new ne;this.isFirstPerson=!1;this.didHit=!1;this.groundVelocity=new _;this.pushedVelocity=new _;this.groundYRotation=0;this.objectRealQuat=new qe;this.colliderWorldQuat=new qe;this.groundNormal=new _;this.groundTilt=new qe;this.groundTiltInv=new qe;this.lastHitObj=null;this.isFirstFrame=!0;this.rotationAccumWhenOrientWithCamera=0;this.navMeshPathDest=null;this.position=new _;this.quaternion=new qe;this.scale=new _;this.initialAction=!0;this.onPointerDown=e=>{!(e.target===this.domElement||e.target instanceof HTMLElement&&e.target.tagName==="SPLINE-VIEWER"&&e.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!pi&&!eC&&this.domElement.requestPointerLock(),this.prevMouse.set(e.clientX,e.clientY))};this.onPointerUp=e=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),e.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()};this.onPointerMove=e=>{if(e.pointerId!==this.firstPointerId)return;let n=e.clientX-this.prevMouse.x,r=e.clientY-this.prevMouse.y;this.prevMouse.set(e.clientX,e.clientY),e.pointerType==="mouse"&&this.rotBy!=="keys"&&(eC&&n3<15.5&&!pi?(this.eulerDelta.y=-n*this.mouseOrbitSensitivity,this.eulerDelta.x=-r*this.mouseOrbitSensitivity):(this.eulerDelta.y=-e.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-e.movementY*this.mouseOrbitSensitivity)),e.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-n*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-r*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()};this.onPointerlockChange=e=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?KE.isLocked=!0:KE.isLocked=!1};this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")};this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0};this.onKeyDown=e=>{!(e.target instanceof HTMLInputElement)&&(e.code==="ArrowLeft"||e.code==="ArrowUp"||e.code==="ArrowRight"||e.code==="ArrowDown"||e.code==="Space")&&e.preventDefault();for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]){this.movementState[n[0]]=1;break}this.controlsManager.requestRender()};this.onKeyUp=e=>{for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]||e.code.slice(3,e.code.length).toUpperCase()===n[1]){this.movementState[n[0]]=0;break}};this.copyVRGamePadValues=(e,n)=>{for(let r=2;r<4;r++){let s=e.axes[r];n===0?r===2?this.movementState.movePosX=s:this.movementState.movePosZ=s:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,r===2?this.movementState.rotPosY=s:this.moveMode==="fly"&&(this.movementState.moveNegY=s))}};this.sharedGameControlGlobals=a.sharedGameControlGlobals,e===l&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let d=this.euler0.clone(),h=d.y;if(this.objectRealQuat.copy(this.quaternion),d.y=0,this.quaternion.setFromEuler(d),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),d.set(0,h,0),this.quaternion.setFromEuler(d),this.rot.setFromEuler(d),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let g=new _(0,0,-1).applyQuaternion(this.camera.quaternion),y=new _().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(y),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ);let v;Math.abs(g.y)<1e-6?(y.y=0,g.y=0,v=y.projectOnVector(g)):y.y/g.y>0?v=g.multiplyScalar(y.y/g.y):v=g.multiplyScalar(y.length()),this.targetToCamera0.copy(v).negate();let b=this.camera.position.clone().add(v);this.objectToTarget0.subVectors(b,this.position);let x=new Xt().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-x.x,x.x=0,x.z=0,x.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(x)}if(this.object instanceof on&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=r.rotByTouch??"joystick",this.rotBy=r.rotBy??"keys",this.rotationMode=r.rotationMode??"normal",this.moveMode=r.moveMode??"walk",this.collisionEnabled=r.collisionEnabled,this.speedTranslate=(r.speedTranslate??250)*Dne,this.speedOrbit=(r.speedRotate??100)*Lne,this.mouseOrbitSensitivity=(r.speedRotate??100)*Nne,this.keyAssignments=r.keyAssignments.map(g=>{let y=[g[0],g[1]];return y[1]==="\u25B2"?y[1]="ArrowUp":y[1]==="\u25C0"?y[1]="ArrowLeft":y[1]==="\u25BC"?y[1]="ArrowDown":y[1]==="\u25B6"?y[1]="ArrowRight":y[1]==="\u21E7"?y[1]="Shift":y[1]==="\u21B5"?y[1]="Enter":y[1]==="Space"?y[1]=" ":y[1]==="\u2318"?y[1]="Meta":y[1]==="Ctrl"?y[1]="Control":y[1]==="Esc"&&(y[1]="Escape"),y}),r.rotBy==="mouse"){let g;g=this.keyAssignments.findIndex(y=>y[0]==="rotNegX"),g!==-1&&(this.keyAssignments[g][1]=""),g=this.keyAssignments.findIndex(y=>y[0]==="rotPosX"),g!==-1&&(this.keyAssignments[g][1]=""),g=this.keyAssignments.findIndex(y=>y[0]==="rotPosY"),g!==-1&&(this.keyAssignments[g][1]=""),g=this.keyAssignments.findIndex(y=>y[0]==="rotNegY"),g!==-1&&(this.keyAssignments[g][1]="")}this.lerpFactorPosStart=1-.02**(1/((r.delayPos[0]??.3)*60)),this.lerpFactorPosEnd=1-.02**(1/((r.delayPos[1]??.3)*60)),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/((r.delayRot[0]??.3)*60)),this.lerpFactorRotEnd=1-.02**(1/((r.delayRot[1]??.3)*60)),this.lerpFactorPosCamera=1-.02**(1/((r.delayPosCamera??.3)*60)),this.lerpFactorRotCamera=1-.02**(1/((r.delayRotCamera??.3)*60)),this.gravity=(this.gloabalPhysics.gravity??yu.defaultData.gravity)*rj,this.usePhysics=this.gloabalPhysics.usePhysics??yu.defaultData.usePhysics,this.jumpPower=r.jumpPower*Bne,this.resetYPosition=this.position.y+Math.abs(r.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=r.alignToGround??!1,this.orientMode=r.autoOrientMove?r.orientMode:"none",this.orientWith=r.orientWith??uf.defaultDataThirdPerson.orientWith,this.slopeThresh=Mne*Math.PI/180,r.collider.type==="capsule"?(this.collider.radius=r.collider.radius,this.collider.segment.start.y=r.collider.height/2-r.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=r.collider.height*QI/this.pixelsPerMeter,this.stepThresh=r.collider.height*JI/this.pixelsPerMeter,this.colliderHeight=r.collider.height):r.collider.type==="sphere"?(this.collider.radius=r.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*r.collider.radius*QI/this.pixelsPerMeter,this.stepThresh=2*r.collider.radius*JI/this.pixelsPerMeter,this.colliderHeight=r.collider.radius*2):(this.offset=r.collider.height*QI/this.pixelsPerMeter,this.stepThresh=r.collider.height*JI/this.pixelsPerMeter,this.colliderHeight=r.collider.height),this.collider.type=r.collider.type;let p=new _().fromArray(r.collider.position.map(g=>typeof g=="number"?g:0)),f=new qe().setFromEuler(new Xt().fromArray([...r.collider.rotation.map(g=>typeof g=="number"?g:0),"XYZ"]));this.collider.position.copy(p).multiply(this.scale),this.collider.rotation.copy(f),this.collider.matrix.compose(p,f,J4),r.cameraXAxis!==void 0&&(this.cameraXAxis=r.cameraXAxis,this.cameraYAxis=r.cameraYAxis,this.minPolarAngle=r.cameraRotXLimits[0],this.maxPolarAngle=r.cameraRotXLimits[1],this.minAzimuthAngleRel=r.cameraRotYLimits[0],this.maxAzimuthAngleRel=r.cameraRotYLimits[1]),this.forwardDir=r.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=r.runMultiplier??2;let m=r.navmesh.destinationHelperRadius*2;if(m>0){let g=new ze;g.push({fi:0,data:{...Qn.defaultData("light","phong"),alpha:0},id:"layer1"}),g.push({fi:0,data:{...Qn.defaultData("color"),color:r.navmesh.destinationHelperColor,alpha:r.navmesh.destinationHelperColor.a},id:"layer2"});let y=Aw({layers:g},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Ht(ow.create({parameters:{width:m,height:m/10,hollow:.7}}),y),this.navMeshPathDest.material.userData.opacity0=r.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let n=new Xt().setFromQuaternion(this.quaternion,"YXZ"),r=n.y;this.objectRealQuat.copy(this.quaternion),n.y=0,this.quaternion.setFromEuler(n),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),n.set(0,r,0),this.quaternion.setFromEuler(n),this.rot.setFromEuler(n),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof on?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,n=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},cf.list.forEach(r=>{this.actions[r]=cn({...e,disabled:!1,type:"GameControl"},e.gameActions[r],this.page,n,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),Nn(this.actions.idle),Nn(this.actions.move),Nn(this.actions.run),Nn(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(n=>{n.play()}),this.actions[e].Animation.forEach(n=>{n.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(n=>{n.play()}),this.actions[e].Create.forEach(n=>{n.dispatchStart()}),this.actions[e].Audio.forEach(n=>{n.dispatchGameControl("start")}),this.actions[e].Particles.forEach(n=>{n.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(n=>{n.stop(),n.object.currentState!==null&&n.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(n=>{n.stop()}),this.actions[e].Create.forEach(n=>{n.dispatchStop()}),this.actions[e].Audio.forEach(n=>{n.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(n=>{n.dispatchGameControl("stop")})))}get colliderWorldPosition(){return $i.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let n=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let r=n*60,s=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let o=Sc.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*rj),1)*(this.gravity>0?1:-1):this.velocity.y)*n,0).divideScalar(this.pixelsPerMeter),l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,o,this.object.rigidBody?.collider(0).shape,0,1,!1,ZI,void 0,void 0,this.object.rigidBody);if(l){this.onObject=!0,this.groundNormal.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(s=!0),l.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let c=l.collider.parent(),u=c!==null&&c.isKinematic()?c:null,d=u===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(u.handle);if(u!==null&&d?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition($i).add(this.collider.position).divideScalar(this.pixelsPerMeter),p=u.velocityAtPoint(h);this.groundVelocity.set(p.x,p.y,p.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=u.angvel().y*n}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*r),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let o=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let l=$i.subVectors(this.path[1],this.position),c=Sc.subVectors(this.path[1],this.path[0]);l.dot(c)<0?this.path.shift():(this.directionXZ.x=c.x,this.directionXZ.z=c.z),o.opacity=o.userData.opacity0}else o.opacity-=.05*o.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**r),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**r),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**r)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let a=_ne.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let o=Sc.copy(a);o.y=0,a.set(0,a.y,o.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let o=$i;this.camera.getWorldDirection(o);let l=ym.copy(dl).multiplyScalar(o.dot(dl));o.sub(l);let c=Sc.copy(this.directionXZ);c.x*=-1,this.rot.y=o.angleTo(c)*(o.cross(c).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(vm.setFromVector3(this.rot),this.moveMode==="walk"&&(vm.x=0),a.applyEuler(vm),s&&(hh.setFromUnitVectors(dl,this.groundNormal),a.applyQuaternion(hh)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let o=0;for(let l of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(l.rigidBody===void 0||l.prevQ===void 0)continue;(l.hasNonUniformScale?l.matrixWorldRigid:l.matrixWorld).decompose(nO,tj,Pne);let c=this.object.getWorldPosition(Ine).add(this.collider.position).sub(nO);nj.copy(l.prevQ).invert().premultiply(tj);let u=ym.subVectors(nO,l.prevT).add(One.copy(c).applyQuaternion(nj).sub(c)).divideScalar(n).divideScalar(this.pixelsPerMeter),d=l.rigidBody.collider(0).castCollider(u,this.object.rigidBody.collider(0),$i.copy(a).divideScalar(this.pixelsPerMeter),0,n,!1);u.multiplyScalar(this.pixelsPerMeter);let h=Dt.is(l)?l:l.object;if(d!==null&&this.lastHitObj!==h){let p;l instanceof Yr&&(p=l);let f=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(f)for(let m of f)m.data.target==="character"&&(m.dispatch(p),h.dispatchEvent($E));this.lastHitObj=h}d!==null&&(Math.abs(u.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=u.x),Math.abs(u.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=u.y),Math.abs(u.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=u.z),ej(o++).copy(d.normal1).applyQuaternion(l.quaternion))}if(o>0){for(let l=0;l<o;l++){let c=ej(l),u=c.dot(a);u<0&&a.addScaledVector(c,-u)}a.add(this.pushedVelocity)}else a.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(n),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**r):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**r),this.euler.x+=this.rotVelocity.x*n,this.euler.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*n),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(dl,this.euler.y-this.euler0.y);let o=Sc.copy(this.objectToCamXZ).normalize(),l=ym.copy(a).multiplyScalar(n);l.y=0;let c=l.sub($i.copy(o).multiplyScalar(l.dot(o))).cross(o).y;this.euler.y-=Math.atan2(c,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=we.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=we.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=we.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(vm.copy(this.euler),vm.y=0,this.nonColliderRotOffset.makeRotationFromEuler(vm)),Qs.setFromAxisAngle(Ane,this.rot.x),hh.setFromAxisAngle(dl,this.rot.y),hh.multiply(Qs),Qs.setFromAxisAngle(Cne,this.rot.z),hh.multiply(Qs),this.quaternion.copy(hh),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let o=Sc.copy(a).multiplyScalar(n/this.pixelsPerMeter),l=null;this.didHit=!1;let c=new _;for(let h=0;h<5;h++){let p=o.length(),f=ym.copy(o).normalize();if(l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),this.colliderWorldQuat,f,this.object.rigidBody.collider(0).shape,0,p,!1,ZI|$4,void 0,void 0,this.object.rigidBody),l!==null){this.didHit=!0;let m=this.sharedGameControlGlobals.colliderToEntity.get(l.collider.handle);if(m!==this.lastHitObj&&h===0){this.lastHitObj=m;let b=this.sharedGameControlGlobals.entityToCollisionEvents[m?.uuid];if(b){for(let x of b)if(x.data.target==="character"){let S=(this.sharedGameControlGlobals.rapierWorld?.getCollider(l.collider.handle))._parent,E;if(m.cloner){for(let M of m.cloner.children)if(M.rigidBody===S){E=M;break}}x.dispatch(E),m.dispatchEvent($E)}}}let g=K4.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat),y=Z4.copy(f).multiplyScalar(l.time_of_impact).dot(g),v=l.time_of_impact;if(v===0&&(this.position.y+=this.offset*this.pixelsPerMeter),y>this.offset&&(v=l.time_of_impact*(y-this.offset)/y,c.addScaledVector(f,v)),o.copy(f).multiplyScalar(p-v),Math.acos(-g.y)>this.slopeThresh){let b=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),x=ym.copy(l.witness2).applyQuaternion(this.colliderWorldQuat);x.y=0;let S=b.add(x);S.y+=this.stepThresh;let E=this.sharedGameControlGlobals.rapierWorld.castShape(S,this.colliderWorldQuat,o,this.object.rigidBody?.collider(0).shape,0,1,!1,ZI|$4,void 0,void 0,this.object.rigidBody);E!==null&&E.time_of_impact===0&&(g.y=0,g.normalize())}o.addScaledVector(g,-o.dot(g))}else{h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),c.add(o);break}}this.position.addScaledVector(c,this.pixelsPerMeter),$i.copy(this.position).divideScalar(this.pixelsPerMeter),Qs.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let u=this.object.rigidBody,d=u!==void 0&&Rne.copy($i).sub(u.translation()).lengthSq()>1;u!==void 0&&(d?(u.setTranslation($i,!0),u.setRotation(Qs,!0)):(u.setNextKinematicTranslation($i),u.setNextKinematicRotation(Qs)))}else{let o=this.onObject?1:5,l=a.multiplyScalar(n/o);for(let c=0;c<o;c++)this.position.add(l),this.collisionAdjustment(n/o)}else this.position.addScaledVector(a,n);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let o=this.objectToTarget.add(this.position),l=this.targetToCamera.add(o);eO.lookAt(l,o,dl).setPosition(l),eO.decompose(this.targetPos,this.targetQuat,$i),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**r),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**r),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=we.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=we.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(Une),this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)?!1:(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(Fne),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Qs.setFromAxisAngle(dl,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?we.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e);let n;this.cameraXAxis==="Limit"?n=we.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):n=we.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let r=$i.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&r.applyQuaternion(e);let s=hh.setFromAxisAngle(r,n);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(s)}groundTiltAdjustment(e){dl.angleTo(e)*180/Math.PI<15||dl.angleTo(e)*180/Math.PI>85?Qs.identity():Qs.setFromUnitVectors(dl,e),this.groundTilt.slerp(Qs,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let n=Z4.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let r=eO.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose($i,Qs,Sc).compose($i,Qs,J4);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(a=>{if(a===this.object||a.isDescendantOf(this.object)||!a.bvhGeometry||!a.bvhGeometry.boundsTree)return;Ra.makeEmpty(),a.updateMatrixWorldRigid();let o=a.matrixWorldRigid,l=Q4.copy(o).invert(),c=Tne.copy(Q4).multiply(r);Oi.copy(this.collider.segment),Oi.start.applyMatrix4(c),Oi.end.applyMatrix4(c);let u=K4.copy(this.position).applyMatrix4(l);Ra.expandByPoint(Oi.start),Ra.expandByPoint(Oi.end),Ra.min.addScalar(-this.collider.radius),Ra.max.addScalar(this.collider.radius),a.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder(d){return d.distanceToPoint(Oi.end)},intersectsBounds:d=>d.intersectsBox(Ra),intersectsTriangle:d=>{let h=$i,p=Sc,f=d.closestPointToSegment(Oi,h,p);if(f<this.collider.radius){let m=this.collider.radius-f,g=p.sub(h).normalize(),y=ym.copy(u);y.addScaledVector(g,m);let v=y.applyMatrix4(o).sub(this.position);n.add(v),Oi.start.addScaledVector(g,m),Oi.end.addScaledVector(g,m)}}})}),Ra.makeEmpty(),Oi.copy(this.collider.segment),Oi.start.applyMatrix4(r),Oi.end.applyMatrix4(r),Ra.expandByPoint(Oi.start),Ra.expandByPoint(Oi.end),Ra.min.addScalar(-this.collider.radius),Ra.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder(a){return a.distanceToPoint(Oi.end)},intersectsBounds:a=>a.intersectsBox(Ra),intersectsTriangle:a=>{let o=$i,l=Sc,c=a.closestPointToSegment(Oi,o,l);if(c<this.collider.radius){let u=this.collider.radius-c,d=l.sub(o).normalize();this.alignToGround&&this.groundTiltAdjustment(d),n.addScaledVector(d,u),Oi.start.addScaledVector(d,u),Oi.end.addScaledVector(d,u)}}}),this.onObject=Math.abs(n.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let s=Math.max(0,n.length()-1e-5);n.normalize().multiplyScalar(s),this.position.add(n)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},cb=KE;cb.isLocked=!1;Y();mf();eh();Jd();var ij,sj=new Promise(i=>{ij=i});var rO,ZE;function aj(i){if(ZE)return ZE;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.11/build");typeof window<"u"&&(rO=new URL(n.endsWith("/")?n:`${n}/`,window.location.href).href);let s=import("./navmesh.js"),[a,o]=await Promise.all([s,fetch(`${n}/navmesh.wasm`).then(u=>u.arrayBuffer())]),l=a.default,c=await l({wasmBinary:o});ij(c)}return ZE=t(),ZE}hn();var kne=!1?typeof window<"u"?window.location.href:"":"https://cdn.spline.design/@splinetool/runtime@2.0.11/build/",Vne=i=>`
9805
+ `)>=0&&(t-=s),n===3?e*.5-t*.5:n===2?e-t:0}getLineInitialOffsetY(t,e,n,r,s){let a=e*t,o=Math.abs(this.ascender-this.descender)*r,l=t-o,c=-this.ascender*r-l/2;return s===3?-(n-a-c):s===2?-(n*.5-a*.5-c):c}createPath(t,e,n,r,s){let a=t.getPath(n,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!a){console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");return}let o=new DE,l=(t.advanceWidth??1)*e;if(t)for(let c of a.commands){let u=o.currentPath?.currentPoint;if(!(u&&c.type!=="Z"&&u.x===c.x&&-u.y===c.y))switch(c.type){case"M":o.moveTo(c.x,-c.y);break;case"L":o.lineTo(c.x,-c.y);break;case"Q":o.quadraticCurveTo(c.x1,-c.y1,c.x,-c.y);break;case"C":o.bezierCurveTo(c.x1,-c.y1,c.x2,-c.y2,c.x,-c.y);break}}return o.subPaths.forEach(c=>{let u=yne(c.curves);u!==void 0&&c.currentPoint.distanceTo(u)>0&&c.lineTo(u.x,u.y)}),{offsetX:l,path:o}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}computeSpaceWidthForLine(t,e,n,r){let s=this.getCharWidth(" ",n),a=t[e];if(a){let o=this.countSpaces(a.trimEnd());if(n.horizontalAlign===4&&e<t.length-1&&o){let l=typeof n.width=="string"?Number(r.getVariable(n.width)):n.width,c=this.getTextWidth(a,n);return(l-(c-o*s))/o}}return s}countSpaces(t){return(t.match(/ /g)||[]).length}};function yne(i){if(i.length){let t=i[0];if(t instanceof Ai)return t.v1;if(t instanceof Bi||t instanceof xs)return t.v0}}aw();Qt();Sa("TextGeometry",(i,t,e)=>new Pu(i,t,e));var x4={create:(i,t)=>new zf(i,t)};ev("TextGeometry",x4);ev("InputGeometry",x4);Sk(NE);_t("text");ft();var BE=200,S4=null;function w4(i){S4=i}function HI(){return S4}function E4(i){let t=!1;return i.scene.objects.forEach(e=>{e.data.type==="Page"&&!t&&e.data.publish.gameControlObject&&Uo.traverseModuleInstances(i,e.id,(r,s,a)=>{for(let o of a)o.data.type==="GameControl"&&o.data.navmesh.enabled&&(t=!0)})}),t}hn();var rb=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return Math.sqrt(e*e+n*n)},M4=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return vne(Math.atan2(n,e))},_4=(i,t,e)=>{let n={x:0,y:0};return e=UE(e),n.x=i.x-t*Math.cos(e),n.y=i.y-t*Math.sin(e),n},UE=i=>i*(Math.PI/180),vne=i=>i*(180/Math.PI),T4=i=>isNaN(i.buttons)?i.pressure!==0:i.buttons!==0,FE=new Map,A4=i=>{FE.has(i)&&clearTimeout(FE.get(i)),FE.set(i,setTimeout(function(){FE.delete(i),i()},100))},um=(i,t,e)=>{let n=t.split(/[ ,]+/g),r;for(let s=0;s<n.length;s+=1)r=n[s],i.addEventListener?i.addEventListener(r,e,!1):i.attachEvent&&i.attachEvent(r,e)},dm=(i,t,e)=>{let n=t.split(/[ ,]+/g),r;for(let s=0;s<n.length;s+=1)r=n[s],i.removeEventListener?i.removeEventListener(r,e):i.detachEvent&&i.detachEvent(r,e)};var kE=i=>(i.preventDefault(),i.type.match(/^touch/)?i.changedTouches:i),WI=()=>{if(typeof window>"u")return;let i=window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,t=window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;return{x:i,y:t}},VE=(i,t)=>{t.top||t.right||t.bottom||t.left?(i.style.top=t.top,i.style.right=t.right,i.style.bottom=t.bottom,i.style.left=t.left):(i.style.left=t.x+"px",i.style.top=t.y+"px")},zE=(i,t,e)=>{let n=P4(i);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof t=="string")n[r]=t+" "+e;else{let s="";for(let a=0,o=t.length;a<o;a+=1)s+=t[a]+" "+e+", ";n[r]=s.slice(0,-2)}return n},C4=(i,t)=>{let e=P4(i);for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t);return e},P4=i=>{let t={};return t[i]="",["webkit","Moz","o"].forEach(function(n){t[n+i.charAt(0).toUpperCase()+i.slice(1)]=""}),t},GE=(i,t)=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e]);return i},I4=(i,t)=>{let e={};for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&Object.prototype.hasOwnProperty.call(t,n)?e[n]=t[n]:Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);return e},ib=(i,t)=>{if(i.length)for(let e=0,n=i.length;e<n;e+=1)t(i[e]);else t(i)},O4=(i,t,e)=>({x:Math.min(Math.max(i.x,t.x-e),t.x+e),y:Math.min(Math.max(i.y,t.y-e),t.y+e)});typeof window<"u"&&(R4="ontouchstart"in window,D4=!!window.PointerEvent,L4=!!window.MSPointerEvent);var R4,D4,L4,sb={touch:{start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},pointer:{start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"},MSPointer:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},hm,ab={};D4?hm=sb.pointer:L4?hm=sb.MSPointer:R4?(hm=sb.touch,ab=sb.mouse):hm=sb.mouse;function dh(){}dh.prototype.on=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]=e._handlers_[r]||[],e._handlers_[r].push(t);return e};dh.prototype.off=function(i,t){var e=this;return e._handlers_=e._handlers_||{},i===void 0?e._handlers_={}:t===void 0?e._handlers_[i]=null:e._handlers_[i]&&e._handlers_[i].indexOf(t)>=0&&e._handlers_[i].splice(e._handlers_[i].indexOf(t),1),e};dh.prototype.trigger=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]&&e._handlers_[r].length&&e._handlers_[r].forEach(function(a){a.call(e,{type:r,target:e},t)})};dh.prototype.config=function(i){var t=this;t.options=t.defaults||{},i&&(t.options=I4(t.options,i))};dh.prototype.bindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},e._domHandlers_[t]=function(){typeof e["on"+t]=="function"?e["on"+t].apply(e,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},um(i,hm[t],e._domHandlers_[t]),ab[t]&&um(i,ab[t],e._domHandlers_[t]),e};dh.prototype.unbindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},dm(i,hm[t],e._domHandlers_[t]),ab[t]&&dm(i,ab[t],e._domHandlers_[t]),delete e._domHandlers_[t],this};var pm=dh;function bi(i,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=i,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=bi.id,bi.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}bi.prototype=new pm;bi.constructor=bi;bi.id=0;bi.prototype.buildEl=function(i){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)};bi.prototype.stylize=function(){if(this.options.dataOnly)return this;var i=this.options.fadeTime+"ms",t=C4("borderRadius","50%"),e=zE("transition","opacity",i),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},GE(n.el,e),this.options.shape==="circle"&&GE(n.back,t),GE(n.front,t),this.applyStyles(n),this};bi.prototype.applyStyles=function(i){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var e in i[t])this.ui[t].style[e]=i[t][e];return this};bi.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};bi.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};bi.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null};bi.prototype.show=function(i){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof i=="function"&&i.call(this)},t.options.fadeTime)),t};bi.prototype.hide=function(i){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var e=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=e,typeof i=="function"&&i.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let e=t.options.restJoystick,n={};n.x=e===!0||e.x!==!1?0:t.instance.frontPosition.x,n.y=e===!0||e.y!==!1?0:t.instance.frontPosition.y,t.setPosition(i,n)}return t};bi.prototype.setPosition=function(i,t){var e=this;e.frontPosition={x:t.x,y:t.y};var n=e.options.fadeTime+"ms",r={};r.front=zE("transition",["top","left"],n);var s={front:{}};s.front={left:e.frontPosition.x+"px",top:e.frontPosition.y+"px"},e.applyStyles(r),e.applyStyles(s),e.restTimeout=setTimeout(function(){typeof i=="function"&&i.call(e),e.restCallback()},e.options.fadeTime)};bi.prototype.restCallback=function(){var i=this,t={};t.front=zE("transition","none",""),i.applyStyles(t),i.trigger("rested",i.instance)};bi.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};bi.prototype.computeDirection=function(i){var t=i.angle.radian,e=Math.PI/4,n=Math.PI/2,r,s,a;if(t>e&&t<e*3&&!i.lockX?r="up":t>-e&&t<=e&&!i.lockY?r="left":t>-e*3&&t<=-e&&!i.lockX?r="down":i.lockY||(r="right"),i.lockY||(t>-n&&t<n?s="left":s="right"),i.lockX||(t>0?a="up":a="down"),i.force>this.options.threshold){var o={},l;for(l in this.direction)Object.prototype.hasOwnProperty.call(this.direction,l)&&(o[l]=this.direction[l]);var c={};this.direction={x:s,y:a,angle:r},i.direction=this.direction;for(l in o)o[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return i;(!c.x||!c.y)&&this.trigger("plain",i),c.x||this.trigger("plain:"+s,i),c.y||this.trigger("plain:"+a,i),c.angle||this.trigger("dir dir:"+r,i)}else this.resetDirection();return i};var N4=bi;function Kr(i,t){var e=this;e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.pressureIntervals={},e.manager=i,e.id=Kr.id,Kr.id+=1,e.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},e.config(t),(e.options.mode==="static"||e.options.mode==="semi")&&(e.options.multitouch=!1),e.options.multitouch||(e.options.maxNumberOfNipples=1);let n=getComputedStyle(e.options.zone.parentElement);return n&&n.display==="flex"&&(e.parentIsFlex=!0),e.updateBox(),e.prepareNipples(),e.bindings(),e.begin(),e.nipples}Kr.prototype=new pm;Kr.constructor=Kr;Kr.id=0;Kr.prototype.prepareNipples=function(){var i=this,t=i.nipples;t.on=i.on.bind(i),t.off=i.off.bind(i),t.options=i.options,t.destroy=i.destroy.bind(i),t.ids=i.ids,t.id=i.id,t.processOnMove=i.processOnMove.bind(i),t.processOnEnd=i.processOnEnd.bind(i),t.get=function(e){if(e===void 0)return t[0];for(var n=0,r=t.length;n<r;n+=1)if(t[n].identifier===e)return t[n];return!1}};Kr.prototype.bindings=function(){var i=this;i.bindEvt(i.options.zone,"start"),i.options.zone.style.touchAction="none",i.options.zone.style.msTouchAction="none"};Kr.prototype.begin=function(){var i=this,t=i.options;if(t.mode==="static"){var e=i.createNipple(t.position,i.manager.getIdentifier());e.add(),i.idles.push(e)}};Kr.prototype.createNipple=function(i,t){var e=this,n=e.manager.scroll,r={},s=e.options,a={x:e.parentIsFlex?n.x:n.x+e.box.left,y:e.parentIsFlex?n.y:n.y+e.box.top};if(i.x&&i.y)r={x:i.x-a.x,y:i.y-a.y};else if(i.top||i.right||i.bottom||i.left){var o=document.createElement("DIV");o.style.display="hidden",o.style.top=i.top,o.style.right=i.right,o.style.bottom=i.bottom,o.style.left=i.left,o.style.position="absolute",s.zone.appendChild(o);var l=o.getBoundingClientRect();s.zone.removeChild(o),r=i,i={x:l.left+n.x,y:l.top+n.y}}var c=new N4(e,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:t,position:i,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(VE(c.ui.el,r),VE(c.ui.front,c.frontPosition)),e.nipples.push(c),e.trigger("added "+c.identifier+":added",c),e.manager.trigger("added "+c.identifier+":added",c),e.bindNipple(c),c};Kr.prototype.updateBox=function(){var i=this;i.box=i.options.zone.getBoundingClientRect()};Kr.prototype.bindNipple=function(i){var t=this,e,n=function(r,s){e=r.type+" "+s.id+":"+r.type,t.trigger(e,s)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",n),i.on("dir:up dir:right dir:down dir:left",n),i.on("plain:up plain:right plain:down plain:left",n)};Kr.prototype.pressureFn=function(i,t,e){var n=this,r=0;clearInterval(n.pressureIntervals[e]),n.pressureIntervals[e]=setInterval(function(){var s=i.force||i.pressure||i.webkitForce||0;s!==r&&(t.trigger("pressure",s),n.trigger("pressure "+t.identifier+":pressure",s),r=s)}.bind(n),100)};Kr.prototype.onstart=function(i){var t=this,e=t.options,n=i;i=kE(i),t.updateBox();var r=function(s){t.actives.length<e.maxNumberOfNipples?t.processOnStart(s):n.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(a){if(Object.values(n.touches).findIndex(function(l){return l.identifier===a})<0){var o=[i[0]];o.identifier=a,t.processOnEnd(o)}}),t.actives.length<e.maxNumberOfNipples&&t.processOnStart(s))};return ib(i,r),t.manager.bindDocument(),!1};Kr.prototype.processOnStart=function(i){var t=this,e=t.options,n,r=t.manager.getIdentifier(i),s=i.force||i.pressure||i.webkitForce||0,a={x:i.pageX,y:i.pageY},o=t.getOrCreate(r,a);o.identifier!==r&&t.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(u){u.trigger("start",u),t.trigger("start "+u.id+":start",u),u.show(),s>0&&t.pressureFn(i,u,u.identifier),t.processOnMove(i)};if((n=t.idles.indexOf(o))>=0&&t.idles.splice(n,1),t.actives.push(o),t.ids.push(o.identifier),e.mode!=="semi")l(o);else{var c=rb(a,o.position);if(c<=e.catchDistance)l(o);else{o.destroy(),t.processOnStart(i);return}}return o};Kr.prototype.getOrCreate=function(i,t){var e=this,n=e.options,r;return/(semi|static)/.test(n.mode)?(r=e.idles[0],r?(e.idles.splice(0,1),r):n.mode==="semi"?e.createNipple(t,i):(console.warn("Coudln't find the needed nipple."),!1)):(r=e.createNipple(t,i),r)};Kr.prototype.processOnMove=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.scroll;if(!T4(i)){this.processOnEnd(i);return}if(!r){console.error("Found zombie joystick with ID "+n),t.manager.removeIdentifier(n);return}if(e.dynamicPage){var a=r.el.getBoundingClientRect();r.position={x:s.x+a.left,y:s.y+a.top}}r.identifier=n;var o=r.options.size/2,l={x:i.pageX,y:i.pageY};e.lockX&&(l.y=r.position.y),e.lockY&&(l.x=r.position.x);var c=rb(l,r.position),u=M4(l,r.position),d=UE(u),h=c/o,p={distance:c,position:l},f,m;if(r.options.shape==="circle"?(f=Math.min(c,o),m=_4(r.position,f,u)):(m=O4(l,r.position,o),f=rb(m,r.position)),e.follow){if(c>o){let b=l.x-m.x,x=l.y-m.y;r.position.x+=b,r.position.y+=x,r.el.style.top=r.position.y-(t.box.top+s.y)+"px",r.el.style.left=r.position.x-(t.box.left+s.x)+"px",c=rb(l,r.position)}}else l=m,c=f;var g=l.x-r.position.x,y=l.y-r.position.y;r.frontPosition={x:g,y},e.dataOnly||VE(r.ui.front,r.frontPosition);var v={identifier:r.identifier,position:l,force:h,pressure:i.force||i.pressure||i.webkitForce||0,distance:c,angle:{radian:d,degree:u},vector:{x:g/o,y:-y/o},raw:p,instance:r,lockX:e.lockX,lockY:e.lockY};v=r.computeDirection(v),v.angle={radian:UE(180-u),degree:180-u},r.trigger("move",v),t.trigger("move "+r.id+":move",v)};Kr.prototype.processOnEnd=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.removeIdentifier(r.identifier);!r||(e.dataOnly||r.hide(function(){e.mode==="dynamic"&&(r.trigger("removed",r),t.trigger("removed "+r.id+":removed",r),t.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(t.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),t.trigger("end "+r.id+":end",r),t.ids.indexOf(r.identifier)>=0&&t.ids.splice(t.ids.indexOf(r.identifier),1),t.actives.indexOf(r)>=0&&t.actives.splice(t.actives.indexOf(r),1),/(semi|static)/.test(e.mode)?t.idles.push(r):t.nipples.indexOf(r)>=0&&t.nipples.splice(t.nipples.indexOf(r),1),t.manager.unbindDocument(),/(semi|static)/.test(e.mode)&&(t.manager.ids[s.id]=s.identifier))};Kr.prototype.onDestroyed=function(i,t){var e=this;e.nipples.indexOf(t)>=0&&e.nipples.splice(e.nipples.indexOf(t),1),e.actives.indexOf(t)>=0&&e.actives.splice(e.actives.indexOf(t),1),e.idles.indexOf(t)>=0&&e.idles.splice(e.idles.indexOf(t),1),e.ids.indexOf(t.identifier)>=0&&e.ids.splice(e.ids.indexOf(t.identifier),1),e.manager.removeIdentifier(t.identifier),e.manager.unbindDocument()};Kr.prototype.destroy=function(){var i=this;i.unbindEvt(i.options.zone,"start"),i.nipples.forEach(function(e){e.destroy()});for(var t in i.pressureIntervals)Object.prototype.hasOwnProperty.call(i.pressureIntervals,t)&&clearInterval(i.pressureIntervals[t]);i.trigger("destroyed",i.nipples),i.manager.unbindDocument(),i.off(),i.pressureIntervals={},i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.manager=null};var B4=Kr;function ii(i){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=WI(),t._windowBound=!1,t.config(i),t.prepareCollections();var e=function(){var n;t.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:t.scroll.x+n.left,y:t.scroll.y+n.top}})})};return t._onResize=function(){A4(e)},t._onScroll=function(){t.scroll=WI()},t.collections}ii.prototype=new pm;ii.constructor=ii;ii.prototype.prepareCollections=function(){var i=this;i.collections.create=i.create.bind(i),i.collections.on=i.on.bind(i),i.collections.off=i.off.bind(i),i.collections.destroy=i.destroy.bind(i),i.collections.get=function(t){var e;return i.collections.every(function(n){return e=n.get(t),!e}),e}};ii.prototype.create=function(i){return this.createCollection(i)};ii.prototype.bindWindowEvents=function(){var i=this;i._windowBound||typeof window>"u"||(i._windowBound=!0,um(window,"resize",i._onResize),um(window,"scroll",i._onScroll))};ii.prototype.unbindWindowEvents=function(){var i=this;!i._windowBound||typeof window>"u"||(i._windowBound=!1,dm(window,"resize",i._onResize),dm(window,"scroll",i._onScroll))};ii.prototype.createCollection=function(i){var t=this,e=new B4(t,i);return t.bindCollection(e),t.collections.push(e),t.bindWindowEvents(),e};ii.prototype.bindCollection=function(i){var t=this,e,n=function(r,s){e=r.type+" "+s.id+":"+r.type,t.trigger(e,s)};i.on("destroyed",t.onDestroyed.bind(t)),i.on("shown hidden rested dir plain",n),i.on("dir:up dir:right dir:down dir:left",n),i.on("plain:up plain:right plain:down plain:left",n)};ii.prototype.bindDocument=function(){var i=this;i.binded||(i.bindEvt(document,"move").bindEvt(document,"end"),i.binded=!0)};ii.prototype.unbindDocument=function(i){var t=this;(!Object.keys(t.ids).length||i===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};ii.prototype.getIdentifier=function(i){var t;return i?(t=i.identifier===void 0?i.pointerId:i.identifier,t===void 0&&(t=this.latest||0)):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]};ii.prototype.removeIdentifier=function(i){var t={};for(var e in this.ids)if(this.ids[e]===i){t.id=e,t.identifier=this.ids[e],delete this.ids[e];break}return t};ii.prototype.onmove=function(i){var t=this;return t.onAny("move",i),!1};ii.prototype.onend=function(i){var t=this;return t.onAny("end",i),!1};ii.prototype.oncancel=function(i){var t=this;return t.onAny("end",i),!1};ii.prototype.onAny=function(i,t){var e=this,n,r="processOn"+i.charAt(0).toUpperCase()+i.slice(1);t=kE(t);var s=function(o,l,c){c.ids.indexOf(l)>=0&&(c[r](o),o._found_=!0)},a=function(o){n=e.getIdentifier(o),ib(e.collections,s.bind(null,o,n)),o._found_||e.removeIdentifier(n)};return ib(t,a),!1};ii.prototype.destroy=function(){var i=this;i.unbindDocument(!0),i.unbindWindowEvents(),i.ids={},i.index=0,i.collections.forEach(function(t){t.destroy()}),i.collections=[],i.off()};ii.prototype.onDestroyed=function(i,t){var e=this;if(e.collections.indexOf(t)<0)return!1;e.collections.splice(e.collections.indexOf(t),1),e.collections.length===0&&e.unbindWindowEvents()};var F4=ii;var fm=null;function U4(){return fm||(fm=new F4),fm}var bne={create:function(i){return U4().create(i)},destroy:function(){fm&&(fm.destroy(),fm=null)},get factory(){return U4()}},k4=bne;hn();ft();Y();$s();Yi();ft();var V4=null;function z4(i){V4=i}function HE(){return V4}var G4,j4=new Promise(i=>{G4=i});var WE;function H4(i){if(WE)return WE;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.13/build"),s=import("./physics.js"),[a,o]=await Promise.all([s,fetch(`${n}/physics.wasm`).then(l=>l.arrayBuffer())]);await a.init(o),G4(a)}return WE=t(),WE}fr();Yi();Qt();aE();Y();Y();Jd();function qI(i){let t=i.elements,e=t[0]**2+t[1]**2+t[2]**2,n=t[4]**2+t[5]**2+t[6]**2,r=t[8]**2+t[9]**2+t[10]**2,s=t[0]**2+t[4]**2+t[8]**2,a=t[1]**2+t[5]**2+t[9]**2,o=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return e<l||n<l||r<l||s<l||a<l||o<l}function mo(i,t){let e=new De;if(t&&qI(t))return e.setAttribute("position",new Ve([],3)),e.setIndex([]),e;if(!i.getAttribute("position"))return e.setAttribute("position",new Ve([],3)),e.setIndex([]),e;let{positions:n,triIndices:r}=Av(i.getAttribute("position"),i.getIndex());return e.setAttribute("position",new Ve(n,3)),e.setIndex(r),t&&e.applyMatrix4(t),e}mf();var qE=class{constructor(t,e,n,r,s,a){this.id=t;this.data=e;this.object=n;this.initialDisabled=!1;this.actions=cn(e,e.actions,r,s,a,n),this.target=e.target}disconnect(){Nn(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}};var ob=class{constructor(t,e,n,r,s,a){this.id=t;this.data=e;this.object=n;this.page=r;this.currentIntersectedObjects=[];this.actions=cn(e,e.actions,r,s,a,n),this.target=e.target,this.triggeringObjects=[];for(let o of e.triggeringObjects){let l=r.scene.find(o);l&&this.triggeringObjects.push(l)}}isValidTriggeringObject(t){return this.target==="all"?!0:this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){Nn(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};fr();var un;j4.then(i=>un=i);var si=new _,Oa=new qe,Lu=new _,MBe=new Xt(0,0,0,"YXZ"),W4=new Xt(0,0,0,"XYZ"),go=new _,XI=new _,YI=new _(1,1,1),mm=new qe,XE=new ne,q4=new ne,xne={type:"updateMatrix"},X4=new qe,$I=new nr,Sne=.5,wne=.7,KI=.01,$E={type:"beginEvent",eventName:"Collision"},Ene={type:"beginEvent",eventName:"Trigger"};function Y4(i){if(Uo.physicsEnabled(i.scene.objects))return!0;let t=!1;return i.scene.objects.traverse((e,n)=>{if(n.events){if(Array.isArray(n.events)){for(let r of n.events)if(r.data.disabled!==!0&&r.data.type==="GameControl"&&r.data.collisionEnabled){t=!0;break}}else for(let r of Object.values(n.events))if(r.disabled!==!0&&r.type==="GameControl"&&r.collisionEnabled){t=!0;break}}}),t}var lb=i=>i.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.hiddenMatrix!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0);function gm(i){return MU(Wo(i)?i.object:i)}var YE=class{constructor(t){this.eventContext=t;this.isEnabled=!1;this.gameControl=null;this.joysticks=[];this.joystickToGameControls=[];this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}};this.sensorToTriggerEvent={};this.eventManager=void 0;this.needsCollisionDetection=!1;this.initializationCounter=-1;this.fixedBodiesToWatch=[];this.rigidBodyToMesh=new Map;this.nActiveRigidBodies=0;this.collisionEvents=[];this.isExport=!1;this.skipRender=!0;this._staticBVHAttrIds=new WeakMap;this._staticBVHNextAttrId=1;this.processRigidBody=t=>{if(t.bodyType()!==un.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,n,r]=this.rigidBodyToMesh.get(t.handle);if(si.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),Oa.copy(t.rotation()),e.matrixWorld.compose(si,Oa,n),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(xne),r){let s=e.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(e.matrixWorld);for(let a of s.children)a.updateMatrixWorld(!0)}for(let a of e.children)a.updateMatrixWorld(!0)}};this.accumulator=0;this.handleCollisionEvents=(t,e,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[t]?(r=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),r&&s&&r.isValidTriggeringObject(s)){r.dispatch();return}for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===t||o.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,t)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let u of o)u.data.target==="scene"&&this.dispatchCollisionEvent(u,a,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(e),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let u of c)u.data.target==="scene"&&this.dispatchCollisionEvent(u,l,e)}};this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=BE,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events){if(n.data.disabled===!0)continue;let r=n.data.actions?.find(s=>s.data.type==="Destroy")?.data;if(r)for(let s of r.objects){let a=this.page.scene.find(s);a&&(a.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events)if(!(n.data.disabled===!0||n.data.type!=="DragDrop"))for(let r of n.data.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(HE()===null){Jn("collision-bvh","trigger/collision detection");return}let t=[],e=[];if(this.page.traverseChildren(n=>{let r,s=n instanceof al,a=xu(n);if(oc(n)||s||a)return;Wo(n)?r=n.object:r=n;let o=r.dataPatched;if(o.physics?.enabled==="visibility"?!o.visible:!o.physics?.enabled)return!0;let l=n.geometry,c=r.userData.hasDestroy===!0,u=r.userData.hasDrag===!0;if(lb(o)||c||u||r.dataPatched.events.some(d=>d.data.disabled!==!0&&(d.data.type==="GameControl"||d.data.type==="Follow")))return n.updateMatrixWorldRigid(),this.addBoundsTree(n),!0;if(l){let d=l.getAttribute("position");if(d!==void 0&&d.count>0){t.push({geometry:l,matrixWorld:n.matrixWorld}),e.push(l.id,this._staticBVHIdOf(d),d.version,l.index!==null?this._staticBVHIdOf(l.index):-1,l.index!==null?l.index.version:-1);for(let h of n.matrixWorld.elements)e.push(h)}}if(gm(n))return!0}),t.length>0){let n=this._staticBVHCache;if(n!==void 0&&n.signature.length===e.length&&n.signature.every((o,l)=>o===e[l])){this.sharedGameControlGlobals.staticMeshBVH=n.bvh;return}let r=t.map(o=>mo(o.geometry,o.matrixWorld)),s=ro(r,!1),a=new(HE())(s);this._staticBVHCache={signature:e,bvh:a},this.sharedGameControlGlobals.staticMeshBVH=a}}addRigidBody(t,e,n){if(qI(t.matrixWorld))return;let r=[],s="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(mo(s,t.shearScale)),a.physics.fusedBody){let o=this.gatherChildrenGeom(t,r);t.traverseObject(o),t.children.forEach(c=>c.updateMatrixWorld(!0));let l=t.cloner;l&&l.objectForSample===void 0&&a.physics.rigidBody==="dynamic"&&(l.traverseObject(o),l.children.forEach(c=>c.updateMatrixWorld(!0)))}if(r.length>0){let o,l=!1,c=!n.fromCreate&&a.physics.rigidBody==="dynamic"||n.fromCreate&&n.dynamic;c?(o=un.RigidBodyDesc.dynamic(),o.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(n.hasTransformAnim||n.hasFollow||n.hasDrag)&&!n.fromCreate?(o=un.RigidBodyDesc.kinematicPositionBased(),l=!0):o=un.RigidBodyDesc.fixed();let u=ro(r);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(si,Oa,Lu),t.position0=si.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Oa.clone(),si.divideScalar(this.pixelsPerMeter),o.setTranslation(si.x,si.y,si.z).setRotation(Oa),s?u?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):u?.scale(Lu.x/this.pixelsPerMeter,Lu.y/this.pixelsPerMeter,Lu.z/this.pixelsPerMeter);let d=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o),h=!(a.geometry===void 0||a.geometry.type==="SubdivGeometry"||a.geometry.type==="NonParametricGeometry"||a.geometry.type==="BooleanGeometry"||a.geometry.type==="VectorGeometry"||a.geometry.type==="StarGeometry"||a.geometry.type==="RectangleGeometry"||a.geometry.type==="EllipseGeometry"||a.geometry.type==="TriangleGeometry"||a.geometry.type==="TorusGeometry"||a.geometry.type==="HelixGeometry");try{this.addCollider(d,a.physics,u,e,h)}catch{try{this.addCollider(d,a.physics,u,e,!1)}catch(p){console.error(p)}}if(d.numColliders()===0){this.sharedGameControlGlobals.rapierWorld.removeRigidBody(d);return}c?this.rigidBodyToMesh.set(d.handle,[t,Lu.clone(),a.physics.fusedBody]):l?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(d.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,d,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=d}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(mo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(n=>n.updateMatrixWorld(!0)),e.length>0){let n=ro(e,!1);t.bvhGeometry=n,n.getAttribute("position").count>0?(t.bvhGeometry.boundsTree=new(HE())(n),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):!1&&console.warn(`ControlsManager.addBoundsTree: object "${t.name}" has empty geometry`)}}addCollider(t,e,n,r,s=!0){if(n?.getAttribute("position").count===0||n?.getIndex()?.count===0)return;let a;n&&(e.colliderType==="trimesh"?a=un.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array):a=un.ColliderDesc.convexMesh(n.getAttribute("position").array,s?n.getIndex().array:void 0)),a.setFrictionCombineRule(un.CoefficientCombineRule.Average).setRestitutionCombineRule(un.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let o=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t);this.sharedGameControlGlobals.colliderToEntity.set(o.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(l=>l.target==="scene")&&o.setActiveEvents(un.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let n=gm(t);return(r,s)=>{if(s===0)return;if(n&&r.parent===t)return!0;let a;if(oc(r))if(r.objectForSample){if(r.objectForSample.dataPatched.physics.fusedBody)return;a=r.object}else return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Wo(r))a=r.object;else if(a=r,a.dataPatched.cloner?.hideBase)return!0;let o=a.dataPatched;if(o.physics.enabled==="visibility"?!o.visible:!o.physics.enabled)return!0;s===1?t.hasNonUniformScale?r.matrixWorld.multiplyMatrices(t.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let l=r.geometry;if(l?.getAttribute("position")!==void 0&&e.push(mo(l,r.matrixWorld)),gm(r))return!0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,n=!1;this.page.traverseEntity(o=>{for(let l of o.dataPatched.events)if(l.data.disabled===!1&&l.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=HI();if(r!==null?n=r.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||n:this.page.data.publish.gameControlObject!==null&&Jn("game-controls","the scene's game controls"),n===!1){let{enableRotate:o,enablePan:l,enableZoom:c,autoRotate:u,hoverRotatePanMode:d}=this.eventManager.publish.orbitControls;(o||l||c||u||d!==0)&&(this.orbitControls=new Jf(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let s=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();HI()?.createJoysticks(this,s,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(o=>o.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new un.World(new un.Vector3(0,this.gravity,0)),this.events=new un.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(o=>{let l;if(oc(o))if(o.objectForSample){if(o.objectForSample.dataPatched.physics.fusedBody)return;l=o.object}else return o.object.dataPatched.physics.fusedBody===!0&&o.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Wo(o))l=o.object;else{if(xu(o)||io(o)||o instanceof al)return;if(l=o,l.dataPatched.cloner?.disabled===!1&&l.dataPatched.cloner?.hideBase&&l.dataPatched.physics?.fusedBody!==!0)return!0}let c=l.dataPatched,u;for(let y of c.events)y.data.disabled!==!0&&y.data.type==="GameControl"&&(u=y.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;o.updateMatrixWorldRigid();let d=lb(c),h=!1,p=l.userData.hasDestroy,f=l.userData.hasDrag,m=!1;for(let y of c.events)if(y.data.disabled!==!0){if(y.data.type==="Collision"){h=!0;let v=new qE(y.id,y.data,l,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].every(b=>b.id!==y.id)?this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]=[v]}else if(y.data.type==="Follow"){m=!0;let v=y.data.target;o.traverseVisible(b=>{b.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(o.matrixWorldFusedFalse=o.matrixWorld.clone());let g=o.geometry;if(u!==void 0){let y=un.RigidBodyDesc.kinematicPositionBased();(o.hasNonUniformScale?o.matrixWorldRigid:o.matrixWorld).decompose(si,Oa,Lu),o.position0=si.clone().divideScalar(this.pixelsPerMeter),o.rotation0=Oa.clone(),si.divideScalar(this.pixelsPerMeter),y.setTranslation(si.x,si.y,si.z).setRotation(Oa);let v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(y);o.rigidBody=v;let b;u.collider.type==="sphere"?b=un.ColliderDesc.ball(u.collider.radius/this.pixelsPerMeter):u.collider.type==="capsule"?b=un.ColliderDesc.capsule((u.collider.height/2-u.collider.radius)/this.pixelsPerMeter,u.collider.radius/this.pixelsPerMeter):b=un.ColliderDesc.cuboid(u.collider.width/this.pixelsPerMeter/2,u.collider.height/this.pixelsPerMeter/2,u.collider.depth/this.pixelsPerMeter/2),b.setFrictionCombineRule(un.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(un.CoefficientCombineRule.Min);let x=this.sharedGameControlGlobals.rapierWorld.createCollider(b,v);this.sharedGameControlGlobals.colliderToEntity.set(x.handle,l),si.fromArray(u.collider.position.map(E=>typeof E=="number"?E:0)).multiply(Lu.setFromMatrixScale(l.matrixWorld)).divideScalar(this.pixelsPerMeter),x.setTranslationWrtParent(si);let S=new qe().setFromEuler(new Xt().setFromVector3(new _().fromArray(u.collider.rotation.map(E=>typeof E=="number"?E:0))));x.setRotationWrtParent(S),x.setActiveEvents(un.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(l,!0)}else c.physics.rigidBody==="dynamic"||d||m||p||f||h?(this.addRigidBody(o,l,{hasFollow:m,hasTransformAnim:d,hasDrag:f}),this.generateSensorColliderDescs(l,c.physics.fusedBody)):(g&&t.push(mo(g,o.matrixWorld)),c.physics.fusedBody&&!gm(o)&&o.traverseObject((y,v)=>{if(v===0)return;let b;if(oc(y))if(y.objectForSample){if(y.objectForSample.dataPatched.physics.fusedBody)return;b=y.object}else return y.object.dataPatched.physics.fusedBody===!0&&y.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else{if(xu(y)||io(y)||y instanceof al)return;if(Wo(y))b=y.object;else if(b=y,b.dataPatched.cloner?.hideBase)return!0}let x=b.dataPatched;if(x.physics.enabled==="visibility"?!x.visible:!x.physics.enabled)return!0;let S=y.geometry;if(S?.getAttribute("position")!==void 0&&t.push(mo(S,y.matrixWorld)),gm(y))return!0}),this.generateSensorColliderDescs(l,c.physics.fusedBody,e));if(c.physics?.fusedBody===!0||u||gm(o))return!0}),t.length===0)return;let n=ro(t),r=n.getIndex().count>0;if(!r&&e.length===0)return;n.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let s=un.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s);if(r){let o=un.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array).setFrictionCombineRule(un.CoefficientCombineRule.Multiply).setRestitutionCombineRule(un.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(o,a)}for(let[o,l]of e){let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,a);this.sensorToTriggerEvent[c.handle]=l}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let n=new ob(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),r=new ne().compose(go.fromArray(e.data.position.map(s=>typeof s=="number"?s:0)),mm.setFromEuler(W4.fromArray(e.data.rotation.map(s=>typeof s=="number"?s:0))),YI);if(e.data.triggerZone==="box"){let s=new Bt;s.min.fromArray(e.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(-.5),s.max.fromArray(e.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([s,r,t,n])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,r,t,n])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(!!this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let n=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let r=t/1e3;r<n&&r>n*.55&&(r=n),this.accumulator+=r;let s=performance.now(),a=0,o=6;for(;this.accumulator>=n&&a<o&&(e=this.stepPhysics()&&e,this.accumulator-=n,a++,!(performance.now()-s>n*1e3)););this.accumulator=this.accumulator%n}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(si,Oa,Lu);let e=t;e.prevQ===void 0?(e.prevQ=Oa.clone(),e.prevT=si.clone()):(e.prevQ.copy(Oa),e.prevT.copy(si))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,n,r]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(r)||(n.setBodyType(un.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(n.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,n=t.linvel(),r=t.translation(),s=Math.hypot(n.x,n.z);for(let a=0;a<t.numColliders();a++){let o=t.collider(a);e.contactPairsWith(o,l=>{let c=l.parent();if(c===null||!c.isDynamic())return;let u=c.translation(),d=-1/0,h=0,p=0;if(e.contactPair(o,l,v=>{let b=v.normal(),S=b.x*(u.x-r.x)+b.y*(u.y-r.y)+b.z*(u.z-r.z)<0?-1:1;if(Math.abs(b.y)>wne)return;let E=S*b.x,M=S*b.z,w=Math.hypot(E,M);if(w<1e-4)return;let T=(n.x*E+n.z*M)/w;T>d&&(d=T,h=E/w,p=M/w)}),d===-1/0)return;let f=n.x*h+n.z*p;if(f<-KI)return;let m=c.linvel();if(s>KI&&f>KI){let v=m.x*h+m.z*p;if(v<=0)return;let b=Math.min(v,f);c.setLinvel({x:h*b,y:m.y,z:p*b},!0);return}let g=m.x*h+m.z*p-Math.max(0,f);if(g<=0)return;let y=g*(1-Sne);c.setLinvel({x:m.x-h*y,y:m.y,z:m.z-p*y},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let e of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(e),e.rigidBody.setNextKinematicTranslation(si.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(Oa);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,n){let r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(n))._parent,s;if(e.cloner){for(let a of e.cloner.children)if(a.rigidBody===r){s=a;break}}t.dispatch(s),e.dispatchEvent($E)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,n){let r=q4.copy(t.matrixWorld).invert();t.traverseEntity((s,a)=>{if(e===!1&&a===1)return!0;for(let o of s.dataPatched.events)if(o.data.type==="Trigger"&&o.data.disabled!==!0){let l=new ob(o.id,o.data,s,this.page,this.sharedAssets,this.eventManager),c;if(o.data.triggerZone==="box"?c=un.ColliderDesc.cuboid(...o.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):c=un.ColliderDesc.ball(o.data.radius/this.pixelsPerMeter),c.setDensity(0).setSensor(!0).setActiveEvents(un.ActiveEvents.COLLISION_EVENTS),go.fromArray(o.data.position.map(u=>typeof u=="number"?u:0)),mm.setFromEuler(W4.fromArray(o.data.rotation.map(u=>typeof u=="number"?u:0))),XE.compose(go,mm,YI).premultiply(s.matrixWorld),n?(XE.decompose(go,mm,XI),c.setActiveCollisionTypes(un.ActiveCollisionTypes.KINEMATIC_FIXED|un.ActiveCollisionTypes.DYNAMIC_FIXED)):(XE.premultiply(r).decompose(go,mm,XI),t.rigidBody.bodyType()===un.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===un.RigidBodyType.Fixed?c.setActiveCollisionTypes(un.ActiveCollisionTypes.KINEMATIC_FIXED|un.ActiveCollisionTypes.DYNAMIC_FIXED):c.setActiveCollisionTypes(un.ActiveCollisionTypes.KINEMATIC_KINEMATIC|un.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),go.divideScalar(this.pixelsPerMeter),c.setTranslation(go.x,go.y,go.z),c.setRotation(mm),n)n.push([c,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(c,t.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[n,r,s,a]=this.sharedGameControlGlobals.triggers[e];for(let o=0;o<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;o++){let l=this.sharedGameControlGlobals.entitiesWithTransformAnim[o];if(s===l||a.isValidTriggeringObject(Dt.is(l)?l:l.object)===!1)continue;let c=q4.copy(s.matrixWorld).decompose(go,X4,XI).compose(go,X4,YI).multiply(r),u=XE.copy(l.matrixWorld).invert().multiply(c),d=l.bvhGeometry.boundsTree;n instanceof Bt?t=d.intersectsBox(n,u):($I.radius=n,$I.center.setFromMatrixPosition(u),t=d.intersectsSphere($I)),t?a.currentIntersectedObjects.indexOf(l)===-1&&(a.currentIntersectedObjects.push(l),a.dispatch(),s.dispatchEvent(Ene)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(h=>h!==l)}}}};eh();Y();pv();an();fc();var $4=4,ZI=8;var QI=.02,JI=.3,Mne=65,K4=new _,Z4=new _,_ne=new _,$i=new _,Sc=new _,ym=new _,eO=new ne,Q4=new ne,Tne=new ne,Qs=new qe,hh=new qe,vm=new Xt(0,0,0,"YXZ"),Ane=new _(1,0,0),dl=new _(0,1,0),Cne=new _(0,0,1),J4=new _(1,1,1),tO=[],ej=i=>tO[i]??(tO[i]=new _),nO=new _,Pne=new _,Ine=new _,One=new _,tj=new qe,Rne=new _,nj=new qe,Dne=1,Lne=.025,Nne=16e-6,rj=12,Bne=20,Oi=new ri,Ra=new Bt,Fne={type:"requestRender"},Une={type:"updateMatrix"},KE=class extends Tn{constructor(e,n,r,s,a,o,l,c,u){super();this.object=e;this.domElement=n;this.data=r;this.gloabalPhysics=s;this.controlsManager=a;this.cameraFollow=o;this.camera=l;this.page=c;this.sharedAssets=u;this.enableDamping=!0;this.hiddenMatrix0=new ne;this.target0=new _;this.zoom0=1;this.rotForce=1;this.moveForce=1;this.pixelsPerMeter=BE;this.euler0=new Xt(0,0,0,"YXZ");this.position0Cam=new _;this.quat0Cam=new qe;this.scale0Cam=new _;this.hiddenMatrix0Cam=new ne;this.threshEndTranslate=.01;this.threshEndRotate=1e-8;this.threshEndRotVel=.005;this.collider={type:"capsule",radius:40,segment:new ri(new _(0,-40,0),new _(0,40,0)),matrix:new ne,position:new _,rotation:new qe};this.euler=new Xt(0,0,0,"YXZ");this.eulerDelta=new _;this.lastPosition=new _;this.lastCameraQuaternion=new qe;this.lastCameraPosition=new _;this.PI_2=Math.PI/2;this.prevMouse=new j;this.velocityTarget=new _;this.velocity=new _;this.directionXZ=new _;this.rotVelocityStick=new _;this.rotVelocityTarget=new _;this.rotVelocity=new _;this.rotDirection=new _;this.nonColliderRotOffset=new ne;this.nonColliderPosOffset=new ne;this.firstPointerId=-1;this.rot=new _;this.path=[];this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0};this.onObject=!1;this.actionState={};this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]];this.collisionEnabled=!0;this.offsetMatrix=new ne;this.objectToTarget=new _;this.objectToTarget0=new _;this.objectToCamXZ=new _;this.objectToCamXZ0=new _;this.targetToCamera=new _;this.targetToCamera0=new _;this.cameraPolarAxis0=new _;this.targetPos=new _;this.targetQuat=new qe;this.lerpFactorPos=new _().setScalar(.3);this.lerpFactorPosStart=.3;this.lerpFactorPosEnd=.3;this.lerpFactorRotStart=.3;this.lerpFactorRotEnd=.3;this.lerpFactorPosCamera=.3;this.lerpFactorRotCamera=.3;this.objXZQuat=new qe;this.objXZQuatInv=new qe;this.objXZRotMat=new ne;this.isFirstPerson=!1;this.didHit=!1;this.groundVelocity=new _;this.pushedVelocity=new _;this.groundYRotation=0;this.objectRealQuat=new qe;this.colliderWorldQuat=new qe;this.groundNormal=new _;this.groundTilt=new qe;this.groundTiltInv=new qe;this.lastHitObj=null;this.isFirstFrame=!0;this.rotationAccumWhenOrientWithCamera=0;this.navMeshPathDest=null;this.position=new _;this.quaternion=new qe;this.scale=new _;this.initialAction=!0;this.onPointerDown=e=>{!(e.target===this.domElement||e.target instanceof HTMLElement&&e.target.tagName==="SPLINE-VIEWER"&&e.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!pi&&!eC&&this.domElement.requestPointerLock(),this.prevMouse.set(e.clientX,e.clientY))};this.onPointerUp=e=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),e.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()};this.onPointerMove=e=>{if(e.pointerId!==this.firstPointerId)return;let n=e.clientX-this.prevMouse.x,r=e.clientY-this.prevMouse.y;this.prevMouse.set(e.clientX,e.clientY),e.pointerType==="mouse"&&this.rotBy!=="keys"&&(eC&&n3<15.5&&!pi?(this.eulerDelta.y=-n*this.mouseOrbitSensitivity,this.eulerDelta.x=-r*this.mouseOrbitSensitivity):(this.eulerDelta.y=-e.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-e.movementY*this.mouseOrbitSensitivity)),e.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-n*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-r*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()};this.onPointerlockChange=e=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?KE.isLocked=!0:KE.isLocked=!1};this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")};this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0};this.onKeyDown=e=>{!(e.target instanceof HTMLInputElement)&&(e.code==="ArrowLeft"||e.code==="ArrowUp"||e.code==="ArrowRight"||e.code==="ArrowDown"||e.code==="Space")&&e.preventDefault();for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]){this.movementState[n[0]]=1;break}this.controlsManager.requestRender()};this.onKeyUp=e=>{for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]||e.code.slice(3,e.code.length).toUpperCase()===n[1]){this.movementState[n[0]]=0;break}};this.copyVRGamePadValues=(e,n)=>{for(let r=2;r<4;r++){let s=e.axes[r];n===0?r===2?this.movementState.movePosX=s:this.movementState.movePosZ=s:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,r===2?this.movementState.rotPosY=s:this.moveMode==="fly"&&(this.movementState.moveNegY=s))}};this.sharedGameControlGlobals=a.sharedGameControlGlobals,e===l&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let d=this.euler0.clone(),h=d.y;if(this.objectRealQuat.copy(this.quaternion),d.y=0,this.quaternion.setFromEuler(d),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),d.set(0,h,0),this.quaternion.setFromEuler(d),this.rot.setFromEuler(d),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let g=new _(0,0,-1).applyQuaternion(this.camera.quaternion),y=new _().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(y),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ);let v;Math.abs(g.y)<1e-6?(y.y=0,g.y=0,v=y.projectOnVector(g)):y.y/g.y>0?v=g.multiplyScalar(y.y/g.y):v=g.multiplyScalar(y.length()),this.targetToCamera0.copy(v).negate();let b=this.camera.position.clone().add(v);this.objectToTarget0.subVectors(b,this.position);let x=new Xt().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-x.x,x.x=0,x.z=0,x.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(x)}if(this.object instanceof on&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=r.rotByTouch??"joystick",this.rotBy=r.rotBy??"keys",this.rotationMode=r.rotationMode??"normal",this.moveMode=r.moveMode??"walk",this.collisionEnabled=r.collisionEnabled,this.speedTranslate=(r.speedTranslate??250)*Dne,this.speedOrbit=(r.speedRotate??100)*Lne,this.mouseOrbitSensitivity=(r.speedRotate??100)*Nne,this.keyAssignments=r.keyAssignments.map(g=>{let y=[g[0],g[1]];return y[1]==="\u25B2"?y[1]="ArrowUp":y[1]==="\u25C0"?y[1]="ArrowLeft":y[1]==="\u25BC"?y[1]="ArrowDown":y[1]==="\u25B6"?y[1]="ArrowRight":y[1]==="\u21E7"?y[1]="Shift":y[1]==="\u21B5"?y[1]="Enter":y[1]==="Space"?y[1]=" ":y[1]==="\u2318"?y[1]="Meta":y[1]==="Ctrl"?y[1]="Control":y[1]==="Esc"&&(y[1]="Escape"),y}),r.rotBy==="mouse"){let g;g=this.keyAssignments.findIndex(y=>y[0]==="rotNegX"),g!==-1&&(this.keyAssignments[g][1]=""),g=this.keyAssignments.findIndex(y=>y[0]==="rotPosX"),g!==-1&&(this.keyAssignments[g][1]=""),g=this.keyAssignments.findIndex(y=>y[0]==="rotPosY"),g!==-1&&(this.keyAssignments[g][1]=""),g=this.keyAssignments.findIndex(y=>y[0]==="rotNegY"),g!==-1&&(this.keyAssignments[g][1]="")}this.lerpFactorPosStart=1-.02**(1/((r.delayPos[0]??.3)*60)),this.lerpFactorPosEnd=1-.02**(1/((r.delayPos[1]??.3)*60)),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/((r.delayRot[0]??.3)*60)),this.lerpFactorRotEnd=1-.02**(1/((r.delayRot[1]??.3)*60)),this.lerpFactorPosCamera=1-.02**(1/((r.delayPosCamera??.3)*60)),this.lerpFactorRotCamera=1-.02**(1/((r.delayRotCamera??.3)*60)),this.gravity=(this.gloabalPhysics.gravity??yu.defaultData.gravity)*rj,this.usePhysics=this.gloabalPhysics.usePhysics??yu.defaultData.usePhysics,this.jumpPower=r.jumpPower*Bne,this.resetYPosition=this.position.y+Math.abs(r.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=r.alignToGround??!1,this.orientMode=r.autoOrientMove?r.orientMode:"none",this.orientWith=r.orientWith??uf.defaultDataThirdPerson.orientWith,this.slopeThresh=Mne*Math.PI/180,r.collider.type==="capsule"?(this.collider.radius=r.collider.radius,this.collider.segment.start.y=r.collider.height/2-r.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=r.collider.height*QI/this.pixelsPerMeter,this.stepThresh=r.collider.height*JI/this.pixelsPerMeter,this.colliderHeight=r.collider.height):r.collider.type==="sphere"?(this.collider.radius=r.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*r.collider.radius*QI/this.pixelsPerMeter,this.stepThresh=2*r.collider.radius*JI/this.pixelsPerMeter,this.colliderHeight=r.collider.radius*2):(this.offset=r.collider.height*QI/this.pixelsPerMeter,this.stepThresh=r.collider.height*JI/this.pixelsPerMeter,this.colliderHeight=r.collider.height),this.collider.type=r.collider.type;let p=new _().fromArray(r.collider.position.map(g=>typeof g=="number"?g:0)),f=new qe().setFromEuler(new Xt().fromArray([...r.collider.rotation.map(g=>typeof g=="number"?g:0),"XYZ"]));this.collider.position.copy(p).multiply(this.scale),this.collider.rotation.copy(f),this.collider.matrix.compose(p,f,J4),r.cameraXAxis!==void 0&&(this.cameraXAxis=r.cameraXAxis,this.cameraYAxis=r.cameraYAxis,this.minPolarAngle=r.cameraRotXLimits[0],this.maxPolarAngle=r.cameraRotXLimits[1],this.minAzimuthAngleRel=r.cameraRotYLimits[0],this.maxAzimuthAngleRel=r.cameraRotYLimits[1]),this.forwardDir=r.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=r.runMultiplier??2;let m=r.navmesh.destinationHelperRadius*2;if(m>0){let g=new ze;g.push({fi:0,data:{...Qn.defaultData("light","phong"),alpha:0},id:"layer1"}),g.push({fi:0,data:{...Qn.defaultData("color"),color:r.navmesh.destinationHelperColor,alpha:r.navmesh.destinationHelperColor.a},id:"layer2"});let y=Aw({layers:g},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Ht(ow.create({parameters:{width:m,height:m/10,hollow:.7}}),y),this.navMeshPathDest.material.userData.opacity0=r.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let n=new Xt().setFromQuaternion(this.quaternion,"YXZ"),r=n.y;this.objectRealQuat.copy(this.quaternion),n.y=0,this.quaternion.setFromEuler(n),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),n.set(0,r,0),this.quaternion.setFromEuler(n),this.rot.setFromEuler(n),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof on?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,n=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},cf.list.forEach(r=>{this.actions[r]=cn({...e,disabled:!1,type:"GameControl"},e.gameActions[r],this.page,n,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),Nn(this.actions.idle),Nn(this.actions.move),Nn(this.actions.run),Nn(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(n=>{n.play()}),this.actions[e].Animation.forEach(n=>{n.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(n=>{n.play()}),this.actions[e].Create.forEach(n=>{n.dispatchStart()}),this.actions[e].Audio.forEach(n=>{n.dispatchGameControl("start")}),this.actions[e].Particles.forEach(n=>{n.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(n=>{n.stop(),n.object.currentState!==null&&n.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(n=>{n.stop()}),this.actions[e].Create.forEach(n=>{n.dispatchStop()}),this.actions[e].Audio.forEach(n=>{n.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(n=>{n.dispatchGameControl("stop")})))}get colliderWorldPosition(){return $i.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let n=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let r=n*60,s=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let o=Sc.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*rj),1)*(this.gravity>0?1:-1):this.velocity.y)*n,0).divideScalar(this.pixelsPerMeter),l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,o,this.object.rigidBody?.collider(0).shape,0,1,!1,ZI,void 0,void 0,this.object.rigidBody);if(l){this.onObject=!0,this.groundNormal.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(s=!0),l.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let c=l.collider.parent(),u=c!==null&&c.isKinematic()?c:null,d=u===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(u.handle);if(u!==null&&d?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition($i).add(this.collider.position).divideScalar(this.pixelsPerMeter),p=u.velocityAtPoint(h);this.groundVelocity.set(p.x,p.y,p.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=u.angvel().y*n}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*r),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let o=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let l=$i.subVectors(this.path[1],this.position),c=Sc.subVectors(this.path[1],this.path[0]);l.dot(c)<0?this.path.shift():(this.directionXZ.x=c.x,this.directionXZ.z=c.z),o.opacity=o.userData.opacity0}else o.opacity-=.05*o.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**r),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**r),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**r)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let a=_ne.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let o=Sc.copy(a);o.y=0,a.set(0,a.y,o.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let o=$i;this.camera.getWorldDirection(o);let l=ym.copy(dl).multiplyScalar(o.dot(dl));o.sub(l);let c=Sc.copy(this.directionXZ);c.x*=-1,this.rot.y=o.angleTo(c)*(o.cross(c).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(vm.setFromVector3(this.rot),this.moveMode==="walk"&&(vm.x=0),a.applyEuler(vm),s&&(hh.setFromUnitVectors(dl,this.groundNormal),a.applyQuaternion(hh)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let o=0;for(let l of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(l.rigidBody===void 0||l.prevQ===void 0)continue;(l.hasNonUniformScale?l.matrixWorldRigid:l.matrixWorld).decompose(nO,tj,Pne);let c=this.object.getWorldPosition(Ine).add(this.collider.position).sub(nO);nj.copy(l.prevQ).invert().premultiply(tj);let u=ym.subVectors(nO,l.prevT).add(One.copy(c).applyQuaternion(nj).sub(c)).divideScalar(n).divideScalar(this.pixelsPerMeter),d=l.rigidBody.collider(0).castCollider(u,this.object.rigidBody.collider(0),$i.copy(a).divideScalar(this.pixelsPerMeter),0,n,!1);u.multiplyScalar(this.pixelsPerMeter);let h=Dt.is(l)?l:l.object;if(d!==null&&this.lastHitObj!==h){let p;l instanceof Yr&&(p=l);let f=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(f)for(let m of f)m.data.target==="character"&&(m.dispatch(p),h.dispatchEvent($E));this.lastHitObj=h}d!==null&&(Math.abs(u.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=u.x),Math.abs(u.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=u.y),Math.abs(u.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=u.z),ej(o++).copy(d.normal1).applyQuaternion(l.quaternion))}if(o>0){for(let l=0;l<o;l++){let c=ej(l),u=c.dot(a);u<0&&a.addScaledVector(c,-u)}a.add(this.pushedVelocity)}else a.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(n),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**r):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**r),this.euler.x+=this.rotVelocity.x*n,this.euler.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*n),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(dl,this.euler.y-this.euler0.y);let o=Sc.copy(this.objectToCamXZ).normalize(),l=ym.copy(a).multiplyScalar(n);l.y=0;let c=l.sub($i.copy(o).multiplyScalar(l.dot(o))).cross(o).y;this.euler.y-=Math.atan2(c,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=we.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=we.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=we.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(vm.copy(this.euler),vm.y=0,this.nonColliderRotOffset.makeRotationFromEuler(vm)),Qs.setFromAxisAngle(Ane,this.rot.x),hh.setFromAxisAngle(dl,this.rot.y),hh.multiply(Qs),Qs.setFromAxisAngle(Cne,this.rot.z),hh.multiply(Qs),this.quaternion.copy(hh),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let o=Sc.copy(a).multiplyScalar(n/this.pixelsPerMeter),l=null;this.didHit=!1;let c=new _;for(let h=0;h<5;h++){let p=o.length(),f=ym.copy(o).normalize();if(l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),this.colliderWorldQuat,f,this.object.rigidBody.collider(0).shape,0,p,!1,ZI|$4,void 0,void 0,this.object.rigidBody),l!==null){this.didHit=!0;let m=this.sharedGameControlGlobals.colliderToEntity.get(l.collider.handle);if(m!==this.lastHitObj&&h===0){this.lastHitObj=m;let b=this.sharedGameControlGlobals.entityToCollisionEvents[m?.uuid];if(b){for(let x of b)if(x.data.target==="character"){let S=(this.sharedGameControlGlobals.rapierWorld?.getCollider(l.collider.handle))._parent,E;if(m.cloner){for(let M of m.cloner.children)if(M.rigidBody===S){E=M;break}}x.dispatch(E),m.dispatchEvent($E)}}}let g=K4.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat),y=Z4.copy(f).multiplyScalar(l.time_of_impact).dot(g),v=l.time_of_impact;if(v===0&&(this.position.y+=this.offset*this.pixelsPerMeter),y>this.offset&&(v=l.time_of_impact*(y-this.offset)/y,c.addScaledVector(f,v)),o.copy(f).multiplyScalar(p-v),Math.acos(-g.y)>this.slopeThresh){let b=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),x=ym.copy(l.witness2).applyQuaternion(this.colliderWorldQuat);x.y=0;let S=b.add(x);S.y+=this.stepThresh;let E=this.sharedGameControlGlobals.rapierWorld.castShape(S,this.colliderWorldQuat,o,this.object.rigidBody?.collider(0).shape,0,1,!1,ZI|$4,void 0,void 0,this.object.rigidBody);E!==null&&E.time_of_impact===0&&(g.y=0,g.normalize())}o.addScaledVector(g,-o.dot(g))}else{h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),c.add(o);break}}this.position.addScaledVector(c,this.pixelsPerMeter),$i.copy(this.position).divideScalar(this.pixelsPerMeter),Qs.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let u=this.object.rigidBody,d=u!==void 0&&Rne.copy($i).sub(u.translation()).lengthSq()>1;u!==void 0&&(d?(u.setTranslation($i,!0),u.setRotation(Qs,!0)):(u.setNextKinematicTranslation($i),u.setNextKinematicRotation(Qs)))}else{let o=this.onObject?1:5,l=a.multiplyScalar(n/o);for(let c=0;c<o;c++)this.position.add(l),this.collisionAdjustment(n/o)}else this.position.addScaledVector(a,n);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let o=this.objectToTarget.add(this.position),l=this.targetToCamera.add(o);eO.lookAt(l,o,dl).setPosition(l),eO.decompose(this.targetPos,this.targetQuat,$i),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**r),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**r),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=we.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=we.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(Une),this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)?!1:(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(Fne),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Qs.setFromAxisAngle(dl,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?we.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e);let n;this.cameraXAxis==="Limit"?n=we.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):n=we.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let r=$i.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&r.applyQuaternion(e);let s=hh.setFromAxisAngle(r,n);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(s)}groundTiltAdjustment(e){dl.angleTo(e)*180/Math.PI<15||dl.angleTo(e)*180/Math.PI>85?Qs.identity():Qs.setFromUnitVectors(dl,e),this.groundTilt.slerp(Qs,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let n=Z4.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let r=eO.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose($i,Qs,Sc).compose($i,Qs,J4);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(a=>{if(a===this.object||a.isDescendantOf(this.object)||!a.bvhGeometry||!a.bvhGeometry.boundsTree)return;Ra.makeEmpty(),a.updateMatrixWorldRigid();let o=a.matrixWorldRigid,l=Q4.copy(o).invert(),c=Tne.copy(Q4).multiply(r);Oi.copy(this.collider.segment),Oi.start.applyMatrix4(c),Oi.end.applyMatrix4(c);let u=K4.copy(this.position).applyMatrix4(l);Ra.expandByPoint(Oi.start),Ra.expandByPoint(Oi.end),Ra.min.addScalar(-this.collider.radius),Ra.max.addScalar(this.collider.radius),a.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder(d){return d.distanceToPoint(Oi.end)},intersectsBounds:d=>d.intersectsBox(Ra),intersectsTriangle:d=>{let h=$i,p=Sc,f=d.closestPointToSegment(Oi,h,p);if(f<this.collider.radius){let m=this.collider.radius-f,g=p.sub(h).normalize(),y=ym.copy(u);y.addScaledVector(g,m);let v=y.applyMatrix4(o).sub(this.position);n.add(v),Oi.start.addScaledVector(g,m),Oi.end.addScaledVector(g,m)}}})}),Ra.makeEmpty(),Oi.copy(this.collider.segment),Oi.start.applyMatrix4(r),Oi.end.applyMatrix4(r),Ra.expandByPoint(Oi.start),Ra.expandByPoint(Oi.end),Ra.min.addScalar(-this.collider.radius),Ra.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder(a){return a.distanceToPoint(Oi.end)},intersectsBounds:a=>a.intersectsBox(Ra),intersectsTriangle:a=>{let o=$i,l=Sc,c=a.closestPointToSegment(Oi,o,l);if(c<this.collider.radius){let u=this.collider.radius-c,d=l.sub(o).normalize();this.alignToGround&&this.groundTiltAdjustment(d),n.addScaledVector(d,u),Oi.start.addScaledVector(d,u),Oi.end.addScaledVector(d,u)}}}),this.onObject=Math.abs(n.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let s=Math.max(0,n.length()-1e-5);n.normalize().multiplyScalar(s),this.position.add(n)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},cb=KE;cb.isLocked=!1;Y();mf();eh();Jd();var ij,sj=new Promise(i=>{ij=i});var rO,ZE;function aj(i){if(ZE)return ZE;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.13/build");typeof window<"u"&&(rO=new URL(n.endsWith("/")?n:`${n}/`,window.location.href).href);let s=import("./navmesh.js"),[a,o]=await Promise.all([s,fetch(`${n}/navmesh.wasm`).then(u=>u.arrayBuffer())]),l=a.default,c=await l({wasmBinary:o});ij(c)}return ZE=t(),ZE}hn();var kne=!1?typeof window<"u"?window.location.href:"":"https://cdn.spline.design/@splinetool/runtime@2.0.13/build/",Vne=i=>`
9806
9806
  (async function() {
9807
9807
  const [wasmImport, wasmBinary] = await Promise.all([
9808
9808
  import('${i}' + 'navmesh.js'),
@@ -9889,4 +9889,4 @@ onmessage = function(messageEvent) {
9889
9889
  [${L_}] { pointer-events: none; }
9890
9890
  [${L_}] > * { pointer-events: auto; }
9891
9891
  [${L_}] [data-spline-passthrough] { pointer-events: none; }
9892
- `,Xm=class{constructor(t,e,n,r,s){this.container=t;this.host=e;this.observer=n;this.previousSplineGlobal=r;this.removeLateLifecycleShim=s}static mount(t,e,n,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let a=document.createElement("div");a.setAttribute(L_,"");let o=a.style;o.position="absolute",o.overflow="hidden";let l=()=>{o.left=`${e.offsetLeft}px`,o.top=`${e.offsetTop}px`,o.width=`${e.offsetWidth}px`,o.height=`${e.offsetHeight}px`};l();let c=new ResizeObserver(l);c.observe(e),c.observe(s);let u=document.createElement("style");u.textContent=eoe,a.appendChild(u);let d=new DOMParser().parseFromString(n,"text/html"),h=Array.from(d.querySelectorAll("script"));for(let x of h)x.remove();for(let x of Array.from(d.head.children))(x.tagName==="STYLE"||x.tagName==="LINK"&&x.rel==="stylesheet")&&a.appendChild(x);for(;d.body.firstChild;)a.appendChild(d.body.firstChild);s.insertBefore(a,e.nextSibling);let p=(x,S)=>{x==="warn"?console.warn(`[spline html] ${S}`):x==="error"&&console.error(`[spline html] ${S}`)},f=new Map,m=new kp(ZR(t,e,r),p,(x,S)=>{let E=f.get(x);if(!!E)for(let M of E)try{M(S)}catch(w){console.error(w)}}),g=(x,S)=>{try{return Promise.resolve(m.execute(x,S))}catch(E){return Promise.reject(E)}},y={ready:Promise.resolve(),setVariable:(x,S)=>g("setVariable",[x,S]),setVariables:x=>g("setVariables",[x]),getVariable:x=>g("getVariable",[x]),getVariables:()=>g("getVariables",[]),getAllObjects:()=>g("getAllObjects",[]),findObjectByName:x=>g("findObjectByName",[x]),findObjectById:x=>g("findObjectById",[x]),getGeometry:(x,S)=>g("getGeometry",[x,S??{}]),updateObject:(x,S)=>g("updateObject",[x,S]),createObject:(x,S)=>g("createObject",[x,S??{}]),createCustomMaterial:x=>g("createCustomMaterial",[x]),setMaterial:(x,S)=>g("setMaterial",[x,S]),cloneObject:(x,S)=>g("cloneObject",[x,S??{}]),removeObject:x=>g("removeObject",[x]),spawnObject:(x,S)=>g("spawnObject",[x,S??{}]),destroyObject:x=>g("destroyObject",[x]),setInstanceTransforms:(x,S)=>g("setInstanceTransforms",[x,S??null]),emitEvent:(x,S)=>g("emitEvent",[x,S]),emitEventReverse:(x,S)=>g("emitEventReverse",[x,S]),requestRender:()=>g("requestRender",[]),addEventListener:(x,S)=>{if(typeof S!="function")return;let E=f.get(x);E||(E=new Set,f.set(x,E),g("listenEvent",[x])),E.add(S)},removeEventListener:(x,S)=>{let E=f.get(x);!E||(E.delete(S),E.size===0&&(f.delete(x),g("unlistenEvent",[x])))}},v=window.spline;window.spline=y;let b=F3();for(let x of h){let S=document.createElement("script");for(let E of Array.from(x.attributes))S.setAttribute(E.name,E.value);x.src?S.async=!1:S.textContent=x.textContent,a.appendChild(S)}return new Xm(a,m,c,v,b)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};ft();an();Y();I2();Ta();function t6(i,t){let e=i.length/3,n=new Map,r=new Array(e);for(let l=0;l<e;l++){let c=`${Math.round(i[3*l]*1e4)},${Math.round(i[3*l+1]*1e4)},${Math.round(i[3*l+2]*1e4)}`,u=n.get(c);u===void 0?(n.set(c,l),r[l]=l):r[l]=u}let s=new Map;for(let l=0;l+2<t.length;l+=3){let c=r[t[l]],u=r[t[l+1]],d=r[t[l+2]];for(let[h,p]of[[c,u],[u,d],[d,c]]){if(h===p)continue;let f=h<p?h+"_"+p:p+"_"+h;s.set(f,(s.get(f)??0)+1)}}let a=s.size>0;for(let l of s.values())if(l!==2){a=!1;break}if(!a)return{closed:!1,inverted:!1};let o=0;for(let l=0;l+2<t.length;l+=3){let c=t[l]*3,u=t[l+1]*3,d=t[l+2]*3,h=i[c],p=i[c+1],f=i[c+2],m=i[u],g=i[u+1],y=i[u+2],v=i[d],b=i[d+1],x=i[d+2];o+=h*(g*x-y*b)+p*(y*v-m*x)+f*(m*b-g*v)}return{closed:!0,inverted:o<0}}an();ft();cU();fc();function a6(i){return typeof i=="object"&&i!==null&&i.isMaterial===!0}function JR(i){if(typeof i.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!a6(i.material))return{options:i};let t=i.material;if(t.isNodeMaterial===!0){let e=Cw()?.NodeMaterial;if(e!==void 0&&t instanceof e)return{options:{...i,material:void 0},material:t};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(t.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...i,material:void 0},material:t}}var toe=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),n6="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",noe={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},roe={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},ioe={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},soe={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},aoe={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function o6(i){if(typeof i!="string"||i.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${n6}.`);let t=i.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),e=roe[t];if(e)return{objectType:e};let n=noe[t];if(n)return{objectType:"Mesh",geometryType:n};let r=ioe[t];throw r?new Error(`createObject: '${i}' is not supported \u2014 ${r}`):new Error(`createObject: '${i}' is not a creatable Spline type \u2014 use one of ${n6}, e.g. createObject('Cube', { width: 200 }).`)}function Xb(i,t){return i===void 0?[t[0],t[1],t[2]]:Array.isArray(i)?[i[0]??t[0],i[1]??t[1],i[2]??t[2]]:[i.x??t[0],i.y??t[1],i.z??t[2]]}function l6(i){return typeof i=="number"?[i,i,i]:Xb(i,[1,1,1])}function ooe(i){let t=i.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)||/^(rgb|hsl)a?\(/.test(t)||Ze.NAMES[t]!==void 0}function QR(i){let t=new yn(0,0,0,1);return t.setStyle(i),{r:t.r,g:t.g,b:t.b}}function loe(i){let t=Object.entries(i.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>e!=="'undefined'");return t.length?t.join(", "):"(none)"}function r6(i,t){let e=i.material??(i.color!==void 0?{color:i.color}:void 0);if(e===void 0)return An.defaultColorMaterial(i6(Er),"physical","layer1","layer2");if(typeof e=="string"){for(let[a,o]of Object.entries(t.shared.materials))if(a===e||o.name===e)return a;if(ooe(e))return An.defaultColorMaterial(QR(e),"physical","layer1","layer2");throw new Error(`createObject: material '${e}' matches no shared material in this document (available: ${loe(t)}) and is not a valid CSS color.`)}if(typeof e=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(a6(e))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=e.color!==void 0?QR(e.color):i6(Er),r=An.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(a=>a.data.type==="light");if(s){let a={};e.roughness!==void 0&&(a.roughness=e.roughness),e.metalness!==void 0&&(a.metalness=e.metalness),e.reflectivity!==void 0&&(a.reflectivity=e.reflectivity),Object.assign(s.data,a)}if(e.alpha!==void 0){let a=r.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:e.alpha})}return r}function i6(i){return{r:(i>>16&255)/255,g:(i>>8&255)/255,b:(i&255)/255}}function coe(i){let t={};for(let[e,n]of Object.entries(i))!toe.has(e)&&n!==void 0&&(t[e]=n);return t}function uoe(i){let t=ma.defaultData("TextGeometry"),{text:e,...n}=i,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=r*350/16),r!==void 0&&n.height===void 0&&(n.height=r*50/16),Object.assign(t,n),e!==void 0&&Object.assign(t,{text:{textValue:String(e)}}),t}var s6=6e4;function N_(i){return Array.isArray(i)?i:ArrayBuffer.isView(i)&&!(i instanceof DataView)?Array.from(i):null}function doe(i){let t=N_(i.vertices);if(!t||t.length<9||t.length%3!==0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let e=t.length/3;if(e>s6)throw new Error(`createObject('CustomMesh'): too many vertices (${e}); keep it under ${s6}.`);let n=N_(i.indices);if(n&&n.length){let d=n.find(h=>!Number.isInteger(h)||h<0||h>=e);if(d!==void 0)throw new Error(`createObject('CustomMesh'): index ${d} is out of range (mesh has ${e} vertices).`)}else n=null;let r=new De;r.setAttribute("position",new Ve(t,3));let s=N_(i.normals),a=s!==null&&s.length===t.length;a&&r.setAttribute("normal",new Ve(s,3));let o=N_(i.uvs);o&&o.length===e*2&&r.setAttribute("uv",new Ve(o,2));let l=!1;if(!a){let d=n??Array.from({length:e},(f,m)=>m),{closed:h,inverted:p}=t6(t,d);if(h&&p){for(let f=0;f+2<d.length;f+=3){let m=d[f+1];d[f+1]=d[f+2],d[f+2]=m}n=d}else h||(l=!0)}n&&r.setIndex(n),a||r.computeVertexNormals();let c=r.toJSON();return{geometry:dP({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:c.data}),doubleSide:l}}function hoe(i,t){let n=P2[i].normalizeInputs({parameters:t});return dP({userData:{type:i,...n}})}function c6(i,t,e){let{objectType:n,geometryType:r}=i,s=coe(t),a={states:new ze,events:new ze,timelineAnimations:new st};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=doe(s);Object.assign(a,ga.defaultData,{geometry:l,materials:[r6(t,e)]}),c&&(a.side=2)}else Object.assign(a,ga.defaultData,{geometry:r==="TextGeometry"?uoe(s):hoe(r,s),material:r6(t,e)});t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow)}else n==="Empty"?Object.assign(a,rf.defaultData):(Object.assign(a,sf.defaultData(n),s),t.color!==void 0&&(a.color=QR(t.color)));a.visible=t.visible??!0,a.position=Xb(t.position,[0,0,0]),a.rotation=Xb(t.rotation,[0,0,0]),a.scale=l6(t.scale);let o=(r&&soe[r])??aoe[n]??n;return a.name=t.name??u6(o,e.scene.objects),a}function u6(i,t){let e=new Set;if(t.traverse((r,s)=>{e.add(s.name??"")}),!e.has(i))return i;let n=2;for(;e.has(`${i} ${n}`);)n++;return`${i} ${n}`}function d6(i,t){let e=we.generateUUID();if(i.data.type==="Component")return{data:{...ya.fromComponentData(i),name:i.data.name+" Instance"},id:e,fi:i.fi,children:[]};t[i.id]=e;let n=i.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,a])=>{let o=we.generateUUID(),l=a.indexOf(r),c=l!==-1?a.slice(0,l)+o+a.slice(l+r.length):a;return[o,s,c]})}),{...i,id:e,data:n,children:i.children.map(r=>d6(r,t))}}function h6(i){let t={},e=d6(i,t);return Y3(e,t)}function p6(i,t,e){let n={...i.data};return t.position!==void 0&&(n.position=Xb(t.position,[0,0,0])),t.rotation!==void 0&&(n.rotation=Xb(t.rotation,[0,0,0])),t.scale!==void 0&&(n.scale=l6(t.scale)),t.visible!==void 0&&(n.visible=t.visible),n.name=t.name??u6(`${i.data.name??"Object"} Copy`,e),{...i,data:n}}fc();fr();sw();Ta();function f6(i){let t=Array.isArray(i)?i[0]:i,e=t.layers?.map(poe)??[],n=t.layers?.find(r=>r.type==="light");return{layers:e,alpha:n?.node.alphaOverride?.value??1}}function poe(i){return i.type==="texture"||i.type==="video"||i.type==="matcap"?{...i.data,updateTexture(t){return i.color.texture.image.updateSrc(t)}}:{...i.data}}function m6(i,t,e){let n=Array.isArray(e)?e[0]:e;if(i[0]==="layers"){let r=parseInt(i[1]),s=n.layers[r],a=i[2];s&&a&&foe(i.slice(2),t,s)}else i[0]==="alpha"&&n.layers.forEach(r=>{r.type==="light"&&r.node.alphaOverride!==void 0&&(r.node.alphaOverride.value=t,t<1&&(n.transparent=!0))})}var Yb=new yn(0,0,0,1);function foe(i,t,e){let n=i[0];try{if(yoe(n,e.type,i.slice(1)))if(n==="colors"){if(i.length<2)throw new Error("You cannot mutate the colors array, only its items");let r=parseInt(i[1]),a=e.getValue(n)?.[r];if(a)Yb.setStyle(t),a.set(Yb.r,Yb.g,Yb.b,Yb.a);else throw new Error("Color index out of range")}else e.getValue(n)?.setStyle(t);else if(n==="texture"||n==="video"){let r=e.color;moe(i.slice(1),t,r,e)}else{let r=i[1],s=e.getValue(n);s?.isVector3&&r!==void 0||s?.isVector2&&r!==void 0?s.setComponent(parseInt(r),t):e.setValue(n,t)}}catch(r){console.error("Error setting material value",r)}}function moe(i,t,e,n){let r=i[0];if(r==="repeat"||r==="offset"||r==="rotation"){let s=n.getNode("mat"),a=s&&typeof s.updateMatrix=="function"?s:n.getValue("mat");if(!a)return;if(r==="rotation")a.rotation=parseFloat(t);else{let o=i[1];if(o===void 0)t instanceof Array&&t.length===2&&Object.assign(a,{[r]:t});else{let l=a[r],c=parseInt(o)===0?[parseFloat(t),l[1]]:[l[0],parseFloat(t)];Object.assign(a,{[r]:c})}}a.updateMatrix()}else r==="wrapping"||r==="minFilter"||r==="magFilter"?r==="wrapping"?e.texture.wrap=t:e.texture[r]=t:r==="image"&&i[1]==="data"&&e.texture.image.updateSrc(t)}var goe={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};function yoe(i,t,e){return!!goe[t]?.includes(i)}ft();ft();var Ale=new j;function Cle(i){let t="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";i.endsWith(".spline")?console.warn(t+" The .spline files are only meant to be used by the Editor."):i.endsWith(".splinecode")||console.warn(t)}async function Ple(i){}function e9(i){let t=new yn(0,0,0,1);try{t.setStyle(i)}catch(e){console.error(e)}return t}var XD=class{constructor(t,{renderOnDemand:e,renderMode:n="auto",wasmPath:r,renderer:s,htmlContentMode:a="sandbox"}={}){this._rendererBackend="webgl";this._rendererAuto=!1;this._rendererConfigured=!1;this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._htmlContentMode="sandbox";this._variablesCache=new Map;this._isPaused=!1;this._renderRequested=!1;this._skipRender=!1;this.time=performance.now();this.dt=0;this.currentTAAFrame=0;this.disposed=!1;this._requestRenderAutoMode=()=>{this._skipRender=!1};this.requestRender=()=>{this._renderRequested=!0};this.render=t=>{if(this.time=t,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),!this._renderer){this._perfs?.end();return}if(!this._isPaused&&(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){this._perfs?.end();return}if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<yU?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{e.type==="ParticleSystem"&&(e.update(this.dt),this._skipRender=!1),io(e)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&e.warnClassicFallbackOnce(),e.isSimulating&&(e.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()};this._resize=t=>{if(!!this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=Ale.set(this._viewportWidth,this._viewportHeight)),t){let e=this._viewportWidth,n=this._viewportHeight;this._renderer.setSize(e-1,n-1,!1),this._renderer.setSize(e,n,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera){let e=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(e!=="fullscreen"),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()}this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}};this._debouncedResize=au(this._resize,10);this._onScroll=t=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())};if(this.canvas=t,this._htmlContentMode=a,this.renderMode=e?"auto":n,r!==void 0&&(this._wasmPath=w3(r,"/")),this._rendererBackend=s??"webgl",s===void 0){let o=null;try{o=new URLSearchParams(window.location.search).get("renderer")}catch{}o==="webgpu"||o==="webgl"||o==="webgl2"?this._rendererBackend=o==="webgl2"?"webgl":o:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(y6(),g6)).then(({Perfs:o})=>{this._perfs=new o({x:10,y:10})}),p3(t)}async _createRenderer(){if(this._rendererBackend==="webgpu"&&!1)try{}catch{}if(this._rendererBackend==="webgpu"&&!1)try{try{}catch{}}catch(t){}{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(qD(),WD));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}throw this._failWebGPURequired(),new Error("[spline] This runtime build is WebGPU-only and the browser provides no WebGPU adapter.")}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,n=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=n*t;let r=this.canvas.getContext("2d");r&&(r.scale(t,t),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",e/2,n/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,n){Cle(t),this.disposed=!1;let s=await(await fetch(t,n)).arrayBuffer();await this.start(s,{variables:e})}async start(t,{interactive:e=!0,variables:n}={}){if(this.disposed)return;Ba.init();let r=await lW(t);this._data=r;let s=cW(r);r.version&&(0,t9.default)(r.version,"2.0.11")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),hW(this._wasmPath));let a=Ple(r);await Promise.all([a,s.length&&FR(this._wasmPath),H2(r)&&XU(this._wasmPath),sG(r)&&bV(this._wasmPath),Uo.physicsEnabled(r.scene.objects)&&H4(this._wasmPath),zP(r)&&jI(),OR(r)&&nW(),bk(r)&&gk(),PI(r)&&a.then(()=>tv()?.loadHanaUIRUNTIME()),E4(r)&&aj(this._wasmPath)].filter(Boolean)),s.length&&await UR(s),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let o=r.scene.publish.renderer;if(this._rendererAuto&&o==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&o==="webgpu"){this._failWebGPURequired();return}let l=pW(r);if(this._rendererBackend==="webgpu"&&!1)try{}catch(p){}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(qD(),WD)),ZW(l)]),AV((this._rendererBackend,"webgl"));let c=new T_(r);if(c.resetPersonalCameraFromDocumentData(),this._scene=c.scene,this._sharedAssetsManager=c.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:p}=await Promise.resolve().then(()=>(Jq(),Qq)),f=performance.now();p(r,c.scene);let m=performance.now();console.log("Merged geometries in ",m-f," ms")}H2(r)&&this._scene.traverse(p=>{hs(p)&&p.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(p=>{oc(p)&&p.pendingMediaLoad&&p.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(p=>{p.type==="ParticleSystem"&&(p.wakeUp(),p.data.autoPlay?p.start():p.stop()),io(p)&&p.setPlayMode(!0)});let u=Object.keys(r.shared.fonts).map(p=>this._sharedAssetsManager.getFont(p).loadingPromise);if(Promise.all(u).then(()=>{this.disposed||(c.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),zP(r)&&Y4(r)&&await Promise.all(u),PI(r)){let p=[];this._scene.traverseEntity(f=>{(vr(f)||f instanceof Cn)&&f.uiCanvas&&p.push(f.uiCanvas)}),await Promise.all(p.map(f=>f.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),km(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0;let p=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),f=this._getPixelRatio(p()?r.scene.publish.settings.web.pixelRatioMobile:r.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(f),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark){let m=this._sharedAssetsManager.getImage("SplineWatermark");await m.loadPromise;let g=m.getTexture(1001);this._renderer.pipeline.setWatermark(g)}}OR(r)&&this._scene.initializeSplatViewer(),r.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(r.scene.blueNoiseTextureData);let d=Object.values(r.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(d.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=d.size[0],this._viewportHeight=d.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new Yw(this._renderer,this._camera,new j(this._viewportWidth,this._viewportHeight),new j(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(d.allowResponsive??!1)&&d.preset==="fullscreen"),e){let p=new Bw(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,d);this._scene.updateMatrixWorld(!0),this._controls=new YE(p),this._animationControls=new A_(this._scene,this._requestRenderAutoMode),this._eventManager=new Hw(r.scene.publish,this._controls,this._animationControls,p,r.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),n!==void 0&&this.setVariables(n),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let h=r.scene.publish.htmlContent?.html;if(e&&h&&this._htmlContentMode!=="none"){let p={shared:this._sharedAssetsManager,findEntity:f=>this._scene?.getObjectByProperty("uuid",f)??this._scene?.getObjectByName(f)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?Xm.mount(this,this.canvas,h,p):qm.mount(this,this.canvas,h,p))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[n,r]of e)this.setVariable(n,r)}}setVariable(t,e){let n=this._getVariableByName(t);if(n&&!("dynamicVariableType"in n.data)){let r=e;typeof n.data.value=="number"?r=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof n.data.value=="boolean"?r=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()==="false"?!1:!!e:typeof n.data.value!="string"&&n.data.value.textValue!==void 0&&(r=e.toString());let s=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(n.id,s),this.requestRender(),this._requestRenderAutoMode()}else n===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in n.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let n=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(n)}}_getVariableValue(t){return typeof t!="string"&&Mr.isTextValue(t)?Mr.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(n=>n.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(e.uuid!==fa&&!this._scene.isInvisibleObjects(e)&&!(e instanceof Cn)){let n=this._createProxyObject(e);n&&t.push(n)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof Jf&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=e9(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,sk(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{mS.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,f3(this.canvas),document.removeEventListener("scroll",this._onScroll),Ba.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);let n;t.traverseAncestors(d=>{d instanceof Cn&&(n=d.name)});let r=this._sharedAssetsManager,s={shared:r,scene:this._scene},a=d=>{if(d===null||d==="Base State")return null;if(d&&t.data.states){let h=t.data.states.find(p=>p.data.name===d);return h?h.id:void 0}},o="material"in t?t.material:void 0,l=t.materialOverride,c={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:n,material:l??(o?f6(o):void 0),parentUuid:t.parent instanceof Cn||t instanceof $u?void 0:t.parent?.uuid,emitEvent(d){t.dispatchEvent({type:"userEvent",eventName:d})},emitEventReverse(d){t.dispatchEvent({type:"userEvent",eventName:d,reverse:!0})},hide(){t.visible&&(t.visible=!1,s.shared.requestRender())},show(){t.visible||(t.visible=!0,s.shared.requestRender())},get state(){let d=t.stateSelection;if(d!==null)return t.data.states.find(({id:h})=>h===d)?.data.name},set state(d){let h;if(d!==void 0){let p=typeof d=="string"?t.data.states.find(({id:f})=>f===d):t.data.states[d];if(p)h=p.id;else{let f=typeof d=="string"?a(d):void 0;f&&(h=f)}}t.changeSelectedState(h??null,s),t.currentState=h??null,t.dispatchEvent({type:"completeState",state:h??null}),s.shared.requestRender()},transition(d){let h=x5();if(h===null)return Jn("transitions","obj.transition()"),{transition(v){return this},play(){return this},pause(){return this},reset(){return this},seek(v){return this}};let p=this,f,m=Ba.timeline({autoplay:d.autoPlay??!0}),g={transition({from:y,to:v,duration:b,delay:x,...S}){let E=a(y);E===void 0&&(E=f);let M=a(v);f=M;let w=new h(t,E,M,{state:M,repeat:0,delay:x??0,delayDirection:"start-once",direction:"normal",duration:b??1e3,...S,...S.easing===6?Yp.defaultData:S.easing===5?$p.defaultData:{}},r,!1,e.activePage);return m.add({...w.params,begin:()=>{(y&&E||y==="Base State"&&!E)&&(p.state=E??void 0)},complete:()=>{p.state=M??void 0}},m.duration),this},play(){return m.play(),this},pause(){return m.pause(),this},reset(){return m.reset(),this},seek(y){return m.seek(y),this}};return g.transition(d),g},set color(d){let h=e9(d);if(Xf.is(t)){t.color=h;return}else if(t.type!=="Mesh"||!("material"in t)||!(t instanceof _r))return;let p={r:h.r,g:h.g,b:h.b,a:h.a},f=t.materialOverride;if(f!==void 0){let y=f.color;y?.isColor===!0&&typeof y.setStyle=="function"&&(y.setStyle(d),s.shared.requestRender());return}let m=Array.isArray(t.material)?t.material[0]:t.material,g=m.data.layers.find(y=>y.data.type==="color")?.id;if(g)m.updateByOp({type:0,path:["layers",g],props:{color:{...p}}},m.data,s);else{let y=m.data,v=y.layers.find(T=>T.data.type==="light");if(!v)return;let b=y.layers.indexOf(v)===0?v:null,x=y.layers.at(b?y.layers.indexOf(b)+1:0),S=b?b.fi+(x?(x.fi-b.fi)/2:1):x?x.fi/2:1,E={type:4,fi:S,id:we.generateUUID(),data:{...Qn.defaultData("color"),color:p},localIndex:0},M=y.layers.insertAfterHelper(b?.id??null,1),w=y.layers.runOp({...E,fi:M[0]}).data;Object.assign(m.data,{layers:w}),m.updateByOp({...E,path:["layers"]},m.data,s)}}},u=mS(c,(d,h)=>{let p=t[d],f=Ile(d);f[0]==="material"&&o&&l===void 0&&m6(f.slice(1),h,o),typeof p!="object"&&Object.getOwnPropertyDescriptor(t,d)?.writable&&(t[d]=h),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,u),u}setUIWasmUrl(t){RU(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let n;if(typeof e=="string")if(e.endsWith(".splinegeometry")){let u=await(await fetch(e)).arrayBuffer();n=new Uint8Array(u)}else throw new Error("Only .splinegeometry format is supported");else n=e;let r=Fd.deserialize(n),s="data"in r&&r.data.draco!==void 0;s&&await FR(this._wasmPath);let a=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!a){console.warn(`Object ${t} not found`);return}if(a.data.type!=="Mesh"||!(a instanceof _r)){console.warn(`Object ${t} is not a mesh`);return}let o=a,l={...o.data,geometry:r};s&&await UR([l]),o.updateByOp({type:0,path:[],props:{geometry:l.geometry}},l,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let c of o.data.states){let u={...c.data};o.states||(o.states={}),o.states[c.id]=to.patch(l,u)}return n}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let n=e.path;Array.isArray(n)&&n.length===2&&n[0]==="scene"&&n[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,n=this._findEntity(e);if(!n)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return n.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=Cw();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let n=t(e);if(typeof n!="object"||n===null||n.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return n}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let n=this._scene;if(!n)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t.uuid,s=this._findEntity(r);if(!s)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(s instanceof _r))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let a=typeof e=="function"?await this.createCustomMaterial(e):e;if(jf()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let o=JR({material:a});if(o.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(o.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),o.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let s=o6(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let{options:a,material:o}=JR(e);if(o!==void 0){if(s.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(jf()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}let l,c;if(s.geometryType==="TextGeometry"){if(!AU("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await jI(),c=e.font??Jp,r.shared.fonts[c]===void 0){if(c!==Jp){let y=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${c}' is not in this document \u2014 available fonts: ${y||"(none)"}.`)}l={name:Jp,url:SF}}}let u=this._resolveParentId(e.parent),d=c6(s,a,r),h=we.generateUUID(),[p,f]=Nd(r);l&&(p.shared.fonts[Jp]=l),p.scene.objects.insertAfter(u,null,[{id:h,data:d,children:[]}]);let m=f.result();if(l&&this._sharedAssetsManager.addFont(Jp,l),c!==void 0){let y=this._sharedAssetsManager.getFont(c);y&&await y.loadingPromise}this._applyDocumentTransaction(m);let g=n.find(h);return o!==void 0&&g.setMaterialOverride(o,{scene:n,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let s=typeof t=="string"?t:t?.uuid,a=s?this._findEntity(s):void 0;if(!a)throw new Error(`cloneObject: '${s}' \u2014 no object with that name or uuid in the scene.`);if(a instanceof Cn)throw new Error("cloneObject: pages cannot be cloned.");let o=r.scene.objects.get(a.uuid);if(!o)throw new Error(`cloneObject: '${s}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let l=p6(h6(o),e,r.scene.objects),c=e.parent!==void 0?this._resolveParentId(e.parent):r.scene.objects.parent(a.uuid)??null,u=e.parent!==void 0?null:a.uuid,[d,h]=Nd(r);d.scene.objects.insertAfter(c,u,[l]),this._applyDocumentTransaction(h.result());let p=n.find(l.id);return this._requestRenderAutoMode(),this._createProxyObject(p)}removeObject(t){let e=this._scene,n=this._data;if(this.disposed||!e||!n)return!1;let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)return!1;if(s instanceof Cn)throw new Error("removeObject: pages cannot be removed.");if(s.data.type==="PerspectiveCamera"||s.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(n.scene.objects.get(s.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let a=[];s.traverseEntity(c=>{a.push(c.uuid)});let[o,l]=Nd(n);o.scene.objects.delete(s.uuid),this._applyDocumentTransaction(l.result());for(let c of a){let u=this._proxyObjectCache.get(c);u&&(mS.unsubscribe(u),this._proxyObjectCache.delete(c))}return this._requestRenderAutoMode(),!0}};function Ile(i){return i.split(".")}
9892
+ `,Xm=class{constructor(t,e,n,r,s){this.container=t;this.host=e;this.observer=n;this.previousSplineGlobal=r;this.removeLateLifecycleShim=s}static mount(t,e,n,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let a=document.createElement("div");a.setAttribute(L_,"");let o=a.style;o.position="absolute",o.overflow="hidden";let l=()=>{o.left=`${e.offsetLeft}px`,o.top=`${e.offsetTop}px`,o.width=`${e.offsetWidth}px`,o.height=`${e.offsetHeight}px`};l();let c=new ResizeObserver(l);c.observe(e),c.observe(s);let u=document.createElement("style");u.textContent=eoe,a.appendChild(u);let d=new DOMParser().parseFromString(n,"text/html"),h=Array.from(d.querySelectorAll("script"));for(let x of h)x.remove();for(let x of Array.from(d.head.children))(x.tagName==="STYLE"||x.tagName==="LINK"&&x.rel==="stylesheet")&&a.appendChild(x);for(;d.body.firstChild;)a.appendChild(d.body.firstChild);s.insertBefore(a,e.nextSibling);let p=(x,S)=>{x==="warn"?console.warn(`[spline html] ${S}`):x==="error"&&console.error(`[spline html] ${S}`)},f=new Map,m=new kp(ZR(t,e,r),p,(x,S)=>{let E=f.get(x);if(!!E)for(let M of E)try{M(S)}catch(w){console.error(w)}}),g=(x,S)=>{try{return Promise.resolve(m.execute(x,S))}catch(E){return Promise.reject(E)}},y={ready:Promise.resolve(),setVariable:(x,S)=>g("setVariable",[x,S]),setVariables:x=>g("setVariables",[x]),getVariable:x=>g("getVariable",[x]),getVariables:()=>g("getVariables",[]),getAllObjects:()=>g("getAllObjects",[]),findObjectByName:x=>g("findObjectByName",[x]),findObjectById:x=>g("findObjectById",[x]),getGeometry:(x,S)=>g("getGeometry",[x,S??{}]),updateObject:(x,S)=>g("updateObject",[x,S]),createObject:(x,S)=>g("createObject",[x,S??{}]),createCustomMaterial:x=>g("createCustomMaterial",[x]),setMaterial:(x,S)=>g("setMaterial",[x,S]),cloneObject:(x,S)=>g("cloneObject",[x,S??{}]),removeObject:x=>g("removeObject",[x]),spawnObject:(x,S)=>g("spawnObject",[x,S??{}]),destroyObject:x=>g("destroyObject",[x]),setInstanceTransforms:(x,S)=>g("setInstanceTransforms",[x,S??null]),emitEvent:(x,S)=>g("emitEvent",[x,S]),emitEventReverse:(x,S)=>g("emitEventReverse",[x,S]),requestRender:()=>g("requestRender",[]),addEventListener:(x,S)=>{if(typeof S!="function")return;let E=f.get(x);E||(E=new Set,f.set(x,E),g("listenEvent",[x])),E.add(S)},removeEventListener:(x,S)=>{let E=f.get(x);!E||(E.delete(S),E.size===0&&(f.delete(x),g("unlistenEvent",[x])))}},v=window.spline;window.spline=y;let b=F3();for(let x of h){let S=document.createElement("script");for(let E of Array.from(x.attributes))S.setAttribute(E.name,E.value);x.src?S.async=!1:S.textContent=x.textContent,a.appendChild(S)}return new Xm(a,m,c,v,b)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline!==void 0&&(window.spline=this.previousSplineGlobal)}};ft();an();Y();I2();Ta();function t6(i,t){let e=i.length/3,n=new Map,r=new Array(e);for(let l=0;l<e;l++){let c=`${Math.round(i[3*l]*1e4)},${Math.round(i[3*l+1]*1e4)},${Math.round(i[3*l+2]*1e4)}`,u=n.get(c);u===void 0?(n.set(c,l),r[l]=l):r[l]=u}let s=new Map;for(let l=0;l+2<t.length;l+=3){let c=r[t[l]],u=r[t[l+1]],d=r[t[l+2]];for(let[h,p]of[[c,u],[u,d],[d,c]]){if(h===p)continue;let f=h<p?h+"_"+p:p+"_"+h;s.set(f,(s.get(f)??0)+1)}}let a=s.size>0;for(let l of s.values())if(l!==2){a=!1;break}if(!a)return{closed:!1,inverted:!1};let o=0;for(let l=0;l+2<t.length;l+=3){let c=t[l]*3,u=t[l+1]*3,d=t[l+2]*3,h=i[c],p=i[c+1],f=i[c+2],m=i[u],g=i[u+1],y=i[u+2],v=i[d],b=i[d+1],x=i[d+2];o+=h*(g*x-y*b)+p*(y*v-m*x)+f*(m*b-g*v)}return{closed:!0,inverted:o<0}}an();ft();cU();fc();function a6(i){return typeof i=="object"&&i!==null&&i.isMaterial===!0}function JR(i){if(typeof i.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!a6(i.material))return{options:i};let t=i.material;if(t.isNodeMaterial===!0){let e=Cw()?.NodeMaterial;if(e!==void 0&&t instanceof e)return{options:{...i,material:void 0},material:t};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(t.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...i,material:void 0},material:t}}var toe=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),n6="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",noe={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},roe={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},ioe={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},soe={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},aoe={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function o6(i){if(typeof i!="string"||i.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${n6}.`);let t=i.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),e=roe[t];if(e)return{objectType:e};let n=noe[t];if(n)return{objectType:"Mesh",geometryType:n};let r=ioe[t];throw r?new Error(`createObject: '${i}' is not supported \u2014 ${r}`):new Error(`createObject: '${i}' is not a creatable Spline type \u2014 use one of ${n6}, e.g. createObject('Cube', { width: 200 }).`)}function Xb(i,t){return i===void 0?[t[0],t[1],t[2]]:Array.isArray(i)?[i[0]??t[0],i[1]??t[1],i[2]??t[2]]:[i.x??t[0],i.y??t[1],i.z??t[2]]}function l6(i){return typeof i=="number"?[i,i,i]:Xb(i,[1,1,1])}function ooe(i){let t=i.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)||/^(rgb|hsl)a?\(/.test(t)||Ze.NAMES[t]!==void 0}function QR(i){let t=new yn(0,0,0,1);return t.setStyle(i),{r:t.r,g:t.g,b:t.b}}function loe(i){let t=Object.entries(i.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>e!=="'undefined'");return t.length?t.join(", "):"(none)"}function r6(i,t){let e=i.material??(i.color!==void 0?{color:i.color}:void 0);if(e===void 0)return An.defaultColorMaterial(i6(Er),"physical","layer1","layer2");if(typeof e=="string"){for(let[a,o]of Object.entries(t.shared.materials))if(a===e||o.name===e)return a;if(ooe(e))return An.defaultColorMaterial(QR(e),"physical","layer1","layer2");throw new Error(`createObject: material '${e}' matches no shared material in this document (available: ${loe(t)}) and is not a valid CSS color.`)}if(typeof e=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(a6(e))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=e.color!==void 0?QR(e.color):i6(Er),r=An.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(a=>a.data.type==="light");if(s){let a={};e.roughness!==void 0&&(a.roughness=e.roughness),e.metalness!==void 0&&(a.metalness=e.metalness),e.reflectivity!==void 0&&(a.reflectivity=e.reflectivity),Object.assign(s.data,a)}if(e.alpha!==void 0){let a=r.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:e.alpha})}return r}function i6(i){return{r:(i>>16&255)/255,g:(i>>8&255)/255,b:(i&255)/255}}function coe(i){let t={};for(let[e,n]of Object.entries(i))!toe.has(e)&&n!==void 0&&(t[e]=n);return t}function uoe(i){let t=ma.defaultData("TextGeometry"),{text:e,...n}=i,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=r*350/16),r!==void 0&&n.height===void 0&&(n.height=r*50/16),Object.assign(t,n),e!==void 0&&Object.assign(t,{text:{textValue:String(e)}}),t}var s6=6e4;function N_(i){return Array.isArray(i)?i:ArrayBuffer.isView(i)&&!(i instanceof DataView)?Array.from(i):null}function doe(i){let t=N_(i.vertices);if(!t||t.length<9||t.length%3!==0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let e=t.length/3;if(e>s6)throw new Error(`createObject('CustomMesh'): too many vertices (${e}); keep it under ${s6}.`);let n=N_(i.indices);if(n&&n.length){let d=n.find(h=>!Number.isInteger(h)||h<0||h>=e);if(d!==void 0)throw new Error(`createObject('CustomMesh'): index ${d} is out of range (mesh has ${e} vertices).`)}else n=null;let r=new De;r.setAttribute("position",new Ve(t,3));let s=N_(i.normals),a=s!==null&&s.length===t.length;a&&r.setAttribute("normal",new Ve(s,3));let o=N_(i.uvs);o&&o.length===e*2&&r.setAttribute("uv",new Ve(o,2));let l=!1;if(!a){let d=n??Array.from({length:e},(f,m)=>m),{closed:h,inverted:p}=t6(t,d);if(h&&p){for(let f=0;f+2<d.length;f+=3){let m=d[f+1];d[f+1]=d[f+2],d[f+2]=m}n=d}else h||(l=!0)}n&&r.setIndex(n),a||r.computeVertexNormals();let c=r.toJSON();return{geometry:dP({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:c.data}),doubleSide:l}}function hoe(i,t){let n=P2[i].normalizeInputs({parameters:t});return dP({userData:{type:i,...n}})}function c6(i,t,e){let{objectType:n,geometryType:r}=i,s=coe(t),a={states:new ze,events:new ze,timelineAnimations:new st};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=doe(s);Object.assign(a,ga.defaultData,{geometry:l,materials:[r6(t,e)]}),c&&(a.side=2)}else Object.assign(a,ga.defaultData,{geometry:r==="TextGeometry"?uoe(s):hoe(r,s),material:r6(t,e)});t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow)}else n==="Empty"?Object.assign(a,rf.defaultData):(Object.assign(a,sf.defaultData(n),s),t.color!==void 0&&(a.color=QR(t.color)));a.visible=t.visible??!0,a.position=Xb(t.position,[0,0,0]),a.rotation=Xb(t.rotation,[0,0,0]),a.scale=l6(t.scale);let o=(r&&soe[r])??aoe[n]??n;return a.name=t.name??u6(o,e.scene.objects),a}function u6(i,t){let e=new Set;if(t.traverse((r,s)=>{e.add(s.name??"")}),!e.has(i))return i;let n=2;for(;e.has(`${i} ${n}`);)n++;return`${i} ${n}`}function d6(i,t){let e=we.generateUUID();if(i.data.type==="Component")return{data:{...ya.fromComponentData(i),name:i.data.name+" Instance"},id:e,fi:i.fi,children:[]};t[i.id]=e;let n=i.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,a])=>{let o=we.generateUUID(),l=a.indexOf(r),c=l!==-1?a.slice(0,l)+o+a.slice(l+r.length):a;return[o,s,c]})}),{...i,id:e,data:n,children:i.children.map(r=>d6(r,t))}}function h6(i){let t={},e=d6(i,t);return Y3(e,t)}function p6(i,t,e){let n={...i.data};return t.position!==void 0&&(n.position=Xb(t.position,[0,0,0])),t.rotation!==void 0&&(n.rotation=Xb(t.rotation,[0,0,0])),t.scale!==void 0&&(n.scale=l6(t.scale)),t.visible!==void 0&&(n.visible=t.visible),n.name=t.name??u6(`${i.data.name??"Object"} Copy`,e),{...i,data:n}}fc();fr();sw();Ta();function f6(i){let t=Array.isArray(i)?i[0]:i,e=t.layers?.map(poe)??[],n=t.layers?.find(r=>r.type==="light");return{layers:e,alpha:n?.node.alphaOverride?.value??1}}function poe(i){return i.type==="texture"||i.type==="video"||i.type==="matcap"?{...i.data,updateTexture(t){return i.color.texture.image.updateSrc(t)}}:{...i.data}}function m6(i,t,e){let n=Array.isArray(e)?e[0]:e;if(i[0]==="layers"){let r=parseInt(i[1]),s=n.layers[r],a=i[2];s&&a&&foe(i.slice(2),t,s)}else i[0]==="alpha"&&n.layers.forEach(r=>{r.type==="light"&&r.node.alphaOverride!==void 0&&(r.node.alphaOverride.value=t,t<1&&(n.transparent=!0))})}var Yb=new yn(0,0,0,1);function foe(i,t,e){let n=i[0];try{if(yoe(n,e.type,i.slice(1)))if(n==="colors"){if(i.length<2)throw new Error("You cannot mutate the colors array, only its items");let r=parseInt(i[1]),a=e.getValue(n)?.[r];if(a)Yb.setStyle(t),a.set(Yb.r,Yb.g,Yb.b,Yb.a);else throw new Error("Color index out of range")}else e.getValue(n)?.setStyle(t);else if(n==="texture"||n==="video"){let r=e.color;moe(i.slice(1),t,r,e)}else{let r=i[1],s=e.getValue(n);s?.isVector3&&r!==void 0||s?.isVector2&&r!==void 0?s.setComponent(parseInt(r),t):e.setValue(n,t)}}catch(r){console.error("Error setting material value",r)}}function moe(i,t,e,n){let r=i[0];if(r==="repeat"||r==="offset"||r==="rotation"){let s=n.getNode("mat"),a=s&&typeof s.updateMatrix=="function"?s:n.getValue("mat");if(!a)return;if(r==="rotation")a.rotation=parseFloat(t);else{let o=i[1];if(o===void 0)t instanceof Array&&t.length===2&&Object.assign(a,{[r]:t});else{let l=a[r],c=parseInt(o)===0?[parseFloat(t),l[1]]:[l[0],parseFloat(t)];Object.assign(a,{[r]:c})}}a.updateMatrix()}else r==="wrapping"||r==="minFilter"||r==="magFilter"?r==="wrapping"?e.texture.wrap=t:e.texture[r]=t:r==="image"&&i[1]==="data"&&e.texture.image.updateSrc(t)}var goe={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};function yoe(i,t,e){return!!goe[t]?.includes(i)}ft();ft();var Ale=new j;function Cle(i){let t="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";i.endsWith(".spline")?console.warn(t+" The .spline files are only meant to be used by the Editor."):i.endsWith(".splinecode")||console.warn(t)}async function Ple(i){}function e9(i){let t=new yn(0,0,0,1);try{t.setStyle(i)}catch(e){console.error(e)}return t}var XD=class{constructor(t,{renderOnDemand:e,renderMode:n="auto",wasmPath:r,renderer:s,htmlContentMode:a="sandbox"}={}){this._rendererBackend="webgl";this._rendererAuto=!1;this._rendererConfigured=!1;this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._htmlContentMode="sandbox";this._variablesCache=new Map;this._isPaused=!1;this._renderRequested=!1;this._skipRender=!1;this.time=performance.now();this.dt=0;this.currentTAAFrame=0;this.disposed=!1;this._requestRenderAutoMode=()=>{this._skipRender=!1};this.requestRender=()=>{this._renderRequested=!0};this.render=t=>{if(this.time=t,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),!this._renderer){this._perfs?.end();return}if(!this._isPaused&&(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){this._perfs?.end();return}if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<yU?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{e.type==="ParticleSystem"&&(e.update(this.dt),this._skipRender=!1),io(e)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&e.warnClassicFallbackOnce(),e.isSimulating&&(e.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()};this._resize=t=>{if(!!this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=Ale.set(this._viewportWidth,this._viewportHeight)),t){let e=this._viewportWidth,n=this._viewportHeight;this._renderer.setSize(e-1,n-1,!1),this._renderer.setSize(e,n,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera){let e=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(e!=="fullscreen"),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()}this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}};this._debouncedResize=au(this._resize,10);this._onScroll=t=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())};if(this.canvas=t,this._htmlContentMode=a,this.renderMode=e?"auto":n,r!==void 0&&(this._wasmPath=w3(r,"/")),this._rendererBackend=s??"webgl",s===void 0){let o=null;try{o=new URLSearchParams(window.location.search).get("renderer")}catch{}o==="webgpu"||o==="webgl"||o==="webgl2"?this._rendererBackend=o==="webgl2"?"webgl":o:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(y6(),g6)).then(({Perfs:o})=>{this._perfs=new o({x:10,y:10})}),p3(t)}async _createRenderer(){if(this._rendererBackend==="webgpu"&&!1)try{}catch{}if(this._rendererBackend==="webgpu"&&!1)try{try{}catch{}}catch(t){}{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(qD(),WD));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}throw this._failWebGPURequired(),new Error("[spline] This runtime build is WebGPU-only and the browser provides no WebGPU adapter.")}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,n=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=n*t;let r=this.canvas.getContext("2d");r&&(r.scale(t,t),r.fillStyle="rgba(127, 127, 127, 0.85)",r.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",r.textAlign="center",r.textBaseline="middle",r.fillText("This scene requires a WebGPU-capable browser.",e/2,n/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,n){Cle(t),this.disposed=!1;let s=await(await fetch(t,n)).arrayBuffer();await this.start(s,{variables:e})}async start(t,{interactive:e=!0,variables:n}={}){if(this.disposed)return;Ba.init();let r=await lW(t);this._data=r;let s=cW(r);r.version&&(0,t9.default)(r.version,"2.0.13")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),hW(this._wasmPath));let a=Ple(r);await Promise.all([a,s.length&&FR(this._wasmPath),H2(r)&&XU(this._wasmPath),sG(r)&&bV(this._wasmPath),Uo.physicsEnabled(r.scene.objects)&&H4(this._wasmPath),zP(r)&&jI(),OR(r)&&nW(),bk(r)&&gk(),PI(r)&&a.then(()=>tv()?.loadHanaUIRUNTIME()),E4(r)&&aj(this._wasmPath)].filter(Boolean)),s.length&&await UR(s),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let o=r.scene.publish.renderer;if(this._rendererAuto&&o==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&o==="webgpu"){this._failWebGPURequired();return}let l=pW(r);if(this._rendererBackend==="webgpu"&&!1)try{}catch(p){}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(qD(),WD)),ZW(l)]),AV((this._rendererBackend,"webgl"));let c=new T_(r);if(c.resetPersonalCameraFromDocumentData(),this._scene=c.scene,this._sharedAssetsManager=c.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:p}=await Promise.resolve().then(()=>(Jq(),Qq)),f=performance.now();p(r,c.scene);let m=performance.now();console.log("Merged geometries in ",m-f," ms")}H2(r)&&this._scene.traverse(p=>{hs(p)&&p.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(p=>{oc(p)&&p.pendingMediaLoad&&p.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(p=>{p.type==="ParticleSystem"&&(p.wakeUp(),p.data.autoPlay?p.start():p.stop()),io(p)&&p.setPlayMode(!0)});let u=Object.keys(r.shared.fonts).map(p=>this._sharedAssetsManager.getFont(p).loadingPromise);if(Promise.all(u).then(()=>{this.disposed||(c.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),zP(r)&&Y4(r)&&await Promise.all(u),PI(r)){let p=[];this._scene.traverseEntity(f=>{(vr(f)||f instanceof Cn)&&f.uiCanvas&&p.push(f.uiCanvas)}),await Promise.all(p.map(f=>f.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),km(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0;let p=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),f=this._getPixelRatio(p()?r.scene.publish.settings.web.pixelRatioMobile:r.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(f),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark){let m=this._sharedAssetsManager.getImage("SplineWatermark");await m.loadPromise;let g=m.getTexture(1001);this._renderer.pipeline.setWatermark(g)}}OR(r)&&this._scene.initializeSplatViewer(),r.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(r.scene.blueNoiseTextureData);let d=Object.values(r.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(d.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=d.size[0],this._viewportHeight=d.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new Yw(this._renderer,this._camera,new j(this._viewportWidth,this._viewportHeight),new j(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(d.allowResponsive??!1)&&d.preset==="fullscreen"),e){let p=new Bw(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,d);this._scene.updateMatrixWorld(!0),this._controls=new YE(p),this._animationControls=new A_(this._scene,this._requestRenderAutoMode),this._eventManager=new Hw(r.scene.publish,this._controls,this._animationControls,p,r.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),n!==void 0&&this.setVariables(n),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let h=r.scene.publish.htmlContent?.html;if(e&&h&&this._htmlContentMode!=="none"){let p={shared:this._sharedAssetsManager,findEntity:f=>this._scene?.getObjectByProperty("uuid",f)??this._scene?.getObjectByName(f)};this._htmlContentOverlay=(this._htmlContentMode==="inline"?Xm.mount(this,this.canvas,h,p):qm.mount(this,this.canvas,h,p))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[n,r]of e)this.setVariable(n,r)}}setVariable(t,e){let n=this._getVariableByName(t);if(n&&!("dynamicVariableType"in n.data)){let r=e;typeof n.data.value=="number"?r=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e):typeof n.data.value=="boolean"?r=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()==="false"?!1:!!e:typeof n.data.value!="string"&&n.data.value.textValue!==void 0&&(r=e.toString());let s=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(n.id,s),this.requestRender(),this._requestRenderAutoMode()}else n===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in n.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let n=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(n)}}_getVariableValue(t){return typeof t!="string"&&Mr.isTextValue(t)?Mr.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(n=>n.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(e.uuid!==fa&&!this._scene.isInvisibleObjects(e)&&!(e instanceof Cn)){let n=this._createProxyObject(e);n&&t.push(n)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof Jf&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=e9(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,sk(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{mS.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,f3(this.canvas),document.removeEventListener("scroll",this._onScroll),Ba.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);let n;t.traverseAncestors(d=>{d instanceof Cn&&(n=d.name)});let r=this._sharedAssetsManager,s={shared:r,scene:this._scene},a=d=>{if(d===null||d==="Base State")return null;if(d&&t.data.states){let h=t.data.states.find(p=>p.data.name===d);return h?h.id:void 0}},o="material"in t?t.material:void 0,l=t.materialOverride,c={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:n,material:l??(o?f6(o):void 0),parentUuid:t.parent instanceof Cn||t instanceof $u?void 0:t.parent?.uuid,emitEvent(d){t.dispatchEvent({type:"userEvent",eventName:d})},emitEventReverse(d){t.dispatchEvent({type:"userEvent",eventName:d,reverse:!0})},hide(){t.visible&&(t.visible=!1,s.shared.requestRender())},show(){t.visible||(t.visible=!0,s.shared.requestRender())},get state(){let d=t.stateSelection;if(d!==null)return t.data.states.find(({id:h})=>h===d)?.data.name},set state(d){let h;if(d!==void 0){let p=typeof d=="string"?t.data.states.find(({id:f})=>f===d):t.data.states[d];if(p)h=p.id;else{let f=typeof d=="string"?a(d):void 0;f&&(h=f)}}t.changeSelectedState(h??null,s),t.currentState=h??null,t.dispatchEvent({type:"completeState",state:h??null}),s.shared.requestRender()},transition(d){let h=x5();if(h===null)return Jn("transitions","obj.transition()"),{transition(v){return this},play(){return this},pause(){return this},reset(){return this},seek(v){return this}};let p=this,f,m=Ba.timeline({autoplay:d.autoPlay??!0}),g={transition({from:y,to:v,duration:b,delay:x,...S}){let E=a(y);E===void 0&&(E=f);let M=a(v);f=M;let w=new h(t,E,M,{state:M,repeat:0,delay:x??0,delayDirection:"start-once",direction:"normal",duration:b??1e3,...S,...S.easing===6?Yp.defaultData:S.easing===5?$p.defaultData:{}},r,!1,e.activePage);return m.add({...w.params,begin:()=>{(y&&E||y==="Base State"&&!E)&&(p.state=E??void 0)},complete:()=>{p.state=M??void 0}},m.duration),this},play(){return m.play(),this},pause(){return m.pause(),this},reset(){return m.reset(),this},seek(y){return m.seek(y),this}};return g.transition(d),g},set color(d){let h=e9(d);if(Xf.is(t)){t.color=h;return}else if(t.type!=="Mesh"||!("material"in t)||!(t instanceof _r))return;let p={r:h.r,g:h.g,b:h.b,a:h.a},f=t.materialOverride;if(f!==void 0){let y=f.color;y?.isColor===!0&&typeof y.setStyle=="function"&&(y.setStyle(d),s.shared.requestRender());return}let m=Array.isArray(t.material)?t.material[0]:t.material,g=m.data.layers.find(y=>y.data.type==="color")?.id;if(g)m.updateByOp({type:0,path:["layers",g],props:{color:{...p}}},m.data,s);else{let y=m.data,v=y.layers.find(T=>T.data.type==="light");if(!v)return;let b=y.layers.indexOf(v)===0?v:null,x=y.layers.at(b?y.layers.indexOf(b)+1:0),S=b?b.fi+(x?(x.fi-b.fi)/2:1):x?x.fi/2:1,E={type:4,fi:S,id:we.generateUUID(),data:{...Qn.defaultData("color"),color:p},localIndex:0},M=y.layers.insertAfterHelper(b?.id??null,1),w=y.layers.runOp({...E,fi:M[0]}).data;Object.assign(m.data,{layers:w}),m.updateByOp({...E,path:["layers"]},m.data,s)}}},u=mS(c,(d,h)=>{let p=t[d],f=Ile(d);f[0]==="material"&&o&&l===void 0&&m6(f.slice(1),h,o),typeof p!="object"&&Object.getOwnPropertyDescriptor(t,d)?.writable&&(t[d]=h),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,u),u}setUIWasmUrl(t){RU(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let n;if(typeof e=="string")if(e.endsWith(".splinegeometry")){let u=await(await fetch(e)).arrayBuffer();n=new Uint8Array(u)}else throw new Error("Only .splinegeometry format is supported");else n=e;let r=Fd.deserialize(n),s="data"in r&&r.data.draco!==void 0;s&&await FR(this._wasmPath);let a=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!a){console.warn(`Object ${t} not found`);return}if(a.data.type!=="Mesh"||!(a instanceof _r)){console.warn(`Object ${t} is not a mesh`);return}let o=a,l={...o.data,geometry:r};s&&await UR([l]),o.updateByOp({type:0,path:[],props:{geometry:l.geometry}},l,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let c of o.data.states){let u={...c.data};o.states||(o.states={}),o.states[c.id]=to.patch(l,u)}return n}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let n=e.path;Array.isArray(n)&&n.length===2&&n[0]==="scene"&&n[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,n=this._findEntity(e);if(!n)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return n.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=Cw();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let n=t(e);if(typeof n!="object"||n===null||n.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return n}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let n=this._scene;if(!n)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t.uuid,s=this._findEntity(r);if(!s)throw new Error(`setMaterial: '${r}' \u2014 no object with that name or uuid in the scene.`);if(!(s instanceof _r))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let a=typeof e=="function"?await this.createCustomMaterial(e):e;if(jf()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let o=JR({material:a});if(o.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(o.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),o.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let s=o6(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let{options:a,material:o}=JR(e);if(o!==void 0){if(s.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(jf()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}let l,c;if(s.geometryType==="TextGeometry"){if(!AU("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await jI(),c=e.font??Jp,r.shared.fonts[c]===void 0){if(c!==Jp){let y=Object.keys(r.shared.fonts).join(", ");throw new Error(`createObject: font '${c}' is not in this document \u2014 available fonts: ${y||"(none)"}.`)}l={name:Jp,url:SF}}}let u=this._resolveParentId(e.parent),d=c6(s,a,r),h=we.generateUUID(),[p,f]=Nd(r);l&&(p.shared.fonts[Jp]=l),p.scene.objects.insertAfter(u,null,[{id:h,data:d,children:[]}]);let m=f.result();if(l&&this._sharedAssetsManager.addFont(Jp,l),c!==void 0){let y=this._sharedAssetsManager.getFont(c);y&&await y.loadingPromise}this._applyDocumentTransaction(m);let g=n.find(h);return o!==void 0&&g.setMaterialOverride(o,{scene:n,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let s=typeof t=="string"?t:t?.uuid,a=s?this._findEntity(s):void 0;if(!a)throw new Error(`cloneObject: '${s}' \u2014 no object with that name or uuid in the scene.`);if(a instanceof Cn)throw new Error("cloneObject: pages cannot be cloned.");let o=r.scene.objects.get(a.uuid);if(!o)throw new Error(`cloneObject: '${s}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let l=p6(h6(o),e,r.scene.objects),c=e.parent!==void 0?this._resolveParentId(e.parent):r.scene.objects.parent(a.uuid)??null,u=e.parent!==void 0?null:a.uuid,[d,h]=Nd(r);d.scene.objects.insertAfter(c,u,[l]),this._applyDocumentTransaction(h.result());let p=n.find(l.id);return this._requestRenderAutoMode(),this._createProxyObject(p)}removeObject(t){let e=this._scene,n=this._data;if(this.disposed||!e||!n)return!1;let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)return!1;if(s instanceof Cn)throw new Error("removeObject: pages cannot be removed.");if(s.data.type==="PerspectiveCamera"||s.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(n.scene.objects.get(s.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let a=[];s.traverseEntity(c=>{a.push(c.uuid)});let[o,l]=Nd(n);o.scene.objects.delete(s.uuid),this._applyDocumentTransaction(l.result());for(let c of a){let u=this._proxyObjectCache.get(c);u&&(mS.unsubscribe(u),this._proxyObjectCache.delete(c))}return this._requestRenderAutoMode(),!0}};function Ile(i){return i.split(".")}