@uptimizr/dashboard 0.4.7 → 0.4.8

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 (386) hide show
  1. package/out/404.html +1 -1
  2. package/out/__next.__PAGE__.txt +9 -9
  3. package/out/__next._full.txt +10 -10
  4. package/out/__next._tree.txt +1 -1
  5. package/out/_next/static/chunks/{209sxygecny37.js → 0-6mdj5wxsfid.js} +1 -1
  6. package/out/_next/static/chunks/{0ybs1u66q26su.js → 0-qthfqvm1jyj.js} +1 -1
  7. package/out/_next/static/chunks/01viyuclp2gm9.js +1 -0
  8. package/out/_next/static/chunks/02aym4t2hgo5c.js +1 -0
  9. package/out/_next/static/chunks/02ic9b5ejugow.js +1 -0
  10. package/out/_next/static/chunks/03p70i4c7qt0v.js +1 -0
  11. package/out/_next/static/chunks/{33i36o_l69sm5.js → 03pjr-ivdicng.js} +1 -1
  12. package/out/_next/static/chunks/041a06-lxipy5.js +1 -0
  13. package/out/_next/static/chunks/{1zm6eo861i3c8.js → 06dzkwetqis-5.js} +1 -1
  14. package/out/_next/static/chunks/{3ipx7xbxchsq9.js → 06kvanz5-fo52.js} +1 -1
  15. package/out/_next/static/chunks/07y8ke_iy59dn.js +1 -0
  16. package/out/_next/static/chunks/09jukc-4jl735.js +1 -0
  17. package/out/_next/static/chunks/{35sne1llxnc-m.js → 09khmdgez3t0a.js} +18 -18
  18. package/out/_next/static/chunks/{02qk_wmkf9at-.js → 0_dca4876jshu.js} +38 -38
  19. package/out/_next/static/chunks/0axcgnl5qzr6e.js +1 -0
  20. package/out/_next/static/chunks/0ay4fjomijs3n.js +1 -0
  21. package/out/_next/static/chunks/0c7fy79wlccat.js +1 -0
  22. package/out/_next/static/chunks/0cqe4-l3imct3.js +1 -0
  23. package/out/_next/static/chunks/0cssvelju788j.js +1 -0
  24. package/out/_next/static/chunks/{0-_j1khfoib6l.js → 0ctain5xq2wsd.js} +12 -12
  25. package/out/_next/static/chunks/{22yqh0zlo_vwr.js → 0df-dr3otg_4w.js} +1 -1
  26. package/out/_next/static/chunks/{26y9sv8_-ykxf.js → 0endw997j7ao9.js} +1 -1
  27. package/out/_next/static/chunks/0ev_pbit1v_qg.js +1 -0
  28. package/out/_next/static/chunks/0eyw9oiwipywb.js +1 -0
  29. package/out/_next/static/chunks/0fkzbuo1tex4u.js +1 -0
  30. package/out/_next/static/chunks/0govas0u0t4w3.js +1 -0
  31. package/out/_next/static/chunks/{0grasqqf5dw7r.js → 0guzhnususp3-.js} +2 -2
  32. package/out/_next/static/chunks/0h7bq_ysu17q7.js +3 -0
  33. package/out/_next/static/chunks/0hneh_3xzlo28.js +1 -0
  34. package/out/_next/static/chunks/0iaqwme19z_0s.js +1 -0
  35. package/out/_next/static/chunks/0ibmar10xndpn.js +1 -0
  36. package/out/_next/static/chunks/0ii8mqoteppgh.js +11 -0
  37. package/out/_next/static/chunks/{1uh9zgsy69g92.js → 0ip6v64di_l6x.js} +1 -1
  38. package/out/_next/static/chunks/{267prao6fyt22.js → 0ixymgjgz3grn.js} +10 -10
  39. package/out/_next/static/chunks/0kuah8g7lt5ox.js +1 -0
  40. package/out/_next/static/chunks/0l3k4j19vxm17.js +1 -0
  41. package/out/_next/static/chunks/0l6hg0ohwh9-m.js +1 -0
  42. package/out/_next/static/chunks/0m4um4ylhlfan.js +1 -0
  43. package/out/_next/static/chunks/0mj837d4h0ddq.js +1 -0
  44. package/out/_next/static/chunks/0nyn-f4905o91.js +1 -0
  45. package/out/_next/static/chunks/0og6i9rsgkuif.js +1 -0
  46. package/out/_next/static/chunks/0os1x-fxzgnxs.js +1 -0
  47. package/out/_next/static/chunks/0otnra7mp0hog.js +1 -0
  48. package/out/_next/static/chunks/{1gttu-n9am66k.js → 0oyf2xzv8ofkk.js} +21 -21
  49. package/out/_next/static/chunks/0qvsy3gcqjm12.js +1 -0
  50. package/out/_next/static/chunks/{1qg1l7t00nyib.js → 0rl4ddh2vgxyl.js} +14 -14
  51. package/out/_next/static/chunks/0rwpttmsmqvn_.js +1 -0
  52. package/out/_next/static/chunks/0so3wjp9ch93y.js +1 -0
  53. package/out/_next/static/chunks/{43fp64xnfy646.js → 0te4g160_rb5d.js} +1 -1
  54. package/out/_next/static/chunks/0uby-zvu799ef.js +1 -0
  55. package/out/_next/static/chunks/{3h6akt2uu05ku.js → 0uvn0op2mlr2u.js} +12 -12
  56. package/out/_next/static/chunks/0vwj4hxjm0igv.js +1 -0
  57. package/out/_next/static/chunks/{1m9zc5gm-327d.js → 0w7c30w07uct2.js} +10 -10
  58. package/out/_next/static/chunks/0wm38z3u2133a.js +1 -0
  59. package/out/_next/static/chunks/0y7yk5al7_p8q.js +4 -0
  60. package/out/_next/static/chunks/0ycr0gi6fn6bt.js +1 -0
  61. package/out/_next/static/chunks/0ywvahq9t0tki.js +1 -0
  62. package/out/_next/static/chunks/0zh6nslagkby-.js +1 -0
  63. package/out/_next/static/chunks/{3vbamaoiuk9yj.js → 0zo8xa0nej3ex.js} +1 -1
  64. package/out/_next/static/chunks/{2of8q0kaeqpf0.js → 0zsir95gpf3xw.js} +1 -1
  65. package/out/_next/static/chunks/0zu6ryyj0ig-j.js +3 -0
  66. package/out/_next/static/chunks/{2c721vfva711t.js → 1-jv8k10q_1uw.js} +1 -1
  67. package/out/_next/static/chunks/1-s5ioie9a94e.js +1 -0
  68. package/out/_next/static/chunks/{13zcn4lv0qj76.js → 1-yos1h0qws5e.js} +11 -11
  69. package/out/_next/static/chunks/10o7brc3x027r.js +1 -0
  70. package/out/_next/static/chunks/{060iult6f68_e.js → 10pae4gb9i929.js} +29 -29
  71. package/out/_next/static/chunks/13p93itm8a3ym.js +1 -0
  72. package/out/_next/static/chunks/{0btmk0wmekl02.js → 147s8i_lktp4_.js} +2 -2
  73. package/out/_next/static/chunks/{3njwfothmmg7u.js → 14tgo5xt_3j4w.js} +1 -1
  74. package/out/_next/static/chunks/1699hx-vlak0n.js +22 -0
  75. package/out/_next/static/chunks/16d6n9e77rqti.js +1 -0
  76. package/out/_next/static/chunks/{3zs7l4362msjd.js → 16f3d5dv83rsr.js} +1 -1
  77. package/out/_next/static/chunks/16i_tpwn_cmr-.js +1 -0
  78. package/out/_next/static/chunks/{1by60_b14x-3o.js → 16rfr165nbha0.js} +1 -1
  79. package/out/_next/static/chunks/{0zqgq0lwtz9tn.js → 16sl51pvzo4tf.js} +1 -1
  80. package/out/_next/static/chunks/{2n-pveub8b_5t.js → 1760s-32qpwgg.js} +1 -1
  81. package/out/_next/static/chunks/{1u8snlm6a7uhi.js → 18kq07c5xy_4g.js} +4 -4
  82. package/out/_next/static/chunks/{1rcdimhu0qhlu.js → 190tbzt861ao3.js} +39 -39
  83. package/out/_next/static/chunks/19bhv6cupnnyj.js +1 -0
  84. package/out/_next/static/chunks/1_14pn2wwebxy.js +1 -0
  85. package/out/_next/static/chunks/{3huu0tqmxwowu.js → 1_kikmeubh0wq.js} +30 -30
  86. package/out/_next/static/chunks/1ay3z6agelsvz.js +1 -0
  87. package/out/_next/static/chunks/1b-fi3bfmpe31.js +1 -0
  88. package/out/_next/static/chunks/1bae3tqv53x9_.js +1 -0
  89. package/out/_next/static/chunks/1bf421g4peccx.js +2 -0
  90. package/out/_next/static/chunks/1bfony5qsc5tp.js +1 -0
  91. package/out/_next/static/chunks/{1e8_jl2cxd3rp.js → 1ddt0ot7kl8vq.js} +40 -40
  92. package/out/_next/static/chunks/1emz2vjkgck4z.js +1 -0
  93. package/out/_next/static/chunks/1eogzzw8i1wsg.js +1 -0
  94. package/out/_next/static/chunks/{2apihn9ra2ufp.js → 1g9p2h1-31q8o.js} +1 -1
  95. package/out/_next/static/chunks/1gcz1k1v1woca.js +1 -0
  96. package/out/_next/static/chunks/{3v-0c2aj6c0on.js → 1h8lyicgqhpxa.js} +1 -1
  97. package/out/_next/static/chunks/{3772oce1n3t_g.js → 1hot663akaepl.js} +1 -1
  98. package/out/_next/static/chunks/1i7pgl3ks5ye0.js +1 -0
  99. package/out/_next/static/chunks/{2sys9nj8lo3uk.js → 1i8sk_qgpdjhs.js} +1 -1
  100. package/out/_next/static/chunks/{30bhz7czzs4mf.js → 1kk3ct7pkpf3b.js} +1 -1
  101. package/out/_next/static/chunks/{33hp-khdfohdq.js → 1kq9o8del67le.js} +1 -1
  102. package/out/_next/static/chunks/{3d-i_skta_wes.js → 1l7tzyx2mumlq.js} +1 -1
  103. package/out/_next/static/chunks/1n_uwed9o--go.js +1 -0
  104. package/out/_next/static/chunks/1o351eldttogn.js +1 -0
  105. package/out/_next/static/chunks/1ogs4_aj84bfn.js +1 -0
  106. package/out/_next/static/chunks/{0sw-8gxbg4x0l.js → 1p206txlluipi.js} +18 -18
  107. package/out/_next/static/chunks/1p2bt1w845v6c.js +1 -0
  108. package/out/_next/static/chunks/1p3rgz4aef1gk.js +1 -0
  109. package/out/_next/static/chunks/{41b5gpyqbj58m.js → 1qcgdx9yl0gfx.js} +4 -4
  110. package/out/_next/static/chunks/1ql3mm2w5r-m8.js +1 -0
  111. package/out/_next/static/chunks/1qvcyuyshi3ll.js +53 -0
  112. package/out/_next/static/chunks/1r0yyg5a_0knc.js +1 -0
  113. package/out/_next/static/chunks/{15o4_2t-l3rj5.js → 1sa6qiidtcyk2.js} +1 -1
  114. package/out/_next/static/chunks/1t-9vrdrsi8le.js +1 -0
  115. package/out/_next/static/chunks/{1rlfg62jxqj3z.js → 1t97zo0tlpbnz.js} +1 -1
  116. package/out/_next/static/chunks/1te2tinzqnwck.js +1 -0
  117. package/out/_next/static/chunks/{3sa_hlx3konc7.js → 1trt-m2nrck0v.js} +1 -1
  118. package/out/_next/static/chunks/1ty9jpwr3o_st.js +1 -0
  119. package/out/_next/static/chunks/1u6w6veke8rze.js +1 -0
  120. package/out/_next/static/chunks/1u900urmrbv73.js +1 -0
  121. package/out/_next/static/chunks/{3_dgblylldcgb.js → 1vz2gd8k74lpi.js} +1 -1
  122. package/out/_next/static/chunks/1wkpl9bfb0wn7.js +1 -0
  123. package/out/_next/static/chunks/1wrly9a9c3teq.js +1 -0
  124. package/out/_next/static/chunks/1x0m05155yy4e.js +1 -0
  125. package/out/_next/static/chunks/{3xl-op0hwxytg.js → 1xf1wfow43ekc.js} +5 -5
  126. package/out/_next/static/chunks/1y10o40v9odam.js +1 -0
  127. package/out/_next/static/chunks/{2s6kpclh6ie7o.js → 1y_zykt3fpen4.js} +29 -29
  128. package/out/_next/static/chunks/1ye6xtbm16pg4.js +1 -0
  129. package/out/_next/static/chunks/{1t5oynmttpfsw.js → 1z6_57k5h31u7.js} +1 -1
  130. package/out/_next/static/chunks/{0lep3_bqwfuin.js → 1zboqft0h6mop.js} +1 -1
  131. package/out/_next/static/chunks/{43v4y2gu5z9_h.js → 1zr3c351x0ri5.js} +1 -1
  132. package/out/_next/static/chunks/2-5p2lcedvrli.js +1 -0
  133. package/out/_next/static/chunks/206hxrq60f1_e.js +1 -0
  134. package/out/_next/static/chunks/20r05k3-studj.js +1 -0
  135. package/out/_next/static/chunks/22gs24kj2du56.js +1 -0
  136. package/out/_next/static/chunks/22x5pd1gyp7sf.js +1 -0
  137. package/out/_next/static/chunks/{2a07so920b6aa.js → 22z-2t_yp1jzs.js} +1 -1
  138. package/out/_next/static/chunks/{30n4y_uu8chbh.js → 23hmfdw6z5zfy.js} +30 -30
  139. package/out/_next/static/chunks/23y1krqnc-8sm.js +1 -0
  140. package/out/_next/static/chunks/{3f8qelpscqfym.js → 24tbkj1qkux88.js} +2 -2
  141. package/out/_next/static/chunks/{2ao-3jzz7yw3p.js → 26cmri51v7497.js} +11 -11
  142. package/out/_next/static/chunks/27jalbk9zu-2b.js +1 -0
  143. package/out/_next/static/chunks/285d2s9096ryc.js +1 -0
  144. package/out/_next/static/chunks/296ykep2nvppv.js +1 -0
  145. package/out/_next/static/chunks/29nehg5cal-ug.js +1 -0
  146. package/out/_next/static/chunks/2_a56_k3x7to6.js +1 -0
  147. package/out/_next/static/chunks/2a-0l6eb1blh3.js +4 -0
  148. package/out/_next/static/chunks/{3qn6r8-0u6dij.js → 2a31-txop1jzg.js} +38 -38
  149. package/out/_next/static/chunks/2bse5vll1o-x0.js +1 -0
  150. package/out/_next/static/chunks/2ct40spu9wfj7.js +1 -0
  151. package/out/_next/static/chunks/{2kok6zedeeltw.js → 2ept01b7t-e03.js} +1 -1
  152. package/out/_next/static/chunks/{3w59kt5ztyvoq.js → 2ey5dqelco_g5.js} +1 -1
  153. package/out/_next/static/chunks/2fd_009hw7y0m.js +1 -0
  154. package/out/_next/static/chunks/{0fd-0i1yt23kz.js → 2ftz9kaxrsgxh.js} +1 -1
  155. package/out/_next/static/chunks/2gefdnozflr7p.js +1 -0
  156. package/out/_next/static/chunks/{2izok2otbk8-2.js → 2gs-u1n5uv7iz.js} +37 -37
  157. package/out/_next/static/chunks/{2r96kyeehsji9.js → 2hizqql79u-54.js} +1 -1
  158. package/out/_next/static/chunks/2iqf2dpdg_vfl.js +1 -0
  159. package/out/_next/static/chunks/2j7z127s_ycjd.js +1 -0
  160. package/out/_next/static/chunks/2kax7uslfxdnx.js +31 -0
  161. package/out/_next/static/chunks/2lh_w9rzy3vek.js +1 -0
  162. package/out/_next/static/chunks/{0rracz73p38mo.js → 2ln1na26qwp-3.js} +9 -9
  163. package/out/_next/static/chunks/2n08l1q5o_27e.js +1 -0
  164. package/out/_next/static/chunks/2n7268gyd9z-6.js +1 -0
  165. package/out/_next/static/chunks/2nq9cgjmtqwvp.js +1 -0
  166. package/out/_next/static/chunks/{005bbq_px7lke.js → 2oj8qc_pv14nk.js} +2 -2
  167. package/out/_next/static/chunks/2q24e72-olbe8.js +1 -0
  168. package/out/_next/static/chunks/2qc4hscs26cro.js +1 -0
  169. package/out/_next/static/chunks/{0gf-ztg86zd80.js → 2qe46redkqhfg.js} +1 -1
  170. package/out/_next/static/chunks/2qmfe0mqw150h.js +1 -0
  171. package/out/_next/static/chunks/2qtc0nbl_521e.js +1 -0
  172. package/out/_next/static/chunks/{0e1jfrmioeuws.js → 2rofu6gu1xzuq.js} +1 -1
  173. package/out/_next/static/chunks/2tdi94rkq739i.js +1 -0
  174. package/out/_next/static/chunks/2u_2sacqa9xa7.js +1 -0
  175. package/out/_next/static/chunks/2ujqz6088shm5.js +1 -0
  176. package/out/_next/static/chunks/{1l_3oidssbhns.js → 2urh9qafp3fiw.js} +17 -17
  177. package/out/_next/static/chunks/{05v-nubi896jg.js → 2v06n4z8wsmn9.js} +1 -1
  178. package/out/_next/static/chunks/2vp-5skbk1nfu.js +1 -0
  179. package/out/_next/static/chunks/2vu973j_n6cpx.js +1 -0
  180. package/out/_next/static/chunks/{37cnbm5ft1mqf.js → 2wwra56rehfcj.js} +1 -1
  181. package/out/_next/static/chunks/2xpwr97h2asal.js +1 -0
  182. package/out/_next/static/chunks/3000-0b8n9t_2.js +1 -0
  183. package/out/_next/static/chunks/30t3203d7p2da.js +1 -0
  184. package/out/_next/static/chunks/31kto7-dxkt3z.js +1 -0
  185. package/out/_next/static/chunks/{2lsvk7xcfkarc.js → 32oflcl79d8mu.js} +1 -1
  186. package/out/_next/static/chunks/32ovg81ae0l03.js +1 -0
  187. package/out/_next/static/chunks/{0z9erbl3llr_b.js → 331kthnvoma7n.js} +16 -16
  188. package/out/_next/static/chunks/{0q75860p8u_ii.js → 337kn1mn34rc6.js} +1 -1
  189. package/out/_next/static/chunks/{2tc3e-iqv71y_.js → 33xug8kf0-a1o.js} +1 -1
  190. package/out/_next/static/chunks/{1-ogak5u00kwa.js → 34dcb7_flbrvo.js} +1 -1
  191. package/out/_next/static/chunks/34zotyeqrz_nq.js +1 -0
  192. package/out/_next/static/chunks/351wsmi75l8db.js +1 -0
  193. package/out/_next/static/chunks/{15jlgfcaeaki9.js → 36yv-ialtpx98.js} +1 -1
  194. package/out/_next/static/chunks/37hwasxtee5e0.js +1 -0
  195. package/out/_next/static/chunks/37t0iclgxes05.js +1 -0
  196. package/out/_next/static/chunks/{1q4lkgxfnqnew.js → 37xnvnx1jxfaf.js} +1 -1
  197. package/out/_next/static/chunks/{2z_iab7ozohhq.js → 38w74ixqt-9co.js} +16 -16
  198. package/out/_next/static/chunks/{2h249uvhh2sij.js → 39t2x_9zd2rst.js} +10 -10
  199. package/out/_next/static/chunks/{0thw099xk3_0p.js → 39v73timmzwny.js} +2 -2
  200. package/out/_next/static/chunks/{2n3xu_wbvtj7h.js → 3_xqc3658d8sw.js} +12 -12
  201. package/out/_next/static/chunks/3ba8eudvlczwe.js +1 -0
  202. package/out/_next/static/chunks/{2q6l-xdqzgmpf.js → 3buezhxqc8n6n.js} +1 -1
  203. package/out/_next/static/chunks/{1zt1xxovnjhkm.js → 3c5iwwj-fhbue.js} +1 -1
  204. package/out/_next/static/chunks/{2urx6fow8c8c9.js → 3d8ot2tw6yqfq.js} +12 -12
  205. package/out/_next/static/chunks/3dc057ffe7ij-.js +1 -0
  206. package/out/_next/static/chunks/3djnlzwj9869o.js +1 -0
  207. package/out/_next/static/chunks/{2y8i7_nxm4r05.js → 3fuqxjjf8o1v9.js} +5 -5
  208. package/out/_next/static/chunks/{0z004fn14pbcu.js → 3gt6rzg9qw-an.js} +1 -1
  209. package/out/_next/static/chunks/{1tgj55b305g4h.js → 3h_05w5j8x538.js} +1 -1
  210. package/out/_next/static/chunks/{3j9xvdz55bi4p.js → 3hkhd1_k8xohv.js} +33 -33
  211. package/out/_next/static/chunks/{42ymanq326mo7.js → 3ijcc5tfisfnj.js} +1 -1
  212. package/out/_next/static/chunks/3j0dbpd9zop3p.js +1 -0
  213. package/out/_next/static/chunks/{1zkd8v-qka--j.js → 3ju83xk-ca7ma.js} +21 -21
  214. package/out/_next/static/chunks/3jxhl4apmhbm1.js +13 -0
  215. package/out/_next/static/chunks/{302qk2fjdrthp.js → 3la99oz_0p0r6.js} +5 -5
  216. package/out/_next/static/chunks/3n1b34fd5fdrh.js +1 -0
  217. package/out/_next/static/chunks/{2j120dkh7q3uf.js → 3nq_hq4x3rn3r.js} +1 -1
  218. package/out/_next/static/chunks/3pgb1kkqrdl9t.js +1 -0
  219. package/out/_next/static/chunks/3pik_-jj-zkfl.js +1 -0
  220. package/out/_next/static/chunks/{2w99knknr5i8c.js → 3q38kdbzd2nbd.js} +1 -1
  221. package/out/_next/static/chunks/3q5zl4ks17au2.js +1 -0
  222. package/out/_next/static/chunks/{2uo6vm7mfgrbf.js → 3qr10445lte-n.js} +1 -1
  223. package/out/_next/static/chunks/3r-8bnguvxsyo.js +1 -0
  224. package/out/_next/static/chunks/3sg56j8boe-3o.js +1 -0
  225. package/out/_next/static/chunks/{2q8yg63br2jc9.js → 3u7zj1-jdg781.js} +1 -1
  226. package/out/_next/static/chunks/{32_c4mbb6j1l6.js → 3wj5dmf6cywz8.js} +22 -22
  227. package/out/_next/static/chunks/{3oqxl46ukaojj.js → 3wr_oijfsq8lr.js} +11 -11
  228. package/out/_next/static/chunks/3xu0dh1ikzwj2.js +1 -0
  229. package/out/_next/static/chunks/3y5tpixt23-fl.js +1 -0
  230. package/out/_next/static/chunks/40gjf-_jt8upu.js +5 -0
  231. package/out/_next/static/chunks/41f12o_5lf-i9.js +1 -0
  232. package/out/_next/static/chunks/42ma8lqduohlc.js +1 -0
  233. package/out/_next/static/chunks/{0ai0zgbgjqb92.js → 43usshq2nc125.js} +1 -1
  234. package/out/_next/static/chunks/{0hajwk2yd-rwr.js → 44bl4ufopbmyh.js} +1 -1
  235. package/out/_next/static/chunks/44iutzkw9r21x.js +1 -0
  236. package/out/_next/static/chunks/turbopack-1xrxa3noq196-.js +1 -0
  237. package/out/_not-found/__next._full.txt +8 -8
  238. package/out/_not-found/__next._not-found.__PAGE__.txt +7 -7
  239. package/out/_not-found/__next._tree.txt +1 -1
  240. package/out/_not-found.html +1 -1
  241. package/out/_not-found.txt +8 -8
  242. package/out/index.html +1 -1
  243. package/out/index.txt +10 -10
  244. package/package.json +9 -9
  245. package/out/_next/static/chunks/00fbhtmui-yxg.js +0 -1
  246. package/out/_next/static/chunks/017pn-pen381_.js +0 -1
  247. package/out/_next/static/chunks/01vov6inx1zzt.js +0 -1
  248. package/out/_next/static/chunks/03bd5plut08tg.js +0 -1
  249. package/out/_next/static/chunks/03dwfqmo73w_z.js +0 -1
  250. package/out/_next/static/chunks/03sn4419dam-h.js +0 -5
  251. package/out/_next/static/chunks/05ere0-228syf.js +0 -1
  252. package/out/_next/static/chunks/05h8u5lrypn5m.js +0 -1
  253. package/out/_next/static/chunks/05z79zh625ezu.js +0 -1
  254. package/out/_next/static/chunks/08lvtnv7b1cxp.js +0 -1
  255. package/out/_next/static/chunks/0_v2luu_qmeid.js +0 -1
  256. package/out/_next/static/chunks/0boov9mwycanf.js +0 -1
  257. package/out/_next/static/chunks/0d8x8m2x6ca_m.js +0 -1
  258. package/out/_next/static/chunks/0dmrdrwtd093b.js +0 -1
  259. package/out/_next/static/chunks/0e7nlxmneb2j_.js +0 -1
  260. package/out/_next/static/chunks/0es97pusfxupl.js +0 -1
  261. package/out/_next/static/chunks/0fxdyvb1w23d1.js +0 -1
  262. package/out/_next/static/chunks/0fxhc24djjcgq.js +0 -1
  263. package/out/_next/static/chunks/0hk1wg7h4araz.js +0 -1
  264. package/out/_next/static/chunks/0j74ipw4fps-n.js +0 -1
  265. package/out/_next/static/chunks/0kj-vckdn7t5p.js +0 -1
  266. package/out/_next/static/chunks/0lbs5xdyjuzuo.js +0 -1
  267. package/out/_next/static/chunks/0mp0jh1gj7290.js +0 -1
  268. package/out/_next/static/chunks/0ngpoj2g5i4kz.js +0 -1
  269. package/out/_next/static/chunks/0nhljhguceh66.js +0 -1
  270. package/out/_next/static/chunks/0p6z73afb9dj2.js +0 -1
  271. package/out/_next/static/chunks/0p9zfmidzqkps.js +0 -1
  272. package/out/_next/static/chunks/0sx-6rf3eteqn.js +0 -1
  273. package/out/_next/static/chunks/0u85f0dhb4i8e.js +0 -1
  274. package/out/_next/static/chunks/0uk7kigzm4vi2.js +0 -31
  275. package/out/_next/static/chunks/0ulufxnsrou61.js +0 -1
  276. package/out/_next/static/chunks/0xa9dyg6ezzyd.js +0 -2
  277. package/out/_next/static/chunks/0xvrfvur0p534.js +0 -1
  278. package/out/_next/static/chunks/0ydfhk-p6zvm0.js +0 -1
  279. package/out/_next/static/chunks/0zcsxvcvog9ue.js +0 -1
  280. package/out/_next/static/chunks/10_5p5-xf2aoo.js +0 -1
  281. package/out/_next/static/chunks/118qlrzdwpfmo.js +0 -1
  282. package/out/_next/static/chunks/11km5p4gd0ut4.js +0 -1
  283. package/out/_next/static/chunks/120rl4l29q9xs.js +0 -1
  284. package/out/_next/static/chunks/129m5i93ltoym.js +0 -1
  285. package/out/_next/static/chunks/12n73o884lyyl.js +0 -1
  286. package/out/_next/static/chunks/175st2ogkg_1o.js +0 -1
  287. package/out/_next/static/chunks/19rsodtu91ja_.js +0 -1
  288. package/out/_next/static/chunks/1a2ouhup611bz.js +0 -1
  289. package/out/_next/static/chunks/1cyq7i39885sl.js +0 -1
  290. package/out/_next/static/chunks/1d9it6yocgt54.js +0 -1
  291. package/out/_next/static/chunks/1dp1s1t-y7gal.js +0 -1
  292. package/out/_next/static/chunks/1dr7gh6xgypl8.js +0 -1
  293. package/out/_next/static/chunks/1dt30s_sp8415.js +0 -1
  294. package/out/_next/static/chunks/1f1rek_fxk3of.js +0 -1
  295. package/out/_next/static/chunks/1f2mna0k5efeq.js +0 -1
  296. package/out/_next/static/chunks/1gfz3sxwkkg3d.js +0 -1
  297. package/out/_next/static/chunks/1gr35qeguuws0.js +0 -1
  298. package/out/_next/static/chunks/1imi0xwi9hd99.js +0 -1
  299. package/out/_next/static/chunks/1ka5v5zu0cstt.js +0 -1
  300. package/out/_next/static/chunks/1n9nhz-6azcp3.js +0 -3
  301. package/out/_next/static/chunks/1ncqwe81t_9_x.js +0 -1
  302. package/out/_next/static/chunks/1nix_lulkpklo.js +0 -1
  303. package/out/_next/static/chunks/1ntqovuz2c217.js +0 -1
  304. package/out/_next/static/chunks/1pgs-98tfkq9_.js +0 -1
  305. package/out/_next/static/chunks/1q2z0aeopo8t8.js +0 -1
  306. package/out/_next/static/chunks/1ses023uud001.js +0 -1
  307. package/out/_next/static/chunks/1t9i20i5-f8ze.js +0 -1
  308. package/out/_next/static/chunks/1ug4k-1zhr63a.js +0 -1
  309. package/out/_next/static/chunks/1vrpzlif-z_p0.js +0 -1
  310. package/out/_next/static/chunks/1vurgl6oz2qey.js +0 -17
  311. package/out/_next/static/chunks/1w-qc09n9ijtq.js +0 -1
  312. package/out/_next/static/chunks/1ycqxcht6x54p.js +0 -1
  313. package/out/_next/static/chunks/1zj4307ugq0qz.js +0 -1
  314. package/out/_next/static/chunks/1zm52cjrfrq7c.js +0 -1
  315. package/out/_next/static/chunks/1zp9363yfhpom.js +0 -1
  316. package/out/_next/static/chunks/2-3hk_db5fpok.js +0 -1
  317. package/out/_next/static/chunks/2-bv9a_0zgw1f.js +0 -1
  318. package/out/_next/static/chunks/216uiih3_vdfd.js +0 -1
  319. package/out/_next/static/chunks/21kfpd_bityxt.js +0 -1
  320. package/out/_next/static/chunks/24ecas0m9tao7.js +0 -3
  321. package/out/_next/static/chunks/24pq9210rng3f.js +0 -1
  322. package/out/_next/static/chunks/26skkagvj1z96.js +0 -1
  323. package/out/_next/static/chunks/2701xfv_07wz_.js +0 -1
  324. package/out/_next/static/chunks/271333m8y3k0e.js +0 -1
  325. package/out/_next/static/chunks/29rkmguzky-bp.js +0 -1
  326. package/out/_next/static/chunks/2a2oy8ryz2tsk.js +0 -1
  327. package/out/_next/static/chunks/2apnpj0-fs9ks.js +0 -1
  328. package/out/_next/static/chunks/2b481pitl4k85.js +0 -1
  329. package/out/_next/static/chunks/2bettxaqt3d2p.js +0 -1
  330. package/out/_next/static/chunks/2d2kl_m64j9cb.js +0 -1
  331. package/out/_next/static/chunks/2droqjmvmgj13.js +0 -1
  332. package/out/_next/static/chunks/2dxbvwbbgpzoq.js +0 -1
  333. package/out/_next/static/chunks/2eqbsut829r5l.js +0 -1
  334. package/out/_next/static/chunks/2f3_mzxjh3gso.js +0 -1
  335. package/out/_next/static/chunks/2fsde0jwi5qtt.js +0 -1
  336. package/out/_next/static/chunks/2j2ynchpqh34-.js +0 -1
  337. package/out/_next/static/chunks/2kj6pzs_wap1v.js +0 -1
  338. package/out/_next/static/chunks/2lnj9jruy4nrv.js +0 -1
  339. package/out/_next/static/chunks/2ofwtw6p08sfz.js +0 -1
  340. package/out/_next/static/chunks/2phl5ta4iim7l.js +0 -12
  341. package/out/_next/static/chunks/2r5qgieqldcd9.js +0 -1
  342. package/out/_next/static/chunks/2r7y401cvjc1s.js +0 -1
  343. package/out/_next/static/chunks/2rmc6ru7mc-kg.js +0 -1
  344. package/out/_next/static/chunks/2w2k1gveljyb7.js +0 -1
  345. package/out/_next/static/chunks/2w_ptlw-ad8-9.js +0 -4
  346. package/out/_next/static/chunks/2ws1s9d52ayv8.js +0 -1
  347. package/out/_next/static/chunks/2x7enks3ydgai.js +0 -1
  348. package/out/_next/static/chunks/2ydub0t01728d.js +0 -1
  349. package/out/_next/static/chunks/3-m_vzabs1uez.js +0 -1
  350. package/out/_next/static/chunks/3527r3jo5fj3i.js +0 -1
  351. package/out/_next/static/chunks/355dg8yaa94hr.js +0 -1
  352. package/out/_next/static/chunks/35ntbr_c-yx44.js +0 -1
  353. package/out/_next/static/chunks/36enkx1skkv2-.js +0 -4
  354. package/out/_next/static/chunks/38xdo3cifphut.js +0 -1
  355. package/out/_next/static/chunks/3beawo-qwuk8k.js +0 -1
  356. package/out/_next/static/chunks/3cj_6sl9kr3e9.js +0 -1
  357. package/out/_next/static/chunks/3df_l2we755bb.js +0 -1
  358. package/out/_next/static/chunks/3eve5y7fpzx2h.js +0 -1
  359. package/out/_next/static/chunks/3ewgyb4y19w-3.js +0 -1
  360. package/out/_next/static/chunks/3f3789eh18_oy.js +0 -1
  361. package/out/_next/static/chunks/3g3-e9m1en45q.js +0 -1
  362. package/out/_next/static/chunks/3i239y-1hbkm-.js +0 -1
  363. package/out/_next/static/chunks/3kp8qmhoi24oz.js +0 -1
  364. package/out/_next/static/chunks/3ksq69yq-40_r.js +0 -1
  365. package/out/_next/static/chunks/3qye1lytea2i8.js +0 -1
  366. package/out/_next/static/chunks/3rlp9yr75liz7.js +0 -1
  367. package/out/_next/static/chunks/3tyo643l62h3m.js +0 -1
  368. package/out/_next/static/chunks/3tz2tpqa9uvwm.js +0 -1
  369. package/out/_next/static/chunks/3utpc-fc6_y0f.js +0 -1
  370. package/out/_next/static/chunks/3v6nxa28rxngq.js +0 -1
  371. package/out/_next/static/chunks/3vv99btjc-mky.js +0 -1
  372. package/out/_next/static/chunks/3x02lxdo28u9i.js +0 -1
  373. package/out/_next/static/chunks/3ydnxyc4rvad_.js +0 -1
  374. package/out/_next/static/chunks/3ylg4gfetwgxw.js +0 -1
  375. package/out/_next/static/chunks/3zdtteq-r2fs5.js +0 -62
  376. package/out/_next/static/chunks/3zkwt0gybqtgm.js +0 -1
  377. package/out/_next/static/chunks/40etabvml_71y.js +0 -1
  378. package/out/_next/static/chunks/417jkzz0slv9m.js +0 -1
  379. package/out/_next/static/chunks/41u2-5jayyajf.js +0 -22
  380. package/out/_next/static/chunks/42gcpy51w7lk1.js +0 -1
  381. package/out/_next/static/chunks/44cer242u-f8v.js +0 -1
  382. package/out/_next/static/chunks/44zi0gl0a6a8w.js +0 -1
  383. package/out/_next/static/chunks/turbopack-0n2o5_bkskckx.js +0 -1
  384. /package/out/_next/static/{A1hxMz783bIWo0Q9qqV3L → 4r0L0ZMJeBwOJCVDsvvZ4}/_buildManifest.js +0 -0
  385. /package/out/_next/static/{A1hxMz783bIWo0Q9qqV3L → 4r0L0ZMJeBwOJCVDsvvZ4}/_clientMiddlewareManifest.js +0 -0
  386. /package/out/_next/static/{A1hxMz783bIWo0Q9qqV3L → 4r0L0ZMJeBwOJCVDsvvZ4}/_ssgManifest.js +0 -0
@@ -1,5 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,46541,e=>{"use strict";var t=e.i(22832),r=e.i(85789),s=e.i(56145),a=e.i(15392),i=e.i(44351),n=e.i(41085),o=e.i(51509),l=e.i(80592),h=e.i(6939),u=e.i(9977),_=e.i(72986);class p{constructor(){this.mm=new Map}get(e,t){let r=this.mm.get(e);if(void 0!==r)return r.get(t)}set(e,t,r){let s=this.mm.get(e);void 0===s&&this.mm.set(e,s=new Map),s.set(t,r)}}class d{get standalone(){return this._options?.standalone??!1}get baseMaterial(){return this._baseMaterial}get doNotInjectCode(){return this._options?.doNotInjectCode??!1}constructor(e,t,r){this._baseMaterial=e,this._scene=t??_.EngineStore.LastCreatedScene,this._options=r,this._subMeshToEffect=new Map,this._subMeshToDepthWrapper=new p,this._meshes=new Map,this._onEffectCreatedObserver=this._baseMaterial.onEffectCreatedObservable.add(e=>{let t=e.subMesh?.getMesh();t&&!this._meshes.has(t)&&this._meshes.set(t,t.onDisposeObservable.add(e=>{let t=this._subMeshToEffect.keys();for(let r=t.next();!0!==r.done;r=t.next()){let t=r.value;t?.getMesh()===e&&(this._subMeshToEffect.delete(t),this._deleteDepthWrapperEffect(t))}})),this._subMeshToEffect.get(e.subMesh)?.[0]!==e.effect&&(this._subMeshToEffect.set(e.subMesh,[e.effect,this._scene.getEngine().currentRenderPassId]),this._deleteDepthWrapperEffect(e.subMesh))})}_deleteDepthWrapperEffect(e){let t=this._subMeshToDepthWrapper.mm.get(e);t&&(t.forEach(e=>{e.mainDrawWrapper.effect?.dispose()}),this._subMeshToDepthWrapper.mm.delete(e))}getEffect(e,t,r){let s=this._subMeshToDepthWrapper.mm.get(e)?.get(t);if(!s)return null;let a=s.drawWrapper[r];return a||(a=s.drawWrapper[r]=new u.DrawWrapper(this._scene.getEngine())).setEffect(s.mainDrawWrapper.effect,s.mainDrawWrapper.defines),a}isReadyForSubMesh(e,t,r,s,a){return(!this.standalone||!!this._baseMaterial.isReadyForSubMesh(e.getMesh(),e,s))&&(this._makeEffect(e,t,r,a)?.isReady()??!1)}dispose(){this._baseMaterial.onEffectCreatedObservable.remove(this._onEffectCreatedObserver),this._onEffectCreatedObserver=null;let e=this._meshes.entries();for(let t=e.next();!0!==t.done;t=e.next()){let[e,r]=t.value;e.onDisposeObservable.remove(r)}}_makeEffect(e,t,r,s){let a=this._scene.getEngine(),i=this._subMeshToEffect.get(e);if(!i)return null;let[n,o]=i;if(!n.isReady())return null;let _=this._subMeshToDepthWrapper.get(e,r);if(!_){let t=new u.DrawWrapper(a),i=e._getDrawWrapper(o)?.defines;t.defines="string"==typeof i?null:i??null,(_={drawWrapper:[],mainDrawWrapper:t,depthDefines:"",token:(0,h.RandomGUID)()}).drawWrapper[s]=t,this._subMeshToDepthWrapper.set(e,r,_)}let p=t.join("\n");if(_.mainDrawWrapper.effect&&p===_.depthDefines)return _.mainDrawWrapper.effect;_.depthDefines=p;let d=n.getUniformNames().slice(),c=n.vertexSourceCodeBeforeMigration,f=n.fragmentSourceCodeBeforeMigration;if(!c&&!f)return null;if(!this.doNotInjectCode){let e=this._options&&this._options.remappedVariables?`#include<shadowMapVertexNormalBias>(${this._options.remappedVariables.join(",")})`:"#include<shadowMapVertexNormalBias>",t=this._options&&this._options.remappedVariables?`#include<shadowMapVertexMetric>(${this._options.remappedVariables.join(",")})`:"#include<shadowMapVertexMetric>",r=this._options&&this._options.remappedVariables?`#include<shadowMapFragmentSoftTransparentShadow>(${this._options.remappedVariables.join(",")})`:"#include<shadowMapFragmentSoftTransparentShadow>",s="#include<shadowMapFragment>",a="#include<shadowMapVertexExtraDeclaration>";c=(c=-1!==(c=(c=0===n.shaderLanguage?c.replace(/void\s+?main/g,`
2
- ${a}
3
- void main`):c.replace(/@vertex/g,`
4
- ${a}
5
- @vertex`)).replace(/#define SHADOWDEPTH_NORMALBIAS|#define CUSTOM_VERTEX_UPDATE_WORLDPOS/g,e)).indexOf("#define SHADOWDEPTH_METRIC")?c.replace(/#define SHADOWDEPTH_METRIC/g,t):c.replace(/}\s*$/g,t+"\n}")).replace(/#define SHADER_NAME.*?\n|out vec4 glFragColor;\n/g,"");let i=f.indexOf("#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW")>=0||f.indexOf("#define CUSTOM_FRAGMENT_BEFORE_FOG")>=0,o=-1!==f.indexOf("#define SHADOWDEPTH_FRAGMENT"),h="";i?f=f.replace(/#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW|#define CUSTOM_FRAGMENT_BEFORE_FOG/g,r):h=r+"\n",f=f.replace(/void\s+?main/g,l.Effect.IncludesShadersStore.shadowMapFragmentExtraDeclaration+"\nvoid main"),o?f=f.replace(/#define SHADOWDEPTH_FRAGMENT/g,s):h+=s+"\n",h&&(f=f.replace(/}\s*$/g,h+"}")),d.push("biasAndScaleSM","depthValuesSM","lightDataSM","softTransparentShadowSM")}_.mainDrawWrapper.effect=a.createEffect({vertexSource:c,fragmentSource:f,vertexToken:_.token,fragmentToken:_.token},{attributes:n.getAttributesNames(),uniformsNames:d,uniformBuffersNames:n.getUniformBuffersNames(),samplers:n.getSamplers(),defines:p+"\n"+n.defines.replace("#define SHADOWS","").replace(/#define SHADOW\d/g,""),indexParameters:n.getIndexParameters(),shaderLanguage:n.shaderLanguage},a);for(let e=0;e<_.drawWrapper.length;++e)e!==s&&_.drawWrapper[e]?.setEffect(_.mainDrawWrapper.effect,_.mainDrawWrapper.defines);return _.mainDrawWrapper.effect}}var c=e.i(43298),f=e.i(7361),x=e.i(9131),m=e.i(88975);function g(e){return Math.min(Math.max(Math.floor(Math.max(e.getCaps().maxVertexUniformVectors-40,0)/5),1),256)}class T extends a.MaterialDefines{constructor(e){super(e),this.FOG=!1,this.THIN_INSTANCES=!0,this.LOGARITHMICDEPTH=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.SH_DEGREE=0,this.COMPENSATION=!1,this.IS_COMPOUND=!1,this.MAX_PART_COUNT=128,this.USE_SOG=!1,this.USE_SOG_V2=!1,this.rebuild()}hasDefine(e){return -1!==this._keys.indexOf(e)}}class S extends i.PushMaterial{constructor(e,t){super(e,t),this.kernelSize=S.KernelSize,this.minPixelSize=S.MinPixelSize,this._compensation=S.Compensation,this._isDirty=!1,this._sourceMesh=null,this._voxelMissingTextureWarned=new Set,this._voxelPartWorldData=new Float32Array(0),this._voxelPartVisibilityData=[],this.backFaceCulling=!1,this.shadowDepthWrapper=S._MakeGaussianSplattingShadowDepthWrapper(t,this.shaderLanguage)}set compensation(e){this._isDirty=this._isDirty!=e,this._compensation=e}get compensation(){return this._compensation}get hasRenderTargetTextures(){return!1}needAlphaTesting(){return!1}needAlphaBlending(){return!0}isReadyForSubMesh(t,r){let s=r._drawWrapper,a=r.materialDefines;if(a&&this._isDirty&&a.markAsUnprocessed(),s.effect&&this.isFrozen&&s._wasPreviouslyReady&&!0===s._wasPreviouslyUsingInstances)return!0;if(!r.materialDefines||this.pluginManager){this._callbackPluginEventGeneric(4,this._eventInfo);let e=this._eventInfo.defineNames;(!r.materialDefines||e&&Object.keys(e).some(e=>!a.hasDefine(e)))&&(a=r.materialDefines=new T(e))}let i=this.getScene();if(this._isReadyForSubMesh(r))return!0;if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=a,this._eventInfo.subMesh=r,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh||!this._sourceMesh)return!1;let o=i.getEngine(),l=this._sourceMesh;(0,x.PrepareDefinesForMisc)(t,i,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,!1,a,void 0,void 0,void 0,this._isVertexOutputInvariant),(0,x.PrepareDefinesForFrameBoundValues)(i,o,this,a,!0,null,!0),this._eventInfo.defines=a,this._eventInfo.mesh=t,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),(0,x.PrepareDefinesForAttributes)(t,a,!1,!1),this._callbackPluginEventPrepareDefines(this._eventInfo),(o.version>1||o.isWebGPU)&&(a.SH_DEGREE=l.shDegree),a.IS_COMPOUND=l.isCompound,a.MAX_PART_COUNT=g(o),a.USE_SOG=l.useSog,a.USE_SOG_V2=l.useSog&&l.sogParams?.version===2;let h=l.material;if(a.COMPENSATION=h&&h.compensation?h.compensation:S.Compensation,a.isDirty){a.markAsProcessed(),i.resetCachedMaterial(),(0,x.PrepareAttributesForInstances)(S._Attribs,a);let s=S._Attribs.slice(),l=S._Uniforms.slice(),h=S._Samplers.slice(),u=S._UniformBuffers.slice();(0,x.PrepareUniformsAndSamplersList)({uniformsNames:l,uniformBuffersNames:u,samplers:h,defines:a}),(0,n.AddClipPlaneUniforms)(l),this._uniformBufferLayoutBuilt||this.buildUniformLayout(),this._eventInfo.fallbackRank=0,this._eventInfo.defines=a,this._eventInfo.attributes=s,this._eventInfo.uniforms=l,this._eventInfo.samplers=h,this._eventInfo.uniformBuffersNames=u,this._eventInfo.customCode=void 0,this._eventInfo.mesh=t,this._callbackPluginEventGeneric(128,this._eventInfo);let _=a.toString(),p=i.getEngine().createEffect("gaussianSplatting",{attributes:s,uniformsNames:l,uniformBuffersNames:u,samplers:h,defines:_,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{},processCodeAfterIncludes:this._eventInfo.customCode,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:async()=>{1===this._shaderLanguage?await Promise.all([e.A(95275),e.A(63357)]):await Promise.all([e.A(96399),e.A(99617)])}},o);r.setEffect(p,a,this._materialContext)}return!!r.effect&&!!r.effect.isReady()&&(a._renderId=i.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!0,this._isDirty=!1,!0)}setSourceMesh(e){this._sourceMesh=e}getSourceMesh(){return this._sourceMesh}static BindEffect(e,t,r){let s=r.getEngine(),a=r.activeCamera,i=s.getRenderWidth()*a.viewport.width,n=s.getRenderHeight()*a.viewport.height,l=e.material;if(!l._sourceMesh)return;let h=l._sourceMesh,u=a?.rigParent?.rigCameras.length||1;t.setFloat2("invViewport",1/(i/u),1/n);let _=1e3;if(a){let e=a.getProjectionMatrix().m[5];_=a.fovMode==o.Camera.FOVMODE_VERTICAL_FIXED?n*e/2:i*e/2}if(t.setFloat2("focal",_,_),t.setFloat("kernelSize",l&&l.kernelSize?l.kernelSize:S.KernelSize),t.setFloat("minPixelSize",l?l.minPixelSize:S.MinPixelSize),t.setFloat("alpha",l.alpha),r.bindEyePosition(t,"eyePosition",!0),h.covariancesATexture){let e=h.covariancesATexture.getSize();if(t.setFloat2("dataTextureSize",e.width,e.height),t.setTexture("covariancesATexture",h.covariancesATexture),t.setTexture("covariancesBTexture",h.covariancesBTexture),t.setTexture("centersTexture",h.centersTexture),t.setTexture("colorsTexture",h.colorsTexture),h.useSog)S._BindSogUniforms(h,t);else if(h.shTextures)for(let e=0;e<h.shTextures.length;e++)t.setTexture(`shTexture${e}`,h.shTextures[e]);h.bindExtraEffectUniforms(t)}}static _BindSogUniforms(e,t){let r=e.sogParams;r&&(t.setTexture("sogQuatsTexture",e.rotationsATexture),e.shTextures&&e.shTextures.length>=2&&(t.setTexture("sogShNCentroidsTexture",e.shTextures[0]),t.setTexture("sogShNLabelsTexture",e.shTextures[1])),r.codebookTexture&&t.setTexture("sogCodebookTexture",r.codebookTexture),t.setFloat3("sogMeansMin",r.meansMin[0],r.meansMin[1],r.meansMin[2]),t.setFloat3("sogMeansMax",r.meansMax[0],r.meansMax[1],r.meansMax[2]),r.scalesMin&&r.scalesMax&&(t.setFloat3("sogScalesMin",r.scalesMin[0],r.scalesMin[1],r.scalesMin[2]),t.setFloat3("sogScalesMax",r.scalesMax[0],r.scalesMax[1],r.scalesMax[2])),r.sh0Min&&r.sh0Max&&(t.setFloat4("sogSh0Min",r.sh0Min[0],r.sh0Min[1],r.sh0Min[2],r.sh0Min[3]),t.setFloat4("sogSh0Max",r.sh0Max[0],r.sh0Max[1],r.sh0Max[2],r.sh0Max[3])),t.setFloat("sogShnMin",r.shnMin??0),t.setFloat("sogShnMax",r.shnMax??0),t.setFloat("sogShCoeffCount",r.shCoeffCount??0))}bindForSubMesh(e,t,r){let s=this.getScene(),a=r.materialDefines;if(!a)return;let i=r.effect;i&&(this._activeEffect=i,t.getMeshUniformBuffer().bindToEffect(i,"Mesh"),t.transferToEffect(e),this._mustRebind(s,i,r,t.visibility)?(this.bindView(i),this.bindViewProjection(i),S.BindEffect(t,this._activeEffect,s),(0,n.BindClipPlane)(i,this,s)):s.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0),(0,x.BindFogParameters)(s,t,i),this.useLogarithmicDepth&&(0,x.BindLogDepth)(a,i,s),this._eventInfo.subMesh=r,this._callbackPluginEventBindForSubMesh(this._eventInfo),this._afterBind(t,this._activeEffect,r))}static _BindEffectUniforms(e,t,r,s){let a,i,n=s.getEngine(),l=r.getEffect(),h=s.activeCamera;if(!h)return;e.getMeshUniformBuffer().bindToEffect(l,"Mesh"),r.bindView(l),r.bindViewProjection(l);let u=n.getRenderWidth()*h.viewport.width,_=n.getRenderHeight()*h.viewport.height;l.setFloat2("invViewport",1/u,1/_);let p=1e3;if(h){let e=h.getProjectionMatrix().m[5];p=h.fovMode==o.Camera.FOVMODE_VERTICAL_FIXED?_*e/2:u*e/2}if(l.setFloat2("focal",p,p),l.setFloat("kernelSize",t&&t.kernelSize?t.kernelSize:S.KernelSize),l.setFloat("minPixelSize",t?t.minPixelSize:S.MinPixelSize),l.setFloat("alpha",t.alpha),h.mode===o.Camera.ORTHOGRAPHIC_CAMERA?(a=!n.useReverseDepthBuffer&&n.isNDCHalfZRange?0:1,i=n.useReverseDepthBuffer&&n.isNDCHalfZRange?0:1):(a=n.useReverseDepthBuffer&&n.isNDCHalfZRange?h.minZ:n.isNDCHalfZRange?0:h.minZ,i=n.useReverseDepthBuffer&&n.isNDCHalfZRange?0:h.maxZ),l.setFloat2("depthValues",a,a+i),e.covariancesATexture){let t=e.covariancesATexture.getSize();l.setFloat2("dataTextureSize",t.width,t.height),l.setTexture("covariancesATexture",e.covariancesATexture),l.setTexture("covariancesBTexture",e.covariancesBTexture),l.setTexture("centersTexture",e.centersTexture),l.setTexture("colorsTexture",e.colorsTexture),e.bindExtraEffectUniforms(l)}}_bindVoxelEffectUniforms(e,t,s){if(!e.rotationsATexture&&(e.needsRotationScaleTextures=!0,!e.rotationsATexture))return!e.centersTexture||e.splatsData||this._voxelMissingTextureWarned.has(e.uniqueId)||(this._voxelMissingTextureWarned.add(e.uniqueId),r.Logger.Error("IBL voxelization: GaussianSplattingMesh rotation/scale textures are not available. Create the mesh either with keepInRam=true or needsRotationScaleTextures=true to enable IBL shadow voxelization.")),!1;this._voxelMissingTextureWarned.delete(e.uniqueId);let a=s.getEffect();e.getMeshUniformBuffer().bindToEffect(a,"Mesh");let i=e.rotationsATexture.getSize();if(a.setFloat("alpha",t.alpha),a.setFloat2("dataTextureSize",i.width,i.height),a.setTexture("rotationsATexture",e.rotationsATexture),a.setTexture("rotationsBTexture",e.rotationsBTexture),a.setTexture("rotationScaleTexture",e.rotationScaleTexture),a.setTexture("centersTexture",e.centersTexture),a.setTexture("colorsTexture",e.colorsTexture),e.partIndicesTexture){a.setTexture("partIndicesTexture",e.partIndicesTexture);let t=16*e.partCount;this._voxelPartWorldData.length!==t&&(this._voxelPartWorldData=new Float32Array(t));let r=this._voxelPartWorldData;for(let t=0;t<e.partCount;t++)e.getWorldMatrixForPart(t).toArray(r,16*t);a.setMatrices("partWorld",r);let s=this._voxelPartVisibilityData;s.length=e.partCount;for(let t=0;t<e.partCount;t++)s[t]=e.partVisibility[t]??1;a.setArray("partVisibility",s)}return!0}makeVoxelRenderingMaterial(t,r,s,a=!1){let i=[`#define MAX_DRAW_BUFFERS ${s}`];i.push("#define IS_FOR_VOXELIZATION"),a&&(i.push("#define IS_COMPOUND 1"),i.push(`#define MAX_PART_COUNT ${g(t.getEngine())}`));let n=new c.ShaderMaterial("gaussianSplattingVoxelRender",t,{vertex:"gaussianSplattingVoxel",fragment:"gaussianSplattingVoxel"},{attributes:S._Attribs,uniforms:S._VoxelUniforms,samplers:S._VoxelSamplers,uniformBuffers:S._UniformBuffers,shaderLanguage:r,defines:i,needAlphaBlending:!1,extraInitializationsAsync:async()=>{1===r?await Promise.all([e.A(14994),e.A(91662)]):await Promise.all([e.A(70102),e.A(23454)])}});return n.cullBackFaces=!1,n.backFaceCulling=!1,n.depthFunction=m.Engine.ALWAYS,n.onBindObservable.add(e=>{let t=e.material;this._bindVoxelEffectUniforms(e,t,n)}),n}makeDepthRenderingMaterial(e,t,r=!1,s=!1){let a=["#define DEPTH_RENDER"];r&&a.push("#define ALPHA_BLENDED_DEPTH"),s&&(a.push("#define IS_COMPOUND 1"),a.push(`#define MAX_PART_COUNT ${g(e.getEngine())}`));let i=new c.ShaderMaterial("gaussianSplattingDepthRender",e,{vertex:"gaussianSplattingDepth",fragment:"gaussianSplattingDepth"},{attributes:S._Attribs,uniforms:S._Uniforms,samplers:S._Samplers,uniformBuffers:S._UniformBuffers,shaderLanguage:t,defines:a,needAlphaBlending:r});return i.doNotSerialize=!0,i.backFaceCulling=!1,i.onBindObservable.add(t=>{let r=t.material,s=r?.getSourceMesh()??t;S._BindEffectUniforms(s,r,i,e)}),i}static _MakeGaussianSplattingShadowDepthWrapper(e,t){let r=new c.ShaderMaterial("gaussianSplattingDepth",e,{vertex:"gaussianSplattingDepth",fragment:"gaussianSplattingDepth"},{attributes:S._Attribs,uniforms:S._Uniforms,samplers:S._Samplers,uniformBuffers:S._UniformBuffers,shaderLanguage:t});r.doNotSerialize=!0,r.backFaceCulling=!1;let s=new d(r,e,{standalone:!0});return r.onBindObservable.add(t=>{let s=t.material,a=s?.getSourceMesh()??t;S._BindEffectUniforms(a,s,r,e)}),s}clone(e){let r=t.SerializationHelper.Clone(()=>new S(e,this.getScene()),this);return r.id=e,r.name=e,this._clonePlugins(r,""),r}serialize(){let e=super.serialize();return e.customType="BABYLON.GaussianSplattingMaterial",e}getClassName(){return"GaussianSplattingMaterial"}static Parse(e,r,s){let a=t.SerializationHelper.Parse(()=>new S(e.name,r),e,r,s);return f.Material._ParsePlugins(e,a,r,s),a}}S.KernelSize=.3,S.Compensation=!1,S.MinPixelSize=0,S._Attribs=[s.VertexBuffer.PositionKind,"splatIndex0","splatIndex1","splatIndex2","splatIndex3"],S._Samplers=["covariancesATexture","covariancesBTexture","centersTexture","colorsTexture","shTexture0","shTexture1","shTexture2","shTexture3","shTexture4","partIndicesTexture","sogQuatsTexture","sogShNCentroidsTexture","sogShNLabelsTexture","sogCodebookTexture"],S._UniformBuffers=["Scene","Mesh"],S._VoxelUniforms=["world","dataTextureSize","alpha","invWorldScale","viewMatrix","nearPlane","farPlane","stepSize","partWorld","partVisibility","axis"],S._VoxelSamplers=["rotationsATexture","rotationsBTexture","rotationScaleTexture","centersTexture","colorsTexture","partIndicesTexture"],S._Uniforms=["world","view","projection","vFogInfos","vFogColor","logarithmicDepthConstant","invViewport","dataTextureSize","focal","eyePosition","kernelSize","minPixelSize","alpha","depthValues","partWorld","partVisibility","sogMeansMin","sogMeansMax","sogScalesMin","sogScalesMax","sogSh0Min","sogSh0Max","sogShnMin","sogShnMax","sogShCoeffCount"],e.s(["GaussianSplattingMaterial",0,S,"GetGaussianSplattingMaxPartCount",0,g],46541)},95823,e=>{"use strict";var t=e.i(86823),r=e.i(36074),s=e.i(55080),a=e.i(85789),i=e.i(76256);let n=!1;class o extends r.RenderTargetTexture{get isSupported(){return this._engine?.getCaps().drawBuffersExtension??!1}get textures(){return this._textures}get count(){return this._count}get depthTexture(){return this._textures[this._textures.length-1]}set wrapU(e){if(this._textures)for(let t=0;t<this._textures.length;t++)this._textures[t].wrapU=e}set wrapV(e){if(this._textures)for(let t=0;t<this._textures.length;t++)this._textures[t].wrapV=e}constructor(e,t,r,o,l,h){const u=!!l&&!!l.generateMipMaps&&l.generateMipMaps,_=!!l&&!!l.generateDepthTexture&&l.generateDepthTexture,p=l&&l.depthTextureFormat?l.depthTextureFormat:15,d=!l||void 0===l.doNotChangeAspectRatio||l.doNotChangeAspectRatio,c=!!l&&!!l.drawOnlyOnFirstAttachmentByDefault&&l.drawOnlyOnFirstAttachmentByDefault;if(super(e,t,o,u,d,void 0,void 0,void 0,void 0,void 0,void 0,void 0,!0),n||(n=!0,i.ThinEngine.prototype.restoreSingleAttachment=function(){let e=this._gl;this.bindAttachments([e.BACK])},i.ThinEngine.prototype.restoreSingleAttachmentForRenderTarget=function(){let e=this._gl;this.bindAttachments([e.COLOR_ATTACHMENT0])},i.ThinEngine.prototype.buildTextureLayout=function(e,t=!1){let r=this._gl,s=[];if(t)s.push(r.BACK);else for(let t=0;t<e.length;t++)e[t]?s.push(r["COLOR_ATTACHMENT"+t]):s.push(r.NONE);return s},i.ThinEngine.prototype.bindAttachments=function(e){this._gl.drawBuffers(e)},i.ThinEngine.prototype.unBindMultiColorAttachmentFramebuffer=function(e,t=!1,r){this._currentRenderTarget=null,e.disableAutomaticMSAAResolve||this.resolveMultiFramebuffer(e),t||this.generateMipMapsMultiFramebuffer(e),r&&(e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._framebuffer),r()),this._bindUnboundFramebuffer(null)},i.ThinEngine.prototype.createMultipleRenderTarget=function(e,t,r=!0){let i,n=!1,o=!0,l=!1,h=!1,u=1,_=1,p=[],d=[],c=[],f=[],x=[],m=[],g=[],T=[],S=[],M=!1,A=this._createHardwareRenderTargetWrapper(!0,!1,e);void 0!==t&&(n=void 0!==t.generateMipMaps&&t.generateMipMaps,o=void 0===t.generateDepthBuffer||t.generateDepthBuffer,l=void 0!==t.generateStencilBuffer&&t.generateStencilBuffer,h=void 0!==t.generateDepthTexture&&t.generateDepthTexture,u=t.textureCount??1,_=t.samples??_,p=t.types||p,d=t.samplingModes||d,c=t.useSRGBBuffers||c,f=t.formats||f,x=t.targetTypes||x,m=t.faceIndex||m,g=t.layerIndex||g,T=t.layerCounts||T,S=t.labels||S,M=t.dontCreateTextures??!1,this.webGLVersion>1&&(13===t.depthTextureFormat||17===t.depthTextureFormat||16===t.depthTextureFormat||14===t.depthTextureFormat||18===t.depthTextureFormat)&&(i=t.depthTextureFormat)),void 0===i&&(i=l?13:14);let b=this._gl,y=this._currentFramebuffer,D=b.createFramebuffer();this._bindUnboundFramebuffer(D);let I=e.width??e,v=e.height??e,w=[],C=[],E=this.webGLVersion>1&&(13===i||17===i||18===i);A.label=t?.label??"MultiRenderTargetWrapper",A._framebuffer=D,A._generateDepthBuffer=h||o,A._generateStencilBuffer=h?E:l,A._depthStencilBuffer=this._setupFramebufferDepthAttachments(A._generateStencilBuffer,A._generateDepthBuffer,I,v,1,i),A._attachments=C;for(let e=0;e<u;e++){let t=d[e]||3,r=p[e]||0,i=c[e]||!1,o=f[e]||5,l=x[e]||3553,h=T[e]??1;(1!==r||this._caps.textureFloatLinearFiltering)&&(2!==r||this._caps.textureHalfFloatLinearFiltering)||(t=1);let u=this._getSamplingParameters(t,n);1!==r||this._caps.textureFloat||(r=0,a.Logger.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")),i=i&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU);let _=this.webGLVersion>1,m=b[_?"COLOR_ATTACHMENT"+e:"COLOR_ATTACHMENT"+e+"_WEBGL"];if(C.push(m),-1===l||M)continue;let g=new s.InternalTexture(this,6);w[e]=g,b.activeTexture(b["TEXTURE"+e]),b.bindTexture(l,g._hardwareTexture.underlyingResource),b.texParameteri(l,b.TEXTURE_MAG_FILTER,u.mag),b.texParameteri(l,b.TEXTURE_MIN_FILTER,u.min),b.texParameteri(l,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(l,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);let y=this._getRGBABufferInternalSizedFormat(r,o,i),D=this._getInternalFormat(o),E=this._getWebGLTextureType(r);if(_&&(35866===l||32879===l))35866===l?g.is2DArray=!0:g.is3D=!0,g.baseDepth=g.depth=h,b.texImage3D(l,0,y,I,v,h,0,D,E,null);else if(34067===l){for(let e=0;e<6;e++)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,y,I,v,0,D,E,null);g.isCube=!0}else b.texImage2D(b.TEXTURE_2D,0,y,I,v,0,D,E,null);n&&b.generateMipmap(l),this._bindTextureDirectly(l,null),g.baseWidth=I,g.baseHeight=v,g.width=I,g.height=v,g.isReady=!0,g.samples=1,g.generateMipMaps=n,g.samplingMode=t,g.type=r,g._useSRGBBuffer=i,g.format=o,g.label=S[e]??A.label+"-Texture"+e,this._internalTexturesCache.push(g)}if(h&&this._caps.depthTextureExtension&&!M){let e=new s.InternalTexture(this,14),t=5,r=b.DEPTH_COMPONENT16,a=b.DEPTH_COMPONENT,o=b.UNSIGNED_SHORT,l=b.DEPTH_ATTACHMENT;this.webGLVersion<2?r=b.DEPTH_COMPONENT:14===i?(t=1,o=b.FLOAT,r=b.DEPTH_COMPONENT32F):18===i?(t=0,o=b.FLOAT_32_UNSIGNED_INT_24_8_REV,r=b.DEPTH32F_STENCIL8,a=b.DEPTH_STENCIL,l=b.DEPTH_STENCIL_ATTACHMENT):16===i?(t=0,o=b.UNSIGNED_INT,r=b.DEPTH_COMPONENT24,l=b.DEPTH_ATTACHMENT):(13===i||17===i)&&(t=12,o=b.UNSIGNED_INT_24_8,r=b.DEPTH24_STENCIL8,a=b.DEPTH_STENCIL,l=b.DEPTH_STENCIL_ATTACHMENT),this._bindTextureDirectly(b.TEXTURE_2D,e,!0),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),b.texImage2D(b.TEXTURE_2D,0,r,I,v,0,a,o,null),b.framebufferTexture2D(b.FRAMEBUFFER,l,b.TEXTURE_2D,e._hardwareTexture.underlyingResource,0),this._bindTextureDirectly(b.TEXTURE_2D,null),A._depthStencilTexture=e,A._depthStencilTextureWithStencil=E,e.baseWidth=I,e.baseHeight=v,e.width=I,e.height=v,e.isReady=!0,e.samples=1,e.generateMipMaps=n,e.samplingMode=1,e.format=i,e.type=t,e.label=A.label+"-DepthStencil",w[u]=e,this._internalTexturesCache.push(e)}if(A.setTextures(w),r&&b.drawBuffers(C),this._bindUnboundFramebuffer(y),A.setLayerAndFaceIndices(g,m),this.resetTextureCache(),M){if(_>1){let e=b.createFramebuffer();if(!e)throw Error("Unable to create multi sampled framebuffer");A._samples=_,A._MSAAFramebuffer=e,u>0&&r&&(this._bindUnboundFramebuffer(e),b.drawBuffers(C),this._bindUnboundFramebuffer(y))}}else this.updateMultipleRenderTargetTextureSampleCount(A,_,r);return A},i.ThinEngine.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t,r=!0){if(this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;let s=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(s.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(s.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null);let a=e._attachments.length;for(let t=0;t<a;t++){let r=e.textures[t]._hardwareTexture;r?.releaseMSAARenderBuffers()}if(t>1&&"function"==typeof s.renderbufferStorageMultisample){let i=s.createFramebuffer();if(!i)throw Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=i,this._bindUnboundFramebuffer(i);let n=[];for(let r=0;r<a;r++){let a=e.textures[r],i=a._hardwareTexture,o=s[this.webGLVersion>1?"COLOR_ATTACHMENT"+r:"COLOR_ATTACHMENT"+r+"_WEBGL"],l=this._createRenderBuffer(a.width,a.height,t,-1,this._getRGBABufferInternalSizedFormat(a.type,a.format,a._useSRGBBuffer),o);if(!l)throw Error("Unable to create multi sampled framebuffer");i.addMSAARenderBuffer(l),a.samples=t,n.push(o)}r&&s.drawBuffers(n)}else this._bindUnboundFramebuffer(e._framebuffer);let i=e._depthStencilTexture?e._depthStencilTexture.format:void 0;return e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.width,e.height,t,i),this._bindUnboundFramebuffer(null),e._samples=t,t},i.ThinEngine.prototype.generateMipMapsMultiFramebuffer=function(e){let t=this._gl;if(e.isMulti)for(let r=0;r<e._attachments.length;r++){let s=e.textures[r];!s?.generateMipMaps||s?.isCube||s?.is3D||(this._bindTextureDirectly(t.TEXTURE_2D,s,!0),t.generateMipmap(t.TEXTURE_2D),this._bindTextureDirectly(t.TEXTURE_2D,null))}},i.ThinEngine.prototype.resolveMultiFramebuffer=function(e){let t=this._gl;if(!e._MSAAFramebuffer||!e.isMulti)return;let r=e.resolveMSAAColors?t.COLOR_BUFFER_BIT:0;r|=e._generateDepthBuffer&&e.resolveMSAADepth?t.DEPTH_BUFFER_BIT:0,r|=e._generateStencilBuffer&&e.resolveMSAAStencil?t.STENCIL_BUFFER_BIT:0;let s=e._attachments,a=s.length;t.bindFramebuffer(t.READ_FRAMEBUFFER,e._MSAAFramebuffer),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,e._framebuffer);for(let i=0;i<a;i++){let n=e.textures[i];for(let e=0;e<a;e++)s[e]=t.NONE;s[i]=t[this.webGLVersion>1?"COLOR_ATTACHMENT"+i:"COLOR_ATTACHMENT"+i+"_WEBGL"],t.readBuffer(s[i]),t.drawBuffers(s),t.blitFramebuffer(0,0,n.width,n.height,0,0,n.width,n.height,r,t.NEAREST)}for(let e=0;e<a;e++)s[e]=t[this.webGLVersion>1?"COLOR_ATTACHMENT"+e:"COLOR_ATTACHMENT"+e+"_WEBGL"];t.drawBuffers(s),t.bindFramebuffer(this._gl.FRAMEBUFFER,e._MSAAFramebuffer)}),!this.isSupported)return void this.dispose();this._textureNames=h;const f=[],x=[],m=[],g=[],T=[],S=[],M=[],A=[];this._initTypes(r,f,x,m,g,T,S,M,A,l);const b=!l||void 0===l.generateDepthBuffer||l.generateDepthBuffer,y=!!l&&void 0!==l.generateStencilBuffer&&l.generateStencilBuffer,D=l&&l.samples?l.samples:1;this._multiRenderTargetOptions={samplingModes:x,generateMipMaps:u,generateDepthBuffer:b,generateStencilBuffer:y,generateDepthTexture:_,depthTextureFormat:p,types:f,textureCount:r,useSRGBBuffers:m,samples:D,formats:g,targetTypes:T,faceIndex:S,layerIndex:M,layerCounts:A,labels:h,label:e},this._count=r,this._drawOnlyOnFirstAttachmentByDefault=c,r>0&&(this._createInternalTextures(),this._createTextures(h))}_initTypes(e,r,s,a,i,n,o,l,h,u){for(let _=0;_<e;_++)u&&u.types&&void 0!==u.types[_]?r.push(u.types[_]):r.push(u&&u.defaultType?u.defaultType:0),u&&u.samplingModes&&void 0!==u.samplingModes[_]?s.push(u.samplingModes[_]):s.push(t.Texture.BILINEAR_SAMPLINGMODE),u&&u.useSRGBBuffers&&void 0!==u.useSRGBBuffers[_]?a.push(u.useSRGBBuffers[_]):a.push(!1),u&&u.formats&&void 0!==u.formats[_]?i.push(u.formats[_]):i.push(5),u&&u.targetTypes&&void 0!==u.targetTypes[_]?n.push(u.targetTypes[_]):n.push(3553),u&&u.faceIndex&&void 0!==u.faceIndex[_]?o.push(u.faceIndex[_]):o.push(0),u&&u.layerIndex&&void 0!==u.layerIndex[_]?l.push(u.layerIndex[_]):l.push(0),u&&u.layerCounts&&void 0!==u.layerCounts[_]?h.push(u.layerCounts[_]):h.push(1)}_createInternaTextureIndexMapping(){let e={},t=[];if(!this._renderTarget)return t;let r=this._renderTarget.textures;for(let s=0;s<r.length;s++){let a=r[s];if(!a)continue;let i=e[a.uniqueId];void 0!==i?t[s]=i:e[a.uniqueId]=s}return t}_rebuild(e=!1,t=!1,r){if(this._count<1||e)return;let s=this._createInternaTextureIndexMapping();this.releaseInternalTextures(),this._createInternalTextures(),t&&(this._releaseTextures(),this._createTextures(r));let a=this._renderTarget.textures;for(let e=0;e<a.length;e++){let t=this._textures[e];void 0!==s[e]&&this._renderTarget.setTexture(a[s[e]],e),t._texture=a[e],t._texture&&(t._noMipmap=!t._texture.useMipMaps,t._useSRGBBuffer=t._texture._useSRGBBuffer)}1!==this.samples&&this._renderTarget.setSamples(this.samples,!this._drawOnlyOnFirstAttachmentByDefault,!0)}_createInternalTextures(){this._renderTarget=this._getEngine().createMultipleRenderTarget(this._size,this._multiRenderTargetOptions,!this._drawOnlyOnFirstAttachmentByDefault),this._texture=this._renderTarget.texture}_releaseTextures(){if(this._textures)for(let e=0;e<this._textures.length;e++)this._textures[e]._texture=null,this._textures[e].dispose()}_createTextures(e){let r=this._renderTarget.textures;this._textures=[];for(let s=0;s<r.length;s++){let a=new t.Texture(null,this.getScene());e?.[s]&&(a.name=e[s]),a._texture=r[s],a._texture&&(a._noMipmap=!a._texture.useMipMaps,a._useSRGBBuffer=a._texture._useSRGBBuffer),this._textures.push(a)}}setInternalTexture(e,r,s=!0){if(this.renderTarget&&(0===r&&(this._texture=e),this.renderTarget.setTexture(e,r,s),this.textures[r]||(this.textures[r]=new t.Texture(null,this.getScene()),this.textures[r].name=this._textureNames?.[r]??this.textures[r].name),this.textures[r]._texture=e,this.textures[r]._noMipmap=!e.useMipMaps,this.textures[r]._useSRGBBuffer=e._useSRGBBuffer,this._count=this.renderTarget.textures?this.renderTarget.textures.length:0,this._multiRenderTargetOptions.types&&(this._multiRenderTargetOptions.types[r]=e.type),this._multiRenderTargetOptions.samplingModes&&(this._multiRenderTargetOptions.samplingModes[r]=e.samplingMode),this._multiRenderTargetOptions.useSRGBBuffers&&(this._multiRenderTargetOptions.useSRGBBuffers[r]=e._useSRGBBuffer),this._multiRenderTargetOptions.targetTypes&&-1!==this._multiRenderTargetOptions.targetTypes[r])){let t;t=e.is2DArray?35866:e.isCube?34067:e.is3D?32879:3553,this._multiRenderTargetOptions.targetTypes[r]=t}}setLayerAndFaceIndex(e,t=-1,r=-1){this.textures[e]&&this.renderTarget&&(this._multiRenderTargetOptions.layerIndex&&(this._multiRenderTargetOptions.layerIndex[e]=t),this._multiRenderTargetOptions.faceIndex&&(this._multiRenderTargetOptions.faceIndex[e]=r),this.renderTarget.setLayerAndFaceIndex(e,t,r))}setLayerAndFaceIndices(e,t){this.renderTarget&&(this._multiRenderTargetOptions.layerIndex=e,this._multiRenderTargetOptions.faceIndex=t,this.renderTarget.setLayerAndFaceIndices(e,t))}get samples(){return this._samples}set samples(e){this._renderTarget?this._samples=this._renderTarget.setSamples(e):this._samples=e}resize(e){this._processSizeParameter(e),this._rebuild(!1,void 0,this._textureNames)}updateCount(e,t,r){this._multiRenderTargetOptions.textureCount=e,this._count=e;let s=[],a=[],i=[],n=[],o=[],l=[],h=[],u=[];this._textureNames=r,this._initTypes(e,s,a,i,n,o,l,h,u,t),this._multiRenderTargetOptions.types=s,this._multiRenderTargetOptions.samplingModes=a,this._multiRenderTargetOptions.useSRGBBuffers=i,this._multiRenderTargetOptions.formats=n,this._multiRenderTargetOptions.targetTypes=o,this._multiRenderTargetOptions.faceIndex=l,this._multiRenderTargetOptions.layerIndex=h,this._multiRenderTargetOptions.layerCounts=u,this._multiRenderTargetOptions.labels=r,this._rebuild(!1,!0,r)}_unbindFrameBuffer(e,t){this._renderTarget&&e.unBindMultiColorAttachmentFramebuffer(this._renderTarget,this.isCube,()=>{this.onAfterRenderObservable.notifyObservers(t)})}dispose(e=!1){this._releaseTextures(),e?this._texture=null:this.releaseInternalTextures(),super.dispose()}releaseInternalTextures(){let e=this._renderTarget?.textures;if(e){for(let t=e.length-1;t>=0;t--)this._textures[t]._texture=null;this._renderTarget?.dispose(),this._renderTarget=null}}}e.s(["MultiRenderTarget",0,o],95823)},74640,e=>{"use strict";var t=e.i(86823);class r extends t.Texture{constructor(e,r,s,a,i,n=!0,o=!1,l=3,h=0,u,_,p,d){if(super(null,i,!n,o,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,u),this.format=a,!this._engine)return;this._engine._caps.textureFloatLinearFiltering||1!==h||(l=1),this._engine._caps.textureHalfFloatLinearFiltering||2!==h||(l=1),this._texture=this._engine.createRawTexture(e,r,s,a,n,o,l,null,h,u??0,_??!1,d),this.wrapU=t.Texture.CLAMP_ADDRESSMODE,this.wrapV=t.Texture.CLAMP_ADDRESSMODE,this._waitingForData=!!p&&!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 r(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,a,i=!0,n=!1,o=3){return new r(e,t,s,1,a,i,n,o)}static CreateLuminanceAlphaTexture(e,t,s,a,i=!0,n=!1,o=3){return new r(e,t,s,2,a,i,n,o)}static CreateAlphaTexture(e,t,s,a,i=!0,n=!1,o=3){return new r(e,t,s,0,a,i,n,o)}static CreateRGBTexture(e,t,s,a,i=!0,n=!1,o=3,l=0,h=0,u=!1){return new r(e,t,s,4,a,i,n,o,l,h,u)}static CreateRGBATexture(e,t,s,a,i=!0,n=!1,o=3,l=0,h=0,u=!1,_=!1){return new r(e,t,s,5,a,i,n,o,l,h,u,_)}static CreateRGBAStorageTexture(e,t,s,a,i=!0,n=!1,o=3,l=0,h=!1){return new r(e,t,s,5,a,i,n,o,l,1,h)}static CreateRTexture(e,s,a,i,n=!0,o=!1,l=t.Texture.TRILINEAR_SAMPLINGMODE,h=1){return new r(e,s,a,6,i,n,o,l,h)}static CreateRStorageTexture(e,s,a,i,n=!0,o=!1,l=t.Texture.TRILINEAR_SAMPLINGMODE,h=1){return new r(e,s,a,6,i,n,o,l,h,1)}}e.s(["RawTexture",0,r])},82368,39312,e=>{"use strict";var t,r,s,a,i=e.i(72003),n=e.i(46541),o=e.i(50545),l=e.i(55206),h=e.i(23037),u=e.i(85789),_=e.i(42704),p=e.i(74640),d=e.i(95823),c=e.i(64073),f=e.i(66464),x=e.i(46202);let m=x.HighestCommonFactor,g={...x,TwoPi:2*Math.PI,Sign:Math.sign,Log2:Math.log2,HCF:m};var T=e.i(36838),S=e.i(72986),M=e.i(7720);let A="positions",b="partMatrices",y="partIndices",D=function(e){let t,r,s,a,i,n,o,l,h=0,u=null;e.onmessage=_=>{let p=_.data.command;if("positions"===p)t=_.data.positions,h=_.data.vertexCount;else if("positionsUpdate"===p)t&&_.data.data&&t.set(_.data.data,_.data.offset);else if("partMatrices"===p)a=_.data.partMatrices;else if("partIndices"===p)s=_.data.partIndices;else if("intervals"===p)u=_.data.intervals;else if("sort"===p){let p=_.data.cameraId,d=_.data.sortRequestId,c=_.data.rangeVersion,f=_.data.worldMatrix,x=_.data.cameraForward,m=_.data.cameraPosition;if(r=_.data.depthMix,!t||!x)return void e.postMessage({command:"sorted",depthMix:r,cameraId:p,sortRequestId:d,rangeVersion:c},[r.buffer]);let g=!1!==_.data.useCountingSort,T=!!_.data.logSortPerformance,S=_.data.rightHanded?-1:1,M=u,A=t.length/4,b=h,y=A;if(M){y=0;for(let e=1;e<M.length;e+=2)y+=M[e]}let D=Math.max(y+15&-16,16),I=x[0]*m[0]+x[1]*m[1]+x[2]*m[2],v=e=>[x[0]*e[0]+x[1]*e[1]+x[2]*e[2],x[0]*e[4]+x[1]*e[5]+x[2]*e[6],x[0]*e[8]+x[1]*e[9]+x[2]*e[10],x[0]*e[12]+x[1]*e[13]+x[2]*e[14]-I],w=globalThis.performance,C=T&&w?w.now():0;try{if(g){let h=new Uint32Array(r.buffer);if(!i||i.length<y){let e=Math.max(y,16);i=new Uint32Array(e),n=new Float32Array(e),o=new Uint32Array(e)}let u=!!(a&&a.length>0&&s&&s.length>0),_=[],x=0,m=0,g=0,T=0,I=0;if(u)_=a.map(e=>{let t=v(e);return t[0]*=S,t[1]*=S,t[2]*=S,t[3]*=S,t}),x=s.length;else{let e=v(f);m=e[0]*S,g=e[1]*S,T=e[2]*S,I=e[3]*S}let w=0,C=1/0,E=-1/0,R=_.length,P=!1,B=M?M.length:2;e:for(let e=0;e<B;e+=2){let r=M?M[e]:0,a=r+(M?M[e+1]:A);if(u)for(let e=r;e<a;e++){let r=4*e,a=s[e<x?e:x-1];if(a>=R){P=!0;break e}let o=_[a],l=o[0]*t[r]+o[1]*t[r+1]+o[2]*t[r+2]+o[3];i[w]=e,n[w]=l,w++,l<C&&(C=l),l>E&&(E=l)}else for(let e=r;e<a;e++){let r=4*e,s=m*t[r]+g*t[r+1]+T*t[r+2]+I;i[w]=e,n[w]=s,w++,s<C&&(C=s),s>E&&(E=s)}}if(P)return void e.postMessage({command:"sorted",depthMix:r,cameraId:p,sortRequestId:d,rangeVersion:c},[r.buffer]);let F=Math.max(10,Math.min(20,Math.round(Math.log2(Math.max(1,y)/4)))),U=2**F+1;l&&l.length===U?l.fill(0):l=new Uint32Array(U);let O=E-C;if(O>1e-12){let e=(U-1)/O,t=U-1;for(let r=0;r<y;r++){let s=(E-n[r])*e>>>0;s>t&&(s=t),o[r]=s,l[s]++}}else{for(let e=0;e<y;e++)o[e]=0;l[0]=y}for(let e=1;e<U;e++)l[e]+=l[e-1];for(let e=0;e<y;e++){let t=--l[o[e]];h[2*t]=i[e]}for(let e=y;e<D;e++)h[2*e]=b}else{let e=new Uint32Array(r.buffer),i=new Float32Array(r.buffer);if(M){let t=0;for(let r=0;r<M.length;r+=2){let s=M[r],a=M[r+1];for(let r=s;r<s+a;r++)e[2*t++]=r}for(;t<D;t++)e[2*t]=b}else for(let t=0;t<D;t++)e[2*t]=t;let n=!1;if(a&&a.length>0&&s&&s.length>0){let r=a.map(e=>v(e)),o=s.length;for(let a=0;a<D;a++){let l=e[2*a],h=s[Math.min(l,o-1)];if(h>=r.length){n=!0;break}let u=r[h];i[2*a+1]=u[0]*t[4*l+0]+u[1]*t[4*l+1]+u[2]*t[4*l+2]+u[3],e[2*a+1]=~e[2*a+1]}}else{let[r,s,a,n]=v(f);for(let o=0;o<D;o++){let l=e[2*o];i[2*o+1]=r*t[4*l+0]+s*t[4*l+1]+a*t[4*l+2]+n,e[2*o+1]=~e[2*o+1]}}n||r.sort()}}catch(e){console.error("Gaussian splat sort worker encountered an error (will retry next frame):",e)}T&&w&&console.log(`[GaussianSplatting] ${g?"counting":"legacy"} sort: ${y} splats in ${(w.now()-C).toFixed(2)}ms`),e.postMessage({command:"sorted",depthMix:r,cameraId:p,sortRequestId:d,rangeVersion:c},[r.buffer])}}},I="u">typeof _native,v=I?_native:null,w=(e,t)=>{let r=(1<<t)-1;return(e&r)/r},C=(e,t)=>{t.x=w(e>>>21,11),t.y=w(e>>>11,10),t.z=w(e,11)},E=(e,t)=>{t[0]=255*w(e>>>24,8),t[1]=255*w(e>>>16,8),t[2]=255*w(e>>>8,8),t[3]=255*w(e,8)},R=(e,t)=>{let r=1/(.5*Math.sqrt(2)),s=(w(e>>>20,10)-.5)*r,a=(w(e>>>10,10)-.5)*r,i=(w(e,10)-.5)*r,n=Math.sqrt(1-(s*s+a*a+i*i));switch(e>>>30){case 0:t.set(n,s,a,i);break;case 1:t.set(s,n,a,i);break;case 2:t.set(s,a,n,i);break;case 3:t.set(s,a,i,n)}};(t=s||(s={}))[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT",t[t.DOUBLE=3]="DOUBLE",t[t.UCHAR=4]="UCHAR",t[t.UNDEFINED=5]="UNDEFINED",(r=a||(a={}))[r.MIN_X=0]="MIN_X",r[r.MIN_Y=1]="MIN_Y",r[r.MIN_Z=2]="MIN_Z",r[r.MAX_X=3]="MAX_X",r[r.MAX_Y=4]="MAX_Y",r[r.MAX_Z=5]="MAX_Z",r[r.MIN_SCALE_X=6]="MIN_SCALE_X",r[r.MIN_SCALE_Y=7]="MIN_SCALE_Y",r[r.MIN_SCALE_Z=8]="MIN_SCALE_Z",r[r.MAX_SCALE_X=9]="MAX_SCALE_X",r[r.MAX_SCALE_Y=10]="MAX_SCALE_Y",r[r.MAX_SCALE_Z=11]="MAX_SCALE_Z",r[r.PACKED_POSITION=12]="PACKED_POSITION",r[r.PACKED_ROTATION=13]="PACKED_ROTATION",r[r.PACKED_SCALE=14]="PACKED_SCALE",r[r.PACKED_COLOR=15]="PACKED_COLOR",r[r.X=16]="X",r[r.Y=17]="Y",r[r.Z=18]="Z",r[r.SCALE_0=19]="SCALE_0",r[r.SCALE_1=20]="SCALE_1",r[r.SCALE_2=21]="SCALE_2",r[r.DIFFUSE_RED=22]="DIFFUSE_RED",r[r.DIFFUSE_GREEN=23]="DIFFUSE_GREEN",r[r.DIFFUSE_BLUE=24]="DIFFUSE_BLUE",r[r.OPACITY=25]="OPACITY",r[r.F_DC_0=26]="F_DC_0",r[r.F_DC_1=27]="F_DC_1",r[r.F_DC_2=28]="F_DC_2",r[r.F_DC_3=29]="F_DC_3",r[r.ROT_0=30]="ROT_0",r[r.ROT_1=31]="ROT_1",r[r.ROT_2=32]="ROT_2",r[r.ROT_3=33]="ROT_3",r[r.MIN_COLOR_R=34]="MIN_COLOR_R",r[r.MIN_COLOR_G=35]="MIN_COLOR_G",r[r.MIN_COLOR_B=36]="MIN_COLOR_B",r[r.MAX_COLOR_R=37]="MAX_COLOR_R",r[r.MAX_COLOR_G=38]="MAX_COLOR_G",r[r.MAX_COLOR_B=39]="MAX_COLOR_B",r[r.SH_0=40]="SH_0",r[r.SH_1=41]="SH_1",r[r.SH_2=42]="SH_2",r[r.SH_3=43]="SH_3",r[r.SH_4=44]="SH_4",r[r.SH_5=45]="SH_5",r[r.SH_6=46]="SH_6",r[r.SH_7=47]="SH_7",r[r.SH_8=48]="SH_8",r[r.SH_9=49]="SH_9",r[r.SH_10=50]="SH_10",r[r.SH_11=51]="SH_11",r[r.SH_12=52]="SH_12",r[r.SH_13=53]="SH_13",r[r.SH_14=54]="SH_14",r[r.SH_15=55]="SH_15",r[r.SH_16=56]="SH_16",r[r.SH_17=57]="SH_17",r[r.SH_18=58]="SH_18",r[r.SH_19=59]="SH_19",r[r.SH_20=60]="SH_20",r[r.SH_21=61]="SH_21",r[r.SH_22=62]="SH_22",r[r.SH_23=63]="SH_23",r[r.SH_24=64]="SH_24",r[r.SH_25=65]="SH_25",r[r.SH_26=66]="SH_26",r[r.SH_27=67]="SH_27",r[r.SH_28=68]="SH_28",r[r.SH_29=69]="SH_29",r[r.SH_30=70]="SH_30",r[r.SH_31=71]="SH_31",r[r.SH_32=72]="SH_32",r[r.SH_33=73]="SH_33",r[r.SH_34=74]="SH_34",r[r.SH_35=75]="SH_35",r[r.SH_36=76]="SH_36",r[r.SH_37=77]="SH_37",r[r.SH_38=78]="SH_38",r[r.SH_39=79]="SH_39",r[r.SH_40=80]="SH_40",r[r.SH_41=81]="SH_41",r[r.SH_42=82]="SH_42",r[r.SH_43=83]="SH_43",r[r.SH_44=84]="SH_44",r[r.SH_45=85]="SH_45",r[r.SH_46=86]="SH_46",r[r.SH_47=87]="SH_47",r[r.SH_48=88]="SH_48",r[r.SH_49=89]="SH_49",r[r.SH_50=90]="SH_50",r[r.SH_51=91]="SH_51",r[r.SH_52=92]="SH_52",r[r.SH_53=93]="SH_53",r[r.SH_54=94]="SH_54",r[r.SH_55=95]="SH_55",r[r.SH_56=96]="SH_56",r[r.SH_57=97]="SH_57",r[r.SH_58=98]="SH_58",r[r.SH_59=99]="SH_59",r[r.SH_60=100]="SH_60",r[r.SH_61=101]="SH_61",r[r.SH_62=102]="SH_62",r[r.SH_63=103]="SH_63",r[r.SH_64=104]="SH_64",r[r.SH_65=105]="SH_65",r[r.SH_66=106]="SH_66",r[r.SH_67=107]="SH_67",r[r.SH_68=108]="SH_68",r[r.SH_69=109]="SH_69",r[r.SH_70=110]="SH_70",r[r.SH_71=111]="SH_71",r[r.UNDEFINED=112]="UNDEFINED";class P extends l.Mesh{static _GetSplatDataBytes(e){return ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}static _GetSplatDataFloats(e){let t=P._GetSplatDataBytes(e),r=Float32Array.BYTES_PER_ELEMENT;if(t.byteLength%r!=0)throw Error(`Gaussian splat data byte length (${t.byteLength}) is not divisible by ${r} and cannot be reinterpreted as Float32 data.`);if(t.byteOffset%r!=0){let e=new Uint8Array(t.byteLength);return e.set(t),new Float32Array(e.buffer,0,t.byteLength/r)}return new Float32Array(t.buffer,t.byteOffset,t.byteLength/r)}static _BuildSplatRangeData(e,t){if(null===e)return{ranges:null,count:t,key:""};let r=[],s=0,a="";for(let i of e){let e=Math.max(0,Math.floor(i.offset)),n=Math.max(0,Math.min(t,e+Math.max(0,Math.floor(i.count)))-e);0!==n&&(r.push(e,n),s+=n,a+=`${e}:${n};`)}return{ranges:new Uint32Array(r),count:s,key:a}}get disableDepthSort(){return this._disableDepthSort}set disableDepthSort(e){!this._disableDepthSort&&e?(this._worker?.terminate(),this._worker=null,this._disableDepthSort=!0):this._disableDepthSort&&!e&&(this._disableDepthSort=!1,this._sortIsDirty=!0,this._instantiateWorker())}get viewDirectionFactor(){return i.Vector3.OneReadOnly}get shDegree(){return this._shDegree}set shDegree(e){let t=Math.max(0,Math.min(Math.round(e),this._maxShDegree));this._shDegree!==t&&(this._shDegree=t,this.material?.resetDrawCache())}get maxShDegree(){return this._maxShDegree}get splatCount(){return this._splatIndex?.length}get renderedSplatCount(){return this._activeSplatRanges?this._activeSplatRenderCount:this._vertexCount}setSplatIndexRanges(e){this._setSplatIndexRanges(e)}_setSplatIndexRanges(e){let t=P._BuildSplatRangeData(e,this._vertexCount);(null===this._activeSplatRanges?null===t.ranges:null!==t.ranges&&this._activeSplatRangeKey===t.key)||(this._activeSplatRanges=t.ranges,this._activeSplatRangeKey=t.key,this._activeSplatRenderCount=t.count,this._activeRangeVersion++,this._postIntervalsToWorker(),this._worker?(this._ensureDepthMixSize(Math.max(this._activeSplatRenderCount+15&-16,16)),this._sortIsDirty=!0):this._updateSplatIndexBuffer(this._vertexCount),this._postToWorker(!0))}get _isDepthSortSettled(){return this._readyToDisplay&&!this._sortIsDirty&&this._canPostToWorker}_ensureDepthMixSize(e){!I&&(this._depthMix&&this._depthMix.length===e&&0!==this._depthMix.buffer.byteLength||(this._depthMix=new BigInt64Array(e)))}_postIntervalsToWorker(){if(!this._worker)return;let e=new Uint32Array(this._activeSplatRanges?this._activeSplatRanges:[0,this._vertexCount]);this._worker.postMessage({command:"intervals",intervals:e},[e.buffer])}_setExternalWorkBuffer(e,t,r,s,a,i,n,o=0,l){this._covariancesATexture=t,this._covariancesBTexture=r,this._centersTexture=e,this._colorsTexture=s,this._splatPositions=a,this._vertexCount=i,n&&n.length&&(this._shTextures=n,this._maxShDegree=o,this._shDegree=o),l&&l.length>=3&&(this._rotationsATexture=l[0],this._rotationsBTexture=l[1],this._rotationScaleTexture=l[2],this._needsRotationScaleTextures=!0),this._activeSplatRanges=null,this._activeSplatRangeKey="",this._activeSplatRenderCount=0,this._readyToDisplay=!1,this._instantiateWorker(),this.setEnabled(!0)}get splatsData(){return this._keepInRam?this._splatsData:null}get shData(){return this._keepInRam?this._shData:null}get splatSizeRange(){return isFinite(this._splatSizeMin)&&isFinite(this._splatSizeMax)?{min:this._splatSizeMin,max:this._splatSizeMax}:null}get covariancesATexture(){return this._covariancesATexture}get covariancesBTexture(){return this._covariancesBTexture}get centersTexture(){return this._centersTexture}get colorsTexture(){return this._colorsTexture}get rotationsATexture(){return this._rotationsATexture}get rotationsBTexture(){return this._rotationsBTexture}get rotationScaleTexture(){return this._rotationScaleTexture}get needsRotationScaleTextures(){return this._needsRotationScaleTextures}set needsRotationScaleTextures(e){this._needsRotationScaleTextures!==e&&(this._needsRotationScaleTextures=e,e&&this._covariancesATexture&&(this._splatsData?this.updateData(this._splatsData,this._shData??void 0,{flipY:!1},void 0,this._shDegree):u.Logger.Error("GaussianSplattingMeshBase: needsRotationScaleTextures was enabled after the mesh was already loaded, but the splat data is not kept in RAM. The rotation and scale matrix textures cannot be initialized. Please reload the mesh data via updateData() or construct with keepInRam=true.")))}get shTextures(){return this._shTextures}get useSog(){return this._useSog}get sogParams(){return this._sogParams}setSogTextureData(e){if(this._useSog=!0,this._sogParams?.codebookTexture?.dispose(),this._sogParams=e,this._vertexCount=e.splatCount,this._shDegree=e.shDegree??0,this._maxShDegree=this._shDegree,this._splatPositions=e.positions,this._covariancesATexture?.dispose(),this._covariancesBTexture?.dispose(),this._centersTexture?.dispose(),this._colorsTexture?.dispose(),this._rotationsATexture?.dispose(),this._shTextures)for(let e of this._shTextures)e.dispose();this._centersTexture=e.meansTextureL,this._covariancesATexture=e.meansTextureU,this._covariancesBTexture=e.scalesTexture,this._rotationsATexture=e.quatsTexture,this._colorsTexture=e.sh0Texture;let t=[];e.shCentroidsTexture&&t.push(e.shCentroidsTexture),e.shLabelsTexture&&t.push(e.shLabelsTexture),this._shTextures=t.length?t:null,this._material?.resetDrawCache();let r=e.meansTextureL.getSize();this._textureSize.x=r.width,this._textureSize.y=r.height,this._updateSplatIndexBuffer(this._vertexCount),this._instantiateWorker();let s=e.positions,a=new i.Vector3(1/0,1/0,1/0),n=new i.Vector3(-1/0,-1/0,-1/0);for(let e=0;e<this._vertexCount;e++){let t=s[4*e+0],r=s[4*e+1],i=s[4*e+2];t<a.x&&(a.x=t),r<a.y&&(a.y=r),i<a.z&&(a.z=i),t>n.x&&(n.x=t),r>n.y&&(n.y=r),i>n.z&&(n.z=i)}this.getBoundingInfo().reConstruct(a,n,this.getWorldMatrix()),this.setEnabled(!0),this._sortIsDirty=!0}get kernelSize(){return this._material instanceof n.GaussianSplattingMaterial?this._material.kernelSize:0}get compensation(){return this._material instanceof n.GaussianSplattingMaterial&&this._material.compensation}get minPixelSize(){return this._material instanceof n.GaussianSplattingMaterial?this._material.minPixelSize:0}set minPixelSize(e){this._material instanceof n.GaussianSplattingMaterial&&(this._material.minPixelSize=Math.max(0,e))}set material(e){this._material=e,this._material.backFaceCulling=!1,this._material.cullBackFaces=!1,e.resetDrawCache()}get material(){return this._material}static _MakeSplatGeometryForMesh(e){let t=new h.VertexData,r=[-2,-2,0,2,-2,0,2,2,0,-2,2,0],s=[0,1,2,0,2,3],a=[],i=[];for(let e=0;e<P._BatchSize;e++){for(let t=0;t<12;t++)2==t||5==t||8==t||11==t?a.push(e):a.push(r[t]);i.push(s.map(t=>t+4*e))}t.positions=a,t.indices=i.flat(),t.applyToMesh(e)}constructor(e,t=null,r=null,s=!1){super(e,r),this.safeOrbitCameraLimits=null,this._vertexCount=0,this._worker=null,this._modelViewProjectionMatrix=i.Matrix.Identity(),this._canPostToWorker=!0,this._readyToDisplay=!1,this._sortRequestId=0,this._activeRangeVersion=0,this._hasRenderedOnce=!1,this._covariancesATexture=null,this._covariancesBTexture=null,this._centersTexture=null,this._colorsTexture=null,this._mrtAtlas=null,this._useMrtAtlas=!1,this._shMrtAtlas=null,this._useShMrtAtlas=!1,this._shMrtAtlasTextureCount=0,this._rotationsATexture=null,this._rotationsBTexture=null,this._rotationScaleTexture=null,this._rotMrtAtlas=null,this._useRotMrtAtlas=!1,this._rotationDataA=null,this._rotationDataB=null,this._rotationScaleData=null,this._needsRotationScaleTextures=!1,this._splatPositions=null,this._splatIndex=null,this._shTextures=null,this._splatsData=null,this._shData=null,this._textureSize=new i.Vector2(0,0),this._keepInRam=!1,this._alwaysRetainSplatsData=!1,this._flipY=!1,this._delayedTextureUpdate=null,this._useRGBACovariants=!1,this._useSog=!1,this._sogParams=null,this._material=null,this._tmpCovariances=[0,0,0,0,0,0],this._splatSizeMin=1/0,this._splatSizeMax=-1/0,this._sortIsDirty=!1,this._activeSplatRanges=null,this._activeSplatRangeKey="",this._activeSplatRenderCount=0,this._cachedBoundingMin=null,this._cachedBoundingMax=null,this._shDegree=0,this._maxShDegree=0,this._cameraViewInfos=new Map,this.onPartCountChangedObservable=new _.Observable,this.onPartRemovedObservable=new _.Observable,this._onBeforeAtlasRebuildObservable=new _.Observable,this._onAfterAtlasRebuildObservable=new _.Observable,this.viewUpdateThreshold=P._DefaultViewUpdateThreshold,this._disableDepthSort=!1,this._loadingPromise=null,this._updateTextureFromData=(e,t,r,s,a)=>{this._getTextureDataUpdateEngine().updateTextureData(e.getInternalTexture(),t,0,s,r,a,0,0,!1)},this._updateTextureFromDataRect=(e,t,r,s,a,i)=>{this._getTextureDataUpdateEngine().updateTextureData(e.getInternalTexture(),t,r,s,a,i,0,0,!1)},this.subMeshes=[],new o.SubMesh(0,0,4*P._BatchSize,0,6*P._BatchSize,this),this.setEnabled(!1),this._useRGBACovariants=!this.getEngine().isWebGPU&&1===this.getEngine().version,function(e){if(I)return;let t=e.customAnimationFrameRequester;if(t?._gsInterFrameYield)return t._refCount++;if(t)return;let r=0,s=0;e.customAnimationFrameRequester={_gsInterFrameYield:!0,_refCount:1,requestAnimationFrame:e=>r=setTimeout(()=>{s=requestAnimationFrame(e)},0),cancelAnimationFrame:e=>{clearTimeout(r),s>0&&cancelAnimationFrame(s),r=0,s=0}}}(this.getEngine()),this._keepInRam=s,t&&(this._loadingPromise=this.loadFileAsync(t));const a=new n.GaussianSplattingMaterial(this.name+"_material",this._scene);a.setSourceMesh(this),a.doNotSerialize=!0,this._material=a,this._scene.onCameraRemovedObservable.add(e=>{let t=e.uniqueId,r=this._cameraViewInfos.get(t);r&&(this._geometry===r.mesh.geometry&&(this._geometry=null),r.mesh.dispose(),this._cameraViewInfos.delete(t))})}getLoadingPromise(){return this._loadingPromise}getClassName(){return"GaussianSplattingMeshBase"}getTotalVertices(){return this._vertexCount}isReady(e=!1){if(!super.isReady(e,!0))return!1;if(!this._readyToDisplay)return this._postToWorker(!0),!1;if(!this._hasRenderedOnce&&!this._disableDepthSort){let e=this._scene.activeCameras?.length?this._scene.activeCameras:[this._scene.activeCamera],t=this.computeWorldMatrix(!0),r=!1;for(let s of e){if(!s)continue;let e=this._cameraViewInfos.get(s.uniqueId);if(!e||!e.splatIndexBufferSet||e.sortAppliedId!==e.sortRequestId){r=!0;continue}this._isSortStateDirty(e,t,s,!0)&&(r=!0)}if(r)return this._postToWorker(!0),!1}if(!this._geometry&&this._cameraViewInfos.size&&(this._geometry=this._cameraViewInfos.values().next().value.mesh.geometry),this.material&&this.material.shadowDepthWrapper){let e=this._scene.getEngine(),t=e.currentRenderPassId;try{for(let t of this._scene.lights){let r=t.getShadowGenerator();if(!r)continue;let s=r.getShadowMap(),a=s?.renderPassIds;if(a&&0!==a.length){for(let t=0;t<a.length;++t)for(let s of(e.currentRenderPassId=a[t],this.subMeshes))if(!r.isReady(s,!0,!1))return!1}}}finally{e.currentRenderPassId=t}}return!0}_getCameraDirection(e){let t=e.getViewMatrix(),r=e.getProjectionMatrix(),s=i.TmpVectors.Matrix[0];t.multiplyToRef(r,s);let a=this.computeWorldMatrix(!0),n=i.TmpVectors.Matrix[1];a.multiplyToRef(t,n),a.multiplyToRef(s,this._modelViewProjectionMatrix);let o=i.TmpVectors.Vector3[1];return o.set(n.m[2],n.m[6],n.m[10]),o.normalize(),o}_isSortStateDirty(e,t,r,s=!1){let a=t.m,i=e.sortWorldMatrix.m;for(let e=0;e<i.length;e++)if(!g.WithinEpsilon(i[e],a[e],this.viewUpdateThreshold))return!0;if(s)return!1;let n=r.getViewMatrix();if(!g.WithinEpsilon(e.sortCameraForward.x,n.m[2],this.viewUpdateThreshold)||!g.WithinEpsilon(e.sortCameraForward.y,n.m[6],this.viewUpdateThreshold)||!g.WithinEpsilon(e.sortCameraForward.z,n.m[10],this.viewUpdateThreshold))return!0;let o=r.globalPosition;return!g.WithinEpsilon(e.sortCameraPosition.x,o.x,this.viewUpdateThreshold)||!g.WithinEpsilon(e.sortCameraPosition.y,o.y,this.viewUpdateThreshold)||!g.WithinEpsilon(e.sortCameraPosition.z,o.z,this.viewUpdateThreshold)}_postToWorker(e=!1){let t=this._scene.getFrameId(),r=!1;this._cameraViewInfos.forEach(e=>{e.frameIdLastUpdate!==t&&(r=!0)});let s=this._scene.activeCameras?.length?this._scene.activeCameras:[this._scene.activeCamera],a=[];s.forEach(e=>{if(!e)return;let r=e.uniqueId,s=this._cameraViewInfos.get(r);if(s)a.push(s);else{let s=new l.Mesh(this.name+"_cameraMesh_"+r,this._scene);if(s.doNotSerialize=!0,s.reservedDataStore={hidden:!0},s.setEnabled(!1),s.material=this.material,s.material&&s.material instanceof n.GaussianSplattingMaterial){let e=s.material;e.getSourceMesh()||e.setSourceMesh(this)}P._MakeSplatGeometryForMesh(s);let o={camera:e,cameraDirection:new i.Vector3(0,0,0),sortWorldMatrix:i.Matrix.Identity(),sortCameraForward:new i.Vector3(0,0,0),sortCameraPosition:new i.Vector3(0,0,0),sortRequestId:0,sortAppliedId:0,mesh:s,frameIdLastUpdate:t,splatIndexBufferSet:!1};a.push(o),this._cameraViewInfos.set(r,o)}}),a.sort((e,t)=>e.splatIndexBufferSet!==t.splatIndexBufferSet?e.splatIndexBufferSet?1:-1:e.frameIdLastUpdate-t.frameIdLastUpdate);let o=!!v?.sortSplats&&!!this._splatPositions&&!!this._splatIndex,h=!this._disableDepthSort&&(this._worker||o);if((e||r)&&h&&(this._scene.activeCameras?.length||this._scene.activeCamera)&&this._canPostToWorker){let r=this.computeWorldMatrix(!0);a.forEach(s=>{let a=s.camera,i=this._getCameraDirection(a);if((e||this._isSortStateDirty(s,r,a))&&this._canPostToWorker){let e=a.getViewMatrix();s.cameraDirection.copyFrom(i),s.sortWorldMatrix.copyFrom(r),s.sortCameraForward.set(e.m[2],e.m[6],e.m[10]),s.sortCameraPosition.copyFrom(a.globalPosition),s.sortRequestId=++this._sortRequestId,s.frameIdLastUpdate=t,this._canPostToWorker=!1,this._worker?this._worker.postMessage({command:"sort",worldMatrix:r.m,cameraForward:[e.m[2],e.m[6],e.m[10]],cameraPosition:[a.globalPosition.x,a.globalPosition.y,a.globalPosition.z],depthMix:this._depthMix,cameraId:a.uniqueId,sortRequestId:s.sortRequestId,rangeVersion:this._activeRangeVersion,useCountingSort:P.UseCountingSort,rightHanded:this._scene.useRightHandedSystem,logSortPerformance:P.LogSortPerformance},[this._depthMix.buffer]):v?.sortSplats&&(this._activeSplatRanges?this._updateSplatIndexBuffer(this._vertexCount):v.sortSplats(this._modelViewProjectionMatrix,this._splatPositions,this._splatIndex,this._scene.useRightHandedSystem),s.splatIndexBufferSet?s.mesh.thinInstanceBufferUpdated("splatIndex"):(s.mesh.thinInstanceSetBuffer("splatIndex",this._splatIndex,16,!1),s.splatIndexBufferSet=!0),s.sortAppliedId=s.sortRequestId,this._canPostToWorker=!0,this._readyToDisplay=!0)}})}else this._disableDepthSort&&(this._splatIndex&&(a.forEach(e=>{e.splatIndexBufferSet||(e.mesh.thinInstanceSetBuffer("splatIndex",this._splatIndex,16,!1),e.splatIndexBufferSet=!0)}),this._readyToDisplay=!0),this._canPostToWorker=!0)}render(e,t,r){this._postToWorker(),!this._geometry&&this._cameraViewInfos.size&&(this._geometry=this._cameraViewInfos.values().next().value.mesh.geometry);let s=this._scene.activeCamera.uniqueId,a=this._cameraViewInfos.get(s);if(!a||!a.splatIndexBufferSet)return this;this.onBeforeRenderObservable&&this.onBeforeRenderObservable.notifyObservers(this);let i=a.mesh;i.getWorldMatrix().copyFrom(this.getWorldMatrix());let n=this._scene.getEngine().currentRenderPassId,o=this.getMaterialForRenderPass(n);o&&i.setMaterialForRenderPass(n,o);let l=i.render(e,t,r);return this._hasRenderedOnce=!0,o&&i.setMaterialForRenderPass(n,void 0),this.onAfterRenderObservable&&this.onAfterRenderObservable.notifyObservers(this),l}static _TypeNameToEnum(e){switch(e){case"float":return 0;case"int":return 1;case"uint":return 2;case"double":return 3;case"uchar":return 4}return 5}static _ValueNameToEnum(e){switch(e){case"min_x":return 0;case"min_y":return 1;case"min_z":return 2;case"max_x":return 3;case"max_y":return 4;case"max_z":return 5;case"min_scale_x":return 6;case"min_scale_y":return 7;case"min_scale_z":return 8;case"max_scale_x":return 9;case"max_scale_y":return 10;case"max_scale_z":return 11;case"packed_position":return 12;case"packed_rotation":return 13;case"packed_scale":return 14;case"packed_color":return 15;case"x":return 16;case"y":return 17;case"z":return 18;case"scale_0":return 19;case"scale_1":return 20;case"scale_2":return 21;case"diffuse_red":case"red":return 22;case"diffuse_green":case"green":return 23;case"diffuse_blue":case"blue":return 24;case"f_dc_0":return 26;case"f_dc_1":return 27;case"f_dc_2":return 28;case"f_dc_3":return 29;case"opacity":return 25;case"rot_0":return 30;case"rot_1":return 31;case"rot_2":return 32;case"rot_3":return 33;case"min_r":return 34;case"min_g":return 35;case"min_b":return 36;case"max_r":return 37;case"max_g":return 38;case"max_b":return 39;case"f_rest_0":return 40;case"f_rest_1":return 41;case"f_rest_2":return 42;case"f_rest_3":return 43;case"f_rest_4":return 44;case"f_rest_5":return 45;case"f_rest_6":return 46;case"f_rest_7":return 47;case"f_rest_8":return 48;case"f_rest_9":return 49;case"f_rest_10":return 50;case"f_rest_11":return 51;case"f_rest_12":return 52;case"f_rest_13":return 53;case"f_rest_14":return 54;case"f_rest_15":return 55;case"f_rest_16":return 56;case"f_rest_17":return 57;case"f_rest_18":return 58;case"f_rest_19":return 59;case"f_rest_20":return 60;case"f_rest_21":return 61;case"f_rest_22":return 62;case"f_rest_23":return 63;case"f_rest_24":return 64;case"f_rest_25":return 65;case"f_rest_26":return 66;case"f_rest_27":return 67;case"f_rest_28":return 68;case"f_rest_29":return 69;case"f_rest_30":return 70;case"f_rest_31":return 71;case"f_rest_32":return 72;case"f_rest_33":return 73;case"f_rest_34":return 74;case"f_rest_35":return 75;case"f_rest_36":return 76;case"f_rest_37":return 77;case"f_rest_38":return 78;case"f_rest_39":return 79;case"f_rest_40":return 80;case"f_rest_41":return 81;case"f_rest_42":return 82;case"f_rest_43":return 83;case"f_rest_44":return 84;case"f_rest_45":return 85;case"f_rest_46":return 86;case"f_rest_47":return 87;case"f_rest_48":return 88;case"f_rest_49":return 89;case"f_rest_50":return 90;case"f_rest_51":return 91;case"f_rest_52":return 92;case"f_rest_53":return 93;case"f_rest_54":return 94;case"f_rest_55":return 95;case"f_rest_56":return 96;case"f_rest_57":return 97;case"f_rest_58":return 98;case"f_rest_59":return 99;case"f_rest_60":return 100;case"f_rest_61":return 101;case"f_rest_62":return 102;case"f_rest_63":return 103;case"f_rest_64":return 104;case"f_rest_65":return 105;case"f_rest_66":return 106;case"f_rest_67":return 107;case"f_rest_68":return 108;case"f_rest_69":return 109;case"f_rest_70":return 110;case"f_rest_71":return 111}return 112}static ParseHeader(e){var t;let r,s=new Uint8Array(e),a=new TextDecoder().decode(s.slice(0,10240)),i="end_header\n",n=a.indexOf(i);if(n<0||!a)return null;let o=parseInt(/element vertex (\d+)\n/.exec(a)[1]),l=/element chunk (\d+)\n/.exec(a),h=0;l&&(h=parseInt(l[1]));let _=0,p=0,d={double:8,int:4,uint:4,float:4,short:2,ushort:2,uchar:1,list:0};(t=r||(r={}))[t.Vertex=0]="Vertex",t[t.Chunk=1]="Chunk",t[t.SH=2]="SH",t[t.Unused=3]="Unused";let c=1,f=[],x=[],m=a.slice(0,n).split("\n"),g=0;for(let e of m)if(e.startsWith("property ")){let[,t,r]=e.split(" "),s=P._ValueNameToEnum(r);112!=s&&(s>=111?g=4:s>=84?g=Math.max(g,3):s>=63?g=Math.max(g,2):s>=48&&(g=Math.max(g,1)));let a=P._TypeNameToEnum(t);1==c?(x.push({value:s,type:a,offset:p}),p+=d[t]):0==c?(f.push({value:s,type:a,offset:_}),_+=d[t]):2==c&&f.push({value:s,type:a,offset:_}),d[t]||u.Logger.Warn(`Unsupported property type: ${t}.`)}else if(e.startsWith("element ")){let[,t]=e.split(" ");c="chunk"==t?1:"vertex"==t?0:"sh"==t?2:3}let T=new DataView(e,n+i.length),S=new ArrayBuffer(P._RowOutputLength*o),M=null,A=0;return g&&(M=new ArrayBuffer((A=3*((g+1)*(g+1)-1))*o)),{vertexCount:o,chunkCount:h,rowVertexLength:_,rowChunkLength:p,vertexProperties:f,chunkProperties:x,dataView:T,buffer:S,shDegree:g,shCoefficientCount:A,shBuffer:M}}static _GetCompressedChunks(e,t){if(!e.chunkCount)return null;let r=e.dataView,s=Array(e.chunkCount);for(let a=0;a<e.chunkCount;a++){let n={min:new i.Vector3,max:new i.Vector3,minScale:new i.Vector3,maxScale:new i.Vector3,minColor:new i.Vector3(0,0,0),maxColor:new i.Vector3(1,1,1)};s[a]=n;for(let s=0;s<e.chunkProperties.length;s++){let a,i=e.chunkProperties[s];if(0===i.type)switch(a=r.getFloat32(i.offset+t.value,!0),i.value){case 0:n.min.x=a;break;case 1:n.min.y=a;break;case 2:n.min.z=a;break;case 3:n.max.x=a;break;case 4:n.max.y=a;break;case 5:n.max.z=a;break;case 6:n.minScale.x=a;break;case 7:n.minScale.y=a;break;case 8:n.minScale.z=a;break;case 9:n.maxScale.x=a;break;case 10:n.maxScale.y=a;break;case 11:n.maxScale.z=a;break;case 34:n.minColor.x=a;break;case 35:n.minColor.y=a;break;case 36:n.minColor.z=a;break;case 37:n.maxColor.x=a;break;case 38:n.maxColor.y=a;break;case 39:n.maxColor.z=a}}t.value+=e.rowChunkLength}return s}static _GetSplat(e,t,r,s){let a=i.TmpVectors.Quaternion[0],n=i.TmpVectors.Vector3[0],o=P._RowOutputLength,l=e.buffer,h=e.dataView,u=new Float32Array(l,t*o,3),_=new Float32Array(l,t*o+12,3),p=new Uint8ClampedArray(l,t*o+24,4),d=new Uint8ClampedArray(l,t*o+28,4),c=null;e.shBuffer&&(c=new Uint8ClampedArray(e.shBuffer,t*e.shCoefficientCount,e.shCoefficientCount));let f=t>>8,x=255,m=0,T=0,S=0,M=[];for(let i=0;i<e.vertexProperties.length;i++){let o,l=e.vertexProperties[i];switch(l.type){case 0:o=h.getFloat32(s.value+l.offset,!0);break;case 1:o=h.getInt32(s.value+l.offset,!0);break;case 2:o=h.getUint32(s.value+l.offset,!0);break;case 3:o=h.getFloat64(s.value+l.offset,!0);break;case 4:o=h.getUint8(s.value+l.offset);break;default:continue}switch(l.value){case 12:{let e=r[f];C(o,n),u[0]=g.Lerp(e.min.x,e.max.x,n.x),u[1]=g.Lerp(e.min.y,e.max.y,n.y),u[2]=g.Lerp(e.min.z,e.max.z,n.z)}break;case 13:R(o,a),x=a.x,m=a.y,T=a.z,S=a.w;break;case 14:{let e=r[f];C(o,n),_[0]=Math.exp(g.Lerp(e.minScale.x,e.maxScale.x,n.x)),_[1]=Math.exp(g.Lerp(e.minScale.y,e.maxScale.y,n.y)),_[2]=Math.exp(g.Lerp(e.minScale.z,e.maxScale.z,n.z))}break;case 15:{let e=r[f];E(o,p),p[0]=255*g.Lerp(e.minColor.x,e.maxColor.x,p[0]/255),p[1]=255*g.Lerp(e.minColor.y,e.maxColor.y,p[1]/255),p[2]=255*g.Lerp(e.minColor.z,e.maxColor.z,p[2]/255)}break;case 16:u[0]=o;break;case 17:u[1]=o;break;case 18:u[2]=o;break;case 19:_[0]=Math.exp(o);break;case 20:_[1]=Math.exp(o);break;case 21:_[2]=Math.exp(o);break;case 22:p[0]=o;break;case 23:p[1]=o;break;case 24:p[2]=o;break;case 26:p[0]=(.5+P._SH_C0*o)*255;break;case 27:p[1]=(.5+P._SH_C0*o)*255;break;case 28:p[2]=(.5+P._SH_C0*o)*255;break;case 29:p[3]=(.5+P._SH_C0*o)*255;break;case 25:p[3]=1/(1+Math.exp(-o))*255;break;case 30:x=o;break;case 31:m=o;break;case 32:T=o;break;case 33:S=o}if(c&&l.value>=40&&l.value<=111){let r=l.value-40;if(4==l.type&&e.chunkCount){let s=h.getUint8(e.rowChunkLength*e.chunkCount+e.vertexCount*e.rowVertexLength+t*e.shCoefficientCount+r);M[r]=(8/255*s-4)*127.5+127.5}else{let e=g.Clamp(127.5*o+127.5,0,255);M[r]=e}}}if(c){let t=1==e.shDegree?3:2==e.shDegree?8:3==e.shDegree?15:24;for(let e=0;e<t;e++)c[3*e+0]=M[e],c[3*e+1]=M[e+t],c[3*e+2]=M[e+2*t]}a.set(m,T,S,x),a.normalize(),d[0]=127.5*a.w+127.5,d[1]=127.5*a.x+127.5,d[2]=127.5*a.y+127.5,d[3]=127.5*a.z+127.5,s.value+=e.rowVertexLength}static*ConvertPLYWithSHToSplat(e,t=!1){let r=P.ParseHeader(e);if(!r)return{buffer:e};let s={value:0},a=P._GetCompressedChunks(r,s);for(let e=0;e<r.vertexCount;e++)P._GetSplat(r,e,a,s),e%P._PlyConversionBatchSize==0&&t&&(yield);let i=null;if(r.shDegree&&r.shBuffer){let e=Math.ceil(r.shCoefficientCount/16),t=0,s=new Uint8Array(r.shBuffer);i=[];let a=r.vertexCount,n=S.EngineStore.LastCreatedEngine;if(n){let o=n.getCaps().maxTextureSize;i=B(e,Math.ceil(a/o)*o*16);for(let e=0;e<a;e++)for(let a=0;a<r.shCoefficientCount;a++){let r=s[t++];i[Math.floor(a/16)][a%16+16*e]=r}}}return{buffer:r.buffer,sh:i,shDegree:r.shDegree}}static*ConvertPLYToSplat(e,t=!1){let r=P.ParseHeader(e);if(!r)return e;let s={value:0},a=P._GetCompressedChunks(r,s);for(let e=0;e<r.vertexCount;e++)P._GetSplat(r,e,a,s),e%P._PlyConversionBatchSize==0&&t&&(yield);return r.buffer}static async ConvertPLYToSplatAsync(e){return await (0,T.runCoroutineAsync)(P.ConvertPLYToSplat(e,!0),(0,T.createYieldingScheduler)())}static async ConvertPLYWithSHToSplatAsync(e){return await (0,T.runCoroutineAsync)(P.ConvertPLYWithSHToSplat(e,!0),(0,T.createYieldingScheduler)())}async loadDataAsync(e){return await this.updateDataAsync(e)}async loadFileAsync(e,t){await (0,M.ImportMeshAsync)(e,t||S.EngineStore.LastCreatedScene,{pluginOptions:{splat:{gaussianSplattingMesh:this}}})}dispose(e){var t;let r;if(this._mrtAtlas?(this._mrtAtlas.dispose(),this._mrtAtlas=null,this._covariancesATexture=this._covariancesBTexture=this._centersTexture=this._colorsTexture=null):(this._covariancesATexture?.dispose(),this._covariancesBTexture?.dispose(),this._centersTexture?.dispose(),this._colorsTexture?.dispose()),this._shMrtAtlas){for(let e of this._shMrtAtlas)e.dispose();if(this._shTextures)for(let e=this._shMrtAtlas.length;e<this._shTextures.length;e++)this._shTextures[e].dispose();this._shMrtAtlas=null}else if(this._shTextures)for(let e of this._shTextures)e.dispose();this._shTextures=null,this._rotMrtAtlas?(this._rotMrtAtlas.dispose(),this._rotMrtAtlas=null):(this._rotationsATexture?.dispose(),this._rotationsBTexture?.dispose(),this._rotationScaleTexture?.dispose()),this._sogParams?.codebookTexture?.dispose(),this._rotationsATexture=null,this._rotationsBTexture=null,this._rotationScaleTexture=null,this._rotationDataA=null,this._rotationDataB=null,this._rotationScaleData=null,this._covariancesATexture=null,this._covariancesBTexture=null,this._centersTexture=null,this._colorsTexture=null,this._shTextures=null,this._cachedBoundingMin=null,this._cachedBoundingMax=null,r=(t=this.getEngine()).customAnimationFrameRequester,r?._gsInterFrameYield&&(r._refCount--,0===r._refCount&&(t.customAnimationFrameRequester=null)),this._worker?.terminate(),this._worker=null,this.onPartCountChangedObservable.clear(),this.onPartRemovedObservable.clear(),this._cameraViewInfos.forEach(e=>{e.mesh.dispose()}),super.dispose(e,!0)}_copyTextures(e){if(this._covariancesATexture=e.covariancesATexture?.clone(),this._covariancesBTexture=e.covariancesBTexture?.clone(),this._centersTexture=e.centersTexture?.clone(),this._colorsTexture=e.colorsTexture?.clone(),e._shTextures)for(let t of(this._shTextures=[],e._shTextures))this._shTextures?.push(t.clone());e._rotationsATexture&&(this._rotationsATexture=e._rotationsATexture.clone(),this._rotationsBTexture=e._rotationsBTexture?.clone(),this._rotationScaleTexture=e._rotationScaleTexture?.clone())}clone(e=""){let t=new P(e,void 0,this.getScene());t._copySource(this),t.makeGeometryUnique(),t._vertexCount=this._vertexCount,t._copyTextures(this),t._modelViewProjectionMatrix=i.Matrix.Identity(),t._splatPositions=this._splatPositions,t._readyToDisplay=!1,t._hasRenderedOnce=!1,t._disableDepthSort=this._disableDepthSort,t._instantiateWorker();let r=this.getBoundingInfo();return t.getBoundingInfo().reConstruct(r.minimum,r.maximum,this.getWorldMatrix()),t.forcedInstanceCount=this.forcedInstanceCount,t.setEnabled(!0),t}_makeEmptySplat(e,t,r,s){let a=this._useRGBACovariants?4:2;this._splatPositions[4*e+0]=0,this._splatPositions[4*e+1]=0,this._splatPositions[4*e+2]=0,t[4*e+0]=(0,f.ToHalfFloat)(0),t[4*e+1]=(0,f.ToHalfFloat)(0),t[4*e+2]=(0,f.ToHalfFloat)(0),t[4*e+3]=(0,f.ToHalfFloat)(0),r[e*a+0]=(0,f.ToHalfFloat)(0),r[e*a+1]=(0,f.ToHalfFloat)(0),s[4*e+3]=0}_makeSplat(e,t,r,s,a,n,o,l,h,u=e,_=e){let p=i.TmpVectors.Matrix[0],d=i.TmpVectors.Matrix[1],c=i.TmpVectors.Quaternion[0],x=this._useRGBACovariants?4:2,m=t[8*u+0],g=t[8*u+1]*(h?-1:1),T=t[8*u+2];if(this._splatPositions[4*e+0]=m,this._splatPositions[4*e+1]=g,this._splatPositions[4*e+2]=T,o.minimizeInPlaceFromFloats(m,g,T),l.maximizeInPlaceFromFloats(m,g,T),c.set((r[32*u+28+1]-127.5)/127.5,(r[32*u+28+2]-127.5)/127.5,(r[32*u+28+3]-127.5)/127.5,-(r[32*u+28+0]-127.5)/127.5),c.normalize(),c.toRotationMatrix(p),i.Matrix.ScalingToRef(2*t[8*u+3+0],2*t[8*u+3+1],2*t[8*u+3+2],d),this._needsRotationScaleTextures){let t=this._splatPositions.length;(!this._rotationDataA||this._rotationDataA.length<t)&&(this._rotationDataA=new Uint16Array(t),this._rotationDataB=new Uint16Array(t),this._rotationScaleData=new Uint16Array(t));let r=this._rotationDataA,s=this._rotationDataB,a=this._rotationScaleData,i=p.m,n=d.m;r[4*e+0]=(0,f.ToHalfFloat)(i[0]),r[4*e+1]=(0,f.ToHalfFloat)(i[1]),r[4*e+2]=(0,f.ToHalfFloat)(i[2]),r[4*e+3]=(0,f.ToHalfFloat)(i[4]),s[4*e+0]=(0,f.ToHalfFloat)(i[5]),s[4*e+1]=(0,f.ToHalfFloat)(i[6]),s[4*e+2]=(0,f.ToHalfFloat)(i[8]),s[4*e+3]=(0,f.ToHalfFloat)(i[9]),a[4*e+0]=(0,f.ToHalfFloat)(i[10]),a[4*e+1]=(0,f.ToHalfFloat)(n[0]),a[4*e+2]=(0,f.ToHalfFloat)(n[5]),a[4*e+3]=(0,f.ToHalfFloat)(n[10])}let S=p.multiplyToRef(d,i.TmpVectors.Matrix[0]).m,M=this._tmpCovariances;M[0]=S[0]*S[0]+S[1]*S[1]+S[2]*S[2],M[1]=S[0]*S[4]+S[1]*S[5]+S[2]*S[6],M[2]=S[0]*S[8]+S[1]*S[9]+S[2]*S[10],M[3]=S[4]*S[4]+S[5]*S[5]+S[6]*S[6],M[4]=S[4]*S[8]+S[5]*S[9]+S[6]*S[10],M[5]=S[8]*S[8]+S[9]*S[9]+S[10]*S[10];let A=-1e4;for(let e=0;e<6;e++)A=Math.max(A,Math.abs(M[e]));this._splatPositions[4*e+3]=A;let b=A;s[4*_+0]=(0,f.ToHalfFloat)(M[0]/b),s[4*_+1]=(0,f.ToHalfFloat)(M[1]/b),s[4*_+2]=(0,f.ToHalfFloat)(M[2]/b),s[4*_+3]=(0,f.ToHalfFloat)(M[3]/b),a[_*x+0]=(0,f.ToHalfFloat)(M[4]/b),a[_*x+1]=(0,f.ToHalfFloat)(M[5]/b);let y=M[0],D=M[1],I=M[2],v=M[3],w=M[4],C=M[5],E=Math.pow(Math.abs(y*(v*C-w*w)-D*(D*C-w*I)+I*(D*w-v*I)),1/6);E<this._splatSizeMin&&(this._splatSizeMin=E),E>this._splatSizeMax&&(this._splatSizeMax=E),n[4*_+0]=r[32*u+24+0],n[4*_+1]=r[32*u+24+1],n[4*_+2]=r[32*u+24+2],n[4*_+3]=r[32*u+24+3]}_onUpdateTextures(e){}_onIndexDataReceived(e,t){}_onIncrementalUpdateStart(e){}get isCompound(){return!1}_setDelayedTextureUpdate(e,t,r,s){this._delayedTextureUpdate={covA:e,covB:t,colors:r,centers:this._splatPositions,sh:s}}_createMrtAtlas(e){this._useRGBACovariants=!0;let t=this.getEngine(),r=this._getTextureDataUpdateEngine();if(!r._gl&&!r.isWebGPU)return;let s=t.getCaps().textureHalfFloatRender?2:1,a=new d.MultiRenderTarget(this.name+"_gsAtlas",{width:e.x,height:e.y},4,this._scene,{types:[1,s,s,0],formats:[5,5,5,5],samplingModes:[1,1,1,1],generateDepthBuffer:!1,generateDepthTexture:!1,generateMipMaps:!1},[this.name+"_gsCenters",this.name+"_gsCovA",this.name+"_gsCovB",this.name+"_gsColors"]);a.clearColor=new c.Color4(0,0,0,0),a.renderList=[],a.onClearObservable.add(()=>{}),a.render(),this._mrtAtlas=a,this._centersTexture=a.textures[0],this._covariancesATexture=a.textures[1],this._covariancesBTexture=a.textures[2],this._colorsTexture=a.textures[3]}_createShMrtAtlas(e){let t=this._getTextureDataUpdateEngine();if(!t._gl&&!t.isWebGPU)return;let r=this._shMrtAtlasTextureCount;if(r<=0)return;let s=[],a=[];for(let t=0;t<r;t++){let r=`${this.name}_gsShAtlas${t}`,i=new d.MultiRenderTarget(r,{width:e.x,height:e.y},1,this._scene,{types:[7],formats:[11],samplingModes:[1],generateDepthBuffer:!1,generateDepthTexture:!1,generateMipMaps:!1},[r]);i.clearColor=new c.Color4(0,0,0,0),i.renderList=[],i.onClearObservable.add(()=>{});let n=i.textures[0];n.wrapU=0,n.wrapV=0,i.render(),s.push(i),a.push(n)}this._shMrtAtlas=s,this._shTextures=a}_createRotMrtAtlas(e){let t=this._getTextureDataUpdateEngine();if(!t._gl&&!t.isWebGPU)return;let r=this.getEngine().getCaps().textureHalfFloatRender?2:1,s=this.name+"_gsRotAtlas",a=new d.MultiRenderTarget(s,{width:e.x,height:e.y},3,this._scene,{types:[r,r,r],formats:[5,5,5],samplingModes:[1,1,1],generateDepthBuffer:!1,generateDepthTexture:!1,generateMipMaps:!1},[s+"A",s+"B",s+"Scale"]);for(let e of(a.clearColor=new c.Color4(0,0,0,0),a.renderList=[],a.onClearObservable.add(()=>{}),a.textures))e.wrapU=0,e.wrapV=0;a.render(),this._rotMrtAtlas=a,this._rotationsATexture=a.textures[0],this._rotationsBTexture=a.textures[1],this._rotationScaleTexture=a.textures[2]}_updateTextures(e,t,r,s){let a=this._getTextureSize(this._vertexCount),i=(e,t,r,s)=>new p.RawTexture(e,t,r,s,this._scene,!1,!1,2,1),n=(e,t,r,s)=>new p.RawTexture(e,t,r,s,this._scene,!1,!1,2,0),o=(e,t,r)=>new p.RawTexture(null,e,t,r,this._scene,!1,!1,1,7),l=(e,t,r,s)=>new p.RawTexture(e,t,r,s,this._scene,!1,!1,2,2),h=null===this._covariancesATexture,u=this._textureSize.y!=a.y;this._useShMrtAtlas&&s&&(this._shMrtAtlasTextureCount=s.length);let _=this._useMrtAtlas&&!this._mrtAtlas||this._useShMrtAtlas&&(!this._shMrtAtlas||this._shMrtAtlas.length!==this._shMrtAtlasTextureCount)||this._useRotMrtAtlas&&!this._rotMrtAtlas;if(h||u||_){let u=this._useMrtAtlas&&!!this._mrtAtlas;if(u&&this._onBeforeAtlasRebuildObservable.notifyObservers(this._mrtAtlas),this._mrtAtlas?(this._mrtAtlas.dispose(),this._mrtAtlas=null,this._covariancesATexture=this._covariancesBTexture=this._centersTexture=this._colorsTexture=null):(this._covariancesATexture?.dispose(),this._covariancesBTexture?.dispose(),this._centersTexture?.dispose(),this._colorsTexture?.dispose()),this._rotMrtAtlas?(this._rotMrtAtlas.dispose(),this._rotMrtAtlas=null,this._rotationsATexture=null,this._rotationsBTexture=null,this._rotationScaleTexture=null):this._rotationsATexture&&(this._rotationsATexture.dispose(),this._rotationsBTexture?.dispose(),this._rotationScaleTexture?.dispose(),this._rotationsATexture=null,this._rotationsBTexture=null,this._rotationScaleTexture=null),this._shTextures){if(this._shMrtAtlas){for(let e of this._shMrtAtlas)e.dispose();for(let e=this._shMrtAtlas.length;e<this._shTextures.length;e++)this._shTextures[e].dispose();this._shMrtAtlas=null}else for(let e of this._shTextures)e.dispose();this._shTextures=null}if(this._textureSize=a,this._useMrtAtlas){if(this._createMrtAtlas(a),this._useShMrtAtlas&&this._createShMrtAtlas(a),this._useRotMrtAtlas&&this._createRotMrtAtlas(a),this._mrtAtlas){if(this._updateSubTextures(this._splatPositions,e,t,r,0,a.y),this._useShMrtAtlas&&s){let e=this._shTextures;if(e)for(let t=0;t<s.length&&t<e.length;t++)this._updateShTextureData(e[t],s[t],a.x,0,a.y)}u&&this._onAfterAtlasRebuildObservable.notifyObservers(this._mrtAtlas)}}else this._covariancesATexture=l(e,a.x,a.y,5),this._covariancesBTexture=l(t,a.x,a.y,this._useRGBACovariants?5:7),this._centersTexture=i(this._splatPositions,a.x,a.y,5),this._colorsTexture=n(r,a.x,a.y,5);if(s&&!this._useShMrtAtlas){this._shTextures=[];for(let e=0;e<s.length;e++){let e=o(a.x,a.y,11);e.wrapU=0,e.wrapV=0,this._shTextures.push(e)}for(let e=0;e<s.length;e++)this._updateShTextureData(this._shTextures[e],s[e],a.x,0,a.y)}if(this._needsRotationScaleTextures&&!this._useRotMrtAtlas){let t=this._rotationDataA??new Uint16Array(e.length),r=this._rotationDataB??new Uint16Array(e.length),s=this._rotationScaleData??new Uint16Array(e.length);this._rotationsATexture=l(t,a.x,a.y,5),this._rotationsBTexture=l(r,a.x,a.y,5),this._rotationScaleTexture=l(s,a.x,a.y,5),this._rotationsATexture.wrapU=0,this._rotationsATexture.wrapV=0,this._rotationsBTexture.wrapU=0,this._rotationsBTexture.wrapV=0,this._rotationScaleTexture.wrapU=0,this._rotationScaleTexture.wrapV=0}if(this._onUpdateTextures(a),h)this._instantiateWorker();else{if(this._worker){let e=Float32Array.from(this._splatPositions),t=this._vertexCount;this._worker.postMessage({command:A,positions:e,vertexCount:t},[e.buffer]),this._postIntervalsToWorker()}this._postToWorker(!0)}}else{this._setDelayedTextureUpdate(e,t,r,s);let i=Float32Array.from(this._splatPositions),n=this._vertexCount;if(this._worker&&(this._worker.postMessage({command:A,positions:i,vertexCount:n},[i.buffer]),this._postIntervalsToWorker()),s&&!this._shTextures&&!this._useShMrtAtlas){this._shTextures=[];for(let e=0;e<s.length;e++){let t=o(a.x,a.y,11);t.wrapU=0,t.wrapV=0,this._shTextures.push(t),this._updateShTextureData(t,s[e],a.x,0,a.y)}}this._needsRotationScaleTextures&&this._rotationDataA&&(this._rotationsATexture?(this._updateTextureFromData(this._rotationsATexture,this._rotationDataA,a.x,0,a.y),this._updateTextureFromData(this._rotationsBTexture,this._rotationDataB,a.x,0,a.y),this._updateTextureFromData(this._rotationScaleTexture,this._rotationScaleData,a.x,0,a.y)):(this._rotationsATexture=l(this._rotationDataA,a.x,a.y,5),this._rotationsBTexture=l(this._rotationDataB,a.x,a.y,5),this._rotationScaleTexture=l(this._rotationScaleData,a.x,a.y,5),this._rotationsATexture.wrapU=0,this._rotationsATexture.wrapV=0,this._rotationsBTexture.wrapU=0,this._rotationsBTexture.wrapV=0,this._rotationScaleTexture.wrapU=0,this._rotationScaleTexture.wrapV=0)),this._onUpdateTextures(a),this._postToWorker(!0)}}_canReuseCachedData(e,t,r=0){return!(e<=0)&&!(e>t)&&null!==this._splatPositions&&null!==this._cachedBoundingMin&&null!==this._cachedBoundingMax&&null!==this._covariancesATexture&&(!this._useMrtAtlas||!!this._mrtAtlas)&&(!this._useShMrtAtlas||!!this._shMrtAtlas&&this._shMrtAtlas.length===r)&&(!this._useRotMrtAtlas||!!this._rotMrtAtlas)&&this._getTextureSize(t).y===this._textureSize.y}_notifyWorkerNewData(){if(this._worker){let e=Float32Array.from(this._splatPositions),t=this._vertexCount;this._worker.postMessage({command:A,positions:e,vertexCount:t},[e.buffer]),this._postIntervalsToWorker()}this._sortIsDirty=!0}_postWorkerPositionsRange(e,t){if(!this._worker||!this._splatPositions||t<=0)return;let r=4*e,s=this._splatPositions.slice(r,r+4*t);this._worker.postMessage({command:"positionsUpdate",offset:r,data:s},[s.buffer]),this._sortIsDirty=!0}_writeStreamingSplats(e,t,r,s,a){if(!this._splatPositions)return;let n=this._splatPositions.length/4,o=P._GetSplatDataBytes(r);if(!Number.isInteger(e)||!Number.isInteger(t)||e<0||t<0||e+t>n)throw Error(`_writeStreamingSplats: range [${e}, ${e+t}) is outside the atlas bounds [0, ${n})`);if(o.length<32*t)throw Error(`_writeStreamingSplats: splatsData has ${o.length} bytes, need ${32*t} for ${t} splats (stride 32)`);if(0===t||!this._covariancesATexture)return;let l=this._getTextureSize(this._vertexCount).x,h=this._useRGBACovariants?4:2,u=e+t,_=P._GetSplatDataFloats(r),p=new Uint16Array(4*t),d=new Uint16Array(t*h),c=new Uint8Array(4*t),f=s??new i.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),x=a??new i.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let r=0;r<t;r++)this._makeSplat(e+r,_,o,p,d,c,f,x,this._flipY,r,r);this._splatsData&&new Uint8Array(P._GetSplatDataBytes(this._splatsData).buffer).set(o.subarray(0,32*t),32*e);let m=this._splatPositions,g=e;for(;g<u;){let t=Math.floor(g/l),r=Math.min(u,(t+1)*l),s=g-t*l,a=r-g,i=g-e;this._updateTextureFromDataRect(this._covariancesATexture,new Uint16Array(p.buffer,4*i*2,4*a),s,t,a,1),this._updateTextureFromDataRect(this._covariancesBTexture,new Uint16Array(d.buffer,i*h*2,a*h),s,t,a,1),this._updateTextureFromDataRect(this._centersTexture,new Float32Array(m.buffer,4*g*4,4*a),s,t,a,1),this._updateTextureFromDataRect(this._colorsTexture,new Uint8Array(c.buffer,4*i,4*a),s,t,a,1),g=r}this._postWorkerPositionsRange(e,t)}*_updateData(e,t,r,s,{flipY:a=!1,previousVertexCount:n=0}={},o){this._covariancesATexture||(this._readyToDisplay=!1),this._flipY=a;let l=new Uint8Array(e),h=new Float32Array(l.buffer);this._keepInRam||this._alwaysRetainSplatsData?(this._splatsData=l.buffer,this._shData=r?r.map(e=>new Uint8Array(e)):null):(this._splatsData=null,this._shData=null);let u=l.length/P._RowOutputLength;u!=this._vertexCount&&(this._activeSplatRanges=null,this._activeSplatRangeKey="",this._activeSplatRenderCount=0,this._updateSplatIndexBuffer(u)),this._vertexCount=u,this._maxShDegree=r?o??0:0,this._shDegree=this._maxShDegree;let _=this._getTextureSize(u),p=_.x*_.y,d=P.ProgressiveUpdateAmount??_.y;s&&this._onIndexDataReceived(s,p);let c=new i.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),f=new i.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),x=this._useRGBACovariants?4:2,m=new Uint16Array(4*p),g=new Uint16Array(x*p),T=new Uint8Array(4*p),S=this._canReuseCachedData(n,u,r?.length??0);S||(this._splatSizeMin=1/0,this._splatSizeMax=-1/0);let M=S?Math.floor(n/_.x):0,A=M*_.x,b=this._splatPositions;if(this._splatPositions=new Float32Array(4*p),S&&(this._splatPositions.set(b.subarray(0,4*n)),c.copyFrom(this._cachedBoundingMin),f.copyFrom(this._cachedBoundingMax),this._onIncrementalUpdateStart(_)),P.ProgressiveUpdateAmount){S||this._updateTextures(m,g,T,r),this.setEnabled(!0);let e=Math.ceil(_.y/d);for(let s=0;s<e;s++){let e=s*d,i=Math.min(e+d,_.y);if(i<=M)continue;let n=Math.max(e,M),o=n*_.x,p=i*_.x;for(let e=o;e<p;e++)e<u?this._makeSplat(e,h,l,m,g,T,c,f,a):this._makeEmptySplat(e,m,g,T);this._updateSubTextures(this._splatPositions,m,g,T,n,i-n,r),this.getBoundingInfo().reConstruct(c,f,this.getWorldMatrix()),t&&(yield)}this._notifyWorkerNewData()}else{for(let e=A;e<u;e++)this._makeSplat(e,h,l,m,g,T,c,f,a),t&&e%P._SplatBatchSize==0&&(yield);let e=S?p:u+15&-16;for(let t=u;t<e;t++)this._makeEmptySplat(t,m,g,T);S?(this._updateSubTextures(this._splatPositions,m,g,T,M,_.y-M,r),this.getBoundingInfo().reConstruct(c,f,this.getWorldMatrix()),this.setEnabled(!0),this._notifyWorkerNewData()):(this._updateTextures(m,g,T,r),this.getBoundingInfo().reConstruct(c,f,this.getWorldMatrix()),this.setEnabled(!0),this._sortIsDirty=!0)}this._cachedBoundingMin=c.clone(),this._cachedBoundingMax=f.clone(),this._postToWorker(!0)}async updateDataAsync(e,t,r,s){return await (0,T.runCoroutineAsync)(this._updateData(e,!0,t,r,void 0,s),(0,T.createYieldingScheduler)())}updateData(e,t,r={flipY:!0},s,a){(0,T.runCoroutineSync)(this._updateData(e,!1,t,s,r,a))}refreshBoundingInfo(){return this.thinInstanceRefreshBoundingInfo(!1),this}_updateSplatIndexBuffer(e){let t=Math.max((this._activeSplatRanges?this._activeSplatRenderCount:e)+15&-16,16),r=this._splatIndex;r&&t===r.length||(this._splatIndex=new Float32Array(t),this._cameraViewInfos.forEach(e=>{e.mesh.thinInstanceSetBuffer("splatIndex",this._splatIndex,16,!1)}));let s=this._splatIndex;if(this._activeSplatRanges){let r=0;for(let e=0;e<this._activeSplatRanges.length;e+=2){let t=this._activeSplatRanges[e],a=this._activeSplatRanges[e+1];for(let e=t;e<t+a;e++)s[r++]=e}for(;r<t;r++)s[r]=e}else for(let e=0;e<t;e++)s[e]=e;this._depthMix&&t===this._depthMix.length||I||(this._depthMix=new BigInt64Array(t)),this.forcedInstanceCount=Math.max(t>>4,1)}_getTextureDataUpdateEngine(){return this.getEngine()}_updateShTextureData(e,t,r,s,a){let i=this._getTextureDataUpdateEngine();if(!i._gl&&!i.isWebGPU){let s,a=e.getInternalTexture(),n=r*a.height*16;if(t.byteLength===n&&t.byteOffset%Uint32Array.BYTES_PER_ELEMENT==0)s=new Uint32Array(t.buffer,t.byteOffset,t.byteLength/Uint32Array.BYTES_PER_ELEMENT);else{let e=new Uint8Array(n);e.set(t.subarray(0,Math.min(t.byteLength,n))),s=new Uint32Array(e.buffer)}i.updateRawTexture(a,s,a.format,a.invertY,null,a.type,a._useSRGBBuffer);return}let n=s*r,o=Math.floor(t.byteLength/16);if(n>=o)return;let l=Math.min(a*r,o-n);if(l<=0)return;let h=(e,r)=>new Uint32Array(t.buffer,t.byteOffset+e,4*r),u=Math.floor(l/r);if(u>0){let t=u*r;this._updateTextureFromData(e,h(16*n,t),r,s,u),l-=t}l>0&&this._updateTextureFromDataRect(e,h((n+u*r)*16,l),0,s+u,l,1)}_updateSubTextures(e,t,r,s,a,i,n){let o=this._getTextureSize(this._vertexCount),l=this._useRGBACovariants?4:2,h=a*o.x,u=i*o.x,_=new Uint16Array(t.buffer,4*h*Uint16Array.BYTES_PER_ELEMENT,4*u),p=new Uint16Array(r.buffer,h*l*Uint16Array.BYTES_PER_ELEMENT,u*l),d=new Uint8Array(s.buffer,4*h,4*u),c=new Float32Array(e.buffer,4*h*Float32Array.BYTES_PER_ELEMENT,4*u);if(this._updateTextureFromData(this._covariancesATexture,_,o.x,a,i),this._updateTextureFromData(this._covariancesBTexture,p,o.x,a,i),this._updateTextureFromData(this._centersTexture,c,o.x,a,i),this._updateTextureFromData(this._colorsTexture,d,o.x,a,i),this._rotationsATexture&&this._rotationDataA){let e=new Uint16Array(this._rotationDataA.buffer,4*h*Uint16Array.BYTES_PER_ELEMENT,4*u),t=new Uint16Array(this._rotationDataB.buffer,4*h*Uint16Array.BYTES_PER_ELEMENT,4*u),r=new Uint16Array(this._rotationScaleData.buffer,4*h*Uint16Array.BYTES_PER_ELEMENT,4*u);this._updateTextureFromData(this._rotationsATexture,e,o.x,a,i),this._updateTextureFromData(this._rotationsBTexture,t,o.x,a,i),this._updateTextureFromData(this._rotationScaleTexture,r,o.x,a,i)}if(n)for(let e=0;e<n.length;e++)this._updateShTextureData(this._shTextures[e],n[e],o.x,a,i)}_instantiateWorker(){if(!this._vertexCount||(this._updateSplatIndexBuffer(this._vertexCount),this._disableDepthSort||I))return;this._worker?.terminate(),this._canPostToWorker=!0,this._worker=new Worker(URL.createObjectURL(new Blob(["(",D.toString(),")(self)"],{type:"application/javascript"})));let e=Float32Array.from(this._splatPositions),t=this._vertexCount;this._worker.postMessage({command:A,positions:e,vertexCount:t},[e.buffer]),this._postIntervalsToWorker(),this._onWorkerCreated(this._worker),this._worker.onerror=()=>{this._canPostToWorker=!0},this._worker.onmessage=e=>{let t=Math.max(this.renderedSplatCount+15&-16,16);if(e.data.depthMix.length!=t||e.data.rangeVersion!==this._activeRangeVersion){this._depthMix.buffer.byteLength>0&&(this._canPostToWorker=!0,this._postToWorker(!0),this._sortIsDirty=!1);return}this._depthMix=e.data.depthMix;let r=e.data.cameraId,s=e.data.sortRequestId;this._splatIndex&&this._splatIndex.length===t||(this._splatIndex=new Float32Array(t),this._cameraViewInfos.forEach(e=>{e.mesh.thinInstanceSetBuffer("splatIndex",this._splatIndex,16,!1),e.splatIndexBufferSet=!0}));let a=new Uint32Array(e.data.depthMix.buffer);if(this._splatIndex)for(let e=0;e<t;e++)this._splatIndex[e]=a[2*e];if(this.forcedInstanceCount=Math.max(t>>4,1),this._delayedTextureUpdate){let e=this._vertexCount+15&-16,t=this._getTextureSize(e);this._updateSubTextures(this._delayedTextureUpdate.centers,this._delayedTextureUpdate.covA,this._delayedTextureUpdate.covB,this._delayedTextureUpdate.colors,0,t.y,this._delayedTextureUpdate.sh),this._delayedTextureUpdate=null}let i=this._cameraViewInfos.get(r);i&&(i.splatIndexBufferSet?i.mesh.thinInstanceBufferUpdated("splatIndex"):(i.mesh.thinInstanceSetBuffer("splatIndex",this._splatIndex,16,!1),i.splatIndexBufferSet=!0),i.sortAppliedId=s),this._canPostToWorker=!0,this._readyToDisplay=!0,this._sortIsDirty&&(this._postToWorker(!0),this._sortIsDirty=!1)}}_getTextureSize(e){let t=this._scene.getEngine(),r=t.getCaps().maxTextureSize,s=1;if(1!==t.version||t.isWebGPU)s=Math.ceil(e/r),e>0&&s*r===e&&(s+=1);else{for(;r*s<e;)s*=2;e>0&&r*s===e&&(s*=2)}return s>r&&(u.Logger.Error("GaussianSplatting texture size: ("+r+", "+s+"), maxTextureSize: "+r),s=r),new i.Vector2(r,s)}_onWorkerCreated(e){}bindExtraEffectUniforms(e){}_appendSourceToArrays(e,t,r,s,a,i,n,o){let l=e._vertexCount,h=e._splatsData;if(!h||0===l)return;let u=P._GetSplatDataBytes(h),_=P._GetSplatDataFloats(h);for(let e=0;e<l;e++)this._makeSplat(t+e,_,u,r,s,a,n,o,!1,e);if(i&&e._shData)for(let r=0;r<i.length;r++)r<e._shData.length&&i[r].set(e._shData[r].subarray(0,16*l),16*t)}bakeTransformIntoVertices(e){let t,r=this.splatsData;if(!r)return u.Logger.Error("Cannot bake transform into vertices if splatsData is not kept in RAM"),this;let s=e.m,a=Math.sqrt(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]),n=Math.sqrt(s[4]*s[4]+s[5]*s[5]+s[6]*s[6]),o=Math.sqrt(s[8]*s[8]+s[9]*s[9]+s[10]*s[10]);if(Math.abs(a-n)>.001||Math.abs(a-o)>.001)return u.Logger.Error("Gaussian Splatting bakeTransformIntoVertices does not support non-uniform scaling"),this;let l=new Uint8Array(r),h=new Float32Array(r),_=i.TmpVectors.Vector3[0],p=i.TmpVectors.Quaternion[0],d=i.TmpVectors.Quaternion[1];for(e.decompose(_,d,_),t=0;t<this._vertexCount;t++){let r=8*t;i.Vector3.TransformCoordinatesFromFloatsToRef(h[r],h[r+1],h[r+2],e,_),h[r]=_.x,h[r+1]=_.y,h[r+2]=_.z,h[r+3]*=a,h[r+4]*=a,h[r+5]*=a,p.set((l[32*t+28+1]-127.5)/127.5,(l[32*t+28+2]-127.5)/127.5,(l[32*t+28+3]-127.5)/127.5,(l[32*t+28+0]-127.5)/127.5),p.normalize(),this.scaling.x<0&&(p.x=-p.x,p.w=-p.w),this.scaling.y<0&&(p.y=-p.y,p.w=-p.w),this.scaling.z<0&&(p.z=-p.z,p.w=-p.w),d.multiplyToRef(p,p),p.normalize(),l[32*t+28+0]=Math.round(127.5*p.w+127.5),l[32*t+28+1]=Math.round(127.5*p.x+127.5),l[32*t+28+2]=Math.round(127.5*p.y+127.5),l[32*t+28+3]=Math.round(127.5*p.z+127.5)}return this.updateData(r,this.shData??void 0,{flipY:!1}),this}}function B(e,t){let r=[];for(let s=0;s<e;s++){let e=new Uint8Array(t);e.fill(128),r.push(e)}return r}P.UseCountingSort=!0,P.LogSortPerformance=!1,P._RowOutputLength=32,P._SH_C0=.28209479177387814,P._SplatBatchSize=327680,P._PlyConversionBatchSize=32768,P._BatchSize=16,P._DefaultViewUpdateThreshold=1e-4,P.ProgressiveUpdateAmount=0,e.s(["AllocateShBuffers",0,B,"GaussianSplattingMeshBase",0,P],39312);var F=e.i(95708),U=l,O=e.i(97363),L=e.i(79428);class H extends U.Mesh{get partIndex(){return this._partIndex}get proxiedMesh(){return this.compoundSplatMesh}constructor(e,t,r,s,a,i,n,o=n){super(e,t),this._partIndex=s,this._vertexCount=i,this._splatsDataOffset=n,this._shDataOffset=o,this._minimum=a.minimum.clone(),this._maximum=a.maximum.clone(),this.compoundSplatMesh=r,this._applyBoundingInfo(),this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex,this.getWorldMatrix()),this.onAfterWorldMatrixUpdateObservable.add(()=>{this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex,this.getWorldMatrix())})}updateBoundingInfoFromPartData(){this._applyBoundingInfo()}updateBoundingInfoFromProxiedMesh(){this.updateBoundingInfoFromPartData()}_applyBoundingInfo(){this.setBoundingInfo(new O.BoundingInfo(this._minimum.clone(),this._maximum.clone()))}getClassName(){return"GaussianSplattingPartProxyMesh"}getHierarchyBoundingVectors(e=!0,t=null){let r=super.getHierarchyBoundingVectors(e,t),s=this.getBoundingInfo();return s.update(this.getWorldMatrix()),i.Vector3.CheckExtends(s.boundingBox.minimumWorld,r.min,r.max),i.Vector3.CheckExtends(s.boundingBox.maximumWorld,r.min,r.max),r}updatePartIndex(e){this._partIndex=e}updatePartMetadata(e,t,r=t){this._vertexCount=e,this._splatsDataOffset=t,this._shDataOffset=r}get isVisible(){return this.compoundSplatMesh.getPartVisibility(this.partIndex)>0}set isVisible(e){this.compoundSplatMesh.setPartVisibility(this.partIndex,+!!e)}get visibility(){return this.compoundSplatMesh.getPartVisibility(this.partIndex)}set visibility(e){this.compoundSplatMesh.setPartVisibility(this.partIndex,e)}intersects(e){let t=new L.PickingInfo,r=this.getBoundingInfo();return r&&e.intersectsSphere(r.boundingSphere)&&e.intersectsBox(r.boundingBox)&&(t.hit=!0,t.pickedMesh=this,t.distance=i.Vector3.Distance(e.origin,r.boundingSphere.center),t.subMeshId=0),t}serialize(e={}){(e=super.serialize(e)).subMeshes=[],e.geometryUniqueId=void 0,e.geometryId=void 0,e.materialUniqueId=void 0,e.materialId=void 0,e.instances=[],e.actions=void 0,e.type=this.getClassName(),e.compoundSplatMeshId=this.compoundSplatMesh.id,e.partIndex=this._partIndex,e.vertexCount=this._vertexCount,e.splatsDataOffset=this._splatsDataOffset,e.shDataOffset=this._shDataOffset;let t=this.getBoundingInfo();return e.boundingInfo={minimum:t.minimum.asArray(),maximum:t.maximum.asArray()},e}static Parse(e,t){let r=e.partIndex,s=e.compoundSplatMesh??t.getLastMeshById(e.compoundSplatMeshId);if(!s)throw Error(`GaussianSplattingPartProxyMesh: compound mesh not found with ID ${e.compoundSplatMeshId}`);let a=i.Vector3.FromArray(e.boundingInfo.minimum),n=i.Vector3.FromArray(e.boundingInfo.maximum),o=new O.BoundingInfo(a,n),l=e.vertexCount??0,h=e.splatsDataOffset??0,u=e.shDataOffset??h;return new H(e.name,t,s,r,o,l,h,u)}}class k extends P{get partIndicesTexture(){return this._partIndicesTexture}constructor(e,t=null,r=null,s=!1,a=!1){super(e,t,r,s),this._partProxies=[],this._part0LocalMin=null,this._part0LocalMax=null,this._partMatrices=[],this._rebuilding=!1,this._partVisibility=[],this._partSplatRanges=[],this._hasStreamingPart=!1,this._streamingStates=[],this._streamingShDegree=0,this._tombstonedPartIndices=new Set,this._partIndicesTexture=null,this._partIndices=null,this._alwaysRetainSplatsData=!0,this._needsRotationScaleTextures=a}getClassName(){return"GaussianSplattingMesh"}isReady(e=!1){for(let e of this._partProxies)e&&e.computeWorldMatrix(!0);return super.isReady(e)}_updateBoundingInfoFromProxies(){let e=this.getWorldMatrix(),t=i.Matrix.Invert(e),r=this._part0LocalMin?this._part0LocalMin.clone():new i.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=this._part0LocalMax?this._part0LocalMax.clone():new i.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),a=new i.Vector3;for(let e of this._partProxies){if(!e||this._tombstonedPartIndices.has(e.partIndex))continue;e.computeWorldMatrix(!1);let n=e.getBoundingInfo().boundingBox,o=n.minimumWorld,l=n.maximumWorld;for(let e=0;e<8;e++)a.set(1&e?l.x:o.x,2&e?l.y:o.y,4&e?l.z:o.z),i.Vector3.TransformCoordinatesToRef(a,t,a),r.minimizeInPlace(a),s.maximizeInPlace(a)}r.x<=s.x&&(this._boundingInfo?this._boundingInfo.reConstruct(r,s,e):this._boundingInfo=new O.BoundingInfo(r,s,e),this._cachedBoundingMin=r.clone(),this._cachedBoundingMax=s.clone())}_updateBoundingInfo(){return this.isCompound?(this._updateBoundingInfoFromProxies(),this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache),this):super._updateBoundingInfo()}getHierarchyBoundingVectors(e=!0,t=null){if(!this.isCompound)return super.getHierarchyBoundingVectors(e,t);let r=new i.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new i.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);if(this._part0LocalMin&&(this._partVisibility[0]??1)>0){let e=this.getWorldMatrix(),t=this._part0LocalMin,a=this._part0LocalMax,n=new i.Vector3;for(let o=0;o<8;o++)n.set(1&o?a.x:t.x,2&o?a.y:t.y,4&o?a.z:t.z),i.Vector3.TransformCoordinatesToRef(n,e,n),r.minimizeInPlace(n),s.maximizeInPlace(n)}for(let e=0;e<this._partProxies.length;e++){let t=this._partProxies[e];if(!t||(this._partVisibility[e]??1)===0)continue;t.computeWorldMatrix(!1);let a=t.getBoundingInfo().boundingBox;r.minimizeInPlace(a.minimumWorld),s.maximizeInPlace(a.maximumWorld)}return{min:r,max:s}}dispose(e){for(let e of this._partProxies)e.dispose();this._partIndicesTexture?.dispose(),this._partProxies=[],this._partMatrices=[],this._partVisibility=[],this._partIndicesTexture=null,this._part0LocalMin=null,this._part0LocalMax=null,super.dispose(e)}_onWorkerCreated(e){e.postMessage({command:b,partMatrices:this._partMatrices.map(e=>new Float32Array(e.m))}),e.postMessage({command:y,partIndices:this._partIndices?new Uint8Array(this._partIndices):null})}_onIndexDataReceived(e,t){this._partIndices=new Uint8Array(t),this._partIndices.set(e)}get isCompound(){return this._partMatrices.length>0}_instantiateWorker(){this._rebuilding&&this._worker?this._updateSplatIndexBuffer(this._vertexCount):super._instantiateWorker()}_onIncrementalUpdateStart(e){this._ensurePartIndicesTexture(e,this._partIndices??void 0)}_notifyWorkerNewData(){super._notifyWorkerNewData(),this._worker&&this._worker.postMessage({command:y,partIndices:this._partIndices??null})}bindExtraEffectUniforms(e){if(!this._partIndicesTexture)return;e.setTexture("partIndicesTexture",this._partIndicesTexture);let t=new Float32Array(16*this.partCount);for(let e=0;e<this.partCount;e++)this._partMatrices[e].toArray(t,16*e);e.setMatrices("partWorld",t);let r=[];for(let e=0;e<this.partCount;e++)r.push(this._partVisibility[e]??1);e.setArray("partVisibility",r)}get partCount(){return this._partMatrices.length}get partVisibility(){return this._partVisibility}setWorldMatrixForPart(e,t){if(this._partMatrices.length<=e){this.computeWorldMatrix(!0);let t=this.getWorldMatrix();for(;this._partMatrices.length<=e;)this._partMatrices.push(t.clone()),this._partVisibility.push(1)}!this._partMatrices[e].equals(t)&&(this._partMatrices[e].copyFrom(t),this._rebuilding||(this._worker&&this._worker.postMessage({command:b,partMatrices:this._partMatrices.map(e=>new Float32Array(e.m))}),this._postToWorker(!0)))}getWorldMatrixForPart(e){return this._partMatrices[e]??this.getWorldMatrix()}getPartVisibility(e){return this._partVisibility[e]??1}setPartVisibility(e,t){this._partVisibility[e]=Math.max(0,Math.min(1,t))}setPartSplatRanges(e,t){e<0||(this._partSplatRanges[e]=t?t.map(e=>({offset:e.offset,count:e.count})):null,this._refreshPartRangeUnion())}_refreshPartRangeUnion(){let e=!1;for(let t=0;t<this._partSplatRanges.length;t++)if(this._partSplatRanges[t]){e=!0;break}if(!e)return void this.setSplatIndexRanges(null);let t=[],r=this.partCount;for(let e=0;e<r;e++){let r=this._partSplatRanges[e];if(r){for(let e of r)e.count>0&&t.push({offset:e.offset,count:e.count});continue}let s=this._partProxies[e];s&&s._vertexCount>0&&t.push({offset:s._splatsDataOffset,count:s._vertexCount})}this.setSplatIndexRanges(k._CoalesceSplatRanges(t))}static _CoalesceSplatRanges(e){if(e.length<=1)return e;let t=e.slice().sort((e,t)=>e.offset-t.offset),r=[{offset:t[0].offset,count:t[0].count}];for(let e=1;e<t.length;e++){let s=r[r.length-1],a=t[e],i=s.offset+s.count;a.offset<=i?s.count=Math.max(i,a.offset+a.count)-s.offset:r.push({offset:a.offset,count:a.count})}return r}_copyTextures(e){super._copyTextures(e),this._partIndicesTexture=e._partIndicesTexture?.clone()}_onUpdateTextures(e){let t=(e,t,r,s)=>new p.RawTexture(e,t,r,s,this._scene,!1,!1,2,0);if(this._partIndices){let r=new Uint8Array(this._partIndices);if(this._partIndicesTexture){let s=this._partIndicesTexture.getSize();s.width!==e.x||s.height!==e.y?(this._partIndicesTexture.dispose(),this._partIndicesTexture=t(r,e.x,e.y,6),this._partIndicesTexture.wrapU=0,this._partIndicesTexture.wrapV=0):this._updateTextureFromData(this._partIndicesTexture,r,e.x,0,e.y)}else this._partIndicesTexture=t(r,e.x,e.y,6),this._partIndicesTexture.wrapU=0,this._partIndicesTexture.wrapV=0}}_updateSubTextures(e,t,r,s,a,i,n,o){if(super._updateSubTextures(e,t,r,s,a,i,n),o&&this._partIndicesTexture){let e=this._getTextureSize(this._vertexCount),t=a*e.x,r=i*e.x,s=new Uint8Array(o.buffer,t,r);this._updateTextureFromData(this._partIndicesTexture,s,e.x,a,i),this._worker&&this._worker.postMessage({command:y,partIndices:o})}}_ensurePartIndicesTexture(e,t){if(!t||this._partIndicesTexture)return;let r=new Uint8Array(this._partIndices);this._partIndicesTexture=new p.RawTexture(r,e.x,e.y,6,this._scene,!1,!1,2,0),this._partIndicesTexture.wrapU=0,this._partIndicesTexture.wrapV=0,this._worker&&this._worker.postMessage({command:y,partIndices:t??null})}_appendPartSourceToArrays(e,t,r,s,a,i,n,o){this._appendSourceToArrays(e,t,r,s,a,i,n,o)}_createRetainedPartSource(e){if(!this._splatsData||this._shDegree>0&&!this._shData)return null;let t=32*e._splatsDataOffset,r=32*e._vertexCount,s=16*e._shDataOffset,a=16*e._vertexCount,i=P._GetSplatDataBytes(this._splatsData);return{name:e.name,_vertexCount:e._vertexCount,_splatsData:i.subarray(t,t+r),_shData:this._shData?.map(e=>e.subarray(s,s+a))??null,_shDegree:this._shData?this._shDegree:0,isCompound:!1,getWorldMatrix:()=>e.getWorldMatrix(),getBoundingInfo:()=>e.getBoundingInfo(),dispose:()=>{}}}_retainMergedPartData(e,t,r,s){if(!this._keepInRam&&!this._alwaysRetainSplatsData){this._splatsData=null,this._shData=null;return}let a=new Uint8Array(32*t),i=0;for(let t of(this._splatsData&&e>0&&(a.set(P._GetSplatDataBytes(this._splatsData).subarray(0,32*e),i),i+=32*e),r)){if(!t._splatsData)continue;let e=32*t._vertexCount;a.set(P._GetSplatDataBytes(t._splatsData).subarray(0,e),i),i+=e}if(this._splatsData=a.buffer,s<=0){this._shData=null;return}let n=B(Math.ceil(((s+1)*(s+1)-1)*3/16),16*t),o=0;if(this._shData&&e>0){let t=16*e;for(let e=0;e<n.length;e++)e<this._shData.length&&n[e].set(this._shData[e].subarray(0,t),o);o+=t}for(let e of r){let t=16*e._vertexCount;if(e._shData)for(let r=0;r<n.length;r++)r<e._shData.length&&n[r].set(e._shData[r].subarray(0,t),o);o+=t}this._shData=n}_addPartsInternal(e,t){let r;if(0===e.length)return{proxyMeshes:[],assignedPartIndices:[]};for(let t of e){if(!t._splatsData&&!t._isReservedEmpty)throw Error("To call addPart()/addParts(), each source mesh must be fully loaded");if(t.isCompound)throw Error("To call addPart()/addParts(), each source mesh must not be a compound")}let s=this._vertexCount,a=s+e.reduce((e,t)=>e+t._vertexCount,0),o=this._getTextureSize(a),l=o.x*o.y,h=this._useRGBACovariants?4:2,u=new Uint16Array(4*l),_=new Uint16Array(h*l),d=new Uint8Array(4*l),c=this._streamingShDegree,f=this._shDegree>0||e.some(e=>null!==e._shData),x=f||c>0,m=x?Math.max(this._shDegree,c,...e.map(e=>e._shDegree)):0;x&&m>0&&(r=B(Math.ceil(((m+1)*(m+1)-1)*3/16),16*l));let g=this._canReuseCachedData(s,a,r?.length??0),T=g?Math.floor(s/o.x):0,S=g?this._cachedBoundingMin.clone():new i.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),M=g?this._cachedBoundingMax.clone():new i.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),A=this._splatPositions;this._splatPositions=new Float32Array(4*l),g&&A&&this._splatPositions.set(A.subarray(0,4*s));let y=this.partCount,D=this._partIndices;D||(D=new Uint8Array(s),y=+(s>0)),this._partIndices=new Uint8Array(l),this._partIndices.set(D.subarray(0,s));let I=[],v=[],w=s,C=(0,n.GetGaussianSplattingMaxPartCount)(this._scene.getEngine());for(let t of e){if(y>=C)throw Error(`Cannot add part, as the maximum part count (${C}) has been reached`);let e=y++;I.push(e),v.push(w),this._partIndices.fill(e,w,w+t._vertexCount),w+=t._vertexCount}if(!g&&s>0){if(this._partProxies.length>0){let e=0;if(!this._partProxies[0]&&this._splatsData){let t=s-this._partProxies.reduce((e,t)=>e+(t?t._vertexCount:0),0);if(t>0){let s=P._GetSplatDataBytes(this._splatsData),a=P._GetSplatDataFloats(this._splatsData);for(let e=0;e<t;e++)this._makeSplat(e,a,s,u,_,d,S,M,!1);if(r&&this._shData)for(let e=0;e<r.length;e++)e<this._shData.length&&r[e].set(this._shData[e].subarray(0,16*t),0);e+=t}}for(let t=0;t<this._partProxies.length;t++){let s=this._partProxies[t];if(!s)continue;if(this._streamingStates.some(e=>e.proxy===s)){e+=s._vertexCount;continue}let a=this._createRetainedPartSource(s);if(!a)throw Error(`Cannot rebuild compound part "${s.name}": the retained compound source data is not available.`);this._appendPartSourceToArrays(a,e,u,_,d,r,S,M),e+=a._vertexCount}}else if(this._splatsData){let e=P._GetSplatDataBytes(this._splatsData),t=P._GetSplatDataFloats(this._splatsData);for(let r=0;r<s;r++)this._makeSplat(r,t,e,u,_,d,S,M,!1);if(r&&this._shData)for(let e=0;e<r.length;e++)e<this._shData.length&&r[e].set(this._shData[e].subarray(0,16*s),0)}}if(g){let e=T*o.x;if(e<s)if(0===this._partProxies.length){if(this._splatsData){let t=P._GetSplatDataBytes(this._splatsData),r=P._GetSplatDataFloats(this._splatsData);for(let a=e;a<s;a++)this._makeSplat(a,r,t,u,_,d,S,M,!1,a)}}else{let t=s-this._partProxies.reduce((e,t)=>e+(t?t._vertexCount:0),0),r=Array(this._partProxies.length).fill(null),a=Array(this._partProxies.length).fill(null),i=Array(this._partProxies.length).fill(0);!this._partProxies[0]&&this._splatsData&&t>0&&(r[0]=P._GetSplatDataBytes(this._splatsData),a[0]=P._GetSplatDataFloats(this._splatsData),i[0]=0);let n=t;for(let e=0;e<this._partProxies.length;e++){let t=this._partProxies[e];if(!t)continue;if(this._streamingStates.some(e=>e.proxy===t)){i[e]=n,n+=t._vertexCount;continue}let s=this._createRetainedPartSource(t);if(!s||!s._splatsData)throw Error(`Cannot rebuild compound part "${t.name}": the retained compound source data is not available.`);r[e]=P._GetSplatDataBytes(s._splatsData),a[e]=P._GetSplatDataFloats(s._splatsData),i[e]=n,n+=s._vertexCount}for(let t=e;t<s;t++){let e=this._partIndices?this._partIndices[t]:0,s=e<r.length?r[e]:null,n=e<a.length?a[e]:null;s&&n&&this._makeSplat(t,n,s,u,_,d,S,M,!1,t-(i[e]??0))}}}for(let t of(w=s,e))this._appendPartSourceToArrays(t,w,u,_,d,r,S,M),w+=t._vertexCount;let E=a+15&-16;for(let e=a;e<E;e++)this._makeEmptySplat(e,u,_,d);a!==this._vertexCount&&this._updateSplatIndexBuffer(a),this._retainMergedPartData(s,a,e,f?m:0),this._vertexCount=a,this._shDegree=m,this._maxShDegree=m;let R=!this._rebuilding;R&&(this._canPostToWorker=!1,this._rebuilding=!0);try{if(g){if(r&&(!this._shTextures||r.length>this._shTextures.length))for(this._shTextures||(this._shTextures=[]);this._shTextures.length<r.length;){let e=this._shTextures.length,t=new p.RawTexture(null,o.x,o.y,11,this._scene,!1,!1,1,7);t.wrapU=0,t.wrapV=0,this._shTextures.push(t);let s=this._shData&&e<this._shData.length?this._shData[e]:r[e];this._updateShTextureData(t,s,o.x,0,o.y)}if(r&&this._shData){let e=T*o.x;if(e<s){let t=16*e,a=16*s;for(let e=0;e<r.length;e++)e<this._shData.length&&r[e].set(this._shData[e].subarray(t,a),t)}}this._onUpdateTextures(o),this._updateSubTextures(this._splatPositions,u,_,d,T,o.y-T,r)}else this._updateTextures(u,_,d,r);this.setEnabled(!0),this._notifyWorkerNewData(),this._partProxies[0]||!(s>0)||this._part0LocalMin||(this._part0LocalMin=this.getBoundingInfo().minimum.clone(),this._part0LocalMax=this.getBoundingInfo().maximum.clone());let a=[];for(let r=0;r<e.length;r++){let s=e[r],n=I[r],o=s.getWorldMatrix();this.setWorldMatrixForPart(n,o);let l=new H(s.name,this.getScene(),this,n,s.getBoundingInfo(),s._vertexCount,v[r],v[r]);t&&s.dispose();let h=new i.Quaternion;o.decompose(l.scaling,h,l.position),l.rotationQuaternion=h,l.computeWorldMatrix(!0),this._partProxies[n]=l,a.push(l)}return this._updateBoundingInfoFromProxies(),R&&(this._rebuilding=!1,this._worker&&this._worker.postMessage({command:b,partMatrices:this._partMatrices.map(e=>new Float32Array(e.m))}),this._canPostToWorker=!0,this._hasStreamingPart&&this._refreshPartRangeUnion(),this._postToWorker(!0)),this.onPartCountChangedObservable.notifyObservers(this.partCount),{proxyMeshes:a,assignedPartIndices:I}}catch(e){throw R&&(this._rebuilding=!1,this._canPostToWorker=!0),e}}addPart(e,t=!0){let{proxyMeshes:r}=this._addPartsInternal([e],t);return r[0]}_refreshStreamingShState(){let e=0,t=0,r=!1;for(let s of this._streamingStates)!this._tombstonedPartIndices.has(s.partIndex)&&(s.shTextureCount>e&&(e=s.shTextureCount),s.shDegree>t&&(t=s.shDegree),s.needsRotationScale&&(r=!0));this._shMrtAtlasTextureCount=e,this._useShMrtAtlas=e>0,this._streamingShDegree=t,this._useRotMrtAtlas=r}_tombstonePart(e){this.onPartRemovedObservable.notifyObservers(e);let t=this._partProxies[e];t&&(t.setEnabled(!1),t.visibility=0),this._partVisibility[e]=0;let r=this._streamingStates.find(t=>t.partIndex===e);r&&(r.removed=!0),this._partSplatRanges[e]=[],this._tombstonedPartIndices.add(e),this._refreshPartRangeUnion(),this._updateBoundingInfoFromProxies()}_resetForRebuild(){if(this._worker&&(this._worker.terminate(),this._worker=null),this._mrtAtlas?(this._mrtAtlas.dispose(),this._mrtAtlas=null,this._covariancesATexture=this._covariancesBTexture=this._centersTexture=this._colorsTexture=null):(this._covariancesATexture?.dispose(),this._covariancesBTexture?.dispose(),this._centersTexture?.dispose(),this._colorsTexture?.dispose(),this._covariancesATexture=null,this._covariancesBTexture=null,this._centersTexture=null,this._colorsTexture=null),this._rotMrtAtlas?(this._rotMrtAtlas.dispose(),this._rotMrtAtlas=null):(this._rotationsATexture?.dispose(),this._rotationsBTexture?.dispose(),this._rotationScaleTexture?.dispose()),this._rotationsATexture=null,this._rotationsBTexture=null,this._rotationScaleTexture=null,this._shMrtAtlas){for(let e of this._shMrtAtlas)e.dispose();this._shMrtAtlas=null,this._shTextures=null}else if(this._shTextures){for(let e of this._shTextures)e.dispose();this._shTextures=null}this._partIndicesTexture&&(this._partIndicesTexture.dispose(),this._partIndicesTexture=null),this._vertexCount=0,this._splatPositions=null,this._partIndices=null,this._partMatrices=[],this._partVisibility=[],this._cachedBoundingMin=null,this._cachedBoundingMax=null,this._part0LocalMin=null,this._part0LocalMax=null,this._splatsData=null,this._shData=null,this._shDegree=0,this._partProxies=[],this._partSplatRanges=[]}compactAtlas(){if(0===this._tombstonedPartIndices.size)return;let e=this._getTextureSize(1).x,t=[],r=0;for(let s=0;s<this._partProxies.length;s++){let a=this._partProxies[s];if(!a||this._tombstonedPartIndices.has(s))continue;let n=this._streamingStates.find(e=>e.proxy===a)??null,o=a.getWorldMatrix().clone(),l=this._partVisibility[s]??1;if(n){let s=Math.ceil(r/e)*e,h=s-r,u=h+n.capacity,_={name:a.name,_vertexCount:u,_splatsData:null,_shData:null,_shDegree:0,isCompound:!1,getWorldMatrix:()=>o,getBoundingInfo:()=>new O.BoundingInfo(i.Vector3.ZeroReadOnly,i.Vector3.ZeroReadOnly),dispose:()=>{},_isReservedEmpty:!0};t.push({oldProxy:a,source:_,worldMatrix:o,visibility:l,state:n,newBase:s,frontPad:h}),r+=u}else{let e=this._createRetainedPartSource(a);if(!e||!e._splatsData)throw Error(`compactAtlas: the retained source data for static part "${a.name}" is not available.`);t.push({oldProxy:a,source:e,worldMatrix:o,visibility:l,state:null,newBase:0,frontPad:0}),r+=e._vertexCount}}for(let e of(this._mrtAtlas&&this._onBeforeAtlasRebuildObservable.notifyObservers(this._mrtAtlas),this._tombstonedPartIndices))this._partProxies[e]?.dispose();if(this._resetForRebuild(),0===t.length){this._streamingStates.length=0,this._hasStreamingPart=!1,this._tombstonedPartIndices.clear(),this._refreshStreamingShState(),this._useMrtAtlas=!1,this._useRGBACovariants=!this.getEngine().isWebGPU&&1===this.getEngine().version,this.setEnabled(!1),this.onPartCountChangedObservable.notifyObservers(0);return}this._refreshStreamingShState(),this._rebuilding=!0,this._canPostToWorker=!1;try{let{proxyMeshes:e}=this._addPartsInternal(t.map(e=>e.source),!1);for(let r=0;r<t.length;r++){let s=t[r],a=e[r],n=a.partIndex;this.setWorldMatrixForPart(n,s.worldMatrix),this.setPartVisibility(n,s.visibility);let o=new i.Quaternion;s.worldMatrix.decompose(a.scaling,o,a.position),a.rotationQuaternion=o,a.computeWorldMatrix(!0),s.oldProxy.updatePartIndex(n),s.oldProxy.updatePartMetadata(a._vertexCount,a._splatsDataOffset,a._shDataOffset),this._partProxies[n]=s.oldProxy,a.dispose(),s.state?(s.state.partIndex=n,s.state.base=a._splatsDataOffset+s.frontPad,this._partSplatRanges[n]=s.state.localRanges?s.state.localRanges.map(e=>({offset:s.state.base+e.offset,count:e.count})):null):this._partSplatRanges[n]=null}this._mrtAtlas&&this._onAfterAtlasRebuildObservable.notifyObservers(this._mrtAtlas),this._streamingStates=t.filter(e=>e.state).map(e=>e.state),this._hasStreamingPart=this._streamingStates.length>0,this._tombstonedPartIndices.clear(),this._updateBoundingInfoFromProxies(),this._rebuilding=!1,this._canPostToWorker=!0,this._refreshPartRangeUnion(),this._notifyWorkerNewData();let r=this._worker;r?.postMessage({command:b,partMatrices:this._partMatrices.map(e=>new Float32Array(e.m))}),this._postToWorker(!0),this.onPartCountChangedObservable.notifyObservers(this.partCount)}catch(e){throw this._rebuilding=!1,this._canPostToWorker=!0,e}}removePart(e){if(e<0||e>=this.partCount)throw Error(`Part index ${e} is out of range [0, ${this.partCount})`);if(this._hasStreamingPart)return void this._tombstonePart(e);let t=[];for(let r=0;r<this._partProxies.length;r++){let s=this._partProxies[r];if(!s||r===e)continue;let a=this._createRetainedPartSource(s);if(!a)throw Error(`Cannot remove part: the retained compound source data is not available for part "${s.name}".`);t.push({proxyMesh:s,source:a,oldIndex:r,worldMatrix:s.getWorldMatrix().clone(),visibility:this._partVisibility[r]??1})}for(let{proxyMesh:e,source:r}of(t.sort((e,t)=>e.oldIndex-t.oldIndex),t)){if(!r._splatsData)throw Error(`Cannot remove part: the source data for part "${e.name}" is not available.`);if(r._shDegree>0&&!r._shData)throw Error(`Cannot remove part: the SH data for part "${e.name}" is not available.`)}if(this.onPartRemovedObservable.notifyObservers(e),this._partProxies[e]?.dispose(),this._resetForRebuild(),0===t.length){this.setEnabled(!1),this.onPartCountChangedObservable.notifyObservers(0);return}this._rebuilding=!0,this._canPostToWorker=!1;try{let e=t.map(e=>e.source),{proxyMeshes:r}=this._addPartsInternal(e,!1);for(let e=0;e<t.length;e++){let s=t[e].proxyMesh,a=r[e],n=a.partIndex;this.setWorldMatrixForPart(n,t[e].worldMatrix),this.setPartVisibility(n,t[e].visibility);let o=new i.Quaternion;t[e].worldMatrix.decompose(a.scaling,o,a.position),a.rotationQuaternion=o,a.computeWorldMatrix(!0),s.updatePartIndex(n),s.updatePartMetadata(a._vertexCount,a._splatsDataOffset,a._shDataOffset),this._partProxies[n]=s,a.dispose()}this._rebuilding=!1;let s=this._worker;s?.postMessage({command:b,partMatrices:this._partMatrices.map(e=>new Float32Array(e.m))}),this._canPostToWorker=!0,this._postToWorker(!0)}catch(e){throw this._rebuilding=!1,this._canPostToWorker=!0,e}}reserveStreamingPart(e,t=i.Matrix.Identity(),r=this.name+"_streamingPart",s=0,a=0,n=!1){if(!Number.isSafeInteger(e)||e<1)throw Error("reserveStreamingPart: capacity must be a positive integer");if(!Number.isSafeInteger(a)||a<0||a>4)throw Error("reserveStreamingPart: shDegree must be an integer in [0, 4]");if(!Number.isSafeInteger(s)||s<0)throw Error("reserveStreamingPart: shTextureCount must be a non-negative integer");if(a>0!=s>0)throw Error("reserveStreamingPart: shDegree and shTextureCount must both be positive (SH) or both zero (no SH)");if(a>0){let e=Math.ceil(((a+1)*(a+1)-1)*3/16);if(s!==e)throw Error(`reserveStreamingPart: shTextureCount ${s} does not match shDegree ${a} (expected ${e})`)}let o=this._scene.getEngine().getCaps().maxTextureSize,l=o*o,h=this._getTextureSize(1).x,u=this._vertexCount,_=Math.ceil(u/h)*h,p=Math.ceil(e/h)*h,d=_-u+p,c=u+d;if(c+1>l)throw Error(`reserveStreamingPart: capacity ${e} would grow the atlas to ${c} splats (plus a sentinel), exceeding the maximum atlas capacity ${l}`);this._useMrtAtlas=!0,this._useRGBACovariants=!0,s>0&&a>0&&(this._useShMrtAtlas=!0,this._shMrtAtlasTextureCount=Math.max(this._shMrtAtlasTextureCount,s),this._streamingShDegree=Math.max(this._streamingShDegree,a)),n&&(this._useRotMrtAtlas=!0,this._needsRotationScaleTextures=!0);let f=new i.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),x=new i.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),{proxyMeshes:m,assignedPartIndices:g}=this._addPartsInternal([{name:r,_vertexCount:d,_splatsData:null,_shData:null,_shDegree:0,isCompound:!1,getWorldMatrix:()=>t,getBoundingInfo:()=>new O.BoundingInfo(i.Vector3.ZeroReadOnly,i.Vector3.ZeroReadOnly),dispose:()=>{},_isReservedEmpty:!0}],!1),T=m[0],S={proxy:T,base:_,partIndex:g[0],capacity:p,boundsMin:f,boundsMax:x,localRanges:null,shTextureCount:s>0&&a>0?s:0,shDegree:s>0&&a>0?a:0,needsRotationScale:n,removed:!1};this._streamingStates.push(S);let M=this,A=()=>{f.x<=x.x&&(T.setBoundingInfo(new O.BoundingInfo(f.clone(),x.clone())),M._updateBoundingInfoFromProxies())},b=e=>{if(S.removed)throw Error(`${e}: this streaming part has been removed`)},y=(e,t,r)=>{if(!Number.isInteger(t)||!Number.isInteger(r)||t<0||r<0||t+r>S.capacity)throw Error(`${e}: local range [${t}, ${t+r}) is outside the reserved region [0, ${S.capacity})`)},D={proxy:T,capacity:e=p,get partIndex(){return S.partIndex},get base(){return S.base},get centersTexture(){return M.centersTexture},get covariancesATexture(){return M.covariancesATexture},get covariancesBTexture(){return M.covariancesBTexture},get colorsTexture(){return M.colorsTexture},get splatPositions(){return M._splatPositions},get mrtAtlas(){return M._mrtAtlas},get shMrtAtlas(){return M._shMrtAtlas},get rotMrtAtlas(){return M._rotMrtAtlas},get atlasWidth(){return M._getTextureSize(M._vertexCount).x},get isDepthSortSettled(){return M._isDepthSortSettled},setActiveRanges:e=>{if(b("setActiveRanges"),e)for(let t of e)y("setActiveRanges",t.offset,t.count);S.localRanges=e?e.map(e=>({offset:e.offset,count:e.count})):null;let t=e?e.map(e=>({offset:S.base+e.offset,count:e.count})):null;M.setPartSplatRanges(S.partIndex,t)},writeSplats:(e,t,r)=>{b("writeSplats"),y("writeSplats",e,t),M._writeStreamingSplats(S.base+e,t,r,f,x),A()},postPositionsRange:(e,t)=>{b("postPositionsRange"),y("postPositionsRange",e,t),M._postWorkerPositionsRange(S.base+e,t)},expandBounds:(e,t)=>{b("expandBounds"),f.minimizeInPlace(e),x.maximizeInPlace(t),A()},notifyDataChanged:()=>{b("notifyDataChanged"),M._notifyWorkerNewData()},onBeforeAtlasRebuild:e=>{let t=M._onBeforeAtlasRebuildObservable.add(e);return()=>M._onBeforeAtlasRebuildObservable.remove(t)},onAfterAtlasRebuild:e=>{let t=M._onAfterAtlasRebuildObservable.add(e);return()=>M._onAfterAtlasRebuildObservable.remove(t)}};return this._hasStreamingPart=!0,D}serialize(e={},t="base64"){if((e=super.serialize(e)).subMeshes=[],e.geometryUniqueId=void 0,e.geometryId=void 0,e.materialUniqueId=void 0,e.materialId=void 0,e.instances=[],e.actions=void 0,e.type=this.getClassName(),e.keepInRam=this._keepInRam,e.disableDepthSort=this._disableDepthSort,e.viewUpdateThreshold=this.viewUpdateThreshold,e._flipY=this._flipY,this._splatsData&&(e.splatsData="base64"===t?(0,F.EncodeArrayBufferToBase64)(this._splatsData):this._splatsData),this._shData&&(e.shData="base64"===t?this._shData.map(F.EncodeArrayBufferToBase64):this._shData,e.shDegree=this._shDegree),this._partIndices){let r=function(e){let t=[],r=e.length,s=0;for(;s<r;){let a=e[s],i=1;for(;s+i<r&&e[s+i]===a;)i++;t.push(i,a),s+=i}return new Uint32Array(t)}(this._partIndices.subarray(0,this._vertexCount));e.partIndices="base64"===t?(0,F.EncodeArrayBufferToBase64)(r):r}return this._partProxies.length&&(e.partProxies=this._partProxies.filter(e=>!!e).map(e=>e.serialize())),e}static _ParseInternal(e,t,r){let s,a,i=new r(e.name,null,t,e.keepInRam);i.disableDepthSort=e.disableDepthSort??!1,i.viewUpdateThreshold=e.viewUpdateThreshold??P._DefaultViewUpdateThreshold;let n=e.splatsData;"string"==typeof n&&(n=(0,F.DecodeBase64ToBinary)(n));let o=e.shData;if(Array.isArray(o)&&o.length){let e=[];for(let t=0,r=o.length;t<r;t++){let r=o[t];"string"==typeof r?e[t]=new Uint8Array((0,F.DecodeBase64ToBinary)(r)):e[t]=r}s=e}let h=e.partIndices;if("string"==typeof h&&(h=new Uint32Array((0,F.DecodeBase64ToBinary)(h))),h&&(a=function(e){let t=0,r=e.length;for(let s=0;s<r;s+=2)t+=e[s];let s=new Uint8Array(t),a=0;for(let t=0;t<r;t+=2){let r=e[t],i=e[t+1];s.fill(i,a,a+r),a+=r}return s}(h)),n){let t=e._flipY??!1;i.updateData(n,s,{flipY:t},a,e.shDegree)}if(e.partProxies)for(let r of e.partProxies){let e=Object.assign({},r);e.compoundSplatMesh=i;let s=l.Mesh.Parse(e,t,""),a=s.partIndex;i._partProxies[a]=s,i.setWorldMatrixForPart(a,s.getWorldMatrix()),i.setPartVisibility(a,s.visibility)}return i}static Parse(e,t){return k._ParseInternal(e,t,k)}}e.s(["GaussianSplattingMesh",0,k,"IsGaussianSplattingClassName",0,function(e){return"GaussianSplattingMesh"===e||"GaussianSplattingStream"===e}],82368)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,72446,e=>{"use strict";var l=e.i(20552),a=e.i(97009),t=e.i(5573),i=e.i(12752),r=e.i(99493);class n extends l.FlowGraphExecutionBlockWithOutSignal{constructor(e){super(e),this.delayIndex=this.registerDataInput("delayIndex",a.RichTypeFlowGraphInteger)}_execute(e,l){let a=(0,t.getNumericValue)(this.delayIndex.getValue(e));if(a<0||isNaN(a)||!isFinite(a))return this._reportError(e,"Invalid delay index");let r=e._getGlobalContextVariable("pendingDelays",[]),n=r[a];n&&(n.dispose(),delete r[a],e._setGlobalContextVariable("pendingDelays",r)),(0,i.MarkDelayInactive)(e,a),this.out._activateSignal(e)}getClassName(){return"FlowGraphCancelDelayBlock"}}let o=!1;function s(){o||(o=!0,(0,r.RegisterClass)("FlowGraphCancelDelayBlock",n))}e.s(["FlowGraphCancelDelayBlock",0,n,"RegisterFlowGraphCancelDelayBlock",0,s],31639),s(),e.s([],48316),e.i(48316),e.i(31639),e.s(["FlowGraphCancelDelayBlock",0,n],72446)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29841,t=>{"use strict";var e=t.i(97009),i=t.i(20552),o=t.i(59012),s=t.i(99493);class n extends i.FlowGraphExecutionBlockWithOutSignal{constructor(t={}){super(t),this.config=t,this.config.startIndex=t.startIndex??new o.FlowGraphInteger(0),this.reset=this._registerSignalInput("reset"),this.maxExecutions=this.registerDataInput("maxExecutions",e.RichTypeFlowGraphInteger),this.executionCount=this.registerDataOutput("executionCount",e.RichTypeFlowGraphInteger,new o.FlowGraphInteger(0))}_execute(t,e){if(e===this.reset)this.executionCount.setValue(this.config.startIndex,t);else{let e=this.executionCount.getValue(t);e.value<this.maxExecutions.getValue(t).value&&(this.executionCount.setValue(new o.FlowGraphInteger(e.value+1),t),this.out._activateSignal(t))}}getClassName(){return"FlowGraphDoNBlock"}}let a=!1;function r(){a||(a=!0,(0,s.RegisterClass)("FlowGraphDoNBlock",n))}t.s(["FlowGraphDoNBlock",0,n,"RegisterFlowGraphDoNBlock",0,r],5157),r(),t.s([],93868),t.i(93868),t.i(5157),t.s(["FlowGraphDoNBlock",0,n],29841)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1118,t=>{"use strict";var e=t.i(37096),i=t.i(97009),a=t.i(72003),s=t.i(75648),r=t.i(17484),o=t.i(47487),l=t.i(42035),n=t.i(99493);class c extends s.FlowGraphUnaryOperationBlock{constructor(t){super((0,i.getRichTypeByFlowGraphType)(t?.matrixType||"Matrix"),(0,i.getRichTypeByFlowGraphType)(t?.matrixType||"Matrix"),t=>t.transpose?t.transpose():a.Matrix.Transpose(t),"FlowGraphTransposeBlock",t)}}class u extends s.FlowGraphUnaryOperationBlock{constructor(t){super((0,i.getRichTypeByFlowGraphType)(t?.matrixType||"Matrix"),i.RichTypeNumber,t=>t.determinant(),"FlowGraphDeterminantBlock",t)}}class h extends r.FlowGraphCachedOperationBlock{constructor(t){super((0,i.getRichTypeByFlowGraphType)(t?.matrixType||"Matrix"),t),this._matrixType=t?.matrixType||"Matrix",this.a=this.registerDataInput("a",(0,i.getRichTypeByFlowGraphType)(t?.matrixType||"Matrix"))}_doOperation(t){let e=this.a.getValue(t),i=e.determinant();if(0!==i&&Number.isFinite(i))return e.inverse?e.inverse():a.Matrix.Invert(e)}_getInvalidOutputValue(){var t;return"Matrix2D"===(t=this._matrixType)?new o.FlowGraphMatrix2D([0,0,0,0]):"Matrix3D"===t?new o.FlowGraphMatrix3D([0,0,0,0,0,0,0,0,0]):a.Matrix.FromArray(Array(16).fill(0))}getClassName(){return"FlowGraphInvertMatrixBlock"}}class p extends l.FlowGraphBinaryOperationBlock{constructor(t){super((0,i.getRichTypeByFlowGraphType)(t?.matrixType||"Matrix"),(0,i.getRichTypeByFlowGraphType)(t?.matrixType||"Matrix"),(0,i.getRichTypeByFlowGraphType)(t?.matrixType||"Matrix"),(t,e)=>e.multiply(t),"FlowGraphMatrixMultiplicationBlock",t)}}class x extends e.FlowGraphBlock{constructor(t){super(t),this.input=this.registerDataInput("input",i.RichTypeMatrix),this.position=this.registerDataOutput("position",i.RichTypeVector3),this.rotationQuaternion=this.registerDataOutput("rotationQuaternion",i.RichTypeQuaternion),this.scaling=this.registerDataOutput("scaling",i.RichTypeVector3),this.isValid=this.registerDataOutput("isValid",i.RichTypeBoolean,!1)}_updateOutputs(t){let e,i=t._getExecutionVariable(this,"executionId",-1),s=t._getExecutionVariable(this,"cachedPosition",null),r=t._getExecutionVariable(this,"cachedRotation",null),o=t._getExecutionVariable(this,"cachedScaling",null),l=t._getExecutionVariable(this,"cachedIsValid",null);if(i===t.executionId&&s&&r&&o&&null!==l){this.isValid.setValue(l,t),this.position.setValue(s,t),this.rotationQuaternion.setValue(r,t),this.scaling.setValue(o,t);return}let n=this.input.getValue(t).m,c=!!this.config?.keepDegenerateComponents,u=new a.Vector3(n[12],n[13],n[14]),h=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]),p=Math.sqrt(n[4]*n[4]+n[5]*n[5]+n[6]*n[6]),x=Math.sqrt(n[8]*n[8]+n[9]*n[9]+n[10]*n[10]),d=t=>({isValid:!1,rotationQuaternion:a.Quaternion.Identity(),position:t?u:a.Vector3.Zero(),scaling:t?new a.Vector3(h,p,x):a.Vector3.One()}),V=Number.isFinite(h)&&Number.isFinite(p)&&Number.isFinite(x),g=Number.isFinite(n[12])&&Number.isFinite(n[13])&&Number.isFinite(n[14]);if(V&&(c||g))if(0===h||0===p||0===x)e=d(!0);else if(1e-6>Math.abs((n[0]*(n[5]*n[10]-n[6]*n[9])-n[4]*(n[1]*n[10]-n[2]*n[9])+n[8]*(n[1]*n[6]-n[2]*n[5]))/(h*p*x)))e=d(c);else{let t=a.Matrix.FromValues(n[0],n[1],n[2],0,n[4],n[5],n[6],0,n[8],n[9],n[10],0,n[12],n[13],n[14],1),i=new a.Vector3,s=new a.Quaternion,r=new a.Vector3;t.decompose(i,s,r),e={isValid:!0,position:r,rotationQuaternion:s,scaling:i}}else e=d(c);this.isValid.setValue(e.isValid,t),this.position.setValue(e.position,t),this.rotationQuaternion.setValue(e.rotationQuaternion,t),this.scaling.setValue(e.scaling,t),t._setExecutionVariable(this,"cachedIsValid",e.isValid),t._setExecutionVariable(this,"cachedPosition",e.position),t._setExecutionVariable(this,"cachedRotation",e.rotationQuaternion),t._setExecutionVariable(this,"cachedScaling",e.scaling),t._setExecutionVariable(this,"executionId",t.executionId)}getClassName(){return"FlowGraphMatrixDecompose"}}class d extends e.FlowGraphBlock{constructor(t){super(t),this.position=this.registerDataInput("position",i.RichTypeVector3),this.rotationQuaternion=this.registerDataInput("rotationQuaternion",i.RichTypeQuaternion),this.scaling=this.registerDataInput("scaling",i.RichTypeVector3),this.value=this.registerDataOutput("value",i.RichTypeMatrix)}_updateOutputs(t){let e=t._getExecutionVariable(this,"executionId",-1),i=t._getExecutionVariable(this,"cachedMatrix",null);if(e===t.executionId&&i)this.value.setValue(i,t);else{let e=a.Matrix.Compose(this.scaling.getValue(t),this.rotationQuaternion.getValue(t),this.position.getValue(t));this.value.setValue(e,t),t._setExecutionVariable(this,"cachedMatrix",e),t._setExecutionVariable(this,"executionId",t.executionId)}}getClassName(){return"FlowGraphMatrixCompose"}}let V=!1;function g(){V||(V=!0,(0,n.RegisterClass)("FlowGraphTransposeBlock",c),(0,n.RegisterClass)("FlowGraphDeterminantBlock",u),(0,n.RegisterClass)("FlowGraphInvertMatrixBlock",h),(0,n.RegisterClass)("FlowGraphMatrixMultiplicationBlock",p),(0,n.RegisterClass)("FlowGraphMatrixDecompose",x),(0,n.RegisterClass)("FlowGraphMatrixCompose",d))}t.s(["FlowGraphDeterminantBlock",0,u,"FlowGraphInvertMatrixBlock",0,h,"FlowGraphMatrixComposeBlock",0,d,"FlowGraphMatrixDecomposeBlock",0,x,"FlowGraphMatrixMultiplicationBlock",0,p,"FlowGraphTransposeBlock",0,c,"RegisterFlowGraphMatrixMathBlocks",0,g],17915),g(),t.s([],48435),t.i(48435),t.i(17915),t.s(["FlowGraphDeterminantBlock",0,u,"FlowGraphInvertMatrixBlock",0,h,"FlowGraphMatrixComposeBlock",0,d,"FlowGraphMatrixDecomposeBlock",0,x,"FlowGraphMatrixMultiplicationBlock",0,p,"FlowGraphTransposeBlock",0,c],1118)},42035,t=>{"use strict";var e=t.i(17484);class i extends e.FlowGraphCachedOperationBlock{constructor(t,e,i,a,s,r){super(i,r),this._operation=a,this._className=s,this.a=this.registerDataInput("a",t),this.b=this.registerDataInput("b",e)}_doOperation(t){let e=this.a.getValue(t),i=this.b.getValue(t);return this._operation(e,i)}getClassName(){return this._className}}t.s(["FlowGraphBinaryOperationBlock",0,i])},17484,t=>{"use strict";var e=t.i(37096),i=t.i(97009);let a="cachedOperationValue",s="cachedExecutionId";class r extends e.FlowGraphBlock{constructor(t,e){super(e),this._outputRichType=t,this.value=this.registerDataOutput("value",t),this.isValid=this.registerDataOutput("isValid",i.RichTypeBoolean)}_getInvalidOutputValue(t){let e=this._outputRichType.defaultValue,i=e?.clone;return"function"==typeof i?i.call(e):e}_updateOutputs(t){let e=t._getExecutionVariable(this,s,-1),i=t._getExecutionVariable(this,a,null);if(null!=i&&e===t.executionId)this.isValid.setValue(!0,t),this.value.setValue(i,t);else try{let e=this._doOperation(t);if(null==e)return void this._setInvalid(t);t._setExecutionVariable(this,a,e),t._setExecutionVariable(this,s,t.executionId),this.value.setValue(e,t),this.isValid.setValue(!0,t)}catch(e){this._setInvalid(t)}}_setInvalid(t){this.isValid.setValue(!1,t),this.value.setValue(this._getInvalidOutputValue(t),t)}}t.s(["FlowGraphCachedOperationBlock",0,r])},75648,t=>{"use strict";var e=t.i(17484);class i extends e.FlowGraphCachedOperationBlock{constructor(t,e,i,a,s){super(e,s),this._operation=i,this._className=a,this.a=this.registerDataInput("a",t)}_doOperation(t){return this._operation(this.a.getValue(t))}getClassName(){return this._className}}t.s(["FlowGraphUnaryOperationBlock",0,i])}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,44744,e=>{"use strict";class t{get underlyingResource(){return null}constructor(){this.references=0,this.capacity=0,this.is32Bits=!1,this.uniqueId=t._Counter++}}t._Counter=0,e.s(["DataBuffer",0,t])},76256,23733,33016,1205,e=>{"use strict";var t=e.i(80592),r=e.i(6302),s=e.i(99429),i=e.i(67501),a=e.i(85789),n=e.i(7484),_=e.i(82015),l=e.i(18799),h=e.i(44744);class u extends h.DataBuffer{constructor(e){super(),this._buffer=e}get underlyingResource(){return this._buffer}}e.s(["WebGLDataBuffer",0,u],23733);var o=e.i(92929);class c{get underlyingResource(){return this._webGLTexture}constructor(e=null,t){if(this._MSAARenderBuffers=null,this._context=t,!e&&!(e=t.createTexture()))throw Error("Unable to create webGL texture");this.set(e)}setUsage(){}set(e){this._webGLTexture=e}reset(){this._webGLTexture=null,this._MSAARenderBuffers=null}addMSAARenderBuffer(e){this._MSAARenderBuffers||(this._MSAARenderBuffers=[]),this._MSAARenderBuffers.push(e)}releaseMSAARenderBuffers(){if(this._MSAARenderBuffers){for(let e of this._MSAARenderBuffers)this._context.deleteRenderbuffer(e);this._MSAARenderBuffers=null}}getMSAARenderBuffer(e=0){return this._MSAARenderBuffers?.[e]??null}release(){this.releaseMSAARenderBuffers(),this._webGLTexture&&this._context.deleteTexture(this._webGLTexture),this.reset()}}e.s(["WebGLHardwareTexture",0,c],33016);var g=e.i(55080),f=e.i(4385),d=e.i(67863);function E(e){return 13===e||14===e||15===e||16===e||17===e||18===e||19===e}function T(e){return 13===e||17===e||18===e||19===e}e.s(["HasStencilAspect",0,T,"IsDepthTexture",0,E],1205);var R=e.i(48404);class A{}class p extends s.AbstractEngine{get name(){return this._name}set name(e){this._name=e}get version(){return this._webGLVersion}static get ShadersRepository(){return t.Effect.ShadersRepository}static set ShadersRepository(e){t.Effect.ShadersRepository=e}get supportsUniformBuffers(){return this.webGLVersion>1&&!this.disableUniformBuffers}get needPOTTextures(){return this._webGLVersion<2||this.forcePOTTextures}get _supportsHardwareTextureRescaling(){return!1}snapshotRenderingReset(){this.snapshotRendering=!1}constructor(e,t,s,i){let n;if(s=s||{},super(t??s.antialias,s,i),this._name="WebGL",this.forcePOTTextures=!1,this.validateShaderPrograms=!1,this.disableUniformBuffers=!1,this._webGLVersion=1,this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=[],this._currentFramebuffer=null,this._dummyFramebuffer=null,this._currentBufferPointers=[],this._currentInstanceLocations=[],this._currentInstanceBuffers=[],this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=[],this._maxSimultaneousTextures=0,this._maxMSAASamplesOverride=null,this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._boundUniforms={},!e)return;if(e.getContext){if(n=e,void 0===s.preserveDrawingBuffer&&(s.preserveDrawingBuffer=!1),void 0===s.xrCompatible&&(s.xrCompatible=!1),navigator&&navigator.userAgent){this._setupMobileChecks();const e=navigator.userAgent;for(const t of p.ExceptionList){const r=t.key,i=t.targets;if(new RegExp(r).test(e)){if(t.capture&&t.captureConstraint){const r=t.capture,s=t.captureConstraint,i=new RegExp(r).exec(e);if(i&&i.length>0&&parseInt(i[i.length-1])>=s)continue}for(const e of i)switch(e){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"vao":this.disableVertexArrayObjects=!0;break;case"antialias":s.antialias=!1;break;case"maxMSAASamples":this._maxMSAASamplesOverride=1}}}}if(this._doNotHandleContextLost?this._onContextLost=()=>{(0,r.deleteStateObject)(this._gl)}:(this._onContextLost=e=>{e.preventDefault(),this._contextWasLost=!0,(0,r.deleteStateObject)(this._gl),a.Logger.Warn("WebGL context lost."),this.onContextLostObservable.notifyObservers(this)},this._onContextRestored=()=>{this._restoreEngineAfterContextLost(()=>this._initGLContext())},n.addEventListener("webglcontextrestored",this._onContextRestored,!1),s.powerPreference=s.powerPreference||"high-performance"),n.addEventListener("webglcontextlost",this._onContextLost,!1),this._badDesktopOS&&(s.xrCompatible=!1),!s.disableWebGL2Support)try{this._gl=n.getContext("webgl2",s)||n.getContext("experimental-webgl2",s),this._gl&&(this._webGLVersion=2,this._shaderPlatformName="WEBGL2",this._gl.deleteQuery||(this._webGLVersion=1,this._shaderPlatformName="WEBGL1"))}catch(e){}if(!this._gl){if(!n)throw Error("The provided canvas is null or undefined.");try{this._gl=n.getContext("webgl",s)||n.getContext("experimental-webgl",s)}catch(e){throw Error("WebGL not supported",{cause:e})}}if(!this._gl)throw Error("WebGL not supported")}else{this._gl=e,n=this._gl.canvas,this._gl.renderbufferStorageMultisample?(this._webGLVersion=2,this._shaderPlatformName="WEBGL2"):this._shaderPlatformName="WEBGL1";const t=this._gl.getContextAttributes();t&&(s.stencil=t.stencil)}this._sharedInit(n),this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),void 0!==s.useHighPrecisionFloats&&(this._highPrecisionShadersAllowed=s.useHighPrecisionFloats),this.resize(),this._initGLContext(),this._initFeatures();for(let e=0;e<this._caps.maxVertexAttribs;e++)this._currentBufferPointers[e]=new A;this._shaderProcessor=this.webGLVersion>1?new l.WebGL2ShaderProcessor:new _.WebGLShaderProcessor;const h=`Babylon.js v${p.Version}`;a.Logger.Log(h+` - ${this.description}`),this._renderingCanvas&&this._renderingCanvas.setAttribute&&this._renderingCanvas.setAttribute("data-engine",h);const u=(0,r.getStateObject)(this._gl);u.validateShaderPrograms=this.validateShaderPrograms,u.parallelShaderCompile=this._caps.parallelShaderCompile}_clearEmptyResources(){this._dummyFramebuffer=null,super._clearEmptyResources()}_getShaderProcessingContext(e){return null}areAllEffectsReady(){for(let e in this._compiledEffects)if(!this._compiledEffects[e].isReady())return!1;return!0}_initGLContext(){this._caps={maxTexturesImageUnits:this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),maxCombinedTexturesImageUnits:this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),maxSamples:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),shaderFloatPrecision:0,parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile")||void 0,standardDerivatives:this._webGLVersion>1||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),s3tc_srgb:this._gl.getExtension("WEBGL_compressed_texture_s3tc_srgb")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc_srgb"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:this._webGLVersion>1||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:this._webGLVersion>1||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),supportOcclusionQuery:this._webGLVersion>1,canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float")),blendFloat:null!==this._gl.getExtension("EXT_float_blend"),supportFloatTexturesResolve:!1,rg11b10ufColorRenderable:!1,colorBufferHalfFloat:!!(this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_half_float")),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),texelFetch:1!==this._webGLVersion,blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1,canUseGLInstanceID:this._webGLVersion>1,canUseGLVertexID:this._webGLVersion>1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:this._webGLVersion>1,textureMaxLevel:this._webGLVersion>1,texture2DArrayMaxLayerCount:this._webGLVersion>1?this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS):128,disableMorphTargetTexture:!1,textureNorm16:!!this._gl.getExtension("EXT_texture_norm16"),blendParametersPerTarget:!1,dualSourceBlending:!1,supportReadWriteStorageTextures:!1},this._caps.supportFloatTexturesResolve=this._caps.colorBufferFloat,this._caps.rg11b10ufColorRenderable=this._caps.colorBufferFloat,this._glVersion=this._gl.getParameter(this._gl.VERSION);let e=this._gl.getExtension("WEBGL_debug_renderer_info");null!=e&&(this._glRenderer=this._gl.getParameter(e.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(e.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor=this._gl.getParameter(this._gl.VENDOR)||"Unknown vendor"),this._glRenderer||(this._glRenderer=this._gl.getParameter(this._gl.RENDERER)||"Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=(this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)??0)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!!(this._caps.textureFloat&&this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!!(this._caps.textureFloat&&this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._caps.textureNorm16&&(this._gl.R16_EXT=33322,this._gl.RG16_EXT=33324,this._gl.RGB16_EXT=32852,this._gl.RGBA16_EXT=32859,this._gl.R16_SNORM_EXT=36760,this._gl.RG16_SNORM_EXT=36761,this._gl.RGB16_SNORM_EXT=36762,this._gl.RGBA16_SNORM_EXT=36763);let t=this._gl.getExtension("OES_draw_buffers_indexed");if(this._caps.blendParametersPerTarget=!!t,this._alphaState=new R.AlphaState(this._caps.blendParametersPerTarget),t&&(this._gl.blendEquationSeparateIndexed=t.blendEquationSeparateiOES.bind(t),this._gl.blendEquationIndexed=t.blendEquationiOES.bind(t),this._gl.blendFuncSeparateIndexed=t.blendFuncSeparateiOES.bind(t),this._gl.blendFuncIndexed=t.blendFunciOES.bind(t),this._gl.colorMaskIndexed=t.colorMaskiOES.bind(t),this._gl.disableIndexed=t.disableiOES.bind(t),this._gl.enableIndexed=t.enableiOES.bind(t)),this._caps.dualSourceBlending=!!this._gl.getExtension("WEBGL_blend_func_extended"),this._caps.astc&&(this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR),this._caps.bptc&&(this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT),this._caps.s3tc_srgb&&(this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT),this._caps.etc2&&(this._gl.COMPRESSED_SRGB8_ETC2=this._caps.etc2.COMPRESSED_SRGB8_ETC2,this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC),this._webGLVersion>1&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=null!==this._maxMSAASamplesOverride?this._maxMSAASamplesOverride:this._gl.getParameter(this._gl.MAX_SAMPLES),this._caps.maxDrawBuffers=this._gl.getParameter(this._gl.MAX_DRAW_BUFFERS);else{let e=this._gl.getExtension("WEBGL_draw_buffers");if(null!==e){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=e.drawBuffersWEBGL.bind(e),this._caps.maxDrawBuffers=this._gl.getParameter(e.MAX_DRAW_BUFFERS_WEBGL),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(let t=0;t<16;t++)this._gl["COLOR_ATTACHMENT"+t+"_WEBGL"]=e["COLOR_ATTACHMENT"+t+"_WEBGL"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{let e=this._gl.getExtension("WEBGL_depth_texture");null!=e&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=e.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{let e=this._gl.getExtension("OES_vertex_array_object");null!=e&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=e.createVertexArrayOES.bind(e),this._gl.bindVertexArray=e.bindVertexArrayOES.bind(e),this._gl.deleteVertexArray=e.deleteVertexArrayOES.bind(e))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{let e=this._gl.getExtension("ANGLE_instanced_arrays");null!=e?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=e.drawArraysInstancedANGLE.bind(e),this._gl.drawElementsInstanced=e.drawElementsInstancedANGLE.bind(e),this._gl.vertexAttribDivisor=e.vertexAttribDivisorANGLE.bind(e)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){let e=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),t=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);if(e&&t&&(this._caps.highPrecisionShaderSupported=0!==e.precision&&0!==t.precision,this._caps.shaderFloatPrecision=Math.min(e.precision,t.precision)),!this._shouldUseHighPrecisionShader){let e=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.MEDIUM_FLOAT),t=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.MEDIUM_FLOAT);e&&t&&(this._caps.shaderFloatPrecision=Math.min(e.precision,t.precision))}this._caps.shaderFloatPrecision<10&&(this._caps.shaderFloatPrecision=10)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{let e=this._gl.getExtension("EXT_blend_minmax");null!=e&&(this._caps.blendMinMax=!0,this._gl.MAX=e.MAX_EXT,this._gl.MIN=e.MIN_EXT)}if(!this._caps.supportSRGBBuffers){if(this._webGLVersion>1)this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:WebGL2RenderingContext.SRGB,SRGB8:WebGL2RenderingContext.SRGB8,SRGB8_ALPHA8:WebGL2RenderingContext.SRGB8_ALPHA8};else{let e=this._gl.getExtension("EXT_sRGB");null!=e&&(this._caps.supportSRGBBuffers=!0,this._glSRGBExtensionValues={SRGB:e.SRGB_EXT,SRGB8:e.SRGB_ALPHA_EXT,SRGB8_ALPHA8:e.SRGB_ALPHA_EXT})}if(this._creationOptions){let e=this._creationOptions.forceSRGBBufferSupportState;void 0!==e&&(this._caps.supportSRGBBuffers=this._caps.supportSRGBBuffers&&e)}}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(let e=0;e<this._maxSimultaneousTextures;e++)this._nextFreeTextureSlots.push(e);"Mali-G72"===this._glRenderer&&(this._caps.disableMorphTargetTexture=!0)}_initFeatures(){this._features={forceBitmapOverHTMLImageElement:"u"<typeof HTMLImageElement,supportRenderAndCopyToLodForFloatTextures:1!==this._webGLVersion,supportDepthStencilTexture:1!==this._webGLVersion,supportShadowSamplers:1!==this._webGLVersion,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:1!==this._webGLVersion,trackUbosInFrame:!1,checkUbosContentBeforeUpload:!1,supportCSM:1!==this._webGLVersion,basisNeedsPOT:1===this._webGLVersion,support3DTextures:1!==this._webGLVersion,needTypeSuffixInShaderConstants:1!==this._webGLVersion,supportMSAA:1!==this._webGLVersion,supportSSAO2:1!==this._webGLVersion,supportIBLShadows:1!==this._webGLVersion,supportExtendedTextureFormats:1!==this._webGLVersion,supportSwitchCaseInShader:1!==this._webGLVersion,supportSyncTextureRead:!0,needsInvertingBitmap:!0,useUBOBindingCache:!0,needShaderCodeInlining:!1,needToAlwaysBindUniformBuffers:!1,supportRenderPasses:!1,supportSpriteInstancing:!0,forceVertexBufferStrideAndOffsetMultiple4Bytes:!1,_checkNonFloatVertexBuffersDontRecreatePipelineContext:!1}}get webGLVersion(){return this._webGLVersion}getClassName(){return"ThinEngine"}_prepareWorkingCanvas(){if(this._workingCanvas)return;this._workingCanvas=this.createCanvas(1,1);let e=this._workingCanvas.getContext("2d");e&&(this._workingContext=e)}getInfo(){return this.getGlInfo()}getGlInfo(){return{vendor:this._glVendor,renderer:this._glRenderer,version:this._glVersion}}extractDriverInfo(){let e=this.getGlInfo();return e&&e.renderer?e.renderer:""}getRenderWidth(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth}getRenderHeight(e=!1){return!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight}clear(e,t,r,s=!1,i=0){let a=this.stencilStateComposer.useStencilGlobalOnly;this.stencilStateComposer.useStencilGlobalOnly=!0,this.applyStates(),this.stencilStateComposer.useStencilGlobalOnly=a;let n=0;if(t&&e){let t=!0;if(this._currentRenderTarget){let r=this._currentRenderTarget.texture?.format;if(8===r||9===r||10===r||11===r){let r=this._currentRenderTarget.texture?.type;7===r||5===r?(p._TempClearColorUint32[0]=255*e.r,p._TempClearColorUint32[1]=255*e.g,p._TempClearColorUint32[2]=255*e.b,p._TempClearColorUint32[3]=255*e.a,this._gl.clearBufferuiv(this._gl.COLOR,0,p._TempClearColorUint32)):(p._TempClearColorInt32[0]=255*e.r,p._TempClearColorInt32[1]=255*e.g,p._TempClearColorInt32[2]=255*e.b,p._TempClearColorInt32[3]=255*e.a,this._gl.clearBufferiv(this._gl.COLOR,0,p._TempClearColorInt32)),t=!1}}t&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),n|=this._gl.COLOR_BUFFER_BIT)}r&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GEQUAL,this._gl.clearDepth(0)):this._gl.clearDepth(1),n|=this._gl.DEPTH_BUFFER_BIT),s&&(this._gl.clearStencil(i),n|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(n)}_viewport(e,t,r,s){(e!==this._viewportCached.x||t!==this._viewportCached.y||r!==this._viewportCached.z||s!==this._viewportCached.w)&&(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=r,this._viewportCached.w=s,this._gl.viewport(e,t,r,s))}endFrame(){super.endFrame(),this._badOS&&this.flushFramebuffer()}get performanceMonitor(){throw Error("Not Supported by ThinEngine")}bindFramebuffer(e,t=0,r,s,i,n=0,_=0){this._currentRenderTarget&&this._resolveAndGenerateMipMapsFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(e._framebuffer);let l=this._gl;e.isMulti||(e.is2DArray||e.is3D?(l.framebufferTextureLayer(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,e.texture._hardwareTexture?.underlyingResource,n,_),e._currentLOD=n):e.isCube?l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.texture._hardwareTexture?.underlyingResource,n):e._currentLOD!==n&&(l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,e.texture._hardwareTexture?.underlyingResource,n),e._currentLOD=n));let h=e._depthStencilTexture;if(h){e.is3D&&(e.texture.width!==h.width||e.texture.height!==h.height||e.texture.depth!==h.depth)&&a.Logger.Warn("Depth/Stencil attachment for 3D target must have same dimensions as color attachment");let r=e._depthStencilTextureWithStencil?l.DEPTH_STENCIL_ATTACHMENT:l.DEPTH_ATTACHMENT;e.is2DArray||e.is3D?l.framebufferTextureLayer(l.FRAMEBUFFER,r,h._hardwareTexture?.underlyingResource,n,_):e.isCube?l.framebufferTexture2D(l.FRAMEBUFFER,r,l.TEXTURE_CUBE_MAP_POSITIVE_X+t,h._hardwareTexture?.underlyingResource,n):l.framebufferTexture2D(l.FRAMEBUFFER,r,l.TEXTURE_2D,h._hardwareTexture?.underlyingResource,n)}e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._MSAAFramebuffer),this._cachedViewport&&!i?this.setViewport(this._cachedViewport,r,s):(!r&&(r=e.width,n&&(r/=Math.pow(2,n))),!s&&(s=e.height,n&&(s/=Math.pow(2,n))),this._viewport(0,0,r,s)),this.wipeCaches()}setStateCullFaceType(e,t){let r=this.cullBackFaces??e??!0?this._gl.BACK:this._gl.FRONT;(this._depthCullingState.cullFace!==r||t)&&(this._depthCullingState.cullFace=r)}setState(e,t=0,r,s=!1,i,a,n=0){(this._depthCullingState.cull!==e||r)&&(this._depthCullingState.cull=e),this.setStateCullFaceType(i,r),this.setZOffset(t),this.setZOffsetUnits(n);let _=s?this._gl.CW:this._gl.CCW;(this._depthCullingState.frontFace!==_||r)&&(this._depthCullingState.frontFace=_),this._stencilStateComposer.stencilMaterial=a}_resolveAndGenerateMipMapsFramebuffer(e,t=!1){e.disableAutomaticMSAAResolve||(e.isMulti?this.resolveMultiFramebuffer(e):this.resolveFramebuffer(e)),t||(e.isMulti?this.generateMipMapsMultiFramebuffer(e):this.generateMipMapsFramebuffer(e))}_bindUnboundFramebuffer(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)}_currentFrameBufferIsDefaultFrameBuffer(){return null===this._currentFramebuffer}generateMipmaps(e){let t=this._getTextureTarget(e);this._bindTextureDirectly(t,e,!0),this._gl.generateMipmap(t),this._bindTextureDirectly(t,null)}unBindFramebuffer(e,t,r){this._currentRenderTarget=null,this._resolveAndGenerateMipMapsFramebuffer(e,t),r&&(e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._framebuffer),r()),this._bindUnboundFramebuffer(null)}generateMipMapsFramebuffer(e){!e.isMulti&&e.texture?.generateMipMaps&&!e.isCube&&this.generateMipmaps(e.texture)}resolveFramebuffer(e){let t=this._gl;if(!e._MSAAFramebuffer||e.isMulti)return;let r=e.resolveMSAAColors?t.COLOR_BUFFER_BIT:0;r|=e._generateDepthBuffer&&e.resolveMSAADepth?t.DEPTH_BUFFER_BIT:0,r|=e._generateStencilBuffer&&e.resolveMSAAStencil?t.STENCIL_BUFFER_BIT:0,t.bindFramebuffer(t.READ_FRAMEBUFFER,e._MSAAFramebuffer),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,e._framebuffer),t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,r,t.NEAREST)}flushFramebuffer(){this._gl.flush()}restoreDefaultFramebuffer(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()}_resetVertexBufferBinding(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null}createVertexBuffer(e,t,r){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)}_createVertexBuffer(e,t){let r=this._gl.createBuffer();if(!r)throw Error("Unable to create vertex buffer");let s=new u(r);return this.bindArrayBuffer(s),"number"!=typeof e?e instanceof Array?(this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),t),s.capacity=4*e.length):(this._gl.bufferData(this._gl.ARRAY_BUFFER,e,t),s.capacity=e.byteLength):(this._gl.bufferData(this._gl.ARRAY_BUFFER,new Uint8Array(e),t),s.capacity=e),this._resetVertexBufferBinding(),s.references=1,s}createDynamicVertexBuffer(e,t){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)}_resetIndexBufferBinding(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null}createIndexBuffer(e,t,r){let s=this._gl.createBuffer(),i=new u(s);if(!s)throw Error("Unable to create index buffer");this.bindIndexBuffer(i);let a=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,a,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),i.references=1,i.is32Bits=4===a.BYTES_PER_ELEMENT,i}_normalizeIndexData(e){if(2===e.BYTES_PER_ELEMENT)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;else for(let t=0;t<e.length;t++)if(e[t]>=65535)return new Uint32Array(e)}return new Uint16Array(e)}bindArrayBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ARRAY_BUFFER)}bindUniformBlock(e,t,r){let s=e.program,i=this._gl.getUniformBlockIndex(s,t);this._gl.uniformBlockBinding(s,i,r)}bindIndexBuffer(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)}_bindBuffer(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)}updateArrayBuffer(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)}_vertexAttribPointer(e,t,r,s,i,a,n){let _=this._currentBufferPointers[t];if(!_)return;let l=!1;_.active?(_.buffer!==e&&(_.buffer=e,l=!0),_.size!==r&&(_.size=r,l=!0),_.type!==s&&(_.type=s,l=!0),_.normalized!==i&&(_.normalized=i,l=!0),_.stride!==a&&(_.stride=a,l=!0),_.offset!==n&&(_.offset=n,l=!0)):(l=!0,_.active=!0,_.index=t,_.size=r,_.type=s,_.normalized=i,_.stride=a,_.offset=n,_.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),s===this._gl.UNSIGNED_INT||s===this._gl.INT?this._gl.vertexAttribIPointer(t,r,s,a,n):this._gl.vertexAttribPointer(t,r,s,i,a,n))}_bindIndexBufferWithCache(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)}_bindVertexBuffersAttributes(e,t,r){let s=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(let i=0;i<s.length;i++){let a=t.getAttributeLocation(i);if(a>=0){let t=s[i],n=null;if(r&&(n=r[t]),n||(n=e[t]),!n)continue;this._gl.enableVertexAttribArray(a),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[a]=!0);let _=n.getBuffer();_&&(this._vertexAttribPointer(_,a,n.getSize(),n.type,n.normalized,n.byteStride,n.byteOffset),n.getIsInstanced()&&(this._gl.vertexAttribDivisor(a,n.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(a),this._currentInstanceBuffers.push(_))))}}}recordVertexArrayObject(e,t,r,s){let i=this._gl.createVertexArray();if(!i)throw Error("Unable to create VAO");return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(i),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,r,s),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),i}bindVertexArrayObject(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)}bindBuffersDirectly(e,t,r,s,i){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==i){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i;let t=i.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();let a=0;for(let n=0;n<t;n++)if(n<r.length){let t=i.getAttributeLocation(n);t>=0&&(this._gl.enableVertexAttribArray(t),this._vertexAttribArraysEnabled[t]=!0,this._vertexAttribPointer(e,t,r[n],this._gl.FLOAT,!1,s,a)),a+=4*r[n]}}this._bindIndexBufferWithCache(t)}_unbindVertexArrayObject(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))}bindBuffers(e,t,r,s){(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r)&&(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r,this._bindVertexBuffersAttributes(e,r,s)),this._bindIndexBufferWithCache(t)}unbindInstanceAttributes(){let e;for(let t=0,r=this._currentInstanceLocations.length;t<r;t++){let r=this._currentInstanceBuffers[t];e!=r&&r.references&&(e=r,this.bindArrayBuffer(r));let s=this._currentInstanceLocations[t];this._gl.vertexAttribDivisor(s,0)}this._currentInstanceBuffers.length=0,this._currentInstanceLocations.length=0}releaseVertexArrayObject(e){this._gl.deleteVertexArray(e)}_releaseBuffer(e){return e.references--,0===e.references&&(this._deleteBuffer(e),!0)}_deleteBuffer(e){this._gl.deleteBuffer(e.underlyingResource)}updateAndBindInstancesBuffer(e,t,r){if(this.bindArrayBuffer(e),t&&this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t),void 0!==r[0].index)this.bindInstancesBuffer(e,r,!0);else for(let t=0;t<4;t++){let s=r[t];this._vertexAttribArraysEnabled[s]||(this._gl.enableVertexAttribArray(s),this._vertexAttribArraysEnabled[s]=!0),this._vertexAttribPointer(e,s,4,this._gl.FLOAT,!1,64,16*t),this._gl.vertexAttribDivisor(s,1),this._currentInstanceLocations.push(s),this._currentInstanceBuffers.push(e)}}bindInstancesBuffer(e,t,r=!0){this.bindArrayBuffer(e);let s=0;if(r)for(let e=0;e<t.length;e++)s+=4*t[e].attributeSize;for(let r=0;r<t.length;r++){let i=t[r];void 0===i.index&&(i.index=this._currentEffect.getAttributeLocationByName(i.attributeName)),i.index<0||(this._vertexAttribArraysEnabled[i.index]||(this._gl.enableVertexAttribArray(i.index),this._vertexAttribArraysEnabled[i.index]=!0),this._vertexAttribPointer(e,i.index,i.attributeSize,i.attributeType||this._gl.FLOAT,i.normalized||!1,s,i.offset),this._gl.vertexAttribDivisor(i.index,void 0===i.divisor?1:i.divisor),this._currentInstanceLocations.push(i.index),this._currentInstanceBuffers.push(e))}}disableInstanceAttributeByName(e){if(!this._currentEffect)return;let t=this._currentEffect.getAttributeLocationByName(e);this.disableInstanceAttribute(t)}disableInstanceAttribute(e){let t,r=!1;for(;-1!==(t=this._currentInstanceLocations.indexOf(e));)this._currentInstanceLocations.splice(t,1),this._currentInstanceBuffers.splice(t,1),r=!0;r&&(this._gl.vertexAttribDivisor(e,0),this.disableAttributeByIndex(e))}disableAttributeByIndex(e){this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1}draw(e,t,r,s){this.drawElementsType(+!e,t,r,s)}drawPointClouds(e,t,r){this.drawArraysType(2,e,t,r)}drawUnIndexed(e,t,r,s){this.drawArraysType(+!e,t,r,s)}drawElementsType(e,t,r,s){this.applyStates(),this._reportDrawCall();let i=this._drawMode(e),a=this._uintIndicesCurrentlySet?this._gl.UNSIGNED_INT:this._gl.UNSIGNED_SHORT,n=this._uintIndicesCurrentlySet?4:2;s?this._gl.drawElementsInstanced(i,r,a,t*n,s):this._gl.drawElements(i,r,a,t*n)}drawArraysType(e,t,r,s){this.applyStates(),this._reportDrawCall();let i=this._drawMode(e);s?this._gl.drawArraysInstanced(i,t,r,s):this._gl.drawArrays(i,t,r)}_drawMode(e){switch(e){case 0:default:return this._gl.TRIANGLES;case 2:case 3:return this._gl.POINTS;case 1:case 4:return this._gl.LINES;case 5:return this._gl.LINE_LOOP;case 6:return this._gl.LINE_STRIP;case 7:return this._gl.TRIANGLE_STRIP;case 8:return this._gl.TRIANGLE_FAN}}_releaseEffect(e){this._compiledEffects[e._key]&&delete this._compiledEffects[e._key];let t=e.getPipelineContext();t&&this._deletePipelineContext(t)}_deletePipelineContext(e){e&&e.program&&(e.program.__SPECTOR_rebuildProgram=null,(0,d.resetCachedPipeline)(e),this._gl&&(this._currentProgram===e.program&&this._setProgram(null),this._gl.deleteProgram(e.program)))}_getGlobalDefines(e){return(0,f._GetGlobalDefines)(e,this.isNDCHalfZRange,this.useReverseDepthBuffer,this.useExactSrgbConversions)}createEffect(e,s,i,a,n,_,l,h,u,o=0,c){let g="string"==typeof e?e:e.vertexToken||e.vertexSource||e.vertexElement||e.vertex,f="string"==typeof e?e:e.fragmentToken||e.fragmentSource||e.fragmentElement||e.fragment,d=this._getGlobalDefines(),E=void 0!==s.attributes,T=n??s.defines??"";d&&(T+=d);let R=g+"+"+f+"@"+T;if(this._compiledEffects[R]){let e=this._compiledEffects[R];return l&&e.isReady()&&l(e),e._refCount++,e}this._gl&&(0,r.getStateObject)(this._gl);let A=new t.Effect(e,s,E?this:i,a,this,n,_,l,h,u,R,s.shaderLanguage??o,s.extraInitializationsAsync??c);return this._compiledEffects[R]=A,A}_getShaderSource(e){return this._gl.getShaderSource(e)}createRawShaderProgram(e,t,s,i,a=null){let n=(0,r.getStateObject)(this._gl);return n._contextWasLost=this._contextWasLost,n.validateShaderPrograms=this.validateShaderPrograms,(0,r.createRawShaderProgram)(e,t,s,i||this._gl,a)}createShaderProgram(e,t,s,i,a,n=null){let _=(0,r.getStateObject)(this._gl);return _._contextWasLost=this._contextWasLost,_.validateShaderPrograms=this.validateShaderPrograms,(0,r.createShaderProgram)(e,t,s,i,a||this._gl,n)}inlineShaderCode(e){return e}createPipelineContext(e){this._gl&&((0,r.getStateObject)(this._gl).parallelShaderCompile=this._caps.parallelShaderCompile);let t=(0,r.createPipelineContext)(this._gl,e);return t.engine=this,t}createMaterialContext(){}createDrawContext(){}_finalizePipelineContext(e){return(0,r._finalizePipelineContext)(e,this._gl,this.validateShaderPrograms)}_preparePipelineContextAsync(e,t,s,i,a,n,_,l,h,u,o){let c=(0,r.getStateObject)(this._gl);return c._contextWasLost=this._contextWasLost,c.validateShaderPrograms=this.validateShaderPrograms,c._createShaderProgramInjection=this._createShaderProgram.bind(this),c.createRawShaderProgramInjection=this.createRawShaderProgram.bind(this),c.createShaderProgramInjection=this.createShaderProgram.bind(this),c.loadFileInjection=this._loadFile.bind(this),(0,r._preparePipelineContext)(e,t,s,i,a,n,_,l,h,u,o)}_createShaderProgram(e,t,s,i,a=null){return(0,r._createShaderProgram)(e,t,s,i,a)}_isRenderingStateCompiled(e){return!this._isDisposed&&(0,r._isRenderingStateCompiled)(e,this._gl,this.validateShaderPrograms)}_executeWhenRenderingStateIsCompiled(e,t){(0,r._executeWhenRenderingStateIsCompiled)(e,t)}getUniforms(e,t){let r=[];for(let s=0;s<t.length;s++)r.push(this._gl.getUniformLocation(e.program,t[s]));return r}getAttributes(e,t){let r=[];for(let s=0;s<t.length;s++)try{r.push(this._gl.getAttribLocation(e.program,t[s]))}catch(e){r.push(-1)}return r}enableEffect(e){(e=null!==e&&(0,i.IsWrapper)(e)?e.effect:e)&&e!==this._currentEffect&&(this._stencilStateComposer.stencilMaterial=void 0,this.bindSamplers(e),this._currentEffect=e,e.onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e))}setInt(e,t){return!!e&&(this._gl.uniform1i(e,t),!0)}setInt2(e,t,r){return!!e&&(this._gl.uniform2i(e,t,r),!0)}setInt3(e,t,r,s){return!!e&&(this._gl.uniform3i(e,t,r,s),!0)}setInt4(e,t,r,s,i){return!!e&&(this._gl.uniform4i(e,t,r,s,i),!0)}setIntArray(e,t){return!!e&&(this._gl.uniform1iv(e,t),!0)}setIntArray2(e,t){return!!e&&t.length%2==0&&(this._gl.uniform2iv(e,t),!0)}setIntArray3(e,t){return!!e&&t.length%3==0&&(this._gl.uniform3iv(e,t),!0)}setIntArray4(e,t){return!!e&&t.length%4==0&&(this._gl.uniform4iv(e,t),!0)}setUInt(e,t){return!!e&&(this._gl.uniform1ui(e,t),!0)}setUInt2(e,t,r){return!!e&&(this._gl.uniform2ui(e,t,r),!0)}setUInt3(e,t,r,s){return!!e&&(this._gl.uniform3ui(e,t,r,s),!0)}setUInt4(e,t,r,s,i){return!!e&&(this._gl.uniform4ui(e,t,r,s,i),!0)}setUIntArray(e,t){return!!e&&(this._gl.uniform1uiv(e,t),!0)}setUIntArray2(e,t){return!!e&&t.length%2==0&&(this._gl.uniform2uiv(e,t),!0)}setUIntArray3(e,t){return!!e&&t.length%3==0&&(this._gl.uniform3uiv(e,t),!0)}setUIntArray4(e,t){return!!e&&t.length%4==0&&(this._gl.uniform4uiv(e,t),!0)}setArray(e,t){return!!e&&!(t.length<1)&&(this._gl.uniform1fv(e,t),!0)}setArray2(e,t){return!!e&&t.length%2==0&&(this._gl.uniform2fv(e,t),!0)}setArray3(e,t){return!!e&&t.length%3==0&&(this._gl.uniform3fv(e,t),!0)}setArray4(e,t){return!!e&&t.length%4==0&&(this._gl.uniform4fv(e,t),!0)}setMatrices(e,t){return!!e&&(this._gl.uniformMatrix4fv(e,!1,t),!0)}setMatrix3x3(e,t){return!!e&&(this._gl.uniformMatrix3fv(e,!1,t),!0)}setMatrix2x2(e,t){return!!e&&(this._gl.uniformMatrix2fv(e,!1,t),!0)}setFloat(e,t){return!!e&&(this._gl.uniform1f(e,t),!0)}setFloat2(e,t,r){return!!e&&(this._gl.uniform2f(e,t,r),!0)}setFloat3(e,t,r,s){return!!e&&(this._gl.uniform3f(e,t,r,s),!0)}setFloat4(e,t,r,s,i){return!!e&&(this._gl.uniform4f(e,t,r,s,i),!0)}applyStates(){if(this._depthCullingState.apply(this._gl),this._stencilStateComposer.apply(this._gl),this._alphaState.apply(this._gl,this._currentRenderTarget&&this._currentRenderTarget.textures?this._currentRenderTarget.textures.length:1),this._colorWriteChanged){this._colorWriteChanged=!1;let e=this._colorWrite;this._gl.colorMask(e,e,e,e)}}wipeCaches(e){(!this.preventCacheWipeBetweenFrames||e)&&(this._currentEffect=null,this._viewportCached.x=0,this._viewportCached.y=0,this._viewportCached.z=0,this._viewportCached.w=0,this._unbindVertexArrayObject(),e&&(this._currentProgram=null,this.resetTextureCache(),this._stencilStateComposer.reset(),this._depthCullingState.reset(),this._depthCullingState.depthFunc=this._gl.LEQUAL,this._alphaState.reset(),this._resetAlphaMode(),this._colorWrite=!0,this._colorWriteChanged=!0,this._unpackFlipYCached=null,this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),this._mustWipeVertexAttributes=!0,this.unbindAllAttributes()),this._resetVertexBufferBinding(),this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null,this.bindIndexBuffer(null))}_getSamplingParameters(e,t){let r=this._gl,s=r.NEAREST,i=r.NEAREST,a=!1;switch(e){case 11:s=r.LINEAR,i=t?r.LINEAR_MIPMAP_NEAREST:r.LINEAR;break;case 3:s=r.LINEAR,a=!0,i=t?r.LINEAR_MIPMAP_LINEAR:r.LINEAR;break;case 8:a=!0,s=r.NEAREST,i=t?r.NEAREST_MIPMAP_LINEAR:r.NEAREST;break;case 4:s=r.NEAREST,i=t?r.NEAREST_MIPMAP_NEAREST:r.NEAREST;break;case 5:s=r.NEAREST,i=t?r.LINEAR_MIPMAP_NEAREST:r.LINEAR;break;case 6:a=!0,s=r.NEAREST,i=t?r.LINEAR_MIPMAP_LINEAR:r.LINEAR;break;case 7:s=r.NEAREST,i=r.LINEAR;break;case 1:s=r.NEAREST,i=r.NEAREST;break;case 9:s=r.LINEAR,i=t?r.NEAREST_MIPMAP_NEAREST:r.NEAREST;break;case 10:a=!0,s=r.LINEAR,i=t?r.NEAREST_MIPMAP_LINEAR:r.NEAREST;break;case 2:s=r.LINEAR,i=r.LINEAR;break;case 12:s=r.LINEAR,i=r.NEAREST}return{min:i,mag:s,hasMipMaps:a}}_createTexture(){let e=this._gl.createTexture();if(!e)throw Error("Unable to create texture");return e}_createHardwareTexture(){return new c(this._createTexture(),this._gl)}_createInternalTexture(e,t,r=!0,s=0){let i,n,_=!1,l=0,h=3,u=5,o=!1,c=1,f=!1,d=0,R=!1;void 0!==t&&"object"==typeof t?(i=!!t.generateMipMaps,_=!!t.createMipMaps,l=void 0===t.type?0:t.type,h=void 0===t.samplingMode?3:t.samplingMode,u=void 0===t.format?5:t.format,o=void 0!==t.useSRGBBuffer&&t.useSRGBBuffer,c=t.samples??1,n=t.label,f=!!t.createMSAATexture,d=t.comparisonFunction||0,R=!!t.isCube):i=!!t,o&&(o=this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU)),(1!==l||this._caps.textureFloatLinearFiltering)&&(2!==l||this._caps.textureHalfFloatLinearFiltering)||(h=1),1!==l||this._caps.textureFloat||(l=0,a.Logger.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));let A=E(u),p=T(u),x=this._gl,S=new g.InternalTexture(this,s),b=e.width||e,m=e.height||e,C=e.depth||0,B=e.layers||0,P=this._getSamplingParameters(h,(i||_)&&!A),L=0!==B?x.TEXTURE_2D_ARRAY:0!==C?x.TEXTURE_3D:R?x.TEXTURE_CUBE_MAP:x.TEXTURE_2D,G=A?this._getInternalFormatFromDepthTextureFormat(u,!0,p):this._getRGBABufferInternalSizedFormat(l,u,o),I=A?p?x.DEPTH_STENCIL:x.DEPTH_COMPONENT:this._getInternalFormat(u),M=A?this._getWebGLTextureTypeFromDepthTextureFormat(u):this._getWebGLTextureType(l);if(this._bindTextureDirectly(L,S),0!==B)S.is2DArray=!0,x.texImage3D(L,0,G,b,m,B,0,I,M,null);else if(0!==C)S.is3D=!0,x.texImage3D(L,0,G,b,m,C,0,I,M,null);else if(R){S.isCube=!0;for(let e=0;e<6;e++)x.texImage2D(x.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,G,b,m,0,I,M,null)}else x.texImage2D(L,0,G,b,m,0,I,M,null);if(x.texParameteri(L,x.TEXTURE_MAG_FILTER,P.mag),x.texParameteri(L,x.TEXTURE_MIN_FILTER,P.min),x.texParameteri(L,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(L,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),A&&this.webGLVersion>1&&(0===d?(x.texParameteri(L,x.TEXTURE_COMPARE_FUNC,515),x.texParameteri(L,x.TEXTURE_COMPARE_MODE,x.NONE)):(x.texParameteri(L,x.TEXTURE_COMPARE_FUNC,d),x.texParameteri(L,x.TEXTURE_COMPARE_MODE,x.COMPARE_REF_TO_TEXTURE))),(i||_)&&this._gl.generateMipmap(L),this._bindTextureDirectly(L,null),S._useSRGBBuffer=o,S.baseWidth=b,S.baseHeight=m,S.width=b,S.height=m,S.depth=B||C,S.isReady=!0,S.samples=c,S.generateMipMaps=i,S.samplingMode=h,S.type=l,S.format=u,S.label=n,S.comparisonFunction=d,this._internalTexturesCache.push(S),f){let e;if(!(e=E(S.format)?this._setupFramebufferDepthAttachments(T(S.format),19!==S.format,S.width,S.height,c,S.format,!0):this._createRenderBuffer(S.width,S.height,c,-1,this._getRGBABufferInternalSizedFormat(S.type,S.format,S._useSRGBBuffer),-1)))throw Error("Unable to create render buffer");S._autoMSAAManagement=!0;let t=S._hardwareTexture;t||(t=S._hardwareTexture=this._createHardwareTexture()),t.addMSAARenderBuffer(e)}return S}_getUseSRGBBuffer(e,t){return e&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||t)}createTexture(e,t,r,s,i=3,a=null,n=null,_=null,l=null,h=null,u=null,o,c,f,d){return this._createTextureBase(e,t,r,s,i,a,n,(...e)=>this._prepareWebGLTexture(...e,h),(e,t,r,i,a,n)=>{let _=this._gl,l=r.width===e&&r.height===t;a._creationFlags=f??0;let h=this._getTexImageParametersForCreateTexture(a.format,a._useSRGBBuffer);if(l)return _.texImage2D(_.TEXTURE_2D,0,h.internalFormat,h.format,h.type,r),!1;let u=this._caps.maxTextureSize;if(r.width>u||r.height>u||!this._supportsHardwareTextureRescaling)return this._prepareWorkingCanvas(),!!this._workingCanvas&&!!this._workingContext&&(this._workingCanvas.width=e,this._workingCanvas.height=t,this._workingContext.drawImage(r,0,0,r.width,r.height,0,0,e,t),_.texImage2D(_.TEXTURE_2D,0,h.internalFormat,h.format,h.type,this._workingCanvas),a.width=e,a.height=t,!1);{let e=new g.InternalTexture(this,2);this._bindTextureDirectly(_.TEXTURE_2D,e,!0),_.texImage2D(_.TEXTURE_2D,0,h.internalFormat,h.format,h.type,r),this._rescaleTexture(e,a,s,h.format,()=>{this._releaseTexture(e),this._bindTextureDirectly(_.TEXTURE_2D,a,!0),n()})}return!0},_,l,h,u,o,c,d)}_getTexImageParametersForCreateTexture(e,t){let r,s;return 1===this.webGLVersion?s=r=this._getInternalFormat(e,t):(r=this._getInternalFormat(e,!1),s=this._getRGBABufferInternalSizedFormat(0,e,t)),{internalFormat:s,format:r,type:this._gl.UNSIGNED_BYTE}}_rescaleTexture(e,t,r,s,i){}_unpackFlipY(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,+!!e),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))}_getUnpackAlignement(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)}_getTextureTarget(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D}updateTextureSamplingMode(e,t,r=!1){let s=this._getTextureTarget(t),i=this._getSamplingParameters(e,t.useMipMaps||r);this._setTextureParameterInteger(s,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(s,this._gl.TEXTURE_MIN_FILTER,i.min),r&&i.hasMipMaps&&(t.generateMipMaps=!0,this._gl.generateMipmap(s)),this._bindTextureDirectly(s,null),t.samplingMode=e}updateTextureDimensions(e,t,r,s=1){}updateTextureWrappingMode(e,t,r=null,s=null){let i=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(i,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==r&&(this._setTextureParameterInteger(i,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(r),e),e._cachedWrapV=r),(e.is2DArray||e.is3D)&&null!==s&&(this._setTextureParameterInteger(i,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(s),e),e._cachedWrapR=s),this._bindTextureDirectly(i,null)}_uploadCompressedDataToTextureDirectly(e,t,r,s,i,a=0,n=0){let _=this._gl,l=_.TEXTURE_2D;if(e.isCube&&(l=_.TEXTURE_CUBE_MAP_POSITIVE_X+a),e._useSRGBBuffer)switch(t){case 37492:case 36196:this._caps.etc2?t=_.COMPRESSED_SRGB8_ETC2:e._useSRGBBuffer=!1;break;case 37496:this._caps.etc2?t=_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e._useSRGBBuffer=!1;break;case 36492:t=_.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;break;case 37808:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;break;case 37809:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;break;case 37810:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;break;case 37811:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;break;case 37812:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;break;case 37813:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;break;case 37814:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;break;case 37815:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;break;case 37816:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;break;case 37817:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;break;case 37818:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;break;case 37819:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;break;case 37820:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;break;case 37821:t=_.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;break;case 33776:this._caps.s3tc_srgb?t=_.COMPRESSED_SRGB_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33777:this._caps.s3tc_srgb?t=_.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case 33779:this._caps.s3tc_srgb?t=_.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:e._useSRGBBuffer=!1;break;default:e._useSRGBBuffer=!1}if(e.generateMipMaps){let a=e._hardwareTexture;a.memoryAllocated||(_.texStorage2D(e.isCube?_.TEXTURE_CUBE_MAP:_.TEXTURE_2D,Math.floor(Math.log2(Math.max(r,s)))+1,t,e.width,e.height),a.memoryAllocated=!0),this._gl.compressedTexSubImage2D(l,n,0,0,r,s,t,i)}else this._gl.compressedTexImage2D(l,n,t,r,s,0,i)}_uploadDataToTextureDirectly(e,t,r=0,s=0,i,a=!1){let n=this._gl,_=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),h=void 0===i?this._getRGBABufferInternalSizedFormat(e.type,e.format,e._useSRGBBuffer):this._getInternalFormat(i,e._useSRGBBuffer);this._unpackFlipY(e.invertY);let u=n.TEXTURE_2D;e.isCube&&(u=n.TEXTURE_CUBE_MAP_POSITIVE_X+r);let o=Math.round(Math.log(e.width)*Math.LOG2E),c=Math.round(Math.log(e.height)*Math.LOG2E),g=a?e.width:Math.pow(2,Math.max(o-s,0)),f=a?e.height:Math.pow(2,Math.max(c-s,0));n.texImage2D(u,s,h,g,f,0,l,_,t)}updateTextureData(e,t,r,s,i,a,n=0,_=0,l=!1){let h=this._gl,u=this._getWebGLTextureType(e.type),o=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);let c=h.TEXTURE_2D,g=h.TEXTURE_2D;e.isCube&&(g=h.TEXTURE_CUBE_MAP_POSITIVE_X+n,c=h.TEXTURE_CUBE_MAP),this._bindTextureDirectly(c,e,!0),h.texSubImage2D(g,_,r,s,i,a,o,u,t),l&&this._gl.generateMipmap(g),this._bindTextureDirectly(c,null)}_uploadArrayBufferViewToTexture(e,t,r=0,s=0){let i=this._gl,a=e.isCube?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D;this._bindTextureDirectly(a,e,!0),this._uploadDataToTextureDirectly(e,t,r,s),this._bindTextureDirectly(a,null,!0)}_prepareWebGLTextureContinuation(e,t,r,s,i){let a=this._gl;if(!a)return;let n=this._getSamplingParameters(i,!r);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,n.mag),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,n.min),r||s||a.generateMipmap(a.TEXTURE_2D),this._bindTextureDirectly(a.TEXTURE_2D,null),t&&t.removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}_prepareWebGLTexture(e,t,r,s,i,a,n,_,l,h){let u=this.getCaps().maxTextureSize,c=Math.min(u,this.needPOTTextures?(0,o.GetExponentOfTwo)(s.width,u):s.width),g=Math.min(u,this.needPOTTextures?(0,o.GetExponentOfTwo)(s.height,u):s.height),f=this._gl;if(f){if(!e._hardwareTexture){r&&r.removePendingData(e);return}this._bindTextureDirectly(f.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===i||!!i),e.baseWidth=s.width,e.baseHeight=s.height,e.width=c,e.height=g,e.isReady=!0,e.type=-1!==e.type?e.type:0,e.format=-1!==e.format?e.format:h??(".jpg"!==t||e._useSRGBBuffer?5:4),_(c,g,s,t,e,()=>{this._prepareWebGLTextureContinuation(e,r,a,n,l)})||this._prepareWebGLTextureContinuation(e,r,a,n,l)}}_getInternalFormatFromDepthTextureFormat(e,t,r){let s=this._gl;if(!t)return s.STENCIL_INDEX8;let i=r?s.DEPTH_STENCIL:s.DEPTH_COMPONENT;return this.webGLVersion>1?15===e?i=s.DEPTH_COMPONENT16:16===e?i=s.DEPTH_COMPONENT24:17===e||13===e?i=r?s.DEPTH24_STENCIL8:s.DEPTH_COMPONENT24:14===e?i=s.DEPTH_COMPONENT32F:18===e&&(i=r?s.DEPTH32F_STENCIL8:s.DEPTH_COMPONENT32F):i=s.DEPTH_COMPONENT16,i}_getWebGLTextureTypeFromDepthTextureFormat(e){let t=this._gl,r=t.UNSIGNED_INT;return 15===e?r=t.UNSIGNED_SHORT:17===e||13===e?r=t.UNSIGNED_INT_24_8:14===e?r=t.FLOAT:18===e?r=t.FLOAT_32_UNSIGNED_INT_24_8_REV:19===e&&(r=t.UNSIGNED_BYTE),r}_setupFramebufferDepthAttachments(e,t,r,s,i=1,a,n=!1){let _=this._gl;a=a??(e?13:14);let l=this._getInternalFormatFromDepthTextureFormat(a,t,e);return e&&t?this._createRenderBuffer(r,s,i,_.DEPTH_STENCIL,l,n?-1:_.DEPTH_STENCIL_ATTACHMENT):t?this._createRenderBuffer(r,s,i,l,l,n?-1:_.DEPTH_ATTACHMENT):e?this._createRenderBuffer(r,s,i,l,l,n?-1:_.STENCIL_ATTACHMENT):null}_createRenderBuffer(e,t,r,s,i,a,n=!0){let _=this._gl.createRenderbuffer();return this._updateRenderBuffer(_,e,t,r,s,i,a,n)}_updateRenderBuffer(e,t,r,s,i,a,n,_=!0){let l=this._gl;return l.bindRenderbuffer(l.RENDERBUFFER,e),s>1&&l.renderbufferStorageMultisample?l.renderbufferStorageMultisample(l.RENDERBUFFER,s,a,t,r):l.renderbufferStorage(l.RENDERBUFFER,i,t,r),-1!==n&&l.framebufferRenderbuffer(l.FRAMEBUFFER,n,l.RENDERBUFFER,e),_&&l.bindRenderbuffer(l.RENDERBUFFER,null),e}_releaseTexture(e){this._deleteTexture(e._hardwareTexture),this.unbindAllTextures();let t=this._internalTexturesCache.indexOf(e);-1!==t&&this._internalTexturesCache.splice(t,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()}_deleteTexture(e){e?.release()}_setProgram(e){this._currentProgram!==e&&((0,r._setProgram)(e,this._gl),this._currentProgram=e)}bindSamplers(e){let t=e.getPipelineContext();this._setProgram(t.program);let r=e.getSamplers();for(let t=0;t<r.length;t++){let s=e.getUniform(r[t]);s&&(this._boundUniforms[t]=s)}this._currentEffect=null}_activateCurrentTexture(){this._currentTextureChannel!==this._activeChannel&&(this._gl.activeTexture(this._gl.TEXTURE0+this._activeChannel),this._currentTextureChannel=this._activeChannel)}_bindTextureDirectly(e,t,r=!1,s=!1){let i=!1,n=t&&t._associatedChannel>-1;if(r&&n&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||s){if(this._activateCurrentTexture(),t&&t.isMultiview)throw a.Logger.Error(["_bindTextureDirectly called with a multiview texture!",e,t]),"_bindTextureDirectly called with a multiview texture!";this._gl.bindTexture(e,t?._hardwareTexture?.underlyingResource??null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)}else r&&(i=!0,this._activateCurrentTexture());return n&&!r&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),i}_bindTexture(e,t,r){if(void 0===e)return;t&&(t._associatedChannel=e),this._activeChannel=e;let s=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(s,t)}unbindAllTextures(){for(let e=0;e<this._maxSimultaneousTextures;e++)this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))}setTexture(e,t,r,s){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,r))}_bindSamplerUniformToChannel(e,t){let r=this._boundUniforms[e];r&&r._currentState!==t&&(this._gl.uniform1i(r,t),r._currentState=t)}_getTextureWrapMode(e){switch(e){case 1:break;case 0:return this._gl.CLAMP_TO_EDGE;case 2:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT}_setTexture(e,t,r=!1,s=!1,i=""){let a;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video){this._activeChannel=e;let r=t.getInternalTexture();r&&(r._associatedChannel=e),t.update()}else if(4===t.delayLoadState)return t.delayLoad(),!1;a=s?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!r&&a&&(a._associatedChannel=e);let n=!0;this._boundTexturesCache[e]===a&&(r||this._bindSamplerUniformToChannel(a._associatedChannel,e),n=!1),this._activeChannel=e;let _=this._getTextureTarget(a);if(n&&this._bindTextureDirectly(_,a,r),a&&!a.isMultiview){if(a.isCube&&a._cachedCoordinatesMode!==t.coordinatesMode){a._cachedCoordinatesMode=t.coordinatesMode;let e=+(3!==t.coordinatesMode&&5!==t.coordinatesMode);t.wrapU=e,t.wrapV=e}a._cachedWrapU!==t.wrapU&&(a._cachedWrapU=t.wrapU,this._setTextureParameterInteger(_,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),a)),a._cachedWrapV!==t.wrapV&&(a._cachedWrapV=t.wrapV,this._setTextureParameterInteger(_,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),a)),a.is3D&&a._cachedWrapR!==t.wrapR&&(a._cachedWrapR=t.wrapR,this._setTextureParameterInteger(_,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),a)),this._setAnisotropicLevel(_,a,t.anisotropicFilteringLevel)}return!0}setTextureArray(e,t,r,s){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===r.length||(this._textureUnits=new Int32Array(r.length));for(let t=0;t<r.length;t++){let s=r[t].getInternalTexture();s?(this._textureUnits[t]=e+t,s._associatedChannel=e+t):this._textureUnits[t]=-1}this._gl.uniform1iv(t,this._textureUnits);for(let e=0;e<r.length;e++)this._setTexture(this._textureUnits[e],r[e],!0)}}_setAnisotropicLevel(e,t,r){let s=this._caps.textureAnisotropicFilterExtension;11!==t.samplingMode&&3!==t.samplingMode&&2!==t.samplingMode&&(r=1),s&&t._cachedAnisotropicFilteringLevel!==r&&(this._setTextureParameterFloat(e,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r,this._caps.maxAnisotropy),t),t._cachedAnisotropicFilteringLevel=r)}_setTextureParameterFloat(e,t,r,s){this._bindTextureDirectly(e,s,!0,!0),this._gl.texParameterf(e,t,r)}_setTextureParameterInteger(e,t,r,s){s&&this._bindTextureDirectly(e,s,!0,!0),this._gl.texParameteri(e,t,r)}unbindAllAttributes(){if(this._mustWipeVertexAttributes){this._mustWipeVertexAttributes=!1;for(let e=0;e<this._caps.maxVertexAttribs;e++)this.disableAttributeByIndex(e);return}for(let e=0,t=this._vertexAttribArraysEnabled.length;e<t;e++)!(e>=this._caps.maxVertexAttribs)&&this._vertexAttribArraysEnabled[e]&&this.disableAttributeByIndex(e)}releaseEffects(){this._compiledEffects={},this.onReleaseEffectsObservable.notifyObservers(this)}dispose(){(0,n.IsWindowObjectExist)()&&this._renderingCanvas&&(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._onContextRestored&&this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored)),super.dispose(),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.unbindAllAttributes(),this._boundUniforms={},this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers.length=0,this._currentProgram=null,this._creationOptions.loseContextOnDispose&&this._gl.getExtension("WEBGL_lose_context")?.loseContext(),(0,r.deleteStateObject)(this._gl)}attachContextLostEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)}attachContextRestoredEvent(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)}getError(){return this._gl.getError()}_canRenderToFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(1)}_canRenderToHalfFloatFramebuffer(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(2)}_canRenderToFramebuffer(e){let t=this._gl;for(;t.getError()!==t.NO_ERROR;);let r=!0,s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);let i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0);let a=t.checkFramebufferStatus(t.FRAMEBUFFER);if((r=(r=r&&a===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),r=r&&t.getError()===t.NO_ERROR),r){t.bindFramebuffer(t.FRAMEBUFFER,null);let e=t.RGBA,s=t.UNSIGNED_BYTE,i=new Uint8Array(4);t.readPixels(0,0,1,1,e,s,i),r=r&&t.getError()===t.NO_ERROR}for(t.deleteTexture(s),t.deleteFramebuffer(i),t.bindFramebuffer(t.FRAMEBUFFER,null);!r&&t.getError()!==t.NO_ERROR;);return r}_getWebGLTextureType(e){if(1===this._webGLVersion){switch(e){case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT_OES;case 0:break;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case 3:return this._gl.BYTE;case 0:break;case 4:return this._gl.SHORT;case 5:return this._gl.UNSIGNED_SHORT;case 6:return this._gl.INT;case 7:return this._gl.UNSIGNED_INT;case 1:return this._gl.FLOAT;case 2:return this._gl.HALF_FLOAT;case 8:return this._gl.UNSIGNED_SHORT_4_4_4_4;case 9:return this._gl.UNSIGNED_SHORT_5_5_5_1;case 10:return this._gl.UNSIGNED_SHORT_5_6_5;case 11:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case 12:return this._gl.UNSIGNED_INT_24_8;case 13:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case 14:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case 15:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE}_getInternalFormat(e,t=!1){let r=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA;switch(e){case 0:r=this._gl.ALPHA;break;case 1:r=this._gl.LUMINANCE;break;case 2:r=this._gl.LUMINANCE_ALPHA;break;case 6:case 33322:case 36760:r=this._gl.RED;break;case 7:case 33324:case 36761:r=this._gl.RG;break;case 4:case 32852:case 36762:r=t?this._glSRGBExtensionValues.SRGB:this._gl.RGB;break;case 5:case 32859:case 36763:r=t?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA}if(this._webGLVersion>1)switch(e){case 8:r=this._gl.RED_INTEGER;break;case 9:r=this._gl.RG_INTEGER;break;case 10:r=this._gl.RGB_INTEGER;break;case 11:r=this._gl.RGBA_INTEGER}return r}_getRGBABufferInternalSizedFormat(e,t,r=!1){if(1===this._webGLVersion){if(void 0!==t)switch(t){case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;case 4:return r?this._glSRGBExtensionValues.SRGB:this._gl.RGB}return this._gl.RGBA}switch(e){case 3:switch(t){case 6:return this._gl.R8_SNORM;case 7:return this._gl.RG8_SNORM;case 4:return this._gl.RGB8_SNORM;case 8:return this._gl.R8I;case 9:return this._gl.RG8I;case 10:return this._gl.RGB8I;case 11:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case 0:switch(t){case 6:return this._gl.R8;case 7:return this._gl.RG8;case 4:return r?this._glSRGBExtensionValues.SRGB8:this._gl.RGB8;case 5:return r?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8;case 8:return this._gl.R8UI;case 9:return this._gl.RG8UI;case 10:return this._gl.RGB8UI;case 11:return this._gl.RGBA8UI;case 0:return this._gl.ALPHA;case 1:return this._gl.LUMINANCE;case 2:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case 4:switch(t){case 8:return this._gl.R16I;case 36760:return this._gl.R16_SNORM_EXT;case 36761:return this._gl.RG16_SNORM_EXT;case 36762:return this._gl.RGB16_SNORM_EXT;case 36763:return this._gl.RGBA16_SNORM_EXT;case 9:return this._gl.RG16I;case 10:return this._gl.RGB16I;default:return this._gl.RGBA16I}case 5:switch(t){case 8:return this._gl.R16UI;case 33322:return this._gl.R16_EXT;case 33324:return this._gl.RG16_EXT;case 32852:return this._gl.RGB16_EXT;case 32859:return this._gl.RGBA16_EXT;case 9:return this._gl.RG16UI;case 10:return this._gl.RGB16UI;default:return this._gl.RGBA16UI}case 6:switch(t){case 8:return this._gl.R32I;case 9:return this._gl.RG32I;case 10:return this._gl.RGB32I;default:return this._gl.RGBA32I}case 7:switch(t){case 8:return this._gl.R32UI;case 9:return this._gl.RG32UI;case 10:return this._gl.RGB32UI;default:return this._gl.RGBA32UI}case 1:switch(t){case 6:return this._gl.R32F;case 7:return this._gl.RG32F;case 4:return this._gl.RGB32F;default:return this._gl.RGBA32F}case 2:switch(t){case 6:return this._gl.R16F;case 7:return this._gl.RG16F;case 4:return this._gl.RGB16F;default:return this._gl.RGBA16F}case 10:return this._gl.RGB565;case 13:return this._gl.R11F_G11F_B10F;case 14:return this._gl.RGB9_E5;case 8:return this._gl.RGBA4;case 9:return this._gl.RGB5_A1;case 11:switch(t){case 5:default:return this._gl.RGB10_A2;case 11:return this._gl.RGB10_A2UI}}return r?this._glSRGBExtensionValues.SRGB8_ALPHA8:this._gl.RGBA8}readPixels(e,t,r,s,i=!0,n=!0,_=null){let l=i?this._gl.RGBA:this._gl.RGB,h=r*s*(i?4:3);if(_){if(_.length<h)return a.Logger.Error(`Data buffer is too small to store the read pixels (${_.length} should be more than ${h})`),Promise.resolve(_)}else _=new Uint8Array(h);return n&&this.flushFramebuffer(),this._gl.readPixels(e,t,r,s,l,this._gl.UNSIGNED_BYTE,_),Promise.resolve(_)}static get IsSupportedAsync(){return Promise.resolve(this.isSupported())}static get IsSupported(){return this.isSupported()}static isSupported(){if(null!==this._HasMajorPerformanceCaveat)return!this._HasMajorPerformanceCaveat;if(null===this._IsSupported)try{let e=s.AbstractEngine._CreateCanvas(1,1),t=e.getContext("webgl")||e.getContext("experimental-webgl");this._IsSupported=null!=t&&!!globalThis.WebGLRenderingContext}catch(e){this._IsSupported=!1}return this._IsSupported}static get HasMajorPerformanceCaveat(){if(null===this._HasMajorPerformanceCaveat)try{let e=s.AbstractEngine._CreateCanvas(1,1),t=e.getContext("webgl",{failIfMajorPerformanceCaveat:!0})||e.getContext("experimental-webgl",{failIfMajorPerformanceCaveat:!0});this._HasMajorPerformanceCaveat=!t}catch(e){this._HasMajorPerformanceCaveat=!1}return this._HasMajorPerformanceCaveat}}p._TempClearColorUint32=new Uint32Array(4),p._TempClearColorInt32=new Int32Array(4),p.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/12\\d\\..+?Mobile",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:".*AppleWebKit.*(15.4).*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]},{key:".*(15.4).*AppleWebKit.*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]}],p._ConcatenateShader=f._ConcatenateShader,p._IsSupported=null,p._HasMajorPerformanceCaveat=null,e.s(["ThinEngine",0,p],76256)},67501,82015,18799,e=>{"use strict";e.s(["IsWrapper",0,function(e){return void 0===e.getPipelineContext}],67501),e.s(["WebGLShaderProcessor",0,class{constructor(){this.shaderLanguage=0}postProcessor(e,t,r,s,i){return i.drawBuffersExtensionDisabled&&(e=e.replace(/#extension.+GL_EXT_draw_buffers.+(enable|require)/g,"")),e}}],82015);let t=/(flat\s)?\s*varying\s*.*/;e.s(["WebGL2ShaderProcessor",0,class{constructor(){this.shaderLanguage=0}attributeProcessor(e){return e.replace("attribute","in")}varyingCheck(e,r){return t.test(e)}varyingProcessor(e,t){return e.replace("varying",t?"in":"out")}postProcessor(e,t,r){let s=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),r){let r=-1!==e.search(/layout *\(location *= *0\) *out/g),i=-1!==t.indexOf("#define DUAL_SOURCE_BLENDING");i&&(e="#extension GL_EXT_blend_func_extended : require\n"+e),e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(s||r?"":i?"layout(location = 0, index = 0) out vec4 glFragColor;\nlayout(location = 0, index = 1) out vec4 glFragColor2;\n":"layout(location = 0) out vec4 glFragColor;\n")+"void main(")}else if(t.indexOf("#define VERTEXOUTPUT_INVARIANT")>=0&&(e="invariant gl_Position;\n"+e),-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e}}],18799)}]);
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,96192,e=>{"use strict";var t,a,i=e.i(60219),s=e.i(97009),r=e.i(42704);(t=a||(a={}))[t.INIT=0]="INIT",t[t.STARTED=1]="STARTED",t[t.ENDED=2]="ENDED";class n{constructor(e){this.onEachCountObservable=new r.Observable,this.onTimerAbortedObservable=new r.Observable,this.onTimerEndedObservable=new r.Observable,this.onStateChangedObservable=new r.Observable,this._observer=null,this._breakOnNextTick=!1,this._tick=e=>{let t=Date.now();this._timer=t-this._startTime;let a={startTime:this._startTime,currentTime:t,deltaTime:this._timer,completeRate:this._timer/this._timeToEnd,payload:e},i=this._breakOnNextTick||this._breakCondition(a);i||this._timer>=this._timeToEnd?this._stop(a,i):this.onEachCountObservable.notifyObservers(a)},this._setState(0),this._contextObservable=e.contextObservable,this._observableParameters=e.observableParameters??{},this._breakCondition=e.breakCondition??(()=>!1),this._timeToEnd=e.timeout,e.onEnded&&this.onTimerEndedObservable.add(e.onEnded),e.onTick&&this.onEachCountObservable.add(e.onTick),e.onAborted&&this.onTimerAbortedObservable.add(e.onAborted)}set breakCondition(e){this._breakCondition=e}clearObservables(){this.onEachCountObservable.clear(),this.onTimerAbortedObservable.clear(),this.onTimerEndedObservable.clear(),this.onStateChangedObservable.clear()}start(e=this._timeToEnd){if(1===this._state)throw Error("Timer already started. Please stop it before starting again");this._timeToEnd=e,this._startTime=Date.now(),this._timer=0,this._observer=this._contextObservable.add(this._tick,this._observableParameters.mask,this._observableParameters.insertFirst,this._observableParameters.scope),this._setState(1)}stop(){1===this._state&&(this._breakOnNextTick=!0)}dispose(){this._observer&&this._contextObservable.remove(this._observer),this.clearObservables()}_setState(e){this._state=e,this.onStateChangedObservable.notifyObservers(this._state)}_stop(e,t=!1){this._contextObservable.remove(this._observer),this._setState(2),t?this.onTimerAbortedObservable.notifyObservers(e):this.onTimerEndedObservable.notifyObservers(e)}}var l=e.i(85789),o=e.i(59012),b=e.i(12752),h=e.i(99493);class d extends i.FlowGraphAsyncExecutionBlock{constructor(e){super(e),this.cancel=this._registerSignalInput("cancel"),this.duration=this.registerDataInput("duration",s.RichTypeNumber),this.lastDelayIndex=this.registerDataOutput("lastDelayIndex",s.RichTypeFlowGraphInteger,new o.FlowGraphInteger(-1))}_preparePendingTasks(e){let t=this.duration.getValue(e);if(t<0||isNaN(t)||!isFinite(t))return this._reportError(e,"Invalid duration in SetDelay block");if(e._getGlobalContextVariable("activeDelays",0)>=d.MaxParallelDelayCount)return this._reportError(e,"Max parallel delays reached");let a=e._getGlobalContextVariable("lastDelayIndex",-1),i=e._getExecutionVariable(this,"pendingDelays",[]),s=new n({timeout:1e3*t,contextObservable:e.configuration.scene.onBeforeRenderObservable,onEnded:()=>this._onEnded(s,e)});s.start();let r=a+1;this.lastDelayIndex.setValue(new o.FlowGraphInteger(r),e),e._setGlobalContextVariable("lastDelayIndex",r),(0,b.MarkDelayActive)(e,r),i[r]=s,e._setExecutionVariable(this,"pendingDelays",i),this._updateGlobalTimers(e)}_cancelPendingTasks(e){let t=e._getExecutionVariable(this,"pendingDelays",[]),a=e._getGlobalContextVariable("pendingDelays",[]);for(let i=0;i<t.length;i++){let s=t[i];s&&(s.dispose(),(0,b.MarkDelayInactive)(e,i),delete a[i])}e._setGlobalContextVariable("pendingDelays",a),e._deleteExecutionVariable(this,"pendingDelays"),this.lastDelayIndex.setValue(new o.FlowGraphInteger(-1),e),this._updateGlobalTimers(e)}_execute(e,t){t===this.cancel?this._cancelPendingTasks(e):(this._preparePendingTasks(e),this.out._activateSignal(e))}getClassName(){return"FlowGraphSetDelayBlock"}_onEnded(e,t){let a=t._getExecutionVariable(this,"pendingDelays",[]),i=a.indexOf(e);if(-1!==i){delete a[i];let e=t._getGlobalContextVariable("pendingDelays",[]);delete e[i],t._setGlobalContextVariable("pendingDelays",e),(0,b.MarkDelayInactive)(t,i)}else l.Logger.Warn("FlowGraphTimerBlock: Timer ended but was not found in the running timers list");t._removePendingBlock(this),this.done._activateSignal(t),this._updateGlobalTimers(t)}_updateGlobalTimers(e){let t=e._getExecutionVariable(this,"pendingDelays",[]),a=e._getGlobalContextVariable("pendingDelays",[]);for(let i=0;i<t.length;i++){if(!t[i]||!(0,b.IsDelayActive)(e,i))continue;let s=t[i];a[i]&&a[i]!==s?l.Logger.Warn("FlowGraphTimerBlock: Timer ended but was not found in the running timers list"):a[i]=s}e._setGlobalContextVariable("pendingDelays",a)}}d.MaxParallelDelayCount=100;let c=!1;function _(){c||(c=!0,(0,h.RegisterClass)("FlowGraphSetDelayBlock",d))}e.s(["FlowGraphSetDelayBlock",0,d,"RegisterFlowGraphSetDelayBlock",0,_],56210),_(),e.s([],67431),e.i(67431),e.i(56210),e.s(["FlowGraphSetDelayBlock",0,d],96192)}]);