@selvajs/selva 4.0.0 → 4.2.0

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 (337) hide show
  1. package/build/client/_app/immutable/assets/0.vgCL98o5.css +1 -0
  2. package/build/client/_app/immutable/assets/0.vgCL98o5.css.br +0 -0
  3. package/build/client/_app/immutable/assets/0.vgCL98o5.css.gz +0 -0
  4. package/build/client/_app/immutable/chunks/{DGr_EUx4.js → 2n-qzJg2.js} +1 -1
  5. package/build/client/_app/immutable/chunks/2n-qzJg2.js.br +0 -0
  6. package/build/client/_app/immutable/chunks/2n-qzJg2.js.gz +0 -0
  7. package/build/client/_app/immutable/chunks/{DT5O4b-_.js → BQ0arxbK.js} +1 -1
  8. package/build/client/_app/immutable/chunks/BQ0arxbK.js.br +0 -0
  9. package/build/client/_app/immutable/chunks/BQ0arxbK.js.gz +0 -0
  10. package/build/client/_app/immutable/chunks/{7DlWX6a_.js → C1kpvSgW.js} +1 -1
  11. package/build/client/_app/immutable/chunks/C1kpvSgW.js.br +0 -0
  12. package/build/client/_app/immutable/chunks/C1kpvSgW.js.gz +0 -0
  13. package/build/client/_app/immutable/chunks/{C_pyGEAV.js → C98bdhQ5.js} +1 -1
  14. package/build/client/_app/immutable/chunks/C98bdhQ5.js.br +0 -0
  15. package/build/client/_app/immutable/chunks/C98bdhQ5.js.gz +0 -0
  16. package/build/client/_app/immutable/chunks/D-Fls4-N.js +1 -0
  17. package/build/client/_app/immutable/chunks/D-Fls4-N.js.br +0 -0
  18. package/build/client/_app/immutable/chunks/D-Fls4-N.js.gz +0 -0
  19. package/build/client/_app/immutable/chunks/{7OGPJeUM.js → D37hHIb0.js} +1 -1
  20. package/build/client/_app/immutable/chunks/D37hHIb0.js.br +0 -0
  21. package/build/client/_app/immutable/chunks/D37hHIb0.js.gz +0 -0
  22. package/build/client/_app/immutable/chunks/{D0kO1GS0.js → DNu_no60.js} +1 -1
  23. package/build/client/_app/immutable/chunks/DNu_no60.js.br +0 -0
  24. package/build/client/_app/immutable/chunks/DNu_no60.js.gz +0 -0
  25. package/build/client/_app/immutable/chunks/snZK0J5H.js +1 -0
  26. package/build/client/_app/immutable/chunks/snZK0J5H.js.br +0 -0
  27. package/build/client/_app/immutable/chunks/snZK0J5H.js.gz +0 -0
  28. package/build/client/_app/immutable/entry/app.1YljYqLj.js +2 -0
  29. package/build/client/_app/immutable/entry/app.1YljYqLj.js.br +0 -0
  30. package/build/client/_app/immutable/entry/app.1YljYqLj.js.gz +0 -0
  31. package/build/client/_app/immutable/entry/start.C41rnrMx.js +1 -0
  32. package/build/client/_app/immutable/entry/start.C41rnrMx.js.br +0 -0
  33. package/build/client/_app/immutable/entry/start.C41rnrMx.js.gz +0 -0
  34. package/build/client/_app/immutable/nodes/{1.NC0eJqYH.js → 1.5JE3G8iG.js} +1 -1
  35. package/build/client/_app/immutable/nodes/1.5JE3G8iG.js.br +0 -0
  36. package/build/client/_app/immutable/nodes/1.5JE3G8iG.js.gz +0 -0
  37. package/build/client/_app/immutable/nodes/11.Co2EmpEg.js +2 -0
  38. package/build/client/_app/immutable/nodes/11.Co2EmpEg.js.br +0 -0
  39. package/build/client/_app/immutable/nodes/11.Co2EmpEg.js.gz +0 -0
  40. package/build/client/_app/immutable/nodes/{13.DoCSNk6B.js → 13.D5OdE_HH.js} +1 -1
  41. package/build/client/_app/immutable/nodes/13.D5OdE_HH.js.br +0 -0
  42. package/build/client/_app/immutable/nodes/13.D5OdE_HH.js.gz +0 -0
  43. package/build/client/_app/immutable/nodes/{14.CGaF6W-i.js → 14.UGx5pLUS.js} +1 -1
  44. package/build/client/_app/immutable/nodes/14.UGx5pLUS.js.br +0 -0
  45. package/build/client/_app/immutable/nodes/14.UGx5pLUS.js.gz +0 -0
  46. package/build/client/_app/immutable/nodes/15.czhLtsoD.js +13 -0
  47. package/build/client/_app/immutable/nodes/15.czhLtsoD.js.br +0 -0
  48. package/build/client/_app/immutable/nodes/15.czhLtsoD.js.gz +0 -0
  49. package/build/client/_app/immutable/nodes/{16.CK0W0845.js → 16.CqZNgdz-.js} +1 -1
  50. package/build/client/_app/immutable/nodes/16.CqZNgdz-.js.br +0 -0
  51. package/build/client/_app/immutable/nodes/16.CqZNgdz-.js.gz +0 -0
  52. package/build/client/_app/immutable/nodes/{17.BLCtgsLP.js → 17.B1PHOW1Y.js} +1 -1
  53. package/build/client/_app/immutable/nodes/17.B1PHOW1Y.js.br +0 -0
  54. package/build/client/_app/immutable/nodes/17.B1PHOW1Y.js.gz +0 -0
  55. package/build/client/_app/immutable/nodes/{19.Dx5b18Qv.js → 19.ClB_k0uw.js} +1 -1
  56. package/build/client/_app/immutable/nodes/19.ClB_k0uw.js.br +0 -0
  57. package/build/client/_app/immutable/nodes/19.ClB_k0uw.js.gz +0 -0
  58. package/build/client/_app/immutable/nodes/{2.BxDq9fgp.js → 2.uPLLf3gR.js} +1 -1
  59. package/build/client/_app/immutable/nodes/2.uPLLf3gR.js.br +0 -0
  60. package/build/client/_app/immutable/nodes/2.uPLLf3gR.js.gz +0 -0
  61. package/build/client/_app/immutable/nodes/{20.Q9tlws_F.js → 20.C5BF7igP.js} +1 -1
  62. package/build/client/_app/immutable/nodes/20.C5BF7igP.js.br +0 -0
  63. package/build/client/_app/immutable/nodes/20.C5BF7igP.js.gz +0 -0
  64. package/build/client/_app/immutable/nodes/{21.Bbzr4DP5.js → 21.B1xX86Nz.js} +1 -1
  65. package/build/client/_app/immutable/nodes/21.B1xX86Nz.js.br +0 -0
  66. package/build/client/_app/immutable/nodes/21.B1xX86Nz.js.gz +0 -0
  67. package/build/client/_app/immutable/nodes/23.BWuAu45o.js +16 -0
  68. package/build/client/_app/immutable/nodes/23.BWuAu45o.js.br +0 -0
  69. package/build/client/_app/immutable/nodes/23.BWuAu45o.js.gz +0 -0
  70. package/build/client/_app/immutable/nodes/{24.B-_Qylvh.js → 24.DSWGE_q2.js} +1 -1
  71. package/build/client/_app/immutable/nodes/24.DSWGE_q2.js.br +0 -0
  72. package/build/client/_app/immutable/nodes/24.DSWGE_q2.js.gz +0 -0
  73. package/build/client/_app/immutable/nodes/{27.CKQ1fXCy.js → 27.CjlEhW_1.js} +1 -1
  74. package/build/client/_app/immutable/nodes/27.CjlEhW_1.js.br +0 -0
  75. package/build/client/_app/immutable/nodes/27.CjlEhW_1.js.gz +0 -0
  76. package/build/client/_app/immutable/nodes/{28.COTXtjAd.js → 28.U-BnDxlP.js} +1 -1
  77. package/build/client/_app/immutable/nodes/28.U-BnDxlP.js.br +0 -0
  78. package/build/client/_app/immutable/nodes/28.U-BnDxlP.js.gz +0 -0
  79. package/build/client/_app/immutable/nodes/{29.C1uWJrpk.js → 29.cl9udKxV.js} +1 -1
  80. package/build/client/_app/immutable/nodes/29.cl9udKxV.js.br +0 -0
  81. package/build/client/_app/immutable/nodes/29.cl9udKxV.js.gz +0 -0
  82. package/build/client/_app/immutable/nodes/{3.D5k6nFAD.js → 3.UKn7Q9OQ.js} +1 -1
  83. package/build/client/_app/immutable/nodes/3.UKn7Q9OQ.js.br +0 -0
  84. package/build/client/_app/immutable/nodes/3.UKn7Q9OQ.js.gz +0 -0
  85. package/build/client/_app/immutable/nodes/{30.iBr8WuRu.js → 30.DPqPYAg4.js} +1 -1
  86. package/build/client/_app/immutable/nodes/30.DPqPYAg4.js.br +0 -0
  87. package/build/client/_app/immutable/nodes/30.DPqPYAg4.js.gz +0 -0
  88. package/build/client/_app/immutable/nodes/{5.BNy6hwdy.js → 5.CbYguvwB.js} +1 -1
  89. package/build/client/_app/immutable/nodes/5.CbYguvwB.js.br +2 -0
  90. package/build/client/_app/immutable/nodes/5.CbYguvwB.js.gz +0 -0
  91. package/build/client/_app/immutable/nodes/{6.CaYtdaf2.js → 6.DZgUvAex.js} +1 -1
  92. package/build/client/_app/immutable/nodes/6.DZgUvAex.js.br +0 -0
  93. package/build/client/_app/immutable/nodes/6.DZgUvAex.js.gz +0 -0
  94. package/build/client/_app/immutable/nodes/{7.C1W_YRKU.js → 7.Cv7r8DBm.js} +1 -1
  95. package/build/client/_app/immutable/nodes/7.Cv7r8DBm.js.br +0 -0
  96. package/build/client/_app/immutable/nodes/7.Cv7r8DBm.js.gz +0 -0
  97. package/build/client/_app/immutable/nodes/{8.B9sIt6MS.js → 8.zr3bqaC_.js} +1 -1
  98. package/build/client/_app/immutable/nodes/8.zr3bqaC_.js.br +0 -0
  99. package/build/client/_app/immutable/nodes/8.zr3bqaC_.js.gz +0 -0
  100. package/build/client/_app/immutable/nodes/9.B2PU0xej.js +1 -0
  101. package/build/client/_app/immutable/nodes/9.B2PU0xej.js.br +0 -0
  102. package/build/client/_app/immutable/nodes/9.B2PU0xej.js.gz +0 -0
  103. package/build/client/_app/version.json +1 -1
  104. package/build/client/_app/version.json.br +0 -0
  105. package/build/client/_app/version.json.gz +0 -0
  106. package/build/server/chunks/{0-RraSrE7U.js → 0-v49L2HZX.js} +3 -3
  107. package/build/server/chunks/{0-RraSrE7U.js.map → 0-v49L2HZX.js.map} +1 -1
  108. package/build/server/chunks/{1-C99xqG8L.js → 1-B8xC9fBg.js} +2 -2
  109. package/build/server/chunks/{1-C99xqG8L.js.map → 1-B8xC9fBg.js.map} +1 -1
  110. package/build/server/chunks/{10-CpPov-q6.js → 10-BowWygfm.js} +4 -3
  111. package/build/server/chunks/{10-CpPov-q6.js.map → 10-BowWygfm.js.map} +1 -1
  112. package/build/server/chunks/{11-CgEVkMbf.js → 11-BLjiJpX4.js} +5 -5
  113. package/build/server/chunks/11-BLjiJpX4.js.map +1 -0
  114. package/build/server/chunks/{13-BsoV45dx.js → 13-CZeQX-Gk.js} +2 -2
  115. package/build/server/chunks/{13-BsoV45dx.js.map → 13-CZeQX-Gk.js.map} +1 -1
  116. package/build/server/chunks/{14-B3BJJIn3.js → 14-VgzSpObZ.js} +2 -2
  117. package/build/server/chunks/{14-B3BJJIn3.js.map → 14-VgzSpObZ.js.map} +1 -1
  118. package/build/server/chunks/{15-BqYjEVaA.js → 15-CKqEgZmF.js} +6 -5
  119. package/build/server/chunks/15-CKqEgZmF.js.map +1 -0
  120. package/build/server/chunks/{16-CQEqybxD.js → 16-9hO-6bzO.js} +5 -4
  121. package/build/server/chunks/{16-CQEqybxD.js.map → 16-9hO-6bzO.js.map} +1 -1
  122. package/build/server/chunks/{17-DPHGdRIj.js → 17-B9Aw6HdC.js} +2 -2
  123. package/build/server/chunks/{17-DPHGdRIj.js.map → 17-B9Aw6HdC.js.map} +1 -1
  124. package/build/server/chunks/{19-CkJN0M4_.js → 19-C9FaW__N.js} +2 -2
  125. package/build/server/chunks/{19-CkJN0M4_.js.map → 19-C9FaW__N.js.map} +1 -1
  126. package/build/server/chunks/{2-BJb8QIPX.js → 2-CwQhh3Hg.js} +5 -4
  127. package/build/server/chunks/{2-BJb8QIPX.js.map → 2-CwQhh3Hg.js.map} +1 -1
  128. package/build/server/chunks/{20-DGeV-MBL.js → 20-52YCUMK3.js} +6 -7
  129. package/build/server/chunks/20-52YCUMK3.js.map +1 -0
  130. package/build/server/chunks/{21-BQWXIChZ.js → 21-Dcz_2iKy.js} +2 -2
  131. package/build/server/chunks/{21-BQWXIChZ.js.map → 21-Dcz_2iKy.js.map} +1 -1
  132. package/build/server/chunks/{23-BmGaVmjO.js → 23-C-gTGofY.js} +5 -5
  133. package/build/server/chunks/{23-BmGaVmjO.js.map → 23-C-gTGofY.js.map} +1 -1
  134. package/build/server/chunks/{24-DC5Qi8Sm.js → 24-ukwP0nYw.js} +2 -2
  135. package/build/server/chunks/{24-DC5Qi8Sm.js.map → 24-ukwP0nYw.js.map} +1 -1
  136. package/build/server/chunks/{27-CJsZbiCR.js → 27-C9kRY1qj.js} +2 -2
  137. package/build/server/chunks/{27-CJsZbiCR.js.map → 27-C9kRY1qj.js.map} +1 -1
  138. package/build/server/chunks/{28-D6UoeYd3.js → 28-X583jLPJ.js} +2 -2
  139. package/build/server/chunks/{28-D6UoeYd3.js.map → 28-X583jLPJ.js.map} +1 -1
  140. package/build/server/chunks/{29-DZgNMmXD.js → 29-PJhSN-Wu.js} +2 -2
  141. package/build/server/chunks/{29-DZgNMmXD.js.map → 29-PJhSN-Wu.js.map} +1 -1
  142. package/build/server/chunks/{3-OhWAE0Wx.js → 3-DZiroZZA.js} +2 -2
  143. package/build/server/chunks/{3-OhWAE0Wx.js.map → 3-DZiroZZA.js.map} +1 -1
  144. package/build/server/chunks/{30-B_GStKPy.js → 30-DvqVphAd.js} +2 -2
  145. package/build/server/chunks/{30-B_GStKPy.js.map → 30-DvqVphAd.js.map} +1 -1
  146. package/build/server/chunks/{5-DLhfWemT.js → 5-QlPeCe4d.js} +2 -2
  147. package/build/server/chunks/{5-DLhfWemT.js.map → 5-QlPeCe4d.js.map} +1 -1
  148. package/build/server/chunks/{6-DnjCwAlp.js → 6-3t8NszBJ.js} +2 -2
  149. package/build/server/chunks/{6-DnjCwAlp.js.map → 6-3t8NszBJ.js.map} +1 -1
  150. package/build/server/chunks/{7-leNovc1s.js → 7-DgFxSLWj.js} +2 -2
  151. package/build/server/chunks/{7-leNovc1s.js.map → 7-DgFxSLWj.js.map} +1 -1
  152. package/build/server/chunks/{8-CAx64_UW.js → 8-BKivPkMd.js} +2 -2
  153. package/build/server/chunks/{8-CAx64_UW.js.map → 8-BKivPkMd.js.map} +1 -1
  154. package/build/server/chunks/{9-Dq-RLXVq.js → 9-COv3kpjW.js} +3 -3
  155. package/build/server/chunks/{9-Dq-RLXVq.js.map → 9-COv3kpjW.js.map} +1 -1
  156. package/build/server/chunks/{_page.svelte-DAu2h8jG.js → _page.svelte-CSZEgmHp.js} +5 -5
  157. package/build/server/chunks/_page.svelte-CSZEgmHp.js.map +1 -0
  158. package/build/server/chunks/{_page.svelte-DFgszLSu.js → _page.svelte-DSPm244d.js} +32 -11
  159. package/build/server/chunks/_page.svelte-DSPm244d.js.map +1 -0
  160. package/build/server/chunks/{_page.svelte-BXyLutv1.js → _page.svelte-DSYaUquf.js} +4 -17
  161. package/build/server/chunks/_page.svelte-DSYaUquf.js.map +1 -0
  162. package/build/server/chunks/{_page.svelte-Dz-6_oW1.js → _page.svelte-DlnKE8Z9.js} +382 -35
  163. package/build/server/chunks/_page.svelte-DlnKE8Z9.js.map +1 -0
  164. package/build/server/chunks/{_server.ts-aUFaewu4.js → _server.ts-17aVSHOa.js} +4 -3
  165. package/build/server/chunks/{_server.ts-aUFaewu4.js.map → _server.ts-17aVSHOa.js.map} +1 -1
  166. package/build/server/chunks/{_server.ts-BLC5g2H_.js → _server.ts-4eVxyBg6.js} +4 -3
  167. package/build/server/chunks/{_server.ts-BLC5g2H_.js.map → _server.ts-4eVxyBg6.js.map} +1 -1
  168. package/build/server/chunks/{_server.ts-BeyEUs6I.js → _server.ts-8ahOmk_6.js} +4 -3
  169. package/build/server/chunks/{_server.ts-BeyEUs6I.js.map → _server.ts-8ahOmk_6.js.map} +1 -1
  170. package/build/server/chunks/{_server.ts-DXqr0BIr.js → _server.ts-B0qq-nxh.js} +3 -3
  171. package/build/server/chunks/{_server.ts-DXqr0BIr.js.map → _server.ts-B0qq-nxh.js.map} +1 -1
  172. package/build/server/chunks/{_server.ts-BTWwyruR.js → _server.ts-B7X5-4kS.js} +4 -3
  173. package/build/server/chunks/{_server.ts-BTWwyruR.js.map → _server.ts-B7X5-4kS.js.map} +1 -1
  174. package/build/server/chunks/{_server.ts-CqCIfPI0.js → _server.ts-B7Z1RMy4.js} +4 -3
  175. package/build/server/chunks/{_server.ts-CqCIfPI0.js.map → _server.ts-B7Z1RMy4.js.map} +1 -1
  176. package/build/server/chunks/{_server.ts-CnVtonm0.js → _server.ts-BL7-YPnc.js} +4 -3
  177. package/build/server/chunks/{_server.ts-CnVtonm0.js.map → _server.ts-BL7-YPnc.js.map} +1 -1
  178. package/build/server/chunks/{_server.ts-B-1avpfE.js → _server.ts-BRjl7H1o.js} +4 -3
  179. package/build/server/chunks/{_server.ts-B-1avpfE.js.map → _server.ts-BRjl7H1o.js.map} +1 -1
  180. package/build/server/chunks/{_server.ts-k9Y_t-wX.js → _server.ts-B_KQteIy.js} +4 -3
  181. package/build/server/chunks/{_server.ts-k9Y_t-wX.js.map → _server.ts-B_KQteIy.js.map} +1 -1
  182. package/build/server/chunks/{_server.ts-Bkr-33U0.js → _server.ts-BiJbME_l.js} +3 -4
  183. package/build/server/chunks/_server.ts-BiJbME_l.js.map +1 -0
  184. package/build/server/chunks/{_server.ts-Dw630Jb2.js → _server.ts-Bq2BT6_L.js} +3 -4
  185. package/build/server/chunks/_server.ts-Bq2BT6_L.js.map +1 -0
  186. package/build/server/chunks/{_server.ts-C3CKmKpW.js → _server.ts-BqsgEogJ.js} +4 -3
  187. package/build/server/chunks/{_server.ts-C3CKmKpW.js.map → _server.ts-BqsgEogJ.js.map} +1 -1
  188. package/build/server/chunks/{_server.ts-C2A_Oiwe.js → _server.ts-BtXdHfbr.js} +4 -3
  189. package/build/server/chunks/{_server.ts-C2A_Oiwe.js.map → _server.ts-BtXdHfbr.js.map} +1 -1
  190. package/build/server/chunks/{_server.ts-EOYMi5x8.js → _server.ts-C-8S5O0H.js} +4 -3
  191. package/build/server/chunks/{_server.ts-EOYMi5x8.js.map → _server.ts-C-8S5O0H.js.map} +1 -1
  192. package/build/server/chunks/{_server.ts-BUEUSAPc.js → _server.ts-C3sOwl5l.js} +4 -3
  193. package/build/server/chunks/{_server.ts-BUEUSAPc.js.map → _server.ts-C3sOwl5l.js.map} +1 -1
  194. package/build/server/chunks/{_server.ts-BHizTPVg.js → _server.ts-CKvfxWeo.js} +4 -3
  195. package/build/server/chunks/{_server.ts-BHizTPVg.js.map → _server.ts-CKvfxWeo.js.map} +1 -1
  196. package/build/server/chunks/{_server.ts-D9iabXf8.js → _server.ts-CMKxt34Z.js} +4 -3
  197. package/build/server/chunks/{_server.ts-D9iabXf8.js.map → _server.ts-CMKxt34Z.js.map} +1 -1
  198. package/build/server/chunks/{_server.ts-C-w9ogA2.js → _server.ts-COWH7HN8.js} +4 -3
  199. package/build/server/chunks/{_server.ts-C-w9ogA2.js.map → _server.ts-COWH7HN8.js.map} +1 -1
  200. package/build/server/chunks/{_server.ts-Dp3_io85.js → _server.ts-CUcFObAP.js} +4 -3
  201. package/build/server/chunks/{_server.ts-Dp3_io85.js.map → _server.ts-CUcFObAP.js.map} +1 -1
  202. package/build/server/chunks/{_server.ts-Bm14E-bx.js → _server.ts-CW_1VZGk.js} +4 -3
  203. package/build/server/chunks/{_server.ts-Bm14E-bx.js.map → _server.ts-CW_1VZGk.js.map} +1 -1
  204. package/build/server/chunks/{_server.ts-DWAwxfXk.js → _server.ts-CXYPZtry.js} +4 -3
  205. package/build/server/chunks/{_server.ts-DWAwxfXk.js.map → _server.ts-CXYPZtry.js.map} +1 -1
  206. package/build/server/chunks/{_server.ts-C52CTPlo.js → _server.ts-Cbe4naEr.js} +4 -3
  207. package/build/server/chunks/{_server.ts-C52CTPlo.js.map → _server.ts-Cbe4naEr.js.map} +1 -1
  208. package/build/server/chunks/{_server.ts-BIQdiZfW.js → _server.ts-D4mOhrFH.js} +4 -3
  209. package/build/server/chunks/{_server.ts-BIQdiZfW.js.map → _server.ts-D4mOhrFH.js.map} +1 -1
  210. package/build/server/chunks/{_server.ts-DzG1eKRC.js → _server.ts-DK7t4rlY.js} +4 -3
  211. package/build/server/chunks/{_server.ts-DzG1eKRC.js.map → _server.ts-DK7t4rlY.js.map} +1 -1
  212. package/build/server/chunks/{_server.ts-BXJAFFdr.js → _server.ts-DMnMoi_a.js} +4 -3
  213. package/build/server/chunks/{_server.ts-BXJAFFdr.js.map → _server.ts-DMnMoi_a.js.map} +1 -1
  214. package/build/server/chunks/{_server.ts-BTSLBiLL.js → _server.ts-DgTNMZbG.js} +3 -3
  215. package/build/server/chunks/{_server.ts-BTSLBiLL.js.map → _server.ts-DgTNMZbG.js.map} +1 -1
  216. package/build/server/chunks/{_server.ts-DiJ2px88.js → _server.ts-DpkIJe-d.js} +4 -3
  217. package/build/server/chunks/{_server.ts-DiJ2px88.js.map → _server.ts-DpkIJe-d.js.map} +1 -1
  218. package/build/server/chunks/{_server.ts-CpC3cdzG.js → _server.ts-DsFj_8lL.js} +4 -3
  219. package/build/server/chunks/{_server.ts-CpC3cdzG.js.map → _server.ts-DsFj_8lL.js.map} +1 -1
  220. package/build/server/chunks/{_server.ts-DcRwP_gQ.js → _server.ts-Dsoq_gsI.js} +3 -3
  221. package/build/server/chunks/{_server.ts-DcRwP_gQ.js.map → _server.ts-Dsoq_gsI.js.map} +1 -1
  222. package/build/server/chunks/{_server.ts-BKtKkHZS.js → _server.ts-Du-NpBy4.js} +11 -6
  223. package/build/server/chunks/_server.ts-Du-NpBy4.js.map +1 -0
  224. package/build/server/chunks/{_server.ts-DuC2r20u.js → _server.ts-EnuOtr_j.js} +8 -6
  225. package/build/server/chunks/_server.ts-EnuOtr_j.js.map +1 -0
  226. package/build/server/chunks/_server.ts-ODEutN30.js +75 -0
  227. package/build/server/chunks/_server.ts-ODEutN30.js.map +1 -0
  228. package/build/server/chunks/{_server.ts-BOCvzY_U.js → _server.ts-bONEWPMV.js} +4 -3
  229. package/build/server/chunks/{_server.ts-BOCvzY_U.js.map → _server.ts-bONEWPMV.js.map} +1 -1
  230. package/build/server/chunks/{_server.ts-CJ8oDVHC.js → _server.ts-t9_veBtJ.js} +3 -2
  231. package/build/server/chunks/{_server.ts-CJ8oDVHC.js.map → _server.ts-t9_veBtJ.js.map} +1 -1
  232. package/build/server/chunks/{_server.ts-DDHHklcd.js → _server.ts-vURDyV-V.js} +4 -3
  233. package/build/server/chunks/{_server.ts-DDHHklcd.js.map → _server.ts-vURDyV-V.js.map} +1 -1
  234. package/build/server/chunks/{access.server-CGwRj2TY.js → access.server-BBglojso.js} +3 -2
  235. package/build/server/chunks/{access.server-CGwRj2TY.js.map → access.server-BBglojso.js.map} +1 -1
  236. package/build/server/chunks/{api-errors-b2AR_m1A.js → api-errors-agQVBoep.js} +21 -3
  237. package/build/server/chunks/api-errors-agQVBoep.js.map +1 -0
  238. package/build/server/chunks/refresh-cw-CiiW6Kvx.js +22 -0
  239. package/build/server/chunks/refresh-cw-CiiW6Kvx.js.map +1 -0
  240. package/build/server/chunks/{resolve.server2-BXKCfGfg.js → resolve.server-BXKCfGfg.js} +1 -1
  241. package/build/server/chunks/resolve.server-BXKCfGfg.js.map +1 -0
  242. package/build/server/chunks/triangle-alert-DuaFagu6.js +20 -0
  243. package/build/server/chunks/triangle-alert-DuaFagu6.js.map +1 -0
  244. package/build/server/index.js +1 -1
  245. package/build/server/index.js.map +1 -1
  246. package/build/server/manifest.js +67 -60
  247. package/build/server/manifest.js.map +1 -1
  248. package/package.json +5 -5
  249. package/build/client/_app/immutable/assets/0.D882LCPK.css +0 -1
  250. package/build/client/_app/immutable/assets/0.D882LCPK.css.br +0 -0
  251. package/build/client/_app/immutable/assets/0.D882LCPK.css.gz +0 -0
  252. package/build/client/_app/immutable/chunks/7DlWX6a_.js.br +0 -0
  253. package/build/client/_app/immutable/chunks/7DlWX6a_.js.gz +0 -0
  254. package/build/client/_app/immutable/chunks/7OGPJeUM.js.br +0 -0
  255. package/build/client/_app/immutable/chunks/7OGPJeUM.js.gz +0 -0
  256. package/build/client/_app/immutable/chunks/C_pyGEAV.js.br +0 -0
  257. package/build/client/_app/immutable/chunks/C_pyGEAV.js.gz +0 -0
  258. package/build/client/_app/immutable/chunks/D0kO1GS0.js.br +0 -0
  259. package/build/client/_app/immutable/chunks/D0kO1GS0.js.gz +0 -0
  260. package/build/client/_app/immutable/chunks/DGr_EUx4.js.br +0 -0
  261. package/build/client/_app/immutable/chunks/DGr_EUx4.js.gz +0 -0
  262. package/build/client/_app/immutable/chunks/DT5O4b-_.js.br +0 -0
  263. package/build/client/_app/immutable/chunks/DT5O4b-_.js.gz +0 -0
  264. package/build/client/_app/immutable/entry/app.DFWfpqb0.js +0 -2
  265. package/build/client/_app/immutable/entry/app.DFWfpqb0.js.br +0 -0
  266. package/build/client/_app/immutable/entry/app.DFWfpqb0.js.gz +0 -0
  267. package/build/client/_app/immutable/entry/start.-fCdkvY6.js +0 -1
  268. package/build/client/_app/immutable/entry/start.-fCdkvY6.js.br +0 -2
  269. package/build/client/_app/immutable/entry/start.-fCdkvY6.js.gz +0 -0
  270. package/build/client/_app/immutable/nodes/1.NC0eJqYH.js.br +0 -0
  271. package/build/client/_app/immutable/nodes/1.NC0eJqYH.js.gz +0 -0
  272. package/build/client/_app/immutable/nodes/11.DegwSwS4.js +0 -2
  273. package/build/client/_app/immutable/nodes/11.DegwSwS4.js.br +0 -0
  274. package/build/client/_app/immutable/nodes/11.DegwSwS4.js.gz +0 -0
  275. package/build/client/_app/immutable/nodes/13.DoCSNk6B.js.br +0 -0
  276. package/build/client/_app/immutable/nodes/13.DoCSNk6B.js.gz +0 -0
  277. package/build/client/_app/immutable/nodes/14.CGaF6W-i.js.br +0 -0
  278. package/build/client/_app/immutable/nodes/14.CGaF6W-i.js.gz +0 -0
  279. package/build/client/_app/immutable/nodes/15.CCL52sqQ.js +0 -16
  280. package/build/client/_app/immutable/nodes/15.CCL52sqQ.js.br +0 -0
  281. package/build/client/_app/immutable/nodes/15.CCL52sqQ.js.gz +0 -0
  282. package/build/client/_app/immutable/nodes/16.CK0W0845.js.br +0 -0
  283. package/build/client/_app/immutable/nodes/16.CK0W0845.js.gz +0 -0
  284. package/build/client/_app/immutable/nodes/17.BLCtgsLP.js.br +0 -0
  285. package/build/client/_app/immutable/nodes/17.BLCtgsLP.js.gz +0 -0
  286. package/build/client/_app/immutable/nodes/19.Dx5b18Qv.js.br +0 -0
  287. package/build/client/_app/immutable/nodes/19.Dx5b18Qv.js.gz +0 -0
  288. package/build/client/_app/immutable/nodes/2.BxDq9fgp.js.br +0 -0
  289. package/build/client/_app/immutable/nodes/2.BxDq9fgp.js.gz +0 -0
  290. package/build/client/_app/immutable/nodes/20.Q9tlws_F.js.br +0 -0
  291. package/build/client/_app/immutable/nodes/20.Q9tlws_F.js.gz +0 -0
  292. package/build/client/_app/immutable/nodes/21.Bbzr4DP5.js.br +0 -0
  293. package/build/client/_app/immutable/nodes/21.Bbzr4DP5.js.gz +0 -0
  294. package/build/client/_app/immutable/nodes/23.fhNJrKbS.js +0 -16
  295. package/build/client/_app/immutable/nodes/23.fhNJrKbS.js.br +0 -0
  296. package/build/client/_app/immutable/nodes/23.fhNJrKbS.js.gz +0 -0
  297. package/build/client/_app/immutable/nodes/24.B-_Qylvh.js.br +0 -0
  298. package/build/client/_app/immutable/nodes/24.B-_Qylvh.js.gz +0 -0
  299. package/build/client/_app/immutable/nodes/27.CKQ1fXCy.js.br +0 -0
  300. package/build/client/_app/immutable/nodes/27.CKQ1fXCy.js.gz +0 -0
  301. package/build/client/_app/immutable/nodes/28.COTXtjAd.js.br +0 -0
  302. package/build/client/_app/immutable/nodes/28.COTXtjAd.js.gz +0 -0
  303. package/build/client/_app/immutable/nodes/29.C1uWJrpk.js.br +0 -0
  304. package/build/client/_app/immutable/nodes/29.C1uWJrpk.js.gz +0 -0
  305. package/build/client/_app/immutable/nodes/3.D5k6nFAD.js.br +0 -0
  306. package/build/client/_app/immutable/nodes/3.D5k6nFAD.js.gz +0 -0
  307. package/build/client/_app/immutable/nodes/30.iBr8WuRu.js.br +0 -0
  308. package/build/client/_app/immutable/nodes/30.iBr8WuRu.js.gz +0 -0
  309. package/build/client/_app/immutable/nodes/5.BNy6hwdy.js.br +0 -0
  310. package/build/client/_app/immutable/nodes/5.BNy6hwdy.js.gz +0 -0
  311. package/build/client/_app/immutable/nodes/6.CaYtdaf2.js.br +0 -0
  312. package/build/client/_app/immutable/nodes/6.CaYtdaf2.js.gz +0 -0
  313. package/build/client/_app/immutable/nodes/7.C1W_YRKU.js.br +0 -0
  314. package/build/client/_app/immutable/nodes/7.C1W_YRKU.js.gz +0 -0
  315. package/build/client/_app/immutable/nodes/8.B9sIt6MS.js.br +0 -0
  316. package/build/client/_app/immutable/nodes/8.B9sIt6MS.js.gz +0 -0
  317. package/build/client/_app/immutable/nodes/9.K1-nNvYh.js +0 -1
  318. package/build/client/_app/immutable/nodes/9.K1-nNvYh.js.br +0 -0
  319. package/build/client/_app/immutable/nodes/9.K1-nNvYh.js.gz +0 -0
  320. package/build/server/chunks/11-CgEVkMbf.js.map +0 -1
  321. package/build/server/chunks/15-BqYjEVaA.js.map +0 -1
  322. package/build/server/chunks/20-DGeV-MBL.js.map +0 -1
  323. package/build/server/chunks/_page.svelte-BXyLutv1.js.map +0 -1
  324. package/build/server/chunks/_page.svelte-DAu2h8jG.js.map +0 -1
  325. package/build/server/chunks/_page.svelte-DFgszLSu.js.map +0 -1
  326. package/build/server/chunks/_page.svelte-Dz-6_oW1.js.map +0 -1
  327. package/build/server/chunks/_server.ts-BKtKkHZS.js.map +0 -1
  328. package/build/server/chunks/_server.ts-Bkr-33U0.js.map +0 -1
  329. package/build/server/chunks/_server.ts-DuC2r20u.js.map +0 -1
  330. package/build/server/chunks/_server.ts-Dw630Jb2.js.map +0 -1
  331. package/build/server/chunks/api-errors-b2AR_m1A.js.map +0 -1
  332. package/build/server/chunks/resolve.server-C5wZnxS_.js +0 -11
  333. package/build/server/chunks/resolve.server-C5wZnxS_.js.map +0 -1
  334. package/build/server/chunks/resolve.server2-BXKCfGfg.js.map +0 -1
  335. /package/build/client/_app/immutable/nodes/{0.kNRjuE1r.js → 0.Y-xP5pet.js} +0 -0
  336. /package/build/client/_app/immutable/nodes/{0.kNRjuE1r.js.br → 0.Y-xP5pet.js.br} +0 -0
  337. /package/build/client/_app/immutable/nodes/{0.kNRjuE1r.js.gz → 0.Y-xP5pet.js.gz} +0 -0
