@splinetool/runtime 2.0.77 → 2.0.78

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 (318) hide show
  1. package/build/{runtime-bloom-SGWFTQ43.js → runtime-bloom-BLGIKDNQ.js} +1 -1
  2. package/build/runtime-bloom-BLGIKDNQ.js.br +0 -0
  3. package/build/runtime-bloom-BLGIKDNQ.js.gz +0 -0
  4. package/build/{runtime-brightnessContrast-3UTV7FCG.js → runtime-brightnessContrast-AKEVG3HR.js} +1 -1
  5. package/build/runtime-brightnessContrast-AKEVG3HR.js.br +0 -0
  6. package/build/runtime-brightnessContrast-AKEVG3HR.js.gz +0 -0
  7. package/build/{runtime-chromaticAberration-3ZR5GYBD.js → runtime-chromaticAberration-CJXZOVUA.js} +1 -1
  8. package/build/runtime-chromaticAberration-CJXZOVUA.js.br +0 -0
  9. package/build/runtime-chromaticAberration-CJXZOVUA.js.gz +0 -0
  10. package/build/{runtime-chunk-6GWU4YCO.js → runtime-chunk-5H6VPLTB.js} +1 -1
  11. package/build/runtime-chunk-5H6VPLTB.js.br +0 -0
  12. package/build/runtime-chunk-5H6VPLTB.js.gz +0 -0
  13. package/build/{runtime-chunk-OWWB5PWZ.js → runtime-chunk-67XYII4R.js} +1 -1
  14. package/build/{runtime-chunk-OWWB5PWZ.js.br → runtime-chunk-67XYII4R.js.br} +0 -0
  15. package/build/runtime-chunk-67XYII4R.js.gz +0 -0
  16. package/build/{runtime-chunk-E635BCSZ.js → runtime-chunk-7QKPATHR.js} +1 -1
  17. package/build/runtime-chunk-7QKPATHR.js.br +0 -0
  18. package/build/runtime-chunk-7QKPATHR.js.gz +0 -0
  19. package/build/{runtime-chunk-6MHKNHIJ.js → runtime-chunk-AIAGSHYQ.js} +1 -1
  20. package/build/runtime-chunk-AIAGSHYQ.js.br +0 -0
  21. package/build/runtime-chunk-AIAGSHYQ.js.gz +0 -0
  22. package/build/{runtime-chunk-25EO7VPR.js → runtime-chunk-AKDBKOG2.js} +1 -1
  23. package/build/runtime-chunk-AKDBKOG2.js.br +0 -0
  24. package/build/runtime-chunk-AKDBKOG2.js.gz +0 -0
  25. package/build/{runtime-chunk-2ILKVPU7.js → runtime-chunk-BE22RDJE.js} +1 -1
  26. package/build/runtime-chunk-BE22RDJE.js.br +0 -0
  27. package/build/runtime-chunk-BE22RDJE.js.gz +0 -0
  28. package/build/{runtime-chunk-NTVPXSOS.js → runtime-chunk-BZZJZWYB.js} +1 -1
  29. package/build/runtime-chunk-BZZJZWYB.js.br +0 -0
  30. package/build/runtime-chunk-BZZJZWYB.js.gz +0 -0
  31. package/build/{runtime-chunk-P7X6NW5K.js → runtime-chunk-E4QRLMNN.js} +1 -1
  32. package/build/runtime-chunk-E4QRLMNN.js.br +0 -0
  33. package/build/runtime-chunk-E4QRLMNN.js.gz +0 -0
  34. package/build/{runtime-chunk-Q5T3KCHG.js → runtime-chunk-EAUIIPGL.js} +1 -1
  35. package/build/runtime-chunk-EAUIIPGL.js.br +0 -0
  36. package/build/runtime-chunk-EAUIIPGL.js.gz +0 -0
  37. package/build/{runtime-chunk-HR4NYGBJ.js → runtime-chunk-FLOULQFC.js} +1 -1
  38. package/build/runtime-chunk-FLOULQFC.js.br +2 -0
  39. package/build/runtime-chunk-FLOULQFC.js.gz +0 -0
  40. package/build/{runtime-chunk-RF2N5NLP.js → runtime-chunk-FSVP4JLG.js} +1 -1
  41. package/build/runtime-chunk-FSVP4JLG.js.br +0 -0
  42. package/build/{runtime-chunk-RF2N5NLP.js.gz → runtime-chunk-FSVP4JLG.js.gz} +0 -0
  43. package/build/{runtime-chunk-VWOW3I3F.js → runtime-chunk-HIFOSG33.js} +1 -1
  44. package/build/runtime-chunk-HIFOSG33.js.br +0 -0
  45. package/build/runtime-chunk-HIFOSG33.js.gz +0 -0
  46. package/build/{runtime-chunk-YP644KQB.js → runtime-chunk-IAV77RF7.js} +1 -1
  47. package/build/runtime-chunk-IAV77RF7.js.br +0 -0
  48. package/build/runtime-chunk-IAV77RF7.js.gz +0 -0
  49. package/build/{runtime-chunk-PVLR72QB.js → runtime-chunk-J26PDWXZ.js} +1 -1
  50. package/build/{runtime-chunk-PVLR72QB.js.br → runtime-chunk-J26PDWXZ.js.br} +0 -0
  51. package/build/runtime-chunk-J26PDWXZ.js.gz +0 -0
  52. package/build/{runtime-chunk-2XTIPMG3.js → runtime-chunk-J4DLIJUZ.js} +1 -1
  53. package/build/runtime-chunk-J4DLIJUZ.js.br +0 -0
  54. package/build/runtime-chunk-J4DLIJUZ.js.gz +0 -0
  55. package/build/{runtime-chunk-6JIJ47Z6.js → runtime-chunk-JPD7WF7H.js} +1 -1
  56. package/build/runtime-chunk-JPD7WF7H.js.br +0 -0
  57. package/build/runtime-chunk-JPD7WF7H.js.gz +0 -0
  58. package/build/{runtime-chunk-RUHSBN6Z.js → runtime-chunk-KVO4BD4I.js} +1 -1
  59. package/build/runtime-chunk-KVO4BD4I.js.br +0 -0
  60. package/build/runtime-chunk-KVO4BD4I.js.gz +0 -0
  61. package/build/{runtime-chunk-YKHSGLFC.js → runtime-chunk-LHPN54CL.js} +1 -1
  62. package/build/{runtime-chunk-YKHSGLFC.js.br → runtime-chunk-LHPN54CL.js.br} +0 -0
  63. package/build/runtime-chunk-LHPN54CL.js.gz +0 -0
  64. package/build/{runtime-chunk-YCVDVV27.js → runtime-chunk-N4IYKCD4.js} +1 -1
  65. package/build/runtime-chunk-N4IYKCD4.js.br +0 -0
  66. package/build/runtime-chunk-N4IYKCD4.js.gz +0 -0
  67. package/build/{runtime-chunk-A5G32UJU.js → runtime-chunk-QIDW3BF7.js} +1 -1
  68. package/build/runtime-chunk-QIDW3BF7.js.br +0 -0
  69. package/build/runtime-chunk-QIDW3BF7.js.gz +0 -0
  70. package/build/{runtime-chunk-NBHUK2SE.js → runtime-chunk-QKJWZ7FI.js} +1 -1
  71. package/build/runtime-chunk-QKJWZ7FI.js.br +0 -0
  72. package/build/runtime-chunk-QKJWZ7FI.js.gz +0 -0
  73. package/build/{runtime-chunk-BVMFLXGM.js → runtime-chunk-R4S4M2CX.js} +1 -1
  74. package/build/runtime-chunk-R4S4M2CX.js.br +0 -0
  75. package/build/runtime-chunk-R4S4M2CX.js.gz +0 -0
  76. package/build/{runtime-chunk-WIFURWRG.js → runtime-chunk-TLKSQZIK.js} +1 -1
  77. package/build/runtime-chunk-TLKSQZIK.js.br +0 -0
  78. package/build/runtime-chunk-TLKSQZIK.js.gz +0 -0
  79. package/build/{runtime-chunk-B7HJFNDU.js → runtime-chunk-UM3BOFRB.js} +1 -1
  80. package/build/runtime-chunk-UM3BOFRB.js.br +0 -0
  81. package/build/runtime-chunk-UM3BOFRB.js.gz +0 -0
  82. package/build/{runtime-chunk-PF2NJUFW.js → runtime-chunk-VGYXNKAV.js} +1 -1
  83. package/build/runtime-chunk-VGYXNKAV.js.br +0 -0
  84. package/build/runtime-chunk-VGYXNKAV.js.gz +0 -0
  85. package/build/{runtime-chunk-WKWLM3FK.js → runtime-chunk-VILHL2A3.js} +1 -1
  86. package/build/runtime-chunk-VILHL2A3.js.br +0 -0
  87. package/build/runtime-chunk-VILHL2A3.js.gz +0 -0
  88. package/build/{runtime-chunk-62KBLHKB.js → runtime-chunk-VUGCWL55.js} +1 -1
  89. package/build/runtime-chunk-VUGCWL55.js.br +0 -0
  90. package/build/runtime-chunk-VUGCWL55.js.gz +0 -0
  91. package/build/{runtime-chunk-BC4EZOEJ.js → runtime-chunk-ZKC6ZNGZ.js} +1 -1
  92. package/build/runtime-chunk-ZKC6ZNGZ.js.br +0 -0
  93. package/build/runtime-chunk-ZKC6ZNGZ.js.gz +0 -0
  94. package/build/{runtime-classicRuntime-XCN3ZR72.js → runtime-classicRuntime-TIXC6A7J.js} +1 -1
  95. package/build/runtime-classicRuntime-TIXC6A7J.js.br +0 -0
  96. package/build/runtime-classicRuntime-TIXC6A7J.js.gz +0 -0
  97. package/build/{runtime-cloners-4W7FLRGV.js → runtime-cloners-MHUMZ5KT.js} +1 -1
  98. package/build/runtime-cloners-MHUMZ5KT.js.br +0 -0
  99. package/build/runtime-cloners-MHUMZ5KT.js.gz +0 -0
  100. package/build/{runtime-components-GDXXOOQR.js → runtime-components-CVLXSYHS.js} +1 -1
  101. package/build/runtime-components-CVLXSYHS.js.br +0 -0
  102. package/build/runtime-components-CVLXSYHS.js.gz +0 -0
  103. package/build/{runtime-createDestroy-POAFJS7C.js → runtime-createDestroy-RP5SUEO4.js} +1 -1
  104. package/build/runtime-createDestroy-RP5SUEO4.js.br +0 -0
  105. package/build/runtime-createDestroy-RP5SUEO4.js.gz +0 -0
  106. package/build/{runtime-depthOfField-EHGOA7NI.js → runtime-depthOfField-UX4I4M7K.js} +1 -1
  107. package/build/runtime-depthOfField-UX4I4M7K.js.br +0 -0
  108. package/build/runtime-depthOfField-UX4I4M7K.js.gz +0 -0
  109. package/build/{runtime-dragDrop-W33Z6Y6W.js → runtime-dragDrop-EGL7S5S5.js} +1 -1
  110. package/build/runtime-dragDrop-EGL7S5S5.js.br +0 -0
  111. package/build/runtime-dragDrop-EGL7S5S5.js.gz +0 -0
  112. package/build/{runtime-gameControls-IEFSF4I7.js → runtime-gameControls-2DDLTBQF.js} +1 -1
  113. package/build/runtime-gameControls-2DDLTBQF.js.br +0 -0
  114. package/build/runtime-gameControls-2DDLTBQF.js.gz +0 -0
  115. package/build/{runtime-hair-XVBS2GA7.js → runtime-hair-3UEJB5FX.js} +1 -1
  116. package/build/runtime-hair-3UEJB5FX.js.br +0 -0
  117. package/build/runtime-hair-3UEJB5FX.js.gz +0 -0
  118. package/build/{runtime-hueSaturation-WCJBBDYB.js → runtime-hueSaturation-TC6KGXQ6.js} +1 -1
  119. package/build/runtime-hueSaturation-TC6KGXQ6.js.br +0 -0
  120. package/build/runtime-hueSaturation-TC6KGXQ6.js.gz +0 -0
  121. package/build/{runtime-mergeStaticGeometries-P5LQGUAM.js → runtime-mergeStaticGeometries-5RJDOXOR.js} +1 -1
  122. package/build/runtime-mergeStaticGeometries-5RJDOXOR.js.br +0 -0
  123. package/build/runtime-mergeStaticGeometries-5RJDOXOR.js.gz +0 -0
  124. package/build/{runtime-miscActions-APTMY76T.js → runtime-miscActions-J75DJJ3S.js} +1 -1
  125. package/build/runtime-miscActions-J75DJJ3S.js.br +0 -0
  126. package/build/runtime-miscActions-J75DJJ3S.js.gz +0 -0
  127. package/build/{runtime-mouseHover-NRO5UCG7.js → runtime-mouseHover-Y3VQ74MU.js} +1 -1
  128. package/build/runtime-mouseHover-Y3VQ74MU.js.br +0 -0
  129. package/build/runtime-mouseHover-Y3VQ74MU.js.gz +0 -0
  130. package/build/{runtime-noise-KM7YQMBM.js → runtime-noise-VDTKGLRY.js} +1 -1
  131. package/build/runtime-noise-VDTKGLRY.js.br +0 -0
  132. package/build/runtime-noise-VDTKGLRY.js.gz +0 -0
  133. package/build/{runtime-particles-GKDZPI7K.js → runtime-particles-GGLPX4N3.js} +1 -1
  134. package/build/runtime-particles-GGLPX4N3.js.br +0 -0
  135. package/build/runtime-particles-GGLPX4N3.js.gz +0 -0
  136. package/build/{runtime-paths-DOXCHUT5.js → runtime-paths-SSVMYZ7I.js} +1 -1
  137. package/build/runtime-paths-SSVMYZ7I.js.br +0 -0
  138. package/build/runtime-paths-SSVMYZ7I.js.gz +0 -0
  139. package/build/{runtime-pixelation-ZLBCYVUE.js → runtime-pixelation-7IVB5AHQ.js} +1 -1
  140. package/build/runtime-pixelation-7IVB5AHQ.js.br +0 -0
  141. package/build/runtime-pixelation-7IVB5AHQ.js.gz +0 -0
  142. package/build/{runtime-resize-SD25URWW.js → runtime-resize-Y2MQXLFX.js} +1 -1
  143. package/build/runtime-resize-Y2MQXLFX.js.br +0 -0
  144. package/build/runtime-resize-Y2MQXLFX.js.gz +0 -0
  145. package/build/{runtime-sceneTransition-O4XWLR26.js → runtime-sceneTransition-7I22WEJO.js} +1 -1
  146. package/build/runtime-sceneTransition-7I22WEJO.js.br +0 -0
  147. package/build/runtime-sceneTransition-7I22WEJO.js.gz +0 -0
  148. package/build/{runtime-scroll-2D4Z5GPS.js → runtime-scroll-SO45MYTH.js} +1 -1
  149. package/build/runtime-scroll-SO45MYTH.js.br +0 -0
  150. package/build/runtime-scroll-SO45MYTH.js.gz +0 -0
  151. package/build/runtime-shapeBlends-6AN6DOFU.js +1 -0
  152. package/build/runtime-shapeBlends-6AN6DOFU.js.br +0 -0
  153. package/build/runtime-shapeBlends-6AN6DOFU.js.gz +0 -0
  154. package/build/{runtime-text-FKMTHZ4K.js → runtime-text-E2ASXWZX.js} +1 -1
  155. package/build/runtime-text-E2ASXWZX.js.br +0 -0
  156. package/build/runtime-text-E2ASXWZX.js.gz +0 -0
  157. package/build/{runtime-textInputs-QNN3S2GJ.js → runtime-textInputs-FNLXJFVY.js} +1 -1
  158. package/build/runtime-textInputs-FNLXJFVY.js.br +0 -0
  159. package/build/runtime-textInputs-FNLXJFVY.js.gz +0 -0
  160. package/build/{runtime-timeline-KX5GBP37.js → runtime-timeline-CJZI4YO7.js} +1 -1
  161. package/build/runtime-timeline-CJZI4YO7.js.br +0 -0
  162. package/build/runtime-timeline-CJZI4YO7.js.gz +0 -0
  163. package/build/{runtime-tracking-44SCAGUQ.js → runtime-tracking-YTG7FGE7.js} +1 -1
  164. package/build/runtime-tracking-YTG7FGE7.js.br +0 -0
  165. package/build/runtime-tracking-YTG7FGE7.js.gz +0 -0
  166. package/build/runtime-transitions-HPFANIJ6.js +1 -0
  167. package/build/runtime-transitions-HPFANIJ6.js.br +0 -0
  168. package/build/runtime-transitions-HPFANIJ6.js.gz +0 -0
  169. package/build/{runtime-ui2d-BKNIWTYT.js → runtime-ui2d-IQYCXIGE.js} +1 -1
  170. package/build/runtime-ui2d-IQYCXIGE.js.br +0 -0
  171. package/build/runtime-ui2d-IQYCXIGE.js.gz +0 -0
  172. package/build/{runtime-vectorShapes-LZ4FR3HV.js → runtime-vectorShapes-MB5TXEDV.js} +1 -1
  173. package/build/runtime-vectorShapes-MB5TXEDV.js.br +0 -0
  174. package/build/runtime-vectorShapes-MB5TXEDV.js.gz +0 -0
  175. package/build/{runtime-vignette-DUC5F7RW.js → runtime-vignette-P4T5Y5FL.js} +1 -1
  176. package/build/runtime-vignette-P4T5Y5FL.js.br +0 -0
  177. package/build/runtime-vignette-P4T5Y5FL.js.gz +0 -0
  178. package/build/{runtime-webgpu-MR5IDANE.js → runtime-webgpu-NMDQXIWA.js} +1 -1
  179. package/build/runtime-webgpu-NMDQXIWA.js.br +0 -0
  180. package/build/runtime-webgpu-NMDQXIWA.js.gz +0 -0
  181. package/build/runtime.cjs +8 -8
  182. package/build/runtime.js +1 -1
  183. package/build/runtime.js.br +0 -0
  184. package/build/runtime.js.gz +0 -0
  185. package/build/runtime.standalone.js +1 -1
  186. package/build/runtime.standalone.js.br +0 -0
  187. package/build/runtime.standalone.js.gz +0 -0
  188. package/build/runtime.standalone.webgl.js +1 -1
  189. package/build/runtime.standalone.webgl.js.br +0 -0
  190. package/build/runtime.standalone.webgl.js.gz +0 -0
  191. package/build/runtime.standalone.webgpu.js +1 -1
  192. package/build/runtime.standalone.webgpu.js.br +0 -0
  193. package/build/runtime.standalone.webgpu.js.gz +0 -0
  194. package/build/runtime.standalone.webgpu.micro.js +1 -1
  195. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  196. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  197. package/build/runtime.standalone.webgpu.min.js +1 -1
  198. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  199. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  200. package/package.json +1 -1
  201. package/build/runtime-bloom-SGWFTQ43.js.br +0 -0
  202. package/build/runtime-bloom-SGWFTQ43.js.gz +0 -0
  203. package/build/runtime-brightnessContrast-3UTV7FCG.js.br +0 -0
  204. package/build/runtime-brightnessContrast-3UTV7FCG.js.gz +0 -0
  205. package/build/runtime-chromaticAberration-3ZR5GYBD.js.br +0 -0
  206. package/build/runtime-chromaticAberration-3ZR5GYBD.js.gz +0 -0
  207. package/build/runtime-chunk-25EO7VPR.js.br +0 -0
  208. package/build/runtime-chunk-25EO7VPR.js.gz +0 -0
  209. package/build/runtime-chunk-2ILKVPU7.js.br +0 -0
  210. package/build/runtime-chunk-2ILKVPU7.js.gz +0 -0
  211. package/build/runtime-chunk-2XTIPMG3.js.br +0 -0
  212. package/build/runtime-chunk-2XTIPMG3.js.gz +0 -0
  213. package/build/runtime-chunk-62KBLHKB.js.br +0 -0
  214. package/build/runtime-chunk-62KBLHKB.js.gz +0 -0
  215. package/build/runtime-chunk-6GWU4YCO.js.br +0 -0
  216. package/build/runtime-chunk-6GWU4YCO.js.gz +0 -0
  217. package/build/runtime-chunk-6JIJ47Z6.js.br +0 -0
  218. package/build/runtime-chunk-6JIJ47Z6.js.gz +0 -0
  219. package/build/runtime-chunk-6MHKNHIJ.js.br +0 -0
  220. package/build/runtime-chunk-6MHKNHIJ.js.gz +0 -0
  221. package/build/runtime-chunk-A5G32UJU.js.br +0 -1
  222. package/build/runtime-chunk-A5G32UJU.js.gz +0 -0
  223. package/build/runtime-chunk-B7HJFNDU.js.br +0 -0
  224. package/build/runtime-chunk-B7HJFNDU.js.gz +0 -0
  225. package/build/runtime-chunk-BC4EZOEJ.js.br +0 -0
  226. package/build/runtime-chunk-BC4EZOEJ.js.gz +0 -0
  227. package/build/runtime-chunk-BVMFLXGM.js.br +0 -0
  228. package/build/runtime-chunk-BVMFLXGM.js.gz +0 -0
  229. package/build/runtime-chunk-E635BCSZ.js.br +0 -0
  230. package/build/runtime-chunk-E635BCSZ.js.gz +0 -0
  231. package/build/runtime-chunk-HR4NYGBJ.js.br +0 -0
  232. package/build/runtime-chunk-HR4NYGBJ.js.gz +0 -0
  233. package/build/runtime-chunk-NBHUK2SE.js.br +0 -0
  234. package/build/runtime-chunk-NBHUK2SE.js.gz +0 -0
  235. package/build/runtime-chunk-NTVPXSOS.js.br +0 -0
  236. package/build/runtime-chunk-NTVPXSOS.js.gz +0 -0
  237. package/build/runtime-chunk-OWWB5PWZ.js.gz +0 -0
  238. package/build/runtime-chunk-P7X6NW5K.js.br +0 -0
  239. package/build/runtime-chunk-P7X6NW5K.js.gz +0 -0
  240. package/build/runtime-chunk-PF2NJUFW.js.br +0 -0
  241. package/build/runtime-chunk-PF2NJUFW.js.gz +0 -0
  242. package/build/runtime-chunk-PVLR72QB.js.gz +0 -0
  243. package/build/runtime-chunk-Q5T3KCHG.js.br +0 -0
  244. package/build/runtime-chunk-Q5T3KCHG.js.gz +0 -0
  245. package/build/runtime-chunk-RF2N5NLP.js.br +0 -0
  246. package/build/runtime-chunk-RUHSBN6Z.js.br +0 -0
  247. package/build/runtime-chunk-RUHSBN6Z.js.gz +0 -0
  248. package/build/runtime-chunk-VWOW3I3F.js.br +0 -0
  249. package/build/runtime-chunk-VWOW3I3F.js.gz +0 -0
  250. package/build/runtime-chunk-WIFURWRG.js.br +0 -0
  251. package/build/runtime-chunk-WIFURWRG.js.gz +0 -0
  252. package/build/runtime-chunk-WKWLM3FK.js.br +0 -0
  253. package/build/runtime-chunk-WKWLM3FK.js.gz +0 -0
  254. package/build/runtime-chunk-YCVDVV27.js.br +0 -0
  255. package/build/runtime-chunk-YCVDVV27.js.gz +0 -0
  256. package/build/runtime-chunk-YKHSGLFC.js.gz +0 -0
  257. package/build/runtime-chunk-YP644KQB.js.br +0 -0
  258. package/build/runtime-chunk-YP644KQB.js.gz +0 -0
  259. package/build/runtime-classicRuntime-XCN3ZR72.js.br +0 -0
  260. package/build/runtime-classicRuntime-XCN3ZR72.js.gz +0 -0
  261. package/build/runtime-cloners-4W7FLRGV.js.br +0 -1
  262. package/build/runtime-cloners-4W7FLRGV.js.gz +0 -0
  263. package/build/runtime-components-GDXXOOQR.js.br +0 -0
  264. package/build/runtime-components-GDXXOOQR.js.gz +0 -0
  265. package/build/runtime-createDestroy-POAFJS7C.js.br +0 -0
  266. package/build/runtime-createDestroy-POAFJS7C.js.gz +0 -0
  267. package/build/runtime-depthOfField-EHGOA7NI.js.br +0 -0
  268. package/build/runtime-depthOfField-EHGOA7NI.js.gz +0 -0
  269. package/build/runtime-dragDrop-W33Z6Y6W.js.br +0 -0
  270. package/build/runtime-dragDrop-W33Z6Y6W.js.gz +0 -0
  271. package/build/runtime-gameControls-IEFSF4I7.js.br +0 -0
  272. package/build/runtime-gameControls-IEFSF4I7.js.gz +0 -0
  273. package/build/runtime-hair-XVBS2GA7.js.br +0 -1
  274. package/build/runtime-hair-XVBS2GA7.js.gz +0 -0
  275. package/build/runtime-hueSaturation-WCJBBDYB.js.br +0 -0
  276. package/build/runtime-hueSaturation-WCJBBDYB.js.gz +0 -0
  277. package/build/runtime-mergeStaticGeometries-P5LQGUAM.js.br +0 -0
  278. package/build/runtime-mergeStaticGeometries-P5LQGUAM.js.gz +0 -0
  279. package/build/runtime-miscActions-APTMY76T.js.br +0 -0
  280. package/build/runtime-miscActions-APTMY76T.js.gz +0 -0
  281. package/build/runtime-mouseHover-NRO5UCG7.js.br +0 -0
  282. package/build/runtime-mouseHover-NRO5UCG7.js.gz +0 -0
  283. package/build/runtime-noise-KM7YQMBM.js.br +0 -0
  284. package/build/runtime-noise-KM7YQMBM.js.gz +0 -0
  285. package/build/runtime-particles-GKDZPI7K.js.br +0 -0
  286. package/build/runtime-particles-GKDZPI7K.js.gz +0 -0
  287. package/build/runtime-paths-DOXCHUT5.js.br +0 -0
  288. package/build/runtime-paths-DOXCHUT5.js.gz +0 -0
  289. package/build/runtime-pixelation-ZLBCYVUE.js.br +0 -0
  290. package/build/runtime-pixelation-ZLBCYVUE.js.gz +0 -0
  291. package/build/runtime-resize-SD25URWW.js.br +0 -0
  292. package/build/runtime-resize-SD25URWW.js.gz +0 -0
  293. package/build/runtime-sceneTransition-O4XWLR26.js.br +0 -0
  294. package/build/runtime-sceneTransition-O4XWLR26.js.gz +0 -0
  295. package/build/runtime-scroll-2D4Z5GPS.js.br +0 -0
  296. package/build/runtime-scroll-2D4Z5GPS.js.gz +0 -0
  297. package/build/runtime-shapeBlends-FUUKLGPZ.js +0 -1
  298. package/build/runtime-shapeBlends-FUUKLGPZ.js.br +0 -0
  299. package/build/runtime-shapeBlends-FUUKLGPZ.js.gz +0 -0
  300. package/build/runtime-text-FKMTHZ4K.js.br +0 -0
  301. package/build/runtime-text-FKMTHZ4K.js.gz +0 -0
  302. package/build/runtime-textInputs-QNN3S2GJ.js.br +0 -0
  303. package/build/runtime-textInputs-QNN3S2GJ.js.gz +0 -0
  304. package/build/runtime-timeline-KX5GBP37.js.br +0 -0
  305. package/build/runtime-timeline-KX5GBP37.js.gz +0 -0
  306. package/build/runtime-tracking-44SCAGUQ.js.br +0 -0
  307. package/build/runtime-tracking-44SCAGUQ.js.gz +0 -0
  308. package/build/runtime-transitions-MYS3FPJE.js +0 -1
  309. package/build/runtime-transitions-MYS3FPJE.js.br +0 -0
  310. package/build/runtime-transitions-MYS3FPJE.js.gz +0 -0
  311. package/build/runtime-ui2d-BKNIWTYT.js.br +0 -0
  312. package/build/runtime-ui2d-BKNIWTYT.js.gz +0 -0
  313. package/build/runtime-vectorShapes-LZ4FR3HV.js.br +0 -0
  314. package/build/runtime-vectorShapes-LZ4FR3HV.js.gz +0 -0
  315. package/build/runtime-vignette-DUC5F7RW.js.br +0 -0
  316. package/build/runtime-vignette-DUC5F7RW.js.gz +0 -0
  317. package/build/runtime-webgpu-MR5IDANE.js.br +0 -0
  318. package/build/runtime-webgpu-MR5IDANE.js.gz +0 -0
package/build/runtime.cjs CHANGED
@@ -4134,13 +4134,13 @@ void main() {
4134
4134
  }
4135
4135
  post({ kind: 'ready' });
4136
4136
  }, 250);
4137
- })();`});function qQ(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 WQ,Yp,RC=B(()=>{"use strict";WQ=100;Yp=class{constructor(t,e,n){this.deps=t;this.onConsole=e;this.onEvent=n;this.disposed=!1;this.eventUnsubs=new Map;this.variablePollHandle=null;this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let n=this.deps;switch(t){case"setVariable":{let r=n.setVariable(String(e[0]),e[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=e[0]??{},s=!0;for(let[o,a]of Object.entries(r)){let l=n.setVariable(o,a);l.warning&&this.onConsole("warn",l.warning),s=s&&l.ok}return s}case"getVariable":return n.getVariable(String(e[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(e[0]));case"getGeometry":{let r=n.getGeometry(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return n.updateObject(String(e[0]),e[1]??{});case"createObject":return n.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":{if(n.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(e[0])}case"getTexture":{if(n.getTexture===void 0)throw new Error("getTexture: not available on this surface \u2014 a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return n.getTexture(String(e[0]),e[1]??{})}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=qQ(this.lastVariables??{},t);this.lastVariables=t;for(let n of e)this.onEvent("variableChange",n)},WQ))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function XQ(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 YQ(i){let t=i[0],e=i[4],n=i[8],r=i[1],s=i[5],o=i[9],a=i[2],l=i[6],c=i[10],u=t*(s*c-o*l)-e*(r*c-o*a)+n*(r*l-s*a);if(!isFinite(u)||Math.abs(u)<1e-12)return null;let d=1/u,h=[(s*c-o*l)*d,(n*l-e*c)*d,(e*o-n*s)*d,(o*a-r*c)*d,(t*c-n*a)*d,(n*r-t*o)*d,(r*l-s*a)*d,(e*a-t*l)*d,(t*s-e*r)*d];return[h[0],h[3],h[6],h[1],h[4],h[7],h[2],h[5],h[8]]}function aB(i,t){let e=i?.getAttribute("position");if(!e||!e.count)return null;let n=e.count,r=t??null,s=i.getIndex?.()??null,o=Math.floor((s?s.count:n)/3),a=1/0,l=1/0,c=1/0,u=-1/0,d=-1/0,h=-1/0,p=new Float32Array(n*3);for(let y=0;y<n;y++){let v=e.getX(y),b=e.getY(y),x=e.getZ(y);r&&([v,b,x]=XQ(r,v,b,x)),v<a&&(a=v),b<l&&(l=b),x<c&&(c=x),v>u&&(u=v),b>d&&(d=b),x>h&&(h=x),p[y*3]=v,p[y*3+1]=b,p[y*3+2]=x}let f={space:r?"world":"local",vertexCount:n,triangleCount:o,indexed:s!==null,bounds:{min:[a,l,c],max:[u,d,h],size:[u-a,d-l,h-c]},vertices:p};if(s){let y=new Uint32Array(s.count);for(let v=0;v<s.count;v++)y[v]=s.getX(v);f.indices=y}let m=i.getAttribute("normal");if(m&&m.count===n){let y=r?YQ(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 T=y[0]*x+y[1]*S+y[2]*E,w=y[3]*x+y[4]*S+y[5]*E,_=y[6]*x+y[7]*S+y[8]*E,A=Math.hypot(T,w,_);A>1e-12?(x=T/A,S=w/A,E=_/A):(x=T,S=w,E=_)}v[b*3]=x,v[b*3+1]=S,v[b*3+2]=E}f.normals=v}}let 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 lB=B(()=>{"use strict"});function cB(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let i=[],t=(r,s,o)=>{let a=new Event(o);try{typeof s=="function"?s.call(r,a):s.handleEvent?.(a)}catch(l){console.error(l)}},e=(r,s)=>{let o=new Set,a=r.addEventListener.bind(r),l=r.removeEventListener.bind(r),c=(d,h,p)=>{if(a(d,h,p),!s.includes(d)||h==null)return;let f={type:d,listener:h};o.add(f),queueMicrotask(()=>{!o.delete(f)||t(r,f.listener,f.type)})},u=(d,h,p)=>{l(d,h,p);for(let f of o)f.type===d&&f.listener===h&&o.delete(f)};Object.defineProperty(r,"addEventListener",{configurable:!0,writable:!0,value:c}),Object.defineProperty(r,"removeEventListener",{configurable:!0,writable:!0,value:u}),i.push(()=>{delete r.addEventListener,delete r.removeEventListener,o.clear()})};e(document,["DOMContentLoaded"]),e(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:r=>{typeof r=="function"&&queueMicrotask(()=>{try{r.call(window,new Event("load"))}catch(s){console.error(s)}})}}),i.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let r of i)r()}}var uB=B(()=>{"use strict"});var $Q,PS,dB=B(()=>{"use strict";CS();RC();$Q=6e3,PS=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;!rB(e)||this.handleMessage(e)};this.host=new Yp(e,n,(r,s)=>{this.sendEvent(r,s)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Yl]:!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.")},$Q)}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({[Yl]:!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({[Yl]:!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({[Yl]:!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({[Yl]:!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 dn=B(()=>{wS();P3();D3();L3();z3();G3();H3();W3();$3();K3();Z3();nB();CS();oB();RC();lB();uB();dB()});var hB=B(()=>{"use strict"});function RS(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 pB=B(()=>{"use strict"});function Wr(i,t){return Object.setPrototypeOf(i,t),i}function IS(i){let t={...i};return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}function Ba(i,t,e){if(i===void 0?t===void 0?(i=0,t=10):i=t-10:t===void 0&&(t=i+10),i>t){let s=i;i=t,t=s}let n=[],r=1/(e+1);for(let s=0;s<e;s++){let o=i+(t-i)*(s+.75+Math.random()*.5)*r;n.push(o)}return n}function co(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 fB(){return typeof process<"u"}var mB=B(()=>{"use strict"});function Gy(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"&&Gy(n)}return Object.freeze(i)}function OS(i){for(let t of Object.keys(i))i[t]===void 0&&delete i[t];return i}var gB=B(()=>{"use strict"});var qr=B(()=>{hB();pB();mB();gB()});var DS,Id,jy,LS=B(()=>{"use strict";DS=class{},Id=class extends DS{constructor(e){super();this.id=e}},jy=class extends DS{constructor(e){super();this.data=e}}});var yB=B(()=>{"use strict"});var st,Hy=B(()=>{"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:o}=t,a={...e,[s]:o};return Object.setPrototypeOf(a,st.prototype),{data:a,actual:t,reverse:r}}else if(t.type===2){let{id:n}=t,r=e[n];if(r===void 0)return null;{let s={...e};return Object.setPrototypeOf(s,st.prototype),delete s[n],{data:s,actual:t,reverse:{type:1,id:n,data:r}}}}return null}}});var $p,NS=B(()=>{"use strict";$p=class extends Error{}});function vB(i,t){for(let e of i)t(e.id,e.data)!==!0&&vB(e.children,t)}function bB(i,t){if(t(i.id,i.data)!==!0)for(let e of i.children)bB(e,t)}var Ln,ou=B(()=>{"use strict";qr();NS();qr();Ln=class extends Array{constructor(...e){super(...e);zi(this,"partialObjectCaches");zi(this,"objCaches");zi(this,"parentCaches");Object.setPrototypeOf(this,Ln.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Gy(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&&bB(r,n)}}traverse(e){vB(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this.parent(e),o=this.childrenArray(s),a=o.findIndex(d=>d.id===e);if(a<0)throw new Error("not expected");let l=o[a];o=[...o],o[a]={...l,data:n};let c=new Map;return c.set(e,o[a]),this.modifyArrayBy(s,o,c)}}modifyArrayBy(e,n,r=void 0){let s=e,o=n;for(;s!==null;){let l=o,c=s;if(s=this.parent(s),s===void 0)throw new Error;o=this.childrenArray(s);let u=o.findIndex(d=>d.id===c);if(u<0)throw new Error;o=[...o],o[u]={...o[u],children:l},r&&r.set(c,o[u])}Object.setPrototypeOf(o,Ln.prototype);let a=o;if(r&&this.objCaches!==void 0&&this.parentCaches!==void 0){a.objCaches=this.objCaches;for(let[l,c]of r)a.objCaches.set(l,c);a.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else a.fillCaches();return a}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:n}){if(this.get(e)!==void 0)return!0;for(let r of n)if(this.checkDuplicatedIdRec(r))return!0;return!1}addOp(e){let{parent:n,fi:r,id:s,data:o,children:a}=e;if(n!==null&&this.get(n)===void 0)return null;if(this.checkDuplicatedIdRec(e))return null;{let l=n,c=this.childrenArray(l),u={fi:r,id:s,data:o,children:a};return c=[...c,u],c.sort((h,p)=>h.fi-p.fi),e.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:e,reverse:{type:8,id:s}}}}deleteOp(e){let{id:n}=e;if(this.get(n)===null)return null;{let r=this.parent(n);if(r===void 0)return null;let s=this.childrenArray(r),o=s.findIndex(c=>c.id===n);e.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(r,s),actual:e,reverse:{type:7,...a,parent:r}}}}moveOp(e){let{parent:n,fi:r,id:s}=e;if(n!==null&&this.get(n)===void 0)return this.deleteOp({type:8,id:s});if(n!==null){let p=n;for(;p!==null;){if(p===void 0)throw new Error;if(p===s)throw new $p("cyclic tree");p=this.parent(p)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(p=>p.id===s);l=[...l];let u=l.splice(c,1)[0],d=this.modifyArrayBy(o,l);o=n,l=d.childrenArray(o);let h=u.fi;return u={...u,fi:r},l=[...l,u],l.sort((p,f)=>p.fi-f.fi),e.localIndex=l.indexOf(u),d=d.modifyArrayBy(o,l),{data:d,actual:e,reverse:{type:9,parent:a,fi:h,id:s}}}previous(e,n){if(n===null){let s=this.childrenArray(e);return s.length===0?null:s[s.length-1].id}let r=null;for(let s of this.childrenArray(e)){if(s.id===n)return r;r=s.id}return null}traverseSortNext(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(o=>o.id===e)+1;if(s<r.length)return r[s].id;if(n)return this.traverseSortNext(n)}}sortNext(e){let n=this.childrenArray(e);return n.length>0?n[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let n=this.childrenArray(e);return n.length>0?this.traverseSortPrevious(n[n.length-1].id):e}sortPrevious(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(o=>o.id===e)-1;return s>=0?this.traverseSortPrevious(r[s].id):n}}getAllSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r.id);s!==void 0&&n.push({...r,...s})}n.sort((r,s)=>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),o=s;if(s!==void 0){for(;n;)r.splice(0,0,s.fi),n=this.parent(n),n!==null&&(s=this.get(n));return{...o,sortKey:r}}}insertBeforeHelper(e,n,r){return this.insertAfterHelper(e,this.previous(e,n),r)}insertAfterHelper(e,n,r){let s=this.childrenArray(e);if(n===null){if(s.length===0)return Ba(0,r,r);{let o=s[0].fi;return Ba(o-r,o,r)}}else{let o=this.get(n);if(o===void 0||this.parent(n)!==e)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Ba(l,l+r,r)}else return Ba(o.fi,a.fi,r)}}}});var IC,au,BS=B(()=>{"use strict";qr();IC=null;(n=>{function i(r){IC=r}n.setPreservePrototype=i;function t(r,s){return Object.getPrototypeOf(r)===IC&&Object.setPrototypeOf(s,IC),s}n.tryPreservePrototype=t;function e(r,s){if(s.type!==0)return null;if(Array.isArray(r)||co(r)){let o=s.props,a={},l=co(r)?r.slice():[...r],c=!1;if(o)for(let u of Object.keys(o)){let d=parseInt(u);if(isNaN(d))throw new Error("wrong index");a[u]=l[d],l[d]=o[u],c=!0}return c?{data:l,actual:s,reverse:{type:0,props:a}}:null}else{let o=s.props,a={},l={...r},c=!1;if(o)for(let u of Object.keys(o)){a[u]=l[u];let d=o[u];d===void 0?delete l[u]:l[u]=d,c=!0}return c?{data:n.tryPreservePrototype(r,l),actual:s,reverse:{type:0,props:a}}:null}}n.runOp=e})(au||(au={}))});var Fe,lu=B(()=>{"use strict";qr();qr();Fe=class extends Array{constructor(...e){super(...e);zi(this,"objCaches");Object.setPrototypeOf(this,Fe.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Gy(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===e);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]={...a,data:n},this.modifyArrayBy(s)}}modifyArrayBy(e){Object.setPrototypeOf(e,Fe.prototype);let n=e;return fB()||n.fillCaches(),n}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:n,id:r,data:s}=e,o=this,a={fi:n,id:r,data:s};return o=[...o,a],o.sort((c,u)=>c.fi-u.fi),e.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:e,reverse:{type:5,id:r}}}deleteOp(e){let{id:n}=e,r=this,s=r.findIndex(l=>l.id===n);if(s===-1)return null;e.localIndex=s,r=[...r];let o=r.splice(s,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:{type:4,...o}}}moveOp(e){let{fi:n,id:r}=e,s=this;s=[...s];let o=s.findIndex(u=>u.id===r);if(o===-1)return null;let a=s[o].fi,l={...s[o],fi:n};return s[o]=l,s.sort((u,d)=>u.fi-d.fi),e.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:e,reverse:{type:6,fi:a,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let n=null;for(let r of this){if(r.id===e)return n;n=r.id}return null}insertBeforeHelper(e,n){return this.insertAfterHelper(this.previous(e),n)}insertAfterHelper(e,n){let r=this;if(e===null){if(r.length===0)return Ba(0,n,n);{let s=r[0].fi;return Ba(s-n,s,n)}}else{let s=this.get(e);if(s===void 0)throw new Error("illegal args");let o=r.find(a=>a.fi>s.fi);if(o===void 0){let a=r[r.length-1].fi;return Ba(a,a+n,n)}else return Ba(s.fi,o.fi,n)}}}});function xB(i,t){return Kp(i,t,null)??i}function SB(i,t){let e={cur:[],result:[],len:0};return i=Kp(i,t,e)??i,[i,e.result]}function FS(i,t){return i===null?null:(i.cur[i.len]=t,i.len+=1,i)}function US(i){i&&(i.len-=1)}function KQ(i){if(i===null)return null;i.result.push(i.cur.slice(0,i.len))}function wB(i,t,e){let n=!1,r=i.map(s=>{let o=s.id,a=t[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,e!==null))throw new Error("not supported");let l=Kp(s.data,t,FS(e,o));US(e),n=n||l!==void 0,l===void 0&&(l=s.data);let c=wB(s.children,t,e);return c!==void 0?n=!0:c=s.children,{...s,id:o,data:l,children:c}});if(n)return r}function ZQ(i,t,e){let n=!1,r=i.map(s=>{let o=s.id,a=t[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,e!==null))throw new Error("not supported");let l=Kp(s.data,t,FS(e,o));return US(e),n=n||l!==void 0,l===void 0&&(l=s.data),{...s,id:o,data:l}});if(n)return Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}function Kp(i,t,e){if(i instanceof Ln){let n=wB(i,t,e);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}else{if(i instanceof Fe)return ZQ(i,t,e);if(Array.isArray(i)){let n=!1,r=i.map((s,o)=>{let a=Kp(s,t,FS(e,o));return US(e),n=n||a!==void 0,a===void 0&&(a=s),a});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else if(i&&typeof i=="object"&&!co(i)){let n={},r=!1;for(let[s,o]of Object.entries(i))if(s!=="name"&&s!=="variableId"){let a=t[s];if(typeof a=="string"){if(e!==null)throw new Error("not supported");r=!0,s=a}let l=Kp(o,t,FS(e,s));US(e),r=r||l!==void 0,l===void 0&&(l=o),n[s]=l}else n[s]=o;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else if(typeof i=="string"){let n=t[i];return n!==void 0&&KQ(e),n}else return}}var OC=B(()=>{"use strict";ou();lu();qr()});function Zp(i){return i&&typeof i=="object"&&i instanceof _n}function DC(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,o=Wy(r.data,t[s]);if(e=e||o!==void 0,o===void 0&&(o=r.data),r.children){let a=DC(r.children,t);return a!==void 0?e=!0:a=r.children,{...r,id:s,data:o,children:a}}else return{...r,id:s,data:o}});if(e)return n}function QQ(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,o=Wy(r.data,t[s]);return e=e||o!==void 0,o===void 0&&(o=r.data),{...r,id:s,data:o}});if(e)return Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}function Wy(i,t){if(!Zp(t))return t;if(i instanceof Ln){let e=DC(i,t);return e!==void 0&&Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e}else{if(i instanceof Fe)return QQ(i,t);if(Array.isArray(i)){let e=!1,n=i.map((r,s)=>{let o=Wy(r,t[s]);return e=e||o!==void 0,o===void 0&&(o=r),o});return e?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else{if(i instanceof _n)return LC(i,t);if(i&&typeof i=="object"){let e={},n=!1;for(let[r,s]of Object.entries(i)){let o=Wy(s,t[r]);n=n||o!==void 0,o===void 0&&(o=s),e[r]=o}return n?(Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e):void 0}}}}function LC(i,t){if(i===void 0)return t;if(t===void 0)return i;if(!Zp(t))return t;if(!Zp(i))return Fa.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 _n;for(let r of e){let s=LC(i===void 0?void 0:i[r],t===void 0?void 0:t[r]);n[r]=s}return n}var _n,Fa,qy=B(()=>{"use strict";ou();lu();Xy();qr();_n=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&&!Zp(n))return null;r+=1}n=n?IS(n):new _n;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=IS(l),delete n[t.path[r-1]])}else{let l=e[r-1];if(l){let c=IS(l);c[t.path[r-1]]=n,n=c}else{let c=new _n;c[t.path[r-1]]=n,n=c}}r-=1}let o=Object.setPrototypeOf(n,_n.prototype),a={...t,props:s};return{data:o,actual:t,reverse:a}}};(n=>{function i(r,s){return Wy(r,s)??r}n.apply=i;function t(r,s){return LC(r,s)}n.merge=t;function e(r,s){let o=0,a=s.path,l=r;for(;o<a.length&&l!==void 0;){if(l=rr.zoomOnce(l,a[o]),l===void 0)return s;if(!Zp(l))return;o+=1}if(l===void 0)return s;if(!!Zp(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=DC([s],l);return c?c[0]:s}else return s}n.filterOp=e})(Fa||(Fa={}))});var Qp,wr,Yy,EB=B(()=>{"use strict";qr();Xy();Hy();ou();NS();BS();lu();OC();qy();(t=>{function i(e,n){let r=rr.zoom(n,e.path);if(typeof r=="object"){let s={};for(let o of Object.keys(e.props))s[o]=r[o];return{...e,props:s}}else return{...e,props:{}}}t.replaceProps=i})(Qp||(Qp={}));(a=>{function i(l,c){return{...l,path:l.path.slice(c)}}a.drop=i;function t(l,c){return e(l,c)?.data??l}a.applySimple=t;function e(l,c){let u=c.path,d=[];for(;;){let h;if(l instanceof _n&&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 Fe||l instanceof st?h=l.runOp(c):h=au.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 Fe){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 _n){let b={...v,[y]:m};m=Object.setPrototypeOf(b,_n.prototype)}else if(typeof v=="object")if(Array.isArray(v)||co(v)){if(typeof y=="string"&&(y=parseInt(y),isNaN(y)))throw new Error("Invalid path");let b=m;m=co(v)?v.slice():[...v],m[y]=b}else m=au.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 Fe){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else l!==null&&(f=l[p]);if(f!==void 0)d.push(l),l=f;else return null}}a.apply=e;function n(l,c){for(let u=0;u<l.length&&u<c.length;u++)if(l[u]!==c[u])return!0;return!1}a.pathDisjoint=n;function r(l,c){if(l.length!==c.length)return!1;for(let u=0;u<l.length;u++)if(l[u]!==c[u])return!1;return!0}a.pathEq=r;function s(l,c){return n(l.path,c.path)}a.commutative=s;function o(l,c){return l.type===0&&c.type===0&&r(l.path,c.path)?Object.keys(l.props).every(u=>c.props[u]!==void 0):!1}a.subsumed=o})(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 o(c,u){for(let d of u){let h=a(c,d);h!==null&&(c=h.data)}return c}l.applyAll=o;function a(c,u){let d=c,h=[],p=[];for(let f of u)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let 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]=SB(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 T=[E];for(let _=x+1;_<b.length;_++){let A=b[_],C=A[A.length-1];if(typeof C=="number"&&rr.equal(S,A.slice(0,A.length-1)))T.push(C),b.splice(_,1);else break}let w=rr.zoom(d,S);g=w.map((_,A)=>T.includes(A)?f.id:_),m=w,E=S.pop()}else{if(E==="alphaOverride"||E==="alpha"){m/=100;let T=m,w=rr.zoom(d,S.slice(0,S.length-2)),_=w.layers.map(A=>A.id===S[S.length-1]?{...A,data:{...A.data,[E]:T}}:A);Object.setPrototypeOf(_,Object.getPrototypeOf(w.layers)),w.layers=_}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 $p)return null;throw m}return{data:d,actual:h,reverse:p.reverse()}}l.apply=a})(Yy||(Yy={}))});function TB(i,t){return i instanceof _n?Object.setPrototypeOf(t,_n.prototype):au.tryPreservePrototype(i,t)}function NC(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 zS(i,t,e){return e instanceof Ln?new Jp(i,t,e):e instanceof Fe?new ef(i,t,e):e instanceof st?new Proxy(new FC(i,t,e),tJ):e!==null&&typeof e=="object"?co(e)?e:new Proxy(new BC(i,t,e),eJ):e}function Dd(i){let t=new kS(i);return[zS(t,"",i),t]}function cu(i,t){let[e,n]=Dd(i);return t(e),n.result()}function Pr(i){return i instanceof Jp||i instanceof ef?i._current:i!==null&&typeof i=="object"?i[MB]:i}var MB,JQ,VS,Od,BC,FC,_B,eJ,tJ,Jp,ef,kS,UC=B(()=>{"use strict";Hy();ou();BS();lu();qr();Xy();qy();MB=Symbol(),JQ=Symbol(),VS=Symbol(),Od=class{reportOp(t,e,n=[]){let r=this;if(e===null)return;r._current=e.data;let s=n;for(;!(r instanceof kS);){let o=r._path,a=r._current;if(o!==""&&s.splice(0,0,o),r=r._parent,r===null)return;r.update(o,a)}r.push(s,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let n=e[VS];n&&n(),delete this._children[t]}}}};BC=class extends Od{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=TB(this._current,{...this._current,[t]:e})}runOp(t){let e=au.runOp(this._current,t);e!==null&&(e.data=TB(this._current,e.data)),this.reportOp(t,e,t.path)}},FC=class extends Od{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))}},_B={get(i,t){if(t===VS)return()=>{i._parent=null};if(t===MB)return i._current;if(t===JQ)return i;let{_current:e,_children:n}=i;if(t==="push"&&Array.isArray(e))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e[t],o=zS(i,t,s);return o!==s?(n===void 0&&(n={},i._children=n),n[t]=o,o):s},has(i,t){return t in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,t){let e=i._current,n=Reflect.getOwnPropertyDescriptor(e,t);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:e[t]}}},eJ={..._B,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}},tJ={..._B,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}},Jp=class extends Od{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[VS]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,n)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,o=zS(this,t,s);return o!==s?(n===void 0&&(n={},this._children=n),n[t]=o,o):s}add(t,e,n,r,s){this.runOp({type:7,parent:t,fi:e,id:n,data:r,children:s})}move(t,e,n){this.runOp({type:9,parent:t,fi:e,id:n})}insertAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.add(t,r[s],o.id,o.data,o.children)}}insertBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.add(t,r[s],o.id,o.data,o.children)}}moveAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.move(t,r[s],o)}}moveBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.move(t,r[s],o)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},ef=class extends Od{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[VS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id,s=this._current[n].fi;t(this.data(this._current[n].id),r,s,n)}}find(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id;if(t(this.data(r),r))return this.get(r)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:n}=this._current.at(t);return{id:e,fi:n,data:this.data(e)}}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,o=zS(this,t,s);return o!==s?(n===void 0&&(n={},this._children=n),n[t]=o,o):s}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,n){this.runOp({type:4,fi:t,id:e,data:n})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}insertBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}moveAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}moveBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};kS=class extends Od{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){NC(this.ts,e,t),NC(this.actual,n,t),NC(this.reverse,r,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}});var rr,Xy=B(()=>{"use strict";LS();UC();lu();ou();qr();(s=>{function i(o,a){if(a.length===o.length){let l=0;for(;l<o.length;){if(o[l]!==a[l])return!1;l+=1}}else return!1;return!0}s.equal=i;function t(o,a,l){let c=n(l,o);if(c!==void 0&&typeof c=="object"&&c!==null){let u={...a};return Object.keys(c).forEach(d=>{delete u[d]}),u}else return a}s.removeOverridden=t;function e(o,a){if((o instanceof Ln||o instanceof Jp)&&typeof a=="string")return o.data(a);if((o instanceof Fe||o instanceof ef)&&typeof a=="string")return o.data(a);if(typeof a=="number"&&Array.isArray(o))return o[a];if(typeof a=="string"&&typeof o=="object"&&o!==null)return o[a]}s.zoomOnce=e;function n(o,a,l=0){for(;l<a.length&&o!==void 0;)o=e(o,a[l]),l+=1;return o}s.zoom=n;function r(o,a){let l=[];function c(u,d){if(u instanceof Id&&u.id===a.id)l.push(d);else if(u instanceof Fe)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(p,[...d,h])});else if(Array.isArray(u)){if(typeof u[0]=="number")return;for(let h=0;h<u.length;h++)c(u[h],[...d,h])}else{if(co(u))return;if(typeof u=="object"&&u!==null)for(let h in u)c(u[h],[...d,h])}}return c(o,[]),l}s.findPathes=r})(rr||(rr={}))});var AB=B(()=>{"use strict"});function CB(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 PB=B(()=>{"use strict"});function GS(i){try{if(!ir.trusted&&!du){let e=hn.sharedLength||0;e<hn.length&&(hn.length=e)}let t;if(ir.randomAccessStructure&&Qe[ie]<64&&Qe[ie]>=32&&OB?(t=OB(Qe,ie,ho,ir),Qe=null,!(i&&i.lazy)&&t&&(t=t.toJSON()),ie=ho):t=Xr(),Pi&&(ie=Pi.postBundlePosition,Pi=null),du&&(hn.restoreStructures=null),ie==ho)hn&&hn.restoreStructures&&NB(),hn=null,Qe=null,$l&&($l=null);else{if(ie>ho)throw new Error("Unexpected end of MessagePack data");if(!du){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 hn&&hn.restoreStructures&&NB(),WC(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||ie>ho)&&(t.incomplete=!0),t}}function NB(){for(let i in hn.restoreStructures)hn[i]=hn.restoreStructures[i];hn.restoreStructures=null}function Xr(){let i=Qe[ie++];if(i<160)if(i<128){if(i<64)return i;{let t=hn[i&63]||ir.getStructures&&WB()[i&63];return t?(t.read||(t.read=qC(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]=Xr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(Xr(),Xr());return t}else{i-=144;let t=new Array(i);for(let e=0;e<i;e++)t[e]=Xr();return ir.freezeData?Object.freeze(t):t}else if(i<192){let t=i-160;if(Ua>=ie)return uu.slice(ie-uo,(ie+=t)-uo);if(Ua==0&&ho<140){let e=t<16?XC(t):qB(t);if(e!=null)return e}return HC(t)}else{let t;switch(i){case 192:return null;case 193:return Pi?(t=Xr(),t>0?Pi[1].slice(Pi.position1,Pi.position1+=t):Pi[0].slice(Pi.position0,Pi.position0-=t)):HB;case 194:return!1;case 195:return!0;case 196:if(t=Qe[ie++],t===void 0)throw new Error("Unexpected end of buffer");return kC(t);case 197:return t=on.getUint16(ie),ie+=2,kC(t);case 198:return t=on.getUint32(ie),ie+=4,kC(t);case 199:return Ld(Qe[ie++]);case 200:return t=on.getUint16(ie),ie+=2,Ld(t);case 201:return t=on.getUint32(ie),ie+=4,Ld(t);case 202:if(t=on.getFloat32(ie),ir.useFloat32>2){let e=ZB[(Qe[ie]&127)<<1|Qe[ie+1]>>7];return ie+=4,(e*t+(t>0?.5:-.5)>>0)/e}return ie+=4,t;case 203:return t=on.getFloat64(ie),ie+=8,t;case 204:return Qe[ie++];case 205:return t=on.getUint16(ie),ie+=2,t;case 206:return t=on.getUint32(ie),ie+=4,t;case 207:return ir.int64AsType==="number"?(t=on.getUint32(ie)*4294967296,t+=on.getUint32(ie+4)):ir.int64AsType==="string"?t=on.getBigUint64(ie).toString():ir.int64AsType==="auto"?(t=on.getBigUint64(ie),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=on.getBigUint64(ie),ie+=8,t;case 208:return on.getInt8(ie++);case 209:return t=on.getInt16(ie),ie+=2,t;case 210:return t=on.getInt32(ie),ie+=4,t;case 211:return ir.int64AsType==="number"?(t=on.getInt32(ie)*4294967296,t+=on.getUint32(ie+4)):ir.int64AsType==="string"?t=on.getBigInt64(ie).toString():ir.int64AsType==="auto"?(t=on.getBigInt64(ie),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=on.getBigInt64(ie),ie+=8,t;case 212:if(t=Qe[ie++],t==114)return zB(Qe[ie++]&63);{let e=qi[t];if(e)return e.read?(ie++,e.read(Xr())):e.noBuffer?(ie++,e()):e(Qe.subarray(ie,++ie));throw new Error("Unknown extension "+t)}case 213:return t=Qe[ie],t==114?(ie++,zB(Qe[ie++]&63,Qe[ie++])):Ld(2);case 214:return Ld(4);case 215:return Ld(8);case 216:return Ld(16);case 217:return t=Qe[ie++],Ua>=ie?uu.slice(ie-uo,(ie+=t)-uo):rJ(t);case 218:return t=on.getUint16(ie),ie+=2,Ua>=ie?uu.slice(ie-uo,(ie+=t)-uo):iJ(t);case 219:return t=on.getUint32(ie),ie+=4,Ua>=ie?uu.slice(ie-uo,(ie+=t)-uo):sJ(t);case 220:return t=on.getUint16(ie),ie+=2,FB(t);case 221:return t=on.getUint32(ie),ie+=4,FB(t);case 222:return t=on.getUint16(ie),ie+=2,UB(t);case 223:return t=on.getUint32(ie),ie+=4,UB(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 qC(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()":nJ.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(Xr)}catch{return IB=1/0,e()}return i.read0=r,i.highByte===0&&(i.read=BB(t,i.read)),r()}let n={};for(let r=0,s=i.length;r<s;r++){let o=i[r];o==="__proto__"&&(o="__proto_"),n[o]=Xr()}return ir.freezeData?Object.freeze(n):n}return e.count=0,i.read0=e,i.highByte===0?BB(t,e):e}function WB(){let i=$B(()=>(Qe=null,ir.getStructures()));return hn=ir._mergeStructures(i,hn)}function $y(i){let t;if(i<16&&(t=XC(i)))return t;if(i>64&&VC)return VC.decode(Qe.subarray(ie,ie+=i));let e=ie+i,n=[];for(t="";ie<e;){let r=Qe[ie++];if((r&128)===0)n.push(r);else if((r&224)===192){let s=Qe[ie++]&63,o=(r&31)<<6|s;o<128?n.push(65533):n.push(o)}else if((r&240)===224){let s=Qe[ie++]&63,o=Qe[ie++]&63,a=(r&31)<<12|s<<6|o;a<2048||a>=55296&&a<=57343?n.push(65533):n.push(a)}else if((r&248)===240){let s=Qe[ie++]&63,o=Qe[ie++]&63,a=Qe[ie++]&63,l=(r&7)<<18|s<<12|o<<6|a;l<65536||l>1114111?n.push(65533):(l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l))}else n.push(65533);n.length>=4096&&(t+=Ci.apply(String,n),n.length=0)}return n.length>0&&(t+=Ci.apply(String,n)),t}function FB(i){let t=new Array(i);for(let e=0;e<i;e++)t[e]=Xr();return ir.freezeData?Object.freeze(t):t}function UB(i){if(ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=XB();n==="__proto__"&&(n="__proto_"),t[n]=Xr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(Xr(),Xr());return t}}function qB(i){let t=ie,e=new Array(i);for(let n=0;n<i;n++){let r=Qe[ie++];if((r&128)>0){ie=t;return}e[n]=r}return Ci.apply(String,e)}function XC(i){if(i<4)if(i<2){if(i===0)return"";{let t=Qe[ie++];if((t&128)>1){ie-=1;return}return Ci(t)}}else{let t=Qe[ie++],e=Qe[ie++];if((t&128)>0||(e&128)>0){ie-=2;return}if(i<3)return Ci(t,e);let n=Qe[ie++];if((n&128)>0){ie-=3;return}return Ci(t,e,n)}else{let t=Qe[ie++],e=Qe[ie++],n=Qe[ie++],r=Qe[ie++];if((t&128)>0||(e&128)>0||(n&128)>0||(r&128)>0){ie-=4;return}if(i<6){if(i===4)return Ci(t,e,n,r);{let s=Qe[ie++];if((s&128)>0){ie-=5;return}return Ci(t,e,n,r,s)}}else if(i<8){let s=Qe[ie++],o=Qe[ie++];if((s&128)>0||(o&128)>0){ie-=6;return}if(i<7)return Ci(t,e,n,r,s,o);let a=Qe[ie++];if((a&128)>0){ie-=7;return}return Ci(t,e,n,r,s,o,a)}else{let s=Qe[ie++],o=Qe[ie++],a=Qe[ie++],l=Qe[ie++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){ie-=8;return}if(i<10){if(i===8)return Ci(t,e,n,r,s,o,a,l);{let c=Qe[ie++];if((c&128)>0){ie-=9;return}return Ci(t,e,n,r,s,o,a,l,c)}}else if(i<12){let c=Qe[ie++],u=Qe[ie++];if((c&128)>0||(u&128)>0){ie-=10;return}if(i<11)return Ci(t,e,n,r,s,o,a,l,c,u);let d=Qe[ie++];if((d&128)>0){ie-=11;return}return Ci(t,e,n,r,s,o,a,l,c,u,d)}else{let c=Qe[ie++],u=Qe[ie++],d=Qe[ie++],h=Qe[ie++];if((c&128)>0||(u&128)>0||(d&128)>0||(h&128)>0){ie-=12;return}if(i<14){if(i===12)return Ci(t,e,n,r,s,o,a,l,c,u,d,h);{let p=Qe[ie++];if((p&128)>0){ie-=13;return}return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p)}}else{let p=Qe[ie++],f=Qe[ie++];if((p&128)>0||(f&128)>0){ie-=14;return}if(i<15)return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p,f);let m=Qe[ie++];if((m&128)>0){ie-=15;return}return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p,f,m)}}}}}function kB(){let i=Qe[ie++],t;if(i<192)t=i-160;else switch(i){case 217:t=Qe[ie++];break;case 218:t=on.getUint16(ie),ie+=2;break;case 219:t=on.getUint32(ie),ie+=4;break;default:throw new Error("Expected string")}return $y(t)}function kC(i){return ir.copyBuffers?Uint8Array.prototype.slice.call(Qe,ie,ie+=i):Qe.subarray(ie,ie+=i)}function Ld(i){let t=Qe[ie++];if(qi[t]){let e;return qi[t](Qe.subarray(ie,e=ie+=i),n=>{ie=n;try{return Xr()}finally{ie=e}})}else throw new Error("Unknown extension type "+t)}function XB(){let i=Qe[ie++];if(i>=160&&i<192){if(i=i-160,Ua>=ie)return uu.slice(ie-uo,(ie+=i)-uo);if(!(Ua==0&&ho<180))return HC(i)}else return ie--,YB(Xr());let t=(i<<5^(i>1?on.getUint16(ie):i>0?Qe[ie]:0))&4095,e=VB[t],n=ie,r=ie+i-3,s,o=0;if(e&&e.bytes==i){for(;n<r;){if(s=on.getUint32(n),s!=e[o++]){n=1879048192;break}n+=4}for(r+=3;n<r;)if(s=Qe[n++],s!=e[o++]){n=1879048192;break}if(n===r)return ie=n,e.string;r-=3,n=ie}for(e=[],VB[t]=e,e.bytes=i;n<r;)s=on.getUint32(n),e.push(s),n+=4;for(r+=3;n<r;)s=Qe[n++],e.push(s);let a=i<16?XC(i):qB(i);return a!=null?e.string=a:e.string=HC(i)}function YB(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 $B(i){LB&&LB();let t=ho,e=ie,n=GC,r=uo,s=Ua,o=uu,a=zC,l=$l,c=Pi,u=new Uint8Array(Qe.slice(0,ho)),d=hn,h=hn.slice(0,hn.length),p=ir,f=du,m=i();return ho=t,ie=e,GC=n,uo=r,Ua=s,uu=o,zC=a,$l=l,Pi=c,Qe=u,du=f,hn=d,hn.splice(0,hn.length,...h),ir=p,on=new DataView(Qe.buffer,Qe.byteOffset,Qe.byteLength),m}function WC(){Qe=null,$l=null,hn=null}function KB(i){i.unpack?qi[i.type]=i.unpack:qi[i.type]=i}var VC,Qe,ho,ie,jB,zC,GC,ir,hn,uu,uo,Ua,Pi,$l,qi,on,RB,jC,HB,du,IB,OB,DB,LB,hu,nJ,BB,HC,rJ,iJ,sJ,Ci,VB,zB,GB,oJ,aJ,lJ,ZB,jS,hge,pge,fge,cJ,mge,QB=B(()=>{try{VC=new TextDecoder}catch{}ie=0,jB=[],zC=jB,GC=0,ir={},uo=0,Ua=0,qi=[],RB={useRecords:!1,mapsAsObjects:!0},jC=class{},HB=new jC;HB.name="MessagePack 0xC1";du=!1,IB=2,hu=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(Qe)return $B(()=>(WC(),this?this.unpack(t,e):hu.prototype.unpack.call(RB,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(ho=e.end||t.length,ie=e.start||0):(ie=0,ho=e>-1?e:t.length),GC=0,Ua=0,uu=null,zC=jB,Pi=null,Qe=t;try{on=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw Qe=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 hu){if(ir=this,this.structures)return hn=this.structures,GS(e);(!hn||hn.length>0)&&(hn=[])}else ir=RB,(!hn||hn.length>0)&&(hn=[]);return GS(e)}unpackMultiple(t,e){let n,r=0;try{du=!0;let s=t.length,o=this?this.unpack(t,s):jS.unpack(t,s);if(e){if(e(o,r,ie)===!1)return;for(;ie<s;)if(r=ie,e(GS(),r,ie)===!1)return}else{for(n=[o];ie<s;)r=ie,n.push(GS());return n}}catch(s){throw s.lastPosition=r,s.values=n,s}finally{du=!1,WC()}}_mergeStructures(t,e){DB&&(t=DB.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)}};nJ=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;BB=(i,t)=>function(){let e=Qe[ie++];if(e===0)return t();let n=i<32?-(i+(e<<5)):i+(e<<5),r=hn[n]||WB()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=qC(r,i)),r.read()};HC=$y,rJ=$y,iJ=$y,sJ=$y;Ci=String.fromCharCode;VB=new Array(4096);zB=(i,t)=>{let e=Xr().map(YB),n=i;t!==void 0&&(i=i<32?-((t<<5)+i):(t<<5)+i,e.highByte=t);let r=hn[i];return r&&(r.isShared||du)&&((hn.restoreStructures||(hn.restoreStructures=[]))[i]=r),hn[i]=e,e.read=qC(e,n),(e.read0||e.read)()};qi[0]=()=>{};qi[0].noBuffer=!0;qi[66]=i=>{let t=i.byteLength%8||8,e=BigInt(i[0]&128?i[0]-256:i[0]);for(let n=1;n<t;n++)e<<=BigInt(8),e+=BigInt(i[n]);if(i.byteLength!==t){let n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=(s,o)=>{let a=o-s;if(a<=40){let d=n.getBigUint64(s);for(let h=s+8;h<o;h+=8)d<<=BigInt(64),d|=n.getBigUint64(h);return d}let l=s+(a>>4<<3),c=r(s,l),u=r(l,o);return c<<BigInt((o-l)*8)|u};e=e<<BigInt((n.byteLength-t)*8)|r(t,n.byteLength)}return e};GB={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};qi[101]=()=>{let i=Xr();if(!GB[i[0]]){let t=Error(i[1],{cause:i[2]});return t.name=i[0],t}return GB[i[0]](i[1],{cause:i[2]})};qi[105]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=on.getUint32(ie-4);$l||($l=new Map);let e=Qe[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)&&Qe[ie+1]===115?n=new Set:n={};let r={target:n};$l.set(t,r);let s=Xr();if(r.used)Object.assign(n,s);else return r.target=s;if(n instanceof Map)for(let[o,a]of s.entries())n.set(o,a);if(n instanceof Set)for(let o of Array.from(s))n.add(o);return n};qi[112]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=on.getUint32(ie-4),e=$l.get(t);return e.used=!0,e.target};qi[115]=()=>new Set(Xr());oJ=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array"),aJ=typeof globalThis=="object"?globalThis:window;qi[116]=i=>{let t=i[0],e=Uint8Array.prototype.slice.call(i,1).buffer,n=oJ[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 aJ[n](e)};qi[120]=()=>{let i=Xr();return new RegExp(i[0],i[1])};lJ=[];qi[98]=i=>{let t=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],e=ie;return ie+=t-i.length,Pi=lJ,Pi=[kB(),kB()],Pi.position0=0,Pi.position1=0,Pi.postBundlePosition=ie,ie=e,Xr()};qi[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");ZB=new Array(147);for(let i=0;i<256;i++)ZB[i]=+("1e"+Math.floor(45.15-i*.30103));jS=new hu({useRecords:!1}),hge=jS.unpack,pge=jS.unpackMultiple,fge=jS.unpack,cJ=new Float32Array(1),mge=new Uint8Array(cJ.buffer,0,4)});var uJ,dJ,HS,JB=B(()=>{"use strict";QB();LS();qy();lu();Hy();ou();uJ=[{Class:st.prototype.constructor,type:1,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,st.prototype),i}},{Class:Fe.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Fe.prototype),i}},{Class:Ln.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Ln.prototype),i}},{Class:Id.prototype.constructor,type:4,write(i){return i.id},read(i){return new Id(i)}},{Class:jy.prototype.constructor,type:5,write(i){return i.data},read(i){return new jy(i)}},{Class:_n.prototype.constructor,type:6,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,_n.prototype),i}}];for(let i of uJ)KB(i);dJ=new hu({structuredClone:!0});(t=>{function i(e){return dJ.unpack(e)}t.deserialize=i})(HS||(HS={}))});var eF,Nd,tF=B(()=>{"use strict";JB();eF=i=>()=>{throw new Error(i+" is not available in the runtime build (decode-only CollabSerialize)")},Nd={deserialize:HS.deserialize,serialize:eF("CollabSerialize.serialize"),checksum:eF("CollabSerialize.checksum")}});var an=B(()=>{Xy();yB();NS();ou();Hy();BS();lu();EB();AB();UC();PB();LS();tF();OC();qy()});function Ky(i){return i==="MouseDown"||i==="MouseUp"||i==="KeyDown"||i==="KeyUp"||i==="Collision"||i==="Trigger"}var nF,$C,tf,WS,YC,rF,iF,sF,qS,XS,oF,aF,lF,cF,uF,YS,$S,dF,hF,pF,fF,KC=B(()=>{"use strict";an();q();(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})(nF||(nF={}));$C={["LookAt"]:[],["Follow"]:["Create"],["DragDrop"]:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseHover"]:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Scroll"]:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Start"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Conditional"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MousePress"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyPress"]:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["GameControl"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],["Collision"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Trigger"]:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Resize"]:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["VariableChange"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["API"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["WEBHOOK"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["AIAssistantListener"]:["SetVariable"],["AIAssistantTrigger"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(e=>{function i(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"}e.is=i;function t(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new Fe}:{type:n,disabled:!1,name:"",key:void 0,actions:new Fe}}e.defaultData=t})(tf||(tf={}));(e=>{function i(n){return{type:"Property",value:[n??null,"position","x"]}}e.propertyDefaultData=i,e.valueDefaultData={type:"Literal",value:0}})(WS||(WS={}));(n=>{function i(r){return{type:"Comparison",operator:"==",lOperand:WS.propertyDefaultData(r),rOperand:{...WS.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})(YC||(YC={}));(t=>{function i(e){return e.find(n=>n==="ifActions"||n==="elseActions")!==void 0}t.isConditionalSubActions=i})(rF||(rF={}));(e=>{function i(n){return n.type==="Conditional"}e.is=i;function t(n){return{type:"Conditional",disabled:!1,name:"",inActions:new Fe,outActions:new Fe,condition:YC.distanceDefaultData(n)}}e.defaultData=t})(iF||(iF={}));(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 Fe,drop:new Fe}})(sF||(sF={}));(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 Fe})(qS||(qS={}));(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})(XS||(XS={}));(e=>{function i(n){return n.type==="MouseHover"}e.is=i;function t(){return{type:"MouseHover",disabled:!1,name:"",actions:new Fe}}e.defaultData=t})(oF||(oF={}));(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 Fe}}e.defaultData=t})(aF||(aF={}));(e=>{function i(n){return n.type==="Start"}e.is=i;function t(){return{type:"Start",disabled:!1,name:"",actions:new Fe}}e.defaultData=t})(lF||(lF={}));(e=>{function i(n){return n.type==="Collision"}e.is=i;function t(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Fe}}e.defaultData=t})(cF||(cF={}));(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 Fe,triggerZone:"box",position:r.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}e.defaultData=t})(uF||(uF={}));(o=>{o.defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]};function t(a){return a.type==="Resize"}o.is=t;function e(a){return typeof a=="string"?a:"custom"}o.sizeToDevice=e;function n(a){return typeof a=="string"?[...o.defaultSizes[a]]:[...a]}o.deviceToSize=n;function r(){let a={size:"mobile",operator:"<",actions:new Fe},l={size:"tablet",operator:"<",actions:new Fe},c={size:[...o.defaultSizes.custom],operator:"<>",actions:new Fe},u=new Fe;return u.push({id:ge.generateUUID(),fi:0,data:a},{id:ge.generateUUID(),fi:1,data:l},{id:ge.generateUUID(),fi:2,data:c}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:u}}o.defaultData=r;function s(){return{size:[...o.defaultSizes.custom],operator:"<>",actions:new Fe}}o.defaultBreakpointData=s})(YS||(YS={}));(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 Fe,variableId:"",objectId:null,property:"Position X"}}n.defaultData=e})($S||($S={}));(e=>{function i(n){return n.type==="API"}e.is=i;function t(){return{disabled:!1,type:"API",name:"",successActions:new Fe,errorActions:new Fe,userAPIId:""}}e.defaultData=t})(dF||(dF={}));(e=>{function i(n){return n.type==="WEBHOOK"}e.is=i;function t(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Fe,userWebhookId:""}}e.defaultData=t})(hF||(hF={}));(e=>{function i(n){return n.type==="AIAssistantListener"}e.is=i;function t(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Fe,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=t})(pF||(pF={}));(e=>{function i(n){return n.type==="AIAssistantTrigger"}e.is=i;function t(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Fe}}e.defaultData=t})(fF||(fF={}))});function yF(i){let t=typeof i;return i!==null&&(t==="object"||t==="function")}function ZC(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 fo,fu,vF,Er,ZS,Ws,po,Bd,mF,pu,yr,Vt,KS,Fd,ea,Kl,gF,Ts=B(()=>{"use strict";fo="personal camera",fu="a218fcc3-276b-49b9-b485-49037fd14f5f",vF=2500134,Er=5526619,ZS=(n=>(n.x="x",n.y="y",n.z="z",n))(ZS||{});(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 o(f,m){return Math.pow(m[0]-f[0],2)+Math.pow(m[1]-f[1],2)}p.distanceSquared=o;function a(f,m){return Math.sqrt(o(f,m))}p.distance=a;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 a(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})(Ws||(Ws={}));(a=>{function i(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]}a.isEqual=i;function t(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}a.add=t;function e(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]}a.sub=e;function n(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]}a.div=n;function r(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]}a.mul=r;function s(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])}a.dist=s;function o(l,c,u){return[l[0]+(c[0]-l[0])*u,l[1]+(c[1]-l[1])*u,l[2]+(c[2]-l[2])*u]}a.lerp=o})(po||(po={}));(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})(Bd||(Bd={}));(o=>{let i=180/Math.PI,t=Math.PI/180;function e(a){return typeof a=="number"?a*i:a}function n(a){return typeof a=="number"?a*t:a}function r(a){return[e(a[0]),e(a[1]),e(a[2])]}o.radToDeg=r;function s(a){return[n(a[0]),n(a[1]),n(a[2])]}o.degToRad=s})(mF||(mF={}));(r=>{r.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(s,o){for(let a=0;a<16;a++)if(s[a]!==o[a])return!1;return!0}r.isEqual=t;function e(s){return s??r.identity}r.simplify=e;function n(s,o){let a=o.slice(0);for(let l=0,c=o.length;l<c;l+=3){let u=s[3]*o[l]+s[7]*o[l+1]+s[11]*o[l+2]+s[15];a[l]=(s[0]*o[l]+s[4]*o[l+1]+s[8]*o[l+2]+s[12])/u,a[l+1]=(s[1]*o[l]+s[5]*o[l+1]+s[9]*o[l+2]+s[13])/u,a[l+2]=(s[2]*o[l]+s[6]*o[l+1]+s[10]*o[l+2]+s[14])/u}return a}r.applyMatrix4=n})(pu||(pu={}));(h=>{function i(p){return typeof p=="object"&&typeof p.r=="number"&&typeof p.g=="number"&&typeof p.b=="number"}h.isRGB=i,h.white={r:1,g:1,b:1},h.red={r:1,g:0,b:0},h.black={r:0,g:0,b:0};function r(p){return{r:Math.round(p.r*255),g:Math.round(p.g*255),b:Math.round(p.b*255),a:1}}h.toRgb255a1=r;function s(p){return{r:p.r,g:p.g,b:p.b}}h.clone=s;function o(p){return p=Math.floor(p),{r:(p>>16&255)/255,g:(p>>8&255)/255,b:(p&255)/255}}h.fromHex=o;function a(p){return Math.round(p.r*255)*65536+Math.round(p.g*255)*256+Math.round(p.b*255)}h.toHex=a;function l(p,f){return p.r===f.r&&p.g===f.g&&p.b===f.b}h.equals=l;function c(p,f){return p.r.toFixed(2)===f.r.toFixed(2)&&p.g.toFixed(2)===f.g.toFixed(2)&&p.b.toFixed(2)===f.b.toFixed(2)}h.equalsFixed=c;function u(p,f,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 yF(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 yF(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 o(d,h){return yr.equals(d,h)&&d.a===h.a}u.equals=o;function a(d,h){return yr.equalsFixed(d,h)&&d.a.toFixed(2)===h.a.toFixed(2)}u.equalsFixed=a;function l(d,h,p){return{r:d.r+(h.r-d.r)*p,g:d.g+(h.g-d.g)*p,b:d.b+(h.b-d.b)*p,a:d.a+(h.a-d.a)*p}}u.lerp=l;function c({r:d,g:h,b:p,a:f}=u.white){return`rgba(${d*255}, ${h*255}, ${p*255}, ${f})`}u.toStyle=c})(Vt||(Vt={}));(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]})(KS||(KS={}));Fd=(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))(Fd||{});(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(ea||(ea={}));(t=>t.defaultData={control1:[.5,0],control2:[.5,1]})(Kl||(Kl={}));(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]))(gF||(gF={}))});var bF,xF,SF,wF,EF,TF,MF,QC,_F,AF,JC,CF,PF,RF,eP,IF,tP,OF,DF,nP,LF,QS,NF,BF,FF,UF,kF,VF=B(()=>{"use strict";an();KC();(t=>t.defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"})(bF||(bF={}));(t=>t.defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"})(xF||(xF={}));(t=>t.defaultData={type:"Link",name:"",url:null,context:"tab"})(SF||(SF={}));(t=>t.defaultData={type:"Destroy",name:"",objects:[],delay:0})(wF||(wF={}));(t=>t.defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"})(EF||(EF={}));(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"})(TF||(TF={}));(t=>t.defaultData={type:"Reset",name:"",delay:0})(MF||(MF={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1})(QC||(QC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(_F||(_F={}));(s=>(s.defaultData={type:"Audio",name:"",...QC.defaultData},s.hasAudioByActions=o=>o.some(({data:a})=>a.type==="Audio"&&a.interaction==="play"&&a.audio),s.hasAudioByEvents=o=>s.getAudiosByEvents(o).length>0,s.getAudiosByActions=o=>{let a=[];return o.forEach(l=>{let c=l.data;c.type==="Audio"&&c.interaction==="play"&&c.audio&&a.push(l),c.type==="Conditional"&&(a.push(...s.getAudiosByActions(c.ifActions)),a.push(...s.getAudiosByActions(c.elseActions)))}),a},s.getAudiosByEvents=o=>{let a=[];return o.forEach(({data:l})=>{tf.is(l)||l.type==="Collision"||l.type==="Start"||l.type==="Trigger"||l.type==="VariableChange"||l.type==="WEBHOOK"||l.type==="AIAssistantTrigger"?a.push(...s.getAudiosByActions(l.actions)):l.type==="Conditional"?(a.push(...s.getAudiosByActions(l.inActions)),a.push(...s.getAudiosByActions(l.outActions))):l.type==="GameControl"?Object.values(l.gameActions).forEach(c=>{a.push(...s.getAudiosByActions(c))}):l.type==="DragDrop"?(a.push(...s.getAudiosByActions(l.dragDropActions.drag)),a.push(...s.getAudiosByActions(l.dragDropActions.drop))):l.type==="Resize"?l.breakpoints.forEach(({data:c})=>{a.push(...s.getAudiosByActions(c.actions))}):l.type==="API"&&(a.push(...s.getAudiosByActions(l.successActions)),a.push(...s.getAudiosByActions(l.errorActions)))}),a}))(AF||(AF={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1/0})(JC||(JC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(CF||(CF={}));(s=>(s.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...JC.defaultData},s.hasVideoByActions=o=>o.some(({data:a})=>a.type==="Video"&&a.interaction==="play"&&a.layerId),s.hasVideoByObject=o=>{if(o.events){for(let{data:a}of o.events)if((tf.is(a)||a.type==="Start")&&s.hasVideoByActions(a.actions))return!0}},s.getVideosByActions=o=>{let a=[];return o.forEach(l=>{let c=l.data;c.type==="Video"&&c.interaction==="play"&&c.layerId&&a.push(l)}),a},s.getVideosByEvents=o=>{let a=[];return o.forEach(({data:l})=>{(tf.is(l)||l.type==="Start")&&a.push(...s.getVideosByActions(l.actions))}),a}))(PF||(PF={}));(t=>{function i(e){return{state:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}}t.defaultData=i})(RF||(RF={}));(t=>{function i(){return{tweens:new Fe,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}}t.defaultData=i})(eP||(eP={}));(t=>{function i(e){return{type:"Transition",name:"",runMode:"Once",object:e??null,...eP.defaultData()}}t.defaultData=i})(IF||(IF={}));(t=>{function i(e){return{interaction:"play",timeline:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}}t.defaultData=i})(tP||(tP={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(OF||(OF={}));(t=>{function i(e){return{type:"TimelineAnimation",name:"",...tP.defaultData(e)}}t.defaultData=i})(DF||(DF={}));(t=>{function i(e,n,r){return{interaction:"play",object:e,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}}t.defaultData=i})(nP||(nP={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(LF||(LF={}));(e=>{function i(n,r,s){return{type:"Animation",name:"",...nP.defaultData(n,r,s)}}e.defaultData=i;function t(n){return n.interaction==="pause"||n.interaction==="stop"}e.isPause=t})(QS||(QS={}));(t=>t.defaultData={type:"SetVariable",name:"",variableId:"",expression:[]})(NF||(NF={}));(t=>t.defaultData=()=>({type:"Conditional",name:"",ifActions:new Fe,elseActions:new Fe,condition:[]}))(BF||(BF={}));(t=>t.defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0})(FF||(FF={}));(t=>t.defaultData={type:"ClearLocalStorage",name:"",target:"all"})(UF||(UF={}));(t=>t.defaultData={name:"",type:"UserAPI"})(kF||(kF={}))});var zF,GF=B(()=>{"use strict";(e=>(e.emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),n=>n.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6))(zF||(zF={}))});var ta,na,rP=B(()=>{"use strict";(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(n){return e.all.includes(n)}e.is=t})(ta||(ta={}));(p=>{p.DefaultUp=[0,1,0],p.DefaultTargetOffset=1e3,p.MinTargetOffset=.001;function n(f){return f===void 0||!Number.isFinite(f)||f<p.MinTargetOffset?p.DefaultTargetOffset:f}p.sanitizeTargetOffset=n,p.DefaultAzimuth=-24,p.DefaultElevation=15;let o=p.DefaultAzimuth*Math.PI/180,a=p.DefaultElevation*Math.PI/180,l=180/Math.PI;p.DefaultPosition=[p.DefaultTargetOffset*Math.sin(o)*Math.cos(a),p.DefaultTargetOffset*Math.sin(a),p.DefaultTargetOffset*Math.cos(o)*Math.cos(a)],p.DefaultRotation=[Math.atan2(-Math.sin(a),Math.cos(o)*Math.cos(a))*l,Math.asin(Math.sin(o)*Math.cos(a))*l,Math.atan2(Math.sin(o)*Math.sin(a),Math.cos(o))*l],p.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:p.DefaultUp,isUpVectorFlipped:!1,targetOffset:p.DefaultTargetOffset};function h(f){return f.type==="PerspectiveCamera"?f.perspective?.zoom??1:f.orthographic?.zoom??1}p.getZoom=h})(na||(na={}))});var ka,JS,iP,e1,t1,n1,r1,i1,sP=B(()=>{"use strict";(n=>{function i(r,s=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:Math.max(typeof r[0]=="number"?r[0]:1,typeof r[1]=="number"?r[1]:1)*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof r[0]=="number"?r[0]+r[0]:1)*s,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:r.map(o=>(typeof o=="number"?o:1)*(1+s)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}}n.defaultData=i;function t(r,s){let o={...r};if(iP.forEach(a=>{Object.assign(o,{[a]:s[a]??r[a]})}),o.radial={...r.radial},s.radial){let a=r.radial,l=s.radial;e1.forEach(c=>{Object.assign(o.radial,{[c]:l[c]??a[c]})})}if(o.linear={...r.linear},s.linear){let a=r.linear,l=s.linear;t1.forEach(c=>{Object.assign(o.linear,{[c]:l[c]??a[c]})})}if(o.grid={...r.grid},s.grid){let a=r.grid,l=s.grid;n1.forEach(c=>{Object.assign(o.grid,{[c]:l[c]??a[c]})})}if(o.toObject={...r.toObject},s.toObject){let a=r.toObject,l=s.toObject;r1.forEach(c=>{Object.assign(o.toObject,{[c]:l[c]??a[c]})})}if(o.randomnessObject={...r.randomnessObject},s.randomnessObject){let a=r.randomnessObject,l=s.randomnessObject;i1.forEach(c=>{Object.assign(o.randomnessObject,{[c]:l[c]??a[c]})})}return o}n.merge=t;function e(r){return!!(r.randomnessObject||r.toObject)}n.isPartial=e})(ka||(ka={}));(n=>{n.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function e(r,s){let o=[];r.count!==void 0&&o.push({type:0,path:s,props:{count:r.count}});for(let a of t){let l=r[a];l&&Object.keys(l).length>0&&o.push({type:0,path:[...s,a],props:l})}return o}n.toOps=e})(JS||(JS={}));iP=["count"],e1=["radius","start","end","position","scale","rotation"],t1=["position","scale","rotation"],n1=["count","size"],r1=["count","position","scale","rotation"],i1=["strength","scale","rotation","position","movement","seed","freqScale"]});var s1,o1,oP=B(()=>{"use strict";Ts();(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(n){return e.all.includes(n)}e.is=t})(s1||(s1={}));(e=>{function i(n){return t(n)}e.defaultData=i;function t(n){if(n==="PointLight")return{type:n,color:Vt.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(n==="SpotLight")return{type:n,color:Vt.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(n==="DirectionalLight")return{type:n,color:Vt.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(o1||(o1={}))});var nf,aP=B(()=>{"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}))(nf||(nf={}))});var a1,lP=B(()=>{"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"]))(a1||(a1={}))});var mu,l1=B(()=>{"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]})(mu||(mu={}))});var u1,cP,uP,c1,jF,dP=B(()=>{"use strict";u1=(n=>(n[n.Front=0]="Front",n[n.Back=1]="Back",n[n.Double=2]="Double",n))(u1||{});(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(n,r){return n.castShadow===r.castShadow&&n.receiveShadow===r.receiveShadow}e.equals=t})(cP||(cP={}));(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})(uP||(uP={}));(t=>t.defaultData={...uP.defaultData,...cP.defaultData})(c1||(c1={}));(t=>{function i(e,n){let r=[];if("material"in e){let s=typeof e.material=="string"?n.materials[e.material]??n.lib.materials[e.material]?.asset:e.material;s&&r.push(s)}else if("materials"in e)for(let s of e.materials){let o=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;o&&r.push(o)}return r}t.getMaterialData=i})(jF||(jF={}))});var rf,hP=B(()=>{"use strict";(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(rf||(rf={}))});function XF(i){return i.type!=="displace"}var HF,WF,Zy,qF,d1,Ud,Qy,pP,fP,h1,mP,gP,sf,p1,Qn,An,of=B(()=>{"use strict";an();Ts();hP();Ts();(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})(HF||(HF={}));(t=>{function i(e){return e==="luminance"||e==="r"||e==="g"||e==="b"||e==="a"}t.is=i})(WF||(WF={}));(t=>{function i(e){return typeof e=="object"&&e!==null&&e.image!=null}t.is=i})(Zy||(Zy={}));(t=>{function i(e){return e==="phong"||e==="toon"||e==="lambert"||e==="physical"}t.is=i})(qF||(qF={}));d1=(n=>(n[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",n))(d1||{}),Ud=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(Ud||{}),Qy=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(Qy||{}),pP=(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))(pP||{}),fP=(o=>(o[o.Simplex=0]="Simplex",o[o.SimplexFractal=1]="SimplexFractal",o[o.Ashima=2]="Ashima",o[o.Fbm=3]="Fbm",o[o.Perlin=4]="Perlin",o[o.Voronoi=5]="Voronoi",o))(fP||{}),h1=(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))(h1||{}),mP=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(mP||{}),gP=(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))(gP||{}),sf=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],p1=["wrapping","image","video","name","minFilter","magFilter"];(s=>{function i(o,a){let{texture:l,...c}=a;if(Object.assign(o,c),l){let u=o.texture;u&&Object.assign(u,l)}}s.patch=i;function t(o){return{...s.defaultData("color"),color:o}}s.defaultColorLayer=t;function e(o,a){return o==="light"&&a?n(a):r(o)}s.defaultData=e;function n(o){let a={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...a,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...a,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...a,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...a,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}function r(o){let a={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...a,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...a,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:rf.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...a,type:"color",color:yr.fromHex(Er)};case"vertexColor":return{...a,type:"vertexColor"};case"depth":return{...a,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...a,type:"normal",cnormal:[1,1,1]};case"gradient":return{...a,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...a,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...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{...a,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...a,type:"fresnel",color:Vt.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...a,type:"dust",color:Vt.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...a,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...a,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Vt.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...a,type:"outline",outlineColor:Vt.fromHexAndA(0,1),contourColor:Vt.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...a,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...a,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...a,type:"reflection",blur:0,thickness:10/1e4,steps:60,stepSize:5/1e3,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...a,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...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 Fe}}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 Fe;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 o(d,h,p="layer1",f="layer2"){let m=new Fe;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=o;function a(d){let h=Qn.defaultData("texture");d&&Object.assign(h.texture,{image:d});let p=new Fe;return p.push({fi:0,data:h,id:"layer1"}),p.push({fi:1,data:{...Qn.defaultData("transmission"),alpha:1},id:"layer2"}),p.push({fi:2,data:{...Qn.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:p}}u.defaultUIObjectMaterial=a;function l(d,h="physical",p="layer1",f="layer2"){let m=Qn.defaultData("texture");Object.assign(m.texture,{image:d});let g=new Fe;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 Fe;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 kd,yP,YF=B(()=>{"use strict";kd="Roboto_regular",yP="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"});var $F=B(()=>{"use strict";YF()});var Vd,vP=B(()=>{"use strict";an();(t=>{function i(){return{points:new Fe,roundness:0,shapeHoles:[],isClosed:!1}}t.defaultData=i})(Vd||(Vd={}))});var af,zd,f1,m1,Jy,bP=B(()=>{"use strict";an();(t=>{function i(){return{points:new Fe,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}t.defaultData=i})(af||(af={}));zd={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(t=>{function i(e,n){let r={...e};return Jy.forEach(s=>{Object.assign(r,{[s]:n[s]??e[s]})}),r}t.merge=i})(f1||(f1={}));m1={shape:zd,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},Jy=["depth","offset","angle","twist","startScale","endScale"]});var ev,g1,mo,y1,v1=B(()=>{"use strict";vP();bP();(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})(ev||(ev={}));(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,f1.merge(r.extrusion,n.extrusion))),r}t.merge=i})(g1||(g1={}));(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:af.defaultData(),extrusion:m1};if(e==="VectorGeometry")return{width:1,height:1,type:e,subdivisions:12,shape:Vd.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,projection:"all",projectionTargets:[]};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})(mo||(mo={}));y1=["width","height","depth"]});var Fr,xP=B(()=>{"use strict";Ts();(o=>{o.defaultData={enabled:!1,useBackgroundColor:!1,color:yr.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0};function t(a){return a.mode??"linear"}o.getMode=t;function e(a){let l=t(a);return l==="height"?1:l==="both"?2:0}o.getModeIndex=e;function n(a){return a.density??o.defaultData.density}o.getDensity=n;function r(a){return a.heightFalloff??o.defaultData.heightFalloff}o.getHeightFalloff=r;function s(a){return a.heightBase??o.defaultData.heightBase}o.getHeightBase=s})(Fr||(Fr={}))});var SP,Va,b1=B(()=>{"use strict";(t=>t.defaultData={image:null,rotation:0,blur:32,showBackground:!0})(SP||(SP={}));(t=>t.defaultData={enabled:!1,mode:"hdri",hdri:SP.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2})(Va||(Va={}))});var lf,wP=B(()=>{"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}}})(lf||(lf={}))});var Gd,EP,TP,MP,gu,_P,x1,S1=B(()=>{"use strict";xP();b1();wP();Ts();(e=>{e.defaultData={type:"normal",softShadowQuality:"low"};function t(n){return n==null?!1:n.type===void 0||n.type==="soft"}e.isSoft=t})(Gd||(Gd={}));(t=>t.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(EP||(EP={}));(t=>t.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(TP||(TP={}));(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})(MP||(MP={}));(t=>t.defaultData={usePhysics:!1,gravity:-10})(gu||(gu={}));(t=>t.defaultData={playCamera:fo,gameControlObject:null})(_P||(_P={}));(t=>t.defaultData={backgroundColor:Vt.fromHexAndA(vF,1),postprocessing:lf.defaultData,fog:Fr.defaultData,sky:Va.defaultData,globalPhysics:gu.defaultData,ambient:EP.defaultData,ao:TP.defaultData,shadow:Gd.defaultData,publish:_P.defaultData,grading:MP.defaultData})(x1||(x1={}))});var w1,KF=B(()=>{"use strict";(t=>t.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(w1||(w1={}))});var ZF,cf,rU,Ur,uf,QF,JF,eU,tU,go,jd,df,hf,yo,ra,nU,ia,tv=B(()=>{"use strict";an();rP();oP();aP();lP();l1();dP();Ts();of();v1();sP();qr();S1();KF();(e=>{function i(n){return n==="Component"||n==="Instance"}e.isComponentRelated=i;function t(n){return n==="Empty"||n==="Instance"}e.isEmptyOrComponent=t})(ZF||(ZF={}));(r=>{r.identity={...KS.identity,hiddenMatrix:pu.identity};function t(s){return{position:s.position,rotation:s.rotation,scale:s.scale,pivot:s.pivot,pivotRotation:s.pivotRotation,hiddenMatrix:s.hiddenMatrix}}r.fromObject=t;function e(s,o){return{position:o?.position||s.position,rotation:o?.rotation||s.rotation,pivot:o?.pivot||s.pivot,pivotRotation:o?.pivotRotation||s.pivotRotation,scale:o?.scale||s.scale,hiddenMatrix:o?.hiddenMatrix||s.hiddenMatrix}}r.merge=e;function n(s,o){return OS({position:po.isEqual(s.position,o.position)?void 0:o.position,rotation:po.isEqual(s.rotation,o.rotation)?void 0:o.rotation,scale:po.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:pu.isEqual(s.hiddenMatrix,o.hiddenMatrix)?void 0:o.hiddenMatrix})}r.diff=n})(cf||(cf={}));rU=["slide","offset"];(t=>t.defaultData={states:new Fe,events:new Fe,visible:!0,raycastLock:!1,physics:mu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...cf.identity,cloner:null})(Ur||(Ur={}));(t=>t.defaultData={type:"Empty",...Ur.defaultData})(uf||(uf={}));(t=>t.defaultData={type:"ParticleCollider",...w1.defaultData,...Ur.defaultData})(QF||(QF={}));(t=>t.defaultData={type:"Component",...Ur.defaultData})(JF||(JF={}));(t=>t.defaultData={type:"Particle",...Ur.defaultData,...nf.defaultData})(eU||(eU={}));(t=>t.defaultData={type:"Hair",...Ur.defaultData,...a1.defaultData})(tU||(tU={}));(t=>t.defaultData={type:"Mesh",...Ur.defaultData,...c1.defaultData})(go||(go={}));(t=>t.defaultData={...Ur.defaultData,...cf.identity,position:na.DefaultPosition,rotation:na.DefaultRotation,...na.defaultData})(jd||(jd={}));(e=>{function i(n){return{...Ur.defaultData,...o1.defaultData(n)}}e.defaultData=i,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(df||(df={}));(e=>{function i(n,r,s=0){for(;s<r.length;){let o=n?n[r[s]]:void 0;if(r.length===s+1)return o;if(o)n=o.descendants,s+=1;else return}}e.resolveWithDes=i;function t(n,r,s=0){let o=i(n,r,s);if(o){let a=Object.keys(o);if(a.length===1&&a[0]==="descendants")return}return o}e.resolve=t})(hf||(hf={}));(s=>{s.rootOverrideProps=["physics","events"],s.compositeNonOptionalOverrideProps=["geometry"],s.compositeEntireOverrideOverrideProps=["material"];function n(o,a){return{...Ur.defaultData,...a,component:o,overrides:new _n,physics:void 0,events:void 0,type:"Instance"}}s.ofComponent=n;function r(o){let a=cf.fromObject(o.data);return n(o.id,a)}s.fromComponentData=r})(yo||(yo={}));(e=>{e.defaultData={type:"Page",...Ur.defaultData,physics:{...mu.defaultData,fusedBody:!1},...x1.defaultData,camera:jd.defaultData,timelines:new st};function t(n){return n.uiScene!==void 0}e.isUIPage=t})(ra||(ra={}));(a=>(a.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:pu.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:mu.defaultData,states:new Fe,events:new Fe,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...na.defaultData},a.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},a.defaultMeshObject={name:"Rectangle",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("RectangleGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultBooleanObject={name:"Boolean",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("BooleanGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultShapeBlendObject={name:"Shape Blend",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("ShapeBlendGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultTextObject={name:"Text",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("TextGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultInputObject={name:"Input",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("InputGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")}))(nU||(nU={}));(r=>{function i(s,o){let a={name:o};return s.type==="Mesh"?(a.geometry={},"material"in s&&(a.material={layers:new _n}),"materials"in s&&(a.materials=s.materials.map(l=>({layers:new _n})))):ta.is(s.type)&&(a.perspective={},a.orthographic={}),a}r.newEmpty=i;function t(s,o){if(o===void 0)return s;let a={...s};return"material"in a&&"material"in o&&o.material&&(a.material=cu(a.material,l=>{if(typeof l!="string")for(let[c,u]of Object.entries(o.material.layers)){let d=l.layers.data(c);d&&Qn.patch(d,u)}}).data),a.materials&&o.materials&&(a.materials=cu(a.materials,l=>{for(let c=0;c<a.materials.length;c++){let u=o.materials[c];if(typeof u!="string")for(let[d,h]of Object.entries(u.layers)){let p=l[c]?.layers?.data(d);p&&Qn.patch(p,h)}}}).data),a}function e(s,o){let a,l=[],c={orthographic:0,perspective:0,geometry:0};function u(d,h){for(let[p,f]of Object.entries(h.layers)){let{texture: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(o)){let p=h;if(d!=="name")if(d==="cloner")l.push(...JS.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 a===void 0&&(a={path:[],props:{},type:0},l.push(a)),a.props[d]=p}return l}r.toOps=e;function n(s,o){if(o===void 0)return s;let a={...s};if(Object.assign(a,cf.merge(a,o)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:o.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:o.pathSnapping?.offset??a.pathSnapping?.offset??0})}),ta.is(s.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let l=o;l.orthographic?.zoom!==void 0&&(a.orthographic.zoom=l.orthographic.zoom),l.perspective?.zoom!==void 0&&(a.perspective.zoom=l.perspective.zoom),l.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=l.isUpVectorFlipped),l.targetOffset!==void 0&&(a.targetOffset=l.targetOffset)}else if(s.type==="Mesh")"geometry"in o&&Object.assign(a,{geometry:g1.merge(a.geometry,o.geometry)}),(o.material||o.materials)&&(a=t(a,o)),a.cloner&&"cloner"in o&&Object.assign(a,{cloner:ka.merge(a.cloner,o.cloner)});else if(s.type==="Empty")a.cloner&&"cloner"in o&&Object.assign(a,{cloner:ka.merge(a.cloner,o.cloner)});else if(s1.is(s.type)){let l=o;l.intensity!==void 0&&(a.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?a.color=l.color:a.color=yr.clone(l.color))}return a}r.patch=n})(ia||(ia={}))});var pf,E1=B(()=>{"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})(pf||(pf={}))});var vo,nv=B(()=>{"use strict";E1();Ts();(t=>t.defaultData={orbitControls:pf.defaultData,playPage:fu,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})(vo||(vo={}))});var AP,CP,Ql,PP=B(()=>{"use strict";(t=>t.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(AP||(AP={}));(t=>t.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(CP||(CP={}));(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...AP.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:CP.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(Ql||(Ql={}))});var bo,Jl,T1=B(()=>{"use strict";tv();an();nv();Ts();qr();PP();(r=>{function i(s){return s.find(o=>o.data.type==="Page"&&o.data.globalPhysics.usePhysics)!==void 0}r.physicsEnabled=i;function t(s,o){let a=s.find(l=>l.data.type==="Page"&&l.data.timelines?.[o]!==void 0);return a&&a.data.timelines?.[o]}r.findTimeline=t;function e(s,o){let a=s.scene.objects.get(o);if(a&&a.data.type==="Component")return a;{let l=s.shared.lib.components[o];if(l)return{...l.asset,id:o}}}r.getComponentData=e;function n(s,o,a){s.scene.objects.traverseFrom(o,(l,c)=>{if(c.type==="Instance"){let u=e(s,c.component)?.data;u&&a(l,c,u.events)}else a(l,c,c.events)})}r.traverseModuleInstances=n})(bo||(bo={}));(c=>{c.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",c.defaultLight={fi:-1,data:df.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:fu,data:{...ra.defaultData,name:"Scene 1"},children:h}),p}c.createDefaultObjectTreeWithPage=e,c.defaultData={objects:e(),publish:vo.defaultData,styles:Ql.defaultData()},c.emptyDataWithoutPage=function(){return{objects:new Ln,publish:vo.defaultData,styles:Ql.defaultData()}},c.emptyDataWithPage=function(u=!0){return{objects:e(u),publish:vo.defaultData,styles:Ql.defaultData()}},c.emptyData=function(){return{objects:new Ln,publish:{...vo.defaultData},styles:Ql.defaultData()}};function a(u){return{...c.defaultData,objects:Wr(u,Ln.prototype)}}c.withObjs=a;function l(u,d){return a([{id:u,data:d,children:[],fi:0}])}c.withObj=l})(Jl||(Jl={}))});var ff,RP=B(()=>{"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}})(ff||(ff={}))});var M1,iU,Tr,IP,sU,oU,sa,ls,_1=B(()=>{"use strict";an();qr();(e=>(e.defaultData=n=>({url:n,name:"New Webhook",parametersSchemas:new Fe}),e.defaultParameterValueByType=n=>n==="number"?0:n==="boolean"?!1:""))(M1||(M1={}));(t=>t.defaultData=(e,n="GET")=>({url:e,method:n,name:"New API",headers:new Fe,queries:new Fe,autoStart:!0}))(iU||(iU={}));(s=>{function i(o){return o.textValue!==void 0}s.isTextValue=i;function t(o){return typeof o=="number"}s.isNumber=t;function e(o){return typeof o=="boolean"}s.isBoolean=e;function n(o){return i(o)?"string":e(o)?"boolean":"number"}s.typeOfVariable=n;function r(o){return s.isTextValue(o)?Array.isArray(o.textValue)?o.textValue.map(a=>a.toString().padStart(o.padding??2,"0")).join(o.deliminator??":")+(o.suffix!==void 0?" "+o.suffix:""):o.textValue.toString():s.isBoolean(o)?o?"True":"False":s.isNumber(o)?parseFloat(o.toFixed(3)).toString():o.toString()}s.getDisplayedValue=r})(Tr||(Tr={}));(t=>t.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(IP||(IP={}));(t=>t.all=[...IP.all,"components"])(sU||(sU={}));(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}}t.defaultData=i})(oU||(oU={}));(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}}t.defaultData=i})(sa||(sa={}));(s=>{function i(){let o={};return o["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},Wr(o,st.prototype)}s.defaultColors=i;function t(){return Wr({},st.prototype)}s.defaultImages=t;function e(){return{catelogs:new st,materials:new st,images:new st,videos:new st,colors:new st,audios:new st,particles:new st,fonts:new st,variables:new Fe,userAPIs:new st,userWebhooks:new st,lib:sa.defaultData()}}s.emptyData=e;function n(o){switch(o){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let a=[0,0,0];return{name:"Time",value:{textValue:a,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:a,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",o)}}s.defaultVariables=n;function r(o,a){if(a.format==="HH:mm:ss"){let l=Math.floor(o/3600),c=Math.floor((o-l*3600)/60),u=Math.round(o-l*3600-c*60);return{textValue:[l,c,u]}}else if(a.format==="mm:ss"){let l=Math.floor(o/60),c=Math.round(o-l*60);return{textValue:[l,c]}}else return a.format==="number"?o=Math.round(o):o=Math.round(o*1e3)/1e3,o}s.getFormattedTimerTime=r})(ls||(ls={}))});var aU=B(()=>{"use strict"});var yu,OP=B(()=>{"use strict";an();T1();RP();_1();(l=>{l.defaultData={schema:132,scene:Jl.defaultData,frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ff.defaultData),shared:{...ls.emptyData(),colors:ls.defaultColors()}},l.createDefaultData=function(){return Nd.deserialize(Nd.serialize(l.defaultData))},l.emptyDataForImports=function(){let c=Jl.emptyDataWithPage();return{schema:132,scene:c,frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ff.defaultData),shared:{...ls.emptyData(),colors:ls.defaultColors(),images:ls.defaultImages()}}},l.emptyData=function(){return{schema:132,scene:Jl.emptyDataWithPage(),frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ff.defaultData),shared:ls.emptyData()}},l.clipboard2dData=function(){return{schema:132,scene:Jl.emptyData(),frames:new st,shared:ls.emptyData()}};function s(c){return{...c,shared:{...c.shared,lib:sa.defaultData()}}}l.withoutLib=s;function o(c,u){return bo.getComponentData(c,u)}l.getComponentData=o;function a(c){let u=Object.values(c.shared.userAPIs);for(let d of u){let h=d.headers;for(let p of h)if(p.data.key.toLowerCase()==="authorization"&&p.data.value!=="")return!0}return!1}l.hasSensitiveData=a})(yu||(yu={}))});var A1,lU=B(()=>{"use strict";(t=>t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"})(A1||(A1={}))});function ec(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 rv(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??{...Kl.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:o}=e??{...ea.defaultData},a=new DP(n,r,s,o),l=a.solve(1);return()=>c=>a.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}var cU,uU,tc,mf,DP,LP=B(()=>{"use strict";an();Ts();(t=>{function i(e,n){return{id:e,name:n,duration:5,objectTimelines:new st}}t.defaultData=i})(cU||(cU={}));(t=>{function i(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"}t.is=i})(uU||(uU={}));(x=>{function i(S,E){let T=[0,0],w=[1,1];if(S?.cubicControls)T=ec(S.cubicControls.control1,T);else switch(S?.type){case 2:T=[.42,0];break;case 3:T=[0,0];break;case 4:T=[.42,0];break;case 1:T=[.25,.1];break;case 0:T=[0,0];break;case 7:T=[.25,1];break}if(E?.cubicControls)w=ec(E.cubicControls.control2,w);else switch(E?.type){case 2:w=[1,1];break;case 3:w=[.58,1];break;case 4:w=[.58,1];break;case 1:w=[.25,1];break;case 0:w=[1,1];break;case 7:w=[.5,1];break}return{control1:T,control2:w}}x.getControlsWithDefault=i,x.BEZIER_PRESETS=[0,1,2,3,4,7];function e(S){if(!x.BEZIER_PRESETS.includes(S))return;let E={type:S};return{control1:i(E).control1,control2:i(void 0,E).control2}}x.presetHandles=e;let n=.001;function r(S,E){return Math.abs(S[0]-E[0])<n&&Math.abs(S[1]-E[1])<n}function s(S){return x.BEZIER_PRESETS.find(E=>{let T=e(E);return T!==void 0&&r(T.control1,S.control1)&&r(T.control2,S.control2)})}x.presetForHandles=s;function o(S){return{id:S,keyframes:new Fe}}x.defaultData=o,x.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"];function l(S){let E=x.ROOT_PROPERTY_ORDER.indexOf(S[0]);return E===-1?x.ROOT_PROPERTY_ORDER.length:E}x.rowOrder=l;function c(S){return S.layerId??S.path.join(".")}x.propertyKey=c;function u(S,E){let T=new Map;for(let w of S){let _=w.data;if(E?.(_))continue;let A=c(_),C=T.get(A);C||(C={id:A,path:_.path,keyframes:[],layerId:_.layerId,index:_.index},T.set(A,C)),_.isPlaceholder?C.placeholder=w.id:C.keyframes.push(w)}return[...T.values()].sort((w,_)=>{let A=l(w.path)-l(_.path);return A!==0?A:(w.index??0)-(_.index??0)})}x.groupKeyframes=u;function d(S){let E=S[S.length-1];return mf.includes(E)?E:void 0}x.rowAxis=d;function h(S){return S.layerId?S.layerId:(d(S.path)?S.path.slice(0,-1):S.path).join(".")}x.drawnRowKey=h;function p(S){let E=new Map;for(let T of S){let w=d(T.path),_=w?T.path.slice(0,-1):T.path,A=h(T),C=E.get(A);C||(C={id:A,path:_,layerId:T.layerId,index:T.index,tracks:[]},E.set(A,C)),C.tracks.push({axis:w,property:T})}return[...E.values()]}x.drawnRows=p;function f(S){return[...S].sort((E,T)=>E.data.time-T.data.time)}x.sortedKeyframes=f;function m(S){return["material",S.type==="light"?`${S.category} lighting`:S.type]}x.materialLayerPath=m;function g(S,E){return S.map(({data:T,id:w},_)=>y(E(),m(T),{layerId:w,index:_}))}x.createMaterialGroup=g;function y(S,E,T){return{id:S,data:{id:S,time:T?.time??0,path:E,value:{},layerId:T?.layerId,index:T?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}x.placeholderKeyframe=y;function v(S){return Object.entries(S).reduce((E,[T,w])=>(typeof w!="string"&&E.push({name:w.name}),E),[])}x.createName=v,x.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:rv(3),duration:1e3},opacity:{value:[0,1],easing:rv(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:rv(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:rv(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:rv(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(tc||(tc={}));mf=["x","y","z"],DP=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 gf,yf,C1=B(()=>{"use strict";Ts();an();(t=>t.list=["idle","move","jump","run"])(gf||(gf={}));(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 Fe,move:new Fe,jump:new Fe,run:new Fe},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Vt.fromHexAndA(3728051,1)}}))(yf||(yf={}))});function Hd(i,...t){let e={};for(let n of t.flat())i!=null&&n in i&&(e[n]=i[n]);return e}function dU(i){i.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let e=t.colorA,n=t.colorB,r=[[e.r,e.g,e.b,e.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let a=2;a<10;a++)r.push(r[1]),s.push(1);let o={...Hd(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,o)}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 za(i,t){Object.values(i.shared.materials).forEach(e=>t(e))}function Ga(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)!==_n.prototype&&t(r.material)})})}function hJ(i){Object.assign(i.scene.publish,{orbitControls:{...pf.defaultData,...Pr(i.scene.publish.orbitControls)}})}function pJ(i){Object.assign(i.scene.publish.settings,{video:{...vo.defaultData.settings.video,...Pr(i.scene.publish.settings.video)}})}function fJ(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((sf.includes(r)||typeof s=="boolean")&&delete n[r],r==="texture")for(let[o,a]of Object.entries(s))(p1.includes(o)||typeof a=="boolean")&&delete s[o]}}}i.scene.objects.traverse((e,n)=>{n.states.forEach(r=>{let s=r;s.material?t(s.material):s.materials&&s.materials.forEach(o=>{t(o)})})})}function mJ(i){i.scene.publish.withBackground=!0}function gJ(i){i.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function yJ(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 vJ(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 bJ(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 xJ(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 SJ(i){function t(n){Object.setPrototypeOf(n,_n.prototype),n.texture&&Object.setPrototypeOf(n.texture,_n.prototype)}function e(n){Object.setPrototypeOf(n,_n.prototype);for(let r in n)t(n[r])}i.scene.objects.traverse((n,r)=>{r.states.forEach(s=>{let o=s;if(o.material){let a=Pr(o.material).layers;e(a),o.material.layers=a}if(o.materials)for(let a=0;a<o.materials.length;a++){let l=o.materials[a],c=Pr(l).layers;e(c),l.layers=c}})})}function hU(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("lambert"))}function NP(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 wJ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&(e.geometry.type==="BooleanGeometry"||e.geometry.type==="SubdivGeometry")&&(e.geometry.phongAngle=35)})}function pU(i){i.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(n=>{typeof n!="string"&&NP(n)}):"material"in e&&typeof e.material!="string"&&NP(e.material)}),Object.values(i.shared.materials).forEach(t=>NP(t))}function EJ(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 TJ(i){i.shared.audios=Wr({},st.prototype)}function MJ(i){i.shared.videos=Wr({},st.prototype)}function _J(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 AJ(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 CJ(i){i.scene.publish.settings.web.preload=!1}function fU(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 mU(i){i.layers&&i.layers.forEach(t=>{XF(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 PJ(i){i.shared.fonts=Wr({},st.prototype)}function RJ(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 IJ(i){let t=[];i.scene.objects.traverse((e,n)=>{let r=n;if(r.type==="TextFrame"){let s=An.defaultTwoLayerData("phong"),o=typeof r.color=="string"?i.shared.colors[r.color]:r.color;s.layers[1].data.color={r:o.r,g:o.g,b:o.b},s.layers[1].data.alpha=r.alpha;let a=RJ(r.font);i.shared.fonts[a]===void 0&&(i.shared.fonts[a]={name:a});let l={name:r.name,...Ur.defaultData,...go.defaultData,flatShading:!1,wireframe:!1,geometry:{...mo.defaultData("TextGeometry"),width:r.width,height:r.height,font:a,depth:0,horizontalAlign:r.horizontalAlign,verticalAlign:r.verticalAlign,fontSize:r.fontSize*1.40625,lineHeight:r.lineHeight/1.40625,letterSpacing:r.letterSpacing-1,text:r.text,textTransform:r.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:s,states: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 OJ(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 Fe,move:new Fe,jump:new Fe}});else{let s=new Fe;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:ge.generateUUID(),data:{type:"Link",url:r.url,delay:0}}),"targets"in r&&(r.targets.forEach((o,a,l)=>{let c={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},u={easing:o.easing,duration:o.duration};o.easing===6?Object.assign(u,Hd(o,"mass","stiffness","damping","velocity")):o.easing===5&&Object.assign(u,{control1:{...o.control1},control2:{...o.control2}});let d={repeat:o.repeat?-1:0,delay:o.delay,delayDirection:o.delayDirection,direction:o.cycle&&o.rewind?"pingpong-rewind":o.cycle?"pingpong":"normal"},h={state:o.state,...d,...u},p={allowSlerp:!0,type:"Transition",object:o.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Fe({fi:0,id:ge.generateUUID(),data:c},{fi:1,id:ge.generateUUID(),data:h})};s.push({fi:l,id:a,data:p})}),delete r.targets)}})})}function DJ(i){i.scene.objects.traverse((t,e)=>{function n(r,s){let o=new Fe,a=[];if(e.events.forEach((l,c,u)=>{if(l.type==="Audio"&&l.trigger===s){let d;a.push(c),l.interaction==="play"?d={...Hd(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={...Hd(l,"interaction","delay","object","playAudio"),type:"Audio"}),d&&o.push({fi:u,id:c,data:d})}}),a.forEach(l=>e.events.delete(l)),o.length){let l=e.events.find(c=>c.type===r)?.data;l?"actions"in l&&l.actions.insertBefore(null,o):e.events.insertBefore(null,[{id:ge.generateUUID(),data:{type:r,actions:o}}])}}n("Start","start"),n("MouseDown","mouseDown"),n("MouseUp","mouseUp"),n("KeyDown","keyDown"),n("KeyUp","keyUp")})}function gU(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 yU(i){za(i,gU),Ga(i,gU)}function LJ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="SubdivGeometry"&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}function NJ(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 BJ(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 FJ(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 UJ(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 kJ(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 VJ(i){let{video:t}=i.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function zJ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.resetYPosition=Math.abs(n.resetYPosition-e.position[1]))})})}function GJ(i){let t=i.scene.environment.usePhysics;i.scene.objects.traverse((e,n)=>{t&&n.physics===null?n.collision=!1:n.collision="visibility"})}function jJ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.navmesh=yf.defaultDataThirdPerson.navmesh)})})}function HJ(i){i.scene.styles||(i.scene.styles=Ql.defaultData())}function vU(i){i.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function WJ(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}),Ga(i,vU),za(i,vU)}function qJ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&Object.assign(n.gameActions,{run:new Fe})})})}function XJ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.keyAssignments=[...n.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}function bU(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function xU(i,t){if(t<1&&(Ga(i,dU),za(i,dU),i.schema=1),t<2&&(hJ(i),i.schema=2),t<3&&(fJ(i),i.schema=3),t<4&&(mJ(i),i.schema=4),t<5&&(gJ(i),i.schema=5),t<6&&(yJ(i),i.schema=6),t<7&&(vJ(i),i.schema=7),t<8&&(i.schema=8),t<9&&(pU(i),i.schema=9),t<10&&(wJ(i),i.schema=10),t<11&&(EJ(i),i.schema=11),t<12&&(pU(i),i.schema=12),t<13&&(TJ(i),i.schema=13),t<14&&(_J(i),i.schema=14),t<15&&(AJ(i),i.schema=15),t<16&&(CJ(i),i.schema=16),t<17&&(Ga(i,fU),za(i,fU),i.schema=17),t<18&&(Ga(i,hU),za(i,hU),i.schema=18),t<19&&(pJ(i),i.schema=19),t<20&&(PJ(i),IJ(i),i.schema=20),t<21&&(OJ(i),DJ(i),i.schema=21),t<22&&(yU(i),i.schema=22),t<23&&(LJ(i),i.schema=23),t<24&&(NJ(i),i.schema=24),(t<25||i.shared.videos===void 0)&&(MJ(i),t<25&&(i.schema=25)),t<26&&(bJ(i),i.schema=26),t<27&&(xJ(i),i.schema=27),t<28&&(yU(i),i.schema=28),t<29&&(SJ(i),i.schema=29),t<30&&(BJ(i),i.schema=30),t<31&&(FJ(i),i.schema=31),t<33&&(UJ(i),i.schema=33),t<34&&(kJ(i),i.schema=34),t<35&&(VJ(i),i.schema=35),t<36&&(zJ(i),i.schema=36),t<37&&(GJ(i),i.schema=37),t<38&&(Ga(i,mU),za(i,mU),i.schema=38),t<39&&(jJ(i),i.schema=39),t<40&&(HJ(i),i.schema=40),t<41&&(WJ(i),i.schema=41),t<42&&(qJ(i),i.schema=42),t<43&&(XJ(i),i.schema=43),t<99){Ga(i,bU),za(i,bU),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=fo);let e=Pr(i.scene.objects),n=i.scene.objects;i.scene.publish.playPage=fu,n.insertBefore(null,null,[{id:fu,data:{...ra.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Hd(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Hd(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...gu.defaultData,...Hd(i.scene.environment,"usePhysics","gravity")},camera:Pr(i.scene.ownerCamera)??ra.defaultData.camera,name:"Scene"},children:[]}]);for(let o of e)o.id!==Jl.TRASH_CAN_ID&&n.move(fu,o.fi,o.id);let r=0,s=0;i.shared.penumbraSize&&i.scene.objects.traverse((o,a)=>{a.type==="DirectionalLight"?(a.penumbraSize=i.shared.penumbraSize[Math.min(r,2)],r+=1):a.type==="SpotLight"&&(a.penumbraSize=i.shared.penumbraSize[3+Math.min(s,1)],s+=1),(a.physics===void 0||a.physics===null)&&a.type!=="Instance"&&(a.physics={},Object.assign(a.physics,mu.defaultData)),a.physics!==void 0&&a.physics!==null&&(a.physics.enabled=a.collision??"visibility",delete a.collision)}),i.schema=99}}var SU=B(()=>{"use strict";of();Ts();E1();tv();an();nv();qr();q();v1();C1();PP();T1();l1();S1()});var RU={};Xh(RU,{updateAllMaterials:()=>CU,updateDocumentSchema:()=>UP,updateLibSchema:()=>See,updateMaterialSchema:()=>iee,updateObjectStateRec:()=>qd,updateObjectsSchema:()=>AU,updateTextValues:()=>nee});function wU(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function YJ(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 MU(i){let t=i.geometry;t!==void 0&&$J.has(t.type)&&t.extrusionVersion===void 0&&(t.extrusionVersion=1)}function KJ(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 QJ(i){i.rotation=i.rotation.slice(0,3).map(t=>t*Wd)}function EU(i,t){let[e,n,r]=i,s=Math.cos(e),o=Math.sin(e),a=Math.cos(n),l=Math.sin(n),c=Math.cos(r),u=Math.sin(r),d=[a*c,s*u+o*c*l,o*u-s*c*l],h=Math.hypot(t[0],t[1],t[2])||1;return Math.abs((d[0]*t[0]+d[1]*t[1]+d[2]*t[2])/h)}function JJ(i,t){let e=Array.isArray(t)&&t.length>=3&&t.every(s=>typeof s=="number"&&Number.isFinite(s))?t:[0,1,0],n=EU(i,e),r=EU(i.map(s=>s*ZJ),e);return Math.abs(n-r)<1e-6?i.some(s=>Math.abs(s)>Math.PI):r<n}function eee(i){let t=i.rotation.slice(0,3);if(JJ(t,i.up)){i.rotation=t;return}i.rotation=t.map(e=>e*Wd)}function _U(i){QJ(i),i.type==="Page"&&eee(i.camera),i.states?.forEach(e=>{e.rotation===void 0||e.rotation===null||(e.rotation=e.rotation.slice(0,3).map(n=>n*Wd))});let t=i.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*Wd),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*Wd),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=Wd,t.extrusion.twist*=Wd),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 tee(i){i.shared.variables=Wr({},st.prototype)}function nee(i){i.scene.objects.traverse((t,e)=>{})}function ree(i){let t=Pr(i.shared.variables);i.shared.variables=Wr(Object.entries(t??{}).map(([e,n],r)=>({fi:r,id:e,data:n})),Fe.prototype)}function iee(i){let t=i.schema??104;t!==132&&t<130&&(P1(i.asset),i.schema=130)}function qd(i,t){t(i.data);for(let e of i.children)qd(e,t)}function AU(i){let t=i.schema??104;t!==132&&(t<105&&(qd(i.asset,_U),i.schema=105),t<118&&(qd(i.asset,PU),i.schema=118),t<121&&(qd(i.asset,FP),i.schema=121),t<130&&(qd(i.asset,see),i.schema=130),t<132&&(qd(i.asset,MU),i.schema=132))}function CU(i,t){Ga(i,t),za(i,t),Object.values(i.shared.lib.materials).forEach(e=>t(e.asset))}function P1(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("phong"))}function see(i){"materials"in i?i.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&P1(t)}):"material"in i&&i.material!==void 0&&typeof i.material!="string"&&P1(i.material)}function oee(i){i.shared.particles=Wr({},st.prototype),i.shared.lib&&(i.shared.lib.particles=sa.defaultData().particles)}function aee(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 lee(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 cee(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"&&"runMode"in s||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"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Toggle")}):n.type==="GameControl"?(delete n.actions,Object.keys(n.gameActions).forEach(o=>{n.gameActions[o]?.forEach(a=>{a.type==="Transition"&&(a.runMode="Repeat"),a.type==="Animation"&&"runMode"in a&&(a.runMode="Normal")})})):n.type==="DragDrop"?(delete n.actions,n.dragDropActions?.drag?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Toggle")}),n.dragDropActions?.drop?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Toggle")})):n.type==="Resize"?(delete n.actions,n.breakpoints?.forEach(s=>{s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})})):n.type==="Start"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Once"),(s.type==="Animation"&&"runMode"in s||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"&&"runMode"in s||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"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Normal")}),n.outActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Normal")}))})})}function uee(i){i.shared.userAPIs=Wr({},st.prototype),i.shared.userWebhooks=Wr({},st.prototype),i.shared.lib&&(i.shared.lib.userAPIs=sa.defaultData().userAPIs,i.shared.lib.userWebhooks=sa.defaultData().userWebhooks)}function dee(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=vo.defaultData.settings.videoStatic)}function PU(i){i.timelineAnimations=Wr({},st.prototype)}function hee(i){let t=[];return i?(i.forEach((e,n)=>{let{path:r,keyframes:s}=e.data,o=r[0]==="material"?e.id:void 0;if(!s?.length){t.push(tc.placeholderKeyframe(e.id,r,{layerId:o,index:n}));return}s.forEach(({id:a,data:l})=>{t.push({id:a,data:{...l,path:r,layerId:o,index:n}})})}),t.sort((e,n)=>e.data.time-n.data.time),new Fe(...t.map((e,n)=>({...e,fi:n})))):new Fe}function pee(i){let t=i.shared,e=t.timelineAnimations;if(!e)return;let n=i.scene.objects,r=n.unproxy().find(s=>s.data.type==="Page")?.id;for(let[s,o]of Object.entries(e)){let a=Wr({},st.prototype),l=0,c=Boolean(o.loop);for(let[p,f]of Object.entries(o.mapping??{})){let g=n.data(p)?.timelineAnimations?.[f];!g||(l=Math.max(l,g.to??0),c=c||Boolean(g.loop),a[p]={id:p,keyframes:hee(g.properties?.unproxy())})}let u=o.page??r,d=u?n.data(u):void 0;if(!d||d.type!=="Page")continue;let h=d.timelines??(d.timelines=Wr({},st.prototype));h[s]={id:s,name:o.name,duration:l||5,...c?{loop:c}:{},objectTimelines:a}}delete t.timelineAnimations,n.traverse((s,o)=>{delete o.timelineAnimations})}function fee(i){i.scene.objects.traverse((t,e)=>{let n=e.states;if(!n)return;let r=e.timelineAnimations,s=[];n.forEach((o,a)=>{(o.isAnimation||r?.[a])&&s.push(a)}),s.forEach(o=>n.delete(o))})}function gee(i){for(let{id:t,data:e}of[...i.unproxy()]){let n=e.path?.[0];if(!n||!mee.includes(n))continue;let r=BP(e.value);if(!r.length)continue;let s=i.data(t);if(!s)continue;let o=e.value,[a,...l]=r;for(let c of l){let u=ge.generateUUID();i.insertBefore(null,[{id:u,data:{...e,id:u,path:[n,c],value:o[c],easing:yee(e.easing)}}])}s.path=[n,a],s.value=o[a]}}function BP(i){return i===null||typeof i!="object"?[]:mf.filter(t=>t in i)}function yee(i){let t=i?.cubicControls;return{...i,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...i?.springParameters?{springParameters:{...i.springParameters}}:{}}}function vee(i,t){return Math.abs(i[0]-t[0])<1e-6&&Math.abs(i[1]-t[1])<1e-6}function bee(i){let t=[];for(let e of tc.groupKeyframes(i)){let n=new Set(e.keyframes.flatMap(s=>BP(s.data.value))),r=n.size?[...n].map(s=>e.keyframes.filter(o=>BP(o.data.value).includes(s))):[e.keyframes];for(let s of r){let o=[...s].sort((a,l)=>a.data.time-l.data.time);for(let a=0;a+1<o.length;a++)t.push({left:o[a],right:o[a+1]})}}return t}function xee(i){let t=bee([...i.unproxy()]),e=new Map,n=new Set;for(let{left:s,right:o}of t){let a=s.data.easing?.type,c=(a===void 0?void 0:tc.presetHandles(a))?.control2??(a===5?ec(o.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!c)continue;let u=e.get(o.id);u?vee(u,c)||n.add(o.id):e.set(o.id,c)}let r=new Map;for(let{id:s,data:o}of i.unproxy()){let a=o.easing?.type,l=a===void 0?void 0:tc.presetHandles(a);l&&r.set(s,l.control1)}for(let{left:s,right:o}of t)n.has(o.id)&&r.delete(s.id);for(let[s,o]of r){let a=i.data(s);!a?.easing||(a.easing.cubicControls={control1:o,control2:ec(a.easing.cubicControls?.control2,[1,1])},a.easing.type=5)}for(let{left:s,right:o}of t){if(!r.has(s.id))continue;let a=i.data(o.id),l=e.get(o.id);!a?.easing||!l||(a.easing.cubicControls={control1:ec(a.easing.cubicControls?.control1,[0,0]),control2:l})}}function TU(i,t){i.scene.objects.traverse((e,n)=>{let r=n;if(!(r.type!=="Page"||!r.timelines))for(let s of Object.values(r.timelines))for(let o of Object.values(s.objectTimelines??{}))t(o.keyframes)})}function FP(i){i.pivot=[0,0,0],i.pivotRotation=[0,0,0]}function See(i){}function UP(i){let t=i.schema??0;if(t!==132){if(t>132){console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads ${132}). Update @splinetool/runtime to the latest version to load it correctly.`);return}console.warn("updating from ",t,"to ",132),xU(i,t),t<100&&(i.scene.publish.joystickSizeAndXYOffset===void 0&&(i.scene.publish.joystickSizeAndXYOffset=vo.defaultData.joystickSizeAndXYOffset),i.schema=100),t<101&&(Ga(i,wU),za(i,wU),i.schema=101),t<102&&(YJ(i),i.schema=102),t<104&&(i.shared.catelogs=new st,i.shared.lib=sa.defaultData(),i.schema=104),t<105&&(tee(i),i.scene.objects.traverse((e,n)=>{_U(n)}),i.schema=105);for(let e of Object.values(i.shared.lib.components))AU(e);t<106&&(ree(i),i.schema=106),t<107&&(i.shared.lib.variables=sa.defaultData().variables,i.schema=107),t<109&&(oee(i),i.schema=109),t<110&&(aee(i),i.schema=110),t<111&&(i.scene.objects.traverse((e,n)=>{KJ(n)}),i.schema=111),t<112&&(lee(i),i.schema=112),t<113&&(cee(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&&(uee(i),i.schema=115),t<116&&(dee(i),i.schema=116),t<117&&(i.scene.publish.settings.web.pixelRatioMobile===void 0&&(i.scene.publish.settings.web.pixelRatioMobile=0),i.scene.publish.settings.web.pixelRatioDesktop===void 0&&(i.scene.publish.settings.web.pixelRatioDesktop=0),i.schema=117),t<118&&(i.shared.timelineAnimations=Wr({},st.prototype),i.scene.objects.traverse((e,n)=>{PU(n)}),i.schema=118),t<119&&(i.scene.publish.settings.videoStatic.format=yu.defaultData.scene.publish.settings.videoStatic.format,i.scene.publish.settings.videoStatic.imageFormat=yu.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)=>{FP(n),n.type==="Page"&&n.camera!==void 0&&FP(n.camera)}),i.schema=121),t<122&&(delete i.scene.publish.settings.video,i.scene.publish.orbitControls.rotationSpeed=yu.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=Va.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=Va.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=Va.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={...Va.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Va.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=ra.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&&(CU(i,P1),i.schema=130),t<131&&(fee(i),pee(i),TU(i,gee),TU(i,xee),i.schema=131),t<132&&(i.scene.objects.traverse((e,n)=>MU(n)),i.schema=132)}}var $J,Wd,ZJ,mee,iv=B(()=>{q();OP();an();LP();SU();nv();of();qr();_1();tv();b1();$J=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]);Wd=180/Math.PI,ZJ=Math.PI/180;mee=["position","rotation","scale","shape size"]});var IU,R1,kP,OU,I1,nc,sv,vf,O1,VP,bf,zP,GP,DU,ov,jP,rc,D1,LU=B(()=>{"use strict";Ts();an();qr();(t=>{function i(e){return!0}t.is=i})(IU||(IU={}));(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 OS({position:Ws.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:Ws.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&Ws.isEqual(r.shear,s.shear)?void 0:s.shear})}n.diff=e})(R1||(R1={}));(t=>t.defaultData={horizontalConstraint:0,verticalConstraint:0})(kP||(kP={}));(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})(OU||(OU={}));(t=>t.defaultData={opacity:1,fill:{color:Vt.fromHexAndA(Er,1),enabled:!0},stroke:{color:Vt.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Vt.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Vt.from0to1([0,0,0,1]),enabled:!1,spread:0}})(I1||(I1={}));(s=>{function i(o,a){return{name:a}}s.newEmpty=i;function t(o,a){if(a===void 0)return o;let l={...o},c=["width","height","cornerRadius"];for(let u of c)u in l&&u in a&&a[u]!==void 0&&Object.assign(l,{[u]:a[u]});return l}function e(o,a){if(a===void 0)return o;let l={...o};return"fill"in l&&"fill"in a&&a.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...a.fill}}),"stroke"in l&&"stroke"in a&&a.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...a.stroke}}),"layerBlur"in l&&"layerBlur"in a&&a.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...a.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in a&&a.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...a.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in a&&a.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...a.dropShadow}}),"innerShadow"in l&&"innerShadow"in a&&a.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...a.innerShadow}}),l}function n(o,a){if(a===void 0)return o;let l={...o};return Object.assign(l,R1.merge(l,a)),l=t(l,a),l=e(l,a),l}s.patch=n;function r(o,a){let l,c=[];for(let[u,d]of Object.entries(a))u!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},c.push(l)),l.props[u]=d);return c}s.toOps=r})(nc||(nc={}));(t=>t.defaultData={...R1.defaultData,...kP.defaultData,states:new Fe,events:new Fe,visible:!0,raycastLock:!1})(sv||(sv={}));(t=>t.defaultData={...sv.defaultData,...I1.defaultData})(vf||(vf={}));(t=>t.defaultData={cornerRadius:[0,0,0,0]})(O1||(O1={}));(t=>t.defaultData={...vf.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(VP||(VP={}));(t=>t.defaultData={...vf.defaultData,...O1.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(bf||(bf={}));(t=>t.defaultData={...vf.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"})(zP||(zP={}));(t=>t.defaultData={...vf.defaultData,type:"path2d",path:"",name:"Path"})(GP||(GP={}));(t=>{function i(e){return e.type==="ellipse2d"||e.type==="rectangle2d"||e.type==="text2d"||e.type==="vector2d"||e.type==="path2d"}t.is=i})(DU||(DU={}));(t=>t.defaultData={...sv.defaultData,name:"Group",type:"group2d"})(ov||(ov={}));(t=>t.defaultData=()=>({...sv.defaultData,...O1.defaultData,...I1.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Vt.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Vt.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(jP||(jP={}));(s=>{function i(o){switch(o){case"rectangle2d":return{...bf.defaultData};case"ellipse2d":return{...VP.defaultData};case"text2d":return{...zP.defaultData};case"vector2d":return{...bf.defaultData};case"path2d":return{...GP.defaultData};case"frame2d":return{...jP.defaultData()};case"group2d":return{...ov.defaultData}}}s.defaultData=i;function t(o){return"width"in o&&"height"in o?[typeof o.width=="number"?o.width*.5:0,typeof o.height=="number"?o.height*.5:0]:[0,0]}s.getPivot=t;function e(o){return o.type==="rectangle2d"||o.type==="ellipse2d"||o.type==="text2d"||o.type==="frame2d"}s.isResizeable=e;function n(o){return o.type==="frame2d"&&o.autoLayout!==void 0}s.isAutoLayoutable=n;function r(o){return o.type==="rectangle2d"||o.type==="frame2d"}s.hasCorners=r})(rc||(rc={}));(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new Ln},e.emptyData=function(){return{type:"scene2d",objects:new Ln}}))(D1||(D1={}))});var NU=B(()=>{"use strict";VF();GF();rP();sP();OP();KC();lU();hP();xP();b1();iv();RP();v1();l1();oP();of();dP();wP();Ts();nv();tv();E1();bP();_1();T1();$F();vP();C1();S1();aP();lP();LU()});function oa(i,t=!1){let e=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Me,c=0;for(let u=0;u<i.length;++u){let d=i[u],h=0;if(e!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),h++}if(h!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[p]===void 0&&(o[p]=[]),o[p].push(d.morphAttributes[p])}if(t){let p;if(e)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(e){let u=0,d=[];for(let h=0;h<i.length;++h){let p=i[h].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+u);u+=i[h].attributes.position.count}l.setIndex(d)}for(let u in s){let d=BU(s[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(let u in o){let d=o[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let h=0;h<d;++h){let p=[];for(let m=0;m<o[u].length;++m)p.push(o[u][m][h]);let f=BU(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 BU(i){let t,e,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=u.itemSize),e!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*e}let o=new t(s),a=new Ue(o,e,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let d=l/e;for(let h=0,p=u.count;h<p;h++)for(let f=0;f<e;f++){let m=u.getComponent(h,f);a.setComponent(h+d,f,m)}}else o.set(u.array,l);l+=u.count*e}return r!==void 0&&(a.gpuType=r),a}function FU(i,t=1e-4){t=Math.max(t,Number.EPSILON);let e={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],d=["getX","getY","getZ","getW"],h=["setX","setY","setZ","setW"];for(let v=0,b=a.length;v<b;v++){let x=a[v],S=i.attributes[x];l[x]=new S.constructor(new S.array.constructor(S.count*S.itemSize),S.itemSize,S.normalized);let E=i.morphAttributes[x];E&&(c[x]||(c[x]=[]),E.forEach((T,w)=>{let _=new T.array.constructor(T.count*T.itemSize);c[x][w]=new T.constructor(_,T.itemSize,T.normalized)}))}let p=t*.5,f=Math.log10(1/t),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=a.length;S<E;S++){let T=a[S],w=i.getAttribute(T),_=w.itemSize;for(let A=0;A<_;A++)x+=`${~~(w[d[A]](b)*m+g)},`}if(x in e)u.push(e[x]);else{for(let S=0,E=a.length;S<E;S++){let T=a[S],w=i.getAttribute(T),_=i.morphAttributes[T],A=w.itemSize,C=l[T],R=c[T];for(let D=0;D<A;D++){let O=d[D],L=h[D];if(C[L](o,w[O](b)),_)for(let F=0,j=_.length;F<j;F++)R[F][L](o,_[F][O](b))}}e[x]=o,u.push(o),o++}}let y=i.clone();for(let v in i.attributes){let b=l[v];if(y.setAttribute(v,new b.constructor(b.array.slice(0,o*b.itemSize),b.itemSize,b.normalized)),v in c)for(let x=0;x<c[v].length;x++){let S=c[v][x];y.morphAttributes[v][x]=new S.constructor(S.array.slice(0,o*S.itemSize),S.itemSize,S.normalized)}}return y.setIndex(u),y}var xf=B(()=>{q()});function Eee(i){let t=1/0,e=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let u=0;u<i.length;u+=3){let d=i[u],h=i[u+1],p=i[u+2];t=Math.min(t,d),e=Math.min(e,h),n=Math.min(n,p),r=Math.max(r,d),s=Math.max(s,h),o=Math.max(o,p)}let a=r-t,l=s-e,c=o-n;return{width:a,height:l,depth:c}}function Tee(i){let{userData:t,data:e}=i,n=e?.groups,r=e?.attributes??{},s=e?.morphAttributes??{},o=e?.interleavedBuffers,a=e?.arrayBuffers,l=e?.index,c;r.position!==void 0&&Array.isArray(r.position.array)&&(c=Eee(r.position.array));let u={...t===void 0?{}:t.parameters,data:{attributes:r,morphAttributes:s,interleavedBuffers:o,arrayBuffers:a},...c===void 0?{}:c,type:"NonParametricGeometry"};return l!==void 0&&Object.assign(u.data,{index:l}),n!==void 0&&Object.assign(u.data,{groups:n.map(d=>({...d,materialIndex:d.materialIndex??0}))}),u}function kU(i){let t=i.points.length/7,e=new Fe;for(let n=0;n<t;n++){let r=n*7,s=i.points[r+0],o=i.points[r+1],a=i.points[r+2],l=i.points[r+3],c=i.points[r+4],u=i.points[r+5],d=i.points[r+6];e.push({fi:n,id:ge.generateUUID(),data:{roundness:d,position:[s,o],areControlsDirectionsMirrored:!0,controlPrevious:{position:[a,l]},controlNext:{position:[c,u]}}})}return{points:e,isClosed:i.isClosed,roundness:i.roundness,shapeHoles:i.shapeHoles?.map(n=>kU(n))??[]}}function HP(i){let{userData:t,uuid:e,...n}=i;if(t===void 0||t.type==="NonParametricGeometry")return Tee(i);if(t.type==="SubdivGeometry"){let o="SubdivGeometry",a=n.data?.attributes;if(a?.positionWASM===void 0){let c=new Me;if(a?.position===void 0||a?.faceMap===void 0)return null;let u=a.position.array,d=a.faceMap.array,h=n.data.index.array;c.setAttribute("position",new Be(u,3)),c.setIndex(new Us(h,1));let p=FU(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++);a.indexWASM={array:f},a.positionWASM=p.attributes.position,a.verticesPerFaceWASM={array:m}}if(a?.positionWASM===void 0||a?.positionWASM.length===0||a?.indexWASM===void 0||a?.indexWASM.length===0||a?.verticesPerFaceWASM===void 0||a?.verticesPerFaceWASM.length===0)return null;let l={type:o,...Mee(a.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let c in a)c==="positionWASM"?l[c]=new Float32Array(a[c].array):c==="indexWASM"?l[c]=new Int32Array(a[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(a[c].array));return l.scaleBaked=[1,1,1],l}let r=t.type,s=t.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:kU(t.shape),type:r}):r==="LatheGeometry"?{...t.parameters,type:r,points:(t?.parameters.points??[]).map(o=>[o.x,o.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function Mee(i){return UU.setFromArray(i),UU.getSize(L1),{width:L1.x,height:L1.y,depth:L1.z}}var h0e,p0e,f0e,m0e,g0e,UU,L1,VU=B(()=>{an();q();xf();h0e=new te,p0e=new ke,f0e=new Ht,m0e=new M,g0e=new M,UU=new Nt,L1=new M});var N1,B1,zU=B(()=>{N1=(e=>(e.view="view",e.edit="edit",e))(N1||{});(t=>{function i(e){return e!=="view"}t.canWrite=i})(N1||(N1={}));B1=class extends Error{constructor(e,n){super(`This is a ${e.toUpperCase()} document, but it was opened as a ${n.toUpperCase()} one`);this.actual=e;this.expected=n;this.name="DocumentKindMismatchError"}}});function F1(i){return typeof i=="object"&&i!==null}function _ee(i){if(!F1(i))return null;let t=i;return F1(t.scene)?"3d":F1(t.scenes)&&F1(t.assets)?"2d":null}function GU(i){let t=_ee(i);if(t!=="3d")throw t!==null?new B1(t,"3d"):new Error("Not a Spline 3D document: the data has no `scene`, so it cannot be migrated")}var WP=B(()=>{"use strict";zU()});var jU=B(()=>{"use strict"});var _0e,HU=B(()=>{"use strict";an();iv();WP();_0e={...Yy,updateSchema(i){return GU(i),(i.schema??0)<132?cu(i,UP):(i.schema??0)-132},asyncKeys(){return[]}}});var P0e,R0e,WU=B(()=>{"use strict";of();P0e=new Set(["type","category","visible","noiseType","isMask","bumpMap","roughnessMap",...sf]),R0e=new Set(p1)});var pt=B(()=>{NU();jU();aU();iv();HU();WP();LP();WU();C1();an()});function qU(i){for(let t of Aee)i.enable(t)}var Aee,cs,Sf,XU,YU,aa=B(()=>{Aee=[3,4,8,9];cs=5,Sf=3,XU=32,YU=.98});var ja,wf=B(()=>{"use strict";q();ja=i=>{var t;return t=class extends i{},t.geometryHelper=new ni(30,30,30),t}});var k1,qP,$U,Ha,Ef=B(()=>{"use strict";q();k1=new Hi,qP=new nr,$U=new te,Ha=(i,t,e,n,r=!1,s=i)=>{let o=t,a=s.matrixWorld;if(o.boundingSphere===null&&o.computeBoundingSphere(),qP.copy(o.boundingSphere),qP.applyMatrix4(a),e.ray.intersectsSphere(qP)===!1||($U.copy(a).invert(),k1.copy(e.ray).applyMatrix4($U),o.boundingBox!==null&&k1.intersectsBox(o.boundingBox)===!1))return;let l,c,u,d,h=o.index,p=o.attributes.position,f=o.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,k1,p,c,u,d),l){l.faceIndex=Math.floor(m/3),n.push(l);return}}else{let b=o.attributes.position,x=new M,S=new M,E=new M,T=new M,w=2,A=1/((s.scale.x+s.scale.y+s.scale.z)/3),C=A*A,R=Math.max(0,f.start),D=Math.min(b.count,f.start+f.count);for(let O=R,L=D-1;O<L;O+=w){if(x.fromBufferAttribute(b,O),S.fromBufferAttribute(b,O+1),k1.distanceSqToSegment(x,S,T,E)>C)continue;T.applyMatrix4(s.matrixWorld);let j=e.ray.origin.distanceTo(T);j<e.near||j>e.far||n.push({distance:j,point:E.clone().applyMatrix4(s.matrixWorld),object:i})}}function y(v,b,x,S,E,T,w){let _=new M,A=new M,C=new M,R=new M,D=new M;if(_.fromBufferAttribute(S,E),A.fromBufferAttribute(S,T),C.fromBufferAttribute(S,w),x.intersectTriangle(_,A,C,!1,R)===null)return null;D.copy(R),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 Cee,KU,Pee,ZU,So,av=B(()=>{"use strict";q();wf();Ef();Cee=new M(1,1,1),KU=new M,Pee=new M,ZU=new ke,So=class extends ja(Sy){constructor(e,n=15){super(n);this.object=e;this.dummy=new Bs;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,n){Ha(this.object,So.geometryHelper,e,n,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(KU,ZU,Pee),this.matrix.compose(KU,ZU,Cee),super.updateMatrixWorld(e)}updateWorldMatrix(e,n){}}});var Xd,Yd,vu,JU,Ree,Iee,QU,lv,ek=B(()=>{"use strict";q();Xd=new M,Yd=new M,vu=new te,JU=[new M(-1,1,1),new M(-1,-1,1),new M(1,-1,1),new M(1,1,1),new M(-1,1,-1),new M(-1,-1,-1),new M(1,-1,-1),new M(1,1,-1)],Ree=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],Iee=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],QU=(i,t,e)=>{i.updateEntityBoxSize(Xd,Yd),vu.copy(t).multiply(i.matrixWorld),Yd.x===0&&Yd.y===0&&Yd.z===0?e.push(new M(Xd.x,Xd.y,Xd.z).applyMatrix4(vu)):JU.forEach(n=>{e.push(n.clone().multiply(Yd).add(Xd).applyMatrix4(vu))})},lv=class extends Nt{constructor(){super(...arguments);this.matrix=new te;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 te().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,n)}expandByObjectSize(e,n,r=!1){let s=[];if(r===!0){let o=[];e.traverseEntity(a=>{if(a.visible||a.cloner&&a.data.visible){if(!("geometry"in a)){vu.copy(n).multiply(a.matrixWorld),o.push(new M().applyMatrix4(vu));return}QU(a,n,s)}}),s.length===0&&s.push(...o)}else QU(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(vu.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(Yd).multiplyScalar(.5),this.getCenter(Xd),vu.copy(this.matrix).setPosition(Xd),this.vertices=JU.map(e=>e.clone().multiply(Yd).applyMatrix4(vu))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=Ree.map(([e,n])=>new ri(this.vertices[e],this.vertices[n])),this.centerEdges=this.edges.map(e=>e.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=Iee.map(([e,n])=>this.vertices[e].clone().add(this.vertices[n]).multiplyScalar(.5))}}});var wo,cv=B(()=>{"use strict";wo={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function bu(i){return i?.isParticleSystem===!0}function la(i){return i?.isHairSystem===!0}function Xi(i){return i?.isShapeBlendEntity===!0}function $d(i){return i?.isPathObject===!0}function Rr(i){return i?.isObject2D===!0}function vr(i){return i?.isUIObject===!0}function tk(i){return typeof i=="object"&&i!==null&&"booleanOp"in i}function ic(i){return i?.isCloner===!0}function Wa(i){return i?.isClone===!0}function Tf(i){return i?.isComponentObject===!0}var fr=B(()=>{});function Mt(i){rk.add(i)}function ik(i){return rk.has(i)}function Jn(i,t){let e=`${i}:${t}`;nk.has(e)||nk.add(e)}function Kd(i,t){sk.set(i,t)}function V1(i){return sk.get(i)}function Eo(i,t){ok.set(i,t)}function z1(i){return ok.get(i)}function uv(i,t){ak.set(i,t)}function G1(i){return ak.get(i)}function lk(i){YP=i,XP!==null&&i.setHanaUIWasmUrl(XP)}function ck(i){XP=i,YP?.setHanaUIWasmUrl(i)}function dv(){return YP}var rk,nk,sk,ok,ak,YP,XP,Qt=B(()=>{rk=new Set;nk=new Set;sk=new Map,ok=new Map;ak=new Map;YP=null,XP=null});function uk(i){let t=i.elements;qa.set(t[0],t[1],t[2]),Xa.set(t[4],t[5],t[6]),sc.set(t[8],t[9],t[10])}function Dee(i,t){i.set(1,0,0).cross(t),i.lengthSq()<=H1&&i.set(0,1,0).cross(t),i.normalize()}function dk(){let i=Math.max(qa.lengthSq(),Xa.lengthSq(),sc.lengthSq());qa.lengthSq()>H1*i?To.copy(qa).normalize():To.set(1,0,0),Mo.crossVectors(sc,To),Mo.lengthSq()<=H1*i&&(Mo.copy(Xa).addScaledVector(To,-Xa.dot(To)),Mo.lengthSq()<=H1*i&&Dee(Mo,To)),Mo.normalize(),Mf.crossVectors(To,Mo)}function Lee(){let i=qa.length(),t=Xa.length(),e=sc.length(),n=Math.max(i,t,e);if(n-i>j1||n-t>j1||n-e>j1)return!0;let r=j1*n*n;return Math.abs(qa.dot(Xa))>r||Math.abs(qa.dot(sc))>r||Math.abs(Xa.dot(sc))>r}function hk(i,t,e){return uk(i),dk(),t.makeBasis(To,Mo,Mf),e.set(To.dot(qa),To.dot(Xa),To.dot(sc),0,Mo.dot(qa),Mo.dot(Xa),Mo.dot(sc),0,Mf.dot(qa),Mf.dot(Xa),Mf.dot(sc),0,0,0,0,1),Lee()}function pk(i){return uk(i),dk(),Oee.makeBasis(To,Mo,Mf)}var qa,Xa,sc,To,Mo,Mf,Oee,H1,j1,$P=B(()=>{"use strict";q();qa=new M,Xa=new M,sc=new M,To=new M,Mo=new M,Mf=new M,Oee=new te,H1=1e-12,j1=.01});var KP,oc,_f,Af=B(()=>{"use strict";q();$P();KP=new te;(t=>{function i(e){return e&&e.__isSPEObject}t.is=i})(oc||(oc={}));_f=i=>class extends i{constructor(){super(...arguments);this.previousModelViewMatrix=new te;this.copyPreviousMatrix=!0;this.hiddenMatrix=new te;this.pivotMatrix=new te;this.matrixWorldRigid=new te;this.shearScale=new te;this.shearScaleInv=new te}get __isSPEObject(){return!0}getPhysicsLocalMatrix(n){return this.rigidBody?.isDynamic()?(n.copy(this.matrixWorld),this.hasNonUniformScale&&n.multiply(this.shearScaleInv),this.parent&&n.premultiply(KP.copy(this.parent.matrixWorld).invert()),n.premultiply(KP.copy(this.hiddenMatrix).invert()),n.multiply(KP.copy(this.pivotMatrix).invert()),!0):!1}isDescendantOf(n){n instanceof Zt&&(n=n.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===n)return!0;r=r.parent}return!1}updateMatrixWorld(n){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,n=!0);for(let r of this.children)r.updateMatrixWorld(n)}updateWorldMatrix(n,r){let s=this.parent;if(n&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),r)for(let o of this.children)o.updateWorldMatrix(!1,!0)}traverseChildren(n,r=0){for(let s of this.children)oc.is(s)&&s.traverseObject(n,r+1)}traverseObject(n,r=0){if(n(this,r)!==!0)for(let o of this.children)oc.is(o)&&o.traverseObject(n,r+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=hk(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 te().copy(this.matrixWorld).invert();return n.parent!==null&&(n.parent.updateWorldMatrix(!0,!1),s.multiply(n.parent.matrixWorld)),"hiddenMatrix"in n&&n.hiddenMatrix instanceof te?n.hiddenMatrix.premultiply(s):n.applyMatrix4(s),n.updateWorldMatrix(!1,!1),this.add(n),r!==void 0&&(this.children.pop(),this.children.splice(r,0,n)),this}copy(n,r=!1){return super.copy(n,r),this.hasNonUniformScale=n.hasNonUniformScale,this}onAfterRender(n,r,s,o,a,l){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function gk(i,t,e){return Zd.subVectors(t,i),q1.subVectors(t,e),Zd.cross(q1).length()<=W1}function X1(i){let t=yk.get(i.points);if(t!==void 0&&t.isClosed===i.isClosed)return t.curve;let e=Nee(i);return yk.set(i.points,{isClosed:i.isClosed,curve:e}),e}function Nee(i){let t=i.points,e=[t[0]],n=[new M(...t[0].data.position)];Cf.copy(n[0]);for(let f=0;f<t.length-1;f++)Zd.fromArray(t[f].data.position),q1.fromArray(t[f+1].data.position),hv.subVectors(Zd,Cf),pv.subVectors(Zd,q1),hv.cross(pv).length()>W1&&(e.push(t[f]),n.push(new M().copy(Zd)),Cf.copy(Zd));let r=t[t.length-1];e.push(r),n.push(new M(...r.data.position));let s=i.isClosed,o=e.length-(s?0:1),a=e.length,l=[],c=[];for(let f=0;f<a;f++){let m=e[f].data;l.push(new M(...m.controlPrevious.position)),c.push(new M(...m.controlNext.position))}let u=[];for(let f=0;f<o;f++){let m=f===a-1?0:f+1;u.push(gk(n[f],c[f],n[m])&&gk(n[f],l[m],n[m]))}let d=[];for(let f=0;f<a;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===a-1))continue;let v=s&&f==0?a-1:f-1,b=s&&f==a-1?0:f+1,x=new M().subVectors(n[v],g).normalize(),S=new M().subVectors(n[b],g).normalize();y.prevDir=x,y.nextDir=S;let E=u[s&&f===0?a-1:f-1],T=u[f];if(E&&T){Pf.addVectors(x,S).normalize();let w=Cf.crossVectors(Pf,x).length()/x.dot(Pf);y.tan=w,y.removedLength=m.roundness/w}}for(let f=0;f<o;f++){let m=f,g=s&&f===a-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*a).fill(null);for(let f=0;f<o;f++){let m=f,g=s&&f===a-1?0:f+1,y=d[m],v=d[g],b=null;if(!u[f])y.position.distanceTo(v.position)>W1&&(b=new Kc(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(Cf.copy(y.nextDir).setLength(y.removedLength)),v.prevDir&&S.add(Cf.copy(v.prevDir).setLength(v.removedLength))),x.distanceTo(S)>W1&&(b=new Kc(x,x.clone().lerp(S,.3),S.clone().lerp(x,.3),S))}h[2*f+1]=b}for(let f=0;f<a;f++){let 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;Pf.addVectors(m.prevDir,m.nextDir).normalize(),hv.copy(y).lerp(v,.5);let x=y.distanceTo(v)/2;mk.copy(Pf).multiplyScalar(Math.sqrt(Math.pow(b,2)-Math.pow(x,2))).add(hv),ZP.copy(Pf).multiplyScalar(-b).add(mk);let S=g.distanceTo(ZP)/g.distanceTo(hv);pv.copy(m.prevDir).multiplyScalar(S*g.distanceTo(y)).add(g),fk.copy(pv).lerp(ZP,2);let E=y.clone().lerp(pv,4/3),T=v.clone().lerp(fk,4/3);h[2*f]=new Kc(y,E,T,v)}let p=new QP;for(let f=0;f<h.length;f++){let m=h[f];m&&p.add(m)}return p}var QP,W1,Zd,q1,Cf,Pf,hv,ZP,pv,fk,mk,yk,JP=B(()=>{"use strict";q();QP=class extends bp{constructor(){super()}getPoints(t=12){let e=[],n,r=this.getCurveLengths(),o=r[r.length-1]/r.length;for(let a=0,l=this.curves;a<l.length;a++){let c=l[a],u=a===0?r[a]:r[a]-r[a-1],d=Math.ceil(t*u/o),h=c.getPoints(d);for(let p=0;p<h.length;p++){let f=h[p];n&&n.equals(f)||(e.push(f),n=f)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}},W1=.001,Zd=new M,q1=new M,Cf=new M,Pf=new M,hv=new M,ZP=new M,pv=new M,fk=new M,mk=new M;yk=new WeakMap});function bk(i){let t=i%1;return t<0?t+1:t===0&&i>0?1:t}function xk(i,t,e,n){vk.setFromRotationMatrix(fv.extractRotation(n));let r=i.clone().applyMatrix4(fv.copy(n).invert().multiply(e));if(t===null)e2.setFromRotationMatrix(fv.extractRotation(e));else{let o=t.clone().applyMatrix4(fv.extractRotation(e));e2.setFromRotationMatrix(fv.lookAt(Fee.set(0,0,0),o,Uee))}let s=new M().setFromEuler(Bee.setFromQuaternion(vk.invert().multiply(e2))).multiplyScalar(ge.RAD2DEG);return{position:r,rotation:s}}var fv,vk,e2,Bee,Fee,Uee,Sk=B(()=>{"use strict";q();fv=new te,vk=new ke,e2=new ke,Bee=new Ht,Fee=new M,Uee=new M(0,1,0)});var Ot,Ya,kee,Vee,Y1,wk,t2,Ek,Tk,Rf,Yi=B(()=>{"use strict";q();pt();ek();an();cv();fr();Qt();Af();JP();Sk();dn();(t=>{function i(e){return e&&e.__isEntity}t.is=i})(Ot||(Ot={}));Ya=i=>Ot.is(i),kee={type:"completeState",isfromEntity:!0},Vee=["x","y","z"],Y1=new M,wk=new M(1,1,1),t2=new ke,Ek=new Ht,Tk=new te,Rf=i=>class extends _f(i){constructor(){super(...arguments);this.raycastLock=!1;this.scaleLock=!1;this.disposed=!1;this.stateSelection=null;this.destroyedInAction=!1;this.instances=[];this.prevState=null;this.currentState=null;this.currentAnimationAction=null;this.reversibleToState=null;this.transitionState={settled:!0,state:null};this.currentTransitionEvent=null;this.previousAction=null;this._singleBBox=new lv;this._recursiveBBox=new lv;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this._needApplyPathSnapping=!0;this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(n){let r=this.children[n];if(Ot.is(r))return r}entityChildrenCount(){let n=this.children.length;for(;n--;)if(Ot.is(this.children[n]))return n+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let n=this;for(;n.data.type!=="Instance";){let r=n.parent;if(Ot.is(r))n=r;else return}return n}forInstancesRec(n){this.instances.forEach(r=>{r.disposed||n(r),r.forInstancesRec(n)})}super_Entity(n,r){typeof n=="string"&&(this.uuid=n),this.identity=n,this.data=r,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(n,r,s=!1){if(!(this.data.states.length===0&&!s)){for(let o of this.data.states)ia.toOps(this.data,o.data).forEach(l=>{let c=Qp.replaceProps(l,this.data);this.dataPatched=this.data,this.updateByPatchedOp(c,this.data,r)});if(n!==null){let o=this.data.states.data(n);o&&(this.dataPatched=ia.patch(this.data,o),ia.toOps(this.data,o).forEach(l=>{this.updateByPatchedOp(l,this.dataPatched,r)}))}s&&this.updateTransformState(this.dataPatched,r),this.stateSelection=n,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(n,r){n.setScalar(0),r.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(n=>{Ya(n)&&n.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(n=>{n.resetBBoxNeedsUpdateSelf()})}find(n){let r;return this.traverseEntity(s=>{s.uuid===n&&(r=s)}),r}traverseSortNextHelper(){let n=this.parent;if(n){let r=n.children,s=r.indexOf(this)+1;if(Ot.is(r[s]))return r[s];if(Ot.is(n))return n.traverseSortNextHelper()}}sortNext(){let n=this.children;return this.children.length>0&&Ot.is(this.children[0])?n[0]:this.traverseSortNextHelper()}goUp(n){let r=this;for(;n>0&&r!==null;)r=r.parent,n-=1;return r}hasAnccestorOrSelf(n){return this===n||this.hasAnccestor(n)}hasAnccestor(n){let r=this.parent;for(;r;){if(n===r)return!0;r=r.parent}return!1}countToAccestor(n){let r=0,s=this;for(;s!==n;){if(s===null)return-1;s=s.parent,r+=1}return r}forEachEntity(n){for(let r of this.children)Ya(r)&&n(r)}traverseEntityAncestors(n){this.traverseAncestors(r=>{Ot.is(r)&&n(r)})}traverseConcreteEntity(n,r=0){if(n(this,r)!==!0)for(let o of this.children)Ya(o)&&o.isConcreteEntity&&o.traverseEntity(n,r+1)}traverseEntity(n,r=0){if(n(this,r)!==!0)for(let o of this.children)Ya(o)&&o.traverseEntity(n,r+1)}traverseVisibleEntity(n){n(this);for(let r of this.children)Ya(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=>Ya(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*ge.RAD2DEG,this.rotation.y*ge.RAD2DEG,this.rotation.z*ge.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return zy(r,n)}getTransformValues(n,r,s){return r[n].map((o,a)=>s?.shared.getVariable(o,[this.uuid,n,Vee[a]])??o)}updateTransformState(n,r){let s=!1;if(n.position&&(this.position.fromArray(this.getTransformValues("position",n,r)),s=!0),n.rotation&&(Y1.fromArray(this.getTransformValues("rotation",n,r)).multiplyScalar(ge.DEG2RAD),this.rotation.setFromVector3(Y1),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??pu.identity)),n.pivot!==void 0||n.pivotRotation!==void 0){if(s=!0,n.pivot!==void 0&&n.pivotRotation!==void 0)this.pivotMatrix.compose(Y1.fromArray(n.pivot).negate(),t2.setFromEuler(Ek.fromArray(n.pivotRotation.map(o=>o*ge.DEG2RAD))).invert(),wk);else if(n.pivot!==void 0)this.pivotMatrix.setPosition(-n.pivot[0],-n.pivot[1],-n.pivot[2]);else if(n.pivotRotation!==void 0){let o=Y1.setFromMatrixPosition(this.pivotMatrix);t2.setFromEuler(Ek.fromArray(n.pivotRotation.map(a=>a*ge.DEG2RAD))).invert(),this.pivotMatrix.compose(o,t2,wk)}}return s&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(o=>{o.invalidateClonerTransform(this)})),n.position&&n.rotation&&n.scale&&n.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),s}onVariableUpdate(n=!1){if(n){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)}),this.requestRender()}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let n of this.children)Ot.is(n)&&n.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(n=>{Ot.is(n)&&n.disposeRecursively()})}toState(n=[]){let r={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(n)};return zy(r,n)}updateByObjUpdateOp(n,r){n!==void 0&&this.updateByOp({type:0,props:n,path:[]},{...this.data,...n},r,!1)}updateByOp(n,r,s,o){let a=this.data;this.data=r;let l=n,c=$t(n.path,["states","*"]);if(c!==null){if(n.type===0){let[u]=c;if(this?.stateSelection===u){let d={...n.props};if(delete d.name,Object.values(n.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let p=rr.zoom(h,n.path.slice(2));if(p)for(let f in n.props)n.props[f]===void 0&&f in p&&(d[f]=p[f])}}l={...n,props:d,path:n.path.slice(2)}}}}else if(n.type===0){let u=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(u!==void 0){if(n.props.name!==void 0&&u.name){let{name:h,...p}=u;u=p}if(n.props.material!==void 0&&"material"in u){let{material:h,...p}=u;u=p}let d=rr.removeOverridden(n.path,n.props,u);l={...n,props:d}}}if(this.updateByPatchedOpBase(l,ia.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(Fa.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=hf.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 yo.rootOverrideProps)h in n.props&&(d===void 0&&(d={}),d[h]=n.props[h]);d&&(u={...n,props:d})}else for(let d of yo.rootOverrideProps)if($t(n.path,[d])){u=n;break}u!==void 0&&this.instances.forEach(d=>{if(d.isInstanceRoot){let h=Fa.filterOp(d.overrideData,u);h&&d.updateByOp(h,wr.applySimple(d.data,h),s,!0)}}),this.instances.forEach(d=>{if(!d.isInstanceRoot){let h=Fa.filterOp(d.overrideData,n);if(h){let p;a===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&&!ta.is(n.props.type)&&wo.changeEntityProptotype(this,r,s);else if(n.path.length===1&&n.path[0]==="geometry"&&n.type===0&&"type"in n.props){wo.changeEntityProptotype(this,r,s);for(let o of this.children)Ot.is(o)&&o.updateVisible(s.scene)}this.updateByPatchedOp(n,r,s)}updateByPatchedOp(n,r,s){if(n.path.length===0&&n.type===0?this.updateState(n.props,s):n.type===0&&("resolutionLevel"in n.props||"useChildrenColors"in n.props)&&this.updateState(r,s),n.path[0]==="morphTargetInfluences"&&n.type===0){let a=r.morphTargetInfluences.get(n.path[1])?.data.name;a&&this.updateMorphInfluences(a,s.shared.getVariable(n.props.value,[this.uuid,"morphTargetInfluences",a]))}if($t(n.path,["pathSnapping"])!==null&&this.updatePathSnapping(r.pathSnapping),$t(n.path,["cloner"])!==null){let o=wr.drop(n,1);o.path.length===0&&o.type===0&&o.props.disabled===!0?this.setFromClonerState(null,s):this.cloner?this.cloner.updateState(r.cloner,s):(this.setFromClonerState(r.cloner,s),this.expandCloner(s)),this.updateVisible(s.scene)}}updatePathSnapping(n=this.dataPatched.pathSnapping){this._updatedPathSnapping=n,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(n){if(this._needApplyPathSnapping===!1)return;let r=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,s=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,o=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(r===null)return;let l=n.find(r);if(!l)return;this._needApplyPathSnapping=!1;let c=l.data;if(c.geometry.path.points.length<=1)return;let u=X1(c.geometry.path),d=bk(s+o),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?Tk.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix):Tk.copy(this.hiddenMatrix),f=xk(h,a==="tangential"?u.getTangentAt(d):null,l.matrixWorld,p);this.updateTransformState({position:f.position.toArray(),rotation:f.rotation.toArray()}),this.traverseEntity(m=>{m._cameraType&&m.dispatchEvent(kee)})}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=>ic(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(wo.Cloner===null){Jn("cloners","a cloner");return}this.cloner=new wo.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 $1,_o,xu=B(()=>{"use strict";q();Yi();(t=>t.is=e=>"objectHelper"in e)($1||($1={}));_o=(i,t)=>class extends Rf(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 Wl&&(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 Wl&&(s.visible=!1)}}}});var us,mv=B(()=>{"use strict";q();av();xu();us=class extends _o(Bs,So){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 ca(i,t,e,n,r,s,o){K1.set(r,s,o).unproject(n);let a=t[i];if(a!==void 0){let l=e.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],K1.x,K1.y,K1.z)}}var K1,Ao,n2,Z1,Mk=B(()=>{"use strict";q();wf();Ef();K1=new M,Ao=new Ss,n2=class extends Fl{constructor(e){let n=new Me,r=new ks({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Ye(15711266),c=new Ye(15711266),u=new Ye(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),o.push(f.r,f.g,f.b),a[p]===void 0&&(a[p]=[]),a[p].push(s.length/3-1)}n.setAttribute("position",new Be(s,3)),n.setAttribute("color",new Be(o,3));super(n,r);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,n=this.pointMap,r=!0;Ao.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=r?.8:1e-4;ca("n1",n,e,Ao,-s,-o,a),ca("n2",n,e,Ao,s,-o,a),ca("n3",n,e,Ao,-s,o,a),ca("n4",n,e,Ao,s,o,a);let l=a;ca("f1",n,e,Ao,-s,-o,l),ca("f2",n,e,Ao,s,-o,l),ca("f3",n,e,Ao,-s,o,l),ca("f4",n,e,Ao,s,o,l);let c=l,u=.5;ca("u1",n,e,Ao,s*.7*u,o*1.1,c),ca("u2",n,e,Ao,-s*.7*u,o*1.1,c),ca("u3",n,e,Ao,0,o*(1.1+.9*u),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};Z1=class extends ja(n2){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){Ha(this.object,this.geometry,e,n,!0)}}});function _k(i){return 1-Math.pow(1-i,3)}var Q1,If,r2,i2,s2,gv,o2,$a,rn,Xs=B(()=>{"use strict";q();Mk();pt();xu();dn();Q1=790;If=new M,r2=new M,i2=new ke,s2=new M,gv=new M,o2=new M,$a=class extends _o(Ss,Z1){constructor(e="",n={...jd.defaultData,name:""}){super();this._cameraType="OrthographicCamera";this.targetOffset=na.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=$a.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),n?.()};this.super_Entity(e,n),this.previousProjectionMatrix=new te,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,s=this.height;this.orthoCamera=new $o(r*-.5,r*.5,s*.5,s*-.5,-5e4,1e4),this.perspCamera=new Yo(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=$a.projectionTransitionsEnabled;$a.projectionTransitionsEnabled=!1;try{return e()}finally{$a.projectionTransitionsEnabled=n}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,n){e==="PerspectiveCamera"?this.perspCamera.near=n:this.orthoCamera.near=n}setZoom(e,n){n>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=n:this.orthoCamera.zoom=n)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,n,r){typeof e=="number"&&(e=new M(e,n,r)),super.lookAt(e),this.getWorldPosition(If),this.targetOffset=If.distanceTo(e)}getTarget(e=new M){return this.getWorldDirection(r2),this.getWorldPosition(If),r2.multiplyScalar(this.targetOffset),e.copy(If).add(r2),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(If),If.distanceTo(e)}updateUp(){this.getWorldQuaternion(i2),s2.set(0,0,1).applyQuaternion(i2),gv.copy(Zt.DEFAULT_UP),this.isUpVectorFlipped&&gv.negate(),gv.applyQuaternion(i2),o2.copy(Zt.DEFAULT_UP).projectOnPlane(s2),this.angleOffsetFromUp=o2.angleTo(gv),this.angleOffsetFromUp*=o2.cross(gv).dot(s2)>=0?1:-1}updateTransformState(e,n){let r=super.updateTransformState(e,n);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(e){let n=e.getWorldPosition(new M),s=e.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:n.clone().add(s),target:n}}getViewToTarget(e){let r=this.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:e.clone().sub(r),target:e}}getViewToObject(e){let n=new M;return e.getWorldPosition(n),this.getViewToTarget(n)}setViewplaneSize(e,n,r=!1){if(this.aspect=e/n,r){let s=e>n?this.aspect:1,o=e>n?1:this.aspect;this.left=-Q1*.5*s,this.right=Q1*.5*s,this.top=Q1*.5*(1/o),this.bottom=-Q1*.5*(1/o)}else this.left=-e*.5,this.right=e*.5,this.top=n*.5,this.bottom=-n*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let e=this._projectionTransition;if(e===void 0)return 1;let n=(performance.now()-e.start)/e.duration;return n>=1?1:n<=0?0:_k(n)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return $a.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=$a.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let n=this._projectionTransition;n===void 0&&(n={from:new te,blend:new te,blendInverse:new te,start:0,duration:$a.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=n),n.from.copy(this.projectionMatrix),n.start=performance.now(),n.duration=$a.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=_k(n),s=e.from.elements,o=this._activeSubCamera.projectionMatrix.elements,a=e.blend.elements,l=e.referenceDepth,c=Math.max(1e-6,s[15]-s[11]*l),u=Math.max(1e-6,o[15]-o[11]*l),d=r*c/(r*c+(1-r)*u);for(let h=0;h<16;h++)a[h]=s[h]+(o[h]-s[h])*d;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let n=this._activeSubCamera;this.projectionMatrix=n.projectionMatrix,this.projectionMatrixInverse=n.projectionMatrixInverse}_syncProjectionTransition(e){let n=e._projectionTransition;if(n===void 0){this._projectionTransition!==void 0&&this._endProjectionTransition();return}let r=this._projectionTransition;r===void 0?(r={from:new te,blend:new te,blendInverse:new te,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):r.raf!==0&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(n.from),r.start=n.start,r.duration=n.duration,r.referenceDepth=n.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,n,r,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,n,r,s,o,a):this.orthoCamera.setViewOffset(e,n,r,s,o,a),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,n){return super.copy(e,n),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=na.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 zy(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=na.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}}},rn=$a;rn.projectionTransitionsEnabled=!1,rn.projectionTransitionDuration=350,rn.projectionTransitionMinAgeMs=1e3});function J1(i){return i.type==="TorusGeometry"&&i.arc===360}var Ak,a2,yv,Of=B(()=>{"use strict";q();Ak=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??n),s=Math.abs(e.depth??n),o=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(e,{width:n,height:r,depth:s,radius:o,segments:Math.round(e.segments),pathSegments:Math.round(e.pathSegments),cornerSegments:Math.round(e.cornerSegments)})}}static build(i){let{width:t,height:e,depth:n,radius:r,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:d}=i.parameters,h=new yv(!1,t,e,n,r,s,o,a,l,c,u,d);return Object.assign(h,{userData:{...i,type:"HelixGeometry"}})}},a2=new Us([0,0,0],1);yv=class extends Me{constructor(t=!0,e=1,n=1,r=1,s=1,o=1,a=1,l=1,c=1,u=1,d=1,h=1){if(super(),o===0)return;let p=t&&o===1;p&&(h=0),d>100&&(d=100),d===0&&(h=0);let f=()=>new M,m=new M,g=f(),y=f(),v=f(),b,x,S,E,T,w,_,A,C=f(),R=f(),D=f(),O=f(),L=f(),F=f(),j=f(),W=f(),K=n-2*l+.001,Y=K/o,$=Math.ceil(a*o),ee=$+1,oe=K/$,ae=-K/2,de=u+1,be=2*Math.PI/u,Re=Math.PI/2/h,me=.01,Ae=Math.min((1-d/100)*l,l-me),Le=l-Ae,Ie=0,Ge=2,Ve=h*Ge+Ge,pe=de*Ve/Ge,Ne=pe+de*ee,we=Math.max(0,de*(ee+Ve)),[$e,nt,Ce]=[3,3,2].map(ye=>Array(we*ye).fill(0)),je=[],V=s-l;function _e(ye,Oe){let le=Math.PI/2;w=Oe*oe,A=2*Math.PI*(w%Y)/Y+le,w+=ae,_=Math.sin(A)*V,T=Math.cos(A)*V,t?ye.set(T,_,w):ye.set(T,w,_)}_e(m,-1e-10),_e(g,0),C.copy(m),_e(m,1);let X=m.distanceTo(g),ct=p?0:Le+Ae,lt=X*$+2*ct,z=Ae,I=lt-ct;for(let ye=0;ye<=$;ye++){_e(y,ye),W.subVectors(y,C).normalize(),C.copy(y),F.copy(y).setComponent(+t+1,0).normalize(),j.crossVectors(W,F).normalize();let Oe=ye===0,le=ye===$,xe=Oe?3*Math.PI/2:Re,Xe=Oe?z:I,xt=Oe?de:Ne,Ze=Oe?0:we-de,He=W.clone().multiplyScalar(Oe?-Le:Le).add(y),et=W.clone().multiplyScalar(Oe?-1:1).normalize();for(let yt=0;yt<de;yt++){let Ut=yt*be;if(R.addVectors(m.copy(F).multiplyScalar(l*Math.cos(Ut)),g.copy(j).multiplyScalar(l*Math.sin(Ut))),D.copy(R).normalize(),Oe||le){p||(Ie=Ze+yt,[0,1,2].forEach(Q=>{$e[Ie*3+Q]=He.getComponent(Q),nt[Ie*3+Q]=et.getComponent(Q)}),Ce[Ie*2]=+le,Ce[Ie*2+1]=yt/u),g.copy(D).multiplyScalar(Ae),v.addVectors(y,g);for(let Q=0;Q<h;Q++){let We=Q*Re+xe;O.addVectors(m.copy(W).multiplyScalar(Le*Math.sin(We)),g.copy(D).multiplyScalar(Le*Math.cos(We))),L.copy(O).normalize(),g.addVectors(v,O),O.normalize(),Ie=xt+Q*de+yt,[0,1,2].forEach(qe=>{$e[Ie*3+qe]=g.getComponent(qe),nt[Ie*3+qe]=L.getComponent(qe)});let Se=+Oe+Math.sin(We);Ce[Ie*2]=(Xe+Le*Se)/lt,Ce[Ie*2+1]=yt/u}}g.addVectors(y,R),Ie=pe+ye*de+yt,[0,1,2].forEach(Q=>{$e[Ie*3+Q]=g.getComponent(Q),nt[Ie*3+Q]=D.getComponent(Q)}),Ce[Ie*2]=(ct+ye*X)/lt,Ce[Ie*2+1]=yt/u}}let Z=ee+2*h+Ge,[re,he]=[+p,Z-1];for(let ye=re;ye<=he-1;ye++){let Oe=p&&ye===he-1;for(let le=0;le<de-1;le++)b=ye*de+le,x=b+1,S=(Oe?le:b)+de,E=(Oe?le+1:x)+de,ye===0?je.push(x,E,S):ye===Z-2?je.push(b,x,S):je.push(b,x,S,x,E,S)}this.setIndex(je),this.setAttribute("position",new Be($e,3)),this.setAttribute("normal",new Be(nt,3)),this.setAttribute("uv",new Be(Ce,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t=this.userData.parameters,e=Math.ceil(t.tubularSegments),n=t.radialSegments,r=n+1,s=[],o,a,l,c;for(let u=1;u<e;u++)for(let d=0;d<n;d++)o=u*r+d,a=o+1,l=o+r,c=a+r,s.push(o,a,l,a,c,l);for(let u=0;u<n;u++)o=e*r+u,a=o+1,l=u+r,c=u+1+r,s.push(o,a,l,a,c,l);return a2.array=new Uint32Array(s),a2.count=s.length,a2}}});function Pk(i){if(ew)return ew;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.77/build"),s=import("./boolean.js"),[o,a]=await Promise.all([s,fetch(`${n}/boolean.wasm`).then(l=>l.arrayBuffer())]);await o.default({module_or_path:a}),vv=o}return ew=t(),ew}function nw(){if(vv===void 0)throw new Error("boolean-wasm is not loaded");return vv}function l2(i){let t=tw.get(i);if(t===void 0)throw new Error("Unknown csg mesh set handle "+i);return t}function c2(i){return tw.set(++Ck,i),Ck}function Hee(i,t){if(t&&i.userData.positions!==void 0){let a=i.userData,l=[];for(let c=0,u=0;c<a.verticesPerFace.length;c++){let d=a.verticesPerFace[c];for(let h=1;h<d-1;h++)l.push(a.indices[u],a.indices[u+h],a.indices[u+h+1]);u+=d}return{positions:a.positions instanceof Float32Array?a.positions:new Float32Array(a.positions),indices:new Uint32Array(l)}}let e;J1(i.userData.parameters)?e=i.getClosedTorusIndicesForBooleanOrSubdiv():e=i.getIndex();let n=i.getAttribute("position"),r;if(e===null){r=new Uint32Array(n.count);for(let a=0;a<r.length;a++)r[a]=a}else e.array instanceof Uint32Array?r=e.array:r=new Uint32Array(e.array);let s=i.getAttribute("normal"),o=s!==void 0&&s.itemSize===3&&s.count===n.count&&s.array instanceof Float32Array&&s.isInterleavedBufferAttribute!==!0?s.array:void 0;return{positions:n.array,indices:r,normals:o}}function Rk(i,t,e){if(vv===void 0)return-1;let{positions:n,indices:r,normals:s}=Hee(i,t);return c2(new vv.CsgMesh(n,r,s))}function Ik(i,t){let e=nw(),n=jee[t];if(n===void 0)throw new Error("Unknown boolean operation "+t);let r=i.map(l2);if(r.length===1)return e.clone_mesh(r[0]);let s=[],o;if(t===2&&r.length>2){let a=r[0];for(let l=1;l<r.length-1;l++)a=e.boolean_mesh(a,r[l],0),s.push(a);o=e.boolean_mesh(r[r.length-1],a,2)}else if(t===2)o=e.boolean_mesh(r[1],r[0],2);else{let a=r[r.length-1];for(let l=0;l<r.length-1&&(a=e.boolean_mesh(a,r[l],n),s.push(a),a.tri_count()!==0);l++);o=a,s.pop()}for(let a of s)a.free();return o}function Ok(i,t,e,n){let r=nw(),s=Ik(i,t),o=r.mesh_render_data(s,Math.max(n,0));if(e.setAttribute("position",new Be(o.positions(),3)),e.setAttribute("normal",new Be(o.normals(),3)),o.free(),e.boundingSphere===null&&(e.boundingSphere=new nr),s.tri_count()===0)e.boundingSphere.center.set(0,0,0),e.boundingSphere.radius=0,e.userData.parameters={width:0,height:0,depth:0};else{let a=s.bounds();e.boundingSphere.center.set(a[0],a[1],a[2]),e.boundingSphere.radius=(a[3]**2+a[4]**2+a[5]**2)**.5,e.userData.parameters={width:a[3]*2,height:a[4]*2,depth:a[5]*2}}return c2(s)}function Dk(i,t){let e=nw(),n=Ik(i,t),r=e.mesh_topological_data(n),s=r.positions(),o=r.indices();r.free(),n.free();let a=new Uint8Array(o.length/3).fill(3);return{positions:s,indices:o,verticesPerFace:a}}function rw(i,t){l2(i).transform(new Float32Array(t.elements))}function iw(i){let t=tw.get(i);t!==void 0&&(t.free(),tw.delete(i))}function Lk(i,t){let e=nw();return c2(e.instanced_union(l2(i),t))}var vv,tw,Ck,ew,jee,bv=B(()=>{q();Of();tw=new Map,Ck=0;jee={[0]:0,[1]:1,[2]:2}});function Qd(i){return i!==null&&"booleanOp"in i}var Df,Nk=B(()=>{"use strict";q();Yi();bv();Df=class extends Rf(Gt){constructor(){super(...arguments);this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new te}updateVisible(e){super.updateVisible(e),this.visible=!Qd(this.parent)&&this.visible,Qd(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Qd(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(iw(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Qd(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof Df&&(e.freeBooleanPointer(),Qd(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,n){let r=super.updateTransformState(e,n);return r&&Qd(this.parent)&&this.invalidateDownstreamBooleanData(!0),r}onVariableUpdate(e=!1){super.onVariableUpdate(e),Qd(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}});function Bk(){return Wee}var Wee,Fk=B(()=>{"use strict";Wee=null});function xv(i,t=0,e=i.count,n,r){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let d=t;d<e;d++){let h=i.getX(d),p=i.getY(d),f=i.getZ(d);h<s&&(s=h),p<o&&(o=p),f<a&&(a=f),h>l&&(l=h),p>c&&(c=p),f>u&&(u=f)}sw.min.set(s,o,a),sw.max.set(l,c,u),sw.getCenter(n),sw.getSize(r).multiplyScalar(.5)}var sw,qee,Xee,Kt,ii=B(()=>{"use strict";q();Nk();Fk();sw=new Nt;qee=new Me,Xee=new ti,Kt=class extends Df{constructor(t,e){super(qee,Xee),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){if(this.raycastDeformed(t,e))return;let n=Bk();if(n!==null){n(this,t,e);return}super.raycast(t,e)}raycastDeformed(t,e){return!1}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?xv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}}});function Jd(i){return i?.isClassicNodeMaterial===!0}function Uk(i){return i?.isClassicSharedMaterial===!0}var ow=B(()=>{"use strict"});var gn,Co=B(()=>{q();gn=class extends Ye{constructor(e,n,r,s){super(e,n,r);this.isColorA=!0;this.a=s}setRGBA(e,n,r,s){super.setRGB(e,n,r),this.a=s}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,n="srgb"){let r;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(r=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=o==="rgba"?parseFloat(s[4]):1,super.setStyle(e,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=o==="hsla"?parseFloat(s[4]):1,super.setStyle(e,n);break}}return super.setStyle(e,n)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}});var ac,d2=B(()=>{"use strict";Co();ac=class extends gn{}});var aw,kk=B(()=>{"use strict";aw=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 Vk(i){return typeof i=="string"?i:(Sv||(Sv=new h2),Sv.load(i))}function zk(){Sv&&Sv.disposeAll()}var h2,Sv,p2=B(()=>{kk();h2=class extends aw{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}});var lw,cw,f2=B(()=>{"use strict";lw=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")}},cw=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 uw,Gk=B(()=>{q();uw=class extends uy{constructor(t){super(t),this.type=pr}parse(t){let o=function(w,_){switch(w){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(_||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(_||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(_||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(_||""))}},u=`
4137
+ })();`});function qQ(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 WQ,Yp,RC=B(()=>{"use strict";WQ=100;Yp=class{constructor(t,e,n){this.deps=t;this.onConsole=e;this.onEvent=n;this.disposed=!1;this.eventUnsubs=new Map;this.variablePollHandle=null;this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let n=this.deps;switch(t){case"setVariable":{let r=n.setVariable(String(e[0]),e[1]);return r.warning&&this.onConsole("warn",r.warning),r.ok}case"setVariables":{let r=e[0]??{},s=!0;for(let[o,a]of Object.entries(r)){let l=n.setVariable(o,a);l.warning&&this.onConsole("warn",l.warning),s=s&&l.ok}return s}case"getVariable":return n.getVariable(String(e[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(e[0]));case"getGeometry":{let r=n.getGeometry(String(e[0]),e[1]??{});return r.warning&&this.onConsole("warn",r.warning),r.data}case"updateObject":return n.updateObject(String(e[0]),e[1]??{});case"createObject":return n.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":{if(n.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(e[0])}case"getTexture":{if(n.getTexture===void 0)throw new Error("getTexture: not available on this surface \u2014 a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return n.getTexture(String(e[0]),e[1]??{})}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=qQ(this.lastVariables??{},t);this.lastVariables=t;for(let n of e)this.onEvent("variableChange",n)},WQ))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function XQ(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 YQ(i){let t=i[0],e=i[4],n=i[8],r=i[1],s=i[5],o=i[9],a=i[2],l=i[6],c=i[10],u=t*(s*c-o*l)-e*(r*c-o*a)+n*(r*l-s*a);if(!isFinite(u)||Math.abs(u)<1e-12)return null;let d=1/u,h=[(s*c-o*l)*d,(n*l-e*c)*d,(e*o-n*s)*d,(o*a-r*c)*d,(t*c-n*a)*d,(n*r-t*o)*d,(r*l-s*a)*d,(e*a-t*l)*d,(t*s-e*r)*d];return[h[0],h[3],h[6],h[1],h[4],h[7],h[2],h[5],h[8]]}function aB(i,t){let e=i?.getAttribute("position");if(!e||!e.count)return null;let n=e.count,r=t??null,s=i.getIndex?.()??null,o=Math.floor((s?s.count:n)/3),a=1/0,l=1/0,c=1/0,u=-1/0,d=-1/0,h=-1/0,p=new Float32Array(n*3);for(let y=0;y<n;y++){let v=e.getX(y),b=e.getY(y),x=e.getZ(y);r&&([v,b,x]=XQ(r,v,b,x)),v<a&&(a=v),b<l&&(l=b),x<c&&(c=x),v>u&&(u=v),b>d&&(d=b),x>h&&(h=x),p[y*3]=v,p[y*3+1]=b,p[y*3+2]=x}let f={space:r?"world":"local",vertexCount:n,triangleCount:o,indexed:s!==null,bounds:{min:[a,l,c],max:[u,d,h],size:[u-a,d-l,h-c]},vertices:p};if(s){let y=new Uint32Array(s.count);for(let v=0;v<s.count;v++)y[v]=s.getX(v);f.indices=y}let m=i.getAttribute("normal");if(m&&m.count===n){let y=r?YQ(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 T=y[0]*x+y[1]*S+y[2]*E,w=y[3]*x+y[4]*S+y[5]*E,_=y[6]*x+y[7]*S+y[8]*E,A=Math.hypot(T,w,_);A>1e-12?(x=T/A,S=w/A,E=_/A):(x=T,S=w,E=_)}v[b*3]=x,v[b*3+1]=S,v[b*3+2]=E}f.normals=v}}let 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 lB=B(()=>{"use strict"});function cB(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let i=[],t=(r,s,o)=>{let a=new Event(o);try{typeof s=="function"?s.call(r,a):s.handleEvent?.(a)}catch(l){console.error(l)}},e=(r,s)=>{let o=new Set,a=r.addEventListener.bind(r),l=r.removeEventListener.bind(r),c=(d,h,p)=>{if(a(d,h,p),!s.includes(d)||h==null)return;let f={type:d,listener:h};o.add(f),queueMicrotask(()=>{!o.delete(f)||t(r,f.listener,f.type)})},u=(d,h,p)=>{l(d,h,p);for(let f of o)f.type===d&&f.listener===h&&o.delete(f)};Object.defineProperty(r,"addEventListener",{configurable:!0,writable:!0,value:c}),Object.defineProperty(r,"removeEventListener",{configurable:!0,writable:!0,value:u}),i.push(()=>{delete r.addEventListener,delete r.removeEventListener,o.clear()})};e(document,["DOMContentLoaded"]),e(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:r=>{typeof r=="function"&&queueMicrotask(()=>{try{r.call(window,new Event("load"))}catch(s){console.error(s)}})}}),i.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let r of i)r()}}var uB=B(()=>{"use strict"});var $Q,PS,dB=B(()=>{"use strict";CS();RC();$Q=6e3,PS=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;!rB(e)||this.handleMessage(e)};this.host=new Yp(e,n,(r,s)=>{this.sendEvent(r,s)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Yl]:!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.")},$Q)}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({[Yl]:!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({[Yl]:!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({[Yl]:!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({[Yl]:!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 dn=B(()=>{wS();P3();D3();L3();z3();G3();H3();W3();$3();K3();Z3();nB();CS();oB();RC();lB();uB();dB()});var hB=B(()=>{"use strict"});function RS(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 pB=B(()=>{"use strict"});function Wr(i,t){return Object.setPrototypeOf(i,t),i}function IS(i){let t={...i};return Object.setPrototypeOf(t,Object.getPrototypeOf(i)),t}function Ba(i,t,e){if(i===void 0?t===void 0?(i=0,t=10):i=t-10:t===void 0&&(t=i+10),i>t){let s=i;i=t,t=s}let n=[],r=1/(e+1);for(let s=0;s<e;s++){let o=i+(t-i)*(s+.75+Math.random()*.5)*r;n.push(o)}return n}function co(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 fB(){return typeof process<"u"}var mB=B(()=>{"use strict"});function Gy(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"&&Gy(n)}return Object.freeze(i)}function OS(i){for(let t of Object.keys(i))i[t]===void 0&&delete i[t];return i}var gB=B(()=>{"use strict"});var qr=B(()=>{hB();pB();mB();gB()});var DS,Id,jy,LS=B(()=>{"use strict";DS=class{},Id=class extends DS{constructor(e){super();this.id=e}},jy=class extends DS{constructor(e){super();this.data=e}}});var yB=B(()=>{"use strict"});var st,Hy=B(()=>{"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:o}=t,a={...e,[s]:o};return Object.setPrototypeOf(a,st.prototype),{data:a,actual:t,reverse:r}}else if(t.type===2){let{id:n}=t,r=e[n];if(r===void 0)return null;{let s={...e};return Object.setPrototypeOf(s,st.prototype),delete s[n],{data:s,actual:t,reverse:{type:1,id:n,data:r}}}}return null}}});var $p,NS=B(()=>{"use strict";$p=class extends Error{}});function vB(i,t){for(let e of i)t(e.id,e.data)!==!0&&vB(e.children,t)}function bB(i,t){if(t(i.id,i.data)!==!0)for(let e of i.children)bB(e,t)}var Ln,ou=B(()=>{"use strict";qr();NS();qr();Ln=class extends Array{constructor(...e){super(...e);zi(this,"partialObjectCaches");zi(this,"objCaches");zi(this,"parentCaches");Object.setPrototypeOf(this,Ln.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Gy(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&&bB(r,n)}}traverse(e){vB(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this.parent(e),o=this.childrenArray(s),a=o.findIndex(d=>d.id===e);if(a<0)throw new Error("not expected");let l=o[a];o=[...o],o[a]={...l,data:n};let c=new Map;return c.set(e,o[a]),this.modifyArrayBy(s,o,c)}}modifyArrayBy(e,n,r=void 0){let s=e,o=n;for(;s!==null;){let l=o,c=s;if(s=this.parent(s),s===void 0)throw new Error;o=this.childrenArray(s);let u=o.findIndex(d=>d.id===c);if(u<0)throw new Error;o=[...o],o[u]={...o[u],children:l},r&&r.set(c,o[u])}Object.setPrototypeOf(o,Ln.prototype);let a=o;if(r&&this.objCaches!==void 0&&this.parentCaches!==void 0){a.objCaches=this.objCaches;for(let[l,c]of r)a.objCaches.set(l,c);a.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else a.fillCaches();return a}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:n}){if(this.get(e)!==void 0)return!0;for(let r of n)if(this.checkDuplicatedIdRec(r))return!0;return!1}addOp(e){let{parent:n,fi:r,id:s,data:o,children:a}=e;if(n!==null&&this.get(n)===void 0)return null;if(this.checkDuplicatedIdRec(e))return null;{let l=n,c=this.childrenArray(l),u={fi:r,id:s,data:o,children:a};return c=[...c,u],c.sort((h,p)=>h.fi-p.fi),e.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:e,reverse:{type:8,id:s}}}}deleteOp(e){let{id:n}=e;if(this.get(n)===null)return null;{let r=this.parent(n);if(r===void 0)return null;let s=this.childrenArray(r),o=s.findIndex(c=>c.id===n);e.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(r,s),actual:e,reverse:{type:7,...a,parent:r}}}}moveOp(e){let{parent:n,fi:r,id:s}=e;if(n!==null&&this.get(n)===void 0)return this.deleteOp({type:8,id:s});if(n!==null){let p=n;for(;p!==null;){if(p===void 0)throw new Error;if(p===s)throw new $p("cyclic tree");p=this.parent(p)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(p=>p.id===s);l=[...l];let u=l.splice(c,1)[0],d=this.modifyArrayBy(o,l);o=n,l=d.childrenArray(o);let h=u.fi;return u={...u,fi:r},l=[...l,u],l.sort((p,f)=>p.fi-f.fi),e.localIndex=l.indexOf(u),d=d.modifyArrayBy(o,l),{data:d,actual:e,reverse:{type:9,parent:a,fi:h,id:s}}}previous(e,n){if(n===null){let s=this.childrenArray(e);return s.length===0?null:s[s.length-1].id}let r=null;for(let s of this.childrenArray(e)){if(s.id===n)return r;r=s.id}return null}traverseSortNext(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(o=>o.id===e)+1;if(s<r.length)return r[s].id;if(n)return this.traverseSortNext(n)}}sortNext(e){let n=this.childrenArray(e);return n.length>0?n[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let n=this.childrenArray(e);return n.length>0?this.traverseSortPrevious(n[n.length-1].id):e}sortPrevious(e){let n=this.parent(e);if(n!==void 0){let r=this.childrenArray(n),s=r.findIndex(o=>o.id===e)-1;return s>=0?this.traverseSortPrevious(r[s].id):n}}getAllSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r.id);s!==void 0&&n.push({...r,...s})}n.sort((r,s)=>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),o=s;if(s!==void 0){for(;n;)r.splice(0,0,s.fi),n=this.parent(n),n!==null&&(s=this.get(n));return{...o,sortKey:r}}}insertBeforeHelper(e,n,r){return this.insertAfterHelper(e,this.previous(e,n),r)}insertAfterHelper(e,n,r){let s=this.childrenArray(e);if(n===null){if(s.length===0)return Ba(0,r,r);{let o=s[0].fi;return Ba(o-r,o,r)}}else{let o=this.get(n);if(o===void 0||this.parent(n)!==e)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Ba(l,l+r,r)}else return Ba(o.fi,a.fi,r)}}}});var IC,au,BS=B(()=>{"use strict";qr();IC=null;(n=>{function i(r){IC=r}n.setPreservePrototype=i;function t(r,s){return Object.getPrototypeOf(r)===IC&&Object.setPrototypeOf(s,IC),s}n.tryPreservePrototype=t;function e(r,s){if(s.type!==0)return null;if(Array.isArray(r)||co(r)){let o=s.props,a={},l=co(r)?r.slice():[...r],c=!1;if(o)for(let u of Object.keys(o)){let d=parseInt(u);if(isNaN(d))throw new Error("wrong index");a[u]=l[d],l[d]=o[u],c=!0}return c?{data:l,actual:s,reverse:{type:0,props:a}}:null}else{let o=s.props,a={},l={...r},c=!1;if(o)for(let u of Object.keys(o)){a[u]=l[u];let d=o[u];d===void 0?delete l[u]:l[u]=d,c=!0}return c?{data:n.tryPreservePrototype(r,l),actual:s,reverse:{type:0,props:a}}:null}}n.runOp=e})(au||(au={}))});var Fe,lu=B(()=>{"use strict";qr();qr();Fe=class extends Array{constructor(...e){super(...e);zi(this,"objCaches");Object.setPrototypeOf(this,Fe.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Gy(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,n){if(this.get(e)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===e);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]={...a,data:n},this.modifyArrayBy(s)}}modifyArrayBy(e){Object.setPrototypeOf(e,Fe.prototype);let n=e;return fB()||n.fillCaches(),n}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:n,id:r,data:s}=e,o=this,a={fi:n,id:r,data:s};return o=[...o,a],o.sort((c,u)=>c.fi-u.fi),e.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:e,reverse:{type:5,id:r}}}deleteOp(e){let{id:n}=e,r=this,s=r.findIndex(l=>l.id===n);if(s===-1)return null;e.localIndex=s,r=[...r];let o=r.splice(s,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:{type:4,...o}}}moveOp(e){let{fi:n,id:r}=e,s=this;s=[...s];let o=s.findIndex(u=>u.id===r);if(o===-1)return null;let a=s[o].fi,l={...s[o],fi:n};return s[o]=l,s.sort((u,d)=>u.fi-d.fi),e.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:e,reverse:{type:6,fi:a,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let n=null;for(let r of this){if(r.id===e)return n;n=r.id}return null}insertBeforeHelper(e,n){return this.insertAfterHelper(this.previous(e),n)}insertAfterHelper(e,n){let r=this;if(e===null){if(r.length===0)return Ba(0,n,n);{let s=r[0].fi;return Ba(s-n,s,n)}}else{let s=this.get(e);if(s===void 0)throw new Error("illegal args");let o=r.find(a=>a.fi>s.fi);if(o===void 0){let a=r[r.length-1].fi;return Ba(a,a+n,n)}else return Ba(s.fi,o.fi,n)}}}});function xB(i,t){return Kp(i,t,null)??i}function SB(i,t){let e={cur:[],result:[],len:0};return i=Kp(i,t,e)??i,[i,e.result]}function FS(i,t){return i===null?null:(i.cur[i.len]=t,i.len+=1,i)}function US(i){i&&(i.len-=1)}function KQ(i){if(i===null)return null;i.result.push(i.cur.slice(0,i.len))}function wB(i,t,e){let n=!1,r=i.map(s=>{let o=s.id,a=t[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,e!==null))throw new Error("not supported");let l=Kp(s.data,t,FS(e,o));US(e),n=n||l!==void 0,l===void 0&&(l=s.data);let c=wB(s.children,t,e);return c!==void 0?n=!0:c=s.children,{...s,id:o,data:l,children:c}});if(n)return r}function ZQ(i,t,e){let n=!1,r=i.map(s=>{let o=s.id,a=t[o];if(a!==void 0&&typeof a=="string"&&(n=!0,o=a,e!==null))throw new Error("not supported");let l=Kp(s.data,t,FS(e,o));return US(e),n=n||l!==void 0,l===void 0&&(l=s.data),{...s,id:o,data:l}});if(n)return Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r}function Kp(i,t,e){if(i instanceof Ln){let n=wB(i,t,e);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}else{if(i instanceof Fe)return ZQ(i,t,e);if(Array.isArray(i)){let n=!1,r=i.map((s,o)=>{let a=Kp(s,t,FS(e,o));return US(e),n=n||a!==void 0,a===void 0&&(a=s),a});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(i)),r):void 0}else if(i&&typeof i=="object"&&!co(i)){let n={},r=!1;for(let[s,o]of Object.entries(i))if(s!=="name"&&s!=="variableId"){let a=t[s];if(typeof a=="string"){if(e!==null)throw new Error("not supported");r=!0,s=a}let l=Kp(o,t,FS(e,s));US(e),r=r||l!==void 0,l===void 0&&(l=o),n[s]=l}else n[s]=o;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else if(typeof i=="string"){let n=t[i];return n!==void 0&&KQ(e),n}else return}}var OC=B(()=>{"use strict";ou();lu();qr()});function Zp(i){return i&&typeof i=="object"&&i instanceof _n}function DC(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,o=Wy(r.data,t[s]);if(e=e||o!==void 0,o===void 0&&(o=r.data),r.children){let a=DC(r.children,t);return a!==void 0?e=!0:a=r.children,{...r,id:s,data:o,children:a}}else return{...r,id:s,data:o}});if(e)return n}function QQ(i,t){if(t===void 0)return;let e=!1,n=i.map(r=>{let s=r.id,o=Wy(r.data,t[s]);return e=e||o!==void 0,o===void 0&&(o=r.data),{...r,id:s,data:o}});if(e)return Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n}function Wy(i,t){if(!Zp(t))return t;if(i instanceof Ln){let e=DC(i,t);return e!==void 0&&Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e}else{if(i instanceof Fe)return QQ(i,t);if(Array.isArray(i)){let e=!1,n=i.map((r,s)=>{let o=Wy(r,t[s]);return e=e||o!==void 0,o===void 0&&(o=r),o});return e?(Object.setPrototypeOf(n,Object.getPrototypeOf(i)),n):void 0}else{if(i instanceof _n)return LC(i,t);if(i&&typeof i=="object"){let e={},n=!1;for(let[r,s]of Object.entries(i)){let o=Wy(s,t[r]);n=n||o!==void 0,o===void 0&&(o=s),e[r]=o}return n?(Object.setPrototypeOf(e,Object.getPrototypeOf(i)),e):void 0}}}}function LC(i,t){if(i===void 0)return t;if(t===void 0)return i;if(!Zp(t))return t;if(!Zp(i))return Fa.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 _n;for(let r of e){let s=LC(i===void 0?void 0:i[r],t===void 0?void 0:t[r]);n[r]=s}return n}var _n,Fa,qy=B(()=>{"use strict";ou();lu();Xy();qr();_n=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&&!Zp(n))return null;r+=1}n=n?IS(n):new _n;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=IS(l),delete n[t.path[r-1]])}else{let l=e[r-1];if(l){let c=IS(l);c[t.path[r-1]]=n,n=c}else{let c=new _n;c[t.path[r-1]]=n,n=c}}r-=1}let o=Object.setPrototypeOf(n,_n.prototype),a={...t,props:s};return{data:o,actual:t,reverse:a}}};(n=>{function i(r,s){return Wy(r,s)??r}n.apply=i;function t(r,s){return LC(r,s)}n.merge=t;function e(r,s){let o=0,a=s.path,l=r;for(;o<a.length&&l!==void 0;){if(l=rr.zoomOnce(l,a[o]),l===void 0)return s;if(!Zp(l))return;o+=1}if(l===void 0)return s;if(!!Zp(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=DC([s],l);return c?c[0]:s}else return s}n.filterOp=e})(Fa||(Fa={}))});var Qp,wr,Yy,EB=B(()=>{"use strict";qr();Xy();Hy();ou();NS();BS();lu();OC();qy();(t=>{function i(e,n){let r=rr.zoom(n,e.path);if(typeof r=="object"){let s={};for(let o of Object.keys(e.props))s[o]=r[o];return{...e,props:s}}else return{...e,props:{}}}t.replaceProps=i})(Qp||(Qp={}));(a=>{function i(l,c){return{...l,path:l.path.slice(c)}}a.drop=i;function t(l,c){return e(l,c)?.data??l}a.applySimple=t;function e(l,c){let u=c.path,d=[];for(;;){let h;if(l instanceof _n&&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 Fe||l instanceof st?h=l.runOp(c):h=au.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 Fe){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 _n){let b={...v,[y]:m};m=Object.setPrototypeOf(b,_n.prototype)}else if(typeof v=="object")if(Array.isArray(v)||co(v)){if(typeof y=="string"&&(y=parseInt(y),isNaN(y)))throw new Error("Invalid path");let b=m;m=co(v)?v.slice():[...v],m[y]=b}else m=au.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 Fe){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else l!==null&&(f=l[p]);if(f!==void 0)d.push(l),l=f;else return null}}a.apply=e;function n(l,c){for(let u=0;u<l.length&&u<c.length;u++)if(l[u]!==c[u])return!0;return!1}a.pathDisjoint=n;function r(l,c){if(l.length!==c.length)return!1;for(let u=0;u<l.length;u++)if(l[u]!==c[u])return!1;return!0}a.pathEq=r;function s(l,c){return n(l.path,c.path)}a.commutative=s;function o(l,c){return l.type===0&&c.type===0&&r(l.path,c.path)?Object.keys(l.props).every(u=>c.props[u]!==void 0):!1}a.subsumed=o})(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 o(c,u){for(let d of u){let h=a(c,d);h!==null&&(c=h.data)}return c}l.applyAll=o;function a(c,u){let d=c,h=[],p=[];for(let f of u)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let 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]=SB(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 T=[E];for(let _=x+1;_<b.length;_++){let A=b[_],C=A[A.length-1];if(typeof C=="number"&&rr.equal(S,A.slice(0,A.length-1)))T.push(C),b.splice(_,1);else break}let w=rr.zoom(d,S);g=w.map((_,A)=>T.includes(A)?f.id:_),m=w,E=S.pop()}else{if(E==="alphaOverride"||E==="alpha"){m/=100;let T=m,w=rr.zoom(d,S.slice(0,S.length-2)),_=w.layers.map(A=>A.id===S[S.length-1]?{...A,data:{...A.data,[E]:T}}:A);Object.setPrototypeOf(_,Object.getPrototypeOf(w.layers)),w.layers=_}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 $p)return null;throw m}return{data:d,actual:h,reverse:p.reverse()}}l.apply=a})(Yy||(Yy={}))});function TB(i,t){return i instanceof _n?Object.setPrototypeOf(t,_n.prototype):au.tryPreservePrototype(i,t)}function NC(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 zS(i,t,e){return e instanceof Ln?new Jp(i,t,e):e instanceof Fe?new ef(i,t,e):e instanceof st?new Proxy(new FC(i,t,e),tJ):e!==null&&typeof e=="object"?co(e)?e:new Proxy(new BC(i,t,e),eJ):e}function Dd(i){let t=new kS(i);return[zS(t,"",i),t]}function cu(i,t){let[e,n]=Dd(i);return t(e),n.result()}function Pr(i){return i instanceof Jp||i instanceof ef?i._current:i!==null&&typeof i=="object"?i[MB]:i}var MB,JQ,VS,Od,BC,FC,_B,eJ,tJ,Jp,ef,kS,UC=B(()=>{"use strict";Hy();ou();BS();lu();qr();Xy();qy();MB=Symbol(),JQ=Symbol(),VS=Symbol(),Od=class{reportOp(t,e,n=[]){let r=this;if(e===null)return;r._current=e.data;let s=n;for(;!(r instanceof kS);){let o=r._path,a=r._current;if(o!==""&&s.splice(0,0,o),r=r._parent,r===null)return;r.update(o,a)}r.push(s,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let n=e[VS];n&&n(),delete this._children[t]}}}};BC=class extends Od{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=TB(this._current,{...this._current,[t]:e})}runOp(t){let e=au.runOp(this._current,t);e!==null&&(e.data=TB(this._current,e.data)),this.reportOp(t,e,t.path)}},FC=class extends Od{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))}},_B={get(i,t){if(t===VS)return()=>{i._parent=null};if(t===MB)return i._current;if(t===JQ)return i;let{_current:e,_children:n}=i;if(t==="push"&&Array.isArray(e))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e[t],o=zS(i,t,s);return o!==s?(n===void 0&&(n={},i._children=n),n[t]=o,o):s},has(i,t){return t in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,t){let e=i._current,n=Reflect.getOwnPropertyDescriptor(e,t);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:e[t]}}},eJ={..._B,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}},tJ={..._B,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}},Jp=class extends Od{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[VS]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,n)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,o=zS(this,t,s);return o!==s?(n===void 0&&(n={},this._children=n),n[t]=o,o):s}add(t,e,n,r,s){this.runOp({type:7,parent:t,fi:e,id:n,data:r,children:s})}move(t,e,n){this.runOp({type:9,parent:t,fi:e,id:n})}insertAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.add(t,r[s],o.id,o.data,o.children)}}insertBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.add(t,r[s],o.id,o.data,o.children)}}moveAfter(t,e,n){let r=this._current.insertAfterHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.move(t,r[s],o)}}moveBefore(t,e,n){let r=this._current.insertBeforeHelper(t,e,n.length);for(let s=0;s<n.length;s++){let o=n[s];this.move(t,r[s],o)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},ef=class extends Od{constructor(t,e,n){super(),this._children={},this._parent=t,this._path=e,this._current=n,this[VS]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id,s=this._current[n].fi;t(this.data(this._current[n].id),r,s,n)}}find(t){let e=this.length;for(let n=0;n<e;n++){let r=this._current[n].id;if(t(this.data(r),r))return this.get(r)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:n}=this._current.at(t);return{id:e,fi:n,data:this.data(e)}}data(t){let{_current:e,_children:n}=this,r=n===void 0?void 0:n[t];if(r!==void 0)return r;let s=e.get(t)?.data,o=zS(this,t,s);return o!==s?(n===void 0&&(n={},this._children=n),n[t]=o,o):s}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,n){this.runOp({type:4,fi:t,id:e,data:n})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}insertBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.add(n[r],s.id,s.data)}}moveAfter(t,e){let n=this._current.insertAfterHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}moveBefore(t,e){let n=this._current.insertBeforeHelper(t,e.length);for(let r=0;r<e.length;r++){let s=e[r];this.move(n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};kS=class extends Od{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){NC(this.ts,e,t),NC(this.actual,n,t),NC(this.reverse,r,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}});var rr,Xy=B(()=>{"use strict";LS();UC();lu();ou();qr();(s=>{function i(o,a){if(a.length===o.length){let l=0;for(;l<o.length;){if(o[l]!==a[l])return!1;l+=1}}else return!1;return!0}s.equal=i;function t(o,a,l){let c=n(l,o);if(c!==void 0&&typeof c=="object"&&c!==null){let u={...a};return Object.keys(c).forEach(d=>{delete u[d]}),u}else return a}s.removeOverridden=t;function e(o,a){if((o instanceof Ln||o instanceof Jp)&&typeof a=="string")return o.data(a);if((o instanceof Fe||o instanceof ef)&&typeof a=="string")return o.data(a);if(typeof a=="number"&&Array.isArray(o))return o[a];if(typeof a=="string"&&typeof o=="object"&&o!==null)return o[a]}s.zoomOnce=e;function n(o,a,l=0){for(;l<a.length&&o!==void 0;)o=e(o,a[l]),l+=1;return o}s.zoom=n;function r(o,a){let l=[];function c(u,d){if(u instanceof Id&&u.id===a.id)l.push(d);else if(u instanceof Fe)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(p,[...d,h])});else if(Array.isArray(u)){if(typeof u[0]=="number")return;for(let h=0;h<u.length;h++)c(u[h],[...d,h])}else{if(co(u))return;if(typeof u=="object"&&u!==null)for(let h in u)c(u[h],[...d,h])}}return c(o,[]),l}s.findPathes=r})(rr||(rr={}))});var AB=B(()=>{"use strict"});function CB(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 PB=B(()=>{"use strict"});function GS(i){try{if(!ir.trusted&&!du){let e=hn.sharedLength||0;e<hn.length&&(hn.length=e)}let t;if(ir.randomAccessStructure&&Qe[ie]<64&&Qe[ie]>=32&&OB?(t=OB(Qe,ie,ho,ir),Qe=null,!(i&&i.lazy)&&t&&(t=t.toJSON()),ie=ho):t=Xr(),Pi&&(ie=Pi.postBundlePosition,Pi=null),du&&(hn.restoreStructures=null),ie==ho)hn&&hn.restoreStructures&&NB(),hn=null,Qe=null,$l&&($l=null);else{if(ie>ho)throw new Error("Unexpected end of MessagePack data");if(!du){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 hn&&hn.restoreStructures&&NB(),WC(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||ie>ho)&&(t.incomplete=!0),t}}function NB(){for(let i in hn.restoreStructures)hn[i]=hn.restoreStructures[i];hn.restoreStructures=null}function Xr(){let i=Qe[ie++];if(i<160)if(i<128){if(i<64)return i;{let t=hn[i&63]||ir.getStructures&&WB()[i&63];return t?(t.read||(t.read=qC(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]=Xr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(Xr(),Xr());return t}else{i-=144;let t=new Array(i);for(let e=0;e<i;e++)t[e]=Xr();return ir.freezeData?Object.freeze(t):t}else if(i<192){let t=i-160;if(Ua>=ie)return uu.slice(ie-uo,(ie+=t)-uo);if(Ua==0&&ho<140){let e=t<16?XC(t):qB(t);if(e!=null)return e}return HC(t)}else{let t;switch(i){case 192:return null;case 193:return Pi?(t=Xr(),t>0?Pi[1].slice(Pi.position1,Pi.position1+=t):Pi[0].slice(Pi.position0,Pi.position0-=t)):HB;case 194:return!1;case 195:return!0;case 196:if(t=Qe[ie++],t===void 0)throw new Error("Unexpected end of buffer");return kC(t);case 197:return t=on.getUint16(ie),ie+=2,kC(t);case 198:return t=on.getUint32(ie),ie+=4,kC(t);case 199:return Ld(Qe[ie++]);case 200:return t=on.getUint16(ie),ie+=2,Ld(t);case 201:return t=on.getUint32(ie),ie+=4,Ld(t);case 202:if(t=on.getFloat32(ie),ir.useFloat32>2){let e=ZB[(Qe[ie]&127)<<1|Qe[ie+1]>>7];return ie+=4,(e*t+(t>0?.5:-.5)>>0)/e}return ie+=4,t;case 203:return t=on.getFloat64(ie),ie+=8,t;case 204:return Qe[ie++];case 205:return t=on.getUint16(ie),ie+=2,t;case 206:return t=on.getUint32(ie),ie+=4,t;case 207:return ir.int64AsType==="number"?(t=on.getUint32(ie)*4294967296,t+=on.getUint32(ie+4)):ir.int64AsType==="string"?t=on.getBigUint64(ie).toString():ir.int64AsType==="auto"?(t=on.getBigUint64(ie),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=on.getBigUint64(ie),ie+=8,t;case 208:return on.getInt8(ie++);case 209:return t=on.getInt16(ie),ie+=2,t;case 210:return t=on.getInt32(ie),ie+=4,t;case 211:return ir.int64AsType==="number"?(t=on.getInt32(ie)*4294967296,t+=on.getUint32(ie+4)):ir.int64AsType==="string"?t=on.getBigInt64(ie).toString():ir.int64AsType==="auto"?(t=on.getBigInt64(ie),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=on.getBigInt64(ie),ie+=8,t;case 212:if(t=Qe[ie++],t==114)return zB(Qe[ie++]&63);{let e=qi[t];if(e)return e.read?(ie++,e.read(Xr())):e.noBuffer?(ie++,e()):e(Qe.subarray(ie,++ie));throw new Error("Unknown extension "+t)}case 213:return t=Qe[ie],t==114?(ie++,zB(Qe[ie++]&63,Qe[ie++])):Ld(2);case 214:return Ld(4);case 215:return Ld(8);case 216:return Ld(16);case 217:return t=Qe[ie++],Ua>=ie?uu.slice(ie-uo,(ie+=t)-uo):rJ(t);case 218:return t=on.getUint16(ie),ie+=2,Ua>=ie?uu.slice(ie-uo,(ie+=t)-uo):iJ(t);case 219:return t=on.getUint32(ie),ie+=4,Ua>=ie?uu.slice(ie-uo,(ie+=t)-uo):sJ(t);case 220:return t=on.getUint16(ie),ie+=2,FB(t);case 221:return t=on.getUint32(ie),ie+=4,FB(t);case 222:return t=on.getUint16(ie),ie+=2,UB(t);case 223:return t=on.getUint32(ie),ie+=4,UB(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 qC(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()":nJ.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(Xr)}catch{return IB=1/0,e()}return i.read0=r,i.highByte===0&&(i.read=BB(t,i.read)),r()}let n={};for(let r=0,s=i.length;r<s;r++){let o=i[r];o==="__proto__"&&(o="__proto_"),n[o]=Xr()}return ir.freezeData?Object.freeze(n):n}return e.count=0,i.read0=e,i.highByte===0?BB(t,e):e}function WB(){let i=$B(()=>(Qe=null,ir.getStructures()));return hn=ir._mergeStructures(i,hn)}function $y(i){let t;if(i<16&&(t=XC(i)))return t;if(i>64&&VC)return VC.decode(Qe.subarray(ie,ie+=i));let e=ie+i,n=[];for(t="";ie<e;){let r=Qe[ie++];if((r&128)===0)n.push(r);else if((r&224)===192){let s=Qe[ie++]&63,o=(r&31)<<6|s;o<128?n.push(65533):n.push(o)}else if((r&240)===224){let s=Qe[ie++]&63,o=Qe[ie++]&63,a=(r&31)<<12|s<<6|o;a<2048||a>=55296&&a<=57343?n.push(65533):n.push(a)}else if((r&248)===240){let s=Qe[ie++]&63,o=Qe[ie++]&63,a=Qe[ie++]&63,l=(r&7)<<18|s<<12|o<<6|a;l<65536||l>1114111?n.push(65533):(l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|l&1023),n.push(l))}else n.push(65533);n.length>=4096&&(t+=Ci.apply(String,n),n.length=0)}return n.length>0&&(t+=Ci.apply(String,n)),t}function FB(i){let t=new Array(i);for(let e=0;e<i;e++)t[e]=Xr();return ir.freezeData?Object.freeze(t):t}function UB(i){if(ir.mapsAsObjects){let t={};for(let e=0;e<i;e++){let n=XB();n==="__proto__"&&(n="__proto_"),t[n]=Xr()}return t}else{let t=new Map;for(let e=0;e<i;e++)t.set(Xr(),Xr());return t}}function qB(i){let t=ie,e=new Array(i);for(let n=0;n<i;n++){let r=Qe[ie++];if((r&128)>0){ie=t;return}e[n]=r}return Ci.apply(String,e)}function XC(i){if(i<4)if(i<2){if(i===0)return"";{let t=Qe[ie++];if((t&128)>1){ie-=1;return}return Ci(t)}}else{let t=Qe[ie++],e=Qe[ie++];if((t&128)>0||(e&128)>0){ie-=2;return}if(i<3)return Ci(t,e);let n=Qe[ie++];if((n&128)>0){ie-=3;return}return Ci(t,e,n)}else{let t=Qe[ie++],e=Qe[ie++],n=Qe[ie++],r=Qe[ie++];if((t&128)>0||(e&128)>0||(n&128)>0||(r&128)>0){ie-=4;return}if(i<6){if(i===4)return Ci(t,e,n,r);{let s=Qe[ie++];if((s&128)>0){ie-=5;return}return Ci(t,e,n,r,s)}}else if(i<8){let s=Qe[ie++],o=Qe[ie++];if((s&128)>0||(o&128)>0){ie-=6;return}if(i<7)return Ci(t,e,n,r,s,o);let a=Qe[ie++];if((a&128)>0){ie-=7;return}return Ci(t,e,n,r,s,o,a)}else{let s=Qe[ie++],o=Qe[ie++],a=Qe[ie++],l=Qe[ie++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){ie-=8;return}if(i<10){if(i===8)return Ci(t,e,n,r,s,o,a,l);{let c=Qe[ie++];if((c&128)>0){ie-=9;return}return Ci(t,e,n,r,s,o,a,l,c)}}else if(i<12){let c=Qe[ie++],u=Qe[ie++];if((c&128)>0||(u&128)>0){ie-=10;return}if(i<11)return Ci(t,e,n,r,s,o,a,l,c,u);let d=Qe[ie++];if((d&128)>0){ie-=11;return}return Ci(t,e,n,r,s,o,a,l,c,u,d)}else{let c=Qe[ie++],u=Qe[ie++],d=Qe[ie++],h=Qe[ie++];if((c&128)>0||(u&128)>0||(d&128)>0||(h&128)>0){ie-=12;return}if(i<14){if(i===12)return Ci(t,e,n,r,s,o,a,l,c,u,d,h);{let p=Qe[ie++];if((p&128)>0){ie-=13;return}return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p)}}else{let p=Qe[ie++],f=Qe[ie++];if((p&128)>0||(f&128)>0){ie-=14;return}if(i<15)return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p,f);let m=Qe[ie++];if((m&128)>0){ie-=15;return}return Ci(t,e,n,r,s,o,a,l,c,u,d,h,p,f,m)}}}}}function kB(){let i=Qe[ie++],t;if(i<192)t=i-160;else switch(i){case 217:t=Qe[ie++];break;case 218:t=on.getUint16(ie),ie+=2;break;case 219:t=on.getUint32(ie),ie+=4;break;default:throw new Error("Expected string")}return $y(t)}function kC(i){return ir.copyBuffers?Uint8Array.prototype.slice.call(Qe,ie,ie+=i):Qe.subarray(ie,ie+=i)}function Ld(i){let t=Qe[ie++];if(qi[t]){let e;return qi[t](Qe.subarray(ie,e=ie+=i),n=>{ie=n;try{return Xr()}finally{ie=e}})}else throw new Error("Unknown extension type "+t)}function XB(){let i=Qe[ie++];if(i>=160&&i<192){if(i=i-160,Ua>=ie)return uu.slice(ie-uo,(ie+=i)-uo);if(!(Ua==0&&ho<180))return HC(i)}else return ie--,YB(Xr());let t=(i<<5^(i>1?on.getUint16(ie):i>0?Qe[ie]:0))&4095,e=VB[t],n=ie,r=ie+i-3,s,o=0;if(e&&e.bytes==i){for(;n<r;){if(s=on.getUint32(n),s!=e[o++]){n=1879048192;break}n+=4}for(r+=3;n<r;)if(s=Qe[n++],s!=e[o++]){n=1879048192;break}if(n===r)return ie=n,e.string;r-=3,n=ie}for(e=[],VB[t]=e,e.bytes=i;n<r;)s=on.getUint32(n),e.push(s),n+=4;for(r+=3;n<r;)s=Qe[n++],e.push(s);let a=i<16?XC(i):qB(i);return a!=null?e.string=a:e.string=HC(i)}function YB(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 $B(i){LB&&LB();let t=ho,e=ie,n=GC,r=uo,s=Ua,o=uu,a=zC,l=$l,c=Pi,u=new Uint8Array(Qe.slice(0,ho)),d=hn,h=hn.slice(0,hn.length),p=ir,f=du,m=i();return ho=t,ie=e,GC=n,uo=r,Ua=s,uu=o,zC=a,$l=l,Pi=c,Qe=u,du=f,hn=d,hn.splice(0,hn.length,...h),ir=p,on=new DataView(Qe.buffer,Qe.byteOffset,Qe.byteLength),m}function WC(){Qe=null,$l=null,hn=null}function KB(i){i.unpack?qi[i.type]=i.unpack:qi[i.type]=i}var VC,Qe,ho,ie,jB,zC,GC,ir,hn,uu,uo,Ua,Pi,$l,qi,on,RB,jC,HB,du,IB,OB,DB,LB,hu,nJ,BB,HC,rJ,iJ,sJ,Ci,VB,zB,GB,oJ,aJ,lJ,ZB,jS,hge,pge,fge,cJ,mge,QB=B(()=>{try{VC=new TextDecoder}catch{}ie=0,jB=[],zC=jB,GC=0,ir={},uo=0,Ua=0,qi=[],RB={useRecords:!1,mapsAsObjects:!0},jC=class{},HB=new jC;HB.name="MessagePack 0xC1";du=!1,IB=2,hu=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(Qe)return $B(()=>(WC(),this?this.unpack(t,e):hu.prototype.unpack.call(RB,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(ho=e.end||t.length,ie=e.start||0):(ie=0,ho=e>-1?e:t.length),GC=0,Ua=0,uu=null,zC=jB,Pi=null,Qe=t;try{on=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw Qe=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 hu){if(ir=this,this.structures)return hn=this.structures,GS(e);(!hn||hn.length>0)&&(hn=[])}else ir=RB,(!hn||hn.length>0)&&(hn=[]);return GS(e)}unpackMultiple(t,e){let n,r=0;try{du=!0;let s=t.length,o=this?this.unpack(t,s):jS.unpack(t,s);if(e){if(e(o,r,ie)===!1)return;for(;ie<s;)if(r=ie,e(GS(),r,ie)===!1)return}else{for(n=[o];ie<s;)r=ie,n.push(GS());return n}}catch(s){throw s.lastPosition=r,s.values=n,s}finally{du=!1,WC()}}_mergeStructures(t,e){DB&&(t=DB.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)}};nJ=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;BB=(i,t)=>function(){let e=Qe[ie++];if(e===0)return t();let n=i<32?-(i+(e<<5)):i+(e<<5),r=hn[n]||WB()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=qC(r,i)),r.read()};HC=$y,rJ=$y,iJ=$y,sJ=$y;Ci=String.fromCharCode;VB=new Array(4096);zB=(i,t)=>{let e=Xr().map(YB),n=i;t!==void 0&&(i=i<32?-((t<<5)+i):(t<<5)+i,e.highByte=t);let r=hn[i];return r&&(r.isShared||du)&&((hn.restoreStructures||(hn.restoreStructures=[]))[i]=r),hn[i]=e,e.read=qC(e,n),(e.read0||e.read)()};qi[0]=()=>{};qi[0].noBuffer=!0;qi[66]=i=>{let t=i.byteLength%8||8,e=BigInt(i[0]&128?i[0]-256:i[0]);for(let n=1;n<t;n++)e<<=BigInt(8),e+=BigInt(i[n]);if(i.byteLength!==t){let n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=(s,o)=>{let a=o-s;if(a<=40){let d=n.getBigUint64(s);for(let h=s+8;h<o;h+=8)d<<=BigInt(64),d|=n.getBigUint64(h);return d}let l=s+(a>>4<<3),c=r(s,l),u=r(l,o);return c<<BigInt((o-l)*8)|u};e=e<<BigInt((n.byteLength-t)*8)|r(t,n.byteLength)}return e};GB={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};qi[101]=()=>{let i=Xr();if(!GB[i[0]]){let t=Error(i[1],{cause:i[2]});return t.name=i[0],t}return GB[i[0]](i[1],{cause:i[2]})};qi[105]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=on.getUint32(ie-4);$l||($l=new Map);let e=Qe[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)&&Qe[ie+1]===115?n=new Set:n={};let r={target:n};$l.set(t,r);let s=Xr();if(r.used)Object.assign(n,s);else return r.target=s;if(n instanceof Map)for(let[o,a]of s.entries())n.set(o,a);if(n instanceof Set)for(let o of Array.from(s))n.add(o);return n};qi[112]=i=>{if(ir.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=on.getUint32(ie-4),e=$l.get(t);return e.used=!0,e.target};qi[115]=()=>new Set(Xr());oJ=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array"),aJ=typeof globalThis=="object"?globalThis:window;qi[116]=i=>{let t=i[0],e=Uint8Array.prototype.slice.call(i,1).buffer,n=oJ[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 aJ[n](e)};qi[120]=()=>{let i=Xr();return new RegExp(i[0],i[1])};lJ=[];qi[98]=i=>{let t=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],e=ie;return ie+=t-i.length,Pi=lJ,Pi=[kB(),kB()],Pi.position0=0,Pi.position1=0,Pi.postBundlePosition=ie,ie=e,Xr()};qi[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");ZB=new Array(147);for(let i=0;i<256;i++)ZB[i]=+("1e"+Math.floor(45.15-i*.30103));jS=new hu({useRecords:!1}),hge=jS.unpack,pge=jS.unpackMultiple,fge=jS.unpack,cJ=new Float32Array(1),mge=new Uint8Array(cJ.buffer,0,4)});var uJ,dJ,HS,JB=B(()=>{"use strict";QB();LS();qy();lu();Hy();ou();uJ=[{Class:st.prototype.constructor,type:1,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,st.prototype),i}},{Class:Fe.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Fe.prototype),i}},{Class:Ln.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Ln.prototype),i}},{Class:Id.prototype.constructor,type:4,write(i){return i.id},read(i){return new Id(i)}},{Class:jy.prototype.constructor,type:5,write(i){return i.data},read(i){return new jy(i)}},{Class:_n.prototype.constructor,type:6,write(i){return{...i}},read(i){return Object.setPrototypeOf(i,_n.prototype),i}}];for(let i of uJ)KB(i);dJ=new hu({structuredClone:!0});(t=>{function i(e){return dJ.unpack(e)}t.deserialize=i})(HS||(HS={}))});var eF,Nd,tF=B(()=>{"use strict";JB();eF=i=>()=>{throw new Error(i+" is not available in the runtime build (decode-only CollabSerialize)")},Nd={deserialize:HS.deserialize,serialize:eF("CollabSerialize.serialize"),checksum:eF("CollabSerialize.checksum")}});var an=B(()=>{Xy();yB();NS();ou();Hy();BS();lu();EB();AB();UC();PB();LS();tF();OC();qy()});function Ky(i){return i==="MouseDown"||i==="MouseUp"||i==="KeyDown"||i==="KeyUp"||i==="Collision"||i==="Trigger"}var nF,$C,tf,WS,YC,rF,iF,sF,qS,XS,oF,aF,lF,cF,uF,YS,$S,dF,hF,pF,fF,KC=B(()=>{"use strict";an();q();(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})(nF||(nF={}));$C={["LookAt"]:[],["Follow"]:["Create"],["DragDrop"]:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseHover"]:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Scroll"]:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Start"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Conditional"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MouseUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["MousePress"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyDown"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyUp"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["KeyPress"]:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["GameControl"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],["Collision"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Trigger"]:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["Resize"]:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["VariableChange"]:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["API"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["WEBHOOK"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],["AIAssistantListener"]:["SetVariable"],["AIAssistantTrigger"]:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(e=>{function i(n){return n.type==="MouseDown"||n.type==="MouseUp"||n.type==="MousePress"||n.type==="KeyDown"||n.type==="KeyUp"||n.type==="KeyPress"}e.is=i;function t(n){return n==="MouseDown"||n==="MouseUp"||n==="MousePress"?{type:n,mode:"Object",disabled:!1,name:"",actions:new Fe}:{type:n,disabled:!1,name:"",key:void 0,actions:new Fe}}e.defaultData=t})(tf||(tf={}));(e=>{function i(n){return{type:"Property",value:[n??null,"position","x"]}}e.propertyDefaultData=i,e.valueDefaultData={type:"Literal",value:0}})(WS||(WS={}));(n=>{function i(r){return{type:"Comparison",operator:"==",lOperand:WS.propertyDefaultData(r),rOperand:{...WS.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})(YC||(YC={}));(t=>{function i(e){return e.find(n=>n==="ifActions"||n==="elseActions")!==void 0}t.isConditionalSubActions=i})(rF||(rF={}));(e=>{function i(n){return n.type==="Conditional"}e.is=i;function t(n){return{type:"Conditional",disabled:!1,name:"",inActions:new Fe,outActions:new Fe,condition:YC.distanceDefaultData(n)}}e.defaultData=t})(iF||(iF={}));(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 Fe,drop:new Fe}})(sF||(sF={}));(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 Fe})(qS||(qS={}));(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})(XS||(XS={}));(e=>{function i(n){return n.type==="MouseHover"}e.is=i;function t(){return{type:"MouseHover",disabled:!1,name:"",actions:new Fe}}e.defaultData=t})(oF||(oF={}));(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 Fe}}e.defaultData=t})(aF||(aF={}));(e=>{function i(n){return n.type==="Start"}e.is=i;function t(){return{type:"Start",disabled:!1,name:"",actions:new Fe}}e.defaultData=t})(lF||(lF={}));(e=>{function i(n){return n.type==="Collision"}e.is=i;function t(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Fe}}e.defaultData=t})(cF||(cF={}));(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 Fe,triggerZone:"box",position:r.toArray(),rotation:[0,0,0],size:n.toArray(),radius:n.length()/2,helperVisible:!0}}e.defaultData=t})(uF||(uF={}));(o=>{o.defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]};function t(a){return a.type==="Resize"}o.is=t;function e(a){return typeof a=="string"?a:"custom"}o.sizeToDevice=e;function n(a){return typeof a=="string"?[...o.defaultSizes[a]]:[...a]}o.deviceToSize=n;function r(){let a={size:"mobile",operator:"<",actions:new Fe},l={size:"tablet",operator:"<",actions:new Fe},c={size:[...o.defaultSizes.custom],operator:"<>",actions:new Fe},u=new Fe;return u.push({id:ge.generateUUID(),fi:0,data:a},{id:ge.generateUUID(),fi:1,data:l},{id:ge.generateUUID(),fi:2,data:c}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:u}}o.defaultData=r;function s(){return{size:[...o.defaultSizes.custom],operator:"<>",actions:new Fe}}o.defaultBreakpointData=s})(YS||(YS={}));(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 Fe,variableId:"",objectId:null,property:"Position X"}}n.defaultData=e})($S||($S={}));(e=>{function i(n){return n.type==="API"}e.is=i;function t(){return{disabled:!1,type:"API",name:"",successActions:new Fe,errorActions:new Fe,userAPIId:""}}e.defaultData=t})(dF||(dF={}));(e=>{function i(n){return n.type==="WEBHOOK"}e.is=i;function t(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Fe,userWebhookId:""}}e.defaultData=t})(hF||(hF={}));(e=>{function i(n){return n.type==="AIAssistantListener"}e.is=i;function t(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Fe,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=t})(pF||(pF={}));(e=>{function i(n){return n.type==="AIAssistantTrigger"}e.is=i;function t(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Fe}}e.defaultData=t})(fF||(fF={}))});function yF(i){let t=typeof i;return i!==null&&(t==="object"||t==="function")}function ZC(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 fo,fu,vF,Er,ZS,Ws,po,Bd,mF,pu,yr,Vt,KS,Fd,ea,Kl,gF,Ts=B(()=>{"use strict";fo="personal camera",fu="a218fcc3-276b-49b9-b485-49037fd14f5f",vF=2500134,Er=5526619,ZS=(n=>(n.x="x",n.y="y",n.z="z",n))(ZS||{});(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 o(f,m){return Math.pow(m[0]-f[0],2)+Math.pow(m[1]-f[1],2)}p.distanceSquared=o;function a(f,m){return Math.sqrt(o(f,m))}p.distance=a;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 a(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})(Ws||(Ws={}));(a=>{function i(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]}a.isEqual=i;function t(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]}a.add=t;function e(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]}a.sub=e;function n(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]}a.div=n;function r(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]}a.mul=r;function s(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])}a.dist=s;function o(l,c,u){return[l[0]+(c[0]-l[0])*u,l[1]+(c[1]-l[1])*u,l[2]+(c[2]-l[2])*u]}a.lerp=o})(po||(po={}));(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})(Bd||(Bd={}));(o=>{let i=180/Math.PI,t=Math.PI/180;function e(a){return typeof a=="number"?a*i:a}function n(a){return typeof a=="number"?a*t:a}function r(a){return[e(a[0]),e(a[1]),e(a[2])]}o.radToDeg=r;function s(a){return[n(a[0]),n(a[1]),n(a[2])]}o.degToRad=s})(mF||(mF={}));(r=>{r.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(s,o){for(let a=0;a<16;a++)if(s[a]!==o[a])return!1;return!0}r.isEqual=t;function e(s){return s??r.identity}r.simplify=e;function n(s,o){let a=o.slice(0);for(let l=0,c=o.length;l<c;l+=3){let u=s[3]*o[l]+s[7]*o[l+1]+s[11]*o[l+2]+s[15];a[l]=(s[0]*o[l]+s[4]*o[l+1]+s[8]*o[l+2]+s[12])/u,a[l+1]=(s[1]*o[l]+s[5]*o[l+1]+s[9]*o[l+2]+s[13])/u,a[l+2]=(s[2]*o[l]+s[6]*o[l+1]+s[10]*o[l+2]+s[14])/u}return a}r.applyMatrix4=n})(pu||(pu={}));(h=>{function i(p){return typeof p=="object"&&typeof p.r=="number"&&typeof p.g=="number"&&typeof p.b=="number"}h.isRGB=i,h.white={r:1,g:1,b:1},h.red={r:1,g:0,b:0},h.black={r:0,g:0,b:0};function r(p){return{r:Math.round(p.r*255),g:Math.round(p.g*255),b:Math.round(p.b*255),a:1}}h.toRgb255a1=r;function s(p){return{r:p.r,g:p.g,b:p.b}}h.clone=s;function o(p){return p=Math.floor(p),{r:(p>>16&255)/255,g:(p>>8&255)/255,b:(p&255)/255}}h.fromHex=o;function a(p){return Math.round(p.r*255)*65536+Math.round(p.g*255)*256+Math.round(p.b*255)}h.toHex=a;function l(p,f){return p.r===f.r&&p.g===f.g&&p.b===f.b}h.equals=l;function c(p,f){return p.r.toFixed(2)===f.r.toFixed(2)&&p.g.toFixed(2)===f.g.toFixed(2)&&p.b.toFixed(2)===f.b.toFixed(2)}h.equalsFixed=c;function u(p,f,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 yF(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 yF(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 o(d,h){return yr.equals(d,h)&&d.a===h.a}u.equals=o;function a(d,h){return yr.equalsFixed(d,h)&&d.a.toFixed(2)===h.a.toFixed(2)}u.equalsFixed=a;function l(d,h,p){return{r:d.r+(h.r-d.r)*p,g:d.g+(h.g-d.g)*p,b:d.b+(h.b-d.b)*p,a:d.a+(h.a-d.a)*p}}u.lerp=l;function c({r:d,g:h,b:p,a:f}=u.white){return`rgba(${d*255}, ${h*255}, ${p*255}, ${f})`}u.toStyle=c})(Vt||(Vt={}));(t=>t.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]})(KS||(KS={}));Fd=(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))(Fd||{});(t=>t.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(ea||(ea={}));(t=>t.defaultData={control1:[.5,0],control2:[.5,1]})(Kl||(Kl={}));(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]))(gF||(gF={}))});var bF,xF,SF,wF,EF,TF,MF,QC,_F,AF,JC,CF,PF,RF,eP,IF,tP,OF,DF,nP,LF,QS,NF,BF,FF,UF,kF,VF=B(()=>{"use strict";an();KC();(t=>t.defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"})(bF||(bF={}));(t=>t.defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"})(xF||(xF={}));(t=>t.defaultData={type:"Link",name:"",url:null,context:"tab"})(SF||(SF={}));(t=>t.defaultData={type:"Destroy",name:"",objects:[],delay:0})(wF||(wF={}));(t=>t.defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"})(EF||(EF={}));(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"})(TF||(TF={}));(t=>t.defaultData={type:"Reset",name:"",delay:0})(MF||(MF={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1})(QC||(QC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(_F||(_F={}));(s=>(s.defaultData={type:"Audio",name:"",...QC.defaultData},s.hasAudioByActions=o=>o.some(({data:a})=>a.type==="Audio"&&a.interaction==="play"&&a.audio),s.hasAudioByEvents=o=>s.getAudiosByEvents(o).length>0,s.getAudiosByActions=o=>{let a=[];return o.forEach(l=>{let c=l.data;c.type==="Audio"&&c.interaction==="play"&&c.audio&&a.push(l),c.type==="Conditional"&&(a.push(...s.getAudiosByActions(c.ifActions)),a.push(...s.getAudiosByActions(c.elseActions)))}),a},s.getAudiosByEvents=o=>{let a=[];return o.forEach(({data:l})=>{tf.is(l)||l.type==="Collision"||l.type==="Start"||l.type==="Trigger"||l.type==="VariableChange"||l.type==="WEBHOOK"||l.type==="AIAssistantTrigger"?a.push(...s.getAudiosByActions(l.actions)):l.type==="Conditional"?(a.push(...s.getAudiosByActions(l.inActions)),a.push(...s.getAudiosByActions(l.outActions))):l.type==="GameControl"?Object.values(l.gameActions).forEach(c=>{a.push(...s.getAudiosByActions(c))}):l.type==="DragDrop"?(a.push(...s.getAudiosByActions(l.dragDropActions.drag)),a.push(...s.getAudiosByActions(l.dragDropActions.drop))):l.type==="Resize"?l.breakpoints.forEach(({data:c})=>{a.push(...s.getAudiosByActions(c.actions))}):l.type==="API"&&(a.push(...s.getAudiosByActions(l.successActions)),a.push(...s.getAudiosByActions(l.errorActions)))}),a}))(AF||(AF={}));(t=>t.defaultData={interaction:"play",delay:0,volume:.5,loop:1/0})(JC||(JC={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(CF||(CF={}));(s=>(s.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...JC.defaultData},s.hasVideoByActions=o=>o.some(({data:a})=>a.type==="Video"&&a.interaction==="play"&&a.layerId),s.hasVideoByObject=o=>{if(o.events){for(let{data:a}of o.events)if((tf.is(a)||a.type==="Start")&&s.hasVideoByActions(a.actions))return!0}},s.getVideosByActions=o=>{let a=[];return o.forEach(l=>{let c=l.data;c.type==="Video"&&c.interaction==="play"&&c.layerId&&a.push(l)}),a},s.getVideosByEvents=o=>{let a=[];return o.forEach(({data:l})=>{(tf.is(l)||l.type==="Start")&&a.push(...s.getVideosByActions(l.actions))}),a}))(PF||(PF={}));(t=>{function i(e){return{state:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}}t.defaultData=i})(RF||(RF={}));(t=>{function i(){return{tweens:new Fe,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}}t.defaultData=i})(eP||(eP={}));(t=>{function i(e){return{type:"Transition",name:"",runMode:"Once",object:e??null,...eP.defaultData()}}t.defaultData=i})(IF||(IF={}));(t=>{function i(e){return{interaction:"play",timeline:e,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}}t.defaultData=i})(tP||(tP={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(OF||(OF={}));(t=>{function i(e){return{type:"TimelineAnimation",name:"",...tP.defaultData(e)}}t.defaultData=i})(DF||(DF={}));(t=>{function i(e,n,r){return{interaction:"play",object:e,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}}t.defaultData=i})(nP||(nP={}));(e=>(e.pauseDefaultData={interaction:"pause",delay:0},e.stopDefaultData={interaction:"stop",delay:0}))(LF||(LF={}));(e=>{function i(n,r,s){return{type:"Animation",name:"",...nP.defaultData(n,r,s)}}e.defaultData=i;function t(n){return n.interaction==="pause"||n.interaction==="stop"}e.isPause=t})(QS||(QS={}));(t=>t.defaultData={type:"SetVariable",name:"",variableId:"",expression:[]})(NF||(NF={}));(t=>t.defaultData=()=>({type:"Conditional",name:"",ifActions:new Fe,elseActions:new Fe,condition:[]}))(BF||(BF={}));(t=>t.defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0})(FF||(FF={}));(t=>t.defaultData={type:"ClearLocalStorage",name:"",target:"all"})(UF||(UF={}));(t=>t.defaultData={name:"",type:"UserAPI"})(kF||(kF={}))});var zF,GF=B(()=>{"use strict";(e=>(e.emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),n=>n.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},e.maxSize=2e6))(zF||(zF={}))});var ta,na,rP=B(()=>{"use strict";(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(n){return e.all.includes(n)}e.is=t})(ta||(ta={}));(p=>{p.DefaultUp=[0,1,0],p.DefaultTargetOffset=1e3,p.MinTargetOffset=.001;function n(f){return f===void 0||!Number.isFinite(f)||f<p.MinTargetOffset?p.DefaultTargetOffset:f}p.sanitizeTargetOffset=n,p.DefaultAzimuth=-24,p.DefaultElevation=15;let o=p.DefaultAzimuth*Math.PI/180,a=p.DefaultElevation*Math.PI/180,l=180/Math.PI;p.DefaultPosition=[p.DefaultTargetOffset*Math.sin(o)*Math.cos(a),p.DefaultTargetOffset*Math.sin(a),p.DefaultTargetOffset*Math.cos(o)*Math.cos(a)],p.DefaultRotation=[Math.atan2(-Math.sin(a),Math.cos(o)*Math.cos(a))*l,Math.asin(Math.sin(o)*Math.cos(a))*l,Math.atan2(Math.sin(o)*Math.sin(a),Math.cos(o))*l],p.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:p.DefaultUp,isUpVectorFlipped:!1,targetOffset:p.DefaultTargetOffset};function h(f){return f.type==="PerspectiveCamera"?f.perspective?.zoom??1:f.orthographic?.zoom??1}p.getZoom=h})(na||(na={}))});var ka,JS,iP,e1,t1,n1,r1,i1,sP=B(()=>{"use strict";(n=>{function i(r,s=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:Math.max(typeof r[0]=="number"?r[0]:1,typeof r[1]=="number"?r[1]:1)*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof r[0]=="number"?r[0]+r[0]:1)*s,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:r.map(o=>(typeof o=="number"?o:1)*(1+s)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}}n.defaultData=i;function t(r,s){let o={...r};if(iP.forEach(a=>{Object.assign(o,{[a]:s[a]??r[a]})}),o.radial={...r.radial},s.radial){let a=r.radial,l=s.radial;e1.forEach(c=>{Object.assign(o.radial,{[c]:l[c]??a[c]})})}if(o.linear={...r.linear},s.linear){let a=r.linear,l=s.linear;t1.forEach(c=>{Object.assign(o.linear,{[c]:l[c]??a[c]})})}if(o.grid={...r.grid},s.grid){let a=r.grid,l=s.grid;n1.forEach(c=>{Object.assign(o.grid,{[c]:l[c]??a[c]})})}if(o.toObject={...r.toObject},s.toObject){let a=r.toObject,l=s.toObject;r1.forEach(c=>{Object.assign(o.toObject,{[c]:l[c]??a[c]})})}if(o.randomnessObject={...r.randomnessObject},s.randomnessObject){let a=r.randomnessObject,l=s.randomnessObject;i1.forEach(c=>{Object.assign(o.randomnessObject,{[c]:l[c]??a[c]})})}return o}n.merge=t;function e(r){return!!(r.randomnessObject||r.toObject)}n.isPartial=e})(ka||(ka={}));(n=>{n.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function e(r,s){let o=[];r.count!==void 0&&o.push({type:0,path:s,props:{count:r.count}});for(let a of t){let l=r[a];l&&Object.keys(l).length>0&&o.push({type:0,path:[...s,a],props:l})}return o}n.toOps=e})(JS||(JS={}));iP=["count"],e1=["radius","start","end","position","scale","rotation"],t1=["position","scale","rotation"],n1=["count","size"],r1=["count","position","scale","rotation"],i1=["strength","scale","rotation","position","movement","seed","freqScale"]});var s1,o1,oP=B(()=>{"use strict";Ts();(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(n){return e.all.includes(n)}e.is=t})(s1||(s1={}));(e=>{function i(n){return t(n)}e.defaultData=i;function t(n){if(n==="PointLight")return{type:n,color:Vt.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(n==="SpotLight")return{type:n,color:Vt.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(n==="DirectionalLight")return{type:n,color:Vt.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(o1||(o1={}))});var nf,aP=B(()=>{"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}))(nf||(nf={}))});var a1,lP=B(()=>{"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"]))(a1||(a1={}))});var mu,l1=B(()=>{"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]})(mu||(mu={}))});var u1,cP,uP,c1,jF,dP=B(()=>{"use strict";u1=(n=>(n[n.Front=0]="Front",n[n.Back=1]="Back",n[n.Double=2]="Double",n))(u1||{});(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(n,r){return n.castShadow===r.castShadow&&n.receiveShadow===r.receiveShadow}e.equals=t})(cP||(cP={}));(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})(uP||(uP={}));(t=>t.defaultData={...uP.defaultData,...cP.defaultData})(c1||(c1={}));(t=>{function i(e,n){let r=[];if("material"in e){let s=typeof e.material=="string"?n.materials[e.material]??n.lib.materials[e.material]?.asset:e.material;s&&r.push(s)}else if("materials"in e)for(let s of e.materials){let o=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;o&&r.push(o)}return r}t.getMaterialData=i})(jF||(jF={}))});var rf,hP=B(()=>{"use strict";(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(rf||(rf={}))});function XF(i){return i.type!=="displace"}var HF,WF,Zy,qF,d1,Ud,Qy,pP,fP,h1,mP,gP,sf,p1,Qn,An,of=B(()=>{"use strict";an();Ts();hP();Ts();(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})(HF||(HF={}));(t=>{function i(e){return e==="luminance"||e==="r"||e==="g"||e==="b"||e==="a"}t.is=i})(WF||(WF={}));(t=>{function i(e){return typeof e=="object"&&e!==null&&e.image!=null}t.is=i})(Zy||(Zy={}));(t=>{function i(e){return e==="phong"||e==="toon"||e==="lambert"||e==="physical"}t.is=i})(qF||(qF={}));d1=(n=>(n[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",n))(d1||{}),Ud=(n=>(n[n.RepeatWrapping=1e3]="RepeatWrapping",n[n.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",n[n.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",n))(Ud||{}),Qy=(n=>(n[n.NearestFilter=1003]="NearestFilter",n[n.LinearFilter=1006]="LinearFilter",n[n.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",n))(Qy||{}),pP=(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))(pP||{}),fP=(o=>(o[o.Simplex=0]="Simplex",o[o.SimplexFractal=1]="SimplexFractal",o[o.Ashima=2]="Ashima",o[o.Fbm=3]="Fbm",o[o.Perlin=4]="Perlin",o[o.Voronoi=5]="Voronoi",o))(fP||{}),h1=(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))(h1||{}),mP=(n=>(n[n.Lights=0]="Lights",n[n.Static=1]="Static",n[n.Camera=2]="Camera",n))(mP||{}),gP=(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))(gP||{}),sf=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],p1=["wrapping","image","video","name","minFilter","magFilter"];(s=>{function i(o,a){let{texture:l,...c}=a;if(Object.assign(o,c),l){let u=o.texture;u&&Object.assign(u,l)}}s.patch=i;function t(o){return{...s.defaultData("color"),color:o}}s.defaultColorLayer=t;function e(o,a){return o==="light"&&a?n(a):r(o)}s.defaultData=e;function n(o){let a={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(o){case"phong":return{...a,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...a,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...a,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...a,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}function r(o){let a={alpha:1,mode:0,isMask:!1,visible:!0};switch(o){case"texture":return{...a,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...a,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:rf.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...a,type:"color",color:yr.fromHex(Er)};case"vertexColor":return{...a,type:"vertexColor"};case"depth":return{...a,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...a,type:"normal",cnormal:[1,1,1]};case"gradient":return{...a,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...a,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...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{...a,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...a,type:"fresnel",color:Vt.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...a,type:"dust",color:Vt.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...a,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...a,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Vt.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...a,type:"outline",outlineColor:Vt.fromHexAndA(0,1),contourColor:Vt.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...a,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...a,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...a,type:"reflection",blur:0,thickness:10/1e4,steps:60,stepSize:5/1e3,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...a,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...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 Fe}}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 Fe;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 o(d,h,p="layer1",f="layer2"){let m=new Fe;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=o;function a(d){let h=Qn.defaultData("texture");d&&Object.assign(h.texture,{image:d});let p=new Fe;return p.push({fi:0,data:h,id:"layer1"}),p.push({fi:1,data:{...Qn.defaultData("transmission"),alpha:1},id:"layer2"}),p.push({fi:2,data:{...Qn.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:p}}u.defaultUIObjectMaterial=a;function l(d,h="physical",p="layer1",f="layer2"){let m=Qn.defaultData("texture");Object.assign(m.texture,{image:d});let g=new Fe;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 Fe;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 kd,yP,YF=B(()=>{"use strict";kd="Roboto_regular",yP="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"});var $F=B(()=>{"use strict";YF()});var Vd,vP=B(()=>{"use strict";an();(t=>{function i(){return{points:new Fe,roundness:0,shapeHoles:[],isClosed:!1}}t.defaultData=i})(Vd||(Vd={}))});var af,zd,f1,m1,Jy,bP=B(()=>{"use strict";an();(t=>{function i(){return{points:new Fe,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}t.defaultData=i})(af||(af={}));zd={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(t=>{function i(e,n){let r={...e};return Jy.forEach(s=>{Object.assign(r,{[s]:n[s]??e[s]})}),r}t.merge=i})(f1||(f1={}));m1={shape:zd,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},Jy=["depth","offset","angle","twist","startScale","endScale"]});var ev,g1,mo,y1,v1=B(()=>{"use strict";vP();bP();(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})(ev||(ev={}));(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,f1.merge(r.extrusion,n.extrusion))),r}t.merge=i})(g1||(g1={}));(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:af.defaultData(),extrusion:m1};if(e==="VectorGeometry")return{width:1,height:1,type:e,subdivisions:12,shape:Vd.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,projection:"all",projectionTargets:[]};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})(mo||(mo={}));y1=["width","height","depth"]});var Fr,xP=B(()=>{"use strict";Ts();(o=>{o.defaultData={enabled:!1,useBackgroundColor:!1,color:yr.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0};function t(a){return a.mode??"linear"}o.getMode=t;function e(a){let l=t(a);return l==="height"?1:l==="both"?2:0}o.getModeIndex=e;function n(a){return a.density??o.defaultData.density}o.getDensity=n;function r(a){return a.heightFalloff??o.defaultData.heightFalloff}o.getHeightFalloff=r;function s(a){return a.heightBase??o.defaultData.heightBase}o.getHeightBase=s})(Fr||(Fr={}))});var SP,Va,b1=B(()=>{"use strict";(t=>t.defaultData={image:null,rotation:0,blur:32,showBackground:!0})(SP||(SP={}));(t=>t.defaultData={enabled:!1,mode:"hdri",hdri:SP.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2})(Va||(Va={}))});var lf,wP=B(()=>{"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}}})(lf||(lf={}))});var Gd,EP,TP,MP,gu,_P,x1,S1=B(()=>{"use strict";xP();b1();wP();Ts();(e=>{e.defaultData={type:"normal",softShadowQuality:"low"};function t(n){return n==null?!1:n.type===void 0||n.type==="soft"}e.isSoft=t})(Gd||(Gd={}));(t=>t.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(EP||(EP={}));(t=>t.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(TP||(TP={}));(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})(MP||(MP={}));(t=>t.defaultData={usePhysics:!1,gravity:-10})(gu||(gu={}));(t=>t.defaultData={playCamera:fo,gameControlObject:null})(_P||(_P={}));(t=>t.defaultData={backgroundColor:Vt.fromHexAndA(vF,1),postprocessing:lf.defaultData,fog:Fr.defaultData,sky:Va.defaultData,globalPhysics:gu.defaultData,ambient:EP.defaultData,ao:TP.defaultData,shadow:Gd.defaultData,publish:_P.defaultData,grading:MP.defaultData})(x1||(x1={}))});var w1,KF=B(()=>{"use strict";(t=>t.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(w1||(w1={}))});var ZF,cf,rU,Ur,uf,QF,JF,eU,tU,go,jd,df,hf,yo,ra,nU,ia,tv=B(()=>{"use strict";an();rP();oP();aP();lP();l1();dP();Ts();of();v1();sP();qr();S1();KF();(e=>{function i(n){return n==="Component"||n==="Instance"}e.isComponentRelated=i;function t(n){return n==="Empty"||n==="Instance"}e.isEmptyOrComponent=t})(ZF||(ZF={}));(r=>{r.identity={...KS.identity,hiddenMatrix:pu.identity};function t(s){return{position:s.position,rotation:s.rotation,scale:s.scale,pivot:s.pivot,pivotRotation:s.pivotRotation,hiddenMatrix:s.hiddenMatrix}}r.fromObject=t;function e(s,o){return{position:o?.position||s.position,rotation:o?.rotation||s.rotation,pivot:o?.pivot||s.pivot,pivotRotation:o?.pivotRotation||s.pivotRotation,scale:o?.scale||s.scale,hiddenMatrix:o?.hiddenMatrix||s.hiddenMatrix}}r.merge=e;function n(s,o){return OS({position:po.isEqual(s.position,o.position)?void 0:o.position,rotation:po.isEqual(s.rotation,o.rotation)?void 0:o.rotation,scale:po.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:pu.isEqual(s.hiddenMatrix,o.hiddenMatrix)?void 0:o.hiddenMatrix})}r.diff=n})(cf||(cf={}));rU=["slide","offset"];(t=>t.defaultData={states:new Fe,events:new Fe,visible:!0,raycastLock:!1,physics:mu.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...cf.identity,cloner:null})(Ur||(Ur={}));(t=>t.defaultData={type:"Empty",...Ur.defaultData})(uf||(uf={}));(t=>t.defaultData={type:"ParticleCollider",...w1.defaultData,...Ur.defaultData})(QF||(QF={}));(t=>t.defaultData={type:"Component",...Ur.defaultData})(JF||(JF={}));(t=>t.defaultData={type:"Particle",...Ur.defaultData,...nf.defaultData})(eU||(eU={}));(t=>t.defaultData={type:"Hair",...Ur.defaultData,...a1.defaultData})(tU||(tU={}));(t=>t.defaultData={type:"Mesh",...Ur.defaultData,...c1.defaultData})(go||(go={}));(t=>t.defaultData={...Ur.defaultData,...cf.identity,position:na.DefaultPosition,rotation:na.DefaultRotation,...na.defaultData})(jd||(jd={}));(e=>{function i(n){return{...Ur.defaultData,...o1.defaultData(n)}}e.defaultData=i,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(df||(df={}));(e=>{function i(n,r,s=0){for(;s<r.length;){let o=n?n[r[s]]:void 0;if(r.length===s+1)return o;if(o)n=o.descendants,s+=1;else return}}e.resolveWithDes=i;function t(n,r,s=0){let o=i(n,r,s);if(o){let a=Object.keys(o);if(a.length===1&&a[0]==="descendants")return}return o}e.resolve=t})(hf||(hf={}));(s=>{s.rootOverrideProps=["physics","events"],s.compositeNonOptionalOverrideProps=["geometry"],s.compositeEntireOverrideOverrideProps=["material"];function n(o,a){return{...Ur.defaultData,...a,component:o,overrides:new _n,physics:void 0,events:void 0,type:"Instance"}}s.ofComponent=n;function r(o){let a=cf.fromObject(o.data);return n(o.id,a)}s.fromComponentData=r})(yo||(yo={}));(e=>{e.defaultData={type:"Page",...Ur.defaultData,physics:{...mu.defaultData,fusedBody:!1},...x1.defaultData,camera:jd.defaultData,timelines:new st};function t(n){return n.uiScene!==void 0}e.isUIPage=t})(ra||(ra={}));(a=>(a.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:pu.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:mu.defaultData,states:new Fe,events:new Fe,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...na.defaultData},a.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},a.defaultMeshObject={name:"Rectangle",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("RectangleGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultBooleanObject={name:"Boolean",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("BooleanGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultShapeBlendObject={name:"Shape Blend",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("ShapeBlendGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultTextObject={name:"Text",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("TextGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")},a.defaultInputObject={name:"Input",...Ur.defaultData,...go.defaultData,geometry:mo.defaultData("InputGeometry"),material:An.defaultTwoLayerData("physical","layer1","layer2")}))(nU||(nU={}));(r=>{function i(s,o){let a={name:o};return s.type==="Mesh"?(a.geometry={},"material"in s&&(a.material={layers:new _n}),"materials"in s&&(a.materials=s.materials.map(l=>({layers:new _n})))):ta.is(s.type)&&(a.perspective={},a.orthographic={}),a}r.newEmpty=i;function t(s,o){if(o===void 0)return s;let a={...s};return"material"in a&&"material"in o&&o.material&&(a.material=cu(a.material,l=>{if(typeof l!="string")for(let[c,u]of Object.entries(o.material.layers)){let d=l.layers.data(c);d&&Qn.patch(d,u)}}).data),a.materials&&o.materials&&(a.materials=cu(a.materials,l=>{for(let c=0;c<a.materials.length;c++){let u=o.materials[c];if(typeof u!="string")for(let[d,h]of Object.entries(u.layers)){let p=l[c]?.layers?.data(d);p&&Qn.patch(p,h)}}}).data),a}function e(s,o){let a,l=[],c={orthographic:0,perspective:0,geometry:0};function u(d,h){for(let[p,f]of Object.entries(h.layers)){let{texture: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(o)){let p=h;if(d!=="name")if(d==="cloner")l.push(...JS.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 a===void 0&&(a={path:[],props:{},type:0},l.push(a)),a.props[d]=p}return l}r.toOps=e;function n(s,o){if(o===void 0)return s;let a={...s};if(Object.assign(a,cf.merge(a,o)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:o.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:o.pathSnapping?.offset??a.pathSnapping?.offset??0})}),ta.is(s.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let l=o;l.orthographic?.zoom!==void 0&&(a.orthographic.zoom=l.orthographic.zoom),l.perspective?.zoom!==void 0&&(a.perspective.zoom=l.perspective.zoom),l.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=l.isUpVectorFlipped),l.targetOffset!==void 0&&(a.targetOffset=l.targetOffset)}else if(s.type==="Mesh")"geometry"in o&&Object.assign(a,{geometry:g1.merge(a.geometry,o.geometry)}),(o.material||o.materials)&&(a=t(a,o)),a.cloner&&"cloner"in o&&Object.assign(a,{cloner:ka.merge(a.cloner,o.cloner)});else if(s.type==="Empty")a.cloner&&"cloner"in o&&Object.assign(a,{cloner:ka.merge(a.cloner,o.cloner)});else if(s1.is(s.type)){let l=o;l.intensity!==void 0&&(a.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?a.color=l.color:a.color=yr.clone(l.color))}return a}r.patch=n})(ia||(ia={}))});var pf,E1=B(()=>{"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})(pf||(pf={}))});var vo,nv=B(()=>{"use strict";E1();Ts();(t=>t.defaultData={orbitControls:pf.defaultData,playPage:fu,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})(vo||(vo={}))});var AP,CP,Ql,PP=B(()=>{"use strict";(t=>t.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(AP||(AP={}));(t=>t.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(CP||(CP={}));(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...AP.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:CP.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(Ql||(Ql={}))});var bo,Jl,T1=B(()=>{"use strict";tv();an();nv();Ts();qr();PP();(r=>{function i(s){return s.find(o=>o.data.type==="Page"&&o.data.globalPhysics.usePhysics)!==void 0}r.physicsEnabled=i;function t(s,o){let a=s.find(l=>l.data.type==="Page"&&l.data.timelines?.[o]!==void 0);return a&&a.data.timelines?.[o]}r.findTimeline=t;function e(s,o){let a=s.scene.objects.get(o);if(a&&a.data.type==="Component")return a;{let l=s.shared.lib.components[o];if(l)return{...l.asset,id:o}}}r.getComponentData=e;function n(s,o,a){s.scene.objects.traverseFrom(o,(l,c)=>{if(c.type==="Instance"){let u=e(s,c.component)?.data;u&&a(l,c,u.events)}else a(l,c,c.events)})}r.traverseModuleInstances=n})(bo||(bo={}));(c=>{c.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",c.defaultLight={fi:-1,data:df.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:fu,data:{...ra.defaultData,name:"Scene 1"},children:h}),p}c.createDefaultObjectTreeWithPage=e,c.defaultData={objects:e(),publish:vo.defaultData,styles:Ql.defaultData()},c.emptyDataWithoutPage=function(){return{objects:new Ln,publish:vo.defaultData,styles:Ql.defaultData()}},c.emptyDataWithPage=function(u=!0){return{objects:e(u),publish:vo.defaultData,styles:Ql.defaultData()}},c.emptyData=function(){return{objects:new Ln,publish:{...vo.defaultData},styles:Ql.defaultData()}};function a(u){return{...c.defaultData,objects:Wr(u,Ln.prototype)}}c.withObjs=a;function l(u,d){return a([{id:u,data:d,children:[],fi:0}])}c.withObj=l})(Jl||(Jl={}))});var ff,RP=B(()=>{"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}})(ff||(ff={}))});var M1,iU,Tr,IP,sU,oU,sa,ls,_1=B(()=>{"use strict";an();qr();(e=>(e.defaultData=n=>({url:n,name:"New Webhook",parametersSchemas:new Fe}),e.defaultParameterValueByType=n=>n==="number"?0:n==="boolean"?!1:""))(M1||(M1={}));(t=>t.defaultData=(e,n="GET")=>({url:e,method:n,name:"New API",headers:new Fe,queries:new Fe,autoStart:!0}))(iU||(iU={}));(s=>{function i(o){return o.textValue!==void 0}s.isTextValue=i;function t(o){return typeof o=="number"}s.isNumber=t;function e(o){return typeof o=="boolean"}s.isBoolean=e;function n(o){return i(o)?"string":e(o)?"boolean":"number"}s.typeOfVariable=n;function r(o){return s.isTextValue(o)?Array.isArray(o.textValue)?o.textValue.map(a=>a.toString().padStart(o.padding??2,"0")).join(o.deliminator??":")+(o.suffix!==void 0?" "+o.suffix:""):o.textValue.toString():s.isBoolean(o)?o?"True":"False":s.isNumber(o)?parseFloat(o.toFixed(3)).toString():o.toString()}s.getDisplayedValue=r})(Tr||(Tr={}));(t=>t.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(IP||(IP={}));(t=>t.all=[...IP.all,"components"])(sU||(sU={}));(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}}t.defaultData=i})(oU||(oU={}));(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}}t.defaultData=i})(sa||(sa={}));(s=>{function i(){let o={};return o["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},Wr(o,st.prototype)}s.defaultColors=i;function t(){return Wr({},st.prototype)}s.defaultImages=t;function e(){return{catelogs:new st,materials:new st,images:new st,videos:new st,colors:new st,audios:new st,particles:new st,fonts:new st,variables:new Fe,userAPIs:new st,userWebhooks:new st,lib:sa.defaultData()}}s.emptyData=e;function n(o){switch(o){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let a=[0,0,0];return{name:"Time",value:{textValue:a,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:a,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",o)}}s.defaultVariables=n;function r(o,a){if(a.format==="HH:mm:ss"){let l=Math.floor(o/3600),c=Math.floor((o-l*3600)/60),u=Math.round(o-l*3600-c*60);return{textValue:[l,c,u]}}else if(a.format==="mm:ss"){let l=Math.floor(o/60),c=Math.round(o-l*60);return{textValue:[l,c]}}else return a.format==="number"?o=Math.round(o):o=Math.round(o*1e3)/1e3,o}s.getFormattedTimerTime=r})(ls||(ls={}))});var aU=B(()=>{"use strict"});var yu,OP=B(()=>{"use strict";an();T1();RP();_1();(l=>{l.defaultData={schema:132,scene:Jl.defaultData,frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ff.defaultData),shared:{...ls.emptyData(),colors:ls.defaultColors()}},l.createDefaultData=function(){return Nd.deserialize(Nd.serialize(l.defaultData))},l.emptyDataForImports=function(){let c=Jl.emptyDataWithPage();return{schema:132,scene:c,frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ff.defaultData),shared:{...ls.emptyData(),colors:ls.defaultColors(),images:ls.defaultImages()}}},l.emptyData=function(){return{schema:132,scene:Jl.emptyDataWithPage(),frames:new st().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",ff.defaultData),shared:ls.emptyData()}},l.clipboard2dData=function(){return{schema:132,scene:Jl.emptyData(),frames:new st,shared:ls.emptyData()}};function s(c){return{...c,shared:{...c.shared,lib:sa.defaultData()}}}l.withoutLib=s;function o(c,u){return bo.getComponentData(c,u)}l.getComponentData=o;function a(c){let u=Object.values(c.shared.userAPIs);for(let d of u){let h=d.headers;for(let p of h)if(p.data.key.toLowerCase()==="authorization"&&p.data.value!=="")return!0}return!1}l.hasSensitiveData=a})(yu||(yu={}))});var A1,lU=B(()=>{"use strict";(t=>t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"})(A1||(A1={}))});function ec(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 rv(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??{...Kl.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:o}=e??{...ea.defaultData},a=new DP(n,r,s,o),l=a.solve(1);return()=>c=>a.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}var cU,uU,tc,mf,DP,LP=B(()=>{"use strict";an();Ts();(t=>{function i(e,n){return{id:e,name:n,duration:5,objectTimelines:new st}}t.defaultData=i})(cU||(cU={}));(t=>{function i(e){return e&&typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number"}t.is=i})(uU||(uU={}));(x=>{function i(S,E){let T=[0,0],w=[1,1];if(S?.cubicControls)T=ec(S.cubicControls.control1,T);else switch(S?.type){case 2:T=[.42,0];break;case 3:T=[0,0];break;case 4:T=[.42,0];break;case 1:T=[.25,.1];break;case 0:T=[0,0];break;case 7:T=[.25,1];break}if(E?.cubicControls)w=ec(E.cubicControls.control2,w);else switch(E?.type){case 2:w=[1,1];break;case 3:w=[.58,1];break;case 4:w=[.58,1];break;case 1:w=[.25,1];break;case 0:w=[1,1];break;case 7:w=[.5,1];break}return{control1:T,control2:w}}x.getControlsWithDefault=i,x.BEZIER_PRESETS=[0,1,2,3,4,7];function e(S){if(!x.BEZIER_PRESETS.includes(S))return;let E={type:S};return{control1:i(E).control1,control2:i(void 0,E).control2}}x.presetHandles=e;let n=.001;function r(S,E){return Math.abs(S[0]-E[0])<n&&Math.abs(S[1]-E[1])<n}function s(S){return x.BEZIER_PRESETS.find(E=>{let T=e(E);return T!==void 0&&r(T.control1,S.control1)&&r(T.control2,S.control2)})}x.presetForHandles=s;function o(S){return{id:S,keyframes:new Fe}}x.defaultData=o,x.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"];function l(S){let E=x.ROOT_PROPERTY_ORDER.indexOf(S[0]);return E===-1?x.ROOT_PROPERTY_ORDER.length:E}x.rowOrder=l;function c(S){return S.layerId??S.path.join(".")}x.propertyKey=c;function u(S,E){let T=new Map;for(let w of S){let _=w.data;if(E?.(_))continue;let A=c(_),C=T.get(A);C||(C={id:A,path:_.path,keyframes:[],layerId:_.layerId,index:_.index},T.set(A,C)),_.isPlaceholder?C.placeholder=w.id:C.keyframes.push(w)}return[...T.values()].sort((w,_)=>{let A=l(w.path)-l(_.path);return A!==0?A:(w.index??0)-(_.index??0)})}x.groupKeyframes=u;function d(S){let E=S[S.length-1];return mf.includes(E)?E:void 0}x.rowAxis=d;function h(S){return S.layerId?S.layerId:(d(S.path)?S.path.slice(0,-1):S.path).join(".")}x.drawnRowKey=h;function p(S){let E=new Map;for(let T of S){let w=d(T.path),_=w?T.path.slice(0,-1):T.path,A=h(T),C=E.get(A);C||(C={id:A,path:_,layerId:T.layerId,index:T.index,tracks:[]},E.set(A,C)),C.tracks.push({axis:w,property:T})}return[...E.values()]}x.drawnRows=p;function f(S){return[...S].sort((E,T)=>E.data.time-T.data.time)}x.sortedKeyframes=f;function m(S){return["material",S.type==="light"?`${S.category} lighting`:S.type]}x.materialLayerPath=m;function g(S,E){return S.map(({data:T,id:w},_)=>y(E(),m(T),{layerId:w,index:_}))}x.createMaterialGroup=g;function y(S,E,T){return{id:S,data:{id:S,time:T?.time??0,path:E,value:{},layerId:T?.layerId,index:T?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}x.placeholderKeyframe=y;function v(S){return Object.entries(S).reduce((E,[T,w])=>(typeof w!="string"&&E.push({name:w.name}),E),[])}x.createName=v,x.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:rv(3),duration:1e3},opacity:{value:[0,1],easing:rv(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:rv(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:rv(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:rv(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(tc||(tc={}));mf=["x","y","z"],DP=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 gf,yf,C1=B(()=>{"use strict";Ts();an();(t=>t.list=["idle","move","jump","run"])(gf||(gf={}));(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 Fe,move:new Fe,jump:new Fe,run:new Fe},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Vt.fromHexAndA(3728051,1)}}))(yf||(yf={}))});function Hd(i,...t){let e={};for(let n of t.flat())i!=null&&n in i&&(e[n]=i[n]);return e}function dU(i){i.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let e=t.colorA,n=t.colorB,r=[[e.r,e.g,e.b,e.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let a=2;a<10;a++)r.push(r[1]),s.push(1);let o={...Hd(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,o)}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 za(i,t){Object.values(i.shared.materials).forEach(e=>t(e))}function Ga(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)!==_n.prototype&&t(r.material)})})}function hJ(i){Object.assign(i.scene.publish,{orbitControls:{...pf.defaultData,...Pr(i.scene.publish.orbitControls)}})}function pJ(i){Object.assign(i.scene.publish.settings,{video:{...vo.defaultData.settings.video,...Pr(i.scene.publish.settings.video)}})}function fJ(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((sf.includes(r)||typeof s=="boolean")&&delete n[r],r==="texture")for(let[o,a]of Object.entries(s))(p1.includes(o)||typeof a=="boolean")&&delete s[o]}}}i.scene.objects.traverse((e,n)=>{n.states.forEach(r=>{let s=r;s.material?t(s.material):s.materials&&s.materials.forEach(o=>{t(o)})})})}function mJ(i){i.scene.publish.withBackground=!0}function gJ(i){i.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function yJ(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 vJ(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 bJ(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 xJ(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 SJ(i){function t(n){Object.setPrototypeOf(n,_n.prototype),n.texture&&Object.setPrototypeOf(n.texture,_n.prototype)}function e(n){Object.setPrototypeOf(n,_n.prototype);for(let r in n)t(n[r])}i.scene.objects.traverse((n,r)=>{r.states.forEach(s=>{let o=s;if(o.material){let a=Pr(o.material).layers;e(a),o.material.layers=a}if(o.materials)for(let a=0;a<o.materials.length;a++){let l=o.materials[a],c=Pr(l).layers;e(c),l.layers=c}})})}function hU(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("lambert"))}function NP(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 wJ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&(e.geometry.type==="BooleanGeometry"||e.geometry.type==="SubdivGeometry")&&(e.geometry.phongAngle=35)})}function pU(i){i.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(n=>{typeof n!="string"&&NP(n)}):"material"in e&&typeof e.material!="string"&&NP(e.material)}),Object.values(i.shared.materials).forEach(t=>NP(t))}function EJ(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 TJ(i){i.shared.audios=Wr({},st.prototype)}function MJ(i){i.shared.videos=Wr({},st.prototype)}function _J(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 AJ(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 CJ(i){i.scene.publish.settings.web.preload=!1}function fU(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 mU(i){i.layers&&i.layers.forEach(t=>{XF(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 PJ(i){i.shared.fonts=Wr({},st.prototype)}function RJ(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 IJ(i){let t=[];i.scene.objects.traverse((e,n)=>{let r=n;if(r.type==="TextFrame"){let s=An.defaultTwoLayerData("phong"),o=typeof r.color=="string"?i.shared.colors[r.color]:r.color;s.layers[1].data.color={r:o.r,g:o.g,b:o.b},s.layers[1].data.alpha=r.alpha;let a=RJ(r.font);i.shared.fonts[a]===void 0&&(i.shared.fonts[a]={name:a});let l={name:r.name,...Ur.defaultData,...go.defaultData,flatShading:!1,wireframe:!1,geometry:{...mo.defaultData("TextGeometry"),width:r.width,height:r.height,font:a,depth:0,horizontalAlign:r.horizontalAlign,verticalAlign:r.verticalAlign,fontSize:r.fontSize*1.40625,lineHeight:r.lineHeight/1.40625,letterSpacing:r.letterSpacing-1,text:r.text,textTransform:r.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:s,states: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 OJ(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 Fe,move:new Fe,jump:new Fe}});else{let s=new Fe;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:ge.generateUUID(),data:{type:"Link",url:r.url,delay:0}}),"targets"in r&&(r.targets.forEach((o,a,l)=>{let c={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},u={easing:o.easing,duration:o.duration};o.easing===6?Object.assign(u,Hd(o,"mass","stiffness","damping","velocity")):o.easing===5&&Object.assign(u,{control1:{...o.control1},control2:{...o.control2}});let d={repeat:o.repeat?-1:0,delay:o.delay,delayDirection:o.delayDirection,direction:o.cycle&&o.rewind?"pingpong-rewind":o.cycle?"pingpong":"normal"},h={state:o.state,...d,...u},p={allowSlerp:!0,type:"Transition",object:o.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Fe({fi:0,id:ge.generateUUID(),data:c},{fi:1,id:ge.generateUUID(),data:h})};s.push({fi:l,id:a,data:p})}),delete r.targets)}})})}function DJ(i){i.scene.objects.traverse((t,e)=>{function n(r,s){let o=new Fe,a=[];if(e.events.forEach((l,c,u)=>{if(l.type==="Audio"&&l.trigger===s){let d;a.push(c),l.interaction==="play"?d={...Hd(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={...Hd(l,"interaction","delay","object","playAudio"),type:"Audio"}),d&&o.push({fi:u,id:c,data:d})}}),a.forEach(l=>e.events.delete(l)),o.length){let l=e.events.find(c=>c.type===r)?.data;l?"actions"in l&&l.actions.insertBefore(null,o):e.events.insertBefore(null,[{id:ge.generateUUID(),data:{type:r,actions:o}}])}}n("Start","start"),n("MouseDown","mouseDown"),n("MouseUp","mouseUp"),n("KeyDown","keyDown"),n("KeyUp","keyUp")})}function gU(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 yU(i){za(i,gU),Ga(i,gU)}function LJ(i){i.scene.objects.traverse((t,e)=>{e.type==="Mesh"&&e.geometry.type==="SubdivGeometry"&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}function NJ(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 BJ(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 FJ(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 UJ(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 kJ(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 VJ(i){let{video:t}=i.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function zJ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.resetYPosition=Math.abs(n.resetYPosition-e.position[1]))})})}function GJ(i){let t=i.scene.environment.usePhysics;i.scene.objects.traverse((e,n)=>{t&&n.physics===null?n.collision=!1:n.collision="visibility"})}function jJ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.navmesh=yf.defaultDataThirdPerson.navmesh)})})}function HJ(i){i.scene.styles||(i.scene.styles=Ql.defaultData())}function vU(i){i.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function WJ(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}),Ga(i,vU),za(i,vU)}function qJ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&Object.assign(n.gameActions,{run:new Fe})})})}function XJ(i){i.scene.objects.traverse((t,e)=>{e.events.forEach(n=>{n.type==="GameControl"&&(n.keyAssignments=[...n.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}function bU(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function xU(i,t){if(t<1&&(Ga(i,dU),za(i,dU),i.schema=1),t<2&&(hJ(i),i.schema=2),t<3&&(fJ(i),i.schema=3),t<4&&(mJ(i),i.schema=4),t<5&&(gJ(i),i.schema=5),t<6&&(yJ(i),i.schema=6),t<7&&(vJ(i),i.schema=7),t<8&&(i.schema=8),t<9&&(pU(i),i.schema=9),t<10&&(wJ(i),i.schema=10),t<11&&(EJ(i),i.schema=11),t<12&&(pU(i),i.schema=12),t<13&&(TJ(i),i.schema=13),t<14&&(_J(i),i.schema=14),t<15&&(AJ(i),i.schema=15),t<16&&(CJ(i),i.schema=16),t<17&&(Ga(i,fU),za(i,fU),i.schema=17),t<18&&(Ga(i,hU),za(i,hU),i.schema=18),t<19&&(pJ(i),i.schema=19),t<20&&(PJ(i),IJ(i),i.schema=20),t<21&&(OJ(i),DJ(i),i.schema=21),t<22&&(yU(i),i.schema=22),t<23&&(LJ(i),i.schema=23),t<24&&(NJ(i),i.schema=24),(t<25||i.shared.videos===void 0)&&(MJ(i),t<25&&(i.schema=25)),t<26&&(bJ(i),i.schema=26),t<27&&(xJ(i),i.schema=27),t<28&&(yU(i),i.schema=28),t<29&&(SJ(i),i.schema=29),t<30&&(BJ(i),i.schema=30),t<31&&(FJ(i),i.schema=31),t<33&&(UJ(i),i.schema=33),t<34&&(kJ(i),i.schema=34),t<35&&(VJ(i),i.schema=35),t<36&&(zJ(i),i.schema=36),t<37&&(GJ(i),i.schema=37),t<38&&(Ga(i,mU),za(i,mU),i.schema=38),t<39&&(jJ(i),i.schema=39),t<40&&(HJ(i),i.schema=40),t<41&&(WJ(i),i.schema=41),t<42&&(qJ(i),i.schema=42),t<43&&(XJ(i),i.schema=43),t<99){Ga(i,bU),za(i,bU),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=fo);let e=Pr(i.scene.objects),n=i.scene.objects;i.scene.publish.playPage=fu,n.insertBefore(null,null,[{id:fu,data:{...ra.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Hd(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Hd(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...gu.defaultData,...Hd(i.scene.environment,"usePhysics","gravity")},camera:Pr(i.scene.ownerCamera)??ra.defaultData.camera,name:"Scene"},children:[]}]);for(let o of e)o.id!==Jl.TRASH_CAN_ID&&n.move(fu,o.fi,o.id);let r=0,s=0;i.shared.penumbraSize&&i.scene.objects.traverse((o,a)=>{a.type==="DirectionalLight"?(a.penumbraSize=i.shared.penumbraSize[Math.min(r,2)],r+=1):a.type==="SpotLight"&&(a.penumbraSize=i.shared.penumbraSize[3+Math.min(s,1)],s+=1),(a.physics===void 0||a.physics===null)&&a.type!=="Instance"&&(a.physics={},Object.assign(a.physics,mu.defaultData)),a.physics!==void 0&&a.physics!==null&&(a.physics.enabled=a.collision??"visibility",delete a.collision)}),i.schema=99}}var SU=B(()=>{"use strict";of();Ts();E1();tv();an();nv();qr();q();v1();C1();PP();T1();l1();S1()});var RU={};Xh(RU,{updateAllMaterials:()=>CU,updateDocumentSchema:()=>UP,updateLibSchema:()=>See,updateMaterialSchema:()=>iee,updateObjectStateRec:()=>qd,updateObjectsSchema:()=>AU,updateTextValues:()=>nee});function wU(i){i.layers&&i.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function YJ(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 MU(i){let t=i.geometry;t!==void 0&&$J.has(t.type)&&t.extrusionVersion===void 0&&(t.extrusionVersion=1)}function KJ(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 QJ(i){i.rotation=i.rotation.slice(0,3).map(t=>t*Wd)}function EU(i,t){let[e,n,r]=i,s=Math.cos(e),o=Math.sin(e),a=Math.cos(n),l=Math.sin(n),c=Math.cos(r),u=Math.sin(r),d=[a*c,s*u+o*c*l,o*u-s*c*l],h=Math.hypot(t[0],t[1],t[2])||1;return Math.abs((d[0]*t[0]+d[1]*t[1]+d[2]*t[2])/h)}function JJ(i,t){let e=Array.isArray(t)&&t.length>=3&&t.every(s=>typeof s=="number"&&Number.isFinite(s))?t:[0,1,0],n=EU(i,e),r=EU(i.map(s=>s*ZJ),e);return Math.abs(n-r)<1e-6?i.some(s=>Math.abs(s)>Math.PI):r<n}function eee(i){let t=i.rotation.slice(0,3);if(JJ(t,i.up)){i.rotation=t;return}i.rotation=t.map(e=>e*Wd)}function _U(i){QJ(i),i.type==="Page"&&eee(i.camera),i.states?.forEach(e=>{e.rotation===void 0||e.rotation===null||(e.rotation=e.rotation.slice(0,3).map(n=>n*Wd))});let t=i.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*Wd),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*Wd),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=Wd,t.extrusion.twist*=Wd),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 tee(i){i.shared.variables=Wr({},st.prototype)}function nee(i){i.scene.objects.traverse((t,e)=>{})}function ree(i){let t=Pr(i.shared.variables);i.shared.variables=Wr(Object.entries(t??{}).map(([e,n],r)=>({fi:r,id:e,data:n})),Fe.prototype)}function iee(i){let t=i.schema??104;t!==132&&t<130&&(P1(i.asset),i.schema=130)}function qd(i,t){t(i.data);for(let e of i.children)qd(e,t)}function AU(i){let t=i.schema??104;t!==132&&(t<105&&(qd(i.asset,_U),i.schema=105),t<118&&(qd(i.asset,PU),i.schema=118),t<121&&(qd(i.asset,FP),i.schema=121),t<130&&(qd(i.asset,see),i.schema=130),t<132&&(qd(i.asset,MU),i.schema=132))}function CU(i,t){Ga(i,t),za(i,t),Object.values(i.shared.lib.materials).forEach(e=>t(e.asset))}function P1(i){i.layers===void 0&&Object.assign(i,An.defaultTwoLayerData("phong"))}function see(i){"materials"in i?i.materials.forEach(t=>{t!==void 0&&typeof t!="string"&&P1(t)}):"material"in i&&i.material!==void 0&&typeof i.material!="string"&&P1(i.material)}function oee(i){i.shared.particles=Wr({},st.prototype),i.shared.lib&&(i.shared.lib.particles=sa.defaultData().particles)}function aee(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 lee(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 cee(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"&&"runMode"in s||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"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Toggle")}):n.type==="GameControl"?(delete n.actions,Object.keys(n.gameActions).forEach(o=>{n.gameActions[o]?.forEach(a=>{a.type==="Transition"&&(a.runMode="Repeat"),a.type==="Animation"&&"runMode"in a&&(a.runMode="Normal")})})):n.type==="DragDrop"?(delete n.actions,n.dragDropActions?.drag?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Toggle")}),n.dragDropActions?.drop?.forEach(s=>{(s.type==="Transition"||s.type==="Animation"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Toggle")})):n.type==="Resize"?(delete n.actions,n.breakpoints?.forEach(s=>{s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})})):n.type==="Start"?n.actions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Once"),(s.type==="Animation"&&"runMode"in s||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"&&"runMode"in s||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"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Normal")}),n.outActions?.forEach(s=>{s.type==="Transition"&&(s.runMode="Repeat"),(s.type==="Animation"&&"runMode"in s||s.type==="SwitchCamera")&&(s.runMode="Normal")}))})})}function uee(i){i.shared.userAPIs=Wr({},st.prototype),i.shared.userWebhooks=Wr({},st.prototype),i.shared.lib&&(i.shared.lib.userAPIs=sa.defaultData().userAPIs,i.shared.lib.userWebhooks=sa.defaultData().userWebhooks)}function dee(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=vo.defaultData.settings.videoStatic)}function PU(i){i.timelineAnimations=Wr({},st.prototype)}function hee(i){let t=[];return i?(i.forEach((e,n)=>{let{path:r,keyframes:s}=e.data,o=r[0]==="material"?e.id:void 0;if(!s?.length){t.push(tc.placeholderKeyframe(e.id,r,{layerId:o,index:n}));return}s.forEach(({id:a,data:l})=>{t.push({id:a,data:{...l,path:r,layerId:o,index:n}})})}),t.sort((e,n)=>e.data.time-n.data.time),new Fe(...t.map((e,n)=>({...e,fi:n})))):new Fe}function pee(i){let t=i.shared,e=t.timelineAnimations;if(!e)return;let n=i.scene.objects,r=n.unproxy().find(s=>s.data.type==="Page")?.id;for(let[s,o]of Object.entries(e)){let a=Wr({},st.prototype),l=0,c=Boolean(o.loop);for(let[p,f]of Object.entries(o.mapping??{})){let g=n.data(p)?.timelineAnimations?.[f];!g||(l=Math.max(l,g.to??0),c=c||Boolean(g.loop),a[p]={id:p,keyframes:hee(g.properties?.unproxy())})}let u=o.page??r,d=u?n.data(u):void 0;if(!d||d.type!=="Page")continue;let h=d.timelines??(d.timelines=Wr({},st.prototype));h[s]={id:s,name:o.name,duration:l||5,...c?{loop:c}:{},objectTimelines:a}}delete t.timelineAnimations,n.traverse((s,o)=>{delete o.timelineAnimations})}function fee(i){i.scene.objects.traverse((t,e)=>{let n=e.states;if(!n)return;let r=e.timelineAnimations,s=[];n.forEach((o,a)=>{(o.isAnimation||r?.[a])&&s.push(a)}),s.forEach(o=>n.delete(o))})}function gee(i){for(let{id:t,data:e}of[...i.unproxy()]){let n=e.path?.[0];if(!n||!mee.includes(n))continue;let r=BP(e.value);if(!r.length)continue;let s=i.data(t);if(!s)continue;let o=e.value,[a,...l]=r;for(let c of l){let u=ge.generateUUID();i.insertBefore(null,[{id:u,data:{...e,id:u,path:[n,c],value:o[c],easing:yee(e.easing)}}])}s.path=[n,a],s.value=o[a]}}function BP(i){return i===null||typeof i!="object"?[]:mf.filter(t=>t in i)}function yee(i){let t=i?.cubicControls;return{...i,cubicControls:{control1:[...t?.control1??[0,0]],control2:[...t?.control2??[1,1]]},...i?.springParameters?{springParameters:{...i.springParameters}}:{}}}function vee(i,t){return Math.abs(i[0]-t[0])<1e-6&&Math.abs(i[1]-t[1])<1e-6}function bee(i){let t=[];for(let e of tc.groupKeyframes(i)){let n=new Set(e.keyframes.flatMap(s=>BP(s.data.value))),r=n.size?[...n].map(s=>e.keyframes.filter(o=>BP(o.data.value).includes(s))):[e.keyframes];for(let s of r){let o=[...s].sort((a,l)=>a.data.time-l.data.time);for(let a=0;a+1<o.length;a++)t.push({left:o[a],right:o[a+1]})}}return t}function xee(i){let t=bee([...i.unproxy()]),e=new Map,n=new Set;for(let{left:s,right:o}of t){let a=s.data.easing?.type,c=(a===void 0?void 0:tc.presetHandles(a))?.control2??(a===5?ec(o.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!c)continue;let u=e.get(o.id);u?vee(u,c)||n.add(o.id):e.set(o.id,c)}let r=new Map;for(let{id:s,data:o}of i.unproxy()){let a=o.easing?.type,l=a===void 0?void 0:tc.presetHandles(a);l&&r.set(s,l.control1)}for(let{left:s,right:o}of t)n.has(o.id)&&r.delete(s.id);for(let[s,o]of r){let a=i.data(s);!a?.easing||(a.easing.cubicControls={control1:o,control2:ec(a.easing.cubicControls?.control2,[1,1])},a.easing.type=5)}for(let{left:s,right:o}of t){if(!r.has(s.id))continue;let a=i.data(o.id),l=e.get(o.id);!a?.easing||!l||(a.easing.cubicControls={control1:ec(a.easing.cubicControls?.control1,[0,0]),control2:l})}}function TU(i,t){i.scene.objects.traverse((e,n)=>{let r=n;if(!(r.type!=="Page"||!r.timelines))for(let s of Object.values(r.timelines))for(let o of Object.values(s.objectTimelines??{}))t(o.keyframes)})}function FP(i){i.pivot=[0,0,0],i.pivotRotation=[0,0,0]}function See(i){}function UP(i){let t=i.schema??0;if(t!==132){if(t>132){console.error(`This scene was created with a newer version of Spline (file format ${t}, this runtime reads ${132}). Update @splinetool/runtime to the latest version to load it correctly.`);return}console.warn("updating from ",t,"to ",132),xU(i,t),t<100&&(i.scene.publish.joystickSizeAndXYOffset===void 0&&(i.scene.publish.joystickSizeAndXYOffset=vo.defaultData.joystickSizeAndXYOffset),i.schema=100),t<101&&(Ga(i,wU),za(i,wU),i.schema=101),t<102&&(YJ(i),i.schema=102),t<104&&(i.shared.catelogs=new st,i.shared.lib=sa.defaultData(),i.schema=104),t<105&&(tee(i),i.scene.objects.traverse((e,n)=>{_U(n)}),i.schema=105);for(let e of Object.values(i.shared.lib.components))AU(e);t<106&&(ree(i),i.schema=106),t<107&&(i.shared.lib.variables=sa.defaultData().variables,i.schema=107),t<109&&(oee(i),i.schema=109),t<110&&(aee(i),i.schema=110),t<111&&(i.scene.objects.traverse((e,n)=>{KJ(n)}),i.schema=111),t<112&&(lee(i),i.schema=112),t<113&&(cee(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&&(uee(i),i.schema=115),t<116&&(dee(i),i.schema=116),t<117&&(i.scene.publish.settings.web.pixelRatioMobile===void 0&&(i.scene.publish.settings.web.pixelRatioMobile=0),i.scene.publish.settings.web.pixelRatioDesktop===void 0&&(i.scene.publish.settings.web.pixelRatioDesktop=0),i.schema=117),t<118&&(i.shared.timelineAnimations=Wr({},st.prototype),i.scene.objects.traverse((e,n)=>{PU(n)}),i.schema=118),t<119&&(i.scene.publish.settings.videoStatic.format=yu.defaultData.scene.publish.settings.videoStatic.format,i.scene.publish.settings.videoStatic.imageFormat=yu.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)=>{FP(n),n.type==="Page"&&n.camera!==void 0&&FP(n.camera)}),i.schema=121),t<122&&(delete i.scene.publish.settings.video,i.scene.publish.orbitControls.rotationSpeed=yu.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=Va.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=Va.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=Va.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={...Va.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Va.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=ra.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&&(CU(i,P1),i.schema=130),t<131&&(fee(i),pee(i),TU(i,gee),TU(i,xee),i.schema=131),t<132&&(i.scene.objects.traverse((e,n)=>MU(n)),i.schema=132)}}var $J,Wd,ZJ,mee,iv=B(()=>{q();OP();an();LP();SU();nv();of();qr();_1();tv();b1();$J=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]);Wd=180/Math.PI,ZJ=Math.PI/180;mee=["position","rotation","scale","shape size"]});var IU,R1,kP,OU,I1,nc,sv,vf,O1,VP,bf,zP,GP,DU,ov,jP,rc,D1,LU=B(()=>{"use strict";Ts();an();qr();(t=>{function i(e){return!0}t.is=i})(IU||(IU={}));(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 OS({position:Ws.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:Ws.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&Ws.isEqual(r.shear,s.shear)?void 0:s.shear})}n.diff=e})(R1||(R1={}));(t=>t.defaultData={horizontalConstraint:0,verticalConstraint:0})(kP||(kP={}));(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})(OU||(OU={}));(t=>t.defaultData={opacity:1,fill:{color:Vt.fromHexAndA(Er,1),enabled:!0},stroke:{color:Vt.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Vt.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Vt.from0to1([0,0,0,1]),enabled:!1,spread:0}})(I1||(I1={}));(s=>{function i(o,a){return{name:a}}s.newEmpty=i;function t(o,a){if(a===void 0)return o;let l={...o},c=["width","height","cornerRadius"];for(let u of c)u in l&&u in a&&a[u]!==void 0&&Object.assign(l,{[u]:a[u]});return l}function e(o,a){if(a===void 0)return o;let l={...o};return"fill"in l&&"fill"in a&&a.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...a.fill}}),"stroke"in l&&"stroke"in a&&a.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...a.stroke}}),"layerBlur"in l&&"layerBlur"in a&&a.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...a.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in a&&a.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...a.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in a&&a.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...a.dropShadow}}),"innerShadow"in l&&"innerShadow"in a&&a.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...a.innerShadow}}),l}function n(o,a){if(a===void 0)return o;let l={...o};return Object.assign(l,R1.merge(l,a)),l=t(l,a),l=e(l,a),l}s.patch=n;function r(o,a){let l,c=[];for(let[u,d]of Object.entries(a))u!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},c.push(l)),l.props[u]=d);return c}s.toOps=r})(nc||(nc={}));(t=>t.defaultData={...R1.defaultData,...kP.defaultData,states:new Fe,events:new Fe,visible:!0,raycastLock:!1})(sv||(sv={}));(t=>t.defaultData={...sv.defaultData,...I1.defaultData})(vf||(vf={}));(t=>t.defaultData={cornerRadius:[0,0,0,0]})(O1||(O1={}));(t=>t.defaultData={...vf.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(VP||(VP={}));(t=>t.defaultData={...vf.defaultData,...O1.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(bf||(bf={}));(t=>t.defaultData={...vf.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"})(zP||(zP={}));(t=>t.defaultData={...vf.defaultData,type:"path2d",path:"",name:"Path"})(GP||(GP={}));(t=>{function i(e){return e.type==="ellipse2d"||e.type==="rectangle2d"||e.type==="text2d"||e.type==="vector2d"||e.type==="path2d"}t.is=i})(DU||(DU={}));(t=>t.defaultData={...sv.defaultData,name:"Group",type:"group2d"})(ov||(ov={}));(t=>t.defaultData=()=>({...sv.defaultData,...O1.defaultData,...I1.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Vt.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Vt.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(jP||(jP={}));(s=>{function i(o){switch(o){case"rectangle2d":return{...bf.defaultData};case"ellipse2d":return{...VP.defaultData};case"text2d":return{...zP.defaultData};case"vector2d":return{...bf.defaultData};case"path2d":return{...GP.defaultData};case"frame2d":return{...jP.defaultData()};case"group2d":return{...ov.defaultData}}}s.defaultData=i;function t(o){return"width"in o&&"height"in o?[typeof o.width=="number"?o.width*.5:0,typeof o.height=="number"?o.height*.5:0]:[0,0]}s.getPivot=t;function e(o){return o.type==="rectangle2d"||o.type==="ellipse2d"||o.type==="text2d"||o.type==="frame2d"}s.isResizeable=e;function n(o){return o.type==="frame2d"&&o.autoLayout!==void 0}s.isAutoLayoutable=n;function r(o){return o.type==="rectangle2d"||o.type==="frame2d"}s.hasCorners=r})(rc||(rc={}));(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new Ln},e.emptyData=function(){return{type:"scene2d",objects:new Ln}}))(D1||(D1={}))});var NU=B(()=>{"use strict";VF();GF();rP();sP();OP();KC();lU();hP();xP();b1();iv();RP();v1();l1();oP();of();dP();wP();Ts();nv();tv();E1();bP();_1();T1();$F();vP();C1();S1();aP();lP();LU()});function oa(i,t=!1){let e=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Me,c=0;for(let u=0;u<i.length;++u){let d=i[u],h=0;if(e!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),h++}if(h!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[p]===void 0&&(o[p]=[]),o[p].push(d.morphAttributes[p])}if(t){let p;if(e)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,p,u),c+=p}}if(e){let u=0,d=[];for(let h=0;h<i.length;++h){let p=i[h].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+u);u+=i[h].attributes.position.count}l.setIndex(d)}for(let u in s){let d=BU(s[u]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,d)}for(let u in o){let d=o[u][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let h=0;h<d;++h){let p=[];for(let m=0;m<o[u].length;++m)p.push(o[u][m][h]);let f=BU(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 BU(i){let t,e,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(t===void 0&&(t=u.array.constructor),t!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(e===void 0&&(e=u.itemSize),e!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*e}let o=new t(s),a=new Ue(o,e,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let d=l/e;for(let h=0,p=u.count;h<p;h++)for(let f=0;f<e;f++){let m=u.getComponent(h,f);a.setComponent(h+d,f,m)}}else o.set(u.array,l);l+=u.count*e}return r!==void 0&&(a.gpuType=r),a}function FU(i,t=1e-4){t=Math.max(t,Number.EPSILON);let e={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],d=["getX","getY","getZ","getW"],h=["setX","setY","setZ","setW"];for(let v=0,b=a.length;v<b;v++){let x=a[v],S=i.attributes[x];l[x]=new S.constructor(new S.array.constructor(S.count*S.itemSize),S.itemSize,S.normalized);let E=i.morphAttributes[x];E&&(c[x]||(c[x]=[]),E.forEach((T,w)=>{let _=new T.array.constructor(T.count*T.itemSize);c[x][w]=new T.constructor(_,T.itemSize,T.normalized)}))}let p=t*.5,f=Math.log10(1/t),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=a.length;S<E;S++){let T=a[S],w=i.getAttribute(T),_=w.itemSize;for(let A=0;A<_;A++)x+=`${~~(w[d[A]](b)*m+g)},`}if(x in e)u.push(e[x]);else{for(let S=0,E=a.length;S<E;S++){let T=a[S],w=i.getAttribute(T),_=i.morphAttributes[T],A=w.itemSize,C=l[T],R=c[T];for(let D=0;D<A;D++){let O=d[D],L=h[D];if(C[L](o,w[O](b)),_)for(let F=0,j=_.length;F<j;F++)R[F][L](o,_[F][O](b))}}e[x]=o,u.push(o),o++}}let y=i.clone();for(let v in i.attributes){let b=l[v];if(y.setAttribute(v,new b.constructor(b.array.slice(0,o*b.itemSize),b.itemSize,b.normalized)),v in c)for(let x=0;x<c[v].length;x++){let S=c[v][x];y.morphAttributes[v][x]=new S.constructor(S.array.slice(0,o*S.itemSize),S.itemSize,S.normalized)}}return y.setIndex(u),y}var xf=B(()=>{q()});function Eee(i){let t=1/0,e=1/0,n=1/0,r=-1/0,s=-1/0,o=-1/0;for(let u=0;u<i.length;u+=3){let d=i[u],h=i[u+1],p=i[u+2];t=Math.min(t,d),e=Math.min(e,h),n=Math.min(n,p),r=Math.max(r,d),s=Math.max(s,h),o=Math.max(o,p)}let a=r-t,l=s-e,c=o-n;return{width:a,height:l,depth:c}}function Tee(i){let{userData:t,data:e}=i,n=e?.groups,r=e?.attributes??{},s=e?.morphAttributes??{},o=e?.interleavedBuffers,a=e?.arrayBuffers,l=e?.index,c;r.position!==void 0&&Array.isArray(r.position.array)&&(c=Eee(r.position.array));let u={...t===void 0?{}:t.parameters,data:{attributes:r,morphAttributes:s,interleavedBuffers:o,arrayBuffers:a},...c===void 0?{}:c,type:"NonParametricGeometry"};return l!==void 0&&Object.assign(u.data,{index:l}),n!==void 0&&Object.assign(u.data,{groups:n.map(d=>({...d,materialIndex:d.materialIndex??0}))}),u}function kU(i){let t=i.points.length/7,e=new Fe;for(let n=0;n<t;n++){let r=n*7,s=i.points[r+0],o=i.points[r+1],a=i.points[r+2],l=i.points[r+3],c=i.points[r+4],u=i.points[r+5],d=i.points[r+6];e.push({fi:n,id:ge.generateUUID(),data:{roundness:d,position:[s,o],areControlsDirectionsMirrored:!0,controlPrevious:{position:[a,l]},controlNext:{position:[c,u]}}})}return{points:e,isClosed:i.isClosed,roundness:i.roundness,shapeHoles:i.shapeHoles?.map(n=>kU(n))??[]}}function HP(i){let{userData:t,uuid:e,...n}=i;if(t===void 0||t.type==="NonParametricGeometry")return Tee(i);if(t.type==="SubdivGeometry"){let o="SubdivGeometry",a=n.data?.attributes;if(a?.positionWASM===void 0){let c=new Me;if(a?.position===void 0||a?.faceMap===void 0)return null;let u=a.position.array,d=a.faceMap.array,h=n.data.index.array;c.setAttribute("position",new Be(u,3)),c.setIndex(new Us(h,1));let p=FU(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++);a.indexWASM={array:f},a.positionWASM=p.attributes.position,a.verticesPerFaceWASM={array:m}}if(a?.positionWASM===void 0||a?.positionWASM.length===0||a?.indexWASM===void 0||a?.indexWASM.length===0||a?.verticesPerFaceWASM===void 0||a?.verticesPerFaceWASM.length===0)return null;let l={type:o,...Mee(a.positionWASM.array)};l.subdivisions=t.parameters.subdivisions;for(let c in a)c==="positionWASM"?l[c]=new Float32Array(a[c].array):c==="indexWASM"?l[c]=new Int32Array(a[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(a[c].array));return l.scaleBaked=[1,1,1],l}let r=t.type,s=t.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:kU(t.shape),type:r}):r==="LatheGeometry"?{...t.parameters,type:r,points:(t?.parameters.points??[]).map(o=>[o.x,o.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function Mee(i){return UU.setFromArray(i),UU.getSize(L1),{width:L1.x,height:L1.y,depth:L1.z}}var h0e,p0e,f0e,m0e,g0e,UU,L1,VU=B(()=>{an();q();xf();h0e=new te,p0e=new ke,f0e=new Ht,m0e=new M,g0e=new M,UU=new Nt,L1=new M});var N1,B1,zU=B(()=>{N1=(e=>(e.view="view",e.edit="edit",e))(N1||{});(t=>{function i(e){return e!=="view"}t.canWrite=i})(N1||(N1={}));B1=class extends Error{constructor(e,n){super(`This is a ${e.toUpperCase()} document, but it was opened as a ${n.toUpperCase()} one`);this.actual=e;this.expected=n;this.name="DocumentKindMismatchError"}}});function F1(i){return typeof i=="object"&&i!==null}function _ee(i){if(!F1(i))return null;let t=i;return F1(t.scene)?"3d":F1(t.scenes)&&F1(t.assets)?"2d":null}function GU(i){let t=_ee(i);if(t!=="3d")throw t!==null?new B1(t,"3d"):new Error("Not a Spline 3D document: the data has no `scene`, so it cannot be migrated")}var WP=B(()=>{"use strict";zU()});var jU=B(()=>{"use strict"});var _0e,HU=B(()=>{"use strict";an();iv();WP();_0e={...Yy,updateSchema(i){return GU(i),(i.schema??0)<132?cu(i,UP):(i.schema??0)-132},asyncKeys(){return[]}}});var P0e,R0e,WU=B(()=>{"use strict";of();P0e=new Set(["type","category","visible","noiseType","isMask","bumpMap","roughnessMap",...sf]),R0e=new Set(p1)});var pt=B(()=>{NU();jU();aU();iv();HU();WP();LP();WU();C1();an()});function qU(i){for(let t of Aee)i.enable(t)}var Aee,cs,Sf,XU,YU,aa=B(()=>{Aee=[3,4,8,9];cs=5,Sf=3,XU=32,YU=.98});var ja,wf=B(()=>{"use strict";q();ja=i=>{var t;return t=class extends i{},t.geometryHelper=new ni(30,30,30),t}});var k1,qP,$U,Ha,Ef=B(()=>{"use strict";q();k1=new Hi,qP=new nr,$U=new te,Ha=(i,t,e,n,r=!1,s=i)=>{let o=t,a=s.matrixWorld;if(o.boundingSphere===null&&o.computeBoundingSphere(),qP.copy(o.boundingSphere),qP.applyMatrix4(a),e.ray.intersectsSphere(qP)===!1||($U.copy(a).invert(),k1.copy(e.ray).applyMatrix4($U),o.boundingBox!==null&&k1.intersectsBox(o.boundingBox)===!1))return;let l,c,u,d,h=o.index,p=o.attributes.position,f=o.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,k1,p,c,u,d),l){l.faceIndex=Math.floor(m/3),n.push(l);return}}else{let b=o.attributes.position,x=new M,S=new M,E=new M,T=new M,w=2,A=1/((s.scale.x+s.scale.y+s.scale.z)/3),C=A*A,R=Math.max(0,f.start),D=Math.min(b.count,f.start+f.count);for(let O=R,L=D-1;O<L;O+=w){if(x.fromBufferAttribute(b,O),S.fromBufferAttribute(b,O+1),k1.distanceSqToSegment(x,S,T,E)>C)continue;T.applyMatrix4(s.matrixWorld);let j=e.ray.origin.distanceTo(T);j<e.near||j>e.far||n.push({distance:j,point:E.clone().applyMatrix4(s.matrixWorld),object:i})}}function y(v,b,x,S,E,T,w){let _=new M,A=new M,C=new M,R=new M,D=new M;if(_.fromBufferAttribute(S,E),A.fromBufferAttribute(S,T),C.fromBufferAttribute(S,w),x.intersectTriangle(_,A,C,!1,R)===null)return null;D.copy(R),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 Cee,KU,Pee,ZU,So,av=B(()=>{"use strict";q();wf();Ef();Cee=new M(1,1,1),KU=new M,Pee=new M,ZU=new ke,So=class extends ja(Sy){constructor(e,n=15){super(n);this.object=e;this.dummy=new Bs;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,n){Ha(this.object,So.geometryHelper,e,n,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(KU,ZU,Pee),this.matrix.compose(KU,ZU,Cee),super.updateMatrixWorld(e)}updateWorldMatrix(e,n){}}});var Xd,Yd,vu,JU,Ree,Iee,QU,lv,ek=B(()=>{"use strict";q();Xd=new M,Yd=new M,vu=new te,JU=[new M(-1,1,1),new M(-1,-1,1),new M(1,-1,1),new M(1,1,1),new M(-1,1,-1),new M(-1,-1,-1),new M(1,-1,-1),new M(1,1,-1)],Ree=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],Iee=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],QU=(i,t,e)=>{i.updateEntityBoxSize(Xd,Yd),vu.copy(t).multiply(i.matrixWorld),Yd.x===0&&Yd.y===0&&Yd.z===0?e.push(new M(Xd.x,Xd.y,Xd.z).applyMatrix4(vu)):JU.forEach(n=>{e.push(n.clone().multiply(Yd).add(Xd).applyMatrix4(vu))})},lv=class extends Nt{constructor(){super(...arguments);this.matrix=new te;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 te().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,n)}expandByObjectSize(e,n,r=!1){let s=[];if(r===!0){let o=[];e.traverseEntity(a=>{if(a.visible||a.cloner&&a.data.visible){if(!("geometry"in a)){vu.copy(n).multiply(a.matrixWorld),o.push(new M().applyMatrix4(vu));return}QU(a,n,s)}}),s.length===0&&s.push(...o)}else QU(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(vu.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(Yd).multiplyScalar(.5),this.getCenter(Xd),vu.copy(this.matrix).setPosition(Xd),this.vertices=JU.map(e=>e.clone().multiply(Yd).applyMatrix4(vu))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=Ree.map(([e,n])=>new ri(this.vertices[e],this.vertices[n])),this.centerEdges=this.edges.map(e=>e.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=Iee.map(([e,n])=>this.vertices[e].clone().add(this.vertices[n]).multiplyScalar(.5))}}});var wo,cv=B(()=>{"use strict";wo={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function bu(i){return i?.isParticleSystem===!0}function la(i){return i?.isHairSystem===!0}function Xi(i){return i?.isShapeBlendEntity===!0}function $d(i){return i?.isPathObject===!0}function Rr(i){return i?.isObject2D===!0}function vr(i){return i?.isUIObject===!0}function tk(i){return typeof i=="object"&&i!==null&&"booleanOp"in i}function ic(i){return i?.isCloner===!0}function Wa(i){return i?.isClone===!0}function Tf(i){return i?.isComponentObject===!0}var fr=B(()=>{});function Mt(i){rk.add(i)}function ik(i){return rk.has(i)}function Jn(i,t){let e=`${i}:${t}`;nk.has(e)||nk.add(e)}function Kd(i,t){sk.set(i,t)}function V1(i){return sk.get(i)}function Eo(i,t){ok.set(i,t)}function z1(i){return ok.get(i)}function uv(i,t){ak.set(i,t)}function G1(i){return ak.get(i)}function lk(i){YP=i,XP!==null&&i.setHanaUIWasmUrl(XP)}function ck(i){XP=i,YP?.setHanaUIWasmUrl(i)}function dv(){return YP}var rk,nk,sk,ok,ak,YP,XP,Qt=B(()=>{rk=new Set;nk=new Set;sk=new Map,ok=new Map;ak=new Map;YP=null,XP=null});function uk(i){let t=i.elements;qa.set(t[0],t[1],t[2]),Xa.set(t[4],t[5],t[6]),sc.set(t[8],t[9],t[10])}function Dee(i,t){i.set(1,0,0).cross(t),i.lengthSq()<=H1&&i.set(0,1,0).cross(t),i.normalize()}function dk(){let i=Math.max(qa.lengthSq(),Xa.lengthSq(),sc.lengthSq());qa.lengthSq()>H1*i?To.copy(qa).normalize():To.set(1,0,0),Mo.crossVectors(sc,To),Mo.lengthSq()<=H1*i&&(Mo.copy(Xa).addScaledVector(To,-Xa.dot(To)),Mo.lengthSq()<=H1*i&&Dee(Mo,To)),Mo.normalize(),Mf.crossVectors(To,Mo)}function Lee(){let i=qa.length(),t=Xa.length(),e=sc.length(),n=Math.max(i,t,e);if(n-i>j1||n-t>j1||n-e>j1)return!0;let r=j1*n*n;return Math.abs(qa.dot(Xa))>r||Math.abs(qa.dot(sc))>r||Math.abs(Xa.dot(sc))>r}function hk(i,t,e){return uk(i),dk(),t.makeBasis(To,Mo,Mf),e.set(To.dot(qa),To.dot(Xa),To.dot(sc),0,Mo.dot(qa),Mo.dot(Xa),Mo.dot(sc),0,Mf.dot(qa),Mf.dot(Xa),Mf.dot(sc),0,0,0,0,1),Lee()}function pk(i){return uk(i),dk(),Oee.makeBasis(To,Mo,Mf)}var qa,Xa,sc,To,Mo,Mf,Oee,H1,j1,$P=B(()=>{"use strict";q();qa=new M,Xa=new M,sc=new M,To=new M,Mo=new M,Mf=new M,Oee=new te,H1=1e-12,j1=.01});var KP,oc,_f,Af=B(()=>{"use strict";q();$P();KP=new te;(t=>{function i(e){return e&&e.__isSPEObject}t.is=i})(oc||(oc={}));_f=i=>class extends i{constructor(){super(...arguments);this.previousModelViewMatrix=new te;this.copyPreviousMatrix=!0;this.hiddenMatrix=new te;this.pivotMatrix=new te;this.matrixWorldRigid=new te;this.shearScale=new te;this.shearScaleInv=new te}get __isSPEObject(){return!0}getPhysicsLocalMatrix(n){return this.rigidBody?.isDynamic()?(n.copy(this.matrixWorld),this.hasNonUniformScale&&n.multiply(this.shearScaleInv),this.parent&&n.premultiply(KP.copy(this.parent.matrixWorld).invert()),n.premultiply(KP.copy(this.hiddenMatrix).invert()),n.multiply(KP.copy(this.pivotMatrix).invert()),!0):!1}isDescendantOf(n){n instanceof Zt&&(n=n.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===n)return!0;r=r.parent}return!1}updateMatrixWorld(n){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,n=!0);for(let r of this.children)r.updateMatrixWorld(n)}updateWorldMatrix(n,r){let s=this.parent;if(n&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),r)for(let o of this.children)o.updateWorldMatrix(!1,!0)}traverseChildren(n,r=0){for(let s of this.children)oc.is(s)&&s.traverseObject(n,r+1)}traverseObject(n,r=0){if(n(this,r)!==!0)for(let o of this.children)oc.is(o)&&o.traverseObject(n,r+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=hk(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 te().copy(this.matrixWorld).invert();return n.parent!==null&&(n.parent.updateWorldMatrix(!0,!1),s.multiply(n.parent.matrixWorld)),"hiddenMatrix"in n&&n.hiddenMatrix instanceof te?n.hiddenMatrix.premultiply(s):n.applyMatrix4(s),n.updateWorldMatrix(!1,!1),this.add(n),r!==void 0&&(this.children.pop(),this.children.splice(r,0,n)),this}copy(n,r=!1){return super.copy(n,r),this.hasNonUniformScale=n.hasNonUniformScale,this}onAfterRender(n,r,s,o,a,l){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function gk(i,t,e){return Zd.subVectors(t,i),q1.subVectors(t,e),Zd.cross(q1).length()<=W1}function X1(i){let t=yk.get(i.points);if(t!==void 0&&t.isClosed===i.isClosed)return t.curve;let e=Nee(i);return yk.set(i.points,{isClosed:i.isClosed,curve:e}),e}function Nee(i){let t=i.points,e=[t[0]],n=[new M(...t[0].data.position)];Cf.copy(n[0]);for(let f=0;f<t.length-1;f++)Zd.fromArray(t[f].data.position),q1.fromArray(t[f+1].data.position),hv.subVectors(Zd,Cf),pv.subVectors(Zd,q1),hv.cross(pv).length()>W1&&(e.push(t[f]),n.push(new M().copy(Zd)),Cf.copy(Zd));let r=t[t.length-1];e.push(r),n.push(new M(...r.data.position));let s=i.isClosed,o=e.length-(s?0:1),a=e.length,l=[],c=[];for(let f=0;f<a;f++){let m=e[f].data;l.push(new M(...m.controlPrevious.position)),c.push(new M(...m.controlNext.position))}let u=[];for(let f=0;f<o;f++){let m=f===a-1?0:f+1;u.push(gk(n[f],c[f],n[m])&&gk(n[f],l[m],n[m]))}let d=[];for(let f=0;f<a;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===a-1))continue;let v=s&&f==0?a-1:f-1,b=s&&f==a-1?0:f+1,x=new M().subVectors(n[v],g).normalize(),S=new M().subVectors(n[b],g).normalize();y.prevDir=x,y.nextDir=S;let E=u[s&&f===0?a-1:f-1],T=u[f];if(E&&T){Pf.addVectors(x,S).normalize();let w=Cf.crossVectors(Pf,x).length()/x.dot(Pf);y.tan=w,y.removedLength=m.roundness/w}}for(let f=0;f<o;f++){let m=f,g=s&&f===a-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*a).fill(null);for(let f=0;f<o;f++){let m=f,g=s&&f===a-1?0:f+1,y=d[m],v=d[g],b=null;if(!u[f])y.position.distanceTo(v.position)>W1&&(b=new Kc(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(Cf.copy(y.nextDir).setLength(y.removedLength)),v.prevDir&&S.add(Cf.copy(v.prevDir).setLength(v.removedLength))),x.distanceTo(S)>W1&&(b=new Kc(x,x.clone().lerp(S,.3),S.clone().lerp(x,.3),S))}h[2*f+1]=b}for(let f=0;f<a;f++){let 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;Pf.addVectors(m.prevDir,m.nextDir).normalize(),hv.copy(y).lerp(v,.5);let x=y.distanceTo(v)/2;mk.copy(Pf).multiplyScalar(Math.sqrt(Math.pow(b,2)-Math.pow(x,2))).add(hv),ZP.copy(Pf).multiplyScalar(-b).add(mk);let S=g.distanceTo(ZP)/g.distanceTo(hv);pv.copy(m.prevDir).multiplyScalar(S*g.distanceTo(y)).add(g),fk.copy(pv).lerp(ZP,2);let E=y.clone().lerp(pv,4/3),T=v.clone().lerp(fk,4/3);h[2*f]=new Kc(y,E,T,v)}let p=new QP;for(let f=0;f<h.length;f++){let m=h[f];m&&p.add(m)}return p}var QP,W1,Zd,q1,Cf,Pf,hv,ZP,pv,fk,mk,yk,JP=B(()=>{"use strict";q();QP=class extends bp{constructor(){super()}getPoints(t=12){let e=[],n,r=this.getCurveLengths(),o=r[r.length-1]/r.length;for(let a=0,l=this.curves;a<l.length;a++){let c=l[a],u=a===0?r[a]:r[a]-r[a-1],d=Math.ceil(t*u/o),h=c.getPoints(d);for(let p=0;p<h.length;p++){let f=h[p];n&&n.equals(f)||(e.push(f),n=f)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}},W1=.001,Zd=new M,q1=new M,Cf=new M,Pf=new M,hv=new M,ZP=new M,pv=new M,fk=new M,mk=new M;yk=new WeakMap});function bk(i){let t=i%1;return t<0?t+1:t===0&&i>0?1:t}function xk(i,t,e,n){vk.setFromRotationMatrix(fv.extractRotation(n));let r=i.clone().applyMatrix4(fv.copy(n).invert().multiply(e));if(t===null)e2.setFromRotationMatrix(fv.extractRotation(e));else{let o=t.clone().applyMatrix4(fv.extractRotation(e));e2.setFromRotationMatrix(fv.lookAt(Fee.set(0,0,0),o,Uee))}let s=new M().setFromEuler(Bee.setFromQuaternion(vk.invert().multiply(e2))).multiplyScalar(ge.RAD2DEG);return{position:r,rotation:s}}var fv,vk,e2,Bee,Fee,Uee,Sk=B(()=>{"use strict";q();fv=new te,vk=new ke,e2=new ke,Bee=new Ht,Fee=new M,Uee=new M(0,1,0)});var Ot,Ya,kee,Vee,Y1,wk,t2,Ek,Tk,Rf,Yi=B(()=>{"use strict";q();pt();ek();an();cv();fr();Qt();Af();JP();Sk();dn();(t=>{function i(e){return e&&e.__isEntity}t.is=i})(Ot||(Ot={}));Ya=i=>Ot.is(i),kee={type:"completeState",isfromEntity:!0},Vee=["x","y","z"],Y1=new M,wk=new M(1,1,1),t2=new ke,Ek=new Ht,Tk=new te,Rf=i=>class extends _f(i){constructor(){super(...arguments);this.raycastLock=!1;this.scaleLock=!1;this.disposed=!1;this.stateSelection=null;this.destroyedInAction=!1;this.instances=[];this.prevState=null;this.currentState=null;this.currentAnimationAction=null;this.reversibleToState=null;this.transitionState={settled:!0,state:null};this.currentTransitionEvent=null;this.previousAction=null;this._singleBBox=new lv;this._recursiveBBox=new lv;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this._needApplyPathSnapping=!0;this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(n){let r=this.children[n];if(Ot.is(r))return r}entityChildrenCount(){let n=this.children.length;for(;n--;)if(Ot.is(this.children[n]))return n+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let n=this;for(;n.data.type!=="Instance";){let r=n.parent;if(Ot.is(r))n=r;else return}return n}forInstancesRec(n){this.instances.forEach(r=>{r.disposed||n(r),r.forInstancesRec(n)})}super_Entity(n,r){typeof n=="string"&&(this.uuid=n),this.identity=n,this.data=r,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(n,r,s=!1){if(!(this.data.states.length===0&&!s)){for(let o of this.data.states)ia.toOps(this.data,o.data).forEach(l=>{let c=Qp.replaceProps(l,this.data);this.dataPatched=this.data,this.updateByPatchedOp(c,this.data,r)});if(n!==null){let o=this.data.states.data(n);o&&(this.dataPatched=ia.patch(this.data,o),ia.toOps(this.data,o).forEach(l=>{this.updateByPatchedOp(l,this.dataPatched,r)}))}s&&this.updateTransformState(this.dataPatched,r),this.stateSelection=n,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(n,r){n.setScalar(0),r.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(n=>{Ya(n)&&n.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(n=>{n.resetBBoxNeedsUpdateSelf()})}find(n){let r;return this.traverseEntity(s=>{s.uuid===n&&(r=s)}),r}traverseSortNextHelper(){let n=this.parent;if(n){let r=n.children,s=r.indexOf(this)+1;if(Ot.is(r[s]))return r[s];if(Ot.is(n))return n.traverseSortNextHelper()}}sortNext(){let n=this.children;return this.children.length>0&&Ot.is(this.children[0])?n[0]:this.traverseSortNextHelper()}goUp(n){let r=this;for(;n>0&&r!==null;)r=r.parent,n-=1;return r}hasAnccestorOrSelf(n){return this===n||this.hasAnccestor(n)}hasAnccestor(n){let r=this.parent;for(;r;){if(n===r)return!0;r=r.parent}return!1}countToAccestor(n){let r=0,s=this;for(;s!==n;){if(s===null)return-1;s=s.parent,r+=1}return r}forEachEntity(n){for(let r of this.children)Ya(r)&&n(r)}traverseEntityAncestors(n){this.traverseAncestors(r=>{Ot.is(r)&&n(r)})}traverseConcreteEntity(n,r=0){if(n(this,r)!==!0)for(let o of this.children)Ya(o)&&o.isConcreteEntity&&o.traverseEntity(n,r+1)}traverseEntity(n,r=0){if(n(this,r)!==!0)for(let o of this.children)Ya(o)&&o.traverseEntity(n,r+1)}traverseVisibleEntity(n){n(this);for(let r of this.children)Ya(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=>Ya(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*ge.RAD2DEG,this.rotation.y*ge.RAD2DEG,this.rotation.z*ge.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return zy(r,n)}getTransformValues(n,r,s){return r[n].map((o,a)=>s?.shared.getVariable(o,[this.uuid,n,Vee[a]])??o)}updateTransformState(n,r){let s=!1;if(n.position&&(this.position.fromArray(this.getTransformValues("position",n,r)),s=!0),n.rotation&&(Y1.fromArray(this.getTransformValues("rotation",n,r)).multiplyScalar(ge.DEG2RAD),this.rotation.setFromVector3(Y1),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??pu.identity)),n.pivot!==void 0||n.pivotRotation!==void 0){if(s=!0,n.pivot!==void 0&&n.pivotRotation!==void 0)this.pivotMatrix.compose(Y1.fromArray(n.pivot).negate(),t2.setFromEuler(Ek.fromArray(n.pivotRotation.map(o=>o*ge.DEG2RAD))).invert(),wk);else if(n.pivot!==void 0)this.pivotMatrix.setPosition(-n.pivot[0],-n.pivot[1],-n.pivot[2]);else if(n.pivotRotation!==void 0){let o=Y1.setFromMatrixPosition(this.pivotMatrix);t2.setFromEuler(Ek.fromArray(n.pivotRotation.map(a=>a*ge.DEG2RAD))).invert(),this.pivotMatrix.compose(o,t2,wk)}}return s&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(o=>{o.invalidateClonerTransform(this)})),n.position&&n.rotation&&n.scale&&n.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),s}onVariableUpdate(n=!1){if(n){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)}),this.requestRender()}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let n of this.children)Ot.is(n)&&n.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(n=>{Ot.is(n)&&n.disposeRecursively()})}toState(n=[]){let r={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(n)};return zy(r,n)}updateByObjUpdateOp(n,r){n!==void 0&&this.updateByOp({type:0,props:n,path:[]},{...this.data,...n},r,!1)}updateByOp(n,r,s,o){let a=this.data;this.data=r;let l=n,c=$t(n.path,["states","*"]);if(c!==null){if(n.type===0){let[u]=c;if(this?.stateSelection===u){let d={...n.props};if(delete d.name,Object.values(n.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let p=rr.zoom(h,n.path.slice(2));if(p)for(let f in n.props)n.props[f]===void 0&&f in p&&(d[f]=p[f])}}l={...n,props:d,path:n.path.slice(2)}}}}else if(n.type===0){let u=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(u!==void 0){if(n.props.name!==void 0&&u.name){let{name:h,...p}=u;u=p}if(n.props.material!==void 0&&"material"in u){let{material:h,...p}=u;u=p}let d=rr.removeOverridden(n.path,n.props,u);l={...n,props:d}}}if(this.updateByPatchedOpBase(l,ia.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(Fa.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=hf.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 yo.rootOverrideProps)h in n.props&&(d===void 0&&(d={}),d[h]=n.props[h]);d&&(u={...n,props:d})}else for(let d of yo.rootOverrideProps)if($t(n.path,[d])){u=n;break}u!==void 0&&this.instances.forEach(d=>{if(d.isInstanceRoot){let h=Fa.filterOp(d.overrideData,u);h&&d.updateByOp(h,wr.applySimple(d.data,h),s,!0)}}),this.instances.forEach(d=>{if(!d.isInstanceRoot){let h=Fa.filterOp(d.overrideData,n);if(h){let p;a===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&&!ta.is(n.props.type)&&wo.changeEntityProptotype(this,r,s);else if(n.path.length===1&&n.path[0]==="geometry"&&n.type===0&&"type"in n.props){wo.changeEntityProptotype(this,r,s);for(let o of this.children)Ot.is(o)&&o.updateVisible(s.scene)}this.updateByPatchedOp(n,r,s)}updateByPatchedOp(n,r,s){if(n.path.length===0&&n.type===0?this.updateState(n.props,s):n.type===0&&("resolutionLevel"in n.props||"useChildrenColors"in n.props)&&this.updateState(r,s),n.path[0]==="morphTargetInfluences"&&n.type===0){let a=r.morphTargetInfluences.get(n.path[1])?.data.name;a&&this.updateMorphInfluences(a,s.shared.getVariable(n.props.value,[this.uuid,"morphTargetInfluences",a]))}if($t(n.path,["pathSnapping"])!==null&&this.updatePathSnapping(r.pathSnapping),$t(n.path,["cloner"])!==null){let o=wr.drop(n,1);o.path.length===0&&o.type===0&&o.props.disabled===!0?this.setFromClonerState(null,s):this.cloner?this.cloner.updateState(r.cloner,s):(this.setFromClonerState(r.cloner,s),this.expandCloner(s)),this.updateVisible(s.scene)}}updatePathSnapping(n=this.dataPatched.pathSnapping){this._updatedPathSnapping=n,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(n){if(this._needApplyPathSnapping===!1)return;let r=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,s=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,o=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(r===null)return;let l=n.find(r);if(!l)return;this._needApplyPathSnapping=!1;let c=l.data;if(c.geometry.path.points.length<=1)return;let u=X1(c.geometry.path),d=bk(s+o),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?Tk.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix):Tk.copy(this.hiddenMatrix),f=xk(h,a==="tangential"?u.getTangentAt(d):null,l.matrixWorld,p);this.updateTransformState({position:f.position.toArray(),rotation:f.rotation.toArray()}),this.traverseEntity(m=>{m._cameraType&&m.dispatchEvent(kee)})}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=>ic(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(wo.Cloner===null){Jn("cloners","a cloner");return}this.cloner=new wo.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 $1,_o,xu=B(()=>{"use strict";q();Yi();(t=>t.is=e=>"objectHelper"in e)($1||($1={}));_o=(i,t)=>class extends Rf(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 Wl&&(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 Wl&&(s.visible=!1)}}}});var us,mv=B(()=>{"use strict";q();av();xu();us=class extends _o(Bs,So){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 ca(i,t,e,n,r,s,o){K1.set(r,s,o).unproject(n);let a=t[i];if(a!==void 0){let l=e.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],K1.x,K1.y,K1.z)}}var K1,Ao,n2,Z1,Mk=B(()=>{"use strict";q();wf();Ef();K1=new M,Ao=new Ss,n2=class extends Fl{constructor(e){let n=new Me,r=new ks({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Ye(15711266),c=new Ye(15711266),u=new Ye(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),o.push(f.r,f.g,f.b),a[p]===void 0&&(a[p]=[]),a[p].push(s.length/3-1)}n.setAttribute("position",new Be(s,3)),n.setAttribute("color",new Be(o,3));super(n,r);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,n=this.pointMap,r=!0;Ao.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=r?.8:1e-4;ca("n1",n,e,Ao,-s,-o,a),ca("n2",n,e,Ao,s,-o,a),ca("n3",n,e,Ao,-s,o,a),ca("n4",n,e,Ao,s,o,a);let l=a;ca("f1",n,e,Ao,-s,-o,l),ca("f2",n,e,Ao,s,-o,l),ca("f3",n,e,Ao,-s,o,l),ca("f4",n,e,Ao,s,o,l);let c=l,u=.5;ca("u1",n,e,Ao,s*.7*u,o*1.1,c),ca("u2",n,e,Ao,-s*.7*u,o*1.1,c),ca("u3",n,e,Ao,0,o*(1.1+.9*u),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};Z1=class extends ja(n2){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){Ha(this.object,this.geometry,e,n,!0)}}});function _k(i){return 1-Math.pow(1-i,3)}var Q1,If,r2,i2,s2,gv,o2,$a,rn,Xs=B(()=>{"use strict";q();Mk();pt();xu();dn();Q1=790;If=new M,r2=new M,i2=new ke,s2=new M,gv=new M,o2=new M,$a=class extends _o(Ss,Z1){constructor(e="",n={...jd.defaultData,name:""}){super();this._cameraType="OrthographicCamera";this.targetOffset=na.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=$a.projectionTransitionRequestRender??e.requestRender;this.updateProjectionMatrix(),n?.()};this.super_Entity(e,n),this.previousProjectionMatrix=new te,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let r=this.width,s=this.height;this.orthoCamera=new $o(r*-.5,r*.5,s*.5,s*-.5,-5e4,1e4),this.perspCamera=new Yo(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=$a.projectionTransitionsEnabled;$a.projectionTransitionsEnabled=!1;try{return e()}finally{$a.projectionTransitionsEnabled=n}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,n){e==="PerspectiveCamera"?this.perspCamera.near=n:this.orthoCamera.near=n}setZoom(e,n){n>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=n:this.orthoCamera.zoom=n)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,n,r){typeof e=="number"&&(e=new M(e,n,r)),super.lookAt(e),this.getWorldPosition(If),this.targetOffset=If.distanceTo(e)}getTarget(e=new M){return this.getWorldDirection(r2),this.getWorldPosition(If),r2.multiplyScalar(this.targetOffset),e.copy(If).add(r2),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(If),If.distanceTo(e)}updateUp(){this.getWorldQuaternion(i2),s2.set(0,0,1).applyQuaternion(i2),gv.copy(Zt.DEFAULT_UP),this.isUpVectorFlipped&&gv.negate(),gv.applyQuaternion(i2),o2.copy(Zt.DEFAULT_UP).projectOnPlane(s2),this.angleOffsetFromUp=o2.angleTo(gv),this.angleOffsetFromUp*=o2.cross(gv).dot(s2)>=0?1:-1}updateTransformState(e,n){let r=super.updateTransformState(e,n);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),r}getViewFrontToObject(e){let n=e.getWorldPosition(new M),s=e.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:n.clone().add(s),target:n}}getViewToTarget(e){let r=this.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:e.clone().sub(r),target:e}}getViewToObject(e){let n=new M;return e.getWorldPosition(n),this.getViewToTarget(n)}setViewplaneSize(e,n,r=!1){if(this.aspect=e/n,r){let s=e>n?this.aspect:1,o=e>n?1:this.aspect;this.left=-Q1*.5*s,this.right=Q1*.5*s,this.top=Q1*.5*(1/o),this.bottom=-Q1*.5*(1/o)}else this.left=-e*.5,this.right=e*.5,this.top=n*.5,this.bottom=-n*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let e=this._projectionTransition;if(e===void 0)return 1;let n=(performance.now()-e.start)/e.duration;return n>=1?1:n<=0?0:_k(n)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return $a.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=$a.projectionTransitionMinAgeMs}_beginProjectionTransition(e){let n=this._projectionTransition;n===void 0&&(n={from:new te,blend:new te,blendInverse:new te,start:0,duration:$a.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:e},this._projectionTransition=n),n.from.copy(this.projectionMatrix),n.start=performance.now(),n.duration=$a.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=_k(n),s=e.from.elements,o=this._activeSubCamera.projectionMatrix.elements,a=e.blend.elements,l=e.referenceDepth,c=Math.max(1e-6,s[15]-s[11]*l),u=Math.max(1e-6,o[15]-o[11]*l),d=r*c/(r*c+(1-r)*u);for(let h=0;h<16;h++)a[h]=s[h]+(o[h]-s[h])*d;e.blendInverse.copy(e.blend).invert(),this.projectionMatrix=e.blend,this.projectionMatrixInverse=e.blendInverse}_endProjectionTransition(){let e=this._projectionTransition;if(e===void 0)return;e.raf!==0&&cancelAnimationFrame(e.raf),this._projectionTransition=void 0;let n=this._activeSubCamera;this.projectionMatrix=n.projectionMatrix,this.projectionMatrixInverse=n.projectionMatrixInverse}_syncProjectionTransition(e){let n=e._projectionTransition;if(n===void 0){this._projectionTransition!==void 0&&this._endProjectionTransition();return}let r=this._projectionTransition;r===void 0?(r={from:new te,blend:new te,blendInverse:new te,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=r):r.raf!==0&&(cancelAnimationFrame(r.raf),r.raf=0),r.requestRender=void 0,r.from.copy(n.from),r.start=n.start,r.duration=n.duration,r.referenceDepth=n.referenceDepth,this._applyProjectionTransition()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,n,r,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,n,r,s,o,a):this.orthoCamera.setViewOffset(e,n,r,s,o,a),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,n){return super.copy(e,n),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=na.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 zy(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=na.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}}},rn=$a;rn.projectionTransitionsEnabled=!1,rn.projectionTransitionDuration=350,rn.projectionTransitionMinAgeMs=1e3});function J1(i){return i.type==="TorusGeometry"&&i.arc===360}var Ak,a2,yv,Of=B(()=>{"use strict";q();Ak=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??n),s=Math.abs(e.depth??n),o=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(e,{width:n,height:r,depth:s,radius:o,segments:Math.round(e.segments),pathSegments:Math.round(e.pathSegments),cornerSegments:Math.round(e.cornerSegments)})}}static build(i){let{width:t,height:e,depth:n,radius:r,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:d}=i.parameters,h=new yv(!1,t,e,n,r,s,o,a,l,c,u,d);return Object.assign(h,{userData:{...i,type:"HelixGeometry"}})}},a2=new Us([0,0,0],1);yv=class extends Me{constructor(t=!0,e=1,n=1,r=1,s=1,o=1,a=1,l=1,c=1,u=1,d=1,h=1){if(super(),o===0)return;let p=t&&o===1;p&&(h=0),d>100&&(d=100),d===0&&(h=0);let f=()=>new M,m=new M,g=f(),y=f(),v=f(),b,x,S,E,T,w,_,A,C=f(),R=f(),D=f(),O=f(),L=f(),F=f(),j=f(),W=f(),K=n-2*l+.001,Y=K/o,$=Math.ceil(a*o),ee=$+1,oe=K/$,ae=-K/2,de=u+1,be=2*Math.PI/u,Re=Math.PI/2/h,me=.01,Ae=Math.min((1-d/100)*l,l-me),Le=l-Ae,Ie=0,Ge=2,Ve=h*Ge+Ge,pe=de*Ve/Ge,Ne=pe+de*ee,we=Math.max(0,de*(ee+Ve)),[$e,nt,Ce]=[3,3,2].map(ye=>Array(we*ye).fill(0)),je=[],V=s-l;function _e(ye,Oe){let le=Math.PI/2;w=Oe*oe,A=2*Math.PI*(w%Y)/Y+le,w+=ae,_=Math.sin(A)*V,T=Math.cos(A)*V,t?ye.set(T,_,w):ye.set(T,w,_)}_e(m,-1e-10),_e(g,0),C.copy(m),_e(m,1);let X=m.distanceTo(g),ct=p?0:Le+Ae,lt=X*$+2*ct,z=Ae,I=lt-ct;for(let ye=0;ye<=$;ye++){_e(y,ye),W.subVectors(y,C).normalize(),C.copy(y),F.copy(y).setComponent(+t+1,0).normalize(),j.crossVectors(W,F).normalize();let Oe=ye===0,le=ye===$,xe=Oe?3*Math.PI/2:Re,Xe=Oe?z:I,xt=Oe?de:Ne,Ze=Oe?0:we-de,He=W.clone().multiplyScalar(Oe?-Le:Le).add(y),et=W.clone().multiplyScalar(Oe?-1:1).normalize();for(let yt=0;yt<de;yt++){let Ut=yt*be;if(R.addVectors(m.copy(F).multiplyScalar(l*Math.cos(Ut)),g.copy(j).multiplyScalar(l*Math.sin(Ut))),D.copy(R).normalize(),Oe||le){p||(Ie=Ze+yt,[0,1,2].forEach(Q=>{$e[Ie*3+Q]=He.getComponent(Q),nt[Ie*3+Q]=et.getComponent(Q)}),Ce[Ie*2]=+le,Ce[Ie*2+1]=yt/u),g.copy(D).multiplyScalar(Ae),v.addVectors(y,g);for(let Q=0;Q<h;Q++){let We=Q*Re+xe;O.addVectors(m.copy(W).multiplyScalar(Le*Math.sin(We)),g.copy(D).multiplyScalar(Le*Math.cos(We))),L.copy(O).normalize(),g.addVectors(v,O),O.normalize(),Ie=xt+Q*de+yt,[0,1,2].forEach(qe=>{$e[Ie*3+qe]=g.getComponent(qe),nt[Ie*3+qe]=L.getComponent(qe)});let Se=+Oe+Math.sin(We);Ce[Ie*2]=(Xe+Le*Se)/lt,Ce[Ie*2+1]=yt/u}}g.addVectors(y,R),Ie=pe+ye*de+yt,[0,1,2].forEach(Q=>{$e[Ie*3+Q]=g.getComponent(Q),nt[Ie*3+Q]=D.getComponent(Q)}),Ce[Ie*2]=(ct+ye*X)/lt,Ce[Ie*2+1]=yt/u}}let Z=ee+2*h+Ge,[re,he]=[+p,Z-1];for(let ye=re;ye<=he-1;ye++){let Oe=p&&ye===he-1;for(let le=0;le<de-1;le++)b=ye*de+le,x=b+1,S=(Oe?le:b)+de,E=(Oe?le+1:x)+de,ye===0?je.push(x,E,S):ye===Z-2?je.push(b,x,S):je.push(b,x,S,x,E,S)}this.setIndex(je),this.setAttribute("position",new Be($e,3)),this.setAttribute("normal",new Be(nt,3)),this.setAttribute("uv",new Be(Ce,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t=this.userData.parameters,e=Math.ceil(t.tubularSegments),n=t.radialSegments,r=n+1,s=[],o,a,l,c;for(let u=1;u<e;u++)for(let d=0;d<n;d++)o=u*r+d,a=o+1,l=o+r,c=a+r,s.push(o,a,l,a,c,l);for(let u=0;u<n;u++)o=e*r+u,a=o+1,l=u+r,c=u+1+r,s.push(o,a,l,a,c,l);return a2.array=new Uint32Array(s),a2.count=s.length,a2}}});function Pk(i){if(ew)return ew;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.78/build"),s=import("./boolean.js"),[o,a]=await Promise.all([s,fetch(`${n}/boolean.wasm`).then(l=>l.arrayBuffer())]);await o.default({module_or_path:a}),vv=o}return ew=t(),ew}function nw(){if(vv===void 0)throw new Error("boolean-wasm is not loaded");return vv}function l2(i){let t=tw.get(i);if(t===void 0)throw new Error("Unknown csg mesh set handle "+i);return t}function c2(i){return tw.set(++Ck,i),Ck}function Hee(i,t){if(t&&i.userData.positions!==void 0){let a=i.userData,l=[];for(let c=0,u=0;c<a.verticesPerFace.length;c++){let d=a.verticesPerFace[c];for(let h=1;h<d-1;h++)l.push(a.indices[u],a.indices[u+h],a.indices[u+h+1]);u+=d}return{positions:a.positions instanceof Float32Array?a.positions:new Float32Array(a.positions),indices:new Uint32Array(l)}}let e;J1(i.userData.parameters)?e=i.getClosedTorusIndicesForBooleanOrSubdiv():e=i.getIndex();let n=i.getAttribute("position"),r;if(e===null){r=new Uint32Array(n.count);for(let a=0;a<r.length;a++)r[a]=a}else e.array instanceof Uint32Array?r=e.array:r=new Uint32Array(e.array);let s=i.getAttribute("normal"),o=s!==void 0&&s.itemSize===3&&s.count===n.count&&s.array instanceof Float32Array&&s.isInterleavedBufferAttribute!==!0?s.array:void 0;return{positions:n.array,indices:r,normals:o}}function Rk(i,t,e){if(vv===void 0)return-1;let{positions:n,indices:r,normals:s}=Hee(i,t);return c2(new vv.CsgMesh(n,r,s))}function Ik(i,t){let e=nw(),n=jee[t];if(n===void 0)throw new Error("Unknown boolean operation "+t);let r=i.map(l2);if(r.length===1)return e.clone_mesh(r[0]);let s=[],o;if(t===2&&r.length>2){let a=r[0];for(let l=1;l<r.length-1;l++)a=e.boolean_mesh(a,r[l],0),s.push(a);o=e.boolean_mesh(r[r.length-1],a,2)}else if(t===2)o=e.boolean_mesh(r[1],r[0],2);else{let a=r[r.length-1];for(let l=0;l<r.length-1&&(a=e.boolean_mesh(a,r[l],n),s.push(a),a.tri_count()!==0);l++);o=a,s.pop()}for(let a of s)a.free();return o}function Ok(i,t,e,n){let r=nw(),s=Ik(i,t),o=r.mesh_render_data(s,Math.max(n,0));if(e.setAttribute("position",new Be(o.positions(),3)),e.setAttribute("normal",new Be(o.normals(),3)),o.free(),e.boundingSphere===null&&(e.boundingSphere=new nr),s.tri_count()===0)e.boundingSphere.center.set(0,0,0),e.boundingSphere.radius=0,e.userData.parameters={width:0,height:0,depth:0};else{let a=s.bounds();e.boundingSphere.center.set(a[0],a[1],a[2]),e.boundingSphere.radius=(a[3]**2+a[4]**2+a[5]**2)**.5,e.userData.parameters={width:a[3]*2,height:a[4]*2,depth:a[5]*2}}return c2(s)}function Dk(i,t){let e=nw(),n=Ik(i,t),r=e.mesh_topological_data(n),s=r.positions(),o=r.indices();r.free(),n.free();let a=new Uint8Array(o.length/3).fill(3);return{positions:s,indices:o,verticesPerFace:a}}function rw(i,t){l2(i).transform(new Float32Array(t.elements))}function iw(i){let t=tw.get(i);t!==void 0&&(t.free(),tw.delete(i))}function Lk(i,t){let e=nw();return c2(e.instanced_union(l2(i),t))}var vv,tw,Ck,ew,jee,bv=B(()=>{q();Of();tw=new Map,Ck=0;jee={[0]:0,[1]:1,[2]:2}});function Qd(i){return i!==null&&"booleanOp"in i}var Df,Nk=B(()=>{"use strict";q();Yi();bv();Df=class extends Rf(Gt){constructor(){super(...arguments);this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new te}updateVisible(e){super.updateVisible(e),this.visible=!Qd(this.parent)&&this.visible,Qd(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Qd(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(iw(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Qd(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof Df&&(e.freeBooleanPointer(),Qd(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,n){let r=super.updateTransformState(e,n);return r&&Qd(this.parent)&&this.invalidateDownstreamBooleanData(!0),r}onVariableUpdate(e=!1){super.onVariableUpdate(e),Qd(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}});function Bk(){return Wee}var Wee,Fk=B(()=>{"use strict";Wee=null});function xv(i,t=0,e=i.count,n,r){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let d=t;d<e;d++){let h=i.getX(d),p=i.getY(d),f=i.getZ(d);h<s&&(s=h),p<o&&(o=p),f<a&&(a=f),h>l&&(l=h),p>c&&(c=p),f>u&&(u=f)}sw.min.set(s,o,a),sw.max.set(l,c,u),sw.getCenter(n),sw.getSize(r).multiplyScalar(.5)}var sw,qee,Xee,Kt,ii=B(()=>{"use strict";q();Nk();Fk();sw=new Nt;qee=new Me,Xee=new ti,Kt=class extends Df{constructor(t,e){super(qee,Xee),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){if(this.raycastDeformed(t,e))return;let n=Bk();if(n!==null){n(this,t,e);return}super.raycast(t,e)}raycastDeformed(t,e){return!1}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?xv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}}});function Jd(i){return i?.isClassicNodeMaterial===!0}function Uk(i){return i?.isClassicSharedMaterial===!0}var ow=B(()=>{"use strict"});var gn,Co=B(()=>{q();gn=class extends Ye{constructor(e,n,r,s){super(e,n,r);this.isColorA=!0;this.a=s}setRGBA(e,n,r,s){super.setRGB(e,n,r),this.a=s}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,n="srgb"){let r;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(r=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=o==="rgba"?parseFloat(s[4]):1,super.setStyle(e,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=o==="hsla"?parseFloat(s[4]):1,super.setStyle(e,n);break}}return super.setStyle(e,n)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}}});var ac,d2=B(()=>{"use strict";Co();ac=class extends gn{}});var aw,kk=B(()=>{"use strict";aw=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 Vk(i){return typeof i=="string"?i:(Sv||(Sv=new h2),Sv.load(i))}function zk(){Sv&&Sv.disposeAll()}var h2,Sv,p2=B(()=>{kk();h2=class extends aw{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}});var lw,cw,f2=B(()=>{"use strict";lw=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")}},cw=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 uw,Gk=B(()=>{q();uw=class extends uy{constructor(t){super(t),this.type=pr}parse(t){let o=function(w,_){switch(w){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(_||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(_||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(_||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(_||""))}},u=`
4138
4138
  `,d=function(w,_,A){_=_||1024;let R=w.pos,D=-1,O=0,L="",F=String.fromCharCode.apply(null,new Uint16Array(w.subarray(R,R+128)));for(;0>(D=F.indexOf(u))&&O<_&&R<w.byteLength;)L+=F,O+=F.length,R+=128,F=String.fromCharCode.apply(null,new Uint16Array(w.subarray(R,R+128)));return-1<D?(A!==!1&&(w.pos+=O+D+1),L+F.slice(0,D)):!1},h=function(w){let _=/^#\?(\S+)/,A=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,C=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,R=/^\s*FORMAT=(\S+)\s*$/,D=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,O={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},L,F;for((w.pos>=w.byteLength||!(L=d(w)))&&o(1,"no header found"),(F=L.match(_))||o(3,"bad initial token"),O.valid|=1,O.programtype=F[1],O.string+=L+`
4139
4139
  `;L=d(w),L!==!1;){if(O.string+=L+`
4140
4140
  `,L.charAt(0)==="#"){O.comments+=L+`
4141
- `;continue}if((F=L.match(A))&&(O.gamma=parseFloat(F[1])),(F=L.match(C))&&(O.exposure=parseFloat(F[1])),(F=L.match(R))&&(O.valid|=2,O.format=F[1]),(F=L.match(D))&&(O.valid|=4,O.height=parseInt(F[1],10),O.width=parseInt(F[2],10)),O.valid&2&&O.valid&4)break}return O.valid&2||o(3,"missing format specifier"),O.valid&4||o(3,"missing image size specifier"),O},p=function(w,_,A){let C=_;if(C<8||C>32767||w[0]!==2||w[1]!==2||w[2]&128)return new Uint8Array(w);C!==(w[2]<<8|w[3])&&o(3,"wrong scanline width");let R=new Uint8Array(4*_*A);R.length||o(4,"unable to allocate buffer space");let D=0,O=0,L=4*C,F=new Uint8Array(4),j=new Uint8Array(L),W=A;for(;W>0&&O<w.byteLength;){O+4>w.byteLength&&o(1),F[0]=w[O++],F[1]=w[O++],F[2]=w[O++],F[3]=w[O++],(F[0]!=2||F[1]!=2||(F[2]<<8|F[3])!=C)&&o(3,"bad rgbe scanline format");let K=0,Y;for(;K<L&&O<w.byteLength;){Y=w[O++];let ee=Y>128;if(ee&&(Y-=128),(Y===0||K+Y>L)&&o(3,"bad scanline data"),ee){let oe=w[O++];for(let ae=0;ae<Y;ae++)j[K++]=oe}else j.set(w.subarray(O,O+Y),K),K+=Y,O+=Y}let $=C;for(let ee=0;ee<$;ee++){let oe=0;R[D]=j[ee+oe],oe+=C,R[D+1]=j[ee+oe],oe+=C,R[D+2]=j[ee+oe],oe+=C,R[D+3]=j[ee+oe],D+=4}W--}return R},f=function(w,_,A,C){let R=w[_+3],D=Math.pow(2,R-128)/255;A[C+0]=w[_+0]*D,A[C+1]=w[_+1]*D,A[C+2]=w[_+2]*D,A[C+3]=1},m=function(w,_,A,C){let R=w[_+3],D=Math.pow(2,R-128)/255;A[C+0]=Fs.toHalfFloat(Math.min(w[_+0]*D,65504)),A[C+1]=Fs.toHalfFloat(Math.min(w[_+1]*D,65504)),A[C+2]=Fs.toHalfFloat(Math.min(w[_+2]*D,65504)),A[C+3]=Fs.toHalfFloat(1)},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,T;switch(this.type){case qt:T=x.length/4;let w=new Float32Array(T*4);for(let A=0;A<T;A++)f(x,A*4,w,A*4);S=w,E=qt;break;case pr:T=x.length/4;let _=new Uint16Array(T*4);for(let A=0;A<T;A++)m(x,A*4,_,A*4);S=_,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:Pa,minFilter:ht,magFilter:ht,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function m2(i){return i.length>2&&i[0]===35&&i[1]===63}function jk(i){try{let t=new uw().parse(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength));if(!t||!t.width||!t.height)return null;let{width:e,height:n}=t,r=t.data,s=new Uint16Array(r.length),o=e*4,a=u=>Fs.toHalfFloat(Math.pow(Math.max(Fs.fromHalfFloat(u),0),1/2.2)),l=new Map,c=u=>{let d=l.get(u);return d===void 0&&(d=a(u),l.set(u,d)),d};for(let u=0;u<n;u++){let d=u*o,h=(n-1-u)*o;for(let p=0;p<o;p+=4)s[h+p]=c(r[d+p]),s[h+p+1]=c(r[d+p+1]),s[h+p+2]=c(r[d+p+2]),s[h+p+3]=r[d+p+3]}return{isSplineHdr:!0,data:s,width:e,height:n}}catch{return null}}function Hk(i){let t=new Wn(i.data,i.width,i.height,Xn,pr);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var Wk=B(()=>{"use strict";q();Gk()});var Yee,Lf,g2=B(()=>{"use strict";q();p2();f2();Wk();Yee=0,Lf=class extends lw{constructor(e,n){super(e,n.imageHolderCache);this.data=e;this.shared=n;this.instanceId=++Yee;this.loaded=!1;this.isVideo=!1;this.isBuffer=!1;this.isHdr=!1;this._cache={[1e3]:{},[1001]:{},[1002]:{}};this.isVideo=e.type==="video",this.isBuffer=e.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let n=()=>{this.loaded=!0;for(let r of Object.values(this._cache))for(let s of Object.values(r))for(let o of Object.values(s))o&&(o.image=this.img,o.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof e!="string"){let r=new FileReader;r.readAsDataURL(new Blob([e],{type:"video/mp4"}));let s;await new Promise(o=>{r.onloadend=a=>{s=a.target?.result,o(null)}}),this.img.src=s}else this.img.src=e;this.img.onloadeddata=()=>{n()}}else if(e instanceof Uint8Array?m2(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&&m2(r)?jk(r):null;s!==null&&(this.isHdr=!0,this.img=s,n())}else this.img=new Image,this.img.src=Vk(e),this.img.onload=n,await new Promise(r=>{this.img.onload=()=>{n(),r(null)}})}getTexture(e,n=1008,r=1006){let s=this._cache[e]?.[n]?.[r];if(s)return s;{let o;return this.isBuffer?o=this.img.texture:this.isVideo?o=new ty(this.img,void 0,e,e):this.isHdr?(o=Hk(this.img),o.wrapS=e,o.wrapT=e,o.magFilter=r,o.minFilter=n):o=new mn(this.img,void 0,e,e,r,n),this.isBuffer||(o.anisotropy=8,o.generateMipmaps=n===1008),this.loaded&&(o.needsUpdate=!0),this._cache[e]===void 0&&(this._cache[e]={}),this._cache[e][n]===void 0&&(this._cache[e][n]={}),this._cache[e][n][r]=o,o}}setNeedsUpdate(e){if(!this.isBuffer)for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let s of Object.values(r))s&&(s.needsUpdate=e)}disposeTextures(){for(let[e,n]of Object.entries(this._cache))for(let[r,s]of Object.entries(n))for(let[o,a]of Object.entries(s))a?.dispose(),this._cache[e]!==void 0&&this._cache[e][r]!==void 0&&(this._cache[e][r][o]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}});var Ys,dw=B(()=>{"use strict";g2();Ys=class extends Lf{}});function Xk(i){if(typeof i=="string")return i;let t=qk.get(i);return t||(t={url:URL.createObjectURL(new Blob([i]))},qk.set(i,t)),t.url}var qk,Yk=B(()=>{"use strict";qk=new Map});function Qk(){if($k)return;if(hw)return hw;async function i(){await import("./howler.js"),Kk(window!==void 0?window:global),$k=!0}return hw=i(),hw}var Kk,Zk,$k,hw,y2=B(()=>{Zk=new Promise(i=>{Kk=i}),$k=!1});function Jk(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 tV(i){let t=!1,e=[];return i.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((s,o)=>{if(o.events===void 0||Array.isArray(o.events)===!1)return!0;Jk(o.events,e),t=t||e.some(a=>a.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;Jk(r.events,e),t=t||e.some(s=>s.data.type==="Audio")}),t}var eV,lc,pw=B(()=>{Yk();y2();Zk.then(i=>eV=i);lc=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:Xk(t),format:"wav"},this.sound=new eV.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 rV(i){nV=i}function iV(){return nV}function v2(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 nV,fw=B(()=>{nV=null});function sV(i){return new G(i.y,-i.x)}var mw,wv,Ev=B(()=>{"use strict";q();mw=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=ge.clamp(r.thetaLength,0,360),r.hollow=ge.clamp(r.hollow??0,0,1);let s=r.width/2,o=r.radiusTop??s,a=r.radiusBottom??s;if(o===a?(o=s,a=s):o>a?(o=s,a=a*s/o):(o=o*s/a,a=s),r.shapeBlendNode){o=e??s,a=n??s;let l=Math.max(o,a)*2;r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:o,radiusBottom:a})}}static build(i){let{width:t,depth:e,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:u,cornerRadius:d,cornerSegments:h,hollow:p}=i.parameters,f;l===0?(f=new Me,f.setAttribute("position",new Be([],3))):d||p?f=new wv(c,u,n,r,s,o,a,l*Math.PI/180,d,d,h,p):f=new Ia(c,u,n,r,s,o,a,l*Math.PI/180);let m=e/t;return m!==1&&f.scale(1,1,m),Object.assign(f,{userData:{...i,type:"CylinderGeometry"}})}};wv=class extends Me{constructor(t,e,n,r,s,o,a,l,c,u,d,h,p=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,n=n||1,r=Math.floor(r)||8,s=Math.floor(s)||1,o=o!==void 0?o:!1,a=a!==void 0?a:0,l=l!==void 0?l:Math.PI*2,o&&(c=0,u=0);let f=n/2;p&&t==0&&(t=c),p&&e==0&&(e=u);let m=new G(t,f),g=new G(e,-f),y=null,v=null,b=null,x=null,S=m.clone().sub(g),E=0,T=0,w=0;h>0&&(E=Math.min(t,e)*(1-h),T=t-E,w=e-E);let _=m.clone();_.x-=E;let A=Math.PI-S.angle(),C=S.angle(),R=Math.tan(C/2),D=Math.tan(A/2),O=R+D,L=h?O:D,F=h?O:R;if(c=Math.min(c,(t-T)/L,S.length()/O),u=Math.min(u,(e-w)/F,S.length()/O),c>0){let Ce=c/R;y=m.clone().sub(new G(Ce,c)),h&&(b=y.clone(),b.x-=E-O*c),m.sub(S.clone().setLength(Ce))}if(u>0){let Ce=u/D;v=g.clone().sub(new G(Ce,-u)),g.add(S.clone().setLength(Ce)),h&&(x=v.clone(),x.x-=E-O*u,_.sub(S.clone().setLength(Ce)))}S=m.clone().sub(g);let j=S.length()<.5,W=[],K=[],Y=[],$=[],ee=[],oe=[],ae=(Ce,je,V,_e,X)=>{for(let ct=0;ct<d+1;ct++){let lt=ct/d,z=_e<0?lt:1-lt;X&&(z-=1),z*=Ce;let I=Math.sin(z),Z=Math.cos(z)*_e,re=Z*je+V.y;W.push(I*je+V.x),K.push(re),Y.push(I),$.push(Z),ee.push(.5+re/n),oe.push(!1)}},de=(Ce,je,V)=>{let _e=[Ce,je];V<0&&_e.reverse();for(let X of _e)W.push(X),K.push(f*V),Y.push(0),$.push(V),ee.push(.5),oe.push(!0)};if(x&&v?(ae(A,u,x,-1,!0),ae(C,u,v,-1,!1)):v?(de(v.x,0,-1),ae(C,u,v,-1,!1)):o||de(e,w,-1),!j){let Ce=sV(S).normalize();for(let je=0;je<=s;je++){let V=je/s,_e=S.y*V+g.y;W.push(S.x*V+g.x),K.push(_e),Y.push(Ce.x),$.push(Ce.y),ee.push(.5+_e/n),oe.push(!1)}}if(b&&y?(ae(A,c,y,1,!1),ae(C,c,b,1,!0)):y?(ae(A,c,y,1,!1),de(y.x,0,1)):o||de(t,T,1),h&&!j){let Ce=sV(S).multiplyScalar(-1).normalize();for(let je=0;je<=s;je++){let V=je/s,_e=S.y*-V+_.y;W.push(S.x*-V+_.x),K.push(_e),Y.push(Ce.x),$.push(Ce.y),ee.push(.5+_e/n),oe.push(!1)}}let be=W.length,me=be+(h&&!o?1:0),Ae=(Ce,je)=>Ce*be+(je===be?0:je),Le=l<Math.PI*2,Ie=(r+1)*be+(Le?2*(1+me):0),Ge=new Float32Array(Ie*3),Ve=new Float32Array(Ie*3),pe=new Float32Array(Ie*2),Ne=Ie-1>65535?new Uint32Array(r*Math.max(0,me-1)*6+(Le?2*(me+1)*3:0)):new Uint16Array(r*Math.max(0,me-1)*6+(Le?2*(me+1)*3:0)),we=0,$e=0;for(let Ce=0;Ce<=r;Ce++){let je=Ce/r,V=je*l+a,_e=Math.sin(V),X=Math.cos(V);for(let ct=0;ct<be;ct++){let lt=$e*3,z=$e*2,I=W[ct],Z=Y[ct];Ge[lt]=I*_e,Ge[lt+1]=K[ct],Ge[lt+2]=I*X,Ve[lt]=Z*_e,Ve[lt+1]=$[ct],Ve[lt+2]=Z*X,oe[ct]?(pe[z]=.5,pe[z+1]=.5):(pe[z]=je,pe[z+1]=ee[ct]),$e++}}for(let Ce=0;Ce<r;Ce++)for(let je=0;je<me-1;je++){if(o&&h&&je==s)continue;let V=Ae(Ce,je),_e=Ae(Ce+1,je),X=Ae(Ce+1,je+1),ct=Ae(Ce,je+1),lt=Ge[X*3+0],z=Ge[X*3+2];Ne[we++]=V,Ne[we++]=_e,Ne[we++]=ct,(lt!=0||z!=0)&&(Ne[we++]=_e,Ne[we++]=X,Ne[we++]=ct)}Le&&(nt(-1,0,a),nt(1,r*be,a+l)),this.setIndex(new Ue(Ne.slice(0,we),1)),this.setAttribute("position",new Ue(Ge,3)),this.setAttribute("normal",new Ue(Ve,3)),this.setAttribute("uv",new Ue(pe,2));function nt(Ce,je,V){let _e=Math.sin(V),X=Math.cos(V),ct=-X,lt=_e,z=Ce<0?(ye,Oe,le)=>{Ne[we++]=ye,Ne[we++]=Oe,Ne[we++]=le}:(ye,Oe,le)=>{Ne[we++]=ye,Ne[we++]=le,Ne[we++]=Oe},I=(t+e+T+w)/4,Z=$e*3,re=$e*2;Ge[Z]=I*_e,Ge[Z+1]=0,Ge[Z+2]=I*X,Ve[Z]=ct,Ve[Z+1]=0,Ve[Z+2]=lt,pe[re]=.5,pe[re+1]=.5;let he=$e++;for(let ye=0;ye<me;ye++){let Oe=(je+(ye===be?0:ye))*3;Z=$e*3,re=$e*2,Ge[Z]=Ge[Oe],Ge[Z+1]=Ge[Oe+1],Ge[Z+2]=Ge[Oe+2],Ve[Z]=ct,Ve[Z+1]=0,Ve[Z+2]=lt;let le=Oe/3*2|0;pe[re]=pe[le],pe[re+1]=pe[le+1],$e++}for(let ye=he+1;ye<$e-1;ye++)z(he,ye,ye+1);z(he,$e-1,he+1)}}}});var oV,b2=B(()=>{"use strict";q();Ev();oV=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=ge.clamp(e.thetaLength,0,360),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,depth:e,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:u,cornerSegments:d}=i.parameters,h;l===0?(h=new Me,h.setAttribute("position",new Be([],3))):c>0||u>0||l<360?h=new wv(0,t/2,n,r,s,o,a,l*Math.PI/180,c,u,d,0,!0):h=new Ul(t/2,n,r,s,o);let p=e/t;return p!==1&&h.scale(1,1,p),Object.assign(h,{userData:{...i,type:"ConeGeometry"}})}}});var aV,x2,S2,w2=B(()=>{"use strict";q();aV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,widthSegments:r,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a===0?c=new ni(t,e,n,r,s,o):c=new S2(t,e,n,r,s,o,a,l),Object.assign(c,{userData:{...i,type:"CubeGeometry"}})}},x2=Math.PI/2,S2=class extends Me{constructor(t=1,e=1,n=1,r=1,s=1,o=1,a=0,l=4){super(),this.type="BoxGeometry",r=Math.floor(r),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,t/2,e/2,n/2);let c=a>0,u=l+1,h=2*((o+1)*(s+1)+(r+1)*(o+1)+(r+1)*(s+1))+(c?u*4*(o+1+(r+1)+(s+1))+8*(u*(u+1)/2):0),p=2*(o*s+r*o+r*s)+(c?l*4*(o+r+s):0),f=c?8*l*l:0,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),T=new Float64Array(u),w=new Float64Array(u);for(let L=0;L<u;L++){let F=L/l*x2;S[L]=Math.sin(F)*a,E[L]=(1-Math.cos(F))*a,T[L]=Math.sin(F),w[L]=Math.cos(F)}let _=u*(u+1)/2,A=new Float64Array(_*3),C=new Float64Array(_*3);{let L=new M(t/2,e/2,n/2);L.subScalar(a);let F=0;for(let j=0;j<=l;j++){let W=x2*(1-j/l),K=Math.cos(W),Y=Math.sin(W),$=0;for(let ee=0;ee<=j;ee++){let oe=Math.cos($),ae=Math.sin($),de=K*oe,be=Y,Re=K*ae;A[F*3]=de,A[F*3+1]=be,A[F*3+2]=Re,C[F*3]=L.x+de*a,C[F*3+1]=L.y+be*a,C[F*3+2]=L.z+Re*a,F++,$+=x2/j}}}R("z","y","x",-1,-1,n,e,t,o,s),R("z","y","x",1,-1,n,e,-t,o,s),R("x","z","y",1,1,t,n,e,r,o),R("x","z","y",1,-1,t,n,-e,r,o),R("x","y","z",1,-1,t,e,n,r,s),R("x","y","z",-1,-1,t,e,-n,r,s),a>0&&(D("z","y","x",-1,-1,1,n,e,t,o),D("z","y","x",1,-1,-1,n,e,t,o),D("z","y","x",-1,1,-1,n,e,t,o),D("z","y","x",1,1,1,n,e,t,o),D("x","y","z",-1,-1,-1,t,e,n,r),D("x","y","z",1,-1,1,t,e,n,r),D("x","y","z",-1,1,1,t,e,n,r),D("x","y","z",1,1,-1,t,e,n,r),D("y","x","z",-1,-1,1,e,t,n,s),D("y","x","z",1,-1,-1,e,t,n,s),D("y","x","z",1,1,1,e,t,n,s),D("y","x","z",-1,1,-1,e,t,n,s),O(1,1,1),O(-1,1,1),O(1,-1,1),O(-1,-1,1),O(1,1,-1),O(-1,1,-1),O(1,-1,-1),O(-1,-1,-1)),this.setIndex(new Ue(v,1)),this.setAttribute("position",new Ue(m,3)),this.setAttribute("normal",new Ue(g,3)),this.setAttribute("uv",new Ue(y,2));function R(L,F,j,W,K,Y,$,ee,oe,ae){let de=(Y-2*a)/oe,be=($-2*a)/ae,Re=Y/2-a,me=$/2-a,Ae=ee/2,Le=oe+1,Ie=ae+1,Ge=0,Ve=new M;for(let pe=0;pe<Ie;pe++){let Ne=pe*be-me;for(let we=0;we<Le;we++){let $e=we*de-Re,nt=(b+Ge)*3,Ce=(b+Ge)*2;Ve[L]=$e*W,Ve[F]=Ne*K,Ve[j]=Ae,m[nt]=Ve.x,m[nt+1]=Ve.y,m[nt+2]=Ve.z,Ve[L]=0,Ve[F]=0,Ve[j]=ee>0?1:-1,g[nt]=Ve.x,g[nt+1]=Ve.y,g[nt+2]=Ve.z,y[Ce]=we/oe,y[Ce+1]=1-pe/ae,Ge+=1}}for(let pe=0;pe<ae;pe++)for(let Ne=0;Ne<oe;Ne++){let we=b+Ne+Le*pe,$e=b+Ne+Le*(pe+1),nt=b+(Ne+1)+Le*(pe+1),Ce=b+(Ne+1)+Le*pe;v[x++]=we,v[x++]=$e,v[x++]=Ce,v[x++]=$e,v[x++]=nt,v[x++]=Ce}b+=Ge}function D(L,F,j,W,K,Y,$,ee,oe,ae){let de=($-2*a)/ae,be=$/2-a,Re=ee/2-a,me=oe/2,Ae=ae+1,Le=0,Ie=new M,Ge=new M;for(let Ve=0;Ve<l+1;Ve++){Ie[F]=(Re+S[Ve])*K,Ie[j]=(me-E[Ve])*Y,Ge[L]=0,Ge[F]=T[Ve]*Math.sign(Ie[F]),Ge[j]=w[Ve]*Math.sign(Ie[j]);for(let pe=0;pe<Ae;pe++){let Ne=pe*de-be;Ie[L]=Ne*W;let we=(b+Le)*3,$e=(b+Le)*2;m[we]=Ie.x,m[we+1]=Ie.y,m[we+2]=Ie.z,g[we]=Ge.x,g[we+1]=Ge.y,g[we+2]=Ge.z,y[$e]=pe/ae,y[$e+1]=0,Le+=1}}for(let Ve=0;Ve<l;Ve++)for(let pe=0;pe<ae;pe++){let Ne=b+pe+Ae*Ve,we=b+pe+Ae*(Ve+1),$e=b+(pe+1)+Ae*(Ve+1),nt=b+(pe+1)+Ae*Ve;v[x++]=Ne,v[x++]=we,v[x++]=nt,v[x++]=we,v[x++]=$e,v[x++]=nt}b+=Le}function O(L,F,j){let K=L*F*j>0?($,ee,oe)=>{v[x++]=$,v[x++]=ee,v[x++]=oe}:($,ee,oe)=>{v[x++]=$,v[x++]=oe,v[x++]=ee},Y=b;for(let $=0;$<_;$++){let ee=$*3,oe=b*3,ae=b*2;m[oe]=L*C[ee],m[oe+1]=F*C[ee+1],m[oe+2]=j*C[ee+2],g[oe]=L*A[ee],g[oe+1]=F*A[ee+1],g[oe+2]=j*A[ee+2],y[ae]=0,y[ae+1]=0,b++}for(let $=0;$<l;$++){let ee=Y+$*($+1)/2,oe=Y+($+1)*($+2)/2;K(ee,oe+1,oe);for(let ae=1;ae<=$;ae++)K(ee+ae-1,ee+ae,oe+ae),K(ee+ae,oe+ae+1,oe+ae)}}}}});var Su,E2=B(()=>{"use strict";q();Su=class extends Me{constructor(t=[],e=[],n="",r=1,s=.2,o=4){super(),this.type="PolyhedronGeometryRound";let a,l,c,u=0;d(),h(),this.setAttribute("position",new Ue(new Float32Array(a.subarray(0,u)),3)),this.setAttribute("normal",new Ue(new Float32Array(l.subarray(0,u)),3)),this.setAttribute("uv",new Ue(new Float32Array(c.subarray(0,u/3*2)),2));return;function d(){s=Math.min(1-1e-5,s),s==0&&(o=0);let f={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[n],m=new M,g=m.clone(),y=new In,v=s*r,b=r-v,x=o+1,S=new M,E=(pe,Ne)=>S.subVectors(pe,Ne).normalize(),T=(pe,Ne)=>Array(pe).fill(void 0).map(Ne),w=T(t.length/3,(pe,Ne)=>new M().fromArray(t,Ne*3).setLength(r)),_=[],A=1e6;for(let pe=0;pe<w.length;pe++){let Ne=w[pe],we=[],$e,nt,Ce,je=1e10,V=-1;for(;(V=e.indexOf(pe,V+1))!=-1;){let lt=V-V%3;$e=e[lt+(V+1)%3],nt=e[lt+(V+2)%3],Ce=Ne.distanceToSquared(w[$e]),je=Math.min(je,Ce),we.push([$e,nt,Ce])}je+=1e-6;let _e=[],X=0,ct=we.length;for(let lt=0;lt<ct;lt++){[$e,nt,Ce]=we[X];let z=_[$e]?.includes(pe)==!0;Ce<=je&&_e.push($e+ +z*A),X=we.findIndex(I=>I[0]==nt)}_.push(_e)}let C=[];{let pe=0,Ne=0,we,$e,nt=f==3;for(let Ce=0;Ce<=o;Ce++){we=Ce*(Ce+1)/2,$e=(Ce+1)*(Ce+2)/2;for(let je=0;je<o-Ce;je++)[pe,Ne]=[we+je+Ce+2,$e+je+Ce+3],C.push(we,$e,...nt?[Ne,we]:[pe,$e],Ne,pe),[we,$e]=[pe,Ne];C.push(we,$e,we+o+2)}}let R=0;for(let pe=0;pe<_.length;pe++)for(let Ne=0;Ne<f;Ne++)_[pe][Ne]<A&&R++;let D=w.length*f*C.length*3,O=R*x*6*3,L=R*2*3*3,F=D+O+L;a=new Float64Array(F),l=new Float64Array(F),c=new Float64Array(F/3*2);let j=(pe,Ne,we)=>{let $e=u/3*2;c[$e]=Math.atan2(we,-pe)/2/Math.PI+.5,c[$e+1]=1-(Math.atan2(-Ne,Math.sqrt(pe*pe+we*we))/Math.PI+.5)},W=pe=>{a[u]=pe.x,a[u+1]=pe.y,a[u+2]=pe.z,l[u]=S.x,l[u+1]=S.y,l[u+2]=S.z,j(pe.x,pe.y,pe.z),u+=3},K=pe=>{a[u]=pe[0].x,a[u+1]=pe[0].y,a[u+2]=pe[0].z,l[u]=pe[1].x,l[u+1]=pe[1].y,l[u+2]=pe[1].z,j(pe[0].x,pe[0].y,pe[0].z),u+=3},Y=(o+2)*(o+3)/2,$=new Float64Array(Y*3),ee=new Float64Array(Y*3),oe=new Float64Array(Y*2),ae=T(f*2*x,()=>new M),de=T(o*Math.max(0,o-1)/2,()=>new M),be=m.clone(),Re=m.clone(),me=m.clone(),Ae=m.clone(),Le=m.clone(),Ie=[],Ge=T(w.length,()=>T(f,()=>m.clone()));for(let pe=0;pe<w.length;pe++){m.copy(w[pe]).normalize(),be.copy(m).multiplyScalar(b);let Ne=_[pe];for(let _e=0;_e<Ne.length;_e++){let X=Ne[_e],ct=Ne[(_e+1)%f];y.setFromPointsAndIndices(w,pe,X%A,ct%A),y.b.sub(y.a).setLength(1e10).add(y.a),y.c.sub(y.a).setLength(1e10).add(y.a),y.closestPointToPoint(be,Ge[pe][_e])}let we=0,$e=[],nt=[],Ce=new M;o==0&&[...Ge[pe]].reduce((_e,X)=>_e.add(X),Ce).multiplyScalar(1/f);for(let _e=0;_e<f;_e++){let X=[],ct=(_e-1+f)%f,lt=Ge[pe][ct],z=Ge[pe][_e];m.copy(lt).sub(be),g.copy(z).sub(be);let I=be.angleTo(m),Z=m.angleTo(g),re=Math.cos(I)*v;o==0?Re.copy(Ce):Re.copy(be).setLength(b+re),$e.push(re);let he=[Re,lt,z];for(let ye=0;ye<2;ye++){let Oe=he[ye],le=he[ye+1];Ae.subVectors(Oe,be),Le.subVectors(le,be),me.crossVectors(Ae,Le).normalize();for(let xe=0;xe<x;xe++){let Xe=[I,Z][ye]*xe/x;m.copy(Ae).applyAxisAngle(me,Xe).add(be),ae[we++].copy(m),ye&&(E(m,be),X.push([xe==0?Oe:m.clone(),S.clone()]))}ye&&(E(le,be),X.push([le,S.clone()]))}nt.push(X)}Ie.push(nt);let je=2*x,V=2;for(let _e=0;_e<f;_e++){let X=je*_e,ct=je*((_e+1)%f),lt=0,z=[ae[X]];for(let I=1;I<x;I++){let Z=ae[X+I],re=ae[ct+I];z.push(Z);for(let he=1,ye=I-V+1;he<=ye;he++)m.lerpVectors(Z,re,he/(ye+1)),m.sub(be).setLength($e[_e]).add(be),z.push(de[lt++].copy(m));z.push(re)}for(let I=0;I<x;I++)z.push(ae[I+x+X]);z.push(ae[ct+x]);for(let I=0,Z=z.length;I<Z;I++){let re=z[I],he=I*3,ye=I*2;$[he]=re.x,$[he+1]=re.y,$[he+2]=re.z,E(re,be),ee[he]=S.x,ee[he+1]=S.y,ee[he+2]=S.z,oe[ye]=Math.atan2(re.z,-re.x)/2/Math.PI+.5,oe[ye+1]=1-(Math.atan2(-re.y,Math.sqrt(re.x*re.x+re.z*re.z))/Math.PI+.5)}for(let I=0,Z=C.length;I<Z;I++){let re=C[I]*3,he=C[I]*2,ye=u/3*2;a[u]=$[re],a[u+1]=$[re+1],a[u+2]=$[re+2],l[u]=ee[re],l[u+1]=ee[re+1],l[u+2]=ee[re+2],c[ye]=oe[he],c[ye+1]=oe[he+1],u+=3}}}let Ve=[];for(let pe=0;pe<_.length;pe++)for(let Ne=0;Ne<f;Ne++){let we=_[pe][Ne];if(we<A){let $e=_[we].findIndex(je=>je%A==pe),nt=Ie[pe][Ne],Ce=Ie[we][$e];for(let je=0;je<x;je++){let V=nt[je],_e=Ce[x-je],X=nt[je+1],ct=Ce[x-(je+1)];K(V),K(_e),K(X),K(X),K(_e),K(ct)}Ve.push(nt[0][0],Ce[x][0],nt[x][0],Ce[0][0])}}for(;Ve.length;){let pe,Ne,we,[$e,nt]=Ve.splice(0,2);pe=nt;let Ce=[$e];for(;$e!=pe;)Ce.push(pe),Ne=Ve.indexOf(pe),we=Ne%2,pe=Ve.splice(Ne-we,2)[1-we];S.subVectors(Ce[0],Ce[1]).cross(m.subVectors(Ce[0],Ce[2])).normalize();let je=S.dot(Ce[0])<0;je&&S.negate();for(let V=1;V<=Ce.length-2;V++)W(Ce[V+ +je]),W(Ce[V+1-+je]),W(Ce[0])}}function h(){let p=new M,f=new M,m=new M,g=new M,y=new G,v=new G,b=new G,x=(T,w,_,A)=>{A<0&&T.x===1&&(c[w]=T.x-1),_.x===0&&_.z===0&&(c[w]=A/2/Math.PI+.5)};for(let T=0,w=0;T<u;T+=9,w+=6){p.set(a[T+0],a[T+1],a[T+2]),f.set(a[T+3],a[T+4],a[T+5]),m.set(a[T+6],a[T+7],a[T+8]),y.set(c[w+0],c[w+1]),v.set(c[w+2],c[w+3]),b.set(c[w+4],c[w+5]),g.copy(p).add(f).add(m).divideScalar(3);let _=E(g);x(y,w+0,p,_),x(v,w+2,f,_),x(b,w+4,m,_)}let S=u/3*2;for(let T=0;T<S;T+=6){let w=c[T+0],_=c[T+2],A=c[T+4],C=Math.max(w,_,A),R=Math.min(w,_,A);C>.9&&R<.1&&(w<.2&&(c[T+0]+=1),_<.2&&(c[T+2]+=1),A<.2&&(c[T+4]+=1))}function E(T){return Math.atan2(T.z,-T.x)}}}static fromJSON(t){return new Su(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}});var lV,Tv,T2=B(()=>{"use strict";E2();q();lV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,detail:r,corner:s,cornerSides:o}=i.parameters,a=r===0&&s!==0?new Tv(t*.5,s,o):new fd(t*.5,r),l=e/t,c=n/t;return(l!==1||c!==1)&&a.scale(1,l,c),Object.assign(a,{userData:{...i,type:"DodecahedronGeometry"}})}},Tv=class extends Su{constructor(t=1,e=.2,n=4){let r=(1+Math.sqrt(5))/2,s=1/r,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-r,0,-s,r,0,s,-r,0,s,r,-s,-r,0,-s,r,0,s,-r,0,s,r,0,-r,0,-s,r,0,-s,-r,0,s,r,0,s],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],l="DodecahedronGeometry";super(o,a,l,t,e,n),this.type=l}static fromJSON(t){return new Tv(t.radius,t.corner,t.cornerSides)}}});function cV(i,t=new G){let e=i.length();return t.set(-i.y/e,i.x/e)}function pV(i){let t=new G;t.addVectors(i.v0,Ff.subVectors(i.v1,i.v0).multiplyScalar(2/3));let e=new G;return e.addVectors(i.v2,gw.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new Ni(i.v0,t,e,i.v2)}function _v(i,t,e=Number.EPSILON){return Math.abs(i-t)<e}function Jee(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function ete(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function A2(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 fV(i,t,e){return uV(i,t)&&uV(t,e)&&M2(i.position,t.position,e.position)}function M2(i,t,e){return Ff.copy(t).sub(i).cross(gw.copy(e).sub(i))===0}function mV(i,t,e,n,r){let s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),o=(i.y+t.y)/2,a=(i.x+t.x)/2,l=Math.sqrt(Math.pow(e,2)-Math.pow(s/2,2))*(i.y-t.y)/s,c=Math.sqrt(Math.pow(e,2)-Math.pow(s/2,2))*(t.x-i.x)/s;return n.set(a+l,o+c),r.set(a-l,o-c),[n,r]}function gV(i,t,e){let n=i.distanceTo(e),r=t.distanceTo(e);return n<r?t:i}function yV(i,t,e,n,r,s){let o=t.x-i.x,a=t.y-i.y,l=e.x-i.x,c=e.y-i.y,u=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),d;return A2(t,i,e)>Math.PI&&(u*=-1),_v(c,a)?d=(a+c)*(n/u-.5)*8/3/(o-l):d=(o+l)*(n/u-.5)*8/3/(c-a),r.set(t.x-d*a,t.y+d*o),s.set(e.x+d*c,e.y-d*l),[r,s]}function C2(i,t){return i.position.equals(i.controls[1].position)&&t.position.equals(t.controls[0].position)}function uV(i,t){return M2(i.position,i.controls[1].position,t.position)&&M2(i.position,t.controls[0].position,t.position)}function vV(i,t,e,n,r=.5){let s=Ff.subVectors(t,i).multiplyScalar(r).add(i),o=gw.subVectors(e,t).multiplyScalar(r).add(t),a=$ee.subVectors(n,e).multiplyScalar(r).add(e),l=s,c=Kee.subVectors(o,s).multiplyScalar(r).add(s),u=Zee.subVectors(a,o).multiplyScalar(r).add(o),d=a,h=Qee.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 bV(i,t,e=12,n=!0){let r=hV.set(0,0,0),s,o=0,a=[];for(let l=0;l<t.length;l++){let c=_2(t[l]),u=Ff,d=wu(c,e);a.push(d);for(let h=0;h<=d;h++)if(c instanceof Ni||c instanceof bs||c instanceof _i){if(c.getPoint(h/d,u),r.set(u.x,u.y,0),s!==void 0&&ete(s,r))continue;s===void 0&&(s=dV),s.copy(r),i.setXYZ(o,r.x,r.y,r.z),o++}}return n&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),i}function xV(i,t,e,n=12,r=!0){let s=hV.set(0,0,0),o=0,a=[];for(let l=0;l<t.length;l++){if(e[l]===!1)continue;let c,u=_2(t[l]),d=Ff,h=wu(u,n);a.push(h);for(let p=0;p<=h;p++)if(u instanceof Ni||u instanceof bs||u instanceof _i){if(u.getPoint(p/h,d),s.set(d.x,d.y,0),c?.equals(s))continue;c===void 0?c=dV:(i.setXYZ(o,c.x,c.y,c.z),o++,i.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return r&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),a}function P2(i,t=12,e=!1){let n=[];for(let r=0,s=i.length;r<s;r++){let o=i[r],a=0;if(e&&o.roundedCurveCorner!==void 0){let l=wu(o.roundedCurveCorner,t)*.5;r>0&&(n[r-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=wu(o.curveAfter,t)),n.push(a)}return i.length>0&&e&&i[0].roundedCurveCorner!==void 0&&(n[i.length-1]+=wu(i[0].roundedCurveCorner,t)*.5),n}function wu(i,t=12){return i&&i instanceof $c?t*2:i&&(i instanceof _i||i instanceof vp)?1:i&&i instanceof md?t*i.points.length:t}function SV(i,t,e=12,n=!0){let r,s=0;for(let o=0;o<t.length;o++){let a=_2(t[o]),l=wu(a,e),c=Ff;for(let u=0;u<=l;u++)if(a instanceof Ni||a instanceof bs||a instanceof _i){if(a.getPoint(u/l,c),r!==void 0&&Jee(r,c,Mv))continue;r===void 0&&(r=gw),r.copy(c),i.push(c.x,c.y),s++}}return _v(i[0],i[i.length-2],Mv)&&_v(i[1],i[i.length-1],Mv)&&(i.pop(),i.pop()),n&&s>1&&!(_v(i[s-1],i[1],Mv)&&_v(i[s-2],i[0],Mv))&&(i.push(i[0],i[1]),s++),i}var Mv,Nf,Bf,ua,_2,Ff,gw,$ee,Kee,Zee,Qee,dV,hV,R2=B(()=>{"use strict";q();Mv=1e-12,Nf=class{constructor(t){this.position=new G;this.startPosition=new G;this.uuid=ge.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 Nf(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Bf=class extends Nf{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new Bf(this.parent).copy(this)}},ua=class extends Nf{constructor(e,n){super(n);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new Bf(this),new Bf(this))}static create(e,n){let r=new ua(e,new G(...n.position));return r.controls[0].position.set(...n.controlPrevious.position),r.controls[1].position.set(...n.controlNext.position),r.roundness=n.roundness,r.areControlsDirectionsMirrored=n.areControlsDirectionsMirrored,r}getOppositeControl(e){let n=this.controls.indexOf(e);return n===0?this.controls[1]:n===1?this.controls[0]:null}applyOffsetToControls(e,n=1){for(let r=0,s=this.controls.length;r<s;r++){let o=this.controls[r];this.position.distanceTo(o.position)<=n?o.position.copy(this.position):o.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new ua(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 G,n=new G){let[r,s]=this.computeTangents();return r&&s&&(cV(r,e),cV(s,n)),[e,n]}computeTangent(e=new G){let[n,r]=this.computeTangents();return n&&r&&e.copy(n).add(r).normalize(),e}computeNormal(e=new G){let[n,r]=this.computeNormals();return e.copy(n).add(r).normalize(),e}};_2=i=>i,Ff=new G,gw=new G,$ee=new G,Kee=new G,Zee=new G,Qee=new G,dV=new M,hV=new M});var I2,tte,nte,rte,ite,ste,yn,cc=B(()=>{"use strict";q();R2();I2=new G,tte=new G,nte=new G,rte=new G,ite=new G,ste=new G,yn=class extends Oa{constructor(e=100,n=100){super();this.points=[];this.shapeHoles=[];this.plane=new xr(new M(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this.isText=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=ge.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=n}static createFromState(e,n,r){let s=new yn;return s.isClosed=e.isClosed,s.points=e.points.map(o=>ua.create(o.id,o.data)),typeof e.roundness=="number"&&(s.roundness=e.roundness),s.shapeHoles=e.shapeHoles.map(o=>yn.createFromState(o)),n!==void 0&&r!==void 0&&s.applySize(n,r),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let n=0,r=this.points.length;n<r;n++)this.points[n].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(n=>this.getPointIndexById(n)).filter(n=>n>=0)}getPointIndexById(e){let n=this.points.length,r=this.points.findIndex(s=>s.uuid===e);if(r<0){let s=n;for(let o=0,a=this.shapeHoles.length;o<a;o++){let l=this.shapeHoles[o],c=l.points.length,u=l.getPointIndexById(e);if(u<0)s+=c;else return u+s}}return r}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let n=this.points.length;for(let r=0,s=this.shapeHoles.length;r<s;r++){let o=this.shapeHoles[r],a=e-n;if(a<=o.points.length-1)return o.points[a];n+=o.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let n=this.points.indexOf(e);if(n>=0)return n;if(n=this.points.length,this.shapeHoles.length>0)for(let r=0,s=this.shapeHoles.length;r<s;r++){let o=this.shapeHoles[r],a=o.points.indexOf(e);if(a>=0)return n+a;n+=o.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(n=>n.points));return[...this.points,...e]}applySize(e,n){e===0&&(e=.001),n===0&&(n=.001),this._width=e,this._height=n}applyScale(e,n){let r=I2.set(e,n);for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];a.position.multiply(r),a.controls[0].position.multiply(r),a.controls[1].position.multiply(r)}for(let s=0,o=this.shapeHoles.length;s<o;s++)this.shapeHoles[s].applyScale(e,n);this._update()}createPoint(e,n=0,r=ge.generateUUID()){let s;e instanceof G?s=e:s=new G(e,n);let o=new ua(r,s);return o.roundness=this.roundness,o}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,n){this.points.splice(n,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];if(s.uuid===e)return s}for(let n=0,r=this.shapeHoles.length;n<r;n++){let o=this.shapeHoles[n].getPointByUuid(e);if(o)return o}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let n=this.points.indexOf(e);n>=0&&this.points.splice(n,1),this.needsUpdate=!0}removePointById(e){let n=this.points.find(r=>r.uuid===e);n&&this.removePoint(n)}update(){for(let e=0,n=this.shapeHoles.length;e<n;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,n=12,r=!1){this.subdivision=n,this.curveDivisions===void 0&&this.computeCurveDivisions(n);let s=r?this.roundedCurveDivisions:this.curveDivisions;return bV(e,r?this.roundedCurves:this.curves,n,this.autoClose),s.reduce((o,a)=>o+a,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=P2(this.points,e,!1),this.roundedCurveDivisions=P2(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,n,r=12){return xV(e,this.curves,n,r,this.autoClose).reduce((o,a)=>o+a,0)*2}extractShapePointsToFlatArray(e,n=12){return this.subdivision=n,this.curveDivisions===void 0&&this.computeCurveDivisions(n),SV(e,this.roundedCurves,n,this.autoClose)}getCurveIndexFromVertexId(e,n=!1){let r=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=n?this.roundedCurveDivisions:this.curveDivisions,o=0;n&&this.points[0].roundedCurveCorner!==void 0&&(o=wu(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=e-o;a<0&&(a+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let u=s[l];if(a<r+u)return[l,(a-r+1)/u];r+=u}return[0,1]}getCurveT(e,n,r){let s=this.points[e],o=this.points[e>=this.points.length-1?0:e+1],a=this.curveDivisions,l=a[e];if(C2(s,o)){let d=s.position.distanceTo(o.position);return s.position.distanceTo(I2.set(r.x,r.y))/d}let c=0;for(let d=0;d<e;d++)c+=a[d];return(n-c)/l}dispose(){}_applyCurveForPoint(e,n){C2(n,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(n.controls[1].position.x,n.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let r=this.curves[this.curves.length-1];e.curveBefore=r,n.curveAfter=r;let s=r.clone();e.roundedCurveBefore=s,n.roundedCurveAfter=s,e.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];if(n===0)this.moveTo(s.position.x,s.position.y);else{let o=this.points[n-1];this._applyCurveForPoint(s,o)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let n=this.points[0],r=this.points[this.points.length-1];this._applyCurveForPoint(n,r)}if(this.points.length>2){let n=0;for(let r=0,s=this.points.length;r<s;r++){let o=this.points[r],a=this.points[r-1]??this.points[this.points.length-1],l=this.points[r+1]??this.points[0],c=o.roundness,u=a&&l&&fV(a,o,l);if(!o.controlsMoved()&&c>0&&!u){let d=o.curveBefore,h=o.curveAfter;if(d===void 0||h===void 0)continue;let p=o.roundedCurveBefore,f=o.roundedCurveAfter,m=d instanceof _i?d.v1.distanceTo(d.v2):d.getLength(),g=h instanceof _i?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,I2),T=h.getPointAt(S,tte);this._subSplitCurve(d,p,x,E,void 0),this._subSplitCurve(h,f,S,void 0,T);let w;if(this.useCubicForRoundedCorners){let _=A2(E,o.position,T)/2,A=Math.tan(_)*E.distanceTo(o.position),[C,R]=mV(E,T,A,nte,rte),D=gV(C,R,o.position),[O,L]=yV(D,E,T,A,ite,ste);w=new Ni(E.clone(),O.clone(),L.clone(),T.clone())}else w=new bs(E.clone(),o.position.clone(),T.clone());o.roundedCurveCorner=w,this.roundedCurves.splice(r+n,0,w),n++}}}}_subSplitCurve(e,n,r,s,o){if(e instanceof _i)s!==void 0&&n.v2.copy(s),o!==void 0&&n.v1.copy(o);else{let a=e,l=n,c=a.getUtoTmapping(r,0),u=vV(a.v0,a.v1,a.v2,a.v3,c);return s!==void 0&&(l.v0.set(u[0],u[1]),l.v1.set(u[2],u[3]),l.v2.set(u[4],u[5]),l.v3.set(u[6],u[7])),o!==void 0&&(l.v0.set(u[6],u[7]),l.v1.set(u[8],u[9]),l.v2.set(u[10],u[11]),l.v3.set(u[12],u[13])),l}return n}clone(){let e=new yn(this._width,this._height);return e.points=this.points.map(n=>n.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(n=>n.clone()),e}toJSON(){return{points:this.points.reduce((e,n)=>e.concat(n.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let n=e.points.length/7;for(let r=0;r<n;r++){let s=r*7,o=e.points[s+0],a=e.points[s+1],l=e.points[s+2],c=e.points[s+3],u=e.points[s+4],d=e.points[s+5],h=e.points[s+6],p=new ua(ge.generateUUID(),new G(o,a));p.controls[0].position.set(l,c),p.controls[1].position.set(u,d),p.roundness=h,this.points.push(p)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(r=>{let s=new yn;return s.fromJSON(r),s}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,n=!1){this.isText=n;let r=(o,a)=>{a instanceof Ni&&a.v3.equals(o.position)&&o.controls[0].position.copy(a.v2)},s=o=>{let a=[],l,c;for(l=0,c=o.length;l<c;l++)o[l]instanceof bs&&(o[l]=pV(o[l]));for(l=0,c=o.length;l<c;l++){let h=o[l],p=l>0?o[l-1]:null,f;h instanceof Ni?(f=this.createPoint(h.v0),f.controls[1].position.copy(h.v1)):h instanceof _i&&(f=this.createPoint(h.v1)),f!==void 0&&(p!==null&&r(f,p),a.push(f))}let u=o[o.length-1],d=!1;return u instanceof Ni?u.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(u.v2),d=!0):u instanceof _i&&u.v2.equals(a[0].position)&&(d=!0),this.isClosed=d,a};return this.points=s(e.curves),e instanceof Oa&&(this.shapeHoles=e.holes.map(o=>{let a=new yn;return a.fromShape(o),a})),this.update(),this}updatePoint(e,n){let r=this.getPointByUuid(e);r&&(n.position!==void 0&&r.position.fromArray(n.position),n.roundness!==void 0&&(r.roundness=n.roundness),n.areControlsDirectionsMirrored!==void 0&&(r.areControlsDirectionsMirrored=n.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,n){let s=this.getPointByUuid(e)?.controls[0];s&&(n.position&&s.position.fromArray(n.position),this.needsUpdate=!0)}updateNextControl(e,n){let s=this.getPointByUuid(e)?.controls[1];s&&(n.position&&s.position.fromArray(n.position),this.needsUpdate=!0)}}});function O2({x:i,y:t},e,n,r,s){return{x:i*e+r,y:t*n+s}}function ote(i,t){let e=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),n=Math.cos(i),r=Math.sin(i),s=Math.cos(i+t),o=Math.sin(i+t);return[{x:n-r*e,y:r+n*e},{x:s+o*e,y:o-s*e},{x:s,y:o}]}function wV(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 ate(i,t,e,n,r,s,o,a,l,c){let u=Math.pow(r,2),d=Math.pow(s,2),h=Math.pow(o,2),p=Math.pow(a,2),f=u*d-u*p-d*h;f<0&&(f=0),f/=u*p+d*h,f=Math.sqrt(f)*(l===c?-1:1);let m=f*r/s*a,g=f*-s/r*o,y=m+(i+e)/2,v=g+(t+n)/2,b=(o-m)/r,x=(a-g)/s,S=(-o-m)/r,E=(-a-g)/s,T=wV(1,0,b,x),w=wV(b,x,S,E);return!c&&w>0&&(w-=D2),c&&w<0&&(w+=D2),{centerx:y,centery:v,ang1:T,ang2:w}}function EV({px:i,py:t,cx:e,cy:n,rx:r,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(r===0||s===0)return[];let c=(i-e)/2,u=(t-n)/2;if(c===0&&u===0)return[];r=Math.abs(r),s=Math.abs(s);let d=Math.pow(c,2)/Math.pow(r,2)+Math.pow(u,2)/Math.pow(s,2);d>1&&(r*=Math.sqrt(d),s*=Math.sqrt(d));let h=ate(i,t,e,n,r,s,c,u,o,a),{ang1:p,ang2:f}=h,{centerx:m,centery:g}=h,y=Math.abs(f)/(D2/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(ote(p,f)),p+=f;return l.map(b=>{let{x,y:S}=O2(b[0],r,s,m,g),{x:E,y:T}=O2(b[1],r,s,m,g),{x:w,y:_}=O2(b[2],r,s,m,g);return{x1:x,y1:S,x2:E,y2:T,x:w,y:_}})}var D2,TV=B(()=>{"use strict";D2=Math.PI*2});function Rt(i,t){if(!i)throw t||"Assertion Failed!"}function Eu(i){var t=i.windingRule,e=t===void 0?Nn.ODD:t,n=i.elementType,r=n===void 0?si.POLYGONS:n,s=i.polySize,o=s===void 0?3:s,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,u=c===void 0?[0,0,1]:c,d=i.contours,h=d===void 0?[]:d,p=i.strict,f=p===void 0?!0:p,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 dte;i.edgeCreateCallback&&(y.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(y.vertexIdCallback=i.vertexIdCallback);for(var v=0;v<h.length;v++)y.addContour(l||2,h[v]);return y.tesselate(e,r,o,l,u,f),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:g?y.mesh:void 0}}}var Nn,si,_t,Av,yw,Uf,MV,_V,AV,lte,L2,CV,cte,ute,dte,gEe,yEe,vEe,bEe,xEe,SEe,wEe,EEe,kf=B(()=>{(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"})(Nn||(Nn={}));(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(si||(si={}));_t=function(){function i(){}return i.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},i.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},i.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},i.edgeGoesLeft=function(t){return i.vertLeq(t.Dst,t.Org)},i.edgeGoesRight=function(t){return i.vertLeq(t.Org,t.Dst)},i.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},i.edgeEval=function(t,e,n){Rt(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){Rt(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){Rt(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){Rt(i.transLeq(t,e)&&i.transLeq(e,n));var r=e.t-t.t,s=n.t-e.t;return r+s>0?(e.s-n.s)*r+(e.s-t.s)*s:0},i.vertCCW=function(t,e,n){return t.s*(e.t-n.t)+e.s*(n.t-t.t)+n.s*(t.t-e.t)>=0},i.interpolate=function(t,e,n,r){return t=t<0?0:t,n=n<0?0:n,t<=n?n===0?(e+r)/2:e+(r-e)*(t/(t+n)):r+(e-r)*(n/(t+n))},i.intersect=function(t,e,n,r,s){var o,a,l;i.vertLeq(t,e)||(l=t,t=e,e=l),i.vertLeq(n,r)||(l=n,n=r,r=l),i.vertLeq(t,n)||(l=t,t=n,n=l,l=e,e=r,r=l),i.vertLeq(n,e)?i.vertLeq(e,r)?(o=i.edgeEval(t,n,e),a=i.edgeEval(n,e,r),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,n.s,a,e.s)):(o=i.edgeSign(t,n,e),a=-i.edgeSign(t,r,e),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,n.s,a,r.s)):s.s=(n.s+e.s)/2,i.transLeq(t,e)||(l=t,t=e,e=l),i.transLeq(n,r)||(l=n,n=r,r=l),i.transLeq(t,n)||(l=t,t=n,n=l,l=e,e=r,r=l),i.transLeq(n,e)?i.transLeq(e,r)?(o=i.transEval(t,n,e),a=i.transEval(n,e,r),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,n.t,a,e.t)):(o=i.transSign(t,n,e),a=-i.transSign(t,r,e),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,n.t,a,r.t)):s.t=(n.t+e.t)/2},i}(),Av=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}(),yw=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}(),Uf=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}(),MV=function(){function i(){var t=new Uf,e=new Av,n=new yw(0),r=new yw(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 yw(0),n=new yw(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;Rt(r,"Vertex can't be null!");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=e;var o=e;do o.Org=r,o=o.Onext;while(o!==e)},i.prototype.makeFace_=function(t,e,n){var r=t;Rt(r,"Face can't be null");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=e,r.trail=null,r.marked=!1,r.inside=n.inside;var o=e;do o.Lface=r,o=o.Lnext;while(o!==e)},i.prototype.killEdge_=function(t){t.Sym.side<t.side&&(t=t.Sym);var e=t.next,n=t.Sym.next;e.Sym.next=n,n.Sym.next=e},i.prototype.killVertex_=function(t,e){var n=t.anEdge,r=n;do r.Org=e,r=r.Onext;while(r!==n);var s=t.prev,o=t.next;o.prev=s,s.next=o},i.prototype.killFace_=function(t,e){var n=t.anEdge,r=n;do r.Lface=e,r=r.Lnext;while(r!==n);var s=t.prev,o=t.next;o.prev=s,s.next=o},i.prototype.makeEdge=function(){var t=new Uf,e=new Uf,n=new Av,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 Uf;this.makeVertex_(s,e,t.Org),t.Org.anEdge=t}if(!n){var o=new Av;this.makeFace_(o,e,t.Lface),t.Lface.anEdge=t}}},i.prototype.delete=function(t){var e=t.Sym,n=!1;if(t.Lface!==t.Rface&&(n=!0,this.killFace_(t.Lface,t.Rface)),t.Onext===t)this.killVertex_(t.Org,null);else if(t.Rface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev),!n){var r=new Av;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 Uf;return this.makeVertex_(r,n,e.Org),e.Lface=n.Lface=t.Lface,e},i.prototype.splitEdge=function(t){var e=this.addEdgeVertex(t),n=e.Sym;return this.splice_(t.Sym,t.Sym.Oprev),this.splice_(t.Sym,n),t.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=t.Rface,n.winding=t.winding,n.Sym.winding=t.Sym.winding,n.idx=t.idx,n.Sym.idx=t.Sym.idx,n},i.prototype.connect=function(t,e){var n=!1,r=this.makeEdge_(t),s=r.Sym;if(e.Lface!==t.Lface&&(n=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(r,t.Lnext),this.splice_(s,e),r.Org=t.Dst,s.Org=e.Org,r.Lface=s.Lface=t.Lface,t.Lface.anEdge=s,!n){var o=new Av;this.makeFace_(o,r,t.Lface)}return r},i.prototype.zapFace=function(t){var e=t.anEdge,n,r,s,o,a;r=e.Lnext;do n=r,r=n.Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),s=n.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=e);o=t.prev,a=t.next,a.prev=o,o.next=a},i.prototype.countFaceVerts_=function(t){var e=t.anEdge,n=0;do n++,e=e.Lnext;while(e!==t.anEdge);return n},i.prototype.mergeConvexFaces=function(t){var e,n,r,s,o,a,l;for(e=this.fHead.next;e!==this.fHead;e=e.next)if(!!e.inside)for(n=e.anEdge,o=n.Org;r=n.Lnext,s=n.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(e),l=this.countFaceVerts_(s.Lface),a+l-2<=t&&_t.vertCCW(n.Lprev.Org,n.Org,s.Lnext.Lnext.Org)&&_t.vertCCW(s.Lprev.Org,s.Org,n.Lnext.Lnext.Org)&&(r=s.Lnext,this.delete(s),n=null,s=null)),!(n&&n.Lnext.Org===o);)n=r;return!0},i.prototype.check=function(){var t=this.fHead,e=this.vHead,n=this.eHead,r,s,o,a,l,c;for(s=t,s=t;(r=s.next)!==t;s=r){Rt(r.prev===s),l=r.anEdge;do Rt(l.Sym!==l),Rt(l.Sym.Sym===l),Rt(l.Lnext.Onext.Sym===l),Rt(l.Onext.Sym.Lnext===l),Rt(l.Lface===r),l=l.Lnext;while(l!==r.anEdge)}for(Rt(r.prev===s&&r.anEdge===null),a=e,a=e;(o=a.next)!==e;a=o){Rt(o.prev===a),l=o.anEdge;do Rt(l.Sym!==l),Rt(l.Sym.Sym===l),Rt(l.Lnext.Onext.Sym===l),Rt(l.Onext.Sym.Lnext===l),Rt(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(Rt(o.prev===a&&o.anEdge===null),c=n,c=n;(l=c.next)!==n;c=l)Rt(l.Sym.next===c.Sym),Rt(l.Sym!==l),Rt(l.Sym.Sym===l),Rt(l.Org!==null),Rt(l.Dst!==null),Rt(l.Lnext.Onext.Sym===l),Rt(l.Onext.Sym.Lnext===l);Rt(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}(),_V=function(){function i(){this.handle=null}return i}(),AV=function(){function i(){this.key=null,this.node=0}return i}(),lte=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 _V,this.handles[n]=new AV;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(t){var e=this.nodes,n=this.handles,r,s,o;for(r=e[t].handle;;){if(o=t<<1,o<this.size&&this.leq(n[e[o+1].handle].key,n[e[o].handle].key)&&++o,Rt(o<=this.max),s=e[o].handle,o>this.size||this.leq(n[r].key,n[s].key)){e[t].handle=r,n[r].node=t;break}e[t].handle=s,n[s].node=t,t=o}},i.prototype.floatUp_=function(t){var e=this.nodes,n=this.handles,r,s,o;for(r=e[t].handle;;){if(o=t>>1,s=e[o].handle,o===0||this.leq(n[s].key,n[r].key)){e[t].handle=r,n[r].node=t;break}e[t].handle=s,n[s].node=t,t=o}},i.prototype.init=function(){for(var t=this.size;t>=1;--t)this.floatDown_(t);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(t){var e,n;if(e=++this.size,e*2>this.max){this.max*=2;var r,s;for(s=this.nodes.length,this.nodes.length=this.max+1,r=s;r<this.nodes.length;r++)this.nodes[r]=new _V;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new AV}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;Rt(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}(),L2=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}(),CV=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),cte=function(){function i(t,e){this.frame=t,this.leq=e,this.head=new CV,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 CV;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}(),ute=function(){function i(){}return i.regionBelow=function(t){return t.nodeUp.prev.key},i.regionAbove=function(t){return t.nodeUp.next.key},i.debugEvent=function(t){},i.addWinding=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.edgeLeq=function(t,e,n){var r=t.event,s=e.eUp,o=n.eUp;if(s.Dst===r)return o.Dst===r?_t.vertLeq(s.Org,o.Org)?_t.edgeSign(o.Dst,s.Org,o.Org)<=0:_t.edgeSign(s.Dst,o.Org,s.Org)>=0:_t.edgeSign(o.Dst,r,o.Org)<=0;if(o.Dst===r)return _t.edgeSign(s.Dst,r,s.Org)>=0;var a=_t.edgeEval(s.Dst,r,s.Org),l=_t.edgeEval(o.Dst,r,o.Org);return a>=l},i.deleteRegion=function(t,e){e.fixUpperEdge&&Rt(e.eUp.winding===0),e.eUp.activeRegion=null,t.dict.delete(e.nodeUp)},i.fixUpperEdge=function(t,e,n){Rt(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 L2;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 Nn.ODD:return(e&1)!==0;case Nn.NONZERO:return e!==0;case Nn.POSITIVE:return e>0;case Nn.NEGATIVE:return e<0;case Nn.ABS_GEQ_TWO:return e>=2||e<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(t,e){e.windingNumber=i.regionAbove(e).windingNumber+e.eUp.winding,e.inside=i.isWindingInside(t,e.windingNumber)},i.finishRegion=function(t,e){var n=e.eUp,r=n.Lface;r.inside=e.inside,r.anEdge=n,i.deleteRegion(t,e)},i.finishLeftRegions=function(t,e,n){for(var r,s=null,o=e,a=e.eUp;o!==n;){if(o.fixUpperEdge=!1,s=i.regionBelow(o),r=s.eUp,r.Org!=a.Org){if(!s.fixUpperEdge){i.finishRegion(t,o);break}r=t.mesh.connect(a.Lprev,r.Sym),i.fixUpperEdge(t,s,r)}a.Onext!==r&&(t.mesh.splice(r.Oprev,r),t.mesh.splice(a,r)),i.finishRegion(t,o),a=s.eUp,o=s}return a},i.addRightEdges=function(t,e,n,r,s,o){var a,l,c,u,d=!0;c=n;do Rt(_t.vertLeq(c.Org,c.Dst)),i.addRegionBelow(t,e,c.Sym),c=c.Onext;while(c!==r);for(s===null&&(s=i.regionBelow(e).eUp.Rprev),l=e,u=s;a=i.regionBelow(l),c=a.eUp.Sym,c.Org===u.Org;)c.Onext!==u&&(t.mesh.splice(c.Oprev,c),t.mesh.splice(u.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=i.isWindingInside(t,a.windingNumber),l.dirty=!0,!d&&i.checkForRightSplice(t,l)&&(i.addWinding(c,u),i.deleteRegion(t,l),t.mesh.delete(u)),d=!1,l=a,u=c;l.dirty=!0,Rt(l.windingNumber-c.winding===a.windingNumber),o&&i.walkDirtyRegions(t,l)},i.spliceMergeVertices=function(t,e,n){t.mesh.splice(e,n)},i.vertexWeights=function(t,e,n){var r=_t.vertL1dist(e,t),s=_t.vertL1dist(n,t),o=.5*s/(r+s),a=.5*r/(r+s);t.coords[0]+=o*e.coords[0]+a*n.coords[0],t.coords[1]+=o*e.coords[1]+a*n.coords[1],t.coords[2]+=o*e.coords[2]+a*n.coords[2]},i.getIntersectData=function(t,e,n,r,s,o){e.coords[0]=e.coords[1]=e.coords[2]=0,e.idx=-1,i.vertexWeights(e,n,r),i.vertexWeights(e,s,o)},i.checkForRightSplice=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp;if(_t.vertLeq(r.Org,s.Org)){if(_t.edgeSign(s.Dst,r.Org,s.Org)>0)return!1;_t.vertEq(r.Org,s.Org)?r.Org!==s.Org&&(t.pq.delete(r.Org.pqHandle),i.spliceMergeVertices(t,s.Oprev,r)):(t.mesh.splitEdge(s.Sym),t.mesh.splice(r,s.Oprev),e.dirty=n.dirty=!0)}else{if(_t.edgeSign(r.Dst,s.Org,r.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(r.Sym),t.mesh.splice(s.Oprev,r)}return!0},i.checkForLeftSplice=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp,o;if(Rt(!_t.vertEq(r.Dst,s.Dst)),_t.vertLeq(r.Dst,s.Dst)){if(_t.edgeSign(r.Dst,s.Dst,r.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,o=t.mesh.splitEdge(r),t.mesh.splice(s.Sym,o),o.Lface.inside=e.inside}else{if(_t.edgeSign(s.Dst,r.Dst,s.Org)>0)return!1;e.dirty=n.dirty=!0,o=t.mesh.splitEdge(s),t.mesh.splice(r.Lnext,s.Sym),o.Rface.inside=e.inside}return!0},i.checkForIntersect=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp,o=r.Org,a=s.Org,l=r.Dst,c=s.Dst,u,d,h=new Uf,p,f;if(Rt(!_t.vertEq(c,l)),Rt(_t.edgeSign(l,t.event,o)<=0),Rt(_t.edgeSign(c,t.event,a)>=0),Rt(o!==t.event&&a!==t.event),Rt(!e.fixUpperEdge&&!n.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),d=Math.max(a.t,c.t),u>d))return!1;if(_t.vertLeq(o,a)){if(_t.edgeSign(c,o,a)>0)return!1}else if(_t.edgeSign(l,a,o)<0)return!1;return i.debugEvent(t),_t.intersect(l,o,c,a,h),Rt(Math.min(o.t,l.t)<=h.t),Rt(h.t<=Math.max(a.t,c.t)),Rt(Math.min(c.s,l.s)<=h.s),Rt(h.s<=Math.max(a.s,o.s)),_t.vertLeq(h,t.event)&&(h.s=t.event.s,h.t=t.event.t),p=_t.vertLeq(o,a)?o:a,_t.vertLeq(p,h)&&(h.s=p.s,h.t=p.t),_t.vertEq(h,o)||_t.vertEq(h,a)?(i.checkForRightSplice(t,e),!1):!_t.vertEq(l,t.event)&&_t.edgeSign(l,t.event,h)>=0||!_t.vertEq(c,t.event)&&_t.edgeSign(c,t.event,h)<=0?c===t.event?(t.mesh.splitEdge(r.Sym),t.mesh.splice(s.Sym,r),e=i.topLeftRegion(t,e),r=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),n),i.addRightEdges(t,e,r.Oprev,r,r,!0),!0):l===t.event?(t.mesh.splitEdge(s.Sym),t.mesh.splice(r.Lnext,s.Oprev),n=e,e=i.topRightRegion(e),f=i.regionBelow(e).eUp.Rprev,n.eUp=s.Oprev,s=i.finishLeftRegions(t,n,null),i.addRightEdges(t,e,s.Onext,r.Rprev,f,!0),!0):(_t.edgeSign(l,t.event,h)>=0&&(i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(r.Sym),r.Org.s=t.event.s,r.Org.t=t.event.t),_t.edgeSign(c,t.event,h)<=0&&(e.dirty=n.dirty=!0,t.mesh.splitEdge(s.Sym),s.Org.s=t.event.s,s.Org.t=t.event.t),!1):(t.mesh.splitEdge(r.Sym),t.mesh.splitEdge(s.Sym),t.mesh.splice(s.Oprev,r),r.Org.s=h.s,r.Org.t=h.t,r.Org.pqHandle=t.pq.insert(r.Org),i.getIntersectData(t,r.Org,o,l,a,c),i.regionAbove(e).dirty=e.dirty=n.dirty=!0,!1)},i.walkDirtyRegions=function(t,e){for(var n=i.regionBelow(e),r,s;;){for(;n.dirty;)e=n,n=i.regionBelow(n);if(!e.dirty&&(n=e,e=i.regionAbove(e),e===null||!e.dirty))return;if(e.dirty=!1,r=e.eUp,s=n.eUp,r.Dst!==s.Dst&&i.checkForLeftSplice(t,e)&&(n.fixUpperEdge?(i.deleteRegion(t,n),t.mesh.delete(s),n=i.regionBelow(e),s=n.eUp):e.fixUpperEdge&&(i.deleteRegion(t,e),t.mesh.delete(r),e=i.regionAbove(n),r=e.eUp)),r.Org!==s.Org)if(r.Dst!==s.Dst&&!e.fixUpperEdge&&!n.fixUpperEdge&&(r.Dst===t.event||s.Dst===t.event)){if(i.checkForIntersect(t,e))return}else i.checkForRightSplice(t,e);r.Org===s.Org&&r.Dst===s.Dst&&(i.addWinding(s,r),i.deleteRegion(t,e),t.mesh.delete(r),e=i.regionAbove(n))}},i.connectRightVertex=function(t,e,n){var r,s=n.Onext,o=i.regionBelow(e),a=e.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(t,e),_t.vertEq(a.Org,t.event)&&(t.mesh.splice(s.Oprev,a),e=i.topLeftRegion(t,e),s=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),o),c=!0),_t.vertEq(l.Org,t.event)&&(t.mesh.splice(n,l.Oprev),n=i.finishLeftRegions(t,o,null),c=!0),c){i.addRightEdges(t,e,n.Onext,s,s,!0);return}_t.vertLeq(l.Org,a.Org)?r=l.Oprev:r=a,r=t.mesh.connect(n.Lprev,r),i.addRightEdges(t,e,r,r.Onext,r.Onext,!1),r.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(t,e)},i.connectLeftDegenerate=function(t,e,n){var r,s,o,a,l;if(r=e.eUp,_t.vertEq(r.Org,n)){Rt(!1),i.spliceMergeVertices(t,r,n.anEdge);return}if(!_t.vertEq(r.Dst,n)){t.mesh.splitEdge(r.Sym),e.fixUpperEdge&&(t.mesh.delete(r.Onext),e.fixUpperEdge=!1),t.mesh.splice(n.anEdge,r),i.sweepEvent(t,n);return}Rt(!1),e=i.topRightRegion(e),l=i.regionBelow(e),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(Rt(s!==o),i.deleteRegion(t,l),t.mesh.delete(o),o=s.Oprev),t.mesh.splice(n.anEdge,o),_t.edgeGoesLeft(s)||(s=null),i.addRightEdges(t,e,o.Onext,a,s,!0)},i.connectLeftVertex=function(t,e){var n,r,s,o,a,l,c=new L2;if(c.eUp=e.anEdge.Sym,n=t.dict.search(c).key,r=i.regionBelow(n),!!r){if(o=n.eUp,a=r.eUp,_t.edgeSign(o.Dst,e,o.Org)===0){i.connectLeftDegenerate(t,n,e);return}if(s=_t.vertLeq(a.Dst,o.Dst)?n:r,n.inside||s.fixUpperEdge){if(s===n)l=t.mesh.connect(e.anEdge.Sym,o.Lnext);else{var u=t.mesh.connect(a.Dnext,e.anEdge);l=u.Sym}s.fixUpperEdge?i.fixUpperEdge(t,s,l):i.computeWinding(t,i.addRegionBelow(t,n,l)),i.sweepEvent(t,e)}else i.addRightEdges(t,n,e.anEdge,e.anEdge,null,!0)}},i.sweepEvent=function(t,e){t.event=e,i.debugEvent(t);for(var n=e.anEdge;n.activeRegion===null;)if(n=n.Onext,n===e.anEdge){i.connectLeftVertex(t,e);return}var r=i.topLeftRegion(t,n.activeRegion);Rt(r!==null);var s=i.regionBelow(r),o=s.eUp,a=i.finishLeftRegions(t,s,null);a.Onext===o?i.connectRightVertex(t,r,a):i.addRightEdges(t,r,a.Onext,o,o,!0)},i.addSentinel=function(t,e,n,r){var s=new L2,o=t.mesh.makeEdge();o.Org.s=n,o.Org.t=r,o.Dst.s=e,o.Dst.t=r,t.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=t.dict.insert(s)},i.initEdgeDict=function(t){t.dict=new cte(t,i.edgeLeq);var e=t.bmax[0]-t.bmin[0],n=t.bmax[1]-t.bmin[1],r=t.bmin[0]-e,s=t.bmax[0]+e,o=t.bmin[1]-n,a=t.bmax[1]+n;i.addSentinel(t,r,s,o),i.addSentinel(t,r,s,a)},i.doneEdgeDict=function(t){for(var e,n=0;(e=t.dict.min().key)!==null;)e.sentinel||(Rt(e.fixUpperEdge),Rt(++n===1)),Rt(e.windingNumber===0),i.deleteRegion(t,e)},i.removeDegenerateEdges=function(t){var e,n,r,s=t.mesh.eHead;for(e=s.next;e!==s;e=n)n=e.next,r=e.Lnext,_t.vertEq(e.Org,e.Dst)&&e.Lnext.Lnext!==e&&(i.spliceMergeVertices(t,r,e),t.mesh.delete(e),e=r,r=e.Lnext),r.Lnext===e&&(r!==e&&((r===n||r===n.Sym)&&(n=n.next),t.mesh.delete(r)),(e===n||e===n.Sym)&&(n=n.next),t.mesh.delete(e))},i.initPriorityQ=function(t){var e,n,r,s=0;for(r=t.mesh.vHead,n=r.next;n!==r;n=n.next)s++;for(s+=8,e=t.pq=new lte(s,_t.vertLeq),r=t.mesh.vHead,n=r.next;n!==r;n=n.next)n.pqHandle=e.insert(n);return n!==r?!1:(e.init(),!0)},i.donePriorityQ=function(t){t.pq=null},i.removeDegenerateFaces=function(t,e){var n,r,s;for(n=e.fHead.next;n!==e.fHead;n=r)r=n.next,s=n.anEdge,Rt(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),t.mesh.delete(s));return!0},i.computeInterior=function(t,e){e===void 0&&(e=!0);var n,r;if(i.removeDegenerateEdges(t),!i.initPriorityQ(t))return!1;for(i.initEdgeDict(t);(n=t.pq.extractMin())!==null;){for(;r=t.pq.min(),!(r===null||!_t.vertEq(r,n));)r=t.pq.extractMin(),i.spliceMergeVertices(t,n.anEdge,r.anEdge);i.sweepEvent(t,n)}return t.event=t.dict.min().key.eUp.Org,i.debugEvent(t),i.doneEdgeDict(t),i.donePriorityQ(t),i.removeDegenerateFaces(t,t.mesh)?(e&&t.mesh.check(),!0):!1},i}(),dte=function(){function i(){this.mesh=new MV,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=Nn.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.prototype.normalize_=function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];if(!e)throw"Zero-size vector!";e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},i.prototype.longAxis_=function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},i.prototype.computeNormal_=function(t){var e,n,r,s,o,a,l=[0,0,0],c=[0,0,0],u=[0,0,0],d=[0,0,0],h=[0,0,0],p=[null,null,null],f=[null,null,null],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(a=0,n=f[v],r=p[v],u[0]=n.coords[0]-r.coords[0],u[1]=n.coords[1]-r.coords[1],u[2]=n.coords[2]-r.coords[2],e=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],o=h[0]*h[0]+h[1]*h[1]+h[2]*h[2],o>a&&(a=o,t[0]=h[0],t[1]=h[1],t[2]=h[2]);a<=0&&(t[0]=t[1]=t[2]=0,t[this.longAxis_(u)]=1)},i.prototype.checkOrientation_=function(){for(var t=this.mesh.fHead,e,n=this.mesh.vHead,r,s=0,o=t.next;o!==t;o=o.next)if(r=o.anEdge,!(r.winding<=0))do s+=(r.Org.s-r.Dst.s)*(r.Org.t+r.Dst.t),r=r.Lnext;while(r!==o.anEdge);if(s<0){for(e=n.next;e!==n;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var t=this.mesh.vHead,e=[0,0,0],n,r,s=!1;e[0]=this.normal[0],e[1]=this.normal[1],e[2]=this.normal[2],!e[0]&&!e[1]&&!e[2]&&(this.computeNormal_(e),s=!0),n=this.sUnit,r=this.tUnit;var o=this.longAxis_(e);n[o]=0,n[(o+1)%3]=1,n[(o+2)%3]=0,r[o]=0,r[(o+1)%3]=0,r[(o+2)%3]=e[o]>0?1:-1;for(var a=t.next;a!==t;a=a.next)a.s=this.dot_(a.coords,n),a.t=this.dot_(a.coords,r);s&&this.checkOrientation_();for(var l=!0,c=t.next;c!==t;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.prototype.tessellateMonoRegion_=function(t,e){var n,r;if(n=e.anEdge,!(n.Lnext!==n&&n.Lnext.Lnext!==n))throw"Mono region invalid";for(;_t.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;_t.vertLeq(n.Org,n.Dst);n=n.Lnext);r=n.Lprev;for(var s=void 0;n.Lnext!==r;)if(_t.vertLeq(n.Dst,r.Org)){for(;r.Lnext!==n&&(_t.edgeGoesLeft(r.Lnext)||_t.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)s=t.connect(r.Lnext,r),r=s.Sym;r=r.Lprev}else{for(;r.Lnext!==n&&(_t.edgeGoesRight(n.Lprev)||_t.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)s=t.connect(n,n.Lprev),n=s.Sym;n=n.Lnext}if(r.Lnext===n)throw"Mono region invalid";for(;r.Lnext.Lnext!==n;)s=t.connect(r.Lnext,r),r=s.Sym;return!0},i.prototype.tessellateInterior_=function(t){for(var e,n=t.fHead.next;n!==t.fHead;n=e)if(e=n.next,n.inside&&!this.tessellateMonoRegion_(t,n))return!1;return!0},i.prototype.discardExterior_=function(t){for(var e,n=t.fHead.next;n!==t.fHead;n=e)e=n.next,n.inside||t.zapFace(n)},i.prototype.setWindingNumber_=function(t,e,n){for(var r,s=t.eHead.next;s!==t.eHead;s=r)r=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?e:-e:n?t.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(t){return!t.Rface||!t.Rface.inside?-1:t.Rface.n},i.prototype.outputPolymesh_=function(t,e,n,r){var s,o=0,a=0,l;n>3&&t.mergeConvexFaces(n);for(var c=t.vHead.next;c!==t.vHead;c=c.next)c.n=-1;for(var u=t.fHead.next;u!==t.fHead;u=u.next)if(u.n=-1,!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;c.n===-1&&(c.n=a,a++),l++,s=s.Lnext}while(s!==u.anEdge);if(l>n)throw"Face vertex greater that support polygon";u.n=o,++o}this.elementCount=o,e===si.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*n,this.vertexCount=a,this.vertices=[],this.vertices.length=a*r,this.vertexIndices=[],this.vertexIndices.length=a;for(var c=t.vHead.next;c!==t.vHead;c=c.next)if(c.n!==-1){var d=c.n*r;this.vertices[d+0]=c.coords[0],this.vertices[d+1]=c.coords[1],r>2&&(this.vertices[d+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var h=0,u=t.fHead.next;u!==t.fHead;u=u.next)if(!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;this.elements[h++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var p=l;p<n;++p)this.elements[h++]=-1;if(e===si.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[h++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var f=l;f<n;++f)this.elements[h++]=-1}}},i.prototype.outputContours_=function(t,e){var n,r,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var a=t.fHead.next;a!==t.fHead;a=a.next)if(!!a.inside){r=n=a.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==r);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*e,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,u=0;s=0;for(var a=t.fHead.next;a!==t.fHead;a=a.next)if(!!a.inside){o=0,r=n=a.anEdge;do this.vertices[l++]=n.Org.coords[0],this.vertices[l++]=n.Org.coords[1],e>2&&(this.vertices[l++]=n.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(n):n.Org.idx,o++,n=n.Lnext;while(n!==r);this.elements[u++]=s,this.elements[u++]=o,s+=o}},i.prototype.addContour=function(t,e){this.mesh===null&&(this.mesh=new MV),t<2&&(t=2),t>3&&(t=3);for(var n=null,r=0;r<e.length;r+=t)n===null?(n=this.mesh.makeEdge(),this.mesh.splice(n,n.Sym)):(this.mesh.splitEdge(n),n=n.Lnext),n.Org.coords[0]=e[r+0],n.Org.coords[1]=e[r+1],t>2?n.Org.coords[2]=e[r+2]:n.Org.coords[2]=0,n.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(n),n.winding=1,n.Sym.winding=-1},i.prototype.tesselate=function(t,e,n,r,s,o){if(t===void 0&&(t=Nn.ODD),e===void 0&&(e=si.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=t,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),ute.computeInterior(this,o);var a=this.mesh;return e===si.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),e===si.BOUNDARY_CONTOURS?this.outputContours_(a,r):this.outputPolymesh_(a,e,n,r),!0},i}();gEe=Nn.ODD,yEe=Nn.NONZERO,vEe=Nn.POSITIVE,bEe=Nn.NEGATIVE,xEe=Nn.ABS_GEQ_TWO,SEe=si.POLYGONS,wEe=si.CONNECTED_POLYGONS,EEe=si.BOUNDARY_CONTOURS});function vw(i,t){let e=i.length/2;if(e<2)return[];let n=0;for(let l=0;l<e;l++){let c=(l+1)%e;n+=i[l*2]*i[c*2+1]-i[c*2]*i[l*2+1]}let r=n>0!==t?1:-1,s=[];for(let l=0;l<e;l++){let c=(l+1)%e,u=i[c*2]-i[l*2],d=i[c*2+1]-i[l*2+1],h=Math.hypot(u,d);s.push(h>0?[r*d/h,-r*u/h]:[0,0])}let o=Math.cos(40*Math.PI/180),a=(l,c)=>{if(l[0]*c[0]+l[1]*c[1]<=o)return l;let[u,d]=[l[0]+c[0],l[1]+c[1]],h=Math.hypot(u,d);return h>0?[u/h,d/h]:l};return s.map((l,c)=>[a(l,s[(c+e-1)%e]),a(l,s[(c+1)%e])])}function bw(i,t,e){let n=i.length/2,r=new Float32Array(n+1);if(!(t>0)||!(e>0)||n<2)return{u:r,vScale:0};let s=0;for(let o=0;o<n;o++){let a=(o+1)%n;s+=Math.hypot((i[a*2]-i[o*2])/t,(i[a*2+1]-i[o*2+1])/e),r[o+1]=s}return{u:r,vScale:Math.sqrt(t*e)}}function xw(i,t,e){for(let n=0;n<e.length;n+=3){let r=e[n]*3,s=e[n+1]*3,o=e[n+2]*3,a=i[s]-i[r],l=i[s+1]-i[r+1],c=i[s+2]-i[r+2],u=i[o]-i[r],d=i[o+1]-i[r+1],h=i[o+2]-i[r+2],p=l*h-c*d,f=c*u-a*h,m=a*d-l*u,g=t[r]+t[s]+t[o],y=t[r+1]+t[s+1]+t[o+1],v=t[r+2]+t[s+2]+t[o+2];if(p*g+f*y+m*v<0){let b=e[n+1];e[n+1]=e[n+2],e[n+2]=b}}}var N2=B(()=>{"use strict"});var Sw,PV,ww,Ew=B(()=>{"use strict";Sw={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},PV={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},ww={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}});function B2(i,t){return i.normals[t*3+2]<.9999}function Tw(i){let t=RV.get(i);if(t!==void 0)return t;if(!(i.rise>0))return i;let e=new Float32Array(i.normals),n=i.positions.length/3;for(let s=0;s<n;s++){if(!B2(i,s))continue;let o=e[s*3],a=e[s*3+1],l=Math.hypot(o,a);if(l===0)continue;let c=i.rise-i.positions[s*3+2],u=Math.min(1,Math.max(0,1-c/i.rise)),d=Math.sqrt(1-u*u);e[s*3]=o/l*d,e[s*3+1]=a/l*d,e[s*3+2]=u}let r={...i,normals:e};return RV.set(i,r),r}function Mw(i,t,e,n){let r=(t-i.minX)/i.spanX,s=(e-i.minY)/i.spanY;return n?[s,r]:[r,s]}var RV,_w=B(()=>{"use strict";RV=new WeakMap});var IV,eh,OV=B(()=>{"use strict";q();kf();dn();N2();Ew();_w();IV=2,eh=class extends Me{constructor(e,n,r=12,s=Nn.ODD,o,a=!1){super();this.type="FlatExtrusionGeometry";this._nearSide=new Uint8Array(0);this._vScale=0;this._shape=e,this._depth=n,this._curveSegments=r,this._windingRule=s,this._uvPitch=a?void 0:o,this._legacy=a;let l=[e.extractShapePointsToFlatArray([],r),...e.shapeHoles.map(K=>K.extractShapePointsToFlatArray([],r))],c;try{c=Eu({contours:l,windingRule:s,elementType:si.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{c=ww}let u=c?.vertexCount??0,d=c?.elementCount??0,h=1/0,p=1/0,f=-1/0,m=-1/0;for(let K of l)for(let Y=0;Y<K.length;Y+=2)K[Y]<h&&(h=K[Y]),K[Y]>f&&(f=K[Y]),K[Y+1]<p&&(p=K[Y+1]),K[Y+1]>m&&(m=K[Y+1]);let g=this._uvPitch,y=g??(f-h||1),v=g??(m-p||1),b=g===void 0?h:0,x=g===void 0?p:0,S=l.map((K,Y)=>vw(K,Y>0)),E=0;for(let K of S)E+=K.length;let T=u*2+E*4,w=d*3*2+E*6,_=new Float32Array(T*3),A=new Float32Array(T*3),C=new Float32Array(T*2),R=new Uint32Array(w),D=new Uint8Array(T),O=0,L=0,F=0,j=!1,W=(K,Y,$,ee,oe,ae,de=(K-b)/y,be=(Y-x)/v)=>{let Re=L*3;_[Re]=K,_[Re+1]=Y,_[Re+2]=$,A[Re]=ee,A[Re+1]=oe,A[Re+2]=ae,D[L]=$===n?j?IV:1:0,C[L*2]=de,C[L*2+1]=be,L++};if(c!==void 0)for(let[K,Y]of[[n,1],[0,-1]]){let $=L;for(let ee=0;ee<u;ee++)W(c.vertices[ee*2],c.vertices[ee*2+1],K,0,0,Y);for(let ee=0;ee<d;ee++){let[oe,ae,de]=[c.elements[ee*3],c.elements[ee*3+1],c.elements[ee*3+2]];R[F++]=$+oe,R[F++]=$+(Y>0?ae:de),R[F++]=$+(Y>0?de:ae)}}j=!0;for(let K=0;K<l.length;K++){let Y=l[K],$=S[K],ee=Y.length/2,{u:oe,vScale:ae}=a?{u:new Float32Array(ee+1),vScale:0}:bw(Y,y,v);O=ae;let de=ae===0?0:n/ae,be={minX:b,minY:x,spanX:y,spanY:v},Re=(me,[Ae,Le],Ie,Ge)=>{let Ve=Y[me*2],pe=Y[me*2+1],[Ne,we]=a?Mw(be,Ve,pe,Ie):[Ge,Ie?0:de];W(Ve,pe,Ie?0:n,Ae,Le,0,Ne,we)};for(let me=0;me<$.length;me++){let Ae=(me+1)%ee,[Le,Ie]=$[me],[Ge,Ve]=[oe[me],oe[me+1]],pe=L;Re(me,Le,!1,Ge),Re(me,Le,!0,Ge),Re(Ae,Ie,!1,Ve),Re(Ae,Ie,!0,Ve),R[F++]=pe,R[F++]=pe+1,R[F++]=pe+2,R[F++]=pe+3,R[F++]=pe+2,R[F++]=pe+1}}xw(_,A,R),this.setAttribute("position",new Ue(_,3)),this.setAttribute("normal",new Ue(A,3)),this.setAttribute("uv",new Ue(C,2)),this.setIndex(new Ue(R,1)),this._nearSide=D,this._vScale=O}takeDepthStateFrom(e){let n=e;n._nearSide!==void 0&&(this._depth=n._depth??this._depth,this._nearSide=n._nearSide,this._vScale=n._vScale??this._vScale)}canShiftDepthTo(e){return this._nearSide.length>0&&this._depth>0&&e>0}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let n=e-this._depth;if(this._depth=e,n===0)return!0;let r=this.getAttribute("position");if(r===void 0)return!1;let s=r.array,o=this.getAttribute("uv"),a=o?.array,l=this._vScale>0?n/this._vScale:0,c=this._nearSide;for(let u=0;u<c.length;u++){let d=c[u];d!==0&&(s[u*3+2]+=n,d===IV&&a!==void 0&&(a[u*2+1]+=l))}return r.needsUpdate=!0,o!==void 0&&l!==0&&(o.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let n=this.boundingBox;n.min.z=Math.min(0,e),n.max.z=Math.max(0,e),this.boundingSphere!==null&&n.getBoundingSphere(this.boundingSphere)}clone(){let e=new eh(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return e.userData=su(this.userData),e}}});var Vf,F2=B(()=>{"use strict";q();kf();dn();Ew();Vf=class extends Me{constructor(e,n=12,r={}){super();this.type="ShapeGeometry";this.windingRule=Nn.ODD;this.elementType=si.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=e,this._curveSegments=n,this._triangulationOptions=Object.assign({windingRule:Nn.ODD,elementType:si.POLYGONS,polySize:3,vertexSize:2,strict:!0},r);let s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(f=>f.extractShapePointsToFlatArray([],this._curveSegments)),a,l=!0,c=!0,u,d;for(let f=0,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{a=Eu({contours:[s,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{a=Sw}let h=a?.vertexCount??1,p=a?.elementCount??1;if(this._positionAttribute=new Ue(new Float32Array(h*3),3),this._normalAttribute=new Ue(new Float32Array(h*3),3),this._uvAttribute=new Ue(new Float32Array(h*2),2),this._indexAttribute=new Ue(new Uint32Array(p*3),1),a){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,T=a.vertices[E+0],w=a.vertices[E+1];T<f&&(f=T),T>m&&(m=T),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,T=a.vertices[E+0],w=a.vertices[E+1],_=(T-f)/v,A=(w-g)/b;this._positionAttribute.setXYZ(x,T,w,0),this._normalAttribute.setXYZ(x,0,0,1),this._uvAttribute.setXY(x,_,A)}for(let x=0,S=p;x<S;x++){let E=x*3,T=a.elements[E+0],w=a.elements[E+1],_=a.elements[E+2];this._indexAttribute.setX(E+0,T),this._indexAttribute.setX(E+1,w),this._indexAttribute.setX(E+2,_)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,(a?.elementCount??1)*3)}clone(){let e=new Vf(this._shape,this._curveSegments);return e.userData=su(this.userData),e}}});function LV(i){if(Aw)return Aw;async function t(){let n=i??(!1?".":"https://unpkg.com/@splinetool/runtime@2.0.77/build"),s=import("./bevel.js"),[o,a]=await Promise.all([s,fetch(`${n}/bevel.wasm`).then(l=>l.arrayBuffer())]);await o.default({module_or_path:a}),Pv=o}return Aw=t(),Aw}function NV(){return Pv!==void 0}function BV(i){let t=!1;return i.scene.objects.traverse((e,n)=>{let r=n.geometry;if(r!==void 0&&(fte.has(r.type)&&r.depth!==void 0&&r.depth>0&&(r.extrudeBevelSize??0)>0&&(t=!0),r.type==="PathGeometry")){let s=r.extrusion;s!==void 0&&s.capType==="round"&&(s.bevel??0)>0&&(t=!0)}}),t}function FV(i,t){let n=[i.extractShapePointsToFlatArray([],t)];for(let l of i.shapeHoles)n.push(l.extractShapePointsToFlatArray([],t));let r=0;for(let l of n)r+=l.length>>1;let s=new Float64Array(r*2),o=new Uint32Array(n.length),a=0;for(let l=0;l<n.length;l++)s.set(n[l],a*2),a+=n[l].length>>1,o[l]=a;return{points:s,ends:o}}function mte(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i[e],t=Math.imul(t,16777619)>>>0;return t}function gte(i,t){let e=[t],n=r=>{e.push(r.points.length,r.isClosed?1:0,r.roundness??0);for(let s of r.points){e.push(s.roundness??0,s.position.x,s.position.y);for(let o of s.controls)e.push(o.position.x,o.position.y)}e.push(r.shapeHoles.length);for(let s of r.shapeHoles)n(s)};return n(i),mte(new Uint8Array(new Float64Array(e).buffer))}function vte(i,t,e,n,r){let s=1/0;for(let o=2;o<i.length;o+=3)i[o]<s&&(s=i[o]);if(s===1/0&&(s=0),s!==0)for(let o=2;o<i.length;o+=3)i[o]-=s;return{positions:i,normals:t,uvs:e,indices:n,rise:r-s}}function Cv(i,t,e,n,r,s){let o=i.positions.length/3,a=r.elements,l=yte.getNormalMatrix(r).elements;for(let u=0;u<o;u++){let d=u*3,h=(e+u)*3,p=i.positions[d],f=i.positions[d+1],m=i.positions[d+2];t.positions[h]=a[0]*p+a[4]*f+a[8]*m+a[12],t.positions[h+1]=a[1]*p+a[5]*f+a[9]*m+a[13],t.positions[h+2]=a[2]*p+a[6]*f+a[10]*m+a[14];let g=i.normals[d],y=i.normals[d+1],v=i.normals[d+2];t.normals[h]=l[0]*g+l[3]*y+l[6]*v,t.normals[h+1]=l[1]*g+l[4]*y+l[7]*v,t.normals[h+2]=l[2]*g+l[5]*y+l[8]*v;let b=(e+u)*2;if(s===void 0)t.uvs[b]=i.uvs[u*2],t.uvs[b+1]=i.uvs[u*2+1];else{let[x,S]=s(p,f,i.uvs[u*2],i.uvs[u*2+1],u);t.uvs[b]=x,t.uvs[b+1]=S}}let c=r.determinant()<0;for(let u=0;u<i.indices.length;u+=3)t.indices[n+u]=i.indices[u]+e,t.indices[n+u+1]=i.indices[u+(c?2:1)]+e,t.indices[n+u+2]=i.indices[u+(c?1:2)]+e}function wte(i,t,e,n,r,s=!1){let o=n.positions.length/3,a=e-n.rise,l=n.rise,{points:c,ends:u}=FV(i,t),d=1/0,h=1/0,p=-1/0,f=-1/0;for(let W=0;W<c.length;W+=2)c[W]<d&&(d=c[W]),c[W]>p&&(p=c[W]),c[W+1]<h&&(h=c[W+1]),c[W+1]>f&&(f=c[W+1]);s&&(r=void 0);let m=r??p-d,g=r??f-h,y={minX:d,minY:h,spanX:p-d||1,spanY:f-h||1},v=[],b=0;for(let W of u)v.push({at:b,count:W-b}),b=W;let x=0;for(let W of v)x+=W.count;let S=o*2+x*4,E=new Float32Array(S*3),T=new Float32Array(S*3),w=new Float32Array(S*2),_=new Uint32Array(n.indices.length*2+x*6),A=new Uint8Array(S),C=0,R=r===void 0?void 0:(W,K)=>[W/r,K/r],D=s?(W,K,Y,$,ee)=>B2(n,ee)?[$,Y]:[Y,$]:R,O=s?Tw(n):n,L={positions:E,normals:T,uvs:w,indices:_};Cv(O,L,0,0,bte.makeTranslation(0,0,a),R),Cv(O,L,o,n.indices.length,xte.makeTranslation(0,0,l).multiply(Ste),D),A.fill(1,0,o);let F=o*2,j=n.indices.length*2;for(let W=0;W<v.length;W++){let{at:K,count:Y}=v[W],$=c.subarray(K*2,(K+Y)*2),ee=vw($,W>0),oe=s?{u:new Float32Array(Y+1),vScale:0}:bw($,m,g),ae=oe.u;C=oe.vScale;for(let de=0;de<Y;de++){let be=(de+1)%Y,[Re,me]=ee[de],Ae=F;for(let[Le,Ie,Ge,Ve,pe,Ne]of[[$[de*2],$[de*2+1],Re,a,ae[de],U2],[$[be*2],$[be*2+1],me,a,ae[de+1],U2],[$[be*2],$[be*2+1],me,l,ae[de+1],0],[$[de*2],$[de*2+1],Re,l,ae[de],0]]){let we=F*3;if(E[we]=Le,E[we+1]=Ie,E[we+2]=Ve,T[we]=Ge[0],T[we+1]=Ge[1],T[we+2]=0,s){let[$e,nt]=Mw(y,Le,Ie,Ne===0);w[F*2]=$e,w[F*2+1]=nt}else w[F*2]=pe,w[F*2+1]=C===0?0:(Ve-l)/C;A[F]=Ne,F++}_[j++]=Ae,_[j++]=Ae+1,_[j++]=Ae+2,_[j++]=Ae,_[j++]=Ae+2,_[j++]=Ae+3}}return xw(E,T,_),{positions:E,normals:T,uvs:w,indices:_,nearSide:A,vScale:C}}function UV(i){let{owner:t,shape:e,curveSegments:n,assembledAt:r,bevel:s,bevelSegments:o}=i,a=gte(e,n),l=t??`outline:${a}`,c=`${s}/${o}`,u=k2.get(l);if(u!==void 0&&u.outlineVersion===a&&u.capKey===c&&(i.stillServes?.(u)??!0))return DV.placements++,u.cap;let d=Ete(e,n,r,s,o);DV.assemblies++;try{let h=Tte(d,r);return k2.set(l,{outlineVersion:a,capKey:c,assembledAt:r,cap:h}),h}finally{d.free()}}function kV(i){k2.delete(i)}function Ete(i,t,e,n,r){let{points:s,ends:o}=FV(i,t);return Pv.assemble_cap(s,o,e,n,0,Math.max(1,Math.floor(r)),pte,40)}function VV(i,t,e,n,r){if(!(Pv===void 0||!(t>0)))return UV({owner:r,shape:i,curveSegments:n,assembledAt:2*t,bevel:t,bevelSegments:e})}function Tte(i,t){return vte(i.positions(),i.normals(),i.uvs(),i.indices(),t)}function th(i,t){return t*.5>i*(1+.001)}var Pv,pte,Aw,fte,yte,bte,xte,Ste,U2,k2,DV,zf,nh=B(()=>{q();dn();N2();_w();pte=.4;fte=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]);yte=new wt;bte=new te,xte=new te,Ste=new te().makeScale(1,1,-1);U2=2,k2=new Map,DV={assemblies:0,placements:0};zf=class extends Me{constructor(e,n,r=0,s=12,o=3,a,l,c=!1){super();this.type="ShapeGeometry";this._nearSide=new Uint8Array(0);this._effectiveBevel=0;this._vScale=0;if(Pv===void 0)throw new Error("bevel-wasm is not loaded");this._shape=e,this._uvPitch=l,this._legacy=c,this._depth=n,this._bevel=r,this._curveSegments=s,this._bevelSegments=o,this._ownerId=a,this.rebuild()}takeDepthStateFrom(e){let n=e;n._nearSide!==void 0&&(this._depth=n._depth??this._depth,this._nearSide=n._nearSide,this._vScale=n._vScale??this._vScale,this._effectiveBevel=n._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length>0&&th(this._effectiveBevel,e)&&th(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let n=e-this._depth;if(this._depth=e,n===0)return!0;let r=this.getAttribute("position");if(r===void 0)return!1;let s=r.array,o=this.getAttribute("uv"),a=o?.array,l=this._vScale>0?n/this._vScale:0,c=this._nearSide;for(let u=0;u<c.length;u++){let d=c[u];d!==0&&(s[u*3+2]+=n,d===U2&&a!==void 0&&(a[u*2+1]+=l))}return r.needsUpdate=!0,o!==void 0&&l!==0&&(o.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let n=this.boundingBox;n.min.z=Math.min(0,e),n.max.z=Math.max(0,e),this.boundingSphere!==null&&n.getBoundingSphere(this.boundingSphere)}setDepth(e){e!==this._depth&&(this._depth=e,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let e=UV({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:l=>th(l.cap.rise,this._depth)&&th(l.cap.rise,l.assembledAt)}),n=wte(this._shape,this._curveSegments,this._depth,e,this._uvPitch,this._legacy);this._nearSide=n.nearSide,this._vScale=n.vScale,this._effectiveBevel=e.rise;let r=this.getAttribute("position"),s=this.getAttribute("normal"),o=this.getAttribute("uv"),a=this.getIndex();if(r!==void 0&&s!==void 0&&o!==void 0&&a!==null&&r.array.length===n.positions.length&&s.array.length===n.normals.length&&o.array.length===n.uvs.length&&a.array.length===n.indices.length){r.array.set(n.positions),s.array.set(n.normals),o.array.set(n.uvs),a.array.set(n.indices),r.needsUpdate=!0,s.needsUpdate=!0,o.needsUpdate=!0,a.needsUpdate=!0;return}this.setAttribute("position",new Ue(n.positions,3)),this.setAttribute("normal",new Ue(n.normals,3)),this.setAttribute("uv",new Ue(n.uvs,2)),this.setIndex(new Ue(n.indices,1))}clone(){let e=new zf(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return e.userData=su(this.userData),e}}});var Ms,uc=B(()=>{"use strict";cc();OV();F2();nh();kf();Ms=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Nn.ODD},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),o=i.shape??t?.shape,a=o?.roundness??e.roundness,l;o!==void 0&&(o instanceof yn?(l=o,(l.width!==n||l.height!==r)&&l.applySize(n,r)):l=new yn(n,r).fromJSON(o),i.parameters?.roundness!==void 0&&i.parameters?.roundness>0&&l.update());let c=l??new yn(n,r);return{parameters:Object.assign(e,{width:n,height:r,depth:s,roundness:a}),shape:c,ownerId:i.ownerId??t?.ownerId}}static build(i){let{depth:t,extrudeBevelSize:e,extrudeBevelSegments:n,subdivisions:r,roundness:s,windingRule:o,uvPitch:a,extrusionVersion:l}=i.parameters,c=l===1;i.shape.roundness=s;let u;return t<=0?u=new Vf(i.shape,r,{windingRule:o}):e<=0?u=new eh(i.shape,t,r,o,a,c):NV()?u=new zf(i.shape,t,e,r,n,i.ownerId,a,c):(console.error("[extrude] engine not loaded \u2014 extruding without a bevel"),u=new eh(i.shape,t,r,o,a,c)),Object.assign(u,{userData:{...i,type:"VectorGeometry"}})}}});function Mte(i,t,e,n,r,s){if(n>=GV)return r>30||r%4===0?(Ate(i,t,e,s),Math.round(r/4)):zV(i,n,r,t,e,s);n=Math.max(n,.001);let o={x:0,y:e},a=n+Math.PI*.5,l={x:Math.cos(a)*t,y:Math.sin(a)*e},c=EV({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:t,ry:e,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?_te(i,o.x,o.y,c,r,t,e,s):zV(i,n,r,t,e,s)}function _te(i,t,e,n,r,s,o,a){let l=Math.round(r/n.length);i.addPoint(Gf(t,e));for(let c=0,u=n.length;c<u;c++){let d=n[c],h=i.points[c],p=Gf(d.x,d.y);h.controls[1].position.set(d.x1,d.y1),p.controls[0].position.set(d.x2,d.y2),i.addPoint(p)}return a>0?jV(i,s,o,a):i.addPoint(Gf(0,0)),l}function zV(i,t,e,n,r,s){let o=-t/e;for(let a=0;a<=e;a++){let l=o*a,c=Math.sin(l)*n,u=Math.cos(l)*r;i.addPoint(Gf(c,u))}return t<GV?s>0?jV(i,n,r,s):i.addPoint(Gf(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&HV(i,n,r,s)),1}function Ate(i,t,e,n=0,r=0,s=0){let o=.5522847498,a=t*o,l=e*o;i.addPoint(Cw(r-t,s,r-t,s-l,r-t,s+l)),i.addPoint(Cw(r,s+e,r-a,s+e,r+a,s+e)),i.addPoint(Cw(r+t,s,r+t,s+l,r+t,s-l)),i.addPoint(Cw(r,s-e,r+a,s-e,r-a,s-e)),n>0&&HV(i,t,e,n)}function Gf(i,t){return new ua(ge.generateUUID(),new G(i,t))}function Cw(i,t,e,n,r,s){let o=Gf(i,t);return o.controls[0].position.set(e,n),o.controls[1].position.set(r,s),o}function jV(i,t,e,n){WV(i,t,e,n).forEach(s=>i.addPoint(s))}function HV(i,t,e,n){let r=WV(i,t,e,n),s=new yn;r.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function WV(i,t,e,n){let r=n*t/100,s=r*(Math.abs(e)/Math.abs(t)),o=new G(r/t,s/e),a=i.points.map(l=>{let c=l.clone();return c.uuid=ge.generateUUID(),c}).reverse();return a.forEach(l=>{l.position.multiply(o);let c=l.controls[0].position.clone().multiply(o),u=l.controls[1].position.clone().multiply(o);l.controls[0].position.copy(u),l.controls[1].position.copy(c)}),a}var GV,jf,Rv=B(()=>{"use strict";cc();R2();TV();uc();q();GV=Math.PI*2,jf=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=ge.clamp(e.angle,0,360),{shape:i.shape&&i.shape instanceof yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:n,angle:r,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,extrusionVersion:c}=i.parameters,u=i.shape,d=t*.5,h=e*.5,p=Mte(u,d,h,r*Math.PI/180,n,s);u.isClosed=!0,u.update();let f;return r===0?(f=new Me,f.setAttribute("position",new Be([],3))):f=Ms.create({shape:u,parameters:{subdivisions:p,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,extrusionVersion:c}}),Object.assign(f,{userData:{...i,type:"EllipseGeometry"}})}}});var qV,Iv,V2=B(()=>{"use strict";q();E2();qV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,detail:r,corner:s,cornerSides:o}=i.parameters,a=r===0&&s!==0?new Iv(t*.5,s,o):new vd(t*.5,r),l=e/t,c=n/t;return(l!==1||c!==1)&&a.scale(1,l,c),Object.assign(a,{userData:{...i,type:"IcosahedronGeometry"}})}},Iv=class extends Su{constructor(t=1,e=.2,n=4){let r=(1+Math.sqrt(5))/2,s=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a="IcosahedronGeometry";super(s,o,a,t,e,n),this.type=a}static fromJSON(t){return new Iv(t.radius,t.corner,t.cornerSides)}}});var XV,z2=B(()=>{"use strict";q();XV=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 Oa;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 bd(r.extractPoints(n).shape,e);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...i,type:"LatheGeometry"}})}}});function Hf(i,t){return Math.abs(t-i)/2+Math.min(i,t)}function Cte(i){let t=i.getAttribute("position");if(t===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let e=i.getAttribute("uv"),n=i.getIndex(),r=t.count,s=new Map,o=new Uint32Array(r),a=[],l=0;for(let m=0;m<r;m++){let g=t.getX(m),y=t.getY(m),v=t.getZ(m),b=Math.round(g*G2),x=Math.round(y*G2),S=Math.round(v*G2),E=s.get(b);E===void 0&&(E=new Map,s.set(b,E));let T=E.get(x);T===void 0&&(T=new Map,E.set(x,T));let w=T.get(S);w===void 0&&(w=l++,T.set(S,w),a.push(g,y,v)),o[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=o[y],S=o[v],E=o[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(a),faces:Uint32Array.from(c),materialIndices:u,uvs:d===null?null:Float64Array.from(d)}}function Pte(i){let{positions:t,faces:e,materialIndices:n,uvs:r}=i,s=t.length/3,o=e.length/3,a=r!==null&&o>0,l=o*3,c=new Uint32Array(l),u=new Uint32Array(l),d=new Uint32Array(l),h=new Uint32Array(l),p=new Uint32Array(l),f=0,m=8;for(;m<l*2;)m*=2;let g=m-1,y=new Int32Array(m).fill(-1),v=(O,L)=>{let F=(Math.imul(O,2654435761)^L)&g;for(;;){let j=y[F];if(j===-1)return y[F]=f,c[f]=O,u[f]=L,f++;if(c[j]===O&&u[j]===L)return j;F=F+1&g}},b=(O,L)=>{let F=O<L?O:L,j=O<L?L:O,W=(Math.imul(F,2654435761)^j)&g;for(;;){let K=y[W];if(c[K]===F&&u[K]===j)return K;W=W+1&g}},x=new Uint32Array(s),S=new Float64Array(s*3),E=(O,L,F)=>{let j=O<L?v(O,L):v(L,O),W=++d[j];W===1?h[j]=F:W===2&&(p[j]=F),x[O]++,x[L]++,S[O*3]+=t[L*3],S[O*3+1]+=t[L*3+1],S[O*3+2]+=t[L*3+2],S[L*3]+=t[O*3],S[L*3+1]+=t[O*3+1],S[L*3+2]+=t[O*3+2]};for(let O=0;O<o;O++){let L=e[O*3],F=e[O*3+1],j=e[O*3+2];E(L,F,j),E(F,j,L),E(j,L,F)}let T=new Float64Array(f*3);for(let O=0;O<f;O++){let L=c[O]*3,F=u[O]*3;if(d[O]===2){let K=h[O]*3,Y=p[O]*3;T[O*3]=(t[L]+t[F])*.375+(t[K]+t[Y])*.125,T[O*3+1]=(t[L+1]+t[F+1])*.375+(t[K+1]+t[Y+1])*.125,T[O*3+2]=(t[L+2]+t[F+2])*.375+(t[K+2]+t[Y+2])*.125}else T[O*3]=(t[L]+t[F])*.5,T[O*3+1]=(t[L+1]+t[F+1])*.5,T[O*3+2]=(t[L+2]+t[F+2])*.5}let w=new Float64Array(s*3),_;for(let O=0;O<s;O++){let L=x[O];L===3?_=3/16:L>3&&(_=3/(8*L));let F=1-L*Number(_),j=Number(_);L===2&&(F=3/4,j=1/8),w[O*3]=t[O*3]*F+S[O*3]*j,w[O*3+1]=t[O*3+1]*F+S[O*3+1]*j,w[O*3+2]=t[O*3+2]*F+S[O*3+2]*j}let A=new Float64Array((s+f)*3);A.set(w),A.set(T,s*3);let C=new Uint32Array(o*12),R=new Array(o*4),D=a?new Float64Array(o*24):null;for(let O=0;O<o;O++){let L=e[O*3],F=e[O*3+1],j=e[O*3+2],W=b(L,F)+s,K=b(F,j)+s,Y=b(j,L)+s,$=O*12;C[$++]=W,C[$++]=K,C[$++]=Y,C[$++]=L,C[$++]=W,C[$++]=Y,C[$++]=F,C[$++]=K,C[$++]=W,C[$++]=j,C[$++]=Y,C[$++]=K;let ee=n[O];if(R[O*4]=ee,R[O*4+1]=ee,R[O*4+2]=ee,R[O*4+3]=ee,D!==null){let oe=O*6,ae=r[oe],de=r[oe+1],be=r[oe+2],Re=r[oe+3],me=r[oe+4],Ae=r[oe+5],Le=Hf(ae,be),Ie=Hf(de,Re),Ge=Hf(be,me),Ve=Hf(Re,Ae),pe=Hf(ae,me),Ne=Hf(de,Ae),we=O*24;D[we++]=Le,D[we++]=Ie,D[we++]=Ge,D[we++]=Ve,D[we++]=pe,D[we++]=Ne,D[we++]=ae,D[we++]=de,D[we++]=Le,D[we++]=Ie,D[we++]=pe,D[we++]=Ne,D[we++]=be,D[we++]=Re,D[we++]=Ge,D[we++]=Ve,D[we++]=Le,D[we++]=Ie,D[we++]=me,D[we++]=Ae,D[we++]=pe,D[we++]=Ne,D[we++]=Ge,D[we++]=Ve}}return{positions:A,faces:C,materialIndices:R,uvs:D}}function Rte(i,t){let{positions:e,faces:n,materialIndices:r,uvs:s}=i,o=e.length/3,a=n.length/3,l=new Float64Array(o*3);for(let f=0;f<a;f++){let 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],T=e[m+2]-e[g+2],w=b*T-x*E,_=x*S-v*T,A=v*E-b*S;l[m]+=w,l[m+1]+=_,l[m+2]+=A,l[g]+=w,l[g+1]+=_,l[g+2]+=A,l[y]+=w,l[y+1]+=_,l[y+2]+=A}for(let f=0;f<o;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=a*3,u=new Float32Array(c*3),d=new Float32Array(c*3),h=s!==null&&s.length>0?new Float32Array(c*2):null;for(let f=0;f<c;f++){let 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 Me;p.setAttribute("position",new Ue(u,3)),c>0&&(p.setAttribute("normal",new Ue(d,3)),p.setAttribute("color",new Ue(new Float32Array(c*3).fill(1),3))),h!==null&&p.setAttribute("uv",new Ue(h,2));for(let f=0;f<a;){let m=r[f],g=f;do f++;while(f<a&&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 G2,Pw,YV=B(()=>{"use strict";q();G2=1e4;Pw=class{constructor(t=1){this.subdivisions=t}modify(t){let e=Cte(t),n=this.subdivisions;for(;n-- >0;)e=Pte(e);return Rte(e,t)}}});function Ite(i){let t=new Nt,e=i.attributes.position;return e?(t.setFromBufferAttribute(e),t):(t.makeEmpty(),t)}var gi,$V,j2=B(()=>{"use strict";q();YV();gi=new M,$V=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=i.geometry??t?.geometry??new Me().copy(new ni(100,100,100)),n;t===void 0?(e.computeBoundingBox(),e.boundingBox.getSize(gi),n={width:gi.x,height:gi.y,depth:gi.z,subdivisions:0}):n=t.parameters;let r={...n,...i.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:e}}static build(i){let{width:t,height:e,depth:n,subdivisions:r}=i.parameters,s=i.geometry??new Me().copy(new ni(100,100,100)),o=s.userData.parameters;o===void 0?(s.boundingBox=Ite(s),s.boundingBox.getSize(gi)):gi.set(o.width,o.height,o.depth),(t!==gi.x||e!==gi.y||n!==gi.z)&&s.scale(gi.x===0?1:t/gi.x,gi.y===0?1:e/gi.y,gi.z===0?1:n/gi.z);let a=s.originalGeometry;try{r>0?(a===void 0||o?.subdivisions!==r)&&(a===void 0&&(a=s),s=new Pw(r).modify(a)):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return a!==void 0&&Object.assign(s,{originalGeometry:a}),delete i.geometry,Object.assign(s,{userData:{...i,type:"NonParametricGeometry"}})}static loadFromUrl(i,t,e){new Ed(e).load(i,r=>{let s=this.normalizeInputs({geometry:r});r.boundingBox.getSize(gi);let o=100/gi.x;Object.assign(s.parameters,{width:100,height:gi.y*o,depth:gi.z*o}),t(this.build(s))})}}});var Rw,Iw=B(()=>{"use strict";cc();uc();Rw=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 yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a,extrusionVersion:l}=i.parameters,c=i.shape,u=t*.5,d=e*.5,h=0,p=0,f=2*Math.PI/n;for(let g=0;g<n;g++){let y=f*g,v=h+Math.sin(y)*u,b=p+Math.cos(y)*d;c.addPoint(c.createPoint(v,b))}c.isClosed=!0;for(let g=0,y=c.points.length;g<y;g++)c.points[g].roundness=r;c.roundness=r,c.update();let m=Ms.create({shape:c,parameters:{roundness:r,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(m,{userData:{...i,type:"PolygonGeometry"}})}}});function Ov(i,t,e){e.x=i.x*t.x,e.y=i.y,e.z=i.x*t.y}function H2(i,t,e,n,r,s){let o=Ote.copy(t).sub(i),a=Dte.copy(e).sub(i),l=o.angleTo(a);if(o.normalize(),a.normalize(),n===r){let c=o.add(a).normalize();s.copy(i).addScaledVector(c,n/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(i),s.addScaledVector(o,r/Math.sin(c)),s.addScaledVector(a,n/Math.sin(c))}}function Lte(i,t,e){let n=i.clone().sub(t),r=e.clone().sub(t);return n.projectOnVector(r),n.add(t)}var KV,Ote,Dte,W2,q2=B(()=>{"use strict";q();KV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,radialSegments:r,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=new W2(t*.5,e,r,s,o,a,l),u=n/t;return u!==1&&c.scale(1,1,u),Object.assign(c,{userData:{...i,type:"PyramidGeometry"}})}};Ote=new M,Dte=new M;W2=class extends Me{constructor(t=.5,e=1,n=4,r=1,s=!1,o=0,a=4){super(),n=Math.floor(Math.max(3,n)),r=Math.floor(r),a=Math.floor(a);let l=[],c=[],u=[],d=[],h=0,p=e/2,f=Math.PI/n,m=t*Math.cos(Math.PI/n),g=2*Math.PI/n,y=(n-2)*Math.PI/n,v=Math.PI-y,b=new M(0,-p,0),x=new M(0,p,0),S=new G(t,-p),E=new G(m,-p),T=new G(0,x.y).sub(E),w=new G(0,x.y).sub(S),_=new G(T.y,-T.x).normalize(),A=new G(w.y,-w.x).normalize(),R=t*Math.cos(Math.PI/n)*Math.tan((Math.PI-T.angle())/2)-1e-8;o=Math.min(o,R);let D;{let Y=new M(_.x,_.y,0),$=new M(Math.cos(g)*Y.x,Y.y,Math.sin(g)*Y.x);D=Y.angleTo($)}let O=o/Math.tan((Math.PI-T.angle())/2),L=o/Math.tan((Math.PI-D)/2),F=new M;if(!s){c.push(b.x,b.y,b.z),u.push(0,-1,0),d.push(0,0);let Y=h++,$=[],ee=S.clone(),oe=O/Math.cos(Math.PI/n);ee.x-=oe;for(let ae=0;ae<n;ae++){let de=ae/n*Math.PI*2+f,be=new G(Math.sin(de),Math.cos(de));Ov(ee,be,F),c.push(F.x,F.y,F.z),u.push(0,-1,0),d.push(0,0),$.push(h++)}for(let ae=0;ae<$.length;ae++)l.push($[ae],Y,$[(ae+1)%$.length])}let j=[];{let Y=new M,$=new M,ee=new M,oe=new M,ae=new M,de=new M;for(let be=0;be<n;be++){let Re=be/n*Math.PI*2+f,me=(be+.5)/n*Math.PI*2+f,Ae=(be+1)/n*Math.PI*2+f,Le=new G(Math.sin(Re),Math.cos(Re)),Ie=new G(Math.sin(me),Math.cos(me)),Ge=new G(Math.sin(Ae),Math.cos(Ae));Ov(S,Le,$),Ov(S,Ge,ee),Ov(_,Ie,Y),H2(x,$,ee,L,L,oe),c.push(oe.x,oe.y,oe.z),H2($,x,ee,L,O,ae),c.push(ae.x,ae.y,ae.z),H2(ee,$,x,O,L,de),c.push(de.x,de.y,de.z),u.push(Y.x,Y.y,Y.z),u.push(Y.x,Y.y,Y.z),u.push(Y.x,Y.y,Y.z),d.push(0,0),d.push(0,0),d.push(0,0);let Ve=h++,pe=h++,Ne=h++;if(l.push(Ve,pe,Ne),o>0){{let nt=$.clone().add(ee).multiplyScalar(.5),Ce=x.clone().sub(nt).normalize(),V=b.clone().sub(nt).normalize().add(Ce).normalize().multiplyScalar(-1),_e=de.clone().sub(ae);W(nt,_e,V,T.angle())}let we,$e;{let nt=new M;Ov(A,Ge,nt);let Ce=de.clone().add(oe).multiplyScalar(.5);Ce=Lte(Ce,ee,x);let je=de.clone().sub(oe);[we,$e]=W(Ce,je,nt,D,oe.y)}{let nt=we,Ce=nt.clone().setY(0).normalize(),je=new M(0,-1,0),V=Ce.clone().cross(je);K(nt,Ce,je,V)}j.concat($e);{let nt=T.angle(),Ce=Math.PI-nt,je=x.clone();je.y-=o/Math.sin(nt-Math.PI/2);let V=new M,_e=[];for(let ct=0;ct<a;ct++){let lt=[],z=Math.PI/2-Ce*ct/a,I=Math.cos(z),Z=Math.sin(z),re=me;for(let he=0;he<=ct;he++){let ye=Math.cos(re),Oe=Math.sin(re);Y.x=I*Oe,Y.y=Z,Y.z=I*ye,V.copy(je).addScaledVector(Y,o),c.push(V.x,V.y,V.z),u.push(Y.x,Y.y,Y.z),d.push(0,0),lt.push(h++),re+=Math.PI*2/ct/n}_e.push(lt)}$e.reverse(),_e.push($e);let X=_e.length-1;for(let ct=0;ct<X;ct++){let lt=_e[ct],z=_e[ct+1],I=lt.length-1;l.push(z[1],lt[0],z[0]);for(let Z=1;Z<=I;Z++)l.push(lt[Z],lt[Z-1],z[Z]),l.push(z[Z+1],lt[Z],z[Z])}}}}}this.setIndex(l),this.setAttribute("position",new Be(c,3)),this.setAttribute("normal",new Be(u,3)),this.setAttribute("uv",new Be(d,2));function W(Y,$,ee,oe,ae){let de=-oe/2,be=(Math.PI-oe)/2,Re=$.clone().normalize().cross(ee);Y.addScaledVector(ee,-o/Math.sin(be));let me=new M,Ae=new M,Le=1,Ie=h,Ge=[];for(let Ve=0;Ve<=a;Ve++){let pe=de+Ve/a*oe;Ae.set(0,0,0),Ae.addScaledVector(Re,Math.sin(pe)),Ae.addScaledVector(ee,Math.cos(pe));for(let Ne=0;Ne<=Le;Ne++){let we=Ne/Le-.5;if(me.copy(Y),me.addScaledVector($,we),me.addScaledVector(Ae,o),ae!=null){let $e=Math.max(0,me.y-ae);me.addScaledVector($,-$e/$.y)}c.push(me.x,me.y,me.z),u.push(Ae.x,Ae.y,Ae.z),d.push(0,0),Ne===0&&Ge.push(h),h++}}for(let Ve=0;Ve<a;Ve++)for(let pe=0;pe<Le;pe++){let Ne=Ie+pe+(Le+1)*Ve,we=Ne+(Le+1),$e=we+1,nt=Ne+1;l.push(Ne,we,nt),l.push(we,$e,nt)}return[Y.clone().addScaledVector($,.5),Ge]}function K(Y,$,ee,oe){let ae=Math.PI/2,de=w.angle()-ae,be=[],Re=new M,me=new M;for(let Le=0;Le<=a;Le++){let Ie=[],Ge=Le/a;for(let Ve=0;Ve<=Le;Ve++){let Ne=((Le?Ve/Le:0)-.5)*v,we=Math.cos(Ne),$e=Math.sin(Ne),nt=Math.atan(Math.tan(de)*we),Ce=(ae+nt)*Ge,je=Math.cos(Ce),V=Math.sin(Ce);Re.set(0,0,0),Re.addScaledVector($,V*we),Re.addScaledVector(ee,je),Re.addScaledVector(oe,V*$e),me.copy(Y).addScaledVector(Re,o),c.push(me.x,me.y,me.z),u.push(Re.x,Re.y,Re.z),d.push(0,0),Ie.push(h++)}be.push(Ie)}let Ae=be.length-1;for(let Le=0;Le<Ae;Le++){let Ie=be[Le],Ge=be[Le+1],Ve=Ie.length-1;l.push(Ie[0],Ge[1],Ge[0]);for(let pe=1;pe<=Ve;pe++)l.push(Ie[pe-1],Ie[pe],Ge[pe]),l.push(Ie[pe],Ge[pe+1],Ge[pe])}}}}});var Wf,Dv=B(()=>{"use strict";cc();uc();Wf=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 yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)}),ui:n}}static build(i){let t=i.shape,{width:e,height:n,cornerRadius:r,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,extrusionVersion:c}=i.parameters,u={x:e*.5,y:n*.5},d={x:-u.x,y:-u.y},h={x:u.x,y:u.y};function p(S,E,T){return E>e&&T>n?Math.min(S*e/E,S*n/T):E>e?S*e/E:T>n?S*n/T:S}let f=[];f[0]=r[0]===0?0:p(r[0],r[0]+r[3],r[0]+r[1]),f[1]=r[1]===0?0:p(r[1],r[1]+r[2],r[1]+r[0]),f[2]=r[2]===0?0:p(r[2],r[2]+r[1],r[2]+r[3]),f[3]=r[3]===0?0:p(r[3],r[3]+r[0],r[3]+r[2]);let m=d.x,g=h.x,y=h.y,v=d.y;t.addPoint(t.createPoint(m,y)),t.addPoint(t.createPoint(g,y)),t.addPoint(t.createPoint(g,v)),t.addPoint(t.createPoint(m,v)),t.isClosed=!0;let b=!0;for(let S=0,E=t.points.length;S<E;S++)t.points[S].roundness=f[S],S>0&&f[S]!==f[S-1]&&(b=!1);b&&(t.roundness=f[0]),t.useCubicForRoundedCorners=s!==1,t.update();let x=Ms.create({shape:t,parameters:{depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,extrusionVersion:c}});return Object.assign(x,{userData:{...i,type:"RectangleGeometry"}})}}});var ZV,X2=B(()=>{"use strict";q();ZV=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=ge.clamp(e.thetaLength,0,180),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t=100,height:e=t,depth:n=t,widthSegments:r=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,u;return c===0?(u=new Me,u.setAttribute("position",new Be([],3))):u=new os(.5*t,r,s,o,a,l,c*ge.DEG2RAD),u.scale(1,e/t,n/t),Object.assign(u,{userData:{...i,type:"SphereGeometry"}})}}});var QV,Y2=B(()=>{"use strict";q();QV=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 di(t,e,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...i,type:"PlaneGeometry"}})}}});var JV,$2,K2=B(()=>{"use strict";q();JV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,angle:r,cornerRadius:s,cornerSegments:o}=i.parameters,a=new $2(t,e,n,r,s,o);return Object.assign(a,{userData:{...i,type:"BackdropGeometry"}})}},$2=class extends Me{constructor(t=1,e=1,n=1,r=90,s=10,o=24){super(),this.type="BackdropGeometry";let a=[],l=[],c=[],u=.001;s==0&&(o=1),o=Math.max(1,Math.floor(o)),s=Math.min(s,100),r=Math.min(180-u,r),r*=Math.PI/180;let d=[],h=Math.PI/2,p=(me=0,Ae=0,Le=0)=>new M(me,Ae,Le),f=p(),m=p(),[g,y,v]=[e/2,t/2,n/2],b=-y,x=+y,[S,E,T]=[p(b,-g,+v),p(b,-g,-v),p(b,+g,-v)],w=(me,Ae=!1)=>Math.sin(me-Math.PI/(1+ +Ae)),_=(me,Ae=!1)=>Math.cos(me-Math.PI/(1+ +Ae));T.y=Math.sin(r)*e-g;let A=Math.cos(r)*e-v,C=S.z-u;r<=h?(T.z=Math.min(A,C),T.z==C&&(T.y-=(A-C)/Math.tan(h-r))):E.z=Math.min(E.z-A-v,S.z-u),f.subVectors(S,E),m.subVectors(T,E);let R=Math.min(f.length(),m.length())*s/100,D=R*Math.tan(r/2),O=R/Math.cos(r/2),L=f.clone().normalize().add(m.normalize()).setLength(O).add(E);f.set(0,w(r,!0),_(r,!0)),d.push([T,f.clone()]);let F=(Math.PI-r)/o;for(let me=0;me<=o;me++){let Ae=h+r+me*F;f.set(0,Math.sin(Ae)*D,Math.cos(Ae)*D),f.add(L),m.set(0,w(Ae),_(Ae)),d.push([f.clone(),m.clone()])}d.push([S,p(0,1,0)]);let j=Math.sin(F/2)*D*2,W=d.length-1,K=d[0][0].distanceTo(d[1][0]),Y=d[W-1][0].distanceTo(d[W][0]),$=K+j*o+Y;d[0].push(1);for(let me=0;me<=o;me++)d[me+1].push(1-(K+me*j)/$);d[W].push(0);let[ee,oe,ae]=d[0],de,be,Re;for(let me=1;me<d.length;me++)[de,be,Re]=d[me],a.push(b,ee.y,ee.z,b,de.y,de.z,x,ee.y,ee.z,x,ee.y,ee.z,b,de.y,de.z,x,de.y,de.z),l.push(0,oe.y,oe.z,0,be.y,be.z,0,oe.y,oe.z,0,oe.y,oe.z,0,be.y,be.z,0,be.y,be.z),c.push(0,ae,0,Re,1,ae,1,ae,0,Re,1,Re),[ee,oe,ae]=[de,be,Re];this.setAttribute("position",new Be(a,3)),this.setAttribute("normal",new Be(l,3)),this.setAttribute("uv",new Be(c,2))}}});var Ow,Dw=B(()=>{"use strict";cc();uc();Ow=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 yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:u}=i.parameters,d=i.shape,h=t*.5,p=e*.5,f=0,m=0,g=o*Math.PI/360/r,y=Math.PI/2*3*-1,v=h*n/100,b=p*n/100;if(r===3&&n===50){g=2*Math.PI/r;for(let S=0;S<r;S++){let E=g*S,T=f+Math.sin(E)*h,w=m+Math.cos(E)*p;d.addPoint(d.createPoint(T,w))}}else for(let S=0;S<r;S++){let E=f+Math.cos(y)*h,T=m+Math.sin(y)*p;d.addPoint(d.createPoint(E,T)),y+=g,E=f+Math.cos(y)*v,T=m+Math.sin(y)*b,d.addPoint(d.createPoint(E,T)),y+=g}d.isClosed=!0;for(let S=0,E=d.points.length;S<E;S++)d.points[S].roundness=s;d.roundness=s,d.update();let x=Ms.create({shape:d,parameters:{roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:u}});return Object.assign(x,{userData:{...i,type:"StarGeometry"}})}}});var ez,Z2=B(()=>{"use strict";q();ez=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 di(t,e);return Object.assign(n,{userData:{...i,type:"TextFrameGeometry"}})}}});function Nte(i,t,e,n,r,s,o,a,l,c,u){[t,e]=[e,t],o=t/2;let d=ge.clamp(r/360,0,1);if(d===0){let h=new Me;return h.setAttribute("position",new Be([],3)),h}return d===1&&(c=0),new yv(!0,i,t,e,n,d,s,o,a,l,c,u)}var tz,Q2=B(()=>{"use strict";q();Of();tz=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width);e.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(e.depth??e.width*.25));return{parameters:Object.assign(e,{width:n,height:r,depth:s})}}static build(i){let{width:t,height:e,depth:n,radialSegments:r,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=Nte(t,e,n,t*.5,o,s,0,0,r,a,l);return c.scale(1,e/t,1),Object.assign(c,{userData:{...i,type:"TorusGeometry"}})}}});var nz,J2=B(()=>{"use strict";q();nz=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width),tube:e.tube??e.width*.125})}}static build(i){let{width:t,tube:e,tubularSegments:n,radialSegments:r,p:s,q:o}=i.parameters,a=t*.5;a!==e&&(a-=e);let l=new xd(a,e,n,r,s,o);return Object.assign(l,{userData:{...i,type:"TorusKnotGeometry"}})}}});var rz,eR=B(()=>{"use strict";cc();uc();rz=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 yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width*(e.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t=100,height:e,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a,extrusionVersion:l}=i.parameters,c=i.shape,u=t*.5,d=e*.5;a?(c.addPoint(c.createPoint(-u,d)),c.addPoint(c.createPoint(u,-d)),c.addPoint(c.createPoint(-u,-d))):(c.addPoint(c.createPoint(0,d)),c.addPoint(c.createPoint(u,-d)),c.addPoint(c.createPoint(-u,-d))),c.isClosed=!0;for(let p=0,f=c.points.length;p<f;p++)c.points[p].roundness=n;c.roundness=n,c.update();let h=Ms.create({shape:c,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:o,extrusionVersion:l}});return Object.assign(h,{userData:{...i,type:"TriangleGeometry"}})}}});var iz=B(()=>{"use strict"});var uMe,dMe,hMe,pMe,fMe,mMe,gMe,sz=B(()=>{"use strict";q();uMe=new nr,dMe=new te,hMe=new Hi,pMe=new M,fMe=new M,mMe=new M,gMe=new M});function oz(){let i=new Me;return i.setAttribute("position",new Ue(new Float32Array([]),3)),i.setIndex(new Ue(new Uint16Array([]),1)),i}function zte(i,t,e,n){let r=typeof i.width=="string"?Number(n.getVariable(i.width)):i.width,s=[""],o="";for(let a of e)o+=a,a===" "||a===`
4141
+ `;continue}if((F=L.match(A))&&(O.gamma=parseFloat(F[1])),(F=L.match(C))&&(O.exposure=parseFloat(F[1])),(F=L.match(R))&&(O.valid|=2,O.format=F[1]),(F=L.match(D))&&(O.valid|=4,O.height=parseInt(F[1],10),O.width=parseInt(F[2],10)),O.valid&2&&O.valid&4)break}return O.valid&2||o(3,"missing format specifier"),O.valid&4||o(3,"missing image size specifier"),O},p=function(w,_,A){let C=_;if(C<8||C>32767||w[0]!==2||w[1]!==2||w[2]&128)return new Uint8Array(w);C!==(w[2]<<8|w[3])&&o(3,"wrong scanline width");let R=new Uint8Array(4*_*A);R.length||o(4,"unable to allocate buffer space");let D=0,O=0,L=4*C,F=new Uint8Array(4),j=new Uint8Array(L),W=A;for(;W>0&&O<w.byteLength;){O+4>w.byteLength&&o(1),F[0]=w[O++],F[1]=w[O++],F[2]=w[O++],F[3]=w[O++],(F[0]!=2||F[1]!=2||(F[2]<<8|F[3])!=C)&&o(3,"bad rgbe scanline format");let K=0,Y;for(;K<L&&O<w.byteLength;){Y=w[O++];let ee=Y>128;if(ee&&(Y-=128),(Y===0||K+Y>L)&&o(3,"bad scanline data"),ee){let oe=w[O++];for(let ae=0;ae<Y;ae++)j[K++]=oe}else j.set(w.subarray(O,O+Y),K),K+=Y,O+=Y}let $=C;for(let ee=0;ee<$;ee++){let oe=0;R[D]=j[ee+oe],oe+=C,R[D+1]=j[ee+oe],oe+=C,R[D+2]=j[ee+oe],oe+=C,R[D+3]=j[ee+oe],D+=4}W--}return R},f=function(w,_,A,C){let R=w[_+3],D=Math.pow(2,R-128)/255;A[C+0]=w[_+0]*D,A[C+1]=w[_+1]*D,A[C+2]=w[_+2]*D,A[C+3]=1},m=function(w,_,A,C){let R=w[_+3],D=Math.pow(2,R-128)/255;A[C+0]=Fs.toHalfFloat(Math.min(w[_+0]*D,65504)),A[C+1]=Fs.toHalfFloat(Math.min(w[_+1]*D,65504)),A[C+2]=Fs.toHalfFloat(Math.min(w[_+2]*D,65504)),A[C+3]=Fs.toHalfFloat(1)},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,T;switch(this.type){case qt:T=x.length/4;let w=new Float32Array(T*4);for(let A=0;A<T;A++)f(x,A*4,w,A*4);S=w,E=qt;break;case pr:T=x.length/4;let _=new Uint16Array(T*4);for(let A=0;A<T;A++)m(x,A*4,_,A*4);S=_,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:Pa,minFilter:ht,magFilter:ht,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function m2(i){return i.length>2&&i[0]===35&&i[1]===63}function jk(i){try{let t=new uw().parse(i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength));if(!t||!t.width||!t.height)return null;let{width:e,height:n}=t,r=t.data,s=new Uint16Array(r.length),o=e*4,a=u=>Fs.toHalfFloat(Math.pow(Math.max(Fs.fromHalfFloat(u),0),1/2.2)),l=new Map,c=u=>{let d=l.get(u);return d===void 0&&(d=a(u),l.set(u,d)),d};for(let u=0;u<n;u++){let d=u*o,h=(n-1-u)*o;for(let p=0;p<o;p+=4)s[h+p]=c(r[d+p]),s[h+p+1]=c(r[d+p+1]),s[h+p+2]=c(r[d+p+2]),s[h+p+3]=r[d+p+3]}return{isSplineHdr:!0,data:s,width:e,height:n}}catch{return null}}function Hk(i){let t=new Wn(i.data,i.width,i.height,Xn,pr);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var Wk=B(()=>{"use strict";q();Gk()});var Yee,Lf,g2=B(()=>{"use strict";q();p2();f2();Wk();Yee=0,Lf=class extends lw{constructor(e,n){super(e,n.imageHolderCache);this.data=e;this.shared=n;this.instanceId=++Yee;this.loaded=!1;this.isVideo=!1;this.isBuffer=!1;this.isHdr=!1;this._cache={[1e3]:{},[1001]:{},[1002]:{}};this.isVideo=e.type==="video",this.isBuffer=e.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let n=()=>{this.loaded=!0;for(let r of Object.values(this._cache))for(let s of Object.values(r))for(let o of Object.values(s))o&&(o.image=this.img,o.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof e!="string"){let r=new FileReader;r.readAsDataURL(new Blob([e],{type:"video/mp4"}));let s;await new Promise(o=>{r.onloadend=a=>{s=a.target?.result,o(null)}}),this.img.src=s}else this.img.src=e;this.img.onloadeddata=()=>{n()}}else if(e instanceof Uint8Array?m2(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&&m2(r)?jk(r):null;s!==null&&(this.isHdr=!0,this.img=s,n())}else this.img=new Image,this.img.src=Vk(e),this.img.onload=n,await new Promise(r=>{this.img.onload=()=>{n(),r(null)}})}getTexture(e,n=1008,r=1006){let s=this._cache[e]?.[n]?.[r];if(s)return s;{let o;return this.isBuffer?o=this.img.texture:this.isVideo?o=new ty(this.img,void 0,e,e):this.isHdr?(o=Hk(this.img),o.wrapS=e,o.wrapT=e,o.magFilter=r,o.minFilter=n):o=new mn(this.img,void 0,e,e,r,n),this.isBuffer||(o.anisotropy=8,o.generateMipmaps=n===1008),this.loaded&&(o.needsUpdate=!0),this._cache[e]===void 0&&(this._cache[e]={}),this._cache[e][n]===void 0&&(this._cache[e][n]={}),this._cache[e][n][r]=o,o}}setNeedsUpdate(e){if(!this.isBuffer)for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let s of Object.values(r))s&&(s.needsUpdate=e)}disposeTextures(){for(let[e,n]of Object.entries(this._cache))for(let[r,s]of Object.entries(n))for(let[o,a]of Object.entries(s))a?.dispose(),this._cache[e]!==void 0&&this._cache[e][r]!==void 0&&(this._cache[e][r][o]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}});var Ys,dw=B(()=>{"use strict";g2();Ys=class extends Lf{}});function Xk(i){if(typeof i=="string")return i;let t=qk.get(i);return t||(t={url:URL.createObjectURL(new Blob([i]))},qk.set(i,t)),t.url}var qk,Yk=B(()=>{"use strict";qk=new Map});function Qk(){if($k)return;if(hw)return hw;async function i(){await import("./howler.js"),Kk(window!==void 0?window:global),$k=!0}return hw=i(),hw}var Kk,Zk,$k,hw,y2=B(()=>{Zk=new Promise(i=>{Kk=i}),$k=!1});function Jk(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 tV(i){let t=!1,e=[];return i.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((s,o)=>{if(o.events===void 0||Array.isArray(o.events)===!1)return!0;Jk(o.events,e),t=t||e.some(a=>a.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;Jk(r.events,e),t=t||e.some(s=>s.data.type==="Audio")}),t}var eV,lc,pw=B(()=>{Yk();y2();Zk.then(i=>eV=i);lc=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:Xk(t),format:"wav"},this.sound=new eV.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 rV(i){nV=i}function iV(){return nV}function v2(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 nV,fw=B(()=>{nV=null});function sV(i){return new G(i.y,-i.x)}var mw,wv,Ev=B(()=>{"use strict";q();mw=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=ge.clamp(r.thetaLength,0,360),r.hollow=ge.clamp(r.hollow??0,0,1);let s=r.width/2,o=r.radiusTop??s,a=r.radiusBottom??s;if(o===a?(o=s,a=s):o>a?(o=s,a=a*s/o):(o=o*s/a,a=s),r.shapeBlendNode){o=e??s,a=n??s;let l=Math.max(o,a)*2;r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:o,radiusBottom:a})}}static build(i){let{width:t,depth:e,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:u,cornerRadius:d,cornerSegments:h,hollow:p}=i.parameters,f;l===0?(f=new Me,f.setAttribute("position",new Be([],3))):d||p?f=new wv(c,u,n,r,s,o,a,l*Math.PI/180,d,d,h,p):f=new Ia(c,u,n,r,s,o,a,l*Math.PI/180);let m=e/t;return m!==1&&f.scale(1,1,m),Object.assign(f,{userData:{...i,type:"CylinderGeometry"}})}};wv=class extends Me{constructor(t,e,n,r,s,o,a,l,c,u,d,h,p=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,n=n||1,r=Math.floor(r)||8,s=Math.floor(s)||1,o=o!==void 0?o:!1,a=a!==void 0?a:0,l=l!==void 0?l:Math.PI*2,o&&(c=0,u=0);let f=n/2;p&&t==0&&(t=c),p&&e==0&&(e=u);let m=new G(t,f),g=new G(e,-f),y=null,v=null,b=null,x=null,S=m.clone().sub(g),E=0,T=0,w=0;h>0&&(E=Math.min(t,e)*(1-h),T=t-E,w=e-E);let _=m.clone();_.x-=E;let A=Math.PI-S.angle(),C=S.angle(),R=Math.tan(C/2),D=Math.tan(A/2),O=R+D,L=h?O:D,F=h?O:R;if(c=Math.min(c,(t-T)/L,S.length()/O),u=Math.min(u,(e-w)/F,S.length()/O),c>0){let Ce=c/R;y=m.clone().sub(new G(Ce,c)),h&&(b=y.clone(),b.x-=E-O*c),m.sub(S.clone().setLength(Ce))}if(u>0){let Ce=u/D;v=g.clone().sub(new G(Ce,-u)),g.add(S.clone().setLength(Ce)),h&&(x=v.clone(),x.x-=E-O*u,_.sub(S.clone().setLength(Ce)))}S=m.clone().sub(g);let j=S.length()<.5,W=[],K=[],Y=[],$=[],ee=[],oe=[],ae=(Ce,je,V,_e,X)=>{for(let ct=0;ct<d+1;ct++){let lt=ct/d,z=_e<0?lt:1-lt;X&&(z-=1),z*=Ce;let I=Math.sin(z),Z=Math.cos(z)*_e,re=Z*je+V.y;W.push(I*je+V.x),K.push(re),Y.push(I),$.push(Z),ee.push(.5+re/n),oe.push(!1)}},de=(Ce,je,V)=>{let _e=[Ce,je];V<0&&_e.reverse();for(let X of _e)W.push(X),K.push(f*V),Y.push(0),$.push(V),ee.push(.5),oe.push(!0)};if(x&&v?(ae(A,u,x,-1,!0),ae(C,u,v,-1,!1)):v?(de(v.x,0,-1),ae(C,u,v,-1,!1)):o||de(e,w,-1),!j){let Ce=sV(S).normalize();for(let je=0;je<=s;je++){let V=je/s,_e=S.y*V+g.y;W.push(S.x*V+g.x),K.push(_e),Y.push(Ce.x),$.push(Ce.y),ee.push(.5+_e/n),oe.push(!1)}}if(b&&y?(ae(A,c,y,1,!1),ae(C,c,b,1,!0)):y?(ae(A,c,y,1,!1),de(y.x,0,1)):o||de(t,T,1),h&&!j){let Ce=sV(S).multiplyScalar(-1).normalize();for(let je=0;je<=s;je++){let V=je/s,_e=S.y*-V+_.y;W.push(S.x*-V+_.x),K.push(_e),Y.push(Ce.x),$.push(Ce.y),ee.push(.5+_e/n),oe.push(!1)}}let be=W.length,me=be+(h&&!o?1:0),Ae=(Ce,je)=>Ce*be+(je===be?0:je),Le=l<Math.PI*2,Ie=(r+1)*be+(Le?2*(1+me):0),Ge=new Float32Array(Ie*3),Ve=new Float32Array(Ie*3),pe=new Float32Array(Ie*2),Ne=Ie-1>65535?new Uint32Array(r*Math.max(0,me-1)*6+(Le?2*(me+1)*3:0)):new Uint16Array(r*Math.max(0,me-1)*6+(Le?2*(me+1)*3:0)),we=0,$e=0;for(let Ce=0;Ce<=r;Ce++){let je=Ce/r,V=je*l+a,_e=Math.sin(V),X=Math.cos(V);for(let ct=0;ct<be;ct++){let lt=$e*3,z=$e*2,I=W[ct],Z=Y[ct];Ge[lt]=I*_e,Ge[lt+1]=K[ct],Ge[lt+2]=I*X,Ve[lt]=Z*_e,Ve[lt+1]=$[ct],Ve[lt+2]=Z*X,oe[ct]?(pe[z]=.5,pe[z+1]=.5):(pe[z]=je,pe[z+1]=ee[ct]),$e++}}for(let Ce=0;Ce<r;Ce++)for(let je=0;je<me-1;je++){if(o&&h&&je==s)continue;let V=Ae(Ce,je),_e=Ae(Ce+1,je),X=Ae(Ce+1,je+1),ct=Ae(Ce,je+1),lt=Ge[X*3+0],z=Ge[X*3+2];Ne[we++]=V,Ne[we++]=_e,Ne[we++]=ct,(lt!=0||z!=0)&&(Ne[we++]=_e,Ne[we++]=X,Ne[we++]=ct)}Le&&(nt(-1,0,a),nt(1,r*be,a+l)),this.setIndex(new Ue(Ne.slice(0,we),1)),this.setAttribute("position",new Ue(Ge,3)),this.setAttribute("normal",new Ue(Ve,3)),this.setAttribute("uv",new Ue(pe,2));function nt(Ce,je,V){let _e=Math.sin(V),X=Math.cos(V),ct=-X,lt=_e,z=Ce<0?(ye,Oe,le)=>{Ne[we++]=ye,Ne[we++]=Oe,Ne[we++]=le}:(ye,Oe,le)=>{Ne[we++]=ye,Ne[we++]=le,Ne[we++]=Oe},I=(t+e+T+w)/4,Z=$e*3,re=$e*2;Ge[Z]=I*_e,Ge[Z+1]=0,Ge[Z+2]=I*X,Ve[Z]=ct,Ve[Z+1]=0,Ve[Z+2]=lt,pe[re]=.5,pe[re+1]=.5;let he=$e++;for(let ye=0;ye<me;ye++){let Oe=(je+(ye===be?0:ye))*3;Z=$e*3,re=$e*2,Ge[Z]=Ge[Oe],Ge[Z+1]=Ge[Oe+1],Ge[Z+2]=Ge[Oe+2],Ve[Z]=ct,Ve[Z+1]=0,Ve[Z+2]=lt;let le=Oe/3*2|0;pe[re]=pe[le],pe[re+1]=pe[le+1],$e++}for(let ye=he+1;ye<$e-1;ye++)z(he,ye,ye+1);z(he,$e-1,he+1)}}}});var oV,b2=B(()=>{"use strict";q();Ev();oV=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=ge.clamp(e.thetaLength,0,360),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,depth:e,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:u,cornerSegments:d}=i.parameters,h;l===0?(h=new Me,h.setAttribute("position",new Be([],3))):c>0||u>0||l<360?h=new wv(0,t/2,n,r,s,o,a,l*Math.PI/180,c,u,d,0,!0):h=new Ul(t/2,n,r,s,o);let p=e/t;return p!==1&&h.scale(1,1,p),Object.assign(h,{userData:{...i,type:"ConeGeometry"}})}}});var aV,x2,S2,w2=B(()=>{"use strict";q();aV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,widthSegments:r,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a===0?c=new ni(t,e,n,r,s,o):c=new S2(t,e,n,r,s,o,a,l),Object.assign(c,{userData:{...i,type:"CubeGeometry"}})}},x2=Math.PI/2,S2=class extends Me{constructor(t=1,e=1,n=1,r=1,s=1,o=1,a=0,l=4){super(),this.type="BoxGeometry",r=Math.floor(r),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,t/2,e/2,n/2);let c=a>0,u=l+1,h=2*((o+1)*(s+1)+(r+1)*(o+1)+(r+1)*(s+1))+(c?u*4*(o+1+(r+1)+(s+1))+8*(u*(u+1)/2):0),p=2*(o*s+r*o+r*s)+(c?l*4*(o+r+s):0),f=c?8*l*l:0,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),T=new Float64Array(u),w=new Float64Array(u);for(let L=0;L<u;L++){let F=L/l*x2;S[L]=Math.sin(F)*a,E[L]=(1-Math.cos(F))*a,T[L]=Math.sin(F),w[L]=Math.cos(F)}let _=u*(u+1)/2,A=new Float64Array(_*3),C=new Float64Array(_*3);{let L=new M(t/2,e/2,n/2);L.subScalar(a);let F=0;for(let j=0;j<=l;j++){let W=x2*(1-j/l),K=Math.cos(W),Y=Math.sin(W),$=0;for(let ee=0;ee<=j;ee++){let oe=Math.cos($),ae=Math.sin($),de=K*oe,be=Y,Re=K*ae;A[F*3]=de,A[F*3+1]=be,A[F*3+2]=Re,C[F*3]=L.x+de*a,C[F*3+1]=L.y+be*a,C[F*3+2]=L.z+Re*a,F++,$+=x2/j}}}R("z","y","x",-1,-1,n,e,t,o,s),R("z","y","x",1,-1,n,e,-t,o,s),R("x","z","y",1,1,t,n,e,r,o),R("x","z","y",1,-1,t,n,-e,r,o),R("x","y","z",1,-1,t,e,n,r,s),R("x","y","z",-1,-1,t,e,-n,r,s),a>0&&(D("z","y","x",-1,-1,1,n,e,t,o),D("z","y","x",1,-1,-1,n,e,t,o),D("z","y","x",-1,1,-1,n,e,t,o),D("z","y","x",1,1,1,n,e,t,o),D("x","y","z",-1,-1,-1,t,e,n,r),D("x","y","z",1,-1,1,t,e,n,r),D("x","y","z",-1,1,1,t,e,n,r),D("x","y","z",1,1,-1,t,e,n,r),D("y","x","z",-1,-1,1,e,t,n,s),D("y","x","z",1,-1,-1,e,t,n,s),D("y","x","z",1,1,1,e,t,n,s),D("y","x","z",-1,1,-1,e,t,n,s),O(1,1,1),O(-1,1,1),O(1,-1,1),O(-1,-1,1),O(1,1,-1),O(-1,1,-1),O(1,-1,-1),O(-1,-1,-1)),this.setIndex(new Ue(v,1)),this.setAttribute("position",new Ue(m,3)),this.setAttribute("normal",new Ue(g,3)),this.setAttribute("uv",new Ue(y,2));function R(L,F,j,W,K,Y,$,ee,oe,ae){let de=(Y-2*a)/oe,be=($-2*a)/ae,Re=Y/2-a,me=$/2-a,Ae=ee/2,Le=oe+1,Ie=ae+1,Ge=0,Ve=new M;for(let pe=0;pe<Ie;pe++){let Ne=pe*be-me;for(let we=0;we<Le;we++){let $e=we*de-Re,nt=(b+Ge)*3,Ce=(b+Ge)*2;Ve[L]=$e*W,Ve[F]=Ne*K,Ve[j]=Ae,m[nt]=Ve.x,m[nt+1]=Ve.y,m[nt+2]=Ve.z,Ve[L]=0,Ve[F]=0,Ve[j]=ee>0?1:-1,g[nt]=Ve.x,g[nt+1]=Ve.y,g[nt+2]=Ve.z,y[Ce]=we/oe,y[Ce+1]=1-pe/ae,Ge+=1}}for(let pe=0;pe<ae;pe++)for(let Ne=0;Ne<oe;Ne++){let we=b+Ne+Le*pe,$e=b+Ne+Le*(pe+1),nt=b+(Ne+1)+Le*(pe+1),Ce=b+(Ne+1)+Le*pe;v[x++]=we,v[x++]=$e,v[x++]=Ce,v[x++]=$e,v[x++]=nt,v[x++]=Ce}b+=Ge}function D(L,F,j,W,K,Y,$,ee,oe,ae){let de=($-2*a)/ae,be=$/2-a,Re=ee/2-a,me=oe/2,Ae=ae+1,Le=0,Ie=new M,Ge=new M;for(let Ve=0;Ve<l+1;Ve++){Ie[F]=(Re+S[Ve])*K,Ie[j]=(me-E[Ve])*Y,Ge[L]=0,Ge[F]=T[Ve]*Math.sign(Ie[F]),Ge[j]=w[Ve]*Math.sign(Ie[j]);for(let pe=0;pe<Ae;pe++){let Ne=pe*de-be;Ie[L]=Ne*W;let we=(b+Le)*3,$e=(b+Le)*2;m[we]=Ie.x,m[we+1]=Ie.y,m[we+2]=Ie.z,g[we]=Ge.x,g[we+1]=Ge.y,g[we+2]=Ge.z,y[$e]=pe/ae,y[$e+1]=0,Le+=1}}for(let Ve=0;Ve<l;Ve++)for(let pe=0;pe<ae;pe++){let Ne=b+pe+Ae*Ve,we=b+pe+Ae*(Ve+1),$e=b+(pe+1)+Ae*(Ve+1),nt=b+(pe+1)+Ae*Ve;v[x++]=Ne,v[x++]=we,v[x++]=nt,v[x++]=we,v[x++]=$e,v[x++]=nt}b+=Le}function O(L,F,j){let K=L*F*j>0?($,ee,oe)=>{v[x++]=$,v[x++]=ee,v[x++]=oe}:($,ee,oe)=>{v[x++]=$,v[x++]=oe,v[x++]=ee},Y=b;for(let $=0;$<_;$++){let ee=$*3,oe=b*3,ae=b*2;m[oe]=L*C[ee],m[oe+1]=F*C[ee+1],m[oe+2]=j*C[ee+2],g[oe]=L*A[ee],g[oe+1]=F*A[ee+1],g[oe+2]=j*A[ee+2],y[ae]=0,y[ae+1]=0,b++}for(let $=0;$<l;$++){let ee=Y+$*($+1)/2,oe=Y+($+1)*($+2)/2;K(ee,oe+1,oe);for(let ae=1;ae<=$;ae++)K(ee+ae-1,ee+ae,oe+ae),K(ee+ae,oe+ae+1,oe+ae)}}}}});var Su,E2=B(()=>{"use strict";q();Su=class extends Me{constructor(t=[],e=[],n="",r=1,s=.2,o=4){super(),this.type="PolyhedronGeometryRound";let a,l,c,u=0;d(),h(),this.setAttribute("position",new Ue(new Float32Array(a.subarray(0,u)),3)),this.setAttribute("normal",new Ue(new Float32Array(l.subarray(0,u)),3)),this.setAttribute("uv",new Ue(new Float32Array(c.subarray(0,u/3*2)),2));return;function d(){s=Math.min(1-1e-5,s),s==0&&(o=0);let f={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[n],m=new M,g=m.clone(),y=new In,v=s*r,b=r-v,x=o+1,S=new M,E=(pe,Ne)=>S.subVectors(pe,Ne).normalize(),T=(pe,Ne)=>Array(pe).fill(void 0).map(Ne),w=T(t.length/3,(pe,Ne)=>new M().fromArray(t,Ne*3).setLength(r)),_=[],A=1e6;for(let pe=0;pe<w.length;pe++){let Ne=w[pe],we=[],$e,nt,Ce,je=1e10,V=-1;for(;(V=e.indexOf(pe,V+1))!=-1;){let lt=V-V%3;$e=e[lt+(V+1)%3],nt=e[lt+(V+2)%3],Ce=Ne.distanceToSquared(w[$e]),je=Math.min(je,Ce),we.push([$e,nt,Ce])}je+=1e-6;let _e=[],X=0,ct=we.length;for(let lt=0;lt<ct;lt++){[$e,nt,Ce]=we[X];let z=_[$e]?.includes(pe)==!0;Ce<=je&&_e.push($e+ +z*A),X=we.findIndex(I=>I[0]==nt)}_.push(_e)}let C=[];{let pe=0,Ne=0,we,$e,nt=f==3;for(let Ce=0;Ce<=o;Ce++){we=Ce*(Ce+1)/2,$e=(Ce+1)*(Ce+2)/2;for(let je=0;je<o-Ce;je++)[pe,Ne]=[we+je+Ce+2,$e+je+Ce+3],C.push(we,$e,...nt?[Ne,we]:[pe,$e],Ne,pe),[we,$e]=[pe,Ne];C.push(we,$e,we+o+2)}}let R=0;for(let pe=0;pe<_.length;pe++)for(let Ne=0;Ne<f;Ne++)_[pe][Ne]<A&&R++;let D=w.length*f*C.length*3,O=R*x*6*3,L=R*2*3*3,F=D+O+L;a=new Float64Array(F),l=new Float64Array(F),c=new Float64Array(F/3*2);let j=(pe,Ne,we)=>{let $e=u/3*2;c[$e]=Math.atan2(we,-pe)/2/Math.PI+.5,c[$e+1]=1-(Math.atan2(-Ne,Math.sqrt(pe*pe+we*we))/Math.PI+.5)},W=pe=>{a[u]=pe.x,a[u+1]=pe.y,a[u+2]=pe.z,l[u]=S.x,l[u+1]=S.y,l[u+2]=S.z,j(pe.x,pe.y,pe.z),u+=3},K=pe=>{a[u]=pe[0].x,a[u+1]=pe[0].y,a[u+2]=pe[0].z,l[u]=pe[1].x,l[u+1]=pe[1].y,l[u+2]=pe[1].z,j(pe[0].x,pe[0].y,pe[0].z),u+=3},Y=(o+2)*(o+3)/2,$=new Float64Array(Y*3),ee=new Float64Array(Y*3),oe=new Float64Array(Y*2),ae=T(f*2*x,()=>new M),de=T(o*Math.max(0,o-1)/2,()=>new M),be=m.clone(),Re=m.clone(),me=m.clone(),Ae=m.clone(),Le=m.clone(),Ie=[],Ge=T(w.length,()=>T(f,()=>m.clone()));for(let pe=0;pe<w.length;pe++){m.copy(w[pe]).normalize(),be.copy(m).multiplyScalar(b);let Ne=_[pe];for(let _e=0;_e<Ne.length;_e++){let X=Ne[_e],ct=Ne[(_e+1)%f];y.setFromPointsAndIndices(w,pe,X%A,ct%A),y.b.sub(y.a).setLength(1e10).add(y.a),y.c.sub(y.a).setLength(1e10).add(y.a),y.closestPointToPoint(be,Ge[pe][_e])}let we=0,$e=[],nt=[],Ce=new M;o==0&&[...Ge[pe]].reduce((_e,X)=>_e.add(X),Ce).multiplyScalar(1/f);for(let _e=0;_e<f;_e++){let X=[],ct=(_e-1+f)%f,lt=Ge[pe][ct],z=Ge[pe][_e];m.copy(lt).sub(be),g.copy(z).sub(be);let I=be.angleTo(m),Z=m.angleTo(g),re=Math.cos(I)*v;o==0?Re.copy(Ce):Re.copy(be).setLength(b+re),$e.push(re);let he=[Re,lt,z];for(let ye=0;ye<2;ye++){let Oe=he[ye],le=he[ye+1];Ae.subVectors(Oe,be),Le.subVectors(le,be),me.crossVectors(Ae,Le).normalize();for(let xe=0;xe<x;xe++){let Xe=[I,Z][ye]*xe/x;m.copy(Ae).applyAxisAngle(me,Xe).add(be),ae[we++].copy(m),ye&&(E(m,be),X.push([xe==0?Oe:m.clone(),S.clone()]))}ye&&(E(le,be),X.push([le,S.clone()]))}nt.push(X)}Ie.push(nt);let je=2*x,V=2;for(let _e=0;_e<f;_e++){let X=je*_e,ct=je*((_e+1)%f),lt=0,z=[ae[X]];for(let I=1;I<x;I++){let Z=ae[X+I],re=ae[ct+I];z.push(Z);for(let he=1,ye=I-V+1;he<=ye;he++)m.lerpVectors(Z,re,he/(ye+1)),m.sub(be).setLength($e[_e]).add(be),z.push(de[lt++].copy(m));z.push(re)}for(let I=0;I<x;I++)z.push(ae[I+x+X]);z.push(ae[ct+x]);for(let I=0,Z=z.length;I<Z;I++){let re=z[I],he=I*3,ye=I*2;$[he]=re.x,$[he+1]=re.y,$[he+2]=re.z,E(re,be),ee[he]=S.x,ee[he+1]=S.y,ee[he+2]=S.z,oe[ye]=Math.atan2(re.z,-re.x)/2/Math.PI+.5,oe[ye+1]=1-(Math.atan2(-re.y,Math.sqrt(re.x*re.x+re.z*re.z))/Math.PI+.5)}for(let I=0,Z=C.length;I<Z;I++){let re=C[I]*3,he=C[I]*2,ye=u/3*2;a[u]=$[re],a[u+1]=$[re+1],a[u+2]=$[re+2],l[u]=ee[re],l[u+1]=ee[re+1],l[u+2]=ee[re+2],c[ye]=oe[he],c[ye+1]=oe[he+1],u+=3}}}let Ve=[];for(let pe=0;pe<_.length;pe++)for(let Ne=0;Ne<f;Ne++){let we=_[pe][Ne];if(we<A){let $e=_[we].findIndex(je=>je%A==pe),nt=Ie[pe][Ne],Ce=Ie[we][$e];for(let je=0;je<x;je++){let V=nt[je],_e=Ce[x-je],X=nt[je+1],ct=Ce[x-(je+1)];K(V),K(_e),K(X),K(X),K(_e),K(ct)}Ve.push(nt[0][0],Ce[x][0],nt[x][0],Ce[0][0])}}for(;Ve.length;){let pe,Ne,we,[$e,nt]=Ve.splice(0,2);pe=nt;let Ce=[$e];for(;$e!=pe;)Ce.push(pe),Ne=Ve.indexOf(pe),we=Ne%2,pe=Ve.splice(Ne-we,2)[1-we];S.subVectors(Ce[0],Ce[1]).cross(m.subVectors(Ce[0],Ce[2])).normalize();let je=S.dot(Ce[0])<0;je&&S.negate();for(let V=1;V<=Ce.length-2;V++)W(Ce[V+ +je]),W(Ce[V+1-+je]),W(Ce[0])}}function h(){let p=new M,f=new M,m=new M,g=new M,y=new G,v=new G,b=new G,x=(T,w,_,A)=>{A<0&&T.x===1&&(c[w]=T.x-1),_.x===0&&_.z===0&&(c[w]=A/2/Math.PI+.5)};for(let T=0,w=0;T<u;T+=9,w+=6){p.set(a[T+0],a[T+1],a[T+2]),f.set(a[T+3],a[T+4],a[T+5]),m.set(a[T+6],a[T+7],a[T+8]),y.set(c[w+0],c[w+1]),v.set(c[w+2],c[w+3]),b.set(c[w+4],c[w+5]),g.copy(p).add(f).add(m).divideScalar(3);let _=E(g);x(y,w+0,p,_),x(v,w+2,f,_),x(b,w+4,m,_)}let S=u/3*2;for(let T=0;T<S;T+=6){let w=c[T+0],_=c[T+2],A=c[T+4],C=Math.max(w,_,A),R=Math.min(w,_,A);C>.9&&R<.1&&(w<.2&&(c[T+0]+=1),_<.2&&(c[T+2]+=1),A<.2&&(c[T+4]+=1))}function E(T){return Math.atan2(T.z,-T.x)}}}static fromJSON(t){return new Su(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}});var lV,Tv,T2=B(()=>{"use strict";E2();q();lV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,detail:r,corner:s,cornerSides:o}=i.parameters,a=r===0&&s!==0?new Tv(t*.5,s,o):new fd(t*.5,r),l=e/t,c=n/t;return(l!==1||c!==1)&&a.scale(1,l,c),Object.assign(a,{userData:{...i,type:"DodecahedronGeometry"}})}},Tv=class extends Su{constructor(t=1,e=.2,n=4){let r=(1+Math.sqrt(5))/2,s=1/r,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-r,0,-s,r,0,s,-r,0,s,r,-s,-r,0,-s,r,0,s,-r,0,s,r,0,-r,0,-s,r,0,-s,-r,0,s,r,0,s],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],l="DodecahedronGeometry";super(o,a,l,t,e,n),this.type=l}static fromJSON(t){return new Tv(t.radius,t.corner,t.cornerSides)}}});function cV(i,t=new G){let e=i.length();return t.set(-i.y/e,i.x/e)}function pV(i){let t=new G;t.addVectors(i.v0,Ff.subVectors(i.v1,i.v0).multiplyScalar(2/3));let e=new G;return e.addVectors(i.v2,gw.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new Ni(i.v0,t,e,i.v2)}function _v(i,t,e=Number.EPSILON){return Math.abs(i-t)<e}function Jee(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function ete(i,t,e=Number.EPSILON){return i.distanceTo(t)<e}function A2(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 fV(i,t,e){return uV(i,t)&&uV(t,e)&&M2(i.position,t.position,e.position)}function M2(i,t,e){return Ff.copy(t).sub(i).cross(gw.copy(e).sub(i))===0}function mV(i,t,e,n,r){let s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),o=(i.y+t.y)/2,a=(i.x+t.x)/2,l=Math.sqrt(Math.pow(e,2)-Math.pow(s/2,2))*(i.y-t.y)/s,c=Math.sqrt(Math.pow(e,2)-Math.pow(s/2,2))*(t.x-i.x)/s;return n.set(a+l,o+c),r.set(a-l,o-c),[n,r]}function gV(i,t,e){let n=i.distanceTo(e),r=t.distanceTo(e);return n<r?t:i}function yV(i,t,e,n,r,s){let o=t.x-i.x,a=t.y-i.y,l=e.x-i.x,c=e.y-i.y,u=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),d;return A2(t,i,e)>Math.PI&&(u*=-1),_v(c,a)?d=(a+c)*(n/u-.5)*8/3/(o-l):d=(o+l)*(n/u-.5)*8/3/(c-a),r.set(t.x-d*a,t.y+d*o),s.set(e.x+d*c,e.y-d*l),[r,s]}function C2(i,t){return i.position.equals(i.controls[1].position)&&t.position.equals(t.controls[0].position)}function uV(i,t){return M2(i.position,i.controls[1].position,t.position)&&M2(i.position,t.controls[0].position,t.position)}function vV(i,t,e,n,r=.5){let s=Ff.subVectors(t,i).multiplyScalar(r).add(i),o=gw.subVectors(e,t).multiplyScalar(r).add(t),a=$ee.subVectors(n,e).multiplyScalar(r).add(e),l=s,c=Kee.subVectors(o,s).multiplyScalar(r).add(s),u=Zee.subVectors(a,o).multiplyScalar(r).add(o),d=a,h=Qee.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 bV(i,t,e=12,n=!0){let r=hV.set(0,0,0),s,o=0,a=[];for(let l=0;l<t.length;l++){let c=_2(t[l]),u=Ff,d=wu(c,e);a.push(d);for(let h=0;h<=d;h++)if(c instanceof Ni||c instanceof bs||c instanceof _i){if(c.getPoint(h/d,u),r.set(u.x,u.y,0),s!==void 0&&ete(s,r))continue;s===void 0&&(s=dV),s.copy(r),i.setXYZ(o,r.x,r.y,r.z),o++}}return n&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),i}function xV(i,t,e,n=12,r=!0){let s=hV.set(0,0,0),o=0,a=[];for(let l=0;l<t.length;l++){if(e[l]===!1)continue;let c,u=_2(t[l]),d=Ff,h=wu(u,n);a.push(h);for(let p=0;p<=h;p++)if(u instanceof Ni||u instanceof bs||u instanceof _i){if(u.getPoint(p/h,d),s.set(d.x,d.y,0),c?.equals(s))continue;c===void 0?c=dV:(i.setXYZ(o,c.x,c.y,c.z),o++,i.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return r&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),a}function P2(i,t=12,e=!1){let n=[];for(let r=0,s=i.length;r<s;r++){let o=i[r],a=0;if(e&&o.roundedCurveCorner!==void 0){let l=wu(o.roundedCurveCorner,t)*.5;r>0&&(n[r-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=wu(o.curveAfter,t)),n.push(a)}return i.length>0&&e&&i[0].roundedCurveCorner!==void 0&&(n[i.length-1]+=wu(i[0].roundedCurveCorner,t)*.5),n}function wu(i,t=12){return i&&i instanceof $c?t*2:i&&(i instanceof _i||i instanceof vp)?1:i&&i instanceof md?t*i.points.length:t}function SV(i,t,e=12,n=!0){let r,s=0;for(let o=0;o<t.length;o++){let a=_2(t[o]),l=wu(a,e),c=Ff;for(let u=0;u<=l;u++)if(a instanceof Ni||a instanceof bs||a instanceof _i){if(a.getPoint(u/l,c),r!==void 0&&Jee(r,c,Mv))continue;r===void 0&&(r=gw),r.copy(c),i.push(c.x,c.y),s++}}return _v(i[0],i[i.length-2],Mv)&&_v(i[1],i[i.length-1],Mv)&&(i.pop(),i.pop()),n&&s>1&&!(_v(i[s-1],i[1],Mv)&&_v(i[s-2],i[0],Mv))&&(i.push(i[0],i[1]),s++),i}var Mv,Nf,Bf,ua,_2,Ff,gw,$ee,Kee,Zee,Qee,dV,hV,R2=B(()=>{"use strict";q();Mv=1e-12,Nf=class{constructor(t){this.position=new G;this.startPosition=new G;this.uuid=ge.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 Nf(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Bf=class extends Nf{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new Bf(this.parent).copy(this)}},ua=class extends Nf{constructor(e,n){super(n);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new Bf(this),new Bf(this))}static create(e,n){let r=new ua(e,new G(...n.position));return r.controls[0].position.set(...n.controlPrevious.position),r.controls[1].position.set(...n.controlNext.position),r.roundness=n.roundness,r.areControlsDirectionsMirrored=n.areControlsDirectionsMirrored,r}getOppositeControl(e){let n=this.controls.indexOf(e);return n===0?this.controls[1]:n===1?this.controls[0]:null}applyOffsetToControls(e,n=1){for(let r=0,s=this.controls.length;r<s;r++){let o=this.controls[r];this.position.distanceTo(o.position)<=n?o.position.copy(this.position):o.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new ua(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 G,n=new G){let[r,s]=this.computeTangents();return r&&s&&(cV(r,e),cV(s,n)),[e,n]}computeTangent(e=new G){let[n,r]=this.computeTangents();return n&&r&&e.copy(n).add(r).normalize(),e}computeNormal(e=new G){let[n,r]=this.computeNormals();return e.copy(n).add(r).normalize(),e}};_2=i=>i,Ff=new G,gw=new G,$ee=new G,Kee=new G,Zee=new G,Qee=new G,dV=new M,hV=new M});var I2,tte,nte,rte,ite,ste,yn,cc=B(()=>{"use strict";q();R2();I2=new G,tte=new G,nte=new G,rte=new G,ite=new G,ste=new G,yn=class extends Oa{constructor(e=100,n=100){super();this.points=[];this.shapeHoles=[];this.plane=new xr(new M(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this.isText=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=ge.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=n}static createFromState(e,n,r){let s=new yn;return s.isClosed=e.isClosed,s.points=e.points.map(o=>ua.create(o.id,o.data)),typeof e.roundness=="number"&&(s.roundness=e.roundness),s.shapeHoles=e.shapeHoles.map(o=>yn.createFromState(o)),n!==void 0&&r!==void 0&&s.applySize(n,r),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let n=0,r=this.points.length;n<r;n++)this.points[n].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(n=>this.getPointIndexById(n)).filter(n=>n>=0)}getPointIndexById(e){let n=this.points.length,r=this.points.findIndex(s=>s.uuid===e);if(r<0){let s=n;for(let o=0,a=this.shapeHoles.length;o<a;o++){let l=this.shapeHoles[o],c=l.points.length,u=l.getPointIndexById(e);if(u<0)s+=c;else return u+s}}return r}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let n=this.points.length;for(let r=0,s=this.shapeHoles.length;r<s;r++){let o=this.shapeHoles[r],a=e-n;if(a<=o.points.length-1)return o.points[a];n+=o.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let n=this.points.indexOf(e);if(n>=0)return n;if(n=this.points.length,this.shapeHoles.length>0)for(let r=0,s=this.shapeHoles.length;r<s;r++){let o=this.shapeHoles[r],a=o.points.indexOf(e);if(a>=0)return n+a;n+=o.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(n=>n.points));return[...this.points,...e]}applySize(e,n){e===0&&(e=.001),n===0&&(n=.001),this._width=e,this._height=n}applyScale(e,n){let r=I2.set(e,n);for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];a.position.multiply(r),a.controls[0].position.multiply(r),a.controls[1].position.multiply(r)}for(let s=0,o=this.shapeHoles.length;s<o;s++)this.shapeHoles[s].applyScale(e,n);this._update()}createPoint(e,n=0,r=ge.generateUUID()){let s;e instanceof G?s=e:s=new G(e,n);let o=new ua(r,s);return o.roundness=this.roundness,o}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,n){this.points.splice(n,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];if(s.uuid===e)return s}for(let n=0,r=this.shapeHoles.length;n<r;n++){let o=this.shapeHoles[n].getPointByUuid(e);if(o)return o}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let n=this.points.indexOf(e);n>=0&&this.points.splice(n,1),this.needsUpdate=!0}removePointById(e){let n=this.points.find(r=>r.uuid===e);n&&this.removePoint(n)}update(){for(let e=0,n=this.shapeHoles.length;e<n;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,n=12,r=!1){this.subdivision=n,this.curveDivisions===void 0&&this.computeCurveDivisions(n);let s=r?this.roundedCurveDivisions:this.curveDivisions;return bV(e,r?this.roundedCurves:this.curves,n,this.autoClose),s.reduce((o,a)=>o+a,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=P2(this.points,e,!1),this.roundedCurveDivisions=P2(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,n,r=12){return xV(e,this.curves,n,r,this.autoClose).reduce((o,a)=>o+a,0)*2}extractShapePointsToFlatArray(e,n=12){return this.subdivision=n,this.curveDivisions===void 0&&this.computeCurveDivisions(n),SV(e,this.roundedCurves,n,this.autoClose)}getCurveIndexFromVertexId(e,n=!1){let r=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=n?this.roundedCurveDivisions:this.curveDivisions,o=0;n&&this.points[0].roundedCurveCorner!==void 0&&(o=wu(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=e-o;a<0&&(a+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let u=s[l];if(a<r+u)return[l,(a-r+1)/u];r+=u}return[0,1]}getCurveT(e,n,r){let s=this.points[e],o=this.points[e>=this.points.length-1?0:e+1],a=this.curveDivisions,l=a[e];if(C2(s,o)){let d=s.position.distanceTo(o.position);return s.position.distanceTo(I2.set(r.x,r.y))/d}let c=0;for(let d=0;d<e;d++)c+=a[d];return(n-c)/l}dispose(){}_applyCurveForPoint(e,n){C2(n,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(n.controls[1].position.x,n.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let r=this.curves[this.curves.length-1];e.curveBefore=r,n.curveAfter=r;let s=r.clone();e.roundedCurveBefore=s,n.roundedCurveAfter=s,e.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];if(n===0)this.moveTo(s.position.x,s.position.y);else{let o=this.points[n-1];this._applyCurveForPoint(s,o)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let n=this.points[0],r=this.points[this.points.length-1];this._applyCurveForPoint(n,r)}if(this.points.length>2){let n=0;for(let r=0,s=this.points.length;r<s;r++){let o=this.points[r],a=this.points[r-1]??this.points[this.points.length-1],l=this.points[r+1]??this.points[0],c=o.roundness,u=a&&l&&fV(a,o,l);if(!o.controlsMoved()&&c>0&&!u){let d=o.curveBefore,h=o.curveAfter;if(d===void 0||h===void 0)continue;let p=o.roundedCurveBefore,f=o.roundedCurveAfter,m=d instanceof _i?d.v1.distanceTo(d.v2):d.getLength(),g=h instanceof _i?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,I2),T=h.getPointAt(S,tte);this._subSplitCurve(d,p,x,E,void 0),this._subSplitCurve(h,f,S,void 0,T);let w;if(this.useCubicForRoundedCorners){let _=A2(E,o.position,T)/2,A=Math.tan(_)*E.distanceTo(o.position),[C,R]=mV(E,T,A,nte,rte),D=gV(C,R,o.position),[O,L]=yV(D,E,T,A,ite,ste);w=new Ni(E.clone(),O.clone(),L.clone(),T.clone())}else w=new bs(E.clone(),o.position.clone(),T.clone());o.roundedCurveCorner=w,this.roundedCurves.splice(r+n,0,w),n++}}}}_subSplitCurve(e,n,r,s,o){if(e instanceof _i)s!==void 0&&n.v2.copy(s),o!==void 0&&n.v1.copy(o);else{let a=e,l=n,c=a.getUtoTmapping(r,0),u=vV(a.v0,a.v1,a.v2,a.v3,c);return s!==void 0&&(l.v0.set(u[0],u[1]),l.v1.set(u[2],u[3]),l.v2.set(u[4],u[5]),l.v3.set(u[6],u[7])),o!==void 0&&(l.v0.set(u[6],u[7]),l.v1.set(u[8],u[9]),l.v2.set(u[10],u[11]),l.v3.set(u[12],u[13])),l}return n}clone(){let e=new yn(this._width,this._height);return e.points=this.points.map(n=>n.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(n=>n.clone()),e}toJSON(){return{points:this.points.reduce((e,n)=>e.concat(n.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let n=e.points.length/7;for(let r=0;r<n;r++){let s=r*7,o=e.points[s+0],a=e.points[s+1],l=e.points[s+2],c=e.points[s+3],u=e.points[s+4],d=e.points[s+5],h=e.points[s+6],p=new ua(ge.generateUUID(),new G(o,a));p.controls[0].position.set(l,c),p.controls[1].position.set(u,d),p.roundness=h,this.points.push(p)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(r=>{let s=new yn;return s.fromJSON(r),s}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,n=!1){this.isText=n;let r=(o,a)=>{a instanceof Ni&&a.v3.equals(o.position)&&o.controls[0].position.copy(a.v2)},s=o=>{let a=[],l,c;for(l=0,c=o.length;l<c;l++)o[l]instanceof bs&&(o[l]=pV(o[l]));for(l=0,c=o.length;l<c;l++){let h=o[l],p=l>0?o[l-1]:null,f;h instanceof Ni?(f=this.createPoint(h.v0),f.controls[1].position.copy(h.v1)):h instanceof _i&&(f=this.createPoint(h.v1)),f!==void 0&&(p!==null&&r(f,p),a.push(f))}let u=o[o.length-1],d=!1;return u instanceof Ni?u.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(u.v2),d=!0):u instanceof _i&&u.v2.equals(a[0].position)&&(d=!0),this.isClosed=d,a};return this.points=s(e.curves),e instanceof Oa&&(this.shapeHoles=e.holes.map(o=>{let a=new yn;return a.fromShape(o),a})),this.update(),this}updatePoint(e,n){let r=this.getPointByUuid(e);r&&(n.position!==void 0&&r.position.fromArray(n.position),n.roundness!==void 0&&(r.roundness=n.roundness),n.areControlsDirectionsMirrored!==void 0&&(r.areControlsDirectionsMirrored=n.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,n){let s=this.getPointByUuid(e)?.controls[0];s&&(n.position&&s.position.fromArray(n.position),this.needsUpdate=!0)}updateNextControl(e,n){let s=this.getPointByUuid(e)?.controls[1];s&&(n.position&&s.position.fromArray(n.position),this.needsUpdate=!0)}}});function O2({x:i,y:t},e,n,r,s){return{x:i*e+r,y:t*n+s}}function ote(i,t){let e=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),n=Math.cos(i),r=Math.sin(i),s=Math.cos(i+t),o=Math.sin(i+t);return[{x:n-r*e,y:r+n*e},{x:s+o*e,y:o-s*e},{x:s,y:o}]}function wV(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 ate(i,t,e,n,r,s,o,a,l,c){let u=Math.pow(r,2),d=Math.pow(s,2),h=Math.pow(o,2),p=Math.pow(a,2),f=u*d-u*p-d*h;f<0&&(f=0),f/=u*p+d*h,f=Math.sqrt(f)*(l===c?-1:1);let m=f*r/s*a,g=f*-s/r*o,y=m+(i+e)/2,v=g+(t+n)/2,b=(o-m)/r,x=(a-g)/s,S=(-o-m)/r,E=(-a-g)/s,T=wV(1,0,b,x),w=wV(b,x,S,E);return!c&&w>0&&(w-=D2),c&&w<0&&(w+=D2),{centerx:y,centery:v,ang1:T,ang2:w}}function EV({px:i,py:t,cx:e,cy:n,rx:r,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(r===0||s===0)return[];let c=(i-e)/2,u=(t-n)/2;if(c===0&&u===0)return[];r=Math.abs(r),s=Math.abs(s);let d=Math.pow(c,2)/Math.pow(r,2)+Math.pow(u,2)/Math.pow(s,2);d>1&&(r*=Math.sqrt(d),s*=Math.sqrt(d));let h=ate(i,t,e,n,r,s,c,u,o,a),{ang1:p,ang2:f}=h,{centerx:m,centery:g}=h,y=Math.abs(f)/(D2/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(ote(p,f)),p+=f;return l.map(b=>{let{x,y:S}=O2(b[0],r,s,m,g),{x:E,y:T}=O2(b[1],r,s,m,g),{x:w,y:_}=O2(b[2],r,s,m,g);return{x1:x,y1:S,x2:E,y2:T,x:w,y:_}})}var D2,TV=B(()=>{"use strict";D2=Math.PI*2});function Rt(i,t){if(!i)throw t||"Assertion Failed!"}function Eu(i){var t=i.windingRule,e=t===void 0?Nn.ODD:t,n=i.elementType,r=n===void 0?si.POLYGONS:n,s=i.polySize,o=s===void 0?3:s,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,u=c===void 0?[0,0,1]:c,d=i.contours,h=d===void 0?[]:d,p=i.strict,f=p===void 0?!0:p,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 dte;i.edgeCreateCallback&&(y.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(y.vertexIdCallback=i.vertexIdCallback);for(var v=0;v<h.length;v++)y.addContour(l||2,h[v]);return y.tesselate(e,r,o,l,u,f),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:g?y.mesh:void 0}}}var Nn,si,_t,Av,yw,Uf,MV,_V,AV,lte,L2,CV,cte,ute,dte,gEe,yEe,vEe,bEe,xEe,SEe,wEe,EEe,kf=B(()=>{(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"})(Nn||(Nn={}));(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(si||(si={}));_t=function(){function i(){}return i.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},i.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},i.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},i.edgeGoesLeft=function(t){return i.vertLeq(t.Dst,t.Org)},i.edgeGoesRight=function(t){return i.vertLeq(t.Org,t.Dst)},i.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},i.edgeEval=function(t,e,n){Rt(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){Rt(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){Rt(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){Rt(i.transLeq(t,e)&&i.transLeq(e,n));var r=e.t-t.t,s=n.t-e.t;return r+s>0?(e.s-n.s)*r+(e.s-t.s)*s:0},i.vertCCW=function(t,e,n){return t.s*(e.t-n.t)+e.s*(n.t-t.t)+n.s*(t.t-e.t)>=0},i.interpolate=function(t,e,n,r){return t=t<0?0:t,n=n<0?0:n,t<=n?n===0?(e+r)/2:e+(r-e)*(t/(t+n)):r+(e-r)*(n/(t+n))},i.intersect=function(t,e,n,r,s){var o,a,l;i.vertLeq(t,e)||(l=t,t=e,e=l),i.vertLeq(n,r)||(l=n,n=r,r=l),i.vertLeq(t,n)||(l=t,t=n,n=l,l=e,e=r,r=l),i.vertLeq(n,e)?i.vertLeq(e,r)?(o=i.edgeEval(t,n,e),a=i.edgeEval(n,e,r),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,n.s,a,e.s)):(o=i.edgeSign(t,n,e),a=-i.edgeSign(t,r,e),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,n.s,a,r.s)):s.s=(n.s+e.s)/2,i.transLeq(t,e)||(l=t,t=e,e=l),i.transLeq(n,r)||(l=n,n=r,r=l),i.transLeq(t,n)||(l=t,t=n,n=l,l=e,e=r,r=l),i.transLeq(n,e)?i.transLeq(e,r)?(o=i.transEval(t,n,e),a=i.transEval(n,e,r),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,n.t,a,e.t)):(o=i.transSign(t,n,e),a=-i.transSign(t,r,e),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,n.t,a,r.t)):s.t=(n.t+e.t)/2},i}(),Av=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}(),yw=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}(),Uf=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}(),MV=function(){function i(){var t=new Uf,e=new Av,n=new yw(0),r=new yw(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 yw(0),n=new yw(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;Rt(r,"Vertex can't be null!");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=e;var o=e;do o.Org=r,o=o.Onext;while(o!==e)},i.prototype.makeFace_=function(t,e,n){var r=t;Rt(r,"Face can't be null");var s=n.prev;r.prev=s,s.next=r,r.next=n,n.prev=r,r.anEdge=e,r.trail=null,r.marked=!1,r.inside=n.inside;var o=e;do o.Lface=r,o=o.Lnext;while(o!==e)},i.prototype.killEdge_=function(t){t.Sym.side<t.side&&(t=t.Sym);var e=t.next,n=t.Sym.next;e.Sym.next=n,n.Sym.next=e},i.prototype.killVertex_=function(t,e){var n=t.anEdge,r=n;do r.Org=e,r=r.Onext;while(r!==n);var s=t.prev,o=t.next;o.prev=s,s.next=o},i.prototype.killFace_=function(t,e){var n=t.anEdge,r=n;do r.Lface=e,r=r.Lnext;while(r!==n);var s=t.prev,o=t.next;o.prev=s,s.next=o},i.prototype.makeEdge=function(){var t=new Uf,e=new Uf,n=new Av,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 Uf;this.makeVertex_(s,e,t.Org),t.Org.anEdge=t}if(!n){var o=new Av;this.makeFace_(o,e,t.Lface),t.Lface.anEdge=t}}},i.prototype.delete=function(t){var e=t.Sym,n=!1;if(t.Lface!==t.Rface&&(n=!0,this.killFace_(t.Lface,t.Rface)),t.Onext===t)this.killVertex_(t.Org,null);else if(t.Rface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev),!n){var r=new Av;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 Uf;return this.makeVertex_(r,n,e.Org),e.Lface=n.Lface=t.Lface,e},i.prototype.splitEdge=function(t){var e=this.addEdgeVertex(t),n=e.Sym;return this.splice_(t.Sym,t.Sym.Oprev),this.splice_(t.Sym,n),t.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=t.Rface,n.winding=t.winding,n.Sym.winding=t.Sym.winding,n.idx=t.idx,n.Sym.idx=t.Sym.idx,n},i.prototype.connect=function(t,e){var n=!1,r=this.makeEdge_(t),s=r.Sym;if(e.Lface!==t.Lface&&(n=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(r,t.Lnext),this.splice_(s,e),r.Org=t.Dst,s.Org=e.Org,r.Lface=s.Lface=t.Lface,t.Lface.anEdge=s,!n){var o=new Av;this.makeFace_(o,r,t.Lface)}return r},i.prototype.zapFace=function(t){var e=t.anEdge,n,r,s,o,a;r=e.Lnext;do n=r,r=n.Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),s=n.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=e);o=t.prev,a=t.next,a.prev=o,o.next=a},i.prototype.countFaceVerts_=function(t){var e=t.anEdge,n=0;do n++,e=e.Lnext;while(e!==t.anEdge);return n},i.prototype.mergeConvexFaces=function(t){var e,n,r,s,o,a,l;for(e=this.fHead.next;e!==this.fHead;e=e.next)if(!!e.inside)for(n=e.anEdge,o=n.Org;r=n.Lnext,s=n.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(e),l=this.countFaceVerts_(s.Lface),a+l-2<=t&&_t.vertCCW(n.Lprev.Org,n.Org,s.Lnext.Lnext.Org)&&_t.vertCCW(s.Lprev.Org,s.Org,n.Lnext.Lnext.Org)&&(r=s.Lnext,this.delete(s),n=null,s=null)),!(n&&n.Lnext.Org===o);)n=r;return!0},i.prototype.check=function(){var t=this.fHead,e=this.vHead,n=this.eHead,r,s,o,a,l,c;for(s=t,s=t;(r=s.next)!==t;s=r){Rt(r.prev===s),l=r.anEdge;do Rt(l.Sym!==l),Rt(l.Sym.Sym===l),Rt(l.Lnext.Onext.Sym===l),Rt(l.Onext.Sym.Lnext===l),Rt(l.Lface===r),l=l.Lnext;while(l!==r.anEdge)}for(Rt(r.prev===s&&r.anEdge===null),a=e,a=e;(o=a.next)!==e;a=o){Rt(o.prev===a),l=o.anEdge;do Rt(l.Sym!==l),Rt(l.Sym.Sym===l),Rt(l.Lnext.Onext.Sym===l),Rt(l.Onext.Sym.Lnext===l),Rt(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(Rt(o.prev===a&&o.anEdge===null),c=n,c=n;(l=c.next)!==n;c=l)Rt(l.Sym.next===c.Sym),Rt(l.Sym!==l),Rt(l.Sym.Sym===l),Rt(l.Org!==null),Rt(l.Dst!==null),Rt(l.Lnext.Onext.Sym===l),Rt(l.Onext.Sym.Lnext===l);Rt(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}(),_V=function(){function i(){this.handle=null}return i}(),AV=function(){function i(){this.key=null,this.node=0}return i}(),lte=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 _V,this.handles[n]=new AV;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(t){var e=this.nodes,n=this.handles,r,s,o;for(r=e[t].handle;;){if(o=t<<1,o<this.size&&this.leq(n[e[o+1].handle].key,n[e[o].handle].key)&&++o,Rt(o<=this.max),s=e[o].handle,o>this.size||this.leq(n[r].key,n[s].key)){e[t].handle=r,n[r].node=t;break}e[t].handle=s,n[s].node=t,t=o}},i.prototype.floatUp_=function(t){var e=this.nodes,n=this.handles,r,s,o;for(r=e[t].handle;;){if(o=t>>1,s=e[o].handle,o===0||this.leq(n[s].key,n[r].key)){e[t].handle=r,n[r].node=t;break}e[t].handle=s,n[s].node=t,t=o}},i.prototype.init=function(){for(var t=this.size;t>=1;--t)this.floatDown_(t);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(t){var e,n;if(e=++this.size,e*2>this.max){this.max*=2;var r,s;for(s=this.nodes.length,this.nodes.length=this.max+1,r=s;r<this.nodes.length;r++)this.nodes[r]=new _V;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new AV}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;Rt(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}(),L2=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}(),CV=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),cte=function(){function i(t,e){this.frame=t,this.leq=e,this.head=new CV,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 CV;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}(),ute=function(){function i(){}return i.regionBelow=function(t){return t.nodeUp.prev.key},i.regionAbove=function(t){return t.nodeUp.next.key},i.debugEvent=function(t){},i.addWinding=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.edgeLeq=function(t,e,n){var r=t.event,s=e.eUp,o=n.eUp;if(s.Dst===r)return o.Dst===r?_t.vertLeq(s.Org,o.Org)?_t.edgeSign(o.Dst,s.Org,o.Org)<=0:_t.edgeSign(s.Dst,o.Org,s.Org)>=0:_t.edgeSign(o.Dst,r,o.Org)<=0;if(o.Dst===r)return _t.edgeSign(s.Dst,r,s.Org)>=0;var a=_t.edgeEval(s.Dst,r,s.Org),l=_t.edgeEval(o.Dst,r,o.Org);return a>=l},i.deleteRegion=function(t,e){e.fixUpperEdge&&Rt(e.eUp.winding===0),e.eUp.activeRegion=null,t.dict.delete(e.nodeUp)},i.fixUpperEdge=function(t,e,n){Rt(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 L2;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 Nn.ODD:return(e&1)!==0;case Nn.NONZERO:return e!==0;case Nn.POSITIVE:return e>0;case Nn.NEGATIVE:return e<0;case Nn.ABS_GEQ_TWO:return e>=2||e<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(t,e){e.windingNumber=i.regionAbove(e).windingNumber+e.eUp.winding,e.inside=i.isWindingInside(t,e.windingNumber)},i.finishRegion=function(t,e){var n=e.eUp,r=n.Lface;r.inside=e.inside,r.anEdge=n,i.deleteRegion(t,e)},i.finishLeftRegions=function(t,e,n){for(var r,s=null,o=e,a=e.eUp;o!==n;){if(o.fixUpperEdge=!1,s=i.regionBelow(o),r=s.eUp,r.Org!=a.Org){if(!s.fixUpperEdge){i.finishRegion(t,o);break}r=t.mesh.connect(a.Lprev,r.Sym),i.fixUpperEdge(t,s,r)}a.Onext!==r&&(t.mesh.splice(r.Oprev,r),t.mesh.splice(a,r)),i.finishRegion(t,o),a=s.eUp,o=s}return a},i.addRightEdges=function(t,e,n,r,s,o){var a,l,c,u,d=!0;c=n;do Rt(_t.vertLeq(c.Org,c.Dst)),i.addRegionBelow(t,e,c.Sym),c=c.Onext;while(c!==r);for(s===null&&(s=i.regionBelow(e).eUp.Rprev),l=e,u=s;a=i.regionBelow(l),c=a.eUp.Sym,c.Org===u.Org;)c.Onext!==u&&(t.mesh.splice(c.Oprev,c),t.mesh.splice(u.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=i.isWindingInside(t,a.windingNumber),l.dirty=!0,!d&&i.checkForRightSplice(t,l)&&(i.addWinding(c,u),i.deleteRegion(t,l),t.mesh.delete(u)),d=!1,l=a,u=c;l.dirty=!0,Rt(l.windingNumber-c.winding===a.windingNumber),o&&i.walkDirtyRegions(t,l)},i.spliceMergeVertices=function(t,e,n){t.mesh.splice(e,n)},i.vertexWeights=function(t,e,n){var r=_t.vertL1dist(e,t),s=_t.vertL1dist(n,t),o=.5*s/(r+s),a=.5*r/(r+s);t.coords[0]+=o*e.coords[0]+a*n.coords[0],t.coords[1]+=o*e.coords[1]+a*n.coords[1],t.coords[2]+=o*e.coords[2]+a*n.coords[2]},i.getIntersectData=function(t,e,n,r,s,o){e.coords[0]=e.coords[1]=e.coords[2]=0,e.idx=-1,i.vertexWeights(e,n,r),i.vertexWeights(e,s,o)},i.checkForRightSplice=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp;if(_t.vertLeq(r.Org,s.Org)){if(_t.edgeSign(s.Dst,r.Org,s.Org)>0)return!1;_t.vertEq(r.Org,s.Org)?r.Org!==s.Org&&(t.pq.delete(r.Org.pqHandle),i.spliceMergeVertices(t,s.Oprev,r)):(t.mesh.splitEdge(s.Sym),t.mesh.splice(r,s.Oprev),e.dirty=n.dirty=!0)}else{if(_t.edgeSign(r.Dst,s.Org,r.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(r.Sym),t.mesh.splice(s.Oprev,r)}return!0},i.checkForLeftSplice=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp,o;if(Rt(!_t.vertEq(r.Dst,s.Dst)),_t.vertLeq(r.Dst,s.Dst)){if(_t.edgeSign(r.Dst,s.Dst,r.Org)<0)return!1;i.regionAbove(e).dirty=e.dirty=!0,o=t.mesh.splitEdge(r),t.mesh.splice(s.Sym,o),o.Lface.inside=e.inside}else{if(_t.edgeSign(s.Dst,r.Dst,s.Org)>0)return!1;e.dirty=n.dirty=!0,o=t.mesh.splitEdge(s),t.mesh.splice(r.Lnext,s.Sym),o.Rface.inside=e.inside}return!0},i.checkForIntersect=function(t,e){var n=i.regionBelow(e),r=e.eUp,s=n.eUp,o=r.Org,a=s.Org,l=r.Dst,c=s.Dst,u,d,h=new Uf,p,f;if(Rt(!_t.vertEq(c,l)),Rt(_t.edgeSign(l,t.event,o)<=0),Rt(_t.edgeSign(c,t.event,a)>=0),Rt(o!==t.event&&a!==t.event),Rt(!e.fixUpperEdge&&!n.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),d=Math.max(a.t,c.t),u>d))return!1;if(_t.vertLeq(o,a)){if(_t.edgeSign(c,o,a)>0)return!1}else if(_t.edgeSign(l,a,o)<0)return!1;return i.debugEvent(t),_t.intersect(l,o,c,a,h),Rt(Math.min(o.t,l.t)<=h.t),Rt(h.t<=Math.max(a.t,c.t)),Rt(Math.min(c.s,l.s)<=h.s),Rt(h.s<=Math.max(a.s,o.s)),_t.vertLeq(h,t.event)&&(h.s=t.event.s,h.t=t.event.t),p=_t.vertLeq(o,a)?o:a,_t.vertLeq(p,h)&&(h.s=p.s,h.t=p.t),_t.vertEq(h,o)||_t.vertEq(h,a)?(i.checkForRightSplice(t,e),!1):!_t.vertEq(l,t.event)&&_t.edgeSign(l,t.event,h)>=0||!_t.vertEq(c,t.event)&&_t.edgeSign(c,t.event,h)<=0?c===t.event?(t.mesh.splitEdge(r.Sym),t.mesh.splice(s.Sym,r),e=i.topLeftRegion(t,e),r=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),n),i.addRightEdges(t,e,r.Oprev,r,r,!0),!0):l===t.event?(t.mesh.splitEdge(s.Sym),t.mesh.splice(r.Lnext,s.Oprev),n=e,e=i.topRightRegion(e),f=i.regionBelow(e).eUp.Rprev,n.eUp=s.Oprev,s=i.finishLeftRegions(t,n,null),i.addRightEdges(t,e,s.Onext,r.Rprev,f,!0),!0):(_t.edgeSign(l,t.event,h)>=0&&(i.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(r.Sym),r.Org.s=t.event.s,r.Org.t=t.event.t),_t.edgeSign(c,t.event,h)<=0&&(e.dirty=n.dirty=!0,t.mesh.splitEdge(s.Sym),s.Org.s=t.event.s,s.Org.t=t.event.t),!1):(t.mesh.splitEdge(r.Sym),t.mesh.splitEdge(s.Sym),t.mesh.splice(s.Oprev,r),r.Org.s=h.s,r.Org.t=h.t,r.Org.pqHandle=t.pq.insert(r.Org),i.getIntersectData(t,r.Org,o,l,a,c),i.regionAbove(e).dirty=e.dirty=n.dirty=!0,!1)},i.walkDirtyRegions=function(t,e){for(var n=i.regionBelow(e),r,s;;){for(;n.dirty;)e=n,n=i.regionBelow(n);if(!e.dirty&&(n=e,e=i.regionAbove(e),e===null||!e.dirty))return;if(e.dirty=!1,r=e.eUp,s=n.eUp,r.Dst!==s.Dst&&i.checkForLeftSplice(t,e)&&(n.fixUpperEdge?(i.deleteRegion(t,n),t.mesh.delete(s),n=i.regionBelow(e),s=n.eUp):e.fixUpperEdge&&(i.deleteRegion(t,e),t.mesh.delete(r),e=i.regionAbove(n),r=e.eUp)),r.Org!==s.Org)if(r.Dst!==s.Dst&&!e.fixUpperEdge&&!n.fixUpperEdge&&(r.Dst===t.event||s.Dst===t.event)){if(i.checkForIntersect(t,e))return}else i.checkForRightSplice(t,e);r.Org===s.Org&&r.Dst===s.Dst&&(i.addWinding(s,r),i.deleteRegion(t,e),t.mesh.delete(r),e=i.regionAbove(n))}},i.connectRightVertex=function(t,e,n){var r,s=n.Onext,o=i.regionBelow(e),a=e.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(t,e),_t.vertEq(a.Org,t.event)&&(t.mesh.splice(s.Oprev,a),e=i.topLeftRegion(t,e),s=i.regionBelow(e).eUp,i.finishLeftRegions(t,i.regionBelow(e),o),c=!0),_t.vertEq(l.Org,t.event)&&(t.mesh.splice(n,l.Oprev),n=i.finishLeftRegions(t,o,null),c=!0),c){i.addRightEdges(t,e,n.Onext,s,s,!0);return}_t.vertLeq(l.Org,a.Org)?r=l.Oprev:r=a,r=t.mesh.connect(n.Lprev,r),i.addRightEdges(t,e,r,r.Onext,r.Onext,!1),r.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(t,e)},i.connectLeftDegenerate=function(t,e,n){var r,s,o,a,l;if(r=e.eUp,_t.vertEq(r.Org,n)){Rt(!1),i.spliceMergeVertices(t,r,n.anEdge);return}if(!_t.vertEq(r.Dst,n)){t.mesh.splitEdge(r.Sym),e.fixUpperEdge&&(t.mesh.delete(r.Onext),e.fixUpperEdge=!1),t.mesh.splice(n.anEdge,r),i.sweepEvent(t,n);return}Rt(!1),e=i.topRightRegion(e),l=i.regionBelow(e),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(Rt(s!==o),i.deleteRegion(t,l),t.mesh.delete(o),o=s.Oprev),t.mesh.splice(n.anEdge,o),_t.edgeGoesLeft(s)||(s=null),i.addRightEdges(t,e,o.Onext,a,s,!0)},i.connectLeftVertex=function(t,e){var n,r,s,o,a,l,c=new L2;if(c.eUp=e.anEdge.Sym,n=t.dict.search(c).key,r=i.regionBelow(n),!!r){if(o=n.eUp,a=r.eUp,_t.edgeSign(o.Dst,e,o.Org)===0){i.connectLeftDegenerate(t,n,e);return}if(s=_t.vertLeq(a.Dst,o.Dst)?n:r,n.inside||s.fixUpperEdge){if(s===n)l=t.mesh.connect(e.anEdge.Sym,o.Lnext);else{var u=t.mesh.connect(a.Dnext,e.anEdge);l=u.Sym}s.fixUpperEdge?i.fixUpperEdge(t,s,l):i.computeWinding(t,i.addRegionBelow(t,n,l)),i.sweepEvent(t,e)}else i.addRightEdges(t,n,e.anEdge,e.anEdge,null,!0)}},i.sweepEvent=function(t,e){t.event=e,i.debugEvent(t);for(var n=e.anEdge;n.activeRegion===null;)if(n=n.Onext,n===e.anEdge){i.connectLeftVertex(t,e);return}var r=i.topLeftRegion(t,n.activeRegion);Rt(r!==null);var s=i.regionBelow(r),o=s.eUp,a=i.finishLeftRegions(t,s,null);a.Onext===o?i.connectRightVertex(t,r,a):i.addRightEdges(t,r,a.Onext,o,o,!0)},i.addSentinel=function(t,e,n,r){var s=new L2,o=t.mesh.makeEdge();o.Org.s=n,o.Org.t=r,o.Dst.s=e,o.Dst.t=r,t.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=t.dict.insert(s)},i.initEdgeDict=function(t){t.dict=new cte(t,i.edgeLeq);var e=t.bmax[0]-t.bmin[0],n=t.bmax[1]-t.bmin[1],r=t.bmin[0]-e,s=t.bmax[0]+e,o=t.bmin[1]-n,a=t.bmax[1]+n;i.addSentinel(t,r,s,o),i.addSentinel(t,r,s,a)},i.doneEdgeDict=function(t){for(var e,n=0;(e=t.dict.min().key)!==null;)e.sentinel||(Rt(e.fixUpperEdge),Rt(++n===1)),Rt(e.windingNumber===0),i.deleteRegion(t,e)},i.removeDegenerateEdges=function(t){var e,n,r,s=t.mesh.eHead;for(e=s.next;e!==s;e=n)n=e.next,r=e.Lnext,_t.vertEq(e.Org,e.Dst)&&e.Lnext.Lnext!==e&&(i.spliceMergeVertices(t,r,e),t.mesh.delete(e),e=r,r=e.Lnext),r.Lnext===e&&(r!==e&&((r===n||r===n.Sym)&&(n=n.next),t.mesh.delete(r)),(e===n||e===n.Sym)&&(n=n.next),t.mesh.delete(e))},i.initPriorityQ=function(t){var e,n,r,s=0;for(r=t.mesh.vHead,n=r.next;n!==r;n=n.next)s++;for(s+=8,e=t.pq=new lte(s,_t.vertLeq),r=t.mesh.vHead,n=r.next;n!==r;n=n.next)n.pqHandle=e.insert(n);return n!==r?!1:(e.init(),!0)},i.donePriorityQ=function(t){t.pq=null},i.removeDegenerateFaces=function(t,e){var n,r,s;for(n=e.fHead.next;n!==e.fHead;n=r)r=n.next,s=n.anEdge,Rt(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),t.mesh.delete(s));return!0},i.computeInterior=function(t,e){e===void 0&&(e=!0);var n,r;if(i.removeDegenerateEdges(t),!i.initPriorityQ(t))return!1;for(i.initEdgeDict(t);(n=t.pq.extractMin())!==null;){for(;r=t.pq.min(),!(r===null||!_t.vertEq(r,n));)r=t.pq.extractMin(),i.spliceMergeVertices(t,n.anEdge,r.anEdge);i.sweepEvent(t,n)}return t.event=t.dict.min().key.eUp.Org,i.debugEvent(t),i.doneEdgeDict(t),i.donePriorityQ(t),i.removeDegenerateFaces(t,t.mesh)?(e&&t.mesh.check(),!0):!1},i}(),dte=function(){function i(){this.mesh=new MV,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=Nn.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.prototype.normalize_=function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];if(!e)throw"Zero-size vector!";e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},i.prototype.longAxis_=function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},i.prototype.computeNormal_=function(t){var e,n,r,s,o,a,l=[0,0,0],c=[0,0,0],u=[0,0,0],d=[0,0,0],h=[0,0,0],p=[null,null,null],f=[null,null,null],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(a=0,n=f[v],r=p[v],u[0]=n.coords[0]-r.coords[0],u[1]=n.coords[1]-r.coords[1],u[2]=n.coords[2]-r.coords[2],e=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],o=h[0]*h[0]+h[1]*h[1]+h[2]*h[2],o>a&&(a=o,t[0]=h[0],t[1]=h[1],t[2]=h[2]);a<=0&&(t[0]=t[1]=t[2]=0,t[this.longAxis_(u)]=1)},i.prototype.checkOrientation_=function(){for(var t=this.mesh.fHead,e,n=this.mesh.vHead,r,s=0,o=t.next;o!==t;o=o.next)if(r=o.anEdge,!(r.winding<=0))do s+=(r.Org.s-r.Dst.s)*(r.Org.t+r.Dst.t),r=r.Lnext;while(r!==o.anEdge);if(s<0){for(e=n.next;e!==n;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var t=this.mesh.vHead,e=[0,0,0],n,r,s=!1;e[0]=this.normal[0],e[1]=this.normal[1],e[2]=this.normal[2],!e[0]&&!e[1]&&!e[2]&&(this.computeNormal_(e),s=!0),n=this.sUnit,r=this.tUnit;var o=this.longAxis_(e);n[o]=0,n[(o+1)%3]=1,n[(o+2)%3]=0,r[o]=0,r[(o+1)%3]=0,r[(o+2)%3]=e[o]>0?1:-1;for(var a=t.next;a!==t;a=a.next)a.s=this.dot_(a.coords,n),a.t=this.dot_(a.coords,r);s&&this.checkOrientation_();for(var l=!0,c=t.next;c!==t;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},i.prototype.tessellateMonoRegion_=function(t,e){var n,r;if(n=e.anEdge,!(n.Lnext!==n&&n.Lnext.Lnext!==n))throw"Mono region invalid";for(;_t.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;_t.vertLeq(n.Org,n.Dst);n=n.Lnext);r=n.Lprev;for(var s=void 0;n.Lnext!==r;)if(_t.vertLeq(n.Dst,r.Org)){for(;r.Lnext!==n&&(_t.edgeGoesLeft(r.Lnext)||_t.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)s=t.connect(r.Lnext,r),r=s.Sym;r=r.Lprev}else{for(;r.Lnext!==n&&(_t.edgeGoesRight(n.Lprev)||_t.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)s=t.connect(n,n.Lprev),n=s.Sym;n=n.Lnext}if(r.Lnext===n)throw"Mono region invalid";for(;r.Lnext.Lnext!==n;)s=t.connect(r.Lnext,r),r=s.Sym;return!0},i.prototype.tessellateInterior_=function(t){for(var e,n=t.fHead.next;n!==t.fHead;n=e)if(e=n.next,n.inside&&!this.tessellateMonoRegion_(t,n))return!1;return!0},i.prototype.discardExterior_=function(t){for(var e,n=t.fHead.next;n!==t.fHead;n=e)e=n.next,n.inside||t.zapFace(n)},i.prototype.setWindingNumber_=function(t,e,n){for(var r,s=t.eHead.next;s!==t.eHead;s=r)r=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?e:-e:n?t.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(t){return!t.Rface||!t.Rface.inside?-1:t.Rface.n},i.prototype.outputPolymesh_=function(t,e,n,r){var s,o=0,a=0,l;n>3&&t.mergeConvexFaces(n);for(var c=t.vHead.next;c!==t.vHead;c=c.next)c.n=-1;for(var u=t.fHead.next;u!==t.fHead;u=u.next)if(u.n=-1,!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;c.n===-1&&(c.n=a,a++),l++,s=s.Lnext}while(s!==u.anEdge);if(l>n)throw"Face vertex greater that support polygon";u.n=o,++o}this.elementCount=o,e===si.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*n,this.vertexCount=a,this.vertices=[],this.vertices.length=a*r,this.vertexIndices=[],this.vertexIndices.length=a;for(var c=t.vHead.next;c!==t.vHead;c=c.next)if(c.n!==-1){var d=c.n*r;this.vertices[d+0]=c.coords[0],this.vertices[d+1]=c.coords[1],r>2&&(this.vertices[d+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var h=0,u=t.fHead.next;u!==t.fHead;u=u.next)if(!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;this.elements[h++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var p=l;p<n;++p)this.elements[h++]=-1;if(e===si.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[h++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var f=l;f<n;++f)this.elements[h++]=-1}}},i.prototype.outputContours_=function(t,e){var n,r,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var a=t.fHead.next;a!==t.fHead;a=a.next)if(!!a.inside){r=n=a.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==r);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*e,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,u=0;s=0;for(var a=t.fHead.next;a!==t.fHead;a=a.next)if(!!a.inside){o=0,r=n=a.anEdge;do this.vertices[l++]=n.Org.coords[0],this.vertices[l++]=n.Org.coords[1],e>2&&(this.vertices[l++]=n.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(n):n.Org.idx,o++,n=n.Lnext;while(n!==r);this.elements[u++]=s,this.elements[u++]=o,s+=o}},i.prototype.addContour=function(t,e){this.mesh===null&&(this.mesh=new MV),t<2&&(t=2),t>3&&(t=3);for(var n=null,r=0;r<e.length;r+=t)n===null?(n=this.mesh.makeEdge(),this.mesh.splice(n,n.Sym)):(this.mesh.splitEdge(n),n=n.Lnext),n.Org.coords[0]=e[r+0],n.Org.coords[1]=e[r+1],t>2?n.Org.coords[2]=e[r+2]:n.Org.coords[2]=0,n.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(n),n.winding=1,n.Sym.winding=-1},i.prototype.tesselate=function(t,e,n,r,s,o){if(t===void 0&&(t=Nn.ODD),e===void 0&&(e=si.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=t,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),ute.computeInterior(this,o);var a=this.mesh;return e===si.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),e===si.BOUNDARY_CONTOURS?this.outputContours_(a,r):this.outputPolymesh_(a,e,n,r),!0},i}();gEe=Nn.ODD,yEe=Nn.NONZERO,vEe=Nn.POSITIVE,bEe=Nn.NEGATIVE,xEe=Nn.ABS_GEQ_TWO,SEe=si.POLYGONS,wEe=si.CONNECTED_POLYGONS,EEe=si.BOUNDARY_CONTOURS});function vw(i,t){let e=i.length/2;if(e<2)return[];let n=0;for(let l=0;l<e;l++){let c=(l+1)%e;n+=i[l*2]*i[c*2+1]-i[c*2]*i[l*2+1]}let r=n>0!==t?1:-1,s=[];for(let l=0;l<e;l++){let c=(l+1)%e,u=i[c*2]-i[l*2],d=i[c*2+1]-i[l*2+1],h=Math.hypot(u,d);s.push(h>0?[r*d/h,-r*u/h]:[0,0])}let o=Math.cos(40*Math.PI/180),a=(l,c)=>{if(l[0]*c[0]+l[1]*c[1]<=o)return l;let[u,d]=[l[0]+c[0],l[1]+c[1]],h=Math.hypot(u,d);return h>0?[u/h,d/h]:l};return s.map((l,c)=>[a(l,s[(c+e-1)%e]),a(l,s[(c+1)%e])])}function bw(i,t,e){let n=i.length/2,r=new Float32Array(n+1);if(!(t>0)||!(e>0)||n<2)return{u:r,vScale:0};let s=0;for(let o=0;o<n;o++){let a=(o+1)%n;s+=Math.hypot((i[a*2]-i[o*2])/t,(i[a*2+1]-i[o*2+1])/e),r[o+1]=s}return{u:r,vScale:Math.sqrt(t*e)}}function xw(i,t,e){for(let n=0;n<e.length;n+=3){let r=e[n]*3,s=e[n+1]*3,o=e[n+2]*3,a=i[s]-i[r],l=i[s+1]-i[r+1],c=i[s+2]-i[r+2],u=i[o]-i[r],d=i[o+1]-i[r+1],h=i[o+2]-i[r+2],p=l*h-c*d,f=c*u-a*h,m=a*d-l*u,g=t[r]+t[s]+t[o],y=t[r+1]+t[s+1]+t[o+1],v=t[r+2]+t[s+2]+t[o+2];if(p*g+f*y+m*v<0){let b=e[n+1];e[n+1]=e[n+2],e[n+2]=b}}}var N2=B(()=>{"use strict"});var Sw,PV,ww,Ew=B(()=>{"use strict";Sw={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},PV={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},ww={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}});function B2(i,t){return i.normals[t*3+2]<.9999}function Tw(i){let t=RV.get(i);if(t!==void 0)return t;if(!(i.rise>0))return i;let e=new Float32Array(i.normals),n=i.positions.length/3;for(let s=0;s<n;s++){if(!B2(i,s))continue;let o=e[s*3],a=e[s*3+1],l=Math.hypot(o,a);if(l===0)continue;let c=i.rise-i.positions[s*3+2],u=Math.min(1,Math.max(0,1-c/i.rise)),d=Math.sqrt(1-u*u);e[s*3]=o/l*d,e[s*3+1]=a/l*d,e[s*3+2]=u}let r={...i,normals:e};return RV.set(i,r),r}function Mw(i,t,e,n){let r=(t-i.minX)/i.spanX,s=(e-i.minY)/i.spanY;return n?[s,r]:[r,s]}var RV,_w=B(()=>{"use strict";RV=new WeakMap});var IV,eh,OV=B(()=>{"use strict";q();kf();dn();N2();Ew();_w();IV=2,eh=class extends Me{constructor(e,n,r=12,s=Nn.ODD,o,a=!1){super();this.type="FlatExtrusionGeometry";this._nearSide=new Uint8Array(0);this._vScale=0;this._shape=e,this._depth=n,this._curveSegments=r,this._windingRule=s,this._uvPitch=a?void 0:o,this._legacy=a;let l=[e.extractShapePointsToFlatArray([],r),...e.shapeHoles.map(K=>K.extractShapePointsToFlatArray([],r))],c;try{c=Eu({contours:l,windingRule:s,elementType:si.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{c=ww}let u=c?.vertexCount??0,d=c?.elementCount??0,h=1/0,p=1/0,f=-1/0,m=-1/0;for(let K of l)for(let Y=0;Y<K.length;Y+=2)K[Y]<h&&(h=K[Y]),K[Y]>f&&(f=K[Y]),K[Y+1]<p&&(p=K[Y+1]),K[Y+1]>m&&(m=K[Y+1]);let g=this._uvPitch,y=g??(f-h||1),v=g??(m-p||1),b=g===void 0?h:0,x=g===void 0?p:0,S=l.map((K,Y)=>vw(K,Y>0)),E=0;for(let K of S)E+=K.length;let T=u*2+E*4,w=d*3*2+E*6,_=new Float32Array(T*3),A=new Float32Array(T*3),C=new Float32Array(T*2),R=new Uint32Array(w),D=new Uint8Array(T),O=0,L=0,F=0,j=!1,W=(K,Y,$,ee,oe,ae,de=(K-b)/y,be=(Y-x)/v)=>{let Re=L*3;_[Re]=K,_[Re+1]=Y,_[Re+2]=$,A[Re]=ee,A[Re+1]=oe,A[Re+2]=ae,D[L]=$===n?j?IV:1:0,C[L*2]=de,C[L*2+1]=be,L++};if(c!==void 0)for(let[K,Y]of[[n,1],[0,-1]]){let $=L;for(let ee=0;ee<u;ee++)W(c.vertices[ee*2],c.vertices[ee*2+1],K,0,0,Y);for(let ee=0;ee<d;ee++){let[oe,ae,de]=[c.elements[ee*3],c.elements[ee*3+1],c.elements[ee*3+2]];R[F++]=$+oe,R[F++]=$+(Y>0?ae:de),R[F++]=$+(Y>0?de:ae)}}j=!0;for(let K=0;K<l.length;K++){let Y=l[K],$=S[K],ee=Y.length/2,{u:oe,vScale:ae}=a?{u:new Float32Array(ee+1),vScale:0}:bw(Y,y,v);O=ae;let de=ae===0?0:n/ae,be={minX:b,minY:x,spanX:y,spanY:v},Re=(me,[Ae,Le],Ie,Ge)=>{let Ve=Y[me*2],pe=Y[me*2+1],[Ne,we]=a?Mw(be,Ve,pe,Ie):[Ge,Ie?0:de];W(Ve,pe,Ie?0:n,Ae,Le,0,Ne,we)};for(let me=0;me<$.length;me++){let Ae=(me+1)%ee,[Le,Ie]=$[me],[Ge,Ve]=[oe[me],oe[me+1]],pe=L;Re(me,Le,!1,Ge),Re(me,Le,!0,Ge),Re(Ae,Ie,!1,Ve),Re(Ae,Ie,!0,Ve),R[F++]=pe,R[F++]=pe+1,R[F++]=pe+2,R[F++]=pe+3,R[F++]=pe+2,R[F++]=pe+1}}xw(_,A,R),this.setAttribute("position",new Ue(_,3)),this.setAttribute("normal",new Ue(A,3)),this.setAttribute("uv",new Ue(C,2)),this.setIndex(new Ue(R,1)),this._nearSide=D,this._vScale=O}takeDepthStateFrom(e){let n=e;n._nearSide!==void 0&&(this._depth=n._depth??this._depth,this._nearSide=n._nearSide,this._vScale=n._vScale??this._vScale)}canShiftDepthTo(e){return this._nearSide.length>0&&this._depth>0&&e>0}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let n=e-this._depth;if(this._depth=e,n===0)return!0;let r=this.getAttribute("position");if(r===void 0)return!1;let s=r.array,o=this.getAttribute("uv"),a=o?.array,l=this._vScale>0?n/this._vScale:0,c=this._nearSide;for(let u=0;u<c.length;u++){let d=c[u];d!==0&&(s[u*3+2]+=n,d===IV&&a!==void 0&&(a[u*2+1]+=l))}return r.needsUpdate=!0,o!==void 0&&l!==0&&(o.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let n=this.boundingBox;n.min.z=Math.min(0,e),n.max.z=Math.max(0,e),this.boundingSphere!==null&&n.getBoundingSphere(this.boundingSphere)}clone(){let e=new eh(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return e.userData=su(this.userData),e}}});var Vf,F2=B(()=>{"use strict";q();kf();dn();Ew();Vf=class extends Me{constructor(e,n=12,r={}){super();this.type="ShapeGeometry";this.windingRule=Nn.ODD;this.elementType=si.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=e,this._curveSegments=n,this._triangulationOptions=Object.assign({windingRule:Nn.ODD,elementType:si.POLYGONS,polySize:3,vertexSize:2,strict:!0},r);let s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(f=>f.extractShapePointsToFlatArray([],this._curveSegments)),a,l=!0,c=!0,u,d;for(let f=0,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{a=Eu({contours:[s,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{a=Sw}let h=a?.vertexCount??1,p=a?.elementCount??1;if(this._positionAttribute=new Ue(new Float32Array(h*3),3),this._normalAttribute=new Ue(new Float32Array(h*3),3),this._uvAttribute=new Ue(new Float32Array(h*2),2),this._indexAttribute=new Ue(new Uint32Array(p*3),1),a){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,T=a.vertices[E+0],w=a.vertices[E+1];T<f&&(f=T),T>m&&(m=T),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,T=a.vertices[E+0],w=a.vertices[E+1],_=(T-f)/v,A=(w-g)/b;this._positionAttribute.setXYZ(x,T,w,0),this._normalAttribute.setXYZ(x,0,0,1),this._uvAttribute.setXY(x,_,A)}for(let x=0,S=p;x<S;x++){let E=x*3,T=a.elements[E+0],w=a.elements[E+1],_=a.elements[E+2];this._indexAttribute.setX(E+0,T),this._indexAttribute.setX(E+1,w),this._indexAttribute.setX(E+2,_)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,(a?.elementCount??1)*3)}clone(){let e=new Vf(this._shape,this._curveSegments);return e.userData=su(this.userData),e}}});function LV(i){if(Aw)return Aw;async function t(){let n=i??(!1?".":"https://unpkg.com/@splinetool/runtime@2.0.78/build"),s=import("./bevel.js"),[o,a]=await Promise.all([s,fetch(`${n}/bevel.wasm`).then(l=>l.arrayBuffer())]);await o.default({module_or_path:a}),Pv=o}return Aw=t(),Aw}function NV(){return Pv!==void 0}function BV(i){let t=!1;return i.scene.objects.traverse((e,n)=>{let r=n.geometry;if(r!==void 0&&(fte.has(r.type)&&r.depth!==void 0&&r.depth>0&&(r.extrudeBevelSize??0)>0&&(t=!0),r.type==="PathGeometry")){let s=r.extrusion;s!==void 0&&s.capType==="round"&&(s.bevel??0)>0&&(t=!0)}}),t}function FV(i,t){let n=[i.extractShapePointsToFlatArray([],t)];for(let l of i.shapeHoles)n.push(l.extractShapePointsToFlatArray([],t));let r=0;for(let l of n)r+=l.length>>1;let s=new Float64Array(r*2),o=new Uint32Array(n.length),a=0;for(let l=0;l<n.length;l++)s.set(n[l],a*2),a+=n[l].length>>1,o[l]=a;return{points:s,ends:o}}function mte(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i[e],t=Math.imul(t,16777619)>>>0;return t}function gte(i,t){let e=[t],n=r=>{e.push(r.points.length,r.isClosed?1:0,r.roundness??0);for(let s of r.points){e.push(s.roundness??0,s.position.x,s.position.y);for(let o of s.controls)e.push(o.position.x,o.position.y)}e.push(r.shapeHoles.length);for(let s of r.shapeHoles)n(s)};return n(i),mte(new Uint8Array(new Float64Array(e).buffer))}function vte(i,t,e,n,r){let s=1/0;for(let o=2;o<i.length;o+=3)i[o]<s&&(s=i[o]);if(s===1/0&&(s=0),s!==0)for(let o=2;o<i.length;o+=3)i[o]-=s;return{positions:i,normals:t,uvs:e,indices:n,rise:r-s}}function Cv(i,t,e,n,r,s){let o=i.positions.length/3,a=r.elements,l=yte.getNormalMatrix(r).elements;for(let u=0;u<o;u++){let d=u*3,h=(e+u)*3,p=i.positions[d],f=i.positions[d+1],m=i.positions[d+2];t.positions[h]=a[0]*p+a[4]*f+a[8]*m+a[12],t.positions[h+1]=a[1]*p+a[5]*f+a[9]*m+a[13],t.positions[h+2]=a[2]*p+a[6]*f+a[10]*m+a[14];let g=i.normals[d],y=i.normals[d+1],v=i.normals[d+2];t.normals[h]=l[0]*g+l[3]*y+l[6]*v,t.normals[h+1]=l[1]*g+l[4]*y+l[7]*v,t.normals[h+2]=l[2]*g+l[5]*y+l[8]*v;let b=(e+u)*2;if(s===void 0)t.uvs[b]=i.uvs[u*2],t.uvs[b+1]=i.uvs[u*2+1];else{let[x,S]=s(p,f,i.uvs[u*2],i.uvs[u*2+1],u);t.uvs[b]=x,t.uvs[b+1]=S}}let c=r.determinant()<0;for(let u=0;u<i.indices.length;u+=3)t.indices[n+u]=i.indices[u]+e,t.indices[n+u+1]=i.indices[u+(c?2:1)]+e,t.indices[n+u+2]=i.indices[u+(c?1:2)]+e}function wte(i,t,e,n,r,s=!1){let o=n.positions.length/3,a=e-n.rise,l=n.rise,{points:c,ends:u}=FV(i,t),d=1/0,h=1/0,p=-1/0,f=-1/0;for(let W=0;W<c.length;W+=2)c[W]<d&&(d=c[W]),c[W]>p&&(p=c[W]),c[W+1]<h&&(h=c[W+1]),c[W+1]>f&&(f=c[W+1]);s&&(r=void 0);let m=r??p-d,g=r??f-h,y={minX:d,minY:h,spanX:p-d||1,spanY:f-h||1},v=[],b=0;for(let W of u)v.push({at:b,count:W-b}),b=W;let x=0;for(let W of v)x+=W.count;let S=o*2+x*4,E=new Float32Array(S*3),T=new Float32Array(S*3),w=new Float32Array(S*2),_=new Uint32Array(n.indices.length*2+x*6),A=new Uint8Array(S),C=0,R=r===void 0?void 0:(W,K)=>[W/r,K/r],D=s?(W,K,Y,$,ee)=>B2(n,ee)?[$,Y]:[Y,$]:R,O=s?Tw(n):n,L={positions:E,normals:T,uvs:w,indices:_};Cv(O,L,0,0,bte.makeTranslation(0,0,a),R),Cv(O,L,o,n.indices.length,xte.makeTranslation(0,0,l).multiply(Ste),D),A.fill(1,0,o);let F=o*2,j=n.indices.length*2;for(let W=0;W<v.length;W++){let{at:K,count:Y}=v[W],$=c.subarray(K*2,(K+Y)*2),ee=vw($,W>0),oe=s?{u:new Float32Array(Y+1),vScale:0}:bw($,m,g),ae=oe.u;C=oe.vScale;for(let de=0;de<Y;de++){let be=(de+1)%Y,[Re,me]=ee[de],Ae=F;for(let[Le,Ie,Ge,Ve,pe,Ne]of[[$[de*2],$[de*2+1],Re,a,ae[de],U2],[$[be*2],$[be*2+1],me,a,ae[de+1],U2],[$[be*2],$[be*2+1],me,l,ae[de+1],0],[$[de*2],$[de*2+1],Re,l,ae[de],0]]){let we=F*3;if(E[we]=Le,E[we+1]=Ie,E[we+2]=Ve,T[we]=Ge[0],T[we+1]=Ge[1],T[we+2]=0,s){let[$e,nt]=Mw(y,Le,Ie,Ne===0);w[F*2]=$e,w[F*2+1]=nt}else w[F*2]=pe,w[F*2+1]=C===0?0:(Ve-l)/C;A[F]=Ne,F++}_[j++]=Ae,_[j++]=Ae+1,_[j++]=Ae+2,_[j++]=Ae,_[j++]=Ae+2,_[j++]=Ae+3}}return xw(E,T,_),{positions:E,normals:T,uvs:w,indices:_,nearSide:A,vScale:C}}function UV(i){let{owner:t,shape:e,curveSegments:n,assembledAt:r,bevel:s,bevelSegments:o}=i,a=gte(e,n),l=t??`outline:${a}`,c=`${s}/${o}`,u=k2.get(l);if(u!==void 0&&u.outlineVersion===a&&u.capKey===c&&(i.stillServes?.(u)??!0))return DV.placements++,u.cap;let d=Ete(e,n,r,s,o);DV.assemblies++;try{let h=Tte(d,r);return k2.set(l,{outlineVersion:a,capKey:c,assembledAt:r,cap:h}),h}finally{d.free()}}function kV(i){k2.delete(i)}function Ete(i,t,e,n,r){let{points:s,ends:o}=FV(i,t);return Pv.assemble_cap(s,o,e,n,0,Math.max(1,Math.floor(r)),pte,40)}function VV(i,t,e,n,r){if(!(Pv===void 0||!(t>0)))return UV({owner:r,shape:i,curveSegments:n,assembledAt:2*t,bevel:t,bevelSegments:e})}function Tte(i,t){return vte(i.positions(),i.normals(),i.uvs(),i.indices(),t)}function th(i,t){return t*.5>i*(1+.001)}var Pv,pte,Aw,fte,yte,bte,xte,Ste,U2,k2,DV,zf,nh=B(()=>{q();dn();N2();_w();pte=.4;fte=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]);yte=new wt;bte=new te,xte=new te,Ste=new te().makeScale(1,1,-1);U2=2,k2=new Map,DV={assemblies:0,placements:0};zf=class extends Me{constructor(e,n,r=0,s=12,o=3,a,l,c=!1){super();this.type="ShapeGeometry";this._nearSide=new Uint8Array(0);this._effectiveBevel=0;this._vScale=0;if(Pv===void 0)throw new Error("bevel-wasm is not loaded");this._shape=e,this._uvPitch=l,this._legacy=c,this._depth=n,this._bevel=r,this._curveSegments=s,this._bevelSegments=o,this._ownerId=a,this.rebuild()}takeDepthStateFrom(e){let n=e;n._nearSide!==void 0&&(this._depth=n._depth??this._depth,this._nearSide=n._nearSide,this._vScale=n._vScale??this._vScale,this._effectiveBevel=n._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length>0&&th(this._effectiveBevel,e)&&th(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let n=e-this._depth;if(this._depth=e,n===0)return!0;let r=this.getAttribute("position");if(r===void 0)return!1;let s=r.array,o=this.getAttribute("uv"),a=o?.array,l=this._vScale>0?n/this._vScale:0,c=this._nearSide;for(let u=0;u<c.length;u++){let d=c[u];d!==0&&(s[u*3+2]+=n,d===U2&&a!==void 0&&(a[u*2+1]+=l))}return r.needsUpdate=!0,o!==void 0&&l!==0&&(o.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let n=this.boundingBox;n.min.z=Math.min(0,e),n.max.z=Math.max(0,e),this.boundingSphere!==null&&n.getBoundingSphere(this.boundingSphere)}setDepth(e){e!==this._depth&&(this._depth=e,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let e=UV({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:l=>th(l.cap.rise,this._depth)&&th(l.cap.rise,l.assembledAt)}),n=wte(this._shape,this._curveSegments,this._depth,e,this._uvPitch,this._legacy);this._nearSide=n.nearSide,this._vScale=n.vScale,this._effectiveBevel=e.rise;let r=this.getAttribute("position"),s=this.getAttribute("normal"),o=this.getAttribute("uv"),a=this.getIndex();if(r!==void 0&&s!==void 0&&o!==void 0&&a!==null&&r.array.length===n.positions.length&&s.array.length===n.normals.length&&o.array.length===n.uvs.length&&a.array.length===n.indices.length){r.array.set(n.positions),s.array.set(n.normals),o.array.set(n.uvs),a.array.set(n.indices),r.needsUpdate=!0,s.needsUpdate=!0,o.needsUpdate=!0,a.needsUpdate=!0;return}this.setAttribute("position",new Ue(n.positions,3)),this.setAttribute("normal",new Ue(n.normals,3)),this.setAttribute("uv",new Ue(n.uvs,2)),this.setIndex(new Ue(n.indices,1))}clone(){let e=new zf(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return e.userData=su(this.userData),e}}});var Ms,uc=B(()=>{"use strict";cc();OV();F2();nh();kf();Ms=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Nn.ODD},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),o=i.shape??t?.shape,a=o?.roundness??e.roundness,l;o!==void 0&&(o instanceof yn?(l=o,(l.width!==n||l.height!==r)&&l.applySize(n,r)):l=new yn(n,r).fromJSON(o),i.parameters?.roundness!==void 0&&i.parameters?.roundness>0&&l.update());let c=l??new yn(n,r);return{parameters:Object.assign(e,{width:n,height:r,depth:s,roundness:a}),shape:c,ownerId:i.ownerId??t?.ownerId}}static build(i){let{depth:t,extrudeBevelSize:e,extrudeBevelSegments:n,subdivisions:r,roundness:s,windingRule:o,uvPitch:a,extrusionVersion:l}=i.parameters,c=l===1;i.shape.roundness=s;let u;return t<=0?u=new Vf(i.shape,r,{windingRule:o}):e<=0?u=new eh(i.shape,t,r,o,a,c):NV()?u=new zf(i.shape,t,e,r,n,i.ownerId,a,c):(console.error("[extrude] engine not loaded \u2014 extruding without a bevel"),u=new eh(i.shape,t,r,o,a,c)),Object.assign(u,{userData:{...i,type:"VectorGeometry"}})}}});function Mte(i,t,e,n,r,s){if(n>=GV)return r>30||r%4===0?(Ate(i,t,e,s),Math.round(r/4)):zV(i,n,r,t,e,s);n=Math.max(n,.001);let o={x:0,y:e},a=n+Math.PI*.5,l={x:Math.cos(a)*t,y:Math.sin(a)*e},c=EV({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:t,ry:e,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?_te(i,o.x,o.y,c,r,t,e,s):zV(i,n,r,t,e,s)}function _te(i,t,e,n,r,s,o,a){let l=Math.round(r/n.length);i.addPoint(Gf(t,e));for(let c=0,u=n.length;c<u;c++){let d=n[c],h=i.points[c],p=Gf(d.x,d.y);h.controls[1].position.set(d.x1,d.y1),p.controls[0].position.set(d.x2,d.y2),i.addPoint(p)}return a>0?jV(i,s,o,a):i.addPoint(Gf(0,0)),l}function zV(i,t,e,n,r,s){let o=-t/e;for(let a=0;a<=e;a++){let l=o*a,c=Math.sin(l)*n,u=Math.cos(l)*r;i.addPoint(Gf(c,u))}return t<GV?s>0?jV(i,n,r,s):i.addPoint(Gf(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&HV(i,n,r,s)),1}function Ate(i,t,e,n=0,r=0,s=0){let o=.5522847498,a=t*o,l=e*o;i.addPoint(Cw(r-t,s,r-t,s-l,r-t,s+l)),i.addPoint(Cw(r,s+e,r-a,s+e,r+a,s+e)),i.addPoint(Cw(r+t,s,r+t,s+l,r+t,s-l)),i.addPoint(Cw(r,s-e,r+a,s-e,r-a,s-e)),n>0&&HV(i,t,e,n)}function Gf(i,t){return new ua(ge.generateUUID(),new G(i,t))}function Cw(i,t,e,n,r,s){let o=Gf(i,t);return o.controls[0].position.set(e,n),o.controls[1].position.set(r,s),o}function jV(i,t,e,n){WV(i,t,e,n).forEach(s=>i.addPoint(s))}function HV(i,t,e,n){let r=WV(i,t,e,n),s=new yn;r.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function WV(i,t,e,n){let r=n*t/100,s=r*(Math.abs(e)/Math.abs(t)),o=new G(r/t,s/e),a=i.points.map(l=>{let c=l.clone();return c.uuid=ge.generateUUID(),c}).reverse();return a.forEach(l=>{l.position.multiply(o);let c=l.controls[0].position.clone().multiply(o),u=l.controls[1].position.clone().multiply(o);l.controls[0].position.copy(u),l.controls[1].position.copy(c)}),a}var GV,jf,Rv=B(()=>{"use strict";cc();R2();TV();uc();q();GV=Math.PI*2,jf=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=ge.clamp(e.angle,0,360),{shape:i.shape&&i.shape instanceof yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:n,angle:r,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,extrusionVersion:c}=i.parameters,u=i.shape,d=t*.5,h=e*.5,p=Mte(u,d,h,r*Math.PI/180,n,s);u.isClosed=!0,u.update();let f;return r===0?(f=new Me,f.setAttribute("position",new Be([],3))):f=Ms.create({shape:u,parameters:{subdivisions:p,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,extrusionVersion:c}}),Object.assign(f,{userData:{...i,type:"EllipseGeometry"}})}}});var qV,Iv,V2=B(()=>{"use strict";q();E2();qV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,detail:r,corner:s,cornerSides:o}=i.parameters,a=r===0&&s!==0?new Iv(t*.5,s,o):new vd(t*.5,r),l=e/t,c=n/t;return(l!==1||c!==1)&&a.scale(1,l,c),Object.assign(a,{userData:{...i,type:"IcosahedronGeometry"}})}},Iv=class extends Su{constructor(t=1,e=.2,n=4){let r=(1+Math.sqrt(5))/2,s=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a="IcosahedronGeometry";super(s,o,a,t,e,n),this.type=a}static fromJSON(t){return new Iv(t.radius,t.corner,t.cornerSides)}}});var XV,z2=B(()=>{"use strict";q();XV=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 Oa;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 bd(r.extractPoints(n).shape,e);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...i,type:"LatheGeometry"}})}}});function Hf(i,t){return Math.abs(t-i)/2+Math.min(i,t)}function Cte(i){let t=i.getAttribute("position");if(t===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let e=i.getAttribute("uv"),n=i.getIndex(),r=t.count,s=new Map,o=new Uint32Array(r),a=[],l=0;for(let m=0;m<r;m++){let g=t.getX(m),y=t.getY(m),v=t.getZ(m),b=Math.round(g*G2),x=Math.round(y*G2),S=Math.round(v*G2),E=s.get(b);E===void 0&&(E=new Map,s.set(b,E));let T=E.get(x);T===void 0&&(T=new Map,E.set(x,T));let w=T.get(S);w===void 0&&(w=l++,T.set(S,w),a.push(g,y,v)),o[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=o[y],S=o[v],E=o[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(a),faces:Uint32Array.from(c),materialIndices:u,uvs:d===null?null:Float64Array.from(d)}}function Pte(i){let{positions:t,faces:e,materialIndices:n,uvs:r}=i,s=t.length/3,o=e.length/3,a=r!==null&&o>0,l=o*3,c=new Uint32Array(l),u=new Uint32Array(l),d=new Uint32Array(l),h=new Uint32Array(l),p=new Uint32Array(l),f=0,m=8;for(;m<l*2;)m*=2;let g=m-1,y=new Int32Array(m).fill(-1),v=(O,L)=>{let F=(Math.imul(O,2654435761)^L)&g;for(;;){let j=y[F];if(j===-1)return y[F]=f,c[f]=O,u[f]=L,f++;if(c[j]===O&&u[j]===L)return j;F=F+1&g}},b=(O,L)=>{let F=O<L?O:L,j=O<L?L:O,W=(Math.imul(F,2654435761)^j)&g;for(;;){let K=y[W];if(c[K]===F&&u[K]===j)return K;W=W+1&g}},x=new Uint32Array(s),S=new Float64Array(s*3),E=(O,L,F)=>{let j=O<L?v(O,L):v(L,O),W=++d[j];W===1?h[j]=F:W===2&&(p[j]=F),x[O]++,x[L]++,S[O*3]+=t[L*3],S[O*3+1]+=t[L*3+1],S[O*3+2]+=t[L*3+2],S[L*3]+=t[O*3],S[L*3+1]+=t[O*3+1],S[L*3+2]+=t[O*3+2]};for(let O=0;O<o;O++){let L=e[O*3],F=e[O*3+1],j=e[O*3+2];E(L,F,j),E(F,j,L),E(j,L,F)}let T=new Float64Array(f*3);for(let O=0;O<f;O++){let L=c[O]*3,F=u[O]*3;if(d[O]===2){let K=h[O]*3,Y=p[O]*3;T[O*3]=(t[L]+t[F])*.375+(t[K]+t[Y])*.125,T[O*3+1]=(t[L+1]+t[F+1])*.375+(t[K+1]+t[Y+1])*.125,T[O*3+2]=(t[L+2]+t[F+2])*.375+(t[K+2]+t[Y+2])*.125}else T[O*3]=(t[L]+t[F])*.5,T[O*3+1]=(t[L+1]+t[F+1])*.5,T[O*3+2]=(t[L+2]+t[F+2])*.5}let w=new Float64Array(s*3),_;for(let O=0;O<s;O++){let L=x[O];L===3?_=3/16:L>3&&(_=3/(8*L));let F=1-L*Number(_),j=Number(_);L===2&&(F=3/4,j=1/8),w[O*3]=t[O*3]*F+S[O*3]*j,w[O*3+1]=t[O*3+1]*F+S[O*3+1]*j,w[O*3+2]=t[O*3+2]*F+S[O*3+2]*j}let A=new Float64Array((s+f)*3);A.set(w),A.set(T,s*3);let C=new Uint32Array(o*12),R=new Array(o*4),D=a?new Float64Array(o*24):null;for(let O=0;O<o;O++){let L=e[O*3],F=e[O*3+1],j=e[O*3+2],W=b(L,F)+s,K=b(F,j)+s,Y=b(j,L)+s,$=O*12;C[$++]=W,C[$++]=K,C[$++]=Y,C[$++]=L,C[$++]=W,C[$++]=Y,C[$++]=F,C[$++]=K,C[$++]=W,C[$++]=j,C[$++]=Y,C[$++]=K;let ee=n[O];if(R[O*4]=ee,R[O*4+1]=ee,R[O*4+2]=ee,R[O*4+3]=ee,D!==null){let oe=O*6,ae=r[oe],de=r[oe+1],be=r[oe+2],Re=r[oe+3],me=r[oe+4],Ae=r[oe+5],Le=Hf(ae,be),Ie=Hf(de,Re),Ge=Hf(be,me),Ve=Hf(Re,Ae),pe=Hf(ae,me),Ne=Hf(de,Ae),we=O*24;D[we++]=Le,D[we++]=Ie,D[we++]=Ge,D[we++]=Ve,D[we++]=pe,D[we++]=Ne,D[we++]=ae,D[we++]=de,D[we++]=Le,D[we++]=Ie,D[we++]=pe,D[we++]=Ne,D[we++]=be,D[we++]=Re,D[we++]=Ge,D[we++]=Ve,D[we++]=Le,D[we++]=Ie,D[we++]=me,D[we++]=Ae,D[we++]=pe,D[we++]=Ne,D[we++]=Ge,D[we++]=Ve}}return{positions:A,faces:C,materialIndices:R,uvs:D}}function Rte(i,t){let{positions:e,faces:n,materialIndices:r,uvs:s}=i,o=e.length/3,a=n.length/3,l=new Float64Array(o*3);for(let f=0;f<a;f++){let 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],T=e[m+2]-e[g+2],w=b*T-x*E,_=x*S-v*T,A=v*E-b*S;l[m]+=w,l[m+1]+=_,l[m+2]+=A,l[g]+=w,l[g+1]+=_,l[g+2]+=A,l[y]+=w,l[y+1]+=_,l[y+2]+=A}for(let f=0;f<o;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=a*3,u=new Float32Array(c*3),d=new Float32Array(c*3),h=s!==null&&s.length>0?new Float32Array(c*2):null;for(let f=0;f<c;f++){let 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 Me;p.setAttribute("position",new Ue(u,3)),c>0&&(p.setAttribute("normal",new Ue(d,3)),p.setAttribute("color",new Ue(new Float32Array(c*3).fill(1),3))),h!==null&&p.setAttribute("uv",new Ue(h,2));for(let f=0;f<a;){let m=r[f],g=f;do f++;while(f<a&&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 G2,Pw,YV=B(()=>{"use strict";q();G2=1e4;Pw=class{constructor(t=1){this.subdivisions=t}modify(t){let e=Cte(t),n=this.subdivisions;for(;n-- >0;)e=Pte(e);return Rte(e,t)}}});function Ite(i){let t=new Nt,e=i.attributes.position;return e?(t.setFromBufferAttribute(e),t):(t.makeEmpty(),t)}var gi,$V,j2=B(()=>{"use strict";q();YV();gi=new M,$V=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=i.geometry??t?.geometry??new Me().copy(new ni(100,100,100)),n;t===void 0?(e.computeBoundingBox(),e.boundingBox.getSize(gi),n={width:gi.x,height:gi.y,depth:gi.z,subdivisions:0}):n=t.parameters;let r={...n,...i.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:e}}static build(i){let{width:t,height:e,depth:n,subdivisions:r}=i.parameters,s=i.geometry??new Me().copy(new ni(100,100,100)),o=s.userData.parameters;o===void 0?(s.boundingBox=Ite(s),s.boundingBox.getSize(gi)):gi.set(o.width,o.height,o.depth),(t!==gi.x||e!==gi.y||n!==gi.z)&&s.scale(gi.x===0?1:t/gi.x,gi.y===0?1:e/gi.y,gi.z===0?1:n/gi.z);let a=s.originalGeometry;try{r>0?(a===void 0||o?.subdivisions!==r)&&(a===void 0&&(a=s),s=new Pw(r).modify(a)):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return a!==void 0&&Object.assign(s,{originalGeometry:a}),delete i.geometry,Object.assign(s,{userData:{...i,type:"NonParametricGeometry"}})}static loadFromUrl(i,t,e){new Ed(e).load(i,r=>{let s=this.normalizeInputs({geometry:r});r.boundingBox.getSize(gi);let o=100/gi.x;Object.assign(s.parameters,{width:100,height:gi.y*o,depth:gi.z*o}),t(this.build(s))})}}});var Rw,Iw=B(()=>{"use strict";cc();uc();Rw=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 yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a,extrusionVersion:l}=i.parameters,c=i.shape,u=t*.5,d=e*.5,h=0,p=0,f=2*Math.PI/n;for(let g=0;g<n;g++){let y=f*g,v=h+Math.sin(y)*u,b=p+Math.cos(y)*d;c.addPoint(c.createPoint(v,b))}c.isClosed=!0;for(let g=0,y=c.points.length;g<y;g++)c.points[g].roundness=r;c.roundness=r,c.update();let m=Ms.create({shape:c,parameters:{roundness:r,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(m,{userData:{...i,type:"PolygonGeometry"}})}}});function Ov(i,t,e){e.x=i.x*t.x,e.y=i.y,e.z=i.x*t.y}function H2(i,t,e,n,r,s){let o=Ote.copy(t).sub(i),a=Dte.copy(e).sub(i),l=o.angleTo(a);if(o.normalize(),a.normalize(),n===r){let c=o.add(a).normalize();s.copy(i).addScaledVector(c,n/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(i),s.addScaledVector(o,r/Math.sin(c)),s.addScaledVector(a,n/Math.sin(c))}}function Lte(i,t,e){let n=i.clone().sub(t),r=e.clone().sub(t);return n.projectOnVector(r),n.add(t)}var KV,Ote,Dte,W2,q2=B(()=>{"use strict";q();KV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,radialSegments:r,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=new W2(t*.5,e,r,s,o,a,l),u=n/t;return u!==1&&c.scale(1,1,u),Object.assign(c,{userData:{...i,type:"PyramidGeometry"}})}};Ote=new M,Dte=new M;W2=class extends Me{constructor(t=.5,e=1,n=4,r=1,s=!1,o=0,a=4){super(),n=Math.floor(Math.max(3,n)),r=Math.floor(r),a=Math.floor(a);let l=[],c=[],u=[],d=[],h=0,p=e/2,f=Math.PI/n,m=t*Math.cos(Math.PI/n),g=2*Math.PI/n,y=(n-2)*Math.PI/n,v=Math.PI-y,b=new M(0,-p,0),x=new M(0,p,0),S=new G(t,-p),E=new G(m,-p),T=new G(0,x.y).sub(E),w=new G(0,x.y).sub(S),_=new G(T.y,-T.x).normalize(),A=new G(w.y,-w.x).normalize(),R=t*Math.cos(Math.PI/n)*Math.tan((Math.PI-T.angle())/2)-1e-8;o=Math.min(o,R);let D;{let Y=new M(_.x,_.y,0),$=new M(Math.cos(g)*Y.x,Y.y,Math.sin(g)*Y.x);D=Y.angleTo($)}let O=o/Math.tan((Math.PI-T.angle())/2),L=o/Math.tan((Math.PI-D)/2),F=new M;if(!s){c.push(b.x,b.y,b.z),u.push(0,-1,0),d.push(0,0);let Y=h++,$=[],ee=S.clone(),oe=O/Math.cos(Math.PI/n);ee.x-=oe;for(let ae=0;ae<n;ae++){let de=ae/n*Math.PI*2+f,be=new G(Math.sin(de),Math.cos(de));Ov(ee,be,F),c.push(F.x,F.y,F.z),u.push(0,-1,0),d.push(0,0),$.push(h++)}for(let ae=0;ae<$.length;ae++)l.push($[ae],Y,$[(ae+1)%$.length])}let j=[];{let Y=new M,$=new M,ee=new M,oe=new M,ae=new M,de=new M;for(let be=0;be<n;be++){let Re=be/n*Math.PI*2+f,me=(be+.5)/n*Math.PI*2+f,Ae=(be+1)/n*Math.PI*2+f,Le=new G(Math.sin(Re),Math.cos(Re)),Ie=new G(Math.sin(me),Math.cos(me)),Ge=new G(Math.sin(Ae),Math.cos(Ae));Ov(S,Le,$),Ov(S,Ge,ee),Ov(_,Ie,Y),H2(x,$,ee,L,L,oe),c.push(oe.x,oe.y,oe.z),H2($,x,ee,L,O,ae),c.push(ae.x,ae.y,ae.z),H2(ee,$,x,O,L,de),c.push(de.x,de.y,de.z),u.push(Y.x,Y.y,Y.z),u.push(Y.x,Y.y,Y.z),u.push(Y.x,Y.y,Y.z),d.push(0,0),d.push(0,0),d.push(0,0);let Ve=h++,pe=h++,Ne=h++;if(l.push(Ve,pe,Ne),o>0){{let nt=$.clone().add(ee).multiplyScalar(.5),Ce=x.clone().sub(nt).normalize(),V=b.clone().sub(nt).normalize().add(Ce).normalize().multiplyScalar(-1),_e=de.clone().sub(ae);W(nt,_e,V,T.angle())}let we,$e;{let nt=new M;Ov(A,Ge,nt);let Ce=de.clone().add(oe).multiplyScalar(.5);Ce=Lte(Ce,ee,x);let je=de.clone().sub(oe);[we,$e]=W(Ce,je,nt,D,oe.y)}{let nt=we,Ce=nt.clone().setY(0).normalize(),je=new M(0,-1,0),V=Ce.clone().cross(je);K(nt,Ce,je,V)}j.concat($e);{let nt=T.angle(),Ce=Math.PI-nt,je=x.clone();je.y-=o/Math.sin(nt-Math.PI/2);let V=new M,_e=[];for(let ct=0;ct<a;ct++){let lt=[],z=Math.PI/2-Ce*ct/a,I=Math.cos(z),Z=Math.sin(z),re=me;for(let he=0;he<=ct;he++){let ye=Math.cos(re),Oe=Math.sin(re);Y.x=I*Oe,Y.y=Z,Y.z=I*ye,V.copy(je).addScaledVector(Y,o),c.push(V.x,V.y,V.z),u.push(Y.x,Y.y,Y.z),d.push(0,0),lt.push(h++),re+=Math.PI*2/ct/n}_e.push(lt)}$e.reverse(),_e.push($e);let X=_e.length-1;for(let ct=0;ct<X;ct++){let lt=_e[ct],z=_e[ct+1],I=lt.length-1;l.push(z[1],lt[0],z[0]);for(let Z=1;Z<=I;Z++)l.push(lt[Z],lt[Z-1],z[Z]),l.push(z[Z+1],lt[Z],z[Z])}}}}}this.setIndex(l),this.setAttribute("position",new Be(c,3)),this.setAttribute("normal",new Be(u,3)),this.setAttribute("uv",new Be(d,2));function W(Y,$,ee,oe,ae){let de=-oe/2,be=(Math.PI-oe)/2,Re=$.clone().normalize().cross(ee);Y.addScaledVector(ee,-o/Math.sin(be));let me=new M,Ae=new M,Le=1,Ie=h,Ge=[];for(let Ve=0;Ve<=a;Ve++){let pe=de+Ve/a*oe;Ae.set(0,0,0),Ae.addScaledVector(Re,Math.sin(pe)),Ae.addScaledVector(ee,Math.cos(pe));for(let Ne=0;Ne<=Le;Ne++){let we=Ne/Le-.5;if(me.copy(Y),me.addScaledVector($,we),me.addScaledVector(Ae,o),ae!=null){let $e=Math.max(0,me.y-ae);me.addScaledVector($,-$e/$.y)}c.push(me.x,me.y,me.z),u.push(Ae.x,Ae.y,Ae.z),d.push(0,0),Ne===0&&Ge.push(h),h++}}for(let Ve=0;Ve<a;Ve++)for(let pe=0;pe<Le;pe++){let Ne=Ie+pe+(Le+1)*Ve,we=Ne+(Le+1),$e=we+1,nt=Ne+1;l.push(Ne,we,nt),l.push(we,$e,nt)}return[Y.clone().addScaledVector($,.5),Ge]}function K(Y,$,ee,oe){let ae=Math.PI/2,de=w.angle()-ae,be=[],Re=new M,me=new M;for(let Le=0;Le<=a;Le++){let Ie=[],Ge=Le/a;for(let Ve=0;Ve<=Le;Ve++){let Ne=((Le?Ve/Le:0)-.5)*v,we=Math.cos(Ne),$e=Math.sin(Ne),nt=Math.atan(Math.tan(de)*we),Ce=(ae+nt)*Ge,je=Math.cos(Ce),V=Math.sin(Ce);Re.set(0,0,0),Re.addScaledVector($,V*we),Re.addScaledVector(ee,je),Re.addScaledVector(oe,V*$e),me.copy(Y).addScaledVector(Re,o),c.push(me.x,me.y,me.z),u.push(Re.x,Re.y,Re.z),d.push(0,0),Ie.push(h++)}be.push(Ie)}let Ae=be.length-1;for(let Le=0;Le<Ae;Le++){let Ie=be[Le],Ge=be[Le+1],Ve=Ie.length-1;l.push(Ie[0],Ge[1],Ge[0]);for(let pe=1;pe<=Ve;pe++)l.push(Ie[pe-1],Ie[pe],Ge[pe]),l.push(Ie[pe],Ge[pe+1],Ge[pe])}}}}});var Wf,Dv=B(()=>{"use strict";cc();uc();Wf=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 yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)}),ui:n}}static build(i){let t=i.shape,{width:e,height:n,cornerRadius:r,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,extrusionVersion:c}=i.parameters,u={x:e*.5,y:n*.5},d={x:-u.x,y:-u.y},h={x:u.x,y:u.y};function p(S,E,T){return E>e&&T>n?Math.min(S*e/E,S*n/T):E>e?S*e/E:T>n?S*n/T:S}let f=[];f[0]=r[0]===0?0:p(r[0],r[0]+r[3],r[0]+r[1]),f[1]=r[1]===0?0:p(r[1],r[1]+r[2],r[1]+r[0]),f[2]=r[2]===0?0:p(r[2],r[2]+r[1],r[2]+r[3]),f[3]=r[3]===0?0:p(r[3],r[3]+r[0],r[3]+r[2]);let m=d.x,g=h.x,y=h.y,v=d.y;t.addPoint(t.createPoint(m,y)),t.addPoint(t.createPoint(g,y)),t.addPoint(t.createPoint(g,v)),t.addPoint(t.createPoint(m,v)),t.isClosed=!0;let b=!0;for(let S=0,E=t.points.length;S<E;S++)t.points[S].roundness=f[S],S>0&&f[S]!==f[S-1]&&(b=!1);b&&(t.roundness=f[0]),t.useCubicForRoundedCorners=s!==1,t.update();let x=Ms.create({shape:t,parameters:{depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,extrusionVersion:c}});return Object.assign(x,{userData:{...i,type:"RectangleGeometry"}})}}});var ZV,X2=B(()=>{"use strict";q();ZV=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=ge.clamp(e.thetaLength,0,180),{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t=100,height:e=t,depth:n=t,widthSegments:r=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,u;return c===0?(u=new Me,u.setAttribute("position",new Be([],3))):u=new os(.5*t,r,s,o,a,l,c*ge.DEG2RAD),u.scale(1,e/t,n/t),Object.assign(u,{userData:{...i,type:"SphereGeometry"}})}}});var QV,Y2=B(()=>{"use strict";q();QV=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 di(t,e,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...i,type:"PlaneGeometry"}})}}});var JV,$2,K2=B(()=>{"use strict";q();JV=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width)})}}static build(i){let{width:t,height:e,depth:n,angle:r,cornerRadius:s,cornerSegments:o}=i.parameters,a=new $2(t,e,n,r,s,o);return Object.assign(a,{userData:{...i,type:"BackdropGeometry"}})}},$2=class extends Me{constructor(t=1,e=1,n=1,r=90,s=10,o=24){super(),this.type="BackdropGeometry";let a=[],l=[],c=[],u=.001;s==0&&(o=1),o=Math.max(1,Math.floor(o)),s=Math.min(s,100),r=Math.min(180-u,r),r*=Math.PI/180;let d=[],h=Math.PI/2,p=(me=0,Ae=0,Le=0)=>new M(me,Ae,Le),f=p(),m=p(),[g,y,v]=[e/2,t/2,n/2],b=-y,x=+y,[S,E,T]=[p(b,-g,+v),p(b,-g,-v),p(b,+g,-v)],w=(me,Ae=!1)=>Math.sin(me-Math.PI/(1+ +Ae)),_=(me,Ae=!1)=>Math.cos(me-Math.PI/(1+ +Ae));T.y=Math.sin(r)*e-g;let A=Math.cos(r)*e-v,C=S.z-u;r<=h?(T.z=Math.min(A,C),T.z==C&&(T.y-=(A-C)/Math.tan(h-r))):E.z=Math.min(E.z-A-v,S.z-u),f.subVectors(S,E),m.subVectors(T,E);let R=Math.min(f.length(),m.length())*s/100,D=R*Math.tan(r/2),O=R/Math.cos(r/2),L=f.clone().normalize().add(m.normalize()).setLength(O).add(E);f.set(0,w(r,!0),_(r,!0)),d.push([T,f.clone()]);let F=(Math.PI-r)/o;for(let me=0;me<=o;me++){let Ae=h+r+me*F;f.set(0,Math.sin(Ae)*D,Math.cos(Ae)*D),f.add(L),m.set(0,w(Ae),_(Ae)),d.push([f.clone(),m.clone()])}d.push([S,p(0,1,0)]);let j=Math.sin(F/2)*D*2,W=d.length-1,K=d[0][0].distanceTo(d[1][0]),Y=d[W-1][0].distanceTo(d[W][0]),$=K+j*o+Y;d[0].push(1);for(let me=0;me<=o;me++)d[me+1].push(1-(K+me*j)/$);d[W].push(0);let[ee,oe,ae]=d[0],de,be,Re;for(let me=1;me<d.length;me++)[de,be,Re]=d[me],a.push(b,ee.y,ee.z,b,de.y,de.z,x,ee.y,ee.z,x,ee.y,ee.z,b,de.y,de.z,x,de.y,de.z),l.push(0,oe.y,oe.z,0,be.y,be.z,0,oe.y,oe.z,0,oe.y,oe.z,0,be.y,be.z,0,be.y,be.z),c.push(0,ae,0,Re,1,ae,1,ae,0,Re,1,Re),[ee,oe,ae]=[de,be,Re];this.setAttribute("position",new Be(a,3)),this.setAttribute("normal",new Be(l,3)),this.setAttribute("uv",new Be(c,2))}}});var Ow,Dw=B(()=>{"use strict";cc();uc();Ow=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 yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t,height:e,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:u}=i.parameters,d=i.shape,h=t*.5,p=e*.5,f=0,m=0,g=o*Math.PI/360/r,y=Math.PI/2*3*-1,v=h*n/100,b=p*n/100;if(r===3&&n===50){g=2*Math.PI/r;for(let S=0;S<r;S++){let E=g*S,T=f+Math.sin(E)*h,w=m+Math.cos(E)*p;d.addPoint(d.createPoint(T,w))}}else for(let S=0;S<r;S++){let E=f+Math.cos(y)*h,T=m+Math.sin(y)*p;d.addPoint(d.createPoint(E,T)),y+=g,E=f+Math.cos(y)*v,T=m+Math.sin(y)*b,d.addPoint(d.createPoint(E,T)),y+=g}d.isClosed=!0;for(let S=0,E=d.points.length;S<E;S++)d.points[S].roundness=s;d.roundness=s,d.update();let x=Ms.create({shape:d,parameters:{roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:u}});return Object.assign(x,{userData:{...i,type:"StarGeometry"}})}}});var ez,Z2=B(()=>{"use strict";q();ez=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 di(t,e);return Object.assign(n,{userData:{...i,type:"TextFrameGeometry"}})}}});function Nte(i,t,e,n,r,s,o,a,l,c,u){[t,e]=[e,t],o=t/2;let d=ge.clamp(r/360,0,1);if(d===0){let h=new Me;return h.setAttribute("position",new Be([],3)),h}return d===1&&(c=0),new yv(!0,i,t,e,n,d,s,o,a,l,c,u)}var tz,Q2=B(()=>{"use strict";q();Of();tz=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width);e.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(e.depth??e.width*.25));return{parameters:Object.assign(e,{width:n,height:r,depth:s})}}static build(i){let{width:t,height:e,depth:n,radialSegments:r,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=Nte(t,e,n,t*.5,o,s,0,0,r,a,l);return c.scale(1,e/t,1),Object.assign(c,{userData:{...i,type:"TorusGeometry"}})}}});var nz,J2=B(()=>{"use strict";q();nz=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width),depth:Math.abs(e.depth??e.width),tube:e.tube??e.width*.125})}}static build(i){let{width:t,tube:e,tubularSegments:n,radialSegments:r,p:s,q:o}=i.parameters,a=t*.5;a!==e&&(a-=e);let l=new xd(a,e,n,r,s,o);return Object.assign(l,{userData:{...i,type:"TorusKnotGeometry"}})}}});var rz,eR=B(()=>{"use strict";cc();uc();rz=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 yn?i.shape:new yn,parameters:Object.assign(e,{width:Math.abs(e.width),height:Math.abs(e.height??e.width*(e.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(e.depth??0)})}}static build(i){let{width:t=100,height:e,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a,extrusionVersion:l}=i.parameters,c=i.shape,u=t*.5,d=e*.5;a?(c.addPoint(c.createPoint(-u,d)),c.addPoint(c.createPoint(u,-d)),c.addPoint(c.createPoint(-u,-d))):(c.addPoint(c.createPoint(0,d)),c.addPoint(c.createPoint(u,-d)),c.addPoint(c.createPoint(-u,-d))),c.isClosed=!0;for(let p=0,f=c.points.length;p<f;p++)c.points[p].roundness=n;c.roundness=n,c.update();let h=Ms.create({shape:c,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:o,extrusionVersion:l}});return Object.assign(h,{userData:{...i,type:"TriangleGeometry"}})}}});var iz=B(()=>{"use strict"});var uMe,dMe,hMe,pMe,fMe,mMe,gMe,sz=B(()=>{"use strict";q();uMe=new nr,dMe=new te,hMe=new Hi,pMe=new M,fMe=new M,mMe=new M,gMe=new M});function oz(){let i=new Me;return i.setAttribute("position",new Ue(new Float32Array([]),3)),i.setIndex(new Ue(new Uint16Array([]),1)),i}function zte(i,t,e,n){let r=typeof i.width=="string"?Number(n.getVariable(i.width)):i.width,s=[""],o="";for(let a of e)o+=a,a===" "||a===`
4142
4142
  `?(s[s.length-1]+=o,o="",a===`
4143
- `&&s.push("")):t.getTextWidth(s[s.length-1]+o,i)>r&&(s[s.length-1].length&&s.push(""),t.getTextWidth(s[s.length-1]+o,i)>r&&(o.length===1?(s[s.length-1]+=o,o=""):(s[s.length-1]+=o.slice(0,-1),o=o[o.length-1],s.push(""))));return s[s.length-1]+=o,s}var Ute,kte,Vte,qf,tR=B(()=>{"use strict";qr();pt();kf();q();xf();cc();uc();nh();Ute=oz().attributes,kte=12,Vte=1,qf=class extends Me{constructor(e,n){super();this.isTextGeometry=!0;this.charWidths=[];this.charCoords=[];this.wrappedText=[];this.isLowResolution=!1;this.vectorShapes=[];this._nearSide=new Uint8Array(0);this._depth=0;this._effectiveBevel=0;this._vScale=0;Object.assign(this.attributes,Ute),this.userData={parameters:e,type:"TextGeometry"};let r=n.getFont(e.font);r?.isLoaded?(this.font=r,this.update(e,n)):this.updateFont(e.font,n).then(()=>{this.update(e,n),n?.requestRender()})}async updateFont(e,n){let r=n.getFont(e);r&&(this.font=r,await r.loadingPromise)}update(e,n){let r=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!r?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:s,height:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,text:u,textTransform:d,fontSize:h,extrusionVersion:p}=e,f=Tr.getDisplayedValue(u),m=d===2?f.toUpperCase():d===3?f.toLowerCase():f,g=zte(e,r,m,n),{shapes:y,charWidths:v,charCoords:b}=r.generateShapes(g,e,n),x=(typeof s=="number"?s:Number(n.getVariable(s)))*.5,S=(typeof o=="number"?o:Number(n.getVariable(o)))*.5,E=y.map(_=>new yn().fromShape(_,!0));this.vectorShapes=E;let T=E.map(_=>Ms.create({shape:_,parameters:{depth:a,extrudeBevelSegments:c,extrudeBevelSize:l,uvPitch:p===1?void 0:h,extrusionVersion:p,windingRule:a<=0?Nn.NONZERO:Nn.ODD,subdivisions:this.isLowResolution&&a>0?Vte:kte}})),w=T.length?oa(T):oz();w.translate(-x,S,0),this.dispose(),this.wrappedText=g,this.charCoords=b,this.charWidths=v,this.deleteAttribute("extrudeNormal"),Object.entries(w.attributes).forEach(([_,A])=>{this.setAttribute(_,A)}),this.setIndex(w.index),this.adoptNearSide(T,a),this.computeBoundingSphere()}adoptNearSide(e,n){this._depth=n;let r=0,s=0,o=0;for(let c of e){let u=c,d=u._nearSide;if(d===void 0||d.length===0){this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0;return}r+=d.length,s=Math.max(s,u._effectiveBevel??0),o=u._vScale??o}this._effectiveBevel=s,this._vScale=o;let a=new Uint8Array(r),l=0;for(let c of e){let u=c._nearSide;a.set(u,l),l+=u.length}this._nearSide=a}takeDepthStateFrom(e){let n=e;n._nearSide!==void 0&&(this._depth=n._depth??this._depth,this._nearSide=n._nearSide,this._vScale=n._vScale??this._vScale,this._effectiveBevel=n._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length!==this.getAttribute("position")?.count?!1:th(this._effectiveBevel,e)&&th(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let n=e-this._depth;if(this._depth=e,n===0)return!0;let r=this.getAttribute("position"),s=r.array,o=this.getAttribute("uv"),a=o?.array,l=this._vScale>0?n/this._vScale:0,c=this._nearSide;for(let u=0;u<c.length;u++){let d=c[u];d!==0&&(s[u*3+2]+=n,d===2&&a!==void 0&&(a[u*2+1]+=l))}return r.needsUpdate=!0,o!==void 0&&l!==0&&(o.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let n=this.boundingBox;n.min.z=Math.min(0,e),n.max.z=Math.max(0,e),this.boundingSphere!==null&&n.getBoundingSphere(this.boundingSphere)}clone(){let e=Wr(new Me,qf.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 cz(i){if(az)return;if(Lw)return Lw;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.77/build"),s=import("./process.js"),[o,a]=await Promise.all([s,fetch(`${n}/process.wasm`).then(u=>u.arrayBuffer())]),l=o.default,c=await l({wasmBinary:a});lz(c),az=!0}return Lw=t(),Lw}var lz,Nw,az,Lw,Lv=B(()=>{Nw=new Promise(i=>{lz=i}),az=!1});function Bw(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 l of n){let c=i.attributes[l],u=t.attributes[l];if(c===void 0||c.isInterleavedBufferAttribute===!0||u.isInterleavedBufferAttribute===!0||c.itemSize!==u.itemSize||c.normalized!==u.normalized||c.array.constructor!==u.array.constructor||c.array.length!==u.array.length)return!1}let r=i.index,s=t.index;if(r===null!=(s===null))return!1;let o=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let l=r.array.constructor,c=s.array.constructor;if(l!==c){if(l!==Uint32Array||c!==Uint16Array)return!1;o=!0}}if(i.groups.length!==t.groups.length)return!1;for(let l=0;l<t.groups.length;l++){let c=i.groups[l],u=t.groups[l];if(c.start!==u.start||c.count!==u.count||c.materialIndex!==u.materialIndex)return!1}for(let l of n){let c=i.attributes[l],u=t.attributes[l];c.array.set(u.array),c.needsUpdate=!0}let a=i.takeDepthStateFrom;if(typeof a=="function"&&a.call(i,t),r!==null&&s!==null){if(o){let l=r.array,c=s.array;for(let u=0,d=c.length;u<d;u++){let h=c[u];l[u]=h===65535?4294967295:h}}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 Nv(i,t,e,n){let r=i.position.array,s=i.normal.array,o=Gte.makeScale(t,e,n).invert().elements,a,l,c;for(let u=0,d=r.length;u<d;u+=3)r[u]*=t,r[u+1]*=e,r[u+2]*=n,a=s[u],l=s[u+1],c=s[u+2],s[u]=o[0]*a+o[4]*l+o[8]*c,s[u+1]=o[1]*a+o[5]*l+o[9]*c,s[u+2]=o[2]*a+o[6]*l+o[10]*c;i.position.needsUpdate=!0,i.normal.needsUpdate=!0}var Gte,nR=B(()=>{"use strict";q();Gte=new te});function aR(i){let t=Number(i);return Number.isInteger(t)&&t>=0&&String(t)===i?t:-1}function jte(i){let t=Object.keys(i),e=0;for(let r of t){let s=aR(r);s>=e&&(e=s+1)}if(e===0||e>t.length)return;let n=new Array(e);for(let r=0;r<e;r++){let s=i[r];if(typeof s!="number")return;n[r]=s}return n}function Uw(i){if(i!=null){if(Array.isArray(i)||ArrayBuffer.isView(i)&&!(i instanceof DataView))return i;if(typeof i=="object")return jte(i)}}function rR(i){if(i==null)return"missing";if(Array.isArray(i))return`Array(${i.length})`;if(ArrayBuffer.isView(i)){let l=i;return`${i.constructor.name}(${l.length})`}if(typeof i!="object")return typeof i;let t=Object.keys(i),e=t.filter(l=>aR(l)===-1),n=0;for(let l of t){let c=aR(l);c>=n&&(n=c+1)}let r=i,s=-1,o=-1;for(let l=0;l<n;l++)l in r?typeof r[l]!="number"&&o===-1&&(o=l):s===-1&&(s=l);let a=[`${t.length} keys`,`max index ${n-1}`];return s!==-1&&a.push(`first missing index ${s}`),o!==-1&&a.push(`non-number at ${o} (${typeof r[o]})`),e.length&&a.push(`stray keys ${e.slice(0,3).join(",")}`),`Object{${a.join(", ")}}`}function Vw(i){let t=Object.keys(i);return t.length===1&&t[0]==="subdivisions"}function Bv(i,t){let e=t?t.count:i.count,n=0,r=1e4,s=new Map,o=new Uint32Array(e),a=[];for(let u=0;u<e;u++){let d=t?t.getX(u):u,h=i.getX(d),p=i.getY(d),f=i.getZ(d),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),a.push(h,p,f)),o[u]=x}let l=[],c=[];for(let u=0;u<o.length;u+=3)o[u]===o[u+1]||o[u]===o[u+2]||o[u+1]===o[u+2]||(l.push(o[u],o[u+1],o[u+2]),c.push(t?t.getX(u):u,t?t.getX(u+1):u+1,t?t.getX(u+2):u+2));return{positions:a,triIndices:l,triOriginals:c}}function Hte(i,t,e,n,r){let s=[],o=[],a=r?e.getAttribute("uv"):void 0,l=a&&a.itemSize===2?[]:void 0,c=h=>{if(l){let p=r[h];l.push(a.getX(p),a.getY(p))}};if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let h=e.userData.shape.extractShapePointsToFlatArray([]),p=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&p<=24&&p%4===0&&e.userData.parameters.angle>=360){let 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 o.push(m),{indices:s,verticesPerFace:o}}let u=new Float32Array([e.userData.parameters.depth])[0],d=0;for(;d<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let h=0;if((i[t[d]*3+2]===u||i[t[d]*3+2]===0)&&h++,(i[t[d+1]*3+2]===u||i[t[d+1]*3+2]===0)&&h++,(i[t[d+2]*3+2]===u||i[t[d+2]*3+2]===0)&&h++,h===3)break}if(t[d+1]===t[d+3]&&t[d+2]===t[d+5]||t[d+0]===t[d+3]&&t[d+2]===t[d+4]){kw.set(i[t[d]*3],i[t[d]*3+1],i[t[d]*3+2]),iR.set(i[t[d+1]*3],i[t[d+1]*3+1],i[t[d+1]*3+2]),sR.set(i[t[d+4]*3],i[t[d+4]*3+1],i[t[d+4]*3+2]),oR.set(i[t[d+5]*3],i[t[d+5]*3+1],i[t[d+5]*3+2]),iR.sub(kw).normalize(),sR.sub(kw).normalize(),oR.sub(kw).normalize();let h=iR.cross(sR).dot(oR),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),o.push(3),d+=3):(s.push(t[d],t[d+1],t[d+4],t[d+5]),c(d),c(d+1),c(d+4),c(d+5),o.push(4),d+=6)}else s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),o.push(3),d+=3}if(e.useNgonForTopBottomFaceDuringBake){let h=[],p=[],f=0;for(let 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),o.push(f,f),l=void 0}return{indices:s,verticesPerFace:o,uvs:l}}var Fw,Xf,gt,uz,dz,hz,Yn,kw,iR,sR,oR,rh=B(()=>{"use strict";q();Lv();pt();Fv();nR();Of();Fw=new Nt,Xf=new M;Nw.then(i=>{gt=i});uz=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),dz=new Uint32Array([0,1,2,3]),hz=new Uint8Array([4]);Yn=class extends Me{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=po.div(n.map(l=>typeof l=="number"?l:0),r);if(s.every(l=>l===1))return;this.subdividedGeometry&&Nv(this.subdividedGeometry.attributes,...s),this.originalGeometry&&Nv(this.originalGeometry.attributes,...s),this.data=e;let o=this.userData.parameters;this.userData.parameters={width:o.width*s[0],height:o.height*s[1],depth:o.depth*s[2]},this.originalGeometry.boundingSphere.center.multiply(Xf.fromArray(s));let a=Xf.set(o.width,o.height,o.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let n=e.phongAngle??35;this.flatShading&&(n=-1);let r=null;if(e.subdivisions>0){let o=0;try{o=Yn.allocate(e),r=Yn.buildRefined(o,e.subdivisions,n)}catch(a){console.error(a,e)}finally{o&&Yn.freeSubdivPointer(o)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let s=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=s}rebuild(){let e,n,r;try{({originalGeometry:e,subdividedGeometry:n,subdivPointer:r}=Yn.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&&(Yn.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;Fw.setFromBufferAttribute(n),Fw.getCenter(r),e.boundingSphere.radius=r.distanceTo(Fw.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Fw.getSize(Xf);let s={width:Xf.x,height:Xf.y,depth:Xf.z};return this.userData.parameters=s,s}static build(e,n,r,s){let o,a,l=e?.phongAngle??35;r===!1&&(l=-1),n&&(gt.free_bvh(n),gt.free_subdivision_surface(n));try{o=Yn.allocate(e,s)}catch(u){console.error(u,e),o=Yn.allocate({positionWASM:uz,indexWASM:dz,verticesPerFaceWASM:hz},s)}gt.set_destination_refinement_level(o,0);let c=Yn.buildLevel(o,!0,l);return e.subdivisions>0?a=Yn.buildRefined(o,e.subdivisions,l):a=null,{subdivPointer:o,originalGeometry:c,subdividedGeometry:a}}static buildRefined(e,n,r){try{return gt.set_destination_refinement_level(e,n),Yn.buildLevel(e,!1,r)??null}catch{try{return gt.set_destination_refinement_level(e,n-1),Yn.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:Po(e,r,!1,n),o;J1(e)?o=s.getClosedTorusIndicesForBooleanOrSubdiv():o=s.getIndex();let{positions:a,triIndices:l,triOriginals:c}=Bv(s.getAttribute("position"),o),u;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let f=e.radialSegments*e.heightSegments*3*2,m=f+e.radialSegments*3;u=[f,m]}let{indices:d,verticesPerFace:h,uvs:p}=Hte(a,l,s,u,c);return{positions:a,indices:d,verticesPerFace:h,uvs:p}}static allocate(e,n){let r,s,o,a=[],l=[],c=Uw(e.positionWASM),u=Uw(e.indexWASM),d=Uw(e.verticesPerFaceWASM);if(c&&c.length>0){if(!u?.length||!d?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${rR(e.positionWASM)}, indexWASM ${rR(e.indexWASM)}, verticesPerFaceWASM ${rR(e.verticesPerFaceWASM)}`);r=c,s=u,o=d;let _=Uw(e.uvWASM);gt.alloc_subdivision_surface_uvs&&_&&_.length===s.length*2&&(l=_)}else r=uz,s=dz,o=hz;let h=r.length,p=s.length,f=o.length,m=r.length+a.length+l.length,g=s.length+o.length,y=m*Float32Array.BYTES_PER_ELEMENT+g*Uint32Array.BYTES_PER_ELEMENT,v=m*Float32Array.BYTES_PER_ELEMENT,b=gt._malloc(y);if(!b)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${y}) failed`);let x=new Float32Array(gt.HEAPF32.buffer,b,m),S=new Uint32Array(gt.HEAPU32.buffer,b+v,g);x.set(r,0),x.set(a,r.length),x.set(l,r.length+a.length),S.set(s,0),S.set(o,s.length);let E;e?.scaleBaked?.some(_=>_!==1)&&(E=new te().makeScale(...e.scaleBaked.map(_=>typeof _=="number"?_:1))),n&&(E?E.premultiply(n):E=n);let T=b+(r.length+a.length)*Float32Array.BYTES_PER_ELEMENT,w=l.length?E?gt.alloc_subdivision_surface_uvs2(b,h,b+v,p,b+v+s.length*Uint32Array.BYTES_PER_ELEMENT,f,T,l.length,E.elements):gt.alloc_subdivision_surface_uvs(b,h,b+v,p,b+v+s.length*Uint32Array.BYTES_PER_ELEMENT,f,T,l.length):E?gt.alloc_subdivision_surface2(b,h,b+v,p,b+v+s.length*Uint32Array.BYTES_PER_ELEMENT,f,E.elements):gt.alloc_subdivision_surface(b,h,b+v,p,b+v+s.length*Uint32Array.BYTES_PER_ELEMENT,f);return gt._free(b),w}static buildLevel(e,n,r,s,o,a=!1){let l=o?gt.get_mesh_data2(e,n?gt.Level.CONTROL:gt.Level.REFINED,r,o.elements):gt.get_mesh_data(e,n?gt.Level.CONTROL:gt.Level.REFINED,r),c=10,u=gt.HEAPU32.subarray(l>>2,(l>>2)+c),d=u.subarray(4,4+4),h=0,p=gt.HEAPU32[u[h]>>2],f=gt.HEAPF32.subarray(p>>2,(p>>2)+d[h]);h++;let 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 T=u[9];if(T>0){let w=gt.HEAPU32[u[8]>>2];S=gt.HEAPF32.subarray(w>>2,(w>>2)+T)}}if(s===void 0){let T=new Me;if(T.setIndex(new Us(x,1)),T.setAttribute("position",new Be(f,3)),T.setAttribute("normal",new Be(g,3)),S&&T.setAttribute("uv",new Be(S,2)),n){T.setAttribute("faceMap",new Us(v,1));let w=new Float32Array(g.length/3*4).fill(0);T.setAttribute("color",new Ue(w,4))}return gt.free_mesh_data(l),T.userData.type="SubdivGeometry",T}if(s.getAttribute("position").copyArray(f),s.getAttribute("normal").copyArray(g),s.attributes.position.needsUpdate=!0,s.attributes.normal.needsUpdate=!0,a){let T=s.getIndex();T!==null&&T.array.length===x.length&&(T.copyArray(x),T.needsUpdate=!0)}let E=s.getAttribute("uv");S&&E&&E.array.length===S.length&&(E.copyArray(S),E.needsUpdate=!0),gt.free_mesh_data(l)}static freeSubdivPointer(e){gt.free_bvh(e),gt.free_subdivision_surface(e)}static buildControlCageWireframe(e,n,r){let s=gt.get_wireframe_data_for_base_level(e),o=4,a=gt.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+2),c=0,u=gt.HEAPU32[a[c]>>2],d=gt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let h=gt.HEAPU32[a[c]>>2],p=gt.HEAPU32.subarray(h>>2,(h>>2)+l[c]);if(n===void 0){let f=new Me;f.setAttribute("position",new Be(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 Ue(m,3)),f.setIndex(new Us(p,1)),gt.free_wireframe_data_for_base_level(s),f}n.getAttribute("position").copyArray(d),n.attributes.position.needsUpdate=!0,gt.free_wireframe_data_for_base_level(s)}static updateCollabMesh(e,n,r){let s=n===0;s||gt.set_destination_refinement_level(e,n);let o=r?gt.get_topological_data2(e,s?gt.Level.CONTROL:gt.Level.REFINED,r.elements):gt.get_topological_data(e,s?gt.Level.CONTROL:gt.Level.REFINED),a=8,l=gt.HEAPU32.subarray(o>>2,(o>>2)+a),c=l.subarray(3,3+3),u=0,d=gt.HEAPU32[l[u]>>2],h=new Float32Array(gt.HEAPF32.subarray(d>>2,(d>>2)+c[u]));u++;let p=gt.HEAPU32[l[u]>>2],f=new Uint32Array(gt.HEAPU32.subarray(p>>2,(p>>2)+c[u]));u++;let 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(o),{positions:h,indices:f,verticesPerFace:g,uvs:y}}};kw=new M,iR=new M,sR=new M,oR=new M});var lR,zw,cR=B(()=>{"use strict";b2();w2();Ev();T2();Rv();Of();V2();z2();j2();Iw();q2();Dv();X2();Y2();K2();Dw();Z2();Q2();J2();eR();uc();Qt();b2();w2();Ev();T2();Rv();iz();Of();V2();z2();j2();Iw();q2();Dv();X2();Y2();K2();Dw();Z2();Q2();J2();eR();uc();sz();F2();tR();rh();Lv();bv();nh();lR={ConeGeometry:oV,CubeGeometry:aV,CylinderGeometry:mw,DodecahedronGeometry:lV,EllipseGeometry:jf,HelixGeometry:Ak,IcosahedronGeometry:qV,LatheGeometry:XV,NonParametricGeometry:$V,PolygonGeometry:Rw,PyramidGeometry:KV,RectangleGeometry:Wf,SphereGeometry:ZV,PlaneGeometry:QV,BackdropGeometry:JV,StarGeometry:Ow,TextFrameGeometry:ez,TorusGeometry:tz,TorusKnotGeometry:nz,TriangleGeometry:rz,VectorGeometry:Ms},zw=i=>{let t=lR[i.type]??G1(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 Po(i,t,e,n){let r,s,o;i.type==="PathGeometry"?(s={...i,extrusion:{...i.extrusion}},o=[[],["extrusion"]]):(s={...i},o=[[]]);for(let c of o){let u=s;for(let d of c)u=u[d];for(r in u){let d=u[r];ZC(d)&&!Wte.includes(r)&&(u[r]=t.getVariable(d,[n.uuid,"geometry",...c,r]),ZC(u[r])&&(u[r]=1))}}let a={parameters:s,type:s.type};if(s.type==="PathGeometry"){a.path=s.path;let c=n.profileShape;c!==void 0&&(a.shapeData=c),a.ownerId=n.uuid}else if(s.type==="VectorGeometry"){let c=yn.createFromState(s.shape,s.width,s.height);a.shape=c,a.ownerId=n.uuid}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),a.geometry=new Ed().parse(s),a.geometry.groups.length===0){let c=a.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else if(s.type==="SubdivGeometry"){let c=new Yn(s,e);return c.data=i,c}else if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=G1(s.type);if(c)return c.create(s,t);Jn("text",`a ${s.type}`);let u=yn.createFromState(Vd.defaultData(),100,100);return zw({...s,shape:u,type:"VectorGeometry"})}else if(s.type==="UIGeometry")return Wf.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}});let l;try{l=zw(a)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${a}`);let u=yn.createFromState(Vd.defaultData(),100,100);a.shape=u,a.type="VectorGeometry",l=zw(a)}return l}var Wte,Fv=B(()=>{"use strict";pt();q();cR();Qt();Dv();cc();rh();Wte=["font"]});var uR,Uv,pz=B(()=>{"use strict";Fv();uR=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()}},Uv=class extends uR{constructor(e){super();this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,n,r){let s=Po(e,n,this.flatShading,r);return s.computeBoundingSphere(),s}}});function yz(i){Gw=i}function Yf(){return Gw}function vz(i){dR=i}function bz(){if(Gw==="webgpu"){if(fz!==void 0)return fz;mz||(mz=!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(dR===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 dR}function jw(i,t){return bz().createRootMaterial(i,t)}function pR(i,t,e){return bz().createSharedMaterial(i,t,e)}function fR(i){return i.getLayersOfType===void 0&&Object.assign(i,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),i}function Sz(i){xz=i}function wz(){let i=Gw==="webgpu"&&gz!==void 0?gz:xz;return i===void 0?null:fR(i())}function Hw(){return qte}function Ez(i){hR=i}function Tz(i,t){return hR===void 0?!1:hR(i,t)}var Gw,fz,dR,mz,gz,xz,qte,hR,dc=B(()=>{Gw="webgl",mz=!1});var Mz,_z=B(()=>{"use strict";Mz={markNeedsUpdateRendererDirty:()=>{}}});function Ka(i,t){let e=0;if(!i.layers||i.layers.length===0)return!1;let n=i.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(t.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of i.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let o of r.data.colors)if(o[3]<1){s=o[3];break}}else if(s===1&&r.data.type==="noise"){let o=t.color(r.data.colorA).a,a=t.color(r.data.colorB).a,l=t.color(r.data.colorC).a,c=t.color(r.data.colorD).a,u=Math.min(o,Math.min(a,Math.min(l,c)));u<1&&(s=u)}e+=(1-e)*s}}return e<1}var Ww=B(()=>{"use strict"});function mR(i){let t=typeof i=="string"?i:i.type;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function da(i){return typeof i=="string"||typeof i=="number"&&i!==0}var Ro,Ke,$f,Az,Za=B(()=>{"use strict";Ro=(i,t,e)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof i=="number"?i*100:i,e)??100)/100))??1,Ke=(i,t,e)=>typeof i=="number"?i:t.getVariable(i,e);$f={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"]},Az={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}});var gR,Xte,Yr,ih=B(()=>{"use strict";q();Af();gR=class extends _f(Zt){},Xte=i=>i.type==="Mesh",Yr=class extends gR{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 Xte(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 Rz(i){Cz=i}function yR(){return Cz}function Iz(i){Pz=i}function Oz(){return Pz}var Cz,Pz,qw=B(()=>{"use strict";Cz=null,Pz=null});function Xw(i){return"variable_"+i}function Zte(i,t){let e=`${i}/${t}`;Fz.has(e)||(Fz.add(e),console.warn(`[spline] updateObject: ignoring a geometry update of ${i} vertices for a mesh that holds ${t}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}var Dz,Lz,Nz,Kte,Bz,vR,Fz,bR,Tu,cCe,Yw=B(()=>{"use strict";pt();d2();g2();dw();Co();pw();fw();pz();dc();f2();_z();Ww();Za();Yi();ih();an();q();qw();Qt();Dz=new te,Lz=new M,Nz=new ke,Kte=new M,Bz=new Ht,vR=class extends cw{constructor(e){super();this.shared=e}create(e){return new Lf(e,this.shared)}},Fz=new Set;bR=class{constructor(t,e={},n=!0,r=!1){this.data=t;this.needsJitter=n;this.enableLocalStorageForPersistentVariables=r;this.geometryCache=new Uv(!0);this.geometryCache2=new Uv(!1);this.imageHolderCache=new vR(this);this.thisContext={scene:Mz,shared:this};this.deletedImage=new Ys(A1.emptyImage,this);this.deletedVideo=new Ys(rf.defaultVideo,this);this.materials={};this.images={};this.uiBuffers={};this.videos={};this.colors={};this.audios={};this.particles={};this.fonts={};this.variables={};this.userAPIs={};this.userWebhooks={};this.mouseProperty=null;this.raycastProperty=null;this.requestRender=()=>{this._requestRender&&this._requestRender()};this.transientGeometryKeys=new WeakSet;if(e.images)for(let[s,o]of Object.entries(e.images))this.addImage(s,o);if(e.videos)for(let[s,o]of Object.entries(e.videos))this.addVideo(s,o);if(e.audios)for(let[s,o]of Object.entries(e.audios))this.addAudio(s,o);if(e.particles)for(let[s,o]of Object.entries(e.particles))this.addParticle(s,o);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=pR(An.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,n=!1){this.data=t,this.resetLib(t.lib);for(let{id:r,data:s}of t.variables)this.addVariableHolder(r,s),e&&this.updateVariableHolder(r,s);for(let[r,s]of Object.entries(t.userAPIs??{}))this.addUserAPI(r,s);for(let[r,s]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(r,s);if(!n){for(let[r,s]of Object.entries(t.images))this.addImage(r,s);for(let[r,s]of Object.entries(t.videos))this.addVideo(r,s)}for(let[r,s]of Object.entries(t.colors))this.addColor(r,s);for(let[r,s]of Object.entries(t.lib.materials))this.addMaterial(r,s.asset);for(let[r,s]of Object.entries(t.materials))this.addMaterial(r,s);for(let[r,s]of Object.entries(t.audios))this.addAudio(r,s);for(let[r,s]of Object.entries(t.particles))this.addParticle(r,s);for(let[r,s]of Object.entries(t.fonts))this.addFont(r,s)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:An.defaultTwoLayerData("phong").layers}),this.materials[t]){let n=this.materials[t];n.reset(e,this.thisContext),n.dispose()}else{let n=pR(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}),jw(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Ys(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Ys(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}getEntityTexture(t,e={}){let n=t.material;if(!n)return null;for(let r of Array.isArray(n)?n:[n]){let s=r.root??r;for(let o of s?.data?.layers??[]){let a=o?.data;if(a?.type!=="texture"&&a?.type!=="matcap"||e.layer!==void 0&&o.id!==e.layer&&a.type!==e.layer)continue;let l=a.texture?.image;if(l==null)continue;let c=(typeof l=="string"?this.uiBuffer(l):void 0)??this.image(l);if(!c)continue;let u=c.getTexture(a.texture.wrapping??(a.type==="texture"?1e3:1001),a.texture.minFilter??1008,a.texture.magFilter??1006),d=c.img;return{texture:u,width:d?.width??0,height:d?.height??0,layerId:o.id,layerType:a.type}}}return null}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Ys(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new ac(e.r,e.g,e.b,e.a):this.colors[t]=new ac(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 gn(0,0,0,0))}else return"a"in t?new gn(t.r,t.g,t.b,t.a):new gn(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 lc)return e;{let n=new lc({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 lc&&e.dispose(),delete this.audios[t])}addFont(t,e){let n=iV();if(n===null){Jn("text","a font asset");return}this.fonts[t]=new n(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof lc&&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(Xw(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(Xw(t),JSON.stringify(e));let n=e;for(;typeof n=="string";)n=this.variables[n].value;let r=this.entityOpContext.scene,s=!1;for(let o=this.variables[t].locations.length-1;o>=0;o--){let a=this.variables[t].locations[o];if(a[0]==="material"){let l=a[1],c=n,u={scene:r,shared:this},d=a.slice(2);r.traverseMaterial(p=>{let f=p.root??p;f.uuid===l&&f.onVariableUpdate(d,c,u)});let h=this.materials[l];h&&h.onVariableUpdate(d,c,u)}else{let l=r.find(a[0]);if(l===void 0){this.variables[t].locations.splice(o,1);continue}if(s=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let c=1;c<a.length-1;c++)l=l[a[c]];a[1]==="rotation"?l[a[a.length-1]]=n*ge.DEG2RAD:l[a[a.length-1]]=n}if(l=r.find(a[0]),l.type==="ParticleEmitter"&&l.updateVariableState(n,a),Ot.is(l))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")l.onVariableUpdate();else if(a[1]==="geometry"){let c=l;l.component&&(c=l.component);let u=c.dataPatched;c.chooseGeoemtryCache(this).forceDelete(u.geometry),c.createGeometryDelayed(this.entityOpContext),c.onVariableUpdate(!0),c.invalidateDownstreamBooleanData(),c.instances.forEach(d=>{let h=d.dataPatched;d.chooseGeoemtryCache(this).forceDelete(h.geometry),d.createGeometryDelayed(this.entityOpContext),d.onVariableUpdate(!0),d.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&l.updateMorphInfluences(a[2],n)}}return s&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||typeof s.type!="string"||s.type==="VectorGeometry"||s.type==="PathGeometry")return!1;let o=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let u of Object.keys(s))a.set(o(u),u);let l={};for(let[u,d]of Object.entries(e??{})){let h=a.get(o(u));if(h===void 0||h==="type"||h==="font"||h==="shape"||h==="path"||h==="data")continue;if(h==="text"){(typeof d=="string"||typeof d=="number")&&(l[h]={textValue:String(d)});continue}let p=s[h];typeof d=="number"&&isFinite(d)&&(typeof p=="number"||typeof p=="string")&&(l[h]=d)}if(Object.keys(l).length===0)return!1;let c={...s,...l};return n.dataPatched={...r,geometry:c},this.transientGeometryKeys.has(s)&&n.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(c),n.createGeometryDelayed(this.entityOpContext),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let r=e.dataPatched?.geometry;return!r||!this.transientGeometryKeys.has(r)?!1:(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(r),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0)}updateEntityGeometryVertices(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||s.type!=="NonParametricGeometry")return!1;let o=e?.vertices;if(o===void 0||typeof o.length!="number"||o.length<9||o.length%3!==0||o.length/3>bR.MAX_TRANSIENT_VERTICES)return!1;let a=o instanceof Float32Array?o:Float32Array.from(o),l=a.length/3,c;if(e.normals!==void 0){if(e.normals.length!==a.length)return!1;c=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}let u;if(e.uvs!==void 0){if(e.uvs.length!==l*2)return!1;u=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}let d;if(e.indices!==void 0){let E=l>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(E.length===0||E.length%3!==0)return!1;for(let T=0;T<E.length;T++)if(E[T]>=l)return!1;d={array:E,itemSize:1,type:E.constructor.name,normalized:!1}}else{let E=s.data,T=E?.index;if(T?.array?.length){let w=(E?.attributes?.position?.array?.length??0)/3;if(l!==w)return Zte(l,w),!1;d=T}}let h=1/0,p=1/0,f=1/0,m=-1/0,g=-1/0,y=-1/0;for(let E=0;E<a.length;E+=3){let T=a[E],w=a[E+1],_=a[E+2];T<h&&(h=T),T>m&&(m=T),w<p&&(p=w),w>g&&(g=w),_<f&&(f=_),_>y&&(y=_)}let v=(E,T)=>({array:E,itemSize:T,type:"Float32Array",normalized:!1}),b={position:v(a,3)};c&&(b.normal=v(c,3)),u&&(b.uv=v(u,2));let x={...s,width: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,o=Math.PI/180,a=!1;if(e===null)for(let l of s)l.transformOverride!==void 0&&(l.transformOverride=void 0,a=!0);else if(Array.isArray(e)){let l=Math.min(e.length,s.length);for(let c=0;c<l;c++){let u=e[c],d=s[c];if(u==null){d.transformOverride!==void 0&&(d.transformOverride=void 0,a=!0);continue}let h=d.transformOverride??{position:[d.position.x,d.position.y,d.position.z],rotation:[d.rotation.x,d.rotation.y,d.rotation.z],scale:[d.scale.x,d.scale.y,d.scale.z]};u.position&&(typeof u.position.x=="number"&&(h.position[0]=u.position.x),typeof u.position.y=="number"&&(h.position[1]=u.position.y),typeof u.position.z=="number"&&(h.position[2]=u.position.z)),u.rotation&&(typeof u.rotation.x=="number"&&(h.rotation[0]=u.rotation.x*o),typeof u.rotation.y=="number"&&(h.rotation[1]=u.rotation.y*o),typeof u.rotation.z=="number"&&(h.rotation[2]=u.rotation.z*o)),u.scale&&(typeof u.scale.x=="number"&&(h.scale[0]=u.scale.x),typeof u.scale.y=="number"&&(h.scale[1]=u.scale.y),typeof u.scale.z=="number"&&(h.scale[2]=u.scale.z)),d.transformOverride=h,d.position.fromArray(h.position),d.rotation.fromArray(h.rotation),d.scale.fromArray(h.scale),d.updateMatrix(),d.hasNonUniformScale&&(d.updateMatrixWorld(),d.updateMatrixWorldRigid())}}else return s.length;return a?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(n),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),s.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let n=t.parent;if(n===null)return;let r=new Yr(t);r.playModeVisible=e.visible!==!1,r.expand(),typeof e.name=="string"&&(r.name=e.name);let s=Math.PI/180;return r.position.copy(t.position),r.rotation.copy(t.rotation),r.scale.copy(t.scale),r.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(r.position.x=e.position.x),typeof e.position.y=="number"&&(r.position.y=e.position.y),typeof e.position.z=="number"&&(r.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(r.rotation.x=e.rotation.x*s),typeof e.rotation.y=="number"&&(r.rotation.y=e.rotation.y*s),typeof e.rotation.z=="number"&&(r.rotation.z=e.rotation.z*s)),e.scale&&(typeof e.scale.x=="number"&&(r.scale.x=e.scale.x),typeof e.scale.y=="number"&&(r.scale.y=e.scale.y),typeof e.scale.z=="number"&&(r.scale.z=e.scale.z)),r.updateMatrix(),n.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let n=t.material;if(!n)return!1;let r=[];for(let u of Array.isArray(n)?n:[n]){let d=u.root??u;d&&Array.isArray(d.layers)&&d.data&&!r.includes(d)&&r.push(d)}if(r.length===0)return!1;let s={scene:this.entityOpContext.scene,shared:this},o=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=u=>{if(typeof u=="string"){let d=new gn(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 ac?u.setValue(d,new gn(h.r,h.g,h.b,f)):typeof p.setRGBA=="function"?p.setRGBA(h.r,h.g,h.b,f):p.setRGB(h.r,h.g,h.b),!0},c=!1;for(let u of r){let d=u.data.layers??[],h=p=>u.layers.find(f=>f.uuid===p);if(e.color!==void 0){let p=a(e.color),f=d.find(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:Ka(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=$f[f.data.type]??[],y=Object.keys(f.data);for(let[v,b]of Object.entries(p)){if(v==="id"||v==="index"||v==="type")continue;let x=y.find(E=>E===v)??y.find(E=>o(E)===o(v))??v;if(g.includes(x))continue;let S=a(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((T,w)=>{u.onVariableUpdate?.(["layer",f.id,x,E[w]],T,s)}),c=!0}}}}return c&&this.requestRender(),c}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let n=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return n.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&n?.getPhysicsLocalMatrix?.(Dz))return Dz.decompose(Lz,Nz,Kte),t[1]==="position"?Lz[t[2]]:(Bz.setFromQuaternion(Nz,n.rotation.order),Bz[t[2]]*ge.RAD2DEG);for(let r=1;r<t.length;r++)n=n[t[r]];return t[1]==="rotation"&&(n*=ge.RAD2DEG),n}for(let n in this.variables){if(e===void 0)break;let r=this.variables[n],s=r.locations?.findIndex(o=>rr.equal(o,e));s!==void 0&&s!==-1&&r.locations.splice(s,1)}if(typeof t=="string"){let n=t,r=t;do{if(r=n,this.variables[n]===void 0)break;let s=this.variables[n].value;e&&this.variables[r]!==void 0&&this.variables[r].locations.push(e),n=s}while(typeof n=="string");return n}else return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,n]of Object.entries(t.images))this.addImage(e,n.asset);for(let[e,n]of Object.entries(t.audios))this.addAudio(e,n.asset);for(let[e,n]of Object.entries(t.particles))this.addParticle(e,n.asset);for(let[e,n]of Object.entries(t.colors))this.addColor(e,n.asset);for(let[e,n]of Object.entries(t.fonts))this.addFont(e,n.asset);for(let[e,n]of Object.entries(t.videos))this.addVideo(e,n.asset);for(let[e,n]of Object.entries(t.variables))this.addVariableHolder(e,n.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,n){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(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,o=this.getUserAPI(t.path[1]);o!==void 0&&o===this.openAIRealtime?o.update(r):o?.update(r,this,s)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let r=e.userWebhooks[t.path[1]];r&&this.getUserWebhook(t.path[1])?.update(r)}}else t.path[0]==="lib"&&this.updateLibByOp(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=Oz();return n===null?(Jn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=n(e,t,this),!1)}else{let n=yR();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=yR();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}},Tu=bR;Tu.MAX_TRANSIENT_VERTICES=6e4;cCe=new Tu(ls.emptyData())});function $w(i){return Jd(i)||i?.isTSLNodeMaterial===!0}function Uz(i){return Uk(i)||i?.isTSLSharedMaterial===!0}var xR=B(()=>{"use strict";ow()});var Mr,Mu=B(()=>{pt();ii();dc();xR();an();qr();Mr=class extends Kt{setMaterialOverride(e,n){this.materialOverride=fR(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),CB(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[s,o]of Object.entries(e.props)){let a=this.material[Number(s)],l=r.shared.material(o);l!==a&&Mr.disposeOneMaterial(a),this.material[Number(s)]=l}else if($t(e.path,["material"])){let s=this.material;!Array.isArray(s)&&typeof s?.updateByOp=="function"&&"material"in n&&typeof n.material!="string"&&s.updateByOp(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 o=n.materials[s];typeof o!="string"&&this.material[s].updateByOp(wr.drop(e,2),o,r)}}}get needsAO(){return this.material!==void 0?(Array.isArray(this.material)?this.material[0]:this.material).hasAO:!1}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&!!this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):(this.layers.mask&1<<9)!==0&&this.layers.set(0)}updateState(e,n){super.updateState(e,n),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let r=this.dataPatched;this.syncShapeBlendNodeLayer();let s;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(s={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let o=this.materialOverride!==void 0;!o&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,s),n.scene.markNeedsUpdateRendererDirty()),!o&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(l=>n.shared.material(l).getFlavor(r.flatShading,r.side,r.wireframe)),n.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],n.scene.markNeedsUpdateRendererDirty()));let a=this.data;if(!o&&a.geometry?.type!=="NonParametricGeometry"&&"materials"in a&&a.materials!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(a.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!o&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let l=0;l<this.material.length;l++)this.material[l]=this.material[l].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,s);this.syncShadowCatcher(n)}shadowCatcherActive(){let e=this.dataPatched,n=e.geometry?.type;return e.shadowCatcher===!0&&(n==="RectangleGeometry"||n==="PlaneGeometry")}syncShadowCatcher(e){let n=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let r=wz();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){$w(e)&&!Uz(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&RS(this.material).forEach(e=>{Mr.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}});var kz,Vz,zz,Qte,Gz,_u,Jte,ene,Zw,Yt,$i=B(()=>{"use strict";pt();an();Yw();Mu();q();Fv();nh();rh();nR();kz=new M,Vz=new vt,zz=new vt,Qte=new M,Gz=new te,_u=new Gt,Jte=_u.geometry,ene=_u.material,Zw=new M,Yt=class extends Mr{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 te().fromArray(n.bindMatrix),this.bindMatrixInverse=new te)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof Me&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof Me?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Tu){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 ev.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return ev.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}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}dispose(){super.dispose(),kV(this.uuid),this._posed=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(!(e===void 0||e.sxPrev===void 0))return[e.sxPrev,e.syPrev,e.szPrev]}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=Po(p,n,this.data.flatShading,this)}let o,a,l;s.scaleBaked?[o,a,l]=s.scaleBaked:{width:o,height:a,depth:l}=s;let c=this.localGeometry.userData,u=typeof o=="number"?o:1,d=typeof a=="number"?a:1,h=typeof l=="number"?l:1;c.sxPrev!==void 0&&Nv(this.localGeometry.attributes,u/c.sxPrev,d/c.syPrev,h/c.szPrev),c.sxPrev=u,c.syPrev=d,c.szPrev=h}else if(!this.absorbDepthInteraction(e)){let s={...this.data.geometry,...e},o=Po(s,n,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&Bw(this.localGeometry,o)?o.dispose():(this.localGeometry?.dispose(),this.localGeometry=o)}}absorbDepthInteraction(e){let n=this.localGeometry;if(n?.shiftDepthTo===void 0)return!1;let r=e;if(typeof r.depth!="number")return!1;let s=n.userData?.parameters;if(s===void 0)return!1;for(let o of Object.keys(r))if(o!=="depth"&&r[o]!==s[o])return!1;return n.shiftDepthTo(r.depth)?(s.depth=r.depth,!0):!1}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 Yn&&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&&Vw(e.props)&&this.geometryCreateDeleyed instanceof Yn&&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 Me&&!(this.geometryCreateDeleyed instanceof Yn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let o=r.shared,a=this.chooseGeoemtryCache(o),l=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===l&&l.isShared!==!0){let u=this.dataPatched.geometry,d=Po(u,o,this.data.flatShading,this);Bw(l,d)?(d.dispose(),l.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,u)):(d.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(u,d),this.geometryCreateDeleyed=d),this._geometryCacheKey=u,s=!0,this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)}}s||(r.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(r)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,n){this.createGeometryDelayed(n)}applyTransientGeometryData(e,n){let r=e.shared,s=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof Me&&!(this.geometryCreateDeleyed instanceof Yn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let o=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(o.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let c=Po(s,r,this.data.flatShading,this);Bw(a,c)?(c.dispose(),a.computeBoundingSphere(),o.mutateIfUnique(this._geometryCacheKey,s)):(c.computeBoundingSphere(),o.forceDelete(this._geometryCacheKey),o.adopt(s,c),this.geometryCreateDeleyed=c),this._geometryCacheKey=s,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e);return}}n&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(r).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,n){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,n);let r=e.morphTargetInfluences;if(r){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:s,value:o}}of r)this.updateMorphInfluences(s,n.shared.getVariable(o,[this.uuid,"morphTargetInfluences",s]))}super.updateState(e,n)}updateMorphInfluences(e,n){if(this.morphTargetDictionary===void 0)return;let r=this.morphTargetDictionary[e];r!==void 0&&(this.morphTargetInfluences[r]=n)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,n){let r=this.posedGeometry()?.boundingBox;if(r){r.getCenter(e),r.getSize(n).multiplyScalar(.5);return}let s=this.geometry.userData.parameters;this.is2DType||this.isTextType?e.set(0,0,s.depth*.5):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),n.set(s.width,s.height,s.depth??0).multiplyScalar(.5)):s.centerOffset?e.fromArray(s.centerOffset):e.setScalar(0),n.set(s.width,s.height,s.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,n){this.skeleton=e,this.isSkinnedMesh=!0,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let n=new vt,r=this.geometry.attributes.skinWeight;for(let s=0,o=r.count;s<o;s++){n.fromBufferAttribute(r,s);let a=1/n.manhattanLength();a!==1/0?n.multiplyScalar(a):n.set(1,0,0,0),r.setXYZW(s,n.x,n.y,n.z,n.w)}}boneTransform(e,n){let r=this.skeleton;if(r===void 0)return;let s=this.geometry;Vz.fromBufferAttribute(s.attributes.skinIndex,e),zz.fromBufferAttribute(s.attributes.skinWeight,e),kz.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let o=0;o<4;o++){let a=zz.getComponent(o);if(a!==0){let l=Vz.getComponent(o);Gz.multiplyMatrices(r.bones[l].matrixWorld,r.boneInverses[l]),n.addScaledVector(Qte.copy(kz).applyMatrix4(Gz),a)}}return n.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(e,n){let r=this.posedGeometry();if(r===void 0)return!1;_u.geometry=r,_u.material=this.material,_u.matrixWorld.copy(this.matrixWorld);let s=n.length;_u.raycast(e,n);for(let o=s;o<n.length;o++)n[o].object=this;return _u.geometry=Jte,_u.material=ene,!0}posedGeometry(){let e=this.skeleton;if(!this.isSkinnedMesh||e===void 0)return;let n=this.geometry,{position:r,skinIndex:s,skinWeight:o}=n.attributes;if(!r||!s||!o)return;let a=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let p=0;p<e.bones.length;p++){let f=e.bones[p];if(!f||!e.boneInverses[p])return;a.push(...f.matrixWorld.elements)}let l=this._posed;if(l?.source===n&&l.version===r.version&&l.pose.length===a.length&&l.pose.every((p,f)=>p===a[f]))return l.geometry;let c=r.count,u=l?.geometry.attributes.position,d=u?.count===c?u:new Ue(new Float32Array(c*3),3);for(let p=0;p<c;p++)this.boneTransform(p,this.getVertexPosition(p,Zw)),d.setXYZ(p,Zw.x,Zw.y,Zw.z);let h=new Me;h.setAttribute("position",d);for(let p of["normal","uv","uv1"]){let f=n.attributes[p];f&&h.setAttribute(p,f)}return h.setIndex(n.index),h.groups=n.groups,h.drawRange=n.drawRange,h.computeBoundingSphere(),h.computeBoundingBox(),this._posed={source:n,version:r.version,pose:a,geometry:h},h}}});function tne(i){if(i.geometry.attributes.extrudeNormal||!i.geometry.attributes.position||!i.geometry.attributes.normal)return;let t=new Map,e=i.geometry.attributes,n=e.position.array,r=e.normal.array,s=new Float32Array(n.length);for(let o=0;o<n.length;o+=3){let a=`${n[o]}_${n[o+1]}_${n[o+2]}`,l=new M(r[o],r[o+1],r[o+2]);t.has(a)?t.get(a)?.normals.push(l):t.set(a,{normals:[l],result:new M})}t.forEach((o,a)=>{for(let l of o.normals)o.result.add(l);o.result.divideScalar(o.normals.length)});for(let o=0;o<n.length;o+=3){let a=`${n[o]}_${n[o+1]}_${n[o+2]}`,l=t.get(a)?.result;l&&(s[o]=l.x,s[o+1]=l.y,s[o+2]=l.z)}i.geometry.setAttribute("extrudeNormal",new Be(s,3))}function nne(i){if(i.geometry.attributes.extrudeNormals||!i.geometry.attributes.position)return;let e=i.geometry.attributes.position.array,n=new Float32Array(e.length),r=new M;for(let s=0;s<e.length;s+=3)r.set(e[s],e[s+1],e[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;i.geometry.setAttribute("extrudeNormal",new Be(n,3))}function Qa(i){if(Array.isArray(i.material)){for(let t of i.material)if(t.getLayersOfType("outline").length===0)return}else if(!Jd(i.material)||i.material.getLayersOfType("outline").length===0)return;i instanceof Yt&&i.is2DAndNoDepth?nne(i):tne(i)}function SR(i){return Math.min(2047,Math.max(1,Math.round(i*2048)))/2048}function Ja(i){if(!i.geometry.attributes.position)return;let t=i.geometry.attributes,e=t.position.array,n=t.randomColor;if(n!==void 0&&n.count*3===e.length)return;let r=new Float32Array(e.length),s=parseInt(i.uuid.replace(/\D/g,"")),o=[SR(ge.seededRandom(s)),SR(ge.seededRandom(s+1e4)),SR(ge.seededRandom(s+2e4))];for(let a=0;a<e.length;a++)r[a]=o[a%3];i.geometry.setAttribute("randomColor",new Ue(r,3))}var kv=B(()=>{"use strict";q();ow();$i()});function ER(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function ine(i,t){let e=i.cloner;return e!==void 0&&e.parent===t?e:void 0}function Wz(i,t,e,n){let r=(t.children.length+1)*16;Qw.length<r&&(Qw=new Float32Array(r));let s=0,o=l=>{l.toArray(Qw,s*16),s++},a=t.parameters.hideBase!==!0;a&&o(n),jz.multiplyMatrices(i.hiddenMatrix,i.matrix);for(let l of t.children)!Wa(l)||l.playModeVisible===!1||(Hz.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),wR.multiplyMatrices(jz,Hz),!(a&&wR.equals(n))&&o(wR));try{return s===0?0:Lk(e,Qw.subarray(0,s*16))}finally{iw(e)}}var Au,rne,jz,Hz,wR,Qw,_s,Zf=B(()=>{ii();q();bv();kv();Mu();fr();Au=new te,rne=new te,jz=new te,Hz=new te,wR=new te;Qw=new Float32Array(0);_s=class extends Mr{constructor(e,n,r){super(e,n);this.data=n;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.geometry=new Me;this.onAfterRender=(e,n,r,s,o,a)=>{super.onAfterRender(e,n,r,s,o,a),this.recomputeBoolean()};this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,n=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let s=0;s<this.children.length;s++){let o=this.children[s];o instanceof _s&&o.dataPatched.visible===!0&&o.recomputeBoolean(e===!0,n)}this.meshSetAddresses=[];for(let s=0;s<this.children.length;s++){let o=this.children[s];if(o instanceof Kt&&o.dataPatched.visible===!0&&o.geometry.attributes.position?.count>0&&o.geometry.drawRange.count>0&&o.booleanMeshSetAddress!==0){Au.multiplyMatrices(o.hiddenMatrix,o.matrix).multiply(o.pivotMatrix);try{let a=ine(o,this);if(o.booleanMeshSetAddress===-1){if((o.geometry.index??o.geometry.getAttribute("position")).count/3<15e5){let l=Rk(o.geometry,e===!0,n);o.booleanMeshSetAddress=a===void 0||l===-1?l:Wz(o,a,l,Au)}if(o.booleanMeshSetAddress===-1)return;a===void 0&&rw(o.booleanMeshSetAddress,Au),o.booleanMatrixInvOld.copy(Au).invert(),o.booleanWasTransformed=!1}else o instanceof _s&&o.needsTransformForDownstream===!0?(a===void 0?rw(o.booleanMeshSetAddress,Au):o.booleanMeshSetAddress=Wz(o,a,o.booleanMeshSetAddress,Au),o.needsTransformForDownstream=!1):o.booleanWasTransformed===!0&&(rw(o.booleanMeshSetAddress,rne.multiplyMatrices(Au,o.booleanMatrixInvOld)),o.booleanMatrixInvOld.copy(Au).invert(),o.booleanWasTransformed=!1)}catch(a){console.error(a),o.booleanMeshSetAddress=0,o.geometry.userData.booleanOperationDidFail=!0;continue}if(o.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(o.booleanMeshSetAddress),o.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let s=this.geometry;s.dispose(),this.geometry=new Me,this.geometry.userData=s.userData,this.geometry.boundingSphere=s.boundingSphere,this.geometry.setAttribute("position",new Be([],3))}this.geometry.setDrawRange(0,0);return}if(e===!0)return Dk(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new Me,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=Ok(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,Qa(this),Ja(this)}dispose(){super.dispose(),this.geometry.dispose()}}});var Qf,Jf,em=B(()=>{q();Yi();xu();(t=>{function i(e){return Ot.is(e)&&e instanceof Gl}t.is=i})(Qf||(Qf={}));Jf=(i,t)=>class extends _o(i,t){updateState_Light(n,r){if(this.updateState_Entity(n,r),n.color!==void 0&&(this.color=r.shared.color(n.color)),n.intensity!==void 0&&(this.intensity=n.intensity*Math.PI),n.depth!==void 0){let s=this.shadow;s.camera.far=n.depth,s.needsUpdate=!0}n.shadows!==void 0&&(this.castShadow=n.shadows)}}});var As,ds,Vv,hc=B(()=>{Zf();ii();xu();As=i=>i instanceof Kt,ds=i=>i!==null&&i instanceof _s,Vv=i=>$1.is(i)});function vne(i,t){try{let e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(i),n=r=>Number(e.find(s=>s.type===r)?.value);return new Date(n("year"),n("month")-1,n("day"),n("hour"),n("minute"),n("second"),i.getMilliseconds())}catch{return new Date(NaN)}}function yi(i,t){return t.color(i)}function AR(i=new Date,t){let e=t.format,n=i.getSeconds(),r=i;t&&t.timeZone!==null&&(r=vne(new Date,t.timeZone));let s=r.getHours(),o=r.getMinutes(),a;t.format12h24h==="12ampm"&&(a=s>=12?"PM":"AM");let l=s;t.format12h24h!=="24"&&(l=s%12,l===0&&(l=12));let c,u;switch(e){case"HH:mm:ss":c=[l,o,n];break;case"HH:mm":c=[l,o];break;case"HH":c=[l],a=void 0;break;case"mm":c=[o],a=void 0;break;case"ss":c=[n],a=void 0;break;case"year":u=r.getFullYear();break;case"month":u=r.getMonth()+1;break;case"dayOfYear":u=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=r.getDate();break;case"secondOfDay":u=s*60*60+o*60+n;break;default:console.error("Unknown time format",e),u=0;break}return c!==void 0?{textValue:c,suffix:a}:u}var nE=B(()=>{"use strict"});var rm,eG=B(()=>{"use strict";q();wf();Ef();rm=class extends ja(xy){constructor(e,n=15,r=10066329){super(e,n,r);this.object=e;this.added=!1;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,n){Ha(this.object,rm.geometryHelper,e,n)}}});function bne(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 pc,rE=B(()=>{"use strict";q();eG();em();pc=class extends Jf(gy,rm){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.top=1250,s.bottom=-1250,s.right=1250,s.left=-1250,s.near=-1e4,s.far=2500;let o=new Hl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Hl&&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&&bne(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 PR(i){return i instanceof Mr&&i.needsAO&&!Xi(i)&&i.isDecalObject!==!0}function RR(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 IR(i){return i.getLayersOfType("reflection").filter(t=>t.data.visible).length}function tG(i,t){let e={outline:!1,cavity:!1},n=i.layers.mask&CR,r=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),o=IR(t),a=t.getLayersOfType("cavity");return(s.length>0||a.length>0)&&(i.layers.set(8),r.length>0&&i.layers.enable(3),o>0&&i.layers.enable(4),e.outline=s.length>0,e.cavity=a.length>0,Ja(i),Qa(i)),r.length===0&&s.length===0&&a.length===0&&o===0&&i.layers.set(0),n&&i.layers.set(9),!n&&PR(i)&&i.layers.enable(5),RR(i),e}function nG(i,t){if(!t.layers)return!1;let e=i.layers.mask&CR,n=!1,r=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),o=IR(t),a=t.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(i.layers.set(3),(s.length>0||a.length>0)&&i.layers.enable(8),o>0&&i.layers.enable(4),n=!0),r.length===0&&s.length===0&&a.length===0&&o===0&&i.layers.set(0),e&&i.layers.set(9),!e&&PR(i)&&i.layers.enable(5),RR(i),n}function rG(i,t){var l;if(!t.layers)return!1;let e=i.layers.mask&CR,n=!1,r=IR(t),s=t.getLayersOfType("transmission").filter(c=>c.data.visible),o=t.getLayersOfType("outline").filter(c=>c.data.visible),a=t.getLayersOfType("cavity").filter(c=>c.data.visible);return r>0&&((l=i.userData).__splinePlanarMirror??(l.__splinePlanarMirror=0),i.layers.set(4),s.length>0&&i.layers.enable(3),(o.length>0||a.length>0)&&i.layers.enable(8),n=!0),r===0&&s.length===0&&o.length===0&&a.length===0&&i.layers.set(0),e&&i.layers.set(9),!e&&PR(i)&&i.layers.enable(5),RR(i),n}function sG(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 Mr)if(Array.isArray(n.material))for(let r=0;r<n.material.length;r++)e(tG(n,n.material[r]));else e(tG(n,n.material))}),t}function oG(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Mr)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)nG(e,e.material[n])&&(t=!0);else nG(e,e.material)&&(t=!0)}),t}function aG(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Mr)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)rG(e,e.material[n])&&(t=!0);else rG(e,e.material)&&(t=!0)}),t}function Gv(i,t,e,n=!1){let r=i.cloner;if(r){let s=null;if((i.raycast===Gt.prototype.raycast||i.raycast===Kt.prototype.raycast)&&i.isSkinnedMesh!==!0){let o=i.geometry;o&&(o.boundingSphere===null&&o.computeBoundingSphere(),s=o.boundingSphere)}for(let o of r.children){if(s!==null&&(iG.copy(s).applyMatrix4(o.matrixWorld),!t.ray.intersectsSphere(iG)))continue;let a=Sne.copy(o.matrixWorld).invert(),l=wne.copy(t.ray).applyMatrix4(a),c=i.matrixWorld;l.applyMatrix4(c);let u=xne;u.set(l.origin,l.direction),u.near=t.near,u.far=t.far,u.layers.mask=t.layers.mask;let d=u.intersectObject(i,!1);d.length>0&&e.push({...d[0],object:n?o:i})}}}var CR,xne,Sne,wne,iG,OR=B(()=>{"use strict";fr();kv();ii();Mu();q();CR=1<<9;xne=new jl,Sne=new te,wne=new Hi,iG=new nr});var sE,jv,lG=B(()=>{"use strict";q();wf();Ef();sE=class extends ja(vy){constructor(e,n=6710886){super(e,n);this.object=e;this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,n){Ha(this.object,sE.geometryHelper,e,n)}update(){if(this.object!==void 0){let e=sE._vector,n=this.object.distance?this.object.distance:1e3,r=n*Math.tan(this.object.angle);this.cone.scale.set(r,r,n),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},jv=sE;jv._vector=new M});var cG,uG,dG,fc,oE=B(()=>{"use strict";q();lG();em();cG=new M,uG=new M,dG=new ke,fc=class extends Jf(fy,jv){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=ge.RAD2DEG*2*this.angle,s.aspect=1,s.near=100,s.far=2500;let o=new Hl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Hl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),uG.setFromMatrixPosition(this.matrixWorld),dG.setFromRotationMatrix(this.matrixWorld),cG.copy(this.up).applyQuaternion(dG).negate().multiplyScalar(this.distance),this.target.position.copy(uG).add(cG),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,tl=B(()=>{pt();Xs();q();Yi();Co();nE();aa();rE();an();dc();q();Mu();hc();OR();oE();Qt();Zf();Cn=class extends Rf(hr){constructor(e,n,r){super();this.data=n;this.bgColor=new gn(1,1,1,1);this.fog=null;this.backupFog=new ud(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 Ye;this.penumbraSizeArrayCache=null;if(this.super_Entity(e,n),this.personalCamera=new rn(fo,{...jd.defaultData,...n.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new hy(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=dv();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=dv();if(r===null){Jn("ui-2d","a page's UI canvas");return}this.uiCanvas=new r.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,n),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,n){e.color!==void 0&&(this.ambientLight.color=yi(e.color,n)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(n=>{n instanceof _s&&n.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof Mr)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=Gd.isSoft(n);Tz(r,n?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,n){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let r=this.scene;r.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=yi(e.color,n),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=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=yi(e.aoColor,n))}updateByOp(e,n,r,s){let o=this.data.uiFrame;super.updateByOp(e,n,r,s);let a=n;$t(e.path,["fog"])?this.updateFog(a.fog,r.shared):$t(e.path,["sky"])?this.updateSky(a.sky,r.shared):$t(e.path,["grading"])?this.gradingState=a.grading??null:$t(e.path,["ao"])?this.updateAo(a.ao,r.shared):$t(e.path,["ambient"])?this.updateAmbientLight(a.ambient,r.shared):$t(e.path,["shadow"])?this.updateShadow(a.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||o!==a.uiFrame)&&this.updateUIFrame(e.props.uiFrame,r)}updateUIFrame(e,n){e?(this.uiCanvas||this.createUICanvas(e,n),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,n){this.updateState_Entity(e,n),e.backgroundColor!==void 0&&this.setBackgroundColor(yi(e.backgroundColor,n.shared)),e.fog!==void 0&&this.updateFog(e.fog,n.shared),e.sky!==void 0&&this.updateSky(e.sky,n.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,n.shared),e.ao!==void 0&&this.updateAo(e.ao,n.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,n){}raycast(e,n){super.raycast(e,n)}switchActiveCamera(e){e instanceof rn&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){let e=this.scene?.find(this.data.publish.playCamera);return e instanceof rn?e: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 pc&&r.visible&&e<Sf&&(this.penumbraSizeArrayCache[e]=r.data.penumbraSize??.5,e+=1),r instanceof fc&&r.visible&&e<cs-Sf&&(this.penumbraSizeArrayCache[Sf+n]=r.data.penumbraSize??.5,n+=1)})}raycastWithClones(e){let n=[],r=s=>{for(let o of s.children){let a=o.cloner;Ot.is(o)&&(o.visible||a?.object.data.visible)&&((As(o)||Vv(o)&&this.scene.enableHelpers&&o.objectHelper.visible)&&(e.intersectObject(o,!1,n),Gv(o,e,n,!0)),r(o))}};return r(this),n}updateEntity2DByOp(e,n,r,s){this.uiCanvas?.updateEntity2DByOp(e,n,r,s)}}});function VR(){return Lne}function DG(i){kR=i}function gE(){if(kR===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 kR}function yE(i){return i?.isWebGPUSplineRenderer===!0}var Lne,kR,zR=B(()=>{"use strict";Lne=null,kR=null});var il,ME=B(()=>{"use strict";q();av();xu();il=class extends _o(Bs,So){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 WG=qh((qR,HG)=>{(function(i,t){typeof qR=="object"?HG.exports=t():typeof define=="function"&&define.amd?define(t):i.Alea=t()})(qR,function(){"use strict";return i.importState=function(e){var n=new i;return n.importState(e),n},i;function i(){return function(e){var n=0,r=0,s=0,o=1;e.length==0&&(e=[+new Date]);var a=t();n=a(" "),r=a(" "),s=a(" ");for(var l=0;l<e.length;l++)n-=a(e[l]),n<0&&(n+=1),r-=a(e[l]),r<0&&(r+=1),s-=a(e[l]),s<0&&(s+=1);a=null;var c=function(){var u=2091639*n+o*23283064365386963e-26;return n=r,r=s,s=u-(o=u|0)};return c.next=c,c.uint32=function(){return c()*4294967296},c.fract53=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.version="Alea 0.9",c.args=e,c.exportState=function(){return[n,r,s,o]},c.importState=function(u){n=+u[0]||0,r=+u[1]||0,s=+u[2]||0,o=+u[3]||0},c}(Array.prototype.slice.call(arguments))}function t(){var e=4022871197,n=function(r){r=r.toString();for(var s=0;s<r.length;s++){e+=r.charCodeAt(s);var o=.02519603282416938*e;e=o>>>0,o-=e,o*=e,e=o>>>0,o-=e,e+=o*4294967296}return(e>>>0)*23283064365386963e-26};return n.version="Mash 0.9",n}})});function KG(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var ol,Jv,fa,lm=B(()=>{ii();q();rh();kv();$i();ol=new Nt,Jv=new M;fa=class extends Yt{constructor(e,n,r){super(e,n,r);this.data=n;this.hiddenMatrixOld=new te;this.smoothShading=!0;this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:s,subdivPointer:o}=Yn.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=o,r!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=r),s!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=s??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qa(this),Ja(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||Yn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0,r),this.subdividedGeometry&&Yn.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=Yn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Yn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qa(this),Ja(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;ol.setFromBufferAttribute(n),ol.getCenter(r),e.boundingSphere.radius=r.distanceTo(ol.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ol.getSize(Jv),this.hasNonUniformScale&&Jv.divide(this.scale);let s={width:Jv.x,height:Jv.y,depth:Jv.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let n=this.originalGeometry;ol.min.set(e[0],e[2],e[4]),ol.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(ol.min.applyMatrix4(this.shearScaleInv),ol.max.applyMatrix4(this.shearScaleInv)),n.boundingSphere===null&&(n.boundingSphere=new nr);let r=n.boundingSphere.center;ol.getCenter(r),n.boundingSphere.radius=r.distanceTo(ol.max)}freeSubdivPointer(){this.subdivPointer&&(Yn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry,r=n?.uuid,s=n?.userData.parameters,o=e.subdivisions>0?Yn.buildRefined(this.subdivPointer,e.subdivisions,this.smoothShading?e.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=o??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qa(this),Ja(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&&Vw(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(n):this.createGeometryByControls(n))}}});function rb(i){if(i.component){let t=i.component.instances.indexOf(i);t>=0&&i.component.instances.splice(t,1);for(let e of i.children)Ot.is(e)&&rb(e)}}var oI=B(()=>{"use strict";Yi()});var z4=qh((iNe,V4)=>{"use strict";function yre(i,t){function e(){this.constructor=i}e.prototype=t.prototype,i.prototype=new e}function ph(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,ph)}yre(ph,Error);ph.buildMessage=function(i,t){var e={literal:function(c){return'"'+r(c.text)+'"'},class:function(c){var u="",d;for(d=0;d<c.parts.length;d++)u+=c.parts[d]instanceof Array?s(c.parts[d][0])+"-"+s(c.parts[d][1]):s(c.parts[d]);return"["+(c.inverted?"^":"")+u+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function n(c){return c.charCodeAt(0).toString(16).toUpperCase()}function r(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function s(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function o(c){return e[c.type](c)}function a(c){var u=new Array(c.length),d,h;for(d=0;d<c.length;d++)u[d]=o(c[d]);if(u.sort(),u.length>0){for(d=1,h=1;d<u.length;d++)u[d-1]!==u[d]&&(u[h]=u[d],h++);u.length=h}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}function l(c){return c?'"'+r(c)+'"':"end of input"}return"Expected "+a(i)+" but "+l(t)+" found."};function vre(i,t){t=t!==void 0?t:{};var e={},n={svg_path:Q},r=Q,s=function(P){if(!P)return[];for(var N=[],H=0;H<P.length;H++)N=N.concat.apply(N,P[H]);var k=N[0];return k&&k.code=="m"&&(delete k.relative,k.code="M"),N},o=function(P,N){return rt(P,N)},a=/^[Mm]/,l=le(["M","m"],!1,!1),c=function(P,N,H){var k=dt(P,[N]);return H&&(k=k.concat(dt(P=="M"?"L":"l",H[1]))),k},u=/^[Zz]/,d=le(["Z","z"],!1,!1),h=function(){return dt("Z")},p=/^[Ll]/,f=le(["L","l"],!1,!1),m=function(P,N){return dt(P,N)},g=/^[Hh]/,y=le(["H","h"],!1,!1),v=function(P,N){return dt(P,N.map(function(H){return{x:H}}))},b=/^[Vv]/,x=le(["V","v"],!1,!1),S=function(P,N){return dt(P,N.map(function(H){return{y:H}}))},E=/^[Cc]/,T=le(["C","c"],!1,!1),w=function(P,N,H){return{x1:P.x,y1:P.y,x2:N.x,y2:N.y,x:H.x,y:H.y}},_=/^[Ss]/,A=le(["S","s"],!1,!1),C=function(P,N){return{x2:P.x,y2:P.y,x:N.x,y:N.y}},R=/^[Qq]/,D=le(["Q","q"],!1,!1),O=function(P,N){return{x1:P.x,y1:P.y,x:N.x,y:N.y}},L=/^[Tt]/,F=le(["T","t"],!1,!1),j=/^[Aa]/,W=le(["A","a"],!1,!1),K=function(P,N,H,k,J,Ee){return{rx:P,ry:N,xAxisRotation:H,largeArc:k,sweep:J,x:Ee.x,y:Ee.y}},Y=function(P,N){return{x:P,y:N}},$=function(P){return P*1},ee=function(P){return P.join("")*1},oe=/^[01]/,ae=le(["0","1"],!1,!1),de=function(P){return P=="1"},be=function(){return""},Re=",",me=Oe(",",!1),Ae=function(P){return P.join("")},Le=".",Ie=Oe(".",!1),Ge=/^[eE]/,Ve=le(["e","E"],!1,!1),pe=/^[+\-]/,Ne=le(["+","-"],!1,!1),we=/^[0-9]/,$e=le([["0","9"]],!1,!1),nt=function(P){return P.join("")},Ce=/^[ \t\n\r]/,je=le([" "," ",`
4143
+ `&&s.push("")):t.getTextWidth(s[s.length-1]+o,i)>r&&(s[s.length-1].length&&s.push(""),t.getTextWidth(s[s.length-1]+o,i)>r&&(o.length===1?(s[s.length-1]+=o,o=""):(s[s.length-1]+=o.slice(0,-1),o=o[o.length-1],s.push(""))));return s[s.length-1]+=o,s}var Ute,kte,Vte,qf,tR=B(()=>{"use strict";qr();pt();kf();q();xf();cc();uc();nh();Ute=oz().attributes,kte=12,Vte=1,qf=class extends Me{constructor(e,n){super();this.isTextGeometry=!0;this.charWidths=[];this.charCoords=[];this.wrappedText=[];this.isLowResolution=!1;this.vectorShapes=[];this._nearSide=new Uint8Array(0);this._depth=0;this._effectiveBevel=0;this._vScale=0;Object.assign(this.attributes,Ute),this.userData={parameters:e,type:"TextGeometry"};let r=n.getFont(e.font);r?.isLoaded?(this.font=r,this.update(e,n)):this.updateFont(e.font,n).then(()=>{this.update(e,n),n?.requestRender()})}async updateFont(e,n){let r=n.getFont(e);r&&(this.font=r,await r.loadingPromise)}update(e,n){let r=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!r?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:s,height:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,text:u,textTransform:d,fontSize:h,extrusionVersion:p}=e,f=Tr.getDisplayedValue(u),m=d===2?f.toUpperCase():d===3?f.toLowerCase():f,g=zte(e,r,m,n),{shapes:y,charWidths:v,charCoords:b}=r.generateShapes(g,e,n),x=(typeof s=="number"?s:Number(n.getVariable(s)))*.5,S=(typeof o=="number"?o:Number(n.getVariable(o)))*.5,E=y.map(_=>new yn().fromShape(_,!0));this.vectorShapes=E;let T=E.map(_=>Ms.create({shape:_,parameters:{depth:a,extrudeBevelSegments:c,extrudeBevelSize:l,uvPitch:p===1?void 0:h,extrusionVersion:p,windingRule:a<=0?Nn.NONZERO:Nn.ODD,subdivisions:this.isLowResolution&&a>0?Vte:kte}})),w=T.length?oa(T):oz();w.translate(-x,S,0),this.dispose(),this.wrappedText=g,this.charCoords=b,this.charWidths=v,this.deleteAttribute("extrudeNormal"),Object.entries(w.attributes).forEach(([_,A])=>{this.setAttribute(_,A)}),this.setIndex(w.index),this.adoptNearSide(T,a),this.computeBoundingSphere()}adoptNearSide(e,n){this._depth=n;let r=0,s=0,o=0;for(let c of e){let u=c,d=u._nearSide;if(d===void 0||d.length===0){this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0;return}r+=d.length,s=Math.max(s,u._effectiveBevel??0),o=u._vScale??o}this._effectiveBevel=s,this._vScale=o;let a=new Uint8Array(r),l=0;for(let c of e){let u=c._nearSide;a.set(u,l),l+=u.length}this._nearSide=a}takeDepthStateFrom(e){let n=e;n._nearSide!==void 0&&(this._depth=n._depth??this._depth,this._nearSide=n._nearSide,this._vScale=n._vScale??this._vScale,this._effectiveBevel=n._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length!==this.getAttribute("position")?.count?!1:th(this._effectiveBevel,e)&&th(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let n=e-this._depth;if(this._depth=e,n===0)return!0;let r=this.getAttribute("position"),s=r.array,o=this.getAttribute("uv"),a=o?.array,l=this._vScale>0?n/this._vScale:0,c=this._nearSide;for(let u=0;u<c.length;u++){let d=c[u];d!==0&&(s[u*3+2]+=n,d===2&&a!==void 0&&(a[u*2+1]+=l))}return r.needsUpdate=!0,o!==void 0&&l!==0&&(o.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let n=this.boundingBox;n.min.z=Math.min(0,e),n.max.z=Math.max(0,e),this.boundingSphere!==null&&n.getBoundingSphere(this.boundingSphere)}clone(){let e=Wr(new Me,qf.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 cz(i){if(az)return;if(Lw)return Lw;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.78/build"),s=import("./process.js"),[o,a]=await Promise.all([s,fetch(`${n}/process.wasm`).then(u=>u.arrayBuffer())]),l=o.default,c=await l({wasmBinary:a});lz(c),az=!0}return Lw=t(),Lw}var lz,Nw,az,Lw,Lv=B(()=>{Nw=new Promise(i=>{lz=i}),az=!1});function Bw(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 l of n){let c=i.attributes[l],u=t.attributes[l];if(c===void 0||c.isInterleavedBufferAttribute===!0||u.isInterleavedBufferAttribute===!0||c.itemSize!==u.itemSize||c.normalized!==u.normalized||c.array.constructor!==u.array.constructor||c.array.length!==u.array.length)return!1}let r=i.index,s=t.index;if(r===null!=(s===null))return!1;let o=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let l=r.array.constructor,c=s.array.constructor;if(l!==c){if(l!==Uint32Array||c!==Uint16Array)return!1;o=!0}}if(i.groups.length!==t.groups.length)return!1;for(let l=0;l<t.groups.length;l++){let c=i.groups[l],u=t.groups[l];if(c.start!==u.start||c.count!==u.count||c.materialIndex!==u.materialIndex)return!1}for(let l of n){let c=i.attributes[l],u=t.attributes[l];c.array.set(u.array),c.needsUpdate=!0}let a=i.takeDepthStateFrom;if(typeof a=="function"&&a.call(i,t),r!==null&&s!==null){if(o){let l=r.array,c=s.array;for(let u=0,d=c.length;u<d;u++){let h=c[u];l[u]=h===65535?4294967295:h}}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 Nv(i,t,e,n){let r=i.position.array,s=i.normal.array,o=Gte.makeScale(t,e,n).invert().elements,a,l,c;for(let u=0,d=r.length;u<d;u+=3)r[u]*=t,r[u+1]*=e,r[u+2]*=n,a=s[u],l=s[u+1],c=s[u+2],s[u]=o[0]*a+o[4]*l+o[8]*c,s[u+1]=o[1]*a+o[5]*l+o[9]*c,s[u+2]=o[2]*a+o[6]*l+o[10]*c;i.position.needsUpdate=!0,i.normal.needsUpdate=!0}var Gte,nR=B(()=>{"use strict";q();Gte=new te});function aR(i){let t=Number(i);return Number.isInteger(t)&&t>=0&&String(t)===i?t:-1}function jte(i){let t=Object.keys(i),e=0;for(let r of t){let s=aR(r);s>=e&&(e=s+1)}if(e===0||e>t.length)return;let n=new Array(e);for(let r=0;r<e;r++){let s=i[r];if(typeof s!="number")return;n[r]=s}return n}function Uw(i){if(i!=null){if(Array.isArray(i)||ArrayBuffer.isView(i)&&!(i instanceof DataView))return i;if(typeof i=="object")return jte(i)}}function rR(i){if(i==null)return"missing";if(Array.isArray(i))return`Array(${i.length})`;if(ArrayBuffer.isView(i)){let l=i;return`${i.constructor.name}(${l.length})`}if(typeof i!="object")return typeof i;let t=Object.keys(i),e=t.filter(l=>aR(l)===-1),n=0;for(let l of t){let c=aR(l);c>=n&&(n=c+1)}let r=i,s=-1,o=-1;for(let l=0;l<n;l++)l in r?typeof r[l]!="number"&&o===-1&&(o=l):s===-1&&(s=l);let a=[`${t.length} keys`,`max index ${n-1}`];return s!==-1&&a.push(`first missing index ${s}`),o!==-1&&a.push(`non-number at ${o} (${typeof r[o]})`),e.length&&a.push(`stray keys ${e.slice(0,3).join(",")}`),`Object{${a.join(", ")}}`}function Vw(i){let t=Object.keys(i);return t.length===1&&t[0]==="subdivisions"}function Bv(i,t){let e=t?t.count:i.count,n=0,r=1e4,s=new Map,o=new Uint32Array(e),a=[];for(let u=0;u<e;u++){let d=t?t.getX(u):u,h=i.getX(d),p=i.getY(d),f=i.getZ(d),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),a.push(h,p,f)),o[u]=x}let l=[],c=[];for(let u=0;u<o.length;u+=3)o[u]===o[u+1]||o[u]===o[u+2]||o[u+1]===o[u+2]||(l.push(o[u],o[u+1],o[u+2]),c.push(t?t.getX(u):u,t?t.getX(u+1):u+1,t?t.getX(u+2):u+2));return{positions:a,triIndices:l,triOriginals:c}}function Hte(i,t,e,n,r){let s=[],o=[],a=r?e.getAttribute("uv"):void 0,l=a&&a.itemSize===2?[]:void 0,c=h=>{if(l){let p=r[h];l.push(a.getX(p),a.getY(p))}};if(e.userData.shape!==void 0&&e.userData.parameters.depth===0&&e.userData.shape.shapeHoles.length===0){let h=e.userData.shape.extractShapePointsToFlatArray([]),p=e.userData.parameters.spikes;if(e.userData.type==="EllipseGeometry"&&p<=24&&p%4===0&&e.userData.parameters.angle>=360){let 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 o.push(m),{indices:s,verticesPerFace:o}}let u=new Float32Array([e.userData.parameters.depth])[0],d=0;for(;d<t.length;){if(e.useNgonForTopBottomFaceDuringBake){let h=0;if((i[t[d]*3+2]===u||i[t[d]*3+2]===0)&&h++,(i[t[d+1]*3+2]===u||i[t[d+1]*3+2]===0)&&h++,(i[t[d+2]*3+2]===u||i[t[d+2]*3+2]===0)&&h++,h===3)break}if(t[d+1]===t[d+3]&&t[d+2]===t[d+5]||t[d+0]===t[d+3]&&t[d+2]===t[d+4]){kw.set(i[t[d]*3],i[t[d]*3+1],i[t[d]*3+2]),iR.set(i[t[d+1]*3],i[t[d+1]*3+1],i[t[d+1]*3+2]),sR.set(i[t[d+4]*3],i[t[d+4]*3+1],i[t[d+4]*3+2]),oR.set(i[t[d+5]*3],i[t[d+5]*3+1],i[t[d+5]*3+2]),iR.sub(kw).normalize(),sR.sub(kw).normalize(),oR.sub(kw).normalize();let h=iR.cross(sR).dot(oR),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),o.push(3),d+=3):(s.push(t[d],t[d+1],t[d+4],t[d+5]),c(d),c(d+1),c(d+4),c(d+5),o.push(4),d+=6)}else s.push(t[d],t[d+1],t[d+2]),c(d),c(d+1),c(d+2),o.push(3),d+=3}if(e.useNgonForTopBottomFaceDuringBake){let h=[],p=[],f=0;for(let 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),o.push(f,f),l=void 0}return{indices:s,verticesPerFace:o,uvs:l}}var Fw,Xf,gt,uz,dz,hz,Yn,kw,iR,sR,oR,rh=B(()=>{"use strict";q();Lv();pt();Fv();nR();Of();Fw=new Nt,Xf=new M;Nw.then(i=>{gt=i});uz=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),dz=new Uint32Array([0,1,2,3]),hz=new Uint8Array([4]);Yn=class extends Me{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=po.div(n.map(l=>typeof l=="number"?l:0),r);if(s.every(l=>l===1))return;this.subdividedGeometry&&Nv(this.subdividedGeometry.attributes,...s),this.originalGeometry&&Nv(this.originalGeometry.attributes,...s),this.data=e;let o=this.userData.parameters;this.userData.parameters={width:o.width*s[0],height:o.height*s[1],depth:o.depth*s[2]},this.originalGeometry.boundingSphere.center.multiply(Xf.fromArray(s));let a=Xf.set(o.width,o.height,o.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let n=e.phongAngle??35;this.flatShading&&(n=-1);let r=null;if(e.subdivisions>0){let o=0;try{o=Yn.allocate(e),r=Yn.buildRefined(o,e.subdivisions,n)}catch(a){console.error(a,e)}finally{o&&Yn.freeSubdivPointer(o)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let s=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=s}rebuild(){let e,n,r;try{({originalGeometry:e,subdividedGeometry:n,subdivPointer:r}=Yn.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&&(Yn.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;Fw.setFromBufferAttribute(n),Fw.getCenter(r),e.boundingSphere.radius=r.distanceTo(Fw.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Fw.getSize(Xf);let s={width:Xf.x,height:Xf.y,depth:Xf.z};return this.userData.parameters=s,s}static build(e,n,r,s){let o,a,l=e?.phongAngle??35;r===!1&&(l=-1),n&&(gt.free_bvh(n),gt.free_subdivision_surface(n));try{o=Yn.allocate(e,s)}catch(u){console.error(u,e),o=Yn.allocate({positionWASM:uz,indexWASM:dz,verticesPerFaceWASM:hz},s)}gt.set_destination_refinement_level(o,0);let c=Yn.buildLevel(o,!0,l);return e.subdivisions>0?a=Yn.buildRefined(o,e.subdivisions,l):a=null,{subdivPointer:o,originalGeometry:c,subdividedGeometry:a}}static buildRefined(e,n,r){try{return gt.set_destination_refinement_level(e,n),Yn.buildLevel(e,!1,r)??null}catch{try{return gt.set_destination_refinement_level(e,n-1),Yn.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:Po(e,r,!1,n),o;J1(e)?o=s.getClosedTorusIndicesForBooleanOrSubdiv():o=s.getIndex();let{positions:a,triIndices:l,triOriginals:c}=Bv(s.getAttribute("position"),o),u;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let f=e.radialSegments*e.heightSegments*3*2,m=f+e.radialSegments*3;u=[f,m]}let{indices:d,verticesPerFace:h,uvs:p}=Hte(a,l,s,u,c);return{positions:a,indices:d,verticesPerFace:h,uvs:p}}static allocate(e,n){let r,s,o,a=[],l=[],c=Uw(e.positionWASM),u=Uw(e.indexWASM),d=Uw(e.verticesPerFaceWASM);if(c&&c.length>0){if(!u?.length||!d?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${rR(e.positionWASM)}, indexWASM ${rR(e.indexWASM)}, verticesPerFaceWASM ${rR(e.verticesPerFaceWASM)}`);r=c,s=u,o=d;let _=Uw(e.uvWASM);gt.alloc_subdivision_surface_uvs&&_&&_.length===s.length*2&&(l=_)}else r=uz,s=dz,o=hz;let h=r.length,p=s.length,f=o.length,m=r.length+a.length+l.length,g=s.length+o.length,y=m*Float32Array.BYTES_PER_ELEMENT+g*Uint32Array.BYTES_PER_ELEMENT,v=m*Float32Array.BYTES_PER_ELEMENT,b=gt._malloc(y);if(!b)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${y}) failed`);let x=new Float32Array(gt.HEAPF32.buffer,b,m),S=new Uint32Array(gt.HEAPU32.buffer,b+v,g);x.set(r,0),x.set(a,r.length),x.set(l,r.length+a.length),S.set(s,0),S.set(o,s.length);let E;e?.scaleBaked?.some(_=>_!==1)&&(E=new te().makeScale(...e.scaleBaked.map(_=>typeof _=="number"?_:1))),n&&(E?E.premultiply(n):E=n);let T=b+(r.length+a.length)*Float32Array.BYTES_PER_ELEMENT,w=l.length?E?gt.alloc_subdivision_surface_uvs2(b,h,b+v,p,b+v+s.length*Uint32Array.BYTES_PER_ELEMENT,f,T,l.length,E.elements):gt.alloc_subdivision_surface_uvs(b,h,b+v,p,b+v+s.length*Uint32Array.BYTES_PER_ELEMENT,f,T,l.length):E?gt.alloc_subdivision_surface2(b,h,b+v,p,b+v+s.length*Uint32Array.BYTES_PER_ELEMENT,f,E.elements):gt.alloc_subdivision_surface(b,h,b+v,p,b+v+s.length*Uint32Array.BYTES_PER_ELEMENT,f);return gt._free(b),w}static buildLevel(e,n,r,s,o,a=!1){let l=o?gt.get_mesh_data2(e,n?gt.Level.CONTROL:gt.Level.REFINED,r,o.elements):gt.get_mesh_data(e,n?gt.Level.CONTROL:gt.Level.REFINED,r),c=10,u=gt.HEAPU32.subarray(l>>2,(l>>2)+c),d=u.subarray(4,4+4),h=0,p=gt.HEAPU32[u[h]>>2],f=gt.HEAPF32.subarray(p>>2,(p>>2)+d[h]);h++;let 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 T=u[9];if(T>0){let w=gt.HEAPU32[u[8]>>2];S=gt.HEAPF32.subarray(w>>2,(w>>2)+T)}}if(s===void 0){let T=new Me;if(T.setIndex(new Us(x,1)),T.setAttribute("position",new Be(f,3)),T.setAttribute("normal",new Be(g,3)),S&&T.setAttribute("uv",new Be(S,2)),n){T.setAttribute("faceMap",new Us(v,1));let w=new Float32Array(g.length/3*4).fill(0);T.setAttribute("color",new Ue(w,4))}return gt.free_mesh_data(l),T.userData.type="SubdivGeometry",T}if(s.getAttribute("position").copyArray(f),s.getAttribute("normal").copyArray(g),s.attributes.position.needsUpdate=!0,s.attributes.normal.needsUpdate=!0,a){let T=s.getIndex();T!==null&&T.array.length===x.length&&(T.copyArray(x),T.needsUpdate=!0)}let E=s.getAttribute("uv");S&&E&&E.array.length===S.length&&(E.copyArray(S),E.needsUpdate=!0),gt.free_mesh_data(l)}static freeSubdivPointer(e){gt.free_bvh(e),gt.free_subdivision_surface(e)}static buildControlCageWireframe(e,n,r){let s=gt.get_wireframe_data_for_base_level(e),o=4,a=gt.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+2),c=0,u=gt.HEAPU32[a[c]>>2],d=gt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let h=gt.HEAPU32[a[c]>>2],p=gt.HEAPU32.subarray(h>>2,(h>>2)+l[c]);if(n===void 0){let f=new Me;f.setAttribute("position",new Be(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 Ue(m,3)),f.setIndex(new Us(p,1)),gt.free_wireframe_data_for_base_level(s),f}n.getAttribute("position").copyArray(d),n.attributes.position.needsUpdate=!0,gt.free_wireframe_data_for_base_level(s)}static updateCollabMesh(e,n,r){let s=n===0;s||gt.set_destination_refinement_level(e,n);let o=r?gt.get_topological_data2(e,s?gt.Level.CONTROL:gt.Level.REFINED,r.elements):gt.get_topological_data(e,s?gt.Level.CONTROL:gt.Level.REFINED),a=8,l=gt.HEAPU32.subarray(o>>2,(o>>2)+a),c=l.subarray(3,3+3),u=0,d=gt.HEAPU32[l[u]>>2],h=new Float32Array(gt.HEAPF32.subarray(d>>2,(d>>2)+c[u]));u++;let p=gt.HEAPU32[l[u]>>2],f=new Uint32Array(gt.HEAPU32.subarray(p>>2,(p>>2)+c[u]));u++;let 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(o),{positions:h,indices:f,verticesPerFace:g,uvs:y}}};kw=new M,iR=new M,sR=new M,oR=new M});var lR,zw,cR=B(()=>{"use strict";b2();w2();Ev();T2();Rv();Of();V2();z2();j2();Iw();q2();Dv();X2();Y2();K2();Dw();Z2();Q2();J2();eR();uc();Qt();b2();w2();Ev();T2();Rv();iz();Of();V2();z2();j2();Iw();q2();Dv();X2();Y2();K2();Dw();Z2();Q2();J2();eR();uc();sz();F2();tR();rh();Lv();bv();nh();lR={ConeGeometry:oV,CubeGeometry:aV,CylinderGeometry:mw,DodecahedronGeometry:lV,EllipseGeometry:jf,HelixGeometry:Ak,IcosahedronGeometry:qV,LatheGeometry:XV,NonParametricGeometry:$V,PolygonGeometry:Rw,PyramidGeometry:KV,RectangleGeometry:Wf,SphereGeometry:ZV,PlaneGeometry:QV,BackdropGeometry:JV,StarGeometry:Ow,TextFrameGeometry:ez,TorusGeometry:tz,TorusKnotGeometry:nz,TriangleGeometry:rz,VectorGeometry:Ms},zw=i=>{let t=lR[i.type]??G1(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 Po(i,t,e,n){let r,s,o;i.type==="PathGeometry"?(s={...i,extrusion:{...i.extrusion}},o=[[],["extrusion"]]):(s={...i},o=[[]]);for(let c of o){let u=s;for(let d of c)u=u[d];for(r in u){let d=u[r];ZC(d)&&!Wte.includes(r)&&(u[r]=t.getVariable(d,[n.uuid,"geometry",...c,r]),ZC(u[r])&&(u[r]=1))}}let a={parameters:s,type:s.type};if(s.type==="PathGeometry"){a.path=s.path;let c=n.profileShape;c!==void 0&&(a.shapeData=c),a.ownerId=n.uuid}else if(s.type==="VectorGeometry"){let c=yn.createFromState(s.shape,s.width,s.height);a.shape=c,a.ownerId=n.uuid}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),a.geometry=new Ed().parse(s),a.geometry.groups.length===0){let c=a.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else if(s.type==="SubdivGeometry"){let c=new Yn(s,e);return c.data=i,c}else if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=G1(s.type);if(c)return c.create(s,t);Jn("text",`a ${s.type}`);let u=yn.createFromState(Vd.defaultData(),100,100);return zw({...s,shape:u,type:"VectorGeometry"})}else if(s.type==="UIGeometry")return Wf.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}});let l;try{l=zw(a)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${a}`);let u=yn.createFromState(Vd.defaultData(),100,100);a.shape=u,a.type="VectorGeometry",l=zw(a)}return l}var Wte,Fv=B(()=>{"use strict";pt();q();cR();Qt();Dv();cc();rh();Wte=["font"]});var uR,Uv,pz=B(()=>{"use strict";Fv();uR=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()}},Uv=class extends uR{constructor(e){super();this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,n,r){let s=Po(e,n,this.flatShading,r);return s.computeBoundingSphere(),s}}});function yz(i){Gw=i}function Yf(){return Gw}function vz(i){dR=i}function bz(){if(Gw==="webgpu"){if(fz!==void 0)return fz;mz||(mz=!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(dR===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 dR}function jw(i,t){return bz().createRootMaterial(i,t)}function pR(i,t,e){return bz().createSharedMaterial(i,t,e)}function fR(i){return i.getLayersOfType===void 0&&Object.assign(i,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),i}function Sz(i){xz=i}function wz(){let i=Gw==="webgpu"&&gz!==void 0?gz:xz;return i===void 0?null:fR(i())}function Hw(){return qte}function Ez(i){hR=i}function Tz(i,t){return hR===void 0?!1:hR(i,t)}var Gw,fz,dR,mz,gz,xz,qte,hR,dc=B(()=>{Gw="webgl",mz=!1});var Mz,_z=B(()=>{"use strict";Mz={markNeedsUpdateRendererDirty:()=>{}}});function Ka(i,t){let e=0;if(!i.layers||i.layers.length===0)return!1;let n=i.layers?.find(r=>r.data.type==="light");if(n){let r=n.data,s=Number(t.getVariable(r.alphaOverride));if((typeof r.alphaOverride=="string"?s/100:r.alphaOverride)<1)return!0}for(let r of i.layers){if(r.data.type!=="displace"&&r.data.isMask)return!0;if(r.data.type!=="displace"&&"alpha"in r.data&&r.data.type!=="light"&&r.data.type!=="fresnel"&&r.data.type!=="cavity"&&r.data.type!=="dust"&&r.data.type!=="texture"&&r.data.type!=="matcap"&&r.data.type!=="rainbow"&&r.data.type!=="outline"&&r.data.type!=="pattern"){let s=r.data.visible?r.data.alpha:0;if(typeof s=="string"&&(s=Math.max(0,Math.min(1,Number(t.getVariable(s)??100)/100))),s===1&&r.data.type==="depth"||r.data.type==="gradient"){for(let o of r.data.colors)if(o[3]<1){s=o[3];break}}else if(s===1&&r.data.type==="noise"){let o=t.color(r.data.colorA).a,a=t.color(r.data.colorB).a,l=t.color(r.data.colorC).a,c=t.color(r.data.colorD).a,u=Math.min(o,Math.min(a,Math.min(l,c)));u<1&&(s=u)}e+=(1-e)*s}}return e<1}var Ww=B(()=>{"use strict"});function mR(i){let t=typeof i=="string"?i:i.type;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function da(i){return typeof i=="string"||typeof i=="number"&&i!==0}var Ro,Ke,$f,Az,Za=B(()=>{"use strict";Ro=(i,t,e)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof i=="number"?i*100:i,e)??100)/100))??1,Ke=(i,t,e)=>typeof i=="number"?i:t.getVariable(i,e);$f={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"]},Az={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}});var gR,Xte,Yr,ih=B(()=>{"use strict";q();Af();gR=class extends _f(Zt){},Xte=i=>i.type==="Mesh",Yr=class extends gR{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 Xte(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 Rz(i){Cz=i}function yR(){return Cz}function Iz(i){Pz=i}function Oz(){return Pz}var Cz,Pz,qw=B(()=>{"use strict";Cz=null,Pz=null});function Xw(i){return"variable_"+i}function Zte(i,t){let e=`${i}/${t}`;Fz.has(e)||(Fz.add(e),console.warn(`[spline] updateObject: ignoring a geometry update of ${i} vertices for a mesh that holds ${t}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}var Dz,Lz,Nz,Kte,Bz,vR,Fz,bR,Tu,cCe,Yw=B(()=>{"use strict";pt();d2();g2();dw();Co();pw();fw();pz();dc();f2();_z();Ww();Za();Yi();ih();an();q();qw();Qt();Dz=new te,Lz=new M,Nz=new ke,Kte=new M,Bz=new Ht,vR=class extends cw{constructor(e){super();this.shared=e}create(e){return new Lf(e,this.shared)}},Fz=new Set;bR=class{constructor(t,e={},n=!0,r=!1){this.data=t;this.needsJitter=n;this.enableLocalStorageForPersistentVariables=r;this.geometryCache=new Uv(!0);this.geometryCache2=new Uv(!1);this.imageHolderCache=new vR(this);this.thisContext={scene:Mz,shared:this};this.deletedImage=new Ys(A1.emptyImage,this);this.deletedVideo=new Ys(rf.defaultVideo,this);this.materials={};this.images={};this.uiBuffers={};this.videos={};this.colors={};this.audios={};this.particles={};this.fonts={};this.variables={};this.userAPIs={};this.userWebhooks={};this.mouseProperty=null;this.raycastProperty=null;this.requestRender=()=>{this._requestRender&&this._requestRender()};this.transientGeometryKeys=new WeakSet;if(e.images)for(let[s,o]of Object.entries(e.images))this.addImage(s,o);if(e.videos)for(let[s,o]of Object.entries(e.videos))this.addVideo(s,o);if(e.audios)for(let[s,o]of Object.entries(e.audios))this.addAudio(s,o);if(e.particles)for(let[s,o]of Object.entries(e.particles))this.addParticle(s,o);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=pR(An.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,n=!1){this.data=t,this.resetLib(t.lib);for(let{id:r,data:s}of t.variables)this.addVariableHolder(r,s),e&&this.updateVariableHolder(r,s);for(let[r,s]of Object.entries(t.userAPIs??{}))this.addUserAPI(r,s);for(let[r,s]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(r,s);if(!n){for(let[r,s]of Object.entries(t.images))this.addImage(r,s);for(let[r,s]of Object.entries(t.videos))this.addVideo(r,s)}for(let[r,s]of Object.entries(t.colors))this.addColor(r,s);for(let[r,s]of Object.entries(t.lib.materials))this.addMaterial(r,s.asset);for(let[r,s]of Object.entries(t.materials))this.addMaterial(r,s);for(let[r,s]of Object.entries(t.audios))this.addAudio(r,s);for(let[r,s]of Object.entries(t.particles))this.addParticle(r,s);for(let[r,s]of Object.entries(t.fonts))this.addFont(r,s)}addMaterial(t,e){if(e.layers===void 0&&(e={...e,layers:An.defaultTwoLayerData("phong").layers}),this.materials[t]){let n=this.materials[t];n.reset(e,this.thisContext),n.dispose()}else{let n=pR(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}),jw(t,this.thisContext))}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new Ys(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new Ys(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}getEntityTexture(t,e={}){let n=t.material;if(!n)return null;for(let r of Array.isArray(n)?n:[n]){let s=r.root??r;for(let o of s?.data?.layers??[]){let a=o?.data;if(a?.type!=="texture"&&a?.type!=="matcap"||e.layer!==void 0&&o.id!==e.layer&&a.type!==e.layer)continue;let l=a.texture?.image;if(l==null)continue;let c=(typeof l=="string"?this.uiBuffer(l):void 0)??this.image(l);if(!c)continue;let u=c.getTexture(a.texture.wrapping??(a.type==="texture"?1e3:1001),a.texture.minFilter??1008,a.texture.magFilter??1006),d=c.img;return{texture:u,width:d?.width??0,height:d?.height??0,layerId:o.id,layerType:a.type}}}return null}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new Ys(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new ac(e.r,e.g,e.b,e.a):this.colors[t]=new ac(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 gn(0,0,0,0))}else return"a"in t?new gn(t.r,t.g,t.b,t.a):new gn(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 lc)return e;{let n=new lc({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 lc&&e.dispose(),delete this.audios[t])}addFont(t,e){let n=iV();if(n===null){Jn("text","a font asset");return}this.fonts[t]=new n(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof lc&&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(Xw(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(Xw(t),JSON.stringify(e));let n=e;for(;typeof n=="string";)n=this.variables[n].value;let r=this.entityOpContext.scene,s=!1;for(let o=this.variables[t].locations.length-1;o>=0;o--){let a=this.variables[t].locations[o];if(a[0]==="material"){let l=a[1],c=n,u={scene:r,shared:this},d=a.slice(2);r.traverseMaterial(p=>{let f=p.root??p;f.uuid===l&&f.onVariableUpdate(d,c,u)});let h=this.materials[l];h&&h.onVariableUpdate(d,c,u)}else{let l=r.find(a[0]);if(l===void 0){this.variables[t].locations.splice(o,1);continue}if(s=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let c=1;c<a.length-1;c++)l=l[a[c]];a[1]==="rotation"?l[a[a.length-1]]=n*ge.DEG2RAD:l[a[a.length-1]]=n}if(l=r.find(a[0]),l.type==="ParticleEmitter"&&l.updateVariableState(n,a),Ot.is(l))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")l.onVariableUpdate();else if(a[1]==="geometry"){let c=l;l.component&&(c=l.component);let u=c.dataPatched;c.chooseGeoemtryCache(this).forceDelete(u.geometry),c.createGeometryDelayed(this.entityOpContext),c.onVariableUpdate(!0),c.invalidateDownstreamBooleanData(),c.instances.forEach(d=>{let h=d.dataPatched;d.chooseGeoemtryCache(this).forceDelete(h.geometry),d.createGeometryDelayed(this.entityOpContext),d.onVariableUpdate(!0),d.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&l.updateMorphInfluences(a[2],n)}}return s&&r.markShadowsDirty(),this.requestRender(),!0}updateEntityGeometryParams(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||typeof s.type!="string"||s.type==="VectorGeometry"||s.type==="PathGeometry")return!1;let o=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let u of Object.keys(s))a.set(o(u),u);let l={};for(let[u,d]of Object.entries(e??{})){let h=a.get(o(u));if(h===void 0||h==="type"||h==="font"||h==="shape"||h==="path"||h==="data")continue;if(h==="text"){(typeof d=="string"||typeof d=="number")&&(l[h]={textValue:String(d)});continue}let p=s[h];typeof d=="number"&&isFinite(d)&&(typeof p=="number"||typeof p=="string")&&(l[h]=d)}if(Object.keys(l).length===0)return!1;let c={...s,...l};return n.dataPatched={...r,geometry:c},this.transientGeometryKeys.has(s)&&n.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(c),n.createGeometryDelayed(this.entityOpContext),n.onVariableUpdate(!0),n.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let r=e.dataPatched?.geometry;return!r||!this.transientGeometryKeys.has(r)?!1:(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(r),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0)}updateEntityGeometryVertices(t,e){let n=t;if(n.component&&(n=n.component),typeof n.chooseGeoemtryCache!="function")return!1;let r=n.dataPatched,s=r?.geometry;if(!s||s.type!=="NonParametricGeometry")return!1;let o=e?.vertices;if(o===void 0||typeof o.length!="number"||o.length<9||o.length%3!==0||o.length/3>bR.MAX_TRANSIENT_VERTICES)return!1;let a=o instanceof Float32Array?o:Float32Array.from(o),l=a.length/3,c;if(e.normals!==void 0){if(e.normals.length!==a.length)return!1;c=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}let u;if(e.uvs!==void 0){if(e.uvs.length!==l*2)return!1;u=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}let d;if(e.indices!==void 0){let E=l>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(E.length===0||E.length%3!==0)return!1;for(let T=0;T<E.length;T++)if(E[T]>=l)return!1;d={array:E,itemSize:1,type:E.constructor.name,normalized:!1}}else{let E=s.data,T=E?.index;if(T?.array?.length){let w=(E?.attributes?.position?.array?.length??0)/3;if(l!==w)return Zte(l,w),!1;d=T}}let h=1/0,p=1/0,f=1/0,m=-1/0,g=-1/0,y=-1/0;for(let E=0;E<a.length;E+=3){let T=a[E],w=a[E+1],_=a[E+2];T<h&&(h=T),T>m&&(m=T),w<p&&(p=w),w>g&&(g=w),_<f&&(f=_),_>y&&(y=_)}let v=(E,T)=>({array:E,itemSize:T,type:"Float32Array",normalized:!1}),b={position:v(a,3)};c&&(b.normal=v(c,3)),u&&(b.uv=v(u,2));let x={...s,width: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,o=Math.PI/180,a=!1;if(e===null)for(let l of s)l.transformOverride!==void 0&&(l.transformOverride=void 0,a=!0);else if(Array.isArray(e)){let l=Math.min(e.length,s.length);for(let c=0;c<l;c++){let u=e[c],d=s[c];if(u==null){d.transformOverride!==void 0&&(d.transformOverride=void 0,a=!0);continue}let h=d.transformOverride??{position:[d.position.x,d.position.y,d.position.z],rotation:[d.rotation.x,d.rotation.y,d.rotation.z],scale:[d.scale.x,d.scale.y,d.scale.z]};u.position&&(typeof u.position.x=="number"&&(h.position[0]=u.position.x),typeof u.position.y=="number"&&(h.position[1]=u.position.y),typeof u.position.z=="number"&&(h.position[2]=u.position.z)),u.rotation&&(typeof u.rotation.x=="number"&&(h.rotation[0]=u.rotation.x*o),typeof u.rotation.y=="number"&&(h.rotation[1]=u.rotation.y*o),typeof u.rotation.z=="number"&&(h.rotation[2]=u.rotation.z*o)),u.scale&&(typeof u.scale.x=="number"&&(h.scale[0]=u.scale.x),typeof u.scale.y=="number"&&(h.scale[1]=u.scale.y),typeof u.scale.z=="number"&&(h.scale[2]=u.scale.z)),d.transformOverride=h,d.position.fromArray(h.position),d.rotation.fromArray(h.rotation),d.scale.fromArray(h.scale),d.updateMatrix(),d.hasNonUniformScale&&(d.updateMatrixWorld(),d.updateMatrixWorldRigid())}}else return s.length;return a?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(n),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),s.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let n=t.parent;if(n===null)return;let r=new Yr(t);r.playModeVisible=e.visible!==!1,r.expand(),typeof e.name=="string"&&(r.name=e.name);let s=Math.PI/180;return r.position.copy(t.position),r.rotation.copy(t.rotation),r.scale.copy(t.scale),r.hiddenMatrix.copy(t.hiddenMatrix),e.position&&(typeof e.position.x=="number"&&(r.position.x=e.position.x),typeof e.position.y=="number"&&(r.position.y=e.position.y),typeof e.position.z=="number"&&(r.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(r.rotation.x=e.rotation.x*s),typeof e.rotation.y=="number"&&(r.rotation.y=e.rotation.y*s),typeof e.rotation.z=="number"&&(r.rotation.z=e.rotation.z*s)),e.scale&&(typeof e.scale.x=="number"&&(r.scale.x=e.scale.x),typeof e.scale.y=="number"&&(r.scale.y=e.scale.y),typeof e.scale.z=="number"&&(r.scale.z=e.scale.z)),r.updateMatrix(),n.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let n=t.material;if(!n)return!1;let r=[];for(let u of Array.isArray(n)?n:[n]){let d=u.root??u;d&&Array.isArray(d.layers)&&d.data&&!r.includes(d)&&r.push(d)}if(r.length===0)return!1;let s={scene:this.entityOpContext.scene,shared:this},o=u=>u.toLowerCase().replace(/[\s_.-]+/g,""),a=u=>{if(typeof u=="string"){let d=new gn(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 ac?u.setValue(d,new gn(h.r,h.g,h.b,f)):typeof p.setRGBA=="function"?p.setRGBA(h.r,h.g,h.b,f):p.setRGB(h.r,h.g,h.b),!0},c=!1;for(let u of r){let d=u.data.layers??[],h=p=>u.layers.find(f=>f.uuid===p);if(e.color!==void 0){let p=a(e.color),f=d.find(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:Ka(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=$f[f.data.type]??[],y=Object.keys(f.data);for(let[v,b]of Object.entries(p)){if(v==="id"||v==="index"||v==="type")continue;let x=y.find(E=>E===v)??y.find(E=>o(E)===o(v))??v;if(g.includes(x))continue;let S=a(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((T,w)=>{u.onVariableUpdate?.(["layer",f.id,x,E[w]],T,s)}),c=!0}}}}return c&&this.requestRender(),c}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let n=this.entityOpContext.scene.find(t[0]);if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return n.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&n?.getPhysicsLocalMatrix?.(Dz))return Dz.decompose(Lz,Nz,Kte),t[1]==="position"?Lz[t[2]]:(Bz.setFromQuaternion(Nz,n.rotation.order),Bz[t[2]]*ge.RAD2DEG);for(let r=1;r<t.length;r++)n=n[t[r]];return t[1]==="rotation"&&(n*=ge.RAD2DEG),n}for(let n in this.variables){if(e===void 0)break;let r=this.variables[n],s=r.locations?.findIndex(o=>rr.equal(o,e));s!==void 0&&s!==-1&&r.locations.splice(s,1)}if(typeof t=="string"){let n=t,r=t;do{if(r=n,this.variables[n]===void 0)break;let s=this.variables[n].value;e&&this.variables[r]!==void 0&&this.variables[r].locations.push(e),n=s}while(typeof n=="string");return n}else return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,n]of Object.entries(t.images))this.addImage(e,n.asset);for(let[e,n]of Object.entries(t.audios))this.addAudio(e,n.asset);for(let[e,n]of Object.entries(t.particles))this.addParticle(e,n.asset);for(let[e,n]of Object.entries(t.colors))this.addColor(e,n.asset);for(let[e,n]of Object.entries(t.fonts))this.addFont(e,n.asset);for(let[e,n]of Object.entries(t.videos))this.addVideo(e,n.asset);for(let[e,n]of Object.entries(t.variables))this.addVariableHolder(e,n.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,n){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(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,o=this.getUserAPI(t.path[1]);o!==void 0&&o===this.openAIRealtime?o.update(r):o?.update(r,this,s)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let r=e.userWebhooks[t.path[1]];r&&this.getUserWebhook(t.path[1])?.update(r)}}else t.path[0]==="lib"&&this.updateLibByOp(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=Oz();return n===null?(Jn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=n(e,t,this),!1)}else{let n=yR();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=yR();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}},Tu=bR;Tu.MAX_TRANSIENT_VERTICES=6e4;cCe=new Tu(ls.emptyData())});function $w(i){return Jd(i)||i?.isTSLNodeMaterial===!0}function Uz(i){return Uk(i)||i?.isTSLSharedMaterial===!0}var xR=B(()=>{"use strict";ow()});var Mr,Mu=B(()=>{pt();ii();dc();xR();an();qr();Mr=class extends Kt{setMaterialOverride(e,n){this.materialOverride=fR(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),CB(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[s,o]of Object.entries(e.props)){let a=this.material[Number(s)],l=r.shared.material(o);l!==a&&Mr.disposeOneMaterial(a),this.material[Number(s)]=l}else if($t(e.path,["material"])){let s=this.material;!Array.isArray(s)&&typeof s?.updateByOp=="function"&&"material"in n&&typeof n.material!="string"&&s.updateByOp(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 o=n.materials[s];typeof o!="string"&&this.material[s].updateByOp(wr.drop(e,2),o,r)}}}get needsAO(){return this.material!==void 0?(Array.isArray(this.material)?this.material[0]:this.material).hasAO:!1}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&!!this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):(this.layers.mask&1<<9)!==0&&this.layers.set(0)}updateState(e,n){super.updateState(e,n),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let r=this.dataPatched;this.syncShapeBlendNodeLayer();let s;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(s={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let o=this.materialOverride!==void 0;!o&&e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,s),n.scene.markNeedsUpdateRendererDirty()),!o&&(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(l=>n.shared.material(l).getFlavor(r.flatShading,r.side,r.wireframe)),n.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[n.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],n.scene.markNeedsUpdateRendererDirty()));let a=this.data;if(!o&&a.geometry?.type!=="NonParametricGeometry"&&"materials"in a&&a.materials!==void 0&&(this.disposeMaterial(),this.material=n.shared.material(a.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!o&&(e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0))if(Array.isArray(this.material))for(let l=0;l<this.material.length;l++)this.material[l]=this.material[l].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,s);this.syncShadowCatcher(n)}shadowCatcherActive(){let e=this.dataPatched,n=e.geometry?.type;return e.shadowCatcher===!0&&(n==="RectangleGeometry"||n==="PlaneGeometry")}syncShadowCatcher(e){let n=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let r=wz();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){$w(e)&&!Uz(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&RS(this.material).forEach(e=>{Mr.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}});var kz,Vz,zz,Qte,Gz,_u,Jte,ene,Zw,Yt,$i=B(()=>{"use strict";pt();an();Yw();Mu();q();Fv();nh();rh();nR();kz=new M,Vz=new vt,zz=new vt,Qte=new M,Gz=new te,_u=new Gt,Jte=_u.geometry,ene=_u.material,Zw=new M,Yt=class extends Mr{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 te().fromArray(n.bindMatrix),this.bindMatrixInverse=new te)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return e.isTextGeometry!==!0}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof Me&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof Me?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Tu){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 ev.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return ev.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}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}dispose(){super.dispose(),kV(this.uuid),this._posed=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(!(e===void 0||e.sxPrev===void 0))return[e.sxPrev,e.syPrev,e.szPrev]}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=Po(p,n,this.data.flatShading,this)}let o,a,l;s.scaleBaked?[o,a,l]=s.scaleBaked:{width:o,height:a,depth:l}=s;let c=this.localGeometry.userData,u=typeof o=="number"?o:1,d=typeof a=="number"?a:1,h=typeof l=="number"?l:1;c.sxPrev!==void 0&&Nv(this.localGeometry.attributes,u/c.sxPrev,d/c.syPrev,h/c.szPrev),c.sxPrev=u,c.syPrev=d,c.szPrev=h}else if(!this.absorbDepthInteraction(e)){let s={...this.data.geometry,...e},o=Po(s,n,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&Bw(this.localGeometry,o)?o.dispose():(this.localGeometry?.dispose(),this.localGeometry=o)}}absorbDepthInteraction(e){let n=this.localGeometry;if(n?.shiftDepthTo===void 0)return!1;let r=e;if(typeof r.depth!="number")return!1;let s=n.userData?.parameters;if(s===void 0)return!1;for(let o of Object.keys(r))if(o!=="depth"&&r[o]!==s[o])return!1;return n.shiftDepthTo(r.depth)?(s.depth=r.depth,!0):!1}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 Yn&&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&&Vw(e.props)&&this.geometryCreateDeleyed instanceof Yn&&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 Me&&!(this.geometryCreateDeleyed instanceof Yn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let o=r.shared,a=this.chooseGeoemtryCache(o),l=this.geometryCreateDeleyed;if(a.getCached(this._geometryCacheKey)===l&&l.isShared!==!0){let u=this.dataPatched.geometry,d=Po(u,o,this.data.flatShading,this);Bw(l,d)?(d.dispose(),l.computeBoundingSphere(),a.mutateIfUnique(this._geometryCacheKey,u)):(d.computeBoundingSphere(),a.forceDelete(this._geometryCacheKey),a.adopt(u,d),this.geometryCreateDeleyed=d),this._geometryCacheKey=u,s=!0,this.refreshAttachedCloners(r),this.refreshAttachedPaths(r)}}s||(r.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(r)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,n){this.createGeometryDelayed(n)}applyTransientGeometryData(e,n){let r=e.shared,s=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof Me&&!(this.geometryCreateDeleyed instanceof Yn)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let o=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(o.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let c=Po(s,r,this.data.flatShading,this);Bw(a,c)?(c.dispose(),a.computeBoundingSphere(),o.mutateIfUnique(this._geometryCacheKey,s)):(c.computeBoundingSphere(),o.forceDelete(this._geometryCacheKey),o.adopt(s,c),this.geometryCreateDeleyed=c),this._geometryCacheKey=s,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e);return}}n&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(r).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,n){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,n);let r=e.morphTargetInfluences;if(r){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:s,value:o}}of r)this.updateMorphInfluences(s,n.shared.getVariable(o,[this.uuid,"morphTargetInfluences",s]))}super.updateState(e,n)}updateMorphInfluences(e,n){if(this.morphTargetDictionary===void 0)return;let r=this.morphTargetDictionary[e];r!==void 0&&(this.morphTargetInfluences[r]=n)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,n){let r=this.posedGeometry()?.boundingBox;if(r){r.getCenter(e),r.getSize(n).multiplyScalar(.5);return}let s=this.geometry.userData.parameters;this.is2DType||this.isTextType?e.set(0,0,s.depth*.5):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),n.set(s.width,s.height,s.depth??0).multiplyScalar(.5)):s.centerOffset?e.fromArray(s.centerOffset):e.setScalar(0),n.set(s.width,s.height,s.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,n){this.skeleton=e,this.isSkinnedMesh=!0,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let n=new vt,r=this.geometry.attributes.skinWeight;for(let s=0,o=r.count;s<o;s++){n.fromBufferAttribute(r,s);let a=1/n.manhattanLength();a!==1/0?n.multiplyScalar(a):n.set(1,0,0,0),r.setXYZW(s,n.x,n.y,n.z,n.w)}}boneTransform(e,n){let r=this.skeleton;if(r===void 0)return;let s=this.geometry;Vz.fromBufferAttribute(s.attributes.skinIndex,e),zz.fromBufferAttribute(s.attributes.skinWeight,e),kz.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let o=0;o<4;o++){let a=zz.getComponent(o);if(a!==0){let l=Vz.getComponent(o);Gz.multiplyMatrices(r.bones[l].matrixWorld,r.boneInverses[l]),n.addScaledVector(Qte.copy(kz).applyMatrix4(Gz),a)}}return n.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(e,n){let r=this.posedGeometry();if(r===void 0)return!1;_u.geometry=r,_u.material=this.material,_u.matrixWorld.copy(this.matrixWorld);let s=n.length;_u.raycast(e,n);for(let o=s;o<n.length;o++)n[o].object=this;return _u.geometry=Jte,_u.material=ene,!0}posedGeometry(){let e=this.skeleton;if(!this.isSkinnedMesh||e===void 0)return;let n=this.geometry,{position:r,skinIndex:s,skinWeight:o}=n.attributes;if(!r||!s||!o)return;let a=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let p=0;p<e.bones.length;p++){let f=e.bones[p];if(!f||!e.boneInverses[p])return;a.push(...f.matrixWorld.elements)}let l=this._posed;if(l?.source===n&&l.version===r.version&&l.pose.length===a.length&&l.pose.every((p,f)=>p===a[f]))return l.geometry;let c=r.count,u=l?.geometry.attributes.position,d=u?.count===c?u:new Ue(new Float32Array(c*3),3);for(let p=0;p<c;p++)this.boneTransform(p,this.getVertexPosition(p,Zw)),d.setXYZ(p,Zw.x,Zw.y,Zw.z);let h=new Me;h.setAttribute("position",d);for(let p of["normal","uv","uv1"]){let f=n.attributes[p];f&&h.setAttribute(p,f)}return h.setIndex(n.index),h.groups=n.groups,h.drawRange=n.drawRange,h.computeBoundingSphere(),h.computeBoundingBox(),this._posed={source:n,version:r.version,pose:a,geometry:h},h}}});function tne(i){if(i.geometry.attributes.extrudeNormal||!i.geometry.attributes.position||!i.geometry.attributes.normal)return;let t=new Map,e=i.geometry.attributes,n=e.position.array,r=e.normal.array,s=new Float32Array(n.length);for(let o=0;o<n.length;o+=3){let a=`${n[o]}_${n[o+1]}_${n[o+2]}`,l=new M(r[o],r[o+1],r[o+2]);t.has(a)?t.get(a)?.normals.push(l):t.set(a,{normals:[l],result:new M})}t.forEach((o,a)=>{for(let l of o.normals)o.result.add(l);o.result.divideScalar(o.normals.length)});for(let o=0;o<n.length;o+=3){let a=`${n[o]}_${n[o+1]}_${n[o+2]}`,l=t.get(a)?.result;l&&(s[o]=l.x,s[o+1]=l.y,s[o+2]=l.z)}i.geometry.setAttribute("extrudeNormal",new Be(s,3))}function nne(i){if(i.geometry.attributes.extrudeNormals||!i.geometry.attributes.position)return;let e=i.geometry.attributes.position.array,n=new Float32Array(e.length),r=new M;for(let s=0;s<e.length;s+=3)r.set(e[s],e[s+1],e[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;i.geometry.setAttribute("extrudeNormal",new Be(n,3))}function Qa(i){if(Array.isArray(i.material)){for(let t of i.material)if(t.getLayersOfType("outline").length===0)return}else if(!Jd(i.material)||i.material.getLayersOfType("outline").length===0)return;i instanceof Yt&&i.is2DAndNoDepth?nne(i):tne(i)}function SR(i){return Math.min(2047,Math.max(1,Math.round(i*2048)))/2048}function Ja(i){if(!i.geometry.attributes.position)return;let t=i.geometry.attributes,e=t.position.array,n=t.randomColor;if(n!==void 0&&n.count*3===e.length)return;let r=new Float32Array(e.length),s=parseInt(i.uuid.replace(/\D/g,"")),o=[SR(ge.seededRandom(s)),SR(ge.seededRandom(s+1e4)),SR(ge.seededRandom(s+2e4))];for(let a=0;a<e.length;a++)r[a]=o[a%3];i.geometry.setAttribute("randomColor",new Ue(r,3))}var kv=B(()=>{"use strict";q();ow();$i()});function ER(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}function ine(i,t){let e=i.cloner;return e!==void 0&&e.parent===t?e:void 0}function Wz(i,t,e,n){let r=(t.children.length+1)*16;Qw.length<r&&(Qw=new Float32Array(r));let s=0,o=l=>{l.toArray(Qw,s*16),s++},a=t.parameters.hideBase!==!0;a&&o(n),jz.multiplyMatrices(i.hiddenMatrix,i.matrix);for(let l of t.children)!Wa(l)||l.playModeVisible===!1||(Hz.multiplyMatrices(l.hiddenMatrix,l.matrix).multiply(l.pivotMatrix),wR.multiplyMatrices(jz,Hz),!(a&&wR.equals(n))&&o(wR));try{return s===0?0:Lk(e,Qw.subarray(0,s*16))}finally{iw(e)}}var Au,rne,jz,Hz,wR,Qw,_s,Zf=B(()=>{ii();q();bv();kv();Mu();fr();Au=new te,rne=new te,jz=new te,Hz=new te,wR=new te;Qw=new Float32Array(0);_s=class extends Mr{constructor(e,n,r){super(e,n);this.data=n;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.geometry=new Me;this.onAfterRender=(e,n,r,s,o,a)=>{super.onAfterRender(e,n,r,s,o,a),this.recomputeBoolean()};this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,n=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let s=0;s<this.children.length;s++){let o=this.children[s];o instanceof _s&&o.dataPatched.visible===!0&&o.recomputeBoolean(e===!0,n)}this.meshSetAddresses=[];for(let s=0;s<this.children.length;s++){let o=this.children[s];if(o instanceof Kt&&o.dataPatched.visible===!0&&o.geometry.attributes.position?.count>0&&o.geometry.drawRange.count>0&&o.booleanMeshSetAddress!==0){Au.multiplyMatrices(o.hiddenMatrix,o.matrix).multiply(o.pivotMatrix);try{let a=ine(o,this);if(o.booleanMeshSetAddress===-1){if((o.geometry.index??o.geometry.getAttribute("position")).count/3<15e5){let l=Rk(o.geometry,e===!0,n);o.booleanMeshSetAddress=a===void 0||l===-1?l:Wz(o,a,l,Au)}if(o.booleanMeshSetAddress===-1)return;a===void 0&&rw(o.booleanMeshSetAddress,Au),o.booleanMatrixInvOld.copy(Au).invert(),o.booleanWasTransformed=!1}else o instanceof _s&&o.needsTransformForDownstream===!0?(a===void 0?rw(o.booleanMeshSetAddress,Au):o.booleanMeshSetAddress=Wz(o,a,o.booleanMeshSetAddress,Au),o.needsTransformForDownstream=!1):o.booleanWasTransformed===!0&&(rw(o.booleanMeshSetAddress,rne.multiplyMatrices(Au,o.booleanMatrixInvOld)),o.booleanMatrixInvOld.copy(Au).invert(),o.booleanWasTransformed=!1)}catch(a){console.error(a),o.booleanMeshSetAddress=0,o.geometry.userData.booleanOperationDidFail=!0;continue}if(o.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(o.booleanMeshSetAddress),o.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let s=this.geometry;s.dispose(),this.geometry=new Me,this.geometry.userData=s.userData,this.geometry.boundingSphere=s.boundingSphere,this.geometry.setAttribute("position",new Be([],3))}this.geometry.setDrawRange(0,0);return}if(e===!0)return Dk(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new Me,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=Ok(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,Qa(this),Ja(this)}dispose(){super.dispose(),this.geometry.dispose()}}});var Qf,Jf,em=B(()=>{q();Yi();xu();(t=>{function i(e){return Ot.is(e)&&e instanceof Gl}t.is=i})(Qf||(Qf={}));Jf=(i,t)=>class extends _o(i,t){updateState_Light(n,r){if(this.updateState_Entity(n,r),n.color!==void 0&&(this.color=r.shared.color(n.color)),n.intensity!==void 0&&(this.intensity=n.intensity*Math.PI),n.depth!==void 0){let s=this.shadow;s.camera.far=n.depth,s.needsUpdate=!0}n.shadows!==void 0&&(this.castShadow=n.shadows)}}});var As,ds,Vv,hc=B(()=>{Zf();ii();xu();As=i=>i instanceof Kt,ds=i=>i!==null&&i instanceof _s,Vv=i=>$1.is(i)});function vne(i,t){try{let e=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(i),n=r=>Number(e.find(s=>s.type===r)?.value);return new Date(n("year"),n("month")-1,n("day"),n("hour"),n("minute"),n("second"),i.getMilliseconds())}catch{return new Date(NaN)}}function yi(i,t){return t.color(i)}function AR(i=new Date,t){let e=t.format,n=i.getSeconds(),r=i;t&&t.timeZone!==null&&(r=vne(new Date,t.timeZone));let s=r.getHours(),o=r.getMinutes(),a;t.format12h24h==="12ampm"&&(a=s>=12?"PM":"AM");let l=s;t.format12h24h!=="24"&&(l=s%12,l===0&&(l=12));let c,u;switch(e){case"HH:mm:ss":c=[l,o,n];break;case"HH:mm":c=[l,o];break;case"HH":c=[l],a=void 0;break;case"mm":c=[o],a=void 0;break;case"ss":c=[n],a=void 0;break;case"year":u=r.getFullYear();break;case"month":u=r.getMonth()+1;break;case"dayOfYear":u=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=r.getDate();break;case"secondOfDay":u=s*60*60+o*60+n;break;default:console.error("Unknown time format",e),u=0;break}return c!==void 0?{textValue:c,suffix:a}:u}var nE=B(()=>{"use strict"});var rm,eG=B(()=>{"use strict";q();wf();Ef();rm=class extends ja(xy){constructor(e,n=15,r=10066329){super(e,n,r);this.object=e;this.added=!1;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,n){Ha(this.object,rm.geometryHelper,e,n)}}});function bne(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 pc,rE=B(()=>{"use strict";q();eG();em();pc=class extends Jf(gy,rm){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.top=1250,s.bottom=-1250,s.right=1250,s.left=-1250,s.near=-1e4,s.far=2500;let o=new Hl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Hl&&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&&bne(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 PR(i){return i instanceof Mr&&i.needsAO&&!Xi(i)&&i.isDecalObject!==!0}function RR(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 IR(i){return i.getLayersOfType("reflection").filter(t=>t.data.visible).length}function tG(i,t){let e={outline:!1,cavity:!1},n=i.layers.mask&CR,r=t.getLayersOfType("transmission"),s=t.getLayersOfType("outline"),o=IR(t),a=t.getLayersOfType("cavity");return(s.length>0||a.length>0)&&(i.layers.set(8),r.length>0&&i.layers.enable(3),o>0&&i.layers.enable(4),e.outline=s.length>0,e.cavity=a.length>0,Ja(i),Qa(i)),r.length===0&&s.length===0&&a.length===0&&o===0&&i.layers.set(0),n&&i.layers.set(9),!n&&PR(i)&&i.layers.enable(5),RR(i),e}function nG(i,t){if(!t.layers)return!1;let e=i.layers.mask&CR,n=!1,r=t.getLayersOfType("transmission").filter(l=>l.data.visible),s=t.getLayersOfType("outline").filter(l=>l.data.visible),o=IR(t),a=t.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(i.layers.set(3),(s.length>0||a.length>0)&&i.layers.enable(8),o>0&&i.layers.enable(4),n=!0),r.length===0&&s.length===0&&a.length===0&&o===0&&i.layers.set(0),e&&i.layers.set(9),!e&&PR(i)&&i.layers.enable(5),RR(i),n}function rG(i,t){var l;if(!t.layers)return!1;let e=i.layers.mask&CR,n=!1,r=IR(t),s=t.getLayersOfType("transmission").filter(c=>c.data.visible),o=t.getLayersOfType("outline").filter(c=>c.data.visible),a=t.getLayersOfType("cavity").filter(c=>c.data.visible);return r>0&&((l=i.userData).__splinePlanarMirror??(l.__splinePlanarMirror=0),i.layers.set(4),s.length>0&&i.layers.enable(3),(o.length>0||a.length>0)&&i.layers.enable(8),n=!0),r===0&&s.length===0&&o.length===0&&a.length===0&&i.layers.set(0),e&&i.layers.set(9),!e&&PR(i)&&i.layers.enable(5),RR(i),n}function sG(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 Mr)if(Array.isArray(n.material))for(let r=0;r<n.material.length;r++)e(tG(n,n.material[r]));else e(tG(n,n.material))}),t}function oG(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Mr)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)nG(e,e.material[n])&&(t=!0);else nG(e,e.material)&&(t=!0)}),t}function aG(i){let t=!1;return i.traverseEntity(e=>{if(e instanceof Mr)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)rG(e,e.material[n])&&(t=!0);else rG(e,e.material)&&(t=!0)}),t}function Gv(i,t,e,n=!1){let r=i.cloner;if(r){let s=null;if((i.raycast===Gt.prototype.raycast||i.raycast===Kt.prototype.raycast)&&i.isSkinnedMesh!==!0){let o=i.geometry;o&&(o.boundingSphere===null&&o.computeBoundingSphere(),s=o.boundingSphere)}for(let o of r.children){if(s!==null&&(iG.copy(s).applyMatrix4(o.matrixWorld),!t.ray.intersectsSphere(iG)))continue;let a=Sne.copy(o.matrixWorld).invert(),l=wne.copy(t.ray).applyMatrix4(a),c=i.matrixWorld;l.applyMatrix4(c);let u=xne;u.set(l.origin,l.direction),u.near=t.near,u.far=t.far,u.layers.mask=t.layers.mask;let d=u.intersectObject(i,!1);d.length>0&&e.push({...d[0],object:n?o:i})}}}var CR,xne,Sne,wne,iG,OR=B(()=>{"use strict";fr();kv();ii();Mu();q();CR=1<<9;xne=new jl,Sne=new te,wne=new Hi,iG=new nr});var sE,jv,lG=B(()=>{"use strict";q();wf();Ef();sE=class extends ja(vy){constructor(e,n=6710886){super(e,n);this.object=e;this.matrix=e.matrixWorld,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,n){Ha(this.object,sE.geometryHelper,e,n)}update(){if(this.object!==void 0){let e=sE._vector,n=this.object.distance?this.object.distance:1e3,r=n*Math.tan(this.object.angle);this.cone.scale.set(r,r,n),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},jv=sE;jv._vector=new M});var cG,uG,dG,fc,oE=B(()=>{"use strict";q();lG();em();cG=new M,uG=new M,dG=new ke,fc=class extends Jf(fy,jv){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=ge.RAD2DEG*2*this.angle,s.aspect=1,s.near=100,s.far=2500;let o=new Hl(this.shadow.camera);o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof Hl&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),uG.setFromMatrixPosition(this.matrixWorld),dG.setFromRotationMatrix(this.matrixWorld),cG.copy(this.up).applyQuaternion(dG).negate().multiplyScalar(this.distance),this.target.position.copy(uG).add(cG),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,tl=B(()=>{pt();Xs();q();Yi();Co();nE();aa();rE();an();dc();q();Mu();hc();OR();oE();Qt();Zf();Cn=class extends Rf(hr){constructor(e,n,r){super();this.data=n;this.bgColor=new gn(1,1,1,1);this.fog=null;this.backupFog=new ud(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 Ye;this.penumbraSizeArrayCache=null;if(this.super_Entity(e,n),this.personalCamera=new rn(fo,{...jd.defaultData,...n.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new hy(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=dv();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=dv();if(r===null){Jn("ui-2d","a page's UI canvas");return}this.uiCanvas=new r.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,n),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,n){e.color!==void 0&&(this.ambientLight.color=yi(e.color,n)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity*Math.PI),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(n=>{n instanceof _s&&n.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof Mr)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=Gd.isSoft(n);Tz(r,n?.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,n){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let r=this.scene;r.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=yi(e.color,n),this.backupFog.near=e.near,this.backupFog.far=e.far,this.fogMode=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=yi(e.aoColor,n))}updateByOp(e,n,r,s){let o=this.data.uiFrame;super.updateByOp(e,n,r,s);let a=n;$t(e.path,["fog"])?this.updateFog(a.fog,r.shared):$t(e.path,["sky"])?this.updateSky(a.sky,r.shared):$t(e.path,["grading"])?this.gradingState=a.grading??null:$t(e.path,["ao"])?this.updateAo(a.ao,r.shared):$t(e.path,["ambient"])?this.updateAmbientLight(a.ambient,r.shared):$t(e.path,["shadow"])?this.updateShadow(a.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||o!==a.uiFrame)&&this.updateUIFrame(e.props.uiFrame,r)}updateUIFrame(e,n){e?(this.uiCanvas||this.createUICanvas(e,n),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,n){this.updateState_Entity(e,n),e.backgroundColor!==void 0&&this.setBackgroundColor(yi(e.backgroundColor,n.shared)),e.fog!==void 0&&this.updateFog(e.fog,n.shared),e.sky!==void 0&&this.updateSky(e.sky,n.shared),e.grading!==void 0&&(this.gradingState=e.grading),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,n.shared),e.ao!==void 0&&this.updateAo(e.ao,n.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,n){}raycast(e,n){super.raycast(e,n)}switchActiveCamera(e){e instanceof rn&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){let e=this.scene?.find(this.data.publish.playCamera);return e instanceof rn?e: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 pc&&r.visible&&e<Sf&&(this.penumbraSizeArrayCache[e]=r.data.penumbraSize??.5,e+=1),r instanceof fc&&r.visible&&e<cs-Sf&&(this.penumbraSizeArrayCache[Sf+n]=r.data.penumbraSize??.5,n+=1)})}raycastWithClones(e){let n=[],r=s=>{for(let o of s.children){let a=o.cloner;Ot.is(o)&&(o.visible||a?.object.data.visible)&&((As(o)||Vv(o)&&this.scene.enableHelpers&&o.objectHelper.visible)&&(e.intersectObject(o,!1,n),Gv(o,e,n,!0)),r(o))}};return r(this),n}updateEntity2DByOp(e,n,r,s){this.uiCanvas?.updateEntity2DByOp(e,n,r,s)}}});function VR(){return Lne}function DG(i){kR=i}function gE(){if(kR===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 kR}function yE(i){return i?.isWebGPUSplineRenderer===!0}var Lne,kR,zR=B(()=>{"use strict";Lne=null,kR=null});var il,ME=B(()=>{"use strict";q();av();xu();il=class extends _o(Bs,So){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 WG=qh((qR,HG)=>{(function(i,t){typeof qR=="object"?HG.exports=t():typeof define=="function"&&define.amd?define(t):i.Alea=t()})(qR,function(){"use strict";return i.importState=function(e){var n=new i;return n.importState(e),n},i;function i(){return function(e){var n=0,r=0,s=0,o=1;e.length==0&&(e=[+new Date]);var a=t();n=a(" "),r=a(" "),s=a(" ");for(var l=0;l<e.length;l++)n-=a(e[l]),n<0&&(n+=1),r-=a(e[l]),r<0&&(r+=1),s-=a(e[l]),s<0&&(s+=1);a=null;var c=function(){var u=2091639*n+o*23283064365386963e-26;return n=r,r=s,s=u-(o=u|0)};return c.next=c,c.uint32=function(){return c()*4294967296},c.fract53=function(){return c()+(c()*2097152|0)*11102230246251565e-32},c.version="Alea 0.9",c.args=e,c.exportState=function(){return[n,r,s,o]},c.importState=function(u){n=+u[0]||0,r=+u[1]||0,s=+u[2]||0,o=+u[3]||0},c}(Array.prototype.slice.call(arguments))}function t(){var e=4022871197,n=function(r){r=r.toString();for(var s=0;s<r.length;s++){e+=r.charCodeAt(s);var o=.02519603282416938*e;e=o>>>0,o-=e,o*=e,e=o>>>0,o-=e,e+=o*4294967296}return(e>>>0)*23283064365386963e-26};return n.version="Mash 0.9",n}})});function KG(i){let t=!1;return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var ol,Jv,fa,lm=B(()=>{ii();q();rh();kv();$i();ol=new Nt,Jv=new M;fa=class extends Yt{constructor(e,n,r){super(e,n,r);this.data=n;this.hiddenMatrixOld=new te;this.smoothShading=!0;this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,n){let r=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),n.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry?.uuid,{originalGeometry:r,subdividedGeometry:s,subdivPointer:o}=Yn.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=o,r!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=r),s!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=s??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qa(this),Ja(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||Yn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0,r),this.subdividedGeometry&&Yn.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=Yn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Yn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qa(this),Ja(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;ol.setFromBufferAttribute(n),ol.getCenter(r),e.boundingSphere.radius=r.distanceTo(ol.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ol.getSize(Jv),this.hasNonUniformScale&&Jv.divide(this.scale);let s={width:Jv.x,height:Jv.y,depth:Jv.z};return this.geometry.userData.parameters=s,s}updateBoundingSphere(e){let n=this.originalGeometry;ol.min.set(e[0],e[2],e[4]),ol.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(ol.min.applyMatrix4(this.shearScaleInv),ol.max.applyMatrix4(this.shearScaleInv)),n.boundingSphere===null&&(n.boundingSphere=new nr);let r=n.boundingSphere.center;ol.getCenter(r),n.boundingSphere.radius=r.distanceTo(ol.max)}freeSubdivPointer(){this.subdivPointer&&(Yn.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(e){if(this.skipReactionUpdate===!0)return;let n=this.localGeometry,r=n?.uuid,s=n?.userData.parameters,o=e.subdivisions>0?Yn.buildRefined(this.subdivPointer,e.subdivisions,this.smoothShading?e.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=o??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Qa(this),Ja(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&&Vw(e.props)&&this.subdivPointer?this.updateSubdivisionLevel(n):this.createGeometryByControls(n))}}});function rb(i){if(i.component){let t=i.component.instances.indexOf(i);t>=0&&i.component.instances.splice(t,1);for(let e of i.children)Ot.is(e)&&rb(e)}}var oI=B(()=>{"use strict";Yi()});var z4=qh((iNe,V4)=>{"use strict";function yre(i,t){function e(){this.constructor=i}e.prototype=t.prototype,i.prototype=new e}function ph(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,ph)}yre(ph,Error);ph.buildMessage=function(i,t){var e={literal:function(c){return'"'+r(c.text)+'"'},class:function(c){var u="",d;for(d=0;d<c.parts.length;d++)u+=c.parts[d]instanceof Array?s(c.parts[d][0])+"-"+s(c.parts[d][1]):s(c.parts[d]);return"["+(c.inverted?"^":"")+u+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function n(c){return c.charCodeAt(0).toString(16).toUpperCase()}function r(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function s(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+n(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+n(u)})}function o(c){return e[c.type](c)}function a(c){var u=new Array(c.length),d,h;for(d=0;d<c.length;d++)u[d]=o(c[d]);if(u.sort(),u.length>0){for(d=1,h=1;d<u.length;d++)u[d-1]!==u[d]&&(u[h]=u[d],h++);u.length=h}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}function l(c){return c?'"'+r(c)+'"':"end of input"}return"Expected "+a(i)+" but "+l(t)+" found."};function vre(i,t){t=t!==void 0?t:{};var e={},n={svg_path:Q},r=Q,s=function(P){if(!P)return[];for(var N=[],H=0;H<P.length;H++)N=N.concat.apply(N,P[H]);var k=N[0];return k&&k.code=="m"&&(delete k.relative,k.code="M"),N},o=function(P,N){return rt(P,N)},a=/^[Mm]/,l=le(["M","m"],!1,!1),c=function(P,N,H){var k=dt(P,[N]);return H&&(k=k.concat(dt(P=="M"?"L":"l",H[1]))),k},u=/^[Zz]/,d=le(["Z","z"],!1,!1),h=function(){return dt("Z")},p=/^[Ll]/,f=le(["L","l"],!1,!1),m=function(P,N){return dt(P,N)},g=/^[Hh]/,y=le(["H","h"],!1,!1),v=function(P,N){return dt(P,N.map(function(H){return{x:H}}))},b=/^[Vv]/,x=le(["V","v"],!1,!1),S=function(P,N){return dt(P,N.map(function(H){return{y:H}}))},E=/^[Cc]/,T=le(["C","c"],!1,!1),w=function(P,N,H){return{x1:P.x,y1:P.y,x2:N.x,y2:N.y,x:H.x,y:H.y}},_=/^[Ss]/,A=le(["S","s"],!1,!1),C=function(P,N){return{x2:P.x,y2:P.y,x:N.x,y:N.y}},R=/^[Qq]/,D=le(["Q","q"],!1,!1),O=function(P,N){return{x1:P.x,y1:P.y,x:N.x,y:N.y}},L=/^[Tt]/,F=le(["T","t"],!1,!1),j=/^[Aa]/,W=le(["A","a"],!1,!1),K=function(P,N,H,k,J,Ee){return{rx:P,ry:N,xAxisRotation:H,largeArc:k,sweep:J,x:Ee.x,y:Ee.y}},Y=function(P,N){return{x:P,y:N}},$=function(P){return P*1},ee=function(P){return P.join("")*1},oe=/^[01]/,ae=le(["0","1"],!1,!1),de=function(P){return P=="1"},be=function(){return""},Re=",",me=Oe(",",!1),Ae=function(P){return P.join("")},Le=".",Ie=Oe(".",!1),Ge=/^[eE]/,Ve=le(["e","E"],!1,!1),pe=/^[+\-]/,Ne=le(["+","-"],!1,!1),we=/^[0-9]/,$e=le([["0","9"]],!1,!1),nt=function(P){return P.join("")},Ce=/^[ \t\n\r]/,je=le([" "," ",`
4144
4144
  `,"\r"],!1,!1),V=0,_e=0,X=[{line:1,column:1}],ct=0,lt=[],z=0,I;if("startRule"in t){if(!(t.startRule in n))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');r=n[t.startRule]}function Z(){return i.substring(_e,V)}function re(){return He(_e,V)}function he(P,N){throw N=N!==void 0?N:He(_e,V),Ut([xt(P)],i.substring(_e,V),N)}function ye(P,N){throw N=N!==void 0?N:He(_e,V),yt(P,N)}function Oe(P,N){return{type:"literal",text:P,ignoreCase:N}}function le(P,N,H){return{type:"class",parts:P,inverted:N,ignoreCase:H}}function xe(){return{type:"any"}}function Xe(){return{type:"end"}}function xt(P){return{type:"other",description:P}}function Ze(P){var N=X[P],H;if(N)return N;for(H=P-1;!X[H];)H--;for(N=X[H],N={line:N.line,column:N.column};H<P;)i.charCodeAt(H)===10?(N.line++,N.column=1):N.column++,H++;return X[P]=N,N}function He(P,N){var H=Ze(P),k=Ze(N);return{start:{offset:P,line:H.line,column:H.column},end:{offset:N,line:k.line,column:k.column}}}function et(P){V<ct||(V>ct&&(ct=V,lt=[]),lt.push(P))}function yt(P,N){return new ph(P,null,null,N)}function Ut(P,N,H){return new ph(ph.buildMessage(P,N),P,N,H)}function Q(){var P,N,H,k,J;for(P=V,N=[],H=ne();H!==e;)N.push(H),H=ne();if(N!==e)if(H=We(),H===e&&(H=null),H!==e){for(k=[],J=ne();J!==e;)k.push(J),J=ne();k!==e?(_e=P,N=s(H),P=N):(V=P,P=e)}else V=P,P=e;else V=P,P=e;return P}function We(){var P,N,H,k,J,Ee;if(P=V,N=Se(),N!==e){for(H=[],k=V,J=[],Ee=ne();Ee!==e;)J.push(Ee),Ee=ne();for(J!==e?(Ee=Se(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);k!==e;){for(H.push(k),k=V,J=[],Ee=ne();Ee!==e;)J.push(Ee),Ee=ne();J!==e?(Ee=Se(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e)}H!==e?(_e=P,N=o(N,H),P=N):(V=P,P=e)}else V=P,P=e;return P}function Se(){var P,N,H,k,J,Ee;if(P=V,N=it(),N!==e){for(H=[],k=V,J=[],Ee=ne();Ee!==e;)J.push(Ee),Ee=ne();for(J!==e?(Ee=qe(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);k!==e;){for(H.push(k),k=V,J=[],Ee=ne();Ee!==e;)J.push(Ee),Ee=ne();J!==e?(Ee=qe(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e)}H!==e?(_e=P,N=o(N,H),P=N):(V=P,P=e)}else V=P,P=e;return P}function qe(){var P;return P=De(),P===e&&(P=St(),P===e&&(P=br(),P===e&&(P=no(),P===e&&(P=ro(),P===e&&(P=px(),P===e&&(P=fx(),P===e&&(P=Og(),P===e&&(P=yx())))))))),P}function it(){var P,N,H,k,J,Ee,Gn;if(P=V,a.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(l)),N!==e){for(H=[],k=ne();k!==e;)H.push(k),k=ne();H!==e?(k=Jr(),k!==e?(J=V,Ee=tr(),Ee===e&&(Ee=null),Ee!==e?(Gn=ft(),Gn!==e?(Ee=[Ee,Gn],J=Ee):(V=J,J=e)):(V=J,J=e),J===e&&(J=null),J!==e?(_e=P,N=c(N,k,J),P=N):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)}else V=P,P=e;return P}function De(){var P,N;return P=V,u.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(d)),N!==e&&(_e=P,N=h()),P=N,P}function St(){var P,N,H,k;if(P=V,p.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(f)),N!==e){for(H=[],k=ne();k!==e;)H.push(k),k=ne();H!==e?(k=ft(),k!==e?(_e=P,N=m(N,k),P=N):(V=P,P=e)):(V=P,P=e)}else V=P,P=e;return P}function ft(){var P,N,H,k,J,Ee;if(P=V,N=Jr(),N!==e){for(H=[],k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Jr(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);k!==e;)H.push(k),k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Jr(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);H!==e?(_e=P,N=o(N,H),P=N):(V=P,P=e)}else V=P,P=e;return P}function br(){var P,N,H,k;if(P=V,g.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(y)),N!==e){for(H=[],k=ne();k!==e;)H.push(k),k=ne();H!==e?(k=zn(),k!==e?(_e=P,N=v(N,k),P=N):(V=P,P=e)):(V=P,P=e)}else V=P,P=e;return P}function zn(){var P,N,H,k,J,Ee;if(P=V,N=wl(),N!==e){for(H=[],k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=wl(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);k!==e;)H.push(k),k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=wl(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);H!==e?(_e=P,N=o(N,H),P=N):(V=P,P=e)}else V=P,P=e;return P}function no(){var P,N,H,k;if(P=V,b.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(x)),N!==e){for(H=[],k=ne();k!==e;)H.push(k),k=ne();H!==e?(k=zn(),k!==e?(_e=P,N=S(N,k),P=N):(V=P,P=e)):(V=P,P=e)}else V=P,P=e;return P}function ro(){var P,N,H,k;if(P=V,E.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(T)),N!==e){for(H=[],k=ne();k!==e;)H.push(k),k=ne();H!==e?(k=j_(),k!==e?(_e=P,N=m(N,k),P=N):(V=P,P=e)):(V=P,P=e)}else V=P,P=e;return P}function j_(){var P,N,H,k,J,Ee;if(P=V,N=Pg(),N!==e){for(H=[],k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Pg(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);k!==e;)H.push(k),k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Pg(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);H!==e?(_e=P,N=o(N,H),P=N):(V=P,P=e)}else V=P,P=e;return P}function Pg(){var P,N,H,k,J,Ee;return P=V,N=Jr(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(k=Jr(),k!==e?(J=tr(),J===e&&(J=null),J!==e?(Ee=Jr(),Ee!==e?(_e=P,N=w(N,k,Ee),P=N):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e),P}function px(){var P,N,H,k;if(P=V,_.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(A)),N!==e){for(H=[],k=ne();k!==e;)H.push(k),k=ne();H!==e?(k=Rg(),k!==e?(_e=P,N=m(N,k),P=N):(V=P,P=e)):(V=P,P=e)}else V=P,P=e;return P}function Rg(){var P,N,H,k,J,Ee;if(P=V,N=Ig(),N!==e){for(H=[],k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Ig(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);k!==e;)H.push(k),k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Ig(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);H!==e?(_e=P,N=o(N,H),P=N):(V=P,P=e)}else V=P,P=e;return P}function Ig(){var P,N,H,k;return P=V,N=Jr(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(k=Jr(),k!==e?(_e=P,N=C(N,k),P=N):(V=P,P=e)):(V=P,P=e)):(V=P,P=e),P}function fx(){var P,N,H,k;if(P=V,R.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(D)),N!==e){for(H=[],k=ne();k!==e;)H.push(k),k=ne();H!==e?(k=mx(),k!==e?(_e=P,N=m(N,k),P=N):(V=P,P=e)):(V=P,P=e)}else V=P,P=e;return P}function mx(){var P,N,H,k,J,Ee;if(P=V,N=Vo(),N!==e){for(H=[],k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Vo(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);k!==e;)H.push(k),k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Vo(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);H!==e?(_e=P,N=o(N,H),P=N):(V=P,P=e)}else V=P,P=e;return P}function Vo(){var P,N,H,k;return P=V,N=Jr(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(k=Jr(),k!==e?(_e=P,N=O(N,k),P=N):(V=P,P=e)):(V=P,P=e)):(V=P,P=e),P}function Og(){var P,N,H,k;if(P=V,L.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(F)),N!==e){for(H=[],k=ne();k!==e;)H.push(k),k=ne();H!==e?(k=gx(),k!==e?(_e=P,N=m(N,k),P=N):(V=P,P=e)):(V=P,P=e)}else V=P,P=e;return P}function gx(){var P,N,H,k,J,Ee;if(P=V,N=Jr(),N!==e){for(H=[],k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Jr(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);k!==e;)H.push(k),k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=Jr(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);H!==e?(_e=P,N=o(N,H),P=N):(V=P,P=e)}else V=P,P=e;return P}function yx(){var P,N,H,k;if(P=V,j.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(W)),N!==e){for(H=[],k=ne();k!==e;)H.push(k),k=ne();H!==e?(k=Gh(),k!==e?(_e=P,N=m(N,k),P=N):(V=P,P=e)):(V=P,P=e)}else V=P,P=e;return P}function Gh(){var P,N,H,k,J,Ee;if(P=V,N=jh(),N!==e){for(H=[],k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=jh(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);k!==e;)H.push(k),k=V,J=tr(),J===e&&(J=null),J!==e?(Ee=jh(),Ee!==e?(J=[J,Ee],k=J):(V=k,k=e)):(V=k,k=e);H!==e?(_e=P,N=o(N,H),P=N):(V=P,P=e)}else V=P,P=e;return P}function jh(){var P,N,H,k,J,Ee,Gn,Tn,zr,at,Ti,nn;return P=V,N=Dg(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(k=Dg(),k!==e?(J=tr(),J===e&&(J=null),J!==e?(Ee=wl(),Ee!==e?(Gn=tr(),Gn!==e?(Tn=vx(),Tn!==e?(zr=tr(),zr===e&&(zr=null),zr!==e?(at=vx(),at!==e?(Ti=tr(),Ti===e&&(Ti=null),Ti!==e?(nn=Jr(),nn!==e?(_e=P,N=K(N,k,Ee,Tn,at,nn),P=N):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e)):(V=P,P=e),P}function Jr(){var P,N,H,k;return P=V,N=wl(),N!==e?(H=tr(),H===e&&(H=null),H!==e?(k=wl(),k!==e?(_e=P,N=Y(N,k),P=N):(V=P,P=e)):(V=P,P=e)):(V=P,P=e),P}function Dg(){var P,N;return P=V,N=xx(),N===e&&(N=ce()),N!==e&&(_e=P,N=$(N)),P=N,P}function wl(){var P,N,H,k;return P=V,N=V,H=fe(),H===e&&(H=null),H!==e?(k=xx(),k!==e?(H=[H,k],N=H):(V=N,N=e)):(V=N,N=e),N===e&&(N=V,H=fe(),H===e&&(H=null),H!==e?(k=ce(),k!==e?(H=[H,k],N=H):(V=N,N=e)):(V=N,N=e)),N!==e&&(_e=P,N=ee(N)),P=N,P}function vx(){var P,N;return P=V,oe.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(ae)),N!==e&&(_e=P,N=de(N)),P=N,P}function tr(){var P,N,H,k,J;if(P=V,N=[],H=ne(),H!==e)for(;H!==e;)N.push(H),H=ne();else N=e;if(N!==e)if(H=bx(),H===e&&(H=null),H!==e){for(k=[],J=ne();J!==e;)k.push(J),J=ne();k!==e?(N=[N,H,k],P=N):(V=P,P=e)}else V=P,P=e;else V=P,P=e;if(P===e){if(P=V,N=V,H=bx(),H!==e){for(k=[],J=ne();J!==e;)k.push(J),J=ne();k!==e?(H=[H,k],N=H):(V=N,N=e)}else V=N,N=e;N!==e&&(_e=P,N=be()),P=N}return P}function bx(){var P;return i.charCodeAt(V)===44?(P=Re,V++):(P=e,z===0&&et(me)),P}function xx(){var P,N,H,k;return P=V,N=V,H=U(),H!==e?(k=se(),k===e&&(k=null),k!==e?(H=[H,k],N=H):(V=N,N=e)):(V=N,N=e),N===e&&(N=V,H=ce(),H!==e?(k=se(),k!==e?(H=[H,k],N=H):(V=N,N=e)):(V=N,N=e)),N!==e&&(_e=P,N=Ae(N)),P=N,P}function U(){var P,N,H,k,J;return P=V,N=V,H=ce(),H===e&&(H=null),H!==e?(i.charCodeAt(V)===46?(k=Le,V++):(k=e,z===0&&et(Ie)),k!==e?(J=ce(),J!==e?(H=[H,k,J],N=H):(V=N,N=e)):(V=N,N=e)):(V=N,N=e),N===e&&(N=V,H=ce(),H!==e?(i.charCodeAt(V)===46?(k=Le,V++):(k=e,z===0&&et(Ie)),k!==e?(H=[H,k],N=H):(V=N,N=e)):(V=N,N=e)),N!==e&&(_e=P,N=Ae(N)),P=N,P}function se(){var P,N,H,k,J;return P=V,N=V,Ge.test(i.charAt(V))?(H=i.charAt(V),V++):(H=e,z===0&&et(Ve)),H!==e?(k=fe(),k===e&&(k=null),k!==e?(J=ce(),J!==e?(H=[H,k,J],N=H):(V=N,N=e)):(V=N,N=e)):(V=N,N=e),N!==e&&(_e=P,N=Ae(N)),P=N,P}function fe(){var P;return pe.test(i.charAt(V))?(P=i.charAt(V),V++):(P=e,z===0&&et(Ne)),P}function ce(){var P,N,H;if(P=V,N=[],we.test(i.charAt(V))?(H=i.charAt(V),V++):(H=e,z===0&&et($e)),H!==e)for(;H!==e;)N.push(H),we.test(i.charAt(V))?(H=i.charAt(V),V++):(H=e,z===0&&et($e));else N=e;return N!==e&&(_e=P,N=nt(N)),P=N,P}function ne(){var P,N;return P=V,Ce.test(i.charAt(V))?(N=i.charAt(V),V++):(N=e,z===0&&et(je)),N!==e&&(_e=P,N=be()),P=N,P}function rt(P,N){if(!N)return[P];for(var H=[P],k=0,J=N.length;k<J;k++)H[k+1]=N[k][1];return H}var ot={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 tt in ot)ot[tt.toUpperCase()]=ot[tt];function dt(P,N){N||(N=[{}]);for(var H=N.length;H--;){var k={code:P,command:ot[P]};P==P.toLowerCase()&&(k.relative=!0);for(var J in N[H])k[J]=N[H][J];N[H]=k}return N}if(I=r(),I!==e&&V===i.length)return I;throw I!==e&&V<i.length&&et(Xe()),Ut(lt,ct<i.length?i.charAt(ct):null,ct<i.length?He(ct,ct+1):He(ct,ct))}V4.exports={SyntaxError:ph,parse:vre}});var VE=qh((sNe,G4)=>{var kE=z4().parse;kE.parseSVG=kE;kE.makeAbsolute=bre;G4.exports=kE;function bre(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 rj(i){KE.add(i)}function ij(i){if(KE.size===0)return;let t=Array.from(KE);KE.clear();for(let e of t)e.render(i)}var KE,fI=B(()=>{"use strict";KE=new Set});var Xm,D5=B(()=>{"use strict";q();wf();Ef();Xm=class extends ja(by){constructor(e,n=15,r=6710886){super(e,n,r);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,n){Ha(this.object,Xm.geometryHelper,e,n)}}});var _h,kO=B(()=>{"use strict";q();D5();em();_h=class extends Jf(my,Xm){constructor(t,e,n){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let s=this.shadow.camera;s.fov=90,s.aspect=1,s.near=100,s.far=2500;let o=new M(-s.far+this.position.x,-s.far+this.position.y,-s.far+this.position.z),a=new M(s.far+this.position.x,s.far+this.position.y,s.far+this.position.z),l=new Nt(o,a),c=new Wl(l,new Ye(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 Wl){let n=this.shadow.camera,r=new M(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),s=new M(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z);e.box.set(r,s),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});function pW(i){let t=hW.get(i);return t===void 0&&(t=zoe++,hW.set(i,t)),t}function Goe(i){return i.isShared===!0}function joe(i){let t=Wa(i)?i.object:i;return t.geometry!==void 0?t:void 0}function Hoe(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 fW(i){if(i.isMesh!==!0)return"not-a-mesh";if(Xi(i)||vr(i)||la(i)||bu(i))return"excluded-type";let e=joe(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(!Goe(r))return"unshared-geometry";if(r.attributes.position===void 0)return"empty-geometry";if(r.morphAttributes.position!==void 0)return"morph";if(e.isSkinnedMesh===!0)return"skinned";let s=e.morphTargetInfluences;if(s!==void 0&&s.length>0)return"morph";if(r.drawRange.start!==0||r.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let o=n;return o.positionNode!=null||o.castShadowPositionNode!=null?"position-node":o.transparent===!0?"transparent":e.userData?.__splinePlanarMirror!==void 0?"reflection":Hoe(e)?"interaction-states":{object:i,owner:e,geometry:r,material:n,key:Woe(i,e,r,n)}}function Woe(i,t,e,n){let r=i,s=t;return[pW(e),pW(n),r.layers?.mask??0,r.renderOrder??0,(r.castShadow??s.castShadow)===!0?1:0,(r.receiveShadow??s.receiveShadow)===!0?1:0].join(":")}var hW,zoe,mW=B(()=>{"use strict";fr();hW=new WeakMap,zoe=1});function gW(i){for(let t of JO)if(i<=t)return t;return eD}var JO,eD,QO,kM,yW=B(()=>{"use strict";q();JO=[8,32,128,512],eD=JO[JO.length-1];QO=new te().makeScale(0,0,0),kM=class extends Bl{constructor(e,n,r,s){super(e,n,r);this.isInstanceGroup=!0;this.members=new Array(r).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(s);for(let o=0;o<r;o++)this.setMatrixAt(o,QO);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,QO),!1):(this.setMatrixAt(e,n.matrixWorld),!0)}park(e){this.members[e]=null,this.setMatrixAt(e,QO)}get memberCount(){let e=0;for(let n of this.members)n!==null&&e++;return e}}});function vW(i,t){let e=t.get(i);if(e!==void 0)return e;let n=i.visible&&(i.parent===null||vW(i.parent,t));return t.set(i,n),n}var qoe,VM,bW=B(()=>{"use strict";mW();yW();qoe=8,VM=class{constructor(t=qoe){this.minGroupSize=t;this.groups=[];this.groupKeys=new WeakMap;this.placements=new Map;this.visibilityMemo=new Map;this.page=null;this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}}}update(t,e){this.page!==t&&(this.teardown(),this.page=t,e=!0),t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh()}reconcile(t){let e={},n=new Map;t.traverse(o=>{if(o.isInstanceGroup===!0)return;let a=fW(o);if(typeof a=="string"){e[a]=(e[a]??0)+1;return}let l=n.get(a.key);l===void 0?n.set(a.key,[a]):l.push(a)});let r=new Map;for(let[o,a]of n)for(let l of a)r.set(l.object,o);let s=!1;for(let[o,a]of this.placements)r.get(o)!==this.groupKeys.get(a.group)&&this.parkPlacement(o,a);for(let o=this.groups.length-1;o>=0;o--){let a=this.groups[o];a.memberCount>=this.minGroupSize||(this.destroyGroup(a),this.groups.splice(o,1),s=!0)}for(let[o,a]of n){let l=a.filter(u=>!this.placements.has(u.object));if(l.length===0)continue;let c=0;for(let u of this.groups){if(c>=l.length)break;if(this.groupKeys.get(u)!==o)continue;let{members:d}=u;for(let h=0;h<d.length&&c<l.length;h++)d[h]===null&&this.place(u,h,l[c++].object)}for(;l.length-c>=this.minGroupSize;){let u=l.slice(c,c+eD);this.groups.push(this.createGroup(t,o,u)),c+=u.length,s=!0}}s&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=e}createGroup(t,e,n){let r=n[0],s=new kM(r.geometry,r.material,gW(n.length),r.object);this.groupKeys.set(s,e);for(let o=0;o<n.length;o++)this.place(s,o,n[o].object);return t.add(s),s}destroyGroup(t){for(let e=0;e<t.members.length;e++){let n=t.members[e];n!==null&&this.parkPlacement(n,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,n){t.assign(e,n),this.placements.set(n,{group:t,slot:e}),n.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(){this.visibilityMemo.clear();for(let t of this.groups){let{members:e}=t,n=null;for(let r=0;r<e.length;r++){let s=e[r];s!==null&&(n===null&&(n=s),t.writeSlot(r,s,vW(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 Koe(i,t,e){e.length=0;let{axis:n,sign:r,limit:s}=t;for(let o=0;o<i.length;o++){let a=i[o],l=i[(o+1)%i.length],c=(n===0?a.px:n===1?a.py:a.pz)*r-s,u=(n===0?l.px:n===1?l.py:l.pz)*r-s,d=c<=0,h=u<=0;if(d&&e.push(a),d!==h){let p=c/(c-u);e.push({px:a.px+(l.px-a.px)*p,py:a.py+(l.py-a.py)*p,pz:a.pz+(l.pz-a.pz)*p,nx:a.nx+(l.nx-a.nx)*p,ny:a.ny+(l.ny-a.ny)*p,nz:a.nz+(l.nz-a.nz)*p})}}return e}function Zoe(i,t,e,n,r,s,o,a,l){let c=i.geometry,u=c.getAttribute("position");if(u===void 0||u.count===0)return!0;let d=c.getAttribute("normal"),h=c.getIndex(),p=h!==null?h.count:u.count;if(p>Xoe)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;Gb.copy(i.objectToDecal),zM.getNormalMatrix(Gb);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(Cc.fromBufferAttribute(u,x).applyMatrix4(Gb),Hu.fromBufferAttribute(u,S).applyMatrix4(Gb),Wu.fromBufferAttribute(u,E).applyMatrix4(Gb),Cc.z>e&&Hu.z>e&&Wu.z>e||Cc.z<-e&&Hu.z<-e&&Wu.z<-e)continue;Is.subVectors(Hu,Cc),xW.subVectors(Wu,Cc),Ch.crossVectors(Is,xW);let T=Ch.length();if(!(T===0||Ch.z/T<=$oe)){if(y.length=0,d!==void 0)Is.fromBufferAttribute(d,x).applyMatrix3(zM),y.push({px:Cc.x,py:Cc.y,pz:Cc.z,nx:Is.x,ny:Is.y,nz:Is.z}),Is.fromBufferAttribute(d,S).applyMatrix3(zM),y.push({px:Hu.x,py:Hu.y,pz:Hu.z,nx:Is.x,ny:Is.y,nz:Is.z}),Is.fromBufferAttribute(d,E).applyMatrix3(zM),y.push({px:Wu.x,py:Wu.y,pz:Wu.z,nx:Is.x,ny:Is.y,nz:Is.z});else{Ch.divideScalar(T);for(let w of[Cc,Hu,Wu])y.push({px:w.x,py:w.y,pz:w.z,nx:Ch.x,ny:Ch.y,nz:Ch.z})}for(let w of t){if(y.length===0)break;let _=Koe(y,w,v);v=y,y=_}if(!(y.length<3)){if(o.length/3+(y.length-2)*3>Yoe)return!1;for(let w=1;w+1<y.length;w++)for(let _ of[y[0],y[w],y[w+1]]){l.push(_.px*n+.5,_.py*r+.5);let A=_.nx,C=_.ny,R=_.nz,D=Math.hypot(A,C,R);D>0?(A/=D,C/=D,R/=D):(A=0,C=0,R=1),o.push(_.px+A*s,_.py+C*s,_.pz+R*s),a.push(A,C,R)}}}}return!0}function SW(i,t){let e=Math.max(Math.abs(t.width),1e-6),n=Math.max(Math.abs(t.height),1e-6),r=Math.max(Math.abs(t.depth),1e-6),s=[{axis:0,sign:1,limit:e/2},{axis:0,sign:-1,limit:e/2},{axis:1,sign:1,limit:n/2},{axis:1,sign:-1,limit:n/2},{axis:2,sign:1,limit:r/2},{axis:2,sign:-1,limit:r/2}],o=[],a=[],l=[];for(let u of i)if(!Zoe(u,s,r/2,1/e,1/n,t.offset,o,a,l))break;let c=new Me;return c.setAttribute("position",new Be(o,3)),c.setAttribute("normal",new Be(a,3)),c.setAttribute("uv",new Be(l,2)),o.length===0?(c.setDrawRange(0,0),c.boundingSphere=new nr):c.computeBoundingSphere(),c}var Xoe,Yoe,$oe,Gb,zM,Cc,Hu,Wu,Is,xW,Ch,wW=B(()=>{"use strict";q();Xoe=15e5,Yoe=3e5,$oe=.01,Gb=new te,zM=new wt,Cc=new M,Hu=new M,Wu=new M,Is=new M,xW=new M,Ch=new M});var tD,EW,TW,MW,Ph,_W=B(()=>{"use strict";q();an();Mu();ii();Yi();wW();kv();tD=new Nt,EW=new Nt,TW=new te,MW=new M,Ph=class extends Mr{constructor(e,n,r){super(e,n);this.data=n;this.geometry=new Me;this.lastSignature=[];this.nextSignature=[];this.scanned=[];this.lastParams={width:0,height:0,depth:0,offset:0};this.targetFilter=new Set;this.context=r;let s=this.data.geometry;this.lastParams={width:this.resolveNumber(s.width,0),height:this.resolveNumber(s.height,0),depth:this.resolveNumber(s.depth,0),offset:s.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(e,n){if(typeof e=="number")return e;let r=Number(this.context.shared.getVariable(e));return Number.isFinite(r)?r:n}currentParams(){let e=this.dataPatched.geometry;return{width:this.resolveNumber(e.width,this.lastParams.width),height:this.resolveNumber(e.height,this.lastParams.height),depth:this.resolveNumber(e.depth,this.lastParams.depth),offset:e.offset??0}}projectionRoot(){let e=this.parent;for(;e!==null&&Ot.is(e);){if(e.data?.type==="Page")return e;e=e.parent}return this.context.scene}currentTargetFilter(){let e=this.dataPatched.geometry;if(e.projection!=="select")return null;let n=e.projectionTargets;if(n!==this.targetFilterSource&&(this.targetFilterSource=n,this.targetFilter.clear(),n!==void 0))for(let r of n)this.targetFilter.add(r);return this.targetFilter}static matchesTargetFilter(e,n,r){let s=e;for(;s!==null&&s!==r;){if(n.has(s.uuid))return!0;s=s.parent}return!1}scanTargets(e,n,r){let s=this.scanned;s.length=0;let o=this.projectionRoot();if(o===null)return s;let a=this.currentTargetFilter();if(a!==null&&a.size===0)return s;tD.makeEmpty();for(let l=0;l<8;l++)MW.set((l&1?.5:-.5)*e,(l&2?.5:-.5)*n,(l&4?.5:-.5)*r).applyMatrix4(this.matrixWorld),tD.expandByPoint(MW);return o.traverse(l=>{if(l===this||!Ot.is(l)||!(l instanceof Kt)||l instanceof Ph||l.dataPatched?.type!=="Mesh"||!l.visible||l.destroyedInAction||(l.layers.mask&1<<9)!==0||a!==null&&!Ph.matchesTargetFilter(l,a,o))return;let c=l.geometry,u=c?.getAttribute("position");u===void 0||u.count===0||c.drawRange.count!==0&&(c.boundingBox===null&&c.computeBoundingBox(),EW.copy(c.boundingBox).applyMatrix4(l.matrixWorld),tD.intersectsBox(EW)&&s.push(l))}),s}collectSignature(e,n,r){e.length=0,e.push(r.width,r.height,r.depth,r.offset);for(let s of this.matrixWorld.elements)e.push(s);for(let s of n){e.push(s.id,s.geometry.id);let o=s.geometry.getAttribute("position");e.push(o===void 0?-1:"version"in o?o.version:o.data.version);let a=s.geometry.getIndex();e.push(a!==null?a.version:-1),e.push(s.geometry.drawRange.count===1/0?-1:s.geometry.drawRange.count);for(let l of s.matrixWorld.elements)e.push(l)}}signaturesEqual(e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let e=this.currentParams(),n=this.scanTargets(e.width,e.height,e.depth);if(this.collectSignature(this.nextSignature,n,e),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let r=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=r,this.lastParams=e,TW.copy(this.matrixWorld).invert();let s=n.map(a=>({geometry:a.geometry,objectToDecal:new te().multiplyMatrices(TW,a.matrixWorld)}));return this.geometry.dispose(),this.geometry=SW(s,e),this.geometry.userData={type:"DecalGeometry",parameters:{width:e.width,height:e.height,depth:e.depth}},Qa(this),Ja(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 GM,AW=B(()=>{"use strict";q();av();xu();GM=class extends _o(gp,So){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}}});function Qoe(){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 Joe(i,t,e){nD!==void 0&&t?.geometry&&"subdivisions"in t.geometry&&(t.geometry.subdivisions??0)>nD&&Object.assign(t.geometry,{subdivisions:nD});let n;if(t.geometry.type==="TextGeometry"||t.geometry.type==="InputGeometry"){let r=z1(t.geometry.type);return r?r(i,t,e):(Jn(t.geometry.type==="InputGeometry"?"textinputs":"text",`a Mesh with ${t.geometry.type}`),new Yt(i,t,e))}else if(t.geometry.type==="SubdivGeometry")n=new fa(i,t,e);else if(t.geometry.type==="PathGeometry"||t.geometry.type==="VectorGeometry"||t.geometry.type==="ShapeBlendGeometry"){let r=z1(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 Yt(i,t,e))}else if(t.geometry.type==="BooleanGeometry")n=new _s(i,t,e);else if(t.geometry.type==="DecalGeometry")n=new Ph(i,t,e);else if(t.geometry.type==="UIGeometry"){let r=z1("UIGeometry");r?n=r(i,t,e):(Jn("ui-2d","a Mesh with UIGeometry"),n=new Yt(i,t,e))}else n=new Yt(i,t,e);return n}function jM(i,t,e){if(console.assert(t.type!==void 0),t.type==="Mesh")return Joe(i,t,e);if(t.type==="Empty")return new us(i,t);if(t.type==="Particle"){let n=V1("Particle");return n?n(i,t,e):(Jn("particles","a Particle system"),new us(i,t))}else{if(t.type==="ParticleCollider")return new il(i,t,e);if(t.type==="Hair"){let n=V1("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 GM(i,t);if(t.type==="Page")return new Cn(i,t,e);if(t.type==="PointLight")return new _h(i,t,e);if(t.type==="SpotLight")return new fc(i,t,e);if(t.type==="DirectionalLight")return new pc(i,t,e);if(t.type==="Component"||t.type==="Instance"){let n=V1(t.type);return n?n(i,t,e):(Jn("components",`a ${t.type}`),new us(i,t))}else if(ta.is(t.type))return new rn(i,t)}}return console.error(t),new us(i,t)}function eae(i,t,e){let n=jM(i.identity,t,e),r=i.children,s=i.attachedPaths,o=i.parent,a=i.component,l=i.instances,c=i.overrideData,u=i.uuid,d=i.stateSelection;i.dispose();for(let h of Object.keys(i))delete i[h];Object.setPrototypeOf(i,Object.getPrototypeOf(n));for(let h of Object.keys(n))i[h]=n[h];i.children=[...i.children,...r],i.attachedPaths=s,i.parent=o,i.component=a,i.instances=l,i.uuid=u,i.overrideData=c,i.updateState(i.data,e),d&&i.changeSelectedState(d,e),i.resetBBoxNeedsUpdate()}function CW(i,t,e,n){i.updateByOp(t,e,n,!1)}var nD,PW=B(()=>{"use strict";pt();lm();Zf();_W();$i();mv();kO();oE();rE();Xs();cv();AW();tl();ME();Qt();nD=Qoe();wo.createEntity=jM;wo.changeEntityProptotype=eae});var HM,RW=B(()=>{"use strict";HM=class{constructor(){this._constraints=new Map}setConstraint(t,e){e===null?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((n,r)=>{let s=[r,n],o=n;for(;this._constraints.has(o);){if(o=this._constraints.get(o),s.includes(o)){console.warn(`circular dependency detected: ${s.join(" -> ")}`);break}e.has(o)||s.push(o)}for(let a=s.length-2;a>=0;a--)if(!e.has(s[a])){let l=t.find(s[a]);l?l.applyPathSnapping(t):console.warn(`missing entity ${s[a]}`),e.add(s[a])}})}findDependency(t,e){let n=t;for(;this._constraints.has(n);)if(n=this._constraints.get(n),n===e)return!0;return!1}}});var IW,OW=B(()=>{"use strict";IW="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"});var DW,LW=B(()=>{"use strict";DW=`
4145
4145
  function sortWorker(self) {
4146
4146
  let wasmInstance;
@@ -4655,7 +4655,7 @@ function sortWorker(self) {
4655
4655
  gl_FragColor = vec4(color.rgb, A);
4656
4656
  gVelocity = vec4(0.0);
4657
4657
  }`,s={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new G},viewport:{type:"v2",value:new G},basisViewport:{type:"v2",value:new G},debugColor:{type:"v3",value:new Ye},covariancesTextureSize:{type:"v2",value:new G(1024,1024)},centersColorsTextureSize:{type:"v2",value:new G(1024,1024)},orthoZoom:{type:"f",value:-1}};return new bt({uniforms:s,vertexShader:n,fragmentShader:r,transparent:!0,alphaTest:1,blending:Il,depthTest:!0,depthWrite:!1,side:Sr})}static buildGeomtery(e){let n=new Me;n.setIndex([0,1,2,0,2,3]);let r=new Float32Array(4*3),s=new Ue(r,3);n.setAttribute("position",s),s.setXYZ(0,-1,-1,0),s.setXYZ(1,-1,1,0),s.setXYZ(2,1,1,0),s.setXYZ(3,1,-1,0),s.needsUpdate=!0;let o=new eu().copy(n),a=new Uint32Array(e),l=new qo(a,1,!1);return l.setUsage(KA),o.setAttribute("splatIndex",l),o.instanceCount=e,o}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(s=>s.buildPreComputedBuffers()),this.covariances=new Float32Array(this.splatCount*6),this.colors=new Uint8Array(this.splatCount*4),this.centers=new Float32Array(this.splatCount*3);let e=0,n=0,r=0;for(let s of this.splatBuffers){let o=s.nsplats;this.colors.subarray(e,e+o*4).set(s.colorsA),e+=o*4,this.centers.subarray(n,n+o*3).set(s.decoded.xyz.denormDequant().data),n+=o*3,this.covariances.subarray(r,r+o*6).set(new Float32Array(s.precomputedCovarianceBufferData)),r+=o*6}}allocateAndStoreLocalSplatDataInTextures(){let r=this.splatCount,s=new G(4096,1024);for(;s.x*s.y*2<r*6;)s.y*=2;let o=new G(4096,1024);for(;o.x*o.y*4<r*4;)o.y*=2;let a,l;if(this.halfPrecisionCovariancesOnGPU){l=new Uint16Array(s.x*s.y*2);for(let f=0;f<this.covariances.length;f++)l[f]=Fs.toHalfFloat(this.covariances[f]);a=new Wn(l,s.x,s.y,Zo,pr)}else l=new Float32Array(s.x*s.y*2),l.set(this.covariances),a=new Wn(l,s.x,s.y,Zo,qt);a.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=a,this.material.uniforms.covariancesTextureSize.value.copy(s);let c=new Uint32Array(o.x*o.y*4);for(let f=0;f<r;f++){let m=f*4,g=f*3,y=f*4;c[y]=FW(this.colors[m],this.colors[m+1],this.colors[m+2],this.colors[m+3]),c[y+1]=WM(this.centers[g]),c[y+2]=WM(this.centers[g+1]),c[y+3]=WM(this.centers[g+2])}let u=new Wn(c,o.x,o.y,Op,Es);Yf()!=="webgpu"&&(u.internalFormat="RGBA32UI"),u.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=u,this.material.uniforms.centersColorsTextureSize.value.copy(o);let d=256*4,h=new Float32Array(256*16);for(let f=0;f<this.meshMatrixWorlds.length;f++)h.set(this.meshMatrixWorlds[f].elements,f*16);let p=new Wn(h,d,1,Xn,qt);p.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=p,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:l,texture:a,size:s},centerColors:{data:c,texture:u,size:o},meshMatrixWorlds:{data:h,texture:p}}}updateIndexes(e){let n=this.geometry;n.attributes.splatIndex.set(e),n.attributes.splatIndex.needsUpdate=!0,n.instanceCount=e.length}updateUniforms(e,n,r,s){this.splatCount>0&&(qM.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(qM),this.material.uniforms.basisViewport.value.set(2/qM.x,2/qM.y),this.material.uniforms.focal.value.set(n,r),this.material.uniforms.orthoZoom.value=s,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}}});function HW(){if(zW)return;if(XM)return XM;async function i(){let e=await import("./gaussian-splat-compression.js");GW(e),zW=!0}return XM=i(),XM}var GW,jW,zW,XM,sD=B(()=>{jW=new Promise(i=>{GW=i}),zW=!1});var WW,YM,qW=B(()=>{"use strict";BW();q();iD();sD();jW.then(i=>WW=i);YM=class{constructor(t={}){zi(this,"updateView",function(){let t=new te,e=[],n=new M(0,0,-1),r=new M(0,0,-1),s=new M,o=new M;return function(a=!1,l){let c=this.updateMatrixWorldsInWorkerIfNeeded(),u=this.cropsChanged();if(!a){r.set(0,0,-1).applyQuaternion(l.quaternion);let h=!1,p=!1;if(r.dot(n)<=.95&&(h=!0),o.copy(l.position).sub(s).length()>=1&&(p=!0),!h&&!p&&!c&&!u&&!this.needsInitialRender)return}this.needsInitialRender=!1,s.copy(l.position),n.copy(r),t.copy(l.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),e[0]=l.position.x,e[1]=l.position.y,e[2]=l.position.z;let d={sort:{view:t.elements,cameraPosition:e,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...c?{newMatrixWorlds:this.meshMatrixWorlds}:{},...u?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=d:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(d))}}());this.scene=t.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=new te().makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(t,e){let n=new G;if(this.splatMesh===null)return;this.splatMesh.getSplatCount()>0&&(t.getSize(n),this.cameraFocalLengthX=e.projectionMatrix.elements[0]*this.devicePixelRatio*n.x*.45,this.cameraFocalLengthY=e.projectionMatrix.elements[5]*this.devicePixelRatio*n.y*.45,this.splatMesh.updateUniforms(n,this.cameraFocalLengthX,this.cameraFocalLengthY,e.isPerspectiveCamera?-1:e.zoom*this.devicePixelRatio))}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=new M().fromArray(t.position)),t.orientation&&(t.orientation=new ke().fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseVisibleEntity(o=>{o.data.type==="Splat"&&e.push(o)}),this.splatMesh&&this.splatMesh.dispose(),e.length===0)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(o=>o.matrixWorld),this.meshMatrixWorldsOld=e.map(o=>o.matrixWorld.clone()),this.cropsArray=e.map(o=>o.data.crops.map(a=>a.data)),this._splatBufferCache??(this._splatBufferCache=new WeakMap);let n=e.map(o=>{let a=this._splatBufferCache.get(o.data.buffer);return a===void 0&&(a=new WW.GSplineBuffer(new Uint8Array(o.data.buffer).buffer),this._splatBufferCache.set(o.data.buffer,a)),a}),r=0,s=[0];for(let o of n)r+=o.getSplatCount(),s.push(r);return this.setupSplatMesh(n,r,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,s,this.meshMatrixWorlds),this.setupSortWorker(r),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,e*16);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,this.meshMatrixWorlds.every((e,n)=>e.equals(this.meshMatrixWorldsOld[n]))?!1:(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(e=>e.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,n)=>{e.data.crops.forEach((r,s)=>{this.cropsArray[n][s]===void 0?(t=!0,this.cropsArray[n][s]=r.data):Object.entries(r.data).forEach(([o,a])=>{Array.isArray(a)&&a.some((l,c)=>l!==this.cropsArray[n][s][o][c])?(t=!0,this.cropsArray[n][s][o]=a):a!==this.cropsArray[n][s]?.[o]&&(t=!0,this.cropsArray[n][s][o]=a)})}),e.data.crops.length!==this.cropsArray[n]?.length&&(this.cropsArray[n].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,n=new M,r=new ke,s=!1,o=1,a,l){this.splatMesh=qu.buildMesh(t,e,s,o,a,l),this.splatMesh.position.copy(n),this.splatMesh.quaternion.copy(r),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=e,this.splatMesh.onBeforeRender=(c,u,d)=>this.update(c,d)}setupSortWorker(t){this.sortWorker=NW(t),this.sortWorker.onmessage=e=>{e.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(e.data.indexesBuffer)),this.lastSortTime=e.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):e.data.sortCanceled?this.sortRunning=!1:e.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):e.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(t,e){this.splatMesh!==null&&(this.updateSplatMeshUniforms(t,e),this.updateView(!1,e))}getSplatMesh(){return this.splatMesh}}});var $M,XW,Xu,KM=B(()=>{q();Xs();Yi();hc();pt();bW();an();OR();ow();ii();Zf();PW();mv();$i();fr();tl();oI();fr();qr();Af();RW();qW();$M=new ti;$M.wireframe=!0;XW=new M,Xu=class extends hr{constructor(e,n){super();this.data=e;this.sharedAssets=n;this.enableHelpers=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this.needsNormalDirty=!0;this.needsReflectionDirty=!0;this._needsTransmission=!1;this._needsNormal=!1;this._normalPassNeeds={outline:!1,cavity:!1};this._needsReflection=!1;this.geometryCacheChanged=!1;this.splatViewer=null;this.shapeBlendIntances=[];this.hairInstances=[];this.shadowsDirty=!0;this.instanceGroupsDirty=!0;this._autoInstancing=null;this.entityByUuid={};this.entityIdentityToEntity={};this.toExpandCloner=new Set;this.toUpdateCloner=new Set;this.pendingCommands=[];this.pathConstraints=new HM;this.invisibleObjects=new us("jflkdsafjasdifjaslk",{...uf.defaultData,visible:!1,name:"buildin invisible"});this.needsRecomputeInstances=!1;this.init(e,n),this.matrixAutoUpdate=!1,this.errorPage=new Cn("fdasfa",{...ra.defaultData,name:""},{shared:n,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markShadowsDirty(){this.shadowsDirty=!0}markInstanceGroupsDirty(){this.instanceGroupsDirty=!0}get autoInstancing(){return this._autoInstancing}updateInstanceGroups(e,n){let r=this._autoInstancing;(r===null||r.minGroupSize!==n)&&(r?.dispose(),r=new VM(n),this._autoInstancing=r);let s=this.instanceGroupsDirty;return this.instanceGroupsDirty=!1,r.update(e,s),r.stats}releaseInstanceGroups(){this._autoInstancing?.teardown(),this.instanceGroupsDirty=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this.shadowsDirty=!0,this.instanceGroupsDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=oG(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._normalPassNeeds=sG(this),this._needsNormal=this._normalPassNeeds.outline||this._normalPassNeeds.cavity,this.needsNormalDirty=!1),this._needsNormal}normalPassNeeds(){return this.needsNormal(),this._normalPassNeeds}needsReflection(){return this.needsReflectionDirty&&(this._needsReflection=aG(this),this.needsReflectionDirty=!1),this._needsReflection}registerInstanceAndSetUuid(e){let n=e.identity.join("-"),r=this.entityIdentityToEntity[n];r&&(e.uuid=r.uuid),this.entityIdentityToEntity[n]=e,this.entityByUuid[e.uuid]=e}markPenumbraSizeDirty(){for(let e of this.children)e instanceof Cn&&(e.penumbraSizeArrayCache=null)}findInstance(e){return this.entityIdentityToEntity[e.join("-")]}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(e){let n=this.find(e);if(n===void 0)return;let r=[],s=n;for(;s!==this;){let o=s;s=s.parent;let a=s.children.indexOf(o);r.splice(0,0,a)}return{entity:n,sortKey:r}}getAllSorted(e){let n=[];for(let r of e){let s=this.getWithSortKey(r.id);s!==void 0&&n.push(s)}return n.sort((r,s)=>Rd(r.sortKey,s.sortKey)),n.map(r=>r.entity)}nonExistOrDescendantOf(e,n){let r=this.find(e);if(r===void 0)return!0;for(;r;){if(r.uuid===n)return!0;r=r.parent}return!1}find(e){if(this.activePage&&this.activePage.personalCamera.parent){if(e==="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera")return this.activePage.personalCamera;if(e===fo)return this.activePage.personalCamera}if(e===""||e===void 0)return;let n=this.entityByUuid[e];return n===void 0?this.getObjectByProperty("uuid",e):n}find2D(e){for(let n of this.children)if(n instanceof Cn&&n.uiScene){let r=n.uiScene.find(e);if(r)return r}}findScene2DfromObject2D(e){for(let n of this.children)if(n instanceof Cn&&n.uiScene&&n.uiScene.find(e))return n.uiScene}find2DInUIObjects(e){let n;return this.traverseEntity(r=>{n===void 0&&vr(r)&&(n=r.uiCanvas.find(e))}),n}traverse2D(e){for(let n of this.children)n instanceof Cn&&n.uiScene&&n.uiScene.traverse(e)}debugEnsureEntity(e){let n=this.find(e);n?Array.isArray(n.identity)&&this.findInstance(n.identity)===void 0&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(e){this.toExpandCloner.add(e)}addPendingUpdateCloner(e){this.toUpdateCloner.add(e)}markToExpandCloner(e){this.toExpandCloner.add(e),e.traverseEntityAncestors(n=>{this.toExpandCloner.add(n)})}doPendingExpandCloner(e){this.toExpandCloner.forEach(n=>{n.expandCloner(e)}),this.toExpandCloner.clear()}doPendingUpdateCloner(e){this.toUpdateCloner.forEach(n=>{n.cloner?.update(e)}),this.toUpdateCloner.clear()}doPendingUpdates(e){this.doPendingExpandCloner(e),this.doPendingUpdateCloner(e),this.applyPendingCommands()}addPendingCommand(e){this.pendingCommands.push(e)}applyPendingCommands(){this.pendingCommands.forEach(e=>e()),this.pendingCommands.length=0}updateByLibOp(e,n){e.path.length===1&&e.path[0]==="components"&&e.type===1&&this.createChildrenObjects([{...e.data.asset,id:e.id}],this.invisibleObjects,n)}updateTreeByOp(e,n){if(e.path.length===0&&e.type===7){let r=e.parent===null?this:this.find(e.parent);if(r===void 0)throw new Error(`scene tree add: parent ${e.parent} not found for object ${e.id}`);let s=this.createObject(e.id,e.data,e.children,r,e.localIndex,n);s.updateVisible(this),s.resetBBoxNeedsUpdate(),As(s)&&ds(s.parent)&&(s.invalidateUpstreamBooleanData(),s.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(r),this.markNeedsRecomputeInstancesForChildren(s),this.markToExpandCloner(s),this.markPenumbraSizeDirty(),s.updatePathSnapping()}else if(e.path.length===0&&e.type===8){let r=this.find(e.id);if(r===void 0)throw new Error(`scene tree delete: object ${e.id} not found`);r.traverseEntity(o=>{Xi(o)&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(a=>a!==o)),la(o)&&(this.hairInstances=this.hairInstances.filter(a=>a!==o))}),this.markToExpandCloner(r),r.resetBBoxNeedsUpdate(),this.unregisterObject(r);let s=r.parent;this.markNeedsRecomputeInstancesForAncessors(s),this.markNeedsRecomputeInstancesForChildren(r),this.markPenumbraSizeDirty(),r.parent.remove(r),ds(r.parent)&&(r.parent.invalidateUpstreamBooleanData(),r.parent.invalidateDownstreamBooleanData().recomputeBoolean()),As(r)&&(r.freeBooleanPointer(),s instanceof _s&&s.invalidateDownstreamBooleanData().recomputeBoolean()),$d(r)&&r.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(r),this.pathConstraints.removeDependencies(r.uuid),r.updatePathSnapping()}else if(e.path.length===0&&e.type===9){let r=this.find(e.id);if(r===void 0)throw new Error(`scene tree move: object ${e.id} not found`);this.markNeedsRecomputeInstancesForChildren(r);let s=r.parent;this.markNeedsRecomputeInstancesForAncessors(s),r.cloner?.resetOnMove(),this.markToExpandCloner(r);let o=e.parent===null?this:this.find(e.parent);if(o===void 0)throw new Error(`scene tree move: new parent ${e.parent} not found for object ${e.id}`);o.add(r),this.markNeedsRecomputeInstancesForAncessors(o),this.markToExpandCloner(r),r.invalidateClonerTransform(r),r.updateVisible(this),r.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let a=e.localIndex;o.children.splice(a,0,o.children.pop()),As(r)&&(r.invalidateUpstreamBooleanData(),ds(r.parent)?r.parent.invalidateDownstreamBooleanData().recomputeBoolean():s instanceof _s&&s.invalidateDownstreamBooleanData().recomputeBoolean()),r.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(e){this.shadowsDirty=!0,this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let n of this.children)n instanceof Cn&&(n.visible=n.uuid===e,n.visible&&(this.activePage=n,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(e,n,r,s){if(this.shadowsDirty=!0,n.type===0){if(("overrides"in n.props||"component"in n.props)&&this.markNeedsRecomputeInstances(),"visible"in n.props&&this.markPenumbraSizeDirty(),n.path.includes("overrides")&&"states"in n.props){let{rest:a}=n.props;n={...n,props:a},this.markNeedsRecomputeInstances()}n.path[0]==="pathSnapping"&&n.props.pathId!==void 0&&this.pathConstraints.setConstraint(e,n.props.pathId)}let o=this.find(e);if(o)try{CW(o,n,r,{scene:this,shared:s}),o instanceof Yt&&o.updateGeometryGroupsIfNeeded()}catch(a){console.error(a)}}updateEntity2DByOp(e,n,r,s,o,a=[]){e.updateEntityByOp(n,r,s,o),this.traverseEntity(l=>{(vr(l)||l instanceof Cn)&&(a.includes(l.frameId??"")||l.frameId===n)&&l.updateEntity2DByOp(n,r,s,o)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(e){this.activePage.switchActiveCamera(e)}isInvisibleObjects(e){return e===this.invisibleObjects||e.hasAnccestor(this.invisibleObjects)}init(e,n){let r=Object.entries(n.data.lib.components).map((s,o)=>({data:s[1].asset.data,children:s[1].asset.children,id:s[0],fi:o}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:n}),this.add(this.invisibleObjects),this.createChildrenObjects(r,this.invisibleObjects,n),this.createChildrenObjects(e.objects,this,n),this.updatePage(e.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(n,!0),this.traverseEntity(s=>{s instanceof rn&&s.updateUp()}),this.doPendingExpandCloner({scene:this,shared:n}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(e){e.traverseEntity(n=>{(n.data.type==="Component"||n.data.type==="Instance")&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(e){Ot.is(e)&&(e.data.type==="Component"&&this.markNeedsRecomputeInstances(),e.traverseAncestors(n=>{Ot.is(n)&&n.data.type==="Component"&&this.markNeedsRecomputeInstances()}))}relativeizeInner(e,n,r,s,o,a,l){if(e){let c=s.find(e);c&&c!==s&&o.forInstancesRec(u=>{u.data=cu(u.data,d=>{let h=d.events.data(l.id),p=u.goUp(a);if(p){let f=[...RS(p.identity),e].join("-"),m=this.entityIdentityToEntity[f];if(m){let g=m.uuid,y=rr.zoom(h,n);y[r]=g}else console.warn("cannot find instance")}}).data})}}rewriteActions(e,n,r,s,o,a){e.forEach(l=>{l.data.type==="Transition"?this.relativeizeInner(l.data.object,[...n,l.id],"object",r,s,o,a):l.data.type==="Animation"&&l.data.object?this.relativeizeInner(l.data.object,[...n,l.id],"object",r,s,o,a):l.data.type==="Conditional"&&(this.rewriteActions(l.data.ifActions,[...n,l.id,"ifActions"],r,s,o,a),this.rewriteActions(l.data.elseActions,[...n,l.id,"elseActions"],r,s,o,a))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(e=>{if(Tf(e)&&typeof e.identity=="string"&&e.data.type==="Component")return e.traverseEntity((n,r)=>{n.data.events.forEach(s=>{if(s.data.type==="GameControl"){let o=!1;if(n.forInstancesRec(a=>{a.data=cu(a.data,l=>{a.isInstanceRoot||(l.events.delete(s.id),o=!0)}).data}),o===!1)for(let a of gf.list)this.rewriteActions(s.data.gameActions[a],["gameActions",a],e,n,r,s)}else s.data.type==="Conditional"?(s.data.condition.type==="Distance"?(this.relativeizeInner(s.data.condition.fromObject,["condition"],"fromObject",e,n,r,s),this.relativeizeInner(s.data.condition.toObject,["condition"],"toObject",e,n,r,s)):s.data.condition.type==="State"?this.relativeizeInner(s.data.condition.object,["condition"],"object",e,n,r,s):s.data.condition.type==="Comparison"&&(s.data.condition.lOperand.type==="Property"&&this.relativeizeInner(s.data.condition.lOperand.value[0],["condition","lOperand","value"],0,e,n,r,s),s.data.condition.rOperand.type==="Property"&&this.relativeizeInner(s.data.condition.rOperand.value[0],["condition","rOperand","value"],0,e,n,r,s)),this.rewriteActions(s.data.inActions,["inActions"],e,n,r,s),this.rewriteActions(s.data.outActions,["outActions"],e,n,r,s)):"actions"in s.data&&this.rewriteActions(s.data.actions,["actions"],e,n,r,s)})}),!0})}expandInstances(e,n,r){let s=new Set;this.traverseEntity(o=>{if(Tf(o)&&o.isInstanceRoot)return o.expandInstanceChildren({scene:this,shared:e,pendingDeletes:s}),n||o.resetBBoxNeedsUpdate(),r&&o.traverseEntity(a=>{r.addClip(a)}),!0});for(let o of s)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(o),rb(o)}recomputeInstances(e,n){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(r=>{Tf(r)&&r.isInstanceRoot&&(r.component=void 0)}),this.expandInstances(e,!1,n))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(e){e.traverseEntity(n=>{let r=typeof n.identity=="string"?n.identity:n.identity.join("-");this.entityIdentityToEntity[r]===n&&(delete this.entityByUuid[n.uuid],delete this.entityIdentityToEntity[r]),n.dispose()})}clearScene(){this._autoInstancing?.dispose(),this._autoInstancing=null,this.instanceGroupsDirty=!0;for(let e of this.children)Ot.is(e)&&e.disposeRecursively();this.children.length=0}resetAfterClear(e,n){this.init(e,n)}raycast(e){return this.raycast1(e,!1)}raycast1(e,n){let r=[],s=o=>{for(let a of o.children){let l=a.cloner;if(Ot.is(a)&&!a.raycastLock&&(a.visible||l?.object.data.visible))if(n===!0&&a.isInstanceRoot){let c=[];if(e.intersectObject(a,!0,c),c.length){let u=c[0];u.object=a,u.point.applyMatrix4(u.object.matrixWorld);let d=a.matrixWorld.clone().invert();u.point.applyMatrix4(d),r.push(u)}}else(As(a)||Vv(a)&&this.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,r),Gv(a,e,r)),s(a)}};return s(this.activePage),r}raycastWithClones(e){let n=[],r=s=>{for(let o of s.children){let a=o.cloner;Ot.is(o)&&(o.visible||a?.object.data.visible)&&((As(o)||Vv(o)&&this.enableHelpers&&o.objectHelper.visible)&&(e.intersectObject(o,!1,n),Gv(o,e,n,!0)),r(o))}};return r(this),n}forEachEntity(e){for(let n of this.children)Ot.is(n)&&e(n)}traverseConcreteEntity(e){for(let n of this.children)Ot.is(n)&&n.isConcreteEntity&&n.traverseEntity(e)}traverseEntity(e){for(let n of this.children)Ot.is(n)&&n.traverseEntity(e)}updateFont(e,n){this.traverseEntity(r=>{if(r instanceof Yt&&r.data.type==="Mesh"&&(r.data.geometry.type==="TextGeometry"||r.data.geometry.type==="InputGeometry")&&r.data.geometry.font===e){let s=r.geometry,o=r.data.geometry;s.updateFont(e,n).then(()=>{s.update(o,n);let a=r.invalidateDownstreamBooleanData();ds(a)&&a.recomputeBoolean()})}})}traverseObject(e){for(let n of this.children)oc.is(n)&&n.traverseObject(e)}traverseVisibleEntity(e){for(let n of this.children)Ot.is(n)&&n.visible&&n.traverseVisibleEntity(e)}dispose(){this.clearScene()}createChildrenObjects(e,n,r){let s=0;for(let o of e)this.createObject(o.id,o.data,o.children,n,s,r),s+=1}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let n of e.children)this.unregisterObject(n)}createObject(e,n,r,s,o,a){let l={scene:this,shared:a},c=jM(e,n,l);return Xi(c)&&this.shapeBlendIntances.push(c),la(c)&&this.hairInstances.push(c),c&&(this.entityByUuid[e]=c,s.add(c),s.children.splice(o,0,s.children.pop()),r.length>0&&(c.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(r,c,a)),c.updateState(n,l),c instanceof Yt&&c.updateGeometryGroupsIfNeeded(),c.updateVisible(this),c.cloner&&this.toExpandCloner.add(c),n.pathSnapping?.pathId&&this.pathConstraints.setConstraint(e,n.pathSnapping.pathId)),n.type==="Empty"&&n.animations&&c.traverseEntity(u=>{let d=u.dataPatched;if(u instanceof Yt&&d.bones&&d.boneInverses){let h=d.bones.map(m=>this.find(m)),p=d.boneInverses.map(m=>new te().fromArray(m)),f=new Nl(h,p);u.bind(f,u.bindMatrix)}else u.matrixAutoUpdate=!0}),c}getCenter(e){let n=[];for(let s=0,o=e.length;s<o;++s){let{id:a,recursive:l}=e[s],c=this.find(a),u=l?c.recursiveBBox:c.singleBBox;n.push(...u.vertices)}let r=new Nt;return r.setFromPoints(n),r.getCenter(XW),XW}copyMatrixWorld(e,n){if(e===null){n.identity();return}let r=this.find(e);r?(r.updateWorldMatrix(!0,!1),n.copy(r.matrixWorld)):n.identity()}copyParentMatrixWorld(e,n){if(e===null){n.identity();return}let r=this.find(e)?.parent;r?(r.updateWorldMatrix(!0,!1),n.copy(r.matrixWorld)):n.identity()}traverseMaterial(e){this.traverseEntity(n=>{if(n instanceof Kt)if(Array.isArray(n.material))for(let r=0;r<n.material.length;r++)Jd(n.material[r])&&e(n.material[r]);else Jd(n.material)&&e(n.material)})}updateViewPlaneSize(e,n,r=!1){this.traverseConcreteEntity(s=>{s instanceof rn&&s.setViewplaneSize(e,n,r)})}initializeSplatViewer(){this.splatViewer=new YM({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}}});var $W={};Xh($W,{DRACOLoader:()=>aD,DRACO_GLTF_CONFIG:()=>sae});function oae(){let i,t;onmessage=function(o){let a=o.data;switch(a.type){case"init":i=a.decoderConfig,t=new Promise(function(u){i.onModuleLoaded=function(d){u({draco:d})},DracoDecoderModule(i)});break;case"decode":let l=a.buffer,c=a.taskConfig;t.then(u=>{let d=u.draco,h=new d.Decoder;try{let p=e(d,h,new Int8Array(l),c),f=p.attributes.map(m=>m.array.buffer);p.index&&f.push(p.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:p},f)}catch(p){console.error(p),self.postMessage({type:"error",id:a.id,error:p.message})}finally{d.destroy(h)}});break}};function e(o,a,l,c){let u=c.attributeIDs,d=c.attributeTypes,h,p,f=a.GetEncodedGeometryType(l);if(f===o.TRIANGULAR_MESH)h=new o.Mesh,p=a.DecodeArrayToMesh(l,l.byteLength,h);else if(f===o.POINT_CLOUD)h=new o.PointCloud,p=a.DecodeArrayToPointCloud(l,l.byteLength,h);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||h.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());let m={index:null,attributes:[]};for(let g in u){let y=self[d[g]],v,b;if(c.useUniqueIDs)b=u[g],v=a.GetAttributeByUniqueId(h,b);else{if(b=a.GetAttributeId(h,o[u[g]]),b===-1)continue;v=a.GetAttribute(h,b)}let x=r(o,a,h,g,y,v);g==="color"&&(x.vertexColorSpace=c.vertexColorSpace),m.attributes.push(x)}return f===o.TRIANGULAR_MESH&&(m.index=n(o,a,h)),o.destroy(h),m}function n(o,a,l){let u=l.num_faces()*3,d=u*4,h=o._malloc(d);a.GetTrianglesUInt32Array(l,d,h);let p=new Uint32Array(o.HEAPF32.buffer,h,u).slice();return o._free(h),{array:p,itemSize:1}}function r(o,a,l,c,u,d){let h=l.num_points(),p=d.num_components(),f=s(o,u),m=p*u.BYTES_PER_ELEMENT,g=Math.ceil(m/4)*4,y=g/u.BYTES_PER_ELEMENT,v=h*m,b=h*g,x=o._malloc(v);a.GetAttributeDataArrayForAllPoints(l,d,f,v,x);let S=new u(o.HEAPF32.buffer,x,v/u.BYTES_PER_ELEMENT),E;if(m===g)E=S.slice();else{E=new u(b/u.BYTES_PER_ELEMENT);let T=0;for(let w=0,_=S.length;w<_;w++){for(let A=0;A<p;A++)E[T+A]=S[w*p+A];T+=y}}return o._free(x),{name:c,count:h,itemSize:p,array:E,stride:y}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}var oD,nae,rae,iae,sae,aD,KW=B(()=>{q();oD=new WeakMap,nae="",rae="",iae="",sae={js:"",wasm:""},aD=class extends Xo{constructor(t){super(t),this.decoderPaths={js:rae,wasm:nae,dep_js:iae},this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){let{decoderPaths:e}=this;return typeof t=="object"?(e.js=t.js,e.wasm=t.wasm,e.dep_js=null):(e.js=wd.resolveURL("draco_wasm_wrapper.js",t),e.wasm=wd.resolveURL("draco_decoder.wasm",t),e.dep_js=wd.resolveURL("draco_decoder.js",t)),this}setDecoderConfig(t){return console.warn("THREE.DRACOLoader: setDecoderConfig to has been deprecated and will be removed in r194."),this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,r){let s=new Jc(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,o=>{this.parse(o,e,r)},n,r)}parse(t,e,n=()=>{}){this.decodeDracoFile(t,e,null,null,It,n).catch(n)}decodeDracoFile(t,e,n,r,s=Pa,o=()=>{}){let a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:s};return this.decodeGeometry(t,a).then(e).catch(o)}decodeGeometry(t,e){let n=JSON.stringify(e);if(oD.has(t)){let l=oD.get(t);if(l.key===n)return l.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r,s=this.workerNextTaskID++,o=t.byteLength,a=this._getWorker(s,o).then(l=>(r=l,new Promise((c,u)=>{r._callbacks[s]={resolve:c,reject:u},r.postMessage({type:"decode",id:s,taskConfig:e,buffer:t},[t])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),oD.set(t,{key:n,promise:a}),a}_createGeometry(t){let e=new Me;t.index&&e.setIndex(new Ue(t.index.array,1));for(let n=0;n<t.attributes.length;n++){let{name:r,array:s,itemSize:o,stride:a,vertexColorSpace:l}=t.attributes[n],c;if(o===a)c=new Ue(s,o);else{let u=new dd(s,a);c=new Ra(u,o,0)}r==="color"&&(this._assignVertexColorSpace(c,l),c.normalized=!(s instanceof Float32Array)),e.setAttribute(r,c)}return e}_assignVertexColorSpace(t,e){if(e!==It)return;let n=new Ye;for(let r=0,s=t.count;r<s;r++)n.fromBufferAttribute(t,r),Jt.colorSpaceToWorking(n,It),t.setXYZ(r,n.r,n.g,n.b)}_loadLibrary(t,e){let n=new Jc(this.manager);return n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((r,s)=>{n.load(t,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[],{decoderPaths:n}=this;if(t){if(n.dep_js===null)throw new Error("THREE.DRACOLoader: WebAssembly is required when using a custom decoder paths.");e.push(this._loadLibrary(n.dep_js,"text"))}else e.push(this._loadLibrary(n.js,"text")),e.push(this._loadLibrary(n.wasm,"arraybuffer"));return this.decoderPending=Promise.all(e).then(r=>{let s=r[0];t||(this.decoderConfig.wasmBinary=r[1]);let o=oae.toString(),a=["/* draco decoder */",s,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
4658
- `);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){let o=s.data;switch(o.type){case"decode":r._callbacks[o.id].resolve(o);break;case"error":r._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});let n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}});function t6(i,{basePath:t,moduleUrl:e,cdnBuild:n}){if(t!==void 0)return{url:`${t}/${i}`};let r=`${n}/${i}`;if(e===void 0||e.startsWith("file:"))return{url:r};let s=e.slice(0,e.lastIndexOf("/")+1)+i;return s===r?{url:s}:{url:s,fallback:r}}var n6=B(()=>{"use strict"});function i6(i){r6=i}function lae(i){return t6(i,{basePath:r6,moduleUrl:"file:///",cdnBuild:"https://cdn.spline.design/@splinetool/runtime@2.0.77/build"})}function dD(i,t){let{url:e,fallback:n}=lae(t);n!==void 0&&i.addEventListener("error",()=>{i.src=n},{once:!0}),i.src=e}var r6,hD=B(()=>{n6()});function Qi(i,t){pD.set(i,t)}function a6(i){return pD.get(i)}function l6(){return pD}function c6(i,t){let e=`${t}:${i}`;o6.has(e)||o6.add(e)}var pD,o6,fl=B(()=>{"use strict";pD=new Map;o6=new Set});function u6(i,t,e){return i*(t-e)-t}function vD(i,t,e){return Math.min(Math.max((i+t)/(t-e),0),1)}function Rae(){if(Yu===null){let i=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);Yu=new Me,Yu.setAttribute!==void 0?(Yu.setAttribute("position",new Ue(i,3)),Yu.setAttribute("uv",new Ue(t,2))):(Yu.addAttribute("position",new Ue(i,3)),Yu.addAttribute("uv",new Ue(t,2)))}return Yu}function p6(i,t,e){for(let n of t){let r="$1"+i+n.charAt(0).toUpperCase()+n.slice(1),s=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(let o of e.entries())o[1]!==null&&e.set(o[0],o[1].replace(s,r))}}function Qae(i,t,e,n,r,s,o){let a=new Map([["fragment",t.getFragmentShader()],["vertex",t.getVertexShader()]]),l=a.get("fragment")!==void 0&&/mainImage/.test(a.get("fragment")),c=a.get("fragment")!==void 0&&/mainUv/.test(a.get("fragment")),u=[],d=[],h=!1,p=!1;if(a.get("fragment")===void 0)console.error("Missing fragment shader",t);else if(c&&(o&ml.CONVOLUTION)!==0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",t);else if(!l&&!c)console.error("The fragment shader contains neither a mainImage nor a mainUv function",t);else{let f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,m=bD.Section;if(c){let y=` ${i}MainUv(UV);
4658
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){let o=s.data;switch(o.type){case"decode":r._callbacks[o.id].resolve(o);break;case"error":r._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});let n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}});function t6(i,{basePath:t,moduleUrl:e,cdnBuild:n}){if(t!==void 0)return{url:`${t}/${i}`};let r=`${n}/${i}`;if(e===void 0||e.startsWith("file:"))return{url:r};let s=e.slice(0,e.lastIndexOf("/")+1)+i;return s===r?{url:s}:{url:s,fallback:r}}var n6=B(()=>{"use strict"});function i6(i){r6=i}function lae(i){return t6(i,{basePath:r6,moduleUrl:"file:///",cdnBuild:"https://cdn.spline.design/@splinetool/runtime@2.0.78/build"})}function dD(i,t){let{url:e,fallback:n}=lae(t);n!==void 0&&i.addEventListener("error",()=>{i.src=n},{once:!0}),i.src=e}var r6,hD=B(()=>{n6()});function Qi(i,t){pD.set(i,t)}function a6(i){return pD.get(i)}function l6(){return pD}function c6(i,t){let e=`${t}:${i}`;o6.has(e)||o6.add(e)}var pD,o6,fl=B(()=>{"use strict";pD=new Map;o6=new Set});function u6(i,t,e){return i*(t-e)-t}function vD(i,t,e){return Math.min(Math.max((i+t)/(t-e),0),1)}function Rae(){if(Yu===null){let i=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);Yu=new Me,Yu.setAttribute!==void 0?(Yu.setAttribute("position",new Ue(i,3)),Yu.setAttribute("uv",new Ue(t,2))):(Yu.addAttribute("position",new Ue(i,3)),Yu.addAttribute("uv",new Ue(t,2)))}return Yu}function p6(i,t,e){for(let n of t){let r="$1"+i+n.charAt(0).toUpperCase()+n.slice(1),s=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(let o of e.entries())o[1]!==null&&e.set(o[0],o[1].replace(s,r))}}function Qae(i,t,e,n,r,s,o){let a=new Map([["fragment",t.getFragmentShader()],["vertex",t.getVertexShader()]]),l=a.get("fragment")!==void 0&&/mainImage/.test(a.get("fragment")),c=a.get("fragment")!==void 0&&/mainUv/.test(a.get("fragment")),u=[],d=[],h=!1,p=!1;if(a.get("fragment")===void 0)console.error("Missing fragment shader",t);else if(c&&(o&ml.CONVOLUTION)!==0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",t);else if(!l&&!c)console.error("The fragment shader contains neither a mainImage nor a mainUv function",t);else{let f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,m=bD.Section;if(c){let y=` ${i}MainUv(UV);
4659
4659
  `;e.set(m.FRAGMENT_MAIN_UV,e.get(m.FRAGMENT_MAIN_UV)+y),h=!0}if(a.get("vertex")!==null&&/mainSupport/.test(a.get("vertex"))){let y=` ${i}MainSupport(`;y+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(a.get("vertex"))?`vUv);
4660
4660
  `:`);
4661
4661
  `,e.set(m.VERTEX_MAIN_SUPPORT,e.get(m.VERTEX_MAIN_SUPPORT)+y),u=u.concat([...a.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(v=>v[1])),d=d.concat(u).concat([...a.get("vertex").matchAll(f)].map(v=>v[1]))}d=d.concat([...a.get("fragment").matchAll(f)].map(y=>y[1])),d=d.concat([...t.defines.keys()].map(y=>y.replace(/\([\w\s,]*\)/g,""))),d=d.concat([...t.uniforms.keys()]),t.uniforms.forEach((y,v)=>s.set(i+v.charAt(0).toUpperCase()+v.slice(1),y)),t.defines.forEach((y,v)=>r.set(i+v.charAt(0).toUpperCase()+v.slice(1),y)),p6(i,d,r),p6(i,d,a);let g=t.blendMode;if(n.set(g.blendFunction,g),l){let y=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/,v=`${i}MainImage(color0, UV, `;(o&ml.DEPTH)!==0&&y.test(a.get("fragment"))&&(v+="depth, ",p=!0),v+=`color1);
@@ -9800,7 +9800,7 @@ void main() {
9800
9800
  gl_FragColor = texture(inputTexture, vUv);
9801
9801
  gVelocity = vec4(0.0);
9802
9802
  }
9803
- `,n.pyramidTextureSize.value=new G(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(),jG()?.release(this)}},nb=nI;nb.streamCompaction=new TE;var ere=new te,tre=new te,um=new ke,hh=new M,NE=new M,nre=new ke;function rre(i,t=0){let e=this.children.length;for(;e--;){let n=this.children[e];oc.is(n)&&S4.call(n,i,t+1)}}function S4(i,t=0){if(i(this,t)!==!0){let n=this.children.length;for(;n--;){let r=this.children[n];oc.is(r)&&S4.call(r,i,t+1)}}}function ire(){if(this.shapesDataTexture.value===void 0){let g=new Wn(new Float32Array(4*$r*mc),$r,mc,Xn,qt);this.shapesDataTexture.value=g}let i=this.shapesDataTexture.value,t=i.image.data,e=0,n=0,r=this.data.geometry.blendRange,s=ere.copy(this.matrixWorld).invert(),o=this._npart,a=0;this._meshSdfWanted.clear();let l=null;if(rre.call(this,g=>{if(g.visible===!1)return!0;let y;if(g instanceof $s)return;if(g instanceof il||bu(g))return;g instanceof Yr?y=g.object:y=g;let v=g.data?.cloner;if(Ot.is(g)&&v&&!v.hideBase&&v.type!=="radial"&&v.disabled!==!0||!(y instanceof Yt))return;let b=y.geometry.userData.parameters,x=b?.shapeBlendNode??y.dataPatched?.geometry?.shapeBlendNode;if(x===void 0)return;if(tre.multiplyMatrices(s,g.matrixWorld).decompose(NE,um,hh),b?.type==="TorusGeometry"&&b.arc!==360){let O=b.arc*Math.PI/180;O=O/4,um.multiply(nre.set(0,0,Math.sin(O),Math.cos(O)))}let E=x.overrideGlobalBlend?x.blendRange:r;E=E/this.bboxSize*2,t[a*4]=(NE.x-this.bboxOffset)/this.bboxSize*2,t[a*4+1]=(NE.y-this.bboxOffset)/this.bboxSize*2,t[a*4+2]=(NE.z-this.bboxOffset)/this.bboxSize*2,t[a*4+3]=x.operation===0?1:x.operation===2?-1:-2,t[$r*4+a*4]=-um.x,t[$r*4+a*4+1]=-um.y,t[$r*4+a*4+2]=-um.z,t[$r*4+a*4+3]=um.w;let T=new Float32Array(4),w=0,_=E;if(b?.type==="SphereGeometry")b.width===b.height&&b.width===b.depth?T[0]=0:T[0]=1,T[1]=b.width/this.bboxSize,T[2]=b.height/this.bboxSize,T[3]=b.depth/this.bboxSize,_=Math.max(T[1],T[2],T[3])*hh.x+E;else if(b?.type==="CubeGeometry"){w=b.cornerRadius;let O=b.width,L=b.height,F=b.depth;T[0]=2,T[1]=(O-2*w)/this.bboxSize,T[2]=(L-2*w)/this.bboxSize,T[3]=(F-2*w)/this.bboxSize,_=Math.sqrt(O**2+L**2+F**2)/this.bboxSize*hh.x+E}else if(b?.type==="CylinderGeometry"){w=b.cornerRadius;let O=b.height,L=b.radiusBottom,F=b.radiusTop;if(F>=L){let j=Math.atan2(F-L,O),W=(Math.PI/2-j)/2;F-=w/Math.tan(W),L-=w*Math.tan(W)}else if(L>F){let j=Math.atan2(L-F,O),W=(Math.PI/2-j)/2;F-=w*Math.tan(W),L-=w/Math.tan(W)}T[1]=(b.height-2*w)/this.bboxSize,L===F?(T[0]=3,T[2]=L/this.bboxSize*2):(T[0]=4,T[2]=L/this.bboxSize*2,T[3]=F/this.bboxSize*2),_=(Math.hypot(T[1],Math.max(Math.abs(T[2]),Math.abs(T[3])))+w/this.bboxSize*2)*hh.x+E}else if(b?.type==="TorusGeometry"){if(T[0]=5,T[1]=(b.width-b.depth)/this.bboxSize,T[2]=b.depth/this.bboxSize,b.arc!==360){T[0]=6,T[3]=T[1],t[$r*12+a*4+3]=T[2];let O=2*Math.atan2(T[2]/2,T[1]),L=b.arc*Math.PI/180/2-O;T[1]=Math.sin(L),T[2]=Math.cos(L)}_=b.width*hh.x/this.bboxSize+E}else{let O=y.geometry;(l??(l=new Set)).add(O.uuid);let L=this._meshSdfBaked.get(O.uuid),F=Jne(O);if((L===void 0||L.posVersion!==F)&&this._meshSdfWanted.set(O.uuid,O),L===void 0)return;T[0]=7,T[1]=L.slot,T[2]=L.boxHalf.x/this.bboxSize*2,T[3]=L.boxHalf.y/this.bboxSize*2,t[$r*12+a*4+3]=L.boxHalf.z/this.bboxSize*2,_=Math.hypot(L.boxHalf.x,L.boxHalf.y,L.boxHalf.z)/this.bboxSize*2*hh.x+E}t.set(T,$r*8+a*4),e=Math.max(e,_),n=Math.max(n,E),this._reach[a]=_,t[$r*12+a*4]=E,t[$r*12+a*4+1]=w/this.bboxSize*2,t[$r*12+a*4+2]=hh.x;let A=Array.isArray(y.material)?y.material[0]:y.material,C=A,R,D;if(C?.getShapeBlendBaseColor){let O=C.getShapeBlendBaseColor();R=O,D=O.a}else A?.uniforms?.nodeU0!==void 0?(R=A.uniforms.nodeU0.node.value,D=A.uniforms.nodeU1?.value??1):(R={r:1,g:1,b:1},D=1);x.operation!==0&&!x.useColor&&(D=-1),t[$r*16+a*4]=R.r,t[$r*16+a*4+1]=R.g,t[$r*16+a*4+2]=R.b,t[$r*16+a*4+3]=D,D<1&&this.material.defines?.SHAPEBLEND_C===1&&this.material.setTransparent(!0),a++}),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=a,this._maxBlendK=n;let c=e*1.1+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=c;let u=this._prevShapeData,d=o!==a,h=u===null||this._prevSpan!==c||d,p=h||tI,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(a,o);for(let y=0;y<g;y++){let v=!1;for(let C=0;C<mc;C++){let R=$r*4*C+y*4;if(t[R]!==u[R]||t[R+1]!==u[R+1]||t[R+2]!==u[R+2]||t[R+3]!==u[R+3]){v=!0;break}}if(!v)continue;if(h=!0,p)break;let b=t[y*4],x=t[y*4+1],S=t[y*4+2],E=u[y*4],T=u[y*4+1],w=u[y*4+2],_=this._reach[y],A=this._prevReach[y];if(!Number.isFinite(b+x+S+_)||!Number.isFinite(E+T+w+A)){p=!0;continue}f.x=Math.min(f.x,b-_,E-A),f.y=Math.min(f.y,x-_,T-A),f.z=Math.min(f.z,S-_,w-A),m.x=Math.max(m.x,b+_,E+A),m.y=Math.max(m.y,x+_,T+A),m.z=Math.max(m.z,S+_,w+A)}}return tI&&(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();Eo("ShapeBlendGeometry",(i,t,e)=>new nb(i,t,e));Mt("shape-blends");ii();$i();var BE=class extends Yt{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?xv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}};Qt();Eo("VectorGeometry",(i,t,e)=>new BE(i,t,e));Mt("vector-shapes");$i();ii();Rv();Iw();Dv();Dw();var FE=class extends Yt{constructor(e,n,r){super(e,n,r);this.isPathObject=!0;this._shapeId=null;this._lastShapeParams=null;this._lastShape=null;this._context=r}get profileShape(){return this._lastShape??void 0}updateState(e,n){super.updateState(e,n),this.updateShape(),this.refreshAttachedCloners(n)}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let s in e)typeof e[s]=="string"&&(e[s]=this._context.shared.getVariable(e[s],[this.uuid,"geometry","extrusion","shape",s]));let n;if(e.type==="Custom"){let s=e.shapeId;if(s!==this._shapeId&&this.detachShape(),s){this._shapeId=s;let o=this._context.scene.find(s);o?.data&&(o.attachedPaths.add(this),n=o.geometry.userData?.shape),n||this._context.scene.addPendingCommand(()=>this.updateShape())}}else if(this._lastShape!==null&&this._sameShapeParams(e))n=this._lastShape;else{let s;switch(e.type){case"Rectangle":s=Wf;break;case"Ellipse":s=jf;break;case"Polygon":s=Rw;break;case"Star":s=Ow;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;if(n&&r.inputs){if(this._lastShape=n,e.type==="Custom"&&(this._lastShapeParams=null),r.inputs.shapeData===n)return;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?xv(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,e,n):super.updateEntityBoxSize(e,n)}};kf();q();pt();Rv();Ew();nh();_w();JP();function w4(i,t){let e=2*Math.PI;return(i%e+e)%e===(t%e+e)%e}var E4=new te,sre=new te,ore=new te().makeScale(1,1,-1),T4=new M,M4=new M,rI=new M,are=new M,lre=new M,cre=new M,ure=new M,_4=new WeakMap,iI=new WeakMap;function dre(i,t,e){let n=[new M,new M,new M],r=[new M,new M,new M];return i.extractBasis(n[0],n[1],n[2]),t.extractBasis(r[0],r[1],r[2]),n.forEach((s,o)=>{let a=r[o],l=ge.lerp(s.length(),a.length(),e);s.lerp(a,e).setLength(l)}),new te().makeBasis(n[0],n[1],n[2])}function A4(i){i.setIndex(null),i.setAttribute("position",new Ue(new Float32Array(0),3)),i.setAttribute("normal",new Ue(new Float32Array(0),3)),i.setAttribute("uv",new Ue(new Float32Array(0),2)),i.setDrawRange(0,0)}var C4=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),o=i.shapeData??t?.shapeData??jf.create({parameters:{...zd,width:typeof zd.width=="number"?zd.width:100,height:typeof zd.height=="number"?zd.height:100}}).userData.shape;return{ownerId:i.ownerId??t?.ownerId,path:i.path??af.defaultData(),parameters:Object.assign(e,{width:n,height:r,depth:s,extrusion:{...m1,...e.extrusion}}),shapeData:o}}static build(i){if(i.path.points.length>=2){let e=new sI(i);return Object.assign(e,{userData:{...i,type:"PathGeometry"}})}else{let e=new Me;return A4(e),Object.assign(e,{userData:{...i,type:"PathGeometry"}})}}},sI=class extends Me{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)||!w4(e.twist,0)||e.startScale!==e.endScale}build(){let{points:e,matrices:n}=this._getSampledPath();if(e.length<2){A4(this);return}let{depth:r,offset:s}=this.inputs.parameters.extrusion;r=Math.max(0,Math.min(r,1)),s=Math.max(0,Math.min(s,1));let o=this.inputs.path.isClosed?e.length:e.length-1,a=Math.floor(s*o),l=this.inputs.path.isClosed?Math.ceil((r+s)*o):Math.ceil(Math.min(1,r+s)*o),c=Math.min(Math.max(2,l-a+1),o+2),u=[],d=[];for(let ae=0;ae<c;ae++){let de=this.inputs.path.isClosed?(ae+a)%e.length:Math.min(ae+a,e.length-1);u.push(e[de].clone()),d.push(n[de].clone())}let h=(ae,de,be)=>{u[ae]=u[ae].clone().lerp(u[de],be),d[ae]=dre(d[ae],d[de],be)},p=0,f=s*o%1;(!this.inputs.path.isClosed||r<=1)&&(f||s===0)&&(p=f,h(0,1,p));let m=0,g=(s+r)*o%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 ae=u.length-1;u[ae].copy(u[0]),d[ae].copy(d[0])}this._applyPathModifiers(d,p,m);let{bevel:y,bevelSides:v}=this.inputs.parameters.extrusion,b=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(b=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:x,infos:S,vertices:E}=this._getShapePoints(b),T=y>0?this.inputs.parameters.extrusion.capType:"flat",w=T==="round"?VV(this.inputs.shapeData,y,v,b,this.inputs.ownerId):void 0,_=w!==void 0&&this.inputs.parameters.extrusionVersion===1?Tw(w):w,A=T==="round"&&_===void 0?"flat":T,C=_!==void 0?_.positions.length/3:0,R=0,D=0;S.sort((ae,de)=>ae.start-de.start),S.forEach(ae=>{ae.verticesStart=R,ae.verticesCount=ae.continuous.reduce((de,be,Re)=>de+(Re===0||!be?2:1),0),D+=ae.verticesCount,R=D});let O=D*c,L,F=0;this._isOpenEnded()&&A==="flat"&&(L=this._getSurfaceTesselation(x),F=L.vertexCount);let j=O+2*F+C*2,W=O+2*F,K={positions:new Float32Array(j*3),normals:new Float32Array(j*3),uvs:new Float32Array(j*2)},Y=0;S.forEach(ae=>{Y+=ae.count});let $=Y*(c-1)*6+(L?2*L.elementCount*3:0)+(_!==void 0?2*_.indices.length:0),ee=new Uint32Array($),oe=0;if(S.forEach(ae=>{oe=this._extrudeRegion(ae,E,d,u,K,ee,oe,this._isGeometryClosed()&&!this._isOpenEnded())}),L&&(oe=this._closeEnd(L,O,ee,oe,K,d[0],u[0],!1),oe=this._closeEnd(L,O+F,ee,oe,K,d[d.length-1],u[u.length-1],!0)),_!==void 0){let ae={positions:K.positions,normals:K.normals,uvs:K.uvs,indices:ee};Cv(_,ae,W,oe,E4.copy(d[0]).setPosition(u[0]).multiply(ore),(de,be,Re)=>[Re,1e-4]),oe+=_.indices.length,W+=C,Cv(_,ae,W,oe,E4.copy(d[d.length-1]).setPosition(u[u.length-1]),(de,be,Re)=>[Re,1]),oe+=_.indices.length}this.setAttribute("position",new Ue(K.positions,3)),this.setAttribute("normal",new Ue(K.normals,3)),this.setAttribute("uv",new Ue(K.uvs,2)),this._setIndexFromUint32(ee)}_setIndexFromUint32(e){let n=!1;for(let r=e.length-1;r>=0;--r)if(e[r]>=65535){n=!0;break}this.setIndex(new Ue(n?e:new Uint16Array(e),1))}_getSampledPath(){let e=this.inputs.path,n=X1(e),r=_4.get(n);if(r===void 0||r.subdivisions!==e.subdivisions||r.subdivisionMode!==e.subdivisionMode){let s=this._extractPathPoints(n),o=s.length<2?[]:this._computeBasisMatrices(s);r={subdivisions:e.subdivisions,subdivisionMode:e.subdivisionMode,points:s,matrices:o},_4.set(n,r)}return r}_extractPathPoints(e){let n=this.inputs.path.subdivisions,r=this.inputs.path.subdivisionMode==="uniform"?e.getSpacedPoints(n*4):e.getPoints(n);if(r.length<2)return[];let s=[r[0]];return r.forEach(a=>{s[s.length-1].distanceToSquared(a)>.001&&s.push(a)}),this.inputs.path.isClosed&&s[s.length-1].distanceTo(s[0])<.001&&s.pop(),s}_computeBasisMatrices(e){let n=[],r=e.length,s=this.inputs.path.isClosed,o=new M,a=new M,l=new M,c=new M,u=new M(0,1,0);for(let g=0;g<r;g++){let y=e[g],v;g===0?v=s?e[r-1]:T4.copy(y).multiplyScalar(2).sub(e[1]):v=e[g-1];let b;g===r-1?b=s?e[0]:T4.copy(y).multiplyScalar(2).sub(e[g-1]):b=e[g+1],M4.subVectors(y,v).normalize(),rI.subVectors(b,y).normalize();let x=are.addVectors(M4,rI);x.lengthSq()<1e-10&&(x.copy(rI),x.dot(l)<0&&x.negate()),x.normalize(),l.copy(x),g===0&&(x.equals(u)||lre.copy(x).negate().equals(u))&&u.set(0,0,1);let S=cre.crossVectors(u,x).normalize(),E=ure.crossVectors(x,S).normalize();u.copy(E),c.copy(S),g===0&&(o.copy(E),a.copy(x));let T=new te().makeBasis(S,E,x);n.push(T)}let d=s?a:l,h=s?o:new M(0,1,0),p=d.clone().cross(c).normalize(),f=Math.acos(h.dot(p));if(isNaN(f))return n;let m=h.clone().cross(p);d.dot(m)>0&&(f*=-1);for(let g=1;g<n.length;g++)n[g].multiply(sre.makeRotationZ(f*g/n.length));return n}_applyPathModifiers(e,n,r){let s=e.length,{angle:o,twist:a,startScale:l,endScale:c}=this.inputs.parameters.extrusion,u=new te,d=new te;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(ge.lerp(o,o+a,f)*ge.DEG2RAD);let m=ge.lerp(l,c,f);d.makeScale(m,m,m),h.multiply(u).multiply(d)}),e}_getShapePoints(e,n=Nn.ODD){let r=this.inputs.shapeData,s=iI.get(r);return(s===void 0||s.curveSegments!==e||s.windingRule!==n)&&(s={curveSegments:e,windingRule:n,shapePoints:this._computeShapePoints(e,n)},iI.set(r,s)),s.shapePoints}_getSurfaceTesselation(e){let n=iI.get(this.inputs.shapeData);if(n?.surfaceTesselation!==void 0)return n.surfaceTesselation;let r;try{r=Eu({windingRule:Nn.ODD,elementType:si.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:e})}catch{r=ww}return n!==void 0&&(n.surfaceTesselation=r),r}_computeShapePoints(e=12,n=Nn.ODD){let r=this.inputs.shapeData,s=r.extractShapePointsToFlatArray([],e),o=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}),a;try{a=Eu({windingRule:n,elementType:si.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]})}catch{a=Sw}let l;try{l=Eu({windingRule:Nn.ODD,elementType:si.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...o]})}catch{l=PV}if(!a)throw new Error("error generating geometry");let c=a.elementCount;if(l){a.elementCount+=l.elementCount;for(let m=0;m<l.elements.length;m++){let g=l.elements[m],y=m%2===0?a.vertexCount:0;a.elements.push(g+y)}for(let m=0;m<l.vertexIndices.length;m++){let g=l.vertexIndices[m],y=a.vertexCount;a.vertexIndices.push(g+y)}for(let m=0;m<l.vertices.length;m++){let g=l.vertices[m];a.vertices.push(g)}}let u=1/0,d=-1/0,h=1/0,p=-1/0;for(let m=0,g=a.vertexCount;m<g;m++){let y=m*2,v=a.vertices[y+0],b=a.vertices[y+1];v<u&&(u=v),v>d&&(d=v),b<h&&(h=b),b>p&&(p=b)}let f=[];for(let m=a.elementCount-1;m>=0;m--){let g=m>=c,y=m*2,v=a.elements[y+0],b=a.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,T=x-1,w=v+1,_=r.roundedCurves.length;do{let A=E-v,C=a.vertices[T*2+0],R=a.vertices[T*2+1],D=a.vertices[E*2+0],O=a.vertices[E*2+1],L=a.vertices[w*2+0],F=a.vertices[w*2+1],j=D-C,W=O-R,K=Math.sqrt(j*j+W*W);j/=K,W/=K;let Y=D-L,$=O-F,ee=Math.sqrt(Y*Y+$*$);Y/=ee,$/=ee,S.normals[A*2+0]=-$,S.normals[A*2+1]=Y;let oe=a.vertexIndices[E];if(Array.isArray(oe))S.continuous[A]=!1;else{let[ae,de]=r.getCurveIndexFromVertexId(oe-1,!0);if(de>0&&de<1)S.continuous[A]=!0;else{let be=de===1?ae+1:ae-1;be=(be+_)%_;let Re=de===1?0:1,me=r.roundedCurves[ae].getTangent(de),Ae=r.roundedCurves[be].getTangent(Re);S.continuous[A]=me.dot(Ae)>.95}}g&&(S.normals[A*2+0]*=-1,S.normals[A*2+1]*=-1),[T,E,w]=[E,w,w+1],w>=x&&(w-=b)}while(w!==v+1)}return{regions:[s,...o],infos:f,vertices:a.vertices}}_insertVertex(e,n,r,s,o){let a=n*2,l=n*3;e.positions[l+0]=r.x,e.positions[l+1]=r.y,e.positions[l+2]=r.z,e.normals[l+0]=s.x,e.normals[l+1]=s.y,e.normals[l+2]=s.z,e.uvs[a+0]=o.x,e.uvs[a+1]=o.y}_extrudeRegion(e,n,r,s,o,a,l,c){let u=e.wallTemplate;if(u===void 0){u=[];for(let x=0;x<e.count;x++){let S=(e.start+x)*2,E=n[S+0],T=n[S+1],w,_;if(e.continuous[x])w=e.normals[x*2+0],_=e.normals[x*2+1];else{let C=x===0?(e.start+e.count-1)*2:S-2,R=E-n[C+0];w=-(T-n[C+1]),_=R,e.isHole||(w=-w,_=-_)}let A=x===0?1:x/e.count;if(u.push(E,T,w,_,A,0),!e.continuous[x]||x===0)if(x===0)u.push(E,T,e.normals[0],e.normals[1],0,1);else{let C=x===e.count-1?e.start*2:S+2,R=n[C+0]-E;w=-(n[C+1]-T),_=R,e.isHole||(w=-w,_=-_),u.push(E,T,w,_,A,1)}}e.wallTemplate=u}let d=r.length,h=u.length,p=o.positions,f=o.normals,m=o.uvs;for(let x=0;x<d;x++){let S=r[x].elements,E=S[0],T=S[1],w=S[2],_=S[4],A=S[5],C=S[6],R=S[12],D=S[13],O=S[14],L=s[x],F=x/(d-1),j=0,W=0,K=0,Y=e.verticesStart*d+e.verticesCount*x;for(let $=0;$<h;$+=6){if(u[$+5]===0){let Le=u[$+0],Ie=u[$+1];j=E*Le+_*Ie+R+L.x,W=T*Le+A*Ie+D+L.y,K=w*Le+C*Ie+O+L.z}let ee=u[$+2],oe=u[$+3],ae=E*ee+_*oe+R,de=T*ee+A*oe+D,be=w*ee+C*oe+O,Re=1/(Math.sqrt(ae*ae+de*de+be*be)||1);ae*=Re,de*=Re,be*=Re;let me=Y*2,Ae=Y*3;p[Ae+0]=j,p[Ae+1]=W,p[Ae+2]=K,f[Ae+0]=ae,f[Ae+1]=de,f[Ae+2]=be,m[me+0]=u[$+4],m[me+1]=F,Y++}}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 T=0;T<v;T+=2){let w=S+g[T],_=S+g[T+1],A=E+g[T+1],C=E+g[T];b?(a[l++]=w,a[l++]=A,a[l++]=_,a[l++]=w,a[l++]=C,a[l++]=A):(a[l++]=w,a[l++]=_,a[l++]=A,a[l++]=w,a[l++]=A,a[l++]=C)}}return l}_closeEnd(e,n,r,s,o,a,l,c){let u=e.vertexCount,d=new M(0,0,c?-1:1).applyMatrix4(a),h=new M,p=new G;for(let m=0;m<u;m++){let g=2*m;h.set(e.vertices[g+0],e.vertices[g+1],0).applyMatrix4(a).add(l),this._insertVertex(o,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}};Qt();Eo("PathGeometry",(i,t,e)=>new FE(i,t,e));uv("PathGeometry",C4);Mt("3d-paths");cv();Qt();wo.Cloner=$s;Mt("cloners");an();dn();pt();q();av();cv();Yi();xu();$i();oI();var ib=class extends _o(Bs,So){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=yu.getComponentData({scene:n.scene.data,shared:n.shared.data},e.component);if(r){let s,o;for(let a of yo.rootOverrideProps)e[a]===void 0?(s===void 0&&(s={...e}),s[a]=r.data[a]):(o===void 0&&(o={}),o[a]=e[a],s===void 0&&(s={...e}),s[a]=Fa.apply(r.data[a],e[a]));return this.overrideData=o,s}else return{...Ur.defaultData,...e,...Vy(Ur.defaultData,yo.rootOverrideProps)}}updateByOp(e,n,r,s){let o;if(this.isInstanceRoot&&!s){if(n=this.transformAssignData(n,r),e.type===0&&e.path.length===0&&this.component)for(let a of yo.rootOverrideProps)a in e.props&&e.props[a]===void 0&&(o===void 0&&(o={...e,props:{...e.props}}),o.props[a]=this.component.data[a]);else if(e.type===0&&e.path.length>0&&yo.rootOverrideProps.includes(e.path[0])){let a=e.path[0];o===void 0&&(o={...e,path:[],props:{[a]:n[a]}})}}super.updateByOp(o??e,n,r,s)}updateState(e,n){this.updateState_Entity(e,n)}expandInstanceChildren(e){let n=this.data;if(this.component===void 0){let r=e.scene.find(n.component)??null,s=!1;if(r!==this.oldComponent){if(this.oldComponent){let o=0;for(let a of this.children)if(Ot.is(a))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),rb(a),o+=1;else break;this.children.splice(0,o)}s=!0}if(r){let o={};R4(e,[this.uuid],n.overrides,this,r,r,0,s,o);for(let a of this.children)if(Ot.is(a)){let l=a.data;l.type==="Empty"&&l.animations&&a.traverseEntity(c=>{let u=c.dataPatched;if(c instanceof Yt&&u.bones&&u.boneInverses){let d=c.dataPatched;if(d.bones&&d.boneInverses){let h=d.bones.map(m=>e.scene.find(o[m])),p=d.boneInverses.map(m=>new te().fromArray(m)),f=new Nl(h,p);c.bind(f,c.bindMatrix)}}else c.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function P4(i,t,e,n){return i.component===t&&Jo(i.identity,n)?i.overrideData===e?2:1:0}function R4(i,t,e,n,r,s,o,a,l){if(o>50)return!1;if(n.component!==r){if(n.component){let u=n.component.instances.indexOf(n);u>=0&&n.component.instances.splice(u,1)}r.instances.find(u=>u===n)||r.instances.push(n),n.component=r}r instanceof ib&&r.isInstanceRoot&&r.expandInstanceChildren(i);let c=0;for(let u of r.children)if(Ot.is(u)){let d=[...t,...typeof u.identity=="string"?[u.identity]:u.identity],h=hf.resolve(e,d,1);h!=null&&!(h instanceof _n)&&(Object.setPrototypeOf(h,_n.prototype),console.error("wrong prototype"));let p=null,f;if(!a){let m=n.children[c];if(p=Ot.is(m)?m:null,p!==null){let g=P4(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=P4(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?Fa.apply(u.data,h):u.data;ta.is(m.type)&&(m={...m,type:"Empty"}),p=wo.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,R4(i,t,e,p,u,s,o+1,a,l)}if(!a){let u=c;for(;;){let d=n.children[c];if(Ot.is(d))i.pendingDeletes.add(d);else break;c+=1}n.children.splice(u,c-u)}return!0}Qt();var I4=(i,t,e)=>new ib(i,t,e);Kd("Component",I4);Kd("Instance",I4);Mt("components");var aI=1e-10;function O4(i){let t=i[0][0],e=i[1][0],n=i[0][1],r=i[1][1],s=Math.sqrt(t*t+e*e),o=s>aI?t/s:1,a=s>aI?e/s:0,l=o*t+a*e,c=o*r-a*n,u=o*n+a*r;return{rotation:Math.atan2(a,o),scale:[l,c],shear:[Math.abs(c)>aI?u/c:0,0]}}function D4({rotation:i,scale:t,shear:e}){let n=Math.cos(i),r=Math.sin(i),s=e[0]*t[1],o=e[1]*t[0];return[n*t[0]-r*o,r*t[0]+n*o,n*s-r*t[1],r*s+n*t[1]]}var At;(S=>{function i(){return[1,0,0,0,1,0,0,0,1]}S.identity=i;function t(E,T=S.identity()){for(let w=0,_=E.length;w<_;w++)T[w]=E[w];return T}S.copy=t;function e(E,T,w,_,A,C){return S.setAbcdef(S.identity(),E,T,w,_,A,C)}S.create=e;function n(E,T,w,_,A,C,R){return E[0]=T,E[1]=_,E[2]=C,E[3]=w,E[4]=A,E[5]=R,E}S.setAbcdef=n;function r(E,T){let[w,_,A,C,R,D]=o(E),[O,L,F,j,W,K]=o(T),Y=O*w+L*A,$=O*_+L*C,ee=F*w+j*A,oe=F*_+j*C,ae=W*w+K*A+R,de=W*_+K*C+D;return S.create(Y,$,ee,oe,ae,de)}S.append=r;function s(E,T){let[w,_,A,C,R,D]=o(E),[O,L,F,j,W,K]=o(T),Y=w,$=_,ee=A,oe=C;(O!==1||L!==0||F!==0||j!==1)&&(Y=w*O+_*F,$=w*L+_*j,ee=A*O+C*F,oe=A*L+C*j);let ae=R*O+D*F+W,de=R*L+D*j+K;return S.create(Y,$,ee,oe,ae,de)}S.prepend=s;function o(E){return[E[0],E[3],E[1],E[4],E[2],E[5]]}S.getAbcdef=o;function a(E){let[T,w,_,A,C,R]=S.getAbcdef(E),D=T*A-w*_,O=A/D,L=-w/D,F=-_/D,j=T/D,W=(_*R-A*C)/D,K=-(T*R-w*C)/D;return S.create(O,L,F,j,W,K)}S.invert=a;function l([E,T],w){let[_,A,C,R,D,O]=S.getAbcdef(w);return[_*E+C*T+D,A*E+R*T+O]}S.apply=l;function c(E,T){let[w,_,A,C,R,D]=S.getAbcdef(T),O=1/(w*C+A*-_),[L,F]=E;return[C*O*L+-A*O*F+(D*A-R*C)*O,w*O*F+-_*O*L+(-D*w+R*_)*O]}S.applyInverse=c;function u(E,T,w=T){let[_,A,C,R,D,O]=S.getAbcdef(E);return S.setAbcdef(E,_*T,A*w,C*T,R*w,D*T,O*w),E}S.scale=u;function d(E,T){let w=Math.cos(T),_=Math.sin(T),[A,C,R,D,O,L]=S.getAbcdef(E);return S.setAbcdef(E,A*w-C*_,A*_+C*w,R*w-D*_,R*_+D*w,O*w-L*_,O*_+L*w),E}S.rotate=d;function h(E,T,w){let[_,A]=w,C=S.translate(E,-_,-A);return C=S.rotate(C,T),C=S.translate(C,_,A),C}S.rotateAround=h;function p(E,T,w){let[_,A,C,R,D,O]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,R,D+T,O+w),E}S.translate=p;function f(E,T,w){let[_,A,C,R]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,R,T,w),E}S.setTranslate=f;function m(E,T,w){let[_,A,C,R]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,R,T,w),E}S.setPosition=m;function g(E){let[T,w,_,A]=S.getAbcdef(E),C=Math.sqrt(T*T+w*w),R=Math.sqrt(_*_+A*A);return[C,R]}S.getScale=g;function y(E){let[,,,,T,w]=S.getAbcdef(E);return[T,w]}S.getPosition=y;function v(E,T){return S.decompose(E,T).rotation}S.getRotation=v;function b(E,T){let[w,_,A,C,R,D]=S.getAbcdef(E),{rotation:O,scale:L,shear:F}=O4([[w,A],[_,C]]);return{position:[R+(T[0]*w+T[1]*A)-T[0],D+(T[0]*_+T[1]*C)-T[1]],scale:L,rotation:O,shear:F,pivot:T}}S.decompose=b;function x(E,T,w,_,A=[0,0]){let[C,R]=E,[D,O]=_,[L,F,j,W]=D4({rotation:w,scale:T,shear:A}),K=C-(D*L+O*j)+D,Y=R-(D*F+O*W)+O;return S.create(L,F,j,W,K,Y)}S.compose=x})(At||(At={}));function hre(i,t){let[[e,n],[r,s]]=i,[[o,a],[l,c]]=t,u=(e-r)*(a-c)-(n-s)*(o-l);if(u===0)return!1;let d=((e-o)*(a-c)-(n-a)*(o-l))/u,h=-((e-r)*(n-a)-(n-s)*(e-o))/u;return d>=0&&d<=1&&h>=0&&h<=1}var N4=[[-1,1],[-1,-1],[1,-1],[1,1]],L4=(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)):N4.forEach(o=>{let a=[o[0]*r[0]+n[0],o[1]*r[1]+n[1]];e.push(At.apply(a,s))})},Iu=class{constructor(){this.matrix=At.identity();this.min=[1/0,1/0];this.max=[-1/0,-1/0];this.vertices=[];this.edges=[]}setFromObjectSize(t,e=!1){t.updateWorldMatrix(),this.makeEmpty(),At.copy(t.worldMatrix,this.matrix);let n=At.invert(t.worldMatrix);this.expandByObjectSize(t,n,e)}expandByObjectSize(t,e,n=!1){let r=[],s=t.isBaseGroup===!0?t:void 0;n===!0&&s!==void 0?s.traverse(o=>{o.visible&&L4(o,e,r)}):L4(t,e,r),this.setFromPoints(r)}setFromSize(t,e,n){this.makeEmpty(),At.copy(n,this.matrix),this.expandBySize(t,e,n)}expandBySize(t,e,n){[At.apply([0,0],n),At.apply([0,e],n),At.apply([t,e],n),At.apply([t,0],n)].forEach(s=>this.expandByPoint(s))}getCenter(){let[t,e]=this.min,[n,r]=this.getHalfSize();return At.apply([t+n,e+r],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(t){this.makeEmpty();for(let e of t)this.expandByPoint(e)}expandByPoint(t){this.min=[Math.min(this.min[0],t[0]),Math.min(this.min[1],t[1])],this.max=[Math.max(this.max[0],t[0]),Math.max(this.max[1],t[1])]}computeVertices(){let[t,e]=this.getHalfSize(),n=this.getCenter(),[r,s,o,a]=At.getAbcdef(this.matrix),l=At.create(r,s,o,a,n[0],n[1]);this.vertices=N4.map(([c,u])=>At.apply([c*t,u*e],l))}computeEdges(){this.edges=[];for(let t=0,e=this.vertices.length;t<e;++t)this.edges.push([this.vertices[t],this.vertices[(t+1)%e]])}project(t,e){let n=this.matrix;return e&&(n=At.append(e.worldMatrix,n)),At.applyInverse(t,n)}intersects(t,e,n){return this.intersectsInLocalSpace(...this.project([t,e],n))}intersectsInLocalSpace(t,e){let{min:n,max:r}=this;return t>=n[0]&&t<=r[0]&&e>=n[1]&&e<=r[1]}containsPoint(t){let[e,n]=t,[r,s]=this.min,[o,a]=this.max;return e>=r&&e<=o&&n>=s&&n<=a}intersectsBBox2D(t){for(let e=0,n=this.edges.length;e<n;e++){let r=this.edges[e];for(let s=0,o=t.edges.length;s<o;s++){let a=t.edges[s];if(hre(r,a))return!0}}for(let e=0,n=t.vertices.length;e<n;e++){let r=t.vertices[e];if(this.containsPoint(r))return!0}return!1}ensureMinMax(){let t=this.min,e=this.max;this.min=[Math.min(t[0],e[0]),Math.min(t[1],e[1])],this.max=[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}copy(t){this.min=[...t.min],this.max=[...t.max],At.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new Iu;return t.copy(this),t}};pt();var pre='{"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":{}}',B4=()=>JSON.parse(pre);async function fre(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,B4(),!0)}}var UE,sb;function mre(i){UE=i}function lI(){if(!sb){if(!UE)return Promise.reject(new Error("HanaRenderer: no Hana UI loader registered. Call setHanaUILoader() from the host app before initializing a HanaRenderer."));sb=UE(),sb.catch(()=>{sb=void 0})}return sb}var F4;function gre(){let i=typeof process<"u"?"2.0.77":void 0;return`https://cdn.spline.design/@splinetool/runtime${i?`@${i}`:""}/build/hana-ui.wasm`}function U4(i){F4=i}function k4(){return UE||mre(async()=>{let t=await import("./hana-ui.js");return fre(t,F4??gre())}),lI().then(()=>{})}var zE=ed(VE(),1);function j4(i){let t=[],e;try{e=(0,zE.makeAbsolute)((0,zE.parseSVG)(i))}catch(c){return console.error("[HanaRenderer] Failed to parse SVG path:",c),t}let n=0,r=0,s=0,o=0,a=null,l=null;for(let c of e){let u=null,d=null;switch(c.code){case"M":n=s=c.x,r=o=c.y,t.push({MoveTo:{x:n,y:r}});break;case"L":n=c.x,r=c.y,t.push({LineTo:{x:n,y:r}});break;case"H":n=c.x,t.push({LineTo:{x:n,y:r}});break;case"V":r=c.y,t.push({LineTo:{x:n,y:r}});break;case"C":{let h={x:c.x1,y:c.y1},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"S":{let h=a?{x:2*n-a.x,y:2*r-a.y}:{x:n,y:r},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"Q":{let h={x:c.x1,y:c.y1};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"T":{let h=l?{x:2*n-l.x,y:2*r-l.y}:{x:n,y:r};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"A":{let h=n,p=r;n=c.x,r=c.y,xre(t,h,p,c.rx,c.ry,c.xAxisRotation,c.largeArc,c.sweep,n,r);break}case"Z":n=s,r=o,t.push("ClosePath");break}a=u,l=d}return t}function xre(i,t,e,n,r,s,o,a,l,c){if(t===l&&e===c)return;if(n=Math.abs(n),r=Math.abs(r),n===0||r===0){i.push({LineTo:{x:l,y:c}});return}let u=s*Math.PI/180,d=Math.cos(u),h=Math.sin(u),p=(t-l)/2,f=(e-c)/2,m=d*p+h*f,g=-h*p+d*f,y=m*m/(n*n)+g*g/(r*r);if(y>1){let Y=Math.sqrt(y);n*=Y,r*=Y}let v=n*n,b=r*r,x=v*b-v*g*g-b*m*m,S=v*g*g+b*m*m,E=(o!==a?1:-1)*Math.sqrt(Math.max(0,x/S)),T=E*(n*g)/r,w=E*(-r*m)/n,_=d*T-h*w+(t+l)/2,A=h*T+d*w+(e+c)/2,C=Math.atan2((g-w)/r,(m-T)/n),D=Math.atan2((-g-w)/r,(-m-T)/n)-C;!a&&D>0?D-=2*Math.PI:a&&D<0&&(D+=2*Math.PI);let O=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2))),L=D/O,F=4/3*Math.tan(L/4),j=C,W=t,K=e;for(let Y=0;Y<O;Y++){let $=j+L,ee=Math.cos(j),oe=Math.sin(j),ae=Math.cos($),de=Math.sin($),be=_+n*ae*d-r*de*h,Re=A+n*ae*h+r*de*d,me=-n*oe*d-r*ee*h,Ae=-n*oe*h+r*ee*d,Le=-n*de*d-r*ae*h,Ie=-n*de*h+r*ae*d;i.push({CurveTo:[{x:W+F*me,y:K+F*Ae},{x:be-F*Le,y:Re-F*Ie},{x:be,y:Re}]}),j=$,W=be,K=Re}}var jE=.5522847498307936,Ere=150,Tre=5*60*1e3,Mre=1536/2816;function K4(i){let t=i.getUint32(0);if(t===65536||t===1330926671||t===1953658213)return 0;if(t===1953784678)return i.getUint32(8)>0?i.getUint32(12):void 0}function _re(i){try{return K4(new DataView(i))!==void 0}catch{return!1}}function Are(i){try{let t=new DataView(i),e=K4(t);if(e===void 0)return;let n=t.getUint16(e+4),r=-1,s=-1;for(let c=0;c<n;c++){let u=e+12+c*16,d=t.getUint32(u);d===1751474532&&(r=t.getUint32(u+8)),d===1330851634&&(s=t.getUint32(u+8))}if(r<0||s<0)return;let o=t.getUint16(r+18),a=t.getUint16(s);if(o===0||a<2)return;let l=t.getInt16(s+86);return l>0?l/o:void 0}catch{return}}var H4=!1;function W4(){H4||(H4=!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 HE=class{constructor(t,e=1){this.canvas=t;this._dpr=e;this._width=0;this._height=0;this._isSizeDirty=!1;this._crashed=!1;this._shapes=[];this._lastPushedJSON="";this._ctm=At.identity();this._stack=[];this._clips=[];this._pathEls=[];this._simpleShape=null;this._pathPrimitives=0;this._fillColor=Vt.transparent;this._strokeColor=Vt.transparent;this._lineWidth=1;this._strokeMode="inside";this._layerBlur=0;this._backgroundBlur=0;this._dropShadowBlur=0;this._dropShadowOffsetX=0;this._dropShadowOffsetY=0;this._dropShadowColor=Vt.transparent;this._innerShadowBlur=0;this._innerShadowOffsetX=0;this._innerShadowOffsetY=0;this._innerShadowSpread=0;this._innerShadowColor=Vt.transparent;this._fonts=new Map;this._fontsFlushed=new Set;this._engineFonts=new Set;this._fontXPerEm=new Map;this._measureCache=new Map;try{let n=t.getBoundingClientRect();t.width=n.width*e,t.height=n.height*e}catch{console.log(t.width,e)}}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this._isSizeDirty=!0}get width(){return this._width}get height(){return this._height}async init(){if(!(this._engine||this._crashed)){try{this._context=await lI(),this._engine=await this._context.createEngine(this.canvas)}catch(t){this._crashed=!0,console.error("[HanaRenderer] Failed to load the Hana UI engine; UI scenes will not render.",t);return}if(this._width>0&&this._height>0)this._syncViewport();else{let t=this.canvas.getBoundingClientRect();t.width>0&&t.height>0&&(this._width=t.width,this._height=t.height,this._syncViewport())}this._flushFonts(),this.uiFontReady=this._watchUiFont()}}_watchUiFont(){return new Promise(t=>{let e=this._engine;if(!e||typeof e.scene.isUiFontLoaded!="function"){t();return}let n=()=>{let o=!1;return this._guard(()=>{o=e.scene.isUiFontLoaded()}),o};if(n()){t();return}let r=Date.now(),s=setInterval(()=>{if(this._crashed||Date.now()-r>Tre){clearInterval(s);return}n()&&(clearInterval(s),t())},Ere)})}_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),_re(t)&&this._engineFonts.add(e);let n=Are(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))===!1&&this._engineFonts.delete(e)}))}set strokeColor(t){this._strokeColor=t}set fillColor(t){this._fillColor=t}set lineWidth(t){this._lineWidth=t}set strokeMode(t){this._strokeMode=t}set dropShadowBlur(t){this._dropShadowBlur=t}set dropShadowColor(t){this._dropShadowColor=t}set dropShadowOffsetX(t){this._dropShadowOffsetX=t}set dropShadowOffsetY(t){this._dropShadowOffsetY=t}set innerShadowBlur(t){this._innerShadowBlur=t}set innerShadowColor(t){this._innerShadowColor=t}set innerShadowOffsetX(t){this._innerShadowOffsetX=t}set innerShadowOffsetY(t){this._innerShadowOffsetY=t}set innerShadowSpread(t){this._innerShadowSpread=t}set layerBlur(t){this._layerBlur=t}set backgroundBlur(t){this._backgroundBlur=t}save(){this._stack.push({ctm:At.copy(this._ctm),clipLen:this._clips.length})}restore(){let t=this._stack.pop();!t||(this._ctm=t.ctm,this._clips.length=t.clipLen)}setTransform(t,e=!1){let n=At.identity();if(this.camera?.enabled&&(n=At.append(n,this.camera.worldMatrix),e)){let r=At.getScale(this.camera.worldMatrix);n=At.scale(n,1/r[0],1/r[1])}this._ctm=At.append(n,t)}transform(t){this._ctm=At.append(this._ctm,t)}beginPath(){this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0}closePath(){this._pathEls.length!==0&&this._pathEls[this._pathEls.length-1]!=="ClosePath"&&this._pathEls.push("ClosePath")}_startFreeform(){this._simpleShape=null,this._pathPrimitives++}moveTo(t,e){this._startFreeform(),this._pathEls.push({MoveTo:{x:t,y:e}})}lineTo(t,e){this._startFreeform(),this._pathEls.push({LineTo:{x:t,y:e}})}bezierCurveTo(t,e,n,r,s,o){this._startFreeform(),this._pathEls.push({CurveTo:[{x:t,y:e},{x:n,y:r},{x:s,y:o}]})}quadraticCurveTo(t,e,n,r){this._startFreeform(),this._pathEls.push({QuadTo:[{x:t,y:e},{x:n,y:r}]})}path(t){this._startFreeform(),this._pathEls.push(...j4(t))}rect(t,e,n,r,s=0,o=0,a=0,l=0){if(!Y4([t,e,n,r]))return;let c={x:t,y:e,w:n,h:r,radii:[s,o,a,l]};this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"rect",rect:c,smoothing:0}:null,$4(this._pathEls,c)}ellipse(t,e,n,r,s,o,a,l){if(!!Y4([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,Ire(this._pathEls,t,e,n,r)}}clipRect(t,e,n,r,s=0,o=0,a=0,l=0){let c=At.invert(this._ctm);!c||this._clips.push({m:At.copy(this._ctm),inv:c,rect:{x:t,y:e,w:n,h:r,radii:[s,o,a,l]}})}fill(){this._emit(!0)}stroke(){this._strokeColor.a<=0||this._lineWidth<=0||this._emit(!1)}_emit(t){let e=this._effectChain(t);if(t&&this._fillColor.a<=0&&!e)return;let n=this._classifyShape();if(!n)return;let r=this._applyClips(n);if(r==="skip")return;if(!t&&r!==n){let o=ob(n);if(o){this._emitClippedRectStroke(o,e);return}}n=r;let s={shape:n,color:t?dm(this._fillColor):[0,0,0,0],transform:At.getAbcdef(this._ctm)};t||(s.stroke=this._strokeDesc()),e&&(s.effect_chain=e),this._shapes.push(s)}_emitClippedRectStroke(t,e){let n=this._lineWidth,r=this._strokeMode==="outside"?n:this._strokeMode==="center"?n/2:0,s=n-r,o=Math.min(t.w,t.h)/2,a=t.radii.map(y=>Math.max(0,Math.min(y,o))),l={x:t.x-r,y:t.y-r,w:t.w+r*2,h:t.h+r*2,radii:a.map(y=>y>0?y+r:0)},c=t.w-s*2,u=t.h-s*2,d=c>0&&u>0?{x:t.x+s,y:t.y+s,w:c,h:u,radii:a.map(y=>Math.max(0,y-s))}:null,h=this._applyClips(GE(l,0));if(h==="skip")return;let p=ob(h)??l,f=null;if(d){let y=this._applyClips(GE(d,0));f=y==="skip"?null:ob(y)??d}let m=[];$4(m,p),f&&Rre(m,f);let g={shape:{Custom:m},color:dm(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"?GE(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:dm(this._strokeColor),align:Cre[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:dm(this._dropShadowColor)}}),t&&this._backgroundBlur>0){let[r,s]=At.getScale(this._ctm),o=(r+s)/2;n.push({BackgroundBlur:{blur:{Uniform:{size:2*this._backgroundBlur*o}}}})}if(this._layerBlur>0&&n.push({LayerBlur:{blur:{Uniform:{size:2*this._layerBlur*e}}}}),t&&this._innerShadowColor.a>0){let[r,s,o,a]=At.getAbcdef(this._ctm),l=this._innerShadowOffsetX,c=this._innerShadowOffsetY;n.push({InnerShadow:{position:[r*l+o*c,s*l+a*c],blur:{Uniform:{size:2*this._innerShadowBlur*e}},spread:this._innerShadowSpread*e,color:dm(this._innerShadowColor)}})}return n.length>0?n:void 0}_applyClips(t,e=this._ctm){if(this._clips.length===0)return t;let n=t;for(let r of this._clips){let s=At.append(r.inv,e),[o,a,l,c,u,d]=At.getAbcdef(s),h=Math.abs(a)<=1e-6*(Math.abs(o)+Math.abs(c))&&Math.abs(l)<=1e-6*(Math.abs(o)+Math.abs(c)),p=Pre(n);if(!p)return n;if(!h){W4();continue}let f=o*p.minX+u,m=o*p.maxX+u,g=c*p.minY+d,y=c*p.maxY+d,v=Math.min(f,m),b=Math.max(f,m),x=Math.min(g,y),S=Math.max(g,y),E=r.rect,T=Math.max(v,E.x),w=Math.max(x,E.y),_=Math.min(b,E.x+E.w),A=Math.min(S,E.y+E.h);if(T>=_||w>=A)return"skip";if(T===v&&w===x&&_===b&&A===S)continue;let R=ob(n);if(!R||o===0||c===0){W4();continue}let D=(T-u)/o,O=(_-u)/o,L=(w-d)/c,F=(A-d)/c,j=Math.min(D,O),W=Math.min(L,F),K=Math.abs(O-D),Y=Math.abs(F-L),[$,ee,oe,ae]=R.radii,de=j!==R.x,be=W!==R.y,Re=j+K!==R.x+R.w,me=W+Y!==R.y+R.h,Ae=Math.min(K,Y)/2,Le=[de||be?0:Math.min($,Ae),Re||be?0:Math.min(ee,Ae),Re||me?0:Math.min(oe,Ae),de||me?0:Math.min(ae,Ae)];n=GE({x:j,y:W,w:K,h:Y,radii:Le},0)}return n}drawText(t,e){let n=this._engineFonts.has(e.font),r=this._fontXPerEm.get(e.font),s=!n&&r?r/Mre:1,o={TextSimple:{text:t,font_size:e.fontSize*s,size:[e.width,e.height],horizontal_align:q4[e.horizontalAlign]??"Left",vertical_align:X4[e.verticalAlign]??"Top",line_height:e.lineHeight,letter_spacing:e.letterSpacing,...n?{font_id:e.font}:{}}},a=this._effectChain(!0),l=this._fillColor.a>0,c=this._strokeColor.a>0&&this._lineWidth>0;if(l||c||a){let u=At.append(this._ctm,At.translate(At.identity(),e.x,e.y));if(this._applyClips(o,u)!=="skip"){let d={shape:o,color:l?dm(this._fillColor):[0,0,0,0],transform:At.getAbcdef(u)};c&&(d.stroke=this._strokeDesc()),a&&(d.effect_chain=a),this._shapes.push(d)}}return{height:this._measureTextHeight(t,e)}}_measureTextHeight(t,e){let n=`${e.font}|${e.fontSize}|${e.lineHeight}|${e.letterSpacing}|${e.width}|${t}`,r=this._measureCache.get(n);if(r!==void 0)return r;let s=0,o=this._engine;if(o&&!this._crashed&&this._fontsFlushed.has(e.font))try{let[,a]=o.scene.measureTextNaturalSize({size:[e.width,e.height],text:t,fontSize:e.fontSize,horizontalAlign:q4[e.horizontalAlign]??"Left",verticalAlign:X4[e.verticalAlign]??"Top",lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textTransform:"None",font:e.font,version:0,autoSize:"None",truncate:"None"});s=a}catch{}if(!(s>0)){let a=e.fontSize*.55+Math.max(0,e.letterSpacing),l=Math.max(1,Math.floor(e.width/a)),c=0;for(let u of t.split(`
9803
+ `,n.pyramidTextureSize.value=new G(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(),jG()?.release(this)}},nb=nI;nb.streamCompaction=new TE;var ere=new te,tre=new te,um=new ke,hh=new M,NE=new M,nre=new ke;function rre(i,t=0){let e=this.children.length;for(;e--;){let n=this.children[e];oc.is(n)&&S4.call(n,i,t+1)}}function S4(i,t=0){if(i(this,t)!==!0){let n=this.children.length;for(;n--;){let r=this.children[n];oc.is(r)&&S4.call(r,i,t+1)}}}function ire(){if(this.shapesDataTexture.value===void 0){let g=new Wn(new Float32Array(4*$r*mc),$r,mc,Xn,qt);this.shapesDataTexture.value=g}let i=this.shapesDataTexture.value,t=i.image.data,e=0,n=0,r=this.data.geometry.blendRange,s=ere.copy(this.matrixWorld).invert(),o=this._npart,a=0;this._meshSdfWanted.clear();let l=null;if(rre.call(this,g=>{if(g.visible===!1)return!0;let y;if(g instanceof $s)return;if(g instanceof il||bu(g))return;g instanceof Yr?y=g.object:y=g;let v=g.data?.cloner;if(Ot.is(g)&&v&&!v.hideBase&&v.type!=="radial"&&v.disabled!==!0||!(y instanceof Yt))return;let b=y.geometry.userData.parameters,x=b?.shapeBlendNode??y.dataPatched?.geometry?.shapeBlendNode;if(x===void 0)return;if(tre.multiplyMatrices(s,g.matrixWorld).decompose(NE,um,hh),b?.type==="TorusGeometry"&&b.arc!==360){let O=b.arc*Math.PI/180;O=O/4,um.multiply(nre.set(0,0,Math.sin(O),Math.cos(O)))}let E=x.overrideGlobalBlend?x.blendRange:r;E=E/this.bboxSize*2,t[a*4]=(NE.x-this.bboxOffset)/this.bboxSize*2,t[a*4+1]=(NE.y-this.bboxOffset)/this.bboxSize*2,t[a*4+2]=(NE.z-this.bboxOffset)/this.bboxSize*2,t[a*4+3]=x.operation===0?1:x.operation===2?-1:-2,t[$r*4+a*4]=-um.x,t[$r*4+a*4+1]=-um.y,t[$r*4+a*4+2]=-um.z,t[$r*4+a*4+3]=um.w;let T=new Float32Array(4),w=0,_=E;if(b?.type==="SphereGeometry")b.width===b.height&&b.width===b.depth?T[0]=0:T[0]=1,T[1]=b.width/this.bboxSize,T[2]=b.height/this.bboxSize,T[3]=b.depth/this.bboxSize,_=Math.max(T[1],T[2],T[3])*hh.x+E;else if(b?.type==="CubeGeometry"){w=b.cornerRadius;let O=b.width,L=b.height,F=b.depth;T[0]=2,T[1]=(O-2*w)/this.bboxSize,T[2]=(L-2*w)/this.bboxSize,T[3]=(F-2*w)/this.bboxSize,_=Math.sqrt(O**2+L**2+F**2)/this.bboxSize*hh.x+E}else if(b?.type==="CylinderGeometry"){w=b.cornerRadius;let O=b.height,L=b.radiusBottom,F=b.radiusTop;if(F>=L){let j=Math.atan2(F-L,O),W=(Math.PI/2-j)/2;F-=w/Math.tan(W),L-=w*Math.tan(W)}else if(L>F){let j=Math.atan2(L-F,O),W=(Math.PI/2-j)/2;F-=w*Math.tan(W),L-=w/Math.tan(W)}T[1]=(b.height-2*w)/this.bboxSize,L===F?(T[0]=3,T[2]=L/this.bboxSize*2):(T[0]=4,T[2]=L/this.bboxSize*2,T[3]=F/this.bboxSize*2),_=(Math.hypot(T[1],Math.max(Math.abs(T[2]),Math.abs(T[3])))+w/this.bboxSize*2)*hh.x+E}else if(b?.type==="TorusGeometry"){if(T[0]=5,T[1]=(b.width-b.depth)/this.bboxSize,T[2]=b.depth/this.bboxSize,b.arc!==360){T[0]=6,T[3]=T[1],t[$r*12+a*4+3]=T[2];let O=2*Math.atan2(T[2]/2,T[1]),L=b.arc*Math.PI/180/2-O;T[1]=Math.sin(L),T[2]=Math.cos(L)}_=b.width*hh.x/this.bboxSize+E}else{let O=y.geometry;(l??(l=new Set)).add(O.uuid);let L=this._meshSdfBaked.get(O.uuid),F=Jne(O);if((L===void 0||L.posVersion!==F)&&this._meshSdfWanted.set(O.uuid,O),L===void 0)return;T[0]=7,T[1]=L.slot,T[2]=L.boxHalf.x/this.bboxSize*2,T[3]=L.boxHalf.y/this.bboxSize*2,t[$r*12+a*4+3]=L.boxHalf.z/this.bboxSize*2,_=Math.hypot(L.boxHalf.x,L.boxHalf.y,L.boxHalf.z)/this.bboxSize*2*hh.x+E}t.set(T,$r*8+a*4),e=Math.max(e,_),n=Math.max(n,E),this._reach[a]=_,t[$r*12+a*4]=E,t[$r*12+a*4+1]=w/this.bboxSize*2,t[$r*12+a*4+2]=hh.x;let A=Array.isArray(y.material)?y.material[0]:y.material,C=A,R,D;if(C?.getShapeBlendBaseColor){let O=C.getShapeBlendBaseColor();R=O,D=O.a}else A?.uniforms?.nodeU0!==void 0?(R=A.uniforms.nodeU0.node.value,D=A.uniforms.nodeU1?.value??1):(R={r:1,g:1,b:1},D=1);x.operation!==0&&!x.useColor&&(D=-1),t[$r*16+a*4]=R.r,t[$r*16+a*4+1]=R.g,t[$r*16+a*4+2]=R.b,t[$r*16+a*4+3]=D,D<1&&this.material.defines?.SHAPEBLEND_C===1&&this.material.setTransparent(!0),a++}),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=a,this._maxBlendK=n;let c=e*1.1+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=c;let u=this._prevShapeData,d=o!==a,h=u===null||this._prevSpan!==c||d,p=h||tI,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(a,o);for(let y=0;y<g;y++){let v=!1;for(let C=0;C<mc;C++){let R=$r*4*C+y*4;if(t[R]!==u[R]||t[R+1]!==u[R+1]||t[R+2]!==u[R+2]||t[R+3]!==u[R+3]){v=!0;break}}if(!v)continue;if(h=!0,p)break;let b=t[y*4],x=t[y*4+1],S=t[y*4+2],E=u[y*4],T=u[y*4+1],w=u[y*4+2],_=this._reach[y],A=this._prevReach[y];if(!Number.isFinite(b+x+S+_)||!Number.isFinite(E+T+w+A)){p=!0;continue}f.x=Math.min(f.x,b-_,E-A),f.y=Math.min(f.y,x-_,T-A),f.z=Math.min(f.z,S-_,w-A),m.x=Math.max(m.x,b+_,E+A),m.y=Math.max(m.y,x+_,T+A),m.z=Math.max(m.z,S+_,w+A)}}return tI&&(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();Eo("ShapeBlendGeometry",(i,t,e)=>new nb(i,t,e));Mt("shape-blends");ii();$i();var BE=class extends Yt{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let n=this.geometry.getAttribute("position");n!==void 0?xv(n,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:n.count,t,e):super.updateEntityBoxSize(t,e)}};Qt();Eo("VectorGeometry",(i,t,e)=>new BE(i,t,e));Mt("vector-shapes");$i();ii();Rv();Iw();Dv();Dw();var FE=class extends Yt{constructor(e,n,r){super(e,n,r);this.isPathObject=!0;this._shapeId=null;this._lastShapeParams=null;this._lastShape=null;this._context=r}get profileShape(){return this._lastShape??void 0}updateState(e,n){super.updateState(e,n),this.updateShape(),this.refreshAttachedCloners(n)}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let s in e)typeof e[s]=="string"&&(e[s]=this._context.shared.getVariable(e[s],[this.uuid,"geometry","extrusion","shape",s]));let n;if(e.type==="Custom"){let s=e.shapeId;if(s!==this._shapeId&&this.detachShape(),s){this._shapeId=s;let o=this._context.scene.find(s);o?.data&&(o.attachedPaths.add(this),n=o.geometry.userData?.shape),n||this._context.scene.addPendingCommand(()=>this.updateShape())}}else if(this._lastShape!==null&&this._sameShapeParams(e))n=this._lastShape;else{let s;switch(e.type){case"Rectangle":s=Wf;break;case"Ellipse":s=jf;break;case"Polygon":s=Rw;break;case"Star":s=Ow;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;if(n&&r.inputs){if(this._lastShape=n,e.type==="Custom"&&(this._lastShapeParams=null),r.inputs.shapeData===n)return;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?xv(r,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:r.count,e,n):super.updateEntityBoxSize(e,n)}};kf();q();pt();Rv();Ew();nh();_w();JP();function w4(i,t){let e=2*Math.PI;return(i%e+e)%e===(t%e+e)%e}var E4=new te,sre=new te,ore=new te().makeScale(1,1,-1),T4=new M,M4=new M,rI=new M,are=new M,lre=new M,cre=new M,ure=new M,_4=new WeakMap,iI=new WeakMap;function dre(i,t,e){let n=[new M,new M,new M],r=[new M,new M,new M];return i.extractBasis(n[0],n[1],n[2]),t.extractBasis(r[0],r[1],r[2]),n.forEach((s,o)=>{let a=r[o],l=ge.lerp(s.length(),a.length(),e);s.lerp(a,e).setLength(l)}),new te().makeBasis(n[0],n[1],n[2])}function A4(i){i.setIndex(null),i.setAttribute("position",new Ue(new Float32Array(0),3)),i.setAttribute("normal",new Ue(new Float32Array(0),3)),i.setAttribute("uv",new Ue(new Float32Array(0),2)),i.setDrawRange(0,0)}var C4=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,t){let e=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),n=Math.abs(e.width),r=Math.abs(e.height??e.width),s=Math.abs(e.depth??0),o=i.shapeData??t?.shapeData??jf.create({parameters:{...zd,width:typeof zd.width=="number"?zd.width:100,height:typeof zd.height=="number"?zd.height:100}}).userData.shape;return{ownerId:i.ownerId??t?.ownerId,path:i.path??af.defaultData(),parameters:Object.assign(e,{width:n,height:r,depth:s,extrusion:{...m1,...e.extrusion}}),shapeData:o}}static build(i){if(i.path.points.length>=2){let e=new sI(i);return Object.assign(e,{userData:{...i,type:"PathGeometry"}})}else{let e=new Me;return A4(e),Object.assign(e,{userData:{...i,type:"PathGeometry"}})}}},sI=class extends Me{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)||!w4(e.twist,0)||e.startScale!==e.endScale}build(){let{points:e,matrices:n}=this._getSampledPath();if(e.length<2){A4(this);return}let{depth:r,offset:s}=this.inputs.parameters.extrusion;r=Math.max(0,Math.min(r,1)),s=Math.max(0,Math.min(s,1));let o=this.inputs.path.isClosed?e.length:e.length-1,a=Math.floor(s*o),l=this.inputs.path.isClosed?Math.ceil((r+s)*o):Math.ceil(Math.min(1,r+s)*o),c=Math.min(Math.max(2,l-a+1),o+2),u=[],d=[];for(let ae=0;ae<c;ae++){let de=this.inputs.path.isClosed?(ae+a)%e.length:Math.min(ae+a,e.length-1);u.push(e[de].clone()),d.push(n[de].clone())}let h=(ae,de,be)=>{u[ae]=u[ae].clone().lerp(u[de],be),d[ae]=dre(d[ae],d[de],be)},p=0,f=s*o%1;(!this.inputs.path.isClosed||r<=1)&&(f||s===0)&&(p=f,h(0,1,p));let m=0,g=(s+r)*o%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 ae=u.length-1;u[ae].copy(u[0]),d[ae].copy(d[0])}this._applyPathModifiers(d,p,m);let{bevel:y,bevelSides:v}=this.inputs.parameters.extrusion,b=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(b=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:x,infos:S,vertices:E}=this._getShapePoints(b),T=y>0?this.inputs.parameters.extrusion.capType:"flat",w=T==="round"?VV(this.inputs.shapeData,y,v,b,this.inputs.ownerId):void 0,_=w!==void 0&&this.inputs.parameters.extrusionVersion===1?Tw(w):w,A=T==="round"&&_===void 0?"flat":T,C=_!==void 0?_.positions.length/3:0,R=0,D=0;S.sort((ae,de)=>ae.start-de.start),S.forEach(ae=>{ae.verticesStart=R,ae.verticesCount=ae.continuous.reduce((de,be,Re)=>de+(Re===0||!be?2:1),0),D+=ae.verticesCount,R=D});let O=D*c,L,F=0;this._isOpenEnded()&&A==="flat"&&(L=this._getSurfaceTesselation(x),F=L.vertexCount);let j=O+2*F+C*2,W=O+2*F,K={positions:new Float32Array(j*3),normals:new Float32Array(j*3),uvs:new Float32Array(j*2)},Y=0;S.forEach(ae=>{Y+=ae.count});let $=Y*(c-1)*6+(L?2*L.elementCount*3:0)+(_!==void 0?2*_.indices.length:0),ee=new Uint32Array($),oe=0;if(S.forEach(ae=>{oe=this._extrudeRegion(ae,E,d,u,K,ee,oe,this._isGeometryClosed()&&!this._isOpenEnded())}),L&&(oe=this._closeEnd(L,O,ee,oe,K,d[0],u[0],!1),oe=this._closeEnd(L,O+F,ee,oe,K,d[d.length-1],u[u.length-1],!0)),_!==void 0){let ae={positions:K.positions,normals:K.normals,uvs:K.uvs,indices:ee};Cv(_,ae,W,oe,E4.copy(d[0]).setPosition(u[0]).multiply(ore),(de,be,Re)=>[Re,1e-4]),oe+=_.indices.length,W+=C,Cv(_,ae,W,oe,E4.copy(d[d.length-1]).setPosition(u[u.length-1]),(de,be,Re)=>[Re,1]),oe+=_.indices.length}this.setAttribute("position",new Ue(K.positions,3)),this.setAttribute("normal",new Ue(K.normals,3)),this.setAttribute("uv",new Ue(K.uvs,2)),this._setIndexFromUint32(ee)}_setIndexFromUint32(e){let n=!1;for(let r=e.length-1;r>=0;--r)if(e[r]>=65535){n=!0;break}this.setIndex(new Ue(n?e:new Uint16Array(e),1))}_getSampledPath(){let e=this.inputs.path,n=X1(e),r=_4.get(n);if(r===void 0||r.subdivisions!==e.subdivisions||r.subdivisionMode!==e.subdivisionMode){let s=this._extractPathPoints(n),o=s.length<2?[]:this._computeBasisMatrices(s);r={subdivisions:e.subdivisions,subdivisionMode:e.subdivisionMode,points:s,matrices:o},_4.set(n,r)}return r}_extractPathPoints(e){let n=this.inputs.path.subdivisions,r=this.inputs.path.subdivisionMode==="uniform"?e.getSpacedPoints(n*4):e.getPoints(n);if(r.length<2)return[];let s=[r[0]];return r.forEach(a=>{s[s.length-1].distanceToSquared(a)>.001&&s.push(a)}),this.inputs.path.isClosed&&s[s.length-1].distanceTo(s[0])<.001&&s.pop(),s}_computeBasisMatrices(e){let n=[],r=e.length,s=this.inputs.path.isClosed,o=new M,a=new M,l=new M,c=new M,u=new M(0,1,0);for(let g=0;g<r;g++){let y=e[g],v;g===0?v=s?e[r-1]:T4.copy(y).multiplyScalar(2).sub(e[1]):v=e[g-1];let b;g===r-1?b=s?e[0]:T4.copy(y).multiplyScalar(2).sub(e[g-1]):b=e[g+1],M4.subVectors(y,v).normalize(),rI.subVectors(b,y).normalize();let x=are.addVectors(M4,rI);x.lengthSq()<1e-10&&(x.copy(rI),x.dot(l)<0&&x.negate()),x.normalize(),l.copy(x),g===0&&(x.equals(u)||lre.copy(x).negate().equals(u))&&u.set(0,0,1);let S=cre.crossVectors(u,x).normalize(),E=ure.crossVectors(x,S).normalize();u.copy(E),c.copy(S),g===0&&(o.copy(E),a.copy(x));let T=new te().makeBasis(S,E,x);n.push(T)}let d=s?a:l,h=s?o:new M(0,1,0),p=d.clone().cross(c).normalize(),f=Math.acos(h.dot(p));if(isNaN(f))return n;let m=h.clone().cross(p);d.dot(m)>0&&(f*=-1);for(let g=1;g<n.length;g++)n[g].multiply(sre.makeRotationZ(f*g/n.length));return n}_applyPathModifiers(e,n,r){let s=e.length,{angle:o,twist:a,startScale:l,endScale:c}=this.inputs.parameters.extrusion,u=new te,d=new te;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(ge.lerp(o,o+a,f)*ge.DEG2RAD);let m=ge.lerp(l,c,f);d.makeScale(m,m,m),h.multiply(u).multiply(d)}),e}_getShapePoints(e,n=Nn.ODD){let r=this.inputs.shapeData,s=iI.get(r);return(s===void 0||s.curveSegments!==e||s.windingRule!==n)&&(s={curveSegments:e,windingRule:n,shapePoints:this._computeShapePoints(e,n)},iI.set(r,s)),s.shapePoints}_getSurfaceTesselation(e){let n=iI.get(this.inputs.shapeData);if(n?.surfaceTesselation!==void 0)return n.surfaceTesselation;let r;try{r=Eu({windingRule:Nn.ODD,elementType:si.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:e})}catch{r=ww}return n!==void 0&&(n.surfaceTesselation=r),r}_computeShapePoints(e=12,n=Nn.ODD){let r=this.inputs.shapeData,s=r.extractShapePointsToFlatArray([],e),o=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}),a;try{a=Eu({windingRule:n,elementType:si.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]})}catch{a=Sw}let l;try{l=Eu({windingRule:Nn.ODD,elementType:si.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...o]})}catch{l=PV}if(!a)throw new Error("error generating geometry");let c=a.elementCount;if(l){a.elementCount+=l.elementCount;for(let m=0;m<l.elements.length;m++){let g=l.elements[m],y=m%2===0?a.vertexCount:0;a.elements.push(g+y)}for(let m=0;m<l.vertexIndices.length;m++){let g=l.vertexIndices[m],y=a.vertexCount;a.vertexIndices.push(g+y)}for(let m=0;m<l.vertices.length;m++){let g=l.vertices[m];a.vertices.push(g)}}let u=1/0,d=-1/0,h=1/0,p=-1/0;for(let m=0,g=a.vertexCount;m<g;m++){let y=m*2,v=a.vertices[y+0],b=a.vertices[y+1];v<u&&(u=v),v>d&&(d=v),b<h&&(h=b),b>p&&(p=b)}let f=[];for(let m=a.elementCount-1;m>=0;m--){let g=m>=c,y=m*2,v=a.elements[y+0],b=a.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,T=x-1,w=v+1,_=r.roundedCurves.length;do{let A=E-v,C=a.vertices[T*2+0],R=a.vertices[T*2+1],D=a.vertices[E*2+0],O=a.vertices[E*2+1],L=a.vertices[w*2+0],F=a.vertices[w*2+1],j=D-C,W=O-R,K=Math.sqrt(j*j+W*W);j/=K,W/=K;let Y=D-L,$=O-F,ee=Math.sqrt(Y*Y+$*$);Y/=ee,$/=ee,S.normals[A*2+0]=-$,S.normals[A*2+1]=Y;let oe=a.vertexIndices[E];if(Array.isArray(oe))S.continuous[A]=!1;else{let[ae,de]=r.getCurveIndexFromVertexId(oe-1,!0);if(de>0&&de<1)S.continuous[A]=!0;else{let be=de===1?ae+1:ae-1;be=(be+_)%_;let Re=de===1?0:1,me=r.roundedCurves[ae].getTangent(de),Ae=r.roundedCurves[be].getTangent(Re);S.continuous[A]=me.dot(Ae)>.95}}g&&(S.normals[A*2+0]*=-1,S.normals[A*2+1]*=-1),[T,E,w]=[E,w,w+1],w>=x&&(w-=b)}while(w!==v+1)}return{regions:[s,...o],infos:f,vertices:a.vertices}}_insertVertex(e,n,r,s,o){let a=n*2,l=n*3;e.positions[l+0]=r.x,e.positions[l+1]=r.y,e.positions[l+2]=r.z,e.normals[l+0]=s.x,e.normals[l+1]=s.y,e.normals[l+2]=s.z,e.uvs[a+0]=o.x,e.uvs[a+1]=o.y}_extrudeRegion(e,n,r,s,o,a,l,c){let u=e.wallTemplate;if(u===void 0){u=[];for(let x=0;x<e.count;x++){let S=(e.start+x)*2,E=n[S+0],T=n[S+1],w,_;if(e.continuous[x])w=e.normals[x*2+0],_=e.normals[x*2+1];else{let C=x===0?(e.start+e.count-1)*2:S-2,R=E-n[C+0];w=-(T-n[C+1]),_=R,e.isHole||(w=-w,_=-_)}let A=x===0?1:x/e.count;if(u.push(E,T,w,_,A,0),!e.continuous[x]||x===0)if(x===0)u.push(E,T,e.normals[0],e.normals[1],0,1);else{let C=x===e.count-1?e.start*2:S+2,R=n[C+0]-E;w=-(n[C+1]-T),_=R,e.isHole||(w=-w,_=-_),u.push(E,T,w,_,A,1)}}e.wallTemplate=u}let d=r.length,h=u.length,p=o.positions,f=o.normals,m=o.uvs;for(let x=0;x<d;x++){let S=r[x].elements,E=S[0],T=S[1],w=S[2],_=S[4],A=S[5],C=S[6],R=S[12],D=S[13],O=S[14],L=s[x],F=x/(d-1),j=0,W=0,K=0,Y=e.verticesStart*d+e.verticesCount*x;for(let $=0;$<h;$+=6){if(u[$+5]===0){let Le=u[$+0],Ie=u[$+1];j=E*Le+_*Ie+R+L.x,W=T*Le+A*Ie+D+L.y,K=w*Le+C*Ie+O+L.z}let ee=u[$+2],oe=u[$+3],ae=E*ee+_*oe+R,de=T*ee+A*oe+D,be=w*ee+C*oe+O,Re=1/(Math.sqrt(ae*ae+de*de+be*be)||1);ae*=Re,de*=Re,be*=Re;let me=Y*2,Ae=Y*3;p[Ae+0]=j,p[Ae+1]=W,p[Ae+2]=K,f[Ae+0]=ae,f[Ae+1]=de,f[Ae+2]=be,m[me+0]=u[$+4],m[me+1]=F,Y++}}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 T=0;T<v;T+=2){let w=S+g[T],_=S+g[T+1],A=E+g[T+1],C=E+g[T];b?(a[l++]=w,a[l++]=A,a[l++]=_,a[l++]=w,a[l++]=C,a[l++]=A):(a[l++]=w,a[l++]=_,a[l++]=A,a[l++]=w,a[l++]=A,a[l++]=C)}}return l}_closeEnd(e,n,r,s,o,a,l,c){let u=e.vertexCount,d=new M(0,0,c?-1:1).applyMatrix4(a),h=new M,p=new G;for(let m=0;m<u;m++){let g=2*m;h.set(e.vertices[g+0],e.vertices[g+1],0).applyMatrix4(a).add(l),this._insertVertex(o,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}};Qt();Eo("PathGeometry",(i,t,e)=>new FE(i,t,e));uv("PathGeometry",C4);Mt("3d-paths");cv();Qt();wo.Cloner=$s;Mt("cloners");an();dn();pt();q();av();cv();Yi();xu();$i();oI();var ib=class extends _o(Bs,So){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=yu.getComponentData({scene:n.scene.data,shared:n.shared.data},e.component);if(r){let s,o;for(let a of yo.rootOverrideProps)e[a]===void 0?(s===void 0&&(s={...e}),s[a]=r.data[a]):(o===void 0&&(o={}),o[a]=e[a],s===void 0&&(s={...e}),s[a]=Fa.apply(r.data[a],e[a]));return this.overrideData=o,s}else return{...Ur.defaultData,...e,...Vy(Ur.defaultData,yo.rootOverrideProps)}}updateByOp(e,n,r,s){let o;if(this.isInstanceRoot&&!s){if(n=this.transformAssignData(n,r),e.type===0&&e.path.length===0&&this.component)for(let a of yo.rootOverrideProps)a in e.props&&e.props[a]===void 0&&(o===void 0&&(o={...e,props:{...e.props}}),o.props[a]=this.component.data[a]);else if(e.type===0&&e.path.length>0&&yo.rootOverrideProps.includes(e.path[0])){let a=e.path[0];o===void 0&&(o={...e,path:[],props:{[a]:n[a]}})}}super.updateByOp(o??e,n,r,s)}updateState(e,n){this.updateState_Entity(e,n)}expandInstanceChildren(e){let n=this.data;if(this.component===void 0){let r=e.scene.find(n.component)??null,s=!1;if(r!==this.oldComponent){if(this.oldComponent){let o=0;for(let a of this.children)if(Ot.is(a))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),rb(a),o+=1;else break;this.children.splice(0,o)}s=!0}if(r){let o={};R4(e,[this.uuid],n.overrides,this,r,r,0,s,o);for(let a of this.children)if(Ot.is(a)){let l=a.data;l.type==="Empty"&&l.animations&&a.traverseEntity(c=>{let u=c.dataPatched;if(c instanceof Yt&&u.bones&&u.boneInverses){let d=c.dataPatched;if(d.bones&&d.boneInverses){let h=d.bones.map(m=>e.scene.find(o[m])),p=d.boneInverses.map(m=>new te().fromArray(m)),f=new Nl(h,p);c.bind(f,c.bindMatrix)}}else c.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function P4(i,t,e,n){return i.component===t&&Jo(i.identity,n)?i.overrideData===e?2:1:0}function R4(i,t,e,n,r,s,o,a,l){if(o>50)return!1;if(n.component!==r){if(n.component){let u=n.component.instances.indexOf(n);u>=0&&n.component.instances.splice(u,1)}r.instances.find(u=>u===n)||r.instances.push(n),n.component=r}r instanceof ib&&r.isInstanceRoot&&r.expandInstanceChildren(i);let c=0;for(let u of r.children)if(Ot.is(u)){let d=[...t,...typeof u.identity=="string"?[u.identity]:u.identity],h=hf.resolve(e,d,1);h!=null&&!(h instanceof _n)&&(Object.setPrototypeOf(h,_n.prototype),console.error("wrong prototype"));let p=null,f;if(!a){let m=n.children[c];if(p=Ot.is(m)?m:null,p!==null){let g=P4(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=P4(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?Fa.apply(u.data,h):u.data;ta.is(m.type)&&(m={...m,type:"Empty"}),p=wo.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,R4(i,t,e,p,u,s,o+1,a,l)}if(!a){let u=c;for(;;){let d=n.children[c];if(Ot.is(d))i.pendingDeletes.add(d);else break;c+=1}n.children.splice(u,c-u)}return!0}Qt();var I4=(i,t,e)=>new ib(i,t,e);Kd("Component",I4);Kd("Instance",I4);Mt("components");var aI=1e-10;function O4(i){let t=i[0][0],e=i[1][0],n=i[0][1],r=i[1][1],s=Math.sqrt(t*t+e*e),o=s>aI?t/s:1,a=s>aI?e/s:0,l=o*t+a*e,c=o*r-a*n,u=o*n+a*r;return{rotation:Math.atan2(a,o),scale:[l,c],shear:[Math.abs(c)>aI?u/c:0,0]}}function D4({rotation:i,scale:t,shear:e}){let n=Math.cos(i),r=Math.sin(i),s=e[0]*t[1],o=e[1]*t[0];return[n*t[0]-r*o,r*t[0]+n*o,n*s-r*t[1],r*s+n*t[1]]}var At;(S=>{function i(){return[1,0,0,0,1,0,0,0,1]}S.identity=i;function t(E,T=S.identity()){for(let w=0,_=E.length;w<_;w++)T[w]=E[w];return T}S.copy=t;function e(E,T,w,_,A,C){return S.setAbcdef(S.identity(),E,T,w,_,A,C)}S.create=e;function n(E,T,w,_,A,C,R){return E[0]=T,E[1]=_,E[2]=C,E[3]=w,E[4]=A,E[5]=R,E}S.setAbcdef=n;function r(E,T){let[w,_,A,C,R,D]=o(E),[O,L,F,j,W,K]=o(T),Y=O*w+L*A,$=O*_+L*C,ee=F*w+j*A,oe=F*_+j*C,ae=W*w+K*A+R,de=W*_+K*C+D;return S.create(Y,$,ee,oe,ae,de)}S.append=r;function s(E,T){let[w,_,A,C,R,D]=o(E),[O,L,F,j,W,K]=o(T),Y=w,$=_,ee=A,oe=C;(O!==1||L!==0||F!==0||j!==1)&&(Y=w*O+_*F,$=w*L+_*j,ee=A*O+C*F,oe=A*L+C*j);let ae=R*O+D*F+W,de=R*L+D*j+K;return S.create(Y,$,ee,oe,ae,de)}S.prepend=s;function o(E){return[E[0],E[3],E[1],E[4],E[2],E[5]]}S.getAbcdef=o;function a(E){let[T,w,_,A,C,R]=S.getAbcdef(E),D=T*A-w*_,O=A/D,L=-w/D,F=-_/D,j=T/D,W=(_*R-A*C)/D,K=-(T*R-w*C)/D;return S.create(O,L,F,j,W,K)}S.invert=a;function l([E,T],w){let[_,A,C,R,D,O]=S.getAbcdef(w);return[_*E+C*T+D,A*E+R*T+O]}S.apply=l;function c(E,T){let[w,_,A,C,R,D]=S.getAbcdef(T),O=1/(w*C+A*-_),[L,F]=E;return[C*O*L+-A*O*F+(D*A-R*C)*O,w*O*F+-_*O*L+(-D*w+R*_)*O]}S.applyInverse=c;function u(E,T,w=T){let[_,A,C,R,D,O]=S.getAbcdef(E);return S.setAbcdef(E,_*T,A*w,C*T,R*w,D*T,O*w),E}S.scale=u;function d(E,T){let w=Math.cos(T),_=Math.sin(T),[A,C,R,D,O,L]=S.getAbcdef(E);return S.setAbcdef(E,A*w-C*_,A*_+C*w,R*w-D*_,R*_+D*w,O*w-L*_,O*_+L*w),E}S.rotate=d;function h(E,T,w){let[_,A]=w,C=S.translate(E,-_,-A);return C=S.rotate(C,T),C=S.translate(C,_,A),C}S.rotateAround=h;function p(E,T,w){let[_,A,C,R,D,O]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,R,D+T,O+w),E}S.translate=p;function f(E,T,w){let[_,A,C,R]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,R,T,w),E}S.setTranslate=f;function m(E,T,w){let[_,A,C,R]=S.getAbcdef(E);return S.setAbcdef(E,_,A,C,R,T,w),E}S.setPosition=m;function g(E){let[T,w,_,A]=S.getAbcdef(E),C=Math.sqrt(T*T+w*w),R=Math.sqrt(_*_+A*A);return[C,R]}S.getScale=g;function y(E){let[,,,,T,w]=S.getAbcdef(E);return[T,w]}S.getPosition=y;function v(E,T){return S.decompose(E,T).rotation}S.getRotation=v;function b(E,T){let[w,_,A,C,R,D]=S.getAbcdef(E),{rotation:O,scale:L,shear:F}=O4([[w,A],[_,C]]);return{position:[R+(T[0]*w+T[1]*A)-T[0],D+(T[0]*_+T[1]*C)-T[1]],scale:L,rotation:O,shear:F,pivot:T}}S.decompose=b;function x(E,T,w,_,A=[0,0]){let[C,R]=E,[D,O]=_,[L,F,j,W]=D4({rotation:w,scale:T,shear:A}),K=C-(D*L+O*j)+D,Y=R-(D*F+O*W)+O;return S.create(L,F,j,W,K,Y)}S.compose=x})(At||(At={}));function hre(i,t){let[[e,n],[r,s]]=i,[[o,a],[l,c]]=t,u=(e-r)*(a-c)-(n-s)*(o-l);if(u===0)return!1;let d=((e-o)*(a-c)-(n-a)*(o-l))/u,h=-((e-r)*(n-a)-(n-s)*(e-o))/u;return d>=0&&d<=1&&h>=0&&h<=1}var N4=[[-1,1],[-1,-1],[1,-1],[1,1]],L4=(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)):N4.forEach(o=>{let a=[o[0]*r[0]+n[0],o[1]*r[1]+n[1]];e.push(At.apply(a,s))})},Iu=class{constructor(){this.matrix=At.identity();this.min=[1/0,1/0];this.max=[-1/0,-1/0];this.vertices=[];this.edges=[]}setFromObjectSize(t,e=!1){t.updateWorldMatrix(),this.makeEmpty(),At.copy(t.worldMatrix,this.matrix);let n=At.invert(t.worldMatrix);this.expandByObjectSize(t,n,e)}expandByObjectSize(t,e,n=!1){let r=[],s=t.isBaseGroup===!0?t:void 0;n===!0&&s!==void 0?s.traverse(o=>{o.visible&&L4(o,e,r)}):L4(t,e,r),this.setFromPoints(r)}setFromSize(t,e,n){this.makeEmpty(),At.copy(n,this.matrix),this.expandBySize(t,e,n)}expandBySize(t,e,n){[At.apply([0,0],n),At.apply([0,e],n),At.apply([t,e],n),At.apply([t,0],n)].forEach(s=>this.expandByPoint(s))}getCenter(){let[t,e]=this.min,[n,r]=this.getHalfSize();return At.apply([t+n,e+r],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(t){this.makeEmpty();for(let e of t)this.expandByPoint(e)}expandByPoint(t){this.min=[Math.min(this.min[0],t[0]),Math.min(this.min[1],t[1])],this.max=[Math.max(this.max[0],t[0]),Math.max(this.max[1],t[1])]}computeVertices(){let[t,e]=this.getHalfSize(),n=this.getCenter(),[r,s,o,a]=At.getAbcdef(this.matrix),l=At.create(r,s,o,a,n[0],n[1]);this.vertices=N4.map(([c,u])=>At.apply([c*t,u*e],l))}computeEdges(){this.edges=[];for(let t=0,e=this.vertices.length;t<e;++t)this.edges.push([this.vertices[t],this.vertices[(t+1)%e]])}project(t,e){let n=this.matrix;return e&&(n=At.append(e.worldMatrix,n)),At.applyInverse(t,n)}intersects(t,e,n){return this.intersectsInLocalSpace(...this.project([t,e],n))}intersectsInLocalSpace(t,e){let{min:n,max:r}=this;return t>=n[0]&&t<=r[0]&&e>=n[1]&&e<=r[1]}containsPoint(t){let[e,n]=t,[r,s]=this.min,[o,a]=this.max;return e>=r&&e<=o&&n>=s&&n<=a}intersectsBBox2D(t){for(let e=0,n=this.edges.length;e<n;e++){let r=this.edges[e];for(let s=0,o=t.edges.length;s<o;s++){let a=t.edges[s];if(hre(r,a))return!0}}for(let e=0,n=t.vertices.length;e<n;e++){let r=t.vertices[e];if(this.containsPoint(r))return!0}return!1}ensureMinMax(){let t=this.min,e=this.max;this.min=[Math.min(t[0],e[0]),Math.min(t[1],e[1])],this.max=[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}copy(t){this.min=[...t.min],this.max=[...t.max],At.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new Iu;return t.copy(this),t}};pt();var pre='{"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":{}}',B4=()=>JSON.parse(pre);async function fre(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,B4(),!0)}}var UE,sb;function mre(i){UE=i}function lI(){if(!sb){if(!UE)return Promise.reject(new Error("HanaRenderer: no Hana UI loader registered. Call setHanaUILoader() from the host app before initializing a HanaRenderer."));sb=UE(),sb.catch(()=>{sb=void 0})}return sb}var F4;function gre(){let i=typeof process<"u"?"2.0.78":void 0;return`https://cdn.spline.design/@splinetool/runtime${i?`@${i}`:""}/build/hana-ui.wasm`}function U4(i){F4=i}function k4(){return UE||mre(async()=>{let t=await import("./hana-ui.js");return fre(t,F4??gre())}),lI().then(()=>{})}var zE=ed(VE(),1);function j4(i){let t=[],e;try{e=(0,zE.makeAbsolute)((0,zE.parseSVG)(i))}catch(c){return console.error("[HanaRenderer] Failed to parse SVG path:",c),t}let n=0,r=0,s=0,o=0,a=null,l=null;for(let c of e){let u=null,d=null;switch(c.code){case"M":n=s=c.x,r=o=c.y,t.push({MoveTo:{x:n,y:r}});break;case"L":n=c.x,r=c.y,t.push({LineTo:{x:n,y:r}});break;case"H":n=c.x,t.push({LineTo:{x:n,y:r}});break;case"V":r=c.y,t.push({LineTo:{x:n,y:r}});break;case"C":{let h={x:c.x1,y:c.y1},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"S":{let h=a?{x:2*n-a.x,y:2*r-a.y}:{x:n,y:r},p={x:c.x2,y:c.y2};n=c.x,r=c.y,t.push({CurveTo:[h,p,{x:n,y:r}]}),u=p;break}case"Q":{let h={x:c.x1,y:c.y1};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"T":{let h=l?{x:2*n-l.x,y:2*r-l.y}:{x:n,y:r};n=c.x,r=c.y,t.push({QuadTo:[h,{x:n,y:r}]}),d=h;break}case"A":{let h=n,p=r;n=c.x,r=c.y,xre(t,h,p,c.rx,c.ry,c.xAxisRotation,c.largeArc,c.sweep,n,r);break}case"Z":n=s,r=o,t.push("ClosePath");break}a=u,l=d}return t}function xre(i,t,e,n,r,s,o,a,l,c){if(t===l&&e===c)return;if(n=Math.abs(n),r=Math.abs(r),n===0||r===0){i.push({LineTo:{x:l,y:c}});return}let u=s*Math.PI/180,d=Math.cos(u),h=Math.sin(u),p=(t-l)/2,f=(e-c)/2,m=d*p+h*f,g=-h*p+d*f,y=m*m/(n*n)+g*g/(r*r);if(y>1){let Y=Math.sqrt(y);n*=Y,r*=Y}let v=n*n,b=r*r,x=v*b-v*g*g-b*m*m,S=v*g*g+b*m*m,E=(o!==a?1:-1)*Math.sqrt(Math.max(0,x/S)),T=E*(n*g)/r,w=E*(-r*m)/n,_=d*T-h*w+(t+l)/2,A=h*T+d*w+(e+c)/2,C=Math.atan2((g-w)/r,(m-T)/n),D=Math.atan2((-g-w)/r,(-m-T)/n)-C;!a&&D>0?D-=2*Math.PI:a&&D<0&&(D+=2*Math.PI);let O=Math.max(1,Math.ceil(Math.abs(D)/(Math.PI/2))),L=D/O,F=4/3*Math.tan(L/4),j=C,W=t,K=e;for(let Y=0;Y<O;Y++){let $=j+L,ee=Math.cos(j),oe=Math.sin(j),ae=Math.cos($),de=Math.sin($),be=_+n*ae*d-r*de*h,Re=A+n*ae*h+r*de*d,me=-n*oe*d-r*ee*h,Ae=-n*oe*h+r*ee*d,Le=-n*de*d-r*ae*h,Ie=-n*de*h+r*ae*d;i.push({CurveTo:[{x:W+F*me,y:K+F*Ae},{x:be-F*Le,y:Re-F*Ie},{x:be,y:Re}]}),j=$,W=be,K=Re}}var jE=.5522847498307936,Ere=150,Tre=5*60*1e3,Mre=1536/2816;function K4(i){let t=i.getUint32(0);if(t===65536||t===1330926671||t===1953658213)return 0;if(t===1953784678)return i.getUint32(8)>0?i.getUint32(12):void 0}function _re(i){try{return K4(new DataView(i))!==void 0}catch{return!1}}function Are(i){try{let t=new DataView(i),e=K4(t);if(e===void 0)return;let n=t.getUint16(e+4),r=-1,s=-1;for(let c=0;c<n;c++){let u=e+12+c*16,d=t.getUint32(u);d===1751474532&&(r=t.getUint32(u+8)),d===1330851634&&(s=t.getUint32(u+8))}if(r<0||s<0)return;let o=t.getUint16(r+18),a=t.getUint16(s);if(o===0||a<2)return;let l=t.getInt16(s+86);return l>0?l/o:void 0}catch{return}}var H4=!1;function W4(){H4||(H4=!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 HE=class{constructor(t,e=1){this.canvas=t;this._dpr=e;this._width=0;this._height=0;this._isSizeDirty=!1;this._crashed=!1;this._shapes=[];this._lastPushedJSON="";this._ctm=At.identity();this._stack=[];this._clips=[];this._pathEls=[];this._simpleShape=null;this._pathPrimitives=0;this._fillColor=Vt.transparent;this._strokeColor=Vt.transparent;this._lineWidth=1;this._strokeMode="inside";this._layerBlur=0;this._backgroundBlur=0;this._dropShadowBlur=0;this._dropShadowOffsetX=0;this._dropShadowOffsetY=0;this._dropShadowColor=Vt.transparent;this._innerShadowBlur=0;this._innerShadowOffsetX=0;this._innerShadowOffsetY=0;this._innerShadowSpread=0;this._innerShadowColor=Vt.transparent;this._fonts=new Map;this._fontsFlushed=new Set;this._engineFonts=new Set;this._fontXPerEm=new Map;this._measureCache=new Map;try{let n=t.getBoundingClientRect();t.width=n.width*e,t.height=n.height*e}catch{console.log(t.width,e)}}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this._isSizeDirty=!0}get width(){return this._width}get height(){return this._height}async init(){if(!(this._engine||this._crashed)){try{this._context=await lI(),this._engine=await this._context.createEngine(this.canvas)}catch(t){this._crashed=!0,console.error("[HanaRenderer] Failed to load the Hana UI engine; UI scenes will not render.",t);return}if(this._width>0&&this._height>0)this._syncViewport();else{let t=this.canvas.getBoundingClientRect();t.width>0&&t.height>0&&(this._width=t.width,this._height=t.height,this._syncViewport())}this._flushFonts(),this.uiFontReady=this._watchUiFont()}}_watchUiFont(){return new Promise(t=>{let e=this._engine;if(!e||typeof e.scene.isUiFontLoaded!="function"){t();return}let n=()=>{let o=!1;return this._guard(()=>{o=e.scene.isUiFontLoaded()}),o};if(n()){t();return}let r=Date.now(),s=setInterval(()=>{if(this._crashed||Date.now()-r>Tre){clearInterval(s);return}n()&&(clearInterval(s),t())},Ere)})}_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),_re(t)&&this._engineFonts.add(e);let n=Are(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))===!1&&this._engineFonts.delete(e)}))}set strokeColor(t){this._strokeColor=t}set fillColor(t){this._fillColor=t}set lineWidth(t){this._lineWidth=t}set strokeMode(t){this._strokeMode=t}set dropShadowBlur(t){this._dropShadowBlur=t}set dropShadowColor(t){this._dropShadowColor=t}set dropShadowOffsetX(t){this._dropShadowOffsetX=t}set dropShadowOffsetY(t){this._dropShadowOffsetY=t}set innerShadowBlur(t){this._innerShadowBlur=t}set innerShadowColor(t){this._innerShadowColor=t}set innerShadowOffsetX(t){this._innerShadowOffsetX=t}set innerShadowOffsetY(t){this._innerShadowOffsetY=t}set innerShadowSpread(t){this._innerShadowSpread=t}set layerBlur(t){this._layerBlur=t}set backgroundBlur(t){this._backgroundBlur=t}save(){this._stack.push({ctm:At.copy(this._ctm),clipLen:this._clips.length})}restore(){let t=this._stack.pop();!t||(this._ctm=t.ctm,this._clips.length=t.clipLen)}setTransform(t,e=!1){let n=At.identity();if(this.camera?.enabled&&(n=At.append(n,this.camera.worldMatrix),e)){let r=At.getScale(this.camera.worldMatrix);n=At.scale(n,1/r[0],1/r[1])}this._ctm=At.append(n,t)}transform(t){this._ctm=At.append(this._ctm,t)}beginPath(){this._pathEls=[],this._simpleShape=null,this._pathPrimitives=0}closePath(){this._pathEls.length!==0&&this._pathEls[this._pathEls.length-1]!=="ClosePath"&&this._pathEls.push("ClosePath")}_startFreeform(){this._simpleShape=null,this._pathPrimitives++}moveTo(t,e){this._startFreeform(),this._pathEls.push({MoveTo:{x:t,y:e}})}lineTo(t,e){this._startFreeform(),this._pathEls.push({LineTo:{x:t,y:e}})}bezierCurveTo(t,e,n,r,s,o){this._startFreeform(),this._pathEls.push({CurveTo:[{x:t,y:e},{x:n,y:r},{x:s,y:o}]})}quadraticCurveTo(t,e,n,r){this._startFreeform(),this._pathEls.push({QuadTo:[{x:t,y:e},{x:n,y:r}]})}path(t){this._startFreeform(),this._pathEls.push(...j4(t))}rect(t,e,n,r,s=0,o=0,a=0,l=0){if(!Y4([t,e,n,r]))return;let c={x:t,y:e,w:n,h:r,radii:[s,o,a,l]};this._pathPrimitives++,this._simpleShape=this._pathPrimitives===1&&this._pathEls.length===0?{kind:"rect",rect:c,smoothing:0}:null,$4(this._pathEls,c)}ellipse(t,e,n,r,s,o,a,l){if(!!Y4([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,Ire(this._pathEls,t,e,n,r)}}clipRect(t,e,n,r,s=0,o=0,a=0,l=0){let c=At.invert(this._ctm);!c||this._clips.push({m:At.copy(this._ctm),inv:c,rect:{x:t,y:e,w:n,h:r,radii:[s,o,a,l]}})}fill(){this._emit(!0)}stroke(){this._strokeColor.a<=0||this._lineWidth<=0||this._emit(!1)}_emit(t){let e=this._effectChain(t);if(t&&this._fillColor.a<=0&&!e)return;let n=this._classifyShape();if(!n)return;let r=this._applyClips(n);if(r==="skip")return;if(!t&&r!==n){let o=ob(n);if(o){this._emitClippedRectStroke(o,e);return}}n=r;let s={shape:n,color:t?dm(this._fillColor):[0,0,0,0],transform:At.getAbcdef(this._ctm)};t||(s.stroke=this._strokeDesc()),e&&(s.effect_chain=e),this._shapes.push(s)}_emitClippedRectStroke(t,e){let n=this._lineWidth,r=this._strokeMode==="outside"?n:this._strokeMode==="center"?n/2:0,s=n-r,o=Math.min(t.w,t.h)/2,a=t.radii.map(y=>Math.max(0,Math.min(y,o))),l={x:t.x-r,y:t.y-r,w:t.w+r*2,h:t.h+r*2,radii:a.map(y=>y>0?y+r:0)},c=t.w-s*2,u=t.h-s*2,d=c>0&&u>0?{x:t.x+s,y:t.y+s,w:c,h:u,radii:a.map(y=>Math.max(0,y-s))}:null,h=this._applyClips(GE(l,0));if(h==="skip")return;let p=ob(h)??l,f=null;if(d){let y=this._applyClips(GE(d,0));f=y==="skip"?null:ob(y)??d}let m=[];$4(m,p),f&&Rre(m,f);let g={shape:{Custom:m},color:dm(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"?GE(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:dm(this._strokeColor),align:Cre[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:dm(this._dropShadowColor)}}),t&&this._backgroundBlur>0){let[r,s]=At.getScale(this._ctm),o=(r+s)/2;n.push({BackgroundBlur:{blur:{Uniform:{size:2*this._backgroundBlur*o}}}})}if(this._layerBlur>0&&n.push({LayerBlur:{blur:{Uniform:{size:2*this._layerBlur*e}}}}),t&&this._innerShadowColor.a>0){let[r,s,o,a]=At.getAbcdef(this._ctm),l=this._innerShadowOffsetX,c=this._innerShadowOffsetY;n.push({InnerShadow:{position:[r*l+o*c,s*l+a*c],blur:{Uniform:{size:2*this._innerShadowBlur*e}},spread:this._innerShadowSpread*e,color:dm(this._innerShadowColor)}})}return n.length>0?n:void 0}_applyClips(t,e=this._ctm){if(this._clips.length===0)return t;let n=t;for(let r of this._clips){let s=At.append(r.inv,e),[o,a,l,c,u,d]=At.getAbcdef(s),h=Math.abs(a)<=1e-6*(Math.abs(o)+Math.abs(c))&&Math.abs(l)<=1e-6*(Math.abs(o)+Math.abs(c)),p=Pre(n);if(!p)return n;if(!h){W4();continue}let f=o*p.minX+u,m=o*p.maxX+u,g=c*p.minY+d,y=c*p.maxY+d,v=Math.min(f,m),b=Math.max(f,m),x=Math.min(g,y),S=Math.max(g,y),E=r.rect,T=Math.max(v,E.x),w=Math.max(x,E.y),_=Math.min(b,E.x+E.w),A=Math.min(S,E.y+E.h);if(T>=_||w>=A)return"skip";if(T===v&&w===x&&_===b&&A===S)continue;let R=ob(n);if(!R||o===0||c===0){W4();continue}let D=(T-u)/o,O=(_-u)/o,L=(w-d)/c,F=(A-d)/c,j=Math.min(D,O),W=Math.min(L,F),K=Math.abs(O-D),Y=Math.abs(F-L),[$,ee,oe,ae]=R.radii,de=j!==R.x,be=W!==R.y,Re=j+K!==R.x+R.w,me=W+Y!==R.y+R.h,Ae=Math.min(K,Y)/2,Le=[de||be?0:Math.min($,Ae),Re||be?0:Math.min(ee,Ae),Re||me?0:Math.min(oe,Ae),de||me?0:Math.min(ae,Ae)];n=GE({x:j,y:W,w:K,h:Y,radii:Le},0)}return n}drawText(t,e){let n=this._engineFonts.has(e.font),r=this._fontXPerEm.get(e.font),s=!n&&r?r/Mre:1,o={TextSimple:{text:t,font_size:e.fontSize*s,size:[e.width,e.height],horizontal_align:q4[e.horizontalAlign]??"Left",vertical_align:X4[e.verticalAlign]??"Top",line_height:e.lineHeight,letter_spacing:e.letterSpacing,...n?{font_id:e.font}:{}}},a=this._effectChain(!0),l=this._fillColor.a>0,c=this._strokeColor.a>0&&this._lineWidth>0;if(l||c||a){let u=At.append(this._ctm,At.translate(At.identity(),e.x,e.y));if(this._applyClips(o,u)!=="skip"){let d={shape:o,color:l?dm(this._fillColor):[0,0,0,0],transform:At.getAbcdef(u)};c&&(d.stroke=this._strokeDesc()),a&&(d.effect_chain=a),this._shapes.push(d)}}return{height:this._measureTextHeight(t,e)}}_measureTextHeight(t,e){let n=`${e.font}|${e.fontSize}|${e.lineHeight}|${e.letterSpacing}|${e.width}|${t}`,r=this._measureCache.get(n);if(r!==void 0)return r;let s=0,o=this._engine;if(o&&!this._crashed&&this._fontsFlushed.has(e.font))try{let[,a]=o.scene.measureTextNaturalSize({size:[e.width,e.height],text:t,fontSize:e.fontSize,horizontalAlign:q4[e.horizontalAlign]??"Left",verticalAlign:X4[e.verticalAlign]??"Top",lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textTransform:"None",font:e.font,version:0,autoSize:"None",truncate:"None"});s=a}catch{}if(!(s>0)){let a=e.fontSize*.55+Math.max(0,e.letterSpacing),l=Math.max(1,Math.floor(e.width/a)),c=0;for(let u of t.split(`
9804
9804
  `))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())}},Cre={inside:"Inside",outside:"Outside",center:"Center"},q4={[1]:"Left",[2]:"Right",[3]:"Center",[4]:"Justify"},X4={[1]:"Top",[2]:"Center",[3]:"Bottom"};function dm({r:i,g:t,b:e,a:n}){return[i,t,e,n]}function Y4(i){for(let t=0;t<i.length;t++)if(i[t]!==void 0&&!Number.isFinite(i[t]))return!1;return!0}function GE(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 ob(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 Pre(i){let t=ob(i);if(t)return{minX:t.x,minY:t.y,maxX:t.x+t.w,maxY:t.y+t.h};if("Ellipse"in i){let e=i.Ellipse;return{minX:e.center_x-e.rx,minY:e.center_y-e.ry,maxX:e.center_x+e.rx,maxY:e.center_y+e.ry}}if("TextSimple"in i){let e=i.TextSimple;return{minX:0,minY:0,maxX:e.size[0],maxY:e.size[1]}}if("Custom"in i){let e=1/0,n=1/0,r=-1/0,s=-1/0,o=a=>{a.x<e&&(e=a.x),a.y<n&&(n=a.y),a.x>r&&(r=a.x),a.y>s&&(s=a.y)};for(let a of i.Custom)a!=="ClosePath"&&("MoveTo"in a?o(a.MoveTo):"LineTo"in a?o(a.LineTo):"QuadTo"in a?a.QuadTo.forEach(o):"CurveTo"in a&&a.CurveTo.forEach(o));return e===1/0?null:{minX:e,minY:n,maxX:r,maxY:s}}return null}function $4(i,t){let{x:e,y:n,w:r,h:s}=t,o=Math.min(r,s)/2,[a,l,c,u]=t.radii.map(h=>Math.max(0,Math.min(h,o)));if(a===0&&l===0&&c===0&&u===0){i.push({MoveTo:{x:e,y:n}},{LineTo:{x:e+r,y:n}},{LineTo:{x:e+r,y:n+s}},{LineTo:{x:e,y:n+s}},"ClosePath");return}let d=1-jE;i.push({MoveTo:{x:e+a,y:n}}),i.push({LineTo:{x:e+r-l,y:n}}),l>0&&i.push({CurveTo:[{x:e+r-l*d,y:n},{x:e+r,y:n+l*d},{x:e+r,y:n+l}]}),i.push({LineTo:{x:e+r,y:n+s-c}}),c>0&&i.push({CurveTo:[{x:e+r,y:n+s-c*d},{x:e+r-c*d,y:n+s},{x:e+r-c,y:n+s}]}),i.push({LineTo:{x:e+u,y:n+s}}),u>0&&i.push({CurveTo:[{x:e+u*d,y:n+s},{x:e,y:n+s-u*d},{x:e,y:n+s-u}]}),i.push({LineTo:{x:e,y:n+a}}),a>0&&i.push({CurveTo:[{x:e,y:n+a*d},{x:e+a*d,y:n},{x:e+a,y:n}]}),i.push("ClosePath")}function Rre(i,t){let{x:e,y:n,w:r,h:s}=t,o=Math.min(r,s)/2,[a,l,c,u]=t.radii.map(h=>Math.max(0,Math.min(h,o)));if(a===0&&l===0&&c===0&&u===0){i.push({MoveTo:{x:e,y:n}},{LineTo:{x:e,y:n+s}},{LineTo:{x:e+r,y:n+s}},{LineTo:{x:e+r,y:n}},"ClosePath");return}let d=1-jE;i.push({MoveTo:{x:e+a,y:n}}),a>0&&i.push({CurveTo:[{x:e+a*d,y:n},{x:e,y:n+a*d},{x:e,y:n+a}]}),i.push({LineTo:{x:e,y:n+s-u}}),u>0&&i.push({CurveTo:[{x:e,y:n+s-u*d},{x:e+u*d,y:n+s},{x:e+u,y:n+s}]}),i.push({LineTo:{x:e+r-c,y:n+s}}),c>0&&i.push({CurveTo:[{x:e+r-c*d,y:n+s},{x:e+r,y:n+s-c*d},{x:e+r,y:n+s-c}]}),i.push({LineTo:{x:e+r,y:n+l}}),l>0&&i.push({CurveTo:[{x:e+r,y:n+l*d},{x:e+r-l*d,y:n},{x:e+r-l,y:n}]}),i.push("ClosePath")}function Ire(i,t,e,n,r){let s=n*jE,o=r*jE;i.push({MoveTo:{x:t+n,y:e}},{CurveTo:[{x:t+n,y:e+o},{x:t+s,y:e+r},{x:t,y:e+r}]},{CurveTo:[{x:t-s,y:e+r},{x:t-n,y:e+o},{x:t-n,y:e}]},{CurveTo:[{x:t-n,y:e-o},{x:t-s,y:e-r},{x:t,y:e-r}]},{CurveTo:[{x:t+s,y:e-r},{x:t+n,y:e-o},{x:t+n,y:e}]},"ClosePath")}function cI(i){let t=!1;return i.scene.objects.traverse((e,n)=>{(n.type==="Mesh"&&n.geometry.type==="UIGeometry"||n.type==="Page"&&n.uiFrame!==void 0)&&(t=!0)}),t}pt();pt();var Ore=Math.PI/180,wNe=180/Math.PI;function Z4(i,t,e,n,r,s){let o=i-e,a=t-n;return o*o/(r*r)+a*a/(s*s)<=1}function Q4(i){return i*Ore}an();function yc(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 vc=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 Iu;this._recursiveBBox=new Iu;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=yc();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,Q4(this.rotation),rc.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 rc.getPivot(this.data)}getCenter(){return[0,0]}getHalfSize(){return[0,0]}get id(){return this.uuid}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{t.resetBBoxNeedsUpdateSelf()})}updateTransformState(t){let e=!1;t.position!==void 0&&(e=!0,this.position=t.position),t.rotation!==void 0&&(e=!0,this.rotation=t.rotation),t.scale!==void 0&&(e=!0,this.scale=t.scale),t.shear!==void 0&&(e=!0,this.shear=t.shear),e&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(t,e,n){t.type===0&&t.props.visible!==void 0&&(this.visible=t.props.visible),this.data=e,this.data=e;let r=t,s=$t(t.path,["states","*"]);if(s!==null){if(t.type===0){let[o]=s;if(this?.stateSelection===o){let a={...t.props};if(delete a.name,Object.values(t.props).some(l=>l===void 0)){let l=this.data;if(l!==void 0){let c=rr.zoom(l,t.path.slice(2));if(c)for(let u in t.props)t.props[u]===void 0&&u in c&&(a[u]=c[u])}}r={...t,props:a,path:t.path.slice(2)}}}}else if(t.type===0){let o=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(o!==void 0){if(t.props.name!==void 0&&o.name){let{name:l,...c}=o;o=c}let a=rr.removeOverridden(t.path,t.props,o);r={...t,props:a}}}this.updateByPatchedOpBase(r,nc.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)nc.toOps(this.data,r.data).forEach(o=>{let a=Qp.replaceProps(o,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,e)});if(t!==null){let r=this.data.states.data(t);r&&(this.dataPatched=nc.patch(this.data,r),nc.toOps(this.data,r).forEach(o=>{this.updateByPatchedOp(o,this.dataPatched,e)}))}n&&this.updateTransformState(this.dataPatched),this.stateSelection=t}}updateState(t,e){t.name!==void 0&&(this.name=t.name),t.visible!==void 0&&(this.visible=t.visible),this.updateTransformState(t)}updateByPatchedOpBase(t,e,n){this.dataPatched=e,this.updateByPatchedOp(t,e,n)}updateByPatchedOp(t,e,n){t.path.length===0&&t.type===0&&this.updateState(t.props,n),this.requestRender()}traverseFrameAncestors(t){this.traverseAncestors(e=>{e.data.type==="frame2d"&&t(e)})}traverseAncestors(t){let e=this.parent;for(;e;)t(e),e=e.parent}requestRender(){this.traverseFrameAncestors(t=>{t.requestRender()})}clone(t){let e=new vc(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 vc&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}};an();pt();var ab=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.color=Vt.transparent;this.blurRadius=0;this.offset=[0,0];this.spread=0;this.update(e)}update(t){t.color!==void 0&&(this.color=t.color),t.enabled!==void 0&&(this.enabled=t.enabled),t.blurRadius!==void 0&&(this.blurRadius=t.blurRadius),t.offset!==void 0&&(this.offset=t.offset),t.spread!==void 0&&(this.spread=t.spread)}};var lb=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.radius=0;this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.radius!==void 0&&(this.radius=t.radius)}};pt();var WE=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.color=Vt.transparent;this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.color!==void 0&&(this.color=t.color)}};pt();var qE=class{constructor(t,e,n){this.uuid=t;this.data=e;this.enabled=!1;this.color=Vt.transparent;this.thickness=0;this.mode="inside";this.update(e)}update(t){t.enabled!==void 0&&(this.enabled=t.enabled),t.color!==void 0&&(this.color=t.color),t.thickness!==void 0&&(this.thickness=t.thickness),t.mode!==void 0&&(this.mode=t.mode)}};var sr=class extends vc{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.autoClose=!0;this.fill=new WE(e+"-fill",n.fill,r),this.stroke=new qE(e+"-stroke",n.stroke,r),this.dropShadow=new ab(e+"-dropShadow",n.dropShadow,r),this.innerShadow=new ab(e+"-innerShadow",n.innerShadow,r),this.backgroundBlur=new lb(e+"-backgroundBlur",n.backgroundBlur,r),this.layerBlur=new lb(e+"-layerBlur",n.layerBlur,r)}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:Vt.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Vt.transparent,e.strokeMode=this.stroke.mode,e.lineWidth=this.stroke.thickness}applyFilters(e){this.layerBlur.enabled?e.layerBlur=this.layerBlur.radius*5:e.layerBlur=0,this.backgroundBlur.enabled?e.backgroundBlur=this.backgroundBlur.radius*5:e.backgroundBlur=0,this.dropShadow.enabled?(e.dropShadowBlur=this.dropShadow.blurRadius*5,e.dropShadowColor=this.dropShadow.color,e.dropShadowOffsetX=this.dropShadow.offset[0],e.dropShadowOffsetY=this.dropShadow.offset[1]):e.dropShadowColor=Vt.transparent,this.innerShadow.enabled?(e.innerShadowSpread=this.innerShadow.spread,e.innerShadowBlur=this.innerShadow.blurRadius*5,e.innerShadowColor=this.innerShadow.color,e.innerShadowOffsetX=this.innerShadow.offset[0],e.innerShadowOffsetY=this.innerShadow.offset[1]):e.innerShadowColor=Vt.transparent}innerDraw(e){}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.applyFilters(e),this.applyFillStroke(e),e.beginPath(),this.innerDraw(e),this.autoClose&&e.closePath(),this.fill.enabled&&e.fill(),this.stroke.enabled&&e.stroke(),e.restore())}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.type===0&&($t(e.path,["fill"])?this.fill.update(e.props):$t(e.path,["stroke"])?this.stroke.update(e.props):$t(e.path,["dropShadow"])?this.dropShadow.update(e.props):$t(e.path,["innerShadow"])?this.innerShadow.update(e.props):$t(e.path,["layerBlur"])?this.layerBlur.update(e.props):$t(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}updateState(e,n){super.updateState(e,n),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur)}clone(e){let n=new sr(this.uuid,this.data,e);return n.parent=void 0,n}};var Ou=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 Z4(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 Ou(this.uuid,this.data,e);return n.parent=void 0,n}};var Oo=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 Oo(this.uuid,this.data,e);return n.parent=void 0,n}};pt();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:Vt.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Vt.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}innerDraw(e){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&e.registerFont(this._fontHolder.arrayBuffer,this.data.font);let n=this.data.textTransform,r=this.data.text.textValue.toString(),s=n===2?r.toUpperCase():n===3?r.toLowerCase():r,{height:o}=e.drawText(s,{x:0,y:0,width:this.width,height:this.height,fontSize:this.data.fontSize,lineHeight:this.data.lineHeight??1,letterSpacing:this.data.letterSpacing??0,horizontalAlign:this.data.horizontalAlign,verticalAlign:this.data.verticalAlign,font:this.data.font});this._textHeight=o}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(e,{shared:n}){e.font!==void 0&&(this._fontHolder=n.getFont(e.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then(()=>{this.requestRender()}))}updateState(e,n){super.updateState(e,n),this.updateSizeState(e),this.updateFontState(e,n)}clone(e){let n=new Du(this.uuid,this.data,e);return n.parent=void 0,n}};var hm=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=>XE.extremas(s)),n=[1/0,1/0],r=[-1/0,-1/0];for(let s=0,o=e.length;s<o;s++){let a=e[s];a[0][0]<n[0]&&(n[0]=a[0][0]),a[0][1]<n[1]&&(n[1]=a[0][1]),a[1][0]>r[0]&&(r[0]=a[1][0]),a[1][1]>r[1]&&(r[1]=a[1][1])}return this.extremasBBox.min=[n[0],n[1]],this.extremasBBox.max=[r[0],r[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let r=1,s=this.data.points.length;r<s;r++){let o=this.data.points[r].data,a=this.data.points[r-1].data,l={start:a.position,cp1:a.controlNext.position,cp2:o.controlPrevious.position,end:o.position};this.curves.push(l)}let e=this.data.points[0].data,n=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let r={start:n.position,cp1:n.controlNext.position,cp2:e.controlPrevious.position,end:e.position};this.curves.push(r)}}getCenter(){let[e,n]=this.extremasBBox.min,[r,s]=this.getHalfSize();return[e+r,n+s]}getHalfSize(){let{min:e,max:n}=this.extremasBBox;return[(n[0]-e[0])*.5,(n[1]-e[1])*.5]}innerDraw(e){for(let s=0,o=this.data.points.length;s<o;s++){let a=this.data.points[s].data;if(s===0){let[l,c]=a.position;e.moveTo(l,c)}else{let l=this.data.points[s-1].data,[c,u]=l.controlNext.position,[d,h]=a.controlPrevious.position,[p,f]=a.position,m={start:l.position,cp1:l.controlNext.position,cp2:a.controlPrevious.position,end:a.position};XE.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,o]=r.controlNext.position,[a,l]=n.controlPrevious.position,[c,u]=n.position;e.bezierCurveTo(s,o,a,l,c,u)}}updateState(e,n){super.updateState(e,n),this.computeExtremas()}clone(e){let n=new hm(this.uuid,this.data,e);return n.parent=void 0,n}},XE;(s=>{function i(o){let a=o.start,l=o.cp1,c=o.cp2,u=o.end,d=[3*(l[0]-a[0]),3*(l[1]-a[1])],h=[3*(c[0]-l[0]),3*(c[1]-l[1])],p=[3*(u[0]-c[0]),3*(u[1]-c[1])],f={start:d,cp:h,end:p};return o.derivative=f,f.derivative=uI.derive(f),f}s.derive=i;function t(o,a,l,c=!1){let u=o-2*a+l;if(u!==0){let d=-Math.sqrt(Math.abs(a*a-o*l)),h=-o+a,p=-(d+h)/u,f=-(-d+h)/u;return[p,f]}else if(a!==l&&u===0)return[(2*a-l)/(2*(a-l))];return[]}function e(o){let a=o.derivative??s.derive(o),l=a.start,c=a.cp,u=a.end;return[t(l[0],c[0],u[0]),t(l[1],c[1],u[1])]}s.droot=e;function n(o){let[a,l]=s.droot(o),c=[o.start[0],o.end[0]],u=[o.start[1],o.end[1]];for(let d of a)c.push(s.compute(o,Math.min(1,Math.max(0,d)))[0]);for(let d of l)u.push(s.compute(o,Math.min(1,Math.max(0,d)))[1]);return c.sort((d,h)=>d-h),u.sort((d,h)=>d-h),[[c[0],u[0]],[c[c.length-1],u[u.length-1]]]}s.extremas=n;function r(o,a){if(a===0)return[...o.start];if(a===1)return[...o.end];let l=1-a,c=l*l,u=a*a,d=c*l,h=c*a*3,p=l*u*3,f=a*u;return[d*o.start[0]+h*o.cp1[0]+p*o.cp2[0]+f*o.end[0],d*o.start[1]+h*o.cp1[1]+p*o.cp2[1]+f*o.end[1]]}s.compute=r})(XE||(XE={}));var uI;(n=>{function i(r){let s=r.start,o=r.cp,a=r.end,l=[2*(o[0]-s[0]),2*(o[1]-s[1])],c=[2*(a[0]-o[0]),2*(a[1]-o[1])],u={start:l,end:c};return u.derivative=dI.derive(u),r.derivative=u,u}n.derive=i;function t(r){let s=r.derivative??n.derive(r),o=s.start,a=s.end;return[o[0]!==a[0]?o[0]/(o[0]-a[0]):0,o[1]!==a[1]?o[1]/(o[1]-a[1]):0]}n.droot=t;function e(r,s){if(s===0)return[...r.start];if(s===1)return[...r.end];let o=1-s,a=o*o,l=s*s,c=a,u=o*s*2,d=l;return[c*r.start[0]+u*r.cp[0]+d*r.end[0],c*r.start[1]+u*r.cp[1]+d*r.end[1]]}n.compute=e})(uI||(uI={}));var dI;(e=>{function i(n){let r=n.start,s=n.end,o=[s[0]-r[0],s[1]-r[1]];return n.derivative=o,n.derivative}e.derive=i;function t(n,r){if(r===0)return[...n.start];if(r===1)return[...n.end];let s=n.start,o=n.end;return[s[0]+(o[0]-s[0])*r,s[1]+(o[1]-s[1])*r]}e.compute=t})(dI||(dI={}));var ps=class extends vc{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 ps&&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 ps?r.traverse(e):n=e(r)}intersectsChildrenHelper(e,n,r,s,o){for(let a of this.children)if(a.intersects(e,n,r,!1)&&(o.push(a),s)||a instanceof ps&&a.intersectsChildrenHelper(e,n,r,s,o))return!0;return!1}intersectsChildren(e,n,r,s=!1,o=[],a=!1){return this.intersectsChildrenHelper(e,n,r,s,o),o}intersectsChildrenHelperReverse(e,n,r,s,o){for(let a of this.children)if(a instanceof ps&&a.intersectsChildrenHelperReverse(e,n,r,s,o)||a.intersects(e,n,r,!1)&&(o.push(a),s))return!0;return!1}intersectsChildrenReverse(e,n,r,s=!1,o=[],a=!1){return this.intersectsChildrenHelperReverse(e,n,r,s,o),o}updateWorldMatrix(e,n,r){if(super.updateWorldMatrix(e,n,r),r&&this.children)for(let s of this.children)s.updateWorldMatrix(e,!1,!0)}find(e){let n;return this.traverse(r=>{r.uuid===e&&(n=r)}),n}innerDrawChildren(e){for(let n=this.children.length-1;n>=0;n--)this.children[n].draw(e)}resetBBoxNeedsUpdate(){super.resetBBoxNeedsUpdate(),this.traverse(e=>{e.resetBBoxNeedsUpdateSelf()})}clone(e){let n=new ps(this.uuid,this.data,e);n.parent=void 0;for(let r of this.children)n.add(r.clone(e));return n}},Ps=class extends ps{constructor(e,n,r){super(e,n,r);this.uuid=e;this.data=n;this.updateState(n,r)}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.innerDrawChildren(e),e.restore())}clone(e){let n=new Ps(this.uuid,this.data,e);n.parent=void 0;for(let r of this.children)n.add(r.clone(e));return n}};pt();an();var Bi=class extends ps{constructor(e,n,r){super(e,n,r);this.uuid=e;this.width=0;this.height=0;this.clipped=!0;this.background=new Oo(e+"-background",bf.defaultData,r),this.background.parent=this,this.updateState(n,r)}get fill(){return this.background.fill}get stroke(){return this.background.stroke}get backgroundBlur(){return this.background.backgroundBlur}get layerBlur(){return this.background.layerBlur}get dropShadow(){return this.background.dropShadow}get innerShadow(){return this.background.innerShadow}get cornerRadius(){return this.background.cornerRadius}set cornerRadius(e){this.background.cornerRadius=e}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(e,n,r){super.updateWorldMatrix(e,n,r),this.background?.updateWorldMatrix(e,n,r)}draw(e){if(!this.visible)return;e.save();let n=this.width,r=this.height;this.applyTransforms(e),this.background.width=n,this.background.height=r,this.background.draw(e),this.clipped&&e.clipRect(0,0,n,r,...this.cornerRadius),this.innerDrawChildren(e),e.restore()}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let n=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,n=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,n=!0),n&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,n){super.updateState(e,n),this.updateSizeState(e),this.updateCornerState(e),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur),e.clipped!==void 0&&(this.clipped=e.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(e,n,r){super.updateByPatchedOp(e,n,r),e.type===0&&($t(e.path,["fill"])?this.fill.update(e.props):$t(e.path,["stroke"])?this.stroke.update(e.props):$t(e.path,["dropShadow"])?this.dropShadow.update(e.props):$t(e.path,["innerShadow"])?this.innerShadow.update(e.props):$t(e.path,["layerBlur"])?this.layerBlur.update(e.props):$t(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}clone(e){let n=new Bi(this.uuid,this.data,e);n.parent=void 0;for(let r of this.children)n.add(r.clone(e));return n}};pt();var J4=ed(VE(),1),YE=new Map,Dre=4096,pm=null;function Lre(i){let t=YE.get(i);if(t!==void 0)return t;if(pm===null||!pm.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",pm=document.createElementNS("http://www.w3.org/2000/svg","path"),n.appendChild(pm),document.body.appendChild(n)}pm.setAttribute("d",i);let e=pm.getBBox();return YE.size>=Dre&&YE.clear(),YE.set(i,e),e}var bc=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;ej(this.path)&&(console.warn("Invalid SVG path",this.uuid),e=""),this._pathBBox=Lre(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 bc(this.uuid,this.data,e);return n.parent=void 0,n}};function ej(i){return/NaN/.test(i)}function tj(i,t=1,e=1){if(t<=0||e<=0)return i;if(ej(i))return console.warn("Cannot scale invalid path",i),$E([]);if(t===1&&e===1)return i;try{let r=(0,J4.parseSVG)(i).map(s=>{let o={...s};return"x"in o&&(o.x=o.x*t),"y"in o&&(o.y=o.y*e),"x1"in o&&(o.x1=o.x1*t),"x2"in o&&(o.x2=o.x2*t),"y1"in o&&(o.y1=o.y1*e),"y2"in o&&(o.y2=o.y2*e),"rx"in o&&(o.rx=o.rx*t),"ry"in o&&(o.ry=o.ry*e),o});return $E(r)}catch(n){return console.warn("Error parsing SVG path",n),$E([])}}function $E(i){let t=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"],e;return i.map(n=>{let r=[];t.forEach(o=>{if(o in n){let a=n[o]*1;r.length&&a>=0&&r.push(","),r.push(a)}});let s=(e===n.code?r[0]<0?"":",":n.code)+r.join("");return e=n.code,s}).join("")}function nj(i,t,e){switch(t.type){case"ellipse2d":return new Ou(i,t,e);case"rectangle2d":return new Oo(i,t,e);case"text2d":return new Du(i,t,e);case"vector2d":return new hm(i,t,e);case"path2d":return new bc(i,t,e);case"frame2d":return new Bi(i,t,e);case"group2d":default:return new Ps(i,t,e)}}qr();var hI=class{constructor(t,e,n){this.uuid=t;this.data=e;this.group=new Ps(hI.GROUP_ID,{...ov.defaultData},n),this.createChildrenObjects(e.objects,this.group,n)}createObject(t,e,n,r,s,o){let a=nj(t,e,o);a&&(r.add(a),r.children.splice(s,0,r.children.pop()),a.updateWorldMatrix(),n.length>0&&(a instanceof Ps||a instanceof Bi)&&this.createChildrenObjects(n,a,o))}createChildrenObjects(t,e,n){let r=0;for(let s of t)this.createObject(s.id,s.data,s.children,e,r,n),r+=1}draw(t){this.group.draw(t)}updateEntityByOp(t,e,n,r){let s=this.find(t);if(s)try{s.updateByOp(e,n,{shared:r})}catch(o){console.error(o)}}updateTreeByOp(t,e){if(t.path.length===0&&t.type===7){let n=t.parent===null?this.group:this.find(t.parent);n!==void 0&&n instanceof ps&&(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 ps){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 ps||s===this){s.add(n);let o=t.localIndex;s.children.splice(o,0,s.children.pop()),n.updateWorldMatrix(!0,!1,!0),r?.requestRender(),n.requestRender()}n.resetBBoxNeedsUpdate()}}}add(t){this.group.add(t)}remove(t){this.group.remove(t)}traverse(t){this.group.traverse(e=>{e!==this.group&&t(e)})}intersectsChildren(t,e,n,r=!1,s=[]){return this.group.intersectsChildren(t,e,n,r,s,!0)}intersectsChildrenReverse(t,e,n,r=!1,s=[]){return this.group.intersectsChildrenReverse(t,e,n,r,s,!0)}find(t){return this.group.find(t)}get children(){return this.group.children}project(t,e){return this.group.project(t,e)}getWithSortKey(t){let e=this.find(t);if(e===void 0)return;let n=[],r=e;for(;r!==this.group;){let s=r;r=r.parent;let o=r.children.indexOf(s);n.splice(0,0,o)}return{entity:e,sortKey:n}}getAllSorted(t){let e=[];for(let n of t){let r=this.getWithSortKey(n.id);r!==void 0&&e.push(r)}return e.sort((n,r)=>Rd(n.sortKey,r.sortKey)),e.map(n=>n.entity)}},fh=hI;fh.GROUP_ID="scene2d";function pI({constraints:i,newParentWidth:t,newParentHeight:e,initialParentWidth:n,initialParentHeight:r,objectInitialWidth:s,objectInitialHeight:o,objectInitialPosition:a}){let{horizontalConstraint:l,verticalConstraint:c}=i,u=t-n,d=e-r,h=s,p=o,f=a[0],m=a[1];if(l!==0){if(l===1)f+=u;else if(l===3)f+=u/2;else if(l===2)h=Math.max(1,h+u);else if(l===4){let 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 Nre=ed(VE(),1);var MBe={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}};$i();an();pt();q();fI();function mI(i,t,e,n){return n?e:2048/Math.max(1,i,t)}function sj(i,t,e,n){let r=mI(i,t,e,n),s=Math.max(e,512/Math.min(i,t)),o=Math.min(s,r);return{width:Math.max(1,Math.ceil(i*o)),height:Math.max(1,Math.ceil(t*o))}}var Bre=`
9805
9805
  varying vec2 vUv;
9806
9806
  void main() {
@@ -9816,7 +9816,7 @@ void main() {
9816
9816
  `,e),d=e.horizontalAlign===1?u:0,h=this.getLineInitialOffsetX(a[0],l,e.horizontalAlign,t[0],u),p=this.getLineInitialOffsetY(o,t.length,c,s,e.verticalAlign),f=[],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(a[v],l,e.horizontalAlign,b,u);let E=[];try{E=this.reverseLigaturesTable(r,b,S)}catch(A){this.warnLayoutError(A)}let T=this.computeSpaceWidthForLine(t,v,e,n),w=0,_=S[0];_&&e.horizontalAlign===2&&_.leftSideBearing!==void 0&&(h-=_.leftSideBearing*s);try{this.font?.forEachGlyph(b,h,p,e.fontSize,x,(A,C,R,D,O)=>{let L=A.index===0?`
9817
9817
  `:A.unicode?String.fromCharCode(A.unicode):void 0,F=E[w],j=0;if(L===`
9818
9818
  `)j=d;else if(L===" ")j=T;else{let W=this.createPath(A,s,C,R,e);W&&(j=W.offsetX,f.push(W.path))}if(!F||F.replacements.length===1)g[v].push([C,R]),m[v].push(j);else{let W=F.replacements.map(ee=>(r.glyphs.get(ee).advanceWidth??0)*s),K=W.reduce((ee,oe)=>ee+=oe,0),Y=W.map(ee=>ee/K),$=C;for(let ee=0;ee<Y.length;ee++){let oe=j*Y[ee];g[v].push([$,R]),m[v].push(oe),$+=oe}}w++})}catch(A){this.warnLayoutError(A)}p-=o}let y=[];for(let v=0,b=f.length;v<b;v++)y.push(...f[v].toShapes());return{shapes:y,charWidths:m,lineWidths:a,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(`
9819
- `)>=0&&(t-=s),n===3?e*.5-t*.5:n===2?e-t:0}getLineInitialOffsetY(t,e,n,r,s){let o=e*t,a=Math.abs(this.ascender-this.descender)*r,l=t-a,c=-this.ascender*r-l/2;return s===3?-(n-o-c):s===2?-(n*.5-o*.5-c):c}createPath(t,e,n,r,s){let o=t.getPath(n,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!o){console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");return}let a=new QE,l=(t.advanceWidth??1)*e;if(t)for(let c of o.commands){let u=a.currentPath?.currentPoint;if(!(u&&c.type!=="Z"&&u.x===c.x&&-u.y===c.y))switch(c.type){case"M":a.moveTo(c.x,-c.y);break;case"L":a.lineTo(c.x,-c.y);break;case"Q":a.quadraticCurveTo(c.x1,-c.y1,c.x,-c.y);break;case"C":a.bezierCurveTo(c.x1,-c.y1,c.x2,-c.y2,c.x,-c.y);break}}return a.subPaths.forEach(c=>{let u=Kre(c.curves);u!==void 0&&c.currentPoint.distanceTo(u)>0&&c.lineTo(u.x,u.y)}),{offsetX:l,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}computeSpaceWidthForLine(t,e,n,r){let s=this.getCharWidth(" ",n),o=t[e];if(o){let a=this.countSpaces(o.trimEnd());if(n.horizontalAlign===4&&e<t.length-1&&a){let l=typeof n.width=="string"?Number(r.getVariable(n.width)):n.width,c=this.getTextWidth(o,n);return(l-(c-a*s))/a}}return s}countSpaces(t){return(t.match(/ /g)||[]).length}};function Kre(i){if(i.length){let t=i[0];if(t instanceof _i)return t.v1;if(t instanceof Ni||t instanceof bs)return t.v0}}fw();Qt();Eo("TextGeometry",(i,t,e)=>new Pu(i,t,e));var dj={create:(i,t)=>new qf(i,t)};uv("TextGeometry",dj);uv("InputGeometry",dj);rV(eT);Mt("text");pt();var tT=200,hj=null;function pj(i){hj=i}function TI(){return hj}function fj(i){let t=!1;return i.scene.objects.forEach(e=>{e.data.type==="Page"&&!t&&e.data.publish.gameControlObject&&bo.traverseModuleInstances(i,e.id,(r,s,o)=>{for(let a of o)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(t=!0)})}),t}dn();var ub=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return Math.sqrt(e*e+n*n)},mj=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return Zre(Math.atan2(n,e))},gj=(i,t,e)=>{let n={x:0,y:0};return e=rT(e),n.x=i.x-t*Math.cos(e),n.y=i.y-t*Math.sin(e),n},rT=i=>i*(Math.PI/180),Zre=i=>i*(180/Math.PI),yj=i=>isNaN(i.buttons)?i.pressure!==0:i.buttons!==0,nT=new Map,vj=i=>{nT.has(i)&&clearTimeout(nT.get(i)),nT.set(i,setTimeout(function(){nT.delete(i),i()},100))},mm=(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)},gm=(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 iT=i=>(i.preventDefault(),i.type.match(/^touch/)?i.changedTouches:i),MI=()=>{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}},sT=(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")},oT=(i,t,e)=>{let n=xj(i);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof t=="string")n[r]=t+" "+e;else{let s="";for(let o=0,a=t.length;o<a;o+=1)s+=t[o]+" "+e+", ";n[r]=s.slice(0,-2)}return n},bj=(i,t)=>{let e=xj(i);for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t);return e},xj=i=>{let t={};return t[i]="",["webkit","Moz","o"].forEach(function(n){t[n+i.charAt(0).toUpperCase()+i.slice(1)]=""}),t},aT=(i,t)=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e]);return i},Sj=(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},db=(i,t)=>{if(i.length)for(let e=0,n=i.length;e<n;e+=1)t(i[e]);else t(i)},wj=(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"&&(Ej="ontouchstart"in window,Tj=!!window.PointerEvent,Mj=!!window.MSPointerEvent);var Ej,Tj,Mj,hb={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"}},ym,pb={};Tj?ym=hb.pointer:Mj?ym=hb.MSPointer:Ej?(ym=hb.touch,pb=hb.mouse):ym=hb.mouse;function mh(){}mh.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};mh.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};mh.prototype.trigger=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]&&e._handlers_[r].length&&e._handlers_[r].forEach(function(o){o.call(e,{type:r,target:e},t)})};mh.prototype.config=function(i){var t=this;t.options=t.defaults||{},i&&(t.options=Sj(t.options,i))};mh.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.')},mm(i,ym[t],e._domHandlers_[t]),pb[t]&&mm(i,pb[t],e._domHandlers_[t]),e};mh.prototype.unbindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},gm(i,ym[t],e._domHandlers_[t]),pb[t]&&gm(i,pb[t],e._domHandlers_[t]),delete e._domHandlers_[t],this};var vm=mh;function vi(i,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=i,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=vi.id,vi.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}vi.prototype=new vm;vi.constructor=vi;vi.id=0;vi.prototype.buildEl=function(i){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)};vi.prototype.stylize=function(){if(this.options.dataOnly)return this;var i=this.options.fadeTime+"ms",t=bj("borderRadius","50%"),e=oT("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)"},aT(n.el,e),this.options.shape==="circle"&&aT(n.back,t),aT(n.front,t),this.applyStyles(n),this};vi.prototype.applyStyles=function(i){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var e in i[t])this.ui[t].style[e]=i[t][e];return this};vi.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};vi.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};vi.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null};vi.prototype.show=function(i){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof i=="function"&&i.call(this)},t.options.fadeTime)),t};vi.prototype.hide=function(i){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var e=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=e,typeof i=="function"&&i.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let e=t.options.restJoystick,n={};n.x=e===!0||e.x!==!1?0:t.instance.frontPosition.x,n.y=e===!0||e.y!==!1?0:t.instance.frontPosition.y,t.setPosition(i,n)}return t};vi.prototype.setPosition=function(i,t){var e=this;e.frontPosition={x:t.x,y:t.y};var n=e.options.fadeTime+"ms",r={};r.front=oT("transition",["top","left"],n);var s={front:{}};s.front={left:e.frontPosition.x+"px",top:e.frontPosition.y+"px"},e.applyStyles(r),e.applyStyles(s),e.restTimeout=setTimeout(function(){typeof i=="function"&&i.call(e),e.restCallback()},e.options.fadeTime)};vi.prototype.restCallback=function(){var i=this,t={};t.front=oT("transition","none",""),i.applyStyles(t),i.trigger("rested",i.instance)};vi.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};vi.prototype.computeDirection=function(i){var t=i.angle.radian,e=Math.PI/4,n=Math.PI/2,r,s,o;if(t>e&&t<e*3&&!i.lockX?r="up":t>-e&&t<=e&&!i.lockY?r="left":t>-e*3&&t<=-e&&!i.lockX?r="down":i.lockY||(r="right"),i.lockY||(t>-n&&t<n?s="left":s="right"),i.lockX||(t>0?o="up":o="down"),i.force>this.options.threshold){var a={},l;for(l in this.direction)Object.prototype.hasOwnProperty.call(this.direction,l)&&(a[l]=this.direction[l]);var c={};this.direction={x:s,y:o,angle:r},i.direction=this.direction;for(l in a)a[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return i;(!c.x||!c.y)&&this.trigger("plain",i),c.x||this.trigger("plain:"+s,i),c.y||this.trigger("plain:"+o,i),c.angle||this.trigger("dir dir:"+r,i)}else this.resetDirection();return i};var _j=vi;function Kr(i,t){var e=this;e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.pressureIntervals={},e.manager=i,e.id=Kr.id,Kr.id+=1,e.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},e.config(t),(e.options.mode==="static"||e.options.mode==="semi")&&(e.options.multitouch=!1),e.options.multitouch||(e.options.maxNumberOfNipples=1);let n=getComputedStyle(e.options.zone.parentElement);return n&&n.display==="flex"&&(e.parentIsFlex=!0),e.updateBox(),e.prepareNipples(),e.bindings(),e.begin(),e.nipples}Kr.prototype=new vm;Kr.constructor=Kr;Kr.id=0;Kr.prototype.prepareNipples=function(){var i=this,t=i.nipples;t.on=i.on.bind(i),t.off=i.off.bind(i),t.options=i.options,t.destroy=i.destroy.bind(i),t.ids=i.ids,t.id=i.id,t.processOnMove=i.processOnMove.bind(i),t.processOnEnd=i.processOnEnd.bind(i),t.get=function(e){if(e===void 0)return t[0];for(var n=0,r=t.length;n<r;n+=1)if(t[n].identifier===e)return t[n];return!1}};Kr.prototype.bindings=function(){var i=this;i.bindEvt(i.options.zone,"start"),i.options.zone.style.touchAction="none",i.options.zone.style.msTouchAction="none"};Kr.prototype.begin=function(){var i=this,t=i.options;if(t.mode==="static"){var e=i.createNipple(t.position,i.manager.getIdentifier());e.add(),i.idles.push(e)}};Kr.prototype.createNipple=function(i,t){var e=this,n=e.manager.scroll,r={},s=e.options,o={x:e.parentIsFlex?n.x:n.x+e.box.left,y:e.parentIsFlex?n.y:n.y+e.box.top};if(i.x&&i.y)r={x:i.x-o.x,y:i.y-o.y};else if(i.top||i.right||i.bottom||i.left){var a=document.createElement("DIV");a.style.display="hidden",a.style.top=i.top,a.style.right=i.right,a.style.bottom=i.bottom,a.style.left=i.left,a.style.position="absolute",s.zone.appendChild(a);var l=a.getBoundingClientRect();s.zone.removeChild(a),r=i,i={x:l.left+n.x,y:l.top+n.y}}var c=new _j(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||(sT(c.ui.el,r),sT(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=iT(i),t.updateBox();var r=function(s){t.actives.length<e.maxNumberOfNipples?t.processOnStart(s):n.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(o){if(Object.values(n.touches).findIndex(function(l){return l.identifier===o})<0){var a=[i[0]];a.identifier=o,t.processOnEnd(a)}}),t.actives.length<e.maxNumberOfNipples&&t.processOnStart(s))};return db(i,r),t.manager.bindDocument(),!1};Kr.prototype.processOnStart=function(i){var t=this,e=t.options,n,r=t.manager.getIdentifier(i),s=i.force||i.pressure||i.webkitForce||0,o={x:i.pageX,y:i.pageY},a=t.getOrCreate(r,o);a.identifier!==r&&t.manager.removeIdentifier(a.identifier),a.identifier=r;var l=function(u){u.trigger("start",u),t.trigger("start "+u.id+":start",u),u.show(),s>0&&t.pressureFn(i,u,u.identifier),t.processOnMove(i)};if((n=t.idles.indexOf(a))>=0&&t.idles.splice(n,1),t.actives.push(a),t.ids.push(a.identifier),e.mode!=="semi")l(a);else{var c=ub(o,a.position);if(c<=e.catchDistance)l(a);else{a.destroy(),t.processOnStart(i);return}}return a};Kr.prototype.getOrCreate=function(i,t){var e=this,n=e.options,r;return/(semi|static)/.test(n.mode)?(r=e.idles[0],r?(e.idles.splice(0,1),r):n.mode==="semi"?e.createNipple(t,i):(console.warn("Coudln't find the needed nipple."),!1)):(r=e.createNipple(t,i),r)};Kr.prototype.processOnMove=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.scroll;if(!yj(i)){this.processOnEnd(i);return}if(!r){console.error("Found zombie joystick with ID "+n),t.manager.removeIdentifier(n);return}if(e.dynamicPage){var o=r.el.getBoundingClientRect();r.position={x:s.x+o.left,y:s.y+o.top}}r.identifier=n;var a=r.options.size/2,l={x:i.pageX,y:i.pageY};e.lockX&&(l.y=r.position.y),e.lockY&&(l.x=r.position.x);var c=ub(l,r.position),u=mj(l,r.position),d=rT(u),h=c/a,p={distance:c,position:l},f,m;if(r.options.shape==="circle"?(f=Math.min(c,a),m=gj(r.position,f,u)):(m=wj(l,r.position,a),f=ub(m,r.position)),e.follow){if(c>a){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=ub(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||sT(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/a,y:-y/a},raw:p,instance:r,lockX:e.lockX,lockY:e.lockY};v=r.computeDirection(v),v.angle={radian:rT(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 Aj=Kr;function oi(i){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=MI(),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(){vj(e)},t._onScroll=function(){t.scroll=MI()},t.collections}oi.prototype=new vm;oi.constructor=oi;oi.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}};oi.prototype.create=function(i){return this.createCollection(i)};oi.prototype.bindWindowEvents=function(){var i=this;i._windowBound||typeof window>"u"||(i._windowBound=!0,mm(window,"resize",i._onResize),mm(window,"scroll",i._onScroll))};oi.prototype.unbindWindowEvents=function(){var i=this;!i._windowBound||typeof window>"u"||(i._windowBound=!1,gm(window,"resize",i._onResize),gm(window,"scroll",i._onScroll))};oi.prototype.createCollection=function(i){var t=this,e=new Aj(t,i);return t.bindCollection(e),t.collections.push(e),t.bindWindowEvents(),e};oi.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)};oi.prototype.bindDocument=function(){var i=this;i.binded||(i.bindEvt(document,"move").bindEvt(document,"end"),i.binded=!0)};oi.prototype.unbindDocument=function(i){var t=this;(!Object.keys(t.ids).length||i===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};oi.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]};oi.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};oi.prototype.onmove=function(i){var t=this;return t.onAny("move",i),!1};oi.prototype.onend=function(i){var t=this;return t.onAny("end",i),!1};oi.prototype.oncancel=function(i){var t=this;return t.onAny("end",i),!1};oi.prototype.onAny=function(i,t){var e=this,n,r="processOn"+i.charAt(0).toUpperCase()+i.slice(1);t=iT(t);var s=function(a,l,c){c.ids.indexOf(l)>=0&&(c[r](a),a._found_=!0)},o=function(a){n=e.getIdentifier(a),db(e.collections,s.bind(null,a,n)),a._found_||e.removeIdentifier(n)};return db(t,o),!1};oi.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()};oi.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 Cj=oi;var bm=null;function Pj(){return bm||(bm=new Cj),bm}var Qre={create:function(i){return Pj().create(i)},destroy:function(){bm&&(bm.destroy(),bm=null)},get factory(){return Pj()}},Rj=Qre;dn();pt();q();Xs();Yi();pt();var Ij=null;function Oj(i){Ij=i}function cT(){return Ij}var Dj,Lj=new Promise(i=>{Dj=i});var uT;function Nj(i){if(uT)return uT;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.77/build"),s=import("./physics.js"),[o,a]=await Promise.all([s,fetch(`${n}/physics.wasm`).then(l=>l.arrayBuffer())]);await o.init(a),Dj(o)}return uT=t(),uT}fr();Yi();Qt();ME();q();q();rh();function _I(i){let t=i.elements,e=t[0]**2+t[1]**2+t[2]**2,n=t[4]**2+t[5]**2+t[6]**2,r=t[8]**2+t[9]**2+t[10]**2,s=t[0]**2+t[4]**2+t[8]**2,o=t[1]**2+t[5]**2+t[9]**2,a=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return e<l||n<l||r<l||s<l||o<l||a<l}function ya(i,t){let e=new Me;if(t&&_I(t))return e.setAttribute("position",new Be([],3)),e.setIndex([]),e;if(!i.getAttribute("position"))return e.setAttribute("position",new Be([],3)),e.setIndex([]),e;let{positions:n,triIndices:r}=Bv(i.getAttribute("position"),i.getIndex());return e.setAttribute("position",new Be(n,3)),e.setIndex(r),t&&e.applyMatrix4(t),e}xf();var dT=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.initialDisabled=!1;this.actions=ln(e,e.actions,r,s,o,n),this.target=e.target}disconnect(){Bn(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{"runMode"in e.data&&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 fb=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.page=r;this.currentIntersectedObjects=[];this.actions=ln(e,e.actions,r,s,o,n),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let l=r.scene.find(a);l&&this.triggeringObjects.push(l)}}isValidTriggeringObject(t){return this.target==="all"?!0:this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){Bn(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};fr();var cn;Lj.then(i=>cn=i);var ai=new M,Do=new ke,Lu=new M,CUe=new Ht(0,0,0,"YXZ"),Bj=new Ht(0,0,0,"XYZ"),va=new M,AI=new M,CI=new M(1,1,1),xm=new ke,hT=new te,Fj=new te,Jre={type:"updateMatrix"},Uj=new ke,PI=new nr,eie=.5,tie=.7,RI=.01,fT={type:"beginEvent",eventName:"Collision"},nie={type:"beginEvent",eventName:"Trigger"};function kj(i){if(bo.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 mb=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 Sm(i){return tk(Wa(i)?i.object:i)}var pT=class{constructor(t){this.eventContext=t;this.isEnabled=!1;this.gameControl=null;this.joysticks=[];this.joystickToGameControls=[];this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}};this.sensorToTriggerEvent={};this.eventManager=void 0;this.needsCollisionDetection=!1;this.initializationCounter=-1;this.fixedBodiesToWatch=[];this.rigidBodyToMesh=new Map;this.nActiveRigidBodies=0;this.collisionEvents=[];this.isExport=!1;this.skipRender=!0;this._staticBVHAttrIds=new WeakMap;this._staticBVHNextAttrId=1;this.processRigidBody=t=>{if(t.bodyType()!==cn.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,n,r]=this.rigidBodyToMesh.get(t.handle);if(ai.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),Do.copy(t.rotation()),e.matrixWorld.compose(ai,Do,n),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(Jre),r){let s=e.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(e.matrixWorld);for(let o of s.children)o.updateMatrixWorld(!0)}for(let o of e.children)o.updateMatrixWorld(!0)}};this.accumulator=0;this.handleCollisionEvents=(t,e,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[t]?(r=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),r&&s&&r.isValidTriggeringObject(s)){r.dispatch();return}for(let o=this.sharedGameControlGlobals.createdObjects.length-1;o>=0;o--){let a=this.sharedGameControlGlobals.createdObjects[o];if(a.userData.hasCollisionDestroy&&(a.rigidBody?.collider(0).handle===t||a.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(o,1),a.removeFromParent();let l=a.rigidBody;requestAnimationFrame(()=>{a.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),a.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let o=this.sharedGameControlGlobals.colliderToEntity.get(e),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a===void 0)return;for(let l of a)l.data.target==="character"&&this.dispatchCollisionEvent(l,o,e)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let o=this.sharedGameControlGlobals.colliderToEntity.get(t),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a===void 0)return;for(let l of a)l.data.target==="character"&&this.dispatchCollisionEvent(l,o,t)}else{let o=this.sharedGameControlGlobals.colliderToEntity.get(t),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a!==void 0)for(let u of a)u.data.target==="scene"&&this.dispatchCollisionEvent(u,o,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(e),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let u of c)u.data.target==="scene"&&this.dispatchCollisionEvent(u,l,e)}};this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=tT,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events){if(n.data.disabled===!0)continue;let r=n.data.actions?.find(s=>s.data.type==="Destroy")?.data;if(r)for(let s of r.objects){let o=this.page.scene.find(s);o&&(o.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events)if(!(n.data.disabled===!0||n.data.type!=="DragDrop"))for(let r of n.data.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(cT()===null){Jn("collision-bvh","trigger/collision detection");return}let t=[],e=[];if(this.page.traverseChildren(n=>{let r,s=n instanceof il,o=bu(n);if(ic(n)||s||o)return;Wa(n)?r=n.object:r=n;let a=r.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let l=n.geometry,c=r.userData.hasDestroy===!0,u=r.userData.hasDrag===!0;if(mb(a)||c||u||r.dataPatched.events.some(d=>d.data.disabled!==!0&&(d.data.type==="GameControl"||d.data.type==="Follow")))return n.updateMatrixWorldRigid(),this.addBoundsTree(n),!0;if(l){let d=l.getAttribute("position");if(d!==void 0&&d.count>0){t.push({geometry:l,matrixWorld:n.matrixWorld}),e.push(l.id,this._staticBVHIdOf(d),d.version,l.index!==null?this._staticBVHIdOf(l.index):-1,l.index!==null?l.index.version:-1);for(let h of n.matrixWorld.elements)e.push(h)}}if(Sm(n))return!0}),t.length>0){let n=this._staticBVHCache;if(n!==void 0&&n.signature.length===e.length&&n.signature.every((a,l)=>a===e[l])){this.sharedGameControlGlobals.staticMeshBVH=n.bvh;return}let r=t.map(a=>ya(a.geometry,a.matrixWorld)),s=oa(r,!1),o=new(cT())(s);this._staticBVHCache={signature:e,bvh:o},this.sharedGameControlGlobals.staticMeshBVH=o}}addRigidBody(t,e,n){if(_I(t.matrixWorld))return;let r=[],s="geometry"in t?t.geometry:void 0,o=e.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(ya(s,t.shearScale)),o.physics.fusedBody){let a=this.gatherChildrenGeom(t,r);t.traverseObject(a),t.children.forEach(c=>c.updateMatrixWorld(!0));let l=t.cloner;l&&l.objectForSample===void 0&&o.physics.rigidBody==="dynamic"&&(l.traverseObject(a),l.children.forEach(c=>c.updateMatrixWorld(!0)))}if(r.length>0){let a,l=!1,c=!n.fromCreate&&o.physics.rigidBody==="dynamic"||n.fromCreate&&n.dynamic;c?(a=cn.RigidBodyDesc.dynamic(),a.setLinearDamping(o.physics.damping).setAngularDamping(o.physics.damping).setAdditionalMass(1e-9).setGravityScale(o.physics.gravityScale).enabledRotations(...o.physics.enabledRotation).enabledTranslations(...o.physics.enabledTranslation)):(n.hasTransformAnim||n.hasFollow||n.hasDrag)&&!n.fromCreate?(a=cn.RigidBodyDesc.kinematicPositionBased(),l=!0):a=cn.RigidBodyDesc.fixed();let u=oa(r);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(ai,Do,Lu),t.position0=ai.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Do.clone(),ai.divideScalar(this.pixelsPerMeter),a.setTranslation(ai.x,ai.y,ai.z).setRotation(Do),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(a),h=!(o.geometry===void 0||o.geometry.type==="SubdivGeometry"||o.geometry.type==="NonParametricGeometry"||o.geometry.type==="BooleanGeometry"||o.geometry.type==="VectorGeometry"||o.geometry.type==="StarGeometry"||o.geometry.type==="RectangleGeometry"||o.geometry.type==="EllipseGeometry"||o.geometry.type==="TriangleGeometry"||o.geometry.type==="TorusGeometry"||o.geometry.type==="HelixGeometry");try{this.addCollider(d,o.physics,u,e,h)}catch{try{this.addCollider(d,o.physics,u,e,!1)}catch(p){console.error(p)}}if(d.numColliders()===0){this.sharedGameControlGlobals.rapierWorld.removeRigidBody(d);return}c?this.rigidBodyToMesh.set(d.handle,[t,Lu.clone(),o.physics.fusedBody]):l?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(d.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,d,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=d}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(ya(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(n=>n.updateMatrixWorld(!0)),e.length>0){let n=oa(e,!1);t.bvhGeometry=n,n.getAttribute("position").count>0?(t.bvhGeometry.boundsTree=new(cT())(n),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):!1&&console.warn(`ControlsManager.addBoundsTree: object "${t.name}" has empty geometry`)}}addCollider(t,e,n,r,s=!0){if(n?.getAttribute("position").count===0||n?.getIndex()?.count===0)return;let o;n&&(e.colliderType==="trimesh"?o=cn.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array):o=cn.ColliderDesc.convexMesh(n.getAttribute("position").array,s?n.getIndex().array:void 0)),o.setFrictionCombineRule(cn.CoefficientCombineRule.Average).setRestitutionCombineRule(cn.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(l=>l.target==="scene")&&a.setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let n=Sm(t);return(r,s)=>{if(s===0)return;if(n&&r.parent===t)return!0;let o;if(ic(r))if(r.objectForSample){if(r.objectForSample.dataPatched.physics.fusedBody)return;o=r.object}else return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Wa(r))o=r.object;else if(o=r,o.dataPatched.cloner?.hideBase)return!0;let a=o.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;s===1?t.hasNonUniformScale?r.matrixWorld.multiplyMatrices(t.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let l=r.geometry;if(l?.getAttribute("position")!==void 0&&e.push(ya(l,r.matrixWorld)),Sm(r))return!0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,n=!1;this.page.traverseEntity(a=>{for(let l of a.dataPatched.events)if(l.data.disabled===!1&&l.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=TI();if(r!==null?n=r.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||n:this.page.data.publish.gameControlObject!==null&&Jn("game-controls","the scene's game controls"),n===!1){let{enableRotate:a,enablePan:l,enableZoom:c,autoRotate:u,hoverRotatePanMode:d}=this.eventManager.publish.orbitControls;(a||l||c||u||d!==0)&&(this.orbitControls=new im(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let s=this.renderer.domElement.width/this.renderer.getPixelRatio(),o=this.renderer.domElement.height/this.renderer.getPixelRatio();TI()?.createJoysticks(this,s,o),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new cn.World(new cn.Vector3(0,this.gravity,0)),this.events=new cn.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let l;if(ic(a))if(a.objectForSample){if(a.objectForSample.dataPatched.physics.fusedBody)return;l=a.object}else return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Wa(a))l=a.object;else{if(bu(a)||la(a)||a instanceof il)return;if(l=a,l.dataPatched.cloner?.disabled===!1&&l.dataPatched.cloner?.hideBase&&l.dataPatched.physics?.fusedBody!==!0)return!0}let c=l.dataPatched,u;for(let y of c.events)y.data.disabled!==!0&&y.data.type==="GameControl"&&(u=y.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let d=mb(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 dT(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;a.traverseVisible(b=>{b.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let g=a.geometry;if(u!==void 0){let y=cn.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(ai,Do,Lu),a.position0=ai.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Do.clone(),ai.divideScalar(this.pixelsPerMeter),y.setTranslation(ai.x,ai.y,ai.z).setRotation(Do);let v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(y);a.rigidBody=v;let b;u.collider.type==="sphere"?b=cn.ColliderDesc.ball(u.collider.radius/this.pixelsPerMeter):u.collider.type==="capsule"?b=cn.ColliderDesc.capsule((u.collider.height/2-u.collider.radius)/this.pixelsPerMeter,u.collider.radius/this.pixelsPerMeter):b=cn.ColliderDesc.cuboid(u.collider.width/this.pixelsPerMeter/2,u.collider.height/this.pixelsPerMeter/2,u.collider.depth/this.pixelsPerMeter/2),b.setFrictionCombineRule(cn.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(cn.CoefficientCombineRule.Min);let x=this.sharedGameControlGlobals.rapierWorld.createCollider(b,v);this.sharedGameControlGlobals.colliderToEntity.set(x.handle,l),ai.fromArray(u.collider.position.map(E=>typeof E=="number"?E:0)).multiply(Lu.setFromMatrixScale(l.matrixWorld)).divideScalar(this.pixelsPerMeter),x.setTranslationWrtParent(ai);let S=new ke().setFromEuler(new Ht().setFromVector3(new M().fromArray(u.collider.rotation.map(E=>typeof E=="number"?E:0))));x.setRotationWrtParent(S),x.setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(l,!0)}else c.physics.rigidBody==="dynamic"||d||m||p||f||h?(this.addRigidBody(a,l,{hasFollow:m,hasTransformAnim:d,hasDrag:f}),this.generateSensorColliderDescs(l,c.physics.fusedBody)):(g&&t.push(ya(g,a.matrixWorld)),c.physics.fusedBody&&!Sm(a)&&a.traverseObject((y,v)=>{if(v===0)return;let b;if(ic(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(bu(y)||la(y)||y instanceof il)return;if(Wa(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(ya(S,y.matrixWorld)),Sm(y))return!0}),this.generateSensorColliderDescs(l,c.physics.fusedBody,e));if(c.physics?.fusedBody===!0||u||Sm(a))return!0}),t.length===0)return;let n=oa(t),r=n.getIndex().count>0;if(!r&&e.length===0)return;n.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let s=cn.RigidBodyDesc.fixed(),o=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s);if(r){let a=cn.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array).setFrictionCombineRule(cn.CoefficientCombineRule.Multiply).setRestitutionCombineRule(cn.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,o)}for(let[a,l]of e){let c=this.sharedGameControlGlobals.rapierWorld.createCollider(a,o);this.sensorToTriggerEvent[c.handle]=l}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let n=new fb(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),r=new te().compose(va.fromArray(e.data.position.map(s=>typeof s=="number"?s:0)),xm.setFromEuler(Bj.fromArray(e.data.rotation.map(s=>typeof s=="number"?s:0))),CI);if(e.data.triggerZone==="box"){let s=new Nt;s.min.fromArray(e.data.size.map(o=>typeof o=="number"?o:0)).multiplyScalar(-.5),s.max.fromArray(e.data.size.map(o=>typeof o=="number"?o:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([s,r,t,n])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,r,t,n])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(!!this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let n=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let r=t/1e3;r<n&&r>n*.55&&(r=n),this.accumulator+=r;let s=performance.now(),o=0,a=6;for(;this.accumulator>=n&&o<a&&(e=this.stepPhysics()&&e,this.accumulator-=n,o++,!(performance.now()-s>n*1e3)););this.accumulator=this.accumulator%n}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(ai,Do,Lu);let e=t;e.prevQ===void 0?(e.prevQ=Do.clone(),e.prevT=ai.clone()):(e.prevQ.copy(Do),e.prevT.copy(ai))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,n,r]=this.fixedBodiesToWatch[t];if(e.rigidBody!==n){this.fixedBodiesToWatch.splice(t,1);continue}(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(r)||(n.setBodyType(cn.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(n.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,n=t.linvel(),r=t.translation(),s=Math.hypot(n.x,n.z);for(let o=0;o<t.numColliders();o++){let a=t.collider(o);e.contactPairsWith(a,l=>{let c=l.parent();if(c===null||!c.isDynamic())return;let u=c.translation(),d=-1/0,h=0,p=0;if(e.contactPair(a,l,v=>{let b=v.normal(),S=b.x*(u.x-r.x)+b.y*(u.y-r.y)+b.z*(u.z-r.z)<0?-1:1;if(Math.abs(b.y)>tie)return;let E=S*b.x,T=S*b.z,w=Math.hypot(E,T);if(w<1e-4)return;let _=(n.x*E+n.z*T)/w;_>d&&(d=_,h=E/w,p=T/w)}),d===-1/0)return;let f=n.x*h+n.z*p;if(f<-RI)return;let m=c.linvel();if(s>RI&&f>RI){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-eie);c.setLinvel({x:m.x-h*y,y:m.y,z:m.z-p*y},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let t=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[n,r]of t){if(r.rigidBody===void 0){t.delete(n);continue}this.recordPhysicsPose(r),r.rigidBody.setNextKinematicTranslation(ai.divideScalar(this.pixelsPerMeter)),r.rigidBody.setNextKinematicRotation(Do)}for(let n of this.sharedGameControlGlobals.entitiesWithTransformAnim)n.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(n);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,n){let r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(n))._parent,s;if(e.cloner){for(let o of e.cloner.children)if(o.rigidBody===r){s=o;break}}t.dispatch(s),e.dispatchEvent(fT)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,n){let r=Fj.copy(t.matrixWorld).invert();t.traverseEntity((s,o)=>{if(e===!1&&o===1)return!0;for(let a of s.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let l=new fb(a.id,a.data,s,this.page,this.sharedAssets,this.eventManager),c;if(a.data.triggerZone==="box"?c=cn.ColliderDesc.cuboid(...a.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):c=cn.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),c.setDensity(0).setSensor(!0).setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS),va.fromArray(a.data.position.map(u=>typeof u=="number"?u:0)),xm.setFromEuler(Bj.fromArray(a.data.rotation.map(u=>typeof u=="number"?u:0))),hT.compose(va,xm,CI).premultiply(s.matrixWorld),n?(hT.decompose(va,xm,AI),c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_FIXED|cn.ActiveCollisionTypes.DYNAMIC_FIXED)):(hT.premultiply(r).decompose(va,xm,AI),t.rigidBody.bodyType()===cn.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===cn.RigidBodyType.Fixed?c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_FIXED|cn.ActiveCollisionTypes.DYNAMIC_FIXED):c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_KINEMATIC|cn.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),va.divideScalar(this.pixelsPerMeter),c.setTranslation(va.x,va.y,va.z),c.setRotation(xm),n)n.push([c,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(c,t.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[n,r,s,o]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let l=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(s===l||o.isValidTriggeringObject(Ot.is(l)?l:l.object)===!1)continue;let c=Fj.copy(s.matrixWorld).decompose(va,Uj,AI).compose(va,Uj,CI).multiply(r),u=hT.copy(l.matrixWorld).invert().multiply(c),d=l.bvhGeometry.boundsTree;n instanceof Nt?t=d.intersectsBox(n,u):(PI.radius=n,PI.center.setFromMatrixPosition(u),t=d.intersectsSphere(PI)),t?o.currentIntersectedObjects.indexOf(l)===-1&&(o.currentIntersectedObjects.push(l),o.dispatch(),s.dispatchEvent(nie)):o.currentIntersectedObjects=o.currentIntersectedObjects.filter(h=>h!==l)}}}};ih();q();Ev();an();dc();var Vj=4,II=8;var OI=.02,DI=.3,rie=65,zj=new M,Gj=new M,iie=new M,Ki=new M,xc=new M,wm=new M,LI=new te,jj=new te,sie=new te,Ks=new ke,gh=new ke,Em=new Ht(0,0,0,"YXZ"),oie=new M(1,0,0),cl=new M(0,1,0),aie=new M(0,0,1),Hj=new M(1,1,1),NI=[],Wj=i=>NI[i]??(NI[i]=new M),BI=new M,lie=new M,cie=new M,uie=new M,qj=new ke,die=new M,Xj=new ke,hie=1,pie=.025,fie=16e-6,Yj=12,mie=20,Ri=new ri,Lo=new Nt,gie={type:"requestRender"},yie={type:"updateMatrix"},mT=class extends Mn{constructor(e,n,r,s,o,a,l,c,u){super();this.object=e;this.domElement=n;this.data=r;this.gloabalPhysics=s;this.controlsManager=o;this.cameraFollow=a;this.camera=l;this.page=c;this.sharedAssets=u;this.enableDamping=!0;this.hiddenMatrix0=new te;this.target0=new M;this.zoom0=1;this.rotForce=1;this.moveForce=1;this.pixelsPerMeter=tT;this.euler0=new Ht(0,0,0,"YXZ");this.position0Cam=new M;this.quat0Cam=new ke;this.scale0Cam=new M;this.hiddenMatrix0Cam=new te;this.threshEndTranslate=.01;this.threshEndRotate=1e-8;this.threshEndRotVel=.005;this.collider={type:"capsule",radius:40,segment:new ri(new M(0,-40,0),new M(0,40,0)),matrix:new te,position:new M,rotation:new ke};this.euler=new Ht(0,0,0,"YXZ");this.eulerDelta=new M;this.lastPosition=new M;this.lastCameraQuaternion=new ke;this.lastCameraPosition=new M;this.PI_2=Math.PI/2;this.prevMouse=new G;this.velocityTarget=new M;this.velocity=new M;this.directionXZ=new M;this.rotVelocityStick=new M;this.rotVelocityTarget=new M;this.rotVelocity=new M;this.rotDirection=new M;this.nonColliderRotOffset=new te;this.nonColliderPosOffset=new te;this.firstPointerId=-1;this.rot=new M;this.path=[];this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0};this.onObject=!1;this.actionState={};this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]];this.collisionEnabled=!0;this.offsetMatrix=new te;this.objectToTarget=new M;this.objectToTarget0=new M;this.objectToCamXZ=new M;this.objectToCamXZ0=new M;this.targetToCamera=new M;this.targetToCamera0=new M;this.cameraPolarAxis0=new M;this.targetPos=new M;this.targetQuat=new ke;this.lerpFactorPos=new M().setScalar(.3);this.lerpFactorPosStart=.3;this.lerpFactorPosEnd=.3;this.lerpFactorRotStart=.3;this.lerpFactorRotEnd=.3;this.lerpFactorPosCamera=.3;this.lerpFactorRotCamera=.3;this.objXZQuat=new ke;this.objXZQuatInv=new ke;this.objXZRotMat=new te;this.isFirstPerson=!1;this.didHit=!1;this.groundVelocity=new M;this.pushedVelocity=new M;this.groundYRotation=0;this.objectRealQuat=new ke;this.colliderWorldQuat=new ke;this.groundNormal=new M;this.groundTilt=new ke;this.groundTiltInv=new ke;this.lastHitObj=null;this.isFirstFrame=!0;this.rotationAccumWhenOrientWithCamera=0;this.navMeshPathDest=null;this.position=new M;this.quaternion=new ke;this.scale=new M;this.initialAction=!0;this.onPointerDown=e=>{!(e.target===this.domElement||e.target instanceof HTMLElement&&e.target.tagName==="SPLINE-VIEWER"&&e.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!mi&&!CC&&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"&&(CC&&C3<15.5&&!mi?(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?mT.isLocked=!0:mT.isLocked=!1};this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")};this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0};this.onKeyDown=e=>{!(e.target instanceof HTMLInputElement)&&(e.code==="ArrowLeft"||e.code==="ArrowUp"||e.code==="ArrowRight"||e.code==="ArrowDown"||e.code==="Space")&&e.preventDefault();for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]){this.movementState[n[0]]=1;break}this.controlsManager.requestRender()};this.onKeyUp=e=>{for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]||e.code.slice(3,e.code.length).toUpperCase()===n[1]){this.movementState[n[0]]=0;break}};this.copyVRGamePadValues=(e,n)=>{for(let r=2;r<4;r++){let s=e.axes[r];n===0?r===2?this.movementState.movePosX=s:this.movementState.movePosZ=s:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,r===2?this.movementState.rotPosY=s:this.moveMode==="fly"&&(this.movementState.moveNegY=s))}};this.sharedGameControlGlobals=o.sharedGameControlGlobals,e===l&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let d=this.euler0.clone(),h=d.y;if(this.objectRealQuat.copy(this.quaternion),d.y=0,this.quaternion.setFromEuler(d),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),d.set(0,h,0),this.quaternion.setFromEuler(d),this.rot.setFromEuler(d),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let g=new M(0,0,-1).applyQuaternion(this.camera.quaternion),y=new M().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(y),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ);let v;Math.abs(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 Ht().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 rn&&(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)*hie,this.speedOrbit=(r.speedRotate??100)*pie,this.mouseOrbitSensitivity=(r.speedRotate??100)*fie,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??gu.defaultData.gravity)*Yj,this.usePhysics=this.gloabalPhysics.usePhysics??gu.defaultData.usePhysics,this.jumpPower=r.jumpPower*mie,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??yf.defaultDataThirdPerson.orientWith,this.slopeThresh=rie*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*OI/this.pixelsPerMeter,this.stepThresh=r.collider.height*DI/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*OI/this.pixelsPerMeter,this.stepThresh=2*r.collider.radius*DI/this.pixelsPerMeter,this.colliderHeight=r.collider.radius*2):(this.offset=r.collider.height*OI/this.pixelsPerMeter,this.stepThresh=r.collider.height*DI/this.pixelsPerMeter,this.colliderHeight=r.collider.height),this.collider.type=r.collider.type;let p=new M().fromArray(r.collider.position.map(g=>typeof g=="number"?g:0)),f=new ke().setFromEuler(new Ht().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,Hj),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 Fe;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=jw({layers:g},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Gt(mw.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 Ht().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 rn?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={},gf.list.forEach(r=>{this.actions[r]=ln({...e,disabled:!1,type:"GameControl"},e.gameActions[r],this.page,n,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),Bn(this.actions.idle),Bn(this.actions.move),Bn(this.actions.run),Bn(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 Ki.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let n=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let r=n*60,s=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let a=xc.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*Yj),1)*(this.gravity>0?1:-1):this.velocity.y)*n,0).divideScalar(this.pixelsPerMeter),l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,II,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(Ki).add(this.collider.position).divideScalar(this.pixelsPerMeter),p=u.velocityAtPoint(h);this.groundVelocity.set(p.x,p.y,p.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=u.angvel().y*n}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*r),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let a=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let l=Ki.subVectors(this.path[1],this.position),c=xc.subVectors(this.path[1],this.path[0]);l.dot(c)<0?this.path.shift():(this.directionXZ.x=c.x,this.directionXZ.z=c.z),a.opacity=a.userData.opacity0}else a.opacity-=.05*a.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**r),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**r),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**r)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let o=iie.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let a=xc.copy(o);a.y=0,o.set(0,o.y,a.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let a=Ki;this.camera.getWorldDirection(a);let l=wm.copy(cl).multiplyScalar(a.dot(cl));a.sub(l);let c=xc.copy(this.directionXZ);c.x*=-1,this.rot.y=a.angleTo(c)*(a.cross(c).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(Em.setFromVector3(this.rot),this.moveMode==="walk"&&(Em.x=0),o.applyEuler(Em),s&&(gh.setFromUnitVectors(cl,this.groundNormal),o.applyQuaternion(gh)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let a=0;for(let l of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(l.rigidBody===void 0||l.prevQ===void 0)continue;(l.hasNonUniformScale?l.matrixWorldRigid:l.matrixWorld).decompose(BI,qj,lie);let c=this.object.getWorldPosition(cie).add(this.collider.position).sub(BI);Xj.copy(l.prevQ).invert().premultiply(qj);let u=wm.subVectors(BI,l.prevT).add(uie.copy(c).applyQuaternion(Xj).sub(c)).divideScalar(n).divideScalar(this.pixelsPerMeter),d=l.rigidBody.collider(0).castCollider(u,this.object.rigidBody.collider(0),Ki.copy(o).divideScalar(this.pixelsPerMeter),0,n,!1);u.multiplyScalar(this.pixelsPerMeter);let h=Ot.is(l)?l:l.object;if(d!==null&&this.lastHitObj!==h){let p;l instanceof Yr&&(p=l);let f=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(f)for(let m of f)m.data.target==="character"&&(m.dispatch(p),h.dispatchEvent(fT));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),Wj(a++).copy(d.normal1).applyQuaternion(l.quaternion))}if(a>0){for(let l=0;l<a;l++){let c=Wj(l),u=c.dot(o);u<0&&o.addScaledVector(c,-u)}o.add(this.pushedVelocity)}else o.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(n),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**r):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**r),this.euler.x+=this.rotVelocity.x*n,this.euler.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*n),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(cl,this.euler.y-this.euler0.y);let a=xc.copy(this.objectToCamXZ).normalize(),l=wm.copy(o).multiplyScalar(n);l.y=0;let c=l.sub(Ki.copy(a).multiplyScalar(l.dot(a))).cross(a).y;this.euler.y-=Math.atan2(c,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=ge.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=ge.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=ge.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(Em.copy(this.euler),Em.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Em)),Ks.setFromAxisAngle(oie,this.rot.x),gh.setFromAxisAngle(cl,this.rot.y),gh.multiply(Ks),Ks.setFromAxisAngle(aie,this.rot.z),gh.multiply(Ks),this.quaternion.copy(gh),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let a=xc.copy(o).multiplyScalar(n/this.pixelsPerMeter),l=null;this.didHit=!1;let c=new M;for(let h=0;h<5;h++){let p=a.length(),f=wm.copy(a).normalize();if(l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),this.colliderWorldQuat,f,this.object.rigidBody.collider(0).shape,0,p,!1,II|Vj,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 T of m.cloner.children)if(T.rigidBody===S){E=T;break}}x.dispatch(E),m.dispatchEvent(fT)}}}let g=zj.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat),y=Gj.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)),a.copy(f).multiplyScalar(p-v),Math.acos(-g.y)>this.slopeThresh){let b=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),x=wm.copy(l.witness2).applyQuaternion(this.colliderWorldQuat);x.y=0;let S=b.add(x);S.y+=this.stepThresh;let E=this.sharedGameControlGlobals.rapierWorld.castShape(S,this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,II|Vj,void 0,void 0,this.object.rigidBody);E!==null&&E.time_of_impact===0&&(g.y=0,g.normalize())}a.addScaledVector(g,-a.dot(g))}else{h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),c.add(a);break}}this.position.addScaledVector(c,this.pixelsPerMeter),Ki.copy(this.position).divideScalar(this.pixelsPerMeter),Ks.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let u=this.object.rigidBody,d=u!==void 0&&die.copy(Ki).sub(u.translation()).lengthSq()>1;u!==void 0&&(d?(u.setTranslation(Ki,!0),u.setRotation(Ks,!0)):(u.setNextKinematicTranslation(Ki),u.setNextKinematicRotation(Ks)))}else{let a=this.onObject?1:5,l=o.multiplyScalar(n/a);for(let c=0;c<a;c++)this.position.add(l),this.collisionAdjustment(n/a)}else this.position.addScaledVector(o,n);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let a=this.objectToTarget.add(this.position),l=this.targetToCamera.add(a);LI.lookAt(l,a,cl).setPosition(l),LI.decompose(this.targetPos,this.targetQuat,Ki),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=ge.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=ge.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(yie),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(gie),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Ks.setFromAxisAngle(cl,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?ge.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=ge.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):n=ge.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let r=Ki.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&r.applyQuaternion(e);let s=gh.setFromAxisAngle(r,n);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(s)}groundTiltAdjustment(e){cl.angleTo(e)*180/Math.PI<15||cl.angleTo(e)*180/Math.PI>85?Ks.identity():Ks.setFromUnitVectors(cl,e),this.groundTilt.slerp(Ks,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let n=Gj.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let r=LI.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Ki,Ks,xc).compose(Ki,Ks,Hj);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(o=>{if(o===this.object||o.isDescendantOf(this.object)||!o.bvhGeometry||!o.bvhGeometry.boundsTree)return;Lo.makeEmpty(),o.updateMatrixWorldRigid();let a=o.matrixWorldRigid,l=jj.copy(a).invert(),c=sie.copy(jj).multiply(r);Ri.copy(this.collider.segment),Ri.start.applyMatrix4(c),Ri.end.applyMatrix4(c);let u=zj.copy(this.position).applyMatrix4(l);Lo.expandByPoint(Ri.start),Lo.expandByPoint(Ri.end),Lo.min.addScalar(-this.collider.radius),Lo.max.addScalar(this.collider.radius),o.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder(d){return d.distanceToPoint(Ri.end)},intersectsBounds:d=>d.intersectsBox(Lo),intersectsTriangle:d=>{let h=Ki,p=xc,f=d.closestPointToSegment(Ri,h,p);if(f<this.collider.radius){let m=this.collider.radius-f,g=p.sub(h).normalize(),y=wm.copy(u);y.addScaledVector(g,m);let v=y.applyMatrix4(a).sub(this.position);n.add(v),Ri.start.addScaledVector(g,m),Ri.end.addScaledVector(g,m)}}})}),Lo.makeEmpty(),Ri.copy(this.collider.segment),Ri.start.applyMatrix4(r),Ri.end.applyMatrix4(r),Lo.expandByPoint(Ri.start),Lo.expandByPoint(Ri.end),Lo.min.addScalar(-this.collider.radius),Lo.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder(o){return o.distanceToPoint(Ri.end)},intersectsBounds:o=>o.intersectsBox(Lo),intersectsTriangle:o=>{let a=Ki,l=xc,c=o.closestPointToSegment(Ri,a,l);if(c<this.collider.radius){let u=this.collider.radius-c,d=l.sub(a).normalize();this.alignToGround&&this.groundTiltAdjustment(d),n.addScaledVector(d,u),Ri.start.addScaledVector(d,u),Ri.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()}},gb=mT;gb.isLocked=!1;q();xf();ih();rh();var $j,Kj=new Promise(i=>{$j=i});var FI,gT;function Zj(i){if(gT)return gT;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.77/build");typeof window<"u"&&(FI=new URL(n.endsWith("/")?n:`${n}/`,window.location.href).href);let s=import("./navmesh.js"),[o,a]=await Promise.all([s,fetch(`${n}/navmesh.wasm`).then(u=>u.arrayBuffer())]),l=o.default,c=await l({wasmBinary:a});$j(c)}return gT=t(),gT}dn();var vie=!1?typeof window<"u"?window.location.href:"":"https://cdn.spline.design/@splinetool/runtime@2.0.77/build/",bie=i=>`
9819
+ `)>=0&&(t-=s),n===3?e*.5-t*.5:n===2?e-t:0}getLineInitialOffsetY(t,e,n,r,s){let o=e*t,a=Math.abs(this.ascender-this.descender)*r,l=t-a,c=-this.ascender*r-l/2;return s===3?-(n-o-c):s===2?-(n*.5-o*.5-c):c}createPath(t,e,n,r,s){let o=t.getPath(n,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!o){console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");return}let a=new QE,l=(t.advanceWidth??1)*e;if(t)for(let c of o.commands){let u=a.currentPath?.currentPoint;if(!(u&&c.type!=="Z"&&u.x===c.x&&-u.y===c.y))switch(c.type){case"M":a.moveTo(c.x,-c.y);break;case"L":a.lineTo(c.x,-c.y);break;case"Q":a.quadraticCurveTo(c.x1,-c.y1,c.x,-c.y);break;case"C":a.bezierCurveTo(c.x1,-c.y1,c.x2,-c.y2,c.x,-c.y);break}}return a.subPaths.forEach(c=>{let u=Kre(c.curves);u!==void 0&&c.currentPoint.distanceTo(u)>0&&c.lineTo(u.x,u.y)}),{offsetX:l,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(n){return this.warnLayoutError(n),0}}computeSpaceWidthForLine(t,e,n,r){let s=this.getCharWidth(" ",n),o=t[e];if(o){let a=this.countSpaces(o.trimEnd());if(n.horizontalAlign===4&&e<t.length-1&&a){let l=typeof n.width=="string"?Number(r.getVariable(n.width)):n.width,c=this.getTextWidth(o,n);return(l-(c-a*s))/a}}return s}countSpaces(t){return(t.match(/ /g)||[]).length}};function Kre(i){if(i.length){let t=i[0];if(t instanceof _i)return t.v1;if(t instanceof Ni||t instanceof bs)return t.v0}}fw();Qt();Eo("TextGeometry",(i,t,e)=>new Pu(i,t,e));var dj={create:(i,t)=>new qf(i,t)};uv("TextGeometry",dj);uv("InputGeometry",dj);rV(eT);Mt("text");pt();var tT=200,hj=null;function pj(i){hj=i}function TI(){return hj}function fj(i){let t=!1;return i.scene.objects.forEach(e=>{e.data.type==="Page"&&!t&&e.data.publish.gameControlObject&&bo.traverseModuleInstances(i,e.id,(r,s,o)=>{for(let a of o)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(t=!0)})}),t}dn();var ub=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return Math.sqrt(e*e+n*n)},mj=(i,t)=>{let e=t.x-i.x,n=t.y-i.y;return Zre(Math.atan2(n,e))},gj=(i,t,e)=>{let n={x:0,y:0};return e=rT(e),n.x=i.x-t*Math.cos(e),n.y=i.y-t*Math.sin(e),n},rT=i=>i*(Math.PI/180),Zre=i=>i*(180/Math.PI),yj=i=>isNaN(i.buttons)?i.pressure!==0:i.buttons!==0,nT=new Map,vj=i=>{nT.has(i)&&clearTimeout(nT.get(i)),nT.set(i,setTimeout(function(){nT.delete(i),i()},100))},mm=(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)},gm=(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 iT=i=>(i.preventDefault(),i.type.match(/^touch/)?i.changedTouches:i),MI=()=>{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}},sT=(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")},oT=(i,t,e)=>{let n=xj(i);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof t=="string")n[r]=t+" "+e;else{let s="";for(let o=0,a=t.length;o<a;o+=1)s+=t[o]+" "+e+", ";n[r]=s.slice(0,-2)}return n},bj=(i,t)=>{let e=xj(i);for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t);return e},xj=i=>{let t={};return t[i]="",["webkit","Moz","o"].forEach(function(n){t[n+i.charAt(0).toUpperCase()+i.slice(1)]=""}),t},aT=(i,t)=>{for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e]);return i},Sj=(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},db=(i,t)=>{if(i.length)for(let e=0,n=i.length;e<n;e+=1)t(i[e]);else t(i)},wj=(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"&&(Ej="ontouchstart"in window,Tj=!!window.PointerEvent,Mj=!!window.MSPointerEvent);var Ej,Tj,Mj,hb={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"}},ym,pb={};Tj?ym=hb.pointer:Mj?ym=hb.MSPointer:Ej?(ym=hb.touch,pb=hb.mouse):ym=hb.mouse;function mh(){}mh.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};mh.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};mh.prototype.trigger=function(i,t){var e=this,n=i.split(/[ ,]+/g),r;e._handlers_=e._handlers_||{};for(var s=0;s<n.length;s+=1)r=n[s],e._handlers_[r]&&e._handlers_[r].length&&e._handlers_[r].forEach(function(o){o.call(e,{type:r,target:e},t)})};mh.prototype.config=function(i){var t=this;t.options=t.defaults||{},i&&(t.options=Sj(t.options,i))};mh.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.')},mm(i,ym[t],e._domHandlers_[t]),pb[t]&&mm(i,pb[t],e._domHandlers_[t]),e};mh.prototype.unbindEvt=function(i,t){var e=this;return e._domHandlers_=e._domHandlers_||{},gm(i,ym[t],e._domHandlers_[t]),pb[t]&&gm(i,pb[t],e._domHandlers_[t]),delete e._domHandlers_[t],this};var vm=mh;function vi(i,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=i,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=vi.id,vi.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}vi.prototype=new vm;vi.constructor=vi;vi.id=0;vi.prototype.buildEl=function(i){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)};vi.prototype.stylize=function(){if(this.options.dataOnly)return this;var i=this.options.fadeTime+"ms",t=bj("borderRadius","50%"),e=oT("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)"},aT(n.el,e),this.options.shape==="circle"&&aT(n.back,t),aT(n.front,t),this.applyStyles(n),this};vi.prototype.applyStyles=function(i){for(var t in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,t))for(var e in i[t])this.ui[t].style[e]=i[t][e];return this};vi.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};vi.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};vi.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null};vi.prototype.show=function(i){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof i=="function"&&i.call(this)},t.options.fadeTime)),t};vi.prototype.hide=function(i){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var e=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=e,typeof i=="function"&&i.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let e=t.options.restJoystick,n={};n.x=e===!0||e.x!==!1?0:t.instance.frontPosition.x,n.y=e===!0||e.y!==!1?0:t.instance.frontPosition.y,t.setPosition(i,n)}return t};vi.prototype.setPosition=function(i,t){var e=this;e.frontPosition={x:t.x,y:t.y};var n=e.options.fadeTime+"ms",r={};r.front=oT("transition",["top","left"],n);var s={front:{}};s.front={left:e.frontPosition.x+"px",top:e.frontPosition.y+"px"},e.applyStyles(r),e.applyStyles(s),e.restTimeout=setTimeout(function(){typeof i=="function"&&i.call(e),e.restCallback()},e.options.fadeTime)};vi.prototype.restCallback=function(){var i=this,t={};t.front=oT("transition","none",""),i.applyStyles(t),i.trigger("rested",i.instance)};vi.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};vi.prototype.computeDirection=function(i){var t=i.angle.radian,e=Math.PI/4,n=Math.PI/2,r,s,o;if(t>e&&t<e*3&&!i.lockX?r="up":t>-e&&t<=e&&!i.lockY?r="left":t>-e*3&&t<=-e&&!i.lockX?r="down":i.lockY||(r="right"),i.lockY||(t>-n&&t<n?s="left":s="right"),i.lockX||(t>0?o="up":o="down"),i.force>this.options.threshold){var a={},l;for(l in this.direction)Object.prototype.hasOwnProperty.call(this.direction,l)&&(a[l]=this.direction[l]);var c={};this.direction={x:s,y:o,angle:r},i.direction=this.direction;for(l in a)a[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return i;(!c.x||!c.y)&&this.trigger("plain",i),c.x||this.trigger("plain:"+s,i),c.y||this.trigger("plain:"+o,i),c.angle||this.trigger("dir dir:"+r,i)}else this.resetDirection();return i};var _j=vi;function Kr(i,t){var e=this;e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.pressureIntervals={},e.manager=i,e.id=Kr.id,Kr.id+=1,e.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},e.config(t),(e.options.mode==="static"||e.options.mode==="semi")&&(e.options.multitouch=!1),e.options.multitouch||(e.options.maxNumberOfNipples=1);let n=getComputedStyle(e.options.zone.parentElement);return n&&n.display==="flex"&&(e.parentIsFlex=!0),e.updateBox(),e.prepareNipples(),e.bindings(),e.begin(),e.nipples}Kr.prototype=new vm;Kr.constructor=Kr;Kr.id=0;Kr.prototype.prepareNipples=function(){var i=this,t=i.nipples;t.on=i.on.bind(i),t.off=i.off.bind(i),t.options=i.options,t.destroy=i.destroy.bind(i),t.ids=i.ids,t.id=i.id,t.processOnMove=i.processOnMove.bind(i),t.processOnEnd=i.processOnEnd.bind(i),t.get=function(e){if(e===void 0)return t[0];for(var n=0,r=t.length;n<r;n+=1)if(t[n].identifier===e)return t[n];return!1}};Kr.prototype.bindings=function(){var i=this;i.bindEvt(i.options.zone,"start"),i.options.zone.style.touchAction="none",i.options.zone.style.msTouchAction="none"};Kr.prototype.begin=function(){var i=this,t=i.options;if(t.mode==="static"){var e=i.createNipple(t.position,i.manager.getIdentifier());e.add(),i.idles.push(e)}};Kr.prototype.createNipple=function(i,t){var e=this,n=e.manager.scroll,r={},s=e.options,o={x:e.parentIsFlex?n.x:n.x+e.box.left,y:e.parentIsFlex?n.y:n.y+e.box.top};if(i.x&&i.y)r={x:i.x-o.x,y:i.y-o.y};else if(i.top||i.right||i.bottom||i.left){var a=document.createElement("DIV");a.style.display="hidden",a.style.top=i.top,a.style.right=i.right,a.style.bottom=i.bottom,a.style.left=i.left,a.style.position="absolute",s.zone.appendChild(a);var l=a.getBoundingClientRect();s.zone.removeChild(a),r=i,i={x:l.left+n.x,y:l.top+n.y}}var c=new _j(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||(sT(c.ui.el,r),sT(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=iT(i),t.updateBox();var r=function(s){t.actives.length<e.maxNumberOfNipples?t.processOnStart(s):n.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(o){if(Object.values(n.touches).findIndex(function(l){return l.identifier===o})<0){var a=[i[0]];a.identifier=o,t.processOnEnd(a)}}),t.actives.length<e.maxNumberOfNipples&&t.processOnStart(s))};return db(i,r),t.manager.bindDocument(),!1};Kr.prototype.processOnStart=function(i){var t=this,e=t.options,n,r=t.manager.getIdentifier(i),s=i.force||i.pressure||i.webkitForce||0,o={x:i.pageX,y:i.pageY},a=t.getOrCreate(r,o);a.identifier!==r&&t.manager.removeIdentifier(a.identifier),a.identifier=r;var l=function(u){u.trigger("start",u),t.trigger("start "+u.id+":start",u),u.show(),s>0&&t.pressureFn(i,u,u.identifier),t.processOnMove(i)};if((n=t.idles.indexOf(a))>=0&&t.idles.splice(n,1),t.actives.push(a),t.ids.push(a.identifier),e.mode!=="semi")l(a);else{var c=ub(o,a.position);if(c<=e.catchDistance)l(a);else{a.destroy(),t.processOnStart(i);return}}return a};Kr.prototype.getOrCreate=function(i,t){var e=this,n=e.options,r;return/(semi|static)/.test(n.mode)?(r=e.idles[0],r?(e.idles.splice(0,1),r):n.mode==="semi"?e.createNipple(t,i):(console.warn("Coudln't find the needed nipple."),!1)):(r=e.createNipple(t,i),r)};Kr.prototype.processOnMove=function(i){var t=this,e=t.options,n=t.manager.getIdentifier(i),r=t.nipples.get(n),s=t.manager.scroll;if(!yj(i)){this.processOnEnd(i);return}if(!r){console.error("Found zombie joystick with ID "+n),t.manager.removeIdentifier(n);return}if(e.dynamicPage){var o=r.el.getBoundingClientRect();r.position={x:s.x+o.left,y:s.y+o.top}}r.identifier=n;var a=r.options.size/2,l={x:i.pageX,y:i.pageY};e.lockX&&(l.y=r.position.y),e.lockY&&(l.x=r.position.x);var c=ub(l,r.position),u=mj(l,r.position),d=rT(u),h=c/a,p={distance:c,position:l},f,m;if(r.options.shape==="circle"?(f=Math.min(c,a),m=gj(r.position,f,u)):(m=wj(l,r.position,a),f=ub(m,r.position)),e.follow){if(c>a){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=ub(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||sT(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/a,y:-y/a},raw:p,instance:r,lockX:e.lockX,lockY:e.lockY};v=r.computeDirection(v),v.angle={radian:rT(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 Aj=Kr;function oi(i){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=MI(),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(){vj(e)},t._onScroll=function(){t.scroll=MI()},t.collections}oi.prototype=new vm;oi.constructor=oi;oi.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}};oi.prototype.create=function(i){return this.createCollection(i)};oi.prototype.bindWindowEvents=function(){var i=this;i._windowBound||typeof window>"u"||(i._windowBound=!0,mm(window,"resize",i._onResize),mm(window,"scroll",i._onScroll))};oi.prototype.unbindWindowEvents=function(){var i=this;!i._windowBound||typeof window>"u"||(i._windowBound=!1,gm(window,"resize",i._onResize),gm(window,"scroll",i._onScroll))};oi.prototype.createCollection=function(i){var t=this,e=new Aj(t,i);return t.bindCollection(e),t.collections.push(e),t.bindWindowEvents(),e};oi.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)};oi.prototype.bindDocument=function(){var i=this;i.binded||(i.bindEvt(document,"move").bindEvt(document,"end"),i.binded=!0)};oi.prototype.unbindDocument=function(i){var t=this;(!Object.keys(t.ids).length||i===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};oi.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]};oi.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};oi.prototype.onmove=function(i){var t=this;return t.onAny("move",i),!1};oi.prototype.onend=function(i){var t=this;return t.onAny("end",i),!1};oi.prototype.oncancel=function(i){var t=this;return t.onAny("end",i),!1};oi.prototype.onAny=function(i,t){var e=this,n,r="processOn"+i.charAt(0).toUpperCase()+i.slice(1);t=iT(t);var s=function(a,l,c){c.ids.indexOf(l)>=0&&(c[r](a),a._found_=!0)},o=function(a){n=e.getIdentifier(a),db(e.collections,s.bind(null,a,n)),a._found_||e.removeIdentifier(n)};return db(t,o),!1};oi.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()};oi.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 Cj=oi;var bm=null;function Pj(){return bm||(bm=new Cj),bm}var Qre={create:function(i){return Pj().create(i)},destroy:function(){bm&&(bm.destroy(),bm=null)},get factory(){return Pj()}},Rj=Qre;dn();pt();q();Xs();Yi();pt();var Ij=null;function Oj(i){Ij=i}function cT(){return Ij}var Dj,Lj=new Promise(i=>{Dj=i});var uT;function Nj(i){if(uT)return uT;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.78/build"),s=import("./physics.js"),[o,a]=await Promise.all([s,fetch(`${n}/physics.wasm`).then(l=>l.arrayBuffer())]);await o.init(a),Dj(o)}return uT=t(),uT}fr();Yi();Qt();ME();q();q();rh();function _I(i){let t=i.elements,e=t[0]**2+t[1]**2+t[2]**2,n=t[4]**2+t[5]**2+t[6]**2,r=t[8]**2+t[9]**2+t[10]**2,s=t[0]**2+t[4]**2+t[8]**2,o=t[1]**2+t[5]**2+t[9]**2,a=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return e<l||n<l||r<l||s<l||o<l||a<l}function ya(i,t){let e=new Me;if(t&&_I(t))return e.setAttribute("position",new Be([],3)),e.setIndex([]),e;if(!i.getAttribute("position"))return e.setAttribute("position",new Be([],3)),e.setIndex([]),e;let{positions:n,triIndices:r}=Bv(i.getAttribute("position"),i.getIndex());return e.setAttribute("position",new Be(n,3)),e.setIndex(r),t&&e.applyMatrix4(t),e}xf();var dT=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.initialDisabled=!1;this.actions=ln(e,e.actions,r,s,o,n),this.target=e.target}disconnect(){Bn(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{"runMode"in e.data&&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 fb=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.page=r;this.currentIntersectedObjects=[];this.actions=ln(e,e.actions,r,s,o,n),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let l=r.scene.find(a);l&&this.triggeringObjects.push(l)}}isValidTriggeringObject(t){return this.target==="all"?!0:this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){Bn(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};fr();var cn;Lj.then(i=>cn=i);var ai=new M,Do=new ke,Lu=new M,CUe=new Ht(0,0,0,"YXZ"),Bj=new Ht(0,0,0,"XYZ"),va=new M,AI=new M,CI=new M(1,1,1),xm=new ke,hT=new te,Fj=new te,Jre={type:"updateMatrix"},Uj=new ke,PI=new nr,eie=.5,tie=.7,RI=.01,fT={type:"beginEvent",eventName:"Collision"},nie={type:"beginEvent",eventName:"Trigger"};function kj(i){if(bo.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 mb=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 Sm(i){return tk(Wa(i)?i.object:i)}var pT=class{constructor(t){this.eventContext=t;this.isEnabled=!1;this.gameControl=null;this.joysticks=[];this.joystickToGameControls=[];this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}};this.sensorToTriggerEvent={};this.eventManager=void 0;this.needsCollisionDetection=!1;this.initializationCounter=-1;this.fixedBodiesToWatch=[];this.rigidBodyToMesh=new Map;this.nActiveRigidBodies=0;this.collisionEvents=[];this.isExport=!1;this.skipRender=!0;this._staticBVHAttrIds=new WeakMap;this._staticBVHNextAttrId=1;this.processRigidBody=t=>{if(t.bodyType()!==cn.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,n,r]=this.rigidBodyToMesh.get(t.handle);if(ai.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),Do.copy(t.rotation()),e.matrixWorld.compose(ai,Do,n),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(Jre),r){let s=e.cloner;if(s&&s.objectForSample===void 0){s.matrixWorld.copy(e.matrixWorld);for(let o of s.children)o.updateMatrixWorld(!0)}for(let o of e.children)o.updateMatrixWorld(!0)}};this.accumulator=0;this.handleCollisionEvents=(t,e,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[t]?(r=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(t)),r&&s&&r.isValidTriggeringObject(s)){r.dispatch();return}for(let o=this.sharedGameControlGlobals.createdObjects.length-1;o>=0;o--){let a=this.sharedGameControlGlobals.createdObjects[o];if(a.userData.hasCollisionDestroy&&(a.rigidBody?.collider(0).handle===t||a.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(o,1),a.removeFromParent();let l=a.rigidBody;requestAnimationFrame(()=>{a.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),a.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let o=this.sharedGameControlGlobals.colliderToEntity.get(e),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a===void 0)return;for(let l of a)l.data.target==="character"&&this.dispatchCollisionEvent(l,o,e)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let o=this.sharedGameControlGlobals.colliderToEntity.get(t),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a===void 0)return;for(let l of a)l.data.target==="character"&&this.dispatchCollisionEvent(l,o,t)}else{let o=this.sharedGameControlGlobals.colliderToEntity.get(t),a=this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid];if(a!==void 0)for(let u of a)u.data.target==="scene"&&this.dispatchCollisionEvent(u,o,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(e),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let u of c)u.data.target==="scene"&&this.dispatchCollisionEvent(u,l,e)}};this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=tT,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events){if(n.data.disabled===!0)continue;let r=n.data.actions?.find(s=>s.data.type==="Destroy")?.data;if(r)for(let s of r.objects){let o=this.page.scene.find(s);o&&(o.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let n of e.events)if(!(n.data.disabled===!0||n.data.type!=="DragDrop"))for(let r of n.data.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(cT()===null){Jn("collision-bvh","trigger/collision detection");return}let t=[],e=[];if(this.page.traverseChildren(n=>{let r,s=n instanceof il,o=bu(n);if(ic(n)||s||o)return;Wa(n)?r=n.object:r=n;let a=r.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let l=n.geometry,c=r.userData.hasDestroy===!0,u=r.userData.hasDrag===!0;if(mb(a)||c||u||r.dataPatched.events.some(d=>d.data.disabled!==!0&&(d.data.type==="GameControl"||d.data.type==="Follow")))return n.updateMatrixWorldRigid(),this.addBoundsTree(n),!0;if(l){let d=l.getAttribute("position");if(d!==void 0&&d.count>0){t.push({geometry:l,matrixWorld:n.matrixWorld}),e.push(l.id,this._staticBVHIdOf(d),d.version,l.index!==null?this._staticBVHIdOf(l.index):-1,l.index!==null?l.index.version:-1);for(let h of n.matrixWorld.elements)e.push(h)}}if(Sm(n))return!0}),t.length>0){let n=this._staticBVHCache;if(n!==void 0&&n.signature.length===e.length&&n.signature.every((a,l)=>a===e[l])){this.sharedGameControlGlobals.staticMeshBVH=n.bvh;return}let r=t.map(a=>ya(a.geometry,a.matrixWorld)),s=oa(r,!1),o=new(cT())(s);this._staticBVHCache={signature:e,bvh:o},this.sharedGameControlGlobals.staticMeshBVH=o}}addRigidBody(t,e,n){if(_I(t.matrixWorld))return;let r=[],s="geometry"in t?t.geometry:void 0,o=e.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(ya(s,t.shearScale)),o.physics.fusedBody){let a=this.gatherChildrenGeom(t,r);t.traverseObject(a),t.children.forEach(c=>c.updateMatrixWorld(!0));let l=t.cloner;l&&l.objectForSample===void 0&&o.physics.rigidBody==="dynamic"&&(l.traverseObject(a),l.children.forEach(c=>c.updateMatrixWorld(!0)))}if(r.length>0){let a,l=!1,c=!n.fromCreate&&o.physics.rigidBody==="dynamic"||n.fromCreate&&n.dynamic;c?(a=cn.RigidBodyDesc.dynamic(),a.setLinearDamping(o.physics.damping).setAngularDamping(o.physics.damping).setAdditionalMass(1e-9).setGravityScale(o.physics.gravityScale).enabledRotations(...o.physics.enabledRotation).enabledTranslations(...o.physics.enabledTranslation)):(n.hasTransformAnim||n.hasFollow||n.hasDrag)&&!n.fromCreate?(a=cn.RigidBodyDesc.kinematicPositionBased(),l=!0):a=cn.RigidBodyDesc.fixed();let u=oa(r);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(ai,Do,Lu),t.position0=ai.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Do.clone(),ai.divideScalar(this.pixelsPerMeter),a.setTranslation(ai.x,ai.y,ai.z).setRotation(Do),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(a),h=!(o.geometry===void 0||o.geometry.type==="SubdivGeometry"||o.geometry.type==="NonParametricGeometry"||o.geometry.type==="BooleanGeometry"||o.geometry.type==="VectorGeometry"||o.geometry.type==="StarGeometry"||o.geometry.type==="RectangleGeometry"||o.geometry.type==="EllipseGeometry"||o.geometry.type==="TriangleGeometry"||o.geometry.type==="TorusGeometry"||o.geometry.type==="HelixGeometry");try{this.addCollider(d,o.physics,u,e,h)}catch{try{this.addCollider(d,o.physics,u,e,!1)}catch(p){console.error(p)}}if(d.numColliders()===0){this.sharedGameControlGlobals.rapierWorld.removeRigidBody(d);return}c?this.rigidBodyToMesh.set(d.handle,[t,Lu.clone(),o.physics.fusedBody]):l?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(d.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,d,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=d}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(ya(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(n=>n.updateMatrixWorld(!0)),e.length>0){let n=oa(e,!1);t.bvhGeometry=n,n.getAttribute("position").count>0?(t.bvhGeometry.boundsTree=new(cT())(n),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):!1&&console.warn(`ControlsManager.addBoundsTree: object "${t.name}" has empty geometry`)}}addCollider(t,e,n,r,s=!0){if(n?.getAttribute("position").count===0||n?.getIndex()?.count===0)return;let o;n&&(e.colliderType==="trimesh"?o=cn.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array):o=cn.ColliderDesc.convexMesh(n.getAttribute("position").array,s?n.getIndex().array:void 0)),o.setFrictionCombineRule(cn.CoefficientCombineRule.Average).setRestitutionCombineRule(cn.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(l=>l.target==="scene")&&a.setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let n=Sm(t);return(r,s)=>{if(s===0)return;if(n&&r.parent===t)return!0;let o;if(ic(r))if(r.objectForSample){if(r.objectForSample.dataPatched.physics.fusedBody)return;o=r.object}else return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Wa(r))o=r.object;else if(o=r,o.dataPatched.cloner?.hideBase)return!0;let a=o.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;s===1?t.hasNonUniformScale?r.matrixWorld.multiplyMatrices(t.shearScale,r.hiddenMatrix):r.matrixWorld.copy(r.hiddenMatrix):r.matrixWorld.multiplyMatrices(r.parent.matrixWorld,r.hiddenMatrix),r.matrixWorld.multiply(r.matrix);let l=r.geometry;if(l?.getAttribute("position")!==void 0&&e.push(ya(l,r.matrixWorld)),Sm(r))return!0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,n=!1;this.page.traverseEntity(a=>{for(let l of a.dataPatched.events)if(l.data.disabled===!1&&l.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let r=TI();if(r!==null?n=r.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||n:this.page.data.publish.gameControlObject!==null&&Jn("game-controls","the scene's game controls"),n===!1){let{enableRotate:a,enablePan:l,enableZoom:c,autoRotate:u,hoverRotatePanMode:d}=this.eventManager.publish.orbitControls;(a||l||c||u||d!==0)&&(this.orbitControls=new im(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let s=this.renderer.domElement.width/this.renderer.getPixelRatio(),o=this.renderer.domElement.height/this.renderer.getPixelRatio();TI()?.createJoysticks(this,s,o),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new cn.World(new cn.Vector3(0,this.gravity,0)),this.events=new cn.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let l;if(ic(a))if(a.objectForSample){if(a.objectForSample.dataPatched.physics.fusedBody)return;l=a.object}else return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(Wa(a))l=a.object;else{if(bu(a)||la(a)||a instanceof il)return;if(l=a,l.dataPatched.cloner?.disabled===!1&&l.dataPatched.cloner?.hideBase&&l.dataPatched.physics?.fusedBody!==!0)return!0}let c=l.dataPatched,u;for(let y of c.events)y.data.disabled!==!0&&y.data.type==="GameControl"&&(u=y.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let d=mb(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 dT(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;a.traverseVisible(b=>{b.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let g=a.geometry;if(u!==void 0){let y=cn.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(ai,Do,Lu),a.position0=ai.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Do.clone(),ai.divideScalar(this.pixelsPerMeter),y.setTranslation(ai.x,ai.y,ai.z).setRotation(Do);let v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(y);a.rigidBody=v;let b;u.collider.type==="sphere"?b=cn.ColliderDesc.ball(u.collider.radius/this.pixelsPerMeter):u.collider.type==="capsule"?b=cn.ColliderDesc.capsule((u.collider.height/2-u.collider.radius)/this.pixelsPerMeter,u.collider.radius/this.pixelsPerMeter):b=cn.ColliderDesc.cuboid(u.collider.width/this.pixelsPerMeter/2,u.collider.height/this.pixelsPerMeter/2,u.collider.depth/this.pixelsPerMeter/2),b.setFrictionCombineRule(cn.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(cn.CoefficientCombineRule.Min);let x=this.sharedGameControlGlobals.rapierWorld.createCollider(b,v);this.sharedGameControlGlobals.colliderToEntity.set(x.handle,l),ai.fromArray(u.collider.position.map(E=>typeof E=="number"?E:0)).multiply(Lu.setFromMatrixScale(l.matrixWorld)).divideScalar(this.pixelsPerMeter),x.setTranslationWrtParent(ai);let S=new ke().setFromEuler(new Ht().setFromVector3(new M().fromArray(u.collider.rotation.map(E=>typeof E=="number"?E:0))));x.setRotationWrtParent(S),x.setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(l,!0)}else c.physics.rigidBody==="dynamic"||d||m||p||f||h?(this.addRigidBody(a,l,{hasFollow:m,hasTransformAnim:d,hasDrag:f}),this.generateSensorColliderDescs(l,c.physics.fusedBody)):(g&&t.push(ya(g,a.matrixWorld)),c.physics.fusedBody&&!Sm(a)&&a.traverseObject((y,v)=>{if(v===0)return;let b;if(ic(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(bu(y)||la(y)||y instanceof il)return;if(Wa(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(ya(S,y.matrixWorld)),Sm(y))return!0}),this.generateSensorColliderDescs(l,c.physics.fusedBody,e));if(c.physics?.fusedBody===!0||u||Sm(a))return!0}),t.length===0)return;let n=oa(t),r=n.getIndex().count>0;if(!r&&e.length===0)return;n.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let s=cn.RigidBodyDesc.fixed(),o=this.sharedGameControlGlobals.rapierWorld.createRigidBody(s);if(r){let a=cn.ColliderDesc.trimesh(n.getAttribute("position").array,n.getIndex().array).setFrictionCombineRule(cn.CoefficientCombineRule.Multiply).setRestitutionCombineRule(cn.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,o)}for(let[a,l]of e){let c=this.sharedGameControlGlobals.rapierWorld.createCollider(a,o);this.sensorToTriggerEvent[c.handle]=l}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let n=new fb(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),r=new te().compose(va.fromArray(e.data.position.map(s=>typeof s=="number"?s:0)),xm.setFromEuler(Bj.fromArray(e.data.rotation.map(s=>typeof s=="number"?s:0))),CI);if(e.data.triggerZone==="box"){let s=new Nt;s.min.fromArray(e.data.size.map(o=>typeof o=="number"?o:0)).multiplyScalar(-.5),s.max.fromArray(e.data.size.map(o=>typeof o=="number"?o:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([s,r,t,n])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,r,t,n])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(!!this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let n=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let r=t/1e3;r<n&&r>n*.55&&(r=n),this.accumulator+=r;let s=performance.now(),o=0,a=6;for(;this.accumulator>=n&&o<a&&(e=this.stepPhysics()&&e,this.accumulator-=n,o++,!(performance.now()-s>n*1e3)););this.accumulator=this.accumulator%n}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(ai,Do,Lu);let e=t;e.prevQ===void 0?(e.prevQ=Do.clone(),e.prevT=ai.clone()):(e.prevQ.copy(Do),e.prevT.copy(ai))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,n,r]=this.fixedBodiesToWatch[t];if(e.rigidBody!==n){this.fixedBodiesToWatch.splice(t,1);continue}(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(r)||(n.setBodyType(cn.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(n.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,n=t.linvel(),r=t.translation(),s=Math.hypot(n.x,n.z);for(let o=0;o<t.numColliders();o++){let a=t.collider(o);e.contactPairsWith(a,l=>{let c=l.parent();if(c===null||!c.isDynamic())return;let u=c.translation(),d=-1/0,h=0,p=0;if(e.contactPair(a,l,v=>{let b=v.normal(),S=b.x*(u.x-r.x)+b.y*(u.y-r.y)+b.z*(u.z-r.z)<0?-1:1;if(Math.abs(b.y)>tie)return;let E=S*b.x,T=S*b.z,w=Math.hypot(E,T);if(w<1e-4)return;let _=(n.x*E+n.z*T)/w;_>d&&(d=_,h=E/w,p=T/w)}),d===-1/0)return;let f=n.x*h+n.z*p;if(f<-RI)return;let m=c.linvel();if(s>RI&&f>RI){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-eie);c.setLinvel({x:m.x-h*y,y:m.y,z:m.z-p*y},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let t=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[n,r]of t){if(r.rigidBody===void 0){t.delete(n);continue}this.recordPhysicsPose(r),r.rigidBody.setNextKinematicTranslation(ai.divideScalar(this.pixelsPerMeter)),r.rigidBody.setNextKinematicRotation(Do)}for(let n of this.sharedGameControlGlobals.entitiesWithTransformAnim)n.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(n);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,n){let r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(n))._parent,s;if(e.cloner){for(let o of e.cloner.children)if(o.rigidBody===r){s=o;break}}t.dispatch(s),e.dispatchEvent(fT)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,n){let r=Fj.copy(t.matrixWorld).invert();t.traverseEntity((s,o)=>{if(e===!1&&o===1)return!0;for(let a of s.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let l=new fb(a.id,a.data,s,this.page,this.sharedAssets,this.eventManager),c;if(a.data.triggerZone==="box"?c=cn.ColliderDesc.cuboid(...a.data.size.map(u=>(typeof u=="number"?u:1)/(2*this.pixelsPerMeter))):c=cn.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),c.setDensity(0).setSensor(!0).setActiveEvents(cn.ActiveEvents.COLLISION_EVENTS),va.fromArray(a.data.position.map(u=>typeof u=="number"?u:0)),xm.setFromEuler(Bj.fromArray(a.data.rotation.map(u=>typeof u=="number"?u:0))),hT.compose(va,xm,CI).premultiply(s.matrixWorld),n?(hT.decompose(va,xm,AI),c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_FIXED|cn.ActiveCollisionTypes.DYNAMIC_FIXED)):(hT.premultiply(r).decompose(va,xm,AI),t.rigidBody.bodyType()===cn.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===cn.RigidBodyType.Fixed?c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_FIXED|cn.ActiveCollisionTypes.DYNAMIC_FIXED):c.setActiveCollisionTypes(cn.ActiveCollisionTypes.KINEMATIC_KINEMATIC|cn.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),va.divideScalar(this.pixelsPerMeter),c.setTranslation(va.x,va.y,va.z),c.setRotation(xm),n)n.push([c,l]);else{let u=this.sharedGameControlGlobals.rapierWorld.createCollider(c,t.rigidBody);this.sensorToTriggerEvent[u.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[n,r,s,o]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let l=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(s===l||o.isValidTriggeringObject(Ot.is(l)?l:l.object)===!1)continue;let c=Fj.copy(s.matrixWorld).decompose(va,Uj,AI).compose(va,Uj,CI).multiply(r),u=hT.copy(l.matrixWorld).invert().multiply(c),d=l.bvhGeometry.boundsTree;n instanceof Nt?t=d.intersectsBox(n,u):(PI.radius=n,PI.center.setFromMatrixPosition(u),t=d.intersectsSphere(PI)),t?o.currentIntersectedObjects.indexOf(l)===-1&&(o.currentIntersectedObjects.push(l),o.dispatch(),s.dispatchEvent(nie)):o.currentIntersectedObjects=o.currentIntersectedObjects.filter(h=>h!==l)}}}};ih();q();Ev();an();dc();var Vj=4,II=8;var OI=.02,DI=.3,rie=65,zj=new M,Gj=new M,iie=new M,Ki=new M,xc=new M,wm=new M,LI=new te,jj=new te,sie=new te,Ks=new ke,gh=new ke,Em=new Ht(0,0,0,"YXZ"),oie=new M(1,0,0),cl=new M(0,1,0),aie=new M(0,0,1),Hj=new M(1,1,1),NI=[],Wj=i=>NI[i]??(NI[i]=new M),BI=new M,lie=new M,cie=new M,uie=new M,qj=new ke,die=new M,Xj=new ke,hie=1,pie=.025,fie=16e-6,Yj=12,mie=20,Ri=new ri,Lo=new Nt,gie={type:"requestRender"},yie={type:"updateMatrix"},mT=class extends Mn{constructor(e,n,r,s,o,a,l,c,u){super();this.object=e;this.domElement=n;this.data=r;this.gloabalPhysics=s;this.controlsManager=o;this.cameraFollow=a;this.camera=l;this.page=c;this.sharedAssets=u;this.enableDamping=!0;this.hiddenMatrix0=new te;this.target0=new M;this.zoom0=1;this.rotForce=1;this.moveForce=1;this.pixelsPerMeter=tT;this.euler0=new Ht(0,0,0,"YXZ");this.position0Cam=new M;this.quat0Cam=new ke;this.scale0Cam=new M;this.hiddenMatrix0Cam=new te;this.threshEndTranslate=.01;this.threshEndRotate=1e-8;this.threshEndRotVel=.005;this.collider={type:"capsule",radius:40,segment:new ri(new M(0,-40,0),new M(0,40,0)),matrix:new te,position:new M,rotation:new ke};this.euler=new Ht(0,0,0,"YXZ");this.eulerDelta=new M;this.lastPosition=new M;this.lastCameraQuaternion=new ke;this.lastCameraPosition=new M;this.PI_2=Math.PI/2;this.prevMouse=new G;this.velocityTarget=new M;this.velocity=new M;this.directionXZ=new M;this.rotVelocityStick=new M;this.rotVelocityTarget=new M;this.rotVelocity=new M;this.rotDirection=new M;this.nonColliderRotOffset=new te;this.nonColliderPosOffset=new te;this.firstPointerId=-1;this.rot=new M;this.path=[];this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0};this.onObject=!1;this.actionState={};this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]];this.collisionEnabled=!0;this.offsetMatrix=new te;this.objectToTarget=new M;this.objectToTarget0=new M;this.objectToCamXZ=new M;this.objectToCamXZ0=new M;this.targetToCamera=new M;this.targetToCamera0=new M;this.cameraPolarAxis0=new M;this.targetPos=new M;this.targetQuat=new ke;this.lerpFactorPos=new M().setScalar(.3);this.lerpFactorPosStart=.3;this.lerpFactorPosEnd=.3;this.lerpFactorRotStart=.3;this.lerpFactorRotEnd=.3;this.lerpFactorPosCamera=.3;this.lerpFactorRotCamera=.3;this.objXZQuat=new ke;this.objXZQuatInv=new ke;this.objXZRotMat=new te;this.isFirstPerson=!1;this.didHit=!1;this.groundVelocity=new M;this.pushedVelocity=new M;this.groundYRotation=0;this.objectRealQuat=new ke;this.colliderWorldQuat=new ke;this.groundNormal=new M;this.groundTilt=new ke;this.groundTiltInv=new ke;this.lastHitObj=null;this.isFirstFrame=!0;this.rotationAccumWhenOrientWithCamera=0;this.navMeshPathDest=null;this.position=new M;this.quaternion=new ke;this.scale=new M;this.initialAction=!0;this.onPointerDown=e=>{!(e.target===this.domElement||e.target instanceof HTMLElement&&e.target.tagName==="SPLINE-VIEWER"&&e.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!mi&&!CC&&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"&&(CC&&C3<15.5&&!mi?(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?mT.isLocked=!0:mT.isLocked=!1};this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")};this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0};this.onKeyDown=e=>{!(e.target instanceof HTMLInputElement)&&(e.code==="ArrowLeft"||e.code==="ArrowUp"||e.code==="ArrowRight"||e.code==="ArrowDown"||e.code==="Space")&&e.preventDefault();for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]){this.movementState[n[0]]=1;break}this.controlsManager.requestRender()};this.onKeyUp=e=>{for(let n of this.keyAssignments)if(e.key.toUpperCase()===n[1]||e.key===n[1]||e.code.slice(3,e.code.length).toUpperCase()===n[1]){this.movementState[n[0]]=0;break}};this.copyVRGamePadValues=(e,n)=>{for(let r=2;r<4;r++){let s=e.axes[r];n===0?r===2?this.movementState.movePosX=s:this.movementState.movePosZ=s:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,r===2?this.movementState.rotPosY=s:this.moveMode==="fly"&&(this.movementState.moveNegY=s))}};this.sharedGameControlGlobals=o.sharedGameControlGlobals,e===l&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let d=this.euler0.clone(),h=d.y;if(this.objectRealQuat.copy(this.quaternion),d.y=0,this.quaternion.setFromEuler(d),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),d.set(0,h,0),this.quaternion.setFromEuler(d),this.rot.setFromEuler(d),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let g=new M(0,0,-1).applyQuaternion(this.camera.quaternion),y=new M().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(y),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ);let v;Math.abs(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 Ht().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 rn&&(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)*hie,this.speedOrbit=(r.speedRotate??100)*pie,this.mouseOrbitSensitivity=(r.speedRotate??100)*fie,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??gu.defaultData.gravity)*Yj,this.usePhysics=this.gloabalPhysics.usePhysics??gu.defaultData.usePhysics,this.jumpPower=r.jumpPower*mie,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??yf.defaultDataThirdPerson.orientWith,this.slopeThresh=rie*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*OI/this.pixelsPerMeter,this.stepThresh=r.collider.height*DI/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*OI/this.pixelsPerMeter,this.stepThresh=2*r.collider.radius*DI/this.pixelsPerMeter,this.colliderHeight=r.collider.radius*2):(this.offset=r.collider.height*OI/this.pixelsPerMeter,this.stepThresh=r.collider.height*DI/this.pixelsPerMeter,this.colliderHeight=r.collider.height),this.collider.type=r.collider.type;let p=new M().fromArray(r.collider.position.map(g=>typeof g=="number"?g:0)),f=new ke().setFromEuler(new Ht().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,Hj),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 Fe;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=jw({layers:g},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Gt(mw.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 Ht().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 rn?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={},gf.list.forEach(r=>{this.actions[r]=ln({...e,disabled:!1,type:"GameControl"},e.gameActions[r],this.page,n,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),Bn(this.actions.idle),Bn(this.actions.move),Bn(this.actions.run),Bn(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 Ki.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let n=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let r=n*60,s=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let a=xc.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*Yj),1)*(this.gravity>0?1:-1):this.velocity.y)*n,0).divideScalar(this.pixelsPerMeter),l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,II,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(Ki).add(this.collider.position).divideScalar(this.pixelsPerMeter),p=u.velocityAtPoint(h);this.groundVelocity.set(p.x,p.y,p.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=u.angvel().y*n}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*r),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let a=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let l=Ki.subVectors(this.path[1],this.position),c=xc.subVectors(this.path[1],this.path[0]);l.dot(c)<0?this.path.shift():(this.directionXZ.x=c.x,this.directionXZ.z=c.z),a.opacity=a.userData.opacity0}else a.opacity-=.05*a.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**r),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**r),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**r)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let o=iie.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let a=xc.copy(o);a.y=0,o.set(0,o.y,a.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let a=Ki;this.camera.getWorldDirection(a);let l=wm.copy(cl).multiplyScalar(a.dot(cl));a.sub(l);let c=xc.copy(this.directionXZ);c.x*=-1,this.rot.y=a.angleTo(c)*(a.cross(c).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(Em.setFromVector3(this.rot),this.moveMode==="walk"&&(Em.x=0),o.applyEuler(Em),s&&(gh.setFromUnitVectors(cl,this.groundNormal),o.applyQuaternion(gh)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let a=0;for(let l of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(l.rigidBody===void 0||l.prevQ===void 0)continue;(l.hasNonUniformScale?l.matrixWorldRigid:l.matrixWorld).decompose(BI,qj,lie);let c=this.object.getWorldPosition(cie).add(this.collider.position).sub(BI);Xj.copy(l.prevQ).invert().premultiply(qj);let u=wm.subVectors(BI,l.prevT).add(uie.copy(c).applyQuaternion(Xj).sub(c)).divideScalar(n).divideScalar(this.pixelsPerMeter),d=l.rigidBody.collider(0).castCollider(u,this.object.rigidBody.collider(0),Ki.copy(o).divideScalar(this.pixelsPerMeter),0,n,!1);u.multiplyScalar(this.pixelsPerMeter);let h=Ot.is(l)?l:l.object;if(d!==null&&this.lastHitObj!==h){let p;l instanceof Yr&&(p=l);let f=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(f)for(let m of f)m.data.target==="character"&&(m.dispatch(p),h.dispatchEvent(fT));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),Wj(a++).copy(d.normal1).applyQuaternion(l.quaternion))}if(a>0){for(let l=0;l<a;l++){let c=Wj(l),u=c.dot(o);u<0&&o.addScaledVector(c,-u)}o.add(this.pushedVelocity)}else o.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(n),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**r):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**r),this.euler.x+=this.rotVelocity.x*n,this.euler.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*n),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(cl,this.euler.y-this.euler0.y);let a=xc.copy(this.objectToCamXZ).normalize(),l=wm.copy(o).multiplyScalar(n);l.y=0;let c=l.sub(Ki.copy(a).multiplyScalar(l.dot(a))).cross(a).y;this.euler.y-=Math.atan2(c,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*n+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=ge.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=ge.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=ge.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(Em.copy(this.euler),Em.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Em)),Ks.setFromAxisAngle(oie,this.rot.x),gh.setFromAxisAngle(cl,this.rot.y),gh.multiply(Ks),Ks.setFromAxisAngle(aie,this.rot.z),gh.multiply(Ks),this.quaternion.copy(gh),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let a=xc.copy(o).multiplyScalar(n/this.pixelsPerMeter),l=null;this.didHit=!1;let c=new M;for(let h=0;h<5;h++){let p=a.length(),f=wm.copy(a).normalize();if(l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),this.colliderWorldQuat,f,this.object.rigidBody.collider(0).shape,0,p,!1,II|Vj,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 T of m.cloner.children)if(T.rigidBody===S){E=T;break}}x.dispatch(E),m.dispatchEvent(fT)}}}let g=zj.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat),y=Gj.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)),a.copy(f).multiplyScalar(p-v),Math.acos(-g.y)>this.slopeThresh){let b=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(c),x=wm.copy(l.witness2).applyQuaternion(this.colliderWorldQuat);x.y=0;let S=b.add(x);S.y+=this.stepThresh;let E=this.sharedGameControlGlobals.rapierWorld.castShape(S,this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,0,1,!1,II|Vj,void 0,void 0,this.object.rigidBody);E!==null&&E.time_of_impact===0&&(g.y=0,g.normalize())}a.addScaledVector(g,-a.dot(g))}else{h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),c.add(a);break}}this.position.addScaledVector(c,this.pixelsPerMeter),Ki.copy(this.position).divideScalar(this.pixelsPerMeter),Ks.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let u=this.object.rigidBody,d=u!==void 0&&die.copy(Ki).sub(u.translation()).lengthSq()>1;u!==void 0&&(d?(u.setTranslation(Ki,!0),u.setRotation(Ks,!0)):(u.setNextKinematicTranslation(Ki),u.setNextKinematicRotation(Ks)))}else{let a=this.onObject?1:5,l=o.multiplyScalar(n/a);for(let c=0;c<a;c++)this.position.add(l),this.collisionAdjustment(n/a)}else this.position.addScaledVector(o,n);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let a=this.objectToTarget.add(this.position),l=this.targetToCamera.add(a);LI.lookAt(l,a,cl).setPosition(l),LI.decompose(this.targetPos,this.targetQuat,Ki),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=ge.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=ge.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(yie),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(gie),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Ks.setFromAxisAngle(cl,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?ge.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=ge.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):n=ge.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let r=Ki.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&r.applyQuaternion(e);let s=gh.setFromAxisAngle(r,n);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(s)}groundTiltAdjustment(e){cl.angleTo(e)*180/Math.PI<15||cl.angleTo(e)*180/Math.PI>85?Ks.identity():Ks.setFromUnitVectors(cl,e),this.groundTilt.slerp(Ks,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let n=Gj.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let r=LI.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Ki,Ks,xc).compose(Ki,Ks,Hj);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(o=>{if(o===this.object||o.isDescendantOf(this.object)||!o.bvhGeometry||!o.bvhGeometry.boundsTree)return;Lo.makeEmpty(),o.updateMatrixWorldRigid();let a=o.matrixWorldRigid,l=jj.copy(a).invert(),c=sie.copy(jj).multiply(r);Ri.copy(this.collider.segment),Ri.start.applyMatrix4(c),Ri.end.applyMatrix4(c);let u=zj.copy(this.position).applyMatrix4(l);Lo.expandByPoint(Ri.start),Lo.expandByPoint(Ri.end),Lo.min.addScalar(-this.collider.radius),Lo.max.addScalar(this.collider.radius),o.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder(d){return d.distanceToPoint(Ri.end)},intersectsBounds:d=>d.intersectsBox(Lo),intersectsTriangle:d=>{let h=Ki,p=xc,f=d.closestPointToSegment(Ri,h,p);if(f<this.collider.radius){let m=this.collider.radius-f,g=p.sub(h).normalize(),y=wm.copy(u);y.addScaledVector(g,m);let v=y.applyMatrix4(a).sub(this.position);n.add(v),Ri.start.addScaledVector(g,m),Ri.end.addScaledVector(g,m)}}})}),Lo.makeEmpty(),Ri.copy(this.collider.segment),Ri.start.applyMatrix4(r),Ri.end.applyMatrix4(r),Lo.expandByPoint(Ri.start),Lo.expandByPoint(Ri.end),Lo.min.addScalar(-this.collider.radius),Lo.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder(o){return o.distanceToPoint(Ri.end)},intersectsBounds:o=>o.intersectsBox(Lo),intersectsTriangle:o=>{let a=Ki,l=xc,c=o.closestPointToSegment(Ri,a,l);if(c<this.collider.radius){let u=this.collider.radius-c,d=l.sub(a).normalize();this.alignToGround&&this.groundTiltAdjustment(d),n.addScaledVector(d,u),Ri.start.addScaledVector(d,u),Ri.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()}},gb=mT;gb.isLocked=!1;q();xf();ih();rh();var $j,Kj=new Promise(i=>{$j=i});var FI,gT;function Zj(i){if(gT)return gT;async function t(){let n=i??(!1?".":"https://cdn.spline.design/@splinetool/runtime@2.0.78/build");typeof window<"u"&&(FI=new URL(n.endsWith("/")?n:`${n}/`,window.location.href).href);let s=import("./navmesh.js"),[o,a]=await Promise.all([s,fetch(`${n}/navmesh.wasm`).then(u=>u.arrayBuffer())]),l=o.default,c=await l({wasmBinary:a});$j(c)}return gT=t(),gT}dn();var vie=!1?typeof window<"u"?window.location.href:"":"https://cdn.spline.design/@splinetool/runtime@2.0.78/build/",bie=i=>`
9820
9820
  (async function() {
9821
9821
  const [wasmImport, wasmBinary] = await Promise.all([
9822
9822
  import('${i}' + 'navmesh.js'),
@@ -9897,8 +9897,8 @@ onmessage = function(messageEvent) {
9897
9897
  `:"")+Ob(e.children,t);if(e.type==="variable"){let r=t.getVariable(e.variableId);if(r!==void 0)return d5(r,t)}}return""}).join("");pt();var hM=1e3,h5=512*hM;function Lse(i,t){let e=typeof i;return!!((t==="string"||t==="number")&&e===t||t==="boolean"&&(i==="true"||i==="false"||i===!0||i===!1)||t==="image"&&e==="string"&&i.startsWith("http"))}var p5="https://hooks.spline.design",Nse=`${p5}/events?hashFile=`,eHe=`${p5}/`,pM=class{constructor(t,e){this.id=t;this.userWebhook=e;this.result=void 0;this._connected=!1;this.emitter=yc();this.reconnectWaitFor=hM;this._onError=t=>{this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this._scheduleReconnect()};this._onConnected=t=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=hM,this._connected=!0};this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=hM,this._connected=!1};this._onMessage=t=>{let e=t.data,n;try{n=JSON.parse(e)}catch(r){console.error("Error parsing webhook message",r)}if(n){let r=!1;this.userWebhook.parametersSchemas.forEach(({data:s})=>{n[s.name]!==void 0&&Lse(n[s.name],s.type)&&(this.result===void 0&&(this.result={}),this.result[s.name]=n[s.name],r=!0)}),r&&this.emitter.emit("message",{userWebhookId:this.id})}}}connect(){clearTimeout(this.scheduledReconnectHandle),this.userWebhook.url&&(this.eventSource=new EventSource(Nse+this.userWebhook.url),this.eventSource.addEventListener("message",this._onMessage),this.eventSource.addEventListener("error",this._onError),this.eventSource.addEventListener("open",this._onConnected))}disconnect(){this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this.eventSource?.close(),this._onDisconnected(),clearTimeout(this.scheduledReconnectHandle)}_scheduleReconnect(){this.reconnectWaitFor*=2,this.reconnectWaitFor>h5&&(this.reconnectWaitFor=h5),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout(()=>{this.scheduledReconnectHandle=void 0,this.connect()},this.reconnectWaitFor)}update(t){this.userWebhook=t}dispose(){this._connected&&this.disconnect()}get connected(){return this._connected}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}getParametersKeys(){return this.userWebhook.parametersSchemas.map(t=>t.data.name)}getParameterValue(t){if(this.getParametersKeys().includes(t)){if(this.result)return this.result?.[t];for(let n of this.userWebhook.parametersSchemas)if(n.data.name===t)return M1.defaultParameterValueByType(n.data.type)}}};Qt();Or("API",({eventContext:i,eventManager:t})=>new lM(i,t));Or("WEBHOOK",({eventContext:i,eventManager:t})=>new cM(i,t));mr("UserAPI",({data:i,page:t,shared:e,actionCondition:n})=>new uM(i,t,e,n));Rz({createUserAPI:(i,t,e)=>new dM(i,t,e),createUserWebhook:(i,t)=>new pM(i,t)});Mt("api-services");var fM=class extends vn{constructor(e,n){super(e);this.eventManager=n;this.events=[];this.onVoice=({value:e,frequencies:n})=>{this.events.forEach(r=>{r.dispatch()})}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(n=>n.data.type==="AIAssistantListener"&&!n.data.disabled).forEach(n=>{this.events.push(new IO(n.id,n.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){this.openAIRealtime?.off("voice",this.onVoice)}},IO=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.actions=ln(e,e.actions,r,s,o,n)}dispatch(){this.dispatchActions(this.actions)}dispatchActions(t){t.Audio.forEach(e=>e.dispatchConditional()),t.Particles.forEach(e=>e.dispatchConditional()),t.Video.forEach(e=>e.dispatchConditional()),t.Create.forEach(e=>e.dispatch()),t.Destroy.forEach(e=>e.dispatch()),t.Reset.forEach(e=>e.dispatch()),t.Transition.forEach(e=>{!e.shouldReinit()||(e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init())}),t.Transition.forEach(e=>e.play()),t.Animation.forEach(e=>e.play()),t.SwitchCamera.forEach(e=>e.play()),t.SceneTransition.forEach(e=>e.dispatch()),t.SetVariable.forEach(e=>e.checkConditions()),t.SetVariable.forEach(e=>e.dispatch()),t.DynamicVariablePlay.forEach(e=>e.dispatch()),t.ClearLocalStorage.forEach(e=>e.dispatch()),t.UserAPI.forEach(e=>e.dispatch())}};var mM=class extends vn{constructor(e,n){super(e);this.eventManager=n;this.events=[];this.onTriggerEvent=({description:e,direction:n})=>{let r=this.events.find(s=>s.data.description===e);r&&(n==="backward"?r.dispatchReverse():r.dispatch())}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(n=>n.data.type==="AIAssistantTrigger"&&!n.data.disabled).forEach(n=>{this.events.push(new OO(n.id,n.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){this.openAIRealtime?.off("trigger_event",this.onTriggerEvent)}},OO=class{constructor(t,e,n,r,s,o){this.id=t;this.data=e;this.object=n;this.actions=ln(e,e.actions,r,s,o,n)}dispatch(){let t=this.actions;t.Audio.forEach(e=>e.dispatchConditional()),t.Particles.forEach(e=>e.dispatchConditional()),t.Video.forEach(e=>e.dispatchConditional()),t.Create.forEach(e=>e.dispatch()),t.Destroy.forEach(e=>e.dispatch()),t.Reset.forEach(e=>e.dispatch()),t.Transition.forEach(e=>{!e.shouldReinit()||(e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init())}),t.Transition.forEach(e=>e.play()),t.Animation.forEach(e=>e.play()),t.SwitchCamera.forEach(e=>e.play()),t.SceneTransition.forEach(e=>e.dispatch()),t.SetVariable.forEach(e=>e.checkConditions()),t.SetVariable.forEach(e=>e.dispatch()),t.DynamicVariablePlay.forEach(e=>e.dispatch()),t.ClearLocalStorage.forEach(e=>e.dispatch()),t.UserAPI.forEach(e=>e.dispatch())}dispatchReverse(){let t=this.actions;t.Transition.forEach(e=>e.reverseFromCurrent()),t.Particles.forEach(e=>e.reverseFromCurrent()),t.Animation.forEach(e=>e.reverseFromCurrent()),t.SwitchCamera.forEach(e=>e.reverseFromCurrent()),t.Create.forEach(e=>e.dispatchStop())}};qw();function Bse(i){return/^(rgba)?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(i.toLowerCase())}function Fse(i,t,e){let n,r,s,o=Math.floor(i*6),a=i*6-o,l=e*(1-t),c=e*(1-a*t),u=e*(1-(1-a)*t);switch(o%6){case 0:n=e,r=u,s=l;break;case 1:n=c,r=e,s=l;break;case 2:n=l,r=e,s=u;break;case 3:n=l,r=c,s=e;break;case 4:n=u,r=l,s=e;break;case 5:default:n=e,r=l,s=c;break}return{r:n*255,g:r*255,b:s*255}}function Use(i,t,e){i/=255,t/=255,e/=255;let n=Math.max(i,t,e),r=Math.min(i,t,e),s=n,o=n-r,a=n==0?0:o/n,l;if(n==r)l=0;else{switch(n){case i:l=(t-e)/o+(t<e?6:0);break;case t:l=(e-i)/o+2;break;case e:default:l=(i-t)/o+4;break}l/=6}return{h:l,s:a,v:s}}function kse(i){return i=Math.floor(i),{r:i>>16&255,g:i>>8&255,b:i&255}}function Vse(i,t,e){return(i<<16)+(t<<8)+e}function zse(i,t,e){return i=Math.round(i),t=Math.round(t),e=Math.round(e),"#"+[i,t,e].map(n=>n.toString(16).padStart(2,"0")).join("").toUpperCase()}function Gse(i){let t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;i=i.replace(t,(n,r,s,o)=>String(r+r+s+s+o+o));let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}var f5={parseRgba:Bse,hsvToRgb:Fse,rgbToHsv:Use,hexToRgb:kse,rgbToHex:Vse,rgbToHexString:zse,hexStringToRgb:Gse};var m5=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],jse=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],_c=[],yM=[];for(let i=1;i<=8;i++)for(let t=0;t<m5.length;t++){let e=m5[t];_c.push(e/Math.pow(2,8-i)),yM.push(jse[t]+i)}var gM=[32,2e3],DO=_c.filter((i,t)=>_c[t]>gM[0]&&_c[t]<gM[1]),g5=yM.filter((i,t)=>_c[t]>gM[0]&&_c[t]<gM[1]);var vM=class{static getFrequencies(t,e,n,r="frequency",s=-100,o=-30){n||(n=new Float32Array(t.frequencyBinCount),t.getFloatFrequencyData(n));let a=e/2,l=1/n.length*a,c,u,d;if(r==="music"||r==="voice"){let f=r==="voice"?DO:_c,m=Array(f.length).fill(s);for(let g=0;g<n.length;g++){let y=g*l,v=n[g];for(let b=f.length-1;b>=0;b--)if(y>f[b]){m[b]=Math.max(m[b],v);break}}c=m,u=r==="voice"?DO:_c,d=r==="voice"?g5:yM}else c=Array.from(n),u=c.map((f,m)=>l*m),d=u.map(f=>`${f.toFixed(2)} Hz`);let h=c.map(f=>Math.max(0,Math.min((f-s)/(o-s),1)));return{values:new Float32Array(h),frequencies:u,labels:d}}};var Hse="gpt-realtime",Wse=()=>!1&&window.location.search.includes("api-dev")?"https://relayserver-dev.spline.design/":"https://relayserver.spline.design/";async function qse(i){try{return(await(await fetch(Wse()+"session?uuidfile="+i)).json()).token}catch(t){console.error("Token generation error:",t)}}var LO=class{constructor(t){this.value=0;this.frequencies=new Float32Array(0);let e=new AudioContext;this.source=e.createMediaStreamSource(t),this.analyser=e.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}getFrequencies(t=-100,e=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return vM.getFrequencies(this.analyser,44100,void 0,"voice",t,e)}update(){let t=this.getFrequencies(),e=t.values.reduce((n,r)=>n+r,0)/t.values.length;this.value=e,this.frequencies=t.values}disconnect(){this.source.disconnect(),this.analyser.disconnect()}},bM=class{constructor(t){this.callbacks=t;this.rafId=0;this.isOpen=!1;this.onMessage=t=>{this.callbacks.onMessage(t.data)};this.onOpen=()=>{this.isOpen=!0,this.callbacks.onOpen()};this.animate=()=>{this.rafId=requestAnimationFrame(this.animate),this.isOpen&&this.analyser&&(this.analyser.update(),this.callbacks.onVoice(this.analyser.value,this.analyser.frequencies))}}async connect(t){let e=await qse(t);this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=c=>{let u=c.streams[0];this.audioElement.srcObject=u,this.analyser=new LO(u)};let n=await navigator.mediaDevices.getUserMedia({audio:!0});this.pc.addTrack(n.getTracks()[0]),this.dc=this.pc.createDataChannel("oai-events"),this.dc.addEventListener("message",this.onMessage),this.dc.addEventListener("open",this.onOpen);let r=await this.pc.createOffer();await this.pc.setLocalDescription(r);let l={type:"answer",sdp:await(await fetch(`https://api.openai.com/v1/realtime/calls?model=${Hse}`,{method:"POST",body:r.sdp,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/sdp"}})).text()};await this.pc.setRemoteDescription(l),this.animate()}send(t){return this.dc?(this.dc.send(t),!0):!1}disconnect(){cancelAnimationFrame(this.rafId),this.analyser?.disconnect(),this.isOpen=!1,this.dc?.removeEventListener("message",this.onMessage),this.dc?.removeEventListener("open",this.onOpen),this.dc?.close(),this.pc?.getSenders().forEach(t=>{t.track&&t.track.stop()}),this.pc?.close(),this.pc=void 0}};function Xse(){try{return window.__SPLINE_PLAY_VOICE_HOST__===!0&&window.parent!==window}catch{return!1}}function y5(i,t,e){if(!Xse())return null;let n=!1,r=o=>{window.parent.postMessage({__splinePlayFrame:!0,...o},"*")},s=o=>{if(o.source!==window.parent)return;let a=o.data;!a||a.__splinePlayFrameHost!==!0||a.id!==i||(a.type==="voice-open"?(n=!0,e.onOpen()):a.type==="voice-message"&&typeof a.data=="string"?e.onMessage(a.data):a.type==="voice-level"&&typeof a.value=="number"?e.onVoice(a.value,a.frequencies instanceof Float32Array?a.frequencies:new Float32Array(0)):a.type==="voice-error"&&console.error("Voice assistant host error:",a.message))};return window.addEventListener("message",s),r({type:"voice-connect",id:i,hash:t}),{send:o=>n?(r({type:"voice-send",id:i,message:o}),!0):!1,disconnect:()=>{n=!1,window.removeEventListener("message",s),r({type:"voice-disconnect",id:i})}}}var xM=class{constructor(t,e,n){this.data=t;this.id=e;this.shared=n;this.emitter=yc();this.voice=0;this.frequencies=new Float32Array([0]);this.events=[];this.isConnected=!1;this.isToolsAdded=!1;this.tools=[];this.onServerEvent=t=>{let e=JSON.parse(t);if(this.appendEvent(e),e.type==="session.created"&&this.onSessionCreated(),e.type==="response.done"&&e.response?.output){for(let n of e.response.output)if(n.type==="function_call")for(let[r,s]of this.tools)n.name===r.name&&(s(JSON.parse(n.arguments)),setTimeout(()=>{this.sendClientEvent({type:"response.create",response:{instructions:"notice the user about what you just did"}})}))}};this.onSessionCreated=()=>{this.isToolsAdded||this.registerTools()};this.onOpen=()=>{this.events=[],this.isConnected=!0,this.sendClientEvent({type:"response.create",response:{instructions:"Say hi"}})}}update(t){this.data=t}setColorByName(t,e){let n=this.shared.getColorByName(t);if(n){let{id:r}=n,{r:s,g:o,b:a}=f5.hexStringToRgb(e)??{r:0,g:0,b:0};this.shared.updateColor(r,{r:s/255,g:o/255,b:a/255})}}async connect(){if(this.isConnected||this.session||this.hosted)return;let t={onMessage:this.onServerEvent,onOpen:this.onOpen,onVoice:(e,n)=>{this.voice=e,this.frequencies=n,this.emitter.emit("voice",{value:e,frequencies:n})}};this.hosted=y5(this.id,this.data.integration.hash,t),!this.hosted&&(this.session=new bM(t),await this.session.connect(this.data.integration.hash))}appendEvent(t){this.events=[t,...this.events]}sendClientEvent(t){t.event_id=t.event_id||crypto.randomUUID();let e=JSON.stringify(t);(this.hosted?this.hosted.send(e):this.session?.send(e)??!1)?this.appendEvent(t):console.error("Failed to send message - no data channel available",t)}registerTools(){this.isToolsAdded=!0,this.registerTool({type:"function",name:"set_personality_color",description:"returns a color based on the voice personality of the ai assistant. This should be called by the voice assistant each time it is asks to speak differently. If a color cannot be associated to the personality, the color should be a neutral color.",parameters:{type:"object",properties:{color:{type:"string",description:"css hex color string, reflecting the personality"},personality:{type:"string",description:"the personality of the voice assistant"}},required:["color","personality"]}},({color:s})=>{this.setColorByName("Voice Assistant Color",s)});let t=this.shared.getVariablesNames().join(", ");this.registerTool({type:"function",name:"set_variable",description:"Sets a Spline variable value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the variable that needs to be set. Here's a list of available variables: ${t}. It the variable does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"The new value for this variable, should always be a string even for number and boolean variables, assume that the value will be cast to the proper type afterwards."}},required:["name","value","type"]}},({name:s,value:o})=>{let a=this.shared.getVariableByName(s);if(a){let l=this.shared.getVariable(a.id),c;if(typeof l=="number"){if(c=parseFloat(o),!Number.isFinite(c))return}else typeof l=="boolean"?c=o.toLowerCase()==="true":c={textValue:o};this.shared.updateVariable(a.id,c)}});let e=this.shared.getColorNames().join(", ");this.registerTool({type:"function",name:"set_color",description:"Sets a Spline color asset value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the color asset that needs to be set. Here's a list of available color assets: ${e}. It the color asset does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"css hex color string"}},required:["name","value"]}},({name:s,value:o})=>{this.setColorByName(s,o)});let n=this.shared.scene,r=[];n.traverseEntity(s=>{s.data.events.forEach(o=>{if(o.data.type==="AIAssistantTrigger"){let{description:a}=o.data;r.push(a)}})}),this.registerTool({type:"function",name:"trigger_event",description:"Trigger an event by name, here are the available events, please match what the user is asking for to one of these if it applies, otherwise don't call the function and warn the user.",parameters:{type:"object",properties:{description:{type:"string",description:`The name of the event that needs to be triggered. Here's a list of available events: ${JSON.stringify(r)}.`},direction:{type:"string",description:"default is forward, but can be forward or backward. Always set to forward unless the user ask to reverse or cancel the event, then set to backward."}},required:["description","direction"]}},({description:s,direction:o})=>{this.emitter.emit("trigger_event",{description:s,direction:o})}),this.sendClientEvent({type:"session.update",session:{type:"realtime",tools:this.tools.map(([s])=>s)}})}registerTool(t,e){this.tools.push([t,e])}disconnect(){this.voice=0,this.isConnected=!1,this.isToolsAdded=!1,this.session?.disconnect(),this.session=void 0,this.hosted?.disconnect(),this.hosted=null}computeAnalysisForListenerEvent(t){if(t.analysis==="range"){let e=this.frequencies.slice(...t.analysisRange);return e.reduce((n,r)=>n+r,0)/e.length}return t.analysis==="single"?this.frequencies[t.analysisSingle]:this.voice}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}};Qt();Or("AIAssistantListener",({eventContext:i,eventManager:t})=>new fM(i,t));Or("AIAssistantTrigger",({eventContext:i,eventManager:t})=>new mM(i,t));Iz((i,t,e)=>new xM(i,t,e));Mt("ai-assistant");dn();var ju=class extends Pu{constructor(e,n,r){super(e,n,r);this.data=n}};pt();q();pt();q();var Hm=class extends Bs{constructor(){super();this.caretIndex=0;this._caretVisibleAlpha=1;this._selectionVisibleAlpha=.3;this.current={start:0,end:void 0};this.matrixAutoUpdate=!1,this.caretMesh=new Gt(new di(1,1),new ti({transparent:!0,opacity:0,side:Sr})),this.add(this.caretMesh),this.selectionMesh=new Gt(new di(1,1),new ti({color:2857471,transparent:!0,depthTest:!1,depthWrite:!1,opacity:0,side:Sr})),this.add(this.selectionMesh),this.hide()}get caretHeight(){return this.object?.AD??0}show(e){this.visible=!0,this.object=e,this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.y=-this.caretHeight*.5,this.setCaretPosition(this.caretIndex),this.update()}hide(){this.visible=!1}update(){if(this.object===void 0)return;this.updateHelperMatrix();let{depth:e}=this.object.geometry.userData.parameters;this.caretMesh.position.z=e,this.selectionMesh.position.z=e}updateHelperMatrix(){if(this.object===void 0)return;let e=this.object,n=e.parent;n!==null&&n.updateWorldMatrix(!0,!1),e.matrixAutoUpdate&&e.updateMatrix(),n!==null?(this.matrixWorld.multiplyMatrices(n.matrixWorld,e.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,e.matrix)):this.matrixWorld.multiplyMatrices(e.hiddenMatrix,e.matrix),this.matrix.copy(this.matrixWorld);for(let r of this.children)r.matrixWorld.copy(this.matrixWorld);e.updateWorldMatrix(!0,!0)}setCaretColor(e){let n=this.caretMesh.material;n.color.setRGB(e.r,e.g,e.b);let r=this._caretVisibleAlpha===n.opacity;this._caretVisibleAlpha=e.a,r&&(n.opacity=this._caretVisibleAlpha)}setSelectionColor(e){this.selectionMesh.material.color.setRGB(e.r,e.g,e.b)}setCaretPosition(e,n={}){if(this.object===void 0)return;this.caretIndex=e;let r=this.object.wrappedText,[s,o]=SM(r,e),[a,l]=e>0?SM(r,e-1):[null,null];(e>0&&r.length?r[a].charAt(l):null)===`
9898
9898
  `&&(s++,o=0),this.current.start=e,this.current.end=void 0;let[u,d]=NO(this.object,s,o),{AD:h,descender:p}=this.object,f=p+h*.5,{width:m,height:g,depth:y}=this.object.geometry.userData.parameters,v=typeof m=="string"?0:m,b=typeof g=="string"?0:g;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(u-v*.5,d+f+b*.5,y),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(e,n){if(this.object===void 0)return;let r=this.object.wrappedText;this.current.start=e,this.current.end=n;let s=[],o=[],a=Yse(r,e,n),{lineHeight:l,AD:c,descender:u}=this.object,d=u+c*.5-l*.5;for(let[v,b,x]of a)if(b!==x){let[S,E]=NO(this.object,v,b),[T,w]=NO(this.object,v,x),_=E,A=w;_+=d,A+=d,A+=l;let C=s.length/3;s.push(S,_,0),s.push(T,_,0),s.push(T,A,0),s.push(S,A,0),o.push(C+0,C+1,C+2),o.push(C+2,C+3,C+0)}let h=new Me;h.setIndex(o),h.setAttribute("position",new Be(s,3));let{width:p,height:f,depth:m}=this.object.geometry.userData.parameters,g=typeof p=="string"?0:p,y=typeof f=="string"?0:f;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=h,this.selectionMesh.position.x=-g*.5,this.selectionMesh.position.y=y*.5,this.selectionMesh.position.z=m,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(e,n,r="previous"){if(this.object===void 0||this.object.font===void 0)return;let s=this.object.wrappedText,o=s.length,a=this.object.lineHeight,l=o*a,{height:c,verticalAlign:u}=this.object.geometry.userData.parameters,d=typeof c=="string"?0:c,h=0;u===3?h=d-l:u===2&&(h=d*.5-l*.5);let p=Math.min(Math.floor(Math.max(Math.min(-n-h,l),0)/a),o-1),f=this.object.charCoords[p],m=this.object.charWidths[p],g=0,y=!1;if(r==="previous"){for(let b=0;b<f.length;b++)if(f[b][0]+m[b]*.5-e>0){g=b,y=!0;break}}else if(r==="closest"){let b=1/0;for(let x=0;x<f.length;x++){let S=f[x][0]+m[x]*.5,E=Math.abs(S-e);E<b&&(b=E,g=x,y=!0)}}else for(let b=0;b<f.length;b++){let x=f[b][0],S=f[b][0]+m[b];if(e>=x&&e<S){g=b,y=!0;break}}return y||(g=f.length),{index:this.getGlobalIndexFromLineAndCharIndexes(s,p,g),lineIndex:p,characterIndex:g}}getGlobalIndexFromLineAndCharIndexes(e,n,r){return e.slice(0,n).reduce((s,o)=>s+=o.length,0)+r}showSelectionMesh(){this.selectionMesh.material.opacity=this._selectionVisibleAlpha}hideSelectionMesh(){this.selectionMesh.material.opacity=0}showCaretMesh(){this.caretMesh.material.opacity=this._caretVisibleAlpha}hideCaretMesh(){this.caretMesh.material.opacity=0}};function NO(i,t,e){let{charCoords:n,charWidths:r,initialOffsetY:s,lineHeight:o}=i;if(n[t]&&n[t].length===0||n.length===0){let d=0,{horizontalAlign:h}=i.data.geometry,p=i.wrappedText,{width:f}=i.geometry.userData.parameters;return p.length===1&&p[0].length===0&&(h===3?d=f*.5:h===2&&(d=f)),[d,s-o*t]}let a=n[t];if(a===void 0||a.length===0)return[0,0];let[l,c]=a[Math.min(e,a.length-1)],u=l;return e>=a.length&&(u+=r[t][e-1]),[u,c]}function SM(i,t){let e=0;for(let n=0;n<i.length;n++){let r=i[n],s=t-e;if(s<=r.length)return[n,s];e+=r.length}return[Math.max(0,i.length-1),i[i.length-1]?.length??0]}function Yse(i,t,e){let[n,r]=SM(i,t),[s,o]=SM(i,e),a=[];r>=i[n].length&&(n++,r=0);for(let l=n;l<=s;l++){let c=i[l],u=l===n?r:0,d=l===s?o:c.length;a.push([l,u,d])}return a}function v5(i,t){let e=yr.fromHex(3223857),n=.8;for(let r of i.layers){if(r.data.type==="light"||r.data.type==="displace"||r.data.type==="fresnel"||r.data.type==="dust"||r.data.type==="matcap"||r.data.type==="texture"||r.data.type==="toon"||r.data.type==="outline"||r.data.type==="transmission"||r.data.type==="noise"||r.data.type==="vertexColor")continue;let s=typeof r.data.alpha=="string"?Number(t.getVariable(r.data.alpha)):r.data.alpha;if(r.data.type==="color"&&s>.3){e=$se(r.data.color,t),n=s;break}else if((r.data.type==="depth"||r.data.type==="gradient")&&s>.3){let o=Kse(r.data);e={r:o[0],g:o[1],b:o[2]},n=typeof r.data.alpha=="string"?1:r.data.alpha;break}}return{...e,a:n}}function $se(i,t){return typeof i=="string"?t.data.colors[i]:i}function Kse(i){return i.colors[0]}q();var wM=class{constructor(){this._clickCount=0;this._lastTime=0;this._lastPosition=[0,0];this._delay=500;this._distance=2;this._onMouseDown=t=>{let e=[t.clientX,t.clientY],n=new Date().getTime();if(this._clickCount>0){let r=e[0]-this._lastPosition[0],s=e[1]-this._lastPosition[1];Math.sqrt(r*r+s*s)>this._distance&&(this._clickCount=0)}this._lastPosition=e,this._clickCount=n-this._lastTime>this._delay?1:this._clickCount+1,this._lastTime=n};this._onMouseUp=t=>{}}start(t,e=500,n=2){this._target&&this.stop(),this.reset(),this._delay=e,this._distance=n,this._target=t,this._target.addEventListener("pointerdown",this._onMouseDown,!1),this._target.addEventListener("pointerup",this._onMouseUp,!1)}stop(){this._target&&(this._target.removeEventListener("pointerdown",this._onMouseDown,!1),this._target.removeEventListener("pointerup",this._onMouseUp,!1),this._target=void 0)}get clickCount(){return this._clickCount}reset(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0]}};dn();function Zse(){let i=document.createElement("textarea");return i.style.position="fixed",i.style.top="200px",i.style.left="400px",i.style.zIndex="-1",i.style.border="1px solid rgba(255,0,0,0.5)",i.style.width="10px",i.style.height="500px",i.style.color="white",i.style.opacity="0.5",i.style.background="transparent",i.style.display="none",i.style.margin="0px",i.style.padding="0px",i.style.boxSizing="content-box",i.style.pointerEvents="none",i}var Qse=new M(0,0,1),b5=new M,x5=new M,S5=new wt,EM=class{constructor(t,e,n,r,s){this.containerScene=t;this.raycaster=e;this.sharedAssets=n;this.requestRender=r;this.onExit=s;this.htmlInput=null;this.virtualInput=null;this.helper=new Hm;this.doubleClickHandler=new wM;this.isDragging=!1;this.plane=new xr;this.caretInterval=0;this.planeIntersection=new M;this.projected=new G;this._lastIndex=0;this._isFirstDragMove=!1;this.selectionOnDragStart=0;this.onTextMaterialChanged=()=>{let t=this.virtualInput?.data;if(this.virtualInput!==void 0&&t){let e=t.material,n=typeof e=="string"?this.sharedAssets.data.materials[e]:e,r=v5(n,this.sharedAssets);this.helper.setCaretColor(r)}};this.stopAnimateTextCursor=()=>{clearInterval(this.caretInterval),this.helper&&(this.helper.caretMesh.visible=!1)};this.startAnimateTextCursor=()=>{this.stopAnimateTextCursor(),this.helper&&(this.helper.caretMesh.visible=!0,this.caretInterval=setInterval(()=>{this.helper&&(this.helper.caretMesh.visible=!this.helper.caretMesh.visible),this.requestRender()},600))};this.handleCaretUpdate=t=>{if(!this.htmlInput||!this.virtualInput)return;let e=this.helper,n=t?.key==="ArrowLeft"||t?.key==="ArrowRight",r=t?.key==="ArrowUp"||t?.key==="ArrowDown";this.htmlInput.selectionStart===this.htmlInput.selectionEnd?(e.setCaretPosition(this.htmlInput.selectionStart,{horizontalKeyMove:n,verticalKeyMove:r}),this.startAnimateTextCursor()):e.setSelection(this.htmlInput.selectionStart,this.htmlInput.selectionEnd),this.requestRender()};this.containerScene.add(this.helper)}createInput(){return this.htmlInput=Zse(),this.htmlInput}connect(){}disconnect(){this.stopAnimateTextCursor(),this.helper.hide(),this.htmlInput?.remove(),this.doubleClickHandler.stop()}handleMouseDown(){if(!this.htmlInput||!this.virtualInput)return!0;this.getPointOnPlane();let t=this.doubleClickHandler.clickCount,e=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,t>1?"inside":"previous")??{index:0,lineIndex:0,characterIndex:0},{lineIndex:n}=e,{index:r,characterIndex:s}=e;this.virtualInput?.wrappedText?.length&&this.virtualInput.wrappedText[n][Math.max(0,s-1)]===`
9899
9899
  `&&(r--,s--),this._lastIndex=r,this._isFirstDragMove=!0;let o=this.checkClickedObject();if(t===1){if(o===null)return this.onExit(this.virtualInput),!0;this.selectionOnDragStart=r,this.isDragging=!0,this.setInputSelection(r)}else o===this.virtualInput&&(t===2?this.selectClosestWord(n,s):t>2&&(this.setInputSelection(0,this.htmlInput.value.length),this.doubleClickHandler.reset()))}handleMouseUp(){this.applyRangeToTextInput(),this.isDragging=!1,this._isFirstDragMove=!1}handleMouseMove(){!this.virtualInput||(this._isFirstDragMove&&this.doubleClickHandler.clickCount>1&&(this.selectionOnDragStart=this._lastIndex,this.isDragging=!0,this.setInputSelection(this._lastIndex)),this._isFirstDragMove=!1,this.getPointOnPlane(),this.applyRangeToTextInput())}focus(t){if(this.virtualInput=t,this.updateTextInputStyles(),this.htmlInput)if(t){let e=this.data?.geometry.text;this.htmlInput.value=typeof e=="string"?"":e?.textValue.toString()??""}else this.htmlInput.value=""}blur(){}get data(){let{virtualInput:t}=this;if(t)return t.dataPatched}applyRangeToTextInput(){if(!this.isDragging||!this.virtualInput||!this.htmlInput)return;let t=this.selectionOnDragStart,{index:e,lineIndex:n,characterIndex:r}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,this.doubleClickHandler.clickCount>2?"inside":"previous")??{index:0},s=e;n!==void 0&&r!==void 0&&this.virtualInput?.wrappedText[n][r-1]===`
9900
- `&&s--,this.htmlInput.setSelectionRange(Math.min(t,s),Math.max(t,s))}checkClickedObject(){if(this.virtualInput){let t=this.raycaster.intersectObject(this.virtualInput,!1);if(t.length>0){let e=t[0];if(e.object instanceof ju)return e.object}}return null}selectClosestWord(t,e){if(!this.virtualInput)return;let n=this.virtualInput.wrappedText,r=n[t],s=e+1,o=e;r[e]!==" "&&(s=this.findNextCharOccurence(r,e,"forward"," "),o=this.findNextCharOccurence(r,e,"backward"," "),o>0&&o++,s>=r.length-1&&t===n.length-1&&s++);let a=this.helper,l=a.getGlobalIndexFromLineAndCharIndexes(n,t,o),c=a.getGlobalIndexFromLineAndCharIndexes(n,t,s);this.setInputSelection(l,c)}findNextCharOccurence(t,e,n,r=" "){let s=Math.max(0,t.length-1),o=n==="forward"?s:0,a=n==="forward"?1:-1,l=Math.max(Math.min(e,s),0);for(;l!==o;)if(l+=a,t.charAt(l)===r)return l;return o}getPointOnPlane(){let t=this.virtualInput?.data;if(!(!this.virtualInput||!t)&&this.raycaster.ray.intersectsPlane(this.plane)){this.planeIntersection===null&&(this.planeIntersection=new M);let e=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(e){this.planeIntersection.copy(this.virtualInput.worldToLocal(e));let n=typeof t.geometry.width=="number"?t.geometry.width:1,r=typeof t.geometry.height=="number"?t.geometry.height:1;this.projected.set(e.x+n*.5,e.y-r*.5)}}}updatePlane(){let t=this.virtualInput?.data;this.virtualInput&&t&&(S5.getNormalMatrix(this.virtualInput.matrixWorld),b5.copy(Qse).applyMatrix3(S5).normalize(),this.virtualInput.localToWorld(x5.set(0,0,t.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(b5,x5))}setInputSelection(t,e=t){this.htmlInput?.setSelectionRange(t,e),lo&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){let t=this.virtualInput?.data;this.virtualInput&&t&&this.htmlInput&&(this.htmlInput.style.fontSize=t.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=t.geometry.letterSpacing*t.geometry.fontSize+"px",this.htmlInput.style.lineHeight=t.geometry.fontSize*t.geometry.lineHeight+"px",this.htmlInput.style.width=t.geometry.width+"px",this.htmlInput.style.height=t.geometry.height+"px",this.htmlInput.style.textAlign=Jse(t.geometry.horizontalAlign))}};function Jse(i){return i===4?"justify":i===2?"right":i===3?"center":"left"}var E5=(i,t)=>{if(typeof i=="string"){let e=t.data(i);if(e)return E5(e.value,t)}return Tr.getDisplayedValue(i)};function w5(i,t){let e=i.text,n="";if(typeof e=="string"){let r=t.variables.data(n);r&&(n=E5(r.value,t.variables))}else n=e.textValue.toString();return n}var TM=class extends vn{constructor(e,n){super(e);this.eventManager=n;this._textInputs=[];this.sceneHelpers=new hr;this.helper=new Hm;this._onMouseDownFocusIn=e=>{if(mt.length>1)return;this.eventContext.updateRaycaster(e);let n=null;if(this.eventContext.raycaster){for(let r of this._textInputs)if(this.eventContext.raycaster.intersectObject(r,!0).length>0){n=r;break}}this.focusOnTextInput(n),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(e),this._onMouseDown(e)};this.onExit=()=>{let{virtualInput:e}=this.textInputManager;if(e===null)return;let n=this.textInputManager.htmlInput;this.helper.hide(),n?.setSelectionRange(n.value.length,n.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:r}=this.eventContext;r.removeEventListener("pointerdown",this._onMouseDown,!1),r.removeEventListener("pointerup",this._onMouseUp,!1),r.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),r.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()};this._onMouseDown=e=>{this.eventContext.updateRaycaster(e),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)};this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)};this._onMouseMove=e=>{this.eventContext.updateRaycaster(e),this.textInputManager.handleMouseMove()};this._onTextEdit=e=>{let{htmlInput:n,virtualInput:r,helper:s}=this.textInputManager;if(!n||!r)return;let o=n.value;r.textGeometry.setText(o,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let a=r.data;s.update();let l=a.geometry.text;if(typeof l=="string"){let c=l;this.eventContext.sharedAssets.updateVariable(c,{textValue:o})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()};this._onCaretUpdate=e=>{this.textInputManager.handleCaretUpdate(e)};this._onKeyPress=e=>{e.key==="Escape"&&this.onExit()};this.textInputManager=new EM(this.sceneHelpers,e.raycaster,e.sharedAssets,e.requestRender,this.onExit)}connect(){let e=[];if(this.eventContext.scene.traverseEntity(s=>{s instanceof ju&&e.push(s)}),this._textInputs=e,e.length===0)return;let{domElement:n}=this.eventContext;n.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let r=this.textInputManager.createInput();document.body.appendChild(r),r.style.display="none",r.addEventListener("keyup",this._onCaretUpdate),r.addEventListener("keydown",this._onCaretUpdate),r.addEventListener("beforeinput",this._onCaretUpdate),r.addEventListener("paste",this._onCaretUpdate),r.addEventListener("cut",this._onCaretUpdate),r.addEventListener("select",this._onCaretUpdate),r.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let e=this.textInputManager.htmlInput,{domElement:n,sharedAssets:r}=this.eventContext;n.removeEventListener("pointerdown",this._onMouseDownFocusIn),e?.removeEventListener("keyup",this._onCaretUpdate),e?.removeEventListener("keydown",this._onCaretUpdate),e?.removeEventListener("beforeinput",this._onCaretUpdate),e?.removeEventListener("paste",this._onCaretUpdate),e?.removeEventListener("cut",this._onCaretUpdate),e?.removeEventListener("select",this._onCaretUpdate),e?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(s=>{let o=w5(s.data.geometry,this.eventContext.sharedAssets.data);s.textGeometry.setText(o,r)}),n.removeEventListener("pointerdown",this._onMouseDown,!1),n.removeEventListener("pointerup",this._onMouseUp,!1),n.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(e){this.textInputManager.focus(e),this.textInputManager.onTextMaterialChanged();let n=this.textInputManager.htmlInput;if(!n||e===null)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let r=w5(e.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);n.value=r,n.setSelectionRange(0,0),this.textInputManager.helper.show(e),n.style.display="block",n.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:s}=this.eventContext;s.removeEventListener("pointerdown",this._onMouseDownFocusIn),s.addEventListener("pointerdown",this._onMouseDown,!1),s.addEventListener("pointerup",this._onMouseUp,!1),s.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}};Qt();Or("Textfields",({eventContext:i,eventManager:t})=>new TM(i,t));Eo("InputGeometry",(i,t,e)=>new ju(i,t,e));Mt("textinputs");pw();var T5=new Map,Db=new Map,Wm=class{constructor(t,e,n,r){this.data=e;this.isPlayAudioAction=!0;let{audio:s,volume:o,delay:a,loop:l}=e;if(!s)throw new Error("Missing property");try{let c=typeof s=="string"?r.getAudio(s).src:s.data;this.audioPlayer=new lc({src:c,volume:o,delay:a,loop:l})}catch{console.warn(`Could not create an audio player for this object: "${n.name}" and this audio: "${s}"`)}Db.has(n.uuid)?Db.get(n.uuid).push(this):Db.set(n.uuid,[this]),T5.set(t,this)}playByToggle(){this.data.toggle==="stop"?this.audioPlayer?.status==="playing"?this.audioPlayer.stop():(this.audioPlayer?.stop(),this.audioPlayer?.play()):this.data.toggle==="pause"?this.audioPlayer?.status==="playing"?this.audioPlayer?.pause():this.audioPlayer?.play():(this.audioPlayer?.stop(),this.audioPlayer?.play())}dispose(){this.audioPlayer?.stop()}},BO=class{constructor(t){this.data=t;this.isPauseAudioAction=!0}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(t){let e=T5.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.audioPlayer?.[this.data.interaction](),this.disposeDelay()},this.data.delay)):e.audioPlayer?.[this.data.interaction]())}pauseAllAudiosFromObject(t){let e=Db.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(n=>n.audioPlayer?.[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(n=>n.audioPlayer?.[this.data.interaction]()))}pauseAllAudios(){let t=[...Db.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(n=>{n.audioPlayer?.[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(n=>{n.audioPlayer?.[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},MM=class{constructor(t,e,n,r,s){this.data=e;this.shared=r;this.condition=s;if(e.interaction==="play")this.interaction=new Wm(t,e,n,r);else if(e.interaction==="pause"||e.interaction==="stop")this.interaction=new BO(e);else throw new Error("Missing property")}dispatchBasic(){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Wm?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Wm?this.interaction.audioPlayer?.play():this.interaction.dispatch()}dispatchGameControl(t){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Wm&&(t==="start"?this.interaction.audioPlayer?.play():this.interaction.audioPlayer?.stop())}dispose(){this.interaction.dispose()}};Qt();mr("Audio",({id:i,data:t,object:e,shared:n,actionCondition:r})=>new MM(i,t,e,n,r));Mt("audio");function M5(i,t){let e;if("material"in i){let r=i.material;Array.isArray(r)?e=i.material[0].layers.find(s=>s.uuid===t):e=i.material.layers.find(s=>s.uuid===t)}if(!e)return;let n=e.color?.texture?.image?.img??e.holders?.find(r=>r.isVideo)?.img;return n instanceof HTMLVideoElement?n:void 0}dn();var _5=new Map,Lb=new Map,Nb=class{constructor(t,e,n){this.data=e;this.isPlayVideoAction=!0;this.delay=0;this.status="stopped";let{layerId:r,loop:s,volume:o,delay:a}=e;if(this.object=n,r===void 0)throw new Error("Missing property");let l=M5(n,r);l&&(this.videoElement=l,this.videoElement.loop=s===1/0,lo&&(this.videoElement.autoplay=!0),o!==void 0&&(this.videoElement.volume=o)),a!==void 0&&(this.delay=a),Lb.has(n.uuid)?Lb.get(n.uuid).push(this):Lb.set(n.uuid,[this]),_5.set(t,this),this.pause()}mute(){!this.videoElement||(this.videoElement.muted=!0)}unMute(){!this.videoElement||(this.videoElement.muted=!1)}play(t){if(!this.videoElement)return;let e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);t?(this.mute(),this.delay+=150):e?(this.mute(),window.setTimeout(()=>{this.unMute()},100)):this.unMute(),this.delayTimerId=window.setTimeout(()=>{if(!this.videoElement)return;let n=this.videoElement.play();n!==void 0&&n.then(r=>{}).catch(r=>{this.play()}),this.clearDelay()},this.delay),this.status="playing"}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}pause(){!this.videoElement||(this.videoElement.pause(),this.status="paused")}stop(){!this.videoElement||(this.videoElement.pause(),this.videoElement.currentTime=0,this.status="stopped",this.clearDelay())}seek(t){return new Promise(e=>{if(!this.videoElement)return e();let n=this.videoElement.duration;if(n>0){let r=t%n;this.videoElement.currentTime=r}this.videoElement.addEventListener("seeked",()=>e(),{once:!0})})}playByToggle(){this.data.toggle==="stop"?this.status==="playing"?this.stop():(this.stop(),this.play()):this.data.toggle==="pause"?this.status==="playing"?this.pause():this.play():(this.stop(),this.play())}dispose(){!this.videoElement||(this.stop(),this.videoElement.muted=!0)}},FO=class{constructor(t){this.data=t;this.isPauseVideoAction=!0}dispatch(){this.data.playVideo?this.pauseVideo(this.data.playVideo):this.data.object?this.pauseAllVideosFromObject(this.data.object):this.pauseAllVideos()}pauseVideo(t){let e=_5.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e[this.data.interaction](),this.disposeDelay()},this.data.delay)):e[this.data.interaction]())}pauseAllVideosFromObject(t){let e=Lb.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(n=>n[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(n=>n[this.data.interaction]()))}pauseAllVideos(){let t=[...Lb.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(n=>{n[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(n=>{n[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},_M=class{constructor(t,e,n,r,s){this.data=e;this.shared=r;this.condition=s;if(e.interaction==="play")this.interaction=new Nb(t,e,n);else if(e.interaction==="pause"||e.interaction==="stop")this.interaction=new FO(e);else throw new Error("Missing property")}dispatchBasic(){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Nb?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Nb?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}};fr();Qt();mr("Video",({id:i,data:t,object:e,shared:n,actionCondition:r})=>Rr(e)?null:new _M(i,t,e,n,r));Mt("video");dn();q();ih();var UO=(()=>{let i,t,e,n,r=!1;function s(c){!i&&!A5()&&(t?.sharedGameControlGlobals.createdObjects.length??0)>0&&(i=requestAnimationFrame(o)),c&&(t=c,n=c.requestRender,!r&&typeof document<"u"&&(document.addEventListener("visibilitychange",a),r=!0))}function o(c){if(!t||!n){i=void 0,e=void 0;return}let u=e?c-e:0,d=t.sharedGameControlGlobals.createdObjects,h=t.sharedGameControlGlobals.nCreatedPerAction,p=d.length,f=0;for(;f<p;){let m=d[f];m.userData.createdTime===void 0&&(m.userData.createdTime=c),m.userData.lifetime===void 0&&m.userData.quantity===void 0||m.userData.lifetime&&c-m.userData.createdTime<m.userData.lifetime||m.userData.quantity&&h[m.userData.actionId]<=m.userData.quantity?(m.userData.velocity&&(m.position.addScaledVector(m.userData.velocity,u/1e3),m.updateMatrix(),n()),f++):(h[m.userData.actionId]>m.userData.quantity&&h[m.userData.actionId]--,d.splice(f,1),m.removeFromParent(),t.sharedGameControlGlobals.rapierWorld&&m.rigidBody?(t.sharedGameControlGlobals.colliderToEntity.delete(m.rigidBody.collider(0).handle),t.sharedGameControlGlobals.rapierWorld.removeRigidBody(m.rigidBody)):(m.bvhGeometry=void 0,t.sharedGameControlGlobals.entitiesWithTransformAnim=t.sharedGameControlGlobals.entitiesWithTransformAnim.filter(g=>g.bvhGeometry!==void 0)),p--,n())}i=f>0?requestAnimationFrame(o):void 0,e=f>0?c:void 0}function a(){A5()?i&&(cancelAnimationFrame(i),i=void 0,e=void 0):s()}function l(){i&&(cancelAnimationFrame(i),i=void 0),r&&typeof document<"u"&&(document.removeEventListener("visibilitychange",a),r=!1),t=void 0,n=void 0,e=void 0}return{play:s,dispose:l}})();function A5(){return!!document&&document.hidden}var C5=new ke,eoe=new M,toe=new M,AM=class{constructor(t,e,n,r,s){this.data=t;this.page=e;this.controlsManager=n;this.shared=r;this.condition=s;this.intervalId=null;this.timeoutIdQueue=[];this.uniqueId=ge.generateUUID();this.dispatch=()=>{if(Xt(this.shared,this.condition)===!1)return!1;this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3)):this.dispatchInner()};this.dispatchFromStart=()=>{if(Xt(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3))};this.dispatchThrottled=q3(this.dispatch,1e3/this.data.creationSpeed);this.dispatchStart=()=>{this.intervalId===null&&(this.intervalId=window.setInterval(this.dispatch,1e3/this.data.creationSpeed))};this.dispatchStop=()=>{this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null)};this.dispatchInner=()=>{this.timeoutIdQueue.shift();let t=new Yr(this.object);if(t.playModeVisible=!0,t.expand(),this.data.coordinateSystem!=="world"){let n=this.data.coordinateSystem,r=this.page.scene.find(n);r&&(r.updateMatrixWorldRigid(),t.hiddenMatrix.copy(r.matrixWorldRigid))}t.scale.copy(this.object.scale),t.position.fromArray(this.data.position.map(n=>typeof n=="number"?n:0)),t.rotation.fromArray(this.data.rotation.map(n=>typeof n=="number"?n:0)),t.updateMatrix(),this.page.add(t);let e=this.controlsManager.sharedGameControlGlobals;e.createdObjects.push(t),e.nCreatedPerAction[this.uniqueId]===void 0?e.nCreatedPerAction[this.uniqueId]=1:e.nCreatedPerAction[this.uniqueId]++,t.updateWorldMatrix(!0,!0),t.traverseObject(this.traverseObjectCB),UO.play(),this.controlsManager.requestRender()};this.traverseObjectCB=t=>{t.hasNonUniformScale&&t.updateMatrixWorldRigid();let e;if(this.controlsManager.sharedGameControlGlobals.rapierWorld){if(t instanceof $s)if(t.objectForSample){if(t.objectForSample.dataPatched.physics.fusedBody)return;e=t.object}else return t.object.dataPatched.physics.fusedBody===!0&&t.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(t instanceof Yr)e=t.object;else if(e=t,e.dataPatched.cloner?.hideBase)return!0}else{if(t instanceof $s)return;t instanceof Yr?e=t.object:e=t}this.data.destroy==="Time"?t.userData.lifetime=this.data.lifetime*1e3:this.data.destroy==="Quantity"&&(t.userData.quantity=this.data.destroyAfterQuantity,t.userData.actionId=this.uniqueId);let n=new M().fromArray(this.data.velocity.map(s=>typeof s=="number"?s:0)),r=e.dataPatched;if(!(r.physics.enabled==="visibility"?!r.visible:!r.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(t,e,{fromCreate:!0,dynamic:this.data.dynamic}),this.data.destroy==="Collision"&&(t.rigidBody?.collider(0).setActiveEvents(1),t.userData.hasCollisionDestroy=!0),t.matrixWorld.decompose(eoe,C5,toe),n.applyQuaternion(C5),this.data.velocity.some(s=>s!==0)&&this.data.dynamic&&t.rigidBody?.setLinvel(n.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in t.object&&this.controlsManager.addBoundsTree(t),this.data.velocity.some(s=>s!==0)&&this.data.dynamic&&(t.userData.velocity=n)),e.dataPatched.physics?.fusedBody===!0))return!0};let o=this.page.scene.find(this.data.object);if(!o)throw new Error("Missing Property");if(this.object=o,this.data.coordinateSystem!=="world"&&!this.page.scene.find(this.data.coordinateSystem))throw new Error("Missing Property");UO.play(n)}dispose(){this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(t=>window.clearTimeout(t)),this.timeoutIdQueue=[],this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[],UO.dispose()}};var CM=class{constructor(t,e,n,r,s){this.data=t;this.page=e;this.controlsManager=n;this.shared=r;this.condition=s;this.timeoutIdQueue=[];this.dispatchInner=()=>{this.objects.forEach(this.destroyCallback)};this.destroyCallback=t=>{this.timeoutIdQueue.shift();let e=this.page.scene.find(t);if(e===void 0)return;let n=this.controlsManager.sharedGameControlGlobals.rapierWorld,r=n?e.dataPatched.physics?.fusedBody:!0;if(e.cloner){for(let s of e.cloner.children)r?(s.playModeVisible=!1,e.dataPatched.physics?.rigidBody==="positioned"&&this.removeBody(s),s.bvhGeometry&&(s.bvhGeometry=void 0)):this.clone===void 0||this.clone===s?(s.playModeVisible=!1,this.removeBody(s)):s.playModeVisible===void 0&&(s.playModeVisible=!0);e.cloner.syncInstanceMatrices(),(r||this.clone===void 0||this.clone===!1)&&(e.visible=!1,this.removeBody(e),e.bvhGeometry&&(e.bvhGeometry=void 0))}else this.removeBody(e),e.bvhGeometry&&(e.bvhGeometry=void 0),e.visible=!1;n===void 0?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(s=>s.bvhGeometry!==void 0):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(s=>s.rigidBody!==void 0),e.destroyedInAction=!0,this.controlsManager.requestRender()};this.objects=[...t.objects]}removeBody(t){let e=t.rigidBody;if(!e)return;let n=this.controlsManager.sharedGameControlGlobals;n.colliderToEntity.delete(e.collider(0).handle),n.kinematicBodyToEntity.delete(e.handle);let r=this.controlsManager;r.fixedBodiesToWatch=r.fixedBodiesToWatch.filter(([,s])=>s!==e),n.rapierWorld.removeRigidBody(e),t.rigidBody=void 0}dispatch(t){if(Xt(this.shared,this.condition)===!1)return!1;this.clone=t,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3)):this.dispatchInner()}dispatchFromStart(){if(Xt(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3))}dispose(){this.timeoutIdQueue.forEach(t=>window.clearTimeout(t))}};Qt();mr("Create",({data:i,page:t,eventManager:e,shared:n,actionCondition:r})=>new AM(i,t,e.controlsManager,n,r));mr("Destroy",({data:i,page:t,eventManager:e,shared:n,actionCondition:r})=>new CM(i,t,e.controlsManager,n,r));Mt("create-destroy");pt();pt();Yi();q();Xs();$i();fr();var P5=new M;function qm(i,t,e=!1){let n=[],r=s=>{let o=s.data;delete s.states,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null;for(let a of o.states){let l={...a.data};s.states||(s.states={}),s.states[a.id]=nc.patch(o,l)}I5(i.scene,s,null,t,o.events.find(a=>a.data.type==="Follow"||a.data.type==="LookAt")!==void 0),R5(i)};i.scene.traverse2D(r),i.traverseChildren(s=>{if(e&&(s.rigidBody?.setTranslation(s.position0,!0),s.rigidBody?.setRotation(s.rotation0,!0),s.rigidBody?.setLinvel(P5,!0),s.rigidBody?.setAngvel(P5,!0)),!Ot.is(s))return;let o=s.uuid,a=s.data;if(delete s.states,s.uuid===fo)return;let l=!1;n.some(c=>i.scene.find(o)?.isDescendantOf(c))?l=!0:a.physics?.fusedBody===!0&&a.physics.rigidBody==="dynamic"&&n.push(o),s.data=a,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null,s.transitionState={settled:!0,state:null};for(let c of a.states){let u={...c.data};i.data.globalPhysics.usePhysics===!0&&a.physics&&(a.physics.rigidBody==="dynamic"||l)&&(c.data.position!==void 0&&delete u.position,c.data.rotation!==void 0&&delete u.rotation,c.data.hiddenMatrix!==void 0&&delete u.hiddenMatrix),s.states||(s.states={}),s.states[c.id]=ia.patch(a,u)}I5(i.scene,s,null,t,a.events.find(c=>c.data.type==="Follow"||c.data.type==="LookAt")!==void 0),vr(s)&&s.frame&&(s.frame.traverse(c=>r(c)),s.uiCanvas?.applySize())}),R5(i),i.frame&&(i.frame.traverse(s=>r(s)),i.uiCanvas?.applySize())}function R5(i){i.traverseEntity(t=>{for(let e of t.data.events){let n=[];switch(e.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":n.push(...e.data.actions);break;case"GameControl":for(let r of Object.values(e.data.gameActions))n.push(...r);break;case"DragDrop":n.push(...e.data.dragDropActions.drag,...e.data.dragDropActions.drop);break;case"Conditional":n.push(...e.data.inActions,...e.data.outActions);break}for(let r of n)if(r.data.type==="Create"&&r.data.hideBase==="Yes"){let s=i.scene.find(r.data.object);s&&(s.visible=!1)}}})}function I5(i,t,e,n,r=!1){if(i.markShadowsDirty(),t instanceof Yt&&!Xi(t)&&t.removeInteractionGeometry(n),Rr(t)?t.changeSelectedState(e,{shared:n},r):t.changeSelectedState(e,{scene:i,shared:n},r),t instanceof Yt&&t.updateGeometryGroupsIfNeeded(),t instanceof rn&&t.updateCameraState(t.dataPatched,{scene:i,shared:n}),!Rr(t)){if(t.cloner){let s=!1;for(let o of t.cloner.children)o.playModeVisible=void 0,o.transformOverride!==void 0&&(o.transformOverride=void 0,s=!0);s&&i.addPendingUpdateCloner(t),t.cloner.syncInstanceMatrices()}t.updateVisible()}}var PM=class{constructor(t,e,n,r,s){this.data=t;this.page=e;this.eventManager=n;this.shared=r;this.condition=s;this.timeOutId=-1;this.scene=e.scene}dispatch(){if(Xt(this.shared,this.condition)===!1)return!1;this.data.target!==this.page.uuid&&(window.clearTimeout(this.timeOutId),this.timeOutId=window.setTimeout(()=>{this.play()},this.data.delay*1e3))}dispose(){window.clearTimeout(this.timeOutId)}play(){if(this.scene.children.every(n=>n.uuid!==this.data.target||n.data.uiScene))return;this.data.transition==="fade"&&this.data.duration>0&&this.eventManager.eventContext.renderer.renderFromSceneForSceneTransitionPass(this.scene,this.scene.activeCamera,this.data.duration*1e3),this.eventManager.deactivate(),this.eventManager.controlsManager.deactivate();let t=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(n=>{n.type==="ParticleSystem"&&(n.sleep(),n.wakeUp(),n.data.autoPlay?n.start():n.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(t),qm(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}};Qt();mr("SceneTransition",({data:i,page:t,eventManager:e,shared:n,actionCondition:r})=>new PM(i,t,e,n,r));Mt("scene-transition");pt();q();pt();function noe(i){return{easing:i.type,control1:ec(i.cubicControls?.control1,[0,0]),control2:ec(i.cubicControls?.control2,[1,1]),...i.springParameters}}function Mh(i,t){let e=[];for(let n of i??[]){let r=t(n.data);r!==void 0&&e.push({time:n.data.time,ease:noe(n.data.easing),value:r})}return{keyframes:KH(e)}}function xa(i,t){if(i.keyframes.length===0)return;let{index0:e,index1:n,t:r}=$H(i.keyframes,t),s=i.read;if(s&&s.index0===e&&s.index1===n&&s.t===r)return;let o={index0:e,index1:n,from:i.keyframes[e].value,to:i.keyframes[n].value,t:r};return i.read=o,o}function O5(i){i.read=void 0}function Bb(i,t,e){return i+(t-i)*e}pt();q();ii();Xs();rE();kO();oE();$i();fr();Za();xR();pt();dn();q();Co();var{degToRad:UWe,radToDeg:kWe}=ge,L5=new M,N5=new M,B5=new ke;function U5(i,t,e,n){if(n===0)return e.copy(i);if(n===1)return e.copy(t);let r=i.w*t.w+i.x*t.x+i.y*t.y+i.z*t.z;if(r>=1)return e.copy(i);let s=1-r*r;if(s<=Number.EPSILON){let u=1-n;return e.w=u*i.w+n*t.w,e.x=u*i.x+n*t.x,e.y=u*i.y+n*t.y,e.z=u*i.z+n*t.z,e.normalize(),e}let o=Math.sqrt(s),a=Math.atan2(o,r),l=Math.sin((1-n)*a)/o,c=Math.sin(n*a)/o;return e.w=i.w*l+t.w*c,e.x=i.x*l+t.x*c,e.y=i.y*l+t.y*c,e.z=i.z*l+t.z*c,e}function Vr(i,t,e,n,r,s){let o=e[i]!==void 0?e[i]:void 0,a=n[i];if(a==null)return;let l=o!=null?typeof o=="string"?Number(r.getVariable(o)??0):o:t[i],c=typeof a=="string"?Number(r.getVariable(a)??0):a;if(l!==c)return{update:u=>{let d=ge.lerp(l,c,u);s?t[i]=Math.trunc(d):t[i]=d},start:()=>{t[i]=l},end:()=>{t[i]=c}}}function Ub(i,t,e,n,r,s){let o=e[i]?e[i]:void 0,a=n[i];if(!a)return;let l=t[i],c=[...o??l].map(d=>typeof d=="string"?Number(r.getVariable(d)??0):d),u=[...a].map(d=>typeof d=="string"?Number(r.getVariable(d)??0):d);if(!(c.length!==u.length||Jo(c,u)))return{update:d=>{c.forEach((h,p)=>{let f=ge.lerp(h,u[p],d);t[i][p]=s?Math.trunc(f):f})},start:()=>{Object.assign(t[i],c)},end:()=>{Object.assign(t[i],u)}}}function Fb(i,t,e){return t.forEach((n,r)=>{i.setComponent(r,typeof n=="string"?Number(e.getVariable(n)??0):n)}),i}function VO(i,t,e,n,r){let s=e[i]?e[i]:void 0,o=n[i];if(!o)return;let a=t[i],l=s?Fb(new M,s,r):a.clone(),c=Fb(new M,o,r);if(!l.equals(c))return{update:u=>{a.lerpVectors(l,c,u)},start:()=>{a.copy(l)},end:()=>{a.copy(c)}}}function F5(i,t,e){return t.forEach((n,r)=>{i.setComponent(r,typeof n=="string"?Number(e.getVariable(n)??0):n)}),i}function Ym(i,t,e,n,r){let s=e[i]?e[i]:void 0,o=n[i];if(!o)return;let a=t[i],l=!(a instanceof G),c=a instanceof G?a:new G().fromArray(a),u=s?F5(new G,s,r):c.clone(),d=F5(new G,o,r);if(!u.equals(d))return{update:h=>{c.lerpVectors(u,d,h),l&&(t[i]=c.toArray())},start:()=>{c.copy(u),l&&(t[i]=c.toArray())},end:()=>{c.copy(d),l&&(t[i]=c.toArray())}}}function k5(i,t,e,n){let r=e[i]?e[i]:void 0,s=n[i];if(!s)return;let o=t[i],a=r?new te().fromArray(r):o.clone(),l=new M,c=new ke,u=new M;a.decompose(l,c,u);let d=new te().fromArray(s),h=new M,p=new ke,f=new M;if(d.decompose(h,p,f),!a.equals(d))return{update:m=>{B5.slerpQuaternions(c,p,m),L5.lerpVectors(l,h,m),N5.lerpVectors(u,f,m),o.compose(L5,B5,N5)},start:()=>{o.compose(l,c,u)},end:()=>{o.compose(h,p,f)}}}function V5(i,t,e,n,r){let s=e[i]?e[i]:void 0,o=n[i];if(!o)return;let a=t[i],l=s?typeof s=="string"?r.getColor(s).clone():new Ye().setRGB(s.r,s.g,s.b):a.clone(),c=typeof o=="string"?r.getColor(o).clone():new Ye().setRGB(o.r,o.g,o.b);if(l.equals(c))return;let u=a.clone();return{update:d=>{u.lerpColors(l,c,d),t[i]?.copy?.(u)},start:()=>{u.copy(l)},end:()=>{u.copy(c)}}}function kb(i,t,e,n,r){let s=e[i]?e[i]:void 0,o=n[i];if(!o)return;let a=t[i],l=new gn(a.r,a.g,a.b,a.a),c=s?typeof s=="string"?r.getColor(s).clone():new gn(s.r,s.g,s.b,s.a):l.clone(),u=typeof o=="string"?r.getColor(o).clone():new gn(o.r,o.g,o.b,o.a);if(!c.equals(u))return{update:d=>{l.lerpColors(c,u,d);let h=ge.lerp(c.a,u.a,d);l.a=h,t[i]={r:l.r,g:l.g,b:l.b,a:l.a}},start:()=>{l.copy(c)},end:()=>{l.copy(u)}}}function hl(i,t,e,n,r){if(typeof t[i]=="number")return Vr(i,t,e??{},n,r);if(Array.isArray(t[i]))return Ub(i,t,e??{},n,r)}var VWe=new Ht;function z5(i,t){if(!!i)for(let[e,n]of Object.entries(t)){let r=i[e];if(Array.isArray(r)&&Array.isArray(n)){let s=Math.min(r.length,n.length);for(let o=0;o<s;o++)r[o]=n[o]}else i[e]=n}}function $m(i,t,e,n){let r={};if(!t||!e)return r;for(let s of i){let o=t[s],a=e[s];if(typeof o=="number"&&typeof a=="number")r[s]=ge.lerp(o,a,n);else if(Array.isArray(o)&&Array.isArray(a)){let l=Math.min(o.length,a.length);r[s]=Array.from({length:l},(c,u)=>ge.lerp(o[u],a[u],n))}}return r}function G5(i,t,e,n){let r=[];if(!("cloner"in e)||!i.cloner)return r;let s=i.cloner,o="cloner"in t?t.cloner:{},a=e.cloner;iP.forEach(p=>{let f;p==="count"?f=Vr("count",s.parameters,o,a,n.shared,!0):f=hl(p,s.parameters,o??{},a,n.shared),f&&r.push(f)});let l=roe(s,o,a,n.shared);l?.length&&r.push(...l);let c=ioe(s,o,a,n.shared);c?.length&&r.push(...c);let u=soe(s,o,a,n.shared);u?.length&&r.push(...u);let d=ooe(s,o,a,n.shared);d?.length&&r.push(...d);let h=aoe(s,o,a,n.shared);return h?.length&&r.push(...h),r.length&&r.push({update:()=>{s.update(n)}}),r}function roe(i,t,e,n){if(i.parameters.type!=="radial")return;let r=t.radial,s=e.radial;if(!s)return;let o=i.parameters.radial,a=[];return e1.forEach(l=>{let c=hl(l,o,r??{},s,n);c&&a.push(c)}),a}function ioe(i,t,e,n){if(i.parameters.type!=="linear")return;let r=t.linear,s=e.linear;if(!s)return;let o=[],a=i.parameters.linear;return t1.forEach(l=>{let c=hl(l,a,r??{},s,n);c&&o.push(c)}),o}function soe(i,t,e,n){if(i.parameters.type!=="grid")return;let r=t.grid,s=e.grid;if(!s)return;let o=[],a=i.parameters.grid;return n1.forEach(l=>{let c;l==="count"?c=Ub(l,a,r??{},s,n,!0):c=hl(l,a,r??{},s,n),c&&o.push(c)}),o}function ooe(i,t,e,n){if(i.parameters.type!=="toObject")return;let r=t.toObject,s=e.toObject;if(!s)return;let o=[],a=i.parameters.toObject;return r1.forEach(l=>{let c;l==="count"?c=Vr(l,a,r??{},s,n,!0):c=hl(l,a,r??{},s,n),c&&o.push(c)}),o}function aoe(i,t,e,n){if(!i.parameters.randomness)return;let r=t.randomnessObject,s=e.randomnessObject;if(!s)return;let o=[],a=i.parameters.randomnessObject;return i1.forEach(l=>{let c=hl(l,a,r??{},s,n);c&&o.push(c)}),o}var j5=[["radial",e1],["linear",t1],["grid",n1],["toObject",r1],["randomnessObject",i1]];function H5(i,t,e,n){if(!i)return{};let r=$m(["count"],t,e,n);r.count!==void 0&&(r.count=Math.trunc(r.count));for(let[s,o]of j5){if(!i[s])continue;let a=$m(o,t[s],e[s],n);Object.keys(a).length&&(r[s]=a)}return r}function W5(i,t){if(!!i){t.count!==void 0&&(i.count=t.count);for(let[e]of j5){let n=t[e];n&&z5(i[e],n)}}}pt();q();Co();Ww();Za();dn();function X5(i,t,e,n){let r=[];if(Array.isArray(i.material)){if(!("materials"in e&&e.materials))return r;let s="materials"in t&&t.materials?t.materials:[],o=e.materials;i.material.forEach((a,l)=>{if(!o[l])return;let c=s[l]??{},u=o[l];typeof c=="string"||typeof u=="string"||r.push(...q5(a,c,u,n))})}else{if(!("material"in e&&e.material))return r;let s="material"in t&&t.material?t.material:{},o=e.material;if(typeof s=="string"||typeof o=="string")return r;r.push(...q5(i.material,s,o,n))}return r}function loe(i,t,e){let n=i.ensureRainbowNoiseCompiled;if(typeof n=="function")for(let r of[...i.layers]){if(r.type!=="rainbow")continue;let s=t.layers?.data(r.uuid),o=e.layers.data(r.uuid);(da(s?.noiseStrength)||da(o?.noiseStrength))&&n.call(i,r.uuid)}}function Y5(i,t,e,n,r){let s=i.getValue(n);if(s!==void 0){if(n==="colors")return moe(i,t,e,n);if(Array.isArray(s))return n==="steps"?foe(i,t,e,n):void 0;if(typeof s=="number")return coe(i,t,e,n,r);if(typeof s!="boolean"){if(s instanceof G)return uoe(i,t,e,n);if(s instanceof M)return doe(i,t,e,n,r);if(s instanceof gn)return poe(i,t,e,n,r);if(s instanceof Ye)return hoe(i,t,e,n,r);if("isTexture"in s)return yoe(i,t,e,n,r)}}}function q5(i,t,e,n){let r=[],s=Ka(e,n)||!!t.layers&&Ka(t,n);r.push(voe(i,s)),loe(i,t,e);for(let o of i.layers){let a=t.layers?.data(o.uuid),l=e.layers.data(o.uuid);if(!l||o.type!=="light"&&(!(o.visible??!0)||!(l.visible??!0)))continue;let c=$f[o.type]??[],u=o.getNames().filter(d=>!c.includes(d)&&!sf.some(h=>d.includes(h)));for(let d of u)try{let h=Y5(o,a,l,d,n);h&&(Array.isArray(h)?r.push(...h):r.push(h))}catch(h){console.error(`lerpMaterial: unexpected material layer for ${d}`,h)}}return r}function coe(i,t,e,n,r){if(!i.hasValue(n)||!(n in e))return;let s=t?t[n]:i.getValue(n),o=e[n],a=typeof s=="string"?Number(r.getVariable(s)??0):s,l=typeof o=="string"?Number(r.getVariable(o)??0):o;return{update:c=>{i.setValue(n,ge.lerp(a,l,c))},start:()=>{i.setValue(n,a)},end:()=>{i.setValue(n,l)}}}function uoe(i,t,e,n){if(!i.hasValue(n)||!(n in e))return;let r=i.getValue(n),s=t?new G().fromArray(t[n]):r.clone(),o=new G().fromArray(e[n]);if(!s.equals(o))return{update:a=>{r.lerpVectors(s,o,a)},start:()=>{r.copy(s)},end:()=>{r.copy(o)}}}function doe(i,t,e,n,r){if(!i.hasValue(n)||!(n in e))return;let s=i.getValue(n),o=t?t[n]:void 0,a=e[n],l=o?Fb(new M,o,r):s.clone(),c=Fb(new M,a,r);if(!l.equals(c))return{update:u=>{s.lerpVectors(l,c,u)},start:()=>{s.copy(l)},end:()=>{s.copy(c)}}}function hoe(i,t,e,n,r){if(!i.hasValue(n)||!(n in e))return;let s=t?t[n]:void 0,o=e[n],a=i.getValue(n),l=s?typeof s=="string"?r.color(s).clone():new Ye().setRGB(s.r,s.g,s.b):a.clone(),c=typeof o=="string"?r.color(o).clone():new Ye().setRGB(o.r,o.g,o.b);if(l.equals(c))return;let u=a.clone();return{update:d=>{i.getValue(n)!==u&&i.setValue(n,u),u.lerpColors(l,c,d)},start:()=>{u.copy(l)},end:()=>{u.copy(c)}}}function poe(i,t,e,n,r){if(!i.hasValue(n)||!(n in e))return;let s=t?t[n]:void 0,o=e[n],a=i.getValue(n),l=s?typeof s=="string"?r.color(s).clone():new Ye().setRGB(s.r,s.g,s.b):a.clone(),c=typeof o=="string"?r.color(o).clone():new gn(o.r,o.g,o.b,o.a);if(l.equals(c))return;let u=a.clone();return{update:d=>{i.getValue(n)!==u&&i.setValue(n,u),u.lerpColors(l,c,d)},start:()=>{u.copy(l)},end:()=>{u.copy(c)}}}function foe(i,t,e,n="steps"){if(!i.hasValue(n)||!(n in e))return;let r=[],s=i.getValue(n),o=t?t[n]:s,a=e[n];return Jo(o,a)||r.push({update:l=>{let c=[...s];for(let u=0;u<s.length;++u){let d=o[u],h=a[u];c[u]=ge.lerp(d,h,l)}i.setValue(n,c)},start:()=>{i.setValue(n,o)},end:()=>{i.setValue(n,a)}}),r.length?r:void 0}function moe(i,t,e,n="colors"){if(!i.hasValue(n)||!(n in e))return;let r=[],s=i.getValue(n),o=t?t[n]:s.map(l=>l.toArray()),a=e[n];for(let l=0;l<s.length;++l){let c=[...o[l]],u=[...a[l]];Bd.isEqual(c,u)||r.push({update:d=>{s[l].fromArray(Bd.lerp(c,u,d))},start:()=>{s[l].fromArray(c)},end:()=>{s[l].fromArray(u)}})}return r.length?r:void 0}function goe(i){let t=i.getNode("mat");if(typeof t?.updateMatrix=="function")return t;let e=i.getValue("mat");return typeof e?.updateMatrix=="function"?e:void 0}function yoe(i,t,e,n="texture",r){if(!i.hasValue(n)||!(n in e))return;let s=v=>Number(typeof v=="string"?r?.getVariable(v)??0:v??0),o=i.getNode("rotation"),a=t?s(t[n]?.rotation):(o?.value??0)*ge.RAD2DEG,l=s(e[n]?.rotation);if(o&&Math.abs(a-l)>1e-9)return{update:v=>{o.value=ge.lerp(a,l,v)*ge.DEG2RAD},start:()=>{o.value=a*ge.DEG2RAD},end:()=>{o.value=l*ge.DEG2RAD}};let c=goe(i);if(!c)return;let u=t?t[n]:c,d=e[n],h=[...u.repeat],p=[...u.offset],f=[...d.repeat],m=[...d.offset],g=u.rotation??0,y=d.rotation??0;if(!Ws.isEqual(h,f)||!Ws.isEqual(p,m)||g!==y)return{update:v=>{c.repeat=Ws.lerp(h,f,v),c.offset=Ws.lerp(p,m,v),c.rotation=ge.lerp(g,y,v),c.updateMatrix()},start:()=>{c.repeat=[...h],c.offset=[...p],c.rotation=g,c.updateMatrix()},end:()=>{c.repeat=[...f],c.offset=[...m],c.rotation=y,c.updateMatrix()}}}function zO(i,t,e,n,r,s){let o=Y5(t,e,n,i,s);!o||(Array.isArray(o)?o.forEach(a=>a.update(r)):o.update(r))}function voe(i,t){return{update:()=>{i.setTransparent(t)}}}function $5(i,t,e,n,r){let s=boe(i,t);return{duration:e,evaluate(o,a){i.resetBBoxNeedsUpdate();let l=Soe();for(let c of s)Eoe(c,i,o,n,r,a,l);woe(i,l,n)},invalidate(){for(let o of s)O5(o.track)}}}function boe(i,t){let e=[];return tc.groupKeyframes(t.keyframes).forEach(n=>{let r=n.path?.[0],s=n.path[1],o=()=>Mh(n.keyframes,a=>a.value);switch(r){case"position":case"rotation":case"scale":s&&mf.includes(s)&&e.push({on:r,axis:s,track:o()});return;case"shape size":s&&mf.includes(s)&&"geometry"in i&&e.push({on:"shapeSize",axis:s,track:o()});return;case"path extrusion":$d(i)&&e.push({on:"pathExtrusion",track:Mh(n.keyframes,a=>a.value)});return;case"path snapping":i.data.pathSnapping&&e.push({on:"pathSnapping",track:Mh(n.keyframes,a=>a.value)});return;case"material":i.type==="Mesh"&&"material"in i&&xoe(i,n).forEach(a=>e.push(a));return;case"opacity":i.type==="Mesh"&&"material"in i&&e.push({on:"opacity",track:o()});return;case"cloner":e.push({on:"cloner",track:Mh(n.keyframes,a=>a.value)});return;case"camera":i instanceof rn&&e.push({on:"camera",field:"zoom",track:o()});return;case"light":(i instanceof pc||i instanceof _h||i instanceof fc)&&e.push({on:"light",field:n.path[1],track:Mh(n.keyframes,a=>a.value)});return}}),e}function xoe(i,t){let e=$w(i.material)?i.material:void 0,n=t.layerId;if(!e||!n)return[];let r=t.keyframes.some(u=>da(u.data.value?.noiseStrength)),s=e.ensureRainbowNoiseCompiled,o=u=>{r&&typeof s=="function"&&s.call(e,u)},a=u=>"data"in u?[{on:"material",layer:u,track:Mh(t.keyframes,d=>d.value)}]:[];o(n);let l=e.getLayerByUuid(n);if(l)return a(l);let c=t.path[1];for(let u of e.getLayersOfType(c))o(u.uuid);return(e.getLayersOfType(c)??[]).flatMap(a)}function Soe(){return{transform:!1,size:!1,cloner:!1,bounds:!1,boolean:!1,render:!1}}function woe(i,t,e){if(t.size&&i instanceof Yt){let{x:n,y:r,z:s}=i.userData.value;i.updateGeometryInteractions({width:n,height:r,depth:s},e.shared)}t.cloner&&i.cloner?.update(e),t.transform&&i.updateMatrix(),t.bounds&&i.resetBBoxNeedsUpdate(),t.boolean&&i instanceof Yt&&i.invalidateDownstreamBooleanData(),t.render&&i.dispatchEvent({type:"requestRender"})}function Ac(i,t,e){!i||(i[t]={...i[t],...e})}function Eoe(i,t,e,n,r,s,o){let a=()=>{o.transform=!0,o.bounds=!0,o.boolean=!0,o.render=!0};switch(i.on){case"position":case"scale":{let l=xa(i.track,e);if(!l)return;let c=Bb(l.from,l.to,l.t);t[i.on][i.axis]=c,Ac(s,i.on,{[i.axis]:c}),a();return}case"rotation":{let l=xa(i.track,e);if(!l)return;let c=Bb(l.from,l.to,l.t);t.rotation[i.axis]=c*ge.DEG2RAD,Ac(s,"rotation",{[i.axis]:c}),a();return}case"shapeSize":{let l=xa(i.track,e);if(!l||!(t instanceof Yt))return;let c=Bb(l.from,l.to,l.t);t.userData.value={...t.userData.value,[i.axis]:c},Ac(s,"shapeSize",{[i.axis]:c}),o.size=!0,o.bounds=!0,o.boolean=!0,o.render=!0;return}case"opacity":{let l=xa(i.track,e);if(!l||!(t instanceof Kt)||Array.isArray(t.material))return;let c=t.material.getLayersOfType("light")[0];if(c===void 0)return;let u=ge.lerp(l.from,l.to,l.t);t.material.transparent=!0,zO("alphaOverride",c,{alphaOverride:u},{alphaOverride:u+1},0,n.shared),s&&(s.opacity=u),o.render=!0;return}case"material":{let l=xa(i.track,e);if(!l||Object.keys(l.from).length===0||Object.keys(l.to).length===0)return;let{layer:c}=i,u={};for(let d in c.data){if(!(d in l.from)||!(d in l.to))continue;let h=GO(l.from[d],l.to[d],l.t,r);if(h===void 0)continue;u[d]=h;let p=c.getValue(d);p!==void 0&&(d==="alpha"&&typeof p=="number"&&p>0&&t instanceof Kt&&!Array.isArray(t.material)&&(t.material.transparent=!0),zO(d,c,l.from,l.to,l.t,n.shared))}Ac(s,"material",{[c.uuid]:u}),o.render=!0;return}case"light":{let l=xa(i.track,e);if(!l||!(t instanceof pc||t instanceof _h||t instanceof fc))return;let c=GO(l.from,l.to,l.t,r);t[i.field]=c,Ac(s,"light",{[i.field]:c}),o.render=!0;return}case"camera":{let l=xa(i.track,e);if(!l||!(t instanceof rn))return;let c=Bb(l.from,l.to,l.t);t[i.field]=c,Ac(s,"camera",{[i.field]:c});return}case"cloner":{let l=xa(i.track,e);if(!l)return;let u=t.cloner?.parameters,d=H5(u,l.from,l.to,l.t);W5(u,d),Ac(s,"cloner",d),o.cloner=!0,o.boolean=!0,o.render=!0;return}case"pathExtrusion":{let l=xa(i.track,e);if(!l||!$d(t))return;let c=$m(Jy,l.from,l.to,l.t),u=t.geometry.userData.parameters;u.extrusion={...u.extrusion,...c},Ac(s,"pathExtrusion",c),t.updateGeometryInteractions({extrusion:{...u.extrusion}},n.shared),o.bounds=!0,o.boolean=!0,o.render=!0;return}case"pathSnapping":{let l=xa(i.track,e);if(!l)return;let c=t,u=$m(rU,l.from,l.to,l.t);c.userData.pathSnapping={...c.userData.pathSnapping,...u},Ac(s,"pathSnapping",u),c.updatePathSnapping(c.userData.pathSnapping),o.render=!0;return}}}function GO(i,t,e,n){if(typeof i=="string"&&n&&(i=n.color(i)),typeof t=="string"&&n&&(t=n.color(t)),typeof i=="number")return ge.lerp(i,t,e);if(Vt.is(i))return Vt.lerp(i,t,e);if(yr.is(i))return yr.lerp(i,t,e);if(Array.isArray(i))return(i.length>t.length?t:i).map((s,o)=>{if(Array.isArray(s)){let a=i[o].length>t[o].length?t[o].length:i[o].length;return(a===4?Bd:a===3?po:Ws).lerp(i[o],t[o],e)}return ge.lerp(i[o],t[o],e)});if(typeof i=="object"&&i!==null){let r={};for(let s in i){let o=GO(i[s],t[s],e,n);o!==void 0&&(r[s]=o)}return r}}dn();fr();pt();Xs();fr();ii();Xs();em();$i();Mu();q();function K5(i,t,e,n){let r=[],s=i.cameraType==="OrthographicCamera"?t.orthographic?.zoom:t.perspective?.zoom,o=i.cameraType==="OrthographicCamera"?e.orthographic?.zoom:e.perspective?.zoom;if(o!==void 0){let a=s??i.zoom,l=o;a!==l&&r.push({update:c=>{i.zoom=ge.lerp(a,l,c),i.updateProjectionMatrix()},start:()=>{i.zoom=a,i.updateProjectionMatrix()},end:()=>{i.zoom=l,i.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let a=Vr("targetOffset",i,t,e,n);a&&r.push(a)}return r}pt();q();lm();fr();dn();function Toe(i,t,e,n){if(e.scaleBaked===void 0)return;let r=(t.scaleBaked??i.appliedGeometrySize??i.data.geometry.scaleBaked).map(a=>typeof a=="string"?Number(n.shared.getVariable(a)??0):a),s=e.scaleBaked.map(a=>typeof a=="string"?Number(n.shared.getVariable(a)??0):a);if(po.isEqual(r,s))return;let o=[];return o.push({update:a=>{i.updateGeometryInteractions({scaleBaked:[ge.lerp(r[0],s[0],a),ge.lerp(r[1],s[1],a),ge.lerp(r[2],s[2],a)]},n.shared),i.invalidateDownstreamBooleanData(),i.refreshAttachedClonersInteractions(n)},start:()=>{i.updateGeometryInteractions({scaleBaked:r},n.shared),i.invalidateDownstreamBooleanData(),i.refreshAttachedClonersInteractions(n)},end:()=>{i.updateGeometryInteractions({scaleBaked:s},n.shared),i.invalidateDownstreamBooleanData(),i.refreshAttachedClonersInteractions(n)}}),o}function Moe(i,t,e,n){if(!e.extrusion)return;let r=i.extrusion,s=t.extrusion??{},o=e.extrusion,a=[];return Jy.forEach(l=>{let c=hl(l,r,s,o,n);c&&a.push(c)}),a}function Z5(i,t,e,n){let r=[];if(!("geometry"in e)||Xi(i))return r;let s=i.geometry.userData.parameters,o="geometry"in t?t.geometry:{},a=e.geometry;if(i instanceof fa){let l=Toe(i,o,a,n);l&&r.push(...l)}else{let l={},c=i.appliedGeometrySize;if(Object.assign(l,Vy(s,y1),c?{width:c[0],height:c[1],depth:c[2]}:{},Vy(o,y1)),y1.forEach(u=>{let d=hl(u,l,o,a,n.shared);d&&r.push(d)}),$d(i)){Object.assign(l,{extrusion:{...s.extrusion}});let u=Moe(l,o,a,n.shared);u&&r.push(...u)}r.length&&r.push({update:u=>{i.updateGeometryInteractions(l,n.shared),i.updateGeometryGroupsIfNeeded(),i.refreshAttachedClonersInteractions(n)},start:u=>{i.updateGeometryInteractions(l,n.shared),i.updateGeometryGroupsIfNeeded(),i.refreshAttachedClonersInteractions(n)},end:u=>{i.updateGeometryInteractions(l,n.shared),i.updateGeometryGroupsIfNeeded(),i.refreshAttachedClonersInteractions(n)}})}return r}function Q5(i,t,e,n){let r=[];if(e.intensity!==void 0){let s=Vr("intensity",i,t,e,n);s&&r.push(s)}if(e.color!==void 0){let s=V5("color",i,t,e,n);s&&r.push(s)}return r}fr();q();hc();q();var jO=new M,J5=new Ht;function eW(i,t,e,n,r){let s=[],o,a,l,c,u,d,h,p;if(Rr(i)?(o=Ym("position",i,t,e,r),o&&s.push(o),l=Vr("rotation",i,t,e,r),l&&s.push(l),c=Ym("shear",i,t,e,r),c&&s.push(c)):(p={slide:t.pathSnapping?.slide??i.updatedPathSnapping?.slide??i.dataPatched.pathSnapping?.slide??0,offset:t.pathSnapping?.offset??i.updatedPathSnapping?.offset??i.dataPatched.pathSnapping?.offset??0},d=Vr("slide",p,t.pathSnapping??i.updatedPathSnapping??i.dataPatched.pathSnapping,e.pathSnapping??i.dataPatched.pathSnapping,r),d&&s.push(d),h=Vr("offset",p,t.pathSnapping??i.updatedPathSnapping??i.dataPatched.pathSnapping,e.pathSnapping??i.dataPatched.pathSnapping,r),h&&s.push(h),!d&&!h&&(o=VO("position",i,t,e,r),o&&s.push(o),a=VO("scale",i,t,e,r),a&&s.push(a),l=_oe(i,t,e,n,r),l&&s.push(l),u=k5("hiddenMatrix",i,t,e),u&&s.push(u))),o||a||l||u||d||h){let f=Rr(i)?()=>{i.updateWorldMatrix(!0,!1,!0),i.resetBBoxNeedsUpdate()}:()=>{i.updateMatrix(),i.hasNonUniformScale&&(i.updateMatrixWorld(),i.updateMatrixWorldRigid()),i.parent?.matrixWorldFusedFalse&&(i.matrixWorld.multiplyMatrices(i.parent.matrixWorldFusedFalse,i.matrix),i.matrixWorldNeedsUpdate=!1),As(i)&&ds(i.parent)&&i.invalidateDownstreamBooleanData(!0),i.updatePathSnapping(Object.assign({},t.pathSnapping,p))};s.push({update:f,start:f,end:f})}return s}function _oe(i,t,e,n,r){let s=t?.rotation?t.rotation.map(u=>(typeof u=="string"?Number(r.getVariable(u)??0):u)*ge.DEG2RAD):void 0,o=e.rotation?.map(u=>(typeof u=="string"?Number(r.getVariable(u)??0):u)*ge.DEG2RAD);if(!o)return;let a=s?new M().fromArray(s):new M().setFromEuler(i.rotation),l=new M().fromArray(o);if(a.equals(l))return;let c=jO.subVectors(l,a);if(n&&c.toArray().every(u=>Math.abs(u)<2*Math.PI)){let u=new ke().setFromEuler(J5.setFromVector3(a)),d=new ke().setFromEuler(J5.setFromVector3(l));return{update:h=>{U5(u,d,i.quaternion,h)},start:()=>{i.rotation.setFromVector3(a)},end:()=>{i.rotation.setFromVector3(l)}}}else return{update:u=>{jO.lerpVectors(a,l,u),i.rotation.setFromVector3(jO)},start:()=>{i.rotation.setFromVector3(a)},end:()=>{i.rotation.setFromVector3(l)}}}function Aoe(i,t){return{update:()=>{i instanceof sr&&(i.fill.enabled=t)}}}function Coe(i,t){return{update:()=>{i instanceof sr&&(i.stroke.enabled=t)}}}function Poe(i,t){return{update:()=>{i instanceof sr&&(i.dropShadow.enabled=t)}}}function Roe(i,t){return{update:()=>{i instanceof sr&&(i.innerShadow.enabled=t)}}}function Ioe(i,t){return{update:()=>{i instanceof sr&&(i.backgroundBlur.enabled=t)}}}function Ooe(i,t){return{update:()=>{i instanceof sr&&(i.layerBlur.enabled=t)}}}function tW(i,t,e,n,r){let s=[],o,a,l,c,u,d,h,p,f,m,g,y,v,b,x;if("width"in i&&(o=Vr("width",i,t,e,r),o&&s.push(o)),"height"in i&&(a=Vr("height",i,t,e,r),a&&s.push(a)),i instanceof sr||i instanceof Bi){let S={...t.fill},E={...e.fill};S.enabled!==void 0&&S.enabled!==E.enabled&&(s.push(Aoe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),E.enabled||Object.assign(E,{enabled:!0,color:{...E.color,a:0}})),l=kb("color",i.fill,S,E,r),l&&s.push(l)}if(i instanceof sr){let S={...t.stroke},E={...e.stroke};(S.enabled||E.enabled)&&(s.push(Coe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),E.enabled||Object.assign(E,{enabled:!0,color:{...E.color,a:0}})),c=kb("color",i.stroke,S,E,r),c&&s.push(c),u=Vr("thickness",i.stroke,S,E,r),u&&s.push(u)}if(i instanceof sr){let S={...t.dropShadow},E={...e.dropShadow};(S.enabled||E.enabled)&&(s.push(Poe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),E.enabled||Object.assign(E,{enabled:!0,color:{...E.color,a:0}})),d=kb("color",i.dropShadow,S,E,r),d&&s.push(d),h=Vr("blurRadius",i.dropShadow,S,E,r),h&&s.push(h),f=Vr("spread",i.dropShadow,S,E,r),f&&s.push(f),p=Ym("offset",i.dropShadow,S,E,r),p&&s.push(p)}if(i instanceof sr){let S={...t.innerShadow},E={...e.innerShadow};(S.enabled||E.enabled)&&(s.push(Roe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),E.enabled||Object.assign(E,{enabled:!0,color:{...E.color,a:0}})),m=kb("color",i.innerShadow,S,E,r),m&&s.push(m),g=Vr("blurRadius",i.innerShadow,S,E,r),g&&s.push(g),v=Vr("spread",i.innerShadow,S,E,r),v&&s.push(v),y=Ym("offset",i.innerShadow,S,E,r),y&&s.push(y)}if(i instanceof sr||i instanceof Bi){let S={...t.backgroundBlur},E={...e.backgroundBlur};(S.enabled||E.enabled)&&(s.push(Ioe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,radius:0}),E.enabled||Object.assign(E,{enabled:!0,radius:0})),b=Vr("radius",i.backgroundBlur,S,E,r),b&&s.push(b)}if(i instanceof sr){let S={...t.layerBlur},E={...e.layerBlur};(S.enabled||E.enabled)&&(s.push(Ooe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,radius:0}),E.enabled||Object.assign(E,{enabled:!0,radius:0})),x=Vr("radius",i.layerBlur,S,E,r),x&&s.push(x)}if(i instanceof Bi||i instanceof Oo){let S=Ub("cornerRadius",i,t,e,r);S&&s.push(S)}return s}function nW(i,t,e,n,r){let s=[];return i.data.visible&&s.push(...eW(i,t,e,r,n.shared)),Rr(i)?s.push(...tW(i,t,e,r,n.shared)):(i.data.visible&&s.push(...G5(i,t,e,n)),i instanceof Kt?(i instanceof Yt&&i.data.visible&&s.push(...Z5(i,t,e,n)),i.data.visible&&!(i instanceof Mr&&i.materialOverride)&&s.push(...X5(i,t,e,n.shared))):Qf.is(i)?i.data.visible&&s.push(...Q5(i,t,e,n.shared)):i instanceof rn&&s.push(...K5(i,t,e,n.shared))),s.length?{update:o=>{s.forEach(a=>a.update(o))},start:o=>{s.forEach(a=>a.start?.(o))},end:o=>{s.forEach(a=>a.end?.(o))}}:void 0}var HO={type:"beginState"};function WO(i){if(i.easing===5){let{control1:t,control2:e}=i;return{easing:5,control1:t??Kl.defaultData.control1,control2:e??Kl.defaultData.control2}}if(i.easing===6){let{mass:t,stiffness:e,damping:n,velocity:r}=i;return{easing:6,mass:t??ea.defaultData.mass,stiffness:e??ea.defaultData.stiffness,damping:n??ea.defaultData.damping,velocity:r??ea.defaultData.velocity}}return{easing:i.easing}}function qO(i){return{delay:i.delay,delayDirection:i.delayDirection??"start-end",direction:i.direction??"normal",repeat:i.repeat}}function Doe(i){return{duration:i.duration,ease:WO(i),...qO(i)}}var XO={type:"completeState",isfromEntity:!1};function Km(i,t){let e,n;if(typeof t=="string"?(e=t,n=i.states?.[e]):t===null&&(e=null,n=i.data),!(e===void 0||n===void 0))return{id:e,data:n}}var Loe=["position","rotation","scale","shear","hiddenMatrix"],RM=new Set;function rW(i){if(i.length<2)return RM;let t=new Set,[e,...n]=i;for(let r of Loe){let s=e[r];s!==void 0&&n.every(o=>Jo(o[r],s))&&t.add(r)}return t}function Noe(i,t){if(t.size===0)return i;let e={...i};for(let n of t)delete e[n];return e}var Ah=class{constructor(t,e,n,r,s,o,a,l={},c=()=>RM){this.object=t;this.fromRef=e;this.toRef=n;this.data=r;this.sharedAssets=s;this.allowSlerp=o;this.page=a;this.hooks=l;this.inert=c;this.builtReversed=!1;this.startStateId=null;this.buildCallback=()=>{this.builtReversed=this.runner.isReversed,this.startStateId=Rr(this.object)?null:this.object.transitionState.state,this.callback=nW(this.object,{},Noe(this.end.data,this.inert()),{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp)};this.onChange=t=>{this.builtReversed!==this.runner.isReversed&&this.buildCallback(),this.callback&&(this.callback.update(t),this.object.requestRender()),this.writeState(t)};this.runner=new Vm(Doe(r),this.onChange,this.buildCallback),this.rebind()}rebind(){let{fromRef:t,toRef:e}=this;if(t===void 0){let r=Km(this.object,this.object.currentState===e?this.object.prevState:this.object.currentState);if(!r)throw new Error("Missing property");this.from=r}else{let r=Km(this.object,t);if(!r)throw new Error("Missing property");this.from=r}if(e===void 0)throw new Error("Missing property");let n=Km(this.object,e);if(!n)throw new Error("Missing property");this.to=n,this.buildCallback()}refresh(){this.buildCallback()}get endpointData(){return[this.from.data,this.to.data]}get targetStateId(){return this.builtReversed?this.from.id:this.to.id}get start(){return this.builtReversed?this.to:this.from}get end(){return this.builtReversed?this.from:this.to}writeState(t){if(t===0||Rr(this.object))return;let e=t===1,n=t>.5?this.targetStateId:this.startStateId,r=this.object.transitionState;r.settled===e&&r.state===n||(this.object.transitionState={settled:e,state:n},this.object.reversibleToState=this.end.id,this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=n,this.object.dispatchEvent({type:"transitionState",settled:e,state:n}),this.object.dispatchEvent({type:e?"completeState":"beginState",state:n}),this.object.traverseEntity(s=>{s!==this.object&&s instanceof rn&&s.dispatchEvent(e?XO:HO)}),e?this.hooks.onComplete?.(n):this.hooks.onBegin?.(n))}};Xs();var YO=new Map,Vb=new Map,Zs=class extends Mn{constructor(e,n,r,s,o,a,l){super();this.id=e;this.data=n;this.scene=r;this.sharedAssets=s;this.object=o;this.eventType=a;this.actionCondition=l;this.evaluators=[];this.elapsed=0;this.lastTime=null;this.direction=1;this._playing=!1;this._finished=!1;this.hasPlayedOnce=!1;this.pauseOnNextCycleEnd=!1;this.lastCycleIndex=0;try{let c=bo.findTimeline(this.scene.data.objects,this.data.timeline),u=c.duration;this.animatedObjectIds=Object.keys(c.objectTimelines),this.animatedObjectIds.forEach(d=>{let h=this.scene.find(d);if(!h)return;let p=c.objectTimelines[d];!p||this.evaluators.push($5(h,{...p},u,{scene:r,shared:s},this.sharedAssets))}),this.schedule=new qT(YH(this.data,u))}catch(c){throw!1&&console.error(c),new Error("Missing property")}o&&(Vb.has(o.uuid)?Vb.get(o.uuid).push(this):Vb.set(o.uuid,[this])),YO.set(e,this)}get playing(){return this._playing}get finished(){return this._finished}get paused(){return!this._playing}update(e){this.lastTime!==null&&(this.elapsed=Math.max(0,this.elapsed+(e-this.lastTime)*this.direction)),this.lastTime=e,this.applyAtElapsed()}applyAtElapsed(){if(this.direction===-1&&this.elapsed===0){this.pause();return}let e=this.schedule.resolve(this.elapsed);if(e){if(e.cycleIndex!==this.lastCycleIndex&&(this.lastCycleIndex=e.cycleIndex,this.pauseOnNextCycleEnd)){this.pauseOnNextCycleEnd=!1,this.pause();return}for(let n of this.evaluators)n.evaluate(e.localTime);return}this.direction===1&&this.schedule.isFinished(this.elapsed)&&this.finish()}finish(){this.pause(),this._finished=!0,this.animatedObjectIds.forEach(e=>{let n=this.scene.find(e);n instanceof rn&&n.dispatchEvent(XO)})}startTicking(){this._playing=!0,this.lastTime=null;for(let e of this.evaluators)e.invalidate();cr.add(this)}play(){let e=this.eventType!==void 0&&Ky(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&this.paused&&this.elapsed>0&&!this._finished;if(this.eventType!==void 0&&Ky(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&!e||this.eventType===void 0&&this._finished)return!1;this.hasPlayedOnce=!0,this.animatedObjectIds.forEach(n=>{let r=this.scene.find(n);r instanceof rn&&r.dispatchEvent(HO)}),!e&&(this.elapsed===0||this._finished)&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.startTicking()}pause(){this._playing=!1,this.lastTime=null,cr.remove(this)}stop(){this.pause(),this.elapsed=0,this.lastCycleIndex=0,this.applyAtElapsed(),this._finished=!1}seek(e){let n=this.schedule.totalDuration;this.elapsed=e*(Number.isFinite(n)?n:this.schedule.effectiveCycleDuration);for(let r of this.evaluators)r.invalidate();this.applyAtElapsed()}toggle(e){let n=e??this.direction===-1;if(this._playing&&this.direction===(n?1:-1)){n&&(this.pauseOnNextCycleEnd=!1);return}n?(this._finished&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.pauseOnNextCycleEnd=!1):(this.direction=this.schedule.resolve(this.elapsed)?.isReverse?1:-1,this.pauseOnNextCycleEnd=!0),this.startTicking()}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}},$O=class{constructor(t){this.data=t}dispatch(){this.data.playTimeline?this.pauseTimeline(this.data.playTimeline):this.data.object?this.pauseAllTimelinesFromObject(this.data.object):this.pauseAllTimelines()}pauseTimeline(t){let e=this.getTimelineActions(t);!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(n=>{n[this.data.interaction]()}),this.disposeDelay()},this.data.delay)):e.forEach(n=>{n[this.data.interaction]()}))}getTimelineActions(t){let e=YO.get(t);return e?[e]:[...YO.values()].filter(n=>n.data.timeline===t)}pauseAllTimelinesFromObject(t){let e=Vb.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(n=>n[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(n=>n[this.data.interaction]()))}pauseAllTimelines(){let t=[...Vb.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(n=>{n[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(n=>{n[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},IM=class{constructor(t,e,n,r,s,o,a){this.data=e;let l="interaction"in e?e.interaction:"play";if(l==="play"||l===void 0)this.interaction=new Zs(t,e,n,r,s,o,a);else if(l==="pause"||l==="stop")this.interaction=new $O(e);else throw new Error("Missing property")}get playing(){return this.interaction instanceof Zs?this.interaction.playing:!1}get finished(){return this.interaction instanceof Zs?this.interaction.finished:!0}get paused(){return this.interaction instanceof Zs?this.interaction.paused:!0}play(){if(this.interaction instanceof Zs)return this.interaction.play();this.interaction.dispatch()}stop(){this.interaction instanceof Zs&&this.interaction.stop()}seek(t){this.interaction instanceof Zs&&this.interaction.seek(t)}toggle(t){this.interaction instanceof Zs?this.interaction.toggle(t):this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof Zs?this.interaction.playFromCurrent():this.interaction.dispatch()}dispatchConditional(){this.interaction instanceof Zs?Xt(this.interaction.sharedAssets,this.interaction.actionCondition)&&this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof Zs&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};Qt();mr("TimelineAnimation",({id:i,data:t,page:e,shared:n,object:r,eventType:s,actionCondition:o})=>new IM(i,t,e.scene,n,r,s,o));Mt("timeline");fr();pt();q();Xs();function iW(i){let t=i.tweens[0]?.data;return{delay:t?.delay??i.delay,delayDirection:t?.delayDirection??"start-once",direction:t?.direction??i.direction,repeat:t?.repeat??i.repeat}}var Boe={state:null,duration:0,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,easing:0},OM=class extends Mn{constructor(e,n,r,s,o,a){super();this.eventType=e;this.data=n;this.page=r;this.shared=s;this.condition=o;this.runModeOverride=a;this.tweens=[];this.hasPlayedOnce=!1;this.inert=RM;if(!n.object)throw new Error("Missing property");let l=this.page.scene.find(n.object)??this.page.uiCanvas?.find(n.object)??this.page.scene.find2DInUIObjects(n.object);if(!l)throw new Error("Missing property");if(!l.states)throw new Error("Missing property");if(this.object=l,n.tweens.length<2)throw new Error("Missing property");this.init()}get playing(){return this.runner?.isPlaying===!0}get animating(){return this.runner?.isAnimating===!0}get claimTime(){return this.runner?.claimTime}get contested(){let e=this.object.previousAction;return e!==null&&e!==this&&e.animating}init(){this.initialCurrentState=Km(this.object,this.object.currentState).id,this.build()}shouldReinit(){return Xt(this.shared,this.condition)?!0:!(this.animating&&!this.loopsForever)}get loopsForever(){return iW(this.data).repeat===-1||this.data.tweens.some((e,n)=>n>0&&e.data.repeat===-1)}get runMode(){return this.runModeOverride!==void 0?this.runModeOverride:Ky(this.eventType)?this.data.runMode:"Repeat"}get currentState(){return this.runMode==="Toggle"?this.initialCurrentState:this.object.currentState}get opensOnCurrent(){return this.data.tweens[0].data.state===void 0&&this.runMode!=="Toggle"}build(){let e=this.data.tweens,n=[];try{let r=e[0].data.state;r!==void 0&&n.push(new Ah(this.object,r,r,Boe,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert));for(let s=1;s<e.length;s++){let o=e[s-1],a=e[s];n.push(new Ah(this.object,o.data.state===void 0?this.currentState:o.data.state,a.data.state===void 0?this.currentState:a.data.state,a.data,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert))}}catch(r){r instanceof Error&&console.error(r.message);return}this.tweens=n,this.syncInert(),this.runner=new km({...qO(iW(this.data)),runMode:this.runMode},n.map(r=>r.runner),{claim:r=>this.claimObject(r),assignCurrentState:()=>this.rebindTweens(),isOwner:()=>this.object.previousAction===this})}claimObject(e){if(this.object.previousAction===this)return!1;let n=this.object.previousAction;if(n?.animating===!0){if(e!==void 0&&n.claimTime!==void 0&&n.claimTime>e)return!1;n.pause()}return this.object.previousAction=this,!0}rebindTweens(){for(let e of this.tweens)try{e.rebind()}catch(n){n instanceof Error&&console.error(n.message)}this.syncInert(),this.object instanceof rn&&this.object.wasMovedByUser&&(this.object.wasMovedByUser=!1)}syncInert(){let e=this.tweens.flatMap(n=>n.endpointData);if(this.opensOnCurrent&&e.length>0){let n=Km(this.object,this.object.currentState);n&&(e[0]=n.data)}this.inert=rW(e);for(let n of this.tweens)n.refresh()}update(e){this.runner?.update(e),this.runner?.isPlaying!==!0&&cr.remove(this)}play(){if(Xt(this.shared,this.condition)===!1||this.runMode==="Once"&&this.hasPlayedOnce)return!1;this.hasPlayedOnce=!0,this.start()}start(){!this.runner||(this.runner.play(cr.time),this.runner.isPlaying&&cr.add(this))}pause(){this.runner?.stop(),cr.remove(this)}stop(){this.pause();let e=this.data.tweens[0].data.state===void 0?this.initialCurrentState:this.data.tweens[0].data.state;Rr(this.object)?this.object.changeSelectedState(e,{shared:this.shared}):this.object.changeSelectedState(e,{scene:this.page.scene,shared:this.shared}),this.object.currentState=e}seek(e){if(Xt(this.shared,this.condition)===!1)return!1;this.runner?.seek(e)}playDirected(e){if(Xt(this.shared,this.condition)===!1)return!1;!this.runner||(this.runner.playDirected(cr.time,e),this.runner.isPlaying&&cr.add(this))}playFromCurrent(){this.playDirected(!0)}reverseFromCurrent(){this.playDirected(!1)}dispose(){this.pause()}};pt();q();dn();function DM(i){let t=i?.tracks.filter(e=>e.ValueTypeName==="vector"||e.ValueTypeName==="quaternion").map(e=>e.times.length);if(t?.length){let e=X3(t);return e&&e>2?e:2}return 2}var Zm=new Map,zb=new WeakSet;function sW(i,t){if(t===void 0)return;let e=i.scene.find(t);return e&&Array.isArray(e.identity)?e.identity[0]:t}var Sa=class extends Mn{constructor(e,n,r,s,o){super();this.page=n;this.animationControls=r;this.shared=s;this.condition=o;this.startOnceDelay=0;this.toggleIsForward=!1;let a=sW(n,e.object)??e.object;this.data={...e,object:a};let l=this.animationControls.clipIdToAction[e.clipId+"/"+a];if(this.duration=l?.getClip()?.duration??1,this.data.crop2){let u=DM(l?.getClip());this.leftFrameTime=this.data.crop2[0]/(u-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(u-1)*this.duration}else{let u=l?.getClip()?.tracks[0]?.times.length;u&&u>1?(this.leftFrameTime=this.data.crop[0]/u*this.duration,this.rightFrameTime=this.data.crop[1]/u*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=e.delay;let c=Zm.get(a);c||(c=new Set,Zm.set(a,c)),c.add(this)}get playing(){return this.threeAnimAction?.isRunning()??!1}cancelPending(){window.clearTimeout(this.timeoutId),delete this.timeoutId}resume(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object];return!e||!zb.has(e)?!1:(zb.delete(e),this.threeAnimAction=e,e.paused=!1,e.play(),this.animationControls.requestRender(),!0)}play(e=!1){if(Xt(this.shared,this.condition)===!1)return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{if(this.resume()||(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction))return;zb.delete(this.threeAnimAction),this.threeAnimAction.reset(),this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime;let n=this.data.object;Object.entries(this.animationControls.clipIdToAction).forEach(([r,s])=>{let o=r.split("/")[1];this.threeAnimAction!==s&&o===n&&(e?s.fadeOut(.2):s.stop())}),e&&this.threeAnimAction?.fadeIn(.2)},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),this.cancelPending()}stop(){this.threeAnimAction?.fadeOut(.2)}seek(e){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=ge.clamp(this.threeAnimAction.time+1/60*e,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(e,n=!1){if(Xt(this.shared,this.condition)===!1)return!1;this.toggleIsForward=e??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing||this.resume()?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction){this.toggleIsForward?(this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction.time=this.rightFrameTime,this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime),this.threeAnimAction.paused=!1,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1;let r=this.data.clipId.split("/")[1];Object.entries(this.animationControls.clipIdToAction).forEach(([s,o])=>{let a=s.split("/")[1];this.threeAnimAction!==o&&a===r&&o.isRunning()&&(n?o.fadeOut(.2):o.stop())}),n&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();e&&(e.duration=this.duration),this.pause();let n=Zm.get(this.data.object);n&&(n.delete(this),n.size===0&&Zm.delete(this.data.object))}},KO=class{constructor(t,e,n){this.data=t;this.page=e;this.animationControls=n;this.objectId=sW(e,t.object)}dispatch(){this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{this.apply(),this.disposeDelay()},this.data.delay)):this.apply()}targetsClip(t,e){return!(this.objectId!==void 0&&e!==this.objectId||this.data.clipId&&t!==this.data.clipId)}apply(){(this.objectId!==void 0?[Zm.get(this.objectId)]:[...Zm.values()]).forEach(n=>{n?.forEach(r=>{this.targetsClip(r.data.clipId,r.data.object)&&r.cancelPending()})});let e=!1;Object.entries(this.animationControls.clipIdToAction).forEach(([n,r])=>{let[s,o]=n.split("/");if(!!this.targetsClip(s,o))if(this.data.interaction==="pause"){if(!r.isRunning())return;r.paused=!0,zb.add(r)}else{if(!r.enabled||!r.isRunning()&&!r.paused)return;r.paused=!0,zb.delete(r),r.time=r._clip.start??0,r._loopCount=-1,e=!0}}),e&&(this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){this.disposeDelay()}},LM=class{constructor(t,e,n,r,s){QS.isPause(t)?this.interaction=new KO(t,e,n):this.interaction=new Sa(t,e,n,r,s)}get data(){return this.interaction.data}get playing(){return this.interaction instanceof Sa?this.interaction.playing:!1}play(t=!1){if(this.interaction instanceof Sa)return this.interaction.play(t);this.interaction.dispatch()}pause(){this.interaction instanceof Sa&&this.interaction.pause()}stop(){this.interaction instanceof Sa&&this.interaction.stop()}seek(t){this.interaction instanceof Sa&&this.interaction.seek(t)}toggle(t,e=!1){if(this.interaction instanceof Sa)return this.interaction.toggle(t,e);this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof Sa?this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof Sa&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};var oW=null;function aW(i){oW=i}function lW(){return oW}Qt();aW(Ah);mr("Transition",({eventType:i,data:t,page:e,shared:n,actionCondition:r,runModeOverride:s})=>new OM(i,t,e,n,r,s));mr("Animation",({data:i,page:t,eventManager:e,shared:n,actionCondition:r})=>new LM(i,t,e.animationControls,n,r));Mt("transitions");dn();var Foe="text/plain",Uoe="us-ascii",cW=(i,t)=>t.some(e=>e instanceof RegExp?e.test(i):e===i),koe=(i,{stripHash:t})=>{let e=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(i);if(!e)throw new Error(`Invalid URL: ${i}`);let{type:n,data:r,hash:s}=e.groups,o=n.split(";");s=t?"":s;let a=!1;o[o.length-1]==="base64"&&(o.pop(),a=!0);let l=(o.shift()||"").toLowerCase(),u=[...o.map(d=>{let[h,p=""]=d.split("=").map(f=>f.trim());return h==="charset"&&(p=p.toLowerCase(),p===Uoe)?"":`${h}${p?`=${p}`:""}`}).filter(Boolean)];return a&&u.push("base64"),(u.length>0||l&&l!==Foe)&&u.unshift(l),`data:${u.join(";")},${a?r.trim():r}${s?`#${s}`:""}`};function ZO(i,t){if(t={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...t},i=i.trim(),/^data:/i.test(i))return koe(i,t);if(/^view-source:/i.test(i))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let e=i.startsWith("//");!e&&/^\.*\//.test(i)||(i=i.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,t.defaultProtocol));let r=new URL(i);if(t.forceHttp&&t.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(t.forceHttp&&r.protocol==="https:"&&(r.protocol="http:"),t.forceHttps&&r.protocol==="http:"&&(r.protocol="https:"),t.stripAuthentication&&(r.username="",r.password=""),t.stripHash?r.hash="":t.stripTextFragment&&(r.hash=r.hash.replace(/#?:~:text.*?$/i,"")),r.pathname){let o=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,a=0,l="";for(;;){let u=o.exec(r.pathname);if(!u)break;let d=u[0],h=u.index,p=r.pathname.slice(a,h);l+=p.replace(/\/{2,}/g,"/"),l+=d,a=h+d.length}let c=r.pathname.slice(a,r.pathname.length);l+=c.replace(/\/{2,}/g,"/"),r.pathname=l}if(r.pathname)try{r.pathname=decodeURI(r.pathname)}catch{}if(t.removeDirectoryIndex===!0&&(t.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(t.removeDirectoryIndex)&&t.removeDirectoryIndex.length>0){let o=r.pathname.split("/"),a=o[o.length-1];cW(a,t.removeDirectoryIndex)&&(o=o.slice(0,-1),r.pathname=o.slice(1).join("/")+"/")}if(r.hostname&&(r.hostname=r.hostname.replace(/\.$/,""),t.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(r.hostname)&&(r.hostname=r.hostname.replace(/^www\./,""))),Array.isArray(t.removeQueryParameters))for(let o of[...r.searchParams.keys()])cW(o,t.removeQueryParameters)&&r.searchParams.delete(o);if(t.removeQueryParameters===!0&&(r.search=""),t.sortQueryParameters){r.searchParams.sort();try{r.search=decodeURIComponent(r.search)}catch{}}t.removeTrailingSlash&&(r.pathname=r.pathname.replace(/\/$/,""));let s=i;return i=r.toString(),!t.removeSingleSlash&&r.pathname==="/"&&!s.endsWith("/")&&r.hash===""&&(i=i.replace(/\/$/,"")),(t.removeTrailingSlash||r.pathname==="/")&&r.hash===""&&t.removeSingleSlash&&(i=i.replace(/\/$/,"")),e&&!t.normalizeProtocol&&(i=i.replace(/^http:\/\//,"//")),t.stripProtocol&&(i=i.replace(/^(?:https?:)?\/\//,"")),i}var NM=class{constructor({url:t,context:e},n,r,s){this.controlsManager=n;this.shared=r;this.condition=s;if(!t)throw new Error("Missing property");this.url=t.startsWith("mailto:")?t:ZO(t,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=e??"tab"}dispatch(){if(Xt(this.shared,this.condition)===!1)return!1;lo?window.location.assign(this.url):(this.context==="tab"||AC&&this.context==="none"?window.open(this.url,"_blank"):this.context==="window"?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(mt[0]),B3())}};var BM=class{constructor(t,e,n,r,s){this.data=t;this.page=e;this.shared=n;this.eventManager=r;this.condition=s}dispatch(){if(Xt(this.shared,this.condition)===!1)return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),qm(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},(this.data.delay??0)*1e3)}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}};q();var Voe={type:"beginState"},uW={type:"completeState",isfromEntity:!1},dW={type:"requestRender"},FM=class extends Mn{constructor(e,n,r,s){super();this.data=e;this.page=n;this.shared=r;this.condition=s;this.toggleIsForward=!1;this.posStart=new M;this.posEnd=new M;this.qStart=new ke;this.qEnd=new ke;this.zoomStart=1;this.zoomEnd=1}init(){}get playing(){return this.runner?.isPlaying===!0}buildAnimation(e=!1){if(!this.data.animate)return;let n=this.page.scene.find(this.data.targetCamera);if(!n||!n.visible)throw new ReferenceError("Target camera not founded or not visible");this.posStart.copy(this.page.activeCamera.position),this.qStart.copy(this.page.activeCamera.quaternion),this.zoomStart=this.page.activeCamera.zoom;let r={duration:this.data.duration,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,ease:WO(this.data)},s=o=>{let a=this.page.activeCamera;a.position.lerpVectors(this.posStart,this.posEnd,o),a.quaternion.slerpQuaternions(this.qStart,this.qEnd,o),a.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*o,a.wasMovedBySwitchCameraAction=!0,a.updateMatrix(),a.updateMatrixWorld(),a.updateProjectionMatrix(),a.dispatchEvent(dW),o===1&&a.dispatchEvent(uW)};this.runner=new Vm(r,s,()=>{this.data.runMode==="Toggle"&&!this.toggleIsForward?this.fromCamera&&(this.posEnd.copy(this.fromCamera.position),this.qEnd.copy(this.fromCamera.quaternion),this.zoomEnd=this.fromCamera.zoom,this.switchCamera(this.fromCamera.uuid)):(this.posEnd.copy(n.position),this.qEnd.copy(n.quaternion),this.zoomEnd=n.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(n.uuid)),this.page.activeCamera.dispatchEvent(Voe),s(0)})}update(e){this.runner?.update(e),this.runner?.isPlaying!==!0&&cr.remove(this)}start(){!this.runner||(this.runner.start(cr.time),cr.add(this))}switchCamera(e){let n=this.page.activeCamera,r=this.page.scene.find(e);if(!r||!r.visible)throw new ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(r),n.dispatchEvent({type:"cameraChange",camera:r})}play(){if(Xt(this.shared,this.condition)===!1)return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(),this.start()):this.switchCamera(this.data.targetCamera)},this.data.delay*1e3)}catch{}}pause(){this.runner?.stop(),cr.remove(this),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(e){if(Xt(this.shared,this.condition)===!1)return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,e!==this.toggleIsForward)try{this.playing?(this.runner?.stop(),this.toggleIsForward=e??!this.toggleIsForward,this.buildAnimation(!0),this.start()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=e??!this.toggleIsForward,this.data.animate?(this.runner?.stop(),this.buildAnimation(),this.start()):(this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.switchCamera(this.data.targetCamera)):this.fromCamera&&this.switchCamera(this.fromCamera.uuid),this.page.activeCamera.dispatchEvent(uW),this.page.activeCamera.dispatchEvent(dW))},this.data.delay*1e3)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}};Yw();var UM=class{constructor(t,e,n,r){this.data=t;this.page=e;this.shared=n;this.condition=r}dispatch(){if(Xt(this.shared,this.condition)===!1)return!1;(this.data.target==="single"?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEach(e=>{this.shared.getVariable(e);let n=this.shared.data.variables.data(e)?.value;n!==void 0&&this.shared.updateVariable(e,n),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(Xw(e))})}dispose(){}};Qt();mr("Link",({data:i,eventManager:t,shared:e,actionCondition:n})=>new NM(i,t.controlsManager,e,n));mr("Reset",({data:i,page:t,shared:e,eventManager:n,actionCondition:r})=>new BM(i,t,e,n,r));mr("SwitchCamera",({data:i,page:t,shared:e,actionCondition:n})=>new FM(i,t,e,n));mr("ClearLocalStorage",({data:i,page:t,shared:e,actionCondition:n})=>new UM(i,t,e,n));Mt("misc-actions");Qt();$i();tl();KM();Yw();var ZM=class{get sharedAssets(){return this.shared}constructor(t,e={},n=!0){this.shared=new Tu(t.shared,e,!0,n),this.scene=new Xu(t.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(t,e){this.scene.clearScene(),this.sharedAssets.reset(t.shared),this.scene.resetAfterClear(t.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let t of this.scene.children)t instanceof Cn&&!t.uiScene&&t.personalCamera.updateState(t.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(t=>{t instanceof Yt&&t.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}};KM();an();var QM="vertexOrder";function YW(i){let t=i.attributes.find(a=>a.name===QM);if(!t)return i;let e=t.array,n=e.length,r=0;for(let a=0;a<n;a++)r=Math.max(r,e[a]+1);let s=i.attributes.filter(a=>a!==t).map(({name:a,itemSize:l,array:c})=>{let u=new Float32Array(r*l);for(let d=0;d<n;d++){let h=e[d]*l,p=d*l;for(let f=0;f<l;f++)u[h+f]=c[p+f]}return{name:a,itemSize:l,array:u}}),o;if(i.index){let a=i.index.array,l=new Uint32Array(a.length);for(let c=0;c<a.length;c++)l[c]=e[a[c]];o={array:l}}return{index:o,attributes:s}}var Rh,lD;function cD(i){return lD||(lD=Promise.resolve().then(()=>(KW(),$W)).then(({DRACOLoader:t})=>(Rh=new t,Rh.setDecoderPath(i!==void 0?`${i}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),Rh.decoderPending))),lD}async function aae(i){if(Rh){let t={attributeIDs:{...Rh.defaultAttributeIDs,[QM]:"GENERIC"},attributeTypes:{...Rh.defaultAttributeTypes,[QM]:"Uint32Array"},useUniqueIDs:!1},e;try{e=await Rh.decodeGeometry(new Int8Array(i).buffer,t)}catch(n){console.error(n)}if(e)return YW({index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([n,r])=>({name:n,itemSize:r.itemSize,array:r.array}))})}return null}async function ZW(i,t){let[e,n]=Dd(Nd.deserialize(new Uint8Array(i)));if((e.schema??0)!==132){let{updateDocumentSchema:r}=await Promise.resolve().then(()=>(iv(),RU));r(e)}return t&&t(e),n.result().data}function QW(i){let t=[];return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&n.geometry.type==="NonParametricGeometry"&&n.geometry.data.draco!==void 0&&t.push(n)}),t}async function uD(i){for(let t of i){let e=await aae(t.geometry.data.draco);if(e){let n=t.geometry.data;e.index&&(n.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let r={};e.attributes.forEach(({name:s,array:o,itemSize:a})=>{r[s]={array:o,itemSize:a,type:"Float32Array",normalized:!1}}),n.attributes=r,n.draco=void 0}}}bv();nh();Zf();lm();fw();hc();Lv();iD();sD();Co();q();q();function JW(i){let t=this._clip.duration,e=this._clip.start??0,n=this.loop,r=this.time+i,s=this._loopCount,o=n===Dp;if(i===0)return s===-1?r:o&&(s&1)===1?t-(r-e):r;if(n===uS){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:i<0?-1:1})}}else{if(s===-1&&(i>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<e){let a=Math.floor((r-e)/(t-e));r-=(t-e)*a,s+=Math.abs(a);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,o||(r=i>0?t:e,this.repetitions===1&&(r=t)),this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:i>0?1:-1});else{if(l===1){let c=i<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-(r-e)}return r}var e6=!1,JM=class{constructor(t,e,n,r){this.scene=t;this.requestRender=e;this.updateDisplayProgress=n;this.animationInspectorState=r;this.clipIdToAction={};this.activeClip=null;this.needsUpdate=!1;this.addClip=t=>{t.data.type==="Empty"&&Array.isArray(t.data.animations)&&t.data.animations.forEach((e,n)=>{let r=e[0]+"/";if(Array.isArray(t.identity)?r+=t.identity[0]:r+=t.uuid,this.clipIdToAction[r])return;let s=Sd.parse(JSON.parse(e[2]));t.animations[n]=s;let o=this.mixer.clipAction(s,t);e6===!1&&(Object.getPrototypeOf(o)._updateTime=JW,e6=!0),o.clampWhenFinished=!0,this.clipIdToAction[r]=o})};this.mixer=new _p(t),this.scene.traverseEntity(this.addClip)}rebindClips(){this.mixer.stopAllAction(),this.mixer=new _p(this.scene),this.clipIdToAction={},this.activeClip=null,this.scene.traverseEntity(this.addClip)}deleteClip(t,e){let n=this.scene.find(e);if(!n)return;let r=n.animations.find(o=>o.uuid===t);if(!r)return;let s=this.clipIdToAction[t];!s||(s.stop(),this.mixer.uncacheClip(r),delete this.clipIdToAction[t],n.animations=n.animations.filter(o=>o.uuid!==t))}get isPlaying(){return Object.values(this.clipIdToAction).some(t=>t.isRunning())}playFromInspector(t){this.mixer.stopAllAction();let e=this.clipIdToAction[t];!e||(e.play(),this.activeClip=e.getClip(),this.scene.markShadowsDirty(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(t=>{t.repetitions=1/0,t.loop=Py}),this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}play(t){let e=t.clipId+"/"+t.object,n=this.clipIdToAction[e];if(!!n)return n.repetitions=t.repeat>=0?t.repeat+1:1/0,n.loop=(t.direction==="pingpong"||t.direction==="pingpong-rewind")&&t.repeat!==0?Dp:Py,n.play(),n.paused=!1,this.requestRender(),n}resumeFromInspector(t){let e=this.clipIdToAction[t];!e||(e.play(),e.paused=!1,this.scene.markShadowsDirty(),this.requestRender())}pauseFromInspector(t){let e=this.clipIdToAction[t];!e||(e.paused=!0)}stop(){this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}update(t){if(this.needsUpdate)this.needsUpdate=!1;else if(this.isPlaying===!1||this.animationInspectorState?.isScrubbing)return;this.mixer.update(t/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return DM(this.activeClip??void 0)}setProgressFromInspector(t,e){if(!this.clipIdToAction[e])return;this.activeClip!==this.clipIdToAction[e].getClip()&&this.playFromInspector(e);let n=this.clipIdToAction[e].paused;this.clipIdToAction[e].paused=!1,this.mixer.setTime(Math.min(t/(this.maxFrames-1),.9999)*this.activeClip.duration),this.scene.markShadowsDirty(),this.requestRender(),n&&(this.clipIdToAction[e].paused=!0)}};aa();tl();y2();Mu();em();p2();hD();function s6(i){let t=new Set;return i.scene.objects.traverse((e,n)=>{if(n.type!=="Page")return;let r=n.postprocessing;if(!(!r||typeof r!="object"||r.enabled!==!0))for(let[s,o]of Object.entries(r))s!=="enabled"&&o&&typeof o=="object"&&o.enabled===!0&&t.add(s)}),[...t]}var Ele={bloom:()=>Promise.resolve().then(()=>(C6(),mle)),chromaticAberration:()=>Promise.resolve().then(()=>(R6(),gle)),vignette:()=>Promise.resolve().then(()=>(O6(),yle)),noise:()=>Promise.resolve().then(()=>(L6(),vle)),hueSaturation:()=>Promise.resolve().then(()=>(B6(),ble)),brightnessContrast:()=>Promise.resolve().then(()=>(U6(),xle)),depthOfField:()=>Promise.resolve().then(()=>(V6(),Sle)),pixelation:()=>Promise.resolve().then(()=>(G6(),wle))};function Tle(i,t,e){return Promise.all(i.map(n=>t[n]?.().catch(r=>{console.warn(`[spline] Failed to load the ${n} postprocessing effect (${e}); the effect will be skipped.`,r)}))).then(()=>{})}function j6(i){return Tle(i,Ele,"webgl")}var i_=new WeakMap,H6=new WeakMap;function W6(i,t){H6.set(i,t)}function q6(i,t){return H6.get(i)===t}function X6(i){return i.backend?.isWebGLBackend===!0}function Y6(i){let t=i.backend;if(t!==void 0)return t.isWebGLBackend===!0?t.gl??null:null;let e=i.getContext,n=typeof e=="function"?e.call(i):null;return n&&typeof n.getExtension=="function"?n:null}function $6(i,t,e){let n=r=>{i.removeEventListener(t,n,!0),r.stopImmediatePropagation(),e(r)};return i.addEventListener(t,n,!0),()=>i.removeEventListener(t,n,!0)}function K6(i,t){let e=t.getExtension("WEBGL_lose_context");if(!e||t.isContextLost())return()=>{};let n=()=>{},r=new Promise(s=>{n=$6(i,"webglcontextlost",o=>{o.preventDefault(),s(e)})});return i_.set(i,{gl:t,lost:r,stopListening:n}),()=>{t.isContextLost()||e.loseContext()}}async function Z6(i){let t=i_.get(i);if(!!t&&(t.restoring??(t.restoring=Mle(i,t).finally(()=>{t.restoring=void 0,!t.gl.isContextLost()&&i_.get(i)===t&&i_.delete(i)})),await t.restoring,t.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}async function Mle(i,t){if(!t.gl.isContextLost()){t.stopListening();return}let e=()=>{},n=t.lost.then(o=>new Promise(a=>{e=$6(i,"webglcontextrestored",()=>a()),o.restoreContext()})),r,s=new Promise(o=>{r=setTimeout(o,2e3)});await Promise.race([n,s]),clearTimeout(r),e(),t.stopListening()}dn();var sX=ed(J6(),1);q();dn();var _le="allow-scripts allow-forms allow-pointer-lock",e8=500;function s_(i){return Array.isArray(i)||ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Ale(i){return{id:i.uuid,name:i.name,type:i.object.data?.type??i.object.type,visible:i.playModeVisible!==!1,position:{x:i.position.x,y:i.position.y,z:i.position.z},rotation:{x:i.rotation.x*ge.RAD2DEG,y:i.rotation.y*ge.RAD2DEG,z:i.rotation.z*ge.RAD2DEG},scale:{x:i.scale.x,y:i.scale.y,z:i.scale.z},spawned:!0}}function o_(i){return{id:i.uuid,name:i.name,type:i.type??"Object",visible:i.visible,position:{x:i.position.x,y:i.position.y,z:i.position.z},rotation:{x:i.rotation.x*ge.RAD2DEG,y:i.rotation.y*ge.RAD2DEG,z:i.rotation.z*ge.RAD2DEG},scale:{x:i.scale.x,y:i.scale.y,z:i.scale.z}}}function wD(i,t,e){let n=o=>i.findObjectById(o)??i.findObjectByName(o),r=new Map,s=o=>{let a=r.get(o);if(a)return a;for(let l of r.values())if(l.name===o)return l};return{setVariable:(o,a)=>o in i.getVariables()?(i.setVariable(o,a),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${o}" in this scene.`},getVariable:o=>i.getVariable(o),getVariables:()=>i.getVariables(),getAllObjects:()=>i.getAllObjects().map(o_),findObject:o=>{let a=n(o);return a?o_(a):void 0},getGeometry:(o,a)=>{if(!e)return{warning:"spline.getGeometry: not available in this runtime integration."};let l=s(o),c=l?l.object:(()=>{let p=n(o);return p?e.findEntity(p.uuid):void 0})();if(!c)return{warning:`spline.getGeometry: no object named "${o}" (names/ids come from getAllObjects).`};let u=l??c,d;a.space==="world"&&(u.updateWorldMatrix?.(!0,!1),d=u.matrixWorld?.elements);let h=aB(c.geometry,d);return h?{data:{id:u.uuid,name:u.name,geometry:c.data?.geometry?.type,...h}}:{warning:`spline.getGeometry: "${u.name}" has no readable geometry \u2014 only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(o,a)=>{let l=s(o);if(l){let{position:g,rotation:y,scale:v,visible:b}=a;return g&&(typeof g.x=="number"&&(l.position.x=g.x),typeof g.y=="number"&&(l.position.y=g.y),typeof g.z=="number"&&(l.position.z=g.z)),y&&(typeof y.x=="number"&&(l.rotation.x=y.x*ge.DEG2RAD),typeof y.y=="number"&&(l.rotation.y=y.y*ge.DEG2RAD),typeof y.z=="number"&&(l.rotation.z=y.z*ge.DEG2RAD)),v&&(typeof v.x=="number"&&(l.scale.x=v.x),typeof v.y=="number"&&(l.scale.y=v.y),typeof v.z=="number"&&(l.scale.z=v.z)),typeof b=="boolean"&&(l.playModeVisible=b),l.updateMatrix(),i.requestRender(),!0}let c=n(o);if(!c)return!1;let{position:u,rotation:d,scale:h,visible:p,geometry:f,material:m}=a;if(f&&typeof f=="object"&&e){let g=e.findEntity(c.uuid);if(g){let{vertices:y,normals:v,uvs:b,indices:x,...S}=f;s_(y)&&e.shared.updateEntityGeometryVertices(g,{vertices:y,normals:s_(v)?v:void 0,uvs:s_(b)?b:void 0,indices:s_(x)?x:void 0}),Object.keys(S).length>0&&e.shared.updateEntityGeometryParams(g,S)}}if(m&&typeof m=="object"&&e){let g=e.findEntity(c.uuid);g&&e.shared.updateEntityMaterialParams(g,m)}return u&&(typeof u.x=="number"&&(c.position.x=u.x),typeof u.y=="number"&&(c.position.y=u.y),typeof u.z=="number"&&(c.position.z=u.z)),d&&(typeof d.x=="number"&&(c.rotation.x=d.x*ge.DEG2RAD),typeof d.y=="number"&&(c.rotation.y=d.y*ge.DEG2RAD),typeof d.z=="number"&&(c.rotation.z=d.z*ge.DEG2RAD)),h&&(typeof h.x=="number"&&(c.scale.x=h.x),typeof h.y=="number"&&(c.scale.y=h.y),typeof h.z=="number"&&(c.scale.z=h.z)),typeof p=="boolean"&&(c.visible=p),i.requestRender(),!0},createObject:async(o,a)=>{let l=await i.createObject(o,a);return o_(l)},createCustomMaterial:o=>i.createCustomMaterial(o),getTexture:(o,a)=>{if(!e)return null;let l=n(o),c=l?e.findEntity(l.uuid):void 0;if(!c)return null;let u=e.shared.getEntityTexture(c,a??{});return u?{texture:u.texture,width:u.width,height:u.height,layer:u.layerType}:null},setMaterial:(o,a)=>i.setMaterial(o,a),cloneObject:(o,a)=>o_(i.cloneObject(o,a)),removeObject:o=>i.removeObject(o),spawnObject:(o,a)=>{if(!e)return{warning:"spline.spawnObject: not available in this runtime integration."};let l=n(o),c=l?e.findEntity(l.uuid):void 0;if(!c)return{warning:`spline.spawnObject: no object named "${o}" to use as a template.`};if(r.size>=e8)return{warning:`spline.spawnObject: spawn budget reached (${e8} live copies) \u2014 destroyObject old copies (or reuse them) instead of spawning more.`};let u=e.shared.spawnRuntimeClone(c,a??{});return u?(r.set(u.uuid,u),i.requestRender(),{object:Ale(u)}):{warning:`spline.spawnObject: "${o}" cannot be spawned from.`}},destroyObject:o=>{let a=s(o);return!e||!a?!1:(r.delete(a.uuid),e.shared.destroyRuntimeClone(a),i.requestRender(),!0)},setInstanceTransforms:(o,a)=>{if(!e)return-1;let l=n(o),c=l?e.findEntity(l.uuid):void 0;if(!c)return-1;let u=e.shared.setEntityInstanceTransforms(c,a);return u>=0&&i.requestRender(),u},emitEvent:(o,a,l)=>{let c=n(a);return c?(l?c.emitEventReverse(o):c.emitEvent(o),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${a}".`}},requestRender:()=>i.requestRender(),addSplineEventListener:(o,a)=>{let l=c=>{a({target:{id:c.target?.id??"",name:c.target?.name??""}})};return i.addEventListener(o,l),()=>i.removeEventListener(o,l)},getCanvas:()=>t}}var Jm=class{constructor(t,e,n){this.iframe=t;this.bridge=e;this.observer=n}static mount(t,e,n,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let o=document.createElement("iframe");o.setAttribute("sandbox",_le),o.title="Spline HTML content";let a=o.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let l=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};l();let c=new ResizeObserver(l);c.observe(e),c.observe(s),o.srcdoc=iB(n,sB),s.insertBefore(o,e.nextSibling);let u=new PS(o,wD(t,e,r),(d,h)=>{d==="warn"?console.warn(`[spline html] ${h}`):d==="error"&&console.error(`[spline html] ${h}`)});return u.attach(),new Jm(o,u,c)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}};dn();var a_="data-spline-html-content",Cle=`
9900
+ `&&s--,this.htmlInput.setSelectionRange(Math.min(t,s),Math.max(t,s))}checkClickedObject(){if(this.virtualInput){let t=this.raycaster.intersectObject(this.virtualInput,!1);if(t.length>0){let e=t[0];if(e.object instanceof ju)return e.object}}return null}selectClosestWord(t,e){if(!this.virtualInput)return;let n=this.virtualInput.wrappedText,r=n[t],s=e+1,o=e;r[e]!==" "&&(s=this.findNextCharOccurence(r,e,"forward"," "),o=this.findNextCharOccurence(r,e,"backward"," "),o>0&&o++,s>=r.length-1&&t===n.length-1&&s++);let a=this.helper,l=a.getGlobalIndexFromLineAndCharIndexes(n,t,o),c=a.getGlobalIndexFromLineAndCharIndexes(n,t,s);this.setInputSelection(l,c)}findNextCharOccurence(t,e,n,r=" "){let s=Math.max(0,t.length-1),o=n==="forward"?s:0,a=n==="forward"?1:-1,l=Math.max(Math.min(e,s),0);for(;l!==o;)if(l+=a,t.charAt(l)===r)return l;return o}getPointOnPlane(){let t=this.virtualInput?.data;if(!(!this.virtualInput||!t)&&this.raycaster.ray.intersectsPlane(this.plane)){this.planeIntersection===null&&(this.planeIntersection=new M);let e=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(e){this.planeIntersection.copy(this.virtualInput.worldToLocal(e));let n=typeof t.geometry.width=="number"?t.geometry.width:1,r=typeof t.geometry.height=="number"?t.geometry.height:1;this.projected.set(e.x+n*.5,e.y-r*.5)}}}updatePlane(){let t=this.virtualInput?.data;this.virtualInput&&t&&(S5.getNormalMatrix(this.virtualInput.matrixWorld),b5.copy(Qse).applyMatrix3(S5).normalize(),this.virtualInput.localToWorld(x5.set(0,0,t.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(b5,x5))}setInputSelection(t,e=t){this.htmlInput?.setSelectionRange(t,e),lo&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){let t=this.virtualInput?.data;this.virtualInput&&t&&this.htmlInput&&(this.htmlInput.style.fontSize=t.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=t.geometry.letterSpacing*t.geometry.fontSize+"px",this.htmlInput.style.lineHeight=t.geometry.fontSize*t.geometry.lineHeight+"px",this.htmlInput.style.width=t.geometry.width+"px",this.htmlInput.style.height=t.geometry.height+"px",this.htmlInput.style.textAlign=Jse(t.geometry.horizontalAlign))}};function Jse(i){return i===4?"justify":i===2?"right":i===3?"center":"left"}var E5=(i,t)=>{if(typeof i=="string"){let e=t.data(i);if(e)return E5(e.value,t)}return Tr.getDisplayedValue(i)};function w5(i,t){let e=i.text,n="";if(typeof e=="string"){let r=t.variables.data(n);r&&(n=E5(r.value,t.variables))}else n=e.textValue.toString();return n}var TM=class extends vn{constructor(e,n){super(e);this.eventManager=n;this._textInputs=[];this.sceneHelpers=new hr;this.helper=new Hm;this._onMouseDownFocusIn=e=>{if(mt.length>1)return;this.eventContext.updateRaycaster(e);let n=null;if(this.eventContext.raycaster){for(let r of this._textInputs)if(this.eventContext.raycaster.intersectObject(r,!0).length>0){n=r;break}}this.focusOnTextInput(n),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(e),this._onMouseDown(e)};this.onExit=()=>{let{virtualInput:e}=this.textInputManager;if(e===null)return;let n=this.textInputManager.htmlInput;this.helper.hide(),n?.setSelectionRange(n.value.length,n.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:r}=this.eventContext;r.removeEventListener("pointerdown",this._onMouseDown,!1),r.removeEventListener("pointerup",this._onMouseUp,!1),r.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),r.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()};this._onMouseDown=e=>{this.eventContext.updateRaycaster(e),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)};this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)};this._onMouseMove=e=>{this.eventContext.updateRaycaster(e),this.textInputManager.handleMouseMove()};this._onTextEdit=e=>{let{htmlInput:n,virtualInput:r,helper:s}=this.textInputManager;if(!n||!r)return;let o=n.value;r.textGeometry.setText(o,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let a=r.data;s.update();let l=a.geometry.text;if(typeof l=="string"){let c=l;this.eventContext.sharedAssets.updateVariable(c,{textValue:o})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()};this._onCaretUpdate=e=>{this.textInputManager.handleCaretUpdate(e)};this._onKeyPress=e=>{e.key==="Escape"&&this.onExit()};this.textInputManager=new EM(this.sceneHelpers,e.raycaster,e.sharedAssets,e.requestRender,this.onExit)}connect(){let e=[];if(this.eventContext.scene.traverseEntity(s=>{s instanceof ju&&e.push(s)}),this._textInputs=e,e.length===0)return;let{domElement:n}=this.eventContext;n.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let r=this.textInputManager.createInput();document.body.appendChild(r),r.style.display="none",r.addEventListener("keyup",this._onCaretUpdate),r.addEventListener("keydown",this._onCaretUpdate),r.addEventListener("beforeinput",this._onCaretUpdate),r.addEventListener("paste",this._onCaretUpdate),r.addEventListener("cut",this._onCaretUpdate),r.addEventListener("select",this._onCaretUpdate),r.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let e=this.textInputManager.htmlInput,{domElement:n,sharedAssets:r}=this.eventContext;n.removeEventListener("pointerdown",this._onMouseDownFocusIn),e?.removeEventListener("keyup",this._onCaretUpdate),e?.removeEventListener("keydown",this._onCaretUpdate),e?.removeEventListener("beforeinput",this._onCaretUpdate),e?.removeEventListener("paste",this._onCaretUpdate),e?.removeEventListener("cut",this._onCaretUpdate),e?.removeEventListener("select",this._onCaretUpdate),e?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(s=>{let o=w5(s.data.geometry,this.eventContext.sharedAssets.data);s.textGeometry.setText(o,r)}),n.removeEventListener("pointerdown",this._onMouseDown,!1),n.removeEventListener("pointerup",this._onMouseUp,!1),n.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(e){this.textInputManager.focus(e),this.textInputManager.onTextMaterialChanged();let n=this.textInputManager.htmlInput;if(!n||e===null)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let r=w5(e.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);n.value=r,n.setSelectionRange(0,0),this.textInputManager.helper.show(e),n.style.display="block",n.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:s}=this.eventContext;s.removeEventListener("pointerdown",this._onMouseDownFocusIn),s.addEventListener("pointerdown",this._onMouseDown,!1),s.addEventListener("pointerup",this._onMouseUp,!1),s.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}};Qt();Or("Textfields",({eventContext:i,eventManager:t})=>new TM(i,t));Eo("InputGeometry",(i,t,e)=>new ju(i,t,e));Mt("textinputs");pw();var T5=new Map,Db=new Map,Wm=class{constructor(t,e,n,r){this.data=e;this.isPlayAudioAction=!0;let{audio:s,volume:o,delay:a,loop:l}=e;if(!s)throw new Error("Missing property");try{let c=typeof s=="string"?r.getAudio(s).src:s.data;this.audioPlayer=new lc({src:c,volume:o,delay:a,loop:l})}catch{console.warn(`Could not create an audio player for this object: "${n.name}" and this audio: "${s}"`)}Db.has(n.uuid)?Db.get(n.uuid).push(this):Db.set(n.uuid,[this]),T5.set(t,this)}playByToggle(){this.data.toggle==="stop"?this.audioPlayer?.status==="playing"?this.audioPlayer.stop():(this.audioPlayer?.stop(),this.audioPlayer?.play()):this.data.toggle==="pause"?this.audioPlayer?.status==="playing"?this.audioPlayer?.pause():this.audioPlayer?.play():(this.audioPlayer?.stop(),this.audioPlayer?.play())}dispose(){this.audioPlayer?.stop()}},BO=class{constructor(t){this.data=t;this.isPauseAudioAction=!0}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(t){let e=T5.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.audioPlayer?.[this.data.interaction](),this.disposeDelay()},this.data.delay)):e.audioPlayer?.[this.data.interaction]())}pauseAllAudiosFromObject(t){let e=Db.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(n=>n.audioPlayer?.[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(n=>n.audioPlayer?.[this.data.interaction]()))}pauseAllAudios(){let t=[...Db.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(n=>{n.audioPlayer?.[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(n=>{n.audioPlayer?.[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},MM=class{constructor(t,e,n,r,s){this.data=e;this.shared=r;this.condition=s;if(e.interaction==="play")this.interaction=new Wm(t,e,n,r);else if(e.interaction==="pause"||e.interaction==="stop")this.interaction=new BO(e);else throw new Error("Missing property")}dispatchBasic(){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Wm?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Wm?this.interaction.audioPlayer?.play():this.interaction.dispatch()}dispatchGameControl(t){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Wm&&(t==="start"?this.interaction.audioPlayer?.play():this.interaction.audioPlayer?.stop())}dispose(){this.interaction.dispose()}};Qt();mr("Audio",({id:i,data:t,object:e,shared:n,actionCondition:r})=>new MM(i,t,e,n,r));Mt("audio");function M5(i,t){let e;if("material"in i){let r=i.material;Array.isArray(r)?e=i.material[0].layers.find(s=>s.uuid===t):e=i.material.layers.find(s=>s.uuid===t)}if(!e)return;let n=e.color?.texture?.image?.img??e.holders?.find(r=>r.isVideo)?.img;return n instanceof HTMLVideoElement?n:void 0}dn();var _5=new Map,Lb=new Map,Nb=class{constructor(t,e,n){this.data=e;this.isPlayVideoAction=!0;this.delay=0;this.status="stopped";let{layerId:r,loop:s,volume:o,delay:a}=e;if(this.object=n,r===void 0)throw new Error("Missing property");let l=M5(n,r);l&&(this.videoElement=l,this.videoElement.loop=s===1/0,lo&&(this.videoElement.autoplay=!0),o!==void 0&&(this.videoElement.volume=o)),a!==void 0&&(this.delay=a),Lb.has(n.uuid)?Lb.get(n.uuid).push(this):Lb.set(n.uuid,[this]),_5.set(t,this),this.pause()}mute(){!this.videoElement||(this.videoElement.muted=!0)}unMute(){!this.videoElement||(this.videoElement.muted=!1)}play(t){if(!this.videoElement)return;let e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);t?(this.mute(),this.delay+=150):e?(this.mute(),window.setTimeout(()=>{this.unMute()},100)):this.unMute(),this.delayTimerId=window.setTimeout(()=>{if(!this.videoElement)return;let n=this.videoElement.play();n!==void 0&&n.then(r=>{}).catch(r=>{this.play()}),this.clearDelay()},this.delay),this.status="playing"}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}pause(){!this.videoElement||(this.videoElement.pause(),this.status="paused")}stop(){!this.videoElement||(this.videoElement.pause(),this.videoElement.currentTime=0,this.status="stopped",this.clearDelay())}seek(t){return new Promise(e=>{if(!this.videoElement)return e();let n=this.videoElement.duration;if(n>0){let r=t%n;this.videoElement.currentTime=r}this.videoElement.addEventListener("seeked",()=>e(),{once:!0})})}playByToggle(){this.data.toggle==="stop"?this.status==="playing"?this.stop():(this.stop(),this.play()):this.data.toggle==="pause"?this.status==="playing"?this.pause():this.play():(this.stop(),this.play())}dispose(){!this.videoElement||(this.stop(),this.videoElement.muted=!0)}},FO=class{constructor(t){this.data=t;this.isPauseVideoAction=!0}dispatch(){this.data.playVideo?this.pauseVideo(this.data.playVideo):this.data.object?this.pauseAllVideosFromObject(this.data.object):this.pauseAllVideos()}pauseVideo(t){let e=_5.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e[this.data.interaction](),this.disposeDelay()},this.data.delay)):e[this.data.interaction]())}pauseAllVideosFromObject(t){let e=Lb.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(n=>n[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(n=>n[this.data.interaction]()))}pauseAllVideos(){let t=[...Lb.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(n=>{n[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(n=>{n[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},_M=class{constructor(t,e,n,r,s){this.data=e;this.shared=r;this.condition=s;if(e.interaction==="play")this.interaction=new Nb(t,e,n);else if(e.interaction==="pause"||e.interaction==="stop")this.interaction=new FO(e);else throw new Error("Missing property")}dispatchBasic(){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Nb?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(Xt(this.shared,this.condition)===!1)return!1;this.interaction instanceof Nb?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}};fr();Qt();mr("Video",({id:i,data:t,object:e,shared:n,actionCondition:r})=>Rr(e)?null:new _M(i,t,e,n,r));Mt("video");dn();q();ih();var UO=(()=>{let i,t,e,n,r=!1;function s(c){!i&&!A5()&&(t?.sharedGameControlGlobals.createdObjects.length??0)>0&&(i=requestAnimationFrame(o)),c&&(t=c,n=c.requestRender,!r&&typeof document<"u"&&(document.addEventListener("visibilitychange",a),r=!0))}function o(c){if(!t||!n){i=void 0,e=void 0;return}let u=e?c-e:0,d=t.sharedGameControlGlobals.createdObjects,h=t.sharedGameControlGlobals.nCreatedPerAction,p=d.length,f=0;for(;f<p;){let m=d[f];m.userData.createdTime===void 0&&(m.userData.createdTime=c),m.userData.lifetime===void 0&&m.userData.quantity===void 0||m.userData.lifetime&&c-m.userData.createdTime<m.userData.lifetime||m.userData.quantity&&h[m.userData.actionId]<=m.userData.quantity?(m.userData.velocity&&(m.position.addScaledVector(m.userData.velocity,u/1e3),m.updateMatrix(),n()),f++):(h[m.userData.actionId]>m.userData.quantity&&h[m.userData.actionId]--,d.splice(f,1),m.removeFromParent(),t.sharedGameControlGlobals.rapierWorld&&m.rigidBody?(t.sharedGameControlGlobals.colliderToEntity.delete(m.rigidBody.collider(0).handle),t.sharedGameControlGlobals.rapierWorld.removeRigidBody(m.rigidBody)):(m.bvhGeometry=void 0,t.sharedGameControlGlobals.entitiesWithTransformAnim=t.sharedGameControlGlobals.entitiesWithTransformAnim.filter(g=>g.bvhGeometry!==void 0)),p--,n())}i=f>0?requestAnimationFrame(o):void 0,e=f>0?c:void 0}function a(){A5()?i&&(cancelAnimationFrame(i),i=void 0,e=void 0):s()}function l(){i&&(cancelAnimationFrame(i),i=void 0),r&&typeof document<"u"&&(document.removeEventListener("visibilitychange",a),r=!1),t=void 0,n=void 0,e=void 0}return{play:s,dispose:l}})();function A5(){return!!document&&document.hidden}var C5=new ke,eoe=new M,toe=new M,AM=class{constructor(t,e,n,r,s){this.data=t;this.page=e;this.controlsManager=n;this.shared=r;this.condition=s;this.intervalId=null;this.timeoutIdQueue=[];this.uniqueId=ge.generateUUID();this.dispatch=()=>{if(Xt(this.shared,this.condition)===!1)return!1;this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3)):this.dispatchInner()};this.dispatchFromStart=()=>{if(Xt(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3))};this.dispatchThrottled=q3(this.dispatch,1e3/this.data.creationSpeed);this.dispatchStart=()=>{this.intervalId===null&&(this.intervalId=window.setInterval(this.dispatch,1e3/this.data.creationSpeed))};this.dispatchStop=()=>{this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null)};this.dispatchInner=()=>{this.timeoutIdQueue.shift();let t=new Yr(this.object);if(t.playModeVisible=!0,t.expand(),this.data.coordinateSystem!=="world"){let n=this.data.coordinateSystem,r=this.page.scene.find(n);r&&(r.updateMatrixWorldRigid(),t.hiddenMatrix.copy(r.matrixWorldRigid))}t.scale.copy(this.object.scale),t.position.fromArray(this.data.position.map(n=>typeof n=="number"?n:0)),t.rotation.fromArray(this.data.rotation.map(n=>typeof n=="number"?n:0)),t.updateMatrix(),this.page.add(t);let e=this.controlsManager.sharedGameControlGlobals;e.createdObjects.push(t),e.nCreatedPerAction[this.uniqueId]===void 0?e.nCreatedPerAction[this.uniqueId]=1:e.nCreatedPerAction[this.uniqueId]++,t.updateWorldMatrix(!0,!0),t.traverseObject(this.traverseObjectCB),UO.play(),this.controlsManager.requestRender()};this.traverseObjectCB=t=>{t.hasNonUniformScale&&t.updateMatrixWorldRigid();let e;if(this.controlsManager.sharedGameControlGlobals.rapierWorld){if(t instanceof $s)if(t.objectForSample){if(t.objectForSample.dataPatched.physics.fusedBody)return;e=t.object}else return t.object.dataPatched.physics.fusedBody===!0&&t.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(t instanceof Yr)e=t.object;else if(e=t,e.dataPatched.cloner?.hideBase)return!0}else{if(t instanceof $s)return;t instanceof Yr?e=t.object:e=t}this.data.destroy==="Time"?t.userData.lifetime=this.data.lifetime*1e3:this.data.destroy==="Quantity"&&(t.userData.quantity=this.data.destroyAfterQuantity,t.userData.actionId=this.uniqueId);let n=new M().fromArray(this.data.velocity.map(s=>typeof s=="number"?s:0)),r=e.dataPatched;if(!(r.physics.enabled==="visibility"?!r.visible:!r.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(t,e,{fromCreate:!0,dynamic:this.data.dynamic}),this.data.destroy==="Collision"&&(t.rigidBody?.collider(0).setActiveEvents(1),t.userData.hasCollisionDestroy=!0),t.matrixWorld.decompose(eoe,C5,toe),n.applyQuaternion(C5),this.data.velocity.some(s=>s!==0)&&this.data.dynamic&&t.rigidBody?.setLinvel(n.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in t.object&&this.controlsManager.addBoundsTree(t),this.data.velocity.some(s=>s!==0)&&this.data.dynamic&&(t.userData.velocity=n)),e.dataPatched.physics?.fusedBody===!0))return!0};let o=this.page.scene.find(this.data.object);if(!o)throw new Error("Missing Property");if(this.object=o,this.data.coordinateSystem!=="world"&&!this.page.scene.find(this.data.coordinateSystem))throw new Error("Missing Property");UO.play(n)}dispose(){this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(t=>window.clearTimeout(t)),this.timeoutIdQueue=[],this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[],UO.dispose()}};var CM=class{constructor(t,e,n,r,s){this.data=t;this.page=e;this.controlsManager=n;this.shared=r;this.condition=s;this.timeoutIdQueue=[];this.dispatchInner=()=>{this.objects.forEach(this.destroyCallback)};this.destroyCallback=t=>{this.timeoutIdQueue.shift();let e=this.page.scene.find(t);if(e===void 0)return;let n=this.controlsManager.sharedGameControlGlobals.rapierWorld,r=n?e.dataPatched.physics?.fusedBody:!0;if(e.cloner){for(let s of e.cloner.children)r?(s.playModeVisible=!1,e.dataPatched.physics?.rigidBody==="positioned"&&this.removeBody(s),s.bvhGeometry&&(s.bvhGeometry=void 0)):this.clone===void 0||this.clone===s?(s.playModeVisible=!1,this.removeBody(s)):s.playModeVisible===void 0&&(s.playModeVisible=!0);e.cloner.syncInstanceMatrices(),(r||this.clone===void 0||this.clone===!1)&&(e.visible=!1,this.removeBody(e),e.bvhGeometry&&(e.bvhGeometry=void 0))}else this.removeBody(e),e.bvhGeometry&&(e.bvhGeometry=void 0),e.visible=!1;n===void 0?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(s=>s.bvhGeometry!==void 0):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(s=>s.rigidBody!==void 0),e.destroyedInAction=!0,this.controlsManager.requestRender()};this.objects=[...t.objects]}removeBody(t){let e=t.rigidBody;if(!e)return;let n=this.controlsManager.sharedGameControlGlobals;n.colliderToEntity.delete(e.collider(0).handle),n.kinematicBodyToEntity.delete(e.handle);let r=this.controlsManager;r.fixedBodiesToWatch=r.fixedBodiesToWatch.filter(([,s])=>s!==e),n.rapierWorld.removeRigidBody(e),t.rigidBody=void 0}dispatch(t){if(Xt(this.shared,this.condition)===!1)return!1;this.clone=t,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3)):this.dispatchInner()}dispatchFromStart(){if(Xt(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3))}dispose(){this.timeoutIdQueue.forEach(t=>window.clearTimeout(t))}};Qt();mr("Create",({data:i,page:t,eventManager:e,shared:n,actionCondition:r})=>new AM(i,t,e.controlsManager,n,r));mr("Destroy",({data:i,page:t,eventManager:e,shared:n,actionCondition:r})=>new CM(i,t,e.controlsManager,n,r));Mt("create-destroy");pt();pt();Yi();q();Xs();$i();fr();var P5=new M;function qm(i,t,e=!1){let n=[],r=s=>{let o=s.data;delete s.states,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null;for(let a of o.states){let l={...a.data};s.states||(s.states={}),s.states[a.id]=nc.patch(o,l)}I5(i.scene,s,null,t,o.events.find(a=>a.data.type==="Follow"||a.data.type==="LookAt")!==void 0),R5(i)};i.scene.traverse2D(r),i.traverseChildren(s=>{if(e&&(s.rigidBody?.setTranslation(s.position0,!0),s.rigidBody?.setRotation(s.rotation0,!0),s.rigidBody?.setLinvel(P5,!0),s.rigidBody?.setAngvel(P5,!0)),!Ot.is(s))return;let o=s.uuid,a=s.data;if(delete s.states,s.uuid===fo)return;let l=!1;n.some(c=>i.scene.find(o)?.isDescendantOf(c))?l=!0:a.physics?.fusedBody===!0&&a.physics.rigidBody==="dynamic"&&n.push(o),s.data=a,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null,s.transitionState={settled:!0,state:null};for(let c of a.states){let u={...c.data};i.data.globalPhysics.usePhysics===!0&&a.physics&&(a.physics.rigidBody==="dynamic"||l)&&(c.data.position!==void 0&&delete u.position,c.data.rotation!==void 0&&delete u.rotation,c.data.hiddenMatrix!==void 0&&delete u.hiddenMatrix),s.states||(s.states={}),s.states[c.id]=ia.patch(a,u)}I5(i.scene,s,null,t,a.events.find(c=>c.data.type==="Follow"||c.data.type==="LookAt")!==void 0),vr(s)&&s.frame&&(s.frame.traverse(c=>r(c)),s.uiCanvas?.applySize())}),R5(i),i.frame&&(i.frame.traverse(s=>r(s)),i.uiCanvas?.applySize())}function R5(i){i.traverseEntity(t=>{for(let e of t.data.events){let n=[];switch(e.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":n.push(...e.data.actions);break;case"GameControl":for(let r of Object.values(e.data.gameActions))n.push(...r);break;case"DragDrop":n.push(...e.data.dragDropActions.drag,...e.data.dragDropActions.drop);break;case"Conditional":n.push(...e.data.inActions,...e.data.outActions);break}for(let r of n)if(r.data.type==="Create"&&r.data.hideBase==="Yes"){let s=i.scene.find(r.data.object);s&&(s.visible=!1)}}})}function I5(i,t,e,n,r=!1){if(i.markShadowsDirty(),t instanceof Yt&&!Xi(t)&&t.removeInteractionGeometry(n),Rr(t)?t.changeSelectedState(e,{shared:n},r):t.changeSelectedState(e,{scene:i,shared:n},r),t instanceof Yt&&t.updateGeometryGroupsIfNeeded(),t instanceof rn&&t.updateCameraState(t.dataPatched,{scene:i,shared:n}),!Rr(t)){if(t.cloner){let s=!1;for(let o of t.cloner.children)o.playModeVisible=void 0,o.transformOverride!==void 0&&(o.transformOverride=void 0,s=!0);s&&i.addPendingUpdateCloner(t),t.cloner.syncInstanceMatrices()}t.updateVisible()}}var PM=class{constructor(t,e,n,r,s){this.data=t;this.page=e;this.eventManager=n;this.shared=r;this.condition=s;this.timeOutId=-1;this.scene=e.scene}dispatch(){if(Xt(this.shared,this.condition)===!1)return!1;this.data.target!==this.page.uuid&&(window.clearTimeout(this.timeOutId),this.timeOutId=window.setTimeout(()=>{this.play()},this.data.delay*1e3))}dispose(){window.clearTimeout(this.timeOutId)}play(){if(this.scene.children.every(n=>n.uuid!==this.data.target||n.data.uiScene))return;this.data.transition==="fade"&&this.data.duration>0&&this.eventManager.eventContext.renderer.renderFromSceneForSceneTransitionPass(this.scene,this.scene.activeCamera,this.data.duration*1e3),this.eventManager.deactivate(),this.eventManager.controlsManager.deactivate();let t=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(n=>{n.type==="ParticleSystem"&&(n.sleep(),n.wakeUp(),n.data.autoPlay?n.start():n.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(t),qm(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}};Qt();mr("SceneTransition",({data:i,page:t,eventManager:e,shared:n,actionCondition:r})=>new PM(i,t,e,n,r));Mt("scene-transition");pt();q();pt();function noe(i){return{easing:i.type,control1:ec(i.cubicControls?.control1,[0,0]),control2:ec(i.cubicControls?.control2,[1,1]),...i.springParameters}}function Mh(i,t){let e=[];for(let n of i??[]){let r=t(n.data);r!==void 0&&e.push({time:n.data.time,ease:noe(n.data.easing),value:r})}return{keyframes:KH(e)}}function xa(i,t){if(i.keyframes.length===0)return;let{index0:e,index1:n,t:r}=$H(i.keyframes,t),s=i.read;if(s&&s.index0===e&&s.index1===n&&s.t===r)return;let o={index0:e,index1:n,from:i.keyframes[e].value,to:i.keyframes[n].value,t:r};return i.read=o,o}function O5(i){i.read=void 0}function Bb(i,t,e){return i+(t-i)*e}pt();q();ii();Xs();rE();kO();oE();$i();fr();Za();xR();pt();dn();q();Co();var{degToRad:UWe,radToDeg:kWe}=ge,L5=new M,N5=new M,B5=new ke;function U5(i,t,e,n){if(n===0)return e.copy(i);if(n===1)return e.copy(t);let r=i.w*t.w+i.x*t.x+i.y*t.y+i.z*t.z;if(r>=1)return e.copy(i);let s=1-r*r;if(s<=Number.EPSILON){let u=1-n;return e.w=u*i.w+n*t.w,e.x=u*i.x+n*t.x,e.y=u*i.y+n*t.y,e.z=u*i.z+n*t.z,e.normalize(),e}let o=Math.sqrt(s),a=Math.atan2(o,r),l=Math.sin((1-n)*a)/o,c=Math.sin(n*a)/o;return e.w=i.w*l+t.w*c,e.x=i.x*l+t.x*c,e.y=i.y*l+t.y*c,e.z=i.z*l+t.z*c,e}function Vr(i,t,e,n,r,s){let o=e[i]!==void 0?e[i]:void 0,a=n[i];if(a==null)return;let l=o!=null?typeof o=="string"?Number(r.getVariable(o)??0):o:t[i],c=typeof a=="string"?Number(r.getVariable(a)??0):a;if(l!==c)return{update:u=>{let d=ge.lerp(l,c,u);s?t[i]=Math.trunc(d):t[i]=d},start:()=>{t[i]=l},end:()=>{t[i]=c}}}function Ub(i,t,e,n,r,s){let o=e[i]?e[i]:void 0,a=n[i];if(!a)return;let l=t[i],c=[...o??l].map(d=>typeof d=="string"?Number(r.getVariable(d)??0):d),u=[...a].map(d=>typeof d=="string"?Number(r.getVariable(d)??0):d);if(!(c.length!==u.length||Jo(c,u)))return{update:d=>{c.forEach((h,p)=>{let f=ge.lerp(h,u[p],d);t[i][p]=s?Math.trunc(f):f})},start:()=>{Object.assign(t[i],c)},end:()=>{Object.assign(t[i],u)}}}function Fb(i,t,e){return t.forEach((n,r)=>{i.setComponent(r,typeof n=="string"?Number(e.getVariable(n)??0):n)}),i}function VO(i,t,e,n,r){let s=e[i]?e[i]:void 0,o=n[i];if(!o)return;let a=t[i],l=s?Fb(new M,s,r):a.clone(),c=Fb(new M,o,r);if(!l.equals(c))return{update:u=>{a.lerpVectors(l,c,u)},start:()=>{a.copy(l)},end:()=>{a.copy(c)}}}function F5(i,t,e){return t.forEach((n,r)=>{i.setComponent(r,typeof n=="string"?Number(e.getVariable(n)??0):n)}),i}function Ym(i,t,e,n,r){let s=e[i]?e[i]:void 0,o=n[i];if(!o)return;let a=t[i],l=!(a instanceof G),c=a instanceof G?a:new G().fromArray(a),u=s?F5(new G,s,r):c.clone(),d=F5(new G,o,r);if(!u.equals(d))return{update:h=>{c.lerpVectors(u,d,h),l&&(t[i]=c.toArray())},start:()=>{c.copy(u),l&&(t[i]=c.toArray())},end:()=>{c.copy(d),l&&(t[i]=c.toArray())}}}function k5(i,t,e,n){let r=e[i]?e[i]:void 0,s=n[i];if(!s)return;let o=t[i],a=r?new te().fromArray(r):o.clone(),l=new M,c=new ke,u=new M;a.decompose(l,c,u);let d=new te().fromArray(s),h=new M,p=new ke,f=new M;if(d.decompose(h,p,f),!a.equals(d))return{update:m=>{B5.slerpQuaternions(c,p,m),L5.lerpVectors(l,h,m),N5.lerpVectors(u,f,m),o.compose(L5,B5,N5)},start:()=>{o.compose(l,c,u)},end:()=>{o.compose(h,p,f)}}}function V5(i,t,e,n,r){let s=e[i]?e[i]:void 0,o=n[i];if(!o)return;let a=t[i],l=s?typeof s=="string"?r.getColor(s).clone():new Ye().setRGB(s.r,s.g,s.b):a.clone(),c=typeof o=="string"?r.getColor(o).clone():new Ye().setRGB(o.r,o.g,o.b);if(l.equals(c))return;let u=a.clone();return{update:d=>{u.lerpColors(l,c,d),t[i]?.copy?.(u)},start:()=>{u.copy(l)},end:()=>{u.copy(c)}}}function kb(i,t,e,n,r){let s=e[i]?e[i]:void 0,o=n[i];if(!o)return;let a=t[i],l=new gn(a.r,a.g,a.b,a.a),c=s?typeof s=="string"?r.getColor(s).clone():new gn(s.r,s.g,s.b,s.a):l.clone(),u=typeof o=="string"?r.getColor(o).clone():new gn(o.r,o.g,o.b,o.a);if(!c.equals(u))return{update:d=>{l.lerpColors(c,u,d);let h=ge.lerp(c.a,u.a,d);l.a=h,t[i]={r:l.r,g:l.g,b:l.b,a:l.a}},start:()=>{l.copy(c)},end:()=>{l.copy(u)}}}function hl(i,t,e,n,r){if(typeof t[i]=="number")return Vr(i,t,e??{},n,r);if(Array.isArray(t[i]))return Ub(i,t,e??{},n,r)}var VWe=new Ht;function z5(i,t){if(!!i)for(let[e,n]of Object.entries(t)){let r=i[e];if(Array.isArray(r)&&Array.isArray(n)){let s=Math.min(r.length,n.length);for(let o=0;o<s;o++)r[o]=n[o]}else i[e]=n}}function $m(i,t,e,n){let r={};if(!t||!e)return r;for(let s of i){let o=t[s],a=e[s];if(typeof o=="number"&&typeof a=="number")r[s]=ge.lerp(o,a,n);else if(Array.isArray(o)&&Array.isArray(a)){let l=Math.min(o.length,a.length);r[s]=Array.from({length:l},(c,u)=>ge.lerp(o[u],a[u],n))}}return r}function G5(i,t,e,n){let r=[];if(!("cloner"in e)||!i.cloner)return r;let s=i.cloner,o="cloner"in t?t.cloner:{},a=e.cloner;iP.forEach(p=>{let f;p==="count"?f=Vr("count",s.parameters,o,a,n.shared,!0):f=hl(p,s.parameters,o??{},a,n.shared),f&&r.push(f)});let l=roe(s,o,a,n.shared);l?.length&&r.push(...l);let c=ioe(s,o,a,n.shared);c?.length&&r.push(...c);let u=soe(s,o,a,n.shared);u?.length&&r.push(...u);let d=ooe(s,o,a,n.shared);d?.length&&r.push(...d);let h=aoe(s,o,a,n.shared);return h?.length&&r.push(...h),r.length&&r.push({update:()=>{s.update(n)}}),r}function roe(i,t,e,n){if(i.parameters.type!=="radial")return;let r=t.radial,s=e.radial;if(!s)return;let o=i.parameters.radial,a=[];return e1.forEach(l=>{let c=hl(l,o,r??{},s,n);c&&a.push(c)}),a}function ioe(i,t,e,n){if(i.parameters.type!=="linear")return;let r=t.linear,s=e.linear;if(!s)return;let o=[],a=i.parameters.linear;return t1.forEach(l=>{let c=hl(l,a,r??{},s,n);c&&o.push(c)}),o}function soe(i,t,e,n){if(i.parameters.type!=="grid")return;let r=t.grid,s=e.grid;if(!s)return;let o=[],a=i.parameters.grid;return n1.forEach(l=>{let c;l==="count"?c=Ub(l,a,r??{},s,n,!0):c=hl(l,a,r??{},s,n),c&&o.push(c)}),o}function ooe(i,t,e,n){if(i.parameters.type!=="toObject")return;let r=t.toObject,s=e.toObject;if(!s)return;let o=[],a=i.parameters.toObject;return r1.forEach(l=>{let c;l==="count"?c=Vr(l,a,r??{},s,n,!0):c=hl(l,a,r??{},s,n),c&&o.push(c)}),o}function aoe(i,t,e,n){if(!i.parameters.randomness)return;let r=t.randomnessObject,s=e.randomnessObject;if(!s)return;let o=[],a=i.parameters.randomnessObject;return i1.forEach(l=>{let c=hl(l,a,r??{},s,n);c&&o.push(c)}),o}var j5=[["radial",e1],["linear",t1],["grid",n1],["toObject",r1],["randomnessObject",i1]];function H5(i,t,e,n){if(!i)return{};let r=$m(["count"],t,e,n);r.count!==void 0&&(r.count=Math.trunc(r.count));for(let[s,o]of j5){if(!i[s])continue;let a=$m(o,t[s],e[s],n);Object.keys(a).length&&(r[s]=a)}return r}function W5(i,t){if(!!i){t.count!==void 0&&(i.count=t.count);for(let[e]of j5){let n=t[e];n&&z5(i[e],n)}}}pt();q();Co();Ww();Za();dn();function X5(i,t,e,n){let r=[];if(Array.isArray(i.material)){if(!("materials"in e&&e.materials))return r;let s="materials"in t&&t.materials?t.materials:[],o=e.materials;i.material.forEach((a,l)=>{if(!o[l])return;let c=s[l]??{},u=o[l];typeof c=="string"||typeof u=="string"||r.push(...q5(a,c,u,n))})}else{if(!("material"in e&&e.material))return r;let s="material"in t&&t.material?t.material:{},o=e.material;if(typeof s=="string"||typeof o=="string")return r;r.push(...q5(i.material,s,o,n))}return r}function loe(i,t,e){let n=i.ensureRainbowNoiseCompiled;if(typeof n=="function")for(let r of[...i.layers]){if(r.type!=="rainbow")continue;let s=t.layers?.data(r.uuid),o=e.layers.data(r.uuid);(da(s?.noiseStrength)||da(o?.noiseStrength))&&n.call(i,r.uuid)}}function Y5(i,t,e,n,r){let s=i.getValue(n);if(s!==void 0){if(n==="colors")return moe(i,t,e,n);if(Array.isArray(s))return n==="steps"?foe(i,t,e,n):void 0;if(typeof s=="number")return coe(i,t,e,n,r);if(typeof s!="boolean"){if(s instanceof G)return uoe(i,t,e,n);if(s instanceof M)return doe(i,t,e,n,r);if(s instanceof gn)return poe(i,t,e,n,r);if(s instanceof Ye)return hoe(i,t,e,n,r);if("isTexture"in s)return yoe(i,t,e,n,r)}}}function q5(i,t,e,n){let r=[],s=Ka(e,n)||!!t.layers&&Ka(t,n);r.push(voe(i,s)),loe(i,t,e);for(let o of i.layers){let a=t.layers?.data(o.uuid),l=e.layers.data(o.uuid);if(!l||o.type!=="light"&&(!(o.visible??!0)||!(l.visible??!0)))continue;let c=$f[o.type]??[],u=o.getNames().filter(d=>!c.includes(d)&&!sf.some(h=>d.includes(h)));for(let d of u)try{let h=Y5(o,a,l,d,n);h&&(Array.isArray(h)?r.push(...h):r.push(h))}catch(h){console.error(`lerpMaterial: unexpected material layer for ${d}`,h)}}return r}function coe(i,t,e,n,r){if(!i.hasValue(n)||!(n in e))return;let s=t?t[n]:i.getValue(n),o=e[n],a=typeof s=="string"?Number(r.getVariable(s)??0):s,l=typeof o=="string"?Number(r.getVariable(o)??0):o;return{update:c=>{i.setValue(n,ge.lerp(a,l,c))},start:()=>{i.setValue(n,a)},end:()=>{i.setValue(n,l)}}}function uoe(i,t,e,n){if(!i.hasValue(n)||!(n in e))return;let r=i.getValue(n),s=t?new G().fromArray(t[n]):r.clone(),o=new G().fromArray(e[n]);if(!s.equals(o))return{update:a=>{r.lerpVectors(s,o,a)},start:()=>{r.copy(s)},end:()=>{r.copy(o)}}}function doe(i,t,e,n,r){if(!i.hasValue(n)||!(n in e))return;let s=i.getValue(n),o=t?t[n]:void 0,a=e[n],l=o?Fb(new M,o,r):s.clone(),c=Fb(new M,a,r);if(!l.equals(c))return{update:u=>{s.lerpVectors(l,c,u)},start:()=>{s.copy(l)},end:()=>{s.copy(c)}}}function hoe(i,t,e,n,r){if(!i.hasValue(n)||!(n in e))return;let s=t?t[n]:void 0,o=e[n],a=i.getValue(n),l=s?typeof s=="string"?r.color(s).clone():new Ye().setRGB(s.r,s.g,s.b):a.clone(),c=typeof o=="string"?r.color(o).clone():new Ye().setRGB(o.r,o.g,o.b);if(l.equals(c))return;let u=a.clone();return{update:d=>{i.getValue(n)!==u&&i.setValue(n,u),u.lerpColors(l,c,d)},start:()=>{u.copy(l)},end:()=>{u.copy(c)}}}function poe(i,t,e,n,r){if(!i.hasValue(n)||!(n in e))return;let s=t?t[n]:void 0,o=e[n],a=i.getValue(n),l=s?typeof s=="string"?r.color(s).clone():new Ye().setRGB(s.r,s.g,s.b):a.clone(),c=typeof o=="string"?r.color(o).clone():new gn(o.r,o.g,o.b,o.a);if(l.equals(c))return;let u=a.clone();return{update:d=>{i.getValue(n)!==u&&i.setValue(n,u),u.lerpColors(l,c,d)},start:()=>{u.copy(l)},end:()=>{u.copy(c)}}}function foe(i,t,e,n="steps"){if(!i.hasValue(n)||!(n in e))return;let r=[],s=i.getValue(n),o=t?t[n]:s,a=e[n];return Jo(o,a)||r.push({update:l=>{let c=[...s];for(let u=0;u<s.length;++u){let d=o[u],h=a[u];c[u]=ge.lerp(d,h,l)}i.setValue(n,c)},start:()=>{i.setValue(n,o)},end:()=>{i.setValue(n,a)}}),r.length?r:void 0}function moe(i,t,e,n="colors"){if(!i.hasValue(n)||!(n in e))return;let r=[],s=i.getValue(n),o=t?t[n]:s.map(l=>l.toArray()),a=e[n];for(let l=0;l<s.length;++l){let c=[...o[l]],u=[...a[l]];Bd.isEqual(c,u)||r.push({update:d=>{s[l].fromArray(Bd.lerp(c,u,d))},start:()=>{s[l].fromArray(c)},end:()=>{s[l].fromArray(u)}})}return r.length?r:void 0}function goe(i){let t=i.getNode("mat");if(typeof t?.updateMatrix=="function")return t;let e=i.getValue("mat");return typeof e?.updateMatrix=="function"?e:void 0}function yoe(i,t,e,n="texture",r){if(!i.hasValue(n)||!(n in e))return;let s=v=>Number(typeof v=="string"?r?.getVariable(v)??0:v??0),o=i.getNode("rotation"),a=t?s(t[n]?.rotation):(o?.value??0)*ge.RAD2DEG,l=s(e[n]?.rotation);if(o&&Math.abs(a-l)>1e-9)return{update:v=>{o.value=ge.lerp(a,l,v)*ge.DEG2RAD},start:()=>{o.value=a*ge.DEG2RAD},end:()=>{o.value=l*ge.DEG2RAD}};let c=goe(i);if(!c)return;let u=t?t[n]:c,d=e[n],h=[...u.repeat],p=[...u.offset],f=[...d.repeat],m=[...d.offset],g=u.rotation??0,y=d.rotation??0;if(!Ws.isEqual(h,f)||!Ws.isEqual(p,m)||g!==y)return{update:v=>{c.repeat=Ws.lerp(h,f,v),c.offset=Ws.lerp(p,m,v),c.rotation=ge.lerp(g,y,v),c.updateMatrix()},start:()=>{c.repeat=[...h],c.offset=[...p],c.rotation=g,c.updateMatrix()},end:()=>{c.repeat=[...f],c.offset=[...m],c.rotation=y,c.updateMatrix()}}}function zO(i,t,e,n,r,s){let o=Y5(t,e,n,i,s);!o||(Array.isArray(o)?o.forEach(a=>a.update(r)):o.update(r))}function voe(i,t){return{update:()=>{i.setTransparent(t)}}}function $5(i,t,e,n,r){let s=boe(i,t);return{duration:e,evaluate(o,a){i.resetBBoxNeedsUpdate();let l=Soe();for(let c of s)Eoe(c,i,o,n,r,a,l);woe(i,l,n)},invalidate(){for(let o of s)O5(o.track)}}}function boe(i,t){let e=[];return tc.groupKeyframes(t.keyframes).forEach(n=>{let r=n.path?.[0],s=n.path[1],o=()=>Mh(n.keyframes,a=>a.value);switch(r){case"position":case"rotation":case"scale":s&&mf.includes(s)&&e.push({on:r,axis:s,track:o()});return;case"shape size":s&&mf.includes(s)&&"geometry"in i&&e.push({on:"shapeSize",axis:s,track:o()});return;case"path extrusion":$d(i)&&e.push({on:"pathExtrusion",track:Mh(n.keyframes,a=>a.value)});return;case"path snapping":i.data.pathSnapping&&e.push({on:"pathSnapping",track:Mh(n.keyframes,a=>a.value)});return;case"material":i.type==="Mesh"&&"material"in i&&xoe(i,n).forEach(a=>e.push(a));return;case"opacity":i.type==="Mesh"&&"material"in i&&e.push({on:"opacity",track:o()});return;case"cloner":e.push({on:"cloner",track:Mh(n.keyframes,a=>a.value)});return;case"camera":i instanceof rn&&e.push({on:"camera",field:"zoom",track:o()});return;case"light":(i instanceof pc||i instanceof _h||i instanceof fc)&&e.push({on:"light",field:n.path[1],track:Mh(n.keyframes,a=>a.value)});return}}),e}function xoe(i,t){let e=$w(i.material)?i.material:void 0,n=t.layerId;if(!e||!n)return[];let r=t.keyframes.some(u=>da(u.data.value?.noiseStrength)),s=e.ensureRainbowNoiseCompiled,o=u=>{r&&typeof s=="function"&&s.call(e,u)},a=u=>"data"in u?[{on:"material",layer:u,track:Mh(t.keyframes,d=>d.value)}]:[];o(n);let l=e.getLayerByUuid(n);if(l)return a(l);let c=t.path[1];for(let u of e.getLayersOfType(c))o(u.uuid);return(e.getLayersOfType(c)??[]).flatMap(a)}function Soe(){return{transform:!1,size:!1,cloner:!1,bounds:!1,boolean:!1,render:!1}}function woe(i,t,e){if(t.size&&i instanceof Yt){let{x:n,y:r,z:s}=i.userData.value;i.updateGeometryInteractions({width:n,height:r,depth:s},e.shared)}t.cloner&&i.cloner?.update(e),t.transform&&i.updateMatrix(),t.bounds&&i.resetBBoxNeedsUpdate(),t.boolean&&i instanceof Yt&&i.invalidateDownstreamBooleanData(),t.render&&i.dispatchEvent({type:"requestRender"})}function Ac(i,t,e){!i||(i[t]={...i[t],...e})}function Eoe(i,t,e,n,r,s,o){let a=()=>{o.transform=!0,o.bounds=!0,o.boolean=!0,o.render=!0};switch(i.on){case"position":case"scale":{let l=xa(i.track,e);if(!l)return;let c=Bb(l.from,l.to,l.t);t[i.on][i.axis]=c,Ac(s,i.on,{[i.axis]:c}),a();return}case"rotation":{let l=xa(i.track,e);if(!l)return;let c=Bb(l.from,l.to,l.t);t.rotation[i.axis]=c*ge.DEG2RAD,Ac(s,"rotation",{[i.axis]:c}),a();return}case"shapeSize":{let l=xa(i.track,e);if(!l||!(t instanceof Yt))return;let c=Bb(l.from,l.to,l.t);t.userData.value={...t.userData.value,[i.axis]:c},Ac(s,"shapeSize",{[i.axis]:c}),o.size=!0,o.bounds=!0,o.boolean=!0,o.render=!0;return}case"opacity":{let l=xa(i.track,e);if(!l||!(t instanceof Kt)||Array.isArray(t.material))return;let c=t.material.getLayersOfType("light")[0];if(c===void 0)return;let u=ge.lerp(l.from,l.to,l.t);t.material.transparent=!0,zO("alphaOverride",c,{alphaOverride:u},{alphaOverride:u+1},0,n.shared),s&&(s.opacity=u),o.render=!0;return}case"material":{let l=xa(i.track,e);if(!l||Object.keys(l.from).length===0||Object.keys(l.to).length===0)return;let{layer:c}=i,u={};for(let d in c.data){if(!(d in l.from)||!(d in l.to))continue;let h=GO(l.from[d],l.to[d],l.t,r);if(h===void 0)continue;u[d]=h;let p=c.getValue(d);p!==void 0&&(d==="alpha"&&typeof p=="number"&&p>0&&t instanceof Kt&&!Array.isArray(t.material)&&(t.material.transparent=!0),zO(d,c,l.from,l.to,l.t,n.shared))}Ac(s,"material",{[c.uuid]:u}),o.render=!0;return}case"light":{let l=xa(i.track,e);if(!l||!(t instanceof pc||t instanceof _h||t instanceof fc))return;let c=GO(l.from,l.to,l.t,r);t[i.field]=c,Ac(s,"light",{[i.field]:c}),o.render=!0;return}case"camera":{let l=xa(i.track,e);if(!l||!(t instanceof rn))return;let c=Bb(l.from,l.to,l.t);t[i.field]=c,Ac(s,"camera",{[i.field]:c});return}case"cloner":{let l=xa(i.track,e);if(!l)return;let u=t.cloner?.parameters,d=H5(u,l.from,l.to,l.t);W5(u,d),Ac(s,"cloner",d),o.cloner=!0,o.boolean=!0,o.render=!0;return}case"pathExtrusion":{let l=xa(i.track,e);if(!l||!$d(t))return;let c=$m(Jy,l.from,l.to,l.t),u=t.geometry.userData.parameters;u.extrusion={...u.extrusion,...c},Ac(s,"pathExtrusion",c),t.updateGeometryInteractions({extrusion:{...u.extrusion}},n.shared),o.bounds=!0,o.boolean=!0,o.render=!0;return}case"pathSnapping":{let l=xa(i.track,e);if(!l)return;let c=t,u=$m(rU,l.from,l.to,l.t);c.userData.pathSnapping={...c.userData.pathSnapping,...u},Ac(s,"pathSnapping",u),c.updatePathSnapping(c.userData.pathSnapping),o.render=!0;return}}}function GO(i,t,e,n){if(typeof i=="string"&&n&&(i=n.color(i)),typeof t=="string"&&n&&(t=n.color(t)),typeof i=="number")return ge.lerp(i,t,e);if(Vt.is(i))return Vt.lerp(i,t,e);if(yr.is(i))return yr.lerp(i,t,e);if(Array.isArray(i))return(i.length>t.length?t:i).map((s,o)=>{if(Array.isArray(s)){let a=i[o].length>t[o].length?t[o].length:i[o].length;return(a===4?Bd:a===3?po:Ws).lerp(i[o],t[o],e)}return ge.lerp(i[o],t[o],e)});if(typeof i=="object"&&i!==null){let r={};for(let s in i){let o=GO(i[s],t[s],e,n);o!==void 0&&(r[s]=o)}return r}}dn();fr();pt();Xs();fr();ii();Xs();em();$i();Mu();q();function K5(i,t,e,n){let r=[],s=i.cameraType==="OrthographicCamera"?t.orthographic?.zoom:t.perspective?.zoom,o=i.cameraType==="OrthographicCamera"?e.orthographic?.zoom:e.perspective?.zoom;if(o!==void 0){let a=s??i.zoom,l=o;a!==l&&r.push({update:c=>{i.zoom=ge.lerp(a,l,c),i.updateProjectionMatrix()},start:()=>{i.zoom=a,i.updateProjectionMatrix()},end:()=>{i.zoom=l,i.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let a=Vr("targetOffset",i,t,e,n);a&&r.push(a)}return r}pt();q();lm();fr();dn();function Toe(i,t,e,n){if(e.scaleBaked===void 0)return;let r=(t.scaleBaked??i.appliedGeometrySize??i.data.geometry.scaleBaked).map(a=>typeof a=="string"?Number(n.shared.getVariable(a)??0):a),s=e.scaleBaked.map(a=>typeof a=="string"?Number(n.shared.getVariable(a)??0):a);if(po.isEqual(r,s))return;let o=[];return o.push({update:a=>{i.updateGeometryInteractions({scaleBaked:[ge.lerp(r[0],s[0],a),ge.lerp(r[1],s[1],a),ge.lerp(r[2],s[2],a)]},n.shared),i.invalidateDownstreamBooleanData(),i.refreshAttachedClonersInteractions(n)},start:()=>{i.updateGeometryInteractions({scaleBaked:r},n.shared),i.invalidateDownstreamBooleanData(),i.refreshAttachedClonersInteractions(n)},end:()=>{i.updateGeometryInteractions({scaleBaked:s},n.shared),i.invalidateDownstreamBooleanData(),i.refreshAttachedClonersInteractions(n)}}),o}function Moe(i,t,e,n){if(!e.extrusion)return;let r=i.extrusion,s=t.extrusion??{},o=e.extrusion,a=[];return Jy.forEach(l=>{let c=hl(l,r,s,o,n);c&&a.push(c)}),a}function Z5(i,t,e,n){let r=[];if(!("geometry"in e)||Xi(i))return r;let s=i.geometry.userData.parameters,o="geometry"in t?t.geometry:{},a=e.geometry;if(i instanceof fa){let l=Toe(i,o,a,n);l&&r.push(...l)}else{let l={},c=i.appliedGeometrySize;if(Object.assign(l,Vy(s,y1),c?{width:c[0],height:c[1],depth:c[2]}:{},Vy(o,y1)),y1.forEach(u=>{let d=hl(u,l,o,a,n.shared);d&&r.push(d)}),$d(i)){Object.assign(l,{extrusion:{...s.extrusion}});let u=Moe(l,o,a,n.shared);u&&r.push(...u)}r.length&&r.push({update:u=>{i.updateGeometryInteractions(l,n.shared),i.updateGeometryGroupsIfNeeded(),i.refreshAttachedClonersInteractions(n)},start:u=>{i.updateGeometryInteractions(l,n.shared),i.updateGeometryGroupsIfNeeded(),i.refreshAttachedClonersInteractions(n)},end:u=>{i.updateGeometryInteractions(l,n.shared),i.updateGeometryGroupsIfNeeded(),i.refreshAttachedClonersInteractions(n)}})}return r}function Q5(i,t,e,n){let r=[];if(e.intensity!==void 0){let s=Vr("intensity",i,t,e,n);s&&r.push(s)}if(e.color!==void 0){let s=V5("color",i,t,e,n);s&&r.push(s)}return r}fr();q();hc();q();var jO=new M,J5=new Ht;function eW(i,t,e,n,r){let s=[],o,a,l,c,u,d,h,p;if(Rr(i)?(o=Ym("position",i,t,e,r),o&&s.push(o),l=Vr("rotation",i,t,e,r),l&&s.push(l),c=Ym("shear",i,t,e,r),c&&s.push(c)):(p={slide:t.pathSnapping?.slide??i.updatedPathSnapping?.slide??i.dataPatched.pathSnapping?.slide??0,offset:t.pathSnapping?.offset??i.updatedPathSnapping?.offset??i.dataPatched.pathSnapping?.offset??0},d=Vr("slide",p,t.pathSnapping??i.updatedPathSnapping??i.dataPatched.pathSnapping,e.pathSnapping??i.dataPatched.pathSnapping,r),d&&s.push(d),h=Vr("offset",p,t.pathSnapping??i.updatedPathSnapping??i.dataPatched.pathSnapping,e.pathSnapping??i.dataPatched.pathSnapping,r),h&&s.push(h),!d&&!h&&(o=VO("position",i,t,e,r),o&&s.push(o),a=VO("scale",i,t,e,r),a&&s.push(a),l=_oe(i,t,e,n,r),l&&s.push(l),u=k5("hiddenMatrix",i,t,e),u&&s.push(u))),o||a||l||u||d||h){let f=Rr(i)?()=>{i.updateWorldMatrix(!0,!1,!0),i.resetBBoxNeedsUpdate()}:()=>{i.updateMatrix(),i.hasNonUniformScale&&(i.updateMatrixWorld(),i.updateMatrixWorldRigid()),i.parent?.matrixWorldFusedFalse&&(i.matrixWorld.multiplyMatrices(i.parent.matrixWorldFusedFalse,i.matrix),i.matrixWorldNeedsUpdate=!1),As(i)&&ds(i.parent)&&i.invalidateDownstreamBooleanData(!0),i.updatePathSnapping(Object.assign({},t.pathSnapping,p))};s.push({update:f,start:f,end:f})}return s}function _oe(i,t,e,n,r){let s=t?.rotation?t.rotation.map(u=>(typeof u=="string"?Number(r.getVariable(u)??0):u)*ge.DEG2RAD):void 0,o=e.rotation?.map(u=>(typeof u=="string"?Number(r.getVariable(u)??0):u)*ge.DEG2RAD);if(!o)return;let a=s?new M().fromArray(s):new M().setFromEuler(i.rotation),l=new M().fromArray(o);if(a.equals(l))return;let c=jO.subVectors(l,a);if(n&&c.toArray().every(u=>Math.abs(u)<2*Math.PI)){let u=new ke().setFromEuler(J5.setFromVector3(a)),d=new ke().setFromEuler(J5.setFromVector3(l));return{update:h=>{U5(u,d,i.quaternion,h)},start:()=>{i.rotation.setFromVector3(a)},end:()=>{i.rotation.setFromVector3(l)}}}else return{update:u=>{jO.lerpVectors(a,l,u),i.rotation.setFromVector3(jO)},start:()=>{i.rotation.setFromVector3(a)},end:()=>{i.rotation.setFromVector3(l)}}}function Aoe(i,t){return{update:()=>{i instanceof sr&&(i.fill.enabled=t)}}}function Coe(i,t){return{update:()=>{i instanceof sr&&(i.stroke.enabled=t)}}}function Poe(i,t){return{update:()=>{i instanceof sr&&(i.dropShadow.enabled=t)}}}function Roe(i,t){return{update:()=>{i instanceof sr&&(i.innerShadow.enabled=t)}}}function Ioe(i,t){return{update:()=>{i instanceof sr&&(i.backgroundBlur.enabled=t)}}}function Ooe(i,t){return{update:()=>{i instanceof sr&&(i.layerBlur.enabled=t)}}}function tW(i,t,e,n,r){let s=[],o,a,l,c,u,d,h,p,f,m,g,y,v,b,x;if("width"in i&&(o=Vr("width",i,t,e,r),o&&s.push(o)),"height"in i&&(a=Vr("height",i,t,e,r),a&&s.push(a)),i instanceof sr||i instanceof Bi){let S={...t.fill},E={...e.fill};S.enabled!==void 0&&S.enabled!==E.enabled&&(s.push(Aoe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),E.enabled||Object.assign(E,{enabled:!0,color:{...E.color,a:0}})),l=kb("color",i.fill,S,E,r),l&&s.push(l)}if(i instanceof sr){let S={...t.stroke},E={...e.stroke};(S.enabled||E.enabled)&&(s.push(Coe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),E.enabled||Object.assign(E,{enabled:!0,color:{...E.color,a:0}})),c=kb("color",i.stroke,S,E,r),c&&s.push(c),u=Vr("thickness",i.stroke,S,E,r),u&&s.push(u)}if(i instanceof sr){let S={...t.dropShadow},E={...e.dropShadow};(S.enabled||E.enabled)&&(s.push(Poe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),E.enabled||Object.assign(E,{enabled:!0,color:{...E.color,a:0}})),d=kb("color",i.dropShadow,S,E,r),d&&s.push(d),h=Vr("blurRadius",i.dropShadow,S,E,r),h&&s.push(h),f=Vr("spread",i.dropShadow,S,E,r),f&&s.push(f),p=Ym("offset",i.dropShadow,S,E,r),p&&s.push(p)}if(i instanceof sr){let S={...t.innerShadow},E={...e.innerShadow};(S.enabled||E.enabled)&&(s.push(Roe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),E.enabled||Object.assign(E,{enabled:!0,color:{...E.color,a:0}})),m=kb("color",i.innerShadow,S,E,r),m&&s.push(m),g=Vr("blurRadius",i.innerShadow,S,E,r),g&&s.push(g),v=Vr("spread",i.innerShadow,S,E,r),v&&s.push(v),y=Ym("offset",i.innerShadow,S,E,r),y&&s.push(y)}if(i instanceof sr||i instanceof Bi){let S={...t.backgroundBlur},E={...e.backgroundBlur};(S.enabled||E.enabled)&&(s.push(Ioe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,radius:0}),E.enabled||Object.assign(E,{enabled:!0,radius:0})),b=Vr("radius",i.backgroundBlur,S,E,r),b&&s.push(b)}if(i instanceof sr){let S={...t.layerBlur},E={...e.layerBlur};(S.enabled||E.enabled)&&(s.push(Ooe(i,!0)),S.enabled||Object.assign(S,{enabled:!0,radius:0}),E.enabled||Object.assign(E,{enabled:!0,radius:0})),x=Vr("radius",i.layerBlur,S,E,r),x&&s.push(x)}if(i instanceof Bi||i instanceof Oo){let S=Ub("cornerRadius",i,t,e,r);S&&s.push(S)}return s}function nW(i,t,e,n,r){let s=[];return i.data.visible&&s.push(...eW(i,t,e,r,n.shared)),Rr(i)?s.push(...tW(i,t,e,r,n.shared)):(i.data.visible&&s.push(...G5(i,t,e,n)),i instanceof Kt?(i instanceof Yt&&i.data.visible&&s.push(...Z5(i,t,e,n)),i.data.visible&&!(i instanceof Mr&&i.materialOverride)&&s.push(...X5(i,t,e,n.shared))):Qf.is(i)?i.data.visible&&s.push(...Q5(i,t,e,n.shared)):i instanceof rn&&s.push(...K5(i,t,e,n.shared))),s.length?{update:o=>{s.forEach(a=>a.update(o))},start:o=>{s.forEach(a=>a.start?.(o))},end:o=>{s.forEach(a=>a.end?.(o))}}:void 0}var HO={type:"beginState"};function WO(i){if(i.easing===5){let{control1:t,control2:e}=i;return{easing:5,control1:t??Kl.defaultData.control1,control2:e??Kl.defaultData.control2}}if(i.easing===6){let{mass:t,stiffness:e,damping:n,velocity:r}=i;return{easing:6,mass:t??ea.defaultData.mass,stiffness:e??ea.defaultData.stiffness,damping:n??ea.defaultData.damping,velocity:r??ea.defaultData.velocity}}return{easing:i.easing}}function qO(i){return{delay:i.delay,delayDirection:i.delayDirection??"start-end",direction:i.direction??"normal",repeat:i.repeat}}function Doe(i){return{duration:i.duration,ease:WO(i),...qO(i)}}var XO={type:"completeState",isfromEntity:!1};function Km(i,t){let e,n;if(typeof t=="string"?(e=t,n=i.states?.[e]):t===null&&(e=null,n=i.data),!(e===void 0||n===void 0))return{id:e,data:n}}var Loe=["position","rotation","scale","shear","hiddenMatrix"],RM=new Set;function rW(i){if(i.length<2)return RM;let t=new Set,[e,...n]=i;for(let r of Loe){let s=e[r];s!==void 0&&n.every(o=>Jo(o[r],s))&&t.add(r)}return t}function Noe(i,t){if(t.size===0)return i;let e={...i};for(let n of t)delete e[n];return e}var Ah=class{constructor(t,e,n,r,s,o,a,l={},c=()=>RM){this.object=t;this.fromRef=e;this.toRef=n;this.data=r;this.sharedAssets=s;this.allowSlerp=o;this.page=a;this.hooks=l;this.inert=c;this.builtReversed=!1;this.startStateId=null;this.buildCallback=()=>{this.builtReversed=this.runner.isReversed,this.startStateId=Rr(this.object)?null:this.object.transitionState.state,this.callback=nW(this.object,{},Noe(this.end.data,this.inert()),{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp)};this.onChange=t=>{this.builtReversed!==this.runner.isReversed&&this.buildCallback(),this.callback&&(this.callback.update(t),this.object.requestRender()),this.writeState(t)};this.runner=new Vm(Doe(r),this.onChange,this.buildCallback),this.rebind()}rebind(){let{fromRef:t,toRef:e}=this;if(t===void 0){let r=Km(this.object,this.object.currentState===e?this.object.prevState:this.object.currentState);if(!r)throw new Error("Missing property");this.from=r}else{let r=Km(this.object,t);if(!r)throw new Error("Missing property");this.from=r}if(e===void 0)throw new Error("Missing property");let n=Km(this.object,e);if(!n)throw new Error("Missing property");this.to=n,this.buildCallback()}refresh(){this.buildCallback()}get endpointData(){return[this.from.data,this.to.data]}get targetStateId(){return this.builtReversed?this.from.id:this.to.id}get start(){return this.builtReversed?this.to:this.from}get end(){return this.builtReversed?this.from:this.to}writeState(t){if(t===0||Rr(this.object))return;let e=t===1,n=t>.5?this.targetStateId:this.startStateId,r=this.object.transitionState;r.settled===e&&r.state===n||(this.object.transitionState={settled:e,state:n},this.object.reversibleToState=this.end.id,this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=n,this.object.dispatchEvent({type:"transitionState",settled:e,state:n}),this.object.dispatchEvent({type:e?"completeState":"beginState",state:n}),this.object.traverseEntity(s=>{s!==this.object&&s instanceof rn&&s.dispatchEvent(e?XO:HO)}),e?this.hooks.onComplete?.(n):this.hooks.onBegin?.(n))}};Xs();var YO=new Map,Vb=new Map,Zs=class extends Mn{constructor(e,n,r,s,o,a,l){super();this.id=e;this.data=n;this.scene=r;this.sharedAssets=s;this.object=o;this.eventType=a;this.actionCondition=l;this.evaluators=[];this.elapsed=0;this.lastTime=null;this.direction=1;this._playing=!1;this._finished=!1;this.hasPlayedOnce=!1;this.pauseOnNextCycleEnd=!1;this.lastCycleIndex=0;try{let c=bo.findTimeline(this.scene.data.objects,this.data.timeline),u=c.duration;this.animatedObjectIds=Object.keys(c.objectTimelines),this.animatedObjectIds.forEach(d=>{let h=this.scene.find(d);if(!h)return;let p=c.objectTimelines[d];!p||this.evaluators.push($5(h,{...p},u,{scene:r,shared:s},this.sharedAssets))}),this.schedule=new qT(YH(this.data,u))}catch(c){throw!1&&console.error(c),new Error("Missing property")}o&&(Vb.has(o.uuid)?Vb.get(o.uuid).push(this):Vb.set(o.uuid,[this])),YO.set(e,this)}get playing(){return this._playing}get finished(){return this._finished}get paused(){return!this._playing}update(e){this.lastTime!==null&&(this.elapsed=Math.max(0,this.elapsed+(e-this.lastTime)*this.direction)),this.lastTime=e,this.applyAtElapsed()}applyAtElapsed(){if(this.direction===-1&&this.elapsed===0){this.pause();return}let e=this.schedule.resolve(this.elapsed);if(e){if(e.cycleIndex!==this.lastCycleIndex&&(this.lastCycleIndex=e.cycleIndex,this.pauseOnNextCycleEnd)){this.pauseOnNextCycleEnd=!1,this.pause();return}for(let n of this.evaluators)n.evaluate(e.localTime);return}this.direction===1&&this.schedule.isFinished(this.elapsed)&&this.finish()}finish(){this.pause(),this._finished=!0,this.animatedObjectIds.forEach(e=>{let n=this.scene.find(e);n instanceof rn&&n.dispatchEvent(XO)})}startTicking(){this._playing=!0,this.lastTime=null;for(let e of this.evaluators)e.invalidate();cr.add(this)}play(){let e=this.eventType!==void 0&&Ky(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&this.paused&&this.elapsed>0&&!this._finished;if(this.eventType!==void 0&&Ky(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce&&!e||this.eventType===void 0&&this._finished)return!1;this.hasPlayedOnce=!0,this.animatedObjectIds.forEach(n=>{let r=this.scene.find(n);r instanceof rn&&r.dispatchEvent(HO)}),!e&&(this.elapsed===0||this._finished)&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.startTicking()}pause(){this._playing=!1,this.lastTime=null,cr.remove(this)}stop(){this.pause(),this.elapsed=0,this.lastCycleIndex=0,this.applyAtElapsed(),this._finished=!1}seek(e){let n=this.schedule.totalDuration;this.elapsed=e*(Number.isFinite(n)?n:this.schedule.effectiveCycleDuration);for(let r of this.evaluators)r.invalidate();this.applyAtElapsed()}toggle(e){let n=e??this.direction===-1;if(this._playing&&this.direction===(n?1:-1)){n&&(this.pauseOnNextCycleEnd=!1);return}n?(this._finished&&(this.elapsed=0,this.lastCycleIndex=0,this._finished=!1),this.direction=1,this.pauseOnNextCycleEnd=!1):(this.direction=this.schedule.resolve(this.elapsed)?.isReverse?1:-1,this.pauseOnNextCycleEnd=!0),this.startTicking()}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}},$O=class{constructor(t){this.data=t}dispatch(){this.data.playTimeline?this.pauseTimeline(this.data.playTimeline):this.data.object?this.pauseAllTimelinesFromObject(this.data.object):this.pauseAllTimelines()}pauseTimeline(t){let e=this.getTimelineActions(t);!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(n=>{n[this.data.interaction]()}),this.disposeDelay()},this.data.delay)):e.forEach(n=>{n[this.data.interaction]()}))}getTimelineActions(t){let e=YO.get(t);return e?[e]:[...YO.values()].filter(n=>n.data.timeline===t)}pauseAllTimelinesFromObject(t){let e=Vb.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(n=>n[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(n=>n[this.data.interaction]()))}pauseAllTimelines(){let t=[...Vb.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e.forEach(n=>{n[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e.forEach(n=>{n[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},IM=class{constructor(t,e,n,r,s,o,a){this.data=e;let l="interaction"in e?e.interaction:"play";if(l==="play"||l===void 0)this.interaction=new Zs(t,e,n,r,s,o,a);else if(l==="pause"||l==="stop")this.interaction=new $O(e);else throw new Error("Missing property")}get playing(){return this.interaction instanceof Zs?this.interaction.playing:!1}get finished(){return this.interaction instanceof Zs?this.interaction.finished:!0}get paused(){return this.interaction instanceof Zs?this.interaction.paused:!0}play(){if(this.interaction instanceof Zs)return this.interaction.play();this.interaction.dispatch()}stop(){this.interaction instanceof Zs&&this.interaction.stop()}seek(t){this.interaction instanceof Zs&&this.interaction.seek(t)}toggle(t){this.interaction instanceof Zs?this.interaction.toggle(t):this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof Zs?this.interaction.playFromCurrent():this.interaction.dispatch()}dispatchConditional(){this.interaction instanceof Zs?Xt(this.interaction.sharedAssets,this.interaction.actionCondition)&&this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof Zs&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};Qt();mr("TimelineAnimation",({id:i,data:t,page:e,shared:n,object:r,eventType:s,actionCondition:o})=>new IM(i,t,e.scene,n,r,s,o));Mt("timeline");fr();pt();q();Xs();function iW(i){let t=i.tweens[0]?.data;return{delay:t?.delay??i.delay,delayDirection:t?.delayDirection??"start-once",direction:t?.direction??i.direction,repeat:t?.repeat??i.repeat}}var Boe={state:null,duration:0,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,easing:0},OM=class extends Mn{constructor(e,n,r,s,o,a){super();this.eventType=e;this.data=n;this.page=r;this.shared=s;this.condition=o;this.runModeOverride=a;this.tweens=[];this.hasPlayedOnce=!1;this.inert=RM;if(!n.object)throw new Error("Missing property");let l=this.page.scene.find(n.object)??this.page.uiCanvas?.find(n.object)??this.page.scene.find2DInUIObjects(n.object);if(!l)throw new Error("Missing property");if(!l.states)throw new Error("Missing property");if(this.object=l,n.tweens.length<2)throw new Error("Missing property");this.init()}get playing(){return this.runner?.isPlaying===!0}get animating(){return this.runner?.isAnimating===!0}get claimTime(){return this.runner?.claimTime}get contested(){let e=this.object.previousAction;return e!==null&&e!==this&&e.animating}init(){this.initialCurrentState=Km(this.object,this.object.currentState).id,this.build()}shouldReinit(){return Xt(this.shared,this.condition)?!0:!(this.animating&&!this.loopsForever)}get loopsForever(){return iW(this.data).repeat===-1||this.data.tweens.some((e,n)=>n>0&&e.data.repeat===-1)}get runMode(){return this.runModeOverride!==void 0?this.runModeOverride:Ky(this.eventType)?this.data.runMode:"Repeat"}get currentState(){return this.runMode==="Toggle"?this.initialCurrentState:this.object.currentState}get opensOnCurrent(){return this.data.tweens[0].data.state===void 0&&this.runMode!=="Toggle"}build(){let e=this.data.tweens,n=[];try{let r=e[0].data.state;r!==void 0&&n.push(new Ah(this.object,r,r,Boe,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert));for(let s=1;s<e.length;s++){let o=e[s-1],a=e[s];n.push(new Ah(this.object,o.data.state===void 0?this.currentState:o.data.state,a.data.state===void 0?this.currentState:a.data.state,a.data,this.shared,this.data.allowSlerp??!1,this.page,{},()=>this.inert))}}catch(r){r instanceof Error&&console.error(r.message);return}this.tweens=n,this.syncInert(),this.runner=new km({...qO(iW(this.data)),runMode:this.runMode},n.map(r=>r.runner),{claim:r=>this.claimObject(r),assignCurrentState:()=>this.rebindTweens(),isOwner:()=>this.object.previousAction===this})}claimObject(e){if(this.object.previousAction===this)return!1;let n=this.object.previousAction;if(n?.animating===!0){if(e!==void 0&&n.claimTime!==void 0&&n.claimTime>e)return!1;n.pause()}return this.object.previousAction=this,!0}rebindTweens(){for(let e of this.tweens)try{e.rebind()}catch(n){n instanceof Error&&console.error(n.message)}this.syncInert(),this.object instanceof rn&&this.object.wasMovedByUser&&(this.object.wasMovedByUser=!1)}syncInert(){let e=this.tweens.flatMap(n=>n.endpointData);if(this.opensOnCurrent&&e.length>0){let n=Km(this.object,this.object.currentState);n&&(e[0]=n.data)}this.inert=this.notMovedByOwner(rW(e));for(let n of this.tweens)n.refresh()}notMovedByOwner(e){let n=this.object.previousAction;if(e.size===0||n===null||n===this||!n.animating)return e;let r=n.leavesAlone;return new Set([...e].filter(s=>r.has(s)))}get leavesAlone(){return this.inert}update(e){this.runner?.update(e),this.runner?.isPlaying!==!0&&cr.remove(this)}play(){if(Xt(this.shared,this.condition)===!1||this.runMode==="Once"&&this.hasPlayedOnce)return!1;this.hasPlayedOnce=!0,this.start()}start(){!this.runner||(this.runner.play(cr.time),this.runner.isPlaying&&cr.add(this))}pause(){this.runner?.stop(),cr.remove(this)}stop(){this.pause();let e=this.data.tweens[0].data.state===void 0?this.initialCurrentState:this.data.tweens[0].data.state;Rr(this.object)?this.object.changeSelectedState(e,{shared:this.shared}):this.object.changeSelectedState(e,{scene:this.page.scene,shared:this.shared}),this.object.currentState=e}seek(e){if(Xt(this.shared,this.condition)===!1)return!1;this.runner?.seek(e)}playDirected(e){if(Xt(this.shared,this.condition)===!1)return!1;!this.runner||(this.runner.playDirected(cr.time,e),this.runner.isPlaying&&cr.add(this))}playFromCurrent(){this.playDirected(!0)}reverseFromCurrent(){this.playDirected(!1)}dispose(){this.pause()}};pt();q();dn();function DM(i){let t=i?.tracks.filter(e=>e.ValueTypeName==="vector"||e.ValueTypeName==="quaternion").map(e=>e.times.length);if(t?.length){let e=X3(t);return e&&e>2?e:2}return 2}var Zm=new Map,zb=new WeakSet;function sW(i,t){if(t===void 0)return;let e=i.scene.find(t);return e&&Array.isArray(e.identity)?e.identity[0]:t}var Sa=class extends Mn{constructor(e,n,r,s,o){super();this.page=n;this.animationControls=r;this.shared=s;this.condition=o;this.startOnceDelay=0;this.toggleIsForward=!1;let a=sW(n,e.object)??e.object;this.data={...e,object:a};let l=this.animationControls.clipIdToAction[e.clipId+"/"+a];if(this.duration=l?.getClip()?.duration??1,this.data.crop2){let u=DM(l?.getClip());this.leftFrameTime=this.data.crop2[0]/(u-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(u-1)*this.duration}else{let u=l?.getClip()?.tracks[0]?.times.length;u&&u>1?(this.leftFrameTime=this.data.crop[0]/u*this.duration,this.rightFrameTime=this.data.crop[1]/u*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=e.delay;let c=Zm.get(a);c||(c=new Set,Zm.set(a,c)),c.add(this)}get playing(){return this.threeAnimAction?.isRunning()??!1}cancelPending(){window.clearTimeout(this.timeoutId),delete this.timeoutId}resume(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object];return!e||!zb.has(e)?!1:(zb.delete(e),this.threeAnimAction=e,e.paused=!1,e.play(),this.animationControls.requestRender(),!0)}play(e=!1){if(Xt(this.shared,this.condition)===!1)return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{if(this.resume()||(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction))return;zb.delete(this.threeAnimAction),this.threeAnimAction.reset(),this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime;let n=this.data.object;Object.entries(this.animationControls.clipIdToAction).forEach(([r,s])=>{let o=r.split("/")[1];this.threeAnimAction!==s&&o===n&&(e?s.fadeOut(.2):s.stop())}),e&&this.threeAnimAction?.fadeIn(.2)},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),this.cancelPending()}stop(){this.threeAnimAction?.fadeOut(.2)}seek(e){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=ge.clamp(this.threeAnimAction.time+1/60*e,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(e,n=!1){if(Xt(this.shared,this.condition)===!1)return!1;this.toggleIsForward=e??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing||this.resume()?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction){this.toggleIsForward?(this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction.time=this.rightFrameTime,this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime),this.threeAnimAction.paused=!1,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1;let r=this.data.clipId.split("/")[1];Object.entries(this.animationControls.clipIdToAction).forEach(([s,o])=>{let a=s.split("/")[1];this.threeAnimAction!==o&&a===r&&o.isRunning()&&(n?o.fadeOut(.2):o.stop())}),n&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();e&&(e.duration=this.duration),this.pause();let n=Zm.get(this.data.object);n&&(n.delete(this),n.size===0&&Zm.delete(this.data.object))}},KO=class{constructor(t,e,n){this.data=t;this.page=e;this.animationControls=n;this.objectId=sW(e,t.object)}dispatch(){this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{this.apply(),this.disposeDelay()},this.data.delay)):this.apply()}targetsClip(t,e){return!(this.objectId!==void 0&&e!==this.objectId||this.data.clipId&&t!==this.data.clipId)}apply(){(this.objectId!==void 0?[Zm.get(this.objectId)]:[...Zm.values()]).forEach(n=>{n?.forEach(r=>{this.targetsClip(r.data.clipId,r.data.object)&&r.cancelPending()})});let e=!1;Object.entries(this.animationControls.clipIdToAction).forEach(([n,r])=>{let[s,o]=n.split("/");if(!!this.targetsClip(s,o))if(this.data.interaction==="pause"){if(!r.isRunning())return;r.paused=!0,zb.add(r)}else{if(!r.enabled||!r.isRunning()&&!r.paused)return;r.paused=!0,zb.delete(r),r.time=r._clip.start??0,r._loopCount=-1,e=!0}}),e&&(this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){this.disposeDelay()}},LM=class{constructor(t,e,n,r,s){QS.isPause(t)?this.interaction=new KO(t,e,n):this.interaction=new Sa(t,e,n,r,s)}get data(){return this.interaction.data}get playing(){return this.interaction instanceof Sa?this.interaction.playing:!1}play(t=!1){if(this.interaction instanceof Sa)return this.interaction.play(t);this.interaction.dispatch()}pause(){this.interaction instanceof Sa&&this.interaction.pause()}stop(){this.interaction instanceof Sa&&this.interaction.stop()}seek(t){this.interaction instanceof Sa&&this.interaction.seek(t)}toggle(t,e=!1){if(this.interaction instanceof Sa)return this.interaction.toggle(t,e);this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof Sa?this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof Sa&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};var oW=null;function aW(i){oW=i}function lW(){return oW}Qt();aW(Ah);mr("Transition",({eventType:i,data:t,page:e,shared:n,actionCondition:r,runModeOverride:s})=>new OM(i,t,e,n,r,s));mr("Animation",({data:i,page:t,eventManager:e,shared:n,actionCondition:r})=>new LM(i,t,e.animationControls,n,r));Mt("transitions");dn();var Foe="text/plain",Uoe="us-ascii",cW=(i,t)=>t.some(e=>e instanceof RegExp?e.test(i):e===i),koe=(i,{stripHash:t})=>{let e=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(i);if(!e)throw new Error(`Invalid URL: ${i}`);let{type:n,data:r,hash:s}=e.groups,o=n.split(";");s=t?"":s;let a=!1;o[o.length-1]==="base64"&&(o.pop(),a=!0);let l=(o.shift()||"").toLowerCase(),u=[...o.map(d=>{let[h,p=""]=d.split("=").map(f=>f.trim());return h==="charset"&&(p=p.toLowerCase(),p===Uoe)?"":`${h}${p?`=${p}`:""}`}).filter(Boolean)];return a&&u.push("base64"),(u.length>0||l&&l!==Foe)&&u.unshift(l),`data:${u.join(";")},${a?r.trim():r}${s?`#${s}`:""}`};function ZO(i,t){if(t={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...t},i=i.trim(),/^data:/i.test(i))return koe(i,t);if(/^view-source:/i.test(i))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let e=i.startsWith("//");!e&&/^\.*\//.test(i)||(i=i.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,t.defaultProtocol));let r=new URL(i);if(t.forceHttp&&t.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(t.forceHttp&&r.protocol==="https:"&&(r.protocol="http:"),t.forceHttps&&r.protocol==="http:"&&(r.protocol="https:"),t.stripAuthentication&&(r.username="",r.password=""),t.stripHash?r.hash="":t.stripTextFragment&&(r.hash=r.hash.replace(/#?:~:text.*?$/i,"")),r.pathname){let o=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,a=0,l="";for(;;){let u=o.exec(r.pathname);if(!u)break;let d=u[0],h=u.index,p=r.pathname.slice(a,h);l+=p.replace(/\/{2,}/g,"/"),l+=d,a=h+d.length}let c=r.pathname.slice(a,r.pathname.length);l+=c.replace(/\/{2,}/g,"/"),r.pathname=l}if(r.pathname)try{r.pathname=decodeURI(r.pathname)}catch{}if(t.removeDirectoryIndex===!0&&(t.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(t.removeDirectoryIndex)&&t.removeDirectoryIndex.length>0){let o=r.pathname.split("/"),a=o[o.length-1];cW(a,t.removeDirectoryIndex)&&(o=o.slice(0,-1),r.pathname=o.slice(1).join("/")+"/")}if(r.hostname&&(r.hostname=r.hostname.replace(/\.$/,""),t.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(r.hostname)&&(r.hostname=r.hostname.replace(/^www\./,""))),Array.isArray(t.removeQueryParameters))for(let o of[...r.searchParams.keys()])cW(o,t.removeQueryParameters)&&r.searchParams.delete(o);if(t.removeQueryParameters===!0&&(r.search=""),t.sortQueryParameters){r.searchParams.sort();try{r.search=decodeURIComponent(r.search)}catch{}}t.removeTrailingSlash&&(r.pathname=r.pathname.replace(/\/$/,""));let s=i;return i=r.toString(),!t.removeSingleSlash&&r.pathname==="/"&&!s.endsWith("/")&&r.hash===""&&(i=i.replace(/\/$/,"")),(t.removeTrailingSlash||r.pathname==="/")&&r.hash===""&&t.removeSingleSlash&&(i=i.replace(/\/$/,"")),e&&!t.normalizeProtocol&&(i=i.replace(/^http:\/\//,"//")),t.stripProtocol&&(i=i.replace(/^(?:https?:)?\/\//,"")),i}var NM=class{constructor({url:t,context:e},n,r,s){this.controlsManager=n;this.shared=r;this.condition=s;if(!t)throw new Error("Missing property");this.url=t.startsWith("mailto:")?t:ZO(t,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=e??"tab"}dispatch(){if(Xt(this.shared,this.condition)===!1)return!1;lo?window.location.assign(this.url):(this.context==="tab"||AC&&this.context==="none"?window.open(this.url,"_blank"):this.context==="window"?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(mt[0]),B3())}};var BM=class{constructor(t,e,n,r,s){this.data=t;this.page=e;this.shared=n;this.eventManager=r;this.condition=s}dispatch(){if(Xt(this.shared,this.condition)===!1)return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),qm(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},(this.data.delay??0)*1e3)}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}};q();var Voe={type:"beginState"},uW={type:"completeState",isfromEntity:!1},dW={type:"requestRender"},FM=class extends Mn{constructor(e,n,r,s){super();this.data=e;this.page=n;this.shared=r;this.condition=s;this.toggleIsForward=!1;this.posStart=new M;this.posEnd=new M;this.qStart=new ke;this.qEnd=new ke;this.zoomStart=1;this.zoomEnd=1}init(){}get playing(){return this.runner?.isPlaying===!0}buildAnimation(e=!1){if(!this.data.animate)return;let n=this.page.scene.find(this.data.targetCamera);if(!n||!n.visible)throw new ReferenceError("Target camera not founded or not visible");this.posStart.copy(this.page.activeCamera.position),this.qStart.copy(this.page.activeCamera.quaternion),this.zoomStart=this.page.activeCamera.zoom;let r={duration:this.data.duration,delay:0,delayDirection:"start-once",direction:"normal",repeat:0,ease:WO(this.data)},s=o=>{let a=this.page.activeCamera;a.position.lerpVectors(this.posStart,this.posEnd,o),a.quaternion.slerpQuaternions(this.qStart,this.qEnd,o),a.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*o,a.wasMovedBySwitchCameraAction=!0,a.updateMatrix(),a.updateMatrixWorld(),a.updateProjectionMatrix(),a.dispatchEvent(dW),o===1&&a.dispatchEvent(uW)};this.runner=new Vm(r,s,()=>{this.data.runMode==="Toggle"&&!this.toggleIsForward?this.fromCamera&&(this.posEnd.copy(this.fromCamera.position),this.qEnd.copy(this.fromCamera.quaternion),this.zoomEnd=this.fromCamera.zoom,this.switchCamera(this.fromCamera.uuid)):(this.posEnd.copy(n.position),this.qEnd.copy(n.quaternion),this.zoomEnd=n.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(n.uuid)),this.page.activeCamera.dispatchEvent(Voe),s(0)})}update(e){this.runner?.update(e),this.runner?.isPlaying!==!0&&cr.remove(this)}start(){!this.runner||(this.runner.start(cr.time),cr.add(this))}switchCamera(e){let n=this.page.activeCamera,r=this.page.scene.find(e);if(!r||!r.visible)throw new ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(r),n.dispatchEvent({type:"cameraChange",camera:r})}play(){if(Xt(this.shared,this.condition)===!1)return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(),this.start()):this.switchCamera(this.data.targetCamera)},this.data.delay*1e3)}catch{}}pause(){this.runner?.stop(),cr.remove(this),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(e){if(Xt(this.shared,this.condition)===!1)return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,e!==this.toggleIsForward)try{this.playing?(this.runner?.stop(),this.toggleIsForward=e??!this.toggleIsForward,this.buildAnimation(!0),this.start()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=e??!this.toggleIsForward,this.data.animate?(this.runner?.stop(),this.buildAnimation(),this.start()):(this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.switchCamera(this.data.targetCamera)):this.fromCamera&&this.switchCamera(this.fromCamera.uuid),this.page.activeCamera.dispatchEvent(uW),this.page.activeCamera.dispatchEvent(dW))},this.data.delay*1e3)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}};Yw();var UM=class{constructor(t,e,n,r){this.data=t;this.page=e;this.shared=n;this.condition=r}dispatch(){if(Xt(this.shared,this.condition)===!1)return!1;(this.data.target==="single"?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEach(e=>{this.shared.getVariable(e);let n=this.shared.data.variables.data(e)?.value;n!==void 0&&this.shared.updateVariable(e,n),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(Xw(e))})}dispose(){}};Qt();mr("Link",({data:i,eventManager:t,shared:e,actionCondition:n})=>new NM(i,t.controlsManager,e,n));mr("Reset",({data:i,page:t,shared:e,eventManager:n,actionCondition:r})=>new BM(i,t,e,n,r));mr("SwitchCamera",({data:i,page:t,shared:e,actionCondition:n})=>new FM(i,t,e,n));mr("ClearLocalStorage",({data:i,page:t,shared:e,actionCondition:n})=>new UM(i,t,e,n));Mt("misc-actions");Qt();$i();tl();KM();Yw();var ZM=class{get sharedAssets(){return this.shared}constructor(t,e={},n=!0){this.shared=new Tu(t.shared,e,!0,n),this.scene=new Xu(t.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(t,e){this.scene.clearScene(),this.sharedAssets.reset(t.shared),this.scene.resetAfterClear(t.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let t of this.scene.children)t instanceof Cn&&!t.uiScene&&t.personalCamera.updateState(t.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(t=>{t instanceof Yt&&t.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}};KM();an();var QM="vertexOrder";function YW(i){let t=i.attributes.find(a=>a.name===QM);if(!t)return i;let e=t.array,n=e.length,r=0;for(let a=0;a<n;a++)r=Math.max(r,e[a]+1);let s=i.attributes.filter(a=>a!==t).map(({name:a,itemSize:l,array:c})=>{let u=new Float32Array(r*l);for(let d=0;d<n;d++){let h=e[d]*l,p=d*l;for(let f=0;f<l;f++)u[h+f]=c[p+f]}return{name:a,itemSize:l,array:u}}),o;if(i.index){let a=i.index.array,l=new Uint32Array(a.length);for(let c=0;c<a.length;c++)l[c]=e[a[c]];o={array:l}}return{index:o,attributes:s}}var Rh,lD;function cD(i){return lD||(lD=Promise.resolve().then(()=>(KW(),$W)).then(({DRACOLoader:t})=>(Rh=new t,Rh.setDecoderPath(i!==void 0?`${i}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),Rh.decoderPending))),lD}async function aae(i){if(Rh){let t={attributeIDs:{...Rh.defaultAttributeIDs,[QM]:"GENERIC"},attributeTypes:{...Rh.defaultAttributeTypes,[QM]:"Uint32Array"},useUniqueIDs:!1},e;try{e=await Rh.decodeGeometry(new Int8Array(i).buffer,t)}catch(n){console.error(n)}if(e)return YW({index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([n,r])=>({name:n,itemSize:r.itemSize,array:r.array}))})}return null}async function ZW(i,t){let[e,n]=Dd(Nd.deserialize(new Uint8Array(i)));if((e.schema??0)!==132){let{updateDocumentSchema:r}=await Promise.resolve().then(()=>(iv(),RU));r(e)}return t&&t(e),n.result().data}function QW(i){let t=[];return i.scene.objects.traverse((e,n)=>{n.type==="Mesh"&&n.geometry.type==="NonParametricGeometry"&&n.geometry.data.draco!==void 0&&t.push(n)}),t}async function uD(i){for(let t of i){let e=await aae(t.geometry.data.draco);if(e){let n=t.geometry.data;e.index&&(n.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let r={};e.attributes.forEach(({name:s,array:o,itemSize:a})=>{r[s]={array:o,itemSize:a,type:"Float32Array",normalized:!1}}),n.attributes=r,n.draco=void 0}}}bv();nh();Zf();lm();fw();hc();Lv();iD();sD();Co();q();q();function JW(i){let t=this._clip.duration,e=this._clip.start??0,n=this.loop,r=this.time+i,s=this._loopCount,o=n===Dp;if(i===0)return s===-1?r:o&&(s&1)===1?t-(r-e):r;if(n===uS){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:i<0?-1:1})}}else{if(s===-1&&(i>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<e){let a=Math.floor((r-e)/(t-e));r-=(t-e)*a,s+=Math.abs(a);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,o||(r=i>0?t:e,this.repetitions===1&&(r=t)),this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:i>0?1:-1});else{if(l===1){let c=i<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-(r-e)}return r}var e6=!1,JM=class{constructor(t,e,n,r){this.scene=t;this.requestRender=e;this.updateDisplayProgress=n;this.animationInspectorState=r;this.clipIdToAction={};this.activeClip=null;this.needsUpdate=!1;this.addClip=t=>{t.data.type==="Empty"&&Array.isArray(t.data.animations)&&t.data.animations.forEach((e,n)=>{let r=e[0]+"/";if(Array.isArray(t.identity)?r+=t.identity[0]:r+=t.uuid,this.clipIdToAction[r])return;let s=Sd.parse(JSON.parse(e[2]));t.animations[n]=s;let o=this.mixer.clipAction(s,t);e6===!1&&(Object.getPrototypeOf(o)._updateTime=JW,e6=!0),o.clampWhenFinished=!0,this.clipIdToAction[r]=o})};this.mixer=new _p(t),this.scene.traverseEntity(this.addClip)}rebindClips(){this.mixer.stopAllAction(),this.mixer=new _p(this.scene),this.clipIdToAction={},this.activeClip=null,this.scene.traverseEntity(this.addClip)}deleteClip(t,e){let n=this.scene.find(e);if(!n)return;let r=n.animations.find(o=>o.uuid===t);if(!r)return;let s=this.clipIdToAction[t];!s||(s.stop(),this.mixer.uncacheClip(r),delete this.clipIdToAction[t],n.animations=n.animations.filter(o=>o.uuid!==t))}get isPlaying(){return Object.values(this.clipIdToAction).some(t=>t.isRunning())}playFromInspector(t){this.mixer.stopAllAction();let e=this.clipIdToAction[t];!e||(e.play(),this.activeClip=e.getClip(),this.scene.markShadowsDirty(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(t=>{t.repetitions=1/0,t.loop=Py}),this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}play(t){let e=t.clipId+"/"+t.object,n=this.clipIdToAction[e];if(!!n)return n.repetitions=t.repeat>=0?t.repeat+1:1/0,n.loop=(t.direction==="pingpong"||t.direction==="pingpong-rewind")&&t.repeat!==0?Dp:Py,n.play(),n.paused=!1,this.requestRender(),n}resumeFromInspector(t){let e=this.clipIdToAction[t];!e||(e.play(),e.paused=!1,this.scene.markShadowsDirty(),this.requestRender())}pauseFromInspector(t){let e=this.clipIdToAction[t];!e||(e.paused=!0)}stop(){this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}update(t){if(this.needsUpdate)this.needsUpdate=!1;else if(this.isPlaying===!1||this.animationInspectorState?.isScrubbing)return;this.mixer.update(t/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return DM(this.activeClip??void 0)}setProgressFromInspector(t,e){if(!this.clipIdToAction[e])return;this.activeClip!==this.clipIdToAction[e].getClip()&&this.playFromInspector(e);let n=this.clipIdToAction[e].paused;this.clipIdToAction[e].paused=!1,this.mixer.setTime(Math.min(t/(this.maxFrames-1),.9999)*this.activeClip.duration),this.scene.markShadowsDirty(),this.requestRender(),n&&(this.clipIdToAction[e].paused=!0)}};aa();tl();y2();Mu();em();p2();hD();function s6(i){let t=new Set;return i.scene.objects.traverse((e,n)=>{if(n.type!=="Page")return;let r=n.postprocessing;if(!(!r||typeof r!="object"||r.enabled!==!0))for(let[s,o]of Object.entries(r))s!=="enabled"&&o&&typeof o=="object"&&o.enabled===!0&&t.add(s)}),[...t]}var Ele={bloom:()=>Promise.resolve().then(()=>(C6(),mle)),chromaticAberration:()=>Promise.resolve().then(()=>(R6(),gle)),vignette:()=>Promise.resolve().then(()=>(O6(),yle)),noise:()=>Promise.resolve().then(()=>(L6(),vle)),hueSaturation:()=>Promise.resolve().then(()=>(B6(),ble)),brightnessContrast:()=>Promise.resolve().then(()=>(U6(),xle)),depthOfField:()=>Promise.resolve().then(()=>(V6(),Sle)),pixelation:()=>Promise.resolve().then(()=>(G6(),wle))};function Tle(i,t,e){return Promise.all(i.map(n=>t[n]?.().catch(r=>{console.warn(`[spline] Failed to load the ${n} postprocessing effect (${e}); the effect will be skipped.`,r)}))).then(()=>{})}function j6(i){return Tle(i,Ele,"webgl")}var i_=new WeakMap,H6=new WeakMap;function W6(i,t){H6.set(i,t)}function q6(i,t){return H6.get(i)===t}function X6(i){return i.backend?.isWebGLBackend===!0}function Y6(i){let t=i.backend;if(t!==void 0)return t.isWebGLBackend===!0?t.gl??null:null;let e=i.getContext,n=typeof e=="function"?e.call(i):null;return n&&typeof n.getExtension=="function"?n:null}function $6(i,t,e){let n=r=>{i.removeEventListener(t,n,!0),r.stopImmediatePropagation(),e(r)};return i.addEventListener(t,n,!0),()=>i.removeEventListener(t,n,!0)}function K6(i,t){let e=t.getExtension("WEBGL_lose_context");if(!e||t.isContextLost())return()=>{};let n=()=>{},r=new Promise(s=>{n=$6(i,"webglcontextlost",o=>{o.preventDefault(),s(e)})});return i_.set(i,{gl:t,lost:r,stopListening:n}),()=>{t.isContextLost()||e.loseContext()}}async function Z6(i){let t=i_.get(i);if(!!t&&(t.restoring??(t.restoring=Mle(i,t).finally(()=>{t.restoring=void 0,!t.gl.isContextLost()&&i_.get(i)===t&&i_.delete(i)})),await t.restoring,t.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}async function Mle(i,t){if(!t.gl.isContextLost()){t.stopListening();return}let e=()=>{},n=t.lost.then(o=>new Promise(a=>{e=$6(i,"webglcontextrestored",()=>a()),o.restoreContext()})),r,s=new Promise(o=>{r=setTimeout(o,2e3)});await Promise.race([n,s]),clearTimeout(r),e(),t.stopListening()}dn();var sX=ed(J6(),1);q();dn();var _le="allow-scripts allow-forms allow-pointer-lock",e8=500;function s_(i){return Array.isArray(i)||ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Ale(i){return{id:i.uuid,name:i.name,type:i.object.data?.type??i.object.type,visible:i.playModeVisible!==!1,position:{x:i.position.x,y:i.position.y,z:i.position.z},rotation:{x:i.rotation.x*ge.RAD2DEG,y:i.rotation.y*ge.RAD2DEG,z:i.rotation.z*ge.RAD2DEG},scale:{x:i.scale.x,y:i.scale.y,z:i.scale.z},spawned:!0}}function o_(i){return{id:i.uuid,name:i.name,type:i.type??"Object",visible:i.visible,position:{x:i.position.x,y:i.position.y,z:i.position.z},rotation:{x:i.rotation.x*ge.RAD2DEG,y:i.rotation.y*ge.RAD2DEG,z:i.rotation.z*ge.RAD2DEG},scale:{x:i.scale.x,y:i.scale.y,z:i.scale.z}}}function wD(i,t,e){let n=o=>i.findObjectById(o)??i.findObjectByName(o),r=new Map,s=o=>{let a=r.get(o);if(a)return a;for(let l of r.values())if(l.name===o)return l};return{setVariable:(o,a)=>o in i.getVariables()?(i.setVariable(o,a),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${o}" in this scene.`},getVariable:o=>i.getVariable(o),getVariables:()=>i.getVariables(),getAllObjects:()=>i.getAllObjects().map(o_),findObject:o=>{let a=n(o);return a?o_(a):void 0},getGeometry:(o,a)=>{if(!e)return{warning:"spline.getGeometry: not available in this runtime integration."};let l=s(o),c=l?l.object:(()=>{let p=n(o);return p?e.findEntity(p.uuid):void 0})();if(!c)return{warning:`spline.getGeometry: no object named "${o}" (names/ids come from getAllObjects).`};let u=l??c,d;a.space==="world"&&(u.updateWorldMatrix?.(!0,!1),d=u.matrixWorld?.elements);let h=aB(c.geometry,d);return h?{data:{id:u.uuid,name:u.name,geometry:c.data?.geometry?.type,...h}}:{warning:`spline.getGeometry: "${u.name}" has no readable geometry \u2014 only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(o,a)=>{let l=s(o);if(l){let{position:g,rotation:y,scale:v,visible:b}=a;return g&&(typeof g.x=="number"&&(l.position.x=g.x),typeof g.y=="number"&&(l.position.y=g.y),typeof g.z=="number"&&(l.position.z=g.z)),y&&(typeof y.x=="number"&&(l.rotation.x=y.x*ge.DEG2RAD),typeof y.y=="number"&&(l.rotation.y=y.y*ge.DEG2RAD),typeof y.z=="number"&&(l.rotation.z=y.z*ge.DEG2RAD)),v&&(typeof v.x=="number"&&(l.scale.x=v.x),typeof v.y=="number"&&(l.scale.y=v.y),typeof v.z=="number"&&(l.scale.z=v.z)),typeof b=="boolean"&&(l.playModeVisible=b),l.updateMatrix(),i.requestRender(),!0}let c=n(o);if(!c)return!1;let{position:u,rotation:d,scale:h,visible:p,geometry:f,material:m}=a;if(f&&typeof f=="object"&&e){let g=e.findEntity(c.uuid);if(g){let{vertices:y,normals:v,uvs:b,indices:x,...S}=f;s_(y)&&e.shared.updateEntityGeometryVertices(g,{vertices:y,normals:s_(v)?v:void 0,uvs:s_(b)?b:void 0,indices:s_(x)?x:void 0}),Object.keys(S).length>0&&e.shared.updateEntityGeometryParams(g,S)}}if(m&&typeof m=="object"&&e){let g=e.findEntity(c.uuid);g&&e.shared.updateEntityMaterialParams(g,m)}return u&&(typeof u.x=="number"&&(c.position.x=u.x),typeof u.y=="number"&&(c.position.y=u.y),typeof u.z=="number"&&(c.position.z=u.z)),d&&(typeof d.x=="number"&&(c.rotation.x=d.x*ge.DEG2RAD),typeof d.y=="number"&&(c.rotation.y=d.y*ge.DEG2RAD),typeof d.z=="number"&&(c.rotation.z=d.z*ge.DEG2RAD)),h&&(typeof h.x=="number"&&(c.scale.x=h.x),typeof h.y=="number"&&(c.scale.y=h.y),typeof h.z=="number"&&(c.scale.z=h.z)),typeof p=="boolean"&&(c.visible=p),i.requestRender(),!0},createObject:async(o,a)=>{let l=await i.createObject(o,a);return o_(l)},createCustomMaterial:o=>i.createCustomMaterial(o),getTexture:(o,a)=>{if(!e)return null;let l=n(o),c=l?e.findEntity(l.uuid):void 0;if(!c)return null;let u=e.shared.getEntityTexture(c,a??{});return u?{texture:u.texture,width:u.width,height:u.height,layer:u.layerType}:null},setMaterial:(o,a)=>i.setMaterial(o,a),cloneObject:(o,a)=>o_(i.cloneObject(o,a)),removeObject:o=>i.removeObject(o),spawnObject:(o,a)=>{if(!e)return{warning:"spline.spawnObject: not available in this runtime integration."};let l=n(o),c=l?e.findEntity(l.uuid):void 0;if(!c)return{warning:`spline.spawnObject: no object named "${o}" to use as a template.`};if(r.size>=e8)return{warning:`spline.spawnObject: spawn budget reached (${e8} live copies) \u2014 destroyObject old copies (or reuse them) instead of spawning more.`};let u=e.shared.spawnRuntimeClone(c,a??{});return u?(r.set(u.uuid,u),i.requestRender(),{object:Ale(u)}):{warning:`spline.spawnObject: "${o}" cannot be spawned from.`}},destroyObject:o=>{let a=s(o);return!e||!a?!1:(r.delete(a.uuid),e.shared.destroyRuntimeClone(a),i.requestRender(),!0)},setInstanceTransforms:(o,a)=>{if(!e)return-1;let l=n(o),c=l?e.findEntity(l.uuid):void 0;if(!c)return-1;let u=e.shared.setEntityInstanceTransforms(c,a);return u>=0&&i.requestRender(),u},emitEvent:(o,a,l)=>{let c=n(a);return c?(l?c.emitEventReverse(o):c.emitEvent(o),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${a}".`}},requestRender:()=>i.requestRender(),addSplineEventListener:(o,a)=>{let l=c=>{a({target:{id:c.target?.id??"",name:c.target?.name??""}})};return i.addEventListener(o,l),()=>i.removeEventListener(o,l)},getCanvas:()=>t}}var Jm=class{constructor(t,e,n){this.iframe=t;this.bridge=e;this.observer=n}static mount(t,e,n,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let o=document.createElement("iframe");o.setAttribute("sandbox",_le),o.title="Spline HTML content";let a=o.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let l=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};l();let c=new ResizeObserver(l);c.observe(e),c.observe(s),o.srcdoc=iB(n,sB),s.insertBefore(o,e.nextSibling);let u=new PS(o,wD(t,e,r),(d,h)=>{d==="warn"?console.warn(`[spline html] ${h}`):d==="error"&&console.error(`[spline html] ${h}`)});return u.attach(),new Jm(o,u,c)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}};dn();var a_="data-spline-html-content",Cle=`
9901
9901
  [${a_}] { pointer-events: none; }
9902
9902
  [${a_}] > * { pointer-events: auto; }
9903
9903
  [${a_}] [data-spline-passthrough] { pointer-events: none; }
9904
- `,eg=class{constructor(t,e,n,r,s,o){this.container=t;this.host=e;this.observer=n;this.spline=r;this.previousSplineGlobal=s;this.removeLateLifecycleShim=o}static mount(t,e,n,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let o=document.createElement("div");o.setAttribute(a_,"");let a=o.style;a.position="absolute",a.overflow="hidden";let l=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};l();let c=new ResizeObserver(l);c.observe(e),c.observe(s);let u=document.createElement("style");u.textContent=Cle,o.appendChild(u);let d=new DOMParser().parseFromString(n,"text/html"),h=Array.from(d.querySelectorAll("script"));for(let x of h)x.remove();for(let x of Array.from(d.head.children))(x.tagName==="STYLE"||x.tagName==="LINK"&&x.rel==="stylesheet")&&o.appendChild(x);for(;d.body.firstChild;)o.appendChild(d.body.firstChild);s.insertBefore(o,e.nextSibling);let p=(x,S)=>{x==="warn"?console.warn(`[spline html] ${S}`):x==="error"&&console.error(`[spline html] ${S}`)},f=new Map,m=new Yp(wD(t,e,r),p,(x,S)=>{let E=f.get(x);if(!!E)for(let T of E)try{T(S)}catch(w){console.error(w)}}),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]),getTexture:(x,S)=>g("getTexture",[x,S??{}]),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=cB();for(let x of h){let S=document.createElement("script");for(let E of Array.from(x.attributes))S.setAttribute(E.name,E.value);x.src?S.async=!1:S.textContent=x.textContent,o.appendChild(S)}return new eg(o,m,c,y,v,b)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};pt();an();q();cR();Co();function t8(i,t){let e=i.length/3,n=new Map,r=new Array(e);for(let l=0;l<e;l++){let c=`${Math.round(i[3*l]*1e4)},${Math.round(i[3*l+1]*1e4)},${Math.round(i[3*l+2]*1e4)}`,u=n.get(c);u===void 0?(n.set(c,l),r[l]=l):r[l]=u}let s=new Map;for(let l=0;l+2<t.length;l+=3){let c=r[t[l]],u=r[t[l+1]],d=r[t[l+2]];for(let[h,p]of[[c,u],[u,d],[d,c]]){if(h===p)continue;let f=h<p?h+"_"+p:p+"_"+h;s.set(f,(s.get(f)??0)+1)}}let o=s.size>0;for(let l of s.values())if(l!==2){o=!1;break}if(!o)return{closed:!1,inverted:!1};let a=0;for(let l=0;l+2<t.length;l+=3){let c=t[l]*3,u=t[l+1]*3,d=t[l+2]*3,h=i[c],p=i[c+1],f=i[c+2],m=i[u],g=i[u+1],y=i[u+2],v=i[d],b=i[d+1],x=i[d+2];a+=h*(g*x-y*b)+p*(y*v-m*x)+f*(m*b-g*v)}return{closed:!0,inverted:a<0}}an();pt();VU();dc();function o8(i){return typeof i=="object"&&i!==null&&i.isMaterial===!0}function TD(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(!o8(i.material))return{options:i};let t=i.material;if(t.isNodeMaterial===!0){let e=Hw()?.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 Ple=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),n8="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Rle={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"},Ile={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Ole={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')."},Dle={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"},Lle={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function a8(i){if(typeof i!="string"||i.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${n8}.`);let t=i.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),e=Ile[t];if(e)return{objectType:e};let n=Rle[t];if(n)return{objectType:"Mesh",geometryType:n};let r=Ole[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 ${n8}, e.g. createObject('Cube', { width: 200 }).`)}function ex(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 l8(i){return typeof i=="number"?[i,i,i]:ex(i,[1,1,1])}function Nle(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)||Ye.NAMES[t]!==void 0}function ED(i){let t=new gn(0,0,0,1);return t.setStyle(i),{r:t.r,g:t.g,b:t.b}}function Ble(i){let t=Object.entries(i.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>e!=="'undefined'");return t.length?t.join(", "):"(none)"}function r8(i,t){let e=i.material??(i.color!==void 0?{color:i.color}:void 0);if(e===void 0)return An.defaultColorMaterial(i8(Er),"physical","layer1","layer2");if(typeof e=="string"){for(let[o,a]of Object.entries(t.shared.materials))if(o===e||a.name===e)return o;if(Nle(e))return An.defaultColorMaterial(ED(e),"physical","layer1","layer2");throw new Error(`createObject: material '${e}' matches no shared material in this document (available: ${Ble(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(o8(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?ED(e.color):i8(Er),r=An.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(o=>o.data.type==="light");if(s){let o={};e.roughness!==void 0&&(o.roughness=e.roughness),e.metalness!==void 0&&(o.metalness=e.metalness),e.reflectivity!==void 0&&(o.reflectivity=e.reflectivity),Object.assign(s.data,o)}if(e.alpha!==void 0){let o=r.layers.find(a=>a.data.type==="color");o&&Object.assign(o.data,{alpha:e.alpha})}return r}function i8(i){return{r:(i>>16&255)/255,g:(i>>8&255)/255,b:(i&255)/255}}function Fle(i){let t={};for(let[e,n]of Object.entries(i))!Ple.has(e)&&n!==void 0&&(t[e]=n);return t}function Ule(i){let t=mo.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 s8=6e4;function l_(i){return Array.isArray(i)?i:ArrayBuffer.isView(i)&&!(i instanceof DataView)?Array.from(i):null}function kle(i){let t=l_(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>s8)throw new Error(`createObject('CustomMesh'): too many vertices (${e}); keep it under ${s8}.`);let n=l_(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 Me;r.setAttribute("position",new Be(t,3));let s=l_(i.normals),o=s!==null&&s.length===t.length;o&&r.setAttribute("normal",new Be(s,3));let a=l_(i.uvs);a&&a.length===e*2&&r.setAttribute("uv",new Be(a,2));let l=!1;if(!o){let d=n??Array.from({length:e},(f,m)=>m),{closed:h,inverted:p}=t8(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),o||r.computeVertexNormals();let c=r.toJSON();return{geometry:HP({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:c.data}),doubleSide:l}}function Vle(i,t){let n=lR[i].normalizeInputs({parameters:t});return HP({userData:{type:i,...n}})}function c8(i,t,e){let{objectType:n,geometryType:r}=i,s=Fle(t),o={states:new Fe,events:new Fe};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=kle(s);Object.assign(o,go.defaultData,{geometry:l,materials:[r8(t,e)]}),c&&(o.side=2)}else Object.assign(o,go.defaultData,{geometry:r==="TextGeometry"?Ule(s):Vle(r,s),material:r8(t,e)});t.castShadow!==void 0&&(o.castShadow=t.castShadow),t.receiveShadow!==void 0&&(o.receiveShadow=t.receiveShadow)}else n==="Empty"?Object.assign(o,uf.defaultData):(Object.assign(o,df.defaultData(n),s),t.color!==void 0&&(o.color=ED(t.color)));o.visible=t.visible??!0,o.position=ex(t.position,[0,0,0]),o.rotation=ex(t.rotation,[0,0,0]),o.scale=l8(t.scale);let a=(r&&Dle[r])??Lle[n]??n;return o.name=t.name??u8(a,e.scene.objects),o}function u8(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 d8(i,t){let e=ge.generateUUID();if(i.data.type==="Component")return{data:{...yo.fromComponentData(i),name:i.data.name+" Instance"},id:e,fi:i.fi,children:[]};t[i.id]=e;let n=i.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,o])=>{let a=ge.generateUUID(),l=o.indexOf(r),c=l!==-1?o.slice(0,l)+a+o.slice(l+r.length):o;return[a,s,c]})}),{...i,id:e,data:n,children:i.children.map(r=>d8(r,t))}}function h8(i){let t={},e=d8(i,t);return xB(e,t)}function p8(i,t,e){let n={...i.data};return t.position!==void 0&&(n.position=ex(t.position,[0,0,0])),t.rotation!==void 0&&(n.rotation=ex(t.rotation,[0,0,0])),t.scale!==void 0&&(n.scale=l8(t.scale)),t.visible!==void 0&&(n.visible=t.visible),n.name=t.name??u8(`${i.data.name??"Object"} Copy`,e),{...i,data:n}}dc();fr();pw();Co();function f8(i){let t=Array.isArray(i)?i[0]:i,e=t.layers?.map(zle)??[],n=t.layers?.find(r=>r.type==="light");return{layers:e,alpha:n?.node.alphaOverride?.value??1}}function zle(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 m8(i,t,e){let n=Array.isArray(e)?e[0]:e;if(i[0]==="layers"){let r=parseInt(i[1]),s=n.layers[r],o=i[2];s&&o&&Gle(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 tx=new gn(0,0,0,1);function Gle(i,t,e){let n=i[0];try{if(Wle(n,e.type,i.slice(1)))if(n==="colors"){if(i.length<2)throw new Error("You cannot mutate the colors array, only its items");let r=parseInt(i[1]),o=e.getValue(n)?.[r];if(o)tx.setStyle(t),o.set(tx.r,tx.g,tx.b,tx.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;jle(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 jle(i,t,e,n){let r=i[0];if(r==="repeat"||r==="offset"||r==="rotation"){let s=n.getNode("mat"),o=s&&typeof s.updateMatrix=="function"?s:n.getValue("mat");if(!o)return;if(r==="rotation")o.rotation=parseFloat(t);else{let a=i[1];if(a===void 0)t instanceof Array&&t.length===2&&Object.assign(o,{[r]:t});else{let l=o[r],c=parseInt(a)===0?[parseFloat(t),l[1]]:[l[0],parseFloat(t)];Object.assign(o,{[r]:c})}}o.updateMatrix()}else r==="wrapping"||r==="minFilter"||r==="magFilter"?r==="wrapping"?e.texture.wrap=t:e.texture[r]=t:r==="image"&&i[1]==="data"&&e.texture.image.updateSrc(t)}var Hle={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 Wle(i,t,e){return!!Hle[t]?.includes(i)}pt();pt();var nue=new G;function rue(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 iue(i){}function iX(i){let t=new gn(0,0,0,1);try{t.setStyle(i)}catch(e){console.error(e)}return t}var bL=class{constructor(t,{renderOnDemand:e,renderMode:n="auto",wasmPath:r,renderer:s,htmlContentMode:o="sandbox"}={}){this._rendererBackend="webgl";this._rendererAuto=!1;this._rendererConfigured=!1;this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._htmlContentMode="sandbox";this._variablesCache=new Map;this._isPaused=!1;this._renderRequested=!1;this._skipRender=!1;this.time=performance.now();this.dt=0;this.currentTAAFrame=0;this.disposed=!1;this._requestRenderAutoMode=()=>{this._skipRender=!1};this.requestRender=()=>{this._renderRequested=!0};this.render=t=>{if(this.time=t,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),!this._renderer){this._perfs?.end();return}if(!this._isPaused&&(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){this._perfs?.end();return}if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<XU?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{e.type==="ParticleSystem"&&(e.update(this.dt),this._skipRender=!1),la(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=nue.set(this._viewportWidth,this._viewportHeight)),t){let e=this._viewportWidth,n=this._viewportHeight;this._renderer.setSize(e-1,n-1,!1),this._renderer.setSize(e,n,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}};this._debouncedResize=iu(this._resize,10);this._onScroll=t=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())};if(this.canvas=t,this._htmlContentMode=o,this.renderMode=e?"auto":n,r!==void 0&&(this._wasmPath=Y3(r,"/")),this._rendererBackend=s??"webgl",s===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(y8(),g8)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),k3(t)}async _initRenderer(){if(this.disposed)return null;let t=await this._createRenderer();return this.disposed?(this._disposeRenderer(t),null):t}_disposeRenderer(t){let e=Y6(t);if(e&&!q6(this.canvas,this)){X6(t)||t.dispose();return}let n=e?K6(this.canvas,e):void 0;try{t.dispose()}finally{n?.()}}async _createRenderer(){if(W6(this.canvas,this),await Z6(this.canvas),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(()=>(vL(),yL));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){rue(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;cr.init();let r=await ZW(t);this._data=r;let s=QW(r);r.version&&(0,sX.default)(r.version,"2.0.77")>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`),i6(this._wasmPath));let o=iue(r);await Promise.all([o,s.length&&cD(this._wasmPath),ER(r)&&Pk(this._wasmPath),BV(r)&&LV(this._wasmPath),KG(r)&&cz(this._wasmPath),bo.physicsEnabled(r.scene.objects)&&Nj(this._wasmPath),v2(r)&&EI(),rD(r)&&HW(),tV(r)&&Qk(),cI(r)&&o.then(()=>dv()?.loadHanaUIRUNTIME()),fj(r)&&Zj(this._wasmPath)].filter(Boolean)),s.length&&await uD(s),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=r.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu"){this._failWebGPURequired();return}let l=s6(r);if(this._rendererBackend==="webgpu"&&!1)try{}catch(p){}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(vL(),yL)),j6(l)]),yz((this._rendererBackend,"webgl"));let c=new ZM(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(()=>(rX(),nX)),f=performance.now();p(r,c.scene);let m=performance.now();console.log("Merged geometries in ",m-f," ms")}ER(r)&&this._scene.traverse(p=>{ds(p)&&p.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(p=>{ic(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()),la(p)&&p.setPlayMode(!0)});let u=Object.keys(r.shared.fonts).flatMap(p=>{let f=this._sharedAssetsManager.getFont(p);return f?[f.loadingPromise]:[]});if(Promise.all(u).then(()=>{this.disposed||(c.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),v2(r)&&kj(r)&&await Promise.all(u),cI(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(),qm(this._scene.activePage,this._sharedAssetsManager),!this._renderer){let p=await this._initRenderer();if(!p)return;this._renderer=p}if(!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)}}rD(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 pE(this._renderer,this._camera,new G(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(d.allowResponsive??!1)&&d.preset==="fullscreen"),e){let p=new Jw(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,d);this._scene.updateMatrixWorld(!0),this._controls=new pT(p),this._animationControls=new JM(this._scene,this._requestRenderAutoMode),this._eventManager=new cE(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),e&&(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"?eg.mount(this,this.canvas,h,p):Jm.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)){if(e==null){console.warn(`Variable ${t} was not updated: received ${e}. Pass a number, boolean or string.`);return}let r=e;if(typeof n.data.value=="number"){if(r=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e),!Number.isFinite(r)){console.warn(`Variable ${t} is a number variable and ${JSON.stringify(e)} cannot be converted to a number. The variable was not updated.`);return}}else 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"&&Tr.isTextValue(t)?Tr.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!==fo&&!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 im&&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=iX(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,zk(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{SS.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,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,V3(this.canvas),document.removeEventListener("scroll",this._onScroll),cr.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);let n;t.traverseAncestors(d=>{d instanceof Cn&&(n=d.name)});let r=this._sharedAssetsManager,s={shared:r,scene:this._scene},o=d=>{if(d===null||d==="Base State")return null;if(d&&t.data.states){let h=t.data.states.find(p=>p.data.name===d);return h?h.id:void 0}},a="material"in t?t.material:void 0,l=t.materialOverride,c={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:n,material:l??(a?f8(a):void 0),parentUuid:t.parent instanceof Cn||t instanceof Xu?void 0:t.parent?.uuid,emitEvent(d){t.dispatchEvent({type:"userEvent",eventName:d})},emitEventReverse(d){t.dispatchEvent({type:"userEvent",eventName:d,reverse:!0})},hide(){t.visible&&(t.visible=!1,s.shared.requestRender())},show(){t.visible||(t.visible=!0,s.shared.requestRender())},get state(){let d=t.stateSelection;if(d!==null)return t.data.states.find(({id:h})=>h===d)?.data.name},set state(d){let h;if(d!==void 0){let p=typeof d=="string"?t.data.states.find(({id:f})=>f===d):t.data.states[d];if(p)h=p.id;else{let f=typeof d=="string"?o(d):void 0;f&&(h=f)}}t.changeSelectedState(h??null,s),t.currentState=h??null,t.dispatchEvent({type:"completeState",state:h??null}),s.shared.requestRender()},transition(d){let h=lW();if(h===null)return Jn("transitions","obj.transition()"),{transition(E){return this},play(){return this},pause(){return this},reset(){return this},seek(E){return this}};let p=this,f,m=[],g,y=!1,v=()=>{g=new km({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},m.map(S=>S.runner))},b={update(S){g?.update(S),g?.isPlaying!==!0&&cr.remove(b)}},x={transition({from:S,to:E,duration:T,delay:w,..._}){let A=o(S);A===void 0&&(A=f);let C=o(E);return f=C,m.push(new h(t,A,C,{state:C,repeat:0,delay:w??0,delayDirection:"start-once",direction:"normal",duration:T??1e3,..._,..._.easing===6?ea.defaultData:_.easing===5?Kl.defaultData:{}},r,!1,e.activePage,{onBegin:()=>{(S&&A||S==="Base State"&&!A)&&(p.state=A??void 0)},onComplete:()=>{p.state=C??void 0}})),v(),this},play(){return g?(y=!0,g.play(cr.time),g.isPlaying&&cr.add(b),this):this},pause(){return g?.stop(),cr.remove(b),this},reset(){return this.pause(),y=!1,v(),g?.seek(0),this},seek(S){let E=m.reduce((T,w)=>T+w.runner.duration,0);return E>0&&g?.seek(S/1e3/E),this}};return x.transition(d),(d.autoPlay??!0)&&queueMicrotask(()=>{y||x.play()}),x},set color(d){let h=iX(d);if(Qf.is(t)){t.color=h;return}else if(t.type!=="Mesh"||!("material"in t)||!(t instanceof Mr))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(_=>_.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:ge.generateUUID(),data:{...Qn.defaultData("color"),color:p},localIndex:0},T=y.layers.insertAfterHelper(b?.id??null,1),w=y.layers.runOp({...E,fi:T[0]}).data;Object.assign(m.data,{layers:w}),m.updateByOp({...E,path:["layers"]},m.data,s)}}},u=SS(c,(d,h)=>{let p=t[d],f=sue(d);f[0]==="material"&&a&&l===void 0&&m8(f.slice(1),h,a),typeof p!="object"&&Object.getOwnPropertyDescriptor(t,d)?.writable&&(t[d]=h),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,u),u}setUIWasmUrl(t){ck(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=Nd.deserialize(n),s="data"in r&&r.data.draco!==void 0;s&&await cD(this._wasmPath);let o=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!o){console.warn(`Object ${t} not found`);return}if(o.data.type!=="Mesh"||!(o instanceof Mr)){console.warn(`Object ${t} is not a mesh`);return}let a=o,l={...a.data,geometry:r};s&&await uD([l]),a.updateByOp({type:0,path:[],props:{geometry:l.geometry}},l,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let c of a.data.states){let u={...c.data};a.states||(a.states={}),a.states[c.id]=ia.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=Hw();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 Mr))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let o=typeof e=="function"?await this.createCustomMaterial(e):e;if(Yf()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=TD({material:o});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(a.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let s=a8(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let{options:o,material:a}=TD(e);if(a!==void 0){if(s.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(Yf()!=="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(!ik("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 EI(),c=e.font??kd,r.shared.fonts[c]===void 0){if(c!==kd){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:kd,url:yP}}}let u=this._resolveParentId(e.parent),d=c8(s,o,r),h=ge.generateUUID(),[p,f]=Dd(r);l&&(p.shared.fonts[kd]=l),p.scene.objects.insertAfter(u,null,[{id:h,data:d,children:[]}]);let m=f.result();if(l&&this._sharedAssetsManager.addFont(kd,l),c!==void 0){let y=this._sharedAssetsManager.getFont(c);y&&await y.loadingPromise}this._applyDocumentTransaction(m);let g=n.find(h);return a!==void 0&&g.setMaterialOverride(a,{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,o=s?this._findEntity(s):void 0;if(!o)throw new Error(`cloneObject: '${s}' \u2014 no object with that name or uuid in the scene.`);if(o instanceof Cn)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(o.uuid);if(!a)throw new Error(`cloneObject: '${s}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let l=p8(h8(a),e,r.scene.objects),c=e.parent!==void 0?this._resolveParentId(e.parent):r.scene.objects.parent(o.uuid)??null,u=e.parent!==void 0?null:o.uuid,[d,h]=Dd(r);d.scene.objects.insertAfter(c,u,[l]),this._applyDocumentTransaction(h.result());let p=n.find(l.id);return this._requestRenderAutoMode(),this._createProxyObject(p)}removeObject(t){let e=this._scene,n=this._data;if(this.disposed||!e||!n)return!1;let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)return!1;if(s instanceof Cn)throw new Error("removeObject: pages cannot be removed.");if(s.data.type==="PerspectiveCamera"||s.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(n.scene.objects.get(s.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let o=[];s.traverseEntity(c=>{o.push(c.uuid)});let[a,l]=Dd(n);a.scene.objects.delete(s.uuid),this._applyDocumentTransaction(l.result());for(let c of o){let u=this._proxyObjectCache.get(c);u&&(SS.unsubscribe(u),this._proxyObjectCache.delete(c))}return this._requestRenderAutoMode(),!0}};function sue(i){return i.split(".")}
9904
+ `,eg=class{constructor(t,e,n,r,s,o){this.container=t;this.host=e;this.observer=n;this.spline=r;this.previousSplineGlobal=s;this.removeLateLifecycleShim=o}static mount(t,e,n,r){if(typeof document>"u")return null;let s=e.parentElement;if(!s)return null;getComputedStyle(s).position==="static"&&(s.style.position="relative");let o=document.createElement("div");o.setAttribute(a_,"");let a=o.style;a.position="absolute",a.overflow="hidden";let l=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};l();let c=new ResizeObserver(l);c.observe(e),c.observe(s);let u=document.createElement("style");u.textContent=Cle,o.appendChild(u);let d=new DOMParser().parseFromString(n,"text/html"),h=Array.from(d.querySelectorAll("script"));for(let x of h)x.remove();for(let x of Array.from(d.head.children))(x.tagName==="STYLE"||x.tagName==="LINK"&&x.rel==="stylesheet")&&o.appendChild(x);for(;d.body.firstChild;)o.appendChild(d.body.firstChild);s.insertBefore(o,e.nextSibling);let p=(x,S)=>{x==="warn"?console.warn(`[spline html] ${S}`):x==="error"&&console.error(`[spline html] ${S}`)},f=new Map,m=new Yp(wD(t,e,r),p,(x,S)=>{let E=f.get(x);if(!!E)for(let T of E)try{T(S)}catch(w){console.error(w)}}),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]),getTexture:(x,S)=>g("getTexture",[x,S??{}]),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=cB();for(let x of h){let S=document.createElement("script");for(let E of Array.from(x.attributes))S.setAttribute(E.name,E.value);x.src?S.async=!1:S.textContent=x.textContent,o.appendChild(S)}return new eg(o,m,c,y,v,b)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};pt();an();q();cR();Co();function t8(i,t){let e=i.length/3,n=new Map,r=new Array(e);for(let l=0;l<e;l++){let c=`${Math.round(i[3*l]*1e4)},${Math.round(i[3*l+1]*1e4)},${Math.round(i[3*l+2]*1e4)}`,u=n.get(c);u===void 0?(n.set(c,l),r[l]=l):r[l]=u}let s=new Map;for(let l=0;l+2<t.length;l+=3){let c=r[t[l]],u=r[t[l+1]],d=r[t[l+2]];for(let[h,p]of[[c,u],[u,d],[d,c]]){if(h===p)continue;let f=h<p?h+"_"+p:p+"_"+h;s.set(f,(s.get(f)??0)+1)}}let o=s.size>0;for(let l of s.values())if(l!==2){o=!1;break}if(!o)return{closed:!1,inverted:!1};let a=0;for(let l=0;l+2<t.length;l+=3){let c=t[l]*3,u=t[l+1]*3,d=t[l+2]*3,h=i[c],p=i[c+1],f=i[c+2],m=i[u],g=i[u+1],y=i[u+2],v=i[d],b=i[d+1],x=i[d+2];a+=h*(g*x-y*b)+p*(y*v-m*x)+f*(m*b-g*v)}return{closed:!0,inverted:a<0}}an();pt();VU();dc();function o8(i){return typeof i=="object"&&i!==null&&i.isMaterial===!0}function TD(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(!o8(i.material))return{options:i};let t=i.material;if(t.isNodeMaterial===!0){let e=Hw()?.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 Ple=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),n8="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Rle={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"},Ile={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Ole={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')."},Dle={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"},Lle={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function a8(i){if(typeof i!="string"||i.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${n8}.`);let t=i.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),e=Ile[t];if(e)return{objectType:e};let n=Rle[t];if(n)return{objectType:"Mesh",geometryType:n};let r=Ole[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 ${n8}, e.g. createObject('Cube', { width: 200 }).`)}function ex(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 l8(i){return typeof i=="number"?[i,i,i]:ex(i,[1,1,1])}function Nle(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)||Ye.NAMES[t]!==void 0}function ED(i){let t=new gn(0,0,0,1);return t.setStyle(i),{r:t.r,g:t.g,b:t.b}}function Ble(i){let t=Object.entries(i.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>e!=="'undefined'");return t.length?t.join(", "):"(none)"}function r8(i,t){let e=i.material??(i.color!==void 0?{color:i.color}:void 0);if(e===void 0)return An.defaultColorMaterial(i8(Er),"physical","layer1","layer2");if(typeof e=="string"){for(let[o,a]of Object.entries(t.shared.materials))if(o===e||a.name===e)return o;if(Nle(e))return An.defaultColorMaterial(ED(e),"physical","layer1","layer2");throw new Error(`createObject: material '${e}' matches no shared material in this document (available: ${Ble(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(o8(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?ED(e.color):i8(Er),r=An.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(o=>o.data.type==="light");if(s){let o={};e.roughness!==void 0&&(o.roughness=e.roughness),e.metalness!==void 0&&(o.metalness=e.metalness),e.reflectivity!==void 0&&(o.reflectivity=e.reflectivity),Object.assign(s.data,o)}if(e.alpha!==void 0){let o=r.layers.find(a=>a.data.type==="color");o&&Object.assign(o.data,{alpha:e.alpha})}return r}function i8(i){return{r:(i>>16&255)/255,g:(i>>8&255)/255,b:(i&255)/255}}function Fle(i){let t={};for(let[e,n]of Object.entries(i))!Ple.has(e)&&n!==void 0&&(t[e]=n);return t}function Ule(i){let t=mo.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 s8=6e4;function l_(i){return Array.isArray(i)?i:ArrayBuffer.isView(i)&&!(i instanceof DataView)?Array.from(i):null}function kle(i){let t=l_(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>s8)throw new Error(`createObject('CustomMesh'): too many vertices (${e}); keep it under ${s8}.`);let n=l_(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 Me;r.setAttribute("position",new Be(t,3));let s=l_(i.normals),o=s!==null&&s.length===t.length;o&&r.setAttribute("normal",new Be(s,3));let a=l_(i.uvs);a&&a.length===e*2&&r.setAttribute("uv",new Be(a,2));let l=!1;if(!o){let d=n??Array.from({length:e},(f,m)=>m),{closed:h,inverted:p}=t8(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),o||r.computeVertexNormals();let c=r.toJSON();return{geometry:HP({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:c.data}),doubleSide:l}}function Vle(i,t){let n=lR[i].normalizeInputs({parameters:t});return HP({userData:{type:i,...n}})}function c8(i,t,e){let{objectType:n,geometryType:r}=i,s=Fle(t),o={states:new Fe,events:new Fe};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=kle(s);Object.assign(o,go.defaultData,{geometry:l,materials:[r8(t,e)]}),c&&(o.side=2)}else Object.assign(o,go.defaultData,{geometry:r==="TextGeometry"?Ule(s):Vle(r,s),material:r8(t,e)});t.castShadow!==void 0&&(o.castShadow=t.castShadow),t.receiveShadow!==void 0&&(o.receiveShadow=t.receiveShadow)}else n==="Empty"?Object.assign(o,uf.defaultData):(Object.assign(o,df.defaultData(n),s),t.color!==void 0&&(o.color=ED(t.color)));o.visible=t.visible??!0,o.position=ex(t.position,[0,0,0]),o.rotation=ex(t.rotation,[0,0,0]),o.scale=l8(t.scale);let a=(r&&Dle[r])??Lle[n]??n;return o.name=t.name??u8(a,e.scene.objects),o}function u8(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 d8(i,t){let e=ge.generateUUID();if(i.data.type==="Component")return{data:{...yo.fromComponentData(i),name:i.data.name+" Instance"},id:e,fi:i.fi,children:[]};t[i.id]=e;let n=i.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:n.animations.map(([r,s,o])=>{let a=ge.generateUUID(),l=o.indexOf(r),c=l!==-1?o.slice(0,l)+a+o.slice(l+r.length):o;return[a,s,c]})}),{...i,id:e,data:n,children:i.children.map(r=>d8(r,t))}}function h8(i){let t={},e=d8(i,t);return xB(e,t)}function p8(i,t,e){let n={...i.data};return t.position!==void 0&&(n.position=ex(t.position,[0,0,0])),t.rotation!==void 0&&(n.rotation=ex(t.rotation,[0,0,0])),t.scale!==void 0&&(n.scale=l8(t.scale)),t.visible!==void 0&&(n.visible=t.visible),n.name=t.name??u8(`${i.data.name??"Object"} Copy`,e),{...i,data:n}}dc();fr();pw();Co();function f8(i){let t=Array.isArray(i)?i[0]:i,e=t.layers?.map(zle)??[],n=t.layers?.find(r=>r.type==="light");return{layers:e,alpha:n?.node.alphaOverride?.value??1}}function zle(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 m8(i,t,e){let n=Array.isArray(e)?e[0]:e;if(i[0]==="layers"){let r=parseInt(i[1]),s=n.layers[r],o=i[2];s&&o&&Gle(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 tx=new gn(0,0,0,1);function Gle(i,t,e){let n=i[0];try{if(Wle(n,e.type,i.slice(1)))if(n==="colors"){if(i.length<2)throw new Error("You cannot mutate the colors array, only its items");let r=parseInt(i[1]),o=e.getValue(n)?.[r];if(o)tx.setStyle(t),o.set(tx.r,tx.g,tx.b,tx.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;jle(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 jle(i,t,e,n){let r=i[0];if(r==="repeat"||r==="offset"||r==="rotation"){let s=n.getNode("mat"),o=s&&typeof s.updateMatrix=="function"?s:n.getValue("mat");if(!o)return;if(r==="rotation")o.rotation=parseFloat(t);else{let a=i[1];if(a===void 0)t instanceof Array&&t.length===2&&Object.assign(o,{[r]:t});else{let l=o[r],c=parseInt(a)===0?[parseFloat(t),l[1]]:[l[0],parseFloat(t)];Object.assign(o,{[r]:c})}}o.updateMatrix()}else r==="wrapping"||r==="minFilter"||r==="magFilter"?r==="wrapping"?e.texture.wrap=t:e.texture[r]=t:r==="image"&&i[1]==="data"&&e.texture.image.updateSrc(t)}var Hle={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 Wle(i,t,e){return!!Hle[t]?.includes(i)}pt();pt();var nue=new G;function rue(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 iue(i){}function iX(i){let t=new gn(0,0,0,1);try{t.setStyle(i)}catch(e){console.error(e)}return t}var bL=class{constructor(t,{renderOnDemand:e,renderMode:n="auto",wasmPath:r,renderer:s,htmlContentMode:o="sandbox"}={}){this._rendererBackend="webgl";this._rendererAuto=!1;this._rendererConfigured=!1;this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._htmlContentMode="sandbox";this._variablesCache=new Map;this._isPaused=!1;this._renderRequested=!1;this._skipRender=!1;this.time=performance.now();this.dt=0;this.currentTAAFrame=0;this.disposed=!1;this._requestRenderAutoMode=()=>{this._skipRender=!1};this.requestRender=()=>{this._renderRequested=!0};this.render=t=>{if(this.time=t,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),!this._renderer){this._perfs?.end();return}if(!this._isPaused&&(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){this._perfs?.end();return}if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<XU?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{e.type==="ParticleSystem"&&(e.update(this.dt),this._skipRender=!1),la(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=nue.set(this._viewportWidth,this._viewportHeight)),t){let e=this._viewportWidth,n=this._viewportHeight;this._renderer.setSize(e-1,n-1,!1),this._renderer.setSize(e,n,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}};this._debouncedResize=iu(this._resize,10);this._onScroll=t=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())};if(this.canvas=t,this._htmlContentMode=o,this.renderMode=e?"auto":n,r!==void 0&&(this._wasmPath=Y3(r,"/")),this._rendererBackend=s??"webgl",s===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(y8(),g8)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),k3(t)}async _initRenderer(){if(this.disposed)return null;let t=await this._createRenderer();return this.disposed?(this._disposeRenderer(t),null):t}_disposeRenderer(t){let e=Y6(t);if(e&&!q6(this.canvas,this)){X6(t)||t.dispose();return}let n=e?K6(this.canvas,e):void 0;try{t.dispose()}finally{n?.()}}async _createRenderer(){if(W6(this.canvas,this),await Z6(this.canvas),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(()=>(vL(),yL));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){rue(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;cr.init();let r=await ZW(t);this._data=r;let s=QW(r);r.version&&(0,sX.default)(r.version,"2.0.78")>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`),i6(this._wasmPath));let o=iue(r);await Promise.all([o,s.length&&cD(this._wasmPath),ER(r)&&Pk(this._wasmPath),BV(r)&&LV(this._wasmPath),KG(r)&&cz(this._wasmPath),bo.physicsEnabled(r.scene.objects)&&Nj(this._wasmPath),v2(r)&&EI(),rD(r)&&HW(),tV(r)&&Qk(),cI(r)&&o.then(()=>dv()?.loadHanaUIRUNTIME()),fj(r)&&Zj(this._wasmPath)].filter(Boolean)),s.length&&await uD(s),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=r.scene.publish.renderer;if(this._rendererAuto&&a==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&a==="webgpu"){this._failWebGPURequired();return}let l=s6(r);if(this._rendererBackend==="webgpu"&&!1)try{}catch(p){}this._rendererBackend!=="webgpu"&&await Promise.all([Promise.resolve().then(()=>(vL(),yL)),j6(l)]),yz((this._rendererBackend,"webgl"));let c=new ZM(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(()=>(rX(),nX)),f=performance.now();p(r,c.scene);let m=performance.now();console.log("Merged geometries in ",m-f," ms")}ER(r)&&this._scene.traverse(p=>{ds(p)&&p.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(p=>{ic(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()),la(p)&&p.setPlayMode(!0)});let u=Object.keys(r.shared.fonts).flatMap(p=>{let f=this._sharedAssetsManager.getFont(p);return f?[f.loadingPromise]:[]});if(Promise.all(u).then(()=>{this.disposed||(c.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),v2(r)&&kj(r)&&await Promise.all(u),cI(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(),qm(this._scene.activePage,this._sharedAssetsManager),!this._renderer){let p=await this._initRenderer();if(!p)return;this._renderer=p}if(!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)}}rD(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 pE(this._renderer,this._camera,new G(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(d.allowResponsive??!1)&&d.preset==="fullscreen"),e){let p=new Jw(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,d);this._scene.updateMatrixWorld(!0),this._controls=new pT(p),this._animationControls=new JM(this._scene,this._requestRenderAutoMode),this._eventManager=new cE(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),e&&(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"?eg.mount(this,this.canvas,h,p):Jm.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)){if(e==null){console.warn(`Variable ${t} was not updated: received ${e}. Pass a number, boolean or string.`);return}let r=e;if(typeof n.data.value=="number"){if(r=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e),!Number.isFinite(r)){console.warn(`Variable ${t} is a number variable and ${JSON.stringify(e)} cannot be converted to a number. The variable was not updated.`);return}}else 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"&&Tr.isTextValue(t)?Tr.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!==fo&&!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 im&&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=iX(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,zk(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{SS.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,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,V3(this.canvas),document.removeEventListener("scroll",this._onScroll),cr.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);let n;t.traverseAncestors(d=>{d instanceof Cn&&(n=d.name)});let r=this._sharedAssetsManager,s={shared:r,scene:this._scene},o=d=>{if(d===null||d==="Base State")return null;if(d&&t.data.states){let h=t.data.states.find(p=>p.data.name===d);return h?h.id:void 0}},a="material"in t?t.material:void 0,l=t.materialOverride,c={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:n,material:l??(a?f8(a):void 0),parentUuid:t.parent instanceof Cn||t instanceof Xu?void 0:t.parent?.uuid,emitEvent(d){t.dispatchEvent({type:"userEvent",eventName:d})},emitEventReverse(d){t.dispatchEvent({type:"userEvent",eventName:d,reverse:!0})},hide(){t.visible&&(t.visible=!1,s.shared.requestRender())},show(){t.visible||(t.visible=!0,s.shared.requestRender())},get state(){let d=t.stateSelection;if(d!==null)return t.data.states.find(({id:h})=>h===d)?.data.name},set state(d){let h;if(d!==void 0){let p=typeof d=="string"?t.data.states.find(({id:f})=>f===d):t.data.states[d];if(p)h=p.id;else{let f=typeof d=="string"?o(d):void 0;f&&(h=f)}}t.changeSelectedState(h??null,s),t.currentState=h??null,t.dispatchEvent({type:"completeState",state:h??null}),s.shared.requestRender()},transition(d){let h=lW();if(h===null)return Jn("transitions","obj.transition()"),{transition(E){return this},play(){return this},pause(){return this},reset(){return this},seek(E){return this}};let p=this,f,m=[],g,y=!1,v=()=>{g=new km({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},m.map(S=>S.runner))},b={update(S){g?.update(S),g?.isPlaying!==!0&&cr.remove(b)}},x={transition({from:S,to:E,duration:T,delay:w,..._}){let A=o(S);A===void 0&&(A=f);let C=o(E);return f=C,m.push(new h(t,A,C,{state:C,repeat:0,delay:w??0,delayDirection:"start-once",direction:"normal",duration:T??1e3,..._,..._.easing===6?ea.defaultData:_.easing===5?Kl.defaultData:{}},r,!1,e.activePage,{onBegin:()=>{(S&&A||S==="Base State"&&!A)&&(p.state=A??void 0)},onComplete:()=>{p.state=C??void 0}})),v(),this},play(){return g?(y=!0,g.play(cr.time),g.isPlaying&&cr.add(b),this):this},pause(){return g?.stop(),cr.remove(b),this},reset(){return this.pause(),y=!1,v(),g?.seek(0),this},seek(S){let E=m.reduce((T,w)=>T+w.runner.duration,0);return E>0&&g?.seek(S/1e3/E),this}};return x.transition(d),(d.autoPlay??!0)&&queueMicrotask(()=>{y||x.play()}),x},set color(d){let h=iX(d);if(Qf.is(t)){t.color=h;return}else if(t.type!=="Mesh"||!("material"in t)||!(t instanceof Mr))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(_=>_.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:ge.generateUUID(),data:{...Qn.defaultData("color"),color:p},localIndex:0},T=y.layers.insertAfterHelper(b?.id??null,1),w=y.layers.runOp({...E,fi:T[0]}).data;Object.assign(m.data,{layers:w}),m.updateByOp({...E,path:["layers"]},m.data,s)}}},u=SS(c,(d,h)=>{let p=t[d],f=sue(d);f[0]==="material"&&a&&l===void 0&&m8(f.slice(1),h,a),typeof p!="object"&&Object.getOwnPropertyDescriptor(t,d)?.writable&&(t[d]=h),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,u),u}setUIWasmUrl(t){ck(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=Nd.deserialize(n),s="data"in r&&r.data.draco!==void 0;s&&await cD(this._wasmPath);let o=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!o){console.warn(`Object ${t} not found`);return}if(o.data.type!=="Mesh"||!(o instanceof Mr)){console.warn(`Object ${t} is not a mesh`);return}let a=o,l={...a.data,geometry:r};s&&await uD([l]),a.updateByOp({type:0,path:[],props:{geometry:l.geometry}},l,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let c of a.data.states){let u={...c.data};a.states||(a.states={}),a.states[c.id]=ia.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=Hw();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 Mr))throw new Error(`setMaterial: '${r}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let o=typeof e=="function"?await this.createCustomMaterial(e):e;if(Yf()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=TD({material:o});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(a.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,r=this._data;if(!n||!r)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let s=a8(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let{options:o,material:a}=TD(e);if(a!==void 0){if(s.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(Yf()!=="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(!ik("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 EI(),c=e.font??kd,r.shared.fonts[c]===void 0){if(c!==kd){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:kd,url:yP}}}let u=this._resolveParentId(e.parent),d=c8(s,o,r),h=ge.generateUUID(),[p,f]=Dd(r);l&&(p.shared.fonts[kd]=l),p.scene.objects.insertAfter(u,null,[{id:h,data:d,children:[]}]);let m=f.result();if(l&&this._sharedAssetsManager.addFont(kd,l),c!==void 0){let y=this._sharedAssetsManager.getFont(c);y&&await y.loadingPromise}this._applyDocumentTransaction(m);let g=n.find(h);return a!==void 0&&g.setMaterialOverride(a,{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,o=s?this._findEntity(s):void 0;if(!o)throw new Error(`cloneObject: '${s}' \u2014 no object with that name or uuid in the scene.`);if(o instanceof Cn)throw new Error("cloneObject: pages cannot be cloned.");let a=r.scene.objects.get(o.uuid);if(!a)throw new Error(`cloneObject: '${s}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let l=p8(h8(a),e,r.scene.objects),c=e.parent!==void 0?this._resolveParentId(e.parent):r.scene.objects.parent(o.uuid)??null,u=e.parent!==void 0?null:o.uuid,[d,h]=Dd(r);d.scene.objects.insertAfter(c,u,[l]),this._applyDocumentTransaction(h.result());let p=n.find(l.id);return this._requestRenderAutoMode(),this._createProxyObject(p)}removeObject(t){let e=this._scene,n=this._data;if(this.disposed||!e||!n)return!1;let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)return!1;if(s instanceof Cn)throw new Error("removeObject: pages cannot be removed.");if(s.data.type==="PerspectiveCamera"||s.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(n.scene.objects.get(s.uuid)===void 0)throw new Error(`removeObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let o=[];s.traverseEntity(c=>{o.push(c.uuid)});let[a,l]=Dd(n);a.scene.objects.delete(s.uuid),this._applyDocumentTransaction(l.result());for(let c of o){let u=this._proxyObjectCache.get(c);u&&(SS.unsubscribe(u),this._proxyObjectCache.delete(c))}return this._requestRenderAutoMode(),!0}};function sue(i){return i.split(".")}