@uptimizr/dashboard 0.3.0 → 0.3.2

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 (360) hide show
  1. package/out/404.html +1 -1
  2. package/out/__next.__PAGE__.txt +4 -4
  3. package/out/__next._full.txt +11 -11
  4. package/out/__next._head.txt +4 -4
  5. package/out/__next._index.txt +4 -4
  6. package/out/__next._tree.txt +2 -2
  7. package/out/_next/static/chunks/0-29qf-q72olu.js +1 -0
  8. package/out/_next/static/chunks/0-tk5ptli--r0.js +1 -0
  9. package/out/_next/static/chunks/006nix8mv66z_.js +1 -0
  10. package/out/_next/static/chunks/01aeari2x_tlz.js +1 -0
  11. package/out/_next/static/chunks/0296l8lzd69ns.js +1 -0
  12. package/out/_next/static/chunks/02tc9r3sc7fgc.js +1 -0
  13. package/out/_next/static/chunks/{256k1jw1m--l7.js → 03st_hmor6qju.js} +1 -1
  14. package/out/_next/static/chunks/{2ue1wo4ryk87z.js → 04pk6n3z75dcy.js} +1 -1
  15. package/out/_next/static/chunks/05l3dluxivcor.js +1 -0
  16. package/out/_next/static/chunks/06ljadw2-i91-.js +1 -0
  17. package/out/_next/static/chunks/06m_64ysu9kn0.js +1 -0
  18. package/out/_next/static/chunks/{2ycvtdd68gub7.js → 08bm3ye5govev.js} +1 -1
  19. package/out/_next/static/chunks/{32ahba5ezp467.js → 08rk1dp1wb-gm.js} +38 -38
  20. package/out/_next/static/chunks/091ll-lp6spu3.js +1 -0
  21. package/out/_next/static/chunks/09p5fltt7o3to.js +1 -0
  22. package/out/_next/static/chunks/{3mbnfpufs2-7e.js → 0_tqu60oxaj7q.js} +1 -1
  23. package/out/_next/static/chunks/{3riekaxl3uxfb.js → 0_ux41xcoea3u.js} +40 -40
  24. package/out/_next/static/chunks/0b7-mrrg7ryj2.js +1 -0
  25. package/out/_next/static/chunks/{29tfeb6amdkjb.js → 0c2k-gvwph4qs.js} +1 -1
  26. package/out/_next/static/chunks/0e7xuupmrw4-e.js +1 -0
  27. package/out/_next/static/chunks/0f_nv15a8q415.js +1 -0
  28. package/out/_next/static/chunks/0fxfsshoxnnh6.js +4 -0
  29. package/out/_next/static/chunks/0g6u34xkzrpjn.js +1 -0
  30. package/out/_next/static/chunks/0g7p8zp2kxve5.js +1 -0
  31. package/out/_next/static/chunks/0gblbgw7w7r9w.js +1 -0
  32. package/out/_next/static/chunks/0gwa154w_0wuh.js +1 -0
  33. package/out/_next/static/chunks/0h-ohf4gntwtj.js +1 -0
  34. package/out/_next/static/chunks/0h1o0cr3327tt.js +1 -0
  35. package/out/_next/static/chunks/0i9oqg-xbq-a9.js +1 -0
  36. package/out/_next/static/chunks/0ioyy42h35hnd.js +1 -0
  37. package/out/_next/static/chunks/{242xhzxxetctz.js → 0jf3n5n5yrr4o.js} +1 -1
  38. package/out/_next/static/chunks/{3idaz_s77e-j_.js → 0jxklh_ayjd4b.js} +12 -12
  39. package/out/_next/static/chunks/{07eeopuufsqp-.js → 0k79ryqehst0b.js} +11 -11
  40. package/out/_next/static/chunks/{3be6s4_kn9q-o.js → 0kcbdjbdxu_wa.js} +1 -1
  41. package/out/_next/static/chunks/0kr-bd6fuqc2s.js +1 -0
  42. package/out/_next/static/chunks/0l3wwyl93sqh9.js +1 -0
  43. package/out/_next/static/chunks/{3l1dr_qm_x5kp.js → 0m0n7kjzscx0y.js} +1 -1
  44. package/out/_next/static/chunks/0m3yjobjg36ce.js +1 -0
  45. package/out/_next/static/chunks/{1a9l89j7e6mqu.js → 0mk8tangq9equ.js} +1 -1
  46. package/out/_next/static/chunks/0mqi0xn_c010j.js +1 -0
  47. package/out/_next/static/chunks/0msckddycfy76.js +1 -0
  48. package/out/_next/static/chunks/0ngai1_zxwsk8.js +1 -0
  49. package/out/_next/static/chunks/0ngiuj5k-or6g.js +1 -0
  50. package/out/_next/static/chunks/0nx_t8iq-324h.js +1 -0
  51. package/out/_next/static/chunks/0oap0o8a8a_cl.js +1 -0
  52. package/out/_next/static/chunks/{3tm-pqpmq_ppw.js → 0ostjlqtwkhqr.js} +1 -1
  53. package/out/_next/static/chunks/{1uu-rt_8p1edp.js → 0ptp4ne7j6yg6.js} +11 -11
  54. package/out/_next/static/chunks/0rruvj1cyflrh.js +1 -0
  55. package/out/_next/static/chunks/{0o_mp98xzqfyf.js → 0tl8j9f8lt0yf.js} +1 -1
  56. package/out/_next/static/chunks/{0sqys6o2pbe1q.js → 0ufakw529sr9d.js} +38 -38
  57. package/out/_next/static/chunks/{3ne77mjdz2y7o.js → 0vddljjnmozzx.js} +1 -1
  58. package/out/_next/static/chunks/{0dm32-jq30tg8.js → 0w0sx062qmcsh.js} +1 -1
  59. package/out/_next/static/chunks/{0rys92_73hdb0.js → 0x4-zyy8pzmlq.js} +1 -1
  60. package/out/_next/static/chunks/0x6i6e6863tir.js +1 -0
  61. package/out/_next/static/chunks/{3k9d4ylc3li2t.js → 0zcdc17ie6lmh.js} +10 -10
  62. package/out/_next/static/chunks/{44nxswtahaq4w.js → 0zo4x1j8ug-kb.js} +5 -5
  63. package/out/_next/static/chunks/{0jmn7u31w95ly.js → 0zwkmsojeuekb.js} +2 -2
  64. package/out/_next/static/chunks/{3m6nmp2dca6un.js → 1--aypw9o8yng.js} +37 -37
  65. package/out/_next/static/chunks/1--kelnig7pxx.js +1 -0
  66. package/out/_next/static/chunks/1-ud6hztxiazp.js +1 -0
  67. package/out/_next/static/chunks/10v4rskkrjgd_.js +1 -0
  68. package/out/_next/static/chunks/117ys3lltfmcu.js +1 -0
  69. package/out/_next/static/chunks/14klj_i6-l-10.js +1 -0
  70. package/out/_next/static/chunks/159u-hx80yfaw.js +1 -0
  71. package/out/_next/static/chunks/{3gimb3z_mteou.js → 168r9r65o9jnc.js} +1 -1
  72. package/out/_next/static/chunks/{0w8_1yjvol1f0.js → 16d4a4iopj2if.js} +5 -5
  73. package/out/_next/static/chunks/{2z_jn9ud28fk7.js → 17d1isrw8gtnb.js} +1 -1
  74. package/out/_next/static/chunks/17dabmbnkkplu.js +1 -0
  75. package/out/_next/static/chunks/17dmbt396_tyq.js +1 -0
  76. package/out/_next/static/chunks/17ev44x54_jrd.js +1 -0
  77. package/out/_next/static/chunks/17svumd4o0qnc.js +1 -0
  78. package/out/_next/static/chunks/17v12p4sfraa0.js +1 -0
  79. package/out/_next/static/chunks/18avgwx9nlxp9.js +1 -0
  80. package/out/_next/static/chunks/{0tw4dyl-cp-hd.js → 18k-0jn63_5ie.js} +1 -1
  81. package/out/_next/static/chunks/18r387bj9iv0j.js +1 -0
  82. package/out/_next/static/chunks/18ss4ls60s31e.js +1 -0
  83. package/out/_next/static/chunks/1a7cup181rjod.js +1 -0
  84. package/out/_next/static/chunks/1ajmblsp0wj0_.js +1 -0
  85. package/out/_next/static/chunks/{1dsy2ngmfflis.js → 1b2tkk7e_2o0k.js} +2 -2
  86. package/out/_next/static/chunks/{1ltux4lwz7muf.js → 1bv97vf67p_ri.js} +33 -33
  87. package/out/_next/static/chunks/1e1zozntzsx42.js +1 -0
  88. package/out/_next/static/chunks/1ek5rtpo6rxev.js +1 -0
  89. package/out/_next/static/chunks/1evp209qbr4cr.js +5 -0
  90. package/out/_next/static/chunks/1f1vq3goue1w4.js +1 -0
  91. package/out/_next/static/chunks/{296w2ke-v5tbm.js → 1f92k-xa0pl-3.js} +1 -1
  92. package/out/_next/static/chunks/1fa265388524p.js +1 -0
  93. package/out/_next/static/chunks/1fruncg3k-3pu.js +3 -0
  94. package/out/_next/static/chunks/{1_qzlkuxukhpq.js → 1fvlbwp6r93wo.js} +22 -22
  95. package/out/_next/static/chunks/1g3z43o3h-024.js +31 -0
  96. package/out/_next/static/chunks/1g_27texazqcj.js +1 -0
  97. package/out/_next/static/chunks/1iaxzjly2pap1.js +1 -0
  98. package/out/_next/static/chunks/{0c83pe1mpx456.js → 1j--a56ji33_x.js} +1 -1
  99. package/out/_next/static/chunks/{112hws17nz665.js → 1kl5xxohpr6-4.js} +1 -1
  100. package/out/_next/static/chunks/1kmsg9ef5djl3.js +1 -0
  101. package/out/_next/static/chunks/1kq86iv41cet4.js +1 -0
  102. package/out/_next/static/chunks/1l12hkz1g7uhf.js +1 -0
  103. package/out/_next/static/chunks/{3figbil1t4ssj.js → 1ll0ta8a2qx1p.js} +16 -16
  104. package/out/_next/static/chunks/{1ynju1jqfrcv0.js → 1oara6fkfvgs3.js} +1 -1
  105. package/out/_next/static/chunks/1par9m038tiov.js +1 -0
  106. package/out/_next/static/chunks/1rcfy_gzean3n.js +1 -0
  107. package/out/_next/static/chunks/{35h5n42wxwgzk.js → 1rne-b-ktit5c.js} +2 -2
  108. package/out/_next/static/chunks/1t60cososq7b0.js +1 -0
  109. package/out/_next/static/chunks/1tdg_eolxlcdl.js +1 -0
  110. package/out/_next/static/chunks/1vkww9l6lgqag.js +1 -0
  111. package/out/_next/static/chunks/1vpcaaf-0dn7q.js +1 -0
  112. package/out/_next/static/chunks/1vzmzrjhlm1q5.js +1 -0
  113. package/out/_next/static/chunks/1w9xu1qa9-wmv.js +1 -0
  114. package/out/_next/static/chunks/1wyr4at61q29n.js +1 -0
  115. package/out/_next/static/chunks/{3_mu-4rdjajna.js → 1y12bjsbq18_t.js} +34 -34
  116. package/out/_next/static/chunks/1y20bv6vl4ylk.js +1 -0
  117. package/out/_next/static/chunks/{0tnlbw78tgaxp.js → 1zcrrq1fx8g2y.js} +2 -2
  118. package/out/_next/static/chunks/224_scesvd739.js +1 -0
  119. package/out/_next/static/chunks/229mkx-mtfcgf.js +1 -0
  120. package/out/_next/static/chunks/{3yfrsm8lfi6ls.js → 22qzld31fbhbv.js} +1 -1
  121. package/out/_next/static/chunks/245h82k-g1nxr.js +1 -0
  122. package/out/_next/static/chunks/24cqjhy669845.js +1 -0
  123. package/out/_next/static/chunks/25ctnyh7njp-d.js +4 -0
  124. package/out/_next/static/chunks/2716si10ouwu-.js +1 -0
  125. package/out/_next/static/chunks/286ggpetqnwyo.js +3 -0
  126. package/out/_next/static/chunks/28f1onw3nywbz.js +1 -0
  127. package/out/_next/static/chunks/28ycc-1519hl2.js +1 -0
  128. package/out/_next/static/chunks/{17xd8hnazzr0g.js → 29v8falcmjvev.js} +34 -33
  129. package/out/_next/static/chunks/{0o6ayai0s01js.js → 2_7dp91937mqi.js} +1 -1
  130. package/out/_next/static/chunks/2_hgfg-cjqw1-.js +1 -0
  131. package/out/_next/static/chunks/2ab-99frxpah-.js +1 -0
  132. package/out/_next/static/chunks/2apt1vh-7rl2l.js +1 -0
  133. package/out/_next/static/chunks/2bn9u9r0rfhvc.js +1 -0
  134. package/out/_next/static/chunks/{45bwefvdpztfs.js → 2btqzk0tj0gz6.js} +1 -1
  135. package/out/_next/static/chunks/2cvvxifoedn6j.js +1 -0
  136. package/out/_next/static/chunks/2dhv35o59yzao.js +1 -0
  137. package/out/_next/static/chunks/{17q0c2h5ui10r.js → 2dolerz81xb52.js} +1 -1
  138. package/out/_next/static/chunks/{2xwy0-qfho1iz.js → 2dqg85hsevk3c.js} +2 -2
  139. package/out/_next/static/chunks/{41wt50z9tx9cx.js → 2enlv4yy0t-9j.js} +12 -12
  140. package/out/_next/static/chunks/2ey30qeaob985.js +1 -0
  141. package/out/_next/static/chunks/2f0r-df7tb3pu.js +1 -0
  142. package/out/_next/static/chunks/2gh4z57fem0_v.js +1 -0
  143. package/out/_next/static/chunks/2gtebfttq1v0o.js +1 -0
  144. package/out/_next/static/chunks/{1ua15kzid0_8p.js → 2h051-1hu4co_.js} +9 -9
  145. package/out/_next/static/chunks/2h1uw3cluvmmo.js +1 -0
  146. package/out/_next/static/chunks/2ib62lnqqaf4p.js +1 -0
  147. package/out/_next/static/chunks/2j-sax2xfdv7l.js +1 -0
  148. package/out/_next/static/chunks/{3z84au-mitjjw.js → 2k4s5rt7-l8jr.js} +1 -1
  149. package/out/_next/static/chunks/2kje_jvmwsvwo.js +1 -0
  150. package/out/_next/static/chunks/{2cbmf9m7lqv6k.js → 2kn_dqzbyabtn.js} +1 -1
  151. package/out/_next/static/chunks/2ktxjmx03u9l3.js +1 -0
  152. package/out/_next/static/chunks/2kw33jl_i9o5j.css +3 -0
  153. package/out/_next/static/chunks/2l_oqx9idxcs8.js +1 -0
  154. package/out/_next/static/chunks/{42k2-4_2hrg6u.js → 2mleh3pbge181.js} +1 -1
  155. package/out/_next/static/chunks/{31u5lbu1vxznh.js → 2npk7tr63h7rl.js} +1 -1
  156. package/out/_next/static/chunks/2op88btas-hl8.js +1 -0
  157. package/out/_next/static/chunks/{1gs-5722l4u59.js → 2p8dbh81chhon.js} +1 -1
  158. package/out/_next/static/chunks/{2yph6f7khgqii.js → 2reukv9c7cq_9.js} +1 -1
  159. package/out/_next/static/chunks/{14ggsmqwej_tt.js → 2rjc8yn50ducj.js} +34 -34
  160. package/out/_next/static/chunks/2s0dwzg7kq36n.js +1 -0
  161. package/out/_next/static/chunks/2vaoftqgc44cg.js +1 -0
  162. package/out/_next/static/chunks/{3_gku1pwluoo0.js → 2vmybybb3dvia.js} +1 -1
  163. package/out/_next/static/chunks/2w7yf7ouyrlkb.js +1 -0
  164. package/out/_next/static/chunks/{3218lp8l0a5g_.js → 2y75diyxqlhzl.js} +1 -1
  165. package/out/_next/static/chunks/{0fh-9h9ylxskr.js → 2yr9wt421xdjr.js} +17 -17
  166. package/out/_next/static/chunks/{0otsec99kdkt7.js → 2yzui3v-besdu.js} +4 -4
  167. package/out/_next/static/chunks/{3wi9gzq2mtr_q.js → 2z9ot-w1x60fv.js} +1 -1
  168. package/out/_next/static/chunks/2zljunurdji0q.js +1 -0
  169. package/out/_next/static/chunks/30363ptka3vzy.js +1 -0
  170. package/out/_next/static/chunks/{38x3c1ra5slhe.js → 3043pprgv9ors.js} +23 -23
  171. package/out/_next/static/chunks/340pg0qkv5tqq.js +1 -0
  172. package/out/_next/static/chunks/{37epa8fz59vba.js → 348hdbpkkcq_2.js} +22 -21
  173. package/out/_next/static/chunks/34gp3hvr3j6um.js +1 -0
  174. package/out/_next/static/chunks/38ea9kqlbxt86.js +1 -0
  175. package/out/_next/static/chunks/38g9jpxjoxn2x.js +1 -0
  176. package/out/_next/static/chunks/390fogn9oz13i.js +1 -0
  177. package/out/_next/static/chunks/{3w9go565cjhq3.js → 39lxb7c--3_2u.js} +30 -30
  178. package/out/_next/static/chunks/39ojyykom0z2r.js +1 -0
  179. package/out/_next/static/chunks/{2bjlls8-qe05r.js → 3_bzxvqtk1t53.js} +12 -12
  180. package/out/_next/static/chunks/3ajhvedcs_lzb.js +1 -0
  181. package/out/_next/static/chunks/3bsvp8qhjqdu0.js +1 -0
  182. package/out/_next/static/chunks/{023axeoslq39i.js → 3d0ejsnhbzi-j.js} +1 -1
  183. package/out/_next/static/chunks/3d5yb9ybkz7hx.js +1 -0
  184. package/out/_next/static/chunks/{0echnagbkyx79.js → 3efuvh_35yhes.js} +39 -39
  185. package/out/_next/static/chunks/3fx3sriw1w3sa.js +1 -0
  186. package/out/_next/static/chunks/{2qq3uzsbiicw3.js → 3fz7tc-4j13uv.js} +21 -21
  187. package/out/_next/static/chunks/3g4e2txsrb2p2.js +1 -0
  188. package/out/_next/static/chunks/{1m_buecgcq67j.js → 3g5ae-38cepwm.js} +199 -199
  189. package/out/_next/static/chunks/3g_h_00xs9u59.js +1 -0
  190. package/out/_next/static/chunks/3gi0f1kg72xsf.js +1 -0
  191. package/out/_next/static/chunks/{38fhw7fatsyvd.js → 3he9bxsc67ivq.js} +1 -1
  192. package/out/_next/static/chunks/3hr-mlwi78nov.js +1 -0
  193. package/out/_next/static/chunks/3jha6wlqw8459.js +1 -0
  194. package/out/_next/static/chunks/3kr1polwvt6o_.js +1 -0
  195. package/out/_next/static/chunks/{0j__xaq_8_di1.js → 3mwoauxszd3mn.js} +1 -1
  196. package/out/_next/static/chunks/3ovd8o_usay7j.js +1 -0
  197. package/out/_next/static/chunks/3pdpaqzwhhijn.js +1 -0
  198. package/out/_next/static/chunks/3pyggl13glbdc.js +1 -0
  199. package/out/_next/static/chunks/3rl45k759wfi1.js +1 -0
  200. package/out/_next/static/chunks/{0flc7nppbmsl1.js → 3sbm1ak54_2ep.js} +1 -1
  201. package/out/_next/static/chunks/3sg4zff4-h3t1.js +1 -0
  202. package/out/_next/static/chunks/3urd7r018nel4.js +1 -0
  203. package/out/_next/static/chunks/3v0td-ziuai2i.js +1 -0
  204. package/out/_next/static/chunks/3vaho-xrtuchd.js +2 -0
  205. package/out/_next/static/chunks/3vxkkhs0vi_xa.js +1 -0
  206. package/out/_next/static/chunks/{1g7emwu85bifo.js → 3w1a2o8nevap8.js} +18 -18
  207. package/out/_next/static/chunks/3wqs57qehored.js +1 -0
  208. package/out/_next/static/chunks/3x6wpv_z5m6rz.js +1 -0
  209. package/out/_next/static/chunks/{1qg_etglhvp9h.js → 3y9c26fv1poq_.js} +199 -199
  210. package/out/_next/static/chunks/{0ql-s-tsmel_u.js → 404f_93w2e8ty.js} +1 -1
  211. package/out/_next/static/chunks/40acif2eh_unv.js +1 -0
  212. package/out/_next/static/chunks/{1hatz-jlztrn0.js → 4227p7752rnny.js} +1 -1
  213. package/out/_next/static/chunks/42oyfkhdvb-u3.js +1 -0
  214. package/out/_next/static/chunks/44gsjajjdhf51.js +1 -0
  215. package/out/_next/static/chunks/{turbopack-19105pdhzxp1x.js → turbopack-16ab30_1p4vhq.js} +1 -1
  216. package/out/_not-found/__next._full.txt +9 -9
  217. package/out/_not-found/__next._head.txt +4 -4
  218. package/out/_not-found/__next._index.txt +4 -4
  219. package/out/_not-found/__next._not-found.__PAGE__.txt +2 -2
  220. package/out/_not-found/__next._not-found.txt +3 -3
  221. package/out/_not-found/__next._tree.txt +2 -2
  222. package/out/_not-found.html +1 -1
  223. package/out/_not-found.txt +9 -9
  224. package/out/index.html +1 -1
  225. package/out/index.txt +11 -11
  226. package/package.json +8 -8
  227. package/out/_next/static/chunks/002cjeoit6-up.js +0 -1
  228. package/out/_next/static/chunks/02n1uiltexy3w.js +0 -1
  229. package/out/_next/static/chunks/03ab2khhe8-x5.js +0 -1
  230. package/out/_next/static/chunks/04_yytpc2paxy.js +0 -1
  231. package/out/_next/static/chunks/06qot1qvlsqaz.js +0 -1
  232. package/out/_next/static/chunks/08a5xek662n8n.js +0 -1
  233. package/out/_next/static/chunks/08wuc9--s8zn_.js +0 -1
  234. package/out/_next/static/chunks/0927l-ygd5c8d.js +0 -1
  235. package/out/_next/static/chunks/09510356f0lad.js +0 -1
  236. package/out/_next/static/chunks/0_eu72k69lxj7.js +0 -1
  237. package/out/_next/static/chunks/0beajlqy8p8b5.js +0 -1
  238. package/out/_next/static/chunks/0dn0yx0rn6mpf.js +0 -1
  239. package/out/_next/static/chunks/0eh1ml86u8dh7.js +0 -1
  240. package/out/_next/static/chunks/0fzmc1up21g1i.js +0 -1
  241. package/out/_next/static/chunks/0g_v2zswo4l6f.js +0 -1
  242. package/out/_next/static/chunks/0grlb9lo8e502.js +0 -1
  243. package/out/_next/static/chunks/0h22pg-0xrxnm.js +0 -1
  244. package/out/_next/static/chunks/0j6p1pmc14t96.js +0 -1
  245. package/out/_next/static/chunks/0j_6dx-sttgsy.js +0 -1
  246. package/out/_next/static/chunks/0kfd-cvj5fvtz.js +0 -1
  247. package/out/_next/static/chunks/0r47gs_e93cka.js +0 -1
  248. package/out/_next/static/chunks/0titqrn1qmcsv.js +0 -1
  249. package/out/_next/static/chunks/0tl_moiyi2txt.js +0 -1
  250. package/out/_next/static/chunks/0v82oqyoy9zol.js +0 -1
  251. package/out/_next/static/chunks/0vbce-8omgurc.js +0 -1
  252. package/out/_next/static/chunks/0vfsg5byzep_0.js +0 -1
  253. package/out/_next/static/chunks/0xh144a5fz58h.js +0 -1
  254. package/out/_next/static/chunks/0xjltg_pph0c8.js +0 -1
  255. package/out/_next/static/chunks/0yeqgh0dnas8d.js +0 -1
  256. package/out/_next/static/chunks/101-7e_7up7rk.js +0 -1
  257. package/out/_next/static/chunks/128e51hj_04r0.js +0 -1
  258. package/out/_next/static/chunks/12kv810lohbsx.js +0 -5
  259. package/out/_next/static/chunks/14bws-suyy5zu.js +0 -1
  260. package/out/_next/static/chunks/15s7425ffrec9.js +0 -3
  261. package/out/_next/static/chunks/17genz6pkmty_.js +0 -1
  262. package/out/_next/static/chunks/18dczy9ylt2s_.js +0 -1
  263. package/out/_next/static/chunks/18xs_kvsaolb0.js +0 -1
  264. package/out/_next/static/chunks/19016f8-ry0z6.js +0 -1
  265. package/out/_next/static/chunks/1_6oejyxj39li.js +0 -1
  266. package/out/_next/static/chunks/1_aon8nz9p1fr.js +0 -1
  267. package/out/_next/static/chunks/1akaj5rhgitn3.js +0 -1
  268. package/out/_next/static/chunks/1bvl1ws7b_3gn.js +0 -1
  269. package/out/_next/static/chunks/1cdbk6kxyr1c9.js +0 -1
  270. package/out/_next/static/chunks/1fbjkk55uu4_g.js +0 -1
  271. package/out/_next/static/chunks/1furcfsgrw_3g.js +0 -1
  272. package/out/_next/static/chunks/1g0-f1g3gn_rs.js +0 -1
  273. package/out/_next/static/chunks/1gt4kh0_xmigy.js +0 -1
  274. package/out/_next/static/chunks/1h8xzuuhhglu9.js +0 -1
  275. package/out/_next/static/chunks/1iioifo7i0t0_.js +0 -1
  276. package/out/_next/static/chunks/1iiz7jqgj20z0.js +0 -1
  277. package/out/_next/static/chunks/1kujmd5n0j9nk.js +0 -1
  278. package/out/_next/static/chunks/1n9sy0yt5d2vq.js +0 -1
  279. package/out/_next/static/chunks/1nj82er7msdto.js +0 -2
  280. package/out/_next/static/chunks/1p1gz6dseck--.js +0 -1
  281. package/out/_next/static/chunks/1p1xtsfwvpuqo.js +0 -1
  282. package/out/_next/static/chunks/1p8f6okk2ewbz.js +0 -1
  283. package/out/_next/static/chunks/1pdep2_c530sg.js +0 -1
  284. package/out/_next/static/chunks/1th_t5ujeqlkf.js +0 -1
  285. package/out/_next/static/chunks/1thr-mdzbu96v.js +0 -1
  286. package/out/_next/static/chunks/1tta1a064979p.js +0 -1
  287. package/out/_next/static/chunks/1u_riwm0nfww7.js +0 -1
  288. package/out/_next/static/chunks/1uu93wuxigx4k.js +0 -1
  289. package/out/_next/static/chunks/1vuq3dos1406d.css +0 -3
  290. package/out/_next/static/chunks/1zfojlgb15okk.js +0 -1
  291. package/out/_next/static/chunks/1zj8x5wbgnzz-.js +0 -1
  292. package/out/_next/static/chunks/1zl6t15gh34nn.js +0 -1
  293. package/out/_next/static/chunks/2-qo2o1_fmpy-.js +0 -3
  294. package/out/_next/static/chunks/223vrr_4sfhsj.js +0 -1
  295. package/out/_next/static/chunks/22cr2b04btguf.js +0 -1
  296. package/out/_next/static/chunks/24essz5mmvx-6.js +0 -1
  297. package/out/_next/static/chunks/259obyrpxcv6r.js +0 -1
  298. package/out/_next/static/chunks/26v9yqicofqba.js +0 -1
  299. package/out/_next/static/chunks/2712627rfsmwn.js +0 -1
  300. package/out/_next/static/chunks/290d93hmm_e8b.js +0 -1
  301. package/out/_next/static/chunks/2_2fk7iddrs43.js +0 -1
  302. package/out/_next/static/chunks/2ckd7f1wbfod-.js +0 -1
  303. package/out/_next/static/chunks/2d6hru4qo23tt.js +0 -1
  304. package/out/_next/static/chunks/2ejvntxtvf5o9.js +0 -1
  305. package/out/_next/static/chunks/2f7_3tzf7xhps.js +0 -1
  306. package/out/_next/static/chunks/2gxd_o1g89_bv.js +0 -1
  307. package/out/_next/static/chunks/2hd2txb4-m9k1.js +0 -1
  308. package/out/_next/static/chunks/2hpxou_cnp4f_.js +0 -1
  309. package/out/_next/static/chunks/2izioctrfc0s5.js +0 -1
  310. package/out/_next/static/chunks/2jhnk4h4n0udv.js +0 -1
  311. package/out/_next/static/chunks/2jpkhkk9zi8-f.js +0 -1
  312. package/out/_next/static/chunks/2kpet_l1kq2sx.js +0 -1
  313. package/out/_next/static/chunks/2nck5w4c7leb7.js +0 -1
  314. package/out/_next/static/chunks/2qqqpu0ahfdda.js +0 -1
  315. package/out/_next/static/chunks/2r3ct6se2qn8z.js +0 -1
  316. package/out/_next/static/chunks/2u-f7mmxvk8wj.js +0 -1
  317. package/out/_next/static/chunks/2uk-vwlxe9-xr.js +0 -1
  318. package/out/_next/static/chunks/2ur5-lxdvv1jm.js +0 -1
  319. package/out/_next/static/chunks/2veqsohwfhfqc.js +0 -1
  320. package/out/_next/static/chunks/2vqlv9wnewhu9.js +0 -1
  321. package/out/_next/static/chunks/2wzshintp5lf8.js +0 -1
  322. package/out/_next/static/chunks/2x-00glogc485.js +0 -1
  323. package/out/_next/static/chunks/2yfxy0f5fqs4o.js +0 -1
  324. package/out/_next/static/chunks/2z88mt3ixktu3.js +0 -1
  325. package/out/_next/static/chunks/3-eswqjobiqk1.js +0 -1
  326. package/out/_next/static/chunks/30-tbi7pys6fp.js +0 -4
  327. package/out/_next/static/chunks/30c-nsedy_ce0.js +0 -1
  328. package/out/_next/static/chunks/337hn35kts7ud.js +0 -1
  329. package/out/_next/static/chunks/33dgpebv-tf73.js +0 -1
  330. package/out/_next/static/chunks/36jkdhq6kb-cf.js +0 -1
  331. package/out/_next/static/chunks/3833xfnz0a-ub.js +0 -1
  332. package/out/_next/static/chunks/38awrh_qxn22k.js +0 -1
  333. package/out/_next/static/chunks/39idqlqlcp5b9.js +0 -1
  334. package/out/_next/static/chunks/3coacc4-g-g5c.js +0 -1
  335. package/out/_next/static/chunks/3e00fzdfkclzq.js +0 -1
  336. package/out/_next/static/chunks/3e8fmlq0k5wkg.js +0 -1
  337. package/out/_next/static/chunks/3e9tzyrt4_98z.js +0 -1
  338. package/out/_next/static/chunks/3edelqkq92pil.js +0 -1
  339. package/out/_next/static/chunks/3j-4wuhs5weba.js +0 -1
  340. package/out/_next/static/chunks/3jjfnwvybayy7.js +0 -1
  341. package/out/_next/static/chunks/3jwm5dfk_78gc.js +0 -1
  342. package/out/_next/static/chunks/3l3_0ack3gy4k.js +0 -1
  343. package/out/_next/static/chunks/3lwhs5ja7tun3.js +0 -1
  344. package/out/_next/static/chunks/3mcd08gmt038z.js +0 -1
  345. package/out/_next/static/chunks/3mt5th7b1i_u9.js +0 -1
  346. package/out/_next/static/chunks/3puhrqtujktyv.js +0 -1
  347. package/out/_next/static/chunks/3rdifucupcgkg.js +0 -1
  348. package/out/_next/static/chunks/3sdoskq_buttj.js +0 -1
  349. package/out/_next/static/chunks/3sjq_xoi4rbyg.js +0 -31
  350. package/out/_next/static/chunks/3tg-ma9tv9xu4.js +0 -1
  351. package/out/_next/static/chunks/3xagd_2_9zft2.js +0 -1
  352. package/out/_next/static/chunks/3xsq_anpad-fb.js +0 -1
  353. package/out/_next/static/chunks/3ycv2qq7vpbua.js +0 -1
  354. package/out/_next/static/chunks/4030dhur2h70-.js +0 -1
  355. package/out/_next/static/chunks/40ffffml4h_3r.js +0 -4
  356. package/out/_next/static/chunks/431slrqh0wa0g.js +0 -1
  357. package/out/_next/static/chunks/43s_lbd1i2krj.js +0 -1
  358. /package/out/_next/static/{1NTbwHeIsn3AW-SeH9aP0 → 2AsIePMYsPfJoAl46w-g4}/_buildManifest.js +0 -0
  359. /package/out/_next/static/{1NTbwHeIsn3AW-SeH9aP0 → 2AsIePMYsPfJoAl46w-g4}/_clientMiddlewareManifest.js +0 -0
  360. /package/out/_next/static/{1NTbwHeIsn3AW-SeH9aP0 → 2AsIePMYsPfJoAl46w-g4}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,84942,e=>{"use strict";let t,s,n;var o,a,i,r,l,h,u,c,d,p,_,m,f,g,y,b,T,A,x,w,v,M,C,F,S,E,O,N=e.i(99267),I=e.i(65740);(0,I.RegisterTools)();var B=e.i(19114),k=e.i(40408),R=e.i(24632),P=e.i(12638),L=e.i(13379),G=e.i(81623),D=e.i(595),V=e.i(46778),U=e.i(59576),K=e.i(76312);class H{constructor(){this.rootNodes=[],this.cameras=[],this.lights=[],this.meshes=[],this.skeletons=[],this.particleSystems=[],this.animations=[],this.animationGroups=[],this.multiMaterials=[],this.materials=[],this.morphTargetManagers=[],this.geometries=[],this.transformNodes=[],this.actionManagers=[],this.textures=[],this._environmentTexture=null,this.postProcesses=[],this.sounds=null,this.effectLayers=[],this.layers=[],this.reflectionProbes=[],this.spriteManagers=[]}get environmentTexture(){return this._environmentTexture}set environmentTexture(e){this._environmentTexture=e}getNodes(){let e=[];for(let t of(e=(e=(e=(e=e.concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes),this.skeletons))e=e.concat(t.bones);return e}}class $ extends H{}class z{constructor(){this.rootNodes=[],this.skeletons=[],this.animationGroups=[]}dispose(){let e=this.rootNodes;for(let t of e)t.dispose();e.length=0;let t=this.skeletons;for(let e of t)e.dispose();t.length=0;let s=this.animationGroups;for(let e of s)e.dispose();s.length=0}}class q extends H{constructor(e){if(super(),this._wasAddedToScene=!1,!(e=e||G.EngineStore.LastCreatedScene))return;this.scene=e,this.proceduralTextures=[],e.onDisposeObservable.add(()=>{this._wasAddedToScene||this.dispose()}),this._onContextRestoredObserver=e.getEngine().onContextRestoredObservable.add(()=>{for(let e of this.geometries)e._rebuild();for(let e of this.meshes)e._rebuild();for(let e of this.particleSystems)e.rebuild();for(let e of this.textures)e._rebuild();for(let e of this.spriteManagers)e.rebuild()})}_topologicalSort(e){let t=new Map;for(let s of e)t.set(s.uniqueId,s);let s={dependsOn:new Map,dependedBy:new Map};for(let t of e){let e=t.uniqueId;s.dependsOn.set(e,new Set),s.dependedBy.set(e,new Set)}for(let n of e){let e=n.uniqueId,o=s.dependsOn.get(e);if(n instanceof D.InstancedMesh){let a=n.sourceMesh;t.has(a.uniqueId)&&(o.add(a.uniqueId),s.dependedBy.get(a.uniqueId).add(e))}let a=s.dependedBy.get(e);for(let o of n.getDescendants()){let n=o.uniqueId;t.has(n)&&(a.add(n),s.dependsOn.get(n).add(e))}}let n=[],o=[];for(let n of e){let e=n.uniqueId;0===s.dependsOn.get(e).size&&(o.push(n),t.delete(e))}for(;o.length>0;){let e=o.shift();for(let a of(n.push(e),Array.from(s.dependedBy.get(e.uniqueId).values()))){let n=s.dependsOn.get(a);n.delete(e.uniqueId),0===n.size&&t.get(a)&&(o.push(t.get(a)),t.delete(a))}}return t.size>0&&(L.Logger.Error("SceneSerializer._topologicalSort: There were unvisited nodes:"),t.forEach(e=>{L.Logger.Error(e.name)})),n}_addNodeAndDescendantsToList(e,t,s,n){if(!(!s||n&&!n(s)||t.has(s.uniqueId)))for(let o of(e.push(s),t.add(s.uniqueId),s.getDescendants(!0)))this._addNodeAndDescendantsToList(e,t,o,n)}_isNodeInContainer(e){return e instanceof P.AbstractMesh&&-1!==this.meshes.indexOf(e)||e instanceof R.TransformNode&&-1!==this.transformNodes.indexOf(e)||e instanceof V.Light&&-1!==this.lights.indexOf(e)||e instanceof U.Camera&&-1!==this.cameras.indexOf(e)}_isValidHierarchy(){for(let e of this.meshes)if(e.parent&&!this._isNodeInContainer(e.parent))return L.Logger.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;for(let e of this.transformNodes)if(e.parent&&!this._isNodeInContainer(e.parent))return L.Logger.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;for(let e of this.lights)if(e.parent&&!this._isNodeInContainer(e.parent))return L.Logger.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;for(let e of this.cameras)if(e.parent&&!this._isNodeInContainer(e.parent))return L.Logger.Warn(`Node ${e.name} has a parent that is not in the container.`),!1;return!0}instantiateModelsToScene(e,t=!1,s){this._isValidHierarchy()||I.Tools.Warn("SceneSerializer.InstantiateModelsToScene: The Asset Container hierarchy is not valid.");let n={},o={},a=new z,i=[],r=[],l={doNotInstantiate:!0,...s},h=[],u=new Set;for(let e of this.transformNodes)null===e.parent&&this._addNodeAndDescendantsToList(h,u,e,l.predicate);for(let e of this.meshes)null===e.parent&&this._addNodeAndDescendantsToList(h,u,e,l.predicate);let c=this._topologicalSort(h),d=(s,i)=>{if(n[s.uniqueId]=i.uniqueId,o[i.uniqueId]=i,e&&(i.name=e(s.name)),i instanceof k.Mesh&&i.morphTargetManager){let e=s.morphTargetManager;i.morphTargetManager=e.clone();for(let t=0;t<e.numTargets;t++){let s=e.getTarget(t),a=i.morphTargetManager.getTarget(t);n[s.uniqueId]=a.uniqueId,o[a.uniqueId]=a}}if(s.parent){let e=o[n[s.parent.uniqueId]];e?i.parent=e:i.parent=s.parent}if(i.position&&s.position&&i.position.copyFrom(s.position),i.rotationQuaternion&&s.rotationQuaternion&&i.rotationQuaternion.copyFrom(s.rotationQuaternion),i.rotation&&s.rotation&&i.rotation.copyFrom(s.rotation),i.scaling&&s.scaling&&i.scaling.copyFrom(s.scaling),i.material&&i.material)if(t){let t=s.material;if(-1===r.indexOf(t)){let s=t.clone(e?e(t.name):"Clone of "+t.name);if(r.push(t),n[t.uniqueId]=s.uniqueId,o[s.uniqueId]=s,"MultiMaterial"===t.getClassName()){for(let a of t.subMaterials)a&&(s=a.clone(e?e(a.name):"Clone of "+a.name),r.push(a),n[a.uniqueId]=s.uniqueId,o[s.uniqueId]=s);t.subMaterials=t.subMaterials.map(e=>e&&o[n[e.uniqueId]])}}"InstancedMesh"!==i.getClassName()&&(i.material=o[n[t.uniqueId]])}else"MultiMaterial"===i.material.getClassName()?-1===this.scene.multiMaterials.indexOf(i.material)&&this.scene.addMultiMaterial(i.material):-1===this.scene.materials.indexOf(i.material)&&this.scene.addMaterial(i.material);null===i.parent&&a.rootNodes.push(i)};for(let e of c)if("InstancedMesh"===e.getClassName()){let t=e.sourceMesh,s=n[t.uniqueId],a=("number"==typeof s?o[s]:t).createInstance(e.name);d(e,a)}else{let t=!0;"TransformNode"===e.getClassName()||"Node"===e.getClassName()||e.skeleton||!e.getTotalVertices||0===e.getTotalVertices()?t=!1:l.doNotInstantiate&&(t="function"==typeof l.doNotInstantiate?!l.doNotInstantiate(e):!l.doNotInstantiate);let s=t?e.createInstance(`instance of ${e.name}`):e.clone(`Clone of ${e.name}`,null,!0);if(!s)throw Error(`Could not clone or instantiate node on Asset Container ${e.name}`);d(e,s)}for(let t of this.skeletons){if(l.predicate&&!l.predicate(t))continue;let s=t.clone(e?e(t.name):"Clone of "+t.name);for(let e of this.meshes)if(e.skeleton===t&&!e.isAnInstance){let t=o[n[e.uniqueId]];if(!t||t.isAnInstance||(t.skeleton=s,-1!==i.indexOf(s)))continue;for(let e of(i.push(s),s.bones))e._linkedTransformNode&&(e._linkedTransformNode=o[n[e._linkedTransformNode.uniqueId]])}a.skeletons.push(s)}for(let t of this.animationGroups){if(l.predicate&&!l.predicate(t))continue;let s=t.clone(e?e(t.name):"Clone of "+t.name,e=>o[n[e.uniqueId]]||e);a.animationGroups.push(s)}return a}addAllToScene(){if(!this._wasAddedToScene){for(let e of(this._isValidHierarchy()||I.Tools.Warn("SceneSerializer.addAllToScene: The Asset Container hierarchy is not valid."),this._wasAddedToScene=!0,this.addToScene(null),this.environmentTexture&&(this.scene.environmentTexture=this.environmentTexture),this.scene._serializableComponents))e.addFromContainer(this);this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null}}addToScene(e=null){let t=[];for(let s of this.cameras)(!e||e(s))&&(this.scene.addCamera(s),t.push(s));for(let s of this.lights)(!e||e(s))&&(this.scene.addLight(s),t.push(s));for(let s of this.meshes)(!e||e(s))&&(this.scene.addMesh(s),t.push(s));for(let t of this.skeletons)(!e||e(t))&&this.scene.addSkeleton(t);for(let t of this.animations)(!e||e(t))&&this.scene.addAnimation(t);for(let t of this.animationGroups)(!e||e(t))&&this.scene.addAnimationGroup(t);for(let t of this.multiMaterials)(!e||e(t))&&this.scene.addMultiMaterial(t);for(let t of this.materials)(!e||e(t))&&this.scene.addMaterial(t);for(let t of this.morphTargetManagers)(!e||e(t))&&this.scene.addMorphTargetManager(t);for(let t of this.geometries)(!e||e(t))&&this.scene.addGeometry(t);for(let s of this.transformNodes)(!e||e(s))&&(this.scene.addTransformNode(s),t.push(s));for(let t of this.actionManagers)(!e||e(t))&&this.scene.addActionManager(t);for(let t of this.textures)(!e||e(t))&&this.scene.addTexture(t);for(let t of this.reflectionProbes)(!e||e(t))&&this.scene.addReflectionProbe(t);for(let t of this.spriteManagers)(!e||e(t))&&(this.scene.spriteManagers||(this.scene.spriteManagers=[]),this.scene.spriteManagers.push(t));if(t.length){let e=new Set(this.scene.meshes);for(let t of this.scene.lights)e.add(t);for(let t of this.scene.cameras)e.add(t);for(let t of this.scene.transformNodes)e.add(t);for(let t of this.skeletons)for(let s of t.bones)e.add(s);for(let s of t)s.parent&&!e.has(s.parent)&&(s.setParent?s.setParent(null):s.parent=null)}}removeAllFromScene(){for(let e of(this._isValidHierarchy()||I.Tools.Warn("SceneSerializer.removeAllFromScene: The Asset Container hierarchy is not valid."),this._wasAddedToScene=!1,this.removeFromScene(null),this.environmentTexture===this.scene.environmentTexture&&(this.scene.environmentTexture=null),this.scene._serializableComponents))e.removeFromContainer(this)}removeFromScene(e=null){for(let t of this.cameras)(!e||e(t))&&this.scene.removeCamera(t);for(let t of this.lights)(!e||e(t))&&this.scene.removeLight(t);for(let t of this.meshes)(!e||e(t))&&this.scene.removeMesh(t,!0);for(let t of this.skeletons)(!e||e(t))&&this.scene.removeSkeleton(t);for(let t of this.animations)(!e||e(t))&&this.scene.removeAnimation(t);for(let t of this.animationGroups)(!e||e(t))&&this.scene.removeAnimationGroup(t);for(let t of this.multiMaterials)(!e||e(t))&&this.scene.removeMultiMaterial(t);for(let t of this.materials)(!e||e(t))&&this.scene.removeMaterial(t);for(let t of this.morphTargetManagers)(!e||e(t))&&this.scene.removeMorphTargetManager(t);for(let t of this.geometries)(!e||e(t))&&this.scene.removeGeometry(t);for(let t of this.transformNodes)(!e||e(t))&&this.scene.removeTransformNode(t);for(let t of this.actionManagers)(!e||e(t))&&this.scene.removeActionManager(t);for(let t of this.textures)(!e||e(t))&&this.scene.removeTexture(t);for(let t of this.reflectionProbes)(!e||e(t))&&this.scene.removeReflectionProbe(t);for(let t of this.spriteManagers)if((!e||e(t))&&this.scene.spriteManagers){let e=this.scene.spriteManagers.indexOf(t);-1!==e&&this.scene.spriteManagers.splice(e,1)}}dispose(){for(let e of this.cameras.slice(0))e.dispose();for(let e of(this.cameras.length=0,this.lights.slice(0)))e.dispose();for(let e of(this.lights.length=0,this.meshes.slice(0)))e.dispose();for(let e of(this.meshes.length=0,this.skeletons.slice(0)))e.dispose();for(let e of(this.skeletons.length=0,this.animationGroups.slice(0)))e.dispose();for(let e of(this.animationGroups.length=0,this.multiMaterials.slice(0)))e.dispose();for(let e of(this.multiMaterials.length=0,this.materials.slice(0)))e.dispose();for(let e of(this.materials.length=0,this.geometries.slice(0)))e.dispose();for(let e of(this.geometries.length=0,this.transformNodes.slice(0)))e.dispose();for(let e of(this.transformNodes.length=0,this.actionManagers.slice(0)))e.dispose();for(let e of(this.actionManagers.length=0,this.textures.slice(0)))e.dispose();for(let e of(this.textures.length=0,this.reflectionProbes.slice(0)))e.dispose();for(let e of(this.reflectionProbes.length=0,this.morphTargetManagers.slice(0)))e.dispose();for(let e of(this.morphTargetManagers.length=0,this.spriteManagers.slice(0)))e.dispose();for(let e of(this.spriteManagers.length=0,this.environmentTexture&&(this.environmentTexture.dispose(),this.environmentTexture=null),this.scene._serializableComponents))e.removeFromContainer(this,!0);this._onContextRestoredObserver&&(this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)}_moveAssets(e,t,s){if(e&&t)for(let n of e){let e=!0;if(s){for(let t of s)if(n===t){e=!1;break}}e&&(t.push(n),n._parentContainer=this)}}moveAllFromScene(e){for(let t in this._wasAddedToScene=!1,void 0===e&&(e=new $),this)Object.prototype.hasOwnProperty.call(this,t)&&(this[t]=this[t]||("_environmentTexture"===t?null:[]),this._moveAssets(this.scene[t],this[t],e[t]));this.environmentTexture=this.scene.environmentTexture,this.removeAllFromScene()}createRootMesh(){let e=new k.Mesh("assetContainerRootMesh",this.scene);for(let t of this.meshes)t.parent||e.addChild(t);return this.meshes.unshift(e),e}mergeAnimationsTo(e=G.EngineStore.LastCreatedScene,t,s=null){if(!e)return L.Logger.Error("No scene available to merge animations to"),[];let n=s||(t=>{let s,n=t.animations.length?t.animations[0].targetProperty:"",o=t.name.split(".").join("").split("_primitive")[0];switch(n){case"position":case"rotationQuaternion":s=e.getTransformNodeByName(t.name)||e.getTransformNodeByName(o);break;case"influence":s=e.getMorphTargetByName(t.name)||e.getMorphTargetByName(o);break;default:s=e.getNodeByName(t.name)||e.getNodeByName(o)}return s});for(let e of this.getNodes()){let t=n(e);if(null!==t){for(let s of e.animations)for(let e of t.animations.filter(e=>e.targetProperty===s.targetProperty)){let s=t.animations.indexOf(e,0);s>-1&&t.animations.splice(s,1)}t.animations=t.animations.concat(e.animations)}}let o=[];for(let e of this.animationGroups.slice())for(let t of(o.push(e.clone(e.name,n)),e.animatables))t.stop();for(let s of t){let t=n(s.target);t&&(e.beginAnimation(t,s.fromFrame,s.toFrame,s.loopAnimation,s.speedRatio,s.onAnimationEnd?s.onAnimationEnd:void 0,void 0,!0,void 0,s.onAnimationLoop?s.onAnimationLoop:void 0),e.stopAnimation(s.target))}return o}populateRootNodes(){for(let e of(this.rootNodes.length=0,this.meshes))e.parent||-1!==this.rootNodes.indexOf(e)||this.rootNodes.push(e);for(let e of this.transformNodes)e.parent||-1!==this.rootNodes.indexOf(e)||this.rootNodes.push(e);for(let e of this.lights)e.parent||-1!==this.rootNodes.indexOf(e)||this.rootNodes.push(e);for(let e of this.cameras)e.parent||-1!==this.rootNodes.indexOf(e)||this.rootNodes.push(e)}addAllAssetsToContainer(e){if(!e)return;let t=[],s=new Set;for(t.push(e);t.length>0;){let e=t.pop();if(e instanceof k.Mesh?(e.geometry&&-1===this.geometries.indexOf(e.geometry)&&this.geometries.push(e.geometry),this.meshes.push(e)):e instanceof D.InstancedMesh?this.meshes.push(e):e instanceof R.TransformNode?this.transformNodes.push(e):e instanceof V.Light?this.lights.push(e):e instanceof U.Camera&&this.cameras.push(e),e instanceof P.AbstractMesh){if(e.material&&-1===this.materials.indexOf(e.material))for(let t of(this.materials.push(e.material),e.material.getActiveTextures()))-1===this.textures.indexOf(t)&&this.textures.push(t);e.skeleton&&-1===this.skeletons.indexOf(e.skeleton)&&this.skeletons.push(e.skeleton),e.morphTargetManager&&-1===this.morphTargetManagers.indexOf(e.morphTargetManager)&&this.morphTargetManagers.push(e.morphTargetManager)}for(let n of e.getChildren())s.has(n)||t.push(n);s.add(e)}this.populateRootNodes()}_getByTags(e,t,s){if(void 0===t)return e;let n=[];for(let o in e){let a=e[o];K.Tags&&K.Tags.MatchesQuery(a,t)&&(!s||s(a))&&n.push(a)}return n}getMeshesByTags(e,t){return this._getByTags(this.meshes,e,t)}getCamerasByTags(e,t){return this._getByTags(this.cameras,e,t)}getLightsByTags(e,t){return this._getByTags(this.lights,e,t)}getMaterialsByTags(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))}getTransformNodesByTags(e,t){return this._getByTags(this.transformNodes,e,t)}}var W=e.i(49311);class j{constructor(e){this.byteOffset=0,this.buffer=e}async loadAsync(e){let t=await this.buffer.readAsync(this.byteOffset,e);this._dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),this._dataByteOffset=0}readUint32(){let e=this._dataView.getUint32(this._dataByteOffset,!0);return this._dataByteOffset+=4,this.byteOffset+=4,e}readUint8Array(e){let t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._dataByteOffset,e);return this._dataByteOffset+=e,this.byteOffset+=e,t}readString(e){return(0,W.Decode)(this.readUint8Array(e))}skipBytes(e){this._dataByteOffset+=e,this.byteOffset+=e}}function Y(e,t,s,n){let o={externalResourceFunction:n};return s&&(o.uri="file:"===t?s:t+s),ArrayBuffer.isView(e)?GLTFValidator.validateBytes(e,o):GLTFValidator.validateString(e,o)}function Q(){let e=[];onmessage=t=>{let s=t.data;switch(s.id){case"init":importScripts(s.url);break;case"validate":Y(s.data,s.rootUrl,s.fileName,t=>new Promise((s,n)=>{let o=e.length;e.push({resolve:s,reject:n}),postMessage({id:"getExternalResource",index:o,uri:t})})).then(e=>{postMessage({id:"validate.resolve",value:e})},e=>{postMessage({id:"validate.reject",reason:e})});break;case"getExternalResource.resolve":e[s.index].resolve(s.value);break;case"getExternalResource.reject":e[s.index].reject(s.reason)}}}class Z{static ValidateAsync(e,t,s,n){return"function"==typeof Worker?new Promise((o,a)=>{let i=`${Y}(${Q})()`,r=new Worker(URL.createObjectURL(new Blob([i],{type:"application/javascript"}))),l=e=>{r.removeEventListener("error",l),r.removeEventListener("message",h),a(e)},h=e=>{let t=e.data;switch(t.id){case"getExternalResource":n(t.uri).then(e=>{r.postMessage({id:"getExternalResource.resolve",index:t.index,value:e},[e.buffer])},e=>{r.postMessage({id:"getExternalResource.reject",index:t.index,reason:e})});break;case"validate.resolve":r.removeEventListener("error",l),r.removeEventListener("message",h),Z._LastResults=t.value,o(t.value),r.terminate();break;case"validate.reject":r.removeEventListener("error",l),r.removeEventListener("message",h),a(t.reason),r.terminate()}};if(r.addEventListener("error",l),r.addEventListener("message",h),r.postMessage({id:"init",url:I.Tools.GetBabylonScriptURL(this.Configuration.url)}),ArrayBuffer.isView(e)){let n=e.slice();r.postMessage({id:"validate",data:n,rootUrl:t,fileName:s},[n.buffer])}else r.postMessage({id:"validate",data:e,rootUrl:t,fileName:s})}):(this._LoadScriptPromise||(this._LoadScriptPromise=I.Tools.LoadBabylonScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then(()=>Y(e,t,s,n)))}}Z.Configuration={url:`${I.Tools._DefaultCdnUrl}/gltf_validator.js`},Z._LastResults=null,e.s(["GLTFValidation",0,Z],87351);let X="Z2xURg",J="gltf",ee={".gltf":{isBinary:!1,mimeType:"model/gltf+json"},".glb":{isBinary:!0,mimeType:"model/gltf-binary"}};var et=e.i(46712);(0,et.RegisterFileTools)();var es=e.i(92605);function en(e,t,s){try{return Promise.resolve(new Uint8Array(e,t,s))}catch(e){return Promise.reject(e)}}(o=y||(y={}))[o.AUTO=0]="AUTO",o[o.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED",(a=b||(b={}))[a.NONE=0]="NONE",a[a.FIRST=1]="FIRST",a[a.ALL=2]="ALL",(i=T||(T={}))[i.LOADING=0]="LOADING",i[i.READY=1]="READY",i[i.COMPLETE=2]="COMPLETE";class eo{constructor(){this.alwaysComputeBoundingBox=!1,this.alwaysComputeSkeletonRootNode=!1,this.animationStartMode=b.FIRST,this.compileMaterials=!1,this.compileShadowGenerators=!1,this.coordinateSystemMode=y.AUTO,this.createInstances=!0,this.loadAllMaterials=!1,this.loadMorphTargets=!0,this.loadNodeAnimations=!0,this.loadOnlyMaterials=!1,this.loadSkins=!0,this.skipMaterials=!1,this.targetFps=60,this.transparencyAsCoverage=!1,this.useClipPlane=!1,this.useGltfTextureNames=!1,this.useRangeRequests=!1,this.useSRGBBuffers=!0,this.validate=!1,this.useOpenPBR=!1,this.dontUseTransmissionHelper=!1}}let ea=new eo;class ei extends eo{constructor(){super(...arguments),this.extensionOptions={},this.preprocessUrlAsync=e=>Promise.resolve(e)}copyFrom(e){e&&(this.alwaysComputeBoundingBox=e.alwaysComputeBoundingBox??this.alwaysComputeBoundingBox,this.alwaysComputeSkeletonRootNode=e.alwaysComputeSkeletonRootNode??this.alwaysComputeSkeletonRootNode,this.animationStartMode=e.animationStartMode??this.animationStartMode,this.capturePerformanceCounters=e.capturePerformanceCounters??this.capturePerformanceCounters,this.compileMaterials=e.compileMaterials??this.compileMaterials,this.compileShadowGenerators=e.compileShadowGenerators??this.compileShadowGenerators,this.coordinateSystemMode=e.coordinateSystemMode??this.coordinateSystemMode,this.createInstances=e.createInstances??this.createInstances,this.customRootNode=e.customRootNode,this.extensionOptions=e.extensionOptions??this.extensionOptions,this.loadAllMaterials=e.loadAllMaterials??this.loadAllMaterials,this.loadMorphTargets=e.loadMorphTargets??this.loadMorphTargets,this.loadNodeAnimations=e.loadNodeAnimations??this.loadNodeAnimations,this.loadOnlyMaterials=e.loadOnlyMaterials??this.loadOnlyMaterials,this.loadSkins=e.loadSkins??this.loadSkins,this.loggingEnabled=e.loggingEnabled??this.loggingEnabled,this.onCameraLoaded=e.onCameraLoaded,this.onMaterialLoaded=e.onMaterialLoaded,this.onMeshLoaded=e.onMeshLoaded,this.onParsed=e.onParsed,this.onSkinLoaded=e.onSkinLoaded,this.onTextureLoaded=e.onTextureLoaded,this.onValidated=e.onValidated,this.preprocessUrlAsync=e.preprocessUrlAsync??this.preprocessUrlAsync,this.skipMaterials=e.skipMaterials??this.skipMaterials,this.targetFps=e.targetFps??this.targetFps,this.transparencyAsCoverage=e.transparencyAsCoverage??this.transparencyAsCoverage,this.useClipPlane=e.useClipPlane??this.useClipPlane,this.useGltfTextureNames=e.useGltfTextureNames??this.useGltfTextureNames,this.useOpenPBR=e.useOpenPBR??this.useOpenPBR,this.useRangeRequests=e.useRangeRequests??this.useRangeRequests,this.useSRGBBuffers=e.useSRGBBuffers??this.useSRGBBuffers,this.validate=e.validate??this.validate,this.dontUseTransmissionHelper=e.dontUseTransmissionHelper??this.dontUseTransmissionHelper)}}class er extends ei{constructor(e){super(),this.onParsedObservable=new N.Observable,this.onMeshLoadedObservable=new N.Observable,this.onSkinLoadedObservable=new N.Observable,this.onTextureLoadedObservable=new N.Observable,this.onMaterialLoadedObservable=new N.Observable,this.onCameraLoadedObservable=new N.Observable,this.onCompleteObservable=new N.Observable,this.onErrorObservable=new N.Observable,this.onDisposeObservable=new N.Observable,this.onExtensionLoadedObservable=new N.Observable,this.onValidatedObservable=new N.Observable,this._loader=null,this._state=null,this._requests=[],this.name=J,this.extensions=ee,this.onLoaderStateChangedObservable=new N.Observable,this._logIndentLevel=0,this._loggingEnabled=!1,this._log=this._logDisabled,this._capturePerformanceCounters=!1,this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled,this.copyFrom(Object.assign({...ea},e))}set onParsed(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),e&&(this._onParsedObserver=this.onParsedObservable.add(e))}set onMeshLoaded(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),e&&(this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e))}set onSkinLoaded(e){this._onSkinLoadedObserver&&this.onSkinLoadedObservable.remove(this._onSkinLoadedObserver),e&&(this._onSkinLoadedObserver=this.onSkinLoadedObservable.add(t=>e(t.node,t.skinnedNode)))}set onTextureLoaded(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),e&&(this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e))}set onMaterialLoaded(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),e&&(this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e))}set onCameraLoaded(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),e&&(this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e))}set onComplete(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)}set onError(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)}set onDispose(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)}set onExtensionLoaded(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)}get loggingEnabled(){return this._loggingEnabled}set loggingEnabled(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)}get capturePerformanceCounters(){return this._capturePerformanceCounters}set capturePerformanceCounters(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))}set onValidated(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)}dispose(){for(let e of(this._loader&&(this._loader.dispose(),this._loader=null),this._requests))e.abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=e=>Promise.resolve(e),this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()}loadFile(e,t,s,n,o,a,i,r){if(ArrayBuffer.isView(t))return this._loadBinary(e,t,s,n,i,r),null;this._progressCallback=o;let l=t.name||I.Tools.GetFilename(t);if(!a)return this._loadFile(e,t,t=>{try{this._validate(e,t,s,l),n({json:this._parseJson(t)})}catch{i&&i()}},!1,i);if(this.useRangeRequests){this.validate&&L.Logger.Warn("glTF validation is not supported when range requests are enabled");let s={abort:()=>{},onCompleteObservable:new N.Observable};return this._unpackBinaryAsync(new j({readAsync:(s,n)=>new Promise((o,a)=>{this._loadFile(e,t,e=>{o(new Uint8Array(e))},!0,e=>{a(e)},e=>{e.setRequestHeader("Range",`bytes=${s}-${s+n-1}`)})}),byteLength:0})).then(e=>{s.onCompleteObservable.notifyObservers(s),n(e)},i?e=>i(void 0,e):void 0),s}return this._loadFile(e,t,t=>{this._validate(e,new Uint8Array(t,0,t.byteLength),s,l),this._unpackBinaryAsync(new j({readAsync:(e,s)=>en(t,e,s),byteLength:t.byteLength})).then(e=>{n(e)},i?e=>i(void 0,e):void 0)},!0,i)}_loadBinary(e,t,s,n,o,a){this._validate(e,new Uint8Array(t.buffer,t.byteOffset,t.byteLength),s,a),this._unpackBinaryAsync(new j({readAsync:(e,s)=>(function(e,t,s){try{if(t<0||t>=e.byteLength)throw RangeError("Offset is out of range.");if(t+s>e.byteLength)throw RangeError("Length is out of range.");return Promise.resolve(new Uint8Array(e.buffer,e.byteOffset+t,s))}catch(e){return Promise.reject(e)}})(t,e,s),byteLength:t.byteLength})).then(e=>{n(e)},o?e=>o(void 0,e):void 0)}importMeshAsync(e,t,s,n,o,a){return Promise.resolve().then(()=>(this.onParsedObservable.notifyObservers(s),this.onParsedObservable.clear(),this._log(`Loading ${a||""}`),this._loader=this._getLoader(s),this._loader.importMeshAsync(e,t,null,s,n,o,a)))}loadAsync(e,t,s,n,o){return Promise.resolve().then(()=>(this.onParsedObservable.notifyObservers(t),this.onParsedObservable.clear(),this._log(`Loading ${o||""}`),this._loader=this._getLoader(t),this._loader.loadAsync(e,t,s,n,o)))}loadAssetContainerAsync(e,t,s,n,o){return Promise.resolve().then(()=>{this.onParsedObservable.notifyObservers(t),this.onParsedObservable.clear(),this._log(`Loading ${o||""}`),this._loader=this._getLoader(t);let a=new q(e),i=[];this.onMaterialLoadedObservable.add(e=>{i.push(e)});let r=[];this.onTextureLoadedObservable.add(e=>{r.push(e)});let l=[];this.onCameraLoadedObservable.add(e=>{l.push(e)});let h=[];return this.onMeshLoadedObservable.add(e=>{e.morphTargetManager&&h.push(e.morphTargetManager)}),this._loader.importMeshAsync(null,e,a,t,s,n,o).then(e=>(Array.prototype.push.apply(a.geometries,e.geometries),Array.prototype.push.apply(a.meshes,e.meshes),Array.prototype.push.apply(a.particleSystems,e.particleSystems),Array.prototype.push.apply(a.skeletons,e.skeletons),Array.prototype.push.apply(a.animationGroups,e.animationGroups),Array.prototype.push.apply(a.materials,i),Array.prototype.push.apply(a.textures,r),Array.prototype.push.apply(a.lights,e.lights),Array.prototype.push.apply(a.transformNodes,e.transformNodes),Array.prototype.push.apply(a.cameras,l),Array.prototype.push.apply(a.morphTargetManagers,h),a))})}canDirectLoad(e){let t;return -1!==(t=e).indexOf("asset")&&-1!==t.indexOf("version")||t.startsWith("data:base64,"+X)||t.startsWith("data:;base64,"+X)||t.startsWith("data:application/octet-stream;base64,"+X)||t.startsWith("data:model/gltf-binary;base64,"+X)}directLoad(e,t){if(t.startsWith("base64,"+X)||t.startsWith(";base64,"+X)||t.startsWith("application/octet-stream;base64,"+X)||t.startsWith("model/gltf-binary;base64,"+X)){let s=(0,et.DecodeBase64UrlToBinary)(t);return this._validate(e,new Uint8Array(s,0,s.byteLength)),this._unpackBinaryAsync(new j({readAsync:(e,t)=>en(s,e,t),byteLength:s.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})}createPlugin(e){return new er(e[J])}get loaderState(){return this._state}whenCompleteAsync(){return new Promise((e,t)=>{this.onCompleteObservable.addOnce(()=>{e()}),this.onErrorObservable.addOnce(e=>{t(e)})})}_setState(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(T[this._state]))}_loadFile(e,t,s,n,o,a){let i=e._loadFile(t,s,e=>{this._onProgress(e,i)},!0,n,o,a);return i.onCompleteObservable.add(()=>{i._lengthComputable=!0,i._total=i._loaded}),this._requests.push(i),i}_onProgress(e,t){if(!this._progressCallback)return;t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;let s=!0,n=0,o=0;for(let e of this._requests){if(void 0===e._lengthComputable||void 0===e._loaded||void 0===e._total)return;s=s&&e._lengthComputable,n+=e._loaded,o+=e._total}this._progressCallback({lengthComputable:s,loaded:n,total:s?o:0})}_validate(e,t,s="",n=""){this.validate&&(this._startPerformanceCounter("Validate JSON"),Z.ValidateAsync(t,s,n,t=>this.preprocessUrlAsync(s+t).then(t=>e._loadFileAsync(t,void 0,!0,!0).then(e=>new Uint8Array(e,0,e.byteLength)))).then(e=>{this._endPerformanceCounter("Validate JSON"),this.onValidatedObservable.notifyObservers(e),this.onValidatedObservable.clear()},e=>{this._endPerformanceCounter("Validate JSON"),I.Tools.Warn(`Failed to validate: ${e.message}`),this.onValidatedObservable.clear()}))}_getLoader(e){let t=e.json.asset||{};this._log(`Asset version: ${t.version}`),t.minVersion&&this._log(`Asset minimum version: ${t.minVersion}`),t.generator&&this._log(`Asset generator: ${t.generator}`);let s=er._parseVersion(t.version);if(!s)throw Error("Invalid version: "+t.version);if(void 0!==t.minVersion){let e=er._parseVersion(t.minVersion);if(!e)throw Error("Invalid minimum version: "+t.minVersion);if(er._compareVersion(e,{major:2,minor:0})>0)throw Error("Incompatible minimum version: "+t.minVersion)}let n={1:er._CreateGLTF1Loader,2:er._CreateGLTF2Loader}[s.major];if(!n)throw Error("Unsupported version: "+t.version);return n(this)}_parseJson(e){this._startPerformanceCounter("Parse JSON"),this._log(`JSON length: ${e.length}`);let t=JSON.parse(e);return this._endPerformanceCounter("Parse JSON"),t}_unpackBinaryAsync(e){return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then(()=>{let t,s=e.readUint32();if(0x46546c67!==s)throw new es.RuntimeError("Unexpected magic: "+s,es.ErrorCodes.GLTFLoaderUnexpectedMagicError);let n=e.readUint32();this.loggingEnabled&&this._log(`Binary version: ${n}`);let o=e.readUint32();switch(!this.useRangeRequests&&o!==e.buffer.byteLength&&L.Logger.Warn(`Length in header does not match actual data length: ${o} != ${e.buffer.byteLength}`),n){case 1:t=this._unpackBinaryV1Async(e,o);break;case 2:t=this._unpackBinaryV2Async(e,o);break;default:throw Error("Unsupported version: "+n)}return this._endPerformanceCounter("Unpack Binary"),t})}_unpackBinaryV1Async(e,t){let s=e.readUint32(),n=e.readUint32();if(0!==n)throw Error(`Unexpected content format: ${n}`);let o=t-e.byteOffset,a={json:this._parseJson(e.readString(s)),bin:null};if(0!==o){let t=e.byteOffset;a.bin={readAsync:(s,n)=>e.buffer.readAsync(t+s,n),byteLength:o}}return Promise.resolve(a)}_unpackBinaryV2Async(e,t){let s=e.readUint32();if(0x4e4f534a!==e.readUint32())throw Error("First chunk format is not JSON");return e.byteOffset+s===t?e.loadAsync(s).then(()=>({json:this._parseJson(e.readString(s)),bin:null})):e.loadAsync(s+8).then(()=>{let n={json:this._parseJson(e.readString(s)),bin:null},o=()=>{let s=e.readUint32();switch(e.readUint32()){case 0x4e4f534a:throw Error("Unexpected JSON chunk");case 5130562:{let t=e.byteOffset;n.bin={readAsync:(s,n)=>e.buffer.readAsync(t+s,n),byteLength:s},e.skipBytes(s);break}default:e.skipBytes(s)}return e.byteOffset!==t?e.loadAsync(8).then(o):Promise.resolve(n)};return o()})}static _parseVersion(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};let t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null}static _compareVersion(e,t){return e.major>t.major?1:e.major<t.major?-1:e.minor>t.minor?1:e.minor<t.minor?-1:0}_logOpen(e){this._log(e),this._logIndentLevel++}_logClose(){--this._logIndentLevel}_logEnabled(e){let t=er._logSpaces.substring(0,2*this._logIndentLevel);L.Logger.Log(`${t}${e}`)}_logDisabled(e){}_startPerformanceCounterEnabled(e){I.Tools.StartPerformanceCounter(e)}_startPerformanceCounterDisabled(e){}_endPerformanceCounterEnabled(e){I.Tools.EndPerformanceCounter(e)}_endPerformanceCounterDisabled(e){}}er.IncrementalLoading=!0,er.HomogeneousCoordinates=!1,er._logSpaces=" ",(0,B.RegisterSceneLoaderPlugin)(new er),e.s(["GLTFFileLoader",0,er,"GLTFLoaderAnimationStartMode",0,b,"GLTFLoaderCoordinateSystemMode",0,y,"GLTFLoaderDefaultOptions",0,ea,"GLTFLoaderState",0,T],77148),(r=A||(A={}))[r.BYTE=5120]="BYTE",r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.SHORT=5122]="SHORT",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.FLOAT=5126]="FLOAT",(l=x||(x={}))[l.FRAGMENT=35632]="FRAGMENT",l[l.VERTEX=35633]="VERTEX",(h=w||(w={}))[h.BYTE=5120]="BYTE",h[h.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",h[h.SHORT=5122]="SHORT",h[h.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",h[h.INT=5124]="INT",h[h.UNSIGNED_INT=5125]="UNSIGNED_INT",h[h.FLOAT=5126]="FLOAT",h[h.FLOAT_VEC2=35664]="FLOAT_VEC2",h[h.FLOAT_VEC3=35665]="FLOAT_VEC3",h[h.FLOAT_VEC4=35666]="FLOAT_VEC4",h[h.INT_VEC2=35667]="INT_VEC2",h[h.INT_VEC3=35668]="INT_VEC3",h[h.INT_VEC4=35669]="INT_VEC4",h[h.BOOL=35670]="BOOL",h[h.BOOL_VEC2=35671]="BOOL_VEC2",h[h.BOOL_VEC3=35672]="BOOL_VEC3",h[h.BOOL_VEC4=35673]="BOOL_VEC4",h[h.FLOAT_MAT2=35674]="FLOAT_MAT2",h[h.FLOAT_MAT3=35675]="FLOAT_MAT3",h[h.FLOAT_MAT4=35676]="FLOAT_MAT4",h[h.SAMPLER_2D=35678]="SAMPLER_2D",(u=v||(v={}))[u.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",u[u.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",u[u.REPEAT=10497]="REPEAT",(c=M||(M={}))[c.NEAREST=9728]="NEAREST",c[c.LINEAR=9728]="LINEAR",c[c.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",c[c.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",c[c.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",c[c.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",(d=C||(C={}))[d.ALPHA=6406]="ALPHA",d[d.RGB=6407]="RGB",d[d.RGBA=6408]="RGBA",d[d.LUMINANCE=6409]="LUMINANCE",d[d.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",(p=F||(F={}))[p.FRONT=1028]="FRONT",p[p.BACK=1029]="BACK",p[p.FRONT_AND_BACK=1032]="FRONT_AND_BACK",(_=S||(S={}))[_.ZERO=0]="ZERO",_[_.ONE=1]="ONE",_[_.SRC_COLOR=768]="SRC_COLOR",_[_.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",_[_.DST_COLOR=774]="DST_COLOR",_[_.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",_[_.SRC_ALPHA=770]="SRC_ALPHA",_[_.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",_[_.DST_ALPHA=772]="DST_ALPHA",_[_.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",_[_.CONSTANT_COLOR=32769]="CONSTANT_COLOR",_[_.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",_[_.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",_[_.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",_[_.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e.s(["EBlendingFunction",0,S,"EComponentType",0,A,"ECullingType",0,F,"EParameterType",0,w,"EShaderType",0,x,"ETextureFilterType",0,M,"ETextureFormat",0,C,"ETextureWrapMode",0,v],53628),e.i(42586);var el=e.i(96265);e.i(11307);var eh=e.i(70653);(0,U.RegisterCamera)();var eu=e.i(25882);(0,eu.RegisterFreeCamera)(),e.i(54964);var ec=e.i(976),ed=e.i(47865),ep=e.i(58720);class e_ extends ep.Texture{constructor(e,t,s,n,o,a=!0,i=!1,r=3,l=0,h,u,c,d){if(super(null,o,!a,i,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,h),this.format=n,!this._engine)return;this._engine._caps.textureFloatLinearFiltering||1!==l||(r=1),this._engine._caps.textureHalfFloatLinearFiltering||2!==l||(r=1),this._texture=this._engine.createRawTexture(e,t,s,n,a,i,r,null,l,h??0,u??!1,d),this.wrapU=ep.Texture.CLAMP_ADDRESSMODE,this.wrapV=ep.Texture.CLAMP_ADDRESSMODE,this._waitingForData=!!c&&!e}update(e){this.updateMipLevel(e,0)}updateMipLevel(e,t){this._getEngine().updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type,this._texture._useSRGBBuffer,t),this._waitingForData=!1}clone(){if(!this._texture)return super.clone();let e=new e_(null,this.getSize().width,this.getSize().height,this.format,this.getScene(),this._texture.generateMipMaps,this._invertY,this.samplingMode,this._texture.type,this._texture._creationFlags,this._useSRGBBuffer);return e._texture=this._texture,this._texture.incrementReferences(),e}isReady(){return super.isReady()&&!this._waitingForData}static CreateLuminanceTexture(e,t,s,n,o=!0,a=!1,i=3){return new e_(e,t,s,1,n,o,a,i)}static CreateLuminanceAlphaTexture(e,t,s,n,o=!0,a=!1,i=3){return new e_(e,t,s,2,n,o,a,i)}static CreateAlphaTexture(e,t,s,n,o=!0,a=!1,i=3){return new e_(e,t,s,0,n,o,a,i)}static CreateRGBTexture(e,t,s,n,o=!0,a=!1,i=3,r=0,l=0,h=!1){return new e_(e,t,s,4,n,o,a,i,r,l,h)}static CreateRGBATexture(e,t,s,n,o=!0,a=!1,i=3,r=0,l=0,h=!1,u=!1){return new e_(e,t,s,5,n,o,a,i,r,l,h,u)}static CreateRGBAStorageTexture(e,t,s,n,o=!0,a=!1,i=3,r=0,l=!1){return new e_(e,t,s,5,n,o,a,i,r,1,l)}static CreateRTexture(e,t,s,n,o=!0,a=!1,i=ep.Texture.TRILINEAR_SAMPLINGMODE,r=1){return new e_(e,t,s,6,n,o,a,i,r)}static CreateRStorageTexture(e,t,s,n,o=!0,a=!1,i=ep.Texture.TRILINEAR_SAMPLINGMODE,r=1){return new e_(e,t,s,6,n,o,a,i,r,1)}}var em=e.i(44754),ef=e.i(71265);class eg{get useTextureToStoreBoneMatrices(){return this._useTextureToStoreBoneMatrices}set useTextureToStoreBoneMatrices(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()}get animationPropertiesOverride(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}get isUsingTextureForMatrices(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones}get uniqueId(){return this._uniqueId}constructor(e,t,s){this.name=e,this.id=t,this.bones=[],this.needInitialSkinMatrix=!1,this._isDirty=!0,this._meshesWithPoseMatrix=[],this._identity=el.Matrix.Identity(),this._currentRenderId=-1,this._textureWidth=0,this._textureHeight=1,this._ranges={},this._absoluteTransformIsDirty=!0,this._canUseTextureForBones=!1,this._uniqueId=0,this._numBonesWithLinkedTransformNode=0,this._hasWaitingData=null,this._parentContainer=null,this.doNotSerialize=!1,this._useTextureToStoreBoneMatrices=!0,this._animationPropertiesOverride=null,this.onBeforeComputeObservable=new N.Observable,this.metadata=null,this.bones=[],this._scene=s||G.EngineStore.LastCreatedScene,this._uniqueId=this._scene.getUniqueId(),this._scene.addSkeleton(this),this._isDirty=!0;const n=this._scene.getEngine().getCaps();this._canUseTextureForBones=n.textureFloat&&n.maxVertexTextureImageUnits>0}getClassName(){return"Skeleton"}getChildren(){return this.bones.filter(e=>!e.getParent())}getTransformMatrices(e){if(this.needInitialSkinMatrix){if(!e)throw Error("getTransformMatrices: When using the needInitialSkinMatrix flag, a mesh must be provided");return e._bonesTransformMatrices||this.prepare(!0),e._bonesTransformMatrices}return(!this._transformMatrices||this._isDirty)&&this.prepare(!this._transformMatrices),this._transformMatrices}getTransformMatrixTexture(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture}getScene(){return this._scene}toString(e){let t=`Name: ${this.name}, nBones: ${this.bones.length}`;if(t+=`, nAnimationRanges: ${this._ranges?Object.keys(this._ranges).length:"none"}`,e){t+=", Ranges: {";let e=!0;for(let s in this._ranges)e&&(t+=", ",e=!1),t+=s;t+="}"}return t}getBoneIndexByName(e){for(let t=0,s=this.bones.length;t<s;t++)if(this.bones[t].name===e)return t;return -1}findBoneFromLinkedTransformNode(e){for(let t of this.bones)if(t._linkedTransformNode===e)return t;return null}findBoneFromLinkedTransformNodeName(e){for(let t of this.bones)if(t._linkedTransformNode&&t._linkedTransformNode.name===e)return t;return null}createAnimationRange(e,t,s){if(!this._ranges[e]){this._ranges[e]=new em.AnimationRange(e,t,s);for(let n=0,o=this.bones.length;n<o;n++)this.bones[n].animations[0]&&this.bones[n].animations[0].createRange(e,t,s)}}deleteAnimationRange(e,t=!0){for(let s=0,n=this.bones.length;s<n;s++)this.bones[s].animations[0]&&this.bones[s].animations[0].deleteRange(e,t);this._ranges[e]=null}getAnimationRange(e){return this._ranges[e]||null}getAnimationRanges(){let e,t=[];for(e in this._ranges)t.push(this._ranges[e]);return t}copyAnimationRange(e,t,s=!1){let n,o;if(this._ranges[t]||!e.getAnimationRange(t))return!1;let a=!0,i=this._getHighestAnimationFrame()+1,r={},l=e.bones;for(o=0,n=l.length;o<n;o++)r[l[o].name]=l[o];this.bones.length!==l.length&&(L.Logger.Warn(`copyAnimationRange: this rig has ${this.bones.length} bones, while source as ${l.length}`),a=!1);let h=s&&this.dimensionsAtRest&&e.dimensionsAtRest?this.dimensionsAtRest.divide(e.dimensionsAtRest):null;for(o=0,n=this.bones.length;o<n;o++){let e=this.bones[o].name,n=r[e];n?a=a&&this.bones[o].copyAnimationRange(n,t,i,s,h):(L.Logger.Warn("copyAnimationRange: not same rig, missing source bone "+e),a=!1)}let u=e.getAnimationRange(t);return u&&(this._ranges[t]=new em.AnimationRange(t,u.from+i,u.to+i)),a}returnToRest(){for(let e of this.bones)-1!==e._index&&e.returnToRest()}_getHighestAnimationFrame(){let e=0;for(let t=0,s=this.bones.length;t<s;t++)if(this.bones[t].animations[0]){let s=this.bones[t].animations[0].getHighestFrame();e<s&&(e=s)}return e}beginAnimation(e,t,s,n){let o=this.getAnimationRange(e);return o?this._scene.beginAnimation(this,o.from,o.to,t,s,n):null}static MakeAnimationAdditive(e,t=0,s){let n=e.getAnimationRange(s);if(!n)return null;let o=e._scene.getAllAnimatablesByTarget(e),a=null;for(let e=0;e<o.length;e++){let t=o[e];if(t.fromFrame===n?.from&&t.toFrame===n?.to){a=t;break}}let i=e.getAnimatables();for(let e=0;e<i.length;e++){let n=i[e].animations;if(n)for(let e=0;e<n.length;e++)(0,ec.AnimationMakeAnimationAdditive)(n[e],t,s)}return a&&(a.isAdditive=!0),e}_markAsDirty(){this._isDirty=!0,this._absoluteTransformIsDirty=!0}_registerMeshWithPoseMatrix(e){this._meshesWithPoseMatrix.push(e)}_unregisterMeshWithPoseMatrix(e){let t=this._meshesWithPoseMatrix.indexOf(e);t>-1&&this._meshesWithPoseMatrix.splice(t,1)}_computeTransformMatrices(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(let s=0;s<this.bones.length;s++){let n=this.bones[s];n._childUpdateId++;let o=n.getParent();if(o?n.getLocalMatrix().multiplyToRef(o.getFinalMatrix(),n.getFinalMatrix()):t?n.getLocalMatrix().multiplyToRef(t,n.getFinalMatrix()):n.getFinalMatrix().copyFrom(n.getLocalMatrix()),-1!==n._index){let t=null===n._index?s:n._index;n.getAbsoluteInverseBindMatrix().multiplyToArray(n.getFinalMatrix(),e,16*t)}}this._identity.copyToArray(e,16*this.bones.length)}_computeTextureSize(){let e=4*(this.bones.length+1),t=e,s=1;if(this.isUsingTextureForMatrices){let n=-4&this.getScene().getEngine().getCaps().maxTextureSize;n<t&&(t=n,s=Math.ceil(e/n))}return this._textureWidth=t,this._textureHeight=s,this._textureWidth*this._textureHeight*4}prepare(e=!1){if(!e){let e=this.getScene().getRenderId();if(this._currentRenderId===e)return;this._currentRenderId=e}if(this._numBonesWithLinkedTransformNode>0){for(let e of this.bones)if(e._linkedTransformNode){let t=e._linkedTransformNode;e.position=t.position,t.rotationQuaternion?e.rotationQuaternion=t.rotationQuaternion:e.rotation=t.rotation,e.scaling=t.scaling}}let t=null;if(this.needInitialSkinMatrix)for(let e of this._meshesWithPoseMatrix){let s=e.getPoseMatrix(),n=this._isDirty;if(null===t&&(t=this._computeTextureSize()),e._bonesTransformMatrices&&e._bonesTransformMatrices.length===t||(e._bonesTransformMatrices=new Float32Array(t),n=!0),n){if(this._synchronizedWithMesh!==e){for(let t of(this._synchronizedWithMesh=e,this.bones))t.getParent()||(t.getBindMatrix().multiplyToRef(s,el.TmpVectors.Matrix[1]),t._updateAbsoluteBindMatrices(el.TmpVectors.Matrix[1]));if(this.isUsingTextureForMatrices){let s=e._transformMatrixTexture?.getSize(),n=s?s.width*s.height*4:0;e._transformMatrixTexture&&n===t||(e._transformMatrixTexture&&e._transformMatrixTexture.dispose(),e._transformMatrixTexture=e_.CreateRGBATexture(e._bonesTransformMatrices,this._textureWidth,this._textureHeight,this._scene,!1,!1,1,1))}}this._computeTransformMatrices(e._bonesTransformMatrices,s),this.isUsingTextureForMatrices&&e._transformMatrixTexture&&e._transformMatrixTexture.update(e._bonesTransformMatrices)}}else{if(!this._isDirty)return;null===t&&(t=this._computeTextureSize()),(!this._transformMatrices||this._transformMatrices.length!==t)&&(this._transformMatrices=new Float32Array(t),this.isUsingTextureForMatrices&&(this._transformMatrixTexture&&this._transformMatrixTexture.dispose(),this._transformMatrixTexture=e_.CreateRGBATexture(this._transformMatrices,this._textureWidth,this._textureHeight,this._scene,!1,!1,1,1))),this._computeTransformMatrices(this._transformMatrices,null),this.isUsingTextureForMatrices&&this._transformMatrixTexture&&this._transformMatrixTexture.update(this._transformMatrices)}this._isDirty=!1}getAnimatables(){if(!this._animatables||this._animatables.length!==this.bones.length){this._animatables=[];for(let e=0;e<this.bones.length;e++)this._animatables.push(this.bones[e])}return this._animatables}clone(e,t){let s=new eg(e,t||e,this._scene);s.needInitialSkinMatrix=this.needInitialSkinMatrix,s.metadata=this.metadata;for(let e=0;e<this.bones.length;e++){let t=this.bones[e],n=null,o=t.getParent();if(o){let e=this.bones.indexOf(o);n=s.bones[e]}let a=new ed.Bone(t.name,s,n,t.getBindMatrix().clone(),t.getRestMatrix().clone());a._index=t._index,t._linkedTransformNode&&a.linkTransformNode(t._linkedTransformNode),ef.DeepCopier.DeepCopy(t.animations,a.animations)}if(this._ranges)for(let e in s._ranges={},this._ranges){let t=this._ranges[e];t&&(s._ranges[e]=t.clone())}return this._isDirty=!0,s.prepare(!0),s}enableBlending(e=.01){for(let t of this.bones)for(let s of t.animations)s.enableBlending=!0,s.blendingSpeed=e}dispose(){if(this._meshesWithPoseMatrix.length=0,this.metadata=null,this.getScene().stopAnimation(this),this.getScene().removeSkeleton(this),this._parentContainer){let e=this._parentContainer.skeletons.indexOf(this);e>-1&&this._parentContainer.skeletons.splice(e,1),this._parentContainer=null}this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null)}serialize(){let e={};e.name=this.name,e.id=this.id,e.uniqueId=this.uniqueId,this.dimensionsAtRest&&(e.dimensionsAtRest=this.dimensionsAtRest.asArray()),e.bones=[],e.needInitialSkinMatrix=this.needInitialSkinMatrix,this.metadata&&(e.metadata=this.metadata);for(let t=0;t<this.bones.length;t++){let s=this.bones[t],n=s.getParent(),o={parentBoneIndex:n?this.bones.indexOf(n):-1,index:s.getIndex(),name:s.name,id:s.id,uniqueId:s.uniqueId,matrix:s.getBindMatrix().asArray(),rest:s.getRestMatrix().asArray(),linkedTransformNodeId:s.getTransformNode()?.id,linkedTransformNodeUniqueId:s.getTransformNode()?.uniqueId};for(let t in e.bones.push(o),s.length&&(o.length=s.length),s.metadata&&(o.metadata=s.metadata),s.animations&&s.animations.length>0&&(o.animation=s.animations[0].serialize()),e.ranges=[],this._ranges){let s=this._ranges[t];if(!s)continue;let n={};n.name=t,n.from=s.from,n.to=s.to,e.ranges.push(n)}}return e}static Parse(e,t){let s,n=new eg(e.name,e.id,t);for(e.dimensionsAtRest&&(n.dimensionsAtRest=el.Vector3.FromArray(e.dimensionsAtRest)),n.needInitialSkinMatrix=e.needInitialSkinMatrix,e.metadata&&(n.metadata=e.metadata),s=0;s<e.bones.length;s++){let t=e.bones[s],o=e.bones[s].index,a=null;t.parentBoneIndex>-1&&(a=n.bones[t.parentBoneIndex]);let i=t.rest?el.Matrix.FromArray(t.rest):null,r=new ed.Bone(t.name,n,a,el.Matrix.FromArray(t.matrix),i,null,o);void 0!==t.id&&null!==t.id&&(r.id=t.id),t.length&&(r.length=t.length),t.metadata&&(r.metadata=t.metadata),t.animation&&r.animations.push((0,ec.AnimationParse)(t.animation)),void 0!==t.linkedTransformNodeId&&null!==t.linkedTransformNodeId&&(n._hasWaitingData=!0,r._waitingTransformNodeId=t.linkedTransformNodeId),void 0!==t.linkedTransformNodeUniqueId&&null!==t.linkedTransformNodeUniqueId&&(n._hasWaitingData=!0,r._waitingTransformNodeUniqueId=t.linkedTransformNodeUniqueId)}if(e.ranges)for(s=0;s<e.ranges.length;s++){let t=e.ranges[s];n.createAnimationRange(t.name,t.from,t.to)}return n}computeAbsoluteMatrices(e=!1){(this._absoluteTransformIsDirty||e)&&(this.bones[0].computeAbsoluteMatrices(),this._absoluteTransformIsDirty=!1)}computeAbsoluteTransforms(e=!1){this.computeAbsoluteMatrices(e)}getPoseMatrix(){let e=null;return this._meshesWithPoseMatrix.length>0&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e}sortBones(){let e=[],t=Array(this.bones.length);for(let s=0;s<this.bones.length;s++)this._sortBones(s,e,t);this.bones=e}_sortBones(e,t,s){if(s[e])return;s[e]=!0;let n=this.bones[e];if(!n)return;void 0===n._index&&(n._index=e);let o=n.getParent();o&&this._sortBones(this.bones.indexOf(o),t,s),t.push(n)}setCurrentPoseAsRest(){for(let e of this.bones)e.setCurrentPoseAsRest()}}var ey=e.i(99904),eb=e.i(23507),eT=e.i(69750);(0,eT.RegisterMultiMaterial)(),e.i(9866);var eA=e.i(23015),ex=e.i(82549);(0,ex.RegisterShaderMaterial)(),(0,ep.RegisterTexture)();var ew=e.i(21249),ev=e.i(35407);(0,ev.RegisterVertexBuffer)();var eM=e.i(4509),eC=e.i(3717);(0,P.RegisterAbstractMesh)(),e.i(35627),e.i(7509);var eF=e.i(21545),eS=e.i(10272),eE=e.i(37143),eO=e.i(71732),eN=e.i(34548),eI=e.i(77052);class eB extends eO.ShadowLight{get shadowFrustumSize(){return this._shadowFrustumSize}set shadowFrustumSize(e){this._shadowFrustumSize=e,this.forceProjectionMatrixCompute()}get shadowOrthoScale(){return this._shadowOrthoScale}set shadowOrthoScale(e){this._shadowOrthoScale=e,this.forceProjectionMatrixCompute()}get orthoLeft(){return this._orthoLeft}set orthoLeft(e){this._orthoLeft=e}get orthoRight(){return this._orthoRight}set orthoRight(e){this._orthoRight=e}get orthoTop(){return this._orthoTop}set orthoTop(e){this._orthoTop=e}get orthoBottom(){return this._orthoBottom}set orthoBottom(e){this._orthoBottom=e}constructor(e,t,s,n){super(e,s,n),this._shadowFrustumSize=0,this._shadowOrthoScale=.1,this.autoUpdateExtends=!0,this.autoCalcShadowZBounds=!1,this._orthoLeft=Number.MAX_VALUE,this._orthoRight=5e-324,this._orthoTop=5e-324,this._orthoBottom=Number.MAX_VALUE,this.position=t.scale(-1),this.direction=t}getClassName(){return"DirectionalLight"}getTypeID(){return V.Light.LIGHTTYPEID_DIRECTIONALLIGHT}_setDefaultShadowProjectionMatrix(e,t,s){this.shadowFrustumSize>0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,s)}_setDefaultFixedFrustumShadowProjectionMatrix(e){let t=this.getScene().activeCamera;el.Matrix.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t?t.minZ:0,void 0!==this.shadowMaxZ?this.shadowMaxZ:t?t.maxZ:1e4,e,this.getScene().getEngine().isNDCHalfZRange)}_setDefaultAutoExtendShadowProjectionMatrix(e,t,s){let n=this.getScene().activeCamera;if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){let e=el.Vector3.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=-Number.MAX_VALUE,this._orthoTop=-Number.MAX_VALUE,this._orthoBottom=Number.MAX_VALUE;let n=Number.MAX_VALUE,o=-Number.MAX_VALUE;for(let a=0;a<s.length;a++){let i=s[a];if(!i)continue;let r=i.getBoundingInfo().boundingBox;for(let s=0;s<r.vectorsWorld.length;s++)el.Vector3.TransformCoordinatesToRef(r.vectorsWorld[s],t,e),e.x<this._orthoLeft&&(this._orthoLeft=e.x),e.y<this._orthoBottom&&(this._orthoBottom=e.y),e.x>this._orthoRight&&(this._orthoRight=e.x),e.y>this._orthoTop&&(this._orthoTop=e.y),this.autoCalcShadowZBounds&&(e.z<n&&(n=e.z),e.z>o&&(o=e.z))}this.autoCalcShadowZBounds&&(this._shadowMinZ=n,this._shadowMaxZ=o)}let o=this._orthoRight-this._orthoLeft,a=this._orthoTop-this._orthoBottom,i=void 0!==this.shadowMinZ?this.shadowMinZ:n?.minZ||0,r=void 0!==this.shadowMaxZ?this.shadowMaxZ:n?.maxZ||1e4,l=this.getScene().getEngine().useReverseDepthBuffer;el.Matrix.OrthoOffCenterLHToRef(this._orthoLeft-o*this.shadowOrthoScale,this._orthoRight+o*this.shadowOrthoScale,this._orthoBottom-a*this.shadowOrthoScale,this._orthoTop+a*this.shadowOrthoScale,l?r:i,l?i:r,e,this.getScene().getEngine().isNDCHalfZRange)}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}transferToEffect(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t):this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this}transferToNodeMaterialEffect(e,t){return this.computeTransformedInformation()?e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z):e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),this}getDepthMinZ(e){let t=this._scene.getEngine();return!t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1}getDepthMaxZ(e){let t=this._scene.getEngine();return t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1}prepareLightSpecificDefines(e,t){e["DIRLIGHT"+t]=!0}}(0,eS.__decorate)([(0,eE.serialize)()],eB.prototype,"shadowFrustumSize",null),(0,eS.__decorate)([(0,eE.serialize)()],eB.prototype,"shadowOrthoScale",null),(0,eS.__decorate)([(0,eE.serialize)()],eB.prototype,"autoUpdateExtends",void 0),(0,eS.__decorate)([(0,eE.serialize)()],eB.prototype,"autoCalcShadowZBounds",void 0),(0,eS.__decorate)([(0,eE.serialize)("orthoLeft")],eB.prototype,"_orthoLeft",void 0),(0,eS.__decorate)([(0,eE.serialize)("orthoRight")],eB.prototype,"_orthoRight",void 0),(0,eS.__decorate)([(0,eE.serialize)("orthoTop")],eB.prototype,"_orthoTop",void 0),(0,eS.__decorate)([(0,eE.serialize)("orthoBottom")],eB.prototype,"_orthoBottom",void 0);let ek=!1;ek=!0,eN.Node.AddNodeConstructor("Light_Type_1",(e,t)=>()=>new eB(e,el.Vector3.Zero(),t)),(0,eI.RegisterClass)("BABYLON.DirectionalLight",eB);var eR=eO;class eP extends eR.ShadowLight{get shadowAngle(){return this._shadowAngle}set shadowAngle(e){this._shadowAngle=e,this.forceProjectionMatrixCompute()}get direction(){return this._direction}set direction(e){let t=this.needCube();if(this._direction=e,this.needCube()!==t&&this._shadowGenerators){let e=this._shadowGenerators.values();for(let t=e.next();!0!==t.done;t=e.next())t.value.recreateShadowMap()}}constructor(e,t,s,n){super(e,s,n),this._shadowAngle=Math.PI/2,this.position=t}getClassName(){return"PointLight"}getTypeID(){return V.Light.LIGHTTYPEID_POINTLIGHT}needCube(){return!this.direction}getShadowDirection(e){if(this.direction)return super.getShadowDirection(e);switch(e){case 0:return new el.Vector3(1,0,0);case 1:return new el.Vector3(-1,0,0);case 2:return new el.Vector3(0,-1,0);case 3:return new el.Vector3(0,1,0);case 4:return new el.Vector3(0,0,1);case 5:return new el.Vector3(0,0,-1)}return el.Vector3.Zero()}_setDefaultShadowProjectionMatrix(e,t,s){let n=this.getScene().activeCamera,o=this.getDepthMinZ(n),a=this.getDepthMaxZ(n),i=this.getScene().getEngine().useReverseDepthBuffer;el.Matrix.PerspectiveFovLHToRef(this.shadowAngle,1,i?a:o,i?o:a,e,!0,this._scene.getEngine().isNDCHalfZRange,void 0,i)}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}transferToEffect(e,t){let s=this._scene.floatingOriginOffset;return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x-s.x,this.transformedPosition.y-s.y,this.transformedPosition.z-s.z,0,t):this._uniformBuffer.updateFloat4("vLightData",this.position.x-s.x,this.position.y-s.y,this.position.z-s.z,0,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,0,0,t),this}transferToNodeMaterialEffect(e,t){let s=this._scene.floatingOriginOffset;return this.computeTransformedInformation()?e.setFloat3(t,this.transformedPosition.x-s.x,this.transformedPosition.y-s.y,this.transformedPosition.z-s.z):e.setFloat3(t,this.position.x-s.x,this.position.y-s.y,this.position.z-s.z),this}prepareLightSpecificDefines(e,t){e["POINTLIGHT"+t]=!0}}(0,eS.__decorate)([(0,eE.serialize)()],eP.prototype,"shadowAngle",null);let eL=!1;eL=!0,eN.Node.AddNodeConstructor("Light_Type_0",(e,t)=>()=>new eP(e,el.Vector3.Zero(),t)),(0,eI.RegisterClass)("BABYLON.PointLight",eP),e.i(72675);var eG=e.i(9922);class eD{static SetMatrix(e,t,s,n,o){let a=null;if("MODEL"===s.semantic?a=t.getWorldMatrix():"PROJECTION"===s.semantic?a=e.getProjectionMatrix():"VIEW"===s.semantic?a=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===s.semantic?a=el.Matrix.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===s.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===s.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===s.semantic?a=t.getWorldMatrix().invert():"VIEWINVERSE"===s.semantic?a=e.getViewMatrix().invert():"PROJECTIONINVERSE"===s.semantic?a=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===s.semantic?a=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===s.semantic?a=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===s.semantic&&(a=el.Matrix.Transpose(t.getWorldMatrix().invert())),a)switch(s.type){case w.FLOAT_MAT2:o.setMatrix2x2(n,el.Matrix.GetAsMatrix2x2(a));break;case w.FLOAT_MAT3:o.setMatrix3x3(n,el.Matrix.GetAsMatrix3x3(a));break;case w.FLOAT_MAT4:o.setMatrix(n,a)}}static SetUniform(e,t,s,n){switch(n){case w.FLOAT:return e.setFloat(t,s),!0;case w.FLOAT_VEC2:return e.setVector2(t,el.Vector2.FromArray(s)),!0;case w.FLOAT_VEC3:return e.setVector3(t,el.Vector3.FromArray(s)),!0;case w.FLOAT_VEC4:return e.setVector4(t,el.Vector4.FromArray(s)),!0;default:return!1}}static GetWrapMode(e){switch(e){case v.CLAMP_TO_EDGE:return ep.Texture.CLAMP_ADDRESSMODE;case v.MIRRORED_REPEAT:return ep.Texture.MIRROR_ADDRESSMODE;case v.REPEAT:default:return ep.Texture.WRAP_ADDRESSMODE}}static GetByteStrideFromType(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}}static GetTextureFilterMode(e){switch(e){case M.LINEAR:case M.LINEAR_MIPMAP_NEAREST:case M.LINEAR_MIPMAP_LINEAR:return ep.Texture.TRILINEAR_SAMPLINGMODE;case M.NEAREST:case M.NEAREST_MIPMAP_NEAREST:return ep.Texture.NEAREST_SAMPLINGMODE;default:return ep.Texture.BILINEAR_SAMPLINGMODE}}static GetBufferFromBufferView(e,t,s,n,o){s=t.byteOffset+s;let a=e.loadedBufferViews[t.buffer];if(s+n>a.byteLength)throw Error("Buffer access is out of range");let i=a.buffer;switch(s+=a.byteOffset,o){case A.BYTE:return new Int8Array(i,s,n);case A.UNSIGNED_BYTE:return new Uint8Array(i,s,n);case A.SHORT:return new Int16Array(i,s,n);case A.UNSIGNED_SHORT:return new Uint16Array(i,s,n);default:return new Float32Array(i,s,n)}}static GetBufferFromAccessor(e,t){let s=e.bufferViews[t.bufferView],n=t.count*eD.GetByteStrideFromType(t);return eD.GetBufferFromBufferView(e,s,t.byteOffset,n,t.componentType)}static DecodeBufferToText(e){let t="",s=e.byteLength;for(let n=0;n<s;++n)t+=String.fromCharCode(e[n]);return t}static GetDefaultMaterial(e){return eD._DefaultMaterial||(ey.Effect.ShadersStore.GLTFDefaultMaterialVertexShader="precision highp float;\n\nuniform mat4 worldView;\nuniform mat4 projection;\n\nattribute vec3 position;\n\nvoid main(void)\n{\n gl_Position = projection * worldView * vec4(position, 1.0);\n}",ey.Effect.ShadersStore.GLTFDefaultMaterialPixelShader="precision highp float;\n\nuniform vec4 u_emission;\n\nvoid main(void)\n{\n gl_FragColor = u_emission;\n}",eD._DefaultMaterial=new ex.ShaderMaterial("GLTFDefaultMaterial",e,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},{attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:[],needAlphaBlending:!1}),eD._DefaultMaterial.setColor4("u_emission",new eh.Color4(.5,.5,.5,1))),eD._DefaultMaterial}}eD._DefaultMaterial=null,e.s(["GLTFUtils",0,eD],38532);var eV=e.i(10038),eU=e.i(38118);(m=E||(E={}))[m.IDENTIFIER=1]="IDENTIFIER",m[m.UNKNOWN=2]="UNKNOWN",m[m.END_OF_INPUT=3]="END_OF_INPUT";class eK{constructor(e){this._pos=0,this.currentToken=E.UNKNOWN,this.currentIdentifier="",this.currentString="",this.isLetterOrDigitPattern=/^[a-zA-Z0-9]+$/,this._toParse=e,this._maxPos=e.length}getNextToken(){if(this.isEnd())return E.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=E.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=E.IDENTIFIER,this.currentIdentifier=this.currentString;!this.isEnd()&&(this.isLetterOrDigitPattern.test(this.currentString=this.peek())||"_"===this.currentString);)this.currentIdentifier+=this.currentString,this.forward();return this.currentToken}peek(){return this._toParse[this._pos]}read(){return this._toParse[this._pos++]}forward(){this._pos++}isEnd(){return this._pos>=this._maxPos}}let eH=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],e$=["world","view","projection","worldView","worldViewProjection","mBones"],ez=["translation","rotation","scale"],eq=["position","rotationQuaternion","scaling"],eW=(e,t,s)=>{for(let n in e){let o=e[n];s[t][n]=o}},ej=e=>{if(e)for(let t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},eY=e=>{if("NORMAL"===e.semantic)return"normal";if("POSITION"===e.semantic)return"position";if("JOINT"===e.semantic)return"matricesIndices";if("WEIGHT"===e.semantic)return"matricesWeights";if("COLOR"===e.semantic)return"color";else if(e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")){let t=Number(e.semantic.split("_")[1]);return"uv"+(0===t?"":t+1)}return null},eQ=e=>{let t;if(e.translation||e.rotation||e.scale){let s=el.Vector3.FromArray(e.scale||[1,1,1]),n=el.Quaternion.FromArray(e.rotation||[0,0,0,1]),o=el.Vector3.FromArray(e.translation||[0,0,0]);t=el.Matrix.Compose(s,n,o)}else t=el.Matrix.FromArray(e.matrix);return t},eZ=(e,t,s,n)=>{for(let e=0;e<n.bones.length;e++)if(n.bones[e].name===s)return n.bones[e];let o=e.nodes;for(let a in o){let i=o[a];if(!i.jointName)continue;let r=i.children;for(let o=0;o<r.length;o++){let l=e.nodes[r[o]];if(l.jointName&&l.jointName===s){let s=eQ(i),o=new ed.Bone(i.name||"",n,eZ(e,t,i.jointName,n),s);return o.id=a,o}}}return null},eX=(e,t)=>{for(let s=0;s<e.length;s++){let n=e[s];for(let e=0;e<n.node.children.length;e++)if(n.node.children[e]===t)return n.bone}return null},eJ=(e,t)=>{let s=e.nodes,n=s[t];if(n)return{node:n,id:t};for(let e in s)if((n=s[e]).jointName===t)return{node:n,id:e};return null},e0=(e,t)=>{for(let s=0;s<e.jointNames.length;s++)if(e.jointNames[s]===t)return!0;return!1},e1=(e,t,s,n,o)=>{let a;if(o||(e.scene._blockEntityCollection=!!e.assetContainer,(o=new k.Mesh(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,o.id=n),!t.babylonNode)return o;let i=[],r=null,l=[],h=[],u=[],c=[];for(let t=0;t<s.length;t++){let n=s[t],o=e.meshes[n];if(o)for(let t=0;t<o.primitives.length;t++){let s,n,a=new ew.VertexData,d=o.primitives[t];d.mode;let p=d.attributes;for(let t in p)if(s=e.accessors[p[t]],n=eD.GetBufferFromAccessor(e,s),"NORMAL"===t)a.normals=new Float32Array(n.length),a.normals.set(n);else if("POSITION"===t){if(er.HomogeneousCoordinates){a.positions=new Float32Array(n.length-n.length/4);for(let e=0;e<n.length;e+=4)a.positions[e]=n[e],a.positions[e+1]=n[e+1],a.positions[e+2]=n[e+2]}else a.positions=new Float32Array(n.length),a.positions.set(n);h.push(a.positions.length)}else if(-1!==t.indexOf("TEXCOORD_")){let e=Number(t.split("_")[1]),s=ev.VertexBuffer.UVKind+(0===e?"":e+1),o=new Float32Array(n.length);o.set(n),ej(o),a.set(o,s)}else"JOINT"===t?(a.matricesIndices=new Float32Array(n.length),a.matricesIndices.set(n)):"WEIGHT"===t?(a.matricesWeights=new Float32Array(n.length),a.matricesWeights.set(n)):"COLOR"===t&&(a.colors=new Float32Array(n.length),a.colors.set(n));if(s=e.accessors[d.indices])a.indices=new Int32Array((n=eD.GetBufferFromAccessor(e,s)).length),a.indices.set(n),c.push(a.indices.length);else{let e=[];for(let t=0;t<a.positions.length/3;t++)e.push(t);a.indices=new Int32Array(e),c.push(a.indices.length)}r?r.merge(a):r=a;let _=e.scene.getMaterialById(d.material);i.push(null===_?eD.GetDefaultMaterial(e.scene):_),l.push(0===l.length?0:l[l.length-1]+h[h.length-2]),u.push(0===u.length?0:u[u.length-1]+c[c.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,i.length>1?(a=new eT.MultiMaterial("multimat"+n,e.scene)).subMaterials=i:a=new eA.StandardMaterial("multimat"+n,e.scene),1===i.length&&(a=i[0]),a._parentContainer=e.assetContainer,o.material||(o.material=a),new eM.Geometry(n,e.scene,r,!1,o),o.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,o.subMeshes=[];let d=0;for(let t=0;t<s.length;t++){let n=s[t],a=e.meshes[n];if(a)for(let e=0;e<a.primitives.length;e++)a.primitives[e].mode,eC.SubMesh.AddToMesh(d,l[d],h[d],u[d],c[d],o,o,!0),d++}return o},e3=(e,t,s,n)=>{e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=s),e.scaling&&(e.scaling=n)},e2=(e,t,s,n=!1)=>{let o=e.nodes[t],a=null;if(n=!e.importOnlyMeshes||!!n||!e.importMeshesNames||-1!==e.importMeshesNames.indexOf(o.name||"")||0===e.importMeshesNames.length,!o.jointName&&n&&null!==(a=((e,t,s)=>{let n=null;if(e.importOnlyMeshes&&(t.skin||t.meshes)&&e.importMeshesNames&&e.importMeshesNames.length>0&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin){if(t.meshes){let o=e.skins[t.skin],a=e1(e,t,t.meshes,s,t.babylonNode);a.skeleton=e.scene.getLastSkeletonById(t.skin),null===a.skeleton&&(a.skeleton=((e,t,s,n)=>{if(n||(n=new eg(t.name||"","",e.scene)),!t.babylonSkeleton)return n;let o=[],a=[];((e,t,s,n)=>{for(let o in e.nodes){let a=e.nodes[o];if(!a.jointName||e0(s,a.jointName))continue;let i=eQ(a),r=new ed.Bone(a.name||"",t,null,i);r.id=o,n.push({bone:r,node:a,id:o})}for(let e=0;e<n.length;e++){let t=n[e],s=t.node.children;for(let e=0;e<s.length;e++){let o=null;for(let t=0;t<n.length;t++)if(n[t].id===s[e]){o=n[t];break}o&&(o.bone._parent=t.bone,t.bone.children.push(o.bone))}}})(e,n,t,o),n.bones=[];for(let s=0;s<t.jointNames.length;s++){let i,r=eJ(e,t.jointNames[s]);if(!r)continue;let l=r.node;if(!l){I.Tools.Warn("Joint named "+t.jointNames[s]+" does not exist");continue}let h=r.id,u=e.scene.getBoneById(h);if(u){n.bones.push(u);continue}let c=null;for(let o=0;o<s;o++){let s=eJ(e,t.jointNames[o]);if(!s)continue;let a=s.node;if(!a){I.Tools.Warn("Joint named "+t.jointNames[o]+" does not exist when looking for parent");continue}let r=a.children;if(r){i=!1;for(let s=0;s<r.length;s++)if(r[s]===h){c=eZ(e,t,t.jointNames[o],n),i=!0;break}if(i)break}}let d=eQ(l);!c&&o.length>0&&(c=eX(o,h))&&-1===a.indexOf(c)&&a.push(c),new ed.Bone(l.jointName||"",n,c,d).id=h}let i=n.bones;n.bones=[];for(let s=0;s<t.jointNames.length;s++){let o=eJ(e,t.jointNames[s]);if(o){for(let e=0;e<i.length;e++)if(i[e].id===o.id){n.bones.push(i[e]);break}}}n.prepare();for(let e=0;e<a.length;e++)n.bones.push(a[e]);return n})(e,o,0,o.babylonSkeleton),o.babylonSkeleton||(o.babylonSkeleton=a.skeleton)),n=a}}else if(t.meshes)n=e1(e,t,t.mesh?[t.mesh]:t.meshes,s,t.babylonNode);else if(!t.light||t.babylonNode||e.importOnlyMeshes){if(t.camera&&!t.babylonNode&&!e.importOnlyMeshes){let s=e.cameras[t.camera];if(s){if(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===s.type){let s=new eu.FreeCamera(t.camera,el.Vector3.Zero(),e.scene,!1);s.name=t.name||"",s.mode=U.Camera.ORTHOGRAPHIC_CAMERA,s.attachControl(),n=s,s._parentContainer=e.assetContainer}else if("perspective"===s.type){let o=s[s.type],a=new eu.FreeCamera(t.camera,el.Vector3.Zero(),e.scene,!1);a.name=t.name||"",a.attachControl(),o.aspectRatio||(o.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),o.znear&&o.zfar&&(a.maxZ=o.zfar,a.minZ=o.znear),n=a,a._parentContainer=e.assetContainer}e.scene._blockEntityCollection=!1}}}else{let s=e.lights[t.light];if(s){if("ambient"===s.type){let o=s[s.type],a=new eF.HemisphericLight(t.light,el.Vector3.Zero(),e.scene);a.name=t.name||"",o.color&&(a.diffuse=eh.Color3.FromArray(o.color)),n=a}else if("directional"===s.type){let o=s[s.type],a=new eB(t.light,el.Vector3.Zero(),e.scene);a.name=t.name||"",o.color&&(a.diffuse=eh.Color3.FromArray(o.color)),n=a}else if("point"===s.type){let o=s[s.type],a=new eP(t.light,el.Vector3.Zero(),e.scene);a.name=t.name||"",o.color&&(a.diffuse=eh.Color3.FromArray(o.color)),n=a}else if("spot"===s.type){let o=s[s.type],a=new eG.SpotLight(t.light,el.Vector3.Zero(),el.Vector3.Zero(),0,0,e.scene);a.name=t.name||"",o.color&&(a.diffuse=eh.Color3.FromArray(o.color)),o.fallOfAngle&&(a.angle=o.fallOfAngle),o.fallOffExponent&&(a.exponent=o.fallOffExponent),n=a}}}if(!t.jointName){if(t.babylonNode)return t.babylonNode;else if(null===n){e.scene._blockEntityCollection=!!e.assetContainer;let s=new k.Mesh(t.name||"",e.scene);s._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,t.babylonNode=s,n=s}}if(null!==n){if(t.matrix&&n instanceof k.Mesh){var o=n;if(t.matrix){let e=new el.Vector3(0,0,0),s=new el.Quaternion,n=new el.Vector3(0,0,0);el.Matrix.FromArray(t.matrix).decompose(n,s,e),e3(o,e,s,n)}else t.translation&&t.rotation&&t.scale&&e3(o,el.Vector3.FromArray(t.translation),el.Quaternion.FromArray(t.rotation),el.Vector3.FromArray(t.scale));o.computeWorldMatrix(!0)}else{let e=t.translation||[0,0,0],s=t.rotation||[0,0,0,1],o=t.scale||[1,1,1];e3(n,el.Vector3.FromArray(e),el.Quaternion.FromArray(s),el.Vector3.FromArray(o))}n.updateCache(!0),t.babylonNode=n}return n})(e,o,t))&&(a.id=t,a.parent=s),o.children)for(let t=0;t<o.children.length;t++)e2(e,o.children[t],a,n)},e7=e=>{let t=e.currentScene;if(t)for(let s=0;s<t.nodes.length;s++)e2(e,t.nodes[s],null);else for(let s in e.scenes){t=e.scenes[s];for(let s=0;s<t.nodes.length;s++)e2(e,t.nodes[s],null)}(e=>{for(let t in e.animations){let s=e.animations[t];if(!s.channels||!s.samplers)continue;let n=null;for(let o=0;o<s.channels.length;o++){let a,i,r=s.channels[o],l=s.samplers[r.sampler];if(!l)continue;s.parameters?(a=s.parameters[l.input],i=s.parameters[l.output]):(a=l.input,i=l.output);let h=eD.GetBufferFromAccessor(e,e.accessors[a]),u=eD.GetBufferFromAccessor(e,e.accessors[i]),c=r.target.id,d=e.scene.getNodeById(c);if(null===d&&(d=e.scene.getNodeByName(c)),null===d){I.Tools.Warn("Creating animation named "+t+". But cannot find node named "+c+" to attach to");continue}let p=d instanceof ed.Bone,_=r.target.path,m=ez.indexOf(_);-1!==m&&(_=eq[m]);let f=ec.Animation.ANIMATIONTYPE_MATRIX;p||("rotationQuaternion"===_?(f=ec.Animation.ANIMATIONTYPE_QUATERNION,d.rotationQuaternion=new el.Quaternion):f=ec.Animation.ANIMATIONTYPE_VECTOR3);let g=null,y=[],b=0,T=!1;p&&n&&n.getKeys().length===h.length&&(g=n,T=!0),T||(e.scene._blockEntityCollection=!!e.assetContainer,g=new ec.Animation(t,p?"_matrix":_,1,f,ec.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(let e=0;e<h.length;e++){let t;if("rotationQuaternion"===_?(t=el.Quaternion.FromArray([u[b],u[b+1],u[b+2],u[b+3]]),b+=4):(t=el.Vector3.FromArray([u[b],u[b+1],u[b+2]]),b+=3),p){let s=d,o=el.Vector3.Zero(),a=new el.Quaternion,i=el.Vector3.Zero(),r=s.getBaseMatrix();T&&n&&(r=n.getKeys()[e].value),r.decompose(i,a,o),"position"===_?o=t:"rotationQuaternion"===_?a=t:i=t,t=el.Matrix.Compose(i,a,o)}T?n&&(n.getKeys()[e].value=t):y.push({frame:h[e],value:t})}!T&&g&&(g.setKeys(y),d.animations.push(g)),n=g,e.scene.stopAnimation(d),e.scene.beginAnimation(d,0,h[h.length-1],!0,1)}}})(e);for(let t=0;t<e.scene.skeletons.length;t++){let s=e.scene.skeletons[t];e.scene.beginAnimation(s,0,Number.MAX_VALUE,!0,1)}},e4=(e,t,s)=>{for(let n in t.uniforms){let o=t.uniforms[n],a=t.parameters[o];if(e.currentIdentifier===n&&a.semantic&&!a.source&&!a.node){let e=eH.indexOf(a.semantic);if(-1!==e)return delete s[n],e$[e]}}return e.currentIdentifier},e5=e=>{for(let t in e.materials)e9.LoadMaterialAsync(e,t,()=>{},()=>{})};class e8{static CreateRuntime(e,t,s){let n={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:s,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null};return e.extensions&&eW(e.extensions,"extensions",n),e.extensionsUsed&&eW(e.extensionsUsed,"extensionsUsed",n),e.buffers&&((e,t)=>{for(let s in e){let n=e[s];t.buffers[s]=n,t.buffersCount++}})(e.buffers,n),e.bufferViews&&eW(e.bufferViews,"bufferViews",n),e.accessors&&eW(e.accessors,"accessors",n),e.meshes&&eW(e.meshes,"meshes",n),e.lights&&eW(e.lights,"lights",n),e.cameras&&eW(e.cameras,"cameras",n),e.nodes&&eW(e.nodes,"nodes",n),e.images&&eW(e.images,"images",n),e.textures&&eW(e.textures,"textures",n),e.shaders&&((e,t)=>{for(let s in e){let n=e[s];t.shaders[s]=n,t.shaderscount++}})(e.shaders,n),e.programs&&eW(e.programs,"programs",n),e.samplers&&eW(e.samplers,"samplers",n),e.techniques&&eW(e.techniques,"techniques",n),e.materials&&eW(e.materials,"materials",n),e.animations&&eW(e.animations,"animations",n),e.skins&&eW(e.skins,"skins",n),e.scenes&&(n.scenes=e.scenes),e.scene&&e.scenes&&(n.currentScene=e.scenes[e.scene]),n}static LoadBufferAsync(e,t,s,n,o){let a=e.buffers[t];I.Tools.IsBase64(a.uri)?setTimeout(()=>s(new Uint8Array(I.Tools.DecodeBase64(a.uri)))):I.Tools.LoadFile(e.rootUrl+a.uri,e=>s(new Uint8Array(e)),o,void 0,!0,e=>{e&&n(e.status+" "+e.statusText)})}static LoadTextureBufferAsync(e,t,s,n){let o=e.textures[t];if(!o||!o.source)return void n("");if(o.babylonTexture)return void s(null);let a=e.images[o.source];I.Tools.IsBase64(a.uri)?setTimeout(()=>s(new Uint8Array(I.Tools.DecodeBase64(a.uri)))):I.Tools.LoadFile(e.rootUrl+a.uri,e=>s(new Uint8Array(e)),void 0,void 0,!0,e=>{e&&n(e.status+" "+e.statusText)})}static CreateTextureAsync(e,t,s,n){let o=e.textures[t];if(o.babylonTexture)return void n(o.babylonTexture);let a=e.samplers[o.sampler],i=a.minFilter===M.NEAREST_MIPMAP_NEAREST||a.minFilter===M.NEAREST_MIPMAP_LINEAR||a.minFilter===M.LINEAR_MIPMAP_NEAREST||a.minFilter===M.LINEAR_MIPMAP_LINEAR,r=ep.Texture.BILINEAR_SAMPLINGMODE,l=null==s?new Blob:new Blob([(0,eU.GetBlobBufferSource)(s)]),h=URL.createObjectURL(l),u=()=>URL.revokeObjectURL(h),c=new ep.Texture(h,e.scene,!i,!0,r,u,u);void 0!==a.wrapS&&(c.wrapU=eD.GetWrapMode(a.wrapS)),void 0!==a.wrapT&&(c.wrapV=eD.GetWrapMode(a.wrapT)),c.name=t,o.babylonTexture=c,n(c)}static LoadShaderStringAsync(e,t,s,n){let o=e.shaders[t];if(I.Tools.IsBase64(o.uri)){let e=atob(o.uri.split(",")[1]);s&&s(e)}else I.Tools.LoadFile(e.rootUrl+o.uri,s,void 0,void 0,!1,e=>{e&&n&&n(e.status+" "+e.statusText)})}static LoadMaterialAsync(e,t,s,n){let o=e.materials[t];if(!o.technique){n&&n("No technique found.");return}let a=e.techniques[o.technique];if(!a){e.scene._blockEntityCollection=!!e.assetContainer;let n=new eA.StandardMaterial(t,e.scene);n._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,n.diffuseColor=new eh.Color3(.5,.5,.5),n.sideOrientation=eb.Material.CounterClockWiseSideOrientation,s(n);return}let i=e.programs[a.program],r=a.states,l=ey.Effect.ShadersStore[i.vertexShader+"VertexShader"],h=ey.Effect.ShadersStore[i.fragmentShader+"PixelShader"],u="",c="",d=new eK(l),p=new eK(h),_={},m=[],f=[],g=[];for(let e in a.uniforms){let t=a.uniforms[e],s=a.parameters[t];if(_[e]=s,!s.semantic||s.node||s.source)s.type===w.SAMPLER_2D?g.push(e):m.push(e);else{let t=eH.indexOf(s.semantic);-1!==t?(m.push(e$[t]),delete _[e]):m.push(e)}}for(let e in a.attributes){let t=a.attributes[e],s=a.parameters[t];if(s.semantic){let e=eY(s);e&&f.push(e)}}for(;!d.isEnd()&&d.getNextToken();){if(d.currentToken!==E.IDENTIFIER){u+=d.currentString;continue}let e=!1;for(let t in a.attributes){let s=a.attributes[t],n=a.parameters[s];if(d.currentIdentifier===t&&n.semantic){u+=eY(n),e=!0;break}}e||(u+=e4(d,a,_))}for(;!p.isEnd()&&p.getNextToken();){if(p.currentToken!==E.IDENTIFIER){c+=p.currentString;continue}c+=e4(p,a,_)}let y={vertex:i.vertexShader+t,fragment:i.fragmentShader+t},b={attributes:f,uniforms:m,samplers:g,needAlphaBlending:r&&r.enable&&-1!==r.enable.indexOf(3042)};ey.Effect.ShadersStore[i.vertexShader+t+"VertexShader"]=u,ey.Effect.ShadersStore[i.fragmentShader+t+"PixelShader"]=c;let T=new ex.ShaderMaterial(t,e.scene,y,b);if(T.onError=(e,t)=>{T.dispose(!0),n("Cannot compile program named "+i.name+". Error: "+t+". Default material will be applied")},T.onCompiled=t=>{((e,t,s,n,o)=>{let a=n.values||s.parameters,i=s.uniforms;for(let s in o){let r=o[s],l=r.type,h=a[i[s]];if(void 0===h&&(h=r.value),!h)continue;let u=e=>s=>{r.value&&e&&(t.setTexture(e,s),delete o[e])};l===w.SAMPLER_2D?e9.LoadTextureAsync(e,n.values?h:r.value,u(s),()=>u(null)):r.value&&eD.SetUniform(t,s,n.values?h:r.value,l)&&delete o[s]}})(e,T,a,o,_),T.onBind=t=>{((e,t,s,n,o,a,i)=>{let r=a.values||o.parameters;for(let i in s){let l=s[i],h=l.type;if(h===w.FLOAT_MAT2||h===w.FLOAT_MAT3||h===w.FLOAT_MAT4)if(!l.semantic||l.source||l.node){if(l.semantic&&(l.source||l.node)){let e=t.scene.getNodeByName(l.source||l.node||"");if(null===e&&(e=t.scene.getNodeById(l.source||l.node||"")),null===e)continue;eD.SetMatrix(t.scene,e,l,i,n.getEffect())}}else eD.SetMatrix(t.scene,e,l,i,n.getEffect());else{let e=r[o.uniforms[i]];if(!e)continue;if(h===w.SAMPLER_2D){let s=t.textures[a.values?e:l.value].babylonTexture;if(null==s)continue;n.getEffect().setTexture(i,s)}else eD.SetUniform(n.getEffect(),i,e,h)}}i(n)})(t,e,_,T,a,o,s)}},T.sideOrientation=eb.Material.CounterClockWiseSideOrientation,r&&r.functions){let e=r.functions;e.cullFace&&e.cullFace[0]!==F.BACK&&(T.backFaceCulling=!1);let t=e.blendFuncSeparate;t&&(t[0]===S.SRC_ALPHA&&t[1]===S.ONE_MINUS_SRC_ALPHA&&t[2]===S.ONE&&t[3]===S.ONE?T.alphaMode=eV.Constants.ALPHA_COMBINE:t[0]===S.ONE&&t[1]===S.ONE&&t[2]===S.ZERO&&t[3]===S.ONE?T.alphaMode=eV.Constants.ALPHA_ONEONE:t[0]===S.SRC_ALPHA&&t[1]===S.ONE&&t[2]===S.ZERO&&t[3]===S.ONE?T.alphaMode=eV.Constants.ALPHA_ADD:t[0]===S.ZERO&&t[1]===S.ONE_MINUS_SRC_COLOR&&t[2]===S.ONE&&t[3]===S.ONE?T.alphaMode=eV.Constants.ALPHA_SUBTRACT:t[0]===S.DST_COLOR&&t[1]===S.ZERO&&t[2]===S.ONE&&t[3]===S.ONE?T.alphaMode=eV.Constants.ALPHA_MULTIPLY:t[0]===S.SRC_ALPHA&&t[1]===S.ONE_MINUS_SRC_COLOR&&t[2]===S.ONE&&t[3]===S.ONE&&(T.alphaMode=eV.Constants.ALPHA_MAXIMIZED))}}}class e6{static RegisterExtension(e){e6.Extensions[e.name]?I.Tools.Error('Tool with the same name "'+e.name+'" already exists'):e6.Extensions[e.name]=e}dispose(){}_importMeshAsync(e,t,s,n,o,a,i,r){return t.useRightHandedSystem=!0,e9.LoadRuntimeAsync(t,s,n,t=>{t.assetContainer=o,t.importOnlyMeshes=!0,""===e?t.importMeshesNames=[]:"string"==typeof e?t.importMeshesNames=[e]:!e||e instanceof Array?(t.importMeshesNames=[],I.Tools.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[e],this._createNodes(t);let s=[],n=[];for(let e in t.nodes){let n=t.nodes[e];n.babylonNode instanceof P.AbstractMesh&&s.push(n.babylonNode)}for(let e in t.skins){let s=t.skins[e];s.babylonSkeleton instanceof eg&&n.push(s.babylonSkeleton)}this._loadBuffersAsync(t,()=>{this._loadShadersAsync(t,()=>{e5(t),e7(t),!er.IncrementalLoading&&a&&a(s,n)})}),er.IncrementalLoading&&a&&a(s,n)},r),!0}importMeshAsync(e,t,s,n,o,a){return new Promise((i,r)=>{this._importMeshAsync(e,t,n,o,s,(e,t)=>{i({meshes:e,particleSystems:[],skeletons:t,animationGroups:[],lights:[],transformNodes:[],geometries:[],spriteManagers:[]})},a,e=>{r(Error(e))})})}_loadAsync(e,t,s,n,o,a){e.useRightHandedSystem=!0,e9.LoadRuntimeAsync(e,t,s,e=>{e9.LoadRuntimeExtensionsAsync(e,()=>{this._createNodes(e),this._loadBuffersAsync(e,()=>{this._loadShadersAsync(e,()=>{e5(e),e7(e),er.IncrementalLoading||n()})}),er.IncrementalLoading&&n()},a)},a)}async loadAsync(e,t,s,n){return await new Promise((o,a)=>{this._loadAsync(e,t,s,()=>{o()},n,e=>{a(Error(e))})})}_loadShadersAsync(e,t){let s=!1,n=(s,n)=>{e9.LoadShaderStringAsync(e,s,o=>{o instanceof ArrayBuffer||(e.loadedShaderCount++,o&&(ey.Effect.ShadersStore[s+(n.type===x.VERTEX?"VertexShader":"PixelShader")]=o),e.loadedShaderCount===e.shaderscount&&t())},()=>{I.Tools.Error("Error when loading shader program named "+s+" located at "+n.uri)})};for(let t in e.shaders){s=!0;let o=e.shaders[t];o?n.bind(this,t,o)():I.Tools.Error("No shader named: "+t)}s||t()}_loadBuffersAsync(e,t){let s=!1,n=(s,n)=>{e9.LoadBufferAsync(e,s,o=>{e.loadedBufferCount++,o&&(o.byteLength!=e.buffers[s].byteLength&&I.Tools.Error("Buffer named "+s+" is length "+o.byteLength+". Expected: "+n.byteLength),e.loadedBufferViews[s]=o),e.loadedBufferCount===e.buffersCount&&t()},()=>{I.Tools.Error("Error when loading buffer named "+s+" located at "+n.uri)})};for(let t in e.buffers){s=!0;let o=e.buffers[t];o?n.bind(this,t,o)():I.Tools.Error("No buffer named: "+t)}s||t()}_createNodes(e){let t=e.currentScene;if(t)for(let s=0;s<t.nodes.length;s++)e2(e,t.nodes[s],null);else for(let s in e.scenes){t=e.scenes[s];for(let s=0;s<t.nodes.length;s++)e2(e,t.nodes[s],null)}}}e6.Extensions={};class e9{constructor(e){this._name=e}get name(){return this._name}loadRuntimeAsync(e,t,s,n,o){return!1}loadRuntimeExtensionsAsync(e,t,s){return!1}loadBufferAsync(e,t,s,n,o){return!1}loadTextureBufferAsync(e,t,s,n){return!1}createTextureAsync(e,t,s,n,o){return!1}loadShaderStringAsync(e,t,s,n){return!1}loadMaterialAsync(e,t,s,n){return!1}static LoadRuntimeAsync(e,t,s,n,o){e9._ApplyExtensions(a=>a.loadRuntimeAsync(e,t,s,n,o),()=>{setTimeout(()=>{n&&n(e8.CreateRuntime(t.json,e,s))})})}static LoadRuntimeExtensionsAsync(e,t,s){e9._ApplyExtensions(n=>n.loadRuntimeExtensionsAsync(e,t,s),()=>{setTimeout(()=>{t()})})}static LoadBufferAsync(e,t,s,n,o){e9._ApplyExtensions(a=>a.loadBufferAsync(e,t,s,n,o),()=>{e8.LoadBufferAsync(e,t,s,n,o)})}static LoadTextureAsync(e,t,s,n){e9._LoadTextureBufferAsync(e,t,o=>{o&&e9._CreateTextureAsync(e,t,o,s,n)},n)}static LoadShaderStringAsync(e,t,s,n){e9._ApplyExtensions(o=>o.loadShaderStringAsync(e,t,s,n),()=>{e8.LoadShaderStringAsync(e,t,s,n)})}static LoadMaterialAsync(e,t,s,n){e9._ApplyExtensions(o=>o.loadMaterialAsync(e,t,s,n),()=>{e8.LoadMaterialAsync(e,t,s,n)})}static _LoadTextureBufferAsync(e,t,s,n){e9._ApplyExtensions(o=>o.loadTextureBufferAsync(e,t,s,n),()=>{e8.LoadTextureBufferAsync(e,t,s,n)})}static _CreateTextureAsync(e,t,s,n,o){e9._ApplyExtensions(a=>a.createTextureAsync(e,t,s,n,o),()=>{e8.CreateTextureAsync(e,t,s,n)})}static _ApplyExtensions(e,t){for(let t in e6.Extensions)if(e(e6.Extensions[t]))return;t()}}er._CreateGLTF1Loader=()=>new e6,e.s(["GLTFLoader",0,e6,"GLTFLoaderBase",0,e8,"GLTFLoaderExtension",0,e9],55235);class te extends e9{constructor(){super("KHR_binary_glTF")}loadRuntimeAsync(e,t,s,n){let o=t.json.extensionsUsed;return!!o&&-1!==o.indexOf(this.name)&&!!t.bin&&(this._bin=t.bin,n(e8.CreateRuntime(t.json,e,s)),!0)}loadBufferAsync(e,t,s,n){return -1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(s,e=>n(e.message)),!0)}loadTextureBufferAsync(e,t,s){let n=e.textures[t],o=e.images[n.source];if(!o.extensions||!(this.name in o.extensions))return!1;let a=o.extensions[this.name],i=e.bufferViews[a.bufferView];return s(eD.GetBufferFromBufferView(e,i,0,i.byteLength,A.UNSIGNED_BYTE)),!0}loadShaderStringAsync(e,t,s){let n=e.shaders[t];if(!n.extensions||!(this.name in n.extensions))return!1;let o=n.extensions[this.name],a=e.bufferViews[o.bufferView],i=eD.GetBufferFromBufferView(e,a,0,a.byteLength,A.UNSIGNED_BYTE);return setTimeout(()=>{s(eD.DecodeBufferToText(i))}),!0}}e6.RegisterExtension(new te),e.s(["GLTFBinaryExtension",0,te],45179);class tt extends e9{constructor(){super("KHR_materials_common")}loadRuntimeExtensionsAsync(e){if(!e.extensions)return!1;let t=e.extensions[this.name];if(!t)return!1;let s=t.lights;if(s)for(let t in s){let n=s[t];switch(n.type){case"ambient":{let t=new eF.HemisphericLight(n.name,new el.Vector3(0,1,0),e.scene),s=n.ambient;s&&(t.diffuse=eh.Color3.FromArray(s.color||[1,1,1]));break}case"point":{let t=new eP(n.name,new el.Vector3(10,10,10),e.scene),s=n.point;s&&(t.diffuse=eh.Color3.FromArray(s.color||[1,1,1]));break}case"directional":{let t=new eB(n.name,new el.Vector3(0,-1,0),e.scene),s=n.directional;s&&(t.diffuse=eh.Color3.FromArray(s.color||[1,1,1]));break}case"spot":{let t=n.spot;t&&(new eG.SpotLight(n.name,new el.Vector3(0,10,0),new el.Vector3(0,-1,0),t.fallOffAngle||Math.PI,t.fallOffExponent||0,e.scene).diffuse=eh.Color3.FromArray(t.color||[1,1,1]));break}default:I.Tools.Warn('GLTF Material Common extension: light type "'+n.type+"” not supported")}}return!1}loadMaterialAsync(e,t,s,n){let o=e.materials[t];if(!o||!o.extensions)return!1;let a=o.extensions[this.name];if(!a)return!1;let i=new eA.StandardMaterial(t,e.scene);return i.sideOrientation=eb.Material.CounterClockWiseSideOrientation,"CONSTANT"===a.technique&&(i.disableLighting=!0),i.backFaceCulling=void 0!==a.doubleSided&&!a.doubleSided,i.alpha=void 0===a.values.transparency?1:a.values.transparency,i.specularPower=void 0===a.values.shininess?0:a.values.shininess,"string"==typeof a.values.ambient?this._loadTexture(e,a.values.ambient,i,"ambientTexture",n):i.ambientColor=eh.Color3.FromArray(a.values.ambient||[0,0,0]),"string"==typeof a.values.diffuse?this._loadTexture(e,a.values.diffuse,i,"diffuseTexture",n):i.diffuseColor=eh.Color3.FromArray(a.values.diffuse||[0,0,0]),"string"==typeof a.values.emission?this._loadTexture(e,a.values.emission,i,"emissiveTexture",n):i.emissiveColor=eh.Color3.FromArray(a.values.emission||[0,0,0]),"string"==typeof a.values.specular?this._loadTexture(e,a.values.specular,i,"specularTexture",n):i.specularColor=eh.Color3.FromArray(a.values.specular||[0,0,0]),!0}_loadTexture(e,t,s,n,o){e8.LoadTextureBufferAsync(e,t,o=>{e8.CreateTextureAsync(e,t,o,e=>s[n]=e)},o)}}e6.RegisterExtension(new tt),e.s(["GLTFMaterialsCommonExtension",0,tt],45509),e.s([],3703),e.i(3703),e.i(45179),e.i(55235),e.i(53628),e.i(38532),e.i(45509),e.s(["EBlendingFunction",0,S,"EComponentType",0,A,"ECullingType",0,F,"EParameterType",0,w,"EShaderType",0,x,"ETextureFilterType",0,M,"ETextureFormat",0,C,"ETextureWrapMode",0,v,"GLTFBinaryExtension",0,te,"GLTFLoader",0,e6,"GLTFLoaderBase",0,e8,"GLTFLoaderExtension",0,e9,"GLTFMaterialsCommonExtension",0,tt,"GLTFUtils",0,eD],70217);var ts=e.i(70217);class tn{get resolve(){return this._resolve}get reject(){return this._reject}constructor(){this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}}(0,R.RegisterTransformNode)();var to=e.i(80871);class ta{get influence(){return this._influence}set influence(e){if(this._influence===e)return;let t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers()&&this.onInfluenceChanged.notifyObservers(0===t||0===e)}get animationPropertiesOverride(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride}set animationPropertiesOverride(e){this._animationPropertiesOverride=e}constructor(e,t=0,s=null,n=null){this.name=e,this.animations=[],this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this._uv2s=null,this._colors=null,this._uniqueId=0,this.onInfluenceChanged=new N.Observable,this._onDataLayoutChanged=new N.Observable,this.morphTargetManager=null,this._animationPropertiesOverride=null,this.id=e,this.morphTargetManager=n,this._scene=s||G.EngineStore.LastCreatedScene,this.influence=t,this._scene&&(this._uniqueId=this._scene.getUniqueId())}get uniqueId(){return this._uniqueId}get hasPositions(){return!!this._positions}get hasNormals(){return!!this._normals}get hasTangents(){return!!this._tangents}get hasUVs(){return!!this._uvs}get hasUV2s(){return!!this._uv2s}get hasColors(){return!!this._colors}get vertexCount(){return this._positions?this._positions.length/3:this._normals?this._normals.length/3:this._tangents?this._tangents.length/3:this._uvs?this._uvs.length/2:this._uv2s?this._uv2s.length/2:this._colors?this._colors.length/4:0}setPositions(e){let t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)}getPositions(){return this._positions}setNormals(e){let t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)}getNormals(){return this._normals}setTangents(e){let t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)}getTangents(){return this._tangents}setUVs(e){let t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)}getUVs(){return this._uvs}setUV2s(e){let t=this.hasUV2s;this._uv2s=e,t!==this.hasUV2s&&this._onDataLayoutChanged.notifyObservers(void 0)}getUV2s(){return this._uv2s}setColors(e){let t=this.hasColors;this._colors=e,t!==this.hasColors&&this._onDataLayoutChanged.notifyObservers(void 0)}getColors(){return this._colors}clone(){let e=to.SerializationHelper.Clone(()=>new ta(this.name,this.influence,this._scene,this.morphTargetManager),this);return e._positions=this._positions,e._normals=this._normals,e._tangents=this._tangents,e._uvs=this._uvs,e._uv2s=this._uv2s,e._colors=this._colors,e}serialize(){let e={};return e.name=this.name,e.influence=this.influence,null!=this.id&&(e.id=this.id),e.uniqueId=this.uniqueId,e.positions=Array.prototype.slice.call(this.getPositions()),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),this.hasUV2s&&(e.uv2s=Array.prototype.slice.call(this.getUV2s())),this.hasColors&&(e.colors=Array.prototype.slice.call(this.getColors())),to.SerializationHelper.AppendSerializedAnimations(this,e),e}getClassName(){return"MorphTarget"}static Parse(e,t,s=null){let n=new ta(e.name,e.influence,t,s);if(n.setPositions(e.positions),null!=e.id&&(n.id=e.id),e.normals&&n.setNormals(e.normals),e.tangents&&n.setTangents(e.tangents),e.uvs&&n.setUVs(e.uvs),e.uv2s&&n.setUV2s(e.uv2s),e.colors&&n.setColors(e.colors),e.animations){for(let t=0;t<e.animations.length;t++){let s=e.animations[t],o=(0,eI.GetClass)("BABYLON.Animation");o&&n.animations.push(o.Parse(s))}e.autoAnimate&&t&&t.beginAnimation(n,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1)}return n}static FromMesh(e,t,s){t||(t=e.name);let n=new ta(t,s,e.getScene(),e.morphTargetManager);return n.setPositions(e.getVerticesData(ev.VertexBuffer.PositionKind)),e.isVerticesDataPresent(ev.VertexBuffer.NormalKind)&&n.setNormals(e.getVerticesData(ev.VertexBuffer.NormalKind)),e.isVerticesDataPresent(ev.VertexBuffer.TangentKind)&&n.setTangents(e.getVerticesData(ev.VertexBuffer.TangentKind)),e.isVerticesDataPresent(ev.VertexBuffer.UVKind)&&n.setUVs(e.getVerticesData(ev.VertexBuffer.UVKind)),e.isVerticesDataPresent(ev.VertexBuffer.UV2Kind)&&n.setUV2s(e.getVerticesData(ev.VertexBuffer.UV2Kind)),e.isVerticesDataPresent(ev.VertexBuffer.ColorKind)&&n.setColors(e.getVerticesData(ev.VertexBuffer.ColorKind)),n}}(0,eS.__decorate)([(0,eE.serialize)()],ta.prototype,"id",void 0),(0,eS.__decorate)([(0,eE.serialize)()],ta.prototype,"morphTargetManager",void 0);var ti=e.i(45707),tr=ep;class tl extends tr.Texture{get depth(){return this._depth}constructor(e,t,s,n,o,a,i=!0,r=!1,l=tr.Texture.TRILINEAR_SAMPLINGMODE,h=0,u,c){super(null,a,!i,r),this.format=o,this._texture=a.getEngine().createRawTexture2DArray(e,t,s,n,o,i,r,l,null,h,u??0,c),this._depth=n,this.is2DArray=!0}update(e){this.updateMipLevel(e,0)}updateMipLevel(e,t){this._texture&&this._getEngine().updateRawTexture2DArray(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type,t)}static CreateRGBATexture(e,t,s,n,o,a=!0,i=!1,r=3,l=0){return new tl(e,t,s,n,5,o,a,i,r,l)}}class th{set areUpdatesFrozen(e){e?this._blockCounter++:(this._blockCounter--,this._blockCounter<=0&&(this._blockCounter=0,this._syncActiveTargets(this._forceUpdateWhenUnfrozen),this._forceUpdateWhenUnfrozen=!1))}get areUpdatesFrozen(){return this._blockCounter>0}constructor(e=null,t){if(this.meshName=t,this._targets=[],this._targetInfluenceChangedObservers=[],this._targetDataLayoutChangedObservers=[],this._activeTargets=new ti.SmartArray(16),this._supportsPositions=!1,this._supportsNormals=!1,this._supportsTangents=!1,this._supportsUVs=!1,this._supportsUV2s=!1,this._supportsColors=!1,this._vertexCount=0,this._uniqueId=0,this._tempInfluences=[],this._canUseTextureForTargets=!1,this._blockCounter=0,this._mustSynchronize=!0,this._forceUpdateWhenUnfrozen=!1,this._textureVertexStride=0,this._textureWidth=0,this._textureHeight=1,this._parentContainer=null,this.optimizeInfluencers=!0,this.enablePositionMorphing=!0,this.enableNormalMorphing=!0,this.enableTangentMorphing=!0,this.enableUVMorphing=!0,this.enableUV2Morphing=!0,this.enableColorMorphing=!0,this._numMaxInfluencers=0,this._useTextureToStoreTargets=!0,this.metadata=null,this._influencesAreDirty=!1,this._needUpdateInfluences=!1,e||(e=G.EngineStore.LastCreatedScene),this._scene=e,this._scene){this._scene.addMorphTargetManager(this),this._uniqueId=this._scene.getUniqueId();const e=this._scene.getEngine().getCaps();this._canUseTextureForTargets=e.canUseGLVertexID&&e.textureFloat&&e.maxVertexTextureImageUnits>0&&e.texture2DArrayMaxLayerCount>1}}get numMaxInfluencers(){return th.ConstantTargetCountForTextureMode>0&&this.isUsingTextureForTargets?th.ConstantTargetCountForTextureMode:this._numMaxInfluencers}set numMaxInfluencers(e){this._numMaxInfluencers!==e&&(this._numMaxInfluencers=e,this._mustSynchronize=!0,this._syncActiveTargets())}get uniqueId(){return this._uniqueId}get vertexCount(){return this._vertexCount}get supportsPositions(){return this._supportsPositions&&this.enablePositionMorphing}get supportsNormals(){return this._supportsNormals&&this.enableNormalMorphing}get supportsTangents(){return this._supportsTangents&&this.enableTangentMorphing}get supportsUVs(){return this._supportsUVs&&this.enableUVMorphing}get supportsUV2s(){return this._supportsUV2s&&this.enableUV2Morphing}get supportsColors(){return this._supportsColors&&this.enableColorMorphing}get hasPositions(){return this._supportsPositions}get hasNormals(){return this._supportsNormals}get hasTangents(){return this._supportsTangents}get hasUVs(){return this._supportsUVs}get hasUV2s(){return this._supportsUV2s}get hasColors(){return this._supportsColors}get numTargets(){return this._targets.length}get numInfluencers(){return this._influencesAreDirty&&this._syncActiveTargets(),this._activeTargets.length}get influences(){return this._influencesAreDirty&&this._syncActiveTargets(),this._influences}get useTextureToStoreTargets(){return this._useTextureToStoreTargets}set useTextureToStoreTargets(e){this._useTextureToStoreTargets!==e&&(this._useTextureToStoreTargets=e,this._mustSynchronize=!0,this._syncActiveTargets())}get isUsingTextureForTargets(){return th.EnableTextureStorage&&this.useTextureToStoreTargets&&this._canUseTextureForTargets&&!this._scene?.getEngine().getCaps().disableMorphTargetTexture}getActiveTarget(e){return this._influencesAreDirty&&this._syncActiveTargets(),this._activeTargets.data[e]}getTarget(e){return this._targets[e]}getTargetByName(e){for(let t of this._targets)if(t.name===e)return t;return null}addTarget(e){this._targets.push(e),this._targetInfluenceChangedObservers.push(e.onInfluenceChanged.add(e=>{this.areUpdatesFrozen&&e&&(this._forceUpdateWhenUnfrozen=!0),this._influencesAreDirty=!0,this._needUpdateInfluences=this._needUpdateInfluences||e})),this._targetDataLayoutChangedObservers.push(e._onDataLayoutChanged.add(()=>{this._mustSynchronize=!0,this._syncActiveTargets()})),this._mustSynchronize=!0,this._syncActiveTargets()}removeTarget(e){let t=this._targets.indexOf(e);t>=0&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._mustSynchronize=!0,this._syncActiveTargets()),this._scene&&this._scene.stopAnimation(e)}_bind(e){this._influencesAreDirty&&this._syncActiveTargets(),e.setFloat3("morphTargetTextureInfo",this._textureVertexStride,this._textureWidth,this._textureHeight),e.setFloatArray("morphTargetTextureIndices",this._morphTargetTextureIndices),e.setTexture("morphTargets",this._targetStoreTexture),e.setFloat("morphTargetCount",this.numInfluencers)}clone(){let e=new th(this._scene);for(let t of(e.areUpdatesFrozen=!0,this._targets))e.addTarget(t.clone());return e.areUpdatesFrozen=!1,e.enablePositionMorphing=this.enablePositionMorphing,e.enableNormalMorphing=this.enableNormalMorphing,e.enableTangentMorphing=this.enableTangentMorphing,e.enableUVMorphing=this.enableUVMorphing,e.enableUV2Morphing=this.enableUV2Morphing,e.enableColorMorphing=this.enableColorMorphing,e.metadata=this.metadata,e}serialize(){let e={};for(let t of(e.id=this.uniqueId,e.meshName=this.meshName,e.targets=[],this._targets))e.targets.push(t.serialize());return this.metadata&&(e.metadata=this.metadata),e}_syncActiveTargets(e=!1){if(this.areUpdatesFrozen)return;e=e||this._needUpdateInfluences,this._needUpdateInfluences=!1,this._influencesAreDirty=!1;let t=!!this._targetStoreTexture,s=this.isUsingTextureForTargets;(this._mustSynchronize||t!==s)&&(this._mustSynchronize=!1,this.synchronize());let n=0;this._activeTargets.reset(),this._morphTargetTextureIndices&&this._morphTargetTextureIndices.length===this._targets.length||(this._morphTargetTextureIndices=new Float32Array(this._targets.length));let o=-1;for(let e of this._targets)if(o++,0!==e.influence||!this.optimizeInfluencers){if(this._activeTargets.length>=th.MaxActiveMorphTargetsInVertexAttributeMode&&!this.isUsingTextureForTargets)break;this._activeTargets.push(e),this._morphTargetTextureIndices[n]=o,this._tempInfluences[n++]=e.influence}this._morphTargetTextureIndices.length!==n&&(this._morphTargetTextureIndices=this._morphTargetTextureIndices.slice(0,n)),this._influences&&this._influences.length===n||(this._influences=new Float32Array(n));for(let e=0;e<n;e++)this._influences[e]=this._tempInfluences[e];if(e&&this._scene)for(let e of this._scene.meshes)e.morphTargetManager===this&&(s?e._markSubMeshesAsAttributesDirty():e._syncGeometryWithMorphTargetManager())}synchronize(){if(!this._scene||this.areUpdatesFrozen)return;let e=this._scene.getEngine();for(let t of(this._supportsPositions=!0,this._supportsNormals=!0,this._supportsTangents=!0,this._supportsUVs=!0,this._supportsUV2s=!0,this._supportsColors=!0,this._vertexCount=0,this._targetStoreTexture?.dispose(),this._targetStoreTexture=null,this.isUsingTextureForTargets&&this._targets.length>e.getCaps().texture2DArrayMaxLayerCount&&(this.useTextureToStoreTargets=!1),this._targets)){this._supportsPositions=this._supportsPositions&&t.hasPositions,this._supportsNormals=this._supportsNormals&&t.hasNormals,this._supportsTangents=this._supportsTangents&&t.hasTangents,this._supportsUVs=this._supportsUVs&&t.hasUVs,this._supportsUV2s=this._supportsUV2s&&t.hasUV2s,this._supportsColors=this._supportsColors&&t.hasColors;let e=t.vertexCount;if(0===this._vertexCount)this._vertexCount=e;else if(this._vertexCount!==e)return void L.Logger.Error(`Incompatible target. Targets must all have the same vertices count. Current vertex count: ${this._vertexCount}, vertex count for target "${t.name}": ${e}`)}if(this.isUsingTextureForTargets){let t;this._textureVertexStride=0,this._supportsPositions&&this._textureVertexStride++,this._supportsNormals&&this._textureVertexStride++,this._supportsTangents&&this._textureVertexStride++,this._supportsUVs&&this._textureVertexStride++,this._supportsUV2s&&this._textureVertexStride++,this._supportsColors&&this._textureVertexStride++,this._textureWidth=this._vertexCount*this._textureVertexStride||1,this._textureHeight=1;let s=e.getCaps().maxTextureSize;this._textureWidth>s&&(this._textureHeight=Math.ceil(this._textureWidth/s),this._textureWidth=s);let n=this._targets.length,o=new Float32Array(n*this._textureWidth*this._textureHeight*4);for(let e=0;e<n;e++){let s=this._targets[e],n=s.getPositions(),a=s.getNormals(),i=s.getUVs(),r=s.getTangents(),l=s.getUV2s(),h=s.getColors();t=e*this._textureWidth*this._textureHeight*4;for(let e=0;e<this._vertexCount;e++)this._supportsPositions&&n&&(o[t]=n[3*e],o[t+1]=n[3*e+1],o[t+2]=n[3*e+2],t+=4),this._supportsNormals&&a&&(o[t]=a[3*e],o[t+1]=a[3*e+1],o[t+2]=a[3*e+2],t+=4),this._supportsUVs&&i&&(o[t]=i[2*e],o[t+1]=i[2*e+1],t+=4),this._supportsTangents&&r&&(o[t]=r[3*e],o[t+1]=r[3*e+1],o[t+2]=r[3*e+2],t+=4),this._supportsUV2s&&l&&(o[t]=l[2*e],o[t+1]=l[2*e+1],t+=4),this._supportsColors&&h&&(o[t]=h[4*e],o[t+1]=h[4*e+1],o[t+2]=h[4*e+2],o[t+3]=h[4*e+3],t+=4)}this._targetStoreTexture=tl.CreateRGBATexture(o,this._textureWidth,this._textureHeight,n,this._scene,!1,!1,1,1),this._targetStoreTexture.name=`Morph texture_${this.uniqueId}`}for(let e of this._scene.meshes)e.morphTargetManager===this&&e._syncGeometryWithMorphTargetManager()}dispose(){if(this._targetStoreTexture&&this._targetStoreTexture.dispose(),this._targetStoreTexture=null,this.metadata=null,this._scene){if(this._scene.removeMorphTargetManager(this),this._parentContainer){let e=this._parentContainer.morphTargetManagers.indexOf(this);e>-1&&this._parentContainer.morphTargetManagers.splice(e,1),this._parentContainer=null}for(let e of this._targets)this._scene.stopAnimation(e)}}static Parse(e,t){let s=new th(t);for(let n of e.targets)s.addTarget(ta.Parse(n,t,s));return e.metadata&&(s.metadata=e.metadata),s}}th.EnableTextureStorage=!0,th.MaxActiveMorphTargetsInVertexAttributeMode=8,th.ConstantTargetCountForTextureMode=0;var tu=e.i(70227);let tc=new Map;function td(e,t,s){tp(e)&&L.Logger.Warn(`Extension with the name '${e}' already exists`),tc.set(e,{isGLTFExtension:t,factory:s})}function tp(e){return tc.delete(e)}e.s(["registerGLTFExtension",0,td,"registeredGLTFExtensions",0,tc,"unregisterGLTFExtension",0,tp],79511);var t_=e.i(36787);class tm{constructor(e){this._factory=e}get value(){return this._factory&&(this._value=this._factory(),this._factory=void 0),this._value}}let tf=new tm(()=>e.A(73551)),tg=new tm(()=>e.A(50731));class ty{static Get(e,t,s){if(!t||void 0==s||!t[s])throw Error(`${e}: Failed to find index (${s})`);return t[s]}static TryGet(e,t){return e&&void 0!=t&&e[t]?e[t]:null}static Assign(e){if(e)for(let t=0;t<e.length;t++)e[t].index=t}}function tb(e){if(e.min&&e.max){let t=e.min,s=e.max,n=el.TmpVectors.Vector3[0].copyFromFloats(t[0],t[1],t[2]),o=el.TmpVectors.Vector3[1].copyFromFloats(s[0],s[1],s[2]);if(e.normalized&&5126!==e.componentType){let t=1;switch(e.componentType){case 5120:t=127;break;case 5121:t=255;break;case 5122:t=32767;break;case 5123:t=65535}let s=1/t;n.scaleInPlace(s),o.scaleInPlace(s)}return new tu.BoundingInfo(n,o)}return null}class tT{isMatchingMaterialType(e){if(!e)return!1;for(let t of Array.from(this._pbrMaterialImpls.values()))if(e instanceof t.materialClass)return!0;return!1}static RegisterExtension(e,t){td(e,!1,t)}static UnregisterExtension(e){return tp(e)}get gltf(){if(!this._gltf)throw Error("glTF JSON is not available");return this._gltf}get bin(){return this._bin}get parent(){return this._parent}get babylonScene(){if(!this._babylonScene)throw Error("Scene is not available");return this._babylonScene}get rootBabylonMesh(){return this._rootBabylonMesh}get rootUrl(){return this._rootUrl}constructor(e){this._completePromises=[],this._assetContainer=null,this._babylonLights=[],this._disableInstancedMesh=0,this._allMaterialsDirtyRequired=!1,this._skipStartAnimationStep=!1,this._extensions=[],this._disposed=!1,this._rootUrl=null,this._fileName=null,this._uniqueRootUrl=null,this._bin=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions=[],this._materialAdapterCache=new WeakMap,this._materialAdapters=new Set,this._pbrMaterialImpls=new Map,this._parent=e}_getOrCreateMaterialAdapter(e){let t=this._materialAdapterCache.get(e);if(!t){for(let s of Array.from(this._pbrMaterialImpls.values()))if(e instanceof s.materialClass){t=new s.adapterClass(e);break}if(!t)throw Error("Appropriate material adapter class not found");let s=t;this._materialAdapterCache.set(e,s),this._materialAdapters.add(s)}return t}dispose(){this._disposed||(this._disposed=!0,this._completePromises.length=0,this._extensions.forEach(e=>e.dispose&&e.dispose()),this._extensions.length=0,this._materialAdapters.clear(),this._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())}async importMeshAsync(e,t,s,n,o,a,i=""){return await Promise.resolve().then(async()=>{this._babylonScene=t,this._assetContainer=s,this._loadData(n);let a=null;if(e){let t={};if(this._gltf.nodes)for(let e of this._gltf.nodes)e.name&&(t[e.name]=e.index);a=(e instanceof Array?e:[e]).map(e=>{let s=t[e];if(void 0===s)throw Error(`Failed to find node '${e}'`);return s})}return await this._loadAsync(o,i,a,()=>({meshes:this._getMeshes(),particleSystems:[],skeletons:this._getSkeletons(),animationGroups:this._getAnimationGroups(),lights:this._babylonLights,transformNodes:this._getTransformNodes(),geometries:this._getGeometries(),spriteManagers:[]}))})}async loadAsync(e,t,s,n,o=""){return this._babylonScene=e,this._loadData(t),await this._loadAsync(s,o,null,()=>void 0)}async _loadAsync(t,s,n,o){return await Promise.resolve().then(async()=>{if(this._rootUrl=t,this._uniqueRootUrl=!t.startsWith("file:")&&s?t:`${t}${Date.now()}/`,this._fileName=s,this._allMaterialsDirtyRequired=!1,await this._loadExtensionsAsync(),!this.parent.skipMaterials){let t=this.parent.useOpenPBR||this.isExtensionUsed("KHR_materials_openpbr"),s=!1;this.parent.useOpenPBR?this._gltf.materials?.length&&this._gltf.materials.some(e=>!e.extensions?.KHR_materials_openpbr)&&(s=!0):s=!0;let n=[];t&&!this._pbrMaterialImpls.has("openpbr")&&n.push(Promise.all([e.A(74875),e.A(71043)]).then(([{OpenPBRMaterial:e},{OpenPBRMaterialLoadingAdapter:t}])=>{this._pbrMaterialImpls.set("openpbr",{materialClass:e,adapterClass:t})})),s&&!this._pbrMaterialImpls.has("pbr")&&n.push(Promise.all([e.A(55254),e.A(81853)]).then(([{PBRMaterial:e},{PBRMaterialLoadingAdapter:t}])=>{this._pbrMaterialImpls.set("pbr",{materialClass:e,adapterClass:t})})),await Promise.all(n)}let a=`${T[T.LOADING]} => ${T[T.READY]}`,i=`${T[T.LOADING]} => ${T[T.COMPLETE]}`;this._parent._startPerformanceCounter(a),this._parent._startPerformanceCounter(i),this._parent._setState(T.LOADING),this._extensionsOnLoading();let r=[],l=this._babylonScene.blockMaterialDirtyMechanism;if(this._babylonScene.blockMaterialDirtyMechanism=!0,!this.parent.loadOnlyMaterials){if(n)r.push(this.loadSceneAsync("/nodes",{nodes:n,index:-1}));else if(void 0!=this._gltf.scene||this._gltf.scenes&&this._gltf.scenes[0]){let e=ty.Get("/scene",this._gltf.scenes,this._gltf.scene||0);r.push(this.loadSceneAsync(`/scenes/${e.index}`,e))}}if(!this.parent.skipMaterials&&this.parent.loadAllMaterials&&this._gltf.materials)for(let e=0;e<this._gltf.materials.length;++e){let t=this._gltf.materials[e],s="/materials/"+e,n=eb.Material.TriangleFillMode;r.push(this._loadMaterialAsync(s,t,null,n,()=>{}))}this._allMaterialsDirtyRequired?this._babylonScene.blockMaterialDirtyMechanism=l:this._babylonScene._forceBlockMaterialDirtyMechanism(l),this._parent.compileMaterials&&r.push(this._compileMaterialsAsync()),this._parent.compileShadowGenerators&&r.push(this._compileShadowGeneratorsAsync());let h=Promise.all(r).then(()=>{for(let e of(this._rootBabylonMesh&&this._rootBabylonMesh!==this._parent.customRootNode&&this._rootBabylonMesh.setEnabled(!0),this._babylonScene.materials))void 0!==e.maxSimultaneousLights&&(e.maxSimultaneousLights=Math.max(e.maxSimultaneousLights,this._babylonScene.lights.length));for(let e of Array.from(this._materialAdapters))this._completePromises.push(e.finalizeAsync(this));return this._extensionsOnReady(),this._parent._setState(T.READY),this._skipStartAnimationStep||this._startAnimations(),o()});return await h.then(e=>(this._parent._endPerformanceCounter(a),I.Tools.SetImmediate(()=>{this._disposed||Promise.all(this._completePromises).then(()=>{this._parent._endPerformanceCounter(i),this._parent._setState(T.COMPLETE),this._parent.onCompleteObservable.notifyObservers(void 0),this._parent.onCompleteObservable.clear(),this.dispose()},e=>{this._parent.onErrorObservable.notifyObservers(e),this._parent.onErrorObservable.clear(),this.dispose()})}),e))}).catch(e=>{throw this._disposed||(this._parent.onErrorObservable.notifyObservers(e),this._parent.onErrorObservable.clear(),this.dispose()),e})}_loadData(e){if(this._gltf=e.json,this._setupData(),e.bin){let t=this._gltf.buffers;if(t&&t[0]&&!t[0].uri){let s=t[0];(s.byteLength<e.bin.byteLength-3||s.byteLength>e.bin.byteLength)&&L.Logger.Warn(`Binary buffer length (${s.byteLength}) from JSON does not match chunk length (${e.bin.byteLength})`),this._bin=e.bin}else L.Logger.Warn("Unexpected BIN chunk")}}_setupData(){if(ty.Assign(this._gltf.accessors),ty.Assign(this._gltf.animations),ty.Assign(this._gltf.buffers),ty.Assign(this._gltf.bufferViews),ty.Assign(this._gltf.cameras),ty.Assign(this._gltf.images),ty.Assign(this._gltf.materials),ty.Assign(this._gltf.meshes),ty.Assign(this._gltf.nodes),ty.Assign(this._gltf.samplers),ty.Assign(this._gltf.scenes),ty.Assign(this._gltf.skins),ty.Assign(this._gltf.textures),this._gltf.nodes){let e={};for(let t of this._gltf.nodes)if(t.children)for(let s of t.children)e[s]=t.index;let t=this._createRootNode();for(let s of this._gltf.nodes){let n=e[s.index];s.parent=void 0===n?t:this._gltf.nodes[n]}}}async _loadExtensionsAsync(){let e=[];if(tc.forEach((t,s)=>{this.parent.extensionOptions[s]?.enabled===!1?t.isGLTFExtension&&this.isExtensionUsed(s)&&L.Logger.Warn(`Extension ${s} is used but has been explicitly disabled.`):(!t.isGLTFExtension||this.isExtensionUsed(s))&&e.push((async()=>{let e=await t.factory(this);return e.name!==s&&L.Logger.Warn(`The name of the glTF loader extension instance does not match the registered name: ${e.name} !== ${s}`),this._parent.onExtensionLoadedObservable.notifyObservers(e),e})())}),this._extensions.push(...await Promise.all(e)),this._extensions.sort((e,t)=>(e.order||Number.MAX_VALUE)-(t.order||Number.MAX_VALUE)),this._parent.onExtensionLoadedObservable.clear(),this._gltf.extensionsRequired){for(let e of this._gltf.extensionsRequired)if(!this._extensions.some(t=>t.name===e&&t.enabled)){if(this.parent.extensionOptions[e]?.enabled===!1)throw Error(`Required extension ${e} is disabled`);throw Error(`Required extension ${e} is not available`)}}}_createRootNode(){if(void 0!==this._parent.customRootNode)return this._rootBabylonMesh=this._parent.customRootNode,{_babylonTransformNode:null===this._rootBabylonMesh?void 0:this._rootBabylonMesh,index:-1};this._babylonScene._blockEntityCollection=!!this._assetContainer;let e=new k.Mesh("__root__",this._babylonScene);this._rootBabylonMesh=e,this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);let t={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case y.AUTO:this._babylonScene.useRightHandedSystem||(t.rotation=[0,1,0,0],t.scale=[1,1,-1],tT._LoadTransform(t,this._rootBabylonMesh));break;case y.FORCE_RIGHT_HANDED:this._babylonScene.useRightHandedSystem=!0;break;default:throw Error(`Invalid coordinate system mode (${this._parent.coordinateSystemMode})`)}return this._parent.onMeshLoadedObservable.notifyObservers(e),t}loadSceneAsync(e,t){let s=this._extensionsLoadSceneAsync(e,t);if(s)return s;let n=[];if(this.logOpen(`${e} ${t.name||""}`),t.nodes)for(let s of t.nodes){let t=ty.Get(`${e}/nodes/${s}`,this._gltf.nodes,s);n.push(this.loadNodeAsync(`/nodes/${t.index}`,t,e=>{e.parent=this._rootBabylonMesh}))}for(let e of this._postSceneLoadActions)e();return n.push(this._loadAnimationsAsync()),this.logClose(),Promise.all(n).then(()=>{})}_forEachPrimitive(e,t){if(e._primitiveBabylonMeshes)for(let s of e._primitiveBabylonMeshes)t(s)}_getGeometries(){let e=[],t=this._gltf.nodes;if(t)for(let s of t)this._forEachPrimitive(s,t=>{let s=t.geometry;s&&-1===e.indexOf(s)&&e.push(s)});return e}_getMeshes(){let e=[];this._rootBabylonMesh instanceof P.AbstractMesh&&e.push(this._rootBabylonMesh);let t=this._gltf.nodes;if(t)for(let s of t)this._forEachPrimitive(s,t=>{e.push(t)});return e}_getTransformNodes(){let e=[],t=this._gltf.nodes;if(t)for(let s of t)s._babylonTransformNode&&"TransformNode"===s._babylonTransformNode.getClassName()&&e.push(s._babylonTransformNode),s._babylonTransformNodeForSkin&&e.push(s._babylonTransformNodeForSkin);return e}_getSkeletons(){let e=[],t=this._gltf.skins;if(t)for(let s of t)s._data&&e.push(s._data.babylonSkeleton);return e}_getAnimationGroups(){let e=[],t=this._gltf.animations;if(t)for(let s of t)s._babylonAnimationGroup&&e.push(s._babylonAnimationGroup);return e}_startAnimations(){switch(this._parent.animationStartMode){case b.NONE:break;case b.FIRST:{let e=this._getAnimationGroups();0!==e.length&&e[0].start(!0);break}case b.ALL:for(let e of this._getAnimationGroups())e.start(!0);break;default:return void L.Logger.Error(`Invalid animation start mode (${this._parent.animationStartMode})`)}}loadNodeAsync(e,t,s=()=>{}){let n=this._extensionsLoadNodeAsync(e,t,s);if(n)return n;if(t._babylonTransformNode)throw Error(`${e}: Invalid recursive node hierarchy`);let o=[];this.logOpen(`${e} ${t.name||""}`);let a=n=>{if(tT.AddPointerMetadata(n,e),tT._LoadTransform(t,n),void 0!=t.camera){let s=ty.Get(`${e}/camera`,this._gltf.cameras,t.camera);o.push(this.loadCameraAsync(`/cameras/${s.index}`,s,e=>{e.parent=n,this._babylonScene.useRightHandedSystem||(n.scaling.x=-1)}))}if(t.children)for(let s of t.children){let t=ty.Get(`${e}/children/${s}`,this._gltf.nodes,s);o.push(this.loadNodeAsync(`/nodes/${t.index}`,t,e=>{e.parent=n}))}s(n)},i=void 0!=t.mesh,r=this._parent.loadSkins&&void 0!=t.skin;if(!i||r){let e=t.name||`node${t.index}`;this._babylonScene._blockEntityCollection=!!this._assetContainer;let s=new R.TransformNode(e,this._babylonScene);s._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,void 0==t.mesh?t._babylonTransformNode=s:t._babylonTransformNodeForSkin=s,a(s)}if(i)if(r){let s=ty.Get(`${e}/mesh`,this._gltf.meshes,t.mesh);o.push(this._loadMeshAsync(`/meshes/${s.index}`,t,s,s=>{let n=t._babylonTransformNodeForSkin;s.metadata=function e(...t){let s=e=>!!e&&"object"==typeof e;return t.reduce((t,n)=>{for(let o of Object.keys(n)){let a=t[o],i=n[o];Array.isArray(a)&&Array.isArray(i)?t[o]=a.concat(...i):s(a)&&s(i)?t[o]=e(a,i):t[o]=i}return t},{})}(n.metadata,s.metadata||{});let a=ty.Get(`${e}/skin`,this._gltf.skins,t.skin);o.push(this._loadSkinAsync(`/skins/${a.index}`,t,a,e=>{this._forEachPrimitive(t,t=>{t.skeleton=e}),this._postSceneLoadActions.push(()=>{if(void 0!=a.skeleton){let e=ty.Get(`/skins/${a.index}/skeleton`,this._gltf.nodes,a.skeleton).parent;t.index===e.index?s.parent=n.parent:s.parent=e._babylonTransformNode}else s.parent=this._rootBabylonMesh;this._parent.onSkinLoadedObservable.notifyObservers({node:n,skinnedNode:s})})}))}))}else{let s=ty.Get(`${e}/mesh`,this._gltf.meshes,t.mesh);o.push(this._loadMeshAsync(`/meshes/${s.index}`,t,s,a))}return this.logClose(),Promise.all(o).then(()=>(this._forEachPrimitive(t,e=>{!e.isAnInstance&&e.geometry&&e.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0,!0)}),t._babylonTransformNode))}_loadMeshAsync(e,t,s,n){let o=s.primitives;if(!o||!o.length)throw Error(`${e}: Primitives are missing`);void 0==o[0].index&&ty.Assign(o);let a=[];this.logOpen(`${e} ${s.name||""}`);let i=t.name||`node${t.index}`;if(1===o.length){let n=s.primitives[0];a.push(this._loadMeshPrimitiveAsync(`${e}/primitives/${n.index}`,i,t,s,n,e=>{t._babylonTransformNode=e,t._primitiveBabylonMeshes=[e]}))}else for(let n of(this._babylonScene._blockEntityCollection=!!this._assetContainer,t._babylonTransformNode=new R.TransformNode(i,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[],o))a.push(this._loadMeshPrimitiveAsync(`${e}/primitives/${n.index}`,`${i}_primitive${n.index}`,t,s,n,e=>{e.parent=t._babylonTransformNode,t._primitiveBabylonMeshes.push(e)}));return n(t._babylonTransformNode),this.logClose(),Promise.all(a).then(()=>t._babylonTransformNode)}_loadMeshPrimitiveAsync(e,t,s,n,o,a){let i,r,l=this._extensionsLoadMeshPrimitiveAsync(e,t,s,n,o,a);if(l)return l;this.logOpen(`${e}`);let h=0===this._disableInstancedMesh&&this._parent.createInstances&&void 0==s.skin&&!n.primitives[0].targets;if(h&&o._instanceData)this._babylonScene._blockEntityCollection=!!this._assetContainer,(i=o._instanceData.babylonSourceMesh.createInstance(t))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,r=o._instanceData.promise;else{let a=[];this._babylonScene._blockEntityCollection=!!this._assetContainer;let l=new k.Mesh(t,this._babylonScene);if(l._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,l.sideOrientation=this._babylonScene.useRightHandedSystem?eb.Material.CounterClockWiseSideOrientation:eb.Material.ClockWiseSideOrientation,this._createMorphTargets(e,s,n,o,l),a.push(this._loadVertexDataAsync(e,o,l).then(async t=>await this._loadMorphTargetsAsync(e,o,l,t).then(()=>{this._disposed||(this._babylonScene._blockEntityCollection=!!this._assetContainer,t.applyToMesh(l),t._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1)}))),!this.parent.skipMaterials){let t=tT._GetDrawMode(e,o.mode);if(void 0==o.material){let e=this._defaultBabylonMaterialData[t];e||(e=this._createDefaultMaterial("__GLTFLoader._default",t,this._getDefaultImpl()),this._parent.onMaterialLoadedObservable.notifyObservers(e),this._defaultBabylonMaterialData[t]=e),l.material=e}else{let s=ty.Get(`${e}/material`,this._gltf.materials,o.material);a.push(this._loadMaterialAsync(`/materials/${s.index}`,s,l,t,e=>{l.material=e}))}}r=Promise.all(a),h&&(o._instanceData={babylonSourceMesh:l,promise:r}),i=l}return tT.AddPointerMetadata(i,e),this._parent.onMeshLoadedObservable.notifyObservers(i),a(i),this.logClose(),r.then(()=>i)}_loadVertexDataAsync(e,t,s){let n=this._extensionsLoadVertexDataAsync(e,t,s);if(n)return n;let o=t.attributes;if(!o)throw Error(`${e}: Attributes are missing`);let a=[],i=new eM.Geometry(s.name,this._babylonScene);if(void 0==t.indices)s.isUnIndexed=!0;else{let s=ty.Get(`${e}/indices`,this._gltf.accessors,t.indices);a.push(this._loadIndicesAccessorAsync(`/accessors/${s.index}`,s).then(e=>{i.setIndices(e)}))}let r=(t,n,r)=>{if(void 0==o[t])return;s._delayInfo=s._delayInfo||[],-1===s._delayInfo.indexOf(n)&&s._delayInfo.push(n);let l=ty.Get(`${e}/attributes/${t}`,this._gltf.accessors,o[t]);a.push(this._loadVertexAccessorAsync(`/accessors/${l.index}`,l,n).then(e=>{if(e.getKind()===ev.VertexBuffer.PositionKind&&!this.parent.alwaysComputeBoundingBox&&!s.skeleton){let e=tb(l);e&&(i._boundingInfo=e,i.useBoundingInfoFromGeometry=!0)}i.setVerticesBuffer(e,l.count)})),n==ev.VertexBuffer.MatricesIndicesExtraKind&&(s.numBoneInfluencers=8),r&&r(l)};return r("POSITION",ev.VertexBuffer.PositionKind),r("NORMAL",ev.VertexBuffer.NormalKind),r("TANGENT",ev.VertexBuffer.TangentKind),r("TEXCOORD_0",ev.VertexBuffer.UVKind),r("TEXCOORD_1",ev.VertexBuffer.UV2Kind),r("TEXCOORD_2",ev.VertexBuffer.UV3Kind),r("TEXCOORD_3",ev.VertexBuffer.UV4Kind),r("TEXCOORD_4",ev.VertexBuffer.UV5Kind),r("TEXCOORD_5",ev.VertexBuffer.UV6Kind),r("JOINTS_0",ev.VertexBuffer.MatricesIndicesKind),r("WEIGHTS_0",ev.VertexBuffer.MatricesWeightsKind),r("JOINTS_1",ev.VertexBuffer.MatricesIndicesExtraKind),r("WEIGHTS_1",ev.VertexBuffer.MatricesWeightsExtraKind),r("COLOR_0",ev.VertexBuffer.ColorKind,e=>{"VEC4"===e.type&&(s.hasVertexAlpha=!0)}),Promise.all(a).then(()=>i)}_createMorphTargets(e,t,s,n,o){if(!n.targets||!this._parent.loadMorphTargets)return;if(void 0==t._numMorphTargets)t._numMorphTargets=n.targets.length;else if(n.targets.length!==t._numMorphTargets)throw Error(`${e}: Primitives do not have the same number of targets`);let a=s.extras?s.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,o.morphTargetManager=new th(this._babylonScene),o.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,o.morphTargetManager.areUpdatesFrozen=!0;for(let e=0;e<n.targets.length;e++){let n=t.weights?t.weights[e]:s.weights?s.weights[e]:0,i=a?a[e]:`morphTarget${e}`;o.morphTargetManager.addTarget(new ta(i,n,o.getScene()))}}_loadMorphTargetsAsync(e,t,s,n){if(!t.targets||!this._parent.loadMorphTargets)return Promise.resolve();let o=[],a=s.morphTargetManager;for(let s=0;s<a.numTargets;s++){let i=a.getTarget(s);o.push(this._loadMorphTargetVertexDataAsync(`${e}/targets/${s}`,n,t.targets[s],i))}return Promise.all(o).then(()=>{a.areUpdatesFrozen=!1})}async _loadMorphTargetVertexDataAsync(e,t,s,n){let o=[],a=(n,a,i)=>{if(void 0==s[n])return;let r=t.getVertexBuffer(a);if(!r)return;let l=ty.Get(`${e}/${n}`,this._gltf.accessors,s[n]);o.push(this._loadFloatAccessorAsync(`/accessors/${l.index}`,l).then(e=>{i(r,e)}))};return a("POSITION",ev.VertexBuffer.PositionKind,(e,t)=>{let s=new Float32Array(t.length);e.forEach(t.length,(e,n)=>{s[n]=t[n]+e}),n.setPositions(s)}),a("NORMAL",ev.VertexBuffer.NormalKind,(e,t)=>{let s=new Float32Array(t.length);e.forEach(s.length,(e,n)=>{s[n]=t[n]+e}),n.setNormals(s)}),a("TANGENT",ev.VertexBuffer.TangentKind,(e,t)=>{let s=new Float32Array(t.length/3*4),o=0;e.forEach(t.length/3*4,(e,n)=>{(n+1)%4!=0&&(s[o]=t[o]+e,o++)}),n.setTangents(s)}),a("TEXCOORD_0",ev.VertexBuffer.UVKind,(e,t)=>{let s=new Float32Array(t.length);e.forEach(t.length,(e,n)=>{s[n]=t[n]+e}),n.setUVs(s)}),a("TEXCOORD_1",ev.VertexBuffer.UV2Kind,(e,t)=>{let s=new Float32Array(t.length);e.forEach(t.length,(e,n)=>{s[n]=t[n]+e}),n.setUV2s(s)}),a("COLOR_0",ev.VertexBuffer.ColorKind,(t,s)=>{let o=null,a=t.getSize();if(3===a){o=new Float32Array(s.length/3*4),t.forEach(s.length,(e,t)=>{let n=Math.floor(t/3),a=t%3;o[4*n+a]=s[3*n+a]+e});for(let e=0;e<s.length/3;++e)o[4*e+3]=1}else if(4===a)o=new Float32Array(s.length),t.forEach(s.length,(e,t)=>{o[t]=s[t]+e});else throw Error(`${e}: Invalid number of components (${a}) for COLOR_0 attribute`);n.setColors(o)}),await Promise.all(o).then(()=>{})}static _LoadTransform(e,t){if(void 0!=e.skin)return;let s=el.Vector3.Zero(),n=el.Quaternion.Identity(),o=el.Vector3.One();e.matrix?el.Matrix.FromArray(e.matrix).decompose(o,n,s):(e.translation&&(s=el.Vector3.FromArray(e.translation)),e.rotation&&(n=el.Quaternion.FromArray(e.rotation)),e.scale&&(o=el.Vector3.FromArray(e.scale))),t.position=s,t.rotationQuaternion=n,t.scaling=o}_loadSkinAsync(e,t,s,n){if(!this._parent.loadSkins)return Promise.resolve();let o=this._extensionsLoadSkinAsync(e,t,s);if(o)return o;if(s._data)return n(s._data.babylonSkeleton),s._data.promise;let a=`skeleton${s.index}`;this._babylonScene._blockEntityCollection=!!this._assetContainer;let i=new eg(s.name||a,a,this._babylonScene);i._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,s,i);let r=this._loadSkinInverseBindMatricesDataAsync(e,s).then(e=>{this._updateBoneMatrices(i,e)});return s._data={babylonSkeleton:i,promise:r},n(i),r}_loadBones(e,t,s){if(void 0==t.skeleton||this._parent.alwaysComputeSkeletonRootNode){let s=this._findSkeletonRootNode(`${e}/joints`,t.joints);if(s)if(void 0===t.skeleton)t.skeleton=s.index;else{let n=ty.Get(`${e}/skeleton`,this._gltf.nodes,t.skeleton);n===s||((e,t)=>{for(;t.parent;t=t.parent)if(t.parent===e)return!0;return!1})(n,s)||(L.Logger.Warn(`${e}/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root`),t.skeleton=s.index)}else L.Logger.Warn(`${e}: Failed to find common root`)}let n={};for(let o of t.joints){let a=ty.Get(`${e}/joints/${o}`,this._gltf.nodes,o);this._loadBone(a,t,s,n)}}_findSkeletonRootNode(e,t){if(0===t.length)return null;let s={};for(let n of t){let t=[],o=ty.Get(`${e}/${n}`,this._gltf.nodes,n);for(;-1!==o.index;)t.unshift(o),o=o.parent;s[n]=t}let n=null;for(let e=0;;++e){let o=s[t[0]];if(e>=o.length)return n;let a=o[e];for(let i=1;i<t.length;++i)if(e>=(o=s[t[i]]).length||a!==o[e])return n;n=a}}_loadBone(e,t,s,n){e._isJoint=!0;let o=n[e.index];if(o)return o;let a=null;e.index!==t.skeleton&&(e.parent&&-1!==e.parent.index?a=this._loadBone(e.parent,t,s,n):void 0!==t.skeleton&&L.Logger.Warn(`/skins/${t.index}/skeleton: Skeleton node is not a common root`));let i=t.joints.indexOf(e.index);return o=new ed.Bone(e.name||`joint${e.index}`,s,a,this._getNodeMatrix(e),null,null,i),n[e.index]=o,this._postSceneLoadActions.push(()=>{o.linkTransformNode(e._babylonTransformNode)}),o}_loadSkinInverseBindMatricesDataAsync(e,t){if(void 0==t.inverseBindMatrices)return Promise.resolve(null);let s=ty.Get(`${e}/inverseBindMatrices`,this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync(`/accessors/${s.index}`,s)}_updateBoneMatrices(e,t){for(let s of e.bones){let e=el.Matrix.Identity(),n=s._index;t&&-1!==n&&(el.Matrix.FromArrayToRef(t,16*n,e),e.invertToRef(e));let o=s.getParent();o&&e.multiplyToRef(o.getAbsoluteInverseBindMatrix(),e),s.updateMatrix(e,!1,!1),s._updateAbsoluteBindMatrices(void 0,!1)}}_getNodeMatrix(e){return e.matrix?el.Matrix.FromArray(e.matrix):el.Matrix.Compose(e.scale?el.Vector3.FromArray(e.scale):el.Vector3.One(),e.rotation?el.Quaternion.FromArray(e.rotation):el.Quaternion.Identity(),e.translation?el.Vector3.FromArray(e.translation):el.Vector3.Zero())}loadCameraAsync(e,t,s=()=>{}){let n=this._extensionsLoadCameraAsync(e,t,s);if(n)return n;this.logOpen(`${e} ${t.name||""}`),this._babylonScene._blockEntityCollection=!!this._assetContainer;let o=new eu.FreeCamera(t.name||`camera${t.index}`,el.Vector3.Zero(),this._babylonScene,!1);switch(o._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._babylonCamera=o,o.setTarget(new el.Vector3(0,0,-1)),t.type){case"perspective":{let s=t.perspective;if(!s)throw Error(`${e}: Camera perspective properties are missing`);o.fov=s.yfov,o.minZ=s.znear,o.maxZ=s.zfar||0;break}case"orthographic":if(!t.orthographic)throw Error(`${e}: Camera orthographic properties are missing`);o.mode=U.Camera.ORTHOGRAPHIC_CAMERA,o.orthoLeft=-t.orthographic.xmag,o.orthoRight=t.orthographic.xmag,o.orthoBottom=-t.orthographic.ymag,o.orthoTop=t.orthographic.ymag,o.minZ=t.orthographic.znear,o.maxZ=t.orthographic.zfar;break;default:throw Error(`${e}: Invalid camera type (${t.type})`)}return tT.AddPointerMetadata(o,e),this._parent.onCameraLoadedObservable.notifyObservers(o),s(o),this.logClose(),Promise.all([]).then(()=>o)}_loadAnimationsAsync(){this._parent._startPerformanceCounter("Load animations");let e=this._gltf.animations;if(!e)return Promise.resolve();let t=[];for(let s=0;s<e.length;s++){let n=e[s];t.push(this.loadAnimationAsync(`/animations/${n.index}`,n).then(e=>{0===e.targetedAnimations.length&&e.dispose()}))}return Promise.all(t).then(()=>{this._parent._endPerformanceCounter("Load animations")})}loadAnimationAsync(e,t){this._parent._startPerformanceCounter("Load animation");let s=this._extensionsLoadAnimationAsync(e,t);return s||tf.value.then(({AnimationGroup:s})=>{this._babylonScene._blockEntityCollection=!!this._assetContainer;let n=new s(t.name||`animation${t.index}`,this._babylonScene);n._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._babylonAnimationGroup=n;let o=[];for(let s of(ty.Assign(t.channels),ty.Assign(t.samplers),t.channels))o.push(this._loadAnimationChannelAsync(`${e}/channels/${s.index}`,e,t,s,(e,t)=>{e.animations=e.animations||[],e.animations.push(t),n.addTargetedAnimation(t,e)}));return this._parent._endPerformanceCounter("Load animation"),Promise.all(o).then(()=>(n.normalize(0),n))})}_loadAnimationChannelAsync(e,t,s,n,o){let a=this._extensionsLoadAnimationChannelAsync(e,t,s,n,o);if(a)return a;if(void 0==n.target.node)return Promise.resolve();let i=ty.Get(`${e}/target/node`,this._gltf.nodes,n.target.node),r=n.target.path,l="weights"===r;return(!l||i._numMorphTargets)&&(l||i._babylonTransformNode)&&(this._parent.loadNodeAnimations||l||i._isJoint)?tg.value.then(()=>{let a;switch(r){case"translation":a=(0,t_.GetMappingForKey)("/nodes/{}/translation")?.interpolation;break;case"rotation":a=(0,t_.GetMappingForKey)("/nodes/{}/rotation")?.interpolation;break;case"scale":a=(0,t_.GetMappingForKey)("/nodes/{}/scale")?.interpolation;break;case"weights":a=(0,t_.GetMappingForKey)("/nodes/{}/weights")?.interpolation;break;default:throw Error(`${e}/target/path: Invalid value (${n.target.path})`)}if(!a)throw Error(`${e}/target/path: Could not find interpolation properties for target path (${n.target.path})`);let l={object:i,info:a};return this._loadAnimationChannelFromTargetInfoAsync(e,t,s,n,l,o)}):Promise.resolve()}_loadAnimationChannelFromTargetInfoAsync(e,t,s,n,o,a){let i=this.parent.targetFps,r=1/i,l=ty.Get(`${e}/sampler`,s.samplers,n.sampler);return this._loadAnimationSamplerAsync(`${t}/samplers/${n.sampler}`,l).then(e=>{let t=0,l=o.object;for(let h of o.info){let o=h.getStride(l),u=e.input,c=e.output,d=Array(u.length),p=0;switch(e.interpolation){case"STEP":for(let e=0;e<u.length;e++){let t=h.getValue(l,c,p,1);p+=o,d[e]={frame:u[e]*i,value:t,interpolation:1}}break;case"CUBICSPLINE":for(let e=0;e<u.length;e++){let t=h.getValue(l,c,p,r);p+=o;let s=h.getValue(l,c,p,1);p+=o;let n=h.getValue(l,c,p,r);p+=o,d[e]={frame:u[e]*i,inTangent:t,value:s,outTangent:n}}break;case"LINEAR":for(let e=0;e<u.length;e++){let t=h.getValue(l,c,p,1);p+=o,d[e]={frame:u[e]*i,value:t}}}if(p>0){let e=`${s.name||`animation${s.index}`}_channel${n.index}_${t}`;for(let s of h.buildAnimations(l,e,i,d))t++,a(s.babylonAnimatable,s.babylonAnimation)}}})}_loadAnimationSamplerAsync(e,t){if(t._data)return t._data;let s=t.interpolation||"LINEAR";switch(s){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw Error(`${e}/interpolation: Invalid value (${t.interpolation})`)}let n=ty.Get(`${e}/input`,this._gltf.accessors,t.input),o=ty.Get(`${e}/output`,this._gltf.accessors,t.output);return t._data=Promise.all([this._loadFloatAccessorAsync(`/accessors/${n.index}`,n),this._loadFloatAccessorAsync(`/accessors/${o.index}`,o)]).then(([e,t])=>({input:e,interpolation:s,output:t})),t._data}loadBufferAsync(e,t,s,n){let o=this._extensionsLoadBufferAsync(e,t,s,n);if(o)return o;if(!t._data)if(t.uri)t._data=this.loadUriAsync(`${e}/uri`,t,t.uri);else{if(!this._bin)throw Error(`${e}: Uri is missing or the binary glTF is missing its binary chunk`);t._data=this._bin.readAsync(0,t.byteLength)}return t._data.then(t=>{try{return new Uint8Array(t.buffer,t.byteOffset+s,n)}catch(t){throw Error(`${e}: ${t.message}`,{cause:t})}})}loadBufferViewAsync(e,t){let s=this._extensionsLoadBufferViewAsync(e,t);if(s)return s;if(t._data)return t._data;let n=ty.Get(`${e}/buffer`,this._gltf.buffers,t.buffer);return t._data=this.loadBufferAsync(`/buffers/${n.index}`,n,t.byteOffset||0,t.byteLength),t._data}_loadAccessorAsync(e,t,s){if(t._data)return t._data;let n=tT._GetNumComponents(e,t.type),o=n*(0,ev.VertexBufferGetTypeByteLength)(t.componentType),a=n*t.count;if(void 0==t.bufferView)t._data=Promise.resolve(new s(a));else{let i=ty.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync(`/bufferViews/${i.index}`,i).then(r=>{if(5126===t.componentType&&!t.normalized&&(!i.byteStride||i.byteStride===o))return tT._GetTypedArray(e,t.componentType,r,t.byteOffset,a);{let e=new s(a);return(0,ev.VertexBufferForEach)(r,t.byteOffset||0,i.byteStride||o,n,t.componentType,e.length,t.normalized||!1,(t,s)=>{e[s]=t}),e}})}if(t.sparse){let a=t.sparse;t._data=t._data.then(i=>{let r=ty.Get(`${e}/sparse/indices/bufferView`,this._gltf.bufferViews,a.indices.bufferView),l=ty.Get(`${e}/sparse/values/bufferView`,this._gltf.bufferViews,a.values.bufferView);return Promise.all([this.loadBufferViewAsync(`/bufferViews/${r.index}`,r),this.loadBufferViewAsync(`/bufferViews/${l.index}`,l)]).then(([r,l])=>{let h,u=tT._GetTypedArray(`${e}/sparse/indices`,a.indices.componentType,r,a.indices.byteOffset,a.count),c=n*a.count;if(5126!==t.componentType||t.normalized){let i=tT._GetTypedArray(`${e}/sparse/values`,t.componentType,l,a.values.byteOffset,c);h=new s(c),(0,ev.VertexBufferForEach)(i,0,o,n,t.componentType,h.length,t.normalized||!1,(e,t)=>{h[t]=e})}else h=tT._GetTypedArray(`${e}/sparse/values`,t.componentType,l,a.values.byteOffset,c);let d=0;for(let e=0;e<u.length;e++){let t=u[e]*n;for(let e=0;e<n;e++)i[t++]=h[d++]}return i})})}return t._data}_loadFloatAccessorAsync(e,t){return this._loadAccessorAsync(e,t,Float32Array)}_loadIndicesAccessorAsync(e,t){if("SCALAR"!==t.type)throw Error(`${e}/type: Invalid value ${t.type}`);if(5121!==t.componentType&&5123!==t.componentType&&5125!==t.componentType)throw Error(`${e}/componentType: Invalid value ${t.componentType}`);if(t._data)return t._data;if(t.sparse){let s=tT._GetTypedArrayConstructor(`${e}/componentType`,t.componentType);t._data=this._loadAccessorAsync(e,t,s)}else{let s=ty.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync(`/bufferViews/${s.index}`,s).then(s=>tT._GetTypedArray(e,t.componentType,s,t.byteOffset,t.count))}return t._data}_loadVertexBufferViewAsync(e){if(e._babylonBuffer)return e._babylonBuffer;let t=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync(`/bufferViews/${e.index}`,e).then(e=>new ev.Buffer(t,e,!1)),e._babylonBuffer}_loadVertexAccessorAsync(e,t,s){if(t._babylonVertexBuffer?.[s])return t._babylonVertexBuffer[s];t._babylonVertexBuffer||(t._babylonVertexBuffer={});let n=this._babylonScene.getEngine();if(t.sparse||void 0==t.bufferView)t._babylonVertexBuffer[s]=this._loadFloatAccessorAsync(e,t).then(e=>new ev.VertexBuffer(n,e,s,!1));else{let o=ty.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._babylonVertexBuffer[s]=this._loadVertexBufferViewAsync(o).then(a=>{let i=tT._GetNumComponents(e,t.type);return new ev.VertexBuffer(n,a,s,!1,void 0,o.byteStride,void 0,t.byteOffset,i,t.componentType,t.normalized,!0,void 0,!0)})}return t._babylonVertexBuffer[s]}_loadMaterialMetallicRoughnessPropertiesAsync(e,t,s){let n=[],o=this._getOrCreateMaterialAdapter(s);return t&&(t.baseColorFactor?(o.baseColor=eh.Color3.FromArray(t.baseColorFactor),o.geometryOpacity=t.baseColorFactor[3]):o.baseColor=eh.Color3.White(),o.baseMetalness=void 0==t.metallicFactor?1:t.metallicFactor,o.specularRoughness=void 0==t.roughnessFactor?1:t.roughnessFactor,t.baseColorTexture&&n.push(this.loadTextureInfoAsync(`${e}/baseColorTexture`,t.baseColorTexture,e=>{e.name=`${s.name} (Base Color)`,o.baseColorTexture=e})),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.nonColorData=!0,n.push(this.loadTextureInfoAsync(`${e}/metallicRoughnessTexture`,t.metallicRoughnessTexture,e=>{e.name=`${s.name} (Metallic Roughness)`,o.baseMetalnessTexture=e,o.specularRoughnessTexture=e})),o.useRoughnessFromMetallicTextureGreen=!0,o.useMetallicFromMetallicTextureBlue=!0)),Promise.all(n).then(()=>{})}_loadMaterialAsync(e,t,s,n,o=()=>{}){let a=this._extensionsLoadMaterialAsync(e,t,s,n,o);if(a)return a;t._data=t._data||{};let i=t._data[n];if(!i){this.logOpen(`${e} ${t.name||""}`);let s=this.createMaterial(e,t,n);i={babylonMaterial:s,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(e,t,s)},t._data[n]=i,tT.AddPointerMetadata(s,e),this._parent.onMaterialLoadedObservable.notifyObservers(s),this.logClose()}return s&&(i.babylonMeshes.push(s),s.onDisposeObservable.addOnce(()=>{let e=i.babylonMeshes.indexOf(s);-1!==e&&i.babylonMeshes.splice(e,1)})),o(i.babylonMaterial),i.promise.then(()=>i.babylonMaterial)}_selectImplForGltfMaterial(e){if(this.parent.useOpenPBR||e.extensions?.KHR_materials_openpbr){let e=this._pbrMaterialImpls.get("openpbr");if(e)return e}let t=this._pbrMaterialImpls.get("pbr");if(t)return t;throw Error("No PBR material implementation loaded")}_getDefaultImpl(){if(this.parent.useOpenPBR){let e=this._pbrMaterialImpls.get("openpbr");if(e)return e}let e=this._pbrMaterialImpls.get("pbr")??this._pbrMaterialImpls.values().next().value;if(e)return e;throw Error("No PBR material implementation loaded")}_createDefaultMaterial(e,t,s){this._babylonScene._blockEntityCollection=!!this._assetContainer;let n=new s.materialClass(e,this._babylonScene);n._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,n.fillMode=t,n.transparencyMode=s.materialClass.MATERIAL_OPAQUE;let o=this._getOrCreateMaterialAdapter(n);return o.transparencyAsAlphaCoverage=this._parent.transparencyAsCoverage,o.baseMetalness=1,o.specularRoughness=1,n}createMaterial(e,t,s){let n=this._extensionsCreateMaterial(e,t,s);if(n)return n;let o=t.name||`material${t.index}`;return this._createDefaultMaterial(o,s,this._selectImplForGltfMaterial(t))}loadMaterialPropertiesAsync(e,t,s){let n=this._extensionsLoadMaterialPropertiesAsync(e,t,s);if(n)return n;let o=[];return o.push(this.loadMaterialBasePropertiesAsync(e,t,s)),t.pbrMetallicRoughness&&o.push(this._loadMaterialMetallicRoughnessPropertiesAsync(`${e}/pbrMetallicRoughness`,t.pbrMetallicRoughness,s)),this.loadMaterialAlphaProperties(e,t,s),Promise.all(o).then(()=>{})}loadMaterialBasePropertiesAsync(e,t,s){let n,o,a=[],i=this._getOrCreateMaterialAdapter(s);i.emissionColor=t.emissiveFactor?eh.Color3.FromArray(t.emissiveFactor):new eh.Color3(0,0,0),t.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,a.push(this.loadTextureInfoAsync(`${e}/normalTexture`,t.normalTexture,e=>{e.name=`${s.name} (Normal)`,i.geometryNormalTexture=e,t.normalTexture?.scale!=void 0&&(e.level=t.normalTexture.scale)})),i.setNormalMapInversions(!this._babylonScene.useRightHandedSystem,this._babylonScene.useRightHandedSystem));let r=1;return t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,a.push(this.loadTextureInfoAsync(`${e}/occlusionTexture`,t.occlusionTexture,e=>{e.name=`${s.name} (Occlusion)`,n=e})),void 0!=t.occlusionTexture.strength&&(r=t.occlusionTexture.strength)),t.emissiveTexture&&a.push(this.loadTextureInfoAsync(`${e}/emissiveTexture`,t.emissiveTexture,e=>{e.name=`${s.name} (Emissive)`,o=e})),Promise.all(a).then(()=>{n&&(i.ambientOcclusionTexture=n,i.ambientOcclusionTextureStrength=r),o&&(i.emissionColorTexture=o)})}loadMaterialAlphaProperties(e,t,s){if(0===this._pbrMaterialImpls.size)throw Error(`${e}: Material type not supported`);let n=this._getOrCreateMaterialAdapter(s),o=n.baseColorTexture;switch(t.alphaMode||"OPAQUE"){case"OPAQUE":s.transparencyMode=eb.Material.MATERIAL_OPAQUE,s.alpha=1;break;case"MASK":s.transparencyMode=eb.Material.MATERIAL_ALPHATEST,n.alphaCutOff=void 0==t.alphaCutoff?.5:t.alphaCutoff,o&&(o.hasAlpha=!0,n.useAlphaFromBaseColorTexture=!0);break;case"BLEND":s.transparencyMode=eb.Material.MATERIAL_ALPHABLEND,o&&(o.hasAlpha=!0,n.useAlphaFromBaseColorTexture=!0);break;default:throw Error(`${e}/alphaMode: Invalid value (${t.alphaMode})`)}}loadTextureInfoAsync(e,t,s=()=>{}){let n=this._extensionsLoadTextureInfoAsync(e,t,s);if(n)return n;if(this.logOpen(`${e}`),t.texCoord>=6)throw Error(`${e}/texCoord: Invalid value (${t.texCoord})`);let o=ty.Get(`${e}/index`,this._gltf.textures,t.index);o._textureInfo=t;let a=this._loadTextureAsync(`/textures/${t.index}`,o,n=>{n.coordinatesIndex=t.texCoord||0,tT.AddPointerMetadata(n,e),this._parent.onTextureLoadedObservable.notifyObservers(n),s(n)});return this.logClose(),a}_loadTextureAsync(e,t,s=()=>{}){let n=this._extensionsLoadTextureAsync(e,t,s);if(n)return n;this.logOpen(`${e} ${t.name||""}`);let o=void 0==t.sampler?tT.DefaultSampler:ty.Get(`${e}/sampler`,this._gltf.samplers,t.sampler),a=ty.Get(`${e}/source`,this._gltf.images,t.source),i=this._createTextureAsync(e,o,a,s,void 0,!t._textureInfo.nonColorData);return this.logClose(),i}_createTextureAsync(e,t,s,n=()=>{},o,a){let i=this._loadSampler(`/samplers/${t.index}`,t),r=[],l=new tn;this._babylonScene._blockEntityCollection=!!this._assetContainer;let h={noMipmap:i.noMipMaps,invertY:!1,samplingMode:i.samplingMode,onLoad:()=>{this._disposed||l.resolve()},onError:(t,s)=>{this._disposed||l.reject(Error(`${e}: ${s&&s.message?s.message:t||"Failed to load texture"}`))},mimeType:s.mimeType??(0,et.GetMimeType)(s.uri??""),loaderOptions:o,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers},u=new ep.Texture(null,this._babylonScene,h);u._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,r.push(l.promise);let c=s.uri&&!(0,et.IsBase64DataUrl)(s.uri)?s.uri:void 0,d=c??`${this._fileName}#image${s.index}`;return r.push(this.loadImageAsync(`/images/${s.index}`,s).then(e=>{let t=`data:${this._uniqueRootUrl}${d}`;u.updateURL(t,e);let n=u.getInternalTexture();n&&(n.label=s.name)})),u.wrapU=i.wrapU,u.wrapV=i.wrapV,n(u),this._parent.useGltfTextureNames&&(u.name=s.name||c||`image${s.index}`),Promise.all(r).then(()=>u)}_loadSampler(e,t){return t._data||(t._data={noMipMaps:9728===t.minFilter||9729===t.minFilter,samplingMode:tT._GetTextureSamplingMode(e,t),wrapU:tT._GetTextureWrapMode(`${e}/wrapS`,t.wrapS),wrapV:tT._GetTextureWrapMode(`${e}/wrapT`,t.wrapT)}),t._data}loadImageAsync(e,t){if(!t._data){if(this.logOpen(`${e} ${t.name||""}`),t.uri)t._data=this.loadUriAsync(`${e}/uri`,t,t.uri);else{let s=ty.Get(`${e}/bufferView`,this._gltf.bufferViews,t.bufferView);t._data=this.loadBufferViewAsync(`/bufferViews/${s.index}`,s)}this.logClose()}return t._data}loadUriAsync(e,t,s){let n=this._extensionsLoadUriAsync(e,t,s);if(n)return n;if(!tT._ValidateUri(s))throw Error(`${e}: '${s}' is invalid`);if((0,et.IsBase64DataUrl)(s)){let t=new Uint8Array((0,et.DecodeBase64UrlToBinary)(s));return this.log(`${e}: Decoded ${s.substring(0,64)}... (${t.length} bytes)`),Promise.resolve(t)}return this.log(`${e}: Loading ${s}`),this._parent.preprocessUrlAsync(this._rootUrl+s).then(t=>new Promise((n,o)=>{this._parent._loadFile(this._babylonScene,t,t=>{this._disposed||(this.log(`${e}: Loaded ${s} (${t.byteLength} bytes)`),n(new Uint8Array(t)))},!0,t=>{o(new et.LoadFileError(`${e}: Failed to load '${s}'${t?": "+t.status+" "+t.statusText:""}`,t))})}))}static AddPointerMetadata(e,t){e.metadata=e.metadata||{};let s=e._internalMetadata=e._internalMetadata||{},n=s.gltf=s.gltf||{};(n.pointers=n.pointers||[]).push(t)}static _GetTextureWrapMode(e,t){switch(t=void 0==t?10497:t){case 33071:return ep.Texture.CLAMP_ADDRESSMODE;case 33648:return ep.Texture.MIRROR_ADDRESSMODE;case 10497:return ep.Texture.WRAP_ADDRESSMODE;default:return L.Logger.Warn(`${e}: Invalid value (${t})`),ep.Texture.WRAP_ADDRESSMODE}}static _GetTextureSamplingMode(e,t){let s=void 0==t.magFilter?9729:t.magFilter,n=void 0==t.minFilter?9987:t.minFilter;if(9729===s)switch(n){case 9728:return ep.Texture.LINEAR_NEAREST;case 9729:return ep.Texture.LINEAR_LINEAR;case 9984:return ep.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return ep.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return ep.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return ep.Texture.LINEAR_LINEAR_MIPLINEAR;default:return L.Logger.Warn(`${e}/minFilter: Invalid value (${n})`),ep.Texture.LINEAR_LINEAR_MIPLINEAR}switch(9728!==s&&L.Logger.Warn(`${e}/magFilter: Invalid value (${s})`),n){case 9728:return ep.Texture.NEAREST_NEAREST;case 9729:return ep.Texture.NEAREST_LINEAR;case 9984:return ep.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return ep.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return ep.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return ep.Texture.NEAREST_LINEAR_MIPLINEAR;default:return L.Logger.Warn(`${e}/minFilter: Invalid value (${n})`),ep.Texture.NEAREST_NEAREST_MIPNEAREST}}static _GetTypedArrayConstructor(e,t){try{return(0,eU.GetTypedArrayConstructor)(t)}catch(t){throw Error(`${e}: ${t.message}`,{cause:t})}}static _GetTypedArray(e,t,s,n,o){let a=s.buffer;n=s.byteOffset+(n||0);let i=tT._GetTypedArrayConstructor(`${e}/componentType`,t),r=(0,ev.VertexBufferGetTypeByteLength)(t);return n%r!=0?(L.Logger.Warn(`${e}: Copying buffer as byte offset (${n}) is not a multiple of component type byte length (${r})`),new i(a.slice(n,n+o*r),0)):new i(a,n,o)}static _GetNumComponents(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw Error(`${e}: Invalid type (${t})`)}static _ValidateUri(e){return I.Tools.IsBase64(e)||-1===e.indexOf("..")}static _GetDrawMode(e,t){switch(void 0==t&&(t=4),t){case 0:return eb.Material.PointListDrawMode;case 1:return eb.Material.LineListDrawMode;case 2:return eb.Material.LineLoopDrawMode;case 3:return eb.Material.LineStripDrawMode;case 4:return eb.Material.TriangleFillMode;case 5:return eb.Material.TriangleStripDrawMode;case 6:return eb.Material.TriangleFanDrawMode}throw Error(`${e}: Invalid mesh primitive mode (${t})`)}_compileMaterialsAsync(){this._parent._startPerformanceCounter("Compile materials");let e=[];if(this._gltf.materials){for(let t of this._gltf.materials)if(t._data)for(let s in t._data){let n=t._data[s];for(let t of n.babylonMeshes){t.computeWorldMatrix(!0);let s=n.babylonMaterial;e.push(s.forceCompilationAsync(t)),e.push(s.forceCompilationAsync(t,{useInstances:!0})),this._parent.useClipPlane&&(e.push(s.forceCompilationAsync(t,{clipPlane:!0})),e.push(s.forceCompilationAsync(t,{clipPlane:!0,useInstances:!0})))}}}return Promise.all(e).then(()=>{this._parent._endPerformanceCounter("Compile materials")})}_compileShadowGeneratorsAsync(){this._parent._startPerformanceCounter("Compile shadow generators");let e=[];for(let t of this._babylonScene.lights){let s=t.getShadowGenerator();s&&e.push(s.forceCompilationAsync())}return Promise.all(e).then(()=>{this._parent._endPerformanceCounter("Compile shadow generators")})}_forEachExtensions(e){for(let t of this._extensions)t.enabled&&e(t)}_applyExtensions(e,t,s){for(let n of this._extensions)if(n.enabled){let o=`${n.name}.${t}`;e._activeLoaderExtensionFunctions=e._activeLoaderExtensionFunctions||{};let a=e._activeLoaderExtensionFunctions;if(!a[o]){a[o]=!0;try{let e=s(n);if(e)return e}finally{delete a[o]}}}return null}_extensionsOnLoading(){this._forEachExtensions(e=>e.onLoading&&e.onLoading())}_extensionsOnReady(){this._forEachExtensions(e=>e.onReady&&e.onReady())}_extensionsLoadSceneAsync(e,t){return this._applyExtensions(t,"loadScene",s=>s.loadSceneAsync&&s.loadSceneAsync(e,t))}_extensionsLoadNodeAsync(e,t,s){return this._applyExtensions(t,"loadNode",n=>n.loadNodeAsync&&n.loadNodeAsync(e,t,s))}_extensionsLoadCameraAsync(e,t,s){return this._applyExtensions(t,"loadCamera",n=>n.loadCameraAsync&&n.loadCameraAsync(e,t,s))}_extensionsLoadVertexDataAsync(e,t,s){return this._applyExtensions(t,"loadVertexData",n=>n._loadVertexDataAsync&&n._loadVertexDataAsync(e,t,s))}_extensionsLoadMeshPrimitiveAsync(e,t,s,n,o,a){return this._applyExtensions(o,"loadMeshPrimitive",i=>i._loadMeshPrimitiveAsync&&i._loadMeshPrimitiveAsync(e,t,s,n,o,a))}_extensionsLoadMaterialAsync(e,t,s,n,o){return this._applyExtensions(t,"loadMaterial",a=>a._loadMaterialAsync&&a._loadMaterialAsync(e,t,s,n,o))}_extensionsCreateMaterial(e,t,s){return this._applyExtensions(t,"createMaterial",n=>n.createMaterial&&n.createMaterial(e,t,s))}_extensionsLoadMaterialPropertiesAsync(e,t,s){return this._applyExtensions(t,"loadMaterialProperties",n=>n.loadMaterialPropertiesAsync&&n.loadMaterialPropertiesAsync(e,t,s))}_extensionsLoadTextureInfoAsync(e,t,s){return this._applyExtensions(t,"loadTextureInfo",n=>n.loadTextureInfoAsync&&n.loadTextureInfoAsync(e,t,s))}_extensionsLoadTextureAsync(e,t,s){return this._applyExtensions(t,"loadTexture",n=>n._loadTextureAsync&&n._loadTextureAsync(e,t,s))}_extensionsLoadAnimationAsync(e,t){return this._applyExtensions(t,"loadAnimation",s=>s.loadAnimationAsync&&s.loadAnimationAsync(e,t))}_extensionsLoadAnimationChannelAsync(e,t,s,n,o){return this._applyExtensions(s,"loadAnimationChannel",a=>a._loadAnimationChannelAsync&&a._loadAnimationChannelAsync(e,t,s,n,o))}_extensionsLoadSkinAsync(e,t,s){return this._applyExtensions(s,"loadSkin",n=>n._loadSkinAsync&&n._loadSkinAsync(e,t,s))}_extensionsLoadUriAsync(e,t,s){return this._applyExtensions(t,"loadUri",n=>n._loadUriAsync&&n._loadUriAsync(e,t,s))}_extensionsLoadBufferViewAsync(e,t){return this._applyExtensions(t,"loadBufferView",s=>s.loadBufferViewAsync&&s.loadBufferViewAsync(e,t))}_extensionsLoadBufferAsync(e,t,s,n){return this._applyExtensions(t,"loadBuffer",o=>o.loadBufferAsync&&o.loadBufferAsync(e,t,s,n))}static LoadExtensionAsync(e,t,s,n){if(!t.extensions)return null;let o=t.extensions[s];return o?n(`${e}/extensions/${s}`,o):null}static LoadExtraAsync(e,t,s,n){if(!t.extras)return null;let o=t.extras[s];return o?n(`${e}/extras/${s}`,o):null}isExtensionUsed(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)}logOpen(e){this._parent._logOpen(e)}logClose(){this._parent._logClose()}log(e){this._parent._log(e)}startPerformanceCounter(e){this._parent._startPerformanceCounter(e)}endPerformanceCounter(e){this._parent._endPerformanceCounter(e)}}tT.DefaultSampler={index:-1},er._CreateGLTF2Loader=e=>new tT(e),e.s(["ArrayItem",0,ty,"GLTFLoader",0,tT,"LoadBoundingInfoFromPositionAccessor",0,tb],32677),e.s([],75215),e.s([],70680);var tA=e.i(65785),tx=e.i(33234),tw=e.i(54268),tv=e.i(14953),tM=e.i(99551),tC=e.i(23240),tF=e.i(52153);class tS extends tF.BaseTexture{set boundingBoxSize(e){if(this._boundingBoxSize&&this._boundingBoxSize.equals(e))return;this._boundingBoxSize=e;let t=this.getScene();t&&t.markAllMaterialsAsDirty(1)}get boundingBoxSize(){return this._boundingBoxSize}set rotationY(e){this._rotationY=e,this.setReflectionTextureMatrix(el.Matrix.RotationY(this._rotationY))}get rotationY(){return this._rotationY}get noMipmap(){return this._noMipmap}get forcedExtension(){return this._forcedExtension}constructor(e,t,s=null,n=!1,o=null,a=null,i=null,r=5,l=!1,h=null,u=!1,c=.8,d=0,p,_){let m;super(t),this.onLoadObservable=new N.Observable,this.boundingBoxPosition=el.Vector3.Zero(),this._rotationY=0,this._files=null,this._forcedExtension=null,this._extensions=null,this._textureMatrixRefraction=new el.Matrix,this._buffer=null,this.name=e,this.url=e,this._noMipmap=n,this.hasAlpha=!1,this.isCube=!0,this._textureMatrix=el.Matrix.Identity(),this.coordinatesMode=ep.Texture.CUBIC_MODE;let f=null;if(null===s||Array.isArray(s)?(this._noMipmap=n,this._format=r,this._createPolynomials=u,m=s,this._loaderOptions=p,this._useSRGBBuffer=_,this._lodScale=c,this._lodOffset=d):(m=s.extensions??null,this._noMipmap=s.noMipmap??!1,o=s.files??null,f=s.buffer??null,this._format=s.format??5,l=s.prefiltered??!1,h=s.forcedExtension??null,this._createPolynomials=s.createPolynomials??!1,this._lodScale=s.lodScale??.8,this._lodOffset=s.lodOffset??0,this._loaderOptions=s.loaderOptions,this._useSRGBBuffer=s.useSRGBBuffer,this._sphericalPolynomialTargetSize=s.sphericalPolynomialTargetSize??0,a=s.onLoad??null,i=s.onError??null),!e&&!o)return;this.updateURL(e,h,a,l,i,m,this.getScene()?.useDelayedTextureLoading,o,f)}getClassName(){return"CubeTexture"}updateURL(e,t=null,s=null,n=!1,o=null,a=null,i=!1,r=null,l=null){(!this.name||this.name.startsWith("data:"))&&(this.name=e),this.url=e,t&&(this._forcedExtension=t);let h=e.lastIndexOf("."),u=t||(h>-1?e.substring(h).toLowerCase():""),c=0===u.indexOf(".dds"),d=0===u.indexOf(".env"),p=0===u.indexOf(".basis");if(d?(this.gammaSpace=!1,this._prefiltered=!1,this.anisotropicFilteringLevel=1):(this._prefiltered=n,n&&(this.gammaSpace=!1,this.anisotropicFilteringLevel=1)),r)this._files=r;else if(p||d||c||a||(a=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),this._files=this._files||[],this._files.length=0,a){for(let t=0;t<a.length;t++)this._files.push(e+a[t]);this._extensions=a}this._buffer=l,i?(this.delayLoadState=4,this._delayedOnLoad=s,this._delayedOnError=o):this._loadTexture(s,o)}delayLoad(e){4===this.delayLoadState&&(e&&(this._forcedExtension=e),this.delayLoadState=1,this._loadTexture(this._delayedOnLoad,this._delayedOnError))}getReflectionTextureMatrix(){return this._textureMatrix}setReflectionTextureMatrix(e){if(e.updateFlag===this._textureMatrix.updateFlag||(e.isIdentity()!==this._textureMatrix.isIdentity()&&this.getScene()?.markAllMaterialsAsDirty(1,e=>-1!==e.getActiveTextures().indexOf(this)),this._textureMatrix=e,!this.getScene()?.useRightHandedSystem))return;let t=el.TmpVectors.Vector3[0],s=el.TmpVectors.Quaternion[0],n=el.TmpVectors.Vector3[1];this._textureMatrix.decompose(t,s,n),s.z*=-1,s.w*=-1,el.Matrix.ComposeToRef(t,s,n,this._textureMatrixRefraction)}getRefractionTextureMatrix(){return this.getScene()?.useRightHandedSystem?this._textureMatrixRefraction:this._textureMatrix}_loadTexture(e=null,t=null){let s=this.getScene(),n=this._texture;this._texture=this._getFromCache(this.url,this._noMipmap,void 0,void 0,this._useSRGBBuffer,this.isCube);let o=()=>{this.onLoadObservable.notifyObservers(this),n&&(n.dispose(),this.getScene()?.markAllMaterialsAsDirty(1)),e&&e()},a=(e,s)=>{this._loadingError=!0,this._errorObject={message:e,exception:s},t&&t(e,s),ep.Texture.OnTextureLoadErrorObservable.notifyObservers(this)};this._texture?this._texture.isReady?tC.TimingTools.SetImmediate(()=>o()):this._texture.onLoadedObservable.add(()=>o()):(this._prefiltered?this._texture=this._getEngine().createPrefilteredCubeTexture(this.url,s,this._lodScale,this._lodOffset,e,a,this._format,this._forcedExtension,this._createPolynomials):this._texture=this._getEngine().createCubeTexture(this.url,s,this._files,this._noMipmap,e,a,this._format,this._forcedExtension,!1,this._lodScale,this._lodOffset,null,this._loaderOptions,!!this._useSRGBBuffer,this._buffer),this._texture?.onLoadedObservable.add(()=>this.onLoadObservable.notifyObservers(this)))}clone(){let e=0,t=this.irradianceTexture,s=to.SerializationHelper.Clone(()=>{let t=new tS(this.url,this.getScene()||this._getEngine(),this._extensions,this._noMipmap,this._files);return e=t.uniqueId,t},this);return s.uniqueId=e,t&&!this.irradianceTexture&&(this.irradianceTexture=t),s}}(0,eS.__decorate)([(0,eE.serialize)()],tS.prototype,"url",void 0),(0,eS.__decorate)([(0,eE.serializeAsVector3)()],tS.prototype,"boundingBoxPosition",void 0),(0,eS.__decorate)([(0,eE.serializeAsVector3)()],tS.prototype,"boundingBoxSize",null),(0,eS.__decorate)([(0,eE.serialize)("rotationY")],tS.prototype,"rotationY",null),(0,eS.__decorate)([(0,eE.serialize)("files")],tS.prototype,"_files",void 0),(0,eS.__decorate)([(0,eE.serialize)("forcedExtension")],tS.prototype,"_forcedExtension",void 0),(0,eS.__decorate)([(0,eE.serialize)("extensions")],tS.prototype,"_extensions",void 0),(0,eS.__decorate)([(0,eE.serializeAsMatrix)("textureMatrix")],tS.prototype,"_textureMatrix",void 0),(0,eS.__decorate)([(0,eE.serializeAsMatrix)("textureMatrixRefraction")],tS.prototype,"_textureMatrixRefraction",void 0);class tE extends tS{constructor(e,t,s,n=5,o=0,a=!1,i=!1,r=3,l=null){super("",e),this._texture=e.getEngine().createRawCubeTexture(t,s,n,o,a,i,r,l)}update(e,t,s,n,o=null){this._texture.getEngine().updateRawCubeTexture(this._texture,e,t,s,n,o)}updateRGBDAsync(e,t=null,s=.8,n=0){return(0,tM._UpdateRGBDAsync)(this._texture,e,t,s,n).then(()=>{})}clone(){return to.SerializationHelper.Clone(()=>{let e=this.getScene(),t=this._texture,s=new tE(e,t._bufferViewArray,t.width,t.format,t.type,t.generateMipMaps,t.invertY,t.samplingMode,t._compression);return 13===t.source&&s.updateRGBDAsync(t._bufferViewArrayArray,t._sphericalPolynomial,t._lodGenerationScale,t._lodGenerationOffset),s},this)}}let tO="EXT_lights_image_based";class tN{constructor(e){this.name=tO,this._loader=e,this.enabled=this._loader.isExtensionUsed(tO)}dispose(){this._loader=null,delete this._lights}onLoading(){let e=this._loader.gltf.extensions;if(e&&e[this.name]){let t=e[this.name];this._lights=t.lights}}loadSceneAsync(e,t){return tT.LoadExtensionAsync(e,t,this.name,async(s,n)=>{this._loader._allMaterialsDirtyRequired=!0;let o=[];o.push(this._loader.loadSceneAsync(e,t)),this._loader.logOpen(`${s}`);let a=ty.Get(`${s}/light`,this._lights,n.light);return o.push(this._loadLightAsync(`/extensions/${this.name}/lights/${n.light}`,a).then(e=>{this._loader.babylonScene.environmentTexture=e})),this._loader.logClose(),await Promise.all(o).then(()=>{})})}_loadLightAsync(e,t){if(!t._loaded){let s=[];this._loader.logOpen(`${e}`);let n=Array(t.specularImages.length);for(let o=0;o<t.specularImages.length;o++){let a=t.specularImages[o];n[o]=Array(a.length);for(let t=0;t<a.length;t++){let i=`${e}/specularImages/${o}/${t}`;this._loader.logOpen(`${i}`);let r=a[t],l=ty.Get(i,this._loader.gltf.images,r);s.push(this._loader.loadImageAsync(`/images/${r}`,l).then(e=>{n[o][t]=e})),this._loader.logClose()}}this._loader.logClose(),t._loaded=Promise.all(s).then(async()=>{let s=new tE(this._loader.babylonScene,null,t.specularImageSize);if(s.name=t.name||"environment",t._babylonTexture=s,void 0!=t.intensity&&(s.level=t.intensity),t.rotation){let e=el.Quaternion.FromArray(t.rotation);this._loader.babylonScene.useRightHandedSystem||(e=el.Quaternion.Inverse(e)),el.Matrix.FromQuaternionToRef(e,s.getReflectionTextureMatrix())}if(!t.irradianceCoefficients)throw Error(`${e}: Irradiance coefficients are missing`);let o=tv.SphericalHarmonics.FromArray(t.irradianceCoefficients);o.scaleInPlace(t.intensity),o.convertIrradianceToLambertianRadiance();let a=tv.SphericalPolynomial.FromHarmonics(o),i=(n.length-1)/Math.log2(t.specularImageSize);return await s.updateRGBDAsync(n,a,i)})}return t._loaded.then(()=>t._babylonTexture)}}tp(tO),td(tO,!0,e=>new tN(e)),e.s(["EXT_lights_image_based",0,tN],27684),e.i(7549);let tI="EXT_mesh_gpu_instancing";class tB{constructor(e){this.name=tI,this._loader=e,this.enabled=this._loader.isExtensionUsed(tI)}dispose(){this._loader=null}loadNodeAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(e,n)=>{this._loader._disableInstancedMesh++;let o=this._loader.loadNodeAsync(`/nodes/${t.index}`,t,s);if(this._loader._disableInstancedMesh--,!t._primitiveBabylonMeshes)return await o;let a=[],i=0,r=t=>{if(void 0==n.attributes[t])return void a.push(Promise.resolve(null));let s=ty.Get(`${e}/attributes/${t}`,this._loader.gltf.accessors,n.attributes[t]);if(a.push(this._loader._loadFloatAccessorAsync(`/accessors/${s.bufferView}`,s)),0===i)i=s.count;else if(i!==s.count)throw Error(`${e}/attributes: Instance buffer accessors do not have the same count.`)};return r("TRANSLATION"),r("ROTATION"),r("SCALE"),r("_COLOR_0"),await o.then(async e=>{let[s,n,o,r]=await Promise.all(a),l=new Float32Array(16*i);el.TmpVectors.Vector3[0].copyFromFloats(0,0,0),el.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),el.TmpVectors.Vector3[1].copyFromFloats(1,1,1);for(let e=0;e<i;++e)s&&el.Vector3.FromArrayToRef(s,3*e,el.TmpVectors.Vector3[0]),n&&el.Quaternion.FromArrayToRef(n,4*e,el.TmpVectors.Quaternion[0]),o&&el.Vector3.FromArrayToRef(o,3*e,el.TmpVectors.Vector3[1]),el.Matrix.ComposeToRef(el.TmpVectors.Vector3[1],el.TmpVectors.Quaternion[0],el.TmpVectors.Vector3[0],el.TmpVectors.Matrix[0]),el.TmpVectors.Matrix[0].copyToArray(l,16*e);for(let e of t._primitiveBabylonMeshes)e.thinInstanceSetBuffer("matrix",l,16,!0),r&&(r.length===3*i?e.thinInstanceSetBuffer("color",r,3,!0):r.length===4*i?e.thinInstanceSetBuffer("color",r,4,!0):L.Logger.Warn("Unexpected size of _COLOR_0 attribute for mesh "+e.name));return e})})}}tp(tI),td(tI,!0,e=>new tB(e)),e.s(["EXT_mesh_gpu_instancing",0,tB],6934);let tk=0,tR=null;class tP{static get Default(){return tP._Default||(tP._Default=new tP),tP._Default}constructor(){const e=tP.Configuration.decoder;this._decoderModulePromise=I.Tools.LoadBabylonScriptAsync(e.url).then(()=>MeshoptDecoder.ready)}dispose(){delete this._decoderModulePromise}async decodeGltfBufferAsync(e,t,s,n,o){await this._decoderModulePromise,0===tk&&(MeshoptDecoder.useWorkers(1),tk=1);let a=await MeshoptDecoder.decodeGltfBufferAsync(t,s,e,n,o);return null!==tR&&clearTimeout(tR),tR=setTimeout(()=>{MeshoptDecoder.useWorkers(0),tk=0,tR=null},1e3),a}}tP.Configuration={decoder:{url:`${I.Tools._DefaultCdnUrl}/meshopt_decoder.js`}},tP._Default=null;let tL="EXT_meshopt_compression";class tG{constructor(e){this.name=tL,this.enabled=e.isExtensionUsed(tL),this._loader=e}dispose(){this._loader=null}loadBufferViewAsync(e,t){return tT.LoadExtensionAsync(e,t,this.name,async(s,n)=>{if(t._meshOptData)return await t._meshOptData;let o=ty.Get(`${e}/buffer`,this._loader.gltf.buffers,n.buffer);return t._meshOptData=this._loader.loadBufferAsync(`/buffers/${o.index}`,o,n.byteOffset||0,n.byteLength).then(async e=>await tP.Default.decodeGltfBufferAsync(e,n.count,n.byteStride,n.mode,n.filter)),await t._meshOptData})}}tp(tL),td(tL,!0,e=>new tG(e)),e.s(["EXT_meshopt_compression",0,tG],58348);let tD="EXT_texture_webp";class tV{constructor(e){this.name=tD,this._loader=e,this.enabled=e.isExtensionUsed(tD)}dispose(){this._loader=null}_loadTextureAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=void 0==t.sampler?tT.DefaultSampler:ty.Get(`${e}/sampler`,this._loader.gltf.samplers,t.sampler),i=ty.Get(`${n}/source`,this._loader.gltf.images,o.source);return await this._loader._createTextureAsync(e,a,i,e=>{s(e)},void 0,!t._textureInfo.nonColorData)})}}tp(tD),td(tD,!0,e=>new tV(e)),e.s(["EXT_texture_webp",0,tV],79487);let tU="EXT_texture_avif";class tK{constructor(e){this.name=tU,this._loader=e,this.enabled=e.isExtensionUsed(tU)}dispose(){this._loader=null}_loadTextureAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=void 0==t.sampler?tT.DefaultSampler:ty.Get(`${e}/sampler`,this._loader.gltf.samplers,t.sampler),i=ty.Get(`${n}/source`,this._loader.gltf.images,o.source);return await this._loader._createTextureAsync(e,a,i,e=>{s(e)},void 0,!t._textureInfo.nonColorData)})}}tp(tU),td(tU,!0,e=>new tK(e)),e.s(["EXT_texture_avif",0,tK],45462);let tH="EXT_lights_ies";class t${constructor(e){this.name=tH,this._loader=e,this.enabled=this._loader.isExtensionUsed(tH)}dispose(){this._loader=null,delete this._lights}onLoading(){let e=this._loader.gltf.extensions;if(e&&e[this.name]){let t=e[this.name];this._lights=t.lights,ty.Assign(this._lights)}}loadNodeAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a,i,r;this._loader._allMaterialsDirtyRequired=!0;let l=await this._loader.loadNodeAsync(e,t,e=>{let t=(i=ty.Get(n,this._lights,o.light)).name||e.name;this._loader.babylonScene._blockEntityCollection=!!this._loader._assetContainer,(a=new eG.SpotLight(t,el.Vector3.Zero(),el.Vector3.Backward(),0,1,this._loader.babylonScene)).angle=Math.PI/2,a.innerAngle=0,a._parentContainer=this._loader._assetContainer,this._loader.babylonScene._blockEntityCollection=!1,i._babylonLight=a,a.falloffType=V.Light.FALLOFF_GLTF,a.diffuse=o.color?eh.Color3.FromArray(o.color):eh.Color3.White(),a.intensity=o.multiplier||1,a.range=Number.MAX_VALUE,a.parent=e,this._loader._babylonLights.push(a),tT.AddPointerMetadata(a,n),s(e)});if(i.uri)r=await this._loader.loadUriAsync(e,i,i.uri);else{let t=ty.Get(`${e}/bufferView`,this._loader.gltf.bufferViews,i.bufferView);r=await this._loader.loadBufferViewAsync(`/bufferViews/${t.index}`,t)}return a.iesProfileTexture=new ep.Texture(name+"_iesProfile",this._loader.babylonScene,!0,!1,void 0,null,null,r,!0,void 0,void 0,void 0,void 0,".ies"),l})}}tp(tH),td(tH,!0,e=>new t$(e)),e.s(["EXT_lights_ies",0,t$],80866);var tz=e.i(21143);function tq(e,t,s,n,o){let a=null,i=null,r=null;try{let l;a=new e.Decoder,(i=new e.DecoderBuffer).Init(t,t.byteLength);let h=a.GetEncodedGeometryType(i);switch(h){case e.TRIANGULAR_MESH:{let t=new e.Mesh;if(!(l=a.DecodeBufferToMesh(i,t)).ok()||0===t.ptr)throw Error(l.error_msg());let s=t.num_faces(),o=3*s,h=4*o,u=e._malloc(h);try{a.GetTrianglesUInt32Array(t,h,u);let s=new Uint32Array(o);s.set(new Uint32Array(e.HEAPF32.buffer,u,o)),n(s)}finally{e._free(u)}r=t;break}case e.POINT_CLOUD:{let t=new e.PointCloud;if(!(l=a.DecodeBufferToPointCloud(i,t)).ok()||!t.ptr)throw Error(l.error_msg());r=t;break}default:throw Error(`Draco: Cannot decode invalid geometry type ${h}`)}let u=r.num_points(),c=(t,s,n,a)=>{let i=a.data_type(),r=a.num_components(),l=a.normalized(),h=a.byte_stride(),c=a.byte_offset(),d={[e.DT_FLOAT32]:{typedArrayConstructor:Float32Array,heap:e.HEAPF32},[e.DT_INT8]:{typedArrayConstructor:Int8Array,heap:e.HEAP8},[e.DT_INT16]:{typedArrayConstructor:Int16Array,heap:e.HEAP16},[e.DT_INT32]:{typedArrayConstructor:Int32Array,heap:e.HEAP32},[e.DT_UINT8]:{typedArrayConstructor:Uint8Array,heap:e.HEAPU8},[e.DT_UINT16]:{typedArrayConstructor:Uint16Array,heap:e.HEAPU16},[e.DT_UINT32]:{typedArrayConstructor:Uint32Array,heap:e.HEAPU32}}[i];if(!d)throw Error(`Draco: Cannot decode invalid data type ${i}`);let p=u*r,_=p*d.typedArrayConstructor.BYTES_PER_ELEMENT,m=e._malloc(_);try{t.GetAttributeDataArrayForAllPoints(s,a,i,_,m);let e=new d.typedArrayConstructor(d.heap.buffer,m,p);o(n,e.slice(),r,c,h,l)}finally{e._free(m)}};if(s)for(let e in s){let t=s[e],n=a.GetAttributeByUniqueId(r,t);c(a,r,e,n)}else{let t={position:e.POSITION,normal:e.NORMAL,color:e.COLOR,uv:e.TEX_COORD};for(let e in t){let s=a.GetAttributeId(r,t[e]);if(-1!==s){let t=a.GetAttribute(r,s);c(a,r,e,t)}}}return u}finally{r&&e.destroy(r),i&&e.destroy(i),a&&e.destroy(a)}}function tW(){let e;onmessage=t=>{let s=t.data;switch(s.id){case"init":s.url&&importScripts(s.url),e=DracoDecoderModule(s.wasmBinary?{wasmBinary:s.wasmBinary}:{}),postMessage({id:"initDone"});break;case"decodeMesh":if(!e)throw Error("Draco: Decoder module is not available");e.then(e=>{let t=tq(e,s.dataView,s.attributes,e=>{postMessage({id:"indices",data:e},[e.buffer])},(e,t,s,n,o,a)=>{postMessage({id:"attribute",kind:e,data:t,size:s,byteOffset:n,byteStride:o,normalized:a},[t.buffer])});postMessage({id:"decodeMeshDone",totalVertices:t})})}}}async function tj(e,t,s){return await new Promise((n,o)=>{let a=t=>{e.removeEventListener("error",a),e.removeEventListener("message",i),o(t)},i=t=>{"initDone"===t.data.id&&(e.removeEventListener("error",a),e.removeEventListener("message",i),n(e))};if(e.addEventListener("error",a),e.addEventListener("message",i),t){let n=t.slice(0);e.postMessage({id:"init",url:s,wasmBinary:n},[n])}else e.postMessage({id:"init",url:s})})}class tY{constructor(e){if(e.workerPool){this._workerPoolPromise=Promise.resolve(e.workerPool);return}const t=e.wasmBinary,s=e.numWorkers??("object"==typeof navigator&&navigator.hardwareConcurrency?Math.min(Math.floor(.5*navigator.hardwareConcurrency),4):1),n=s&&"function"==typeof Worker&&"function"==typeof URL,o=n||!e.jsModule,a=e.wasmUrl&&e.wasmBinaryUrl&&"object"==typeof WebAssembly?{url:o?I.Tools.GetBabylonScriptURL(e.wasmUrl,!0):"",wasmBinaryPromise:t?Promise.resolve(t):I.Tools.LoadFileAsync(I.Tools.GetBabylonScriptURL(e.wasmBinaryUrl,!0))}:{url:o?I.Tools.GetBabylonScriptURL(e.fallbackUrl):"",wasmBinaryPromise:Promise.resolve(void 0)};n?this._workerPoolPromise=a.wasmBinaryPromise.then(e=>{let t=this._getWorkerContent(),n=URL.createObjectURL(new Blob([t],{type:"application/javascript"}));return new tz.AutoReleaseWorkerPool(s,()=>tj(new Worker(n),e,a.url))}):this._modulePromise=a.wasmBinaryPromise.then(async t=>{if(!this._isModuleAvailable()&&!e.jsModule){if(!a.url)throw Error("Draco codec module is not available");await I.Tools.LoadBabylonScriptAsync(a.url)}return await this._createModuleAsync(t,e.jsModule)})}async whenReadyAsync(){this._workerPoolPromise?await this._workerPoolPromise:this._modulePromise&&await this._modulePromise}dispose(){this._workerPoolPromise&&this._workerPoolPromise.then(e=>{e.dispose()}),delete this._workerPoolPromise,delete this._modulePromise}}class tQ extends tY{static get DefaultAvailable(){var e;return!!((e=tQ.DefaultConfiguration).wasmUrl&&(e.wasmBinary||e.wasmBinaryUrl)&&"object"==typeof WebAssembly||e.fallbackUrl)}static get Default(){return tQ._Default??(tQ._Default=new tQ),tQ._Default}static ResetDefault(e){tQ._Default&&(e||tQ._Default.dispose(),tQ._Default=null)}_isModuleAvailable(){return"u">typeof DracoDecoderModule}async _createModuleAsync(e,t){return{module:await (t||DracoDecoderModule)({wasmBinary:e})}}_getWorkerContent(){return`${tq}(${tW})()`}constructor(e=tQ.DefaultConfiguration){super(e)}decodeMeshToMeshDataAsync(e,t,s){let n=e instanceof ArrayBuffer?new Int8Array(e):new Int8Array(e.buffer,e.byteOffset,e.byteLength);if(this._workerPoolPromise)return this._workerPoolPromise.then(async e=>await new Promise((o,a)=>{e.push((e,i)=>{let r=null,l=[],h=t=>{e.removeEventListener("error",h),e.removeEventListener("message",u),a(t),i()},u=t=>{let n=t.data;switch(n.id){case"indices":r=n.data;break;case"attribute":var a,c;l.push({kind:n.kind,data:n.data,size:n.size,byteOffset:n.byteOffset,byteStride:n.byteStride,normalized:(a=n.kind,c=n.normalized,s&&void 0!==s[a]?(c!==s[a]&&L.Logger.Warn(`Normalized flag from Draco data (${c}) does not match normalized flag from glTF accessor (${s[a]}). Using flag from glTF accessor.`),s[a]):c)});break;case"decodeMeshDone":e.removeEventListener("error",h),e.removeEventListener("message",u),o({indices:r,attributes:l,totalVertices:n.totalVertices}),i()}};e.addEventListener("error",h),e.addEventListener("message",u);let c=n.slice();e.postMessage({id:"decodeMesh",dataView:c,attributes:t},[c.buffer])})}));if(this._modulePromise)return this._modulePromise.then(e=>{let s=null,o=[],a=tq(e.module,n,t,e=>{s=e},(e,t,s,n,a,i)=>{o.push({kind:e,data:t,size:s,byteOffset:n,byteStride:a,normalized:i})});return{indices:s,attributes:o,totalVertices:a}});throw Error("Draco: Decoder module is not available")}async decodeMeshToGeometryAsync(e,t,s,n){let o=await this.decodeMeshToMeshDataAsync(s,n),a=new eM.Geometry(e,t);for(let e of(o.indices&&a.setIndices(o.indices),o.attributes))a.setVerticesBuffer(new ev.VertexBuffer(t.getEngine(),e.data,e.kind,!1,void 0,e.byteStride,void 0,e.byteOffset,e.size,void 0,e.normalized,!0),o.totalVertices);return a}async _decodeMeshToGeometryForGltfAsync(e,t,s,n,o,a){let i=await this.decodeMeshToMeshDataAsync(s,n,o),r=new eM.Geometry(e,t);for(let e of(a&&(r._boundingInfo=a,r.useBoundingInfoFromGeometry=!0),i.indices&&r.setIndices(i.indices),i.attributes))r.setVerticesBuffer(new ev.VertexBuffer(t.getEngine(),e.data,e.kind,!1,void 0,e.byteStride,void 0,e.byteOffset,e.size,void 0,e.normalized,!0),i.totalVertices);return r}}tQ.DefaultConfiguration={wasmUrl:`${I.Tools._DefaultCdnUrl}/draco_wasm_wrapper_gltf.js`,wasmBinaryUrl:`${I.Tools._DefaultCdnUrl}/draco_decoder_gltf.wasm`,fallbackUrl:`${I.Tools._DefaultCdnUrl}/draco_decoder_gltf.js`},tQ._Default=null;let tZ="KHR_draco_mesh_compression";class tX{constructor(e){this.name=tZ,this.useNormalizedFlagFromAccessor=!0,this._loader=e,this.enabled=tQ.DefaultAvailable&&this._loader.isExtensionUsed(tZ)}dispose(){delete this.dracoDecoder,this._loader=null}_loadVertexDataAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{if(void 0!=t.mode&&4!==t.mode&&5!==t.mode)throw Error(`${e}: Unsupported mode ${t.mode}`);let a={},i={},r=(e,n)=>{let r=o.attributes[e];if(void 0!=r&&(s._delayInfo=s._delayInfo||[],-1===s._delayInfo.indexOf(n)&&s._delayInfo.push(n),a[n]=r,this.useNormalizedFlagFromAccessor)){let s=ty.TryGet(this._loader.gltf.accessors,t.attributes[e]);s&&(i[n]=s.normalized||!1)}};r("POSITION",ev.VertexBuffer.PositionKind),r("NORMAL",ev.VertexBuffer.NormalKind),r("TANGENT",ev.VertexBuffer.TangentKind),r("TEXCOORD_0",ev.VertexBuffer.UVKind),r("TEXCOORD_1",ev.VertexBuffer.UV2Kind),r("TEXCOORD_2",ev.VertexBuffer.UV3Kind),r("TEXCOORD_3",ev.VertexBuffer.UV4Kind),r("TEXCOORD_4",ev.VertexBuffer.UV5Kind),r("TEXCOORD_5",ev.VertexBuffer.UV6Kind),r("JOINTS_0",ev.VertexBuffer.MatricesIndicesKind),r("WEIGHTS_0",ev.VertexBuffer.MatricesWeightsKind),r("COLOR_0",ev.VertexBuffer.ColorKind);let l=ty.Get(n,this._loader.gltf.bufferViews,o.bufferView);return l._dracoBabylonGeometry||(l._dracoBabylonGeometry=this._loader.loadBufferViewAsync(`/bufferViews/${l.index}`,l).then(async n=>{let o=this.dracoDecoder||tQ.Default,r=ty.TryGet(this._loader.gltf.accessors,t.attributes.POSITION),l=this._loader.parent.alwaysComputeBoundingBox||s.skeleton||!r?null:tb(r);return await o._decodeMeshToGeometryForGltfAsync(s.name,this._loader.babylonScene,n,a,i,l).catch(t=>{throw Error(`${e}: ${t.message}`)})})),await l._dracoBabylonGeometry})}}tp(tZ),td(tZ,!0,e=>new tX(e)),e.s(["KHR_draco_mesh_compression",0,tX],43060);let tJ="KHR_lights_punctual";class t0{constructor(e){this.name=tJ,this._loader=e,this.enabled=this._loader.isExtensionUsed(tJ)}dispose(){this._loader=null,delete this._lights}onLoading(){let e=this._loader.gltf.extensions;if(e&&e[this.name]){let t=e[this.name];this._lights=t.lights,ty.Assign(this._lights)}}loadNodeAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>(this._loader._allMaterialsDirtyRequired=!0,await this._loader.loadNodeAsync(e,t,e=>{let t,a=ty.Get(n,this._lights,o.light),i=a.name||e.name;switch(this._loader.babylonScene._blockEntityCollection=!!this._loader._assetContainer,a.type){case"directional":{let e=new eB(i,el.Vector3.Backward(),this._loader.babylonScene);e.position.setAll(0),t=e;break}case"point":t=new eP(i,el.Vector3.Zero(),this._loader.babylonScene);break;case"spot":{let e=new eG.SpotLight(i,el.Vector3.Zero(),el.Vector3.Backward(),0,1,this._loader.babylonScene);e.angle=2*(a.spot&&a.spot.outerConeAngle||Math.PI/4),e.innerAngle=2*(a.spot&&a.spot.innerConeAngle||0),t=e;break}default:throw this._loader.babylonScene._blockEntityCollection=!1,Error(`${n}: Invalid light type (${a.type})`)}t._parentContainer=this._loader._assetContainer,this._loader.babylonScene._blockEntityCollection=!1,a._babylonLight=t,t.falloffType=V.Light.FALLOFF_GLTF,t.diffuse=a.color?eh.Color3.FromArray(a.color):eh.Color3.White(),t.intensity=void 0==a.intensity?1:a.intensity,t.range=void 0==a.range?Number.MAX_VALUE:a.range,t.parent=e,this._loader._babylonLights.push(t),tT.AddPointerMetadata(t,n),s(e)})))}}tp(tJ),td(tJ,!0,e=>new t0(e)),e.s(["KHR_lights",0,t0],57050);var t1=V;async function t3(){let e=new Uint16Array(16384),t=new Uint16Array(16384),s=new Uint16Array(await I.Tools.LoadFileAsync(I.Tools.GetAssetUrl("https://assets.babylonjs.com/core/areaLights/areaLightsLTC.bin"))),n=s.length/8;for(let o=0;o<n;o++)e[4*o]=s[8*o],e[4*o+1]=s[8*o+1],e[4*o+2]=s[8*o+2],e[4*o+3]=s[8*o+3],t[4*o]=s[8*o+4],t[4*o+1]=s[8*o+5],t[4*o+2]=s[8*o+6],t[4*o+3]=s[8*o+7];return[e,t]}class t2 extends t1.Light{constructor(e,t,s,n){super(e,s,n),this.position=t,this._scene._ltcTextures||function(e){let t=e.useDelayedTextureLoading;e.useDelayedTextureLoading=!1;let s=e._blockEntityCollection;e._blockEntityCollection=!1,e._ltcTextures={LTC1:e_.CreateRGBATexture(null,64,64,e.getEngine(),!1,!1,2,2,0,!1,!0),LTC2:e_.CreateRGBATexture(null,64,64,e.getEngine(),!1,!1,2,2,0,!1,!0)},e._blockEntityCollection=s,e._ltcTextures.LTC1.wrapU=ep.Texture.CLAMP_ADDRESSMODE,e._ltcTextures.LTC1.wrapV=ep.Texture.CLAMP_ADDRESSMODE,e._ltcTextures.LTC2.wrapU=ep.Texture.CLAMP_ADDRESSMODE,e._ltcTextures.LTC2.wrapV=ep.Texture.CLAMP_ADDRESSMODE,e.useDelayedTextureLoading=t,t3().then(t=>{e._ltcTextures&&((e._ltcTextures?.LTC1).update(t[0]),(e._ltcTextures?.LTC2).update(t[1]),e.onDisposeObservable.addOnce(()=>{e._ltcTextures?.LTC1.dispose(),e._ltcTextures?.LTC2.dispose()}))}).catch(e=>{L.Logger.Error(`Area Light fail to get LTC textures data. Error: ${e}`)})}(this._scene)}transferTexturesToEffect(e,t){return this._scene._ltcTextures&&(e.setTexture("areaLightsLTC1Sampler",this._scene._ltcTextures.LTC1),e.setTexture("areaLightsLTC2Sampler",this._scene._ltcTextures.LTC2)),this}prepareLightSpecificDefines(e,t){e["AREALIGHT"+t]=!0,e.AREALIGHTUSED=!0}_isReady(){return!!this._scene._ltcTextures&&this._scene._ltcTextures.LTC1.isReady()&&this._scene._ltcTextures.LTC2.isReady()}}class t7 extends t2{get emissionTexture(){return this._emissionTextureTexture}set emissionTexture(e){this._emissionTextureTexture!==e&&(this._emissionTextureTexture=e,this._emissionTextureTexture&&(this._emissionTextureTexture.wrapU=0,this._emissionTextureTexture.wrapV=0),this._emissionTextureTexture&&t7._IsTexture(this._emissionTextureTexture)&&this._emissionTextureTexture.onLoadObservable.addOnce(()=>{this._markMeshesAsLightDirty()}))}get width(){return this._width.x}set width(e){this._width.x=e}get height(){return this._height.y}set height(e){this._height.y=e}constructor(e,t,s,n,o,a){super(e,t,o,a),this._emissionTextureTexture=null,this._width=new el.Vector3(s,0,0),this._height=new el.Vector3(0,n,0),this._pointTransformedPosition=el.Vector3.Zero(),this._pointTransformedWidth=el.Vector3.Zero(),this._pointTransformedHeight=el.Vector3.Zero()}getClassName(){return"RectAreaLight"}getTypeID(){return V.Light.LIGHTTYPEID_RECT_AREALIGHT}_buildUniformLayout(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightWidth",4),this._uniformBuffer.addUniform("vLightHeight",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()}_computeTransformedInformation(){return!!this.parent&&!!this.parent.getWorldMatrix&&(el.Vector3.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),this._pointTransformedPosition),el.Vector3.TransformNormalToRef(this._width,this.parent.getWorldMatrix(),this._pointTransformedWidth),el.Vector3.TransformNormalToRef(this._height,this.parent.getWorldMatrix(),this._pointTransformedHeight),!0)}static _IsTexture(e){return void 0!==e.onLoadObservable}transferToEffect(e,t){let s=this._scene.floatingOriginOffset;return this._computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this._pointTransformedPosition.x-s.x,this._pointTransformedPosition.y-s.y,this._pointTransformedPosition.z-s.z,0,t),this._uniformBuffer.updateFloat4("vLightWidth",this._pointTransformedWidth.x/2,this._pointTransformedWidth.y/2,this._pointTransformedWidth.z/2,0,t),this._uniformBuffer.updateFloat4("vLightHeight",this._pointTransformedHeight.x/2,this._pointTransformedHeight.y/2,this._pointTransformedHeight.z/2,0,t)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x-s.x,this.position.y-s.y,this.position.z-s.z,0,t),this._uniformBuffer.updateFloat4("vLightWidth",this._width.x/2,this._width.y/2,this._width.z/2,0,t),this._uniformBuffer.updateFloat4("vLightHeight",this._height.x/2,this._height.y/2,this._height.z/2,0,t)),this}transferTexturesToEffect(e,t){return super.transferTexturesToEffect(e,t),this._emissionTextureTexture&&this._emissionTextureTexture.isReady()&&e.setTexture("rectAreaLightEmissionTexture"+t,this._emissionTextureTexture),this}transferToNodeMaterialEffect(e,t){let s=this._scene.floatingOriginOffset;return this._computeTransformedInformation()?e.setFloat3(t,this._pointTransformedPosition.x-s.x,this._pointTransformedPosition.y-s.y,this._pointTransformedPosition.z-s.z):e.setFloat3(t,this.position.x-s.x,this.position.y-s.y,this.position.z-s.z),this}prepareLightSpecificDefines(e,t){super.prepareLightSpecificDefines(e,t),e["RECTAREALIGHTEMISSIONTEXTURE"+t]=!!(this._emissionTextureTexture&&this._emissionTextureTexture.isReady())}}(0,eS.__decorate)([(0,eE.serialize)()],t7.prototype,"width",null),(0,eS.__decorate)([(0,eE.serialize)()],t7.prototype,"height",null);let t4=!1;t4=!0,eN.Node.AddNodeConstructor("Light_Type_4",(e,t)=>()=>new t7(e,el.Vector3.Zero(),1,1,t)),(0,eI.RegisterClass)("BABYLON.RectAreaLight",t7);let t5="EXT_lights_area";class t8{constructor(e){this.name=t5,this._loader=e,this.enabled=this._loader.isExtensionUsed(t5)}dispose(){this._loader=null,delete this._lights}onLoading(){let e=this._loader.gltf.extensions;if(e&&e[this.name]){let t=e[this.name];this._lights=t.lights,ty.Assign(this._lights)}}loadNodeAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>(this._loader._allMaterialsDirtyRequired=!0,await this._loader.loadNodeAsync(e,t,e=>{let t,a=ty.Get(n,this._lights,o.light),i=a.name||e.name;this._loader.babylonScene._blockEntityCollection=!!this._loader._assetContainer;let r=void 0!==a.size?a.size:1;switch(a.type){case"rect":{let e=a.rect?.aspect!==void 0?a.rect.aspect*r:r;t=new t7(i,el.Vector3.Zero(),e,r,this._loader.babylonScene);break}case"disk":{let e=Math.sqrt(r*r*.25*Math.PI);t=new t7(i,el.Vector3.Zero(),e,e,this._loader.babylonScene);break}default:throw this._loader.babylonScene._blockEntityCollection=!1,Error(`${n}: Invalid area light type (${a.type})`)}t._parentContainer=this._loader._assetContainer,this._loader.babylonScene._blockEntityCollection=!1,a._babylonLight=t,t.falloffType=V.Light.FALLOFF_GLTF,t.diffuse=a.color?eh.Color3.FromArray(a.color):eh.Color3.White(),t.intensity=void 0==a.intensity?1:a.intensity;let l=new R.TransformNode(`${i}_orientation`,this._loader.babylonScene);l.rotationQuaternion=el.Quaternion.RotationAxis(el.Vector3.Up(),Math.PI),l.parent=e,t.parent=l,this._loader._babylonLights.push(t),tT.AddPointerMetadata(t,n),s(e)})))}}tp(t5),td(t5,!0,e=>new t8(e)),e.s(["EXT_lights_area",0,t8],70136);let t6="KHR_materials_pbrSpecularGlossiness";class t9{constructor(e){this.name=t6,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(t6)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialBasePropertiesAsync(e,t,s)),a.push(this._loadSpecularGlossinessPropertiesAsync(n,o,s)),this._loader.loadMaterialAlphaProperties(e,t,s),await Promise.all(a).then(()=>{})})}_loadSpecularGlossinessPropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[];return n.configureSpecularGlossiness(),t.diffuseFactor?(n.baseColor=eh.Color3.FromArray(t.diffuseFactor),s.alpha=t.diffuseFactor[3]):n.baseColor=eh.Color3.White(),n.specularColor=t.specularFactor?eh.Color3.FromArray(t.specularFactor):eh.Color3.White(),n.glossiness=void 0==t.glossinessFactor?1:t.glossinessFactor,t.diffuseTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/diffuseTexture`,t.diffuseTexture,e=>{e.name=`${s.name} (Diffuse)`,n.baseColorTexture=e})),t.specularGlossinessTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/specularGlossinessTexture`,t.specularGlossinessTexture,e=>{e.name=`${s.name} (Specular Glossiness)`,n.specularColorTexture=e})),Promise.all(o).then(()=>{})}}tp(t6),td(t6,!0,e=>new t9(e)),e.s(["KHR_materials_pbrSpecularGlossiness",0,t9],93230);let se="KHR_materials_unlit";class st{constructor(e){this.name=se,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(se)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async()=>await this._loadUnlitPropertiesAsync(e,t,s))}_loadUnlitPropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[],a=t.pbrMetallicRoughness;return a&&(a.baseColorFactor&&(n.baseColor=eh.Color3.FromArray(a.baseColorFactor),n.geometryOpacity=a.baseColorFactor[3]),a.baseColorTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/baseColorTexture`,a.baseColorTexture,e=>{e.name=`${s.name} (Base Color)`,n.baseColorTexture=e}))),n.isUnlit=!0,t.doubleSided&&(n.backFaceCulling=!1,n.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,t,s),Promise.all(o).then(()=>{})}}tp(se),td(se,!0,e=>new st(e)),e.s(["KHR_materials_unlit",0,st],31375);let ss="KHR_materials_clearcoat";class sn{constructor(e){this.name=ss,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(ss)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadClearCoatPropertiesAsync(n,o,s)),await Promise.all(a)})}_loadClearCoatPropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[];return n.configureCoat(),n.coatWeight=void 0!==t.clearcoatFactor?t.clearcoatFactor:0,n.coatRoughness=void 0!==t.clearcoatRoughnessFactor?t.clearcoatRoughnessFactor:0,t.clearcoatTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/clearcoatTexture`,t.clearcoatTexture,e=>{e.name=`${s.name} (ClearCoat)`,n.coatWeightTexture=e})),t.clearcoatRoughnessTexture&&(t.clearcoatRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync(`${e}/clearcoatRoughnessTexture`,t.clearcoatRoughnessTexture,e=>{e.name=`${s.name} (ClearCoat Roughness)`,n.coatRoughnessTexture=e}))),t.clearcoatNormalTexture&&(t.clearcoatNormalTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync(`${e}/clearcoatNormalTexture`,t.clearcoatNormalTexture,e=>{e.name=`${s.name} (ClearCoat Normal)`,n.geometryCoatNormalTexture=e,t.clearcoatNormalTexture?.scale!=void 0&&(n.geometryCoatNormalTextureScale=t.clearcoatNormalTexture.scale)})),n.setNormalMapInversions(!s.getScene().useRightHandedSystem,s.getScene().useRightHandedSystem)),Promise.all(o).then(()=>{})}}tp(ss),td(ss,!0,e=>new sn(e)),e.s(["KHR_materials_clearcoat",0,sn],74303);let so="KHR_materials_coat";class sa{constructor(e){this.name=so,this.order=191,this.useOpenPBR=!1,this._loader=e,this.enabled=this._loader.isExtensionUsed(so)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),t.extensions&&t.extensions.KHR_materials_openpbr&&(this.useOpenPBR=!0),a.push(this._loadCoatPropertiesAsync(n,o,s)),await Promise.all(a)})}_loadCoatPropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[];n.configureCoat(),n.coatWeight=void 0!==t.coatFactor?t.coatFactor:0,n.coatRoughness=void 0!==t.coatRoughnessFactor?t.coatRoughnessFactor:0,t.coatTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/coatTexture`,t.coatTexture,e=>{e.name=`${s.name} (Coat)`,n.coatWeightTexture=e})),t.coatRoughnessTexture&&(t.coatRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync(`${e}/coatRoughnessTexture`,t.coatRoughnessTexture,e=>{e.name=`${s.name} (Coat Roughness)`,n.coatRoughnessTexture=e}))),t.coatNormalTexture&&(t.coatNormalTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync(`${e}/coatNormalTexture`,t.coatNormalTexture,e=>{e.name=`${s.name} (Coat Normal)`,n.geometryCoatNormalTexture=e,t.coatNormalTexture?.scale!=void 0&&(n.geometryCoatNormalTextureScale=t.coatNormalTexture.scale)})),n.setNormalMapInversions(!s.getScene().useRightHandedSystem,s.getScene().useRightHandedSystem)),n.coatDarkening=void 0!==t.coatDarkeningFactor?t.coatDarkeningFactor:1,n.coatIor=void 0!==t.coatIor?t.coatIor:1.5;let a=eh.Color3.White();void 0!==t.coatColorFactor&&a.fromArray(t.coatColorFactor),n.coatColor=a,t.coatColorTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/coatColorTexture`,t.coatColorTexture,e=>{e.name=`${s.name} (Coat Color)`,n.coatColorTexture=e}));let i=t.coatAnisotropyStrength??0,r=t.coatAnisotropyRotation??0;return n.coatRoughnessAnisotropy=i,n.geometryCoatTangentAngle=r,this.useOpenPBR||n.configureGltfStyleAnisotropy(!0),t.coatAnisotropyTexture&&(t.coatAnisotropyTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync(`${e}/coatAnisotropyTexture`,t.coatAnisotropyTexture,e=>{e.name=`${s.name} (Coat Anisotropy)`,n.geometryCoatTangentTexture=e}))),Promise.all(o).then(()=>{})}}tp(so),td(so,!0,e=>new sa(e)),e.s(["KHR_materials_coat",0,sa],13995);let si="KHR_materials_iridescence";class sr{constructor(e){this.name=si,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(si)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadIridescencePropertiesAsync(n,o,s)),await Promise.all(a).then(()=>{})})}_loadIridescencePropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[];return n.thinFilmWeight=t.iridescenceFactor??0,n.thinFilmIor=t.iridescenceIor??t.iridescenceIOR??1.3,n.thinFilmThicknessMinimum=t.iridescenceThicknessMinimum??100,n.thinFilmThicknessMaximum=t.iridescenceThicknessMaximum??400,t.iridescenceTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/iridescenceTexture`,t.iridescenceTexture,e=>{e.name=`${s.name} (Iridescence)`,n.thinFilmWeightTexture=e})),t.iridescenceThicknessTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/iridescenceThicknessTexture`,t.iridescenceThicknessTexture,e=>{e.name=`${s.name} (Iridescence Thickness)`,n.thinFilmThicknessTexture=e})),Promise.all(o).then(()=>{})}}tp(si),td(si,!0,e=>new sr(e)),e.s(["KHR_materials_iridescence",0,sr],95671);let sl="KHR_materials_anisotropy";class sh{constructor(e){this.name=sl,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(sl)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadAnisotropyPropertiesAsync(n,o,s)),await Promise.all(a)})}async _loadAnisotropyPropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[],a=t.anisotropyStrength??0,i=t.anisotropyRotation??0;n.specularRoughnessAnisotropy=a,n.geometryTangentAngle=i;let r=t.extensions??{};r.EXT_materials_anisotropy_openpbr&&r.EXT_materials_anisotropy_openpbr.openPbrAnisotropyEnabled||n.configureGltfStyleAnisotropy(!0),t.anisotropyTexture&&(t.anisotropyTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync(`${e}/anisotropyTexture`,t.anisotropyTexture,e=>{e.name=`${s.name} (Anisotropy Intensity)`,n.geometryTangentTexture=e}))),await Promise.all(o)}}tp(sl),td(sl,!0,e=>new sh(e)),e.s(["KHR_materials_anisotropy",0,sh],7903);let su="KHR_materials_emissive_strength";class sc{constructor(e){this.name=su,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(su)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>(await this._loader.loadMaterialPropertiesAsync(e,t,s),this._loadEmissiveProperties(n,o,s),await Promise.resolve()))}_loadEmissiveProperties(e,t,s){void 0!==t.emissiveStrength&&(this._loader._getOrCreateMaterialAdapter(s).emissionLuminance=t.emissiveStrength)}}tp(su),td(su,!0,e=>new sc(e)),e.s(["KHR_materials_emissive_strength",0,sc],37069);let sd="KHR_materials_sheen";class sp{constructor(e){this.name=sd,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(sd)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadSheenPropertiesAsync(n,o,s)),await Promise.all(a).then(()=>{})})}_loadSheenPropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[];n.configureFuzz();let a=void 0!==t.sheenColorFactor?eh.Color3.FromArray(t.sheenColorFactor):eh.Color3.Black(),i=void 0!==t.sheenRoughnessFactor?t.sheenRoughnessFactor:0;return n.fuzzWeight=1,n.fuzzColor=a,n.fuzzRoughness=i,t.sheenColorTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/sheenColorTexture`,t.sheenColorTexture,e=>{e.name=`${s.name} (Sheen Color)`,n.fuzzColorTexture=e})),t.sheenRoughnessTexture&&(t.sheenRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync(`${e}/sheenRoughnessTexture`,t.sheenRoughnessTexture,e=>{e.name=`${s.name} (Sheen Roughness)`,n.fuzzRoughnessTexture=e}))),Promise.all(o).then(()=>{})}}tp(sd),td(sd,!0,e=>new sp(e)),e.s(["KHR_materials_sheen",0,sp],13093);let s_="KHR_materials_fuzz";class sm{constructor(e){this.name=s_,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(s_)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadFuzzPropertiesAsync(n,o,s)),await Promise.all(a).then(()=>{})})}_loadFuzzPropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[];return n.configureFuzz(),n.fuzzWeight=void 0!==t.fuzzFactor?t.fuzzFactor:0,n.fuzzColor=void 0!==t.fuzzColorFactor?eh.Color3.FromArray(t.fuzzColorFactor):eh.Color3.White(),n.fuzzRoughness=void 0!==t.fuzzRoughnessFactor?t.fuzzRoughnessFactor:.5,t.fuzzTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/fuzzTexture`,t.fuzzTexture,e=>{e.name=`${s.name} (Fuzz)`,n.fuzzWeightTexture=e})),t.fuzzColorTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/fuzzColorTexture`,t.fuzzColorTexture,e=>{e.name=`${s.name} (Fuzz Color)`,n.fuzzColorTexture=e})),t.fuzzRoughnessTexture&&(t.fuzzRoughnessTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync(`${e}/fuzzRoughnessTexture`,t.fuzzRoughnessTexture,e=>{e.name=`${s.name} (Fuzz Roughness)`,n.fuzzRoughnessTexture=e}))),Promise.all(o).then(()=>{})}}tp(s_),td(s_,!0,e=>new sm(e)),e.s(["KHR_materials_fuzz",0,sm],43487);let sf="KHR_materials_specular";class sg{constructor(e){this.name=sf,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(sf)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadSpecularPropertiesAsync(n,o,s));let i=this._loader._getOrCreateMaterialAdapter(s);return o.extensions&&o.extensions.EXT_materials_specular_edge_color&&o.extensions.EXT_materials_specular_edge_color.specularEdgeColorEnabled&&i.enableSpecularEdgeColor(!0),await Promise.all(a).then(()=>{})})}_loadSpecularPropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[];return n.specularWeight=t.specularFactor??1,n.specularColor=void 0!==t.specularColorFactor?eh.Color3.FromArray(t.specularColorFactor):new eh.Color3(1,1,1),t.specularTexture&&(t.specularTexture.nonColorData=!0,o.push(this._loader.loadTextureInfoAsync(`${e}/specularTexture`,t.specularTexture,e=>{e.name=`${s.name} (Specular)`,n.specularWeightTexture=e}))),t.specularColorTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/specularColorTexture`,t.specularColorTexture,e=>{e.name=`${s.name} (Specular Color)`,n.specularColorTexture=e})),Promise.all(o).then(()=>{})}}tp(sf),td(sf,!0,e=>new sg(e)),e.s(["KHR_materials_specular",0,sg],70189);let sy="KHR_materials_ior";class sb{constructor(e){this.name=sy,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(sy)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadIorPropertiesAsync(n,o,s)),await Promise.all(a).then(()=>{})})}_loadIorPropertiesAsync(e,t,s){return this._loader._getOrCreateMaterialAdapter(s).specularIor=void 0!==t.ior?t.ior:sb._DEFAULT_IOR,Promise.resolve()}}sb._DEFAULT_IOR=1.5,tp(sy),td(sy,!0,e=>new sb(e)),e.s(["KHR_materials_ior",0,sb],80888);let sT="KHR_materials_variants";class sA{constructor(e){this.name=sT,this._loader=e,this.enabled=this._loader.isExtensionUsed(sT)&&!this._loader.parent.skipMaterials}dispose(){this._loader=null}static GetAvailableVariants(e){let t=this._GetExtensionMetadata(e);return t?Object.keys(t.variants):[]}getAvailableVariants(e){return sA.GetAvailableVariants(e)}static SelectVariant(e,t){let s=this._GetExtensionMetadata(e);if(!s)throw Error(`Cannot select variant on a glTF mesh that does not have the ${sT} extension`);let n=e=>{let t=s.variants[e];if(t)for(let e of t)e.mesh.material=e.material};if(t instanceof Array)for(let e of t)n(e);else n(t);s.lastSelected=t}selectVariant(e,t){sA.SelectVariant(e,t)}static Reset(e){let t=this._GetExtensionMetadata(e);if(!t)throw Error(`Cannot reset on a glTF mesh that does not have the ${sT} extension`);for(let e of t.original)e.mesh.material=e.material;t.lastSelected=null}reset(e){sA.Reset(e)}static GetLastSelectedVariant(e){let t=this._GetExtensionMetadata(e);if(!t)throw Error(`Cannot get the last selected variant on a glTF mesh that does not have the ${sT} extension`);return t.lastSelected}getLastSelectedVariant(e){return sA.GetLastSelectedVariant(e)}static _GetExtensionMetadata(e){return e?._internalMetadata?.gltf?.[sT]||null}onLoading(){let e=this._loader.gltf.extensions;if(e&&e[this.name]){let t=e[this.name];this._variants=t.variants}}onReady(){let e=this._loader.rootBabylonMesh;if(e){let t=this._loader.parent.extensionOptions[sT];t?.defaultVariant&&sA.SelectVariant(e,t.defaultVariant),t?.onLoaded?.({get variants(){return sA.GetAvailableVariants(e)},get selectedVariant(){let t=sA.GetLastSelectedVariant(e);if(!t)return sA.GetAvailableVariants(e)[0];if(Array.isArray(t))return t[0];return t},set selectedVariant(variantName){sA.SelectVariant(e,variantName)}})}}_loadMeshPrimitiveAsync(e,t,s,n,o,a){return tT.LoadExtensionAsync(e,o,this.name,async(i,r)=>{let l=[];return l.push(this._loader._loadMeshPrimitiveAsync(e,t,s,n,o,t=>{if(a(t),t instanceof k.Mesh){let s=tT._GetDrawMode(e,o.mode),n=this._loader.rootBabylonMesh,a=n?n._internalMetadata=n._internalMetadata||{}:{},h=a.gltf=a.gltf||{},u=h[sT]=h[sT]||{lastSelected:null,original:[],variants:{}};u.original.push({mesh:t,material:t.material});for(let e=0;e<r.mappings.length;++e){let o=r.mappings[e],a=ty.Get(`${i}/mappings/${e}/material`,this._loader.gltf.materials,o.material);l.push(this._loader._loadMaterialAsync(`#/materials/${o.material}`,a,t,s,e=>{for(let s=0;s<o.variants.length;++s){let a=o.variants[s],i=ty.Get(`/extensions/${sT}/variants/${a}`,this._variants,a);u.variants[i.name]=u.variants[i.name]||[],u.variants[i.name].push({mesh:t,material:e}),t.onClonedObservable.add(e=>{let s,o=e;do{if(!(o=o.parent))return;s=sA._GetExtensionMetadata(o)}while(null===s)if(n&&s===sA._GetExtensionMetadata(n)){for(let e in o._internalMetadata={},n._internalMetadata)o._internalMetadata[e]=n._internalMetadata[e];for(let e in o._internalMetadata.gltf=[],n._internalMetadata.gltf)o._internalMetadata.gltf[e]=n._internalMetadata.gltf[e];for(let e of(o._internalMetadata.gltf[sT]={lastSelected:null,original:[],variants:{}},s.original))o._internalMetadata.gltf[sT].original.push({mesh:e.mesh,material:e.material});for(let e in s.variants)if(Object.prototype.hasOwnProperty.call(s.variants,e))for(let t of(o._internalMetadata.gltf[sT].variants[e]=[],s.variants[e]))o._internalMetadata.gltf[sT].variants[e].push({mesh:t.mesh,material:t.material});s=o._internalMetadata.gltf[sT]}for(let n of s.original)n.mesh===t&&(n.mesh=e);for(let n of s.variants[i.name])n.mesh===t&&(n.mesh=e)})}}))}}})),await Promise.all(l).then(([e])=>e)})}}tp(sT),td(sT,!0,e=>new sA(e)),e.s(["KHR_materials_variants",0,sA],65540);var sx=e.i(36516);(0,sx.RegisterRenderTargetTexture)();class sw{static _GetDefaultOptions(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:eV.Constants.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}}constructor(e,t){this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._newMeshObserver=null,this._removedMeshObserver=null,this._disposed=!1,this._materialImpls=[],this._adapterCache=new WeakMap,this._translucentMaterialIndices=new Map,this._opaqueOnlySubMeshes=new Map,this._savedSubMeshes=new Map,this._options={...sw._GetDefaultOptions(),...e},this._scene=t,this._scene._transmissionHelper=this,this.onErrorObservable=new N.Observable,this._scene.onDisposeObservable.addOnce(()=>{this.dispose()}),this._parseScene(),this._setupRenderTargets()}addMaterialImpl(e){this._materialImpls.some(t=>t.materialClass===e.materialClass)||this._materialImpls.push(e)}updateOptions(e){if(!Object.keys(e).filter(t=>this._options[t]!==e[t]).length)return;let t={...this._options,...e},s=this._options;this._options=t,t.renderSize===s.renderSize&&t.renderTargetTextureType===s.renderTargetTextureType&&t.generateMipmaps===s.generateMipmaps&&this._opaqueRenderTarget?(this._opaqueRenderTarget.samples=t.samples,this._opaqueRenderTarget.lodGenerationScale=t.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=t.lodGenerationOffset):this._setupRenderTargets()}getOpaqueTarget(){return this._opaqueRenderTarget}_getOrCreateAdapter(e){let t=this._adapterCache.get(e);if(!t){for(let s of this._materialImpls)if(e instanceof s.materialClass){t=new s.adapterClass(e),this._adapterCache.set(e,t);break}}return t}_classifyMeshMaterials(e){let t=e.material;if(!t)return"opaque";if(!(t instanceof eT.MultiMaterial)){let e=this._getOrCreateAdapter(t);return e&&e.isTranslucent()?(e.refractionBackgroundTexture=this._opaqueRenderTarget,"transparent"):"opaque"}let s=!1,n=!1,o=new Set;for(let e=0;e<t.subMaterials.length;e++){let a=t.subMaterials[e];if(!a){n=!0;continue}let i=this._getOrCreateAdapter(a);i&&i.isTranslucent()?(i.refractionBackgroundTexture=this._opaqueRenderTarget,s=!0,o.add(e)):n=!0}return s&&n?(this._translucentMaterialIndices.set(e,o),this._rebuildOpaqueOnlySubMeshes(e,o),"mixed"):(this._translucentMaterialIndices.delete(e),this._opaqueOnlySubMeshes.delete(e),s?"transparent":"opaque")}_rebuildOpaqueOnlySubMeshes(e,t){e.subMeshes&&this._opaqueOnlySubMeshes.set(e,e.subMeshes.filter(e=>!t.has(e.materialIndex)))}_addMesh(e){this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),I.Tools.SetImmediate(()=>{!this._disposed&&e.material&&("transparent"===this._classifyMeshMaterials(e)?-1===this._transparentMeshesCache.indexOf(e)&&this._transparentMeshesCache.push(e):-1===this._opaqueMeshesCache.indexOf(e)&&this._opaqueMeshesCache.push(e))})}_removeMesh(e){e.onMaterialChangedObservable.remove(this._materialObservers[e.uniqueId]),delete this._materialObservers[e.uniqueId];let t=this._transparentMeshesCache.indexOf(e);-1!==t&&this._transparentMeshesCache.splice(t,1),-1!==(t=this._opaqueMeshesCache.indexOf(e))&&this._opaqueMeshesCache.splice(t,1),this._translucentMaterialIndices.delete(e),this._opaqueOnlySubMeshes.delete(e)}_parseScene(){this._scene.meshes.forEach(this._addMesh.bind(this)),this._newMeshObserver=this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this)),this._removedMeshObserver=this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this))}_onMeshMaterialChanged(e){let t=this._transparentMeshesCache.indexOf(e),s=this._opaqueMeshesCache.indexOf(e);"transparent"===this._classifyMeshMaterials(e)?-1!==s?(this._opaqueMeshesCache.splice(s,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e):-1!==t?(this._transparentMeshesCache.splice(t,1),this._opaqueMeshesCache.push(e)):-1===s&&this._opaqueMeshesCache.push(e)}_isRenderTargetValid(){return this._opaqueRenderTarget?.getInternalTexture()!==null}_setupRenderTargets(){let e;for(let t of(this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new sx.RenderTargetTexture("opaqueSceneTexture",this._options.renderSize,this._scene,this._options.generateMipmaps,void 0,this._options.renderTargetTextureType),this._opaqueRenderTarget.ignoreCameraViewport=!0,this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.clearColor=this._options.clearColor?.clone()??this._scene.clearColor.clone(),this._opaqueRenderTarget.clearColor.a=0,this._opaqueRenderTarget.gammaSpace=!1,this._opaqueRenderTarget.lodGenerationScale=this._options.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=this._options.lodGenerationOffset,this._opaqueRenderTarget.samples=this._options.samples,this._opaqueRenderTarget.renderSprites=!0,this._opaqueRenderTarget.renderParticles=!0,this._opaqueRenderTarget.disableImageProcessing=!0,this._opaqueRenderTarget.onBeforeBindObservable.add(t=>{e=this._scene.environmentIntensity,this._scene.environmentIntensity=1,this._options.clearColor?t.clearColor.copyFrom(this._options.clearColor):this._scene.clearColor.toLinearSpaceToRef(t.clearColor,this._scene.getEngine().useExactSrgbConversions),t.clearColor.a=0;let s=this._opaqueOnlySubMeshes.entries();for(let e=s.next();!e.done;e=s.next()){let t=e.value[0],s=e.value[1];t.subMeshes&&(this._savedSubMeshes.set(t,t.subMeshes),t.subMeshes=s)}}),this._opaqueRenderTarget.onAfterUnbindObservable.add(()=>{this._scene.environmentIntensity=e;let t=this._savedSubMeshes.entries();for(let e=t.next();!e.done;e=t.next())e.value[0].subMeshes=e.value[1];this._savedSubMeshes.clear()}),this._transparentMeshesCache))t.material&&this._classifyMeshMaterials(t);let t=this._translucentMaterialIndices.entries();for(let e=t.next();!e.done;e=t.next()){let t=e.value[0];t.material&&this._classifyMeshMaterials(t)}}dispose(){for(let e of(this._disposed=!0,this._newMeshObserver?.remove(),this._removedMeshObserver?.remove(),this._newMeshObserver=null,this._removedMeshObserver=null,[...this._transparentMeshesCache,...this._opaqueMeshesCache])){let t=this._materialObservers[e.uniqueId];t&&(t.remove(),delete this._materialObservers[e.uniqueId])}for(let e of this._scene.meshes){let t=this._materialObservers[e.uniqueId];t&&(t.remove(),delete this._materialObservers[e.uniqueId])}this._materialObservers={},this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[],this._translucentMaterialIndices.clear(),this._opaqueOnlySubMeshes.clear(),this._savedSubMeshes.clear()}}function sv(e,t){if(e.parent.dontUseTransmissionHelper)return;let s=t.getScene()._transmissionHelper,n=s??new sw({},t.getScene());for(let t of Array.from(e._pbrMaterialImpls.values()))n.addMaterialImpl(t);s&&!s._isRenderTargetValid()&&s._setupRenderTargets()}e.s(["TransmissionHelper",0,sw,"ensureTransmissionHelper",0,sv],88677);let sM="KHR_materials_transmission";class sC{constructor(e){this.name=sM,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(sM),this.enabled&&(e.parent.transparencyAsCoverage=!0)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadTransparentPropertiesAsync(n,t,s,o)),await Promise.all(a).then(()=>{})})}_loadTransparentPropertiesAsync(e,t,s,n){let o=this._loader._getOrCreateMaterialAdapter(s),a=void 0!==n.transmissionFactor?n.transmissionFactor:0;if(0===a||!o)return Promise.resolve();o.configureTransmission(),o.transmissionWeight=a,a>0&&sv(this._loader,s);let i=Promise.resolve(null);return n.transmissionTexture&&(n.transmissionTexture.nonColorData=!0,i=this._loader.loadTextureInfoAsync(`${e}/transmissionTexture`,n.transmissionTexture,e=>{e.name=`${s.name} (Transmission)`,o.transmissionWeightTexture=e})),i.then(()=>{})}}tp(sM),td(sM,!0,e=>new sC(e)),e.s(["KHR_materials_transmission",0,sC],52311);let sF="KHR_materials_diffuse_transmission";class sS{constructor(e){this.name=sF,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(sF),this.enabled&&(e.parent.transparencyAsCoverage=!0)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadTranslucentPropertiesAsync(n,t,s,o)),await Promise.all(a).then(()=>{})})}_loadTranslucentPropertiesAsync(e,t,s,n){let o=this._loader._getOrCreateMaterialAdapter(s);o.configureSubsurface(),o.subsurfaceWeight=n.diffuseTransmissionFactor??0,o.subsurfaceWeight>0&&sv(this._loader,s),o.diffuseTransmissionTint=void 0!==n.diffuseTransmissionColorFactor?eh.Color3.FromArray(n.diffuseTransmissionColorFactor):eh.Color3.White();let a=[];return n.diffuseTransmissionTexture&&(n.diffuseTransmissionTexture.nonColorData=!0,a.push(this._loader.loadTextureInfoAsync(`${e}/diffuseTransmissionTexture`,n.diffuseTransmissionTexture).then(e=>{e.name=`${s.name} (Diffuse Transmission)`,o.subsurfaceWeightTexture=e}))),n.diffuseTransmissionColorTexture&&a.push(this._loader.loadTextureInfoAsync(`${e}/diffuseTransmissionColorTexture`,n.diffuseTransmissionColorTexture).then(e=>{e.name=`${s.name} (Diffuse Transmission Color)`,o.diffuseTransmissionTintTexture=e})),Promise.all(a).then(()=>{})}}tp(sF),td(sF,!0,e=>new sS(e)),e.s(["KHR_materials_diffuse_transmission",0,sS],2596);let sE="KHR_materials_volume";class sO{constructor(e){this.name=sE,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(sE),this.enabled&&this._loader._disableInstancedMesh++}dispose(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadVolumePropertiesAsync(n,t,s,o)),await Promise.all(a).then(()=>{})})}_loadVolumePropertiesAsync(e,t,s,n){let o=this._loader._getOrCreateMaterialAdapter(s);if(0===o.transmissionWeight&&0===o.subsurfaceWeight||!n.thicknessFactor)return Promise.resolve();o.geometryThinWalled=!1;let a=void 0!==n.attenuationDistance?n.attenuationDistance:Number.MAX_VALUE,i=void 0!==n.attenuationColor&&3==n.attenuationColor.length?eh.Color3.FromArray(n.attenuationColor):eh.Color3.White();o.configureVolume(),o.transmissionColor=i,o.transmissionDepth=a,o.volumeThickness=n.thicknessFactor??0;let r=[];return n.thicknessTexture&&(n.thicknessTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync(`${e}/thicknessTexture`,n.thicknessTexture,e=>{e.name=`${s.name} (Thickness)`,o.volumeThicknessTexture=e}))),Promise.all(r).then(()=>{})}}tp(sE),td(sE,!0,e=>new sO(e)),e.s(["KHR_materials_volume",0,sO],56007);let sN="KHR_materials_volume_scatter";class sI{constructor(e){this.name=sN,this.order=172,this._loader=e,this.enabled=this._loader.isExtensionUsed(sN),this.enabled&&this._loader._disableInstancedMesh++}dispose(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadVolumePropertiesAsync(n,t,s,o)),await Promise.all(a).then(()=>{})})}_loadVolumePropertiesAsync(e,t,s,n){let o=this._loader._getOrCreateMaterialAdapter(s);if(0===o.transmissionWeight&&0===o.subsurfaceWeight||o.geometryThinWalled)return Promise.resolve();let a=void 0!==n.multiscatterColorFactor&&3==n.multiscatterColorFactor.length?eh.Color3.FromArray(n.multiscatterColorFactor):eh.Color3.Black(),i=void 0!==n.scatterAnisotropy?n.scatterAnisotropy:0,r=Promise.resolve(null);n.multiscatterColorTexture&&(n.multiscatterColorTexture.nonColorData=!0,r=this._loader.loadTextureInfoAsync(`${e}/multiscatterColorTexture`,n.multiscatterColorTexture,e=>{e.name=`${s.name} (Scatter Color)`,o.transmissionWeight>0&&(o.transmissionScatterTexture=e),o.subsurfaceWeight>0&&(o.subsurfaceColorTexture=e)}));let l=new el.Vector3(-Math.log(o.transmissionColor.r),-Math.log(o.transmissionColor.g),-Math.log(o.transmissionColor.b));if(l.scaleInPlace(1/Math.max(o.transmissionDepth,1e-6)),o.transmissionWeight>0){let e,t,s,n=(e=new el.Vector3(a.r,a.g,a.b),(t=new el.Vector3(4.09712,4.09712,4.09712)).addInPlace(new el.Vector3(4.20863,4.20863,4.20863).multiplyInPlace(e)),(s=new el.Vector3(9.59217,9.59217,9.59217)).addInPlace(new el.Vector3(41.6808,41.6808,41.6808).multiplyInPlace(e)),s.addInPlace(new el.Vector3(17.7126,17.7126,17.7126).multiplyInPlace(e.multiply(e))),t.subtractInPlace(new el.Vector3(Math.sqrt(s.x),Math.sqrt(s.y),Math.sqrt(s.z))),new el.Vector3(1,1,1).subtract(t.multiply(t))),r=l.multiply(n);r.scaleInPlace(o.transmissionDepth),o.transmissionScatter.set(r.x,r.y,r.z),o.transmissionScatterAnisotropy=i}if(o.subsurfaceWeight>0){o.subsurfaceScatterAnisotropy=i,o.subsurfaceColor=a;let e=new el.Vector3(0!==l.x?1/l.x:1,0!==l.y?1/l.y:1,0!==l.z?1/l.z:1);o.subsurfaceRadius=Math.max(e.x,e.y,e.z),o.subsurfaceRadiusScale=new eh.Color3(e.x/o.subsurfaceRadius,e.y/o.subsurfaceRadius,e.z/o.subsurfaceRadius)}return r.then(()=>{})}}tp(sN),td(sN,!0,e=>new sI(e)),e.s(["KHR_materials_volume_scatter",0,sI],67797);let sB="KHR_materials_dispersion";class sk{constructor(e){this.name=sB,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(sB)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadDispersionPropertiesAsync(n,t,s,o)),await Promise.all(a).then(()=>{})})}_loadDispersionPropertiesAsync(e,t,s,n){let o=this._loader._getOrCreateMaterialAdapter(s);return 0!=o.transmissionWeight&&n.dispersion&&(o.transmissionDispersionAbbeNumber=20,o.transmissionDispersionScale=n.dispersion),Promise.resolve()}}tp(sB),td(sB,!0,e=>new sk(e)),e.s(["KHR_materials_dispersion",0,sk],63441);let sR="KHR_materials_diffuse_roughness";class sP{constructor(e){this.name=sR,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(sR)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=[];return a.push(this._loader.loadMaterialPropertiesAsync(e,t,s)),a.push(this._loadDiffuseRoughnessPropertiesAsync(n,o,s)),await Promise.all(a).then(()=>{})})}_loadDiffuseRoughnessPropertiesAsync(e,t,s){let n=this._loader._getOrCreateMaterialAdapter(s),o=[];return n.baseDiffuseRoughness=t.diffuseRoughnessFactor??0,t.diffuseRoughnessTexture&&o.push(this._loader.loadTextureInfoAsync(`${e}/diffuseRoughnessTexture`,t.diffuseRoughnessTexture,e=>{e.name=`${s.name} (Diffuse Roughness)`,n.baseDiffuseRoughnessTexture=e})),Promise.all(o).then(()=>{})}}tp(sR),td(sR,!0,e=>new sP(e)),e.s(["KHR_materials_diffuse_roughness",0,sP],90760);let sL="KHR_mesh_quantization";class sG{constructor(e){this.name=sL,this.enabled=e.isExtensionUsed(sL)}dispose(){}}tp(sL),td(sL,!0,e=>new sG(e)),e.s(["KHR_mesh_quantization",0,sG],49688);let sD="KHR_texture_basisu";class sV{constructor(e){this.name=sD,this._loader=e,this.enabled=e.isExtensionUsed(sD)}dispose(){this._loader=null}_loadTextureAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>{let a=void 0==t.sampler?tT.DefaultSampler:ty.Get(`${e}/sampler`,this._loader.gltf.samplers,t.sampler),i=ty.Get(`${n}/source`,this._loader.gltf.images,o.source);return await this._loader._createTextureAsync(e,a,i,e=>{s(e)},t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)})}}tp(sD),td(sD,!0,e=>new sV(e)),e.s(["KHR_texture_basisu",0,sV],51844);let sU="KHR_texture_transform";class sK{constructor(e){this.name=sU,this._loader=e,this.enabled=this._loader.isExtensionUsed(sU)}dispose(){this._loader=null}loadTextureInfoAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(n,o)=>await this._loader.loadTextureInfoAsync(e,t,e=>{if(!(e instanceof ep.Texture))throw Error(`${n}: Texture type not supported`);o.offset&&(e.uOffset=o.offset[0],e.vOffset=o.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,o.rotation&&(e.wAng=-o.rotation),o.scale&&(e.uScale=o.scale[0],e.vScale=o.scale[1]),void 0!=o.texCoord&&(e.coordinatesIndex=o.texCoord),s(e)}))}}tp(sU),td(sU,!0,e=>new sK(e)),e.s(["KHR_texture_transform",0,sK],24684);let sH="KHR_xmp_json_ld";class s${constructor(e){this.name=sH,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(sH)}dispose(){this._loader=null}onLoading(){if(null===this._loader.rootBabylonMesh)return;let e=this._loader.gltf.extensions?.KHR_xmp_json_ld,t=this._loader.gltf.asset?.extensions?.KHR_xmp_json_ld;if(e&&t){let s=+t.packet;e.packets&&s<e.packets.length&&(this._loader.rootBabylonMesh.metadata=this._loader.rootBabylonMesh.metadata||{},this._loader.rootBabylonMesh.metadata.xmp=e.packets[s])}}}tp(sH),td(sH,!0,e=>new s$(e)),e.s(["KHR_xmp_json_ld",0,s$],35597);var sz=tA;function sq(e,t,s,n){return eh.Color3.FromArray(t,s).scale(n)}function sW(e,t,s,n){return t[s]*n}function sj(e,t,s,n){return-t[s]*n}function sY(e,t,s,n){return t[s+1]*n}function sQ(e,t,s,n){return t[s]*n*2}function sZ(e){return{scale:[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,`${e}.uScale`,sW,()=>2),new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,`${e}.vScale`,sY,()=>2)],offset:[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,`${e}.uOffset`,sW,()=>2),new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,`${e}.vOffset`,sY,()=>2)],rotation:[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,`${e}.wAng`,sj,()=>1)]}}class sX extends sz.AnimationPropertyInfo{buildAnimations(e,t,s,n){return[{babylonAnimatable:e._babylonCamera,babylonAnimation:this._buildAnimation(t,s,n)}]}}class sJ extends sz.AnimationPropertyInfo{buildAnimations(e,t,s,n){let o=[];for(let a in e._data)o.push({babylonAnimatable:e._data[a].babylonMaterial,babylonAnimation:this._buildAnimation(t,s,n)});return o}}class s0 extends sz.AnimationPropertyInfo{buildAnimations(e,t,s,n){return[{babylonAnimatable:e._babylonLight,babylonAnimation:this._buildAnimation(t,s,n)}]}}class s1 extends sz.AnimationPropertyInfo{buildAnimations(e,t,s,n){return e._primitiveBabylonMeshes?e._primitiveBabylonMeshes.map(e=>({babylonAnimatable:e,babylonAnimation:this._buildAnimation(t,s,n)})):[]}}(0,t_.SetInterpolationForKey)("/cameras/{}/orthographic/xmag",[new sX(ec.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",sj,()=>1),new sX(ec.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",sY,()=>1)]),(0,t_.SetInterpolationForKey)("/cameras/{}/orthographic/ymag",[new sX(ec.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",sj,()=>1),new sX(ec.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",sY,()=>1)]),(0,t_.SetInterpolationForKey)("/cameras/{}/orthographic/zfar",[new sX(ec.Animation.ANIMATIONTYPE_FLOAT,"maxZ",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/cameras/{}/orthographic/znear",[new sX(ec.Animation.ANIMATIONTYPE_FLOAT,"minZ",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/cameras/{}/perspective/yfov",[new sX(ec.Animation.ANIMATIONTYPE_FLOAT,"fov",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/cameras/{}/perspective/zfar",[new sX(ec.Animation.ANIMATIONTYPE_FLOAT,"maxZ",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/cameras/{}/perspective/znear",[new sX(ec.Animation.ANIMATIONTYPE_FLOAT,"minZ",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/pbrMetallicRoughness/baseColorFactor",[new sJ(ec.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",sq,()=>4),new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"alpha",function(e,t,s,n){return t[s+3]*n},()=>4)]),(0,t_.SetInterpolationForKey)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"metallic",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/pbrMetallicRoughness/metallicFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"roughness",sW,()=>1)]);let s3=sZ("albedoTexture");(0,t_.SetInterpolationForKey)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale",s3.scale),(0,t_.SetInterpolationForKey)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset",s3.offset),(0,t_.SetInterpolationForKey)("/materials/{}/pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/rotation",s3.rotation);let s2=sZ("metallicTexture");(0,t_.SetInterpolationForKey)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/scale",s2.scale),(0,t_.SetInterpolationForKey)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/offset",s2.offset),(0,t_.SetInterpolationForKey)("//materials/{}/pbrMetallicRoughness/metallicRoughnessTexture/rotation",s2.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/emissiveFactor",[new sJ(ec.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",sq,()=>3)]);let s7=sZ("bumpTexture");(0,t_.SetInterpolationForKey)("/materials/{}/normalTexture/scale",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/normalTexture/extensions/KHR_texture_transform/scale",s7.scale),(0,t_.SetInterpolationForKey)("/materials/{}/normalTexture/extensions/KHR_texture_transform/offset",s7.offset),(0,t_.SetInterpolationForKey)("/materials/{}/normalTexture/extensions/KHR_texture_transform/rotation",s7.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/occlusionTexture/strength",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",sW,()=>1)]);let s4=sZ("ambientTexture");(0,t_.SetInterpolationForKey)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/scale",s4.scale),(0,t_.SetInterpolationForKey)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/offset",s4.offset),(0,t_.SetInterpolationForKey)("/materials/{}/occlusionTexture/extensions/KHR_texture_transform/rotation",s4.rotation);let s5=sZ("emissiveTexture");(0,t_.SetInterpolationForKey)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/scale",s5.scale),(0,t_.SetInterpolationForKey)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/offset",s5.offset),(0,t_.SetInterpolationForKey)("/materials/{}/emissiveTexture/extensions/KHR_texture_transform/rotation",s5.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyStrength",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.intensity",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyRotation",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"anisotropy.angle",sW,()=>1)]);let s8=sZ("anisotropy.texture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/scale",s8.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/offset",s8.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_anisotropy/anisotropyTexture/extensions/KHR_texture_transform/rotation",s8.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",sW,()=>1)]);let s6=sZ("clearCoat.texture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/scale",s6.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/offset",s6.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatTexture/extensions/KHR_texture_transform/rotation",s6.rotation);let s9=sZ("clearCoat.bumpTexture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/scale",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.bumpTexture.level",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/scale",s9.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/offset",s9.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatNormalTexture/extensions/KHR_texture_transform/rotation",s9.rotation);let ne=sZ("clearCoat.textureRoughness");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/scale",ne.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/offset",ne.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_clearcoat/clearcoatRoughnessTexture/extensions/KHR_texture_transform/rotation",ne.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_dispersion/dispersionFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"subSurface.dispersion",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_emissive_strength/emissiveStrength",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_ior/ior",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceIor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMinimum",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessMaximum",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",sW,()=>1)]);let nt=sZ("iridescence.texture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/scale",nt.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/offset",nt.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceTexture/extensions/KHR_texture_transform/rotation",nt.rotation);let ns=sZ("iridescence.thicknessTexture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/scale",ns.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/offset",ns.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_iridescence/iridescenceThicknessTexture/extensions/KHR_texture_transform/rotation",ns.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_sheen/sheenColorFactor",[new sJ(ec.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",sq,()=>3)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",sW,()=>1)]);let nn=sZ("sheen.texture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/scale",nn.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/offset",nn.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_sheen/sheenColorTexture/extensions/KHR_texture_transform/rotation",nn.rotation);let no=sZ("sheen.textureRoughness");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/scale",no.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/offset",no.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_sheen/sheenRoughnessTexture/extensions/KHR_texture_transform/rotation",no.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_specular/specularFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_specular/specularColorFactor",[new sJ(ec.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",sq,()=>3)]);let na=sZ("metallicReflectanceTexture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/scale",na.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/offset",na.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_specular/specularTexture/extensions/KHR_texture_transform/rotation",na.rotation);let ni=sZ("reflectanceTexture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/scale",ni.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/offset",ni.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_specular/specularColorTexture/extensions/KHR_texture_transform/rotation",ni.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_transmission/transmissionFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",sW,()=>1)]);let nr=sZ("subSurface.refractionIntensityTexture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/scale",nr.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/offset",nr.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_transmission/transmissionTexture/extensions/KHR_texture_transform/rotation",nr.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_volume/attenuationColor",[new sJ(ec.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",sq,()=>3)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_volume/attenuationDistance",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_volume/thicknessFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",sW,()=>1)]);let nl=sZ("subSurface.thicknessTexture");(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/scale",nl.scale),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/offset",nl.offset),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_volume/thicknessTexture/extensions/KHR_texture_transform/rotation",nl.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionFactor",[new sJ(ec.Animation.ANIMATIONTYPE_FLOAT,"subSurface.translucencyIntensity",sW,()=>1)]);let nh=sZ("subSurface.translucencyIntensityTexture");(0,t_.SetInterpolationForKey)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/scale",nh.scale),(0,t_.SetInterpolationForKey)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/offset",nh.offset),(0,t_.SetInterpolationForKey)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionTexture/extensions/KHR_texture_transform/rotation",nh.rotation),(0,t_.SetInterpolationForKey)("/materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorFactor",[new sJ(ec.Animation.ANIMATIONTYPE_COLOR3,"subSurface.translucencyColor",sq,()=>3)]);let nu=sZ("subSurface.translucencyColorTexture");(0,t_.SetInterpolationForKey)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/scale",nu.scale),(0,t_.SetInterpolationForKey)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/offset",nu.offset),(0,t_.SetInterpolationForKey)("materials/{}/extensions/KHR_materials_diffuse_transmission/diffuseTransmissionColorTexture/extensions/KHR_texture_transform/rotation",nu.rotation),(0,t_.SetInterpolationForKey)("/extensions/KHR_lights_punctual/lights/{}/color",[new s0(ec.Animation.ANIMATIONTYPE_COLOR3,"diffuse",sq,()=>3)]),(0,t_.SetInterpolationForKey)("/extensions/KHR_lights_punctual/lights/{}/intensity",[new s0(ec.Animation.ANIMATIONTYPE_FLOAT,"intensity",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/extensions/KHR_lights_punctual/lights/{}/range",[new s0(ec.Animation.ANIMATIONTYPE_FLOAT,"range",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/extensions/KHR_lights_punctual/lights/{}/spot/innerConeAngle",[new s0(ec.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",sQ,()=>1)]),(0,t_.SetInterpolationForKey)("/extensions/KHR_lights_punctual/lights/{}/spot/outerConeAngle",[new s0(ec.Animation.ANIMATIONTYPE_FLOAT,"angle",sQ,()=>1)]),(0,t_.SetInterpolationForKey)("/extensions/EXT_lights_area/lights/{}/color",[new s0(ec.Animation.ANIMATIONTYPE_COLOR3,"diffuse",sq,()=>3)]),(0,t_.SetInterpolationForKey)("/extensions/EXT_lights_area/lights/{}/intensity",[new s0(ec.Animation.ANIMATIONTYPE_FLOAT,"intensity",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/extensions/EXT_lights_area/lights/{}/size",[new s0(ec.Animation.ANIMATIONTYPE_FLOAT,"radius",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/extensions/EXT_lights_area/lights/{}/rect/aspect",[new s0(ec.Animation.ANIMATIONTYPE_FLOAT,"radius",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/nodes/{}/extensions/EXT_lights_ies/color",[new s0(ec.Animation.ANIMATIONTYPE_COLOR3,"diffuse",sq,()=>3)]),(0,t_.SetInterpolationForKey)("/nodes/{}/extensions/EXT_lights_ies/multiplier",[new s0(ec.Animation.ANIMATIONTYPE_FLOAT,"intensity",sW,()=>1)]),(0,t_.SetInterpolationForKey)("/nodes/{}/extensions/KHR_node_visibility/visible",[new s1(ec.Animation.ANIMATIONTYPE_FLOAT,"isVisible",sW,()=>1)]);let nc="KHR_animation_pointer";class nd{constructor(e){this.name=nc,this._loader=e,this._pathToObjectConverter=(0,t_.GetPathToObjectConverter)(this._loader.gltf)}get enabled(){return this._loader.isExtensionUsed(nc)}dispose(){this._loader=null,delete this._pathToObjectConverter}_loadAnimationChannelAsync(e,t,s,n,o){let a=n.target.extensions?.KHR_animation_pointer;if(!a||!this._pathToObjectConverter)return null;"pointer"!==n.target.path&&L.Logger.Warn(`${e}/target/path: Value (${n.target.path}) must be (pointer) when using the ${this.name} extension`),void 0!=n.target.node&&L.Logger.Warn(`${e}/target/node: Value (${n.target.node}) must not be present when using the ${this.name} extension`);let i=`${e}/extensions/${this.name}`,r=a.pointer;if(!r)throw Error(`${i}: Pointer is missing`);try{let a=this._pathToObjectConverter.convert(r);if(!a.info.interpolation)throw Error(`${i}/pointer: Interpolation is missing`);return this._loader._loadAnimationChannelFromTargetInfoAsync(e,t,s,n,{object:a.object,info:a.info.interpolation},o)}catch(e){return L.Logger.Warn(`${i}/pointer: Invalid pointer (${r}) skipped`),null}}}tp(nc),td(nc,!0,e=>new nd(e)),e.s(["KHR_animation_pointer",0,nd],53287);class np{constructor(e,t,s){this.frame=e,this.action=t,this.onlyOnce=s,this.isDone=!1}_clone(){return new np(this.frame,this.action,this.onlyOnce)}}let n_={coneInnerAngle:6.28318530718,coneOuterAngle:6.28318530718,coneOuterVolume:0,distanceModel:"linear",maxDistance:1e4,minDistance:1,orientation:el.Vector3.Right(),panningEnabled:!0,panningModel:"equalpower",position:el.Vector3.Zero(),rolloffFactor:1,rotation:el.Vector3.Zero(),rotationQuaternion:new el.Quaternion};function nm(e){return e.spatialEnabled||void 0!==e.spatialAutoUpdate||void 0!==e.spatialConeInnerAngle||void 0!==e.spatialConeOuterAngle||void 0!==e.spatialConeOuterVolume||void 0!==e.spatialDistanceModel||void 0!==e.spatialMaxDistance||void 0!==e.spatialMinDistance||void 0!==e.spatialMinUpdateTime||void 0!==e.spatialOrientation||void 0!==e.spatialPanningEnabled||void 0!==e.spatialPanningModel||void 0!==e.spatialPosition||void 0!==e.spatialRolloffFactor||void 0!==e.spatialRotation||void 0!==e.spatialRotationQuaternion}class nf{}(f=O||(O={}))[f.HAS_INPUTS=1]="HAS_INPUTS",f[f.HAS_OUTPUTS=2]="HAS_OUTPUTS",f[f.HAS_INPUTS_AND_OUTPUTS=3]="HAS_INPUTS_AND_OUTPUTS";class ng{constructor(e,t){this.onDisposeObservable=new N.Observable,this.engine=e,1&t&&(this._upstreamNodes=new Set),2&t&&(this._downstreamNodes=new Set)}dispose(){if(this._downstreamNodes){for(let e of Array.from(this._downstreamNodes))if(!this._disconnect(e))throw Error("Disconnect failed");this._downstreamNodes.clear()}if(this._upstreamNodes){for(let e of Array.from(this._upstreamNodes))if(!e._disconnect(this))throw Error("Disconnect failed");this._upstreamNodes.clear()}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()}_connect(e){return!(!this._downstreamNodes||this._downstreamNodes.has(e))&&!!e._onConnect(this)&&(this._downstreamNodes.add(e),!0)}_disconnect(e){return!!this._downstreamNodes&&!!this._downstreamNodes.delete(e)&&e._onDisconnect(this)}_onConnect(e){return!(!this._upstreamNodes||this._upstreamNodes.has(e))&&(this._upstreamNodes.add(e),!0)}_onDisconnect(e){return this._upstreamNodes?.delete(e)??!1}}class ny extends ng{constructor(e,t,s){super(t,s),this.onNameChangedObservable=new N.Observable,this._name=e}get name(){return this._name}set name(e){if(this._name===e)return;let t=this._name;this._name=e,this.onNameChangedObservable.notifyObservers({newName:e,oldName:t,node:this})}dispose(){super.dispose(),this.onNameChangedObservable.clear()}}class nb extends ny{constructor(e,t){super(e,t,3)}connect(e){if(!this._connect(e))throw Error("Connect failed")}disconnect(e){if(!this._disconnect(e))throw Error("Disconnect failed")}disconnectAll(){if(!this._downstreamNodes)throw Error("Disconnect failed");let e=this._downstreamNodes.values();for(let t=e.next();!t.done;t=e.next())if(!this._disconnect(t.value))throw Error("Disconnect failed")}}let nT={volume:1};class nA extends nb{constructor(e){super("Volume",e)}setOptions(e){this.setVolume(e.volume??nT.volume,{shape:"none"})}}function nx(e){return e.getSubNode("Volume")}class nw{get frequencyBinCount(){return this.fftSize/2}getByteTimeDomainData(){return t??(t=new Uint8Array)}getFloatTimeDomainData(){return s??(s=new Float32Array)}}class nv extends nb{constructor(e){super("Analyzer",e)}setOptions(e){this.fftSize=e.analyzerFFTSize??2048,this.minDecibels=e.analyzerMinDecibels??-100,this.maxDecibels=e.analyzerMaxDecibels??-30,this.smoothing=e.analyzerSmoothing??.8}}function nM(e){return e.getSubNode("Analyzer")}function nC(e,t,s){e.callOnSubNode("Analyzer",e=>{e[t]=s})}let nF=null,nS=null;class nE extends nw{constructor(e){super(),this._fftSize=2048,this._maxDecibels=-30,this._minDecibels=-100,this._smoothing=.8,this._subGraph=e}get fftSize(){return this._fftSize}set fftSize(e){this._fftSize=e,nC(this._subGraph,"fftSize",e)}get isEnabled(){return null!==nM(this._subGraph)}get minDecibels(){return this._minDecibels}set minDecibels(e){this._minDecibels=e,nC(this._subGraph,"minDecibels",e)}get maxDecibels(){return this._maxDecibels}set maxDecibels(e){this._maxDecibels=e,nC(this._subGraph,"maxDecibels",e)}get smoothing(){return this._smoothing}set smoothing(e){this._smoothing=e,nC(this._subGraph,"smoothing",e)}dispose(){let e=nM(this._subGraph);e&&(this._subGraph.removeSubNodeAsync(e),e.dispose())}async enableAsync(){nM(this._subGraph)||await this._subGraph.createAndAddSubNodeAsync("Analyzer")}getByteFrequencyData(){let e=nM(this._subGraph);return e?e.getByteFrequencyData():(L.Logger.Warn("AudioAnalyzer not enabled"),this.enableAsync(),nF||(nF=new Uint8Array),nF)}getByteTimeDomainData(){let e=nM(this._subGraph);return e?e.getByteTimeDomainData():(L.Logger.Warn("AudioAnalyzer not enabled"),this.enableAsync(),super.getByteTimeDomainData())}getFloatFrequencyData(){let e=nM(this._subGraph);return e?e.getFloatFrequencyData():(L.Logger.Warn("AudioAnalyzer not enabled"),this.enableAsync(),nS||(nS=new Float32Array),nS)}getFloatTimeDomainData(){let e=nM(this._subGraph);return e?e.getFloatTimeDomainData():(L.Logger.Warn("AudioAnalyzer not enabled"),this.enableAsync(),super.getFloatTimeDomainData())}}class nO extends ny{constructor(e,t,s){super(e,t,s),this._analyzer=null}get analyzer(){return this._analyzer??(this._analyzer=new nE(this._subGraph))}get volume(){var e,t;return e=this._subGraph,t="volume",nx(e)?.[t]??nT[t]}set volume(e){let t=nx(this._subGraph);if(!t)throw Error("No volume subnode");t.volume=e}dispose(){super.dispose(),this._analyzer?.dispose(),this._analyzer=null,this._subGraph.dispose()}setVolume(e,t=null){let s=nx(this._subGraph);if(!s)throw Error("No volume subnode");s.setVolume(e,t)}}class nN extends nO{constructor(e,t,s,n=2){super(e,t,n),this._spatialAutoUpdate=!0,this._spatialMinUpdateTime=0,this._outBus=null,this._spatial=null,this._onOutBusDisposed=null,"boolean"==typeof s.spatialAutoUpdate&&(this._spatialAutoUpdate=s.spatialAutoUpdate),"number"==typeof s.spatialMinUpdateTime&&(this._spatialMinUpdateTime=s.spatialMinUpdateTime)}get outBus(){return this._outBus}set outBus(e){if(this._outBus!==e){if(this._outBus&&(this._onOutBusDisposed&&(this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed),this._onOutBusDisposed=null),!this._disconnect(this._outBus)))throw Error("Disconnect failed");if(this._outBus=e,this._outBus&&(this._onOutBusDisposed=()=>{this._outBus=null},this._outBus.onDisposeObservable.add(this._onOutBusDisposed),!this._connect(this._outBus)))throw Error("Connect failed")}}get spatial(){return this._spatial?this._spatial:this._initSpatialProperty()}dispose(){super.dispose(),this._spatial?.dispose(),this._spatial=null,this._outBus&&this._onOutBusDisposed&&(this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed),this._onOutBusDisposed=null),this._outBus=null}_initSpatialProperty(){return this._spatial=this._createSpatialProperty(this._spatialAutoUpdate,this._spatialMinUpdateTime)}get _isSpatial(){return null!==this._spatial}set _isSpatial(e){e&&!this._spatial?this._initSpatialProperty():!e&&this._spatial&&(this._spatial.dispose(),this._spatial=null)}}class nI{}class nB extends nb{constructor(e){super("Stereo",e)}setOptions(e){this.pan=e.stereoPan??0}}function nk(e){return e.getSubNode("Stereo")}class nR extends nI{constructor(e){super(),this._pan=0,this._subGraph=e}get pan(){return this._pan}set pan(e){var t;this._pan=e,t=this._subGraph,t.callOnSubNode("Stereo",t=>{t.pan=e})}}class nP{constructor(e){this._attachmentType=3,this._position=new el.Vector3,this._rotationQuaternion=new el.Quaternion,this._sceneNode=null,this._useBoundingBox=!1,this.dispose=()=>{this.detach()},this._spatialAudioNode=e}get isAttached(){return null!==this._sceneNode}get sceneNode(){return this._sceneNode}get useBoundingBox(){return this._useBoundingBox}get attachmentType(){return this._attachmentType}attach(e,t,s){this._sceneNode===e||(this.detach(),e&&(this._attachmentType=s,this._sceneNode=e,this._sceneNode.onDisposeObservable.add(this.dispose),this._useBoundingBox=t))}detach(){this._sceneNode?.onDisposeObservable.removeCallback(this.dispose),this._sceneNode=null}update(){let e=!!(1&this._attachmentType);e&&(this._useBoundingBox&&this._sceneNode.getBoundingInfo?this._position.copyFrom(this._sceneNode.getBoundingInfo().boundingBox.centerWorld):this._sceneNode?.getWorldMatrix().getTranslationToRef(this._position),this._spatialAudioNode.position.copyFrom(this._position),this._spatialAudioNode._updatePosition()),2&this._attachmentType&&(this._sceneNode?.getWorldMatrix().decompose(void 0,this._rotationQuaternion),this._spatialAudioNode.rotationQuaternion.copyFrom(this._rotationQuaternion),this._spatialAudioNode._updateRotation()),!e&&"panningEnabled"in this._spatialAudioNode&&!this._spatialAudioNode.panningEnabled&&this._spatialAudioNode._updatePosition()}}class nL extends nb{constructor(e){super("Spatial",e),this._attacherComponent=null}get isAttached(){return null!==this._attacherComponent&&this._attacherComponent.isAttached}get attachedNode(){return this._attacherComponent?.sceneNode??null}get useBoundingBox(){return this._attacherComponent?.useBoundingBox??!1}get attachmentType(){return this._attacherComponent?.attachmentType??3}attach(e,t,s){this.detach(),this._attacherComponent||(this._attacherComponent=new nP(this)),this._attacherComponent.attach(e,t,s)}detach(){this._attacherComponent?.detach()}dispose(){super.dispose(),this._attacherComponent?.dispose(),this._attacherComponent=null}setOptions(e){this.coneInnerAngle=e.spatialConeInnerAngle??n_.coneInnerAngle,this.coneOuterAngle=e.spatialConeOuterAngle??n_.coneOuterAngle,this.coneOuterVolume=e.spatialConeOuterVolume??n_.coneOuterVolume,this.distanceModel=e.spatialDistanceModel??n_.distanceModel,this.maxDistance=e.spatialMaxDistance??n_.maxDistance,this.minDistance=e.spatialMinDistance??n_.minDistance,this.orientation=e.spatialOrientation??n_.orientation,this.panningEnabled=e.spatialPanningEnabled??n_.panningEnabled,this.panningModel=e.spatialPanningModel??n_.panningModel,this.rolloffFactor=e.spatialRolloffFactor??n_.rolloffFactor,e.spatialPosition&&(this.position=e.spatialPosition.clone()),e.spatialRotationQuaternion?this.rotationQuaternion=e.spatialRotationQuaternion.clone():e.spatialRotation?this.rotation=e.spatialRotation.clone():this.rotationQuaternion=n_.rotationQuaternion.clone(),this.update()}update(){this.isAttached?this._attacherComponent?.update():(this._updatePosition(),this._updateRotation())}}function nG(e){return e.getSubNode("Spatial")}function nD(e,t,s){e.callOnSubNode("Spatial",e=>{e[t]=s})}var nV=e.i(65295);let nU=RegExp("\\.(\\w{3,4})($|\\?)"),nK=new Float32Array([0,0]),nH=null,n$=null,nz=null;function nq(e){return e.replace(/#/gm,"%23")}function nW(e){let{url:t,headers:s}=nV.WebRequest._CollectCustomizations(e);return Object.keys(s).length>0&&L.Logger.Warn("WebAudioStreamingSound: Custom request headers cannot be applied to a streaming <audio> element and will be ignored. To use custom headers with audio, switch to a static (non-streaming) sound which fetches the file up-front."),t}async function nj(e){let t=await nV.WebRequest.FetchAsync(e);if(!t.ok)throw Error(`HTTP ${t.status} loading '${e}': ${t.statusText}`);return{data:await t.arrayBuffer(),contentType:t.headers.get("Content-Type")??""}}let nY=!0;class nQ{constructor(e,t){this._rampEndTime=0,this._engine=e,this._param=t,this._targetValue=t.value}get isRamping(){return this._engine.currentTime<this._rampEndTime}get targetValue(){return this._targetValue}set targetValue(e){this.setTargetValue(e)}get value(){return this._param.value}dispose(){this._param=null,this._engine=null}setTargetValue(e,t=null){if(!Number.isFinite(e))return void L.Logger.Warn(`Attempted to set audio parameter to non-finite value: ${e}`);this._param.cancelScheduledValues(0);let s="string"==typeof t?.shape?t.shape:"linear",n=this._engine.currentTime;if("none"===s){this._param.value=this._targetValue=e,this._rampEndTime=n;return}let o="number"==typeof t?.duration?Math.max(t.duration,this._engine.parameterRampDuration):this._engine.parameterRampDuration;if(this._targetValue=e,(o=Math.max(this._engine.parameterRampDuration,o))<1e-6)return void this._param.setValueAtTime(e,n);try{this._param.setValueCurveAtTime(function(e,t,s){let n;if(nH||(nH=new Float32Array(100)),"linear"===e)return nK[0]=t,nK[1]=s,nK;if("exponential"===e)n=function(){if(!n$){n$=new Float32Array(100);let e=1/99,t=1/99;for(let s=1;s<100;s++)n$[s]=Math.exp(-11.512925464970227*(1-t)),t+=e}return n$}();else if("logarithmic"===e)n=function(){if(!nz){nz=new Float32Array(100);let e=.01;for(let t=0;t<100;t++)nz[t]=1+Math.log10(e)/Math.log10(100),e+=.01}return nz}();else throw Error(`Unknown ramp shape: ${e}`);let o=Math.sign(s-t),a=Math.abs(s-t);if(1===o)for(let e=0;e<n.length;e++)nH[e]=t+a*n[e];else{let e=99;for(let s=0;s<n.length;s++,e--)nH[s]=t-a*(1-n[e])}return nH}(s,Number.isFinite(this._param.value)?this._param.value:0,e),n,o),this._rampEndTime=n+o}catch(e){nY&&(L.Logger.Warn(`Audio parameter ramping failed: ${e.message}`),nY=!1)}}}let nZ=el.Matrix.Zero(),nX=new el.Quaternion;function nJ(e){return e*Math.PI/180}function n0(e){return 180*e/Math.PI}async function n1(e){return new n3(e)}class n3 extends nL{constructor(e){super(e),this._lastOrientation=el.Vector3.Zero(),this._lastPosition=el.Vector3.Zero(),this._lastRotation=el.Vector3.Zero(),this._lastRotationQuaternion=new el.Quaternion,this._panningEnabled=n_.panningEnabled,this.orientation=n_.orientation.clone(),this.position=n_.position.clone(),this.rotation=n_.rotation.clone(),this.rotationQuaternion=n_.rotationQuaternion.clone(),this._inputNode=new GainNode(e._audioContext),this._attenuationNode=new GainNode(e._audioContext),this._attenuation=new nQ(e,this._attenuationNode.gain),this.node=new PannerNode(e._audioContext),this._orientationX=new nQ(e,this.node.orientationX),this._orientationY=new nQ(e,this.node.orientationY),this._orientationZ=new nQ(e,this.node.orientationZ),this._positionX=new nQ(e,this.node.positionX),this._positionY=new nQ(e,this.node.positionY),this._positionZ=new nQ(e,this.node.positionZ),this._connectActiveInput()}dispose(){super.dispose(),this._attenuation.dispose(),this._orientationX.dispose(),this._orientationY.dispose(),this._orientationZ.dispose(),this._positionX.dispose(),this._positionY.dispose(),this._positionZ.dispose(),this._inputNode.disconnect(),this._attenuationNode.disconnect(),this.node.disconnect()}get coneInnerAngle(){return nJ(this.node.coneInnerAngle)}set coneInnerAngle(e){this.node.coneInnerAngle=n0(e)}get coneOuterAngle(){return nJ(this.node.coneOuterAngle)}set coneOuterAngle(e){this.node.coneOuterAngle=n0(e)}get coneOuterVolume(){return this.node.coneOuterGain}set coneOuterVolume(e){this.node.coneOuterGain=e}get distanceModel(){return this.node.distanceModel}set distanceModel(e){this.node.distanceModel=e;let t=this.node.maxDistance;this.node.maxDistance=t+.001,this.node.maxDistance=t,this._updateAttenuation()}get minDistance(){return this.node.refDistance}set minDistance(e){this.node.refDistance=e,this._updateAttenuation()}get maxDistance(){return this.node.maxDistance}set maxDistance(e){this.node.maxDistance=e,this._updateAttenuation()}get panningEnabled(){return this._panningEnabled}set panningEnabled(e){this._panningEnabled!==e&&(this._panningEnabled=e,this._connectActiveInput(),this._updateAttenuation())}get panningModel(){return this.node.panningModel}set panningModel(e){this.node.panningModel=e}get rolloffFactor(){return this.node.rolloffFactor}set rolloffFactor(e){this.node.rolloffFactor=e,this._updateAttenuation()}get _inNode(){return this._inputNode}get _outNode(){return this._panningEnabled?this.node:this._attenuationNode}_updatePosition(){this._lastPosition.equalsWithEpsilon(this.position)||(this._positionX.targetValue=this.position.x,this._positionY.targetValue=this.position.y,this._positionZ.targetValue=this.position.z,this._lastPosition.copyFrom(this.position)),this._updateAttenuation()}_updateRotation(){let e=!1;if(this._lastRotationQuaternion.equalsWithEpsilon(this.rotationQuaternion))if(this._lastRotation.equalsWithEpsilon(this.rotation)){if(this._lastOrientation.equalsWithEpsilon(this.orientation))return}else el.Quaternion.FromEulerAnglesToRef(this.rotation.x,this.rotation.y,this.rotation.z,nX),this._lastRotation.copyFrom(this.rotation),e=!0;else nX.copyFrom(this.rotationQuaternion),this._lastRotationQuaternion.copyFrom(this.rotationQuaternion),e=!0;e&&(el.Matrix.FromQuaternionToRef(nX,nZ),el.Vector3.TransformNormalToRef(el.Vector3.RightReadOnly,nZ,this.orientation)),this._orientationX.targetValue=this.orientation.x,this._orientationY.targetValue=this.orientation.y,this._orientationZ.targetValue=this.orientation.z}_connect(e){return!!super._connect(e)&&(e._inNode&&(this.node.connect(e._inNode),this._attenuationNode.connect(e._inNode)),!0)}_disconnect(e){return!!super._disconnect(e)&&(e._inNode&&(this.node.disconnect(e._inNode),this._attenuationNode.disconnect(e._inNode)),!0)}getClassName(){return"_SpatialWebAudioSubNode"}_connectActiveInput(){this._inputNode.disconnect(),this._panningEnabled?this._inputNode.connect(this.node):this._inputNode.connect(this._attenuationNode)}_updateAttenuation(){if(this._panningEnabled){this._attenuation.targetValue=1;return}let e=this.engine.listener.position,t=this.position.x-e.x,s=this.position.y-e.y,n=this.position.z-e.z,o=Math.sqrt(t*t+s*s+n*n),a=Math.max(this.minDistance,0),i=1;switch(this.distanceModel){case"linear":{let e=Math.max(this.maxDistance,a),t=Math.min(Math.max(o,a),e);i=e===a?+(o<=a):1-this.rolloffFactor*(t-a)/(e-a)}break;case"inverse":if(0===a){i=0;break}i=a/(a+this.rolloffFactor*(Math.max(o,a)-a));break;case"exponential":if(0===a){i=0;break}i=Math.pow(Math.max(o,a)/a,-this.rolloffFactor)}this._attenuation.targetValue=Math.min(Math.max(i,0),1)}}async function n2(e){return new n7(e)}class n7 extends nB{constructor(e){super(e),this.node=new StereoPannerNode(e._audioContext),this._pan=new nQ(e,this.node.pan)}dispose(){super.dispose(),this._pan.dispose()}get pan(){return this._pan.targetValue}set pan(e){this._pan.targetValue=e}get _inNode(){return this.node}get _outNode(){return this.node}getClassName(){return"_StereoWebAudioSubNode"}_connect(e){return!!super._connect(e)&&(e._inNode&&this.node.connect(e._inNode),!0)}_disconnect(e){return!!super._disconnect(e)&&(e._inNode&&this.node.disconnect(e._inNode),!0)}}class n4{constructor(){this._createSubNodePromises={},this._isDisposed=!1,this._subNodes={},this._onSubNodeDisposed=e=>{delete this._subNodes[e.name],this._onSubNodesChanged()}}callOnSubNode(e,t){let s=this.getSubNode(e);s?t(s):this._createSubNodePromisesResolvedAsync().then(()=>{let s=this.getSubNode(e);s?t(s):this.createAndAddSubNodeAsync(e).then(e=>{t(e)})})}createAndAddSubNodeAsync(e){var t;return(t=this._createSubNodePromises)[e]||(t[e]=this._createSubNode(e).then(e=>(this._addSubNode(e),e))),this._createSubNodePromises[e]}dispose(){for(let e of(this._isDisposed=!0,Object.values(this._subNodes)))e.dispose();this._subNodes={},this._createSubNodePromises={}}getSubNode(e){return this._subNodes[e]??null}async removeSubNodeAsync(e){if(!e)return;await this._createSubNodePromisesResolvedAsync();let t=e.name;this._subNodes[t]&&delete this._subNodes[t],delete this._createSubNodePromises[t],this._onSubNodesChanged()}async _createSubNodePromisesResolvedAsync(){return await Promise.all(Object.values(this._createSubNodePromises))}_addSubNode(e){this._isDisposed?e.dispose():(this._subNodes[e.name]=e,e.onDisposeObservable.addOnce(this._onSubNodeDisposed),this._onSubNodesChanged())}}async function n5(e){return new n8(e)}class n8 extends nA{constructor(e){super(e);const t=this.node=new GainNode(e._audioContext);this._volume=new nQ(e,t.gain)}dispose(){super.dispose(),this._volume.dispose()}get volume(){return this._volume.value}set volume(e){this.setVolume(e)}get _inNode(){return this.node}get _outNode(){return this.node}setVolume(e,t=null){this._volume.setTargetValue(e,t)}_connect(e){return!!super._connect(e)&&(e._inNode&&this.node.connect(e._inNode),!0)}_disconnect(e){return!!super._disconnect(e)&&(e._inNode&&this.node.disconnect(e._inNode),!0)}getClassName(){return"_VolumeWebAudioSubNode"}}async function n6(e){return new n9(e)}class n9 extends nv{constructor(e){super(e),this._byteFrequencyData=null,this._byteTimeDomainData=null,this._floatFrequencyData=null,this._floatTimeDomainData=null,this._analyzerNode=new AnalyserNode(e._audioContext)}get fftSize(){return this._analyzerNode.fftSize}set fftSize(e){e!==this._analyzerNode.fftSize&&(this._analyzerNode.fftSize=e,this._clearArrays())}get _inNode(){return this._analyzerNode}get minDecibels(){return this._analyzerNode.minDecibels}set minDecibels(e){this._analyzerNode.minDecibels=e}get maxDecibels(){return this._analyzerNode.maxDecibels}set maxDecibels(e){this._analyzerNode.maxDecibels=e}get smoothing(){return this._analyzerNode.smoothingTimeConstant}set smoothing(e){this._analyzerNode.smoothingTimeConstant=e}dispose(){super.dispose(),this._clearArrays(),this._analyzerNode.disconnect()}getClassName(){return"_WebAudioAnalyzerSubNode"}getByteFrequencyData(){return this._byteFrequencyData&&0!==this._byteFrequencyData.length||(this._byteFrequencyData=new Uint8Array(this._analyzerNode.frequencyBinCount)),this._analyzerNode.getByteFrequencyData(this._byteFrequencyData),this._byteFrequencyData}getByteTimeDomainData(){return this._byteTimeDomainData&&0!==this._byteTimeDomainData.length||(this._byteTimeDomainData=new Uint8Array(this._analyzerNode.fftSize)),this._analyzerNode.getByteTimeDomainData(this._byteTimeDomainData),this._byteTimeDomainData}getFloatFrequencyData(){return this._floatFrequencyData&&0!==this._floatFrequencyData.length||(this._floatFrequencyData=new Float32Array(this._analyzerNode.frequencyBinCount)),this._analyzerNode.getFloatFrequencyData(this._floatFrequencyData),this._floatFrequencyData}getFloatTimeDomainData(){return this._floatTimeDomainData&&0!==this._floatTimeDomainData.length||(this._floatTimeDomainData=new Float32Array(this._analyzerNode.fftSize)),this._analyzerNode.getFloatTimeDomainData(this._floatTimeDomainData),this._floatTimeDomainData}_clearArrays(){this._byteFrequencyData=null,this._byteTimeDomainData=null,this._floatFrequencyData=null,this._floatTimeDomainData=null}}class oe extends n4{constructor(e){super(),this._outputNode=null,this._owner=e}async initAsync(e){let t=e.analyzerEnabled||void 0!==e.analyzerFFTSize||void 0!==e.analyzerMinDecibels||void 0!==e.analyzerMaxDecibels||void 0!==e.analyzerSmoothing;if(t&&await this.createAndAddSubNodeAsync("Analyzer"),await this.createAndAddSubNodeAsync("Volume"),await this._createSubNodePromisesResolvedAsync(),t){let t=nM(this);if(!t)throw Error("No analyzer subnode.");t.setOptions(e)}let s=nx(this);if(!s)throw Error("No volume subnode.");if(s.setOptions(e),"_VolumeWebAudioSubNode"!==s.getClassName())throw Error("Not a WebAudio subnode.");if(this._outputNode=s.node,this._outputNode&&this._downstreamNodes){let e=this._downstreamNodes.values();for(let t=e.next();!t.done;t=e.next()){let e=t.value._inNode;e&&this._outputNode.connect(e)}}}get _inNode(){return this._outputNode}get _outNode(){return this._outputNode}_createSubNode(e){switch(e){case"Analyzer":return n6(this._owner.engine);case"Volume":return n5(this._owner.engine);default:throw Error(`Unknown subnode name: ${e}`)}}_onSubNodesChanged(){let e=nM(this),t=nx(this);e&&t&&t.connect(e)}}class ot extends oe{constructor(){super(...arguments),this._rootNode=null,this._inputNode=null}async initAsync(e){let t,s;await super.initAsync(e),(t=nm(e))&&await this.createAndAddSubNodeAsync("Spatial"),(s=e.stereoEnabled||void 0!==e.stereoPan)&&await this.createAndAddSubNodeAsync("Stereo"),await this._createSubNodePromisesResolvedAsync(),t&&nG(this)?.setOptions(e),s&&nk(this)?.setOptions(e)}get _inNode(){return this._inputNode}_createSubNode(e){try{return super._createSubNode(e)}catch(e){}switch(e){case"Spatial":return n1(this._owner.engine);case"Stereo":return n2(this._owner.engine);default:throw Error(`Unknown subnode name: ${e}`)}}_onSubNodesChanged(){let e;super._onSubNodesChanged();let t=nG(this),s=nk(this),n=nx(this);if(t&&"_SpatialWebAudioSubNode"!==t.getClassName()||s&&"_StereoWebAudioSubNode"!==s.getClassName()||n&&"_VolumeWebAudioSubNode"!==n.getClassName())throw Error("Not a WebAudio subnode.");t&&(t.disconnectAll(),n&&t.connect(n)),s&&(s.disconnectAll(),n&&s.connect(n)),t&&s?(this._rootNode=new GainNode(this._owner.engine._audioContext),this._rootNode.connect(t._inNode),this._rootNode.connect(s._inNode)):(this._rootNode?.disconnect(),this._rootNode=null);let o=null;if(this._rootNode?e=this._rootNode:(t?o=t:s?o=s:n&&(o=n),e=o?._inNode??null),this._inputNode!==e){if(this._inputNode&&this._upstreamNodes){let e=this._upstreamNodes.values();for(let t=e.next();!t.done;t=e.next())t.value._outNode?.disconnect(this._inputNode)}if(this._inputNode=e,e&&this._upstreamNodes){let t=this._upstreamNodes.values();for(let s=t.next();!s.done;s=t.next())s.value._outNode?.connect(e)}}}}class os extends nf{constructor(e){super(),this._coneInnerAngle=n_.coneInnerAngle,this._coneOuterAngle=n_.coneOuterAngle,this._coneOuterVolume=n_.coneOuterVolume,this._distanceModel=n_.distanceModel,this._maxDistance=n_.maxDistance,this._minDistance=n_.minDistance,this._panningEnabled=n_.panningEnabled,this._panningModel=n_.panningModel,this._rolloffFactor=n_.rolloffFactor;const t=nG(e);t?(this._orientation=t.orientation.clone(),this._panningEnabled=t.panningEnabled,this._position=t.position.clone(),this._rotation=t.rotation.clone(),this._rotationQuaternion=t.rotationQuaternion.clone()):(this._orientation=n_.orientation.clone(),this._position=n_.position.clone(),this._rotation=n_.rotation.clone(),this._rotationQuaternion=n_.rotationQuaternion.clone(),e.createAndAddSubNodeAsync("Spatial")),this._subGraph=e}dispose(){this._subGraph.removeSubNodeAsync(nG(this._subGraph))}get coneInnerAngle(){return this._coneInnerAngle}set coneInnerAngle(e){this._coneInnerAngle=e,nD(this._subGraph,"coneInnerAngle",e)}get coneOuterAngle(){return this._coneOuterAngle}set coneOuterAngle(e){this._coneOuterAngle=e,nD(this._subGraph,"coneOuterAngle",e)}get coneOuterVolume(){return this._coneOuterVolume}set coneOuterVolume(e){this._coneOuterVolume=e,nD(this._subGraph,"coneOuterVolume",e)}get distanceModel(){return this._distanceModel}set distanceModel(e){this._distanceModel=e,nD(this._subGraph,"distanceModel",e)}get isAttached(){return this._subGraph.getSubNode("Spatial")?.isAttached??!1}get attachedNode(){return this._subGraph.getSubNode("Spatial")?.attachedNode??null}get useBoundingBox(){return this._subGraph.getSubNode("Spatial")?.useBoundingBox??!1}get attachmentType(){return this._subGraph.getSubNode("Spatial")?.attachmentType??3}get maxDistance(){return this._maxDistance}set maxDistance(e){e<=0&&(e=1e-6),this._maxDistance=e,nD(this._subGraph,"maxDistance",e)}get minDistance(){return this._minDistance}set minDistance(e){this._minDistance=e,nD(this._subGraph,"minDistance",e)}get orientation(){return this._orientation}set orientation(e){this._orientation=e,this._updateRotation()}get panningEnabled(){return this._panningEnabled}set panningEnabled(e){this._panningEnabled=e,nD(this._subGraph,"panningEnabled",e)}get panningModel(){return this._panningModel}set panningModel(e){this._panningModel=e,nD(this._subGraph,"panningModel",e)}get position(){return this._position}set position(e){this._position=e,this._updatePosition()}get rolloffFactor(){return this._rolloffFactor}set rolloffFactor(e){this._rolloffFactor=e,nD(this._subGraph,"rolloffFactor",e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this._updateRotation()}get rotationQuaternion(){return this._rotationQuaternion}set rotationQuaternion(e){this._rotationQuaternion=e,this._updateRotation()}attach(e,t=!1,s=3){nG(this._subGraph)?.attach(e,t,s)}detach(){nG(this._subGraph)?.detach()}update(){let e=nG(this._subGraph);e&&(e.isAttached?e.update():(this._updatePosition(e),this._updateRotation(e)))}_updatePosition(e=null){(e||(e=nG(this._subGraph)))&&(e.position.equalsWithEpsilon(this._position)?e.panningEnabled||e._updatePosition():(e.position.copyFrom(this._position),e._updatePosition()))}_updateRotation(e=null){(e||(e=nG(this._subGraph)))&&(e.rotationQuaternion.equalsWithEpsilon(this._rotationQuaternion)?e.rotation.equalsWithEpsilon(this._rotation)?e.orientation.equalsWithEpsilon(this._orientation)||(e.orientation.copyFrom(this._orientation),e._updateRotation(),this._rotation.copyFrom(e.rotation),this._rotationQuaternion.copyFrom(e.rotationQuaternion)):(e.rotation.copyFrom(this._rotation),e._updateRotation(),this._orientation.copyFrom(e.orientation),this._rotationQuaternion.copyFrom(e.rotationQuaternion)):(e.rotationQuaternion.copyFrom(this._rotationQuaternion),e._updateRotation(),this._orientation.copyFrom(e.orientation),this._rotation.copyFrom(e.rotation)))}}var on=e.i(36395);class oo{constructor(e,t,s){if(this._autoUpdate=!0,this._lastUpdateTime=0,this.minUpdateTime=0,!t)return;this.minUpdateTime=s;const n=()=>{if(!this._autoUpdate)return;let t=!1;if(0<this.minUpdateTime){let e=on.PrecisionDate.Now;this._lastUpdateTime&&e-this._lastUpdateTime<1e3*this.minUpdateTime&&(t=!0),this._lastUpdateTime=e}t||e.update(),requestAnimationFrame(n)};requestAnimationFrame(n)}dispose(){this._autoUpdate=!1}}class oa extends os{constructor(e,t,s){super(e),this._updaterComponent=new oo(this,t,s)}get minUpdateTime(){return this._updaterComponent.minUpdateTime}set minUpdateTime(e){this._updaterComponent.minUpdateTime=e}dispose(){super.dispose(),this._updaterComponent.dispose(),this._updaterComponent=null}}class oi extends nN{constructor(e,t,s,n){super(e,s,n),this._stereo=null,this._webAudioNode=null,this._audioContext=this.engine._audioContext,this._webAudioNode=t,this._subGraph=new oi._SubGraph(this)}async _initAsync(e){e.outBus?this.outBus=e.outBus:!1!==e.outBusAutoDefault&&(await this.engine.isReadyPromise,this.outBus=this.engine.defaultMainBus),await this._subGraph.initAsync(e),nm(e)&&this._initSpatialProperty(),this.engine._addNode(this)}get _inNode(){return this._webAudioNode}get _outNode(){return this._subGraph._outNode}get stereo(){return this._stereo??(this._stereo=new nR(this._subGraph))}dispose(){if(super.dispose(),this._webAudioNode){if(this._webAudioNode instanceof MediaStreamAudioSourceNode)for(let e of this._webAudioNode.mediaStream.getTracks())e.stop();this._webAudioNode.disconnect(),this._webAudioNode=null}this._stereo=null,this._subGraph.dispose(),this.engine._removeNode(this)}getClassName(){return"_WebAudioSoundSource"}_connect(e){return!!super._connect(e)&&(e._inNode&&this._outNode?.connect(e._inNode),!0)}_disconnect(e){return!!super._disconnect(e)&&(e._inNode&&this._outNode?.disconnect(e._inNode),!0)}_createSpatialProperty(e,t){return new oa(this._subGraph,e,t)}}oi._SubGraph=class extends ot{get _downstreamNodes(){return this._owner._downstreamNodes??null}get _upstreamNodes(){return this._owner._upstreamNodes??null}_onSubNodesChanged(){super._onSubNodesChanged(),this._owner._inNode?.disconnect(),this._owner._subGraph._inNode&&this._owner._inNode?.connect(this._owner._subGraph._inNode)}};class or extends nN{constructor(e,t,s){super(e,t,s,3),this._newestInstance=null,this._privateInstances=new Set,this._state=1,this._instances=this._privateInstances,this.onEndedObservable=new N.Observable,this._onInstanceEnded=e=>{this._newestInstance===e&&(this._newestInstance=null),e.onStateChangedObservable.removeCallback(this._onInstanceStateChanged),this._privateInstances.delete(e),0===this._instances.size&&(this._state=1,this.onEndedObservable.notifyObservers(this)),e.dispose(),this.engine._onSoundPlaybackStateChanged()},this._onInstanceStateChanged=e=>{this.engine._onSoundPlaybackStateChanged()}}get activeInstancesCount(){return this._instances.size}get autoplay(){return this._options.autoplay}get currentTime(){let e=this._getNewestInstance();return e?e.currentTime:0}set currentTime(e){this.startOffset=e;let t=this._getNewestInstance();t&&(t.currentTime=e)}get loop(){return this._options.loop}set loop(e){this._options.loop=e}get maxInstances(){return this._options.maxInstances}set maxInstances(e){this._options.maxInstances=e}get startOffset(){return this._options.startOffset}set startOffset(e){this._options.startOffset=e}get state(){return this._state}dispose(){super.dispose(),this.stop(),this._newestInstance=null,this._privateInstances.clear(),this.onEndedObservable.clear()}pause(){let e=this._instances.values();for(let t=e.next();!t.done;t=e.next())t.value.pause();this._state=5,this.engine._onSoundPlaybackStateChanged()}resume(){if(5!==this._state)return;let e=this._instances.values();for(let t=e.next();!t.done;t=e.next())t.value.resume();this._state=3,this.engine._onSoundPlaybackStateChanged()}_beforePlay(e){5===this.state&&this._instances.size>0?this.resume():(e.onEndedObservable.addOnce(this._onInstanceEnded),e.onStateChangedObservable.add(this._onInstanceStateChanged),this._privateInstances.add(e),this._newestInstance=e)}_afterPlay(e){this._state=e.state,this.engine._onSoundPlaybackStateChanged()}_getNewestInstance(){if(0===this._instances.size)return null;if(!this._newestInstance){let e=this._instances.values();for(let t=e.next();!t.done;t=e.next())this._newestInstance=t.value}return this._newestInstance}_setState(e){this._state=e}_stopExcessInstances(){if(this.maxInstances<1/0){let e=Array.from(this._instances).filter(e=>3===e.state),t=e.length-this.maxInstances;for(let s=0;s<t;s++)e[s].stop()}}}class ol extends or{constructor(e,t,s){super(e,t,s)}get duration(){return this._options.duration}set duration(e){this._options.duration=e}get loopStart(){return this._options.loopStart}set loopStart(e){this._options.loopStart=e}get loopEnd(){return this._options.loopEnd}set loopEnd(e){this._options.loopEnd=e}get pitch(){return this._options.pitch}set pitch(e){this._options.pitch=e;let t=this._instances.values();for(let s=t.next();!s.done;s=t.next())s.value.pitch=e}get playbackRate(){return this._options.playbackRate}set playbackRate(e){this._options.playbackRate=e;let t=this._instances.values();for(let s=t.next();!s.done;s=t.next())s.value.playbackRate=e}play(e={}){if(5===this.state)return void this.resume();e.duration??(e.duration=this.duration),e.loop??(e.loop=this.loop),e.loopStart??(e.loopStart=this.loopStart),e.loopEnd??(e.loopEnd=this.loopEnd),e.startOffset??(e.startOffset=this.startOffset),e.volume??(e.volume=1),e.waitTime??(e.waitTime=0);let t=this._createInstance();this._beforePlay(t),t.play(e),this._afterPlay(t),this._stopExcessInstances()}stop(e={}){if(e.waitTime&&0<e.waitTime?this._setState(0):this._setState(1),this._instances)for(let t of Array.from(this._instances))t.stop(e)}}let oh=1;class ou{constructor(e){this.name=`StaticSoundBuffer #${oh++}`,this.engine=e}}class oc extends ng{constructor(e){super(e.engine,2),this._state=1,this.onEndedObservable=new N.Observable,this.onErrorObservable=new N.Observable,this.onStateChangedObservable=new N.Observable,this._sound=e}get state(){return this._state}dispose(){super.dispose(),this.stop(),this.onEndedObservable.clear(),this.onStateChangedObservable.clear()}_setState(e){this._state!==e&&(this._state=e,this.onStateChangedObservable.notifyObservers(this),1===this._state&&this.onEndedObservable.notifyObservers(this))}}class od extends oc{}class op extends ol{constructor(e,t,s){super(e,t,s),this._stereo=null,this._options={autoplay:s.autoplay??!1,duration:s.duration??0,loop:s.loop??!1,loopEnd:s.loopEnd??0,loopStart:s.loopStart??0,maxInstances:s.maxInstances??1/0,pitch:s.pitch??0,playbackRate:s.playbackRate??1,startOffset:s.startOffset??0},this._subGraph=new op._SubGraph(this)}async _initAsync(e,t){this._audioContext=this.engine._audioContext,e instanceof o_?this._buffer=e:("string"==typeof e||Array.isArray(e)||e instanceof ArrayBuffer||e instanceof AudioBuffer)&&(this._buffer=await this.engine.createSoundBufferAsync(e,t)),t.outBus?this.outBus=t.outBus:!1!==t.outBusAutoDefault&&(await this.engine.isReadyPromise,this.outBus=this.engine.defaultMainBus),await this._subGraph.initAsync(t),nm(t)&&this._initSpatialProperty(),t.autoplay&&this.play(),this.engine._addSound(this)}get buffer(){return this._buffer}get _inNode(){return this._subGraph._inNode}get _outNode(){return this._subGraph._outNode}get stereo(){return this._stereo??(this._stereo=new nR(this._subGraph))}async cloneAsync(e=null){let t=await this.engine.createSoundAsync(this.name,e?.cloneBuffer?this.buffer.clone():this.buffer,this._options);return t.outBus=e?.outBus?e.outBus:this.outBus,t}dispose(){super.dispose(),this._stereo=null,this._subGraph.dispose(),this.engine._removeSound(this)}getClassName(){return"_WebAudioStaticSound"}_createInstance(){return new om(this,this._options)}_connect(e){return!!super._connect(e)&&(e._inNode&&this._outNode?.connect(e._inNode),!0)}_disconnect(e){return!!super._disconnect(e)&&(e._inNode&&this._outNode?.disconnect(e._inNode),!0)}_createSpatialProperty(e,t){return new oa(this._subGraph,e,t)}_getOptions(){return this._options}}op._SubGraph=class extends ot{get _downstreamNodes(){return this._owner._downstreamNodes??null}get _upstreamNodes(){return this._owner._upstreamNodes??null}};class o_ extends ou{constructor(e){super(e)}async _initAsync(e,t){e instanceof AudioBuffer?this._audioBuffer=e:"string"==typeof e?await this._initFromUrlAsync(e):Array.isArray(e)?await this._initFromUrlsAsync(e,t.skipCodecCheck??!1):e instanceof ArrayBuffer&&await this._initFromArrayBufferAsync(e)}get channelCount(){return this._audioBuffer.numberOfChannels}get duration(){return this._audioBuffer.duration}get length(){return this._audioBuffer.length}get sampleRate(){return this._audioBuffer.sampleRate}clone(e=null){let t=new AudioBuffer({length:this._audioBuffer.length,numberOfChannels:this._audioBuffer.numberOfChannels,sampleRate:this._audioBuffer.sampleRate});for(let e=0;e<this._audioBuffer.numberOfChannels;e++)t.copyToChannel(this._audioBuffer.getChannelData(e),e);let s=new o_(this.engine);return s._audioBuffer=t,s.name=e?.name?e.name:this.name,s}async _initFromArrayBufferAsync(e){this._audioBuffer=await this.engine._audioContext.decodeAudioData(e)}async _initFromUrlAsync(e){e=nq(e);let{data:t}=await nj(e);await this._initFromArrayBufferAsync(t)}async _initFromUrlsAsync(e,t){for(let s of e){if(t)await this._initFromUrlAsync(s);else{let e=s.match(nU),t=e?.at(1);if(t&&this.engine.isFormatValid(t))try{await this._initFromUrlAsync(s)}catch{t&&0<t.length&&this.engine.flagInvalidFormat(t)}}if(this._audioBuffer)break}}}class om extends od{constructor(e,t){super(e),this._enginePlayTime=0,this._enginePauseTime=0,this._isConnected=!1,this._pitch=null,this._playbackRate=null,this._sourceNode=null,this._onEnded=()=>{this._enginePlayTime=0,5!==this._state&&this.onEndedObservable.notifyObservers(this),this._deinitSourceNode()},this._onEngineStateChanged=()=>{"running"===this.engine.state&&(this._options.loop&&2===this.state&&this.play(),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged))},this._options=t,this._volumeNode=new GainNode(e._audioContext),this._initSourceNode()}dispose(){super.dispose(),this._pitch?.dispose(),this._playbackRate?.dispose(),this.stop(),this._deinitSourceNode(),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged)}get currentTime(){if(1===this._state)return 0;let e=5===this._state?0:this.engine.currentTime-this._enginePlayTime;return this._enginePauseTime+e+this._options.startOffset}set currentTime(e){let t=2===this._state||3===this._state;if(t){let e=this._sourceNode;this._deinitSourceNode(),e?.stop(),this._state=1}5===this.state&&(this._enginePauseTime=0),this._options.startOffset=e,t&&this.play()}get _outNode(){return this._volumeNode}set pitch(e){this._pitch?.setTargetValue(e)}set playbackRate(e){this._playbackRate?.setTargetValue(e)}get startTime(){return 1===this._state?0:this._enginePlayTime}getClassName(){return"_WebAudioStaticSoundInstance"}play(e={}){if(3===this._state)return;void 0!==e.duration&&(this._options.duration=e.duration),void 0!==e.loop&&(this._options.loop=e.loop),void 0!==e.loopStart&&(this._options.loopStart=e.loopStart),void 0!==e.loopEnd&&(this._options.loopEnd=e.loopEnd),void 0!==e.startOffset&&(this._options.startOffset=e.startOffset);let t=this._options.startOffset;5===this._state&&(t+=this._enginePauseTime,t%=this._sound.buffer.duration),this._enginePlayTime=this.engine.currentTime+(e.waitTime??0),this._volumeNode.gain.value=e.volume??1,this._initSourceNode(),"running"===this.engine.state?(this._setState(3),this._sourceNode?.start(this._enginePlayTime,t,this._options.duration>0?this._options.duration:void 0)):this._options.loop&&(this._setState(2),this.engine.stateChangedObservable.add(this._onEngineStateChanged))}pause(){if(3!==this._state&&2!==this._state)return;let e=3===this._state;this._setState(5),this._enginePauseTime+=this.engine.currentTime-this._enginePlayTime,e?this._sourceNode?.stop():this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged),this._deinitSourceNode()}resume(){5===this._state&&this.play()}stop(e={}){if(1!==this._state){if(3===this._state){let t=this.engine.currentTime+(e.waitTime??0);this._sourceNode?.stop(t)}(void 0===e.waitTime||e.waitTime<=0)&&(this._setState(1),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged))}}_connect(e){return!!super._connect(e)&&(e instanceof op&&e._inNode&&(this._outNode?.connect(e._inNode),this._isConnected=!0),!0)}_disconnect(e){return!!super._disconnect(e)&&(e instanceof op&&e._inNode&&(this._outNode?.disconnect(e._inNode),this._isConnected=!1),!0)}_deinitSourceNode(){if(this._sourceNode){if(this._isConnected&&!this._disconnect(this._sound))throw Error("Disconnect failed");this._sourceNode.disconnect(this._volumeNode),this._sourceNode.removeEventListener("ended",this._onEnded),this._sourceNode=null}}_initSourceNode(){if(!this._sourceNode){if(this._sourceNode=new AudioBufferSourceNode(this._sound._audioContext,{buffer:this._sound.buffer._audioBuffer}),this._sourceNode.addEventListener("ended",this._onEnded,{once:!0}),this._sourceNode.connect(this._volumeNode),!this._connect(this._sound))throw Error("Connect failed");this._pitch=new nQ(this.engine,this._sourceNode.detune),this._playbackRate=new nQ(this.engine,this._sourceNode.playbackRate)}let e=this._sourceNode;e.detune.value=this._sound.pitch,e.loop=this._options.loop,e.loopEnd=this._options.loopEnd,e.loopStart=this._options.loopStart,e.playbackRate.value=this._sound.playbackRate}}class of extends or{constructor(e,t,s){super(e,t,s),this._preloadedInstances=[]}get preloadCount(){return this._options.preloadCount??1}get preloadCompletedCount(){return this._preloadedInstances.length}preloadInstanceAsync(){let e=this._createInstance();return this._addPreloadedInstance(e),e.preloadedPromise}async preloadInstancesAsync(e){for(let t=0;t<e;t++)this.preloadInstanceAsync();await Promise.all(this._preloadedInstances.map(async e=>await e.preloadedPromise))}play(e={}){let t;if(5===this.state)return void this.resume();this.preloadCompletedCount>0?((t=this._preloadedInstances[0]).startOffset=this.startOffset,this._removePreloadedInstance(t)):t=this._createInstance();let s=()=>{3===t.state&&(this._stopExcessInstances(),t.onStateChangedObservable.removeCallback(s))};t.onStateChangedObservable.add(s),e.startOffset??(e.startOffset=this.startOffset),e.loop??(e.loop=this.loop),e.volume??(e.volume=1),this._beforePlay(t),t.play(e),this._afterPlay(t)}stop(){if(this._setState(1),this._instances)for(let e of Array.from(this._instances))e.stop()}_addPreloadedInstance(e){this._preloadedInstances.includes(e)||this._preloadedInstances.push(e)}_removePreloadedInstance(e){let t=this._preloadedInstances.indexOf(e);-1!==t&&this._preloadedInstances.splice(t,1)}}class og extends oc{constructor(e){super(e),this.onReadyObservable=new N.Observable,this.preloadedPromise=new Promise((e,t)=>{this._rejectPreloadedPromise=t,this._resolvePreloadedPromise=e}),this.onErrorObservable.add(this._rejectPreloadedPromise),this.onReadyObservable.add(this._resolvePreloadedPromise)}set startOffset(e){this._options.startOffset=e}dispose(){super.dispose(),this.onErrorObservable.clear(),this.onReadyObservable.clear(),this._resolvePreloadedPromise()}}class oy extends of{constructor(e,t,s){super(e,t,s),this._stereo=null,this._options={autoplay:s.autoplay??!1,loop:s.loop??!1,maxInstances:s.maxInstances??1/0,preloadCount:s.preloadCount??1,startOffset:s.startOffset??0},this._subGraph=new oy._SubGraph(this)}async _initAsync(e,t){let s=this.engine._audioContext;if(!(s instanceof AudioContext))throw Error("Unsupported audio context type.");this._audioContext=s,this._source=e,t.outBus?this.outBus=t.outBus:!1!==t.outBusAutoDefault&&(await this.engine.isReadyPromise,this.outBus=this.engine.defaultMainBus),await this._subGraph.initAsync(t),nm(t)&&this._initSpatialProperty(),this.preloadCount&&await this.preloadInstancesAsync(this.preloadCount),t.autoplay&&this.play(t),this.engine._addSound(this)}get _inNode(){return this._subGraph._inNode}get _outNode(){return this._subGraph._outNode}get stereo(){return this._stereo??(this._stereo=new nR(this._subGraph))}dispose(){super.dispose(),this._stereo=null,this._subGraph.dispose(),this.engine._removeSound(this)}getClassName(){return"_WebAudioStreamingSound"}_createInstance(){return new ob(this,this._options)}_connect(e){return!!super._connect(e)&&(e._inNode&&this._outNode?.connect(e._inNode),!0)}_disconnect(e){return!!super._disconnect(e)&&(e._inNode&&this._outNode?.disconnect(e._inNode),!0)}_createSpatialProperty(e,t){return new oa(this._subGraph,e,t)}_getOptions(){return this._options}}oy._SubGraph=class extends ot{get _downstreamNodes(){return this._owner._downstreamNodes??null}get _upstreamNodes(){return this._owner._upstreamNodes??null}};class ob extends og{constructor(e,t){if(super(e),this._currentTimeChangedWhilePaused=!1,this._enginePlayTime=1/0,this._enginePauseTime=0,this._isReady=!1,this._isReadyPromise=new Promise((e,t)=>{this._resolveIsReadyPromise=e,this._rejectIsReadyPromise=t}),this._onCanPlayThrough=()=>{this._isReady=!0,this._resolveIsReadyPromise(this._mediaElement),this.onReadyObservable.notifyObservers(this)},this._onEnded=()=>{this._setState(1)},this._onError=e=>{this._setState(4),this.onErrorObservable.notifyObservers(e),this._rejectIsReadyPromise(e),this.dispose()},this._onEngineStateChanged=()=>{"running"===this.engine.state&&(this._options.loop&&2===this.state&&this.play(),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged))},this._onUserGesture=()=>{this.play()},this._options=t,this._volumeNode=new GainNode(e._audioContext),"string"==typeof e._source)this._initFromUrl(e._source);else if(Array.isArray(e._source))this._initFromUrls(e._source);else if(e._source instanceof HTMLMediaElement)this._initFromMediaElement(e._source);else throw Error(`Invalid streaming sound source (${e._source}).`)}get currentTime(){if(1===this._state)return 0;let e=5===this._state?0:this.engine.currentTime-this._enginePlayTime;return this._enginePauseTime+e+this._options.startOffset}set currentTime(e){let t=2===this._state||3===this._state;t&&(this._mediaElement.pause(),this._state=1),this._options.startOffset=e,t?this.play({startOffset:e}):5===this._state&&(this._currentTimeChangedWhilePaused=!0)}get _outNode(){return this._volumeNode}get startTime(){return 1===this._state?0:this._enginePlayTime}dispose(){for(let e of(super.dispose(),this.stop(),this._sourceNode?.disconnect(this._volumeNode),this._sourceNode=null,this._mediaElement.removeEventListener("error",this._onError),this._mediaElement.removeEventListener("ended",this._onEnded),this._mediaElement.removeEventListener("canplaythrough",this._onCanPlayThrough),Array.from(this._mediaElement.children)))this._mediaElement.removeChild(e);this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged),this.engine.userGestureObservable.removeCallback(this._onUserGesture)}play(e={}){if(3===this._state)return;void 0!==e.loop&&(this._options.loop=e.loop),this._mediaElement.loop=this._options.loop;let t=e.startOffset;this._currentTimeChangedWhilePaused?(t=this._options.startOffset,this._currentTimeChangedWhilePaused=!1):5===this._state&&(t=this.currentTime),t&&t>0&&(this._mediaElement.currentTime=t),this._volumeNode.gain.value=e.volume??1,this._play()}pause(){(2===this._state||3===this._state)&&(this._setState(5),this._enginePauseTime+=this.engine.currentTime-this._enginePlayTime,this._mediaElement.pause())}resume(){5===this._state?this.play():this._currentTimeChangedWhilePaused&&this.play()}stop(){1!==this._state&&this._stop()}getClassName(){return"_WebAudioStreamingSoundInstance"}_connect(e){return!!super._connect(e)&&(e instanceof oy&&e._inNode&&this._outNode?.connect(e._inNode),!0)}_disconnect(e){return!!super._disconnect(e)&&(e instanceof oy&&e._inNode&&this._outNode?.disconnect(e._inNode),!0)}_initFromMediaElement(e){if(I.Tools.SetCorsBehavior(e.currentSrc,e),e.controls=!1,e.loop=this._options.loop,e.preload="auto",e.addEventListener("canplaythrough",this._onCanPlayThrough,{once:!0}),e.addEventListener("ended",this._onEnded,{once:!0}),e.addEventListener("error",this._onError,{once:!0}),e.load(),this._sourceNode=new MediaElementAudioSourceNode(this._sound._audioContext,{mediaElement:e}),this._sourceNode.connect(this._volumeNode),!this._connect(this._sound))throw Error("Connect failed");this._mediaElement=e}_initFromUrl(e){let t=new Audio(nV.WebRequest.IsCustomRequestAvailable?nW(nq(e)):nq(e));this._initFromMediaElement(t)}_initFromUrls(e){let t=new Audio;for(let s of e){let e=document.createElement("source");e.src=nV.WebRequest.IsCustomRequestAvailable?nW(nq(s)):nq(s),t.appendChild(e)}this._initFromMediaElement(t)}_play(){if(this._setState(2),!this._isReady)return void this._playWhenReady();if(2===this._state)if("running"===this.engine.state){let e=this._mediaElement.play();this._enginePlayTime=this.engine.currentTime,this._setState(3),e.catch(()=>{this._setState(4),this._options.loop&&this.engine.userGestureObservable.addOnce(this._onUserGesture)})}else this._options.loop?this.engine.stateChangedObservable.add(this._onEngineStateChanged):(this.stop(),this._setState(4))}_playWhenReady(){this._isReadyPromise.then(()=>{this._play()}).catch(()=>{L.Logger.Error("Streaming sound instance failed to play"),this._setState(4)})}_stop(){this._mediaElement.pause(),this._onEnded(),this.engine.stateChangedObservable.removeCallback(this._onEngineStateChanged)}}var oT=e.i(76535),oA=e.i(75405);class ox{constructor(e,t={}){if(this.id=-1,this._isInitialized=!1,!(e=e||G.EngineStore.LastCreatedScene))return;this._scene=e,this.soundCollection=[],this._options=t,!this._options.mainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1)}_initializeSoundTrackAudioGraph(){oT.AbstractEngine.audioEngine?.canUseWebAudio&&oT.AbstractEngine.audioEngine.audioContext&&(this._outputAudioNode=oT.AbstractEngine.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(oT.AbstractEngine.audioEngine.masterGain),this._options&&this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._isInitialized=!0)}dispose(){if(oT.AbstractEngine.audioEngine&&oT.AbstractEngine.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}}addSound(e){this._isInitialized||this._initializeSoundTrackAudioGraph(),oT.AbstractEngine.audioEngine?.canUseWebAudio&&this._outputAudioNode&&e.connectToSoundTrackAudioNode(this._outputAudioNode),void 0!==e.soundTrackId&&(-1===e.soundTrackId?this._scene.mainSoundTrack.removeSound(e):this._scene.soundTracks&&this._scene.soundTracks[e.soundTrackId].removeSound(e)),this.soundCollection.push(e),e.soundTrackId=this.id}removeSound(e){let t=this.soundCollection.indexOf(e);-1!==t&&this.soundCollection.splice(t,1)}setVolume(e){oT.AbstractEngine.audioEngine?.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)}switchPanningModelToHRTF(){if(oT.AbstractEngine.audioEngine?.canUseWebAudio)for(let e=0;e<this.soundCollection.length;e++)this.soundCollection[e].switchPanningModelToHRTF()}switchPanningModelToEqualPower(){if(oT.AbstractEngine.audioEngine?.canUseWebAudio)for(let e=0;e<this.soundCollection.length;e++)this.soundCollection[e].switchPanningModelToEqualPower()}connectToAnalyser(e){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser=e,oT.AbstractEngine.audioEngine?.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.disconnect(),this._connectedAnalyser.connectAudioNodes(this._outputAudioNode,oT.AbstractEngine.audioEngine.masterGain))}}var ow=e.i(19905),ov=e.i(66749);let oM={};class oC{get audioEnabled(){return this._audioEnabled}get headphone(){return this._headphone}constructor(e){if(this.name=ow.SceneComponentConstants.NAME_AUDIO,this._audioEnabled=!0,this._headphone=!1,this.audioPositioningRefreshRate=500,this.audioListenerPositionProvider=null,this.audioListenerRotationProvider=null,this._cachedCameraDirection=new el.Vector3,this._cachedCameraPosition=new el.Vector3,this._lastCheck=0,this._invertMatrixTemp=new el.Matrix,this._cameraDirectionTemp=new el.Vector3,!(e=e||G.EngineStore.LastCreatedScene))return;this.scene=e,e.soundTracks=[],e.sounds=[]}register(){this.scene._afterRenderStage.registerStep(ow.SceneComponentConstants.STEP_AFTERRENDER_AUDIO,this,this._afterRender)}rebuild(){}serialize(e){if(e.sounds=[],this.scene.soundTracks)for(let t=0;t<this.scene.soundTracks.length;t++){let s=this.scene.soundTracks[t];for(let t=0;t<s.soundCollection.length;t++)e.sounds.push(s.soundCollection[t].serialize())}}addFromContainer(e){if(e.sounds)for(let t of e.sounds)t.play(),t.autoplay=!0,this.scene.mainSoundTrack.addSound(t)}removeFromContainer(e,t=!1){if(e.sounds)for(let s of e.sounds)s.stop(),s.autoplay=!1,this.scene.mainSoundTrack.removeSound(s),t&&s.dispose()}dispose(){let e=this.scene;if(e._mainSoundTrack&&e.mainSoundTrack.dispose(),e.soundTracks)for(let t=0;t<e.soundTracks.length;t++)e.soundTracks[t].dispose()}disableAudio(){let e,t=this.scene;for(this._audioEnabled=!1,oT.AbstractEngine.audioEngine&&oT.AbstractEngine.audioEngine.audioContext&&oT.AbstractEngine.audioEngine.audioContext.suspend(),e=0;e<t.mainSoundTrack.soundCollection.length;e++)t.mainSoundTrack.soundCollection[e].pause();if(t.soundTracks)for(e=0;e<t.soundTracks.length;e++)for(let s=0;s<t.soundTracks[e].soundCollection.length;s++)t.soundTracks[e].soundCollection[s].pause()}enableAudio(){let e,t=this.scene;for(this._audioEnabled=!0,oT.AbstractEngine.audioEngine&&oT.AbstractEngine.audioEngine.audioContext&&oT.AbstractEngine.audioEngine.audioContext.resume(),e=0;e<t.mainSoundTrack.soundCollection.length;e++)t.mainSoundTrack.soundCollection[e].isPaused&&t.mainSoundTrack.soundCollection[e].play();if(t.soundTracks)for(e=0;e<t.soundTracks.length;e++)for(let s=0;s<t.soundTracks[e].soundCollection.length;s++)t.soundTracks[e].soundCollection[s].isPaused&&t.soundTracks[e].soundCollection[s].play()}switchAudioModeForHeadphones(){let e=this.scene;if(this._headphone=!0,e.mainSoundTrack.switchPanningModelToHRTF(),e.soundTracks)for(let t=0;t<e.soundTracks.length;t++)e.soundTracks[t].switchPanningModelToHRTF()}switchAudioModeForNormalSpeakers(){let e=this.scene;if(this._headphone=!1,e.mainSoundTrack.switchPanningModelToEqualPower(),e.soundTracks)for(let t=0;t<e.soundTracks.length;t++)e.soundTracks[t].switchPanningModelToEqualPower()}_afterRender(){let e=on.PrecisionDate.Now;if(this._lastCheck&&e-this._lastCheck<this.audioPositioningRefreshRate)return;this._lastCheck=e;let t=this.scene;if(!this._audioEnabled||!t._mainSoundTrack||!t.soundTracks||0===t._mainSoundTrack.soundCollection.length&&1===t.soundTracks.length)return;let s=oT.AbstractEngine.audioEngine;if(s&&s.audioContext){let e,n=t.activeCamera;if(t.activeCameras&&t.activeCameras.length>0&&(n=t.activeCameras[0]),this.audioListenerPositionProvider){let e=this.audioListenerPositionProvider();s.audioContext.listener.setPosition(e.x||0,e.y||0,e.z||0)}else n?this._cachedCameraPosition.equals(n.globalPosition)||(this._cachedCameraPosition.copyFrom(n.globalPosition),s.audioContext.listener.setPosition(n.globalPosition.x,n.globalPosition.y,n.globalPosition.z)):s.audioContext.listener.setPosition(0,0,0);if(this.audioListenerRotationProvider){let e=this.audioListenerRotationProvider();s.audioContext.listener.setOrientation(e.x||0,e.y||0,e.z||0,0,1,0)}else n?(n.rigCameras&&n.rigCameras.length>0&&(n=n.rigCameras[0]),n.getViewMatrix().invertToRef(this._invertMatrixTemp),el.Vector3.TransformNormalToRef(oC._CameraDirection,this._invertMatrixTemp,this._cameraDirectionTemp),this._cameraDirectionTemp.normalize(),isNaN(this._cameraDirectionTemp.x)||isNaN(this._cameraDirectionTemp.y)||isNaN(this._cameraDirectionTemp.z)||this._cachedCameraDirection.equals(this._cameraDirectionTemp)||(this._cachedCameraDirection.copyFrom(this._cameraDirectionTemp),s.audioContext.listener.setOrientation(this._cameraDirectionTemp.x,this._cameraDirectionTemp.y,this._cameraDirectionTemp.z,0,1,0))):s.audioContext.listener.setOrientation(0,0,0,0,1,0);for(e=0;e<t.mainSoundTrack.soundCollection.length;e++){let s=t.mainSoundTrack.soundCollection[e];s.useCustomAttenuation&&s.updateDistanceFromListener()}if(t.soundTracks)for(e=0;e<t.soundTracks.length;e++)for(let s=0;s<t.soundTracks[e].soundCollection.length;s++){let n=t.soundTracks[e].soundCollection[s];n.useCustomAttenuation&&n.updateDistanceFromListener()}}}}oC._CameraDirection=new el.Vector3(0,0,-1);let oF=!1;function oS(e){if(!oF){var t;oF=!0,t=ow.SceneComponentConstants.NAME_AUDIO,oM[t]=(t,s,n,o)=>{let a,i=[];if(n.sounds=n.sounds||[],void 0!==t.sounds&&null!==t.sounds)for(let r=0,l=t.sounds.length;r<l;r++){let l=t.sounds[r];oT.AbstractEngine.audioEngine?.canUseWebAudio?(l.url||(l.url=l.name),i[l.url]?n.sounds.push(e.Parse(l,s,o,i[l.url])):(a=e.Parse(l,s,o),i[l.url]=a,n.sounds.push(a))):n.sounds.push(new e(l.name,null,s))}},Object.defineProperty(ov.Scene.prototype,"mainSoundTrack",{get:function(){let e=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);return e||(e=new oC(this),this._addComponent(e)),this._mainSoundTrack||(this._mainSoundTrack=new ox(this,{mainTrack:!0})),this._mainSoundTrack},enumerable:!0,configurable:!0}),ov.Scene.prototype.getSoundByName=function(e){let t;for(t=0;t<this.mainSoundTrack.soundCollection.length;t++)if(this.mainSoundTrack.soundCollection[t].name===e)return this.mainSoundTrack.soundCollection[t];if(this.soundTracks){for(let s=0;s<this.soundTracks.length;s++)for(t=0;t<this.soundTracks[s].soundCollection.length;t++)if(this.soundTracks[s].soundCollection[t].name===e)return this.soundTracks[s].soundCollection[t]}return null},Object.defineProperty(ov.Scene.prototype,"audioEnabled",{get:function(){let e=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);return e||(e=new oC(this),this._addComponent(e)),e.audioEnabled},set:function(e){let t=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);t||(t=new oC(this),this._addComponent(t)),e?t.enableAudio():t.disableAudio()},enumerable:!0,configurable:!0}),Object.defineProperty(ov.Scene.prototype,"headphone",{get:function(){let e=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);return e||(e=new oC(this),this._addComponent(e)),e.headphone},set:function(e){let t=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);t||(t=new oC(this),this._addComponent(t)),e?t.switchAudioModeForHeadphones():t.switchAudioModeForNormalSpeakers()},enumerable:!0,configurable:!0}),Object.defineProperty(ov.Scene.prototype,"audioListenerPositionProvider",{get:function(){let e=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);return e||(e=new oC(this),this._addComponent(e)),e.audioListenerPositionProvider},set:function(e){let t=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);if(t||(t=new oC(this),this._addComponent(t)),e&&"function"!=typeof e)throw Error("The value passed to [Scene.audioListenerPositionProvider] must be a function that returns a Vector3");t.audioListenerPositionProvider=e},enumerable:!0,configurable:!0}),Object.defineProperty(ov.Scene.prototype,"audioListenerRotationProvider",{get:function(){let e=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);return e||(e=new oC(this),this._addComponent(e)),e.audioListenerRotationProvider},set:function(e){let t=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);if(t||(t=new oC(this),this._addComponent(t)),e&&"function"!=typeof e)throw Error("The value passed to [Scene.audioListenerRotationProvider] must be a function that returns a Vector3");t.audioListenerRotationProvider=e},enumerable:!0,configurable:!0}),Object.defineProperty(ov.Scene.prototype,"audioPositioningRefreshRate",{get:function(){let e=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);return e||(e=new oC(this),this._addComponent(e)),e.audioPositioningRefreshRate},set:function(e){let t=this._getComponent(ow.SceneComponentConstants.NAME_AUDIO);t||(t=new oC(this),this._addComponent(t)),t.audioPositioningRefreshRate=e},enumerable:!0,configurable:!0}),e._SceneComponentInitialization=e=>{let t=e._getComponent(ow.SceneComponentConstants.NAME_AUDIO);t||(t=new oC(e),e._addComponent(t))}}}let oE={duration:0,shape:"linear"},oO={duration:0,startOffset:0,waitTime:0},oN={waitTime:0};function oI(e){return e*Math.PI/180}function oB(e){return 180*e/Math.PI}class ok{get name(){return this._soundV2.name}set name(e){this._soundV2.name=e}get autoplay(){return this._soundV2 instanceof oi||this._optionsV2.autoplay}set autoplay(e){this._optionsV2.autoplay=e}get loop(){return this._soundV2 instanceof oi||this._soundV2.loop}set loop(e){this._soundV2 instanceof oi||this._soundV2&&(this._soundV2.loop=e)}get isPlaying(){return this._soundV2 instanceof oi||this._soundV2?.state===3||!this.isReady()&&this._optionsV2.autoplay}get isPaused(){return!(this._soundV2 instanceof oi)&&5===this._soundV2.state}get maxDistance(){return this._optionsV2.spatialMaxDistance||100}set maxDistance(e){this._optionsV2.spatialMaxDistance=e,!this.useCustomAttenuation&&this._soundV2&&(this._initSpatial(),this._soundV2.spatial.maxDistance=e)}get distanceModel(){return this._optionsV2.spatialDistanceModel||"linear"}set distanceModel(e){this._optionsV2.spatialDistanceModel=e,this._soundV2&&(this._initSpatial(),this._soundV2.spatial.distanceModel=e)}get currentTime(){return this._soundV2 instanceof oi?this._soundV2.engine.currentTime:this._soundV2.currentTime}get spatialSound(){return this._soundV2?._isSpatial??!1}set spatialSound(e){this._soundV2&&(e?this._initSpatial():this._soundV2._isSpatial=!1)}get _onReady(){return this._onReadyObservable||(this._onReadyObservable=new N.Observable),this._onReadyObservable}constructor(e,t,s,n=null,o){if(this.useCustomAttenuation=!1,this.soundTrackId=-1,this.refDistance=1,this.rolloffFactor=1,this.metadata=null,this.onEndedObservable=new N.Observable,this._localDirection=new el.Vector3(1,0,0),this._volume=1,this._isReadyToPlay=!1,this._isDirectional=!1,this._isOutputConnected=!1,this._url=null,this._onReadyObservable=null,this._onReadyToPlay=()=>{this._scene.mainSoundTrack.addSound(this),this._isReadyToPlay=!0,this._readyToPlayCallback(),this._onReadyObservable&&this._onReadyObservable.notifyObservers(),this._optionsV2.autoplay&&this.play()},this._onended=()=>{this.onended&&this.onended(),this.onEndedObservable.notifyObservers(this)},!(s=s||G.EngineStore.LastCreatedScene))return;this._scene=s,oS(ok),ok._SceneComponentInitialization(s),this._readyToPlayCallback=n||(()=>{}),this._customAttenuationFunction=(e,t,s,n,o)=>t<s?e*(1-t/s):0;const a={analyzerEnabled:!1,autoplay:!1,duration:(o=o||{}).length||0,loop:o.loop||!1,loopEnd:0,loopStart:0,outBus:null,outBusAutoDefault:!1,playbackRate:o.playbackRate||1,pitch:0,skipCodecCheck:o.skipCodecCheck||!1,spatialDistanceModel:o.distanceModel,spatialEnabled:o.spatialSound,spatialMaxDistance:o.maxDistance,spatialMinDistance:o.refDistance,spatialRolloffFactor:o.rolloffFactor,stereoEnabled:!1,startOffset:o.offset||0,volume:o.volume??1};this._volume=o.volume??1,nm(a)&&(a.spatialAutoUpdate=!1,a.spatialConeInnerAngle=n_.coneInnerAngle,a.spatialConeOuterAngle=n_.coneOuterAngle,a.spatialConeOuterVolume=n_.coneOuterVolume,a.spatialMinUpdateTime=0,a.spatialOrientation=n_.orientation.clone(),a.spatialPanningModel=this._scene.headphone?"HRTF":"equalpower",a.spatialPosition=n_.position.clone(),a.spatialRotation=n_.rotation.clone(),a.spatialRotationQuaternion=n_.rotationQuaternion.clone(),void 0===a.spatialMaxDistance&&(a.spatialMaxDistance=100)),this._optionsV2={...a},this._optionsV2.autoplay=o.autoplay||!1,this.useCustomAttenuation=o.useCustomAttenuation??!1,this.useCustomAttenuation&&(a.spatialMaxDistance=Number.MAX_VALUE,a.volume=0);let i=o?.streaming||!1;if(!oT.AbstractEngine.audioEngine)return;const r=oT.AbstractEngine.audioEngine._v2,l=()=>{if(i){let s=new oy(e,r,{preloadCount:0,...a});return s._initAsync(t,a).then(()=>{s.preloadInstancesAsync(1).then(this._onReadyToPlay)}),s}{let s=new op(e,r,a);return s._initAsync(t,a).then(this._onReadyToPlay),s}};if(t)if("string"==typeof t)this._url=t,this._soundV2=l();else if(t instanceof ArrayBuffer)i=!1,this._soundV2=l();else if(t instanceof HTMLMediaElement)i=!0,this._soundV2=l();else if(t instanceof MediaStream){const s=new MediaStreamAudioSourceNode(r._audioContext,{mediaStream:t});this._soundV2=new oi(e,s,r,a),this._soundV2._initAsync(a).then(this._onReadyToPlay)}else t instanceof AudioBuffer?(i=!1,this._soundV2=l()):Array.isArray(t)&&(this._soundV2=l());else this._soundV2=new op(e,r,a);if(!this._soundV2)return void L.Logger.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.");this._soundV2 instanceof oi||this._soundV2.onEndedObservable.add(this._onended)}dispose(){this.isPlaying&&this.stop(),this._isReadyToPlay=!1,-1===this.soundTrackId?this._scene.mainSoundTrack.removeSound(this):this._scene.soundTracks&&this._scene.soundTracks[this.soundTrackId].removeSound(this),this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._connectedTransformNode=null),this._soundV2.dispose()}isReady(){return this._isReadyToPlay}getClassName(){return"Sound"}setAudioBuffer(e){!this._isReadyToPlay&&this._soundV2 instanceof op&&this._soundV2._initAsync(e,this._optionsV2).then(this._onReadyToPlay)}updateOptions(e){if(e){if(this.loop=e.loop??this.loop,this.maxDistance=e.maxDistance??this.maxDistance,this.useCustomAttenuation=e.useCustomAttenuation??this.useCustomAttenuation,this.rolloffFactor=e.rolloffFactor??this.rolloffFactor,this.refDistance=e.refDistance??this.refDistance,this.distanceModel=e.distanceModel??this.distanceModel,void 0!==e.playbackRate&&this.setPlaybackRate(e.playbackRate),void 0!==e.spatialSound&&(this.spatialSound=e.spatialSound),void 0!==e.volume&&this.setVolume(e.volume),this._soundV2 instanceof op){let t=!1;void 0!==e.offset&&(this._optionsV2.startOffset=e.offset,t=!0),void 0!==e.length&&(this._soundV2.duration=e.length,t=!0),t&&this.isPaused&&this.stop()}this._updateSpatialParameters()}}_updateSpatialParameters(){if(!this.spatialSound)return;let e=this._soundV2.spatial;this.useCustomAttenuation?(e.distanceModel="linear",e.minDistance=1,e.maxDistance=Number.MAX_VALUE,e.rolloffFactor=1,e.panningModel="equalpower"):(e.distanceModel=this.distanceModel,e.minDistance=this.refDistance,e.maxDistance=this.maxDistance,e.rolloffFactor=this.rolloffFactor,e.panningModel=this._optionsV2.spatialPanningModel||"equalpower")}switchPanningModelToHRTF(){this.spatialSound&&(this._initSpatial(),this._soundV2.spatial.panningModel="HRTF")}switchPanningModelToEqualPower(){this.spatialSound&&(this._initSpatial(),this._soundV2.spatial.panningModel="equalpower")}connectToSoundTrackAudioNode(e){let t=this._soundV2._outNode;t&&(this._isOutputConnected&&t.disconnect(),t.connect(e),this._isOutputConnected=!0)}setDirectionalCone(e,t,s){t<e?L.Logger.Error("setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle."):(this._optionsV2.spatialConeInnerAngle=oI(e),this._optionsV2.spatialConeOuterAngle=oI(t),this._optionsV2.spatialConeOuterVolume=s,this._initSpatial(),this._soundV2.spatial.coneInnerAngle=this._optionsV2.spatialConeInnerAngle,this._soundV2.spatial.coneOuterAngle=this._optionsV2.spatialConeOuterAngle,this._soundV2.spatial.coneOuterVolume=s,this._isDirectional=!0,this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._optionsV2.startOffset,this._optionsV2.duration)))}get directionalConeInnerAngle(){return oB("number"==typeof this._optionsV2.spatialConeInnerAngle?this._optionsV2.spatialConeInnerAngle:n_.coneInnerAngle)}set directionalConeInnerAngle(e){if((e=oI(e))!=this._optionsV2.spatialConeInnerAngle){if(this.directionalConeOuterAngle<e)return void L.Logger.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.");this._optionsV2.spatialConeInnerAngle=e,this.spatialSound&&(this._initSpatial(),this._soundV2.spatial.coneInnerAngle=e)}}get directionalConeOuterAngle(){return oB("number"==typeof this._optionsV2.spatialConeOuterAngle?this._optionsV2.spatialConeOuterAngle:n_.coneOuterAngle)}set directionalConeOuterAngle(e){if((e=oI(e))!=this._optionsV2.spatialConeOuterAngle){if(e<this.directionalConeInnerAngle)return void L.Logger.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.");this._optionsV2.spatialConeOuterAngle=e,this.spatialSound&&(this._initSpatial(),this._soundV2.spatial.coneOuterAngle=e)}}setPosition(e){!(this._optionsV2.spatialPosition&&e.equals(this._optionsV2.spatialPosition))&&(this._optionsV2.spatialPosition||(this._optionsV2.spatialPosition=el.Vector3.Zero()),this._optionsV2.spatialPosition.copyFrom(e),!this.spatialSound||isNaN(e.x)||isNaN(e.y)||isNaN(e.z)||(this._initSpatial(),this._soundV2.spatial.position=e))}setLocalDirectionToMesh(e){this._localDirection=e,this._connectedTransformNode&&this.isPlaying&&this._updateDirection()}_updateDirection(){if(!this._connectedTransformNode||!this.spatialSound)return;let e=this._connectedTransformNode.getWorldMatrix(),t=el.Vector3.TransformNormal(this._localDirection,e);t.normalize(),this._initSpatial(),this._soundV2.spatial.orientation=t}_initSpatial(){this._soundV2._isSpatial=!0,void 0===this._optionsV2.spatialDistanceModel&&(this._optionsV2.spatialDistanceModel="linear",this._soundV2.spatial.distanceModel="linear"),void 0===this._optionsV2.spatialMaxDistance&&(this._optionsV2.spatialMaxDistance=100,this._soundV2.spatial.maxDistance=100)}updateDistanceFromListener(){if(this._soundV2._outNode&&this._connectedTransformNode&&this.useCustomAttenuation&&this._scene.activeCamera){let e=this._scene.audioListenerPositionProvider?this._connectedTransformNode.position.subtract(this._scene.audioListenerPositionProvider()).length():this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera);this._soundV2.volume=this._customAttenuationFunction(this._volume,e,this.maxDistance,this.refDistance,this.rolloffFactor)}}setAttenuationFunction(e){this._customAttenuationFunction=e}play(e,t,s){let n=oT.AbstractEngine.audioEngine;if(n?.unlock(),!(this._soundV2 instanceof oi)&&this._isReadyToPlay&&this._scene.audioEnabled){5===this._soundV2.state&&(void 0!==e||void 0!==t||void 0!==s)&&this._soundV2.stop();try{oO.duration=s||0,oO.startOffset=void 0!==t&&t||this._optionsV2.startOffset,oO.waitTime=e||0,oO.loop=void 0,oO.loopStart=void 0,oO.loopEnd=void 0,oO.volume=void 0,n?.unlocked?this._soundV2.play(oO):setTimeout(()=>{this._soundV2.play(oO)},500)}catch(e){L.Logger.Error("Error while trying to play audio: "+this.name+", "+e.message)}}}stop(e){!this._soundV2||this._soundV2 instanceof oi||(oN.waitTime=e||0,this._soundV2.stop(oN))}pause(){!this._soundV2||this._soundV2 instanceof oi||this._soundV2.pause()}setVolume(e,t){this.isReady()?(oE.duration=t||0,this._soundV2.setVolume(e,oE),this._volume=e):this._onReady.addOnce(()=>{this.setVolume(e,t)})}setPlaybackRate(e){this._soundV2 instanceof op&&(this._soundV2.playbackRate=e)}getPlaybackRate(){return this._soundV2 instanceof op?this._soundV2.playbackRate:1}getVolume(){return this._volume}attachToMesh(e){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,!this.spatialSound&&(this.spatialSound=!0,this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._optionsV2.startOffset,this._optionsV2.duration))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=e=>this._onRegisterAfterWorldMatrixUpdate(e),this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)}detachFromMesh(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)}_onRegisterAfterWorldMatrixUpdate(e){if(e.getBoundingInfo){let t=e.getBoundingInfo();this.setPosition(t.boundingSphere.centerWorld)}else this.setPosition(e.absolutePosition);this._isDirectional&&this.isPlaying&&this._updateDirection()}clone(){if(!(this._soundV2 instanceof op))return null;let e={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},t=new ok(this.name+"_cloned",this._soundV2.buffer,this._scene,null,e);return t._optionsV2=this._optionsV2,this.useCustomAttenuation&&t.setAttenuationFunction(this._customAttenuationFunction),t}getAudioBuffer(){return this._soundV2 instanceof op?this._soundV2.buffer._audioBuffer:null}getSoundSource(){return null}getSoundGain(){return this._soundV2._outNode}serialize(){let e={name:this.name,url:this._url,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this.getPlaybackRate(),panningModel:this._soundV2.spatial.panningModel,soundTrackId:this.soundTrackId,metadata:this.metadata};return this.spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._soundV2.spatial.position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this.directionalConeInnerAngle,e.coneOuterAngle=this.directionalConeOuterAngle,e.coneOuterGain=this._soundV2.spatial.coneOuterVolume),e}static Parse(e,t,s,n){let o,a,i=e.name;o=e.url?s+e.url:s+i;let r={autoplay:e.autoplay,loop:e.loop,volume:e.volume,spatialSound:e.spatialSound,maxDistance:e.maxDistance,rolloffFactor:e.rolloffFactor,refDistance:e.refDistance,distanceModel:e.distanceModel,playbackRate:e.playbackRate};if(n?(a=new ok(i,new ArrayBuffer(0),t,null,r),(0,tC._RetryWithInterval)(()=>n._isReadyToPlay,()=>{let e=n.getAudioBuffer();e&&a.setAudioBuffer(e),a._isReadyToPlay=!0,a.autoplay&&a.play(0,n._optionsV2.startOffset,n._optionsV2.duration)},void 0,300)):(a=new ok(i,o,t,()=>{t.removePendingData(a)},r),t.addPendingData(a)),e.position){let t=el.Vector3.FromArray(e.position);a.setPosition(t)}if(e.isDirectional&&(a.setDirectionalCone(e.coneInnerAngle||360,e.coneOuterAngle||360,e.coneOuterGain||0),e.localDirectionToMesh)){let t=el.Vector3.FromArray(e.localDirectionToMesh);a.setLocalDirectionToMesh(t)}if(e.connectedMeshId){let s=t.getMeshById(e.connectedMeshId);s&&a.attachToMesh(s)}return e.metadata&&(a.metadata=e.metadata),a}}ok._SceneComponentInitialization=e=>{throw(0,oA._WarnImport)("AudioSceneComponent")};let oR=!1;oR=!0,(0,eI.RegisterClass)("BABYLON.Sound",ok);class oP{constructor(e,t,s){if(this.loop=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._volume=1,this.isPlaying=!1,this.isPaused=!1,this._sounds=[],this._weights=[],t.length!==s.length)throw Error("Sounds length does not equal weights length");this.loop=e,this._weights=s;let n=0;for(const e of s)n+=e;const o=n>0?1/n:0;for(let e=0;e<this._weights.length;e++)this._weights[e]*=o;for(const e of(this._sounds=t,this._sounds))e.onEndedObservable.add(()=>{this._onended()})}get directionalConeInnerAngle(){return this._coneInnerAngle}set directionalConeInnerAngle(e){if(e!==this._coneInnerAngle){if(this._coneOuterAngle<e)return void L.Logger.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.");for(let t of(this._coneInnerAngle=e,this._sounds))t.directionalConeInnerAngle=e}}get directionalConeOuterAngle(){return this._coneOuterAngle}set directionalConeOuterAngle(e){if(e!==this._coneOuterAngle){if(e<this._coneInnerAngle)return void L.Logger.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.");for(let t of(this._coneOuterAngle=e,this._sounds))t.directionalConeOuterAngle=e}}get volume(){return this._volume}set volume(e){if(e!==this._volume)for(let t of this._sounds)t.setVolume(e)}_onended(){void 0!==this._currentIndex&&(this._sounds[this._currentIndex].autoplay=!1),this.loop&&this.isPlaying?this.play():this.isPlaying=!1}pause(){this.isPlaying&&(this.isPaused=!0,void 0!==this._currentIndex&&this._sounds[this._currentIndex].pause())}stop(){this.isPlaying=!1,void 0!==this._currentIndex&&this._sounds[this._currentIndex].stop()}play(e){if(!this.isPaused){this.stop();let e=Math.random(),t=0;for(let s=0;s<this._weights.length;s++)if(e<=(t+=this._weights[s])){this._currentIndex=s;break}}let t=this._sounds[this._currentIndex??0];t.isReady()?t.play(0,this.isPaused?void 0:e):t.autoplay=!0,this.isPlaying=!0,this.isPaused=!1}}oS(ok);let oL="MSFT_audio_emitter";class oG{constructor(e){this.name=oL,this._loader=e,this.enabled=this._loader.isExtensionUsed(oL)}dispose(){this._loader=null,this._clips=null,this._emitters=null}onLoading(){let e=this._loader.gltf.extensions;if(e&&e[this.name]){let t=e[this.name];this._clips=t.clips,this._emitters=t.emitters,ty.Assign(this._clips),ty.Assign(this._emitters)}}loadSceneAsync(e,t){return tT.LoadExtensionAsync(e,t,this.name,async(s,n)=>{let o=[];for(let a of(o.push(this._loader.loadSceneAsync(e,t)),n.emitters)){let e=ty.Get(`${s}/emitters`,this._emitters,a);if(void 0!=e.refDistance||void 0!=e.maxDistance||void 0!=e.rolloffFactor||void 0!=e.distanceModel||void 0!=e.innerAngle||void 0!=e.outerAngle)throw Error(`${s}: Direction or Distance properties are not allowed on emitters attached to a scene`);o.push(this._loadEmitterAsync(`${s}/emitters/${e.index}`,e))}await Promise.all(o)})}loadNodeAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(e,n)=>{let o=[],a=await this._loader.loadNodeAsync(e,t,t=>{for(let s of n.emitters){let n=ty.Get(`${e}/emitters`,this._emitters,s);o.push(this._loadEmitterAsync(`${e}/emitters/${n.index}`,n).then(()=>{for(let e of n._babylonSounds)e.attachToMesh(t),(void 0!=n.innerAngle||void 0!=n.outerAngle)&&(e.setLocalDirectionToMesh(el.Vector3.Forward()),e.setDirectionalCone(2*I.Tools.ToDegrees(void 0==n.innerAngle?Math.PI:n.innerAngle),2*I.Tools.ToDegrees(void 0==n.outerAngle?Math.PI:n.outerAngle),0))}))}s(t)});return await Promise.all(o),a})}loadAnimationAsync(e,t){return tT.LoadExtensionAsync(e,t,this.name,async(s,n)=>{let o=await this._loader.loadAnimationAsync(e,t),a=[];for(let i of(ty.Assign(n.events),n.events))a.push(this._loadAnimationEventAsync(`${s}/events/${i.index}`,e,t,i,o));return await Promise.all(a),o})}_loadClipAsync(e,t){let s;if(t._objectURL)return t._objectURL;if(t.uri)s=this._loader.loadUriAsync(e,t,t.uri);else{let n=ty.Get(`${e}/bufferView`,this._loader.gltf.bufferViews,t.bufferView);s=this._loader.loadBufferViewAsync(`/bufferViews/${n.index}`,n)}return t._objectURL=s.then(e=>{let s=(0,eU.GetBlobBufferSource)(e);return URL.createObjectURL(new Blob([s],{type:t.mimeType}))}),t._objectURL}_loadEmitterAsync(e,t){if(t._babylonSounds=t._babylonSounds||[],!t._babylonData){let e=[],s=t.name||`emitter${t.index}`,n={loop:!1,autoplay:!1,volume:void 0==t.volume?1:t.volume};for(let o=0;o<t.clips.length;o++){let a=`/extensions/${this.name}/clips`,i=ty.Get(a,this._clips,t.clips[o].clip);e.push(this._loadClipAsync(`${a}/${t.clips[o].clip}`,i).then(e=>{let a=t._babylonSounds[o]=new ok(s,e,this._loader.babylonScene,null,n);a.refDistance=t.refDistance||1,a.maxDistance=t.maxDistance||256,a.rolloffFactor=t.rolloffFactor||1,a.distanceModel=t.distanceModel||"exponential"}))}let o=Promise.all(e).then(()=>{let e=t.clips.map(e=>e.weight||1),s=new oP(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(s.directionalConeInnerAngle=2*I.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(s.directionalConeOuterAngle=2*I.Tools.ToDegrees(t.outerAngle)),t.volume&&(s.volume=t.volume),t._babylonData.sound=s});t._babylonData={loaded:o}}return t._babylonData.loaded}_getEventAction(e,t,s,n,o){switch(s){case"play":return e=>{t.play((o||0)+(e-n))};case"stop":return()=>{t.stop()};case"pause":return()=>{t.pause()};default:throw Error(`${e}: Unsupported action ${s}`)}}_loadAnimationEventAsync(e,t,s,n,o){if(0==o.targetedAnimations.length)return Promise.resolve();let a=o.targetedAnimations[0],i=n.emitter,r=ty.Get(`/extensions/${this.name}/emitters`,this._emitters,i);return this._loadEmitterAsync(e,r).then(()=>{let t=r._babylonData.sound;if(t){let s=new np(n.time,this._getEventAction(e,t,n.action,n.time,n.startOffset));a.animation.addEvent(s),o.onAnimationGroupEndObservable.add(()=>{t.stop()}),o.onAnimationGroupPauseObservable.add(()=>{t.pause()})}})}}tp(oL),td(oL,!0,e=>new oG(e)),e.s(["MSFT_audio_emitter",0,oG],19458);let oD="MSFT_lod";class oV{constructor(e){this.name=oD,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new N.Observable,this.onMaterialLODsLoadedObservable=new N.Observable,this._bufferLODs=[],this._nodeIndexLOD=null,this._nodeSignalLODs=[],this._nodePromiseLODs=[],this._nodeBufferLODs=[],this._materialIndexLOD=null,this._materialSignalLODs=[],this._materialPromiseLODs=[],this._materialBufferLODs=[],this._loader=e,this.maxLODsToLoad=this._loader.parent.extensionOptions[oD]?.maxLODsToLoad??this.maxLODsToLoad,this.enabled=this._loader.isExtensionUsed(oD)}dispose(){this._loader=null,this._nodeIndexLOD=null,this._nodeSignalLODs.length=0,this._nodePromiseLODs.length=0,this._nodeBufferLODs.length=0,this._materialIndexLOD=null,this._materialSignalLODs.length=0,this._materialPromiseLODs.length=0,this._materialBufferLODs.length=0,this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()}onReady(){for(let e=0;e<this._nodePromiseLODs.length;e++){let t=Promise.all(this._nodePromiseLODs[e]).then(()=>{0!==e&&(this._loader.endPerformanceCounter(`Node LOD ${e}`),this._loader.log(`Loaded node LOD ${e}`)),this.onNodeLODsLoadedObservable.notifyObservers(e),e!==this._nodePromiseLODs.length-1&&(this._loader.startPerformanceCounter(`Node LOD ${e+1}`),this._loadBufferLOD(this._nodeBufferLODs,e+1),this._nodeSignalLODs[e]&&this._nodeSignalLODs[e].resolve())});this._loader._completePromises.push(t)}for(let e=0;e<this._materialPromiseLODs.length;e++){let t=Promise.all(this._materialPromiseLODs[e]).then(()=>{0!==e&&(this._loader.endPerformanceCounter(`Material LOD ${e}`),this._loader.log(`Loaded material LOD ${e}`)),this.onMaterialLODsLoadedObservable.notifyObservers(e),e!==this._materialPromiseLODs.length-1&&(this._loader.startPerformanceCounter(`Material LOD ${e+1}`),this._loadBufferLOD(this._materialBufferLODs,e+1),this._materialSignalLODs[e]&&this._materialSignalLODs[e].resolve())});this._loader._completePromises.push(t)}}loadSceneAsync(e,t){let s=this._loader.loadSceneAsync(e,t);return this._loadBufferLOD(this._bufferLODs,0),s}loadNodeAsync(e,t,s){return tT.LoadExtensionAsync(e,t,this.name,async(e,n)=>{let o,a=this._getLODs(e,t,this._loader.gltf.nodes,n.ids);this._loader.logOpen(`${e}`);for(let e=0;e<a.length;e++){let t=a[e];0!==e&&(this._nodeIndexLOD=e,this._nodeSignalLODs[e]=this._nodeSignalLODs[e]||new tn);let n=e=>{s(e),e.setEnabled(!1)},i=this._loader.loadNodeAsync(`/nodes/${t.index}`,t,n).then(t=>{if(0!==e){let t=a[e-1];t._babylonTransformNode&&(this._disposeTransformNode(t._babylonTransformNode),delete t._babylonTransformNode)}return t.setEnabled(!0),t});this._nodePromiseLODs[e]=this._nodePromiseLODs[e]||[],0===e?o=i:(this._nodeIndexLOD=null,this._nodePromiseLODs[e].push(i))}return this._loader.logClose(),await o})}_loadMaterialAsync(e,t,s,n,o){return this._nodeIndexLOD?null:tT.LoadExtensionAsync(e,t,this.name,async(e,a)=>{let i,r=this._getLODs(e,t,this._loader.gltf.materials,a.ids);this._loader.logOpen(`${e}`);for(let e=0;e<r.length;e++){let t=r[e];0!==e&&(this._materialIndexLOD=e);let a=this._loader._loadMaterialAsync(`/materials/${t.index}`,t,s,n,t=>{0===e&&o(t)}).then(t=>{if(0!==e){o(t);let s=r[e-1]._data;s[n]&&(this._disposeMaterials([s[n].babylonMaterial]),delete s[n])}return t});this._materialPromiseLODs[e]=this._materialPromiseLODs[e]||[],0===e?i=a:(this._materialIndexLOD=null,this._materialPromiseLODs[e].push(a))}return this._loader.logClose(),await i})}_loadUriAsync(e,t,s){if(null!==this._nodeIndexLOD){this._loader.log("deferred");let n=this._nodeIndexLOD-1;return this._nodeSignalLODs[n]=this._nodeSignalLODs[n]||new tn,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then(async()=>await this._loader.loadUriAsync(e,t,s))}if(null!==this._materialIndexLOD){this._loader.log("deferred");let n=this._materialIndexLOD-1;return this._materialSignalLODs[n]=this._materialSignalLODs[n]||new tn,this._materialSignalLODs[n].promise.then(async()=>await this._loader.loadUriAsync(e,t,s))}return null}loadBufferAsync(e,t,s,n){if(this._loader.parent.useRangeRequests&&!t.uri){if(!this._loader.bin)throw Error(`${e}: Uri is missing or the binary glTF is missing its binary chunk`);let t=async(e,t)=>{let o=s+n-1,a=e[t];return a?(a.start=Math.min(a.start,s),a.end=Math.max(a.end,o)):(a={start:s,end:o,loaded:new tn},e[t]=a),await a.loaded.promise.then(e=>new Uint8Array(e.buffer,e.byteOffset+s-a.start,n))};return(this._loader.log("deferred"),null!==this._nodeIndexLOD)?t(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?t(this._materialBufferLODs,this._materialIndexLOD):t(this._bufferLODs,0)}return null}_loadBufferLOD(e,t){let s=e[t];s&&(this._loader.log(`Loading buffer range [${s.start}-${s.end}]`),this._loader.bin.readAsync(s.start,s.end-s.start+1).then(e=>{s.loaded.resolve(e)},e=>{s.loaded.reject(e)}))}_getLODs(e,t,s,n){if(this.maxLODsToLoad<=0)throw Error("maxLODsToLoad must be greater than zero");let o=[];for(let t=n.length-1;t>=0;t--)if(o.push(ty.Get(`${e}/ids/${n[t]}`,s,n[t])),o.length===this.maxLODsToLoad)return o;return o.push(t),o}_disposeTransformNode(e){let t=[],s=e.material;for(let n of(s&&t.push(s),e.getChildMeshes()))n.material&&t.push(n.material);e.dispose();let n=t.filter(e=>this._loader.babylonScene.meshes.every(t=>t.material!=e));this._disposeMaterials(n)}_disposeMaterials(e){let t={};for(let s of e){for(let e of s.getActiveTextures())t[e.uniqueId]=e;s.dispose()}for(let e in t)for(let s of this._loader.babylonScene.materials)s.hasTexture(t[e])&&delete t[e];for(let e in t)t[e].dispose()}}tp(oD),td(oD,!0,e=>new oV(e)),e.s(["MSFT_lod",0,oV],95913);let oU="MSFT_minecraftMesh";class oK{constructor(e){this.name=oU,this._loader=e,this.enabled=this._loader.isExtensionUsed(oU)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtraAsync(e,t,this.name,async(n,o)=>{if(o){if(!this._loader._pbrMaterialImpls.get("pbr"))throw Error(`${n}: Material type not supported`);let o=this._loader.loadMaterialPropertiesAsync(e,t,s);return s.needAlphaBlending()&&(s.forceDepthWrite=!0,s.separateCullingPass=!0),s.backFaceCulling=s.forceDepthWrite,s.twoSidedLighting=!0,await o}})}}tp(oU),td(oU,!0,e=>new oK(e)),e.s(["MSFT_minecraftMesh",0,oK],63803);let oH="MSFT_sRGBFactors";class o${constructor(e){this.name=oH,this._loader=e,this.enabled=this._loader.isExtensionUsed(oH)}dispose(){this._loader=null}loadMaterialPropertiesAsync(e,t,s){return tT.LoadExtraAsync(e,t,this.name,async(n,o)=>{if(o){let n=this._loader._getOrCreateMaterialAdapter(s),o=this._loader.loadMaterialPropertiesAsync(e,t,s),a=s.getScene().getEngine().useExactSrgbConversions;return n.baseColorTexture||n.baseColor.toLinearSpaceToRef(n.baseColor,a),n.specularColorTexture||n.specularColor.toLinearSpaceToRef(n.specularColor,a),await o}})}}tp(oH),td(oH,!0,e=>new o$(e)),e.s(["MSFT_sRGBFactors",0,o$],71509);var oz=e.i(65299);let oq={},oW={};var oj=e.i(43350),oY=e.i(55491),oQ=e.i(36146);async function oZ(t,s){let n=await Promise.all(t.allBlocks.map(async t=>{let s=function(t){switch(t){case"FlowGraphPlayAnimationBlock":return async()=>(await e.A(10210)).FlowGraphPlayAnimationBlock;case"FlowGraphStopAnimationBlock":return async()=>(await e.A(32052)).FlowGraphStopAnimationBlock;case"FlowGraphPauseAnimationBlock":return async()=>(await e.A(10379)).FlowGraphPauseAnimationBlock;case"FlowGraphInterpolationBlock":return async()=>(await e.A(33722)).FlowGraphInterpolationBlock;case"FlowGraphSceneReadyEventBlock":return async()=>(await e.A(22118)).FlowGraphSceneReadyEventBlock;case"FlowGraphSceneTickEventBlock":return async()=>(await e.A(18012)).FlowGraphSceneTickEventBlock;case"FlowGraphSendCustomEventBlock":return async()=>(await e.A(23104)).FlowGraphSendCustomEventBlock;case"FlowGraphReceiveCustomEventBlock":return async()=>(await e.A(74441)).FlowGraphReceiveCustomEventBlock;case"FlowGraphMeshPickEventBlock":return async()=>(await e.A(44142)).FlowGraphMeshPickEventBlock;case"FlowGraphEBlock":return async()=>(await e.A(73077)).FlowGraphEBlock;case"FlowGraphPIBlock":return async()=>(await e.A(73077)).FlowGraphPiBlock;case"FlowGraphInfBlock":return async()=>(await e.A(73077)).FlowGraphInfBlock;case"FlowGraphNaNBlock":return async()=>(await e.A(73077)).FlowGraphNaNBlock;case"FlowGraphRandomBlock":return async()=>(await e.A(73077)).FlowGraphRandomBlock;case"FlowGraphAddBlock":return async()=>(await e.A(73077)).FlowGraphAddBlock;case"FlowGraphSubtractBlock":return async()=>(await e.A(73077)).FlowGraphSubtractBlock;case"FlowGraphMultiplyBlock":return async()=>(await e.A(73077)).FlowGraphMultiplyBlock;case"FlowGraphDivideBlock":return async()=>(await e.A(73077)).FlowGraphDivideBlock;case"FlowGraphAbsBlock":return async()=>(await e.A(73077)).FlowGraphAbsBlock;case"FlowGraphSignBlock":return async()=>(await e.A(73077)).FlowGraphSignBlock;case"FlowGraphTruncBlock":return async()=>(await e.A(73077)).FlowGraphTruncBlock;case"FlowGraphFloorBlock":return async()=>(await e.A(73077)).FlowGraphFloorBlock;case"FlowGraphCeilBlock":return async()=>(await e.A(73077)).FlowGraphCeilBlock;case"FlowGraphRoundBlock":return async()=>(await e.A(73077)).FlowGraphRoundBlock;case"FlowGraphFractBlock":return async()=>(await e.A(73077)).FlowGraphFractionBlock;case"FlowGraphNegationBlock":return async()=>(await e.A(73077)).FlowGraphNegationBlock;case"FlowGraphModuloBlock":return async()=>(await e.A(73077)).FlowGraphModuloBlock;case"FlowGraphMinBlock":return async()=>(await e.A(73077)).FlowGraphMinBlock;case"FlowGraphMaxBlock":return async()=>(await e.A(73077)).FlowGraphMaxBlock;case"FlowGraphClampBlock":return async()=>(await e.A(73077)).FlowGraphClampBlock;case"FlowGraphSaturateBlock":return async()=>(await e.A(73077)).FlowGraphSaturateBlock;case"FlowGraphMathInterpolationBlock":return async()=>(await e.A(73077)).FlowGraphMathInterpolationBlock;case"FlowGraphEqualityBlock":return async()=>(await e.A(73077)).FlowGraphEqualityBlock;case"FlowGraphLessThanBlock":return async()=>(await e.A(73077)).FlowGraphLessThanBlock;case"FlowGraphLessThanOrEqualBlock":return async()=>(await e.A(73077)).FlowGraphLessThanOrEqualBlock;case"FlowGraphGreaterThanBlock":return async()=>(await e.A(73077)).FlowGraphGreaterThanBlock;case"FlowGraphGreaterThanOrEqualBlock":return async()=>(await e.A(73077)).FlowGraphGreaterThanOrEqualBlock;case"FlowGraphIsNaNBlock":return async()=>(await e.A(73077)).FlowGraphIsNanBlock;case"FlowGraphIsInfBlock":return async()=>(await e.A(73077)).FlowGraphIsInfinityBlock;case"FlowGraphDegToRadBlock":return async()=>(await e.A(73077)).FlowGraphDegToRadBlock;case"FlowGraphRadToDegBlock":return async()=>(await e.A(73077)).FlowGraphRadToDegBlock;case"FlowGraphSinBlock":return async()=>(await e.A(73077)).FlowGraphSinBlock;case"FlowGraphCosBlock":return async()=>(await e.A(73077)).FlowGraphCosBlock;case"FlowGraphTanBlock":return async()=>(await e.A(73077)).FlowGraphTanBlock;case"FlowGraphASinBlock":return async()=>(await e.A(73077)).FlowGraphAsinBlock;case"FlowGraphACosBlock":return async()=>(await e.A(73077)).FlowGraphAcosBlock;case"FlowGraphATanBlock":return async()=>(await e.A(73077)).FlowGraphAtanBlock;case"FlowGraphATan2Block":return async()=>(await e.A(73077)).FlowGraphAtan2Block;case"FlowGraphSinhBlock":return async()=>(await e.A(73077)).FlowGraphSinhBlock;case"FlowGraphCoshBlock":return async()=>(await e.A(73077)).FlowGraphCoshBlock;case"FlowGraphTanhBlock":return async()=>(await e.A(73077)).FlowGraphTanhBlock;case"FlowGraphASinhBlock":return async()=>(await e.A(73077)).FlowGraphAsinhBlock;case"FlowGraphACoshBlock":return async()=>(await e.A(73077)).FlowGraphAcoshBlock;case"FlowGraphATanhBlock":return async()=>(await e.A(73077)).FlowGraphAtanhBlock;case"FlowGraphExponentialBlock":return async()=>(await e.A(73077)).FlowGraphExpBlock;case"FlowGraphLogBlock":return async()=>(await e.A(73077)).FlowGraphLogBlock;case"FlowGraphLog2Block":return async()=>(await e.A(73077)).FlowGraphLog2Block;case"FlowGraphLog10Block":return async()=>(await e.A(73077)).FlowGraphLog10Block;case"FlowGraphSquareRootBlock":return async()=>(await e.A(73077)).FlowGraphSquareRootBlock;case"FlowGraphPowerBlock":return async()=>(await e.A(73077)).FlowGraphPowerBlock;case"FlowGraphCubeRootBlock":return async()=>(await e.A(73077)).FlowGraphCubeRootBlock;case"FlowGraphBitwiseAndBlock":return async()=>(await e.A(73077)).FlowGraphBitwiseAndBlock;case"FlowGraphBitwiseOrBlock":return async()=>(await e.A(73077)).FlowGraphBitwiseOrBlock;case"FlowGraphBitwiseNotBlock":return async()=>(await e.A(73077)).FlowGraphBitwiseNotBlock;case"FlowGraphBitwiseXorBlock":return async()=>(await e.A(73077)).FlowGraphBitwiseXorBlock;case"FlowGraphBitwiseLeftShiftBlock":return async()=>(await e.A(73077)).FlowGraphBitwiseLeftShiftBlock;case"FlowGraphBitwiseRightShiftBlock":return async()=>(await e.A(73077)).FlowGraphBitwiseRightShiftBlock;case"FlowGraphLengthBlock":return async()=>(await e.A(52080)).FlowGraphLengthBlock;case"FlowGraphNormalizeBlock":return async()=>(await e.A(52080)).FlowGraphNormalizeBlock;case"FlowGraphDotBlock":return async()=>(await e.A(52080)).FlowGraphDotBlock;case"FlowGraphCrossBlock":return async()=>(await e.A(52080)).FlowGraphCrossBlock;case"FlowGraphRotate2DBlock":return async()=>(await e.A(52080)).FlowGraphRotate2DBlock;case"FlowGraphRotate3DBlock":return async()=>(await e.A(52080)).FlowGraphRotate3DBlock;case"FlowGraphTransposeBlock":return async()=>(await e.A(80831)).FlowGraphTransposeBlock;case"FlowGraphDeterminantBlock":return async()=>(await e.A(80831)).FlowGraphDeterminantBlock;case"FlowGraphInvertMatrixBlock":return async()=>(await e.A(80831)).FlowGraphInvertMatrixBlock;case"FlowGraphMatrixMultiplicationBlock":return async()=>(await e.A(80831)).FlowGraphMatrixMultiplicationBlock;case"FlowGraphBranchBlock":return async()=>(await e.A(68135)).FlowGraphBranchBlock;case"FlowGraphSetDelayBlock":return async()=>(await e.A(57048)).FlowGraphSetDelayBlock;case"FlowGraphCancelDelayBlock":return async()=>(await e.A(2331)).FlowGraphCancelDelayBlock;case"FlowGraphCallCounterBlock":return async()=>(await e.A(79405)).FlowGraphCallCounterBlock;case"FlowGraphDebounceBlock":return async()=>(await e.A(93114)).FlowGraphDebounceBlock;case"FlowGraphThrottleBlock":return async()=>(await e.A(14704)).FlowGraphThrottleBlock;case"FlowGraphDoNBlock":return async()=>(await e.A(84308)).FlowGraphDoNBlock;case"FlowGraphFlipFlopBlock":return async()=>(await e.A(66009)).FlowGraphFlipFlopBlock;case"FlowGraphForLoopBlock":return async()=>(await e.A(15273)).FlowGraphForLoopBlock;case"FlowGraphMultiGateBlock":return async()=>(await e.A(86576)).FlowGraphMultiGateBlock;case"FlowGraphSequenceBlock":return async()=>(await e.A(11537)).FlowGraphSequenceBlock;case"FlowGraphSwitchBlock":return async()=>(await e.A(31284)).FlowGraphSwitchBlock;case"FlowGraphWaitAllBlock":return async()=>(await e.A(15439)).FlowGraphWaitAllBlock;case"FlowGraphWhileLoopBlock":return async()=>(await e.A(69906)).FlowGraphWhileLoopBlock;case"FlowGraphConsoleLogBlock":return async()=>(await e.A(49926)).FlowGraphConsoleLogBlock;case"FlowGraphConditionalBlock":return async()=>(await e.A(88688)).FlowGraphConditionalDataBlock;case"FlowGraphConstantBlock":return async()=>(await e.A(81151)).FlowGraphConstantBlock;case"FlowGraphTransformCoordinatesSystemBlock":return async()=>(await e.A(56291)).FlowGraphTransformCoordinatesSystemBlock;case"FlowGraphGetAssetBlock":return async()=>(await e.A(12665)).FlowGraphGetAssetBlock;case"FlowGraphGetPropertyBlock":return async()=>(await e.A(99440)).FlowGraphGetPropertyBlock;case"FlowGraphSetPropertyBlock":return async()=>(await e.A(62734)).FlowGraphSetPropertyBlock;case"FlowGraphGetVariableBlock":return async()=>(await e.A(12353)).FlowGraphGetVariableBlock;case"FlowGraphSetVariableBlock":return async()=>(await e.A(10464)).FlowGraphSetVariableBlock;case"FlowGraphJsonPointerParserBlock":return async()=>(await e.A(96090)).FlowGraphJsonPointerParserBlock;case"FlowGraphLeadingZerosBlock":return async()=>(await e.A(73077)).FlowGraphLeadingZerosBlock;case"FlowGraphTrailingZerosBlock":return async()=>(await e.A(73077)).FlowGraphTrailingZerosBlock;case"FlowGraphOneBitsCounterBlock":return async()=>(await e.A(73077)).FlowGraphOneBitsCounterBlock;case"FlowGraphCombineVector2Block":return async()=>(await e.A(99771)).FlowGraphCombineVector2Block;case"FlowGraphCombineVector3Block":return async()=>(await e.A(99771)).FlowGraphCombineVector3Block;case"FlowGraphCombineVector4Block":return async()=>(await e.A(99771)).FlowGraphCombineVector4Block;case"FlowGraphCombineMatrixBlock":return async()=>(await e.A(99771)).FlowGraphCombineMatrixBlock;case"FlowGraphCombineMatrix2DBlock":return async()=>(await e.A(99771)).FlowGraphCombineMatrix2DBlock;case"FlowGraphCombineMatrix3DBlock":return async()=>(await e.A(99771)).FlowGraphCombineMatrix3DBlock;case"FlowGraphExtractVector2Block":return async()=>(await e.A(99771)).FlowGraphExtractVector2Block;case"FlowGraphExtractVector3Block":return async()=>(await e.A(99771)).FlowGraphExtractVector3Block;case"FlowGraphExtractVector4Block":return async()=>(await e.A(99771)).FlowGraphExtractVector4Block;case"FlowGraphExtractMatrixBlock":return async()=>(await e.A(99771)).FlowGraphExtractMatrixBlock;case"FlowGraphExtractMatrix2DBlock":return async()=>(await e.A(99771)).FlowGraphExtractMatrix2DBlock;case"FlowGraphExtractMatrix3DBlock":return async()=>(await e.A(99771)).FlowGraphExtractMatrix3DBlock;case"FlowGraphTransformVectorBlock":return async()=>(await e.A(52080)).FlowGraphTransformBlock;case"FlowGraphTransformCoordinatesBlock":return async()=>(await e.A(52080)).FlowGraphTransformCoordinatesBlock;case"FlowGraphConjugateBlock":return async()=>(await e.A(52080)).FlowGraphConjugateBlock;case"FlowGraphAngleBetweenBlock":return async()=>(await e.A(52080)).FlowGraphAngleBetweenBlock;case"FlowGraphQuaternionFromAxisAngleBlock":return async()=>(await e.A(52080)).FlowGraphQuaternionFromAxisAngleBlock;case"FlowGraphAxisAngleFromQuaternionBlock":return async()=>(await e.A(52080)).FlowGraphAxisAngleFromQuaternionBlock;case"FlowGraphQuaternionFromDirectionsBlock":return async()=>(await e.A(52080)).FlowGraphQuaternionFromDirectionsBlock;case"FlowGraphMatrixDecompose":return async()=>(await e.A(80831)).FlowGraphMatrixDecomposeBlock;case"FlowGraphMatrixCompose":return async()=>(await e.A(80831)).FlowGraphMatrixComposeBlock;case"FlowGraphBooleanToFloat":return async()=>(await e.A(12116)).FlowGraphBooleanToFloat;case"FlowGraphBooleanToInt":return async()=>(await e.A(12116)).FlowGraphBooleanToInt;case"FlowGraphFloatToBoolean":return async()=>(await e.A(12116)).FlowGraphFloatToBoolean;case"FlowGraphIntToBoolean":return async()=>(await e.A(12116)).FlowGraphIntToBoolean;case"FlowGraphIntToFloat":return async()=>(await e.A(12116)).FlowGraphIntToFloat;case"FlowGraphFloatToInt":return async()=>(await e.A(12116)).FlowGraphFloatToInt;case"FlowGraphEasingBlock":return async()=>(await e.A(72848)).FlowGraphEasingBlock;case"FlowGraphBezierCurveEasing":return async()=>(await e.A(41143)).FlowGraphBezierCurveEasingBlock;case"FlowGraphPointerOverEventBlock":return async()=>(await e.A(15356)).FlowGraphPointerOverEventBlock;case"FlowGraphPointerOutEventBlock":return async()=>(await e.A(7821)).FlowGraphPointerOutEventBlock;case"FlowGraphPointerDownEventBlock":return async()=>(await e.A(22527)).FlowGraphPointerDownEventBlock;case"FlowGraphPointerUpEventBlock":return async()=>(await e.A(49435)).FlowGraphPointerUpEventBlock;case"FlowGraphPointerMoveEventBlock":return async()=>(await e.A(67541)).FlowGraphPointerMoveEventBlock;case"FlowGraphKeyDownEventBlock":return async()=>(await e.A(1509)).FlowGraphKeyDownEventBlock;case"FlowGraphKeyUpEventBlock":return async()=>(await e.A(28893)).FlowGraphKeyUpEventBlock;case"FlowGraphIsKeyPressedBlock":return async()=>(await e.A(89981)).FlowGraphIsKeyPressedBlock;case"FlowGraphContextBlock":return async()=>(await e.A(55867)).FlowGraphContextBlock;case"FlowGraphArrayIndexBlock":return async()=>(await e.A(338)).FlowGraphArrayIndexBlock;case"FlowGraphCodeExecutionBlock":return async()=>(await e.A(87989)).FlowGraphCodeExecutionBlock;case"FlowGraphIndexOfBlock":return async()=>(await e.A(47861)).FlowGraphIndexOfBlock;case"FlowGraphFunctionReference":return async()=>(await e.A(39988)).FlowGraphFunctionReferenceBlock;case"FlowGraphDataSwitchBlock":return async()=>(await e.A(28362)).FlowGraphDataSwitchBlock;case"FlowGraphDebugBlock":return async()=>(await e.A(35852)).FlowGraphDebugBlock;case"FlowGraphPhysicsCollisionEventBlock":return async()=>(await e.A(41325)).FlowGraphPhysicsCollisionEventBlock;case"FlowGraphApplyForceBlock":return async()=>(await e.A(77947)).FlowGraphApplyForceBlock;case"FlowGraphApplyImpulseBlock":return async()=>(await e.A(13042)).FlowGraphApplyImpulseBlock;case"FlowGraphSetLinearVelocityBlock":return async()=>(await e.A(68682)).FlowGraphSetLinearVelocityBlock;case"FlowGraphSetAngularVelocityBlock":return async()=>(await e.A(4730)).FlowGraphSetAngularVelocityBlock;case"FlowGraphSetPhysicsMotionTypeBlock":return async()=>(await e.A(39210)).FlowGraphSetPhysicsMotionTypeBlock;case"FlowGraphGetLinearVelocityBlock":return async()=>(await e.A(4586)).FlowGraphGetLinearVelocityBlock;case"FlowGraphGetAngularVelocityBlock":return async()=>(await e.A(74223)).FlowGraphGetAngularVelocityBlock;case"FlowGraphGetPhysicsMassPropertiesBlock":return async()=>(await e.A(284)).FlowGraphGetPhysicsMassPropertiesBlock;case"FlowGraphPlaySoundBlock":return async()=>(await e.A(15119)).FlowGraphPlaySoundBlock;case"FlowGraphStopSoundBlock":return async()=>(await e.A(70439)).FlowGraphStopSoundBlock;case"FlowGraphPauseSoundBlock":return async()=>(await e.A(84069)).FlowGraphPauseSoundBlock;case"FlowGraphSetSoundVolumeBlock":return async()=>(await e.A(41530)).FlowGraphSetSoundVolumeBlock;case"FlowGraphSoundEndedEventBlock":return async()=>(await e.A(92768)).FlowGraphSoundEndedEventBlock;case"FlowGraphGetSoundVolumeBlock":return async()=>(await e.A(27806)).FlowGraphGetSoundVolumeBlock;case"FlowGraphIsSoundPlayingBlock":return async()=>(await e.A(52501)).FlowGraphIsSoundPlayingBlock;default:if(oq[t])return oq[t];if(!t.includes("/")){let e=oW[t];if(e&&oq[e])return oq[e]}throw Error(`Unknown block name ${t}`)}}(t.className);return await s()}));return function(e,t,s){let n=t.coordinator.createGraph();e.name&&(n.name=e.name),e.uniqueId&&(n.uniqueId=e.uniqueId);let o=[],a=t.valueParseFunction??oQ.defaultValueParseFunction;for(let i=0;i<e.allBlocks.length;i++){let r=function(e,t,s){let n={},o=t.valueParseFunction??oQ.defaultValueParseFunction;if(e.config)for(let s in e.config)n[s]=o(s,e.config,t.assetsContainer||t.scene,t.scene);if((0,oQ.needsPathConverter)(e.className)){if(!t.pathConverter)throw Error("Block "+e.className+" requires a path converter to be provided in parse options.");n.pathConverter=t.pathConverter}let a=new s(n);a.uniqueId=e.uniqueId;for(let s=0;s<e.dataInputs.length;s++){let n=a.getDataInput(e.dataInputs[s].name);if(n)n.deserialize(e.dataInputs[s]),void 0!==e.dataInputs[s].defaultValue&&(n._defaultValue=o("defaultValue",e.dataInputs[s],t.assetsContainer||t.scene,t.scene));else throw Error("Could not find data input with name "+e.dataInputs[s].name+" in block "+e.className)}for(let t=0;t<e.dataOutputs.length;t++){let s=a.getDataOutput(e.dataOutputs[t].name);if(s)s.deserialize(e.dataOutputs[t]);else throw Error("Could not find data output with name "+e.dataOutputs[t].name+" in block "+e.className)}return a.metadata=e.metadata,a.deserialize&&a.deserialize(e),a}(e.allBlocks[i],{scene:t.coordinator.config.scene,pathConverter:t.pathConverter,assetsContainer:t.coordinator.config.scene,valueParseFunction:a},s[i]);o.push(r),n.addBlock(r),r instanceof oj.FlowGraphEventBlock&&n.addEventBlock(r)}let i=new Map,r=new Map,l=new Map,h=new Map;for(let e of o){for(let t of e.dataInputs)i.set(t.uniqueId,t);for(let t of e.dataOutputs)r.set(t.uniqueId,t);if(e instanceof oY.FlowGraphExecutionBlock){for(let t of e.signalInputs)l.set(t.uniqueId,t);for(let t of e.signalOutputs)h.set(t.uniqueId,t)}}let u=(e,t)=>{-1===e._connectedPoint.indexOf(t)&&e.connectTo(t)};for(let e of o){for(let t of e.dataInputs)for(let e of t.connectedPointIds){let s=r.get(e);if(!s)throw Error("Could not find data out connection with unique id "+e);u(t,s)}for(let t of e.dataOutputs)for(let e of t.connectedPointIds){let s=i.get(e);if(!s)throw Error("Could not find data in connection with unique id "+e);u(t,s)}if(e instanceof oY.FlowGraphExecutionBlock){for(let t of e.signalOutputs)for(let e of t.connectedPointIds){let s=l.get(e);if(!s)throw Error("Could not find signal in connection with unique id "+e);u(t,s)}for(let t of e.signalInputs)for(let e of t.connectedPointIds){let s=h.get(e);if(!s)throw Error("Could not find signal out connection with unique id "+e);u(s,t)}}}for(let t of e.executionContexts??[])!function(e,t,s){let n=t.graph.createContext();e.enableLogging&&(n.enableLogging=!0),n.treatDataAsRightHanded=s||!1;let o=t.valueParseFunction??oQ.defaultValueParseFunction;n.uniqueId=e.uniqueId,n.name=e.name??"";let a=n.getScene();if(e._assetsContext){let t=e._assetsContext;n.assetsContext={meshes:t.meshes?.map(e=>a.getMeshById(e)),lights:t.lights?.map(e=>a.getLightByName(e)),cameras:t.cameras?.map(e=>a.getCameraByName(e)),materials:t.materials?.map(e=>a.getMaterialById(e)),textures:t.textures?.map(e=>a.getTextureByName(e)),animations:t.animations?.map(e=>a.animations.find(t=>t.name===e)),skeletons:t.skeletons?.map(e=>a.getSkeletonByName(e)),particleSystems:t.particleSystems?.map(e=>a.getParticleSystemById(e)),animationGroups:t.animationGroups?.map(e=>a.getAnimationGroupByName(e)),transformNodes:t.transformNodes?.map(e=>a.getTransformNodeById(e)),rootNodes:[],multiMaterials:[],morphTargetManagers:[],geometries:[],actionManagers:[],environmentTexture:null,postProcesses:[],sounds:null,effectLayers:[],layers:[],reflectionProbes:[],lensFlareSystems:[],proceduralTextures:[],getNodes:function(){throw Error("Function not implemented.")}}}for(let t in e._userVariables){let s=o(t,e._userVariables,n.assetsContext,a);n.userVariables[t]=s}if(e._variableTypes)for(let t in e._variableTypes)n.setVariableType(t,e._variableTypes[t]);for(let t in e._connectionValues){let s=o(t,e._connectionValues,n.assetsContext,a);n._setConnectionValueByKey(t,s)}}(t,{graph:n,valueParseFunction:a},e.rightHanded);return n}(t,s,n)}e.i(82155);var oX=e.i(5110);function oJ(e){let[t,s]=e.split(":");return o0({op:t,extension:s})}function o0(e,t=!0){let s=e.extension?o3[e.extension]?.[e.op]:o2[e.op];if(!s&&(L.Logger.Warn(`No mapping found for operation ${e.op} and extension ${e.extension||"KHR_interactivity"}`),t)){let t={},s={flows:{}};if(e.inputValueSockets)for(let s in t.values={},e.inputValueSockets)t.values[s]={name:s};return e.outputValueSockets&&(s.values={},Object.keys(e.outputValueSockets).forEach(e=>{s.values[e]={name:e}})),{blocks:[],inputs:t,outputs:s}}return s}function o1(e,t,s){o3[t]||(o3[t]={}),o3[t][e]=s}let o3={BABYLON:{"flow/log":{blocks:["FlowGraphConsoleLogBlock"],inputs:{values:{message:{name:"message"}}}}}},o2={"event/onStart":{blocks:["FlowGraphSceneReadyEventBlock"],outputs:{flows:{out:{name:"done"}}}},"event/onTick":{blocks:["FlowGraphSceneTickEventBlock"],inputs:{},outputs:{values:{timeSinceLastTick:{name:"deltaTime",gltfType:"number"}},flows:{out:{name:"done"}}}},"event/send":{blocks:["FlowGraphSendCustomEventBlock"],extraProcessor(e,t,s,n,o){if("event/send"!==t.op||!e.configuration||1!==Object.keys(e.configuration).length)throw Error("Receive event should have a single configuration object, the event itself");let a=e.configuration.event,i=a.value?.[0];if("number"!=typeof i)throw Error("Event id should be a number");let r=n.arrays.events[i],l=o[0];return l.config||(l.config={}),l.config.eventId=r.eventId,l.config.eventData=r.eventData,o}},"event/receive":{blocks:["FlowGraphReceiveCustomEventBlock"],outputs:{flows:{out:{name:"done"}}},validation(e,t){if(!e.configuration)return L.Logger.Error("Receive event should have a configuration object"),{valid:!1,error:"Receive event should have a configuration object"};let s=e.configuration.event;if(!s)return L.Logger.Error("Receive event should have a single configuration object, the event itself"),{valid:!1,error:"Receive event should have a single configuration object, the event itself"};let n=s.value?.[0];return"number"!=typeof n?(L.Logger.Error("Event id should be a number"),{valid:!1,error:"Event id should be a number"}):t.events?.[n]?{valid:!0}:(L.Logger.Error(`Event with id ${n} not found`),{valid:!1,error:`Event with id ${n} not found`})},extraProcessor(e,t,s,n,o){if("event/receive"!==t.op||!e.configuration||1!==Object.keys(e.configuration).length)throw Error("Receive event should have a single configuration object, the event itself");let a=e.configuration.event,i=a.value?.[0];if("number"!=typeof i)throw Error("Event id should be a number");let r=n.arrays.events[i],l=o[0];return l.config||(l.config={}),l.config.eventId=r.eventId,l.config.eventData=r.eventData,o}},"math/E":o7("FlowGraphEBlock"),"math/Pi":o7("FlowGraphPIBlock"),"math/Inf":o7("FlowGraphInfBlock"),"math/NaN":o7("FlowGraphNaNBlock"),"math/abs":o7("FlowGraphAbsBlock"),"math/sign":o7("FlowGraphSignBlock"),"math/trunc":o7("FlowGraphTruncBlock"),"math/floor":o7("FlowGraphFloorBlock"),"math/ceil":o7("FlowGraphCeilBlock"),"math/round":{blocks:["FlowGraphRoundBlock"],configuration:{},inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.roundHalfAwayFromZero=!0,o}},"math/fract":o7("FlowGraphFractBlock"),"math/neg":o7("FlowGraphNegationBlock"),"math/add":o7("FlowGraphAddBlock",["a","b"],!0),"math/sub":o7("FlowGraphSubtractBlock",["a","b"],!0),"math/mul":{blocks:["FlowGraphMultiplyBlock"],extraProcessor(e,t,s,n,o){var a;(a=o[0]).config||(a.config={}),o[0].config.useMatrixPerComponent=!0,o[0].config.preventIntegerFloatArithmetic=!0;let i=-1;return Object.keys(e.values||{}).find(t=>e.values?.[t].type!==void 0&&(i=e.values[t].type,!0)),-1!==i&&(o[0].config.type=n.arrays.types[i].flowGraphType),o},validation:e=>e.values?o4(e):{valid:!0}},"math/div":o7("FlowGraphDivideBlock",["a","b"],!0),"math/rem":o7("FlowGraphModuloBlock",["a","b"]),"math/min":o7("FlowGraphMinBlock",["a","b"]),"math/max":o7("FlowGraphMaxBlock",["a","b"]),"math/clamp":o7("FlowGraphClampBlock",["a","b","c"]),"math/saturate":o7("FlowGraphSaturateBlock"),"math/mix":o7("FlowGraphMathInterpolationBlock",["a","b","c"]),"math/eq":o7("FlowGraphEqualityBlock",["a","b"]),"math/lt":o7("FlowGraphLessThanBlock",["a","b"]),"math/le":o7("FlowGraphLessThanOrEqualBlock",["a","b"]),"math/gt":o7("FlowGraphGreaterThanBlock",["a","b"]),"math/ge":o7("FlowGraphGreaterThanOrEqualBlock",["a","b"]),"math/isNaN":o7("FlowGraphIsNaNBlock"),"math/isInf":o7("FlowGraphIsInfBlock"),"math/select":{blocks:["FlowGraphConditionalBlock"],inputs:{values:{condition:{name:"condition"},a:{name:"onTrue"},b:{name:"onFalse"}}},outputs:{values:{value:{name:"output"}}}},"math/random":{blocks:["FlowGraphRandomBlock"],outputs:{values:{value:{name:"value"}}}},"math/sin":o7("FlowGraphSinBlock"),"math/cos":o7("FlowGraphCosBlock"),"math/tan":o7("FlowGraphTanBlock"),"math/asin":o7("FlowGraphASinBlock"),"math/acos":o7("FlowGraphACosBlock"),"math/atan":o7("FlowGraphATanBlock"),"math/atan2":o7("FlowGraphATan2Block",["a","b"]),"math/sinh":o7("FlowGraphSinhBlock"),"math/cosh":o7("FlowGraphCoshBlock"),"math/tanh":o7("FlowGraphTanhBlock"),"math/asinh":o7("FlowGraphASinhBlock"),"math/acosh":o7("FlowGraphACoshBlock"),"math/atanh":o7("FlowGraphATanhBlock"),"math/exp":o7("FlowGraphExponentialBlock"),"math/log":o7("FlowGraphLogBlock"),"math/log2":o7("FlowGraphLog2Block"),"math/log10":o7("FlowGraphLog10Block"),"math/sqrt":o7("FlowGraphSquareRootBlock"),"math/cbrt":o7("FlowGraphCubeRootBlock"),"math/pow":o7("FlowGraphPowerBlock",["a","b"]),"math/length":o7("FlowGraphLengthBlock"),"math/normalize":o7("FlowGraphNormalizeBlock"),"math/dot":o7("FlowGraphDotBlock",["a","b"]),"math/cross":o7("FlowGraphCrossBlock",["a","b"]),"math/rotate2D":{blocks:["FlowGraphRotate2DBlock"],inputs:{values:{a:{name:"a"},angle:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/rotate3D":{blocks:["FlowGraphRotate3DBlock"],inputs:{values:{a:{name:"a"},rotation:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/transform":{blocks:["FlowGraphTransformVectorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}}},"math/combine2":{blocks:["FlowGraphCombineVector2Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/combine3":{blocks:["FlowGraphCombineVector3Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/combine4":{blocks:["FlowGraphCombineVector4Block"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/extract2":{blocks:["FlowGraphExtractVector2Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"}}}},"math/extract3":{blocks:["FlowGraphExtractVector3Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"}}}},"math/extract4":{blocks:["FlowGraphExtractVector4Block"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"}}}},"math/transpose":o7("FlowGraphTransposeBlock"),"math/determinant":o7("FlowGraphDeterminantBlock"),"math/inverse":o7("FlowGraphInvertMatrixBlock"),"math/matMul":o7("FlowGraphMatrixMultiplicationBlock",["a","b"]),"math/matCompose":{blocks:["FlowGraphMatrixCompose"],inputs:{values:{translation:{name:"position",gltfType:"float3"},rotation:{name:"rotationQuaternion",gltfType:"float4"},scale:{name:"scaling",gltfType:"float3"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o,a){let i=o[0].dataInputs.find(e=>"rotationQuaternion"===e.name);if(!i)throw Error("Rotation quaternion input not found");return a._connectionValues[i.uniqueId]&&(a._connectionValues[i.uniqueId].type="Quaternion"),o}},"math/matDecompose":{blocks:["FlowGraphMatrixDecompose"],inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{translation:{name:"position"},rotation:{name:"rotationQuaternion"},scale:{name:"scaling"}}}},"math/quatConjugate":o7("FlowGraphConjugateBlock",["a"]),"math/quatMul":{blocks:["FlowGraphMultiplyBlock"],inputs:{values:{a:{name:"a",gltfType:"vector4"},b:{name:"b",gltfType:"vector4"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.type="Quaternion",o}},"math/quatAngleBetween":o7("FlowGraphAngleBetweenBlock",["a","b"]),"math/quatFromAxisAngle":{blocks:["FlowGraphQuaternionFromAxisAngleBlock"],inputs:{values:{axis:{name:"a",gltfType:"float3"},angle:{name:"b",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}}},"math/quatToAxisAngle":o7("FlowGraphAxisAngleFromQuaternionBlock",["a"]),"math/quatFromDirections":o7("FlowGraphQuaternionFromDirectionsBlock",["a","b"]),"math/combine2x2":{blocks:["FlowGraphCombineMatrix2DBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"math/extract2x2":{blocks:["FlowGraphExtractMatrix2DBlock"],inputs:{values:{a:{name:"input",gltfType:"float2x2"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"}}}},"math/combine3x3":{blocks:["FlowGraphCombineMatrix3DBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"},e:{name:"input_4",gltfType:"number"},f:{name:"input_5",gltfType:"number"},g:{name:"input_6",gltfType:"number"},h:{name:"input_7",gltfType:"number"},i:{name:"input_8",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"math/extract3x3":{blocks:["FlowGraphExtractMatrix3DBlock"],inputs:{values:{a:{name:"input",gltfType:"float3x3"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"},4:{name:"output_4"},5:{name:"output_5"},6:{name:"output_6"},7:{name:"output_7"},8:{name:"output_8"}}}},"math/combine4x4":{blocks:["FlowGraphCombineMatrixBlock"],inputs:{values:{a:{name:"input_0",gltfType:"number"},b:{name:"input_1",gltfType:"number"},c:{name:"input_2",gltfType:"number"},d:{name:"input_3",gltfType:"number"},e:{name:"input_4",gltfType:"number"},f:{name:"input_5",gltfType:"number"},g:{name:"input_6",gltfType:"number"},h:{name:"input_7",gltfType:"number"},i:{name:"input_8",gltfType:"number"},j:{name:"input_9",gltfType:"number"},k:{name:"input_10",gltfType:"number"},l:{name:"input_11",gltfType:"number"},m:{name:"input_12",gltfType:"number"},n:{name:"input_13",gltfType:"number"},o:{name:"input_14",gltfType:"number"},p:{name:"input_15",gltfType:"number"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o){var a;return(a=o[0]).config||(a.config={}),o[0].config.inputIsColumnMajor=!0,o}},"math/extract4x4":{blocks:["FlowGraphExtractMatrixBlock"],configuration:{},inputs:{values:{a:{name:"input",gltfType:"number"}}},outputs:{values:{0:{name:"output_0"},1:{name:"output_1"},2:{name:"output_2"},3:{name:"output_3"},4:{name:"output_4"},5:{name:"output_5"},6:{name:"output_6"},7:{name:"output_7"},8:{name:"output_8"},9:{name:"output_9"},10:{name:"output_10"},11:{name:"output_11"},12:{name:"output_12"},13:{name:"output_13"},14:{name:"output_14"},15:{name:"output_15"}}}},"math/not":{blocks:["FlowGraphBitwiseNotBlock"],inputs:{values:{a:{name:"a"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o,a){var i;(i=o[0]).config||(i.config={});let r=o[0].dataInputs[0];return o[0].config.valueType=a._connectionValues[r.uniqueId]?.type??"FlowGraphInteger",o}},"math/and":{blocks:["FlowGraphBitwiseAndBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o,a){var i;(i=o[0]).config||(i.config={});let r=o[0].dataInputs[0],l=o[0].dataInputs[1];return o[0].config.valueType=a._connectionValues[r.uniqueId]?.type??a._connectionValues[l.uniqueId]?.type??"FlowGraphInteger",o}},"math/or":{blocks:["FlowGraphBitwiseOrBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o,a){var i;(i=o[0]).config||(i.config={});let r=o[0].dataInputs[0],l=o[0].dataInputs[1];return o[0].config.valueType=a._connectionValues[r.uniqueId]?.type??a._connectionValues[l.uniqueId]?.type??"FlowGraphInteger",o}},"math/xor":{blocks:["FlowGraphBitwiseXorBlock"],inputs:{values:{a:{name:"a"},b:{name:"b"}}},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,s,n,o,a){var i;(i=o[0]).config||(i.config={});let r=o[0].dataInputs[0],l=o[0].dataInputs[1];return o[0].config.valueType=a._connectionValues[r.uniqueId]?.type??a._connectionValues[l.uniqueId]?.type??"FlowGraphInteger",o}},"math/asr":o7("FlowGraphBitwiseRightShiftBlock",["a","b"]),"math/lsl":o7("FlowGraphBitwiseLeftShiftBlock",["a","b"]),"math/clz":o7("FlowGraphLeadingZerosBlock"),"math/ctz":o7("FlowGraphTrailingZerosBlock"),"math/popcnt":o7("FlowGraphOneBitsCounterBlock"),"math/rad":o7("FlowGraphDegToRadBlock"),"math/deg":o7("FlowGraphRadToDegBlock"),"type/boolToInt":o7("FlowGraphBooleanToInt"),"type/boolToFloat":o7("FlowGraphBooleanToFloat"),"type/intToBool":o7("FlowGraphIntToBoolean"),"type/intToFloat":o7("FlowGraphIntToFloat"),"type/floatToInt":o7("FlowGraphFloatToInt"),"type/floatToBool":o7("FlowGraphFloatToBoolean"),"flow/sequence":{blocks:["FlowGraphSequenceBlock"],extraProcessor(e,t,s,n,o){let a=o[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows||[]).length,a.signalOutputs.forEach((e,t)=>{e.name="out_"+t}),o}},"flow/branch":{blocks:["FlowGraphBranchBlock"],outputs:{flows:{true:{name:"onTrue"},false:{name:"onFalse"}}}},"flow/switch":{blocks:["FlowGraphSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"},default:{name:"default"}}},validation(e){let t=e.configuration?.cases;if(t&&t.value){if(!t.value.every(e=>"number"==typeof e&&/^-?\d+$/.test(e.toString())))return L.Logger.Warn("Switch cases should be integers. Using empty array instead."),t.value=[],{valid:!0};let e=new Set(t.value);t.value=Array.from(e)}return{valid:!0}},extraProcessor(e,t,s,n,o){if("flow/switch"!==t.op||!e.flows||0===Object.keys(e.flows).length)throw Error("Switch should have a single configuration object, the cases array");return o[0].signalOutputs.forEach(e=>{"default"!==e.name&&(e.name="out_"+e.name)}),o}},"flow/while":{blocks:["FlowGraphWhileLoopBlock"],outputs:{flows:{loopBody:{name:"executionFlow"}}}},"flow/for":{blocks:["FlowGraphForLoopBlock"],configuration:{initialIndex:{name:"initialIndex",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{values:{startIndex:{name:"startIndex",gltfType:"number"},endIndex:{name:"endIndex",gltfType:"number"}}},outputs:{values:{index:{name:"index"}},flows:{loopBody:{name:"executionFlow"}}},extraProcessor(e,t,s,n,o){let a=o[0];return a.config||(a.config={}),a.config.incrementIndexWhenLoopDone=!0,o}},"flow/doN":{blocks:["FlowGraphDoNBlock"],configuration:{},inputs:{values:{n:{name:"maxExecutions",gltfType:"number"}}},outputs:{values:{currentCount:{name:"executionCount"}}}},"flow/multiGate":{blocks:["FlowGraphMultiGateBlock"],configuration:{isRandom:{name:"isRandom",gltfType:"boolean",inOptions:!0,defaultValue:!1},isLoop:{name:"isLoop",gltfType:"boolean",inOptions:!0,defaultValue:!1}},extraProcessor(e,t,s,n,o){if("flow/multiGate"!==t.op||!e.flows||0===Object.keys(e.flows).length)throw Error("MultiGate should have a single configuration object, the number of output flows");let a=o[0];return a.config||(a.config={}),a.config.outputSignalCount=Object.keys(e.flows).length,a.signalOutputs.forEach((e,t)=>{e.name="out_"+t}),o}},"flow/waitAll":{blocks:["FlowGraphWaitAllBlock"],configuration:{inputFlows:{name:"inputSignalCount",gltfType:"number",inOptions:!0,defaultValue:0}},inputs:{flows:{reset:{name:"reset"},"[segment]":{name:"in_$1"}}},validation:e=>("number"!=typeof e.configuration?.inputFlows?.value?.[0]&&(e.configuration=e.configuration||{inputFlows:{value:[0]}},e.configuration.inputFlows.value=[0]),{valid:!0})},"flow/throttle":{blocks:["FlowGraphThrottleBlock"],outputs:{flows:{err:{name:"error"}}}},"flow/setDelay":{blocks:["FlowGraphSetDelayBlock"],outputs:{flows:{err:{name:"error"}}}},"flow/cancelDelay":{blocks:["FlowGraphCancelDelayBlock"]},"variable/get":{blocks:["FlowGraphGetVariableBlock"],validation:e=>e.configuration?.variable?.value?{valid:!0}:(L.Logger.Error("Variable get block should have a variable configuration"),{valid:!1,error:"Variable get block should have a variable configuration"}),configuration:{variable:{name:"variable",gltfType:"number",flowGraphType:"string",inOptions:!0,isVariable:!0,dataTransformer:(e,t)=>t.getVariableName(e)}}},"variable/set":{blocks:["FlowGraphSetVariableBlock"],configuration:{variables:{name:"variables",gltfType:"number",flowGraphType:"string",inOptions:!0,isArray:!0,dataTransformer:(e,t)=>e.map(e=>t.getVariableName(e))}},extraProcessor:(e,t,s,n,o)=>(o[0].dataInputs.forEach(e=>{e.name=n.getVariableName(+e.name)}),o)},"variable/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphContextBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing","FlowGraphGetVariableBlock"],configuration:{variable:{name:"propertyName",inOptions:!0,isVariable:!0,dataTransformer:(e,t)=>t.getVariableName(e)},useSlerp:{name:"animationType",inOptions:!0,defaultValue:!1,dataTransformer:e=>!0===e?"Quaternion":void 0}},inputs:{values:{value:{name:"value_1"},duration:{name:"duration_1",gltfType:"number"},p1:{name:"controlPoint1",toBlock:"FlowGraphBezierCurveEasing"},p2:{name:"controlPoint2",toBlock:"FlowGraphBezierCurveEasing"}},flows:{in:{name:"in",toBlock:"FlowGraphPlayAnimationBlock"}}},outputs:{flows:{err:{name:"error",toBlock:"FlowGraphPlayAnimationBlock"},out:{name:"out",toBlock:"FlowGraphPlayAnimationBlock"},done:{name:"done",toBlock:"FlowGraphPlayAnimationBlock"}}},interBlockConnectors:[{input:"object",output:"userVariables",inputBlockIndex:2,outputBlockIndex:1,isVariable:!0},{input:"animation",output:"animation",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0},{input:"easingFunction",output:"easingFunction",inputBlockIndex:0,outputBlockIndex:3,isVariable:!0},{input:"value_0",output:"value",inputBlockIndex:0,outputBlockIndex:4,isVariable:!0}],extraProcessor(e,t,s,n,o){var a,i;let r=o[0],l=e.configuration?.variable.value?.[0];if("number"!=typeof l)throw L.Logger.Error("Variable index is not defined for variable interpolation block"),Error("Variable index is not defined for variable interpolation block");let h=n.arrays.staticVariables[l];void 0===r.config?.animationType?.value&&(r.config||(r.config={}),(a=r.config).animationType||(a.animationType={}),r.config.animationType.value=(0,oX.getAnimationTypeByFlowGraphType)(h.type));let u=o[4];return u.config||(u.config={}),(i=u.config).variable||(i.variable={}),u.config.variable.value=n.getVariableName(l),o}},"pointer/get":{blocks:["FlowGraphGetPropertyBlock","FlowGraphJsonPointerParserBlock"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customGetFunction",output:"getFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor:(e,t,s,n,o)=>(o.forEach(e=>{"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)}),o)},"pointer/set":{blocks:["FlowGraphSetPropertyBlock","FlowGraphJsonPointerParserBlock"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{value:{name:"value"},"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customSetFunction",output:"setFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor:(e,t,s,n,o)=>(o.forEach(e=>{"FlowGraphJsonPointerParserBlock"===e.className&&(e.config||(e.config={}),e.config.outputValue=!0)}),o)},"pointer/interpolate":{blocks:["FlowGraphInterpolationBlock","FlowGraphJsonPointerParserBlock","FlowGraphPlayAnimationBlock","FlowGraphBezierCurveEasing"],configuration:{pointer:{name:"jsonPointer",toBlock:"FlowGraphJsonPointerParserBlock"}},inputs:{values:{value:{name:"value_1"},"[segment]":{name:"$1",toBlock:"FlowGraphJsonPointerParserBlock"},duration:{name:"duration_1",gltfType:"number"},p1:{name:"controlPoint1",toBlock:"FlowGraphBezierCurveEasing"},p2:{name:"controlPoint2",toBlock:"FlowGraphBezierCurveEasing"}},flows:{in:{name:"in",toBlock:"FlowGraphPlayAnimationBlock"}}},outputs:{flows:{err:{name:"error",toBlock:"FlowGraphPlayAnimationBlock"},out:{name:"out",toBlock:"FlowGraphPlayAnimationBlock"},done:{name:"done",toBlock:"FlowGraphPlayAnimationBlock"}}},interBlockConnectors:[{input:"object",output:"object",inputBlockIndex:2,outputBlockIndex:1,isVariable:!0},{input:"propertyName",output:"propertyName",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"customBuildAnimation",output:"generateAnimationsFunction",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"animation",output:"animation",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0},{input:"easingFunction",output:"easingFunction",inputBlockIndex:0,outputBlockIndex:3,isVariable:!0},{input:"value_0",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0}],extraProcessor:(e,t,s,n,o)=>(o.forEach(t=>{"FlowGraphJsonPointerParserBlock"===t.className?(t.config||(t.config={}),t.config.outputValue=!0):"FlowGraphInterpolationBlock"===t.className&&(t.config||(t.config={}),Object.keys(e.values||[]).forEach(s=>{let o=e.values?.[s];if("value"===s&&o){let e=o.type;void 0!==e&&(t.config.animationType=n.arrays.types[e].flowGraphType)}}))}),o)},"animation/start":{blocks:["FlowGraphPlayAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"},speed:{name:"speed",gltfType:"number"},startTime:{name:"from",gltfType:"number",dataTransformer:(e,t)=>[e[0]*t._animationTargetFps]},endTime:{name:"to",gltfType:"number",dataTransformer:(e,t)=>[e[0]*t._animationTargetFps]}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor(e,t,s,n,o,a,i){let r=o[o.length-1];return r.config||(r.config={}),r.config.glTF=i,o}},"animation/stop":{blocks:["FlowGraphStopAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor(e,t,s,n,o,a,i){let r=o[o.length-1];return r.config||(r.config={}),r.config.glTF=i,o}},"animation/stopAt":{blocks:["FlowGraphStopAnimationBlock","FlowGraphArrayIndexBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{},inputs:{values:{animation:{name:"index",gltfType:"number",toBlock:"FlowGraphArrayIndexBlock"},stopTime:{name:"stopAtFrame",gltfType:"number",dataTransformer:(e,t)=>[e[0]*t._animationTargetFps]}}},outputs:{flows:{err:{name:"error"}}},interBlockConnectors:[{input:"animationGroup",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"animationGroups",inputBlockIndex:1,outputBlockIndex:2,isVariable:!0}],extraProcessor(e,t,s,n,o,a,i){let r=o[o.length-1];return r.config||(r.config={}),r.config.glTF=i,o}},"math/switch":{blocks:["FlowGraphDataSwitchBlock"],configuration:{cases:{name:"cases",isArray:!0,inOptions:!0,defaultValue:[]}},inputs:{values:{selection:{name:"case"}}},validation(e){let t=e.configuration?.cases;if(t&&t.value){if(!t.value.every(e=>"number"==typeof e&&/^-?\d+$/.test(e.toString())))return L.Logger.Warn("Switch cases should be integers. Using empty array instead."),t.value=[],{valid:!0};let e=new Set(t.value);t.value=Array.from(e)}return{valid:!0}},extraProcessor(e,t,s,n,o){let a=o[0];return a.dataInputs.forEach(e=>{"default"!==e.name&&"case"!==e.name&&(e.name="in_"+e.name)}),a.config||(a.config={}),a.config.treatCasesAsIntegers=!0,o}},"debug/log":{blocks:["FlowGraphConsoleLogBlock"],configuration:{message:{name:"messageTemplate",inOptions:!0}}}};function o7(e,t=["a"],s){return{blocks:[e],inputs:{values:t.reduce((e,t)=>(e[t]={name:t},e),{})},outputs:{values:{value:{name:"value"}}},extraProcessor(e,t,n,o,a){var i;if(s){(i=a[0]).config||(i.config={}),a[0].config.preventIntegerFloatArithmetic=!0;let t=-1;Object.keys(e.values||{}).find(s=>e.values?.[s].type!==void 0&&(t=e.values[s].type,!0)),-1!==t&&(a[0].config.type=o.arrays.types[t].flowGraphType)}return a},validation:e=>s?o4(e):{valid:!0}}}function o4(e){if(e.values){let t=Object.keys(e.values).map(t=>e.values[t].type).filter(e=>void 0!==e);if(!t.every(e=>e===t[0]))return{valid:!1,error:"All inputs must be of the same type"}}return{valid:!0}}function o5(){return Object.keys(o2)}e.s(["addNewInteractivityFlowGraphMapping",0,o1,"getAllSupportedNativeNodeTypes",0,o5,"getMappingForDeclaration",0,o0,"getMappingForFullOperationName",0,oJ],4712);var o8=e.i(84768);let o6={float:{length:1,flowGraphType:"number",elementType:"number"},bool:{length:1,flowGraphType:"boolean",elementType:"boolean"},float2:{length:2,flowGraphType:"Vector2",elementType:"number"},float3:{length:3,flowGraphType:"Vector3",elementType:"number"},float4:{length:4,flowGraphType:"Vector4",elementType:"number"},float4x4:{length:16,flowGraphType:"Matrix",elementType:"number"},float2x2:{length:4,flowGraphType:"Matrix2D",elementType:"number"},float3x3:{length:9,flowGraphType:"Matrix3D",elementType:"number"},int:{length:1,flowGraphType:"FlowGraphInteger",elementType:"number"}};class o9{constructor(e,t,s=60){this._interactivityGraph=e,this._gltf=t,this._animationTargetFps=s,this._types=[],this._mappings=[],this._staticVariables=[],this._events=[],this._internalEventsCounter=0,this._nodes=[],this._parseTypes(),this._parseDeclarations(),this._parseVariables(),this._parseEvents(),this._parseNodes()}get arrays(){return{types:this._types,mappings:this._mappings,staticVariables:this._staticVariables,events:this._events,nodes:this._nodes}}_parseTypes(){if(this._interactivityGraph.types)for(let e of this._interactivityGraph.types)this._types.push(o6[e.signature])}_parseDeclarations(){if(this._interactivityGraph.declarations)for(let e of this._interactivityGraph.declarations){let t=o0(e);if(!t)throw L.Logger.Error(["No mapping found for declaration",e]),Error("Error parsing declarations");this._mappings.push({flowGraphMapping:t,fullOperationName:e.extension?e.op+":"+e.extension:e.op})}}_parseVariables(){if(this._interactivityGraph.variables)for(let e of this._interactivityGraph.variables){let t=this._parseVariable(e);this._staticVariables.push(t)}}_parseVariable(e,t){let s=this._types[e.type];if(!s)throw L.Logger.Error(["No type found for variable",e]),Error("Error parsing variables");if(e.value&&e.value.length!==s.length)throw L.Logger.Error(["Invalid value length for variable",e,s]),Error("Error parsing variables");let n=e.value||[];if(!n.length)switch(s.flowGraphType){case"boolean":n.push(!1);break;case"FlowGraphInteger":n.push(0);break;case"number":n.push(NaN);break;case"Vector2":n.push(NaN,NaN);break;case"Vector3":n.push(NaN,NaN,NaN);break;case"Vector4":case"Matrix2D":case"Quaternion":n.fill(NaN,0,4);break;case"Matrix":n.fill(NaN,0,16);break;case"Matrix3D":n.fill(NaN,0,9)}return"number"===s.elementType&&"string"==typeof n[0]&&(n[0]=parseFloat(n[0])),{type:s.flowGraphType,value:t?t(n,this):n}}_parseEvents(){if(this._interactivityGraph.events)for(let e of this._interactivityGraph.events){let t={eventId:e.id||"internalEvent_"+this._internalEventsCounter++};e.values&&(t.eventData=Object.keys(e.values).map(t=>{let s=e.values?.[t];if(!s)throw L.Logger.Error(["No value found for event key",t]),Error("Error parsing events");let n=this._types[s.type];if(!n)throw L.Logger.Error(["No type found for event value",s]),Error("Error parsing events");let o=void 0!==s.value?this._parseVariable(s):void 0;return{id:t,type:n.flowGraphType,eventData:!0,value:o}})),this._events.push(t)}}_parseNodes(){if(this._interactivityGraph.nodes)for(let e of this._interactivityGraph.nodes){if("number"!=typeof e.declaration)throw L.Logger.Error(["No declaration found for node",e]),Error("Error parsing nodes");let t=this._mappings[e.declaration];if(!t)throw L.Logger.Error(["No mapping found for node",e]),Error("Error parsing nodes");if(t.flowGraphMapping.validation){let s=t.flowGraphMapping.validation(e,this._interactivityGraph,this._gltf);if(!s.valid)throw Error(`Error validating interactivity node ${this._interactivityGraph.declarations?.[e.declaration].op} - ${s.error}`)}let s=[];for(let n of t.flowGraphMapping.blocks){let o=this._getEmptyBlock(n,t.fullOperationName);this._parseNodeConfiguration(e,o,t.flowGraphMapping,n),s.push(o)}this._nodes.push({blocks:s,fullOperationName:t.fullOperationName})}}_getEmptyBlock(e,t){return{uniqueId:(0,o8.RandomGUID)(),className:e,dataInputs:[],dataOutputs:[],signalInputs:[],signalOutputs:[],config:{},type:t,metadata:{}}}_parseNodeConfiguration(e,t,s,n){let o=e.configuration;if(o)for(let e in o){let a=o[e];if(!a)throw Error("Error parsing node configuration");let i=s.configuration?.[e];if(i&&i.toBlock?i.toBlock===n:0===s.blocks.indexOf(n)){let s=i?.defaultValue;a?.value&&(s=a.value),i?.isArray||(1!==s.length&&L.Logger.Warn(`Invalid non-array value length: ${s.length}`),s=s[0]),i?.dataTransformer&&(s=i.dataTransformer(s,this)),void 0!==s&&(t.config[i?.name||e]={value:s})}}}_parseNodeConnections(e){for(let t=0;t<this._nodes.length;t++){let s=this._interactivityGraph.nodes?.[t];if(!s)throw L.Logger.Error(["No node found for interactivity node",this._nodes[t]]),Error("Error parsing node connections");let n=this._nodes[t],o=this._mappings[s.declaration];if(!o)throw L.Logger.Error(["No mapping found for node",s]),Error("Error parsing node connections");let a=s.flows||{};for(let e of Object.keys(a).sort()){let t=a[e],s=o.flowGraphMapping.outputs?.flows?.[e],i=s?.name||e,r=this._createNewSocketConnection(i,!0);(s&&s.toBlock&&n.blocks.find(e=>e.className===s.toBlock)||n.blocks[0]).signalOutputs.push(r);let l=t.node,h=this._nodes[l];if(!h)throw L.Logger.Error(["No node found for input node id",l]),Error("Error parsing node connections");let u=oJ(h.fullOperationName);if(!u)throw L.Logger.Error(["No mapping found for input node",h]),Error("Error parsing node connections");let c=u.inputs?.flows?.[t.socket||"in"],d=!1;if(!c)for(let e in u.inputs?.flows)e.startsWith("[")&&e.endsWith("]")&&(d=!0,c=u.inputs?.flows?.[e]);let p=c?d?c.name.replace("$1",t.socket||""):c.name:t.socket||"in",_=c&&c.toBlock&&h.blocks.find(e=>e.className===c.toBlock)||h.blocks[0],m=_.signalInputs.find(e=>e.name===p);m||(m=this._createNewSocketConnection(p),_.signalInputs.push(m)),m.connectedPointIds.push(r.uniqueId),r.connectedPointIds.push(m.uniqueId)}let i=s.values||{};for(let t of Object.keys(i)){let s=i[t],a=o.flowGraphMapping.inputs?.values?.[t],r=!1;if(!a)for(let e in o.flowGraphMapping.inputs?.values)e.startsWith("[")&&e.endsWith("]")&&(r=!0,a=o.flowGraphMapping.inputs?.values?.[e]);let l=a?r?a.name.replace("$1",t):a.name:t,h=this._createNewSocketConnection(l);if((a&&a.toBlock&&n.blocks.find(e=>e.className===a.toBlock)||n.blocks[0]).dataInputs.push(h),void 0!==s.value){let t=this._parseVariable(s,a&&a.dataTransformer);e._connectionValues[h.uniqueId]=t}else if(void 0!==s.node){let e=s.node,t=s.socket||"value",n=this._nodes[e];if(!n)throw L.Logger.Error(["No node found for output socket reference",s]),Error("Error parsing node connections");let o=oJ(n.fullOperationName);if(!o)throw L.Logger.Error(["No mapping found for output socket reference",s]),Error("Error parsing node connections");let a=o.outputs?.values?.[t],i=!1;if(!a)for(let e in o.outputs?.values)e.startsWith("[")&&e.endsWith("]")&&(i=!0,a=o.outputs?.values?.[e]);let r=a?i?a.name.replace("$1",t):a?.name:t,l=a&&a.toBlock&&n.blocks.find(e=>e.className===a.toBlock)||n.blocks[0],u=l.dataOutputs.find(e=>e.name===r);u||(u=this._createNewSocketConnection(r,!0),l.dataOutputs.push(u)),h.connectedPointIds.push(u.uniqueId),u.connectedPointIds.push(h.uniqueId)}else throw L.Logger.Error(["Invalid value for value connection",s]),Error("Error parsing node connections")}if(o.flowGraphMapping.interBlockConnectors)for(let e of o.flowGraphMapping.interBlockConnectors){let t=e.input,s=e.output,o=e.isVariable;this._connectFlowGraphNodes(t,s,n.blocks[e.inputBlockIndex],n.blocks[e.outputBlockIndex],o)}if(o.flowGraphMapping.extraProcessor){let t=this._interactivityGraph.declarations?.[s.declaration];if(!t)throw L.Logger.Error(["No declaration found for extra processor",s]),Error("Error parsing node connections");n.blocks=o.flowGraphMapping.extraProcessor(s,t,o.flowGraphMapping,this,n.blocks,e,this._gltf)}}}_createNewSocketConnection(e,t){return{uniqueId:(0,o8.RandomGUID)(),name:e,_connectionType:+!!t,connectedPointIds:[]}}_connectFlowGraphNodes(e,t,s,n,o){let a=o?s.dataInputs:s.signalInputs,i=o?n.dataOutputs:n.signalOutputs,r=a.find(t=>t.name===e)||this._createNewSocketConnection(e),l=i.find(e=>e.name===t)||this._createNewSocketConnection(t,!0);a.find(t=>t.name===e)||a.push(r),i.find(e=>e.name===t)||i.push(l),r.connectedPointIds.push(l.uniqueId),l.connectedPointIds.push(r.uniqueId)}getVariableName(e){return"staticVariable_"+e}serializeToFlowGraph(){let e={uniqueId:(0,o8.RandomGUID)(),_userVariables:{},_connectionValues:{}};this._parseNodeConnections(e);for(let t=0;t<this._staticVariables.length;t++){let s=this._staticVariables[t];e._userVariables[this.getVariableName(t)]=s}return{rightHanded:!0,allBlocks:this._nodes.reduce((e,t)=>e.concat(t.blocks),[]),executionContexts:[e]}}}e.s(["InteractivityGraphToFlowGraphParser",0,o9,"gltfTypeToBabylonType",0,o6],25360);let ae="KHR_interactivity";class at{constructor(e){this._loader=e,this.name=ae,this.enabled=this._loader.isExtensionUsed(ae),this._pathConverter=(0,t_.GetPathToObjectConverter)(this._loader.gltf),e._skipStartAnimationStep=!0;const t=e.babylonScene;t&&as(t)}dispose(){this._loader=null,delete this._pathConverter}async onReady(){if(!this._loader.babylonScene||!this._pathConverter)return;let e=this._loader.babylonScene,t=this._loader.gltf.extensions?.KHR_interactivity;if(!t)return;let s=new oz.FlowGraphCoordinator({scene:e});s.dispatchEventsSynchronously=!1;let n=t.graphs.map(e=>new o9(e,this._loader.gltf,this._loader.parent.targetFps).serializeToFlowGraph());await Promise.all(n.map(async e=>await oZ(e,{coordinator:s,pathConverter:this._pathConverter}))),s.start()}}function as(e){(0,t_.AddObjectAccessorToKey)("/extensions/KHR_interactivity/?/activeCamera/rotation",{get:()=>{if(!e.activeCamera)return new el.Quaternion(NaN,NaN,NaN,NaN);let t=el.Quaternion.FromRotationMatrix(e.activeCamera.getWorldMatrix()).normalize();return e.useRightHandedSystem||(t.w*=-1,t.x*=-1),t},type:"Quaternion",getTarget:()=>e.activeCamera}),(0,t_.AddObjectAccessorToKey)("/extensions/KHR_interactivity/?/activeCamera/position",{get:()=>{if(!e.activeCamera)return new el.Vector3(NaN,NaN,NaN);let t=e.activeCamera.getWorldMatrix().getTranslation();return e.useRightHandedSystem||(t.x*=-1),t},type:"Vector3",getTarget:()=>e.activeCamera}),(0,t_.AddObjectAccessorToKey)("/animations/{}/extensions/KHR_interactivity/isPlaying",{get:e=>e._babylonAnimationGroup?.isPlaying??!1,type:"boolean",getTarget:e=>e._babylonAnimationGroup}),(0,t_.AddObjectAccessorToKey)("/animations/{}/extensions/KHR_interactivity/minTime",{get:e=>(e._babylonAnimationGroup?.from??0)/60,type:"number",getTarget:e=>e._babylonAnimationGroup}),(0,t_.AddObjectAccessorToKey)("/animations/{}/extensions/KHR_interactivity/maxTime",{get:e=>(e._babylonAnimationGroup?.to??0)/60,type:"number",getTarget:e=>e._babylonAnimationGroup}),(0,t_.AddObjectAccessorToKey)("/animations/{}/extensions/KHR_interactivity/playhead",{get:e=>(e._babylonAnimationGroup?.getCurrentFrame()??0)/60,type:"number",getTarget:e=>e._babylonAnimationGroup}),(0,t_.AddObjectAccessorToKey)("/animations/{}/extensions/KHR_interactivity/virtualPlayhead",{get:e=>(e._babylonAnimationGroup?.getCurrentFrame()??0)/60,type:"number",getTarget:e=>e._babylonAnimationGroup})}g=async()=>(await e.A(44857)).FlowGraphGLTFDataProvider,oq[n=`${ae}/FlowGraphGLTFDataProvider`]=g,oW.FlowGraphGLTFDataProvider=n,tp(ae),td(ae,!0,e=>new at(e)),e.s(["KHR_interactivity",0,at,"_AddInteractivityObjectModel",0,as],800);let an="KHR_node_visibility";(0,t_.AddObjectAccessorToKey)("/nodes/{}/extensions/KHR_node_visibility/visible",{get:e=>{let t=e._babylonTransformNode;return!t||void 0===t.isVisible||t.isVisible},set:(e,t)=>{t._primitiveBabylonMeshes?.forEach(e=>{e.inheritVisibility=!0}),t._babylonTransformNode&&(t._babylonTransformNode.isVisible=e),t._primitiveBabylonMeshes?.forEach(t=>{t.isVisible=e})},getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"isVisible"],type:"boolean"});class ao{constructor(e){this.name=an,this._loader=e,this.enabled=e.isExtensionUsed(an)}onReady(){if(!this._loader)return;let e=this._loader.gltf.nodes;if(e)for(let t of e){let e=t._babylonTransformNode;e&&(e.inheritVisibility=!0,t.extensions&&t.extensions.KHR_node_visibility&&!1===t.extensions.KHR_node_visibility.visible&&(e.isVisible=!1))}}dispose(){delete this._loader}}tp(an),td(an,!0,e=>new ao(e)),e.s(["KHR_node_visibility",0,ao],29638);let aa="KHR_node_selectability";o1("event/onSelect",aa,{blocks:["FlowGraphMeshPickEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:e=>"pickedMesh_"+e}},outputs:{values:{selectedNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"},selectionPoint:{name:"pickedPoint"},selectionRayOrigin:{name:"pickOrigin"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"asset",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"pickedMesh",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor(e,t,s,n,o,a,i){let r=o[o.length-1];r.config=r.config||{},r.config.glTF=i;let l=e.configuration?.nodeIndex?.value?.[0];if(void 0===l||"number"!=typeof l)throw Error("nodeIndex not found in configuration");let h="pickedMesh_"+l;return o[1].config.variable=h,a._userVariables[h]={className:"Mesh",id:i?.nodes?.[l]._babylonTransformNode?.id,uniqueId:i?.nodes?.[l]._babylonTransformNode?.uniqueId},o}}),(0,t_.AddObjectAccessorToKey)("/nodes/{}/extensions/KHR_node_selectability/selectable",{get:e=>{let t=e._babylonTransformNode;return!t||void 0===t.isPickable||t.isPickable},set:(e,t)=>{t._primitiveBabylonMeshes?.forEach(t=>{t.isPickable=e})},getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"isPickable"],type:"boolean"});class ai{constructor(e){this.name=aa,this._loader=e,this.enabled=e.isExtensionUsed(aa)}async onReady(){this._loader.gltf.nodes?.forEach(e=>{e.extensions?.KHR_node_selectability&&e.extensions?.KHR_node_selectability.selectable===!1&&e._babylonTransformNode?.getChildMeshes().forEach(e=>{e.isPickable=!1})})}dispose(){this._loader=null}}tp(aa),td(aa,!0,e=>new ai(e)),e.s(["KHR_node_selectability",0,ai],19504);let ar="KHR_node_hoverability",al="targetMeshPointerOver_";o1("event/onHoverIn",ar,{blocks:["FlowGraphPointerOverEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:e=>al+e}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshUnderPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor(e,t,s,n,o,a,i){let r=o[o.length-1];r.config=r.config||{},r.config.glTF=i;let l=e.configuration?.nodeIndex?.value?.[0];if(void 0===l||"number"!=typeof l)throw Error("nodeIndex not found in configuration");let h=al+l;return o[1].config.variable=h,a._userVariables[h]={className:"Mesh",id:i?.nodes?.[l]._babylonTransformNode?.id,uniqueId:i?.nodes?.[l]._babylonTransformNode?.uniqueId},o}});let ah="targetMeshPointerOut_";o1("event/onHoverOut",ar,{blocks:["FlowGraphPointerOutEventBlock","FlowGraphGetVariableBlock","FlowGraphIndexOfBlock","KHR_interactivity/FlowGraphGLTFDataProvider"],configuration:{stopPropagation:{name:"stopPropagation"},nodeIndex:{name:"variable",toBlock:"FlowGraphGetVariableBlock",dataTransformer:e=>ah+e}},outputs:{values:{hoverNodeIndex:{name:"index",toBlock:"FlowGraphIndexOfBlock"},controllerIndex:{name:"pointerId"}},flows:{out:{name:"done"}}},interBlockConnectors:[{input:"targetMesh",output:"value",inputBlockIndex:0,outputBlockIndex:1,isVariable:!0},{input:"array",output:"nodes",inputBlockIndex:2,outputBlockIndex:3,isVariable:!0},{input:"object",output:"meshOutOfPointer",inputBlockIndex:2,outputBlockIndex:0,isVariable:!0}],extraProcessor(e,t,s,n,o,a,i){let r=o[o.length-1];r.config=r.config||{},r.config.glTF=i;let l=e.configuration?.nodeIndex?.value?.[0];if(void 0===l||"number"!=typeof l)throw Error("nodeIndex not found in configuration");let h=ah+l;return o[1].config.variable=h,a._userVariables[h]={className:"Mesh",id:i?.nodes?.[l]._babylonTransformNode?.id,uniqueId:i?.nodes?.[l]._babylonTransformNode?.uniqueId},o}}),(0,t_.AddObjectAccessorToKey)("/nodes/{}/extensions/KHR_node_hoverability/hoverable",{get:e=>{let t=e._babylonTransformNode;return!t||void 0===t.pointerOverDisableMeshTesting||t.pointerOverDisableMeshTesting},set:(e,t)=>{t._primitiveBabylonMeshes?.forEach(t=>{t.pointerOverDisableMeshTesting=!e})},getTarget:e=>e._babylonTransformNode,getPropertyName:[()=>"pointerOverDisableMeshTesting"],type:"boolean"});class au{constructor(e){this.name=ar,this._loader=e,this.enabled=e.isExtensionUsed(ar)}async onReady(){this._loader.gltf.nodes?.forEach(e=>{e.extensions?.KHR_node_hoverability&&e.extensions?.KHR_node_hoverability.hoverable===!1&&e._babylonTransformNode?.getChildMeshes().forEach(e=>{e.pointerOverDisableMeshTesting=!0})})}dispose(){this._loader=null}}tp(ar),td(ar,!0,e=>new au(e)),e.s(["KHR_node_hoverability",0,au],89667);let ac="ExtrasAsMetadata";class ad{_assignExtras(e,t){if(t.extras&&Object.keys(t.extras).length>0){let s=e.metadata=e.metadata||{};(s.gltf=s.gltf||{}).extras=t.extras}}constructor(e){this.name=ac,this.enabled=!0,this._loader=e}dispose(){this._loader=null}loadNodeAsync(e,t,s){return this._loader.loadNodeAsync(e,t,e=>{this._assignExtras(e,t),s(e)})}loadCameraAsync(e,t,s){return this._loader.loadCameraAsync(e,t,e=>{this._assignExtras(e,t),s(e)})}createMaterial(e,t,s){let n=this._loader.createMaterial(e,t,s);return this._assignExtras(n,t),n}loadAnimationAsync(e,t){return this._loader.loadAnimationAsync(e,t).then(e=>(this._assignExtras(e,t),e))}}tp(ac),td(ac,!1,e=>new ad(e)),e.s(["ExtrasAsMetadata",0,ad],11593);var ap=e.i(4577);e.s([],82449),e.s([],72049),e.s([],96116),e.i(96116),e.i(32677),e.s(["ArrayItem",0,ty,"GLTFFileLoader",0,er,"GLTFLoader",0,tT,"LoadBoundingInfoFromPositionAccessor",0,tb],59758),e.i(59758),e.i(75215),e.i(79511),e.i(70680),e.i(72049),e.i(27684),e.i(6934),e.i(58348),e.i(79487),e.i(45462),e.i(80866),e.i(43060),e.i(57050),e.i(70136),e.i(93230),e.i(31375),e.i(74303),e.i(13995),e.i(95671),e.i(7903),e.i(37069),e.i(13093),e.i(43487),e.i(70189),e.i(80888),e.i(65540),e.i(88677),e.i(52311),e.i(2596),e.i(56007),e.i(67797),e.i(63441),e.i(90760),e.i(49688),e.i(51844),e.i(24684),e.i(35597),e.i(53287),e.i(19458),e.i(95913),e.i(63803),e.i(71509),e.i(800),e.i(29638),e.i(19504),e.i(89667),e.i(11593),e.i(82449),e.i(4712),e.i(25360),e.s(["FlowGraphGLTFDataProvider",()=>ap.FlowGraphGLTFDataProvider,"InteractivityGraphToFlowGraphParser",0,o9,"addNewInteractivityFlowGraphMapping",0,o1,"getAllSupportedNativeNodeTypes",0,o5,"getMappingForDeclaration",0,o0,"getMappingForFullOperationName",0,oJ,"gltfTypeToBabylonType",0,o6],73414),e.i(73414),e.s(["AddObjectAccessorToKey",()=>t_.AddObjectAccessorToKey,"EXT_lights_area",0,t8,"EXT_lights_ies",0,t$,"EXT_lights_image_based",0,tN,"EXT_mesh_gpu_instancing",0,tB,"EXT_meshopt_compression",0,tG,"EXT_texture_avif",0,tK,"EXT_texture_webp",0,tV,"ExtrasAsMetadata",0,ad,"FlowGraphGLTFDataProvider",()=>ap.FlowGraphGLTFDataProvider,"GetMappingForKey",()=>t_.GetMappingForKey,"GetPathToObjectConverter",()=>t_.GetPathToObjectConverter,"InteractivityGraphToFlowGraphParser",0,o9,"KHR_animation_pointer",0,nd,"KHR_draco_mesh_compression",0,tX,"KHR_interactivity",0,at,"KHR_lights",0,t0,"KHR_materials_anisotropy",0,sh,"KHR_materials_clearcoat",0,sn,"KHR_materials_coat",0,sa,"KHR_materials_diffuse_roughness",0,sP,"KHR_materials_diffuse_transmission",0,sS,"KHR_materials_dispersion",0,sk,"KHR_materials_emissive_strength",0,sc,"KHR_materials_fuzz",0,sm,"KHR_materials_ior",0,sb,"KHR_materials_iridescence",0,sr,"KHR_materials_pbrSpecularGlossiness",0,t9,"KHR_materials_sheen",0,sp,"KHR_materials_specular",0,sg,"KHR_materials_transmission",0,sC,"KHR_materials_unlit",0,st,"KHR_materials_variants",0,sA,"KHR_materials_volume",0,sO,"KHR_materials_volume_scatter",0,sI,"KHR_mesh_quantization",0,sG,"KHR_node_hoverability",0,au,"KHR_node_selectability",0,ai,"KHR_node_visibility",0,ao,"KHR_texture_basisu",0,sV,"KHR_texture_transform",0,sK,"KHR_xmp_json_ld",0,s$,"MSFT_audio_emitter",0,oG,"MSFT_lod",0,oV,"MSFT_minecraftMesh",0,oK,"MSFT_sRGBFactors",0,o$,"SetInterpolationForKey",()=>t_.SetInterpolationForKey,"TransmissionHelper",0,sw,"_AddInteractivityObjectModel",0,as,"addNewInteractivityFlowGraphMapping",0,o1,"ensureTransmissionHelper",0,sv,"getAllSupportedNativeNodeTypes",0,o5,"getMappingForDeclaration",0,o0,"getMappingForFullOperationName",0,oJ,"gltfTypeToBabylonType",0,o6],32713),e.i(32713),e.s(["AddObjectAccessorToKey",()=>t_.AddObjectAccessorToKey,"AnimationPropertyInfo",()=>tA.AnimationPropertyInfo,"ArrayItem",0,ty,"EXT_lights_area",0,t8,"EXT_lights_ies",0,t$,"EXT_lights_image_based",0,tN,"EXT_mesh_gpu_instancing",0,tB,"EXT_meshopt_compression",0,tG,"EXT_texture_avif",0,tK,"EXT_texture_webp",0,tV,"ExtrasAsMetadata",0,ad,"FlowGraphGLTFDataProvider",()=>ap.FlowGraphGLTFDataProvider,"GLTFFileLoader",0,er,"GLTFLoader",0,tT,"GetMappingForKey",()=>t_.GetMappingForKey,"GetPathToObjectConverter",()=>t_.GetPathToObjectConverter,"InteractivityGraphToFlowGraphParser",0,o9,"KHR_animation_pointer",0,nd,"KHR_draco_mesh_compression",0,tX,"KHR_interactivity",0,at,"KHR_lights",0,t0,"KHR_materials_anisotropy",0,sh,"KHR_materials_clearcoat",0,sn,"KHR_materials_coat",0,sa,"KHR_materials_diffuse_roughness",0,sP,"KHR_materials_diffuse_transmission",0,sS,"KHR_materials_dispersion",0,sk,"KHR_materials_emissive_strength",0,sc,"KHR_materials_fuzz",0,sm,"KHR_materials_ior",0,sb,"KHR_materials_iridescence",0,sr,"KHR_materials_pbrSpecularGlossiness",0,t9,"KHR_materials_sheen",0,sp,"KHR_materials_specular",0,sg,"KHR_materials_transmission",0,sC,"KHR_materials_unlit",0,st,"KHR_materials_variants",0,sA,"KHR_materials_volume",0,sO,"KHR_materials_volume_scatter",0,sI,"KHR_mesh_quantization",0,sG,"KHR_node_hoverability",0,au,"KHR_node_selectability",0,ai,"KHR_node_visibility",0,ao,"KHR_texture_basisu",0,sV,"KHR_texture_transform",0,sK,"KHR_xmp_json_ld",0,s$,"LoadBoundingInfoFromPositionAccessor",0,tb,"MSFT_audio_emitter",0,oG,"MSFT_lod",0,oV,"MSFT_minecraftMesh",0,oK,"MSFT_sRGBFactors",0,o$,"OpenPBRMaterialLoadingAdapter",()=>tx.OpenPBRMaterialLoadingAdapter,"PBRMaterialLoadingAdapter",()=>tw.PBRMaterialLoadingAdapter,"SetInterpolationForKey",()=>t_.SetInterpolationForKey,"TransformNodeAnimationPropertyInfo",()=>tA.TransformNodeAnimationPropertyInfo,"TransmissionHelper",0,sw,"WeightAnimationPropertyInfo",()=>tA.WeightAnimationPropertyInfo,"_AddInteractivityObjectModel",0,as,"addNewInteractivityFlowGraphMapping",0,o1,"ensureTransmissionHelper",0,sv,"getAllSupportedNativeNodeTypes",0,o5,"getMappingForDeclaration",0,o0,"getMappingForFullOperationName",0,oJ,"getQuaternion",()=>tA.getQuaternion,"getVector3",()=>tA.getVector3,"getWeights",()=>tA.getWeights,"gltfTypeToBabylonType",0,o6,"registerGLTFExtension",0,td,"registeredGLTFExtensions",0,tc,"unregisterGLTFExtension",0,tp],83732);var a_=e.i(83732);e.s([],18948),e.i(18948),e.i(77148),e.i(87351),e.s(["GLTF1",0,ts,"GLTF2",0,a_,"GLTFFileLoader",0,er,"GLTFLoaderAnimationStartMode",0,b,"GLTFLoaderCoordinateSystemMode",0,y,"GLTFLoaderDefaultOptions",0,ea,"GLTFLoaderState",0,T,"GLTFValidation",0,Z],84942)}]);