@@ -1,4 +1,4 @@
1
- import"../chunks/DsnmJJEf.js";import{az as ap,am as op,aL as lp,ao as cp,ah as ha,a$ as up,af as u,a_ as U,ba as Ae,bk as F,bl as Rt,bh as rn,aQ as nt,ac as oe,aN as it,b7 as le,V as $,aK as Ut,aW as X,bm as dp,be as ye,bg as $i,aJ as vt,aP as zn,bf as hp,bi as jd,a8 as fp,a5 as lu,ab as cu}from"../chunks/DEk358l3.js";import{c as Ie,a as C,p as Un,f as Z,t as wt,d as pp}from"../chunks/DS1KfRtl.js";import{i as xe}from"../chunks/BnZOgasr.js";import{a as qd}from"../chunks/jO1WSR3P.js";import{o as Kt,s as De,e as Dt,d as Wn,a as mp,f as gp}from"../chunks/T-Nslbso.js";import{S as vp}from"../chunks/DeMiewtM.js";import{C as Kd,T as Js,a as _p,D as Zd,A as xp,U as bp}from"../chunks/7DlWX6a_.js";import{A as Sp,o as yp,D as $d,u as Mp,g as Ep,k as Tp}from"../chunks/CYyqq9B1.js";import{a as an,r as kl,e as Vt,g as Ht,j as At,c as fa,i as Jd,d as za,k as hi,l as wp}from"../chunks/6CzuHfQM.js";import{a as pt,p as _e,r as lt,c as We,b as Nn}from"../chunks/DCBLBrrW.js";import{p as uu}from"../chunks/7OGPJeUM.js";import{a as Ea,o as Qd}from"../chunks/CsdWDH4Y.js";import{w as Qs,F as du}from"../chunks/B6yEy6Wb.js";import{c as eh}from"../chunks/C46MGZre.js";import{S as is}from"../chunks/C33A5aSj.js";import{S as pa}from"../chunks/DRNG0pfi.js";import{S as hu}from"../chunks/Bwn5lHBl.js";import{I as $t}from"../chunks/CeS0GhtF.js";import{X as Ap,R as Ar,D as Rr,c as Ji,b as rs,a as ss}from"../chunks/BeM-GIFh.js";import{s as Ct}from"../chunks/9DES--UJ.js";import{a as Gn,b as tr,c as ma,o as Rp,k as Vl,l as xi,h as dt,v as fn,w as Lo,n as Hl,S as Cp,j as Pp}from"../chunks/BTm-dDt9.js";import{c as In}from"../chunks/BIIXkPqf.js";import{B as mn}from"../chunks/CGKZc1Kf.js";import{C as th}from"../chunks/DZM0bVcB.js";import{C as zi,w as Fi,d as Dp,S as Lp,j as Ip,a as nh,b as ih,c as rh,A as sh,H as ah,E as oh,h as lh,n as fu}from"../chunks/xQ1SsCxk.js";import{i as Np,H as Up,o as ch,c as Fp,R as Op,b as Bp,S as zp,a as kp,C as Vp}from"../chunks/Cal8_SqL.js";import{h as Hp}from"../chunks/BJTJCSLB.js";import{b as Gp,c as Wp,a as Xp,T as Yp,d as jp}from"../chunks/BsKtJj5h.js";import{a as uh,C as Cr}from"../chunks/B1z9if9B.js";import{C as dh}from"../chunks/D1xkoVpc.js";import{C as qp,a as Kp}from"../chunks/CnXIg_dO.js";import{C as Zp}from"../chunks/BM8Ok6pJ.js";import{C as $p}from"../chunks/DRpLcVdK.js";import{L as Di}from"../chunks/Uv0-HWHq.js";import{I as Pr}from"../chunks/CDmA5ezP.js";import{t as Jp}from"../chunks/vyYztzrZ.js";import{r as Qp}from"../chunks/Cbu9Tg11.js";import{D as ka,U as pu}from"../chunks/CynIvqMH.js";const em=[];function Gl(n,e=!1,t=!1){return ea(n,new Map,"",em,null,t)}function ea(n,e,t,i,r=null,s=!1){if(typeof n=="object"&&n!==null){var a=e.get(n);if(a!==void 0)return a;if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);if(ap(n)){var o=Array(n.length);e.set(n,o),r!==null&&e.set(r,o);for(var l=0;l<n.length;l+=1){var c=n[l];l in n&&(o[l]=ea(c,e,t,i,null,s))}return o}if(op(n)===lp){o={},e.set(n,o),r!==null&&e.set(r,o);for(var d of Object.keys(n))o[d]=ea(n[d],e,t,i,null,s);return o}if(n instanceof Date)return structuredClone(n);if(typeof n.toJSON=="function"&&!s)return ea(n.toJSON(),e,t,i,n)}if(n instanceof EventTarget)return n;try{return structuredClone(n)}catch{return n}}class tm{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return cp(this.#t)}get(){const e=ha(this.#t);if(e===void 0)throw new Error(`Context "${this.#e}" not found`);return e}getOr(e){const t=ha(this.#t);return t===void 0?e:t}set(e){return up(this.#t,e)}}function nm(n,e){if(Np(n)){const i=n();return i===void 0?e:i}return n===void 0?e:n}function Ta(n,e){let t=Ae(null);const i=F(()=>nm(e,250));function r(...s){if(u(t))u(t).timeout&&clearTimeout(u(t).timeout);else{let a,o;const l=new Promise((c,d)=>{a=c,o=d});U(t,{timeout:null,runner:null,promise:l,resolve:a,reject:o},!0)}return u(t).runner=async()=>{if(!u(t))return;const a=u(t);U(t,null);try{a.resolve(await n.apply(this,s))}catch(o){a.reject(o)}},u(t).timeout=setTimeout(u(t).runner,u(i)),u(t).promise}return r.cancel=async()=>{(!u(t)||u(t).timeout===null)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||u(t).timeout===null)||(clearTimeout(u(t).timeout),u(t).reject("Cancelled"),U(t,null))},r.runScheduledNow=async()=>{(!u(t)||!u(t).timeout)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||!u(t).timeout)||(clearTimeout(u(t).timeout),u(t).timeout=null,await u(t).runner?.())},Object.defineProperty(r,"pending",{enumerable:!0,get(){return!!u(t)?.timeout}}),r}class Wl{#e=Ae(!1);constructor(){Rt(()=>(rn(()=>U(this.#e,!0)),()=>{U(this.#e,!1)}))}get current(){return u(this.#e)}}const im=Vl({component:"checkbox",parts:["root","group","group-label","input"]}),rm=new zi("Checkbox.Group"),hh=new zi("Checkbox.Root");class Xl{static create(e,t=null){return hh.set(new Xl(e,t))}opts;group;#e=F(()=>this.group&&this.group.opts.name.current?this.group.opts.name.current:this.opts.name.current);get trueName(){return u(this.#e)}set trueName(e){U(this.#e,e)}#t=F(()=>this.group&&this.group.opts.required.current?!0:this.opts.required.current);get trueRequired(){return u(this.#t)}set trueRequired(e){U(this.#t,e)}#n=F(()=>this.group&&this.group.opts.disabled.current?!0:this.opts.disabled.current);get trueDisabled(){return u(this.#n)}set trueDisabled(e){U(this.#n,e)}#i=F(()=>this.group&&this.group.opts.readonly.current?!0:this.opts.readonly.current);get trueReadonly(){return u(this.#i)}set trueReadonly(e){U(this.#i,e)}attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=Gn(this.opts.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),Fi.pre([()=>Gl(this.group?.opts.value.current),()=>this.opts.value.current],([i,r])=>{!i||!r||(this.opts.checked.current=i.includes(r))}),Fi.pre(()=>this.opts.checked.current,i=>{this.group&&(i?this.group?.addValue(this.opts.value.current):this.group?.removeValue(this.opts.value.current))})}onkeydown(e){if(!(this.trueDisabled||this.trueReadonly)){if(e.key===Dp){e.preventDefault(),this.opts.type.current==="submit"&&e.currentTarget.closest("form")?.requestSubmit();return}e.key===Lp&&(e.preventDefault(),this.#r())}}#r(){this.opts.indeterminate.current?(this.opts.indeterminate.current=!1,this.opts.checked.current=!0):this.opts.checked.current=!this.opts.checked.current}onclick(e){if(!(this.trueDisabled||this.trueReadonly)){if(this.opts.type.current==="submit"){this.#r();return}e.preventDefault(),this.#r()}}#s=F(()=>({checked:this.opts.checked.current,indeterminate:this.opts.indeterminate.current}));get snippetProps(){return u(this.#s)}set snippetProps(e){U(this.#s,e)}#a=F(()=>({id:this.opts.id.current,role:"checkbox",type:this.opts.type.current,disabled:this.trueDisabled,"aria-checked":Rp(this.opts.checked.current,this.opts.indeterminate.current),"aria-required":ma(this.trueRequired),"aria-readonly":ma(this.trueReadonly),"data-disabled":tr(this.trueDisabled),"data-readonly":tr(this.trueReadonly),"data-state":sm(this.opts.checked.current,this.opts.indeterminate.current),[im.root]:"",onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return u(this.#a)}set props(e){U(this.#a,e)}}class Yl{static create(){return new Yl(hh.get())}root;#e=F(()=>this.root.group?!!(this.root.opts.value.current!==void 0&&this.root.group.opts.value.current.includes(this.root.opts.value.current)):this.root.opts.checked.current);get trueChecked(){return u(this.#e)}set trueChecked(e){U(this.#e,e)}#t=F(()=>!!this.root.trueName);get shouldRender(){return u(this.#t)}set shouldRender(e){U(this.#t,e)}constructor(e){this.root=e,this.onfocus=this.onfocus.bind(this)}onfocus(e){Ip(this.root.opts.ref.current)&&this.root.opts.ref.current.focus()}#n=F(()=>({type:"checkbox",checked:this.root.opts.checked.current===!0,disabled:this.root.trueDisabled,required:this.root.trueRequired,name:this.root.trueName,value:this.root.opts.value.current,readonly:this.root.trueReadonly,onfocus:this.onfocus}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}}function sm(n,e){return e?"indeterminate":n?"checked":"unchecked"}function am(n,e){nt(e,!0);const t=Yl.create();var i=Ie(),r=oe(i);{var s=a=>{Up(a,pt(()=>t.props))};xe(r,a=>{t.shouldRender&&a(s)})}C(n,i),it()}var om=Z("<button><!></button>"),lm=Z("<!> <!>",1);function cm(n,e){const t=Un();nt(e,!0);let i=_e(e,"checked",15,!1),r=_e(e,"ref",15,null),s=_e(e,"disabled",3,!1),a=_e(e,"required",3,!1),o=_e(e,"name",3,void 0),l=_e(e,"value",3,"on"),c=_e(e,"id",19,()=>xi(t)),d=_e(e,"indeterminate",15,!1),h=_e(e,"type",3,"button"),f=lt(e,["$$slots","$$events","$$legacy","checked","ref","onCheckedChange","children","disabled","required","name","value","id","indeterminate","onIndeterminateChange","child","type","readonly"]);const p=rm.getOr(null);p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1)),Fi.pre(()=>l(),()=>{p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1))});const v=Xl.create({checked:dt(()=>i(),R=>{i(R),e.onCheckedChange?.(R)}),disabled:dt(()=>s()??!1),required:dt(()=>a()),name:dt(()=>o()),value:dt(()=>l()),id:dt(()=>c()),ref:dt(()=>r(),R=>r(R)),indeterminate:dt(()=>d(),R=>{d(R),e.onIndeterminateChange?.(R)}),type:dt(()=>h()),readonly:dt(()=>!!e.readonly)},p),S=F(()=>fn({...f},v.props));var g=lm(),m=oe(g);{var x=R=>{var y=Ie(),L=oe(y);{let _=F(()=>({props:u(S),...v.snippetProps}));Ct(L,()=>e.child,()=>u(_))}C(R,y)},M=R=>{var y=om();an(y,()=>({...u(S)}));var L=$(y);Ct(L,()=>e.children??Ut,()=>v.snippetProps),X(y),C(R,y)};xe(m,R=>{e.child?R(x):R(M,-1)})}var w=le(m,2);am(w,{}),C(n,g),it()}class nr{#e;#t;constructor(e,t){this.#e=e,this.#t=t,this.handler=this.handler.bind(this),Rt(this.handler)}handler(){let e=0;const t=this.#e();if(!t)return;const i=new ResizeObserver(()=>{cancelAnimationFrame(e),e=window.requestAnimationFrame(this.#t)});return i.observe(t),()=>{window.cancelAnimationFrame(e),i.unobserve(t)}}}class um{opts;present;#e;#t=Ae(!1);#n=!1;#i=Ae(void 0);#r=null;constructor(e){this.opts=e,this.present=this.opts.open,U(this.#t,e.open.current,!0),this.#e=new Sp({ref:this.opts.ref,afterTick:this.opts.open}),yp(()=>this.#a()),Fi(()=>this.present.current,t=>{if(!this.#n){this.#n=!0;return}this.#a(),t&&U(this.#t,!0),U(this.#i,t?"starting":"ending",!0),t&&(this.#r=window.requestAnimationFrame(()=>{this.#r=null,this.present.current&&U(this.#i,void 0)})),this.#e.run(()=>{t===this.present.current&&(t||U(this.#t,!1),U(this.#i,void 0))})})}#s=F(()=>u(this.#t));get isPresent(){return u(this.#s)}set isPresent(e){U(this.#s,e)}get transitionStatus(){return u(this.#i)}#a(){this.#r!==null&&(window.cancelAnimationFrame(this.#r),this.#r=null)}}function wa(n,e){nt(e,!0);const t=new um({open:dt(()=>e.open),ref:e.ref});var i=Ie(),r=oe(i);{var s=a=>{var o=Ie(),l=oe(o);Ct(l,()=>e.presence??Ut,()=>({present:t.isPresent,transitionStatus:t.transitionStatus})),C(a,o)};xe(r,a=>{(e.forceMount||e.open||t.isPresent)&&a(s)})}C(n,i),it()}function dm(n,e,t){return Math.min(t,Math.max(e,n))}class hm{state;#e;constructor(e,t){this.state=Lo(e),this.#e=t,this.dispatch=this.dispatch.bind(this)}#t(e){return this.#e[this.state.current][e]??this.state.current}dispatch(e){this.state.current=this.#t(e)}}const ps=Vl({component:"scroll-area",parts:["root","viewport","corner","thumb","scrollbar"]}),ms=new zi("ScrollArea.Root"),gs=new zi("ScrollArea.Scrollbar"),Aa=new zi("ScrollArea.ScrollbarVisible"),jl=new zi("ScrollArea.ScrollbarAxis"),fh=new zi("ScrollArea.ScrollbarShared");class ql{static create(e){return ms.set(new ql(e))}opts;attachment;#e=Ae(null);get scrollAreaNode(){return u(this.#e)}set scrollAreaNode(e){U(this.#e,e,!0)}#t=Ae(null);get viewportNode(){return u(this.#t)}set viewportNode(e){U(this.#t,e,!0)}#n=Ae(null);get contentNode(){return u(this.#n)}set contentNode(e){U(this.#n,e,!0)}#i=Ae(null);get scrollbarXNode(){return u(this.#i)}set scrollbarXNode(e){U(this.#i,e,!0)}#r=Ae(null);get scrollbarYNode(){return u(this.#r)}set scrollbarYNode(e){U(this.#r,e,!0)}#s=Ae(0);get cornerWidth(){return u(this.#s)}set cornerWidth(e){U(this.#s,e,!0)}#a=Ae(0);get cornerHeight(){return u(this.#a)}set cornerHeight(e){U(this.#a,e,!0)}#o=Ae(!1);get scrollbarXEnabled(){return u(this.#o)}set scrollbarXEnabled(e){U(this.#o,e,!0)}#l=Ae(!1);get scrollbarYEnabled(){return u(this.#l)}set scrollbarYEnabled(e){U(this.#l,e,!0)}domContext;constructor(e){this.opts=e,this.attachment=Gn(e.ref,t=>this.scrollAreaNode=t),this.domContext=new $d(e.ref)}#c=F(()=>({id:this.opts.id.current,dir:this.opts.dir.current,style:{position:"relative","--bits-scroll-area-corner-height":`${this.cornerHeight}px`,"--bits-scroll-area-corner-width":`${this.cornerWidth}px`},[ps.root]:"",...this.attachment}));get props(){return u(this.#c)}set props(e){U(this.#c,e)}}class Kl{static create(e){return new Kl(e,ms.get())}opts;root;attachment;#e=Lo(Mp());#t=Lo(null);contentAttachment=Gn(this.#t,e=>this.root.contentNode=e);constructor(e,t){this.opts=e,this.root=t,this.attachment=Gn(e.ref,i=>this.root.viewportNode=i)}#n=F(()=>({id:this.opts.id.current,style:{overflowX:this.root.scrollbarXEnabled?"scroll":"hidden",overflowY:this.root.scrollbarYEnabled?"scroll":"hidden"},[ps.viewport]:"",...this.attachment}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}#i=F(()=>({id:this.#e.current,"data-scroll-area-content":"",style:{minWidth:this.root.scrollbarXEnabled?"fit-content":void 0},...this.contentAttachment}));get contentProps(){return u(this.#i)}set contentProps(e){U(this.#i,e)}}class Zl{static create(e){return gs.set(new Zl(e,ms.get()))}opts;root;#e=F(()=>this.opts.orientation.current==="horizontal");get isHorizontal(){return u(this.#e)}set isHorizontal(e){U(this.#e,e)}#t=Ae(!1);get hasThumb(){return u(this.#t)}set hasThumb(e){U(this.#t,e,!0)}constructor(e,t){this.opts=e,this.root=t,Fi(()=>this.isHorizontal,i=>i?(this.root.scrollbarXEnabled=!0,()=>{this.root.scrollbarXEnabled=!1}):(this.root.scrollbarYEnabled=!0,()=>{this.root.scrollbarYEnabled=!1}))}}class $l{static create(){return new $l(gs.get())}scrollbar;root;#e=Ae(!1);get isVisible(){return u(this.#e)}set isVisible(e){U(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Rt(()=>{const t=this.root.scrollAreaNode,i=this.root.opts.scrollHideDelay.current;let r=0;if(!t)return;const s=()=>{this.root.domContext.clearTimeout(r),rn(()=>this.isVisible=!0)},a=()=>{r&&this.root.domContext.clearTimeout(r),r=this.root.domContext.setTimeout(()=>{rn(()=>{this.scrollbar.hasThumb=!1,this.isVisible=!1})},i)},o=Hl(Kt(t,"pointerenter",s),Kt(t,"pointerleave",a));return()=>{this.root.domContext.getWindow().clearTimeout(r),o()}})}#t=F(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){U(this.#t,e)}}class Jl{static create(){return new Jl(gs.get())}scrollbar;root;machine=new hm("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});#e=F(()=>this.machine.state.current==="hidden");get isHidden(){return u(this.#e)}set isHidden(e){U(this.#e,e)}constructor(e){this.scrollbar=e,this.root=e.root;const t=Ta(()=>this.machine.dispatch("SCROLL_END"),100);Rt(()=>{const i=this.machine.state.current,r=this.root.opts.scrollHideDelay.current;if(i==="idle"){const s=this.root.domContext.setTimeout(()=>this.machine.dispatch("HIDE"),r);return()=>this.root.domContext.clearTimeout(s)}}),Rt(()=>{const i=this.root.viewportNode;if(!i)return;const r=this.scrollbar.isHorizontal?"scrollLeft":"scrollTop";let s=i[r];return Kt(i,"scroll",()=>{const l=i[r];s!==l&&(this.machine.dispatch("SCROLL"),t()),s=l})}),this.onpointerenter=this.onpointerenter.bind(this),this.onpointerleave=this.onpointerleave.bind(this)}onpointerenter(e){this.machine.dispatch("POINTER_ENTER")}onpointerleave(e){this.machine.dispatch("POINTER_LEAVE")}#t=F(()=>({"data-state":this.machine.state.current==="hidden"?"hidden":"visible",onpointerenter:this.onpointerenter,onpointerleave:this.onpointerleave}));get props(){return u(this.#t)}set props(e){U(this.#t,e)}}class Ra{static create(){return new Ra(gs.get())}scrollbar;root;#e=Ae(!1);get isVisible(){return u(this.#e)}set isVisible(e){U(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root;const t=Ta(()=>{const i=this.root.viewportNode;if(!i)return;const r=i.offsetWidth<i.scrollWidth,s=i.offsetHeight<i.scrollHeight;this.isVisible=this.scrollbar.isHorizontal?r:s},10);new nr(()=>this.root.viewportNode,t),new nr(()=>this.root.contentNode,t)}#t=F(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){U(this.#t,e)}}class Ql{static create(){return Aa.set(new Ql(gs.get()))}scrollbar;root;#e=Ae(null);get thumbNode(){return u(this.#e)}set thumbNode(e){U(this.#e,e,!0)}#t=Ae(0);get pointerOffset(){return u(this.#t)}set pointerOffset(e){U(this.#t,e,!0)}#n=Ae({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}});get sizes(){return u(this.#n)}set sizes(e){U(this.#n,e)}#i=F(()=>ph(this.sizes.viewport,this.sizes.content));get thumbRatio(){return u(this.#i)}set thumbRatio(e){U(this.#i,e)}#r=F(()=>this.thumbRatio>0&&this.thumbRatio<1);get hasThumb(){return u(this.#r)}set hasThumb(e){U(this.#r,e)}#s=Ae("");get prevTransformStyle(){return u(this.#s)}set prevTransformStyle(e){U(this.#s,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Rt(()=>{this.scrollbar.hasThumb=this.hasThumb}),Rt(()=>{!this.scrollbar.hasThumb&&this.thumbNode&&(this.prevTransformStyle=this.thumbNode.style.transform)})}setSizes(e){this.sizes=e}getScrollPosition(e,t){return fm({pointerPos:e,pointerOffset:this.pointerOffset,sizes:this.sizes,dir:t})}onThumbPointerUp(){this.pointerOffset=0}onThumbPointerDown(e){this.pointerOffset=e}xOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollLeft,i=`translate3d(${mu({scrollPos:e,sizes:this.sizes,dir:this.root.opts.dir.current})}px, 0, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}xOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=e)}xOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=this.getScrollPosition(e,this.root.opts.dir.current))}yOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollTop,i=`translate3d(0, ${mu({scrollPos:e,sizes:this.sizes})}px, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}yOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=e)}yOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=this.getScrollPosition(e,this.root.opts.dir.current))}}class ec{static create(e){return jl.set(new ec(e,Aa.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Ae();get computedStyle(){return u(this.#e)}set computedStyle(e){U(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=Gn(this.scrollbar.opts.ref,i=>this.root.scrollbarXNode=i),Rt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Rt(()=>{this.onResize()})}onThumbPointerDown=e=>{this.scrollbarVis.onThumbPointerDown(e.x)};onDragScroll=e=>{this.scrollbarVis.xOnDragScroll(e.x)};onThumbPointerUp=()=>{this.scrollbarVis.onThumbPointerUp()};onThumbPositionChange=()=>{this.scrollbarVis.xOnThumbPositionChange()};onWheelScroll=(e,t)=>{if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollLeft+e.deltaX;this.scrollbarVis.xOnWheelScroll(i),gh(i,t)&&e.preventDefault()};onResize=()=>{this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollWidth,viewport:this.root.viewportNode.offsetWidth,scrollbar:{size:this.scrollbar.opts.ref.current.clientWidth,paddingStart:ga(this.computedStyle.paddingLeft),paddingEnd:ga(this.computedStyle.paddingRight)}})};#t=F(()=>Ca(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){U(this.#t,e)}#n=F(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"horizontal",style:{bottom:0,left:this.root.opts.dir.current==="rtl"?"var(--bits-scroll-area-corner-width)":0,right:this.root.opts.dir.current==="ltr"?"var(--bits-scroll-area-corner-width)":0,"--bits-scroll-area-thumb-width":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}}class tc{static create(e){return jl.set(new tc(e,Aa.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Ae();get computedStyle(){return u(this.#e)}set computedStyle(e){U(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=Gn(this.scrollbar.opts.ref,i=>this.root.scrollbarYNode=i),Rt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Rt(()=>{this.onResize()}),this.onThumbPointerDown=this.onThumbPointerDown.bind(this),this.onDragScroll=this.onDragScroll.bind(this),this.onThumbPointerUp=this.onThumbPointerUp.bind(this),this.onThumbPositionChange=this.onThumbPositionChange.bind(this),this.onWheelScroll=this.onWheelScroll.bind(this),this.onResize=this.onResize.bind(this)}onThumbPointerDown(e){this.scrollbarVis.onThumbPointerDown(e.y)}onDragScroll(e){this.scrollbarVis.yOnDragScroll(e.y)}onThumbPointerUp(){this.scrollbarVis.onThumbPointerUp()}onThumbPositionChange(){this.scrollbarVis.yOnThumbPositionChange()}onWheelScroll(e,t){if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollTop+e.deltaY;this.scrollbarVis.yOnWheelScroll(i),gh(i,t)&&e.preventDefault()}onResize(){this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollHeight,viewport:this.root.viewportNode.offsetHeight,scrollbar:{size:this.scrollbar.opts.ref.current.clientHeight,paddingStart:ga(this.computedStyle.paddingTop),paddingEnd:ga(this.computedStyle.paddingBottom)}})}#t=F(()=>Ca(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){U(this.#t,e)}#n=F(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"vertical",style:{top:0,right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:"var(--bits-scroll-area-corner-height)","--bits-scroll-area-thumb-height":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}}class nc{static create(){return fh.set(new nc(jl.get()))}scrollbarState;root;scrollbarVis;scrollbar;#e=Ae(null);get rect(){return u(this.#e)}set rect(e){U(this.#e,e)}#t=Ae("");get prevWebkitUserSelect(){return u(this.#t)}set prevWebkitUserSelect(e){U(this.#t,e,!0)}handleResize;handleThumbPositionChange;handleWheelScroll;handleThumbPointerDown;handleThumbPointerUp;#n=F(()=>this.scrollbarVis.sizes.content-this.scrollbarVis.sizes.viewport);get maxScrollPos(){return u(this.#n)}set maxScrollPos(e){U(this.#n,e)}constructor(e){this.scrollbarState=e,this.root=e.root,this.scrollbarVis=e.scrollbarVis,this.scrollbar=e.scrollbarVis.scrollbar,this.handleResize=Ta(()=>this.scrollbarState.onResize(),10),this.handleThumbPositionChange=this.scrollbarState.onThumbPositionChange,this.handleWheelScroll=this.scrollbarState.onWheelScroll,this.handleThumbPointerDown=this.scrollbarState.onThumbPointerDown,this.handleThumbPointerUp=this.scrollbarState.onThumbPointerUp,Rt(()=>{const t=this.maxScrollPos,i=this.scrollbar.opts.ref.current;this.root.viewportNode;const r=a=>{const o=a.target;i?.contains(o)&&this.handleWheelScroll(a,t)};return Kt(this.root.domContext.getDocument(),"wheel",r,{passive:!1})}),dp(()=>{this.scrollbarVis.sizes,rn(()=>this.handleThumbPositionChange())}),new nr(()=>this.scrollbar.opts.ref.current,this.handleResize),new nr(()=>this.root.contentNode,this.handleResize),this.onpointerdown=this.onpointerdown.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onpointerup=this.onpointerup.bind(this),this.onlostpointercapture=this.onlostpointercapture.bind(this)}handleDragScroll(e){if(!this.rect)return;const t=e.clientX-this.rect.left,i=e.clientY-this.rect.top;this.scrollbarState.onDragScroll({x:t,y:i})}#i(){this.rect!==null&&(this.root.domContext.getDocument().body.style.webkitUserSelect=this.prevWebkitUserSelect,this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior=""),this.rect=null)}onpointerdown(e){if(e.button!==0)return;e.target.setPointerCapture(e.pointerId),this.rect=this.scrollbar.opts.ref.current?.getBoundingClientRect()??null,this.prevWebkitUserSelect=this.root.domContext.getDocument().body.style.webkitUserSelect,this.root.domContext.getDocument().body.style.webkitUserSelect="none",this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior="auto"),this.handleDragScroll(e)}onpointermove(e){this.handleDragScroll(e)}onpointerup(e){const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),this.#i()}onlostpointercapture(e){this.#i()}#r=F(()=>fn({...this.scrollbarState.props,style:{position:"absolute",...this.scrollbarState.props.style},[ps.scrollbar]:"",onpointerdown:this.onpointerdown,onpointermove:this.onpointermove,onpointerup:this.onpointerup,onlostpointercapture:this.onlostpointercapture}));get props(){return u(this.#r)}set props(e){U(this.#r,e)}}class ic{static create(e){return new ic(e,fh.get())}opts;scrollbarState;attachment;#e;#t=Ae();#n=Ta(()=>{u(this.#t)&&(u(this.#t)(),U(this.#t,void 0))},100);constructor(e,t){this.opts=e,this.scrollbarState=t,this.#e=t.root,this.attachment=Gn(this.opts.ref,i=>this.scrollbarState.scrollbarVis.thumbNode=i),Rt(()=>{const i=this.#e.viewportNode;if(!i)return;const r=()=>{if(this.#n(),!u(this.#t)){const a=pm(i,this.scrollbarState.handleThumbPositionChange);U(this.#t,a,!0),this.scrollbarState.handleThumbPositionChange()}};return rn(()=>this.scrollbarState.handleThumbPositionChange()),Kt(i,"scroll",r)}),this.onpointerdowncapture=this.onpointerdowncapture.bind(this),this.onpointerup=this.onpointerup.bind(this)}onpointerdowncapture(e){const t=e.target;if(!t)return;const i=t.getBoundingClientRect(),r=e.clientX-i.left,s=e.clientY-i.top;this.scrollbarState.handleThumbPointerDown({x:r,y:s})}onpointerup(e){this.scrollbarState.handleThumbPointerUp()}#i=F(()=>({id:this.opts.id.current,"data-state":this.scrollbarState.scrollbarVis.hasThumb?"visible":"hidden",style:{width:"var(--bits-scroll-area-thumb-width)",height:"var(--bits-scroll-area-thumb-height)",transform:this.scrollbarState.scrollbarVis.prevTransformStyle},onpointerdowncapture:this.onpointerdowncapture,onpointerup:this.onpointerup,[ps.thumb]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){U(this.#i,e)}}class rc{static create(e){return new rc(e,ms.get())}opts;root;attachment;#e=Ae(0);#t=Ae(0);#n=F(()=>!!(u(this.#e)&&u(this.#t)));get hasSize(){return u(this.#n)}set hasSize(e){U(this.#n,e)}constructor(e,t){this.opts=e,this.root=t,this.attachment=Gn(this.opts.ref),new nr(()=>this.root.scrollbarXNode,()=>{const i=this.root.scrollbarXNode?.offsetHeight||0;this.root.cornerHeight=i,U(this.#t,i,!0)}),new nr(()=>this.root.scrollbarYNode,()=>{const i=this.root.scrollbarYNode?.offsetWidth||0;this.root.cornerWidth=i,U(this.#e,i,!0)})}#i=F(()=>({id:this.opts.id.current,style:{width:u(this.#e),height:u(this.#t),position:"absolute",right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:0},[ps.corner]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){U(this.#i,e)}}function ga(n){return n?Number.parseInt(n,10):0}function ph(n,e){const t=n/e;return Number.isNaN(t)?0:t}function Ca(n){const e=ph(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-t)*e;return Math.max(i,18)}function fm({pointerPos:n,pointerOffset:e,sizes:t,dir:i="ltr"}){const r=Ca(t),s=r/2,a=e||s,o=r-a,l=t.scrollbar.paddingStart+a,c=t.scrollbar.size-t.scrollbar.paddingEnd-o,d=t.content-t.viewport,h=i==="ltr"?[0,d]:[d*-1,0];return mh([l,c],h)(n)}function mu({scrollPos:n,sizes:e,dir:t="ltr"}){const i=Ca(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,a=e.content-e.viewport,o=s-i,l=t==="ltr"?[0,a]:[a*-1,0],c=dm(n,l[0],l[1]);return mh([0,a],[0,o])(c)}function mh(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(n[1]-n[0]);return e[0]+i*(t-n[0])}}function gh(n,e){return n>0&&n<e}function pm(n,e){let t={left:n.scrollLeft,top:n.scrollTop},i=0;const r=Ep(n);return(function s(){const a={left:n.scrollLeft,top:n.scrollTop},o=t.left!==a.left,l=t.top!==a.top;(o||l)&&e(),t=a,i=r.requestAnimationFrame(s)})(),()=>r.cancelAnimationFrame(i)}var mm=Z("<div><!></div>");function gm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=_e(e,"type",3,"hover"),a=_e(e,"dir",3,"ltr"),o=_e(e,"scrollHideDelay",3,600),l=lt(e,["$$slots","$$events","$$legacy","ref","id","type","dir","scrollHideDelay","children","child"]);const c=ql.create({type:dt(()=>s()),dir:dt(()=>a()),scrollHideDelay:dt(()=>o()),id:dt(()=>r()),ref:dt(()=>i(),S=>i(S))}),d=F(()=>fn(l,c.props));var h=Ie(),f=oe(h);{var p=S=>{var g=Ie(),m=oe(g);Ct(m,()=>e.child,()=>({props:u(d)})),C(S,g)},v=S=>{var g=mm();an(g,()=>({...u(d)}));var m=$(g);Ct(m,()=>e.children??Ut),X(g),C(S,g)};xe(f,S=>{e.child?S(p):S(v,-1)})}C(n,h),it()}var vm=Z("<div><div><!></div></div>");function _m(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=lt(e,["$$slots","$$events","$$legacy","ref","id","children"]);const a=Kl.create({id:dt(()=>r()),ref:dt(()=>i(),f=>i(f))}),o=F(()=>fn(s,a.props)),l=F(()=>fn({},a.contentProps));var c=vm();an(c,()=>({...u(o)}));var d=$(c);an(d,()=>({...u(l)}));var h=$(d);Ct(h,()=>e.children??Ut),X(d),X(c),C(n,c),it()}var xm=Z("<div><!></div>");function vh(n,e){nt(e,!0);let t=lt(e,["$$slots","$$events","$$legacy","child","children"]);const i=nc.create(),r=F(()=>fn(t,i.props));var s=Ie(),a=oe(s);{var o=c=>{var d=Ie(),h=oe(d);Ct(h,()=>e.child,()=>({props:u(r)})),C(c,d)},l=c=>{var d=xm();an(d,()=>({...u(r)}));var h=$(d);Ct(h,()=>e.children??Ut),X(d),C(c,d)};xe(a,c=>{e.child?c(o):c(l,-1)})}C(n,s),it()}function bm(n,e){nt(e,!0);let t=lt(e,["$$slots","$$events","$$legacy"]);const i=new Wl,r=ec.create({mounted:dt(()=>i.current)}),s=F(()=>fn(t,r.props));vh(n,pt(()=>u(s))),it()}function Sm(n,e){nt(e,!0);let t=lt(e,["$$slots","$$events","$$legacy"]);const i=new Wl,r=tc.create({mounted:dt(()=>i.current)}),s=F(()=>fn(t,r.props));vh(n,pt(()=>u(s))),it()}function Pa(n,e){nt(e,!0);let t=lt(e,["$$slots","$$events","$$legacy"]);const i=Ql.create();var r=Ie(),s=oe(r);{var a=l=>{bm(l,pt(()=>t))},o=l=>{Sm(l,pt(()=>t))};xe(s,l=>{i.scrollbar.opts.orientation.current==="horizontal"?l(a):l(o,-1)})}C(n,r),it()}function ym(n,e){nt(e,!0);let t=_e(e,"forceMount",3,!1),i=lt(e,["$$slots","$$events","$$legacy","forceMount"]);const r=Ra.create(),s=F(()=>fn(i,r.props));{const a=l=>{Pa(l,pt(()=>u(s)))};let o=F(()=>t()||r.isVisible);wa(n,{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}})}it()}function Mm(n,e){nt(e,!0);let t=_e(e,"forceMount",3,!1),i=lt(e,["$$slots","$$events","$$legacy","forceMount"]);const r=Jl.create(),s=F(()=>fn(i,r.props));{const a=l=>{Pa(l,pt(()=>u(s)))};let o=F(()=>t()||!r.isHidden);wa(n,pt(()=>u(s),{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}}))}it()}function Em(n,e){nt(e,!0);let t=_e(e,"forceMount",3,!1),i=lt(e,["$$slots","$$events","$$legacy","forceMount"]);const r=$l.create(),s=Ra.create(),a=F(()=>fn(i,r.props,s.props,{"data-state":r.isVisible?"visible":"hidden"})),o=F(()=>t()||r.isVisible&&s.isVisible);wa(n,{get open(){return u(o)},get ref(){return s.scrollbar.opts.ref},presence:c=>{Pa(c,pt(()=>u(a)))},$$slots:{presence:!0}}),it()}function Tm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=lt(e,["$$slots","$$events","$$legacy","ref","id","orientation"]);const a=Zl.create({orientation:dt(()=>e.orientation),id:dt(()=>r()),ref:dt(()=>i(),v=>i(v))}),o=F(()=>a.root.opts.type.current);var l=Ie(),c=oe(l);{var d=v=>{Em(v,pt(()=>s,{get id(){return r()}}))},h=v=>{Mm(v,pt(()=>s,{get id(){return r()}}))},f=v=>{ym(v,pt(()=>s,{get id(){return r()}}))},p=v=>{Pa(v,pt(()=>s,{get id(){return r()}}))};xe(c,v=>{u(o)==="hover"?v(d):u(o)==="scroll"?v(h,1):u(o)==="auto"?v(f,2):u(o)==="always"&&v(p,3)})}C(n,l),it()}var wm=Z("<div><!></div>");function Am(n,e){nt(e,!0);let t=_e(e,"ref",15,null),i=lt(e,["$$slots","$$events","$$legacy","ref","id","child","children","present"]);const r=new Wl,s=ic.create({id:dt(()=>e.id),ref:dt(()=>t(),h=>t(h)),mounted:dt(()=>r.current)}),a=F(()=>fn(i,s.props,{style:{hidden:!e.present}}));var o=Ie(),l=oe(o);{var c=h=>{var f=Ie(),p=oe(f);Ct(p,()=>e.child,()=>({props:u(a)})),C(h,f)},d=h=>{var f=wm();an(f,()=>({...u(a)}));var p=$(f);Ct(p,()=>e.children??Ut),X(f),C(h,f)};xe(l,h=>{e.child?h(c):h(d,-1)})}C(n,o),it()}function Rm(n,e){const t=Un();nt(e,!0);let i=_e(e,"id",19,()=>xi(t)),r=_e(e,"ref",15,null),s=_e(e,"forceMount",3,!1),a=lt(e,["$$slots","$$events","$$legacy","id","ref","forceMount"]);const o=Aa.get();{const l=(d,h)=>{let f=()=>h?.().present;Am(d,pt(()=>a,{get id(){return i()},get present(){return f()},get ref(){return r()},set ref(p){r(p)}}))};let c=F(()=>s()||o.hasThumb);wa(n,{get open(){return u(c)},get ref(){return o.scrollbar.opts.ref},presence:l,$$slots:{presence:!0}})}it()}var Cm=Z("<div><!></div>");function Pm(n,e){nt(e,!0);let t=_e(e,"ref",15,null),i=lt(e,["$$slots","$$events","$$legacy","ref","id","children","child"]);const r=rc.create({id:dt(()=>e.id),ref:dt(()=>t(),d=>t(d))}),s=F(()=>fn(i,r.props));var a=Ie(),o=oe(a);{var l=d=>{var h=Ie(),f=oe(h);Ct(f,()=>e.child,()=>({props:u(s)})),C(d,h)},c=d=>{var h=Cm();an(h,()=>({...u(s)}));var f=$(h);Ct(f,()=>e.children??Ut),X(h),C(d,h)};xe(o,d=>{e.child?d(l):d(c,-1)})}C(n,a),it()}function Dm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=lt(e,["$$slots","$$events","$$legacy","ref","id"]);const a=ms.get(),o=F(()=>!!(a.scrollbarXNode&&a.scrollbarYNode)),l=F(()=>a.opts.type.current!=="scroll"&&u(o));var c=Ie(),d=oe(c);{var h=f=>{Pm(f,pt(()=>s,{get id(){return r()},get ref(){return i()},set ref(p){i(p)}}))};xe(d,f=>{u(l)&&f(h)})}C(n,c),it()}function gu(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.right=`${t}%`):n==="rl"?(i.right=`${e}%`,i.left=`${t}%`):n==="bt"?(i.bottom=`${e}%`,i.top=`${t}%`):(i.top=`${e}%`,i.bottom=`${t}%`),i}function _h(n,e){const t={position:"absolute"};return n==="lr"?(t.left=`${e}%`,t.translate="-50% 0"):n==="rl"?(t.right=`${e}%`,t.translate="50% 0"):n==="bt"?(t.bottom=`${e}%`,t.translate="0 50%"):(t.top=`${e}%`,t.translate="0 -50%"),t}function xh(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.translate=`${t}% 0`):n==="rl"?(i.right=`${e}%`,i.translate=`${-t}% 0`):n==="bt"?(i.bottom=`${e}%`,i.translate=`0 ${-t}%`):(i.top=`${e}%`,i.translate=`0 ${t}%`),i}function Lm(n){if(Math.floor(n)===n)return 0;const e=n.toString();if(e.indexOf(".")!==-1&&e.indexOf("e-")===-1)return e.split(".")[1].length;if(e.indexOf("e-")!==-1){const t=e.split("e-");return parseInt(t[1],10)}return 0}function Im(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}function sc(n,e,t){if(typeof n=="number"){const i=t-e;let r=Math.ceil(i/n);const s=Lm(n),a=Math.pow(10,s),o=Math.round(i*a),l=Math.round(n*a);o%l===0&&r++;const c=[];for(let d=0;d<r;d++){const h=e+d*n,f=Im(h,s);c.push(f)}return c}return[...new Set(n)].filter(i=>i>=e&&i<=t).sort((i,r)=>i-r)}function Qi(n,e){if(e.length===0)return n;let t=e[0],i=Math.abs(n-t);for(const r of e){const s=Math.abs(n-r);s<i&&(i=s,t=r)}return t}function Ms(n,e,t){const i=e.indexOf(n);return i===-1?Qi(n,e):t==="next"?i<e.length-1?e[i+1]:n:i>0?e[i-1]:n}function Nm(n,e,t=!0){const[i,r]=n,[s,a]=e,o=(a-s)/(r-i);return l=>{const c=s+o*(l-i);return t?c>Math.max(s,a)?Math.max(s,a):c<Math.min(s,a)?Math.min(s,a):c:c}}const Ni=Vl({component:"slider",parts:["root","thumb","range","tick","tick-label","thumb-label"]}),ac=new zi("Slider.Root");class bh{opts;attachment;#e=Ae(!1);get isActive(){return u(this.#e)}set isActive(e){U(this.#e,e,!0)}#t=Ae(0);#n=F(()=>this.opts.orientation.current==="horizontal"?this.opts.dir.current==="rtl"?"rl":"lr":this.opts.dir.current==="rtl"?"tb":"bt");get direction(){return u(this.#n)}set direction(e){U(this.#n,e)}#i=F(()=>sc(this.opts.step.current,this.opts.min.current,this.opts.max.current));get normalizedSteps(){return u(this.#i)}set normalizedSteps(e){U(this.#i,e)}domContext;constructor(e){this.opts=e,this.attachment=Gn(e.ref),this.domContext=new $d(this.opts.ref),new nr(()=>this.opts.ref.current,this.#r)}#r=()=>{U(this.#t,u(this.#t)+1)};isThumbActive(e){return this.isActive}#s=F(()=>{if(!this.opts.disabled.current)return this.opts.orientation.current==="horizontal"?"pan-y":"pan-x"});getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Ni.selector("thumb"))):[]};getThumbScale=()=>{u(this.#t);const e=this.opts.trackPadding?.current;if(e!==void 0&&e>0)return[e,100-e];if(this.opts.thumbPositioning.current==="exact")return[0,100];const t=this.opts.orientation.current==="vertical",i=this.getAllThumbs()[0],r=t?i?.offsetHeight:i?.offsetWidth;if(r===void 0||Number.isNaN(r)||r===0)return[0,100];const s=t?this.opts.ref.current?.offsetHeight:this.opts.ref.current?.offsetWidth;if(s===void 0||Number.isNaN(s)||s===0)return[0,100];const a=r/2/s*100,o=a,l=100-a;return[o,l]};getPositionFromValue=e=>{const t=this.getThumbScale();return Nm([this.opts.min.current,this.opts.max.current],t)(e)};#a=F(()=>({id:this.opts.id.current,"data-orientation":this.opts.orientation.current,"data-disabled":tr(this.opts.disabled.current),style:{touchAction:u(this.#s)},[Ni.root]:"",...this.attachment}));get props(){return u(this.#a)}set props(e){U(this.#a,e)}}class Um extends bh{opts;isMulti=!1;constructor(e){super(e),this.opts=e,ch(()=>Hl(Kt(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),Kt(this.domContext.getDocument(),"pointerup",this.handlePointerUp),Kt(this.domContext.getDocument(),"pointermove",this.handlePointerMove),Kt(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),Fi([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=sc(t,i,r),o=c=>a.includes(c),l=c=>Qi(c,a);o(s)||(this.opts.value.current=l(s))})}isTickValueSelected=e=>this.opts.value.current===e;applyPosition({clientXY:e,start:t,end:i}){const r=this.opts.min.current,s=this.opts.max.current,o=(e-t)/(i-t)*(s-r)+r;if(o<r)this.updateValue(r);else if(o>s)this.updateValue(s);else{const l=this.normalizedSteps,c=Qi(o,l);this.updateValue(c)}}updateValue=e=>{this.opts.value.current=Qi(e,this.normalizedSteps)};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!t||!i)return;i.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect();this.direction==="lr"?this.applyPosition({clientXY:e.clientX,start:r,end:s}):this.direction==="rl"?this.applyPosition({clientXY:e.clientX,start:s,end:r}):this.direction==="bt"?this.applyPosition({clientXY:e.clientY,start:o,end:a}):this.direction==="tb"&&this.applyPosition({clientXY:e.clientY,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!i||!t)return;const r=e.composedPath()[0]??e.target;!lh(r)||!t.contains(r)||(e.preventDefault(),i.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(rn(()=>this.opts.value.current)),this.isActive=!1)};#e=F(()=>{const e=this.opts.value.current;return Array.from({length:1},()=>{const t=e,i=this.getPositionFromValue(t),r=_h(this.direction,i);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":t,"aria-disabled":ma(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":t,"data-orientation":this.opts.orientation.current,style:r,[Ni.thumb]:""}})});get thumbsPropsArr(){return u(this.#e)}set thumbsPropsArr(e){U(this.#e,e)}#t=F(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#t)}set thumbsRenderArr(e){U(this.#t,e)}#n=F(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=xh(this.direction,s,l),d=i<=t;return{"data-disabled":tr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,"data-selected":this.isTickValueSelected(i)?"":void 0,style:c,[Ni.tick]:""}})});get ticksPropsArr(){return u(this.#n)}set ticksPropsArr(e){U(this.#n,e)}#i=F(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#i)}set ticksRenderArr(e){U(this.#i,e)}#r=F(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#r)}set tickItemsArr(e){U(this.#r,e)}#s=F(()=>[{value:this.opts.value.current,index:0}]);get thumbItemsArr(){return u(this.#s)}set thumbItemsArr(e){U(this.#s,e)}#a=F(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#a)}set snippetProps(e){U(this.#a,e)}}class Fm extends bh{opts;isMulti=!0;#e=Ae(null);get activeThumb(){return u(this.#e)}set activeThumb(e){U(this.#e,e,!0)}#t=Ae(0);get currentThumbIdx(){return u(this.#t)}set currentThumbIdx(e){U(this.#t,e,!0)}constructor(e){super(e),this.opts=e,ch(()=>Hl(Kt(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),Kt(this.domContext.getDocument(),"pointerup",this.handlePointerUp),Kt(this.domContext.getDocument(),"pointermove",this.handlePointerMove),Kt(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),Fi([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=sc(t,i,r),o=c=>a.includes(c),l=c=>Qi(c,a);s.some(c=>!o(c))&&(this.opts.value.current=s.map(l))})}isTickValueSelected=e=>this.opts.value.current.includes(e);isThumbActive(e){return this.isActive&&this.activeThumb?.idx===e}applyPosition({clientXY:e,activeThumbIdx:t,start:i,end:r}){const s=this.opts.min.current,a=this.opts.max.current,l=(e-i)/(r-i)*(a-s)+s;if(l<s)this.updateValue(s,t);else if(l>a)this.updateValue(a,t);else{const c=this.normalizedSteps,d=Qi(l,c);this.updateValue(d,t)}}#n=e=>{const t=this.getAllThumbs();if(!t.length)return;for(const a of t)a.blur();const i=t.map(a=>{if(this.opts.orientation.current==="horizontal"){const{left:o,right:l}=a.getBoundingClientRect();return Math.abs(e.clientX-(o+l)/2)}else{const{top:o,bottom:l}=a.getBoundingClientRect();return Math.abs(e.clientY-(o+l)/2)}}),r=t[i.indexOf(Math.min(...i))],s=t.indexOf(r);return{node:r,idx:s}};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.activeThumb;if(!t||!i)return;i.node.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect(),l=this.direction;l==="lr"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:r,end:s}):l==="rl"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:s,end:r}):l==="bt"?this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:o,end:a}):l==="tb"&&this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.#n(e);if(!i||!t)return;const r=e.composedPath()[0]??e.target;!lh(r)||!t.contains(r)||(e.preventDefault(),this.activeThumb=i,i.node.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(rn(()=>this.opts.value.current)),this.isActive=!1)};getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Ni.selector("thumb"))):[]};updateValue=(e,t)=>{const i=this.opts.value.current;if(!i.length){this.opts.value.current.push(e);return}if(i[t]===e)return;const s=[...i];if(!Fp(t,s))return;const a=s[t]>e?-1:1,o=()=>{const c=t+a;s[t]=s[c],s[c]=e;const d=this.getAllThumbs();d.length&&(d[c]?.focus(),this.activeThumb={node:d[c],idx:c})};if(this.opts.autoSort.current&&(a===-1&&e<s[t-1]||a===1&&e>s[t+1])){o(),this.opts.value.current=s;return}const l=this.normalizedSteps;s[t]=Qi(e,l),this.opts.value.current=s};#i=F(()=>{const e=this.opts.value.current;return Array.from({length:e.length||1},(t,i)=>{const r=rn(()=>this.currentThumbIdx);r<e.length&&rn(()=>{this.currentThumbIdx=r+1});const s=e[i],a=this.getPositionFromValue(s??0),o=_h(this.direction,a);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":s,"aria-disabled":ma(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":s,"data-orientation":this.opts.orientation.current,style:o,[Ni.thumb]:""}})});get thumbsPropsArr(){return u(this.#i)}set thumbsPropsArr(e){U(this.#i,e)}#r=F(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#r)}set thumbsRenderArr(e){U(this.#r,e)}#s=F(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=xh(this.direction,s,l),d=t.length===1?i<=t[0]:t[0]<=i&&i<=t[t.length-1];return{"data-disabled":tr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,style:c,[Ni.tick]:""}})});get ticksPropsArr(){return u(this.#s)}set ticksPropsArr(e){U(this.#s,e)}#a=F(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#a)}set ticksRenderArr(e){U(this.#a,e)}#o=F(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#o)}set tickItemsArr(e){U(this.#o,e)}#l=F(()=>this.opts.value.current.map((t,i)=>({value:t,index:i})));get thumbItemsArr(){return u(this.#l)}set thumbItemsArr(e){U(this.#l,e)}#c=F(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#c)}set snippetProps(e){U(this.#c,e)}}class Om{static create(e){const{type:t,...i}=e,r=t==="single"?new Um(i):new Fm(i);return ac.set(r)}}const Bm=[nh,ih,rh,sh,ah,oh];class oc{static create(e){return new oc(e,ac.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Gn(e.ref)}#e=F(()=>{if(Array.isArray(this.root.opts.value.current)){const e=this.root.opts.value.current.length>1?this.root.getPositionFromValue(Math.min(...this.root.opts.value.current)??0):0,t=100-this.root.getPositionFromValue(Math.max(...this.root.opts.value.current)??0);return{position:"absolute",...gu(this.root.direction,e,t)}}else{const e=this.root.opts.trackPadding?.current,t=this.root.opts.value.current,i=this.root.opts.max.current,r=0,s=e!==void 0&&e>0&&t===i?0:100-this.root.getPositionFromValue(t);return{position:"absolute",...gu(this.root.direction,r,s)}}});get rangeStyles(){return u(this.#e)}set rangeStyles(e){U(this.#e,e)}#t=F(()=>({id:this.opts.id.current,"data-orientation":this.root.opts.orientation.current,"data-disabled":tr(this.root.opts.disabled.current),style:this.rangeStyles,[Ni.range]:"",...this.attachment}));get props(){return u(this.#t)}set props(e){U(this.#t,e)}}class lc{static create(e){return new lc(e,ac.get())}opts;root;attachment;#e=F(()=>this.root.opts.disabled.current||this.opts.disabled.current);constructor(e,t){this.opts=e,this.root=t,this.attachment=Gn(e.ref),this.onkeydown=this.onkeydown.bind(this)}#t(e){this.root.isMulti?this.root.updateValue(e,this.opts.index.current):this.root.updateValue(e)}onkeydown(e){if(u(this.#e))return;const t=this.opts.ref.current;if(!t)return;const i=this.root.getAllThumbs();if(!i.length)return;const r=i.indexOf(t);if(this.root.isMulti&&(this.root.currentThumbIdx=r),!Bm.includes(e.key))return;e.preventDefault();const s=this.root.opts.min.current,a=this.root.opts.max.current,o=this.root.opts.value.current,l=Array.isArray(o)?o[r]:o,c=this.root.opts.orientation.current,d=this.root.direction,h=this.root.normalizedSteps;switch(e.key){case ah:this.#t(s);break;case oh:this.#t(a);break;case nh:if(c!=="horizontal")break;if(e.metaKey){const f=d==="rl"?a:s;this.#t(f)}else{const p=Ms(l,h,d==="rl"?"next":"prev");this.#t(p)}break;case ih:if(c!=="horizontal")break;if(e.metaKey){const f=d==="rl"?s:a;this.#t(f)}else{const p=Ms(l,h,d==="rl"?"prev":"next");this.#t(p)}break;case rh:if(e.metaKey){const f=d==="tb"?s:a;this.#t(f)}else{const p=Ms(l,h,d==="tb"?"prev":"next");this.#t(p)}break;case sh:if(e.metaKey){const f=d==="tb"?a:s;this.#t(f)}else{const p=Ms(l,h,d==="tb"?"next":"prev");this.#t(p)}break}this.root.opts.onValueCommit.current(this.root.opts.value.current)}#n=F(()=>({...this.root.thumbsPropsArr[this.opts.index.current],id:this.opts.id.current,onkeydown:this.onkeydown,"data-active":this.root.isThumbActive(this.opts.index.current)?"":void 0,"data-disabled":tr(this.opts.disabled.current||this.root.opts.disabled.current),tabindex:this.opts.disabled.current||this.root.opts.disabled.current?-1:0,...this.attachment}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}}var zm=Z("<span><!></span>");function km(n,e){const t=Un();nt(e,!0);let i=_e(e,"id",19,()=>xi(t)),r=_e(e,"ref",15,null),s=_e(e,"value",15),a=_e(e,"onValueChange",3,fu),o=_e(e,"onValueCommit",3,fu),l=_e(e,"disabled",3,!1),c=_e(e,"step",3,1),d=_e(e,"dir",3,"ltr"),h=_e(e,"autoSort",3,!0),f=_e(e,"orientation",3,"horizontal"),p=_e(e,"thumbPositioning",3,"contain"),v=lt(e,["$$slots","$$events","$$legacy","children","child","id","ref","value","type","onValueChange","onValueCommit","disabled","min","max","step","dir","autoSort","orientation","thumbPositioning","trackPadding"]);const S=F(()=>e.min!==void 0?e.min:Array.isArray(c())?Math.min(...c()):0),g=F(()=>e.max!==void 0?e.max:Array.isArray(c())?Math.max(...c()):100);function m(){if(s()===void 0)return e.type==="single"?u(S):[]}m(),Fi.pre(()=>s(),()=>{m()});const x=Om.create({id:dt(()=>i()),ref:dt(()=>r(),_=>r(_)),value:dt(()=>s(),_=>{s(_),a()(_)}),onValueCommit:dt(()=>o()),disabled:dt(()=>l()),min:dt(()=>u(S)),max:dt(()=>u(g)),step:dt(()=>c()),dir:dt(()=>d()),autoSort:dt(()=>h()),orientation:dt(()=>f()),thumbPositioning:dt(()=>p()),type:e.type,trackPadding:dt(()=>e.trackPadding)}),M=F(()=>fn(v,x.props));var w=Ie(),R=oe(w);{var y=_=>{var E=Ie(),I=oe(E);{let P=F(()=>({props:u(M),...x.snippetProps}));Ct(I,()=>e.child,()=>u(P))}C(_,E)},L=_=>{var E=zm();an(E,()=>({...u(M)}));var I=$(E);Ct(I,()=>e.children??Ut,()=>x.snippetProps),X(E),C(_,E)};xe(R,_=>{e.child?_(y):_(L,-1)})}C(n,w),it()}var Vm=Z("<span><!></span>");function Hm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=lt(e,["$$slots","$$events","$$legacy","children","child","ref","id"]);const a=oc.create({id:dt(()=>r()),ref:dt(()=>i(),f=>i(f))}),o=F(()=>fn(s,a.props));var l=Ie(),c=oe(l);{var d=f=>{var p=Ie(),v=oe(p);Ct(v,()=>e.child,()=>({props:u(o)})),C(f,p)},h=f=>{var p=Vm();an(p,()=>({...u(o)}));var v=$(p);Ct(v,()=>e.children??Ut),X(p),C(f,p)};xe(c,f=>{e.child?f(d):f(h,-1)})}C(n,l),it()}var Gm=Z("<span><!></span>");function Wm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=_e(e,"disabled",3,!1),a=lt(e,["$$slots","$$events","$$legacy","children","child","ref","id","index","disabled"]);const o=lc.create({id:dt(()=>r()),ref:dt(()=>i(),p=>i(p)),index:dt(()=>e.index),disabled:dt(()=>s())}),l=F(()=>fn(a,o.props));var c=Ie(),d=oe(c);{var h=p=>{var v=Ie(),S=oe(v);{let g=F(()=>({active:o.root.isThumbActive(o.opts.index.current),props:u(l)}));Ct(S,()=>e.child,()=>u(g))}C(p,v)},f=p=>{var v=Gm();an(v,()=>({...u(l)}));var S=$(v);{let g=F(()=>({active:o.root.isThumbActive(o.opts.index.current)}));Ct(S,()=>e.children??Ut,()=>u(g))}X(v),C(p,v)};xe(d,p=>{e.child?p(h):p(f,-1)})}C(n,c),it()}function Xm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];$t(n,pt({name:"camera"},()=>t,{get iconNode(){return i}}))}function Ym(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335"}],["path",{d:"m9 11 3 3L22 4"}]];$t(n,pt({name:"circle-check-big"},()=>t,{get iconNode(){return i}}))}function jm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m9 12 2 2 4-4"}]];$t(n,pt({name:"circle-check"},()=>t,{get iconNode(){return i}}))}function qm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]];$t(n,pt({name:"circle-question-mark"},()=>t,{get iconNode(){return i}}))}function Sh(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];$t(n,pt({name:"download"},()=>t,{get iconNode(){return i}}))}function Va(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];$t(n,pt({name:"eye-off"},()=>t,{get iconNode(){return i}}))}function Ha(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];$t(n,pt({name:"eye"},()=>t,{get iconNode(){return i}}))}function vu(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M12 12v6"}],["path",{d:"m15 15-3-3-3 3"}]];$t(n,pt({name:"file-up"},()=>t,{get iconNode(){return i}}))}function Km(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];$t(n,pt({name:"file"},()=>t,{get iconNode(){return i}}))}function Zm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}]];$t(n,pt({name:"folder-open"},()=>t,{get iconNode(){return i}}))}function $m(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];$t(n,pt({name:"folder"},()=>t,{get iconNode(){return i}}))}function Jm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}]];$t(n,pt({name:"inbox"},()=>t,{get iconNode(){return i}}))}function Qm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];$t(n,pt({name:"info"},()=>t,{get iconNode(){return i}}))}function eg(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]];$t(n,pt({name:"layers"},()=>t,{get iconNode(){return i}}))}function tg(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];$t(n,pt({name:"link"},()=>t,{get iconNode(){return i}}))}function cc(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];$t(n,pt({name:"loader"},()=>t,{get iconNode(){return i}}))}function uc(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];$t(n,pt({name:"maximize"},()=>t,{get iconNode(){return i}}))}function dc(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]];$t(n,pt({name:"minimize"},()=>t,{get iconNode(){return i}}))}function ng(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M5 12h14"}]];$t(n,pt({name:"minus"},()=>t,{get iconNode(){return i}}))}function ig(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"}]];$t(n,pt({name:"play"},()=>t,{get iconNode(){return i}}))}function rg(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];$t(n,pt({name:"zap"},()=>t,{get iconNode(){return i}}))}const Nr={FILE_UPLOAD:{MAX_SIZE_MB:150,MAX_SIZE_BYTES:150*1024*1024},TIMEOUTS:{SOLVE_STATE_DURATION:3500,PARAM_EXPORT_DELAY:100,DRAWER_ANIMATION_MS:350},SOLVING_INDICATOR:{FAST_THRESHOLD_MS:200,SLOW_THRESHOLD_MS:600,ANIMATION_DELAY:300,HISTORY_SIZE:3},FILE_SIZE:{BYTES_PER_KB:1024}};var yh=Object.defineProperty,sg=(n,e,t)=>e in n?yh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ag=(n,e)=>{for(var t in e)yh(n,t,{get:e[t],enumerable:!0})},Es=(n,e,t)=>sg(n,typeof e!="symbol"?e+"":e,t),gi={VALIDATION_ERROR:"VALIDATION_ERROR",INVALID_STATE:"INVALID_STATE",INVALID_INPUT:"INVALID_INPUT",BROWSER_ONLY:"BROWSER_ONLY"},Ui=class Io extends Error{constructor(e,t="UNKNOWN_ERROR",i){super(e),Es(this,"code"),Es(this,"statusCode"),Es(this,"context"),Es(this,"originalError"),this.name="RhinoComputeError",this.code=t,this.statusCode=i?.statusCode,this.context=i?.context,this.originalError=i?.originalError,i?.originalError&&(this.cause=i.originalError)}static missingValues(e,t,i){return new Io(`Input "${e}" has no values defined${t?` (expected ${t})`:""}`,gi.INVALID_INPUT,{context:{inputName:e,expectedType:t,...i}})}static unknownParamType(e,t,i){return new Io(`Unknown paramType: ${e}`,gi.VALIDATION_ERROR,{context:{receivedParamType:e,paramName:t,...i}})}},og=class{debug(){}info(){}warn(){}error(){}},lg=new og;function zt(){return lg}function Mh(n){if(typeof globalThis.Buffer=="function"){let e=globalThis.Buffer.from(n,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}if(typeof globalThis.atob=="function"){let e=globalThis.atob(n),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i)&255;return t}throw new Ui("Base64 decoding not supported in this environment.",gi.INVALID_STATE,{context:{environmentInfo:"atob or Buffer not available"}})}const hc="184",Dr={ROTATE:0,DOLLY:1,PAN:2},Mr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},cg=0,_u=1,ug=2,ta=1,dg=2,Er=3,Sn=0,xn=1,Ln=2,fi=0,Lr=1,xu=2,bu=3,Su=4,hg=5,ji=100,fg=101,pg=102,mg=103,gg=104,vg=200,_g=201,xg=202,bg=203,No=204,Uo=205,Sg=206,yg=207,Mg=208,Eg=209,Tg=210,wg=211,Ag=212,Rg=213,Cg=214,Fo=0,Oo=1,Bo=2,Ur=3,zo=4,ko=5,Vo=6,Ho=7,Eh=0,Pg=1,Dg=2,Qn=0,Th=1,wh=2,Ah=3,Rh=4,Ch=5,Ph=6,fc=7,Dh=300,ir=301,Fr=302,na=303,Ga=304,Da=306,Go=1e3,Vn=1001,Wo=1002,on=1003,Lg=1004,Ts=1005,Zt=1006,Wa=1007,Li=1008,wn=1009,Lh=1010,Ih=1011,os=1012,pc=1013,ti=1014,An=1015,Rn=1016,mc=1017,gc=1018,ls=1020,Nh=35902,Uh=35899,Fh=1021,Oh=1022,Hn=1023,vi=1026,Ki=1027,Bh=1028,vc=1029,rr=1030,_c=1031,xc=1033,ia=33776,ra=33777,sa=33778,aa=33779,Xo=35840,Yo=35841,jo=35842,qo=35843,Ko=36196,Zo=37492,$o=37496,Jo=37488,Qo=37489,va=37490,el=37491,tl=37808,nl=37809,il=37810,rl=37811,sl=37812,al=37813,ol=37814,ll=37815,cl=37816,ul=37817,dl=37818,hl=37819,fl=37820,pl=37821,ml=36492,gl=36494,vl=36495,_l=36283,xl=36284,_a=36285,bl=36286,Ig=3200,Sl=0,Ng=1,Pi="",Tn="srgb",cs="srgb-linear",xa="linear",Pt="srgb",or=7680,yu=519,Ug=512,Fg=513,Og=514,bc=515,Bg=516,zg=517,Sc=518,kg=519,Mu=35044,Eu="300 es",Jn=2e3,us=2001;function Vg(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function ba(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Hg(){const n=ba("canvas");return n.style.display="block",n}const Tu={};function wu(...n){const e="THREE."+n.shift();console.log(e,...n)}function zh(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function ut(...n){n=zh(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Mt(...n){n=zh(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function yl(...n){const e=n.join(" ");e in Tu||(Tu[e]=!0,ut(...n))}function Gg(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const Wg={[Fo]:Oo,[Bo]:Vo,[zo]:Ho,[Ur]:ko,[Oo]:Fo,[Vo]:Bo,[Ho]:zo,[ko]:Ur};class ki{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const cn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],oa=Math.PI/180,Ml=180/Math.PI;function vs(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(cn[n&255]+cn[n>>8&255]+cn[n>>16&255]+cn[n>>24&255]+"-"+cn[e&255]+cn[e>>8&255]+"-"+cn[e>>16&15|64]+cn[e>>24&255]+"-"+cn[t&63|128]+cn[t>>8&255]+"-"+cn[t>>16&255]+cn[t>>24&255]+cn[i&255]+cn[i>>8&255]+cn[i>>16&255]+cn[i>>24&255]).toLowerCase()}function bt(n,e,t){return Math.max(e,Math.min(t,n))}function Xg(n,e){return(n%e+e)%e}function Xa(n,e,t){return(1-t)*n+t*e}function Hr(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function gn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Yg={DEG2RAD:oa},Kc=class Kc{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=bt(this.x,e.x,t.x),this.y=bt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=bt(this.x,e,t),this.y=bt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(bt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(bt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Kc.prototype.isVector2=!0;let ht=Kc;class Oi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],d=i[r+2],h=i[r+3],f=s[a+0],p=s[a+1],v=s[a+2],S=s[a+3];if(h!==S||l!==f||c!==p||d!==v){let g=l*f+c*p+d*v+h*S;g<0&&(f=-f,p=-p,v=-v,S=-S,g=-g);let m=1-o;if(g<.9995){const x=Math.acos(g),M=Math.sin(x);m=Math.sin(m*x)/M,o=Math.sin(o*x)/M,l=l*m+f*o,c=c*m+p*o,d=d*m+v*o,h=h*m+S*o}else{l=l*m+f*o,c=c*m+p*o,d=d*m+v*o,h=h*m+S*o;const x=1/Math.sqrt(l*l+c*c+d*d+h*h);l*=x,c*=x,d*=x,h*=x}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],h=s[a],f=s[a+1],p=s[a+2],v=s[a+3];return e[t]=o*v+d*h+l*p-c*f,e[t+1]=l*v+d*f+c*h-o*p,e[t+2]=c*v+d*p+o*f-l*h,e[t+3]=d*v-o*h-l*f-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),h=o(s/2),f=l(i/2),p=l(r/2),v=l(s/2);switch(a){case"XYZ":this._x=f*d*h+c*p*v,this._y=c*p*h-f*d*v,this._z=c*d*v+f*p*h,this._w=c*d*h-f*p*v;break;case"YXZ":this._x=f*d*h+c*p*v,this._y=c*p*h-f*d*v,this._z=c*d*v-f*p*h,this._w=c*d*h+f*p*v;break;case"ZXY":this._x=f*d*h-c*p*v,this._y=c*p*h+f*d*v,this._z=c*d*v+f*p*h,this._w=c*d*h-f*p*v;break;case"ZYX":this._x=f*d*h-c*p*v,this._y=c*p*h+f*d*v,this._z=c*d*v-f*p*h,this._w=c*d*h+f*p*v;break;case"YZX":this._x=f*d*h+c*p*v,this._y=c*p*h+f*d*v,this._z=c*d*v-f*p*h,this._w=c*d*h-f*p*v;break;case"XZY":this._x=f*d*h-c*p*v,this._y=c*p*h-f*d*v,this._z=c*d*v+f*p*h,this._w=c*d*h+f*p*v;break;default:ut("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],h=t[10],f=i+o+h;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(d-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>h){const p=2*Math.sqrt(1+i-o-h);this._w=(d-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>h){const p=2*Math.sqrt(1+o-i-h);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+h-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(bt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-i*c,this._z=s*d+a*c+i*l-r*o,this._w=a*d-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Zc=class Zc{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Au.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Au.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),d=2*(o*t-s*r),h=2*(s*i-a*t);return this.x=t+l*c+a*h-o*d,this.y=i+l*d+o*c-s*h,this.z=r+l*h+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=bt(this.x,e.x,t.x),this.y=bt(this.y,e.y,t.y),this.z=bt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=bt(this.x,e,t),this.y=bt(this.y,e,t),this.z=bt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(bt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Ya.copy(this).projectOnVector(e),this.sub(Ya)}reflect(e){return this.sub(Ya.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(bt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Zc.prototype.isVector3=!0;let ne=Zc;const Ya=new ne,Au=new Oi,$c=class $c{constructor(e,t,i,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],d=i[4],h=i[7],f=i[2],p=i[5],v=i[8],S=r[0],g=r[3],m=r[6],x=r[1],M=r[4],w=r[7],R=r[2],y=r[5],L=r[8];return s[0]=a*S+o*x+l*R,s[3]=a*g+o*M+l*y,s[6]=a*m+o*w+l*L,s[1]=c*S+d*x+h*R,s[4]=c*g+d*M+h*y,s[7]=c*m+d*w+h*L,s[2]=f*S+p*x+v*R,s[5]=f*g+p*M+v*y,s[8]=f*m+p*w+v*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*s*d+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],h=d*a-o*c,f=o*l-d*s,p=c*s-a*l,v=t*h+i*f+r*p;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/v;return e[0]=h*S,e[1]=(r*c-d*i)*S,e[2]=(o*i-r*a)*S,e[3]=f*S,e[4]=(d*t-r*l)*S,e[5]=(r*s-o*t)*S,e[6]=p*S,e[7]=(i*l-c*t)*S,e[8]=(a*t-i*s)*S,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(ja.makeScale(e,t)),this}rotate(e){return this.premultiply(ja.makeRotation(-e)),this}translate(e,t){return this.premultiply(ja.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};$c.prototype.isMatrix3=!0;let ft=$c;const ja=new ft,Ru=new ft().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Cu=new ft().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function jg(){const n={enabled:!0,workingColorSpace:cs,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Pt&&(r.r=pi(r.r),r.g=pi(r.g),r.b=pi(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Pt&&(r.r=Ir(r.r),r.g=Ir(r.g),r.b=Ir(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Pi?xa:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return yl("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return yl("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[cs]:{primaries:e,whitePoint:i,transfer:xa,toXYZ:Ru,fromXYZ:Cu,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Tn},outputColorSpaceConfig:{drawingBufferColorSpace:Tn}},[Tn]:{primaries:e,whitePoint:i,transfer:Pt,toXYZ:Ru,fromXYZ:Cu,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Tn}}}),n}const Et=jg();function pi(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ir(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let lr;class qg{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{lr===void 0&&(lr=ba("canvas")),lr.width=e.width,lr.height=e.height;const r=lr.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=lr}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=ba("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=pi(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(pi(t[i]/255)*255):t[i]=pi(t[i]);return{data:t,width:e.width,height:e.height}}else return ut("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Kg=0;class yc{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Kg++}),this.uuid=vs(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(qa(r[a].image)):s.push(qa(r[a]))}else s=qa(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function qa(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?qg.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(ut("Texture: Unable to serialize Texture."),{})}let Zg=0;const Ka=new ne;class dn extends ki{constructor(e=dn.DEFAULT_IMAGE,t=dn.DEFAULT_MAPPING,i=Vn,r=Vn,s=Zt,a=Li,o=Hn,l=wn,c=dn.DEFAULT_ANISOTROPY,d=Pi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Zg++}),this.uuid=vs(),this.name="",this.source=new yc(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new ht(0,0),this.repeat=new ht(1,1),this.center=new ht(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ft,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Ka).x}get height(){return this.source.getSize(Ka).y}get depth(){return this.source.getSize(Ka).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(i===void 0){ut(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ut(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Dh)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Go:e.x=e.x-Math.floor(e.x);break;case Vn:e.x=e.x<0?0:1;break;case Wo:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Go:e.y=e.y-Math.floor(e.y);break;case Vn:e.y=e.y<0?0:1;break;case Wo:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}dn.DEFAULT_IMAGE=null;dn.DEFAULT_MAPPING=Dh;dn.DEFAULT_ANISOTROPY=1;const Jc=class Jc{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],d=l[4],h=l[8],f=l[1],p=l[5],v=l[9],S=l[2],g=l[6],m=l[10];if(Math.abs(d-f)<.01&&Math.abs(h-S)<.01&&Math.abs(v-g)<.01){if(Math.abs(d+f)<.1&&Math.abs(h+S)<.1&&Math.abs(v+g)<.1&&Math.abs(c+p+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(c+1)/2,w=(p+1)/2,R=(m+1)/2,y=(d+f)/4,L=(h+S)/4,_=(v+g)/4;return M>w&&M>R?M<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(M),r=y/i,s=L/i):w>R?w<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(w),i=y/r,s=_/r):R<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),i=L/s,r=_/s),this.set(i,r,s,t),this}let x=Math.sqrt((g-v)*(g-v)+(h-S)*(h-S)+(f-d)*(f-d));return Math.abs(x)<.001&&(x=1),this.x=(g-v)/x,this.y=(h-S)/x,this.z=(f-d)/x,this.w=Math.acos((c+p+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=bt(this.x,e.x,t.x),this.y=bt(this.y,e.y,t.y),this.z=bt(this.z,e.z,t.z),this.w=bt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=bt(this.x,e,t),this.y=bt(this.y,e,t),this.z=bt(this.z,e,t),this.w=bt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(bt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Jc.prototype.isVector4=!0;let Wt=Jc;class $g extends ki{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Zt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new dn(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:Zt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new yc(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ei extends $g{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class kh extends dn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=on,this.minFilter=on,this.wrapR=Vn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Jg extends dn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=on,this.minFilter=on,this.wrapR=Vn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Ma=class Ma{constructor(e,t,i,r,s,a,o,l,c,d,h,f,p,v,S,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,d,h,f,p,v,S,g)}set(e,t,i,r,s,a,o,l,c,d,h,f,p,v,S,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=r,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=d,m[10]=h,m[14]=f,m[3]=p,m[7]=v,m[11]=S,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ma().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/cr.setFromMatrixColumn(e,0).length(),s=1/cr.setFromMatrixColumn(e,1).length(),a=1/cr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=a*d,p=a*h,v=o*d,S=o*h;t[0]=l*d,t[4]=-l*h,t[8]=c,t[1]=p+v*c,t[5]=f-S*c,t[9]=-o*l,t[2]=S-f*c,t[6]=v+p*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*d,p=l*h,v=c*d,S=c*h;t[0]=f+S*o,t[4]=v*o-p,t[8]=a*c,t[1]=a*h,t[5]=a*d,t[9]=-o,t[2]=p*o-v,t[6]=S+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*d,p=l*h,v=c*d,S=c*h;t[0]=f-S*o,t[4]=-a*h,t[8]=v+p*o,t[1]=p+v*o,t[5]=a*d,t[9]=S-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*d,p=a*h,v=o*d,S=o*h;t[0]=l*d,t[4]=v*c-p,t[8]=f*c+S,t[1]=l*h,t[5]=S*c+f,t[9]=p*c-v,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,p=a*c,v=o*l,S=o*c;t[0]=l*d,t[4]=S-f*h,t[8]=v*h+p,t[1]=h,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*h+v,t[10]=f-S*h}else if(e.order==="XZY"){const f=a*l,p=a*c,v=o*l,S=o*c;t[0]=l*d,t[4]=-h,t[8]=c*d,t[1]=f*h+S,t[5]=a*d,t[9]=p*h-v,t[2]=v*h-p,t[6]=o*d,t[10]=S*h+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Qg,e,ev)}lookAt(e,t,i){const r=this.elements;return Mn.subVectors(e,t),Mn.lengthSq()===0&&(Mn.z=1),Mn.normalize(),Mi.crossVectors(i,Mn),Mi.lengthSq()===0&&(Math.abs(i.z)===1?Mn.x+=1e-4:Mn.z+=1e-4,Mn.normalize(),Mi.crossVectors(i,Mn)),Mi.normalize(),ws.crossVectors(Mn,Mi),r[0]=Mi.x,r[4]=ws.x,r[8]=Mn.x,r[1]=Mi.y,r[5]=ws.y,r[9]=Mn.y,r[2]=Mi.z,r[6]=ws.z,r[10]=Mn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],d=i[1],h=i[5],f=i[9],p=i[13],v=i[2],S=i[6],g=i[10],m=i[14],x=i[3],M=i[7],w=i[11],R=i[15],y=r[0],L=r[4],_=r[8],E=r[12],I=r[1],P=r[5],z=r[9],W=r[13],H=r[2],N=r[6],D=r[10],V=r[14],B=r[3],K=r[7],G=r[11],te=r[15];return s[0]=a*y+o*I+l*H+c*B,s[4]=a*L+o*P+l*N+c*K,s[8]=a*_+o*z+l*D+c*G,s[12]=a*E+o*W+l*V+c*te,s[1]=d*y+h*I+f*H+p*B,s[5]=d*L+h*P+f*N+p*K,s[9]=d*_+h*z+f*D+p*G,s[13]=d*E+h*W+f*V+p*te,s[2]=v*y+S*I+g*H+m*B,s[6]=v*L+S*P+g*N+m*K,s[10]=v*_+S*z+g*D+m*G,s[14]=v*E+S*W+g*V+m*te,s[3]=x*y+M*I+w*H+R*B,s[7]=x*L+M*P+w*N+R*K,s[11]=x*_+M*z+w*D+R*G,s[15]=x*E+M*W+w*V+R*te,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],h=e[6],f=e[10],p=e[14],v=e[3],S=e[7],g=e[11],m=e[15],x=l*p-c*f,M=o*p-c*h,w=o*f-l*h,R=a*p-c*d,y=a*f-l*d,L=a*h-o*d;return t*(S*x-g*M+m*w)-i*(v*x-g*R+m*y)+r*(v*M-S*R+m*L)-s*(v*w-S*y+g*L)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],h=e[9],f=e[10],p=e[11],v=e[12],S=e[13],g=e[14],m=e[15],x=t*o-i*a,M=t*l-r*a,w=t*c-s*a,R=i*l-r*o,y=i*c-s*o,L=r*c-s*l,_=d*S-h*v,E=d*g-f*v,I=d*m-p*v,P=h*g-f*S,z=h*m-p*S,W=f*m-p*g,H=x*W-M*z+w*P+R*I-y*E+L*_;if(H===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/H;return e[0]=(o*W-l*z+c*P)*N,e[1]=(r*z-i*W-s*P)*N,e[2]=(S*L-g*y+m*R)*N,e[3]=(f*y-h*L-p*R)*N,e[4]=(l*I-a*W-c*E)*N,e[5]=(t*W-r*I+s*E)*N,e[6]=(g*w-v*L-m*M)*N,e[7]=(d*L-f*w+p*M)*N,e[8]=(a*z-o*I+c*_)*N,e[9]=(i*I-t*z-s*_)*N,e[10]=(v*y-S*w+m*x)*N,e[11]=(h*w-d*y-p*x)*N,e[12]=(o*E-a*P-l*_)*N,e[13]=(t*P-i*E+r*_)*N,e[14]=(S*M-v*R-g*x)*N,e[15]=(d*R-h*M+f*x)*N,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,d=a+a,h=o+o,f=s*c,p=s*d,v=s*h,S=a*d,g=a*h,m=o*h,x=l*c,M=l*d,w=l*h,R=i.x,y=i.y,L=i.z;return r[0]=(1-(S+m))*R,r[1]=(p+w)*R,r[2]=(v-M)*R,r[3]=0,r[4]=(p-w)*y,r[5]=(1-(f+m))*y,r[6]=(g+x)*y,r[7]=0,r[8]=(v+M)*L,r[9]=(g-x)*L,r[10]=(1-(f+S))*L,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=cr.set(r[0],r[1],r[2]).length();const o=cr.set(r[4],r[5],r[6]).length(),l=cr.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Fn.copy(this);const c=1/a,d=1/o,h=1/l;return Fn.elements[0]*=c,Fn.elements[1]*=c,Fn.elements[2]*=c,Fn.elements[4]*=d,Fn.elements[5]*=d,Fn.elements[6]*=d,Fn.elements[8]*=h,Fn.elements[9]*=h,Fn.elements[10]*=h,t.setFromRotationMatrix(Fn),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=Jn,l=!1){const c=this.elements,d=2*s/(t-e),h=2*s/(i-r),f=(t+e)/(t-e),p=(i+r)/(i-r);let v,S;if(l)v=s/(a-s),S=a*s/(a-s);else if(o===Jn)v=-(a+s)/(a-s),S=-2*a*s/(a-s);else if(o===us)v=-a/(a-s),S=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=h,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=S,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=Jn,l=!1){const c=this.elements,d=2/(t-e),h=2/(i-r),f=-(t+e)/(t-e),p=-(i+r)/(i-r);let v,S;if(l)v=1/(a-s),S=a/(a-s);else if(o===Jn)v=-2/(a-s),S=-(a+s)/(a-s);else if(o===us)v=-1/(a-s),S=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=h,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=v,c[14]=S,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};Ma.prototype.isMatrix4=!0;let Xt=Ma;const cr=new ne,Fn=new Xt,Qg=new ne(0,0,0),ev=new ne(1,1,1),Mi=new ne,ws=new ne,Mn=new ne,Pu=new Xt,Du=new Oi;class Bi{constructor(e=0,t=0,i=0,r=Bi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],d=r[9],h=r[2],f=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(bt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-bt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(bt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-bt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(bt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-bt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,p),this._y=0);break;default:ut("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Pu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Pu,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Du.setFromEuler(this),this.setFromQuaternion(Du,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Bi.DEFAULT_ORDER="XYZ";class Mc{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let tv=0;const Lu=new ne,ur=new Oi,ri=new Xt,As=new ne,Gr=new ne,nv=new ne,iv=new Oi,Iu=new ne(1,0,0),Nu=new ne(0,1,0),Uu=new ne(0,0,1),Fu={type:"added"},rv={type:"removed"},dr={type:"childadded",child:null},Za={type:"childremoved",child:null};class hn extends ki{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:tv++}),this.uuid=vs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=hn.DEFAULT_UP.clone();const e=new ne,t=new Bi,i=new Oi,r=new ne(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Xt},normalMatrix:{value:new ft}}),this.matrix=new Xt,this.matrixWorld=new Xt,this.matrixAutoUpdate=hn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Mc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ur.setFromAxisAngle(e,t),this.quaternion.multiply(ur),this}rotateOnWorldAxis(e,t){return ur.setFromAxisAngle(e,t),this.quaternion.premultiply(ur),this}rotateX(e){return this.rotateOnAxis(Iu,e)}rotateY(e){return this.rotateOnAxis(Nu,e)}rotateZ(e){return this.rotateOnAxis(Uu,e)}translateOnAxis(e,t){return Lu.copy(e).applyQuaternion(this.quaternion),this.position.add(Lu.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Iu,e)}translateY(e){return this.translateOnAxis(Nu,e)}translateZ(e){return this.translateOnAxis(Uu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ri.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?As.copy(e):As.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Gr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ri.lookAt(Gr,As,this.up):ri.lookAt(As,Gr,this.up),this.quaternion.setFromRotationMatrix(ri),r&&(ri.extractRotation(r.matrixWorld),ur.setFromRotationMatrix(ri),this.quaternion.premultiply(ur.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Mt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Fu),dr.child=e,this.dispatchEvent(dr),dr.child=null):Mt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rv),Za.child=e,this.dispatchEvent(Za),Za.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ri.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ri.multiply(e.parent.matrixWorld)),e.applyMatrix4(ri),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Fu),dr.child=e,this.dispatchEvent(dr),dr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,e,nv),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,iv,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),h=a(e.shapes),f=a(e.skeletons),p=a(e.animations),v=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),h.length>0&&(i.shapes=h),f.length>0&&(i.skeletons=f),p.length>0&&(i.animations=p),v.length>0&&(i.nodes=v)}return i.object=r,i;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}hn.DEFAULT_UP=new ne(0,1,0);hn.DEFAULT_MATRIX_AUTO_UPDATE=!0;hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let Rs=class extends hn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const sv={type:"move"};class $a{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Rs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Rs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ne,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ne),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Rs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ne,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ne,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const S of e.hand.values()){const g=t.getJointPose(S,i),m=this._getHandJoint(c,S);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const d=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=d.position.distanceTo(h.position),p=.02,v=.005;c.inputState.pinching&&f>p+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(sv)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Rs;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const Vh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ei={h:0,s:0,l:0},Cs={h:0,s:0,l:0};function Ja(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ot{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Tn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Et.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=Et.workingColorSpace){return this.r=e,this.g=t,this.b=i,Et.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=Et.workingColorSpace){if(e=Xg(e,1),t=bt(t,0,1),i=bt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Ja(a,s,e+1/3),this.g=Ja(a,s,e),this.b=Ja(a,s,e-1/3)}return Et.colorSpaceToWorking(this,r),this}setStyle(e,t=Tn){function i(s){s!==void 0&&parseFloat(s)<1&&ut("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ut("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);ut("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Tn){const i=Vh[e.toLowerCase()];return i!==void 0?this.setHex(i,t):ut("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=pi(e.r),this.g=pi(e.g),this.b=pi(e.b),this}copyLinearToSRGB(e){return this.r=Ir(e.r),this.g=Ir(e.g),this.b=Ir(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Tn){return Et.workingToColorSpace(un.copy(this),e),Math.round(bt(un.r*255,0,255))*65536+Math.round(bt(un.g*255,0,255))*256+Math.round(bt(un.b*255,0,255))}getHexString(e=Tn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Et.workingColorSpace){Et.workingToColorSpace(un.copy(this),t);const i=un.r,r=un.g,s=un.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=d<=.5?h/(a+o):h/(2-a-o),a){case i:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-i)/h+2;break;case s:l=(i-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=Et.workingColorSpace){return Et.workingToColorSpace(un.copy(this),t),e.r=un.r,e.g=un.g,e.b=un.b,e}getStyle(e=Tn){Et.workingToColorSpace(un.copy(this),e);const t=un.r,i=un.g,r=un.b;return e!==Tn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(Ei),this.setHSL(Ei.h+e,Ei.s+t,Ei.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Ei),e.getHSL(Cs);const i=Xa(Ei.h,Cs.h,t),r=Xa(Ei.s,Cs.s,t),s=Xa(Ei.l,Cs.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const un=new ot;ot.NAMES=Vh;class av extends hn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Bi,this.environmentIntensity=1,this.environmentRotation=new Bi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const On=new ne,si=new ne,Qa=new ne,ai=new ne,hr=new ne,fr=new ne,Ou=new ne,eo=new ne,to=new ne,no=new ne,io=new Wt,ro=new Wt,so=new Wt;class kn{constructor(e=new ne,t=new ne,i=new ne){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),On.subVectors(e,t),r.cross(On);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){On.subVectors(r,t),si.subVectors(i,t),Qa.subVectors(e,t);const a=On.dot(On),o=On.dot(si),l=On.dot(Qa),c=si.dot(si),d=si.dot(Qa),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const f=1/h,p=(c*l-o*d)*f,v=(a*d-o*l)*f;return s.set(1-p-v,v,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,ai)===null?!1:ai.x>=0&&ai.y>=0&&ai.x+ai.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,ai)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ai.x),l.addScaledVector(a,ai.y),l.addScaledVector(o,ai.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return io.setScalar(0),ro.setScalar(0),so.setScalar(0),io.fromBufferAttribute(e,t),ro.fromBufferAttribute(e,i),so.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(io,s.x),a.addScaledVector(ro,s.y),a.addScaledVector(so,s.z),a}static isFrontFacing(e,t,i,r){return On.subVectors(i,t),si.subVectors(e,t),On.cross(si).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return On.subVectors(this.c,this.b),si.subVectors(this.a,this.b),On.cross(si).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return kn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return kn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return kn.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return kn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return kn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;hr.subVectors(r,i),fr.subVectors(s,i),eo.subVectors(e,i);const l=hr.dot(eo),c=fr.dot(eo);if(l<=0&&c<=0)return t.copy(i);to.subVectors(e,r);const d=hr.dot(to),h=fr.dot(to);if(d>=0&&h<=d)return t.copy(r);const f=l*h-d*c;if(f<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(i).addScaledVector(hr,a);no.subVectors(e,s);const p=hr.dot(no),v=fr.dot(no);if(v>=0&&p<=v)return t.copy(s);const S=p*c-l*v;if(S<=0&&c>=0&&v<=0)return o=c/(c-v),t.copy(i).addScaledVector(fr,o);const g=d*v-p*h;if(g<=0&&h-d>=0&&p-v>=0)return Ou.subVectors(s,r),o=(h-d)/(h-d+(p-v)),t.copy(r).addScaledVector(Ou,o);const m=1/(g+S+f);return a=S*m,o=f*m,t.copy(i).addScaledVector(hr,a).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class _i{constructor(e=new ne(1/0,1/0,1/0),t=new ne(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Bn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Bn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Bn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Bn):Bn.fromBufferAttribute(s,a),Bn.applyMatrix4(e.matrixWorld),this.expandByPoint(Bn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ps.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Ps.copy(i.boundingBox)),Ps.applyMatrix4(e.matrixWorld),this.union(Ps)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Bn),Bn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Wr),Ds.subVectors(this.max,Wr),pr.subVectors(e.a,Wr),mr.subVectors(e.b,Wr),gr.subVectors(e.c,Wr),Ti.subVectors(mr,pr),wi.subVectors(gr,mr),Gi.subVectors(pr,gr);let t=[0,-Ti.z,Ti.y,0,-wi.z,wi.y,0,-Gi.z,Gi.y,Ti.z,0,-Ti.x,wi.z,0,-wi.x,Gi.z,0,-Gi.x,-Ti.y,Ti.x,0,-wi.y,wi.x,0,-Gi.y,Gi.x,0];return!ao(t,pr,mr,gr,Ds)||(t=[1,0,0,0,1,0,0,0,1],!ao(t,pr,mr,gr,Ds))?!1:(Ls.crossVectors(Ti,wi),t=[Ls.x,Ls.y,Ls.z],ao(t,pr,mr,gr,Ds))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Bn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Bn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(oi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),oi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),oi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),oi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),oi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),oi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),oi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),oi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(oi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const oi=[new ne,new ne,new ne,new ne,new ne,new ne,new ne,new ne],Bn=new ne,Ps=new _i,pr=new ne,mr=new ne,gr=new ne,Ti=new ne,wi=new ne,Gi=new ne,Wr=new ne,Ds=new ne,Ls=new ne,Wi=new ne;function ao(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){Wi.fromArray(n,s);const o=r.x*Math.abs(Wi.x)+r.y*Math.abs(Wi.y)+r.z*Math.abs(Wi.z),l=e.dot(Wi),c=t.dot(Wi),d=i.dot(Wi);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const di=ov();function ov(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function lv(n){Math.abs(n)>65504&&ut("DataUtils.toHalfFloat(): Value out of range."),n=bt(n,-65504,65504),di.floatView[0]=n;const e=di.uint32View[0],t=e>>23&511;return di.baseTable[t]+((e&8388607)>>di.shiftTable[t])}function cv(n){const e=n>>10;return di.uint32View[0]=di.mantissaTable[di.offsetTable[e]+(n&1023)]+di.exponentTable[e],di.floatView[0]}class Is{static toHalfFloat(e){return lv(e)}static fromHalfFloat(e){return cv(e)}}const Jt=new ne,Ns=new ht;let uv=0;class bn extends ki{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:uv++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Mu,this.updateRanges=[],this.gpuType=An,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Ns.fromBufferAttribute(this,t),Ns.applyMatrix3(e),this.setXY(t,Ns.x,Ns.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Jt.fromBufferAttribute(this,t),Jt.applyMatrix3(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Jt.fromBufferAttribute(this,t),Jt.applyMatrix4(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Jt.fromBufferAttribute(this,t),Jt.applyNormalMatrix(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Jt.fromBufferAttribute(this,t),Jt.transformDirection(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=Hr(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=gn(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Hr(t,this.array)),t}setX(e,t){return this.normalized&&(t=gn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Hr(t,this.array)),t}setY(e,t){return this.normalized&&(t=gn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Hr(t,this.array)),t}setZ(e,t){return this.normalized&&(t=gn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Hr(t,this.array)),t}setW(e,t){return this.normalized&&(t=gn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=gn(t,this.array),i=gn(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=gn(t,this.array),i=gn(i,this.array),r=gn(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=gn(t,this.array),i=gn(i,this.array),r=gn(r,this.array),s=gn(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Mu&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Hh extends bn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class Gh extends bn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class mi extends bn{constructor(e,t,i){super(new Float32Array(e),t,i)}}const dv=new _i,Xr=new ne,oo=new ne;class Ec{constructor(e=new ne,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):dv.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Xr.subVectors(e,this.center);const t=Xr.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Xr,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(oo.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xr.copy(e.center).add(oo)),this.expandByPoint(Xr.copy(e.center).sub(oo))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hv=0;const Pn=new Xt,lo=new hn,vr=new ne,En=new _i,Yr=new _i,nn=new ne;class Xn extends ki{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hv++}),this.uuid=vs(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Vg(e)?Gh:Hh)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new ft().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Pn.makeRotationFromQuaternion(e),this.applyMatrix4(Pn),this}rotateX(e){return Pn.makeRotationX(e),this.applyMatrix4(Pn),this}rotateY(e){return Pn.makeRotationY(e),this.applyMatrix4(Pn),this}rotateZ(e){return Pn.makeRotationZ(e),this.applyMatrix4(Pn),this}translate(e,t,i){return Pn.makeTranslation(e,t,i),this.applyMatrix4(Pn),this}scale(e,t,i){return Pn.makeScale(e,t,i),this.applyMatrix4(Pn),this}lookAt(e){return lo.lookAt(e),lo.updateMatrix(),this.applyMatrix4(lo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(vr).negate(),this.translate(vr.x,vr.y,vr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new mi(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&ut("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _i);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Mt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ne(-1/0,-1/0,-1/0),new ne(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];En.setFromBufferAttribute(s),this.morphTargetsRelative?(nn.addVectors(this.boundingBox.min,En.min),this.boundingBox.expandByPoint(nn),nn.addVectors(this.boundingBox.max,En.max),this.boundingBox.expandByPoint(nn)):(this.boundingBox.expandByPoint(En.min),this.boundingBox.expandByPoint(En.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Mt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ec);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Mt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ne,1/0);return}if(e){const i=this.boundingSphere.center;if(En.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Yr.setFromBufferAttribute(o),this.morphTargetsRelative?(nn.addVectors(En.min,Yr.min),En.expandByPoint(nn),nn.addVectors(En.max,Yr.max),En.expandByPoint(nn)):(En.expandByPoint(Yr.min),En.expandByPoint(Yr.max))}En.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)nn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(nn));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)nn.fromBufferAttribute(o,c),l&&(vr.fromBufferAttribute(e,c),nn.add(vr)),r=Math.max(r,i.distanceToSquared(nn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Mt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Mt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new bn(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let _=0;_<i.count;_++)o[_]=new ne,l[_]=new ne;const c=new ne,d=new ne,h=new ne,f=new ht,p=new ht,v=new ht,S=new ne,g=new ne;function m(_,E,I){c.fromBufferAttribute(i,_),d.fromBufferAttribute(i,E),h.fromBufferAttribute(i,I),f.fromBufferAttribute(s,_),p.fromBufferAttribute(s,E),v.fromBufferAttribute(s,I),d.sub(c),h.sub(c),p.sub(f),v.sub(f);const P=1/(p.x*v.y-v.x*p.y);isFinite(P)&&(S.copy(d).multiplyScalar(v.y).addScaledVector(h,-p.y).multiplyScalar(P),g.copy(h).multiplyScalar(p.x).addScaledVector(d,-v.x).multiplyScalar(P),o[_].add(S),o[E].add(S),o[I].add(S),l[_].add(g),l[E].add(g),l[I].add(g))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let _=0,E=x.length;_<E;++_){const I=x[_],P=I.start,z=I.count;for(let W=P,H=P+z;W<H;W+=3)m(e.getX(W+0),e.getX(W+1),e.getX(W+2))}const M=new ne,w=new ne,R=new ne,y=new ne;function L(_){R.fromBufferAttribute(r,_),y.copy(R);const E=o[_];M.copy(E),M.sub(R.multiplyScalar(R.dot(E))).normalize(),w.crossVectors(y,E);const P=w.dot(l[_])<0?-1:1;a.setXYZW(_,M.x,M.y,M.z,P)}for(let _=0,E=x.length;_<E;++_){const I=x[_],P=I.start,z=I.count;for(let W=P,H=P+z;W<H;W+=3)L(e.getX(W+0)),L(e.getX(W+1)),L(e.getX(W+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new bn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let f=0,p=i.count;f<p;f++)i.setXYZ(f,0,0,0);const r=new ne,s=new ne,a=new ne,o=new ne,l=new ne,c=new ne,d=new ne,h=new ne;if(e)for(let f=0,p=e.count;f<p;f+=3){const v=e.getX(f+0),S=e.getX(f+1),g=e.getX(f+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,S),a.fromBufferAttribute(t,g),d.subVectors(a,s),h.subVectors(r,s),d.cross(h),o.fromBufferAttribute(i,v),l.fromBufferAttribute(i,S),c.fromBufferAttribute(i,g),o.add(d),l.add(d),c.add(d),i.setXYZ(v,o.x,o.y,o.z),i.setXYZ(S,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let f=0,p=t.count;f<p;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),d.subVectors(a,s),h.subVectors(r,s),d.cross(h),i.setXYZ(f+0,d.x,d.y,d.z),i.setXYZ(f+1,d.x,d.y,d.z),i.setXYZ(f+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)nn.fromBufferAttribute(e,t),nn.normalize(),e.setXYZ(t,nn.x,nn.y,nn.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,h=o.normalized,f=new c.constructor(l.length*d);let p=0,v=0;for(let S=0,g=l.length;S<g;S++){o.isInterleavedBufferAttribute?p=l[S]*o.data.stride+o.offset:p=l[S]*d;for(let m=0;m<d;m++)f[v++]=c[p++]}return new bn(f,d,h)}if(this.index===null)return ut("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Xn,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,h=c.length;d<h;d++){const f=c[d],p=e(f,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let h=0,f=c.length;h<f;h++){const p=c[h];d.push(p.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],h=s[c];for(let f=0,p=h.length;f<p;f++)d.push(h[f].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let fv=0;class kr extends ki{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:fv++}),this.uuid=vs(),this.name="",this.type="Material",this.blending=Lr,this.side=Sn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=No,this.blendDst=Uo,this.blendEquation=ji,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ot(0,0,0),this.blendAlpha=0,this.depthFunc=Ur,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=yu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=or,this.stencilZFail=or,this.stencilZPass=or,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){ut(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ut(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Lr&&(i.blending=this.blending),this.side!==Sn&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==No&&(i.blendSrc=this.blendSrc),this.blendDst!==Uo&&(i.blendDst=this.blendDst),this.blendEquation!==ji&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Ur&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==yu&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==or&&(i.stencilFail=this.stencilFail),this.stencilZFail!==or&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==or&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const li=new ne,co=new ne,Us=new ne,Ai=new ne,uo=new ne,Fs=new ne,ho=new ne;class Tc{constructor(e=new ne,t=new ne(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,li)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=li.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(li.copy(this.origin).addScaledVector(this.direction,t),li.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){co.copy(e).add(t).multiplyScalar(.5),Us.copy(t).sub(e).normalize(),Ai.copy(this.origin).sub(co);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Us),o=Ai.dot(this.direction),l=-Ai.dot(Us),c=Ai.lengthSq(),d=Math.abs(1-a*a);let h,f,p,v;if(d>0)if(h=a*l-o,f=a*o-l,v=s*d,h>=0)if(f>=-v)if(f<=v){const S=1/d;h*=S,f*=S,p=h*(h+a*f+2*o)+f*(a*h+f+2*l)+c}else f=s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f<=-v?(h=Math.max(0,-(-a*s+o)),f=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c):f<=v?(h=0,f=Math.min(Math.max(-s,-l),s),p=f*(f+2*l)+c):(h=Math.max(0,-(a*s+o)),f=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c);else f=a>0?-s:s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(co).addScaledVector(Us,f),p}intersectSphere(e,t){li.subVectors(e.center,this.origin);const i=li.dot(this.direction),r=li.dot(li)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),d>=0?(s=(e.min.y-f.y)*d,a=(e.max.y-f.y)*d):(s=(e.max.y-f.y)*d,a=(e.min.y-f.y)*d),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),h>=0?(o=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(o=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,li)!==null}intersectTriangle(e,t,i,r,s){uo.subVectors(t,e),Fs.subVectors(i,e),ho.crossVectors(uo,Fs);let a=this.direction.dot(ho),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Ai.subVectors(this.origin,e);const l=o*this.direction.dot(Fs.crossVectors(Ai,Fs));if(l<0)return null;const c=o*this.direction.dot(uo.cross(Ai));if(c<0||l+c>a)return null;const d=-o*Ai.dot(ho);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Wh extends kr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=Eh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Bu=new Xt,Xi=new Tc,Os=new Ec,zu=new ne,Bs=new ne,zs=new ne,ks=new ne,fo=new ne,Vs=new ne,ku=new ne,Hs=new ne;class sn extends hn{constructor(e=new Xn,t=new Wh){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Vs.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],h=s[l];d!==0&&(fo.fromBufferAttribute(h,e),a?Vs.addScaledVector(fo,d):Vs.addScaledVector(fo.sub(t),d))}t.add(Vs)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Os.copy(i.boundingSphere),Os.applyMatrix4(s),Xi.copy(e.ray).recast(e.near),!(Os.containsPoint(Xi.origin)===!1&&(Xi.intersectSphere(Os,zu)===null||Xi.origin.distanceToSquared(zu)>(e.far-e.near)**2))&&(Bu.copy(s).invert(),Xi.copy(e.ray).applyMatrix4(Bu),!(i.boundingBox!==null&&Xi.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Xi)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,h=s.attributes.normal,f=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let v=0,S=f.length;v<S;v++){const g=f[v],m=a[g.materialIndex],x=Math.max(g.start,p.start),M=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let w=x,R=M;w<R;w+=3){const y=o.getX(w),L=o.getX(w+1),_=o.getX(w+2);r=Gs(this,m,e,i,c,d,h,y,L,_),r&&(r.faceIndex=Math.floor(w/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const v=Math.max(0,p.start),S=Math.min(o.count,p.start+p.count);for(let g=v,m=S;g<m;g+=3){const x=o.getX(g),M=o.getX(g+1),w=o.getX(g+2);r=Gs(this,a,e,i,c,d,h,x,M,w),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let v=0,S=f.length;v<S;v++){const g=f[v],m=a[g.materialIndex],x=Math.max(g.start,p.start),M=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let w=x,R=M;w<R;w+=3){const y=w,L=w+1,_=w+2;r=Gs(this,m,e,i,c,d,h,y,L,_),r&&(r.faceIndex=Math.floor(w/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const v=Math.max(0,p.start),S=Math.min(l.count,p.start+p.count);for(let g=v,m=S;g<m;g+=3){const x=g,M=g+1,w=g+2;r=Gs(this,a,e,i,c,d,h,x,M,w),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function pv(n,e,t,i,r,s,a,o){let l;if(e.side===xn?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===Sn,o),l===null)return null;Hs.copy(o),Hs.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(Hs);return c<t.near||c>t.far?null:{distance:c,point:Hs.clone(),object:n}}function Gs(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Bs),n.getVertexPosition(l,zs),n.getVertexPosition(c,ks);const d=pv(n,e,t,i,Bs,zs,ks,ku);if(d){const h=new ne;kn.getBarycoord(ku,Bs,zs,ks,h),r&&(d.uv=kn.getInterpolatedAttribute(r,o,l,c,h,new ht)),s&&(d.uv1=kn.getInterpolatedAttribute(s,o,l,c,h,new ht)),a&&(d.normal=kn.getInterpolatedAttribute(a,o,l,c,h,new ne),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new ne,materialIndex:0};kn.getNormal(Bs,zs,ks,f.normal),d.face=f,d.barycoord=h}return d}class Xh extends dn{constructor(e=null,t=1,i=1,r,s,a,o,l,c=on,d=on,h,f){super(null,a,o,l,c,d,r,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const po=new ne,mv=new ne,gv=new ft;class Ci{constructor(e=new ne(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=po.subVectors(i,t).cross(mv.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){const r=e.delta(po),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||gv.getNormalMatrix(e),r=this.coplanarPoint(po).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Yi=new Ec,vv=new ht(.5,.5),Ws=new ne;class wc{constructor(e=new Ci,t=new Ci,i=new Ci,r=new Ci,s=new Ci,a=new Ci){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Jn,i=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],h=s[5],f=s[6],p=s[7],v=s[8],S=s[9],g=s[10],m=s[11],x=s[12],M=s[13],w=s[14],R=s[15];if(r[0].setComponents(c-a,p-d,m-v,R-x).normalize(),r[1].setComponents(c+a,p+d,m+v,R+x).normalize(),r[2].setComponents(c+o,p+h,m+S,R+M).normalize(),r[3].setComponents(c-o,p-h,m-S,R-M).normalize(),i)r[4].setComponents(l,f,g,w).normalize(),r[5].setComponents(c-l,p-f,m-g,R-w).normalize();else if(r[4].setComponents(c-l,p-f,m-g,R-w).normalize(),t===Jn)r[5].setComponents(c+l,p+f,m+g,R+w).normalize();else if(t===us)r[5].setComponents(l,f,g,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Yi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Yi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Yi)}intersectsSprite(e){Yi.center.set(0,0,0);const t=vv.distanceTo(e.center);return Yi.radius=.7071067811865476+t,Yi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Yi)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Ws.x=r.normal.x>0?e.max.x:e.min.x,Ws.y=r.normal.y>0?e.max.y:e.min.y,Ws.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ws)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Yh extends dn{constructor(e=[],t=ir,i,r,s,a,o,l,c,d){super(e,t,i,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Or extends dn{constructor(e,t,i=ti,r,s,a,o=on,l=on,c,d=vi,h=1){if(d!==vi&&d!==Ki)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:h};super(f,r,s,a,o,l,d,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new yc(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class _v extends Or{constructor(e,t=ti,i=ir,r,s,a=on,o=on,l,c=vi){const d={width:e,height:e,depth:1},h=[d,d,d,d,d,d];super(e,e,t,i,r,s,a,o,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class jh extends dn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class _s extends Xn{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],h=[];let f=0,p=0;v("z","y","x",-1,-1,i,t,e,a,s,0),v("z","y","x",1,-1,i,t,-e,a,s,1),v("x","z","y",1,1,e,i,t,r,a,2),v("x","z","y",1,-1,e,i,-t,r,a,3),v("x","y","z",1,-1,e,t,i,r,s,4),v("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new mi(c,3)),this.setAttribute("normal",new mi(d,3)),this.setAttribute("uv",new mi(h,2));function v(S,g,m,x,M,w,R,y,L,_,E){const I=w/L,P=R/_,z=w/2,W=R/2,H=y/2,N=L+1,D=_+1;let V=0,B=0;const K=new ne;for(let G=0;G<D;G++){const te=G*P-W;for(let q=0;q<N;q++){const pe=q*I-z;K[S]=pe*x,K[g]=te*M,K[m]=H,c.push(K.x,K.y,K.z),K[S]=0,K[g]=0,K[m]=y>0?1:-1,d.push(K.x,K.y,K.z),h.push(q/L),h.push(1-G/_),V+=1}}for(let G=0;G<_;G++)for(let te=0;te<L;te++){const q=f+te+N*G,pe=f+te+N*(G+1),be=f+(te+1)+N*(G+1),ge=f+(te+1)+N*G;l.push(q,pe,ge),l.push(pe,be,ge),B+=6}o.addGroup(p,B,E),p+=B,f+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _s(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class xs extends Xn{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,h=e/o,f=t/l,p=[],v=[],S=[],g=[];for(let m=0;m<d;m++){const x=m*f-a;for(let M=0;M<c;M++){const w=M*h-s;v.push(w,-x,0),S.push(0,0,1),g.push(M/o),g.push(1-m/l)}}for(let m=0;m<l;m++)for(let x=0;x<o;x++){const M=x+c*m,w=x+c*(m+1),R=x+1+c*(m+1),y=x+1+c*m;p.push(M,w,y),p.push(w,R,y)}this.setIndex(p),this.setAttribute("position",new mi(v,3)),this.setAttribute("normal",new mi(S,3)),this.setAttribute("uv",new mi(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xs(e.width,e.height,e.widthSegments,e.heightSegments)}}function Br(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];if(Vu(r))r.isRenderTargetTexture?(ut("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(Vu(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function pn(n){const e={};for(let t=0;t<n.length;t++){const i=Br(n[t]);for(const r in i)e[r]=i[r]}return e}function Vu(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function xv(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function qh(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Et.workingColorSpace}const bv={clone:Br,merge:pn};var Sv=`void main() {
1
+ import"../chunks/DsnmJJEf.js";import{az as ap,am as op,aL as lp,ao as cp,ah as ha,a$ as up,af as u,a_ as U,ba as Ae,bk as F,bl as Rt,bh as rn,aQ as nt,ac as oe,aN as it,b7 as le,V as $,aK as Ut,aW as X,bm as dp,be as ye,bg as $i,aJ as vt,aP as zn,bf as hp,bi as jd,a8 as fp,a5 as lu,ab as cu}from"../chunks/DEk358l3.js";import{c as Ie,a as C,p as Un,f as Z,t as wt,d as pp}from"../chunks/DS1KfRtl.js";import{i as xe}from"../chunks/BnZOgasr.js";import{a as qd}from"../chunks/jO1WSR3P.js";import{o as Kt,s as De,e as Dt,d as Wn,a as mp,f as gp}from"../chunks/T-Nslbso.js";import{S as vp}from"../chunks/DeMiewtM.js";import{C as Kd,T as Js,a as _p,D as Zd,A as xp,U as bp}from"../chunks/C1kpvSgW.js";import{A as Sp,o as yp,D as $d,u as Mp,g as Ep,k as Tp}from"../chunks/CYyqq9B1.js";import{a as an,r as kl,e as Vt,g as Ht,j as At,c as fa,i as Jd,d as za,k as hi,l as wp}from"../chunks/6CzuHfQM.js";import{a as pt,p as _e,r as lt,c as We,b as Nn}from"../chunks/DCBLBrrW.js";import{p as uu}from"../chunks/D37hHIb0.js";import{a as Ea,o as Qd}from"../chunks/CsdWDH4Y.js";import{w as Qs,F as du}from"../chunks/B6yEy6Wb.js";import{c as eh}from"../chunks/C46MGZre.js";import{S as is}from"../chunks/C33A5aSj.js";import{S as pa}from"../chunks/DRNG0pfi.js";import{S as hu}from"../chunks/Bwn5lHBl.js";import{I as $t}from"../chunks/CeS0GhtF.js";import{X as Ap,R as Ar,D as Rr,c as Ji,b as rs,a as ss}from"../chunks/BeM-GIFh.js";import{s as Ct}from"../chunks/9DES--UJ.js";import{a as Gn,b as tr,c as ma,o as Rp,k as Vl,l as xi,h as dt,v as fn,w as Lo,n as Hl,S as Cp,j as Pp}from"../chunks/BTm-dDt9.js";import{c as In}from"../chunks/BIIXkPqf.js";import{B as mn}from"../chunks/CGKZc1Kf.js";import{C as th}from"../chunks/DZM0bVcB.js";import{C as zi,w as Fi,d as Dp,S as Lp,j as Ip,a as nh,b as ih,c as rh,A as sh,H as ah,E as oh,h as lh,n as fu}from"../chunks/xQ1SsCxk.js";import{i as Np,H as Up,o as ch,c as Fp,R as Op,b as Bp,S as zp,a as kp,C as Vp}from"../chunks/Cal8_SqL.js";import{h as Hp}from"../chunks/BJTJCSLB.js";import{b as Gp,c as Wp,a as Xp,T as Yp,d as jp}from"../chunks/BsKtJj5h.js";import{a as uh,C as Cr}from"../chunks/B1z9if9B.js";import{C as dh}from"../chunks/D1xkoVpc.js";import{C as qp,a as Kp}from"../chunks/CnXIg_dO.js";import{C as Zp}from"../chunks/BM8Ok6pJ.js";import{C as $p}from"../chunks/DRpLcVdK.js";import{L as Di}from"../chunks/Uv0-HWHq.js";import{I as Pr}from"../chunks/CDmA5ezP.js";import{t as Jp}from"../chunks/vyYztzrZ.js";import{r as Qp}from"../chunks/Cbu9Tg11.js";import{D as ka,U as pu}from"../chunks/CynIvqMH.js";const em=[];function Gl(n,e=!1,t=!1){return ea(n,new Map,"",em,null,t)}function ea(n,e,t,i,r=null,s=!1){if(typeof n=="object"&&n!==null){var a=e.get(n);if(a!==void 0)return a;if(n instanceof Map)return new Map(n);if(n instanceof Set)return new Set(n);if(ap(n)){var o=Array(n.length);e.set(n,o),r!==null&&e.set(r,o);for(var l=0;l<n.length;l+=1){var c=n[l];l in n&&(o[l]=ea(c,e,t,i,null,s))}return o}if(op(n)===lp){o={},e.set(n,o),r!==null&&e.set(r,o);for(var d of Object.keys(n))o[d]=ea(n[d],e,t,i,null,s);return o}if(n instanceof Date)return structuredClone(n);if(typeof n.toJSON=="function"&&!s)return ea(n.toJSON(),e,t,i,n)}if(n instanceof EventTarget)return n;try{return structuredClone(n)}catch{return n}}class tm{#e;#t;constructor(e){this.#e=e,this.#t=Symbol(e)}get key(){return this.#t}exists(){return cp(this.#t)}get(){const e=ha(this.#t);if(e===void 0)throw new Error(`Context "${this.#e}" not found`);return e}getOr(e){const t=ha(this.#t);return t===void 0?e:t}set(e){return up(this.#t,e)}}function nm(n,e){if(Np(n)){const i=n();return i===void 0?e:i}return n===void 0?e:n}function Ta(n,e){let t=Ae(null);const i=F(()=>nm(e,250));function r(...s){if(u(t))u(t).timeout&&clearTimeout(u(t).timeout);else{let a,o;const l=new Promise((c,d)=>{a=c,o=d});U(t,{timeout:null,runner:null,promise:l,resolve:a,reject:o},!0)}return u(t).runner=async()=>{if(!u(t))return;const a=u(t);U(t,null);try{a.resolve(await n.apply(this,s))}catch(o){a.reject(o)}},u(t).timeout=setTimeout(u(t).runner,u(i)),u(t).promise}return r.cancel=async()=>{(!u(t)||u(t).timeout===null)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||u(t).timeout===null)||(clearTimeout(u(t).timeout),u(t).reject("Cancelled"),U(t,null))},r.runScheduledNow=async()=>{(!u(t)||!u(t).timeout)&&(await new Promise(s=>setTimeout(s,0)),!u(t)||!u(t).timeout)||(clearTimeout(u(t).timeout),u(t).timeout=null,await u(t).runner?.())},Object.defineProperty(r,"pending",{enumerable:!0,get(){return!!u(t)?.timeout}}),r}class Wl{#e=Ae(!1);constructor(){Rt(()=>(rn(()=>U(this.#e,!0)),()=>{U(this.#e,!1)}))}get current(){return u(this.#e)}}const im=Vl({component:"checkbox",parts:["root","group","group-label","input"]}),rm=new zi("Checkbox.Group"),hh=new zi("Checkbox.Root");class Xl{static create(e,t=null){return hh.set(new Xl(e,t))}opts;group;#e=F(()=>this.group&&this.group.opts.name.current?this.group.opts.name.current:this.opts.name.current);get trueName(){return u(this.#e)}set trueName(e){U(this.#e,e)}#t=F(()=>this.group&&this.group.opts.required.current?!0:this.opts.required.current);get trueRequired(){return u(this.#t)}set trueRequired(e){U(this.#t,e)}#n=F(()=>this.group&&this.group.opts.disabled.current?!0:this.opts.disabled.current);get trueDisabled(){return u(this.#n)}set trueDisabled(e){U(this.#n,e)}#i=F(()=>this.group&&this.group.opts.readonly.current?!0:this.opts.readonly.current);get trueReadonly(){return u(this.#i)}set trueReadonly(e){U(this.#i,e)}attachment;constructor(e,t){this.opts=e,this.group=t,this.attachment=Gn(this.opts.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this),Fi.pre([()=>Gl(this.group?.opts.value.current),()=>this.opts.value.current],([i,r])=>{!i||!r||(this.opts.checked.current=i.includes(r))}),Fi.pre(()=>this.opts.checked.current,i=>{this.group&&(i?this.group?.addValue(this.opts.value.current):this.group?.removeValue(this.opts.value.current))})}onkeydown(e){if(!(this.trueDisabled||this.trueReadonly)){if(e.key===Dp){e.preventDefault(),this.opts.type.current==="submit"&&e.currentTarget.closest("form")?.requestSubmit();return}e.key===Lp&&(e.preventDefault(),this.#r())}}#r(){this.opts.indeterminate.current?(this.opts.indeterminate.current=!1,this.opts.checked.current=!0):this.opts.checked.current=!this.opts.checked.current}onclick(e){if(!(this.trueDisabled||this.trueReadonly)){if(this.opts.type.current==="submit"){this.#r();return}e.preventDefault(),this.#r()}}#s=F(()=>({checked:this.opts.checked.current,indeterminate:this.opts.indeterminate.current}));get snippetProps(){return u(this.#s)}set snippetProps(e){U(this.#s,e)}#a=F(()=>({id:this.opts.id.current,role:"checkbox",type:this.opts.type.current,disabled:this.trueDisabled,"aria-checked":Rp(this.opts.checked.current,this.opts.indeterminate.current),"aria-required":ma(this.trueRequired),"aria-readonly":ma(this.trueReadonly),"data-disabled":tr(this.trueDisabled),"data-readonly":tr(this.trueReadonly),"data-state":sm(this.opts.checked.current,this.opts.indeterminate.current),[im.root]:"",onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return u(this.#a)}set props(e){U(this.#a,e)}}class Yl{static create(){return new Yl(hh.get())}root;#e=F(()=>this.root.group?!!(this.root.opts.value.current!==void 0&&this.root.group.opts.value.current.includes(this.root.opts.value.current)):this.root.opts.checked.current);get trueChecked(){return u(this.#e)}set trueChecked(e){U(this.#e,e)}#t=F(()=>!!this.root.trueName);get shouldRender(){return u(this.#t)}set shouldRender(e){U(this.#t,e)}constructor(e){this.root=e,this.onfocus=this.onfocus.bind(this)}onfocus(e){Ip(this.root.opts.ref.current)&&this.root.opts.ref.current.focus()}#n=F(()=>({type:"checkbox",checked:this.root.opts.checked.current===!0,disabled:this.root.trueDisabled,required:this.root.trueRequired,name:this.root.trueName,value:this.root.opts.value.current,readonly:this.root.trueReadonly,onfocus:this.onfocus}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}}function sm(n,e){return e?"indeterminate":n?"checked":"unchecked"}function am(n,e){nt(e,!0);const t=Yl.create();var i=Ie(),r=oe(i);{var s=a=>{Up(a,pt(()=>t.props))};xe(r,a=>{t.shouldRender&&a(s)})}C(n,i),it()}var om=Z("<button><!></button>"),lm=Z("<!> <!>",1);function cm(n,e){const t=Un();nt(e,!0);let i=_e(e,"checked",15,!1),r=_e(e,"ref",15,null),s=_e(e,"disabled",3,!1),a=_e(e,"required",3,!1),o=_e(e,"name",3,void 0),l=_e(e,"value",3,"on"),c=_e(e,"id",19,()=>xi(t)),d=_e(e,"indeterminate",15,!1),h=_e(e,"type",3,"button"),f=lt(e,["$$slots","$$events","$$legacy","checked","ref","onCheckedChange","children","disabled","required","name","value","id","indeterminate","onIndeterminateChange","child","type","readonly"]);const p=rm.getOr(null);p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1)),Fi.pre(()=>l(),()=>{p&&l()&&(p.opts.value.current.includes(l())?i(!0):i(!1))});const v=Xl.create({checked:dt(()=>i(),R=>{i(R),e.onCheckedChange?.(R)}),disabled:dt(()=>s()??!1),required:dt(()=>a()),name:dt(()=>o()),value:dt(()=>l()),id:dt(()=>c()),ref:dt(()=>r(),R=>r(R)),indeterminate:dt(()=>d(),R=>{d(R),e.onIndeterminateChange?.(R)}),type:dt(()=>h()),readonly:dt(()=>!!e.readonly)},p),S=F(()=>fn({...f},v.props));var g=lm(),m=oe(g);{var x=R=>{var y=Ie(),L=oe(y);{let _=F(()=>({props:u(S),...v.snippetProps}));Ct(L,()=>e.child,()=>u(_))}C(R,y)},M=R=>{var y=om();an(y,()=>({...u(S)}));var L=$(y);Ct(L,()=>e.children??Ut,()=>v.snippetProps),X(y),C(R,y)};xe(m,R=>{e.child?R(x):R(M,-1)})}var w=le(m,2);am(w,{}),C(n,g),it()}class nr{#e;#t;constructor(e,t){this.#e=e,this.#t=t,this.handler=this.handler.bind(this),Rt(this.handler)}handler(){let e=0;const t=this.#e();if(!t)return;const i=new ResizeObserver(()=>{cancelAnimationFrame(e),e=window.requestAnimationFrame(this.#t)});return i.observe(t),()=>{window.cancelAnimationFrame(e),i.unobserve(t)}}}class um{opts;present;#e;#t=Ae(!1);#n=!1;#i=Ae(void 0);#r=null;constructor(e){this.opts=e,this.present=this.opts.open,U(this.#t,e.open.current,!0),this.#e=new Sp({ref:this.opts.ref,afterTick:this.opts.open}),yp(()=>this.#a()),Fi(()=>this.present.current,t=>{if(!this.#n){this.#n=!0;return}this.#a(),t&&U(this.#t,!0),U(this.#i,t?"starting":"ending",!0),t&&(this.#r=window.requestAnimationFrame(()=>{this.#r=null,this.present.current&&U(this.#i,void 0)})),this.#e.run(()=>{t===this.present.current&&(t||U(this.#t,!1),U(this.#i,void 0))})})}#s=F(()=>u(this.#t));get isPresent(){return u(this.#s)}set isPresent(e){U(this.#s,e)}get transitionStatus(){return u(this.#i)}#a(){this.#r!==null&&(window.cancelAnimationFrame(this.#r),this.#r=null)}}function wa(n,e){nt(e,!0);const t=new um({open:dt(()=>e.open),ref:e.ref});var i=Ie(),r=oe(i);{var s=a=>{var o=Ie(),l=oe(o);Ct(l,()=>e.presence??Ut,()=>({present:t.isPresent,transitionStatus:t.transitionStatus})),C(a,o)};xe(r,a=>{(e.forceMount||e.open||t.isPresent)&&a(s)})}C(n,i),it()}function dm(n,e,t){return Math.min(t,Math.max(e,n))}class hm{state;#e;constructor(e,t){this.state=Lo(e),this.#e=t,this.dispatch=this.dispatch.bind(this)}#t(e){return this.#e[this.state.current][e]??this.state.current}dispatch(e){this.state.current=this.#t(e)}}const ps=Vl({component:"scroll-area",parts:["root","viewport","corner","thumb","scrollbar"]}),ms=new zi("ScrollArea.Root"),gs=new zi("ScrollArea.Scrollbar"),Aa=new zi("ScrollArea.ScrollbarVisible"),jl=new zi("ScrollArea.ScrollbarAxis"),fh=new zi("ScrollArea.ScrollbarShared");class ql{static create(e){return ms.set(new ql(e))}opts;attachment;#e=Ae(null);get scrollAreaNode(){return u(this.#e)}set scrollAreaNode(e){U(this.#e,e,!0)}#t=Ae(null);get viewportNode(){return u(this.#t)}set viewportNode(e){U(this.#t,e,!0)}#n=Ae(null);get contentNode(){return u(this.#n)}set contentNode(e){U(this.#n,e,!0)}#i=Ae(null);get scrollbarXNode(){return u(this.#i)}set scrollbarXNode(e){U(this.#i,e,!0)}#r=Ae(null);get scrollbarYNode(){return u(this.#r)}set scrollbarYNode(e){U(this.#r,e,!0)}#s=Ae(0);get cornerWidth(){return u(this.#s)}set cornerWidth(e){U(this.#s,e,!0)}#a=Ae(0);get cornerHeight(){return u(this.#a)}set cornerHeight(e){U(this.#a,e,!0)}#o=Ae(!1);get scrollbarXEnabled(){return u(this.#o)}set scrollbarXEnabled(e){U(this.#o,e,!0)}#l=Ae(!1);get scrollbarYEnabled(){return u(this.#l)}set scrollbarYEnabled(e){U(this.#l,e,!0)}domContext;constructor(e){this.opts=e,this.attachment=Gn(e.ref,t=>this.scrollAreaNode=t),this.domContext=new $d(e.ref)}#c=F(()=>({id:this.opts.id.current,dir:this.opts.dir.current,style:{position:"relative","--bits-scroll-area-corner-height":`${this.cornerHeight}px`,"--bits-scroll-area-corner-width":`${this.cornerWidth}px`},[ps.root]:"",...this.attachment}));get props(){return u(this.#c)}set props(e){U(this.#c,e)}}class Kl{static create(e){return new Kl(e,ms.get())}opts;root;attachment;#e=Lo(Mp());#t=Lo(null);contentAttachment=Gn(this.#t,e=>this.root.contentNode=e);constructor(e,t){this.opts=e,this.root=t,this.attachment=Gn(e.ref,i=>this.root.viewportNode=i)}#n=F(()=>({id:this.opts.id.current,style:{overflowX:this.root.scrollbarXEnabled?"scroll":"hidden",overflowY:this.root.scrollbarYEnabled?"scroll":"hidden"},[ps.viewport]:"",...this.attachment}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}#i=F(()=>({id:this.#e.current,"data-scroll-area-content":"",style:{minWidth:this.root.scrollbarXEnabled?"fit-content":void 0},...this.contentAttachment}));get contentProps(){return u(this.#i)}set contentProps(e){U(this.#i,e)}}class Zl{static create(e){return gs.set(new Zl(e,ms.get()))}opts;root;#e=F(()=>this.opts.orientation.current==="horizontal");get isHorizontal(){return u(this.#e)}set isHorizontal(e){U(this.#e,e)}#t=Ae(!1);get hasThumb(){return u(this.#t)}set hasThumb(e){U(this.#t,e,!0)}constructor(e,t){this.opts=e,this.root=t,Fi(()=>this.isHorizontal,i=>i?(this.root.scrollbarXEnabled=!0,()=>{this.root.scrollbarXEnabled=!1}):(this.root.scrollbarYEnabled=!0,()=>{this.root.scrollbarYEnabled=!1}))}}class $l{static create(){return new $l(gs.get())}scrollbar;root;#e=Ae(!1);get isVisible(){return u(this.#e)}set isVisible(e){U(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Rt(()=>{const t=this.root.scrollAreaNode,i=this.root.opts.scrollHideDelay.current;let r=0;if(!t)return;const s=()=>{this.root.domContext.clearTimeout(r),rn(()=>this.isVisible=!0)},a=()=>{r&&this.root.domContext.clearTimeout(r),r=this.root.domContext.setTimeout(()=>{rn(()=>{this.scrollbar.hasThumb=!1,this.isVisible=!1})},i)},o=Hl(Kt(t,"pointerenter",s),Kt(t,"pointerleave",a));return()=>{this.root.domContext.getWindow().clearTimeout(r),o()}})}#t=F(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){U(this.#t,e)}}class Jl{static create(){return new Jl(gs.get())}scrollbar;root;machine=new hm("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});#e=F(()=>this.machine.state.current==="hidden");get isHidden(){return u(this.#e)}set isHidden(e){U(this.#e,e)}constructor(e){this.scrollbar=e,this.root=e.root;const t=Ta(()=>this.machine.dispatch("SCROLL_END"),100);Rt(()=>{const i=this.machine.state.current,r=this.root.opts.scrollHideDelay.current;if(i==="idle"){const s=this.root.domContext.setTimeout(()=>this.machine.dispatch("HIDE"),r);return()=>this.root.domContext.clearTimeout(s)}}),Rt(()=>{const i=this.root.viewportNode;if(!i)return;const r=this.scrollbar.isHorizontal?"scrollLeft":"scrollTop";let s=i[r];return Kt(i,"scroll",()=>{const l=i[r];s!==l&&(this.machine.dispatch("SCROLL"),t()),s=l})}),this.onpointerenter=this.onpointerenter.bind(this),this.onpointerleave=this.onpointerleave.bind(this)}onpointerenter(e){this.machine.dispatch("POINTER_ENTER")}onpointerleave(e){this.machine.dispatch("POINTER_LEAVE")}#t=F(()=>({"data-state":this.machine.state.current==="hidden"?"hidden":"visible",onpointerenter:this.onpointerenter,onpointerleave:this.onpointerleave}));get props(){return u(this.#t)}set props(e){U(this.#t,e)}}class Ra{static create(){return new Ra(gs.get())}scrollbar;root;#e=Ae(!1);get isVisible(){return u(this.#e)}set isVisible(e){U(this.#e,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root;const t=Ta(()=>{const i=this.root.viewportNode;if(!i)return;const r=i.offsetWidth<i.scrollWidth,s=i.offsetHeight<i.scrollHeight;this.isVisible=this.scrollbar.isHorizontal?r:s},10);new nr(()=>this.root.viewportNode,t),new nr(()=>this.root.contentNode,t)}#t=F(()=>({"data-state":this.isVisible?"visible":"hidden"}));get props(){return u(this.#t)}set props(e){U(this.#t,e)}}class Ql{static create(){return Aa.set(new Ql(gs.get()))}scrollbar;root;#e=Ae(null);get thumbNode(){return u(this.#e)}set thumbNode(e){U(this.#e,e,!0)}#t=Ae(0);get pointerOffset(){return u(this.#t)}set pointerOffset(e){U(this.#t,e,!0)}#n=Ae({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}});get sizes(){return u(this.#n)}set sizes(e){U(this.#n,e)}#i=F(()=>ph(this.sizes.viewport,this.sizes.content));get thumbRatio(){return u(this.#i)}set thumbRatio(e){U(this.#i,e)}#r=F(()=>this.thumbRatio>0&&this.thumbRatio<1);get hasThumb(){return u(this.#r)}set hasThumb(e){U(this.#r,e)}#s=Ae("");get prevTransformStyle(){return u(this.#s)}set prevTransformStyle(e){U(this.#s,e,!0)}constructor(e){this.scrollbar=e,this.root=e.root,Rt(()=>{this.scrollbar.hasThumb=this.hasThumb}),Rt(()=>{!this.scrollbar.hasThumb&&this.thumbNode&&(this.prevTransformStyle=this.thumbNode.style.transform)})}setSizes(e){this.sizes=e}getScrollPosition(e,t){return fm({pointerPos:e,pointerOffset:this.pointerOffset,sizes:this.sizes,dir:t})}onThumbPointerUp(){this.pointerOffset=0}onThumbPointerDown(e){this.pointerOffset=e}xOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollLeft,i=`translate3d(${mu({scrollPos:e,sizes:this.sizes,dir:this.root.opts.dir.current})}px, 0, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}xOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=e)}xOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollLeft=this.getScrollPosition(e,this.root.opts.dir.current))}yOnThumbPositionChange(){if(!(this.root.viewportNode&&this.thumbNode))return;const e=this.root.viewportNode.scrollTop,i=`translate3d(0, ${mu({scrollPos:e,sizes:this.sizes})}px, 0)`;this.thumbNode.style.transform=i,this.prevTransformStyle=i}yOnWheelScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=e)}yOnDragScroll(e){this.root.viewportNode&&(this.root.viewportNode.scrollTop=this.getScrollPosition(e,this.root.opts.dir.current))}}class ec{static create(e){return jl.set(new ec(e,Aa.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Ae();get computedStyle(){return u(this.#e)}set computedStyle(e){U(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=Gn(this.scrollbar.opts.ref,i=>this.root.scrollbarXNode=i),Rt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Rt(()=>{this.onResize()})}onThumbPointerDown=e=>{this.scrollbarVis.onThumbPointerDown(e.x)};onDragScroll=e=>{this.scrollbarVis.xOnDragScroll(e.x)};onThumbPointerUp=()=>{this.scrollbarVis.onThumbPointerUp()};onThumbPositionChange=()=>{this.scrollbarVis.xOnThumbPositionChange()};onWheelScroll=(e,t)=>{if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollLeft+e.deltaX;this.scrollbarVis.xOnWheelScroll(i),gh(i,t)&&e.preventDefault()};onResize=()=>{this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollWidth,viewport:this.root.viewportNode.offsetWidth,scrollbar:{size:this.scrollbar.opts.ref.current.clientWidth,paddingStart:ga(this.computedStyle.paddingLeft),paddingEnd:ga(this.computedStyle.paddingRight)}})};#t=F(()=>Ca(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){U(this.#t,e)}#n=F(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"horizontal",style:{bottom:0,left:this.root.opts.dir.current==="rtl"?"var(--bits-scroll-area-corner-width)":0,right:this.root.opts.dir.current==="ltr"?"var(--bits-scroll-area-corner-width)":0,"--bits-scroll-area-thumb-width":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}}class tc{static create(e){return jl.set(new tc(e,Aa.get()))}opts;scrollbarVis;root;scrollbar;attachment;#e=Ae();get computedStyle(){return u(this.#e)}set computedStyle(e){U(this.#e,e,!0)}constructor(e,t){this.opts=e,this.scrollbarVis=t,this.root=t.root,this.scrollbar=t.scrollbar,this.attachment=Gn(this.scrollbar.opts.ref,i=>this.root.scrollbarYNode=i),Rt(()=>{this.scrollbar.opts.ref.current&&this.opts.mounted.current&&(this.computedStyle=getComputedStyle(this.scrollbar.opts.ref.current))}),Rt(()=>{this.onResize()}),this.onThumbPointerDown=this.onThumbPointerDown.bind(this),this.onDragScroll=this.onDragScroll.bind(this),this.onThumbPointerUp=this.onThumbPointerUp.bind(this),this.onThumbPositionChange=this.onThumbPositionChange.bind(this),this.onWheelScroll=this.onWheelScroll.bind(this),this.onResize=this.onResize.bind(this)}onThumbPointerDown(e){this.scrollbarVis.onThumbPointerDown(e.y)}onDragScroll(e){this.scrollbarVis.yOnDragScroll(e.y)}onThumbPointerUp(){this.scrollbarVis.onThumbPointerUp()}onThumbPositionChange(){this.scrollbarVis.yOnThumbPositionChange()}onWheelScroll(e,t){if(!this.root.viewportNode)return;const i=this.root.viewportNode.scrollTop+e.deltaY;this.scrollbarVis.yOnWheelScroll(i),gh(i,t)&&e.preventDefault()}onResize(){this.scrollbar.opts.ref.current&&this.root.viewportNode&&this.computedStyle&&this.scrollbarVis.setSizes({content:this.root.viewportNode.scrollHeight,viewport:this.root.viewportNode.offsetHeight,scrollbar:{size:this.scrollbar.opts.ref.current.clientHeight,paddingStart:ga(this.computedStyle.paddingTop),paddingEnd:ga(this.computedStyle.paddingBottom)}})}#t=F(()=>Ca(this.scrollbarVis.sizes));get thumbSize(){return u(this.#t)}set thumbSize(e){U(this.#t,e)}#n=F(()=>({id:this.scrollbar.opts.id.current,"data-orientation":"vertical",style:{top:0,right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:"var(--bits-scroll-area-corner-height)","--bits-scroll-area-thumb-height":`${this.thumbSize}px`},...this.attachment}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}}class nc{static create(){return fh.set(new nc(jl.get()))}scrollbarState;root;scrollbarVis;scrollbar;#e=Ae(null);get rect(){return u(this.#e)}set rect(e){U(this.#e,e)}#t=Ae("");get prevWebkitUserSelect(){return u(this.#t)}set prevWebkitUserSelect(e){U(this.#t,e,!0)}handleResize;handleThumbPositionChange;handleWheelScroll;handleThumbPointerDown;handleThumbPointerUp;#n=F(()=>this.scrollbarVis.sizes.content-this.scrollbarVis.sizes.viewport);get maxScrollPos(){return u(this.#n)}set maxScrollPos(e){U(this.#n,e)}constructor(e){this.scrollbarState=e,this.root=e.root,this.scrollbarVis=e.scrollbarVis,this.scrollbar=e.scrollbarVis.scrollbar,this.handleResize=Ta(()=>this.scrollbarState.onResize(),10),this.handleThumbPositionChange=this.scrollbarState.onThumbPositionChange,this.handleWheelScroll=this.scrollbarState.onWheelScroll,this.handleThumbPointerDown=this.scrollbarState.onThumbPointerDown,this.handleThumbPointerUp=this.scrollbarState.onThumbPointerUp,Rt(()=>{const t=this.maxScrollPos,i=this.scrollbar.opts.ref.current;this.root.viewportNode;const r=a=>{const o=a.target;i?.contains(o)&&this.handleWheelScroll(a,t)};return Kt(this.root.domContext.getDocument(),"wheel",r,{passive:!1})}),dp(()=>{this.scrollbarVis.sizes,rn(()=>this.handleThumbPositionChange())}),new nr(()=>this.scrollbar.opts.ref.current,this.handleResize),new nr(()=>this.root.contentNode,this.handleResize),this.onpointerdown=this.onpointerdown.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onpointerup=this.onpointerup.bind(this),this.onlostpointercapture=this.onlostpointercapture.bind(this)}handleDragScroll(e){if(!this.rect)return;const t=e.clientX-this.rect.left,i=e.clientY-this.rect.top;this.scrollbarState.onDragScroll({x:t,y:i})}#i(){this.rect!==null&&(this.root.domContext.getDocument().body.style.webkitUserSelect=this.prevWebkitUserSelect,this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior=""),this.rect=null)}onpointerdown(e){if(e.button!==0)return;e.target.setPointerCapture(e.pointerId),this.rect=this.scrollbar.opts.ref.current?.getBoundingClientRect()??null,this.prevWebkitUserSelect=this.root.domContext.getDocument().body.style.webkitUserSelect,this.root.domContext.getDocument().body.style.webkitUserSelect="none",this.root.viewportNode&&(this.root.viewportNode.style.scrollBehavior="auto"),this.handleDragScroll(e)}onpointermove(e){this.handleDragScroll(e)}onpointerup(e){const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),this.#i()}onlostpointercapture(e){this.#i()}#r=F(()=>fn({...this.scrollbarState.props,style:{position:"absolute",...this.scrollbarState.props.style},[ps.scrollbar]:"",onpointerdown:this.onpointerdown,onpointermove:this.onpointermove,onpointerup:this.onpointerup,onlostpointercapture:this.onlostpointercapture}));get props(){return u(this.#r)}set props(e){U(this.#r,e)}}class ic{static create(e){return new ic(e,fh.get())}opts;scrollbarState;attachment;#e;#t=Ae();#n=Ta(()=>{u(this.#t)&&(u(this.#t)(),U(this.#t,void 0))},100);constructor(e,t){this.opts=e,this.scrollbarState=t,this.#e=t.root,this.attachment=Gn(this.opts.ref,i=>this.scrollbarState.scrollbarVis.thumbNode=i),Rt(()=>{const i=this.#e.viewportNode;if(!i)return;const r=()=>{if(this.#n(),!u(this.#t)){const a=pm(i,this.scrollbarState.handleThumbPositionChange);U(this.#t,a,!0),this.scrollbarState.handleThumbPositionChange()}};return rn(()=>this.scrollbarState.handleThumbPositionChange()),Kt(i,"scroll",r)}),this.onpointerdowncapture=this.onpointerdowncapture.bind(this),this.onpointerup=this.onpointerup.bind(this)}onpointerdowncapture(e){const t=e.target;if(!t)return;const i=t.getBoundingClientRect(),r=e.clientX-i.left,s=e.clientY-i.top;this.scrollbarState.handleThumbPointerDown({x:r,y:s})}onpointerup(e){this.scrollbarState.handleThumbPointerUp()}#i=F(()=>({id:this.opts.id.current,"data-state":this.scrollbarState.scrollbarVis.hasThumb?"visible":"hidden",style:{width:"var(--bits-scroll-area-thumb-width)",height:"var(--bits-scroll-area-thumb-height)",transform:this.scrollbarState.scrollbarVis.prevTransformStyle},onpointerdowncapture:this.onpointerdowncapture,onpointerup:this.onpointerup,[ps.thumb]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){U(this.#i,e)}}class rc{static create(e){return new rc(e,ms.get())}opts;root;attachment;#e=Ae(0);#t=Ae(0);#n=F(()=>!!(u(this.#e)&&u(this.#t)));get hasSize(){return u(this.#n)}set hasSize(e){U(this.#n,e)}constructor(e,t){this.opts=e,this.root=t,this.attachment=Gn(this.opts.ref),new nr(()=>this.root.scrollbarXNode,()=>{const i=this.root.scrollbarXNode?.offsetHeight||0;this.root.cornerHeight=i,U(this.#t,i,!0)}),new nr(()=>this.root.scrollbarYNode,()=>{const i=this.root.scrollbarYNode?.offsetWidth||0;this.root.cornerWidth=i,U(this.#e,i,!0)})}#i=F(()=>({id:this.opts.id.current,style:{width:u(this.#e),height:u(this.#t),position:"absolute",right:this.root.opts.dir.current==="ltr"?0:void 0,left:this.root.opts.dir.current==="rtl"?0:void 0,bottom:0},[ps.corner]:"",...this.attachment}));get props(){return u(this.#i)}set props(e){U(this.#i,e)}}function ga(n){return n?Number.parseInt(n,10):0}function ph(n,e){const t=n/e;return Number.isNaN(t)?0:t}function Ca(n){const e=ph(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-t)*e;return Math.max(i,18)}function fm({pointerPos:n,pointerOffset:e,sizes:t,dir:i="ltr"}){const r=Ca(t),s=r/2,a=e||s,o=r-a,l=t.scrollbar.paddingStart+a,c=t.scrollbar.size-t.scrollbar.paddingEnd-o,d=t.content-t.viewport,h=i==="ltr"?[0,d]:[d*-1,0];return mh([l,c],h)(n)}function mu({scrollPos:n,sizes:e,dir:t="ltr"}){const i=Ca(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,a=e.content-e.viewport,o=s-i,l=t==="ltr"?[0,a]:[a*-1,0],c=dm(n,l[0],l[1]);return mh([0,a],[0,o])(c)}function mh(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(n[1]-n[0]);return e[0]+i*(t-n[0])}}function gh(n,e){return n>0&&n<e}function pm(n,e){let t={left:n.scrollLeft,top:n.scrollTop},i=0;const r=Ep(n);return(function s(){const a={left:n.scrollLeft,top:n.scrollTop},o=t.left!==a.left,l=t.top!==a.top;(o||l)&&e(),t=a,i=r.requestAnimationFrame(s)})(),()=>r.cancelAnimationFrame(i)}var mm=Z("<div><!></div>");function gm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=_e(e,"type",3,"hover"),a=_e(e,"dir",3,"ltr"),o=_e(e,"scrollHideDelay",3,600),l=lt(e,["$$slots","$$events","$$legacy","ref","id","type","dir","scrollHideDelay","children","child"]);const c=ql.create({type:dt(()=>s()),dir:dt(()=>a()),scrollHideDelay:dt(()=>o()),id:dt(()=>r()),ref:dt(()=>i(),S=>i(S))}),d=F(()=>fn(l,c.props));var h=Ie(),f=oe(h);{var p=S=>{var g=Ie(),m=oe(g);Ct(m,()=>e.child,()=>({props:u(d)})),C(S,g)},v=S=>{var g=mm();an(g,()=>({...u(d)}));var m=$(g);Ct(m,()=>e.children??Ut),X(g),C(S,g)};xe(f,S=>{e.child?S(p):S(v,-1)})}C(n,h),it()}var vm=Z("<div><div><!></div></div>");function _m(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=lt(e,["$$slots","$$events","$$legacy","ref","id","children"]);const a=Kl.create({id:dt(()=>r()),ref:dt(()=>i(),f=>i(f))}),o=F(()=>fn(s,a.props)),l=F(()=>fn({},a.contentProps));var c=vm();an(c,()=>({...u(o)}));var d=$(c);an(d,()=>({...u(l)}));var h=$(d);Ct(h,()=>e.children??Ut),X(d),X(c),C(n,c),it()}var xm=Z("<div><!></div>");function vh(n,e){nt(e,!0);let t=lt(e,["$$slots","$$events","$$legacy","child","children"]);const i=nc.create(),r=F(()=>fn(t,i.props));var s=Ie(),a=oe(s);{var o=c=>{var d=Ie(),h=oe(d);Ct(h,()=>e.child,()=>({props:u(r)})),C(c,d)},l=c=>{var d=xm();an(d,()=>({...u(r)}));var h=$(d);Ct(h,()=>e.children??Ut),X(d),C(c,d)};xe(a,c=>{e.child?c(o):c(l,-1)})}C(n,s),it()}function bm(n,e){nt(e,!0);let t=lt(e,["$$slots","$$events","$$legacy"]);const i=new Wl,r=ec.create({mounted:dt(()=>i.current)}),s=F(()=>fn(t,r.props));vh(n,pt(()=>u(s))),it()}function Sm(n,e){nt(e,!0);let t=lt(e,["$$slots","$$events","$$legacy"]);const i=new Wl,r=tc.create({mounted:dt(()=>i.current)}),s=F(()=>fn(t,r.props));vh(n,pt(()=>u(s))),it()}function Pa(n,e){nt(e,!0);let t=lt(e,["$$slots","$$events","$$legacy"]);const i=Ql.create();var r=Ie(),s=oe(r);{var a=l=>{bm(l,pt(()=>t))},o=l=>{Sm(l,pt(()=>t))};xe(s,l=>{i.scrollbar.opts.orientation.current==="horizontal"?l(a):l(o,-1)})}C(n,r),it()}function ym(n,e){nt(e,!0);let t=_e(e,"forceMount",3,!1),i=lt(e,["$$slots","$$events","$$legacy","forceMount"]);const r=Ra.create(),s=F(()=>fn(i,r.props));{const a=l=>{Pa(l,pt(()=>u(s)))};let o=F(()=>t()||r.isVisible);wa(n,{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}})}it()}function Mm(n,e){nt(e,!0);let t=_e(e,"forceMount",3,!1),i=lt(e,["$$slots","$$events","$$legacy","forceMount"]);const r=Jl.create(),s=F(()=>fn(i,r.props));{const a=l=>{Pa(l,pt(()=>u(s)))};let o=F(()=>t()||!r.isHidden);wa(n,pt(()=>u(s),{get open(){return u(o)},get ref(){return r.scrollbar.opts.ref},presence:a,$$slots:{presence:!0}}))}it()}function Em(n,e){nt(e,!0);let t=_e(e,"forceMount",3,!1),i=lt(e,["$$slots","$$events","$$legacy","forceMount"]);const r=$l.create(),s=Ra.create(),a=F(()=>fn(i,r.props,s.props,{"data-state":r.isVisible?"visible":"hidden"})),o=F(()=>t()||r.isVisible&&s.isVisible);wa(n,{get open(){return u(o)},get ref(){return s.scrollbar.opts.ref},presence:c=>{Pa(c,pt(()=>u(a)))},$$slots:{presence:!0}}),it()}function Tm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=lt(e,["$$slots","$$events","$$legacy","ref","id","orientation"]);const a=Zl.create({orientation:dt(()=>e.orientation),id:dt(()=>r()),ref:dt(()=>i(),v=>i(v))}),o=F(()=>a.root.opts.type.current);var l=Ie(),c=oe(l);{var d=v=>{Em(v,pt(()=>s,{get id(){return r()}}))},h=v=>{Mm(v,pt(()=>s,{get id(){return r()}}))},f=v=>{ym(v,pt(()=>s,{get id(){return r()}}))},p=v=>{Pa(v,pt(()=>s,{get id(){return r()}}))};xe(c,v=>{u(o)==="hover"?v(d):u(o)==="scroll"?v(h,1):u(o)==="auto"?v(f,2):u(o)==="always"&&v(p,3)})}C(n,l),it()}var wm=Z("<div><!></div>");function Am(n,e){nt(e,!0);let t=_e(e,"ref",15,null),i=lt(e,["$$slots","$$events","$$legacy","ref","id","child","children","present"]);const r=new Wl,s=ic.create({id:dt(()=>e.id),ref:dt(()=>t(),h=>t(h)),mounted:dt(()=>r.current)}),a=F(()=>fn(i,s.props,{style:{hidden:!e.present}}));var o=Ie(),l=oe(o);{var c=h=>{var f=Ie(),p=oe(f);Ct(p,()=>e.child,()=>({props:u(a)})),C(h,f)},d=h=>{var f=wm();an(f,()=>({...u(a)}));var p=$(f);Ct(p,()=>e.children??Ut),X(f),C(h,f)};xe(l,h=>{e.child?h(c):h(d,-1)})}C(n,o),it()}function Rm(n,e){const t=Un();nt(e,!0);let i=_e(e,"id",19,()=>xi(t)),r=_e(e,"ref",15,null),s=_e(e,"forceMount",3,!1),a=lt(e,["$$slots","$$events","$$legacy","id","ref","forceMount"]);const o=Aa.get();{const l=(d,h)=>{let f=()=>h?.().present;Am(d,pt(()=>a,{get id(){return i()},get present(){return f()},get ref(){return r()},set ref(p){r(p)}}))};let c=F(()=>s()||o.hasThumb);wa(n,{get open(){return u(c)},get ref(){return o.scrollbar.opts.ref},presence:l,$$slots:{presence:!0}})}it()}var Cm=Z("<div><!></div>");function Pm(n,e){nt(e,!0);let t=_e(e,"ref",15,null),i=lt(e,["$$slots","$$events","$$legacy","ref","id","children","child"]);const r=rc.create({id:dt(()=>e.id),ref:dt(()=>t(),d=>t(d))}),s=F(()=>fn(i,r.props));var a=Ie(),o=oe(a);{var l=d=>{var h=Ie(),f=oe(h);Ct(f,()=>e.child,()=>({props:u(s)})),C(d,h)},c=d=>{var h=Cm();an(h,()=>({...u(s)}));var f=$(h);Ct(f,()=>e.children??Ut),X(h),C(d,h)};xe(o,d=>{e.child?d(l):d(c,-1)})}C(n,a),it()}function Dm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=lt(e,["$$slots","$$events","$$legacy","ref","id"]);const a=ms.get(),o=F(()=>!!(a.scrollbarXNode&&a.scrollbarYNode)),l=F(()=>a.opts.type.current!=="scroll"&&u(o));var c=Ie(),d=oe(c);{var h=f=>{Pm(f,pt(()=>s,{get id(){return r()},get ref(){return i()},set ref(p){i(p)}}))};xe(d,f=>{u(l)&&f(h)})}C(n,c),it()}function gu(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.right=`${t}%`):n==="rl"?(i.right=`${e}%`,i.left=`${t}%`):n==="bt"?(i.bottom=`${e}%`,i.top=`${t}%`):(i.top=`${e}%`,i.bottom=`${t}%`),i}function _h(n,e){const t={position:"absolute"};return n==="lr"?(t.left=`${e}%`,t.translate="-50% 0"):n==="rl"?(t.right=`${e}%`,t.translate="50% 0"):n==="bt"?(t.bottom=`${e}%`,t.translate="0 50%"):(t.top=`${e}%`,t.translate="0 -50%"),t}function xh(n,e,t){const i={position:"absolute"};return n==="lr"?(i.left=`${e}%`,i.translate=`${t}% 0`):n==="rl"?(i.right=`${e}%`,i.translate=`${-t}% 0`):n==="bt"?(i.bottom=`${e}%`,i.translate=`0 ${-t}%`):(i.top=`${e}%`,i.translate=`0 ${t}%`),i}function Lm(n){if(Math.floor(n)===n)return 0;const e=n.toString();if(e.indexOf(".")!==-1&&e.indexOf("e-")===-1)return e.split(".")[1].length;if(e.indexOf("e-")!==-1){const t=e.split("e-");return parseInt(t[1],10)}return 0}function Im(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}function sc(n,e,t){if(typeof n=="number"){const i=t-e;let r=Math.ceil(i/n);const s=Lm(n),a=Math.pow(10,s),o=Math.round(i*a),l=Math.round(n*a);o%l===0&&r++;const c=[];for(let d=0;d<r;d++){const h=e+d*n,f=Im(h,s);c.push(f)}return c}return[...new Set(n)].filter(i=>i>=e&&i<=t).sort((i,r)=>i-r)}function Qi(n,e){if(e.length===0)return n;let t=e[0],i=Math.abs(n-t);for(const r of e){const s=Math.abs(n-r);s<i&&(i=s,t=r)}return t}function Ms(n,e,t){const i=e.indexOf(n);return i===-1?Qi(n,e):t==="next"?i<e.length-1?e[i+1]:n:i>0?e[i-1]:n}function Nm(n,e,t=!0){const[i,r]=n,[s,a]=e,o=(a-s)/(r-i);return l=>{const c=s+o*(l-i);return t?c>Math.max(s,a)?Math.max(s,a):c<Math.min(s,a)?Math.min(s,a):c:c}}const Ni=Vl({component:"slider",parts:["root","thumb","range","tick","tick-label","thumb-label"]}),ac=new zi("Slider.Root");class bh{opts;attachment;#e=Ae(!1);get isActive(){return u(this.#e)}set isActive(e){U(this.#e,e,!0)}#t=Ae(0);#n=F(()=>this.opts.orientation.current==="horizontal"?this.opts.dir.current==="rtl"?"rl":"lr":this.opts.dir.current==="rtl"?"tb":"bt");get direction(){return u(this.#n)}set direction(e){U(this.#n,e)}#i=F(()=>sc(this.opts.step.current,this.opts.min.current,this.opts.max.current));get normalizedSteps(){return u(this.#i)}set normalizedSteps(e){U(this.#i,e)}domContext;constructor(e){this.opts=e,this.attachment=Gn(e.ref),this.domContext=new $d(this.opts.ref),new nr(()=>this.opts.ref.current,this.#r)}#r=()=>{U(this.#t,u(this.#t)+1)};isThumbActive(e){return this.isActive}#s=F(()=>{if(!this.opts.disabled.current)return this.opts.orientation.current==="horizontal"?"pan-y":"pan-x"});getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Ni.selector("thumb"))):[]};getThumbScale=()=>{u(this.#t);const e=this.opts.trackPadding?.current;if(e!==void 0&&e>0)return[e,100-e];if(this.opts.thumbPositioning.current==="exact")return[0,100];const t=this.opts.orientation.current==="vertical",i=this.getAllThumbs()[0],r=t?i?.offsetHeight:i?.offsetWidth;if(r===void 0||Number.isNaN(r)||r===0)return[0,100];const s=t?this.opts.ref.current?.offsetHeight:this.opts.ref.current?.offsetWidth;if(s===void 0||Number.isNaN(s)||s===0)return[0,100];const a=r/2/s*100,o=a,l=100-a;return[o,l]};getPositionFromValue=e=>{const t=this.getThumbScale();return Nm([this.opts.min.current,this.opts.max.current],t)(e)};#a=F(()=>({id:this.opts.id.current,"data-orientation":this.opts.orientation.current,"data-disabled":tr(this.opts.disabled.current),style:{touchAction:u(this.#s)},[Ni.root]:"",...this.attachment}));get props(){return u(this.#a)}set props(e){U(this.#a,e)}}class Um extends bh{opts;isMulti=!1;constructor(e){super(e),this.opts=e,ch(()=>Hl(Kt(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),Kt(this.domContext.getDocument(),"pointerup",this.handlePointerUp),Kt(this.domContext.getDocument(),"pointermove",this.handlePointerMove),Kt(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),Fi([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=sc(t,i,r),o=c=>a.includes(c),l=c=>Qi(c,a);o(s)||(this.opts.value.current=l(s))})}isTickValueSelected=e=>this.opts.value.current===e;applyPosition({clientXY:e,start:t,end:i}){const r=this.opts.min.current,s=this.opts.max.current,o=(e-t)/(i-t)*(s-r)+r;if(o<r)this.updateValue(r);else if(o>s)this.updateValue(s);else{const l=this.normalizedSteps,c=Qi(o,l);this.updateValue(c)}}updateValue=e=>{this.opts.value.current=Qi(e,this.normalizedSteps)};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!t||!i)return;i.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect();this.direction==="lr"?this.applyPosition({clientXY:e.clientX,start:r,end:s}):this.direction==="rl"?this.applyPosition({clientXY:e.clientX,start:s,end:r}):this.direction==="bt"?this.applyPosition({clientXY:e.clientY,start:o,end:a}):this.direction==="tb"&&this.applyPosition({clientXY:e.clientY,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.getAllThumbs()[0];if(!i||!t)return;const r=e.composedPath()[0]??e.target;!lh(r)||!t.contains(r)||(e.preventDefault(),i.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(rn(()=>this.opts.value.current)),this.isActive=!1)};#e=F(()=>{const e=this.opts.value.current;return Array.from({length:1},()=>{const t=e,i=this.getPositionFromValue(t),r=_h(this.direction,i);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":t,"aria-disabled":ma(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":t,"data-orientation":this.opts.orientation.current,style:r,[Ni.thumb]:""}})});get thumbsPropsArr(){return u(this.#e)}set thumbsPropsArr(e){U(this.#e,e)}#t=F(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#t)}set thumbsRenderArr(e){U(this.#t,e)}#n=F(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=xh(this.direction,s,l),d=i<=t;return{"data-disabled":tr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,"data-selected":this.isTickValueSelected(i)?"":void 0,style:c,[Ni.tick]:""}})});get ticksPropsArr(){return u(this.#n)}set ticksPropsArr(e){U(this.#n,e)}#i=F(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#i)}set ticksRenderArr(e){U(this.#i,e)}#r=F(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#r)}set tickItemsArr(e){U(this.#r,e)}#s=F(()=>[{value:this.opts.value.current,index:0}]);get thumbItemsArr(){return u(this.#s)}set thumbItemsArr(e){U(this.#s,e)}#a=F(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#a)}set snippetProps(e){U(this.#a,e)}}class Fm extends bh{opts;isMulti=!0;#e=Ae(null);get activeThumb(){return u(this.#e)}set activeThumb(e){U(this.#e,e,!0)}#t=Ae(0);get currentThumbIdx(){return u(this.#t)}set currentThumbIdx(e){U(this.#t,e,!0)}constructor(e){super(e),this.opts=e,ch(()=>Hl(Kt(this.domContext.getDocument(),"pointerdown",this.handlePointerDown),Kt(this.domContext.getDocument(),"pointerup",this.handlePointerUp),Kt(this.domContext.getDocument(),"pointermove",this.handlePointerMove),Kt(this.domContext.getDocument(),"pointerleave",this.handlePointerUp))),Fi([()=>this.opts.step.current,()=>this.opts.min.current,()=>this.opts.max.current,()=>this.opts.value.current],([t,i,r,s])=>{const a=sc(t,i,r),o=c=>a.includes(c),l=c=>Qi(c,a);s.some(c=>!o(c))&&(this.opts.value.current=s.map(l))})}isTickValueSelected=e=>this.opts.value.current.includes(e);isThumbActive(e){return this.isActive&&this.activeThumb?.idx===e}applyPosition({clientXY:e,activeThumbIdx:t,start:i,end:r}){const s=this.opts.min.current,a=this.opts.max.current,l=(e-i)/(r-i)*(a-s)+s;if(l<s)this.updateValue(s,t);else if(l>a)this.updateValue(a,t);else{const c=this.normalizedSteps,d=Qi(l,c);this.updateValue(d,t)}}#n=e=>{const t=this.getAllThumbs();if(!t.length)return;for(const a of t)a.blur();const i=t.map(a=>{if(this.opts.orientation.current==="horizontal"){const{left:o,right:l}=a.getBoundingClientRect();return Math.abs(e.clientX-(o+l)/2)}else{const{top:o,bottom:l}=a.getBoundingClientRect();return Math.abs(e.clientY-(o+l)/2)}}),r=t[i.indexOf(Math.min(...i))],s=t.indexOf(r);return{node:r,idx:s}};handlePointerMove=e=>{if(!this.isActive||this.opts.disabled.current)return;e.preventDefault(),e.stopPropagation();const t=this.opts.ref.current,i=this.activeThumb;if(!t||!i)return;i.node.focus();const{left:r,right:s,top:a,bottom:o}=t.getBoundingClientRect(),l=this.direction;l==="lr"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:r,end:s}):l==="rl"?this.applyPosition({clientXY:e.clientX,activeThumbIdx:i.idx,start:s,end:r}):l==="bt"?this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:o,end:a}):l==="tb"&&this.applyPosition({clientXY:e.clientY,activeThumbIdx:i.idx,start:a,end:o})};handlePointerDown=e=>{if(e.button!==0||this.opts.disabled.current)return;const t=this.opts.ref.current,i=this.#n(e);if(!i||!t)return;const r=e.composedPath()[0]??e.target;!lh(r)||!t.contains(r)||(e.preventDefault(),this.activeThumb=i,i.node.focus(),this.isActive=!0,this.handlePointerMove(e))};handlePointerUp=()=>{this.opts.disabled.current||(this.isActive&&this.opts.onValueCommit.current(rn(()=>this.opts.value.current)),this.isActive=!1)};getAllThumbs=()=>{const e=this.opts.ref.current;return e?Array.from(e.querySelectorAll(Ni.selector("thumb"))):[]};updateValue=(e,t)=>{const i=this.opts.value.current;if(!i.length){this.opts.value.current.push(e);return}if(i[t]===e)return;const s=[...i];if(!Fp(t,s))return;const a=s[t]>e?-1:1,o=()=>{const c=t+a;s[t]=s[c],s[c]=e;const d=this.getAllThumbs();d.length&&(d[c]?.focus(),this.activeThumb={node:d[c],idx:c})};if(this.opts.autoSort.current&&(a===-1&&e<s[t-1]||a===1&&e>s[t+1])){o(),this.opts.value.current=s;return}const l=this.normalizedSteps;s[t]=Qi(e,l),this.opts.value.current=s};#i=F(()=>{const e=this.opts.value.current;return Array.from({length:e.length||1},(t,i)=>{const r=rn(()=>this.currentThumbIdx);r<e.length&&rn(()=>{this.currentThumbIdx=r+1});const s=e[i],a=this.getPositionFromValue(s??0),o=_h(this.direction,a);return{role:"slider","aria-valuemin":this.opts.min.current,"aria-valuemax":this.opts.max.current,"aria-valuenow":s,"aria-disabled":ma(this.opts.disabled.current),"aria-orientation":this.opts.orientation.current,"data-value":s,"data-orientation":this.opts.orientation.current,style:o,[Ni.thumb]:""}})});get thumbsPropsArr(){return u(this.#i)}set thumbsPropsArr(e){U(this.#i,e)}#r=F(()=>this.thumbsPropsArr.map((e,t)=>t));get thumbsRenderArr(){return u(this.#r)}set thumbsRenderArr(e){U(this.#r,e)}#s=F(()=>{const e=this.normalizedSteps,t=this.opts.value.current;return e.map((i,r)=>{const s=this.getPositionFromValue(i),a=r===0,o=r===e.length-1,l=a?0:o?-100:-50,c=xh(this.direction,s,l),d=t.length===1?i<=t[0]:t[0]<=i&&i<=t[t.length-1];return{"data-disabled":tr(this.opts.disabled.current),"data-orientation":this.opts.orientation.current,"data-bounded":d?"":void 0,"data-value":i,style:c,[Ni.tick]:""}})});get ticksPropsArr(){return u(this.#s)}set ticksPropsArr(e){U(this.#s,e)}#a=F(()=>this.ticksPropsArr.map((e,t)=>t));get ticksRenderArr(){return u(this.#a)}set ticksRenderArr(e){U(this.#a,e)}#o=F(()=>this.ticksPropsArr.map((e,t)=>({value:e["data-value"],index:t})));get tickItemsArr(){return u(this.#o)}set tickItemsArr(e){U(this.#o,e)}#l=F(()=>this.opts.value.current.map((t,i)=>({value:t,index:i})));get thumbItemsArr(){return u(this.#l)}set thumbItemsArr(e){U(this.#l,e)}#c=F(()=>({ticks:this.ticksRenderArr,thumbs:this.thumbsRenderArr,tickItems:this.tickItemsArr,thumbItems:this.thumbItemsArr}));get snippetProps(){return u(this.#c)}set snippetProps(e){U(this.#c,e)}}class Om{static create(e){const{type:t,...i}=e,r=t==="single"?new Um(i):new Fm(i);return ac.set(r)}}const Bm=[nh,ih,rh,sh,ah,oh];class oc{static create(e){return new oc(e,ac.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=Gn(e.ref)}#e=F(()=>{if(Array.isArray(this.root.opts.value.current)){const e=this.root.opts.value.current.length>1?this.root.getPositionFromValue(Math.min(...this.root.opts.value.current)??0):0,t=100-this.root.getPositionFromValue(Math.max(...this.root.opts.value.current)??0);return{position:"absolute",...gu(this.root.direction,e,t)}}else{const e=this.root.opts.trackPadding?.current,t=this.root.opts.value.current,i=this.root.opts.max.current,r=0,s=e!==void 0&&e>0&&t===i?0:100-this.root.getPositionFromValue(t);return{position:"absolute",...gu(this.root.direction,r,s)}}});get rangeStyles(){return u(this.#e)}set rangeStyles(e){U(this.#e,e)}#t=F(()=>({id:this.opts.id.current,"data-orientation":this.root.opts.orientation.current,"data-disabled":tr(this.root.opts.disabled.current),style:this.rangeStyles,[Ni.range]:"",...this.attachment}));get props(){return u(this.#t)}set props(e){U(this.#t,e)}}class lc{static create(e){return new lc(e,ac.get())}opts;root;attachment;#e=F(()=>this.root.opts.disabled.current||this.opts.disabled.current);constructor(e,t){this.opts=e,this.root=t,this.attachment=Gn(e.ref),this.onkeydown=this.onkeydown.bind(this)}#t(e){this.root.isMulti?this.root.updateValue(e,this.opts.index.current):this.root.updateValue(e)}onkeydown(e){if(u(this.#e))return;const t=this.opts.ref.current;if(!t)return;const i=this.root.getAllThumbs();if(!i.length)return;const r=i.indexOf(t);if(this.root.isMulti&&(this.root.currentThumbIdx=r),!Bm.includes(e.key))return;e.preventDefault();const s=this.root.opts.min.current,a=this.root.opts.max.current,o=this.root.opts.value.current,l=Array.isArray(o)?o[r]:o,c=this.root.opts.orientation.current,d=this.root.direction,h=this.root.normalizedSteps;switch(e.key){case ah:this.#t(s);break;case oh:this.#t(a);break;case nh:if(c!=="horizontal")break;if(e.metaKey){const f=d==="rl"?a:s;this.#t(f)}else{const p=Ms(l,h,d==="rl"?"next":"prev");this.#t(p)}break;case ih:if(c!=="horizontal")break;if(e.metaKey){const f=d==="rl"?s:a;this.#t(f)}else{const p=Ms(l,h,d==="rl"?"prev":"next");this.#t(p)}break;case rh:if(e.metaKey){const f=d==="tb"?s:a;this.#t(f)}else{const p=Ms(l,h,d==="tb"?"prev":"next");this.#t(p)}break;case sh:if(e.metaKey){const f=d==="tb"?a:s;this.#t(f)}else{const p=Ms(l,h,d==="tb"?"next":"prev");this.#t(p)}break}this.root.opts.onValueCommit.current(this.root.opts.value.current)}#n=F(()=>({...this.root.thumbsPropsArr[this.opts.index.current],id:this.opts.id.current,onkeydown:this.onkeydown,"data-active":this.root.isThumbActive(this.opts.index.current)?"":void 0,"data-disabled":tr(this.opts.disabled.current||this.root.opts.disabled.current),tabindex:this.opts.disabled.current||this.root.opts.disabled.current?-1:0,...this.attachment}));get props(){return u(this.#n)}set props(e){U(this.#n,e)}}var zm=Z("<span><!></span>");function km(n,e){const t=Un();nt(e,!0);let i=_e(e,"id",19,()=>xi(t)),r=_e(e,"ref",15,null),s=_e(e,"value",15),a=_e(e,"onValueChange",3,fu),o=_e(e,"onValueCommit",3,fu),l=_e(e,"disabled",3,!1),c=_e(e,"step",3,1),d=_e(e,"dir",3,"ltr"),h=_e(e,"autoSort",3,!0),f=_e(e,"orientation",3,"horizontal"),p=_e(e,"thumbPositioning",3,"contain"),v=lt(e,["$$slots","$$events","$$legacy","children","child","id","ref","value","type","onValueChange","onValueCommit","disabled","min","max","step","dir","autoSort","orientation","thumbPositioning","trackPadding"]);const S=F(()=>e.min!==void 0?e.min:Array.isArray(c())?Math.min(...c()):0),g=F(()=>e.max!==void 0?e.max:Array.isArray(c())?Math.max(...c()):100);function m(){if(s()===void 0)return e.type==="single"?u(S):[]}m(),Fi.pre(()=>s(),()=>{m()});const x=Om.create({id:dt(()=>i()),ref:dt(()=>r(),_=>r(_)),value:dt(()=>s(),_=>{s(_),a()(_)}),onValueCommit:dt(()=>o()),disabled:dt(()=>l()),min:dt(()=>u(S)),max:dt(()=>u(g)),step:dt(()=>c()),dir:dt(()=>d()),autoSort:dt(()=>h()),orientation:dt(()=>f()),thumbPositioning:dt(()=>p()),type:e.type,trackPadding:dt(()=>e.trackPadding)}),M=F(()=>fn(v,x.props));var w=Ie(),R=oe(w);{var y=_=>{var E=Ie(),I=oe(E);{let P=F(()=>({props:u(M),...x.snippetProps}));Ct(I,()=>e.child,()=>u(P))}C(_,E)},L=_=>{var E=zm();an(E,()=>({...u(M)}));var I=$(E);Ct(I,()=>e.children??Ut,()=>x.snippetProps),X(E),C(_,E)};xe(R,_=>{e.child?_(y):_(L,-1)})}C(n,w),it()}var Vm=Z("<span><!></span>");function Hm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=lt(e,["$$slots","$$events","$$legacy","children","child","ref","id"]);const a=oc.create({id:dt(()=>r()),ref:dt(()=>i(),f=>i(f))}),o=F(()=>fn(s,a.props));var l=Ie(),c=oe(l);{var d=f=>{var p=Ie(),v=oe(p);Ct(v,()=>e.child,()=>({props:u(o)})),C(f,p)},h=f=>{var p=Vm();an(p,()=>({...u(o)}));var v=$(p);Ct(v,()=>e.children??Ut),X(p),C(f,p)};xe(c,f=>{e.child?f(d):f(h,-1)})}C(n,l),it()}var Gm=Z("<span><!></span>");function Wm(n,e){const t=Un();nt(e,!0);let i=_e(e,"ref",15,null),r=_e(e,"id",19,()=>xi(t)),s=_e(e,"disabled",3,!1),a=lt(e,["$$slots","$$events","$$legacy","children","child","ref","id","index","disabled"]);const o=lc.create({id:dt(()=>r()),ref:dt(()=>i(),p=>i(p)),index:dt(()=>e.index),disabled:dt(()=>s())}),l=F(()=>fn(a,o.props));var c=Ie(),d=oe(c);{var h=p=>{var v=Ie(),S=oe(v);{let g=F(()=>({active:o.root.isThumbActive(o.opts.index.current),props:u(l)}));Ct(S,()=>e.child,()=>u(g))}C(p,v)},f=p=>{var v=Gm();an(v,()=>({...u(l)}));var S=$(v);{let g=F(()=>({active:o.root.isThumbActive(o.opts.index.current)}));Ct(S,()=>e.children??Ut,()=>u(g))}X(v),C(p,v)};xe(d,p=>{e.child?p(h):p(f,-1)})}C(n,c),it()}function Xm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];$t(n,pt({name:"camera"},()=>t,{get iconNode(){return i}}))}function Ym(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335"}],["path",{d:"m9 11 3 3L22 4"}]];$t(n,pt({name:"circle-check-big"},()=>t,{get iconNode(){return i}}))}function jm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m9 12 2 2 4-4"}]];$t(n,pt({name:"circle-check"},()=>t,{get iconNode(){return i}}))}function qm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]];$t(n,pt({name:"circle-question-mark"},()=>t,{get iconNode(){return i}}))}function Sh(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];$t(n,pt({name:"download"},()=>t,{get iconNode(){return i}}))}function Va(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];$t(n,pt({name:"eye-off"},()=>t,{get iconNode(){return i}}))}function Ha(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];$t(n,pt({name:"eye"},()=>t,{get iconNode(){return i}}))}function vu(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M12 12v6"}],["path",{d:"m15 15-3-3-3 3"}]];$t(n,pt({name:"file-up"},()=>t,{get iconNode(){return i}}))}function Km(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];$t(n,pt({name:"file"},()=>t,{get iconNode(){return i}}))}function Zm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}]];$t(n,pt({name:"folder-open"},()=>t,{get iconNode(){return i}}))}function $m(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];$t(n,pt({name:"folder"},()=>t,{get iconNode(){return i}}))}function Jm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}]];$t(n,pt({name:"inbox"},()=>t,{get iconNode(){return i}}))}function Qm(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];$t(n,pt({name:"info"},()=>t,{get iconNode(){return i}}))}function eg(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]];$t(n,pt({name:"layers"},()=>t,{get iconNode(){return i}}))}function tg(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];$t(n,pt({name:"link"},()=>t,{get iconNode(){return i}}))}function cc(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];$t(n,pt({name:"loader"},()=>t,{get iconNode(){return i}}))}function uc(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];$t(n,pt({name:"maximize"},()=>t,{get iconNode(){return i}}))}function dc(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]];$t(n,pt({name:"minimize"},()=>t,{get iconNode(){return i}}))}function ng(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M5 12h14"}]];$t(n,pt({name:"minus"},()=>t,{get iconNode(){return i}}))}function ig(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"}]];$t(n,pt({name:"play"},()=>t,{get iconNode(){return i}}))}function rg(n,e){let t=lt(e,["$$slots","$$events","$$legacy"]);const i=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];$t(n,pt({name:"zap"},()=>t,{get iconNode(){return i}}))}const Nr={FILE_UPLOAD:{MAX_SIZE_MB:150,MAX_SIZE_BYTES:150*1024*1024},TIMEOUTS:{SOLVE_STATE_DURATION:3500,PARAM_EXPORT_DELAY:100,DRAWER_ANIMATION_MS:350},SOLVING_INDICATOR:{FAST_THRESHOLD_MS:200,SLOW_THRESHOLD_MS:600,ANIMATION_DELAY:300,HISTORY_SIZE:3},FILE_SIZE:{BYTES_PER_KB:1024}};var yh=Object.defineProperty,sg=(n,e,t)=>e in n?yh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ag=(n,e)=>{for(var t in e)yh(n,t,{get:e[t],enumerable:!0})},Es=(n,e,t)=>sg(n,typeof e!="symbol"?e+"":e,t),gi={VALIDATION_ERROR:"VALIDATION_ERROR",INVALID_STATE:"INVALID_STATE",INVALID_INPUT:"INVALID_INPUT",BROWSER_ONLY:"BROWSER_ONLY"},Ui=class Io extends Error{constructor(e,t="UNKNOWN_ERROR",i){super(e),Es(this,"code"),Es(this,"statusCode"),Es(this,"context"),Es(this,"originalError"),this.name="RhinoComputeError",this.code=t,this.statusCode=i?.statusCode,this.context=i?.context,this.originalError=i?.originalError,i?.originalError&&(this.cause=i.originalError)}static missingValues(e,t,i){return new Io(`Input "${e}" has no values defined${t?` (expected ${t})`:""}`,gi.INVALID_INPUT,{context:{inputName:e,expectedType:t,...i}})}static unknownParamType(e,t,i){return new Io(`Unknown paramType: ${e}`,gi.VALIDATION_ERROR,{context:{receivedParamType:e,paramName:t,...i}})}},og=class{debug(){}info(){}warn(){}error(){}},lg=new og;function zt(){return lg}function Mh(n){if(typeof globalThis.Buffer=="function"){let e=globalThis.Buffer.from(n,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}if(typeof globalThis.atob=="function"){let e=globalThis.atob(n),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i)&255;return t}throw new Ui("Base64 decoding not supported in this environment.",gi.INVALID_STATE,{context:{environmentInfo:"atob or Buffer not available"}})}const hc="184",Dr={ROTATE:0,DOLLY:1,PAN:2},Mr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},cg=0,_u=1,ug=2,ta=1,dg=2,Er=3,Sn=0,xn=1,Ln=2,fi=0,Lr=1,xu=2,bu=3,Su=4,hg=5,ji=100,fg=101,pg=102,mg=103,gg=104,vg=200,_g=201,xg=202,bg=203,No=204,Uo=205,Sg=206,yg=207,Mg=208,Eg=209,Tg=210,wg=211,Ag=212,Rg=213,Cg=214,Fo=0,Oo=1,Bo=2,Ur=3,zo=4,ko=5,Vo=6,Ho=7,Eh=0,Pg=1,Dg=2,Qn=0,Th=1,wh=2,Ah=3,Rh=4,Ch=5,Ph=6,fc=7,Dh=300,ir=301,Fr=302,na=303,Ga=304,Da=306,Go=1e3,Vn=1001,Wo=1002,on=1003,Lg=1004,Ts=1005,Zt=1006,Wa=1007,Li=1008,wn=1009,Lh=1010,Ih=1011,os=1012,pc=1013,ti=1014,An=1015,Rn=1016,mc=1017,gc=1018,ls=1020,Nh=35902,Uh=35899,Fh=1021,Oh=1022,Hn=1023,vi=1026,Ki=1027,Bh=1028,vc=1029,rr=1030,_c=1031,xc=1033,ia=33776,ra=33777,sa=33778,aa=33779,Xo=35840,Yo=35841,jo=35842,qo=35843,Ko=36196,Zo=37492,$o=37496,Jo=37488,Qo=37489,va=37490,el=37491,tl=37808,nl=37809,il=37810,rl=37811,sl=37812,al=37813,ol=37814,ll=37815,cl=37816,ul=37817,dl=37818,hl=37819,fl=37820,pl=37821,ml=36492,gl=36494,vl=36495,_l=36283,xl=36284,_a=36285,bl=36286,Ig=3200,Sl=0,Ng=1,Pi="",Tn="srgb",cs="srgb-linear",xa="linear",Pt="srgb",or=7680,yu=519,Ug=512,Fg=513,Og=514,bc=515,Bg=516,zg=517,Sc=518,kg=519,Mu=35044,Eu="300 es",Jn=2e3,us=2001;function Vg(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function ba(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Hg(){const n=ba("canvas");return n.style.display="block",n}const Tu={};function wu(...n){const e="THREE."+n.shift();console.log(e,...n)}function zh(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function ut(...n){n=zh(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Mt(...n){n=zh(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function yl(...n){const e=n.join(" ");e in Tu||(Tu[e]=!0,ut(...n))}function Gg(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const Wg={[Fo]:Oo,[Bo]:Vo,[zo]:Ho,[Ur]:ko,[Oo]:Fo,[Vo]:Bo,[Ho]:zo,[ko]:Ur};class ki{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const cn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],oa=Math.PI/180,Ml=180/Math.PI;function vs(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(cn[n&255]+cn[n>>8&255]+cn[n>>16&255]+cn[n>>24&255]+"-"+cn[e&255]+cn[e>>8&255]+"-"+cn[e>>16&15|64]+cn[e>>24&255]+"-"+cn[t&63|128]+cn[t>>8&255]+"-"+cn[t>>16&255]+cn[t>>24&255]+cn[i&255]+cn[i>>8&255]+cn[i>>16&255]+cn[i>>24&255]).toLowerCase()}function bt(n,e,t){return Math.max(e,Math.min(t,n))}function Xg(n,e){return(n%e+e)%e}function Xa(n,e,t){return(1-t)*n+t*e}function Hr(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function gn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Yg={DEG2RAD:oa},Kc=class Kc{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=bt(this.x,e.x,t.x),this.y=bt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=bt(this.x,e,t),this.y=bt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(bt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(bt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Kc.prototype.isVector2=!0;let ht=Kc;class Oi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],d=i[r+2],h=i[r+3],f=s[a+0],p=s[a+1],v=s[a+2],S=s[a+3];if(h!==S||l!==f||c!==p||d!==v){let g=l*f+c*p+d*v+h*S;g<0&&(f=-f,p=-p,v=-v,S=-S,g=-g);let m=1-o;if(g<.9995){const x=Math.acos(g),M=Math.sin(x);m=Math.sin(m*x)/M,o=Math.sin(o*x)/M,l=l*m+f*o,c=c*m+p*o,d=d*m+v*o,h=h*m+S*o}else{l=l*m+f*o,c=c*m+p*o,d=d*m+v*o,h=h*m+S*o;const x=1/Math.sqrt(l*l+c*c+d*d+h*h);l*=x,c*=x,d*=x,h*=x}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],h=s[a],f=s[a+1],p=s[a+2],v=s[a+3];return e[t]=o*v+d*h+l*p-c*f,e[t+1]=l*v+d*f+c*h-o*p,e[t+2]=c*v+d*p+o*f-l*h,e[t+3]=d*v-o*h-l*f-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),h=o(s/2),f=l(i/2),p=l(r/2),v=l(s/2);switch(a){case"XYZ":this._x=f*d*h+c*p*v,this._y=c*p*h-f*d*v,this._z=c*d*v+f*p*h,this._w=c*d*h-f*p*v;break;case"YXZ":this._x=f*d*h+c*p*v,this._y=c*p*h-f*d*v,this._z=c*d*v-f*p*h,this._w=c*d*h+f*p*v;break;case"ZXY":this._x=f*d*h-c*p*v,this._y=c*p*h+f*d*v,this._z=c*d*v+f*p*h,this._w=c*d*h-f*p*v;break;case"ZYX":this._x=f*d*h-c*p*v,this._y=c*p*h+f*d*v,this._z=c*d*v-f*p*h,this._w=c*d*h+f*p*v;break;case"YZX":this._x=f*d*h+c*p*v,this._y=c*p*h+f*d*v,this._z=c*d*v-f*p*h,this._w=c*d*h-f*p*v;break;case"XZY":this._x=f*d*h-c*p*v,this._y=c*p*h-f*d*v,this._z=c*d*v+f*p*h,this._w=c*d*h+f*p*v;break;default:ut("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],h=t[10],f=i+o+h;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(d-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>h){const p=2*Math.sqrt(1+i-o-h);this._w=(d-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>h){const p=2*Math.sqrt(1+o-i-h);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+h-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(bt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-i*c,this._z=s*d+a*c+i*l-r*o,this._w=a*d-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Zc=class Zc{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Au.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Au.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),d=2*(o*t-s*r),h=2*(s*i-a*t);return this.x=t+l*c+a*h-o*d,this.y=i+l*d+o*c-s*h,this.z=r+l*h+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=bt(this.x,e.x,t.x),this.y=bt(this.y,e.y,t.y),this.z=bt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=bt(this.x,e,t),this.y=bt(this.y,e,t),this.z=bt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(bt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Ya.copy(this).projectOnVector(e),this.sub(Ya)}reflect(e){return this.sub(Ya.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(bt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Zc.prototype.isVector3=!0;let ne=Zc;const Ya=new ne,Au=new Oi,$c=class $c{constructor(e,t,i,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],d=i[4],h=i[7],f=i[2],p=i[5],v=i[8],S=r[0],g=r[3],m=r[6],x=r[1],M=r[4],w=r[7],R=r[2],y=r[5],L=r[8];return s[0]=a*S+o*x+l*R,s[3]=a*g+o*M+l*y,s[6]=a*m+o*w+l*L,s[1]=c*S+d*x+h*R,s[4]=c*g+d*M+h*y,s[7]=c*m+d*w+h*L,s[2]=f*S+p*x+v*R,s[5]=f*g+p*M+v*y,s[8]=f*m+p*w+v*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*s*d+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],h=d*a-o*c,f=o*l-d*s,p=c*s-a*l,v=t*h+i*f+r*p;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/v;return e[0]=h*S,e[1]=(r*c-d*i)*S,e[2]=(o*i-r*a)*S,e[3]=f*S,e[4]=(d*t-r*l)*S,e[5]=(r*s-o*t)*S,e[6]=p*S,e[7]=(i*l-c*t)*S,e[8]=(a*t-i*s)*S,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(ja.makeScale(e,t)),this}rotate(e){return this.premultiply(ja.makeRotation(-e)),this}translate(e,t){return this.premultiply(ja.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};$c.prototype.isMatrix3=!0;let ft=$c;const ja=new ft,Ru=new ft().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Cu=new ft().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function jg(){const n={enabled:!0,workingColorSpace:cs,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Pt&&(r.r=pi(r.r),r.g=pi(r.g),r.b=pi(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Pt&&(r.r=Ir(r.r),r.g=Ir(r.g),r.b=Ir(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Pi?xa:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return yl("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return yl("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[cs]:{primaries:e,whitePoint:i,transfer:xa,toXYZ:Ru,fromXYZ:Cu,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Tn},outputColorSpaceConfig:{drawingBufferColorSpace:Tn}},[Tn]:{primaries:e,whitePoint:i,transfer:Pt,toXYZ:Ru,fromXYZ:Cu,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Tn}}}),n}const Et=jg();function pi(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ir(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let lr;class qg{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{lr===void 0&&(lr=ba("canvas")),lr.width=e.width,lr.height=e.height;const r=lr.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=lr}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=ba("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=pi(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(pi(t[i]/255)*255):t[i]=pi(t[i]);return{data:t,width:e.width,height:e.height}}else return ut("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Kg=0;class yc{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Kg++}),this.uuid=vs(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(qa(r[a].image)):s.push(qa(r[a]))}else s=qa(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function qa(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?qg.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(ut("Texture: Unable to serialize Texture."),{})}let Zg=0;const Ka=new ne;class dn extends ki{constructor(e=dn.DEFAULT_IMAGE,t=dn.DEFAULT_MAPPING,i=Vn,r=Vn,s=Zt,a=Li,o=Hn,l=wn,c=dn.DEFAULT_ANISOTROPY,d=Pi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Zg++}),this.uuid=vs(),this.name="",this.source=new yc(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new ht(0,0),this.repeat=new ht(1,1),this.center=new ht(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ft,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Ka).x}get height(){return this.source.getSize(Ka).y}get depth(){return this.source.getSize(Ka).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(i===void 0){ut(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ut(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Dh)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Go:e.x=e.x-Math.floor(e.x);break;case Vn:e.x=e.x<0?0:1;break;case Wo:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Go:e.y=e.y-Math.floor(e.y);break;case Vn:e.y=e.y<0?0:1;break;case Wo:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}dn.DEFAULT_IMAGE=null;dn.DEFAULT_MAPPING=Dh;dn.DEFAULT_ANISOTROPY=1;const Jc=class Jc{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],d=l[4],h=l[8],f=l[1],p=l[5],v=l[9],S=l[2],g=l[6],m=l[10];if(Math.abs(d-f)<.01&&Math.abs(h-S)<.01&&Math.abs(v-g)<.01){if(Math.abs(d+f)<.1&&Math.abs(h+S)<.1&&Math.abs(v+g)<.1&&Math.abs(c+p+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(c+1)/2,w=(p+1)/2,R=(m+1)/2,y=(d+f)/4,L=(h+S)/4,_=(v+g)/4;return M>w&&M>R?M<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(M),r=y/i,s=L/i):w>R?w<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(w),i=y/r,s=_/r):R<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),i=L/s,r=_/s),this.set(i,r,s,t),this}let x=Math.sqrt((g-v)*(g-v)+(h-S)*(h-S)+(f-d)*(f-d));return Math.abs(x)<.001&&(x=1),this.x=(g-v)/x,this.y=(h-S)/x,this.z=(f-d)/x,this.w=Math.acos((c+p+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=bt(this.x,e.x,t.x),this.y=bt(this.y,e.y,t.y),this.z=bt(this.z,e.z,t.z),this.w=bt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=bt(this.x,e,t),this.y=bt(this.y,e,t),this.z=bt(this.z,e,t),this.w=bt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(bt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Jc.prototype.isVector4=!0;let Wt=Jc;class $g extends ki{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Zt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new dn(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:Zt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new yc(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ei extends $g{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class kh extends dn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=on,this.minFilter=on,this.wrapR=Vn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Jg extends dn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=on,this.minFilter=on,this.wrapR=Vn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Ma=class Ma{constructor(e,t,i,r,s,a,o,l,c,d,h,f,p,v,S,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,d,h,f,p,v,S,g)}set(e,t,i,r,s,a,o,l,c,d,h,f,p,v,S,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=r,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=d,m[10]=h,m[14]=f,m[3]=p,m[7]=v,m[11]=S,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ma().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/cr.setFromMatrixColumn(e,0).length(),s=1/cr.setFromMatrixColumn(e,1).length(),a=1/cr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=a*d,p=a*h,v=o*d,S=o*h;t[0]=l*d,t[4]=-l*h,t[8]=c,t[1]=p+v*c,t[5]=f-S*c,t[9]=-o*l,t[2]=S-f*c,t[6]=v+p*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*d,p=l*h,v=c*d,S=c*h;t[0]=f+S*o,t[4]=v*o-p,t[8]=a*c,t[1]=a*h,t[5]=a*d,t[9]=-o,t[2]=p*o-v,t[6]=S+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*d,p=l*h,v=c*d,S=c*h;t[0]=f-S*o,t[4]=-a*h,t[8]=v+p*o,t[1]=p+v*o,t[5]=a*d,t[9]=S-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*d,p=a*h,v=o*d,S=o*h;t[0]=l*d,t[4]=v*c-p,t[8]=f*c+S,t[1]=l*h,t[5]=S*c+f,t[9]=p*c-v,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,p=a*c,v=o*l,S=o*c;t[0]=l*d,t[4]=S-f*h,t[8]=v*h+p,t[1]=h,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*h+v,t[10]=f-S*h}else if(e.order==="XZY"){const f=a*l,p=a*c,v=o*l,S=o*c;t[0]=l*d,t[4]=-h,t[8]=c*d,t[1]=f*h+S,t[5]=a*d,t[9]=p*h-v,t[2]=v*h-p,t[6]=o*d,t[10]=S*h+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Qg,e,ev)}lookAt(e,t,i){const r=this.elements;return Mn.subVectors(e,t),Mn.lengthSq()===0&&(Mn.z=1),Mn.normalize(),Mi.crossVectors(i,Mn),Mi.lengthSq()===0&&(Math.abs(i.z)===1?Mn.x+=1e-4:Mn.z+=1e-4,Mn.normalize(),Mi.crossVectors(i,Mn)),Mi.normalize(),ws.crossVectors(Mn,Mi),r[0]=Mi.x,r[4]=ws.x,r[8]=Mn.x,r[1]=Mi.y,r[5]=ws.y,r[9]=Mn.y,r[2]=Mi.z,r[6]=ws.z,r[10]=Mn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],d=i[1],h=i[5],f=i[9],p=i[13],v=i[2],S=i[6],g=i[10],m=i[14],x=i[3],M=i[7],w=i[11],R=i[15],y=r[0],L=r[4],_=r[8],E=r[12],I=r[1],P=r[5],z=r[9],W=r[13],H=r[2],N=r[6],D=r[10],V=r[14],B=r[3],K=r[7],G=r[11],te=r[15];return s[0]=a*y+o*I+l*H+c*B,s[4]=a*L+o*P+l*N+c*K,s[8]=a*_+o*z+l*D+c*G,s[12]=a*E+o*W+l*V+c*te,s[1]=d*y+h*I+f*H+p*B,s[5]=d*L+h*P+f*N+p*K,s[9]=d*_+h*z+f*D+p*G,s[13]=d*E+h*W+f*V+p*te,s[2]=v*y+S*I+g*H+m*B,s[6]=v*L+S*P+g*N+m*K,s[10]=v*_+S*z+g*D+m*G,s[14]=v*E+S*W+g*V+m*te,s[3]=x*y+M*I+w*H+R*B,s[7]=x*L+M*P+w*N+R*K,s[11]=x*_+M*z+w*D+R*G,s[15]=x*E+M*W+w*V+R*te,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],h=e[6],f=e[10],p=e[14],v=e[3],S=e[7],g=e[11],m=e[15],x=l*p-c*f,M=o*p-c*h,w=o*f-l*h,R=a*p-c*d,y=a*f-l*d,L=a*h-o*d;return t*(S*x-g*M+m*w)-i*(v*x-g*R+m*y)+r*(v*M-S*R+m*L)-s*(v*w-S*y+g*L)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],h=e[9],f=e[10],p=e[11],v=e[12],S=e[13],g=e[14],m=e[15],x=t*o-i*a,M=t*l-r*a,w=t*c-s*a,R=i*l-r*o,y=i*c-s*o,L=r*c-s*l,_=d*S-h*v,E=d*g-f*v,I=d*m-p*v,P=h*g-f*S,z=h*m-p*S,W=f*m-p*g,H=x*W-M*z+w*P+R*I-y*E+L*_;if(H===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/H;return e[0]=(o*W-l*z+c*P)*N,e[1]=(r*z-i*W-s*P)*N,e[2]=(S*L-g*y+m*R)*N,e[3]=(f*y-h*L-p*R)*N,e[4]=(l*I-a*W-c*E)*N,e[5]=(t*W-r*I+s*E)*N,e[6]=(g*w-v*L-m*M)*N,e[7]=(d*L-f*w+p*M)*N,e[8]=(a*z-o*I+c*_)*N,e[9]=(i*I-t*z-s*_)*N,e[10]=(v*y-S*w+m*x)*N,e[11]=(h*w-d*y-p*x)*N,e[12]=(o*E-a*P-l*_)*N,e[13]=(t*P-i*E+r*_)*N,e[14]=(S*M-v*R-g*x)*N,e[15]=(d*R-h*M+f*x)*N,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,d=a+a,h=o+o,f=s*c,p=s*d,v=s*h,S=a*d,g=a*h,m=o*h,x=l*c,M=l*d,w=l*h,R=i.x,y=i.y,L=i.z;return r[0]=(1-(S+m))*R,r[1]=(p+w)*R,r[2]=(v-M)*R,r[3]=0,r[4]=(p-w)*y,r[5]=(1-(f+m))*y,r[6]=(g+x)*y,r[7]=0,r[8]=(v+M)*L,r[9]=(g-x)*L,r[10]=(1-(f+S))*L,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=cr.set(r[0],r[1],r[2]).length();const o=cr.set(r[4],r[5],r[6]).length(),l=cr.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Fn.copy(this);const c=1/a,d=1/o,h=1/l;return Fn.elements[0]*=c,Fn.elements[1]*=c,Fn.elements[2]*=c,Fn.elements[4]*=d,Fn.elements[5]*=d,Fn.elements[6]*=d,Fn.elements[8]*=h,Fn.elements[9]*=h,Fn.elements[10]*=h,t.setFromRotationMatrix(Fn),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=Jn,l=!1){const c=this.elements,d=2*s/(t-e),h=2*s/(i-r),f=(t+e)/(t-e),p=(i+r)/(i-r);let v,S;if(l)v=s/(a-s),S=a*s/(a-s);else if(o===Jn)v=-(a+s)/(a-s),S=-2*a*s/(a-s);else if(o===us)v=-a/(a-s),S=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=h,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=S,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=Jn,l=!1){const c=this.elements,d=2/(t-e),h=2/(i-r),f=-(t+e)/(t-e),p=-(i+r)/(i-r);let v,S;if(l)v=1/(a-s),S=a/(a-s);else if(o===Jn)v=-2/(a-s),S=-(a+s)/(a-s);else if(o===us)v=-1/(a-s),S=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=h,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=v,c[14]=S,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};Ma.prototype.isMatrix4=!0;let Xt=Ma;const cr=new ne,Fn=new Xt,Qg=new ne(0,0,0),ev=new ne(1,1,1),Mi=new ne,ws=new ne,Mn=new ne,Pu=new Xt,Du=new Oi;class Bi{constructor(e=0,t=0,i=0,r=Bi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],d=r[9],h=r[2],f=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(bt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-bt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(bt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-bt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(bt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-bt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,p),this._y=0);break;default:ut("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Pu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Pu,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Du.setFromEuler(this),this.setFromQuaternion(Du,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Bi.DEFAULT_ORDER="XYZ";class Mc{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let tv=0;const Lu=new ne,ur=new Oi,ri=new Xt,As=new ne,Gr=new ne,nv=new ne,iv=new Oi,Iu=new ne(1,0,0),Nu=new ne(0,1,0),Uu=new ne(0,0,1),Fu={type:"added"},rv={type:"removed"},dr={type:"childadded",child:null},Za={type:"childremoved",child:null};class hn extends ki{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:tv++}),this.uuid=vs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=hn.DEFAULT_UP.clone();const e=new ne,t=new Bi,i=new Oi,r=new ne(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Xt},normalMatrix:{value:new ft}}),this.matrix=new Xt,this.matrixWorld=new Xt,this.matrixAutoUpdate=hn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Mc,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ur.setFromAxisAngle(e,t),this.quaternion.multiply(ur),this}rotateOnWorldAxis(e,t){return ur.setFromAxisAngle(e,t),this.quaternion.premultiply(ur),this}rotateX(e){return this.rotateOnAxis(Iu,e)}rotateY(e){return this.rotateOnAxis(Nu,e)}rotateZ(e){return this.rotateOnAxis(Uu,e)}translateOnAxis(e,t){return Lu.copy(e).applyQuaternion(this.quaternion),this.position.add(Lu.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Iu,e)}translateY(e){return this.translateOnAxis(Nu,e)}translateZ(e){return this.translateOnAxis(Uu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ri.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?As.copy(e):As.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Gr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ri.lookAt(Gr,As,this.up):ri.lookAt(As,Gr,this.up),this.quaternion.setFromRotationMatrix(ri),r&&(ri.extractRotation(r.matrixWorld),ur.setFromRotationMatrix(ri),this.quaternion.premultiply(ur.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Mt("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Fu),dr.child=e,this.dispatchEvent(dr),dr.child=null):Mt("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rv),Za.child=e,this.dispatchEvent(Za),Za.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ri.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ri.multiply(e.parent.matrixWorld)),e.applyMatrix4(ri),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Fu),dr.child=e,this.dispatchEvent(dr),dr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,e,nv),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,iv,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),h=a(e.shapes),f=a(e.skeletons),p=a(e.animations),v=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),h.length>0&&(i.shapes=h),f.length>0&&(i.skeletons=f),p.length>0&&(i.animations=p),v.length>0&&(i.nodes=v)}return i.object=r,i;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}hn.DEFAULT_UP=new ne(0,1,0);hn.DEFAULT_MATRIX_AUTO_UPDATE=!0;hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let Rs=class extends hn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const sv={type:"move"};class $a{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Rs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Rs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ne,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ne),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Rs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ne,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ne,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const S of e.hand.values()){const g=t.getJointPose(S,i),m=this._getHandJoint(c,S);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const d=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=d.position.distanceTo(h.position),p=.02,v=.005;c.inputState.pinching&&f>p+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(sv)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Rs;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const Vh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ei={h:0,s:0,l:0},Cs={h:0,s:0,l:0};function Ja(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ot{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Tn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Et.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=Et.workingColorSpace){return this.r=e,this.g=t,this.b=i,Et.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=Et.workingColorSpace){if(e=Xg(e,1),t=bt(t,0,1),i=bt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Ja(a,s,e+1/3),this.g=Ja(a,s,e),this.b=Ja(a,s,e-1/3)}return Et.colorSpaceToWorking(this,r),this}setStyle(e,t=Tn){function i(s){s!==void 0&&parseFloat(s)<1&&ut("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ut("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);ut("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Tn){const i=Vh[e.toLowerCase()];return i!==void 0?this.setHex(i,t):ut("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=pi(e.r),this.g=pi(e.g),this.b=pi(e.b),this}copyLinearToSRGB(e){return this.r=Ir(e.r),this.g=Ir(e.g),this.b=Ir(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Tn){return Et.workingToColorSpace(un.copy(this),e),Math.round(bt(un.r*255,0,255))*65536+Math.round(bt(un.g*255,0,255))*256+Math.round(bt(un.b*255,0,255))}getHexString(e=Tn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Et.workingColorSpace){Et.workingToColorSpace(un.copy(this),t);const i=un.r,r=un.g,s=un.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=d<=.5?h/(a+o):h/(2-a-o),a){case i:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-i)/h+2;break;case s:l=(i-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=Et.workingColorSpace){return Et.workingToColorSpace(un.copy(this),t),e.r=un.r,e.g=un.g,e.b=un.b,e}getStyle(e=Tn){Et.workingToColorSpace(un.copy(this),e);const t=un.r,i=un.g,r=un.b;return e!==Tn?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(Ei),this.setHSL(Ei.h+e,Ei.s+t,Ei.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Ei),e.getHSL(Cs);const i=Xa(Ei.h,Cs.h,t),r=Xa(Ei.s,Cs.s,t),s=Xa(Ei.l,Cs.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const un=new ot;ot.NAMES=Vh;class av extends hn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Bi,this.environmentIntensity=1,this.environmentRotation=new Bi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const On=new ne,si=new ne,Qa=new ne,ai=new ne,hr=new ne,fr=new ne,Ou=new ne,eo=new ne,to=new ne,no=new ne,io=new Wt,ro=new Wt,so=new Wt;class kn{constructor(e=new ne,t=new ne,i=new ne){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),On.subVectors(e,t),r.cross(On);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){On.subVectors(r,t),si.subVectors(i,t),Qa.subVectors(e,t);const a=On.dot(On),o=On.dot(si),l=On.dot(Qa),c=si.dot(si),d=si.dot(Qa),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const f=1/h,p=(c*l-o*d)*f,v=(a*d-o*l)*f;return s.set(1-p-v,v,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,ai)===null?!1:ai.x>=0&&ai.y>=0&&ai.x+ai.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,ai)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ai.x),l.addScaledVector(a,ai.y),l.addScaledVector(o,ai.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return io.setScalar(0),ro.setScalar(0),so.setScalar(0),io.fromBufferAttribute(e,t),ro.fromBufferAttribute(e,i),so.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(io,s.x),a.addScaledVector(ro,s.y),a.addScaledVector(so,s.z),a}static isFrontFacing(e,t,i,r){return On.subVectors(i,t),si.subVectors(e,t),On.cross(si).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return On.subVectors(this.c,this.b),si.subVectors(this.a,this.b),On.cross(si).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return kn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return kn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return kn.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return kn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return kn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;hr.subVectors(r,i),fr.subVectors(s,i),eo.subVectors(e,i);const l=hr.dot(eo),c=fr.dot(eo);if(l<=0&&c<=0)return t.copy(i);to.subVectors(e,r);const d=hr.dot(to),h=fr.dot(to);if(d>=0&&h<=d)return t.copy(r);const f=l*h-d*c;if(f<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(i).addScaledVector(hr,a);no.subVectors(e,s);const p=hr.dot(no),v=fr.dot(no);if(v>=0&&p<=v)return t.copy(s);const S=p*c-l*v;if(S<=0&&c>=0&&v<=0)return o=c/(c-v),t.copy(i).addScaledVector(fr,o);const g=d*v-p*h;if(g<=0&&h-d>=0&&p-v>=0)return Ou.subVectors(s,r),o=(h-d)/(h-d+(p-v)),t.copy(r).addScaledVector(Ou,o);const m=1/(g+S+f);return a=S*m,o=f*m,t.copy(i).addScaledVector(hr,a).addScaledVector(fr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class _i{constructor(e=new ne(1/0,1/0,1/0),t=new ne(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Bn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Bn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Bn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Bn):Bn.fromBufferAttribute(s,a),Bn.applyMatrix4(e.matrixWorld),this.expandByPoint(Bn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ps.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Ps.copy(i.boundingBox)),Ps.applyMatrix4(e.matrixWorld),this.union(Ps)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Bn),Bn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Wr),Ds.subVectors(this.max,Wr),pr.subVectors(e.a,Wr),mr.subVectors(e.b,Wr),gr.subVectors(e.c,Wr),Ti.subVectors(mr,pr),wi.subVectors(gr,mr),Gi.subVectors(pr,gr);let t=[0,-Ti.z,Ti.y,0,-wi.z,wi.y,0,-Gi.z,Gi.y,Ti.z,0,-Ti.x,wi.z,0,-wi.x,Gi.z,0,-Gi.x,-Ti.y,Ti.x,0,-wi.y,wi.x,0,-Gi.y,Gi.x,0];return!ao(t,pr,mr,gr,Ds)||(t=[1,0,0,0,1,0,0,0,1],!ao(t,pr,mr,gr,Ds))?!1:(Ls.crossVectors(Ti,wi),t=[Ls.x,Ls.y,Ls.z],ao(t,pr,mr,gr,Ds))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Bn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Bn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(oi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),oi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),oi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),oi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),oi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),oi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),oi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),oi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(oi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const oi=[new ne,new ne,new ne,new ne,new ne,new ne,new ne,new ne],Bn=new ne,Ps=new _i,pr=new ne,mr=new ne,gr=new ne,Ti=new ne,wi=new ne,Gi=new ne,Wr=new ne,Ds=new ne,Ls=new ne,Wi=new ne;function ao(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){Wi.fromArray(n,s);const o=r.x*Math.abs(Wi.x)+r.y*Math.abs(Wi.y)+r.z*Math.abs(Wi.z),l=e.dot(Wi),c=t.dot(Wi),d=i.dot(Wi);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const di=ov();function ov(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function lv(n){Math.abs(n)>65504&&ut("DataUtils.toHalfFloat(): Value out of range."),n=bt(n,-65504,65504),di.floatView[0]=n;const e=di.uint32View[0],t=e>>23&511;return di.baseTable[t]+((e&8388607)>>di.shiftTable[t])}function cv(n){const e=n>>10;return di.uint32View[0]=di.mantissaTable[di.offsetTable[e]+(n&1023)]+di.exponentTable[e],di.floatView[0]}class Is{static toHalfFloat(e){return lv(e)}static fromHalfFloat(e){return cv(e)}}const Jt=new ne,Ns=new ht;let uv=0;class bn extends ki{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:uv++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Mu,this.updateRanges=[],this.gpuType=An,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Ns.fromBufferAttribute(this,t),Ns.applyMatrix3(e),this.setXY(t,Ns.x,Ns.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Jt.fromBufferAttribute(this,t),Jt.applyMatrix3(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Jt.fromBufferAttribute(this,t),Jt.applyMatrix4(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Jt.fromBufferAttribute(this,t),Jt.applyNormalMatrix(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Jt.fromBufferAttribute(this,t),Jt.transformDirection(e),this.setXYZ(t,Jt.x,Jt.y,Jt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=Hr(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=gn(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Hr(t,this.array)),t}setX(e,t){return this.normalized&&(t=gn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Hr(t,this.array)),t}setY(e,t){return this.normalized&&(t=gn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Hr(t,this.array)),t}setZ(e,t){return this.normalized&&(t=gn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Hr(t,this.array)),t}setW(e,t){return this.normalized&&(t=gn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=gn(t,this.array),i=gn(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=gn(t,this.array),i=gn(i,this.array),r=gn(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=gn(t,this.array),i=gn(i,this.array),r=gn(r,this.array),s=gn(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Mu&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Hh extends bn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class Gh extends bn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class mi extends bn{constructor(e,t,i){super(new Float32Array(e),t,i)}}const dv=new _i,Xr=new ne,oo=new ne;class Ec{constructor(e=new ne,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):dv.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Xr.subVectors(e,this.center);const t=Xr.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Xr,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(oo.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xr.copy(e.center).add(oo)),this.expandByPoint(Xr.copy(e.center).sub(oo))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let hv=0;const Pn=new Xt,lo=new hn,vr=new ne,En=new _i,Yr=new _i,nn=new ne;class Xn extends ki{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:hv++}),this.uuid=vs(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Vg(e)?Gh:Hh)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new ft().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Pn.makeRotationFromQuaternion(e),this.applyMatrix4(Pn),this}rotateX(e){return Pn.makeRotationX(e),this.applyMatrix4(Pn),this}rotateY(e){return Pn.makeRotationY(e),this.applyMatrix4(Pn),this}rotateZ(e){return Pn.makeRotationZ(e),this.applyMatrix4(Pn),this}translate(e,t,i){return Pn.makeTranslation(e,t,i),this.applyMatrix4(Pn),this}scale(e,t,i){return Pn.makeScale(e,t,i),this.applyMatrix4(Pn),this}lookAt(e){return lo.lookAt(e),lo.updateMatrix(),this.applyMatrix4(lo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(vr).negate(),this.translate(vr.x,vr.y,vr.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new mi(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&ut("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _i);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Mt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ne(-1/0,-1/0,-1/0),new ne(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];En.setFromBufferAttribute(s),this.morphTargetsRelative?(nn.addVectors(this.boundingBox.min,En.min),this.boundingBox.expandByPoint(nn),nn.addVectors(this.boundingBox.max,En.max),this.boundingBox.expandByPoint(nn)):(this.boundingBox.expandByPoint(En.min),this.boundingBox.expandByPoint(En.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Mt('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ec);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Mt("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ne,1/0);return}if(e){const i=this.boundingSphere.center;if(En.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Yr.setFromBufferAttribute(o),this.morphTargetsRelative?(nn.addVectors(En.min,Yr.min),En.expandByPoint(nn),nn.addVectors(En.max,Yr.max),En.expandByPoint(nn)):(En.expandByPoint(Yr.min),En.expandByPoint(Yr.max))}En.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)nn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(nn));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)nn.fromBufferAttribute(o,c),l&&(vr.fromBufferAttribute(e,c),nn.add(vr)),r=Math.max(r,i.distanceToSquared(nn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Mt('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Mt("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new bn(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let _=0;_<i.count;_++)o[_]=new ne,l[_]=new ne;const c=new ne,d=new ne,h=new ne,f=new ht,p=new ht,v=new ht,S=new ne,g=new ne;function m(_,E,I){c.fromBufferAttribute(i,_),d.fromBufferAttribute(i,E),h.fromBufferAttribute(i,I),f.fromBufferAttribute(s,_),p.fromBufferAttribute(s,E),v.fromBufferAttribute(s,I),d.sub(c),h.sub(c),p.sub(f),v.sub(f);const P=1/(p.x*v.y-v.x*p.y);isFinite(P)&&(S.copy(d).multiplyScalar(v.y).addScaledVector(h,-p.y).multiplyScalar(P),g.copy(h).multiplyScalar(p.x).addScaledVector(d,-v.x).multiplyScalar(P),o[_].add(S),o[E].add(S),o[I].add(S),l[_].add(g),l[E].add(g),l[I].add(g))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let _=0,E=x.length;_<E;++_){const I=x[_],P=I.start,z=I.count;for(let W=P,H=P+z;W<H;W+=3)m(e.getX(W+0),e.getX(W+1),e.getX(W+2))}const M=new ne,w=new ne,R=new ne,y=new ne;function L(_){R.fromBufferAttribute(r,_),y.copy(R);const E=o[_];M.copy(E),M.sub(R.multiplyScalar(R.dot(E))).normalize(),w.crossVectors(y,E);const P=w.dot(l[_])<0?-1:1;a.setXYZW(_,M.x,M.y,M.z,P)}for(let _=0,E=x.length;_<E;++_){const I=x[_],P=I.start,z=I.count;for(let W=P,H=P+z;W<H;W+=3)L(e.getX(W+0)),L(e.getX(W+1)),L(e.getX(W+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new bn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let f=0,p=i.count;f<p;f++)i.setXYZ(f,0,0,0);const r=new ne,s=new ne,a=new ne,o=new ne,l=new ne,c=new ne,d=new ne,h=new ne;if(e)for(let f=0,p=e.count;f<p;f+=3){const v=e.getX(f+0),S=e.getX(f+1),g=e.getX(f+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,S),a.fromBufferAttribute(t,g),d.subVectors(a,s),h.subVectors(r,s),d.cross(h),o.fromBufferAttribute(i,v),l.fromBufferAttribute(i,S),c.fromBufferAttribute(i,g),o.add(d),l.add(d),c.add(d),i.setXYZ(v,o.x,o.y,o.z),i.setXYZ(S,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let f=0,p=t.count;f<p;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),d.subVectors(a,s),h.subVectors(r,s),d.cross(h),i.setXYZ(f+0,d.x,d.y,d.z),i.setXYZ(f+1,d.x,d.y,d.z),i.setXYZ(f+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)nn.fromBufferAttribute(e,t),nn.normalize(),e.setXYZ(t,nn.x,nn.y,nn.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,h=o.normalized,f=new c.constructor(l.length*d);let p=0,v=0;for(let S=0,g=l.length;S<g;S++){o.isInterleavedBufferAttribute?p=l[S]*o.data.stride+o.offset:p=l[S]*d;for(let m=0;m<d;m++)f[v++]=c[p++]}return new bn(f,d,h)}if(this.index===null)return ut("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Xn,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,h=c.length;d<h;d++){const f=c[d],p=e(f,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let h=0,f=c.length;h<f;h++){const p=c[h];d.push(p.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],h=s[c];for(let f=0,p=h.length;f<p;f++)d.push(h[f].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let fv=0;class kr extends ki{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:fv++}),this.uuid=vs(),this.name="",this.type="Material",this.blending=Lr,this.side=Sn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=No,this.blendDst=Uo,this.blendEquation=ji,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ot(0,0,0),this.blendAlpha=0,this.depthFunc=Ur,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=yu,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=or,this.stencilZFail=or,this.stencilZPass=or,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){ut(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){ut(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Lr&&(i.blending=this.blending),this.side!==Sn&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==No&&(i.blendSrc=this.blendSrc),this.blendDst!==Uo&&(i.blendDst=this.blendDst),this.blendEquation!==ji&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Ur&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==yu&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==or&&(i.stencilFail=this.stencilFail),this.stencilZFail!==or&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==or&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const li=new ne,co=new ne,Us=new ne,Ai=new ne,uo=new ne,Fs=new ne,ho=new ne;class Tc{constructor(e=new ne,t=new ne(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,li)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=li.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(li.copy(this.origin).addScaledVector(this.direction,t),li.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){co.copy(e).add(t).multiplyScalar(.5),Us.copy(t).sub(e).normalize(),Ai.copy(this.origin).sub(co);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Us),o=Ai.dot(this.direction),l=-Ai.dot(Us),c=Ai.lengthSq(),d=Math.abs(1-a*a);let h,f,p,v;if(d>0)if(h=a*l-o,f=a*o-l,v=s*d,h>=0)if(f>=-v)if(f<=v){const S=1/d;h*=S,f*=S,p=h*(h+a*f+2*o)+f*(a*h+f+2*l)+c}else f=s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f<=-v?(h=Math.max(0,-(-a*s+o)),f=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c):f<=v?(h=0,f=Math.min(Math.max(-s,-l),s),p=f*(f+2*l)+c):(h=Math.max(0,-(a*s+o)),f=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c);else f=a>0?-s:s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(co).addScaledVector(Us,f),p}intersectSphere(e,t){li.subVectors(e.center,this.origin);const i=li.dot(this.direction),r=li.dot(li)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),d>=0?(s=(e.min.y-f.y)*d,a=(e.max.y-f.y)*d):(s=(e.max.y-f.y)*d,a=(e.min.y-f.y)*d),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),h>=0?(o=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(o=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,li)!==null}intersectTriangle(e,t,i,r,s){uo.subVectors(t,e),Fs.subVectors(i,e),ho.crossVectors(uo,Fs);let a=this.direction.dot(ho),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Ai.subVectors(this.origin,e);const l=o*this.direction.dot(Fs.crossVectors(Ai,Fs));if(l<0)return null;const c=o*this.direction.dot(uo.cross(Ai));if(c<0||l+c>a)return null;const d=-o*Ai.dot(ho);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Wh extends kr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=Eh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Bu=new Xt,Xi=new Tc,Os=new Ec,zu=new ne,Bs=new ne,zs=new ne,ks=new ne,fo=new ne,Vs=new ne,ku=new ne,Hs=new ne;class sn extends hn{constructor(e=new Xn,t=new Wh){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Vs.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],h=s[l];d!==0&&(fo.fromBufferAttribute(h,e),a?Vs.addScaledVector(fo,d):Vs.addScaledVector(fo.sub(t),d))}t.add(Vs)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Os.copy(i.boundingSphere),Os.applyMatrix4(s),Xi.copy(e.ray).recast(e.near),!(Os.containsPoint(Xi.origin)===!1&&(Xi.intersectSphere(Os,zu)===null||Xi.origin.distanceToSquared(zu)>(e.far-e.near)**2))&&(Bu.copy(s).invert(),Xi.copy(e.ray).applyMatrix4(Bu),!(i.boundingBox!==null&&Xi.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Xi)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,h=s.attributes.normal,f=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let v=0,S=f.length;v<S;v++){const g=f[v],m=a[g.materialIndex],x=Math.max(g.start,p.start),M=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let w=x,R=M;w<R;w+=3){const y=o.getX(w),L=o.getX(w+1),_=o.getX(w+2);r=Gs(this,m,e,i,c,d,h,y,L,_),r&&(r.faceIndex=Math.floor(w/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const v=Math.max(0,p.start),S=Math.min(o.count,p.start+p.count);for(let g=v,m=S;g<m;g+=3){const x=o.getX(g),M=o.getX(g+1),w=o.getX(g+2);r=Gs(this,a,e,i,c,d,h,x,M,w),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let v=0,S=f.length;v<S;v++){const g=f[v],m=a[g.materialIndex],x=Math.max(g.start,p.start),M=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let w=x,R=M;w<R;w+=3){const y=w,L=w+1,_=w+2;r=Gs(this,m,e,i,c,d,h,y,L,_),r&&(r.faceIndex=Math.floor(w/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{const v=Math.max(0,p.start),S=Math.min(l.count,p.start+p.count);for(let g=v,m=S;g<m;g+=3){const x=g,M=g+1,w=g+2;r=Gs(this,a,e,i,c,d,h,x,M,w),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}}function pv(n,e,t,i,r,s,a,o){let l;if(e.side===xn?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===Sn,o),l===null)return null;Hs.copy(o),Hs.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(Hs);return c<t.near||c>t.far?null:{distance:c,point:Hs.clone(),object:n}}function Gs(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Bs),n.getVertexPosition(l,zs),n.getVertexPosition(c,ks);const d=pv(n,e,t,i,Bs,zs,ks,ku);if(d){const h=new ne;kn.getBarycoord(ku,Bs,zs,ks,h),r&&(d.uv=kn.getInterpolatedAttribute(r,o,l,c,h,new ht)),s&&(d.uv1=kn.getInterpolatedAttribute(s,o,l,c,h,new ht)),a&&(d.normal=kn.getInterpolatedAttribute(a,o,l,c,h,new ne),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new ne,materialIndex:0};kn.getNormal(Bs,zs,ks,f.normal),d.face=f,d.barycoord=h}return d}class Xh extends dn{constructor(e=null,t=1,i=1,r,s,a,o,l,c=on,d=on,h,f){super(null,a,o,l,c,d,r,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const po=new ne,mv=new ne,gv=new ft;class Ci{constructor(e=new ne(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=po.subVectors(i,t).cross(mv.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){const r=e.delta(po),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||gv.getNormalMatrix(e),r=this.coplanarPoint(po).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Yi=new Ec,vv=new ht(.5,.5),Ws=new ne;class wc{constructor(e=new Ci,t=new Ci,i=new Ci,r=new Ci,s=new Ci,a=new Ci){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Jn,i=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],h=s[5],f=s[6],p=s[7],v=s[8],S=s[9],g=s[10],m=s[11],x=s[12],M=s[13],w=s[14],R=s[15];if(r[0].setComponents(c-a,p-d,m-v,R-x).normalize(),r[1].setComponents(c+a,p+d,m+v,R+x).normalize(),r[2].setComponents(c+o,p+h,m+S,R+M).normalize(),r[3].setComponents(c-o,p-h,m-S,R-M).normalize(),i)r[4].setComponents(l,f,g,w).normalize(),r[5].setComponents(c-l,p-f,m-g,R-w).normalize();else if(r[4].setComponents(c-l,p-f,m-g,R-w).normalize(),t===Jn)r[5].setComponents(c+l,p+f,m+g,R+w).normalize();else if(t===us)r[5].setComponents(l,f,g,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Yi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Yi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Yi)}intersectsSprite(e){Yi.center.set(0,0,0);const t=vv.distanceTo(e.center);return Yi.radius=.7071067811865476+t,Yi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Yi)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(Ws.x=r.normal.x>0?e.max.x:e.min.x,Ws.y=r.normal.y>0?e.max.y:e.min.y,Ws.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ws)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Yh extends dn{constructor(e=[],t=ir,i,r,s,a,o,l,c,d){super(e,t,i,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Or extends dn{constructor(e,t,i=ti,r,s,a,o=on,l=on,c,d=vi,h=1){if(d!==vi&&d!==Ki)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:t,depth:h};super(f,r,s,a,o,l,d,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new yc(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class _v extends Or{constructor(e,t=ti,i=ir,r,s,a=on,o=on,l,c=vi){const d={width:e,height:e,depth:1},h=[d,d,d,d,d,d];super(e,e,t,i,r,s,a,o,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class jh extends dn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class _s extends Xn{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],h=[];let f=0,p=0;v("z","y","x",-1,-1,i,t,e,a,s,0),v("z","y","x",1,-1,i,t,-e,a,s,1),v("x","z","y",1,1,e,i,t,r,a,2),v("x","z","y",1,-1,e,i,-t,r,a,3),v("x","y","z",1,-1,e,t,i,r,s,4),v("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new mi(c,3)),this.setAttribute("normal",new mi(d,3)),this.setAttribute("uv",new mi(h,2));function v(S,g,m,x,M,w,R,y,L,_,E){const I=w/L,P=R/_,z=w/2,W=R/2,H=y/2,N=L+1,D=_+1;let V=0,B=0;const K=new ne;for(let G=0;G<D;G++){const te=G*P-W;for(let q=0;q<N;q++){const pe=q*I-z;K[S]=pe*x,K[g]=te*M,K[m]=H,c.push(K.x,K.y,K.z),K[S]=0,K[g]=0,K[m]=y>0?1:-1,d.push(K.x,K.y,K.z),h.push(q/L),h.push(1-G/_),V+=1}}for(let G=0;G<_;G++)for(let te=0;te<L;te++){const q=f+te+N*G,pe=f+te+N*(G+1),be=f+(te+1)+N*(G+1),ge=f+(te+1)+N*G;l.push(q,pe,ge),l.push(pe,be,ge),B+=6}o.addGroup(p,B,E),p+=B,f+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _s(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class xs extends Xn{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,h=e/o,f=t/l,p=[],v=[],S=[],g=[];for(let m=0;m<d;m++){const x=m*f-a;for(let M=0;M<c;M++){const w=M*h-s;v.push(w,-x,0),S.push(0,0,1),g.push(M/o),g.push(1-m/l)}}for(let m=0;m<l;m++)for(let x=0;x<o;x++){const M=x+c*m,w=x+c*(m+1),R=x+1+c*(m+1),y=x+1+c*m;p.push(M,w,y),p.push(w,R,y)}this.setIndex(p),this.setAttribute("position",new mi(v,3)),this.setAttribute("normal",new mi(S,3)),this.setAttribute("uv",new mi(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xs(e.width,e.height,e.widthSegments,e.heightSegments)}}function Br(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];if(Vu(r))r.isRenderTargetTexture?(ut("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(Vu(r[0])){const s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function pn(n){const e={};for(let t=0;t<n.length;t++){const i=Br(n[t]);for(const r in i)e[r]=i[r]}return e}function Vu(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function xv(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function qh(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Et.workingColorSpace}const bv={clone:Br,merge:pn};var Sv=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
3
  }`,yv=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );